1(()=>{var ts=Object.defineProperty;var Ds=(s,e,t)=>e in s?ts(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var C=(s,e)=>()=>(s&&(e=s(s=0)),e);var Hs=(s,e)=>{for(var t in e)ts(s,t,{get:e[t],enumerable:!0})};var M=(s,e,t)=>(Ds(s,typeof e!="symbol"?e+"":e,t),t);var N,Ce=C(()=>{N={logger:self.console,WebSocket:self.WebSocket}});var c,G=C(()=>{Ce();c={log(...s){this.enabled&&(s.push(Date.now()),N.logger.log("[ActionCable]",...s))}}});var ne,Me,oe,xe,mt=C(()=>{G();ne=()=>new Date().getTime(),Me=s=>(ne()-s)/1e3,oe=class{constructor(e){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=e,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=ne(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),c.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=ne(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),c.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=ne()}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,c.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=ne(),c.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:e,reconnectionBackoffRate:t}=this.constructor,i=Math.pow(1+t,Math.min(this.reconnectAttempts,10)),n=(this.reconnectAttempts===0?1:t)*Math.random();return e*1e3*i*(1+n)}reconnectIfStale(){this.connectionIsStale()&&(c.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${Me(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?c.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${Me(this.disconnectedAt)} s`):(c.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return Me(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&Me(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(c.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};oe.staleThreshold=6;oe.reconnectionBackoffRate=.15;xe=oe});var ae,ft=C(()=>{ae={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]}});var le,Re,ki,ds,ce,Oe,gt=C(()=>{Ce();mt();ft();G();({message_types:le,protocols:Re}=ae),ki=Re.slice(0,Re.length-1),ds=[].indexOf,ce=class{constructor(e){this.open=this.open.bind(this),this.consumer=e,this.subscriptions=this.consumer.subscriptions,this.monitor=new xe(this),this.disconnected=!0}send(e){return this.isOpen()?(this.webSocket.send(JSON.stringify(e)),!0):!1}open(){return this.isActive()?(c.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1):(c.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${Re}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new N.WebSocket(this.consumer.url,Re),this.installEventHandlers(),this.monitor.start(),!0)}close({allowReconnect:e}={allowReconnect:!0}){if(e||this.monitor.stop(),this.isActive())return this.webSocket.close()}reopen(){if(c.log(`Reopening WebSocket, current state is ${this.get
1State()}`),this.isActive())try{return this.close()}catch(e){c.log("Failed to reopen WebSocket",e)}finally{c.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}isProtocolSupported(){return ds.call(ki,this.getProtocol())>=0}isState(...e){return ds.call(e,this.getState())>=0}getState(){if(this.webSocket){for(let e in N.WebSocket)if(N.WebSocket[e]===this.webSocket.readyState)return e.toLowerCase()}return null}installEventHandlers(){for(let e in this.events){let t=this.events[e].bind(this);this.webSocket[`on${e}`]=t}}uninstallEventHandlers(){for(let e in this.events)this.webSocket[`on${e}`]=function(){}}};ce.reopenDelay=500;ce.prototype.events={message(s){if(!this.isProtocolSupported())return;let{identifier:e,message:t,reason:i,reconnect:r,type:n}=JSON.parse(s.data);switch(n){case le.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case le.disconnect:return c.log(`Disconnecting. Reason: ${i}`),this.close({allowReconnect:r});case le.ping:return this.monitor.recordPing();case le.confirmation:return this.subscriptions.confirmSubscription(e),this.subscriptions.notify(e,"connected");case le.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",t)}},open(){if(c.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return c.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(s){if(c.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){c.log("WebSocket onerror event")}};Oe=ce});var Bi,W,pt=C(()=>{Bi=function(s,e){if(e!=null)for(let t in e){let i=e[t];s[t]=i}return s},W=class{constructor(e,t={},i){this.consumer=e,this.identifier=JSON.stringify(t),Bi(this,i)}perform(e,t={}){return t.action=e,this.send(t)}send(e){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(e)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}});var bt,ke,vt=C(()=>{G();bt=class{constructor(e){this.subscriptions=e,this.pendingSubscriptions=[]}guarantee(e){this.pendingSubscriptions.indexOf(e)==-1?(c.log(`SubscriptionGuarantor guaranteeing ${e.identifier}`),this.pendingSubscriptions.push(e)):c.log(`SubscriptionGuarantor already guaranteeing ${e.identifier}`),this.startGuaranteeing()}forget(e){c.log(`SubscriptionGuarantor forgetting ${e.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(t=>t!==e)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(e=>{c.log(`SubscriptionGuarantor resubscribing ${e.identifier}`),this.subscriptions.subscribe(e)})},500)}},ke=bt});var _,yt=C(()=>{pt();vt();G();_=class{constructor(e){this.consumer=e,this.guarantor=new ke(this),this.subscriptions=[]}create(e,t){let i=e,r=typeof i=="object"?i:{channel:i},n=new W(this.consumer,r,t);return this.add(n)}add(e){return this.subscriptions.push(e),this.consumer.ensureActiveConnection(),this.notify(e,"initialized"),this.subscribe(e),e}remove(e){return this.forget(e),this.findAll(e.identifier).length||this.sendCommand(e,"unsubscribe"),e}reject(e){return this.findAll(e).map(t=>(this.forget(t),this.notify(t,"rejected"),t))}forget(e){return this.guarantor.forget(e),this.subscriptions=this.subscriptions.filter(t=>t!==e),e}findAll(e){return this.subscriptions.filter(t=>t.identifier===e)}reload(){return this.subscriptions.map(e=>this.subscribe(e))}notifyAll(e,...t){return this.subscriptions.map(i=>this.notify(i,e,...t))}notify(e,t,...i){let r;return typeof e=="string"?r=this.findAll(e):r=[e],r.map(n=>typeof n[t]=="function"?n[t](...i):void 0)}subscribe(e){this.sendCommand(e,"subscribe")&&this.guarantor.guarantee(e)}confirmSubscription(e){c.log(`Subscription confirmed ${e}`),this.findAll(e).map(t=>this.guarantor.forget(t))}sendCommand(e,t){let{identifier:i}=e;return this.consumer.send({command:t,identifier:i})}}});
1function wt(s){if(typeof s=="function"&&(s=s()),s&&!/^wss?:/i.test(s)){let e=document.createElement("a");return e.href=s,e.href=e.href,e.protocol=e.protocol.replace("http","ws"),e.href}else return s}var J,us=C(()=>{gt();yt();J=class{constructor(e){this._url=e,this.subscriptions=new _(this),this.connection=new Oe(this)}get url(){return wt(this._url)}send(e){return this.connection.send(e)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}}});var fs={};Hs(fs,{Connection:()=>Oe,ConnectionMonitor:()=>xe,Consumer:()=>J,INTERNAL:()=>ae,Subscription:()=>W,SubscriptionGuarantor:()=>ke,Subscriptions:()=>_,adapters:()=>N,createConsumer:()=>Pi,createWebSocketURL:()=>wt,getConfig:()=>ms,logger:()=>c});function Pi(s=ms("url")||ae.default_mount_path){return new J(s)}function ms(s){let e=document.head.querySelector(`meta[name='action-cable-${s}']`);if(e)return e.getAttribute("content")}var gs=C(()=>{gt();mt();us();ft();pt();yt();vt();Ce();G()});(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let s=HTMLElement,e={HTMLElement:function(){return Reflect.construct(s,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=s.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,s)})();(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,r){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,r,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+r+".",n)}})(HTMLFormElement.prototype);var as=new WeakMap;function $s(s){let e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function qs(s){let e=$s(s.target);e&&e.form&&as.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))s=window.SubmitEvent.prototype;else{if("SubmitEvent"in window)return;s=window.Event.prototype}addEventListener("click",qs,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return as.get(this.target)}})})();var V;(function(s){s.eager="eager",s.lazy="lazy"})(V||(V={}));var R=class extends HTMLElement{constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new R.delegateConstructor(this)}static get observedAttributes(){return["disabled","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){let{src:e}=this;this.src=null,this.src=e}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return js(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}};function js(s){switch(s.toLowerCase()){case"lazy":return V.lazy;default:return V.eager}}function b(s){return new URL(s.toString(),document.baseURI)}function $(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function ct(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return b(t)}function Ws(s){return(Gs(s).match(/\.[^.]*$/)||[])[0]||""}function _s(s){return!!Ws(s).match(/^(?:|\.(?:htm|html|xhtml))$/)}function Ks(s,e){let t=Js(e);return s.href===b(t).href||s.href.startsWith(t)}function te(s,e){return Ks(s,e)&&_s(s)}function Ne(s){let e=$(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function ve(s){return Ne(s)}function Us(s,e){return b(s).href==b(e).href}function zs(s){return s.pathname.split("/").slice(1)}function Gs(s){return zs(s).slice(-1)[0]}function Js(s){return Qs(s.origin+s.pathname)}function Qs(s){return s.endsWith("/")?s:s+"/"}var Ee=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 b(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)}};
1function v(s,{target:e,cancelable:t,detail:i}={}){let r=new CustomEvent(s,{cancelable:t,bubbles:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(r):document.documentElement.dispatchEvent(r),r}function ye(){return new Promise(s=>requestAnimationFrame(()=>s()))}function Ys(){return new Promise(s=>setTimeout(()=>s(),0))}function Xs(){return Promise.resolve()}function ls(s=""){return new DOMParser().parseFromString(s,"text/html")}function cs(s,...e){let t=Zs(s,e).replace(/^\n/,"").split(` 2`),i=t[0].match(/^\s+/),r=i?i[0].length:0;return t.map(n=>n.slice(r)).join(` 3`)}function Zs(s,e){return s.reduce((t,i,r)=>{let n=e[r]==null?"":e[r];return t+i+n},"")}function se(){return Array.apply(null,{length:36}).map((s,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 we(s,...e){for(let t of e.map(i=>i?.getAttribute(s)))if(typeof t=="string")return t;return null}function De(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function He(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}var g;(function(s){s[s.get=0]="get",s[s.post=1]="post",s[s.put=2]="put",s[s.patch=3]="patch",s[s.delete=4]="delete"})(g||(g={}));function ei(s){switch(s.toLowerCase()){case"get":return g.get;case"post":return g.post;case"put":return g.put;case"patch":return g.patch;case"delete":return g.delete}}var ie=class{constructor(e,t,i,r=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=r,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){var e,t;let{fetchOptions:i}=this;(t=(e=this.delegate).prepareHeadersForRequest)===null||t===void 0||t.call(e,this.headers,this),await this.allowRequestToBeIntercepted(i);try{this.delegate.requestStarted(this);let r=await fetch(this.url.href,i);return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Ee(e);return v("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:g[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isIdempotent?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isIdempotent(){return this.method==g.get}get abortSignal(){return this.abortController.signal}async allowRequestToBeIntercepted(e){let t=new Promise(r=>this.resolveRequestPromise=r);v("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}},$e=class{constructor(e,t){this.started=!1,this.intersect=i=>{let r=i.slice(-1)[0];r?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},q=class{constructor(e){this.templateElement=document.createElement("template"),this.templateElement.innerHTML=e}static wrap(e){return typeof e=="string"?new this(e):e}get fragment(){let e=document.createDocumentFragment();for(let t of this.foreignElements)e.appendChild(document.importNode(t,!0));return e}get foreignElements(){return this.templateChildren.reduce((e,t)=>
3t.tagName.toLowerCase()=="turbo-stream"?[...e,t]:e,[])}get templateChildren(){return Array.from(this.templateElement.content.children)}};q.contentType="text/vnd.turbo-stream.html";var P;(function(s){s[s.initialized=0]="initialized",s[s.requesting=1]="requesting",s[s.waiting=2]="waiting",s[s.receiving=3]="receiving",s[s.stopping=4]="stopping",s[s.stopped=5]="stopped"})(P||(P={}));var F;(function(s){s.urlEncoded="application/x-www-form-urlencoded",s.multipart="multipart/form-data",s.plain="text/plain"})(F||(F={}));function ti(s){switch(s.toLowerCase()){case F.multipart:return F.multipart;case F.plain:return F.plain;default:return F.urlEncoded}}var j=class{constructor(e,t,i,r=!1){this.state=P.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=si(t,i),this.location=b(this.action),this.method==g.get&&ni(this.location,[...this.body.entries()]),this.fetchRequest=new ie(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=r}static confirmMethod(e,t){return confirm(e)}get method(){var e;let t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return ei(t.toLowerCase())||g.get}get action(){var e;let t=typeof this.formElement.action=="string"?this.formElement.action:null;return((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formaction"))||this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==F.urlEncoded||this.method==g.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return ti(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isIdempotent(){return this.fetchRequest.isIdempotent}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}get confirmationMessage(){return this.formElement.getAttribute("data-turbo-confirm")}get needsConfirmation(){return this.confirmationMessage!==null}async start(){let{initialized:e,requesting:t}=P;if(!(this.needsConfirmation&&!j.confirmMethod(this.confirmationMessage,this.formElement))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=P;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareHeadersForRequest(e,t){if(!t.isIdempotent){let i=ii(ss("csrf-param"))||ss("csrf-token");i&&(e["X-CSRF-Token"]=i),e.Accept=[q.contentType,e.Accept].join(", ")}}requestStarted(e){var t;this.state=P.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),v("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&ri(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=P.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=P.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),v("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}requestMustRedirect(e){return!e.isIdempotent&&this.mustRedirect}};function si(s,e){let t=new FormData(s),i=e?.getAttribute("name"),r=e?.getAttribute("value");return i&&r!=null&&t.get(i)!=r&&t.append(i,r),t}function ii(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(s));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function ss(s){let e=document.querySelector(`meta[name="${s}"]`);return e&&e.content}function ri(s){return s.statusCode==200&&!s.redirected}function ni(s,e){let t=new URLSearchParams;for(let[i,r]of e)r instanceof File||t.append(i,r);return s.search=t.toString(),s}var z=class{constructor(e){this.element=e}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 this.element.querySelector("[autofocus]")}get permanentElements(){return[...this.element.querySelectorAll("[id][data-turbo-permanent]")]}getPermanentElementById(e){return this.element.querySelector(`#${e}[data-turbo-permanent]`)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:r}=i,n=e.getPermanentElementById(r);n&&(t[r]=[i,n])}return t}},Te=class{constructor(e,t){this.submitBubbled=i=>{let r=i.target;if(!i.defaultPrevented&&r instanceof HTMLFormElement&&r.closest("turbo-frame, html")==this.element){let n=i.submitter||void 0;(n?.getAttribute("formmethod")||r.method)!="dialog"&&this.delegate.shouldInterceptFormSubmission(r,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmissionIntercepted(r,n))}},this.delegate=e,this.element=t}start(){this.element.addEventListener("submit",this.submitBubbled)}stop(){this.element.removeEventListener("submit",this.submitBubbled)}},Se=class{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},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($(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}
3async render(e){let{isPreview:t,shouldRender:i,newSnapshot:r}=e;if(i)try{this.renderPromise=new Promise(a=>this.resolveRenderPromise=a),this.renderer=e,this.prepareToRenderSnapshot(e);let n=new Promise(a=>this.resolveInterceptionPromise=a);this.delegate.allowsImmediateRender(r,this.resolveInterceptionPromise)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(r,t),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate()}invalidate(){this.delegate.viewInvalidated()}prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},qe=class extends Se{invalidate(){this.element.innerHTML=""}get snapshot(){return new z(this.element)}},Ae=class{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url)),delete this.clickEvent},this.willVisit=()=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},je=class{constructor(e){this.permanentElementMap=e}static preservingPermanentElements(e,t){let i=new this(e);i.enter(),t(),i.leave()}enter(){for(let e in this.permanentElementMap){let[,t]=this.permanentElementMap[e];this.replaceNewPermanentElementWithPlaceholder(t)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=oi(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function oi(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var re=class{constructor(e,t,i,r=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=r,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}createScriptElement(e){if(e.getAttribute("data-turbo-eval")=="false")return e;{let t=document.createElement("script");return this.cspNonce&&(t.nonce=this.cspNonce),t.textContent=e.textContent,t.async=!1,ai(t,e),t}}preservingPermanentElements(e){je.preservingPermanentElements(this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;li(e)&&e.focus()}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 cspNonce(){var e;return(e=document.head.querySelector('meta[name="csp-nonce"]'))===null||e===void 0?void 0:e.getAttribute("content")}};function ai(s,e){for(let{name:t,value:i}of[...e.attributes])s.setAttribute(t,i)}function li(s){return s&&typeof s.focus=="function"}var We=class extends re{get shouldRender(){return!0}async render(){await ye(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await ye(),this.focusFirstAutofocusableElement(),await ye(),this.activateScriptElements()}loadFrameElement(){var e;let t=document.createRange();t.selectNodeContents(this.currentElement),t.deleteContents();let i=this.newElement,r=(e=i.ownerDocument)===null||e===void 0?void 0:e.createRange();r&&(r.selectNodeContents(i),this.currentElement.appendChild(r.extractContents()))}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=ci(this.currentElement.getAttribute("data-autoscroll-block"),"end");if(e)return e.scrollIntoView({block:t}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function ci(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}var L=class{constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return cs` 4 .turbo-progress-bar { 5 position: fixed; 6 display: block; 7 top: 0; 8 left: 0; 9 height: 3px; 10 background: #0076ff; 11 z-index: 9999; 12 transition: 13 width ${L.animationDuration}ms ease-out, 14 opacity ${L.animationDuration/2}ms ${L.animationDuration/2}ms ease-in; 15 transform: translate3d(0, 0, 0); 16 } 17 `}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,L.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,L.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=L.defaultCSS,e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}};L.animationDuration=300;var _e=class extends z{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(e=>!mi(e)).map(e=>pi(e)).reduce((e,t)=>
17{let{outerHTML:i}=t,r=i in e?e[i]:{type:hi(t),tracked:di(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},r),{elements:[...r.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(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:r,elements:n}=this.detailsByOuterHTML[t];return i==null&&!r?[...e,...n]:n.length>1?[...e,...n.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,i)=>{let{elements:[r]}=this.detailsByOuterHTML[i];return gi(r,e)?r:t},void 0)}};function hi(s){if(ui(s))return"script";if(fi(s))return"stylesheet"}function di(s){return s.getAttribute("data-turbo-track")=="reload"}function ui(s){return s.tagName.toLowerCase()=="script"}function mi(s){return s.tagName.toLowerCase()=="noscript"}function fi(s){let e=s.tagName.toLowerCase();return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function gi(s,e){return s.tagName.toLowerCase()=="meta"&&s.getAttribute("name")==e}function pi(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}var x=class extends z{constructor(e,t){super(e),this.headSnapshot=t}static fromHTMLString(e=""){return this.fromDocument(ls(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new _e(e))}clone(){return new x(this.element.cloneNode(!0),this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return b(t)}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"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},U;(function(s){s.visitStart="visitStart",s.requestStart="requestStart",s.requestEnd="requestEnd",s.visitEnd="visitEnd"})(U||(U={}));var A;(function(s){s.initialized="initialized",s.started="started",s.canceled="canceled",s.failed="failed",s.completed="completed"})(A||(A={}));var bi={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0},I;(function(s){s[s.networkFailure=0]="networkFailure",s[s.timeoutFailure=-1]="timeoutFailure",s[s.contentTypeMismatch=-2]="contentTypeMismatch"})(I||(I={}));var Ke=class{constructor(e,t,i,r={}){this.identifier=se(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.snapshotCached=!1,this.state=A.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||se();let{action:n,historyChanged:o,referrer:a,snapshotHTML:l,response:m,visitCachedSnapshot:E,willRender:y}=Object.assign(Object.assign({},bi),r);this.action=n,this.historyChanged=o,this.referrer=a,this.snapshotHTML=l,this.response=m,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=E,this.willRender=y,this.scrolled=!y}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==A.initialized&&(this.recordTimingMetric(U.visitStart),this.state=A.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==A.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=A.canceled)}complete(){this.state==A.started&&(this.recordTimingMetric(U.visitEnd),this.state=A.completed,this.adapter.visitCompleted(this),this.delegate.visitCompleted(this),this.followRedirect())}fail(){this.state==A.started&&(this.state=A.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged){let t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=this.getHistoryMethodForAction(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new ie(this,g.get,this.location),this.request.perform())}
17simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(U.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;is(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(U.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,is(e)&&t!=null?(await this.view.renderPage(x.fromHTMLString(t),!1,this.willRender),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(x.fromHTMLString(t)),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!$(this.location)||e.hasAnchor($(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return x.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.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&((e=this.response)===null||e===void 0?void 0:e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.adapter.visitRendered(this)})}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:I.contentTypeMismatch,redirected:r}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:r}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:I.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:I.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||(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=$(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},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().then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame,this.performScroll()}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function is(s){return s>=200&&s<300}var Ue=class{constructor(e){this.progressBar=new L,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,se(),t)}visitStarted(e){e.loadCachedSnapshot(),e.issueRequest(),e.changeHistory(),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 I.networkFailure:case I.timeoutFailure:case I.contentTypeMismatch:return this.reload();default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(){this.reload()}visitFailed(e){}visitRendered(e){}
17formSubmissionStarted(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)}reload(){window.location.reload()}get navigator(){return this.session.navigator}},ze=class{constructor(){this.started=!1}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeStaleElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeStaleElements,!1))}removeStaleElements(){let e=[...document.querySelectorAll('[data-turbo-cache="false"]')];for(let t of e)t.remove()}},Ge=class{constructor(e){this.started=!1,this.submitCaptured=()=>{removeEventListener("submit",this.submitBubbled,!1),addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=t=>{if(!t.defaultPrevented){let i=t.target instanceof HTMLFormElement?t.target:void 0,r=t.submitter||void 0;i&&(r?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"&&this.delegate.willSubmitForm(i,r)&&(t.preventDefault(),this.delegate.formSubmitted(i,r))}},this.delegate=e}start(){this.started||(addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}},Je=class{constructor(e){this.element=e,this.linkInterceptor=new Ae(this,e),this.formInterceptor=new Te(this,e)}start(){this.linkInterceptor.start(),this.formInterceptor.start()}stop(){this.linkInterceptor.stop(),this.formInterceptor.stop()}shouldInterceptLinkClick(e,t){return this.shouldRedirect(e)}linkClickIntercepted(e,t){let i=this.findFrameElement(e);i&&i.delegate.linkClickIntercepted(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldSubmit(e,t)}formSubmissionIntercepted(e,t){let i=this.findFrameElement(e,t);i&&(i.removeAttribute("reloadable"),i.delegate.formSubmissionIntercepted(e,t))}shouldSubmit(e,t){var i;let r=ct(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=b((i=n?.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&te(r,o)}shouldRedirect(e,t){let i=this.findFrameElement(e,t);return i?i!=e.closest("turbo-frame"):!1}findFrameElement(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let r=this.element.querySelector(`#${i}:not([disabled])`);if(r instanceof R)return r}}},Qe=class{constructor(e){this.restorationIdentifier=se(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){let{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);let{restorationIdentifier:r}=i;this.restorationIdentifier=r,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,r)}}},this.onPageLoad=async t=>{await Xs(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=se()){let r={turbo:{restorationIdentifier:i}};e.call(history,r,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},Ye=class{constructor(e){this.started=!1,this.clickCaptured=()=>{removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=t=>{if(this.clickEventIsSignificant(t)){let i=t.composedPath&&t.composedPath()[0]||t.target,r=this.findLinkFromClickTarget(i);if(r){let n=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,n)&&(t.preventDefault(),this.delegate.followedLinkToLocation(r,n))}}},this.delegate=e}start(){this.started||(addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){if(e instanceof Element)return e.closest("a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return b(e.getAttribute("href")||"")}};function ht(s){return s=="advance"||s=="replace"||s=="restore"}var Xe=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(te(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new Ke(this,b(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new j(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 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 i=await t.responseHTML;if(i){e.method!=g.get&&this.view.clearSnapshotCache();let{statusCode:r,redirected:n}=t,a={action:this.getActionForFormSubmission(e),response:{statusCode:r,responseHTML:i,redirected:n}};this.proposeVisit(t.location,a)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let r=x.fromHTMLString(i);t.serverError?await this.view.renderError(r):await this.view.renderPage(r),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 i=$(e),r=$(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&Ne(e)===Ne(this.view.lastRenderedLocation)&&(n||i!=null&&i!==r)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission(e){let{formElement:t,submitter:i}=e,r=we("data-turbo-action",i,t);return ht(r)?r:"advance"}},k;(function(s){s[s.initial=0]="initial",s[s.loading=1]="loading",s[s.interactive=2]="interactive",s[s.c
17omplete=3]="complete"})(k||(k={}));var Ze=class{constructor(e){this.stage=k.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==k.initial&&(this.stage=k.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==k.loading&&(this.stage=k.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==k.interactive&&(this.stage=k.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},et=class{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},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)}updatePosition(e){this.delegate.scrollPositionChanged(e)}},tt=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{let i=vi(t);i&&yi(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(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)}async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(new q(e))}};function vi(s){var e;let t=(e=s.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof Ee)return t}function yi(s){var e;return((e=s.contentType)!==null&&e!==void 0?e:"").startsWith(q.contentType)}var st=class extends re{async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t,body:i}=document;e.replaceChild(this.newHead,t),e.replaceChild(this.newElement,i)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=this.createScriptElement(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return[...document.documentElement.querySelectorAll("script")]}},Le=class extends re{get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}prepareToRender(){this.mergeHead()}async render(){this.willRender&&this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}mergeHead(){this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()}replaceBody(){this.preservingPermanentElements(()=>{this.activateNewBody(),this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}copyNewHeadStylesheetElements(){for(let e of this.newHeadStylesheetElements)document.head.appendChild(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(this.createScriptElement(e))}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=this.createScriptElement(e);e.replaceWith(t)}}assignNewBody(){document.body&&this.newElement instanceof HTMLBodyElement?document.body.replaceWith(this.newElement):document.documentElement.appendChild(this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},it=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return ve(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[ve(e)]}write(e,t){this.snapshots[ve(e)]=t}touch(e){let t=ve(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},rt=class extends Se{constructor(){super(...arguments),this.snapshotCache=new it(10),this.lastRenderedLocation=new URL(location.href)}renderPage(e,t=!1,i=!0){let r=new Le(this.snapshot,e,t,i);return this.render(r)}renderError(e){let t=new st(this.snapshot,e,!1);return this.render(t)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(){if(this.shouldCacheSnapshot){this.delegate.viewWillCacheSnapshot();let{snapshot:e,lastRenderedLocation:t}=this;await Ys();let i=e.clone();
17return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return x.fromElement(this.element)}get shouldCacheSnapshot(){return this.snapshot.isCacheable}},nt=class{constructor(){this.navigator=new Xe(this),this.history=new Qe(this),this.view=new rt(this,document.documentElement),this.adapter=new Ue(this),this.pageObserver=new Ze(this),this.cacheObserver=new ze,this.linkClickObserver=new Ye(this),this.formSubmitObserver=new Ge(this),this.scrollObserver=new et(this),this.streamObserver=new tt(this),this.frameRedirector=new Je(document.documentElement),this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){this.navigator.proposeVisit(b(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){document.documentElement.appendChild(q.wrap(e).fragment)}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willFollowLinkToLocation(e,t){return this.elementDriveEnabled(e)&&te(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t)}followedLinkToLocation(e,t){let i=this.getActionForLink(e);this.convertLinkWithMethodClickToFormSubmission(e)||this.visit(t.href,{action:i})}convertLinkWithMethodClickToFormSubmission(e){let t=e.getAttribute("data-turbo-method");if(t){let i=document.createElement("form");i.method=t,i.action=e.getAttribute("href")||"undefined",i.hidden=!0,e.hasAttribute("data-turbo-confirm")&&i.setAttribute("data-turbo-confirm",e.getAttribute("data-turbo-confirm"));let r=this.getTargetFrameForLink(e);return r?(i.setAttribute("data-turbo-frame",r),i.addEventListener("turbo:submit-start",()=>i.remove())):i.addEventListener("submit",()=>i.remove()),document.body.appendChild(i),v("submit",{cancelable:!0,target:i})}else return!1}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){rs(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){rs(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=ct(e,t);return this.elementDriveEnabled(e)&&(!t||this.elementDriveEnabled(t))&&te(b(i),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(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){return!this.notifyApplicationBeforeRender(e,t).defaultPrevented}viewRenderedSnapshot(e,t){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}viewInvalidated(){this.adapter.pageInvalidated()}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t){return!this.notifyApplicationAfterClickingLinkToLocation(e,t).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t){return v("turbo:click",{target:e,detail:{url:t.href},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return v("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return De(document.documentElement),v("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return v("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return v("turbo:before-render",{detail:{newBody:e,resume:t},cancelable:!0})}notifyApplicationAfterRender(){return v("turbo:render")}notifyApplicationAfterPageLoad(e={}
17){return He(document.documentElement),v("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 v("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return v("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}elementDriveEnabled(e){let t=e?.closest("[data-turbo]");return this.drive?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){let t=e.getAttribute("data-turbo-action");return ht(t)?t:"advance"}getTargetFrameForLink(e){let t=e.getAttribute("data-turbo-frame");if(t)return t;{let i=e.closest("turbo-frame");if(i)return i.id}}get snapshot(){return this.view.snapshot}};function rs(s){Object.defineProperties(s,wi)}var wi={absoluteURL:{get(){return this.toString()}}},p=new nt,{navigator:Ei}=p;function hs(){p.start()}function Ti(s){p.registerAdapter(s)}function Si(s,e){p.visit(s,e)}function dt(s){p.connectStreamSource(s)}function ut(s){p.disconnectStreamSource(s)}function Ai(s){p.renderStreamMessage(s)}function Li(){p.clearCache()}function Ci(s){p.setProgressBarDelay(s)}function Mi(s){j.confirmMethod=s}var xi=Object.freeze({__proto__:null,navigator:Ei,session:p,PageRenderer:Le,PageSnapshot:x,start:hs,registerAdapter:Ti,visit:Si,connectStreamSource:dt,disconnectStreamSource:ut,renderStreamMessage:Ai,clearCache:Li,setProgressBarDelay:Ci,setConfirmMethod:Mi}),ot=class{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.settingSourceURL=!1,this.element=e,this.view=new qe(this,this.element),this.appearanceObserver=new $e(this,this.element),this.linkInterceptor=new Ae(this,this.element),this.formInterceptor=new Te(this,this.element)}connect(){this.connected||(this.connected=!0,this.reloadable=!1,this.loadingStyle==V.lazy&&this.appearanceObserver.start(),this.linkInterceptor.start(),this.formInterceptor.start(),this.sourceURLChanged())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.linkInterceptor.stop(),this.formInterceptor.stop())}disabledChanged(){this.loadingStyle==V.eager&&this.loadSourceURL()}sourceURLChanged(){(this.loadingStyle==V.eager||this.hasBeenLoaded)&&this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==V.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){if(!this.settingSourceURL&&this.enabled&&this.isActive&&(this.reloadable||this.sourceURL!=this.currentURL)){let e=this.currentURL;if(this.currentURL=this.sourceURL,this.sourceURL)try{this.element.loaded=this.visit(b(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0}catch(t){throw this.currentURL=e,t}}}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let{body:i}=ls(t),r=new z(await this.extractForeignFrameElement(i)),n=new We(this.view.snapshot,r,!1,!1);this.view.renderPromise&&await this.view.renderPromise,await this.view.render(n),p.frameRendered(e,this.element),p.frameLoaded(this.element),this.fetchResponseLoaded(e)}}catch(t){console.error(t),this.view.invalidate()}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.loadSourceURL()}shouldInterceptLinkClick(e,t){return e.hasAttribute("data-turbo-method")?!1:this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.reloadable=!0,this.navigateFrame(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldInterceptNavigation(e,t)}formSubmissionIntercepted(e,t){this.formSubmission&&this.formSubmission.stop(),this.reloadable=!1,this.formSubmission=new j(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareHeadersForRequest(i.headers,i),this.formSubmission.start()}prepareHeadersForRequest(e,t){e["Turbo-Frame"]=this.id}requestStarted(e){De(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestFailedWithResponse(e,t){console.error(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){He(this.element)}formSubmissionStarted({formElement:e}){De(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){let i=this.findFrameElement(e.formElement,e.submitter);this.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t)}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t)}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){He(e,this.findFrameElement(e))}allowsImmediateRender(e,t){return!0}viewRenderedSnapshot(e,t){}viewInvalidated(){}async visit(e){var t;let i=new ie(this,g.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(r=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,r()},i.perform()})}navigateFrame(e,t,i){let r=this.findFrameElement(e,i);this.proposeVisitIfNavigatedWithAction(r,e,i),r.setAttribute("reload
17able",""),r.src=t}proposeVisitIfNavigatedWithAction(e,t,i){let r=we("data-turbo-action",i,t,e);if(ht(r)){let{visitCachedSnapshot:n}=new at(e);e.delegate.fetchResponseLoaded=o=>{if(e.src){let{statusCode:a,redirected:l}=o,m=e.ownerDocument.documentElement.outerHTML,E={statusCode:a,redirected:l,responseHTML:m};p.visit(e.src,{action:r,response:E,visitCachedSnapshot:n,willRender:!1})}}}}findFrameElement(e,t){var i;let r=we("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=ns(r))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=os(e.querySelector(`turbo-frame#${i}`),this.currentURL))return t;if(t=os(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.currentURL))return await t.loaded,await this.extractForeignFrameElement(t);console.error(`Response has no matching <turbo-frame id="${i}"> element`)}catch(r){console.error(r)}return new R}formActionIsVisitable(e,t){let i=ct(e,t);return te(b(i),this.rootLocation)}shouldInterceptNavigation(e,t){let i=we("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){let r=ns(i);if(r)return!r.disabled}return!(!p.elementDriveEnabled(e)||t&&!p.elementDriveEnabled(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}get reloadable(){return this.findFrameElement(this.element).hasAttribute("reloadable")}
17set reloadable(e){let t=this.findFrameElement(this.element);e?t.setAttribute("reloadable",""):t.removeAttribute("reloadable")}set sourceURL(e){this.settingSourceURL=!0,this.element.src=e??null,this.currentURL=this.element.src,this.settingSourceURL=!1}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t?.content)!==null&&e!==void 0?e:"/";return b(i)}},at=class{constructor(e){this.visitCachedSnapshot=({element:t})=>{var i;let{id:r,clone:n}=this;(i=t.querySelector("#"+r))===null||i===void 0||i.replaceWith(n)},this.clone=e.cloneNode(!0),this.id=e.id}};function ns(s){if(s!=null){let e=document.getElementById(s);if(e instanceof R)return e}}function os(s,e){if(s){let t=s.getAttribute("src");if(t!=null&&e!=null&&Us(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof R)return s.connectedCallback(),s.disconnectedCallback(),s}}var Ri={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})}},lt=class extends HTMLElement{async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{this.dispatchEvent(this.beforeRenderEvent)&&(await ye(),this.performAction())})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),i=[...(e=this.templateContent)===null||e===void 0?void 0:e.children].filter(r=>!!r.id).map(r=>r.id);return t.filter(r=>i.includes(r.id))}get performAction(){if(this.action){let e=Ri[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0})}get targetElementsById(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}};R.delegateConstructor=ot;customElements.define("turbo-frame",R);customElements.define("turbo-stream",lt);(()=>{let s=document.currentScript;if(!!s&&!s.hasAttribute("data-turbo-suppress-warning")){for(;s=s.parentElement;)if(s==document.body)return console.warn(cs` 18 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 19 20 Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 21 22 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 23 24 —— 25 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 26 `,s.outerHTML)}})();window.Turbo=xi;hs();var bs;async function Fi(){return bs||ps(Vi().then(ps))}function ps(s){return bs=s}async function Vi(){let{createConsumer:s}=await Promise.resolve().then(()=>(gs(),fs));return s()}async function vs(s,e){let{subscriptions:t}=await Fi();return t.create(s,e)}function he(s){return!s||typeof s!="object"||s instanceof Date||s instanceof RegExp?s:Array.isArray(s)?s.map(he):Object.keys(s).reduce(function(e,t){var i=t[0].toLowerCase()+t.slice(1).replace(/([A-Z]+)/g,function(r,n){return"_"+n.toLowerCase()});return e[i]=he(s[t]),e},{})}var Et=class extends HTMLElement{async connectedCallback(){dt(this),this.subscription=await vs(this.channel,{received:this.dispatchMessageEvent.bind(this)})}disconnectedCallback(){ut(this),this.subscription&&this.subscription.unsubscribe()}dispatchMessageEvent(e){let t=new MessageEvent("message",{data:e});return this.dispatchEvent(t)}get channel(){let e=this.getAttribute("channel"),t=this.getAttribute("signed-stream-name");return{channel:e,signed_stream_name:t,...he({...this.dataset})}}};customElements.define("turbo-cable-stream-source",Et);function ys({detail:{formSubmission:{fetchRequest:s,submitter:e}}}){e&&e.formMethod&&s.body.has("_method")&&s.body.set("_method",e.formMethod)}addEventListener("turbo:submit-start",ys);var St=class{constructor(e,t,i){this.eventTarget=e,this.eventName=t,this.eventOptions=i,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=Ni(e);for(let i of this.bindings){if(t.immediatePropagationStopped)break;i.handleEvent(t)}}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>
26{let i=e.index,r=t.index;return i<r?-1:i>r?1:0})}};function Ni(s){if("immediatePropagationStopped"in s)return s;{let{stopImmediatePropagation:e}=s;return Object.assign(s,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var At=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){this.fetchEventListenerForBinding(e).bindingDisconnected(e)}handleError(e,t,i={}){this.application.handleError(e,`Error ${t}`,i)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:i,eventOptions:r}=e;return this.fetchEventListener(t,i,r)}fetchEventListener(e,t,i){let r=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,i),o=r.get(n);return o||(o=this.createEventListener(e,t,i),r.set(n,o)),o}createEventListener(e,t,i){let r=new St(e,t,i);return this.started&&r.connect(),r}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let i=[e];return Object.keys(t).sort().forEach(r=>{i.push(`${t[r]?"":"!"}${r}`)}),i.join(":")}},Di=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function Hi(s){let t=s.trim().match(Di)||[];return{eventTarget:$i(t[4]),eventName:t[2],eventOptions:t[9]?qi(t[9]):{},identifier:t[5],methodName:t[7]}}function $i(s){if(s=="window")return window;if(s=="document")return document}function qi(s){return s.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function ji(s){if(s==window)return"window";if(s==document)return"document"}function Ss(s){return s.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Fe(s){return s.charAt(0).toUpperCase()+s.slice(1)}function As(s){return s.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Wi(s){return s.match(/[^\s]+/g)||[]}var Lt=class{constructor(e,t,i){this.element=e,this.index=t,this.eventTarget=i.eventTarget||e,this.eventName=i.eventName||_i(e)||Tt("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||Tt("missing identifier"),this.methodName=i.methodName||Tt("missing method name")}static forToken(e){return new this(e.element,e.index,Hi(e.content))}toString(){let e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}->${this.identifier}#${this.methodName}`}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`);for(let{name:i,value:r}of Array.from(this.element.attributes)){let n=i.match(t),o=n&&n[1];o&&(e[Ss(o)]=Ki(r))}return e}get eventTargetName(){return ji(this.eventTarget)}},ws={a:s=>"click",button:s=>"click",form:s=>"submit",details:s=>"toggle",input:s=>s.getAttribute("type")=="submit"?"click":"input",select:s=>"change",textarea:s=>"input"};function _i(s){let e=s.tagName.toLowerCase();if(e in ws)return ws[e](s)}function Tt(s){throw new Error(s)}function Ki(s){try{return JSON.parse(s)}catch{return s}}var Ct=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){this.willBeInvokedByEvent(e)&&this.shouldBeInvokedPerSelf(e)&&(this.processStopPropagation(e),this.processPreventDefault(e),this.invokeWithEvent(e))}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}"`)}processStopPropagation(e){this.eventOptions.stop&&e.stopPropagation()}processPreventDefault(e){this.eventOptions.prevent&&e.preventDefault()}invokeWithEvent(e){let{target:t,currentTarget:i}=e;try{let{params:r}=this.action,n=Object.assign(e,{params:r});this.method.call(this.controller,n),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:i,action:this.methodName})}catch(r){let{identifier:n,controller:o,element:a,index:l}=this,m={identifier:n,controller:o,element:a,index:l,event:e};this.context.handleError(r,`invoking action "${this.action}"`,m)}}
26shouldBeInvokedPerSelf(e){return this.action.eventOptions.self===!0?this.action.element===e.target:!0}willBeInvokedByEvent(e){let t=e.target;return 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}},Mt=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(i=>this.processMutations(i))}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){let i=e;this.elements.has(i)?this.delegate.elementAttributeChanged&&this.matchElement(i)?this.delegate.elementAttributeChanged(i,t):this.removeElement(i):this.matchElement(i)&&this.addElement(i)}processRemovedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.processTree(i,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let i=this.elementFromNode(t);i&&this.elementIsActive(i)&&this.processTree(i,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let i of this.matchElementsInTree(e))t.call(this,i)}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))}},xt=class{constructor(e,t,i){this.attributeName=t,this.delegate=i,this.elementObserver=new Mt(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]:[],i=Array.from(e.querySelectorAll(this.selector));return t.concat(i)}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)}},Rt=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}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 i=this.delegate.getStringMapKeyForAttribute(e);
26if(i!=null){this.stringMap.has(e)||this.stringMapKeyAdded(i,e);let r=this.element.getAttribute(e);if(this.stringMap.get(e)!=r&&this.stringMapValueChanged(r,i,t),r==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(i,e,n)}else this.stringMap.set(e,r)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,i){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,i)}stringMapKeyRemoved(e,t,i){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,i)}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())}};function Ui(s,e,t){Ls(s,e).add(t)}function zi(s,e,t){Ls(s,e).delete(t),Gi(s,e)}function Ls(s,e){let t=s.get(e);return t||(t=new Set,s.set(e,t)),t}function Gi(s,e){let t=s.get(e);t!=null&&t.size==0&&s.delete(e)}var de=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t.concat(Array.from(i)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,i)=>t+i.size,0)}add(e,t){Ui(this.valuesByKey,e,t)}delete(e,t){zi(this.valuesByKey,e,t)}has(e,t){let i=this.valuesByKey.get(e);return i!=null&&i.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(i=>i.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,i])=>i.has(e)).map(([t,i])=>t)}};var Be=class{constructor(e,t,i){this.attributeObserver=new xt(e,t,this),this.delegate=i,this.tokensByElement=new de}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,i]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(i)}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),i=this.readTokensForElement(e),r=Qi(t,i).findIndex(([n,o])=>!Yi(n,o));return r==-1?[[],[]]:[t.slice(r),i.slice(r)]}readTokensForElement(e){let t=this.attributeName,i=e.getAttribute(t)||"";return Ji(i,e,t)}};function Ji(s,e,t){return s.trim().split(/\s+/).filter(i=>i.length).map((i,r)=>({element:e,attributeName:t,content:i,index:r}))}function Qi(s,e){let t=Math.max(s.length,e.length);return Array.from({length:t},(i,r)=>[s[r],e[r]])}function Yi(s,e){return s&&e&&s.index==e.index&&s.content==e.content}var Pe=class{constructor(e,t,i){this.tokenListObserver=new Be(e,t,this),this.delegate=i,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:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).set(e,i),this.delegate.elementMatchedValue(t,i))}tokenUnmatched(e){let{element:t}=e,{value:i}=this.fetchParseResultForToken(e);i&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,i))}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}}}},Ot=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Pe(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}
26get 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 Ct(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)),this.bindingsByAction.clear()}parseValueForToken(e){let t=Lt.forToken(e);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},kt=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Rt(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 i=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,i.writer(this.receiver[e]),i.writer(i.defaultValue))}stringMapValueChanged(e,t,i){let r=this.valueDescriptorNameMap[t];e!==null&&(i===null&&(i=r.writer(r.defaultValue)),this.invokeChangedCallback(t,e,i))}stringMapKeyRemoved(e,t,i){let r=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,r.writer(this.receiver[e]),i):this.invokeChangedCallback(e,r.writer(r.defaultValue),i)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:i,writer:r}of this.valueDescriptors)i!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,r(i),void 0)}invokeChangedCallback(e,t,i){let r=`${e}Changed`,n=this.receiver[r];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=i;i&&(l=o.reader(i)),n.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError?new TypeError(`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 i=this.valueDescriptorMap[t];e[i.name]=i}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],i=`has${Fe(t.name)}`;return this.receiver[i]}},Bt=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new de}start(){this.tokenListObserver||(this.tokenListObserver=new Be(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 i;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var i;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(i=this.tokenListObserver)===null||i===void 0||i.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}},Pt=class{constructor(e,t){this.logDebugActivity=(i,r={})=>{let{identifier:n,controller:o,element:a}=this;r=Object.assign({identifier:n,controller:o,element:a},r),this.application.logDebugActivity(this.identifier,i,r)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new Ot(this,this.dispatcher),this.valueObserver=new kt(this,this.controller),this.targetObserver=new Bt(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(i){this.handleError(i,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}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}
26get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,i={}){let{identifier:r,controller:n,element:o}=this;i=Object.assign({identifier:r,controller:n,element:o},i),this.application.handleError(e,`Error ${t}`,i)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}invokeControllerMethod(e,...t){let i=this.controller;typeof i[e]=="function"&&i[e](...t)}};function Wt(s,e){let t=Cs(s);return Array.from(t.reduce((i,r)=>(Zi(r,e).forEach(n=>i.add(n)),i),new Set))}function Xi(s,e){return Cs(s).reduce((i,r)=>(i.push(...er(r,e)),i),[])}function Cs(s){let e=[];for(;s;)e.push(s),s=Object.getPrototypeOf(s);return e.reverse()}function Zi(s,e){let t=s[e];return Array.isArray(t)?t:[]}function er(s,e){let t=s[e];return t?Object.keys(t).map(i=>[i,t[i]]):[]}function tr(s){return sr(s,ir(s))}function sr(s,e){let t=ar(s),i=rr(s.prototype,e);return Object.defineProperties(t.prototype,i
26),t}function ir(s){return Wt(s,"blessings").reduce((t,i)=>{let r=i(s);for(let n in r){let o=t[n]||{};t[n]=Object.assign(o,r[n])}return t},{})}function rr(s,e){return or(e).reduce((t,i)=>{let r=nr(s,e,i);return r&&Object.assign(t,{[i]:r}),t},{})}function nr(s,e,t){let i=Object.getOwnPropertyDescriptor(s,t);if(!(i&&"value"in i)){let n=Object.getOwnPropertyDescriptor(e,t).value;return i&&(n.get=i.get||n.get,n.set=i.set||n.set),n}}var or=(()=>typeof Object.getOwnPropertySymbols=="function"?s=>[...Object.getOwnPropertyNames(s),...Object.getOwnPropertySymbols(s)]:Object.getOwnPropertyNames)(),ar=(()=>{function s(t){function i(){return Reflect.construct(t,arguments,new.target)}return i.prototype=Object.create(t.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,t),i}function e(){let i=s(function(){this.a.call(this)});return i.prototype.a=function(){},new i}try{return e(),s}catch{return i=>class extends i{}}})();function lr(s){return{identifier:s.identifier,controllerConstructor:tr(s.controllerConstructor)}}var Ft=class{constructor(e,t){this.application=e,this.definition=lr(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 Pt(this,e),this.contextsByScope.set(e,t)),t}},Vt=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 Wi(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},It=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 i=this.getAttributeNameForKey(e);return this.element.setAttribute(i,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}-${As(e)}`}},Nt=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,i){let r=this.warnedKeysByObject.get(e);r||(r=new Set,this.warnedKeysByObject.set(e,r)),r.has(t)||(r.add(t),this.logger.warn(i,e))}};function Dt(s,e){return`[${s}~="${e}"]`}var Ht=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,i)=>t||this.findTarget(i)||this.findLegacyTarget(i),void 0)}findAll(...e){return e.reduce((t,i)=>[...t,...this.findAllTargets(i),...this.findAllLegacyTargets(i)],[])}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 Dt(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(i=>this.deprecate(i,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return Dt(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:i}=this,r=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(i);this.guide.warn(e,`target:${t}`,`Please replace ${r}="${i}.${t}" with ${n}="${t}". The ${r} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},$t=class{constructor(e,t,i,r){this.targets=new Ht(this),this.classes=new Vt(this),this.data=new It(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=i,this.guide=new Nt(r)}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 Dt(this.schema.controllerAttribute,this.identifier)}},qt=class{constructor(e,t,i){this.element=e,this.schema=t,this.delegate=i,this.valueListObserver=new Pe(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:i}=e,r=this.fetchScopesByIdentifierForElement(t),n=r.get(i);return n||(n=this.delegate.createScopeForElementAndIdentifier(t,i),r.set(i,n)),n}elementMatchedValue(e,t){let i=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,i),i==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let i=this.scopeReferenceCounts.get(t);i&&(this.scopeReferenceCounts.set(t,i-1),i==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},jt=class{constructor(e){this.application=e,this.scopeObserver=new qt(this.element,this.schema,this),this.scopesByIdentifier=new de,this.modulesByIdentifier=new Map}
26get 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 Ft(this.application,e);this.connectModule(t)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let i=this.modulesByIdentifier.get(t);if(i)return i.contexts.find(r=>r.element==e)}handleError(e,t,i){this.application.handleError(e,t,i)}createScopeForElementAndIdentifier(e,t){return new $t(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(i=>e.connectContextForScope(i))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(i=>e.disconnectContextForScope(i))}},cr={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:s=>`data-${s}-target`},Q=class{constructor(e=document.documentElement,t=cr){this.logger=console,this.debug=!1,this.logDebugActivity=(i,r,n={})=>{this.debug&&this.logFormattedMessage(i,r,n)},this.element=e,this.schema=t,this.dispatcher=new At(this),this.router=new jt(this)}static start(e,t){let i=new Q(e,t);return i.start(),i}async start(){await hr(),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})}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(r=>{r.controllerConstructor.shouldLoad&&this.router.loadDefinition(r)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(r=>this.router.unloadIdentifier(r))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let i=this.router.getContextForElementAndIdentifier(e,t);return i?i.controller:null}handleError(e,t,i){var r;this.logger.error(`%s 27 28%o 29 30%o`,t,e,i),(r=window.onerror)===null||r===void 0||r.call(window,t,"",0,0,e)}logFormattedMessage(e,t,i={}){i=Object.assign({application:this},i),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},i)),this.logger.groupEnd()}};function hr(){return new Promise(s=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>s()):s()})}function dr(s){return Wt(s,"classes").reduce((t,i)=>Object.assign(t,ur(i)),{})}function ur(s){return{[`${s}Class`]:{get(){let{classes:e}=this;if(e.has(s))return e.get(s);{let t=e.getAttributeName(s);throw new Error(`Missing attribute "${t}"`)}}},[`${s}Classes`]:{get(){return this.classes.getAll(s)}},[`has${Fe(s)}Class`]:{get(){return this.classes.has(s)}}}}function mr(s){return Wt(s,"targets").reduce((t,i)=>Object.assign(t,fr(i)),{})}function fr(s){return{[`${s}Target`]:{get(){let e=this.targets.find(s);if(e)return e;throw new Error(`Missing target element "${s}" for "${this.identifier}" controller`)}},[`${s}Targets`]:{get(){return this.targets.findAll(s)}},[`has${Fe(s)}Target`]:{get(){return this.targets.has(s)}}}}function gr(s){let e=Xi(s,"values"),t={valueDescriptorMap:{get(){return e.reduce((i,r)=>{let n=Ms(r,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(i,{[o]:n})},{})}}};return e.reduce((i,r)=>Object.assign(i,pr(r)),t)}function pr(s,e){let t=Ms(s,e),{key:i,name:r,reader:n,writer:o}=t;return{[r]:{get(){let a=this.data.get(i);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(i):this.data.set(i,o(a))}},[`has${Fe(r)}
30`]:{get(){return this.data.has(i)||t.hasCustomDefaultValue}}}}function Ms([s,e],t){return wr({controller:t,token:s,typeDefinition:e})}function _t(s){switch(s){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function ue(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(s))return"array";if(Object.prototype.toString.call(s)==="[object Object]")return"object"}function br(s){let e=_t(s.typeObject.type);if(!e)return;let t=ue(s.typeObject.default);if(e!==t){let i=s.controller?`${s.controller}.${s.token}`:s.token;throw new Error(`The specified default value for the Stimulus Value "${i}" must match the defined type "${e}". The provided default value of "${s.typeObject.default}" is of type "${t}".`)}return e}function vr(s){let e=br({controller:s.controller,token:s.token,typeObject:s.typeDefinition}),t=ue(s.typeDefinition),i=_t(s.typeDefinition),r=e||t||i;if(r)return r;let n=s.controller?`${s.controller}.${s.typeDefinition}`:s.token;throw new Error(`Unknown value type "${n}" for "${s.token}" value`)}function yr(s){let e=_t(s);if(e)return Er[e];let t=s.default;return t!==void 0?t:s}function wr(s){let e=`${As(s.token)}-value`,t=vr(s);return{type:t,key:e,name:Ss(e),get defaultValue(){return yr(s.typeDefinition)},get hasCustomDefaultValue(){return ue(s.typeDefinition)!==void 0},reader:Tr[t],writer:Es[t]||Es.default}}var Er={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Tr={array(s){let e=JSON.parse(s);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${s}" of type "${ue(e)}"`);return e},boolean(s){return!(s=="0"||String(s).toLowerCase()=="false")},number(s){return Number(s)},object(s){let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${s}" of type "${ue(e)}"`);return e},string(s){return s}},Es={default:Sr,array:Ts,object:Ts};function Ts(s){return JSON.stringify(s)}function Sr(s){return`${s}`}var f=class{constructor(e){this.context=e}static get shouldLoad(){return!0}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 classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:i={},prefix:r=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=r?`${r}:${e}`:e,l=new CustomEvent(a,{detail:i,bubbles:n,cancelable:o});return t.dispatchEvent(l),l}};f.blessings=[dr,mr,gr];f.targets=[];f.values={};var K=Q.start();K.debug=!1;window.Stimulus=K;var Kt=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Ut(s,e,t,i){s.addEventListener?s.addEventListener(e,t,i):s.attachEvent&&s.attachEvent("on".concat(e),function(){t(window.event)})}function Bs(s,e){for(var t=e.slice(0,e.length-1),i=0;i<t.length;i++)t[i]=s[t[i].toLowerCase()];return t}function Ps(s){typeof s!="string"&&(s=""),s=s.replace(/\s/g,"");for(var e=s.split(","),t=e.lastIndexOf("");t>=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function Ar(s,e){for(var t=s.length>=e.length?s:e,i=s.length>=e.length?e:s,r=!0,n=0;n<t.length;n++)i.indexOf(t[n])===-1&&(r=!1);return r}var Qt={backspace:8,"\u232B":8,tab:9,clear:12,enter:13,"\u21A9":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21EA":20,",":188,".":190,"/":191,"`":192,"-":Kt?173:189,"=":Kt?61:187,";":Kt?59:186,"'":222,"[":219,"]":221,"\\":220},D={"\u21E7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91}
30,Jt={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},u={16:!1,18:!1,17:!1,91:!1},d={};for(me=1;me<20;me++)Qt["f".concat(me)]=111+me;var me,h=[],xs=!1,Fs="all",Vs=[],Ie=function(e){return Qt[e.toLowerCase()]||D[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function Is(s){Fs=s||"all"}function fe(){return Fs||"all"}function Lr(){return h.slice(0)}function Cr(s){var e=s.target||s.srcElement,t=e.tagName,i=!0;return(e.isContentEditable||(t==="INPUT"||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(i=!1),i}function Mr(s){return typeof s=="string"&&(s=Ie(s)),h.indexOf(s)!==-1}function xr(s,e){var t,i;s||(s=fe());for(var r in d)if(Object.prototype.hasOwnProperty.call(d,r))for(t=d[r],i=0;i<t.length;)t[i].scope===s?t.splice(i,1):i++;fe()===s&&Is(e||"all")}function Rr(s){var e=s.keyCode||s.which||s.charCode,t=h.indexOf(e);if(t>=0&&h.splice(t,1),s.key&&s.key.toLowerCase()==="meta"&&h.splice(0,h.length),(e===93||e===224)&&(e=91),e in u){u[e]=!1;for(var i in D)D[i]===e&&(B[i]=!1)}}function Or(s){if(typeof s>"u")Object.keys(d).forEach(function(o){return delete d[o]});else if(Array.isArray(s))s.forEach(function(o){o.key&&zt(o)});else if(typeof s=="object")s.key&&zt(s);else if(typeof s=="string"){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];var r=t[0],n=t[1];typeof r=="function"&&(n=r,r=""),zt({key:s,scope:r,method:n,splitKey:"+"})}}var zt=function(e){var t=e.key,i=e.scope,r=e.method,n=e.splitKey,o=n===void 0?"+":n,a=Ps(t);a.forEach(function(l){var m=l.split(o),E=m.length,y=m[E-1],S=y==="*"?"*":Ie(y);if(!!d[S]){i||(i=fe());var ee=E>1?Bs(D,m):[];d[S]=d[S].filter(function(O){var H=r?O.method===r:!0;return!(H&&O.scope===i&&Ar(O.mods,ee))})}})};function Rs(s,e,t,i){if(e.element===i){var r;if(e.scope===t||e.scope==="all"){r=e.mods.length>0;for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(!u[n]&&e.mods.indexOf(+n)>-1||u[n]&&e.mods.indexOf(+n)===-1)&&(r=!1);(e.mods.length===0&&!u[16]&&!u[18]&&!u[17]&&!u[91]||r||e.shortcut==="*")&&e.method(s,e)===!1&&(s.preventDefault?s.preventDefault():s.returnValue=!1,s.stopPropagation&&s.stopPropagation(),s.cancelBubble&&(s.cancelBubble=!0))}}}function Os(s,e){var t=d["*"],i=s.keyCode||s.which||s.charCode;if(!!B.filter.call(this,s)){if((i===93||i===224)&&(i=91),h.indexOf(i)===-1&&i!==229&&h.push(i),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(O){var H=Jt[O];s[O]&&h.indexOf(H)===-1?h.push(H):!s[O]&&h.indexOf(H)>-1?h.splice(h.indexOf(H),1):O==="metaKey"&&s[O]&&h.length===3&&(s.ctrlKey||s.shiftKey||s.altKey||(h=h.slice(h.indexOf(H))))}),i in u){u[i]=!0;for(var r in D)D[r]===i&&(B[r]=!0);if(!t)return}for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(u[n]=s[Jt[n]]);s.getModifierState&&!(s.altKey&&!s.ctrlKey)&&s.getModifierState("AltGraph")&&(h.indexOf(17)===-1&&h.push(17),h.indexOf(18)===-1&&h.push(18),u[17]=!0,u[18]=!0);var o=fe();if(t)for(var a=0;a<t.length;a++)t[a].scope===o&&(s.type==="keydown"&&t[a].keydown||s.type==="keyup"&&t[a].keyup)&&Rs(s,t[a],o,e);if(i in d){for(var l=0;l<d[i].length;l++)if((s.type==="keydown"&&d[i][l].keydown||s.type==="keyup"&&d[i][l].keyup)&&d[i][l].key){for(var m=d[i][l],E=m.splitKey,y=m.key.split(E),S=[],ee=0;ee<y.length;ee++)S.push(Ie(y[ee]));S.sort().join("")===h.sort().join("")&&Rs(s,m,o,e)}}}}function kr(s){return Vs.indexOf(s)>-1}function B(s,e,t){h=[];var i=Ps(s),r=[],n="all",o=document,a=0,l=!1,m=!0,E="+",y=!1;for(t===void 0&&typeof e=="function"&&(t=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(n=e.scope),e.element&&(o=e.element),e.keyup&&(l=e.keyup),e.keydown!==void 0&&(m=e.keydown),e.capture!==void 0&&(y=e.capture),typeof e.splitKey=="string"&&(E=e.splitKey)),typeof e=="string"&&(n=e);a<i.length;a++)s=i[a].split(E),r=[],s.length>1&&(r=Bs(D,s)),s=s[s.length-1],s=s==="*"?"*":Ie(s),s in d||(d[s]=[]),d[s].push({keyup:l,keydown:m,scope:n,mods:r,shortcut:i[a],method:t,key:i[a],splitKey:E,element:o});typeof o<"u"&&!kr(o)&&window&&(Vs.push(o),Ut(o,"keydown",function(S){Os(S,o)},y),xs||(xs=!0,Ut(window,"focus",function(){h=[]},y)),Ut(o,"keyup",function(S){Os(S,o),Rr(S)},y))}function Br(s){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";
30Object.keys(d).forEach(function(t){var i=d[t].find(function(r){return r.scope===e&&r.shortcut===s});i&&i.method&&i.method()})}var Gt={setScope:Is,getScope:fe,deleteScope:xr,getPressedKeyCodes:Lr,isPressed:Mr,filter:Cr,trigger:Br,unbind:Or,keyMap:Qt,modifier:D,modifierMap:Jt};for(Ve in Gt)Object.prototype.hasOwnProperty.call(Gt,Ve)&&(B[Ve]=Gt[Ve]);var Ve;typeof window<"u"&&(ks=window.hotkeys,B.noConflict=function(s){return s&&window.hotkeys===B&&(window.hotkeys=ks),B},window.hotkeys=B);var ks;var Pr=(s,e)=>{let t=s[e];return typeof t=="function"?t:(...i)=>{}};var Y=s=>{let e=n=>{let{innerWidth:o,innerHeight:a}=window,l={height:a||1/0,width:o||1/0,event:n};Pr(s,"windowResize").call(s,l)},t=s.disconnect.bind(s),i=()=>{window.addEventListener("resize",e),e()},r=()=>{window.removeEventListener("resize",e)};return Object.assign(s,{disconnect(){r(),t()}}),i(),[i,r]};var Yt=class extends f{};Yt.debounces=[];var Xt=class extends f{};Xt.throttles=[];var ge=class extends f{connect(){Y(this),this.footerYearTarget.innerHTML=new Date().getFullYear()}windowResize(){let s=this.footerWrapperTarget.offsetHeight-1;document.body.style.paddingBottom=`${s}px`}};M(ge,"targets",["footerYear","footerWrapper"]);async function w(s,e=null){s.classList.remove("hidden"),await Ns("enter",s,e)}async function T(s,e=null){await Ns("leave",s,e),s.classList.add("hidden")}async function Ns(s,e,t){let i=e.dataset,r=t?`${t}-${s}`:s,n=`transition${s.charAt(0).toUpperCase()+s.slice(1)}`,o=i[n]?i[n].split(" "):[r],a=i[`${n}Start`]?i[`${n}Start`].split(" "):[`${r}-start`],l=i[`${n}End`]?i[`${n}End`].split(" "):[`${r}-end`];Zt(e,o),Zt(e,a),await Fr(),es(e,a),Zt(e,l),await Vr(e),es(e,l),es(e,o)}function Zt(s,e){s.classList.add(...e)}function es(s,e){s.classList.remove(...e)}function Fr(){return new Promise(s=>{requestAnimationFrame(()=>{requestAnimationFrame(s)})})}function Vr(s){return new Promise(e=>{let t=getComputedStyle(s).transitionDuration.split(",")[0],i=Number(t.replace("s",""))*1e3;setTimeout(()=>{e()},i)})}var pe=(s,e,t)=>{let i=document.head.querySelector("meta[name=csrf-token]")?.content;fetch("/api/searchable_authors",{method:"GET",headers:{"Content-Type":"application/json","X-CSRF-Token":i}}).then(r=>{if(!r.ok)throw new Error(`HTTP error! Status: ${r.status}`);return r.json()}).then(r=>{let n=r.searchable_authors??[],o=s.querySelector(e);return o.innerHTML="",n.forEach(a=>{let l=document.createElement("option");l.value=a.slug,l.text=a.name,o.appendChild(l)}),n.length>0?n[0].slug:""}).then(r=>{let n=s.querySelector(t);n.href=`/authors/${r}`}).catch(r=>{console.error("Error communicating with Rails:",r)})};var X=class extends f{connect(){Y(this),this.windowHeightValue=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}onHeaderOverlayHandler(){this.openEventsValue||this.openAllSectionsValue?this.headerOverlayGeneralTarget.style.top=`${this.headerWrapperTarget.offsetHeight}px`:this.headerOverlayGeneralTarget.style.top=`${this.headerTopTarget.offsetHeight}px`,this.openAllSectionsValue&&(this.dropdownMenuAllSectionsTarget.style.top=`${this.headerWrapperTarget.offsetHeight-5.5}px`)}onScrollHeaderHandler(s){s?(this.headerLogoTarget.classList.remove("2xl:order-2","2xl:mr-0","2xl:absolute","2xl:left-1/2","2xl:transform","2xl:-translate-x-1/2"),this.hasMalaysiaLogoTarget?this.headerLogoTarget.children[1].classList.remove("2xl:w-[342px]","2xl:h-[30px]"):this.headerLogoTarget.children[1].classList.remove("2xl:w-[450px]","2xl:h-[27px]"),this.headerTopWrapperTarget.classList.remove("2xl:py-4","2xl:justify-between"),this.headerRegionTarget.classList.remove("2xl:order-1"),this.headerRightNavTarget.classList.remove("2xl:order-3","2xl:ml-0"),this.headerWrapperTarget.classList.add("drop-shadow-xl")):(this.headerLogoTarget.classList.add("2xl:order-2","2xl:mr-0","2xl:absolute","2xl:left-1/2","2xl:transform","2xl:-translate-x-1/2"),this.hasMalaysiaLogoTarget?this.headerLogoTarget.children[1].classList.add("2xl:w-[342px]","2xl:h-[30px]"):this.headerLogoTarget.children[1].classList.add("2xl:w-[450px]","2xl:h-[27px]"),this.headerTopWrapperTarget.classList.add("2xl:py-4","2xl:justify-between"),this.headerRegionTarget.classList.add("2xl:order-1"),this.headerRightNavTarget.classList.add("2xl:order-3","2xl:ml-0"),this.headerWrapperTarget.classList.remove("drop-shadow-xl")),this.onHeaderOverlayHandler()}onToggleHandle(){let s=[...this.headerLogoTarget.children];this.hasMalaysiaLogoTarget||(this.headerTopTarget.classList.toggle("bg-primary-500"),this.headerTopTarget.classList.toggle("text-white"),this.headerLogoTarget.classList.toggle("text-white"),s.forEac
30h(e=>e.classList.toggle("text-white")),this.headerChangeRegionButtonTarget.classList.toggle("lg:hover:bg-primary-650"),this.headerSearchButtonTarget.classList.toggle("lg:hover:bg-primary-650"),this.headerMenuButtonTarget.classList.toggle("lg:hover:bg-primary-650"))}initialize(){this.onScrollHeaderHandler(this.windowHeightValue>80)}windowResize({width:s}){s<1024&&this.openEventsValue&&(this.openEventsValue=!1,this.dropdownEventsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownEventsButtonTarget.classList.remove("text-primary-650"),this.dropdownEventsButtonSpanTarget.classList.remove("rotate-180"),this.onToggleHandle()),s<1536&&this.openAllSectionsValue&&(this.openAllSectionsValue=!1,this.dropdownAllSectionsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownAllSectionsButtonTarget.classList.remove("text-primary-650"),this.dropdownAllSectionsButtonSpanTarget.classList.remove("rotate-180"),this.onToggleHandle()),s>1536&&this.openMobileTabletValue&&this.headerOverlayGeneralTarget.classList.add("hidden"),this.onHeaderOverlayHandler(),this.mobileTabletMenuTarget.style.top=`${this.headerTopTarget.offsetHeight}px`,this.mobileTabletMenuTarget.style.height=`calc(100vh - ${this.headerTopTarget.offsetHeight}px)`,this.mobileTabletCloseButtonTarget.style.height=`${this.headerTopTarget.offsetHeight}px`,this.mobileTabletCloseButtonTarget.style.top=`-${this.headerTopTarget.offsetHeight}px`}checkOnScroll(){this.windowHeightValue=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop}openSearchModal(){this.openSearchModalValue=!0}toggleEventsButton(s){this.openEventsValue=!this.openEventsValue,s.currentTarget.setAttribute("aria-expanded",!this.openEventsValue),s.currentTarget.classList.toggle("text-primary-650"),this.dropdownEventsButtonSpanTarget.classList.toggle("rotate-180"),this.headerOverlayGeneralTarget.style.top=`${this.headerWrapperTarget.offsetHeight}px`,this.onToggleHandle()}clickOutsideEvents(s){!this.dropdownContainerEventsTarget.contains(s.target)&&this.openEventsValue&&(this.openEventsValue=!1,this.dropdownEventsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownEventsButtonTarget.classList.remove("text-primary-650"),this.dropdownEventsButtonSpanTarget.classList.remove("rotate-180"),this.onToggleHandle())}resetOutsideEvents(s){s.key==="Escape"&&(this.dropdownEventsButtonTarget.focus(),this.openEventsValue=!1,this.dropdownEventsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownEventsButtonTarget.classList.remove("text-primary-650"),this.dropdownEventsButtonSpanTarget.classList.remove("rotate-180"),this.headerTopTarget.classList.remove("bg-primary-500"),this.headerTopTarget.classList.remove("text-white"),this.headerLogoTarget.classList.remove("text-white"),this.headerChangeRegionButtonTarget.classList.remove("lg:hover:bg-primary-650"),this.headerSearchButtonTarget.classList.remove("lg:hover:bg-primary-650"),this.headerMenuButtonTarget.classList.remove("lg:hover:bg-primary-650"))}tabEvents(s){(!this.dropdownContainerEventsTarget.contains(s.relatedTarget)||s.relatedTarget.tagName==="BUTTON")&&(this.openEventsValue=!1,this.dropdownEventsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownEventsButtonTarget.classList.remove("text-primary-650"),this.dropdownEventsButtonSpanTarget.classList.remove("rotate-180"),this.onToggleHandle())}toggleAllSectionsButton(s){this.openAllSectionsValue=!this.openAllSectionsValue,s.currentTarget.setAttribute("aria-expanded",!this.openAllSectionsValue),s.currentTarget.classList.toggle("text-primary-650"),this.dropdownAllSectionsButtonSpanTarget.classList.toggle("rotate-180"),this.dropdownMenuAllSectionsTarget.style.top=`${this.headerWrapperTarget.offsetHeight-5.5}px`,this.headerOverlayGeneralTarget.style.top=`${this.headerWrapperTarget.offsetHeight}px`,this.onToggleHandle()}clickOutsideAllSections(s){!this.dropdownContainerAllSectionsTarget.contains(s.target)&&this.openAllSectionsValue&&(this.openAllSectionsValue=!1,this.dropdownAllSectionsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownAllSectionsButtonTarget.classList.remove("text-primary-650"),this.dropdownAllSectionsButtonSpanTarget.classList.remove("rotate-180"),this.onToggleHandle())}resetOutsideAllSections(s){s.key==="Escape"&&(this.dropdownAllSectionsButtonTarget.focu
30s(),this.openAllSectionsValue=!1,this.dropdownAllSectionsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownAllSectionsButtonTarget.classList.remove("text-primary-650"),this.dropdownAllSectionsButtonSpanTarget.classList.remove("rotate-180"),this.headerTopTarget.classList.remove("bg-primary-500"),this.headerTopTarget.classList.remove("text-white"),this.headerLogoTarget.classList.remove("text-white"),this.headerChangeRegionButtonTarget.classList.remove("lg:hover:bg-primary-650"),this.headerSearchButtonTarget.classList.remove("lg:hover:bg-primary-650"),this.headerMenuButtonTarget.classList.remove("lg:hover:bg-primary-650"))}tabAllSections(s){(!this.dropdownContainerAllSectionsTarget.contains(s.relatedTarget)||s.relatedTarget.tagName==="BUTTON")&&(this.openAllSectionsValue=!1,this.dropdownAllSectionsButtonTarget.setAttribute("aria-expanded",!1),this.dropdownAllSectionsButtonTarget.classList.remove("text-primary-650"),this.dropdownAllSectionsButtonSpanTarget.classList.remove("rotate-180"),this.onToggleHandle())}toggleRegionsButton(s){s.currentTarget.setAttribute("aria-expanded",!this.openRegionsValue),s.currentTarget.classList.toggle("bg-grey-200"),this.dropdownRegionsChangeButtonSpanTarget.classList.toggle("rotate-180"),this.openRegionsValue=!this.openRegionsValue,this.headerOverlayGeneralTarget.style.top=`${this.headerTopTarget.offsetHeight}px`,this.headerOverlayGeneralTarget.classList.add("z-40")}changeForm(s){s.currentTarget.checked?(this.searchModalContentFormTarget.classList.remove("flex","visible"),this.searchModalContentFormTarget.classList.add("hidden","invisible"),this.searchModalAuthorFormTarget.classList.add("flex","visible"),this.searchModalAuthorFormTarget.classList.remove("hidden","invisible"),this.searchInputTargets[0].value="",pe(this.searchModalAuthorFormTarget,"#site-search-by-author","#site-search-by-author-link")):(this.searchModalContentFormTarget.classList.add("flex","visible"),this.searchModalContentFormTarget.classList.remove("hidden","invisible"),this.searchModalAuthorFormTarget.classList.remove("flex","visible"),this.searchModalAuthorFormTarget.classList.add("hidden","invisible"))}changeFormMobile(s){s.currentTarget.checked?(this.searchModalContentFormMobileTarget.classList.remove("flex","visible"),this.searchModalContentFormMobileTarget.classList.add("hidden","invisible"),this.searchModalAuthorFormMobileTarget.classList.add("flex","visible"),this.searchModalAuthorFormMobileTarget.classList.remove("hidden","invisible"),pe(this.searchModalAuthorFormMobileTarget,"#site-search-by-author-mobile","#site-search-by-author-mobile-link")):(this.searchModalContentFormMobileTarget.classList.add("flex","visible"),this.searchModalContentFormMobileTarget.classList.remove("hidden","invisible"),this.searchModalAuthorFormMobileTarget.classList.remove("flex","visible"),this.searchModalAuthorFormMobileTarget.classList.add("hidden","invisible"))}clickOutsideRegions(s){!this.dropdownContainerRegionsTarget.contains(s.target)&&this.openRegionsValue&&(this.openRegionsValue=!1,this.headerChangeRegionButtonTarget.setAttribute("aria-expanded",!1),this.headerChangeRegionButtonTarget.classList.toggle("bg-grey-200"),this.dropdownRegionsChangeButtonSpanTarget.classList.remove("rotate-180"),this.openMobileTabletValue||setTimeout(()=>{this.headerOverlayGeneralTarget.classList.remove("z-40")},100))}resetOutsideRegions(s){s.key==="Escape"&&(this.openRegionsValue=!1,this.headerChangeRegionButtonTarget.focus(),this.headerChangeRegionButtonTarget.setAttribute("aria-expanded",!1),this.dropdownRegionsChangeButtonSpanTarget.classList.remove("rotate-180"))}tabRegions(s){(!this.dropdownContainerRegionsTarget.contains(s.relatedTarget)||s.relatedTarget.tagName==="BUTTON")&&(this.openRegionsValue=!1,this.headerChangeRegionButtonTarget.setAttribute("aria-expanded",!1),this.headerChangeRegionButtonTarget.classList.toggle("bg-grey-200"),this.dropdownRegionsChangeButtonSpanTarget.classList.remove("rotate-180"))}openMobileMenuButton(s){s.currentTarget.setAttribute("aria-expanded",!this.openMobileTabletValue),s.currentTarget.disabled=!this.openMobileTabletValue,this.openMobileTabletValue=!this.openMobileTabletValue,this.headerOverlayGeneralTarget.style.top=`${this.headerTopTarget.offsetHeight}px`,this.headerOverlayGeneralTarget.classList.add("z-40"),this.mobileTabletMenuTarget.style.top=`${this.headerTopTarget.offsetHeight}px`,this.mobileTabletMenuTarget.style.height=`calc(100vh - ${this.headerTopTarget.offsetHeight}px)`,this.mobileTabletCloseButtonTarget.style.height=`${this.headerTopTarget.offsetHeight}px`,this.mobileTabletCloseButtonTarget.style.top=`-${this.headerTopTarget.offsetHeight}px`}toggleMobileRegionsButton(s){s.currentTarget.setAttribute("aria-expanded",!this.openMobileRegionsValue),s.currentTarget.classList.toggle("bg-primary-650"),this.openMobileRegionsValue=!this.openMobileRegionsValue}closeMobileTabletMenu(){this.headerMenuButtonTarget.setAttribute("aria-expanded",!1),this.headerMenuButtonTarget.disabled=!1,this.openMobileTabletValue=!1}clickOutsideSearchModal(s){!this.searchModalTarget.contains(s.target)&&!this.headerSearchButtonTarget.contains(s.target)&&this.openSearchModalValue&&(this.openSearchModalValue=!1)}clickOutsideMobileRegions(s){!this.dropdownContainerMobileRegionsTarget.contains(s.target)&&this.openMobileRegionsValue&&(this.openMobileRegionsValue=!1,this.mobileTabletRegionsButtonTarget.setAttribute("aria-expanded",!1),this.mobileTabletRegionsButtonTarget.classList.toggle("bg-primary-650"))}clickOutsideMobileTablet(s){!this.mobileTabletMenuTarget.contains(s.target)&&!this.headerMenuButtonTarget.contains(s.target)&&this.openMobileTabletValue&&(this.openMobileTabletValue=!1,this.headerMenuButtonTarget.disabled=!1,this.openRegionsValue||setTimeout(()=>{this.headerOverlayGeneralTarget.classList.remove("z-40")},100))}resetOutsideMobileRegions(s){s.key==="Escape"&&(this.mobileTabletRegionsButtonTarget.focu
30s(),this.openMobileRegionsValue=!1,this.mobileTabletRegionsButtonTarget.setAttribute("aria-expanded",!1),this.mobileTabletRegionsButtonTarget.classList.toggle("bg-primary-650"))}resetSearchModal(s){s.key==="Escape"&&(this.headerSearchButtonTarget.focus(),this.openSearchModalValue=!1,this.searchModalTarget.setAttribute("aria-hidden",!0))}tabMobileRegions(s){(!this.dropdownContainerMobileRegionsTarget.contains(s.relatedTarget)||s.relatedTarget.tagName==="INPUT")&&(this.openMobileRegionsValue=!1,this.mobileTabletRegionsButtonTarget.setAttribute("aria-expanded",!1),this.mobileTabletRegionsButtonTarget.classList.toggle("bg-primary-650"))}openEventsValueChanged(){this.openEventsValue?(w(this.dropdownMenuEventsTarget),!this.openAllSectionsValue&&!this.openRegionsValue&&!this.openMobileTabletValue&&w(this.headerOverlayGeneralTarget)):(T(this.dropdownMenuEventsTarget),!this.openAllSectionsValue&&!this.openRegionsValue&&!this.openMobileTabletValue&&T(this.headerOverlayGeneralTarget))}openAllSectionsValueChanged(){this.openAllSectionsValue?(w(this.dropdownMenuAllSectionsTarget),!this.openEventsValue&&!this.openRegionsValue&&!this.openMobileTabletValue&&w(this.headerOverlayGeneralTarget),w(this.headerOverlayGeneralTarget)):(T(this.dropdownMenuAllSectionsTarget),!this.openEventsValue&&!this.openRegionsValue&&!this.openMobileTabletValue&&T(this.headerOverlayGeneralTarget))}openRegionsValueChanged(){this.openRegionsValue?(w(this.dropdownMenuRegionsTarget),!this.openAllSectionsValue&&!this.openEventsValue&&!this.openMobileTabletValue&&w(this.headerOverlayGeneralTarget)):(T(this.dropdownMenuRegionsTarget),!this.openAllSectionsValue&&!this.openEventsValue&&!this.openMobileTabletValue&&T(this.headerOverlayGeneralTarget))}openMobileRegionsValueChanged(){this.openMobileRegionsValue?w(this.mobileDropdownMenuRegionsTarget):T(this.mobileDropdownMenuRegionsTarget)}openMobileTabletValueChanged(){this.openMobileTabletValue?(document.body.style.overflow="hidden",w(this.mobileTabletMenuTarget),!this.openAllSectionsValue&&!this.openEventsValue&&!this.openRegionsValue&&w(this.headerOverlayGeneralTarget)):(document.body.style.overflow="auto",this.headerOverlayGeneralTarget.classList.remove("z-40"),T(this.mobileTabletMenuTarget),!this.openAllSectionsValue&&!this.openEventsValue&&!this.openRegionsValue&&T(this.headerOverlayGeneralTarget))}openSearchModalValueChanged(){this.openSearchModalValue?(document.body.style.overflow="hidden",this.searchModalTarget.setAttribute("aria-hidden",!1),w(this.headerOverlaySearchModalTarget),w(this.searchModalTarget)):(document.body.style.overflow="auto",this.searchInputTargets.map(s=>s.value=""),this.searchModalTarget.setAttribute("aria-hidden",!0),T(this.headerOverlaySearchModalTarget),T(this.searchModalTarget))}windowHeightValueChanged(){this.onScrollHeaderHandler(this.windowHeightValue>80)}};M(X,"targets",["headerOverlayGeneral","headerWrapper","dropdownContainerEvents","dropdownContainerAllSections","dropdownContainerRegions","dropdownEventsButton","dropdownEventsButtonSpan","dropdownAllSectionsButton","dropdownAllSectionsButtonSpan","dropdownMenuEvents","dropdownMenuAllSections","headerTop","headerLogo","headerChangeRegionButton","headerSearchButton","headerMenuButton","dropdownMenuRegions","dropdownRegionsChangeButtonSpan","mobileTabletMenu","mobileTabletCloseButton","mobileTabletRegionsButton","mobileDropdownMenuRegions","dropdownContainerMobileRegions","headerRegion","headerTopWrapper","headerRightNav","headerOverlaySearchModal","searchModal","searchInput","malaysiaLogo","searchModalContentForm","searchModalAuthorForm","searchModalContentFormMobile","searchModalAuthorFormMobile"]),M(X,"values",{openMobileTablet:Boolean,openEvents:Boolean,openAllSections:Boolean,openRegions:Boolean,openMobileRegions:Boolean,openSearchModal:Boolean,windowHeight:Number});var Z=class extends f{connect(){Y(this)}onMobileMenuResizeHandler(s,e){e<768?s.forEach(t=>{t.setAttribute("role","button"),t.nextElementSibling.classList.contains("visible")?(t.setAttribute("aria-expanded",!0),t.nextElementSibling.setAttribute("aria-hidden",!1)):(t.setAttribute("aria-expanded",!1),t.nextElementSibling.setAttribute("aria-hidden",!0))}):s.forEach(t=>{t.removeAttribute("role"),t.setAttribute("aria-expanded",!0),t.nextElementSibling.setAttribute("aria-hidden",!1)})}windowResize({width:s}){if(this.onMobileMenuResizeHandler(this.mobileTabletFooterTargets,s),this.onMobileMenuResizeHandler(this.mobileTabletHeaderTargets,s),this.hasMainContainerTarget){let e=this.mainContainerTarget.offsetWidth;if(s-e>400){let t=(Math.floor((s-e)/2)-250)/2;this.hasFullSkinBannerLeftTarget&&this.hasFullSkinBannerRightTarget&&(this.fullSkinBannerLeftTarget.style.display="block",this.fullSkinBannerLeftTarget.style.visibility="visible",this.fullSkinBannerRightTarget.style.display="block",this.fullSkinBannerRightTarget.style.visibility="visible",this.fullSkinBannerLeftTarget.style.left=`${t}px`,this.fullSkinBannerRightTarget.style.right=`${t}px`)}else this.hasFullSkinBannerLeftTarget&&this.hasFullSkinBannerRightTarget&&(this.fullSkinBannerLeftTarget.style.display="none",this.fullSkinBannerLeftTarget.style.visibility="hidden",this.fullSkinBannerRightTarget.style.display="none",this.fullSkinBannerRightTarget.style.visibility="hidden")}}openMobileMenu({target:s}){let e=s.getAttribute("aria-expanded");window.innerWidth>768||(s.nextElementSibling.classList.toggle("invisible"),s.nextElementSibling.classList.toggle("hidden"),s.nextElementSibling.classList.toggle("visible"),s.firstElementChild.classList.toggle("rotate-180"),e==="false"?(s.setAttribute("aria-expanded",!0),s.nextElementSibling.setAttribute("aria-hidden",!1)):(s.setAttribute("aria-expanded",!1),s.nextElementSibling.setAttribute("aria-hidden",!0)))}updateBodyPadding(){if(window.innerWidth>768)return;let s=this.footerWrapperTarget.offsetHeight-1;document.body.style.paddingBottom=`${s}px`}toggleShareSocial(s){let e=s.currentTarget.getAttribute("aria-expanded");this.openShareSocialValue=s.params.id,this.openShareSocialDropdownValue=s.currentTarget.nextSibling.nextSibling.dataset.mainIdParam,s.currentTarget.nextElementSibling.classList.toggle("hidden"),s.currentTarget.classList.toggle("bg-grey-50"),e==="false"?(s.currentTarget.setAttribute("aria-expanded",!0),s.currentTarget.nextElementSibling.setAttribute("aria-hidden",!1)):(s.currentTarget.setAttribute("aria-expanded",!1),s.currentTarget.nextElementSibling.setAttribute("aria-hidden",!0))}closeShareSocial(s,e){s.setAttribute("aria-expanded",!1),s.classList.remove("bg-grey-50"),e.classList.add("hidden"),e.setAttribute("aria-hidden",!0),this.openShareSocialValue="",this.openShareSocialDropdownValue=""}clickOutsideShareSocial(s){let e=this.shareSocialbuttonTargets.find(i=>i.dataset.mainIdParam===this.openShareSocialValue)??!1,t=this.dropdownShareSocialTargets.find(i=>i.dataset.mainIdParam===this.openShareSocialDropdownValue)??!1;s&&(this.dropdownShareSocialTarget.contains(s.target)||!e)||!t.contains(s.target)&&!e.contains(s.target)&&this.openShareSocialValue!==""&&this.closeShareSocial(e,t)}clickShareSocial(){let s=this.shareSocialbuttonTargets.find(t=>t.dataset.mainIdParam===this.openShareSocialValue)??!1,e=this.dropdownShareSocialTargets.find(t=>t.dataset.mainIdParam===this.openShareSocialDropdownValue)??!1;this.closeShareSocial(s,e)}changeFormNoResult(s){s.currentTarget.checked?(this.searchNoFoundContentTarget.classList.remove("flex","visible"),this.searchNoFoundContentTarget.classList.add("hidden","invisible"),this.searchNoFoundAuthorTarget.classList.add("flex","visible"),this.searchNoFoundAuthorTarget.classList.remove("hidden","invisible"),this.searchInputNoFoundTarget.value="",pe(this.searchNoFoundAuthorTarget,"#nf-site-search-by-author","#nf-site-search-by-author-link")):(this.searchNoFoundContentTarget.classList.add("flex","visible"),this.searchNoFoundContentTarget.classList.remove("hidden","invisible"),this.searchNoFoundAuthorTarget.classList.remove("flex","visible"),this.searchNoFoundAuthorTarget.classList.add("hidden","invisible"))}};M(Z,"targets",["mobileTabletHeader","mobileTabletFooter","footerWrapper","dropdownShareSocial","shareSocialbutton","mainContainer","fullSkinBannerLeft","fullSkinBannerRight","searchNoFoundContent","searchNoFoundAuthor","searchInputNoFound"]),M(Z,"values",{openShareSocial:String,openShareSocialDropdown:String});var be=class extends f{handleChange(){let s=this.selectTarget,e=s.options[s.selectedIndex];this.linkTarget.href=`/authors/${e.value}`}handleChangeMobile(){let s=this.selectMobileTarget,e=s.options[s.selectedIndex];this.linkMobileTarget.href=`/authors/${e.value}`}handleChangeNoResult(){let s=this.selectNoFoundTarget,e=s.options[s.selectedIndex];this.linkNoFoundTarget.href=`/authors/${e.value}`}};M(be,"targets",["select","link","selectMobile","linkMobile","selectNoFound","linkNoFound"]);K.register("footer",ge);K.register("header",X);K.register("main",Z);K.register("search",be);})(); 31/*! ***************************************************************************** 32Copyright (c) Microsoft Corporation. 33 34Permission to use, copy, modify, and/or distribute this software for any 35purpose with or without fee is hereby granted. 36 37THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 38REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 39AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 40INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 41LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 42OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 43PERFORMANCE OF THIS SOFTWARE. 44***************************************************************************** */;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.