stimulus-library 0.6.3 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/controllers/ajax/async_block_controller.d.ts +17 -17
- package/dist/controllers/ajax/index.d.ts +4 -4
- package/dist/controllers/ajax/lazy_block_controller.d.ts +9 -9
- package/dist/controllers/ajax/lazy_block_controller.d.ts.map +1 -1
- package/dist/controllers/ajax/load_block_controller.d.ts +23 -23
- package/dist/controllers/ajax/poll_block_controller.d.ts +15 -15
- package/dist/controllers/anchor_spy_controller.d.ts +20 -26
- package/dist/controllers/anchor_spy_controller.d.ts.map +1 -1
- package/dist/controllers/back_link_controller.d.ts +16 -16
- package/dist/controllers/clipboard_controller.d.ts +18 -18
- package/dist/controllers/confirm_controller.d.ts +12 -12
- package/dist/controllers/confirm_navigation_controller.d.ts +14 -15
- package/dist/controllers/confirm_navigation_controller.d.ts.map +1 -1
- package/dist/controllers/debug_controller.d.ts +6 -6
- package/dist/controllers/disable_with_controller.d.ts +19 -23
- package/dist/controllers/disable_with_controller.d.ts.map +1 -1
- package/dist/controllers/dismissable_controller.d.ts +6 -6
- package/dist/controllers/element_save_controller.d.ts +30 -25
- package/dist/controllers/element_save_controller.d.ts.map +1 -1
- package/dist/controllers/empty_dom_controller.d.ts +21 -29
- package/dist/controllers/empty_dom_controller.d.ts.map +1 -1
- package/dist/controllers/forms/auto_submit_form_controller.d.ts +22 -21
- package/dist/controllers/forms/auto_submit_form_controller.d.ts.map +1 -1
- package/dist/controllers/forms/autosize_controller.d.ts +8 -9
- package/dist/controllers/forms/autosize_controller.d.ts.map +1 -1
- package/dist/controllers/forms/char_count_controller.d.ts +20 -24
- package/dist/controllers/forms/char_count_controller.d.ts.map +1 -1
- package/dist/controllers/forms/checkbox_disable_inputs_controller.d.ts +16 -16
- package/dist/controllers/forms/checkbox_enable_inputs_controller.d.ts +16 -16
- package/dist/controllers/forms/checkbox_select_all_controller.d.ts +13 -13
- package/dist/controllers/forms/checkbox_xor_controller.d.ts +8 -8
- package/dist/controllers/forms/detect_dirty_controller.d.ts +14 -14
- package/dist/controllers/forms/detect_dirty_controller.d.ts.map +1 -1
- package/dist/controllers/forms/detect_dirty_form_controller.d.ts +17 -17
- package/dist/controllers/forms/detect_dirty_form_controller.d.ts.map +1 -1
- package/dist/controllers/forms/enable_inputs_controller.d.ts +13 -13
- package/dist/controllers/forms/focus_steal_controller.d.ts +11 -11
- package/dist/controllers/forms/form_rc_controller.d.ts +17 -17
- package/dist/controllers/forms/form_save_controller.d.ts +31 -31
- package/dist/controllers/forms/index.d.ts +22 -22
- package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts +16 -16
- package/dist/controllers/forms/navigate_form_errors_controller.d.ts +40 -43
- package/dist/controllers/forms/navigate_form_errors_controller.d.ts.map +1 -1
- package/dist/controllers/forms/nested_form_controller.d.ts +21 -21
- package/dist/controllers/forms/password_confirm_controller.d.ts +11 -15
- package/dist/controllers/forms/password_confirm_controller.d.ts.map +1 -1
- package/dist/controllers/forms/password_peek_controller.d.ts +8 -8
- package/dist/controllers/forms/remote_form_controller.d.ts +13 -13
- package/dist/controllers/forms/sync_inputs_controller.d.ts +19 -21
- package/dist/controllers/forms/sync_inputs_controller.d.ts.map +1 -1
- package/dist/controllers/forms/value_warn_controller.d.ts +30 -37
- package/dist/controllers/forms/value_warn_controller.d.ts.map +1 -1
- package/dist/controllers/forms/word_count_controller.d.ts +20 -24
- package/dist/controllers/forms/word_count_controller.d.ts.map +1 -1
- package/dist/controllers/index.d.ts +29 -29
- package/dist/controllers/media/fallback_image_controller.d.ts +19 -27
- package/dist/controllers/media/fallback_image_controller.d.ts.map +1 -1
- package/dist/controllers/media/index.d.ts +3 -3
- package/dist/controllers/media/lightbox_image_controller.d.ts +30 -30
- package/dist/controllers/media/media_player_controller.d.ts +9 -12
- package/dist/controllers/media/media_player_controller.d.ts.map +1 -1
- package/dist/controllers/prefetch_controller.d.ts +16 -16
- package/dist/controllers/prefetch_controller.d.ts.map +1 -1
- package/dist/controllers/print_button_controller.d.ts +7 -11
- package/dist/controllers/print_button_controller.d.ts.map +1 -1
- package/dist/controllers/responsive_iframe_controller.d.ts +16 -21
- package/dist/controllers/responsive_iframe_controller.d.ts.map +1 -1
- package/dist/controllers/scroll/index.d.ts +5 -5
- package/dist/controllers/scroll/scroll_container_controller.d.ts +21 -21
- package/dist/controllers/scroll/scroll_into_focus_controller.d.ts +15 -15
- package/dist/controllers/scroll/scroll_to_bottom_controller.d.ts +11 -11
- package/dist/controllers/scroll/scroll_to_controller.d.ts +17 -17
- package/dist/controllers/scroll/scroll_to_top_controller.d.ts +11 -11
- package/dist/controllers/self_destruct_controller.d.ts +8 -8
- package/dist/controllers/signal/events.d.ts +4 -0
- package/dist/controllers/signal/events.d.ts.map +1 -0
- package/dist/controllers/signal/expressions.d.ts +2 -0
- package/dist/controllers/signal/expressions.d.ts.map +1 -0
- package/dist/controllers/signal/index.d.ts +3 -2
- package/dist/controllers/signal/index.d.ts.map +1 -1
- package/dist/controllers/signal/signal_action_controller.d.ts +15 -0
- package/dist/controllers/signal/signal_action_controller.d.ts.map +1 -0
- package/dist/controllers/signal/signal_input_controller.d.ts +19 -16
- package/dist/controllers/signal/signal_input_controller.d.ts.map +1 -1
- package/dist/controllers/signal/signal_visibility_controller.d.ts +17 -23
- package/dist/controllers/signal/signal_visibility_controller.d.ts.map +1 -1
- package/dist/controllers/sticky_controller.d.ts +15 -18
- package/dist/controllers/sticky_controller.d.ts.map +1 -1
- package/dist/controllers/tables/index.d.ts +2 -2
- package/dist/controllers/tables/table_sort_controller.d.ts +19 -19
- package/dist/controllers/tables/table_sort_controller.d.ts.map +1 -1
- package/dist/controllers/tables/table_truncate_controller.d.ts +25 -26
- package/dist/controllers/tables/table_truncate_controller.d.ts.map +1 -1
- package/dist/controllers/teleport_controller.d.ts +15 -15
- package/dist/controllers/temporary_state_controller.d.ts +26 -27
- package/dist/controllers/temporary_state_controller.d.ts.map +1 -1
- package/dist/controllers/toggle_class_controller.d.ts +35 -35
- package/dist/controllers/toggle_class_controller.d.ts.map +1 -1
- package/dist/controllers/trix_modifier_controller.d.ts +87 -87
- package/dist/controllers/trix_modifier_controller.d.ts.map +1 -1
- package/dist/controllers/turbo_frame_rc_controller.d.ts +20 -20
- package/dist/controllers/turbo_frame_refresh_controller.d.ts +13 -13
- package/dist/controllers/utility/alert_controller.d.ts +8 -8
- package/dist/controllers/utility/fullscreen_controller.d.ts +7 -7
- package/dist/controllers/utility/index.d.ts +8 -8
- package/dist/controllers/utility/intersection_controller.d.ts +13 -13
- package/dist/controllers/utility/intersection_controller.d.ts.map +1 -1
- package/dist/controllers/utility/interval_controller.d.ts +10 -10
- package/dist/controllers/utility/presence_controller.d.ts +13 -13
- package/dist/controllers/utility/print_controller.d.ts +4 -4
- package/dist/controllers/utility/timeout_controller.d.ts +9 -9
- package/dist/controllers/utility/user_focus_controller.d.ts +8 -8
- package/dist/controllers/visual/clock_controller.d.ts +15 -15
- package/dist/controllers/visual/countdown_controller.d.ts +45 -53
- package/dist/controllers/visual/countdown_controller.d.ts.map +1 -1
- package/dist/controllers/visual/duration_controller.d.ts +25 -25
- package/dist/controllers/visual/index.d.ts +6 -6
- package/dist/controllers/visual/tabs_controller.d.ts +29 -35
- package/dist/controllers/visual/tabs_controller.d.ts.map +1 -1
- package/dist/controllers/visual/time_distance_controller.d.ts +15 -16
- package/dist/controllers/visual/time_distance_controller.d.ts.map +1 -1
- package/dist/controllers/visual/tree_view_controller.d.ts +25 -29
- package/dist/controllers/visual/tree_view_controller.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/mixins/create_mixin.d.ts +3 -0
- package/dist/mixins/create_mixin.d.ts.map +1 -0
- package/dist/mixins/index.d.ts +8 -5
- package/dist/mixins/index.d.ts.map +1 -1
- package/dist/mixins/install_class_methods.d.ts +6 -0
- package/dist/mixins/install_class_methods.d.ts.map +1 -0
- package/dist/mixins/use_click_outside.d.ts +5 -0
- package/dist/mixins/use_click_outside.d.ts.map +1 -0
- package/dist/mixins/use_event_bus.d.ts +8 -0
- package/dist/mixins/use_event_bus.d.ts.map +1 -0
- package/dist/mixins/use_event_listener.d.ts +19 -19
- package/dist/mixins/use_event_listener.d.ts.map +1 -1
- package/dist/mixins/use_fullscreen.d.ts +8 -7
- package/dist/mixins/use_fullscreen.d.ts.map +1 -1
- package/dist/mixins/use_geolocation.d.ts +19 -0
- package/dist/mixins/use_geolocation.d.ts.map +1 -0
- package/dist/mixins/use_hover.d.ts +5 -0
- package/dist/mixins/use_hover.d.ts.map +1 -0
- package/dist/mixins/use_injected_html.d.ts +10 -10
- package/dist/mixins/use_injected_html.d.ts.map +1 -1
- package/dist/mixins/use_intersection.d.ts +14 -0
- package/dist/mixins/use_intersection.d.ts.map +1 -0
- package/dist/mixins/use_interval.d.ts +2 -2
- package/dist/mixins/use_interval.d.ts.map +1 -1
- package/dist/mixins/use_localstorage.d.ts +21 -0
- package/dist/mixins/use_localstorage.d.ts.map +1 -0
- package/dist/mixins/use_mutation_observer.d.ts +3 -0
- package/dist/mixins/use_mutation_observer.d.ts.map +1 -0
- package/dist/mixins/use_temporary_content.d.ts +6 -0
- package/dist/mixins/use_temporary_content.d.ts.map +1 -0
- package/dist/mixins/use_timeout.d.ts +2 -2
- package/dist/mixins/use_timeout.d.ts.map +1 -1
- package/dist/mixins/{installsTrixBehaviour.d.ts → use_trix_modifiers.d.ts} +11 -11
- package/dist/mixins/use_trix_modifiers.d.ts.map +1 -0
- package/dist/stimulus-library.cjs.js +1 -5
- package/dist/stimulus-library.cjs.js.map +1 -1
- package/dist/stimulus-library.es.js +851 -3515
- package/dist/stimulus-library.es.js.map +1 -1
- package/dist/stimulus-library.umd.js +1 -5
- package/dist/stimulus-library.umd.js.map +1 -1
- package/dist/utilities/arrays.d.ts +2 -0
- package/dist/utilities/arrays.d.ts.map +1 -0
- package/dist/utilities/base_controller.d.ts +10 -13
- package/dist/utilities/base_controller.d.ts.map +1 -1
- package/dist/utilities/elements.d.ts +48 -17
- package/dist/utilities/elements.d.ts.map +1 -1
- package/dist/utilities/ephemeral_controller.d.ts +5 -5
- package/dist/utilities/event_bus.d.ts +3 -3
- package/dist/utilities/events.d.ts +3 -0
- package/dist/utilities/events.d.ts.map +1 -0
- package/dist/utilities/fetchRetry.d.ts +1 -1
- package/dist/utilities/index.d.ts +7 -7
- package/dist/utilities/logging.d.ts +6 -0
- package/dist/utilities/logging.d.ts.map +1 -0
- package/dist/utilities/reactive.d.ts +2 -0
- package/dist/utilities/reactive.d.ts.map +1 -0
- package/dist/utilities/request_submit.d.ts +2 -2
- package/dist/utilities/scroll.d.ts +10 -10
- package/dist/utilities/stimulus.d.ts +2 -2
- package/dist/utilities/stimulus.d.ts.map +1 -1
- package/dist/utilities/strings.d.ts +2 -0
- package/dist/utilities/strings.d.ts.map +1 -0
- package/dist/utilities/turbo.d.ts +1 -1
- package/package.json +7 -8
- package/dist/mixins/installsTrixBehaviour.d.ts.map +0 -1
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
var ar=Object.defineProperty;var Q=Object.getOwnPropertySymbols;var hs=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable;var Re=(o,m,g)=>m in o?ar(o,m,{enumerable:!0,configurable:!0,writable:!0,value:g}):o[m]=g,I=(o,m)=>{for(var g in m||(m={}))hs.call(m,g)&&Re(o,g,m[g]);if(Q)for(var g of Q(m))ds.call(m,g)&&Re(o,g,m[g]);return o};var fs=(o,m)=>{var g={};for(var E in o)hs.call(o,E)&&m.indexOf(E)<0&&(g[E]=o[E]);if(o!=null&&Q)for(var E of Q(o))m.indexOf(E)<0&&ds.call(o,E)&&(g[E]=o[E]);return g};var l=(o,m,g)=>(Re(o,typeof m!="symbol"?m+"":m,g),g);(function(o,m){typeof exports=="object"&&typeof module!="undefined"?m(exports,require("lodash-es"),require("date-fns")):typeof define=="function"&&define.amd?define(["exports","lodash-es","date-fns"],m):(o=typeof globalThis!="undefined"?globalThis:o||self,m(o["Stimulus-Library"]={},o.lodashEs,o.dateFns))})(this,function(o,m,g){"use strict";var E=function(){function t(e,s,i){this.eventTarget=e,this.eventName=s,this.eventOptions=i,this.unorderedBindings=new Set}return t.prototype.connect=function(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)},t.prototype.disconnect=function(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)},t.prototype.bindingConnected=function(e){this.unorderedBindings.add(e)},t.prototype.bindingDisconnected=function(e){this.unorderedBindings.delete(e)},t.prototype.handleEvent=function(e){for(var s=ms(e),i=0,r=this.bindings;i<r.length;i++){var n=r[i];if(s.immediatePropagationStopped)break;n.handleEvent(s)}},Object.defineProperty(t.prototype,"bindings",{get:function(){return Array.from(this.unorderedBindings).sort(function(e,s){var i=e.index,r=s.index;return i<r?-1:i>r?1:0})},enumerable:!1,configurable:!0}),t}();function ms(t){if("immediatePropagationStopped"in t)return t;var e=t.stopImmediatePropagation;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation:function(){this.immediatePropagationStopped=!0,e.call(this)}})}var ps=function(){function t(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}return t.prototype.start=function(){this.started||(this.started=!0,this.eventListeners.forEach(function(e){return e.connect()}))},t.prototype.stop=function(){this.started&&(this.started=!1,this.eventListeners.forEach(function(e){return e.disconnect()}))},Object.defineProperty(t.prototype,"eventListeners",{get:function(){return Array.from(this.eventListenerMaps.values()).reduce(function(e,s){return e.concat(Array.from(s.values()))},[])},enumerable:!1,configurable:!0}),t.prototype.bindingConnected=function(e){this.fetchEventListenerForBinding(e).bindingConnected(e)},t.prototype.bindingDisconnected=function(e){this.fetchEventListenerForBinding(e).bindingDisconnected(e)},t.prototype.handleError=function(e,s,i){i===void 0&&(i={}),this.application.handleError(e,"Error "+s,i)},t.prototype.fetchEventListenerForBinding=function(e){var s=e.eventTarget,i=e.eventName,r=e.eventOptions;return this.fetchEventListener(s,i,r)},t.prototype.fetchEventListener=function(e,s,i){var r=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(s,i),a=r.get(n);return a||(a=this.createEventListener(e,s,i),r.set(n,a)),a},t.prototype.createEventListener=function(e,s,i){var r=new E(e,s,i);return this.started&&r.connect(),r},t.prototype.fetchEventListenerMapForEventTarget=function(e){var s=this.eventListenerMaps.get(e);return s||(s=new Map,this.eventListenerMaps.set(e,s)),s},t.prototype.cacheKey=function(e,s){var i=[e];return Object.keys(s).sort().forEach(function(r){i.push(""+(s[r]?"":"!")+r)}),i.join(":")},t}(),gs=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function bs(t){var e=t.trim(),s=e.match(gs)||[];return{eventTarget:vs(s[4]),eventName:s[2],eventOptions:s[9]?ys(s[9]):{},identifier:s[5],methodName:s[7]}}function vs(t){if(t=="window")return window;if(t=="document")return document}function ys(t){return t.split(":").reduce(function(e,s){var i;return Object.assign(e,(i={},i[s.replace(/^!/,"")]=!/^!/.test(s),i))},{})}function _s(t){if(t==window)return"window";if(t==document)return"document"}var Cs=function(){function t(e,s,i){this.element=e,this.index=s,this.eventTarget=i.eventTarget||e,this.eventName=i.eventName||ws(e)||ee("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||ee("missing identifier"),this.methodName=i.methodName||ee("missing method name")}return t.forToken=function(e){return new this(e.element,e.index,bs(e.content))},t.prototype.toString=function(){var e=this.eventTargetName?"@"+this.eventTargetName:"";return""+this.eventName+e+"->"+this.identifier+"#"+this.methodName},Object.defineProperty(t.prototype,"eventTargetName",{get:function(){return _s(this.eventTarget)},enumerable:!1,configurable:!0}),t}(),qe={a:function(t){return"click"},button:function(t){return"click"},form:function(t){return"submit"},input:function(t){return t.getAttribute("type")=="submit"?"click":"input"},select:function(t){return"change"},textarea:function(t){return"input"}};function ws(t){var e=t.tagName.toLowerCase();if(e in qe)return qe[e](t)}function ee(t){throw new Error(t)}var Es=function(){function t(e,s){this.context=e,this.action=s}return Object.defineProperty(t.prototype,"index",{get:function(){return this.action.index},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"eventTarget",{get:function(){return this.action.eventTarget},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"eventOptions",{get:function(){return this.action.eventOptions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),t.prototype.handleEvent=function(e){this.willBeInvokedByEvent(e)&&this.invokeWithEvent(e)},Object.defineProperty(t.prototype,"eventName",{get:function(){return this.action.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"method",{get:function(){var e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error('Action "'+this.action+'" references undefined method "'+this.methodName+'"')},enumerable:!1,configurable:!0}),t.prototype.invokeWithEvent=function(e){try{this.method.call(this.controller,e)}catch(u){var s=this,i=s.identifier,r=s.controller,n=s.element,a=s.index,c={identifier:i,controller:r,element:n,index:a,event:e};this.context.handleError(u,'invoking action "'+this.action+'"',c)}},t.prototype.willBeInvokedByEvent=function(e){var s=e.target;return this.element===s?!0:s instanceof Element&&this.element.contains(s)?this.scope.containsElement(s):this.scope.containsElement(this.action.element)},Object.defineProperty(t.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"methodName",{get:function(){return this.action.methodName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),t}(),Ts=function(){function t(e,s){var i=this;this.element=e,this.started=!1,this.delegate=s,this.elements=new Set,this.mutationObserver=new MutationObserver(function(r){return i.processMutations(r)})}return t.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,childList:!0,subtree:!0}),this.refresh())},t.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},t.prototype.refresh=function(){if(this.started){for(var e=new Set(this.matchElementsInTree()),s=0,i=Array.from(this.elements);s<i.length;s++){var r=i[s];e.has(r)||this.removeElement(r)}for(var n=0,a=Array.from(e);n<a.length;n++){var r=a[n];this.addElement(r)}}},t.prototype.processMutations=function(e){if(this.started)for(var s=0,i=e;s<i.length;s++){var r=i[s];this.processMutation(r)}},t.prototype.processMutation=function(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))},t.prototype.processAttributeChange=function(e,s){var i=e;this.elements.has(i)?this.delegate.elementAttributeChanged&&this.matchElement(i)?this.delegate.elementAttributeChanged(i,s):this.removeElement(i):this.matchElement(i)&&this.addElement(i)},t.prototype.processRemovedNodes=function(e){for(var s=0,i=Array.from(e);s<i.length;s++){var r=i[s],n=this.elementFromNode(r);n&&this.processTree(n,this.removeElement)}},t.prototype.processAddedNodes=function(e){for(var s=0,i=Array.from(e);s<i.length;s++){var r=i[s],n=this.elementFromNode(r);n&&this.elementIsActive(n)&&this.processTree(n,this.addElement)}},t.prototype.matchElement=function(e){return this.delegate.matchElement(e)},t.prototype.matchElementsInTree=function(e){return e===void 0&&(e=this.element),this.delegate.matchElementsInTree(e)},t.prototype.processTree=function(e,s){for(var i=0,r=this.matchElementsInTree(e);i<r.length;i++){var n=r[i];s.call(this,n)}},t.prototype.elementFromNode=function(e){if(e.nodeType==Node.ELEMENT_NODE)return e},t.prototype.elementIsActive=function(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)},t.prototype.addElement=function(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))},t.prototype.removeElement=function(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))},t}(),Ss=function(){function t(e,s,i){this.attributeName=s,this.delegate=i,this.elementObserver=new Ts(e,this)}return Object.defineProperty(t.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.elementObserver.start()},t.prototype.stop=function(){this.elementObserver.stop()},t.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(t.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!1,configurable:!0}),t.prototype.matchElement=function(e){return e.hasAttribute(this.attributeName)},t.prototype.matchElementsInTree=function(e){var s=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(this.selector));return s.concat(i)},t.prototype.elementMatched=function(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)},t.prototype.elementUnmatched=function(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)},t.prototype.elementAttributeChanged=function(e,s){this.delegate.elementAttributeValueChanged&&this.attributeName==s&&this.delegate.elementAttributeValueChanged(e,s)},t}(),As=function(){function t(e,s){var i=this;this.element=e,this.delegate=s,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(function(r){return i.processMutations(r)})}return t.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0}),this.refresh())},t.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},t.prototype.refresh=function(){if(this.started)for(var e=0,s=this.knownAttributeNames;e<s.length;e++){var i=s[e];this.refreshAttribute(i)}},t.prototype.processMutations=function(e){if(this.started)for(var s=0,i=e;s<i.length;s++){var r=i[s];this.processMutation(r)}},t.prototype.processMutation=function(e){var s=e.attributeName;s&&this.refreshAttribute(s)},t.prototype.refreshAttribute=function(e){var s=this.delegate.getStringMapKeyForAttribute(e);if(s!=null){this.stringMap.has(e)||this.stringMapKeyAdded(s,e);var i=this.element.getAttribute(e);this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,s),i==null?(this.stringMap.delete(e),this.stringMapKeyRemoved(s,e)):this.stringMap.set(e,i)}},t.prototype.stringMapKeyAdded=function(e,s){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,s)},t.prototype.stringMapValueChanged=function(e,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,s)},t.prototype.stringMapKeyRemoved=function(e,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,s)},Object.defineProperty(t.prototype,"knownAttributeNames",{get:function(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentAttributeNames",{get:function(){return Array.from(this.element.attributes).map(function(e){return e.name})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"recordedAttributeNames",{get:function(){return Array.from(this.stringMap.keys())},enumerable:!1,configurable:!0}),t}();function $e(t,e,s){ze(t,e).add(s)}function Ue(t,e,s){ze(t,e).delete(s),ks(t,e)}function ze(t,e){var s=t.get(e);return s||(s=new Set,t.set(e,s)),s}function ks(t,e){var s=t.get(e);s!=null&&s.size==0&&t.delete(e)}var te=function(){function t(){this.valuesByKey=new Map}return Object.defineProperty(t.prototype,"values",{get:function(){var e=Array.from(this.valuesByKey.values());return e.reduce(function(s,i){return s.concat(Array.from(i))},[])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=Array.from(this.valuesByKey.values());return e.reduce(function(s,i){return s+i.size},0)},enumerable:!1,configurable:!0}),t.prototype.add=function(e,s){$e(this.valuesByKey,e,s)},t.prototype.delete=function(e,s){Ue(this.valuesByKey,e,s)},t.prototype.has=function(e,s){var i=this.valuesByKey.get(e);return i!=null&&i.has(s)},t.prototype.hasKey=function(e){return this.valuesByKey.has(e)},t.prototype.hasValue=function(e){var s=Array.from(this.valuesByKey.values());return s.some(function(i){return i.has(e)})},t.prototype.getValuesForKey=function(e){var s=this.valuesByKey.get(e);return s?Array.from(s):[]},t.prototype.getKeysForValue=function(e){return Array.from(this.valuesByKey).filter(function(s){s[0];var i=s[1];return i.has(e)}).map(function(s){var i=s[0];return s[1],i})},t}(),Vs=globalThis&&globalThis.__extends||function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var n in r)r.hasOwnProperty(n)&&(i[n]=r[n])},t(e,s)};return function(e,s){t(e,s);function i(){this.constructor=e}e.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();(function(t){Vs(e,t);function e(){var s=t.call(this)||this;return s.keysByValue=new Map,s}return Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.keysByValue.keys())},enumerable:!1,configurable:!0}),e.prototype.add=function(s,i){t.prototype.add.call(this,s,i),$e(this.keysByValue,i,s)},e.prototype.delete=function(s,i){t.prototype.delete.call(this,s,i),Ue(this.keysByValue,i,s)},e.prototype.hasValue=function(s){return this.keysByValue.has(s)},e.prototype.getKeysForValue=function(s){var i=this.keysByValue.get(s);return i?Array.from(i):[]},e})(te);var Ls=function(){function t(e,s,i){this.attributeObserver=new Ss(e,s,this),this.delegate=i,this.tokensByElement=new te}return Object.defineProperty(t.prototype,"started",{get:function(){return this.attributeObserver.started},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.attributeObserver.start()},t.prototype.stop=function(){this.attributeObserver.stop()},t.prototype.refresh=function(){this.attributeObserver.refresh()},Object.defineProperty(t.prototype,"element",{get:function(){return this.attributeObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributeName",{get:function(){return this.attributeObserver.attributeName},enumerable:!1,configurable:!0}),t.prototype.elementMatchedAttribute=function(e){this.tokensMatched(this.readTokensForElement(e))},t.prototype.elementAttributeValueChanged=function(e){var s=this.refreshTokensForElement(e),i=s[0],r=s[1];this.tokensUnmatched(i),this.tokensMatched(r)},t.prototype.elementUnmatchedAttribute=function(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))},t.prototype.tokensMatched=function(e){var s=this;e.forEach(function(i){return s.tokenMatched(i)})},t.prototype.tokensUnmatched=function(e){var s=this;e.forEach(function(i){return s.tokenUnmatched(i)})},t.prototype.tokenMatched=function(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)},t.prototype.tokenUnmatched=function(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)},t.prototype.refreshTokensForElement=function(e){var s=this.tokensByElement.getValuesForKey(e),i=this.readTokensForElement(e),r=Os(s,i).findIndex(function(n){var a=n[0],c=n[1];return!xs(a,c)});return r==-1?[[],[]]:[s.slice(r),i.slice(r)]},t.prototype.readTokensForElement=function(e){var s=this.attributeName,i=e.getAttribute(s)||"";return Ms(i,e,s)},t}();function Ms(t,e,s){return t.trim().split(/\s+/).filter(function(i){return i.length}).map(function(i,r){return{element:e,attributeName:s,content:i,index:r}})}function Os(t,e){var s=Math.max(t.length,e.length);return Array.from({length:s},function(i,r){return[t[r],e[r]]})}function xs(t,e){return t&&e&&t.index==e.index&&t.content==e.content}var We=function(){function t(e,s,i){this.tokenListObserver=new Ls(e,s,this),this.delegate=i,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}return Object.defineProperty(t.prototype,"started",{get:function(){return this.tokenListObserver.started},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.tokenListObserver.start()},t.prototype.stop=function(){this.tokenListObserver.stop()},t.prototype.refresh=function(){this.tokenListObserver.refresh()},Object.defineProperty(t.prototype,"element",{get:function(){return this.tokenListObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributeName",{get:function(){return this.tokenListObserver.attributeName},enumerable:!1,configurable:!0}),t.prototype.tokenMatched=function(e){var s=e.element,i=this.fetchParseResultForToken(e).value;i&&(this.fetchValuesByTokenForElement(s).set(e,i),this.delegate.elementMatchedValue(s,i))},t.prototype.tokenUnmatched=function(e){var s=e.element,i=this.fetchParseResultForToken(e).value;i&&(this.fetchValuesByTokenForElement(s).delete(e),this.delegate.elementUnmatchedValue(s,i))},t.prototype.fetchParseResultForToken=function(e){var s=this.parseResultsByToken.get(e);return s||(s=this.parseToken(e),this.parseResultsByToken.set(e,s)),s},t.prototype.fetchValuesByTokenForElement=function(e){var s=this.valuesByTokenByElement.get(e);return s||(s=new Map,this.valuesByTokenByElement.set(e,s)),s},t.prototype.parseToken=function(e){try{var s=this.delegate.parseValueForToken(e);return{value:s}}catch(i){return{error:i}}},t}(),Ds=function(){function t(e,s){this.context=e,this.delegate=s,this.bindingsByAction=new Map}return t.prototype.start=function(){this.valueListObserver||(this.valueListObserver=new We(this.element,this.actionAttribute,this),this.valueListObserver.start())},t.prototype.stop=function(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())},Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actionAttribute",{get:function(){return this.schema.actionAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return this.context.schema},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bindings",{get:function(){return Array.from(this.bindingsByAction.values())},enumerable:!1,configurable:!0}),t.prototype.connectAction=function(e){var s=new Es(this.context,e);this.bindingsByAction.set(e,s),this.delegate.bindingConnected(s)},t.prototype.disconnectAction=function(e){var s=this.bindingsByAction.get(e);s&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(s))},t.prototype.disconnectAllActions=function(){var e=this;this.bindings.forEach(function(s){return e.delegate.bindingDisconnected(s)}),this.bindingsByAction.clear()},t.prototype.parseValueForToken=function(e){var s=Cs.forToken(e);if(s.identifier==this.identifier)return s},t.prototype.elementMatchedValue=function(e,s){this.connectAction(s)},t.prototype.elementUnmatchedValue=function(e,s){this.disconnectAction(s)},t}(),Ns=function(){function t(e,s){this.context=e,this.receiver=s,this.stringMapObserver=new As(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap,this.invokeChangedCallbacksForDefaultValues()}return t.prototype.start=function(){this.stringMapObserver.start()},t.prototype.stop=function(){this.stringMapObserver.stop()},Object.defineProperty(t.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),t.prototype.getStringMapKeyForAttribute=function(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name},t.prototype.stringMapValueChanged=function(e,s){this.invokeChangedCallbackForValue(s)},t.prototype.invokeChangedCallbacksForDefaultValues=function(){for(var e=0,s=this.valueDescriptors;e<s.length;e++){var i=s[e],r=i.key,n=i.name,a=i.defaultValue;a!=null&&!this.controller.data.has(r)&&this.invokeChangedCallbackForValue(n)}},t.prototype.invokeChangedCallbackForValue=function(e){var s=e+"Changed",i=this.receiver[s];if(typeof i=="function"){var r=this.receiver[e];i.call(this.receiver,r)}},Object.defineProperty(t.prototype,"valueDescriptors",{get:function(){var e=this.valueDescriptorMap;return Object.keys(e).map(function(s){return e[s]})},enumerable:!1,configurable:!0}),t}(),Is=function(){function t(e,s){this.module=e,this.scope=s,this.controller=new e.controllerConstructor(this),this.bindingObserver=new Ds(this,this.dispatcher),this.valueObserver=new Ns(this,this.controller);try{this.controller.initialize()}catch(i){this.handleError(i,"initializing controller")}}return t.prototype.connect=function(){this.bindingObserver.start(),this.valueObserver.start();try{this.controller.connect()}catch(e){this.handleError(e,"connecting controller")}},t.prototype.disconnect=function(){try{this.controller.disconnect()}catch(e){this.handleError(e,"disconnecting controller")}this.valueObserver.stop(),this.bindingObserver.stop()},Object.defineProperty(t.prototype,"application",{get:function(){return this.module.application},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.module.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dispatcher",{get:function(){return this.application.dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentElement",{get:function(){return this.element.parentElement},enumerable:!1,configurable:!0}),t.prototype.handleError=function(e,s,i){i===void 0&&(i={});var r=this,n=r.identifier,a=r.controller,c=r.element;i=Object.assign({identifier:n,controller:a,element:c},i),this.application.handleError(e,"Error "+s,i)},t}();function se(t,e){var s=Ke(t);return Array.from(s.reduce(function(i,r){return Hs(r,e).forEach(function(n){return i.add(n)}),i},new Set))}function Bs(t,e){var s=Ke(t);return s.reduce(function(i,r){return i.push.apply(i,Fs(r,e)),i},[])}function Ke(t){for(var e=[];t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}function Hs(t,e){var s=t[e];return Array.isArray(s)?s:[]}function Fs(t,e){var s=t[e];return s?Object.keys(s).map(function(i){return[i,s[i]]}):[]}var Ps=globalThis&&globalThis.__extends||function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var n in r)r.hasOwnProperty(n)&&(i[n]=r[n])},t(e,s)};return function(e,s){t(e,s);function i(){this.constructor=e}e.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}(),js=globalThis&&globalThis.__spreadArrays||function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<s;e++)for(var n=arguments[e],a=0,c=n.length;a<c;a++,r++)i[r]=n[a];return i};function Rs(t){return qs(t,$s(t))}function qs(t,e){var s=Ks(t),i=Us(t.prototype,e);return Object.defineProperties(s.prototype,i),s}function $s(t){var e=se(t,"blessings");return e.reduce(function(s,i){var r=i(t);for(var n in r){var a=s[n]||{};s[n]=Object.assign(a,r[n])}return s},{})}function Us(t,e){return Ws(e).reduce(function(s,i){var r,n=zs(t,e,i);return n&&Object.assign(s,(r={},r[i]=n,r)),s},{})}function zs(t,e,s){var i=Object.getOwnPropertyDescriptor(t,s),r=i&&"value"in i;if(!r){var n=Object.getOwnPropertyDescriptor(e,s).value;return i&&(n.get=i.get||n.get,n.set=i.set||n.set),n}}var Ws=function(){return typeof Object.getOwnPropertySymbols=="function"?function(t){return js(Object.getOwnPropertyNames(t),Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames}(),Ks=function(){function t(s){function i(){var r=this&&this instanceof i?this.constructor:void 0;return Reflect.construct(s,arguments,r)}return i.prototype=Object.create(s.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,s),i}function e(){var s=function(){this.a.call(this)},i=t(s);return i.prototype.a=function(){},new i}try{return e(),t}catch{return function(i){return function(r){Ps(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}return n}(i)}}}();function Js(t){return{identifier:t.identifier,controllerConstructor:Rs(t.controllerConstructor)}}var Xs=function(){function t(e,s){this.application=e,this.definition=Js(s),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}return Object.defineProperty(t.prototype,"identifier",{get:function(){return this.definition.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerConstructor",{get:function(){return this.definition.controllerConstructor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contexts",{get:function(){return Array.from(this.connectedContexts)},enumerable:!1,configurable:!0}),t.prototype.connectContextForScope=function(e){var s=this.fetchContextForScope(e);this.connectedContexts.add(s),s.connect()},t.prototype.disconnectContextForScope=function(e){var s=this.contextsByScope.get(e);s&&(this.connectedContexts.delete(s),s.disconnect())},t.prototype.fetchContextForScope=function(e){var s=this.contextsByScope.get(e);return s||(s=new Is(this,e),this.contextsByScope.set(e,s)),s},t}(),Gs=function(){function t(e){this.scope=e}return t.prototype.has=function(e){return this.data.has(this.getDataKey(e))},t.prototype.get=function(e){return this.data.get(this.getDataKey(e))},t.prototype.getAttributeName=function(e){return this.data.getAttributeNameForKey(this.getDataKey(e))},t.prototype.getDataKey=function(e){return e+"-class"},Object.defineProperty(t.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),t}();function Ys(t){return t.replace(/(?:[_-])([a-z0-9])/g,function(e,s){return s.toUpperCase()})}function ie(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Je(t){return t.replace(/([A-Z])/g,function(e,s){return"-"+s.toLowerCase()})}var Zs=function(){function t(e){this.scope=e}return Object.defineProperty(t.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),t.prototype.get=function(e){var s=this.getAttributeNameForKey(e);return this.element.getAttribute(s)},t.prototype.set=function(e,s){var i=this.getAttributeNameForKey(e);return this.element.setAttribute(i,s),this.get(e)},t.prototype.has=function(e){var s=this.getAttributeNameForKey(e);return this.element.hasAttribute(s)},t.prototype.delete=function(e){if(this.has(e)){var s=this.getAttributeNameForKey(e);return this.element.removeAttribute(s),!0}else return!1},t.prototype.getAttributeNameForKey=function(e){return"data-"+this.identifier+"-"+Je(e)},t}(),Qs=function(){function t(e){this.warnedKeysByObject=new WeakMap,this.logger=e}return t.prototype.warn=function(e,s,i){var r=this.warnedKeysByObject.get(e);r||(r=new Set,this.warnedKeysByObject.set(e,r)),r.has(s)||(r.add(s),this.logger.warn(i,e))},t}();function re(t,e){return"["+t+'~="'+e+'"]'}var ei=globalThis&&globalThis.__spreadArrays||function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<s;e++)for(var n=arguments[e],a=0,c=n.length;a<c;a++,r++)i[r]=n[a];return i},ti=function(){function t(e){this.scope=e}return Object.defineProperty(t.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return this.scope.schema},enumerable:!1,configurable:!0}),t.prototype.has=function(e){return this.find(e)!=null},t.prototype.find=function(){for(var e=this,s=[],i=0;i<arguments.length;i++)s[i]=arguments[i];return s.reduce(function(r,n){return r||e.findTarget(n)||e.findLegacyTarget(n)},void 0)},t.prototype.findAll=function(){for(var e=this,s=[],i=0;i<arguments.length;i++)s[i]=arguments[i];return s.reduce(function(r,n){return ei(r,e.findAllTargets(n),e.findAllLegacyTargets(n))},[])},t.prototype.findTarget=function(e){var s=this.getSelectorForTargetName(e);return this.scope.findElement(s)},t.prototype.findAllTargets=function(e){var s=this.getSelectorForTargetName(e);return this.scope.findAllElements(s)},t.prototype.getSelectorForTargetName=function(e){var s="data-"+this.identifier+"-target";return re(s,e)},t.prototype.findLegacyTarget=function(e){var s=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(s),e)},t.prototype.findAllLegacyTargets=function(e){var s=this,i=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(i).map(function(r){return s.deprecate(r,e)})},t.prototype.getLegacySelectorForTargetName=function(e){var s=this.identifier+"."+e;return re(this.schema.targetAttribute,s)},t.prototype.deprecate=function(e,s){if(e){var i=this.identifier,r=this.schema.targetAttribute;this.guide.warn(e,"target:"+s,"Please replace "+r+'="'+i+"."+s+'" with data-'+i+'-target="'+s+'". '+("The "+r+" attribute is deprecated and will be removed in a future version of Stimulus."))}return e},Object.defineProperty(t.prototype,"guide",{get:function(){return this.scope.guide},enumerable:!1,configurable:!0}),t}(),si=globalThis&&globalThis.__spreadArrays||function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<s;e++)for(var n=arguments[e],a=0,c=n.length;a<c;a++,r++)i[r]=n[a];return i},ii=function(){function t(e,s,i,r){var n=this;this.targets=new ti(this),this.classes=new Gs(this),this.data=new Zs(this),this.containsElement=function(a){return a.closest(n.controllerSelector)===n.element},this.schema=e,this.element=s,this.identifier=i,this.guide=new Qs(r)}return t.prototype.findElement=function(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)},t.prototype.findAllElements=function(e){return si(this.element.matches(e)?[this.element]:[],this.queryElements(e).filter(this.containsElement))},t.prototype.queryElements=function(e){return Array.from(this.element.querySelectorAll(e))},Object.defineProperty(t.prototype,"controllerSelector",{get:function(){return re(this.schema.controllerAttribute,this.identifier)},enumerable:!1,configurable:!0}),t}(),ri=function(){function t(e,s,i){this.element=e,this.schema=s,this.delegate=i,this.valueListObserver=new We(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}return t.prototype.start=function(){this.valueListObserver.start()},t.prototype.stop=function(){this.valueListObserver.stop()},Object.defineProperty(t.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),t.prototype.parseValueForToken=function(e){var s=e.element,i=e.content,r=this.fetchScopesByIdentifierForElement(s),n=r.get(i);return n||(n=this.delegate.createScopeForElementAndIdentifier(s,i),r.set(i,n)),n},t.prototype.elementMatchedValue=function(e,s){var i=(this.scopeReferenceCounts.get(s)||0)+1;this.scopeReferenceCounts.set(s,i),i==1&&this.delegate.scopeConnected(s)},t.prototype.elementUnmatchedValue=function(e,s){var i=this.scopeReferenceCounts.get(s);i&&(this.scopeReferenceCounts.set(s,i-1),i==1&&this.delegate.scopeDisconnected(s))},t.prototype.fetchScopesByIdentifierForElement=function(e){var s=this.scopesByIdentifierByElement.get(e);return s||(s=new Map,this.scopesByIdentifierByElement.set(e,s)),s},t}(),ni=function(){function t(e){this.application=e,this.scopeObserver=new ri(this.element,this.schema,this),this.scopesByIdentifier=new te,this.modulesByIdentifier=new Map}return Object.defineProperty(t.prototype,"element",{get:function(){return this.application.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"logger",{get:function(){return this.application.logger},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modules",{get:function(){return Array.from(this.modulesByIdentifier.values())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contexts",{get:function(){return this.modules.reduce(function(e,s){return e.concat(s.contexts)},[])},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.scopeObserver.start()},t.prototype.stop=function(){this.scopeObserver.stop()},t.prototype.loadDefinition=function(e){this.unloadIdentifier(e.identifier);var s=new Xs(this.application,e);this.connectModule(s)},t.prototype.unloadIdentifier=function(e){var s=this.modulesByIdentifier.get(e);s&&this.disconnectModule(s)},t.prototype.getContextForElementAndIdentifier=function(e,s){var i=this.modulesByIdentifier.get(s);if(i)return i.contexts.find(function(r){return r.element==e})},t.prototype.handleError=function(e,s,i){this.application.handleError(e,s,i)},t.prototype.createScopeForElementAndIdentifier=function(e,s){return new ii(this.schema,e,s,this.logger)},t.prototype.scopeConnected=function(e){this.scopesByIdentifier.add(e.identifier,e);var s=this.modulesByIdentifier.get(e.identifier);s&&s.connectContextForScope(e)},t.prototype.scopeDisconnected=function(e){this.scopesByIdentifier.delete(e.identifier,e);var s=this.modulesByIdentifier.get(e.identifier);s&&s.disconnectContextForScope(e)},t.prototype.connectModule=function(e){this.modulesByIdentifier.set(e.identifier,e);var s=this.scopesByIdentifier.getValuesForKey(e.identifier);s.forEach(function(i){return e.connectContextForScope(i)})},t.prototype.disconnectModule=function(e){this.modulesByIdentifier.delete(e.identifier);var s=this.scopesByIdentifier.getValuesForKey(e.identifier);s.forEach(function(i){return e.disconnectContextForScope(i)})},t}(),ai={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"},oi=globalThis&&globalThis.__awaiter||function(t,e,s,i){function r(n){return n instanceof s?n:new s(function(a){a(n)})}return new(s||(s=Promise))(function(n,a){function c(f){try{h(i.next(f))}catch(v){a(v)}}function u(f){try{h(i.throw(f))}catch(v){a(v)}}function h(f){f.done?n(f.value):r(f.value).then(c,u)}h((i=i.apply(t,e||[])).next())})},li=globalThis&&globalThis.__generator||function(t,e){var s={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,n,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(h){return function(f){return u([h,f])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(n=h[0]&2?r.return:h[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,h[1])).done)return n;switch(r=0,n&&(h=[h[0]&2,n.value]),h[0]){case 0:case 1:n=h;break;case 4:return s.label++,{value:h[1],done:!1};case 5:s.label++,r=h[1],h=[0];continue;case 7:h=s.ops.pop(),s.trys.pop();continue;default:if(n=s.trys,!(n=n.length>0&&n[n.length-1])&&(h[0]===6||h[0]===2)){s=0;continue}if(h[0]===3&&(!n||h[1]>n[0]&&h[1]<n[3])){s.label=h[1];break}if(h[0]===6&&s.label<n[1]){s.label=n[1],n=h;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(h);break}n[2]&&s.ops.pop(),s.trys.pop();continue}h=e.call(t,s)}catch(f){h=[6,f],r=0}finally{i=n=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}},Xe=globalThis&&globalThis.__spreadArrays||function(){for(var t=0,e=0,s=arguments.length;e<s;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<s;e++)for(var n=arguments[e],a=0,c=n.length;a<c;a++,r++)i[r]=n[a];return i};(function(){function t(e,s){e===void 0&&(e=document.documentElement),s===void 0&&(s=ai),this.logger=console,this.element=e,this.schema=s,this.dispatcher=new ps(this),this.router=new ni(this)}return t.start=function(e,s){var i=new t(e,s);return i.start(),i},t.prototype.start=function(){return oi(this,void 0,void 0,function(){return li(this,function(e){switch(e.label){case 0:return[4,ci()];case 1:return e.sent(),this.dispatcher.start(),this.router.start(),[2]}})})},t.prototype.stop=function(){this.dispatcher.stop(),this.router.stop()},t.prototype.register=function(e,s){this.load({identifier:e,controllerConstructor:s})},t.prototype.load=function(e){for(var s=this,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=Array.isArray(e)?e:Xe([e],i);n.forEach(function(a){return s.router.loadDefinition(a)})},t.prototype.unload=function(e){for(var s=this,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=Array.isArray(e)?e:Xe([e],i);n.forEach(function(a){return s.router.unloadIdentifier(a)})},Object.defineProperty(t.prototype,"controllers",{get:function(){return this.router.contexts.map(function(e){return e.controller})},enumerable:!1,configurable:!0}),t.prototype.getControllerForElementAndIdentifier=function(e,s){var i=this.router.getContextForElementAndIdentifier(e,s);return i?i.controller:null},t.prototype.handleError=function(e,s,i){this.logger.error(`%s
|
|
2
|
-
|
|
3
|
-
%o
|
|
4
|
-
|
|
5
|
-
%o`,s,e,i)},t})();function ci(){return new Promise(function(t){document.readyState=="loading"?document.addEventListener("DOMContentLoaded",t):t()})}function ui(t){var e=se(t,"classes");return e.reduce(function(s,i){return Object.assign(s,hi(i))},{})}function hi(t){var e,s=t+"Class";return e={},e[s]={get:function(){var i=this.classes;if(i.has(t))return i.get(t);var r=i.getAttributeName(t);throw new Error('Missing attribute "'+r+'"')}},e["has"+ie(s)]={get:function(){return this.classes.has(t)}},e}function di(t){var e=se(t,"targets");return e.reduce(function(s,i){return Object.assign(s,fi(i))},{})}function fi(t){var e;return e={},e[t+"Target"]={get:function(){var s=this.targets.find(t);if(s)return s;throw new Error('Missing target element "'+this.identifier+"."+t+'"')}},e[t+"Targets"]={get:function(){return this.targets.findAll(t)}},e["has"+ie(t)+"Target"]={get:function(){return this.targets.has(t)}},e}function mi(t){var e=Bs(t,"values"),s={valueDescriptorMap:{get:function(){var i=this;return e.reduce(function(r,n){var a,c=Ge(n),u=i.data.getAttributeNameForKey(c.key);return Object.assign(r,(a={},a[u]=c,a))},{})}}};return e.reduce(function(i,r){return Object.assign(i,pi(r))},s)}function pi(t){var e,s=Ge(t),i=s.type,r=s.key,n=s.name,a=yi[i],c=Ye[i]||Ye.default;return e={},e[n]={get:function(){var u=this.data.get(r);return u!==null?a(u):s.defaultValue},set:function(u){u===void 0?this.data.delete(r):this.data.set(r,c(u))}},e["has"+ie(n)]={get:function(){return this.data.has(r)}},e}function Ge(t){var e=t[0],s=t[1],i=gi(s);return bi(e,i)}function gi(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}throw new Error('Unknown value type constant "'+t+'"')}function bi(t,e){var s=Je(t)+"-value";return{type:e,key:s,name:Ys(s),get defaultValue(){return vi[e]}}}var vi={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},yi={array:function(t){var e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError("Expected array");return e},boolean:function(t){return!(t=="0"||t=="false")},number:function(t){return parseFloat(t)},object:function(t){var e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("Expected object");return e},string:function(t){return t}},Ye={default:_i,array:Ze,object:Ze};function Ze(t){return JSON.stringify(t)}function _i(t){return""+t}var Qe=function(){function t(e){this.context=e}return Object.defineProperty(t.prototype,"application",{get:function(){return this.context.application},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"targets",{get:function(){return this.scope.targets},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classes",{get:function(){return this.scope.classes},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){},t.prototype.connect=function(){},t.prototype.disconnect=function(){},t.blessings=[ui,di,mi],t.targets=[],t.values={},t}();class d extends Qe{constructor(e){super(e);return this.application.debug?new Proxy(this,{get:(s,i)=>{let r=Reflect.get(s,i),n=this;if(Ci(i.toString())){if(typeof r=="function")return new Proxy(r,{apply(a,c,u){return n.log(i.toString(),{args:u}),Reflect.apply(a,c,u)}});this.log(i.toString())}return r}}):this}get el(){return this.element}get isTurboPreview(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}get isTurbolinksPreview(){return this.isTurboPreview}get csrfToken(){return this.metaValue("csrf-token")}metaValue(e){const s=document.head.querySelector(`meta[name="${e}"]`);return(s==null?void 0:s.getAttribute("content"))||null}dispatch(e,s,i={}){let r=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},i);r.detail.target&&(r.detail.target=e);let n=new CustomEvent(s,r);this.logEvent(s,n,e),e.dispatchEvent(n)}log(e,s={}){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),i.log(I({element:this.element,controller:this},s)),i.groupEnd()}warn(e,s={}){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: F39B1AFF","color: unset"),i.warn(I({element:this.element,controller:this},s)),i.groupEnd()}logEvent(e,s,i){if(!this.application.debug)return;let r=console;r.groupCollapsed(`%c${this.identifier} %c${e}%c`,"color: #3B82F6","color: #0be000","color: unset"),r.log({element:i}),r.groupEnd()}}function Ci(t){switch(t){case"application":case"el":case"element":case"constructor":case"initialize":case"log":case"logEvent":case"dispatch":case"data":case"valueDescriptorMap":case"mutate":case"identifier":return!1}return!(/^_.*?$/.test(t)||/^.*?Target(s)?$/.test(t)||/^.*?Value$/.test(t)||/^.*?ValueChanged$/.test(t)||/^.*?Class$/.test(t)||/^.*?Classes$/.test(t))}var ne={exports:{}};const wi=(t,e)=>{let s=!1,i=!1,r=!1;for(let n=0;n<t.length;n++){const a=t[n];s&&/[\p{Lu}]/u.test(a)?(t=t.slice(0,n)+"-"+t.slice(n),s=!1,r=i,i=!0,n++):i&&r&&/[\p{Ll}]/u.test(a)?(t=t.slice(0,n-1)+"-"+t.slice(n-1),r=i,i=!1,s=!0):(s=a.toLocaleLowerCase(e)===a&&a.toLocaleUpperCase(e)!==a,r=i,i=a.toLocaleUpperCase(e)===a&&a.toLocaleLowerCase(e)!==a)}return t},Ei=t=>t.replace(/^[\p{Lu}](?![\p{Lu}])/gu,e=>e.toLowerCase()),Ti=(t,e)=>t.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,(s,i)=>i.toLocaleUpperCase(e.locale)).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,s=>s.toLocaleUpperCase(e.locale)),et=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");return e=I({pascalCase:!1,preserveConsecutiveUppercase:!1},e),Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toLocaleUpperCase(e.locale):t.toLocaleLowerCase(e.locale):(t!==t.toLocaleLowerCase(e.locale)&&(t=wi(t,e.locale)),t=t.replace(/^[_.\- ]+/,""),e.preserveConsecutiveUppercase?t=Ei(t):t=t.toLocaleLowerCase(),e.pascalCase&&(t=t.charAt(0).toLocaleUpperCase(e.locale)+t.slice(1)),Ti(t,e))};ne.exports=et,ne.exports.default=et;var P=ne.exports;class j extends d{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var n,a,c;e.dataset.controller=((n=e.dataset.controller)==null?void 0:n.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",e.dataset.controller==""&&delete e.dataset.controller;let s=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=((a=e.dataset.target)==null?void 0:a.replaceAll(s,""))||"",delete e.dataset[P(`${this.identifier}-target`)],e.dataset.target==""&&delete e.dataset.target,e.dataset.action=((c=e.dataset.target)==null?void 0:c.replaceAll(s,""))||"",delete e.dataset[P(`${this.identifier}-action`)],e.dataset.action==""&&delete e.dataset.action;let i=this.constructor.values;i&&Object.keys(i).forEach(u=>delete e.dataset[P(`${this.identifier}-${u}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(u=>delete e.dataset[P(`${this.identifier}-${u}-class`)])}}const T="scrollBehavior"in document.documentElement.style;let tt;async function k(t,{behavior:e="smooth",block:s="start",inline:i="nearest"}={}){e=="smooth"&&!T&&await S(),t.scrollIntoView({behavior:e,block:s,inline:i})}async function ae(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await S(),t.scrollTo({top:0,left:0,behavior:e})}async function oe(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await S(),t==window?t.scrollTo({top:document.body.scrollHeight,left:0,behavior:e}):t.scrollTo({top:t.scrollHeight,left:0,behavior:e})}async function le(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await S(),t.scrollTo({left:0,behavior:e})}async function Si(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await S(),t==window?t.scrollTo({left:document.body.scrollWidth,behavior:e}):t.scrollTo({left:t.scrollWidth,behavior:e})}async function st(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await S(),t.scrollBy({top:-e,left:0,behavior:s})}async function it(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await S(),t.scrollBy({top:e,left:0,behavior:s})}async function rt(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await S(),t.scrollBy({top:0,left:-e,behavior:s})}async function nt(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await S(),t.scrollBy({top:0,left:e,behavior:s})}async function S(){const{polyfill:t}=await import("smoothscroll-polyfill");tt||(tt=!0,t())}function R(t){if(!t)return null;if(t==document.body)return window;const e=getComputedStyle(t).overflowY;return e!=="visible"&&e!=="hidden"&&t.scrollHeight>=t.clientHeight?t:R(t.parentElement)||document.body}function ce(t){return t.nodeName=="TURBO-FRAME"}function Ai(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map(function(r){r(s)}),(i=t.get("*"))&&i.slice().map(function(r){r(e,s)})}}}const O=Ai();function ki(t){return t.nodeName=="LINK"}function q(t){return t.nodeName=="A"}function ue(t){return t.nodeName=="FORM"}function y(t){return t.nodeName=="INPUT"}function $(t){return t.nodeName=="TEXTAREA"}function B(t){return t.nodeName=="BUTTON"}function L(t){return t.nodeName=="SELECT"}function Vi(t){return t.nodeName=="IMG"}function A(t){return y(t)&&(t.type==="radio"||t.type==="checkbox")}function at(t){return y(t)||L(t)||$(t)}function ot(t){let e=document.createElement("button");return e.type=t,e.style.display="none",e.dataset.sythentic="true",e}function lt(t,e){let s=document.createElement("input");return s.type="hidden",s.name=t,s.value=e,s}function he(t,e,s){let i=t.insertAdjacentElement(e,s);if(!i)throw new Error(`Failed to insert element ${s.nodeName} into ${t.nodeName}`);return i}function Li(t,e,s,i){return he(s,i,lt(t,e))}function de(t,e,s){return he(e,s,ot(t))}function fe(t){if(t.requestSubmit)t.requestSubmit();else{let e=t.querySelector('button[type="submit"]');e||(e=de("submit",t,"beforeend")),e.click()}}function ct(t){let e=t.querySelector('button[type="reset"]');e||(e=de("reset",t,"beforeend")),e.click()}function w(t,e,s,i,r){const n=t.disconnect.bind(t);let a=r;(a==null?void 0:a.debounce)?(i=m.debounce(i.bind(t),a.debounce),delete a.debounce):i=i.bind(t);let c=()=>s.forEach(h=>e.addEventListener(h,i,a)),u=()=>s.forEach(h=>e.removeEventListener(h,i));return c(),Object.assign(t,{disconnect(){u(),n()}}),{setup:c,teardown:u}}function b(t,e,s,i,r){return w(t,e,[s],i,r)}function ut(t,e,s,i,r){let n=[];return e.forEach(a=>{let{setup:c,teardown:u}=w(t,a,s,i,r);n.push({setup:c,teardown:u})}),[()=>n.forEach(a=>a.setup()),()=>n.forEach(a=>a.teardown())]}function M(t,e,s,i,r){return ut(t,e,[s],i,r)}function H(t,e,s){const i=t.disconnect.bind(t);e=e.bind(t);let r=null,n=()=>r=setInterval(e,s),a=()=>{r!==null&&clearInterval(r)};return n(),Object.assign(t,{disconnect(){a(),i()}}),a}function ht(t,e){const s=t.disconnect.bind(t);let i=e||document.documentElement,r=document.fullscreenElement!==null;function n(){r=document.fullscreenElement!==null}function a(){return r}async function c(){document.exitFullscreen&&(r=!1,await document.exitFullscreen())}async function u(){r&&await c(),i.requestFullscreen&&(await i.requestFullscreen(),r=!0)}async function h(){r?await c():await u()}return document.addEventListener("fullscreenchange",n),Object.assign(t,{disconnect(){document.removeEventListener("fullscreenchange",n),s()}}),{isFullscreen:a,enter:u,exit:c,toggle:h}}function V(t,e,s){const i=t.disconnect.bind(t);e=e.bind(t);let r=null,n=()=>r=setTimeout(e,s),a=()=>{r!==null&&clearTimeout(r)};return n(),Object.assign(t,{disconnect(){a(),i()}}),a}function me(t,e,s,i,r={}){const n=t.disconnect.bind(t);let a=Array.from(i.childNodes),c=()=>{let h=e.parentElement;if(["beforebegin","afterend"].includes(s)&&h==null)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":e.append(i);break;case"afterbegin":e.prepend(i);break;case"beforebegin":h.insertBefore(i,e);break;case"afterend":h.insertBefore(i,e);break}},u;return r.cleanup?u=()=>a.forEach(h=>h.remove()):u=()=>{},c(),Object.assign(t,{disconnect(){u(),n()}}),[a,u]}function Mi(t,e,s,i,r={}){const n=document.createRange().createContextualFragment(i);return me(t,e,s,n,r)}function dt(t,e,s,i,r={}){const n=new DocumentFragment;n.append(i);let[a,c]=me(t,e,s,n,r);return[a[0],c]}async function ft(t,e,s){try{return await fetch(e,s)}catch(i){if(t===1)throw i;return await ft(t-1,e,s)}}class x extends d{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}get _maxRetries(){return this.hasMaxRetriesValue?this.maxRetriesValue:1}connect(){}async loadContent(e=null){e==null||e.preventDefault();let s=this,i=this.hasReplaceTarget?this.replaceTarget:this.el,r=()=>{i.replaceWith(this._errorMessage),s.dispatch(i,"ajax:error")};try{let n=await ft(this._maxRetries,this.endpointValue);n.ok||r();let a=await n.text(),c=document.createElement("div");if(c.innerHTML=a,this.hasSelectorValue){let u=c.querySelectorAll(this.selectorValue);i.replaceWith(...u)}else i.replaceWith(...c.children);s.dispatch(i,"ajax:success")}catch{r()}finally{s.dispatch(i,"ajax:complete")}}}l(x,"targets",["replace"]),l(x,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});class pe extends x{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}l(pe,"targets",["replace"]),l(pe,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});const ge=(t,e)=>{const s=t[e];return typeof s=="function"?s:(...i)=>{}},be=(t,e,s)=>{let i=t;return s===!0?i=`${e.identifier}:${t}`:typeof s=="string"&&(i=`${s}:${t}`),i},ve=(t,e,s)=>{const{bubbles:i,cancelable:r,composed:n}=e||{bubbles:!0,cancelable:!0,composed:!0};return e&&Object.assign(s,{originalEvent:e}),new CustomEvent(t,{bubbles:i,cancelable:r,composed:n,detail:s})};function Oi(t){const e=t.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,r=e.top<=s&&e.top+e.height>=0,n=e.left<=i&&e.left+e.width>=0;return r&&n}const xi={dispatchEvent:!0,eventPrefix:!0},ye=(t,e={})=>{const{dispatchEvent:s,eventPrefix:i}=Object.assign({},xi,e),r=(e==null?void 0:e.element)||t.element,n=_=>{const[C]=_;C.isIntersecting?a(C):t.isVisible&&c(C)},a=_=>{if(t.isVisible=!0,ge(t,"appear").call(t,_),s){const C=be("appear",t,i),Z=ve(C,null,{controller:t,entry:_});r.dispatchEvent(Z)}},c=_=>{if(t.isVisible=!1,ge(t,"disappear").call(t,_),s){const C=be("disappear",t,i),Z=ve(C,null,{controller:t,entry:_});r.dispatchEvent(Z)}},u=t.disconnect.bind(t),h=new IntersectionObserver(n,e),f=()=>{h.observe(r)},v=()=>{h.unobserve(r)};return Object.assign(t,{isVisible:!1,disconnect(){v(),u()}}),f(),[f,v]},Di={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},Ni=(t,e={})=>{const{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:n}=Object.assign({},Di,e),a=f=>{const v=(e==null?void 0:e.element)||t.element;if(!(v.contains(f.target)||!Oi(v)&&s)&&(t.clickOutside&&t.clickOutside(f),i)){const _=be("click:outside",t,n),C=ve(_,f,{controller:t});v.dispatchEvent(C)}},c=()=>{r==null||r.forEach(f=>{window.addEventListener(f,a,!1)})},u=()=>{r==null||r.forEach(f=>{window.removeEventListener(f,a,!1)})},h=t.disconnect.bind(t);return Object.assign(t,{disconnect(){u(),h()}}),c(),[c,u]},_e={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class mt{constructor(e,s={}){var i,r,n;this.log=(u,h)=>{!this.debug||(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${u}`,"color: #3B82F6","color: unset"),this.logger.log(I({controllerId:this.controllerId},h)),this.logger.groupEnd())},this.dispatch=(u,h={})=>{if(this.dispatchEvent){const f=h,{event:v}=f,_=fs(f,["event"]),C=this.extendedEvent(u,v||null,_);this.targetElement.dispatchEvent(C),this.log("dispatchEvent",I({eventName:C.type},_))}},this.call=(u,h={})=>{const f=this.controller[u];if(typeof f=="function")return f.call(this.controller,h)},this.extendedEvent=(u,h,f)=>{const{bubbles:v,cancelable:_,composed:C}=h||{bubbles:!0,cancelable:!0,composed:!0};return h&&Object.assign(f,{originalEvent:h}),new CustomEvent(this.composeEventName(u),{bubbles:v,cancelable:_,composed:C,detail:f})},this.composeEventName=u=>{let h=u;return this.eventPrefix===!0?h=`${this.controller.identifier}:${u}`:typeof this.eventPrefix=="string"&&(h=`${this.eventPrefix}:${u}`),h},this.debug=(r=(i=s==null?void 0:s.debug)!==null&&i!==void 0?i:e.application.stimulusUseDebug)!==null&&r!==void 0?r:_e.debug,this.logger=(n=s==null?void 0:s.logger)!==null&&n!==void 0?n:_e.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.targetElement=(s==null?void 0:s.element)||e.element;const{dispatchEvent:a,eventPrefix:c}=Object.assign({},_e,s);Object.assign(this,{dispatchEvent:a,eventPrefix:c}),this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class Ii extends mt{constructor(e,s={}){super(e,s);this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter),this.targetElement.addEventListener("mouseleave",this.onLeave)},this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter),this.targetElement.removeEventListener("mouseleave",this.onLeave)},this.onEnter=i=>{this.call("mouseEnter",i),this.log("mouseEnter",{hover:!0}),this.dispatch("mouseEnter",{hover:!1})},this.onLeave=i=>{this.call("mouseLeave",i),this.log("mouseLeave",{hover:!1}),this.dispatch("mouseLeave",{hover:!1})},this.controller=e,this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller),s=()=>{this.unobserve(),e()};Object.assign(this.controller,{disconnect:s})}}const Bi=(t,e={})=>{const s=new Ii(t,e);return[s.observe,s.unobserve]};class Hi extends mt{constructor(e,s={}){super(e,s);this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(i){this.controller.application.handleError(i,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=i=>{this.call("mutate",i),this.log("mutate",{entries:i}),this.dispatch("mutate",{entries:i})},this.targetElement=(s==null?void 0:s.element)||e.element,this.controller=e,this.options=s,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller),s=()=>{this.unobserve(),e()};Object.assign(this.controller,{disconnect:s})}}const Ce=(t,e={})=>{const s=new Hi(t,e);return[s.observe,s.unobserve]},pt=t=>{const e=n=>{const{innerWidth:a,innerHeight:c}=window,u={height:c||1/0,width:a||1/0,event:n};ge(t,"windowResize").call(t,u)},s=t.disconnect.bind(t),i=()=>{window.addEventListener("resize",e),e()},r=()=>{window.removeEventListener("resize",e)};return Object.assign(t,{disconnect(){r(),s()}}),i(),[i,r]};class Fi extends Qe{}Fi.debounces=[];const Pi=200,gt=(t,e=Pi)=>{let s=null;return function(){const i=arguments,r=this,n=()=>t.apply(r,i);s&&clearTimeout(s),s=setTimeout(n,e)}},ji=(t,e)=>{var s;(s=t.constructor.debounces)===null||s===void 0||s.forEach(r=>{if(typeof r=="string"&&(t[r]=gt(t[r],e==null?void 0:e.wait)),typeof r=="object"){const{name:n,wait:a}=r;if(!n)return;t[n]=gt(t[n],a||(e==null?void 0:e.wait))}})};class Ri extends x{async connect(){let e=this.el;"IntersectionObserver"in window?[this.observe,this.unobserve]=ye(this,{element:e,threshold:.3}):await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}}class we extends x{connect(){if(!this.hasSecondsValue)throw new Error("Required value `seconds` is missing");requestAnimationFrame(()=>{this._timeout(),H(this,this._timeout,this.secondsValue*1e3)})}async _timeout(){await this.loadContent()}}l(we,"targets",["replace"]),l(we,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number,seconds:Number});class bt extends d{get _eventMode(){if(this.hasEventModeValue){if(!["change","input","debounced"].includes(this.eventModeValue))throw new Error(`The modeValue provided '${this.eventModeValue}' is not one of the recognised configuration options`);return this.eventModeValue}else return"change"}get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:1e3}get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get _cssSelector(){let e=["input","textarea","select"],s=":not([data-no-autosubmit])";return e.map(i=>i.concat(s)).join(",")}get inputElements(){return this.element.querySelectorAll(this._cssSelector)}connect(){this.inputElements.forEach(e=>b(this,e,this._eventMode=="change"?"change":"input",this.submit,{debounce:this._eventMode=="debounced"?this._debounceTimeout:void 0}))}submit(){let e=this.el;this._mode=="request"?fe(e):e.submit()}}l(bt,"values",{submitMode:String,eventMode:String,debounceInterval:Number});class qi extends d{connect(){pt(this);let[,e]=ye(this);if(this.unobserveIntersection=e,!$(this.el))throw new Error(`Expected controller to be attached to a textarea, but was a '${this.el.tagName}'`);requestAnimationFrame(()=>{this.el.style.resize="none",this.el.style.boxSizing="border-box",this._handler(),w(this,window,["resize"],this._handler),w(this,this.el,["input","change","focus"],this._handler,{debounce:100})})}appear(e){this.autosize(this.el),this.unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let s=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+s+"px"}}class U extends d{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){requestAnimationFrame(()=>{b(this,this.inputTarget,"input",this._updateCharCount),this._updateCharCount()})}_addErrorClasses(e=this.el){this.hasErrorClass?e.classList.add(...this._errorClasses):e.classList.add(...this._defaultErrorClasses)}_removeErrorClasses(e=this.el){this.hasErrorClass?e.classList.remove(...this._errorClasses):e.classList.remove(...this._defaultErrorClasses)}_updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this._isValidCount(e)?this._removeErrorClasses(this.outputTarget):this._addErrorClasses(this.outputTarget))}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}l(U,"targets",["input","output"]),l(U,"values",{min:Number,max:Number}),l(U,"classes",["error"]);class Ee extends d{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.disableTargets.forEach((e,s)=>{e.disabled=!1})}}l(Ee,"targets",["disabler","disable"]),l(Ee,"values",{clear:Boolean});class Te extends d{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.enableTargets.forEach((e,s)=>{e.disabled=!1})}}l(Te,"targets",["enabler","enable"]),l(Te,"values",{clear:Boolean});class vt extends d{get _checked(){return this._enabled.filter(e=>e.checked)}get _enabled(){return this.checkboxTargets.filter(e=>!e.disabled&&!e.readOnly)}get _unchecked(){return this._enabled.filter(e=>!e.checked)}connect(){requestAnimationFrame(()=>{!this.hasSelectAllTarget||(b(this,this.selectAllTarget,"change",this._toggle),M(this,this.checkboxTargets,"change",this._refresh),this._refresh())})}_toggle(e){e.preventDefault();let s=e.target;this._enabled.forEach(i=>i.checked=i.disabled||i.readOnly?i.checked:s.checked)}_refresh(){const e=this._enabled.length,s=this._checked.length;this.selectAllTarget.checked=s>0,this.selectAllTarget.indeterminate=s>0&&s<e}}l(vt,"targets",["selectAll","checkbox"]);class yt extends d{connect(){M(this,this.checkboxTargets,"change",this._update)}_otherCheckboxes(e){return Array.from(this.checkboxTargets).filter(s=>s!==e)}_update(e){const s=e.target;if(!s)throw new Error("No target found on event");let i=this._otherCheckboxes(s);s.checked&&i.forEach(r=>{r.checked=!1,this.dispatch(this.el,"change")})}}l(yt,"targets",["checkbox"]);class $i extends d{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),w(this,e,["input","change"],this._checkDirty)}restore(e){e==null||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return A(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);return A(e)?s==null?e.defaultChecked:s=="true":(s!==null||L(e)&&Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value}),s)}_elementHasCachedLoadValue(){return this.el.hasAttribute(this._cacheAttrName)}_checkDirty(){let e=this.el;this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(){return this._getElementValue()!==this._getElementLoadValue()}_restoreElementFromLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);A(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):L(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&A(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}}function Ui(t){return t.hasAttribute("data-dirty")}class zi extends d{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),w(this,e,["input","change"],this._checkDirty)}restore(e){e==null||e.preventDefault(),this._formElements.forEach(s=>this._restoreElementFromLoadValue(s))}_getElementValue(e){return A(e)?e.checked:e.value}_getElementLoadValue(e){let s=e.getAttribute(this._cacheAttrName);return A(e)?s==null?e.defaultChecked:s=="true":(s!==null||L(e)&&Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value}),s)}_elementHasCachedLoadValue(e){return e.hasAttribute(this._cacheAttrName)}_checkElementDirty(e){this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(e){return this._getElementValue(e)!==this._getElementLoadValue(e)}_cacheElementLoadValue(e){!this._elementHasCachedLoadValue(e)&&A(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let s=e.getAttribute(this._cacheAttrName);A(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):L(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){this._formElements.forEach(e=>this._cacheElementLoadValue(e))}_checkDirty(){this._formElements.forEach(e=>this._checkElementDirty(e)),this._formElements.some(e=>_t(e))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}}function _t(t){return t.hasAttribute("data-dirty")}class Se extends d{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.inputTargets.forEach((e,s)=>e.disabled=!1)}}l(Se,"targets",["input"]),l(Se,"values",{clear:Boolean});class Ct extends d{get _mode(){const e=["immediate","wait"];if(this.hasModeValue){if(e.includes(this.modeValue))return this.modeValue;throw new Error(`The given modeValue '${this.modeValue}' is not one of the supported modes: "${e.join('", "')}"`)}else return e[0]}connect(){this._mode=="immediate"&&this.steal()}steal(){this.el.focus()}}l(Ct,"values",{mode:String});class Ae extends d{get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get form(){let e;if(this.hasFormSelectorValue){if(e=document.querySelector(this.formSelectorValue),!e)throw new Error(`Could not find a form on the page that matches selector '${this.formSelectorValue}'`)}else e=this.formTarget;return e}submit(e){e==null||e.preventDefault();let s=this.formTarget;this._mode=="request"?fe(s):s.submit()}reset(e){e==null||e.preventDefault(),ct(this.form)}}l(Ae,"targets",["form"]),l(Ae,"values",{formSelector:String,submitMode:String});class wt extends d{get _formID(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this form. Please either specify data-${this.identifier}-id-value or give this form an 'id' attribute. `)}get _formIdentifier(){return`${location.href} ${this._formID}`}get _formElements(){return this.el.elements}get _formData(){let e={[this._formIdentifier]:{}};for(const s of this._formElements){let i=s;i.name.length>0&&(y(i)&&i.type=="checkbox"?e[this._formIdentifier][i.name]=i.checked:y(i)&&i.type=="radio"?i.checked&&(e[this._formIdentifier][i.name]=i.value):e[this._formIdentifier][i.name]=i.value)}return e}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _clearOnSubmit(){return this.hasClearOnSubmitValue?this.clearOnSubmitValue:!0}connect(){requestAnimationFrame(()=>{let e=this.el;if(!ue(e))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&b(this,this.el,"submit",this._clear)})}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatch(this.el,"form-save:cleared")}clear(e){e==null||e.preventDefault(),this._clear()}save(e){e.preventDefault();let s=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(s[this._formIdentifier])),this.dispatch(this.el,"form-save:save:success")}restore(e){if(e==null||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const s=JSON.parse(localStorage.getItem(this._formIdentifier));for(const i of this._formElements){let r=i;r.name in s&&(y(r)&&r.type=="checkbox"?r.checked=s[r.name]:y(r)&&r.type=="radio"?r.value==s[r.name]&&(r.checked=!0):r.value=s[r.name])}this.dispatch(this.el,"form-save:restore:success")}else this.dispatch(this.el,"form-save:restore:empty")}}l(wt,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class ke extends d{connect(){M(this,this.inputTargets,"change",this._handleInputs)}_handleInputs(e){let s=this.inputTargets.reduce((r,n)=>n.checked?r+1:r,0),i=e.target;s>this.maxValue?(e.preventDefault(),i.checked=!1,this.dispatch(i,"change"),this.dispatch(i,"limited-selection:too-many"),this.hasErrorTarget&&this.hasMessageValue&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatch(i,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}l(ke,"targets",["input","error"]),l(ke,"values",{max:Number,message:String});class z extends d{constructor(){super(...arguments);l(this,"_errors",[]);l(this,"_firstClick",!1)}get _currentClasses(){return this.currentClass.split(" ")}get _defaultCurrentClasses(){return["currentError"]}get _errorCount(){return this._errors.length}get _previousIndex(){let e=this._index-1;return e<0?0:e}get _nextIndex(){let e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}get _index(){return m.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}get _selector(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}get _currentError(){return this._errors[this._index]}get _otherErrors(){return this._errors.filter((e,s)=>s!==this._index)}connect(){requestAnimationFrame(()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()})}async current(e){e==null||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await k(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async next(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await k(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async previous(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await k(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_updateClasses(){this._addCurrentClasses(this._currentError),this._otherErrors.forEach(e=>this._removeCurrentClasses(e))}_addCurrentClasses(e=this.el){this.hasCurrentClass?e.classList.add(...this._currentClasses):e.classList.add(...this._defaultCurrentClasses)}_removeCurrentClasses(e=this.el){this.hasCurrentClass?e.classList.remove(...this._currentClasses):e.classList.remove(...this._defaultCurrentClasses)}_toggleVisibility(){this._errorCount===0?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget)if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1){this.nextTarget.removeAttribute("disabled");return}else this.indexValue>=this._errorCount-1?this.nextTarget.setAttribute("disabled","true"):this.nextTarget.removeAttribute("disabled");this.hasPreviousTarget&&(this.indexValue<=0?this.previousTarget.setAttribute("disabled","true"):this.previousTarget.removeAttribute("disabled"))}}l(z,"values",{selector:String,index:Number}),l(z,"classes",["current"]),l(z,"targets",["next","current","previous"]);class Ve extends d{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){e==null||e.preventDefault();const s=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,s)}remove(e){e.preventDefault();const s=e.target.closest(`.${this._wrapperClass}`);if(s==null)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if(s.dataset.newRecord==="true")s.remove();else{s.style.display="none";let i=s.querySelector("input[name*='_destroy']");if(i==null)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");i.value="1"}}_generateID(){return new Date().getTime().toString()+Math.random().toString().slice(2)}_checkStructure(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")}}l(Ve,"targets",["target","template"]),l(Ve,"values",{insertMode:String,wrapperClass:String});class Le extends d{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){M(this,this.passwordTargets,"change",this._checkPasswordsMatch)}_addErrorClasses(e=this.el){this.hasErrorClass?e.classList.add(...this._errorClasses):e.classList.add(...this._defaultErrorClasses)}_removeErrorClasses(e=this.el){this.hasErrorClass?e.classList.remove(...this._errorClasses):e.classList.remove(...this._defaultErrorClasses)}_allPasswordsMatch(){let e=new Set(this.passwordTargets.map(s=>s.value));return e.has("")||e.size==1}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatch(e,"password-confirm:match"),this.hasErrorClass&&this.passwordTargets.forEach(s=>this._removeErrorClasses(s))):(this.dispatch(e,"password-confirm:no-match"),this.hasErrorClass&&this.passwordTargets.forEach(s=>this._addErrorClasses(s)))}}l(Le,"targets",["password"]),l(Le,"classes",["error"]);class Et extends d{peak(e){e==null||e.preventDefault(),this.passwordTarget.type="text"}hide(e){e==null||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e==null||e.preventDefault(),this.passwordTarget.type==="password"?this.peak():this.hide()}}l(Et,"targets",["password"]);class Me extends d{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[s,i,r]=e.detail;if(s instanceof Node){let n=s.querySelector(this._selector);if(n==null)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let a=this.el.parentNode;if(a==null)throw new Error("expected form to have a DOM parent, could not execute replaceChild");a.replaceChild(n,this.el),this.dispatch(n,"remote-form:replace")}else console.log("Unknown",s)}}l(Me,"targets",[]),l(Me,"values",{selector:String});class Tt extends d{get _eventName(){return`sync:${this._key}`}get _key(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}get _value(){let e=this.el;return y(e)&&e.type==="checkbox"?e.checked:y(e)&&e.type==="radio"?e.checked?e.value:"":e.value}set _value(e){let s=this.el;y(s)&&s.type==="checkbox"?s.checked=e.toString()==="true":y(s)&&s.type==="radio"?s.checked=s.value===e:y(s)||$(s)||L(s)?s.value=e.toString():s.innerHTML=e.toString()}initialize(){this._read=this._read.bind(this),this._emit=this._emit.bind(this)}connect(){O.on(this._eventName,this._read),requestAnimationFrame(()=>{at(this.el)&&(this._emit(),b(this,this.el,"input",this._emit))})}disconnect(){O.off(this._eventName,this._read)}_emit(){O.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(e===void 0)throw new Error("No payload received");let{dispatcher:s,value:i}=e;s!==this.el&&(this._value=i)}}l(Tt,"values",{key:String});class W extends d{get _maxMessage(){return this.hasMaxMessageValue?this.maxMessageValue:`Value must be less than ${this.maxValue}`}get _minMessage(){return this.hasMinMessageValue?this.minMessageValue:`Value must be greater than ${this.minValue}`}get _warningHideClasses(){return this.warningHideClass.split(" ")}get _defaultWarningHideClasses(){return["hide"]}get _inputWarningClasses(){return this.inputWarningClass.split(" ")}get _defaultInputWarningClasses(){return[""]}connect(){this._addWarningHideClasses(this.warningTarget),b(this,this.inputTarget,"input",this._check),this._check()}_check(){this.hasMinValue&&Number.parseFloat(this.inputTarget.value)<this.minValue?(this._removeWarningHideClasses(this.warningTarget),this._addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._minMessage):this.hasMaxValue&&Number.parseFloat(this.inputTarget.value)>this.maxValue?(this._removeWarningHideClasses(this.warningTarget),this._addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._maxMessage):(this._addWarningHideClasses(this.warningTarget),this._removeInputWarningClasses(this.inputTarget),this.warningTarget.innerText="")}_addWarningHideClasses(e=this.el){this.hasWarningHideClass?e.classList.add(...this._warningHideClasses):e.classList.add(...this._defaultWarningHideClasses)}_removeWarningHideClasses(e=this.el){this.hasWarningHideClass?e.classList.remove(...this._warningHideClasses):e.classList.remove(...this._defaultWarningHideClasses)}_addInputWarningClasses(e=this.el){this.hasInputWarningClass?e.classList.add(...this._inputWarningClasses):e.classList.add(...this._defaultInputWarningClasses)}_removeInputWarningClasses(e=this.el){this.hasInputWarningClass?e.classList.remove(...this._inputWarningClasses):e.classList.remove(...this._defaultInputWarningClasses)}}l(W,"classes",["inputWarning","warningHide"]),l(W,"targets",["input","warning"]),l(W,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class K extends d{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){this._updateWordCount(),b(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,i=this.inputTarget.value.match(/\S+/g);e=i&&i.length||0,this.outputTarget.innerText=e.toString(),this.hasErrorClass&&(this._isValidCount(e)?this._removeErrorClasses(this.outputTarget):this._addErrorClasses(this.outputTarget))}_addErrorClasses(e=this.el){this.hasErrorClass?e.classList.add(...this._errorClasses):e.classList.add(...this._defaultErrorClasses)}_removeErrorClasses(e=this.el){this.hasErrorClass?e.classList.remove(...this._errorClasses):e.classList.remove(...this._defaultErrorClasses)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}l(K,"targets",["input","output"]),l(K,"values",{min:Number,max:Number}),l(K,"classes",["error"]);class Oe extends d{get _successClasses(){return this.successClass.split(" ")}get _defaultSuccessClasses(){return[]}get _failClasses(){return this.failClass.split(" ")}get _defaultFailClasses(){return[]}initialize(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)}connect(){let e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()}disconnect(){this._removeSuccessClasses(),this._removeFailClasses()}_success(){this._addSuccessClasses()}_fail(){let e=this.el;this._addFailClasses(),this.hasPlaceholderValue&&e.src!==this.placeholderValue?(this.dispatch(e,"fallback-image:placeholder"),e.src=this.placeholderValue,e.onerror=this._fail):(this.dispatch(e,"fallback-image:fail"),e.style.display="none")}_hasLoadedSuccessfully(){let e=this.el;return e.naturalHeight>0&&e.naturalWidth>0}_addFailClasses(e=this.el){this.hasFailClass?e.classList.add(...this._failClasses):e.classList.add(...this._defaultFailClasses)}_removeFailClasses(e=this.el){this.hasFailClass?e.classList.remove(...this._failClasses):e.classList.remove(...this._defaultFailClasses)}_addSuccessClasses(e=this.el){this.hasSuccessClass?e.classList.add(...this._successClasses):e.classList.add(...this._defaultSuccessClasses)}_removeSuccessClasses(e=this.el){this.hasSuccessClass?e.classList.remove(...this._successClasses):e.classList.remove(...this._defaultSuccessClasses)}}l(Oe,"values",{placeholder:String}),l(Oe,"classes",["success","fail"]);var D=window.CustomEvent;(!D||typeof D=="object")&&(D=function(e,s){s=s||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!s.bubbles,!!s.cancelable,s.detail||null),i},D.prototype=window.Event.prototype);function St(t,e){var s="on"+e.type.toLowerCase();return typeof t[s]=="function"&&t[s](e),t.dispatchEvent(e)}function Wi(t){for(;t&&t!==document.body;){var e=window.getComputedStyle(t),s=function(i,r){return!(e[i]===void 0||e[i]===r)};if(e.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;t=t.parentElement}return!1}function F(t){for(;t;){if(t.localName==="dialog")return t;t.parentElement?t=t.parentElement:t.parentNode?t=t.parentNode.host:t=null}return null}function At(t){for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;t&&t.blur&&t!==document.body&&t.blur()}function Ki(t,e){for(var s=0;s<t.length;++s)if(t[s]===e)return!0;return!1}function xe(t){return!t||!t.hasAttribute("method")?!1:t.getAttribute("method").toLowerCase()==="dialog"}function kt(t){var e=["button","input","keygen","select","textarea"],s=e.map(function(a){return a+":not([disabled])"});s.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=t.querySelector(s.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var r=t.querySelectorAll("*"),n=0;n<r.length&&!(r[n].tagName&&r[n].shadowRoot&&(i=kt(r[n].shadowRoot),i));n++);return i}function Vt(t){return t.isConnected||document.body.contains(t)}function Lt(t){if(t.submitter)return t.submitter;var e=t.target;if(!(e instanceof HTMLFormElement))return null;var s=p.formSubmitter;if(!s){var i=t.target,r="getRootNode"in i&&i.getRootNode()||document;s=r.activeElement}return!s||s.form!==e?null:s}function Ji(t){if(!t.defaultPrevented){var e=t.target,s=p.imagemapUseValue,i=Lt(t);s===null&&i&&(s=i.value);var r=F(e);if(!!r){var n=i&&i.getAttribute("formmethod")||e.getAttribute("method");n==="dialog"&&(t.preventDefault(),s!=null?r.close(s):r.close())}}}function Mt(t){if(this.dialog_=t,this.replacedStyleTop_=!1,this.openAsModal_=!1,t.hasAttribute("role")||t.setAttribute("role","dialog"),t.show=this.show.bind(this),t.showModal=this.showModal.bind(this),t.close=this.close.bind(this),t.addEventListener("submit",Ji,!1),"returnValue"in t||(t.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(t,{attributes:!0,attributeFilter:["open"]})}else{var s=!1,i=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),r,n=function(a){if(a.target===t){var c="DOMNodeRemoved";s|=a.type.substr(0,c.length)===c,window.clearTimeout(r),r=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){t.addEventListener(a,n)})}Object.defineProperty(t,"open",{set:this.setOpen.bind(this),get:t.hasAttribute.bind(t,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Mt.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Vt(this.dialog_)||this.downgradeModal()},downgradeModal:function(){!this.openAsModal_||(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),p.dm.removeDialog(this))},setOpen:function(t){t?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(t){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var s=document.createEvent("MouseEvents");s.initMouseEvent(t.type,t.bubbles,t.cancelable,window,t.detail,t.screenX,t.screenY,t.clientX,t.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget),this.dialog_.dispatchEvent(s),t.stopPropagation()},focus_:function(){var t=this.dialog_.querySelector("[autofocus]:not([disabled])");!t&&this.dialog_.tabIndex>=0&&(t=this.dialog_),t||(t=kt(this.dialog_)),At(document.activeElement),t&&t.focus()},updateZIndex:function(t,e){if(t<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=t,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Vt(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!p.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");Wi(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,p.needsCentering(this.dialog_)?(p.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(t){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),t!==void 0&&(this.dialog_.returnValue=t);var e=new D("close",{bubbles:!1,cancelable:!1});St(this.dialog_,e)}};var p={};if(p.reposition=function(t){var e=document.body.scrollTop||document.documentElement.scrollTop,s=e+(window.innerHeight-t.offsetHeight)/2;t.style.top=Math.max(e,s)+"px"},p.isInlinePositionSetByStylesheet=function(t){for(var e=0;e<document.styleSheets.length;++e){var s=document.styleSheets[e],i=null;try{i=s.cssRules}catch{}if(!!i)for(var r=0;r<i.length;++r){var n=i[r],a=null;try{a=document.querySelectorAll(n.selectorText)}catch{}if(!(!a||!Ki(a,t))){var c=n.style.getPropertyValue("top"),u=n.style.getPropertyValue("bottom");if(c&&c!=="auto"||u&&u!=="auto")return!0}}}return!1},p.needsCentering=function(t){var e=window.getComputedStyle(t);return e.position!=="absolute"||t.style.top!=="auto"&&t.style.top!==""||t.style.bottom!=="auto"&&t.style.bottom!==""?!1:!p.isInlinePositionSetByStylesheet(t)},p.forceRegisterDialog=function(t){if((window.HTMLDialogElement||t.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",t),t.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Mt(t)},p.registerDialog=function(t){t.showModal||p.forceRegisterDialog(t)},p.DialogManager=function(){this.pendingDialogStack=[];var t=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(e){this.forwardTab_=void 0,e.stopPropagation(),t([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=1e5+150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var s=[];e.forEach(function(i){for(var r=0,n;n=i.removedNodes[r];++r){if(n instanceof Element)n.localName==="dialog"&&s.push(n);else continue;s=s.concat(n.querySelectorAll("dialog"))}}),s.length&&t(s)}))},p.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},p.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},p.DialogManager.prototype.updateStacking=function(){for(var t=this.zIndexHigh_,e=0,s;s=this.pendingDialogStack[e];++e)s.updateZIndex(--t,--t),e===0&&(this.overlay.style.zIndex=--t);var i=this.pendingDialogStack[0];if(i){var r=i.dialog.parentNode||document.body;r.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},p.DialogManager.prototype.containedByTopDialog_=function(t){for(;t=F(t);){for(var e=0,s;s=this.pendingDialogStack[e];++e)if(s.dialog===t)return e===0;t=t.parentElement}return!1},p.DialogManager.prototype.handleFocus_=function(t){var e=t.composedPath?t.composedPath()[0]:t.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(t.preventDefault(),t.stopPropagation(),At(e),this.forwardTab_!==void 0)){var s=this.pendingDialogStack[0],i=s.dialog,r=i.compareDocumentPosition(e);return r&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},p.DialogManager.prototype.handleKey_=function(t){if(this.forwardTab_=void 0,t.keyCode===27){t.preventDefault(),t.stopPropagation();var e=new D("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&St(s.dialog,e)&&s.dialog.close()}else t.keyCode===9&&(this.forwardTab_=!t.shiftKey)},p.DialogManager.prototype.checkDOM_=function(t){var e=this.pendingDialogStack.slice();e.forEach(function(s){t.indexOf(s.dialog)!==-1?s.downgradeModal():s.maybeHideModal()})},p.DialogManager.prototype.pushDialog=function(t){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(t)===1&&this.blockDocument(),this.updateStacking(),!0)},p.DialogManager.prototype.removeDialog=function(t){var e=this.pendingDialogStack.indexOf(t);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},p.dm=new p.DialogManager,p.formSubmitter=null,p.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Ot=document.createElement("form");if(Ot.setAttribute("method","dialog"),Ot.method!=="dialog"){var N=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(N){var Xi=N.get;N.get=function(){return xe(this)?"dialog":Xi.call(this)};var Gi=N.set;N.set=function(t){return typeof t=="string"&&t.toLowerCase()==="dialog"?this.setAttribute("method",t):Gi.call(this,t)},Object.defineProperty(HTMLFormElement.prototype,"method",N)}}document.addEventListener("click",function(t){if(p.formSubmitter=null,p.imagemapUseValue=null,!t.defaultPrevented){var e=t.target;if("composedPath"in t){var s=t.composedPath();e=s.shift()||e}if(!(!e||!xe(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;p.imagemapUseValue=t.offsetX+","+t.offsetY}var r=F(e);!r||(p.formSubmitter=e)}}},!1),document.addEventListener("submit",function(t){var e=t.target,s=F(e);if(!s){var i=Lt(t),r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&t.preventDefault()}});var Yi=HTMLFormElement.prototype.submit,Zi=function(){if(!xe(this))return Yi.call(this);var t=F(this);t&&t.close()};HTMLFormElement.prototype.submit=Zi}class De extends d{constructor(){super(...arguments);l(this,"_dialog",null)}get _src(){return this.hasSrcValue?this.srcValue:this.el.src}get _srcSet(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}get _sizes(){return this.hasSizesValue?this.sizesValue:this.el.sizes}get _modalClassName(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}get _imageClassName(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}initialize(){this.open=this.open.bind(this),this.close=this.close.bind(this)}connect(){}disconnect(){this.close()}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let s=document.createElement("img");s.className=this._imageClassName,s.src=this._src,s.srcset=this._srcSet,s.sizes=this._sizes,this._dialog.appendChild(s),e.insertAdjacentElement("afterend",this._dialog),p.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),k(this._dialog,{behavior:"smooth",block:"end"}).catch(()=>this._dialog.scrollIntoView(!1)),b(this,this._dialog,"click",this.close),b(this,this._dialog,"cancel",this.close),b(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,k(this.el,{behavior:"smooth",block:"end"}).catch(()=>this.el.scrollIntoView(!1)))}}l(De,"values",{src:String,srcSet:String,sizes:String}),l(De,"classes",["modal","image"]);class xt extends d{initialize(){}connect(){}disconnect(){}async play(e){e==null||e.preventDefault(),await this.mediaTarget.play()}pause(e){e==null||e.preventDefault(),this.mediaTarget.pause()}restart(e){e==null||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){e==null||e.preventDefault(),this.mediaTarget.currentTime+=5}}l(xt,"targets",["media"]);class Dt extends d{get _increment(){return this.hasIncrementValue?this.incrementValue:50}get _behaviour(){if(this.hasBehaviourValue){if(["auto","smooth"].includes(this.behaviourValue))return this.behaviourValue;throw new Error(`'${this.behaviourValue}' is not a recognised scroll behaviour`)}else return"auto"}async scrollTop(e){e==null||e.preventDefault(),await ae(this.el,{behavior:this._behaviour})}async scrollBottom(e){e==null||e.preventDefault(),await oe(this.el,{behavior:this._behaviour})}async scrollLeft(e){e==null||e.preventDefault(),await le(this.el,{behavior:this._behaviour})}async scrollRight(e){e==null||e.preventDefault(),await le(this.el,{behavior:this._behaviour})}async up(e){e==null||e.preventDefault(),await st(this.el,this._increment,{behavior:this._behaviour})}async down(e){e==null||e.preventDefault(),await it(this.el,this._increment,{behavior:this._behaviour})}async left(e){e==null||e.preventDefault(),await rt(this.el,this._increment,{behavior:this._behaviour})}async right(e){e==null||e.preventDefault(),await nt(this.el,this._increment,{behavior:this._behaviour})}}l(Dt,"values",{behaviour:String,increment:Number});class Nt extends j{connect(){requestAnimationFrame(()=>{k(this.el,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.el.scrollIntoView()),this._cleanupSelf()})}}l(Nt,"values",{behavior:String,block:String,inline:String});class It extends d{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=R(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await oe(this._scrollTarget)}}l(It,"values",{mode:String});class Bt extends d{scroll(){let e=document.querySelector(this.selectorValue);if(!e){console.warn(`Could not find target for '${this.selectorValue}'`);return}k(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView())}}l(Bt,"values",{selector:String,behavior:String,block:String,inline:String});class Ht extends d{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=R(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await ae(this._scrollTarget)}}l(Ht,"values",{mode:String});class Ft extends d{get _name(){return this.hasNameValue?this.nameValue:this.element.name}get _eventName(){return`signal:value:${this._name}`}connect(){w(this,this.el,["input"],this.emitValue,{debounce:1e3}),w(this,this.el,["change"],this.emitValue),requestAnimationFrame(()=>this.emitValue())}emitValue(){let e=this.el.value;y(this.el)&&this.el.type==="checkbox"&&(e=this.el.checked?"true":"false"),O.emit(this._eventName,{element:this.el,value:e})}}l(Ft,"values",{name:String});class Ne extends d{get _predicates(){let e=this.showValue.replaceAll(" ","").trim(),s=e.includes("&&"),i=e.includes("||"),r=e.includes("(")||e.includes(")");if(s&&i)throw new Error("Cannot have both && and || in the same expression.");if(r)throw new Error("Cannot have logical groupings `(>3 && <= 9) || (>1 && <2)` in the expression. Only supports simple expressions like `>1 && <3`");let n=e.split(s?"&&":"||");return s?n.map(a=>this._predicateForExpression(a)):i?n.map(a=>this._predicateForExpression(a)):[this._predicateForExpression(e)]}get _hideClasses(){return this.hideClass.split(" ")}get _defaultHideClasses(){return["hide"]}get _eventName(){return`signal:value:${this.nameValue}`}_predicateForExpression(e){let i=[">=","<=","==","!=",">","<"].find(c=>e.includes(c));if(!i)throw new Error(`Could not find operator in expression: ${e}`);let r=e.split(i)[1],n=/^-?[0-9]\d*(\.\d+)?$/.test(r);r=n?parseFloat(r):r;let a=c=>c!=="";switch(i){case">":return c=>n&&a(c)&&c>r;case"<":return c=>n&&a(c)&&c<r;case">=":return c=>n&&a(c)&&c>=r;case"<=":return c=>n&&a(c)&&c<=r;case"==":return c=>a(c)&&c==r;case"!=":return c=>a(c)&&c!=r;default:throw new Error(`Unknown operator ${i}`)}}initialize(){this._onSignal=this._onSignal.bind(this)}connect(){O.on(this._eventName,this._onSignal)}_onSignal(e){let s=e.value;if(this.showValue=="default"){s==""?this._removeHideClasses(this.el):this._addHideClasses(this.el);return}this._predicates.every(i=>i(s))?this._removeHideClasses(this.el):this._addHideClasses(this.el)}_addHideClasses(e=this.el){this.hasHideClass?e.classList.add(...this._hideClasses):e.classList.add(...this._defaultHideClasses)}_removeHideClasses(e=this.el){this.hasHideClass?e.classList.remove(...this._hideClasses):e.classList.remove(...this._defaultHideClasses)}}l(Ne,"values",{name:String,show:String}),l(Ne,"classes",["hide"]);class Pt extends d{constructor(){super(...arguments);l(this,"_lastIndex",null);l(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(e==null)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(e.length==0)throw new Error("Expected table to have a <thead> element with at least one row.");return Array.from(e[0].cells)}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}connect(){requestAnimationFrame(()=>{M(this,this._tableHeaders,"click",this.sort),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)})}sort(e){e.preventDefault();let s=e.target,i=this._indexOfHeaderCell(s);s.dataset.sort=="asc"?(this._reverse=!0,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="desc",this._sortByColumn(i)):(this._reverse=!1,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="asc",this._sortByColumn(i))}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_otherHeaderCells(e){return Array.from(this._tableHeaders).filter(s=>s!=e)}_sortByColumn(e){let s=document.createDocumentFragment();this._tableRows.sort((n,a)=>{var _,C;let c=Array.from(n.cells),u=Array.from(a.cells),h=((_=c[e])==null?void 0:_.innerText)||"",f=((C=u[e])==null?void 0:C.innerText)||"",v=h.localeCompare(f,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return n.dataset.sortTop||a.dataset.sortBottom?n.dataset.sortTop&&a.dataset.sortTop?v:-1:n.dataset.sortBottom||a.dataset.sortTop?n.dataset.sortBottom&&a.dataset.sortBottom?v:1:this._reverse?v>0?-1:1:v}).forEach(n=>s.appendChild(n)),this._tableBody.innerHTML="",this._tableBody.appendChild(s),this._lastIndex=e}}l(Pt,"values",{startSort:Number});class Ie extends d{get _truncated(){return this.hasTruncatedValue?this.truncatedValue:!1}set _truncated(e){this.truncatedValue=e}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}get _limit(){return this.hasLimitValue?this.limitValue:20}initialize(){this.truncate=this.truncate.bind(this),this.expand=this.expand.bind(this)}connect(){Ce(this,{childList:!0,element:this._tableBody}),requestAnimationFrame(()=>{this.truncate(),b(this,this.showMoreTarget,"click",this.expand)})}truncate(e){e==null||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._hideElement(s)}),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,e==null||e.preventDefault(),this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._showElement(s)}),this._hideElement(this.showMoreTarget)}mutate(e){this._truncated&&this._reTruncate()}_showElement(e){e.style.display=""}_hideElement(e){e.style.display="none"}_reTruncate(){this._tableRows.slice(0,this._limit).forEach(e=>{e!==this.showMoreTarget&&this._showElement(e)}),this._tableRows.slice(this._limit).forEach(e=>{e!==this.showMoreTarget&&this._hideElement(e)}),this._showElement(this.showMoreTarget)}}l(Ie,"targets",["showMore"]),l(Ie,"values",{limit:Number,truncated:Boolean});class jt extends d{alert(){alert(this.messageValue)}}l(jt,"values",{message:String});class Qi extends d{connect(){let{enter:e,exit:s,toggle:i}=ht(this);this.enter=e,this.exit=s,this.toggle=i}}class Rt extends d{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map(e=>Number.parseFloat(e.trim())).filter(e=>e>=0&&e<=1):[0,1]}connect(){ye(this,{threshold:this._threshold,element:this.el})}appear(e){this.dispatch(this.el,"intersection:appear",{detail:{element:this.el}})}disappear(e){this.dispatch(this.el,"intersection:disappear",{detail:{element:this.el}})}}l(Rt,"values",{threshold:String});class qt extends d{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(()=>{H(this,this._interval,this.secondsValue*1e3)})}_interval(){this.dispatch(this.el,"interval:action")}}l(qt,"values",{seconds:Number});class $t extends d{get name(){return this.hasNameValue?this.nameValue:""}get _addedEventName(){return[this.name,"presence","added"].filter(e=>!!e).join(":")}get _removedEventName(){return[this.name,"presence","removed"].filter(e=>!!e).join(":")}connect(){this.dispatch(this.el,this._addedEventName)}disconnect(){this.dispatch(this.el,this._removedEventName)}}l($t,"values",{name:String});class Ut extends d{print(e){e==null||e.preventDefault(),window.print()}}class zt extends d{connect(){requestAnimationFrame(()=>{V(this,this._timeout,this.secondsValue*1e3)})}_timeout(){this.dispatch(this.el,"timeout")}}l(zt,"values",{seconds:Number});class er extends d{connect(){w(this,window,["focus","blur"],this._handleVisibility),b(this,document,"visibilitychange",this._handleVisibility),requestAnimationFrame(()=>{this._handleVisibility()})}appear(){this.dispatch(this.el,"user-focus:active")}away(){this.dispatch(this.el,"user-focus:away")}_handleVisibility(){this._documentIsActive()?this.appear():this.away()}_documentIsActive(){return document.visibilityState=="visible"&&document.hasFocus()}}class Wt extends d{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame(()=>{H(this,this._tick,this._tickInterval)})}_tick(){let e=new Date;this.hasHoursTarget&&(this.hoursTarget.innerHTML=e.getHours().toString().padStart(2,"0")),this.hasMinutesTarget&&(this.minutesTarget.innerHTML=e.getMinutes().toString().padStart(2,"0")),this.hasSecondsTarget&&(this.secondsTarget.innerHTML=e.getSeconds().toString().padStart(2,"0")),this.hasMillisecondsTarget&&(this.millisecondsTarget.innerHTML=e.getMilliseconds().toString().padStart(3,"0"))}}l(Wt,"targets",["hours","minutes","seconds","milliseconds"]);class J extends d{constructor(){super(...arguments);l(this,"_interval",null)}get _removeUnused(){return this.hasRemoveUnusedValue?this.removeUnusedValue:!1}get _endedClasses(){return this.endedClass.split(" ")}get _defaultEndedClasses(){return[]}get _countingDownClasses(){return this.countingDownClass.split(" ")}get _defaultCountingDownClasses(){return[]}get _deadlineDate(){return new Date(this.deadlineValue)}connect(){this._interval=setInterval(this._tick.bind(this),1e3),this._addCountingDownClasses()}disconnect(){this._clearTick(),this._removeCountingDownClasses(),this._removeEndedClasses()}deadlineValueChanged(){this._interval==null&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let s={};g.isPast(this._deadlineDate)?(s={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this._removeCountingDownClasses(),this._addEndedClasses(),this.dispatch(this.el,"countdown:ended")):s=g.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(s)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(s)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(s)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(s)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(s)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(s))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,s){this._removeTargetIfUnused(e,s),e.innerHTML=s.toString()}_removeTargetIfUnused(e,s){this._removeUnused&&(s===0&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():s==0?e.dataset.unused=Date.now().toString():e.dataset.unused=void 0)}_years(e){return e.years||0}_months(e){return e.months||0}_days(e){return e.days||0}_hours(e){return e.hours||0}_minutes(e){return e.minutes||0}_seconds(e){return e.seconds||0}_addEndedClasses(e=this.el){this.hasEndedClass?e.classList.add(...this._endedClasses):e.classList.add(...this._defaultEndedClasses)}_removeEndedClasses(e=this.el){this.hasEndedClass?e.classList.remove(...this._endedClasses):e.classList.remove(...this._defaultEndedClasses)}_addCountingDownClasses(e=this.el){this.hasCountingDownClass?e.classList.add(...this._countingDownClasses):e.classList.add(...this._defaultCountingDownClasses)}_removeCountingDownClasses(e=this.el){this.hasCountingDownClass?e.classList.remove(...this._countingDownClasses):e.classList.remove(...this._defaultCountingDownClasses)}}l(J,"values",{deadline:String,removeUnused:Boolean}),l(J,"targets",["years","months","days","hours","minutes","seconds"]),l(J,"classes",["countingDown","ended"]);class Kt extends d{get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:s,weeks:i,days:r,hours:n,minutes:a,seconds:c}=this._duration;e||(e=0),s||(s=0),i||(i=0),r||(r=0),n||(n=0),a||(a=0),c||(c=0);let u=[e,s,i,r,n];return!this._minutes&&!this._seconds&&u.every(h=>h===0)?(a=a+c/60,`${(a/60).toFixed(1)} hours`):g.formatDuration(this._duration,{format:this._format,delimiter:", "})}get _seconds(){return this.hasSecondsValue?this.secondsValue:!0}get _minutes(){return this.hasMinutesValue?this.minutesValue:!0}get _timestamp(){if(this.hasTimestampValue)return g.toDate(this.timestampValue*1e3);throw new Error("Expected `timestampValue` to be present")}get _duration(){return g.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=H(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._clearInterval()}}}l(Kt,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class X extends d{get _hideClasses(){return this.hideClass.split(" ")}get _defaultHideClasses(){return["hide"]}get _activeClasses(){return this.activeClass.split(" ")}get _defaultActiveClasses(){return["is-active"]}get _currentTab(){return this.hasCurrentTabValue?this.currentTabValue:0}get _equalize(){return this.hasEqualizeValue?this.equalizeValue:!1}connect(){M(this,this.linkTargets,"click",this.switchTabs),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}switchTabs(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)}currentTabValueChanged(){let e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)}_selectTab(e){e=this._clampIndex(e);let s=this.linkTargets,i=this.contentTargets,r=i[e],n=s[e],a=[...i.slice(0,e),...i.slice(e+1)],c=[...s.slice(0,e),...s.slice(e+1)];this._addActiveClasses(n),n.setAttribute("aria-selected","true"),this._addActiveClasses(r),this._removeHideClasses(r),c.forEach(u=>{u.removeAttribute("aria-selected"),this._removeActiveClasses(u)}),a.forEach(u=>{this._removeActiveClasses(u),this._addHideClasses(u)})}_clampIndex(e){return m.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach(s=>{let i=s.hasAttribute("tab-hidden");i&&this._removeHideClasses(s);let r=s.offsetHeight;r>e&&(e=r),i&&this._addHideClasses(s)}),this.contentTargets.forEach(s=>s.style.minHeight=e+"px")}_addHideClasses(e=this.el){e.setAttribute("tab-hidden","true"),this.hasHideClass?e.classList.add(...this._hideClasses):e.classList.add(...this._defaultHideClasses)}_removeHideClasses(e=this.el){e.removeAttribute("tab-hidden"),this.hasHideClass?e.classList.remove(...this._hideClasses):e.classList.remove(...this._defaultHideClasses)}_addActiveClasses(e=this.el){this.hasActiveClass?e.classList.add(...this._activeClasses):e.classList.add(...this._defaultActiveClasses)}_removeActiveClasses(e=this.el){this.hasActiveClass?e.classList.remove(...this._activeClasses):e.classList.remove(...this._defaultActiveClasses)}}l(X,"values",{currentTab:Number,equalize:Boolean}),l(X,"targets",["link","content"]),l(X,"classes",["active","hide"]);class Jt extends d{get _duration(){return g.isPast(this._timestamp)?g.intervalToDuration({start:this._timestamp,end:new Date}):g.intervalToDuration({start:new Date,end:this._timestamp})}get _nextUpdate(){let e=this._duration;return e.years&&e.years>0||e.months&&e.months>0||e.days&&e.days>0?null:e.hours&&e.hours>0?18e5:3e4}timestampValueChanged(){this._timestamp=g.toDate(this.timestampValue*1e3)}initialize(){this._update=this._update.bind(this)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=g.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&V(this,this._update,this._nextUpdate)}}l(Jt,"values",{timestamp:Number});class Xt extends d{get _collapsedClasses(){return this.hasCollapsedClass?this.collapsedClass.split(" "):this._defaultCollapsedClasses}get _defaultCollapsedClasses(){return["collapsed"]}get _activeClasses(){return this.hasActiveClass?this.activeClass.split(" "):this._defaultActiveClasses}get _defaultActiveClasses(){return["active"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){this._setup(),Ce(this,{subtree:!0,childList:!0})}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const s=i=>{let r=i.parentElement;r&&(this._nodeActive(r)||this._hideNode(r),r.removeEventListener("click",this._nodeClicked),r.addEventListener("click",this._nodeClicked))};(e.tagName==="UL"||e.tagName==="OL")&&s(e),e.querySelectorAll("ul, ol").forEach(i=>s(i))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach(e=>this._teardownNode(e))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach(s=>{s.removeEventListener("click",this._nodeClicked),this._removeActiveClasses(s),this._removeCollapsedClasses(s)})}_nodeClicked(e){e&&e.stopImmediatePropagation();let s=e.target;!s||!this._hasNested(s)||(this._nodeActive(s)?this._hideNode(s):this._showNode(s))}_nodeActive(e){return this._activeClasses.every(s=>e.classList.contains(s))}_showNode(e){this._removeCollapsedClasses(e),this._addActiveClasses(e)}_hideNode(e){this._removeActiveClasses(e),this._addCollapsedClasses(e)}_hasNested(e){return e.querySelectorAll("ul, ol").length>0}mutate(e){for(const s of e)s.type==="childList"&&(Array.from(s.addedNodes||[]).forEach(i=>this._setupNode(i)),Array.from(s.removedNodes||[]).forEach(i=>this._teardownNode(i)))}_addCollapsedClasses(e=this.el){this.hasCollapsedClass?e.classList.add(...this._collapsedClasses):e.classList.add(...this._defaultCollapsedClasses)}_removeCollapsedClasses(e=this.el){this.hasCollapsedClass?e.classList.remove(...this._collapsedClasses):e.classList.remove(...this._defaultCollapsedClasses)}_addActiveClasses(e=this.el){this.hasActiveClass?e.classList.add(...this._activeClasses):e.classList.add(...this._defaultActiveClasses)}_removeActiveClasses(e=this.el){this.hasActiveClass?e.classList.remove(...this._activeClasses):e.classList.remove(...this._defaultActiveClasses)}}l(Xt,"classes",["active","collapsed"]);class Be extends d{get _activeClasses(){return this.activeClass.split(" ")}get _defaultActiveClasses(){return["active"]}get _inactiveClasses(){return this.inactiveClass.split(" ")}get _defaultInactiveClasses(){return["inactive"]}get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}connect(){requestAnimationFrame(()=>{this._checkAnchor(),b(this,window,"hashchange",this._checkAnchor)})}write(e){e==null||e.preventDefault(),this._anchor=this._key}_addActiveClasses(e=this.el){this.hasActiveClass?e.classList.add(...this._activeClasses):e.classList.add(...this._defaultActiveClasses)}_removeActiveClasses(e=this.el){this.hasActiveClass?e.classList.remove(...this._activeClasses):e.classList.remove(...this._defaultActiveClasses)}_addInactiveClasses(e=this.el){this.hasInactiveClass?e.classList.add(...this._inactiveClasses):e.classList.add(...this._defaultInactiveClasses)}_removeInactiveClasses(e=this.el){this.hasInactiveClass?e.classList.remove(...this._inactiveClasses):e.classList.remove(...this._defaultInactiveClasses)}_checkAnchor(){this._key===this._anchor?(this.dispatch(this.el,"anchor-spy:active"),this._addActiveClasses(this.el),this._removeInactiveClasses(this.el)):(this.dispatch(this.el,"anchor-spy:inactive"),this._addInactiveClasses(this.el),this._removeActiveClasses(this.el))}}l(Be,"values",{key:String}),l(Be,"classes",["active","inactive"]);class Gt extends d{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){b(this,this.el,"click",this.goBack)}goBack(e){e==null||e.preventDefault(),history.go(-this._pages),this.el.href&&V(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}l(Gt,"values",{timeout:Number,pages:Number});class He extends d{constructor(){super(...arguments);l(this,"_supported",!1)}connect(){this._supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this._supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this._supported&&document.execCommand("copy")}}l(He,"targets",["source","button","copy","fallback"]),l(He,"values",{removeUnused:Boolean});class Yt extends d{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(ue(this.el))return"submit";if(q(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame(()=>{b(this,this.el,this._eventType,this.confirm)})}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatch(this.el,"confirm:cancelled"))}}l(Yt,"values",{message:String});class Zt extends d{get _message(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}initialize(){this.allowSubmit=this.allowSubmit.bind(this),this.confirmNavigation=this.confirmNavigation.bind(this),this.confirmTurboNavigation=this.confirmTurboNavigation.bind(this)}connect(){window.onbeforeunload=()=>this._message,b(this,window,"popstate",this.confirmNavigation),b(this,window,"submit",this.allowSubmit),w(this,window,["turbolinks:before-visit","turbo:before-visit"],this.confirmTurboNavigation)}disconnect(){window.onbeforeunload=null}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}l(Zt,"values",{message:String});class Qt extends d{connect(){console.log("Debug Controller",this,this.testTargets)}}l(Qt,"targets",["test"]);class es extends d{constructor(){super(...arguments);l(this,"_cacheText")}get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}initialize(){}connect(){requestAnimationFrame(()=>{w(this,this.el,["click"],this.disable),w(this,window,["turbo:load","turbolinks:load"],this._enable)})}disable(e){let s=this.el;this._isDisabled(s)?(e==null||e.preventDefault(),e==null||e.stopImmediatePropagation()):(this._cacheText=this._getElText(s),this._setElText(s,this._message),this._disable(),V(this,this.enable,this._timeout))}enable(e){e==null||e.preventDefault();let s=this.el;this._isDisabled(s)&&(this._setElText(s,this._cacheText),this._enable())}_isDisabled(e){return y(e)&&e.type=="submit"||B(e)?e.disabled:e.dataset.disabled=="true"}_getElText(e){return y(e)&&e.type=="submit"?e.value:e.innerText}_setElText(e,s){y(e)&&e.type=="submit"?e.value=s:(B(e)||q(e))&&(e.innerText=s)}_disable(){let e=this.el;y(e)&&e.type=="submit"||B(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;y(e)&&e.type=="submit"||B(e)?e.disabled=!1:e.dataset.disabled=void 0}}l(es,"values",{message:String,timeout:Number});class ts extends d{dismiss(){this.el.remove()}}class tr extends ts{}class Fe extends d{get _id(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this element. Please either specify data-${this.identifier}-id-value or give this element an 'id' attribute. `)}get _uniqueIdentifier(){return`${location.href} ${this._id}`}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _element(){return this.hasElementTarget?this.elementTarget:this.el}connect(){requestAnimationFrame(()=>{this._restoreOnLoad&&this.restore()})}clear(e){e&&e.preventDefault(),localStorage.removeItem(this._uniqueIdentifier),this.dispatch(this._element,"element-save:cleared")}save(e){e&&e.preventDefault();let s=this._element,i=this.attributesValue.split(" "),r={};i.forEach(n=>r[n]=m.get(s,n)),localStorage.setItem(this._uniqueIdentifier,JSON.stringify(r)),this.dispatch(s,"element-save:save:success")}restore(e){e&&e.preventDefault();let s=this._element;if(localStorage.getItem(this._uniqueIdentifier)){const i=JSON.parse(localStorage.getItem(this._uniqueIdentifier));Object.keys(i).forEach(r=>{m.set(s,r,i[r])}),this.dispatch(s,"element-save:restore:success")}else this.dispatch(s,"element-save:restore:empty")}}l(Fe,"targets",["element"]),l(Fe,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class G extends d{get _container(){return this.hasContainerTarget?this.containerTarget:this.el}get _notEmptyClasses(){return this.notEmptyClass.split(" ")}get _defaultNotEmptyClasses(){return[]}get _emptyClasses(){return this.emptyClass.split(" ")}get _defaultEmptyClasses(){return[]}get _children(){let e=this._container;return this.hasScopeSelectorValue?Array.from(e.querySelectorAll(this.scopeSelectorValue)):Array.from(e.children)}connect(){Ce(this,{element:this._container,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,s=this._children;s.length===0?(this._removeNotEmptyClasses(),this._addEmptyClasses(),this.dispatch(e,"dom:empty")):(this._addNotEmptyClasses(),this._removeEmptyClasses(),this.dispatch(e,"dom:not-empty",{detail:{count:s.length}}))}_addNotEmptyClasses(e=this.el){this.hasNotEmptyClass?e.classList.add(...this._notEmptyClasses):e.classList.add(...this._defaultNotEmptyClasses)}_removeNotEmptyClasses(e=this.el){this.hasNotEmptyClass?e.classList.remove(...this._notEmptyClasses):e.classList.remove(...this._defaultNotEmptyClasses)}_addEmptyClasses(e=this.el){this.hasEmptyClass?e.classList.add(...this._emptyClasses):e.classList.add(...this._defaultEmptyClasses)}_removeEmptyClasses(e=this.el){this.hasEmptyClass?e.classList.remove(...this._emptyClasses):e.classList.remove(...this._defaultEmptyClasses)}}l(G,"targets",["container"]),l(G,"classes",["empty","notEmpty"]),l(G,"values",{scopeSelector:String});class ss extends d{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var s,i;const e=document.createElement("link");return((s=e.relList)==null?void 0:s.supports)&&((i=e.relList)==null?void 0:i.supports("prefetch"))}get _href(){return this.el.href}get _existingPrefetch(){return(document.head.querySelectorAll(`link[rel="prefetch"][href="${this._href}"]`)||[]).length>0}get _connectionSuitable(){const e=navigator.connection;if(!e)return!0;if(e){if(e.saveData)return this.warn("Data Saving is enabled"),!1;if(/2g/.test(e.effectiveType))return this.warn("Network is too slow"),!1}return!0}connect(){if(!!this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":b(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver(([s],i)=>{s.isIntersecting&&(this.prefetch(),i.unobserve(s.target))}).observe(this.element)}prefetch(){if(this._existingPrefetch||!this._connectionSuitable)return;const e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}}l(ss,"values",{mode:String});class is extends Ut{get _unsupportedClasses(){return this.unsupportedClass.split(" ")}get _defaultUnsupportedClasses(){return["unsupported"]}connect(){"print"in window||this._addUnsupportedClasses(this.el),b(this,this.el,"click",this.print)}_addUnsupportedClasses(e=this.el){this.hasUnsupportedClass?e.classList.add(...this._unsupportedClasses):e.classList.add(...this._defaultUnsupportedClasses)}_removeUnsupportedClasses(e=this.el){this.hasUnsupportedClass?e.classList.remove(...this._unsupportedClasses):e.classList.remove(...this._defaultUnsupportedClasses)}}l(is,"classes",["unsupported"]);class sr extends d{connect(){b(this,window,"message",this.messageReceived)}messageReceived(e){let s=e.data;s.hasOwnProperty("name")&&s.name==="iframe-body"&&s.hasOwnProperty("height")&&this.resize(s.height)}resize(e){this.el.style.height=`${e}px`}}class rs extends d{connect(){window.self!==window.top&&(pt(this),ji(this,{}),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,s=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight)}}l(rs,"debounces",["postUpdate"]);class ns extends d{connect(){requestAnimationFrame(()=>{V(this,()=>this.el.remove(),this.secondsValue*1e3)})}}l(ns,"values",{seconds:Number});class Pe extends d{constructor(){super(...arguments);l(this,"_magicElement",null)}get _stuckClasses(){return this.stuckClass.split(" ")}get _defaultStuckClasses(){return["stuck"]}get _mode(){if(this.hasModeValue){if(!["top","bottom"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);if(this.modeValue==="top")return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),dt(this,this.el,this._mode,this._magicElement),new IntersectionObserver(s=>{s.forEach(i=>{i.target===this._magicElement&&(i.intersectionRatio===0?this._addStuckClasses():i.intersectionRatio===1&&this._removeStuckClasses())})},{threshold:[0,1]}).observe(this._magicElement)}_addStuckClasses(e=this.el){this.hasStuckClass?e.classList.add(...this._stuckClasses):e.classList.add(...this._defaultStuckClasses)}_removeStuckClasses(e=this.el){this.hasStuckClass?e.classList.remove(...this._stuckClasses):e.classList.remove(...this._defaultStuckClasses)}}l(Pe,"classes",["stuck"]),l(Pe,"values",{mode:String});class as extends j{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e==null||e.preventDefault();let s=this.el,i=document.querySelector(this.targetValue);if(i==null){this.dispatch(s,"teleport:error");return}let r=s.cloneNode(!0);switch(this.cleanup(r),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":i.insertAdjacentHTML(this.insertValue,r.outerHTML);break;case"replaceOuter":i.outerHTML=r.outerHTML;break;case"replaceInner":i.innerHTML=r.outerHTML;break;case"prepend":i.insertAdjacentHTML("afterbegin",r.outerHTML);break;case"append":i.insertAdjacentHTML("beforeend",r.outerHTML);break;default:throw new Error("`insert` value was not specified")}s.remove()}}l(as,"values",{target:String,insert:String,immediate:Boolean});class os extends j{constructor(){super(...arguments);l(this,"_previousState",{})}get _value(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}get _attribute(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}get _seconds(){if(this.hasSecondsValue)return this.secondsValue*1e3;throw new Error("Expected `secondsValue` to be present")}initialize(){this.setState=this.setState.bind(this),this.removeState=this.removeState.bind(this)}connect(){this.setState(),V(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=m.get(this.el,this._attribute),m.set(this.el,this._attribute,this.valueValue)}removeState(){m.set(this.el,this._attribute,this._previousState[this._attribute])}}l(os,"values",{attribute:String,seconds:Number,value:String});function ls(t,e,s,i,r="temporary-state"){var n;(!t.dataset.controller||!((n=t.dataset.controller)==null?void 0:n.includes(r)))&&(t.dataset.controller=(t.dataset.controller||` ${r} `).trim().replaceAll(" "," ")),t[m.camelCase(`${r}-attribute-value`)]=e,t[m.camelCase(`${r}-seconds-value`)]=i.toString()}function ir(t,e,s){ls(t,"className",e,s)}class je extends d{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&Bi(this),this.hasClickAwayValue&&this.clickAwayValue&&Ni(this),requestAnimationFrame(()=>{this.hasInitialValue&&(this.initialValue==="on"?this.toggleTargets.forEach(e=>this._elementOn(e)):this.toggleTargets.forEach(e=>this._elementOff(e)))})}clickOutside(){this.toggleTargets.forEach(e=>{this._elementWasToggled(e)&&(this._elementToggleStatus(e),this._elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}on(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOn(s)})}off(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOff(s)})}toggle(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementToggle(s)})}_elementWasToggled(e){return e.dataset.toggled=="true"}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i))}_elementOn(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!0))}_elementOff(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!1))}}l(je,"targets",["toggle"]),l(je,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});function Y(t,e){const s=t[e];return typeof s=="function"?s:()=>{}}function rr(t){const e=t.disconnect.bind(t);let s=!1,i=(u,h)=>{u.forEach(f=>{f.type==="childList"&&Array.from(f.addedNodes).some(v=>v.tagName==="TRIX-TOOLBAR")&&(a(),h.disconnect())})},r=u=>Y(t,"pasteEvent").call(t,u),n=new MutationObserver(i),a=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let u=t.element,h=t.element.parentElement;if(h==null)throw new Error("Could not traverse DOM tree from <trix-editor>");u.addEventListener("trix-paste",r);let f=h.querySelector("trix-toolbar");if(!s&&!f){s=!0,n.observe(h,{childList:!0});return}else if(f)n.disconnect();else throw new Error("Could not find an instance of <trix-toolbar> that is a sibling of this <trix-editor>");Y(t,"install").call(t,{toolbar:f,editor:u})},c=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let u=t.element,h=t.element.parentElement;if(h==null)throw new Error("Could not traverse DOM tree from <trix-editor>");u.removeEventListener("trix-paste",r);let f=h.querySelector("trix-toolbar");if(!f)throw new Error("Could not find <trix-toolbar> that is a sibling of this <trix-editor> element");Y(t,"uninstall").call(t,{toolbar:f,editor:u})};a(),Object.assign(t,{disconnect(){n.disconnect(),c(),Y(t,"uninstall").call({toolbar,editor:t.element}),e()}})}class nr extends d{connect(){rr(this)}get enabledBehaviours(){let e=i=>i!==void 0&&i!=="false",s=(i,r)=>e(i)?[r]:[];return[...s(this.el.dataset.noBold,this.bold),...s(this.el.dataset.noBulletList,this.bulletList),...s(this.el.dataset.noCode,this.code),...s(this.el.dataset.noHeading,this.heading),...s(this.el.dataset.noItalic,this.italic),...s(this.el.dataset.noStrikethrough,this.strikethrough),...s(this.el.dataset.noLink,this.link),...s(this.el.dataset.noIndents,this.indents),...s(this.el.dataset.noNumberList,this.numberList),...s(this.el.dataset.noQuote,this.quote),...s(this.el.dataset.noFileUploads,this.fileUploads)]}install(e){this.enabledBehaviours.forEach(s=>s.install(e))}pasteEvent(e){this.enabledBehaviours.forEach(s=>s.pasteEvent&&s.pasteEvent(e))}uninstall(e){this.enabledBehaviours.forEach(s=>s.uninstall(e))}get bold(){return this.formattingHandlers(".trix-button--icon-bold","bold")}get bulletList(){return this.formattingHandlers(".trix-button--icon-bullet-list","bullet-list")}get code(){return this.formattingHandlers(".trix-button--icon-code","code")}get heading(){return this.formattingHandlers(".trix-button--icon-heading-1","heading")}get italic(){return this.formattingHandlers(".trix-button--icon-italic","italic")}get strikethrough(){return this.formattingHandlers(".trix-button--icon-strike","strike")}get link(){return this.formattingHandlers(".trix-button--icon-link","href")}get indents(){return this.simpleHideShowHandlers([".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level",".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level"].join(", "))}get numberList(){return this.simpleHideShowHandlers(".trix-button--icon-number-list")}get quote(){return this.simpleHideShowHandlers(".trix-button--icon-quote")}get fileUploads(){let e=".trix-button-group.trix-button-group--file-tools",s=n=>n==null?void 0:n.preventDefault(),i=this,r=this.el;return{install(n){i.simpleHideShowHandlers(e).install(n),i.el.addEventListener("trix-file-accept",s)},pasteEvent(n){let{dataTransfer:a,html:c}=n.paste,{editor:u}=r;(a.files.length>0||c.includes("<img"))&&(alert("The content you pasted contains images and/or files. File uploads are not supported."),u.undo())},uninstall(n){i.simpleHideShowHandlers(e).uninstall(n),i.el.removeEventListener("trix-file-accept",s)}}}simpleHideShowHandlers(e){return{install:({toolbar:s})=>this.hideToolbarSelector(s,e),uninstall:({toolbar:s})=>this.showToolbarSelector(s,e)}}formattingHandlers(e,s){let i=this.el,{editor:r}=i;return{install:n=>{this.simpleHideShowHandlers(e).install(n)},pasteEvent(n){let{range:a}=n.paste,c=i.editor.getSelectedRange();r.setSelectedRange(a),r.deactivateAttribute(s),r.setSelectedRange(c)},uninstall:n=>{this.simpleHideShowHandlers(e).uninstall(n)}}}showToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="")}hideToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="none")}}class cs extends d{toggle(e){e==null||e.preventDefault();let i=this._getFrame().src;i==null||i!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){e==null||e.preventDefault(),this._setSrc()}clear(e){e==null||e.preventDefault(),this._clear()}_setSrc(){let e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()}_clear(){let e=this._getFrame();e.src="",e.innerHTML=""}_getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(e==null)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(ce(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(q(e))return e.href;throw new Error("No link given to drive frame to")}}l(cs,"values",{frameId:String,src:String,loadingMessage:String});class us extends d{get _poll(){return this.hasPollValue?this.pollValue:!1}connect(){let e=this.el;if(ce(e)){if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.")}else throw new Error("Expected controller to be mounted on a <turbo-frame> element.");this._poll&&requestAnimationFrame(()=>V(this,this.refresh,this.intervalValue))}refresh(e){e==null||e.preventDefault();let s=this.el;s.src=s.src}}l(us,"values",{interval:Number,poll:Boolean}),o.AlertController=jt,o.AnchorSpyController=Be,o.AsyncBlockController=pe,o.AutoSubmitFormController=bt,o.AutosizeController=qi,o.BackLinkController=Gt,o.BaseController=d,o.CharCountController=U,o.CheckboxDisableInputsController=Ee,o.CheckboxEnableInputsController=Te,o.CheckboxSelectAllController=vt,o.CheckboxXORController=yt,o.ClipboardController=He,o.ClockController=Wt,o.ConfirmController=Yt,o.ConfirmNavigationController=Zt,o.CountdownController=J,o.DebugController=Qt,o.DetectDirtyController=$i,o.DetectDirtyFormController=zi,o.DisableWithController=es,o.DismissableController=ts,o.DurationController=Kt,o.ElementSaveController=Fe,o.EmptyDomController=G,o.EnableInputsController=Se,o.EphemeralController=j,o.EventBus=O,o.FallbackImageController=Oe,o.FocusStealController=Ct,o.FormRcController=Ae,o.FormSaveController=wt,o.FullscreenController=Qi,o.IntersectionController=Rt,o.IntervalController=qt,o.LazyBlockController=Ri,o.LightboxImageController=De,o.LimitedSelectionCheckboxesController=ke,o.LoadBlockController=x,o.MediaPlayerController=xt,o.NavigateFormErrorsController=z,o.NestedFormController=Ve,o.PasswordConfirmController=Le,o.PasswordPeekController=Et,o.PollBlockController=we,o.PrefetchController=ss,o.PresenceController=$t,o.PrintButtonController=is,o.PrintController=Ut,o.RemoteFormController=Me,o.RemoveController=tr,o.ResponsiveIframeBodyController=rs,o.ResponsiveIframeWrapperController=sr,o.ScrollContainerController=Dt,o.ScrollIntoFocusController=Nt,o.ScrollToBottomController=It,o.ScrollToController=Bt,o.ScrollToTopController=Ht,o.SelfDestructController=ns,o.SignalInputController=Ft,o.SignalVisibilityController=Ne,o.StickyController=Pe,o.SyncInputsController=Tt,o.TableSortController=Pt,o.TableTruncateController=Ie,o.TabsController=X,o.TeleportController=as,o.TemporaryStateController=os,o.TimeDistanceController=Jt,o.TimeoutController=zt,o.ToggleClassController=je,o.TreeViewController=Xt,o.TrixModifierController=nr,o.TurboFrameRCController=cs,o.TurboFrameRefreshController=us,o.UserFocusController=er,o.ValueWarnController=W,o.WordCountController=K,o.applyTemporaryClass=ir,o.applyTemporaryState=ls,o.createHiddenButton=ot,o.createHiddenInput=lt,o.getScrollParent=R,o.insertElement=he,o.insertHiddenButton=de,o.insertHiddenInput=Li,o.isDirty=Ui,o.isElementCheckable=A,o.isFormDirty=_t,o.isHTMLAnchorElement=q,o.isHTMLButtonElement=B,o.isHTMLFormElement=ue,o.isHTMLImageElement=Vi,o.isHTMLInputElement=y,o.isHTMLLinkElement=ki,o.isHTMLSelectElement=L,o.isHTMLTextAreaElement=$,o.isTurboFrame=ce,o.isTypeOfFormInputElement=at,o.requestReset=ct,o.requestSubmit=fe,o.scrollAbsoluteBottom=oe,o.scrollAbsoluteLeft=le,o.scrollAbsoluteRight=Si,o.scrollAbsoluteTop=ae,o.scrollDown=it,o.scrollLeft=rt,o.scrollRight=nt,o.scrollToElement=k,o.scrollUp=st,o.useCollectionEventListener=M,o.useCollectionEventListeners=ut,o.useEventListener=b,o.useEventListeners=w,o.useFullscreen=ht,o.useInjectedElement=dt,o.useInjectedFragment=me,o.useInjectedHTML=Mi,o.useInterval=H,o.useTimeout=V,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});
|
|
1
|
+
var Ws=Object.defineProperty;var ls=Object.getOwnPropertySymbols;var Ks=Object.prototype.hasOwnProperty,Gs=Object.prototype.propertyIsEnumerable;var Fe=(a,b,f)=>b in a?Ws(a,b,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[b]=f,Re=(a,b)=>{for(var f in b||(b={}))Ks.call(b,f)&&Fe(a,f,b[f]);if(ls)for(var f of ls(b))Gs.call(b,f)&&Fe(a,f,b[f]);return a};var l=(a,b,f)=>(Fe(a,typeof b!="symbol"?b+"":b,f),f);(function(a,b){typeof exports=="object"&&typeof module!="undefined"?b(exports,require("stimulus"),require("lodash-es"),require("date-fns")):typeof define=="function"&&define.amd?define(["exports","stimulus","lodash-es","date-fns"],b):(a=typeof globalThis!="undefined"?globalThis:a||self,b(a["Stimulus-Library"]={},a.stimulus,a.lodashEs,a.dateFns))})(this,function(a,b,f,E){"use strict";function os(t){switch(t){case"application":case"el":case"element":case"constructor":case"initialize":case"log":case"logEvent":case"dispatch":case"data":case"valueDescriptorMap":case"mutate":case"identifier":return!1}return!(/^_.*?$/.test(t)||/^.*?Target(s)?$/.test(t)||/^.*?Value$/.test(t)||/^.*?ValueChanged$/.test(t)||/^.*?Class$/.test(t)||/^.*?Classes$/.test(t)||/^.*?ClassesPresent$/.test(t))}function qe(t,e,s={}){if(!t.application.debug)return;let i=console;i.groupCollapsed(`%c${t.identifier} %c#${e}`,"color: #3B82F6","color: unset"),i.log(Re({element:t.element,controller:t},s)),i.groupEnd()}function Pe(t,e,s={}){if(!t.application.debug)return;let i=console;i.groupCollapsed(`%c${t.identifier} %c#${e}`,"color: F39B1AFF","color: unset"),i.warn(Re({element:t.element,controller:t},s)),i.groupEnd()}function us(t,e,s,i){if(!t.application.debug)return;let r=console;r.groupCollapsed(`%c${t.identifier} %c${e}%c`,"color: #3B82F6","color: #0be000","color: unset"),r.log({element:i}),r.groupEnd()}function ee(t,e,s,i={}){let r=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},i);r.detail.target&&(r.detail.target=e);let n=new CustomEvent(s,r);us(t,s,n,e),e.dispatchEvent(n)}class h extends b.Controller{constructor(e){super(e);return this.application.debug?new Proxy(this,{get:(s,i)=>{let r=Reflect.get(s,i),n=this;if(os(i.toString())){if(typeof r=="function")return new Proxy(r,{apply(o,c,u){return qe(n,i.toString(),{args:u}),Reflect.apply(o,c,u)}});qe(this,i.toString())}return r}}):this}get el(){return this.element}get isTurboPreview(){return document.documentElement.hasAttribute("data-turbo-preview")||document.documentElement.hasAttribute("data-turbolinks-preview")}get isTurbolinksPreview(){return this.isTurboPreview}get csrfToken(){return this.metaValue("csrf-token")}metaValue(e){const s=document.head.querySelector(`meta[name="${e}"]`);return(s==null?void 0:s.getAttribute("content"))||null}dispatchEvent(e,s,i={}){ee(this,e,s,i)}}class q extends h{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var n,o,c;e.dataset.controller=((n=e.dataset.controller)==null?void 0:n.replaceAll(new RegExp(`(\\s|^)${this.identifier}(\\s|$)`,"g"),""))||"",e.dataset.controller==""&&delete e.dataset.controller;let s=new RegExp(`(\\s|^)${this.identifier}\\..+?(\\s|$)`,"g");e.dataset.target=((o=e.dataset.target)==null?void 0:o.replaceAll(s,""))||"",delete e.dataset[f.camelCase(`${this.identifier}-target`)],e.dataset.target==""&&delete e.dataset.target,e.dataset.action=((c=e.dataset.target)==null?void 0:c.replaceAll(s,""))||"",delete e.dataset[f.camelCase(`${this.identifier}-action`)],e.dataset.action==""&&delete e.dataset.action;let i=this.constructor.values;i&&Object.keys(i).forEach(u=>delete e.dataset[f.camelCase(`${this.identifier}-${u}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(u=>delete e.dataset[f.camelCase(`${this.identifier}-${u}-class`)])}}const C="scrollBehavior"in document.documentElement.style;let $e;async function M(t,{behavior:e="smooth",block:s="start",inline:i="nearest"}={}){e=="smooth"&&!C&&await S(),t.scrollIntoView({behavior:e,block:s,inline:i})}async function te(t,{behavior:e="smooth"}={}){e=="smooth"&&!C&&await S(),t.scrollTo({top:0,left:0,behavior:e})}async function se(t,{behavior:e="smooth"}={}){e=="smooth"&&!C&&await S(),t==window?t.scrollTo({top:document.body.scrollHeight,left:0,behavior:e}):t.scrollTo({top:t.scrollHeight,left:0,behavior:e})}async function ie(t,{behavior:e="smooth"}={}){e=="smooth"&&!C&&await S(),t.scrollTo({left:0,behavior:e})}async function hs(t,{behavior:e="smooth"}={}){e=="smooth"&&!C&&await S(),t==window?t.scrollTo({left:document.body.scrollWidth,behavior:e}):t.scrollTo({left:t.scrollWidth,behavior:e})}async function ze(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!C&&await S(),t.scrollBy({top:-e,left:0,behavior:s})}async function Ue(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!C&&await S(),t.scrollBy({top:e,left:0,behavior:s})}async function je(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!C&&await S(),t.scrollBy({top:0,left:-e,behavior:s})}async function We(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!C&&await S(),t.scrollBy({top:0,left:e,behavior:s})}async function S(){const{polyfill:t}=await import("smoothscroll-polyfill");$e||($e=!0,t())}function P(t){if(!t)return null;if(t==document.body)return window;const e=getComputedStyle(t).overflowY;return e!=="visible"&&e!=="hidden"&&t.scrollHeight>=t.clientHeight?t:P(t.parentElement)||document.body}function re(t){return t.nodeName=="TURBO-FRAME"}function cs(t){return{all:t=t||new Map,on:function(e,s){var i=t.get(e);i?i.push(s):t.set(e,[s])},off:function(e,s){var i=t.get(e);i&&(s?i.splice(i.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var i=t.get(e);i&&i.slice().map(function(r){r(s)}),(i=t.get("*"))&&i.slice().map(function(r){r(e,s)})}}}const L=cs();function ds(t){return t.nodeName=="LINK"}function ae(t){return t.nodeName=="A"}function ne(t){return t.nodeName=="FORM"}function v(t){return t.nodeName=="INPUT"}function fs(t){return t.nodeName=="LABEL"}function $(t){return t.nodeName=="TEXTAREA"}function ms(t){return t.nodeName=="BUTTON"}function I(t){return t.nodeName=="SELECT"}function gs(t){return t.nodeName=="IMG"}function ps(t){return t.nodeName=="INPUT"&&t.type=="button"}function Ke(t){return t.nodeName=="INPUT"&&t.type=="submit"}function Ge(t){return t.nodeName=="INPUT"&&t.type=="reset"}function Je(t){return t.nodeName=="BUTTON"&&t.type=="button"}function Xe(t){return t.nodeName=="BUTTON"&&t.type=="submit"}function Ye(t){return t.nodeName=="BUTTON"&&t.type=="reset"}function Ze(t){return Ye(t)||Ge(t)}function Qe(t){return Xe(t)||Ke(t)}function z(t){return Ze(t)||Qe(t)||Je(t)}function V(t){return v(t)&&(t.type==="radio"||t.type==="checkbox")}function et(t){return v(t)||I(t)||$(t)}function tt(t){let e=document.createElement("button");return e.type=t,e.style.display="none",e.dataset.sythentic="true",e}function st(t,e){let s=document.createElement("input");return s.type="hidden",s.name=t,s.value=e,s}function le(t,e,s){let i=t.insertAdjacentElement(e,s);if(!i)throw new Error(`Failed to insert element ${s.nodeName} into ${t.nodeName}`);return i}function _s(t,e,s,i){return le(s,i,st(t,e))}function oe(t,e,s){return le(e,s,tt(t))}function ue(t){let e=t.form||document;return Array.from(e.querySelectorAll(`input[type="radio"][name="${t.name}"]`))}function he(t){return ue(t).filter(e=>e!==t)}function it(t){const e=t.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,r=e.top<=s&&e.top+e.height>=0,n=e.left<=i&&e.left+e.width>=0;return r&&n}function ce(t){if(t.requestSubmit)t.requestSubmit();else{let e=t.querySelector('button[type="submit"]');e||(e=oe("submit",t,"beforeend")),e.click()}}function rt(t){let e=t.querySelector('button[type="reset"]');e||(e=oe("reset",t,"beforeend")),e.click()}function at(t){return Array.isArray(t)?t:[t]}function y(t,e,s){const i=t.disconnect.bind(t);return e(),Object.assign(t,{disconnect(){s(),i()}}),i}function d(t,e,s,i,r){(r==null?void 0:r.debounce)?(i=f.debounce(i.bind(t),r.debounce),delete r.debounce):i=i.bind(t);let n=at(s),o=()=>n.forEach(u=>e.addEventListener(u,i,r)),c=()=>n.forEach(u=>e.removeEventListener(u,i));return y(t,o,c),{setup:o,teardown:c}}function bs(t,e,s,i,r){return d(t,e,s,i,r)}function A(t,e,s,i,r){let n=[];return e.forEach(o=>{let{setup:c,teardown:u}=d(t,o,s,i,r);n.push({setup:c,teardown:u})}),[()=>n.forEach(o=>o.setup()),()=>n.forEach(o=>o.teardown())]}function vs(t,e,s,i,r){return A(t,e,s,i,r)}function nt(t,e){let s=e||document.documentElement,i=document.fullscreenElement!==null;const r=()=>i=document.fullscreenElement!==null,n=()=>i,o=async()=>i?await g():await p();let c=()=>document.addEventListener("fullscreenchange",r),u=()=>document.removeEventListener("fullscreenchange",r);const g=async()=>{document.exitFullscreen&&(i=!1,await document.exitFullscreen())},p=async()=>{i&&await g(),s.requestFullscreen&&(await s.requestFullscreen(),i=!0)};return y(t,c,u),{isFullscreen:n,enter:p,exit:g,toggle:o,teardown:u}}function U(t){if(t===null||typeof t!="object")return t;for(const e in t)Object.getOwnPropertyDescriptor(t,e)!=null&&(t[e]=U(t[e]));return new Proxy(t,{get(e,s){return e[s]},set(e,s,i){return e[s]=U(i),!0}})}function ws(t,e={},s,i){s&&(s=s.bind(t)),i&&(i=i.bind(t));const{enableHighAccuracy:r=!0,maximumAge:n=3e4,timeout:o=27e3}=e,c=navigator&&"geolocation"in navigator,u=U({locatedAt:null,error:null,coords:{accuracy:0,latitude:1/0,longitude:1/0,altitude:null,altitudeAccuracy:null,heading:null,speed:null},teardown:()=>{p&&(navigator.geolocation.clearWatch(p),p=null)}});let g=()=>{c&&(p=navigator.geolocation.watchPosition(_=>{u.locatedAt=_.timestamp,u.coords=_.coords,u.error=null,s&&s(_)},_=>{u.error=_,i&&i(_)},{enableHighAccuracy:r,maximumAge:n,timeout:o}))},p=null;return y(t,g,u.teardown),u}function de(t,e,s,i,r={}){let n=Array.from(i.childNodes),o=()=>{let u=e.parentElement;if(["beforebegin","afterend"].includes(s)&&u==null)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":e.append(i);break;case"afterbegin":e.prepend(i);break;case"beforebegin":u.insertBefore(i,e);break;case"afterend":u.insertBefore(i,e);break}},c=r.cleanup?()=>n.forEach(u=>u.remove()):()=>{};return y(t,o,c),[n,c]}function ys(t,e,s,i,r={}){const n=document.createRange().createContextualFragment(i);return de(t,e,s,n,r)}function lt(t,e,s,i,r={}){const n=new DocumentFragment;n.append(i);let[o,c]=de(t,e,s,n,r);return[o[0],c]}function O(t,e,s){e=e.bind(t);let i=null,r=()=>i=setInterval(e,s),n=()=>{i!==null&&clearInterval(i)};return y(t,r,n),n}const ot={boolean:{deserialize:t=>t==="true",serialize:t=>String(t),isEmpty:t=>t===""||t===null},object:{deserialize:t=>JSON.parse(t),serialize:t=>JSON.stringify(t),isEmpty:t=>{const e=Object.values(JSON.parse(t));return e.length===0||e.every(s=>s===""||s===null)}},number:{deserialize:t=>Number.parseFloat(t),serialize:t=>String(t),isEmpty:t=>t===""||t===null},any:{deserialize:t=>t,serialize:t=>String(t),isEmpty:t=>t===""||t===null},string:{deserialize:t=>t,serialize:t=>String(t),isEmpty:t=>t===""||t===null},map:{deserialize:t=>new Map(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t.entries())),isEmpty:t=>{const e=Array.from(t.values());return e.length===0||e.every(s=>s===""||s===null)}},set:{deserialize:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify(Array.from(t.entries())),isEmpty:t=>{const e=Array.from(t.values());return e.length===0||e.every(s=>s===""||s===null)}}};function ut(t,e,s,i={writeDefaults:!0}){let r,{writeDefaults:n}=i;s==null?r="any":s instanceof Set?r="set":s instanceof Map?r="map":typeof s=="boolean"?r="boolean":typeof s=="string"?r="string":typeof s=="object"||Array.isArray(s)?r="object":Number.isNaN(s)?r="any":r="number";let o=U({value:s}),c=localStorage;const u=ot[r],g=()=>{const w=c.getItem(e);return w==null?(o.value=s,n&&s!==null&&c.setItem(e,u.serialize(s))):o.value=u.deserialize(w),o.value},p=w=>{c.setItem(e,u.serialize(w)),o.value=w},_=()=>(c.removeItem(e),o.value=s,o.value),k=()=>{let w=c.getItem(e);return u.isEmpty(w)};return g(),{get value(){return g()},set value(w){p(w)},read:g,clear:_,write:p,isEmpty:k}}function D(t,e,s){let i,r=null;e=e.bind(t);let n=()=>{e(),r=null,Object.assign(t,{disconnect:i})},o=()=>r=setTimeout(n,s),c=()=>{r!==null&&(clearTimeout(r),r=null)};return i=y(t,o,c),c}function ht(t,e,s,i,r){const n=(_,k)=>{v(_)?_.value=k:_.textContent=k},o=_=>v(_)?_.value:_.innerHTML;let c=()=>{},u=o(e);const g=()=>{n(e,u),c(),r&&r.call(t)};return y(t,()=>{n(e,s),i!==void 0&&(c=D(t,g,i))},g),{teardown:g,update(_){n(e,_)}}}async function ct(t,e,s){try{return await fetch(e,s)}catch(i){if(t===1)throw i;return await ct(t-1,e,s)}}class N extends h{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}get _maxRetries(){return this.hasMaxRetriesValue?this.maxRetriesValue:1}connect(){}async loadContent(e=null){e==null||e.preventDefault();let s=this,i=this.hasReplaceTarget?this.replaceTarget:this.el,r=()=>{i.replaceWith(this._errorMessage),s.dispatchEvent(i,"ajax:error")};try{let n=await ct(this._maxRetries,this.endpointValue);n.ok||r();let o=await n.text(),c=document.createElement("div");if(c.innerHTML=o,this.hasSelectorValue){let u=c.querySelectorAll(this.selectorValue);i.replaceWith(...u)}else i.replaceWith(...c.children);s.dispatchEvent(i,"ajax:success")}catch{r()}finally{s.dispatchEvent(i,"ajax:complete")}}}l(N,"targets",["replace"]),l(N,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});class fe extends N{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}l(fe,"targets",["replace"]),l(fe,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});function Es(t,e,s){e=e.bind(t);let i=new IntersectionObserver(e,s);return{observer:i,teardown:()=>{i==null||i.disconnect(),i=null},observe:c=>i==null?void 0:i.observe(c),unobserve:c=>i==null?void 0:i.unobserve(c)}}function me(t,e,s,i,r){s&&(s=s.bind(t)),i&&(i=i.bind(t));let n=r!=null?r:{},o=k=>{k.forEach(w=>{w.isIntersecting?s&&s(w):i&&i(w)})},{observer:c,observe:u,unobserve:g,teardown:p}=Es(t,o,n);return y(t,()=>u(e),p),{observer:c,observe:()=>u(e),unobserve:()=>g(e),teardown:p}}class Ts extends N{async connect(){let e=this.el;if("IntersectionObserver"in window){let{observe:s,unobserve:i}=me(this,e,this.appear,null,{threshold:.3});this.observe=s,this.unobserve=i}else await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}}class ge extends N{connect(){if(!this.hasSecondsValue)throw new Error("Required value `seconds` is missing");requestAnimationFrame(()=>{this._timeout(),O(this,this._timeout,this.secondsValue*1e3)})}async _timeout(){await this.loadContent()}}l(ge,"targets",["replace"]),l(ge,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number,seconds:Number});class dt extends h{get _eventModes(){if(this.hasEventModeValue){let e=this.eventModeValue.split(" ").map(s=>s.trim());if(e.length===1&&e[0]==="debounced")return["change","input"];if(!e.every(s=>["change","input"].includes(s)))throw new Error(`The modeValue provided '${this.eventModeValue}' is not one of the recognised configuration options`);return e}else return["change"]}get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:-1}get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get _cssSelector(){let e=["input","textarea","select"],s=":not([data-no-autosubmit])";return e.map(i=>i.concat(s)).join(",")}get inputElements(){let e=Array.from(this.element.querySelectorAll(this._cssSelector));return e=e.filter(s=>!this._ancestorIsTrix(s)),e}connect(){this.inputElements.forEach(e=>d(this,e,this._eventModes,this.submit,{debounce:this._debounceTimeout&&this._debounceTimeout>0?this._debounceTimeout:void 0}))}_ancestorIsTrix(e){return e.closest("trix-toolbar")!==null&&e.closest("trix-editor")!==null}submit(){let e=this.el;this._mode=="request"?ce(e):e.submit()}}l(dt,"values",{submitMode:String,eventMode:String,debounceInterval:Number});class Cs extends h{connect(){let{teardown:e}=me(this,this.el,this.appear);if(this._unobserveIntersection=e,!$(this.el))throw new Error(`Expected controller to be attached to a textarea, but was a '${this.el.tagName}'`);requestAnimationFrame(()=>{this.el.style.resize="none",this.el.style.boxSizing="border-box",this._handler(),d(this,window,["resize"],this._handler),d(this,this.el,["input","change","focus"],this._handler,{debounce:100})})}appear(e){this.autosize(this.el),this._unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let s=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+s+"px"}}function B(t,e){const s=t[e];return typeof s=="function"?s:s!=null?()=>s:()=>{}}function j(t){return f.upperFirst(f.camelCase(t))}function Ss(t,e){let s=t.element,i=()=>t[`has${j(e)}Class`]==!0,r=()=>t[`${e}Classes`],n=()=>B(t,`default${j(e)}Classes`).call(t)||[],o=()=>i()?r():n();t[`${e}Classes`]==null&&Object.defineProperty(t,`${e}Classes`,{get:()=>i()?t[`${e}Class`].split(" "):n()});let c={[`add${j(e)}Classes`]:(u=s)=>u.classList.add(...o()),[`remove${j(e)}Classes`]:(u=s)=>u.classList.remove(...o()),[`${e}ClassesPresent`]:(u=s)=>o().every(g=>u.classList.contains(g))};Object.assign(t,c)}function T(t){(t.constructor.classes||[]).forEach(s=>Ss(t,s))}class W extends h{connect(){T(this),requestAnimationFrame(()=>{d(this,this.inputTarget,"input",this._updateCharCount),this._updateCharCount()})}_updateCharCount(){let e=this.inputTarget.value.length;this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}l(W,"targets",["input","output"]),l(W,"values",{min:Number,max:Number}),l(W,"classes",["error"]);class pe extends h{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.disableTargets.forEach((e,s)=>{e.disabled=!1})}}l(pe,"targets",["disabler","disable"]),l(pe,"values",{clear:Boolean});class _e extends h{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.enableTargets.forEach((e,s)=>{e.disabled=!1})}}l(_e,"targets",["enabler","enable"]),l(_e,"values",{clear:Boolean});class ft extends h{get _checked(){return this._enabled.filter(e=>e.checked)}get _enabled(){return this.checkboxTargets.filter(e=>!e.disabled&&!e.readOnly)}get _unchecked(){return this._enabled.filter(e=>!e.checked)}connect(){requestAnimationFrame(()=>{!this.hasSelectAllTarget||(d(this,this.selectAllTarget,"change",this._toggle),A(this,this.checkboxTargets,"change",this._refresh),this._refresh())})}_toggle(e){e.preventDefault();let s=e.target;this._enabled.forEach(i=>i.checked=i.disabled||i.readOnly?i.checked:s.checked)}_refresh(){const e=this._enabled.length,s=this._checked.length;this.selectAllTarget.checked=s>0,this.selectAllTarget.indeterminate=s>0&&s<e}}l(ft,"targets",["selectAll","checkbox"]);class mt extends h{connect(){A(this,this.checkboxTargets,"change",this._update)}_otherCheckboxes(e){return Array.from(this.checkboxTargets).filter(s=>s!==e)}_update(e){const s=e.target;if(!s)throw new Error("No target found on event");let i=this._otherCheckboxes(s);s.checked&&i.forEach(r=>{r.checked=!1,this.dispatchEvent(this.el,"change")})}}l(mt,"targets",["checkbox"]);class Vs extends h{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),d(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return V(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);if(V(e))return s==null?e.defaultChecked:s=="true";if(I(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(){return this.el.hasAttribute(this._cacheAttrName)}_checkDirty(){let e=this.el;v(e)&&e.type=="radio"&&he(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty()?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(){return this._getElementValue()!==this._getElementLoadValue()}_restoreElementFromLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);V(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):I(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&V(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}}function ks(t){return t.hasAttribute("data-dirty")}class Ms extends h{get _formElements(){return Array.from(this.el.querySelectorAll("input, select, textarea"))}get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),d(this,e,["input","change"],this._checkDirty,{debounce:10})}restore(e){e==null||e.preventDefault(),this._formElements.forEach(s=>this._restoreElementFromLoadValue(s))}_getElementValue(e){return V(e)?e.checked:e.value}_getElementLoadValue(e){let s=e.getAttribute(this._cacheAttrName);if(V(e))return s==null?e.defaultChecked:s=="true";if(I(e))Array.from(e.options).forEach(r=>{if(r.defaultSelected)return e.value=r.value,r.value});else if(s!==null)return s;return s}_elementHasCachedLoadValue(e){return e.hasAttribute(this._cacheAttrName)}_checkElementDirty(e){v(e)&&e.type=="radio"&&he(e).forEach(s=>s.removeAttribute("data-dirty")),this._isElementDirty(e)?e.setAttribute("data-dirty","true"):e.removeAttribute("data-dirty")}_isElementDirty(e){return this._getElementValue(e)!==this._getElementLoadValue(e)}_cacheElementLoadValue(e){!this._elementHasCachedLoadValue(e)&&V(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let s=e.getAttribute(this._cacheAttrName);V(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):I(e)?s==null?Array.from(e.options).forEach(r=>{if(r.defaultSelected){e.value=r.value;return}}):e.value=s:e.value=s==null?e.defaultValue:s}_cacheLoadValues(){this._formElements.forEach(e=>this._cacheElementLoadValue(e))}_checkDirty(){this._formElements.forEach(e=>this._checkElementDirty(e)),this._formElements.some(e=>gt(e))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}}function gt(t){return t.hasAttribute("data-dirty")}class be extends h{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach((s,i)=>{e&&(s.value=""),s.disabled=!0})}enable(){this.inputTargets.forEach((e,s)=>e.disabled=!1)}}l(be,"targets",["input"]),l(be,"values",{clear:Boolean});class pt extends h{get _mode(){const e=["immediate","wait"];if(this.hasModeValue){if(e.includes(this.modeValue))return this.modeValue;throw new Error(`The given modeValue '${this.modeValue}' is not one of the supported modes: "${e.join('", "')}"`)}else return e[0]}connect(){this._mode=="immediate"&&this.steal()}steal(){this.el.focus()}}l(pt,"values",{mode:String});class ve extends h{get _mode(){if(this.hasSubmitModeValue){if(!["direct","request"].includes(this.submitModeValue))throw new Error(`The modeValue provided '${this.submitModeValue}' is not one of the recognised configuration options`);return this.submitModeValue}else return"request"}get form(){let e;if(this.hasFormSelectorValue){if(e=document.querySelector(this.formSelectorValue),!e)throw new Error(`Could not find a form on the page that matches selector '${this.formSelectorValue}'`)}else e=this.formTarget;return e}submit(e){e==null||e.preventDefault();let s=this.formTarget;this._mode=="request"?ce(s):s.submit()}reset(e){e==null||e.preventDefault(),rt(this.form)}}l(ve,"targets",["form"]),l(ve,"values",{formSelector:String,submitMode:String});class _t extends h{get _formID(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this form. Please either specify data-${this.identifier}-id-value or give this form an 'id' attribute. `)}get _formIdentifier(){return`${location.href} ${this._formID}`}get _formElements(){return this.el.elements}get _formData(){let e={[this._formIdentifier]:{}};for(const s of this._formElements){let i=s;i.name.length>0&&(v(i)&&i.type=="checkbox"?e[this._formIdentifier][i.name]=i.checked:v(i)&&i.type=="radio"?i.checked&&(e[this._formIdentifier][i.name]=i.value):e[this._formIdentifier][i.name]=i.value)}return e}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _clearOnSubmit(){return this.hasClearOnSubmitValue?this.clearOnSubmitValue:!0}connect(){requestAnimationFrame(()=>{let e=this.el;if(!ne(e))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&d(this,this.el,"submit",this._clear)})}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatchEvent(this.el,"form-save:cleared")}clear(e){e==null||e.preventDefault(),this._clear()}save(e){e.preventDefault();let s=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(s[this._formIdentifier])),this.dispatchEvent(this.el,"form-save:save:success")}restore(e){if(e==null||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const s=JSON.parse(localStorage.getItem(this._formIdentifier));for(const i of this._formElements){let r=i;r.name in s&&(v(r)&&r.type=="checkbox"?r.checked=s[r.name]:v(r)&&r.type=="radio"?r.value==s[r.name]&&(r.checked=!0):r.value=s[r.name])}this.dispatchEvent(this.el,"form-save:restore:success")}else this.dispatchEvent(this.el,"form-save:restore:empty")}}l(_t,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class we extends h{connect(){A(this,this.inputTargets,"change",this._handleInputs)}_handleInputs(e){let s=this.inputTargets.reduce((r,n)=>n.checked?r+1:r,0),i=e.target;s>this.maxValue?(e.preventDefault(),i.checked=!1,this.dispatchEvent(i,"change"),this.dispatchEvent(i,"limited-selection:too-many"),this.hasErrorTarget&&this.hasMessageValue&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatchEvent(i,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}l(we,"targets",["input","error"]),l(we,"values",{max:Number,message:String});class K extends h{constructor(){super(...arguments);l(this,"_errors",[]);l(this,"_firstClick",!1)}get defaultCurrentClasses(){return["currentError"]}get _errorCount(){return this._errors.length}get _previousIndex(){let e=this._index-1;return e<0?0:e}get _nextIndex(){let e=this._index+1;return e>this._errors.length-1?this._errors.length-1:e}get _index(){return f.clamp(this.hasIndexValue?this.indexValue:0,0,this._errors.length)}get _selector(){if(this.hasSelectorValue)return this.selectorValue;throw new Error("Expected `selectorValue` to be present")}get _currentError(){return this._errors[this._index]}get _otherErrors(){return this._errors.filter((e,s)=>s!==this._index)}connect(){T(this),requestAnimationFrame(()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()})}async current(e){e==null||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await M(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async next(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await M(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}async previous(e){e==null||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await M(this._currentError,{behavior:"smooth",block:"center",inline:"center"}),this._updateClasses()}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_updateClasses(){this.addCurrentClasses(this._currentError),this._otherErrors.forEach(e=>this.removeCurrentClasses(e))}_toggleVisibility(){this._errorCount===0?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget)if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1){this.nextTarget.removeAttribute("disabled");return}else this.indexValue>=this._errorCount-1?this.nextTarget.setAttribute("disabled","true"):this.nextTarget.removeAttribute("disabled");this.hasPreviousTarget&&(this.indexValue<=0?this.previousTarget.setAttribute("disabled","true"):this.previousTarget.removeAttribute("disabled"))}}l(K,"values",{selector:String,index:Number}),l(K,"classes",["current"]),l(K,"targets",["next","current","previous"]);class ye extends h{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){e==null||e.preventDefault();const s=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,s)}remove(e){e.preventDefault();const s=e.target.closest(`.${this._wrapperClass}`);if(s==null)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if(s.dataset.newRecord==="true")s.remove();else{s.style.display="none";let i=s.querySelector("input[name*='_destroy']");if(i==null)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");i.value="1"}}_generateID(){return new Date().getTime().toString()+Math.random().toString().slice(2)}_checkStructure(){if(this.templateTarget.innerHTML.indexOf("NEW_RECORD"))throw new Error("Could not find 'NEW_RECORD' in the provided template. Please make sure you've passed `child_index: 'NEW_RECORD'` to `fields_for`")}}l(ye,"targets",["target","template"]),l(ye,"values",{insertMode:String,wrapperClass:String});class Ee extends h{connect(){T(this),A(this,this.passwordTargets,"change",this._checkPasswordsMatch)}_allPasswordsMatch(){let e=new Set(this.passwordTargets.map(s=>s.value));return e.has("")||e.size==1}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatchEvent(e,"password-confirm:match"),this.passwordTargets.forEach(s=>this.removeErrorClasses(s))):(this.dispatchEvent(e,"password-confirm:no-match"),this.passwordTargets.forEach(s=>this.addErrorClasses(s)))}}l(Ee,"targets",["password"]),l(Ee,"classes",["error"]);class bt extends h{peak(e){e==null||e.preventDefault(),this.passwordTarget.type="text"}hide(e){e==null||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){e==null||e.preventDefault(),this.passwordTarget.type==="password"?this.peak():this.hide()}}l(bt,"targets",["password"]);class Te extends h{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[s,i,r]=e.detail;if(s instanceof Node){let n=s.querySelector(this._selector);if(n==null)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let o=this.el.parentNode;if(o==null)throw new Error("expected form to have a DOM parent, could not execute replaceChild");o.replaceChild(n,this.el),this.dispatchEvent(n,"remote-form:replace")}else console.log("Unknown",s)}}l(Te,"targets",[]),l(Te,"values",{selector:String});function G(t,e,s,i){let r=i;(r==null?void 0:r.debounce)?(s=f.debounce(s.bind(t),r.debounce),delete r.debounce):s=s.bind(t);let n=at(e),o=()=>n.forEach(u=>L.on(u,s)),c=()=>n.forEach(u=>L.off(u,s));return y(t,o,c),{setup:o,teardown:c}}class vt extends h{get _eventName(){return`sync:${this._key}`}get _key(){if(this.hasKeyValue)return this.keyValue;throw new Error("Expected `keyValue` to be present")}get _value(){let e=this.el;return v(e)&&e.type==="checkbox"?e.checked:v(e)&&e.type==="radio"?e.checked?e.value:"":e.value}set _value(e){let s=this.el;v(s)&&s.type==="checkbox"?s.checked=e.toString()==="true":v(s)&&s.type==="radio"?s.checked=s.value===e:v(s)||$(s)||I(s)?s.value=e.toString():s.innerHTML=e.toString()}connect(){G(this,this._eventName,this._read),requestAnimationFrame(()=>{et(this.el)&&(this._emit(),d(this,this.el,"input",this._emit))})}_emit(){L.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(e===void 0)throw new Error("No payload received");let{dispatcher:s,value:i}=e;s!==this.el&&(this._value=i)}}l(vt,"values",{key:String});class J extends h{get _maxMessage(){return this.hasMaxMessageValue?this.maxMessageValue:`Value must be less than ${this.maxValue}`}get _minMessage(){return this.hasMinMessageValue?this.minMessageValue:`Value must be greater than ${this.minValue}`}get defaultWarningHideClasses(){return["hide"]}connect(){T(this),this.addWarningHideClasses(this.warningTarget),d(this,this.inputTarget,"input",this._check),this._check()}_check(){this.hasMinValue&&Number.parseFloat(this.inputTarget.value)<this.minValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._minMessage):this.hasMaxValue&&Number.parseFloat(this.inputTarget.value)>this.maxValue?(this.removeWarningHideClasses(this.warningTarget),this.addInputWarningClasses(this.inputTarget),this.warningTarget.innerText=this._maxMessage):(this.addWarningHideClasses(this.warningTarget),this.removeInputWarningClasses(this.inputTarget),this.warningTarget.innerText="")}}l(J,"classes",["inputWarning","warningHide"]),l(J,"targets",["input","warning"]),l(J,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class X extends h{connect(){T(this),this._updateWordCount(),d(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,i=this.inputTarget.value.match(/\S+/g);e=i&&i.length||0,this.outputTarget.innerText=e.toString(),this._isValidCount(e)?this.removeErrorClasses(this.outputTarget):this.addErrorClasses(this.outputTarget)}_isValidCount(e){let s=0,i=99999;return this.hasMinValue&&(s=this.minValue),this.hasMaxValue&&(i=this.maxValue),e>=s&&e<=i}}l(X,"targets",["input","output"]),l(X,"values",{min:Number,max:Number}),l(X,"classes",["error"]);class Ce extends h{initialize(){this._hasLoadedSuccessfully=this._hasLoadedSuccessfully.bind(this),this._success=this._success.bind(this),this._fail=this._fail.bind(this)}connect(){let e=this.el;e.onerror=this._fail,e.complete&&!this._hasLoadedSuccessfully()?this._fail():this._success()}disconnect(){this.removeSuccessClasses(),this.removeFailClasses()}_success(){this.addSuccessClasses()}_fail(){let e=this.el;this.addFailClasses(),this.hasPlaceholderValue&&e.src!==this.placeholderValue?(this.dispatchEvent(e,"fallback-image:placeholder"),e.src=this.placeholderValue,e.onerror=this._fail):(this.dispatchEvent(e,"fallback-image:fail"),e.style.display="none")}_hasLoadedSuccessfully(){let e=this.el;return e.naturalHeight>0&&e.naturalWidth>0}}l(Ce,"values",{placeholder:String}),l(Ce,"classes",["success","fail"]);var H=window.CustomEvent;(!H||typeof H=="object")&&(H=function(e,s){s=s||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!s.bubbles,!!s.cancelable,s.detail||null),i},H.prototype=window.Event.prototype);function wt(t,e){var s="on"+e.type.toLowerCase();return typeof t[s]=="function"&&t[s](e),t.dispatchEvent(e)}function As(t){for(;t&&t!==document.body;){var e=window.getComputedStyle(t),s=function(i,r){return!(e[i]===void 0||e[i]===r)};if(e.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;t=t.parentElement}return!1}function F(t){for(;t;){if(t.localName==="dialog")return t;t.parentElement?t=t.parentElement:t.parentNode?t=t.parentNode.host:t=null}return null}function yt(t){for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;t&&t.blur&&t!==document.body&&t.blur()}function Ds(t,e){for(var s=0;s<t.length;++s)if(t[s]===e)return!0;return!1}function Se(t){return!t||!t.hasAttribute("method")?!1:t.getAttribute("method").toLowerCase()==="dialog"}function Et(t){var e=["button","input","keygen","select","textarea"],s=e.map(function(o){return o+":not([disabled])"});s.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=t.querySelector(s.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var r=t.querySelectorAll("*"),n=0;n<r.length&&!(r[n].tagName&&r[n].shadowRoot&&(i=Et(r[n].shadowRoot),i));n++);return i}function Tt(t){return t.isConnected||document.body.contains(t)}function Ct(t){if(t.submitter)return t.submitter;var e=t.target;if(!(e instanceof HTMLFormElement))return null;var s=m.formSubmitter;if(!s){var i=t.target,r="getRootNode"in i&&i.getRootNode()||document;s=r.activeElement}return!s||s.form!==e?null:s}function Ls(t){if(!t.defaultPrevented){var e=t.target,s=m.imagemapUseValue,i=Ct(t);s===null&&i&&(s=i.value);var r=F(e);if(!!r){var n=i&&i.getAttribute("formmethod")||e.getAttribute("method");n==="dialog"&&(t.preventDefault(),s!=null?r.close(s):r.close())}}}function St(t){if(this.dialog_=t,this.replacedStyleTop_=!1,this.openAsModal_=!1,t.hasAttribute("role")||t.setAttribute("role","dialog"),t.show=this.show.bind(this),t.showModal=this.showModal.bind(this),t.close=this.close.bind(this),t.addEventListener("submit",Ls,!1),"returnValue"in t||(t.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(t,{attributes:!0,attributeFilter:["open"]})}else{var s=!1,i=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),r,n=function(o){if(o.target===t){var c="DOMNodeRemoved";s|=o.type.substr(0,c.length)===c,window.clearTimeout(r),r=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(o){t.addEventListener(o,n)})}Object.defineProperty(t,"open",{set:this.setOpen.bind(this),get:t.hasAttribute.bind(t,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}St.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Tt(this.dialog_)||this.downgradeModal()},downgradeModal:function(){!this.openAsModal_||(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),m.dm.removeDialog(this))},setOpen:function(t){t?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(t){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var s=document.createEvent("MouseEvents");s.initMouseEvent(t.type,t.bubbles,t.cancelable,window,t.detail,t.screenX,t.screenY,t.clientX,t.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget),this.dialog_.dispatchEvent(s),t.stopPropagation()},focus_:function(){var t=this.dialog_.querySelector("[autofocus]:not([disabled])");!t&&this.dialog_.tabIndex>=0&&(t=this.dialog_),t||(t=Et(this.dialog_)),yt(document.activeElement),t&&t.focus()},updateZIndex:function(t,e){if(t<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=t,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Tt(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!m.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");As(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,m.needsCentering(this.dialog_)?(m.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(t){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),t!==void 0&&(this.dialog_.returnValue=t);var e=new H("close",{bubbles:!1,cancelable:!1});wt(this.dialog_,e)}};var m={};if(m.reposition=function(t){var e=document.body.scrollTop||document.documentElement.scrollTop,s=e+(window.innerHeight-t.offsetHeight)/2;t.style.top=Math.max(e,s)+"px"},m.isInlinePositionSetByStylesheet=function(t){for(var e=0;e<document.styleSheets.length;++e){var s=document.styleSheets[e],i=null;try{i=s.cssRules}catch{}if(!!i)for(var r=0;r<i.length;++r){var n=i[r],o=null;try{o=document.querySelectorAll(n.selectorText)}catch{}if(!(!o||!Ds(o,t))){var c=n.style.getPropertyValue("top"),u=n.style.getPropertyValue("bottom");if(c&&c!=="auto"||u&&u!=="auto")return!0}}}return!1},m.needsCentering=function(t){var e=window.getComputedStyle(t);return e.position!=="absolute"||t.style.top!=="auto"&&t.style.top!==""||t.style.bottom!=="auto"&&t.style.bottom!==""?!1:!m.isInlinePositionSetByStylesheet(t)},m.forceRegisterDialog=function(t){if((window.HTMLDialogElement||t.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",t),t.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new St(t)},m.registerDialog=function(t){t.showModal||m.forceRegisterDialog(t)},m.DialogManager=function(){this.pendingDialogStack=[];var t=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(e){this.forwardTab_=void 0,e.stopPropagation(),t([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=1e5+150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var s=[];e.forEach(function(i){for(var r=0,n;n=i.removedNodes[r];++r){if(n instanceof Element)n.localName==="dialog"&&s.push(n);else continue;s=s.concat(n.querySelectorAll("dialog"))}}),s.length&&t(s)}))},m.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},m.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},m.DialogManager.prototype.updateStacking=function(){for(var t=this.zIndexHigh_,e=0,s;s=this.pendingDialogStack[e];++e)s.updateZIndex(--t,--t),e===0&&(this.overlay.style.zIndex=--t);var i=this.pendingDialogStack[0];if(i){var r=i.dialog.parentNode||document.body;r.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},m.DialogManager.prototype.containedByTopDialog_=function(t){for(;t=F(t);){for(var e=0,s;s=this.pendingDialogStack[e];++e)if(s.dialog===t)return e===0;t=t.parentElement}return!1},m.DialogManager.prototype.handleFocus_=function(t){var e=t.composedPath?t.composedPath()[0]:t.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(t.preventDefault(),t.stopPropagation(),yt(e),this.forwardTab_!==void 0)){var s=this.pendingDialogStack[0],i=s.dialog,r=i.compareDocumentPosition(e);return r&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},m.DialogManager.prototype.handleKey_=function(t){if(this.forwardTab_=void 0,t.keyCode===27){t.preventDefault(),t.stopPropagation();var e=new H("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&wt(s.dialog,e)&&s.dialog.close()}else t.keyCode===9&&(this.forwardTab_=!t.shiftKey)},m.DialogManager.prototype.checkDOM_=function(t){var e=this.pendingDialogStack.slice();e.forEach(function(s){t.indexOf(s.dialog)!==-1?s.downgradeModal():s.maybeHideModal()})},m.DialogManager.prototype.pushDialog=function(t){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(t)===1&&this.blockDocument(),this.updateStacking(),!0)},m.DialogManager.prototype.removeDialog=function(t){var e=this.pendingDialogStack.indexOf(t);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},m.dm=new m.DialogManager,m.formSubmitter=null,m.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Vt=document.createElement("form");if(Vt.setAttribute("method","dialog"),Vt.method!=="dialog"){var x=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(x){var Is=x.get;x.get=function(){return Se(this)?"dialog":Is.call(this)};var Ns=x.set;x.set=function(t){return typeof t=="string"&&t.toLowerCase()==="dialog"?this.setAttribute("method",t):Ns.call(this,t)},Object.defineProperty(HTMLFormElement.prototype,"method",x)}}document.addEventListener("click",function(t){if(m.formSubmitter=null,m.imagemapUseValue=null,!t.defaultPrevented){var e=t.target;if("composedPath"in t){var s=t.composedPath();e=s.shift()||e}if(!(!e||!Se(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;m.imagemapUseValue=t.offsetX+","+t.offsetY}var r=F(e);!r||(m.formSubmitter=e)}}},!1),document.addEventListener("submit",function(t){var e=t.target,s=F(e);if(!s){var i=Ct(t),r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&t.preventDefault()}});var Hs=HTMLFormElement.prototype.submit,xs=function(){if(!Se(this))return Hs.call(this);var t=F(this);t&&t.close()};HTMLFormElement.prototype.submit=xs}class Ve extends h{constructor(){super(...arguments);l(this,"_dialog",null)}get _src(){return this.hasSrcValue?this.srcValue:this.el.src}get _srcSet(){return this.hasSrcSetValue?this.srcSetValue:this.el.srcset}get _sizes(){return this.hasSizesValue?this.sizesValue:this.el.sizes}get _modalClassName(){return this.hasModalClass?this.modalClass:"image-lightbox-dialog"}get _imageClassName(){return this.hasImageClass?this.imageClass:"image-lightbox-image"}initialize(){this.open=this.open.bind(this),this.close=this.close.bind(this)}connect(){}disconnect(){this.close()}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let s=document.createElement("img");s.className=this._imageClassName,s.src=this._src,s.srcset=this._srcSet,s.sizes=this._sizes,this._dialog.appendChild(s),e.insertAdjacentElement("afterend",this._dialog),m.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),M(this._dialog,{behavior:"smooth",block:"end"}).catch(()=>this._dialog.scrollIntoView(!1)),d(this,this._dialog,"click",this.close),d(this,this._dialog,"cancel",this.close),d(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,M(this.el,{behavior:"smooth",block:"end"}).catch(()=>this.el.scrollIntoView(!1)))}}l(Ve,"values",{src:String,srcSet:String,sizes:String}),l(Ve,"classes",["modal","image"]);class kt extends h{async play(e){e==null||e.preventDefault(),await this.mediaTarget.play()}pause(e){e==null||e.preventDefault(),this.mediaTarget.pause()}restart(e){e==null||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){e==null||e.preventDefault(),this.mediaTarget.currentTime+=5}}l(kt,"targets",["media"]);class Mt extends h{get _increment(){return this.hasIncrementValue?this.incrementValue:50}get _behaviour(){if(this.hasBehaviourValue){if(["auto","smooth"].includes(this.behaviourValue))return this.behaviourValue;throw new Error(`'${this.behaviourValue}' is not a recognised scroll behaviour`)}else return"auto"}async scrollTop(e){e==null||e.preventDefault(),await te(this.el,{behavior:this._behaviour})}async scrollBottom(e){e==null||e.preventDefault(),await se(this.el,{behavior:this._behaviour})}async scrollLeft(e){e==null||e.preventDefault(),await ie(this.el,{behavior:this._behaviour})}async scrollRight(e){e==null||e.preventDefault(),await ie(this.el,{behavior:this._behaviour})}async up(e){e==null||e.preventDefault(),await ze(this.el,this._increment,{behavior:this._behaviour})}async down(e){e==null||e.preventDefault(),await Ue(this.el,this._increment,{behavior:this._behaviour})}async left(e){e==null||e.preventDefault(),await je(this.el,this._increment,{behavior:this._behaviour})}async right(e){e==null||e.preventDefault(),await We(this.el,this._increment,{behavior:this._behaviour})}}l(Mt,"values",{behaviour:String,increment:Number});class At extends q{connect(){requestAnimationFrame(()=>{M(this.el,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>this.el.scrollIntoView()),this._cleanupSelf()})}}l(At,"values",{behavior:String,block:String,inline:String});class Dt extends h{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=P(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await se(this._scrollTarget)}}l(Dt,"values",{mode:String});class Lt extends h{scroll(){let e=document.querySelector(this.selectorValue);if(!e){console.warn(`Could not find target for '${this.selectorValue}'`);return}M(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView())}}l(Lt,"values",{selector:String,behavior:String,block:String,inline:String});class It extends h{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=P(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await te(this._scrollTarget)}}l(It,"values",{mode:String});function Nt(t){t=t.trim();let e=t.includes("&&"),s=t.includes("||"),i=t.includes("(")||t.includes(")");if(e&&s)throw new Error("Cannot have both && and || in the same expression.");if(i)throw new Error("Cannot have logical groupings `(>3 && <= 9) || (>1 && <2)` in the expression. Only supports simple expressions like `>1 && <3`");let r=t.split(e?"&&":"||");return e?r.map(n=>ke(n)):s?r.map(n=>ke(n)):[ke(t)]}function ke(t){let s=[">=","<=","==","!=",">","<"].find(o=>t.includes(o));if(!s)throw new Error(`Could not find operator in expression: ${t}`);let i=t.split(s)[1].trim(),r=/^-?[0-9]\d*(\.\d+)?$/.test(i);if(i=r?parseFloat(i):i,i=="")throw new Error(`Could not find a value in expression: ${t}`);let n=o=>o!=="";switch(s){case">":return o=>r&&n(o)&&o>i;case"<":return o=>r&&n(o)&&o<i;case">=":return o=>r&&n(o)&&o>=i;case"<=":return o=>r&&n(o)&&o<=i;case"==":return o=>n(o)&&o==i;case"!=":return o=>n(o)&&o!=i;default:throw new Error(`Unknown operator ${s}`)}}function R(t,e){return`signal:${e}:${t}`}function Me(t){return R(t,"connect")}function Ae(t){return R(t,"value")}class Ht extends h{get _predicates(){return Nt(this.whenValue)}connect(){L.emit(Me(this.nameValue)),G(this,Ae(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(!this.hasWhenValue){this.dispatchEvent(this.el,R(this.nameValue,"match"));return}this._predicates.every(i=>i(s))?this.dispatchEvent(this.el,R(this.nameValue,"match"),{detail:{element:this.el,value:s}}):this.dispatchEvent(this.el,R(this.nameValue,"no-match"),{detail:{element:this.el,value:s}})}}l(Ht,"values",{name:String,when:String});class xt extends h{get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:null}get _name(){return this.hasNameValue?this.nameValue:this.element.name}connect(){G(this,Me(this._name),()=>this.emitValue()),d(this,this.el,"input",this.emitValue,{debounce:this._debounceTimeout||void 0}),d(this,this.el,"change",this.emitValue),requestAnimationFrame(()=>this.emitValue())}emitValue(){var s;let e=this.el.value;if(v(this.el)&&this.el.type==="checkbox")e=this.el.checked?"true":"false";else if(v(this.el)&&this.el.type==="radio"){let i=(s=ue(this.el).find(r=>r.checked))==null?void 0:s.value;e=i||""}L.emit(Ae(this._name),{element:this.el,value:e})}}l(xt,"values",{name:String,debounceInterval:Number});class De extends h{get _predicates(){return Nt(this.showValue)}get defaultHideClasses(){return["hide"]}connect(){T(this),L.emit(Me(this.nameValue)),G(this,Ae(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(this.showValue=="default"){s==""?this.removeHideClasses(this.el):this.addHideClasses(this.el);return}this._predicates.every(i=>i(s))?this.removeHideClasses(this.el):this.addHideClasses(this.el)}}l(De,"values",{name:String,show:String}),l(De,"classes",["hide"]);class Ot extends h{constructor(){super(...arguments);l(this,"_lastIndex",null);l(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(e==null)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(e.length==0)throw new Error("Expected table to have a <thead> element with at least one row.");return Array.from(e[0].cells)}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}connect(){requestAnimationFrame(()=>{A(this,this._tableHeaders,"click",this.sort),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)})}sort(e){e.preventDefault();let s=e.target,i=this._indexOfHeaderCell(s);s.dataset.sortable!="false"&&(s.dataset.sort=="asc"?(this._reverse=!0,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="desc",this._sortByColumn(i)):(this._reverse=!1,this._otherHeaderCells(s).forEach(r=>delete r.dataset.sort),s.dataset.sort="asc",this._sortByColumn(i)))}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_otherHeaderCells(e){return Array.from(this._tableHeaders).filter(s=>s!=e)}_sortByColumn(e){let s=document.createDocumentFragment();this._tableRows.sort((n,o)=>{var k,w;let c=Array.from(n.cells),u=Array.from(o.cells),g=((k=c[e])==null?void 0:k.innerText)||"",p=((w=u[e])==null?void 0:w.innerText)||"",_=g.localeCompare(p,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return n.dataset.sortTop||o.dataset.sortBottom?n.dataset.sortTop&&o.dataset.sortTop?_:-1:n.dataset.sortBottom||o.dataset.sortTop?n.dataset.sortBottom&&o.dataset.sortBottom?_:1:this._reverse?_>0?-1:1:_}).forEach(n=>s.appendChild(n)),this._tableBody.innerHTML="",this._tableBody.appendChild(s),this._lastIndex=e}}l(Ot,"values",{startSort:Number});function Le(t,e,s,i){s=s.bind(t);let r=new MutationObserver(s),n=()=>r.observe(e,i),o=()=>r.disconnect();return y(t,n,o),o}class Ie extends h{get _truncated(){return this.hasTruncatedValue?this.truncatedValue:!1}set _truncated(e){this.truncatedValue=e}get _tableBody(){return this.el.tBodies[0]}get _tableRows(){return Array.from(this._tableBody.rows)}get _limit(){return this.hasLimitValue?this.limitValue:20}connect(){Le(this,this._tableBody,this.mutate,{childList:!0}),requestAnimationFrame(()=>{this.truncate(),d(this,this.showMoreTarget,"click",this.expand)})}truncate(e){e==null||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._hideElement(s)}),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,e==null||e.preventDefault(),this._tableRows.slice(this._limit).forEach(s=>{s!==this.showMoreTarget&&this._showElement(s)}),this._hideElement(this.showMoreTarget)}mutate(e){this._truncated&&this._reTruncate()}_showElement(e){e.style.display=""}_hideElement(e){e.style.display="none"}_reTruncate(){this._tableRows.slice(0,this._limit).forEach(e=>{e!==this.showMoreTarget&&this._showElement(e)}),this._tableRows.slice(this._limit).forEach(e=>{e!==this.showMoreTarget&&this._hideElement(e)}),this._showElement(this.showMoreTarget)}}l(Ie,"targets",["showMore"]),l(Ie,"values",{limit:Number,truncated:Boolean});class Bt extends h{alert(){alert(this.messageValue)}}l(Bt,"values",{message:String});class Os extends h{connect(){let{enter:e,exit:s,toggle:i}=nt(this);this.enter=e,this.exit=s,this.toggle=i}}class Ft extends h{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map(e=>Number.parseFloat(e.trim())).filter(e=>e>=0&&e<=1):[0,1]}connect(){me(this,this.el,this.appear,this.disappear,{threshold:this._threshold})}appear(e){ee(this,this.el,"intersection:appear")}disappear(e){ee(this,this.el,"intersection:disappear")}}l(Ft,"values",{threshold:String});class Rt extends h{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(()=>{O(this,this._interval,this.secondsValue*1e3)})}_interval(){this.dispatchEvent(this.el,"interval:action")}}l(Rt,"values",{seconds:Number});class qt extends h{get name(){return this.hasNameValue?this.nameValue:""}get _addedEventName(){return[this.name,"presence","added"].filter(e=>!!e).join(":")}get _removedEventName(){return[this.name,"presence","removed"].filter(e=>!!e).join(":")}connect(){this.dispatchEvent(this.el,this._addedEventName)}disconnect(){this.dispatchEvent(this.el,this._removedEventName)}}l(qt,"values",{name:String});class Pt extends h{print(e){e==null||e.preventDefault(),window.print()}}class $t extends h{connect(){requestAnimationFrame(()=>{D(this,this._timeout,this.secondsValue*1e3)})}_timeout(){this.dispatchEvent(this.el,"timeout")}}l($t,"values",{seconds:Number});class Bs extends h{connect(){d(this,window,["focus","blur"],this._handleVisibility),d(this,document,"visibilitychange",this._handleVisibility),requestAnimationFrame(()=>{this._handleVisibility()})}appear(){this.dispatchEvent(this.el,"user-focus:active")}away(){this.dispatchEvent(this.el,"user-focus:away")}_handleVisibility(){this._documentIsActive()?this.appear():this.away()}_documentIsActive(){return document.visibilityState=="visible"&&document.hasFocus()}}class zt extends h{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame(()=>{O(this,this._tick,this._tickInterval)})}_tick(){let e=new Date;this.hasHoursTarget&&(this.hoursTarget.innerHTML=e.getHours().toString().padStart(2,"0")),this.hasMinutesTarget&&(this.minutesTarget.innerHTML=e.getMinutes().toString().padStart(2,"0")),this.hasSecondsTarget&&(this.secondsTarget.innerHTML=e.getSeconds().toString().padStart(2,"0")),this.hasMillisecondsTarget&&(this.millisecondsTarget.innerHTML=e.getMilliseconds().toString().padStart(3,"0"))}}l(zt,"targets",["hours","minutes","seconds","milliseconds"]);class Y extends h{constructor(){super(...arguments);l(this,"_interval",null)}get _removeUnused(){return this.hasRemoveUnusedValue?this.removeUnusedValue:!1}get _deadlineDate(){return new Date(this.deadlineValue)}connect(){this._interval=setInterval(this._tick.bind(this),1e3),this.addCountingDownClasses()}disconnect(){this._clearTick(),this.removeCountingDownClasses(),this.removeEndedClasses()}deadlineValueChanged(){this._interval==null&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let s={};E.isPast(this._deadlineDate)?(s={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this.removeCountingDownClasses(),this.addEndedClasses(),this.dispatchEvent(this.el,"countdown:ended")):s=E.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(s)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(s)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(s)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(s)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(s)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(s))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,s){this._removeTargetIfUnused(e,s),e.innerHTML=s.toString()}_removeTargetIfUnused(e,s){this._removeUnused&&(s===0&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():s==0?e.dataset.unused=Date.now().toString():e.dataset.unused=void 0)}_years(e){return e.years||0}_months(e){return e.months||0}_days(e){return e.days||0}_hours(e){return e.hours||0}_minutes(e){return e.minutes||0}_seconds(e){return e.seconds||0}}l(Y,"values",{deadline:String,removeUnused:Boolean}),l(Y,"targets",["years","months","days","hours","minutes","seconds"]),l(Y,"classes",["countingDown","ended"]);class Ut extends h{get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:s,weeks:i,days:r,hours:n,minutes:o,seconds:c}=this._duration;e||(e=0),s||(s=0),i||(i=0),r||(r=0),n||(n=0),o||(o=0),c||(c=0);let u=[e,s,i,r,n];return!this._minutes&&!this._seconds&&u.every(g=>g===0)?(o=o+c/60,`${(o/60).toFixed(1)} hours`):E.formatDuration(this._duration,{format:this._format,delimiter:", "})}get _seconds(){return this.hasSecondsValue?this.secondsValue:!0}get _minutes(){return this.hasMinutesValue?this.minutesValue:!0}get _timestamp(){if(this.hasTimestampValue)return E.toDate(this.timestampValue*1e3);throw new Error("Expected `timestampValue` to be present")}get _duration(){return E.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=O(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._clearInterval()}}}l(Ut,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class Z extends h{get defaultHideClasses(){return["hide"]}get defaultActiveClasses(){return["is-active"]}get _currentTab(){return this.hasCurrentTabValue?this.currentTabValue:0}get _equalize(){return this.hasEqualizeValue?this.equalizeValue:!1}connect(){A(this,this.linkTargets,"click",this.switchTabs),this._equalize&&this._setMinHeight(),this.currentTabValue=this._currentTab}switchTabs(e){e.preventDefault(),this.currentTabValue=this.linkTargets.indexOf(e.currentTarget)}currentTabValueChanged(){let e=this._currentTab;e=this._clampIndex(e),this._selectTab(e)}_selectTab(e){e=this._clampIndex(e);let s=this.linkTargets,i=this.contentTargets,r=i[e],n=s[e],o=[...i.slice(0,e),...i.slice(e+1)],c=[...s.slice(0,e),...s.slice(e+1)];this.addActiveClasses(n),n.setAttribute("aria-selected","true"),this.addActiveClasses(r),this.removeHideClasses(r),c.forEach(u=>{u.removeAttribute("aria-selected"),this.removeActiveClasses(u)}),o.forEach(u=>{this.removeActiveClasses(u),this.addHideClasses(u)})}_clampIndex(e){return f.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach(s=>{let i=s.hasAttribute("tab-hidden");i&&this.removeHideClasses(s);let r=s.offsetHeight;r>e&&(e=r),i&&this.addHideClasses(s)}),this.contentTargets.forEach(s=>s.style.minHeight=e+"px")}}l(Z,"values",{currentTab:Number,equalize:Boolean}),l(Z,"targets",["link","content"]),l(Z,"classes",["active","hide"]);class jt extends h{get _duration(){return E.isPast(this._timestamp)?E.intervalToDuration({start:this._timestamp,end:new Date}):E.intervalToDuration({start:new Date,end:this._timestamp})}get _nextUpdate(){let e=this._duration;return e.years&&e.years>0||e.months&&e.months>0||e.days&&e.days>0?null:e.hours&&e.hours>0?18e5:3e4}timestampValueChanged(){this._timestamp=E.toDate(this.timestampValue*1e3)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=E.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&D(this,this._update,this._nextUpdate)}}l(jt,"values",{timestamp:Number});class Wt extends h{get defaultActiveClasses(){return["active"]}get defaultCollapsedClasses(){return["collapsed"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){T(this),Le(this,this.el,this.mutate,{subtree:!0,childList:!0}),this._setup()}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const s=i=>{let r=i.parentElement;r&&(this._nodeActive(r)||this._hideNode(r),r.removeEventListener("click",this._nodeClicked),r.addEventListener("click",this._nodeClicked))};(e.tagName==="UL"||e.tagName==="OL")&&s(e),e.querySelectorAll("ul, ol").forEach(i=>s(i))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach(e=>this._teardownNode(e))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach(s=>{s.removeEventListener("click",this._nodeClicked),this.removeActiveClasses(s),this.removeCollapsedClasses(s)})}_nodeClicked(e){e&&e.stopImmediatePropagation();let s=e.target;!s||!this._hasNested(s)||(this._nodeActive(s)?this._hideNode(s):this._showNode(s))}_nodeActive(e){return this.activeClassesPresent(e)}_showNode(e){this.removeCollapsedClasses(e),this.addActiveClasses(e)}_hideNode(e){this.removeActiveClasses(e),this.addCollapsedClasses(e)}_hasNested(e){return e.querySelectorAll("ul, ol").length>0}mutate(e){for(const s of e)s.type==="childList"&&(Array.from(s.addedNodes||[]).forEach(i=>this._setupNode(i)),Array.from(s.removedNodes||[]).forEach(i=>this._teardownNode(i)))}}l(Wt,"classes",["active","collapsed"]);class Ne extends h{get defaultActiveClasses(){return["active"]}get defaultInactiveClasses(){return["inactive"]}get _key(){return this.keyValue.replaceAll("#","")}get _anchor(){return window.location.hash.substr(1)}set _anchor(e){window.location.hash=e}connect(){T(this),requestAnimationFrame(()=>{this._checkAnchor(),d(this,window,"hashchange",this._checkAnchor)})}write(e){e==null||e.preventDefault(),this._anchor=this._key}_checkAnchor(){this._key===this._anchor?(this.dispatchEvent(this.el,"anchor-spy:active"),this.addActiveClasses(this.el),this.removeInactiveClasses(this.el)):(this.dispatchEvent(this.el,"anchor-spy:inactive"),this.addInactiveClasses(this.el),this.removeActiveClasses(this.el))}}l(Ne,"values",{key:String}),l(Ne,"classes",["active","inactive"]);class Kt extends h{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){d(this,this.el,"click",this.goBack)}goBack(e){e==null||e.preventDefault(),history.go(-this._pages),this.el.href&&D(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}l(Kt,"values",{timeout:Number,pages:Number});class He extends h{constructor(){super(...arguments);l(this,"_supported",!1)}connect(){this._supported=document.queryCommandSupported("copy"),this.hasRemoveUnusedValue&&this.removeUnusedValue&&(this._supported&&this.hasFallbackTarget?this.fallbackTarget.remove():this.hasCopyTarget&&this.copyTarget.remove())}select(e){e&&e.preventDefault(),this.sourceTarget.select()}copy(e){e&&e.preventDefault(),this.sourceTarget.select(),this._supported&&document.execCommand("copy")}}l(He,"targets",["source","button","copy","fallback"]),l(He,"values",{removeUnused:Boolean});class Gt extends h{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(ne(this.el))return"submit";if(ae(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame(()=>{d(this,this.el,this._eventType,this.confirm)})}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatchEvent(this.el,"confirm:cancelled"))}}l(Gt,"values",{message:String});class Jt extends h{get _message(){return this.hasMessageValue?this.messageValue:"Do you want to leave this page? Changes you made may not be saved"}connect(){window.onbeforeunload=()=>this._message,d(this,window,"popstate",this.confirmNavigation),d(this,window,"submit",this.allowSubmit),d(this,window,["turbolinks:before-visit","turbo:before-visit"],this.confirmTurboNavigation)}disconnect(){window.onbeforeunload=null}allowSubmit(e){window.removeEventListener("popstate",this.confirmNavigation),window.onbeforeunload=null}confirmNavigation(e){return!1}confirmTurboNavigation(e){confirm(this._message)||e.preventDefault()}}l(Jt,"values",{message:String});class Xt extends h{connect(){console.log("Debug Controller",this,this.testTargets)}}l(Xt,"targets",["test"]);class Yt extends h{get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}connect(){requestAnimationFrame(()=>{d(this,this.el,["click"],this.disable),d(this,window,["turbo:load","turbolinks:load"],this._enable)})}disable(e){let s=this.el;this._isDisabled(s)?(e==null||e.preventDefault(),e==null||e.stopImmediatePropagation()):(this._disable(),ht(this,s,this._message,this._timeout,this._enable))}enable(e){e==null||e.preventDefault();let s=this.el;this._isDisabled(s)&&this._enable()}_isDisabled(e){return z(e)?e.disabled:e.dataset.disabled=="true"}_disable(){let e=this.el;z(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;z(e)?e.disabled=!1:e.dataset.disabled=void 0}}l(Yt,"values",{message:String,timeout:Number});class Zt extends h{dismiss(){this.el.remove()}}class Fs extends Zt{}class xe extends h{get _id(){if(this.hasIdValue)return this.idValue;let e=this.el.id;if(e!=="")return e;throw new Error(`No ID value to uniquely identify this element. Please either specify data-${this.identifier}-id-value or give this element an 'id' attribute. `)}get _uniqueIdentifier(){return`${location.href} ${this._id}`}get _restoreOnLoad(){return this.hasRestoreOnLoadValue?this.restoreOnLoadValue:!0}get _element(){return this.hasElementTarget?this.elementTarget:this.el}initialize(){this.save=f.debounce(this.save.bind(this),300)}connect(){this._store=ut(this,this._uniqueIdentifier,{}),requestAnimationFrame(()=>{this._restoreOnLoad&&this.restore()})}clear(e){e&&e.preventDefault(),this._store.clear(),this.dispatchEvent(this._element,"element-save:cleared")}save(e){e&&e.preventDefault();let s=this._element,i=this.attributesValue.split(" "),r={};i.forEach(n=>r[n]=f.get(s,n)),this._store.value=r,this.dispatchEvent(s,"element-save:save:success")}restore(e){e&&e.preventDefault();let s=this._element;if(this._store.isEmpty())this.dispatchEvent(s,"element-save:restore:empty");else{const i=this._store.value;Object.keys(i).forEach(r=>f.set(s,r,i[r])),this.dispatchEvent(s,"element-save:restore:success")}}}l(xe,"targets",["element"]),l(xe,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class Q extends h{get _container(){return this.hasContainerTarget?this.containerTarget:this.el}get _children(){let e=this._container;return this.hasScopeSelectorValue?Array.from(e.querySelectorAll(this.scopeSelectorValue)):Array.from(e.children)}connect(){T(this),Le(this,this._container,this.mutate,{childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,s=this._children;s.length===0?(this.removeNotEmptyClasses(),this.addEmptyClasses(),this.dispatchEvent(e,"dom:empty")):(this.addNotEmptyClasses(),this.removeEmptyClasses(),this.dispatchEvent(e,"dom:not-empty",{detail:{count:s.length}}))}}l(Q,"targets",["container"]),l(Q,"classes",["empty","notEmpty"]),l(Q,"values",{scopeSelector:String});class Qt extends h{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var s,i;const e=document.createElement("link");return((s=e.relList)==null?void 0:s.supports)&&((i=e.relList)==null?void 0:i.supports("prefetch"))}get _href(){return this.el.href}get _existingPrefetch(){return(document.head.querySelectorAll(`link[rel="prefetch"][href="${this._href}"]`)||[]).length>0}get _connectionSuitable(){const e=navigator.connection;if(!e)return!0;if(e){if(e.saveData)return Pe(this,"Data Saving is enabled"),!1;if(/2g/.test(e.effectiveType))return Pe(this,"Network is too slow"),!1}return!0}connect(){if(!!this._supportsPrefetch)switch(this._mode){case"intersect":this._setupObserver();break;case"mouseover":d(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver(([s],i)=>{s.isIntersecting&&(this.prefetch(),i.unobserve(s.target))}).observe(this.element)}prefetch(){if(this._existingPrefetch||!this._connectionSuitable)return;const e=document.createElement("link");Object.assign(e,{rel:"prefetch",href:this._href,as:"document"}),document.head.appendChild(e)}}l(Qt,"values",{mode:String});class es extends Pt{get defaultUnsupportedClasses(){return["unsupported"]}connect(){T(this),"print"in window||this.addUnsupportedClasses(),d(this,this.el,"click",this.print)}}l(es,"classes",["unsupported"]);class Rs extends h{connect(){d(this,window,"message",this.messageReceived)}messageReceived(e){let s=e.data;s.hasOwnProperty("name")&&s.name==="iframe-body"&&s.hasOwnProperty("height")&&this.resize(s.height)}resize(e){this.el.style.height=`${e}px`}}class qs extends h{connect(){window.self!==window.top&&(d(this,window,"resize",this.postUpdate,{debounce:200}),this.postUpdate())}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,s=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight)}}class ts extends h{connect(){requestAnimationFrame(()=>{D(this,()=>this.el.remove(),this.secondsValue*1e3)})}}l(ts,"values",{seconds:Number});class Oe extends h{constructor(){super(...arguments);l(this,"_magicElement",null)}get defaultStuckClasses(){return["stuck"]}get _mode(){if(this.hasModeValue){if(!["top","bottom"].includes(this.modeValue))throw new Error(`The modeValue provided '${this.modeValue}' is not one of the recognised configuration options`);if(this.modeValue==="top")return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),lt(this,this.el,this._mode,this._magicElement),new IntersectionObserver(s=>{s.forEach(i=>{i.target===this._magicElement&&(i.intersectionRatio===0?this.addStuckClasses():i.intersectionRatio===1&&this.removeStuckClasses())})},{threshold:[0,1]}).observe(this._magicElement)}}l(Oe,"classes",["stuck"]),l(Oe,"values",{mode:String});class ss extends q{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame(()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()})}execute(e){e==null||e.preventDefault();let s=this.el,i=document.querySelector(this.targetValue);if(i==null){this.dispatchEvent(s,"teleport:error");return}let r=s.cloneNode(!0);switch(this.cleanup(r),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":i.insertAdjacentHTML(this.insertValue,r.outerHTML);break;case"replaceOuter":i.outerHTML=r.outerHTML;break;case"replaceInner":i.innerHTML=r.outerHTML;break;case"prepend":i.insertAdjacentHTML("afterbegin",r.outerHTML);break;case"append":i.insertAdjacentHTML("beforeend",r.outerHTML);break;default:throw new Error("`insert` value was not specified")}s.remove()}}l(ss,"values",{target:String,insert:String,immediate:Boolean});class is extends q{constructor(){super(...arguments);l(this,"_previousState",{})}get _value(){if(this.hasValueValue)return this.valueValue;throw new Error("Expected `valueValue` to be present")}get _attribute(){if(this.hasAttributeValue)return this.attributeValue;throw new Error("Expected `attributeValue` to be present")}get _seconds(){if(this.hasSecondsValue)return this.secondsValue*1e3;throw new Error("Expected `secondsValue` to be present")}connect(){this.setState(),D(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=f.get(this.el,this._attribute),f.set(this.el,this._attribute,this.valueValue)}removeState(){f.set(this.el,this._attribute,this._previousState[this._attribute])}}l(is,"values",{attribute:String,seconds:Number,value:String});function rs(t,e,s,i,r="temporary-state"){var n;(!t.dataset.controller||!((n=t.dataset.controller)==null?void 0:n.includes(r)))&&(t.dataset.controller=(t.dataset.controller||` ${r} `).trim().replaceAll(" "," ")),t[f.camelCase(`${r}-attribute-value`)]=e,t[f.camelCase(`${r}-seconds-value`)]=i.toString()}function Ps(t,e,s){rs(t,"className",e,s)}function $s(t,e,s){s=s.bind(t);const i=n=>{e.contains(n.target)||!it(e)||s(n)};let{teardown:r}=d(t,window,["click","touchend"],i);return y(t,()=>{},r),{teardown:r}}function zs(t,e,s,i){let r=null,n=null;if(s){s=s.bind(t);let{teardown:u}=d(t,e,"mouseenter",s);r=u}if(i){i=i.bind(t);let{teardown:u}=d(t,e,"mouseleave",i);n=u}let o=()=>{},c=()=>{r&&r(),n&&n()};return y(t,o,c),{teardown:c}}class Be extends h{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&zs(this,this.el,this.mouseEnter,this.mouseLeave),this.hasClickAwayValue&&this.clickAwayValue&&$s(this,this.el,this.clickOutside),requestAnimationFrame(()=>{this.hasInitialValue&&(this.initialValue==="on"?this.toggleTargets.forEach(e=>this._elementOn(e)):this.toggleTargets.forEach(e=>this._elementOff(e)))})}clickOutside(){this.toggleTargets.forEach(e=>{this._elementWasToggled(e)&&(this._elementToggleStatus(e),this._elementToggle(e))})}mouseEnter(){if(this.hasMouseEnterValue)switch(this.mouseEnterValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle();break}return{}}on(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOn(s)})}off(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementOff(s)})}toggle(e){this.toggleTargets.forEach(s=>{this._elementToggleStatus(s),this._elementToggle(s)})}_elementWasToggled(e){return e.dataset.toggled=="true"}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i))}_elementOn(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!0))}_elementOff(e){this.classValue.split(" ").forEach(i=>e.classList.toggle(i,!1))}}l(Be,"targets",["toggle"]),l(Be,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});function Us(t){const e=t.disconnect.bind(t);let s=!1,i=(u,g)=>{u.forEach(p=>{p.type==="childList"&&Array.from(p.addedNodes).some(_=>_.tagName==="TRIX-TOOLBAR")&&(o(),g.disconnect())})},r=u=>B(t,"pasteEvent").call(t,u),n=new MutationObserver(i),o=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let u=t.element,g=t.element.parentElement;if(g==null)throw new Error("Could not traverse DOM tree from <trix-editor>");u.addEventListener("trix-paste",r);let p=g.querySelector("trix-toolbar");if(!s&&!p){s=!0,n.observe(g,{childList:!0});return}else if(p)n.disconnect();else throw new Error("Could not find an instance of <trix-toolbar> that is a sibling of this <trix-editor>");B(t,"install").call(t,{toolbar:p,editor:u})},c=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let u=t.element,g=t.element.parentElement;if(g==null)throw new Error("Could not traverse DOM tree from <trix-editor>");u.removeEventListener("trix-paste",r);let p=g.querySelector("trix-toolbar");if(!p)throw new Error("Could not find <trix-toolbar> that is a sibling of this <trix-editor> element");B(t,"uninstall").call(t,{toolbar:p,editor:u})};o(),Object.assign(t,{disconnect(){n.disconnect(),c(),B(t,"uninstall").call({toolbar,editor:t.element}),e()}})}class js extends h{get enabledBehaviours(){let e=i=>i!==void 0&&i!=="false",s=(i,r)=>e(i)?[r]:[];return[...s(this.el.dataset.noBold,this.bold),...s(this.el.dataset.noBulletList,this.bulletList),...s(this.el.dataset.noCode,this.code),...s(this.el.dataset.noHeading,this.heading),...s(this.el.dataset.noItalic,this.italic),...s(this.el.dataset.noStrikethrough,this.strikethrough),...s(this.el.dataset.noLink,this.link),...s(this.el.dataset.noIndents,this.indents),...s(this.el.dataset.noNumberList,this.numberList),...s(this.el.dataset.noQuote,this.quote),...s(this.el.dataset.noFileUploads,this.fileUploads)]}get bold(){return this.formattingHandlers(".trix-button--icon-bold","bold")}get bulletList(){return this.formattingHandlers(".trix-button--icon-bullet-list","bullet-list")}get code(){return this.formattingHandlers(".trix-button--icon-code","code")}get heading(){return this.formattingHandlers(".trix-button--icon-heading-1","heading")}get italic(){return this.formattingHandlers(".trix-button--icon-italic","italic")}get strikethrough(){return this.formattingHandlers(".trix-button--icon-strike","strike")}get link(){return this.formattingHandlers(".trix-button--icon-link","href")}get indents(){return this.simpleHideShowHandlers([".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level",".trix-button--icon-decrease-nesting-level, .trix-button--icon-increase-nesting-level"].join(", "))}get numberList(){return this.simpleHideShowHandlers(".trix-button--icon-number-list")}get quote(){return this.simpleHideShowHandlers(".trix-button--icon-quote")}get fileUploads(){let e=".trix-button-group.trix-button-group--file-tools",s=n=>n==null?void 0:n.preventDefault(),i=this,r=this.el;return{install(n){i.simpleHideShowHandlers(e).install(n),i.el.addEventListener("trix-file-accept",s)},pasteEvent(n){let{dataTransfer:o,html:c}=n.paste,{editor:u}=r;(o.files.length>0||c.includes("<img"))&&(alert("The content you pasted contains images and/or files. File uploads are not supported."),u.undo())},uninstall(n){i.simpleHideShowHandlers(e).uninstall(n),i.el.removeEventListener("trix-file-accept",s)}}}connect(){Us(this)}install(e){this.enabledBehaviours.forEach(s=>s.install(e))}pasteEvent(e){this.enabledBehaviours.forEach(s=>s.pasteEvent&&s.pasteEvent(e))}uninstall(e){this.enabledBehaviours.forEach(s=>s.uninstall(e))}simpleHideShowHandlers(e){return{install:({toolbar:s})=>this.hideToolbarSelector(s,e),uninstall:({toolbar:s})=>this.showToolbarSelector(s,e)}}formattingHandlers(e,s){let i=this.el,{editor:r}=i;return{install:n=>{this.simpleHideShowHandlers(e).install(n)},pasteEvent(n){let{range:o}=n.paste,c=i.editor.getSelectedRange();r.setSelectedRange(o),r.deactivateAttribute(s),r.setSelectedRange(c)},uninstall:n=>{this.simpleHideShowHandlers(e).uninstall(n)}}}showToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="")}hideToolbarSelector(e,s){e.querySelectorAll(s).forEach(i=>i.style.display="none")}}class as extends h{toggle(e){e==null||e.preventDefault();let i=this._getFrame().src;i==null||i!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){e==null||e.preventDefault(),this._setSrc()}clear(e){e==null||e.preventDefault(),this._clear()}_setSrc(){let e=this._getFrame();this.hasLoadingMessageValue&&(e.innerHTML=this.loadingMessageValue),e.src=this._getSrc()}_clear(){let e=this._getFrame();e.src="",e.innerHTML=""}_getFrame(){let e=document.getElementById(`${this.frameIdValue}`);if(e==null)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(re(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(ae(e))return e.href;throw new Error("No link given to drive frame to")}}l(as,"values",{frameId:String,src:String,loadingMessage:String});class ns extends h{get _poll(){return this.hasPollValue?this.pollValue:!1}connect(){let e=this.el;if(re(e)){if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.")}else throw new Error("Expected controller to be mounted on a <turbo-frame> element.");this._poll&&requestAnimationFrame(()=>D(this,this.refresh,this.intervalValue))}refresh(e){e==null||e.preventDefault();let s=this.el;s.src=s.src}}l(ns,"values",{interval:Number,poll:Boolean}),a.AlertController=Bt,a.AnchorSpyController=Ne,a.AsyncBlockController=fe,a.AutoSubmitFormController=dt,a.AutosizeController=Cs,a.BackLinkController=Kt,a.BaseController=h,a.CharCountController=W,a.CheckboxDisableInputsController=pe,a.CheckboxEnableInputsController=_e,a.CheckboxSelectAllController=ft,a.CheckboxXORController=mt,a.ClipboardController=He,a.ClockController=zt,a.ConfirmController=Gt,a.ConfirmNavigationController=Jt,a.CountdownController=Y,a.DebugController=Xt,a.DetectDirtyController=Vs,a.DetectDirtyFormController=Ms,a.DisableWithController=Yt,a.DismissableController=Zt,a.DurationController=Ut,a.ElementSaveController=xe,a.EmptyDomController=Q,a.EnableInputsController=be,a.EphemeralController=q,a.EventBus=L,a.FallbackImageController=Ce,a.FocusStealController=pt,a.FormRcController=ve,a.FormSaveController=_t,a.FullscreenController=Os,a.IntersectionController=Ft,a.IntervalController=Rt,a.LazyBlockController=Ts,a.LightboxImageController=Ve,a.LimitedSelectionCheckboxesController=we,a.LoadBlockController=N,a.MediaPlayerController=kt,a.NavigateFormErrorsController=K,a.NestedFormController=ye,a.PasswordConfirmController=Ee,a.PasswordPeekController=bt,a.PollBlockController=ge,a.PrefetchController=Qt,a.PresenceController=qt,a.PrintButtonController=es,a.PrintController=Pt,a.RemoteFormController=Te,a.RemoveController=Fs,a.ResponsiveIframeBodyController=qs,a.ResponsiveIframeWrapperController=Rs,a.ScrollContainerController=Mt,a.ScrollIntoFocusController=At,a.ScrollToBottomController=Dt,a.ScrollToController=Lt,a.ScrollToTopController=It,a.SelfDestructController=ts,a.SignalActionController=Ht,a.SignalInputController=xt,a.SignalVisibilityController=De,a.StickyController=Oe,a.StorageSerializers=ot,a.SyncInputsController=vt,a.TableSortController=Ot,a.TableTruncateController=Ie,a.TabsController=Z,a.TeleportController=ss,a.TemporaryStateController=is,a.TimeDistanceController=jt,a.TimeoutController=$t,a.ToggleClassController=Be,a.TreeViewController=Wt,a.TrixModifierController=js,a.TurboFrameRCController=as,a.TurboFrameRefreshController=ns,a.UserFocusController=Bs,a.ValueWarnController=J,a.WordCountController=X,a.applyTemporaryClass=Ps,a.applyTemporaryState=rs,a.createHiddenButton=tt,a.createHiddenInput=st,a.getAllRadiosInGroup=ue,a.getOtherRadiosInGroup=he,a.getScrollParent=P,a.insertElement=le,a.insertHiddenButton=oe,a.insertHiddenInput=_s,a.isDirty=ks,a.isElementCheckable=V,a.isElementInViewport=it,a.isFormDirty=gt,a.isHTMLAnchorElement=ae,a.isHTMLButtonButtonElement=Je,a.isHTMLButtonElement=ms,a.isHTMLButtonInputElement=ps,a.isHTMLFormElement=ne,a.isHTMLImageElement=gs,a.isHTMLInputElement=v,a.isHTMLLabelElement=fs,a.isHTMLLinkElement=ds,a.isHTMLResetButtonElement=Ye,a.isHTMLResetInputElement=Ge,a.isHTMLSelectElement=I,a.isHTMLSubmitButtonElement=Xe,a.isHTMLSubmitInputElement=Ke,a.isHTMLTextAreaElement=$,a.isTurboFrame=re,a.isTypeOfButtonableElement=z,a.isTypeOfFormInputElement=et,a.isTypeOfResetButtonElement=Ze,a.isTypeOfSubmitButtonElement=Qe,a.requestReset=rt,a.requestSubmit=ce,a.scrollAbsoluteBottom=se,a.scrollAbsoluteLeft=ie,a.scrollAbsoluteRight=hs,a.scrollAbsoluteTop=te,a.scrollDown=Ue,a.scrollLeft=je,a.scrollRight=We,a.scrollToElement=M,a.scrollUp=ze,a.useCollectionEventListener=A,a.useCollectionEventListeners=vs,a.useEventListener=d,a.useEventListeners=bs,a.useFullscreen=nt,a.useGeolocation=ws,a.useInjectedElement=lt,a.useInjectedFragment=de,a.useInjectedHTML=ys,a.useInterval=O,a.useLocalStorage=ut,a.useTemporaryContent=ht,a.useTimeout=D,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
|
6
2
|
//# sourceMappingURL=stimulus-library.umd.js.map
|