ariadne_view_components 0.0.59 → 0.0.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/LICENSE.txt +661 -49
  4. data/README.md +52 -4
  5. data/app/assets/javascripts/ariadne_view_components.js +98 -7
  6. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  7. data/app/assets/stylesheets/ariadne_view_components.css +1 -7
  8. data/app/components/ariadne/base_component.rb +79 -27
  9. data/app/components/ariadne/behaviors/tooltipable.rb +120 -0
  10. data/app/components/ariadne/conditional_wrapper.rb +21 -0
  11. data/app/components/ariadne/form/base_component.rb +74 -0
  12. data/app/components/ariadne/form/base_input_component.rb +60 -0
  13. data/app/components/ariadne/form/caption/component.html.erb +10 -0
  14. data/app/components/ariadne/form/caption/component.rb +29 -0
  15. data/app/components/ariadne/form/form_control/component.html.erb +19 -0
  16. data/app/components/ariadne/form/form_control/component.rb +27 -0
  17. data/app/components/ariadne/form/form_reference/component.html.erb +1 -0
  18. data/app/components/ariadne/form/form_reference/component.rb +18 -0
  19. data/app/components/ariadne/form/group/component.html.erb +5 -0
  20. data/app/components/ariadne/form/group/component.rb +27 -0
  21. data/app/components/ariadne/form/hidden_field/component.html.erb +1 -0
  22. data/app/components/ariadne/form/hidden_field/component.rb +15 -0
  23. data/app/components/ariadne/form/separator/component.html.erb +1 -0
  24. data/app/components/ariadne/form/separator/component.rb +8 -0
  25. data/app/components/ariadne/form/spacing_wrapper/component.html.erb +3 -0
  26. data/app/components/ariadne/form/spacing_wrapper/component.rb +8 -0
  27. data/app/components/ariadne/form/text_field/component.html.erb +25 -0
  28. data/app/components/ariadne/form/text_field/component.rb +132 -0
  29. data/app/components/ariadne/form/validation_message/component.html.erb +5 -0
  30. data/app/components/ariadne/form/validation_message/component.rb +14 -0
  31. data/app/components/ariadne/layout/narrow/component.html.erb +10 -0
  32. data/app/components/ariadne/layout/narrow/component.rb +24 -0
  33. data/app/components/ariadne/layout/nav_bar/component.css +0 -0
  34. data/app/components/ariadne/layout/nav_bar/component.html.erb +123 -0
  35. data/app/components/ariadne/layout/nav_bar/component.rb +77 -0
  36. data/app/components/ariadne/ui/button/component.html.erb +5 -0
  37. data/app/components/ariadne/ui/button/component.rb +184 -0
  38. data/app/components/ariadne/ui/clipboard_copy/component.html.erb +8 -0
  39. data/app/components/ariadne/ui/clipboard_copy/component.rb +102 -0
  40. data/app/components/ariadne/ui/clipboard_copy/component.ts +54 -0
  41. data/app/components/ariadne/ui/combobox/component.html.erb +32 -0
  42. data/app/components/ariadne/ui/combobox/component.rb +83 -0
  43. data/app/components/ariadne/ui/combobox/component.ts +119 -0
  44. data/app/components/ariadne/ui/combobox/menu_item/component.html.erb +9 -0
  45. data/app/components/ariadne/ui/combobox/menu_item/component.rb +53 -0
  46. data/app/components/ariadne/ui/combobox/option/component.html.erb +11 -0
  47. data/app/components/ariadne/ui/combobox/option/component.rb +45 -0
  48. data/app/components/ariadne/ui/heroicon/component.html.erb +3 -0
  49. data/app/components/ariadne/ui/heroicon/component.rb +141 -0
  50. data/app/components/ariadne/ui/image/component.rb +69 -0
  51. data/app/components/ariadne/ui/link/component.html.erb +3 -0
  52. data/app/components/ariadne/ui/link/component.rb +56 -0
  53. data/app/components/ariadne/ui/typography/component.html.erb +3 -0
  54. data/app/components/ariadne/ui/typography/component.rb +41 -0
  55. data/app/lib/ariadne/attributes_helper.rb +119 -0
  56. data/app/lib/ariadne/fetch_or_fallback_helper.rb +1 -1
  57. data/app/lib/ariadne/form.rb +16 -0
  58. data/app/lib/ariadne/view_helper.rb +2 -5
  59. data/app/lib/view_components_contrib/html_attrs.rb +64 -0
  60. data/app/lib/view_components_contrib/style_variants.rb +14 -0
  61. data/lib/ariadne/forms/acts_as_component.rb +125 -0
  62. data/lib/ariadne/forms/base.html.erb +8 -0
  63. data/lib/ariadne/forms/base.rb +132 -0
  64. data/lib/ariadne/forms/buffer_rewriter.rb +51 -0
  65. data/lib/ariadne/forms/builder.rb +88 -0
  66. data/lib/ariadne/forms/dsl/button_input.rb +33 -0
  67. data/lib/ariadne/forms/dsl/form_object.rb +26 -0
  68. data/lib/ariadne/forms/dsl/input.rb +322 -0
  69. data/lib/ariadne/forms/dsl/input_group.rb +34 -0
  70. data/lib/ariadne/forms/dsl/input_methods.rb +157 -0
  71. data/lib/ariadne/forms/dsl/submit_button_input.rb +36 -0
  72. data/lib/ariadne/forms/dsl/text_field_input.rb +73 -0
  73. data/lib/ariadne/forms/utils.rb +34 -0
  74. data/lib/ariadne/generate.rb +11 -0
  75. data/lib/ariadne/view_components/engine.rb +24 -7
  76. data/lib/ariadne/view_components/version.rb +1 -1
  77. data/lib/ariadne/view_components.rb +1 -1
  78. data/lib/ariadne/yard/backend.rb +24 -0
  79. data/lib/ariadne/yard/component_manifest.rb +148 -0
  80. data/lib/ariadne/yard/component_ref.rb +49 -0
  81. data/lib/ariadne/yard/docs_helper.rb +98 -0
  82. data/lib/ariadne/yard/info_arch_docs_helper.rb +31 -0
  83. data/lib/ariadne/yard/lookbook_docs_helper.rb +32 -0
  84. data/lib/ariadne/yard/lookbook_pages_backend.rb +235 -0
  85. data/lib/ariadne/yard/registry.rb +136 -0
  86. data/lib/ariadne/yard/renders_many_handler.rb +23 -0
  87. data/lib/ariadne/yard/renders_one_handler.rb +23 -0
  88. data/lib/ariadne/yard.rb +19 -0
  89. data/static/arguments.yml +141 -48
  90. data/static/audited_at.json +0 -9
  91. data/static/classes.yml +210 -209
  92. data/static/constants.json +2 -209
  93. data/static/statuses.json +0 -9
  94. metadata +125 -210
  95. data/app/assets/builds/ariadne_view_components.css +0 -2202
  96. data/app/assets/javascripts/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
  97. data/app/assets/javascripts/components/ariadne/ariadne-form.d.ts +0 -22
  98. data/app/assets/javascripts/components/ariadne/ariadne.d.ts +0 -2
  99. data/app/assets/javascripts/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
  100. data/app/assets/javascripts/components/ariadne/dropdown/menu_component.d.ts +0 -1
  101. data/app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts +0 -4
  102. data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +0 -39
  103. data/app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
  104. data/app/assets/javascripts/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
  105. data/app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
  106. data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
  107. data/app/assets/javascripts/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
  108. data/app/assets/javascripts/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
  109. data/app/assets/javascripts/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
  110. data/app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
  111. data/app/assets/javascripts/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
  112. data/app/assets/stylesheets/dropdown.css +0 -46
  113. data/app/assets/stylesheets/prosemirror.css +0 -323
  114. data/app/assets/stylesheets/tooltip-component.css +0 -37
  115. data/app/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
  116. data/app/components/ariadne/accumulator_controller/accumulator_controller.js +0 -39
  117. data/app/components/ariadne/accumulator_controller/accumulator_controller.ts +0 -48
  118. data/app/components/ariadne/action_card_component.html.erb +0 -13
  119. data/app/components/ariadne/action_card_component.rb +0 -88
  120. data/app/components/ariadne/ariadne-form.d.ts +0 -22
  121. data/app/components/ariadne/ariadne-form.js +0 -85
  122. data/app/components/ariadne/ariadne.d.ts +0 -2
  123. data/app/components/ariadne/ariadne.js +0 -24
  124. data/app/components/ariadne/ariadne.ts +0 -29
  125. data/app/components/ariadne/avatar_component.rb +0 -81
  126. data/app/components/ariadne/avatar_stack_component/avatar_stack_component.html.erb +0 -12
  127. data/app/components/ariadne/avatar_stack_component.rb +0 -75
  128. data/app/components/ariadne/base_button.rb +0 -70
  129. data/app/components/ariadne/blankslate_component/blankslate_component.html.erb +0 -26
  130. data/app/components/ariadne/blankslate_component.rb +0 -148
  131. data/app/components/ariadne/body_component.rb +0 -30
  132. data/app/components/ariadne/bottom_tab_component.html.erb +0 -4
  133. data/app/components/ariadne/bottom_tab_component.rb +0 -44
  134. data/app/components/ariadne/bottom_tab_nav_component.html.erb +0 -5
  135. data/app/components/ariadne/bottom_tab_nav_component.rb +0 -33
  136. data/app/components/ariadne/breadcrumbs_component.html.erb +0 -13
  137. data/app/components/ariadne/breadcrumbs_component.rb +0 -31
  138. data/app/components/ariadne/button_component/button_component.html.erb +0 -4
  139. data/app/components/ariadne/button_component.rb +0 -165
  140. data/app/components/ariadne/checkbox_component.html.erb +0 -5
  141. data/app/components/ariadne/checkbox_component.rb +0 -43
  142. data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
  143. data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.js +0 -18
  144. data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.ts +0 -19
  145. data/app/components/ariadne/clipboard_copy_component/clipboard_copy_component.html.erb +0 -9
  146. data/app/components/ariadne/clipboard_copy_component.rb +0 -90
  147. data/app/components/ariadne/close_button_component.html.erb +0 -4
  148. data/app/components/ariadne/close_button_component.rb +0 -33
  149. data/app/components/ariadne/combobox_component.html.erb +0 -14
  150. data/app/components/ariadne/combobox_component.rb +0 -76
  151. data/app/components/ariadne/component.rb +0 -127
  152. data/app/components/ariadne/container_component/container_component.html.erb +0 -3
  153. data/app/components/ariadne/container_component.rb +0 -25
  154. data/app/components/ariadne/content.rb +0 -12
  155. data/app/components/ariadne/counter_component.rb +0 -100
  156. data/app/components/ariadne/details_component/details_component.html.erb +0 -4
  157. data/app/components/ariadne/details_component.rb +0 -81
  158. data/app/components/ariadne/dropdown/menu_component.d.ts +0 -1
  159. data/app/components/ariadne/dropdown/menu_component.html.erb +0 -20
  160. data/app/components/ariadne/dropdown/menu_component.js +0 -1
  161. data/app/components/ariadne/dropdown/menu_component.rb +0 -101
  162. data/app/components/ariadne/dropdown/menu_component.ts +0 -1
  163. data/app/components/ariadne/dropdown_component/dropdown_component.html.erb +0 -8
  164. data/app/components/ariadne/dropdown_component.rb +0 -172
  165. data/app/components/ariadne/events_controller/events_controller.d.ts +0 -4
  166. data/app/components/ariadne/events_controller/events_controller.js +0 -6
  167. data/app/components/ariadne/events_controller/events_controller.ts +0 -7
  168. data/app/components/ariadne/flash_component/flash_component.html.erb +0 -31
  169. data/app/components/ariadne/flash_component.rb +0 -128
  170. data/app/components/ariadne/flex_component/flex_component.html.erb +0 -5
  171. data/app/components/ariadne/flex_component.rb +0 -56
  172. data/app/components/ariadne/footer_component/footer_component.html.erb +0 -7
  173. data/app/components/ariadne/footer_component.rb +0 -23
  174. data/app/components/ariadne/grid_component/grid_component.html.erb +0 -26
  175. data/app/components/ariadne/grid_component.rb +0 -67
  176. data/app/components/ariadne/header_component/header_component.html.erb +0 -29
  177. data/app/components/ariadne/header_component.rb +0 -111
  178. data/app/components/ariadne/heading_component.rb +0 -49
  179. data/app/components/ariadne/heroicon_component/heroicon_component.html.erb +0 -4
  180. data/app/components/ariadne/heroicon_component.rb +0 -166
  181. data/app/components/ariadne/image_component.rb +0 -53
  182. data/app/components/ariadne/inline_flex_component/inline_flex_component.html.erb +0 -6
  183. data/app/components/ariadne/inline_flex_component.rb +0 -72
  184. data/app/components/ariadne/layout_component.html.erb +0 -21
  185. data/app/components/ariadne/layout_component.rb +0 -69
  186. data/app/components/ariadne/link_component.rb +0 -65
  187. data/app/components/ariadne/list_component/list_component.html.erb +0 -3
  188. data/app/components/ariadne/list_component.rb +0 -70
  189. data/app/components/ariadne/modal_component.html.erb +0 -11
  190. data/app/components/ariadne/modal_component.rb +0 -88
  191. data/app/components/ariadne/narrow_container_component/narrow_container_component.html.erb +0 -3
  192. data/app/components/ariadne/narrow_container_component.rb +0 -30
  193. data/app/components/ariadne/options_controller/options_controller.d.ts +0 -39
  194. data/app/components/ariadne/options_controller/options_controller.js +0 -89
  195. data/app/components/ariadne/options_controller/options_controller.ts +0 -122
  196. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
  197. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.js +0 -237
  198. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.ts +0 -278
  199. data/app/components/ariadne/panel_bar_component/panel_bar_component.html.erb +0 -20
  200. data/app/components/ariadne/panel_bar_component.rb +0 -80
  201. data/app/components/ariadne/pill_component/pill_component.html.erb +0 -3
  202. data/app/components/ariadne/pill_component.rb +0 -44
  203. data/app/components/ariadne/popover_component.html.erb +0 -10
  204. data/app/components/ariadne/popover_component.rb +0 -81
  205. data/app/components/ariadne/progress_bar_component.html.erb +0 -5
  206. data/app/components/ariadne/progress_bar_component.rb +0 -63
  207. data/app/components/ariadne/relative_time_component.html.erb +0 -3
  208. data/app/components/ariadne/relative_time_component.rb +0 -61
  209. data/app/components/ariadne/show_more_button_component.html.erb +0 -11
  210. data/app/components/ariadne/show_more_button_component.rb +0 -47
  211. data/app/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
  212. data/app/components/ariadne/slideover_component/slideover-component.js +0 -11
  213. data/app/components/ariadne/slideover_component/slideover-component.ts +0 -17
  214. data/app/components/ariadne/slideover_component/slideover_component.html.erb +0 -9
  215. data/app/components/ariadne/slideover_component.rb +0 -66
  216. data/app/components/ariadne/spinner_component.html.erb +0 -16
  217. data/app/components/ariadne/spinner_component.rb +0 -45
  218. data/app/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
  219. data/app/components/ariadne/string_match_controller/string_match_controller.js +0 -51
  220. data/app/components/ariadne/string_match_controller/string_match_controller.ts +0 -65
  221. data/app/components/ariadne/subheader_component.html.erb +0 -11
  222. data/app/components/ariadne/subheader_component.rb +0 -65
  223. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
  224. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.js +0 -207
  225. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.ts +0 -256
  226. data/app/components/ariadne/tab_component/tab_component.html.erb +0 -3
  227. data/app/components/ariadne/tab_component.rb +0 -98
  228. data/app/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
  229. data/app/components/ariadne/tab_container_component/tab-container-component.js +0 -23
  230. data/app/components/ariadne/tab_container_component/tab-container-component.ts +0 -24
  231. data/app/components/ariadne/tab_container_component.erb +0 -10
  232. data/app/components/ariadne/tab_container_component.rb +0 -68
  233. data/app/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
  234. data/app/components/ariadne/tab_nav_component/tab-nav-component.js +0 -33
  235. data/app/components/ariadne/tab_nav_component/tab-nav-component.ts +0 -34
  236. data/app/components/ariadne/tab_nav_component/tab_nav_component.html.erb +0 -7
  237. data/app/components/ariadne/tab_nav_component.rb +0 -72
  238. data/app/components/ariadne/table_nav_component/table_nav_component.html.erb +0 -52
  239. data/app/components/ariadne/table_nav_component.rb +0 -338
  240. data/app/components/ariadne/text.rb +0 -25
  241. data/app/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
  242. data/app/components/ariadne/time_ago_component/time-ago-component.js +0 -1
  243. data/app/components/ariadne/time_ago_component/time-ago-component.ts +0 -1
  244. data/app/components/ariadne/time_ago_component.rb +0 -56
  245. data/app/components/ariadne/timeline_component/timeline_component.html.erb +0 -19
  246. data/app/components/ariadne/timeline_component.rb +0 -34
  247. data/app/components/ariadne/toggle_component/toggle_component.html.erb +0 -15
  248. data/app/components/ariadne/toggle_component.rb +0 -95
  249. data/app/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
  250. data/app/components/ariadne/toggleable_controller/toggleable_controller.js +0 -54
  251. data/app/components/ariadne/toggleable_controller/toggleable_controller.ts +0 -77
  252. data/app/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
  253. data/app/components/ariadne/tooltip_component/tooltip-component.js +0 -43
  254. data/app/components/ariadne/tooltip_component/tooltip-component.ts +0 -57
  255. data/app/components/ariadne/tooltip_component/tooltip_component.html.erb +0 -4
  256. data/app/components/ariadne/tooltip_component.rb +0 -108
  257. data/app/lib/ariadne/action_view_extensions/form_helper.rb +0 -30
  258. data/app/lib/ariadne/audited/dsl.rb +0 -32
  259. data/app/lib/ariadne/form_builder.rb +0 -80
  260. data/app/lib/ariadne/status/dsl.rb +0 -41
  261. data/config/importmap.rb +0 -3
  262. data/exe/tailwindcss +0 -21
  263. data/lib/rubocop/cop/ariadne/base_cop.rb +0 -26
  264. data/tailwind.config.js +0 -70
@@ -1,8 +1,99 @@
1
- class t{constructor(t,e,n){this.eventTarget=t,this.eventName=e,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=function(t){if("immediatePropagationStopped"in t)return t;{const{stopImmediatePropagation:e}=t;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}(t);for(const t of this.bindings){if(e.immediatePropagationStopped)break;t.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((t,e)=>{const n=t.index,s=e.index;return n<s?-1:n>s?1:0}))}}class e{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((t=>t.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((t=>t.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((t,e)=>t.concat(Array.from(e.values()))),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,n={}){this.application.handleError(t,`Error ${e}`,n)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:n,eventOptions:s}=t,i=this.fetchEventListenerMapForEventTarget(e),r=this.cacheKey(n,s);i.delete(r),0==i.size&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:n,eventOptions:s}=t;return this.fetchEventListener(e,n,s)}fetchEventListener(t,e,n){const s=this.fetchEventListenerMapForEventTarget(t),i=this.cacheKey(e,n);let r=s.get(i);return r||(r=this.createEventListener(t,e,n),s.set(i,r)),r}createEventListener(e,n,s){const i=new t(e,n,s);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const n=[t];return Object.keys(e).sort().forEach((t=>{n.push(`${e[t]?"":"!"}${t}`)})),n.join(":")}}const n={stop:({event:t,value:e})=>(e&&t.stopPropagation(),!0),prevent:({event:t,value:e})=>(e&&t.preventDefault(),!0),self:({event:t,value:e,element:n})=>!e||n===t.target},s=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function i(t){return"window"==t?window:"document"==t?document:void 0}function r(t){return t.replace(/(?:[_-])([a-z0-9])/g,((t,e)=>e.toUpperCase()))}function o(t){return r(t.replace(/--/g,"-").replace(/__/g,"_"))}function a(t){return t.charAt(0).toUpperCase()+t.slice(1)}function l(t){return t.replace(/([A-Z])/g,((t,e)=>`-${e.toLowerCase()}`))}class c{constructor(t,e,n,s){this.element=t,this.index=e,this.eventTarget=n.eventTarget||t,this.eventName=n.eventName||function(t){const e=t.tagName.toLowerCase();if(e in h)return h[e](t)}(t)||u("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||u("missing identifier"),this.methodName=n.methodName||u("missing method name"),this.keyFilter=n.keyFilter||"",this.schema=s}static forToken(t,e){return new this(t.element,t.index,function(t){const e=t.trim().match(s)||[];let n=e[1],r=e[2];return r&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${r}`,r=""),{eventTarget:i(e[3]),eventName:n,eventOptions:e[6]?(o=e[6],o.split(":").reduce(((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)})),{})):{},identifier:e[4],methodName:e[5],keyFilter:r};var o}(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}isFilterTarget(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+"),n=["meta","ctrl","alt","shift"],[s,i,r,o]=n.map((t=>e.includes(t)));if(t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o)return!0;const a=e.filter((t=>!n.includes(t)))[0];return!!a&&(Object.prototype.hasOwnProperty.call(this.keyMappings,a)||u(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[a].toLowerCase()!==t.key.toLowerCase())}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:n,value:s}of Array.from(this.element.attributes)){const i=n.match(e),o=i&&i[1];o&&(t[r(o)]=d(s))}return t}get eventTargetName(){return(t=this.eventTarget)==window?"window":t==document?"document":void 0;var t}get keyMappings(){return this.schema.keyMappings}}const h={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:t=>"submit"==t.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function u(t){throw new Error(t)}function d(t){try{return JSON.parse(t)}catch(e){return t}}class f{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){this.willBeInvokedByEvent(t)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if("function"==typeof t)return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:n}=this.context.application;let s=!0;for(const[i,r]of Object.entries(this.eventOptions))if(i in n){const o=n[i];s=s&&o({name:i,value:r,event:t,element:e})}return s}invokeWithEvent(t){const{target:e,currentTarget:n}=t;try{const{params:s}=this.action,i=Object.assign(t,{params:s});this.method.call(this.controller,i),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:n,action:this.methodName})}catch(e){const{identifier:n,controller:s,element:i,index:r}=this,o={identifier:n,controller:s,element:i,index:r,event:t};this.context.handleError(e,`invoking action "${this.action}"`,o)}}willBeInvokedByEvent(t){const e=t.target;return!(t instanceof KeyboardEvent&&this.action.isFilterTarget(t))&&(this.element===e||(e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class m{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){"attributes"==t.type?this.processAttributeChange(t.target,t.attributeName):"childList"==t.type&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){const n=t;this.elements.has(n)?this.delegate.elementAttributeChanged&&this.matchElement(n)?this.delegate.elementAttributeChanged(n,e):this.removeElement(n):this.matchElement(n)&&this.addElement(n)}processRemovedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.processTree(t,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.elementIsActive(t)&&this.processTree(t,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const n of this.matchElementsInTree(t))e.call(this,n)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected==this.element.isConnected&&this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class p{constructor(t,e,n){this.attributeName=e,this.delegate=n,this.elementObserver=new m(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector));return e.concat(n)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function g(t,e){let n=t.get(e);return n||(n=new Set,t.set(e,n)),n}class v{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t.concat(Array.from(e))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t+e.size),0)}add(t,e){!function(t,e,n){g(t,e).add(n)}(this.valuesByKey,t,e)}delete(t,e){!function(t,e,n){g(t,e).delete(n),function(t,e){const n=t.get(e);null!=n&&0==n.size&&t.delete(e)}(t,e)}(this.valuesByKey,t,e)}has(t,e){const n=this.valuesByKey.get(t);return null!=n&&n.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some((e=>e.has(t)))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter((([e,n])=>n.has(t))).map((([t,e])=>t))}}class b{constructor(t,e,n,s={}){this.selector=e,this.details=s,this.elementObserver=new m(t,this),this.delegate=n,this.matchesByElement=new v}get started(){return this.elementObserver.started}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const e=t.matches(this.selector);return this.delegate.selectorMatchElement?e&&this.delegate.selectorMatchElement(t,this.details):e}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],n=Array.from(t.querySelectorAll(this.selector)).filter((t=>this.matchElement(t)));return e.concat(n)}elementMatched(t){this.selectorMatched(t)}elementUnmatched(t){this.selectorUnmatched(t)}elementAttributeChanged(t,e){const n=this.matchElement(t),s=this.matchesByElement.has(this.selector,t);!n&&s&&this.selectorUnmatched(t)}selectorMatched(t){this.delegate.selectorMatched&&(this.delegate.selectorMatched(t,this.selector,this.details),this.matchesByElement.add(this.selector,t))}selectorUnmatched(t){this.delegate.selectorUnmatched(t,this.selector,this.details),this.matchesByElement.delete(this.selector,t)}}class y{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const n=this.delegate.getStringMapKeyForAttribute(t);if(null!=n){this.stringMap.has(t)||this.stringMapKeyAdded(n,t);const s=this.element.getAttribute(t);if(this.stringMap.get(t)!=s&&this.stringMapValueChanged(s,n,e),null==s){const e=this.stringMap.get(t);this.stringMap.delete(t),e&&this.stringMapKeyRemoved(n,t,e)}else this.stringMap.set(t,s)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,n)}stringMapKeyRemoved(t,e,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((t=>t.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class A{constructor(t,e,n){this.attributeObserver=new p(t,e,this),this.delegate=n,this.tokensByElement=new v}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,n]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(n)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach((t=>this.tokenMatched(t)))}tokensUnmatched(t){t.forEach((t=>this.tokenUnmatched(t)))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),n=this.readTokensForElement(t),s=function(t,e){const n=Math.max(t.length,e.length);return Array.from({length:n},((n,s)=>[t[s],e[s]]))}(e,n).findIndex((([t,e])=>!function(t,e){return t&&e&&t.index==e.index&&t.content==e.content}(t,e)));return-1==s?[[],[]]:[e.slice(s),n.slice(s)]}readTokensForElement(t){const e=this.attributeName;return function(t,e,n){return t.trim().split(/\s+/).filter((t=>t.length)).map(((t,s)=>({element:e,attributeName:n,content:t,index:s})))}(t.getAttribute(e)||"",t,e)}}class w{constructor(t,e,n){this.tokenListObserver=new A(t,e,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:n}=this.fetchParseResultForToken(t);n&&(this.fetchValuesByTokenForElement(e).set(t,n),this.delegate.elementMatchedValue(e,n))}tokenUnmatched(t){const{element:e}=t,{value:n}=this.fetchParseResultForToken(t);n&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,n))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(t){return{error:t}}}}class E{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new w(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new f(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach((t=>this.delegate.bindingDisconnected(t,!0))),this.bindingsByAction.clear()}parseValueForToken(t){const e=c.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class O{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new y(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const n=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,n.writer(this.receiver[t]),n.writer(n.defaultValue))}stringMapValueChanged(t,e,n){const s=this.valueDescriptorNameMap[e];null!==t&&(null===n&&(n=s.writer(s.defaultValue)),this.invokeChangedCallback(e,t,n))}stringMapKeyRemoved(t,e,n){const s=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,s.writer(this.receiver[t]),n):this.invokeChangedCallback(t,s.writer(s.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:n,writer:s}of this.valueDescriptors)null==n||this.controller.data.has(t)||this.invokeChangedCallback(e,s(n),void 0)}invokeChangedCallback(t,e,n){const s=`${t}Changed`,i=this.receiver[s];if("function"==typeof i){const s=this.valueDescriptorNameMap[t];try{const t=s.reader(e);let r=n;n&&(r=s.reader(n)),i.call(this.receiver,t,r)}catch(t){throw t instanceof TypeError&&(t.message=`Stimulus Value "${this.context.identifier}.${s.name}" - ${t.message}`),t}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map((e=>t[e]))}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach((e=>{const n=this.valueDescriptorMap[e];t[n.name]=n})),t}hasValue(t){const e=`has${a(this.valueDescriptorNameMap[t].name)}`;return this.receiver[e]}}class x{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new v}start(){this.tokenListObserver||(this.tokenListObserver=new A(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var n;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetConnected(t,e))))}disconnectTarget(t,e){var n;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetDisconnected(t,e))))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function M(t,e){const n=T(t);return Array.from(n.reduce(((t,n)=>(function(t,e){const n=t[e];return Array.isArray(n)?n:[]}(n,e).forEach((e=>t.add(e))),t)),new Set))}function $(t,e){return T(t).reduce(((t,n)=>(t.push(...function(t,e){const n=t[e];return n?Object.keys(n).map((t=>[t,n[t]])):[]}(n,e)),t)),[])}function T(t){const e=[];for(;t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}class k{constructor(t,e){this.context=t,this.delegate=e,this.outletsByName=new v,this.outletElementsByName=new v,this.selectorObserverMap=new Map}start(){0===this.selectorObserverMap.size&&(this.outletDefinitions.forEach((t=>{const e=this.selector(t),n={outletName:t};e&&this.selectorObserverMap.set(t,new b(document.body,e,this,n))})),this.selectorObserverMap.forEach((t=>t.start()))),this.dependentContexts.forEach((t=>t.refresh()))}stop(){this.selectorObserverMap.size>0&&(this.disconnectAllOutlets(),this.selectorObserverMap.forEach((t=>t.stop())),this.selectorObserverMap.clear())}refresh(){this.selectorObserverMap.forEach((t=>t.refresh()))}selectorMatched(t,e,{outletName:n}){const s=this.getOutlet(t,n);s&&this.connectOutlet(s,t,n)}selectorUnmatched(t,e,{outletName:n}){const s=this.getOutletFromMap(t,n);s&&this.disconnectOutlet(s,t,n)}selectorMatchElement(t,{outletName:e}){return this.hasOutlet(t,e)&&t.matches(`[${this.context.application.schema.controllerAttribute}~=${e}]`)}connectOutlet(t,e,n){var s;this.outletElementsByName.has(n,e)||(this.outletsByName.add(n,t),this.outletElementsByName.add(n,e),null===(s=this.selectorObserverMap.get(n))||void 0===s||s.pause((()=>this.delegate.outletConnected(t,e,n))))}disconnectOutlet(t,e,n){var s;this.outletElementsByName.has(n,e)&&(this.outletsByName.delete(n,t),this.outletElementsByName.delete(n,e),null===(s=this.selectorObserverMap.get(n))||void 0===s||s.pause((()=>this.delegate.outletDisconnected(t,e,n))))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const n of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(n,e,t)}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}get outletDependencies(){const t=new v;return this.router.modules.forEach((e=>{M(e.definition.controllerConstructor,"outlets").forEach((n=>t.add(n,e.identifier)))})),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter((e=>t.includes(e.identifier)))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find((e=>e.element===t))}get scope(){return this.context.scope}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class N{constructor(t,e){this.logDebugActivity=(t,e={})=>{const{identifier:n,controller:s,element:i}=this;e=Object.assign({identifier:n,controller:s,element:i},e),this.application.logDebugActivity(this.identifier,t,e)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new E(this,this.dispatcher),this.valueObserver=new O(this,this.controller),this.targetObserver=new x(this,this),this.outletObserver=new k(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(t){this.handleError(t,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,n={}){const{identifier:s,controller:i,element:r}=this;n=Object.assign({identifier:s,controller:i,element:r},n),this.application.handleError(t,`Error ${e}`,n)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,n){this.invokeControllerMethod(`${o(n)}OutletConnected`,t,e)}outletDisconnected(t,e,n){this.invokeControllerMethod(`${o(n)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const n=this.controller;"function"==typeof n[t]&&n[t](...e)}}function C(t){return function(t,e){const n=F(t),s=function(t,e){return S(e).reduce(((n,s)=>{const i=function(t,e,n){const s=Object.getOwnPropertyDescriptor(t,n);if(!s||!("value"in s)){const t=Object.getOwnPropertyDescriptor(e,n).value;return s&&(t.get=s.get||t.get,t.set=s.set||t.set),t}}(t,e,s);return i&&Object.assign(n,{[s]:i}),n}),{})}(t.prototype,e);return Object.defineProperties(n.prototype,s),n}(t,function(t){const e=M(t,"blessings");return e.reduce(((e,n)=>{const s=n(t);for(const t in s){const n=e[t]||{};e[t]=Object.assign(n,s[t])}return e}),{})}(t))}const S="function"==typeof Object.getOwnPropertySymbols?t=>[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)]:Object.getOwnPropertyNames,F=(()=>{function t(t){function e(){return Reflect.construct(t,arguments,new.target)}return e.prototype=Object.create(t.prototype,{constructor:{value:e}}),Reflect.setPrototypeOf(e,t),e}try{return function(){const e=t((function(){this.a.call(this)}));e.prototype.a=function(){},new e}(),t}catch(t){return t=>class extends t{}}})();class L{constructor(t,e){this.application=t,this.definition=function(t){return{identifier:t.identifier,controllerConstructor:C(t.controllerConstructor)}}(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new N(this,t),this.contextsByScope.set(t,e)),e}}class D{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return e.match(/[^\s]+/g)||[]}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class B{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const n=this.getAttributeNameForKey(t);return this.element.setAttribute(n,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${l(t)}`}}class _{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,n){let s=this.warnedKeysByObject.get(t);s||(s=new Set,this.warnedKeysByObject.set(t,s)),s.has(e)||(s.add(e),this.logger.warn(n,t))}}function j(t,e){return`[${t}~="${e}"]`}class V{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findTarget(e)||this.findLegacyTarget(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllTargets(e),...this.findAllLegacyTargets(e)]),[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){return j(this.schema.targetAttributeForScope(this.identifier),t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map((e=>this.deprecate(e,t)))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return j(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:n}=this,s=this.schema.targetAttribute,i=this.schema.targetAttributeForScope(n);this.guide.warn(t,`target:${e}`,`Please replace ${s}="${n}.${e}" with ${i}="${e}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class I{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findOutlet(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllOutlets(e)]),[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter((n=>this.matchesElement(n,t,e)))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter((n=>this.matchesElement(n,t,e)))}matchesElement(t,e,n){const s=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&s.split(" ").includes(n)}}class H{constructor(t,e,n,s){this.targets=new V(this),this.classes=new D(this),this.data=new B(this),this.containsElement=t=>t.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=n,this.guide=new _(s),this.outlets=new I(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return j(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new H(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class R{constructor(t,e,n){this.element=t,this.schema=e,this.delegate=n,this.valueListObserver=new w(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:n}=t,s=this.fetchScopesByIdentifierForElement(e);let i=s.get(n);return i||(i=this.delegate.createScopeForElementAndIdentifier(e,n),s.set(n,i)),i}elementMatchedValue(t,e){const n=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,n),1==n&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const n=this.scopeReferenceCounts.get(e);n&&(this.scopeReferenceCounts.set(e,n-1),1==n&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class K{constructor(t){this.application=t,this.scopeObserver=new R(this.element,this.schema,this),this.scopesByIdentifier=new v,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((t,e)=>t.concat(e.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new L(this.application,t);this.connectModule(e);const n=t.controllerConstructor.afterLoad;n&&n(t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const n=this.modulesByIdentifier.get(e);if(n)return n.contexts.find((e=>e.element==t))}handleError(t,e,n){this.application.handleError(t,e,n)}createScopeForElementAndIdentifier(t,e){return new H(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.connectContextForScope(e)))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.disconnectContextForScope(e)))}}const P={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:t=>`data-${t}-target`,outletAttributeForScope:(t,e)=>`data-${t}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End"},U("abcdefghijklmnopqrstuvwxyz".split("").map((t=>[t,t])))),U("0123456789".split("").map((t=>[t,t]))))};function U(t){return t.reduce(((t,[e,n])=>Object.assign(Object.assign({},t),{[e]:n})),{})}function W([t,e],n){return function(t){const e=`${l(t.token)}-value`,n=function(t){const e=function(t){const e=q(t.typeObject.type);if(!e)return;const n=z(t.typeObject.default);if(e!==n){const s=t.controller?`${t.controller}.${t.token}`:t.token;throw new Error(`The specified default value for the Stimulus Value "${s}" must match the defined type "${e}". The provided default value of "${t.typeObject.default}" is of type "${n}".`)}return e}({controller:t.controller,token:t.token,typeObject:t.typeDefinition}),n=z(t.typeDefinition),s=q(t.typeDefinition),i=e||n||s;if(i)return i;const r=t.controller?`${t.controller}.${t.typeDefinition}`:t.token;throw new Error(`Unknown value type "${r}" for "${t.token}" value`)}(t);return{type:n,key:e,name:r(e),get defaultValue(){return function(t){const e=q(t);if(e)return Z[e];const n=t.default;return void 0!==n?n:t}(t.typeDefinition)},get hasCustomDefaultValue(){return void 0!==z(t.typeDefinition)},reader:Y[n],writer:J[n]||J.default}}({controller:n,token:t,typeDefinition:e})}function q(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function z(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(t)?"array":"[object Object]"===Object.prototype.toString.call(t)?"object":void 0}const Z={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Y={array(t){const e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${t}" of type "${z(e)}"`);return e},boolean:t=>!("0"==t||"false"==String(t).toLowerCase()),number:t=>Number(t),object(t){const e=JSON.parse(t);if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${t}" of type "${z(e)}"`);return e},string:t=>t},J={default:function(t){return`${t}`},array:G,object:G};function G(t){return JSON.stringify(t)}class X{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:n={},prefix:s=this.identifier,bubbles:i=!0,cancelable:r=!0}={}){const o=new CustomEvent(s?`${s}:${t}`:t,{detail:n,bubbles:i,cancelable:r});return e.dispatchEvent(o),o}}
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- var Q;X.blessings=[function(t){return M(t,"classes").reduce(((t,e)=>{return Object.assign(t,{[`${n=e}Class`]:{get(){const{classes:t}=this;if(t.has(n))return t.get(n);{const e=t.getAttributeName(n);throw new Error(`Missing attribute "${e}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${a(n)}Class`]:{get(){return this.classes.has(n)}}});var n}),{})},function(t){return M(t,"targets").reduce(((t,e)=>{return Object.assign(t,{[`${n=e}Target`]:{get(){const t=this.targets.find(n);if(t)return t;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${a(n)}Target`]:{get(){return this.targets.has(n)}}});var n}),{})},function(t){const e=$(t,"values"),n={valueDescriptorMap:{get(){return e.reduce(((t,e)=>{const n=W(e,this.identifier),s=this.data.getAttributeNameForKey(n.key);return Object.assign(t,{[s]:n})}),{})}}};return e.reduce(((t,e)=>Object.assign(t,function(t,e){const n=W(t,e),{key:s,name:i,reader:r,writer:o}=n;return{[i]:{get(){const t=this.data.get(s);return null!==t?r(t):n.defaultValue},set(t){void 0===t?this.data.delete(s):this.data.set(s,o(t))}},[`has${a(i)}`]:{get(){return this.data.has(s)||n.hasCustomDefaultValue}}}}(e))),n)},function(t){return M(t,"outlets").reduce(((t,e)=>Object.assign(t,function(t){const e=o(t);return{[`${e}Outlet`]:{get(){const e=this.outlets.find(t);if(e){const n=this.application.getControllerForElementAndIdentifier(e,t);if(n)return n;throw new Error(`Missing "data-controller=${t}" attribute on outlet element for "${this.identifier}" controller`)}throw new Error(`Missing outlet element "${t}" for "${this.identifier}" controller`)}},[`${e}Outlets`]:{get(){const e=this.outlets.findAll(t);return e.length>0?e.map((e=>{const n=this.application.getControllerForElementAndIdentifier(e,t);if(n)return n;console.warn(`The provided outlet element is missing the outlet controller "${t}" for "${this.identifier}"`,e)})).filter((t=>t)):[]}},[`${e}OutletElement`]:{get(){const e=this.outlets.find(t);if(e)return e;throw new Error(`Missing outlet element "${t}" for "${this.identifier}" controller`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(t)}},[`has${a(e)}Outlet`]:{get(){return this.outlets.has(t)}}}}(e))),{})}],X.targets=[],X.outlets=[],X.values={};const tt=window,et=tt.trustedTypes,nt=et?et.createPolicy("lit-html",{createHTML:t=>t}):void 0,st="$lit$",it=`lit$${(Math.random()+"").slice(9)}$`,rt="?"+it,ot=`<${rt}>`,at=document,lt=()=>at.createComment(""),ct=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ht=Array.isArray,ut="[ \t\n\f\r]",dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ft=/-->/g,mt=/>/g,pt=RegExp(`>|${ut}(?:([^\\s"'>=/]+)(${ut}*=${ut}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),gt=/'/g,vt=/"/g,bt=/^(?:script|style|textarea|title)$/i,yt=(t=>(e,...n)=>({_$litType$:t,strings:e,values:n}))(1),At=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),Et=new WeakMap,Ot=at.createTreeWalker(at,129,null,!1);function xt(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==nt?nt.createHTML(e):e}const Mt=(t,e)=>{const n=t.length-1,s=[];let i,r=2===e?"<svg>":"",o=dt;for(let e=0;e<n;e++){const n=t[e];let a,l,c=-1,h=0;for(;h<n.length&&(o.lastIndex=h,l=o.exec(n),null!==l);)h=o.lastIndex,o===dt?"!--"===l[1]?o=ft:void 0!==l[1]?o=mt:void 0!==l[2]?(bt.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=pt):void 0!==l[3]&&(o=pt):o===pt?">"===l[0]?(o=null!=i?i:dt,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?pt:'"'===l[3]?vt:gt):o===vt||o===gt?o=pt:o===ft||o===mt?o=dt:(o=pt,i=void 0);const u=o===pt&&t[e+1].startsWith("/>")?" ":"";r+=o===dt?n+ot:c>=0?(s.push(a),n.slice(0,c)+st+n.slice(c)+it+u):n+it+(-2===c?(s.push(void 0),e):u)}return[xt(t,r+(t[n]||"<?>")+(2===e?"</svg>":"")),s]};class $t{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let i=0,r=0;const o=t.length-1,a=this.parts,[l,c]=Mt(t,e);if(this.el=$t.createElement(l,n),Ot.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=Ot.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith(st)||e.startsWith(it)){const n=c[r++];if(t.push(e),void 0!==n){const t=s.getAttribute(n.toLowerCase()+st).split(it),e=/([.?@])?(.*)/.exec(n);a.push({type:1,index:i,name:e[2],strings:t,ctor:"."===e[1]?St:"?"===e[1]?Lt:"@"===e[1]?Dt:Ct})}else a.push({type:6,index:i})}for(const e of t)s.removeAttribute(e)}if(bt.test(s.tagName)){const t=s.textContent.split(it),e=t.length-1;if(e>0){s.textContent=et?et.emptyScript:"";for(let n=0;n<e;n++)s.append(t[n],lt()),Ot.nextNode(),a.push({type:2,index:++i});s.append(t[e],lt())}}}else if(8===s.nodeType)if(s.data===rt)a.push({type:2,index:i});else{let t=-1;for(;-1!==(t=s.data.indexOf(it,t+1));)a.push({type:7,index:i}),t+=it.length-1}i++}}static createElement(t,e){const n=at.createElement("template");return n.innerHTML=t,n}}function Tt(t,e,n=t,s){var i,r,o,a;if(e===At)return e;let l=void 0!==s?null===(i=n._$Co)||void 0===i?void 0:i[s]:n._$Cl;const c=ct(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(r=null==l?void 0:l._$AO)||void 0===r||r.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,n,s)),void 0!==s?(null!==(o=(a=n)._$Co)&&void 0!==o?o:a._$Co=[])[s]=l:n._$Cl=l),void 0!==l&&(e=Tt(t,l._$AS(t,e.values),l,s)),e}class kt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:n},parts:s}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:at).importNode(n,!0);Ot.currentNode=i;let r=Ot.nextNode(),o=0,a=0,l=s[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new Nt(r,r.nextSibling,this,t):1===l.type?e=new l.ctor(r,l.name,l.strings,this,t):6===l.type&&(e=new Bt(r,this,t)),this._$AV.push(e),l=s[++a]}o!==(null==l?void 0:l.index)&&(r=Ot.nextNode(),o++)}return Ot.currentNode=at,i}v(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class Nt{constructor(t,e,n,s){var i;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cp=null===(i=null==s?void 0:s.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Tt(this,t,e),ct(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==At&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>ht(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wt&&ct(this._$AH)?this._$AA.nextSibling.data=t:this.$(at.createTextNode(t)),this._$AH=t}g(t){var e;const{values:n,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=$t.createElement(xt(s.h,s.h[0]),this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.v(n);else{const t=new kt(i,this),e=t.u(this.options);t.v(n),this.$(e),this._$AH=t}}_$AC(t){let e=Et.get(t.strings);return void 0===e&&Et.set(t.strings,e=new $t(t)),e}T(t){ht(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,s=0;for(const i of t)s===e.length?e.push(n=new Nt(this.k(lt()),this.k(lt()),this,this.options)):n=e[s],n._$AI(i),s++;s<e.length&&(this._$AR(n&&n._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var n;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class Ct{constructor(t,e,n,s,i){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,s){const i=this.strings;let r=!1;if(void 0===i)t=Tt(this,t,e,0),r=!ct(t)||t!==this._$AH&&t!==At,r&&(this._$AH=t);else{const s=t;let o,a;for(t=i[0],o=0;o<i.length-1;o++)a=Tt(this,s[n+o],e,o),a===At&&(a=this._$AH[o]),r||(r=!ct(a)||a!==this._$AH[o]),a===wt?t=wt:t!==wt&&(t+=(null!=a?a:"")+i[o+1]),this._$AH[o]=a}r&&!s&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class St extends Ct{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Ft=et?et.emptyScript:"";class Lt extends Ct{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Ft):this.element.removeAttribute(this.name)}}class Dt extends Ct{constructor(t,e,n,s,i){super(t,e,n,s,i),this.type=5}_$AI(t,e=this){var n;if((t=null!==(n=Tt(this,t,e,0))&&void 0!==n?n:wt)===At)return;const s=this._$AH,i=t===wt&&s!==wt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==wt&&(s===wt||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==n?n:this.element,t):this._$AH.handleEvent(t)}}class Bt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Tt(this,t)}}const _t=tt.litHtmlPolyfillSupport;null==_t||_t($t,Nt),(null!==(Q=tt.litHtmlVersions)&&void 0!==Q?Q:tt.litHtmlVersions=[]).push("2.7.5");class jt extends X{constructor(){super(...arguments),this.onBlur=t=>{this.validateField(t.target)},this.onSubmit=t=>{var e;this.validateForm()||(t.preventDefault(),null===(e=this.firstInvalidField)||void 0===e||e.focus())},this.getRenderString=t=>{const{strings:e,values:n}=t,s=[...n,""].map((t=>"object"==typeof t?this.getRenderString(t):t));return e.reduce(((t,e,n)=>t+e+s[n]),"")}}connect(){this.element.setAttribute("novalidate","true"),this.element.addEventListener("blur",this.onBlur,!0),this.element.addEventListener("submit",this.onSubmit),this.element.addEventListener("ajax:beforeSend",this.onSubmit)}disconnect(){this.element.removeEventListener("blur",this.onBlur),this.element.removeEventListener("submit",this.onSubmit),this.element.removeEventListener("ajax:beforeSend",this.onSubmit)}validateForm(){let t=!0;for(const e of this.formFields)this.shouldValidateField(e)&&!this.validateField(e)&&(t=!1);return t}validateField(t){if(!this.shouldValidateField(t))return!0;const e=t.checkValidity();return t.classList.toggle("invalid",!e),this.refreshErrorForInvalidField(t,e),e}shouldValidateField(t){return!t.disabled&&!t.classList.contains("ProseMirror")&&!["file","reset","submit","button"].includes(t.type)}refreshErrorForInvalidField(t,e){this.removeExistingErrorMessage(t),e||this.showErrorForInvalidField(t)}removeExistingErrorMessage(t){var e;const n=t.closest(".field");if(!n)return;const s=n.querySelector(".error");s&&(null===(e=null==s?void 0:s.parentNode)||void 0===e||e.removeChild(s))}showErrorForInvalidField(t){t.insertAdjacentHTML("afterend",this.buildFieldErrorHtml(t))}buildFieldErrorHtml(t){const e=yt`<p class="error">${t.validationMessage}</p>`;return this.getRenderString(e)}get formFields(){return Array.from(this.formFieldTargets)}get firstInvalidField(){return this.formFields.find((t=>!t.checkValidity()))}}function Vt(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)}var It,Ht,Rt,Kt,Pt,Ut,Wt,qt,zt,Zt,Yt,Jt,Gt,Xt,Qt;jt.targets=["formField"],"function"==typeof SuppressedError&&SuppressedError;class te extends X{constructor(){super(...arguments),It.add(this),this.outletEventsLookup=null,this.eventRecords=new Map}getOutlets(){return null}outletUpdate(t,e){}getState(){return null}connect(){this.syncOutlets()}syncOutlets(){const t=new Event("init");this.sendToOutlets(t,{data:this.getState(),eventKey:this.getEventKey(t)})}sendToOutlets(t,e={}){var n;const s=null!==(n=e.eventKey)&&void 0!==n?n:this.getEventKey(t),i=Vt(this,It,"a",Ht);if(null==i?void 0:i.length)for(const n in i){const r=i[n];if(r.isListeningForOutletEvent(s)&&!this.hasHeardEvent(t)){const n=this.identifier===r.identifier;r.outletUpdate(t,{eventKey:s,data:n?e.data:void 0})}}}isListeningForOutletEvent(t){const e=t.split("-");if(!e.length)return!1;let n=this.outletEvents;for(let t=0;t<e.length;t++){const s=e[t];if("boolean"==typeof n)return n;let i=s;if(void 0!==n["*"])i="*";else{const t=void 0!==n.domEvent;if(t&&!this.isDOMEventName(s))return!1;t&&(i="domEvent")}if(!n[i])return!1;n=n[i]}return!0}isDOMEventName(t){return te.domEvents[t]}getEventKey(t){const e=this.event_key_prefix,n=this.event_key_postfix,s=e?"-":"",i=null!=e?e:"",r=n?"-":"",o=null!=n?n:"";return`${this.identifier}-${i}${s}${t.type}${r}${o}`}hasHeardEvent(t){return!!this.eventRecords.has(t)||(this.eventRecords.set(t,!0),setTimeout((()=>this.eventRecords.delete(t))),!1)}get event_key_prefix(){return""}get event_key_postfix(){return""}get outletEvents(){return!this.outletEventsLookup&&this.hasOutletEventsValue?this.outletEventsLookup=this.outletEventsValue.reduce(((t,e)=>{let n=t;return e.split("-").forEach(((t,e,s)=>{"boolean"!=typeof n&&(e===s.length-1?n[t]=!0:void 0===n[t]&&(n[t]={}),n=n[t])})),t}),{}):this.outletEventsLookup||(this.outletEventsLookup={"*":!0}),this.outletEventsLookup}}It=new WeakSet,Ht=function(){const t=this.getOutlets();if(t)return t;const e=[];return this.hasToggleableOutlet&&e.push(...this.toggleableOutlets),this.hasOptionsOutlet&&e.push(...this.optionsOutlets),this.hasStringMatchOutlet&&e.push(...this.stringMatchOutlets),e},te.values={outletEvents:Array},te.outlets=["toggleable","options","string-match"],te.domEvents={abort:!0,afterprint:!0,animationend:!0,animationiteration:!0,animationstart:!0,beforeprint:!0,beforeunload:!0,blur:!0,canplay:!0,canplaythrough:!0,change:!0,click:!0,contextmenu:!0,copy:!0,cut:!0,dblclick:!0,drag:!0,dragend:!0,dragenter:!0,dragleave:!0,dragover:!0,dragstart:!0,drop:!0,durationchange:!0,ended:!0,error:!0,focus:!0,focusin:!0,focusout:!0,fullscreenchange:!0,fullscreenerror:!0,hashchange:!0,input:!0,invalid:!0,keydown:!0,keypress:!0,keyup:!0,load:!0,loadeddata:!0,loadedmetadata:!0,loadstart:!0,message:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseover:!0,mouseout:!0,mouseup:!0,mousewheel:!0,offline:!0,online:!0,open:!0,pagehide:!0,pageshow:!0,paste:!0,pause:!0,play:!0,playing:!0,popstate:!0,progress:!0,ratechange:!0,resize:!0,reset:!0,scroll:!0,search:!0,seeked:!0,seeking:!0,select:!0,show:!0,stalled:!0,storage:!0,submit:!0,suspend:!0,timeupdate:!0,toggle:!0,touchcancel:!0,touchend:!0,touchmove:!0,touchstart:!0,transitionend:!0,unload:!0,volumechange:!0,waiting:!0,wheel:!0};class ee extends te{constructor(){super(...arguments),Rt.add(this),this.syncedAttrsLookup=null,this.antiAttrsLookup=null}getValueForElement(t){return null}getElementsToSync(){return[]}connect(){this.syncElementAttributes()}updateAttributesForElement(t,e){const n=this.getSyncedAttrsForElement(t);(null==n?void 0:n.length)&&Vt(this,Rt,"m",Wt).call(this,t,n,e);const s=this.getAntiAttrsForElement(t);(null==s?void 0:s.length)&&Vt(this,Rt,"m",Wt).call(this,t,s,!e)}getSyncedAttrsForElement(t){const e=this.getParsedAttributeForElement(t,"data-options-synced-attrs-value");return e||(this.hasSyncedAttrsValue?this.syncedAttrsValue:null)}getAntiAttrsForElement(t){const e=this.getParsedAttributeForElement(t,"data-options-anti-attrs-value");return e||(this.hasAntiAttrsValue?this.antiAttrsValue:null)}getParsedAttributeForElement(t,e){const n=t.getAttribute(e);try{if(null===n)throw new Error("Bad attr");return JSON.parse(n)}catch(t){return null}}syncElementAttributes(){var t;this.syncOutlets();const e=this.getElementsToSync();if(null==e?void 0:e.length)for(const n in e){const s=e[n],i=null!==(t=this.getValueForElement(s))&&void 0!==t&&t;this.updateAttributesForElement(s,i)}}validateAttrChange(t){const{target:e,detail:n}=t;if(e&&n){null!==this.getValueForElement(e)&&this.protectAttrsValue&&Vt(this,Rt,"m",Ut).call(this,n.attr)&&t.preventDefault()}}doesElementHaveOnAttrs(t){if(this.hasSyncedAttrsValue)for(let e=0;e<this.syncedAttrsValue.length;e++){const n=this.syncedAttrsValue[e];if("true"===t.getAttribute(n))return!0}if(this.hasAntiAttrsValue)for(let e=0;e<this.antiAttrsValue.length;e++){const n=this.antiAttrsValue[e],s=t.getAttribute(n);if("false"===s||ee.removeOnFalseAttrs[n]&&!s)return!0}return!1}}Rt=new WeakSet,Kt=function(t){var e;return null===this.syncedAttrsLookup&&(this.syncedAttrsLookup=Vt(this,Rt,"m",qt).call(this,this.syncedAttrsValue)),null!==(e=this.syncedAttrsLookup[t])&&void 0!==e&&e},Pt=function(t){var e;return null===this.antiAttrsLookup&&(this.antiAttrsLookup=Vt(this,Rt,"m",qt).call(this,this.antiAttrsValue)),null!==(e=this.antiAttrsLookup[t])&&void 0!==e&&e},Ut=function(t){return Vt(this,Rt,"m",Pt).call(this,t)||Vt(this,Rt,"m",Kt).call(this,t)},Wt=function(t,e,n){const s=JSON.stringify(n);for(const i in e){const r=e[i];this.dispatch("attrChange",{target:t,detail:{attr:r,value:n}}).defaultPrevented||("false"===s&&ee.removeOnFalseAttrs[r]?t.removeAttribute(r):t.setAttribute(r,s))}},qt=function(t){return(null==t?void 0:t.length)?t.reduce(((t,e)=>(t[e]=!0,t)),{}):{}},ee.values=Object.assign(Object.assign({},te.values),{syncedAttrs:Array,antiAttrs:Array,protectAttrs:Boolean}),ee.removeOnFalseAttrs={checked:!0};class ne extends ee{constructor(){super(...arguments),zt.add(this),this.outletUpdate=this.change}change(t,e={}){var n;const s=null!==(n=e.data)&&void 0!==n?n:t.currentTarget.value;this.keywordValue=s,Vt(this,zt,"m",Zt).call(this),this.sendToOutlets(t,Object.assign(Object.assign({},e),{data:this.keywordValue}))}getElementsToSync(){return this.matchTargets}getValueForElement(t){var e,n;return null!==(n=null===(e=t.textContent)||void 0===e?void 0:e.toLowerCase().includes(this.keywordValue.toLowerCase()))&&void 0!==n&&n}getState(){return this.keywordValue}}zt=new WeakSet,Zt=function(){if(this.hasMatchTarget){let t=!1;for(const e in this.matchTargets){const n=this.matchTargets[e],s=this.getValueForElement(n);this.updateAttributesForElement(n,s),s&&(t=!0)}this.hasEmptyTarget&&this.emptyTarget.setAttribute("aria-hidden",String(t))}},ne.outlets=ee.outlets,ne.targets=["match","empty"],ne.values=Object.assign(Object.assign({},ee.values),{keyword:String});class se extends ee{constructor(){super(...arguments),Yt.add(this),this.outletUpdate=this.select}select(t,e={}){var n;const s=e.data;for(const e in this.optionTargets){const i=this.optionTargets[e],r=i===t.currentTarget,o=null!==(n=this.getValueForElement(i))&&void 0!==n&&n,a=Vt(this,Yt,"m",Qt).call(this,i);if(void 0!==s?!!s[a]!==o:Vt(this,Yt,"m",Jt).call(this,o,r)){const t=!o;this.updateAttributesForElement(i,t),t?Vt(this,Yt,"m",Gt).call(this,a):Vt(this,Yt,"m",Xt).call(this,a)}}this.sendToOutlets(t,Object.assign(Object.assign({},e),{data:this.activeOptionsValue}))}optionTargetConnected(t){const e=Vt(this,Yt,"m",Qt).call(this,t),n=this.activeOptionsValue[e]||this.doesElementHaveOnAttrs(t);n?Vt(this,Yt,"m",Gt).call(this,e):Vt(this,Yt,"m",Xt).call(this,e),this.updateAttributesForElement(t,n)}getValueForElement(t){var e;const n=Vt(this,Yt,"m",Qt).call(this,t);return null!==(e=this.activeOptionsValue[n])&&void 0!==e&&e}getState(){return this.activeOptionsValue}}Yt=new WeakSet,Jt=function(t,e){return!(!e&&!t)&&(!(!e&&t&&this.isMultiValue)&&!(e&&t&&!this.toggleableValue))},Gt=function(t){this.activeOptionsValue=Object.assign(Object.assign({},this.activeOptionsValue),{[t]:!0})},Xt=function(t){const e=Object.assign({},this.activeOptionsValue);delete e[t],this.activeOptionsValue=e},Qt=function(t){const e=null==t?void 0:t.getAttribute("data-option-value");if(e)return e;const n=null==t?void 0:t.textContent;if(null===n)throw new Error(`${t.tagName} was given as an options target without a data-option-value or textContent. One must be provided to identify the target.`);return n.trim()},se.outlets=ee.outlets,se.targets=["option"],se.values=Object.assign(Object.assign({},ee.values),{activeOptions:Object,isMulti:{type:Boolean,default:!1},toggleable:{type:Boolean,default:!1}});class ie extends X{connect(){this.accumulate()}accumulate(){let t=0;for(const e in this.sumTargets){const n=this.sumTargets[e],s=Number(n.getAttribute(this.sumAttrValue));isNaN(s)||(t+=s)}this.setAttributesTo(t)}setAttributesTo(t){for(const e in this.syncAttrsValue){const n=this.syncAttrsValue[e];this.accumulator.setAttribute(n,t.toString())}}get accumulator(){var t;return null!==(t=this.accumulatorTarget)&&void 0!==t?t:this.element}}ie.targets=["sum","accumulator"],ie.values={syncAttrs:{type:Array,default:["aria-valuenow"]},sumAttr:{type:"string",default:"data-value"}};const re={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},oe=(t,e={})=>{const n=t,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},re,e),a=t=>{const r=(null==e?void 0:e.element)||n.element;if(!(r.contains(t.target)||!function(t){const e=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,i=e.top<=n&&e.top+e.height>0,r=e.left<=s&&e.left+e.width>0;return i&&r}(r)&&s)&&(n.clickOutside&&n.clickOutside(t),i)){const e=((t,e,n)=>{let s=t;return!0===n?s=`${e.identifier}:${t}`:"string"==typeof n&&(s=`${n}:${t}`),s})("click:outside",n,o),s=((t,e,n)=>{const{bubbles:s,cancelable:i,composed:r}=e||{bubbles:!0,cancelable:!0,composed:!0};return e&&Object.assign(n,{originalEvent:e}),new CustomEvent(t,{bubbles:s,cancelable:i,composed:r,detail:n})})(e,t,{controller:n});r.dispatchEvent(s)}},l=()=>{null==r||r.forEach((t=>{window.addEventListener(t,a,!0)}))},c=()=>{null==r||r.forEach((t=>{window.removeEventListener(t,a,!0)}))},h=n.disconnect.bind(n);return Object.assign(n,{disconnect(){c(),h()}}),l(),[l,c]};(class extends X{}).debounces=[];(class extends X{}).throttles=[];class ae extends ee{constructor(){super(...arguments),this.outletUpdate=this.toggle}connect(){this.syncElementAttributes(),oe(this,{dispatchEvent:this.closeOnOutsideClickValue&&this.stateValue})}toggle(t,e={}){var n;const s=null!==(n=e.data)&&void 0!==n?n:!this.stateValue;this.updateAttributesForElement(this.element,s),this.stateValue=s,this.sendToOutlets(t,Object.assign(Object.assign({},e),{data:s}))}on(t){this.toggle(t,{data:!0})}off(t){this.toggle(t,{data:!1})}clickOutside(t){this.closeOnOutsideClickValue&&this.stateValue&&this.toggle(t,{data:!1})}getValueForElement(t){return t!==this.element?null:this.stateValue}getElementsToSync(){return[this.element]}getState(){return this.stateValue}get event_key_postfix(){return this.stateValue?"on":"off"}}ae.outlets=ee.outlets,ae.values=Object.assign(Object.assign({},ee.values),{state:{type:Boolean,default:!1},closeOnOutsideClick:{type:Boolean,default:!1}});class le extends X{toggle(){this.expandableTarget.classList.toggle("ariadne-hidden");for(const t of this.slidePanelTargets)t.classList.toggle("ariadne-hidden")}}le.targets=["expandable","expandWrapper","slidePanel","buttonWrapper"];class ce extends X{constructor(){super(...arguments),this.SELECTED_CLASSES=["ariadne-border-slate-500","ariadne-text-slate-600"],this.UNSELECTED_CLASSES=["ariadne-text-gray-500","hover:ariadne-text-gray-700","hover:ariadne-border-gray-300"]}connect(){for(const t of this.tabTargets)t.hasAttribute("aria-current")&&(t.classList.add(...this.SELECTED_CLASSES),t.classList.remove(...this.UNSELECTED_CLASSES))}toggle(t){for(const e of this.tabTargets)e===t.target?(e.setAttribute("aria-current","page"),e.classList.add(...this.SELECTED_CLASSES),e.classList.remove(...this.UNSELECTED_CLASSES)):e.hasAttribute("aria-current")&&(e.removeAttribute("aria-current"),e.classList.add(...this.UNSELECTED_CLASSES),e.classList.remove(...this.SELECTED_CLASSES))}}ce.targets=["tab"];var he="top",ue="bottom",de="right",fe="left",me="auto",pe=[he,ue,de,fe],ge="start",ve="end",be="clippingParents",ye="viewport",Ae="popper",we="reference",Ee=pe.reduce((function(t,e){return t.concat([e+"-"+ge,e+"-"+ve])}),[]),Oe=[].concat(pe,[me]).reduce((function(t,e){return t.concat([e,e+"-"+ge,e+"-"+ve])}),[]),xe=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Me(t){return t?(t.nodeName||"").toLowerCase():null}function $e(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Te(t){return t instanceof $e(t).Element||t instanceof Element}function ke(t){return t instanceof $e(t).HTMLElement||t instanceof HTMLElement}function Ne(t){return"undefined"!=typeof ShadowRoot&&(t instanceof $e(t).ShadowRoot||t instanceof ShadowRoot)}var Ce={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},s=e.attributes[t]||{},i=e.elements[t];ke(i)&&Me(i)&&(Object.assign(i.style,n),Object.keys(s).forEach((function(t){var e=s[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var s=e.elements[t],i=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});ke(s)&&Me(s)&&(Object.assign(s.style,r),Object.keys(i).forEach((function(t){s.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Se(t){return t.split("-")[0]}var Fe=Math.max,Le=Math.min,De=Math.round;function Be(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function _e(){return!/^((?!chrome|android).)*safari/i.test(Be())}function je(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var s=t.getBoundingClientRect(),i=1,r=1;e&&ke(t)&&(i=t.offsetWidth>0&&De(s.width)/t.offsetWidth||1,r=t.offsetHeight>0&&De(s.height)/t.offsetHeight||1);var o=(Te(t)?$e(t):window).visualViewport,a=!_e()&&n,l=(s.left+(a&&o?o.offsetLeft:0))/i,c=(s.top+(a&&o?o.offsetTop:0))/r,h=s.width/i,u=s.height/r;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Ve(t){var e=je(t),n=t.offsetWidth,s=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-s)<=1&&(s=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:s}}function Ie(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Ne(n)){var s=e;do{if(s&&t.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function He(t){return $e(t).getComputedStyle(t)}function Re(t){return["table","td","th"].indexOf(Me(t))>=0}function Ke(t){return((Te(t)?t.ownerDocument:t.document)||window.document).documentElement}function Pe(t){return"html"===Me(t)?t:t.assignedSlot||t.parentNode||(Ne(t)?t.host:null)||Ke(t)}function Ue(t){return ke(t)&&"fixed"!==He(t).position?t.offsetParent:null}function We(t){for(var e=$e(t),n=Ue(t);n&&Re(n)&&"static"===He(n).position;)n=Ue(n);return n&&("html"===Me(n)||"body"===Me(n)&&"static"===He(n).position)?e:n||function(t){var e=/firefox/i.test(Be());if(/Trident/i.test(Be())&&ke(t)&&"fixed"===He(t).position)return null;var n=Pe(t);for(Ne(n)&&(n=n.host);ke(n)&&["html","body"].indexOf(Me(n))<0;){var s=He(n);if("none"!==s.transform||"none"!==s.perspective||"paint"===s.contain||-1!==["transform","perspective"].indexOf(s.willChange)||e&&"filter"===s.willChange||e&&s.filter&&"none"!==s.filter)return n;n=n.parentNode}return null}(t)||e}function qe(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ze(t,e,n){return Fe(t,Le(e,n))}function Ze(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Ye(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}var Je={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,s=t.name,i=t.options,r=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Se(n.placement),l=qe(a),c=[fe,de].indexOf(a)>=0?"height":"width";if(r&&o){var h=function(t,e){return Ze("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Ye(t,pe))}(i.padding,n),u=Ve(r),d="y"===l?he:fe,f="y"===l?ue:de,m=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],p=o[l]-n.rects.reference[l],g=We(r),v=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,b=m/2-p/2,y=h[d],A=v-u[c]-h[f],w=v/2-u[c]/2+b,E=ze(y,w,A),O=l;n.modifiersData[s]=((e={})[O]=E,e.centerOffset=E-w,e)}},effect:function(t){var e=t.state,n=t.options.element,s=void 0===n?"[data-popper-arrow]":n;null!=s&&("string"!=typeof s||(s=e.elements.popper.querySelector(s)))&&Ie(e.elements.popper,s)&&(e.elements.arrow=s)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ge(t){return t.split("-")[1]}var Xe={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Qe(t){var e,n=t.popper,s=t.popperRect,i=t.placement,r=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,u=t.isFixed,d=o.x,f=void 0===d?0:d,m=o.y,p=void 0===m?0:m,g="function"==typeof h?h({x:f,y:p}):{x:f,y:p};f=g.x,p=g.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=fe,A=he,w=window;if(c){var E=We(n),O="clientHeight",x="clientWidth";if(E===$e(n)&&"static"!==He(E=Ke(n)).position&&"absolute"===a&&(O="scrollHeight",x="scrollWidth"),i===he||(i===fe||i===de)&&r===ve)A=ue,p-=(u&&E===w&&w.visualViewport?w.visualViewport.height:E[O])-s.height,p*=l?1:-1;if(i===fe||(i===he||i===ue)&&r===ve)y=de,f-=(u&&E===w&&w.visualViewport?w.visualViewport.width:E[x])-s.width,f*=l?1:-1}var M,$=Object.assign({position:a},c&&Xe),T=!0===h?function(t,e){var n=t.x,s=t.y,i=e.devicePixelRatio||1;return{x:De(n*i)/i||0,y:De(s*i)/i||0}}({x:f,y:p},$e(n)):{x:f,y:p};return f=T.x,p=T.y,l?Object.assign({},$,((M={})[A]=b?"0":"",M[y]=v?"0":"",M.transform=(w.devicePixelRatio||1)<=1?"translate("+f+"px, "+p+"px)":"translate3d("+f+"px, "+p+"px, 0)",M)):Object.assign({},$,((e={})[A]=b?p+"px":"",e[y]=v?f+"px":"",e.transform="",e))}var tn={passive:!0};var en={left:"right",right:"left",bottom:"top",top:"bottom"};function nn(t){return t.replace(/left|right|bottom|top/g,(function(t){return en[t]}))}var sn={start:"end",end:"start"};function rn(t){return t.replace(/start|end/g,(function(t){return sn[t]}))}function on(t){var e=$e(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function an(t){return je(Ke(t)).left+on(t).scrollLeft}function ln(t){var e=He(t),n=e.overflow,s=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+s)}function cn(t){return["html","body","#document"].indexOf(Me(t))>=0?t.ownerDocument.body:ke(t)&&ln(t)?t:cn(Pe(t))}function hn(t,e){var n;void 0===e&&(e=[]);var s=cn(t),i=s===(null==(n=t.ownerDocument)?void 0:n.body),r=$e(s),o=i?[r].concat(r.visualViewport||[],ln(s)?s:[]):s,a=e.concat(o);return i?a:a.concat(hn(Pe(o)))}function un(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function dn(t,e,n){return e===ye?un(function(t,e){var n=$e(t),s=Ke(t),i=n.visualViewport,r=s.clientWidth,o=s.clientHeight,a=0,l=0;if(i){r=i.width,o=i.height;var c=_e();(c||!c&&"fixed"===e)&&(a=i.offsetLeft,l=i.offsetTop)}return{width:r,height:o,x:a+an(t),y:l}}(t,n)):Te(e)?function(t,e){var n=je(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(e,n):un(function(t){var e,n=Ke(t),s=on(t),i=null==(e=t.ownerDocument)?void 0:e.body,r=Fe(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=Fe(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-s.scrollLeft+an(t),l=-s.scrollTop;return"rtl"===He(i||n).direction&&(a+=Fe(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Ke(t)))}function fn(t,e,n,s){var i="clippingParents"===e?function(t){var e=hn(Pe(t)),n=["absolute","fixed"].indexOf(He(t).position)>=0&&ke(t)?We(t):t;return Te(n)?e.filter((function(t){return Te(t)&&Ie(t,n)&&"body"!==Me(t)})):[]}(t):[].concat(e),r=[].concat(i,[n]),o=r[0],a=r.reduce((function(e,n){var i=dn(t,n,s);return e.top=Fe(i.top,e.top),e.right=Le(i.right,e.right),e.bottom=Le(i.bottom,e.bottom),e.left=Fe(i.left,e.left),e}),dn(t,o,s));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mn(t){var e,n=t.reference,s=t.element,i=t.placement,r=i?Se(i):null,o=i?Ge(i):null,a=n.x+n.width/2-s.width/2,l=n.y+n.height/2-s.height/2;switch(r){case he:e={x:a,y:n.y-s.height};break;case ue:e={x:a,y:n.y+n.height};break;case de:e={x:n.x+n.width,y:l};break;case fe:e={x:n.x-s.width,y:l};break;default:e={x:n.x,y:n.y}}var c=r?qe(r):null;if(null!=c){var h="y"===c?"height":"width";switch(o){case ge:e[c]=e[c]-(n[h]/2-s[h]/2);break;case ve:e[c]=e[c]+(n[h]/2-s[h]/2)}}return e}function pn(t,e){void 0===e&&(e={});var n=e,s=n.placement,i=void 0===s?t.placement:s,r=n.strategy,o=void 0===r?t.strategy:r,a=n.boundary,l=void 0===a?be:a,c=n.rootBoundary,h=void 0===c?ye:c,u=n.elementContext,d=void 0===u?Ae:u,f=n.altBoundary,m=void 0!==f&&f,p=n.padding,g=void 0===p?0:p,v=Ze("number"!=typeof g?g:Ye(g,pe)),b=d===Ae?we:Ae,y=t.rects.popper,A=t.elements[m?b:d],w=fn(Te(A)?A:A.contextElement||Ke(t.elements.popper),l,h,o),E=je(t.elements.reference),O=mn({reference:E,element:y,strategy:"absolute",placement:i}),x=un(Object.assign({},y,O)),M=d===Ae?x:E,$={top:w.top-M.top+v.top,bottom:M.bottom-w.bottom+v.bottom,left:w.left-M.left+v.left,right:M.right-w.right+v.right},T=t.modifiersData.offset;if(d===Ae&&T){var k=T[i];Object.keys($).forEach((function(t){var e=[de,ue].indexOf(t)>=0?1:-1,n=[he,ue].indexOf(t)>=0?"y":"x";$[t]+=k[n]*e}))}return $}function gn(t,e){void 0===e&&(e={});var n=e,s=n.placement,i=n.boundary,r=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?Oe:l,h=Ge(s),u=h?a?Ee:Ee.filter((function(t){return Ge(t)===h})):pe,d=u.filter((function(t){return c.indexOf(t)>=0}));0===d.length&&(d=u);var f=d.reduce((function(e,n){return e[n]=pn(t,{placement:n,boundary:i,rootBoundary:r,padding:o})[Se(n)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}var vn={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,s=t.name;if(!e.modifiersData[s]._skip){for(var i=n.mainAxis,r=void 0===i||i,o=n.altAxis,a=void 0===o||o,l=n.fallbackPlacements,c=n.padding,h=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.flipVariations,m=void 0===f||f,p=n.allowedAutoPlacements,g=e.options.placement,v=Se(g),b=l||(v===g||!m?[nn(g)]:function(t){if(Se(t)===me)return[];var e=nn(t);return[rn(t),e,rn(e)]}(g)),y=[g].concat(b).reduce((function(t,n){return t.concat(Se(n)===me?gn(e,{placement:n,boundary:h,rootBoundary:u,padding:c,flipVariations:m,allowedAutoPlacements:p}):n)}),[]),A=e.rects.reference,w=e.rects.popper,E=new Map,O=!0,x=y[0],M=0;M<y.length;M++){var $=y[M],T=Se($),k=Ge($)===ge,N=[he,ue].indexOf(T)>=0,C=N?"width":"height",S=pn(e,{placement:$,boundary:h,rootBoundary:u,altBoundary:d,padding:c}),F=N?k?de:fe:k?ue:he;A[C]>w[C]&&(F=nn(F));var L=nn(F),D=[];if(r&&D.push(S[T]<=0),a&&D.push(S[F]<=0,S[L]<=0),D.every((function(t){return t}))){x=$,O=!1;break}E.set($,D)}if(O)for(var B=function(t){var e=y.find((function(e){var n=E.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return x=e,"break"},_=m?3:1;_>0;_--){if("break"===B(_))break}e.placement!==x&&(e.modifiersData[s]._skip=!0,e.placement=x,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function bn(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yn(t){return[he,de,ue,fe].some((function(e){return t[e]>=0}))}var An={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,s=t.name,i=n.offset,r=void 0===i?[0,0]:i,o=Oe.reduce((function(t,n){return t[n]=function(t,e,n){var s=Se(t),i=[fe,he].indexOf(s)>=0?-1:1,r="function"==typeof n?n(Object.assign({},e,{placement:t})):n,o=r[0],a=r[1];return o=o||0,a=(a||0)*i,[fe,de].indexOf(s)>=0?{x:a,y:o}:{x:o,y:a}}(n,e.rects,r),t}),{}),a=o[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[s]=o}};var wn={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,s=t.name,i=n.mainAxis,r=void 0===i||i,o=n.altAxis,a=void 0!==o&&o,l=n.boundary,c=n.rootBoundary,h=n.altBoundary,u=n.padding,d=n.tether,f=void 0===d||d,m=n.tetherOffset,p=void 0===m?0:m,g=pn(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:h}),v=Se(e.placement),b=Ge(e.placement),y=!b,A=qe(v),w="x"===A?"y":"x",E=e.modifiersData.popperOffsets,O=e.rects.reference,x=e.rects.popper,M="function"==typeof p?p(Object.assign({},e.rects,{placement:e.placement})):p,$="number"==typeof M?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),T=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(E){if(r){var N,C="y"===A?he:fe,S="y"===A?ue:de,F="y"===A?"height":"width",L=E[A],D=L+g[C],B=L-g[S],_=f?-x[F]/2:0,j=b===ge?O[F]:x[F],V=b===ge?-x[F]:-O[F],I=e.elements.arrow,H=f&&I?Ve(I):{width:0,height:0},R=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},K=R[C],P=R[S],U=ze(0,O[F],H[F]),W=y?O[F]/2-_-U-K-$.mainAxis:j-U-K-$.mainAxis,q=y?-O[F]/2+_+U+P+$.mainAxis:V+U+P+$.mainAxis,z=e.elements.arrow&&We(e.elements.arrow),Z=z?"y"===A?z.clientTop||0:z.clientLeft||0:0,Y=null!=(N=null==T?void 0:T[A])?N:0,J=L+q-Y,G=ze(f?Le(D,L+W-Y-Z):D,L,f?Fe(B,J):B);E[A]=G,k[A]=G-L}if(a){var X,Q="x"===A?he:fe,tt="x"===A?ue:de,et=E[w],nt="y"===w?"height":"width",st=et+g[Q],it=et-g[tt],rt=-1!==[he,fe].indexOf(v),ot=null!=(X=null==T?void 0:T[w])?X:0,at=rt?st:et-O[nt]-x[nt]-ot+$.altAxis,lt=rt?et+O[nt]+x[nt]-ot-$.altAxis:it,ct=f&&rt?function(t,e,n){var s=ze(t,e,n);return s>n?n:s}(at,et,lt):ze(f?at:st,et,f?lt:it);E[w]=ct,k[w]=ct-et}e.modifiersData[s]=k}},requiresIfExists:["offset"]};function En(t,e,n){void 0===n&&(n=!1);var s,i,r=ke(e),o=ke(e)&&function(t){var e=t.getBoundingClientRect(),n=De(e.width)/t.offsetWidth||1,s=De(e.height)/t.offsetHeight||1;return 1!==n||1!==s}(e),a=Ke(e),l=je(t,o,n),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(r||!r&&!n)&&(("body"!==Me(e)||ln(a))&&(c=(s=e)!==$e(s)&&ke(s)?{scrollLeft:(i=s).scrollLeft,scrollTop:i.scrollTop}:on(s)),ke(e)?((h=je(e,!0)).x+=e.clientLeft,h.y+=e.clientTop):a&&(h.x=an(a))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function On(t){var e=new Map,n=new Set,s=[];function i(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var s=e.get(t);s&&i(s)}})),s.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||i(t)})),s}var xn={placement:"bottom",modifiers:[],strategy:"absolute"};function Mn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function $n(t){void 0===t&&(t={});var e=t,n=e.defaultModifiers,s=void 0===n?[]:n,i=e.defaultOptions,r=void 0===i?xn:i;return function(t,e,n){void 0===n&&(n=r);var i,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},xn,r),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,h={state:a,setOptions:function(n){var i="function"==typeof n?n(a.options):n;u(),a.options=Object.assign({},r,a.options,i),a.scrollParents={reference:Te(t)?hn(t):t.contextElement?hn(t.contextElement):[],popper:hn(e)};var o,c,d=function(t){var e=On(t);return xe.reduce((function(t,n){return t.concat(e.filter((function(t){return t.phase===n})))}),[])}((o=[].concat(s,a.options.modifiers),c=o.reduce((function(t,e){var n=t[e.name];return t[e.name]=n?Object.assign({},n,e,{options:Object.assign({},n.options,e.options),data:Object.assign({},n.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return a.orderedModifiers=d.filter((function(t){return t.enabled})),a.orderedModifiers.forEach((function(t){var e=t.name,n=t.options,s=void 0===n?{}:n,i=t.effect;if("function"==typeof i){var r=i({state:a,name:e,instance:h,options:s}),o=function(){};l.push(r||o)}})),h.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,n=t.popper;if(Mn(e,n)){a.rects={reference:En(e,We(n),"fixed"===a.options.strategy),popper:Ve(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(t){return a.modifiersData[t.name]=Object.assign({},t.data)}));for(var s=0;s<a.orderedModifiers.length;s++)if(!0!==a.reset){var i=a.orderedModifiers[s],r=i.fn,o=i.options,l=void 0===o?{}:o,u=i.name;"function"==typeof r&&(a=r({state:a,options:l,name:u,instance:h})||a)}else a.reset=!1,s=-1}}},update:(i=function(){return new Promise((function(t){h.forceUpdate(),t(a)}))},function(){return o||(o=new Promise((function(t){Promise.resolve().then((function(){o=void 0,t(i())}))}))),o}),destroy:function(){u(),c=!0}};if(!Mn(t,e))return h;function u(){l.forEach((function(t){return t()})),l=[]}return h.setOptions(n).then((function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)})),h}}var Tn=$n({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,s=t.options,i=s.scroll,r=void 0===i||i,o=s.resize,a=void 0===o||o,l=$e(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&c.forEach((function(t){t.addEventListener("scroll",n.update,tn)})),a&&l.addEventListener("resize",n.update,tn),function(){r&&c.forEach((function(t){t.removeEventListener("scroll",n.update,tn)})),a&&l.removeEventListener("resize",n.update,tn)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=mn({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,s=n.gpuAcceleration,i=void 0===s||s,r=n.adaptive,o=void 0===r||r,a=n.roundOffsets,l=void 0===a||a,c={placement:Se(e.placement),variation:Ge(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Qe(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Qe(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},Ce,An,vn,wn,Je,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,s=e.rects.reference,i=e.rects.popper,r=e.modifiersData.preventOverflow,o=pn(e,{elementContext:"reference"}),a=pn(e,{altBoundary:!0}),l=bn(o,s),c=bn(a,i,r),h=yn(l),u=yn(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}}]});class kn extends X{connect(){this.popperInstance=Tn(this.triggerTarget,this.tooltipTarget,{placement:this.placementValue,modifiers:[{name:"offset",options:{offset:this.offsetValue}}]})}disconnect(){this.popperInstance&&this.popperInstance.destroy()}show(){this.tooltipTarget.setAttribute("data-tooltip-show",""),this.tooltipTarget.classList.remove("ariadne-invisible"),this.popperInstance.update(),this.dispatch("shown",{detail:{trigger:this.triggerTarget,tooltip:this.tooltipTarget}})}hide(){this.tooltipTarget.removeAttribute("data-tooltip-show"),this.tooltipTarget.classList.add("ariadne-invisible"),this.dispatch("ariadne-hidden",{detail:{trigger:this.triggerTarget,tooltip:this.tooltipTarget}})}}function Nn(t){return Array.from(t.querySelectorAll('[role="tablist"] [role="tab"]')).filter((e=>e instanceof HTMLElement&&e.closest(t.tagName)===t))}kn.targets=["trigger","tooltip"],kn.values={placement:{type:String,default:"top"},offset:{type:Array,default:[0,8]}};class Cn extends HTMLElement{static define(t="tab-container",e=customElements){return e.define(t,this),this}connectedCallback(){this.addEventListener("keydown",(t=>{var e;const n=t.target;if(!(n instanceof HTMLElement))return;if(n.closest(this.tagName)!==this)return;if("tab"!==n.getAttribute("role")&&!n.closest('[role="tablist"]'))return;const s=Nn(this),i=s.indexOf(s.find((t=>t.matches('[aria-selected="true"]')))),[r,o]="vertical"===(null===(e=n.closest('[role="tablist"]'))||void 0===e?void 0:e.getAttribute("aria-orientation"))?[["ArrowDown","ArrowRight"],["ArrowUp","ArrowLeft"]]:[["ArrowRight"],["ArrowLeft"]];if(r.some((e=>t.code===e))){let t=i+1;t>=s.length&&(t=0),this.selectTab(t)}else if(o.some((e=>t.code===e))){let t=i-1;t<0&&(t=s.length-1),this.selectTab(t)}else"Home"===t.code?(this.selectTab(0),t.preventDefault()):"End"===t.code&&(this.selectTab(s.length-1),t.preventDefault())})),this.addEventListener("click",(t=>{const e=Nn(this);if(!(t.target instanceof Element))return;if(t.target.closest(this.tagName)!==this)return;const n=t.target.closest('[role="tab"]');if(!(n instanceof HTMLElement&&n.closest('[role="tablist"]')))return;const s=e.indexOf(n);this.selectTab(s)}));for(const t of Nn(this))t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false"),t.hasAttribute("tabindex")||("true"===t.getAttribute("aria-selected")?t.setAttribute("tabindex","0"):t.setAttribute("tabindex","-1"))}selectTab(t){const e=Nn(this),n=Array.from(this.querySelectorAll('[role="tabpanel"]')).filter((t=>t.closest(this.tagName)===this));if(t>e.length-1)throw new RangeError(`Index "${t}" out of bounds`);const s=e[t],i=n[t];if(!!this.dispatchEvent(new CustomEvent("tab-container-change",{bubbles:!0,cancelable:!0,detail:{relatedTarget:i}}))){for(const t of e)t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");for(const t of n)t.hidden=!0,t.hasAttribute("tabindex")||t.hasAttribute("data-tab-container-no-tabstop")||t.setAttribute("tabindex","0");s.setAttribute("aria-selected","true"),s.setAttribute("tabindex","0"),s.focus(),i.hidden=!1,this.dispatchEvent(new CustomEvent("tab-container-changed",{bubbles:!0,detail:{relatedTarget:i}}))}}}const Sn="undefined"!=typeof globalThis?globalThis:window;try{Sn.TabContainerElement=Cn.define()}catch(nt){if(!(Sn.DOMException&&nt instanceof DOMException&&"NotSupportedError"===nt.name||nt instanceof ReferenceError))throw nt}const Fn=["ariadne-border-slate-500","ariadne-text-slate-600"],Ln=["ariadne-text-gray-500","hover:ariadne-text-gray-700","hover:ariadne-border-gray-300"];for(const t of document.getElementsByTagName("tab-container"))t.addEventListener("tab-container-change",(function(t){var e;const n=t.detail.relatedTarget,s=n.closest("tab-container").firstElementChild,i=s.querySelector('[aria-selected="true"]'),r=null===(e=n.getAttribute("id"))||void 0===e?void 0:e.split("-").slice(1).join("-"),o=s.querySelector(`#${r}`);i.classList.remove(...Fn),i.classList.add(...Ln),o.classList.add(...Fn),o.classList.remove(...Ln)}));const Dn=["second","minute","hour","day","month","year"];const Bn=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;class _n{constructor(t=0,e=0,n=0,s=0,i=0,r=0,o=0){this.years=t,this.months=e,this.weeks=n,this.days=s,this.hours=i,this.minutes=r,this.seconds=o}abs(){return new _n(Math.abs(this.years),Math.abs(this.months),Math.abs(this.weeks),Math.abs(this.days),Math.abs(this.hours),Math.abs(this.minutes),Math.abs(this.seconds))}static from(t){var e;if("string"==typeof t){const n=String(t).trim(),s=n.startsWith("-")?-1:1,i=null===(e=n.match(Bn))||void 0===e?void 0:e.slice(1).map((t=>(Number(t)||0)*s));return i?new _n(...i):new _n}if("object"==typeof t){const{years:e,months:n,weeks:s,days:i,hours:r,minutes:o,seconds:a}=t;return new _n(e,n,s,i,r,o,a)}throw new RangeError("invalid duration")}}function jn(t,e,n){const s=function(t,e){const n=new Date(t);return n.setFullYear(n.getFullYear()+e.years),n.setMonth(n.getMonth()+e.months),n.setDate(n.getDate()+7*e.weeks+e.days),n.setHours(n.getHours()+e.hours),n.setMinutes(n.getMinutes()+e.minutes),n.setSeconds(n.getSeconds()+e.seconds),n}(t,_n.from(n).abs());return!s||Math.abs(Number(s)-Number(t))>Math.abs(Number(t)-Number(e))}var Vn,In,Hn,Rn,Kn,Pn,Un,Wn=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)},qn=function(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n};const zn=("undefined"!=typeof globalThis?globalThis:window).HTMLElement||null;class Zn extends Event{constructor(t,e,n,s){super("relative-time-updated",{bubbles:!0,composed:!0}),this.oldText=t,this.newText=e,this.oldTitle=n,this.newTitle=s}}function Yn(t){if(!t.date)return 1/0;if("elapsed"===t.format){const e=t.precision;if("second"===e)return 1e3;if("minute"===e)return 6e4}const e=Math.abs(Date.now()-t.date.getTime());return e<6e4?1e3:e<36e5?6e4:36e5}const Jn=new class{constructor(){this.elements=new Set,this.time=1/0,this.timer=-1}observe(t){if(this.elements.has(t))return;this.elements.add(t);const e=t.date;if(e&&e.getTime()){const e=Yn(t),n=Date.now()+e;n<this.time&&(clearTimeout(this.timer),this.timer=setTimeout((()=>this.update()),e),this.time=n)}}unobserve(t){this.elements.has(t)&&this.elements.delete(t)}update(){if(clearTimeout(this.timer),!this.elements.size)return;let t=1/0;for(const e of this.elements)t=Math.min(t,Yn(e)),e.update();this.time=Math.min(36e5,t),this.timer=setTimeout((()=>this.update()),this.time),this.time+=Date.now()}};class Gn extends zn{constructor(){super(...arguments),Vn.add(this),In.set(this,!1),Hn.set(this,!1),Kn.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this)}static get observedAttributes(){return["second","minute","hour","weekday","day","month","year","time-zone-name","prefix","threshold","tense","precision","format","datetime","lang","title"]}get second(){const t=this.getAttribute("second");if("numeric"===t||"2-digit"===t)return t}set second(t){this.setAttribute("second",t||"")}get minute(){const t=this.getAttribute("minute");if("numeric"===t||"2-digit"===t)return t}set minute(t){this.setAttribute("minute",t||"")}get hour(){const t=this.getAttribute("hour");if("numeric"===t||"2-digit"===t)return t}set hour(t){this.setAttribute("hour",t||"")}get weekday(){const t=this.getAttribute("weekday");if("long"===t||"short"===t||"narrow"===t)return t}set weekday(t){this.setAttribute("weekday",t||"")}get day(){var t;const e=null!==(t=this.getAttribute("day"))&&void 0!==t?t:"numeric";if("numeric"===e||"2-digit"===e)return e}set day(t){this.setAttribute("day",t||"")}get month(){var t;const e=null!==(t=this.getAttribute("month"))&&void 0!==t?t:"short";if("numeric"===e||"2-digit"===e||"short"===e||"long"===e||"narrow"===e)return e}set month(t){this.setAttribute("month",t||"")}get year(){var t;const e=this.getAttribute("year");return"numeric"===e||"2-digit"===e?e:this.hasAttribute("year")||(new Date).getUTCFullYear()===(null===(t=this.date)||void 0===t?void 0:t.getUTCFullYear())?void 0:"numeric"}set year(t){this.setAttribute("day",t||"")}get timeZoneName(){const t=this.getAttribute("time-zone-name");if("long"===t||"short"===t||"shortOffset"===t||"longOffset"===t||"shortGeneric"===t||"longGeneric"===t)return t}set timeZoneName(t){this.setAttribute("time-zone-name",t||"")}get prefix(){var t;return null!==(t=this.getAttribute("prefix"))&&void 0!==t?t:"on"}set prefix(t){this.setAttribute("prefix",t)}get threshold(){const t=this.getAttribute("threshold");return t&&(e=t,Bn.test(e))?t:"P30D";var e}set threshold(t){this.setAttribute("threshold",t)}get tense(){const t=this.getAttribute("tense");return"past"===t?"past":"future"===t?"future":"auto"}set tense(t){this.setAttribute("tense",t)}get precision(){const t=this.getAttribute("precision");return Dn.includes(t)?t:"second"}set precision(t){this.setAttribute("precision",t)}get format(){const t=this.getAttribute("format");return"micro"===t?"micro":"elapsed"===t?"elapsed":"auto"}set format(t){this.setAttribute("format",t)}get datetime(){return this.getAttribute("datetime")||""}set datetime(t){this.setAttribute("datetime",t)}get date(){const t=Date.parse(this.datetime);return Number.isNaN(t)?null:new Date(t)}set date(t){this.datetime=(null==t?void 0:t.toISOString())||""}connectedCallback(){this.update()}disconnectedCallback(){Jn.unobserve(this)}attributeChangedCallback(t,e,n){e!==n&&("title"===t&&qn(this,In,null!==n&&Wn(this,Vn,"m",Pn).call(this)!==n,"f"),Wn(this,Hn,"f")||"title"===t&&Wn(this,In,"f")||qn(this,Hn,(async()=>{await Promise.resolve(),this.update()})(),"f"))}update(){const t=Wn(this,Kn,"f").textContent||"",e=this.getAttribute("title")||"";let n=e,s=t;const i=new Date;Wn(this,In,"f")||(n=Wn(this,Vn,"m",Pn).call(this)||"",n&&this.setAttribute("title",n)),s=Wn(this,Vn,"m",Un).call(this,i)||"",s?Wn(this,Kn,"f").textContent=s:this.shadowRoot===Wn(this,Kn,"f")&&this.textContent&&(Wn(this,Kn,"f").textContent=this.textContent),s===t&&n===e||this.dispatchEvent(new Zn(t,s,e,n));const r=this.date,o=this.format,a=("auto"===o||"micro"===o)&&r&&jn(i,r,this.threshold);"elapsed"===o||a?Jn.observe(this):Jn.unobserve(this),qn(this,Hn,!1,"f")}}In=new WeakMap,Hn=new WeakMap,Kn=new WeakMap,Vn=new WeakSet,Rn=function(){var t,e;return null!==(e=null===(t=this.closest("[lang]"))||void 0===t?void 0:t.getAttribute("lang"))&&void 0!==e?e:"default"},Pn=function(){const t=this.date;if(t&&"undefined"!=typeof Intl&&Intl.DateTimeFormat)return new Intl.DateTimeFormat(Wn(this,Vn,"a",Rn),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},Un=function(t=new Date){const e=this.date;if(!e)return;const n=this.format;if("elapsed"===n){const t=Dn.indexOf(this.precision)||0,n=function(t){const e=Math.abs(t.getTime()-(new Date).getTime()),n=Math.floor(e/1e3),s=Math.floor(n/60),i=Math.floor(s/60),r=Math.floor(i/24),o=Math.floor(r/30),a=Math.floor(o/12),l=[];return a&&l.push([a,"year"]),o-12*a&&l.push([o-12*a,"month"]),r-30*o&&l.push([r-30*o,"day"]),i-24*r&&l.push([i-24*r,"hour"]),s-60*i&&l.push([s-60*i,"minute"]),n-60*s&&l.push([n-60*s,"second"]),l}(e).filter((e=>Dn.indexOf(e[1])>=t));return n.map((([t,e])=>`${t}${e[0]}`)).join(" ")||`0${this.precision[0]}`}const s=this.tense,i="micro"===n,r=t.getTime()<e.getTime(),o=jn(t,e,this.threshold),a=Wn(this,Vn,"a",Rn);if("undefined"!=typeof Intl&&Intl.RelativeTimeFormat){const t=new Intl.RelativeTimeFormat(a,{numeric:"auto"});if("past"===s||"auto"===s&&!r&&o){const[n,s]=i?function(t){const e=(new Date).getTime()-t.getTime(),n=Math.round(e/1e3),s=Math.round(n/60),i=Math.round(s/60),r=Math.round(i/24),o=Math.round(r/30),a=Math.round(o/12);return s<1?[1,"minute"]:s<60?[s,"minute"]:i<24?[i,"hour"]:r<365?[r,"day"]:[a,"year"]}(e):function(t){const e=(new Date).getTime()-t.getTime(),n=Math.round(e/1e3),s=Math.round(n/60),i=Math.round(s/60),r=Math.round(i/24),o=Math.round(r/30),a=Math.round(o/12);return e<0||n<10?[0,"second"]:n<45?[-n,"second"]:n<90||s<45?[-s,"minute"]:s<90||i<24?[-i,"hour"]:i<36||r<30?[-r,"day"]:o<18?[-o,"month"]:[-a,"year"]}(e);return i?`${n}${s[0]}`:t.format(n,s)}if("future"===s||"auto"===s&&r&&o){const[n,s]=i?function(t){const e=t.getTime()-(new Date).getTime(),n=Math.round(e/1e3),s=Math.round(n/60),i=Math.round(s/60),r=Math.round(i/24),o=Math.round(r/30),a=Math.round(o/12);return r>=365?[a,"year"]:i>=24?[r,"day"]:s>=60?[i,"hour"]:s>1?[s,"minute"]:[1,"minute"]}(e):function(t){const e=t.getTime()-(new Date).getTime(),n=Math.round(e/1e3),s=Math.round(n/60),i=Math.round(s/60),r=Math.round(i/24),o=Math.round(r/30),a=Math.round(o/12);return o>=18||o>=12?[a,"year"]:r>=45||r>=30?[o,"month"]:i>=36||i>=24?[r,"day"]:s>=90||s>=45?[i,"hour"]:n>=90||n>=45?[s,"minute"]:n>=10?[n,"second"]:[0,"second"]}(e);return i?`${n}${s[0]}`:t.format(n,s)}}if("undefined"==typeof Intl||!Intl.DateTimeFormat)return;const l=new Intl.DateTimeFormat(a,{second:this.second,minute:this.minute,hour:this.hour,weekday:this.weekday,day:this.day,month:this.month,year:this.year,timeZoneName:this.timeZoneName});return`${this.prefix} ${l.format(e)}`.trim()};const Xn="undefined"!=typeof globalThis?globalThis:window;try{customElements.define("relative-time",Gn),Xn.RelativeTimeElement=Gn}catch(nt){if(!(Xn.DOMException&&nt instanceof DOMException&&"NotSupportedError"===nt.name||nt instanceof ReferenceError))throw nt}const Qn=class{constructor(t=document.documentElement,s=P){this.logger=console,this.debug=!1,this.logDebugActivity=(t,e,n={})=>{this.debug&&this.logFormattedMessage(t,e,n)},this.element=t,this.schema=s,this.dispatcher=new e(this),this.router=new K(this),this.actionDescriptorFilters=Object.assign({},n)}static start(t,e){const n=new this(t,e);return n.start(),n}async start(){await new Promise((t=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>t())):t()})),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>{t.controllerConstructor.shouldLoad&&this.router.loadDefinition(t)}))}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>this.router.unloadIdentifier(t)))}get controllers(){return this.router.contexts.map((t=>t.controller))}getControllerForElementAndIdentifier(t,e){const n=this.router.getContextForElementAndIdentifier(t,e);return n?n.controller:null}handleError(t,e,n){var s;this.logger.error("%s\n\n%o\n\n%o",e,t,n),null===(s=window.onerror)||void 0===s||s.call(window,e,"",0,0,t)}logFormattedMessage(t,e,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}}.start();Qn.register("clipboard-copy-component",class extends X{copy(){const t=this.element.attributes.getNamedItem("value"),e=this.element.attributes.getNamedItem("for");if(t)navigator.clipboard.writeText(t.value);else if(e){const t=document.getElementById(e.value);navigator.clipboard.writeText((null==t?void 0:t.textContent)||"")}else navigator.clipboard.writeText(this.element.textContent||"")}}),Qn.register("ariadne-form",jt),Qn.register("slideover-component",le),Qn.register("tab-nav-component",ce),Qn.register("tooltip-component",kn),Qn.register("toggleable",ae),Qn.register("accumulator",ie),Qn.register("options",se),Qn.register("string-match",ne),Qn.register("events",class extends X{stopPropagation(t){t.stopPropagation()}});
1
+ function ks(n,t=0,{start:e=!0,middle:s=!0,once:i=!1}={}){let r=e,o=0,a,c=!1;function l(...u){if(c)return;const h=Date.now()-o;o=Date.now(),e&&s&&h>=t&&(r=!0),r?(r=!1,n.apply(this,u),i&&l.cancel()):(s&&h<t||!s)&&(clearTimeout(a),a=setTimeout(()=>{o=Date.now(),n.apply(this,u),i&&l.cancel()},s?t-h:t))}return l.cancel=()=>{clearTimeout(a),c=!0},l}function Ms(n,t=0,{start:e=!1,middle:s=!1,once:i=!1}={}){return ks(n,t,{start:e,middle:s,once:i})}var te=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Cs=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},it;const St=new WeakMap;class Gt extends Event{constructor(t){super(`auto-check-${t}`,{bubbles:!0}),this.phase=t}get detail(){return this}}class $n extends Gt{constructor(t,e=""){super(t),this.phase=t,this.message=e,this.setValidity=s=>{this.message=s}}}class $e extends Gt{constructor(){super("complete")}}class Ss extends Gt{constructor(t){super("success"),this.response=t}}class Ls extends $n{constructor(){super("start","Verifying…")}}class Fs extends $n{constructor(t){super("error","Validation failed"),this.response=t}}class Ds extends Gt{constructor(t){super("send"),this.body=t}}class Rn extends HTMLElement{constructor(){super(...arguments),it.set(this,null)}static define(t="auto-check",e=customElements){return e.define(t,this),this}get onloadend(){return te(this,it,"f")}set onloadend(t){te(this,it,"f")&&this.removeEventListener("loadend",te(this,it,"f")),Cs(this,it,typeof t=="object"||typeof t=="function"?t:null,"f"),typeof t=="function"&&this.addEventListener("loadend",t)}connectedCallback(){const t=this.input;if(!t)return;const e=Ms($s.bind(null,this),300),s={check:e,controller:null};St.set(this,s),t.addEventListener("input",Re),t.addEventListener("input",e),t.autocomplete="off",t.spellcheck=!1}disconnectedCallback(){const t=this.input;if(!t)return;const e=St.get(this);e&&(St.delete(this),t.removeEventListener("input",Re),t.removeEventListener("input",e.check),t.setCustomValidity(""))}attributeChangedCallback(t){if(t==="required"){const e=this.input;if(!e)return;e.required=this.required}}static get observedAttributes(){return["required"]}get input(){return this.querySelector("input")}get src(){const t=this.getAttribute("src");if(!t)return"";const e=this.ownerDocument.createElement("a");return e.href=t,e.href}set src(t){this.setAttribute("src",t)}get csrf(){const t=this.querySelector("[data-csrf]");return this.getAttribute("csrf")||t instanceof HTMLInputElement&&t.value||""}set csrf(t){this.setAttribute("csrf",t)}get required(){return this.hasAttribute("required")}set required(t){t?this.setAttribute("required",""):this.removeAttribute("required")}get csrfField(){return this.getAttribute("csrf-field")||"authenticity_token"}set csrfField(t){this.setAttribute("csrf-field",t)}}it=new WeakMap;function Re(n){const t=n.currentTarget;if(!(t instanceof HTMLInputElement))return;const e=t.closest("auto-check");if(!(e instanceof Rn))return;const s=e.src,i=e.csrf,r=St.get(e);if(!s||!i||!r)return;const o=new Ls;t.dispatchEvent(o),e.required&&t.setCustomValidity(o.message)}function _s(){return"AbortController"in window?new AbortController:{signal:null,abort(){}}}async function Bs(n,t,e){try{const s=await fetch(t,e);return n.dispatchEvent(new Event("load")),n.dispatchEvent(new Event("loadend")),s}catch(s){throw s.name!=="AbortError"&&(n.dispatchEvent(new Event("error")),n.dispatchEvent(new Event("loadend"))),s}}async function $s(n){const t=n.input;if(!t)return;const e=n.csrfField,s=n.src,i=n.csrf,r=St.get(n);if(!s||!i||!r){n.required&&t.setCustomValidity("");return}if(!t.value.trim()){n.required&&t.setCustomValidity("");return}const o=new FormData;o.append(e,i),o.append("value",t.value),t.dispatchEvent(new Ds(o)),r.controller?r.controller.abort():n.dispatchEvent(new Event("loadstart")),r.controller=_s();try{const a=await Bs(n,s,{credentials:"same-origin",signal:r.controller.signal,method:"POST",body:o});if(a.ok)n.required&&t.setCustomValidity(""),t.dispatchEvent(new Ss(a.clone()));else{const c=new Fs(a.clone());t.dispatchEvent(c),n.required&&t.setCustomValidity(c.message)}r.controller=null,t.dispatchEvent(new $e)}catch(a){a.name!=="AbortError"&&(r.controller=null,t.dispatchEvent(new $e))}}const Pe=typeof globalThis<"u"?globalThis:window;try{Pe.AutoCheckElement=Rn.define()}catch(n){if(!(Pe.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Rs{constructor(t,e,{tabInsertsSuggestions:s,defaultFirstOption:i}={}){this.input=t,this.list=e,this.tabInsertsSuggestions=s??!0,this.defaultFirstOption=i??!1,this.isComposing=!1,e.id||(e.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=r=>Ps(r,this),this.compositionEventHandler=r=>Is(r,this),this.inputHandler=this.clearSelection.bind(this),t.setAttribute("role","combobox"),t.setAttribute("aria-controls",e.id),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",Ne),this.indicateDefaultOption()}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",Ne)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(ee)[0])===null||t===void 0||t.setAttribute("data-combobox-option-default","true"))}navigate(t=1){const e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(ee)[0],s=Array.from(this.list.querySelectorAll('[role="option"]')).filter(ee),i=s.indexOf(e);if(i===s.length-1&&t===1||i===0&&t===-1){this.clearSelection(),this.input.focus();return}let r=t===1?0:s.length-1;if(e&&i>=0){const a=i+t;a>=0&&a<s.length&&(r=a)}const o=s[r];if(o)for(const a of s)a.removeAttribute("data-combobox-option-default"),o===a?(this.input.setAttribute("aria-activedescendant",o.id),o.setAttribute("aria-selected","true"),js(this.list,o)):a.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.removeAttribute("aria-selected");this.indicateDefaultOption()}}function Ps(n,t){if(!(n.shiftKey||n.metaKey||n.altKey)&&!(!t.ctrlBindings&&n.ctrlKey)&&!t.isComposing)switch(n.key){case"Enter":Ie(t.input,t.list)&&n.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&Ie(t.input,t.list)&&n.preventDefault();break;case"Escape":t.clearSelection();break;case"ArrowDown":t.navigate(1),n.preventDefault();break;case"ArrowUp":t.navigate(-1),n.preventDefault();break;case"n":t.ctrlBindings&&n.ctrlKey&&(t.navigate(1),n.preventDefault());break;case"p":t.ctrlBindings&&n.ctrlKey&&(t.navigate(-1),n.preventDefault());break;default:if(n.ctrlKey)break;t.clearSelection()}}function Ne(n){if(!(n.target instanceof Element))return;const t=n.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&Ns(t,{event:n})}function Ie(n,t){const e=t.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return e?(e.getAttribute("aria-disabled")==="true"||e.click(),!0):!1}function Ns(n,t){n.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:t}))}function ee(n){return!n.hidden&&!(n instanceof HTMLInputElement&&n.type==="hidden")&&(n.offsetWidth>0||n.offsetHeight>0)}function Is(n,t){t.isComposing=n.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function js(n,t){Hs(n,t)||(n.scrollTop=t.offsetTop)}function Hs(n,t){const e=n.scrollTop,s=e+n.clientHeight,i=t.offsetTop,r=i+t.clientHeight;return i>=e&&r<=s}function Vs(n,t=0){let e;return function(...s){clearTimeout(e),e=window.setTimeout(()=>{clearTimeout(e),n(...s)},t)}}const Ws=window.testScreenReaderDelay||100;class Ks{constructor(t,e,s,i=!1){var r;if(this.container=t,this.input=e,this.results=s,this.combobox=new Rs(e,s,{defaultFirstOption:i}),this.feedback=t.getRootNode().getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=i,this.clearButton=t.getRootNode().getElementById(`${this.input.id||this.input.name}-clear`),this.clientOptions=s.querySelectorAll("[role=option]"),this.feedback&&(this.feedback.setAttribute("aria-live","polite"),this.feedback.setAttribute("aria-atomic","true")),this.clearButton&&!this.clearButton.getAttribute("aria-label")){const o=document.querySelector(`label[for="${this.input.name}"]`);this.clearButton.setAttribute("aria-label","clear:"),this.clearButton.setAttribute("aria-labelledby",`${this.clearButton.id} ${(o==null?void 0:o.id)||""}`)}this.input.getAttribute("aria-expanded")||this.input.setAttribute("aria-expanded","false"),this.results.popover?this.results.matches(":popover-open")&&this.results.hidePopover():this.results.hidden=!0,this.results.getAttribute("aria-label")||this.results.setAttribute("aria-label","results"),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=Vs(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.handleClear=this.handleClear.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit),(r=this.clearButton)===null||r===void 0||r.addEventListener("click",this.handleClear)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}handleClear(t){t.preventDefault(),this.input.getAttribute("aria-expanded")==="true"&&(this.input.setAttribute("aria-expanded","false"),this.updateFeedbackForScreenReaders("Results hidden.")),this.input.value="",this.container.value="",this.input.focus(),this.input.dispatchEvent(new Event("change")),this.close()}onKeydown(t){if(t.key==="Escape"&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&t.key==="ArrowUp"&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&t.key==="ArrowDown"&&!this.container.open){if(!this.input.value.trim())return;this.open(),t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.interactingWithList||this.fetchResults()}onInputBlur(){this.interactingWithList||this.close()}onCommit({target:t}){const e=t;if(!(e instanceof HTMLElement)||(this.close(),e instanceof HTMLAnchorElement))return;const s=e.getAttribute("data-autocomplete-value")||e.textContent;this.updateFeedbackForScreenReaders(`${e.textContent||""} selected.`),this.container.value=s,s||this.updateFeedbackForScreenReaders("Results hidden.")}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.feedback&&this.feedback.textContent&&(this.feedback.textContent=""),this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(const e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}updateFeedbackForScreenReaders(t){setTimeout(()=>{this.feedback&&(this.feedback.textContent=t)},Ws)}fetchResults(){const t=this.input.value.trim();if(!t&&!this.container.fetchOnEmpty){this.close();return}const e=this.container.src;if(!e)return;const s=new URL(e,window.location.href),i=new URLSearchParams(s.search.slice(1));i.append("q",t),s.search=i.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),this.container.fetchResult(s).then(r=>{this.results.innerHTML=r,this.identifyOptions(),this.combobox.indicateDefaultOption();const o=this.results.querySelectorAll('[role="option"]'),a=!!o.length,c=o.length,[l]=o,u=l==null?void 0:l.textContent;this.autoselectEnabled&&u?this.updateFeedbackForScreenReaders(`${c} results. ${u} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${c||"No"} results.`),a?this.open():this.close(),this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))}).catch(()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))})}open(){(this.results.popover?!this.results.matches(":popover-open"):this.results.hidden)&&(this.combobox.start(),this.results.popover?this.results.showPopover():this.results.hidden=!1),this.container.open=!0,this.interactingWithList=!0}close(){(this.results.popover?this.results.matches(":popover-open"):!this.results.hidden)&&(this.combobox.stop(),this.results.popover?this.results.hidePopover():this.results.hidden=!0),this.container.open=!1,this.interactingWithList=!1}}var V=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},ne=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Us=function(n,t){var e={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&t.indexOf(s)<0&&(e[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(n);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(n,s[i])&&(e[s[i]]=n[s[i]]);return e},rt,At,xt,Tt,Vt;const qs=globalThis.HTMLElement||null;class zs extends Event{constructor(t,e){var{relatedTarget:s}=e,i=Us(e,["relatedTarget"]);super(t,i),this.relatedTarget=s}}const z=new WeakMap;let se=null;class Ys extends qs{constructor(){super(...arguments),rt.add(this),At.set(this,null),xt.set(this,null),Vt.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){se=t===null?t:Promise.resolve(t)}get forElement(){var t;if(!((t=V(this,At,"f"))===null||t===void 0)&&t.isConnected)return V(this,At,"f");const e=this.getAttribute("for"),s=this.getRootNode();return e&&(s instanceof Document||s instanceof ShadowRoot)?s.getElementById(e):null}set forElement(t){ne(this,At,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return!((t=V(this,xt,"f"))===null||t===void 0)&&t.isConnected?V(this,xt,"f"):this.querySelector("input")}set inputElement(t){ne(this,xt,t,"f"),V(this,rt,"m",Tt).call(this)}connectedCallback(){this.isConnected&&(V(this,rt,"m",Tt).call(this),new MutationObserver(()=>{z.get(this)||V(this,rt,"m",Tt).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){const t=z.get(this);t&&(t.destroy(),z.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}get fetchOnEmpty(){return this.hasAttribute("fetch-on-empty")}set fetchOnEmpty(t){this.toggleAttribute("fetch-on-empty",t)}async fetchResult(t){var e;(e=V(this,Vt,"f"))===null||e===void 0||e.abort();const{signal:s}=ne(this,Vt,new AbortController,"f"),i=await fetch(t.toString(),{signal:s,headers:{Accept:"text/fragment+html"}});if(!i.ok)throw new Error(await i.text());return se?(await se).createHTML(await i.text(),i):await i.text()}static get observedAttributes(){return["open","value","for"]}attributeChangedCallback(t,e,s){var i,r;if(e===s)return;const o=z.get(this);if(o)switch((this.forElement!==((i=z.get(this))===null||i===void 0?void 0:i.results)||this.inputElement!==((r=z.get(this))===null||r===void 0?void 0:r.input))&&V(this,rt,"m",Tt).call(this),t){case"open":s===null?o.close():o.open();break;case"value":s!==null&&(o.input.value=s),this.dispatchEvent(new zs("auto-complete-change",{bubbles:!0,relatedTarget:o.input}));break}}}At=new WeakMap,xt=new WeakMap,Vt=new WeakMap,rt=new WeakSet,Tt=function(){var t;(t=z.get(this))===null||t===void 0||t.destroy();const{forElement:e,inputElement:s}=this;if(!e||!s)return;const i=this.getAttribute("data-autoselect")==="true";z.set(this,new Ks(this,s,e,i)),e.setAttribute("role","listbox")};const ie=typeof globalThis<"u"?globalThis:window;try{ie.AutocompleteElement=ie.AutoCompleteElement=Ys.define()}catch(n){if(!(ie.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class je extends HTMLElement{get preload(){return this.hasAttribute("preload")}set preload(t){t?this.setAttribute("preload",""):this.removeAttribute("preload")}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","menu");const t=this.parentElement;if(!t)return;const e=t.querySelector("summary");e&&(e.setAttribute("aria-haspopup","menu"),e.hasAttribute("role")||e.setAttribute("role","button"));const s=[R(t,"compositionstart",i=>Ue(this,i)),R(t,"compositionend",i=>Ue(this,i)),R(t,"click",i=>We(t,i)),R(t,"change",i=>We(t,i)),R(t,"keydown",i=>ti(t,this,i)),R(t,"toggle",()=>He(t,this),{once:!0}),R(t,"toggle",()=>Zs(t)),this.preload?R(t,"mouseover",()=>He(t,this),{once:!0}):Xs,...Gs(t)];lt.set(this,{subscriptions:s,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=lt.get(this);if(t){lt.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const lt=new WeakMap,Xs={unsubscribe(){}};function R(n,t,e,s=!1){return n.addEventListener(t,e,s),{unsubscribe:()=>{n.removeEventListener(t,e,s)}}}function He(n,t){const e=t.getAttribute("src");if(!e)return;const s=lt.get(t);if(!s||s.loaded)return;s.loaded=!0;const i=t.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",()=>Pn(n)),i.setAttribute("src",e))}function Gs(n){let t=!1;const e=()=>t=!0,s=()=>t=!1,i=()=>{n.hasAttribute("open")&&(Pn(n)||t||Js(n))};return[R(n,"mousedown",e),R(n,"keydown",s),R(n,"toggle",i)]}function Zs(n){if(n.hasAttribute("open"))for(const t of document.querySelectorAll("details[open] > details-menu")){const e=t.closest("details");e&&e!==n&&!e.contains(n)&&e.removeAttribute("open")}}function Pn(n){if(!n.hasAttribute("open"))return!1;const t=n.querySelector("details-menu [autofocus]");return t?(t.focus(),!0):!1}function Js(n){const t=document.activeElement;if(t&&Nn(t)&&n.contains(t))return;const e=Ot(n,!0);e&&e.focus()}function Ot(n,t){const e=Array.from(n.querySelectorAll('[role^="menuitem"]:not([hidden]):not([disabled])')),s=document.activeElement,i=s instanceof HTMLElement?e.indexOf(s):-1,r=t?e[i+1]:e[i-1],o=t?e[0]:e[e.length-1];return r||o}const Ve=navigator.userAgent.match(/Macintosh/);function We(n,t){const e=t.target;if(e instanceof Element&&e.closest("details")===n){if(t.type==="click"){const s=e.closest('[role="menuitem"], [role="menuitemradio"]');if(!s)return;const i=s.querySelector("input");if(s.tagName==="LABEL"&&e===i)return;s.tagName==="LABEL"&&i&&!i.checked||Ke(s,n)}else if(t.type==="change"){const s=e.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');s&&Ke(s,n)}}}function Qs(n,t){for(const e of t.querySelectorAll('[role="menuitemradio"], [role="menuitemcheckbox"]')){const s=e.querySelector('input[type="radio"], input[type="checkbox"]');let i=(e===n).toString();s instanceof HTMLInputElement&&(i=s.indeterminate?"mixed":s.checked.toString()),e.setAttribute("aria-checked",i)}}function Ke(n,t){if(n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true")return;const e=n.closest("details-menu");!e||!e.dispatchEvent(new CustomEvent("details-menu-select",{cancelable:!0,detail:{relatedTarget:n}}))||(ei(n,t),Qs(n,t),n.getAttribute("role")!=="menuitemcheckbox"&&In(t),e.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:n}})))}function ti(n,t,e){if(!(e instanceof KeyboardEvent)||n.querySelector("details[open]"))return;const s=lt.get(t);if(!s||s.isComposing)return;const i=e.target instanceof Element&&e.target.tagName==="SUMMARY";switch(e.key){case"Escape":n.hasAttribute("open")&&(In(n),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=Ot(n,!0);r&&r.focus(),e.preventDefault()}break;case"ArrowUp":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=Ot(n,!1);r&&r.focus(),e.preventDefault()}break;case"n":if(Ve&&e.ctrlKey){const r=Ot(n,!0);r&&r.focus(),e.preventDefault()}break;case"p":if(Ve&&e.ctrlKey){const r=Ot(n,!1);r&&r.focus(),e.preventDefault()}break;case" ":case"Enter":{const r=document.activeElement;r instanceof HTMLElement&&Nn(r)&&r.closest("details")===n&&(e.preventDefault(),e.stopPropagation(),r.click())}break}}function Nn(n){const t=n.getAttribute("role");return t==="menuitem"||t==="menuitemcheckbox"||t==="menuitemradio"}function In(n){if(!n.hasAttribute("open"))return;n.removeAttribute("open");const e=n.querySelector("summary");e&&e.focus()}function ei(n,t){const e=t.querySelector("[data-menu-button]");if(!e)return;const s=ni(n);if(s)e.textContent=s;else{const i=si(n);i&&(e.innerHTML=i)}}function ni(n){if(!n)return null;const t=n.hasAttribute("data-menu-button-text")?n:n.querySelector("[data-menu-button-text]");return t?t.getAttribute("data-menu-button-text")||t.textContent:null}function si(n){if(!n)return null;const t=n.hasAttribute("data-menu-button-contents")?n:n.querySelector("[data-menu-button-contents]");return t?t.innerHTML:null}function Ue(n,t){const e=lt.get(n);e&&(e.isComposing=t.type==="compositionstart")}window.customElements.get("details-menu")||(window.DetailsMenuElement=je,window.customElements.define("details-menu",je));const ut=new WeakMap,Q=new WeakMap,W=new WeakMap;function Ft(n){const t=n.currentTarget;if(!(t instanceof ft))return;const{box:e,image:s}=W.get(t)||{};if(!e||!s)return;let i=0,r=0;if(n instanceof KeyboardEvent)n.key==="ArrowUp"?r=-1:n.key==="ArrowDown"?r=1:n.key==="ArrowLeft"?i=-1:n.key==="ArrowRight"&&(i=1);else if(Q.has(t)&&n instanceof MouseEvent){const o=Q.get(t);i=n.pageX-o.dragStartX,r=n.pageY-o.dragStartY}else if(Q.has(t)&&n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0],{dragStartX:c,dragStartY:l}=Q.get(t);i=o-c,r=a-l}if(i!==0||r!==0){const o=Math.min(Math.max(0,e.offsetLeft+i),s.width-e.offsetWidth),a=Math.min(Math.max(0,e.offsetTop+r),s.height-e.offsetHeight);e.style.left=`${o}px`,e.style.top=`${a}px`,Wn(t,{x:o,y:a,width:e.offsetWidth,height:e.offsetHeight})}if(n instanceof MouseEvent)Q.set(t,{dragStartX:n.pageX,dragStartY:n.pageY});else if(n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0];Q.set(t,{dragStartX:o,dragStartY:a})}}function ht(n){const t=n.target;if(!(t instanceof HTMLElement))return;const e=jn(t);if(!(e instanceof ft))return;const{box:s}=W.get(e)||{};if(!s)return;const i=e.getBoundingClientRect();let r,o,a;if(n instanceof KeyboardEvent){if(n.key==="Escape")return Vn(e);if(n.key==="-"&&(a=-10),n.key==="="&&(a=10),!a)return;r=s.offsetWidth+a,o=s.offsetHeight+a,ut.set(e,{startX:s.offsetLeft,startY:s.offsetTop})}else if(n instanceof MouseEvent){const c=ut.get(e);if(!c)return;r=n.pageX-c.startX-i.left-window.pageXOffset,o=n.pageY-c.startY-i.top-window.pageYOffset}else if(n instanceof TouchEvent){const c=ut.get(e);if(!c)return;r=n.changedTouches[0].pageX-c.startX-i.left-window.pageXOffset,o=n.changedTouches[0].pageY-c.startY-i.top-window.pageYOffset}r&&o&&Hn(e,r,o,!(n instanceof KeyboardEvent))}function jn(n){const t=n.getRootNode();return t instanceof ShadowRoot?t.host:n}function qe(n){const t=n.currentTarget;if(!(t instanceof HTMLElement))return;const e=jn(t);if(!(e instanceof ft))return;const{box:s}=W.get(e)||{};if(!s)return;const i=n.target;if(i instanceof HTMLElement)if(i.hasAttribute("data-direction")){const r=i.getAttribute("data-direction")||"";e.addEventListener("mousemove",ht),e.addEventListener("touchmove",ht,{passive:!0}),["nw","se"].indexOf(r)>=0&&e.classList.add("nwse"),["ne","sw"].indexOf(r)>=0&&e.classList.add("nesw"),ut.set(e,{startX:s.offsetLeft+(["se","ne"].indexOf(r)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(r)>=0?0:s.offsetHeight)}),ht(n)}else e.addEventListener("mousemove",Ft),e.addEventListener("touchmove",Ft,{passive:!0})}function Hn(n,t,e,s=!0){let i=Math.max(Math.abs(t),Math.abs(e),10);const r=ut.get(n);if(!r)return;const{box:o,image:a}=W.get(n)||{};if(!o||!a)return;i=Math.min(i,e>0?a.height-r.startY:r.startY,t>0?a.width-r.startX:r.startX);const c=s?Math.round(Math.max(0,t>0?r.startX:r.startX-i)):o.offsetLeft,l=s?Math.round(Math.max(0,e>0?r.startY:r.startY-i)):o.offsetTop;o.style.left=`${c}px`,o.style.top=`${l}px`,o.style.width=`${i}px`,o.style.height=`${i}px`,Wn(n,{x:c,y:l,width:i,height:i})}function Vn(n){const{image:t}=W.get(n)||{};if(!t)return;const e=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);ut.set(n,{startX:(t.clientWidth-e)/2,startY:(t.clientHeight-e)/2}),Hn(n,e,e)}function re(n){const t=n.currentTarget;t instanceof ft&&(Q.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",ht),t.removeEventListener("mousemove",Ft),t.removeEventListener("touchmove",ht),t.removeEventListener("touchmove",Ft))}function Wn(n,t){const{image:e}=W.get(n)||{};if(!e)return;const s=e.naturalWidth/e.width;for(const i in t){const r=Math.round(t[i]*s);t[i]=r;const o=n.querySelector(`[data-image-crop-input='${i}']`);o instanceof HTMLInputElement&&(o.value=r.toString())}n.dispatchEvent(new CustomEvent("image-crop-change",{bubbles:!0,detail:t}))}class ft extends HTMLElement{connectedCallback(){if(W.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML=`
2
+ <style>
3
+ :host { touch-action: none; display: block; }
4
+ :host(.nesw) { cursor: nesw-resize; }
5
+ :host(.nwse) { cursor: nwse-resize; }
6
+ :host(.nesw) .crop-box, :host(.nwse) .crop-box { cursor: inherit; }
7
+ :host([loaded]) .crop-image { display: block; }
8
+ :host([loaded]) ::slotted([data-loading-slot]), .crop-image { display: none; }
9
+
10
+ .crop-wrapper {
11
+ position: relative;
12
+ font-size: 0;
13
+ }
14
+ .crop-container {
15
+ user-select: none;
16
+ -ms-user-select: none;
17
+ -moz-user-select: none;
18
+ -webkit-user-select: none;
19
+ position: absolute;
20
+ overflow: hidden;
21
+ z-index: 1;
22
+ top: 0;
23
+ width: 100%;
24
+ height: 100%;
25
+ }
26
+
27
+ :host([rounded]) .crop-box {
28
+ border-radius: 50%;
29
+ box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);
30
+ }
31
+ .crop-box {
32
+ position: absolute;
33
+ border: 1px dashed #fff;
34
+ box-sizing: border-box;
35
+ cursor: move;
36
+ }
37
+
38
+ :host([rounded]) .crop-outline {
39
+ outline: none;
40
+ }
41
+ .crop-outline {
42
+ position: absolute;
43
+ top: 0;
44
+ bottom: 0;
45
+ left: 0;
46
+ right: 0;
47
+ outline: 4000px solid rgba(0, 0, 0, .3);
48
+ }
49
+
50
+ .handle { position: absolute; }
51
+ :host([rounded]) .handle::before { border-radius: 50%; }
52
+ .handle:before {
53
+ position: absolute;
54
+ display: block;
55
+ padding: 4px;
56
+ transform: translate(-50%, -50%);
57
+ content: ' ';
58
+ background: #fff;
59
+ border: 1px solid #767676;
60
+ }
61
+ .ne { top: 0; right: 0; cursor: nesw-resize; }
62
+ .nw { top: 0; left: 0; cursor: nwse-resize; }
63
+ .se { bottom: 0; right: 0; cursor: nwse-resize; }
64
+ .sw { bottom: 0; left: 0; cursor: nesw-resize; }
65
+ </style>
66
+ <slot></slot>
67
+ <div class="crop-wrapper">
68
+ <img width="100%" class="crop-image" alt="">
69
+ <div class="crop-container">
70
+ <div data-crop-box class="crop-box">
71
+ <div class="crop-outline"></div>
72
+ <div data-direction="nw" class="handle nw"></div>
73
+ <div data-direction="ne" class="handle ne"></div>
74
+ <div data-direction="sw" class="handle sw"></div>
75
+ <div data-direction="se" class="handle se"></div>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ `;const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const s=t.querySelector("img");s instanceof HTMLImageElement&&(W.set(this,{box:e,image:s}),s.addEventListener("load",()=>{this.loaded=!0,Vn(this)}),this.addEventListener("mouseleave",re),this.addEventListener("touchend",re),this.addEventListener("mouseup",re),e.addEventListener("mousedown",qe),e.addEventListener("touchstart",qe,{passive:!0}),this.addEventListener("keydown",Ft),this.addEventListener("keydown",ht),this.src&&(s.src=this.src))}static get observedAttributes(){return["src"]}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loaded(){return this.hasAttribute("loaded")}set loaded(t){t?this.setAttribute("loaded",""):this.removeAttribute("loaded")}attributeChangedCallback(t,e,s){const{image:i}=W.get(this)||{};t==="src"&&(this.loaded=!1,i&&(i.src=s))}}window.customElements.get("image-crop")||(window.ImageCropElement=ft,window.customElements.define("image-crop",ft));var T=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},oe=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},k,ot,Lt,at,ae,he,Nt,ze;const de=new WeakMap;function ii(n){return n&&!!n.split(",").find(t=>t.match(/^\s*\*\/\*/))}let fe=null;class Te extends HTMLElement{constructor(){super(...arguments),k.add(this),ot.set(this,!1),Lt.set(this,new IntersectionObserver(t=>{for(const e of t)if(e.isIntersecting){const{target:s}=e;if(T(this,Lt,"f").unobserve(s),!(s instanceof Te))return;s.loading==="lazy"&&T(this,k,"m",at).call(this)}},{rootMargin:"0px 0px 256px 0px",threshold:.01}))}static define(t="include-fragment",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){fe=t===null?t:Promise.resolve(t)}static get observedAttributes(){return["src","loading"]}get src(){const t=this.getAttribute("src");if(t){const e=this.ownerDocument.createElement("a");return e.href=t,e.href}else return""}set src(t){this.setAttribute("src",t)}get loading(){return this.getAttribute("loading")==="lazy"?"lazy":"eager"}set loading(t){this.setAttribute("loading",t)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}get data(){return T(this,k,"m",he).call(this)}attributeChangedCallback(t,e){t==="src"?this.isConnected&&this.loading==="eager"&&T(this,k,"m",at).call(this):t==="loading"&&this.isConnected&&e!=="eager"&&this.loading==="eager"&&T(this,k,"m",at).call(this)}connectedCallback(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=":host {display: block;}",this.shadowRoot.append(t,document.createElement("slot"))}this.src&&this.loading==="eager"&&T(this,k,"m",at).call(this),this.loading==="lazy"&&T(this,Lt,"f").observe(this)}request(){const t=this.src;if(!t)throw new Error("missing src");return new Request(t,{method:"GET",credentials:"same-origin",headers:{Accept:this.accept||"text/html"}})}load(){return T(this,k,"m",he).call(this)}fetch(t){return fetch(t)}refetch(){de.delete(this),T(this,k,"m",at).call(this)}}ot=new WeakMap,Lt=new WeakMap,k=new WeakSet,at=async function(){if(!T(this,ot,"f")){oe(this,ot,!0,"f"),T(this,Lt,"f").unobserve(this);try{const t=await T(this,k,"m",ae).call(this);if(t instanceof Error)throw t;const e=t,s=document.createElement("template");s.innerHTML=e;const i=document.importNode(s.content,!0);if(!this.dispatchEvent(new CustomEvent("include-fragment-replace",{cancelable:!0,detail:{fragment:i}}))){oe(this,ot,!1,"f");return}this.replaceWith(i),this.dispatchEvent(new CustomEvent("include-fragment-replaced"))}catch{this.classList.add("is-error")}finally{oe(this,ot,!1,"f")}}},ae=async function(){const t=this.src,e=de.get(this);if(e&&e.src===t)return e.data;{let s;return t?s=T(this,k,"m",ze).call(this):s=Promise.reject(new Error("missing src")),de.set(this,{src:t,data:s}),s}},he=async function(){const t=await T(this,k,"m",ae).call(this);if(t instanceof Error)throw t;return t.toString()},Nt=async function(t){await new Promise(e=>setTimeout(e,0));for(const e of t)this.dispatchEvent(new Event(e))},ze=async function(){try{await T(this,k,"m",Nt).call(this,["loadstart"]);const t=await this.fetch(this.request());if(t.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${t.status}`);const e=t.headers.get("Content-Type");if(!ii(this.accept)&&(!e||!e.includes(this.accept?this.accept:"text/html")))throw new Error(`Failed to load resource: expected ${this.accept||"text/html"} but was ${e}`);const s=await t.text();let i=s;return fe&&(i=(await fe).createHTML(s,t)),T(this,k,"m",Nt).call(this,["load","loadend"]),i}catch(t){throw T(this,k,"m",Nt).call(this,["error","loadend"]),t}};const Ye=typeof globalThis<"u"?globalThis:window;try{Ye.IncludeFragmentElement=Te.define()}catch(n){if(!(Ye.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}var Xe=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},Wt,me;const ri=["[data-md-button]","md-header","md-bold","md-italic","md-quote","md-code","md-link","md-image","md-unordered-list","md-ordered-list","md-task-list","md-mention","md-ref","md-strikethrough"];function Kn(n){const t=[];for(const e of n.querySelectorAll(ri.join(", ")))e.hidden||e.offsetWidth<=0&&e.offsetHeight<=0||e.closest("markdown-toolbar")===n&&t.push(e);return t}function Un(n){return function(t){(t.key===" "||t.key==="Enter")&&n(t)}}const M=new WeakMap,oi={"header-1":{prefix:"# "},"header-2":{prefix:"## "},"header-3":{prefix:"### "},"header-4":{prefix:"#### "},"header-5":{prefix:"##### "},"header-6":{prefix:"###### "},bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"},image:{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"},"unordered-list":{prefix:"- ",multiline:!0,unorderedList:!0},"ordered-list":{prefix:"1. ",multiline:!0,orderedList:!0},"task-list":{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0},mention:{prefix:"@",prefixSpace:!0},ref:{prefix:"#",prefixSpace:!0},strikethrough:{prefix:"~~",suffix:"~~",trimFirst:!0}};class D extends HTMLElement{constructor(){super();const t=e=>{const s=M.get(this);s&&(e.preventDefault(),ge(this,s))};this.addEventListener("keydown",Un(t)),this.addEventListener("click",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button")}click(){const t=M.get(this);t&&ge(this,t)}}class Ge extends D{constructor(){super(...arguments),Wt.add(this)}connectedCallback(){const t=parseInt(this.getAttribute("level")||"3",10);Xe(this,Wt,"m",me).call(this,t)}static get observedAttributes(){return["level"]}attributeChangedCallback(t,e,s){if(t!=="level")return;const i=parseInt(s||"3",10);Xe(this,Wt,"m",me).call(this,i)}}Wt=new WeakSet,me=function(t){if(t<1||t>6)return;const e=`${"#".repeat(t)} `;M.set(this,{prefix:e})};window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=Ge,window.customElements.define("md-header",Ge));class Ze extends D{connectedCallback(){M.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=Ze,window.customElements.define("md-bold",Ze));class Je extends D{connectedCallback(){M.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=Je,window.customElements.define("md-italic",Je));class Qe extends D{connectedCallback(){M.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=Qe,window.customElements.define("md-quote",Qe));class tn extends D{connectedCallback(){M.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=tn,window.customElements.define("md-code",tn));class en extends D{connectedCallback(){M.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=en,window.customElements.define("md-link",en));class nn extends D{connectedCallback(){M.set(this,{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=nn,window.customElements.define("md-image",nn));class sn extends D{connectedCallback(){M.set(this,{prefix:"- ",multiline:!0,unorderedList:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=sn,window.customElements.define("md-unordered-list",sn));class rn extends D{connectedCallback(){M.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=rn,window.customElements.define("md-ordered-list",rn));class on extends D{connectedCallback(){M.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=on,window.customElements.define("md-task-list",on));class an extends D{connectedCallback(){M.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=an,window.customElements.define("md-mention",an));class cn extends D{connectedCallback(){M.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=cn,window.customElements.define("md-ref",cn));class ln extends D{connectedCallback(){M.set(this,{prefix:"~~",suffix:"~~",trimFirst:!0})}}window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=ln,window.customElements.define("md-strikethrough",ln));function un(n){const{target:t,currentTarget:e}=n;if(!(t instanceof Element))return;const s=t.closest("[data-md-button]");if(!s||s.closest("markdown-toolbar")!==e)return;const i=s.getAttribute("data-md-button"),r=oi[i];r&&(n.preventDefault(),ge(t,r))}function hn(n){n.addEventListener("keydown",zn),n.setAttribute("tabindex","0"),n.addEventListener("focus",qn,{once:!0})}function dn(n){n.removeEventListener("keydown",zn),n.removeAttribute("tabindex"),n.removeEventListener("focus",qn)}class Kt extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.hasAttribute("data-no-focus")||hn(this),this.addEventListener("keydown",Un(un)),this.addEventListener("click",un)}attributeChangedCallback(t,e,s){t==="data-no-focus"&&(s===null?hn(this):dn(this))}disconnectedCallback(){dn(this)}get field(){const t=this.getAttribute("for");if(!t)return null;const e="getRootNode"in this?this.getRootNode():document;let s;return(e instanceof Document||e instanceof ShadowRoot)&&(s=e.getElementById(t)),s instanceof HTMLTextAreaElement?s:null}}Kt.observedAttributes=["data-no-focus"];function qn({target:n}){if(!(n instanceof Element))return;n.removeAttribute("tabindex");let t="0";for(const e of Kn(n))e.setAttribute("tabindex",t),t==="0"&&(e.focus(),t="-1")}function zn(n){const t=n.key;if(t!=="ArrowRight"&&t!=="ArrowLeft"&&t!=="Home"&&t!=="End")return;const e=n.currentTarget;if(!(e instanceof HTMLElement))return;const s=Kn(e),i=s.indexOf(n.target),r=s.length;if(i===-1)return;let o=0;t==="ArrowLeft"&&(o=i-1),t==="ArrowRight"&&(o=i+1),t==="End"&&(o=r-1),o<0&&(o=r-1),o>r-1&&(o=0);for(let a=0;a<r;a+=1)s[a].setAttribute("tabindex",a===o?"0":"-1");n.preventDefault(),s[o].focus()}window.customElements.get("markdown-toolbar")||(window.MarkdownToolbarElement=Kt,window.customElements.define("markdown-toolbar",Kt));function pe(n){return n.trim().split(`
80
+ `).length>1}function fn(n,t){return Array(t+1).join(n)}function ai(n,t){let e=t;for(;n[e]&&n[e-1]!=null&&!n[e-1].match(/\s/);)e--;return e}function ci(n,t,e){let s=t;const i=e?/\n/:/\s/;for(;n[s]&&!n[s].match(i);)s++;return s}let J=null;function li(n,{text:t,selectionStart:e,selectionEnd:s}){const i=n.selectionStart,r=n.value.slice(0,i),o=n.value.slice(n.selectionEnd);if(J===null||J===!0){n.contentEditable="true";try{J=document.execCommand("insertText",!1,t)}catch{J=!1}n.contentEditable="false"}if(J&&!n.value.slice(0,n.selectionStart).endsWith(t)&&(J=!1),!J){try{document.execCommand("ms-beginUndoUnit")}catch{}n.value=r+t+o;try{document.execCommand("ms-endUndoUnit")}catch{}n.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))}e!=null&&s!=null?n.setSelectionRange(e,s):n.setSelectionRange(i,n.selectionEnd)}function ui(n,t){const e=n.value.slice(n.selectionStart,n.selectionEnd);let s;t.orderedList||t.unorderedList?s=gi(n,t):t.multiline&&pe(e)?s=mi(n,t):s=fi(n,t),li(n,s)}function hi(n){const t=n.value.split(`
81
+ `);let e=0;for(let s=0;s<t.length;s++){const i=t[s].length+1;n.selectionStart>=e&&n.selectionStart<e+i&&(n.selectionStart=e),n.selectionEnd>=e&&n.selectionEnd<e+i&&(n.selectionEnd=e+i-1),e+=i}}function di(n,t,e,s=!1){if(n.selectionStart===n.selectionEnd)n.selectionStart=ai(n.value,n.selectionStart),n.selectionEnd=ci(n.value,n.selectionEnd,s);else{const i=n.selectionStart-t.length,r=n.selectionEnd+e.length,o=n.value.slice(i,n.selectionStart)===t,a=n.value.slice(n.selectionEnd,r)===e;o&&a&&(n.selectionStart=i,n.selectionEnd=r)}return n.value.slice(n.selectionStart,n.selectionEnd)}function Oe(n){const t=n.value.slice(0,n.selectionStart),e=n.value.slice(n.selectionEnd),s=t.match(/\n*$/),i=e.match(/^\n*/),r=s?s[0].length:0,o=i?i[0].length:0;let a,c;return t.match(/\S/)&&r<2&&(a=fn(`
82
+ `,2-r)),e.match(/\S/)&&o<2&&(c=fn(`
83
+ `,2-o)),a==null&&(a=""),c==null&&(c=""),{newlinesToAppend:a,newlinesToPrepend:c}}function fi(n,t){let e,s;const{prefix:i,suffix:r,blockPrefix:o,blockSuffix:a,replaceNext:c,prefixSpace:l,scanFor:u,surroundWithNewlines:h}=t,d=n.selectionStart,m=n.selectionEnd;let f=n.value.slice(n.selectionStart,n.selectionEnd),p=pe(f)&&o.length>0?`${o}
84
+ `:i,b=pe(f)&&a.length>0?`
85
+ ${a}`:r;if(l){const w=n.value[n.selectionStart-1];n.selectionStart!==0&&w!=null&&!w.match(/\s/)&&(p=` ${p}`)}f=di(n,p,b,t.multiline);let g=n.selectionStart,v=n.selectionEnd;const E=c.length>0&&b.indexOf(c)>-1&&f.length>0;if(h){const w=Oe(n);e=w.newlinesToAppend,s=w.newlinesToPrepend,p=e+i,b+=s}if(f.startsWith(p)&&f.endsWith(b)){const w=f.slice(p.length,f.length-b.length);if(d===m){let y=d-p.length;y=Math.max(y,g),y=Math.min(y,g+w.length),g=v=y}else v=g+w.length;return{text:w,selectionStart:g,selectionEnd:v}}else if(E)if(u.length>0&&f.match(u)){b=b.replace(c,f);const w=p+b;return g=v=g+p.length,{text:w,selectionStart:g,selectionEnd:v}}else{const w=p+f+b;return g=g+p.length+f.length+b.indexOf(c),v=g+c.length,{text:w,selectionStart:g,selectionEnd:v}}else{let w=p+f+b;g=d+p.length,v=m+p.length;const y=f.match(/^\s*|\s*$/g);if(t.trimFirst&&y){const A=y[0]||"",O=y[1]||"";w=A+p+f.trim()+b+O,g+=A.length,v-=O.length}return{text:w,selectionStart:g,selectionEnd:v}}}function mi(n,t){const{prefix:e,suffix:s,surroundWithNewlines:i}=t;let r=n.value.slice(n.selectionStart,n.selectionEnd),o=n.selectionStart,a=n.selectionEnd;const c=r.split(`
86
+ `);if(c.every(u=>u.startsWith(e)&&u.endsWith(s)))r=c.map(u=>u.slice(e.length,u.length-s.length)).join(`
87
+ `),a=o+r.length;else if(r=c.map(u=>e+u+s).join(`
88
+ `),i){const{newlinesToAppend:u,newlinesToPrepend:h}=Oe(n);o+=u.length,a=o+r.length,r=u+r+h}return{text:r,selectionStart:o,selectionEnd:a}}function mn(n){const t=n.split(`
89
+ `),e=/^\d+\.\s+/,s=t.every(r=>e.test(r));let i=t;return s&&(i=t.map(r=>r.replace(e,""))),{text:i.join(`
90
+ `),processed:s}}function pn(n){const t=n.split(`
91
+ `),e="- ",s=t.every(r=>r.startsWith(e));let i=t;return s&&(i=t.map(r=>r.slice(e.length,r.length))),{text:i.join(`
92
+ `),processed:s}}function yt(n,t){return t?"- ":`${n+1}. `}function pi(n,t){let e,s,i;return n.orderedList?(s=mn(t),e=pn(s.text),i=e.text):(s=pn(t),e=mn(s.text),i=e.text),[s,e,i]}function gi(n,t){const e=n.selectionStart===n.selectionEnd;let s=n.selectionStart,i=n.selectionEnd;hi(n);const r=n.value.slice(n.selectionStart,n.selectionEnd),[o,a,c]=pi(t,r),l=c.split(`
93
+ `).map((p,b)=>`${yt(b,t.unorderedList)}${p}`),u=l.reduce((p,b,g)=>p+yt(g,t.unorderedList).length,0),h=l.reduce((p,b,g)=>p+yt(g,!t.unorderedList).length,0);if(o.processed)return e?(s=Math.max(s-yt(0,t.unorderedList).length,0),i=s):(s=n.selectionStart,i=n.selectionEnd-u),{text:c,selectionStart:s,selectionEnd:i};const{newlinesToAppend:d,newlinesToPrepend:m}=Oe(n),f=d+l.join(`
94
+ `)+m;return e?(s=Math.max(s+yt(0,t.unorderedList).length+d.length,0),i=s):a.processed?(s=Math.max(n.selectionStart+d.length,0),i=n.selectionEnd+d.length+u-h):(s=Math.max(n.selectionStart+d.length,0),i=n.selectionEnd+d.length+u),{text:f,selectionStart:s,selectionEnd:i}}function ge(n,t){const e=n.closest("markdown-toolbar");if(!(e instanceof Kt))return;const i=Object.assign(Object.assign({},{prefix:"",suffix:"",blockPrefix:"",blockSuffix:"",multiline:!1,replaceNext:"",prefixSpace:!1,scanFor:"",surroundWithNewlines:!1,orderedList:!1,unorderedList:!1,trimFirst:!1}),t),r=e.field;r&&(r.focus(),ui(r,i))}var bi=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},gn=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},kt;class vi{formatToParts(t){const e=[];for(const s of t)e.push({type:"element",value:s}),e.push({type:"literal",value:", "});return e.slice(0,-1)}}const wi=typeof Intl<"u"&&Intl.ListFormat||vi,yi=[["years","year"],["months","month"],["weeks","week"],["days","day"],["hours","hour"],["minutes","minute"],["seconds","second"],["milliseconds","millisecond"]],Ei={minimumIntegerDigits:2};class Ai{constructor(t,e={}){kt.set(this,void 0);let s=String(e.style||"short");s!=="long"&&s!=="short"&&s!=="narrow"&&s!=="digital"&&(s="short");let i=s==="digital"?"numeric":s;const r=e.hours||i;i=r==="2-digit"?"numeric":r;const o=e.minutes||i;i=o==="2-digit"?"numeric":o;const a=e.seconds||i;i=a==="2-digit"?"numeric":a;const c=e.milliseconds||i;bi(this,kt,{locale:t,style:s,years:e.years||s==="digital"?"short":s,yearsDisplay:e.yearsDisplay==="always"?"always":"auto",months:e.months||s==="digital"?"short":s,monthsDisplay:e.monthsDisplay==="always"?"always":"auto",weeks:e.weeks||s==="digital"?"short":s,weeksDisplay:e.weeksDisplay==="always"?"always":"auto",days:e.days||s==="digital"?"short":s,daysDisplay:e.daysDisplay==="always"?"always":"auto",hours:r,hoursDisplay:e.hoursDisplay==="always"||s==="digital"?"always":"auto",minutes:o,minutesDisplay:e.minutesDisplay==="always"||s==="digital"?"always":"auto",seconds:a,secondsDisplay:e.secondsDisplay==="always"||s==="digital"?"always":"auto",milliseconds:c,millisecondsDisplay:e.millisecondsDisplay==="always"?"always":"auto"},"f")}resolvedOptions(){return gn(this,kt,"f")}formatToParts(t){const e=[],s=gn(this,kt,"f"),i=s.style,r=s.locale;for(const[o,a]of yi){const c=t[o];if(s[`${o}Display`]==="auto"&&!c)continue;const l=s[o],u=l==="2-digit"?Ei:l==="numeric"?{}:{style:"unit",unit:a,unitDisplay:l};e.push(new Intl.NumberFormat(r,u).format(c))}return new wi(r,{type:"unit",style:i==="digital"?"short":i}).formatToParts(e)}format(t){return this.formatToParts(t).map(e=>e.value).join("")}}kt=new WeakMap;const Yn=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,Ut=["year","month","week","day","hour","minute","second","millisecond"],xi=n=>Yn.test(n);class S{constructor(t=0,e=0,s=0,i=0,r=0,o=0,a=0,c=0){this.years=t,this.months=e,this.weeks=s,this.days=i,this.hours=r,this.minutes=o,this.seconds=a,this.milliseconds=c,this.years||(this.years=0),this.sign||(this.sign=Math.sign(this.years)),this.months||(this.months=0),this.sign||(this.sign=Math.sign(this.months)),this.weeks||(this.weeks=0),this.sign||(this.sign=Math.sign(this.weeks)),this.days||(this.days=0),this.sign||(this.sign=Math.sign(this.days)),this.hours||(this.hours=0),this.sign||(this.sign=Math.sign(this.hours)),this.minutes||(this.minutes=0),this.sign||(this.sign=Math.sign(this.minutes)),this.seconds||(this.seconds=0),this.sign||(this.sign=Math.sign(this.seconds)),this.milliseconds||(this.milliseconds=0),this.sign||(this.sign=Math.sign(this.milliseconds)),this.blank=this.sign===0}abs(){return new S(Math.abs(this.years),Math.abs(this.months),Math.abs(this.weeks),Math.abs(this.days),Math.abs(this.hours),Math.abs(this.minutes),Math.abs(this.seconds),Math.abs(this.milliseconds))}static from(t){var e;if(typeof t=="string"){const s=String(t).trim(),i=s.startsWith("-")?-1:1,r=(e=s.match(Yn))===null||e===void 0?void 0:e.slice(1).map(o=>(Number(o)||0)*i);return r?new S(...r):new S}else if(typeof t=="object"){const{years:s,months:i,weeks:r,days:o,hours:a,minutes:c,seconds:l,milliseconds:u}=t;return new S(s,i,r,o,a,c,l,u)}throw new RangeError("invalid duration")}static compare(t,e){const s=Date.now(),i=Math.abs(bn(s,S.from(t)).getTime()-s),r=Math.abs(bn(s,S.from(e)).getTime()-s);return i>r?-1:i<r?1:0}toLocaleString(t,e){return new Ai(t,e).format(this)}}function bn(n,t){const e=new Date(n);return e.setFullYear(e.getFullYear()+t.years),e.setMonth(e.getMonth()+t.months),e.setDate(e.getDate()+t.weeks*7+t.days),e.setHours(e.getHours()+t.hours),e.setMinutes(e.getMinutes()+t.minutes),e.setSeconds(e.getSeconds()+t.seconds),e}function Ti(n,t="second",e=Date.now()){const s=n.getTime()-e;if(s===0)return new S;const i=Math.sign(s),r=Math.abs(s),o=Math.floor(r/1e3),a=Math.floor(o/60),c=Math.floor(a/60),l=Math.floor(c/24),u=Math.floor(l/30),h=Math.floor(u/12),d=Ut.indexOf(t)||Ut.length;return new S(d>=0?h*i:0,d>=1?(u-h*12)*i:0,0,d>=3?(l-u*30)*i:0,d>=4?(c-l*24)*i:0,d>=5?(a-c*60)*i:0,d>=6?(o-a*60)*i:0,d>=7?(r-o*1e3)*i:0)}function Xn(n,{relativeTo:t=Date.now()}={}){if(t=new Date(t),n.blank)return n;const e=n.sign;let s=Math.abs(n.years),i=Math.abs(n.months),r=Math.abs(n.weeks),o=Math.abs(n.days),a=Math.abs(n.hours),c=Math.abs(n.minutes),l=Math.abs(n.seconds),u=Math.abs(n.milliseconds);u>=900&&(l+=Math.round(u/1e3)),(l||c||a||o||r||i||s)&&(u=0),l>=55&&(c+=Math.round(l/60)),(c||a||o||r||i||s)&&(l=0),c>=55&&(a+=Math.round(c/60)),(a||o||r||i||s)&&(c=0),o&&a>=12&&(o+=Math.round(a/24)),!o&&a>=21&&(o+=Math.round(a/24)),(o||r||i||s)&&(a=0);const h=t.getFullYear();let d=t.getMonth();const m=t.getDate();if(o>=27||s+i+o){const f=new Date(t);f.setFullYear(h+s*e),f.setMonth(d+i*e),f.setDate(m+o*e);const p=f.getFullYear()-t.getFullYear(),b=f.getMonth()-t.getMonth(),g=Math.abs(Math.round((Number(f)-Number(t))/864e5)),v=Math.abs(p*12+b);g<27?(o>=6?(r+=Math.round(o/7),o=0):o=g,i=s=0):v<11?(i=v,s=0):(i=0,s=p*e),(i||s)&&(o=0),d=t.getMonth()}return s&&(i=0),r>=4&&(i+=Math.round(r/4)),(i||s)&&(r=0),o&&r&&!i&&!s&&(r+=Math.round(o/7),o=0),new S(s*e,i*e,r*e,o*e,a*e,c*e,l*e,u*e)}function Oi(n,t){const e=Xn(n,t);if(e.blank)return[0,"second"];for(const s of Ut){if(s==="millisecond")continue;const i=e[`${s}s`];if(i)return[i,s]}return[0,"second"]}var x=function(n,t,e,s){if(e==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?s:e==="a"?s.call(n):s?s.value:t.get(n)},It=function(n,t,e,s,i){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},B,Mt,Ct,Et,tt,be,Gn,Zn,Jn,Qn,ct;const ki=globalThis.HTMLElement||null,ce=new S,vn=new S(0,0,0,0,0,1);class Mi extends Event{constructor(t,e,s,i){super("relative-time-updated",{bubbles:!0,composed:!0}),this.oldText=t,this.newText=e,this.oldTitle=s,this.newTitle=i}}function wn(n){if(!n.date)return 1/0;if(n.format==="duration"||n.format==="elapsed"){const e=n.precision;if(e==="second")return 1e3;if(e==="minute")return 60*1e3}const t=Math.abs(Date.now()-n.date.getTime());return t<60*1e3?1e3:t<60*60*1e3?60*1e3:60*60*1e3}const le=new class{constructor(){this.elements=new Set,this.time=1/0,this.timer=-1}observe(n){if(this.elements.has(n))return;this.elements.add(n);const t=n.date;if(t&&t.getTime()){const e=wn(n),s=Date.now()+e;s<this.time&&(clearTimeout(this.timer),this.timer=setTimeout(()=>this.update(),e),this.time=s)}}unobserve(n){this.elements.has(n)&&this.elements.delete(n)}update(){if(clearTimeout(this.timer),!this.elements.size)return;let n=1/0;for(const t of this.elements)n=Math.min(n,wn(t)),t.update();this.time=Math.min(60*60*1e3,n),this.timer=setTimeout(()=>this.update(),this.time),this.time+=Date.now()}};class Ci extends ki{constructor(){super(...arguments),B.add(this),Mt.set(this,!1),Ct.set(this,!1),tt.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this),ct.set(this,null)}static define(t="relative-time",e=customElements){return e.define(t,this),this}static get observedAttributes(){return["second","minute","hour","weekday","day","month","year","time-zone-name","prefix","threshold","tense","precision","format","format-style","datetime","lang","title"]}get onRelativeTimeUpdated(){return x(this,ct,"f")}set onRelativeTimeUpdated(t){x(this,ct,"f")&&this.removeEventListener("relative-time-updated",x(this,ct,"f")),It(this,ct,typeof t=="object"||typeof t=="function"?t:null,"f"),typeof t=="function"&&this.addEventListener("relative-time-updated",t)}get second(){const t=this.getAttribute("second");if(t==="numeric"||t==="2-digit")return t}set second(t){this.setAttribute("second",t||"")}get minute(){const t=this.getAttribute("minute");if(t==="numeric"||t==="2-digit")return t}set minute(t){this.setAttribute("minute",t||"")}get hour(){const t=this.getAttribute("hour");if(t==="numeric"||t==="2-digit")return t}set hour(t){this.setAttribute("hour",t||"")}get weekday(){const t=this.getAttribute("weekday");if(t==="long"||t==="short"||t==="narrow")return t;if(this.format==="datetime"&&t!=="")return this.formatStyle}set weekday(t){this.setAttribute("weekday",t||"")}get day(){var t;const e=(t=this.getAttribute("day"))!==null&&t!==void 0?t:"numeric";if(e==="numeric"||e==="2-digit")return e}set day(t){this.setAttribute("day",t||"")}get month(){const t=this.format;let e=this.getAttribute("month");if(e!==""&&(e??(e=t==="datetime"?this.formatStyle:"short"),e==="numeric"||e==="2-digit"||e==="short"||e==="long"||e==="narrow"))return e}set month(t){this.setAttribute("month",t||"")}get year(){var t;const e=this.getAttribute("year");if(e==="numeric"||e==="2-digit")return e;if(!this.hasAttribute("year")&&new Date().getUTCFullYear()!==((t=this.date)===null||t===void 0?void 0:t.getUTCFullYear()))return"numeric"}set year(t){this.setAttribute("year",t||"")}get timeZoneName(){const t=this.getAttribute("time-zone-name");if(t==="long"||t==="short"||t==="shortOffset"||t==="longOffset"||t==="shortGeneric"||t==="longGeneric")return t}set timeZoneName(t){this.setAttribute("time-zone-name",t||"")}get prefix(){var t;return(t=this.getAttribute("prefix"))!==null&&t!==void 0?t:this.format==="datetime"?"":"on"}set prefix(t){this.setAttribute("prefix",t)}get threshold(){const t=this.getAttribute("threshold");return t&&xi(t)?t:"P30D"}set threshold(t){this.setAttribute("threshold",t)}get tense(){const t=this.getAttribute("tense");return t==="past"?"past":t==="future"?"future":"auto"}set tense(t){this.setAttribute("tense",t)}get precision(){const t=this.getAttribute("precision");return Ut.includes(t)?t:this.format==="micro"?"minute":"second"}set precision(t){this.setAttribute("precision",t)}get format(){const t=this.getAttribute("format");return t==="datetime"?"datetime":t==="relative"?"relative":t==="duration"?"duration":t==="micro"?"micro":t==="elapsed"?"elapsed":"auto"}set format(t){this.setAttribute("format",t)}get formatStyle(){const t=this.getAttribute("format-style");if(t==="long")return"long";if(t==="short")return"short";if(t==="narrow")return"narrow";const e=this.format;return e==="elapsed"||e==="micro"?"narrow":e==="datetime"?"short":"long"}set formatStyle(t){this.setAttribute("format-style",t)}get datetime(){return this.getAttribute("datetime")||""}set datetime(t){this.setAttribute("datetime",t)}get date(){const t=Date.parse(this.datetime);return Number.isNaN(t)?null:new Date(t)}set date(t){this.datetime=(t==null?void 0:t.toISOString())||""}connectedCallback(){this.update()}disconnectedCallback(){le.unobserve(this)}attributeChangedCallback(t,e,s){e!==s&&(t==="title"&&It(this,Mt,s!==null&&(this.date&&x(this,B,"m",be).call(this,this.date))!==s,"f"),!x(this,Ct,"f")&&!(t==="title"&&x(this,Mt,"f"))&&It(this,Ct,(async()=>{await Promise.resolve(),this.update()})(),"f"))}update(){const t=x(this,tt,"f").textContent||this.textContent||"",e=this.getAttribute("title")||"";let s=e;const i=this.date;if(typeof Intl>"u"||!Intl.DateTimeFormat||!i){x(this,tt,"f").textContent=t;return}const r=Date.now();x(this,Mt,"f")||(s=x(this,B,"m",be).call(this,i)||"",s&&this.setAttribute("title",s));const o=Ti(i,this.precision,r),a=x(this,B,"m",Gn).call(this,o);let c=t;a==="duration"?c=x(this,B,"m",Zn).call(this,o):a==="relative"?c=x(this,B,"m",Jn).call(this,o):c=x(this,B,"m",Qn).call(this,i),c?x(this,tt,"f").textContent=c:this.shadowRoot===x(this,tt,"f")&&this.textContent&&(x(this,tt,"f").textContent=this.textContent),(c!==t||s!==e)&&this.dispatchEvent(new Mi(t,c,e,s)),a==="relative"||a==="duration"?le.observe(this):le.unobserve(this),It(this,Ct,!1,"f")}}Mt=new WeakMap,Ct=new WeakMap,tt=new WeakMap,ct=new WeakMap,B=new WeakSet,Et=function(){var t;return((t=this.closest("[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"))||this.ownerDocument.documentElement.getAttribute("lang")||"default"},be=function(t){return new Intl.DateTimeFormat(x(this,B,"a",Et),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},Gn=function(t){const e=this.format;if(e==="datetime")return"datetime";if(e==="duration"||e==="elapsed"||e==="micro")return"duration";if((e==="auto"||e==="relative")&&typeof Intl<"u"&&Intl.RelativeTimeFormat){const s=this.tense;if(s==="past"||s==="future"||S.compare(t,this.threshold)===1)return"relative"}return"datetime"},Zn=function(t){const e=x(this,B,"a",Et),s=this.format,i=this.formatStyle,r=this.tense;let o=ce;s==="micro"?(t=Xn(t),o=vn,(this.tense==="past"&&t.sign!==-1||this.tense==="future"&&t.sign!==1)&&(t=vn)):(r==="past"&&t.sign!==-1||r==="future"&&t.sign!==1)&&(t=o);const a=`${this.precision}sDisplay`;return t.blank?o.toLocaleString(e,{style:i,[a]:"always"}):t.abs().toLocaleString(e,{style:i})},Jn=function(t){const e=new Intl.RelativeTimeFormat(x(this,B,"a",Et),{numeric:"auto",style:this.formatStyle}),s=this.tense;s==="future"&&t.sign!==1&&(t=ce),s==="past"&&t.sign!==-1&&(t=ce);const[i,r]=Oi(t);return r==="second"&&i<10?e.format(0,this.precision==="millisecond"?"second":this.precision):e.format(i,r)},Qn=function(t){const e=new Intl.DateTimeFormat(x(this,B,"a",Et),{second:this.second,minute:this.minute,hour:this.hour,weekday:this.weekday,day:this.day,month:this.month,year:this.year,timeZoneName:this.timeZoneName});return`${this.prefix} ${e.format(t)}`.trim()};const yn=typeof globalThis<"u"?globalThis:window;try{yn.RelativeTimeElement=Ci.define()}catch(n){if(!(yn.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}localStorage.getItem("theme");window.matchMedia("(prefers-color-scheme: dark)").matches;class Si{constructor(t,e,s){this.eventTarget=t,this.eventName=e,this.eventOptions=s,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=Li(t);for(const s of this.bindings){if(e.immediatePropagationStopped)break;s.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((t,e)=>{const s=t.index,i=e.index;return s<i?-1:s>i?1:0})}}function Li(n){if("immediatePropagationStopped"in n)return n;{const{stopImmediatePropagation:t}=n;return Object.assign(n,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}class Fi{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(t=>t.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(t=>t.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((t,e)=>t.concat(Array.from(e.values())),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,s={}){this.application.handleError(t,`Error ${e}`,s)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:s,eventOptions:i}=t,r=this.fetchEventListenerMapForEventTarget(e),o=this.cacheKey(s,i);r.delete(o),r.size==0&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:s,eventOptions:i}=t;return this.fetchEventListener(e,s,i)}fetchEventListener(t,e,s){const i=this.fetchEventListenerMapForEventTarget(t),r=this.cacheKey(e,s);let o=i.get(r);return o||(o=this.createEventListener(t,e,s),i.set(r,o)),o}createEventListener(t,e,s){const i=new Si(t,e,s);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const s=[t];return Object.keys(e).sort().forEach(i=>{s.push(`${e[i]?"":"!"}${i}`)}),s.join(":")}}const Di={stop({event:n,value:t}){return t&&n.stopPropagation(),!0},prevent({event:n,value:t}){return t&&n.preventDefault(),!0},self({event:n,value:t,element:e}){return t?e===n.target:!0}},_i=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Bi(n){const e=n.trim().match(_i)||[];let s=e[2],i=e[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:$i(e[4]),eventName:s,eventOptions:e[7]?Ri(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||i}}function $i(n){if(n=="window")return window;if(n=="document")return document}function Ri(n){return n.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function Pi(n){if(n==window)return"window";if(n==document)return"document"}function ke(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function ve(n){return ke(n.replace(/--/g,"-").replace(/__/g,"_"))}function Bt(n){return n.charAt(0).toUpperCase()+n.slice(1)}function ts(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function Ni(n){return n.match(/[^\s]+/g)||[]}function En(n){return n!=null}function we(n,t){return Object.prototype.hasOwnProperty.call(n,t)}const An=["meta","ctrl","alt","shift"];class Ii{constructor(t,e,s,i){this.element=t,this.index=e,this.eventTarget=s.eventTarget||t,this.eventName=s.eventName||ji(t)||jt("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||jt("missing identifier"),this.methodName=s.methodName||jt("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=i}static forToken(t,e){return new this(t.element,t.index,Bi(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;const s=e.filter(i=>!An.includes(i))[0];return s?(we(this.keyMappings,s)||jt(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[s].toLowerCase()!==t.key.toLowerCase()):!1}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;const e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:s,value:i}of Array.from(this.element.attributes)){const r=s.match(e),o=r&&r[1];o&&(t[ke(o)]=Hi(i))}return t}get eventTargetName(){return Pi(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[s,i,r,o]=An.map(a=>e.includes(a));return t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o}}const xn={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:n=>n.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function ji(n){const t=n.tagName.toLowerCase();if(t in xn)return xn[t](n)}function jt(n){throw new Error(n)}function Hi(n){try{return JSON.parse(n)}catch{return n}}class Vi{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){const e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if(typeof t=="function")return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:s}=this.context.application,{controller:i}=this.context;let r=!0;for(const[o,a]of Object.entries(this.eventOptions))if(o in s){const c=s[o];r=r&&c({name:o,value:a,event:t,element:e,controller:i})}else continue;return r}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){const{target:e,currentTarget:s}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:s,action:this.methodName})}catch(i){const{identifier:r,controller:o,element:a,index:c}=this,l={identifier:r,controller:o,element:a,index:c,event:t};this.context.handleError(i,`invoking action "${this.action}"`,l)}}willBeInvokedByEvent(t){const e=t.target;return t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t)||t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t)?!1:this.element===e?!0:e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class es{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){t.type=="attributes"?this.processAttributeChange(t.target,t.attributeName):t.type=="childList"&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(const e of Array.from(t)){const s=this.elementFromNode(e);s&&this.processTree(s,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const s=this.elementFromNode(e);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const s of this.matchElementsInTree(t))e.call(this,s)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected!=this.element.isConnected?!1:this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class ns{constructor(t,e,s){this.attributeName=e,this.delegate=s,this.elementObserver=new es(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],s=Array.from(t.querySelectorAll(this.selector));return e.concat(s)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function Wi(n,t,e){ss(n,t).add(e)}function Ki(n,t,e){ss(n,t).delete(e),Ui(n,t)}function ss(n,t){let e=n.get(t);return e||(e=new Set,n.set(t,e)),e}function Ui(n,t){const e=n.get(t);e!=null&&e.size==0&&n.delete(t)}class et{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,s)=>e.concat(Array.from(s)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,s)=>e+s.size,0)}add(t,e){Wi(this.valuesByKey,t,e)}delete(t,e){Ki(this.valuesByKey,t,e)}has(t,e){const s=this.valuesByKey.get(t);return s!=null&&s.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some(s=>s.has(t))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter(([e,s])=>s.has(t)).map(([e,s])=>e)}}class qi{constructor(t,e,s,i){this._selector=e,this.details=i,this.elementObserver=new es(t,this),this.delegate=s,this.matchesByElement=new et}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const{selector:e}=this;if(e){const s=t.matches(e);return this.delegate.selectorMatchElement?s&&this.delegate.selectorMatchElement(t,this.details):s}else return!1}matchElementsInTree(t){const{selector:e}=this;if(e){const s=this.matchElement(t)?[t]:[],i=Array.from(t.querySelectorAll(e)).filter(r=>this.matchElement(r));return s.concat(i)}else return[]}elementMatched(t){const{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){const e=this.matchesByElement.getKeysForValue(t);for(const s of e)this.selectorUnmatched(t,s)}elementAttributeChanged(t,e){const{selector:s}=this;if(s){const i=this.matchElement(t),r=this.matchesByElement.has(s,t);i&&!r?this.selectorMatched(t,s):!i&&r&&this.selectorUnmatched(t,s)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}}class zi{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const s=this.delegate.getStringMapKeyForAttribute(t);if(s!=null){this.stringMap.has(t)||this.stringMapKeyAdded(s,t);const i=this.element.getAttribute(t);if(this.stringMap.get(t)!=i&&this.stringMapValueChanged(i,s,e),i==null){const r=this.stringMap.get(t);this.stringMap.delete(t),r&&this.stringMapKeyRemoved(s,t,r)}else this.stringMap.set(t,i)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,s)}stringMapKeyRemoved(t,e,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,s)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(t=>t.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class is{constructor(t,e,s){this.attributeObserver=new ns(t,e,this),this.delegate=s,this.tokensByElement=new et}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,s]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(s)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach(e=>this.tokenMatched(e))}tokensUnmatched(t){t.forEach(e=>this.tokenUnmatched(e))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),s=this.readTokensForElement(t),i=Xi(e,s).findIndex(([r,o])=>!Gi(r,o));return i==-1?[[],[]]:[e.slice(i),s.slice(i)]}readTokensForElement(t){const e=this.attributeName,s=t.getAttribute(e)||"";return Yi(s,t,e)}}function Yi(n,t,e){return n.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:t,attributeName:e,content:s,index:i}))}function Xi(n,t){const e=Math.max(n.length,t.length);return Array.from({length:e},(s,i)=>[n[i],t[i]])}function Gi(n,t){return n&&t&&n.index==t.index&&n.content==t.content}class rs{constructor(t,e,s){this.tokenListObserver=new is(t,e,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:s}=this.fetchParseResultForToken(t);s&&(this.fetchValuesByTokenForElement(e).set(t,s),this.delegate.elementMatchedValue(e,s))}tokenUnmatched(t){const{element:e}=t,{value:s}=this.fetchParseResultForToken(t);s&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,s))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(e){return{error:e}}}}class Zi{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new rs(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new Vi(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach(t=>this.delegate.bindingDisconnected(t,!0)),this.bindingsByAction.clear()}parseValueForToken(t){const e=Ii.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class Ji{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new zi(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const s=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,s.writer(this.receiver[t]),s.writer(s.defaultValue))}stringMapValueChanged(t,e,s){const i=this.valueDescriptorNameMap[e];t!==null&&(s===null&&(s=i.writer(i.defaultValue)),this.invokeChangedCallback(e,t,s))}stringMapKeyRemoved(t,e,s){const i=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,i.writer(this.receiver[t]),s):this.invokeChangedCallback(t,i.writer(i.defaultValue),s)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:s,writer:i}of this.valueDescriptors)s!=null&&!this.controller.data.has(t)&&this.invokeChangedCallback(e,i(s),void 0)}invokeChangedCallback(t,e,s){const i=`${t}Changed`,r=this.receiver[i];if(typeof r=="function"){const o=this.valueDescriptorNameMap[t];try{const a=o.reader(e);let c=s;s&&(c=o.reader(s)),r.call(this.receiver,a,c)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map(e=>t[e])}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach(e=>{const s=this.valueDescriptorMap[e];t[s.name]=s}),t}hasValue(t){const e=this.valueDescriptorNameMap[t],s=`has${Bt(e.name)}`;return this.receiver[s]}}class Qi{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new et}start(){this.tokenListObserver||(this.tokenListObserver=new is(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var s;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetConnected(t,e)))}disconnectTarget(t,e){var s;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetDisconnected(t,e)))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function $t(n,t){const e=os(n);return Array.from(e.reduce((s,i)=>(er(i,t).forEach(r=>s.add(r)),s),new Set))}function tr(n,t){return os(n).reduce((s,i)=>(s.push(...nr(i,t)),s),[])}function os(n){const t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function er(n,t){const e=n[t];return Array.isArray(e)?e:[]}function nr(n,t){const e=n[t];return e?Object.keys(e).map(s=>[s,e[s]]):[]}class sr{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new et,this.outletElementsByName=new et,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)}),this.started=!0,this.dependentContexts.forEach(t=>t.refresh()))}refresh(){this.selectorObserverMap.forEach(t=>t.refresh()),this.attributeObserverMap.forEach(t=>t.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(t=>t.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(t=>t.stop()),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:s}){const i=this.getOutlet(t,s);i&&this.connectOutlet(i,t,s)}selectorUnmatched(t,e,{outletName:s}){const i=this.getOutletFromMap(t,s);i&&this.disconnectOutlet(i,t,s)}selectorMatchElement(t,{outletName:e}){const s=this.selector(e),i=this.hasOutlet(t,e),r=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return s?i&&r&&t.matches(s):!1}elementMatchedAttribute(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}elementAttributeValueChanged(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}elementUnmatchedAttribute(t,e){const s=this.getOutletNameFromOutletAttributeName(e);s&&this.updateSelectorObserverForOutlet(s)}connectOutlet(t,e,s){var i;this.outletElementsByName.has(s,e)||(this.outletsByName.add(s,t),this.outletElementsByName.add(s,e),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletConnected(t,e,s)))}disconnectOutlet(t,e,s){var i;this.outletElementsByName.has(s,e)&&(this.outletsByName.delete(s,t),this.outletElementsByName.delete(s,e),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletDisconnected(t,e,s)))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const s of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(s,e,t)}updateSelectorObserverForOutlet(t){const e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){const e=this.selector(t),s=new qi(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,s),s.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),s=new ns(this.scope.element,e,this);this.attributeObserverMap.set(t,s),s.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find(e=>this.attributeNameForOutletName(e)===t)}get outletDependencies(){const t=new et;return this.router.modules.forEach(e=>{const s=e.definition.controllerConstructor;$t(s,"outlets").forEach(r=>t.add(r,e.identifier))}),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter(e=>t.includes(e.identifier))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find(s=>s.element===t)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class ir{constructor(t,e){this.logDebugActivity=(s,i={})=>{const{identifier:r,controller:o,element:a}=this;i=Object.assign({identifier:r,controller:o,element:a},i),this.application.logDebugActivity(this.identifier,s,i)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new Zi(this,this.dispatcher),this.valueObserver=new Ji(this,this.controller),this.targetObserver=new Qi(this,this),this.outletObserver=new sr(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(s){this.handleError(s,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,s={}){const{identifier:i,controller:r,element:o}=this;s=Object.assign({identifier:i,controller:r,element:o},s),this.application.handleError(t,`Error ${e}`,s)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,s){this.invokeControllerMethod(`${ve(s)}OutletConnected`,t,e)}outletDisconnected(t,e,s){this.invokeControllerMethod(`${ve(s)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const s=this.controller;typeof s[t]=="function"&&s[t](...e)}}function rr(n){return or(n,ar(n))}function or(n,t){const e=hr(n),s=cr(n.prototype,t);return Object.defineProperties(e.prototype,s),e}function ar(n){return $t(n,"blessings").reduce((e,s)=>{const i=s(n);for(const r in i){const o=e[r]||{};e[r]=Object.assign(o,i[r])}return e},{})}function cr(n,t){return ur(t).reduce((e,s)=>{const i=lr(n,t,s);return i&&Object.assign(e,{[s]:i}),e},{})}function lr(n,t,e){const s=Object.getOwnPropertyDescriptor(n,e);if(!(s&&"value"in s)){const r=Object.getOwnPropertyDescriptor(t,e).value;return s&&(r.get=s.get||r.get,r.set=s.set||r.set),r}}const ur=typeof Object.getOwnPropertySymbols=="function"?n=>[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)]:Object.getOwnPropertyNames,hr=(()=>{function n(e){function s(){return Reflect.construct(e,arguments,new.target)}return s.prototype=Object.create(e.prototype,{constructor:{value:s}}),Reflect.setPrototypeOf(s,e),s}function t(){const s=n(function(){this.a.call(this)});return s.prototype.a=function(){},new s}try{return t(),n}catch{return s=>class extends s{}}})();function dr(n){return{identifier:n.identifier,controllerConstructor:rr(n.controllerConstructor)}}class fr{constructor(t,e){this.application=t,this.definition=dr(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new ir(this,t),this.contextsByScope.set(t,e)),e}}class mr{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return Ni(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class pr{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const s=this.getAttributeNameForKey(t);return this.element.setAttribute(s,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}else return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${ts(t)}`}}class gr{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,s){let i=this.warnedKeysByObject.get(t);i||(i=new Set,this.warnedKeysByObject.set(t,i)),i.has(e)||(i.add(e),this.logger.warn(s,t))}}function ye(n,t){return`[${n}~="${t}"]`}class br{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,s)=>e||this.findTarget(s)||this.findLegacyTarget(s),void 0)}findAll(...t){return t.reduce((e,s)=>[...e,...this.findAllTargets(s),...this.findAllLegacyTargets(s)],[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){const e=this.schema.targetAttributeForScope(this.identifier);return ye(e,t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map(s=>this.deprecate(s,t))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return ye(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:s}=this,i=this.schema.targetAttribute,r=this.schema.targetAttributeForScope(s);this.guide.warn(t,`target:${e}`,`Please replace ${i}="${s}.${e}" with ${r}="${e}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class vr{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,s)=>e||this.findOutlet(s),void 0)}findAll(...t){return t.reduce((e,s)=>[...e,...this.findAllOutlets(s)],[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter(i=>this.matchesElement(i,t,e))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter(i=>this.matchesElement(i,t,e))}matchesElement(t,e,s){const i=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&i.split(" ").includes(s)}}class Me{constructor(t,e,s,i){this.targets=new br(this),this.classes=new mr(this),this.data=new pr(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=s,this.guide=new gr(i),this.outlets=new vr(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return ye(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Me(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class wr{constructor(t,e,s){this.element=t,this.schema=e,this.delegate=s,this.valueListObserver=new rs(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:s}=t;return this.parseValueForElementAndIdentifier(e,s)}parseValueForElementAndIdentifier(t,e){const s=this.fetchScopesByIdentifierForElement(t);let i=s.get(e);return i||(i=this.delegate.createScopeForElementAndIdentifier(t,e),s.set(e,i)),i}elementMatchedValue(t,e){const s=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,s),s==1&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const s=this.scopeReferenceCounts.get(e);s&&(this.scopeReferenceCounts.set(e,s-1),s==1&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class yr{constructor(t){this.application=t,this.scopeObserver=new wr(this.element,this.schema,this),this.scopesByIdentifier=new et,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((t,e)=>t.concat(e.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new fr(this.application,t);this.connectModule(e);const s=t.controllerConstructor.afterLoad;s&&s.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const s=this.modulesByIdentifier.get(e);if(s)return s.contexts.find(i=>i.element==t)}proposeToConnectScopeForElementAndIdentifier(t,e){const s=this.scopeObserver.parseValueForElementAndIdentifier(t,e);s?this.scopeObserver.elementMatchedValue(s.element,s):console.error(`Couldn't find or create scope for identifier: "${e}" and element:`,t)}handleError(t,e,s){this.application.handleError(t,e,s)}createScopeForElementAndIdentifier(t,e){return new Me(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(s=>t.connectContextForScope(s))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(s=>t.disconnectContextForScope(s))}}const Er={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:n=>`data-${n}-target`,outletAttributeForScope:(n,t)=>`data-${n}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Tn("abcdefghijklmnopqrstuvwxyz".split("").map(n=>[n,n]))),Tn("0123456789".split("").map(n=>[n,n])))};function Tn(n){return n.reduce((t,[e,s])=>Object.assign(Object.assign({},t),{[e]:s}),{})}class Ar{constructor(t=document.documentElement,e=Er){this.logger=console,this.debug=!1,this.logDebugActivity=(s,i,r={})=>{this.debug&&this.logFormattedMessage(s,i,r)},this.element=t,this.schema=e,this.dispatcher=new Fi(this),this.router=new yr(this),this.actionDescriptorFilters=Object.assign({},Di)}static start(t,e){const s=new this(t,e);return s.start(),s}async start(){await xr(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(i=>{i.controllerConstructor.shouldLoad&&this.router.loadDefinition(i)})}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(i=>this.router.unloadIdentifier(i))}get controllers(){return this.router.contexts.map(t=>t.controller)}getControllerForElementAndIdentifier(t,e){const s=this.router.getContextForElementAndIdentifier(t,e);return s?s.controller:null}handleError(t,e,s){var i;this.logger.error(`%s
95
+
96
+ %o
97
+
98
+ %o`,e,t,s),(i=window.onerror)===null||i===void 0||i.call(window,e,"",0,0,t)}logFormattedMessage(t,e,s={}){s=Object.assign({application:this},s),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},s)),this.logger.groupEnd()}}function xr(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function Tr(n){return $t(n,"classes").reduce((e,s)=>Object.assign(e,Or(s)),{})}function Or(n){return{[`${n}Class`]:{get(){const{classes:t}=this;if(t.has(n))return t.get(n);{const e=t.getAttributeName(n);throw new Error(`Missing attribute "${e}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${Bt(n)}Class`]:{get(){return this.classes.has(n)}}}}function kr(n){return $t(n,"outlets").reduce((e,s)=>Object.assign(e,Mr(s)),{})}function On(n,t,e){return n.application.getControllerForElementAndIdentifier(t,e)}function kn(n,t,e){let s=On(n,t,e);if(s||(n.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),s=On(n,t,e),s))return s}function Mr(n){const t=ve(n);return{[`${t}Outlet`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e){const i=kn(this,e,n);if(i)return i;throw new Error(`The provided outlet element is missing an outlet controller "${n}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${n}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${t}Outlets`]:{get(){const e=this.outlets.findAll(n);return e.length>0?e.map(s=>{const i=kn(this,s,n);if(i)return i;console.warn(`The provided outlet element is missing an outlet controller "${n}" instance for host controller "${this.identifier}"`,s)}).filter(s=>s):[]}},[`${t}OutletElement`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e)return e;throw new Error(`Missing outlet element "${n}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(n)}},[`has${Bt(t)}Outlet`]:{get(){return this.outlets.has(n)}}}}function Cr(n){return $t(n,"targets").reduce((e,s)=>Object.assign(e,Sr(s)),{})}function Sr(n){return{[`${n}Target`]:{get(){const t=this.targets.find(n);if(t)return t;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${Bt(n)}Target`]:{get(){return this.targets.has(n)}}}}function Lr(n){const t=tr(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((s,i)=>{const r=as(i,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(s,{[o]:r})},{})}}};return t.reduce((s,i)=>Object.assign(s,Fr(i)),e)}function Fr(n,t){const e=as(n,t),{key:s,name:i,reader:r,writer:o}=e;return{[i]:{get(){const a=this.data.get(s);return a!==null?r(a):e.defaultValue},set(a){a===void 0?this.data.delete(s):this.data.set(s,o(a))}},[`has${Bt(i)}`]:{get(){return this.data.has(s)||e.hasCustomDefaultValue}}}}function as([n,t],e){return $r({controller:e,token:n,typeDefinition:t})}function qt(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Dt(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(n))return"array";if(Object.prototype.toString.call(n)==="[object Object]")return"object"}function Dr(n){const{controller:t,token:e,typeObject:s}=n,i=En(s.type),r=En(s.default),o=i&&r,a=i&&!r,c=!i&&r,l=qt(s.type),u=Dt(n.typeObject.default);if(a)return l;if(c)return u;if(l!==u){const h=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${h}" must match the defined type "${l}". The provided default value of "${s.default}" is of type "${u}".`)}if(o)return l}function _r(n){const{controller:t,token:e,typeDefinition:s}=n,r=Dr({controller:t,token:e,typeObject:s}),o=Dt(s),a=qt(s),c=r||o||a;if(c)return c;const l=t?`${t}.${s}`:e;throw new Error(`Unknown value type "${l}" for "${e}" value`)}function Br(n){const t=qt(n);if(t)return Mn[t];const e=we(n,"default"),s=we(n,"type"),i=n;if(e)return i.default;if(s){const{type:r}=i,o=qt(r);if(o)return Mn[o]}return n}function $r(n){const{token:t,typeDefinition:e}=n,s=`${ts(t)}-value`,i=_r(n);return{type:i,key:s,name:ke(s),get defaultValue(){return Br(e)},get hasCustomDefaultValue(){return Dt(e)!==void 0},reader:Rr[i],writer:Cn[i]||Cn.default}}const Mn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Rr={array(n){const t=JSON.parse(n);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${n}" of type "${Dt(t)}"`);return t},boolean(n){return!(n=="0"||String(n).toLowerCase()=="false")},number(n){return Number(n.replace(/_/g,""))},object(n){const t=JSON.parse(n);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${n}" of type "${Dt(t)}"`);return t},string(n){return n}},Cn={default:Pr,array:Sn,object:Sn};function Sn(n){return JSON.stringify(n)}function Pr(n){return`${n}`}class st{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:s={},prefix:i=this.identifier,bubbles:r=!0,cancelable:o=!0}={}){const a=i?`${i}:${t}`:t,c=new CustomEvent(a,{detail:s,bubbles:r,cancelable:o});return e.dispatchEvent(c),c}}st.blessings=[Tr,Cr,Lr,kr];st.targets=[];st.outlets=[];st.values={};function Ce(){return function({targets:t,values:e}={}){const i=class i extends st{};i.targets=Object.keys(t??{}),i.values=e??{};let s=i;return s}}function Nr(n){const t=document.createElement("pre");return t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.top="5px",t.textContent=n,t}function cs(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n.textContent||"");const t=getSelection();if(t==null)return Promise.reject(new Error);t.removeAllRanges();const e=document.createRange();return e.selectNodeContents(n),t.addRange(e),document.execCommand("copy"),t.removeAllRanges(),Promise.resolve()}function Ee(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n);const t=document.body;if(!t)return Promise.reject(new Error);const e=Nr(n);return t.appendChild(e),cs(e),t.removeChild(e),Promise.resolve()}async function ls(n){const t=n.getAttribute("for"),e=n.getAttribute("value");function s(){n.dispatchEvent(new CustomEvent("clipboard-copy",{bubbles:!0}))}if(n.getAttribute("aria-disabled")!=="true"){if(e)await Ee(e),s();else if(t){const i="getRootNode"in Element.prototype?n.getRootNode():n.ownerDocument;if(!(i instanceof Document||"ShadowRoot"in window&&i instanceof ShadowRoot))return;const r=i.getElementById(t);r&&(await Ir(r),s())}}}function Ir(n){return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?Ee(n.value):n instanceof HTMLAnchorElement&&n.hasAttribute("href")?Ee(n.href):cs(n)}function jr(n){const t=n.currentTarget;t instanceof HTMLElement&&ls(t)}function us(n){if(n.key===" "||n.key==="Enter"){const t=n.currentTarget;t instanceof HTMLElement&&(n.preventDefault(),ls(t))}}function Hr(n){n.currentTarget.addEventListener("keydown",us)}function Vr(n){n.currentTarget.removeEventListener("keydown",us)}class Wr extends HTMLElement{static define(t="clipboard-copy",e=customElements){return e.define(t,this),this}constructor(){super(),this.addEventListener("click",jr),this.addEventListener("focus",Hr),this.addEventListener("blur",Vr)}connectedCallback(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","button")}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}}const Ln=typeof globalThis<"u"?globalThis:window;try{Ln.ClipboardCopyElement=Wr.define()}catch(n){if(!(Ln.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}const Kr=2e3;class Ur extends Ce()({targets:{initial:HTMLElement,confirmed:null}}){connect(){this.clipboardCopyElementTimers=new WeakMap}copy(t){const e=t.target,s=this.clipboardCopyElementTimers.get(e);s?(clearTimeout(s),this.clipboardCopyElementTimers.delete(e)):this.showConfirm(),this.clipboardCopyElementTimers.set(e,window.setTimeout(()=>{this.showInitial(),this.clipboardCopyElementTimers.delete(e)},Kr))}showConfirm(){this.hasConfirmedTarget&&(this.confirmedTarget.classList.remove("hidden"),this.confirmedTarget.classList.add("inline-block"),this.initialTarget.classList.add("hidden"))}showInitial(){this.initialTarget.classList.remove("hidden"),this.initialTarget.classList.add("inline-block"),this.hasConfirmedTarget&&this.confirmedTarget.classList.add("hidden")}}const qr=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"})),Y=Math.min,L=Math.max,zt=Math.round,Ht=Math.floor,X=n=>({x:n,y:n}),zr={left:"right",right:"left",bottom:"top",top:"bottom"},Yr={start:"end",end:"start"};function Ae(n,t,e){return L(n,Y(t,e))}function pt(n,t){return typeof n=="function"?n(t):n}function G(n){return n.split("-")[0]}function gt(n){return n.split("-")[1]}function hs(n){return n==="x"?"y":"x"}function Se(n){return n==="y"?"height":"width"}function Rt(n){return["top","bottom"].includes(G(n))?"y":"x"}function Le(n){return hs(Rt(n))}function Xr(n,t,e){e===void 0&&(e=!1);const s=gt(n),i=Le(n),r=Se(i);let o=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=Yt(o)),[o,Yt(o)]}function Gr(n){const t=Yt(n);return[xe(n),t,xe(t)]}function xe(n){return n.replace(/start|end/g,t=>Yr[t])}function Zr(n,t,e){const s=["left","right"],i=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return e?t?i:s:t?s:i;case"left":case"right":return t?r:o;default:return[]}}function Jr(n,t,e,s){const i=gt(n);let r=Zr(G(n),e==="start",s);return i&&(r=r.map(o=>o+"-"+i),t&&(r=r.concat(r.map(xe)))),r}function Yt(n){return n.replace(/left|right|bottom|top/g,t=>zr[t])}function Qr(n){return{top:0,right:0,bottom:0,left:0,...n}}function ds(n){return typeof n!="number"?Qr(n):{top:n,right:n,bottom:n,left:n}}function Xt(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function Fn(n,t,e){let{reference:s,floating:i}=n;const r=Rt(t),o=Le(t),a=Se(o),c=G(t),l=r==="y",u=s.x+s.width/2-i.width/2,h=s.y+s.height/2-i.height/2,d=s[a]/2-i[a]/2;let m;switch(c){case"top":m={x:u,y:s.y-i.height};break;case"bottom":m={x:u,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:h};break;case"left":m={x:s.x-i.width,y:h};break;default:m={x:s.x,y:s.y}}switch(gt(t)){case"start":m[o]-=d*(e&&l?-1:1);break;case"end":m[o]+=d*(e&&l?-1:1);break}return m}const to=async(n,t,e)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let l=await o.getElementRects({reference:n,floating:t,strategy:i}),{x:u,y:h}=Fn(l,s,c),d=s,m={},f=0;for(let p=0;p<a.length;p++){const{name:b,fn:g}=a[p],{x:v,y:E,data:w,reset:y}=await g({x:u,y:h,initialPlacement:s,placement:d,strategy:i,middlewareData:m,rects:l,platform:o,elements:{reference:n,floating:t}});u=v??u,h=E??h,m={...m,[b]:{...m[b],...w}},y&&f<=50&&(f++,typeof y=="object"&&(y.placement&&(d=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:n,floating:t,strategy:i}):y.rects),{x:u,y:h}=Fn(l,d,c)),p=-1)}return{x:u,y:h,placement:d,strategy:i,middlewareData:m}};async function Fe(n,t){var e;t===void 0&&(t={});const{x:s,y:i,platform:r,rects:o,elements:a,strategy:c}=n,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:m=0}=pt(t,n),f=ds(m),b=a[d?h==="floating"?"reference":"floating":h],g=Xt(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(b)))==null||e?b:b.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),v=h==="floating"?{...o.floating,x:s,y:i}:o.reference,E=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),w=await(r.isElement==null?void 0:r.isElement(E))?await(r.getScale==null?void 0:r.getScale(E))||{x:1,y:1}:{x:1,y:1},y=Xt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:E,strategy:c}):v);return{top:(g.top-y.top+f.top)/w.y,bottom:(y.bottom-g.bottom+f.bottom)/w.y,left:(g.left-y.left+f.left)/w.x,right:(y.right-g.right+f.right)/w.x}}const eo=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:s,placement:i,rects:r,platform:o,elements:a,middlewareData:c}=t,{element:l,padding:u=0}=pt(n,t)||{};if(l==null)return{};const h=ds(u),d={x:e,y:s},m=Le(i),f=Se(m),p=await o.getDimensions(l),b=m==="y",g=b?"top":"left",v=b?"bottom":"right",E=b?"clientHeight":"clientWidth",w=r.reference[f]+r.reference[m]-d[m]-r.floating[f],y=d[m]-r.reference[m],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let O=A?A[E]:0;(!O||!await(o.isElement==null?void 0:o.isElement(A)))&&(O=a.floating[E]||r.floating[f]);const P=w/2-y/2,q=O/2-p[f]/2-1,bt=Y(h[g],q),vt=Y(h[v],q),_=bt,wt=O-p[f]-vt,C=O/2-p[f]/2+P,N=Ae(_,C,wt),I=!c.arrow&&gt(i)!=null&&C!==N&&r.reference[f]/2-(C<_?bt:vt)-p[f]/2<0,H=I?C<_?C-_:C-wt:0;return{[m]:d[m]+H,data:{[m]:N,centerOffset:C-N-H,...I&&{alignmentOffset:H}},reset:I}}}),no=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,s;const{placement:i,middlewareData:r,rects:o,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:p=!0,...b}=pt(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const g=G(i),v=G(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(l.floating)),w=d||(v||!p?[Yt(a)]:Gr(a));!d&&f!=="none"&&w.push(...Jr(a,p,f,E));const y=[a,...w],A=await Fe(t,b),O=[];let P=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&O.push(A[g]),h){const _=Xr(i,o,E);O.push(A[_[0]],A[_[1]])}if(P=[...P,{placement:i,overflows:O}],!O.every(_=>_<=0)){var q,bt;const _=(((q=r.flip)==null?void 0:q.index)||0)+1,wt=y[_];if(wt)return{data:{index:_,overflows:P},reset:{placement:wt}};let C=(bt=P.filter(N=>N.overflows[0]<=0).sort((N,I)=>N.overflows[1]-I.overflows[1])[0])==null?void 0:bt.placement;if(!C)switch(m){case"bestFit":{var vt;const N=(vt=P.map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,Os)=>H+Os,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:vt[0];N&&(C=N);break}case"initialPlacement":C=a;break}if(i!==C)return{reset:{placement:C}}}return{}}}};async function so(n,t){const{placement:e,platform:s,elements:i}=n,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),o=G(e),a=gt(e),c=Rt(e)==="y",l=["left","top"].includes(o)?-1:1,u=r&&c?-1:1,h=pt(t,n);let{mainAxis:d,crossAxis:m,alignmentAxis:f}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&typeof f=="number"&&(m=a==="end"?f*-1:f),c?{x:m*u,y:d*l}:{x:d*l,y:m*u}}const fs=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,s;const{x:i,y:r,placement:o,middlewareData:a}=t,c=await so(t,n);return o===((e=a.offset)==null?void 0:e.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:o}}}}},io=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:s,placement:i}=t,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:b=>{let{x:g,y:v}=b;return{x:g,y:v}}},...c}=pt(n,t),l={x:e,y:s},u=await Fe(t,c),h=Rt(G(i)),d=hs(h);let m=l[d],f=l[h];if(r){const b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",v=m+u[b],E=m-u[g];m=Ae(v,m,E)}if(o){const b=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=f+u[b],E=f-u[g];f=Ae(v,f,E)}const p=a.fn({...t,[d]:m,[h]:f});return{...p,data:{x:p.x-e,y:p.y-s}}}}},ro=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){const{placement:e,rects:s,platform:i,elements:r}=t,{apply:o=()=>{},...a}=pt(n,t),c=await Fe(t,a),l=G(e),u=gt(e),h=Rt(e)==="y",{width:d,height:m}=s.floating;let f,p;l==="top"||l==="bottom"?(f=l,p=u===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(p=l,f=u==="end"?"top":"bottom");const b=m-c[f],g=d-c[p],v=!t.middlewareData.shift;let E=b,w=g;if(h){const A=d-c.left-c.right;w=u||v?Y(g,A):A}else{const A=m-c.top-c.bottom;E=u||v?Y(b,A):A}if(v&&!u){const A=L(c.left,0),O=L(c.right,0),P=L(c.top,0),q=L(c.bottom,0);h?w=d-2*(A!==0||O!==0?A+O:L(c.left,c.right)):E=m-2*(P!==0||q!==0?P+q:L(c.top,c.bottom))}await o({...t,availableWidth:w,availableHeight:E});const y=await i.getDimensions(r.floating);return d!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}};function Z(n){return ms(n)?(n.nodeName||"").toLowerCase():"#document"}function F(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function U(n){var t;return(t=(ms(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function ms(n){return n instanceof Node||n instanceof F(n).Node}function K(n){return n instanceof Element||n instanceof F(n).Element}function j(n){return n instanceof HTMLElement||n instanceof F(n).HTMLElement}function Dn(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof F(n).ShadowRoot}function Pt(n){const{overflow:t,overflowX:e,overflowY:s,display:i}=$(n);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(i)}function oo(n){return["table","td","th"].includes(Z(n))}function De(n){const t=_e(),e=$(n);return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(e.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(e.contain||"").includes(s))}function ao(n){let t=mt(n);for(;j(t)&&!Zt(t);){if(De(t))return t;t=mt(t)}return null}function _e(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Zt(n){return["html","body","#document"].includes(Z(n))}function $(n){return F(n).getComputedStyle(n)}function Jt(n){return K(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function mt(n){if(Z(n)==="html")return n;const t=n.assignedSlot||n.parentNode||Dn(n)&&n.host||U(n);return Dn(t)?t.host:t}function ps(n){const t=mt(n);return Zt(t)?n.ownerDocument?n.ownerDocument.body:n.body:j(t)&&Pt(t)?t:ps(t)}function _t(n,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=ps(n),r=i===((s=n.ownerDocument)==null?void 0:s.body),o=F(i);return r?t.concat(o,o.visualViewport||[],Pt(i)?i:[],o.frameElement&&e?_t(o.frameElement):[]):t.concat(i,_t(i,[],e))}function gs(n){const t=$(n);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=j(n),r=i?n.offsetWidth:e,o=i?n.offsetHeight:s,a=zt(e)!==r||zt(s)!==o;return a&&(e=r,s=o),{width:e,height:s,$:a}}function Be(n){return K(n)?n:n.contextElement}function dt(n){const t=Be(n);if(!j(t))return X(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=gs(t);let o=(r?zt(e.width):e.width)/s,a=(r?zt(e.height):e.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const co=X(0);function bs(n){const t=F(n);return!_e()||!t.visualViewport?co:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lo(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==F(n)?!1:t}function nt(n,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),r=Be(n);let o=X(1);t&&(s?K(s)&&(o=dt(s)):o=dt(n));const a=lo(r,e,s)?bs(r):X(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(r){const d=F(r),m=s&&K(s)?F(s):s;let f=d,p=f.frameElement;for(;p&&s&&m!==f;){const b=dt(p),g=p.getBoundingClientRect(),v=$(p),E=g.left+(p.clientLeft+parseFloat(v.paddingLeft))*b.x,w=g.top+(p.clientTop+parseFloat(v.paddingTop))*b.y;c*=b.x,l*=b.y,u*=b.x,h*=b.y,c+=E,l+=w,f=F(p),p=f.frameElement}}return Xt({width:u,height:h,x:c,y:l})}const uo=[":popover-open",":modal"];function vs(n){return uo.some(t=>{try{return n.matches(t)}catch{return!1}})}function ho(n){let{elements:t,rect:e,offsetParent:s,strategy:i}=n;const r=i==="fixed",o=U(s),a=t?vs(t.floating):!1;if(s===o||a&&r)return e;let c={scrollLeft:0,scrollTop:0},l=X(1);const u=X(0),h=j(s);if((h||!h&&!r)&&((Z(s)!=="body"||Pt(o))&&(c=Jt(s)),j(s))){const d=nt(s);l=dt(s),u.x=d.x+s.clientLeft,u.y=d.y+s.clientTop}return{width:e.width*l.x,height:e.height*l.y,x:e.x*l.x-c.scrollLeft*l.x+u.x,y:e.y*l.y-c.scrollTop*l.y+u.y}}function fo(n){return Array.from(n.getClientRects())}function ws(n){return nt(U(n)).left+Jt(n).scrollLeft}function mo(n){const t=U(n),e=Jt(n),s=n.ownerDocument.body,i=L(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=L(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-e.scrollLeft+ws(n);const a=-e.scrollTop;return $(s).direction==="rtl"&&(o+=L(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:a}}function po(n,t){const e=F(n),s=U(n),i=e.visualViewport;let r=s.clientWidth,o=s.clientHeight,a=0,c=0;if(i){r=i.width,o=i.height;const l=_e();(!l||l&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:r,height:o,x:a,y:c}}function go(n,t){const e=nt(n,!0,t==="fixed"),s=e.top+n.clientTop,i=e.left+n.clientLeft,r=j(n)?dt(n):X(1),o=n.clientWidth*r.x,a=n.clientHeight*r.y,c=i*r.x,l=s*r.y;return{width:o,height:a,x:c,y:l}}function _n(n,t,e){let s;if(t==="viewport")s=po(n,e);else if(t==="document")s=mo(U(n));else if(K(t))s=go(t,e);else{const i=bs(n);s={...t,x:t.x-i.x,y:t.y-i.y}}return Xt(s)}function ys(n,t){const e=mt(n);return e===t||!K(e)||Zt(e)?!1:$(e).position==="fixed"||ys(e,t)}function bo(n,t){const e=t.get(n);if(e)return e;let s=_t(n,[],!1).filter(a=>K(a)&&Z(a)!=="body"),i=null;const r=$(n).position==="fixed";let o=r?mt(n):n;for(;K(o)&&!Zt(o);){const a=$(o),c=De(o);!c&&a.position==="fixed"&&(i=null),(r?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Pt(o)&&!c&&ys(n,o))?s=s.filter(u=>u!==o):i=a,o=mt(o)}return t.set(n,s),s}function vo(n){let{element:t,boundary:e,rootBoundary:s,strategy:i}=n;const o=[...e==="clippingAncestors"?bo(t,this._c):[].concat(e),s],a=o[0],c=o.reduce((l,u)=>{const h=_n(t,u,i);return l.top=L(h.top,l.top),l.right=Y(h.right,l.right),l.bottom=Y(h.bottom,l.bottom),l.left=L(h.left,l.left),l},_n(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function wo(n){const{width:t,height:e}=gs(n);return{width:t,height:e}}function yo(n,t,e){const s=j(t),i=U(t),r=e==="fixed",o=nt(n,!0,r,t);let a={scrollLeft:0,scrollTop:0};const c=X(0);if(s||!s&&!r)if((Z(t)!=="body"||Pt(i))&&(a=Jt(t)),s){const h=nt(t,!0,r,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&(c.x=ws(i));const l=o.left+a.scrollLeft-c.x,u=o.top+a.scrollTop-c.y;return{x:l,y:u,width:o.width,height:o.height}}function Bn(n,t){return!j(n)||$(n).position==="fixed"?null:t?t(n):n.offsetParent}function Es(n,t){const e=F(n);if(!j(n)||vs(n))return e;let s=Bn(n,t);for(;s&&oo(s)&&$(s).position==="static";)s=Bn(s,t);return s&&(Z(s)==="html"||Z(s)==="body"&&$(s).position==="static"&&!De(s))?e:s||ao(n)||e}const Eo=async function(n){const t=this.getOffsetParent||Es,e=this.getDimensions;return{reference:yo(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,...await e(n.floating)}}};function Ao(n){return $(n).direction==="rtl"}const xo={convertOffsetParentRelativeRectToViewportRelativeRect:ho,getDocumentElement:U,getClippingRect:vo,getOffsetParent:Es,getElementRects:Eo,getClientRects:fo,getDimensions:wo,getScale:dt,isElement:K,isRTL:Ao};function To(n,t){let e=null,s;const i=U(n);function r(){var a;clearTimeout(s),(a=e)==null||a.disconnect(),e=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),r();const{left:l,top:u,width:h,height:d}=n.getBoundingClientRect();if(a||t(),!h||!d)return;const m=Ht(u),f=Ht(i.clientWidth-(l+h)),p=Ht(i.clientHeight-(u+d)),b=Ht(l),v={rootMargin:-m+"px "+-f+"px "+-p+"px "+-b+"px",threshold:L(0,Y(1,c))||1};let E=!0;function w(y){const A=y[0].intersectionRatio;if(A!==c){if(!E)return o();A?o(!1,A):s=setTimeout(()=>{o(!1,1e-7)},100)}E=!1}try{e=new IntersectionObserver(w,{...v,root:i.ownerDocument})}catch{e=new IntersectionObserver(w,v)}e.observe(n)}return o(!0),r}function Oo(n,t,e,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,l=Be(n),u=i||r?[...l?_t(l):[],..._t(t)]:[];u.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),r&&g.addEventListener("resize",e)});const h=l&&a?To(l,e):null;let d=-1,m=null;o&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(t)})),e()}),l&&!c&&m.observe(l),m.observe(t));let f,p=c?nt(n):null;c&&b();function b(){const g=nt(n);p&&(g.x!==p.x||g.y!==p.y||g.width!==p.width||g.height!==p.height)&&e(),p=g,f=requestAnimationFrame(b)}return e(),()=>{var g;u.forEach(v=>{i&&v.removeEventListener("scroll",e),r&&v.removeEventListener("resize",e)}),h==null||h(),(g=m)==null||g.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const As=io,xs=no,ko=ro,Mo=eo,Ts=(n,t,e)=>{const s=new Map,i={platform:xo,...e},r={...i.platform,_c:s};return to(n,t,{...i,platform:r})},Co=(n,t,e)=>{let s=n;return e===!0?s=`${t.identifier}:${n}`:typeof e=="string"&&(s=`${e}:${n}`),s},So=(n,t,e)=>{const{bubbles:s,cancelable:i,composed:r}=t||{bubbles:!0,cancelable:!0,composed:!0};return t&&Object.assign(e,{originalEvent:t}),new CustomEvent(n,{bubbles:s,cancelable:i,composed:r,detail:e})};function Lo(n){const t=n.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,i=t.top<=e&&t.top+t.height>0,r=t.left<=s&&t.left+t.width>0;return i&&r}function Fo(n,t){var e={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&t.indexOf(s)<0&&(e[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(n);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(n,s[i])&&(e[s[i]]=n[s[i]]);return e}const ue={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class Do{constructor(t,e={}){var s,i,r;this.log=(c,l)=>{this.debug&&(this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${c}`,"color: #3B82F6","color: unset"),this.logger.log(Object.assign({controllerId:this.controllerId},l)),this.logger.groupEnd())},this.warn=c=>{this.logger.warn(`%c${this.controller.identifier} %c${c}`,"color: #3B82F6; font-weight: bold","color: unset")},this.dispatch=(c,l={})=>{if(this.dispatchEvent){const{event:u}=l,h=Fo(l,["event"]),d=this.extendedEvent(c,u||null,h);this.targetElement.dispatchEvent(d),this.log("dispatchEvent",Object.assign({eventName:d.type},h))}},this.call=(c,l={})=>{const u=this.controller[c];if(typeof u=="function")return u.call(this.controller,l)},this.extendedEvent=(c,l,u)=>{const{bubbles:h,cancelable:d,composed:m}=l||{bubbles:!0,cancelable:!0,composed:!0};return l&&Object.assign(u,{originalEvent:l}),new CustomEvent(this.composeEventName(c),{bubbles:h,cancelable:d,composed:m,detail:u})},this.composeEventName=c=>{let l=c;return this.eventPrefix===!0?l=`${this.controller.identifier}:${c}`:typeof this.eventPrefix=="string"&&(l=`${this.eventPrefix}:${c}`),l},this.debug=(i=(s=e==null?void 0:e.debug)!==null&&s!==void 0?s:t.application.stimulusUseDebug)!==null&&i!==void 0?i:ue.debug,this.logger=(r=e==null?void 0:e.logger)!==null&&r!==void 0?r:ue.logger,this.controller=t,this.controllerId=t.element.id||t.element.dataset.id,this.targetElement=(e==null?void 0:e.element)||t.element;const{dispatchEvent:o,eventPrefix:a}=Object.assign({},ue,e);Object.assign(this,{dispatchEvent:o,eventPrefix:a}),this.controllerInitialize=t.initialize.bind(t),this.controllerConnect=t.connect.bind(t),this.controllerDisconnect=t.disconnect.bind(t)}}const _o={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},Bo=(n,t={})=>{const e=n,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},_o,t),a=h=>{const d=(t==null?void 0:t.element)||e.element;if(!(d.contains(h.target)||!Lo(d)&&s)&&(e.clickOutside&&e.clickOutside(h),i)){const m=Co("click:outside",e,o),f=So(m,h,{controller:e});d.dispatchEvent(f)}},c=()=>{r==null||r.forEach(h=>{window.addEventListener(h,a,!0)})},l=()=>{r==null||r.forEach(h=>{window.removeEventListener(h,a,!0)})},u=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),u()}}),c(),[c,l]};class $o extends st{}$o.debounces=[];class Ro extends Do{constructor(t,e={}){super(t,e),this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(s){this.controller.application.handleError(s,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}},this.unobserve=()=>{this.observer.disconnect()},this.mutation=s=>{this.call("mutate",s),this.log("mutate",{entries:s}),this.dispatch("mutate",{entries:s})},this.targetElement=(e==null?void 0:e.element)||t.element,this.controller=t,this.options=e,this.observer=new MutationObserver(this.mutation),this.enhanceController(),this.observe()}enhanceController(){const t=this.controller.disconnect.bind(this.controller),e=()=>{this.unobserve(),t()};Object.assign(this.controller,{disconnect:e})}}const Po=(n,t={})=>{const e=new Ro(n,t);return[e.observe,e.unobserve]};class No extends st{}No.throttles=[];class Io extends Ce()({targets:{anchor:null,options:null,popover:null,searchInput:HTMLInputElement},values:{clamped:Boolean,placement:String}}){constructor(){super(...arguments),this.changedIds=new Set,this.clickHandlers=[]}setupClickHandlers(){const t=()=>this.toggle();for(const e of this.clickHandlers)e();this.clickHandlers=[];for(const e of this.anchorTarget.querySelectorAll('button, [tabindex]:not([tabindex="-1"])'))e.addEventListener("click",t),this.clickHandlers.push(()=>e.removeEventListener("click",t))}checkboxClicked(t){const s=t.target.value;this.changedIds.has(s)?this.changedIds.delete(s):this.changedIds.add(s),this.dispatch("clicked",{detail:s})}clickOutside(){this.element.open=!1,this.setupAutoUpdate(),this.close()}close(){this.hasSearchInputTarget&&(this.searchInputTarget.value=""),this.changedIds.size>0&&(this.dispatch("changed"),this.changedIds.clear())}connect(){Bo(this),Po(this,{childList:!0,subtree:!0}),this.setupAutoUpdate(),this.setupClickHandlers()}disconnect(){var t;(t=this.unsubAutoUpdate)==null||t.call(this)}setupAutoUpdate(){var e;if(!this.element.open){(e=this.unsubAutoUpdate)==null||e.call(this);return}const t=()=>{const s=this.optionsTarget,i=this.hasSearchInputTarget?this.searchInputTarget:null,r=this.clampedValue;Ts(this.anchorTarget,this.popoverTarget,{middleware:[fs(6),xs(),As({padding:6}),ko({apply({availableHeight:o}){const a=i?i.getBoundingClientRect().height:0;let c=o-a-6;r&&c>400&&(c=400),Object.assign(s.style,{maxHeight:`${c}px`})}})],placement:this.placementValue,strategy:"fixed"}).then(({x:o,y:a})=>{Object.assign(this.popoverTarget.style,{left:`${o}px`,top:`${a}px`})})};t(),this.unsubAutoUpdate=Oo(this.anchorTarget,this.popoverTarget,t)}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const jo=Object.freeze(Object.defineProperty({__proto__:null,default:Io},Symbol.toStringTag,{value:"Module"}));class Ho extends Ce()({targets:{activator:HTMLElement,wrapper:HTMLDivElement,tooltip:HTMLDivElement,arrow:HTMLDivElement}}){async update(){Ts(this.activatorTarget,this.tooltipTarget,{placement:"top",middleware:[fs(10),xs(),As({padding:5}),Mo({element:this.arrowTarget})]}).then(({x:t,y:e,placement:s,middlewareData:i})=>{Object.assign(this.tooltipTarget.style,{left:`${t}px`,top:`${e}px`}),Object.assign(this.arrowTarget.style,{left:"",top:"",right:"",bottom:""});const{x:r,y:o}=i.arrow||{};switch(s.split("-")[0]){case"top":Object.assign(this.arrowTarget.style,{left:r?`${r}px`:"",bottom:"-4px"});break;case"bottom":Object.assign(this.arrowTarget.style,{left:r?`${r}px`:"",top:"-4px"});break;case"left":Object.assign(this.arrowTarget.style,{top:o?`${o}px`:"",right:"-4px"});break;case"right":Object.assign(this.arrowTarget.style,{top:o?`${o}px`:"",left:"-4px"});break}})}showTooltip(t){this.wrapperTarget.classList.add("block"),this.wrapperTarget.classList.remove("hidden"),this.update()}hideTooltip(t){this.wrapperTarget.classList.add("hidden"),this.wrapperTarget.classList.remove("block")}}const Vo=Object.freeze(Object.defineProperty({__proto__:null,default:Ho},Symbol.toStringTag,{value:"Module"})),Qt=Ar.start();Qt.debug=!1;window.Stimulus=Qt;const Wo=Object.assign({"../../components/ariadne/ui/clipboard_copy/component.ts":qr,"../../components/ariadne/ui/combobox/component.ts":jo});for(const[n,t]of Object.entries(Wo)){const e=n.split("/"),s=e.slice(3,e.length-1).join("-").replaceAll("_","-").toLocaleLowerCase();Qt.register(s,t.default)}const Ko=Object.assign({"/controllers/tooltip.ts":Vo});for(const[n,t]of Object.entries(Ko)){const e=n.split("/"),s=e.slice(2,e.length).join("-").replace(".ts","").replaceAll("_","-").toLocaleLowerCase();Qt.register(`ariadne-${s}`,t.default)}
8
99
  //# sourceMappingURL=ariadne_view_components.js.map