var qn=Object.defineProperty;var Hs=s=>{throw TypeError(s)};var Hn=(s,e,t)=>e in s?qn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var R=(s,e,t)=>Hn(s,typeof e!="symbol"?e+"":e,t),Ci=(s,e,t)=>e.has(s)||Hs("Cannot "+t);var N=(s,e,t)=>(Ci(s,e,"read from private field"),t?t.call(s):e.get(s)),U=(s,e,t)=>e.has(s)?Hs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),X=(s,e,t,i)=>(Ci(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),V=(s,e,t)=>(Ci(s,e,"access private method"),t);/*! Turbo 8.0.13 Copyright © 2025 37signals LLC */(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"),.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);const xr=new WeakMap;function On(s){const e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return(t==null?void 0:t.type)=="submit"?t:null}function zn(s){const e=On(s.target);e&&e.form&&xr.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window){const e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))s=e;else return}addEventListener("click",zn,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return xr.get(this.target)}})})();const rt={eager:"eager",lazy:"lazy"},mi=class mi extends HTMLElement{constructor(){super();R(this,"loaded",Promise.resolve());this.delegate=new mi.delegateConstructor(this)}static get observedAttributes(){return["disabled","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="src"?this.delegate.sourceURLChanged():t=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(t){t?this.setAttribute("refresh",t):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return _n(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var t,i;return(i=(t=this.ownerDocument)==null?void 0:t.documentElement)==null?void 0:i.hasAttribute("data-turbo-preview")}};R(mi,"delegateConstructor");let be=mi;function _n(s){switch(s.toLowerCase()){case"lazy":return rt.lazy;default:return rt.eager}}const Bn={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function Ct(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{const e=document.createElement("script"),t=Rr();return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Fn(e,s),e}}function Fn(s,e){for(const{name:t,value:i}of e.attributes)s.setAttribute(t,i)}function Nn(s){const e=document.createElement("template");return e.innerHTML=s,e.content}function J(s,{target:e,cancelable:t,detail:i}={}){const r=new CustomEvent(s,{cancelable:t,bubbles:!0,composed:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(r):document.documentElement.dispatchEvent(r),r}function Os(s){s.preventDefault(),s.stopImmediatePropagation()}function At(){return document.visibilityState==="hidden"?Cr():Mr()}function Mr(){return new Promise(s=>requestAnimationFrame(()=>s()))}function Cr(){return new Promise(s=>setTimeout(()=>s(),0))}function Vn(){return Promise.resolve()}function Pr(s=""){return new DOMParser().parseFromString(s,"text/html")}function Ir(s,...e){const t=$n(s,e).replace(/^\n/,"").split(` `),i=t[0].match(/^\s+/),r=i?i[0].length:0;return t.map(n=>n.slice(r)).join(` `)}function $n(s,e){return s.reduce((t,i,r)=>{const n=e[r]==null?"":e[r];return t+i+n},"")}function Be(){return Array.from({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 ai(s,...e){for(const t of e.map(i=>i==null?void 0:i.getAttribute(s)))if(typeof t=="string")return t;return null}function Wn(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function oi(...s){for(const e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function li(...s){for(const e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function jn(s,e=2e3){return new Promise(t=>{const i=()=>{s.removeEventListener("error",i),s.removeEventListener("load",i),t()};s.addEventListener("load",i,{once:!0}),s.addEventListener("error",i,{once:!0}),setTimeout(t,e)})}function Dr(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Gn(s){return s=="advance"||s=="replace"||s=="restore"}function We(...s){const e=ai("data-turbo-action",...s);return Gn(e)?e:null}function ms(s){return document.querySelector(`meta[name="${s}"]`)}function ci(s){const e=ms(s);return e&&e.content}function Rr(){const s=ms("csp-nonce");if(s){const{nonce:e,content:t}=s;return e==""?t:e}}function Un(s,e){let t=ms(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function ot(s,e){var t;if(s instanceof Element)return s.closest(e)||ot(s.assignedSlot||((t=s.getRootNode())==null?void 0:t.host),e)}function gs(s){return!!s&&s.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof s.focus=="function"}function qr(s){return Array.from(s.querySelectorAll("[autofocus]")).find(gs)}async function Xn(s,e){const t=e();s(),await Mr();const i=e();return[t,i]}function Hr(s){if(s==="_blank")return!1;if(s){for(const e of document.getElementsByName(s))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Or(s){return ot(s,"a[href]:not([target^=_]):not([download])")}function zr(s){return ie(s.getAttribute("href")||"")}function Yn(s,e){let t=null;return(...i)=>{const r=()=>s.apply(this,i);clearTimeout(t),t=setTimeout(r,e)}}const Kn={"aria-disabled":{beforeSubmit:s=>{s.setAttribute("aria-disabled","true"),s.addEventListener("click",Os)},afterSubmit:s=>{s.removeAttribute("aria-disabled"),s.removeEventListener("click",Os)}},disabled:{beforeSubmit:s=>s.disabled=!0,afterSubmit:s=>s.disabled=!1}};var It;class Zn{constructor(e){U(this,It,null);Object.assign(this,e)}get submitter(){return N(this,It)}set submitter(e){X(this,It,Kn[e]||e)}}It=new WeakMap;const Jn=new Zn({mode:"on",submitter:"disabled"}),te={drive:Bn,forms:Jn};function ie(s){return new URL(s.toString(),document.baseURI)}function je(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function vs(s,e){const t=(e==null?void 0:e.getAttribute("formaction"))||s.getAttribute("action")||s.action;return ie(t)}function Qn(s){return(sa(s).match(/\.[^.]*$/)||[])[0]||""}function ea(s,e){const t=ra(e);return s.href===ie(t).href||s.href.startsWith(t)}function Re(s,e){return ea(s,e)&&!te.drive.unvisitableExtensions.has(Qn(s))}function ns(s){const e=je(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function Kt(s){return ns(s)}function ta(s,e){return ie(s).href==ie(e).href}function ia(s){return s.pathname.split("/").slice(1)}function sa(s){return ia(s).slice(-1)[0]}function ra(s){return na(s.origin+s.pathname)}function na(s){return s.endsWith("/")?s:s+"/"}class bs{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 ie(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)}}class aa extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){const i=this.values().next().value;this.delete(i)}super.add(e)}}const _r=new aa(20),oa=window.fetch;function Br(s,e={}){const t=new Headers(e.headers||{}),i=Be();return _r.add(i),t.append("X-Turbo-Request-Id",i),oa(s,{...e,headers:t})}function ys(s){switch(s.toLowerCase()){case"get":return ue.get;case"post":return ue.post;case"put":return ue.put;case"patch":return ue.patch;case"delete":return ue.delete}}const ue={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function la(s){switch(s.toLowerCase()){case Ne.multipart:return Ne.multipart;case Ne.plain:return Ne.plain;default:return Ne.urlEncoded}}const Ne={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};var Dt,mt,Fr,Nr;class Wt{constructor(e,t,i,r=new URLSearchParams,n=null,a=Ne.urlEncoded){U(this,mt);R(this,"abortController",new AbortController);U(this,Dt,e=>{});var d;const[o,h]=zs(ie(i),t,r,a);this.delegate=e,this.url=o,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:h,signal:this.abortSignal,referrer:(d=this.delegate.referrer)==null?void 0:d.href},this.enctype=a}get method(){return this.fetchOptions.method}set method(e){const t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,i=ys(e)||ue.get;this.url.search="";const[r,n]=zs(this.url,i,t,this.enctype);this.url=r,this.fetchOptions.body=n,this.fetchOptions.method=i.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this);const t=await V(this,mt,Fr).call(this,e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Br(this.url.href,e);const i=await this.response;return await this.receive(i)}catch(i){if(i.name!=="AbortError")throw V(this,mt,Nr).call(this,i)&&this.delegate.requestErrored(this,i),i}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new bs(e);return J("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return ws(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}}Dt=new WeakMap,mt=new WeakSet,Fr=async function(e){const t=new Promise(r=>X(this,Dt,r)),i=J("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:N(this,Dt)},target:this.target});return this.url=i.detail.url,i.defaultPrevented&&await t,i},Nr=function(e){return!J("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented};function ws(s){return ys(s)==ue.get}function zs(s,e,t,i){const r=Array.from(t).length>0?new URLSearchParams(Vr(t)):s.searchParams;return ws(e)?[ca(s,r),null]:i==Ne.urlEncoded?[s,r]:[s,t]}function Vr(s){const e=[];for(const[t,i]of s)i instanceof File||e.push([t,i]);return e}function ca(s,e){const t=new URLSearchParams(Vr(e));return s.search=t.toString(),s}class da{constructor(e,t){R(this,"started",!1);R(this,"intersect",e=>{const t=e.slice(-1)[0];t!=null&&t.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)});this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class Ye{static wrap(e){return typeof e=="string"?new this(Nn(e)):e}constructor(e){this.fragment=ha(e)}}R(Ye,"contentType","text/vnd.turbo-stream.html");function ha(s){for(const e of s.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const i of t.templateElement.content.querySelectorAll("script"))i.replaceWith(Ct(i));e.replaceWith(t)}return s}const ua=100;var Ve,ke;class pa{constructor(){U(this,Ve,null);U(this,ke,null)}get(e){if(N(this,ke)&&N(this,ke).url===e&&N(this,ke).expire>Date.now())return N(this,ke).request}setLater(e,t,i){this.clear(),X(this,Ve,setTimeout(()=>{t.perform(),this.set(e,t,i),X(this,Ve,null)},ua))}set(e,t,i){X(this,ke,{url:e,request:t,expire:new Date(new Date().getTime()+i)})}clear(){N(this,Ve)&&clearTimeout(N(this,Ve)),X(this,ke,null)}}Ve=new WeakMap,ke=new WeakMap;const fa=10*1e3,nt=new pa,et={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class bi{constructor(e,t,i,r=!1){R(this,"state",et.initialized);const n=wa(t,i),a=ya(ba(t,i),n),o=ma(t,i),h=Sa(t,i);this.delegate=e,this.formElement=t,this.submitter=i,this.fetchRequest=new Wt(this,n,a,o,t,h),this.mustRedirect=r}static confirmMethod(e){return Promise.resolve(confirm(e))}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=ie(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){const{initialized:e,requesting:t}=et,i=ai("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await(typeof te.forms.confirm=="function"?te.forms.confirm:bi.confirmMethod)(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=et;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=ga(ci("csrf-param"))||ci("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(Ye.contentType)}requestStarted(e){this.state=et.waiting,this.submitter&&te.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),oi(this.formElement),J("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){nt.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(nt.clear(),this.requestMustRedirect(e)&&va(t)){const i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=et.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=et.stopped,this.submitter&&te.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),li(this.formElement),J("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){const e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){const e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Wn("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)==null?void 0:e.getAttribute("data-turbo-submits-with")}}function ma(s,e){const t=new FormData(s),i=e==null?void 0:e.getAttribute("name"),r=e==null?void 0:e.getAttribute("value");return i&&t.append(i,r||""),t}function ga(s){if(s!=null){const t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(s));if(t){const i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function va(s){return s.statusCode==200&&!s.redirected}function ba(s,e){const t=typeof s.action=="string"?s.action:null;return e!=null&&e.hasAttribute("formaction")?e.getAttribute("formaction")||"":s.getAttribute("action")||t||""}function ya(s,e){const t=ie(s);return ws(e)&&(t.search=""),t}function wa(s,e){const t=(e==null?void 0:e.getAttribute("formmethod"))||s.getAttribute("method")||"";return ys(t.toLowerCase())||ue.get}function Sa(s,e){return la((e==null?void 0:e.getAttribute("formenctype"))||s.enctype)}class yi{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return qr(this.element)}get permanentElements(){return Wr(this.element)}getPermanentElementById(e){return $r(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const i of this.permanentElements){const{id:r}=i,n=e.getPermanentElementById(r);n&&(t[r]=[i,n])}return t}}function $r(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function Wr(s){return s.querySelectorAll("[id][data-turbo-permanent]")}class Ss{constructor(e,t){R(this,"started",!1);R(this,"submitCaptured",()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)});R(this,"submitBubbled",e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,i=e.submitter||void 0;t&&Ea(t,i)&&La(t,i)&&this.delegate.willSubmitForm(t,i)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,i))}});this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}}function Ea(s,e){return((e==null?void 0:e.getAttribute("formmethod"))||s.getAttribute("method"))!="dialog"}function La(s,e){const t=(e==null?void 0:e.getAttribute("formtarget"))||s.getAttribute("target");return Hr(t)}var Rt,qt;class jr{constructor(e,t){U(this,Rt,e=>{});U(this,qt,e=>{});this.delegate=e,this.element=t}scrollToAnchor(e){const t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(je(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){const{isPreview:t,shouldRender:i,willRender:r,newSnapshot:n}=e,a=r;if(i)try{this.renderPromise=new Promise(u=>X(this,Rt,u)),this.renderer=e,await this.prepareToRenderSnapshot(e);const o=new Promise(u=>X(this,qt,u)),h={resume:N(this,qt),render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,h)||await o,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,N(this,Rt).call(this,void 0),delete this.renderPromise}else a&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}}Rt=new WeakMap,qt=new WeakMap;class Ta extends jr{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new yi(this.element)}}class Gr{constructor(e,t){R(this,"clickBubbled",e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent});R(this,"linkClicked",e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent});R(this,"willVisit",e=>{delete this.clickEvent});this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickEventIsSignificant(e){var r;const t=e.composed?(r=e.target)==null?void 0:r.parentElement:e.target,i=Or(t)||t;return i instanceof Element&&i.closest("turbo-frame, html")==this.element}}class Ur{constructor(e,t){R(this,"started",!1);R(this,"clickCaptured",()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)});R(this,"clickBubbled",e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=e.composedPath&&e.composedPath()[0]||e.target,i=Or(t);if(i&&Hr(i.target)){const r=zr(i);this.delegate.willFollowLinkToLocation(i,r,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(i,r))}}});this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}}class Xr{constructor(e,t){this.delegate=e,this.linkInterceptor=new Ur(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){const i=document.createElement("form"),r="hidden";for(const[m,v]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:r,name:m,value:v}));const n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");const a=e.getAttribute("data-turbo-method");a&&i.setAttribute("method",a);const o=e.getAttribute("data-turbo-frame");o&&i.setAttribute("data-turbo-frame",o);const h=We(e);h&&i.setAttribute("data-turbo-action",h);const d=e.getAttribute("data-turbo-confirm");d&&i.setAttribute("data-turbo-confirm",d),e.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}}class Yr{static async preservingPermanentElements(e,t,i){const r=new this(e,t);r.enter(),await i(),r.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(const e in this.permanentElementMap){const[t,i]=this.permanentElementMap[e];this.delegate.enteringBardo(t,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(const e in this.permanentElementMap){const[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){const t=ka(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){const t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){const t=this.getPlaceholderById(e.id);t==null||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 ka(s){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var Ae;class Es{constructor(e,t,i,r=!0){U(this,Ae,null);this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=r,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,a)=>this.resolvingFunctions={resolve:n,reject:a})}static renderElement(e,t){}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Yr.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){const e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){N(this,Ae)||e.contains(this.currentSnapshot.activeElement)&&X(this,Ae,this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(N(this,Ae))&&N(this,Ae)instanceof HTMLElement&&(N(this,Ae).focus(),X(this,Ae,null))}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}}Ae=new WeakMap;class Ls extends Es{static renderElement(e,t){var a;const i=document.createRange();i.selectNodeContents(e),i.deleteContents();const r=t,n=(a=r.ownerDocument)==null?void 0:a.createRange();n&&(n.selectNodeContents(r),e.appendChild(n.extractContents()))}constructor(e,t,i,r,n,a=!0){super(t,i,r,n,a),this.delegate=e}get shouldRender(){return!0}async render(){await At(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await At(),this.focusFirstAutofocusableElement(),await At(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const e=this.currentElement.firstElementChild,t=Aa(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=xa(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:i}),!0}return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=Ct(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function Aa(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function xa(s,e){return s=="auto"||s=="smooth"?s:e}var Ma=function(){const s=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:s,afterNodeAdded:s,beforeNodeMorphed:s,afterNodeMorphed:s,beforeNodeRemoved:s,afterNodeRemoved:s,beforeAttributeUpdated:s},head:{style:"merge",shouldPreserve:v=>v.getAttribute("im-preserve")==="true",shouldReAppend:v=>v.getAttribute("im-re-append")==="true",shouldRemove:s,afterHeadMorphed:s},restoreFocus:!0};function t(v,g,l={}){v=u(v);const c=m(g),b=d(v,c,l),w=r(b,()=>o(b,v,c,f=>f.morphStyle==="innerHTML"?(n(f,v,c),Array.from(v.childNodes)):i(f,v,c)));return b.pantry.remove(),w}function i(v,g,l){const c=m(g);let b=Array.from(c.childNodes);const w=b.indexOf(g),f=b.length-(w+1);return n(v,c,l,g,g.nextSibling),b=Array.from(c.childNodes),b.slice(w,b.length-f)}function r(v,g){var p;if(!v.config.restoreFocus)return g();let l=document.activeElement;if(!(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement))return g();const{id:c,selectionStart:b,selectionEnd:w}=l,f=g();return c&&c!==((p=document.activeElement)==null?void 0:p.id)&&(l=v.target.querySelector(`#${c}`),l==null||l.focus()),l&&!l.selectionEnd&&w&&l.setSelectionRange(b,w),f}const n=function(){function v(y,S,T,E=null,L=null){S instanceof HTMLTemplateElement&&T instanceof HTMLTemplateElement&&(S=S.content,T=T.content),E||(E=S.firstChild);for(const k of T.childNodes){if(E&&E!=L){const M=l(y,k,E,L);if(M){M!==E&&b(y,E,M),a(M,k,y),E=M.nextSibling;continue}}if(k instanceof Element&&y.persistentIds.has(k.id)){const M=w(S,k.id,E,y);a(M,k,y),E=M.nextSibling;continue}const A=g(S,k,E,y);A&&(E=A.nextSibling)}for(;E&&E!=L;){const k=E;E=E.nextSibling,c(y,k)}}function g(y,S,T,E){if(E.callbacks.beforeNodeAdded(S)===!1)return null;if(E.idMap.has(S)){const L=document.createElement(S.tagName);return y.insertBefore(L,T),a(L,S,E),E.callbacks.afterNodeAdded(L),L}else{const L=document.importNode(S,!0);return y.insertBefore(L,T),E.callbacks.afterNodeAdded(L),L}}const l=function(){function y(E,L,k,A){let M=null,P=L.nextSibling,D=0,I=k;for(;I&&I!=A;){if(T(I,L)){if(S(E,I,L))return I;M===null&&(E.idMap.has(I)||(M=I))}if(M===null&&P&&T(I,P)&&(D++,P=P.nextSibling,D>=2&&(M=void 0)),I.contains(document.activeElement))break;I=I.nextSibling}return M||null}function S(E,L,k){let A=E.idMap.get(L),M=E.idMap.get(k);if(!M||!A)return!1;for(const P of A)if(M.has(P))return!0;return!1}function T(E,L){const k=E,A=L;return k.nodeType===A.nodeType&&k.tagName===A.tagName&&(!k.id||k.id===A.id)}return y}();function c(y,S){var T;if(y.idMap.has(S))p(y.pantry,S,null);else{if(y.callbacks.beforeNodeRemoved(S)===!1)return;(T=S.parentNode)==null||T.removeChild(S),y.callbacks.afterNodeRemoved(S)}}function b(y,S,T){let E=S;for(;E&&E!==T;){let L=E;E=E.nextSibling,c(y,L)}return E}function w(y,S,T,E){const L=E.target.querySelector(`#${S}`)||E.pantry.querySelector(`#${S}`);return f(L,E),p(y,L,T),L}function f(y,S){const T=y.id;for(;y=y.parentNode;){let E=S.idMap.get(y);E&&(E.delete(T),E.size||S.idMap.delete(y))}}function p(y,S,T){if(y.moveBefore)try{y.moveBefore(S,T)}catch{y.insertBefore(S,T)}else y.insertBefore(S,T)}return v}(),a=function(){function v(f,p,y){return y.ignoreActive&&f===document.activeElement?null:(y.callbacks.beforeNodeMorphed(f,p)===!1||(f instanceof HTMLHeadElement&&y.head.ignore||(f instanceof HTMLHeadElement&&y.head.style!=="morph"?h(f,p,y):(g(f,p,y),w(f,y)||n(y,f,p))),y.callbacks.afterNodeMorphed(f,p)),f)}function g(f,p,y){let S=p.nodeType;if(S===1){const T=f,E=p,L=T.attributes,k=E.attributes;for(const A of k)b(A.name,T,"update",y)||T.getAttribute(A.name)!==A.value&&T.setAttribute(A.name,A.value);for(let A=L.length-1;0<=A;A--){const M=L[A];if(M&&!E.hasAttribute(M.name)){if(b(M.name,T,"remove",y))continue;T.removeAttribute(M.name)}}w(T,y)||l(T,E,y)}(S===8||S===3)&&f.nodeValue!==p.nodeValue&&(f.nodeValue=p.nodeValue)}function l(f,p,y){if(f instanceof HTMLInputElement&&p instanceof HTMLInputElement&&p.type!=="file"){let S=p.value,T=f.value;c(f,p,"checked",y),c(f,p,"disabled",y),p.hasAttribute("value")?T!==S&&(b("value",f,"update",y)||(f.setAttribute("value",S),f.value=S)):b("value",f,"remove",y)||(f.value="",f.removeAttribute("value"))}else if(f instanceof HTMLOptionElement&&p instanceof HTMLOptionElement)c(f,p,"selected",y);else if(f instanceof HTMLTextAreaElement&&p instanceof HTMLTextAreaElement){let S=p.value,T=f.value;if(b("value",f,"update",y))return;S!==T&&(f.value=S),f.firstChild&&f.firstChild.nodeValue!==S&&(f.firstChild.nodeValue=S)}}function c(f,p,y,S){const T=p[y],E=f[y];if(T!==E){const L=b(y,f,"update",S);L||(f[y]=p[y]),T?L||f.setAttribute(y,""):b(y,f,"remove",S)||f.removeAttribute(y)}}function b(f,p,y,S){return f==="value"&&S.ignoreActiveValue&&p===document.activeElement?!0:S.callbacks.beforeAttributeUpdated(f,p,y)===!1}function w(f,p){return!!p.ignoreActiveValue&&f===document.activeElement&&f!==document.body}return v}();function o(v,g,l,c){if(v.head.block){const b=g.querySelector("head"),w=l.querySelector("head");if(b&&w){const f=h(b,w,v);return Promise.all(f).then(()=>{const p=Object.assign(v,{head:{block:!1,ignore:!0}});return c(p)})}}return c(v)}function h(v,g,l){let c=[],b=[],w=[],f=[],p=new Map;for(const S of g.children)p.set(S.outerHTML,S);for(const S of v.children){let T=p.has(S.outerHTML),E=l.head.shouldReAppend(S),L=l.head.shouldPreserve(S);T||L?E?b.push(S):(p.delete(S.outerHTML),w.push(S)):l.head.style==="append"?E&&(b.push(S),f.push(S)):l.head.shouldRemove(S)!==!1&&b.push(S)}f.push(...p.values());let y=[];for(const S of f){let T=document.createRange().createContextualFragment(S.outerHTML).firstChild;if(l.callbacks.beforeNodeAdded(T)!==!1){if("href"in T&&T.href||"src"in T&&T.src){let E,L=new Promise(function(k){E=k});T.addEventListener("load",function(){E()}),y.push(L)}v.appendChild(T),l.callbacks.afterNodeAdded(T),c.push(T)}}for(const S of b)l.callbacks.beforeNodeRemoved(S)!==!1&&(v.removeChild(S),l.callbacks.afterNodeRemoved(S));return l.head.afterHeadMorphed(v,{added:c,kept:w,removed:b}),y}const d=function(){function v(p,y,S){const{persistentIds:T,idMap:E}=w(p,y),L=g(S),k=L.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(k))throw`Do not understand how to morph style ${k}`;return{target:p,newContent:y,config:L,morphStyle:k,ignoreActive:L.ignoreActive,ignoreActiveValue:L.ignoreActiveValue,restoreFocus:L.restoreFocus,idMap:E,persistentIds:T,pantry:l(),callbacks:L.callbacks,head:L.head}}function g(p){let y=Object.assign({},e);return Object.assign(y,p),y.callbacks=Object.assign({},e.callbacks,p.callbacks),y.head=Object.assign({},e.head,p.head),y}function l(){const p=document.createElement("div");return p.hidden=!0,document.body.insertAdjacentElement("afterend",p),p}function c(p){let y=Array.from(p.querySelectorAll("[id]"));return p.id&&y.push(p),y}function b(p,y,S,T){for(const E of T)if(y.has(E.id)){let L=E;for(;L;){let k=p.get(L);if(k==null&&(k=new Set,p.set(L,k)),k.add(E.id),L===S)break;L=L.parentElement}}}function w(p,y){const S=c(p),T=c(y),E=f(S,T);let L=new Map;b(L,E,p,S);const k=y.__idiomorphRoot||y;return b(L,E,k,T),{persistentIds:E,idMap:L}}function f(p,y){let S=new Set,T=new Map;for(const{id:L,tagName:k}of p)T.has(L)?S.add(L):T.set(L,k);let E=new Set;for(const{id:L,tagName:k}of y)E.has(L)?S.add(L):T.get(L)===k&&E.add(L);for(const L of S)E.delete(L);return E}return v}(),{normalizeElement:u,normalizeParent:m}=function(){const v=new WeakSet;function g(w){return w instanceof Document?w.documentElement:w}function l(w){if(w==null)return document.createElement("div");if(typeof w=="string")return l(b(w));if(v.has(w))return w;if(w instanceof Node){if(w.parentNode)return c(w);{const f=document.createElement("div");return f.append(w),f}}else{const f=document.createElement("div");for(const p of[...w])f.append(p);return f}}function c(w){return{childNodes:[w],querySelectorAll:f=>{const p=w.querySelectorAll(f);return w.matches(f)?[w,...p]:p},insertBefore:(f,p)=>w.parentNode.insertBefore(f,p),moveBefore:(f,p)=>w.parentNode.moveBefore(f,p),get __idiomorphRoot(){return w}}}function b(w){let f=new DOMParser,p=w.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(p.match(/<\/html>/)||p.match(/<\/head>/)||p.match(/<\/body>/)){let y=f.parseFromString(w,"text/html");if(p.match(/<\/html>/))return v.add(y),y;{let S=y.firstChild;return S&&v.add(S),S}}else{let S=f.parseFromString("","text/html").body.querySelector("template").content;return v.add(S),S}}return{normalizeElement:g,normalizeParent:l}}();return{morph:t,defaults:e}}();function Ts(s,e,{callbacks:t,...i}={}){Ma.morph(s,e,{...i,callbacks:new Ca(t)})}function Kr(s,e){Ts(s,e.childNodes,{morphStyle:"innerHTML"})}var Ht;class Ca{constructor({beforeNodeMorphed:e}={}){U(this,Ht);R(this,"beforeNodeAdded",e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id)));R(this,"beforeNodeMorphed",(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&N(this,Ht).call(this,e,t)?!J("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1});R(this,"beforeAttributeUpdated",(e,t,i)=>!J("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:i}}).defaultPrevented);R(this,"beforeNodeRemoved",e=>this.beforeNodeMorphed(e));R(this,"afterNodeMorphed",(e,t)=>{e instanceof Element&&J("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})});X(this,Ht,e||(()=>!0))}}Ht=new WeakMap;class Pa extends Ls{static renderElement(e,t){J("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Kr(e,t)}async preservingPermanentElements(e){return await e()}}const Te=class Te{constructor(){R(this,"hiding",!1);R(this,"value",0);R(this,"visible",!1);R(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 Ir` .turbo-progress-bar { position: fixed; display: block; top: 0; left: 0; height: 3px; background: #0076ff; z-index: 2147483647; transition: width ${Te.animationDuration}ms ease-out, opacity ${Te.animationDuration/2}ms ${Te.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } `}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(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,Te.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,Te.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){const e=document.createElement("style");e.type="text/css",e.textContent=Te.defaultCSS;const t=Rr();return t&&(e.nonce=t),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}};R(Te,"animationDuration",300);let as=Te;class Ia extends yi{constructor(){super(...arguments);R(this,"detailsByOuterHTML",this.children.filter(t=>!Ha(t)).map(t=>_a(t)).reduce((t,i)=>{const{outerHTML:r}=i,n=r in t?t[r]:{type:Da(i),tracked:Ra(i),elements:[]};return{...t,[r]:{...n,elements:[...n.elements,i]}}},{}))}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(t=>this.detailsByOuterHTML[t].tracked).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,i){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in i.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==t).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{const{type:r,tracked:n,elements:a}=this.detailsByOuterHTML[i];return r==null&&!n?[...t,...a]:a.length>1?[...t,...a.slice(1)]:t},[])}getMetaValue(t){const i=this.findMetaElementByName(t);return i?i.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((i,r)=>{const{elements:[n]}=this.detailsByOuterHTML[r];return za(n,t)?n:i},void 0|void 0)}}function Da(s){if(qa(s))return"script";if(Oa(s))return"stylesheet"}function Ra(s){return s.getAttribute("data-turbo-track")=="reload"}function qa(s){return s.localName=="script"}function Ha(s){return s.localName=="noscript"}function Oa(s){const e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function za(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function _a(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}class ve extends yi{static fromHTMLString(e=""){return this.fromDocument(Pr(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:i}){return new this(e,t,new Ia(i))}constructor(e,t,i){super(t),this.documentElement=e,this.headSnapshot=i}clone(){const e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(const[r,n]of t.entries()){const a=i[r];for(const o of a.selectedOptions)o.selected=!1;for(const o of n.selectedOptions)a.options[o.index].selected=!0}for(const r of e.querySelectorAll('input[type="password"]'))r.value="";return new ve(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){const e=this.getSetting("root")??"/";return ie(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}}var Ot,He;class Ba{constructor(){U(this,Ot,!1);U(this,He,Promise.resolve())}renderChange(e,t){return e&&this.viewTransitionsAvailable&&!N(this,Ot)?(X(this,Ot,!0),X(this,He,N(this,He).then(async()=>{await document.startViewTransition(t).finished}))):X(this,He,N(this,He).then(t)),N(this,He)}get viewTransitionsAvailable(){return document.startViewTransition}}Ot=new WeakMap,He=new WeakMap;const Fa={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Zt={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},Le={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},lt={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Na={advance:"forward",restore:"back",replace:"none"};class Va{constructor(e,t,i,r={}){R(this,"identifier",Be());R(this,"timingMetrics",{});R(this,"followedRedirect",!1);R(this,"historyChanged",!1);R(this,"scrolled",!1);R(this,"shouldCacheSnapshot",!0);R(this,"acceptsStreamResponse",!1);R(this,"snapshotCached",!1);R(this,"state",Le.initialized);R(this,"viewTransitioner",new Ba);this.delegate=e,this.location=t,this.restorationIdentifier=i||Be();const{action:n,historyChanged:a,referrer:o,snapshot:h,snapshotHTML:d,response:u,visitCachedSnapshot:m,willRender:v,updateHistory:g,shouldCacheSnapshot:l,acceptsStreamResponse:c,direction:b}={...Fa,...r};this.action=n,this.historyChanged=a,this.referrer=o,this.snapshot=h,this.snapshotHTML=d,this.response=u,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=v,this.updateHistory=g,this.scrolled=!v,this.shouldCacheSnapshot=l,this.acceptsStreamResponse=c,this.direction=b||Na[n]}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==Le.initialized&&(this.recordTimingMetric(Zt.visitStart),this.state=Le.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Le.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Le.canceled)}complete(){this.state==Le.started&&(this.recordTimingMetric(Zt.visitEnd),this.adapter.visitCompleted(this),this.state=Le.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Le.started&&(this.state=Le.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){const t=this.location.href===((e=this.referrer)==null?void 0:e.href)?"replace":this.action,i=Dr(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Wt(this,ue.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Zt.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;_s(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Zt.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,_s(e)&&t!=null){const i=ve.fromHTMLString(t);await this.renderPageSnapshot(i,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(ve.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!je(this.location)||e.hasAnchor(je(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return ve.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){const e=this.getCachedSnapshot();if(e){const t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&((e=this.response)!=null&&e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Ye.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){const i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:lt.contentTypeMismatch,redirected:r}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:r}))}async requestFailedWithResponse(e,t){const i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:lt.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:lt.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){const{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){const e=je(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function _s(s){return s>=200&&s<300}class $a{constructor(e){R(this,"progressBar",new as);R(this,"showProgressBar",()=>{this.progressBar.show()});this.session=e}visitProposedToLocation(e,t){Re(e,this.navigator.rootLocation)?this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||Be(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case lt.networkFailure:case lt.timeoutFailure:case lt.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;J("turbo:reload",{detail:e}),window.location.href=((t=this.location)==null?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}}class Wa{constructor(){R(this,"selector","[data-turbo-temporary]");R(this,"deprecatedSelector","[data-turbo-cache=false]");R(this,"started",!1);R(this,"removeTemporaryElements",e=>{for(const t of this.temporaryElements)t.remove()})}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){const e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}}var fe,Zr,ei,ti;class ja{constructor(e,t){U(this,fe);this.session=e,this.element=t,this.linkInterceptor=new Gr(this,t),this.formSubmitObserver=new Ss(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return V(this,fe,ei).call(this,e)}linkClickIntercepted(e,t,i){const r=V(this,fe,ti).call(this,e);r&&r.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&V(this,fe,Zr).call(this,e,t)&&V(this,fe,ei).call(this,e,t)}formSubmitted(e,t){const i=V(this,fe,ti).call(this,e,t);i&&i.delegate.formSubmitted(e,t)}}fe=new WeakSet,Zr=function(e,t){const i=vs(e,t),r=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=ie((r==null?void 0:r.content)??"/");return V(this,fe,ei).call(this,e,t)&&Re(i,n)},ei=function(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const r=V(this,fe,ti).call(this,e,t);return r?r!=e.closest("turbo-frame"):!1}else return!1},ti=function(e,t){const i=(t==null?void 0:t.getAttribute("data-turbo-frame"))||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){const r=this.element.querySelector(`#${i}:not([disabled])`);if(r instanceof be)return r}};let Ga=class{constructor(e){R(this,"location");R(this,"restorationIdentifier",Be());R(this,"restorationData",{});R(this,"started",!1);R(this,"pageLoaded",!1);R(this,"currentIndex",0);R(this,"onPopState",e=>{if(this.shouldHandlePopState()){const{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);const{restorationIdentifier:i,restorationIndex:r}=t;this.restorationIdentifier=i;const n=r>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,i,n),this.currentIndex=r}}});R(this,"onPageLoad",async e=>{await Vn(),this.pageLoaded=!0});this.delegate=e}start(){var e,t;this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=((t=(e=history.state)==null?void 0:e.turbo)==null?void 0:t.restorationIndex)||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=Be()){e===history.pushState&&++this.currentIndex;const r={turbo:{restorationIdentifier:i,restorationIndex:this.currentIndex}};e.call(history,r,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){const{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]={...i,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"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"}};var ct,zt,_t,Bt,gi,Ft,gt,Jr,Qr;class Ua{constructor(e,t){U(this,gt);R(this,"started",!1);U(this,ct,null);U(this,zt,()=>{this.eventTarget.addEventListener("mouseenter",N(this,_t),{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",N(this,Bt),{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",N(this,Ft),!0),this.started=!0});U(this,_t,e=>{if(ci("turbo-prefetch")==="false")return;const t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&V(this,gt,Qr).call(this,t)){const r=t,n=zr(r);if(this.delegate.canPrefetchRequestToLocation(r,n)){X(this,ct,r);const a=new Wt(this,ue.get,n,new URLSearchParams,t);nt.setLater(n.toString(),a,N(this,gt,Jr))}}});U(this,Bt,e=>{e.target===N(this,ct)&&N(this,gi).call(this)});U(this,gi,()=>{nt.clear(),X(this,ct,null)});U(this,Ft,e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){const t=nt.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),nt.clear()}});this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",N(this,zt),{once:!0}):N(this,zt).call(this))}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",N(this,_t),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",N(this,Bt),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",N(this,Ft),!0),this.started=!1)}prepareRequest(e){const t=e.target;e.headers["X-Sec-Purpose"]="prefetch";const i=t.closest("turbo-frame"),r=t.getAttribute("data-turbo-frame")||(i==null?void 0:i.getAttribute("target"))||(i==null?void 0:i.id);r&&r!=="_top"&&(e.headers["Turbo-Frame"]=r)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}ct=new WeakMap,zt=new WeakMap,_t=new WeakMap,Bt=new WeakMap,gi=new WeakMap,Ft=new WeakMap,gt=new WeakSet,Jr=function(){return Number(ci("turbo-prefetch-cache-time"))||fa},Qr=function(e){return!(!e.getAttribute("href")||Xa(e)||Ya(e)||Ka(e)||Za(e)||Qa(e))};const Xa=s=>s.origin!==document.location.origin||!["http:","https:"].includes(s.protocol)||s.hasAttribute("target"),Ya=s=>s.pathname+s.search===document.location.pathname+document.location.search||s.href.startsWith("#"),Ka=s=>{if(s.getAttribute("data-turbo-prefetch")==="false"||s.getAttribute("data-turbo")==="false")return!0;const e=ot(s,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Za=s=>{const e=s.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||Ja(s)||s.hasAttribute("data-turbo-confirm")||s.hasAttribute("data-turbo-stream"))},Ja=s=>s.hasAttribute("data-remote")||s.hasAttribute("data-behavior")||s.hasAttribute("data-confirm")||s.hasAttribute("data-method"),Qa=s=>J("turbo:before-prefetch",{target:s,cancelable:!0}).defaultPrevented;var vt,en,tn;class eo{constructor(e){U(this,vt);this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,i={}){this.stop(),this.currentVisit=new Va(this,ie(e),t,{referrer:this.location,...i}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new bi(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){const i=await t.responseHTML;if(i){const r=e.isSafe;r||this.view.clearSnapshotCache();const{statusCode:n,redirected:a}=t,h={action:V(this,vt,en).call(this,e,t),shouldCacheSnapshot:r,response:{statusCode:n,responseHTML:i,redirected:a}};this.proposeVisit(t.location,h)}}}async formSubmissionFailedWithResponse(e,t){const i=await t.responseHTML;if(i){const r=ve.fromHTMLString(i);t.serverError?await this.view.renderError(r,this.currentVisit):await this.view.renderPage(r,!1,!0,this.currentVisit),r.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){const i=je(e),r=je(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&ns(e)===ns(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}}vt=new WeakSet,en=function(e,t){const{submitter:i,formElement:r}=e;return We(i,r)||V(this,vt,tn).call(this,t)},tn=function(e){var i;return e.redirected&&e.location.href===((i=this.location)==null?void 0:i.href)?"replace":"advance"};const Fe={initial:0,loading:1,interactive:2,complete:3};class to{constructor(e){R(this,"stage",Fe.initial);R(this,"started",!1);R(this,"interpretReadyState",()=>{const{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()});R(this,"pageWillUnload",()=>{this.delegate.pageWillUnload()});this.delegate=e}start(){this.started||(this.stage==Fe.initial&&(this.stage=Fe.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==Fe.loading&&(this.stage=Fe.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Fe.interactive&&(this.stage=Fe.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class io{constructor(e){R(this,"started",!1);R(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)}}class so{render({fragment:e}){Yr.preservingPermanentElements(this,ro(e),()=>{no(e,()=>{ao(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}function ro(s){const e=Wr(document.documentElement),t={};for(const i of e){const{id:r}=i;for(const n of s.querySelectorAll("turbo-stream")){const a=$r(n.templateElement.content,r);a&&(t[r]=[i,a])}}return t}async function no(s,e){const t=`turbo-stream-autofocus-${Be()}`,i=s.querySelectorAll("turbo-stream"),r=oo(i);let n=null;if(r&&(r.id?n=r.id:n=t,r.id=n),e(),await At(),(document.activeElement==null||document.activeElement==document.body)&&n){const o=document.getElementById(n);gs(o)&&o.focus(),o&&o.id==t&&o.removeAttribute("id")}}async function ao(s){const[e,t]=await Xn(s,()=>document.activeElement),i=e&&e.id;if(i){const r=document.getElementById(i);gs(r)&&r!=t&&r.focus()}}function oo(s){for(const e of s){const t=qr(e.templateElement.content);if(t)return t}return null}var Oe;class lo{constructor(e){R(this,"sources",new Set);U(this,Oe,!1);R(this,"inspectFetchResponse",e=>{const t=co(e);t&&ho(t)&&(e.preventDefault(),this.receiveMessageResponse(t))});R(this,"receiveMessageEvent",e=>{N(this,Oe)&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)});this.delegate=e}start(){N(this,Oe)||(X(this,Oe,!0),addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){N(this,Oe)&&(X(this,Oe,!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){const t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Ye.wrap(e))}}Oe=new WeakMap;function co(s){var t;const e=(t=s.detail)==null?void 0:t.fetchResponse;if(e instanceof bs)return e}function ho(s){return(s.contentType??"").startsWith(Ye.contentType)}class uo extends Es{static renderElement(e,t){const{documentElement:i,body:r}=document;i.replaceChild(t,r)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){const{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(const e of this.scriptElements){const t=e.parentNode;if(t){const i=Ct(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}var vi,sn;class ks extends Es{constructor(){super(...arguments);U(this,vi)}static renderElement(t,i){document.body&&i instanceof HTMLBodyElement?document.body.replaceWith(i):document.documentElement.appendChild(i)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){V(this,vi,sn).call(this),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){const t=this.mergeProvisionalElements(),i=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await i,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const t=[];for(const i of this.newHeadStylesheetElements)t.push(jn(i)),document.head.appendChild(i);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(Ct(t))}removeUnusedDynamicStylesheetElements(){for(const t of this.unusedDynamicStylesheetElements)document.head.removeChild(t)}async mergeProvisionalElements(){const t=[...this.newHeadProvisionalElements];for(const i of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(i,t)||document.head.removeChild(i);for(const i of t)document.head.appendChild(i)}isCurrentElementInElementList(t,i){for(const[r,n]of i.entries()){if(t.tagName=="TITLE"){if(n.tagName!="TITLE")continue;if(t.innerHTML==n.innerHTML)return i.splice(r,1),!0}if(n.isEqualNode(t))return i.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(const t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(const t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const t of this.newBodyScriptElements){const i=Ct(t);t.replaceWith(i)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(t=>t.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}}vi=new WeakSet,sn=function(){const{documentElement:t}=this.currentSnapshot,{lang:i}=this.newSnapshot;i?t.setAttribute("lang",i):t.removeAttribute("lang")};class po extends ks{static renderElement(e,t){Ts(e,t,{callbacks:{beforeNodeMorphed:i=>!Bs(i)}});for(const i of e.querySelectorAll("turbo-frame"))Bs(i)&&i.reload();J("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}}function Bs(s){return s instanceof be&&s.src&&s.refresh==="morph"&&!s.closest("[data-turbo-permanent]")}class fo{constructor(e){R(this,"keys",[]);R(this,"snapshots",{});this.size=e}has(e){return Kt(e)in this.snapshots}get(e){if(this.has(e)){const 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[Kt(e)]}write(e,t){this.snapshots[Kt(e)]=t}touch(e){const t=Kt(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(const e of this.keys.splice(this.size))delete this.snapshots[e]}}class mo extends jr{constructor(){super(...arguments);R(this,"snapshotCache",new fo(10));R(this,"lastRenderedLocation",new URL(location.href));R(this,"forceReloaded",!1)}shouldTransitionTo(t){return this.snapshot.prefersViewTransitions&&t.prefersViewTransitions}renderPage(t,i=!1,r=!0,n){const o=this.isPageRefresh(n)&&this.snapshot.shouldMorphPage?po:ks,h=new o(this.snapshot,t,i,r);return h.shouldRender?n==null||n.changeHistory():this.forceReloaded=!0,this.render(h)}renderError(t,i){i==null||i.changeHistory();const r=new uo(this.snapshot,t,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:i}=this;await Cr();const r=t.clone();return this.snapshotCache.put(i,r),r}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}isPageRefresh(t){return!t||this.lastRenderedLocation.pathname===t.location.pathname&&t.action==="replace"}shouldPreserveScrollPosition(t){return this.isPageRefresh(t)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return ve.fromElement(this.element)}}var Nt;class go{constructor(e,t){R(this,"selector","a[data-turbo-preload]");U(this,Nt,()=>{this.preloadOnLoadLinksForView(document.body)});this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N(this,Nt)):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",N(this,Nt))}preloadOnLoadLinksForView(e){for(const t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){const t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Wt(this,ue.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{const i=await t.responseHTML,r=ve.fromHTMLString(i);this.snapshotCache.put(e.url,r)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}Nt=new WeakMap;var dt,ii;class vo{constructor(e){U(this,dt);this.session=e}clear(){this.session.clearCache()}resetCacheControl(){V(this,dt,ii).call(this,"")}exemptPageFromCache(){V(this,dt,ii).call(this,"no-cache")}exemptPageFromPreview(){V(this,dt,ii).call(this,"no-preview")}}dt=new WeakSet,ii=function(e){Un("turbo-cache-control",e)};var Vt;class bo{constructor(e){R(this,"navigator",new eo(this));R(this,"history",new Ga(this));R(this,"view",new mo(this,document.documentElement));R(this,"adapter",new $a(this));R(this,"pageObserver",new to(this));R(this,"cacheObserver",new Wa);R(this,"linkPrefetchObserver",new Ua(this,document));R(this,"linkClickObserver",new Ur(this,window));R(this,"formSubmitObserver",new Ss(this,document));R(this,"scrollObserver",new io(this));R(this,"streamObserver",new lo(this));R(this,"formLinkClickObserver",new Xr(this,document.documentElement));R(this,"frameRedirector",new ja(this,document.documentElement));R(this,"streamMessageRenderer",new so);R(this,"cache",new vo(this));R(this,"enabled",!0);R(this,"started",!1);U(this,Vt,150);this.recentRequests=e,this.preloader=new go(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){const i=t.frame?document.getElementById(t.frame):null;if(i instanceof be){const r=t.action||We(i);i.delegate.proposeVisitIfNavigatedWithAction(i,r),i.src=e.toString()}else this.navigator.proposeVisit(ie(e),t)}refresh(e,t){const i=t&&this.recentRequests.has(t),r=e===document.baseURI;!i&&!this.navigator.currentVisit&&r&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Ye.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){te.drive.progressBarDelay=e}get progressBarDelay(){return te.drive.progressBarDelay}set drive(e){te.drive.enabled=e}get drive(){return te.drive.enabled}set formMode(e){te.forms.mode=e}get formMode(){return te.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return N(this,Vt)}set pageRefreshDebouncePeriod(e){this.refresh=Yn(this.debouncedRefresh.bind(this),e),X(this,Vt,e)}shouldPreloadLink(e){const t=e.hasAttribute("data-turbo-method"),i=e.hasAttribute("data-turbo-stream"),r=e.getAttribute("data-turbo-frame"),n=r=="_top"?null:document.getElementById(r)||ot(e,"turbo-frame:not([disabled])");if(t||i||n instanceof be)return!1;{const a=new URL(e.href);return this.elementIsNavigatable(e)&&Re(a,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,i){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:i}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Re(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Re(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&Re(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,i)}followedLinkToLocation(e,t){const i=this.getActionForLink(e),r=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:i,acceptsStreamResponse:r})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Fs(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(oi(document.documentElement),this.view.markVisitDirection(e.direction)),Fs(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),li(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){const i=vs(e,t);return this.submissionIsNavigatable(e,t)&&Re(ie(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.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){const i=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:r,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!r}viewRenderedSnapshot(e,t,i){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(i)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,i){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,i).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,i){return J("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return J("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return J("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return J("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return J("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return J("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return J("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 J("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return J("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(te.forms.mode=="off")return!1;{const i=t?this.elementIsNavigatable(t):!0;return te.forms.mode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=ot(e,"[data-turbo]"),i=ot(e,"turbo-frame");return te.drive.enabled||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return We(e)||"advance"}get snapshot(){return this.view.snapshot}}Vt=new WeakMap;function Fs(s){Object.defineProperties(s,yo)}const yo={absoluteURL:{get(){return this.toString()}}},Q=new bo(_r),{cache:wo,navigator:So}=Q;function rn(){Q.start()}function Eo(s){Q.registerAdapter(s)}function Lo(s,e){Q.visit(s,e)}function nn(s){Q.connectStreamSource(s)}function an(s){Q.disconnectStreamSource(s)}function To(s){Q.renderStreamMessage(s)}function ko(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Q.clearCache()}function Ao(s){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),te.drive.progressBarDelay=s}function xo(s){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),te.forms.confirm=s}function Mo(s){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),te.forms.mode=s}var Co=Object.freeze({__proto__:null,navigator:So,session:Q,cache:wo,PageRenderer:ks,PageSnapshot:ve,FrameRenderer:Ls,fetch:Br,config:te,start:rn,registerAdapter:Eo,visit:Lo,connectStreamSource:nn,disconnectStreamSource:an,renderStreamMessage:To,clearCache:ko,setProgressBarDelay:Ao,setConfirmMethod:xo,setFormMode:Mo});class Po extends Error{}var ht,Se,ze,$t,ut,pt,$,it,on,ln,cn,dn,hn,un,pn,os,st,fn,si,mn,gn,vn;class Io{constructor(e){U(this,$);R(this,"fetchResponseLoaded",e=>Promise.resolve());U(this,ht,null);U(this,Se,()=>{});U(this,ze,!1);U(this,$t,!1);U(this,ut,new Set);U(this,pt,!1);R(this,"action",null);R(this,"visitCachedSnapshot",({element:e})=>{const t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement});this.element=e,this.view=new Ta(this,this.element),this.appearanceObserver=new da(this,this.element),this.formLinkClickObserver=new Xr(this,this.element),this.linkInterceptor=new Gr(this,this.element),this.restorationIdentifier=Be(),this.formSubmitObserver=new Ss(this,this.element)}connect(){N(this,ze)||(X(this,ze,!0),this.loadingStyle==rt.lazy?this.appearanceObserver.start():V(this,$,it).call(this),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){N(this,ze)&&(X(this,ze,!1),this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==rt.eager&&V(this,$,it).call(this)}sourceURLChanged(){V(this,$,mn).call(this,"src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==rt.eager||N(this,$t))&&V(this,$,it).call(this))}sourceURLReloaded(){const{refresh:e,src:t}=this.element;return X(this,pt,t&&e==="morph"),this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==rt.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),V(this,$,it).call(this))}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{const t=await e.responseHTML;if(t){const i=Pr(t);ve.fromDocument(i).isVisitable?await V(this,$,on).call(this,e,i):await V(this,$,dn).call(this,e)}}finally{X(this,pt,!1),this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,We(e)),V(this,$,it).call(this)}willSubmitFormLinkToLocation(e){return V(this,$,si).call(this,e)}submittedFormLinkToLocation(e,t,i){const r=V(this,$,st).call(this,e);r&&i.setAttribute("data-turbo-frame",r.id)}shouldInterceptLinkClick(e,t,i){return V(this,$,si).call(this,e)}linkClickIntercepted(e,t){V(this,$,cn).call(this,e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&V(this,$,si).call(this,e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new bi(this,e,t);const{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(e){var t;e.headers["Turbo-Frame"]=this.id,(t=this.currentNavigationElement)!=null&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Ye.contentType)}requestStarted(e){oi(this.element)}requestPreventedHandlingResponse(e,t){N(this,Se).call(this)}async requestSucceededWithResponse(e,t){await this.loadResponse(t),N(this,Se).call(this)}async requestFailedWithResponse(e,t){await this.loadResponse(t),N(this,Se).call(this)}requestErrored(e,t){console.error(t),N(this,Se).call(this)}requestFinished(e){li(this.element)}formSubmissionStarted({formElement:e}){oi(e,V(this,$,st).call(this,e))}formSubmissionSucceededWithResponse(e,t){const i=V(this,$,st).call(this,e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,We(e.submitter,e.formElement,i)),i.delegate.loadResponse(t),e.isSafe||Q.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Q.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){li(e,V(this,$,st).call(this,e))}allowsImmediateRender({element:e},t){const i=J("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:r,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!r}viewRenderedSnapshot(e,t,i){}preloadOnLoadLinksForView(e){Q.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){const i=ve.fromElement(e).clone(),{visitCachedSnapshot:r}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){const{statusCode:a,redirected:o}=n,h=await n.responseHTML,u={response:{statusCode:a,redirected:o,responseHTML:h},visitCachedSnapshot:r,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:i};this.action&&(u.action=this.action),Q.visit(e.src,u)}}}}changeHistory(){if(this.action){const e=Dr(this.action);Q.history.update(e,ie(this.element.src||""),this.restorationIdentifier)}}async extractForeignFrameElement(e){let t;const i=CSS.escape(this.id);try{if(t=Vs(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=Vs(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(r){return console.error(r),new be}return null}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){V(this,$,gn).call(this,"src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||N(this,Se).call(this)!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&N(this,ze)}get rootLocation(){const e=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),t=(e==null?void 0:e.content)??"/";return ie(t)}}ht=new WeakMap,Se=new WeakMap,ze=new WeakMap,$t=new WeakMap,ut=new WeakMap,pt=new WeakMap,$=new WeakSet,it=async function(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=V(this,$,ln).call(this,ie(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,X(this,$t,!0))},on=async function(e,t){const i=await this.extractForeignFrameElement(t.body),r=N(this,pt)?Pa:Ls;if(i){const n=new yi(i),a=new r(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(a),this.complete=!0,Q.frameRendered(e,this.element),Q.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else V(this,$,hn).call(this,e)&&V(this,$,un).call(this,e)},ln=async function(e){var i;const t=new Wt(this,ue.get,e,new URLSearchParams,this.element);return(i=N(this,ht))==null||i.cancel(),X(this,ht,t),new Promise(r=>{X(this,Se,()=>{X(this,Se,()=>{}),X(this,ht,null),r()}),t.perform()})},cn=function(e,t,i){const r=V(this,$,st).call(this,e,i);r.delegate.proposeVisitIfNavigatedWithAction(r,We(i,e,r)),V(this,$,vn).call(this,e,()=>{r.src=t})},dn=async function(e){console.warn(`The response (${e.statusCode}) from is performing a full page visit due to turbo-visit-control.`),await V(this,$,os).call(this,e.response)},hn=function(e){this.element.setAttribute("complete","");const t=e.response,i=async(n,a)=>{n instanceof Response?V(this,$,os).call(this,n):Q.visit(n,a)};return!J("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented},un=function(e){this.view.missing(),V(this,$,pn).call(this,e)},pn=function(e){const t=`The response (${e.statusCode}) did not contain the expected and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Po(t)},os=async function(e){const t=new bs(e),i=await t.responseHTML,{location:r,redirected:n,statusCode:a}=t;return Q.visit(r,{response:{redirected:n,statusCode:a,responseHTML:i}})},st=function(e,t){const i=ai("data-turbo-frame",t,e)||this.element.getAttribute("target");return Ns(i)??this.element},fn=function(e,t){const i=vs(e,t);return Re(ie(i),this.rootLocation)},si=function(e,t){const i=ai("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!V(this,$,fn).call(this,e,t)||!this.enabled||i=="_top")return!1;if(i){const r=Ns(i);if(r)return!r.disabled}return!(!Q.elementIsNavigatable(e)||t&&!Q.elementIsNavigatable(t))},mn=function(e){return N(this,ut).has(e)},gn=function(e,t){N(this,ut).add(e),t(),N(this,ut).delete(e)},vn=function(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement};function Ns(s){if(s!=null){const e=document.getElementById(s);if(e instanceof be)return e}}function Vs(s,e){if(s){const t=s.getAttribute("src");if(t!=null&&e!=null&&ta(t,e))throw new Error(`Matching element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof be)return s.connectedCallback(),s.disconnectedCallback(),s}}const bn={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)==null?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?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(){const s=this.getAttribute("method");this.targetElements.forEach(e=>{s==="morph"?Ts(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){const s=this.getAttribute("method");this.targetElements.forEach(e=>{s==="morph"?Kr(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){Q.refresh(this.baseURI,this.requestId)}};var $e,Et;const Rs=class Rs extends HTMLElement{constructor(){super(...arguments);U(this,$e)}static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){return this.renderPromise??(this.renderPromise=(async()=>{const t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await At(),await t.detail.render(this))})())}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){var r;const t=this.targetElements.flatMap(n=>[...n.children]).filter(n=>!!n.getAttribute("id")),i=[...((r=this.templateContent)==null?void 0:r.children)||[]].filter(n=>!!n.getAttribute("id")).map(n=>n.getAttribute("id"));return t.filter(n=>i.includes(n.getAttribute("id")))}get performAction(){if(this.action){const t=bn[this.action];if(t)return t;V(this,$e,Et).call(this,"unknown action")}V(this,$e,Et).call(this,"action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;V(this,$e,Et).call(this,"target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){const t=this.ownerDocument.createElement("template");return this.appendChild(t),t}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;V(this,$e,Et).call(this,"first child element must be a