").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),!0===e||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===e)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),(function(t,e){i[e]="_eventHandler"})),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each((function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))})),this.element.children().not(this.panels).each((function(){i-=t(this).outerHeight(!0)})),this.panels.each((function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))})).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each((function(){i=Math.max(i,t(this).height("").height())})).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget).closest("li"),o=n[0]===s[0],a=o&&i.collapsible,r=a?t():this._getPanelForTab(n),l=s.length?this._getPanelForTab(s):t(),h={oldTab:s,oldPanel:l,newTab:a?t():n,newPanel:r};e.preventDefault(),n.hasClass("ui-state-disabled")||n.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||!1===this._trigger("beforeActivate",e,h)||(i.active=!a&&this.tabs.index(n),this.active=o?t():n,this.xhr&&this.xhr.abort(),l.length||r.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),r.length&&this.load(this.tabs.index(n),e),this._toggle(e,h))},_toggle:function(e,i){var s=this,n=i.newPanel,o=i.oldPanel;function a(){s.running=!1,s._trigger("activate",e,i)}function r(){s._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),n.length&&s.options.show?s._show(n,s.options.show,a):(n.show(),a())}this.running=!0,o.length&&this.options.hide?this._hide(o,this.options.hide,(function(){s._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r()})):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),o.hide(),r()),o.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),n.length&&o.length?i.oldTab.attr("tabIndex",-1):n.length&&this.tabs.filter((function(){return 0===t(this).attr("tabIndex")})).attr("tabIndex",-1),n.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return!1===e?t():this.tabs.eq(e)},_getIndex:function(e){return"string"===typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each((function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")})),this.tabs.each((function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")})),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;!1!==i&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,(function(t){return t!==e?t:null})):t.map(this.tabs,(function(t,i){return i!==e?i:null}))),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(!0!==i){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},l=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done((function(t,e,n){setTimeout((function(){a.html(t),s._trigger("load",i,r),l(n,e)}),1)})).fail((function(t,e){setTimeout((function(){l(t,e)}),1)}))))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),!1!==t.uiBackCompat&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs})?s.apply(e,n):s)||(t.exports=o)},203:function(t,e,i){(function(t){!function(t,e){"use strict";var i;t.rails!==e&&t.error("jquery-ujs has already been loaded!");var s=t(document);t.rails=i={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",buttonClickSelector:"button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",disableSelector:"input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",requiredInputSelector:"input[name][required]:not([disabled]), textarea[name][required]:not([disabled])",fileInputSelector:"input[name][type=file]:not([disabled])",linkDisableSelector:"a[data-disable-with], a[data-disable]",buttonDisableSelector:"button[data-remote][data-disable-with], button[data-remote][data-disable]",csrfToken:function(){return t("meta[name=csrf-token]").attr("content")},csrfParam:function(){return t("meta[name=csrf-param]").attr("content")},CSRFProtection:function(t){var e=i.csrfToken();e&&t.setRequestHeader("X-CSRF-Token",e)},refreshCSRFTokens:function(){t('form input[name="'+i.csrfParam()+'"]').val(i.csrfToken())},fire:function(e,i,s){var n=t.Event(i);return e.trigger(n,s),!1!==n.result},confirm:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return confirm(t)})),ajax:function(e){return t.ajax(e)},href:function(t){return t[0].href},isRemote:function(t){return t.data("remote")!==e&&!1!==t.data("remote")},handleRemote:function(s){var n,o,a,r,l,h;if(i.fire(s,"ajax:before")){if(r=s.data("with-credentials")||null,l=s.data("type")||t.ajaxSettings&&t.ajaxSettings.dataType,s.is("form")){n=s.data("ujs:submit-button-formmethod")||s.attr("method"),o=s.data("ujs:submit-button-formaction")||s.attr("action"),a=t(s[0]).serializeArray();var c=s.data("ujs:submit-button");c&&(a.push(c),s.data("ujs:submit-button",null)),s.data("ujs:submit-button-formmethod",null),s.data("ujs:submit-button-formaction",null)}else s.is(i.inputChangeSelector)?(n=s.data("method"),o=s.data("url"),a=s.serialize(),s.data("params")&&(a=a+"&"+s.data("params"))):s.is(i.buttonClickSelector)?(n=s.data("method")||"get",o=s.data("url"),a=s.serialize(),s.data("params")&&(a=a+"&"+s.data("params"))):(n=s.data("method"),o=i.href(s),a=s.data("params")||null);return h={type:n||"GET",data:a,dataType:l,beforeSend:function(t,n){if(n.dataType===e&&t.setRequestHeader("accept","*/*;q=0.5, "+n.accepts.script),!i.fire(s,"ajax:beforeSend",[t,n]))return!1;s.trigger("ajax:send",t)},success:function(t,e,i){s.trigger("ajax:success",[t,e,i])},complete:function(t,e){s.trigger("ajax:complete",[t,e])},error:function(t,e,i){s.trigger("ajax:error",[t,e,i])},crossDomain:i.isCrossDomain(o)},r&&(h.xhrFields={withCredentials:r}),o&&(h.url=o),i.ajax(h)}return!1},isCrossDomain:function(t){var e=document.createElement("a");e.href=location.href;var i=document.createElement("a");try{return i.href=t,i.href=i.href,!((!i.protocol||":"===i.protocol)&&!i.host||e.protocol+"//"+e.host===i.protocol+"//"+i.host)}catch(s){return!0}},handleMethod:function(s){var n=i.href(s),o=s.data("method"),a=s.attr("target"),r=i.csrfToken(),l=i.csrfParam(),h=t('
'),c='
';l===e||r===e||i.isCrossDomain(n)||(c+='
'),a&&h.attr("target",a),h.hide().append(c).appendTo("body"),h.submit()},formElements:function(e,i){return e.is("form")?t(e[0].elements).filter(i):e.find(i)},disableFormElements:function(e){i.formElements(e,i.disableSelector).each((function(){i.disableFormElement(t(this))}))},disableFormElement:function(t){var i,s;i=t.is("button")?"html":"val",(s=t.data("disable-with"))!==e&&(t.data("ujs:enable-with",t[i]()),t[i](s)),t.prop("disabled",!0),t.data("ujs:disabled",!0)},enableFormElements:function(e){i.formElements(e,i.enableSelector).each((function(){i.enableFormElement(t(this))}))},enableFormElement:function(t){var i=t.is("button")?"html":"val";t.data("ujs:enable-with")!==e&&(t[i](t.data("ujs:enable-with")),t.removeData("ujs:enable-with")),t.prop("disabled",!1),t.removeData("ujs:disabled")},allowAction:function(t){var e,s=t.data("confirm"),n=!1;if(!s)return!0;if(i.fire(t,"confirm")){try{n=i.confirm(s)}catch(o){(console.error||console.log).call(console,o.stack||o)}e=i.fire(t,"confirm:complete",[n])}return n&&e},blankInputs:function(e,i,s){var n,o,a,r=t(),l=i||"input,textarea",h=e.find(l),c={};return h.each((function(){(n=t(this)).is("input[type=radio]")?(a=n.attr("name"),c[a]||(0===e.find('input[type=radio]:checked[name="'+a+'"]').length&&(o=e.find('input[type=radio][name="'+a+'"]'),r=r.add(o)),c[a]=a)):(n.is("input[type=checkbox],input[type=radio]")?n.is(":checked"):!!n.val())===s&&(r=r.add(n))})),!!r.length&&r},nonBlankInputs:function(t,e){return i.blankInputs(t,e,!0)},stopEverything:function(e){return t(e.target).trigger("ujs:everythingStopped"),e.stopImmediatePropagation(),!1},disableElement:function(t){var s=t.data("disable-with");s!==e&&(t.data("ujs:enable-with",t.html()),t.html(s)),t.bind("click.railsDisable",(function(t){return i.stopEverything(t)})),t.data("ujs:disabled",!0)},enableElement:function(t){t.data("ujs:enable-with")!==e&&(t.html(t.data("ujs:enable-with")),t.removeData("ujs:enable-with")),t.unbind("click.railsDisable"),t.removeData("ujs:disabled")}},i.fire(s,"rails:attachBindings")&&(t.ajaxPrefilter((function(t,e,s){t.crossDomain||i.CSRFProtection(s)})),t(window).on("pageshow.rails",(function(){t(t.rails.enableSelector).each((function(){var e=t(this);e.data("ujs:disabled")&&t.rails.enableFormElement(e)})),t(t.rails.linkDisableSelector).each((function(){var e=t(this);e.data("ujs:disabled")&&t.rails.enableElement(e)}))})),s.on("ajax:complete",i.linkDisableSelector,(function(){i.enableElement(t(this))})),s.on("ajax:complete",i.buttonDisableSelector,(function(){i.enableFormElement(t(this))})),s.on("click.rails",i.linkClickSelector,(function(e){var s=t(this),n=s.data("method"),o=s.data("params"),a=e.metaKey||e.ctrlKey;if(!i.allowAction(s))return i.stopEverything(e);if(!a&&s.is(i.linkDisableSelector)&&i.disableElement(s),i.isRemote(s)){if(a&&(!n||"GET"===n)&&!o)return!0;var r=i.handleRemote(s);return!1===r?i.enableElement(s):r.fail((function(){i.enableElement(s)})),!1}return n?(i.handleMethod(s),!1):void 0})),s.on("click.rails",i.buttonClickSelector,(function(e){var s=t(this);if(!i.allowAction(s)||!i.isRemote(s))return i.stopEverything(e);s.is(i.buttonDisableSelector)&&i.disableFormElement(s);var n=i.handleRemote(s);return!1===n?i.enableFormElement(s):n.fail((function(){i.enableFormElement(s)})),!1})),s.on("change.rails",i.inputChangeSelector,(function(e){var s=t(this);return i.allowAction(s)&&i.isRemote(s)?(i.handleRemote(s),!1):i.stopEverything(e)})),s.on("submit.rails",i.formSubmitSelector,(function(s){var n,o,a=t(this),r=i.isRemote(a);if(!i.allowAction(a))return i.stopEverything(s);if(a.attr("novalidate")===e)if(a.data("ujs:formnovalidate-button")===e){if((n=i.blankInputs(a,i.requiredInputSelector,!1))&&i.fire(a,"ajax:aborted:required",[n]))return i.stopEverything(s)}else a.data("ujs:formnovalidate-button",e);if(r){if(o=i.nonBlankInputs(a,i.fileInputSelector)){setTimeout((function(){i.disableFormElements(a)}),13);var l=i.fire(a,"ajax:aborted:file",[o]);return l||setTimeout((function(){i.enableFormElements(a)}),13),l}return i.handleRemote(a),!1}setTimeout((function(){i.disableFormElements(a)}),13)})),s.on("click.rails",i.formInputClickSelector,(function(e){var s=t(this);if(!i.allowAction(s))return i.stopEverything(e);var n=s.attr("name"),o=n?{name:n,value:s.val()}:null,a=s.closest("form");0===a.length&&(a=t("#"+s.attr("form"))),a.data("ujs:submit-button",o),a.data("ujs:formnovalidate-button",s.attr("formnovalidate")),a.data("ujs:submit-button-formaction",s.attr("formaction")),a.data("ujs:submit-button-formmethod",s.attr("formmethod"))})),s.on("ajax:send.rails",i.formSubmitSelector,(function(e){this===e.target&&i.disableFormElements(t(this))})),s.on("ajax:complete.rails",i.formSubmitSelector,(function(e){this===e.target&&i.enableFormElements(t(this))})),t((function(){i.refreshCSRFTokens()})))}(t)}).call(this,i(3))},31:function(t,e,i){var s,n,o;n=[i(3),i(8)],void 0===(o="function"===typeof(s=function(t){var e,i=0,s=Array.prototype.slice;return t.cleanData=(e=t.cleanData,function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{(s=t._data(n,"events"))&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0],h=l+"-"+(e=e.split(".")[1]);return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){if(!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),(a=new i).options=t.widget.extend({},a.options),t.each(s,(function(e,s){t.isFunction(s)?r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}():r[e]=s})),o.prototype=t.widget.extend(a,{widgetEventPrefix:n&&a.widgetEventPrefix||e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,(function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)})),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),a=0,r=o.length;a
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,(function(t,i){e._removeClass(i,t)})),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"===typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;o';for(var o in e){var a,r,l=e[o];if(/^(datepicker|checkbox|text|number)$/.test(l))r="input";else if("textarea"===l)r="textarea";else{if(!s.isArray(l))throw new Error("Unsupported input type: {"+o+": "+l+"}");var h=["select",l,""];r=h[0],a=h[1],l=h[2]}var c="datepicker"===l?l:"";n+="- \n \n <"+r+' name="'+o+'" class="'+c+'" type="'+l+'">'+(a?function(){var t=[];return a.forEach((function(e){var i=s("");s.isArray(e)?i.text(e[0]).val(e[1]):i.text(e),t.push(i.wrap("").parent().html())})),t}().join(""):"")+""+r+">
";var u=[];r=u[0],a=u[1],l=u[2],c=u[3]}var d=s(n+="
").appendTo("body");s("body").trigger("modal_dialog:before_open",[d]),d.dialog({modal:!0,open:function(t,e){s("body").trigger("modal_dialog:after_open",[d])},dialogClass:"active_admin_dialog",buttons:{OK:function(){i(s(this).serializeObject()),s(this).dialog("close")},Cancel:function(){s(this).dialog("close").remove()}}})}s.fn.serializeObject=function(){return this.serializeArray().reduce((function(t,e){return t[e.name]=e.value,t}),{})},s.ui.dialog.prototype._focusTabbable=function(){this.uiDialog.focus()};var i=function(){s(".batch_actions_selector li a").off("click confirm:complete"),s(".batch_actions_selector li a").on("click",(function(t){var i,n=this;t.stopPropagation(),t.preventDefault(),(i=s(this).data("confirm"))?e(i,s(this).data("inputs"),(function(t){s(n).trigger("confirm:complete",t)})):s(this).trigger("confirm:complete")})),s(".batch_actions_selector li a").on("confirm:complete",(function(t,e){var i;(i=JSON.stringify(e))?s("#batch_action_inputs").removeAttr("disabled").val(i):s("#batch_action_inputs").attr("disabled","disabled"),s("#batch_action").val(s(this).data("action")),s("#collection_selection").submit()})),s(".batch_actions_selector").length&&s(":checkbox.toggle_all").length&&(s(".paginated_collection table.index_table").length?s(".paginated_collection table.index_table").tableCheckboxToggler():s(".paginated_collection").checkboxToggler(),s(document).on("change",".paginated_collection :checkbox",(function(){s(".paginated_collection :checkbox:checked").length&&s(".dropdown_menu_list").children().length?s(".batch_actions_selector").each((function(){s(this).aaDropdownMenu("enable")})):s(".batch_actions_selector").each((function(){s(this).aaDropdownMenu("disable")}))})))};s(document).ready(i).on("page:load turbolinks:load",i);var o=function(){function t(t,e){this.options=t,this.container=e,this._init(),this._bind()}var e=t.prototype;return e.option=function(t,e){},e._init=function(){if(!this.container)throw new Error("Container element not found");if(this.$container=s(this.container),!this.$container.find(".toggle_all").length)throw new Error('"toggle all" checkbox not found');this.toggle_all_checkbox=this.$container.find(".toggle_all"),this.checkboxes=this.$container.find(":checkbox").not(this.toggle_all_checkbox)},e._bind=function(){var t=this;this.checkboxes.change((function(e){return t._didChangeCheckbox(e.target)})),this.toggle_all_checkbox.change((function(){return t._didChangeToggleAllCheckbox()}))},e._didChangeCheckbox=function(t){var e=this.checkboxes.filter(":checked").length,i=e===this.checkboxes.length,s=e>0&&e '),this.$menuList.prepend(this.$nipple),this.$menuList.hide()},e._bind=function(){var t=this;s("body").click((function(){t.isOpen&&t.close()})),this.$menuButton.click((function(){return t.isDisabled()||(t.isOpen?t.close():t.open()),!1}))},e._position=function(){this.$menuList.css("top",this.$menuButton.position().top+this.$menuButton.outerHeight()+10);var t=this.$menuButton.position().left,e=this.$menuButton.outerWidth()/2,i=t+2*e,n=this.$menuList.outerWidth()/2,o=this.$nipple.outerWidth()/2,a=s(window).width(),r=t+e-n,l=t+e+n;r<0?(this.$menuList.css("left",t),this.$nipple.css("left",e-o)):l>a?(this.$menuList.css("right",a-i),this.$nipple.css("right",e-o)):(this.$menuList.css("left",r),this.$nipple.css("left",n-o))},t}();s.widget.bridge("aaDropdownMenu",a);var r=function(){return s(".dropdown_menu").aaDropdownMenu()};function l(){return"undefined"!==typeof Turbolinks&&Turbolinks.supported}function h(t){var e=[window.location.pathname,"?",u(t)].join("");Turbolinks.visit(e)}function c(){var t=function(t){return decodeURIComponent((t||"").replace(/\+/g,"%20"))};return(window.location.search||"").replace(/^\?/,"").split("&").map((function(t){return t.split("=")})).map((function(e){var i=e[0],s=e[1];return{name:t(i),value:t(s)}}))}function u(t){var e=function(t){return encodeURIComponent(t||"")};return t.map((function(t){var i=t.name,s=t.value;return[e(i),e(s)]})).map((function(t){return t.join("=")})).join("&")}s(document).ready(r).on("page:load turbolinks:load",r);var d=function(){function t(){}return t._clearForm=function(t){var e=/^(q\[|q%5B|q%5b|page|utf8|commit)/,i=c().filter((function(t){return!t.name.match(e)}));t.preventDefault(),l()?h(i):window.location.search=u(i)},t._disableEmptyInputFields=function(t){var e=s(this).find(":input").filter((function(t,e){return""===e.value})).prop({disabled:!0}).end().serializeArray();l()&&(t.preventDefault(),h(e))},t._setSearchType=function(){s(this).siblings("input").prop({name:"q["+this.value+"]"})},t}();!function(t){t(document).on("click",".clear_filters_btn",d._clearForm).on("submit",".filter_form",d._disableEmptyInputFields).on("change",".filter_form_field.select_and_search select",d._setSearchType)}(n),s((function(){s(document).on("click","a.button.has_many_remove",(function(t){t.preventDefault();var e=s(this).closest(".has_many_container"),i=s(this).closest("fieldset");return f(e),e.trigger("has_many_remove:before",[i,e]),i.remove(),e.trigger("has_many_remove:after",[i,e])})),s(document).on("click","a.button.has_many_add",(function(t){var e;t.preventDefault();var i=s(this).closest(".has_many_container");if(i.trigger(e=s.Event("has_many_add:before"),[i]),!e.isDefaultPrevented()){var n=i.data("has_many_index")||i.children("fieldset").length-1;i.data({has_many_index:++n});var o=new RegExp(s(this).data("placeholder"),"g"),a=s(this).data("html").replace(o,n),r=s(a).insertBefore(this);return f(i),i.trigger("has_many_add:after",[r,i])}})),s(document).on("change",'.has_many_container[data-sortable] :input[name$="[_destroy]"]',(function(){f(s(this).closest(".has_many"))})),p(),s(document).on("has_many_add:after",".has_many_container",p)}));var p=function(){var t=s(".has_many_container[data-sortable]:not(.ui-sortable)");t.sortable({items:"> fieldset",handle:"> ol > .handle",start:function(t,e){e.item.css({opacity:.3})},stop:function(t,e){e.item.css({opacity:1}),f(s(this))}}),t.each(f)},f=function(t){var e=(t=t instanceof n?t:s(this)).data("sortable"),i=parseInt(t.data("sortable-start")||0,10);t.children("fieldset").each((function(){var t=s(this).find("> ol > .input > :input[name$='[_destroy]']"),n=s(this).find("> ol > .input > :input[name$='["+e+"]']");n.length&&n.val(t.is(":checked")?"":i++)}))},g=function(){function t(t){this.element=t}return t.prototype.update=function(){var t=c().filter((function(t){var e=t.name;return"per_page"!=e||"page"!=e}));t.push({name:"per_page",value:this.element.value}),l()?h(t):window.location.search=u(t)},t._jQueryInterface=function(e){return this.each((function(){var i=s(this),n=i.data("perPage");n||(n=new t(this),i.data("perPage",n)),"update"===e&&n[e]()}))},t}();!function(t){t(document).on("change",".pagination_per_page > select",(function(e){g._jQueryInterface.call(t(this),"update")})),t.fn.perPage=g._jQueryInterface,t.fn.perPage.Constructor=g}(n);var m=function(t){var e,i;function n(){return t.apply(this,arguments)||this}i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i;var o=n.prototype;return o._bind=function(){var e=this;t.prototype._bind.apply(this,arguments),this.$container.find("tbody td").click((function(t){"checkbox"!==t.target.type&&e._didClickCell(t.target)}))},o._didChangeCheckbox=function(e){t.prototype._didChangeCheckbox.apply(this,arguments),s(e).parents("tr").toggleClass("selected",e.checked)},o._didChangeToggleAllCheckbox=function(){this.$container.find("tbody tr").toggleClass("selected",t.prototype._didChangeToggleAllCheckbox.apply(this,arguments))},o._didClickCell=function(t){s(t).parent("tr").find(":checkbox").click()},n}(o);s.widget.bridge("tableCheckboxToggler",m);var _=function(){return s("#active_admin_content .tabs").tabs()};s(document).ready(_).on("page:load turbolinks:load",_),t.ModalDialog=e,t.modal_dialog=function(t,i,s){return console.warn("ActiveAdmin.modal_dialog is deprecated in favor of ActiveAdmin.ModalDialog, please update usage."),e(t,i,s)},Object.defineProperty(t,"__esModule",{value:!0})},"object"===h(e)&&"undefined"!==typeof t?l(e,i(3),i(192),i(193),i(201),i(202),i(31),i(203)):(a=[e,i(3),i(192),i(193),i(201),i(202),i(31),i(203)],void 0===(r="function"===typeof(o=l)?o.apply(e,a):o)||(t.exports=r))}).call(this,i(3),i(3))},549:function(t,e,i){var s,n,o;function a(t){return(a="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n=[i(3),i(550),i(551),i(98),i(31)],void 0===(o="function"===typeof(s=function(t){var e;return t.widget("ui.button",{version:"1.12.1",defaultElement:"