@stackoverflow/stacks 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/activity-indicator/activity-indicator.a11y.test.d.ts +1 -0
- package/dist/components/activity-indicator/activity-indicator.visual.test.d.ts +1 -0
- package/dist/components/avatar/avatar.a11y.test.d.ts +1 -0
- package/dist/components/avatar/avatar.visual.test.d.ts +1 -0
- package/dist/{controllers/s-banner.d.ts → components/banner/banner.d.ts} +1 -1
- package/dist/components/banner/banner.test.d.ts +1 -0
- package/dist/components/banner/banner.visual.test.d.ts +1 -0
- package/dist/components/button/button.a11y.test.d.ts +1 -0
- package/dist/components/button/button.visual.test.d.ts +1 -0
- package/dist/{controllers/s-expandable-control.d.ts → components/expandable/expandable.d.ts} +1 -1
- package/dist/components/expandable/expandable.test.d.ts +1 -0
- package/dist/{controllers/s-modal.d.ts → components/modal/modal.d.ts} +1 -1
- package/dist/{controllers/s-navigation-tablist.d.ts → components/navigation/navigation.d.ts} +1 -1
- package/dist/{controllers/s-popover.d.ts → components/popover/popover.d.ts} +1 -1
- package/dist/{controllers/s-tooltip.d.ts → components/popover/tooltip.d.ts} +1 -1
- package/dist/components/popover/tooltip.test.d.ts +1 -0
- package/dist/components/popover/tooltip.visual.test.d.ts +1 -0
- package/dist/{controllers/s-table.d.ts → components/table/table.d.ts} +1 -1
- package/dist/{controllers/s-toast.d.ts → components/toast/toast.d.ts} +1 -1
- package/dist/components/toast/toast.test.d.ts +1 -0
- package/dist/components/toast/toast.visual.test.d.ts +1 -0
- package/dist/{controllers/s-uploader.d.ts → components/uploader/uploader.d.ts} +1 -1
- package/dist/controllers.d.ts +9 -0
- package/dist/css/stacks.css +2043 -1989
- package/dist/css/stacks.min.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/js/stacks.js +545 -545
- package/dist/js/stacks.min.js +1 -1
- package/dist/test/test-utils.d.ts +136 -0
- package/lib/{css/atomic/borders.less → atomic/border.less} +18 -0
- package/lib/{css/base/icons.less → base/icon.less} +0 -9
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -0
- package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -0
- package/lib/components/avatar/avatar.a11y.test.ts +36 -0
- package/lib/components/avatar/avatar.visual.test.ts +54 -0
- package/lib/components/banner/banner.less +51 -0
- package/lib/{test/s-banner.test.ts → components/banner/banner.test.ts} +7 -3
- package/lib/{ts/controllers/s-banner.ts → components/banner/banner.ts} +1 -1
- package/lib/components/banner/banner.visual.test.ts +36 -0
- package/lib/components/button/button.a11y.test.ts +32 -0
- package/lib/{css/components/buttons.less → components/button/button.less} +3 -2
- package/lib/components/button/button.visual.test.ts +52 -0
- package/lib/{css/components/cards.less → components/card/card.less} +1 -1
- package/lib/components/check-control/check-control.less +17 -0
- package/lib/components/check-group/check-group.less +19 -0
- package/lib/{css/components → components/expandable}/expandable.less +3 -0
- package/lib/components/expandable/expandable.test.ts +53 -0
- package/lib/{ts/controllers/s-expandable-control.ts → components/expandable/expandable.ts} +1 -1
- package/lib/components/input-fill/input-fill.less +35 -0
- package/lib/components/input-icon/input-icon.less +45 -0
- package/lib/components/input-message/input-message.less +48 -0
- package/lib/{css/components/inputs.less → components/input_textarea/input_textarea.less} +0 -131
- package/lib/{css/components → components/link}/link.less +2 -2
- package/lib/{ts/controllers/s-modal.ts → components/modal/modal.ts} +1 -1
- package/lib/{ts/controllers/s-navigation-tablist.ts → components/navigation/navigation.ts} +1 -1
- package/lib/{css/components/notices.less → components/notice/notice.less} +0 -89
- package/lib/{css/components/popovers.less → components/popover/popover.less} +1 -0
- package/lib/{ts/controllers/s-popover.ts → components/popover/popover.ts} +1 -1
- package/lib/{test/s-tooltip.test.ts → components/popover/tooltip.test.ts} +6 -2
- package/lib/{ts/controllers/s-tooltip.ts → components/popover/tooltip.ts} +2 -2
- package/lib/{test/s-tooltip.visual.test.ts → components/popover/tooltip.visual.test.ts} +2 -2
- package/lib/{css/components/sidebar-widgets.less → components/sidebar-widget/sidebar-widget.less} +0 -1
- package/lib/{css/components → components/table}/table.less +0 -5
- package/lib/{ts/controllers/s-table.ts → components/table/table.ts} +1 -1
- package/lib/components/table-container/table-container.less +4 -0
- package/lib/components/toast/toast.less +35 -0
- package/lib/{test/s-toast.test.ts → components/toast/toast.test.ts} +7 -3
- package/lib/{ts/controllers/s-toast.ts → components/toast/toast.ts} +1 -1
- package/lib/components/toast/toast.visual.test.ts +27 -0
- package/lib/{ts/controllers/s-uploader.ts → components/uploader/uploader.ts} +1 -1
- package/lib/controllers.ts +33 -0
- package/lib/{ts/index.ts → index.ts} +1 -1
- package/lib/{css/stacks-dynamic.less → stacks-dynamic.less} +1 -2
- package/lib/stacks-static.less +93 -0
- package/lib/test/test-utils.ts +444 -0
- package/lib/tsconfig.json +1 -1
- package/package.json +17 -17
- package/dist/controllers/index.d.ts +0 -9
- package/lib/css/stacks-static.less +0 -87
- package/lib/test/s-avatar.a11y.test.ts +0 -77
- package/lib/test/s-banner.visual.test.ts +0 -61
- package/lib/test/s-btn.a11y.test.ts +0 -123
- package/lib/test/s-btn.visual.test.ts +0 -16
- package/lib/test/s-toast.visual.test.ts +0 -48
- package/lib/ts/controllers/index.ts +0 -17
- /package/lib/{css/atomic/colors.less → atomic/color.less} +0 -0
- /package/lib/{css/atomic → atomic}/flex.less +0 -0
- /package/lib/{css/atomic → atomic}/gap.less +0 -0
- /package/lib/{css/atomic → atomic}/grid.less +0 -0
- /package/lib/{css/atomic → atomic}/misc.less +0 -0
- /package/lib/{css/atomic → atomic}/spacing.less +0 -0
- /package/lib/{css/atomic → atomic}/typography.less +0 -0
- /package/lib/{css/atomic → atomic}/width-height.less +0 -0
- /package/lib/{css/base → base}/body.less +0 -0
- /package/lib/{css/base → base}/configuration-static.less +0 -0
- /package/lib/{css/base → base}/fieldset.less +0 -0
- /package/lib/{css/base/internals.less → base/internal.less} +0 -0
- /package/lib/{css/base → base}/reset-meyer.less +0 -0
- /package/lib/{css/base → base}/reset-normalize.less +0 -0
- /package/lib/{css/base → base}/reset.less +0 -0
- /package/lib/{css/components → components/activity-indicator}/activity-indicator.less +0 -0
- /package/lib/{css/components/anchors.less → components/anchor/anchor.less} +0 -0
- /package/lib/{css/components/avatars.less → components/avatar/avatar.less} +0 -0
- /package/lib/{css/components → components/award-bling}/award-bling.less +0 -0
- /package/lib/{css/components/badges.less → components/badge/badge.less} +0 -0
- /package/lib/{css/components → components/block-link}/block-link.less +0 -0
- /package/lib/{css/components → components/breadcrumbs}/breadcrumbs.less +0 -0
- /package/lib/{css/components/button-groups.less → components/button-group/button-group.less} +0 -0
- /package/lib/{css/components/checkboxes-radios.less → components/checkbox_radio/checkbox_radio.less} +0 -0
- /package/lib/{css/components/code-blocks.less → components/code-block/code-block.less} +0 -0
- /package/lib/{css/components → components/description}/description.less +0 -0
- /package/lib/{css/components/empty-states.less → components/empty-state/empty-state.less} +0 -0
- /package/lib/{css/components/labels.less → components/label/label.less} +0 -0
- /package/lib/{css/components/link-previews.less → components/link-preview/link-preview.less} +0 -0
- /package/lib/{css/components → components/menu}/menu.less +0 -0
- /package/lib/{css/components/modals.less → components/modal/modal.less} +0 -0
- /package/lib/{css/components → components/navigation}/navigation.less +0 -0
- /package/lib/{css/components/page-titles.less → components/page-title/page-title.less} +0 -0
- /package/lib/{css/components → components/pagination}/pagination.less +0 -0
- /package/lib/{css/components → components/post-summary}/post-summary.less +0 -0
- /package/lib/{css/components/progress-bars.less → components/progress-bar/progress-bar.less} +0 -0
- /package/lib/{css/components → components/prose}/prose.less +0 -0
- /package/lib/{css/components → components/select}/select.less +0 -0
- /package/lib/{css/components → components/spinner}/spinner.less +0 -0
- /package/lib/{css/components/tags.less → components/tag/tag.less} +0 -0
- /package/lib/{css/components/toggle-switches.less → components/toggle-switch/toggle-switch.less} +0 -0
- /package/lib/{css/components → components/topbar}/topbar.less +0 -0
- /package/lib/{css/components → components/uploader}/uploader.less +0 -0
- /package/lib/{css/components/user-cards.less → components/user-card/user-card.less} +0 -0
- /package/lib/{css/exports → exports}/constants-colors.less +0 -0
- /package/lib/{css/exports → exports}/constants-helpers.less +0 -0
- /package/lib/{css/exports → exports}/constants-type.less +0 -0
- /package/lib/{css/exports → exports}/exports.less +0 -0
- /package/lib/{css/exports → exports}/mixins.less +0 -0
- /package/lib/{css/input-utils.less → input-utils.less} +0 -0
- /package/lib/{css/stacks.less → stacks.less} +0 -0
- /package/lib/{ts/stacks.ts → stacks.ts} +0 -0
package/dist/js/stacks.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Stacks=t():e.Stacks=t()}(globalThis,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BannerController:()=>de,BasePopoverController:()=>Lt,ExpandableController:()=>oe,ModalController:()=>ae,PopoverController:()=>Mt,StacksApplication:()=>Z,StacksController:()=>Q,TabListController:()=>ye,TableController:()=>$t,ToastController:()=>me,TooltipController:()=>Pt,UploaderController:()=>_t,addController:()=>te,application:()=>G,attachPopover:()=>Ft,createController:()=>ee,detachPopover:()=>Bt,hideBanner:()=>pe,hideModal:()=>ce,hidePopover:()=>St,hideToast:()=>ve,setTooltipHtml:()=>Vt,setTooltipText:()=>Kt,showBanner:()=>ue,showModal:()=>le,showPopover:()=>Dt,showToast:()=>ge});class n{constructor(e,t,n){this.eventTarget=e,this.eventName=t,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=function(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((e,t)=>{const n=e.index,i=t.index;return n<i?-1:n>i?1:0}))}}class i{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((e=>e.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((e=>e.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((e,t)=>e.concat(Array.from(t.values()))),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,n={}){this.application.handleError(e,`Error ${t}`,n)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:n,eventOptions:i}=e,s=this.fetchEventListenerMapForEventTarget(t),r=this.cacheKey(n,i);s.delete(r),0==s.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:n,eventOptions:i}=e;return this.fetchEventListener(t,n,i)}fetchEventListener(e,t,n){const i=this.fetchEventListenerMapForEventTarget(e),s=this.cacheKey(t,n);let r=i.get(s);return r||(r=this.createEventListener(e,t,n),i.set(s,r)),r}createEventListener(e,t,i){const s=new n(e,t,i);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const n=[e];return Object.keys(t).sort().forEach((e=>{n.push(`${t[e]?"":"!"}${e}`)})),n.join(":")}}const s={stop:({event:e,value:t})=>(t&&e.stopPropagation(),!0),prevent:({event:e,value:t})=>(t&&e.preventDefault(),!0),self:({event:e,value:t,element:n})=>!t||n===e.target},r=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function o(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function a(e){return o(e.replace(/--/g,"-").replace(/__/g,"_"))}function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}const h={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function d(e){throw new Error(e)}function u(e){try{return JSON.parse(e)}catch(t){return e}}class p{constructor(e,t){this.context=e,this.action=t}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(e){this.willBeInvokedByEvent(e)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){const{element:t}=this.action,{actionDescriptorFilters:n}=this.context.application;let i=!0;for(const[s,r]of Object.entries(this.eventOptions))if(s in n){const o=n[s];i=i&&o({name:s,value:r,event:e,element:t})}return i}invokeWithEvent(e){const{target:t,currentTarget:n}=e;try{const{params:i}=this.action,s=Object.assign(e,{params:i});this.method.call(this.controller,s),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:n,action:this.methodName})}catch(t){const{identifier:n,controller:i,element:s,index:r}=this,o={identifier:n,controller:i,element:s,index:r,event:e};this.context.handleError(t,`invoking action "${this.action}"`,o)}}willBeInvokedByEvent(e){const t=e.target;return!(e instanceof KeyboardEvent&&this.action.isFilterTarget(e))&&(this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):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 f{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),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 e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){const n=e;this.elements.has(n)?this.delegate.elementAttributeChanged&&this.matchElement(n)?this.delegate.elementAttributeChanged(n,t):this.removeElement(n):this.matchElement(n)&&this.addElement(n)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const n of this.matchElementsInTree(e))t.call(this,n)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}}class m{constructor(e,t,n){this.attributeName=t,this.delegate=n,this.elementObserver=new f(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return t.concat(n)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}function g(e,t){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n}class v{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e.concat(Array.from(t))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e+t.size),0)}add(e,t){!function(e,t,n){g(e,t).add(n)}(this.valuesByKey,e,t)}delete(e,t){!function(e,t,n){g(e,t).delete(n),function(e,t){const n=e.get(t);null!=n&&0==n.size&&e.delete(t)}(e,t)}(this.valuesByKey,e,t)}has(e,t){const n=this.valuesByKey.get(e);return null!=n&&n.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some((t=>t.has(e)))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter((([t,n])=>n.has(e))).map((([e,t])=>e))}}class b{constructor(e,t,n,i={}){this.selector=t,this.details=i,this.elementObserver=new f(e,this),this.delegate=n,this.matchesByElement=new v}get started(){return this.elementObserver.started}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){const t=e.matches(this.selector);return this.delegate.selectorMatchElement?t&&this.delegate.selectorMatchElement(e,this.details):t}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector)).filter((e=>this.matchElement(e)));return t.concat(n)}elementMatched(e){this.selectorMatched(e)}elementUnmatched(e){this.selectorUnmatched(e)}elementAttributeChanged(e,t){const n=this.matchElement(e),i=this.matchesByElement.has(this.selector,e);!n&&i&&this.selectorUnmatched(e)}selectorMatched(e){this.delegate.selectorMatched&&(this.delegate.selectorMatched(e,this.selector,this.details),this.matchesByElement.add(this.selector,e))}selectorUnmatched(e){this.delegate.selectorUnmatched(e,this.selector,this.details),this.matchesByElement.delete(this.selector,e)}}class y{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}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 e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const n=this.delegate.getStringMapKeyForAttribute(e);if(null!=n){this.stringMap.has(e)||this.stringMapKeyAdded(n,e);const i=this.element.getAttribute(e);if(this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,n,t),null==i){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(n,e,t)}else this.stringMap.set(e,i)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,n)}stringMapKeyRemoved(e,t,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((e=>e.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class E{constructor(e,t,n){this.attributeObserver=new m(e,t,this),this.delegate=n,this.tokensByElement=new v}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,n]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(n)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach((e=>this.tokenMatched(e)))}tokensUnmatched(e){e.forEach((e=>this.tokenUnmatched(e)))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),i=function(e,t){const n=Math.max(e.length,t.length);return Array.from({length:n},((n,i)=>[e[i],t[i]]))}(t,n).findIndex((([e,t])=>!function(e,t){return e&&t&&e.index==t.index&&e.content==t.content}(e,t)));return-1==i?[[],[]]:[t.slice(i),n.slice(i)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,n){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,i)=>({element:t,attributeName:n,content:e,index:i})))}(e.getAttribute(t)||"",e,t)}}class w{constructor(e,t,n){this.tokenListObserver=new E(e,t,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).set(e,n),this.delegate.elementMatchedValue(t,n))}tokenUnmatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,n))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(e){return{error:e}}}}class O{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new w(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new p(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach((e=>this.delegate.bindingDisconnected(e,!0))),this.bindingsByAction.clear()}parseValueForToken(e){const t=class{constructor(e,t,n,i){this.element=e,this.index=t,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||function(e){const t=e.tagName.toLowerCase();if(t in h)return h[t](e)}(e)||d("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||d("missing identifier"),this.methodName=n.methodName||d("missing method name"),this.keyFilter=n.keyFilter||"",this.schema=i}static forToken(e,t){return new this(e.element,e.index,function(e){const t=e.trim().match(r)||[];let n=t[1],i=t[2];return i&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${i}`,i=""),{eventTarget:(s=t[3],"window"==s?window:"document"==s?document:void 0),eventName:n,eventOptions:t[6]?(o=t[6],o.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})):{},identifier:t[4],methodName:t[5],keyFilter:i};var s,o}(e.content),t)}toString(){const e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}isFilterTarget(e){if(!this.keyFilter)return!1;const t=this.keyFilter.split("+"),n=["meta","ctrl","alt","shift"],[i,s,r,o]=n.map((e=>t.includes(e)));if(e.metaKey!==i||e.ctrlKey!==s||e.altKey!==r||e.shiftKey!==o)return!0;const a=t.filter((e=>!n.includes(e)))[0];return!!a&&(Object.prototype.hasOwnProperty.call(this.keyMappings,a)||d(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[a].toLowerCase()!==e.key.toLowerCase())}get params(){const e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:n,value:i}of Array.from(this.element.attributes)){const s=n.match(t),r=s&&s[1];r&&(e[o(r)]=u(i))}return e}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}get keyMappings(){return this.schema.keyMappings}}.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class A{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new y(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const n=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,n.writer(this.receiver[e]),n.writer(n.defaultValue))}stringMapValueChanged(e,t,n){const i=this.valueDescriptorNameMap[t];null!==e&&(null===n&&(n=i.writer(i.defaultValue)),this.invokeChangedCallback(t,e,n))}stringMapKeyRemoved(e,t,n){const i=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,i.writer(this.receiver[e]),n):this.invokeChangedCallback(e,i.writer(i.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:n,writer:i}of this.valueDescriptors)null==n||this.controller.data.has(e)||this.invokeChangedCallback(t,i(n),void 0)}invokeChangedCallback(e,t,n){const i=`${e}Changed`,s=this.receiver[i];if("function"==typeof s){const i=this.valueDescriptorNameMap[e];try{const e=i.reader(t);let r=n;n&&(r=i.reader(n)),s.call(this.receiver,e,r)}catch(e){throw e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${i.name}" - ${e.message}`),e}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map((t=>e[t]))}get valueDescriptorNameMap(){const e={};return Object.keys(this.valueDescriptorMap).forEach((t=>{const n=this.valueDescriptorMap[t];e[n.name]=n})),e}hasValue(e){const t=`has${l(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class T{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new v}start(){this.tokenListObserver||(this.tokenListObserver=new E(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var n;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetConnected(e,t))))}disconnectTarget(e,t){var n;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetDisconnected(e,t))))}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function x(e,t){const n=k(e);return Array.from(n.reduce(((e,n)=>(function(e,t){const n=e[t];return Array.isArray(n)?n:[]}(n,t).forEach((t=>e.add(t))),e)),new Set))}function k(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}class C{constructor(e,t){this.context=e,this.delegate=t,this.outletsByName=new v,this.outletElementsByName=new v,this.selectorObserverMap=new Map}start(){0===this.selectorObserverMap.size&&(this.outletDefinitions.forEach((e=>{const t=this.selector(e),n={outletName:e};t&&this.selectorObserverMap.set(e,new b(document.body,t,this,n))})),this.selectorObserverMap.forEach((e=>e.start()))),this.dependentContexts.forEach((e=>e.refresh()))}stop(){this.selectorObserverMap.size>0&&(this.disconnectAllOutlets(),this.selectorObserverMap.forEach((e=>e.stop())),this.selectorObserverMap.clear())}refresh(){this.selectorObserverMap.forEach((e=>e.refresh()))}selectorMatched(e,t,{outletName:n}){const i=this.getOutlet(e,n);i&&this.connectOutlet(i,e,n)}selectorUnmatched(e,t,{outletName:n}){const i=this.getOutletFromMap(e,n);i&&this.disconnectOutlet(i,e,n)}selectorMatchElement(e,{outletName:t}){return this.hasOutlet(e,t)&&e.matches(`[${this.context.application.schema.controllerAttribute}~=${t}]`)}connectOutlet(e,t,n){var i;this.outletElementsByName.has(n,t)||(this.outletsByName.add(n,e),this.outletElementsByName.add(n,t),null===(i=this.selectorObserverMap.get(n))||void 0===i||i.pause((()=>this.delegate.outletConnected(e,t,n))))}disconnectOutlet(e,t,n){var i;this.outletElementsByName.has(n,t)&&(this.outletsByName.delete(n,e),this.outletElementsByName.delete(n,t),null===(i=this.selectorObserverMap.get(n))||void 0===i||i.pause((()=>this.delegate.outletDisconnected(e,t,n))))}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const n of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(n,t,e)}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}get outletDependencies(){const e=new v;return this.router.modules.forEach((t=>{x(t.definition.controllerConstructor,"outlets").forEach((n=>e.add(n,t.identifier)))})),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const e=this.dependentControllerIdentifiers;return this.router.contexts.filter((t=>e.includes(t.identifier)))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find((t=>t.element===e))}get scope(){return this.context.scope}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class L{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:n,controller:i,element:s}=this;t=Object.assign({identifier:n,controller:i,element:s},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new O(this,this.dispatcher),this.valueObserver=new A(this,this.controller),this.targetObserver=new T(this,this),this.outletObserver=new C(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"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(e,t,n={}){const{identifier:i,controller:s,element:r}=this;n=Object.assign({identifier:i,controller:s,element:r},n),this.application.handleError(e,`Error ${t}`,n)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,n){this.invokeControllerMethod(`${a(n)}OutletConnected`,e,t)}outletDisconnected(e,t,n){this.invokeControllerMethod(`${a(n)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const n=this.controller;"function"==typeof n[e]&&n[e](...t)}}const M="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,D=(()=>{function e(e){function t(){return Reflect.construct(e,arguments,new.target)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return function(){const t=e((function(){this.a.call(this)}));t.prototype.a=function(){},new t}(),e}catch(e){return e=>class extends e{}}})();class S{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:(t=e.controllerConstructor,function(e,t){const n=D(e),i=function(e,t){return M(t).reduce(((n,i)=>{const s=function(e,t,n){const i=Object.getOwnPropertyDescriptor(e,n);if(!i||!("value"in i)){const e=Object.getOwnPropertyDescriptor(t,n).value;return i&&(e.get=i.get||e.get,e.set=i.set||e.set),e}}(e,t,i);return s&&Object.assign(n,{[i]:s}),n}),{})}(e.prototype,t);return Object.defineProperties(n.prototype,i),n}(t,function(e){return x(e,"blessings").reduce(((t,n)=>{const i=n(e);for(const e in i){const n=t[e]||{};t[e]=Object.assign(n,i[e])}return t}),{})}(t)))};var t}(t),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(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new L(this,e),this.contextsByScope.set(e,t)),t}}class F{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){return(this.data.get(this.getDataKey(e))||"").match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class B{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,t),this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${c(e)}`}}class N{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,n){let i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(n,e))}}function j(e,t){return`[${e}~="${t}"]`}class ${constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)]),[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){return j(this.schema.targetAttributeForScope(this.identifier),e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map((t=>this.deprecate(t,e)))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return j(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:n}=this,i=this.schema.targetAttribute,s=this.schema.targetAttributeForScope(n);this.guide.warn(e,`target:${t}`,`Please replace ${i}="${n}.${t}" with ${s}="${t}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class I{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findOutlet(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllOutlets(t)]),[])}getSelectorForOutletName(e){const t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){const t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){const t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter((n=>this.matchesElement(n,e,t)))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter((n=>this.matchesElement(n,e,t)))}matchesElement(e,t,n){const i=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&i.split(" ").includes(n)}}class P{constructor(e,t,n,i){this.targets=new $(this),this.classes=new F(this),this.data=new B(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=n,this.guide=new N(i),this.outlets=new I(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return j(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new P(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class V{constructor(e,t,n){this.element=e,this.schema=t,this.delegate=n,this.valueListObserver=new w(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:n}=e,i=this.fetchScopesByIdentifierForElement(t);let s=i.get(n);return s||(s=this.delegate.createScopeForElementAndIdentifier(t,n),i.set(n,s)),s}elementMatchedValue(e,t){const n=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,n),1==n&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const n=this.scopeReferenceCounts.get(t);n&&(this.scopeReferenceCounts.set(t,n-1),1==n&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class K{constructor(e){this.application=e,this.scopeObserver=new V(this.element,this.schema,this),this.scopesByIdentifier=new v,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((e,t)=>e.concat(t.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new S(this.application,e);this.connectModule(t);const n=e.controllerConstructor.afterLoad;n&&n(e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const n=this.modulesByIdentifier.get(t);if(n)return n.contexts.find((t=>t.element==e))}handleError(e,t,n){this.application.handleError(e,t,n)}createScopeForElementAndIdentifier(e,t){return new P(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.connectContextForScope(t)))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.disconnectContextForScope(t)))}}const H={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`,outletAttributeForScope:(e,t)=>`data-${e}-${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"},_("abcdefghijklmnopqrstuvwxyz".split("").map((e=>[e,e])))),_("0123456789".split("").map((e=>[e,e]))))};function _(e){return e.reduce(((e,[t,n])=>Object.assign(Object.assign({},e),{[t]:n})),{})}function R([e,t],n){return function(e){const t=`${c(e.token)}-value`,n=function(e){const t=function(e){const t=U(e.typeObject.type);if(!t)return;const n=W(e.typeObject.default);if(t!==n){throw new Error(`The specified default value for the Stimulus Value "${e.controller?`${e.controller}.${e.token}`:e.token}" must match the defined type "${t}". The provided default value of "${e.typeObject.default}" is of type "${n}".`)}return t}({controller:e.controller,token:e.token,typeObject:e.typeDefinition}),n=W(e.typeDefinition),i=U(e.typeDefinition),s=t||n||i;if(s)return s;throw new Error(`Unknown value type "${e.controller?`${e.controller}.${e.typeDefinition}`:e.token}" for "${e.token}" value`)}(e);return{type:n,key:t,name:o(t),get defaultValue(){return function(e){const t=U(e);if(t)return q[t];const n=e.default;return void 0!==n?n:e}(e.typeDefinition)},get hasCustomDefaultValue(){return void 0!==W(e.typeDefinition)},reader:z[n],writer:J[n]||J.default}}({controller:n,token:e,typeDefinition:t})}function U(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function W(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}const q={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},z={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${W(t)}"`);return t},boolean:e=>!("0"==e||"false"==String(e).toLowerCase()),number:e=>Number(e),object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${W(t)}"`);return t},string:e=>e},J={default:function(e){return`${e}`},array:X,object:X};function X(e){return JSON.stringify(e)}class Y{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}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(e,{target:t=this.element,detail:n={},prefix:i=this.identifier,bubbles:s=!0,cancelable:r=!0}={}){const o=new CustomEvent(i?`${i}:${e}`:e,{detail:n,bubbles:s,cancelable:r});return t.dispatchEvent(o),o}}Y.blessings=[function(e){return x(e,"classes").reduce(((e,t)=>{return Object.assign(e,{[`${n=t}Class`]:{get(){const{classes:e}=this;if(e.has(n))return e.get(n);{const t=e.getAttributeName(n);throw new Error(`Missing attribute "${t}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${l(n)}Class`]:{get(){return this.classes.has(n)}}});var n}),{})},function(e){return x(e,"targets").reduce(((e,t)=>{return Object.assign(e,{[`${n=t}Target`]:{get(){const e=this.targets.find(n);if(e)return e;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${l(n)}Target`]:{get(){return this.targets.has(n)}}});var n}),{})},function(e){const t=function(e,t){return k(e).reduce(((e,n)=>(e.push(...function(e,t){const n=e[t];return n?Object.keys(n).map((e=>[e,n[e]])):[]}(n,t)),e)),[])}(e,"values"),n={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const n=R(t,this.identifier),i=this.data.getAttributeNameForKey(n.key);return Object.assign(e,{[i]:n})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,function(e,t){const n=R(e,void 0),{key:i,name:s,reader:r,writer:o}=n;return{[s]:{get(){const e=this.data.get(i);return null!==e?r(e):n.defaultValue},set(e){void 0===e?this.data.delete(i):this.data.set(i,o(e))}},[`has${l(s)}`]:{get(){return this.data.has(i)||n.hasCustomDefaultValue}}}}(t))),n)},function(e){return x(e,"outlets").reduce(((e,t)=>Object.assign(e,function(e){const t=a(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e);if(t){const n=this.application.getControllerForElementAndIdentifier(t,e);if(n)return n;throw new Error(`Missing "data-controller=${e}" attribute on outlet element for "${this.identifier}" controller`)}throw new Error(`Missing outlet element "${e}" for "${this.identifier}" controller`)}},[`${t}Outlets`]:{get(){const t=this.outlets.findAll(e);return t.length>0?t.map((t=>{const n=this.application.getControllerForElementAndIdentifier(t,e);if(n)return n;console.warn(`The provided outlet element is missing the outlet controller "${e}" for "${this.identifier}"`,t)})).filter((e=>e)):[]}},[`${t}OutletElement`]:{get(){const t=this.outlets.find(e);if(t)return t;throw new Error(`Missing outlet element "${e}" for "${this.identifier}" controller`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(e)}},[`has${l(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}(t))),{})}],Y.targets=[],Y.outlets=[],Y.values={};class Z extends class{constructor(e=document.documentElement,t=H){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,n={})=>{this.debug&&this.logFormattedMessage(e,t,n)},this.element=e,this.schema=t,this.dispatcher=new i(this),this.router=new K(this),this.actionDescriptorFilters=Object.assign({},s)}static start(e,t){const n=new this(e,t);return n.start(),n}async start(){await new Promise((e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>e())):e()})),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(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)}))}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>this.router.unloadIdentifier(e)))}get controllers(){return this.router.contexts.map((e=>e.controller))}getControllerForElementAndIdentifier(e,t){const n=this.router.getContextForElementAndIdentifier(e,t);return n?n.controller:null}handleError(e,t,n){var i;this.logger.error("%s\n\n%o\n\n%o",t,e,n),null===(i=window.onerror)||void 0===i||i.call(window,t,"",0,0,e)}logFormattedMessage(e,t,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}}{load(e,...t){const n=Array.isArray(e)?e:[e,...t];for(const e of n){const t=/^s-/.test(e.identifier);if(Z._initializing&&!t)throw'Stacks-created Stimulus controller names must start with "s-".';if(!Z._initializing&&t)throw'The "s-" prefix on Stimulus controller names is reserved for Stacks-created controllers.'}super.load(n)}static start(e,t){const n=new Z(e,t);return n.start(),n}static finalize(){Z._initializing=!1}}Z._initializing=!0;const G=Z.start();class Q extends Y{getElementData(e,t){return e.getAttribute("data-"+this.identifier+"-"+t)}setElementData(e,t,n){e.setAttribute("data-"+this.identifier+"-"+t,n)}removeElementData(e,t){e.removeAttribute("data-"+this.identifier+"-"+t)}triggerEvent(e,t,n){const i=this.identifier+":"+e;let s;try{s=new CustomEvent(i,{bubbles:!0,cancelable:!0,detail:t})}catch(e){s=document.createEvent("CustomEvent"),s.initCustomEvent(i,!0,!0,t)}return(n||this.element).dispatchEvent(s),s}}function ee(e){var t,n;const i=e.hasOwnProperty("targets")?((n=class extends Q{}).targets=null!==(t=e.targets)&&void 0!==t?t:[],n):class extends Q{};for(const t in e){const n=e.hasOwnProperty(t)&&Object.getOwnPropertyDescriptor(e,t);"targets"!==t&&n&&Object.defineProperty(i.prototype,t,n)}return i}function te(e,t){G.register(e,ee(t))}const ne="s-expandable-control:radio-off";function ie(e){const t=e.target;t instanceof HTMLInputElement&&"INPUT"===t.nodeName&&"radio"===t.type&&document.querySelectorAll('input[type="radio"][name="'+t.name+'"]').forEach((function(t){if(t===e.target)return;let n;try{n=new Event(ne)}catch(e){n=document.createEvent("Event"),n.initEvent(ne,!0,!0)}t.dispatchEvent(n)}))}let se=0;function re(e){e?(se++,1===se&&document.body.addEventListener("change",ie)):(se--,0===se&&document.body.removeEventListener("change",ie))}class oe extends Q{constructor(){super(...arguments),this.lastKeydownClickTimestamp=0}initialize(){"INPUT"===this.element.nodeName&&["radio","checkbox"].indexOf(this.element.type)>=0?(this.isCollapsed=this._isCollapsedForCheckable.bind(this),this.events=["change",ne],this.isCheckable=!0,this.isRadio="radio"===this.element.type):(this.isCollapsed=this._isCollapsedForClickable.bind(this),this.events=["click","keydown"]),this.listener=this.listener.bind(this)}_isCollapsedForClickable(){const e=this.controlledExpandables;return e.length>0?!e.every((e=>e.classList.contains("is-expanded"))):"false"===this.element.getAttribute("aria-expanded")}_isCollapsedForCheckable(){return!this.element.checked}get controlledExpandables(){const e=this.element.getAttribute("aria-controls");if(!e)throw'[aria-controls="targetId1 ... targetIdN"] attribute required';const t=e.split(/\s+/g).map((e=>document.getElementById(e))).filter((e=>!!e));if(!t.length)throw"couldn't find controls";return t}_dispatchShowHideEvent(e){this.triggerEvent(e?"show":"hide")}_toggleClass(e){if(!this.data.has("toggle-class"))return;const t=this.element.classList,n=this.data.get("toggle-class");if(!n)throw"couldn't find toggle class";n.split(/\s+/).forEach((function(n){t.toggle(n,!!e)}))}listener(e){let t;if(this.isCheckable)t=!this.element.checked;else{if("keydown"==e.type&&e instanceof KeyboardEvent&&13!=e.keyCode&&32!=e.keyCode)return;if(e.target!==e.currentTarget&&["A","BUTTON"].indexOf(e.target.nodeName)>=0)return;if(e.preventDefault(),"keydown"==e.type)this.lastKeydownClickTimestamp=Date.now();else if("click"==e.type&&Date.now()-this.lastKeydownClickTimestamp<300)return;t="true"===this.element.getAttribute("aria-expanded"),"click"===e.type&&this.element.blur()}this.element.setAttribute("aria-expanded",t?"false":"true");for(const e of this.controlledExpandables)e.classList.toggle("is-expanded",!t);this._dispatchShowHideEvent(!t),this._toggleClass(!t)}connect(){if(this.events.forEach((e=>{this.element.addEventListener(e,this.listener.bind(this))}),this),this.isRadio&&re(!0),this.isRadio||this.element.setAttribute("aria-expanded",this.isCollapsed()?"false":"true"),this.isCheckable){const e=this.controlledExpandables;if(e.length){const t=!this.isCollapsed();if(e.some((e=>e.classList.contains("is-expanded")!==t))){for(const e of this.controlledExpandables)e.classList.toggle("is-expanded",t);this._dispatchShowHideEvent(t),this._toggleClass(t)}}}}disconnect(){this.events.forEach((e=>{this.element.removeEventListener(e,this.listener.bind(this))}),this),this.isRadio&&re(!1)}}class ae extends Q{connect(){this.validate()}disconnect(){this.unbindDocumentEvents()}toggle(e=null){this._toggle(void 0,e)}show(e=null){this._toggle(!0,e)}hide(e=null){this._toggle(!1,e)}validate(){const e=this.data.get("return-element");if(e&&(this.returnElement=document.querySelector(e),!this.returnElement))throw"Unable to find element by return-element selector: "+e}_toggle(e,t=null){let n=e;const i="false"===this.modalTarget.getAttribute("aria-hidden");if(void 0===n&&(n=!i),n&&i||!n&&!i)return;const s=this.getDispatcher(t),r=this.triggerEvent(n?"show":"hide",{returnElement:this.returnElement,dispatcher:this.getDispatcher(s)},this.modalTarget);r.defaultPrevented||(this.returnElement=r.detail.returnElement,this.modalTarget.setAttribute("aria-hidden",n?"false":"true"),n?(this.bindDocumentEvents(),this.focusInsideModal()):(this.unbindDocumentEvents(),this.focusReturnElement(),this.removeModalOnHide()),void 0!==this.modalTarget.ontransitionend?this.modalTarget.addEventListener("transitionend",(()=>{this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.modalTarget)}),{once:!0}):this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.modalTarget))}focusReturnElement(){this.returnElement&&this.modalTarget.addEventListener("s-modal:hidden",(()=>{this.returnElement&&document.body.contains(this.returnElement)&&this.returnElement.focus()}),{once:!0})}removeModalOnHide(){"true"===this.data.get("remove-when-hidden")&&this.modalTarget.addEventListener("s-modal:hidden",(()=>{this.element.remove()}),{once:!0})}getAllTabbables(){return Array.from(this.modalTarget.querySelectorAll("[href], input, select, textarea, button, [tabindex]")).filter((e=>e.matches(":not([disabled]):not([tabindex='-1'])")))}firstVisible(e){return e.find((e=>null!==e.offsetParent))}lastVisible(e){return this.firstVisible([...e].reverse())}focusInsideModal(){this.modalTarget.addEventListener("s-modal:shown",(()=>{var e;const t=null!==(e=this.firstVisible(this.initialFocusTargets))&&void 0!==e?e:this.firstVisible(this.getAllTabbables());null==t||t.focus()}),{once:!0})}keepFocusWithinModal(e){if(this.modalTarget.contains(e.target)){if("Tab"===e.key){const t=this.getAllTabbables(),n=this.firstVisible(t),i=this.lastVisible(t);n&&i&&(n===i?(e.preventDefault(),n.focus()):e.shiftKey&&e.target===n?(e.preventDefault(),i.focus()):e.shiftKey||e.target!==i||(e.preventDefault(),n.focus()))}}else{const t=this.firstVisible(this.getAllTabbables());t&&(e.preventDefault(),t.focus())}}bindDocumentEvents(){this._boundClickFn=this._boundClickFn||this.hideOnOutsideClick.bind(this),this._boundKeypressFn=this._boundKeypressFn||this.hideOnEscapePress.bind(this),this._boundTabTrap=this._boundTabTrap||this.keepFocusWithinModal.bind(this),document.addEventListener("mousedown",this._boundClickFn),document.addEventListener("keyup",this._boundKeypressFn),document.addEventListener("keydown",this._boundTabTrap)}unbindDocumentEvents(){document.removeEventListener("mousedown",this._boundClickFn),document.removeEventListener("keyup",this._boundKeypressFn),document.removeEventListener("keydown",this._boundTabTrap)}hideOnOutsideClick(e){var t;const n=e.target;!(null===(t=this.modalTarget.querySelector(".s-modal--dialog"))||void 0===t?void 0:t.contains(n))&&document.body.contains(n)&&this._toggle(!1,e)}hideOnEscapePress(e){27===e.which&&"true"!==this.modalTarget.getAttribute("aria-hidden")&&this._toggle(!1,e)}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}}function le(e){he(e,!0)}function ce(e){he(e,!1)}function he(e,t){const n=G.getControllerForElementAndIdentifier(e,"s-modal");if(!n)throw"Unable to get s-modal controller from element";t?n.show():n.hide()}ae.targets=["modal","initialFocus"];class de extends Q{toggle(e=null){this._toggle(void 0,e)}show(e=null){this._toggle(!0,e)}hide(e=null){this._toggle(!1,e)}_toggle(e,t=null){let n=e;const i="false"===this.bannerTarget.getAttribute("aria-hidden");if(void 0===n&&(n=!i),n&&i||!n&&!i)return;const s=this.getDispatcher(t);this.triggerEvent(n?"show":"hide",{dispatcher:this.getDispatcher(s)},this.bannerTarget).defaultPrevented||(this.bannerTarget.setAttribute("aria-hidden",n?"false":"true"),n||this.removeBannerOnHide(),this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.bannerTarget))}removeBannerOnHide(){"true"===this.data.get("remove-when-hidden")&&this.bannerTarget.addEventListener("s-banner:hidden",(()=>{this.element.remove()}),{once:!0})}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}}function ue(e){fe(e,!0)}function pe(e){fe(e,!1)}function fe(e,t){const n=G.getControllerForElementAndIdentifier(e,"s-banner");if(!n)throw"Unable to get s-banner controller from element";t?n.show():n.hide()}de.targets=["banner"];class me extends Q{connect(){this.validate()}disconnect(){this.unbindDocumentEvents()}toggle(e=null){this._toggle(void 0,e)}show(e=null){this._toggle(!0,e)}hide(e=null){this._toggle(!1,e)}validate(){const e=this.data.get("return-element");if(e&&(this.returnElement=document.querySelector(e),!this.returnElement))throw"Unable to find element by return-element selector: "+e}_toggle(e,t=null){let n=e;const i="false"===this.toastTarget.getAttribute("aria-hidden");if(void 0===n&&(n=!i),n&&i||!n&&!i)return;const s=this.getDispatcher(t),r=this.triggerEvent(n?"show":"hide",{returnElement:this.returnElement,dispatcher:this.getDispatcher(s)},this.toastTarget);r.defaultPrevented||(this.returnElement=r.detail.returnElement,this.toastTarget.setAttribute("aria-hidden",n?"false":"true"),n?(this.bindDocumentEvents(),this.hideAfterTimeout(),"true"!==this.data.get("prevent-focus-capture")&&this.focusInsideToast()):(this.unbindDocumentEvents(),this.focusReturnElement(),this.removeToastOnHide(),this.clearActiveTimeout()),void 0!==this.toastTarget.ontransitionend?this.toastTarget.addEventListener("transitionend",(()=>{this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.toastTarget)}),{once:!0}):this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.toastTarget))}focusReturnElement(){this.returnElement&&this.toastTarget.addEventListener("s-toast:hidden",(()=>{this.returnElement&&document.body.contains(this.returnElement)&&this.returnElement.focus()}),{once:!0})}removeToastOnHide(){"true"===this.data.get("remove-when-hidden")&&this.toastTarget.addEventListener("s-toast:hidden",(()=>{this.element.remove()}),{once:!0})}hideAfterTimeout(){if("true"===this.data.get("prevent-auto-hide")||"0"===this.data.get("hide-after-timeout"))return;const e=parseInt(this.data.get("hide-after-timeout"),10)||3e3;this.activeTimeout=window.setTimeout((()=>this.hide()),e)}clearActiveTimeout(){clearTimeout(this.activeTimeout)}getAllTabbables(){return Array.from(this.toastTarget.querySelectorAll("[href], input, select, textarea, button, [tabindex]")).filter((e=>e.matches(":not([disabled]):not([tabindex='-1'])")))}firstVisible(e){return null==e?void 0:e.find((e=>null!==e.offsetParent))}focusInsideToast(){this.toastTarget.addEventListener("s-toast:shown",(()=>{var e;const t=null!==(e=this.firstVisible(this.initialFocusTargets))&&void 0!==e?e:this.firstVisible(this.getAllTabbables());null==t||t.focus()}),{once:!0})}bindDocumentEvents(){this._boundClickFn=this._boundClickFn||this.hideOnOutsideClick.bind(this),this._boundKeypressFn=this._boundKeypressFn||this.hideOnEscapePress.bind(this),document.addEventListener("mousedown",this._boundClickFn),document.addEventListener("keyup",this._boundKeypressFn)}unbindDocumentEvents(){document.removeEventListener("mousedown",this._boundClickFn),document.removeEventListener("keyup",this._boundKeypressFn)}hideOnOutsideClick(e){var t;const n=e.target;!(null===(t=this.toastTarget)||void 0===t?void 0:t.contains(n))&&document.body.contains(n)&&"false"!==this.data.get("hide-on-outside-click")&&this._toggle(!1,e)}hideOnEscapePress(e){27===e.which&&"true"!==this.toastTarget.getAttribute("aria-hidden")&&this._toggle(!1,e)}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}}function ge(e){be(e,!0)}function ve(e){be(e,!1)}function be(e,t){const n=G.getControllerForElementAndIdentifier(e,"s-toast");if(!n)throw"Unable to get s-toast controller from element";t?n.show():n.hide()}me.targets=["toast","initialFocus"];class ye extends Q{connect(){super.connect(),this.boundSelectTab=this.selectTab.bind(this),this.boundHandleKeydown=this.handleKeydown.bind(this);for(const e of this.tabTargets)e.addEventListener("click",this.boundSelectTab),e.addEventListener("keydown",this.boundHandleKeydown)}disconnect(){super.disconnect();for(const e of this.tabTargets)e.removeEventListener("click",this.boundSelectTab),e.removeEventListener("keydown",this.boundHandleKeydown)}get tabTargets(){return Array.from(this.element.querySelectorAll("[role=tab]"))}selectTab(e){this.switchToTab(e.currentTarget)}handleKeydown(e){var t;let n=e.currentTarget;const i=this.tabTargets;let s=i.indexOf(n);if("ArrowRight"===e.key)s++;else{if("ArrowLeft"!==e.key)return;s--}s<0&&(s=i.length-1),s>=i.length&&(s=0),n=i[s],this.switchToTab(n),null===(t=this.selectedTab)||void 0===t||t.focus()}switchToTab(e){const t=this.selectedTab;t!==e&&(this.triggerEvent("select",{oldTab:t,newTab:e}).defaultPrevented||(this.selectedTab=e,this.triggerEvent("selected",{oldTab:t,newTab:e})))}get selectedTab(){return this.tabTargets.find((e=>"true"===e.getAttribute("aria-selected")))||null}set selectedTab(e){for(const t of this.tabTargets){const n=t.getAttribute("aria-controls"),i=n?document.getElementById(n):null;t===e?(t.classList.add("is-selected"),t.setAttribute("aria-selected","true"),t.removeAttribute("tabindex"),null==i||i.classList.remove("d-none")):(t.classList.remove("is-selected"),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1"),null==i||i.classList.add("d-none"))}}}function Ee(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function we(e){return e instanceof Ee(e).Element||e instanceof Element}function Oe(e){return e instanceof Ee(e).HTMLElement||e instanceof HTMLElement}function Ae(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Ee(e).ShadowRoot||e instanceof ShadowRoot)}var Te=Math.max,xe=Math.min,ke=Math.round;function Ce(){var e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function Le(){return!/^((?!chrome|android).)*safari/i.test(Ce())}function Me(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var i=e.getBoundingClientRect(),s=1,r=1;t&&Oe(e)&&(s=e.offsetWidth>0&&ke(i.width)/e.offsetWidth||1,r=e.offsetHeight>0&&ke(i.height)/e.offsetHeight||1);var o=(we(e)?Ee(e):window).visualViewport,a=!Le()&&n,l=(i.left+(a&&o?o.offsetLeft:0))/s,c=(i.top+(a&&o?o.offsetTop:0))/r,h=i.width/s,d=i.height/r;return{width:h,height:d,top:c,right:l+h,bottom:c+d,left:l,x:l,y:c}}function De(e){var t=Ee(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Se(e){return e?(e.nodeName||"").toLowerCase():null}function Fe(e){return((we(e)?e.ownerDocument:e.document)||window.document).documentElement}function Be(e){return Me(Fe(e)).left+De(e).scrollLeft}function Ne(e){return Ee(e).getComputedStyle(e)}function je(e){var t=Ne(e),n=t.overflow,i=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+i)}function $e(e,t,n){void 0===n&&(n=!1);var i,s,r=Oe(t),o=Oe(t)&&function(e){var t=e.getBoundingClientRect(),n=ke(t.width)/e.offsetWidth||1,i=ke(t.height)/e.offsetHeight||1;return 1!==n||1!==i}(t),a=Fe(t),l=Me(e,o,n),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(r||!r&&!n)&&(("body"!==Se(t)||je(a))&&(c=(i=t)!==Ee(i)&&Oe(i)?{scrollLeft:(s=i).scrollLeft,scrollTop:s.scrollTop}:De(i)),Oe(t)?((h=Me(t,!0)).x+=t.clientLeft,h.y+=t.clientTop):a&&(h.x=Be(a))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function Ie(e){var t=Me(e),n=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:i}}function Pe(e){return"html"===Se(e)?e:e.assignedSlot||e.parentNode||(Ae(e)?e.host:null)||Fe(e)}function Ve(e){return["html","body","#document"].indexOf(Se(e))>=0?e.ownerDocument.body:Oe(e)&&je(e)?e:Ve(Pe(e))}function Ke(e,t){var n;void 0===t&&(t=[]);var i=Ve(e),s=i===(null==(n=e.ownerDocument)?void 0:n.body),r=Ee(i),o=s?[r].concat(r.visualViewport||[],je(i)?i:[]):i,a=t.concat(o);return s?a:a.concat(Ke(Pe(o)))}function He(e){return["table","td","th"].indexOf(Se(e))>=0}function _e(e){return Oe(e)&&"fixed"!==Ne(e).position?e.offsetParent:null}function Re(e){for(var t=Ee(e),n=_e(e);n&&He(n)&&"static"===Ne(n).position;)n=_e(n);return n&&("html"===Se(n)||"body"===Se(n)&&"static"===Ne(n).position)?t:n||function(e){var t=/firefox/i.test(Ce());if(/Trident/i.test(Ce())&&Oe(e)&&"fixed"===Ne(e).position)return null;var n=Pe(e);for(Ae(n)&&(n=n.host);Oe(n)&&["html","body"].indexOf(Se(n))<0;){var i=Ne(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||t}var Ue="top",We="bottom",qe="right",ze="left",Je="auto",Xe=[Ue,We,qe,ze],Ye="start",Ze="end",Ge="viewport",Qe="popper",et=Xe.reduce((function(e,t){return e.concat([t+"-"+Ye,t+"-"+Ze])}),[]),tt=[].concat(Xe,[Je]).reduce((function(e,t){return e.concat([t,t+"-"+Ye,t+"-"+Ze])}),[]),nt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function it(e){var t=new Map,n=new Set,i=[];function s(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var i=t.get(e);i&&s(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||s(e)})),i}var st={placement:"bottom",modifiers:[],strategy:"absolute"};function rt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function ot(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,i=void 0===n?[]:n,s=t.defaultOptions,r=void 0===s?st:s;return function(e,t,n){void 0===n&&(n=r);var s,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},st,r),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,h={state:a,setOptions:function(n){var s="function"==typeof n?n(a.options):n;d(),a.options=Object.assign({},r,a.options,s),a.scrollParents={reference:we(e)?Ke(e):e.contextElement?Ke(e.contextElement):[],popper:Ke(t)};var o,c,u=function(e){var t=it(e);return nt.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((o=[].concat(i,a.options.modifiers),c=o.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{}),Object.keys(c).map((function(e){return c[e]}))));return a.orderedModifiers=u.filter((function(e){return e.enabled})),a.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,i=void 0===n?{}:n,s=e.effect;if("function"==typeof s){var r=s({state:a,name:t,instance:h,options:i});l.push(r||function(){})}})),h.update()},forceUpdate:function(){if(!c){var e=a.elements,t=e.reference,n=e.popper;if(rt(t,n)){a.rects={reference:$e(t,Re(n),"fixed"===a.options.strategy),popper:Ie(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(e){return a.modifiersData[e.name]=Object.assign({},e.data)}));for(var i=0;i<a.orderedModifiers.length;i++)if(!0!==a.reset){var s=a.orderedModifiers[i],r=s.fn,o=s.options,l=void 0===o?{}:o,d=s.name;"function"==typeof r&&(a=r({state:a,options:l,name:d,instance:h})||a)}else a.reset=!1,i=-1}}},update:(s=function(){return new Promise((function(e){h.forceUpdate(),e(a)}))},function(){return o||(o=new Promise((function(e){Promise.resolve().then((function(){o=void 0,e(s())}))}))),o}),destroy:function(){d(),c=!0}};if(!rt(e,t))return h;function d(){l.forEach((function(e){return e()})),l=[]}return h.setOptions(n).then((function(e){!c&&n.onFirstUpdate&&n.onFirstUpdate(e)})),h}}var at={passive:!0};function lt(e){return e.split("-")[0]}function ct(e){return e.split("-")[1]}function ht(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function dt(e){var t,n=e.reference,i=e.element,s=e.placement,r=s?lt(s):null,o=s?ct(s):null,a=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2;switch(r){case Ue:t={x:a,y:n.y-i.height};break;case We:t={x:a,y:n.y+n.height};break;case qe:t={x:n.x+n.width,y:l};break;case ze:t={x:n.x-i.width,y:l};break;default:t={x:n.x,y:n.y}}var c=r?ht(r):null;if(null!=c){var h="y"===c?"height":"width";switch(o){case Ye:t[c]=t[c]-(n[h]/2-i[h]/2);break;case Ze:t[c]=t[c]+(n[h]/2-i[h]/2)}}return t}var ut={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pt(e){var t,n=e.popper,i=e.popperRect,s=e.placement,r=e.variation,o=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,d=e.isFixed,u=o.x,p=void 0===u?0:u,f=o.y,m=void 0===f?0:f,g="function"==typeof h?h({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=ze,E=Ue,w=window;if(c){var O=Re(n),A="clientHeight",T="clientWidth";O===Ee(n)&&"static"!==Ne(O=Fe(n)).position&&"absolute"===a&&(A="scrollHeight",T="scrollWidth"),(s===Ue||(s===ze||s===qe)&&r===Ze)&&(E=We,m-=(d&&O===w&&w.visualViewport?w.visualViewport.height:O[A])-i.height,m*=l?1:-1),s!==ze&&(s!==Ue&&s!==We||r!==Ze)||(y=qe,p-=(d&&O===w&&w.visualViewport?w.visualViewport.width:O[T])-i.width,p*=l?1:-1)}var x,k=Object.assign({position:a},c&&ut),C=!0===h?function(e){var t=e.x,n=e.y,i=window.devicePixelRatio||1;return{x:ke(t*i)/i||0,y:ke(n*i)/i||0}}({x:p,y:m}):{x:p,y:m};return p=C.x,m=C.y,l?Object.assign({},k,((x={})[E]=b?"0":"",x[y]=v?"0":"",x.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",x)):Object.assign({},k,((t={})[E]=b?m+"px":"",t[y]=v?p+"px":"",t.transform="",t))}var ft={left:"right",right:"left",bottom:"top",top:"bottom"};function mt(e){return e.replace(/left|right|bottom|top/g,(function(e){return ft[e]}))}var gt={start:"end",end:"start"};function vt(e){return e.replace(/start|end/g,(function(e){return gt[e]}))}function bt(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ae(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function yt(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Et(e,t,n){return t===Ge?yt(function(e,t){var n=Ee(e),i=Fe(e),s=n.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=Le();(c||!c&&"fixed"===t)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+Be(e),y:l}}(e,n)):we(t)?function(e,t){var n=Me(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):yt(function(e){var t,n=Fe(e),i=De(e),s=null==(t=e.ownerDocument)?void 0:t.body,r=Te(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Te(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+Be(e),l=-i.scrollTop;return"rtl"===Ne(s||n).direction&&(a+=Te(n.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Fe(e)))}function wt(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Ot(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function At(e,t){void 0===t&&(t={});var n=t,i=n.placement,s=void 0===i?e.placement:i,r=n.strategy,o=void 0===r?e.strategy:r,a=n.boundary,l=void 0===a?"clippingParents":a,c=n.rootBoundary,h=void 0===c?Ge:c,d=n.elementContext,u=void 0===d?Qe:d,p=n.altBoundary,f=void 0!==p&&p,m=n.padding,g=void 0===m?0:m,v=wt("number"!=typeof g?g:Ot(g,Xe)),b=u===Qe?"reference":Qe,y=e.rects.popper,E=e.elements[f?b:u],w=function(e,t,n,i){var s="clippingParents"===t?function(e){var t=Ke(Pe(e)),n=["absolute","fixed"].indexOf(Ne(e).position)>=0&&Oe(e)?Re(e):e;return we(n)?t.filter((function(e){return we(e)&&bt(e,n)&&"body"!==Se(e)})):[]}(e):[].concat(t),r=[].concat(s,[n]),o=r[0],a=r.reduce((function(t,n){var s=Et(e,n,i);return t.top=Te(s.top,t.top),t.right=xe(s.right,t.right),t.bottom=xe(s.bottom,t.bottom),t.left=Te(s.left,t.left),t}),Et(e,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(we(E)?E:E.contextElement||Fe(e.elements.popper),l,h,o),O=Me(e.elements.reference),A=dt({reference:O,element:y,strategy:"absolute",placement:s}),T=yt(Object.assign({},y,A)),x=u===Qe?T:O,k={top:w.top-x.top+v.top,bottom:x.bottom-w.bottom+v.bottom,left:w.left-x.left+v.left,right:x.right-w.right+v.right},C=e.modifiersData.offset;if(u===Qe&&C){var L=C[s];Object.keys(k).forEach((function(e){var t=[qe,We].indexOf(e)>=0?1:-1,n=[Ue,We].indexOf(e)>=0?"y":"x";k[e]+=L[n]*t}))}return k}function Tt(e,t,n){return Te(e,xe(t,n))}function xt(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kt(e){return[Ue,qe,We,ze].some((function(t){return e[t]>=0}))}var Ct=ot({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,i=e.options,s=i.scroll,r=void 0===s||s,o=i.resize,a=void 0===o||o,l=Ee(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&c.forEach((function(e){e.addEventListener("scroll",n.update,at)})),a&&l.addEventListener("resize",n.update,at),function(){r&&c.forEach((function(e){e.removeEventListener("scroll",n.update,at)})),a&&l.removeEventListener("resize",n.update,at)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=dt({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,i=n.gpuAcceleration,s=void 0===i||i,r=n.adaptive,o=void 0===r||r,a=n.roundOffsets,l=void 0===a||a,c={placement:lt(t.placement),variation:ct(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,pt(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,pt(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},i=t.attributes[e]||{},s=t.elements[e];Oe(s)&&Se(s)&&(Object.assign(s.style,n),Object.keys(i).forEach((function(e){var t=i[e];!1===t?s.removeAttribute(e):s.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],s=t.attributes[e]||{},r=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});Oe(i)&&Se(i)&&(Object.assign(i.style,r),Object.keys(s).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,i=e.name,s=n.offset,r=void 0===s?[0,0]:s,o=tt.reduce((function(e,n){return e[n]=function(e,t,n){var i=lt(e),s=[ze,Ue].indexOf(i)>=0?-1:1,r="function"==typeof n?n(Object.assign({},t,{placement:e})):n,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[ze,qe].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}(n,t.rects,r),e}),{}),a=o[t.placement],l=a.x,c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=o}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var s=n.mainAxis,r=void 0===s||s,o=n.altAxis,a=void 0===o||o,l=n.fallbackPlacements,c=n.padding,h=n.boundary,d=n.rootBoundary,u=n.altBoundary,p=n.flipVariations,f=void 0===p||p,m=n.allowedAutoPlacements,g=t.options.placement,v=lt(g),b=l||(v!==g&&f?function(e){if(lt(e)===Je)return[];var t=mt(e);return[vt(e),t,vt(t)]}(g):[mt(g)]),y=[g].concat(b).reduce((function(e,n){return e.concat(lt(n)===Je?function(e,t){void 0===t&&(t={});var n=t,i=n.placement,s=n.boundary,r=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?tt:l,h=ct(i),d=h?a?et:et.filter((function(e){return ct(e)===h})):Xe,u=d.filter((function(e){return c.indexOf(e)>=0}));0===u.length&&(u=d);var p=u.reduce((function(t,n){return t[n]=At(e,{placement:n,boundary:s,rootBoundary:r,padding:o})[lt(n)],t}),{});return Object.keys(p).sort((function(e,t){return p[e]-p[t]}))}(t,{placement:n,boundary:h,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:m}):n)}),[]),E=t.rects.reference,w=t.rects.popper,O=new Map,A=!0,T=y[0],x=0;x<y.length;x++){var k=y[x],C=lt(k),L=ct(k)===Ye,M=[Ue,We].indexOf(C)>=0,D=M?"width":"height",S=At(t,{placement:k,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),F=M?L?qe:ze:L?We:Ue;E[D]>w[D]&&(F=mt(F));var B=mt(F),N=[];if(r&&N.push(S[C]<=0),a&&N.push(S[F]<=0,S[B]<=0),N.every((function(e){return e}))){T=k,A=!1;break}O.set(k,N)}if(A)for(var j=function(e){var t=y.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return T=t,"break"},$=f?3:1;$>0&&"break"!==j($);$--);t.placement!==T&&(t.modifiersData[i]._skip=!0,t.placement=T,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name,s=n.mainAxis,r=void 0===s||s,o=n.altAxis,a=void 0!==o&&o,l=n.boundary,c=n.rootBoundary,h=n.altBoundary,d=n.padding,u=n.tether,p=void 0===u||u,f=n.tetherOffset,m=void 0===f?0:f,g=At(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),v=lt(t.placement),b=ct(t.placement),y=!b,E=ht(v),w="x"===E?"y":"x",O=t.modifiersData.popperOffsets,A=t.rects.reference,T=t.rects.popper,x="function"==typeof m?m(Object.assign({},t.rects,{placement:t.placement})):m,k="number"==typeof x?{mainAxis:x,altAxis:x}:Object.assign({mainAxis:0,altAxis:0},x),C=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(O){if(r){var M,D="y"===E?Ue:ze,S="y"===E?We:qe,F="y"===E?"height":"width",B=O[E],N=B+g[D],j=B-g[S],$=p?-T[F]/2:0,I=b===Ye?A[F]:T[F],P=b===Ye?-T[F]:-A[F],V=t.elements.arrow,K=p&&V?Ie(V):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},_=H[D],R=H[S],U=Tt(0,A[F],K[F]),W=y?A[F]/2-$-U-_-k.mainAxis:I-U-_-k.mainAxis,q=y?-A[F]/2+$+U+R+k.mainAxis:P+U+R+k.mainAxis,z=t.elements.arrow&&Re(t.elements.arrow),J=z?"y"===E?z.clientTop||0:z.clientLeft||0:0,X=null!=(M=null==C?void 0:C[E])?M:0,Y=B+q-X,Z=Tt(p?xe(N,B+W-X-J):N,B,p?Te(j,Y):j);O[E]=Z,L[E]=Z-B}if(a){var G,Q="x"===E?Ue:ze,ee="x"===E?We:qe,te=O[w],ne="y"===w?"height":"width",ie=te+g[Q],se=te-g[ee],re=-1!==[Ue,ze].indexOf(v),oe=null!=(G=null==C?void 0:C[w])?G:0,ae=re?ie:te-A[ne]-T[ne]-oe+k.altAxis,le=re?te+A[ne]+T[ne]-oe-k.altAxis:se,ce=p&&re?function(e,t,n){var i=Tt(e,t,n);return i>n?n:i}(ae,te,le):Tt(p?ae:ie,te,p?le:se);O[w]=ce,L[w]=ce-te}t.modifiersData[i]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,i=e.name,s=e.options,r=n.elements.arrow,o=n.modifiersData.popperOffsets,a=lt(n.placement),l=ht(a),c=[ze,qe].indexOf(a)>=0?"height":"width";if(r&&o){var h=function(e,t){return wt("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Ot(e,Xe))}(s.padding,n),d=Ie(r),u="y"===l?Ue:ze,p="y"===l?We:qe,f=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],m=o[l]-n.rects.reference[l],g=Re(r),v=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,b=f/2-m/2,y=h[u],E=v-d[c]-h[p],w=v/2-d[c]/2+b,O=Tt(y,w,E),A=l;n.modifiersData[i]=((t={})[A]=O,t.centerOffset=O-w,t)}},effect:function(e){var t=e.state,n=e.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&bt(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,i=t.rects.reference,s=t.rects.popper,r=t.modifiersData.preventOverflow,o=At(t,{elementContext:"reference"}),a=At(t,{altBoundary:!0}),l=xt(o,i),c=xt(a,s,r),h=kt(l),d=kt(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}}]});class Lt extends Q{get isVisible(){const e=this.popoverElement;return!!e&&e.classList.contains("is-visible")}get isInViewport(){const e=this.popoverElement;if(!this.isVisible||!e)return!1;const t=e.getBoundingClientRect(),n=Math.max(document.documentElement.clientHeight,window.innerHeight),i=Math.max(document.documentElement.clientWidth,window.innerWidth);return t.bottom>0&&t.top<n&&t.right>0&&t.left<i}get shouldHideOnOutsideClick(){switch(this.data.get("hide-on-outside-click")){case"after-dismissal":case"never":return!1;case"if-in-viewport":return this.isInViewport;default:return!0}}connect(){super.connect(),this.validate(),this.isVisible?this.initializePopper():"true"===this.data.get("auto-show")&&this.show(null),this.data.delete("auto-show")}disconnect(){this.hide(),this.popper&&(this.popper.destroy(),delete this.popper),super.disconnect()}toggle(e=null){this.isVisible?this.hide(e):this.show(e)}show(e=null){if(this.isVisible)return;const t=this.getDispatcher(e);this.triggerEvent("show",{dispatcher:t}).defaultPrevented||(this.popper||this.initializePopper(),this.popoverElement.classList.add("is-visible"),this.scheduleUpdate(),this.shown(t))}hide(e=null){if(!this.isVisible)return;const t=this.getDispatcher(e);this.triggerEvent("hide",{dispatcher:t}).defaultPrevented||(this.popoverElement.classList.remove("is-visible"),this.popper&&(this.popper.destroy(),delete this.popper),"after-dismissal"===this.data.get("hide-on-outside-click")&&this.data.delete("hide-on-outside-click"),this.hidden(t))}shown(e=null){this.bindDocumentEvents(),this.triggerEvent("shown",{dispatcher:e})}hidden(e=null){this.unbindDocumentEvents(),this.triggerEvent("hidden",{dispatcher:e})}generatePopover(){return null}initializePopper(){this.popper=Ct(this.referenceElement,this.popoverElement,{placement:this.data.get("placement")||"bottom",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"arrow",options:{element:".s-popover--arrow"}}]})}validate(){const e=this.data.get("reference-selector");if(this.referenceElement=this.element,e&&(this.referenceElement=this.element.querySelector(e),!this.referenceElement))throw"Unable to find element by reference selector: "+e;const t=this.referenceElement.getAttribute(this.popoverSelectorAttribute);let n=null;if(t){if(n=document.getElementById(t),!n)throw`[${this.popoverSelectorAttribute}="{POPOVER_ID}"] required`}else n=this.generatePopover();if(!n)throw"unable to find or generate popover element";this.popoverElement=n}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}scheduleUpdate(){this.popper&&this.isVisible&&this.popper.update()}}class Mt extends Lt{constructor(){super(...arguments),this.popoverSelectorAttribute="aria-controls"}shown(e=null){this.toggleOptionalClasses(!0),this.toggleAccessibilityAttributes(!0),super.shown(e)}hidden(e=null){this.toggleOptionalClasses(!1),this.toggleAccessibilityAttributes(!1),super.hidden(e)}connect(){super.connect(),this.toggleAccessibilityAttributes()}bindDocumentEvents(){this.boundHideOnOutsideClick=this.boundHideOnOutsideClick||this.hideOnOutsideClick.bind(this),this.boundHideOnEscapePress=this.boundHideOnEscapePress||this.hideOnEscapePress.bind(this),document.addEventListener("mousedown",this.boundHideOnOutsideClick),document.addEventListener("keyup",this.boundHideOnEscapePress)}unbindDocumentEvents(){document.removeEventListener("mousedown",this.boundHideOnOutsideClick),document.removeEventListener("keyup",this.boundHideOnEscapePress)}hideOnOutsideClick(e){const t=e.target;this.shouldHideOnOutsideClick&&!this.referenceElement.contains(t)&&!this.popoverElement.contains(t)&&document.body.contains(t)&&this.hide(e)}hideOnEscapePress(e){27===e.which&&this.isVisible&&(this.popoverElement.contains(e.target)&&this.referenceElement.focus(),this.hide(e))}toggleOptionalClasses(e){if(!this.data.has("toggle-class"))return;const t=this.data.get("toggle-class")||"",n=this.referenceElement.classList;t.split(/\s+/).forEach((function(t){n.toggle(t,e)}))}toggleAccessibilityAttributes(e){const t=(null==e?void 0:e.toString())||this.referenceElement.ariaExpanded||"false";this.referenceElement.ariaExpanded=t,this.referenceElement.setAttribute("aria-expanded",t)}}function Dt(e){const{isPopover:t,controller:n}=Nt(e);if(n)n.show();else{if(!t)throw'element does not have data-controller="s-popover"';e.setAttribute("data-s-popover-auto-show","true")}}function St(e){const{isPopover:t,controller:n,popover:i}=Nt(e);if(n)n.hide();else{if(!t)throw'element does not have data-controller="s-popover"';e.removeAttribute("data-s-popover-auto-show"),i&&i.classList.remove("is-visible")}}function Ft(e,t,n){const{referenceElement:i,popover:s}=Nt(e);if(s)throw`element already has popover with id="${s.id}"`;if(!i)throw"element has invalid data-s-popover-reference-selector attribute";if("string"==typeof t){const e=document.createRange().createContextualFragment(t).children;if(1!==e.length)throw"popover should contain a single element";t=e[0]}const r=i.getAttribute("aria-controls");let o=t.id;if(!t.classList.contains("s-popover"))throw`popover should have the "s-popover" class but had class="${t.className}"`;if(r&&r!==o)throw`element has aria-controls="${r}" but popover has id="${o}"`;o||(o="--stacks-s-popover-"+Math.random().toString(36).substring(2,10),t.id=o),r||i.setAttribute("aria-controls",o),!t.parentElement&&e.parentElement&&i.insertAdjacentElement("afterend",t),jt(e,"s-popover",!0),n&&(n.toggleOnClick&&i.setAttribute("data-action","click->s-popover#toggle"),n.placement&&e.setAttribute("data-s-popover-placement",n.placement),n.autoShow&&e.setAttribute("data-s-popover-auto-show","true"))}function Bt(e){const{isPopover:t,controller:n,referenceElement:i,popover:s}=Nt(e);return null==n||n.hide(),null==s||s.remove(),t&&(jt(e,"s-popover",!1),i&&i.removeAttribute("aria-controls")),s}function Nt(e){var t;const n=(null===(t=e.getAttribute("data-controller"))||void 0===t?void 0:t.includes("s-popover"))||!1,i=G.getControllerForElementAndIdentifier(e,"s-popover"),s=e.getAttribute("data-s-popover-reference-selector"),r=s?e.querySelector(s):e,o=r?r.getAttribute("aria-controls"):null;return{isPopover:n,controller:i,referenceElement:r,popover:o?document.getElementById(o):null}}function jt(e,t,n){var i;const s=new Set(null===(i=e.getAttribute("data-controller"))||void 0===i?void 0:i.split(/\s+/));n?s.add(t):s.delete(t),e.setAttribute("data-controller",Array.from(s).join(" "))}Mt.targets=[];class $t extends Q{setCurrentSort(e,t){if(["asc","desc","none"].indexOf(t)<0)throw"direction must be one of asc, desc, or none";const n=this;this.columnTargets.forEach((function(i){const s=i===e;i.classList.toggle("is-sorted",s&&"none"!==t),i.querySelectorAll(".js-sorting-indicator").forEach((function(e){const n=s?t:"none";e.classList.toggle("d-none",!e.classList.contains("js-sorting-indicator-"+n))})),s&&"none"!==t?n.setElementData(i,"sort-direction",t):n.removeElementData(i,"sort-direction")}))}sort(e){const t=this,n=e.currentTarget;if(!(n instanceof HTMLTableCellElement))throw"invalid event target";const i=this.element,s=i.tBodies[0],r=function(e){if(!(e.parentElement&&e.parentElement.parentElement instanceof HTMLTableSectionElement))throw"invalid table";const t=It(e.parentElement.parentElement,e);if("number"!=typeof t)throw"shouldn't happen";return t}(n);if(r<0)return;const o=function(e){const t=It(e);if(!(t instanceof Array))throw"shouldn't happen";return t}(s),a="asc"===this.getElementData(n,"sort-direction")?-1:1,l=Array.from(i.tBodies[0].rows);let c=!1;const h=[];let d;l.forEach((function(e,n){var i,s;const a=t.getElementData(e,"sort-to");if("top"===a)return;if("bottom"===a)return void(d||(d=e));const l=o[n][r];if(!l)return void h.push(["",n]);const u=t.getElementData(l,"sort-val"),p="string"==typeof u?u:null!==(s=null===(i=l.textContent)||void 0===i?void 0:i.trim())&&void 0!==s?s:"";""!==p&&`${parseInt(p,10)}`!==p&&(c=!0),h.push([p,n])})),c||h.forEach((function(e){e[0]=""===e[0]?Number.MIN_VALUE:parseInt(e[0],10)})),h.sort((function(e,t){return e[0]>t[0]?1*a:e[0]<t[0]?-1*a:e[1]>t[1]?1:-1})),h.forEach((function(e){var t;const n=l[e[1]];null===(t=n.parentElement)||void 0===t||t.removeChild(n),d?s.insertBefore(n,d):s.appendChild(n)})),this.setCurrentSort(n,1===a?"asc":"desc")}}function It(e,t){const n=[];let i=e.children[0];const s=[],r=[];for(;i||r.some((function(e){return 0!==e}));){const e=[];n.push(e);let o=0;if(i)for(let n=0;n<i.children.length;n++){for(;r[o];)r[o]--,e[o]=s[o],o++;const a=i.children[n];if(!(a instanceof HTMLTableCellElement))throw"invalid table";if("none"===getComputedStyle(a).display)continue;if(a===t)return o;const l=o+a.colSpan;for(;o<l;o++)r[o]=a.rowSpan-1,s[o]=a,e[o]=a}for(;o<s.length;)r[o]&&(r[o]--,e[o]=s[o]),o++;i&&(i=i.nextElementSibling)}return t?-1:n}$t.targets=["column"];class Pt extends Lt{constructor(){super(...arguments),this.popoverSelectorAttribute="aria-describedby"}connect(){super.connect(),window.matchMedia("(hover: hover)").matches&&this.bindMouseEvents(),this.bindKeyboardEvents()}disconnect(){this.unbindKeyboardEvents(),this.unbindMouseEvents(),super.disconnect()}show(e=null){const t=G.getControllerForElementAndIdentifier(this.element,"s-popover");t&&t.isVisible||super.show(e)}scheduleShow(e=null){window.clearTimeout(this.activeTimeout),this.activeTimeout=window.setTimeout((()=>this.show(e)),300)}scheduleHide(e=null){window.clearTimeout(this.activeTimeout),this.activeTimeout=window.setTimeout((()=>super.hide(e)),100)}clearActiveTimeout(){clearTimeout(this.activeTimeout)}applyTitleAttributes(){let e;const t=this.data.get("html-title");if(t)e=document.createRange().createContextualFragment(t);else{const t=this.element.getAttribute("title");if(!t)return null;e=document.createTextNode(t)}this.data.delete("html-title"),this.element.removeAttribute("title");let n=this.element.getAttribute("aria-describedby");n||(n=Pt.generateId(),this.element.setAttribute("aria-describedby",n));let i=document.getElementById(n);if(!i){i=document.createElement("div"),i.id=n,i.className="s-popover s-popover__tooltip",i.setAttribute("role","tooltip");const e=this.element.parentNode;e?e.insertBefore(i,this.element.nextSibling):document.body.appendChild(i)}const s=i.querySelector(".s-popover--arrow");return i.innerHTML="",i.appendChild(e),s?i.appendChild(s):i.insertAdjacentHTML("beforeend",'<div class="s-popover--arrow"></div>'),this.scheduleUpdate(),i}bindDocumentEvents(){this.boundHideIfWithin=this.boundHideIfWithin||this.hideIfWithin.bind(this),document.addEventListener("s-popover:shown",this.boundHideIfWithin)}unbindDocumentEvents(){document.removeEventListener("s-popover:shown",this.boundHideIfWithin)}generatePopover(){return this.applyTitleAttributes()}hideIfWithin(e){e.target.contains(this.referenceElement)&&this.scheduleHide()}hideOnEscapeKeyEvent(e){"Escape"===e.key&&this.scheduleHide()}bindKeyboardEvents(){this.boundScheduleShow=this.boundScheduleShow||this.scheduleShow.bind(this),this.boundHide=this.boundHide||this.scheduleHide.bind(this),this.boundHideOnEscapeKeyEvent=this.boundHideOnEscapeKeyEvent||this.hideOnEscapeKeyEvent.bind(this),this.referenceElement.addEventListener("focus",this.boundScheduleShow),this.referenceElement.addEventListener("blur",this.boundHide),document.addEventListener("keyup",this.boundHideOnEscapeKeyEvent)}unbindKeyboardEvents(){this.referenceElement.removeEventListener("focus",this.boundScheduleShow),this.referenceElement.removeEventListener("blur",this.boundHide),document.removeEventListener("keyup",this.boundHideOnEscapeKeyEvent)}bindMouseEvents(){this.boundScheduleShow=this.boundScheduleShow||this.scheduleShow.bind(this),this.boundHide=this.boundHide||this.scheduleHide.bind(this),this.boundClearActiveTimeout=this.boundClearActiveTimeout||this.clearActiveTimeout.bind(this),this.referenceElement.addEventListener("mouseover",this.boundScheduleShow),this.referenceElement.addEventListener("mouseout",this.boundHide),this.popoverElement.addEventListener("mouseover",this.boundClearActiveTimeout),this.popoverElement.addEventListener("mouseout",this.boundHide)}unbindMouseEvents(){this.referenceElement.removeEventListener("mouseover",this.boundScheduleShow),this.referenceElement.removeEventListener("mouseout",this.boundHide),this.referenceElement.removeEventListener("focus",this.boundScheduleShow),this.referenceElement.removeEventListener("blur",this.boundHide),this.popoverElement.removeEventListener("mouseover",this.boundClearActiveTimeout),this.popoverElement.removeEventListener("mouseout",this.boundHide)}static generateId(){return"--stacks-s-tooltip-"+Math.random().toString(36).substring(2,10)}}function Vt(e,t,n){e.setAttribute("data-s-tooltip-html-title",t),e.removeAttribute("title"),Ht(e,n)}function Kt(e,t,n){e.setAttribute("title",t),e.removeAttribute("data-s-tooltip-html-title"),Ht(e,n)}function Ht(e,t){t&&t.placement&&e.setAttribute("data-s-tooltip-placement",t.placement);const n=G.getControllerForElementAndIdentifier(e,"s-tooltip");if(n)n.applyTitleAttributes();else{const t=e.getAttribute("data-controller");e.setAttribute("data-controller",`${t||""} s-tooltip`)}}Pt.targets=[];class _t extends Q{connect(){super.connect(),this.boundDragEnter=this.handleUploaderActive.bind(this,!0),this.boundDragLeave=this.handleUploaderActive.bind(this,!1),this.inputTarget.addEventListener("dragenter",this.boundDragEnter),this.inputTarget.addEventListener("dragleave",this.boundDragLeave)}disconnect(){this.inputTarget.removeEventListener("dragenter",this.boundDragEnter),this.inputTarget.removeEventListener("dragleave",this.boundDragLeave),super.disconnect()}handleInput(){if(this.previewsTarget.innerHTML="",!this.inputTarget.files)return;const e=this.inputTarget.files.length;this.getDataURLs(this.inputTarget.files,_t.FILE_DISPLAY_LIMIT).then((t=>{if(this.handleVisible(!0),t.length>1){const n=document.createElement("div");n.classList.add("s-uploader--previews-heading"),n.innerText=t.length<e?`Showing ${t.length} of ${e} files`:`${e} items`,this.previewsTarget.appendChild(n),this.previewsTarget.classList.add("has-multiple")}else this.previewsTarget.classList.remove("has-multiple");t.forEach((e=>this.addFilePreview(e))),this.handleUploaderActive(!0)})).catch((()=>null))}reset(){this.inputTarget.value="",this.previewsTarget.innerHTML="",this.handleVisible(!1)}handleVisible(e){const{scope:t}=this.targets,n=t.findAllElements("[data-s-uploader-hide-on-input]"),i=t.findAllElements("[data-s-uploader-show-on-input]"),s=t.findAllElements("[data-s-uploader-enable-on-input]");e?(n.forEach((e=>{e.classList.add("d-none")})),i.forEach((e=>{e.classList.remove("d-none")})),s.forEach((e=>{e.removeAttribute("disabled")}))):(n.forEach((e=>{e.classList.remove("d-none")})),i.forEach((e=>{e.classList.add("d-none")})),s.forEach((e=>{e.setAttribute("disabled","true")})),this.handleUploaderActive(!1))}addFilePreview(e){if(!e)return;const t=document.createElement("div");let n;e.type.match("image/*")&&e.data?(n=document.createElement("img"),n.src=e.data.toString(),n.alt=e.name):(n=document.createElement("div"),n.innerText=e.name),n.classList.add("s-uploader--preview-thumbnail"),t.appendChild(n),t.classList.add("s-uploader--preview"),t.setAttribute("data-filename",e.name),this.previewsTarget.appendChild(t)}handleUploaderActive(e){this.uploaderTarget.classList.toggle("is-active",e)}fileToDataURL(e){const t=new FileReader,{name:n,size:i,type:s}=e;return i<_t.MAX_FILE_SIZE&&s.indexOf("image")>-1?new Promise(((i,r)=>{t.onload=e=>{var t;const o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.result;o?i({data:o,name:n,type:s}):r()},t.readAsDataURL(e)})):Promise.resolve({name:n,type:s})}getDataURLs(e,t){const n=Array.from(e).slice(0,Math.min(t,e.length)).map((e=>this.fileToDataURL(e)));return Promise.all(n)}}return _t.targets=["input","previews","uploader"],_t.FILE_DISPLAY_LIMIT=10,_t.MAX_FILE_SIZE=10485760,G.register("s-banner",de),G.register("s-expandable-control",oe),G.register("s-modal",ae),G.register("s-toast",me),G.register("s-navigation-tablist",ye),G.register("s-popover",Mt),G.register("s-table",$t),G.register("s-tooltip",Pt),G.register("s-uploader",_t),Z.finalize(),t})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Stacks=t():e.Stacks=t()}(globalThis,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{BannerController:()=>ne,BasePopoverController:()=>Tt,ExpandableController:()=>he,ModalController:()=>de,PopoverController:()=>xt,StacksApplication:()=>Z,StacksController:()=>Q,TabListController:()=>me,TableController:()=>Ft,ToastController:()=>Nt,TooltipController:()=>Pt,UploaderController:()=>_t,addController:()=>te,application:()=>G,attachPopover:()=>Lt,createController:()=>ee,detachPopover:()=>Mt,hideBanner:()=>se,hideModal:()=>pe,hidePopover:()=>Ct,hideToast:()=>$t,setTooltipHtml:()=>Vt,setTooltipText:()=>Kt,showBanner:()=>ie,showModal:()=>ue,showPopover:()=>kt,showToast:()=>jt});class n{constructor(e,t,n){this.eventTarget=e,this.eventName=t,this.eventOptions=n,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=function(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((e,t)=>{const n=e.index,i=t.index;return n<i?-1:n>i?1:0}))}}class i{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((e=>e.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((e=>e.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((e,t)=>e.concat(Array.from(t.values()))),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,n={}){this.application.handleError(e,`Error ${t}`,n)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:n,eventOptions:i}=e,s=this.fetchEventListenerMapForEventTarget(t),r=this.cacheKey(n,i);s.delete(r),0==s.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:n,eventOptions:i}=e;return this.fetchEventListener(t,n,i)}fetchEventListener(e,t,n){const i=this.fetchEventListenerMapForEventTarget(e),s=this.cacheKey(t,n);let r=i.get(s);return r||(r=this.createEventListener(e,t,n),i.set(s,r)),r}createEventListener(e,t,i){const s=new n(e,t,i);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const n=[e];return Object.keys(t).sort().forEach((e=>{n.push(`${t[e]?"":"!"}${e}`)})),n.join(":")}}const s={stop:({event:e,value:t})=>(t&&e.stopPropagation(),!0),prevent:({event:e,value:t})=>(t&&e.preventDefault(),!0),self:({event:e,value:t,element:n})=>!t||n===e.target},r=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function o(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function a(e){return o(e.replace(/--/g,"-").replace(/__/g,"_"))}function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}const h={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function d(e){throw new Error(e)}function u(e){try{return JSON.parse(e)}catch(t){return e}}class p{constructor(e,t){this.context=e,this.action=t}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(e){this.willBeInvokedByEvent(e)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){const{element:t}=this.action,{actionDescriptorFilters:n}=this.context.application;let i=!0;for(const[s,r]of Object.entries(this.eventOptions))if(s in n){const o=n[s];i=i&&o({name:s,value:r,event:e,element:t})}return i}invokeWithEvent(e){const{target:t,currentTarget:n}=e;try{const{params:i}=this.action,s=Object.assign(e,{params:i});this.method.call(this.controller,s),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:n,action:this.methodName})}catch(t){const{identifier:n,controller:i,element:s,index:r}=this,o={identifier:n,controller:i,element:s,index:r,event:e};this.context.handleError(t,`invoking action "${this.action}"`,o)}}willBeInvokedByEvent(e){const t=e.target;return!(e instanceof KeyboardEvent&&this.action.isFilterTarget(e))&&(this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):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 f{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),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 e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){"attributes"==e.type?this.processAttributeChange(e.target,e.attributeName):"childList"==e.type&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){const n=e;this.elements.has(n)?this.delegate.elementAttributeChanged&&this.matchElement(n)?this.delegate.elementAttributeChanged(n,t):this.removeElement(n):this.matchElement(n)&&this.addElement(n)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const n of this.matchElementsInTree(e))t.call(this,n)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}}class m{constructor(e,t,n){this.attributeName=t,this.delegate=n,this.elementObserver=new f(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return t.concat(n)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}function g(e,t){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n}class v{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e.concat(Array.from(t))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((e,t)=>e+t.size),0)}add(e,t){!function(e,t,n){g(e,t).add(n)}(this.valuesByKey,e,t)}delete(e,t){!function(e,t,n){g(e,t).delete(n),function(e,t){const n=e.get(t);null!=n&&0==n.size&&e.delete(t)}(e,t)}(this.valuesByKey,e,t)}has(e,t){const n=this.valuesByKey.get(e);return null!=n&&n.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some((t=>t.has(e)))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter((([t,n])=>n.has(e))).map((([e,t])=>e))}}class b{constructor(e,t,n,i={}){this.selector=t,this.details=i,this.elementObserver=new f(e,this),this.delegate=n,this.matchesByElement=new v}get started(){return this.elementObserver.started}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){const t=e.matches(this.selector);return this.delegate.selectorMatchElement?t&&this.delegate.selectorMatchElement(e,this.details):t}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector)).filter((e=>this.matchElement(e)));return t.concat(n)}elementMatched(e){this.selectorMatched(e)}elementUnmatched(e){this.selectorUnmatched(e)}elementAttributeChanged(e,t){const n=this.matchElement(e),i=this.matchesByElement.has(this.selector,e);!n&&i&&this.selectorUnmatched(e)}selectorMatched(e){this.delegate.selectorMatched&&(this.delegate.selectorMatched(e,this.selector,this.details),this.matchesByElement.add(this.selector,e))}selectorUnmatched(e){this.delegate.selectorUnmatched(e,this.selector,this.details),this.matchesByElement.delete(this.selector,e)}}class y{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}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 e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const n=this.delegate.getStringMapKeyForAttribute(e);if(null!=n){this.stringMap.has(e)||this.stringMapKeyAdded(n,e);const i=this.element.getAttribute(e);if(this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,n,t),null==i){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(n,e,t)}else this.stringMap.set(e,i)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,n){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,n)}stringMapKeyRemoved(e,t,n){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,n)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((e=>e.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class E{constructor(e,t,n){this.attributeObserver=new m(e,t,this),this.delegate=n,this.tokensByElement=new v}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,n]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(n)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach((e=>this.tokenMatched(e)))}tokensUnmatched(e){e.forEach((e=>this.tokenUnmatched(e)))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),i=function(e,t){const n=Math.max(e.length,t.length);return Array.from({length:n},((n,i)=>[e[i],t[i]]))}(t,n).findIndex((([e,t])=>!function(e,t){return e&&t&&e.index==t.index&&e.content==t.content}(e,t)));return-1==i?[[],[]]:[t.slice(i),n.slice(i)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,n){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,i)=>({element:t,attributeName:n,content:e,index:i})))}(e.getAttribute(t)||"",e,t)}}class w{constructor(e,t,n){this.tokenListObserver=new E(e,t,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).set(e,n),this.delegate.elementMatchedValue(t,n))}tokenUnmatched(e){const{element:t}=e,{value:n}=this.fetchParseResultForToken(e);n&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,n))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(e){return{error:e}}}}class O{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new w(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new p(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach((e=>this.delegate.bindingDisconnected(e,!0))),this.bindingsByAction.clear()}parseValueForToken(e){const t=class{constructor(e,t,n,i){this.element=e,this.index=t,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||function(e){const t=e.tagName.toLowerCase();if(t in h)return h[t](e)}(e)||d("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||d("missing identifier"),this.methodName=n.methodName||d("missing method name"),this.keyFilter=n.keyFilter||"",this.schema=i}static forToken(e,t){return new this(e.element,e.index,function(e){const t=e.trim().match(r)||[];let n=t[1],i=t[2];return i&&!["keydown","keyup","keypress"].includes(n)&&(n+=`.${i}`,i=""),{eventTarget:(s=t[3],"window"==s?window:"document"==s?document:void 0),eventName:n,eventOptions:t[6]?(o=t[6],o.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})):{},identifier:t[4],methodName:t[5],keyFilter:i};var s,o}(e.content),t)}toString(){const e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}isFilterTarget(e){if(!this.keyFilter)return!1;const t=this.keyFilter.split("+"),n=["meta","ctrl","alt","shift"],[i,s,r,o]=n.map((e=>t.includes(e)));if(e.metaKey!==i||e.ctrlKey!==s||e.altKey!==r||e.shiftKey!==o)return!0;const a=t.filter((e=>!n.includes(e)))[0];return!!a&&(Object.prototype.hasOwnProperty.call(this.keyMappings,a)||d(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[a].toLowerCase()!==e.key.toLowerCase())}get params(){const e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:n,value:i}of Array.from(this.element.attributes)){const s=n.match(t),r=s&&s[1];r&&(e[o(r)]=u(i))}return e}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}get keyMappings(){return this.schema.keyMappings}}.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class A{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new y(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const n=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,n.writer(this.receiver[e]),n.writer(n.defaultValue))}stringMapValueChanged(e,t,n){const i=this.valueDescriptorNameMap[t];null!==e&&(null===n&&(n=i.writer(i.defaultValue)),this.invokeChangedCallback(t,e,n))}stringMapKeyRemoved(e,t,n){const i=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,i.writer(this.receiver[e]),n):this.invokeChangedCallback(e,i.writer(i.defaultValue),n)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:n,writer:i}of this.valueDescriptors)null==n||this.controller.data.has(e)||this.invokeChangedCallback(t,i(n),void 0)}invokeChangedCallback(e,t,n){const i=`${e}Changed`,s=this.receiver[i];if("function"==typeof s){const i=this.valueDescriptorNameMap[e];try{const e=i.reader(t);let r=n;n&&(r=i.reader(n)),s.call(this.receiver,e,r)}catch(e){throw e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${i.name}" - ${e.message}`),e}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map((t=>e[t]))}get valueDescriptorNameMap(){const e={};return Object.keys(this.valueDescriptorMap).forEach((t=>{const n=this.valueDescriptorMap[t];e[n.name]=n})),e}hasValue(e){const t=`has${l(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class T{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new v}start(){this.tokenListObserver||(this.tokenListObserver=new E(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var n;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetConnected(e,t))))}disconnectTarget(e,t){var n;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(n=this.tokenListObserver)||void 0===n||n.pause((()=>this.delegate.targetDisconnected(e,t))))}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function x(e,t){const n=k(e);return Array.from(n.reduce(((e,n)=>(function(e,t){const n=e[t];return Array.isArray(n)?n:[]}(n,t).forEach((t=>e.add(t))),e)),new Set))}function k(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}class C{constructor(e,t){this.context=e,this.delegate=t,this.outletsByName=new v,this.outletElementsByName=new v,this.selectorObserverMap=new Map}start(){0===this.selectorObserverMap.size&&(this.outletDefinitions.forEach((e=>{const t=this.selector(e),n={outletName:e};t&&this.selectorObserverMap.set(e,new b(document.body,t,this,n))})),this.selectorObserverMap.forEach((e=>e.start()))),this.dependentContexts.forEach((e=>e.refresh()))}stop(){this.selectorObserverMap.size>0&&(this.disconnectAllOutlets(),this.selectorObserverMap.forEach((e=>e.stop())),this.selectorObserverMap.clear())}refresh(){this.selectorObserverMap.forEach((e=>e.refresh()))}selectorMatched(e,t,{outletName:n}){const i=this.getOutlet(e,n);i&&this.connectOutlet(i,e,n)}selectorUnmatched(e,t,{outletName:n}){const i=this.getOutletFromMap(e,n);i&&this.disconnectOutlet(i,e,n)}selectorMatchElement(e,{outletName:t}){return this.hasOutlet(e,t)&&e.matches(`[${this.context.application.schema.controllerAttribute}~=${t}]`)}connectOutlet(e,t,n){var i;this.outletElementsByName.has(n,t)||(this.outletsByName.add(n,e),this.outletElementsByName.add(n,t),null===(i=this.selectorObserverMap.get(n))||void 0===i||i.pause((()=>this.delegate.outletConnected(e,t,n))))}disconnectOutlet(e,t,n){var i;this.outletElementsByName.has(n,t)&&(this.outletsByName.delete(n,e),this.outletElementsByName.delete(n,t),null===(i=this.selectorObserverMap.get(n))||void 0===i||i.pause((()=>this.delegate.outletDisconnected(e,t,n))))}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const n of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(n,t,e)}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}get outletDependencies(){const e=new v;return this.router.modules.forEach((t=>{x(t.definition.controllerConstructor,"outlets").forEach((n=>e.add(n,t.identifier)))})),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const e=this.dependentControllerIdentifiers;return this.router.contexts.filter((t=>e.includes(t.identifier)))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find((t=>t.element===e))}get scope(){return this.context.scope}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class L{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:n,controller:i,element:s}=this;t=Object.assign({identifier:n,controller:i,element:s},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new O(this,this.dispatcher),this.valueObserver=new A(this,this.controller),this.targetObserver=new T(this,this),this.outletObserver=new C(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"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(e,t,n={}){const{identifier:i,controller:s,element:r}=this;n=Object.assign({identifier:i,controller:s,element:r},n),this.application.handleError(e,`Error ${t}`,n)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,n){this.invokeControllerMethod(`${a(n)}OutletConnected`,e,t)}outletDisconnected(e,t,n){this.invokeControllerMethod(`${a(n)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const n=this.controller;"function"==typeof n[e]&&n[e](...t)}}const M="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,D=(()=>{function e(e){function t(){return Reflect.construct(e,arguments,new.target)}return t.prototype=Object.create(e.prototype,{constructor:{value:t}}),Reflect.setPrototypeOf(t,e),t}try{return function(){const t=e((function(){this.a.call(this)}));t.prototype.a=function(){},new t}(),e}catch(e){return e=>class extends e{}}})();class S{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:(t=e.controllerConstructor,function(e,t){const n=D(e),i=function(e,t){return M(t).reduce(((n,i)=>{const s=function(e,t,n){const i=Object.getOwnPropertyDescriptor(e,n);if(!i||!("value"in i)){const e=Object.getOwnPropertyDescriptor(t,n).value;return i&&(e.get=i.get||e.get,e.set=i.set||e.set),e}}(e,t,i);return s&&Object.assign(n,{[i]:s}),n}),{})}(e.prototype,t);return Object.defineProperties(n.prototype,i),n}(t,function(e){return x(e,"blessings").reduce(((t,n)=>{const i=n(e);for(const e in i){const n=t[e]||{};t[e]=Object.assign(n,i[e])}return t}),{})}(t)))};var t}(t),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(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new L(this,e),this.contextsByScope.set(e,t)),t}}class F{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){return(this.data.get(this.getDataKey(e))||"").match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class B{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,t),this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${c(e)}`}}class N{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,n){let i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(n,e))}}function j(e,t){return`[${e}~="${t}"]`}class ${constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)]),[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){return j(this.schema.targetAttributeForScope(this.identifier),e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map((t=>this.deprecate(t,e)))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return j(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:n}=this,i=this.schema.targetAttribute,s=this.schema.targetAttributeForScope(n);this.guide.warn(e,`target:${t}`,`Please replace ${i}="${n}.${t}" with ${s}="${t}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class I{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findOutlet(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllOutlets(t)]),[])}getSelectorForOutletName(e){const t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){const t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){const t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter((n=>this.matchesElement(n,e,t)))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter((n=>this.matchesElement(n,e,t)))}matchesElement(e,t,n){const i=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&i.split(" ").includes(n)}}class P{constructor(e,t,n,i){this.targets=new $(this),this.classes=new F(this),this.data=new B(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=n,this.guide=new N(i),this.outlets=new I(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return j(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new P(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class V{constructor(e,t,n){this.element=e,this.schema=t,this.delegate=n,this.valueListObserver=new w(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:n}=e,i=this.fetchScopesByIdentifierForElement(t);let s=i.get(n);return s||(s=this.delegate.createScopeForElementAndIdentifier(t,n),i.set(n,s)),s}elementMatchedValue(e,t){const n=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,n),1==n&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const n=this.scopeReferenceCounts.get(t);n&&(this.scopeReferenceCounts.set(t,n-1),1==n&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class K{constructor(e){this.application=e,this.scopeObserver=new V(this.element,this.schema,this),this.scopesByIdentifier=new v,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((e,t)=>e.concat(t.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new S(this.application,e);this.connectModule(t);const n=e.controllerConstructor.afterLoad;n&&n(e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const n=this.modulesByIdentifier.get(t);if(n)return n.contexts.find((t=>t.element==e))}handleError(e,t,n){this.application.handleError(e,t,n)}createScopeForElementAndIdentifier(e,t){return new P(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.connectContextForScope(t)))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach((t=>e.disconnectContextForScope(t)))}}const H={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`,outletAttributeForScope:(e,t)=>`data-${e}-${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"},_("abcdefghijklmnopqrstuvwxyz".split("").map((e=>[e,e])))),_("0123456789".split("").map((e=>[e,e]))))};function _(e){return e.reduce(((e,[t,n])=>Object.assign(Object.assign({},e),{[t]:n})),{})}function R([e,t],n){return function(e){const t=`${c(e.token)}-value`,n=function(e){const t=function(e){const t=U(e.typeObject.type);if(!t)return;const n=W(e.typeObject.default);if(t!==n){throw new Error(`The specified default value for the Stimulus Value "${e.controller?`${e.controller}.${e.token}`:e.token}" must match the defined type "${t}". The provided default value of "${e.typeObject.default}" is of type "${n}".`)}return t}({controller:e.controller,token:e.token,typeObject:e.typeDefinition}),n=W(e.typeDefinition),i=U(e.typeDefinition),s=t||n||i;if(s)return s;throw new Error(`Unknown value type "${e.controller?`${e.controller}.${e.typeDefinition}`:e.token}" for "${e.token}" value`)}(e);return{type:n,key:t,name:o(t),get defaultValue(){return function(e){const t=U(e);if(t)return q[t];const n=e.default;return void 0!==n?n:e}(e.typeDefinition)},get hasCustomDefaultValue(){return void 0!==W(e.typeDefinition)},reader:z[n],writer:J[n]||J.default}}({controller:n,token:e,typeDefinition:t})}function U(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function W(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}const q={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},z={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${W(t)}"`);return t},boolean:e=>!("0"==e||"false"==String(e).toLowerCase()),number:e=>Number(e),object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${W(t)}"`);return t},string:e=>e},J={default:function(e){return`${e}`},array:X,object:X};function X(e){return JSON.stringify(e)}class Y{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}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(e,{target:t=this.element,detail:n={},prefix:i=this.identifier,bubbles:s=!0,cancelable:r=!0}={}){const o=new CustomEvent(i?`${i}:${e}`:e,{detail:n,bubbles:s,cancelable:r});return t.dispatchEvent(o),o}}Y.blessings=[function(e){return x(e,"classes").reduce(((e,t)=>{return Object.assign(e,{[`${n=t}Class`]:{get(){const{classes:e}=this;if(e.has(n))return e.get(n);{const t=e.getAttributeName(n);throw new Error(`Missing attribute "${t}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${l(n)}Class`]:{get(){return this.classes.has(n)}}});var n}),{})},function(e){return x(e,"targets").reduce(((e,t)=>{return Object.assign(e,{[`${n=t}Target`]:{get(){const e=this.targets.find(n);if(e)return e;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${l(n)}Target`]:{get(){return this.targets.has(n)}}});var n}),{})},function(e){const t=function(e,t){return k(e).reduce(((e,n)=>(e.push(...function(e,t){const n=e[t];return n?Object.keys(n).map((e=>[e,n[e]])):[]}(n,t)),e)),[])}(e,"values"),n={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const n=R(t,this.identifier),i=this.data.getAttributeNameForKey(n.key);return Object.assign(e,{[i]:n})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,function(e,t){const n=R(e,void 0),{key:i,name:s,reader:r,writer:o}=n;return{[s]:{get(){const e=this.data.get(i);return null!==e?r(e):n.defaultValue},set(e){void 0===e?this.data.delete(i):this.data.set(i,o(e))}},[`has${l(s)}`]:{get(){return this.data.has(i)||n.hasCustomDefaultValue}}}}(t))),n)},function(e){return x(e,"outlets").reduce(((e,t)=>Object.assign(e,function(e){const t=a(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e);if(t){const n=this.application.getControllerForElementAndIdentifier(t,e);if(n)return n;throw new Error(`Missing "data-controller=${e}" attribute on outlet element for "${this.identifier}" controller`)}throw new Error(`Missing outlet element "${e}" for "${this.identifier}" controller`)}},[`${t}Outlets`]:{get(){const t=this.outlets.findAll(e);return t.length>0?t.map((t=>{const n=this.application.getControllerForElementAndIdentifier(t,e);if(n)return n;console.warn(`The provided outlet element is missing the outlet controller "${e}" for "${this.identifier}"`,t)})).filter((e=>e)):[]}},[`${t}OutletElement`]:{get(){const t=this.outlets.find(e);if(t)return t;throw new Error(`Missing outlet element "${e}" for "${this.identifier}" controller`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(e)}},[`has${l(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}(t))),{})}],Y.targets=[],Y.outlets=[],Y.values={};class Z extends class{constructor(e=document.documentElement,t=H){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,n={})=>{this.debug&&this.logFormattedMessage(e,t,n)},this.element=e,this.schema=t,this.dispatcher=new i(this),this.router=new K(this),this.actionDescriptorFilters=Object.assign({},s)}static start(e,t){const n=new this(e,t);return n.start(),n}async start(){await new Promise((e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>e())):e()})),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(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)}))}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach((e=>this.router.unloadIdentifier(e)))}get controllers(){return this.router.contexts.map((e=>e.controller))}getControllerForElementAndIdentifier(e,t){const n=this.router.getContextForElementAndIdentifier(e,t);return n?n.controller:null}handleError(e,t,n){var i;this.logger.error("%s\n\n%o\n\n%o",t,e,n),null===(i=window.onerror)||void 0===i||i.call(window,t,"",0,0,e)}logFormattedMessage(e,t,n={}){n=Object.assign({application:this},n),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},n)),this.logger.groupEnd()}}{load(e,...t){const n=Array.isArray(e)?e:[e,...t];for(const e of n){const t=/^s-/.test(e.identifier);if(Z._initializing&&!t)throw'Stacks-created Stimulus controller names must start with "s-".';if(!Z._initializing&&t)throw'The "s-" prefix on Stimulus controller names is reserved for Stacks-created controllers.'}super.load(n)}static start(e,t){const n=new Z(e,t);return n.start(),n}static finalize(){Z._initializing=!1}}Z._initializing=!0;const G=Z.start();class Q extends Y{getElementData(e,t){return e.getAttribute("data-"+this.identifier+"-"+t)}setElementData(e,t,n){e.setAttribute("data-"+this.identifier+"-"+t,n)}removeElementData(e,t){e.removeAttribute("data-"+this.identifier+"-"+t)}triggerEvent(e,t,n){const i=this.identifier+":"+e;let s;try{s=new CustomEvent(i,{bubbles:!0,cancelable:!0,detail:t})}catch(e){s=document.createEvent("CustomEvent"),s.initCustomEvent(i,!0,!0,t)}return(n||this.element).dispatchEvent(s),s}}function ee(e){var t,n;const i=e.hasOwnProperty("targets")?((n=class extends Q{}).targets=null!==(t=e.targets)&&void 0!==t?t:[],n):class extends Q{};for(const t in e){const n=e.hasOwnProperty(t)&&Object.getOwnPropertyDescriptor(e,t);"targets"!==t&&n&&Object.defineProperty(i.prototype,t,n)}return i}function te(e,t){G.register(e,ee(t))}class ne extends Q{toggle(e=null){this._toggle(void 0,e)}show(e=null){this._toggle(!0,e)}hide(e=null){this._toggle(!1,e)}_toggle(e,t=null){let n=e;const i="false"===this.bannerTarget.getAttribute("aria-hidden");if(void 0===n&&(n=!i),n&&i||!n&&!i)return;const s=this.getDispatcher(t);this.triggerEvent(n?"show":"hide",{dispatcher:this.getDispatcher(s)},this.bannerTarget).defaultPrevented||(this.bannerTarget.setAttribute("aria-hidden",n?"false":"true"),n||this.removeBannerOnHide(),this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.bannerTarget))}removeBannerOnHide(){"true"===this.data.get("remove-when-hidden")&&this.bannerTarget.addEventListener("s-banner:hidden",(()=>{this.element.remove()}),{once:!0})}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}}function ie(e){re(e,!0)}function se(e){re(e,!1)}function re(e,t){const n=G.getControllerForElementAndIdentifier(e,"s-banner");if(!n)throw"Unable to get s-banner controller from element";t?n.show():n.hide()}ne.targets=["banner"];const oe="s-expandable-control:radio-off";function ae(e){const t=e.target;t instanceof HTMLInputElement&&"INPUT"===t.nodeName&&"radio"===t.type&&document.querySelectorAll('input[type="radio"][name="'+t.name+'"]').forEach((function(t){if(t===e.target)return;let n;try{n=new Event(oe)}catch(e){n=document.createEvent("Event"),n.initEvent(oe,!0,!0)}t.dispatchEvent(n)}))}let le=0;function ce(e){e?(le++,1===le&&document.body.addEventListener("change",ae)):(le--,0===le&&document.body.removeEventListener("change",ae))}class he extends Q{constructor(){super(...arguments),this.lastKeydownClickTimestamp=0}initialize(){"INPUT"===this.element.nodeName&&["radio","checkbox"].indexOf(this.element.type)>=0?(this.isCollapsed=this._isCollapsedForCheckable.bind(this),this.events=["change",oe],this.isCheckable=!0,this.isRadio="radio"===this.element.type):(this.isCollapsed=this._isCollapsedForClickable.bind(this),this.events=["click","keydown"]),this.listener=this.listener.bind(this)}_isCollapsedForClickable(){const e=this.controlledExpandables;return e.length>0?!e.every((e=>e.classList.contains("is-expanded"))):"false"===this.element.getAttribute("aria-expanded")}_isCollapsedForCheckable(){return!this.element.checked}get controlledExpandables(){const e=this.element.getAttribute("aria-controls");if(!e)throw'[aria-controls="targetId1 ... targetIdN"] attribute required';const t=e.split(/\s+/g).map((e=>document.getElementById(e))).filter((e=>!!e));if(!t.length)throw"couldn't find controls";return t}_dispatchShowHideEvent(e){this.triggerEvent(e?"show":"hide")}_toggleClass(e){if(!this.data.has("toggle-class"))return;const t=this.element.classList,n=this.data.get("toggle-class");if(!n)throw"couldn't find toggle class";n.split(/\s+/).forEach((function(n){t.toggle(n,!!e)}))}listener(e){let t;if(this.isCheckable)t=!this.element.checked;else{if("keydown"==e.type&&e instanceof KeyboardEvent&&13!=e.keyCode&&32!=e.keyCode)return;if(e.target!==e.currentTarget&&["A","BUTTON"].indexOf(e.target.nodeName)>=0)return;if(e.preventDefault(),"keydown"==e.type)this.lastKeydownClickTimestamp=Date.now();else if("click"==e.type&&Date.now()-this.lastKeydownClickTimestamp<300)return;t="true"===this.element.getAttribute("aria-expanded"),"click"===e.type&&this.element.blur()}this.element.setAttribute("aria-expanded",t?"false":"true");for(const e of this.controlledExpandables)e.classList.toggle("is-expanded",!t);this._dispatchShowHideEvent(!t),this._toggleClass(!t)}connect(){if(this.events.forEach((e=>{this.element.addEventListener(e,this.listener.bind(this))}),this),this.isRadio&&ce(!0),this.isRadio||this.element.setAttribute("aria-expanded",this.isCollapsed()?"false":"true"),this.isCheckable){const e=this.controlledExpandables;if(e.length){const t=!this.isCollapsed();if(e.some((e=>e.classList.contains("is-expanded")!==t))){for(const e of this.controlledExpandables)e.classList.toggle("is-expanded",t);this._dispatchShowHideEvent(t),this._toggleClass(t)}}}}disconnect(){this.events.forEach((e=>{this.element.removeEventListener(e,this.listener.bind(this))}),this),this.isRadio&&ce(!1)}}class de extends Q{connect(){this.validate()}disconnect(){this.unbindDocumentEvents()}toggle(e=null){this._toggle(void 0,e)}show(e=null){this._toggle(!0,e)}hide(e=null){this._toggle(!1,e)}validate(){const e=this.data.get("return-element");if(e&&(this.returnElement=document.querySelector(e),!this.returnElement))throw"Unable to find element by return-element selector: "+e}_toggle(e,t=null){let n=e;const i="false"===this.modalTarget.getAttribute("aria-hidden");if(void 0===n&&(n=!i),n&&i||!n&&!i)return;const s=this.getDispatcher(t),r=this.triggerEvent(n?"show":"hide",{returnElement:this.returnElement,dispatcher:this.getDispatcher(s)},this.modalTarget);r.defaultPrevented||(this.returnElement=r.detail.returnElement,this.modalTarget.setAttribute("aria-hidden",n?"false":"true"),n?(this.bindDocumentEvents(),this.focusInsideModal()):(this.unbindDocumentEvents(),this.focusReturnElement(),this.removeModalOnHide()),void 0!==this.modalTarget.ontransitionend?this.modalTarget.addEventListener("transitionend",(()=>{this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.modalTarget)}),{once:!0}):this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.modalTarget))}focusReturnElement(){this.returnElement&&this.modalTarget.addEventListener("s-modal:hidden",(()=>{this.returnElement&&document.body.contains(this.returnElement)&&this.returnElement.focus()}),{once:!0})}removeModalOnHide(){"true"===this.data.get("remove-when-hidden")&&this.modalTarget.addEventListener("s-modal:hidden",(()=>{this.element.remove()}),{once:!0})}getAllTabbables(){return Array.from(this.modalTarget.querySelectorAll("[href], input, select, textarea, button, [tabindex]")).filter((e=>e.matches(":not([disabled]):not([tabindex='-1'])")))}firstVisible(e){return e.find((e=>null!==e.offsetParent))}lastVisible(e){return this.firstVisible([...e].reverse())}focusInsideModal(){this.modalTarget.addEventListener("s-modal:shown",(()=>{var e;const t=null!==(e=this.firstVisible(this.initialFocusTargets))&&void 0!==e?e:this.firstVisible(this.getAllTabbables());null==t||t.focus()}),{once:!0})}keepFocusWithinModal(e){if(this.modalTarget.contains(e.target)){if("Tab"===e.key){const t=this.getAllTabbables(),n=this.firstVisible(t),i=this.lastVisible(t);n&&i&&(n===i?(e.preventDefault(),n.focus()):e.shiftKey&&e.target===n?(e.preventDefault(),i.focus()):e.shiftKey||e.target!==i||(e.preventDefault(),n.focus()))}}else{const t=this.firstVisible(this.getAllTabbables());t&&(e.preventDefault(),t.focus())}}bindDocumentEvents(){this._boundClickFn=this._boundClickFn||this.hideOnOutsideClick.bind(this),this._boundKeypressFn=this._boundKeypressFn||this.hideOnEscapePress.bind(this),this._boundTabTrap=this._boundTabTrap||this.keepFocusWithinModal.bind(this),document.addEventListener("mousedown",this._boundClickFn),document.addEventListener("keyup",this._boundKeypressFn),document.addEventListener("keydown",this._boundTabTrap)}unbindDocumentEvents(){document.removeEventListener("mousedown",this._boundClickFn),document.removeEventListener("keyup",this._boundKeypressFn),document.removeEventListener("keydown",this._boundTabTrap)}hideOnOutsideClick(e){var t;const n=e.target;!(null===(t=this.modalTarget.querySelector(".s-modal--dialog"))||void 0===t?void 0:t.contains(n))&&document.body.contains(n)&&this._toggle(!1,e)}hideOnEscapePress(e){27===e.which&&"true"!==this.modalTarget.getAttribute("aria-hidden")&&this._toggle(!1,e)}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}}function ue(e){fe(e,!0)}function pe(e){fe(e,!1)}function fe(e,t){const n=G.getControllerForElementAndIdentifier(e,"s-modal");if(!n)throw"Unable to get s-modal controller from element";t?n.show():n.hide()}de.targets=["modal","initialFocus"];class me extends Q{connect(){super.connect(),this.boundSelectTab=this.selectTab.bind(this),this.boundHandleKeydown=this.handleKeydown.bind(this);for(const e of this.tabTargets)e.addEventListener("click",this.boundSelectTab),e.addEventListener("keydown",this.boundHandleKeydown)}disconnect(){super.disconnect();for(const e of this.tabTargets)e.removeEventListener("click",this.boundSelectTab),e.removeEventListener("keydown",this.boundHandleKeydown)}get tabTargets(){return Array.from(this.element.querySelectorAll("[role=tab]"))}selectTab(e){this.switchToTab(e.currentTarget)}handleKeydown(e){var t;let n=e.currentTarget;const i=this.tabTargets;let s=i.indexOf(n);if("ArrowRight"===e.key)s++;else{if("ArrowLeft"!==e.key)return;s--}s<0&&(s=i.length-1),s>=i.length&&(s=0),n=i[s],this.switchToTab(n),null===(t=this.selectedTab)||void 0===t||t.focus()}switchToTab(e){const t=this.selectedTab;t!==e&&(this.triggerEvent("select",{oldTab:t,newTab:e}).defaultPrevented||(this.selectedTab=e,this.triggerEvent("selected",{oldTab:t,newTab:e})))}get selectedTab(){return this.tabTargets.find((e=>"true"===e.getAttribute("aria-selected")))||null}set selectedTab(e){for(const t of this.tabTargets){const n=t.getAttribute("aria-controls"),i=n?document.getElementById(n):null;t===e?(t.classList.add("is-selected"),t.setAttribute("aria-selected","true"),t.removeAttribute("tabindex"),null==i||i.classList.remove("d-none")):(t.classList.remove("is-selected"),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1"),null==i||i.classList.add("d-none"))}}}function ge(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ve(e){return e instanceof ge(e).Element||e instanceof Element}function be(e){return e instanceof ge(e).HTMLElement||e instanceof HTMLElement}function ye(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ge(e).ShadowRoot||e instanceof ShadowRoot)}var Ee=Math.max,we=Math.min,Oe=Math.round;function Ae(){var e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function Te(){return!/^((?!chrome|android).)*safari/i.test(Ae())}function xe(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var i=e.getBoundingClientRect(),s=1,r=1;t&&be(e)&&(s=e.offsetWidth>0&&Oe(i.width)/e.offsetWidth||1,r=e.offsetHeight>0&&Oe(i.height)/e.offsetHeight||1);var o=(ve(e)?ge(e):window).visualViewport,a=!Te()&&n,l=(i.left+(a&&o?o.offsetLeft:0))/s,c=(i.top+(a&&o?o.offsetTop:0))/r,h=i.width/s,d=i.height/r;return{width:h,height:d,top:c,right:l+h,bottom:c+d,left:l,x:l,y:c}}function ke(e){var t=ge(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Ce(e){return e?(e.nodeName||"").toLowerCase():null}function Le(e){return((ve(e)?e.ownerDocument:e.document)||window.document).documentElement}function Me(e){return xe(Le(e)).left+ke(e).scrollLeft}function De(e){return ge(e).getComputedStyle(e)}function Se(e){var t=De(e),n=t.overflow,i=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+i)}function Fe(e,t,n){void 0===n&&(n=!1);var i,s,r=be(t),o=be(t)&&function(e){var t=e.getBoundingClientRect(),n=Oe(t.width)/e.offsetWidth||1,i=Oe(t.height)/e.offsetHeight||1;return 1!==n||1!==i}(t),a=Le(t),l=xe(e,o,n),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(r||!r&&!n)&&(("body"!==Ce(t)||Se(a))&&(c=(i=t)!==ge(i)&&be(i)?{scrollLeft:(s=i).scrollLeft,scrollTop:s.scrollTop}:ke(i)),be(t)?((h=xe(t,!0)).x+=t.clientLeft,h.y+=t.clientTop):a&&(h.x=Me(a))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function Be(e){var t=xe(e),n=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:i}}function Ne(e){return"html"===Ce(e)?e:e.assignedSlot||e.parentNode||(ye(e)?e.host:null)||Le(e)}function je(e){return["html","body","#document"].indexOf(Ce(e))>=0?e.ownerDocument.body:be(e)&&Se(e)?e:je(Ne(e))}function $e(e,t){var n;void 0===t&&(t=[]);var i=je(e),s=i===(null==(n=e.ownerDocument)?void 0:n.body),r=ge(i),o=s?[r].concat(r.visualViewport||[],Se(i)?i:[]):i,a=t.concat(o);return s?a:a.concat($e(Ne(o)))}function Ie(e){return["table","td","th"].indexOf(Ce(e))>=0}function Pe(e){return be(e)&&"fixed"!==De(e).position?e.offsetParent:null}function Ve(e){for(var t=ge(e),n=Pe(e);n&&Ie(n)&&"static"===De(n).position;)n=Pe(n);return n&&("html"===Ce(n)||"body"===Ce(n)&&"static"===De(n).position)?t:n||function(e){var t=/firefox/i.test(Ae());if(/Trident/i.test(Ae())&&be(e)&&"fixed"===De(e).position)return null;var n=Ne(e);for(ye(n)&&(n=n.host);be(n)&&["html","body"].indexOf(Ce(n))<0;){var i=De(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||t}var Ke="top",He="bottom",_e="right",Re="left",Ue="auto",We=[Ke,He,_e,Re],qe="start",ze="end",Je="viewport",Xe="popper",Ye=We.reduce((function(e,t){return e.concat([t+"-"+qe,t+"-"+ze])}),[]),Ze=[].concat(We,[Ue]).reduce((function(e,t){return e.concat([t,t+"-"+qe,t+"-"+ze])}),[]),Ge=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Qe(e){var t=new Map,n=new Set,i=[];function s(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var i=t.get(e);i&&s(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||s(e)})),i}var et={placement:"bottom",modifiers:[],strategy:"absolute"};function tt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function nt(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,i=void 0===n?[]:n,s=t.defaultOptions,r=void 0===s?et:s;return function(e,t,n){void 0===n&&(n=r);var s,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},et,r),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,h={state:a,setOptions:function(n){var s="function"==typeof n?n(a.options):n;d(),a.options=Object.assign({},r,a.options,s),a.scrollParents={reference:ve(e)?$e(e):e.contextElement?$e(e.contextElement):[],popper:$e(t)};var o,c,u=function(e){var t=Qe(e);return Ge.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}((o=[].concat(i,a.options.modifiers),c=o.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{}),Object.keys(c).map((function(e){return c[e]}))));return a.orderedModifiers=u.filter((function(e){return e.enabled})),a.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,i=void 0===n?{}:n,s=e.effect;if("function"==typeof s){var r=s({state:a,name:t,instance:h,options:i});l.push(r||function(){})}})),h.update()},forceUpdate:function(){if(!c){var e=a.elements,t=e.reference,n=e.popper;if(tt(t,n)){a.rects={reference:Fe(t,Ve(n),"fixed"===a.options.strategy),popper:Be(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(e){return a.modifiersData[e.name]=Object.assign({},e.data)}));for(var i=0;i<a.orderedModifiers.length;i++)if(!0!==a.reset){var s=a.orderedModifiers[i],r=s.fn,o=s.options,l=void 0===o?{}:o,d=s.name;"function"==typeof r&&(a=r({state:a,options:l,name:d,instance:h})||a)}else a.reset=!1,i=-1}}},update:(s=function(){return new Promise((function(e){h.forceUpdate(),e(a)}))},function(){return o||(o=new Promise((function(e){Promise.resolve().then((function(){o=void 0,e(s())}))}))),o}),destroy:function(){d(),c=!0}};if(!tt(e,t))return h;function d(){l.forEach((function(e){return e()})),l=[]}return h.setOptions(n).then((function(e){!c&&n.onFirstUpdate&&n.onFirstUpdate(e)})),h}}var it={passive:!0};function st(e){return e.split("-")[0]}function rt(e){return e.split("-")[1]}function ot(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function at(e){var t,n=e.reference,i=e.element,s=e.placement,r=s?st(s):null,o=s?rt(s):null,a=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2;switch(r){case Ke:t={x:a,y:n.y-i.height};break;case He:t={x:a,y:n.y+n.height};break;case _e:t={x:n.x+n.width,y:l};break;case Re:t={x:n.x-i.width,y:l};break;default:t={x:n.x,y:n.y}}var c=r?ot(r):null;if(null!=c){var h="y"===c?"height":"width";switch(o){case qe:t[c]=t[c]-(n[h]/2-i[h]/2);break;case ze:t[c]=t[c]+(n[h]/2-i[h]/2)}}return t}var lt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ct(e){var t,n=e.popper,i=e.popperRect,s=e.placement,r=e.variation,o=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,d=e.isFixed,u=o.x,p=void 0===u?0:u,f=o.y,m=void 0===f?0:f,g="function"==typeof h?h({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var v=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),y=Re,E=Ke,w=window;if(c){var O=Ve(n),A="clientHeight",T="clientWidth";O===ge(n)&&"static"!==De(O=Le(n)).position&&"absolute"===a&&(A="scrollHeight",T="scrollWidth"),(s===Ke||(s===Re||s===_e)&&r===ze)&&(E=He,m-=(d&&O===w&&w.visualViewport?w.visualViewport.height:O[A])-i.height,m*=l?1:-1),s!==Re&&(s!==Ke&&s!==He||r!==ze)||(y=_e,p-=(d&&O===w&&w.visualViewport?w.visualViewport.width:O[T])-i.width,p*=l?1:-1)}var x,k=Object.assign({position:a},c&<),C=!0===h?function(e){var t=e.x,n=e.y,i=window.devicePixelRatio||1;return{x:Oe(t*i)/i||0,y:Oe(n*i)/i||0}}({x:p,y:m}):{x:p,y:m};return p=C.x,m=C.y,l?Object.assign({},k,((x={})[E]=b?"0":"",x[y]=v?"0":"",x.transform=(w.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",x)):Object.assign({},k,((t={})[E]=b?m+"px":"",t[y]=v?p+"px":"",t.transform="",t))}var ht={left:"right",right:"left",bottom:"top",top:"bottom"};function dt(e){return e.replace(/left|right|bottom|top/g,(function(e){return ht[e]}))}var ut={start:"end",end:"start"};function pt(e){return e.replace(/start|end/g,(function(e){return ut[e]}))}function ft(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&ye(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function mt(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function gt(e,t,n){return t===Je?mt(function(e,t){var n=ge(e),i=Le(e),s=n.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=Te();(c||!c&&"fixed"===t)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+Me(e),y:l}}(e,n)):ve(t)?function(e,t){var n=xe(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):mt(function(e){var t,n=Le(e),i=ke(e),s=null==(t=e.ownerDocument)?void 0:t.body,r=Ee(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ee(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-i.scrollLeft+Me(e),l=-i.scrollTop;return"rtl"===De(s||n).direction&&(a+=Ee(n.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Le(e)))}function vt(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function bt(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function yt(e,t){void 0===t&&(t={});var n=t,i=n.placement,s=void 0===i?e.placement:i,r=n.strategy,o=void 0===r?e.strategy:r,a=n.boundary,l=void 0===a?"clippingParents":a,c=n.rootBoundary,h=void 0===c?Je:c,d=n.elementContext,u=void 0===d?Xe:d,p=n.altBoundary,f=void 0!==p&&p,m=n.padding,g=void 0===m?0:m,v=vt("number"!=typeof g?g:bt(g,We)),b=u===Xe?"reference":Xe,y=e.rects.popper,E=e.elements[f?b:u],w=function(e,t,n,i){var s="clippingParents"===t?function(e){var t=$e(Ne(e)),n=["absolute","fixed"].indexOf(De(e).position)>=0&&be(e)?Ve(e):e;return ve(n)?t.filter((function(e){return ve(e)&&ft(e,n)&&"body"!==Ce(e)})):[]}(e):[].concat(t),r=[].concat(s,[n]),o=r[0],a=r.reduce((function(t,n){var s=gt(e,n,i);return t.top=Ee(s.top,t.top),t.right=we(s.right,t.right),t.bottom=we(s.bottom,t.bottom),t.left=Ee(s.left,t.left),t}),gt(e,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(ve(E)?E:E.contextElement||Le(e.elements.popper),l,h,o),O=xe(e.elements.reference),A=at({reference:O,element:y,strategy:"absolute",placement:s}),T=mt(Object.assign({},y,A)),x=u===Xe?T:O,k={top:w.top-x.top+v.top,bottom:x.bottom-w.bottom+v.bottom,left:w.left-x.left+v.left,right:x.right-w.right+v.right},C=e.modifiersData.offset;if(u===Xe&&C){var L=C[s];Object.keys(k).forEach((function(e){var t=[_e,He].indexOf(e)>=0?1:-1,n=[Ke,He].indexOf(e)>=0?"y":"x";k[e]+=L[n]*t}))}return k}function Et(e,t,n){return Ee(e,we(t,n))}function wt(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Ot(e){return[Ke,_e,He,Re].some((function(t){return e[t]>=0}))}var At=nt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,i=e.options,s=i.scroll,r=void 0===s||s,o=i.resize,a=void 0===o||o,l=ge(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&c.forEach((function(e){e.addEventListener("scroll",n.update,it)})),a&&l.addEventListener("resize",n.update,it),function(){r&&c.forEach((function(e){e.removeEventListener("scroll",n.update,it)})),a&&l.removeEventListener("resize",n.update,it)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=at({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,i=n.gpuAcceleration,s=void 0===i||i,r=n.adaptive,o=void 0===r||r,a=n.roundOffsets,l=void 0===a||a,c={placement:st(t.placement),variation:rt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,ct(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,ct(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},i=t.attributes[e]||{},s=t.elements[e];be(s)&&Ce(s)&&(Object.assign(s.style,n),Object.keys(i).forEach((function(e){var t=i[e];!1===t?s.removeAttribute(e):s.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],s=t.attributes[e]||{},r=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});be(i)&&Ce(i)&&(Object.assign(i.style,r),Object.keys(s).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,i=e.name,s=n.offset,r=void 0===s?[0,0]:s,o=Ze.reduce((function(e,n){return e[n]=function(e,t,n){var i=st(e),s=[Re,Ke].indexOf(i)>=0?-1:1,r="function"==typeof n?n(Object.assign({},t,{placement:e})):n,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[Re,_e].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}(n,t.rects,r),e}),{}),a=o[t.placement],l=a.x,c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=o}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var s=n.mainAxis,r=void 0===s||s,o=n.altAxis,a=void 0===o||o,l=n.fallbackPlacements,c=n.padding,h=n.boundary,d=n.rootBoundary,u=n.altBoundary,p=n.flipVariations,f=void 0===p||p,m=n.allowedAutoPlacements,g=t.options.placement,v=st(g),b=l||(v!==g&&f?function(e){if(st(e)===Ue)return[];var t=dt(e);return[pt(e),t,pt(t)]}(g):[dt(g)]),y=[g].concat(b).reduce((function(e,n){return e.concat(st(n)===Ue?function(e,t){void 0===t&&(t={});var n=t,i=n.placement,s=n.boundary,r=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?Ze:l,h=rt(i),d=h?a?Ye:Ye.filter((function(e){return rt(e)===h})):We,u=d.filter((function(e){return c.indexOf(e)>=0}));0===u.length&&(u=d);var p=u.reduce((function(t,n){return t[n]=yt(e,{placement:n,boundary:s,rootBoundary:r,padding:o})[st(n)],t}),{});return Object.keys(p).sort((function(e,t){return p[e]-p[t]}))}(t,{placement:n,boundary:h,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:m}):n)}),[]),E=t.rects.reference,w=t.rects.popper,O=new Map,A=!0,T=y[0],x=0;x<y.length;x++){var k=y[x],C=st(k),L=rt(k)===qe,M=[Ke,He].indexOf(C)>=0,D=M?"width":"height",S=yt(t,{placement:k,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),F=M?L?_e:Re:L?He:Ke;E[D]>w[D]&&(F=dt(F));var B=dt(F),N=[];if(r&&N.push(S[C]<=0),a&&N.push(S[F]<=0,S[B]<=0),N.every((function(e){return e}))){T=k,A=!1;break}O.set(k,N)}if(A)for(var j=function(e){var t=y.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return T=t,"break"},$=f?3:1;$>0&&"break"!==j($);$--);t.placement!==T&&(t.modifiersData[i]._skip=!0,t.placement=T,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,i=e.name,s=n.mainAxis,r=void 0===s||s,o=n.altAxis,a=void 0!==o&&o,l=n.boundary,c=n.rootBoundary,h=n.altBoundary,d=n.padding,u=n.tether,p=void 0===u||u,f=n.tetherOffset,m=void 0===f?0:f,g=yt(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),v=st(t.placement),b=rt(t.placement),y=!b,E=ot(v),w="x"===E?"y":"x",O=t.modifiersData.popperOffsets,A=t.rects.reference,T=t.rects.popper,x="function"==typeof m?m(Object.assign({},t.rects,{placement:t.placement})):m,k="number"==typeof x?{mainAxis:x,altAxis:x}:Object.assign({mainAxis:0,altAxis:0},x),C=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(O){if(r){var M,D="y"===E?Ke:Re,S="y"===E?He:_e,F="y"===E?"height":"width",B=O[E],N=B+g[D],j=B-g[S],$=p?-T[F]/2:0,I=b===qe?A[F]:T[F],P=b===qe?-T[F]:-A[F],V=t.elements.arrow,K=p&&V?Be(V):{width:0,height:0},H=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},_=H[D],R=H[S],U=Et(0,A[F],K[F]),W=y?A[F]/2-$-U-_-k.mainAxis:I-U-_-k.mainAxis,q=y?-A[F]/2+$+U+R+k.mainAxis:P+U+R+k.mainAxis,z=t.elements.arrow&&Ve(t.elements.arrow),J=z?"y"===E?z.clientTop||0:z.clientLeft||0:0,X=null!=(M=null==C?void 0:C[E])?M:0,Y=B+q-X,Z=Et(p?we(N,B+W-X-J):N,B,p?Ee(j,Y):j);O[E]=Z,L[E]=Z-B}if(a){var G,Q="x"===E?Ke:Re,ee="x"===E?He:_e,te=O[w],ne="y"===w?"height":"width",ie=te+g[Q],se=te-g[ee],re=-1!==[Ke,Re].indexOf(v),oe=null!=(G=null==C?void 0:C[w])?G:0,ae=re?ie:te-A[ne]-T[ne]-oe+k.altAxis,le=re?te+A[ne]+T[ne]-oe-k.altAxis:se,ce=p&&re?function(e,t,n){var i=Et(e,t,n);return i>n?n:i}(ae,te,le):Et(p?ae:ie,te,p?le:se);O[w]=ce,L[w]=ce-te}t.modifiersData[i]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,i=e.name,s=e.options,r=n.elements.arrow,o=n.modifiersData.popperOffsets,a=st(n.placement),l=ot(a),c=[Re,_e].indexOf(a)>=0?"height":"width";if(r&&o){var h=function(e,t){return vt("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:bt(e,We))}(s.padding,n),d=Be(r),u="y"===l?Ke:Re,p="y"===l?He:_e,f=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],m=o[l]-n.rects.reference[l],g=Ve(r),v=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,b=f/2-m/2,y=h[u],E=v-d[c]-h[p],w=v/2-d[c]/2+b,O=Et(y,w,E),A=l;n.modifiersData[i]=((t={})[A]=O,t.centerOffset=O-w,t)}},effect:function(e){var t=e.state,n=e.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ft(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,i=t.rects.reference,s=t.rects.popper,r=t.modifiersData.preventOverflow,o=yt(t,{elementContext:"reference"}),a=yt(t,{altBoundary:!0}),l=wt(o,i),c=wt(a,s,r),h=Ot(l),d=Ot(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}}]});class Tt extends Q{get isVisible(){const e=this.popoverElement;return!!e&&e.classList.contains("is-visible")}get isInViewport(){const e=this.popoverElement;if(!this.isVisible||!e)return!1;const t=e.getBoundingClientRect(),n=Math.max(document.documentElement.clientHeight,window.innerHeight),i=Math.max(document.documentElement.clientWidth,window.innerWidth);return t.bottom>0&&t.top<n&&t.right>0&&t.left<i}get shouldHideOnOutsideClick(){switch(this.data.get("hide-on-outside-click")){case"after-dismissal":case"never":return!1;case"if-in-viewport":return this.isInViewport;default:return!0}}connect(){super.connect(),this.validate(),this.isVisible?this.initializePopper():"true"===this.data.get("auto-show")&&this.show(null),this.data.delete("auto-show")}disconnect(){this.hide(),this.popper&&(this.popper.destroy(),delete this.popper),super.disconnect()}toggle(e=null){this.isVisible?this.hide(e):this.show(e)}show(e=null){if(this.isVisible)return;const t=this.getDispatcher(e);this.triggerEvent("show",{dispatcher:t}).defaultPrevented||(this.popper||this.initializePopper(),this.popoverElement.classList.add("is-visible"),this.scheduleUpdate(),this.shown(t))}hide(e=null){if(!this.isVisible)return;const t=this.getDispatcher(e);this.triggerEvent("hide",{dispatcher:t}).defaultPrevented||(this.popoverElement.classList.remove("is-visible"),this.popper&&(this.popper.destroy(),delete this.popper),"after-dismissal"===this.data.get("hide-on-outside-click")&&this.data.delete("hide-on-outside-click"),this.hidden(t))}shown(e=null){this.bindDocumentEvents(),this.triggerEvent("shown",{dispatcher:e})}hidden(e=null){this.unbindDocumentEvents(),this.triggerEvent("hidden",{dispatcher:e})}generatePopover(){return null}initializePopper(){this.popper=At(this.referenceElement,this.popoverElement,{placement:this.data.get("placement")||"bottom",modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"arrow",options:{element:".s-popover--arrow"}}]})}validate(){const e=this.data.get("reference-selector");if(this.referenceElement=this.element,e&&(this.referenceElement=this.element.querySelector(e),!this.referenceElement))throw"Unable to find element by reference selector: "+e;const t=this.referenceElement.getAttribute(this.popoverSelectorAttribute);let n=null;if(t){if(n=document.getElementById(t),!n)throw`[${this.popoverSelectorAttribute}="{POPOVER_ID}"] required`}else n=this.generatePopover();if(!n)throw"unable to find or generate popover element";this.popoverElement=n}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}scheduleUpdate(){this.popper&&this.isVisible&&this.popper.update()}}class xt extends Tt{constructor(){super(...arguments),this.popoverSelectorAttribute="aria-controls"}shown(e=null){this.toggleOptionalClasses(!0),this.toggleAccessibilityAttributes(!0),super.shown(e)}hidden(e=null){this.toggleOptionalClasses(!1),this.toggleAccessibilityAttributes(!1),super.hidden(e)}connect(){super.connect(),this.toggleAccessibilityAttributes()}bindDocumentEvents(){this.boundHideOnOutsideClick=this.boundHideOnOutsideClick||this.hideOnOutsideClick.bind(this),this.boundHideOnEscapePress=this.boundHideOnEscapePress||this.hideOnEscapePress.bind(this),document.addEventListener("mousedown",this.boundHideOnOutsideClick),document.addEventListener("keyup",this.boundHideOnEscapePress)}unbindDocumentEvents(){document.removeEventListener("mousedown",this.boundHideOnOutsideClick),document.removeEventListener("keyup",this.boundHideOnEscapePress)}hideOnOutsideClick(e){const t=e.target;this.shouldHideOnOutsideClick&&!this.referenceElement.contains(t)&&!this.popoverElement.contains(t)&&document.body.contains(t)&&this.hide(e)}hideOnEscapePress(e){27===e.which&&this.isVisible&&(this.popoverElement.contains(e.target)&&this.referenceElement.focus(),this.hide(e))}toggleOptionalClasses(e){if(!this.data.has("toggle-class"))return;const t=this.data.get("toggle-class")||"",n=this.referenceElement.classList;t.split(/\s+/).forEach((function(t){n.toggle(t,e)}))}toggleAccessibilityAttributes(e){const t=(null==e?void 0:e.toString())||this.referenceElement.ariaExpanded||"false";this.referenceElement.ariaExpanded=t,this.referenceElement.setAttribute("aria-expanded",t)}}function kt(e){const{isPopover:t,controller:n}=Dt(e);if(n)n.show();else{if(!t)throw'element does not have data-controller="s-popover"';e.setAttribute("data-s-popover-auto-show","true")}}function Ct(e){const{isPopover:t,controller:n,popover:i}=Dt(e);if(n)n.hide();else{if(!t)throw'element does not have data-controller="s-popover"';e.removeAttribute("data-s-popover-auto-show"),i&&i.classList.remove("is-visible")}}function Lt(e,t,n){const{referenceElement:i,popover:s}=Dt(e);if(s)throw`element already has popover with id="${s.id}"`;if(!i)throw"element has invalid data-s-popover-reference-selector attribute";if("string"==typeof t){const e=document.createRange().createContextualFragment(t).children;if(1!==e.length)throw"popover should contain a single element";t=e[0]}const r=i.getAttribute("aria-controls");let o=t.id;if(!t.classList.contains("s-popover"))throw`popover should have the "s-popover" class but had class="${t.className}"`;if(r&&r!==o)throw`element has aria-controls="${r}" but popover has id="${o}"`;o||(o="--stacks-s-popover-"+Math.random().toString(36).substring(2,10),t.id=o),r||i.setAttribute("aria-controls",o),!t.parentElement&&e.parentElement&&i.insertAdjacentElement("afterend",t),St(e,"s-popover",!0),n&&(n.toggleOnClick&&i.setAttribute("data-action","click->s-popover#toggle"),n.placement&&e.setAttribute("data-s-popover-placement",n.placement),n.autoShow&&e.setAttribute("data-s-popover-auto-show","true"))}function Mt(e){const{isPopover:t,controller:n,referenceElement:i,popover:s}=Dt(e);return null==n||n.hide(),null==s||s.remove(),t&&(St(e,"s-popover",!1),i&&i.removeAttribute("aria-controls")),s}function Dt(e){var t;const n=(null===(t=e.getAttribute("data-controller"))||void 0===t?void 0:t.includes("s-popover"))||!1,i=G.getControllerForElementAndIdentifier(e,"s-popover"),s=e.getAttribute("data-s-popover-reference-selector"),r=s?e.querySelector(s):e,o=r?r.getAttribute("aria-controls"):null;return{isPopover:n,controller:i,referenceElement:r,popover:o?document.getElementById(o):null}}function St(e,t,n){var i;const s=new Set(null===(i=e.getAttribute("data-controller"))||void 0===i?void 0:i.split(/\s+/));n?s.add(t):s.delete(t),e.setAttribute("data-controller",Array.from(s).join(" "))}xt.targets=[];class Ft extends Q{setCurrentSort(e,t){if(["asc","desc","none"].indexOf(t)<0)throw"direction must be one of asc, desc, or none";const n=this;this.columnTargets.forEach((function(i){const s=i===e;i.classList.toggle("is-sorted",s&&"none"!==t),i.querySelectorAll(".js-sorting-indicator").forEach((function(e){const n=s?t:"none";e.classList.toggle("d-none",!e.classList.contains("js-sorting-indicator-"+n))})),s&&"none"!==t?n.setElementData(i,"sort-direction",t):n.removeElementData(i,"sort-direction")}))}sort(e){const t=this,n=e.currentTarget;if(!(n instanceof HTMLTableCellElement))throw"invalid event target";const i=this.element,s=i.tBodies[0],r=function(e){if(!(e.parentElement&&e.parentElement.parentElement instanceof HTMLTableSectionElement))throw"invalid table";const t=Bt(e.parentElement.parentElement,e);if("number"!=typeof t)throw"shouldn't happen";return t}(n);if(r<0)return;const o=function(e){const t=Bt(e);if(!(t instanceof Array))throw"shouldn't happen";return t}(s),a="asc"===this.getElementData(n,"sort-direction")?-1:1,l=Array.from(i.tBodies[0].rows);let c=!1;const h=[];let d;l.forEach((function(e,n){var i,s;const a=t.getElementData(e,"sort-to");if("top"===a)return;if("bottom"===a)return void(d||(d=e));const l=o[n][r];if(!l)return void h.push(["",n]);const u=t.getElementData(l,"sort-val"),p="string"==typeof u?u:null!==(s=null===(i=l.textContent)||void 0===i?void 0:i.trim())&&void 0!==s?s:"";""!==p&&`${parseInt(p,10)}`!==p&&(c=!0),h.push([p,n])})),c||h.forEach((function(e){e[0]=""===e[0]?Number.MIN_VALUE:parseInt(e[0],10)})),h.sort((function(e,t){return e[0]>t[0]?1*a:e[0]<t[0]?-1*a:e[1]>t[1]?1:-1})),h.forEach((function(e){var t;const n=l[e[1]];null===(t=n.parentElement)||void 0===t||t.removeChild(n),d?s.insertBefore(n,d):s.appendChild(n)})),this.setCurrentSort(n,1===a?"asc":"desc")}}function Bt(e,t){const n=[];let i=e.children[0];const s=[],r=[];for(;i||r.some((function(e){return 0!==e}));){const e=[];n.push(e);let o=0;if(i)for(let n=0;n<i.children.length;n++){for(;r[o];)r[o]--,e[o]=s[o],o++;const a=i.children[n];if(!(a instanceof HTMLTableCellElement))throw"invalid table";if("none"===getComputedStyle(a).display)continue;if(a===t)return o;const l=o+a.colSpan;for(;o<l;o++)r[o]=a.rowSpan-1,s[o]=a,e[o]=a}for(;o<s.length;)r[o]&&(r[o]--,e[o]=s[o]),o++;i&&(i=i.nextElementSibling)}return t?-1:n}Ft.targets=["column"];class Nt extends Q{connect(){this.validate()}disconnect(){this.unbindDocumentEvents()}toggle(e=null){this._toggle(void 0,e)}show(e=null){this._toggle(!0,e)}hide(e=null){this._toggle(!1,e)}validate(){const e=this.data.get("return-element");if(e&&(this.returnElement=document.querySelector(e),!this.returnElement))throw"Unable to find element by return-element selector: "+e}_toggle(e,t=null){let n=e;const i="false"===this.toastTarget.getAttribute("aria-hidden");if(void 0===n&&(n=!i),n&&i||!n&&!i)return;const s=this.getDispatcher(t),r=this.triggerEvent(n?"show":"hide",{returnElement:this.returnElement,dispatcher:this.getDispatcher(s)},this.toastTarget);r.defaultPrevented||(this.returnElement=r.detail.returnElement,this.toastTarget.setAttribute("aria-hidden",n?"false":"true"),n?(this.bindDocumentEvents(),this.hideAfterTimeout(),"true"!==this.data.get("prevent-focus-capture")&&this.focusInsideToast()):(this.unbindDocumentEvents(),this.focusReturnElement(),this.removeToastOnHide(),this.clearActiveTimeout()),void 0!==this.toastTarget.ontransitionend?this.toastTarget.addEventListener("transitionend",(()=>{this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.toastTarget)}),{once:!0}):this.triggerEvent(n?"shown":"hidden",{dispatcher:s},this.toastTarget))}focusReturnElement(){this.returnElement&&this.toastTarget.addEventListener("s-toast:hidden",(()=>{this.returnElement&&document.body.contains(this.returnElement)&&this.returnElement.focus()}),{once:!0})}removeToastOnHide(){"true"===this.data.get("remove-when-hidden")&&this.toastTarget.addEventListener("s-toast:hidden",(()=>{this.element.remove()}),{once:!0})}hideAfterTimeout(){if("true"===this.data.get("prevent-auto-hide")||"0"===this.data.get("hide-after-timeout"))return;const e=parseInt(this.data.get("hide-after-timeout"),10)||3e3;this.activeTimeout=window.setTimeout((()=>this.hide()),e)}clearActiveTimeout(){clearTimeout(this.activeTimeout)}getAllTabbables(){return Array.from(this.toastTarget.querySelectorAll("[href], input, select, textarea, button, [tabindex]")).filter((e=>e.matches(":not([disabled]):not([tabindex='-1'])")))}firstVisible(e){return null==e?void 0:e.find((e=>null!==e.offsetParent))}focusInsideToast(){this.toastTarget.addEventListener("s-toast:shown",(()=>{var e;const t=null!==(e=this.firstVisible(this.initialFocusTargets))&&void 0!==e?e:this.firstVisible(this.getAllTabbables());null==t||t.focus()}),{once:!0})}bindDocumentEvents(){this._boundClickFn=this._boundClickFn||this.hideOnOutsideClick.bind(this),this._boundKeypressFn=this._boundKeypressFn||this.hideOnEscapePress.bind(this),document.addEventListener("mousedown",this._boundClickFn),document.addEventListener("keyup",this._boundKeypressFn)}unbindDocumentEvents(){document.removeEventListener("mousedown",this._boundClickFn),document.removeEventListener("keyup",this._boundKeypressFn)}hideOnOutsideClick(e){var t;const n=e.target;!(null===(t=this.toastTarget)||void 0===t?void 0:t.contains(n))&&document.body.contains(n)&&"false"!==this.data.get("hide-on-outside-click")&&this._toggle(!1,e)}hideOnEscapePress(e){27===e.which&&"true"!==this.toastTarget.getAttribute("aria-hidden")&&this._toggle(!1,e)}getDispatcher(e=null){return e instanceof Event?e.target:e instanceof Element?e:this.element}}function jt(e){It(e,!0)}function $t(e){It(e,!1)}function It(e,t){const n=G.getControllerForElementAndIdentifier(e,"s-toast");if(!n)throw"Unable to get s-toast controller from element";t?n.show():n.hide()}Nt.targets=["toast","initialFocus"];class Pt extends Tt{constructor(){super(...arguments),this.popoverSelectorAttribute="aria-describedby"}connect(){super.connect(),window.matchMedia("(hover: hover)").matches&&this.bindMouseEvents(),this.bindKeyboardEvents()}disconnect(){this.unbindKeyboardEvents(),this.unbindMouseEvents(),super.disconnect()}show(e=null){const t=G.getControllerForElementAndIdentifier(this.element,"s-popover");t&&t.isVisible||super.show(e)}scheduleShow(e=null){window.clearTimeout(this.activeTimeout),this.activeTimeout=window.setTimeout((()=>this.show(e)),300)}scheduleHide(e=null){window.clearTimeout(this.activeTimeout),this.activeTimeout=window.setTimeout((()=>super.hide(e)),100)}clearActiveTimeout(){clearTimeout(this.activeTimeout)}applyTitleAttributes(){let e;const t=this.data.get("html-title");if(t)e=document.createRange().createContextualFragment(t);else{const t=this.element.getAttribute("title");if(!t)return null;e=document.createTextNode(t)}this.data.delete("html-title"),this.element.removeAttribute("title");let n=this.element.getAttribute("aria-describedby");n||(n=Pt.generateId(),this.element.setAttribute("aria-describedby",n));let i=document.getElementById(n);if(!i){i=document.createElement("div"),i.id=n,i.className="s-popover s-popover__tooltip",i.setAttribute("role","tooltip");const e=this.element.parentNode;e?e.insertBefore(i,this.element.nextSibling):document.body.appendChild(i)}const s=i.querySelector(".s-popover--arrow");return i.innerHTML="",i.appendChild(e),s?i.appendChild(s):i.insertAdjacentHTML("beforeend",'<div class="s-popover--arrow"></div>'),this.scheduleUpdate(),i}bindDocumentEvents(){this.boundHideIfWithin=this.boundHideIfWithin||this.hideIfWithin.bind(this),document.addEventListener("s-popover:shown",this.boundHideIfWithin)}unbindDocumentEvents(){document.removeEventListener("s-popover:shown",this.boundHideIfWithin)}generatePopover(){return this.applyTitleAttributes()}hideIfWithin(e){e.target.contains(this.referenceElement)&&this.scheduleHide()}hideOnEscapeKeyEvent(e){"Escape"===e.key&&this.scheduleHide()}bindKeyboardEvents(){this.boundScheduleShow=this.boundScheduleShow||this.scheduleShow.bind(this),this.boundHide=this.boundHide||this.scheduleHide.bind(this),this.boundHideOnEscapeKeyEvent=this.boundHideOnEscapeKeyEvent||this.hideOnEscapeKeyEvent.bind(this),this.referenceElement.addEventListener("focus",this.boundScheduleShow),this.referenceElement.addEventListener("blur",this.boundHide),document.addEventListener("keyup",this.boundHideOnEscapeKeyEvent)}unbindKeyboardEvents(){this.referenceElement.removeEventListener("focus",this.boundScheduleShow),this.referenceElement.removeEventListener("blur",this.boundHide),document.removeEventListener("keyup",this.boundHideOnEscapeKeyEvent)}bindMouseEvents(){this.boundScheduleShow=this.boundScheduleShow||this.scheduleShow.bind(this),this.boundHide=this.boundHide||this.scheduleHide.bind(this),this.boundClearActiveTimeout=this.boundClearActiveTimeout||this.clearActiveTimeout.bind(this),this.referenceElement.addEventListener("mouseover",this.boundScheduleShow),this.referenceElement.addEventListener("mouseout",this.boundHide),this.popoverElement.addEventListener("mouseover",this.boundClearActiveTimeout),this.popoverElement.addEventListener("mouseout",this.boundHide)}unbindMouseEvents(){this.referenceElement.removeEventListener("mouseover",this.boundScheduleShow),this.referenceElement.removeEventListener("mouseout",this.boundHide),this.referenceElement.removeEventListener("focus",this.boundScheduleShow),this.referenceElement.removeEventListener("blur",this.boundHide),this.popoverElement.removeEventListener("mouseover",this.boundClearActiveTimeout),this.popoverElement.removeEventListener("mouseout",this.boundHide)}static generateId(){return"--stacks-s-tooltip-"+Math.random().toString(36).substring(2,10)}}function Vt(e,t,n){e.setAttribute("data-s-tooltip-html-title",t),e.removeAttribute("title"),Ht(e,n)}function Kt(e,t,n){e.setAttribute("title",t),e.removeAttribute("data-s-tooltip-html-title"),Ht(e,n)}function Ht(e,t){t&&t.placement&&e.setAttribute("data-s-tooltip-placement",t.placement);const n=G.getControllerForElementAndIdentifier(e,"s-tooltip");if(n)n.applyTitleAttributes();else{const t=e.getAttribute("data-controller");e.setAttribute("data-controller",`${t||""} s-tooltip`)}}Pt.targets=[];class _t extends Q{connect(){super.connect(),this.boundDragEnter=this.handleUploaderActive.bind(this,!0),this.boundDragLeave=this.handleUploaderActive.bind(this,!1),this.inputTarget.addEventListener("dragenter",this.boundDragEnter),this.inputTarget.addEventListener("dragleave",this.boundDragLeave)}disconnect(){this.inputTarget.removeEventListener("dragenter",this.boundDragEnter),this.inputTarget.removeEventListener("dragleave",this.boundDragLeave),super.disconnect()}handleInput(){if(this.previewsTarget.innerHTML="",!this.inputTarget.files)return;const e=this.inputTarget.files.length;this.getDataURLs(this.inputTarget.files,_t.FILE_DISPLAY_LIMIT).then((t=>{if(this.handleVisible(!0),t.length>1){const n=document.createElement("div");n.classList.add("s-uploader--previews-heading"),n.innerText=t.length<e?`Showing ${t.length} of ${e} files`:`${e} items`,this.previewsTarget.appendChild(n),this.previewsTarget.classList.add("has-multiple")}else this.previewsTarget.classList.remove("has-multiple");t.forEach((e=>this.addFilePreview(e))),this.handleUploaderActive(!0)})).catch((()=>null))}reset(){this.inputTarget.value="",this.previewsTarget.innerHTML="",this.handleVisible(!1)}handleVisible(e){const{scope:t}=this.targets,n=t.findAllElements("[data-s-uploader-hide-on-input]"),i=t.findAllElements("[data-s-uploader-show-on-input]"),s=t.findAllElements("[data-s-uploader-enable-on-input]");e?(n.forEach((e=>{e.classList.add("d-none")})),i.forEach((e=>{e.classList.remove("d-none")})),s.forEach((e=>{e.removeAttribute("disabled")}))):(n.forEach((e=>{e.classList.remove("d-none")})),i.forEach((e=>{e.classList.add("d-none")})),s.forEach((e=>{e.setAttribute("disabled","true")})),this.handleUploaderActive(!1))}addFilePreview(e){if(!e)return;const t=document.createElement("div");let n;e.type.match("image/*")&&e.data?(n=document.createElement("img"),n.src=e.data.toString(),n.alt=e.name):(n=document.createElement("div"),n.innerText=e.name),n.classList.add("s-uploader--preview-thumbnail"),t.appendChild(n),t.classList.add("s-uploader--preview"),t.setAttribute("data-filename",e.name),this.previewsTarget.appendChild(t)}handleUploaderActive(e){this.uploaderTarget.classList.toggle("is-active",e)}fileToDataURL(e){const t=new FileReader,{name:n,size:i,type:s}=e;return i<_t.MAX_FILE_SIZE&&s.indexOf("image")>-1?new Promise(((i,r)=>{t.onload=e=>{var t;const o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.result;o?i({data:o,name:n,type:s}):r()},t.readAsDataURL(e)})):Promise.resolve({name:n,type:s})}getDataURLs(e,t){const n=Array.from(e).slice(0,Math.min(t,e.length)).map((e=>this.fileToDataURL(e)));return Promise.all(n)}}return _t.targets=["input","previews","uploader"],_t.FILE_DISPLAY_LIMIT=10,_t.MAX_FILE_SIZE=10485760,G.register("s-banner",ne),G.register("s-expandable-control",he),G.register("s-modal",de),G.register("s-toast",Nt),G.register("s-navigation-tablist",me),G.register("s-popover",xt),G.register("s-table",Ft),G.register("s-tooltip",Pt),G.register("s-uploader",_t),Z.finalize(),t})()));
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import type { TemplateResult } from "lit-html";
|
|
3
|
+
type Themes = ["light" | "dark" | "highcontrast" | ""];
|
|
4
|
+
type TestTypes = "visual" | "a11y";
|
|
5
|
+
type TestOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Enable tests for all color themes
|
|
8
|
+
* default: true
|
|
9
|
+
*/
|
|
10
|
+
testColorThemes: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enable tests for high contrast
|
|
13
|
+
* default: true
|
|
14
|
+
*/
|
|
15
|
+
testHighContrast: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Include tests for the component without any variants applied
|
|
18
|
+
* default: true
|
|
19
|
+
*/
|
|
20
|
+
includeNullVariant: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Include tests for the component without any modifiers applied
|
|
23
|
+
* default: true
|
|
24
|
+
*/
|
|
25
|
+
includeNullModifier: boolean;
|
|
26
|
+
};
|
|
27
|
+
interface ComponentTestVariationArgs {
|
|
28
|
+
/**
|
|
29
|
+
* Base class of the component
|
|
30
|
+
* (e.g. "s-component")
|
|
31
|
+
*/
|
|
32
|
+
baseClass: string;
|
|
33
|
+
/**
|
|
34
|
+
* Variants of the component
|
|
35
|
+
* (e.g. ["primary", "secondary"])
|
|
36
|
+
*/
|
|
37
|
+
variants?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Modifiers of the component
|
|
40
|
+
* (e.g. { primary: ["filled", "outlined"], secondary: ["xs", "sm", "md"] })
|
|
41
|
+
*/
|
|
42
|
+
modifiers?: ComponentTestModifiers;
|
|
43
|
+
/**
|
|
44
|
+
* Options for the test
|
|
45
|
+
*/
|
|
46
|
+
options?: TestOptions;
|
|
47
|
+
}
|
|
48
|
+
type ComponentTestArgs = {
|
|
49
|
+
/**
|
|
50
|
+
* The element to test
|
|
51
|
+
* use the `html` template tag to render the element
|
|
52
|
+
*/
|
|
53
|
+
element: TemplateResult;
|
|
54
|
+
/**
|
|
55
|
+
* testid of the test
|
|
56
|
+
* (e.g. "s-component-primary-important")
|
|
57
|
+
*/
|
|
58
|
+
testid: string;
|
|
59
|
+
/**
|
|
60
|
+
* Theme to apply to the test element
|
|
61
|
+
*/
|
|
62
|
+
theme?: Themes;
|
|
63
|
+
/**
|
|
64
|
+
* Type of test to run
|
|
65
|
+
*/
|
|
66
|
+
type: TestTypes;
|
|
67
|
+
};
|
|
68
|
+
interface ComponentTestsArgs extends ComponentTestVariationArgs {
|
|
69
|
+
/**
|
|
70
|
+
* Additional html attributes applied to the test element
|
|
71
|
+
* (e.g. { role: "button", id: "id" } -> <element role="button" id="id"> )
|
|
72
|
+
*/
|
|
73
|
+
attributes?: Record<string, string>;
|
|
74
|
+
/**
|
|
75
|
+
* Child elements to render inside the test element
|
|
76
|
+
* (if key `default` is used, the testid will not include the child name)
|
|
77
|
+
*/
|
|
78
|
+
children?: {
|
|
79
|
+
[key: string]: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* testids of tests to exclude from testing
|
|
83
|
+
*/
|
|
84
|
+
excludedTestids?: (string | RegExp)[];
|
|
85
|
+
/**
|
|
86
|
+
* testids of tests to skip
|
|
87
|
+
*/
|
|
88
|
+
skippedTestids?: (string | RegExp)[];
|
|
89
|
+
/**
|
|
90
|
+
* HTML tag name of the test element
|
|
91
|
+
*/
|
|
92
|
+
tag?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Function that returns a template for the test element
|
|
95
|
+
* used to wrap the component test element in a container
|
|
96
|
+
*/
|
|
97
|
+
template?: (args: {
|
|
98
|
+
component: unknown;
|
|
99
|
+
tag?: string;
|
|
100
|
+
testid: string;
|
|
101
|
+
}) => ReturnType<typeof html>;
|
|
102
|
+
/**
|
|
103
|
+
* Type of test to run
|
|
104
|
+
*/
|
|
105
|
+
type: TestTypes;
|
|
106
|
+
}
|
|
107
|
+
type ComponentTestModifiers = {
|
|
108
|
+
/**
|
|
109
|
+
* Primary grouping of modifiers to test
|
|
110
|
+
* The base class will be used as a prefix for these modifiers
|
|
111
|
+
*/
|
|
112
|
+
primary?: string[];
|
|
113
|
+
/**
|
|
114
|
+
* Secondary grouping of modifiers to test
|
|
115
|
+
* The base class will be used as a prefix for these modifiers
|
|
116
|
+
*/
|
|
117
|
+
secondary?: string[];
|
|
118
|
+
/**
|
|
119
|
+
* Grouping of modifers to test that will not be prefixed with the base class
|
|
120
|
+
*/
|
|
121
|
+
global?: string[];
|
|
122
|
+
/**
|
|
123
|
+
* Modifiers to test individually
|
|
124
|
+
* The base class will be used as a prefix for these modifiers
|
|
125
|
+
*/
|
|
126
|
+
standalone?: string[];
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Constructs and runs an individual test for a component
|
|
130
|
+
*/
|
|
131
|
+
declare const runComponentTest: ({ element, testid, theme, type, }: ComponentTestArgs) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Constructs and runs tests for a component with a each provided combination
|
|
134
|
+
*/
|
|
135
|
+
declare const runComponentTests: ({ baseClass, variants, modifiers, options, attributes, children, excludedTestids, skippedTestids, tag, template, type, }: ComponentTestsArgs) => void;
|
|
136
|
+
export { runComponentTest, runComponentTests };
|