stimulus-library 0.6.1 → 0.6.5

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.
Files changed (158) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/controllers/ajax/async_block_controller.d.ts +1 -2
  3. package/dist/controllers/ajax/async_block_controller.d.ts.map +1 -1
  4. package/dist/controllers/ajax/index.d.ts +5 -0
  5. package/dist/controllers/ajax/index.d.ts.map +1 -0
  6. package/dist/controllers/ajax/lazy_block_controller.d.ts.map +1 -1
  7. package/dist/controllers/ajax/load_block_controller.d.ts +4 -0
  8. package/dist/controllers/ajax/load_block_controller.d.ts.map +1 -1
  9. package/dist/controllers/ajax/poll_block_controller.d.ts +2 -0
  10. package/dist/controllers/ajax/poll_block_controller.d.ts.map +1 -1
  11. package/dist/controllers/anchor_spy_controller.d.ts +7 -0
  12. package/dist/controllers/anchor_spy_controller.d.ts.map +1 -1
  13. package/dist/controllers/confirm_navigation_controller.d.ts +0 -1
  14. package/dist/controllers/confirm_navigation_controller.d.ts.map +1 -1
  15. package/dist/controllers/disable_with_controller.d.ts +0 -1
  16. package/dist/controllers/disable_with_controller.d.ts.map +1 -1
  17. package/dist/controllers/element_save_controller.d.ts.map +1 -1
  18. package/dist/controllers/empty_dom_controller.d.ts +4 -12
  19. package/dist/controllers/empty_dom_controller.d.ts.map +1 -1
  20. package/dist/controllers/forms/autosize_controller.d.ts +1 -2
  21. package/dist/controllers/forms/autosize_controller.d.ts.map +1 -1
  22. package/dist/controllers/forms/char_count_controller.d.ts +2 -6
  23. package/dist/controllers/forms/char_count_controller.d.ts.map +1 -1
  24. package/dist/controllers/forms/checkbox_select_all_controller.d.ts +1 -0
  25. package/dist/controllers/forms/checkbox_select_all_controller.d.ts.map +1 -1
  26. package/dist/controllers/forms/checkbox_xor_controller.d.ts +9 -0
  27. package/dist/controllers/forms/checkbox_xor_controller.d.ts.map +1 -0
  28. package/dist/controllers/forms/detect_dirty_controller.d.ts.map +1 -1
  29. package/dist/controllers/forms/detect_dirty_form_controller.d.ts.map +1 -1
  30. package/dist/controllers/forms/index.d.ts +23 -0
  31. package/dist/controllers/forms/index.d.ts.map +1 -0
  32. package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts +2 -1
  33. package/dist/controllers/forms/limited_selection_checkboxes_controller.d.ts.map +1 -1
  34. package/dist/controllers/forms/navigate_form_errors_controller.d.ts +6 -0
  35. package/dist/controllers/forms/navigate_form_errors_controller.d.ts.map +1 -1
  36. package/dist/controllers/forms/password_confirm_controller.d.ts +2 -6
  37. package/dist/controllers/forms/password_confirm_controller.d.ts.map +1 -1
  38. package/dist/controllers/forms/sync_inputs_controller.d.ts +0 -2
  39. package/dist/controllers/forms/sync_inputs_controller.d.ts.map +1 -1
  40. package/dist/controllers/forms/value_warn_controller.d.ts +5 -12
  41. package/dist/controllers/forms/value_warn_controller.d.ts.map +1 -1
  42. package/dist/controllers/forms/word_count_controller.d.ts +2 -6
  43. package/dist/controllers/forms/word_count_controller.d.ts.map +1 -1
  44. package/dist/controllers/index.d.ts +30 -0
  45. package/dist/controllers/index.d.ts.map +1 -0
  46. package/dist/controllers/media/fallback_image_controller.d.ts +4 -12
  47. package/dist/controllers/media/fallback_image_controller.d.ts.map +1 -1
  48. package/dist/controllers/media/index.d.ts +4 -0
  49. package/dist/controllers/media/index.d.ts.map +1 -0
  50. package/dist/controllers/media/lightbox_image_controller.d.ts +1 -0
  51. package/dist/controllers/media/lightbox_image_controller.d.ts.map +1 -1
  52. package/dist/controllers/media/media_player_controller.d.ts +0 -3
  53. package/dist/controllers/media/media_player_controller.d.ts.map +1 -1
  54. package/dist/controllers/print_button_controller.d.ts +2 -6
  55. package/dist/controllers/print_button_controller.d.ts.map +1 -1
  56. package/dist/controllers/responsive_iframe_controller.d.ts +0 -5
  57. package/dist/controllers/responsive_iframe_controller.d.ts.map +1 -1
  58. package/dist/controllers/scroll/index.d.ts +6 -0
  59. package/dist/controllers/scroll/index.d.ts.map +1 -0
  60. package/dist/controllers/signal/events.d.ts +4 -0
  61. package/dist/controllers/signal/events.d.ts.map +1 -0
  62. package/dist/controllers/signal/expressions.d.ts +2 -0
  63. package/dist/controllers/signal/expressions.d.ts.map +1 -0
  64. package/dist/controllers/signal/index.d.ts +4 -0
  65. package/dist/controllers/signal/index.d.ts.map +1 -0
  66. package/dist/controllers/signal/signal_action_controller.d.ts +15 -0
  67. package/dist/controllers/signal/signal_action_controller.d.ts.map +1 -0
  68. package/dist/controllers/signal/signal_input_controller.d.ts +20 -0
  69. package/dist/controllers/signal/signal_input_controller.d.ts.map +1 -0
  70. package/dist/controllers/signal/signal_visibility_controller.d.ts +18 -0
  71. package/dist/controllers/signal/signal_visibility_controller.d.ts.map +1 -0
  72. package/dist/controllers/sticky_controller.d.ts +3 -6
  73. package/dist/controllers/sticky_controller.d.ts.map +1 -1
  74. package/dist/controllers/tables/index.d.ts +3 -0
  75. package/dist/controllers/tables/index.d.ts.map +1 -0
  76. package/dist/controllers/tables/table_sort_controller.d.ts +1 -0
  77. package/dist/controllers/tables/table_sort_controller.d.ts.map +1 -1
  78. package/dist/controllers/tables/table_truncate_controller.d.ts +0 -1
  79. package/dist/controllers/tables/table_truncate_controller.d.ts.map +1 -1
  80. package/dist/controllers/temporary_state_controller.d.ts +0 -1
  81. package/dist/controllers/temporary_state_controller.d.ts.map +1 -1
  82. package/dist/controllers/toggle_class_controller.d.ts.map +1 -1
  83. package/dist/controllers/trix_modifier_controller.d.ts +88 -0
  84. package/dist/controllers/trix_modifier_controller.d.ts.map +1 -0
  85. package/dist/controllers/utility/alert_controller.d.ts +9 -0
  86. package/dist/controllers/utility/alert_controller.d.ts.map +1 -0
  87. package/dist/controllers/utility/fullscreen_controller.d.ts +8 -0
  88. package/dist/controllers/utility/fullscreen_controller.d.ts.map +1 -0
  89. package/dist/controllers/utility/index.d.ts +9 -0
  90. package/dist/controllers/utility/index.d.ts.map +1 -0
  91. package/dist/controllers/utility/intersection_controller.d.ts.map +1 -1
  92. package/dist/controllers/utility/presence_controller.d.ts +2 -0
  93. package/dist/controllers/utility/presence_controller.d.ts.map +1 -1
  94. package/dist/controllers/visual/countdown_controller.d.ts +4 -12
  95. package/dist/controllers/visual/countdown_controller.d.ts.map +1 -1
  96. package/dist/controllers/visual/duration_controller.d.ts +1 -2
  97. package/dist/controllers/visual/duration_controller.d.ts.map +1 -1
  98. package/dist/controllers/visual/index.d.ts +7 -0
  99. package/dist/controllers/visual/index.d.ts.map +1 -0
  100. package/dist/controllers/visual/tabs_controller.d.ts +6 -12
  101. package/dist/controllers/visual/tabs_controller.d.ts.map +1 -1
  102. package/dist/controllers/visual/time_distance_controller.d.ts +0 -1
  103. package/dist/controllers/visual/time_distance_controller.d.ts.map +1 -1
  104. package/dist/controllers/visual/tree_view_controller.d.ts +8 -12
  105. package/dist/controllers/visual/tree_view_controller.d.ts.map +1 -1
  106. package/dist/index.d.ts +3 -79
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/mixins/create_mixin.d.ts +3 -0
  109. package/dist/mixins/create_mixin.d.ts.map +1 -0
  110. package/dist/mixins/index.d.ts +8 -0
  111. package/dist/mixins/index.d.ts.map +1 -0
  112. package/dist/mixins/install_class_methods.d.ts +6 -0
  113. package/dist/mixins/install_class_methods.d.ts.map +1 -0
  114. package/dist/mixins/use_click_outside.d.ts +5 -0
  115. package/dist/mixins/use_click_outside.d.ts.map +1 -0
  116. package/dist/mixins/use_event_bus.d.ts +8 -0
  117. package/dist/mixins/use_event_bus.d.ts.map +1 -0
  118. package/dist/mixins/use_event_listener.d.ts +14 -2
  119. package/dist/mixins/use_event_listener.d.ts.map +1 -1
  120. package/dist/mixins/use_fullscreen.d.ts +9 -0
  121. package/dist/mixins/use_fullscreen.d.ts.map +1 -0
  122. package/dist/mixins/use_geolocation.d.ts +19 -0
  123. package/dist/mixins/use_geolocation.d.ts.map +1 -0
  124. package/dist/mixins/use_hover.d.ts +5 -0
  125. package/dist/mixins/use_hover.d.ts.map +1 -0
  126. package/dist/mixins/use_injected_html.d.ts +2 -2
  127. package/dist/mixins/use_injected_html.d.ts.map +1 -1
  128. package/dist/mixins/use_intersection.d.ts +14 -0
  129. package/dist/mixins/use_intersection.d.ts.map +1 -0
  130. package/dist/mixins/use_interval.d.ts.map +1 -1
  131. package/dist/mixins/use_localstorage.d.ts +15 -0
  132. package/dist/mixins/use_localstorage.d.ts.map +1 -0
  133. package/dist/mixins/use_mutation_observer.d.ts +3 -0
  134. package/dist/mixins/use_mutation_observer.d.ts.map +1 -0
  135. package/dist/mixins/use_timeout.d.ts.map +1 -1
  136. package/dist/mixins/use_trix_modifiers.d.ts +11 -0
  137. package/dist/mixins/use_trix_modifiers.d.ts.map +1 -0
  138. package/dist/stimulus-library.cjs.js +1 -1
  139. package/dist/stimulus-library.cjs.js.map +1 -1
  140. package/dist/stimulus-library.es.js +4584 -1
  141. package/dist/stimulus-library.es.js.map +1 -1
  142. package/dist/stimulus-library.umd.js +1 -1
  143. package/dist/stimulus-library.umd.js.map +1 -1
  144. package/dist/utilities/arrays.d.ts +2 -0
  145. package/dist/utilities/arrays.d.ts.map +1 -0
  146. package/dist/utilities/elements.d.ts +3 -0
  147. package/dist/utilities/elements.d.ts.map +1 -1
  148. package/dist/utilities/fetchRetry.d.ts +2 -0
  149. package/dist/utilities/fetchRetry.d.ts.map +1 -0
  150. package/dist/utilities/index.d.ts +8 -0
  151. package/dist/utilities/index.d.ts.map +1 -0
  152. package/dist/utilities/reactive.d.ts +2 -0
  153. package/dist/utilities/reactive.d.ts.map +1 -0
  154. package/dist/utilities/stimulus.d.ts +3 -0
  155. package/dist/utilities/stimulus.d.ts.map +1 -0
  156. package/dist/utilities/strings.d.ts +2 -0
  157. package/dist/utilities/strings.d.ts.map +1 -0
  158. package/package.json +9 -9
@@ -1,2 +1,2 @@
1
- var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,s)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,__spreadValues=(e,t)=>{for(var s in t||(t={}))__hasOwnProp.call(t,s)&&__defNormalProp(e,s,t[s]);if(__getOwnPropSymbols)for(var s of __getOwnPropSymbols(t))__propIsEnum.call(t,s)&&__defNormalProp(e,s,t[s]);return e},__objRest=(e,t)=>{var s={};for(var i in e)__hasOwnProp.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&__getOwnPropSymbols)for(var i of __getOwnPropSymbols(e))t.indexOf(i)<0&&__propIsEnum.call(e,i)&&(s[i]=e[i]);return s},__publicField=(e,t,s)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,s),s);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash-es"),require("date-fns")):"function"==typeof define&&define.amd?define(["exports","lodash-es","date-fns"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["Stimulus-Library"]={},e.lodashEs,e.dateFns)}(this,(function(e,t,s){"use strict";var i=function(){function e(e,t,s){this.eventTarget=e,this.eventName=t,this.eventOptions=s,this.unorderedBindings=new Set}return e.prototype.connect=function(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)},e.prototype.disconnect=function(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)},e.prototype.bindingConnected=function(e){this.unorderedBindings.add(e)},e.prototype.bindingDisconnected=function(e){this.unorderedBindings.delete(e)},e.prototype.handleEvent=function(e){for(var t=function(e){if("immediatePropagationStopped"in e)return e;var t=e.stopImmediatePropagation;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation:function(){this.immediatePropagationStopped=!0,t.call(this)}})}(e),s=0,i=this.bindings;s<i.length;s++){var r=i[s];if(t.immediatePropagationStopped)break;r.handleEvent(t)}},Object.defineProperty(e.prototype,"bindings",{get:function(){return Array.from(this.unorderedBindings).sort((function(e,t){var s=e.index,i=t.index;return s<i?-1:s>i?1:0}))},enumerable:!1,configurable:!0}),e}();var r=function(){function e(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}return e.prototype.start=function(){this.started||(this.started=!0,this.eventListeners.forEach((function(e){return e.connect()})))},e.prototype.stop=function(){this.started&&(this.started=!1,this.eventListeners.forEach((function(e){return e.disconnect()})))},Object.defineProperty(e.prototype,"eventListeners",{get:function(){return Array.from(this.eventListenerMaps.values()).reduce((function(e,t){return e.concat(Array.from(t.values()))}),[])},enumerable:!1,configurable:!0}),e.prototype.bindingConnected=function(e){this.fetchEventListenerForBinding(e).bindingConnected(e)},e.prototype.bindingDisconnected=function(e){this.fetchEventListenerForBinding(e).bindingDisconnected(e)},e.prototype.handleError=function(e,t,s){void 0===s&&(s={}),this.application.handleError(e,"Error "+t,s)},e.prototype.fetchEventListenerForBinding=function(e){var t=e.eventTarget,s=e.eventName,i=e.eventOptions;return this.fetchEventListener(t,s,i)},e.prototype.fetchEventListener=function(e,t,s){var i=this.fetchEventListenerMapForEventTarget(e),r=this.cacheKey(t,s),n=i.get(r);return n||(n=this.createEventListener(e,t,s),i.set(r,n)),n},e.prototype.createEventListener=function(e,t,s){var r=new i(e,t,s);return this.started&&r.connect(),r},e.prototype.fetchEventListenerMapForEventTarget=function(e){var t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t},e.prototype.cacheKey=function(e,t){var s=[e];return Object.keys(t).sort().forEach((function(e){s.push((t[e]?"":"!")+e)})),s.join(":")},e}(),n=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function o(e){return"window"==e?window:"document"==e?document:void 0}var a=function(){function e(e,t,s){this.element=e,this.index=t,this.eventTarget=s.eventTarget||e,this.eventName=s.eventName||function(e){var t=e.tagName.toLowerCase();if(t in l)return l[t](e)}(e)||c("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||c("missing identifier"),this.methodName=s.methodName||c("missing method name")}return e.forToken=function(e){return new this(e.element,e.index,(t=e.content,{eventTarget:o((i=t.trim().match(n)||[])[4]),eventName:i[2],eventOptions:i[9]?(s=i[9],s.split(":").reduce((function(e,t){var s;return Object.assign(e,((s={})[t.replace(/^!/,"")]=!/^!/.test(t),s))}),{})):{},identifier:i[5],methodName:i[7]}));var t,s,i},e.prototype.toString=function(){var e=this.eventTargetName?"@"+this.eventTargetName:"";return""+this.eventName+e+"->"+this.identifier+"#"+this.methodName},Object.defineProperty(e.prototype,"eventTargetName",{get:function(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e},enumerable:!1,configurable:!0}),e}(),l={a:function(e){return"click"},button:function(e){return"click"},form:function(e){return"submit"},input:function(e){return"submit"==e.getAttribute("type")?"click":"input"},select:function(e){return"change"},textarea:function(e){return"input"}};function c(e){throw new Error(e)}var u=function(){function e(e,t){this.context=e,this.action=t}return Object.defineProperty(e.prototype,"index",{get:function(){return this.action.index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventTarget",{get:function(){return this.action.eventTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventOptions",{get:function(){return this.action.eventOptions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),e.prototype.handleEvent=function(e){this.willBeInvokedByEvent(e)&&this.invokeWithEvent(e)},Object.defineProperty(e.prototype,"eventName",{get:function(){return this.action.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){var e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error('Action "'+this.action+'" references undefined method "'+this.methodName+'"')},enumerable:!1,configurable:!0}),e.prototype.invokeWithEvent=function(e){try{this.method.call(this.controller,e)}catch(i){var t=this,s={identifier:t.identifier,controller:t.controller,element:t.element,index:t.index,event:e};this.context.handleError(i,'invoking action "'+this.action+'"',s)}},e.prototype.willBeInvokedByEvent=function(e){var t=e.target;return this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element))},Object.defineProperty(e.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"methodName",{get:function(){return this.action.methodName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),e}(),h=function(){function e(e,t){var s=this;this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((function(e){return s.processMutations(e)}))}return e.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,childList:!0,subtree:!0}),this.refresh())},e.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},e.prototype.refresh=function(){if(this.started){for(var e=new Set(this.matchElementsInTree()),t=0,s=Array.from(this.elements);t<s.length;t++){var i=s[t];e.has(i)||this.removeElement(i)}for(var r=0,n=Array.from(e);r<n.length;r++){i=n[r];this.addElement(i)}}},e.prototype.processMutations=function(e){if(this.started)for(var t=0,s=e;t<s.length;t++){var i=s[t];this.processMutation(i)}},e.prototype.processMutation=function(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))},e.prototype.processAttributeChange=function(e,t){var s=e;this.elements.has(s)?this.delegate.elementAttributeChanged&&this.matchElement(s)?this.delegate.elementAttributeChanged(s,t):this.removeElement(s):this.matchElement(s)&&this.addElement(s)},e.prototype.processRemovedNodes=function(e){for(var t=0,s=Array.from(e);t<s.length;t++){var i=s[t],r=this.elementFromNode(i);r&&this.processTree(r,this.removeElement)}},e.prototype.processAddedNodes=function(e){for(var t=0,s=Array.from(e);t<s.length;t++){var i=s[t],r=this.elementFromNode(i);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}},e.prototype.matchElement=function(e){return this.delegate.matchElement(e)},e.prototype.matchElementsInTree=function(e){return void 0===e&&(e=this.element),this.delegate.matchElementsInTree(e)},e.prototype.processTree=function(e,t){for(var s=0,i=this.matchElementsInTree(e);s<i.length;s++){var r=i[s];t.call(this,r)}},e.prototype.elementFromNode=function(e){if(e.nodeType==Node.ELEMENT_NODE)return e},e.prototype.elementIsActive=function(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)},e.prototype.addElement=function(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))},e.prototype.removeElement=function(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))},e}(),d=function(){function e(e,t,s){this.attributeName=t,this.delegate=s,this.elementObserver=new h(e,this)}return Object.defineProperty(e.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.elementObserver.start()},e.prototype.stop=function(){this.elementObserver.stop()},e.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(e.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!1,configurable:!0}),e.prototype.matchElement=function(e){return e.hasAttribute(this.attributeName)},e.prototype.matchElementsInTree=function(e){var t=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(this.selector));return t.concat(s)},e.prototype.elementMatched=function(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)},e.prototype.elementUnmatched=function(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)},e.prototype.elementAttributeChanged=function(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)},e}(),p=function(){function e(e,t){var s=this;this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((function(e){return s.processMutations(e)}))}return e.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0}),this.refresh())},e.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},e.prototype.refresh=function(){if(this.started)for(var e=0,t=this.knownAttributeNames;e<t.length;e++){var s=t[e];this.refreshAttribute(s)}},e.prototype.processMutations=function(e){if(this.started)for(var t=0,s=e;t<s.length;t++){var i=s[t];this.processMutation(i)}},e.prototype.processMutation=function(e){var t=e.attributeName;t&&this.refreshAttribute(t)},e.prototype.refreshAttribute=function(e){var t=this.delegate.getStringMapKeyForAttribute(e);if(null!=t){this.stringMap.has(e)||this.stringMapKeyAdded(t,e);var s=this.element.getAttribute(e);this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,t),null==s?(this.stringMap.delete(e),this.stringMapKeyRemoved(t,e)):this.stringMap.set(e,s)}},e.prototype.stringMapKeyAdded=function(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)},e.prototype.stringMapValueChanged=function(e,t){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t)},e.prototype.stringMapKeyRemoved=function(e,t){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t)},Object.defineProperty(e.prototype,"knownAttributeNames",{get:function(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentAttributeNames",{get:function(){return Array.from(this.element.attributes).map((function(e){return e.name}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"recordedAttributeNames",{get:function(){return Array.from(this.stringMap.keys())},enumerable:!1,configurable:!0}),e}();function m(e,t,s){g(e,t).add(s)}function f(e,t,s){g(e,t).delete(s),function(e,t){var s=e.get(t);null!=s&&0==s.size&&e.delete(t)}(e,t)}function g(e,t){var s=e.get(t);return s||(s=new Set,e.set(t,s)),s}var b,v=function(){function e(){this.valuesByKey=new Map}return Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.valuesByKey.values()).reduce((function(e,t){return e.concat(Array.from(t))}),[])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return Array.from(this.valuesByKey.values()).reduce((function(e,t){return e+t.size}),0)},enumerable:!1,configurable:!0}),e.prototype.add=function(e,t){m(this.valuesByKey,e,t)},e.prototype.delete=function(e,t){f(this.valuesByKey,e,t)},e.prototype.has=function(e,t){var s=this.valuesByKey.get(e);return null!=s&&s.has(t)},e.prototype.hasKey=function(e){return this.valuesByKey.has(e)},e.prototype.hasValue=function(e){return Array.from(this.valuesByKey.values()).some((function(t){return t.has(e)}))},e.prototype.getValuesForKey=function(e){var t=this.valuesByKey.get(e);return t?Array.from(t):[]},e.prototype.getKeysForValue=function(e){return Array.from(this.valuesByKey).filter((function(t){return t[0],t[1].has(e)})).map((function(e){var t=e[0];return e[1],t}))},e}(),_=(b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(e,t)},function(e,t){function s(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)});!function(e){function t(){var t=e.call(this)||this;return t.keysByValue=new Map,t}_(t,e),Object.defineProperty(t.prototype,"values",{get:function(){return Array.from(this.keysByValue.keys())},enumerable:!1,configurable:!0}),t.prototype.add=function(t,s){e.prototype.add.call(this,t,s),m(this.keysByValue,s,t)},t.prototype.delete=function(t,s){e.prototype.delete.call(this,t,s),f(this.keysByValue,s,t)},t.prototype.hasValue=function(e){return this.keysByValue.has(e)},t.prototype.getKeysForValue=function(e){var t=this.keysByValue.get(e);return t?Array.from(t):[]}}(v);var y=function(){function e(e,t,s){this.attributeObserver=new d(e,t,this),this.delegate=s,this.tokensByElement=new v}return Object.defineProperty(e.prototype,"started",{get:function(){return this.attributeObserver.started},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.attributeObserver.start()},e.prototype.stop=function(){this.attributeObserver.stop()},e.prototype.refresh=function(){this.attributeObserver.refresh()},Object.defineProperty(e.prototype,"element",{get:function(){return this.attributeObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this.attributeObserver.attributeName},enumerable:!1,configurable:!0}),e.prototype.elementMatchedAttribute=function(e){this.tokensMatched(this.readTokensForElement(e))},e.prototype.elementAttributeValueChanged=function(e){var t=this.refreshTokensForElement(e),s=t[0],i=t[1];this.tokensUnmatched(s),this.tokensMatched(i)},e.prototype.elementUnmatchedAttribute=function(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))},e.prototype.tokensMatched=function(e){var t=this;e.forEach((function(e){return t.tokenMatched(e)}))},e.prototype.tokensUnmatched=function(e){var t=this;e.forEach((function(e){return t.tokenUnmatched(e)}))},e.prototype.tokenMatched=function(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)},e.prototype.tokenUnmatched=function(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)},e.prototype.refreshTokensForElement=function(e){var t,s,i,r=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),o=(t=r,s=n,i=Math.max(t.length,s.length),Array.from({length:i},(function(e,i){return[t[i],s[i]]}))).findIndex((function(e){return!function(e,t){return e&&t&&e.index==t.index&&e.content==t.content}(e[0],e[1])}));return-1==o?[[],[]]:[r.slice(o),n.slice(o)]},e.prototype.readTokensForElement=function(e){var t=this.attributeName;return function(e,t,s){return e.trim().split(/\s+/).filter((function(e){return e.length})).map((function(e,i){return{element:t,attributeName:s,content:e,index:i}}))}(e.getAttribute(t)||"",e,t)},e}();var w=function(){function e(e,t,s){this.tokenListObserver=new y(e,t,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}return Object.defineProperty(e.prototype,"started",{get:function(){return this.tokenListObserver.started},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.tokenListObserver.start()},e.prototype.stop=function(){this.tokenListObserver.stop()},e.prototype.refresh=function(){this.tokenListObserver.refresh()},Object.defineProperty(e.prototype,"element",{get:function(){return this.tokenListObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attributeName",{get:function(){return this.tokenListObserver.attributeName},enumerable:!1,configurable:!0}),e.prototype.tokenMatched=function(e){var t=e.element,s=this.fetchParseResultForToken(e).value;s&&(this.fetchValuesByTokenForElement(t).set(e,s),this.delegate.elementMatchedValue(t,s))},e.prototype.tokenUnmatched=function(e){var t=e.element,s=this.fetchParseResultForToken(e).value;s&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,s))},e.prototype.fetchParseResultForToken=function(e){var t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t},e.prototype.fetchValuesByTokenForElement=function(e){var t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t},e.prototype.parseToken=function(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}},e}(),C=function(){function e(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}return e.prototype.start=function(){this.valueListObserver||(this.valueListObserver=new w(this.element,this.actionAttribute,this),this.valueListObserver.start())},e.prototype.stop=function(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())},Object.defineProperty(e.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actionAttribute",{get:function(){return this.schema.actionAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.context.schema},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bindings",{get:function(){return Array.from(this.bindingsByAction.values())},enumerable:!1,configurable:!0}),e.prototype.connectAction=function(e){var t=new u(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)},e.prototype.disconnectAction=function(e){var t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))},e.prototype.disconnectAllActions=function(){var e=this;this.bindings.forEach((function(t){return e.delegate.bindingDisconnected(t)})),this.bindingsByAction.clear()},e.prototype.parseValueForToken=function(e){var t=a.forToken(e);if(t.identifier==this.identifier)return t},e.prototype.elementMatchedValue=function(e,t){this.connectAction(t)},e.prototype.elementUnmatchedValue=function(e,t){this.disconnectAction(t)},e}(),E=function(){function e(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new p(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap,this.invokeChangedCallbacksForDefaultValues()}return e.prototype.start=function(){this.stringMapObserver.start()},e.prototype.stop=function(){this.stringMapObserver.stop()},Object.defineProperty(e.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),e.prototype.getStringMapKeyForAttribute=function(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name},e.prototype.stringMapValueChanged=function(e,t){this.invokeChangedCallbackForValue(t)},e.prototype.invokeChangedCallbacksForDefaultValues=function(){for(var e=0,t=this.valueDescriptors;e<t.length;e++){var s=t[e],i=s.key,r=s.name;null==s.defaultValue||this.controller.data.has(i)||this.invokeChangedCallbackForValue(r)}},e.prototype.invokeChangedCallbackForValue=function(e){var t=e+"Changed",s=this.receiver[t];if("function"==typeof s){var i=this.receiver[e];s.call(this.receiver,i)}},Object.defineProperty(e.prototype,"valueDescriptors",{get:function(){var e=this.valueDescriptorMap;return Object.keys(e).map((function(t){return e[t]}))},enumerable:!1,configurable:!0}),e}(),T=function(){function e(e,t){this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new C(this,this.dispatcher),this.valueObserver=new E(this,this.controller);try{this.controller.initialize()}catch(s){this.handleError(s,"initializing controller")}}return e.prototype.connect=function(){this.bindingObserver.start(),this.valueObserver.start();try{this.controller.connect()}catch(e){this.handleError(e,"connecting controller")}},e.prototype.disconnect=function(){try{this.controller.disconnect()}catch(e){this.handleError(e,"disconnecting controller")}this.valueObserver.stop(),this.bindingObserver.stop()},Object.defineProperty(e.prototype,"application",{get:function(){return this.module.application},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.module.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dispatcher",{get:function(){return this.application.dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return this.element.parentElement},enumerable:!1,configurable:!0}),e.prototype.handleError=function(e,t,s){void 0===s&&(s={});var i=this,r=i.identifier,n=i.controller,o=i.element;s=Object.assign({identifier:r,controller:n,element:o},s),this.application.handleError(e,"Error "+t,s)},e}();function k(e,t){var s=V(e);return Array.from(s.reduce((function(e,s){return function(e,t){var s=e[t];return Array.isArray(s)?s:[]}(s,t).forEach((function(t){return e.add(t)})),e}),new Set))}function S(e,t){return V(e).reduce((function(e,s){return e.push.apply(e,function(e,t){var s=e[t];return s?Object.keys(s).map((function(e){return[e,s[e]]})):[]}(s,t)),e}),[])}function V(e){for(var t=[];e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}var A=function(){var e=function(t,s){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(t,s)};return function(t,s){function i(){this.constructor=t}e(t,s),t.prototype=null===s?Object.create(s):(i.prototype=s.prototype,new i)}}();function x(e){return function(e,t){var s=M(e),i=function(e,t){return O(t).reduce((function(s,i){var r,n=function(e,t,s){var i=Object.getOwnPropertyDescriptor(e,s);if(!i||!("value"in i)){var r=Object.getOwnPropertyDescriptor(t,s).value;return i&&(r.get=i.get||r.get,r.set=i.set||r.set),r}}(e,t,i);return n&&Object.assign(s,((r={})[i]=n,r)),s}),{})}(e.prototype,t);return Object.defineProperties(s.prototype,i),s}(e,function(e){return k(e,"blessings").reduce((function(t,s){var i=s(e);for(var r in i){var n=t[r]||{};t[r]=Object.assign(n,i[r])}return t}),{})}(e))}var O="function"==typeof Object.getOwnPropertySymbols?function(e){return function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)i[r]=n[o];return i}(Object.getOwnPropertyNames(e),Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,M=function(){function e(e){function t(){var s=this&&this instanceof t?this.constructor:void 0;return Reflect.construct(e,arguments,s)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return(t=e((function(){this.a.call(this)}))).prototype.a=function(){},new t,e}catch(s){return function(e){return function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t}(e)}}var t}();var L=function(){function e(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:x(e.controllerConstructor)}}(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}return Object.defineProperty(e.prototype,"identifier",{get:function(){return this.definition.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerConstructor",{get:function(){return this.definition.controllerConstructor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contexts",{get:function(){return Array.from(this.connectedContexts)},enumerable:!1,configurable:!0}),e.prototype.connectContextForScope=function(e){var t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()},e.prototype.disconnectContextForScope=function(e){var t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())},e.prototype.fetchContextForScope=function(e){var t=this.contextsByScope.get(e);return t||(t=new T(this,e),this.contextsByScope.set(e,t)),t},e}(),F=function(){function e(e){this.scope=e}return e.prototype.has=function(e){return this.data.has(this.getDataKey(e))},e.prototype.get=function(e){return this.data.get(this.getDataKey(e))},e.prototype.getAttributeName=function(e){return this.data.getAttributeNameForKey(this.getDataKey(e))},e.prototype.getDataKey=function(e){return e+"-class"},Object.defineProperty(e.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),e}();function N(e){return e.replace(/(?:[_-])([a-z0-9])/g,(function(e,t){return t.toUpperCase()}))}function D(e){return e.charAt(0).toUpperCase()+e.slice(1)}function I(e){return e.replace(/([A-Z])/g,(function(e,t){return"-"+t.toLowerCase()}))}var P=function(){function e(e){this.scope=e}return Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),e.prototype.get=function(e){var t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)},e.prototype.set=function(e,t){var s=this.getAttributeNameForKey(e);return this.element.setAttribute(s,t),this.get(e)},e.prototype.has=function(e){var t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)},e.prototype.delete=function(e){if(this.has(e)){var t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1},e.prototype.getAttributeNameForKey=function(e){return"data-"+this.identifier+"-"+I(e)},e}(),B=function(){function e(e){this.warnedKeysByObject=new WeakMap,this.logger=e}return e.prototype.warn=function(e,t,s){var i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(s,e))},e}();function j(e,t){return"["+e+'~="'+t+'"]'}var H=function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)i[r]=n[o];return i},R=function(){function e(e){this.scope=e}return Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.scope.schema},enumerable:!1,configurable:!0}),e.prototype.has=function(e){return null!=this.find(e)},e.prototype.find=function(){for(var e=this,t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return t.reduce((function(t,s){return t||e.findTarget(s)||e.findLegacyTarget(s)}),void 0)},e.prototype.findAll=function(){for(var e=this,t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return t.reduce((function(t,s){return H(t,e.findAllTargets(s),e.findAllLegacyTargets(s))}),[])},e.prototype.findTarget=function(e){var t=this.getSelectorForTargetName(e);return this.scope.findElement(t)},e.prototype.findAllTargets=function(e){var t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)},e.prototype.getSelectorForTargetName=function(e){return j("data-"+this.identifier+"-target",e)},e.prototype.findLegacyTarget=function(e){var t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)},e.prototype.findAllLegacyTargets=function(e){var t=this,s=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(s).map((function(s){return t.deprecate(s,e)}))},e.prototype.getLegacySelectorForTargetName=function(e){var t=this.identifier+"."+e;return j(this.schema.targetAttribute,t)},e.prototype.deprecate=function(e,t){if(e){var s=this.identifier,i=this.schema.targetAttribute;this.guide.warn(e,"target:"+t,"Please replace "+i+'="'+s+"."+t+'" with data-'+s+'-target="'+t+'". The '+i+" attribute is deprecated and will be removed in a future version of Stimulus.")}return e},Object.defineProperty(e.prototype,"guide",{get:function(){return this.scope.guide},enumerable:!1,configurable:!0}),e}(),q=function(){function e(e,t,s,i){var r=this;this.targets=new R(this),this.classes=new F(this),this.data=new P(this),this.containsElement=function(e){return e.closest(r.controllerSelector)===r.element},this.schema=e,this.element=t,this.identifier=s,this.guide=new B(i)}return e.prototype.findElement=function(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)},e.prototype.findAllElements=function(e){return function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)i[r]=n[o];return i}(this.element.matches(e)?[this.element]:[],this.queryElements(e).filter(this.containsElement))},e.prototype.queryElements=function(e){return Array.from(this.element.querySelectorAll(e))},Object.defineProperty(e.prototype,"controllerSelector",{get:function(){return j(this.schema.controllerAttribute,this.identifier)},enumerable:!1,configurable:!0}),e}(),$=function(){function e(e,t,s){this.element=e,this.schema=t,this.delegate=s,this.valueListObserver=new w(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}return e.prototype.start=function(){this.valueListObserver.start()},e.prototype.stop=function(){this.valueListObserver.stop()},Object.defineProperty(e.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),e.prototype.parseValueForToken=function(e){var t=e.element,s=e.content,i=this.fetchScopesByIdentifierForElement(t),r=i.get(s);return r||(r=this.delegate.createScopeForElementAndIdentifier(t,s),i.set(s,r)),r},e.prototype.elementMatchedValue=function(e,t){var s=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,s),1==s&&this.delegate.scopeConnected(t)},e.prototype.elementUnmatchedValue=function(e,t){var s=this.scopeReferenceCounts.get(t);s&&(this.scopeReferenceCounts.set(t,s-1),1==s&&this.delegate.scopeDisconnected(t))},e.prototype.fetchScopesByIdentifierForElement=function(e){var t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t},e}(),U=function(){function e(e){this.application=e,this.scopeObserver=new $(this.element,this.schema,this),this.scopesByIdentifier=new v,this.modulesByIdentifier=new Map}return Object.defineProperty(e.prototype,"element",{get:function(){return this.application.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"logger",{get:function(){return this.application.logger},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"modules",{get:function(){return Array.from(this.modulesByIdentifier.values())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contexts",{get:function(){return this.modules.reduce((function(e,t){return e.concat(t.contexts)}),[])},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.scopeObserver.start()},e.prototype.stop=function(){this.scopeObserver.stop()},e.prototype.loadDefinition=function(e){this.unloadIdentifier(e.identifier);var t=new L(this.application,e);this.connectModule(t)},e.prototype.unloadIdentifier=function(e){var t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)},e.prototype.getContextForElementAndIdentifier=function(e,t){var s=this.modulesByIdentifier.get(t);if(s)return s.contexts.find((function(t){return t.element==e}))},e.prototype.handleError=function(e,t,s){this.application.handleError(e,t,s)},e.prototype.createScopeForElementAndIdentifier=function(e,t){return new q(this.schema,e,t,this.logger)},e.prototype.scopeConnected=function(e){this.scopesByIdentifier.add(e.identifier,e);var t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)},e.prototype.scopeDisconnected=function(e){this.scopesByIdentifier.delete(e.identifier,e);var t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)},e.prototype.connectModule=function(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((function(t){return e.connectContextForScope(t)}))},e.prototype.disconnectModule=function(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((function(t){return e.disconnectContextForScope(t)}))},e}(),W={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"},z=function(e,t,s,i){return new(s||(s=Promise))((function(r,n){function o(e){try{l(i.next(e))}catch(t){n(t)}}function a(e){try{l(i.throw(e))}catch(t){n(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},K=function(e,t){var s,i,r,n,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(s)throw new TypeError("Generator is already executing.");for(;o;)try{if(s=1,i&&(r=2&n[0]?i.return:n[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,n[1])).done)return r;switch(i=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,i=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){o.label=n[1];break}if(6===n[0]&&o.label<r[1]){o.label=r[1],r=n;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(n);break}r[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(a){n=[6,a],i=0}finally{s=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}},J=function(){for(var e=0,t=0,s=arguments.length;t<s;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<s;t++)for(var n=arguments[t],o=0,a=n.length;o<a;o++,r++)i[r]=n[o];return i};function Y(e){return k(e,"classes").reduce((function(e,t){return Object.assign(e,((i={})[r=(s=t)+"Class"]={get:function(){var e=this.classes;if(e.has(s))return e.get(s);var t=e.getAttributeName(s);throw new Error('Missing attribute "'+t+'"')}},i["has"+D(r)]={get:function(){return this.classes.has(s)}},i));var s,i,r}),{})}function Z(e){return k(e,"targets").reduce((function(e,t){return Object.assign(e,((i={})[(s=t)+"Target"]={get:function(){var e=this.targets.find(s);if(e)return e;throw new Error('Missing target element "'+this.identifier+"."+s+'"')}},i[s+"Targets"]={get:function(){return this.targets.findAll(s)}},i["has"+D(s)+"Target"]={get:function(){return this.targets.has(s)}},i));var s,i}),{})}function X(e){var t=S(e,"values"),s={valueDescriptorMap:{get:function(){var e=this;return t.reduce((function(t,s){var i,r=G(s),n=e.data.getAttributeNameForKey(r.key);return Object.assign(t,((i={})[n]=r,i))}),{})}}};return t.reduce((function(e,t){return Object.assign(e,function(e){var t,s=G(e),i=s.type,r=s.key,n=s.name,o=ee[i],a=te[i]||te.default;return(t={})[n]={get:function(){var e=this.data.get(r);return null!==e?o(e):s.defaultValue},set:function(e){void 0===e?this.data.delete(r):this.data.set(r,a(e))}},t["has"+D(n)]={get:function(){return this.data.has(r)}},t}(t))}),s)}function G(e){return function(e,t){var s=I(e)+"-value";return{type:t,key:s,name:N(s),get defaultValue(){return Q[t]}}}(e[0],function(e){switch(e){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 "'+e+'"')}(e[1]))}!function(){function e(e,t){void 0===e&&(e=document.documentElement),void 0===t&&(t=W),this.logger=console,this.element=e,this.schema=t,this.dispatcher=new r(this),this.router=new U(this)}e.start=function(t,s){var i=new e(t,s);return i.start(),i},e.prototype.start=function(){return z(this,void 0,void 0,(function(){return K(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){"loading"==document.readyState?document.addEventListener("DOMContentLoaded",e):e()}))];case 1:return e.sent(),this.dispatcher.start(),this.router.start(),[2]}}))}))},e.prototype.stop=function(){this.dispatcher.stop(),this.router.stop()},e.prototype.register=function(e,t){this.load({identifier:e,controllerConstructor:t})},e.prototype.load=function(e){for(var t=this,s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];var r=Array.isArray(e)?e:J([e],s);r.forEach((function(e){return t.router.loadDefinition(e)}))},e.prototype.unload=function(e){for(var t=this,s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];var r=Array.isArray(e)?e:J([e],s);r.forEach((function(e){return t.router.unloadIdentifier(e)}))},Object.defineProperty(e.prototype,"controllers",{get:function(){return this.router.contexts.map((function(e){return e.controller}))},enumerable:!1,configurable:!0}),e.prototype.getControllerForElementAndIdentifier=function(e,t){var s=this.router.getContextForElementAndIdentifier(e,t);return s?s.controller:null},e.prototype.handleError=function(e,t,s){this.logger.error("%s\n\n%o\n\n%o",t,e,s)}}();var Q={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},ee={array:function(e){var t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean:function(e){return!("0"==e||"false"==e)},number:function(e){return parseFloat(e)},object:function(e){var t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError("Expected object");return t},string:function(e){return e}},te={default:function(e){return""+e},array:se,object:se};function se(e){return JSON.stringify(e)}var ie=function(){function e(e){this.context=e}return Object.defineProperty(e.prototype,"application",{get:function(){return this.context.application},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targets",{get:function(){return this.scope.targets},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classes",{get:function(){return this.scope.classes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){},e.prototype.connect=function(){},e.prototype.disconnect=function(){},e.blessings=[Y,Z,X],e.targets=[],e.values={},e}();class re extends ie{constructor(e){return super(e),this.application.debug?new Proxy(this,{get:(e,t)=>{let s=Reflect.get(e,t),i=this;if(function(e){switch(e){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}if(/^_.*?$/.test(e))return!1;if(/^.*?Target(s)?$/.test(e))return!1;if(/^.*?Value$/.test(e))return!1;if(/^.*?ValueChanged$/.test(e))return!1;if(/^.*?Class$/.test(e))return!1;if(/^.*?Classes$/.test(e))return!1;return!0}(t.toString())){if("function"==typeof s)return new Proxy(s,{apply:(e,s,r)=>(i.log(t.toString(),{args:r}),Reflect.apply(e,s,r))});this.log(t.toString())}return s}}):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 t=document.head.querySelector(`meta[name="${e}"]`);return(null==t?void 0:t.getAttribute("content"))||null}dispatch(e,t,s={}){let i=Object.assign({},{bubbles:!0,cancelable:!0,detail:{target:e}},s);i.detail.target&&(i.detail.target=e);let r=new CustomEvent(t,i);this.logEvent(t,r,e),e.dispatchEvent(r)}log(e,t={}){if(!this.application.debug)return;let s=console;s.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: #3B82F6","color: unset"),s.log(__spreadValues({element:this.element,controller:this},t)),s.groupEnd()}warn(e,t={}){if(!this.application.debug)return;let s=console;s.groupCollapsed(`%c${this.identifier} %c#${e}`,"color: F39B1AFF","color: unset"),s.warn(__spreadValues({element:this.element,controller:this},t)),s.groupEnd()}logEvent(e,t,s){if(!this.application.debug)return;let i=console;i.groupCollapsed(`%c${this.identifier} %c${e}%c`,"color: #3B82F6","color: #0be000","color: unset"),i.log({element:s}),i.groupEnd()}}var ne={exports:{}};const oe=(e,t)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t=__spreadValues({pascalCase:!1,preserveConsecutiveUppercase:!1},t),0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";if(1===e.length)return t.pascalCase?e.toLocaleUpperCase(t.locale):e.toLocaleLowerCase(t.locale);return e!==e.toLocaleLowerCase(t.locale)&&(e=((e,t)=>{let s=!1,i=!1,r=!1;for(let n=0;n<e.length;n++){const o=e[n];s&&/[\p{Lu}]/u.test(o)?(e=e.slice(0,n)+"-"+e.slice(n),s=!1,r=i,i=!0,n++):i&&r&&/[\p{Ll}]/u.test(o)?(e=e.slice(0,n-1)+"-"+e.slice(n-1),r=i,i=!1,s=!0):(s=o.toLocaleLowerCase(t)===o&&o.toLocaleUpperCase(t)!==o,r=i,i=o.toLocaleUpperCase(t)===o&&o.toLocaleLowerCase(t)!==o)}return e})(e,t.locale)),e=e.replace(/^[_.\- ]+/,""),e=t.preserveConsecutiveUppercase?(e=>e.replace(/^[\p{Lu}](?![\p{Lu}])/gu,(e=>e.toLowerCase())))(e):e.toLocaleLowerCase(),t.pascalCase&&(e=e.charAt(0).toLocaleUpperCase(t.locale)+e.slice(1)),((e,t)=>e.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,((e,s)=>s.toLocaleUpperCase(t.locale))).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,(e=>e.toLocaleUpperCase(t.locale))))(e,t)};ne.exports=oe,ne.exports.default=oe;var ae=ne.exports;class le extends re{_cleanupSelf(){this.cleanup(this.el)}cleanup(e){var t,s,i;e.dataset.controller=(null==(t=e.dataset.controller)?void 0:t.replaceAll(new RegExp(`(s|^)${this.identifier}(s|$)`,"g"),""))||"",""==e.dataset.controller&&delete e.dataset.controller;let r=new RegExp(`(s|^)${this.identifier}\\..+?(s|$)`,"g");e.dataset.target=(null==(s=e.dataset.target)?void 0:s.replaceAll(r,""))||"",delete e.dataset[ae(`${this.identifier}-target`)],""==e.dataset.target&&delete e.dataset.target,e.dataset.action=(null==(i=e.dataset.target)?void 0:i.replaceAll(r,""))||"",delete e.dataset[ae(`${this.identifier}-action`)],""==e.dataset.action&&delete e.dataset.action;let n=this.constructor.values;n&&Object.keys(n).forEach((t=>delete e.dataset[ae(`${this.identifier}-${t}-value`)]));let o=this.constructor.classes;o&&Object.keys(o).forEach((t=>delete e.dataset[ae(`${this.identifier}-${t}-class`)]))}}const ce="scrollBehavior"in document.documentElement.style;let ue;async function he(e,{behavior:t="smooth",block:s="start",inline:i="nearest"}={}){"smooth"!=t||ce||await _e(),e.scrollIntoView({behavior:t,block:s,inline:i})}async function de(e,{behavior:t="smooth"}={}){"smooth"!=t||ce||await _e(),e.scrollTo({top:0,left:0,behavior:t})}async function pe(e,{behavior:t="smooth"}={}){"smooth"!=t||ce||await _e(),e==window?e.scrollTo({top:document.body.scrollHeight,left:0,behavior:t}):e.scrollTo({top:e.scrollHeight,left:0,behavior:t})}async function me(e,{behavior:t="smooth"}={}){"smooth"!=t||ce||await _e(),e.scrollTo({left:0,behavior:t})}async function fe(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ce||await _e(),e.scrollBy({top:-t,left:0,behavior:s})}async function ge(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ce||await _e(),e.scrollBy({top:t,left:0,behavior:s})}async function be(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ce||await _e(),e.scrollBy({top:0,left:-t,behavior:s})}async function ve(e,t,{behavior:s="smooth"}={}){"smooth"!=s||ce||await _e(),e.scrollBy({top:0,left:t,behavior:s})}async function _e(){const{polyfill:e}=await import("smoothscroll-polyfill");ue||(ue=!0,e())}function ye(e){if(!e)return null;if(e==document.body)return window;const t=getComputedStyle(e).overflowY;return"visible"!==t&&"hidden"!==t&&e.scrollHeight>=e.clientHeight?e:ye(e.parentElement)||document.body}function we(e){return"TURBO-FRAME"==e.nodeName}const Ce={all:Ee=Ee||new Map,on:function(e,t){var s=Ee.get(e);s?s.push(t):Ee.set(e,[t])},off:function(e,t){var s=Ee.get(e);s&&(t?s.splice(s.indexOf(t)>>>0,1):Ee.set(e,[]))},emit:function(e,t){var s=Ee.get(e);s&&s.slice().map((function(e){e(t)})),(s=Ee.get("*"))&&s.slice().map((function(s){s(e,t)}))}};var Ee;function Te(e){return"A"==e.nodeName}function ke(e){return"FORM"==e.nodeName}function Se(e){return"INPUT"==e.nodeName}function Ve(e){return"TEXTAREA"==e.nodeName}function Ae(e){return"BUTTON"==e.nodeName}function xe(e){return"SELECT"==e.nodeName}function Oe(e){return Se(e)&&("radio"===e.type||"checkbox"===e.type)}function Me(e){let t=document.createElement("button");return t.type=e,t.style.display="none",t.dataset.sythentic="true",t}function Le(e,t,s){let i=e.insertAdjacentElement(t,s);if(!i)throw new Error(`Failed to insert element ${s.nodeName} into ${e.nodeName}`);return i}function Fe(e,t,s){return Le(t,s,Me(e))}function Ne(e){if(e.requestSubmit)e.requestSubmit();else{let t=e.querySelector('button[type="submit"]');t||(t=Fe("submit",e,"beforeend")),t.click()}}function De(e){let t=e.querySelector('button[type="reset"]');t||(t=Fe("reset",e,"beforeend")),t.click()}function Ie(e,t,s,i,r){return Pe(e,t,[s],i,r)}function Pe(e,s,i,r,n){const o=e.disconnect.bind(e);let a=n;(null==a?void 0:a.debounce)?(r=t.debounce(r.bind(e),a.debounce),delete a.debounce):r=r.bind(e);let l=()=>i.forEach((e=>s.addEventListener(e,r,a))),c=()=>i.forEach((e=>s.removeEventListener(e,r)));return l(),Object.assign(e,{disconnect(){c(),o()}}),[l,c]}function Be(e,t,s){const i=e.disconnect.bind(e);t=t.bind(e);let r=null,n=()=>{null!==r&&clearInterval(r)};return r=setInterval(t,s),Object.assign(e,{disconnect(){n(),i()}}),n}function je(e,t,s){const i=e.disconnect.bind(e);t=t.bind(e);let r=null,n=()=>{null!==r&&clearTimeout(r)};return r=setTimeout(t,s),Object.assign(e,{disconnect(){n(),i()}}),n}function He(e,t,s,i,r={}){const n=e.disconnect.bind(e);let o,a=Array.from(i.childNodes);return o=r.cleanup?()=>{console.log("teardown"),a.forEach((e=>e.remove()))}:()=>console.log("void teardown"),(()=>{let e=t.parentElement;if(["beforebegin","afterend"].includes(s)&&null==e)throw new Error("Cannot insert beforebegin into a node with no parent");switch(s){case"beforeend":t.append(i);break;case"afterbegin":t.prepend(i);break;case"beforebegin":case"afterend":e.insertBefore(i,t)}})(),Object.assign(e,{disconnect(){o(),n()}}),[a,o]}function Re(e,t,s,i,r={}){const n=new DocumentFragment;n.append(i);let[o,a]=He(e,t,s,n,r);return[o[0],a]}class qe extends re{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(),Ie(this,window,"hashchange",this._checkAnchor)}))}write(e){null==e||e.preventDefault(),this._anchor=this._key}_checkAnchor(){this._key===this._anchor?this.dispatch(this.el,"anchor-spy:active"):this.dispatch(this.el,"anchor-spy:inactive")}}__publicField(qe,"values",{key:String});class $e extends re{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}connect(){}async loadContent(e=null){null==e||e.preventDefault();let t=this,s=this.hasReplaceTarget?this.replaceTarget:this.el,i=()=>{s.replaceWith(this._errorMessage),t.dispatch(s,"ajax:error")};try{let e=await fetch(this.endpointValue);e.ok||i();let r=await e.text(),n=document.createElement("div");if(n.innerHTML=r,this.hasSelectorValue){let e=n.querySelectorAll(this.selectorValue);s.replaceWith(...e)}else s.replaceWith(...n.children);t.dispatch(s,"ajax:success")}catch(r){i()}finally{t.dispatch(s,"ajax:complete")}}}__publicField($e,"targets",["replace"]),__publicField($e,"values",{endpoint:String,errorMessage:String,selector:String});class Ue extends $e{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}__publicField(Ue,"targets",["replace"]),__publicField(Ue,"values",{endpoint:String,errorMessage:String,selector:String});class We extends re{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}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}return"request"}get _cssSelector(){return["input","textarea","select"].map((e=>e.concat(":not([data-no-autosubmit])"))).join(",")}get inputElements(){return this.element.querySelectorAll(this._cssSelector)}connect(){this.inputElements.forEach((e=>Ie(this,e,"change"==this._eventMode?"change":"input",this.submit,{debounce:"debounced"==this._eventMode?this._debounceTimeout:void 0})))}submit(){let e=this.el;"request"==this._mode?Ne(e):e.submit()}}__publicField(We,"values",{submitMode:String,eventMode:String,debounceInterval:Number});const ze=(e,t)=>{const s=e[t];return"function"==typeof s?s:(...e)=>{}},Ke=(e,t,s)=>{let i=e;return!0===s?i=`${t.identifier}:${e}`:"string"==typeof s&&(i=`${s}:${e}`),i},Je=(e,t,s)=>{const{bubbles:i,cancelable:r,composed:n}=t||{bubbles:!0,cancelable:!0,composed:!0};t&&Object.assign(s,{originalEvent:t});return new CustomEvent(e,{bubbles:i,cancelable:r,composed:n,detail:s})};const Ye={dispatchEvent:!0,eventPrefix:!0},Ze=(e,t={})=>{const{dispatchEvent:s,eventPrefix:i}=Object.assign({},Ye,t),r=(null==t?void 0:t.element)||e.element,n=t=>{if(e.isVisible=!0,ze(e,"appear").call(e,t),s){const s=Ke("appear",e,i),n=Je(s,null,{controller:e,entry:t});r.dispatchEvent(n)}},o=t=>{if(e.isVisible=!1,ze(e,"disappear").call(e,t),s){const s=Ke("disappear",e,i),n=Je(s,null,{controller:e,entry:t});r.dispatchEvent(n)}},a=e.disconnect.bind(e),l=new IntersectionObserver((t=>{const[s]=t;s.isIntersecting?n(s):e.isVisible&&o(s)}),t),c=()=>{l.observe(r)},u=()=>{l.unobserve(r)};return Object.assign(e,{isVisible:!1,disconnect(){u(),a()}}),c(),[c,u]},Xe={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},Ge=(e,t={})=>{const{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:n}=Object.assign({},Xe,t),o=r=>{const o=(null==t?void 0:t.element)||e.element;if(!(o.contains(r.target)||!function(e){const t=e.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,r=t.top<=s&&t.top+t.height>=0,n=t.left<=i&&t.left+t.width>=0;return r&&n}(o)&&s)&&(e.clickOutside&&e.clickOutside(r),i)){const t=Ke("click:outside",e,n),s=Je(t,r,{controller:e});o.dispatchEvent(s)}},a=()=>{null==r||r.forEach((e=>{window.addEventListener(e,o,!1)}))},l=()=>{null==r||r.forEach((e=>{window.removeEventListener(e,o,!1)}))},c=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),c()}}),a(),[a,l]},Qe={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class et{constructor(e,t={}){var s,i,r;this.log=(e,t)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset"),this.logger.log(__spreadValues({controllerId:this.controllerId},t)),this.logger.groupEnd())},this.dispatch=(e,t={})=>{if(this.dispatchEvent){const s=t,{event:i}=s,r=__objRest(s,["event"]),n=this.extendedEvent(e,i||null,r);this.targetElement.dispatchEvent(n),this.log("dispatchEvent",__spreadValues({eventName:n.type},r))}},this.call=(e,t={})=>{const s=this.controller[e];if("function"==typeof s)return s.call(this.controller,t)},this.extendedEvent=(e,t,s)=>{const{bubbles:i,cancelable:r,composed:n}=t||{bubbles:!0,cancelable:!0,composed:!0};t&&Object.assign(s,{originalEvent:t});return new CustomEvent(this.composeEventName(e),{bubbles:i,cancelable:r,composed:n,detail:s})},this.composeEventName=e=>{let t=e;return!0===this.eventPrefix?t=`${this.controller.identifier}:${e}`:"string"==typeof this.eventPrefix&&(t=`${this.eventPrefix}:${e}`),t},this.debug=null!==(i=null!==(s=null==t?void 0:t.debug)&&void 0!==s?s:e.application.stimulusUseDebug)&&void 0!==i?i:Qe.debug,this.logger=null!==(r=null==t?void 0:t.logger)&&void 0!==r?r:Qe.logger,this.controller=e,this.controllerId=e.element.id||e.element.dataset.id,this.targetElement=(null==t?void 0:t.element)||e.element;const{dispatchEvent:n,eventPrefix:o}=Object.assign({},Qe,t);Object.assign(this,{dispatchEvent:n,eventPrefix:o}),this.controllerInitialize=e.initialize.bind(e),this.controllerConnect=e.connect.bind(e),this.controllerDisconnect=e.disconnect.bind(e)}}class tt extends et{constructor(e,t={}){super(e,t),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=e=>{this.call("mouseEnter",e),this.log("mouseEnter",{hover:!0}),this.dispatch("mouseEnter",{hover:!1})},this.onLeave=e=>{this.call("mouseLeave",e),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);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}class st extends et{constructor(e,t={}){super(e,t),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=e=>{this.call("mutate",e),this.log("mutate",{entries:e}),this.dispatch("mutate",{entries:e})},this.targetElement=(null==t?void 0:t.element)||e.element,this.controller=e,this.options=t,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);Object.assign(this.controller,{disconnect:()=>{this.unobserve(),e()}})}}const it=(e,t={})=>{const s=new st(e,t);return[s.observe,s.unobserve]},rt=e=>{const t=t=>{const{innerWidth:s,innerHeight:i}=window,r={height:i||1/0,width:s||1/0,event:t};ze(e,"windowResize").call(e,r)},s=e.disconnect.bind(e),i=()=>{window.addEventListener("resize",t),t()},r=()=>{window.removeEventListener("resize",t)};return Object.assign(e,{disconnect(){r(),s()}}),i(),[i,r]};(class extends ie{}).debounces=[];const nt=(e,t=200)=>{let s=null;return function(){const i=arguments,r=this,n=()=>e.apply(r,i);s&&clearTimeout(s),s=setTimeout(n,t)}};class ot extends re{get _pages(){return this.hasPagesValue?Math.abs(this.pagesValue):1}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1500}connect(){Ie(this,this.el,"click",this.goBack)}goBack(e){null==e||e.preventDefault(),history.go(-this._pages),this.el.href&&je(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}__publicField(ot,"values",{timeout:Number,pages:Number});class at extends re{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){requestAnimationFrame((()=>{Ie(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 t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}__publicField(at,"targets",["input","output"]),__publicField(at,"values",{min:Number,max:Number}),__publicField(at,"classes",["error"]);class lt extends re{connect(){this.toggle()}toggle(){this.hasDisablerTarget&&this.disablerTarget.checked?this.disable():this.enable()}disable(){let e=this.hasClearValue&&this.clearValue;this.disableTargets.forEach(((t,s)=>{e&&(t.value=""),t.disabled=!0}))}enable(){this.disableTargets.forEach(((e,t)=>{e.disabled=!1}))}}__publicField(lt,"targets",["disabler","disable"]),__publicField(lt,"values",{clear:Boolean});class ct extends re{connect(){this.toggle()}toggle(){this.hasEnablerTarget&&this.enablerTarget.checked?this.enable():this.disable()}disable(){let e=this.hasClearValue&&this.clearValue;this.enableTargets.forEach(((t,s)=>{e&&(t.value=""),t.disabled=!0}))}enable(){this.enableTargets.forEach(((e,t)=>{e.disabled=!1}))}}__publicField(ct,"targets",["enabler","enable"]),__publicField(ct,"values",{clear:Boolean});class ut extends re{get _checked(){return this.checkboxTargets.filter((e=>e.checked))}get _unchecked(){return this.checkboxTargets.filter((e=>!e.checked))}connect(){requestAnimationFrame((()=>{this.hasSelectAllTarget&&(Ie(this,this.selectAllTarget,"change",this._toggle),this.checkboxTargets.forEach((e=>Ie(this,e,"change",this._refresh))),this._refresh())}))}_toggle(e){e.preventDefault();let t=e.target;this.checkboxTargets.forEach((e=>e.checked=t.checked))}_refresh(){const e=this.checkboxTargets.length,t=this._checked.length;this.selectAllTarget.checked=t>0,this.selectAllTarget.indeterminate=t>0&&t<e}}__publicField(ut,"targets",["selectAll","checkbox"]);class ht extends re{constructor(){super(...arguments),__publicField(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")}}__publicField(ht,"targets",["source","button","copy","fallback"]),__publicField(ht,"values",{removeUnused:Boolean});class dt extends re{get _tickInterval(){return this.hasMillisecondsTarget?1:this.hasSecondsTarget?1e3:this.hasMinutesTarget?15e3:3e5}connect(){requestAnimationFrame((()=>{Be(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"))}}__publicField(dt,"targets",["hours","minutes","seconds","milliseconds"]);class pt extends re{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(ke(this.el))return"submit";if(Te(this.el))return"click";throw new Error("Can't handle confirmation on attached element")}connect(){requestAnimationFrame((()=>{Ie(this,this.el,this._eventType,this.confirm)}))}confirm(e){window.confirm(this._message)||(e.preventDefault(),this.dispatch(this.el,"confirm:cancelled"))}}__publicField(pt,"values",{message:String});class mt extends re{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,Ie(this,window,"popstate",this.confirmNavigation),Ie(this,window,"submit",this.allowSubmit),Pe(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()}}__publicField(mt,"values",{message:String});class ft extends re{constructor(){super(...arguments),__publicField(this,"_interval",null)}get _removeUnused(){return!!this.hasRemoveUnusedValue&&this.removeUnusedValue}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(){null==this._interval&&(this._interval=setInterval(this._tick.bind(this),1e3))}_tick(){try{const e=new Date;let t={};s.isPast(this._deadlineDate)?(t={years:0,months:0,days:0,hours:0,minutes:0,seconds:0},this._clearTick(),this._removeCountingDownClasses(),this._addEndedClasses(),this.dispatch(this.el,"countdown:ended")):t=s.intervalToDuration({start:this._deadlineDate,end:e}),this.hasYearsTarget&&this._updateTarget(this.yearsTarget,this._years(t)),this.hasMonthsTarget&&this._updateTarget(this.monthsTarget,this._months(t)),this.hasDaysTarget&&this._updateTarget(this.daysTarget,this._days(t)),this.hasHoursTarget&&this._updateTarget(this.hoursTarget,this._hours(t)),this.hasMinutesTarget&&this._updateTarget(this.minutesTarget,this._minutes(t)),this.hasSecondsTarget&&this._updateTarget(this.secondsTarget,this._seconds(t))}catch(e){console.error(e),this._clearTick()}}_clearTick(){this._interval&&(clearInterval(this._interval),this._interval=null)}_updateTarget(e,t){this._removeTargetIfUnused(e,t),e.innerHTML=t.toString()}_removeTargetIfUnused(e,t){this._removeUnused&&(0===t&&e.dataset.unused?Number.parseInt(e.dataset.unused)>Date.now()+1500&&e.remove():e.dataset.unused=0==t?Date.now().toString():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)}}__publicField(ft,"values",{deadline:String,removeUnused:Boolean}),__publicField(ft,"targets",["years","months","days","hours","minutes","seconds"]),__publicField(ft,"classes",["countingDown","ended"]);class gt extends re{connect(){console.log("Debug Controller",this,this.testTargets)}}__publicField(gt,"targets",["test"]);function bt(e){return e.hasAttribute("data-dirty")}class vt extends re{constructor(){super(...arguments),__publicField(this,"_cacheText")}get _message(){return this.hasMessageValue?this.messageValue:"Submitting..."}get _timeout(){return this.hasTimeoutValue?this.timeoutValue:1e3}initialize(){}connect(){requestAnimationFrame((()=>{Pe(this,this.el,["click"],this.disable),Pe(this,window,["turbo:load","turbolinks:load"],this._enable)}))}disable(e){let t=this.el;this._isDisabled(t)?(null==e||e.preventDefault(),null==e||e.stopImmediatePropagation()):(this._cacheText=this._getElText(t),this._setElText(t,this._message),this._disable(),je(this,this.enable,this._timeout))}enable(e){null==e||e.preventDefault();let t=this.el;this._isDisabled(t)&&(this._setElText(t,this._cacheText),this._enable())}_isDisabled(e){return Se(e)&&"submit"==e.type||Ae(e)?e.disabled:"true"==e.dataset.disabled}_getElText(e){return Se(e)&&"submit"==e.type?e.value:e.innerText}_setElText(e,t){Se(e)&&"submit"==e.type?e.value=t:(Ae(e)||Te(e))&&(e.innerText=t)}_disable(){let e=this.el;Se(e)&&"submit"==e.type||Ae(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;Se(e)&&"submit"==e.type||Ae(e)?e.disabled=!1:e.dataset.disabled=void 0}}__publicField(vt,"values",{message:String,timeout:Number});class _t extends re{dismiss(){this.el.remove()}}class yt extends re{constructor(){super(...arguments),__publicField(this,"_intervalHandle",null)}get _format(){return["years","months","weeks","days","hours",...this._minutes?["minutes"]:[],...this._seconds?["seconds"]:[]]}get _output(){let{years:e,months:t,weeks:i,days:r,hours:n,minutes:o,seconds:a}=this._duration;e||(e=0),t||(t=0),i||(i=0),r||(r=0),n||(n=0),o||(o=0),a||(a=0);let l=[e,t,i,r,n];return this._minutes||this._seconds||!l.every((e=>0===e))?s.formatDuration(this._duration,{format:this._format,delimiter:", "}):(o+=a/60,`${(o/60).toFixed(1)} hours`)}get _seconds(){return!this.hasSecondsValue||this.secondsValue}get _minutes(){return!this.hasMinutesValue||this.minutesValue}get _timestamp(){if(this.hasTimestampValue)return s.toDate(1e3*this.timestampValue);throw new Error("Expected `timestampValue` to be present")}get _duration(){return s.intervalToDuration({start:new Date,end:this._timestamp})}get _tickInterval(){return this._seconds?1e3:this._minutes?15e3:12e4}connect(){this._clearInterval=Be(this,this._update,this._tickInterval),this._update()}_update(){try{this.el.innerHTML=this._output}catch{this._intervalHandle&&window.clearInterval(this._intervalHandle)}}}__publicField(yt,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class wt extends re{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}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((e=>r[e]=t.get(s,e))),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 e=JSON.parse(localStorage.getItem(this._uniqueIdentifier));Object.keys(e).forEach((i=>{t.set(s,i,e[i])})),this.dispatch(s,"element-save:restore:success")}else this.dispatch(s,"element-save:restore:empty")}}__publicField(wt,"targets",["element"]),__publicField(wt,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class Ct extends re{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(){it(this,{element:this._container,childList:!0}),this.checkEmpty()}mutate(e){this.checkEmpty()}checkEmpty(){let e=this._container,t=this._children;0===t.length?(this._removeNotEmptyClasses(),this._addEmptyClasses(),this.dispatch(e,"dom:empty")):(this._addNotEmptyClasses(),this._removeEmptyClasses(),this.dispatch(e,"dom:not-empty",{detail:{count:t.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)}}__publicField(Ct,"targets",["container"]),__publicField(Ct,"classes",["empty","notEmpty"]),__publicField(Ct,"values",{scopeSelector:String});class Et extends re{connect(){}disable(){let e=this.hasClearValue&&this.clearValue;this.inputTargets.forEach(((t,s)=>{e&&(t.value=""),t.disabled=!0}))}enable(){this.inputTargets.forEach(((e,t)=>e.disabled=!1))}}__publicField(Et,"targets",["input"]),__publicField(Et,"values",{clear:Boolean});class Tt extends re{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)}}__publicField(Tt,"values",{placeholder:String}),__publicField(Tt,"classes",["success","fail"]);class kt extends re{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('", "')}"`)}return e[0]}connect(){"immediate"==this._mode&&this.steal()}steal(){this.el.focus()}}__publicField(kt,"values",{mode:String});class St extends re{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}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){null==e||e.preventDefault();let t=this.el;"request"==this._mode?Ne(t):t.submit()}reset(e){null==e||e.preventDefault(),De(this.form)}}__publicField(St,"targets",["form"]),__publicField(St,"values",{formSelector:String,submitMode:String});class Vt extends re{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 t of this._formElements){let s=t;s.name.length>0&&(Se(s)&&"checkbox"==s.type?e[this._formIdentifier][s.name]=s.checked:Se(s)&&"radio"==s.type?s.checked&&(e[this._formIdentifier][s.name]=s.value):e[this._formIdentifier][s.name]=s.value)}return e}get _restoreOnLoad(){return!this.hasRestoreOnLoadValue||this.restoreOnLoadValue}get _clearOnSubmit(){return!this.hasClearOnSubmitValue||this.clearOnSubmitValue}connect(){requestAnimationFrame((()=>{if(!ke(this.el))throw new Error("Expected controller to be mounted on a form element.");this._restoreOnLoad&&this.restore(),this._clearOnSubmit&&Ie(this,this.el,"submit",this._clear)}))}_clear(){localStorage.removeItem(this._formIdentifier),this.dispatch(this.el,"form-save:cleared")}clear(e){null==e||e.preventDefault(),this._clear()}save(e){e.preventDefault();let t=this._formData;localStorage.setItem(this._formIdentifier,JSON.stringify(t[this._formIdentifier])),this.dispatch(this.el,"form-save:save:success")}restore(e){if(null==e||e.preventDefault(),localStorage.getItem(this._formIdentifier)){const e=JSON.parse(localStorage.getItem(this._formIdentifier));for(const t of this._formElements){let s=t;s.name in e&&(Se(s)&&"checkbox"==s.type?s.checked=e[s.name]:Se(s)&&"radio"==s.type?s.value==e[s.name]&&(s.checked=!0):s.value=e[s.name])}this.dispatch(this.el,"form-save:restore:success")}else this.dispatch(this.el,"form-save:restore:empty")}}__publicField(Vt,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class At extends re{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map((e=>Number.parseFloat(e.trim()))).filter((e=>e>=0&&e<=1)):[0,1]}connect(){Ze(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}})}}__publicField(At,"values",{threshold:String});class xt extends re{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame((()=>{Be(this,this._interval,1e3*this.secondsValue)}))}_interval(){this.dispatch(this.el,"interval:action")}}__publicField(xt,"values",{seconds:Number});var Ot=window.CustomEvent;function Mt(e,t){var s="on"+t.type.toLowerCase();return"function"==typeof e[s]&&e[s](t),e.dispatchEvent(t)}function Lt(e){for(;e;){if("dialog"===e.localName)return e;e=e.parentElement?e.parentElement:e.parentNode?e.parentNode.host:null}return null}function Ft(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function Nt(e,t){for(var s=0;s<e.length;++s)if(e[s]===t)return!0;return!1}function Dt(e){return!(!e||!e.hasAttribute("method"))&&"dialog"===e.getAttribute("method").toLowerCase()}function It(e){var t=["button","input","keygen","select","textarea"].map((function(e){return e+":not([disabled])"}));t.push('[tabindex]:not([disabled]):not([tabindex=""])');var s=e.querySelector(t.join(", "));if(!s&&"attachShadow"in Element.prototype)for(var i=e.querySelectorAll("*"),r=0;r<i.length&&!(i[r].tagName&&i[r].shadowRoot&&(s=It(i[r].shadowRoot)));r++);return s}function Pt(e){return e.isConnected||document.body.contains(e)}function Bt(e){if(e.submitter)return e.submitter;var t=e.target;if(!(t instanceof HTMLFormElement))return null;var s=Rt.formSubmitter;if(!s){var i=e.target;s=("getRootNode"in i&&i.getRootNode()||document).activeElement}return s&&s.form===t?s:null}function jt(e){if(!e.defaultPrevented){var t=e.target,s=Rt.imagemapUseValue,i=Bt(e);null===s&&i&&(s=i.value);var r=Lt(t);if(r)"dialog"===(i&&i.getAttribute("formmethod")||t.getAttribute("method"))&&(e.preventDefault(),null!=s?r.close(s):r.close())}}function Ht(e){if(this.dialog_=e,this.replacedStyleTop_=!1,this.openAsModal_=!1,e.hasAttribute("role")||e.setAttribute("role","dialog"),e.show=this.show.bind(this),e.showModal=this.showModal.bind(this),e.close=this.close.bind(this),e.addEventListener("submit",jt,!1),"returnValue"in e||(e.returnValue=""),"MutationObserver"in window){new MutationObserver(this.maybeHideModal.bind(this)).observe(e,{attributes:!0,attributeFilter:["open"]})}else{var t,s=!1,i=function(){s?this.downgradeModal():this.maybeHideModal(),s=!1}.bind(this),r=function(r){if(r.target===e){var n="DOMNodeRemoved";s|=r.type.substr(0,n.length)===n,window.clearTimeout(t),t=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach((function(t){e.addEventListener(t,r)}))}Object.defineProperty(e,"open",{set:this.setOpen.bind(this),get:e.hasAttribute.bind(e,"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))}Ot&&"object"!=typeof Ot||((Ot=function(e,t){t=t||{};var s=document.createEvent("CustomEvent");return s.initCustomEvent(e,!!t.bubbles,!!t.cancelable,t.detail||null),s}).prototype=window.Event.prototype),Ht.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Pt(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_),Rt.dm.removeDialog(this))},setOpen:function(e){e?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(e){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var t=document.createElement("div");this.dialog_.insertBefore(t,this.dialog_.firstChild),t.tabIndex=-1,t.focus(),this.dialog_.removeChild(t)}var s=document.createEvent("MouseEvents");s.initMouseEvent(e.type,e.bubbles,e.cancelable,window,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),this.dialog_.dispatchEvent(s),e.stopPropagation()},focus_:function(){var e=this.dialog_.querySelector("[autofocus]:not([disabled])");!e&&this.dialog_.tabIndex>=0&&(e=this.dialog_),e||(e=It(this.dialog_)),Ft(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e<t)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=e,this.backdrop_.style.zIndex=t},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(!Pt(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!Rt.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");(function(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),s=function(e,s){return!(void 0===t[e]||t[e]===s)};if(t.opacity<1||s("zIndex","auto")||s("transform","none")||s("mixBlendMode","normal")||s("filter","none")||s("perspective","none")||"isolate"===t.isolation||"fixed"===t.position||"touch"===t.webkitOverflowScrolling)return!0;e=e.parentElement}return!1})(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,Rt.needsCentering(this.dialog_)?(Rt.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(e){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),void 0!==e&&(this.dialog_.returnValue=e);var t=new Ot("close",{bubbles:!1,cancelable:!1});Mt(this.dialog_,t)}};var Rt={reposition:function(e){var t=document.body.scrollTop||document.documentElement.scrollTop,s=t+(window.innerHeight-e.offsetHeight)/2;e.style.top=Math.max(t,s)+"px"},isInlinePositionSetByStylesheet:function(e){for(var t=0;t<document.styleSheets.length;++t){var s=document.styleSheets[t],i=null;try{i=s.cssRules}catch(c){}if(i)for(var r=0;r<i.length;++r){var n=i[r],o=null;try{o=document.querySelectorAll(n.selectorText)}catch(c){}if(o&&Nt(o,e)){var a=n.style.getPropertyValue("top"),l=n.style.getPropertyValue("bottom");if(a&&"auto"!==a||l&&"auto"!==l)return!0}}}return!1},needsCentering:function(e){return"absolute"===window.getComputedStyle(e).position&&(!("auto"!==e.style.top&&""!==e.style.top||"auto"!==e.style.bottom&&""!==e.style.bottom)&&!Rt.isInlinePositionSetByStylesheet(e))},forceRegisterDialog:function(e){if((window.HTMLDialogElement||e.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",e),"dialog"!==e.localName)throw new Error("Failed to register dialog: The element is not a dialog.");new Ht(e)},registerDialog:function(e){e.showModal||Rt.forceRegisterDialog(e)},DialogManager:function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver((function(t){var s=[];t.forEach((function(e){for(var t,i=0;t=e.removedNodes[i];++i)t instanceof Element&&("dialog"===t.localName&&s.push(t),s=s.concat(t.querySelectorAll("dialog")))})),s.length&&e(s)})))}};if(Rt.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})},Rt.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},Rt.DialogManager.prototype.updateStacking=function(){for(var e,t=this.zIndexHigh_,s=0;e=this.pendingDialogStack[s];++s)e.updateZIndex(--t,--t),0===s&&(this.overlay.style.zIndex=--t);var i=this.pendingDialogStack[0];i?(i.dialog.parentNode||document.body).appendChild(this.overlay):this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},Rt.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=Lt(e);){for(var t,s=0;t=this.pendingDialogStack[s];++s)if(t.dialog===e)return 0===s;e=e.parentElement}return!1},Rt.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),Ft(t),void 0!==this.forwardTab_)){var s=this.pendingDialogStack[0];return s.dialog.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?s.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}},Rt.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,27===e.keyCode){e.preventDefault(),e.stopPropagation();var t=new Ot("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&Mt(s.dialog,t)&&s.dialog.close()}else 9===e.keyCode&&(this.forwardTab_=!e.shiftKey)},Rt.DialogManager.prototype.checkDOM_=function(e){this.pendingDialogStack.slice().forEach((function(t){-1!==e.indexOf(t.dialog)?t.downgradeModal():t.maybeHideModal()}))},Rt.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return!(this.pendingDialogStack.length>=t)&&(1===this.pendingDialogStack.unshift(e)&&this.blockDocument(),this.updateStacking(),!0)},Rt.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);-1!==t&&(this.pendingDialogStack.splice(t,1),0===this.pendingDialogStack.length&&this.unblockDocument(),this.updateStacking())},Rt.dm=new Rt.DialogManager,Rt.formSubmitter=null,Rt.imagemapUseValue=null,void 0===window.HTMLDialogElement){var qt=document.createElement("form");if(qt.setAttribute("method","dialog"),"dialog"!==qt.method){var $t=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if($t){var Ut=$t.get;$t.get=function(){return Dt(this)?"dialog":Ut.call(this)};var Wt=$t.set;$t.set=function(e){return"string"==typeof e&&"dialog"===e.toLowerCase()?this.setAttribute("method",e):Wt.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",$t)}}document.addEventListener("click",(function(e){if(Rt.formSubmitter=null,Rt.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e)t=e.composedPath().shift()||t;if(t&&Dt(t.form)){if(!("submit"===t.type&&["button","input"].indexOf(t.localName)>-1)){if("input"!==t.localName||"image"!==t.type)return;Rt.imagemapUseValue=e.offsetX+","+e.offsetY}Lt(t)&&(Rt.formSubmitter=t)}}}),!1),document.addEventListener("submit",(function(e){var t=e.target;if(!Lt(t)){var s=Bt(e);"dialog"===(s&&s.getAttribute("formmethod")||t.getAttribute("method"))&&e.preventDefault()}}));var zt=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){if(!Dt(this))return zt.call(this);var e=Lt(this);e&&e.close()}}class Kt extends re{constructor(){super(...arguments),__publicField(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(){}open(){let e=this.el;if(this._dialog)return;this._dialog=document.createElement("dialog");let t=document.createElement("img");t.className=this._imageClassName,t.src=this._src,t.srcset=this._srcSet,t.sizes=this._sizes,this._dialog.appendChild(t),e.insertAdjacentElement("afterend",this._dialog),Rt.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),he(this._dialog,{behavior:"smooth",block:"end"}).catch((()=>this._dialog.scrollIntoView(!1))),Ie(this,this._dialog,"click",this.close),Ie(this,this._dialog,"cancel",this.close),Ie(this,this._dialog,"close",this.close)}close(){this._dialog&&(this._dialog.close(),this._dialog.remove(),this._dialog=null,he(this.el,{behavior:"smooth",block:"end"}).catch((()=>this.el.scrollIntoView(!1))))}}__publicField(Kt,"values",{src:String,srcSet:String,sizes:String}),__publicField(Kt,"classes",["modal","image"]);class Jt extends re{connect(){this.inputTargets.forEach((e=>Ie(this,e,"change",this.handleInputs)))}handleInputs(e){let t=this.inputTargets.reduce(((e,t)=>t.checked?e+1:e),0),s=e.target;t>this.maxValue?(e.preventDefault(),s.checked=!1,this.dispatch(s,"change"),this.dispatch(s,"limited-selection:too-many"),this.hasErrorTarget&&(this.errorTarget.innerHTML=this.messageValue)):(this.dispatch(s,"limited-selection:selection"),this.hasErrorTarget&&(this.errorTarget.innerHTML=""))}}__publicField(Jt,"targets",["input","error"]),__publicField(Jt,"values",{max:Number,message:String});class Yt extends re{initialize(){}connect(){}disconnect(){}async play(e){null==e||e.preventDefault(),await this.mediaTarget.play()}pause(e){null==e||e.preventDefault(),this.mediaTarget.pause()}restart(e){null==e||e.preventDefault(),this.mediaTarget.currentTime=0}seek(e){null==e||e.preventDefault(),this.mediaTarget.currentTime+=5}}__publicField(Yt,"targets",["media"]);class Zt extends re{constructor(){super(...arguments),__publicField(this,"_errors",[]),__publicField(this,"_firstClick",!1)}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 t.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]}connect(){requestAnimationFrame((()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()}))}async current(e){null==e||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await he(this._currentError,{behavior:"smooth",block:"center",inline:"center"})}async next(e){null==e||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._nextIndex,await he(this._currentError,{behavior:"smooth",block:"center",inline:"center"})}async previous(e){null==e||e.preventDefault(),this._firstClick?(this._firstClick=!1,this._toggleButtons()):this.indexValue=this._previousIndex,await he(this._currentError,{behavior:"smooth",block:"center",inline:"center"})}indexValueChanged(){this._toggleButtons()}selectorValueChanged(){this._errors=Array.from(document.querySelectorAll(this._selector)),this.indexValue=0,this._toggleButtons(),this._toggleVisibility()}_toggleVisibility(){0===this._errorCount?this.el.style.display="none":this.el.style.display=""}_toggleButtons(){if(this.hasNextTarget){if(!this.hasCurrentTarget&&this._firstClick&&this.indexValue==this._errorCount-1)return void this.nextTarget.removeAttribute("disabled");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"))}}__publicField(Zt,"values",{selector:String,index:Number}),__publicField(Zt,"targets",["next","current","previous"]);class Xt extends re{get _wrapperClass(){return this.hasWrapperSelectorValue?this.wrapperClassValue:"nested-fields"}get _insertMode(){return this.hasInsertModeValue?this.insertModeValue:"beforeend"}connect(){this._checkStructure()}add(e){null==e||e.preventDefault();const t=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,this._generateID());this.targetTarget.insertAdjacentHTML(this._insertMode,t)}remove(e){e.preventDefault();const t=e.target.closest(`.${this._wrapperClass}`);if(null==t)throw new Error(`#remove was clicked from outside of a child record. Could not find an ancestor with class .${this._wrapperClass}`);if("true"===t.dataset.newRecord)t.remove();else{t.style.display="none";let e=t.querySelector("input[name*='_destroy']");if(null==e)throw new Error("Could not find a hidden input with name '_destroy'. NestedForm cannot remove an already persisted record without it.");e.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`")}}__publicField(Xt,"targets",["target","template"]),__publicField(Xt,"values",{insertMode:String,wrapperClass:String});class Gt extends re{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){this.passwordTargets.forEach((e=>Ie(this,e,"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((e=>e.value)));return e.has("")||1==e.size}_checkPasswordsMatch(){let e=this.el;this._allPasswordsMatch()?(this.dispatch(e,"password-confirm:match"),this.hasErrorClass&&this.passwordTargets.forEach((e=>this._removeErrorClasses(e)))):(this.dispatch(e,"password-confirm:no-match"),this.hasErrorClass&&this.passwordTargets.forEach((e=>this._addErrorClasses(e))))}}__publicField(Gt,"targets",["password"]),__publicField(Gt,"classes",["error"]);class Qt extends re{peak(e){null==e||e.preventDefault(),this.passwordTarget.type="text"}hide(e){null==e||e.preventDefault(),this.passwordTarget.type="password"}toggle(e){null==e||e.preventDefault(),"password"===this.passwordTarget.type?this.peak():this.hide()}}__publicField(Qt,"targets",["password"]);class es extends $e{connect(){requestAnimationFrame((()=>{this._timeout(),Be(this,this._timeout,1e3*this.secondsValue)}))}async _timeout(){await this.loadContent()}}__publicField(es,"targets",["replace"]),__publicField(es,"values",{endpoint:String,errorMessage:String,selector:String,seconds:Number});class ts extends re{get _mode(){return this.hasModeValue?this.modeValue:"mouseover"}get _supportsPrefetch(){var e,t;const s=document.createElement("link");return(null==(e=s.relList)?void 0:e.supports)&&(null==(t=s.relList)?void 0:t.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":Ie(this,this.el,"mouseover",this.prefetch,{once:!0});break;default:throw new Error(`'${this._mode}' is not a supported prefetch mode`)}}_setupObserver(){new IntersectionObserver((([e],t)=>{e.isIntersecting&&(this.prefetch(),t.unobserve(e.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)}}__publicField(ts,"values",{mode:String});class ss extends re{get name(){return this.hasNameValue?`${this.nameValue}:`:""}connect(){this.dispatch(this.el,`${this.nameValue}presence:added`)}disconnect(){this.dispatch(this.el,`${this.nameValue}presence:removed`)}}__publicField(ss,"values",{name:String});class is extends re{print(e){null==e||e.preventDefault(),window.print()}}class rs extends is{get _unsupportedClasses(){return this.unsupportedClass.split(" ")}get _defaultUnsupportedClasses(){return["unsupported"]}connect(){"print"in window||this._addUnsupportedClasses(this.el),Ie(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)}}__publicField(rs,"classes",["unsupported"]);class ns extends re{get _selector(){return this.hasSelectorValue?this.selectorValue:`[data-controller~="${this.identifier}"]`}replace(e){const[t,s,i]=e.detail;if(t instanceof Node){let e=t.querySelector(this._selector);if(null==e)throw new Error(`expected new form DOM with [data-controller="${this.identifier}"] to be present in returned payload`);let s=this.el.parentNode;if(null==s)throw new Error("expected form to have a DOM parent, could not execute replaceChild");s.replaceChild(e,this.el),this.dispatch(e,"remote-form:replace")}else console.log("Unknown",t)}}__publicField(ns,"targets",[]),__publicField(ns,"values",{selector:String});class os extends re{connect(){var e,t,s;window.self!==window.top&&(rt(this),t={},null===(s=(e=this).constructor.debounces)||void 0===s||s.forEach((s=>{if("string"==typeof s&&(e[s]=nt(e[s],null==t?void 0:t.wait)),"object"==typeof s){const{name:i,wait:r}=s;if(!i)return;e[i]=nt(e[i],r||(null==t?void 0:t.wait))}})),this.postUpdate())}windowResize(e){this.postUpdate()}postUpdate(){let e={name:"iframe-body",height:this.getHeight()};window.parent.postMessage(e,"*")}getHeight(){const e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}}__publicField(os,"debounces",["postUpdate"]);class as extends re{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`)}return"auto"}async scrollTop(e){null==e||e.preventDefault(),await de(this.el,{behavior:this._behaviour})}async scrollBottom(e){null==e||e.preventDefault(),await pe(this.el,{behavior:this._behaviour})}async scrollLeft(e){null==e||e.preventDefault(),await me(this.el,{behavior:this._behaviour})}async scrollRight(e){null==e||e.preventDefault(),await me(this.el,{behavior:this._behaviour})}async up(e){null==e||e.preventDefault(),await fe(this.el,this._increment,{behavior:this._behaviour})}async down(e){null==e||e.preventDefault(),await ge(this.el,this._increment,{behavior:this._behaviour})}async left(e){null==e||e.preventDefault(),await be(this.el,this._increment,{behavior:this._behaviour})}async right(e){null==e||e.preventDefault(),await ve(this.el,this._increment,{behavior:this._behaviour})}}__publicField(as,"values",{behaviour:String,increment:Number});class ls extends le{connect(){requestAnimationFrame((()=>{he(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()}))}}__publicField(ls,"values",{behavior:String,block:String,inline:String});class cs extends re{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return e="document"==this._mode?window:ye(this.el),e}async scroll(e){null==e||e.preventDefault(),this._scrollTarget&&await pe(this._scrollTarget)}}__publicField(cs,"values",{mode:String});class us extends re{scroll(){let e=document.querySelector(this.selectorValue);e?he(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch((()=>e.scrollIntoView())):console.warn(`Could not find target for '${this.selectorValue}'`)}}__publicField(us,"values",{selector:String,behavior:String,block:String,inline:String});class hs extends re{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return e="document"==this._mode?window:ye(this.el),e}async scroll(e){null==e||e.preventDefault(),this._scrollTarget&&await de(this._scrollTarget)}}__publicField(hs,"values",{mode:String});class ds extends re{connect(){requestAnimationFrame((()=>{je(this,(()=>this.el.remove()),1e3*this.secondsValue)}))}}__publicField(ds,"values",{seconds:Number});class ps extends re{constructor(){super(...arguments),__publicField(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("top"===this.modeValue)return"beforebegin"}return"afterend"}connect(){this._magicElement=document.createElement("div"),Re(this,this.el,this._mode,this._magicElement);new IntersectionObserver((e=>{e.forEach((e=>{e.target===this._magicElement&&(0===e.intersectionRatio?this._addStuckClasses():1===e.intersectionRatio&&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)}}__publicField(ps,"classes",["stuck"]),__publicField(ps,"values",{mode:String});class ms extends re{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 Se(e)&&"checkbox"===e.type?e.checked:Se(e)&&"radio"===e.type?e.checked?e.value:"":e.value}set _value(e){let t=this.el;Se(t)&&"checkbox"===t.type?t.checked="true"===e.toString():Se(t)&&"radio"===t.type?t.checked=t.value===e:Se(t)||Ve(t)||xe(t)?t.value=e.toString():t.innerHTML=e.toString()}initialize(){this._read=this._read.bind(this),this._emit=this._emit.bind(this)}connect(){Ce.on(this._eventName,this._read),requestAnimationFrame((()=>{var e;(Se(e=this.el)||xe(e)||Ve(e))&&(this._emit(),Ie(this,this.el,"input",this._emit))}))}disconnect(){Ce.off(this._eventName,this._read)}_emit(){Ce.emit(this._eventName,{value:this._value,dispatcher:this.el})}_read(e){if(void 0===e)throw new Error("No payload received");let{dispatcher:t,value:s}=e;t!==this.el&&(this._value=s)}}__publicField(ms,"values",{key:String});class fs extends re{constructor(){super(...arguments),__publicField(this,"_lastIndex",null),__publicField(this,"_reverse",!1)}get _tableHead(){let e=this.el.tHead;if(null==e)throw new Error("Expected table to have a <thead> element.");return e}get _tableHeaders(){let e=this._tableHead.rows;if(0==e.length)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((()=>{this._tableHeaders.forEach((e=>Ie(this,e,"click",this.sort))),this.hasStartSortValue&&this._sortByColumn(this.startSortValue)}))}sort(e){e.preventDefault();let t=e.target,s=this._indexOfHeaderCell(t);this._sortByColumn(s)}_indexOfHeaderCell(e){return this._tableHeaders.indexOf(e)}_sortByColumn(e){this._reverse=e===this._lastIndex&&!this._reverse;let t=document.createDocumentFragment();this._tableRows.sort(((t,s)=>{var i,r;let n=Array.from(t.cells),o=Array.from(s.cells),a=(null==(i=n[e])?void 0:i.innerText)||"",l=(null==(r=o[e])?void 0:r.innerText)||"",c=a.localeCompare(l,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return t.dataset.sortTop||s.dataset.sortBottom?t.dataset.sortTop&&s.dataset.sortTop?c:-1:t.dataset.sortBottom||s.dataset.sortTop?t.dataset.sortBottom&&s.dataset.sortBottom?c:1:this._reverse?c>0?-1:1:c})).forEach((e=>t.appendChild(e))),this._tableBody.innerHTML="",this._tableBody.appendChild(t),this._lastIndex=e}}__publicField(fs,"values",{startSort:Number});class gs extends re{get _truncated(){return!!this.hasTruncatedValue&&this.truncatedValue}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(){it(this,{childList:!0,element:this._tableBody}),requestAnimationFrame((()=>{this.truncate(),Ie(this,this.showMoreTarget,"click",this.expand)}))}truncate(e){null==e||e.preventDefault(),this._truncated=!0,this._tableRows.length>=this._limit?(this._tableRows.slice(this._limit).forEach((e=>{e!==this.showMoreTarget&&this._hideElement(e)})),this._showElement(this.showMoreTarget)):this._hideElement(this.showMoreTarget)}expand(e){this._truncated=!1,null==e||e.preventDefault(),this._tableRows.slice(this._limit).forEach((e=>{e!==this.showMoreTarget&&this._showElement(e)})),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)}}__publicField(gs,"targets",["showMore"]),__publicField(gs,"values",{limit:Number,truncated:Boolean});class bs extends re{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}connect(){this.linkTargets.forEach((e=>Ie(this,e,"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 t=this.linkTargets,s=this.contentTargets,i=s[e],r=t[e],n=[...s.slice(0,e),...s.slice(e+1)],o=[...t.slice(0,e),...t.slice(e+1)];this._addActiveClasses(r),r.setAttribute("aria-selected","true"),this._addActiveClasses(i),this._removeHideClasses(i),o.forEach((e=>{e.removeAttribute("aria-selected"),this._removeActiveClasses(e)})),n.forEach((e=>{this._removeActiveClasses(e),this._addHideClasses(e)}))}_clampIndex(e){return t.clamp(e,0,this.contentTargets.length-1)}_setMinHeight(){let e=0;this.contentTargets.forEach((t=>{let s=t.hasAttribute("tab-hidden");s&&this._removeHideClasses(t);let i=t.offsetHeight;i>e&&(e=i),s&&this._addHideClasses(t)})),this.contentTargets.forEach((t=>t.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)}}__publicField(bs,"values",{currentTab:Number,equalize:Boolean}),__publicField(bs,"targets",["link","content"]),__publicField(bs,"classes",["active","hide"]);class vs extends le{connect(){if(!this.hasInsertValue)throw new Error("`insert` value was not specified");requestAnimationFrame((()=>{this.hasImmediateValue&&this.immediateValue&&this.execute()}))}execute(e){null==e||e.preventDefault();let t=this.el,s=document.querySelector(this.targetValue);if(null==s)return void this.dispatch(t,"teleport:error");let i=t.cloneNode(!0);switch(this.cleanup(i),this.insertValue){case"beforebegin":case"beforeend":case"afterend":case"afterbegin":s.insertAdjacentHTML(this.insertValue,i.outerHTML);break;case"replaceOuter":s.outerHTML=i.outerHTML;break;case"replaceInner":s.innerHTML=i.outerHTML;break;case"prepend":s.insertAdjacentHTML("afterbegin",i.outerHTML);break;case"append":s.insertAdjacentHTML("beforeend",i.outerHTML);break;default:throw new Error("`insert` value was not specified")}t.remove()}}__publicField(vs,"values",{target:String,insert:String,immediate:Boolean});class _s extends le{constructor(){super(...arguments),__publicField(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 1e3*this.secondsValue;throw new Error("Expected `secondsValue` to be present")}initialize(){this.setState=this.setState.bind(this),this.removeState=this.removeState.bind(this)}connect(){this.setState(),je(this,this.removeState,this._seconds)}disconnect(){this.removeState()}setState(){this._previousState[this._attribute]=t.get(this.el,this._attribute),t.set(this.el,this._attribute,this.valueValue)}removeState(){t.set(this.el,this._attribute,this._previousState[this._attribute])}}function ys(e,s,i,r,n="temporary-state"){var o;e.dataset.controller&&(null==(o=e.dataset.controller)?void 0:o.includes(n))||(e.dataset.controller=(e.dataset.controller||` ${n} `).trim().replaceAll(" "," ")),e[t.camelCase(`${n}-attribute-value`)]=s,e[t.camelCase(`${n}-seconds-value`)]=r.toString()}__publicField(_s,"values",{attribute:String,seconds:Number,value:String});class ws extends re{get _duration(){return s.isPast(this._timestamp)?s.intervalToDuration({start:this._timestamp,end:new Date}):s.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=s.toDate(1e3*this.timestampValue)}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=s.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&je(this,this._update,this._nextUpdate)}}__publicField(ws,"values",{timestamp:Number});class Cs extends re{connect(){requestAnimationFrame((()=>{je(this,this._timeout,1e3*this.secondsValue)}))}_timeout(){this.dispatch(this.el,"timeout")}}__publicField(Cs,"values",{seconds:Number});class Es extends re{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&((e,t={})=>{const s=new tt(e,t);s.observe,s.unobserve})(this),this.hasClickAwayValue&&this.clickAwayValue&&Ge(this),requestAnimationFrame((()=>{this.hasInitialValue&&("on"===this.initialValue?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()}return{}}mouseLeave(){if(this.hasMouseLeaveValue)switch(this.mouseLeaveValue){case"on":this.on();break;case"off":this.off();break;case"toggle":this.toggle()}return{}}on(e){this.toggleTargets.forEach((e=>{this._elementToggleStatus(e),this._elementOn(e)}))}off(e){this.toggleTargets.forEach((e=>{this._elementToggleStatus(e),this._elementOff(e)}))}toggle(e){this.toggleTargets.forEach((e=>{this._elementToggleStatus(e),this._elementToggle(e)}))}_elementWasToggled(e){return"true"==e.dataset.toggled}_elementToggleStatus(e){this._elementWasToggled(e)?delete e.dataset.toggled:e.dataset.toggled="true"}_elementToggle(e){this.classValue.split(" ").forEach((t=>e.classList.toggle(t)))}_elementOn(e){this.classValue.split(" ").forEach((t=>e.classList.toggle(t,!0)))}_elementOff(e){this.classValue.split(" ").forEach((t=>e.classList.toggle(t,!1)))}}__publicField(Es,"targets",["toggle"]),__publicField(Es,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});class Ts extends re{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(),it(this,{subtree:!0,childList:!0})}disconnect(){this._teardown()}_setup(){this._setupNode(this.el)}_setupNode(e){const t=e=>{let t=e.parentElement;t&&(this._nodeActive(t)||this._hideNode(t),t.removeEventListener("click",this._nodeClicked),t.addEventListener("click",this._nodeClicked))};"UL"!==e.tagName&&"OL"!==e.tagName||t(e),e.querySelectorAll("ul, ol").forEach((e=>t(e)))}_teardown(){this.el.querySelectorAll("ul, ol, li").forEach((e=>this._teardownNode(e)))}_teardownNode(e){[e,...Array.from(e.querySelectorAll("ul, ol, li"))].forEach((e=>{e.removeEventListener("click",this._nodeClicked),this._removeActiveClasses(e),this._removeCollapsedClasses(e)}))}_nodeClicked(e){e&&e.stopImmediatePropagation();let t=e.target;t&&this._hasNested(t)&&(this._nodeActive(t)?this._hideNode(t):this._showNode(t))}_nodeActive(e){return this._activeClasses.every((t=>e.classList.contains(t)))}_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 t of e)"childList"===t.type&&(Array.from(t.addedNodes||[]).forEach((e=>this._setupNode(e))),Array.from(t.removedNodes||[]).forEach((e=>this._teardownNode(e))))}_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)}}__publicField(Ts,"classes",["active","collapsed"]);class ks extends re{toggle(e){null==e||e.preventDefault();let t=this._getFrame().src;null==t||t!==this._getSrc()?this._setSrc():this._clear()}setSrc(e){null==e||e.preventDefault(),this._setSrc()}clear(e){null==e||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(null==e)throw new Error(`Could not find frame with ID '${this.frameIdValue}'`);if(we(e))return e;throw new Error(`Element targeted by ID '${this.frameIdValue}'`)}_getSrc(){let e=this.el;if(this.hasSrcValue)return this.srcValue;if(Te(e))return e.href;throw new Error("No link given to drive frame to")}}__publicField(ks,"values",{frameId:String,src:String,loadingMessage:String});class Ss extends re{get _poll(){return!!this.hasPollValue&&this.pollValue}connect(){let e=this.el;if(!we(e))throw new Error("Expected controller to be mounted on a <turbo-frame> element.");if(e.src)throw new Error("The provided <turbo-frame> element has no `src` attribute.");this._poll&&requestAnimationFrame((()=>je(this,this.refresh,this.intervalValue)))}refresh(e){null==e||e.preventDefault();let t=this.el;t.src=t.src}}__publicField(Ss,"values",{interval:Number,poll:Boolean});class Vs extends re{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),Ie(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)}}__publicField(Vs,"classes",["inputWarning","warningHide"]),__publicField(Vs,"targets",["input","warning"]),__publicField(Vs,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class As extends re{get _errorClasses(){return this.errorClass.split(" ")}get _defaultErrorClasses(){return[]}connect(){this._updateWordCount(),Ie(this,this.inputTarget,"input",this._updateWordCount)}_updateWordCount(){let e=0,t=this.inputTarget.value.match(/\S+/g);e=t&&t.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 t=0,s=99999;return this.hasMinValue&&(t=this.minValue),this.hasMaxValue&&(s=this.maxValue),e>=t&&e<=s}}__publicField(As,"targets",["input","output"]),__publicField(As,"values",{min:Number,max:Number}),__publicField(As,"classes",["error"]),e.AnchorSpyController=qe,e.AsyncBlockController=Ue,e.AutoSubmitFormController=We,e.AutosizeController=class extends re{connect(){rt(this);let[,e]=Ze(this);if(this.unobserveIntersection=e,!Ve(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(),Pe(this,window,["resize"],this._handler),Pe(this,this.el,["input","focus"],this._handler)}))}appear(e){this.autosize(this.el),this.unobserveIntersection()}_handler(){this.autosize(this.el)}autosize(e){let t=e.offsetHeight-e.clientHeight;e.style.height="auto",e.style.height=e.scrollHeight+t+"px"}},e.BackLinkController=ot,e.BaseController=re,e.CharCountController=at,e.CheckboxDisableInputsController=lt,e.CheckboxEnableInputsController=ct,e.CheckboxSelectAllController=ut,e.ClipboardController=ht,e.ClockController=dt,e.ConfirmController=pt,e.ConfirmNavigationController=mt,e.CountdownController=ft,e.DebugController=gt,e.DetectDirtyController=class extends re{get _cacheAttrName(){return"detect-dirty-load-value"}connect(){let e=this.el;this._cacheLoadValues(),this._checkDirty(),Pe(this,e,["input","change"],this._checkDirty)}restore(e){null==e||e.preventDefault(),this._restoreElementFromLoadValue()}_getElementValue(){let e=this.el;return Oe(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,t=e.getAttribute(this._cacheAttrName);if(Oe(e))return null==t?e.defaultChecked:"true"==t;if(null!==t)return t;if(xe(e)){Array.from(e.options).forEach((t=>{if(t.defaultSelected)return e.value=t.value,t.value}))}return t}_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,t=e.getAttribute(this._cacheAttrName);if(Oe(e))e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t;else if(xe(e))if(null==t){Array.from(e.options).forEach((t=>{t.defaultSelected&&(e.value=t.value)}))}else e.value=t;else e.value=null==t?e.defaultValue:t}_cacheLoadValues(){let e=this.el;!this._elementHasCachedLoadValue()&&Oe(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}},e.DetectDirtyFormController=class extends re{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(),Pe(this,e,["input","change"],this._checkDirty)}restore(e){null==e||e.preventDefault(),this._formElements.forEach((e=>this._restoreElementFromLoadValue(e)))}_getElementValue(e){return Oe(e)?e.checked:e.value}_getElementLoadValue(e){let t=e.getAttribute(this._cacheAttrName);if(Oe(e))return null==t?e.defaultChecked:"true"==t;if(null!==t)return t;if(xe(e)){Array.from(e.options).forEach((t=>{if(t.defaultSelected)return e.value=t.value,t.value}))}return t}_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)&&Oe(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let t=e.getAttribute(this._cacheAttrName);if(Oe(e))e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=null==t?e.defaultChecked:"true"==t;else if(xe(e))if(null==t){Array.from(e.options).forEach((t=>{t.defaultSelected&&(e.value=t.value)}))}else e.value=t;else e.value=null==t?e.defaultValue:t}_cacheLoadValues(){this._formElements.forEach((e=>this._cacheElementLoadValue(e)))}_checkDirty(){this._formElements.forEach((e=>this._checkElementDirty(e))),this._formElements.some((e=>bt(e)))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}},e.DisableWithController=vt,e.DismissableController=_t,e.DurationController=yt,e.ElementSaveController=wt,e.EmptyDomController=Ct,e.EnableInputsController=Et,e.EphemeralController=le,e.EventBus=Ce,e.FallbackImageController=Tt,e.FocusStealController=kt,e.FormRcController=St,e.FormSaveController=Vt,e.IntersectionController=At,e.IntervalController=xt,e.LazyBlockController=class extends $e{async connect(){let e=this.el;"IntersectionObserver"in window?[this.observe,this.unobserve]=Ze(this,{element:e,threshold:.3}):await this.loadContent()}async appear(e){e.target===this.el&&e.isIntersecting&&(await this.loadContent(),this.unobserve&&this.unobserve())}},e.LightboxImageController=Kt,e.LimitedSelectionCheckboxesController=Jt,e.LoadBlockController=$e,e.MediaPlayerController=Yt,e.NavigateFormErrorsController=Zt,e.NestedFormController=Xt,e.PasswordConfirmController=Gt,e.PasswordPeekController=Qt,e.PollBlockController=es,e.PrefetchController=ts,e.PresenceController=ss,e.PrintButtonController=rs,e.PrintController=is,e.RemoteFormController=ns,e.RemoveController=class extends _t{},e.ResponsiveIframeBodyController=os,e.ResponsiveIframeWrapperController=class extends re{connect(){Ie(this,window,"message",this.messageReceived)}messageReceived(e){let t=e.data;t.hasOwnProperty("name")&&"iframe-body"===t.name&&t.hasOwnProperty("height")&&this.resize(t.height)}resize(e){this.el.style.height=`${e}px`}},e.ScrollContainerController=as,e.ScrollIntoFocusController=ls,e.ScrollToBottomController=cs,e.ScrollToController=us,e.ScrollToTopController=hs,e.SelfDestructController=ds,e.StickyController=ps,e.SyncInputsController=ms,e.TableSortController=fs,e.TableTruncateController=gs,e.TabsController=bs,e.TeleportController=vs,e.TemporaryStateController=_s,e.TimeDistanceController=ws,e.TimeoutController=Cs,e.ToggleClassController=Es,e.TreeViewController=Ts,e.TurboFrameRCController=ks,e.TurboFrameRefreshController=Ss,e.UserFocusController=class extends re{connect(){Pe(this,window,["focus","blur"],this._handleVisibility),Ie(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"visible"==document.visibilityState&&document.hasFocus()}},e.ValueWarnController=Vs,e.WordCountController=As,e.applyTemporaryClass=function(e,t,s){ys(e,"className",0,s)},e.applyTemporaryState=ys,e.createHiddenButton=Me,e.createHiddenInput=function(e,t){let s=document.createElement("input");return s.type="hidden",s.name=e,s.value=t,s},e.getScrollParent=ye,e.insertElement=Le,e.isDirty=function(e){return e.hasAttribute("data-dirty")},e.isFormDirty=bt,e.isTurboFrame=we,e.requestReset=De,e.requestSubmit=Ne,e.scrollAbsoluteBottom=pe,e.scrollAbsoluteLeft=me,e.scrollAbsoluteRight=async function(e,{behavior:t="smooth"}={}){"smooth"!=t||ce||await _e(),e==window?e.scrollTo({left:document.body.scrollWidth,behavior:t}):e.scrollTo({left:e.scrollWidth,behavior:t})},e.scrollAbsoluteTop=de,e.scrollDown=ge,e.scrollLeft=be,e.scrollRight=ve,e.scrollToElement=he,e.scrollUp=fe,e.useEventListener=Ie,e.useEventListeners=Pe,e.useInjectedElement=Re,e.useInjectedFragment=He,e.useInjectedHTML=function(e,t,s,i,r={}){return He(e,t,s,document.createRange().createContextualFragment(i),r)},e.useInterval=Be,e.useTimeout=je,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
1
+ var Is=Object.defineProperty;var Gt=Object.getOwnPropertySymbols;var Ls=Object.prototype.hasOwnProperty,xs=Object.prototype.propertyIsEnumerable;var Fe=(a,b,m)=>b in a?Is(a,b,{enumerable:!0,configurable:!0,writable:!0,value:m}):a[b]=m,Be=(a,b)=>{for(var m in b||(b={}))Ls.call(b,m)&&Fe(a,m,b[m]);if(Gt)for(var m of Gt(b))xs.call(b,m)&&Fe(a,m,b[m]);return a};var l=(a,b,m)=>(Fe(a,typeof b!="symbol"?b+"":b,m),m);(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,m,y){"use strict";class u 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(Xt(i.toString())){if(typeof r=="function")return new Proxy(r,{apply(o,c,h){return n.log(i.toString(),{args:h}),Reflect.apply(o,c,h)}});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,element: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(Be({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(Be({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 Xt(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))}class R extends u{_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[m.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[m.camelCase(`${this.identifier}-action`)],e.dataset.action==""&&delete e.dataset.action;let i=this.constructor.values;i&&Object.keys(i).forEach(h=>delete e.dataset[m.camelCase(`${this.identifier}-${h}-value`)]);let r=this.constructor.classes;r&&Object.keys(r).forEach(h=>delete e.dataset[m.camelCase(`${this.identifier}-${h}-class`)])}}const T="scrollBehavior"in document.documentElement.style;let qe;async function V(t,{behavior:e="smooth",block:s="start",inline:i="nearest"}={}){e=="smooth"&&!T&&await C(),t.scrollIntoView({behavior:e,block:s,inline:i})}async function te(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t.scrollTo({top:0,left:0,behavior:e})}async function se(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),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"&&!T&&await C(),t.scrollTo({left:0,behavior:e})}async function Yt(t,{behavior:e="smooth"}={}){e=="smooth"&&!T&&await C(),t==window?t.scrollTo({left:document.body.scrollWidth,behavior:e}):t.scrollTo({left:t.scrollWidth,behavior:e})}async function Re(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:-e,left:0,behavior:s})}async function $e(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:e,left:0,behavior:s})}async function Pe(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:0,left:-e,behavior:s})}async function ze(t,e,{behavior:s="smooth"}={}){s=="smooth"&&!T&&await C(),t.scrollBy({top:0,left:e,behavior:s})}async function C(){const{polyfill:t}=await import("smoothscroll-polyfill");qe||(qe=!0,t())}function $(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:$(t.parentElement)||document.body}function re(t){return t.nodeName=="TURBO-FRAME"}function Zt(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 A=Zt();function Qt(t){return t.nodeName=="LINK"}function P(t){return t.nodeName=="A"}function ae(t){return t.nodeName=="FORM"}function _(t){return t.nodeName=="INPUT"}function z(t){return t.nodeName=="TEXTAREA"}function H(t){return t.nodeName=="BUTTON"}function D(t){return t.nodeName=="SELECT"}function es(t){return t.nodeName=="IMG"}function S(t){return _(t)&&(t.type==="radio"||t.type==="checkbox")}function Ue(t){return _(t)||D(t)||z(t)}function je(t){let e=document.createElement("button");return e.type=t,e.style.display="none",e.dataset.sythentic="true",e}function We(t,e){let s=document.createElement("input");return s.type="hidden",s.name=t,s.value=e,s}function ne(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 ts(t,e,s,i){return ne(s,i,We(t,e))}function le(t,e,s){return ne(e,s,je(t))}function oe(t){let e=t.form||document;return Array.from(e.querySelectorAll(`input[type="radio"][name="${t.name}"]`))}function he(t){return oe(t).filter(e=>e!==t)}function Ke(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 ue(t){if(t.requestSubmit)t.requestSubmit();else{let e=t.querySelector('button[type="submit"]');e||(e=le("submit",t,"beforeend")),e.click()}}function Je(t){let e=t.querySelector('button[type="reset"]');e||(e=le("reset",t,"beforeend")),e.click()}function Ge(t){return Array.isArray(t)?t:[t]}function w(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=m.debounce(i.bind(t),r.debounce),delete r.debounce):i=i.bind(t);let n=Ge(s),o=()=>n.forEach(h=>e.addEventListener(h,i,r)),c=()=>n.forEach(h=>e.removeEventListener(h,i));return w(t,o,c),{setup:o,teardown:c}}function ss(t,e,s,i,r){return d(t,e,s,i,r)}function k(t,e,s,i,r){let n=[];return e.forEach(o=>{let{setup:c,teardown:h}=d(t,o,s,i,r);n.push({setup:c,teardown:h})}),[()=>n.forEach(o=>o.setup()),()=>n.forEach(o=>o.teardown())]}function is(t,e,s,i,r){return k(t,e,s,i,r)}function Xe(t,e){let s=e||document.documentElement,i=document.fullscreenElement!==null;const r=()=>i=document.fullscreenElement!==null,n=()=>i,o=async()=>i?await p():await g();let c=()=>document.addEventListener("fullscreenchange",r),h=()=>document.removeEventListener("fullscreenchange",r);const p=async()=>{document.exitFullscreen&&(i=!1,await document.exitFullscreen())},g=async()=>{i&&await p(),s.requestFullscreen&&(await s.requestFullscreen(),i=!0)};return w(t,c,h),{isFullscreen:n,enter:g,exit:p,toggle:o,teardown:h}}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 rs(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,h=U({locatedAt:null,error:null,coords:{accuracy:0,latitude:1/0,longitude:1/0,altitude:null,altitudeAccuracy:null,heading:null,speed:null},teardown:()=>{g&&(navigator.geolocation.clearWatch(g),g=null)}});let p=()=>{c&&(g=navigator.geolocation.watchPosition(v=>{h.locatedAt=v.timestamp,h.coords=v.coords,h.error=null,s&&s(v)},v=>{h.error=v,i&&i(v)},{enableHighAccuracy:r,maximumAge:n,timeout:o}))},g=null;return w(t,p,h.teardown),h}function ce(t,e,s,i,r={}){let n=Array.from(i.childNodes),o=()=>{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}},c=r.cleanup?()=>n.forEach(h=>h.remove()):()=>{};return w(t,o,c),[n,c]}function as(t,e,s,i,r={}){const n=document.createRange().createContextualFragment(i);return ce(t,e,s,n,r)}function Ye(t,e,s,i,r={}){const n=new DocumentFragment;n.append(i);let[o,c]=ce(t,e,s,n,r);return[o[0],c]}const Ze={boolean:{read:t=>t==="true",write:t=>String(t)},object:{read:t=>JSON.parse(t),write:t=>JSON.stringify(t)},number:{read:t=>Number.parseFloat(t),write:t=>String(t)},any:{read:t=>t,write:t=>String(t)},string:{read:t=>t,write:t=>String(t)},map:{read:t=>new Map(JSON.parse(t)),write:t=>JSON.stringify(Array.from(t.entries()))},set:{read:t=>new Set(JSON.parse(t)),write:t=>JSON.stringify(Array.from(t.entries()))}};function ns(t,e,s,i){let r="any",{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"&&(r="object"),Array.isArray(s)&&(r="object"),Number.isNaN(s)||(r="number");let o=U({value:s}),c=localStorage;const h=Ze[r],p=g=>{if(!(g&&g.key!==e))try{const v=g?g.newValue:c.getItem(e);v==null?(o.value=s,n&&s!==null&&c.setItem(e,h.write(s))):o.value=h.read(v)}catch{}};return p(),{get value(){return o.value},set value(g){o.value=g,c.setItem(e,h.write(g))},read:p}}function O(t,e,s){e=e.bind(t);let i=null,r=()=>i=setInterval(e,s),n=()=>{i!==null&&clearInterval(i)};return w(t,r,n),n}function M(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=w(t,o,c),c}async function Qe(t,e,s){try{return await fetch(e,s)}catch(i){if(t===1)throw i;return await Qe(t-1,e,s)}}class I extends u{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 Qe(this._maxRetries,this.endpointValue);n.ok||r();let o=await n.text(),c=document.createElement("div");if(c.innerHTML=o,this.hasSelectorValue){let h=c.querySelectorAll(this.selectorValue);i.replaceWith(...h)}else i.replaceWith(...c.children);s.dispatch(i,"ajax:success")}catch{r()}finally{s.dispatch(i,"ajax:complete")}}}l(I,"targets",["replace"]),l(I,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});class de extends I{get _errorMessage(){return this.hasErrorMessageValue?this.errorMessageValue:"This content failed to load"}async connect(){await this.loadContent()}}l(de,"targets",["replace"]),l(de,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number});function ls(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 fe(t,e,s,i,r){s&&(s=s.bind(t)),i&&(i=i.bind(t));let n=r!=null?r:{},o=ee=>{ee.forEach(N=>{N.isIntersecting?s&&s(N):i&&i(N)})},{observer:c,observe:h,unobserve:p,teardown:g}=ls(t,o,n);return w(t,()=>h(e),g),{observer:c,observe:()=>h(e),unobserve:()=>p(e),teardown:g}}class os extends I{async connect(){let e=this.el;if("IntersectionObserver"in window){let{observe:s,unobserve:i}=fe(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 me extends I{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(me,"targets",["replace"]),l(me,"values",{endpoint:String,errorMessage:String,selector:String,maxRetries:Number,seconds:Number});class et extends u{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=>d(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"?ue(e):e.submit()}}l(et,"values",{submitMode:String,eventMode:String,debounceInterval:Number});class hs extends u{connect(){let{teardown:e}=fe(this,this.el,this.appear);if(this._unobserveIntersection=e,!z(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 F(t,e){const s=t[e];return typeof s=="function"?s:s!=null?()=>s:()=>{}}function j(t){return m.upperFirst(m.camelCase(t))}function us(t,e){let s=t.element,i=()=>t[`has${j(e)}Class`]==!0,r=()=>t[`${e}Classes`],n=()=>F(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`]:(h=s)=>h.classList.add(...o()),[`remove${j(e)}Classes`]:(h=s)=>h.classList.remove(...o()),[`${e}ClassesPresent`]:(h=s)=>o().every(p=>h.classList.contains(p))};console.log(c),Object.assign(t,c)}function E(t){let e=t.constructor.classes||[];console.log(e),e.forEach(s=>us(t,s))}class W extends u{connect(){E(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 ge extends u{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(ge,"targets",["disabler","disable"]),l(ge,"values",{clear:Boolean});class pe extends u{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(pe,"targets",["enabler","enable"]),l(pe,"values",{clear:Boolean});class tt extends u{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),k(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(tt,"targets",["selectAll","checkbox"]);class st extends u{connect(){k(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(st,"targets",["checkbox"]);class cs extends u{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 S(e)?e.checked:e.value}_getElementLoadValue(){let e=this.el,s=e.getAttribute(this._cacheAttrName);if(S(e))return s==null?e.defaultChecked:s=="true";if(D(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;_(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);S(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):D(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()&&S(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}}function ds(t){return t.hasAttribute("data-dirty")}class fs extends u{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 S(e)?e.checked:e.value}_getElementLoadValue(e){let s=e.getAttribute(this._cacheAttrName);if(S(e))return s==null?e.defaultChecked:s=="true";if(D(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){_(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)&&S(e)?e.setAttribute(this._cacheAttrName,e.checked.toString()):e.setAttribute(this._cacheAttrName,e.value.toString())}_restoreElementFromLoadValue(e){let s=e.getAttribute(this._cacheAttrName);S(e)?(e.setAttribute(this._cacheAttrName,e.checked.toString()),e.checked=s==null?e.defaultChecked:s=="true"):D(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=>it(e))?this.el.setAttribute("data-dirty","true"):this.el.removeAttribute("data-dirty")}}function it(t){return t.hasAttribute("data-dirty")}class _e extends u{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(_e,"targets",["input"]),l(_e,"values",{clear:Boolean});class rt extends u{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(rt,"values",{mode:String});class be extends u{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"?ue(s):s.submit()}reset(e){e==null||e.preventDefault(),Je(this.form)}}l(be,"targets",["form"]),l(be,"values",{formSelector:String,submitMode:String});class at extends u{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&&(_(i)&&i.type=="checkbox"?e[this._formIdentifier][i.name]=i.checked:_(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(!ae(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.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&&(_(r)&&r.type=="checkbox"?r.checked=s[r.name]:_(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(at,"values",{id:String,restoreOnLoad:Boolean,clearOnSubmit:Boolean});class ve extends u{connect(){k(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(ve,"targets",["input","error"]),l(ve,"values",{max:Number,message:String});class K extends u{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 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(){E(this),requestAnimationFrame(()=>{this._firstClick=!0,this._toggleButtons(),this._toggleVisibility()})}async current(e){e==null||e.preventDefault(),this._firstClick&&(this._firstClick=!1,this._toggleButtons()),await V(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 V(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 V(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 we extends u{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(we,"targets",["target","template"]),l(we,"values",{insertMode:String,wrapperClass:String});class ye extends u{connect(){E(this),k(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.dispatch(e,"password-confirm:match"),this.passwordTargets.forEach(s=>this.removeErrorClasses(s))):(this.dispatch(e,"password-confirm:no-match"),this.passwordTargets.forEach(s=>this.addErrorClasses(s)))}}l(ye,"targets",["password"]),l(ye,"classes",["error"]);class nt extends u{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(nt,"targets",["password"]);class Ee extends u{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.dispatch(n,"remote-form:replace")}else console.log("Unknown",s)}}l(Ee,"targets",[]),l(Ee,"values",{selector:String});function J(t,e,s,i){let r=i;(r==null?void 0:r.debounce)?(s=m.debounce(s.bind(t),r.debounce),delete r.debounce):s=s.bind(t);let n=Ge(e),o=()=>n.forEach(h=>A.on(h,s)),c=()=>n.forEach(h=>A.off(h,s));return w(t,o,c),{setup:o,teardown:c}}class lt extends u{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 _(e)&&e.type==="checkbox"?e.checked:_(e)&&e.type==="radio"?e.checked?e.value:"":e.value}set _value(e){let s=this.el;_(s)&&s.type==="checkbox"?s.checked=e.toString()==="true":_(s)&&s.type==="radio"?s.checked=s.value===e:_(s)||z(s)||D(s)?s.value=e.toString():s.innerHTML=e.toString()}connect(){J(this,this._eventName,this._read),requestAnimationFrame(()=>{Ue(this.el)&&(this._emit(),d(this,this.el,"input",this._emit))})}_emit(){A.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(lt,"values",{key:String});class G extends u{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(){E(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(G,"classes",["inputWarning","warningHide"]),l(G,"targets",["input","warning"]),l(G,"values",{max:Number,min:Number,minMessage:String,maxMessage:String});class X extends u{connect(){E(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 Te extends u{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}}l(Te,"values",{placeholder:String}),l(Te,"classes",["success","fail"]);var L=window.CustomEvent;(!L||typeof L=="object")&&(L=function(e,s){s=s||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,!!s.bubbles,!!s.cancelable,s.detail||null),i},L.prototype=window.Event.prototype);function ot(t,e){var s="on"+e.type.toLowerCase();return typeof t[s]=="function"&&t[s](e),t.dispatchEvent(e)}function ms(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 B(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 ht(t){for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;t&&t.blur&&t!==document.body&&t.blur()}function gs(t,e){for(var s=0;s<t.length;++s)if(t[s]===e)return!0;return!1}function Ce(t){return!t||!t.hasAttribute("method")?!1:t.getAttribute("method").toLowerCase()==="dialog"}function ut(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=ut(r[n].shadowRoot),i));n++);return i}function ct(t){return t.isConnected||document.body.contains(t)}function dt(t){if(t.submitter)return t.submitter;var e=t.target;if(!(e instanceof HTMLFormElement))return null;var s=f.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 ps(t){if(!t.defaultPrevented){var e=t.target,s=f.imagemapUseValue,i=dt(t);s===null&&i&&(s=i.value);var r=B(e);if(!!r){var n=i&&i.getAttribute("formmethod")||e.getAttribute("method");n==="dialog"&&(t.preventDefault(),s!=null?r.close(s):r.close())}}}function ft(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",ps,!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))}ft.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&ct(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_),f.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=ut(this.dialog_)),ht(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(!ct(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!f.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");ms(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,f.needsCentering(this.dialog_)?(f.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 L("close",{bubbles:!1,cancelable:!1});ot(this.dialog_,e)}};var f={};if(f.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"},f.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||!gs(o,t))){var c=n.style.getPropertyValue("top"),h=n.style.getPropertyValue("bottom");if(c&&c!=="auto"||h&&h!=="auto")return!0}}}return!1},f.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:!f.isInlinePositionSetByStylesheet(t)},f.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 ft(t)},f.registerDialog=function(t){t.showModal||f.forceRegisterDialog(t)},f.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)}))},f.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})},f.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},f.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)},f.DialogManager.prototype.containedByTopDialog_=function(t){for(;t=B(t);){for(var e=0,s;s=this.pendingDialogStack[e];++e)if(s.dialog===t)return e===0;t=t.parentElement}return!1},f.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(),ht(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}},f.DialogManager.prototype.handleKey_=function(t){if(this.forwardTab_=void 0,t.keyCode===27){t.preventDefault(),t.stopPropagation();var e=new L("cancel",{bubbles:!1,cancelable:!0}),s=this.pendingDialogStack[0];s&&ot(s.dialog,e)&&s.dialog.close()}else t.keyCode===9&&(this.forwardTab_=!t.shiftKey)},f.DialogManager.prototype.checkDOM_=function(t){var e=this.pendingDialogStack.slice();e.forEach(function(s){t.indexOf(s.dialog)!==-1?s.downgradeModal():s.maybeHideModal()})},f.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)},f.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())},f.dm=new f.DialogManager,f.formSubmitter=null,f.imagemapUseValue=null,window.HTMLDialogElement===void 0){var mt=document.createElement("form");if(mt.setAttribute("method","dialog"),mt.method!=="dialog"){var x=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(x){var _s=x.get;x.get=function(){return Ce(this)?"dialog":_s.call(this)};var bs=x.set;x.set=function(t){return typeof t=="string"&&t.toLowerCase()==="dialog"?this.setAttribute("method",t):bs.call(this,t)},Object.defineProperty(HTMLFormElement.prototype,"method",x)}}document.addEventListener("click",function(t){if(f.formSubmitter=null,f.imagemapUseValue=null,!t.defaultPrevented){var e=t.target;if("composedPath"in t){var s=t.composedPath();e=s.shift()||e}if(!(!e||!Ce(e.form))){var i=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!i){if(!(e.localName==="input"&&e.type==="image"))return;f.imagemapUseValue=t.offsetX+","+t.offsetY}var r=B(e);!r||(f.formSubmitter=e)}}},!1),document.addEventListener("submit",function(t){var e=t.target,s=B(e);if(!s){var i=dt(t),r=i&&i.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&t.preventDefault()}});var vs=HTMLFormElement.prototype.submit,ws=function(){if(!Ce(this))return vs.call(this);var t=B(this);t&&t.close()};HTMLFormElement.prototype.submit=ws}class Se extends u{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),f.registerDialog(this._dialog),this._dialog.className=this._modalClassName,this._dialog.showModal(),V(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,V(this.el,{behavior:"smooth",block:"end"}).catch(()=>this.el.scrollIntoView(!1)))}}l(Se,"values",{src:String,srcSet:String,sizes:String}),l(Se,"classes",["modal","image"]);class gt extends u{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(gt,"targets",["media"]);class pt extends u{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 Re(this.el,this._increment,{behavior:this._behaviour})}async down(e){e==null||e.preventDefault(),await $e(this.el,this._increment,{behavior:this._behaviour})}async left(e){e==null||e.preventDefault(),await Pe(this.el,this._increment,{behavior:this._behaviour})}async right(e){e==null||e.preventDefault(),await ze(this.el,this._increment,{behavior:this._behaviour})}}l(pt,"values",{behaviour:String,increment:Number});class _t extends R{connect(){requestAnimationFrame(()=>{V(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(_t,"values",{behavior:String,block:String,inline:String});class bt extends u{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=$(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await se(this._scrollTarget)}}l(bt,"values",{mode:String});class vt extends u{scroll(){let e=document.querySelector(this.selectorValue);if(!e){console.warn(`Could not find target for '${this.selectorValue}'`);return}V(e,{behavior:this.hasBehaviorValue?this.behaviorValue:"smooth",block:this.hasBlockValue?this.blockValue:"center",inline:this.hasInlineValue?this.inlineValue:"center"}).catch(()=>e.scrollIntoView())}}l(vt,"values",{selector:String,behavior:String,block:String,inline:String});class wt extends u{get _mode(){return this.hasModeValue?this.modeValue:"document"}get _scrollTarget(){let e;return this._mode=="document"?e=window:e=$(this.el),e}async scroll(e){e==null||e.preventDefault(),this._scrollTarget&&await te(this._scrollTarget)}}l(wt,"values",{mode:String});function yt(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=>Ve(n)):s?r.map(n=>Ve(n)):[Ve(t)]}function Ve(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 q(t,e){return`signal:${e}:${t}`}function ke(t){return q(t,"connect")}function Me(t){return q(t,"value")}class Et extends u{get _predicates(){return yt(this.whenValue)}connect(){A.emit(ke(this.nameValue)),J(this,Me(this.nameValue),this._onSignal)}_onSignal(e){let s=e.value;if(!this.hasWhenValue){this.dispatch(this.el,q(this.nameValue,"match"));return}this._predicates.every(i=>i(s))?this.dispatch(this.el,q(this.nameValue,"match"),{detail:{element:this.el,value:s}}):this.dispatch(this.el,q(this.nameValue,"no-match"),{detail:{element:this.el,value:s}})}}l(Et,"values",{name:String,when:String});class Tt extends u{get _debounceTimeout(){return this.hasDebounceIntervalValue?this.debounceIntervalValue:null}get _name(){return this.hasNameValue?this.nameValue:this.element.name}connect(){J(this,ke(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(_(this.el)&&this.el.type==="checkbox")e=this.el.checked?"true":"false";else if(_(this.el)&&this.el.type==="radio"){let i=(s=oe(this.el).find(r=>r.checked))==null?void 0:s.value;e=i||""}A.emit(Me(this._name),{element:this.el,value:e})}}l(Tt,"values",{name:String,debounceInterval:Number});class Ae extends u{get _predicates(){return yt(this.showValue)}get defaultHideClasses(){return["hide"]}connect(){E(this),A.emit(ke(this.nameValue)),J(this,Me(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(Ae,"values",{name:String,show:String}),l(Ae,"classes",["hide"]);class Ct extends u{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(()=>{k(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 ee,N;let c=Array.from(n.cells),h=Array.from(o.cells),p=((ee=c[e])==null?void 0:ee.innerText)||"",g=((N=h[e])==null?void 0:N.innerText)||"",v=p.localeCompare(g,"en",{sensitivity:"base",numeric:!0,caseFirst:"upper"});return n.dataset.sortTop||o.dataset.sortBottom?n.dataset.sortTop&&o.dataset.sortTop?v:-1:n.dataset.sortBottom||o.dataset.sortTop?n.dataset.sortBottom&&o.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(Ct,"values",{startSort:Number});function De(t,e,s,i){s=s.bind(t);let r=new MutationObserver(s),n=()=>r.observe(e,i),o=()=>r.disconnect();return w(t,n,o),o}class Ie extends u{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(){De(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 St extends u{alert(){alert(this.messageValue)}}l(St,"values",{message:String});class ys extends u{connect(){let{enter:e,exit:s,toggle:i}=Xe(this);this.enter=e,this.exit=s,this.toggle=i}}class Vt extends u{get _threshold(){return this.hasThresholdValue?this.thresholdValue.split(",").map(e=>Number.parseFloat(e.trim())).filter(e=>e>=0&&e<=1):[0,1]}connect(){fe(this,this.el,this.appear,this.disappear,{threshold:this._threshold})}appear(e){this.dispatch(this.el,"intersection:appear")}disappear(e){this.dispatch(this.el,"intersection:disappear")}}l(Vt,"values",{threshold:String});class kt extends u{connect(){if(!this.hasSecondsValue)throw new Error("Expected `secondsValue` to be present");requestAnimationFrame(()=>{O(this,this._interval,this.secondsValue*1e3)})}_interval(){this.dispatch(this.el,"interval:action")}}l(kt,"values",{seconds:Number});class Mt extends u{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(Mt,"values",{name:String});class At extends u{print(e){e==null||e.preventDefault(),window.print()}}class Dt extends u{connect(){requestAnimationFrame(()=>{M(this,this._timeout,this.secondsValue*1e3)})}_timeout(){this.dispatch(this.el,"timeout")}}l(Dt,"values",{seconds:Number});class Es extends u{connect(){d(this,window,["focus","blur"],this._handleVisibility),d(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 It extends u{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(It,"targets",["hours","minutes","seconds","milliseconds"]);class Y extends u{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={};y.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=y.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 Lt extends u{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 h=[e,s,i,r,n];return!this._minutes&&!this._seconds&&h.every(p=>p===0)?(o=o+c/60,`${(o/60).toFixed(1)} hours`):y.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 y.toDate(this.timestampValue*1e3);throw new Error("Expected `timestampValue` to be present")}get _duration(){return y.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(Lt,"values",{timestamp:Number,minutes:Boolean,seconds:Boolean});class Z extends u{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(){k(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(h=>{h.removeAttribute("aria-selected"),this.removeActiveClasses(h)}),o.forEach(h=>{this.removeActiveClasses(h),this.addHideClasses(h)})}_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")}}l(Z,"values",{currentTab:Number,equalize:Boolean}),l(Z,"targets",["link","content"]),l(Z,"classes",["active","hide"]);class xt extends u{get _duration(){return y.isPast(this._timestamp)?y.intervalToDuration({start:this._timestamp,end:new Date}):y.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=y.toDate(this.timestampValue*1e3)}connect(){if(!this.hasTimestampValue)throw new Error("Expected `timestampValue` to be present");this._update()}_update(){this.el.innerHTML=y.formatDistanceToNow(this._timestamp,{addSuffix:!0,includeSeconds:!0}),this._nextUpdate&&M(this,this._update,this._nextUpdate)}}l(xt,"values",{timestamp:Number});class Nt extends u{get defaultActiveClasses(){return["active"]}get defaultCollapsedClasses(){return["collapsed"]}initialize(){this._nodeClicked=this._nodeClicked.bind(this)}connect(){E(this),De(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){console.log("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(Nt,"classes",["active","collapsed"]);class Le extends u{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(){E(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.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(Le,"values",{key:String}),l(Le,"classes",["active","inactive"]);class Ht extends u{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&&M(this,this.fallback,this._timeout)}fallback(){window.location.href=this.el.href}}l(Ht,"values",{timeout:Number,pages:Number});class xe extends u{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(xe,"targets",["source","button","copy","fallback"]),l(xe,"values",{removeUnused:Boolean});class Ot extends u{get _message(){return this.hasMessageValue?this.messageValue:"Are you sure?"}get _eventType(){if(ae(this.el))return"submit";if(P(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.dispatch(this.el,"confirm:cancelled"))}}l(Ot,"values",{message:String});class Ft extends u{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(Ft,"values",{message:String});class Bt extends u{connect(){console.log("Debug Controller",this,this.testTargets)}}l(Bt,"targets",["test"]);class qt extends u{constructor(){super(...arguments);l(this,"_cacheText")}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._cacheText=this._getElText(s),this._setElText(s,this._message),this._disable(),M(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 _(e)&&e.type=="submit"||H(e)?e.disabled:e.dataset.disabled=="true"}_getElText(e){return _(e)&&e.type=="submit"?e.value:e.innerText}_setElText(e,s){_(e)&&e.type=="submit"?e.value=s:(H(e)||P(e))&&(e.innerText=s)}_disable(){let e=this.el;_(e)&&e.type=="submit"||H(e)?e.disabled=!0:e.dataset.disabled="true"}_enable(){let e=this.el;_(e)&&e.type=="submit"||H(e)?e.disabled=!1:e.dataset.disabled=void 0}}l(qt,"values",{message:String,timeout:Number});class Rt extends u{dismiss(){this.el.remove()}}class Ts extends Rt{}class Ne extends u{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(Ne,"targets",["element"]),l(Ne,"values",{id:String,attributes:String,restoreOnLoad:Boolean});class Q extends u{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(){E(this),De(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.dispatch(e,"dom:empty")):(this.addNotEmptyClasses(),this.removeEmptyClasses(),this.dispatch(e,"dom:not-empty",{detail:{count:s.length}}))}}l(Q,"targets",["container"]),l(Q,"classes",["empty","notEmpty"]),l(Q,"values",{scopeSelector:String});class $t extends u{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":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($t,"values",{mode:String});class Pt extends At{get defaultUnsupportedClasses(){return["unsupported"]}connect(){E(this),"print"in window||this.addUnsupportedClasses(),d(this,this.el,"click",this.print)}}l(Pt,"classes",["unsupported"]);class Cs extends u{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 Ss extends u{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 zt extends u{connect(){requestAnimationFrame(()=>{M(this,()=>this.el.remove(),this.secondsValue*1e3)})}}l(zt,"values",{seconds:Number});class He extends u{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"),Ye(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(He,"classes",["stuck"]),l(He,"values",{mode:String});class Ut extends R{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(Ut,"values",{target:String,insert:String,immediate:Boolean});class jt extends R{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(),M(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(jt,"values",{attribute:String,seconds:Number,value:String});function Wt(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 Vs(t,e,s){Wt(t,"className",e,s)}function ks(t,e,s){s=s.bind(t);const i=n=>{e.contains(n.target)||!Ke(e)||s(n)};let{teardown:r}=d(t,window,["click","touchend"],i);return w(t,()=>{},r),{teardown:r}}function Ms(t,e,s,i){let r=null,n=null;if(s){s=s.bind(t);let{teardown:h}=d(t,e,"mouseenter",s);r=h}if(i){i=i.bind(t);let{teardown:h}=d(t,e,"mouseleave",i);n=h}let o=()=>{},c=()=>{r&&r(),n&&n()};return w(t,o,c),{teardown:c}}class Oe extends u{connect(){if(!this.hasClassValue)throw new Error("data-toggle-class-class-value must not be empty");(this.hasMouseEnterValue||this.hasMouseLeaveValue)&&Ms(this,this.el,this.mouseEnter,this.mouseLeave),this.hasClickAwayValue&&this.clickAwayValue&&ks(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(Oe,"targets",["toggle"]),l(Oe,"values",{class:String,mouseEnter:String,mouseLeave:String,clickAway:Boolean,initial:String});function As(t){const e=t.disconnect.bind(t);let s=!1,i=(h,p)=>{h.forEach(g=>{g.type==="childList"&&Array.from(g.addedNodes).some(v=>v.tagName==="TRIX-TOOLBAR")&&(o(),p.disconnect())})},r=h=>F(t,"pasteEvent").call(t,h),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 h=t.element,p=t.element.parentElement;if(p==null)throw new Error("Could not traverse DOM tree from <trix-editor>");h.addEventListener("trix-paste",r);let g=p.querySelector("trix-toolbar");if(!s&&!g){s=!0,n.observe(p,{childList:!0});return}else if(g)n.disconnect();else throw new Error("Could not find an instance of <trix-toolbar> that is a sibling of this <trix-editor>");F(t,"install").call(t,{toolbar:g,editor:h})},c=()=>{if(t.element.tagName!=="TRIX-EDITOR")throw new Error("Expected controller to be mounted on an instance of <trix-editor>");let h=t.element,p=t.element.parentElement;if(p==null)throw new Error("Could not traverse DOM tree from <trix-editor>");h.removeEventListener("trix-paste",r);let g=p.querySelector("trix-toolbar");if(!g)throw new Error("Could not find <trix-toolbar> that is a sibling of this <trix-editor> element");F(t,"uninstall").call(t,{toolbar:g,editor:h})};o(),Object.assign(t,{disconnect(){n.disconnect(),c(),F(t,"uninstall").call({toolbar,editor:t.element}),e()}})}class Ds extends u{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:h}=r;(o.files.length>0||c.includes("<img"))&&(alert("The content you pasted contains images and/or files. File uploads are not supported."),h.undo())},uninstall(n){i.simpleHideShowHandlers(e).uninstall(n),i.el.removeEventListener("trix-file-accept",s)}}}connect(){As(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 Kt extends u{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(P(e))return e.href;throw new Error("No link given to drive frame to")}}l(Kt,"values",{frameId:String,src:String,loadingMessage:String});class Jt extends u{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(()=>M(this,this.refresh,this.intervalValue))}refresh(e){e==null||e.preventDefault();let s=this.el;s.src=s.src}}l(Jt,"values",{interval:Number,poll:Boolean}),a.AlertController=St,a.AnchorSpyController=Le,a.AsyncBlockController=de,a.AutoSubmitFormController=et,a.AutosizeController=hs,a.BackLinkController=Ht,a.BaseController=u,a.CharCountController=W,a.CheckboxDisableInputsController=ge,a.CheckboxEnableInputsController=pe,a.CheckboxSelectAllController=tt,a.CheckboxXORController=st,a.ClipboardController=xe,a.ClockController=It,a.ConfirmController=Ot,a.ConfirmNavigationController=Ft,a.CountdownController=Y,a.DebugController=Bt,a.DetectDirtyController=cs,a.DetectDirtyFormController=fs,a.DisableWithController=qt,a.DismissableController=Rt,a.DurationController=Lt,a.ElementSaveController=Ne,a.EmptyDomController=Q,a.EnableInputsController=_e,a.EphemeralController=R,a.EventBus=A,a.FallbackImageController=Te,a.FocusStealController=rt,a.FormRcController=be,a.FormSaveController=at,a.FullscreenController=ys,a.IntersectionController=Vt,a.IntervalController=kt,a.LazyBlockController=os,a.LightboxImageController=Se,a.LimitedSelectionCheckboxesController=ve,a.LoadBlockController=I,a.MediaPlayerController=gt,a.NavigateFormErrorsController=K,a.NestedFormController=we,a.PasswordConfirmController=ye,a.PasswordPeekController=nt,a.PollBlockController=me,a.PrefetchController=$t,a.PresenceController=Mt,a.PrintButtonController=Pt,a.PrintController=At,a.RemoteFormController=Ee,a.RemoveController=Ts,a.ResponsiveIframeBodyController=Ss,a.ResponsiveIframeWrapperController=Cs,a.ScrollContainerController=pt,a.ScrollIntoFocusController=_t,a.ScrollToBottomController=bt,a.ScrollToController=vt,a.ScrollToTopController=wt,a.SelfDestructController=zt,a.SignalActionController=Et,a.SignalInputController=Tt,a.SignalVisibilityController=Ae,a.StickyController=He,a.StorageSerializers=Ze,a.SyncInputsController=lt,a.TableSortController=Ct,a.TableTruncateController=Ie,a.TabsController=Z,a.TeleportController=Ut,a.TemporaryStateController=jt,a.TimeDistanceController=xt,a.TimeoutController=Dt,a.ToggleClassController=Oe,a.TreeViewController=Nt,a.TrixModifierController=Ds,a.TurboFrameRCController=Kt,a.TurboFrameRefreshController=Jt,a.UserFocusController=Es,a.ValueWarnController=G,a.WordCountController=X,a.applyTemporaryClass=Vs,a.applyTemporaryState=Wt,a.createHiddenButton=je,a.createHiddenInput=We,a.getAllRadiosInGroup=oe,a.getOtherRadiosInGroup=he,a.getScrollParent=$,a.insertElement=ne,a.insertHiddenButton=le,a.insertHiddenInput=ts,a.isDirty=ds,a.isElementCheckable=S,a.isElementInViewport=Ke,a.isFormDirty=it,a.isHTMLAnchorElement=P,a.isHTMLButtonElement=H,a.isHTMLFormElement=ae,a.isHTMLImageElement=es,a.isHTMLInputElement=_,a.isHTMLLinkElement=Qt,a.isHTMLSelectElement=D,a.isHTMLTextAreaElement=z,a.isTurboFrame=re,a.isTypeOfFormInputElement=Ue,a.requestReset=Je,a.requestSubmit=ue,a.scrollAbsoluteBottom=se,a.scrollAbsoluteLeft=ie,a.scrollAbsoluteRight=Yt,a.scrollAbsoluteTop=te,a.scrollDown=$e,a.scrollLeft=Pe,a.scrollRight=ze,a.scrollToElement=V,a.scrollUp=Re,a.useCollectionEventListener=k,a.useCollectionEventListeners=is,a.useEventListener=d,a.useEventListeners=ss,a.useFullscreen=Xe,a.useGeolocation=rs,a.useInjectedElement=Ye,a.useInjectedFragment=ce,a.useInjectedHTML=as,a.useInterval=O,a.useLocalStorage=ns,a.useTimeout=M,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
2
2
  //# sourceMappingURL=stimulus-library.umd.js.map