(()=>{var Rl=Object.create;var ko=Object.defineProperty;var Ml=Object.getOwnPropertyDescriptor;var Pl=Object.getOwnPropertyNames;var Dl=Object.getPrototypeOf,Fl=Object.prototype.hasOwnProperty;var Bl=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nl=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pl(e))!Fl.call(i,n)&&n!==t&&ko(i,n,{get:()=>e[n],enumerable:!(r=Ml(e,n))||r.enumerable});return i};var Hl=(i,e,t)=>(t=i!=null?Rl(Dl(i)):{},Nl(e||!i||!i.__esModule?ko(t,"default",{value:i,enumerable:!0}):t,i));var $o=Bl((Jp,Vo)=>{var Cc="Expected a function",qo=NaN,Ic="[object Symbol]",Oc=/^\s+|\s+$/g,Rc=/^[-+]0x[0-9a-f]+$/i,Mc=/^0b[01]+$/i,Pc=/^0o[0-7]+$/i,Dc=parseInt,Fc=typeof global=="object"&&global&&global.Object===Object&&global,Bc=typeof self=="object"&&self&&self.Object===Object&&self,Nc=Fc||Bc||Function("return this")(),Hc=Object.prototype,qc=Hc.toString,zc=Math.max,Vc=Math.min,Gn=function(){return Nc.Date.now()};function $c(i,e,t){var r,n,s,o,a,l,d=0,p=!1,m=!1,E=!0;if(typeof i!="function")throw new TypeError(Cc);e=zo(e)||0,Xn(t)&&(p=!!t.leading,m="maxWait"in t,s=m?zc(zo(t.maxWait)||0,e):s,E="trailing"in t?!!t.trailing:E);function v(x){var P=r,N=n;return r=n=void 0,d=x,o=i.apply(N,P),o}function C(x){return d=x,a=setTimeout(D,e),p?v(x):o}function _(x){var P=x-l,N=x-d,U=e-P;return m?Vc(U,s-N):U}function k(x){var P=x-l,N=x-d;return l===void 0||P>=e||P<0||m&&N>=s}function D(){var x=Gn();if(k(x))return q(x);a=setTimeout(D,_(x))}function q(x){return a=void 0,E&&r?v(x):(r=n=void 0,o)}function B(){a!==void 0&&clearTimeout(a),d=0,r=l=n=a=void 0}function S(){return a===void 0?o:q(Gn())}function R(){var x=Gn(),P=k(x);if(r=arguments,n=this,l=x,P){if(a===void 0)return C(l);if(m)return a=setTimeout(D,e),v(l)}return a===void 0&&(a=setTimeout(D,e)),o}return R.cancel=B,R.flush=S,R}function Xn(i){var e=typeof i;return!!i&&(e=="object"||e=="function")}function jc(i){return!!i&&typeof i=="object"}function Uc(i){return typeof i=="symbol"||jc(i)&&qc.call(i)==Ic}function zo(i){if(typeof i=="number")return i;if(Uc(i))return qo;if(Xn(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Xn(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=i.replace(Oc,"");var t=Mc.test(i);return t||Pc.test(i)?Dc(i.slice(2),t?2:8):Rc.test(i)?qo:+i}Vo.exports=$c});var Sn=class{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){let t=ql(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,n=t.index;return rn?1:0})}};function ql(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:e}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Tn=class{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){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:n}=e,s=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,n);s.delete(o),s.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:n}=e;return this.fetchEventListener(t,r,n)}fetchEventListener(e,t,r){let n=this.fetchEventListenerMapForEventTarget(e),s=this.cacheKey(t,r),o=n.get(s);return o||(o=this.createEventListener(e,t,r),n.set(s,o)),o}createEventListener(e,t,r){let n=new Sn(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){let r=[e];return Object.keys(t).sort().forEach(n=>{r.push(`${t[n]?"":"!"}${n}`)}),r.join(":")}},zl={stop({event:i,value:e}){return e&&i.stopPropagation(),!0},prevent({event:i,value:e}){return e&&i.preventDefault(),!0},self({event:i,value:e,element:t}){return e?t===i.target:!0}},Vl=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function $l(i){let t=i.trim().match(Vl)||[],r=t[2],n=t[3];return n&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${n}`,n=""),{eventTarget:jl(t[4]),eventName:r,eventOptions:t[7]?Ul(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||n}}function jl(i){if(i=="window")return window;if(i=="document")return document}function Ul(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Wl(i){if(i==window)return"window";if(i==document)return"document"}function Kn(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function kn(i){return Kn(i.replace(/--/g,"-").replace(/__/g,"_"))}function wi(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Fo(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Kl(i){return i.match(/[^\s]+/g)||[]}function xo(i){return i!=null}function xn(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var Lo=["meta","ctrl","alt","shift"],Ln=class{constructor(e,t,r,n){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Gl(e)||Zi("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||Zi("missing identifier"),this.methodName=r.methodName||Zi("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=n}static forToken(e,t){return new this(e.element,e.index,$l(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(n=>!Lo.includes(n))[0];return r?(xn(this.keyMappings,r)||Zi(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:n}of Array.from(this.element.attributes)){let s=r.match(t),o=s&&s[1];o&&(e[Kn(o)]=Xl(n))}return e}get eventTargetName(){return Wl(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,n,s,o]=Lo.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==n||e.altKey!==s||e.shiftKey!==o}},Co={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Gl(i){let e=i.tagName.toLowerCase();if(e in Co)return Co[e](i)}function Zi(i){throw new Error(i)}function Xl(i){try{return JSON.parse(i)}catch{return i}}var Cn=class{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){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:n}=this.context,s=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in r){let l=r[o];s=s&&l({name:o,value:a,event:e,element:t,controller:n})}else continue;return s}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(n){let{identifier:s,controller:o,element:a,index:l}=this,d={identifier:s,controller:o,element:a,index:l,event:e};this.context.handleError(n,`invoking action "${this.action}"`,d)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0: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}},Qi=class{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(r=>this.processMutations(r))}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){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let 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?!1: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))}},Ji=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new Qi(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){let 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 Yl(i,e,t){Bo(i,e).add(t)}function Zl(i,e,t){Bo(i,e).delete(t),Ql(i,e)}function Bo(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function Ql(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var Ge=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){Yl(this.valuesByKey,e,t)}delete(e,t){Zl(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var In=class{constructor(e,t,r,n){this._selector=t,this.details=n,this.elementObserver=new Qi(e,this),this.delegate=r,this.matchesByElement=new Ge}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}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){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(t)).filter(s=>this.matchElement(s));return r.concat(n)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let n=this.matchElement(e),s=this.matchesByElement.has(r,e);n&&!s?this.selectorMatched(e,r):!n&&s&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},On=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}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(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let n=this.element.getAttribute(e);if(this.stringMap.get(e)!=n&&this.stringMapValueChanged(n,r,t),n==null){let s=this.stringMap.get(e);this.stringMap.delete(e),s&&this.stringMapKeyRemoved(r,e,s)}else this.stringMap.set(e,n)}}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())}},er=class{constructor(e,t,r){this.attributeObserver=new Ji(e,t,this),this.delegate=r,this.tokensByElement=new Ge}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){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}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){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),n=ec(t,r).findIndex(([s,o])=>!tc(s,o));return n==-1?[[],[]]:[t.slice(n),r.slice(n)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return Jl(r,e,t)}};function Jl(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,n)=>({element:e,attributeName:t,content:r,index:n}))}function ec(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,n)=>[i[n],e[n]])}function tc(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var tr=class{constructor(e,t,r){this.tokenListObserver=new er(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){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{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(t){return{error:t}}}},Rn=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new tr(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){let t=new Cn(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let 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){let t=Ln.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},Mn=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new On(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){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let n=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=n.writer(n.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let n=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,n.writer(this.receiver[e]),r):this.invokeChangedCallback(e,n.writer(n.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:n}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,n(r),void 0)}invokeChangedCallback(e,t,r){let n=`${e}Changed`,s=this.receiver[n];if(typeof s=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=r;r&&(l=o.reader(r)),s.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${wi(t.name)}`;return this.receiver[r]}},Pn=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new Ge}start(){this.tokenListObserver||(this.tokenListObserver=new er(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),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let 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 Ei(i,e){let t=No(i);return Array.from(t.reduce((r,n)=>(rc(n,e).forEach(s=>r.add(s)),r),new Set))}function ic(i,e){return No(i).reduce((r,n)=>(r.push(...nc(n,e)),r),[])}function No(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function rc(i,e){let t=i[e];return Array.isArray(t)?t:[]}function nc(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var Dn=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new Ge,this.outletElementsByName=new Ge,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let n=this.getOutlet(e,r);n&&this.connectOutlet(n,e,r)}selectorUnmatched(e,t,{outletName:r}){let n=this.getOutletFromMap(e,r);n&&this.disconnectOutlet(n,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),n=this.hasOutlet(e,t),s=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?n&&s&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var n;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(n=this.selectorObserverMap.get(r))===null||n===void 0||n.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var n;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(n=this.selectorObserverMap.get(r))===null||n===void 0||n.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new In(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new Ji(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new Ge;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;Ei(r,"outlets").forEach(s=>e.add(s,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let 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(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},Fn=class{constructor(e,t){this.logDebugActivity=(r,n={})=>{let{identifier:s,controller:o,element:a}=this;n=Object.assign({identifier:s,controller:o,element:a},n),this.application.logDebugActivity(this.identifier,r,n)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new Rn(this,this.dispatcher),this.valueObserver=new Mn(this,this.controller),this.targetObserver=new Pn(this,this),this.outletObserver=new Dn(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"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={}){let{identifier:n,controller:s,element:o}=this;r=Object.assign({identifier:n,controller:s,element:o},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(`${kn(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${kn(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function sc(i){return oc(i,ac(i))}function oc(i,e){let t=hc(i),r=lc(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function ac(i){return Ei(i,"blessings").reduce((t,r)=>{let n=r(i);for(let s in n){let o=t[s]||{};t[s]=Object.assign(o,n[s])}return t},{})}function lc(i,e){return uc(e).reduce((t,r)=>{let n=cc(i,e,r);return n&&Object.assign(t,{[r]:n}),t},{})}function cc(i,e,t){let r=Object.getOwnPropertyDescriptor(i,t);if(!(r&&"value"in r)){let s=Object.getOwnPropertyDescriptor(e,t).value;return r&&(s.get=r.get||s.get,s.set=r.set||s.set),s}}var uc=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,hc=(()=>{function i(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=i(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),i}catch{return r=>class extends r{}}})();function dc(i){return{identifier:i.identifier,controllerConstructor:sc(i.controllerConstructor)}}var Bn=class{constructor(e,t){this.application=e,this.definition=dc(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){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new Fn(this,e),this.contextsByScope.set(e,t)),t}},Nn=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return Kl(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},Hn=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${Fo(e)}`}},qn=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let n=this.warnedKeysByObject.get(e);n||(n=new Set,this.warnedKeysByObject.set(e,n)),n.has(t)||(n.add(t),this.logger.warn(r,e))}};function zn(i,e){return`[${i}~="${e}"]`}var Vn=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return zn(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return zn(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,n=this.schema.targetAttribute,s=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${n}="${r}.${t}" with ${s}="${t}". The ${n} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},$n=class{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 this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(n=>this.matchesElement(n,e,t))}matchesElement(e,t,r){let n=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&n.split(" ").includes(r)}},jn=class i{constructor(e,t,r,n){this.targets=new Vn(this),this.classes=new Nn(this),this.data=new Hn(this),this.containsElement=s=>s.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new qn(n),this.outlets=new $n(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 zn(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},Un=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new tr(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){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),n=r.get(t);return n||(n=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,n)),n}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},Wn=class{constructor(e){this.application=e,this.scopeObserver=new Un(this.element,this.schema,this),this.scopesByIdentifier=new Ge,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);let t=new Bn(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(n=>n.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new jn(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},pc={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,e)=>`data-${i}-${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",page_up:"PageUp",page_down:"PageDown"},Io("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),Io("0123456789".split("").map(i=>[i,i])))};function Io(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var ir=class{constructor(e=document.documentElement,t=pc){this.logger=console,this.debug=!1,this.logDebugActivity=(r,n,s={})=>{this.debug&&this.logFormattedMessage(r,n,s)},this.element=e,this.schema=t,this.dispatcher=new Tn(this),this.router=new Wn(this),this.actionDescriptorFilters=Object.assign({},zl)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await fc(),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(n=>{n.controllerConstructor.shouldLoad&&this.router.loadDefinition(n)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(n=>this.router.unloadIdentifier(n))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var n;this.logger.error(`%s %o %o`,t,e,r),(n=window.onerror)===null||n===void 0||n.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 fc(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function mc(i){return Ei(i,"classes").reduce((t,r)=>Object.assign(t,gc(r)),{})}function gc(i){return{[`${i}Class`]:{get(){let{classes:e}=this;if(e.has(i))return e.get(i);{let t=e.getAttributeName(i);throw new Error(`Missing attribute "${t}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${wi(i)}Class`]:{get(){return this.classes.has(i)}}}}function vc(i){return Ei(i,"outlets").reduce((t,r)=>Object.assign(t,bc(r)),{})}function Oo(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function Ro(i,e,t){let r=Oo(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=Oo(i,e,t),r))return r}function bc(i){let e=kn(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let n=Ro(this,t,i);if(n)return n;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(i);return t.length>0?t.map(r=>{let n=Ro(this,r,i);if(n)return n;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t)return t;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${wi(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function yc(i){return Ei(i,"targets").reduce((t,r)=>Object.assign(t,wc(r)),{})}function wc(i){return{[`${i}Target`]:{get(){let e=this.targets.find(i);if(e)return e;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${wi(i)}Target`]:{get(){return this.targets.has(i)}}}}function Ec(i){let e=ic(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,n)=>{let s=Ho(n,this.identifier),o=this.data.getAttributeNameForKey(s.key);return Object.assign(r,{[o]:s})},{})}}};return e.reduce((r,n)=>Object.assign(r,_c(n)),t)}function _c(i,e){let t=Ho(i,e),{key:r,name:n,reader:s,writer:o}=t;return{[n]:{get(){let a=this.data.get(r);return a!==null?s(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${wi(n)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function Ho([i,e],t){return kc({controller:t,token:i,typeDefinition:e})}function rr(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function yi(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function Ac(i){let{controller:e,token:t,typeObject:r}=i,n=xo(r.type),s=xo(r.default),o=n&&s,a=n&&!s,l=!n&&s,d=rr(r.type),p=yi(i.typeObject.default);if(a)return d;if(l)return p;if(d!==p){let m=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${m}" must match the defined type "${d}". The provided default value of "${r.default}" is of type "${p}".`)}if(o)return d}function Sc(i){let{controller:e,token:t,typeDefinition:r}=i,s=Ac({controller:e,token:t,typeObject:r}),o=yi(r),a=rr(r),l=s||o||a;if(l)return l;let d=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${d}" for "${t}" value`)}function Tc(i){let e=rr(i);if(e)return Mo[e];let t=xn(i,"default"),r=xn(i,"type"),n=i;if(t)return n.default;if(r){let{type:s}=n,o=rr(s);if(o)return Mo[o]}return i}function kc(i){let{token:e,typeDefinition:t}=i,r=`${Fo(e)}-value`,n=Sc(i);return{type:n,key:r,name:Kn(r),get defaultValue(){return Tc(t)},get hasCustomDefaultValue(){return yi(t)!==void 0},reader:xc[n],writer:Po[n]||Po.default}}var Mo={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},xc={array(i){let e=JSON.parse(i);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${yi(e)}"`);return e},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let e=JSON.parse(i);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${yi(e)}"`);return e},string(i){return i}},Po={default:Lc,array:Do,object:Do};function Do(i){return JSON.stringify(i)}function Lc(i){return`${i}`}var T=class{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:n=this.identifier,bubbles:s=!0,cancelable:o=!0}={}){let a=n?`${n}:${e}`:e,l=new CustomEvent(a,{detail:r,bubbles:s,cancelable:o});return t.dispatchEvent(l),l}};T.blessings=[mc,yc,Ec,vc];T.targets=[];T.outlets=[];T.values={};var nr=class extends T{connect(){console.log(`resource-layout connected: ${this.element}`)}};var sr=class extends T{connect(){console.log(`nav-grid-menu-item connected: ${this.element}`)}};var or=class extends T{connect(){console.log(`nav-grid-menu connected: ${this.element}`)}};var ar=class extends T{connect(){console.log(`nav-user-section connected: ${this.element}`)}};var lr=class extends T{connect(){console.log(`nav-user-link connected: ${this.element}`)}};var cr=class extends T{connect(){console.log(`nav-user connected: ${this.element}`)}};var ur=class extends T{static targets=["openIcon","closeIcon"];static outlets=["sidebar"];static values={placement:{type:String,default:"left"},bodyScrolling:{type:Boolean,default:!1},backdrop:{type:Boolean,default:!0},edge:{type:Boolean,default:!1},edgeOffset:{type:String,default:"bottom-[60px]"}};static classes={backdrop:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"};initialize(){this.visible=!1,this.handleEscapeKey=this.handleEscapeKey.bind(this)}connect(){document.addEventListener("keydown",this.handleEscapeKey)}sidebarOutletConnected(){this.#e(this.sidebarOutlet.element)}disconnect(){this.#i(),document.removeEventListener("keydown",this.handleEscapeKey),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden")}#e(i){i.setAttribute("aria-hidden","true"),i.classList.add("transition-transform"),this.#n(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#r(`${this.placementValue}-edge`,!0):this.#s(this.placementValue,!0),this.openIconTarget.classList.add("hidden"),this.openIconTarget.setAttribute("aria-hidden","true"),this.closeIconTarget.classList.remove("hidden"),this.closeIconTarget.setAttribute("aria-hidden","false"),this.sidebarOutlet.element.setAttribute("aria-modal","true"),this.sidebarOutlet.element.setAttribute("role","dialog"),this.sidebarOutlet.element.removeAttribute("aria-hidden"),this.bodyScrollingValue||document.body.classList.add("overflow-hidden"),this.backdropValue&&this.#t(),this.visible=!0,this.dispatch("show")}hideDrawer(){this.edgeValue?this.#r(`${this.placementValue}-edge`,!1):this.#s(this.placementValue,!1),this.openIconTarget.classList.remove("hidden"),this.openIconTarget.setAttribute("aria-hidden","false"),this.closeIconTarget.classList.add("hidden"),this.closeIconTarget.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.removeAttribute("aria-modal"),this.sidebarOutlet.element.removeAttribute("role"),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden"),this.backdropValue&&this.#i(),this.visible=!1,this.dispatch("hide")}handleEscapeKey(i){i.key==="Escape"&&this.visible&&this.hideDrawer()}#t(){if(!this.visible){let i=document.createElement("div");i.setAttribute("data-drawer-backdrop",""),i.classList.add(...this.constructor.classes.backdrop.split(" ")),i.addEventListener("click",()=>this.hideDrawer()),document.body.appendChild(i)}}#i(){let i=document.querySelector("[data-drawer-backdrop]");i&&i.remove()}#n(i){let e={top:{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]},right:{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]},bottom:{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]},left:{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]},"bottom-edge":{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this.edgeOffsetValue]}};return e[i]||e.left}#s(i,e){let t=this.#n(i);e?(t.active.forEach(r=>this.sidebarOutlet.element.classList.add(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.remove(r))):(t.active.forEach(r=>this.sidebarOutlet.element.classList.remove(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.add(r)))}#r(i,e){this.#s(i,e)}};var hr=class extends T{connect(){console.log(`sidebar-menu-item connected: ${this.element}`)}};var dr=class extends T{connect(){console.log(`sidebar-menu connected: ${this.element}`)}};var pr=class extends T{connect(){console.log(`sidebar connected: ${this.element}`)}};var fr=class extends T{connect(){console.log(`has-many-panel connected: ${this.element}`)}};var mr=class extends T{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(i){i.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e);let t=new CustomEvent("nested-resource-form-fields:add",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}remove(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);if(e.dataset.newRecord!==void 0)e.remove();else{e.style.display="none",e.classList.remove(...e.classList);let r=e.querySelector("input[name*='_destroy']");r.value="1"}let t=new CustomEvent("nested-resource-form-fields:remove",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(this.wrapperSelectorValue).length}};var gr=class extends T{connect(){console.log(`toolbar connected: ${this.element}`)}};var vr=class extends T{connect(){console.log(`table-search-input connected: ${this.element}`)}};var br=class extends T{connect(){console.log(`table-toolbar connected: ${this.element}`)}};var yr=class extends T{connect(){console.log(`table connected: ${this.element}`)}};var tf=Hl($o(),1),wr=class extends T{connect(){console.log(`form connected: ${this.element}`)}submit(){this.element.requestSubmit()}};var Wc=function(){function i(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return i.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},i}(),jo=Wc;var Kc=function(){function i(){this._instances={Accordion:{},Carousel:{},Collapse:{},Dial:{},Dismiss:{},Drawer:{},Dropdown:{},Modal:{},Popover:{},Tabs:{},Tooltip:{},InputCounter:{},CopyClipboard:{}}}return i.prototype.addInstance=function(e,t,r,n){if(n===void 0&&(n=!1),!this._instances[e])return console.warn("Flowbite: Component ".concat(e," does not exist.")),!1;if(this._instances[e][r]&&!n){console.warn("Flowbite: Instance with ID ".concat(r," already exists."));return}n&&this._instances[e][r]&&this._instances[e][r].destroyAndRemoveInstance(),this._instances[e][r||this._generateRandomId()]=t},i.prototype.getAllInstances=function(){return this._instances},i.prototype.getInstances=function(e){return this._instances[e]?this._instances[e]:(console.warn("Flowbite: Component ".concat(e," does not exist.")),!1)},i.prototype.getInstance=function(e,t){if(this._componentAndInstanceCheck(e,t)){if(!this._instances[e][t]){console.warn("Flowbite: Instance with ID ".concat(t," does not exist."));return}return this._instances[e][t]}},i.prototype.destroyAndRemoveInstance=function(e,t){this._componentAndInstanceCheck(e,t)&&(this.destroyInstanceObject(e,t),this.removeInstance(e,t))},i.prototype.removeInstance=function(e,t){this._componentAndInstanceCheck(e,t)&&delete this._instances[e][t]},i.prototype.destroyInstanceObject=function(e,t){this._componentAndInstanceCheck(e,t)&&this._instances[e][t].destroy()},i.prototype.instanceExists=function(e,t){return!(!this._instances[e]||!this._instances[e][t])},i.prototype._generateRandomId=function(){return Math.random().toString(36).substr(2,9)},i.prototype._componentAndInstanceCheck=function(e,t){return this._instances[e]?this._instances[e][t]?!0:(console.warn("Flowbite: Instance with ID ".concat(t," does not exist.")),!1):(console.warn("Flowbite: Component ".concat(e," does not exist.")),!1)},i}(),Uo=new Kc,I=Uo;typeof window<"u"&&(window.FlowbiteInstances=Uo);var Er=function(){return Er=Object.assign||function(i){for(var e,t=1,r=arguments.length;t"u")return!1;var e=G(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function au(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];!re(s)||!oe(s)||(Object.assign(s.style,r),Object.keys(n).forEach(function(o){var a=n[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function lu(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var n=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,d){return l[d]="",l},{});!re(n)||!oe(n)||(Object.assign(n.style,a),Object.keys(s).forEach(function(l){n.removeAttribute(l)}))})}}var ea={name:"applyStyles",enabled:!0,phase:"write",fn:au,effect:lu,requires:["computeStyles"]};function ae(i){return i.split("-")[0]}var Ce=Math.max,dt=Math.min,Ye=Math.round;function jt(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function _i(){return!/^((?!chrome|android).)*safari/i.test(jt())}function Ae(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),n=1,s=1;e&&re(i)&&(n=i.offsetWidth>0&&Ye(r.width)/i.offsetWidth||1,s=i.offsetHeight>0&&Ye(r.height)/i.offsetHeight||1);var o=_e(i)?G(i):window,a=o.visualViewport,l=!_i()&&t,d=(r.left+(l&&a?a.offsetLeft:0))/n,p=(r.top+(l&&a?a.offsetTop:0))/s,m=r.width/n,E=r.height/s;return{width:m,height:E,top:p,right:d+m,bottom:p+E,left:d,x:d,y:p}}function pt(i){var e=Ae(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function Ai(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&$t(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function me(i){return G(i).getComputedStyle(i)}function Qn(i){return["table","td","th"].indexOf(oe(i))>=0}function he(i){return((_e(i)?i.ownerDocument:i.document)||window.document).documentElement}function Ze(i){return oe(i)==="html"?i:i.assignedSlot||i.parentNode||($t(i)?i.host:null)||he(i)}function ta(i){return!re(i)||me(i).position==="fixed"?null:i.offsetParent}function cu(i){var e=/firefox/i.test(jt()),t=/Trident/i.test(jt());if(t&&re(i)){var r=me(i);if(r.position==="fixed")return null}var n=Ze(i);for($t(n)&&(n=n.host);re(n)&&["html","body"].indexOf(oe(n))<0;){var s=me(n);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return n;n=n.parentNode}return null}function Ie(i){for(var e=G(i),t=ta(i);t&&Qn(t)&&me(t).position==="static";)t=ta(t);return t&&(oe(t)==="html"||oe(t)==="body"&&me(t).position==="static")?e:t||cu(i)||e}function ft(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function mt(i,e,t){return Ce(i,dt(e,t))}function ia(i,e,t){var r=mt(i,e,t);return r>t?t:r}function Si(){return{top:0,right:0,bottom:0,left:0}}function Ti(i){return Object.assign({},Si(),i)}function ki(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var uu=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Ti(typeof e!="number"?e:ki(e,et))};function hu(i){var e,t=i.state,r=i.name,n=i.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ae(t.placement),l=ft(a),d=[ee,te].indexOf(a)>=0,p=d?"height":"width";if(!(!s||!o)){var m=uu(n.padding,t),E=pt(s),v=l==="y"?J:ee,C=l==="y"?ie:te,_=t.rects.reference[p]+t.rects.reference[l]-o[l]-t.rects.popper[p],k=o[l]-t.rects.reference[l],D=Ie(s),q=D?l==="y"?D.clientHeight||0:D.clientWidth||0:0,B=_/2-k/2,S=m[v],R=q-E[p]-m[C],x=q/2-E[p]/2+B,P=mt(S,x,R),N=l;t.modifiersData[r]=(e={},e[N]=P,e.centerOffset=P-x,e)}}function du(i){var e=i.state,t=i.options,r=t.element,n=r===void 0?"[data-popper-arrow]":r;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||Ai(e.elements.popper,n)&&(e.elements.arrow=n))}var ra={name:"arrow",enabled:!0,phase:"main",fn:hu,effect:du,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Se(i){return i.split("-")[1]}var pu={top:"auto",right:"auto",bottom:"auto",left:"auto"};function fu(i,e){var t=i.x,r=i.y,n=e.devicePixelRatio||1;return{x:Ye(t*n)/n||0,y:Ye(r*n)/n||0}}function na(i){var e,t=i.popper,r=i.popperRect,n=i.placement,s=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,d=i.adaptive,p=i.roundOffsets,m=i.isFixed,E=o.x,v=E===void 0?0:E,C=o.y,_=C===void 0?0:C,k=typeof p=="function"?p({x:v,y:_}):{x:v,y:_};v=k.x,_=k.y;var D=o.hasOwnProperty("x"),q=o.hasOwnProperty("y"),B=ee,S=J,R=window;if(d){var x=Ie(t),P="clientHeight",N="clientWidth";if(x===G(t)&&(x=he(t),me(x).position!=="static"&&a==="absolute"&&(P="scrollHeight",N="scrollWidth")),x=x,n===J||(n===ee||n===te)&&s===ht){S=ie;var U=m&&x===R&&R.visualViewport?R.visualViewport.height:x[P];_-=U-r.height,_*=l?1:-1}if(n===ee||(n===J||n===ie)&&s===ht){B=te;var X=m&&x===R&&R.visualViewport?R.visualViewport.width:x[N];v-=X-r.width,v*=l?1:-1}}var z=Object.assign({position:a},d&&pu),Y=p===!0?fu({x:v,y:_},G(t)):{x:v,y:_};if(v=Y.x,_=Y.y,l){var W;return Object.assign({},z,(W={},W[S]=q?"0":"",W[B]=D?"0":"",W.transform=(R.devicePixelRatio||1)<=1?"translate("+v+"px, "+_+"px)":"translate3d("+v+"px, "+_+"px, 0)",W))}return Object.assign({},z,(e={},e[S]=q?_+"px":"",e[B]=D?v+"px":"",e.transform="",e))}function mu(i){var e=i.state,t=i.options,r=t.gpuAcceleration,n=r===void 0?!0:r,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,d={placement:ae(e.placement),variation:Se(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,na(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,na(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var sa={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:mu,data:{}};var Ir={passive:!0};function gu(i){var e=i.state,t=i.instance,r=i.options,n=r.scroll,s=n===void 0?!0:n,o=r.resize,a=o===void 0?!0:o,l=G(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&d.forEach(function(p){p.addEventListener("scroll",t.update,Ir)}),a&&l.addEventListener("resize",t.update,Ir),function(){s&&d.forEach(function(p){p.removeEventListener("scroll",t.update,Ir)}),a&&l.removeEventListener("resize",t.update,Ir)}}var oa={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:gu,data:{}};var vu={left:"right",right:"left",bottom:"top",top:"bottom"};function Ut(i){return i.replace(/left|right|bottom|top/g,function(e){return vu[e]})}var bu={start:"end",end:"start"};function Or(i){return i.replace(/start|end/g,function(e){return bu[e]})}function gt(i){var e=G(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function vt(i){return Ae(he(i)).left+gt(i).scrollLeft}function Jn(i,e){var t=G(i),r=he(i),n=t.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(n){s=n.width,o=n.height;var d=_i();(d||!d&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:s,height:o,x:a+vt(i),y:l}}function es(i){var e,t=he(i),r=gt(i),n=(e=i.ownerDocument)==null?void 0:e.body,s=Ce(t.scrollWidth,t.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),o=Ce(t.scrollHeight,t.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-r.scrollLeft+vt(i),l=-r.scrollTop;return me(n||t).direction==="rtl"&&(a+=Ce(t.clientWidth,n?n.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function bt(i){var e=me(i),t=e.overflow,r=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+n+r)}function Rr(i){return["html","body","#document"].indexOf(oe(i))>=0?i.ownerDocument.body:re(i)&&bt(i)?i:Rr(Ze(i))}function tt(i,e){var t;e===void 0&&(e=[]);var r=Rr(i),n=r===((t=i.ownerDocument)==null?void 0:t.body),s=G(r),o=n?[s].concat(s.visualViewport||[],bt(r)?r:[]):r,a=e.concat(o);return n?a:a.concat(tt(Ze(o)))}function Wt(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function yu(i,e){var t=Ae(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function aa(i,e,t){return e===Lr?Wt(Jn(i,t)):_e(e)?yu(e,t):Wt(es(he(i)))}function wu(i){var e=tt(Ze(i)),t=["absolute","fixed"].indexOf(me(i).position)>=0,r=t&&re(i)?Ie(i):i;return _e(r)?e.filter(function(n){return _e(n)&&Ai(n,r)&&oe(n)!=="body"}):[]}function ts(i,e,t,r){var n=e==="clippingParents"?wu(i):[].concat(e),s=[].concat(n,[t]),o=s[0],a=s.reduce(function(l,d){var p=aa(i,d,r);return l.top=Ce(p.top,l.top),l.right=dt(p.right,l.right),l.bottom=dt(p.bottom,l.bottom),l.left=Ce(p.left,l.left),l},aa(i,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function xi(i){var e=i.reference,t=i.element,r=i.placement,n=r?ae(r):null,s=r?Se(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(n){case J:l={x:o,y:e.y-t.height};break;case ie:l={x:o,y:e.y+e.height};break;case te:l={x:e.x+e.width,y:a};break;case ee:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var d=n?ft(n):null;if(d!=null){var p=d==="y"?"height":"width";switch(s){case Xe:l[d]=l[d]-(e[p]/2-t[p]/2);break;case ht:l[d]=l[d]+(e[p]/2-t[p]/2);break;default:}}return l}function Oe(i,e){e===void 0&&(e={});var t=e,r=t.placement,n=r===void 0?i.placement:r,s=t.strategy,o=s===void 0?i.strategy:s,a=t.boundary,l=a===void 0?Zo:a,d=t.rootBoundary,p=d===void 0?Lr:d,m=t.elementContext,E=m===void 0?Vt:m,v=t.altBoundary,C=v===void 0?!1:v,_=t.padding,k=_===void 0?0:_,D=Ti(typeof k!="number"?k:ki(k,et)),q=E===Vt?Qo:Vt,B=i.rects.popper,S=i.elements[C?q:E],R=ts(_e(S)?S:S.contextElement||he(i.elements.popper),l,p,o),x=Ae(i.elements.reference),P=xi({reference:x,element:B,strategy:"absolute",placement:n}),N=Wt(Object.assign({},B,P)),U=E===Vt?N:x,X={top:R.top-U.top+D.top,bottom:U.bottom-R.bottom+D.bottom,left:R.left-U.left+D.left,right:U.right-R.right+D.right},z=i.modifiersData.offset;if(E===Vt&&z){var Y=z[n];Object.keys(X).forEach(function(W){var ye=[te,ie].indexOf(W)>=0?1:-1,xe=[J,ie].indexOf(W)>=0?"y":"x";X[W]+=Y[xe]*ye})}return X}function is(i,e){e===void 0&&(e={});var t=e,r=t.placement,n=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,d=l===void 0?Cr:l,p=Se(r),m=p?a?Zn:Zn.filter(function(C){return Se(C)===p}):et,E=m.filter(function(C){return d.indexOf(C)>=0});E.length===0&&(E=m);var v=E.reduce(function(C,_){return C[_]=Oe(i,{placement:_,boundary:n,rootBoundary:s,padding:o})[ae(_)],C},{});return Object.keys(v).sort(function(C,_){return v[C]-v[_]})}function Eu(i){if(ae(i)===xr)return[];var e=Ut(i);return[Or(i),e,Or(e)]}function _u(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var n=t.mainAxis,s=n===void 0?!0:n,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,d=t.padding,p=t.boundary,m=t.rootBoundary,E=t.altBoundary,v=t.flipVariations,C=v===void 0?!0:v,_=t.allowedAutoPlacements,k=e.options.placement,D=ae(k),q=D===k,B=l||(q||!C?[Ut(k)]:Eu(k)),S=[k].concat(B).reduce(function(ce,H){return ce.concat(ae(H)===xr?is(e,{placement:H,boundary:p,rootBoundary:m,padding:d,flipVariations:C,allowedAutoPlacements:_}):H)},[]),R=e.rects.reference,x=e.rects.popper,P=new Map,N=!0,U=S[0],X=0;X=0,xe=ye?"width":"height",u=Oe(e,{placement:z,boundary:p,rootBoundary:m,altBoundary:E,padding:d}),h=ye?W?te:ee:W?ie:J;R[xe]>x[xe]&&(h=Ut(h));var f=Ut(h),y=[];if(s&&y.push(u[Y]<=0),a&&y.push(u[h]<=0,u[f]<=0),y.every(function(ce){return ce})){U=z,N=!1;break}P.set(z,y)}if(N)for(var w=C?3:1,b=function(H){var V=S.find(function(ne){var de=P.get(ne);if(de)return de.slice(0,H).every(function(Le){return Le})});if(V)return U=V,"break"},O=w;O>0;O--){var M=b(O);if(M==="break")break}e.placement!==U&&(e.modifiersData[r]._skip=!0,e.placement=U,e.reset=!0)}}var la={name:"flip",enabled:!0,phase:"main",fn:_u,requiresIfExists:["offset"],data:{_skip:!1}};function ca(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function ua(i){return[J,te,ie,ee].some(function(e){return i[e]>=0})}function Au(i){var e=i.state,t=i.name,r=e.rects.reference,n=e.rects.popper,s=e.modifiersData.preventOverflow,o=Oe(e,{elementContext:"reference"}),a=Oe(e,{altBoundary:!0}),l=ca(o,r),d=ca(a,n,s),p=ua(l),m=ua(d);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:d,isReferenceHidden:p,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":m})}var ha={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Au};function Su(i,e,t){var r=ae(i),n=[ee,J].indexOf(r)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*n,[ee,te].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Tu(i){var e=i.state,t=i.options,r=i.name,n=t.offset,s=n===void 0?[0,0]:n,o=Cr.reduce(function(p,m){return p[m]=Su(m,e.rects,s),p},{}),a=o[e.placement],l=a.x,d=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=d),e.modifiersData[r]=o}var da={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Tu};function ku(i){var e=i.state,t=i.name;e.modifiersData[t]=xi({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var pa={name:"popperOffsets",enabled:!0,phase:"read",fn:ku,data:{}};function rs(i){return i==="x"?"y":"x"}function xu(i){var e=i.state,t=i.options,r=i.name,n=t.mainAxis,s=n===void 0?!0:n,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,d=t.rootBoundary,p=t.altBoundary,m=t.padding,E=t.tether,v=E===void 0?!0:E,C=t.tetherOffset,_=C===void 0?0:C,k=Oe(e,{boundary:l,rootBoundary:d,padding:m,altBoundary:p}),D=ae(e.placement),q=Se(e.placement),B=!q,S=ft(D),R=rs(S),x=e.modifiersData.popperOffsets,P=e.rects.reference,N=e.rects.popper,U=typeof _=="function"?_(Object.assign({},e.rects,{placement:e.placement})):_,X=typeof U=="number"?{mainAxis:U,altAxis:U}:Object.assign({mainAxis:0,altAxis:0},U),z=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Y={x:0,y:0};if(x){if(s){var W,ye=S==="y"?J:ee,xe=S==="y"?ie:te,u=S==="y"?"height":"width",h=x[S],f=h+k[ye],y=h-k[xe],w=v?-N[u]/2:0,b=q===Xe?P[u]:N[u],O=q===Xe?-N[u]:-P[u],M=e.elements.arrow,ce=v&&M?pt(M):{width:0,height:0},H=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Si(),V=H[ye],ne=H[xe],de=mt(0,P[u],ce[u]),Le=B?P[u]/2-w-de-V-X.mainAxis:b-de-V-X.mainAxis,Ct=B?-P[u]/2+w+de+ne+X.mainAxis:O+de+ne+X.mainAxis,It=e.elements.arrow&&Ie(e.elements.arrow),Je=It?S==="y"?It.clientTop||0:It.clientLeft||0:0,Ot=(W=z?.[S])!=null?W:0,ze=h+Le-Ot-Je,fi=h+Ct-Ot,Rt=mt(v?dt(f,ze):f,h,v?Ce(y,fi):y);x[S]=Rt,Y[S]=Rt-h}if(a){var Ve,Mt=S==="x"?J:ee,Pt=S==="x"?ie:te,Fe=x[R],ct=R==="y"?"height":"width",Ui=Fe+k[Mt],Dt=Fe-k[Pt],$e=[J,ee].indexOf(D)!==-1,je=(Ve=z?.[R])!=null?Ve:0,Ue=$e?Ui:Fe-P[ct]-N[ct]-je+X.altAxis,mi=$e?Fe+P[ct]+N[ct]-je-X.altAxis:Dt,gi=v&&$e?ia(Ue,Fe,mi):mt(v?Ue:Ui,Fe,v?mi:Dt);x[R]=gi,Y[R]=gi-Fe}e.modifiersData[r]=Y}}var fa={name:"preventOverflow",enabled:!0,phase:"main",fn:xu,requiresIfExists:["offset"]};function ns(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function ss(i){return i===G(i)||!re(i)?gt(i):ns(i)}function Lu(i){var e=i.getBoundingClientRect(),t=Ye(e.width)/i.offsetWidth||1,r=Ye(e.height)/i.offsetHeight||1;return t!==1||r!==1}function os(i,e,t){t===void 0&&(t=!1);var r=re(e),n=re(e)&&Lu(e),s=he(e),o=Ae(i,n,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((oe(e)!=="body"||bt(s))&&(a=ss(e)),re(e)?(l=Ae(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=vt(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Cu(i){var e=new Map,t=new Set,r=[];i.forEach(function(s){e.set(s.name,s)});function n(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&n(l)}}),r.push(s)}return i.forEach(function(s){t.has(s.name)||n(s)}),r}function as(i){var e=Cu(i);return Jo.reduce(function(t,r){return t.concat(e.filter(function(n){return n.phase===r}))},[])}function ls(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function cs(i){var e=i.reduce(function(t,r){var n=t[r.name];return t[r.name]=n?Object.assign({},n,r,{options:Object.assign({},n.options,r.options),data:Object.assign({},n.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var ma={placement:"bottom",modifiers:[],strategy:"absolute"};function ga(){for(var i=arguments.length,e=new Array(i),t=0;te._options.maxValue&&(r.value=e._options.maxValue.toString()),e._options.minValue!==null&&parseInt(r.value)=this._options.maxValue||(this._targetEl.value=(this.getCurrentValue()+1).toString(),this._options.onIncrement(this))},i.prototype.decrement=function(){this._options.minValue!==null&&this.getCurrentValue()<=this._options.minValue||(this._targetEl.value=(this.getCurrentValue()-1).toString(),this._options.onDecrement(this))},i.prototype.updateOnIncrement=function(e){this._options.onIncrement=e},i.prototype.updateOnDecrement=function(e){this._options.onDecrement=e},i}();function ei(){document.querySelectorAll("[data-input-counter]").forEach(function(i){var e=i.id,t=document.querySelector('[data-input-counter-increment="'+e+'"]'),r=document.querySelector('[data-input-counter-decrement="'+e+'"]'),n=i.getAttribute("data-input-counter-min"),s=i.getAttribute("data-input-counter-max");i?I.instanceExists("InputCounter",i.getAttribute("id"))||new Ta(i,t||null,r||null,{minValue:n?parseInt(n):null,maxValue:s?parseInt(s):null}):console.error('The target element with id "'.concat(e,'" does not exist. Please check the data-input-counter attribute.'))})}typeof window<"u"&&(window.InputCounter=Ta,window.initInputCounters=ei);var jr=function(){return jr=Object.assign||function(i){for(var e,t=1,r=arguments.length;t0&&(this.autoDismissTimeout=setTimeout(()=>{this.dismiss(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.autoDismissTimeout=null}dismiss(){this.element.remove()}};var Xr=class extends T{static targets=["frame","refreshButton","backButton","homeButton"];connect(){console.log(`frame-navigator connected: ${this.element}`),this.#e(),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading),this.frameFailed=this.frameFailed.bind(this),this.frameTarget.addEventListener("turbo:fetch-request-error",this.frameFailed)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading),this.frameTarget.removeEventListener("turbo:fetch-request-error",this.frameFailed)}frameLoading(i){this.#e()}frameFailed(i){this.#t()}frameLoaded(i){this.#t();let e=i.target.src;e==this.currentSrc||(e==this.originalFrameSrc?this.srcHistory=[e]:this.srcHistory.push(e)),this.#i()}refreshButtonClicked(i){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(i){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(i){this.frameLoading(null),this.frameTarget.src=this.originalFrameSrc}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}#e(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}#t(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse")}#i(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var Yr=class extends T{connect(){console.log(`color-mode connected: ${this.element}`),this.updateColorMode()}disconnect(){}updateColorMode(){localStorage.theme==="dark"||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}setLightColorMode(){localStorage.theme="light",this.updateColorMode()}setDarkColorMode(){localStorage.theme="dark",this.updateColorMode()}setSystemColorMode(){localStorage.removeItem("theme"),this.updateColorMode()}};var{entries:Ba,setPrototypeOf:La,isFrozen:zu,getPrototypeOf:Vu,getOwnPropertyDescriptor:$u}=Object,{freeze:ve,seal:Te,create:Na}=Object,{apply:bs,construct:ys}=typeof Reflect<"u"&&Reflect;ve||(ve=function(e){return e});Te||(Te=function(e){return e});bs||(bs=function(e,t,r){return e.apply(t,r)});ys||(ys=function(e,t){return new e(...t)});var Zr=Ee(Array.prototype.forEach),Ca=Ee(Array.prototype.pop),Ci=Ee(Array.prototype.push),Jr=Ee(String.prototype.toLowerCase),ps=Ee(String.prototype.toString),Ia=Ee(String.prototype.match),Ii=Ee(String.prototype.replace),ju=Ee(String.prototype.indexOf),Uu=Ee(String.prototype.trim),Re=Ee(Object.prototype.hasOwnProperty),ge=Ee(RegExp.prototype.test),Oi=Wu(TypeError);function Ee(i){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n2&&arguments[2]!==void 0?arguments[2]:Jr;La&&La(i,null);let r=e.length;for(;r--;){let n=e[r];if(typeof n=="string"){let s=t(n);s!==n&&(zu(e)||(e[r]=s),n=s)}i[n]=!0}return i}function Ku(i){for(let e=0;e/gm),Qu=Te(/\${[\w\W]*}/gm),Ju=Te(/^data-[\-\w.\u00B7-\uFFFF]/),eh=Te(/^aria-[\-\w]+$/),Ha=Te(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),th=Te(/^(?:\w+script|data):/i),ih=Te(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qa=Te(/^html$/i),rh=Te(/^[a-z][.\w]*(-[.\w]+)+$/i),Da=Object.freeze({__proto__:null,ARIA_ATTR:eh,ATTR_WHITESPACE:ih,CUSTOM_ELEMENT:rh,DATA_ATTR:Ju,DOCTYPE_NAME:qa,ERB_EXPR:Zu,IS_ALLOWED_URI:Ha,IS_SCRIPT_OR_DATA:th,MUSTACHE_EXPR:Yu,TMPLIT_EXPR:Qu}),Mi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nh=function(){return typeof window>"u"?null:window},sh=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(r=t.getAttribute(n));let s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Fa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function za(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nh(),e=L=>za(L);if(e.version="3.2.2",e.removed=[],!i||!i.document||i.document.nodeType!==Mi.document)return e.isSupported=!1,e;let{document:t}=i,r=t,n=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:d,NamedNodeMap:p=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:m,DOMParser:E,trustedTypes:v}=i,C=l.prototype,_=Ri(C,"cloneNode"),k=Ri(C,"remove"),D=Ri(C,"nextSibling"),q=Ri(C,"childNodes"),B=Ri(C,"parentNode");if(typeof o=="function"){let L=t.createElement("template");L.content&&L.content.ownerDocument&&(t=L.content.ownerDocument)}let S,R="",{implementation:x,createNodeIterator:P,createDocumentFragment:N,getElementsByTagName:U}=t,{importNode:X}=r,z=Fa();e.isSupported=typeof Ba=="function"&&typeof B=="function"&&x&&x.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Y,ERB_EXPR:W,TMPLIT_EXPR:ye,DATA_ATTR:xe,ARIA_ATTR:u,IS_SCRIPT_OR_DATA:h,ATTR_WHITESPACE:f,CUSTOM_ELEMENT:y}=Da,{IS_ALLOWED_URI:w}=Da,b=null,O=F({},[...Oa,...fs,...ms,...gs,...Ra]),M=null,ce=F({},[...Ma,...vs,...Pa,...Qr]),H=Object.seal(Na(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,ne=null,de=!0,Le=!0,Ct=!1,It=!0,Je=!1,Ot=!0,ze=!1,fi=!1,Rt=!1,Ve=!1,Mt=!1,Pt=!1,Fe=!0,ct=!1,Ui="user-content-",Dt=!0,$e=!1,je={},Ue=null,mi=F({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),gi=null,uo=F({},["audio","video","img","source","image","track"]),wn=null,ho=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Wi="http://www.w3.org/1998/Math/MathML",Ki="http://www.w3.org/2000/svg",We="http://www.w3.org/1999/xhtml",Ft=We,En=!1,_n=null,Tl=F({},[Wi,Ki,We],ps),Gi=F({},["mi","mo","mn","ms","mtext"]),Xi=F({},["annotation-xml"]),kl=F({},["title","style","font","a","script"]),vi=null,xl=["application/xhtml+xml","text/html"],Ll="text/html",se=null,Bt=null,Cl=t.createElement("form"),po=function(c){return c instanceof RegExp||c instanceof Function},An=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Bt&&Bt===c)){if((!c||typeof c!="object")&&(c={}),c=Et(c),vi=xl.indexOf(c.PARSER_MEDIA_TYPE)===-1?Ll:c.PARSER_MEDIA_TYPE,se=vi==="application/xhtml+xml"?ps:Jr,b=Re(c,"ALLOWED_TAGS")?F({},c.ALLOWED_TAGS,se):O,M=Re(c,"ALLOWED_ATTR")?F({},c.ALLOWED_ATTR,se):ce,_n=Re(c,"ALLOWED_NAMESPACES")?F({},c.ALLOWED_NAMESPACES,ps):Tl,wn=Re(c,"ADD_URI_SAFE_ATTR")?F(Et(ho),c.ADD_URI_SAFE_ATTR,se):ho,gi=Re(c,"ADD_DATA_URI_TAGS")?F(Et(uo),c.ADD_DATA_URI_TAGS,se):uo,Ue=Re(c,"FORBID_CONTENTS")?F({},c.FORBID_CONTENTS,se):mi,V=Re(c,"FORBID_TAGS")?F({},c.FORBID_TAGS,se):{},ne=Re(c,"FORBID_ATTR")?F({},c.FORBID_ATTR,se):{},je=Re(c,"USE_PROFILES")?c.USE_PROFILES:!1,de=c.ALLOW_ARIA_ATTR!==!1,Le=c.ALLOW_DATA_ATTR!==!1,Ct=c.ALLOW_UNKNOWN_PROTOCOLS||!1,It=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Je=c.SAFE_FOR_TEMPLATES||!1,Ot=c.SAFE_FOR_XML!==!1,ze=c.WHOLE_DOCUMENT||!1,Ve=c.RETURN_DOM||!1,Mt=c.RETURN_DOM_FRAGMENT||!1,Pt=c.RETURN_TRUSTED_TYPE||!1,Rt=c.FORCE_BODY||!1,Fe=c.SANITIZE_DOM!==!1,ct=c.SANITIZE_NAMED_PROPS||!1,Dt=c.KEEP_CONTENT!==!1,$e=c.IN_PLACE||!1,w=c.ALLOWED_URI_REGEXP||Ha,Ft=c.NAMESPACE||We,Gi=c.MATHML_TEXT_INTEGRATION_POINTS||Gi,Xi=c.HTML_INTEGRATION_POINTS||Xi,H=c.CUSTOM_ELEMENT_HANDLING||{},c.CUSTOM_ELEMENT_HANDLING&&po(c.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=c.CUSTOM_ELEMENT_HANDLING.tagNameCheck),c.CUSTOM_ELEMENT_HANDLING&&po(c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Je&&(Le=!1),Mt&&(Ve=!0),je&&(b=F({},Ra),M=[],je.html===!0&&(F(b,Oa),F(M,Ma)),je.svg===!0&&(F(b,fs),F(M,vs),F(M,Qr)),je.svgFilters===!0&&(F(b,ms),F(M,vs),F(M,Qr)),je.mathMl===!0&&(F(b,gs),F(M,Pa),F(M,Qr))),c.ADD_TAGS&&(b===O&&(b=Et(b)),F(b,c.ADD_TAGS,se)),c.ADD_ATTR&&(M===ce&&(M=Et(M)),F(M,c.ADD_ATTR,se)),c.ADD_URI_SAFE_ATTR&&F(wn,c.ADD_URI_SAFE_ATTR,se),c.FORBID_CONTENTS&&(Ue===mi&&(Ue=Et(Ue)),F(Ue,c.FORBID_CONTENTS,se)),Dt&&(b["#text"]=!0),ze&&F(b,["html","head","body"]),b.table&&(F(b,["tbody"]),delete V.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw Oi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Oi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=c.TRUSTED_TYPES_POLICY,R=S.createHTML("")}else S===void 0&&(S=sh(v,n)),S!==null&&typeof R=="string"&&(R=S.createHTML(""));ve&&ve(c),Bt=c}},fo=F({},[...fs,...ms,...Gu]),mo=F({},[...gs,...Xu]),Il=function(c){let g=B(c);(!g||!g.tagName)&&(g={namespaceURI:Ft,tagName:"template"});let A=Jr(c.tagName),K=Jr(g.tagName);return _n[c.namespaceURI]?c.namespaceURI===Ki?g.namespaceURI===We?A==="svg":g.namespaceURI===Wi?A==="svg"&&(K==="annotation-xml"||Gi[K]):!!fo[A]:c.namespaceURI===Wi?g.namespaceURI===We?A==="math":g.namespaceURI===Ki?A==="math"&&Xi[K]:!!mo[A]:c.namespaceURI===We?g.namespaceURI===Ki&&!Xi[K]||g.namespaceURI===Wi&&!Gi[K]?!1:!mo[A]&&(kl[A]||!fo[A]):!!(vi==="application/xhtml+xml"&&_n[c.namespaceURI]):!1},Be=function(c){Ci(e.removed,{element:c});try{B(c).removeChild(c)}catch{k(c)}},Yi=function(c,g){try{Ci(e.removed,{attribute:g.getAttributeNode(c),from:g})}catch{Ci(e.removed,{attribute:null,from:g})}if(g.removeAttribute(c),c==="is")if(Ve||Mt)try{Be(g)}catch{}else try{g.setAttribute(c,"")}catch{}},go=function(c){let g=null,A=null;if(Rt)c=""+c;else{let ue=Ia(c,/^[\r\n\t ]+/);A=ue&&ue[0]}vi==="application/xhtml+xml"&&Ft===We&&(c=''+c+"");let K=S?S.createHTML(c):c;if(Ft===We)try{g=new E().parseFromString(K,vi)}catch{}if(!g||!g.documentElement){g=x.createDocument(Ft,"template",null);try{g.documentElement.innerHTML=En?R:K}catch{}}let pe=g.body||g.documentElement;return c&&A&&pe.insertBefore(t.createTextNode(A),pe.childNodes[0]||null),Ft===We?U.call(g,ze?"html":"body")[0]:ze?g.documentElement:pe},vo=function(c){return P.call(c.ownerDocument||c,c,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},bo=function(c){return c instanceof m&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof p)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},yo=function(c){return typeof a=="function"&&c instanceof a};function Ke(L,c,g){Zr(L,A=>{A.call(e,c,g,Bt)})}let wo=function(c){let g=null;if(Ke(z.beforeSanitizeElements,c,null),bo(c))return Be(c),!0;let A=se(c.nodeName);if(Ke(z.uponSanitizeElement,c,{tagName:A,allowedTags:b}),c.hasChildNodes()&&!yo(c.firstElementChild)&&ge(/<[/\w]/g,c.innerHTML)&&ge(/<[/\w]/g,c.textContent)||c.nodeType===Mi.progressingInstruction||Ot&&c.nodeType===Mi.comment&&ge(/<[/\w]/g,c.data))return Be(c),!0;if(!b[A]||V[A]){if(!V[A]&&_o(A)&&(H.tagNameCheck instanceof RegExp&&ge(H.tagNameCheck,A)||H.tagNameCheck instanceof Function&&H.tagNameCheck(A)))return!1;if(Dt&&!Ue[A]){let K=B(c)||c.parentNode,pe=q(c)||c.childNodes;if(pe&&K){let ue=pe.length;for(let we=ue-1;we>=0;--we){let Ne=_(pe[we],!0);Ne.__removalCount=(c.__removalCount||0)+1,K.insertBefore(Ne,D(c))}}}return Be(c),!0}return c instanceof l&&!Il(c)||(A==="noscript"||A==="noembed"||A==="noframes")&&ge(/<\/no(script|embed|frames)/i,c.innerHTML)?(Be(c),!0):(Je&&c.nodeType===Mi.text&&(g=c.textContent,Zr([Y,W,ye],K=>{g=Ii(g,K," ")}),c.textContent!==g&&(Ci(e.removed,{element:c.cloneNode()}),c.textContent=g)),Ke(z.afterSanitizeElements,c,null),!1)},Eo=function(c,g,A){if(Fe&&(g==="id"||g==="name")&&(A in t||A in Cl))return!1;if(!(Le&&!ne[g]&&ge(xe,g))){if(!(de&&ge(u,g))){if(!M[g]||ne[g]){if(!(_o(c)&&(H.tagNameCheck instanceof RegExp&&ge(H.tagNameCheck,c)||H.tagNameCheck instanceof Function&&H.tagNameCheck(c))&&(H.attributeNameCheck instanceof RegExp&&ge(H.attributeNameCheck,g)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(g))||g==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&ge(H.tagNameCheck,A)||H.tagNameCheck instanceof Function&&H.tagNameCheck(A))))return!1}else if(!wn[g]){if(!ge(w,Ii(A,f,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&c!=="script"&&ju(A,"data:")===0&&gi[c])){if(!(Ct&&!ge(h,Ii(A,f,"")))){if(A)return!1}}}}}}return!0},_o=function(c){return c!=="annotation-xml"&&Ia(c,y)},Ao=function(c){Ke(z.beforeSanitizeAttributes,c,null);let{attributes:g}=c;if(!g)return;let A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0},K=g.length;for(;K--;){let pe=g[K],{name:ue,namespaceURI:we,value:Ne}=pe,bi=se(ue),fe=ue==="value"?Ne:Uu(Ne);if(A.attrName=bi,A.attrValue=fe,A.keepAttr=!0,A.forceKeepAttr=void 0,Ke(z.uponSanitizeAttribute,c,A),fe=A.attrValue,ct&&(bi==="id"||bi==="name")&&(Yi(ue,c),fe=Ui+fe),Ot&&ge(/((--!?|])>)|<\/(style|title)/i,fe)){Yi(ue,c);continue}if(A.forceKeepAttr||(Yi(ue,c),!A.keepAttr))continue;if(!It&&ge(/\/>/i,fe)){Yi(ue,c);continue}Je&&Zr([Y,W,ye],To=>{fe=Ii(fe,To," ")});let So=se(c.nodeName);if(Eo(So,bi,fe)){if(S&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!we)switch(v.getAttributeType(So,bi)){case"TrustedHTML":{fe=S.createHTML(fe);break}case"TrustedScriptURL":{fe=S.createScriptURL(fe);break}}try{we?c.setAttributeNS(we,ue,fe):c.setAttribute(ue,fe),bo(c)?Be(c):Ca(e.removed)}catch{}}}Ke(z.afterSanitizeAttributes,c,null)},Ol=function L(c){let g=null,A=vo(c);for(Ke(z.beforeSanitizeShadowDOM,c,null);g=A.nextNode();)Ke(z.uponSanitizeShadowNode,g,null),!wo(g)&&(g.content instanceof s&&L(g.content),Ao(g));Ke(z.afterSanitizeShadowDOM,c,null)};return e.sanitize=function(L){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,A=null,K=null,pe=null;if(En=!L,En&&(L=""),typeof L!="string"&&!yo(L))if(typeof L.toString=="function"){if(L=L.toString(),typeof L!="string")throw Oi("dirty is not a string, aborting")}else throw Oi("toString is not a function");if(!e.isSupported)return L;if(fi||An(c),e.removed=[],typeof L=="string"&&($e=!1),$e){if(L.nodeName){let Ne=se(L.nodeName);if(!b[Ne]||V[Ne])throw Oi("root node is forbidden and cannot be sanitized in-place")}}else if(L instanceof a)g=go(""),A=g.ownerDocument.importNode(L,!0),A.nodeType===Mi.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?g=A:g.appendChild(A);else{if(!Ve&&!Je&&!ze&&L.indexOf("<")===-1)return S&&Pt?S.createHTML(L):L;if(g=go(L),!g)return Ve?null:Pt?R:""}g&&Rt&&Be(g.firstChild);let ue=vo($e?L:g);for(;K=ue.nextNode();)wo(K)||(K.content instanceof s&&Ol(K.content),Ao(K));if($e)return L;if(Ve){if(Mt)for(pe=N.call(g.ownerDocument);g.firstChild;)pe.appendChild(g.firstChild);else pe=g;return(M.shadowroot||M.shadowrootmode)&&(pe=X.call(r,pe,!0)),pe}let we=ze?g.outerHTML:g.innerHTML;return ze&&b["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&ge(qa,g.ownerDocument.doctype.name)&&(we=" `+we),Je&&Zr([Y,W,ye],Ne=>{we=Ii(we,Ne," ")}),S&&Pt?S.createHTML(we):we},e.setConfig=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};An(L),fi=!0},e.clearConfig=function(){Bt=null,fi=!1},e.isValidAttribute=function(L,c,g){Bt||An({});let A=se(L),K=se(c);return Eo(A,K,g)},e.addHook=function(L,c){typeof c=="function"&&Ci(z[L],c)},e.removeHook=function(L){return Ca(z[L])},e.removeHooks=function(L){z[L]=[]},e.removeAllHooks=function(){z=Fa()},e}var ws=za();function As(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var At=As();function Ka(i){At=i}var Fi={exec:()=>null};function j(i,e=""){let t=typeof i=="string"?i:i.source,r={replace:(n,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(be.caret,"$1"),t=t.replace(n,o),r},getRegex:()=>new RegExp(t,e)};return r}var be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},oh=/^(?:[ \t]*(?:\n|$))+/,ah=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ni=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ch=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ga=/(?:[*+-]|\d{1,9}[.)])/,Xa=j(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ga).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Ss=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,uh=/^[^\n]+/,Ts=/(?!\s*\])(?:\\.|[^\[\]\\])+/,hh=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ts).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),dh=j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ga).getRegex(),rn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ks=/|$))/,ph=j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ks).replace("tag",rn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ya=j(Ss).replace("hr",Ni).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",rn).getRegex(),fh=j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ya).getRegex(),xs={blockquote:fh,code:ah,def:hh,fences:lh,heading:ch,hr:Ni,html:ph,lheading:Xa,list:dh,newline:oh,paragraph:Ya,table:Fi,text:uh},Va=j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ni).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",rn).getRegex(),mh={...xs,table:Va,paragraph:j(Ss).replace("hr",Ni).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Va).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",rn).getRegex()},gh={...xs,html:j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ks).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Fi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(Ss).replace("hr",Ni).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",Xa).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Za=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vh=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Qa=/^( {2,}|\\)\n(?!\s*$)/,bh=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,Eh=j(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,nn).getRegex(),_h=j("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,Ja).replace(/punctSpace/g,Ls).replace(/punct/g,nn).getRegex(),Ah=j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ja).replace(/punctSpace/g,Ls).replace(/punct/g,nn).getRegex(),Sh=j(/\\(punct)/,"gu").replace(/punct/g,nn).getRegex(),Th=j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kh=j(ks).replace("(?:-->|$)","-->").getRegex(),xh=j("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",kh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tn=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Lh=j(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",tn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),el=j(/^!?\[(label)\]\[(ref)\]/).replace("label",tn).replace("ref",Ts).getRegex(),tl=j(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ts).getRegex(),Ch=j("reflink|nolink(?!\\()","g").replace("reflink",el).replace("nolink",tl).getRegex(),Cs={_backpedal:Fi,anyPunctuation:Sh,autolink:Th,blockSkip:wh,br:Qa,code:vh,del:Fi,emStrongLDelim:Eh,emStrongRDelimAst:_h,emStrongRDelimUnd:Ah,escape:Za,link:Lh,nolink:tl,punctuation:yh,reflink:el,reflinkSearch:Ch,tag:xh,text:bh,url:Fi},Ih={...Cs,link:j(/^!?\[(label)\]\((.*?)\)/).replace("label",tn).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tn).getRegex()},Es={...Cs,escape:j(Za).replace("])","~|])").getRegex(),url:j(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},$a=i=>Rh[i];function He(i,e){if(e){if(be.escapeTest.test(i))return i.replace(be.escapeReplace,$a)}else if(be.escapeTestNoEncode.test(i))return i.replace(be.escapeReplaceNoEncode,$a);return i}function ja(i){try{i=encodeURI(i).replace(be.percentDecode,"%")}catch{return null}return i}function Ua(i,e){let t=i.replace(be.findPipe,(s,o,a)=>{let l=!1,d=o;for(;--d>=0&&a[d]==="\\";)l=!l;return l?"|":" |"}),r=t.split(be.splitPipe),n=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=n.length?s.slice(n.length):s}).join(` `)}var ri=class{options;rules;lexer;constructor(e){this.options=e||At}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Di(r,` `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],n=Ph(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let n=Di(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Di(t[0],` `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Di(t[0],` `).split(` `),n="",s="",o=[];for(;r.length>0;){let a=!1,l=[],d;for(d=0;d1,s={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let d=!1,p="",m="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let E=t[2].split(` `,1)[0].replace(this.rules.other.listReplaceTabs,q=>" ".repeat(3*q.length)),v=e.split(` `,1)[0],C=!E.trim(),_=0;if(this.options.pedantic?(_=2,m=E.trimStart()):C?_=t[1].length+1:(_=t[2].search(this.rules.other.nonSpaceChar),_=_>4?1:_,m=E.slice(_),_+=t[1].length),C&&this.rules.other.blankLine.test(v)&&(p+=v+` `,e=e.substring(v.length+1),d=!0),!d){let q=this.rules.other.nextBulletRegex(_),B=this.rules.other.hrRegex(_),S=this.rules.other.fencesBeginRegex(_),R=this.rules.other.headingBeginRegex(_),x=this.rules.other.htmlBeginRegex(_);for(;e;){let P=e.split(` `,1)[0],N;if(v=P,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),N=v):N=v.replace(this.rules.other.tabCharGlobal," "),S.test(v)||R.test(v)||x.test(v)||q.test(v)||B.test(v))break;if(N.search(this.rules.other.nonSpaceChar)>=_||!v.trim())m+=` `+N.slice(_);else{if(C||E.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(E)||R.test(E)||B.test(E))break;m+=` `+v}!C&&!v.trim()&&(C=!0),p+=P+` `,e=e.substring(P.length+1),E=N.slice(_)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0));let k=null,D;this.options.gfm&&(k=this.rules.other.listIsTask.exec(m),k&&(D=k[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:p,task:!!k,checked:D,loose:!1,text:m,tokens:[]}),s.raw+=p}let l=s.items.at(-1);l&&(l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd()),s.raw=s.raw.trimEnd();for(let d=0;dE.type==="space"),m=p.length>0&&p.some(E=>this.rules.other.anyLine.test(E.raw));s.loose=m}if(s.loose)for(let d=0;d({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[d]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===` `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=Di(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=Mh(t[2],"()");if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],s=o[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),Wa(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[n.toLowerCase()];if(!s){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return Wa(r,s,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let o=[...n[0]].length-1,a,l,d=o,p=0,m=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(n=m.exec(t))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(l=[...a].length,n[3]||n[4]){d+=l;continue}else if((n[5]||n[6])&&o%3&&!((o+l)%3)){p+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+p);let E=[...n[0]][0].length,v=e.slice(0,o+n.index+E+l);if(Math.min(o,l)%2){let _=v.slice(1,-1);return{type:"em",raw:v,text:_,tokens:this.lexer.inlineTokens(_)}}let C=v.slice(2,-2);return{type:"strong",raw:v,text:C,tokens:this.lexer.inlineTokens(C)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,n;return t[2]==="@"?(r=t[1],n="mailto:"+r):(r=t[1],n=r),{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,n;if(t[2]==="@")r=t[0],n="mailto:"+r;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);r=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},Me=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||At,this.options.tokenizer=this.options.tokenizer||new ri,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:be,block:en.normal,inline:Pi.normal};this.options.pedantic?(t.block=en.pedantic,t.inline=Pi.pedantic):this.options.gfm&&(t.block=en.gfm,this.options.breaks?t.inline=Pi.breaks:t.inline=Pi.gfm),this.tokenizer.rules=t}static get rules(){return{block:en,inline:Pi}}static lex(e,t){return new i(t).lex(e)}static lexInline(e,t){return new i(t).inlineTokens(e)}lex(e){e=e.replace(be.carriageReturn,` `),this.blockTokens(e,this.tokens);for(let t=0;t(n=o.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let o=t.at(-1);n.raw.length===1&&o!==void 0?o.raw+=` `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=` `+n.raw,o.text+=` `+n.text,this.inlineQueue.at(-1).src=o.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=` `+n.raw,o.text+=` `+n.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let s=e;if(this.options.extensions?.startBlock){let o=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(d=>{l=d.call({lexer:this},a),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s))){let o=t.at(-1);r&&o?.type==="paragraph"?(o.raw+=` `+n.raw,o.text+=` `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(n),r=s.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=` `+n.raw,o.text+=` `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(n);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,n=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,n.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s=!1,o="";for(;e;){s||(o=""),s=!1;let a;if(this.options.extensions?.inline?.some(d=>(a=d.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let d=t.at(-1);a.type==="text"&&d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,r,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let d=1/0,p=e.slice(1),m;this.options.extensions.startInline.forEach(E=>{m=E.call({lexer:this},p),typeof m=="number"&&m>=0&&(d=Math.min(d,m))}),d<1/0&&d>=0&&(l=e.substring(0,d+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),s=!0;let d=t.at(-1);d?.type==="text"?(d.raw+=a.raw,d.text+=a.text):t.push(a);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},ni=class{options;parser;constructor(e){this.options=e||At}space(e){return""}code({text:e,lang:t,escaped:r}){let n=(t||"").match(be.notSpaceStart)?.[0],s=e.replace(be.endingNewline,"")+` `;return n?'
'+(r?s:He(s,!0))+`
`:"
"+(r?s:He(s,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} `}hr(e){return`
`}list(e){let t=e.ordered,r=e.start,n="";for(let a=0;a `+n+" `}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+He(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • `}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    `}table(e){let t="",r="";for(let s=0;s${n}`),` `+t+` `+n+`
    `}tablerow({text:e}){return` ${e} `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+` `}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${He(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:r}){let n=this.parser.parseInline(r),s=ja(e);if(s===null)return n;e=s;let o='
    ",o}image({href:e,title:t,text:r}){let n=ja(e);if(n===null)return He(r);e=n;let s=`${r}{let a=s[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):s.tokens&&(r=r.concat(this.walkTokens(s.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=t.renderers[s.name];o?t.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),n.extensions=t),r.renderer){let s=this.defaults.renderer||new ni(this.defaults);for(let o in r.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],d=s[a];s[a]=(...p)=>{let m=l.apply(s,p);return m===!1&&(m=d.apply(s,p)),m||""}}n.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new ri(this.defaults);for(let o in r.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],d=s[a];s[a]=(...p)=>{let m=l.apply(s,p);return m===!1&&(m=d.apply(s,p)),m}}n.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new ii;for(let o in r.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],d=s[a];ii.passThroughHooks.has(o)?s[a]=p=>{if(this.defaults.async)return Promise.resolve(l.call(s,p)).then(E=>d.call(s,E));let m=l.call(s,p);return d.call(s,m)}:s[a]=(...p)=>{let m=l.apply(s,p);return m===!1&&(m=d.apply(s,p)),m}}n.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,o=r.walkTokens;n.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Me.lex(e,t??this.defaults)}parser(e,t){return Pe.parse(e,t??this.defaults)}parseMarkdown(e){return(r,n)=>{let s={...n},o={...this.defaults,...s},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?Me.lex:Me.lexInline,d=o.hooks?o.hooks.provideParser():e?Pe.parse:Pe.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(p=>l(p,o)).then(p=>o.hooks?o.hooks.processAllTokens(p):p).then(p=>o.walkTokens?Promise.all(this.walkTokens(p,o.walkTokens)).then(()=>p):p).then(p=>d(p,o)).then(p=>o.hooks?o.hooks.postprocess(p):p).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let p=l(r,o);o.hooks&&(p=o.hooks.processAllTokens(p)),o.walkTokens&&this.walkTokens(p,o.walkTokens);let m=d(p,o);return o.hooks&&(m=o.hooks.postprocess(m)),m}catch(p){return a(p)}}}onError(e,t){return r=>{if(r.message+=` Please report this to https://github.com/markedjs/marked.`,e){let n="

    An error occurred:

    "+He(r.message+"",!0)+"
    ";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}},_t=new _s;function $(i,e){return _t.parse(i,e)}$.options=$.setOptions=function(i){return _t.setOptions(i),$.defaults=_t.defaults,Ka($.defaults),$};$.getDefaults=As;$.defaults=At;$.use=function(...i){return _t.use(...i),$.defaults=_t.defaults,Ka($.defaults),$};$.walkTokens=function(i,e){return _t.walkTokens(i,e)};$.parseInline=_t.parseInline;$.Parser=Pe;$.parser=Pe.parse;$.Renderer=ni;$.TextRenderer=Bi;$.Lexer=Me;$.lexer=Me.lex;$.Tokenizer=ri;$.Hooks=ii;$.parse=$;var Dw=$.options,Fw=$.setOptions,Bw=$.use,Nw=$.walkTokens,Hw=$.parseInline;var qw=Pe.parse,zw=Me.lex;var sn=class extends T{connect(){console.log(`easymde connected: ${this.element}`),this.easyMDE=new EasyMDE(this.#e()),this.element.setAttribute("data-action","turbo:morph-element->easymde#reconnect")}disconnect(){this.easyMDE.toTextArea(),this.easyMDE=null}reconnect(){this.disconnect(),this.connect()}#e(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=ws.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=$(t);return ws.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var on=class extends T{connect(){console.log(`slim-select connected: ${this.element}`),this.slimSelect=new SlimSelect({select:this.element}),this.element.setAttribute("data-action","turbo:morph-element->slim-select#reconnect")}disconnect(){this.slimSelect.destroy(),this.slimSelect=null}reconnect(){this.disconnect(),this.connect()}};var an=class extends T{connect(){console.log(`flatpickr connected: ${this.element}`),this.picker=new flatpickr(this.element,this.#e()),this.element.setAttribute("data-action","turbo:morph-element->flatpickr#reconnect")}disconnect(){this.picker.destroy(),this.picker=null}reconnect(){this.disconnect(),this.connect()}#e(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),i}};var ln=class extends T{static targets=["input"];connect(){console.log(`intl-tel-input connected: ${this.element}`)}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){this.hasInputTarget&&(this.iti=window.intlTelInput(this.inputTarget,this.#e()),this.inputTarget.setAttribute("data-action","turbo:morph-element->intl-tel-input#reconnect"))}inputTargetDisconnected(){this.iti&&this.iti.destroy(),this.iti=null}reconnect(){this.inputTargetDisconnected(),this.inputTargetConnected()}#e(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js"}}};function Is(i){i.register("resource-layout",nr),i.register("nav-grid-menu-item",sr),i.register("nav-grid-menu",or),i.register("nav-user-section",ar),i.register("nav-user-link",lr),i.register("nav-user",cr),i.register("header",ur),i.register("sidebar-menu-item",hr),i.register("sidebar-menu",dr),i.register("sidebar",pr),i.register("has-many-panel",fr),i.register("nested-resource-form-fields",mr),i.register("toolbar",gr),i.register("table-search-input",vr),i.register("table-toolbar",br),i.register("table",yr),i.register("form",wr),i.register("resource-drop-down",Wr),i.register("resource-collapse",Kr),i.register("resource-dismiss",Gr),i.register("frame-navigator",Xr),i.register("color-mode",Yr),i.register("easymde",sn),i.register("slim-select",on),i.register("flatpickr",an),i.register("intl-tel-input",ln)}(function(i){if(typeof i.requestSubmit=="function")return;i.requestSubmit=function(r){r?(e(r,this),r.click()):(r=document.createElement("input"),r.type="submit",r.hidden=!0,this.appendChild(r),r.click(),this.removeChild(r))};function e(r,n){r instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),r.type=="submit"||t(TypeError,"The specified element is not a submit button"),r.form==n||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(r,n,s){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+n+".",s)}})(HTMLFormElement.prototype);var al=new WeakMap;function Dh(i){let e=i instanceof Element?i:i instanceof Node?i.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function Fh(i){let e=Dh(i.target);e&&e.form&&al.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let i=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))i=e;else return}addEventListener("click",Fh,!0),Object.defineProperty(i,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return al.get(this.target)}})})();var oi={eager:"eager",lazy:"lazy"},qe=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return Bh(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(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function Bh(i){switch(i.toLowerCase()){case"lazy":return oi.lazy;default:return oi.eager}}function le(i){return new URL(i.toString(),document.baseURI)}function kt(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function oo(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return le(t)}function Nh(i){return($h(i).match(/\.[^.]*$/)||[])[0]||""}function Hh(i){return!!Nh(i).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function qh(i,e){let t=jh(e);return i.href===le(t).href||i.href.startsWith(t)}function ot(i,e){return qh(i,e)&&Hh(i)}function Os(i){let e=kt(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function cn(i){return Os(i)}function zh(i,e){return le(i).href==le(e).href}function Vh(i){return i.pathname.split("/").slice(1)}function $h(i){return Vh(i).slice(-1)[0]}function jh(i){return Uh(i.origin+i.pathname)}function Uh(i){return i.endsWith("/")?i:i+"/"}var Hi=class{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 le(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 qi(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=hi("csp-nonce");return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,Wh(e,i),e}}function Wh(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function Kh(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function Q(i,{target:e,cancelable:t,detail:r}={}){let n=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(n):document.documentElement.dispatchEvent(n),n}function li(){return document.visibilityState==="hidden"?cl():ll()}function ll(){return new Promise(i=>requestAnimationFrame(()=>i()))}function cl(){return new Promise(i=>setTimeout(()=>i(),0))}function Gh(){return Promise.resolve()}function ul(i=""){return new DOMParser().parseFromString(i,"text/html")}function hl(i,...e){let t=Xh(i,e).replace(/^\n/,"").split(` `),r=t[0].match(/^\s+/),n=r?r[0].length:0;return t.map(s=>s.slice(n)).join(` `)}function Xh(i,e){return i.reduce((t,r,n)=>{let s=e[n]==null?"":e[n];return t+r+s},"")}function at(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function hn(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function Yh(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function dn(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function pn(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Zh(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function dl(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Qh(i){return i=="advance"||i=="replace"||i=="restore"}function xt(...i){let e=hn("data-turbo-action",...i);return Qh(e)?e:null}function pl(i){return document.querySelector(`meta[name="${i}"]`)}function hi(i){let e=pl(i);return e&&e.content}function Jh(i,e){let t=pl(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function ci(i,e){if(i instanceof Element)return i.closest(e)||ci(i.assignedSlot||i.getRootNode()?.host,e)}function ao(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function fl(i){return Array.from(i.querySelectorAll("[autofocus]")).find(ao)}async function ed(i,e){let t=e();i(),await ll();let r=e();return[t,r]}function td(i){if(i.hasAttribute("target")){for(let e of document.getElementsByName(i.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function id(i){return ci(i,"a[href]:not([target^=_]):not([download])")}function ml(i){return le(i.getAttribute("href")||"")}function rd(i,e){let t=null;return(...r)=>{let n=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(n,e)}}var Rs=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},gl=new Rs(20),nd=window.fetch;function vl(i,e={}){let t=new Headers(e.headers||{}),r=at();return gl.add(r),t.append("X-Turbo-Request-Id",r),nd(i,{...e,headers:t})}function lo(i){switch(i.toLowerCase()){case"get":return ke.get;case"post":return ke.post;case"put":return ke.put;case"patch":return ke.patch;case"delete":return ke.delete}}var ke={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function sd(i){switch(i.toLowerCase()){case Tt.multipart:return Tt.multipart;case Tt.plain:return Tt.plain;default:return Tt.urlEncoded}}var Tt={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Lt=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,n=new URLSearchParams,s=null,o=Tt.urlEncoded){let[a,l]=il(le(r),t,n,o);this.delegate=e,this.url=a,this.target=s,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=lo(e)||ke.get;this.url.search="";let[n,s]=il(this.url,r,t,this.enctype);this.url=n,this.fetchOptions.body=s,this.fetchOptions.method=r}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}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(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=vl(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Hi(e);return Q("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 defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return co(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(n=>this.#e=n),r=Q("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!Q("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function co(i){return lo(i)==ke.get}function il(i,e,t,r){let n=Array.from(t).length>0?new URLSearchParams(bl(t)):i.searchParams;return co(e)?[od(i,n),null]:r==Tt.urlEncoded?[i,n]:[i,t]}function bl(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function od(i,e){let t=new URLSearchParams(bl(e));return i.search=t.toString(),i}var Ms=class{started=!1;constructor(e,t){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))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},lt=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(Kh(e)):e}constructor(e){this.fragment=ad(e)}};function ad(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(qi(r));e.replaceWith(t)}return i}var ld=100,Ps=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,r){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,r),this.#e=null},ld)}set(e,t,r){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+r)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},cd=10*1e3,ai=new Ps,si={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},zi=class i{state=si.initialized;static confirmMethod(e,t,r){return Promise.resolve(confirm(e))}constructor(e,t,r,n=!1){let s=md(t,r),o=fd(pd(t,r),s),a=ud(t,r),l=gd(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new Lt(this,s,o,a,t,l),this.mustRedirect=n}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=le(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=si,r=hn("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await i.confirmMethod(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=si;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=hd(hi("csrf-param"))||hi("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(lt.contentType)}requestStarted(e){this.state=si.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),dn(this.formElement),Q("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){ai.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(ai.clear(),this.requestMustRedirect(e)&&dd(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=si.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){this.state=si.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),pn(this.formElement),Q("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Yh("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function ud(i,e){let t=new FormData(i),r=e?.getAttribute("name"),n=e?.getAttribute("value");return r&&t.append(r,n||""),t}function hd(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function dd(i){return i.statusCode==200&&!i.redirected}function pd(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function fd(i,e){let t=le(i);return co(e)&&(t.search=""),t}function md(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return lo(t.toLowerCase())||ke.get}function gd(i,e){return sd(e?.getAttribute("formenctype")||i.enctype)}var di=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return fl(this.element)}get permanentElements(){return wl(this.element)}getPermanentElementById(e){return yl(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:n}=r,s=e.getPermanentElementById(n);s&&(t[n]=[r,s])}return t}};function yl(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function wl(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var Vi=class{started=!1;constructor(e,t){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)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&vd(t,r)&&bd(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function vd(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function bd(i,e){if(e?.hasAttribute("formtarget")||i.hasAttribute("target")){let t=e?.getAttribute("formtarget")||i.target;for(let r of document.getElementsByName(t))if(r instanceof HTMLIFrameElement)return!1;return!0}else return!0}var fn=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(kt(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){let{isPreview:t,shouldRender:r,willRender:n,newSnapshot:s}=e,o=n;if(r)try{this.renderPromise=new Promise(p=>this.#e=p),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(p=>this.#t=p),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(s,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(s,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&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")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Ds=class extends fn{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new di(this.element)}},mn=class{constructor(e,t){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)}clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};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};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},gn=class{started=!1;constructor(e,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)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=id(t);if(r&&td(r)){let n=ml(r);this.delegate.willFollowLinkToLocation(r,n,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,n))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},vn=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new gn(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),n="hidden";for(let[m,E]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:n,name:m,value:E}));let s=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",s.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=xt(e);l&&r.setAttribute("data-turbo-action",l);let 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())}},bn=class{static async preservingPermanentElements(e,t,r){let n=new this(e,t);n.enter(),await r(),n.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=yd(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function yd(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var $i=class{#e=null;constructor(e,t,r,n,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=n,this.willRender=s,this.renderElement=r,this.promise=new Promise((o,a)=>this.resolvingFunctions={resolve:o,reject:a})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await bn.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=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)}get renderMethod(){return"replace"}},ji=class extends $i{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let n=t,s=n.ownerDocument?.createRange();s&&(s.selectNodeContents(n),e.appendChild(s.extractContents()))}constructor(e,t,r,n,s,o=!0){super(t,r,n,s,o),this.delegate=e}get shouldRender(){return!0}async render(){await li(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await li(),this.focusFirstAutofocusableElement(),await li(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=wd(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=Ed(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=qi(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function wd(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function Ed(i,e){return i=="auto"||i=="smooth"?i:e}var Fs=class i{static animationDuration=300;static get defaultCSS(){return hl` .turbo-progress-bar { position: fixed; display: block; top: 0; left: 0; height: 3px; background: #0076ff; z-index: 2147483647; transition: width ${i.animationDuration}ms ease-out, opacity ${i.animationDuration/2}ms ${i.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(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(e){this.value=e,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(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=i.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return hi("csp-nonce")}},Bs=class extends di{detailsByOuterHTML=this.children.filter(e=>!Td(e)).map(e=>Ld(e)).reduce((e,t)=>{let{outerHTML:r}=t,n=r in e?e[r]:{type:_d(t),tracked:Ad(t),elements:[]};return{...e,[r]:{...n,elements:[...n.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:n,elements:s}=this.detailsByOuterHTML[t];return r==null&&!n?[...e,...s]:s.length>1?[...e,...s.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[n]}=this.detailsByOuterHTML[r];return xd(n,e)?n:t},void 0|void 0)}};function _d(i){if(Sd(i))return"script";if(kd(i))return"stylesheet"}function Ad(i){return i.getAttribute("data-turbo-track")=="reload"}function Sd(i){return i.localName=="script"}function Td(i){return i.localName=="noscript"}function kd(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function xd(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function Ld(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var De=class i extends di{static fromHTMLString(e=""){return this.fromDocument(ul(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new Bs(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[n,s]of t.entries()){let o=r[n];for(let a of o.selectedOptions)a.selected=!1;for(let a of s.selectedOptions)o.options[a.index].selected=!0}for(let n of e.querySelectorAll('input[type="password"]'))n.value="";return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return le(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Ns=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Cd={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},un={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},Qe={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ui={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Id={advance:"forward",restore:"back",replace:"none"},Hs=class{identifier=at();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=Qe.initialized;viewTransitioner=new Ns;constructor(e,t,r,n={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||at();let{action:s,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:d,response:p,visitCachedSnapshot:m,willRender:E,updateHistory:v,shouldCacheSnapshot:C,acceptsStreamResponse:_,direction:k}={...Cd,...n};this.action=s,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=d,this.response=p,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=E,this.updateHistory=v,this.scrolled=!E,this.shouldCacheSnapshot=C,this.acceptsStreamResponse=_,this.direction=k||Id[s]}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==Qe.initialized&&(this.recordTimingMetric(un.visitStart),this.state=Qe.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Qe.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Qe.canceled)}complete(){this.state==Qe.started&&(this.recordTimingMetric(un.visitEnd),this.adapter.visitCompleted(this),this.state=Qe.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Qe.started&&(this.state=Qe.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=dl(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Lt(this,ke.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(un.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;rl(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(un.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,rl(e)&&t!=null){let r=De.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(De.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!kt(this.location)||e.hasAnchor(kt(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return De.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(lt.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:n,statusCode:s}=t;r==null?this.recordResponse({statusCode:ui.contentTypeMismatch,redirected:n}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:s,responseHTML:r,redirected:n}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:n,statusCode:s}=t;r==null?this.recordResponse({statusCode:ui.contentTypeMismatch,redirected:n}):this.recordResponse({statusCode:s,responseHTML:r,redirected:n})}requestErrored(e,t){this.recordResponse({statusCode:ui.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?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(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=kt(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await li(),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function rl(i){return i>=200&&i<300}var qs=class{progressBar=new Fs;constructor(e){this.session=e}visitProposedToLocation(e,t){ot(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||at(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case ui.networkFailure:case ui.timeoutFailure:case ui.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){Q("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},zs=class{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},Vs=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new mn(this,t),this.formSubmitObserver=new Vi(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let n=this.#i(e);n&&n.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=oo(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),s=le(n?.content??"/");return this.#t(e,t)&&ot(r,s)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let n=this.#i(e,t);return n?n!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let n=this.element.querySelector(`#${r}:not([disabled])`);if(n instanceof qe)return n}}},$s=class{location;restorationIdentifier=at();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,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(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=at()){e===history.pushState&&++this.currentIndex;let n={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,n,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:r,restorationIndex:n}=t;this.restorationIdentifier=r;let s=n>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,s),this.currentIndex=n}}};onPageLoad=async e=>{await Gh(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},js=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#r,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#r,!0),this.started=!0};#i=e=>{if(hi("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#a(t)){let n=t,s=ml(n);if(this.delegate.canPrefetchRequestToLocation(n,s)){this.#e=n;let o=new Lt(this,ke.get,s,new URLSearchParams,t);ai.setLater(s.toString(),o,this.#o)}}};#n=e=>{e.target===this.#e&&this.#s()};#s=()=>{ai.clear(),this.#e=null};#r=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="get"){let t=ai.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),ai.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),n=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;n&&n!=="_top"&&(e.headers["Turbo-Frame"]=n)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#o(){return Number(hi("turbo-prefetch-cache-time"))||cd}#a(e){return!(!e.getAttribute("href")||Od(e)||Rd(e)||Md(e)||Pd(e)||Fd(e))}},Od=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),Rd=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),Md=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=ci(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Pd=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||Dd(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},Dd=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),Fd=i=>Q("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,Us=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new Hs(this,le(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new zi(this,e,t,!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 rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let n=e.isSafe;n||this.view.clearSnapshotCache();let{statusCode:s,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:n,response:{statusCode:s,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let n=De.fromHTMLString(r);t.serverError?await this.view.renderError(n,this.currentVisit):await this.view.renderPage(n,!1,!0,this.currentVisit),n.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let r=kt(e),n=kt(this.view.lastRenderedLocation),s=t==="restore"&&typeof r>"u";return t!=="replace"&&Os(e)===Os(this.view.lastRenderedLocation)&&(s||r!=null&&r!==n)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:n}=e;return xt(r,n)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},St={initial:0,loading:1,interactive:2,complete:3},Ws=class{stage=St.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==St.initial&&(this.stage=St.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)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==St.loading&&(this.stage=St.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==St.interactive&&(this.stage=St.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},Ks=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},Gs=class{render({fragment:e}){bn.preservingPermanentElements(this,Bd(e),()=>{Nd(e,()=>{Hd(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Bd(i){let e=wl(document.documentElement),t={};for(let r of e){let{id:n}=r;for(let s of i.querySelectorAll("turbo-stream")){let o=yl(s.templateElement.content,n);o&&(t[n]=[r,o])}}return t}async function Nd(i,e){let t=`turbo-stream-autofocus-${at()}`,r=i.querySelectorAll("turbo-stream"),n=qd(r),s=null;if(n&&(n.id?s=n.id:s=t,n.id=s),e(),await li(),(document.activeElement==null||document.activeElement==document.body)&&s){let a=document.getElementById(s);ao(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function Hd(i){let[e,t]=await ed(i,()=>document.activeElement),r=e&&e.id;if(r){let n=document.getElementById(r);ao(n)&&n!=t&&n.focus()}}function qd(i){for(let e of i){let t=fl(e.templateElement.content);if(t)return t}return null}var Xs=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=zd(e);t&&Vd(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(lt.wrap(e))}};function zd(i){let e=i.detail?.fetchResponse;if(e instanceof Hi)return e}function Vd(i){return(i.contentType??"").startsWith(lt.contentType)}var yn=class extends $i{static renderElement(e,t){let{documentElement:r,body:n}=document;r.replaceChild(t,n)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=qi(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},$d=function(){let i=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:E,afterNodeAdded:E,beforeNodeMorphed:E,afterNodeMorphed:E,beforeNodeRemoved:E,afterNodeRemoved:E,beforeAttributeUpdated:E},head:{style:"merge",shouldPreserve:function(u){return u.getAttribute("im-preserve")==="true"},shouldReAppend:function(u){return u.getAttribute("im-re-append")==="true"},shouldRemove:E,afterHeadMorphed:E}};function t(u,h,f={}){u instanceof Document&&(u=u.documentElement),typeof h=="string"&&(h=S(h));let y=R(h),w=C(u,y,f);return r(u,y,w)}function r(u,h,f){if(f.head.block){let y=u.querySelector("head"),w=h.querySelector("head");if(y&&w){let b=m(w,y,f);Promise.all(b).then(function(){r(u,h,Object.assign(f,{head:{block:!1,ignore:!0}}))});return}}if(f.morphStyle==="innerHTML")return o(h,u,f),u.children;if(f.morphStyle==="outerHTML"||f.morphStyle==null){let y=P(h,u,f),w=y?.previousSibling,b=y?.nextSibling,O=s(u,y,f);return y?x(w,O,b):[]}else throw"Do not understand how to morph style "+f.morphStyle}function n(u,h){return h.ignoreActiveValue&&u===document.activeElement&&u!==document.body}function s(u,h,f){if(!(f.ignoreActive&&u===document.activeElement))return h==null?f.callbacks.beforeNodeRemoved(u)===!1?u:(u.remove(),f.callbacks.afterNodeRemoved(u),null):k(u,h)?(f.callbacks.beforeNodeMorphed(u,h)===!1||(u instanceof HTMLHeadElement&&f.head.ignore||(u instanceof HTMLHeadElement&&f.head.style!=="morph"?m(h,u,f):(l(h,u,f),n(u,f)||o(h,u,f))),f.callbacks.afterNodeMorphed(u,h)),u):f.callbacks.beforeNodeRemoved(u)===!1||f.callbacks.beforeNodeAdded(h)===!1?u:(u.parentElement.replaceChild(h,u),f.callbacks.afterNodeAdded(h),f.callbacks.afterNodeRemoved(u),h)}function o(u,h,f){let y=u.firstChild,w=h.firstChild,b;for(;y;){if(b=y,y=b.nextSibling,w==null){if(f.callbacks.beforeNodeAdded(b)===!1)return;h.appendChild(b),f.callbacks.afterNodeAdded(b),Y(f,b);continue}if(_(b,w,f)){s(w,b,f),w=w.nextSibling,Y(f,b);continue}let O=q(u,h,b,w,f);if(O){w=D(w,O,f),s(O,b,f),Y(f,b);continue}let M=B(u,h,b,w,f);if(M){w=D(w,M,f),s(M,b,f),Y(f,b);continue}if(f.callbacks.beforeNodeAdded(b)===!1)return;h.insertBefore(b,w),f.callbacks.afterNodeAdded(b),Y(f,b)}for(;w!==null;){let O=w;w=w.nextSibling,U(O,f)}}function a(u,h,f,y){return u==="value"&&y.ignoreActiveValue&&h===document.activeElement?!0:y.callbacks.beforeAttributeUpdated(u,h,f)===!1}function l(u,h,f){let y=u.nodeType;if(y===1){let w=u.attributes,b=h.attributes;for(let O of w)a(O.name,h,"update",f)||h.getAttribute(O.name)!==O.value&&h.setAttribute(O.name,O.value);for(let O=b.length-1;0<=O;O--){let M=b[O];a(M.name,h,"remove",f)||u.hasAttribute(M.name)||h.removeAttribute(M.name)}}(y===8||y===3)&&h.nodeValue!==u.nodeValue&&(h.nodeValue=u.nodeValue),n(h,f)||p(u,h,f)}function d(u,h,f,y){if(u[f]!==h[f]){let w=a(f,h,"update",y);w||(h[f]=u[f]),u[f]?w||h.setAttribute(f,u[f]):a(f,h,"remove",y)||h.removeAttribute(f)}}function p(u,h,f){if(u instanceof HTMLInputElement&&h instanceof HTMLInputElement&&u.type!=="file"){let y=u.value,w=h.value;d(u,h,"checked",f),d(u,h,"disabled",f),u.hasAttribute("value")?y!==w&&(a("value",h,"update",f)||(h.setAttribute("value",y),h.value=y)):a("value",h,"remove",f)||(h.value="",h.removeAttribute("value"))}else if(u instanceof HTMLOptionElement)d(u,h,"selected",f);else if(u instanceof HTMLTextAreaElement&&h instanceof HTMLTextAreaElement){let y=u.value,w=h.value;if(a("value",h,"update",f))return;y!==w&&(h.value=y),h.firstChild&&h.firstChild.nodeValue!==y&&(h.firstChild.nodeValue=y)}}function m(u,h,f){let y=[],w=[],b=[],O=[],M=f.head.style,ce=new Map;for(let V of u.children)ce.set(V.outerHTML,V);for(let V of h.children){let ne=ce.has(V.outerHTML),de=f.head.shouldReAppend(V),Le=f.head.shouldPreserve(V);ne||Le?de?w.push(V):(ce.delete(V.outerHTML),b.push(V)):M==="append"?de&&(w.push(V),O.push(V)):f.head.shouldRemove(V)!==!1&&w.push(V)}O.push(...ce.values());let H=[];for(let V of O){let ne=document.createRange().createContextualFragment(V.outerHTML).firstChild;if(f.callbacks.beforeNodeAdded(ne)!==!1){if(ne.href||ne.src){let de=null,Le=new Promise(function(Ct){de=Ct});ne.addEventListener("load",function(){de()}),H.push(Le)}h.appendChild(ne),f.callbacks.afterNodeAdded(ne),y.push(ne)}}for(let V of w)f.callbacks.beforeNodeRemoved(V)!==!1&&(h.removeChild(V),f.callbacks.afterNodeRemoved(V));return f.head.afterHeadMorphed(h,{added:y,kept:b,removed:w}),H}function E(){}function v(u){let h={};return Object.assign(h,e),Object.assign(h,u),h.callbacks={},Object.assign(h.callbacks,e.callbacks),Object.assign(h.callbacks,u.callbacks),h.head={},Object.assign(h.head,e.head),Object.assign(h.head,u.head),h}function C(u,h,f){return f=v(f),{target:u,newContent:h,config:f,morphStyle:f.morphStyle,ignoreActive:f.ignoreActive,ignoreActiveValue:f.ignoreActiveValue,idMap:xe(u,h),deadIds:new Set,callbacks:f.callbacks,head:f.head}}function _(u,h,f){return u==null||h==null?!1:u.nodeType===h.nodeType&&u.tagName===h.tagName?u.id!==""&&u.id===h.id?!0:W(f,u,h)>0:!1}function k(u,h){return u==null||h==null?!1:u.nodeType===h.nodeType&&u.tagName===h.tagName}function D(u,h,f){for(;u!==h;){let y=u;u=u.nextSibling,U(y,f)}return Y(f,h),h.nextSibling}function q(u,h,f,y,w){let b=W(w,f,h),O=null;if(b>0){let M=y,ce=0;for(;M!=null;){if(_(f,M,w))return M;if(ce+=W(w,M,u),ce>b)return null;M=M.nextSibling}}return O}function B(u,h,f,y,w){let b=y,O=f.nextSibling,M=0;for(;b!=null;){if(W(w,b,u)>0)return null;if(k(f,b))return b;if(k(O,b)&&(M++,O=O.nextSibling,M>=2))return null;b=b.nextSibling}return b}function S(u){let h=new DOMParser,f=u.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(f.match(/<\/html>/)||f.match(/<\/head>/)||f.match(/<\/body>/)){let y=h.parseFromString(u,"text/html");if(f.match(/<\/html>/))return y.generatedByIdiomorph=!0,y;{let w=y.firstChild;return w?(w.generatedByIdiomorph=!0,w):null}}else{let w=h.parseFromString("","text/html").body.querySelector("template").content;return w.generatedByIdiomorph=!0,w}}function R(u){if(u==null)return document.createElement("div");if(u.generatedByIdiomorph)return u;if(u instanceof Node){let h=document.createElement("div");return h.append(u),h}else{let h=document.createElement("div");for(let f of[...u])h.append(f);return h}}function x(u,h,f){let y=[],w=[];for(;u!=null;)y.push(u),u=u.previousSibling;for(;y.length>0;){let b=y.pop();w.push(b),h.parentElement.insertBefore(b,h)}for(w.push(h);f!=null;)y.push(f),w.push(f),f=f.nextSibling;for(;y.length>0;)h.parentElement.insertBefore(y.pop(),h.nextSibling);return w}function P(u,h,f){let y;y=u.firstChild;let w=y,b=0;for(;y;){let O=N(y,h,f);O>b&&(w=y,b=O),y=y.nextSibling}return w}function N(u,h,f){return k(u,h)?.5+W(f,u,h):0}function U(u,h){Y(h,u),h.callbacks.beforeNodeRemoved(u)!==!1&&(u.remove(),h.callbacks.afterNodeRemoved(u))}function X(u,h){return!u.deadIds.has(h)}function z(u,h,f){return(u.idMap.get(f)||i).has(h)}function Y(u,h){let f=u.idMap.get(h)||i;for(let y of f)u.deadIds.add(y)}function W(u,h,f){let y=u.idMap.get(h)||i,w=0;for(let b of y)X(u,b)&&z(u,b,f)&&++w;return w}function ye(u,h){let f=u.parentElement,y=u.querySelectorAll("[id]");for(let w of y){let b=w;for(;b!==f&&b!=null;){let O=h.get(b);O==null&&(O=new Set,h.set(b,O)),O.add(w.id),b=b.parentElement}}}function xe(u,h){let f=new Map;return ye(u,f),ye(h,f),f}return{morph:t,defaults:e}}(),pi=class extends $i{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await 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}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Zh(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(qi(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,n]of t.entries()){if(e.tagName=="TITLE"){if(n.tagName!="TITLE")continue;if(e.innerHTML==n.innerHTML)return t.splice(r,1),!0}if(n.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=qi(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}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")}},Ys=class extends pi{async render(){this.willRender&&await this.#e()}get renderMethod(){return"morph"}async#e(){this.#t(this.currentElement,this.newElement),this.#a(),Q("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})}#t(e,t,r="outerHTML"){this.isMorphingTurboFrame=this.#l(e),$d.morph(e,t,{morphStyle:r,callbacks:{beforeNodeAdded:this.#i,beforeNodeMorphed:this.#n,beforeAttributeUpdated:this.#s,beforeNodeRemoved:this.#o,afterNodeMorphed:this.#r}})}#i=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));#n=(e,t)=>{if(e instanceof HTMLElement)return!e.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!this.#l(e))?!Q("turbo:before-morph-element",{cancelable:!0,target:e,detail:{newElement:t}}).defaultPrevented:!1};#s=(e,t,r)=>!Q("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;#r=(e,t)=>{t instanceof HTMLElement&&Q("turbo:morph-element",{target:e,detail:{newElement:t}})};#o=e=>this.#n(e);#a(){this.#d().forEach(e=>{this.#l(e)&&(this.#u(e),e.reload())})}#u(e){e.addEventListener("turbo:before-frame-render",t=>{t.detail.render=this.#h},{once:!0})}#h=(e,t)=>{Q("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),this.#t(e,t.children,"innerHTML")};#l(e){return e.src&&e.refresh==="morph"}#d(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(e=>!e.closest("[data-turbo-permanent]"))}},Zs=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return cn(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[cn(e)]}write(e,t){this.snapshots[cn(e)]=t}touch(e){let t=cn(e),r=this.keys.indexOf(t);r>-1&&this.keys.splice(r,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},Qs=class extends fn{snapshotCache=new Zs(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,n){let o=this.isPageRefresh(n)&&this.snapshot.shouldMorphPage?Ys:pi,a=new o(this.snapshot,e,pi.renderElement,t,r);return a.shouldRender?n?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new yn(this.snapshot,e,yn.renderElement,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await cl();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return De.fromElement(this.element)}},Js=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Lt(this,ke.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,n=De.fromHTMLString(r);this.snapshotCache.put(e.url,n)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},eo=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Jh("turbo-cache-control",e)}},to=class{navigator=new Us(this);history=new $s(this);view=new Qs(this,document.documentElement);adapter=new qs(this);pageObserver=new Ws(this);cacheObserver=new zs;linkPrefetchObserver=new js(this,document);linkClickObserver=new gn(this,window);formSubmitObserver=new Vi(this,document);scrollObserver=new Ks(this);streamObserver=new Xs(this);formLinkClickObserver=new vn(this,document.documentElement);frameRedirector=new Vs(this,document.documentElement);streamMessageRenderer=new Gs;cache=new eo(this);drive=!0;enabled=!0;progressBarDelay=500;started=!1;formMode="on";#e=150;constructor(e){this.recentRequests=e,this.preloader=new Js(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.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.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof qe){let n=t.action||xt(r);r.delegate.proposeVisitIfNavigatedWithAction(r,n),r.src=e.toString()}else this.navigator.proposeVisit(le(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(lt.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=rd(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),n=e.getAttribute("data-turbo-frame"),s=n=="_top"?null:document.getElementById(n)||ci(e,"turbo-frame:not([disabled])");if(t||r||s instanceof qe)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&ot(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&ot(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&ot(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&ot(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),n=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:n})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){nl(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(dn(document.documentElement),this.view.markVisitDirection(e.direction)),nl(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),pn(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let r=oo(e,t);return this.submissionIsNavigatable(e,t)&&ot(le(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:n,detail:{render:s}}=r;return this.view.renderer&&s&&(this.view.renderer.renderElement=s),!n}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return Q("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return Q("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return Q("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return Q("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return Q("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return Q("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return Q("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return Q("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return Q("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=ci(e,"[data-turbo]"),r=ci(e,"turbo-frame");return this.drive||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return xt(e)||"advance"}get snapshot(){return this.view.snapshot}};function nl(i){Object.defineProperties(i,jd)}var jd={absoluteURL:{get(){return this.toString()}}},Z=new to(gl),{cache:Ud,navigator:Wd}=Z;function El(){Z.start()}function Kd(i){Z.registerAdapter(i)}function Gd(i,e){Z.visit(i,e)}function _l(i){Z.connectStreamSource(i)}function Al(i){Z.disconnectStreamSource(i)}function Xd(i){Z.renderStreamMessage(i)}function Yd(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Z.clearCache()}function Zd(i){Z.setProgressBarDelay(i)}function Qd(i){zi.confirmMethod=i}function Jd(i){Z.setFormMode(i)}var ep=Object.freeze({__proto__:null,navigator:Wd,session:Z,cache:Ud,PageRenderer:pi,PageSnapshot:De,FrameRenderer:ji,fetch:vl,start:El,registerAdapter:Kd,visit:Gd,connectStreamSource:_l,disconnectStreamSource:Al,renderStreamMessage:Xd,clearCache:Yd,setProgressBarDelay:Zd,setConfirmMethod:Qd,setFormMode:Jd}),io=class extends Error{},ro=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#n=!1;#s=new Set;action=null;constructor(e){this.element=e,this.view=new Ds(this,this.element),this.appearanceObserver=new Ms(this,this.element),this.formLinkClickObserver=new vn(this,this.element),this.linkInterceptor=new mn(this,this.element),this.restorationIdentifier=at(),this.formSubmitObserver=new Vi(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==oi.lazy?this.appearanceObserver.start():this.#r(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==oi.eager&&this.#r()}sourceURLChanged(){this.#v("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==oi.eager||this.#n)&&this.#r())}sourceURLReloaded(){let{src:e}=this.element;return this.element.removeAttribute("complete"),this.element.src=null,this.element.src=e,this.element.loaded}loadingStyleChanged(){this.loadingStyle==oi.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#r())}async#r(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(le(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#n=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=ul(t);De.fromDocument(r).isVisitable?await this.#o(e,r):await this.#h(e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,xt(e)),this.#r()}willSubmitFormLinkToLocation(e){return this.#p(e)}submittedFormLinkToLocation(e,t,r){let n=this.#c(e);n&&r.setAttribute("data-turbo-frame",n.id)}shouldInterceptLinkClick(e,t,r){return this.#p(e)}linkClickIntercepted(e,t){this.#u(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#p(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new zi(this,e,t);let{fetchRequest:r}=this.formSubmission;this.prepareRequest(r),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(lt.contentType)}requestStarted(e){dn(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){pn(this.element)}formSubmissionStarted({formElement:e}){dn(e,this.#c(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#c(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,xt(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Z.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Z.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){pn(e,this.#c(e))}allowsImmediateRender({element:e},t){let r=Q("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:n,detail:{render:s}}=r;return this.view.renderer&&s&&(this.view.renderer.renderElement=s),!n}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Z.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#o(e,t){let r=await this.extractForeignFrameElement(t.body);if(r){let n=new di(r),s=new ji(this,this.view.snapshot,n,ji.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(s),this.complete=!0,Z.frameRendered(e,this.element),Z.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#l(e)&&this.#d(e)}async#a(e){let t=new Lt(this,ke.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#u(e,t,r){let n=this.#c(e,r);n.delegate.proposeVisitIfNavigatedWithAction(n,xt(r,e,n)),this.#y(e,()=>{n.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=De.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=async s=>{if(e.src){let{statusCode:o,redirected:a}=s,l=await s.responseHTML,p={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(p.action=this.action),Z.visit(e.src,p)}}}}changeHistory(){if(this.action){let e=dl(this.action);Z.history.update(e,le(this.element.src||""),this.restorationIdentifier)}}async#h(e){console.warn(`The response (${e.statusCode}) from is performing a full page visit due to turbo-visit-control.`),await this.#f(e.response)}#l(e){this.element.setAttribute("complete","");let t=e.response,r=async(s,o)=>{s instanceof Response?this.#f(s):Z.visit(s,o)};return!Q("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#d(e){this.view.missing(),this.#m(e)}#m(e){let t=`The response (${e.statusCode}) did not contain the expected and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new io(t)}async#f(e){let t=new Hi(e),r=await t.responseHTML,{location:n,redirected:s,statusCode:o}=t;return Z.visit(n,{response:{redirected:s,statusCode:o,responseHTML:r}})}#c(e,t){let r=hn("data-turbo-frame",t,e)||this.element.getAttribute("target");return sl(r)??this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=ol(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=ol(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(n){return console.error(n),new qe}return null}#g(e,t){let r=oo(e,t);return ot(le(r),this.rootLocation)}#p(e,t){let r=hn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#g(e,t)||!this.enabled||r=="_top")return!1;if(r){let n=sl(r);if(n)return!n.disabled}return!(!Z.elementIsNavigatable(e)||t&&!Z.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#b("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return le(t)}#v(e){return this.#s.has(e)}#b(e,t){this.#s.add(e),t(),this.#s.delete(e)}#y(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function sl(i){if(i!=null){let e=document.getElementById(i);if(e instanceof qe)return e}}function ol(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&zh(t,e))throw new Error(`Matching element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof qe)return i.connectedCallback(),i.disconnectedCallback(),i}}var Sl={after(){this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){this.targetElements.forEach(i=>i.replaceWith(this.templateContent))},update(){this.targetElements.forEach(i=>{i.innerHTML="",i.append(this.templateContent)})},refresh(){Z.refresh(this.baseURI,this.requestId)}},no=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await li(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=Sl[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a