From cd15604a95e0bb4434a98c9d7ab27746c3a19a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Fr=C3=B3es=20Ferr=C3=A3o?= Date: Mon, 13 Feb 2023 01:19:47 -0300 Subject: [PATCH 1/2] Popped elements from targets variable to avoid duplication and be able to send Matrix data to the Listener's asyncMethod. --- resources/js/controllers/listener_controller.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/js/controllers/listener_controller.js b/resources/js/controllers/listener_controller.js index f22020e736..83deb50966 100644 --- a/resources/js/controllers/listener_controller.js +++ b/resources/js/controllers/listener_controller.js @@ -31,6 +31,11 @@ export default class extends ApplicationController { targets.forEach(name => document.querySelectorAll(`[name="${name}"]`) .forEach((field) => { + let fieldIndex = targets.findIndex(i => i === field.name); + + if (fieldIndex > -1) { + targets.splice(fieldIndex, 1); + } if ((field.type === 'checkbox' || field.type === 'radio') && !field.checked) { return; @@ -43,7 +48,10 @@ export default class extends ApplicationController { } else { params.append(name, field.value); } - })); + }) + ); + + targets.forEach(name => document.querySelectorAll(`[id^="matrix-field-${name}"]`).forEach(e => params.append(e.name, e.value))); this.asyncLoadData(params).then(() => { document.dispatchEvent( From d82d5b79e010d1c814fd3059f4175d3024b7b78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Fr=C3=B3es=20Ferr=C3=A3o?= Date: Mon, 13 Feb 2023 01:25:34 -0300 Subject: [PATCH 2/2] Recompiling production assets. --- public/js/manifest.js | 2 +- public/js/orchid.js | 8 ++++---- public/js/vendor.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/manifest.js b/public/js/manifest.js index 6aa5e41dac..1d99b2158d 100644 --- a/public/js/manifest.js +++ b/public/js/manifest.js @@ -1 +1 @@ -(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return r[e].call(i.exports,i,i.exports,o),i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(s=0;s=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i0&&e[s-1][2]>i;s--)e[s]=e[s-1];e[s]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={929:0,251:0,756:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[l,a,u]=t,f=0;if(l.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(u)var s=u(o)}for(r&&r(t);f{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(s=0;s=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i0&&e[s-1][2]>i;s--)e[s]=e[s-1];e[s]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={929:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[l,a,u]=t,f=0;if(l.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(u)var s=u(o)}for(r&&r(t);f{"use strict";r.d(e,{Mx:()=>J,Qr:()=>ot});class n{constructor(t,e,r){this.eventTarget=t,this.eventName=e,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=function(t){if("immediatePropagationStopped"in t)return t;{const{stopImmediatePropagation:e}=t;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}(t);for(const t of this.bindings){if(e.immediatePropagationStopped)break;t.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((t,e)=>{const r=t.index,n=e.index;return rn?1:0}))}}class o{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((t=>t.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((t=>t.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((t,e)=>t.concat(Array.from(e.values()))),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,r={}){this.application.handleError(t,`Error ${e}`,r)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:r,eventOptions:n}=t,o=this.fetchEventListenerMapForEventTarget(e),i=this.cacheKey(r,n);o.delete(i),0==o.size&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:r,eventOptions:n}=t;return this.fetchEventListener(e,r,n)}fetchEventListener(t,e,r){const n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(e,r);let i=n.get(o);return i||(i=this.createEventListener(t,e,r),n.set(o,i)),i}createEventListener(t,e,r){const o=new n(t,e,r);return this.started&&o.connect(),o}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const r=[t];return Object.keys(e).sort().forEach((t=>{r.push(`${e[t]?"":"!"}${t}`)})),r.join(":")}}const i={stop:({event:t,value:e})=>(e&&t.stopPropagation(),!0),prevent:({event:t,value:e})=>(e&&t.preventDefault(),!0),self:({event:t,value:e,element:r})=>!e||r===t.target},s=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function a(t){return"window"==t?window:"document"==t?document:void 0}function c(t){return t.replace(/(?:[_-])([a-z0-9])/g,((t,e)=>e.toUpperCase()))}function l(t){return c(t.replace(/--/g,"-").replace(/__/g,"_"))}function u(t){return t.charAt(0).toUpperCase()+t.slice(1)}function f(t){return t.replace(/([A-Z])/g,((t,e)=>`-${e.toLowerCase()}`))}class h{constructor(t,e,r,n){this.element=t,this.index=e,this.eventTarget=r.eventTarget||t,this.eventName=r.eventName||function(t){const e=t.tagName.toLowerCase();if(e in p)return p[e](t)}(t)||d("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||d("missing identifier"),this.methodName=r.methodName||d("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=n}static forToken(t,e){return new this(t.element,t.index,function(t){const e=t.trim().match(s)||[];let r=e[1],n=e[2];return n&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${n}`,n=""),{eventTarget:a(e[3]),eventName:r,eventOptions:e[6]?(o=e[6],o.split(":").reduce(((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)})),{})):{},identifier:e[4],methodName:e[5],keyFilter:n};var o}(t.content),e)}toString(){const t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}isFilterTarget(t){if(!this.keyFilter)return!1;const e=this.keyFilter.split("+"),r=["meta","ctrl","alt","shift"],[n,o,i,s]=r.map((t=>e.includes(t)));if(t.metaKey!==n||t.ctrlKey!==o||t.altKey!==i||t.shiftKey!==s)return!0;const a=e.filter((t=>!r.includes(t)))[0];return!!a&&(Object.prototype.hasOwnProperty.call(this.keyMappings,a)||d(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[a].toLowerCase()!==t.key.toLowerCase())}get params(){const t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:r,value:n}of Array.from(this.element.attributes)){const o=r.match(e),i=o&&o[1];i&&(t[c(i)]=m(n))}return t}get eventTargetName(){return(t=this.eventTarget)==window?"window":t==document?"document":void 0;var t}get keyMappings(){return this.schema.keyMappings}}const p={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:t=>"submit"==t.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function d(t){throw new Error(t)}function m(t){try{return JSON.parse(t)}catch(e){return t}}class y{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(t){this.willBeInvokedByEvent(t)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){const t=this.controller[this.methodName];if("function"==typeof t)return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){const{element:e}=this.action,{actionDescriptorFilters:r}=this.context.application;let n=!0;for(const[o,i]of Object.entries(this.eventOptions))if(o in r){const s=r[o];n=n&&s({name:o,value:i,event:t,element:e})}return n}invokeWithEvent(t){const{target:e,currentTarget:r}=t;try{const{params:n}=this.action,o=Object.assign(t,{params:n});this.method.call(this.controller,o),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:r,action:this.methodName})}catch(e){const{identifier:r,controller:n,element:o,index:i}=this,s={identifier:r,controller:n,element:o,index:i,event:t};this.context.handleError(e,`invoking action "${this.action}"`,s)}}willBeInvokedByEvent(t){const e=t.target;return!(t instanceof KeyboardEvent&&this.action.isFilterTarget(t))&&(this.element===e||(e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class g{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){const t=new Set(this.matchElementsInTree());for(const e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(const e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){"attributes"==t.type?this.processAttributeChange(t.target,t.attributeName):"childList"==t.type&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){const r=t;this.elements.has(r)?this.delegate.elementAttributeChanged&&this.matchElement(r)?this.delegate.elementAttributeChanged(r,e):this.removeElement(r):this.matchElement(r)&&this.addElement(r)}processRemovedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.processTree(t,this.removeElement)}}processAddedNodes(t){for(const e of Array.from(t)){const t=this.elementFromNode(e);t&&this.elementIsActive(t)&&this.processTree(t,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(const r of this.matchElementsInTree(t))e.call(this,r)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected==this.element.isConnected&&this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}}class b{constructor(t,e,r){this.attributeName=e,this.delegate=r,this.elementObserver=new g(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],r=Array.from(t.querySelectorAll(this.selector));return e.concat(r)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}}function v(t,e,r){S(t,e).add(r)}function w(t,e,r){S(t,e).delete(r),function(t,e){const r=t.get(e);null!=r&&0==r.size&&t.delete(e)}(t,e)}function S(t,e){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r}class O{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t.concat(Array.from(e))),[])}get size(){return Array.from(this.valuesByKey.values()).reduce(((t,e)=>t+e.size),0)}add(t,e){v(this.valuesByKey,t,e)}delete(t,e){w(this.valuesByKey,t,e)}has(t,e){const r=this.valuesByKey.get(t);return null!=r&&r.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some((e=>e.has(t)))}getValuesForKey(t){const e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter((([e,r])=>r.has(t))).map((([t,e])=>t))}}class E{constructor(t,e,r,n={}){this.selector=e,this.details=n,this.elementObserver=new g(t,this),this.delegate=r,this.matchesByElement=new O}get started(){return this.elementObserver.started}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){const e=t.matches(this.selector);return this.delegate.selectorMatchElement?e&&this.delegate.selectorMatchElement(t,this.details):e}matchElementsInTree(t){const e=this.matchElement(t)?[t]:[],r=Array.from(t.querySelectorAll(this.selector)).filter((t=>this.matchElement(t)));return e.concat(r)}elementMatched(t){this.selectorMatched(t)}elementUnmatched(t){this.selectorUnmatched(t)}elementAttributeChanged(t,e){const r=this.matchElement(t),n=this.matchesByElement.has(this.selector,t);!r&&n&&this.selectorUnmatched(t)}selectorMatched(t){this.delegate.selectorMatched&&(this.delegate.selectorMatched(t,this.selector,this.details),this.matchesByElement.add(this.selector,t))}selectorUnmatched(t){this.delegate.selectorUnmatched(t,this.selector,this.details),this.matchesByElement.delete(this.selector,t)}}class P{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((t=>this.processMutations(t)))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(const t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(const e of t)this.processMutation(e)}processMutation(t){const e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){const r=this.delegate.getStringMapKeyForAttribute(t);if(null!=r){this.stringMap.has(t)||this.stringMapKeyAdded(r,t);const n=this.element.getAttribute(t);if(this.stringMap.get(t)!=n&&this.stringMapValueChanged(n,r,e),null==n){const e=this.stringMap.get(t);this.stringMap.delete(t),e&&this.stringMapKeyRemoved(r,t,e)}else this.stringMap.set(t,n)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,r)}stringMapKeyRemoved(t,e,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((t=>t.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class A{constructor(t,e,r){this.attributeObserver=new b(t,e,this),this.delegate=r,this.tokensByElement=new O}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){const[e,r]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(r)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}tokensMatched(t){t.forEach((t=>this.tokenMatched(t)))}tokensUnmatched(t){t.forEach((t=>this.tokenUnmatched(t)))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){const e=this.tokensByElement.getValuesForKey(t),r=this.readTokensForElement(t),n=function(t,e){const r=Math.max(t.length,e.length);return Array.from({length:r},((r,n)=>[t[n],e[n]]))}(e,r).findIndex((([t,e])=>{return n=e,!((r=t)&&n&&r.index==n.index&&r.content==n.content);var r,n}));return-1==n?[[],[]]:[e.slice(n),r.slice(n)]}readTokensForElement(t){const e=this.attributeName;return function(t,e,r){return t.trim().split(/\s+/).filter((t=>t.length)).map(((t,n)=>({element:e,attributeName:r,content:t,index:n})))}(t.getAttribute(e)||"",t,e)}}class j{constructor(t,e,r){this.tokenListObserver=new A(t,e,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){const{element:e}=t,{value:r}=this.fetchParseResultForToken(t);r&&(this.fetchValuesByTokenForElement(e).set(t,r),this.delegate.elementMatchedValue(e,r))}tokenUnmatched(t){const{element:e}=t,{value:r}=this.fetchParseResultForToken(t);r&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,r))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(t){return{error:t}}}}class R{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new j(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){const e=new y(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){const e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}disconnectAllActions(){this.bindings.forEach((t=>this.delegate.bindingDisconnected(t,!0))),this.bindingsByAction.clear()}parseValueForToken(t){const e=h.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}}class k{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new P(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){const r=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,r.writer(this.receiver[t]),r.writer(r.defaultValue))}stringMapValueChanged(t,e,r){const n=this.valueDescriptorNameMap[e];null!==t&&(null===r&&(r=n.writer(n.defaultValue)),this.invokeChangedCallback(e,t,r))}stringMapKeyRemoved(t,e,r){const n=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,n.writer(this.receiver[t]),r):this.invokeChangedCallback(t,n.writer(n.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:t,name:e,defaultValue:r,writer:n}of this.valueDescriptors)null==r||this.controller.data.has(t)||this.invokeChangedCallback(e,n(r),void 0)}invokeChangedCallback(t,e,r){const n=`${t}Changed`,o=this.receiver[n];if("function"==typeof o){const n=this.valueDescriptorNameMap[t];try{const t=n.reader(e);let i=r;r&&(i=n.reader(r)),o.call(this.receiver,t,i)}catch(t){throw t instanceof TypeError&&(t.message=`Stimulus Value "${this.context.identifier}.${n.name}" - ${t.message}`),t}}}get valueDescriptors(){const{valueDescriptorMap:t}=this;return Object.keys(t).map((e=>t[e]))}get valueDescriptorNameMap(){const t={};return Object.keys(this.valueDescriptorMap).forEach((e=>{const r=this.valueDescriptorMap[e];t[r.name]=r})),t}hasValue(t){const e=`has${u(this.valueDescriptorNameMap[t].name)}`;return this.receiver[e]}}class T{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new O}start(){this.tokenListObserver||(this.tokenListObserver=new A(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var r;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetConnected(t,e))))}disconnectTarget(t,e){var r;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetDisconnected(t,e))))}disconnectAllTargets(){for(const t of this.targetsByName.keys)for(const e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function C(t,e){const r=x(t);return Array.from(r.reduce(((t,r)=>(function(t,e){const r=t[e];return Array.isArray(r)?r:[]}(r,e).forEach((e=>t.add(e))),t)),new Set))}function L(t,e){return x(t).reduce(((t,r)=>(t.push(...function(t,e){const r=t[e];return r?Object.keys(r).map((t=>[t,r[t]])):[]}(r,e)),t)),[])}function x(t){const e=[];for(;t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}class M{constructor(t,e){this.context=t,this.delegate=e,this.outletsByName=new O,this.outletElementsByName=new O,this.selectorObserverMap=new Map}start(){0===this.selectorObserverMap.size&&(this.outletDefinitions.forEach((t=>{const e=this.selector(t),r={outletName:t};e&&this.selectorObserverMap.set(t,new E(document.body,e,this,r))})),this.selectorObserverMap.forEach((t=>t.start()))),this.dependentContexts.forEach((t=>t.refresh()))}stop(){this.selectorObserverMap.size>0&&(this.disconnectAllOutlets(),this.selectorObserverMap.forEach((t=>t.stop())),this.selectorObserverMap.clear())}refresh(){this.selectorObserverMap.forEach((t=>t.refresh()))}selectorMatched(t,e,{outletName:r}){const n=this.getOutlet(t,r);n&&this.connectOutlet(n,t,r)}selectorUnmatched(t,e,{outletName:r}){const n=this.getOutletFromMap(t,r);n&&this.disconnectOutlet(n,t,r)}selectorMatchElement(t,{outletName:e}){return this.hasOutlet(t,e)&&t.matches(`[${this.context.application.schema.controllerAttribute}~=${e}]`)}connectOutlet(t,e,r){var n;this.outletElementsByName.has(r,e)||(this.outletsByName.add(r,t),this.outletElementsByName.add(r,e),null===(n=this.selectorObserverMap.get(r))||void 0===n||n.pause((()=>this.delegate.outletConnected(t,e,r))))}disconnectOutlet(t,e,r){var n;this.outletElementsByName.has(r,e)&&(this.outletsByName.delete(r,t),this.outletElementsByName.delete(r,e),null===(n=this.selectorObserverMap.get(r))||void 0===n||n.pause((()=>this.delegate.outletDisconnected(t,e,r))))}disconnectAllOutlets(){for(const t of this.outletElementsByName.keys)for(const e of this.outletElementsByName.getValuesForKey(t))for(const r of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(r,e,t)}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}get outletDependencies(){const t=new O;return this.router.modules.forEach((e=>{C(e.definition.controllerConstructor,"outlets").forEach((r=>t.add(r,e.identifier)))})),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const t=this.dependentControllerIdentifiers;return this.router.contexts.filter((e=>t.includes(e.identifier)))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find((e=>e.element===t))}get scope(){return this.context.scope}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class _{constructor(t,e){this.logDebugActivity=(t,e={})=>{const{identifier:r,controller:n,element:o}=this;e=Object.assign({identifier:r,controller:n,element:o},e),this.application.logDebugActivity(this.identifier,t,e)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new R(this,this.dispatcher),this.valueObserver=new k(this,this.controller),this.targetObserver=new T(this,this),this.outletObserver=new M(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(t){this.handleError(t,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,r={}){const{identifier:n,controller:o,element:i}=this;r=Object.assign({identifier:n,controller:o,element:i},r),this.application.handleError(t,`Error ${e}`,r)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,r){this.invokeControllerMethod(`${l(r)}OutletConnected`,t,e)}outletDisconnected(t,e,r){this.invokeControllerMethod(`${l(r)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){const r=this.controller;"function"==typeof r[t]&&r[t](...e)}}function B(t){return function(t,e){const r=I(t),n=function(t,e){return F(e).reduce(((r,n)=>{const o=function(t,e,r){const n=Object.getOwnPropertyDescriptor(t,r);if(!n||!("value"in n)){const t=Object.getOwnPropertyDescriptor(e,r).value;return n&&(t.get=n.get||t.get,t.set=n.set||t.set),t}}(t,e,n);return o&&Object.assign(r,{[n]:o}),r}),{})}(t.prototype,e);return Object.defineProperties(r.prototype,n),r}(t,function(t){const e=C(t,"blessings");return e.reduce(((e,r)=>{const n=r(t);for(const t in n){const r=e[t]||{};e[t]=Object.assign(r,n[t])}return e}),{})}(t))}const F="function"==typeof Object.getOwnPropertySymbols?t=>[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)]:Object.getOwnPropertyNames,I=(()=>{function t(t){function e(){return Reflect.construct(t,arguments,new.target)}return e.prototype=Object.create(t.prototype,{constructor:{value:e}}),Reflect.setPrototypeOf(e,t),e}try{return function(){const e=t((function(){this.a.call(this)}));e.prototype.a=function(){},new e}(),t}catch(t){return t=>class extends t{}}})();class N{constructor(t,e){this.application=t,this.definition=function(t){return{identifier:t.identifier,controllerConstructor:B(t.controllerConstructor)}}(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){const e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){const e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new _(this,t),this.contextsByScope.set(t,e)),e}}class D{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){const e=this.data.get(this.getDataKey(t))||"";return e.match(/[^\s]+/g)||[]}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}}class q{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){const e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){const r=this.getAttributeNameForKey(t);return this.element.setAttribute(r,e),this.get(t)}has(t){const e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){const e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${f(t)}`}}class H{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,r){let n=this.warnedKeysByObject.get(t);n||(n=new Set,this.warnedKeysByObject.set(t,n)),n.has(e)||(n.add(e),this.logger.warn(r,t))}}function U(t,e){return`[${t}~="${e}"]`}class Z{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findTarget(e)||this.findLegacyTarget(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllTargets(e),...this.findAllLegacyTargets(e)]),[])}findTarget(t){const e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){const e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){return U(this.schema.targetAttributeForScope(this.identifier),t)}findLegacyTarget(t){const e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){const e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map((e=>this.deprecate(e,t)))}getLegacySelectorForTargetName(t){const e=`${this.identifier}.${t}`;return U(this.schema.targetAttribute,e)}deprecate(t,e){if(t){const{identifier:r}=this,n=this.schema.targetAttribute,o=this.schema.targetAttributeForScope(r);this.guide.warn(t,`target:${e}`,`Please replace ${n}="${r}.${e}" with ${o}="${e}". The ${n} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}}class V{constructor(t,e){this.scope=t,this.controllerElement=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return null!=this.find(t)}find(...t){return t.reduce(((t,e)=>t||this.findOutlet(e)),void 0)}findAll(...t){return t.reduce(((t,e)=>[...t,...this.findAllOutlets(e)]),[])}getSelectorForOutletName(t){const e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){const e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){const e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter((r=>this.matchesElement(r,t,e)))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter((r=>this.matchesElement(r,t,e)))}matchesElement(t,e,r){const n=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&n.split(" ").includes(r)}}class W{constructor(t,e,r,n){this.targets=new Z(this),this.classes=new D(this),this.data=new q(this),this.containsElement=t=>t.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=r,this.guide=new H(n),this.outlets=new V(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return U(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new W(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class ${constructor(t,e,r){this.element=t,this.schema=e,this.delegate=r,this.valueListObserver=new j(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){const{element:e,content:r}=t,n=this.fetchScopesByIdentifierForElement(e);let o=n.get(r);return o||(o=this.delegate.createScopeForElementAndIdentifier(e,r),n.set(r,o)),o}elementMatchedValue(t,e){const r=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,r),1==r&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){const r=this.scopeReferenceCounts.get(e);r&&(this.scopeReferenceCounts.set(e,r-1),1==r&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}}class z{constructor(t){this.application=t,this.scopeObserver=new $(this.element,this.schema,this),this.scopesByIdentifier=new O,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((t,e)=>t.concat(e.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);const e=new N(this.application,t);this.connectModule(e);const r=t.controllerConstructor.afterLoad;r&&r(t.identifier,this.application)}unloadIdentifier(t){const e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){const r=this.modulesByIdentifier.get(e);if(r)return r.contexts.find((e=>e.element==t))}handleError(t,e,r){this.application.handleError(t,e,r)}createScopeForElementAndIdentifier(t,e){return new W(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);const e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}connectModule(t){this.modulesByIdentifier.set(t.identifier,t);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.connectContextForScope(e)))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier);this.scopesByIdentifier.getValuesForKey(t.identifier).forEach((e=>t.disconnectContextForScope(e)))}}const K={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:t=>`data-${t}-target`,outletAttributeForScope:(t,e)=>`data-${t}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End"},Y("abcdefghijklmnopqrstuvwxyz".split("").map((t=>[t,t])))),Y("0123456789".split("").map((t=>[t,t]))))};function Y(t){return t.reduce(((t,[e,r])=>Object.assign(Object.assign({},t),{[e]:r})),{})}class J{constructor(t=document.documentElement,e=K){this.logger=console,this.debug=!1,this.logDebugActivity=(t,e,r={})=>{this.debug&&this.logFormattedMessage(t,e,r)},this.element=t,this.schema=e,this.dispatcher=new o(this),this.router=new z(this),this.actionDescriptorFilters=Object.assign({},i)}static start(t,e){const r=new this(t,e);return r.start(),r}async start(){await new Promise((t=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>t())):t()})),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>{t.controllerConstructor.shouldLoad&&this.router.loadDefinition(t)}))}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach((t=>this.router.unloadIdentifier(t)))}get controllers(){return this.router.contexts.map((t=>t.controller))}getControllerForElementAndIdentifier(t,e){const r=this.router.getContextForElementAndIdentifier(t,e);return r?r.controller:null}handleError(t,e,r){var n;this.logger.error("%s\n\n%o\n\n%o",e,t,r),null===(n=window.onerror)||void 0===n||n.call(window,e,"",0,0,t)}logFormattedMessage(t,e,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}}function Q([t,e],r){return function(t){const e=`${f(t.token)}-value`,r=function(t){const e=function(t){const e=G(t.typeObject.type);if(!e)return;const r=X(t.typeObject.default);if(e!==r){const n=t.controller?`${t.controller}.${t.token}`:t.token;throw new Error(`The specified default value for the Stimulus Value "${n}" must match the defined type "${e}". The provided default value of "${t.typeObject.default}" is of type "${r}".`)}return e}({controller:t.controller,token:t.token,typeObject:t.typeDefinition}),r=X(t.typeDefinition),n=G(t.typeDefinition),o=e||r||n;if(o)return o;const i=t.controller?`${t.controller}.${t.typeDefinition}`:t.token;throw new Error(`Unknown value type "${i}" for "${t.token}" value`)}(t);return{type:r,key:e,name:c(e),get defaultValue(){return function(t){const e=G(t);if(e)return tt[e];const r=t.default;return void 0!==r?r:t}(t.typeDefinition)},get hasCustomDefaultValue(){return void 0!==X(t.typeDefinition)},reader:et[r],writer:rt[r]||rt.default}}({controller:r,token:t,typeDefinition:e})}function G(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function X(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(t)?"array":"[object Object]"===Object.prototype.toString.call(t)?"object":void 0}const tt={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},et={array(t){const e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${t}" of type "${X(e)}"`);return e},boolean:t=>!("0"==t||"false"==String(t).toLowerCase()),number:t=>Number(t),object(t){const e=JSON.parse(t);if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${t}" of type "${X(e)}"`);return e},string:t=>t},rt={default:function(t){return`${t}`},array:nt,object:nt};function nt(t){return JSON.stringify(t)}class ot{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:r={},prefix:n=this.identifier,bubbles:o=!0,cancelable:i=!0}={}){const s=new CustomEvent(n?`${n}:${t}`:t,{detail:r,bubbles:o,cancelable:i});return e.dispatchEvent(s),s}}ot.blessings=[function(t){return C(t,"classes").reduce(((t,e)=>{return Object.assign(t,{[`${r=e}Class`]:{get(){const{classes:t}=this;if(t.has(r))return t.get(r);{const e=t.getAttributeName(r);throw new Error(`Missing attribute "${e}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${u(r)}Class`]:{get(){return this.classes.has(r)}}});var r}),{})},function(t){return C(t,"targets").reduce(((t,e)=>{return Object.assign(t,{[`${r=e}Target`]:{get(){const t=this.targets.find(r);if(t)return t;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${u(r)}Target`]:{get(){return this.targets.has(r)}}});var r}),{})},function(t){const e=L(t,"values"),r={valueDescriptorMap:{get(){return e.reduce(((t,e)=>{const r=Q(e,this.identifier),n=this.data.getAttributeNameForKey(r.key);return Object.assign(t,{[n]:r})}),{})}}};return e.reduce(((t,e)=>Object.assign(t,function(t,e){const r=Q(t,e),{key:n,name:o,reader:i,writer:s}=r;return{[o]:{get(){const t=this.data.get(n);return null!==t?i(t):r.defaultValue},set(t){void 0===t?this.data.delete(n):this.data.set(n,s(t))}},[`has${u(o)}`]:{get(){return this.data.has(n)||r.hasCustomDefaultValue}}}}(e))),r)},function(t){return C(t,"outlets").reduce(((t,e)=>Object.assign(t,function(t){const e=l(t);return{[`${e}Outlet`]:{get(){const e=this.outlets.find(t);if(e){const r=this.application.getControllerForElementAndIdentifier(e,t);if(r)return r;throw new Error(`Missing "data-controller=${t}" attribute on outlet element for "${this.identifier}" controller`)}throw new Error(`Missing outlet element "${t}" for "${this.identifier}" controller`)}},[`${e}Outlets`]:{get(){const e=this.outlets.findAll(t);return e.length>0?e.map((e=>{const r=this.application.getControllerForElementAndIdentifier(e,t);if(r)return r})).filter((t=>t)):[]}},[`${e}OutletElement`]:{get(){const e=this.outlets.find(t);if(e)return e;throw new Error(`Missing outlet element "${t}" for "${this.identifier}" controller`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(t)}},[`has${u(e)}Outlet`]:{get(){return this.outlets.has(t)}}}}(e))),{})}],ot.targets=[],ot.outlets=[],ot.values={}},6184:(t,e,r)=>{"use strict";r.r(e),r.d(e,{FrameElement:()=>f,FrameLoadingStyle:()=>i,FrameRenderer:()=>J,PageRenderer:()=>gt,PageSnapshot:()=>et,StreamActions:()=>Et,StreamElement:()=>qt,StreamSourceElement:()=>Ht,cache:()=>At,clearCache:()=>Mt,connectStreamSource:()=>Ct,disconnectStreamSource:()=>Lt,navigator:()=>jt,registerAdapter:()=>kt,renderStreamMessage:()=>xt,session:()=>Pt,setConfirmMethod:()=>Bt,setFormMode:()=>Ft,setProgressBarDelay:()=>_t,start:()=>Rt,visit:()=>Tt}),function(){if(void 0===window.Reflect||void 0===window.customElements||window.customElements.polyfillWrapFlushCallback)return;const t=HTMLElement,e=function(){return Reflect.construct(t,[],this.constructor)};window.HTMLElement=e,HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}(),function(t){function e(t,e,r){throw new t("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+e+".",r)}"function"!=typeof t.requestSubmit&&(t.requestSubmit=function(t){t?(!function(t,r){t instanceof HTMLElement||e(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==t.type||e(TypeError,"The specified element is not a submit button"),t.form==r||e(DOMException,"The specified element is not owned by this form element","NotFoundError")}(t,this),t.click()):((t=document.createElement("input")).type="submit",t.hidden=!0,this.appendChild(t),t.click(),this.removeChild(t))})}(HTMLFormElement.prototype);const n=new WeakMap;function o(t){const e=function(t){const e=t instanceof Element?t:t instanceof Node?t.parentElement:null,r=e?e.closest("input, button"):null;return"submit"==(null==r?void 0:r.type)?r:null}(t.target);e&&e.form&&n.set(e.form,e)}var i,s,a,c,l,u;!function(){if("submitter"in Event.prototype)return;let t;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))t=window.SubmitEvent.prototype;else{if("SubmitEvent"in window)return;t=window.Event.prototype}addEventListener("click",o,!0),Object.defineProperty(t,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return n.get(this.target)}})}(),function(t){t.eager="eager",t.lazy="lazy"}(i||(i={}));class f extends HTMLElement{constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new f.delegateConstructor(this)}static get observedAttributes(){return["disabled","complete","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){"loading"==t?this.delegate.loadingStyleChanged():"complete"==t?this.delegate.completeChanged():"src"==t?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loading(){return function(t){if("lazy"===t.toLowerCase())return i.lazy;return i.eager}(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var t,e;return null===(e=null===(t=this.ownerDocument)||void 0===t?void 0:t.documentElement)||void 0===e?void 0:e.hasAttribute("data-turbo-preview")}}function h(t){return new URL(t.toString(),document.baseURI)}function p(t){let e;return t.hash?t.hash.slice(1):(e=t.href.match(/#(.*)$/))?e[1]:void 0}function d(t,e){return h((null==e?void 0:e.getAttribute("formaction"))||t.getAttribute("action")||t.action)}function m(t){return(function(t){return function(t){return t.pathname.split("/").slice(1)}(t).slice(-1)[0]}(t).match(/\.[^.]*$/)||[])[0]||""}function y(t,e){const r=function(t){return e=t.origin+t.pathname,e.endsWith("/")?e:e+"/";var e}(e);return t.href===h(r).href||t.href.startsWith(r)}function g(t,e){return y(t,e)&&!!m(t).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function b(t){const e=p(t);return null!=e?t.href.slice(0,-(e.length+1)):t.href}function v(t){return b(t)}class w{constructor(t){this.response=t}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return h(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(t){return this.response.headers.get(t)}}function S(t){return"advance"==t||"replace"==t||"restore"==t}function O(t){if("false"==t.getAttribute("data-turbo-eval"))return t;{const e=document.createElement("script"),r=_("csp-nonce");return r&&(e.nonce=r),e.textContent=t.textContent,e.async=!1,function(t,e){for(const{name:r,value:n}of e.attributes)t.setAttribute(r,n)}(e,t),e}}function E(t,{target:e,cancelable:r,detail:n}={}){const o=new CustomEvent(t,{cancelable:r,bubbles:!0,detail:n});return e&&e.isConnected?e.dispatchEvent(o):document.documentElement.dispatchEvent(o),o}function P(){return new Promise((t=>requestAnimationFrame((()=>t()))))}function A(t=""){return(new DOMParser).parseFromString(t,"text/html")}function j(t,...e){const r=function(t,e){return t.reduce(((t,r,n)=>t+r+(null==e[n]?"":e[n])),"")}(t,e).replace(/^\n/,"").split("\n"),n=r[0].match(/^\s+/),o=n?n[0].length:0;return r.map((t=>t.slice(o))).join("\n")}function R(){return Array.from({length:36}).map(((t,e)=>8==e||13==e||18==e||23==e?"-":14==e?"4":19==e?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16))).join("")}function k(t,...e){for(const r of e.map((e=>null==e?void 0:e.getAttribute(t))))if("string"==typeof r)return r;return null}function T(...t){for(const e of t)"turbo-frame"==e.localName&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function C(...t){for(const e of t)"turbo-frame"==e.localName&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function L(t,e=2e3){return new Promise((r=>{const n=()=>{t.removeEventListener("error",n),t.removeEventListener("load",n),r()};t.addEventListener("load",n,{once:!0}),t.addEventListener("error",n,{once:!0}),setTimeout(r,e)}))}function x(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function M(t){return document.querySelector(`meta[name="${t}"]`)}function _(t){const e=M(t);return e&&e.content}!function(t){t[t.get=0]="get",t[t.post=1]="post",t[t.put=2]="put",t[t.patch=3]="patch",t[t.delete=4]="delete"}(s||(s={}));class B{constructor(t,e,r,n=new URLSearchParams,o=null){this.abortController=new AbortController,this.resolveRequestPromise=t=>{},this.delegate=t,this.method=e,this.headers=this.defaultHeaders,this.body=n,this.url=r,this.target=o}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){var t,e;const{fetchOptions:r}=this;null===(e=(t=this.delegate).prepareHeadersForRequest)||void 0===e||e.call(t,this.headers,this),await this.allowRequestToBeIntercepted(r);try{this.delegate.requestStarted(this);const t=await fetch(this.url.href,r);return await this.receive(t)}catch(t){if("AbortError"!==t.name)throw this.willDelegateErrorHandling(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(t){const e=new w(t);return E("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:e},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,e):e.succeeded?this.delegate.requestSucceededWithResponse(this,e):this.delegate.requestFailedWithResponse(this,e),e}get fetchOptions(){var t;return{method:s[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isIdempotent?null:this.body,signal:this.abortSignal,referrer:null===(t=this.delegate.referrer)||void 0===t?void 0:t.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isIdempotent(){return this.method==s.get}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(t){const e=new Promise((t=>this.resolveRequestPromise=t));E("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await e}willDelegateErrorHandling(t){return!E("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented}}class F{constructor(t,e){this.started=!1,this.intersect=t=>{const e=t.slice(-1)[0];(null==e?void 0:e.isIntersecting)&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=t,this.element=e,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class I{constructor(t){this.fragment=function(t){for(const e of t.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const e of t.templateElement.content.querySelectorAll("script"))e.replaceWith(O(e));e.replaceWith(t)}return t}(t)}static wrap(t){return"string"==typeof t?new this(function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t)):t}}I.contentType="text/vnd.turbo-stream.html",function(t){t[t.initialized=0]="initialized",t[t.requesting=1]="requesting",t[t.waiting=2]="waiting",t[t.receiving=3]="receiving",t[t.stopping=4]="stopping",t[t.stopped=5]="stopped"}(a||(a={})),function(t){t.urlEncoded="application/x-www-form-urlencoded",t.multipart="multipart/form-data",t.plain="text/plain"}(c||(c={}));class N{constructor(t,e,r,n=!1){this.state=a.initialized,this.delegate=t,this.formElement=e,this.submitter=r,this.formData=function(t,e){const r=new FormData(t),n=null==e?void 0:e.getAttribute("name"),o=null==e?void 0:e.getAttribute("value");n&&r.append(n,o||"");return r}(e,r),this.location=h(this.action),this.method==s.get&&function(t,e){const r=new URLSearchParams;for(const[t,n]of e)n instanceof File||r.append(t,n);t.search=r.toString()}(this.location,[...this.body.entries()]),this.fetchRequest=new B(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=n}static confirmMethod(t,e,r){return Promise.resolve(confirm(t))}get method(){var t;return function(t){switch(t.toLowerCase()){case"get":return s.get;case"post":return s.post;case"put":return s.put;case"patch":return s.patch;case"delete":return s.delete}}(((null===(t=this.submitter)||void 0===t?void 0:t.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"").toLowerCase())||s.get}get action(){var t;const e="string"==typeof this.formElement.action?this.formElement.action:null;return(null===(t=this.submitter)||void 0===t?void 0:t.hasAttribute("formaction"))?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||e||""}get body(){return this.enctype==c.urlEncoded||this.method==s.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var t;return function(t){switch(t.toLowerCase()){case c.multipart:return c.multipart;case c.plain:return c.plain;default:return c.urlEncoded}}((null===(t=this.submitter)||void 0===t?void 0:t.getAttribute("formenctype"))||this.formElement.enctype)}get isIdempotent(){return this.fetchRequest.isIdempotent}get stringFormData(){return[...this.formData].reduce(((t,[e,r])=>t.concat("string"==typeof r?[[e,r]]:[])),[])}async start(){const{initialized:t,requesting:e}=a,r=k("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof r){if(!await N.confirmMethod(r,this.formElement,this.submitter))return}if(this.state==t)return this.state=e,this.fetchRequest.perform()}stop(){const{stopping:t,stopped:e}=a;if(this.state!=t&&this.state!=e)return this.state=t,this.fetchRequest.cancel(),!0}prepareHeadersForRequest(t,e){if(!e.isIdempotent){const e=function(t){if(null!=t){const e=(document.cookie?document.cookie.split("; "):[]).find((e=>e.startsWith(t)));if(e){const t=e.split("=").slice(1).join("=");return t?decodeURIComponent(t):void 0}}}(_("csrf-param"))||_("csrf-token");e&&(t["X-CSRF-Token"]=e)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(I.contentType)}requestStarted(t){var e;this.state=a.waiting,null===(e=this.submitter)||void 0===e||e.setAttribute("disabled",""),E("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,e){this.result={success:e.succeeded,fetchResponse:e}}requestSucceededWithResponse(t,e){if(e.clientError||e.serverError)this.delegate.formSubmissionFailedWithResponse(this,e);else if(this.requestMustRedirect(t)&&function(t){return 200==t.statusCode&&!t.redirected}(e)){const t=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,t)}else this.state=a.receiving,this.result={success:!0,fetchResponse:e},this.delegate.formSubmissionSucceededWithResponse(this,e)}requestFailedWithResponse(t,e){this.result={success:!1,fetchResponse:e},this.delegate.formSubmissionFailedWithResponse(this,e)}requestErrored(t,e){this.result={success:!1,error:e},this.delegate.formSubmissionErrored(this,e)}requestFinished(t){var e;this.state=a.stopped,null===(e=this.submitter)||void 0===e||e.removeAttribute("disabled"),E("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}requestMustRedirect(t){return!t.isIdempotent&&this.mustRedirect}requestAcceptsTurboStreamResponse(t){return!t.isIdempotent||function(t,...e){return e.some((e=>e&&e.hasAttribute(t)))}("data-turbo-stream",this.submitter,this.formElement)}}class D{constructor(t){this.element=t}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(t){return null!=this.getElementForAnchor(t)}getElementForAnchor(t){return t?this.element.querySelector(`[id='${t}'], a[name='${t}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){for(const t of this.element.querySelectorAll("[autofocus]"))if(null==t.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"))return t;return null}get permanentElements(){return H(this.element)}getPermanentElementById(t){return q(this.element,t)}getPermanentElementMapForSnapshot(t){const e={};for(const r of this.permanentElements){const{id:n}=r,o=t.getPermanentElementById(n);o&&(e[n]=[r,o])}return e}}function q(t,e){return t.querySelector(`#${e}[data-turbo-permanent]`)}function H(t){return t.querySelectorAll("[id][data-turbo-permanent]")}class U{constructor(t,e){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=t=>{if(!t.defaultPrevented){const e=t.target instanceof HTMLFormElement?t.target:void 0,r=t.submitter||void 0;e&&function(t,e){const r=(null==e?void 0:e.getAttribute("formmethod"))||t.getAttribute("method");return"dialog"!=r}(e,r)&&function(t,e){const r=(null==e?void 0:e.getAttribute("formtarget"))||t.target;for(const t of document.getElementsByName(r))if(t instanceof HTMLIFrameElement)return!1;return!0}(e,r)&&this.delegate.willSubmitForm(e,r)&&(t.preventDefault(),t.stopImmediatePropagation(),this.delegate.formSubmitted(e,r))}},this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}}class Z{constructor(t,e){this.resolveRenderPromise=t=>{},this.resolveInterceptionPromise=t=>{},this.delegate=t,this.element=e}scrollToAnchor(t){const e=this.snapshot.getElementForAnchor(t);e?(this.scrollToElement(e),this.focusElement(e)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(p(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focus(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:e}){this.scrollRoot.scrollTo(t,e)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){const{isPreview:e,shouldRender:r,newSnapshot:n}=t;if(r)try{this.renderPromise=new Promise((t=>this.resolveRenderPromise=t)),this.renderer=t,await this.prepareToRenderSnapshot(t);const r=new Promise((t=>this.resolveInterceptionPromise=t)),o={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(n,o)||await r,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(n,e),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(t.reloadReason)}invalidate(t){this.delegate.viewInvalidated(t)}async prepareToRenderSnapshot(t){this.markAsPreview(t.isPreview),await t.prepareToRender()}markAsPreview(t){t?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(t){await t.render()}finishRenderingSnapshot(t){t.finishRendering()}}class V extends Z{invalidate(){this.element.innerHTML=""}get snapshot(){return new D(this.element)}}class W{constructor(t,e){this.clickBubbled=t=>{this.respondsToEventTarget(t.target)?this.clickEvent=t:delete this.clickEvent},this.linkClicked=t=>{this.clickEvent&&this.respondsToEventTarget(t.target)&&t.target instanceof Element&&this.delegate.shouldInterceptLinkClick(t.target,t.detail.url,t.detail.originalEvent)&&(this.clickEvent.preventDefault(),t.preventDefault(),this.delegate.linkClickIntercepted(t.target,t.detail.url,t.detail.originalEvent)),delete this.clickEvent},this.willVisit=t=>{delete this.clickEvent},this.delegate=t,this.element=e}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(t){const e=t instanceof Element?t:t instanceof Node?t.parentElement:null;return e&&e.closest("turbo-frame, html")==this.element}}class ${constructor(t,e){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=t=>{if(t instanceof MouseEvent&&this.clickEventIsSignificant(t)){const e=t.composedPath&&t.composedPath()[0]||t.target,r=this.findLinkFromClickTarget(e);if(r&&function(t){for(const e of document.getElementsByName(t.target))if(e instanceof HTMLIFrameElement)return!1;return!0}(r)){const e=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,e,t)&&(t.preventDefault(),this.delegate.followedLinkToLocation(r,e))}}},this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}findLinkFromClickTarget(t){if(t instanceof Element)return t.closest("a[href]:not([target^=_]):not([download])")}getLocationForLink(t){return h(t.getAttribute("href")||"")}}class z{constructor(t,e){this.delegate=t,this.linkInterceptor=new $(this,e)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(t,e,r){return this.delegate.willSubmitFormLinkToLocation(t,e,r)&&t.hasAttribute("data-turbo-method")}followedLinkToLocation(t,e){const r=e.href,n=document.createElement("form");n.setAttribute("data-turbo","true"),n.setAttribute("action",r),n.setAttribute("hidden","");const o=t.getAttribute("data-turbo-method");o&&n.setAttribute("method",o);const i=t.getAttribute("data-turbo-frame");i&&n.setAttribute("data-turbo-frame",i);const s=t.getAttribute("data-turbo-action");s&&n.setAttribute("data-turbo-action",s);const a=t.getAttribute("data-turbo-confirm");a&&n.setAttribute("data-turbo-confirm",a);t.hasAttribute("data-turbo-stream")&&n.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,e,n),document.body.appendChild(n),n.addEventListener("turbo:submit-end",(()=>n.remove()),{once:!0}),requestAnimationFrame((()=>n.requestSubmit()))}}class K{constructor(t,e){this.delegate=t,this.permanentElementMap=e}static preservingPermanentElements(t,e,r){const n=new this(t,e);n.enter(),r(),n.leave()}enter(){for(const t in this.permanentElementMap){const[e,r]=this.permanentElementMap[t];this.delegate.enteringBardo(e,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(const t in this.permanentElementMap){const[e]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(e),this.replacePlaceholderWithPermanentElement(e),this.delegate.leavingBardo(e)}}replaceNewPermanentElementWithPlaceholder(t){const e=function(t){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",t.id),e}(t);t.replaceWith(e)}replaceCurrentPermanentElementWithClone(t){const e=t.cloneNode(!0);t.replaceWith(e)}replacePlaceholderWithPermanentElement(t){const e=this.getPlaceholderById(t.id);null==e||e.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find((e=>e.content==t))}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class Y{constructor(t,e,r,n,o=!0){this.activeElement=null,this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=n,this.willRender=o,this.renderElement=r,this.promise=new Promise(((t,e)=>this.resolvingFunctions={resolve:t,reject:e}))}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}preservingPermanentElements(t){K.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){const t=this.connectedSnapshot.firstAutofocusableElement;(function(t){return t&&"function"==typeof t.focus})(t)&&t.focus()}enteringBardo(t){this.activeElement||t.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}}class J extends Y{constructor(t,e,r,n,o,i=!0){super(e,r,n,o,i),this.delegate=t}static renderElement(t,e){var r;const n=document.createRange();n.selectNodeContents(t),n.deleteContents();const o=e,i=null===(r=o.ownerDocument)||void 0===r?void 0:r.createRange();i&&(i.selectNodeContents(o),t.appendChild(i.extractContents()))}get shouldRender(){return!0}async render(){await P(),this.preservingPermanentElements((()=>{this.loadFrameElement()})),this.scrollFrameIntoView(),await P(),this.focusFirstAutofocusableElement(),await P(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const r=this.currentElement.firstElementChild,n=(t=this.currentElement.getAttribute("data-autoscroll-block"),e="end","end"==t||"start"==t||"center"==t||"nearest"==t?t:e),o=function(t,e){return"auto"==t||"smooth"==t?t:e}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(r)return r.scrollIntoView({block:n,behavior:o}),!0}var t,e;return!1}activateScriptElements(){for(const t of this.newScriptElements){const e=O(t);t.replaceWith(e)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}class Q{constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return j` +(self.webpackChunk=self.webpackChunk||[]).push([[600],{2839:(e,t,r)=>{"use strict";r.d(t,{Mx:()=>J,Qr:()=>ne});class o{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,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 r=e.index,o=t.index;return ro?1:0}))}}class n{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,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:r,eventOptions:o}=e,n=this.fetchEventListenerMapForEventTarget(t),i=this.cacheKey(r,o);n.delete(i),0==n.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:r,eventOptions:o}=e;return this.fetchEventListener(t,r,o)}fetchEventListener(e,t,r){const o=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r);let i=o.get(n);return i||(i=this.createEventListener(e,t,r),o.set(n,i)),i}createEventListener(e,t,r){const n=new o(e,t,r);return this.started&&n.connect(),n}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){const r=[e];return Object.keys(t).sort().forEach((e=>{r.push(`${t[e]?"":"!"}${e}`)})),r.join(":")}}const i={stop:({event:e,value:t})=>(t&&e.stopPropagation(),!0),prevent:({event:e,value:t})=>(t&&e.preventDefault(),!0),self:({event:e,value:t,element:r})=>!t||r===e.target},a=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function d(e){return"window"==e?window:"document"==e?document:void 0}function l(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function p(e){return l(e.replace(/--/g,"-").replace(/__/g,"_"))}function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}class m{constructor(e,t,r,o){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||function(e){const t=e.tagName.toLowerCase();if(t in b)return b[t](e)}(e)||u("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||u("missing identifier"),this.methodName=r.methodName||u("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=o}static forToken(e,t){return new this(e.element,e.index,function(e){const t=e.trim().match(a)||[];let r=t[1],o=t[2];return o&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${o}`,o=""),{eventTarget:d(t[3]),eventName:r,eventOptions:t[6]?(n=t[6],n.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})):{},identifier:t[4],methodName:t[5],keyFilter:o};var n}(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("+"),r=["meta","ctrl","alt","shift"],[o,n,i,a]=r.map((e=>t.includes(e)));if(e.metaKey!==o||e.ctrlKey!==n||e.altKey!==i||e.shiftKey!==a)return!0;const d=t.filter((e=>!r.includes(e)))[0];return!!d&&(Object.prototype.hasOwnProperty.call(this.keyMappings,d)||u(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[d].toLowerCase()!==e.key.toLowerCase())}get params(){const e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:r,value:o}of Array.from(this.element.attributes)){const n=r.match(t),i=n&&n[1];i&&(e[l(i)]=g(o))}return e}get eventTargetName(){return(e=this.eventTarget)==window?"window":e==document?"document":void 0;var e}get keyMappings(){return this.schema.keyMappings}}const b={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function u(e){throw new Error(e)}function g(e){try{return JSON.parse(e)}catch(t){return e}}class f{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:r}=this.context.application;let o=!0;for(const[n,i]of Object.entries(this.eventOptions))if(n in r){const a=r[n];o=o&&a({name:n,value:i,event:e,element:t})}return o}invokeWithEvent(e){const{target:t,currentTarget:r}=e;try{const{params:o}=this.action,n=Object.assign(e,{params:o});this.method.call(this.controller,n),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(t){const{identifier:r,controller:o,element:n,index:i}=this,a={identifier:r,controller:o,element:n,index:i,event:e};this.context.handleError(t,`invoking action "${this.action}"`,a)}}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 v{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 r=e;this.elements.has(r)?this.delegate.elementAttributeChanged&&this.matchElement(r)?this.delegate.elementAttributeChanged(r,t):this.removeElement(r):this.matchElement(r)&&this.addElement(r)}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 r of this.matchElementsInTree(e))t.call(this,r)}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 h{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new v(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]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}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 w(e,t,r){x(e,t).add(r)}function z(e,t,r){x(e,t).delete(r),function(e,t){const r=e.get(t);null!=r&&0==r.size&&e.delete(t)}(e,t)}function x(e,t){let r=e.get(t);return r||(r=new Set,e.set(t,r)),r}class y{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){w(this.valuesByKey,e,t)}delete(e,t){z(this.valuesByKey,e,t)}has(e,t){const r=this.valuesByKey.get(e);return null!=r&&r.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,r])=>r.has(e))).map((([e,t])=>e))}}class k{constructor(e,t,r,o={}){this.selector=t,this.details=o,this.elementObserver=new v(e,this),this.delegate=r,this.matchesByElement=new y}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]:[],r=Array.from(e.querySelectorAll(this.selector)).filter((e=>this.matchElement(e)));return t.concat(r)}elementMatched(e){this.selectorMatched(e)}elementUnmatched(e){this.selectorUnmatched(e)}elementAttributeChanged(e,t){const r=this.matchElement(e),o=this.matchesByElement.has(this.selector,e);!r&&o&&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 q{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 r=this.delegate.getStringMapKeyForAttribute(e);if(null!=r){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);const o=this.element.getAttribute(e);if(this.stringMap.get(e)!=o&&this.stringMapValueChanged(o,r,t),null==o){const t=this.stringMap.get(e);this.stringMap.delete(e),t&&this.stringMapKeyRemoved(r,e,t)}else this.stringMap.set(e,o)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}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,r){this.attributeObserver=new h(e,t,this),this.delegate=r,this.tokensByElement=new y}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,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}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),r=this.readTokensForElement(e),o=function(e,t){const r=Math.max(e.length,t.length);return Array.from({length:r},((r,o)=>[e[o],t[o]]))}(t,r).findIndex((([e,t])=>{return o=t,!((r=e)&&o&&r.index==o.index&&r.content==o.content);var r,o}));return-1==o?[[],[]]:[t.slice(o),r.slice(o)]}readTokensForElement(e){const t=this.attributeName;return function(e,t,r){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,o)=>({element:t,attributeName:r,content:e,index:o})))}(e.getAttribute(t)||"",e,t)}}class S{constructor(e,t,r){this.tokenListObserver=new E(e,t,this),this.delegate=r,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:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){const{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}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 C{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new S(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 f(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=m.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class j{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new q(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 r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){const o=this.valueDescriptorNameMap[t];null!==e&&(null===r&&(r=o.writer(o.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){const o=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,o.writer(this.receiver[e]),r):this.invokeChangedCallback(e,o.writer(o.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:r,writer:o}of this.valueDescriptors)null==r||this.controller.data.has(e)||this.invokeChangedCallback(t,o(r),void 0)}invokeChangedCallback(e,t,r){const o=`${e}Changed`,n=this.receiver[o];if("function"==typeof n){const o=this.valueDescriptorNameMap[e];try{const e=o.reader(t);let i=r;r&&(i=o.reader(r)),n.call(this.receiver,e,i)}catch(e){throw e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${o.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 r=this.valueDescriptorMap[t];e[r.name]=r})),e}hasValue(e){const t=`has${s(this.valueDescriptorNameMap[e].name)}`;return this.receiver[t]}}class O{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new y}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 r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),null===(r=this.tokenListObserver)||void 0===r||r.pause((()=>this.delegate.targetConnected(e,t))))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),null===(r=this.tokenListObserver)||void 0===r||r.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 M(e,t){const r=P(e);return Array.from(r.reduce(((e,r)=>(function(e,t){const r=e[t];return Array.isArray(r)?r:[]}(r,t).forEach((t=>e.add(t))),e)),new Set))}function A(e,t){return P(e).reduce(((e,r)=>(e.push(...function(e,t){const r=e[t];return r?Object.keys(r).map((e=>[e,r[e]])):[]}(r,t)),e)),[])}function P(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}class R{constructor(e,t){this.context=e,this.delegate=t,this.outletsByName=new y,this.outletElementsByName=new y,this.selectorObserverMap=new Map}start(){0===this.selectorObserverMap.size&&(this.outletDefinitions.forEach((e=>{const t=this.selector(e),r={outletName:e};t&&this.selectorObserverMap.set(e,new k(document.body,t,this,r))})),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:r}){const o=this.getOutlet(e,r);o&&this.connectOutlet(o,e,r)}selectorUnmatched(e,t,{outletName:r}){const o=this.getOutletFromMap(e,r);o&&this.disconnectOutlet(o,e,r)}selectorMatchElement(e,{outletName:t}){return this.hasOutlet(e,t)&&e.matches(`[${this.context.application.schema.controllerAttribute}~=${t}]`)}connectOutlet(e,t,r){var o;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),null===(o=this.selectorObserverMap.get(r))||void 0===o||o.pause((()=>this.delegate.outletConnected(e,t,r))))}disconnectOutlet(e,t,r){var o;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),null===(o=this.selectorObserverMap.get(r))||void 0===o||o.pause((()=>this.delegate.outletDisconnected(e,t,r))))}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}get outletDependencies(){const e=new y;return this.router.modules.forEach((t=>{M(t.definition.controllerConstructor,"outlets").forEach((r=>e.add(r,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 T{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:r,controller:o,element:n}=this;t=Object.assign({identifier:r,controller:o,element:n},t),this.application.logDebugActivity(this.identifier,e,t)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new C(this,this.dispatcher),this.valueObserver=new j(this,this.controller),this.targetObserver=new O(this,this),this.outletObserver=new R(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,r={}){const{identifier:o,controller:n,element:i}=this;r=Object.assign({identifier:o,controller:n,element:i},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${p(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${p(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const r=this.controller;"function"==typeof r[e]&&r[e](...t)}}function L(e){return function(e,t){const r=B(e),o=function(e,t){return _(t).reduce(((r,o)=>{const n=function(e,t,r){const o=Object.getOwnPropertyDescriptor(e,r);if(!o||!("value"in o)){const e=Object.getOwnPropertyDescriptor(t,r).value;return o&&(e.get=o.get||e.get,e.set=o.set||e.set),e}}(e,t,o);return n&&Object.assign(r,{[o]:n}),r}),{})}(e.prototype,t);return Object.defineProperties(r.prototype,o),r}(e,function(e){const t=M(e,"blessings");return t.reduce(((t,r)=>{const o=r(e);for(const e in o){const r=t[e]||{};t[e]=Object.assign(r,o[e])}return t}),{})}(e))}const _="function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames,B=(()=>{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 I{constructor(e,t){this.application=e,this.definition=function(e){return{identifier:e.identifier,controllerConstructor:L(e.controllerConstructor)}}(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 T(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){const t=this.data.get(this.getDataKey(e))||"";return t.match(/[^\s]+/g)||[]}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class N{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 r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,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 D{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let o=this.warnedKeysByObject.get(e);o||(o=new Set,this.warnedKeysByObject.set(e,o)),o.has(t)||(o.add(t),this.logger.warn(r,e))}}function H(e,t){return`[${e}~="${t}"]`}class U{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 H(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 H(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:r}=this,o=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${o}="${r}.${t}" with ${n}="${t}". The ${o} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class Z{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((r=>this.matchesElement(r,e,t)))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter((r=>this.matchesElement(r,e,t)))}matchesElement(e,t,r){const o=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&o.split(" ").includes(r)}}class W{constructor(e,t,r,o){this.targets=new U(this),this.classes=new F(this),this.data=new N(this),this.containsElement=e=>e.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new D(o),this.outlets=new Z(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 H(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new W(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class V{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new S(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:r}=e,o=this.fetchScopesByIdentifierForElement(t);let n=o.get(r);return n||(n=this.delegate.createScopeForElementAndIdentifier(t,r),o.set(r,n)),n}elementMatchedValue(e,t){const r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),1==r&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),1==r&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}}class Y{constructor(e){this.application=e,this.scopeObserver=new V(this.element,this.schema,this),this.scopesByIdentifier=new y,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 I(this.application,e);this.connectModule(t);const r=e.controllerConstructor.afterLoad;r&&r(e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find((t=>t.element==e))}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new W(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 $={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"},K("abcdefghijklmnopqrstuvwxyz".split("").map((e=>[e,e])))),K("0123456789".split("").map((e=>[e,e]))))};function K(e){return e.reduce(((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r})),{})}class J{constructor(e=document.documentElement,t=$){this.logger=console,this.debug=!1,this.logDebugActivity=(e,t,r={})=>{this.debug&&this.logFormattedMessage(e,t,r)},this.element=e,this.schema=t,this.dispatcher=new n(this),this.router=new Y(this),this.actionDescriptorFilters=Object.assign({},i)}static start(e,t){const r=new this(e,t);return r.start(),r}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 r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var o;this.logger.error("%s\n\n%o\n\n%o",t,e,r),null===(o=window.onerror)||void 0===o||o.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}}function Q([e,t],r){return function(e){const t=`${c(e.token)}-value`,r=function(e){const t=function(e){const t=G(e.typeObject.type);if(!t)return;const r=X(e.typeObject.default);if(t!==r){const o=e.controller?`${e.controller}.${e.token}`:e.token;throw new Error(`The specified default value for the Stimulus Value "${o}" must match the defined type "${t}". The provided default value of "${e.typeObject.default}" is of type "${r}".`)}return t}({controller:e.controller,token:e.token,typeObject:e.typeDefinition}),r=X(e.typeDefinition),o=G(e.typeDefinition),n=t||r||o;if(n)return n;const i=e.controller?`${e.controller}.${e.typeDefinition}`:e.token;throw new Error(`Unknown value type "${i}" for "${e.token}" value`)}(e);return{type:r,key:t,name:l(t),get defaultValue(){return function(e){const t=G(e);if(t)return ee[t];const r=e.default;return void 0!==r?r:e}(e.typeDefinition)},get hasCustomDefaultValue(){return void 0!==X(e.typeDefinition)},reader:te[r],writer:re[r]||re.default}}({controller:r,token:e,typeDefinition:t})}function G(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function X(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 ee={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},te={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 "${X(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 "${X(t)}"`);return t},string:e=>e},re={default:function(e){return`${e}`},array:oe,object:oe};function oe(e){return JSON.stringify(e)}class ne{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:r={},prefix:o=this.identifier,bubbles:n=!0,cancelable:i=!0}={}){const a=new CustomEvent(o?`${o}:${e}`:e,{detail:r,bubbles:n,cancelable:i});return t.dispatchEvent(a),a}}ne.blessings=[function(e){return M(e,"classes").reduce(((e,t)=>{return Object.assign(e,{[`${r=t}Class`]:{get(){const{classes:e}=this;if(e.has(r))return e.get(r);{const t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${s(r)}Class`]:{get(){return this.classes.has(r)}}});var r}),{})},function(e){return M(e,"targets").reduce(((e,t)=>{return Object.assign(e,{[`${r=t}Target`]:{get(){const e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${s(r)}Target`]:{get(){return this.targets.has(r)}}});var r}),{})},function(e){const t=A(e,"values"),r={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const r=Q(t,this.identifier),o=this.data.getAttributeNameForKey(r.key);return Object.assign(e,{[o]:r})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,function(e,t){const r=Q(e,t),{key:o,name:n,reader:i,writer:a}=r;return{[n]:{get(){const e=this.data.get(o);return null!==e?i(e):r.defaultValue},set(e){void 0===e?this.data.delete(o):this.data.set(o,a(e))}},[`has${s(n)}`]:{get(){return this.data.has(o)||r.hasCustomDefaultValue}}}}(t))),r)},function(e){return M(e,"outlets").reduce(((e,t)=>Object.assign(e,function(e){const t=p(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e);if(t){const r=this.application.getControllerForElementAndIdentifier(t,e);if(r)return r;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 r=this.application.getControllerForElementAndIdentifier(t,e);if(r)return r})).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${s(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}(t))),{})}],ne.targets=[],ne.outlets=[],ne.values={}},8409:(e,t,r)=>{"use strict";r.r(t),r.d(t,{FrameElement:()=>c,FrameLoadingStyle:()=>i,FrameRenderer:()=>Q,PageRenderer:()=>he,PageSnapshot:()=>re,StreamActions:()=>qe,StreamElement:()=>De,StreamSourceElement:()=>He,cache:()=>Se,clearCache:()=>Te,connectStreamSource:()=>Ae,disconnectStreamSource:()=>Pe,navigator:()=>Ce,registerAdapter:()=>Oe,renderStreamMessage:()=>Re,session:()=>Ee,setConfirmMethod:()=>_e,setFormMode:()=>Be,setProgressBarDelay:()=>Le,start:()=>je,visit:()=>Me}),function(){if(void 0===window.Reflect||void 0===window.customElements||window.customElements.polyfillWrapFlushCallback)return;const e=HTMLElement,t=function(){return Reflect.construct(e,[],this.constructor)};window.HTMLElement=t,HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}(),function(e){function t(e,t,r){throw new e("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+t+".",r)}"function"!=typeof e.requestSubmit&&(e.requestSubmit=function(e){e?(!function(e,r){e instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==e.type||t(TypeError,"The specified element is not a submit button"),e.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}(e,this),e.click()):((e=document.createElement("input")).type="submit",e.hidden=!0,this.appendChild(e),e.click(),this.removeChild(e))})}(HTMLFormElement.prototype);const o=new WeakMap;function n(e){const t=function(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null,r=t?t.closest("input, button"):null;return"submit"==(null==r?void 0:r.type)?r:null}(e.target);t&&t.form&&o.set(t.form,t)}var i,a,d,l,p,s;!function(){if("submitter"in Event.prototype)return;let e;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))e=window.SubmitEvent.prototype;else{if("SubmitEvent"in window)return;e=window.Event.prototype}addEventListener("click",n,!0),Object.defineProperty(e,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return o.get(this.target)}})}(),function(e){e.eager="eager",e.lazy="lazy"}(i||(i={}));class c extends HTMLElement{constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new c.delegateConstructor(this)}static get observedAttributes(){return["disabled","complete","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){"loading"==e?this.delegate.loadingStyleChanged():"complete"==e?this.delegate.completeChanged():"src"==e?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return function(e){if("lazy"===e.toLowerCase())return i.lazy;return i.eager}(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return null===(t=null===(e=this.ownerDocument)||void 0===e?void 0:e.documentElement)||void 0===t?void 0:t.hasAttribute("data-turbo-preview")}}function m(e){return new URL(e.toString(),document.baseURI)}function b(e){let t;return e.hash?e.hash.slice(1):(t=e.href.match(/#(.*)$/))?t[1]:void 0}function u(e,t){return m((null==t?void 0:t.getAttribute("formaction"))||e.getAttribute("action")||e.action)}function g(e){return(function(e){return function(e){return e.pathname.split("/").slice(1)}(e).slice(-1)[0]}(e).match(/\.[^.]*$/)||[])[0]||""}function f(e,t){const r=function(e){return t=e.origin+e.pathname,t.endsWith("/")?t:t+"/";var t}(t);return e.href===m(r).href||e.href.startsWith(r)}function v(e,t){return f(e,t)&&!!g(e).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function h(e){const t=b(e);return null!=t?e.href.slice(0,-(t.length+1)):e.href}function w(e){return h(e)}class z{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return m(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}function x(e){if("false"==e.getAttribute("data-turbo-eval"))return e;{const t=document.createElement("script"),r=T("csp-nonce");return r&&(t.nonce=r),t.textContent=e.textContent,t.async=!1,function(e,t){for(const{name:r,value:o}of t.attributes)e.setAttribute(r,o)}(t,e),t}}function y(e,{target:t,cancelable:r,detail:o}={}){const n=new CustomEvent(e,{cancelable:r,bubbles:!0,composed:!0,detail:o});return t&&t.isConnected?t.dispatchEvent(n):document.documentElement.dispatchEvent(n),n}function k(){return new Promise((e=>requestAnimationFrame((()=>e()))))}function q(e=""){return(new DOMParser).parseFromString(e,"text/html")}function E(e,...t){const r=function(e,t){return e.reduce(((e,r,o)=>e+r+(null==t[o]?"":t[o])),"")}(e,t).replace(/^\n/,"").split("\n"),o=r[0].match(/^\s+/),n=o?o[0].length:0;return r.map((e=>e.slice(n))).join("\n")}function S(){return Array.from({length:36}).map(((e,t)=>8==t||13==t||18==t||23==t?"-":14==t?"4":19==t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16))).join("")}function C(e,...t){for(const r of t.map((t=>null==t?void 0:t.getAttribute(e))))if("string"==typeof r)return r;return null}function j(...e){for(const t of e)"turbo-frame"==t.localName&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function O(...e){for(const t of e)"turbo-frame"==t.localName&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function M(e,t=2e3){return new Promise((r=>{const o=()=>{e.removeEventListener("error",o),e.removeEventListener("load",o),r()};e.addEventListener("load",o,{once:!0}),e.addEventListener("error",o,{once:!0}),setTimeout(r,t)}))}function A(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function P(...e){const t=C("data-turbo-action",...e);return function(e){return"advance"==e||"replace"==e||"restore"==e}(t)?t:null}function R(e){return document.querySelector(`meta[name="${e}"]`)}function T(e){const t=R(e);return t&&t.content}function L(e,t){var r;if(e instanceof Element)return e.closest(t)||L(e.assignedSlot||(null===(r=e.getRootNode())||void 0===r?void 0:r.host),t)}!function(e){e[e.get=0]="get",e[e.post=1]="post",e[e.put=2]="put",e[e.patch=3]="patch",e[e.delete=4]="delete"}(a||(a={}));class _{constructor(e,t,r,o=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=e=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=o,this.url=r,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(e);try{this.delegate.requestStarted(this);const t=await fetch(this.url.href,e);return await this.receive(t)}catch(e){if("AbortError"!==e.name)throw this.willDelegateErrorHandling(e)&&this.delegate.requestErrored(this,e),e}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new z(e);return y("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:a[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isIdempotent?null:this.body,signal:this.abortSignal,referrer:null===(e=this.delegate.referrer)||void 0===e?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isIdempotent(){return this.method==a.get}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(e){const t=new Promise((e=>this.resolveRequestPromise=e));y("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}willDelegateErrorHandling(e){return!y("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}}class B{constructor(e,t){this.started=!1,this.intersect=e=>{const t=e.slice(-1)[0];(null==t?void 0:t.isIntersecting)&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class I{constructor(e){this.fragment=function(e){for(const t of e.querySelectorAll("turbo-stream")){const e=document.importNode(t,!0);for(const t of e.templateElement.content.querySelectorAll("script"))t.replaceWith(x(t));t.replaceWith(e)}return e}(e)}static wrap(e){return"string"==typeof e?new this(function(e){const t=document.createElement("template");return t.innerHTML=e,t.content}(e)):e}}I.contentType="text/vnd.turbo-stream.html",function(e){e[e.initialized=0]="initialized",e[e.requesting=1]="requesting",e[e.waiting=2]="waiting",e[e.receiving=3]="receiving",e[e.stopping=4]="stopping",e[e.stopped=5]="stopped"}(d||(d={})),function(e){e.urlEncoded="application/x-www-form-urlencoded",e.multipart="multipart/form-data",e.plain="text/plain"}(l||(l={}));class F{constructor(e,t,r,o=!1){this.state=d.initialized,this.delegate=e,this.formElement=t,this.submitter=r,this.formData=function(e,t){const r=new FormData(e),o=null==t?void 0:t.getAttribute("name"),n=null==t?void 0:t.getAttribute("value");o&&r.append(o,n||"");return r}(t,r),this.location=m(this.action),this.method==a.get&&function(e,t){const r=new URLSearchParams;for(const[e,o]of t)o instanceof File||r.append(e,o);e.search=r.toString()}(this.location,[...this.body.entries()]),this.fetchRequest=new _(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=o}static confirmMethod(e,t,r){return Promise.resolve(confirm(e))}get method(){var e;return function(e){switch(e.toLowerCase()){case"get":return a.get;case"post":return a.post;case"put":return a.put;case"patch":return a.patch;case"delete":return a.delete}}(((null===(e=this.submitter)||void 0===e?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"").toLowerCase())||a.get}get action(){var e;const t="string"==typeof this.formElement.action?this.formElement.action:null;return(null===(e=this.submitter)||void 0===e?void 0:e.hasAttribute("formaction"))?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==l.urlEncoded||this.method==a.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return function(e){switch(e.toLowerCase()){case l.multipart:return l.multipart;case l.plain:return l.plain;default:return l.urlEncoded}}((null===(e=this.submitter)||void 0===e?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isIdempotent(){return this.fetchRequest.isIdempotent}get stringFormData(){return[...this.formData].reduce(((e,[t,r])=>e.concat("string"==typeof r?[[t,r]]:[])),[])}async start(){const{initialized:e,requesting:t}=d,r=C("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof r){if(!await F.confirmMethod(r,this.formElement,this.submitter))return}if(this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=d;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isIdempotent){const t=function(e){if(null!=e){const t=(document.cookie?document.cookie.split("; "):[]).find((t=>t.startsWith(e)));if(t){const e=t.split("=").slice(1).join("=");return e?decodeURIComponent(e):void 0}}}(T("csrf-param"))||T("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(I.contentType)}requestStarted(e){var t;this.state=d.waiting,null===(t=this.submitter)||void 0===t||t.setAttribute("disabled",""),y("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&function(e){return 200==e.statusCode&&!e.redirected}(t)){const e=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,e)}else this.state=d.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=d.stopped,null===(t=this.submitter)||void 0===t||t.removeAttribute("disabled"),y("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}requestMustRedirect(e){return!e.isIdempotent&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isIdempotent||function(e,...t){return t.some((t=>t&&t.hasAttribute(e)))}("data-turbo-stream",this.submitter,this.formElement)}}class N{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return null!=this.getElementForAnchor(e)}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){for(const e of this.element.querySelectorAll("[autofocus]"))if(null==e.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"))return e;return null}get permanentElements(){return H(this.element)}getPermanentElementById(e){return D(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const r of this.permanentElements){const{id:o}=r,n=e.getPermanentElementById(o);n&&(t[o]=[r,n])}return t}}function D(e,t){return e.querySelector(`#${t}[data-turbo-permanent]`)}function H(e){return e.querySelectorAll("[id][data-turbo-permanent]")}class U{constructor(e,t){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&function(e,t){const r=(null==t?void 0:t.getAttribute("formmethod"))||e.getAttribute("method");return"dialog"!=r}(t,r)&&function(e,t){if((null==t?void 0:t.hasAttribute("formtarget"))||e.hasAttribute("target")){const r=(null==t?void 0:t.getAttribute("formtarget"))||e.target;for(const e of document.getElementsByName(r))if(e instanceof HTMLIFrameElement)return!1;return!0}return!0}(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}}class Z{constructor(e,t){this.resolveRenderPromise=e=>{},this.resolveInterceptionPromise=e=>{},this.delegate=e,this.element=t}scrollToAnchor(e){const t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(b(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){const{isPreview:t,shouldRender:r,newSnapshot:o}=e;if(r)try{this.renderPromise=new Promise((e=>this.resolveRenderPromise=e)),this.renderer=e,await this.prepareToRenderSnapshot(e);const r=new Promise((e=>this.resolveInterceptionPromise=e)),n={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(o,n)||await r,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(o,t),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}}class W extends Z{invalidate(){this.element.innerHTML=""}get snapshot(){return new N(this.element)}}class V{constructor(e,t){this.clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent},this.linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent},this.willVisit=e=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}}class Y{constructor(e,t){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=e.composedPath&&e.composedPath()[0]||e.target,r=this.findLinkFromClickTarget(t);if(r&&function(e){if(e.hasAttribute("target")){for(const t of document.getElementsByName(e.target))if(t instanceof HTMLIFrameElement)return!1;return!0}return!0}(r)){const t=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,t,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,t))}}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return L(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return m(e.getAttribute("href")||"")}}class ${constructor(e,t){this.delegate=e,this.linkInterceptor=new Y(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&e.hasAttribute("data-turbo-method")}followedLinkToLocation(e,t){const r=document.createElement("form");for(const[e,o]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:"hidden",name:e,value:o}));const o=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",o.href),r.setAttribute("hidden","");const n=e.getAttribute("data-turbo-method");n&&r.setAttribute("method",n);const i=e.getAttribute("data-turbo-frame");i&&r.setAttribute("data-turbo-frame",i);const a=P(e);a&&r.setAttribute("data-turbo-action",a);const d=e.getAttribute("data-turbo-confirm");d&&r.setAttribute("data-turbo-confirm",d);e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",(()=>r.remove()),{once:!0}),requestAnimationFrame((()=>r.requestSubmit()))}}class K{constructor(e,t){this.delegate=e,this.permanentElementMap=t}static async preservingPermanentElements(e,t,r){const o=new this(e,t);o.enter(),await r(),o.leave()}enter(){for(const e in this.permanentElementMap){const[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(const e in this.permanentElementMap){const[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){const t=function(e){const t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",e.id),t}(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){const t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){const t=this.getPlaceholderById(e.id);null==t||t.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find((t=>t.content==e))}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class J{constructor(e,t,r,o,n=!0){this.activeElement=null,this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=o,this.willRender=n,this.renderElement=r,this.promise=new Promise(((e,t)=>this.resolvingFunctions={resolve:e,reject:t}))}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await K.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){const e=this.connectedSnapshot.firstAutofocusableElement;(function(e){return e&&"function"==typeof e.focus})(e)&&e.focus()}enteringBardo(e){this.activeElement||e.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}}class Q extends J{constructor(e,t,r,o,n,i=!0){super(t,r,o,n,i),this.delegate=e}static renderElement(e,t){var r;const o=document.createRange();o.selectNodeContents(e),o.deleteContents();const n=t,i=null===(r=n.ownerDocument)||void 0===r?void 0:r.createRange();i&&(i.selectNodeContents(n),e.appendChild(i.extractContents()))}get shouldRender(){return!0}async render(){await k(),this.preservingPermanentElements((()=>{this.loadFrameElement()})),this.scrollFrameIntoView(),await k(),this.focusFirstAutofocusableElement(),await k(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const r=this.currentElement.firstElementChild,o=(e=this.currentElement.getAttribute("data-autoscroll-block"),t="end","end"==e||"start"==e||"center"==e||"nearest"==e?e:t),n=function(e,t){return"auto"==e||"smooth"==e?e:t}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(r)return r.scrollIntoView({block:o,behavior:n}),!0}var e,t;return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=x(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}class G{constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return E` .turbo-progress-bar { position: fixed; display: block; @@ -9,8 +9,8 @@ background: #0076ff; z-index: 2147483647; transition: - width ${Q.animationDuration}ms ease-out, - opacity ${Q.animationDuration/2}ms ${Q.animationDuration/2}ms ease-in; + width ${G.animationDuration}ms ease-out, + opacity ${G.animationDuration/2}ms ${G.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } - `}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement((()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1})))}setValue(t){this.value=t,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(t){this.progressElement.style.opacity="0",setTimeout(t,1.5*Q.animationDuration)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,Q.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame((()=>{this.progressElement.style.width=10+90*this.value+"%"}))}createStylesheetElement(){const t=document.createElement("style");return t.type="text/css",t.textContent=Q.defaultCSS,this.cspNonce&&(t.nonce=this.cspNonce),t}createProgressElement(){const t=document.createElement("div");return t.className="turbo-progress-bar",t}get cspNonce(){return _("csp-nonce")}}Q.animationDuration=300;class G extends D{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter((t=>!function(t){const e=t.localName;return"noscript"==e}(t))).map((t=>function(t){t.hasAttribute("nonce")&&t.setAttribute("nonce","");return t}(t))).reduce(((t,e)=>{const{outerHTML:r}=e,n=r in t?t[r]:{type:X(e),tracked:tt(e),elements:[]};return Object.assign(Object.assign({},t),{[r]:Object.assign(Object.assign({},n),{elements:[...n.elements,e]})})}),{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter((t=>this.detailsByOuterHTML[t].tracked)).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,e){return Object.keys(this.detailsByOuterHTML).filter((t=>!(t in e.detailsByOuterHTML))).map((t=>this.detailsByOuterHTML[t])).filter((({type:e})=>e==t)).map((({elements:[t]})=>t))}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce(((t,e)=>{const{type:r,tracked:n,elements:o}=this.detailsByOuterHTML[e];return null!=r||n?o.length>1?[...t,...o.slice(1)]:t:[...t,...o]}),[])}getMetaValue(t){const e=this.findMetaElementByName(t);return e?e.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce(((e,r)=>{const{elements:[n]}=this.detailsByOuterHTML[r];return function(t,e){const r=t.localName;return"meta"==r&&t.getAttribute("name")==e}(n,t)?n:e}),void 0)}}function X(t){return function(t){const e=t.localName;return"script"==e}(t)?"script":function(t){const e=t.localName;return"style"==e||"link"==e&&"stylesheet"==t.getAttribute("rel")}(t)?"stylesheet":void 0}function tt(t){return"reload"==t.getAttribute("data-turbo-track")}class et extends D{constructor(t,e){super(t),this.headSnapshot=e}static fromHTMLString(t=""){return this.fromDocument(A(t))}static fromElement(t){return this.fromDocument(t.ownerDocument)}static fromDocument({head:t,body:e}){return new this(e,new G(t))}clone(){const t=this.element.cloneNode(!0),e=this.element.querySelectorAll("select"),r=t.querySelectorAll("select");for(const[t,n]of e.entries()){const e=r[t];for(const t of e.selectedOptions)t.selected=!1;for(const t of n.selectedOptions)e.options[t.index].selected=!0}for(const e of t.querySelectorAll('input[type="password"]'))e.value="";return new et(t,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var t;return h(null!==(t=this.getSetting("root"))&&void 0!==t?t:"/")}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return"no-preview"!=this.cacheControlValue}get isCacheable(){return"no-cache"!=this.cacheControlValue}get isVisitable(){return"reload"!=this.getSetting("visit-control")}getSetting(t){return this.headSnapshot.getMetaValue(`turbo-${t}`)}}!function(t){t.visitStart="visitStart",t.requestStart="requestStart",t.requestEnd="requestEnd",t.visitEnd="visitEnd"}(l||(l={})),function(t){t.initialized="initialized",t.started="started",t.canceled="canceled",t.failed="failed",t.completed="completed"}(u||(u={}));const rt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1};var nt,ot;!function(t){t[t.networkFailure=0]="networkFailure",t[t.timeoutFailure=-1]="timeoutFailure",t[t.contentTypeMismatch=-2]="contentTypeMismatch"}(nt||(nt={}));class it{constructor(t,e,r,n={}){this.identifier=R(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=u.initialized,this.delegate=t,this.location=e,this.restorationIdentifier=r||R();const{action:o,historyChanged:i,referrer:s,snapshot:a,snapshotHTML:c,response:l,visitCachedSnapshot:f,willRender:h,updateHistory:p,shouldCacheSnapshot:d,acceptsStreamResponse:m}=Object.assign(Object.assign({},rt),n);this.action=o,this.historyChanged=i,this.referrer=s,this.snapshot=a,this.snapshotHTML=c,this.response=l,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=f,this.willRender=h,this.updateHistory=p,this.scrolled=!h,this.shouldCacheSnapshot=d,this.acceptsStreamResponse=m}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==u.initialized&&(this.recordTimingMetric(l.visitStart),this.state=u.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==u.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=u.canceled)}complete(){this.state==u.started&&(this.recordTimingMetric(l.visitEnd),this.state=u.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==u.started&&(this.state=u.failed,this.adapter.visitFailed(this))}changeHistory(){var t;if(!this.historyChanged&&this.updateHistory){const e=x(this.location.href===(null===(t=this.referrer)||void 0===t?void 0:t.href)?"replace":this.action);this.history.update(e,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new B(this,s.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(l.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(t=this.response){if(this.response=t,t){const{statusCode:e}=t;st(e)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,e)}}finishRequest(){this.recordTimingMetric(l.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:t,responseHTML:e}=this.response;this.render((async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,st(t)&&null!=e?(await this.view.renderPage(et.fromHTMLString(e),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(et.fromHTMLString(e),this),this.adapter.visitRendered(this),this.fail())}))}}getCachedSnapshot(){const t=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(t&&(!p(this.location)||t.hasAnchor(p(this.location)))&&("restore"==this.action||t.isPreviewable))return t}getPreloadedSnapshot(){if(this.snapshotHTML)return et.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return null!=this.getCachedSnapshot()}loadCachedSnapshot(){const t=this.getCachedSnapshot();if(t){const e=this.shouldIssueRequest();this.render((async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(t,e,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),e||this.complete())}))}}followRedirect(){var t;this.redirectedToLocation&&!this.followedRedirect&&(null===(t=this.response)||void 0===t?void 0:t.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render((async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)}))}prepareHeadersForRequest(t,e){this.acceptsStreamResponse&&e.acceptResponseType(I.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(t,e){}async requestSucceededWithResponse(t,e){const r=await e.responseHTML,{redirected:n,statusCode:o}=e;null==r?this.recordResponse({statusCode:nt.contentTypeMismatch,redirected:n}):(this.redirectedToLocation=e.redirected?e.location:void 0,this.recordResponse({statusCode:o,responseHTML:r,redirected:n}))}async requestFailedWithResponse(t,e){const r=await e.responseHTML,{redirected:n,statusCode:o}=e;null==r?this.recordResponse({statusCode:nt.contentTypeMismatch,redirected:n}):this.recordResponse({statusCode:o,responseHTML:r,redirected:n})}requestErrored(t,e){this.recordResponse({statusCode:nt.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||this.view.forceReloaded||("restore"==this.action?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){const{scrollPosition:t}=this.restorationData;if(t)return this.view.scrollToPosition(t),!0}scrollToAnchor(){const t=p(this.location);if(null!=t)return this.view.scrollToAnchor(t),!0}recordTimingMetric(t){this.timingMetrics[t]=(new Date).getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(t){switch(t){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return"object"==typeof this.response}shouldIssueRequest(){return!this.isSamePage&&("restore"==this.action?!this.hasCachedSnapshot():this.willRender)}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then((t=>t&&this.visitCachedSnapshot(t))),this.snapshotCached=!0)}async render(t){this.cancelRender(),await new Promise((t=>{this.frame=requestAnimationFrame((()=>t()))})),await t(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function st(t){return t>=200&&t<300}class at{constructor(t){this.progressBar=new Q,this.showProgressBar=()=>{this.progressBar.show()},this.session=t}visitProposedToLocation(t,e){this.navigator.startVisit(t,(null==e?void 0:e.restorationIdentifier)||R(),e)}visitStarted(t){this.location=t.location,t.loadCachedSnapshot(),t.issueRequest(),t.goToSamePageAnchor()}visitRequestStarted(t){this.progressBar.setValue(0),t.hasCachedSnapshot()||"restore"!=t.action?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(t){t.loadResponse()}visitRequestFailedWithStatusCode(t,e){switch(e){case nt.networkFailure:case nt.timeoutFailure:case nt.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:e}});default:return t.loadResponse()}}visitRequestFinished(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(t){}pageInvalidated(t){this.reload(t)}visitFailed(t){}visitRendered(t){}formSubmissionStarted(t){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(t){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),null!=this.visitProgressBarTimeout&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){null==this.formProgressBarTimeout&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),null!=this.formProgressBarTimeout&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(t){var e;E("turbo:reload",{detail:t}),window.location.href=(null===(e=this.location)||void 0===e?void 0:e.toString())||window.location.href}get navigator(){return this.session.navigator}}class ct{constructor(){this.started=!1,this.removeStaleElements=t=>{const e=[...document.querySelectorAll('[data-turbo-cache="false"]')];for(const t of e)t.remove()}}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeStaleElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeStaleElements,!1))}}class lt{constructor(t,e){this.session=t,this.element=e,this.linkInterceptor=new W(this,e),this.formSubmitObserver=new U(this,e)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(t,e,r){return this.shouldRedirect(t)}linkClickIntercepted(t,e,r){const n=this.findFrameElement(t);n&&n.delegate.linkClickIntercepted(t,e,r)}willSubmitForm(t,e){return null==t.closest("turbo-frame")&&this.shouldSubmit(t,e)&&this.shouldRedirect(t,e)}formSubmitted(t,e){const r=this.findFrameElement(t,e);r&&r.delegate.formSubmitted(t,e)}shouldSubmit(t,e){var r;const n=d(t,e),o=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=h(null!==(r=null==o?void 0:o.content)&&void 0!==r?r:"/");return this.shouldRedirect(t,e)&&g(n,i)}shouldRedirect(t,e){if(t instanceof HTMLFormElement?this.session.submissionIsNavigatable(t,e):this.session.elementIsNavigatable(t)){const r=this.findFrameElement(t,e);return!!r&&r!=t.closest("turbo-frame")}return!1}findFrameElement(t,e){const r=(null==e?void 0:e.getAttribute("data-turbo-frame"))||t.getAttribute("data-turbo-frame");if(r&&"_top"!=r){const t=this.element.querySelector(`#${r}:not([disabled])`);if(t instanceof f)return t}}}class ut{constructor(t){this.restorationIdentifier=R(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){const{turbo:e}=t.state||{};if(e){this.location=new URL(window.location.href);const{restorationIdentifier:t}=e;this.restorationIdentifier=t,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,t)}}},this.onPageLoad=async t=>{await Promise.resolve(),this.pageLoaded=!0},this.delegate=t}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(t,e){this.update(history.pushState,t,e)}replace(t,e){this.update(history.replaceState,t,e)}update(t,e,r=R()){const n={turbo:{restorationIdentifier:r}};t.call(history,n,"",e.href),this.location=e,this.restorationIdentifier=r}getRestorationDataForIdentifier(t){return this.restorationData[t]||{}}updateRestorationData(t){const{restorationIdentifier:e}=this,r=this.restorationData[e];this.restorationData[e]=Object.assign(Object.assign({},r),t)}assumeControlOfScrollRestoration(){var t;this.previousScrollRestoration||(this.previousScrollRestoration=null!==(t=history.scrollRestoration)&&void 0!==t?t:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||"complete"==document.readyState}}class ft{constructor(t){this.delegate=t}proposeVisit(t,e={}){this.delegate.allowsVisitingLocationWithAction(t,e.action)&&(g(t,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(t,e):window.location.href=t.toString())}startVisit(t,e,r={}){this.stop(),this.currentVisit=new it(this,h(t),e,Object.assign({referrer:this.location},r)),this.currentVisit.start()}submitForm(t,e){this.stop(),this.formSubmission=new N(this,t,e,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(t){"function"==typeof this.adapter.formSubmissionStarted&&this.adapter.formSubmissionStarted(t)}async formSubmissionSucceededWithResponse(t,e){if(t==this.formSubmission){const r=await e.responseHTML;if(r){const n=t.method==s.get;n||this.view.clearSnapshotCache();const{statusCode:o,redirected:i}=e,a={action:this.getActionForFormSubmission(t),shouldCacheSnapshot:n,response:{statusCode:o,responseHTML:r,redirected:i}};this.proposeVisit(e.location,a)}}}async formSubmissionFailedWithResponse(t,e){const r=await e.responseHTML;if(r){const t=et.fromHTMLString(r);e.serverError?await this.view.renderError(t,this.currentVisit):await this.view.renderPage(t,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(t,e){}formSubmissionFinished(t){"function"==typeof this.adapter.formSubmissionFinished&&this.adapter.formSubmissionFinished(t)}visitStarted(t){this.delegate.visitStarted(t)}visitCompleted(t){this.delegate.visitCompleted(t)}locationWithActionIsSamePage(t,e){const r=p(t),n=p(this.view.lastRenderedLocation),o="restore"===e&&void 0===r;return"replace"!==e&&b(t)===b(this.view.lastRenderedLocation)&&(o||null!=r&&r!==n)}visitScrolledToSamePageLocation(t,e){this.delegate.visitScrolledToSamePageLocation(t,e)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission(t){const{formElement:e,submitter:r}=t,n=k("data-turbo-action",r,e);return S(n)?n:"advance"}}!function(t){t[t.initial=0]="initial",t[t.loading=1]="loading",t[t.interactive=2]="interactive",t[t.complete=3]="complete"}(ot||(ot={}));class ht{constructor(t){this.stage=ot.initial,this.started=!1,this.interpretReadyState=()=>{const{readyState:t}=this;"interactive"==t?this.pageIsInteractive():"complete"==t&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=t}start(){this.started||(this.stage==ot.initial&&(this.stage=ot.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==ot.loading&&(this.stage=ot.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==ot.interactive&&(this.stage=ot.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class pt{constructor(t){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=t}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(t){this.delegate.scrollPositionChanged(t)}}class dt{render({fragment:t}){K.preservingPermanentElements(this,function(t){const e=H(document.documentElement),r={};for(const n of e){const{id:e}=n;for(const o of t.querySelectorAll("turbo-stream")){const t=q(o.templateElement.content,e);t&&(r[e]=[n,t])}}return r}(t),(()=>document.documentElement.appendChild(t)))}enteringBardo(t,e){e.replaceWith(t.cloneNode(!0))}leavingBardo(){}}class mt{constructor(t){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{const e=function(t){var e;const r=null===(e=t.detail)||void 0===e?void 0:e.fetchResponse;if(r instanceof w)return r}(t);e&&function(t){var e;const r=null!==(e=t.contentType)&&void 0!==e?e:"";return r.startsWith(I.contentType)}(e)&&(t.preventDefault(),this.receiveMessageResponse(e))},this.receiveMessageEvent=t=>{this.started&&"string"==typeof t.data&&this.receiveMessageHTML(t.data)},this.delegate=t}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(t){this.streamSourceIsConnected(t)||(this.sources.add(t),t.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(t){this.streamSourceIsConnected(t)&&(this.sources.delete(t),t.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(t){return this.sources.has(t)}async receiveMessageResponse(t){const e=await t.responseHTML;e&&this.receiveMessageHTML(e)}receiveMessageHTML(t){this.delegate.receivedMessageFromStream(I.wrap(t))}}class yt extends Y{static renderElement(t,e){const{documentElement:r,body:n}=document;r.replaceChild(e,n)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){const{documentElement:t,head:e}=document;t.replaceChild(this.newHead,e),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(const t of this.scriptElements){const e=t.parentNode;if(e){const r=O(t);e.replaceChild(r,t)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}class gt extends Y{static renderElement(t,e){document.body&&e instanceof HTMLBodyElement?document.body.replaceWith(e):document.documentElement.appendChild(e)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){return this.newSnapshot.isVisitable?this.trackedElementsAreIdentical?void 0:{reason:"tracked_element_mismatch"}:{reason:"turbo_visit_control_is_reload"}}async prepareToRender(){await this.mergeHead()}async render(){this.willRender&&this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){const t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements(),await t}replaceBody(){this.preservingPermanentElements((()=>{this.activateNewBody(),this.assignNewBody()}))}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const t=[];for(const e of this.newHeadStylesheetElements)t.push(L(e)),document.head.appendChild(e);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(O(t))}removeCurrentHeadProvisionalElements(){for(const t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(const t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const t of this.newBodyScriptElements){const e=O(t);t.replaceWith(e)}}assignNewBody(){this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}}class bt{constructor(t){this.keys=[],this.snapshots={},this.size=t}has(t){return v(t)in this.snapshots}get(t){if(this.has(t)){const e=this.read(t);return this.touch(t),e}}put(t,e){return this.write(t,e),this.touch(t),e}clear(){this.snapshots={}}read(t){return this.snapshots[v(t)]}write(t,e){this.snapshots[v(t)]=e}touch(t){const e=v(t),r=this.keys.indexOf(e);r>-1&&this.keys.splice(r,1),this.keys.unshift(e),this.trim()}trim(){for(const t of this.keys.splice(this.size))delete this.snapshots[t]}}class vt extends Z{constructor(){super(...arguments),this.snapshotCache=new bt(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(t,e=!1,r=!0,n){const o=new gt(this.snapshot,t,gt.renderElement,e,r);return o.shouldRender?null==n||n.changeHistory():this.forceReloaded=!0,this.render(o)}renderError(t,e){null==e||e.changeHistory();const r=new yt(this.snapshot,t,yt.renderElement,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:e}=this;await new Promise((t=>setTimeout((()=>t()),0)));const r=t.clone();return this.snapshotCache.put(e,r),r}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}get snapshot(){return et.fromElement(this.element)}}class wt{constructor(t){this.selector="a[data-turbo-preload]",this.delegate=t}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if("loading"===document.readyState)return document.addEventListener("DOMContentLoaded",(()=>{this.preloadOnLoadLinksForView(document.body)}));this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(t){for(const e of t.querySelectorAll(this.selector))this.preloadURL(e)}async preloadURL(t){const e=new URL(t.href);if(!this.snapshotCache.has(e))try{const t=await fetch(e.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}}),r=await t.text(),n=et.fromHTMLString(r);this.snapshotCache.put(e,n)}catch(t){}}}function St(t){Object.defineProperties(t,Ot)}const Ot={absoluteURL:{get(){return this.toString()}}};const Et={after(){this.targetElements.forEach((t=>{var e;return null===(e=t.parentElement)||void 0===e?void 0:e.insertBefore(this.templateContent,t.nextSibling)}))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((t=>t.append(this.templateContent)))},before(){this.targetElements.forEach((t=>{var e;return null===(e=t.parentElement)||void 0===e?void 0:e.insertBefore(this.templateContent,t)}))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((t=>t.prepend(this.templateContent)))},remove(){this.targetElements.forEach((t=>t.remove()))},replace(){this.targetElements.forEach((t=>t.replaceWith(this.templateContent)))},update(){this.targetElements.forEach((t=>t.replaceChildren(this.templateContent)))}},Pt=new class{constructor(){this.navigator=new ft(this),this.history=new ut(this),this.preloader=new wt(this),this.view=new vt(this,document.documentElement),this.adapter=new at(this),this.pageObserver=new ht(this),this.cacheObserver=new ct,this.linkClickObserver=new $(this,window),this.formSubmitObserver=new U(this,document),this.scrollObserver=new pt(this),this.streamObserver=new mt(this),this.formLinkClickObserver=new z(this,document.documentElement),this.frameRedirector=new lt(this,document.documentElement),this.streamMessageRenderer=new dt,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(t){this.adapter=t}visit(t,e={}){const r=e.frame?document.getElementById(e.frame):null;r instanceof f?(r.src=t.toString(),r.loaded):this.navigator.proposeVisit(h(t),e)}connectStreamSource(t){this.streamObserver.connectStreamSource(t)}disconnectStreamSource(t){this.streamObserver.disconnectStreamSource(t)}renderStreamMessage(t){this.streamMessageRenderer.render(I.wrap(t))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(t){this.progressBarDelay=t}setFormMode(t){this.formMode=t}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(t,e){this.enabled?this.navigator.startVisit(t,e,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(t){this.history.updateRestorationData({scrollPosition:t})}willSubmitFormLinkToLocation(t,e){return this.elementIsNavigatable(t)&&g(e,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(t,e,r){return this.elementIsNavigatable(t)&&g(e,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(t,e,r)}followedLinkToLocation(t,e){const r=this.getActionForLink(t),n=t.hasAttribute("data-turbo-stream");this.visit(e.href,{action:r,acceptsStreamResponse:n})}allowsVisitingLocationWithAction(t,e){return this.locationWithActionIsSamePage(t,e)||this.applicationAllowsVisitingLocation(t)}visitProposedToLocation(t,e){St(t),this.adapter.visitProposedToLocation(t,e)}visitStarted(t){t.acceptsStreamResponse||T(document.documentElement),St(t.location),t.silent||this.notifyApplicationAfterVisitingLocation(t.location,t.action)}visitCompleted(t){C(document.documentElement),this.notifyApplicationAfterPageLoad(t.getTimingMetrics())}locationWithActionIsSamePage(t,e){return this.navigator.locationWithActionIsSamePage(t,e)}visitScrolledToSamePageLocation(t,e){this.notifyApplicationAfterVisitingSamePageLocation(t,e)}willSubmitForm(t,e){const r=d(t,e);return this.submissionIsNavigatable(t,e)&&g(h(r),this.snapshot.rootLocation)}formSubmitted(t,e){this.navigator.submitForm(t,e)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(t){this.renderStreamMessage(t)}viewWillCacheSnapshot(){var t;(null===(t=this.navigator.currentVisit)||void 0===t?void 0:t.silent)||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:t},e){const r=this.notifyApplicationBeforeRender(t,e),{defaultPrevented:n,detail:{render:o}}=r;return this.view.renderer&&o&&(this.view.renderer.renderElement=o),!n}viewRenderedSnapshot(t,e){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}preloadOnLoadLinksForView(t){this.preloader.preloadOnLoadLinksForView(t)}viewInvalidated(t){this.adapter.pageInvalidated(t)}frameLoaded(t){this.notifyApplicationAfterFrameLoad(t)}frameRendered(t,e){this.notifyApplicationAfterFrameRender(t,e)}applicationAllowsFollowingLinkToLocation(t,e,r){return!this.notifyApplicationAfterClickingLinkToLocation(t,e,r).defaultPrevented}applicationAllowsVisitingLocation(t){return!this.notifyApplicationBeforeVisitingLocation(t).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(t,e,r){return E("turbo:click",{target:t,detail:{url:e.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(t){return E("turbo:before-visit",{detail:{url:t.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(t,e){return E("turbo:visit",{detail:{url:t.href,action:e}})}notifyApplicationBeforeCachingSnapshot(){return E("turbo:before-cache")}notifyApplicationBeforeRender(t,e){return E("turbo:before-render",{detail:Object.assign({newBody:t},e),cancelable:!0})}notifyApplicationAfterRender(){return E("turbo:render")}notifyApplicationAfterPageLoad(t={}){return E("turbo:load",{detail:{url:this.location.href,timing:t}})}notifyApplicationAfterVisitingSamePageLocation(t,e){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:t.toString(),newURL:e.toString()}))}notifyApplicationAfterFrameLoad(t){return E("turbo:frame-load",{target:t})}notifyApplicationAfterFrameRender(t,e){return E("turbo:frame-render",{detail:{fetchResponse:t},target:e,cancelable:!0})}submissionIsNavigatable(t,e){if("off"==this.formMode)return!1;{const r=!e||this.elementIsNavigatable(e);return"optin"==this.formMode?r&&null!=t.closest('[data-turbo="true"]'):r&&this.elementIsNavigatable(t)}}elementIsNavigatable(t){const e=t.closest("[data-turbo]"),r=t.closest("turbo-frame");return this.drive||r?!e||"false"!=e.getAttribute("data-turbo"):!!e&&"true"==e.getAttribute("data-turbo")}getActionForLink(t){const e=t.getAttribute("data-turbo-action");return S(e)?e:"advance"}get snapshot(){return this.view.snapshot}},At=new class{constructor(t){this.session=t}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(t){!function(t,e){let r=M(t);r||(r=document.createElement("meta"),r.setAttribute("name",t),document.head.appendChild(r)),r.setAttribute("content",e)}("turbo-cache-control",t)}}(Pt),{navigator:jt}=Pt;function Rt(){Pt.start()}function kt(t){Pt.registerAdapter(t)}function Tt(t,e){Pt.visit(t,e)}function Ct(t){Pt.connectStreamSource(t)}function Lt(t){Pt.disconnectStreamSource(t)}function xt(t){Pt.renderStreamMessage(t)}function Mt(){Pt.clearCache()}function _t(t){Pt.setProgressBarDelay(t)}function Bt(t){N.confirmMethod=t}function Ft(t){Pt.setFormMode(t)}var It=Object.freeze({__proto__:null,navigator:jt,session:Pt,cache:At,PageRenderer:gt,PageSnapshot:et,FrameRenderer:J,start:Rt,registerAdapter:kt,visit:Tt,connectStreamSource:Ct,disconnectStreamSource:Lt,renderStreamMessage:xt,clearCache:Mt,setProgressBarDelay:_t,setConfirmMethod:Bt,setFormMode:Ft,StreamActions:Et});function Nt(t){if(null!=t){const e=document.getElementById(t);if(e instanceof f)return e}}function Dt(t,e){if(t){const n=t.getAttribute("src");if(null!=n&&null!=e&&(r=e,h(n).href==h(r).href))throw new Error(`Matching element has a source URL which references itself`);if(t.ownerDocument!==document&&(t=document.importNode(t,!0)),t instanceof f)return t.connectedCallback(),t.disconnectedCallback(),t}var r}class qt extends HTMLElement{static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){}finally{this.disconnect()}}async render(){var t;return null!==(t=this.renderPromise)&&void 0!==t?t:this.renderPromise=(async()=>{const t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await P(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch(t){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach((t=>t.remove()))}get duplicateChildren(){var t;const e=this.targetElements.flatMap((t=>[...t.children])).filter((t=>!!t.id)),r=[...(null===(t=this.templateContent)||void 0===t?void 0:t.children)||[]].filter((t=>!!t.id)).map((t=>t.id));return e.filter((t=>r.includes(t.id)))}get performAction(){if(this.action){const t=Et[this.action];if(t)return t;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){return this.target?this.targetElementsById:this.targets?this.targetElementsByQuery:void this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(null===this.firstElementChild){const t=this.ownerDocument.createElement("template");return this.appendChild(t),t}if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a