ariadne_view_components 0.0.70 → 0.0.71

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/README.md +20 -1
  4. data/app/assets/javascripts/ariadne_view_components.js +14 -14
  5. data/app/assets/javascripts/ariadne_view_components.js.br +0 -0
  6. data/app/assets/javascripts/ariadne_view_components.js.gz +0 -0
  7. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  8. data/app/assets/stylesheets/ariadne_view_components.css +1 -1
  9. data/app/assets/stylesheets/ariadne_view_components.css.br +0 -0
  10. data/app/assets/stylesheets/ariadne_view_components.css.gz +0 -0
  11. data/app/components/ariadne/base_component.rb +9 -1
  12. data/app/components/ariadne/behaviors/captionable.rb +55 -0
  13. data/app/components/ariadne/behaviors/tooltipable.rb +15 -15
  14. data/app/components/ariadne/form/base_component.rb +1 -1
  15. data/app/components/ariadne/form/checkbox/component.html.erb +6 -0
  16. data/app/components/ariadne/form/checkbox/component.rb +34 -0
  17. data/app/components/ariadne/form/group/component.html.erb +2 -2
  18. data/app/components/ariadne/form/group/component.rb +29 -2
  19. data/app/components/ariadne/form/hidden_field/component.html.erb +6 -1
  20. data/app/components/ariadne/form/hidden_field/component.rb +10 -3
  21. data/app/components/ariadne/form/radio/component.html.erb +6 -0
  22. data/app/components/ariadne/form/radio/component.rb +26 -0
  23. data/app/components/ariadne/form/radio_button/component.html.erb +6 -0
  24. data/app/components/ariadne/form/radio_button/component.rb +60 -0
  25. data/app/components/ariadne/form/radio_button_group/component.html.erb +24 -0
  26. data/app/components/ariadne/form/radio_button_group/component.rb +59 -0
  27. data/app/components/ariadne/form/text_field/component.html.erb +1 -0
  28. data/app/components/ariadne/layout/grid/component.html.erb +7 -0
  29. data/app/components/ariadne/layout/grid/component.rb +36 -0
  30. data/app/components/ariadne/layout/nav_bar/component.html.erb +12 -101
  31. data/app/components/ariadne/layout/nav_bar/component.rb +38 -9
  32. data/app/components/ariadne/layout/two_panel/component.html.erb +14 -0
  33. data/app/components/ariadne/layout/two_panel/component.rb +38 -0
  34. data/app/components/ariadne/layout/wide/component.html.erb +9 -0
  35. data/app/components/ariadne/layout/wide/component.rb +24 -0
  36. data/app/components/ariadne/turbo/frame/component.html.erb +3 -0
  37. data/app/components/ariadne/turbo/frame/component.rb +16 -0
  38. data/app/components/ariadne/turbo/stream_action/component.html.erb +4 -0
  39. data/app/components/ariadne/turbo/stream_action/component.rb +25 -0
  40. data/app/components/ariadne/ui/badge/component.html.erb +1 -0
  41. data/app/components/ariadne/ui/badge/component.rb +76 -0
  42. data/app/components/ariadne/ui/blankslate/component.html.erb +9 -0
  43. data/app/components/ariadne/ui/blankslate/component.rb +37 -0
  44. data/app/components/ariadne/ui/button/component.rb +2 -1
  45. data/app/components/ariadne/ui/color_dot/component.html.erb +7 -0
  46. data/app/components/ariadne/ui/color_dot/component.rb +39 -0
  47. data/app/components/ariadne/ui/combobox/component.html.erb +9 -15
  48. data/app/components/ariadne/ui/combobox/component.rb +38 -26
  49. data/app/components/ariadne/ui/combobox/{menu_item → item}/component.html.erb +1 -1
  50. data/app/components/ariadne/ui/combobox/item/component.rb +61 -0
  51. data/app/components/ariadne/ui/combobox/option/component.html.erb +1 -1
  52. data/app/components/ariadne/ui/combobox/option/component.rb +11 -12
  53. data/app/components/ariadne/ui/data_table/component.html.erb +1 -0
  54. data/app/components/ariadne/ui/data_table/component.rb +11 -0
  55. data/app/components/ariadne/ui/dialog/component.html.erb +32 -0
  56. data/app/components/ariadne/ui/dialog/component.rb +37 -0
  57. data/app/components/ariadne/ui/dialog/component.ts +27 -0
  58. data/app/components/ariadne/ui/heroicon/component.rb +6 -1
  59. data/app/components/ariadne/ui/list/component.html.erb +6 -0
  60. data/app/components/ariadne/ui/list/component.rb +12 -0
  61. data/app/components/ariadne/ui/list/item/component.html.erb +16 -0
  62. data/app/components/ariadne/ui/list/item/component.rb +17 -0
  63. data/app/components/ariadne/ui/table/cell/component.html.erb +3 -0
  64. data/app/components/ariadne/ui/table/cell/component.rb +38 -0
  65. data/app/components/ariadne/ui/table/component.html.erb +13 -0
  66. data/app/components/ariadne/ui/table/component.rb +45 -0
  67. data/app/components/ariadne/ui/table/footer/component.html.erb +0 -0
  68. data/app/components/ariadne/ui/table/footer/component.rb +14 -0
  69. data/app/components/ariadne/ui/table/header/component.html.erb +3 -0
  70. data/app/components/ariadne/ui/table/header/component.rb +40 -0
  71. data/app/components/ariadne/ui/table/row/component.html.erb +5 -0
  72. data/app/components/ariadne/ui/table/row/component.rb +28 -0
  73. data/app/components/ariadne/ui/typography/component.html.erb +1 -3
  74. data/app/components/ariadne/ui/typography/component.rb +62 -2
  75. data/app/frontend/ariadne/index.ts +0 -1
  76. data/app/frontend/controllers/autosubmittable_controller.ts +25 -0
  77. data/lib/ariadne/forms/base.html.erb +4 -5
  78. data/lib/ariadne/forms/dsl/badge.rb +35 -0
  79. data/lib/ariadne/forms/dsl/button_input.rb +4 -3
  80. data/lib/ariadne/forms/dsl/form_object.rb +8 -0
  81. data/lib/ariadne/forms/dsl/form_reference_input.rb +59 -0
  82. data/lib/ariadne/forms/dsl/hidden_input.rb +32 -0
  83. data/lib/ariadne/forms/dsl/input.rb +4 -2
  84. data/lib/ariadne/forms/dsl/input_group.rb +3 -3
  85. data/lib/ariadne/forms/dsl/radio_button_group_input.rb +50 -0
  86. data/lib/ariadne/forms/dsl/radio_button_input.rb +48 -0
  87. data/lib/ariadne/forms/dsl/text_field_input.rb +4 -1
  88. data/lib/ariadne/view_components/version.rb +1 -1
  89. metadata +54 -10
  90. data/app/components/ariadne/form/caption/component.html.erb +0 -10
  91. data/app/components/ariadne/form/caption/component.rb +0 -32
  92. data/app/components/ariadne/form/spacing_wrapper/component.html.erb +0 -3
  93. data/app/components/ariadne/form/spacing_wrapper/component.rb +0 -10
  94. data/app/components/ariadne/ui/combobox/menu_item/component.rb +0 -53
  95. data/app/frontend/controllers/tooltip.ts +0 -75
  96. data/app/frontend/stylesheets/typography.css +0 -117
@@ -1,4 +1,4 @@
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=`
1
+ function Rs(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 d=Date.now()-o;o=Date.now(),e&&s&&d>=t&&(r=!0),r?(r=!1,n.apply(this,u),i&&l.cancel()):(s&&d<t||!s)&&(clearTimeout(a),a=setTimeout(()=>{o=Date.now(),n.apply(this,u),i&&l.cancel()},s?t-d:t))}return l.cancel=()=>{clearTimeout(a),c=!0},l}function $s(n,t=0,{start:e=!1,middle:s=!1,once:i=!1}={}){return Rs(n,t,{start:e,middle:s,once:i})}var re=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)},Ps=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},nt;const kt=new WeakMap;class ee extends Event{constructor(t){super(`auto-check-${t}`,{bubbles:!0}),this.phase=t}get detail(){return this}}class Un extends ee{constructor(t,e=""){super(t),this.phase=t,this.message=e,this.setValidity=s=>{this.message=s}}}class Ve extends ee{constructor(){super("complete")}}class Is extends ee{constructor(t){super("success"),this.response=t}}class Ns extends Un{constructor(){super("start","Verifying…")}}class js extends Un{constructor(t){super("error","Validation failed"),this.response=t}}class Hs extends ee{constructor(t){super("send"),this.body=t}}class qn extends HTMLElement{constructor(){super(...arguments),nt.set(this,null)}static define(t="auto-check",e=customElements){return e.define(t,this),this}get onloadend(){return re(this,nt,"f")}set onloadend(t){re(this,nt,"f")&&this.removeEventListener("loadend",re(this,nt,"f")),Ps(this,nt,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=$s(Ks.bind(null,this),300),s={check:e,controller:null};kt.set(this,s),t.addEventListener("input",We),t.addEventListener("input",e),t.autocomplete="off",t.spellcheck=!1}disconnectedCallback(){const t=this.input;if(!t)return;const e=kt.get(this);e&&(kt.delete(this),t.removeEventListener("input",We),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)}}nt=new WeakMap;function We(n){const t=n.currentTarget;if(!(t instanceof HTMLInputElement))return;const e=t.closest("auto-check");if(!(e instanceof qn))return;const s=e.src,i=e.csrf,r=kt.get(e);if(!s||!i||!r)return;const o=new Ns;t.dispatchEvent(o),e.required&&t.setCustomValidity(o.message)}function Vs(){return"AbortController"in window?new AbortController:{signal:null,abort(){}}}async function Ws(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 Ks(n){const t=n.input;if(!t)return;const e=n.csrfField,s=n.src,i=n.csrf,r=kt.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 Hs(o)),r.controller?r.controller.abort():n.dispatchEvent(new Event("loadstart")),r.controller=Vs();try{const a=await Ws(n,s,{credentials:"same-origin",signal:r.controller.signal,method:"POST",body:o});if(a.ok)n.required&&t.setCustomValidity(""),t.dispatchEvent(new Is(a.clone()));else{const c=new js(a.clone());t.dispatchEvent(c),n.required&&t.setCustomValidity(c.message)}r.controller=null,t.dispatchEvent(new Ve)}catch(a){a.name!=="AbortError"&&(r.controller=null,t.dispatchEvent(new Ve))}}const Ke=typeof globalThis<"u"?globalThis:window;try{Ke.AutoCheckElement=qn.define()}catch(n){if(!(Ke.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class Us{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=>qs(r,this),this.compositionEventHandler=r=>Ys(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",Ue),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",Ue)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(oe)[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(oe)[0],s=Array.from(this.list.querySelectorAll('[role="option"]')).filter(oe),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"),Xs(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 qs(n,t){if(!(n.shiftKey||n.metaKey||n.altKey)&&!(!t.ctrlBindings&&n.ctrlKey)&&!t.isComposing)switch(n.key){case"Enter":qe(t.input,t.list)&&n.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&qe(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 Ue(n){if(!(n.target instanceof Element))return;const t=n.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&zs(t,{event:n})}function qe(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 zs(n,t){n.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:t}))}function oe(n){return!n.hidden&&!(n instanceof HTMLInputElement&&n.type==="hidden")&&(n.offsetWidth>0||n.offsetHeight>0)}function Ys(n,t){t.isComposing=n.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Xs(n,t){Gs(n,t)||(n.scrollTop=t.offsetTop)}function Gs(n,t){const e=n.scrollTop,s=e+n.clientHeight,i=t.offsetTop,r=i+t.clientHeight;return i>=e&&r<=s}function Zs(n,t=0){let e;return function(...s){clearTimeout(e),e=window.setTimeout(()=>{clearTimeout(e),n(...s)},t)}}const Js=window.testScreenReaderDelay||100;class Qs{constructor(t,e,s,i=!1){var r;if(this.container=t,this.input=e,this.results=s,this.combobox=new Us(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=Zs(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)},Js)}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 $=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)},ae=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},ti=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},st,wt,yt,Et,Wt;const ei=globalThis.HTMLElement||null;class ni extends Event{constructor(t,e){var{relatedTarget:s}=e,i=ti(e,["relatedTarget"]);super(t,i),this.relatedTarget=s}}const H=new WeakMap;let ce=null;class si extends ei{constructor(){super(...arguments),st.add(this),wt.set(this,null),yt.set(this,null),Wt.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){ce=t===null?t:Promise.resolve(t)}get forElement(){var t;if(!((t=$(this,wt,"f"))===null||t===void 0)&&t.isConnected)return $(this,wt,"f");const e=this.getAttribute("for"),s=this.getRootNode();return e&&(s instanceof Document||s instanceof ShadowRoot)?s.getElementById(e):null}set forElement(t){ae(this,wt,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return!((t=$(this,yt,"f"))===null||t===void 0)&&t.isConnected?$(this,yt,"f"):this.querySelector("input")}set inputElement(t){ae(this,yt,t,"f"),$(this,st,"m",Et).call(this)}connectedCallback(){this.isConnected&&($(this,st,"m",Et).call(this),new MutationObserver(()=>{H.get(this)||$(this,st,"m",Et).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){const t=H.get(this);t&&(t.destroy(),H.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=$(this,Wt,"f"))===null||e===void 0||e.abort();const{signal:s}=ae(this,Wt,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 ce?(await ce).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=H.get(this);if(o)switch((this.forElement!==((i=H.get(this))===null||i===void 0?void 0:i.results)||this.inputElement!==((r=H.get(this))===null||r===void 0?void 0:r.input))&&$(this,st,"m",Et).call(this),t){case"open":s===null?o.close():o.open();break;case"value":s!==null&&(o.input.value=s),this.dispatchEvent(new ni("auto-complete-change",{bubbles:!0,relatedTarget:o.input}));break}}}wt=new WeakMap,yt=new WeakMap,Wt=new WeakMap,st=new WeakSet,Et=function(){var t;(t=H.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";H.set(this,new Qs(this,s,e,i)),e.setAttribute("role","listbox")};const le=typeof globalThis<"u"?globalThis:window;try{le.AutocompleteElement=le.AutoCompleteElement=si.define()}catch(n){if(!(le.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}class ze 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=[_(t,"compositionstart",i=>Je(this,i)),_(t,"compositionend",i=>Je(this,i)),_(t,"click",i=>Ge(t,i)),_(t,"change",i=>Ge(t,i)),_(t,"keydown",i=>li(t,this,i)),_(t,"toggle",()=>Ye(t,this),{once:!0}),_(t,"toggle",()=>oi(t)),this.preload?_(t,"mouseover",()=>Ye(t,this),{once:!0}):ii,...ri(t)];at.set(this,{subscriptions:s,loaded:!1,isComposing:!1})}disconnectedCallback(){const t=at.get(this);if(t){at.delete(this);for(const e of t.subscriptions)e.unsubscribe()}}}const at=new WeakMap,ii={unsubscribe(){}};function _(n,t,e,s=!1){return n.addEventListener(t,e,s),{unsubscribe:()=>{n.removeEventListener(t,e,s)}}}function Ye(n,t){const e=t.getAttribute("src");if(!e)return;const s=at.get(t);if(!s||s.loaded)return;s.loaded=!0;const i=t.querySelector("include-fragment");i&&!i.hasAttribute("src")&&(i.addEventListener("loadend",()=>zn(n)),i.setAttribute("src",e))}function ri(n){let t=!1;const e=()=>t=!0,s=()=>t=!1,i=()=>{n.hasAttribute("open")&&(zn(n)||t||ai(n))};return[_(n,"mousedown",e),_(n,"keydown",s),_(n,"toggle",i)]}function oi(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 zn(n){if(!n.hasAttribute("open"))return!1;const t=n.querySelector("details-menu [autofocus]");return t?(t.focus(),!0):!1}function ai(n){const t=document.activeElement;if(t&&Yn(t)&&n.contains(t))return;const e=At(n,!0);e&&e.focus()}function At(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 Xe=navigator.userAgent.match(/Macintosh/);function Ge(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||Ze(s,n)}else if(t.type==="change"){const s=e.closest('[role="menuitemradio"], [role="menuitemcheckbox"]');s&&Ze(s,n)}}}function ci(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 Ze(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}}))||(ui(n,t),ci(n,t),n.getAttribute("role")!=="menuitemcheckbox"&&Xn(t),e.dispatchEvent(new CustomEvent("details-menu-selected",{detail:{relatedTarget:n}})))}function li(n,t,e){if(!(e instanceof KeyboardEvent)||n.querySelector("details[open]"))return;const s=at.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")&&(Xn(n),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=At(n,!0);r&&r.focus(),e.preventDefault()}break;case"ArrowUp":{i&&!n.hasAttribute("open")&&n.setAttribute("open","");const r=At(n,!1);r&&r.focus(),e.preventDefault()}break;case"n":if(Xe&&e.ctrlKey){const r=At(n,!0);r&&r.focus(),e.preventDefault()}break;case"p":if(Xe&&e.ctrlKey){const r=At(n,!1);r&&r.focus(),e.preventDefault()}break;case" ":case"Enter":{const r=document.activeElement;r instanceof HTMLElement&&Yn(r)&&r.closest("details")===n&&(e.preventDefault(),e.stopPropagation(),r.click())}break}}function Yn(n){const t=n.getAttribute("role");return t==="menuitem"||t==="menuitemcheckbox"||t==="menuitemradio"}function Xn(n){if(!n.hasAttribute("open"))return;n.removeAttribute("open");const e=n.querySelector("summary");e&&e.focus()}function ui(n,t){const e=t.querySelector("[data-menu-button]");if(!e)return;const s=di(n);if(s)e.textContent=s;else{const i=hi(n);i&&(e.innerHTML=i)}}function di(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 hi(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 Je(n,t){const e=at.get(n);e&&(e.isComposing=t.type==="compositionstart")}window.customElements.get("details-menu")||(window.DetailsMenuElement=ze,window.customElements.define("details-menu",ze));const ct=new WeakMap,Y=new WeakMap,P=new WeakMap;function Lt(n){const t=n.currentTarget;if(!(t instanceof dt))return;const{box:e,image:s}=P.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(Y.has(t)&&n instanceof MouseEvent){const o=Y.get(t);i=n.pageX-o.dragStartX,r=n.pageY-o.dragStartY}else if(Y.has(t)&&n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0],{dragStartX:c,dragStartY:l}=Y.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`,Qn(t,{x:o,y:a,width:e.offsetWidth,height:e.offsetHeight})}if(n instanceof MouseEvent)Y.set(t,{dragStartX:n.pageX,dragStartY:n.pageY});else if(n instanceof TouchEvent){const{pageX:o,pageY:a}=n.changedTouches[0];Y.set(t,{dragStartX:o,dragStartY:a})}}function lt(n){const t=n.target;if(!(t instanceof HTMLElement))return;const e=Gn(t);if(!(e instanceof dt))return;const{box:s}=P.get(e)||{};if(!s)return;const i=e.getBoundingClientRect();let r,o,a;if(n instanceof KeyboardEvent){if(n.key==="Escape")return Jn(e);if(n.key==="-"&&(a=-10),n.key==="="&&(a=10),!a)return;r=s.offsetWidth+a,o=s.offsetHeight+a,ct.set(e,{startX:s.offsetLeft,startY:s.offsetTop})}else if(n instanceof MouseEvent){const c=ct.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=ct.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&&Zn(e,r,o,!(n instanceof KeyboardEvent))}function Gn(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=Gn(t);if(!(e instanceof dt))return;const{box:s}=P.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",lt),e.addEventListener("touchmove",lt,{passive:!0}),["nw","se"].indexOf(r)>=0&&e.classList.add("nwse"),["ne","sw"].indexOf(r)>=0&&e.classList.add("nesw"),ct.set(e,{startX:s.offsetLeft+(["se","ne"].indexOf(r)>=0?0:s.offsetWidth),startY:s.offsetTop+(["se","sw"].indexOf(r)>=0?0:s.offsetHeight)}),lt(n)}else e.addEventListener("mousemove",Lt),e.addEventListener("touchmove",Lt,{passive:!0})}function Zn(n,t,e,s=!0){let i=Math.max(Math.abs(t),Math.abs(e),10);const r=ct.get(n);if(!r)return;const{box:o,image:a}=P.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`,Qn(n,{x:c,y:l,width:i,height:i})}function Jn(n){const{image:t}=P.get(n)||{};if(!t)return;const e=Math.round(t.clientWidth>t.clientHeight?t.clientHeight:t.clientWidth);ct.set(n,{startX:(t.clientWidth-e)/2,startY:(t.clientHeight-e)/2}),Zn(n,e,e)}function ue(n){const t=n.currentTarget;t instanceof dt&&(Y.delete(t),t.classList.remove("nwse","nesw"),t.removeEventListener("mousemove",lt),t.removeEventListener("mousemove",Lt),t.removeEventListener("touchmove",lt),t.removeEventListener("touchmove",Lt))}function Qn(n,t){const{image:e}=P.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 dt extends HTMLElement{connectedCallback(){if(P.has(this))return;const t=this.attachShadow({mode:"open"});t.innerHTML=`
2
2
  <style>
3
3
  :host { touch-action: none; display: block; }
4
4
  :host(.nesw) { cursor: nesw-resize; }
@@ -76,24 +76,24 @@ function ks(n,t=0,{start:e=!0,middle:s=!0,once:i=!1}={}){let r=e,o=0,a,c=!1;func
76
76
  </div>
77
77
  </div>
78
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(`
79
+ `;const e=t.querySelector("[data-crop-box]");if(!(e instanceof HTMLElement))return;const s=t.querySelector("img");s instanceof HTMLImageElement&&(P.set(this,{box:e,image:s}),s.addEventListener("load",()=>{this.loaded=!0,Jn(this)}),this.addEventListener("mouseleave",ue),this.addEventListener("touchend",ue),this.addEventListener("mouseup",ue),e.addEventListener("mousedown",Qe),e.addEventListener("touchstart",Qe,{passive:!0}),this.addEventListener("keydown",Lt),this.addEventListener("keydown",lt),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}=P.get(this)||{};t==="src"&&(this.loaded=!1,i&&(i.src=s))}}window.customElements.get("image-crop")||(window.ImageCropElement=dt,window.customElements.define("image-crop",dt));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)},de=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},O,it,Mt,rt,he,ge,Nt,tn;const be=new WeakMap;function fi(n){return n&&!!n.split(",").find(t=>t.match(/^\s*\*\/\*/))}let ve=null;class Ce extends HTMLElement{constructor(){super(...arguments),O.add(this),it.set(this,!1),Mt.set(this,new IntersectionObserver(t=>{for(const e of t)if(e.isIntersecting){const{target:s}=e;if(T(this,Mt,"f").unobserve(s),!(s instanceof Ce))return;s.loading==="lazy"&&T(this,O,"m",rt).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){ve=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,O,"m",ge).call(this)}attributeChangedCallback(t,e){t==="src"?this.isConnected&&this.loading==="eager"&&T(this,O,"m",rt).call(this):t==="loading"&&this.isConnected&&e!=="eager"&&this.loading==="eager"&&T(this,O,"m",rt).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,O,"m",rt).call(this),this.loading==="lazy"&&T(this,Mt,"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,O,"m",ge).call(this)}fetch(t){return fetch(t)}refetch(){be.delete(this),T(this,O,"m",rt).call(this)}}it=new WeakMap,Mt=new WeakMap,O=new WeakSet,rt=async function(){if(!T(this,it,"f")){de(this,it,!0,"f"),T(this,Mt,"f").unobserve(this);try{const t=await T(this,O,"m",he).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}}))){de(this,it,!1,"f");return}this.replaceWith(i),this.dispatchEvent(new CustomEvent("include-fragment-replaced"))}catch{this.classList.add("is-error")}finally{de(this,it,!1,"f")}}},he=async function(){const t=this.src,e=be.get(this);if(e&&e.src===t)return e.data;{let s;return t?s=T(this,O,"m",tn).call(this):s=Promise.reject(new Error("missing src")),be.set(this,{src:t,data:s}),s}},ge=async function(){const t=await T(this,O,"m",he).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))},tn=async function(){try{await T(this,O,"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(!fi(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 ve&&(i=(await ve).createHTML(s,t)),T(this,O,"m",Nt).call(this,["load","loadend"]),i}catch(t){throw T(this,O,"m",Nt).call(this,["error","loadend"]),t}};const en=typeof globalThis<"u"?globalThis:window;try{en.IncludeFragmentElement=Ce.define()}catch(n){if(!(en.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}var nn=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,we;const mi=["[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 ts(n){const t=[];for(const e of n.querySelectorAll(mi.join(", ")))e.hidden||e.offsetWidth<=0&&e.offsetHeight<=0||e.closest("markdown-toolbar")===n&&t.push(e);return t}function es(n){return function(t){(t.key===" "||t.key==="Enter")&&n(t)}}const k=new WeakMap,pi={"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 L extends HTMLElement{constructor(){super();const t=e=>{const s=k.get(this);s&&(e.preventDefault(),Ee(this,s))};this.addEventListener("keydown",es(t)),this.addEventListener("click",t)}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","button")}click(){const t=k.get(this);t&&Ee(this,t)}}class sn extends L{constructor(){super(...arguments),Kt.add(this)}connectedCallback(){const t=parseInt(this.getAttribute("level")||"3",10);nn(this,Kt,"m",we).call(this,t)}static get observedAttributes(){return["level"]}attributeChangedCallback(t,e,s){if(t!=="level")return;const i=parseInt(s||"3",10);nn(this,Kt,"m",we).call(this,i)}}Kt=new WeakSet,we=function(t){if(t<1||t>6)return;const e=`${"#".repeat(t)} `;k.set(this,{prefix:e})};window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=sn,window.customElements.define("md-header",sn));class rn extends L{connectedCallback(){k.set(this,{prefix:"**",suffix:"**",trimFirst:!0})}}window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=rn,window.customElements.define("md-bold",rn));class on extends L{connectedCallback(){k.set(this,{prefix:"_",suffix:"_",trimFirst:!0})}}window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=on,window.customElements.define("md-italic",on));class an extends L{connectedCallback(){k.set(this,{prefix:"> ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=an,window.customElements.define("md-quote",an));class cn extends L{connectedCallback(){k.set(this,{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"})}}window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=cn,window.customElements.define("md-code",cn));class ln extends L{connectedCallback(){k.set(this,{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=ln,window.customElements.define("md-link",ln));class un extends L{connectedCallback(){k.set(this,{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"})}}window.customElements.get("md-image")||(window.MarkdownImageButtonElement=un,window.customElements.define("md-image",un));class dn extends L{connectedCallback(){k.set(this,{prefix:"- ",multiline:!0,unorderedList:!0})}}window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=dn,window.customElements.define("md-unordered-list",dn));class hn extends L{connectedCallback(){k.set(this,{prefix:"1. ",multiline:!0,orderedList:!0})}}window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=hn,window.customElements.define("md-ordered-list",hn));class fn extends L{connectedCallback(){k.set(this,{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0})}}window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=fn,window.customElements.define("md-task-list",fn));class mn extends L{connectedCallback(){k.set(this,{prefix:"@",prefixSpace:!0})}}window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=mn,window.customElements.define("md-mention",mn));class pn extends L{connectedCallback(){k.set(this,{prefix:"#",prefixSpace:!0})}}window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=pn,window.customElements.define("md-ref",pn));class gn extends L{connectedCallback(){k.set(this,{prefix:"~~",suffix:"~~",trimFirst:!0})}}window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=gn,window.customElements.define("md-strikethrough",gn));function bn(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=pi[i];r&&(n.preventDefault(),Ee(t,r))}function vn(n){n.addEventListener("keydown",ss),n.setAttribute("tabindex","0"),n.addEventListener("focus",ns,{once:!0})}function wn(n){n.removeEventListener("keydown",ss),n.removeAttribute("tabindex"),n.removeEventListener("focus",ns)}class Ut extends HTMLElement{connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.hasAttribute("data-no-focus")||vn(this),this.addEventListener("keydown",es(bn)),this.addEventListener("click",bn)}attributeChangedCallback(t,e,s){t==="data-no-focus"&&(s===null?vn(this):wn(this))}disconnectedCallback(){wn(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}}Ut.observedAttributes=["data-no-focus"];function ns({target:n}){if(!(n instanceof Element))return;n.removeAttribute("tabindex");let t="0";for(const e of ts(n))e.setAttribute("tabindex",t),t==="0"&&(e.focus(),t="-1")}function ss(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=ts(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=Ut,window.customElements.define("markdown-toolbar",Ut));function ye(n){return n.trim().split(`
80
+ `).length>1}function yn(n,t){return Array(t+1).join(n)}function gi(n,t){let e=t;for(;n[e]&&n[e-1]!=null&&!n[e-1].match(/\s/);)e--;return e}function bi(n,t,e){let s=t;const i=e?/\n/:/\s/;for(;n[s]&&!n[s].match(i);)s++;return s}let z=null;function vi(n,{text:t,selectionStart:e,selectionEnd:s}){const i=n.selectionStart,r=n.value.slice(0,i),o=n.value.slice(n.selectionEnd);if(z===null||z===!0){n.contentEditable="true";try{z=document.execCommand("insertText",!1,t)}catch{z=!1}n.contentEditable="false"}if(z&&!n.value.slice(0,n.selectionStart).endsWith(t)&&(z=!1),!z){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 wi(n,t){const e=n.value.slice(n.selectionStart,n.selectionEnd);let s;t.orderedList||t.unorderedList?s=Oi(n,t):t.multiline&&ye(e)?s=xi(n,t):s=Ai(n,t),vi(n,s)}function yi(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 Ei(n,t,e,s=!1){if(n.selectionStart===n.selectionEnd)n.selectionStart=gi(n.value,n.selectionStart),n.selectionEnd=bi(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 Le(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=yn(`
82
+ `,2-r)),e.match(/\S/)&&o<2&&(c=yn(`
83
+ `,2-o)),a==null&&(a=""),c==null&&(c=""),{newlinesToAppend:a,newlinesToPrepend:c}}function Ai(n,t){let e,s;const{prefix:i,suffix:r,blockPrefix:o,blockSuffix:a,replaceNext:c,prefixSpace:l,scanFor:u,surroundWithNewlines:d}=t,h=n.selectionStart,g=n.selectionEnd;let f=n.value.slice(n.selectionStart,n.selectionEnd),m=ye(f)&&o.length>0?`${o}
84
+ `:i,b=ye(f)&&a.length>0?`
85
+ ${a}`:r;if(l){const w=n.value[n.selectionStart-1];n.selectionStart!==0&&w!=null&&!w.match(/\s/)&&(m=` ${m}`)}f=Ei(n,m,b,t.multiline);let p=n.selectionStart,v=n.selectionEnd;const E=c.length>0&&b.indexOf(c)>-1&&f.length>0;if(d){const w=Le(n);e=w.newlinesToAppend,s=w.newlinesToPrepend,m=e+i,b+=s}if(f.startsWith(m)&&f.endsWith(b)){const w=f.slice(m.length,f.length-b.length);if(h===g){let y=h-m.length;y=Math.max(y,p),y=Math.min(y,p+w.length),p=v=y}else v=p+w.length;return{text:w,selectionStart:p,selectionEnd:v}}else if(E)if(u.length>0&&f.match(u)){b=b.replace(c,f);const w=m+b;return p=v=p+m.length,{text:w,selectionStart:p,selectionEnd:v}}else{const w=m+f+b;return p=p+m.length+f.length+b.indexOf(c),v=p+c.length,{text:w,selectionStart:p,selectionEnd:v}}else{let w=m+f+b;p=h+m.length,v=g+m.length;const y=f.match(/^\s*|\s*$/g);if(t.trimFirst&&y){const x=y[0]||"",B=y[1]||"";w=x+m+f.trim()+b+B,p+=x.length,v-=B.length}return{text:w,selectionStart:p,selectionEnd:v}}}function xi(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
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
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(`
88
+ `),i){const{newlinesToAppend:u,newlinesToPrepend:d}=Le(n);o+=u.length,a=o+r.length,r=u+r+d}return{text:r,selectionStart:o,selectionEnd:a}}function En(n){const t=n.split(`
89
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(`
90
+ `),processed:s}}function An(n){const t=n.split(`
91
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
92
+ `),processed:s}}function bt(n,t){return t?"- ":`${n+1}. `}function Ti(n,t){let e,s,i;return n.orderedList?(s=En(t),e=An(s.text),i=e.text):(s=An(t),e=En(s.text),i=e.text),[s,e,i]}function Oi(n,t){const e=n.selectionStart===n.selectionEnd;let s=n.selectionStart,i=n.selectionEnd;yi(n);const r=n.value.slice(n.selectionStart,n.selectionEnd),[o,a,c]=Ti(t,r),l=c.split(`
93
+ `).map((m,b)=>`${bt(b,t.unorderedList)}${m}`),u=l.reduce((m,b,p)=>m+bt(p,t.unorderedList).length,0),d=l.reduce((m,b,p)=>m+bt(p,!t.unorderedList).length,0);if(o.processed)return e?(s=Math.max(s-bt(0,t.unorderedList).length,0),i=s):(s=n.selectionStart,i=n.selectionEnd-u),{text:c,selectionStart:s,selectionEnd:i};const{newlinesToAppend:h,newlinesToPrepend:g}=Le(n),f=h+l.join(`
94
+ `)+g;return e?(s=Math.max(s+bt(0,t.unorderedList).length+h.length,0),i=s):a.processed?(s=Math.max(n.selectionStart+h.length,0),i=n.selectionEnd+h.length+u-d):(s=Math.max(n.selectionStart+h.length,0),i=n.selectionEnd+h.length+u),{text:f,selectionStart:s,selectionEnd:i}}function Ee(n,t){const e=n.closest("markdown-toolbar");if(!(e instanceof Ut))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(),wi(r,i))}var ki=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},xn=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)},xt;class Mi{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 Si=typeof Intl<"u"&&Intl.ListFormat||Mi,Ci=[["years","year"],["months","month"],["weeks","week"],["days","day"],["hours","hour"],["minutes","minute"],["seconds","second"],["milliseconds","millisecond"]],Li={minimumIntegerDigits:2};class Fi{constructor(t,e={}){xt.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;ki(this,xt,{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 xn(this,xt,"f")}formatToParts(t){const e=[],s=xn(this,xt,"f"),i=s.style,r=s.locale;for(const[o,a]of Ci){const c=t[o];if(s[`${o}Display`]==="auto"&&!c)continue;const l=s[o],u=l==="2-digit"?Li:l==="numeric"?{}:{style:"unit",unit:a,unitDisplay:l};e.push(new Intl.NumberFormat(r,u).format(c))}return new Si(r,{type:"unit",style:i==="digital"?"short":i}).formatToParts(e)}format(t){return this.formatToParts(t).map(e=>e.value).join("")}}xt=new WeakMap;const is=/^[-+]?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/,qt=["year","month","week","day","hour","minute","second","millisecond"],Di=n=>is.test(n);class M{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 M(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(is))===null||e===void 0?void 0:e.slice(1).map(o=>(Number(o)||0)*i);return r?new M(...r):new M}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 M(s,i,r,o,a,c,l,u)}throw new RangeError("invalid duration")}static compare(t,e){const s=Date.now(),i=Math.abs(Tn(s,M.from(t)).getTime()-s),r=Math.abs(Tn(s,M.from(e)).getTime()-s);return i>r?-1:i<r?1:0}toLocaleString(t,e){return new Fi(t,e).format(this)}}function Tn(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 _i(n,t="second",e=Date.now()){const s=n.getTime()-e;if(s===0)return new M;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),d=Math.floor(u/12),h=qt.indexOf(t)||qt.length;return new M(h>=0?d*i:0,h>=1?(u-d*12)*i:0,0,h>=3?(l-u*30)*i:0,h>=4?(c-l*24)*i:0,h>=5?(a-c*60)*i:0,h>=6?(o-a*60)*i:0,h>=7?(r-o*1e3)*i:0)}function rs(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 d=t.getFullYear();let h=t.getMonth();const g=t.getDate();if(o>=27||s+i+o){const f=new Date(t);f.setFullYear(d+s*e),f.setMonth(h+i*e),f.setDate(g+o*e);const m=f.getFullYear()-t.getFullYear(),b=f.getMonth()-t.getMonth(),p=Math.abs(Math.round((Number(f)-Number(t))/864e5)),v=Math.abs(m*12+b);p<27?(o>=6?(r+=Math.round(o/7),o=0):o=p,i=s=0):v<11?(i=v,s=0):(i=0,s=m*e),(i||s)&&(o=0),h=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 M(s*e,i*e,r*e,o*e,a*e,c*e,l*e,u*e)}function Bi(n,t){const e=rs(n,t);if(e.blank)return[0,"second"];for(const s of qt){if(s==="millisecond")continue;const i=e[`${s}s`];if(i)return[i,s]}return[0,"second"]}var A=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)},jt=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},F,Tt,Ot,vt,X,Ae,os,as,cs,ls,ot;const Ri=globalThis.HTMLElement||null,fe=new M,On=new M(0,0,0,0,0,1);class $i 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 kn(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 me=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=kn(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,kn(t)),t.update();this.time=Math.min(60*60*1e3,n),this.timer=setTimeout(()=>this.update(),this.time),this.time+=Date.now()}};class Pi extends Ri{constructor(){super(...arguments),F.add(this),Tt.set(this,!1),Ot.set(this,!1),X.set(this,this.shadowRoot?this.shadowRoot:this.attachShadow?this.attachShadow({mode:"open"}):this),ot.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 A(this,ot,"f")}set onRelativeTimeUpdated(t){A(this,ot,"f")&&this.removeEventListener("relative-time-updated",A(this,ot,"f")),jt(this,ot,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&&Di(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 qt.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(){me.unobserve(this)}attributeChangedCallback(t,e,s){e!==s&&(t==="title"&&jt(this,Tt,s!==null&&(this.date&&A(this,F,"m",Ae).call(this,this.date))!==s,"f"),!A(this,Ot,"f")&&!(t==="title"&&A(this,Tt,"f"))&&jt(this,Ot,(async()=>{await Promise.resolve(),this.update()})(),"f"))}update(){const t=A(this,X,"f").textContent||this.textContent||"",e=this.getAttribute("title")||"";let s=e;const i=this.date;if(typeof Intl>"u"||!Intl.DateTimeFormat||!i){A(this,X,"f").textContent=t;return}const r=Date.now();A(this,Tt,"f")||(s=A(this,F,"m",Ae).call(this,i)||"",s&&this.setAttribute("title",s));const o=_i(i,this.precision,r),a=A(this,F,"m",os).call(this,o);let c=t;a==="duration"?c=A(this,F,"m",as).call(this,o):a==="relative"?c=A(this,F,"m",cs).call(this,o):c=A(this,F,"m",ls).call(this,i),c?A(this,X,"f").textContent=c:this.shadowRoot===A(this,X,"f")&&this.textContent&&(A(this,X,"f").textContent=this.textContent),(c!==t||s!==e)&&this.dispatchEvent(new $i(t,c,e,s)),a==="relative"||a==="duration"?me.observe(this):me.unobserve(this),jt(this,Ot,!1,"f")}}Tt=new WeakMap,Ot=new WeakMap,X=new WeakMap,ot=new WeakMap,F=new WeakSet,vt=function(){var t;return((t=this.closest("[lang]"))===null||t===void 0?void 0:t.getAttribute("lang"))||this.ownerDocument.documentElement.getAttribute("lang")||"default"},Ae=function(t){return new Intl.DateTimeFormat(A(this,F,"a",vt),{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t)},os=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"||M.compare(t,this.threshold)===1)return"relative"}return"datetime"},as=function(t){const e=A(this,F,"a",vt),s=this.format,i=this.formatStyle,r=this.tense;let o=fe;s==="micro"?(t=rs(t),o=On,(this.tense==="past"&&t.sign!==-1||this.tense==="future"&&t.sign!==1)&&(t=On)):(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})},cs=function(t){const e=new Intl.RelativeTimeFormat(A(this,F,"a",vt),{numeric:"auto",style:this.formatStyle}),s=this.tense;s==="future"&&t.sign!==1&&(t=fe),s==="past"&&t.sign!==-1&&(t=fe);const[i,r]=Bi(t);return r==="second"&&i<10?e.format(0,this.precision==="millisecond"?"second":this.precision):e.format(i,r)},ls=function(t){const e=new Intl.DateTimeFormat(A(this,F,"a",vt),{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 Mn=typeof globalThis<"u"?globalThis:window;try{Mn.RelativeTimeElement=Pi.define()}catch(n){if(!(Mn.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}localStorage.getItem("theme");window.matchMedia("(prefers-color-scheme: dark)").matches;class Ii{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=Ni(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 Ni(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 ji{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 Ii(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 Hi={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}},Vi=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Wi(n){const e=n.trim().match(Vi)||[];let s=e[2],i=e[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:Ki(e[4]),eventName:s,eventOptions:e[7]?Ui(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||i}}function Ki(n){if(n=="window")return window;if(n=="document")return document}function Ui(n){return n.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function qi(n){if(n==window)return"window";if(n==document)return"document"}function Fe(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function xe(n){return Fe(n.replace(/--/g,"-").replace(/__/g,"_"))}function _t(n){return n.charAt(0).toUpperCase()+n.slice(1)}function us(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function zi(n){return n.match(/[^\s]+/g)||[]}function Sn(n){return n!=null}function Te(n,t){return Object.prototype.hasOwnProperty.call(n,t)}const Cn=["meta","ctrl","alt","shift"];class Yi{constructor(t,e,s,i){this.element=t,this.index=e,this.eventTarget=s.eventTarget||t,this.eventName=s.eventName||Xi(t)||Ht("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||Ht("missing identifier"),this.methodName=s.methodName||Ht("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=i}static forToken(t,e){return new this(t.element,t.index,Wi(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=>!Cn.includes(i))[0];return s?(Te(this.keyMappings,s)||Ht(`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[Fe(o)]=Gi(i))}return t}get eventTargetName(){return qi(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){const[s,i,r,o]=Cn.map(a=>e.includes(a));return t.metaKey!==s||t.ctrlKey!==i||t.altKey!==r||t.shiftKey!==o}}const Ln={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:n=>n.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Xi(n){const t=n.tagName.toLowerCase();if(t in Ln)return Ln[t](n)}function Ht(n){throw new Error(n)}function Gi(n){try{return JSON.parse(n)}catch{return n}}class Zi{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 ds{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 hs{constructor(t,e,s){this.attributeName=e,this.delegate=s,this.elementObserver=new ds(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 Ji(n,t,e){fs(n,t).add(e)}function Qi(n,t,e){fs(n,t).delete(e),tr(n,t)}function fs(n,t){let e=n.get(t);return e||(e=new Set,n.set(t,e)),e}function tr(n,t){const e=n.get(t);e!=null&&e.size==0&&n.delete(t)}class Z{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){Ji(this.valuesByKey,t,e)}delete(t,e){Qi(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 er{constructor(t,e,s,i){this._selector=e,this.details=i,this.elementObserver=new ds(t,this),this.delegate=s,this.matchesByElement=new Z}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 nr{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 ms{constructor(t,e,s){this.attributeObserver=new hs(t,e,this),this.delegate=s,this.tokensByElement=new Z}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=ir(e,s).findIndex(([r,o])=>!rr(r,o));return i==-1?[[],[]]:[e.slice(i),s.slice(i)]}readTokensForElement(t){const e=this.attributeName,s=t.getAttribute(e)||"";return sr(s,t,e)}}function sr(n,t,e){return n.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:t,attributeName:e,content:s,index:i}))}function ir(n,t){const e=Math.max(n.length,t.length);return Array.from({length:e},(s,i)=>[n[i],t[i]])}function rr(n,t){return n&&t&&n.index==t.index&&n.content==t.content}class ps{constructor(t,e,s){this.tokenListObserver=new ms(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 or{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new ps(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 Zi(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=Yi.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class ar{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new nr(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${_t(e.name)}`;return this.receiver[s]}}class cr{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new Z}start(){this.tokenListObserver||(this.tokenListObserver=new ms(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 Bt(n,t){const e=gs(n);return Array.from(e.reduce((s,i)=>(ur(i,t).forEach(r=>s.add(r)),s),new Set))}function lr(n,t){return gs(n).reduce((s,i)=>(s.push(...dr(i,t)),s),[])}function gs(n){const t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function ur(n,t){const e=n[t];return Array.isArray(e)?e:[]}function dr(n,t){const e=n[t];return e?Object.keys(e).map(s=>[s,e[s]]):[]}class hr{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new Z,this.outletElementsByName=new Z,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 er(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,s),s.start()}setupAttributeObserverForOutlet(t){const e=this.attributeNameForOutletName(t),s=new hs(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 Z;return this.router.modules.forEach(e=>{const s=e.definition.controllerConstructor;Bt(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 fr{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 or(this,this.dispatcher),this.valueObserver=new ar(this,this.controller),this.targetObserver=new cr(this,this),this.outletObserver=new hr(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(`${xe(s)}OutletConnected`,t,e)}outletDisconnected(t,e,s){this.invokeControllerMethod(`${xe(s)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const s=this.controller;typeof s[t]=="function"&&s[t](...e)}}function mr(n){return pr(n,gr(n))}function pr(n,t){const e=yr(n),s=br(n.prototype,t);return Object.defineProperties(e.prototype,s),e}function gr(n){return Bt(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 br(n,t){return wr(t).reduce((e,s)=>{const i=vr(n,t,s);return i&&Object.assign(e,{[s]:i}),e},{})}function vr(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 wr=typeof Object.getOwnPropertySymbols=="function"?n=>[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)]:Object.getOwnPropertyNames,yr=(()=>{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 Er(n){return{identifier:n.identifier,controllerConstructor:mr(n.controllerConstructor)}}class Ar{constructor(t,e){this.application=t,this.definition=Er(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 fr(this,t),this.contextsByScope.set(t,e)),e}}class xr{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 zi(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class Tr{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}-${us(t)}`}}class Or{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 Oe(n,t){return`[${n}~="${t}"]`}class kr{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 Oe(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 Oe(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 Mr{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 De{constructor(t,e,s,i){this.targets=new kr(this),this.classes=new xr(this),this.data=new Tr(this),this.containsElement=r=>r.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=s,this.guide=new Or(i),this.outlets=new Mr(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 Oe(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new De(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class Sr{constructor(t,e,s){this.element=t,this.schema=e,this.delegate=s,this.valueListObserver=new ps(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 Cr{constructor(t){this.application=t,this.scopeObserver=new Sr(this.element,this.schema,this),this.scopesByIdentifier=new Z,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 Ar(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 De(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 Lr={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"},Fn("abcdefghijklmnopqrstuvwxyz".split("").map(n=>[n,n]))),Fn("0123456789".split("").map(n=>[n,n])))};function Fn(n){return n.reduce((t,[e,s])=>Object.assign(Object.assign({},t),{[e]:s}),{})}class Fr{constructor(t=document.documentElement,e=Lr){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 ji(this),this.router=new Cr(this),this.actionDescriptorFilters=Object.assign({},Hi)}static start(t,e){const s=new this(t,e);return s.start(),s}async start(){await Dr(),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
95
 
96
96
  %o
97
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)}
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 Dr(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function _r(n){return Bt(n,"classes").reduce((e,s)=>Object.assign(e,Br(s)),{})}function Br(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${_t(n)}Class`]:{get(){return this.classes.has(n)}}}}function Rr(n){return Bt(n,"outlets").reduce((e,s)=>Object.assign(e,$r(s)),{})}function Dn(n,t,e){return n.application.getControllerForElementAndIdentifier(t,e)}function _n(n,t,e){let s=Dn(n,t,e);if(s||(n.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),s=Dn(n,t,e),s))return s}function $r(n){const t=xe(n);return{[`${t}Outlet`]:{get(){const e=this.outlets.find(n),s=this.outlets.getSelectorForOutletName(n);if(e){const i=_n(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=_n(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${_t(t)}Outlet`]:{get(){return this.outlets.has(n)}}}}function Pr(n){return Bt(n,"targets").reduce((e,s)=>Object.assign(e,Ir(s)),{})}function Ir(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${_t(n)}Target`]:{get(){return this.targets.has(n)}}}}function Nr(n){const t=lr(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((s,i)=>{const r=bs(i,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(s,{[o]:r})},{})}}};return t.reduce((s,i)=>Object.assign(s,jr(i)),e)}function jr(n,t){const e=bs(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${_t(i)}`]:{get(){return this.data.has(s)||e.hasCustomDefaultValue}}}}function bs([n,t],e){return Kr({controller:e,token:n,typeDefinition:t})}function zt(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Ft(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 Hr(n){const{controller:t,token:e,typeObject:s}=n,i=Sn(s.type),r=Sn(s.default),o=i&&r,a=i&&!r,c=!i&&r,l=zt(s.type),u=Ft(n.typeObject.default);if(a)return l;if(c)return u;if(l!==u){const d=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${d}" must match the defined type "${l}". The provided default value of "${s.default}" is of type "${u}".`)}if(o)return l}function Vr(n){const{controller:t,token:e,typeDefinition:s}=n,r=Hr({controller:t,token:e,typeObject:s}),o=Ft(s),a=zt(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 Wr(n){const t=zt(n);if(t)return Bn[t];const e=Te(n,"default"),s=Te(n,"type"),i=n;if(e)return i.default;if(s){const{type:r}=i,o=zt(r);if(o)return Bn[o]}return n}function Kr(n){const{token:t,typeDefinition:e}=n,s=`${us(t)}-value`,i=Vr(n);return{type:i,key:s,name:Fe(s),get defaultValue(){return Wr(e)},get hasCustomDefaultValue(){return Ft(e)!==void 0},reader:Ur[i],writer:Rn[i]||Rn.default}}const Bn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Ur={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 "${Ft(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 "${Ft(t)}"`);return t},string(n){return n}},Rn={default:qr,array:$n,object:$n};function $n(n){return JSON.stringify(n)}function qr(n){return`${n}`}class U{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}}U.blessings=[_r,Pr,Nr,Rr];U.targets=[];U.outlets=[];U.values={};function _e(){return function({targets:t,values:e}={}){const i=class i extends U{};i.targets=Object.keys(t??{}),i.values=e??{};let s=i;return s}}function zr(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 vs(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 ke(n){if("clipboard"in navigator)return navigator.clipboard.writeText(n);const t=document.body;if(!t)return Promise.reject(new Error);const e=zr(n);return t.appendChild(e),vs(e),t.removeChild(e),Promise.resolve()}async function ws(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 ke(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 Yr(r),s())}}}function Yr(n){return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement?ke(n.value):n instanceof HTMLAnchorElement&&n.hasAttribute("href")?ke(n.href):vs(n)}function Xr(n){const t=n.currentTarget;t instanceof HTMLElement&&ws(t)}function ys(n){if(n.key===" "||n.key==="Enter"){const t=n.currentTarget;t instanceof HTMLElement&&(n.preventDefault(),ws(t))}}function Gr(n){n.currentTarget.addEventListener("keydown",ys)}function Zr(n){n.currentTarget.removeEventListener("keydown",ys)}class Jr extends HTMLElement{static define(t="clipboard-copy",e=customElements){return e.define(t,this),this}constructor(){super(),this.addEventListener("click",Xr),this.addEventListener("focus",Gr),this.addEventListener("blur",Zr)}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 Pn=typeof globalThis<"u"?globalThis:window;try{Pn.ClipboardCopyElement=Jr.define()}catch(n){if(!(Pn.DOMException&&n instanceof DOMException&&n.name==="NotSupportedError")&&!(n instanceof ReferenceError))throw n}const Qr=2e3;class to extends _e()({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)},Qr))}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 eo=Object.freeze(Object.defineProperty({__proto__:null,default:to},Symbol.toStringTag,{value:"Module"})),ht=Math.min,S=Math.max,Yt=Math.round,Vt=Math.floor,V=n=>({x:n,y:n}),no={left:"right",right:"left",bottom:"top",top:"bottom"},so={start:"end",end:"start"};function In(n,t,e){return S(n,ht(t,e))}function Rt(n,t){return typeof n=="function"?n(t):n}function W(n){return n.split("-")[0]}function $t(n){return n.split("-")[1]}function Es(n){return n==="x"?"y":"x"}function As(n){return n==="y"?"height":"width"}function Pt(n){return["top","bottom"].includes(W(n))?"y":"x"}function xs(n){return Es(Pt(n))}function io(n,t,e){e===void 0&&(e=!1);const s=$t(n),i=xs(n),r=As(i);let o=i==="x"?s===(e?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=Xt(o)),[o,Xt(o)]}function ro(n){const t=Xt(n);return[Me(n),t,Me(t)]}function Me(n){return n.replace(/start|end/g,t=>so[t])}function oo(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 ao(n,t,e,s){const i=$t(n);let r=oo(W(n),e==="start",s);return i&&(r=r.map(o=>o+"-"+i),t&&(r=r.concat(r.map(Me)))),r}function Xt(n){return n.replace(/left|right|bottom|top/g,t=>no[t])}function co(n){return{top:0,right:0,bottom:0,left:0,...n}}function lo(n){return typeof n!="number"?co(n):{top:n,right:n,bottom:n,left:n}}function Gt(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function Nn(n,t,e){let{reference:s,floating:i}=n;const r=Pt(t),o=xs(t),a=As(o),c=W(t),l=r==="y",u=s.x+s.width/2-i.width/2,d=s.y+s.height/2-i.height/2,h=s[a]/2-i[a]/2;let g;switch(c){case"top":g={x:u,y:s.y-i.height};break;case"bottom":g={x:u,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:d};break;case"left":g={x:s.x-i.width,y:d};break;default:g={x:s.x,y:s.y}}switch($t(t)){case"start":g[o]-=h*(e&&l?-1:1);break;case"end":g[o]+=h*(e&&l?-1:1);break}return g}const uo=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:d}=Nn(l,s,c),h=s,g={},f=0;for(let m=0;m<a.length;m++){const{name:b,fn:p}=a[m],{x:v,y:E,data:w,reset:y}=await p({x:u,y:d,initialPlacement:s,placement:h,strategy:i,middlewareData:g,rects:l,platform:o,elements:{reference:n,floating:t}});u=v??u,d=E??d,g={...g,[b]:{...g[b],...w}},y&&f<=50&&(f++,typeof y=="object"&&(y.placement&&(h=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:n,floating:t,strategy:i}):y.rects),{x:u,y:d}=Nn(l,h,c)),m=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:g}};async function Be(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:d="floating",altBoundary:h=!1,padding:g=0}=Rt(t,n),f=lo(g),b=a[h?d==="floating"?"reference":"floating":d],p=Gt(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=d==="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=Gt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:E,strategy:c}):v);return{top:(p.top-y.top+f.top)/w.y,bottom:(y.bottom-p.bottom+f.bottom)/w.y,left:(p.left-y.left+f.left)/w.x,right:(y.right-p.right+f.right)/w.x}}const ho=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:d=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...b}=Rt(n,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};const p=W(i),v=W(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(l.floating)),w=h||(v||!m?[Xt(a)]:ro(a));!h&&f!=="none"&&w.push(...ao(a,m,f,E));const y=[a,...w],x=await Be(t,b),B=[];let j=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&B.push(x[p]),d){const q=io(i,o,E);B.push(x[q[0]],x[q[1]])}if(j=[...j,{placement:i,overflows:B}],!B.every(q=>q<=0)){var mt,Ne;const q=(((mt=r.flip)==null?void 0:mt.index)||0)+1,He=y[q];if(He)return{data:{index:q,overflows:j},reset:{placement:He}};let pt=(Ne=j.filter(tt=>tt.overflows[0]<=0).sort((tt,et)=>tt.overflows[1]-et.overflows[1])[0])==null?void 0:Ne.placement;if(!pt)switch(g){case"bestFit":{var je;const tt=(je=j.map(et=>[et.placement,et.overflows.filter(gt=>gt>0).reduce((gt,Bs)=>gt+Bs,0)]).sort((et,gt)=>et[1]-gt[1])[0])==null?void 0:je[0];tt&&(pt=tt);break}case"initialPlacement":pt=a;break}if(i!==pt)return{reset:{placement:pt}}}return{}}}};async function fo(n,t){const{placement:e,platform:s,elements:i}=n,r=await(s.isRTL==null?void 0:s.isRTL(i.floating)),o=W(e),a=$t(e),c=Pt(e)==="y",l=["left","top"].includes(o)?-1:1,u=r&&c?-1:1,d=Rt(t,n);let{mainAxis:h,crossAxis:g,alignmentAxis:f}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof f=="number"&&(g=a==="end"?f*-1:f),c?{x:g*u,y:h*l}:{x:h*l,y:g*u}}const mo=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 fo(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}}}}},po=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:p,y:v}=b;return{x:p,y:v}}},...c}=Rt(n,t),l={x:e,y:s},u=await Be(t,c),d=Pt(W(i)),h=Es(d);let g=l[h],f=l[d];if(r){const b=h==="y"?"top":"left",p=h==="y"?"bottom":"right",v=g+u[b],E=g-u[p];g=In(v,g,E)}if(o){const b=d==="y"?"top":"left",p=d==="y"?"bottom":"right",v=f+u[b],E=f-u[p];f=In(v,f,E)}const m=a.fn({...t,[h]:g,[d]:f});return{...m,data:{x:m.x-e,y:m.y-s}}}}},go=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}=Rt(n,t),c=await Be(t,a),l=W(e),u=$t(e),d=Pt(e)==="y",{width:h,height:g}=s.floating;let f,m;l==="top"||l==="bottom"?(f=l,m=u===(await(i.isRTL==null?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(m=l,f=u==="end"?"top":"bottom");const b=g-c[f],p=h-c[m],v=!t.middlewareData.shift;let E=b,w=p;if(d){const x=h-c.left-c.right;w=u||v?ht(p,x):x}else{const x=g-c.top-c.bottom;E=u||v?ht(b,x):x}if(v&&!u){const x=S(c.left,0),B=S(c.right,0),j=S(c.top,0),mt=S(c.bottom,0);d?w=h-2*(x!==0||B!==0?x+B:S(c.left,c.right)):E=g-2*(j!==0||mt!==0?j+mt:S(c.top,c.bottom))}await o({...t,availableWidth:w,availableHeight:E});const y=await i.getDimensions(r.floating);return h!==y.width||g!==y.height?{reset:{rects:!0}}:{}}}};function K(n){return Ts(n)?(n.nodeName||"").toLowerCase():"#document"}function C(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function N(n){var t;return(t=(Ts(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function Ts(n){return n instanceof Node||n instanceof C(n).Node}function I(n){return n instanceof Element||n instanceof C(n).Element}function R(n){return n instanceof HTMLElement||n instanceof C(n).HTMLElement}function jn(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof C(n).ShadowRoot}function It(n){const{overflow:t,overflowX:e,overflowY:s,display:i}=D(n);return/auto|scroll|overlay|hidden|clip/.test(t+s+e)&&!["inline","contents"].includes(i)}function bo(n){return["table","td","th"].includes(K(n))}function Re(n){const t=$e(),e=D(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 vo(n){let t=ft(n);for(;R(t)&&!ne(t);){if(Re(t))return t;t=ft(t)}return null}function $e(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ne(n){return["html","body","#document"].includes(K(n))}function D(n){return C(n).getComputedStyle(n)}function se(n){return I(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function ft(n){if(K(n)==="html")return n;const t=n.assignedSlot||n.parentNode||jn(n)&&n.host||N(n);return jn(t)?t.host:t}function Os(n){const t=ft(n);return ne(t)?n.ownerDocument?n.ownerDocument.body:n.body:R(t)&&It(t)?t:Os(t)}function Dt(n,t,e){var s;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=Os(n),r=i===((s=n.ownerDocument)==null?void 0:s.body),o=C(i);return r?t.concat(o,o.visualViewport||[],It(i)?i:[],o.frameElement&&e?Dt(o.frameElement):[]):t.concat(i,Dt(i,[],e))}function ks(n){const t=D(n);let e=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=R(n),r=i?n.offsetWidth:e,o=i?n.offsetHeight:s,a=Yt(e)!==r||Yt(s)!==o;return a&&(e=r,s=o),{width:e,height:s,$:a}}function Pe(n){return I(n)?n:n.contextElement}function ut(n){const t=Pe(n);if(!R(t))return V(1);const e=t.getBoundingClientRect(),{width:s,height:i,$:r}=ks(t);let o=(r?Yt(e.width):e.width)/s,a=(r?Yt(e.height):e.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const wo=V(0);function Ms(n){const t=C(n);return!$e()||!t.visualViewport?wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function yo(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==C(n)?!1:t}function Q(n,t,e,s){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),r=Pe(n);let o=V(1);t&&(s?I(s)&&(o=ut(s)):o=ut(n));const a=yo(r,e,s)?Ms(r):V(0);let c=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(r){const h=C(r),g=s&&I(s)?C(s):s;let f=h,m=f.frameElement;for(;m&&s&&g!==f;){const b=ut(m),p=m.getBoundingClientRect(),v=D(m),E=p.left+(m.clientLeft+parseFloat(v.paddingLeft))*b.x,w=p.top+(m.clientTop+parseFloat(v.paddingTop))*b.y;c*=b.x,l*=b.y,u*=b.x,d*=b.y,c+=E,l+=w,f=C(m),m=f.frameElement}}return Gt({width:u,height:d,x:c,y:l})}const Eo=[":popover-open",":modal"];function Ss(n){return Eo.some(t=>{try{return n.matches(t)}catch{return!1}})}function Ao(n){let{elements:t,rect:e,offsetParent:s,strategy:i}=n;const r=i==="fixed",o=N(s),a=t?Ss(t.floating):!1;if(s===o||a&&r)return e;let c={scrollLeft:0,scrollTop:0},l=V(1);const u=V(0),d=R(s);if((d||!d&&!r)&&((K(s)!=="body"||It(o))&&(c=se(s)),R(s))){const h=Q(s);l=ut(s),u.x=h.x+s.clientLeft,u.y=h.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 xo(n){return Array.from(n.getClientRects())}function Cs(n){return Q(N(n)).left+se(n).scrollLeft}function To(n){const t=N(n),e=se(n),s=n.ownerDocument.body,i=S(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),r=S(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-e.scrollLeft+Cs(n);const a=-e.scrollTop;return D(s).direction==="rtl"&&(o+=S(t.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:a}}function Oo(n,t){const e=C(n),s=N(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 ko(n,t){const e=Q(n,!0,t==="fixed"),s=e.top+n.clientTop,i=e.left+n.clientLeft,r=R(n)?ut(n):V(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 Hn(n,t,e){let s;if(t==="viewport")s=Oo(n,e);else if(t==="document")s=To(N(n));else if(I(t))s=ko(t,e);else{const i=Ms(n);s={...t,x:t.x-i.x,y:t.y-i.y}}return Gt(s)}function Ls(n,t){const e=ft(n);return e===t||!I(e)||ne(e)?!1:D(e).position==="fixed"||Ls(e,t)}function Mo(n,t){const e=t.get(n);if(e)return e;let s=Dt(n,[],!1).filter(a=>I(a)&&K(a)!=="body"),i=null;const r=D(n).position==="fixed";let o=r?ft(n):n;for(;I(o)&&!ne(o);){const a=D(o),c=Re(o);!c&&a.position==="fixed"&&(i=null),(r?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||It(o)&&!c&&Ls(n,o))?s=s.filter(u=>u!==o):i=a,o=ft(o)}return t.set(n,s),s}function So(n){let{element:t,boundary:e,rootBoundary:s,strategy:i}=n;const o=[...e==="clippingAncestors"?Mo(t,this._c):[].concat(e),s],a=o[0],c=o.reduce((l,u)=>{const d=Hn(t,u,i);return l.top=S(d.top,l.top),l.right=ht(d.right,l.right),l.bottom=ht(d.bottom,l.bottom),l.left=S(d.left,l.left),l},Hn(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Co(n){const{width:t,height:e}=ks(n);return{width:t,height:e}}function Lo(n,t,e){const s=R(t),i=N(t),r=e==="fixed",o=Q(n,!0,r,t);let a={scrollLeft:0,scrollTop:0};const c=V(0);if(s||!s&&!r)if((K(t)!=="body"||It(i))&&(a=se(t)),s){const d=Q(t,!0,r,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else i&&(c.x=Cs(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 Vn(n,t){return!R(n)||D(n).position==="fixed"?null:t?t(n):n.offsetParent}function Fs(n,t){const e=C(n);if(!R(n)||Ss(n))return e;let s=Vn(n,t);for(;s&&bo(s)&&D(s).position==="static";)s=Vn(s,t);return s&&(K(s)==="html"||K(s)==="body"&&D(s).position==="static"&&!Re(s))?e:s||vo(n)||e}const Fo=async function(n){const t=this.getOffsetParent||Fs,e=this.getDimensions;return{reference:Lo(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,...await e(n.floating)}}};function Do(n){return D(n).direction==="rtl"}const _o={convertOffsetParentRelativeRectToViewportRelativeRect:Ao,getDocumentElement:N,getClippingRect:So,getOffsetParent:Fs,getElementRects:Fo,getClientRects:xo,getDimensions:Co,getScale:ut,isElement:I,isRTL:Do};function Bo(n,t){let e=null,s;const i=N(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:d,height:h}=n.getBoundingClientRect();if(a||t(),!d||!h)return;const g=Vt(u),f=Vt(i.clientWidth-(l+d)),m=Vt(i.clientHeight-(u+h)),b=Vt(l),v={rootMargin:-g+"px "+-f+"px "+-m+"px "+-b+"px",threshold:S(0,ht(1,c))||1};let E=!0;function w(y){const x=y[0].intersectionRatio;if(x!==c){if(!E)return o();x?o(!1,x):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 Ro(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=Pe(n),u=i||r?[...l?Dt(l):[],...Dt(t)]:[];u.forEach(p=>{i&&p.addEventListener("scroll",e,{passive:!0}),r&&p.addEventListener("resize",e)});const d=l&&a?Bo(l,e):null;let h=-1,g=null;o&&(g=new ResizeObserver(p=>{let[v]=p;v&&v.target===l&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=g)==null||E.observe(t)})),e()}),l&&!c&&g.observe(l),g.observe(t));let f,m=c?Q(n):null;c&&b();function b(){const p=Q(n);m&&(p.x!==m.x||p.y!==m.y||p.width!==m.width||p.height!==m.height)&&e(),m=p,f=requestAnimationFrame(b)}return e(),()=>{var p;u.forEach(v=>{i&&v.removeEventListener("scroll",e),r&&v.removeEventListener("resize",e)}),d==null||d(),(p=g)==null||p.disconnect(),g=null,c&&cancelAnimationFrame(f)}}const $o=po,Po=ho,Io=go,No=(n,t,e)=>{const s=new Map,i={platform:_o,...e},r={...i.platform,_c:s};return uo(n,t,{...i,platform:r})},jo=(n,t,e)=>{let s=n;return e===!0?s=`${t.identifier}:${n}`:typeof e=="string"&&(s=`${e}:${n}`),s},Ho=(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 Vo(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 Wo(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 pe={debug:!1,logger:console,dispatchEvent:!0,eventPrefix:!0};class Ko{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,d=Wo(l,["event"]),h=this.extendedEvent(c,u||null,d);this.targetElement.dispatchEvent(h),this.log("dispatchEvent",Object.assign({eventName:h.type},d))}},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:d,cancelable:h,composed:g}=l||{bubbles:!0,cancelable:!0,composed:!0};return l&&Object.assign(u,{originalEvent:l}),new CustomEvent(this.composeEventName(c),{bubbles:d,cancelable:h,composed:g,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:pe.debug,this.logger=(r=e==null?void 0:e.logger)!==null&&r!==void 0?r:pe.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({},pe,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 Uo={events:["click","touchend"],onlyVisible:!0,dispatchEvent:!0,eventPrefix:!0},qo=(n,t={})=>{const e=n,{onlyVisible:s,dispatchEvent:i,events:r,eventPrefix:o}=Object.assign({},Uo,t),a=d=>{const h=(t==null?void 0:t.element)||e.element;if(!(h.contains(d.target)||!Vo(h)&&s)&&(e.clickOutside&&e.clickOutside(d),i)){const g=jo("click:outside",e,o),f=Ho(g,d,{controller:e});h.dispatchEvent(f)}},c=()=>{r==null||r.forEach(d=>{window.addEventListener(d,a,!0)})},l=()=>{r==null||r.forEach(d=>{window.removeEventListener(d,a,!0)})},u=e.disconnect.bind(e);return Object.assign(e,{disconnect(){l(),u()}}),c(),[c,l]};class zo extends U{}zo.debounces=[];const Yo=200,Wn=(n,t=Yo)=>{let e=null;return function(){const s=Array.from(arguments),i=this,r=s.map(a=>a.params),o=()=>(s.forEach((a,c)=>a.params=r[c]),n.apply(i,s));e&&clearTimeout(e),e=setTimeout(o,t)}},Xo=(n,t)=>{const e=n;e.constructor.debounces.forEach(i=>{if(typeof i=="string"&&(e[i]=Wn(e[i],t==null?void 0:t.wait)),typeof i=="object"){const{name:r,wait:o}=i;if(!r)return;e[r]=Wn(e[r],o||(t==null?void 0:t.wait))}})};class Go extends Ko{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 Zo=(n,t={})=>{const e=new Go(n,t);return[e.observe,e.unobserve]};class Jo extends U{}Jo.throttles=[];class Qo extends _e()({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(){qo(this),Zo(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;No(this.anchorTarget,this.popoverTarget,{middleware:[mo(6),Po(),$o({padding:6}),Io({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=Ro(this.anchorTarget,this.popoverTarget,t)}toggle(){this.element.open=!this.element.open,this.setupAutoUpdate()}}const ta=Object.freeze(Object.defineProperty({__proto__:null,default:Qo},Symbol.toStringTag,{value:"Module"}));function ea(n){if(Array.isArray(n)){for(var t=0,e=Array(n.length);t<n.length;t++)e[t]=n[t];return e}else return Array.from(n)}var Ie=!1;if(typeof window<"u"){var Kn={get passive(){Ie=!0}};window.addEventListener("testPassive",null,Kn),window.removeEventListener("testPassive",null,Kn)}var Zt=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),J=[],Jt=!1,Ds=-1,St=void 0,G=void 0,Ct=void 0,_s=function(t){return J.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(t))})},Qt=function(t){var e=t||window.event;return _s(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},na=function(t){if(Ct===void 0){var e=!!t&&t.reserveScrollBarGap===!0,s=window.innerWidth-document.documentElement.clientWidth;if(e&&s>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);Ct=document.body.style.paddingRight,document.body.style.paddingRight=i+s+"px"}}St===void 0&&(St=document.body.style.overflow,document.body.style.overflow="hidden")},sa=function(){Ct!==void 0&&(document.body.style.paddingRight=Ct,Ct=void 0),St!==void 0&&(document.body.style.overflow=St,St=void 0)},ia=function(){return window.requestAnimationFrame(function(){if(G===void 0){G={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var t=window,e=t.scrollY,s=t.scrollX,i=t.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-s,setTimeout(function(){return window.requestAnimationFrame(function(){var r=i-window.innerHeight;r&&e>=i&&(document.body.style.top=-(e+r))})},300)}})},ra=function(){if(G!==void 0){var t=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=G.position,document.body.style.top=G.top,document.body.style.left=G.left,window.scrollTo(e,t),G=void 0}},oa=function(t){return t?t.scrollHeight-t.scrollTop<=t.clientHeight:!1},aa=function(t,e){var s=t.targetTouches[0].clientY-Ds;return _s(t.target)?!1:e&&e.scrollTop===0&&s>0||oa(e)&&s<0?Qt(t):(t.stopPropagation(),!0)},ca=function(t,e){if(!t){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!J.some(function(i){return i.targetElement===t})){var s={targetElement:t,options:e||{}};J=[].concat(ea(J),[s]),Zt?ia():na(e),Zt&&(t.ontouchstart=function(i){i.targetTouches.length===1&&(Ds=i.targetTouches[0].clientY)},t.ontouchmove=function(i){i.targetTouches.length===1&&aa(i,t)},Jt||(document.addEventListener("touchmove",Qt,Ie?{passive:!1}:void 0),Jt=!0))}},la=function(t){if(!t){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}J=J.filter(function(e){return e.targetElement!==t}),Zt&&(t.ontouchstart=null,t.ontouchmove=null,Jt&&J.length===0&&(document.removeEventListener("touchmove",Qt,Ie?{passive:!1}:void 0),Jt=!1)),Zt?ra():sa()};class ua extends _e()({targets:{dialog:HTMLDialogElement}}){close(){this.dialogTarget.close(),la(this.dialogTarget)}disconnect(){this.close()}open(){this.dialogTarget.showModal(),ca(this.dialogTarget,{reserveScrollBarGap:!0})}triggerClick(){this.dialogTarget.open?this.close():this.open()}windowClick(t){t.target===this.dialogTarget&&this.close()}}const da=Object.freeze(Object.defineProperty({__proto__:null,default:ua},Symbol.toStringTag,{value:"Module"})),te=class te extends U{connect(){Xo(this)}save(){this.hasFormTarget?this.formTarget.requestSubmit():this.element.requestSubmit()}};te.debounces=["save"],te.targets=["form"];let Se=te;const ha=Object.freeze(Object.defineProperty({__proto__:null,default:Se},Symbol.toStringTag,{value:"Module"})),ie=Fr.start();ie.debug=!1;window.Stimulus=ie;const fa=Object.assign({"../../components/ariadne/ui/clipboard_copy/component.ts":eo,"../../components/ariadne/ui/combobox/component.ts":ta,"../../components/ariadne/ui/dialog/component.ts":da});for(const[n,t]of Object.entries(fa)){const e=n.split("/"),s=e.slice(3,e.length-1).join("-").replaceAll("_","-").toLocaleLowerCase();ie.register(s,t.default)}const ma=Object.assign({"/controllers/autosubmittable_controller.ts":ha});for(const[n,t]of Object.entries(ma)){const e=n.split("/"),s=e.slice(2,e.length).join("-").replace(".ts","").replaceAll("_","-").toLocaleLowerCase();ie.register(`ariadne-${s}`,t.default)}
99
99
  //# sourceMappingURL=ariadne_view_components.js.map