Plugin Directory

Changeset 3033244


Ignore:
Timestamp:
02/08/2024 02:16:42 PM (2 years ago)
Author:
rherault
Message:

Update to version 0.3.3 from GitHub

Location:
td-turbo-drive
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • td-turbo-drive/tags/0.3.3/dist/main.js

    r2922137 r3033244  
    1 (function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;const s=HTMLElement,e={HTMLElement:function(){return Reflect.construct(s,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=s.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,s)})();(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,r){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,r,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+r+".",n)}})(HTMLFormElement.prototype);const se=new WeakMap;function Se(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 ye(s){const e=Se(s.target);e&&e.form&&se.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))s=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",ye,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return se.get(this.target)}})})();var E;(function(s){s.eager="eager",s.lazy="lazy"})(E||(E={}));class v extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new v.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return Le(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}}function Le(s){switch(s.toLowerCase()){case"lazy":return E.lazy;default:return E.eager}}function c(s){return new URL(s.toString(),document.baseURI)}function y(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function $(s,e){const t=(e==null?void 0:e.getAttribute("formaction"))||s.getAttribute("action")||s.action;return c(t)}function Re(s){return(Fe(s).match(/\.[^.]*$/)||[])[0]||""}function Te(s){return!!Re(s).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Ce(s,e){const t=ke(e);return s.href===c(t).href||s.href.startsWith(t)}function A(s,e){return Ce(s,e)&&Te(s)}function _(s){const e=y(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function I(s){return _(s)}function Ae(s,e){return c(s).href==c(e).href}function Pe(s){return s.pathname.split("/").slice(1)}function Fe(s){return Pe(s).slice(-1)[0]}function ke(s){return Me(s.origin+s.pathname)}function Me(s){return s.endsWith("/")?s:s+"/"}class z{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return c(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}function F(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{const e=document.createElement("script"),t=B("csp-nonce");return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Ie(e,s),e}}function Ie(s,e){for(const{name:t,value:i}of e.attributes)s.setAttribute(t,i)}function He(s){const e=document.createElement("template");return e.innerHTML=s,e.content}function l(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 H(){return new Promise(s=>requestAnimationFrame(()=>s()))}function qe(){return new Promise(s=>setTimeout(()=>s(),0))}function Be(){return Promise.resolve()}function ie(s=""){return new DOMParser().parseFromString(s,"text/html")}function re(s,...e){const t=Oe(s,e).replace(/^\n/,"").split(`
    2 `),i=t[0].match(/^\s+/),r=i?i[0].length:0;return t.map(n=>n.slice(r)).join(`
    3 `)}function Oe(s,e){return s.reduce((t,i,r)=>{const n=e[r]==null?"":e[r];return t+i+n},"")}function P(){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 q(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 Ne(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function x(...s){for(const e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function W(...s){for(const e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function De(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 ne(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Ve(s){return s=="advance"||s=="replace"||s=="restore"}function N(...s){const e=q("data-turbo-action",...s);return Ve(e)?e:null}function oe(s){return document.querySelector(`meta[name="${s}"]`)}function B(s){const e=oe(s);return e&&e.content}function _e(s,e){let t=oe(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function O(s,e){var t;if(s instanceof Element)return s.closest(e)||O(s.assignedSlot||((t=s.getRootNode())===null||t===void 0?void 0:t.host),e)}var d;(function(s){s[s.get=0]="get",s[s.post=1]="post",s[s.put=2]="put",s[s.patch=3]="patch",s[s.delete=4]="delete"})(d||(d={}));function xe(s){switch(s.toLowerCase()){case"get":return d.get;case"post":return d.post;case"put":return d.put;case"patch":return d.patch;case"delete":return d.delete}}class K{constructor(e,t,i,r=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=r,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(e);try{this.delegate.requestStarted(this);const t=await fetch(this.url.href,e);return await this.receive(t)}catch(t){if(t.name!=="AbortError")throw this.willDelegateErrorHandling(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new z(e);return l("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:d[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===d.get}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(e){const t=new Promise(r=>this.resolveRequestPromise=r);l("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}willDelegateErrorHandling(e){return!l("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}}class We{constructor(e,t){this.started=!1,this.intersect=i=>{const r=i.slice(-1)[0];r!=null&&r.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class L{static wrap(e){return typeof e=="string"?new this(He(e)):e}constructor(e){this.fragment=Ue(e)}}L.contentType="text/vnd.turbo-stream.html";function Ue(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(F(i));e.replaceWith(t)}return s}var b;(function(s){s[s.initialized=0]="initialized",s[s.requesting=1]="requesting",s[s.waiting=2]="waiting",s[s.receiving=3]="receiving",s[s.stopping=4]="stopping",s[s.stopped=5]="stopped"})(b||(b={}));var w;(function(s){s.urlEncoded="application/x-www-form-urlencoded",s.multipart="multipart/form-data",s.plain="text/plain"})(w||(w={}));function je(s){switch(s.toLowerCase()){case w.multipart:return w.multipart;case w.plain:return w.plain;default:return w.urlEncoded}}class k{static confirmMethod(e,t,i){return Promise.resolve(confirm(e))}constructor(e,t,i,r=!1){this.state=b.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=$e(t,i),this.location=c(this.action),this.method==d.get&&Qe(this.location,[...this.body.entries()]),this.fetchRequest=new K(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=r}get method(){var e;const t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return xe(t.toLowerCase())||d.get}get action(){var e;const t=typeof this.formElement.action=="string"?this.formElement.action:null;return!((e=this.submitter)===null||e===void 0)&&e.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==w.urlEncoded||this.method==d.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return je(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}async start(){const{initialized:e,requesting:t}=b,i=q("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await k.confirmMethod(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=b;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=ze(B("csrf-param"))||B("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(L.contentType)}requestStarted(e){var t;this.state=b.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),this.setSubmitsWith(),l("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&Ke(t)){const i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=b.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=b.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),this.resetSubmitterText(),l("turbo:submit-end",{target:this.formElement,detail:Object.assign({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||Ne("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)===null||e===void 0?void 0:e.getAttribute("data-turbo-submits-with")}}function $e(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 ze(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 Ke(s){return s.statusCode==200&&!s.redirected}function Qe(s,e){const t=new URLSearchParams;for(const[i,r]of e)r instanceof File||t.append(i,r);return s.search=t.toString(),s}class D{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(){const e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(const t of this.element.querySelectorAll("[autofocus]"))if(t.closest(e)==null)return t;return null}get permanentElements(){return le(this.element)}getPermanentElementById(e){return ae(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 ae(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function le(s){return s.querySelectorAll("[id][data-turbo-permanent]")}class Q{constructor(e,t){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=i=>{if(!i.defaultPrevented){const r=i.target instanceof HTMLFormElement?i.target:void 0,n=i.submitter||void 0;r&&Xe(r,n)&&Ye(r,n)&&this.delegate.willSubmitForm(r,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmitted(r,n))}},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 Xe(s,e){return((e==null?void 0:e.getAttribute("formmethod"))||s.getAttribute("method"))!="dialog"}function Ye(s,e){if(e!=null&&e.hasAttribute("formtarget")||s.hasAttribute("target")){const t=(e==null?void 0:e.getAttribute("formtarget"))||s.target;for(const i of document.getElementsByName(t))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}class ce{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},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(y(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,newSnapshot:r}=e;if(i)try{this.renderPromise=new Promise(u=>this.resolveRenderPromise=u),this.renderer=e,await this.prepareToRenderSnapshot(e);const n=new Promise(u=>this.resolveInterceptionPromise=u),o={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(r,o)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(r,t),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}}class Je extends ce{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new D(this.element)}}class he{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url,i.detail.originalEvent)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url,i.detail.originalEvent)),delete this.clickEvent},this.willVisit=i=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}}class de{constructor(e,t){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=i=>{if(i instanceof MouseEvent&&this.clickEventIsSignificant(i)){const r=i.composedPath&&i.composedPath()[0]||i.target,n=this.findLinkFromClickTarget(r);if(n&&Ge(n)){const o=this.getLocationForLink(n);this.delegate.willFollowLinkToLocation(n,o,i)&&(i.preventDefault(),this.delegate.followedLinkToLocation(n,o))}}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return O(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return c(e.getAttribute("href")||"")}}function Ge(s){if(s.hasAttribute("target")){for(const e of document.getElementsByName(s.target))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}class ue{constructor(e,t){this.delegate=e,this.linkInterceptor=new de(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&e.hasAttribute("data-turbo-method")}followedLinkToLocation(e,t){const i=document.createElement("form"),r="hidden";for(const[T,M]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:r,name:T,value:M}));const n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");const o=e.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);const h=e.getAttribute("data-turbo-frame");h&&i.setAttribute("data-turbo-frame",h);const u=N(e);u&&i.setAttribute("data-turbo-action",u);const R=e.getAttribute("data-turbo-confirm");R&&i.setAttribute("data-turbo-confirm",R),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 me{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=Ze(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 Ze(s){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}class X{constructor(e,t,i,r,n=!0){this.activeElement=null,this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,h)=>this.resolvingFunctions={resolve:o,reject:h})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await me.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){const e=this.connectedSnapshot.firstAutofocusableElement;et(e)&&e.focus()}enteringBardo(e){this.activeElement||e.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}}function et(s){return s&&typeof s.focus=="function"}class U extends X{static renderElement(e,t){var i;const r=document.createRange();r.selectNodeContents(e),r.deleteContents();const n=t,o=(i=n.ownerDocument)===null||i===void 0?void 0:i.createRange();o&&(o.selectNodeContents(n),e.appendChild(o.extractContents()))}constructor(e,t,i,r,n,o=!0){super(t,i,r,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await H(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await H(),this.focusFirstAutofocusableElement(),await H(),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=tt(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=st(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=F(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function tt(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function st(s,e){return s=="auto"||s=="smooth"?s:e}class g{static get defaultCSS(){return re`
     1var or=Object.defineProperty;var ar=(r,e,t)=>e in r?or(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var c=(r,e,t)=>(ar(r,typeof e!="symbol"?e+"":e,t),t),It=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var p=(r,e,t)=>(It(r,e,"read from private field"),t?t.call(r):e.get(r)),u=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},S=(r,e,t,s)=>(It(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);var m=(r,e,t)=>(It(r,e,"access private method"),t);/*!
     2Turbo 8.0.1
     3Copyright © 2024 37signals LLC
     4 */(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(s){s?(e(s,this),s.click()):(s=document.createElement("input"),s.type="submit",s.hidden=!0,this.appendChild(s),s.click(),this.removeChild(s))};function e(s,i){s instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),s.type=="submit"||t(TypeError,"The specified element is not a submit button"),s.form==i||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(s,i,l){throw new s("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",l)}})(HTMLFormElement.prototype);const is=new WeakMap;function lr(r){const e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return(t==null?void 0:t.type)=="submit"?t:null}function cr(r){const e=lr(r.target);e&&e.form&&is.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){const e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))r=e;else return}addEventListener("click",cr,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return is.get(this.target)}})})();const ne={eager:"eager",lazy:"lazy"},et=class et extends HTMLElement{constructor(){super();c(this,"loaded",Promise.resolve());this.delegate=new et.delegateConstructor(this)}static get observedAttributes(){return["disabled","complete","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="complete"?this.delegate.completeChanged():t=="src"?this.delegate.sourceURLChanged():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 loading(){return hr(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,s;return(s=(t=this.ownerDocument)==null?void 0:t.documentElement)==null?void 0:s.hasAttribute("data-turbo-preview")}};c(et,"delegateConstructor");let I=et;function hr(r){switch(r.toLowerCase()){case"lazy":return ne.lazy;default:return ne.eager}}function L(r){return new URL(r.toString(),document.baseURI)}function Z(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function Wt(r,e){const t=(e==null?void 0:e.getAttribute("formaction"))||r.getAttribute("action")||r.action;return L(t)}function dr(r){return(gr(r).match(/\.[^.]*$/)||[])[0]||""}function ur(r){return!!dr(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function mr(r,e){const t=br(e);return r.href===L(t).href||r.href.startsWith(t)}function N(r,e){return mr(r,e)&&ur(r)}function qt(r){const e=Z(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function _e(r){return qt(r)}function fr(r,e){return L(r).href==L(e).href}function pr(r){return r.pathname.split("/").slice(1)}function gr(r){return pr(r).slice(-1)[0]}function br(r){return vr(r.origin+r.pathname)}function vr(r){return r.endsWith("/")?r:r+"/"}class Ut{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 L(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}function Re(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{const e=document.createElement("script"),t=Se("csp-nonce");return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,Sr(e,r),e}}function Sr(r,e){for(const{name:t,value:s}of e.attributes)r.setAttribute(t,s)}function wr(r){const e=document.createElement("template");return e.innerHTML=r,e.content}function E(r,{target:e,cancelable:t,detail:s}={}){const i=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:s});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function ae(){return document.visibilityState==="hidden"?os():ns()}function ns(){return new Promise(r=>requestAnimationFrame(()=>r()))}function os(){return new Promise(r=>setTimeout(()=>r(),0))}function Er(){return Promise.resolve()}function as(r=""){return new DOMParser().parseFromString(r,"text/html")}function ls(r,...e){const t=yr(r,e).replace(/^\n/,"").split(`
     5`),s=t[0].match(/^\s+/),i=s?s[0].length:0;return t.map(l=>l.slice(i)).join(`
     6`)}function yr(r,e){return r.reduce((t,s,i)=>{const l=e[i]==null?"":e[i];return t+s+l},"")}function $(){return Array.from({length:36}).map((r,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 Qe(r,...e){for(const t of e.map(s=>s==null?void 0:s.getAttribute(r)))if(typeof t=="string")return t;return null}function Rr(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function Je(...r){for(const e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Ge(...r){for(const e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ar(r,e=2e3){return new Promise(t=>{const s=()=>{r.removeEventListener("error",s),r.removeEventListener("load",s),t()};r.addEventListener("load",s,{once:!0}),r.addEventListener("error",s,{once:!0}),setTimeout(t,e)})}function cs(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Lr(r){return r=="advance"||r=="replace"||r=="restore"}function ee(...r){const e=Qe("data-turbo-action",...r);return Lr(e)?e:null}function hs(r){return document.querySelector(`meta[name="${r}"]`)}function Se(r){const e=hs(r);return e&&e.content}function Tr(r,e){let t=hs(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function le(r,e){var t;if(r instanceof Element)return r.closest(e)||le(r.assignedSlot||((t=r.getRootNode())==null?void 0:t.host),e)}function _t(r){const e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";return!!r&&r.closest(e)==null&&typeof r.focus=="function"}function ds(r){return Array.from(r.querySelectorAll("[autofocus]")).find(_t)}async function Pr(r,e){const t=e();r(),await ns();const s=e();return[t,s]}function us(r){if(r.hasAttribute("target")){for(const e of document.getElementsByName(r.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function Cr(r){return le(r,"a[href]:not([target^=_]):not([download])")}function ms(r){return L(r.getAttribute("href")||"")}function Mr(r,e){let t=null;return(...s)=>{const i=()=>r.apply(this,s);clearTimeout(t),t=setTimeout(i,e)}}class kr extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){const s=this.values().next().value;this.delete(s)}super.add(e)}}const fs=new kr(20),Fr=window.fetch;function ps(r,e={}){const t=new Headers(e.headers||{}),s=$();return fs.add(s),t.append("X-Turbo-Request-Id",s),Fr(r,{...e,headers:t})}function xt(r){switch(r.toLowerCase()){case"get":return C.get;case"post":return C.post;case"put":return C.put;case"patch":return C.patch;case"delete":return C.delete}}const C={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Ir(r){switch(r.toLowerCase()){case Q.multipart:return Q.multipart;case Q.plain:return Q.plain;default:return Q.urlEncoded}}const Q={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};var Ae,tt,gs,st,bs;class Ne{constructor(e,t,s,i=new URLSearchParams,l=null,g=Q.urlEncoded){u(this,tt);u(this,st);c(this,"abortController",new AbortController);u(this,Ae,e=>{});var P;const[b,y]=Gt(L(s),t,i,g);this.delegate=e,this.url=b,this.target=l,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:y,signal:this.abortSignal,referrer:(P=this.delegate.referrer)==null?void 0:P.href},this.enctype=g}get method(){return this.fetchOptions.method}set method(e){const t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=xt(e)||C.get;this.url.search="";const[i,l]=Gt(this.url,s,t,this.enctype);this.url=i,this.fetchOptions.body=l,this.fetchOptions.method=s}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 m(this,tt,gs).call(this,e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=ps(this.url.href,e);const s=await this.response;return await this.receive(s)}catch(s){if(s.name!=="AbortError")throw m(this,st,bs).call(this,s)&&this.delegate.requestErrored(this,s),s}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new Ut(e);return E("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 $t(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}}Ae=new WeakMap,tt=new WeakSet,gs=async function(e){const t=new Promise(i=>S(this,Ae,i)),s=E("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:p(this,Ae)},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await t,s},st=new WeakSet,bs=function(e){return!E("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented};function $t(r){return xt(r)==C.get}function Gt(r,e,t,s){const i=Array.from(t).length>0?new URLSearchParams(vs(t)):r.searchParams;return $t(e)?[qr(r,i),null]:s==Q.urlEncoded?[r,i]:[r,t]}function vs(r){const e=[];for(const[t,s]of r)s instanceof File||e.push([t,s]);return e}function qr(r,e){const t=new URLSearchParams(vs(e));return r.search=t.toString(),r}class Hr{constructor(e,t){c(this,"started",!1);c(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 j{static wrap(e){return typeof e=="string"?new this(wr(e)):e}constructor(e){this.fragment=Br(e)}}c(j,"contentType","text/vnd.turbo-stream.html");function Br(r){for(const e of r.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const s of t.templateElement.content.querySelectorAll("script"))s.replaceWith(Re(s));e.replaceWith(t)}return r}const Or=100;var J,O;class Vr{constructor(){u(this,J,null);u(this,O,null)}get(e){if(p(this,O)&&p(this,O).url===e&&p(this,O).expire>Date.now())return p(this,O).request}setLater(e,t,s){this.clear(),S(this,J,setTimeout(()=>{t.perform(),this.set(e,t,s),S(this,J,null)},Or))}set(e,t,s){S(this,O,{url:e,request:t,expire:new Date(new Date().getTime()+s)})}clear(){p(this,J)&&clearTimeout(p(this,J)),S(this,O,null)}}J=new WeakMap,O=new WeakMap;const Dr=10*1e3,oe=new Vr,re={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class We{constructor(e,t,s,i=!1){c(this,"state",re.initialized);const l=$r(t,s),g=xr(_r(t,s),l),b=Nr(t,s),y=jr(t,s);this.delegate=e,this.formElement=t,this.submitter=s,this.fetchRequest=new Ne(this,l,g,b,t,y),this.mustRedirect=i}static confirmMethod(e,t,s){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=L(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}=re,s=Qe("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof s=="string"&&!await We.confirmMethod(s,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=re;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=Wr(Se("csrf-param"))||Se("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(j.contentType)}requestStarted(e){var t;this.state=re.waiting,(t=this.submitter)==null||t.setAttribute("disabled",""),this.setSubmitsWith(),Je(this.formElement),E("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){oe.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(oe.clear(),this.requestMustRedirect(e)&&Ur(t)){const s=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,s)}else this.state=re.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=re.stopped,(t=this.submitter)==null||t.removeAttribute("disabled"),this.resetSubmitterText(),Ge(this.formElement),E("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||Rr("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 Nr(r,e){const t=new FormData(r),s=e==null?void 0:e.getAttribute("name"),i=e==null?void 0:e.getAttribute("value");return s&&t.append(s,i||""),t}function Wr(r){if(r!=null){const t=(document.cookie?document.cookie.split("; "):[]).find(s=>s.startsWith(r));if(t){const s=t.split("=").slice(1).join("=");return s?decodeURIComponent(s):void 0}}}function Ur(r){return r.statusCode==200&&!r.redirected}function _r(r,e){const t=typeof r.action=="string"?r.action:null;return e!=null&&e.hasAttribute("formaction")?e.getAttribute("formaction")||"":r.getAttribute("action")||t||""}function xr(r,e){const t=L(r);return $t(e)&&(t.search=""),t}function $r(r,e){const t=(e==null?void 0:e.getAttribute("formmethod"))||r.getAttribute("method")||"";return xt(t.toLowerCase())||C.get}function jr(r,e){return Ir((e==null?void 0:e.getAttribute("formenctype"))||r.enctype)}class Ct{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 ds(this.element)}get permanentElements(){return ws(this.element)}getPermanentElementById(e){return Ss(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const s of this.permanentElements){const{id:i}=s,l=e.getPermanentElementById(i);l&&(t[i]=[s,l])}return t}}function Ss(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function ws(r){return r.querySelectorAll("[id][data-turbo-permanent]")}class jt{constructor(e,t){c(this,"started",!1);c(this,"submitCaptured",()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)});c(this,"submitBubbled",e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,s=e.submitter||void 0;t&&zr(t,s)&&Kr(t,s)&&this.delegate.willSubmitForm(t,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,s))}});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 zr(r,e){return((e==null?void 0:e.getAttribute("formmethod"))||r.getAttribute("method"))!="dialog"}function Kr(r,e){if(e!=null&&e.hasAttribute("formtarget")||r.hasAttribute("target")){const t=(e==null?void 0:e.getAttribute("formtarget"))||r.target;for(const s of document.getElementsByName(t))if(s instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Le,Te;class Es{constructor(e,t){u(this,Le,e=>{});u(this,Te,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(Z(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:s,willRender:i,newSnapshot:l}=e,g=i;if(s)try{this.renderPromise=new Promise(M=>S(this,Le,M)),this.renderer=e,await this.prepareToRenderSnapshot(e);const b=new Promise(M=>S(this,Te,M)),y={resume:p(this,Te),render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(l,y)||await b,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(l,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,p(this,Le).call(this,void 0),delete this.renderPromise}else g&&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()}}Le=new WeakMap,Te=new WeakMap;class Xr extends Es{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Ct(this.element)}}class ys{constructor(e,t){c(this,"clickBubbled",e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent});c(this,"linkClicked",e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent});c(this,"willVisit",e=>{delete this.clickEvent});this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}}class Rs{constructor(e,t){c(this,"started",!1);c(this,"clickCaptured",()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)});c(this,"clickBubbled",e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=e.composedPath&&e.composedPath()[0]||e.target,s=Cr(t);if(s&&us(s)){const i=ms(s);this.delegate.willFollowLinkToLocation(s,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(s,i))}}});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 As{constructor(e,t){this.delegate=e,this.linkInterceptor=new Rs(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,s){return this.delegate.willSubmitFormLinkToLocation(e,t,s)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){const s=document.createElement("form"),i="hidden";for(const[te,T]of t.searchParams)s.append(Object.assign(document.createElement("input"),{type:i,name:te,value:T}));const l=Object.assign(t,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",l.href),s.setAttribute("hidden","");const g=e.getAttribute("data-turbo-method");g&&s.setAttribute("method",g);const b=e.getAttribute("data-turbo-frame");b&&s.setAttribute("data-turbo-frame",b);const y=ee(e);y&&s.setAttribute("data-turbo-action",y);const P=e.getAttribute("data-turbo-confirm");P&&s.setAttribute("data-turbo-confirm",P),e.hasAttribute("data-turbo-stream")&&s.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,s),document.body.appendChild(s),s.addEventListener("turbo:submit-end",()=>s.remove(),{once:!0}),requestAnimationFrame(()=>s.requestSubmit())}}class Ls{static async preservingPermanentElements(e,t,s){const i=new this(e,t);i.enter(),await s(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(const e in this.permanentElementMap){const[t,s]=this.permanentElementMap[e];this.delegate.enteringBardo(t,s),this.replaceNewPermanentElementWithPlaceholder(s)}}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=Yr(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 Yr(r){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var V;class zt{constructor(e,t,s,i,l=!0){u(this,V,null);this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=l,this.renderElement=s,this.promise=new Promise((g,b)=>this.resolvingFunctions={resolve:g,reject:b})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Ls.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){const e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){p(this,V)||e.contains(this.currentSnapshot.activeElement)&&S(this,V,this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(p(this,V))&&p(this,V)instanceof HTMLElement&&(p(this,V).focus(),S(this,V,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"}}V=new WeakMap;class Ht extends zt{static renderElement(e,t){var g;const s=document.createRange();s.selectNodeContents(e),s.deleteContents();const i=t,l=(g=i.ownerDocument)==null?void 0:g.createRange();l&&(l.selectNodeContents(i),e.appendChild(l.extractContents()))}constructor(e,t,s,i,l,g=!0){super(t,s,i,l,g),this.delegate=e}get shouldRender(){return!0}async render(){await ae(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await ae(),this.focusFirstAutofocusableElement(),await ae(),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=Qr(this.currentElement.getAttribute("data-autoscroll-block"),"end"),s=Jr(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:s}),!0}return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=Re(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function Qr(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function Jr(r,e){return r=="auto"||r=="smooth"?r:e}const B=class B{constructor(){c(this,"hiding",!1);c(this,"value",0);c(this,"visible",!1);c(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 ls`
    47      .turbo-progress-bar {
    58        position: fixed;
     
    1114        z-index: 2147483647;
    1215        transition:
    13           width ${g.animationDuration}ms ease-out,
    14           opacity ${g.animationDuration/2}ms ${g.animationDuration/2}ms ease-in;
     16          width ${B.animationDuration}ms ease-out,
     17          opacity ${B.animationDuration/2}ms ${B.animationDuration/2}ms ease-in;
    1518        transform: translate3d(0, 0, 0);
    1619      }
    17     `}constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}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,g.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,g.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");return e.type="text/css",e.textContent=g.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return B("csp-nonce")}}g.animationDuration=300;class it extends D{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(e=>!at(e)).map(e=>ht(e)).reduce((e,t)=>{const{outerHTML:i}=t,r=i in e?e[i]:{type:rt(t),tracked:nt(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},r),{elements:[...r.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{const{type:i,tracked:r,elements:n}=this.detailsByOuterHTML[t];return i==null&&!r?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){const t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{const{elements:[r]}=this.detailsByOuterHTML[i];return ct(r,e)?r:t},void 0)}}function rt(s){if(ot(s))return"script";if(lt(s))return"stylesheet"}function nt(s){return s.getAttribute("data-turbo-track")=="reload"}function ot(s){return s.localName=="script"}function at(s){return s.localName=="noscript"}function lt(s){const e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function ct(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function ht(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}class p extends D{static fromHTMLString(e=""){return this.fromDocument(ie(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new it(e))}constructor(e,t){super(e),this.headSnapshot=t}clone(){const e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(const[r,n]of t.entries()){const o=i[r];for(const h of o.selectedOptions)h.selected=!1;for(const h of n.selectedOptions)o.options[h.index].selected=!0}for(const r of e.querySelectorAll('input[type="password"]'))r.value="";return new p(e,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;const t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return c(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}}var C;(function(s){s.visitStart="visitStart",s.requestStart="requestStart",s.requestEnd="requestEnd",s.visitEnd="visitEnd"})(C||(C={}));var m;(function(s){s.initialized="initialized",s.started="started",s.canceled="canceled",s.failed="failed",s.completed="completed"})(m||(m={}));const dt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1};var S;(function(s){s[s.networkFailure=0]="networkFailure",s[s.timeoutFailure=-1]="timeoutFailure",s[s.contentTypeMismatch=-2]="contentTypeMismatch"})(S||(S={}));class ut{constructor(e,t,i,r={}){this.identifier=P(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=m.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||P();const{action:n,historyChanged:o,referrer:h,snapshot:u,snapshotHTML:R,response:V,visitCachedSnapshot:T,willRender:M,updateHistory:be,shouldCacheSnapshot:we,acceptsStreamResponse:Ee}=Object.assign(Object.assign({},dt),r);this.action=n,this.historyChanged=o,this.referrer=h,this.snapshot=u,this.snapshotHTML=R,this.response=V,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=T,this.willRender=M,this.updateHistory=be,this.scrolled=!M,this.shouldCacheSnapshot=we,this.acceptsStreamResponse=Ee}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==m.initialized&&(this.recordTimingMetric(C.visitStart),this.state=m.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==m.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=m.canceled)}complete(){this.state==m.started&&(this.recordTimingMetric(C.visitEnd),this.state=m.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==m.started&&(this.state=m.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){const t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=ne(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new K(this,d.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(C.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;J(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(C.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,J(e)&&t!=null?(await this.view.renderPage(p.fromHTMLString(t),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(p.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!y(this.location)||e.hasAnchor(y(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return p.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.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&(!((e=this.response)===null||e===void 0)&&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(L.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:S.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:S.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:S.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(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=y(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function J(s){return s>=200&&s<300}class mt{constructor(e){this.progressBar=new g,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||P(),t)}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 S.networkFailure:case S.timeoutFailure:case S.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(e){this.reload(e)}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;l("turbo:reload",{detail:e}),window.location.href=((t=this.location)===null||t===void 0?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}}class pt{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,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]}}class ft{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new he(this,t),this.formSubmitObserver=new Q(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return this.shouldRedirect(e)}linkClickIntercepted(e,t,i){const r=this.findFrameElement(e);r&&r.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.shouldSubmit(e,t)&&this.shouldRedirect(e,t)}formSubmitted(e,t){const i=this.findFrameElement(e,t);i&&i.delegate.formSubmitted(e,t)}shouldSubmit(e,t){var i;const r=$(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=c((i=n==null?void 0:n.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&A(r,o)}shouldRedirect(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const r=this.findFrameElement(e,t);return r?r!=e.closest("turbo-frame"):!1}else return!1}findFrameElement(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 v)return r}}}class gt{constructor(e){this.restorationIdentifier=P(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){const{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);const{restorationIdentifier:r}=i;this.restorationIdentifier=r,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,r)}}},this.onPageLoad=async t=>{await Be(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=P()){const r={turbo:{restorationIdentifier:i}};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]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}}class vt{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(A(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new ut(this,c(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new k(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){const i=await t.responseHTML;if(i){const r=e.isSafe;r||this.view.clearSnapshotCache();const{statusCode:n,redirected:o}=t,u={action:this.getActionForFormSubmission(e),shouldCacheSnapshot:r,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(t.location,u)}}}async formSubmissionFailedWithResponse(e,t){const i=await t.responseHTML;if(i){const r=p.fromHTMLString(i);t.serverError?await this.view.renderError(r,this.currentVisit):await this.view.renderPage(r,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){const i=y(e),r=y(this.view.lastRenderedLocation),n=t==="restore"&&typeof i=="undefined";return t!=="replace"&&_(e)===_(this.view.lastRenderedLocation)&&(n||i!=null&&i!==r)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:e,formElement:t}){return N(e,t)||"advance"}}var f;(function(s){s[s.initial=0]="initial",s[s.loading=1]="loading",s[s.interactive=2]="interactive",s[s.complete=3]="complete"})(f||(f={}));class bt{constructor(e){this.stage=f.initial,this.started=!1,this.interpretReadyState=()=>{const{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==f.initial&&(this.stage=f.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==f.loading&&(this.stage=f.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==f.interactive&&(this.stage=f.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class wt{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}}class Et{render({fragment:e}){me.preservingPermanentElements(this,St(e),()=>document.documentElement.appendChild(e))}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}function St(s){const e=le(document.documentElement),t={};for(const i of e){const{id:r}=i;for(const n of s.querySelectorAll("turbo-stream")){const o=ae(n.templateElement.content,r);o&&(t[r]=[i,o])}}return t}class yt{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{const i=Lt(t);i&&Rt(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){const t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(L.wrap(e))}}function Lt(s){var e;const t=(e=s.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof z)return t}function Rt(s){var e;return((e=s.contentType)!==null&&e!==void 0?e:"").startsWith(L.contentType)}class G extends X{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=F(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}class j extends X{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){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 e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const e=[];for(const t of this.newHeadStylesheetElements)e.push(De(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(const e of this.newHeadScriptElements)document.head.appendChild(F(e))}async mergeProvisionalElements(){const e=[...this.newHeadProvisionalElements];for(const t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(const t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(const[i,r]of t.entries()){if(e.tagName=="TITLE"){if(r.tagName!="TITLE")continue;if(e.innerHTML==r.innerHTML)return t.splice(i,1),!0}if(r.isEqualNode(e))return t.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(const e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(const e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const e of this.newBodyScriptElements){const t=F(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}}class Tt{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return I(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[I(e)]}write(e,t){this.snapshots[I(e)]=t}touch(e){const t=I(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 Ct extends ce{constructor(){super(...arguments),this.snapshotCache=new Tt(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(e,t=!1,i=!0,r){const n=new j(this.snapshot,e,j.renderElement,t,i);return n.shouldRender?r==null||r.changeHistory():this.forceReloaded=!0,this.render(n)}renderError(e,t){t==null||t.changeHistory();const i=new G(this.snapshot,e,G.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:t}=this;await qe();const i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return p.fromElement(this.element)}}class At{constructor(e){this.selector="a[data-turbo-preload]",this.delegate=e}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(e){for(const t of e.querySelectorAll(this.selector))this.preloadURL(t)}async preloadURL(e){const t=new URL(e.href);if(!this.snapshotCache.has(t))try{const r=await(await fetch(t.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),n=p.fromHTMLString(r);this.snapshotCache.put(t,n)}catch(i){}}}class Pt{constructor(){this.navigator=new vt(this),this.history=new gt(this),this.preloader=new At(this),this.view=new Ct(this,document.documentElement),this.adapter=new mt(this),this.pageObserver=new bt(this),this.cacheObserver=new pt,this.linkClickObserver=new de(this,window),this.formSubmitObserver=new Q(this,document),this.scrollObserver=new wt(this),this.streamObserver=new yt(this),this.formLinkClickObserver=new ue(this,document.documentElement),this.frameRedirector=new ft(this,document.documentElement),this.streamMessageRenderer=new Et,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){const i=t.frame?document.getElementById(t.frame):null;i instanceof v?(i.src=e.toString(),i.loaded):this.navigator.proposeVisit(c(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(L.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&A(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&A(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){Z(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||x(document.documentElement),Z(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){W(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=$(e,t);return this.submissionIsNavigatable(e,t)&&A(c(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){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){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}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 l("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return l("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return l("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return l("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return l("turbo:before-render",{detail:Object.assign({newBody:e},t),cancelable:!0})}notifyApplicationAfterRender(){return l("turbo:render")}notifyApplicationAfterPageLoad(e={}){return l("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 l("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return l("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{const i=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=O(e,"[data-turbo]"),i=O(e,"turbo-frame");return this.drive||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return N(e)||"advance"}get snapshot(){return this.view.snapshot}}function Z(s){Object.defineProperties(s,Ft)}const Ft={absoluteURL:{get(){return this.toString()}}};class kt{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(e){_e("turbo-cache-control",e)}}const pe={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})}},a=new Pt,Mt=new kt(a),{navigator:It}=a;function fe(){a.start()}function Ht(s){a.registerAdapter(s)}function qt(s,e){a.visit(s,e)}function ge(s){a.connectStreamSource(s)}function ve(s){a.disconnectStreamSource(s)}function Bt(s){a.renderStreamMessage(s)}function Ot(){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.`"),a.clearCache()}function Nt(s){a.setProgressBarDelay(s)}function Dt(s){k.confirmMethod=s}function Vt(s){a.setFormMode(s)}var _t=Object.freeze({__proto__:null,navigator:It,session:a,cache:Mt,PageRenderer:j,PageSnapshot:p,FrameRenderer:U,start:fe,registerAdapter:Ht,visit:qt,connectStreamSource:ge,disconnectStreamSource:ve,renderStreamMessage:Bt,clearCache:Ot,setProgressBarDelay:Nt,setConfirmMethod:Dt,setFormMode:Vt,StreamActions:pe});class xt extends Error{}class Wt{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:t})=>{const i=t.querySelector("#"+this.element.id);i&&this.previousFrameElement&&i.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=e,this.view=new Je(this,this.element),this.appearanceObserver=new We(this,this.element),this.formLinkClickObserver=new ue(this,this.element),this.linkInterceptor=new he(this,this.element),this.restorationIdentifier=P(),this.formSubmitObserver=new Q(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==E.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==E.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==E.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){const{src:e}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==E.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(c(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{const t=await e.responseHTML;if(t){const i=ie(t);p.fromDocument(i).isVisitable?await this.loadFrameResponse(e,i):await this.handleUnvisitableFrameResponse(e)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,e),this.loadSourceURL()}willSubmitFormLinkToLocation(e){return this.shouldInterceptNavigation(e)}submittedFormLinkToLocation(e,t,i){const r=this.findFrameElement(e);r&&i.setAttribute("data-turbo-frame",r.id)}shouldInterceptLinkClick(e,t,i){return this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.navigateFrame(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new k(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===void 0)&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(L.contentType)}requestStarted(e){x(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){W(this.element)}formSubmissionStarted({formElement:e}){x(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){const i=this.findFrameElement(e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t),e.isSafe||a.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),a.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){W(e,this.findFrameElement(e))}allowsImmediateRender({element:e},t){const i=l("turbo:before-frame-render",{target:this.element,detail:Object.assign({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){}preloadOnLoadLinksForView(e){a.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}async loadFrameResponse(e,t){const i=await this.extractForeignFrameElement(t.body);if(i){const r=new D(i),n=new U(this,this.view.snapshot,r,U.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,a.frameRendered(e,this.element),a.frameLoaded(this.element),this.fetchResponseLoaded(e)}else this.willHandleFrameMissingFromResponse(e)&&this.handleFrameMissingFromResponse(e)}async visit(e){var t;const i=new K(this,d.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(r=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,r()},i.perform()})}navigateFrame(e,t,i){const r=this.findFrameElement(e,i);r.delegate.proposeVisitIfNavigatedWithAction(r,e,i),this.withCurrentNavigationElement(e,()=>{r.src=t})}proposeVisitIfNavigatedWithAction(e,t,i){if(this.action=N(i,t,e),this.action){const r=p.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=o=>{if(e.src){const{statusCode:h,redirected:u}=o,R=e.ownerDocument.documentElement.outerHTML,T={response:{statusCode:h,redirected:u,responseHTML:R},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(T.action=this.action),a.visit(e.src,T)}}}}changeHistory(){if(this.action){const e=ne(this.action);a.history.update(e,c(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(e.response)}willHandleFrameMissingFromResponse(e){this.element.setAttribute("complete","");const t=e.response,i=async(n,o={})=>{n instanceof Response?this.visitResponse(n):a.visit(n,o)};return!l("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(e){this.view.missing(),this.throwFrameMissingError(e)}throwFrameMissingError(e){const t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new xt(t)}async visitResponse(e){const t=new z(e),i=await t.responseHTML,{location:r,redirected:n,statusCode:o}=t;return a.visit(r,{response:{redirected:n,statusCode:o,responseHTML:i}})}findFrameElement(e,t){var i;const r=q("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=ee(r))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t;const i=CSS.escape(this.id);try{if(t=te(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=te(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 v}return null}formActionIsVisitable(e,t){const i=$(e,t);return A(c(i),this.rootLocation)}shouldInterceptNavigation(e,t){const i=q("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){const r=ee(i);if(r)return!r.disabled}return!(!a.elementIsNavigatable(e)||t&&!a.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.ignoringChangesToAttribute("src",()=>{this.element.src=e!=null?e:null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.ignoringChangesToAttribute("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;const t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t==null?void 0:t.content)!==null&&e!==void 0?e:"/";return c(i)}isIgnoringChangesTo(e){return this.ignoredAttributes.has(e)}ignoringChangesToAttribute(e,t){this.ignoredAttributes.add(e),t(),this.ignoredAttributes.delete(e)}withCurrentNavigationElement(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}}function ee(s){if(s!=null){const e=document.getElementById(s);if(e instanceof v)return e}}function te(s,e){if(s){const t=s.getAttribute("src");if(t!=null&&e!=null&&Ae(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof v)return s.connectedCallback(),s.disconnectedCallback(),s}}class Y extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{const t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await H(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch(e){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;const t=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),i=[...((e=this.templateContent)===null||e===void 0?void 0:e.children)||[]].filter(r=>!!r.id).map(r=>r.id);return t.filter(r=>i.includes(r.id))}get performAction(){if(this.action){const e=pe[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){const e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:Y.renderElement}})}get targetElementsById(){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}}class Ut extends HTMLElement{constructor(){super(...arguments),this.streamSource=null}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),ge(this.streamSource)}disconnectedCallback(){this.streamSource&&ve(this.streamSource)}get src(){return this.getAttribute("src")||""}}v.delegateConstructor=Wt;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",v);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Y);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ut);(()=>{let s=document.currentScript;if(s&&!s.hasAttribute("data-turbo-suppress-warning"))for(s=s.parentElement;s;){if(s==document.body)return console.warn(re`
     20    `}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,B.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,B.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");return e.type="text/css",e.textContent=B.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return Se("csp-nonce")}};c(B,"animationDuration",300);let Bt=B;class Gr extends Ct{constructor(){super(...arguments);c(this,"detailsByOuterHTML",this.children.filter(t=>!si(t)).map(t=>ni(t)).reduce((t,s)=>{const{outerHTML:i}=s,l=i in t?t[i]:{type:Zr(s),tracked:ei(s),elements:[]};return{...t,[i]:{...l,elements:[...l.elements,s]}}},{}))}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,s){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in s.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==t).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,s)=>{const{type:i,tracked:l,elements:g}=this.detailsByOuterHTML[s];return i==null&&!l?[...t,...g]:g.length>1?[...t,...g.slice(1)]:t},[])}getMetaValue(t){const s=this.findMetaElementByName(t);return s?s.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((s,i)=>{const{elements:[l]}=this.detailsByOuterHTML[i];return ii(l,t)?l:s},void 0|void 0)}}function Zr(r){if(ti(r))return"script";if(ri(r))return"stylesheet"}function ei(r){return r.getAttribute("data-turbo-track")=="reload"}function ti(r){return r.localName=="script"}function si(r){return r.localName=="noscript"}function ri(r){const e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function ii(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function ni(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}class k extends Ct{static fromHTMLString(e=""){return this.fromDocument(as(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:s}){return new this(e,t,new Gr(s))}constructor(e,t,s){super(t),this.documentElement=e,this.headSnapshot=s}clone(){const e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),s=e.querySelectorAll("select");for(const[i,l]of t.entries()){const g=s[i];for(const b of g.selectedOptions)b.selected=!1;for(const b of l.selectedOptions)g.options[b.index].selected=!0}for(const i of e.querySelectorAll('input[type="password"]'))i.value="";return new k(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){var t;const e=(t=this.getSetting("root"))!=null?t:"/";return L(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 Pe,W;class oi{constructor(){u(this,Pe,!1);u(this,W,Promise.resolve())}renderChange(e,t){return e&&this.viewTransitionsAvailable&&!p(this,Pe)?(S(this,Pe,!0),S(this,W,p(this,W).then(async()=>{await document.startViewTransition(t).finished}))):S(this,W,p(this,W).then(t)),p(this,W)}get viewTransitionsAvailable(){return document.startViewTransition}}Pe=new WeakMap,W=new WeakMap;const ai={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},xe={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},H={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ce={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},li={advance:"forward",restore:"back",replace:"none"};class ci{constructor(e,t,s,i={}){c(this,"identifier",$());c(this,"timingMetrics",{});c(this,"followedRedirect",!1);c(this,"historyChanged",!1);c(this,"scrolled",!1);c(this,"shouldCacheSnapshot",!0);c(this,"acceptsStreamResponse",!1);c(this,"snapshotCached",!1);c(this,"state",H.initialized);c(this,"viewTransitioner",new oi);this.delegate=e,this.location=t,this.restorationIdentifier=s||$();const{action:l,historyChanged:g,referrer:b,snapshot:y,snapshotHTML:P,response:M,visitCachedSnapshot:te,willRender:T,updateHistory:Mt,shouldCacheSnapshot:kt,acceptsStreamResponse:Ue,direction:se}={...ai,...i};this.action=l,this.historyChanged=g,this.referrer=b,this.snapshot=y,this.snapshotHTML=P,this.response=M,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=te,this.willRender=T,this.updateHistory=Mt,this.scrolled=!T,this.shouldCacheSnapshot=kt,this.acceptsStreamResponse=Ue,this.direction=se||li[l]}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==H.initialized&&(this.recordTimingMetric(xe.visitStart),this.state=H.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==H.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=H.canceled)}complete(){this.state==H.started&&(this.recordTimingMetric(xe.visitEnd),this.adapter.visitCompleted(this),this.state=H.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==H.started&&(this.state=H.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,s=cs(t);this.history.update(s,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Ne(this,C.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(xe.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;Zt(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(xe.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,Zt(e)&&t!=null){const s=k.fromHTMLString(t);await this.renderPageSnapshot(s,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(k.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Z(this.location)||e.hasAnchor(Z(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return k.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(j.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){const s=await t.responseHTML,{redirected:i,statusCode:l}=t;s==null?this.recordResponse({statusCode:ce.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:l,responseHTML:s,redirected:i}))}async requestFailedWithResponse(e,t){const s=await t.responseHTML,{redirected:i,statusCode:l}=t;s==null?this.recordResponse({statusCode:ce.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:l,responseHTML:s,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:ce.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=Z(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await ae(),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 Zt(r){return r>=200&&r<300}class hi{constructor(e){c(this,"progressBar",new Bt);c(this,"showProgressBar",()=>{this.progressBar.show()});this.session=e}visitProposedToLocation(e,t){N(e,this.navigator.rootLocation)?this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||$(),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 ce.networkFailure:case ce.timeoutFailure:case ce.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;E("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 di{constructor(){c(this,"selector","[data-turbo-temporary]");c(this,"deprecatedSelector","[data-turbo-cache=false]");c(this,"started",!1);c(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 rt,Ts,he,$e,de,je;class ui{constructor(e,t){u(this,rt);u(this,he);u(this,de);this.session=e,this.element=t,this.linkInterceptor=new ys(this,t),this.formSubmitObserver=new jt(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,s){return m(this,he,$e).call(this,e)}linkClickIntercepted(e,t,s){const i=m(this,de,je).call(this,e);i&&i.delegate.linkClickIntercepted(e,t,s)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&m(this,rt,Ts).call(this,e,t)&&m(this,he,$e).call(this,e,t)}formSubmitted(e,t){const s=m(this,de,je).call(this,e,t);s&&s.delegate.formSubmitted(e,t)}}rt=new WeakSet,Ts=function(e,t){var g;const s=Wt(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),l=L((g=i==null?void 0:i.content)!=null?g:"/");return m(this,he,$e).call(this,e,t)&&N(s,l)},he=new WeakSet,$e=function(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const i=m(this,de,je).call(this,e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1},de=new WeakSet,je=function(e,t){const s=(t==null?void 0:t.getAttribute("data-turbo-frame"))||e.getAttribute("data-turbo-frame");if(s&&s!="_top"){const i=this.element.querySelector(`#${s}:not([disabled])`);if(i instanceof I)return i}};class mi{constructor(e){c(this,"location");c(this,"restorationIdentifier",$());c(this,"restorationData",{});c(this,"started",!1);c(this,"pageLoaded",!1);c(this,"currentIndex",0);c(this,"onPopState",e=>{if(this.shouldHandlePopState()){const{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);const{restorationIdentifier:s,restorationIndex:i}=t;this.restorationIdentifier=s;const l=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,s,l),this.currentIndex=i}}});c(this,"onPageLoad",async e=>{await Er(),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,s=$()){e===history.pushState&&++this.currentIndex;const i={turbo:{restorationIdentifier:s,restorationIndex:this.currentIndex}};e.call(history,i,"",t.href),this.location=t,this.restorationIdentifier=s}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){const{restorationIdentifier:t}=this,s=this.restorationData[t];this.restorationData[t]={...s,...e}}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!=null?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}}var ue,Ce,Me,ke,it,Fe,nt,Ps,ot,Cs;class fi{constructor(e,t){u(this,nt);u(this,ot);c(this,"started",!1);u(this,ue,null);u(this,Ce,()=>{this.eventTarget.addEventListener("mouseenter",p(this,Me),{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",p(this,ke),{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",p(this,Fe),!0),this.started=!0});u(this,Me,e=>{if(Se("turbo-prefetch")==="false")return;const t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&m(this,ot,Cs).call(this,t)){const i=t,l=ms(i);if(this.delegate.canPrefetchRequestToLocation(i,l)){S(this,ue,i);const g=new Ne(this,C.get,l,new URLSearchParams,t);oe.setLater(l.toString(),g,p(this,nt,Ps))}}});u(this,ke,e=>{e.target===p(this,ue)&&p(this,it).call(this)});u(this,it,()=>{oe.clear(),S(this,ue,null)});u(this,Fe,e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="get"){const t=oe.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),oe.clear()}});this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",p(this,Ce),{once:!0}):p(this,Ce).call(this))}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",p(this,Me),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",p(this,ke),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",p(this,Fe),!0),this.started=!1)}prepareRequest(e){const t=e.target;e.headers["X-Sec-Purpose"]="prefetch";const s=t.closest("turbo-frame"),i=t.getAttribute("data-turbo-frame")||(s==null?void 0:s.getAttribute("target"))||(s==null?void 0:s.id);i&&i!=="_top"&&(e.headers["Turbo-Frame"]=i),t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(j.contentType)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}ue=new WeakMap,Ce=new WeakMap,Me=new WeakMap,ke=new WeakMap,it=new WeakMap,Fe=new WeakMap,nt=new WeakSet,Ps=function(){return Number(Se("turbo-prefetch-cache-time"))||Dr},ot=new WeakSet,Cs=function(e){const t=e.getAttribute("href");if(!t||t.startsWith("#")||e.getAttribute("data-turbo")==="false"||e.getAttribute("data-turbo-prefetch")==="false"||E("turbo:before-prefetch",{target:e,cancelable:!0}).defaultPrevented||e.origin!==document.location.origin||!["http:","https:"].includes(e.protocol)||e.pathname+e.search===document.location.pathname+document.location.search)return!1;const i=e.getAttribute("data-turbo-method");if(i&&i!=="get"||pi(e))return!1;const l=le(e,"[data-turbo-prefetch]");return!(l&&l.getAttribute("data-turbo-prefetch")==="false")};const pi=r=>!us(r);var at,Ms,lt,ks;class gi{constructor(e){u(this,at);u(this,lt);this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,s={}){this.stop(),this.currentVisit=new ci(this,L(e),t,{referrer:this.location,...s}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new We(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 s=await t.responseHTML;if(s){const i=e.isSafe;i||this.view.clearSnapshotCache();const{statusCode:l,redirected:g}=t,y={action:m(this,at,Ms).call(this,e,t),shouldCacheSnapshot:i,response:{statusCode:l,responseHTML:s,redirected:g}};this.proposeVisit(t.location,y)}}}async formSubmissionFailedWithResponse(e,t){const s=await t.responseHTML;if(s){const i=k.fromHTMLString(s);t.serverError?await this.view.renderError(i,this.currentVisit):await this.view.renderPage(i,!1,!0,this.currentVisit),i.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){const s=Z(e),i=Z(this.view.lastRenderedLocation),l=t==="restore"&&typeof s=="undefined";return t!=="replace"&&qt(e)===qt(this.view.lastRenderedLocation)&&(l||s!=null&&s!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}}at=new WeakSet,Ms=function(e,t){const{submitter:s,formElement:i}=e;return ee(s,i)||m(this,lt,ks).call(this,t)},lt=new WeakSet,ks=function(e){var s;return e.redirected&&e.location.href===((s=this.location)==null?void 0:s.href)?"replace":"advance"};const X={initial:0,loading:1,interactive:2,complete:3};class bi{constructor(e){c(this,"stage",X.initial);c(this,"started",!1);c(this,"interpretReadyState",()=>{const{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()});c(this,"pageWillUnload",()=>{this.delegate.pageWillUnload()});this.delegate=e}start(){this.started||(this.stage==X.initial&&(this.stage=X.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==X.loading&&(this.stage=X.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==X.interactive&&(this.stage=X.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class vi{constructor(e){c(this,"started",!1);c(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 Si{render({fragment:e}){Ls.preservingPermanentElements(this,wi(e),()=>{Ei(e,()=>{yi(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}function wi(r){const e=ws(document.documentElement),t={};for(const s of e){const{id:i}=s;for(const l of r.querySelectorAll("turbo-stream")){const g=Ss(l.templateElement.content,i);g&&(t[i]=[s,g])}}return t}async function Ei(r,e){const t=`turbo-stream-autofocus-${$()}`,s=r.querySelectorAll("turbo-stream"),i=Ri(s);let l=null;if(i&&(i.id?l=i.id:l=t,i.id=l),e(),await ae(),(document.activeElement==null||document.activeElement==document.body)&&l){const b=document.getElementById(l);_t(b)&&b.focus(),b&&b.id==t&&b.removeAttribute("id")}}async function yi(r){const[e,t]=await Pr(r,()=>document.activeElement),s=e&&e.id;if(s){const i=document.getElementById(s);_t(i)&&i!=t&&i.focus()}}function Ri(r){for(const e of r){const t=ds(e.templateElement.content);if(t)return t}return null}var U;class Ai{constructor(e){c(this,"sources",new Set);u(this,U,!1);c(this,"inspectFetchResponse",e=>{const t=Li(e);t&&Ti(t)&&(e.preventDefault(),this.receiveMessageResponse(t))});c(this,"receiveMessageEvent",e=>{p(this,U)&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)});this.delegate=e}start(){p(this,U)||(S(this,U,!0),addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){p(this,U)&&(S(this,U,!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(j.wrap(e))}}U=new WeakMap;function Li(r){var t;const e=(t=r.detail)==null?void 0:t.fetchResponse;if(e instanceof Ut)return e}function Ti(r){var t;return((t=r.contentType)!=null?t:"").startsWith(j.contentType)}class es extends zt{static renderElement(e,t){const{documentElement:s,body:i}=document;s.replaceChild(t,i)}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 s=Re(e);t.replaceChild(s,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}var Pi=function(){let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:T,afterNodeAdded:T,beforeNodeMorphed:T,afterNodeMorphed:T,beforeNodeRemoved:T,afterNodeRemoved:T,beforeAttributeUpdated:T},head:{style:"merge",shouldPreserve:function(n){return n.getAttribute("im-preserve")==="true"},shouldReAppend:function(n){return n.getAttribute("im-re-append")==="true"},shouldRemove:T,afterHeadMorphed:T}};function t(n,o,a={}){n instanceof Document&&(n=n.documentElement),typeof o=="string"&&(o=Js(o));let h=Gs(o),d=kt(n,h,a);return s(n,h,d)}function s(n,o,a){if(a.head.block){let h=n.querySelector("head"),d=o.querySelector("head");if(h&&d){let f=te(d,h,a);Promise.all(f).then(function(){s(n,o,Object.assign(a,{head:{block:!1,ignore:!0}}))});return}}if(a.morphStyle==="innerHTML")return g(o,n,a),n.children;if(a.morphStyle==="outerHTML"||a.morphStyle==null){let h=er(o,n,a),d=h==null?void 0:h.previousSibling,f=h==null?void 0:h.nextSibling,v=l(n,h,a);return h?Zs(d,v,f):[]}else throw"Do not understand how to morph style "+a.morphStyle}function i(n,o){return o.ignoreActiveValue&&n===document.activeElement&&n!==document.body}function l(n,o,a){if(!(a.ignoreActive&&n===document.activeElement))return o==null?a.callbacks.beforeNodeRemoved(n)===!1?n:(n.remove(),a.callbacks.afterNodeRemoved(n),null):se(n,o)?(a.callbacks.beforeNodeMorphed(n,o)===!1||(n instanceof HTMLHeadElement&&a.head.ignore||(n instanceof HTMLHeadElement&&a.head.style!=="morph"?te(o,n,a):(y(o,n,a),i(n,a)||g(o,n,a))),a.callbacks.afterNodeMorphed(n,o)),n):a.callbacks.beforeNodeRemoved(n)===!1||a.callbacks.beforeNodeAdded(o)===!1?n:(n.parentElement.replaceChild(o,n),a.callbacks.afterNodeAdded(o),a.callbacks.afterNodeRemoved(n),o)}function g(n,o,a){let h=n.firstChild,d=o.firstChild,f;for(;h;){if(f=h,h=f.nextSibling,d==null){if(a.callbacks.beforeNodeAdded(f)===!1)return;o.appendChild(f),a.callbacks.afterNodeAdded(f),z(a,f);continue}if(Ue(f,d,a)){l(d,f,a),d=d.nextSibling,z(a,f);continue}let v=Ys(n,o,f,d,a);if(v){d=Xt(d,v,a),l(v,f,a),z(a,f);continue}let R=Qs(n,o,f,d,a);if(R){d=Xt(d,R,a),l(R,f,a),z(a,f);continue}if(a.callbacks.beforeNodeAdded(f)===!1)return;o.insertBefore(f,d),a.callbacks.afterNodeAdded(f),z(a,f)}for(;d!==null;){let v=d;d=d.nextSibling,Yt(v,a)}}function b(n,o,a,h){return n==="value"&&h.ignoreActiveValue&&o===document.activeElement?!0:h.callbacks.beforeAttributeUpdated(n,o,a)===!1}function y(n,o,a){let h=n.nodeType;if(h===1){const d=n.attributes,f=o.attributes;for(const v of d)b(v.name,o,"update",a)||o.getAttribute(v.name)!==v.value&&o.setAttribute(v.name,v.value);for(let v=f.length-1;0<=v;v--){const R=f[v];b(R.name,o,"remove",a)||n.hasAttribute(R.name)||o.removeAttribute(R.name)}}(h===8||h===3)&&o.nodeValue!==n.nodeValue&&(o.nodeValue=n.nodeValue),i(o,a)||M(n,o,a)}function P(n,o,a,h){if(n[a]!==o[a]){let d=b(a,o,"update",h);d||(o[a]=n[a]),n[a]?d||o.setAttribute(a,n[a]):b(a,o,"remove",h)||o.removeAttribute(a)}}function M(n,o,a){if(n instanceof HTMLInputElement&&o instanceof HTMLInputElement&&n.type!=="file"){let h=n.value,d=o.value;P(n,o,"checked",a),P(n,o,"disabled",a),n.hasAttribute("value")?h!==d&&(b("value",o,"update",a)||(o.setAttribute("value",h),o.value=h)):b("value",o,"remove",a)||(o.value="",o.removeAttribute("value"))}else if(n instanceof HTMLOptionElement)P(n,o,"selected",a);else if(n instanceof HTMLTextAreaElement&&o instanceof HTMLTextAreaElement){let h=n.value,d=o.value;if(b("value",o,"update",a))return;h!==d&&(o.value=h),o.firstChild&&o.firstChild.nodeValue!==h&&(o.firstChild.nodeValue=h)}}function te(n,o,a){let h=[],d=[],f=[],v=[],R=a.head.style,K=new Map;for(const A of n.children)K.set(A.outerHTML,A);for(const A of o.children){let q=K.has(A.outerHTML),Ee=a.head.shouldReAppend(A),Ft=a.head.shouldPreserve(A);q||Ft?Ee?d.push(A):(K.delete(A.outerHTML),f.push(A)):R==="append"?Ee&&(d.push(A),v.push(A)):a.head.shouldRemove(A)!==!1&&d.push(A)}v.push(...K.values());let Jt=[];for(const A of v){let q=document.createRange().createContextualFragment(A.outerHTML).firstChild;if(a.callbacks.beforeNodeAdded(q)!==!1){if(q.href||q.src){let Ee=null,Ft=new Promise(function(nr){Ee=nr});q.addEventListener("load",function(){Ee()}),Jt.push(Ft)}o.appendChild(q),a.callbacks.afterNodeAdded(q),h.push(q)}}for(const A of d)a.callbacks.beforeNodeRemoved(A)!==!1&&(o.removeChild(A),a.callbacks.afterNodeRemoved(A));return a.head.afterHeadMorphed(o,{added:h,kept:f,removed:d}),Jt}function T(){}function Mt(n){let o={};return Object.assign(o,e),Object.assign(o,n),o.callbacks={},Object.assign(o.callbacks,e.callbacks),Object.assign(o.callbacks,n.callbacks),o.head={},Object.assign(o.head,e.head),Object.assign(o.head,n.head),o}function kt(n,o,a){return a=Mt(a),{target:n,newContent:o,config:a,morphStyle:a.morphStyle,ignoreActive:a.ignoreActive,ignoreActiveValue:a.ignoreActiveValue,idMap:ir(n,o),deadIds:new Set,callbacks:a.callbacks,head:a.head}}function Ue(n,o,a){return n==null||o==null?!1:n.nodeType===o.nodeType&&n.tagName===o.tagName?n.id!==""&&n.id===o.id?!0:we(a,n,o)>0:!1}function se(n,o){return n==null||o==null?!1:n.nodeType===o.nodeType&&n.tagName===o.tagName}function Xt(n,o,a){for(;n!==o;){let h=n;n=n.nextSibling,Yt(h,a)}return z(a,o),o.nextSibling}function Ys(n,o,a,h,d){let f=we(d,a,o),v=null;if(f>0){let R=h,K=0;for(;R!=null;){if(Ue(a,R,d))return R;if(K+=we(d,R,n),K>f)return null;R=R.nextSibling}}return v}function Qs(n,o,a,h,d){let f=h,v=a.nextSibling,R=0;for(;f!=null;){if(we(d,f,n)>0)return null;if(se(a,f))return f;if(se(v,f)&&(R++,v=v.nextSibling,R>=2))return null;f=f.nextSibling}return f}function Js(n){let o=new DOMParser,a=n.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(a.match(/<\/html>/)||a.match(/<\/head>/)||a.match(/<\/body>/)){let h=o.parseFromString(n,"text/html");if(a.match(/<\/html>/))return h.generatedByIdiomorph=!0,h;{let d=h.firstChild;return d?(d.generatedByIdiomorph=!0,d):null}}else{let d=o.parseFromString("<body><template>"+n+"</template></body>","text/html").body.querySelector("template").content;return d.generatedByIdiomorph=!0,d}}function Gs(n){if(n==null)return document.createElement("div");if(n.generatedByIdiomorph)return n;if(n instanceof Node){const o=document.createElement("div");return o.append(n),o}else{const o=document.createElement("div");for(const a of[...n])o.append(a);return o}}function Zs(n,o,a){let h=[],d=[];for(;n!=null;)h.push(n),n=n.previousSibling;for(;h.length>0;){let f=h.pop();d.push(f),o.parentElement.insertBefore(f,o)}for(d.push(o);a!=null;)h.push(a),d.push(a),a=a.nextSibling;for(;h.length>0;)o.parentElement.insertBefore(h.pop(),o.nextSibling);return d}function er(n,o,a){let h;h=n.firstChild;let d=h,f=0;for(;h;){let v=tr(h,o,a);v>f&&(d=h,f=v),h=h.nextSibling}return d}function tr(n,o,a){return se(n,o)?.5+we(a,n,o):0}function Yt(n,o){z(o,n),o.callbacks.beforeNodeRemoved(n)!==!1&&(n.remove(),o.callbacks.afterNodeRemoved(n))}function sr(n,o){return!n.deadIds.has(o)}function rr(n,o,a){return(n.idMap.get(a)||r).has(o)}function z(n,o){let a=n.idMap.get(o)||r;for(const h of a)n.deadIds.add(h)}function we(n,o,a){let h=n.idMap.get(o)||r,d=0;for(const f of h)sr(n,f)&&rr(n,f,a)&&++d;return d}function Qt(n,o){let a=n.parentElement,h=n.querySelectorAll("[id]");for(const d of h){let f=d;for(;f!==a&&f!=null;){let v=o.get(f);v==null&&(v=new Set,o.set(f,v)),v.add(d.id),f=f.parentElement}}}function ir(n,o){let a=new Map;return Qt(n,a),Qt(o,a),a}return{morph:t,defaults:e}}(),ct,Fs;class Ze extends zt{constructor(){super(...arguments);u(this,ct)}static renderElement(t,s){document.body&&s instanceof HTMLBodyElement?document.body.replaceWith(s):document.documentElement.appendChild(s)}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(){m(this,ct,Fs).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(),s=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await s,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 s of this.newHeadStylesheetElements)t.push(Ar(s)),document.head.appendChild(s);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(Re(t))}removeUnusedDynamicStylesheetElements(){for(const t of this.unusedDynamicStylesheetElements)document.head.removeChild(t)}async mergeProvisionalElements(){const t=[...this.newHeadProvisionalElements];for(const s of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(s,t)||document.head.removeChild(s);for(const s of t)document.head.appendChild(s)}isCurrentElementInElementList(t,s){for(const[i,l]of s.entries()){if(t.tagName=="TITLE"){if(l.tagName!="TITLE")continue;if(t.innerHTML==l.innerHTML)return s.splice(i,1),!0}if(l.isEqualNode(t))return s.splice(i,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 s=Re(t);t.replaceWith(s)}}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")}}ct=new WeakSet,Fs=function(){const{documentElement:t}=this.currentSnapshot,{lang:s}=this.newSnapshot;s?t.setAttribute("lang",s):t.removeAttribute("lang")};var ht,Is,Ie,Ot,dt,qe,ut,mt,ft,pt,qs,gt,Hs,bt,me,ze,vt,Bs;class Ci extends Ze{constructor(){super(...arguments);u(this,ht);u(this,Ie);u(this,pt);u(this,gt);u(this,me);u(this,vt);u(this,dt,t=>!(t.id&&t.hasAttribute("data-turbo-permanent")&&document.getElementById(t.id)));u(this,qe,(t,s)=>{if(t instanceof HTMLElement)return!t.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!m(this,me,ze).call(this,t))?!E("turbo:before-morph-element",{cancelable:!0,target:t,detail:{newElement:s}}).defaultPrevented:!1});u(this,ut,(t,s,i)=>!E("turbo:before-morph-attribute",{cancelable:!0,target:s,detail:{attributeName:t,mutationType:i}}).defaultPrevented);u(this,mt,(t,s)=>{s instanceof HTMLElement&&E("turbo:morph-element",{target:t,detail:{newElement:s}})});u(this,ft,t=>p(this,qe).call(this,t));u(this,bt,(t,s)=>{E("turbo:before-frame-morph",{target:t,detail:{currentElement:t,newElement:s}}),m(this,Ie,Ot).call(this,t,s.children,"innerHTML")})}async render(){this.willRender&&await m(this,ht,Is).call(this)}get renderMethod(){return"morph"}}ht=new WeakSet,Is=async function(){m(this,Ie,Ot).call(this,this.currentElement,this.newElement),m(this,pt,qs).call(this),E("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})},Ie=new WeakSet,Ot=function(t,s,i="outerHTML"){this.isMorphingTurboFrame=m(this,me,ze).call(this,t),Pi.morph(t,s,{ignoreActiveValue:!0,morphStyle:i,callbacks:{beforeNodeAdded:p(this,dt),beforeNodeMorphed:p(this,qe),beforeAttributeUpdated:p(this,ut),beforeNodeRemoved:p(this,ft),afterNodeMorphed:p(this,mt)}})},dt=new WeakMap,qe=new WeakMap,ut=new WeakMap,mt=new WeakMap,ft=new WeakMap,pt=new WeakSet,qs=function(){m(this,vt,Bs).call(this).forEach(t=>{m(this,me,ze).call(this,t)&&(m(this,gt,Hs).call(this,t),t.reload())})},gt=new WeakSet,Hs=function(t){t.addEventListener("turbo:before-frame-render",s=>{s.detail.render=p(this,bt)},{once:!0})},bt=new WeakMap,me=new WeakSet,ze=function(t){return t.src&&t.refresh==="morph"},vt=new WeakSet,Bs=function(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(t=>!t.closest("[data-turbo-permanent]"))};class Mi{constructor(e){c(this,"keys",[]);c(this,"snapshots",{});this.size=e}has(e){return _e(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[_e(e)]}write(e,t){this.snapshots[_e(e)]=t}touch(e){const t=_e(e),s=this.keys.indexOf(t);s>-1&&this.keys.splice(s,1),this.keys.unshift(t),this.trim()}trim(){for(const e of this.keys.splice(this.size))delete this.snapshots[e]}}class ki extends Es{constructor(){super(...arguments);c(this,"snapshotCache",new Mi(10));c(this,"lastRenderedLocation",new URL(location.href));c(this,"forceReloaded",!1)}shouldTransitionTo(t){return this.snapshot.prefersViewTransitions&&t.prefersViewTransitions}renderPage(t,s=!1,i=!0,l){const b=this.isPageRefresh(l)&&this.snapshot.shouldMorphPage?Ci:Ze,y=new b(this.snapshot,t,Ze.renderElement,s,i);return y.shouldRender?l==null||l.changeHistory():this.forceReloaded=!0,this.render(y)}renderError(t,s){s==null||s.changeHistory();const i=new es(this.snapshot,t,es.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:s}=this;await os();const i=t.clone();return this.snapshotCache.put(s,i),i}}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 k.fromElement(this.element)}}var He;class Fi{constructor(e,t){c(this,"selector","a[data-turbo-preload]");u(this,He,()=>{this.preloadOnLoadLinksForView(document.body)});this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",p(this,He)):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",p(this,He))}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 Ne(this,C.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{const s=await t.responseHTML,i=k.fromHTMLString(s);this.snapshotCache.put(e.url,i)}catch(s){}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}He=new WeakMap;var fe,Ke;class Ii{constructor(e){u(this,fe);this.session=e}clear(){this.session.clearCache()}resetCacheControl(){m(this,fe,Ke).call(this,"")}exemptPageFromCache(){m(this,fe,Ke).call(this,"no-cache")}exemptPageFromPreview(){m(this,fe,Ke).call(this,"no-preview")}}fe=new WeakSet,Ke=function(e){Tr("turbo-cache-control",e)};var Be;class qi{constructor(e){c(this,"navigator",new gi(this));c(this,"history",new mi(this));c(this,"view",new ki(this,document.documentElement));c(this,"adapter",new hi(this));c(this,"pageObserver",new bi(this));c(this,"cacheObserver",new di);c(this,"linkPrefetchObserver",new fi(this,document));c(this,"linkClickObserver",new Rs(this,window));c(this,"formSubmitObserver",new jt(this,document));c(this,"scrollObserver",new vi(this));c(this,"streamObserver",new Ai(this));c(this,"formLinkClickObserver",new As(this,document.documentElement));c(this,"frameRedirector",new ui(this,document.documentElement));c(this,"streamMessageRenderer",new Si);c(this,"cache",new Ii(this));c(this,"drive",!0);c(this,"enabled",!0);c(this,"progressBarDelay",500);c(this,"started",!1);c(this,"formMode","on");u(this,Be,150);this.recentRequests=e,this.preloader=new Fi(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 s=t.frame?document.getElementById(t.frame):null;if(s instanceof I){const i=t.action||ee(s);s.delegate.proposeVisitIfNavigatedWithAction(s,i),s.src=e.toString()}else this.navigator.proposeVisit(L(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||(this.cache.exemptPageFromPreview(),this.visit(e,{action:"replace"}))}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(j.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return p(this,Be)}set pageRefreshDebouncePeriod(e){this.refresh=Mr(this.debouncedRefresh.bind(this),e),S(this,Be,e)}shouldPreloadLink(e){const t=e.hasAttribute("data-turbo-method"),s=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),l=i=="_top"?null:document.getElementById(i)||le(e,"turbo-frame:not([disabled])");if(t||s||l instanceof I)return!1;{const g=new URL(e.href);return this.elementIsNavigatable(e)&&N(g,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,s){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:s}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,s){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,s)}followedLinkToLocation(e,t){const s=this.getActionForLink(e),i=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:s,acceptsStreamResponse:i})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){ts(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Je(document.documentElement),this.view.markVisitDirection(e.direction)),ts(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Ge(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 s=Wt(e,t);return this.submissionIsNavigatable(e,t)&&N(L(s),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 s=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:i,detail:{render:l}}=s;return this.view.renderer&&l&&(this.view.renderer.renderElement=l),!i}viewRenderedSnapshot(e,t,s){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(s)}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,s){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,s).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,s){return E("turbo:click",{target:e,detail:{url:t.href,originalEvent:s},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return E("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return E("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return E("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return E("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return E("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return E("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 E("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return E("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{const s=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?s&&e.closest('[data-turbo="true"]')!=null:s&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=le(e,"[data-turbo]"),s=le(e,"turbo-frame");return this.drive||s?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return ee(e)||"advance"}get snapshot(){return this.view.snapshot}}Be=new WeakMap;function ts(r){Object.defineProperties(r,Hi)}const Hi={absoluteURL:{get(){return this.toString()}}},w=new qi(fs),{cache:Bi,navigator:Oi}=w;function Os(){w.start()}function Vi(r){w.registerAdapter(r)}function Di(r,e){w.visit(r,e)}function Vs(r){w.connectStreamSource(r)}function Ds(r){w.disconnectStreamSource(r)}function Ni(r){w.renderStreamMessage(r)}function Wi(){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.`"),w.clearCache()}function Ui(r){w.setProgressBarDelay(r)}function _i(r){We.confirmMethod=r}function xi(r){w.setFormMode(r)}var $i=Object.freeze({__proto__:null,navigator:Oi,session:w,cache:Bi,PageRenderer:Ze,PageSnapshot:k,FrameRenderer:Ht,fetch:ps,start:Os,registerAdapter:Vi,visit:Di,connectStreamSource:Vs,disconnectStreamSource:Ds,renderStreamMessage:Ni,clearCache:Wi,setProgressBarDelay:Ui,setConfirmMethod:_i,setFormMode:xi});class ji extends Error{}var pe,F,_,Oe,ge,D,Y,St,Ns,wt,Ws,Et,Us,yt,_s,Rt,xs,At,$s,Lt,js,Ve,Vt,x,ie,Tt,zs,be,Xe,De,Dt,ve,Ye,Pt,Ks;class zi{constructor(e){u(this,D);u(this,St);u(this,wt);u(this,Et);u(this,yt);u(this,Rt);u(this,At);u(this,Lt);u(this,Ve);u(this,x);u(this,Tt);u(this,be);u(this,De);u(this,ve);u(this,Pt);c(this,"fetchResponseLoaded",e=>Promise.resolve());u(this,pe,null);u(this,F,()=>{});u(this,_,!1);u(this,Oe,!1);u(this,ge,new Set);c(this,"action",null);c(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 Xr(this,this.element),this.appearanceObserver=new Hr(this,this.element),this.formLinkClickObserver=new As(this,this.element),this.linkInterceptor=new ys(this,this.element),this.restorationIdentifier=$(),this.formSubmitObserver=new jt(this,this.element)}connect(){p(this,_)||(S(this,_,!0),this.loadingStyle==ne.lazy?this.appearanceObserver.start():m(this,D,Y).call(this),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){p(this,_)&&(S(this,_,!1),this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==ne.eager&&m(this,D,Y).call(this)}sourceURLChanged(){m(this,De,Dt).call(this,"src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==ne.eager||p(this,Oe))&&m(this,D,Y).call(this))}sourceURLReloaded(){const{src:e}=this.element;return m(this,ve,Ye).call(this,"complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){m(this,De,Dt).call(this,"complete")||m(this,D,Y).call(this)}loadingStyleChanged(){this.loadingStyle==ne.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),m(this,D,Y).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 s=as(t);k.fromDocument(s).isVisitable?await m(this,St,Ns).call(this,e,s):await m(this,yt,_s).call(this,e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,ee(e)),m(this,D,Y).call(this)}willSubmitFormLinkToLocation(e){return m(this,be,Xe).call(this,e)}submittedFormLinkToLocation(e,t,s){const i=m(this,x,ie).call(this,e);i&&s.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,s){return m(this,be,Xe).call(this,e)}linkClickIntercepted(e,t){m(this,Et,Us).call(this,e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&m(this,be,Xe).call(this,e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new We(this,e,t);const{fetchRequest:s}=this.formSubmission;this.prepareRequest(s),this.formSubmission.start()}prepareRequest(e){var t;e.headers["Turbo-Frame"]=this.id,(t=this.currentNavigationElement)!=null&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(j.contentType)}requestStarted(e){Je(this.element)}requestPreventedHandlingResponse(e,t){p(this,F).call(this)}async requestSucceededWithResponse(e,t){await this.loadResponse(t),p(this,F).call(this)}async requestFailedWithResponse(e,t){await this.loadResponse(t),p(this,F).call(this)}requestErrored(e,t){console.error(t),p(this,F).call(this)}requestFinished(e){Ge(this.element)}formSubmissionStarted({formElement:e}){Je(e,m(this,x,ie).call(this,e))}formSubmissionSucceededWithResponse(e,t){const s=m(this,x,ie).call(this,e.formElement,e.submitter);s.delegate.proposeVisitIfNavigatedWithAction(s,ee(e.submitter,e.formElement,s)),s.delegate.loadResponse(t),e.isSafe||w.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),w.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Ge(e,m(this,x,ie).call(this,e))}allowsImmediateRender({element:e},t){const s=E("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:i,detail:{render:l}}=s;return this.view.renderer&&l&&(this.view.renderer.renderElement=l),!i}viewRenderedSnapshot(e,t,s){}preloadOnLoadLinksForView(e){w.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){const s=k.fromElement(e).clone(),{visitCachedSnapshot:i}=e.delegate;e.delegate.fetchResponseLoaded=async l=>{if(e.src){const{statusCode:g,redirected:b}=l,y=await l.responseHTML,M={response:{statusCode:g,redirected:b,responseHTML:y},visitCachedSnapshot:i,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(M.action=this.action),w.visit(e.src,M)}}}}changeHistory(){if(this.action){const e=cs(this.action);w.history.update(e,L(this.element.src||""),this.restorationIdentifier)}}async extractForeignFrameElement(e){let t;const s=CSS.escape(this.id);try{if(t=rs(e.querySelector(`turbo-frame#${s}`),this.sourceURL),t)return t;if(t=rs(e.querySelector(`turbo-frame[src][recurse~=${s}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(i){return console.error(i),new I}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){m(this,ve,Ye).call(this,"src",()=>{this.element.src=e!=null?e:null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||p(this,F).call(this)!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){m(this,ve,Ye).call(this,"complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&p(this,_)}get rootLocation(){var s;const e=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),t=(s=e==null?void 0:e.content)!=null?s:"/";return L(t)}}pe=new WeakMap,F=new WeakMap,_=new WeakMap,Oe=new WeakMap,ge=new WeakMap,D=new WeakSet,Y=async function(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=m(this,wt,Ws).call(this,L(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,S(this,Oe,!0))},St=new WeakSet,Ns=async function(e,t){const s=await this.extractForeignFrameElement(t.body);if(s){const i=new Ct(s),l=new Ht(this,this.view.snapshot,i,Ht.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(l),this.complete=!0,w.frameRendered(e,this.element),w.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else m(this,Rt,xs).call(this,e)&&m(this,At,$s).call(this,e)},wt=new WeakSet,Ws=async function(e){var s;const t=new Ne(this,C.get,e,new URLSearchParams,this.element);return(s=p(this,pe))==null||s.cancel(),S(this,pe,t),new Promise(i=>{S(this,F,()=>{S(this,F,()=>{}),S(this,pe,null),i()}),t.perform()})},Et=new WeakSet,Us=function(e,t,s){const i=m(this,x,ie).call(this,e,s);i.delegate.proposeVisitIfNavigatedWithAction(i,ee(s,e,i)),m(this,Pt,Ks).call(this,e,()=>{i.src=t})},yt=new WeakSet,_s=async function(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await m(this,Ve,Vt).call(this,e.response)},Rt=new WeakSet,xs=function(e){this.element.setAttribute("complete","");const t=e.response,s=async(l,g)=>{l instanceof Response?m(this,Ve,Vt).call(this,l):w.visit(l,g)};return!E("turbo:frame-missing",{target:this.element,detail:{response:t,visit:s},cancelable:!0}).defaultPrevented},At=new WeakSet,$s=function(e){this.view.missing(),m(this,Lt,js).call(this,e)},Lt=new WeakSet,js=function(e){const t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new ji(t)},Ve=new WeakSet,Vt=async function(e){const t=new Ut(e),s=await t.responseHTML,{location:i,redirected:l,statusCode:g}=t;return w.visit(i,{response:{redirected:l,statusCode:g,responseHTML:s}})},x=new WeakSet,ie=function(e,t){var i;const s=Qe("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=ss(s))!=null?i:this.element},Tt=new WeakSet,zs=function(e,t){const s=Wt(e,t);return N(L(s),this.rootLocation)},be=new WeakSet,Xe=function(e,t){const s=Qe("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!m(this,Tt,zs).call(this,e,t)||!this.enabled||s=="_top")return!1;if(s){const i=ss(s);if(i)return!i.disabled}return!(!w.elementIsNavigatable(e)||t&&!w.elementIsNavigatable(t))},De=new WeakSet,Dt=function(e){return p(this,ge).has(e)},ve=new WeakSet,Ye=function(e,t){p(this,ge).add(e),t(),p(this,ge).delete(e)},Pt=new WeakSet,Ks=function(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement};function ss(r){if(r!=null){const e=document.getElementById(r);if(e instanceof I)return e}}function rs(r,e){if(r){const t=r.getAttribute("src");if(t!=null&&e!=null&&fr(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof I)return r.connectedCallback(),r.disconnectedCallback(),r}}const Xs={after(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)==null?void 0:e.insertBefore(this.templateContent,r.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)==null?void 0:e.insertBefore(this.templateContent,r)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})},refresh(){w.refresh(this.baseURI,this.requestId)}};var G,ye;const Kt=class Kt extends HTMLElement{constructor(){super(...arguments);u(this,G)}static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){var t;return(t=this.renderPromise)!=null?t:this.renderPromise=(async()=>{const s=this.beforeRenderEvent;this.dispatchEvent(s)&&(await ae(),await s.detail.render(this))})()}disconnect(){try{this.remove()}catch(t){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){var i;const t=this.targetElements.flatMap(l=>[...l.children]).filter(l=>!!l.id),s=[...((i=this.templateContent)==null?void 0:i.children)||[]].filter(l=>!!l.id).map(l=>l.id);return t.filter(l=>s.includes(l.id))}get performAction(){if(this.action){const t=Xs[this.action];if(t)return t;m(this,G,ye).call(this,"unknown action")}m(this,G,ye).call(this,"action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;m(this,G,ye).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;m(this,G,ye).call(this,"first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}get description(){var t,s;return(s=((t=this.outerHTML.match(/<[^>]+>/))!=null?t:[])[0])!=null?s:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:Kt.renderElement}})}get targetElementsById(){var s;const t=(s=this.ownerDocument)==null?void 0:s.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var s;const t=(s=this.ownerDocument)==null?void 0:s.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}};G=new WeakSet,ye=function(t){throw new Error(`${this.description}: ${t}`)};let Nt=Kt;class Ki extends HTMLElement{constructor(){super(...arguments);c(this,"streamSource",null)}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Vs(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Ds(this.streamSource))}get src(){return this.getAttribute("src")||""}}I.delegateConstructor=zi;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",I);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Nt);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ki);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(ls`
    1821        You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
    1922
     
    2427        ——
    2528        Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
    26       `,s.outerHTML);s=s.parentElement}})();window.Turbo=_t;fe();
     29      `,r.outerHTML);r=r.parentElement}})();window.Turbo={...$i,StreamActions:Xs};Os();
  • td-turbo-drive/trunk/dist/main.js

    r2922137 r3033244  
    1 (function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;const s=HTMLElement,e={HTMLElement:function(){return Reflect.construct(s,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=s.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,s)})();(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,r){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,r,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+r+".",n)}})(HTMLFormElement.prototype);const se=new WeakMap;function Se(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 ye(s){const e=Se(s.target);e&&e.form&&se.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))s=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",ye,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return se.get(this.target)}})})();var E;(function(s){s.eager="eager",s.lazy="lazy"})(E||(E={}));class v extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new v.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return Le(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}}function Le(s){switch(s.toLowerCase()){case"lazy":return E.lazy;default:return E.eager}}function c(s){return new URL(s.toString(),document.baseURI)}function y(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function $(s,e){const t=(e==null?void 0:e.getAttribute("formaction"))||s.getAttribute("action")||s.action;return c(t)}function Re(s){return(Fe(s).match(/\.[^.]*$/)||[])[0]||""}function Te(s){return!!Re(s).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Ce(s,e){const t=ke(e);return s.href===c(t).href||s.href.startsWith(t)}function A(s,e){return Ce(s,e)&&Te(s)}function _(s){const e=y(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function I(s){return _(s)}function Ae(s,e){return c(s).href==c(e).href}function Pe(s){return s.pathname.split("/").slice(1)}function Fe(s){return Pe(s).slice(-1)[0]}function ke(s){return Me(s.origin+s.pathname)}function Me(s){return s.endsWith("/")?s:s+"/"}class z{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return c(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}function F(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{const e=document.createElement("script"),t=B("csp-nonce");return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Ie(e,s),e}}function Ie(s,e){for(const{name:t,value:i}of e.attributes)s.setAttribute(t,i)}function He(s){const e=document.createElement("template");return e.innerHTML=s,e.content}function l(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 H(){return new Promise(s=>requestAnimationFrame(()=>s()))}function qe(){return new Promise(s=>setTimeout(()=>s(),0))}function Be(){return Promise.resolve()}function ie(s=""){return new DOMParser().parseFromString(s,"text/html")}function re(s,...e){const t=Oe(s,e).replace(/^\n/,"").split(`
    2 `),i=t[0].match(/^\s+/),r=i?i[0].length:0;return t.map(n=>n.slice(r)).join(`
    3 `)}function Oe(s,e){return s.reduce((t,i,r)=>{const n=e[r]==null?"":e[r];return t+i+n},"")}function P(){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 q(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 Ne(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function x(...s){for(const e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function W(...s){for(const e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function De(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 ne(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Ve(s){return s=="advance"||s=="replace"||s=="restore"}function N(...s){const e=q("data-turbo-action",...s);return Ve(e)?e:null}function oe(s){return document.querySelector(`meta[name="${s}"]`)}function B(s){const e=oe(s);return e&&e.content}function _e(s,e){let t=oe(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function O(s,e){var t;if(s instanceof Element)return s.closest(e)||O(s.assignedSlot||((t=s.getRootNode())===null||t===void 0?void 0:t.host),e)}var d;(function(s){s[s.get=0]="get",s[s.post=1]="post",s[s.put=2]="put",s[s.patch=3]="patch",s[s.delete=4]="delete"})(d||(d={}));function xe(s){switch(s.toLowerCase()){case"get":return d.get;case"post":return d.post;case"put":return d.put;case"patch":return d.patch;case"delete":return d.delete}}class K{constructor(e,t,i,r=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=r,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(e);try{this.delegate.requestStarted(this);const t=await fetch(this.url.href,e);return await this.receive(t)}catch(t){if(t.name!=="AbortError")throw this.willDelegateErrorHandling(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new z(e);return l("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:d[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===d.get}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(e){const t=new Promise(r=>this.resolveRequestPromise=r);l("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}willDelegateErrorHandling(e){return!l("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}}class We{constructor(e,t){this.started=!1,this.intersect=i=>{const r=i.slice(-1)[0];r!=null&&r.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class L{static wrap(e){return typeof e=="string"?new this(He(e)):e}constructor(e){this.fragment=Ue(e)}}L.contentType="text/vnd.turbo-stream.html";function Ue(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(F(i));e.replaceWith(t)}return s}var b;(function(s){s[s.initialized=0]="initialized",s[s.requesting=1]="requesting",s[s.waiting=2]="waiting",s[s.receiving=3]="receiving",s[s.stopping=4]="stopping",s[s.stopped=5]="stopped"})(b||(b={}));var w;(function(s){s.urlEncoded="application/x-www-form-urlencoded",s.multipart="multipart/form-data",s.plain="text/plain"})(w||(w={}));function je(s){switch(s.toLowerCase()){case w.multipart:return w.multipart;case w.plain:return w.plain;default:return w.urlEncoded}}class k{static confirmMethod(e,t,i){return Promise.resolve(confirm(e))}constructor(e,t,i,r=!1){this.state=b.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=$e(t,i),this.location=c(this.action),this.method==d.get&&Qe(this.location,[...this.body.entries()]),this.fetchRequest=new K(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=r}get method(){var e;const t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return xe(t.toLowerCase())||d.get}get action(){var e;const t=typeof this.formElement.action=="string"?this.formElement.action:null;return!((e=this.submitter)===null||e===void 0)&&e.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==w.urlEncoded||this.method==d.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return je(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}async start(){const{initialized:e,requesting:t}=b,i=q("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await k.confirmMethod(i,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=b;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=ze(B("csrf-param"))||B("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(L.contentType)}requestStarted(e){var t;this.state=b.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),this.setSubmitsWith(),l("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&Ke(t)){const i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=b.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=b.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),this.resetSubmitterText(),l("turbo:submit-end",{target:this.formElement,detail:Object.assign({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||Ne("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)===null||e===void 0?void 0:e.getAttribute("data-turbo-submits-with")}}function $e(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 ze(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 Ke(s){return s.statusCode==200&&!s.redirected}function Qe(s,e){const t=new URLSearchParams;for(const[i,r]of e)r instanceof File||t.append(i,r);return s.search=t.toString(),s}class D{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(){const e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(const t of this.element.querySelectorAll("[autofocus]"))if(t.closest(e)==null)return t;return null}get permanentElements(){return le(this.element)}getPermanentElementById(e){return ae(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 ae(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function le(s){return s.querySelectorAll("[id][data-turbo-permanent]")}class Q{constructor(e,t){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=i=>{if(!i.defaultPrevented){const r=i.target instanceof HTMLFormElement?i.target:void 0,n=i.submitter||void 0;r&&Xe(r,n)&&Ye(r,n)&&this.delegate.willSubmitForm(r,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmitted(r,n))}},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 Xe(s,e){return((e==null?void 0:e.getAttribute("formmethod"))||s.getAttribute("method"))!="dialog"}function Ye(s,e){if(e!=null&&e.hasAttribute("formtarget")||s.hasAttribute("target")){const t=(e==null?void 0:e.getAttribute("formtarget"))||s.target;for(const i of document.getElementsByName(t))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}class ce{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},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(y(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,newSnapshot:r}=e;if(i)try{this.renderPromise=new Promise(u=>this.resolveRenderPromise=u),this.renderer=e,await this.prepareToRenderSnapshot(e);const n=new Promise(u=>this.resolveInterceptionPromise=u),o={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(r,o)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(r,t),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}}class Je extends ce{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new D(this.element)}}class he{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url,i.detail.originalEvent)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url,i.detail.originalEvent)),delete this.clickEvent},this.willVisit=i=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}}class de{constructor(e,t){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=i=>{if(i instanceof MouseEvent&&this.clickEventIsSignificant(i)){const r=i.composedPath&&i.composedPath()[0]||i.target,n=this.findLinkFromClickTarget(r);if(n&&Ge(n)){const o=this.getLocationForLink(n);this.delegate.willFollowLinkToLocation(n,o,i)&&(i.preventDefault(),this.delegate.followedLinkToLocation(n,o))}}},this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return O(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return c(e.getAttribute("href")||"")}}function Ge(s){if(s.hasAttribute("target")){for(const e of document.getElementsByName(s.target))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}class ue{constructor(e,t){this.delegate=e,this.linkInterceptor=new de(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,t,i){return this.delegate.willSubmitFormLinkToLocation(e,t,i)&&e.hasAttribute("data-turbo-method")}followedLinkToLocation(e,t){const i=document.createElement("form"),r="hidden";for(const[T,M]of t.searchParams)i.append(Object.assign(document.createElement("input"),{type:r,name:T,value:M}));const n=Object.assign(t,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");const o=e.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);const h=e.getAttribute("data-turbo-frame");h&&i.setAttribute("data-turbo-frame",h);const u=N(e);u&&i.setAttribute("data-turbo-action",u);const R=e.getAttribute("data-turbo-confirm");R&&i.setAttribute("data-turbo-confirm",R),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 me{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=Ze(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 Ze(s){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}class X{constructor(e,t,i,r,n=!0){this.activeElement=null,this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,h)=>this.resolvingFunctions={resolve:o,reject:h})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await me.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){const e=this.connectedSnapshot.firstAutofocusableElement;et(e)&&e.focus()}enteringBardo(e){this.activeElement||e.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}}function et(s){return s&&typeof s.focus=="function"}class U extends X{static renderElement(e,t){var i;const r=document.createRange();r.selectNodeContents(e),r.deleteContents();const n=t,o=(i=n.ownerDocument)===null||i===void 0?void 0:i.createRange();o&&(o.selectNodeContents(n),e.appendChild(o.extractContents()))}constructor(e,t,i,r,n,o=!0){super(t,i,r,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await H(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await H(),this.focusFirstAutofocusableElement(),await H(),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=tt(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=st(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=F(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function tt(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function st(s,e){return s=="auto"||s=="smooth"?s:e}class g{static get defaultCSS(){return re`
     1var or=Object.defineProperty;var ar=(r,e,t)=>e in r?or(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var c=(r,e,t)=>(ar(r,typeof e!="symbol"?e+"":e,t),t),It=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var p=(r,e,t)=>(It(r,e,"read from private field"),t?t.call(r):e.get(r)),u=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},S=(r,e,t,s)=>(It(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);var m=(r,e,t)=>(It(r,e,"access private method"),t);/*!
     2Turbo 8.0.1
     3Copyright © 2024 37signals LLC
     4 */(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(s){s?(e(s,this),s.click()):(s=document.createElement("input"),s.type="submit",s.hidden=!0,this.appendChild(s),s.click(),this.removeChild(s))};function e(s,i){s instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),s.type=="submit"||t(TypeError,"The specified element is not a submit button"),s.form==i||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(s,i,l){throw new s("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",l)}})(HTMLFormElement.prototype);const is=new WeakMap;function lr(r){const e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return(t==null?void 0:t.type)=="submit"?t:null}function cr(r){const e=lr(r.target);e&&e.form&&is.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){const e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))r=e;else return}addEventListener("click",cr,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return is.get(this.target)}})})();const ne={eager:"eager",lazy:"lazy"},et=class et extends HTMLElement{constructor(){super();c(this,"loaded",Promise.resolve());this.delegate=new et.delegateConstructor(this)}static get observedAttributes(){return["disabled","complete","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="complete"?this.delegate.completeChanged():t=="src"?this.delegate.sourceURLChanged():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 loading(){return hr(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,s;return(s=(t=this.ownerDocument)==null?void 0:t.documentElement)==null?void 0:s.hasAttribute("data-turbo-preview")}};c(et,"delegateConstructor");let I=et;function hr(r){switch(r.toLowerCase()){case"lazy":return ne.lazy;default:return ne.eager}}function L(r){return new URL(r.toString(),document.baseURI)}function Z(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function Wt(r,e){const t=(e==null?void 0:e.getAttribute("formaction"))||r.getAttribute("action")||r.action;return L(t)}function dr(r){return(gr(r).match(/\.[^.]*$/)||[])[0]||""}function ur(r){return!!dr(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function mr(r,e){const t=br(e);return r.href===L(t).href||r.href.startsWith(t)}function N(r,e){return mr(r,e)&&ur(r)}function qt(r){const e=Z(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function _e(r){return qt(r)}function fr(r,e){return L(r).href==L(e).href}function pr(r){return r.pathname.split("/").slice(1)}function gr(r){return pr(r).slice(-1)[0]}function br(r){return vr(r.origin+r.pathname)}function vr(r){return r.endsWith("/")?r:r+"/"}class Ut{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 L(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}function Re(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{const e=document.createElement("script"),t=Se("csp-nonce");return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,Sr(e,r),e}}function Sr(r,e){for(const{name:t,value:s}of e.attributes)r.setAttribute(t,s)}function wr(r){const e=document.createElement("template");return e.innerHTML=r,e.content}function E(r,{target:e,cancelable:t,detail:s}={}){const i=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:s});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function ae(){return document.visibilityState==="hidden"?os():ns()}function ns(){return new Promise(r=>requestAnimationFrame(()=>r()))}function os(){return new Promise(r=>setTimeout(()=>r(),0))}function Er(){return Promise.resolve()}function as(r=""){return new DOMParser().parseFromString(r,"text/html")}function ls(r,...e){const t=yr(r,e).replace(/^\n/,"").split(`
     5`),s=t[0].match(/^\s+/),i=s?s[0].length:0;return t.map(l=>l.slice(i)).join(`
     6`)}function yr(r,e){return r.reduce((t,s,i)=>{const l=e[i]==null?"":e[i];return t+s+l},"")}function $(){return Array.from({length:36}).map((r,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 Qe(r,...e){for(const t of e.map(s=>s==null?void 0:s.getAttribute(r)))if(typeof t=="string")return t;return null}function Rr(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function Je(...r){for(const e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Ge(...r){for(const e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ar(r,e=2e3){return new Promise(t=>{const s=()=>{r.removeEventListener("error",s),r.removeEventListener("load",s),t()};r.addEventListener("load",s,{once:!0}),r.addEventListener("error",s,{once:!0}),setTimeout(t,e)})}function cs(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Lr(r){return r=="advance"||r=="replace"||r=="restore"}function ee(...r){const e=Qe("data-turbo-action",...r);return Lr(e)?e:null}function hs(r){return document.querySelector(`meta[name="${r}"]`)}function Se(r){const e=hs(r);return e&&e.content}function Tr(r,e){let t=hs(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function le(r,e){var t;if(r instanceof Element)return r.closest(e)||le(r.assignedSlot||((t=r.getRootNode())==null?void 0:t.host),e)}function _t(r){const e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";return!!r&&r.closest(e)==null&&typeof r.focus=="function"}function ds(r){return Array.from(r.querySelectorAll("[autofocus]")).find(_t)}async function Pr(r,e){const t=e();r(),await ns();const s=e();return[t,s]}function us(r){if(r.hasAttribute("target")){for(const e of document.getElementsByName(r.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function Cr(r){return le(r,"a[href]:not([target^=_]):not([download])")}function ms(r){return L(r.getAttribute("href")||"")}function Mr(r,e){let t=null;return(...s)=>{const i=()=>r.apply(this,s);clearTimeout(t),t=setTimeout(i,e)}}class kr extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){const s=this.values().next().value;this.delete(s)}super.add(e)}}const fs=new kr(20),Fr=window.fetch;function ps(r,e={}){const t=new Headers(e.headers||{}),s=$();return fs.add(s),t.append("X-Turbo-Request-Id",s),Fr(r,{...e,headers:t})}function xt(r){switch(r.toLowerCase()){case"get":return C.get;case"post":return C.post;case"put":return C.put;case"patch":return C.patch;case"delete":return C.delete}}const C={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Ir(r){switch(r.toLowerCase()){case Q.multipart:return Q.multipart;case Q.plain:return Q.plain;default:return Q.urlEncoded}}const Q={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};var Ae,tt,gs,st,bs;class Ne{constructor(e,t,s,i=new URLSearchParams,l=null,g=Q.urlEncoded){u(this,tt);u(this,st);c(this,"abortController",new AbortController);u(this,Ae,e=>{});var P;const[b,y]=Gt(L(s),t,i,g);this.delegate=e,this.url=b,this.target=l,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:y,signal:this.abortSignal,referrer:(P=this.delegate.referrer)==null?void 0:P.href},this.enctype=g}get method(){return this.fetchOptions.method}set method(e){const t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=xt(e)||C.get;this.url.search="";const[i,l]=Gt(this.url,s,t,this.enctype);this.url=i,this.fetchOptions.body=l,this.fetchOptions.method=s}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 m(this,tt,gs).call(this,e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=ps(this.url.href,e);const s=await this.response;return await this.receive(s)}catch(s){if(s.name!=="AbortError")throw m(this,st,bs).call(this,s)&&this.delegate.requestErrored(this,s),s}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new Ut(e);return E("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 $t(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}}Ae=new WeakMap,tt=new WeakSet,gs=async function(e){const t=new Promise(i=>S(this,Ae,i)),s=E("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:p(this,Ae)},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await t,s},st=new WeakSet,bs=function(e){return!E("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented};function $t(r){return xt(r)==C.get}function Gt(r,e,t,s){const i=Array.from(t).length>0?new URLSearchParams(vs(t)):r.searchParams;return $t(e)?[qr(r,i),null]:s==Q.urlEncoded?[r,i]:[r,t]}function vs(r){const e=[];for(const[t,s]of r)s instanceof File||e.push([t,s]);return e}function qr(r,e){const t=new URLSearchParams(vs(e));return r.search=t.toString(),r}class Hr{constructor(e,t){c(this,"started",!1);c(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 j{static wrap(e){return typeof e=="string"?new this(wr(e)):e}constructor(e){this.fragment=Br(e)}}c(j,"contentType","text/vnd.turbo-stream.html");function Br(r){for(const e of r.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const s of t.templateElement.content.querySelectorAll("script"))s.replaceWith(Re(s));e.replaceWith(t)}return r}const Or=100;var J,O;class Vr{constructor(){u(this,J,null);u(this,O,null)}get(e){if(p(this,O)&&p(this,O).url===e&&p(this,O).expire>Date.now())return p(this,O).request}setLater(e,t,s){this.clear(),S(this,J,setTimeout(()=>{t.perform(),this.set(e,t,s),S(this,J,null)},Or))}set(e,t,s){S(this,O,{url:e,request:t,expire:new Date(new Date().getTime()+s)})}clear(){p(this,J)&&clearTimeout(p(this,J)),S(this,O,null)}}J=new WeakMap,O=new WeakMap;const Dr=10*1e3,oe=new Vr,re={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class We{constructor(e,t,s,i=!1){c(this,"state",re.initialized);const l=$r(t,s),g=xr(_r(t,s),l),b=Nr(t,s),y=jr(t,s);this.delegate=e,this.formElement=t,this.submitter=s,this.fetchRequest=new Ne(this,l,g,b,t,y),this.mustRedirect=i}static confirmMethod(e,t,s){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=L(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}=re,s=Qe("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof s=="string"&&!await We.confirmMethod(s,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=re;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=Wr(Se("csrf-param"))||Se("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(j.contentType)}requestStarted(e){var t;this.state=re.waiting,(t=this.submitter)==null||t.setAttribute("disabled",""),this.setSubmitsWith(),Je(this.formElement),E("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){oe.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(oe.clear(),this.requestMustRedirect(e)&&Ur(t)){const s=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,s)}else this.state=re.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=re.stopped,(t=this.submitter)==null||t.removeAttribute("disabled"),this.resetSubmitterText(),Ge(this.formElement),E("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||Rr("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 Nr(r,e){const t=new FormData(r),s=e==null?void 0:e.getAttribute("name"),i=e==null?void 0:e.getAttribute("value");return s&&t.append(s,i||""),t}function Wr(r){if(r!=null){const t=(document.cookie?document.cookie.split("; "):[]).find(s=>s.startsWith(r));if(t){const s=t.split("=").slice(1).join("=");return s?decodeURIComponent(s):void 0}}}function Ur(r){return r.statusCode==200&&!r.redirected}function _r(r,e){const t=typeof r.action=="string"?r.action:null;return e!=null&&e.hasAttribute("formaction")?e.getAttribute("formaction")||"":r.getAttribute("action")||t||""}function xr(r,e){const t=L(r);return $t(e)&&(t.search=""),t}function $r(r,e){const t=(e==null?void 0:e.getAttribute("formmethod"))||r.getAttribute("method")||"";return xt(t.toLowerCase())||C.get}function jr(r,e){return Ir((e==null?void 0:e.getAttribute("formenctype"))||r.enctype)}class Ct{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 ds(this.element)}get permanentElements(){return ws(this.element)}getPermanentElementById(e){return Ss(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const s of this.permanentElements){const{id:i}=s,l=e.getPermanentElementById(i);l&&(t[i]=[s,l])}return t}}function Ss(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function ws(r){return r.querySelectorAll("[id][data-turbo-permanent]")}class jt{constructor(e,t){c(this,"started",!1);c(this,"submitCaptured",()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)});c(this,"submitBubbled",e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,s=e.submitter||void 0;t&&zr(t,s)&&Kr(t,s)&&this.delegate.willSubmitForm(t,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,s))}});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 zr(r,e){return((e==null?void 0:e.getAttribute("formmethod"))||r.getAttribute("method"))!="dialog"}function Kr(r,e){if(e!=null&&e.hasAttribute("formtarget")||r.hasAttribute("target")){const t=(e==null?void 0:e.getAttribute("formtarget"))||r.target;for(const s of document.getElementsByName(t))if(s instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Le,Te;class Es{constructor(e,t){u(this,Le,e=>{});u(this,Te,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(Z(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:s,willRender:i,newSnapshot:l}=e,g=i;if(s)try{this.renderPromise=new Promise(M=>S(this,Le,M)),this.renderer=e,await this.prepareToRenderSnapshot(e);const b=new Promise(M=>S(this,Te,M)),y={resume:p(this,Te),render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(l,y)||await b,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(l,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,p(this,Le).call(this,void 0),delete this.renderPromise}else g&&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()}}Le=new WeakMap,Te=new WeakMap;class Xr extends Es{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Ct(this.element)}}class ys{constructor(e,t){c(this,"clickBubbled",e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent});c(this,"linkClicked",e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent});c(this,"willVisit",e=>{delete this.clickEvent});this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}}class Rs{constructor(e,t){c(this,"started",!1);c(this,"clickCaptured",()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)});c(this,"clickBubbled",e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=e.composedPath&&e.composedPath()[0]||e.target,s=Cr(t);if(s&&us(s)){const i=ms(s);this.delegate.willFollowLinkToLocation(s,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(s,i))}}});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 As{constructor(e,t){this.delegate=e,this.linkInterceptor=new Rs(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,s){return this.delegate.willSubmitFormLinkToLocation(e,t,s)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){const s=document.createElement("form"),i="hidden";for(const[te,T]of t.searchParams)s.append(Object.assign(document.createElement("input"),{type:i,name:te,value:T}));const l=Object.assign(t,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",l.href),s.setAttribute("hidden","");const g=e.getAttribute("data-turbo-method");g&&s.setAttribute("method",g);const b=e.getAttribute("data-turbo-frame");b&&s.setAttribute("data-turbo-frame",b);const y=ee(e);y&&s.setAttribute("data-turbo-action",y);const P=e.getAttribute("data-turbo-confirm");P&&s.setAttribute("data-turbo-confirm",P),e.hasAttribute("data-turbo-stream")&&s.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,s),document.body.appendChild(s),s.addEventListener("turbo:submit-end",()=>s.remove(),{once:!0}),requestAnimationFrame(()=>s.requestSubmit())}}class Ls{static async preservingPermanentElements(e,t,s){const i=new this(e,t);i.enter(),await s(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(const e in this.permanentElementMap){const[t,s]=this.permanentElementMap[e];this.delegate.enteringBardo(t,s),this.replaceNewPermanentElementWithPlaceholder(s)}}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=Yr(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 Yr(r){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var V;class zt{constructor(e,t,s,i,l=!0){u(this,V,null);this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=l,this.renderElement=s,this.promise=new Promise((g,b)=>this.resolvingFunctions={resolve:g,reject:b})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Ls.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){const e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){p(this,V)||e.contains(this.currentSnapshot.activeElement)&&S(this,V,this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(p(this,V))&&p(this,V)instanceof HTMLElement&&(p(this,V).focus(),S(this,V,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"}}V=new WeakMap;class Ht extends zt{static renderElement(e,t){var g;const s=document.createRange();s.selectNodeContents(e),s.deleteContents();const i=t,l=(g=i.ownerDocument)==null?void 0:g.createRange();l&&(l.selectNodeContents(i),e.appendChild(l.extractContents()))}constructor(e,t,s,i,l,g=!0){super(t,s,i,l,g),this.delegate=e}get shouldRender(){return!0}async render(){await ae(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await ae(),this.focusFirstAutofocusableElement(),await ae(),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=Qr(this.currentElement.getAttribute("data-autoscroll-block"),"end"),s=Jr(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:s}),!0}return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=Re(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function Qr(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function Jr(r,e){return r=="auto"||r=="smooth"?r:e}const B=class B{constructor(){c(this,"hiding",!1);c(this,"value",0);c(this,"visible",!1);c(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 ls`
    47      .turbo-progress-bar {
    58        position: fixed;
     
    1114        z-index: 2147483647;
    1215        transition:
    13           width ${g.animationDuration}ms ease-out,
    14           opacity ${g.animationDuration/2}ms ${g.animationDuration/2}ms ease-in;
     16          width ${B.animationDuration}ms ease-out,
     17          opacity ${B.animationDuration/2}ms ${B.animationDuration/2}ms ease-in;
    1518        transform: translate3d(0, 0, 0);
    1619      }
    17     `}constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}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,g.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,g.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");return e.type="text/css",e.textContent=g.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return B("csp-nonce")}}g.animationDuration=300;class it extends D{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(e=>!at(e)).map(e=>ht(e)).reduce((e,t)=>{const{outerHTML:i}=t,r=i in e?e[i]:{type:rt(t),tracked:nt(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},r),{elements:[...r.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{const{type:i,tracked:r,elements:n}=this.detailsByOuterHTML[t];return i==null&&!r?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){const t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{const{elements:[r]}=this.detailsByOuterHTML[i];return ct(r,e)?r:t},void 0)}}function rt(s){if(ot(s))return"script";if(lt(s))return"stylesheet"}function nt(s){return s.getAttribute("data-turbo-track")=="reload"}function ot(s){return s.localName=="script"}function at(s){return s.localName=="noscript"}function lt(s){const e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function ct(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function ht(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}class p extends D{static fromHTMLString(e=""){return this.fromDocument(ie(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new it(e))}constructor(e,t){super(e),this.headSnapshot=t}clone(){const e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),i=e.querySelectorAll("select");for(const[r,n]of t.entries()){const o=i[r];for(const h of o.selectedOptions)h.selected=!1;for(const h of n.selectedOptions)o.options[h.index].selected=!0}for(const r of e.querySelectorAll('input[type="password"]'))r.value="";return new p(e,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;const t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return c(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}}var C;(function(s){s.visitStart="visitStart",s.requestStart="requestStart",s.requestEnd="requestEnd",s.visitEnd="visitEnd"})(C||(C={}));var m;(function(s){s.initialized="initialized",s.started="started",s.canceled="canceled",s.failed="failed",s.completed="completed"})(m||(m={}));const dt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1};var S;(function(s){s[s.networkFailure=0]="networkFailure",s[s.timeoutFailure=-1]="timeoutFailure",s[s.contentTypeMismatch=-2]="contentTypeMismatch"})(S||(S={}));class ut{constructor(e,t,i,r={}){this.identifier=P(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=m.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||P();const{action:n,historyChanged:o,referrer:h,snapshot:u,snapshotHTML:R,response:V,visitCachedSnapshot:T,willRender:M,updateHistory:be,shouldCacheSnapshot:we,acceptsStreamResponse:Ee}=Object.assign(Object.assign({},dt),r);this.action=n,this.historyChanged=o,this.referrer=h,this.snapshot=u,this.snapshotHTML=R,this.response=V,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=T,this.willRender=M,this.updateHistory=be,this.scrolled=!M,this.shouldCacheSnapshot=we,this.acceptsStreamResponse=Ee}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==m.initialized&&(this.recordTimingMetric(C.visitStart),this.state=m.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==m.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=m.canceled)}complete(){this.state==m.started&&(this.recordTimingMetric(C.visitEnd),this.state=m.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==m.started&&(this.state=m.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){const t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=ne(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new K(this,d.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(C.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;J(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(C.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,J(e)&&t!=null?(await this.view.renderPage(p.fromHTMLString(t),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(p.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!y(this.location)||e.hasAnchor(y(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return p.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.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&(!((e=this.response)===null||e===void 0)&&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(L.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:S.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:S.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:S.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(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=y(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function J(s){return s>=200&&s<300}class mt{constructor(e){this.progressBar=new g,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||P(),t)}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 S.networkFailure:case S.timeoutFailure:case S.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(e){this.reload(e)}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;l("turbo:reload",{detail:e}),window.location.href=((t=this.location)===null||t===void 0?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}}class pt{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,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]}}class ft{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new he(this,t),this.formSubmitObserver=new Q(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,i){return this.shouldRedirect(e)}linkClickIntercepted(e,t,i){const r=this.findFrameElement(e);r&&r.delegate.linkClickIntercepted(e,t,i)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.shouldSubmit(e,t)&&this.shouldRedirect(e,t)}formSubmitted(e,t){const i=this.findFrameElement(e,t);i&&i.delegate.formSubmitted(e,t)}shouldSubmit(e,t){var i;const r=$(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=c((i=n==null?void 0:n.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&A(r,o)}shouldRedirect(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const r=this.findFrameElement(e,t);return r?r!=e.closest("turbo-frame"):!1}else return!1}findFrameElement(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 v)return r}}}class gt{constructor(e){this.restorationIdentifier=P(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){const{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);const{restorationIdentifier:r}=i;this.restorationIdentifier=r,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,r)}}},this.onPageLoad=async t=>{await Be(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=P()){const r={turbo:{restorationIdentifier:i}};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]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}}class vt{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(A(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new ut(this,c(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new k(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){const i=await t.responseHTML;if(i){const r=e.isSafe;r||this.view.clearSnapshotCache();const{statusCode:n,redirected:o}=t,u={action:this.getActionForFormSubmission(e),shouldCacheSnapshot:r,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(t.location,u)}}}async formSubmissionFailedWithResponse(e,t){const i=await t.responseHTML;if(i){const r=p.fromHTMLString(i);t.serverError?await this.view.renderError(r,this.currentVisit):await this.view.renderPage(r,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){const i=y(e),r=y(this.view.lastRenderedLocation),n=t==="restore"&&typeof i=="undefined";return t!=="replace"&&_(e)===_(this.view.lastRenderedLocation)&&(n||i!=null&&i!==r)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:e,formElement:t}){return N(e,t)||"advance"}}var f;(function(s){s[s.initial=0]="initial",s[s.loading=1]="loading",s[s.interactive=2]="interactive",s[s.complete=3]="complete"})(f||(f={}));class bt{constructor(e){this.stage=f.initial,this.started=!1,this.interpretReadyState=()=>{const{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==f.initial&&(this.stage=f.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==f.loading&&(this.stage=f.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==f.interactive&&(this.stage=f.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class wt{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}}class Et{render({fragment:e}){me.preservingPermanentElements(this,St(e),()=>document.documentElement.appendChild(e))}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}function St(s){const e=le(document.documentElement),t={};for(const i of e){const{id:r}=i;for(const n of s.querySelectorAll("turbo-stream")){const o=ae(n.templateElement.content,r);o&&(t[r]=[i,o])}}return t}class yt{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{const i=Lt(t);i&&Rt(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){const t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(L.wrap(e))}}function Lt(s){var e;const t=(e=s.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof z)return t}function Rt(s){var e;return((e=s.contentType)!==null&&e!==void 0?e:"").startsWith(L.contentType)}class G extends X{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=F(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}class j extends X{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){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 e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const e=[];for(const t of this.newHeadStylesheetElements)e.push(De(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(const e of this.newHeadScriptElements)document.head.appendChild(F(e))}async mergeProvisionalElements(){const e=[...this.newHeadProvisionalElements];for(const t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(const t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(const[i,r]of t.entries()){if(e.tagName=="TITLE"){if(r.tagName!="TITLE")continue;if(e.innerHTML==r.innerHTML)return t.splice(i,1),!0}if(r.isEqualNode(e))return t.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(const e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(const e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const e of this.newBodyScriptElements){const t=F(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}}class Tt{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return I(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[I(e)]}write(e,t){this.snapshots[I(e)]=t}touch(e){const t=I(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 Ct extends ce{constructor(){super(...arguments),this.snapshotCache=new Tt(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(e,t=!1,i=!0,r){const n=new j(this.snapshot,e,j.renderElement,t,i);return n.shouldRender?r==null||r.changeHistory():this.forceReloaded=!0,this.render(n)}renderError(e,t){t==null||t.changeHistory();const i=new G(this.snapshot,e,G.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:t}=this;await qe();const i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return p.fromElement(this.element)}}class At{constructor(e){this.selector="a[data-turbo-preload]",this.delegate=e}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(e){for(const t of e.querySelectorAll(this.selector))this.preloadURL(t)}async preloadURL(e){const t=new URL(e.href);if(!this.snapshotCache.has(t))try{const r=await(await fetch(t.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),n=p.fromHTMLString(r);this.snapshotCache.put(t,n)}catch(i){}}}class Pt{constructor(){this.navigator=new vt(this),this.history=new gt(this),this.preloader=new At(this),this.view=new Ct(this,document.documentElement),this.adapter=new mt(this),this.pageObserver=new bt(this),this.cacheObserver=new pt,this.linkClickObserver=new de(this,window),this.formSubmitObserver=new Q(this,document),this.scrollObserver=new wt(this),this.streamObserver=new yt(this),this.formLinkClickObserver=new ue(this,document.documentElement),this.frameRedirector=new ft(this,document.documentElement),this.streamMessageRenderer=new Et,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){const i=t.frame?document.getElementById(t.frame):null;i instanceof v?(i.src=e.toString(),i.loaded):this.navigator.proposeVisit(c(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(L.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&A(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(e,t,i){return this.elementIsNavigatable(e)&&A(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){Z(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||x(document.documentElement),Z(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){W(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=$(e,t);return this.submissionIsNavigatable(e,t)&&A(c(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){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){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}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 l("turbo:click",{target:e,detail:{url:t.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return l("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return l("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return l("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return l("turbo:before-render",{detail:Object.assign({newBody:e},t),cancelable:!0})}notifyApplicationAfterRender(){return l("turbo:render")}notifyApplicationAfterPageLoad(e={}){return l("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 l("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return l("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{const i=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?i&&e.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=O(e,"[data-turbo]"),i=O(e,"turbo-frame");return this.drive||i?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return N(e)||"advance"}get snapshot(){return this.view.snapshot}}function Z(s){Object.defineProperties(s,Ft)}const Ft={absoluteURL:{get(){return this.toString()}}};class kt{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(e){_e("turbo-cache-control",e)}}const pe={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})}},a=new Pt,Mt=new kt(a),{navigator:It}=a;function fe(){a.start()}function Ht(s){a.registerAdapter(s)}function qt(s,e){a.visit(s,e)}function ge(s){a.connectStreamSource(s)}function ve(s){a.disconnectStreamSource(s)}function Bt(s){a.renderStreamMessage(s)}function Ot(){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.`"),a.clearCache()}function Nt(s){a.setProgressBarDelay(s)}function Dt(s){k.confirmMethod=s}function Vt(s){a.setFormMode(s)}var _t=Object.freeze({__proto__:null,navigator:It,session:a,cache:Mt,PageRenderer:j,PageSnapshot:p,FrameRenderer:U,start:fe,registerAdapter:Ht,visit:qt,connectStreamSource:ge,disconnectStreamSource:ve,renderStreamMessage:Bt,clearCache:Ot,setProgressBarDelay:Nt,setConfirmMethod:Dt,setFormMode:Vt,StreamActions:pe});class xt extends Error{}class Wt{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:t})=>{const i=t.querySelector("#"+this.element.id);i&&this.previousFrameElement&&i.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=e,this.view=new Je(this,this.element),this.appearanceObserver=new We(this,this.element),this.formLinkClickObserver=new ue(this,this.element),this.linkInterceptor=new he(this,this.element),this.restorationIdentifier=P(),this.formSubmitObserver=new Q(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==E.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==E.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==E.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){const{src:e}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==E.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(c(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{const t=await e.responseHTML;if(t){const i=ie(t);p.fromDocument(i).isVisitable?await this.loadFrameResponse(e,i):await this.handleUnvisitableFrameResponse(e)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,e),this.loadSourceURL()}willSubmitFormLinkToLocation(e){return this.shouldInterceptNavigation(e)}submittedFormLinkToLocation(e,t,i){const r=this.findFrameElement(e);r&&i.setAttribute("data-turbo-frame",r.id)}shouldInterceptLinkClick(e,t,i){return this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.navigateFrame(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new k(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===void 0)&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(L.contentType)}requestStarted(e){x(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){W(this.element)}formSubmissionStarted({formElement:e}){x(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){const i=this.findFrameElement(e.formElement,e.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t),e.isSafe||a.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),a.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){W(e,this.findFrameElement(e))}allowsImmediateRender({element:e},t){const i=l("turbo:before-frame-render",{target:this.element,detail:Object.assign({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){}preloadOnLoadLinksForView(e){a.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}async loadFrameResponse(e,t){const i=await this.extractForeignFrameElement(t.body);if(i){const r=new D(i),n=new U(this,this.view.snapshot,r,U.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,a.frameRendered(e,this.element),a.frameLoaded(this.element),this.fetchResponseLoaded(e)}else this.willHandleFrameMissingFromResponse(e)&&this.handleFrameMissingFromResponse(e)}async visit(e){var t;const i=new K(this,d.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(r=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,r()},i.perform()})}navigateFrame(e,t,i){const r=this.findFrameElement(e,i);r.delegate.proposeVisitIfNavigatedWithAction(r,e,i),this.withCurrentNavigationElement(e,()=>{r.src=t})}proposeVisitIfNavigatedWithAction(e,t,i){if(this.action=N(i,t,e),this.action){const r=p.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=o=>{if(e.src){const{statusCode:h,redirected:u}=o,R=e.ownerDocument.documentElement.outerHTML,T={response:{statusCode:h,redirected:u,responseHTML:R},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(T.action=this.action),a.visit(e.src,T)}}}}changeHistory(){if(this.action){const e=ne(this.action);a.history.update(e,c(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(e.response)}willHandleFrameMissingFromResponse(e){this.element.setAttribute("complete","");const t=e.response,i=async(n,o={})=>{n instanceof Response?this.visitResponse(n):a.visit(n,o)};return!l("turbo:frame-missing",{target:this.element,detail:{response:t,visit:i},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(e){this.view.missing(),this.throwFrameMissingError(e)}throwFrameMissingError(e){const t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new xt(t)}async visitResponse(e){const t=new z(e),i=await t.responseHTML,{location:r,redirected:n,statusCode:o}=t;return a.visit(r,{response:{redirected:n,statusCode:o,responseHTML:i}})}findFrameElement(e,t){var i;const r=q("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=ee(r))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t;const i=CSS.escape(this.id);try{if(t=te(e.querySelector(`turbo-frame#${i}`),this.sourceURL),t)return t;if(t=te(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 v}return null}formActionIsVisitable(e,t){const i=$(e,t);return A(c(i),this.rootLocation)}shouldInterceptNavigation(e,t){const i=q("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){const r=ee(i);if(r)return!r.disabled}return!(!a.elementIsNavigatable(e)||t&&!a.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.ignoringChangesToAttribute("src",()=>{this.element.src=e!=null?e:null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.ignoringChangesToAttribute("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;const t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t==null?void 0:t.content)!==null&&e!==void 0?e:"/";return c(i)}isIgnoringChangesTo(e){return this.ignoredAttributes.has(e)}ignoringChangesToAttribute(e,t){this.ignoredAttributes.add(e),t(),this.ignoredAttributes.delete(e)}withCurrentNavigationElement(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}}function ee(s){if(s!=null){const e=document.getElementById(s);if(e instanceof v)return e}}function te(s,e){if(s){const t=s.getAttribute("src");if(t!=null&&e!=null&&Ae(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof v)return s.connectedCallback(),s.disconnectedCallback(),s}}class Y extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{const t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await H(),await t.detail.render(this))})()}disconnect(){try{this.remove()}catch(e){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;const t=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),i=[...((e=this.templateContent)===null||e===void 0?void 0:e.children)||[]].filter(r=>!!r.id).map(r=>r.id);return t.filter(r=>i.includes(r.id))}get performAction(){if(this.action){const e=pe[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){const e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:Y.renderElement}})}get targetElementsById(){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}}class Ut extends HTMLElement{constructor(){super(...arguments),this.streamSource=null}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),ge(this.streamSource)}disconnectedCallback(){this.streamSource&&ve(this.streamSource)}get src(){return this.getAttribute("src")||""}}v.delegateConstructor=Wt;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",v);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Y);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ut);(()=>{let s=document.currentScript;if(s&&!s.hasAttribute("data-turbo-suppress-warning"))for(s=s.parentElement;s;){if(s==document.body)return console.warn(re`
     20    `}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,B.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,B.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");return e.type="text/css",e.textContent=B.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return Se("csp-nonce")}};c(B,"animationDuration",300);let Bt=B;class Gr extends Ct{constructor(){super(...arguments);c(this,"detailsByOuterHTML",this.children.filter(t=>!si(t)).map(t=>ni(t)).reduce((t,s)=>{const{outerHTML:i}=s,l=i in t?t[i]:{type:Zr(s),tracked:ei(s),elements:[]};return{...t,[i]:{...l,elements:[...l.elements,s]}}},{}))}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,s){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in s.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==t).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,s)=>{const{type:i,tracked:l,elements:g}=this.detailsByOuterHTML[s];return i==null&&!l?[...t,...g]:g.length>1?[...t,...g.slice(1)]:t},[])}getMetaValue(t){const s=this.findMetaElementByName(t);return s?s.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((s,i)=>{const{elements:[l]}=this.detailsByOuterHTML[i];return ii(l,t)?l:s},void 0|void 0)}}function Zr(r){if(ti(r))return"script";if(ri(r))return"stylesheet"}function ei(r){return r.getAttribute("data-turbo-track")=="reload"}function ti(r){return r.localName=="script"}function si(r){return r.localName=="noscript"}function ri(r){const e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function ii(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function ni(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}class k extends Ct{static fromHTMLString(e=""){return this.fromDocument(as(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:s}){return new this(e,t,new Gr(s))}constructor(e,t,s){super(t),this.documentElement=e,this.headSnapshot=s}clone(){const e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),s=e.querySelectorAll("select");for(const[i,l]of t.entries()){const g=s[i];for(const b of g.selectedOptions)b.selected=!1;for(const b of l.selectedOptions)g.options[b.index].selected=!0}for(const i of e.querySelectorAll('input[type="password"]'))i.value="";return new k(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){var t;const e=(t=this.getSetting("root"))!=null?t:"/";return L(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 Pe,W;class oi{constructor(){u(this,Pe,!1);u(this,W,Promise.resolve())}renderChange(e,t){return e&&this.viewTransitionsAvailable&&!p(this,Pe)?(S(this,Pe,!0),S(this,W,p(this,W).then(async()=>{await document.startViewTransition(t).finished}))):S(this,W,p(this,W).then(t)),p(this,W)}get viewTransitionsAvailable(){return document.startViewTransition}}Pe=new WeakMap,W=new WeakMap;const ai={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},xe={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},H={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ce={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},li={advance:"forward",restore:"back",replace:"none"};class ci{constructor(e,t,s,i={}){c(this,"identifier",$());c(this,"timingMetrics",{});c(this,"followedRedirect",!1);c(this,"historyChanged",!1);c(this,"scrolled",!1);c(this,"shouldCacheSnapshot",!0);c(this,"acceptsStreamResponse",!1);c(this,"snapshotCached",!1);c(this,"state",H.initialized);c(this,"viewTransitioner",new oi);this.delegate=e,this.location=t,this.restorationIdentifier=s||$();const{action:l,historyChanged:g,referrer:b,snapshot:y,snapshotHTML:P,response:M,visitCachedSnapshot:te,willRender:T,updateHistory:Mt,shouldCacheSnapshot:kt,acceptsStreamResponse:Ue,direction:se}={...ai,...i};this.action=l,this.historyChanged=g,this.referrer=b,this.snapshot=y,this.snapshotHTML=P,this.response=M,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=te,this.willRender=T,this.updateHistory=Mt,this.scrolled=!T,this.shouldCacheSnapshot=kt,this.acceptsStreamResponse=Ue,this.direction=se||li[l]}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==H.initialized&&(this.recordTimingMetric(xe.visitStart),this.state=H.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==H.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=H.canceled)}complete(){this.state==H.started&&(this.recordTimingMetric(xe.visitEnd),this.adapter.visitCompleted(this),this.state=H.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==H.started&&(this.state=H.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,s=cs(t);this.history.update(s,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Ne(this,C.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(xe.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;Zt(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(xe.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,Zt(e)&&t!=null){const s=k.fromHTMLString(t);await this.renderPageSnapshot(s,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(k.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Z(this.location)||e.hasAnchor(Z(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return k.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(j.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){const s=await t.responseHTML,{redirected:i,statusCode:l}=t;s==null?this.recordResponse({statusCode:ce.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:l,responseHTML:s,redirected:i}))}async requestFailedWithResponse(e,t){const s=await t.responseHTML,{redirected:i,statusCode:l}=t;s==null?this.recordResponse({statusCode:ce.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:l,responseHTML:s,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:ce.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=Z(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await ae(),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 Zt(r){return r>=200&&r<300}class hi{constructor(e){c(this,"progressBar",new Bt);c(this,"showProgressBar",()=>{this.progressBar.show()});this.session=e}visitProposedToLocation(e,t){N(e,this.navigator.rootLocation)?this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||$(),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 ce.networkFailure:case ce.timeoutFailure:case ce.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(e){var t;E("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 di{constructor(){c(this,"selector","[data-turbo-temporary]");c(this,"deprecatedSelector","[data-turbo-cache=false]");c(this,"started",!1);c(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 rt,Ts,he,$e,de,je;class ui{constructor(e,t){u(this,rt);u(this,he);u(this,de);this.session=e,this.element=t,this.linkInterceptor=new ys(this,t),this.formSubmitObserver=new jt(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,s){return m(this,he,$e).call(this,e)}linkClickIntercepted(e,t,s){const i=m(this,de,je).call(this,e);i&&i.delegate.linkClickIntercepted(e,t,s)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&m(this,rt,Ts).call(this,e,t)&&m(this,he,$e).call(this,e,t)}formSubmitted(e,t){const s=m(this,de,je).call(this,e,t);s&&s.delegate.formSubmitted(e,t)}}rt=new WeakSet,Ts=function(e,t){var g;const s=Wt(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),l=L((g=i==null?void 0:i.content)!=null?g:"/");return m(this,he,$e).call(this,e,t)&&N(s,l)},he=new WeakSet,$e=function(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const i=m(this,de,je).call(this,e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1},de=new WeakSet,je=function(e,t){const s=(t==null?void 0:t.getAttribute("data-turbo-frame"))||e.getAttribute("data-turbo-frame");if(s&&s!="_top"){const i=this.element.querySelector(`#${s}:not([disabled])`);if(i instanceof I)return i}};class mi{constructor(e){c(this,"location");c(this,"restorationIdentifier",$());c(this,"restorationData",{});c(this,"started",!1);c(this,"pageLoaded",!1);c(this,"currentIndex",0);c(this,"onPopState",e=>{if(this.shouldHandlePopState()){const{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);const{restorationIdentifier:s,restorationIndex:i}=t;this.restorationIdentifier=s;const l=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,s,l),this.currentIndex=i}}});c(this,"onPageLoad",async e=>{await Er(),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,s=$()){e===history.pushState&&++this.currentIndex;const i={turbo:{restorationIdentifier:s,restorationIndex:this.currentIndex}};e.call(history,i,"",t.href),this.location=t,this.restorationIdentifier=s}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){const{restorationIdentifier:t}=this,s=this.restorationData[t];this.restorationData[t]={...s,...e}}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!=null?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}}var ue,Ce,Me,ke,it,Fe,nt,Ps,ot,Cs;class fi{constructor(e,t){u(this,nt);u(this,ot);c(this,"started",!1);u(this,ue,null);u(this,Ce,()=>{this.eventTarget.addEventListener("mouseenter",p(this,Me),{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",p(this,ke),{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",p(this,Fe),!0),this.started=!0});u(this,Me,e=>{if(Se("turbo-prefetch")==="false")return;const t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&m(this,ot,Cs).call(this,t)){const i=t,l=ms(i);if(this.delegate.canPrefetchRequestToLocation(i,l)){S(this,ue,i);const g=new Ne(this,C.get,l,new URLSearchParams,t);oe.setLater(l.toString(),g,p(this,nt,Ps))}}});u(this,ke,e=>{e.target===p(this,ue)&&p(this,it).call(this)});u(this,it,()=>{oe.clear(),S(this,ue,null)});u(this,Fe,e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="get"){const t=oe.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),oe.clear()}});this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",p(this,Ce),{once:!0}):p(this,Ce).call(this))}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",p(this,Me),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",p(this,ke),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",p(this,Fe),!0),this.started=!1)}prepareRequest(e){const t=e.target;e.headers["X-Sec-Purpose"]="prefetch";const s=t.closest("turbo-frame"),i=t.getAttribute("data-turbo-frame")||(s==null?void 0:s.getAttribute("target"))||(s==null?void 0:s.id);i&&i!=="_top"&&(e.headers["Turbo-Frame"]=i),t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(j.contentType)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}ue=new WeakMap,Ce=new WeakMap,Me=new WeakMap,ke=new WeakMap,it=new WeakMap,Fe=new WeakMap,nt=new WeakSet,Ps=function(){return Number(Se("turbo-prefetch-cache-time"))||Dr},ot=new WeakSet,Cs=function(e){const t=e.getAttribute("href");if(!t||t.startsWith("#")||e.getAttribute("data-turbo")==="false"||e.getAttribute("data-turbo-prefetch")==="false"||E("turbo:before-prefetch",{target:e,cancelable:!0}).defaultPrevented||e.origin!==document.location.origin||!["http:","https:"].includes(e.protocol)||e.pathname+e.search===document.location.pathname+document.location.search)return!1;const i=e.getAttribute("data-turbo-method");if(i&&i!=="get"||pi(e))return!1;const l=le(e,"[data-turbo-prefetch]");return!(l&&l.getAttribute("data-turbo-prefetch")==="false")};const pi=r=>!us(r);var at,Ms,lt,ks;class gi{constructor(e){u(this,at);u(this,lt);this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,s={}){this.stop(),this.currentVisit=new ci(this,L(e),t,{referrer:this.location,...s}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new We(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 s=await t.responseHTML;if(s){const i=e.isSafe;i||this.view.clearSnapshotCache();const{statusCode:l,redirected:g}=t,y={action:m(this,at,Ms).call(this,e,t),shouldCacheSnapshot:i,response:{statusCode:l,responseHTML:s,redirected:g}};this.proposeVisit(t.location,y)}}}async formSubmissionFailedWithResponse(e,t){const s=await t.responseHTML;if(s){const i=k.fromHTMLString(s);t.serverError?await this.view.renderError(i,this.currentVisit):await this.view.renderPage(i,!1,!0,this.currentVisit),i.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){const s=Z(e),i=Z(this.view.lastRenderedLocation),l=t==="restore"&&typeof s=="undefined";return t!=="replace"&&qt(e)===qt(this.view.lastRenderedLocation)&&(l||s!=null&&s!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}}at=new WeakSet,Ms=function(e,t){const{submitter:s,formElement:i}=e;return ee(s,i)||m(this,lt,ks).call(this,t)},lt=new WeakSet,ks=function(e){var s;return e.redirected&&e.location.href===((s=this.location)==null?void 0:s.href)?"replace":"advance"};const X={initial:0,loading:1,interactive:2,complete:3};class bi{constructor(e){c(this,"stage",X.initial);c(this,"started",!1);c(this,"interpretReadyState",()=>{const{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()});c(this,"pageWillUnload",()=>{this.delegate.pageWillUnload()});this.delegate=e}start(){this.started||(this.stage==X.initial&&(this.stage=X.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==X.loading&&(this.stage=X.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==X.interactive&&(this.stage=X.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class vi{constructor(e){c(this,"started",!1);c(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 Si{render({fragment:e}){Ls.preservingPermanentElements(this,wi(e),()=>{Ei(e,()=>{yi(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}function wi(r){const e=ws(document.documentElement),t={};for(const s of e){const{id:i}=s;for(const l of r.querySelectorAll("turbo-stream")){const g=Ss(l.templateElement.content,i);g&&(t[i]=[s,g])}}return t}async function Ei(r,e){const t=`turbo-stream-autofocus-${$()}`,s=r.querySelectorAll("turbo-stream"),i=Ri(s);let l=null;if(i&&(i.id?l=i.id:l=t,i.id=l),e(),await ae(),(document.activeElement==null||document.activeElement==document.body)&&l){const b=document.getElementById(l);_t(b)&&b.focus(),b&&b.id==t&&b.removeAttribute("id")}}async function yi(r){const[e,t]=await Pr(r,()=>document.activeElement),s=e&&e.id;if(s){const i=document.getElementById(s);_t(i)&&i!=t&&i.focus()}}function Ri(r){for(const e of r){const t=ds(e.templateElement.content);if(t)return t}return null}var U;class Ai{constructor(e){c(this,"sources",new Set);u(this,U,!1);c(this,"inspectFetchResponse",e=>{const t=Li(e);t&&Ti(t)&&(e.preventDefault(),this.receiveMessageResponse(t))});c(this,"receiveMessageEvent",e=>{p(this,U)&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)});this.delegate=e}start(){p(this,U)||(S(this,U,!0),addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){p(this,U)&&(S(this,U,!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(j.wrap(e))}}U=new WeakMap;function Li(r){var t;const e=(t=r.detail)==null?void 0:t.fetchResponse;if(e instanceof Ut)return e}function Ti(r){var t;return((t=r.contentType)!=null?t:"").startsWith(j.contentType)}class es extends zt{static renderElement(e,t){const{documentElement:s,body:i}=document;s.replaceChild(t,i)}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 s=Re(e);t.replaceChild(s,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}var Pi=function(){let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:T,afterNodeAdded:T,beforeNodeMorphed:T,afterNodeMorphed:T,beforeNodeRemoved:T,afterNodeRemoved:T,beforeAttributeUpdated:T},head:{style:"merge",shouldPreserve:function(n){return n.getAttribute("im-preserve")==="true"},shouldReAppend:function(n){return n.getAttribute("im-re-append")==="true"},shouldRemove:T,afterHeadMorphed:T}};function t(n,o,a={}){n instanceof Document&&(n=n.documentElement),typeof o=="string"&&(o=Js(o));let h=Gs(o),d=kt(n,h,a);return s(n,h,d)}function s(n,o,a){if(a.head.block){let h=n.querySelector("head"),d=o.querySelector("head");if(h&&d){let f=te(d,h,a);Promise.all(f).then(function(){s(n,o,Object.assign(a,{head:{block:!1,ignore:!0}}))});return}}if(a.morphStyle==="innerHTML")return g(o,n,a),n.children;if(a.morphStyle==="outerHTML"||a.morphStyle==null){let h=er(o,n,a),d=h==null?void 0:h.previousSibling,f=h==null?void 0:h.nextSibling,v=l(n,h,a);return h?Zs(d,v,f):[]}else throw"Do not understand how to morph style "+a.morphStyle}function i(n,o){return o.ignoreActiveValue&&n===document.activeElement&&n!==document.body}function l(n,o,a){if(!(a.ignoreActive&&n===document.activeElement))return o==null?a.callbacks.beforeNodeRemoved(n)===!1?n:(n.remove(),a.callbacks.afterNodeRemoved(n),null):se(n,o)?(a.callbacks.beforeNodeMorphed(n,o)===!1||(n instanceof HTMLHeadElement&&a.head.ignore||(n instanceof HTMLHeadElement&&a.head.style!=="morph"?te(o,n,a):(y(o,n,a),i(n,a)||g(o,n,a))),a.callbacks.afterNodeMorphed(n,o)),n):a.callbacks.beforeNodeRemoved(n)===!1||a.callbacks.beforeNodeAdded(o)===!1?n:(n.parentElement.replaceChild(o,n),a.callbacks.afterNodeAdded(o),a.callbacks.afterNodeRemoved(n),o)}function g(n,o,a){let h=n.firstChild,d=o.firstChild,f;for(;h;){if(f=h,h=f.nextSibling,d==null){if(a.callbacks.beforeNodeAdded(f)===!1)return;o.appendChild(f),a.callbacks.afterNodeAdded(f),z(a,f);continue}if(Ue(f,d,a)){l(d,f,a),d=d.nextSibling,z(a,f);continue}let v=Ys(n,o,f,d,a);if(v){d=Xt(d,v,a),l(v,f,a),z(a,f);continue}let R=Qs(n,o,f,d,a);if(R){d=Xt(d,R,a),l(R,f,a),z(a,f);continue}if(a.callbacks.beforeNodeAdded(f)===!1)return;o.insertBefore(f,d),a.callbacks.afterNodeAdded(f),z(a,f)}for(;d!==null;){let v=d;d=d.nextSibling,Yt(v,a)}}function b(n,o,a,h){return n==="value"&&h.ignoreActiveValue&&o===document.activeElement?!0:h.callbacks.beforeAttributeUpdated(n,o,a)===!1}function y(n,o,a){let h=n.nodeType;if(h===1){const d=n.attributes,f=o.attributes;for(const v of d)b(v.name,o,"update",a)||o.getAttribute(v.name)!==v.value&&o.setAttribute(v.name,v.value);for(let v=f.length-1;0<=v;v--){const R=f[v];b(R.name,o,"remove",a)||n.hasAttribute(R.name)||o.removeAttribute(R.name)}}(h===8||h===3)&&o.nodeValue!==n.nodeValue&&(o.nodeValue=n.nodeValue),i(o,a)||M(n,o,a)}function P(n,o,a,h){if(n[a]!==o[a]){let d=b(a,o,"update",h);d||(o[a]=n[a]),n[a]?d||o.setAttribute(a,n[a]):b(a,o,"remove",h)||o.removeAttribute(a)}}function M(n,o,a){if(n instanceof HTMLInputElement&&o instanceof HTMLInputElement&&n.type!=="file"){let h=n.value,d=o.value;P(n,o,"checked",a),P(n,o,"disabled",a),n.hasAttribute("value")?h!==d&&(b("value",o,"update",a)||(o.setAttribute("value",h),o.value=h)):b("value",o,"remove",a)||(o.value="",o.removeAttribute("value"))}else if(n instanceof HTMLOptionElement)P(n,o,"selected",a);else if(n instanceof HTMLTextAreaElement&&o instanceof HTMLTextAreaElement){let h=n.value,d=o.value;if(b("value",o,"update",a))return;h!==d&&(o.value=h),o.firstChild&&o.firstChild.nodeValue!==h&&(o.firstChild.nodeValue=h)}}function te(n,o,a){let h=[],d=[],f=[],v=[],R=a.head.style,K=new Map;for(const A of n.children)K.set(A.outerHTML,A);for(const A of o.children){let q=K.has(A.outerHTML),Ee=a.head.shouldReAppend(A),Ft=a.head.shouldPreserve(A);q||Ft?Ee?d.push(A):(K.delete(A.outerHTML),f.push(A)):R==="append"?Ee&&(d.push(A),v.push(A)):a.head.shouldRemove(A)!==!1&&d.push(A)}v.push(...K.values());let Jt=[];for(const A of v){let q=document.createRange().createContextualFragment(A.outerHTML).firstChild;if(a.callbacks.beforeNodeAdded(q)!==!1){if(q.href||q.src){let Ee=null,Ft=new Promise(function(nr){Ee=nr});q.addEventListener("load",function(){Ee()}),Jt.push(Ft)}o.appendChild(q),a.callbacks.afterNodeAdded(q),h.push(q)}}for(const A of d)a.callbacks.beforeNodeRemoved(A)!==!1&&(o.removeChild(A),a.callbacks.afterNodeRemoved(A));return a.head.afterHeadMorphed(o,{added:h,kept:f,removed:d}),Jt}function T(){}function Mt(n){let o={};return Object.assign(o,e),Object.assign(o,n),o.callbacks={},Object.assign(o.callbacks,e.callbacks),Object.assign(o.callbacks,n.callbacks),o.head={},Object.assign(o.head,e.head),Object.assign(o.head,n.head),o}function kt(n,o,a){return a=Mt(a),{target:n,newContent:o,config:a,morphStyle:a.morphStyle,ignoreActive:a.ignoreActive,ignoreActiveValue:a.ignoreActiveValue,idMap:ir(n,o),deadIds:new Set,callbacks:a.callbacks,head:a.head}}function Ue(n,o,a){return n==null||o==null?!1:n.nodeType===o.nodeType&&n.tagName===o.tagName?n.id!==""&&n.id===o.id?!0:we(a,n,o)>0:!1}function se(n,o){return n==null||o==null?!1:n.nodeType===o.nodeType&&n.tagName===o.tagName}function Xt(n,o,a){for(;n!==o;){let h=n;n=n.nextSibling,Yt(h,a)}return z(a,o),o.nextSibling}function Ys(n,o,a,h,d){let f=we(d,a,o),v=null;if(f>0){let R=h,K=0;for(;R!=null;){if(Ue(a,R,d))return R;if(K+=we(d,R,n),K>f)return null;R=R.nextSibling}}return v}function Qs(n,o,a,h,d){let f=h,v=a.nextSibling,R=0;for(;f!=null;){if(we(d,f,n)>0)return null;if(se(a,f))return f;if(se(v,f)&&(R++,v=v.nextSibling,R>=2))return null;f=f.nextSibling}return f}function Js(n){let o=new DOMParser,a=n.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(a.match(/<\/html>/)||a.match(/<\/head>/)||a.match(/<\/body>/)){let h=o.parseFromString(n,"text/html");if(a.match(/<\/html>/))return h.generatedByIdiomorph=!0,h;{let d=h.firstChild;return d?(d.generatedByIdiomorph=!0,d):null}}else{let d=o.parseFromString("<body><template>"+n+"</template></body>","text/html").body.querySelector("template").content;return d.generatedByIdiomorph=!0,d}}function Gs(n){if(n==null)return document.createElement("div");if(n.generatedByIdiomorph)return n;if(n instanceof Node){const o=document.createElement("div");return o.append(n),o}else{const o=document.createElement("div");for(const a of[...n])o.append(a);return o}}function Zs(n,o,a){let h=[],d=[];for(;n!=null;)h.push(n),n=n.previousSibling;for(;h.length>0;){let f=h.pop();d.push(f),o.parentElement.insertBefore(f,o)}for(d.push(o);a!=null;)h.push(a),d.push(a),a=a.nextSibling;for(;h.length>0;)o.parentElement.insertBefore(h.pop(),o.nextSibling);return d}function er(n,o,a){let h;h=n.firstChild;let d=h,f=0;for(;h;){let v=tr(h,o,a);v>f&&(d=h,f=v),h=h.nextSibling}return d}function tr(n,o,a){return se(n,o)?.5+we(a,n,o):0}function Yt(n,o){z(o,n),o.callbacks.beforeNodeRemoved(n)!==!1&&(n.remove(),o.callbacks.afterNodeRemoved(n))}function sr(n,o){return!n.deadIds.has(o)}function rr(n,o,a){return(n.idMap.get(a)||r).has(o)}function z(n,o){let a=n.idMap.get(o)||r;for(const h of a)n.deadIds.add(h)}function we(n,o,a){let h=n.idMap.get(o)||r,d=0;for(const f of h)sr(n,f)&&rr(n,f,a)&&++d;return d}function Qt(n,o){let a=n.parentElement,h=n.querySelectorAll("[id]");for(const d of h){let f=d;for(;f!==a&&f!=null;){let v=o.get(f);v==null&&(v=new Set,o.set(f,v)),v.add(d.id),f=f.parentElement}}}function ir(n,o){let a=new Map;return Qt(n,a),Qt(o,a),a}return{morph:t,defaults:e}}(),ct,Fs;class Ze extends zt{constructor(){super(...arguments);u(this,ct)}static renderElement(t,s){document.body&&s instanceof HTMLBodyElement?document.body.replaceWith(s):document.documentElement.appendChild(s)}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(){m(this,ct,Fs).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(),s=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await s,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 s of this.newHeadStylesheetElements)t.push(Ar(s)),document.head.appendChild(s);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(Re(t))}removeUnusedDynamicStylesheetElements(){for(const t of this.unusedDynamicStylesheetElements)document.head.removeChild(t)}async mergeProvisionalElements(){const t=[...this.newHeadProvisionalElements];for(const s of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(s,t)||document.head.removeChild(s);for(const s of t)document.head.appendChild(s)}isCurrentElementInElementList(t,s){for(const[i,l]of s.entries()){if(t.tagName=="TITLE"){if(l.tagName!="TITLE")continue;if(t.innerHTML==l.innerHTML)return s.splice(i,1),!0}if(l.isEqualNode(t))return s.splice(i,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 s=Re(t);t.replaceWith(s)}}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")}}ct=new WeakSet,Fs=function(){const{documentElement:t}=this.currentSnapshot,{lang:s}=this.newSnapshot;s?t.setAttribute("lang",s):t.removeAttribute("lang")};var ht,Is,Ie,Ot,dt,qe,ut,mt,ft,pt,qs,gt,Hs,bt,me,ze,vt,Bs;class Ci extends Ze{constructor(){super(...arguments);u(this,ht);u(this,Ie);u(this,pt);u(this,gt);u(this,me);u(this,vt);u(this,dt,t=>!(t.id&&t.hasAttribute("data-turbo-permanent")&&document.getElementById(t.id)));u(this,qe,(t,s)=>{if(t instanceof HTMLElement)return!t.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!m(this,me,ze).call(this,t))?!E("turbo:before-morph-element",{cancelable:!0,target:t,detail:{newElement:s}}).defaultPrevented:!1});u(this,ut,(t,s,i)=>!E("turbo:before-morph-attribute",{cancelable:!0,target:s,detail:{attributeName:t,mutationType:i}}).defaultPrevented);u(this,mt,(t,s)=>{s instanceof HTMLElement&&E("turbo:morph-element",{target:t,detail:{newElement:s}})});u(this,ft,t=>p(this,qe).call(this,t));u(this,bt,(t,s)=>{E("turbo:before-frame-morph",{target:t,detail:{currentElement:t,newElement:s}}),m(this,Ie,Ot).call(this,t,s.children,"innerHTML")})}async render(){this.willRender&&await m(this,ht,Is).call(this)}get renderMethod(){return"morph"}}ht=new WeakSet,Is=async function(){m(this,Ie,Ot).call(this,this.currentElement,this.newElement),m(this,pt,qs).call(this),E("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})},Ie=new WeakSet,Ot=function(t,s,i="outerHTML"){this.isMorphingTurboFrame=m(this,me,ze).call(this,t),Pi.morph(t,s,{ignoreActiveValue:!0,morphStyle:i,callbacks:{beforeNodeAdded:p(this,dt),beforeNodeMorphed:p(this,qe),beforeAttributeUpdated:p(this,ut),beforeNodeRemoved:p(this,ft),afterNodeMorphed:p(this,mt)}})},dt=new WeakMap,qe=new WeakMap,ut=new WeakMap,mt=new WeakMap,ft=new WeakMap,pt=new WeakSet,qs=function(){m(this,vt,Bs).call(this).forEach(t=>{m(this,me,ze).call(this,t)&&(m(this,gt,Hs).call(this,t),t.reload())})},gt=new WeakSet,Hs=function(t){t.addEventListener("turbo:before-frame-render",s=>{s.detail.render=p(this,bt)},{once:!0})},bt=new WeakMap,me=new WeakSet,ze=function(t){return t.src&&t.refresh==="morph"},vt=new WeakSet,Bs=function(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(t=>!t.closest("[data-turbo-permanent]"))};class Mi{constructor(e){c(this,"keys",[]);c(this,"snapshots",{});this.size=e}has(e){return _e(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[_e(e)]}write(e,t){this.snapshots[_e(e)]=t}touch(e){const t=_e(e),s=this.keys.indexOf(t);s>-1&&this.keys.splice(s,1),this.keys.unshift(t),this.trim()}trim(){for(const e of this.keys.splice(this.size))delete this.snapshots[e]}}class ki extends Es{constructor(){super(...arguments);c(this,"snapshotCache",new Mi(10));c(this,"lastRenderedLocation",new URL(location.href));c(this,"forceReloaded",!1)}shouldTransitionTo(t){return this.snapshot.prefersViewTransitions&&t.prefersViewTransitions}renderPage(t,s=!1,i=!0,l){const b=this.isPageRefresh(l)&&this.snapshot.shouldMorphPage?Ci:Ze,y=new b(this.snapshot,t,Ze.renderElement,s,i);return y.shouldRender?l==null||l.changeHistory():this.forceReloaded=!0,this.render(y)}renderError(t,s){s==null||s.changeHistory();const i=new es(this.snapshot,t,es.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:s}=this;await os();const i=t.clone();return this.snapshotCache.put(s,i),i}}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 k.fromElement(this.element)}}var He;class Fi{constructor(e,t){c(this,"selector","a[data-turbo-preload]");u(this,He,()=>{this.preloadOnLoadLinksForView(document.body)});this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",p(this,He)):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",p(this,He))}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 Ne(this,C.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{const s=await t.responseHTML,i=k.fromHTMLString(s);this.snapshotCache.put(e.url,i)}catch(s){}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}He=new WeakMap;var fe,Ke;class Ii{constructor(e){u(this,fe);this.session=e}clear(){this.session.clearCache()}resetCacheControl(){m(this,fe,Ke).call(this,"")}exemptPageFromCache(){m(this,fe,Ke).call(this,"no-cache")}exemptPageFromPreview(){m(this,fe,Ke).call(this,"no-preview")}}fe=new WeakSet,Ke=function(e){Tr("turbo-cache-control",e)};var Be;class qi{constructor(e){c(this,"navigator",new gi(this));c(this,"history",new mi(this));c(this,"view",new ki(this,document.documentElement));c(this,"adapter",new hi(this));c(this,"pageObserver",new bi(this));c(this,"cacheObserver",new di);c(this,"linkPrefetchObserver",new fi(this,document));c(this,"linkClickObserver",new Rs(this,window));c(this,"formSubmitObserver",new jt(this,document));c(this,"scrollObserver",new vi(this));c(this,"streamObserver",new Ai(this));c(this,"formLinkClickObserver",new As(this,document.documentElement));c(this,"frameRedirector",new ui(this,document.documentElement));c(this,"streamMessageRenderer",new Si);c(this,"cache",new Ii(this));c(this,"drive",!0);c(this,"enabled",!0);c(this,"progressBarDelay",500);c(this,"started",!1);c(this,"formMode","on");u(this,Be,150);this.recentRequests=e,this.preloader=new Fi(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 s=t.frame?document.getElementById(t.frame):null;if(s instanceof I){const i=t.action||ee(s);s.delegate.proposeVisitIfNavigatedWithAction(s,i),s.src=e.toString()}else this.navigator.proposeVisit(L(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||(this.cache.exemptPageFromPreview(),this.visit(e,{action:"replace"}))}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(j.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return p(this,Be)}set pageRefreshDebouncePeriod(e){this.refresh=Mr(this.debouncedRefresh.bind(this),e),S(this,Be,e)}shouldPreloadLink(e){const t=e.hasAttribute("data-turbo-method"),s=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),l=i=="_top"?null:document.getElementById(i)||le(e,"turbo-frame:not([disabled])");if(t||s||l instanceof I)return!1;{const g=new URL(e.href);return this.elementIsNavigatable(e)&&N(g,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,s){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:s}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,s){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,s)}followedLinkToLocation(e,t){const s=this.getActionForLink(e),i=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:s,acceptsStreamResponse:i})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){ts(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Je(document.documentElement),this.view.markVisitDirection(e.direction)),ts(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Ge(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 s=Wt(e,t);return this.submissionIsNavigatable(e,t)&&N(L(s),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 s=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:i,detail:{render:l}}=s;return this.view.renderer&&l&&(this.view.renderer.renderElement=l),!i}viewRenderedSnapshot(e,t,s){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(s)}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,s){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,s).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,s){return E("turbo:click",{target:e,detail:{url:t.href,originalEvent:s},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return E("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return E("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return E("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return E("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return E("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return E("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 E("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return E("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{const s=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?s&&e.closest('[data-turbo="true"]')!=null:s&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=le(e,"[data-turbo]"),s=le(e,"turbo-frame");return this.drive||s?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return ee(e)||"advance"}get snapshot(){return this.view.snapshot}}Be=new WeakMap;function ts(r){Object.defineProperties(r,Hi)}const Hi={absoluteURL:{get(){return this.toString()}}},w=new qi(fs),{cache:Bi,navigator:Oi}=w;function Os(){w.start()}function Vi(r){w.registerAdapter(r)}function Di(r,e){w.visit(r,e)}function Vs(r){w.connectStreamSource(r)}function Ds(r){w.disconnectStreamSource(r)}function Ni(r){w.renderStreamMessage(r)}function Wi(){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.`"),w.clearCache()}function Ui(r){w.setProgressBarDelay(r)}function _i(r){We.confirmMethod=r}function xi(r){w.setFormMode(r)}var $i=Object.freeze({__proto__:null,navigator:Oi,session:w,cache:Bi,PageRenderer:Ze,PageSnapshot:k,FrameRenderer:Ht,fetch:ps,start:Os,registerAdapter:Vi,visit:Di,connectStreamSource:Vs,disconnectStreamSource:Ds,renderStreamMessage:Ni,clearCache:Wi,setProgressBarDelay:Ui,setConfirmMethod:_i,setFormMode:xi});class ji extends Error{}var pe,F,_,Oe,ge,D,Y,St,Ns,wt,Ws,Et,Us,yt,_s,Rt,xs,At,$s,Lt,js,Ve,Vt,x,ie,Tt,zs,be,Xe,De,Dt,ve,Ye,Pt,Ks;class zi{constructor(e){u(this,D);u(this,St);u(this,wt);u(this,Et);u(this,yt);u(this,Rt);u(this,At);u(this,Lt);u(this,Ve);u(this,x);u(this,Tt);u(this,be);u(this,De);u(this,ve);u(this,Pt);c(this,"fetchResponseLoaded",e=>Promise.resolve());u(this,pe,null);u(this,F,()=>{});u(this,_,!1);u(this,Oe,!1);u(this,ge,new Set);c(this,"action",null);c(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 Xr(this,this.element),this.appearanceObserver=new Hr(this,this.element),this.formLinkClickObserver=new As(this,this.element),this.linkInterceptor=new ys(this,this.element),this.restorationIdentifier=$(),this.formSubmitObserver=new jt(this,this.element)}connect(){p(this,_)||(S(this,_,!0),this.loadingStyle==ne.lazy?this.appearanceObserver.start():m(this,D,Y).call(this),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){p(this,_)&&(S(this,_,!1),this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==ne.eager&&m(this,D,Y).call(this)}sourceURLChanged(){m(this,De,Dt).call(this,"src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==ne.eager||p(this,Oe))&&m(this,D,Y).call(this))}sourceURLReloaded(){const{src:e}=this.element;return m(this,ve,Ye).call(this,"complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){m(this,De,Dt).call(this,"complete")||m(this,D,Y).call(this)}loadingStyleChanged(){this.loadingStyle==ne.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),m(this,D,Y).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 s=as(t);k.fromDocument(s).isVisitable?await m(this,St,Ns).call(this,e,s):await m(this,yt,_s).call(this,e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,ee(e)),m(this,D,Y).call(this)}willSubmitFormLinkToLocation(e){return m(this,be,Xe).call(this,e)}submittedFormLinkToLocation(e,t,s){const i=m(this,x,ie).call(this,e);i&&s.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,s){return m(this,be,Xe).call(this,e)}linkClickIntercepted(e,t){m(this,Et,Us).call(this,e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&m(this,be,Xe).call(this,e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new We(this,e,t);const{fetchRequest:s}=this.formSubmission;this.prepareRequest(s),this.formSubmission.start()}prepareRequest(e){var t;e.headers["Turbo-Frame"]=this.id,(t=this.currentNavigationElement)!=null&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(j.contentType)}requestStarted(e){Je(this.element)}requestPreventedHandlingResponse(e,t){p(this,F).call(this)}async requestSucceededWithResponse(e,t){await this.loadResponse(t),p(this,F).call(this)}async requestFailedWithResponse(e,t){await this.loadResponse(t),p(this,F).call(this)}requestErrored(e,t){console.error(t),p(this,F).call(this)}requestFinished(e){Ge(this.element)}formSubmissionStarted({formElement:e}){Je(e,m(this,x,ie).call(this,e))}formSubmissionSucceededWithResponse(e,t){const s=m(this,x,ie).call(this,e.formElement,e.submitter);s.delegate.proposeVisitIfNavigatedWithAction(s,ee(e.submitter,e.formElement,s)),s.delegate.loadResponse(t),e.isSafe||w.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),w.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Ge(e,m(this,x,ie).call(this,e))}allowsImmediateRender({element:e},t){const s=E("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:i,detail:{render:l}}=s;return this.view.renderer&&l&&(this.view.renderer.renderElement=l),!i}viewRenderedSnapshot(e,t,s){}preloadOnLoadLinksForView(e){w.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){const s=k.fromElement(e).clone(),{visitCachedSnapshot:i}=e.delegate;e.delegate.fetchResponseLoaded=async l=>{if(e.src){const{statusCode:g,redirected:b}=l,y=await l.responseHTML,M={response:{statusCode:g,redirected:b,responseHTML:y},visitCachedSnapshot:i,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(M.action=this.action),w.visit(e.src,M)}}}}changeHistory(){if(this.action){const e=cs(this.action);w.history.update(e,L(this.element.src||""),this.restorationIdentifier)}}async extractForeignFrameElement(e){let t;const s=CSS.escape(this.id);try{if(t=rs(e.querySelector(`turbo-frame#${s}`),this.sourceURL),t)return t;if(t=rs(e.querySelector(`turbo-frame[src][recurse~=${s}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(i){return console.error(i),new I}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){m(this,ve,Ye).call(this,"src",()=>{this.element.src=e!=null?e:null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||p(this,F).call(this)!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){m(this,ve,Ye).call(this,"complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&p(this,_)}get rootLocation(){var s;const e=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),t=(s=e==null?void 0:e.content)!=null?s:"/";return L(t)}}pe=new WeakMap,F=new WeakMap,_=new WeakMap,Oe=new WeakMap,ge=new WeakMap,D=new WeakSet,Y=async function(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=m(this,wt,Ws).call(this,L(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,S(this,Oe,!0))},St=new WeakSet,Ns=async function(e,t){const s=await this.extractForeignFrameElement(t.body);if(s){const i=new Ct(s),l=new Ht(this,this.view.snapshot,i,Ht.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(l),this.complete=!0,w.frameRendered(e,this.element),w.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else m(this,Rt,xs).call(this,e)&&m(this,At,$s).call(this,e)},wt=new WeakSet,Ws=async function(e){var s;const t=new Ne(this,C.get,e,new URLSearchParams,this.element);return(s=p(this,pe))==null||s.cancel(),S(this,pe,t),new Promise(i=>{S(this,F,()=>{S(this,F,()=>{}),S(this,pe,null),i()}),t.perform()})},Et=new WeakSet,Us=function(e,t,s){const i=m(this,x,ie).call(this,e,s);i.delegate.proposeVisitIfNavigatedWithAction(i,ee(s,e,i)),m(this,Pt,Ks).call(this,e,()=>{i.src=t})},yt=new WeakSet,_s=async function(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await m(this,Ve,Vt).call(this,e.response)},Rt=new WeakSet,xs=function(e){this.element.setAttribute("complete","");const t=e.response,s=async(l,g)=>{l instanceof Response?m(this,Ve,Vt).call(this,l):w.visit(l,g)};return!E("turbo:frame-missing",{target:this.element,detail:{response:t,visit:s},cancelable:!0}).defaultPrevented},At=new WeakSet,$s=function(e){this.view.missing(),m(this,Lt,js).call(this,e)},Lt=new WeakSet,js=function(e){const t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new ji(t)},Ve=new WeakSet,Vt=async function(e){const t=new Ut(e),s=await t.responseHTML,{location:i,redirected:l,statusCode:g}=t;return w.visit(i,{response:{redirected:l,statusCode:g,responseHTML:s}})},x=new WeakSet,ie=function(e,t){var i;const s=Qe("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=ss(s))!=null?i:this.element},Tt=new WeakSet,zs=function(e,t){const s=Wt(e,t);return N(L(s),this.rootLocation)},be=new WeakSet,Xe=function(e,t){const s=Qe("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!m(this,Tt,zs).call(this,e,t)||!this.enabled||s=="_top")return!1;if(s){const i=ss(s);if(i)return!i.disabled}return!(!w.elementIsNavigatable(e)||t&&!w.elementIsNavigatable(t))},De=new WeakSet,Dt=function(e){return p(this,ge).has(e)},ve=new WeakSet,Ye=function(e,t){p(this,ge).add(e),t(),p(this,ge).delete(e)},Pt=new WeakSet,Ks=function(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement};function ss(r){if(r!=null){const e=document.getElementById(r);if(e instanceof I)return e}}function rs(r,e){if(r){const t=r.getAttribute("src");if(t!=null&&e!=null&&fr(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof I)return r.connectedCallback(),r.disconnectedCallback(),r}}const Xs={after(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)==null?void 0:e.insertBefore(this.templateContent,r.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)==null?void 0:e.insertBefore(this.templateContent,r)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})},refresh(){w.refresh(this.baseURI,this.requestId)}};var G,ye;const Kt=class Kt extends HTMLElement{constructor(){super(...arguments);u(this,G)}static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){var t;return(t=this.renderPromise)!=null?t:this.renderPromise=(async()=>{const s=this.beforeRenderEvent;this.dispatchEvent(s)&&(await ae(),await s.detail.render(this))})()}disconnect(){try{this.remove()}catch(t){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){var i;const t=this.targetElements.flatMap(l=>[...l.children]).filter(l=>!!l.id),s=[...((i=this.templateContent)==null?void 0:i.children)||[]].filter(l=>!!l.id).map(l=>l.id);return t.filter(l=>s.includes(l.id))}get performAction(){if(this.action){const t=Xs[this.action];if(t)return t;m(this,G,ye).call(this,"unknown action")}m(this,G,ye).call(this,"action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;m(this,G,ye).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;m(this,G,ye).call(this,"first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}get description(){var t,s;return(s=((t=this.outerHTML.match(/<[^>]+>/))!=null?t:[])[0])!=null?s:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:Kt.renderElement}})}get targetElementsById(){var s;const t=(s=this.ownerDocument)==null?void 0:s.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var s;const t=(s=this.ownerDocument)==null?void 0:s.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}};G=new WeakSet,ye=function(t){throw new Error(`${this.description}: ${t}`)};let Nt=Kt;class Ki extends HTMLElement{constructor(){super(...arguments);c(this,"streamSource",null)}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Vs(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Ds(this.streamSource))}get src(){return this.getAttribute("src")||""}}I.delegateConstructor=zi;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",I);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Nt);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ki);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(ls`
    1821        You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
    1922
     
    2427        ——
    2528        Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
    26       `,s.outerHTML);s=s.parentElement}})();window.Turbo=_t;fe();
     29      `,r.outerHTML);r=r.parentElement}})();window.Turbo={...$i,StreamActions:Xs};Os();
Note: See TracChangeset for help on using the changeset viewer.