diff --git a/core-bundle/assets/controllers/choices-controller.js b/core-bundle/assets/controllers/choices-controller.js index 3af8b00f8ac..bc3bf157090 100644 --- a/core-bundle/assets/controllers/choices-controller.js +++ b/core-bundle/assets/controllers/choices-controller.js @@ -1,16 +1,17 @@ -import {Controller} from "@hotwired/stimulus" +import { Controller } from '@hotwired/stimulus'; export default class ChoicesController extends Controller { - mutationGuard = false; + addMutationGuard = false; + removeMutationGuard = false; connect() { - if (this._isGuarded()) { + if (this.addMutationGuard) { return; } // Choices wraps the element multiple times during initialization, leading to // multiple disconnects/reconnects of the controller that we need to ignore. - this._setGuard(); + this.addMutationGuard = true; const select = this.element; @@ -35,7 +36,9 @@ export default class ChoicesController extends Controller { choices.dataset.placeholder = select.dataset.placeholder; } - this._resetGuard(); + queueMicrotask(() => { + this.addMutationGuard = false; + }); }, loadingText: Contao.lang.loading, noResultsText: Contao.lang.noResults, @@ -43,11 +46,11 @@ export default class ChoicesController extends Controller { removeItemLabelText: function (value) { return Contao.lang.removeItem.concat(' ').concat(value); }, - }) + }); } disconnect() { - if (this._isGuarded()) { + if (this.addMutationGuard || this.removeMutationGuard) { return; } @@ -64,24 +67,13 @@ export default class ChoicesController extends Controller { _removeChoices() { // Safely unwrap the element by preventing disconnect/connect calls // during the process. - this._setGuard(); + this.removeMutationGuard = true; this.choices?.destroy(); this.choices = null; - this._resetGuard(); - } - - _setGuard() { - this.mutationGuard = true; - } - - _resetGuard() { - // Reset guard as soon as the call stack has cleared. - setTimeout(() => { this.mutationGuard = false; }, 0); - } - - _isGuarded() { - return this.mutationGuard; + queueMicrotask(() => { + this.removeMutationGuard = false; + }); } } diff --git a/core-bundle/public/backend.e4988065.js b/core-bundle/public/backend.2486388b.js similarity index 71% rename from core-bundle/public/backend.e4988065.js rename to core-bundle/public/backend.2486388b.js index 5e9992d6a3c..6e5a7de710e 100644 --- a/core-bundle/public/backend.e4988065.js +++ b/core-bundle/public/backend.2486388b.js @@ -1,5 +1,5 @@ -/*! For license information please see backend.e4988065.js.LICENSE.txt */ -!function(){var e={63:function(e,t,s){"use strict";s.r(t);var n=s(891);t.default=class extends n.xI{static targets=["input"];delete(){this.inputTargets.forEach((e=>{e.value=""}))}}},71:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return a}});var n=s(891),i=s(931);const r=class extends n.xI{initialize(){this.onSave=this.onSave.bind(this)}connect(){this.picker=i.create({el:this.buttonTarget,theme:this.themeValue,default:this.inputTarget.value,swatches:this.swatches,components:this.componentOptions}),this.picker.on("save",this.onSave)}disconnect(){this.picker.destroy()}onSave(e){this.inputTarget.value=null,e&&(this.inputTarget.value=e.toHEXA().toString()),this.picker.hide()}get componentOptions(){return{preview:!0,hue:!0,interaction:{input:!0,clear:!0,save:!0}}}get swatches(){return["#A0AEC0","#F56565","#ED8936","#ECC94B","#48BB78","#38B2AC","#4299E1","#667EEA","#9F7AEA","#ED64A6"]}};r.targets=["button","input"],r.values={theme:{type:String,default:"classic"}};let o=r;var a=class extends o{onSave(e){if(this.inputTarget.value=null,e){let t=e.toHEXA().toString();"#"===t.charAt(0)&&(t=t.substring(1)),this.inputTarget.value=t.toLowerCase()}this.picker.hide()}}},89:function(e,t,s){"use strict";s.d(t,{YR:function(){return Mt}}),function(e){function t(e,t,s){throw new e("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+t+".",s)}"function"!=typeof e.requestSubmit&&(e.requestSubmit=function(e){e?(!function(e,s){e instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==e.type||t(TypeError,"The specified element is not a submit button"),e.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}(e,this),e.click()):((e=document.createElement("input")).type="submit",e.hidden=!0,this.appendChild(e),e.click(),this.removeChild(e))})}(HTMLFormElement.prototype);const n=new WeakMap;function i(e){const t=function(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null,s=t?t.closest("input, button"):null;return"submit"==s?.type?s:null}(e.target);t&&t.form&&n.set(t.form,t)}!function(){if("submitter"in Event.prototype)return;let e=window.Event.prototype;if("SubmitEvent"in window){const t=window.SubmitEvent.prototype;if(!/Apple Computer/.test(navigator.vendor)||"submitter"in t)return;e=t}addEventListener("click",i,!0),Object.defineProperty(e,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return n.get(this.target)}})}();const r="eager",o="lazy";class a extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new a.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){"loading"==e?this.delegate.loadingStyleChanged():"src"==e?this.delegate.sourceURLChanged():"disabled"==e&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&"morph"===this.refresh}get loading(){return function(e){if("lazy"===e.toLowerCase())return o;return r}(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}}const l={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function c(e){if("false"==e.getAttribute("data-turbo-eval"))return e;{const t=document.createElement("script"),s=_();return s&&(t.nonce=s),t.textContent=e.textContent,t.async=!1,function(e,t){for(const{name:s,value:n}of t.attributes)e.setAttribute(s,n)}(t,e),t}}function u(e,{target:t,cancelable:s,detail:n}={}){const i=new CustomEvent(e,{cancelable:s,bubbles:!0,composed:!0,detail:n});return t&&t.isConnected?t.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function h(e){e.preventDefault(),e.stopImmediatePropagation()}function d(){return"hidden"===document.visibilityState?p():m()}function m(){return new Promise((e=>requestAnimationFrame((()=>e()))))}function p(){return new Promise((e=>setTimeout((()=>e()),0)))}function g(e=""){return(new DOMParser).parseFromString(e,"text/html")}function f(e,...t){const s=function(e,t){return e.reduce(((e,s,n)=>e+s+(null==t[n]?"":t[n])),"")}(e,t).replace(/^\n/,"").split("\n"),n=s[0].match(/^\s+/),i=n?n[0].length:0;return s.map((e=>e.slice(i))).join("\n")}function b(){return Array.from({length:36}).map(((e,t)=>8==t||13==t||18==t||23==t?"-":14==t?"4":19==t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16))).join("")}function v(e,...t){for(const s of t.map((t=>t?.getAttribute(e))))if("string"==typeof s)return s;return null}function y(...e){for(const t of e)"turbo-frame"==t.localName&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function w(...e){for(const t of e)"turbo-frame"==t.localName&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function E(e,t=2e3){return new Promise((s=>{const n=()=>{e.removeEventListener("error",n),e.removeEventListener("load",n),s()};e.addEventListener("load",n,{once:!0}),e.addEventListener("error",n,{once:!0}),setTimeout(s,t)}))}function S(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function C(...e){const t=v("data-turbo-action",...e);return function(e){return"advance"==e||"replace"==e||"restore"==e}(t)?t:null}function T(e){return document.querySelector(`meta[name="${e}"]`)}function A(e){const t=T(e);return t&&t.content}function _(){const e=T("csp-nonce");if(e){const{nonce:t,content:s}=e;return""==t?s:t}}function M(e,t){if(e instanceof Element)return e.closest(t)||M(e.assignedSlot||e.getRootNode()?.host,t)}function k(e){return!!e&&null==e.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")&&"function"==typeof e.focus}function L(e){return Array.from(e.querySelectorAll("[autofocus]")).find(k)}function x(e){if("_blank"===e)return!1;if(e){for(const t of document.getElementsByName(e))if(t instanceof HTMLIFrameElement)return!1;return!0}return!0}function R(e){return M(e,"a[href]:not([target^=_]):not([download])")}function O(e){return D(e.getAttribute("href")||"")}const I={"aria-disabled":{beforeSubmit:e=>{e.setAttribute("aria-disabled","true"),e.addEventListener("click",h)},afterSubmit:e=>{e.removeAttribute("aria-disabled"),e.removeEventListener("click",h)}},disabled:{beforeSubmit:e=>e.disabled=!0,afterSubmit:e=>e.disabled=!1}};const F=new class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=I[e]||e}}({mode:"on",submitter:"disabled"}),P={drive:l,forms:F};function D(e){return new URL(e.toString(),document.baseURI)}function N(e){let t;return e.hash?e.hash.slice(1):(t=e.href.match(/#(.*)$/))?t[1]:void 0}function $(e,t){return D(t?.getAttribute("formaction")||e.getAttribute("action")||e.action)}function q(e){return(function(e){return function(e){return e.pathname.split("/").slice(1)}(e).slice(-1)[0]}(e).match(/\.[^.]*$/)||[])[0]||""}function B(e,t){const s=function(e){return t=e.origin+e.pathname,t.endsWith("/")?t:t+"/";var t}(t);return e.href===D(s).href||e.href.startsWith(s)}function V(e,t){return B(e,t)&&!P.drive.unvisitableExtensions.has(q(e))}function H(e){const t=N(e);return null!=t?e.href.slice(0,-(t.length+1)):e.href}function j(e){return H(e)}class U{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 D(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}class K extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){const e=this.values().next().value;this.delete(e)}super.add(e)}}const z=new K(20),W=window.fetch;function G(e,t={}){const s=new Headers(t.headers||{}),n=b();return z.add(n),s.append("X-Turbo-Request-Id",n),W(e,{...t,headers:s})}function X(e){switch(e.toLowerCase()){case"get":return J.get;case"post":return J.post;case"put":return J.put;case"patch":return J.patch;case"delete":return J.delete}}const J={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};const Y={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};class Q{abortController=new AbortController;#t=e=>{};constructor(e,t,s,n=new URLSearchParams,i=null,r=Y.urlEncoded){const[o,a]=ee(D(s),t,n,r);this.delegate=e,this.url=o,this.target=i,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:a,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=r}get method(){return this.fetchOptions.method}set method(e){const t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=X(e)||J.get;this.url.search="";const[n,i]=ee(this.url,s,t,this.enctype);this.url=n,this.fetchOptions.body=i,this.fetchOptions.method=s.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this);const t=await this.#s(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=G(this.url.href,e);const s=await this.response;return await this.receive(s)}catch(e){if("AbortError"!==e.name)throw this.#n(e)&&this.delegate.requestErrored(this,e),e}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new U(e);return u("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 Z(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#s(e){const t=new Promise((e=>this.#t=e)),s=u("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#t},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await t,s}#n(e){return!u("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}}function Z(e){return X(e)==J.get}function ee(e,t,s,n){const i=Array.from(s).length>0?new URLSearchParams(te(s)):e.searchParams;return Z(t)?[se(e,i),null]:n==Y.urlEncoded?[e,i]:[e,s]}function te(e){const t=[];for(const[s,n]of e)n instanceof File||t.push([s,n]);return t}function se(e,t){const s=new URLSearchParams(te(t));return e.search=s.toString(),e}class ne{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{const t=e.slice(-1)[0];t?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}}class ie{static contentType="text/vnd.turbo-stream.html";static wrap(e){return"string"==typeof e?new this(function(e){const t=document.createElement("template");return t.innerHTML=e,t.content}(e)):e}constructor(e){this.fragment=function(e){for(const t of e.querySelectorAll("turbo-stream")){const e=document.importNode(t,!0);for(const t of e.templateElement.content.querySelectorAll("script"))t.replaceWith(c(t));t.replaceWith(e)}return e}(e)}}const re=new class{#i=null;#r=null;get(e){if(this.#r&&this.#r.url===e&&this.#r.expire>Date.now())return this.#r.request}setLater(e,t,s){this.clear(),this.#i=setTimeout((()=>{t.perform(),this.set(e,t,s),this.#i=null}),100)}set(e,t,s){this.#r={url:e,request:t,expire:new Date((new Date).getTime()+s)}}clear(){this.#i&&clearTimeout(this.#i),this.#r=null}},oe={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class ae{state=oe.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,s,n=!1){const i=function(e,t){const s=t?.getAttribute("formmethod")||e.getAttribute("method")||"";return X(s.toLowerCase())||J.get}(t,s),r=function(e,t){const s=D(e);Z(t)&&(s.search="");return s}(function(e,t){const s="string"==typeof e.action?e.action:null;return t?.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||s||""}(t,s),i),o=function(e,t){const s=new FormData(e),n=t?.getAttribute("name"),i=t?.getAttribute("value");n&&s.append(n,i||"");return s}(t,s),a=function(e,t){return function(e){switch(e.toLowerCase()){case Y.multipart:return Y.multipart;case Y.plain:return Y.plain;default:return Y.urlEncoded}}(t?.getAttribute("formenctype")||e.enctype)}(t,s);this.delegate=e,this.formElement=t,this.submitter=s,this.fetchRequest=new Q(this,i,r,o,t,a),this.mustRedirect=n}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=D(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}=oe,s=v("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof s){const e="function"==typeof P.forms.confirm?P.forms.confirm:ae.confirmMethod;if(!await e(s,this.formElement,this.submitter))return}if(this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=oe;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=function(e){if(null!=e){const t=(document.cookie?document.cookie.split("; "):[]).find((t=>t.startsWith(e)));if(t){const e=t.split("=").slice(1).join("=");return e?decodeURIComponent(e):void 0}}}(A("csrf-param"))||A("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(ie.contentType)}requestStarted(e){this.state=oe.waiting,this.submitter&&P.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),y(this.formElement),u("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){re.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(re.clear(),this.requestMustRedirect(e)&&function(e){return 200==e.statusCode&&!e.redirected}(t)){const e=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,e)}else this.state=oe.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=oe.stopped,this.submitter&&P.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),w(this.formElement),u("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")){this.submitter.value=this.originalSubmitText}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||function(e,...t){return t.some((t=>t&&t.hasAttribute(e)))}("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}}class le{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return null!=this.getElementForAnchor(e)}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return L(this.element)}get permanentElements(){return ue(this.element)}getPermanentElementById(e){return ce(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const s of this.permanentElements){const{id:n}=s,i=e.getPermanentElementById(n);i&&(t[n]=[s,i])}return t}}function ce(e,t){return e.querySelector(`#${t}[data-turbo-permanent]`)}function ue(e){return e.querySelectorAll("[id][data-turbo-permanent]")}class he{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,s=e.submitter||void 0;t&&function(e,t){const s=t?.getAttribute("formmethod")||e.getAttribute("method");return"dialog"!=s}(t,s)&&function(e,t){const s=t?.getAttribute("formtarget")||e.getAttribute("target");return x(s)}(t,s)&&this.delegate.willSubmitForm(t,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,s))}}}class de{#o=e=>{};#a=e=>{};constructor(e,t){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(N(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:n,newSnapshot:i}=e,r=n;if(s)try{this.renderPromise=new Promise((e=>this.#o=e)),this.renderer=e,await this.prepareToRenderSnapshot(e);const s=new Promise((e=>this.#a=e)),n={resume:this.#a,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(i,n)||await s,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(i,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#o(void 0),delete this.renderPromise}else r&&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()}}class me extends de{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new le(this.element)}}class pe{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){const t=e.composed?e.target?.parentElement:e.target,s=R(t)||t;return s instanceof Element&&s.closest("turbo-frame, html")==this.element}}class ge{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=R(e.composedPath&&e.composedPath()[0]||e.target);if(t&&x(t.target)){const s=O(t);this.delegate.willFollowLinkToLocation(t,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(t,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}}class fe{constructor(e,t){this.delegate=e,this.linkInterceptor=new ge(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");for(const[e,n]of t.searchParams)s.append(Object.assign(document.createElement("input"),{type:"hidden",name:e,value:n}));const n=Object.assign(t,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",n.href),s.setAttribute("hidden","");const i=e.getAttribute("data-turbo-method");i&&s.setAttribute("method",i);const r=e.getAttribute("data-turbo-frame");r&&s.setAttribute("data-turbo-frame",r);const o=C(e);o&&s.setAttribute("data-turbo-action",o);const a=e.getAttribute("data-turbo-confirm");a&&s.setAttribute("data-turbo-confirm",a);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 be{static async preservingPermanentElements(e,t,s){const n=new this(e,t);n.enter(),await s(),n.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=function(e){const t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",e.id),t}(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){const t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){const t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find((t=>t.content==e))}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class ve{#l=null;static renderElement(e,t){}constructor(e,t,s,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=n,this.renderElement=this.constructor.renderElement,this.promise=new Promise(((e,t)=>this.resolvingFunctions={resolve:e,reject:t}))}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await be.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){const e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#l||e.contains(this.currentSnapshot.activeElement)&&(this.#l=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#l)&&this.#l instanceof HTMLElement&&(this.#l.focus(),this.#l=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"}}class ye extends ve{static renderElement(e,t){const s=document.createRange();s.selectNodeContents(e),s.deleteContents();const n=t,i=n.ownerDocument?.createRange();i&&(i.selectNodeContents(n),e.appendChild(i.extractContents()))}constructor(e,t,s,n,i,r=!0){super(t,s,n,i,r),this.delegate=e}get shouldRender(){return!0}async render(){await d(),this.preservingPermanentElements((()=>{this.loadFrameElement()})),this.scrollFrameIntoView(),await d(),this.focusFirstAutofocusableElement(),await d(),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 s=this.currentElement.firstElementChild,n=(e=this.currentElement.getAttribute("data-autoscroll-block"),t="end","end"==e||"start"==e||"center"==e||"nearest"==e?e:t),i=function(e,t){return"auto"==e||"smooth"==e?e:t}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(s)return s.scrollIntoView({block:n,behavior:i}),!0}var e,t;return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=c(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}var we=function(){const e=()=>{},t={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:e=>"true"===e.getAttribute("im-preserve"),shouldReAppend:e=>"true"===e.getAttribute("im-re-append"),shouldRemove:e,afterHeadMorphed:e},restoreFocus:!0};const s=function(){function e(e,t,s,i){if(!1===i.callbacks.beforeNodeAdded(t))return null;if(i.idMap.has(t)){const r=document.createElement(t.tagName);return e.insertBefore(r,s),n(r,t,i),i.callbacks.afterNodeAdded(r),r}{const n=document.importNode(t,!0);return e.insertBefore(n,s),i.callbacks.afterNodeAdded(n),n}}const t=function(){function e(e,t,s){let n=e.idMap.get(t),i=e.idMap.get(s);if(!i||!n)return!1;for(const e of n)if(i.has(e))return!0;return!1}function t(e,t){const s=e,n=t;return s.nodeType===n.nodeType&&s.tagName===n.tagName&&(!s.id||s.id===n.id)}return function(s,n,i,r){let o=null,a=n.nextSibling,l=0,c=i;for(;c&&c!=r;){if(t(c,n)){if(e(s,c,n))return c;null===o&&(s.idMap.has(c)||(o=c))}if(null===o&&a&&t(c,a)&&(l++,a=a.nextSibling,l>=2&&(o=void 0)),c.contains(document.activeElement))break;c=c.nextSibling}return o||null}}();function s(e,t){if(e.idMap.has(t))o(e.pantry,t,null);else{if(!1===e.callbacks.beforeNodeRemoved(t))return;t.parentNode?.removeChild(t),e.callbacks.afterNodeRemoved(t)}}function i(e,t,n){let i=t;for(;i&&i!==n;){let t=i;i=i.nextSibling,s(e,t)}return i}function r(e,t,s,n){const i=n.target.querySelector(`#${t}`)||n.pantry.querySelector(`#${t}`);return function(e,t){const s=e.id;for(;e=e.parentNode;){let n=t.idMap.get(e);n&&(n.delete(s),n.size||t.idMap.delete(e))}}(i,n),o(e,i,s),i}function o(e,t,s){if(e.moveBefore)try{e.moveBefore(t,s)}catch(n){e.insertBefore(t,s)}else e.insertBefore(t,s)}return function(o,a,l,c=null,u=null){a instanceof HTMLTemplateElement&&l instanceof HTMLTemplateElement&&(a=a.content,l=l.content),c||=a.firstChild;for(const s of l.childNodes){if(c&&c!=u){const e=t(o,s,c,u);if(e){e!==c&&i(o,c,e),n(e,s,o),c=e.nextSibling;continue}}if(s instanceof Element&&o.persistentIds.has(s.id)){const e=r(a,s.id,c,o);n(e,s,o),c=e.nextSibling;continue}const l=e(a,s,c,o);l&&(c=l.nextSibling)}for(;c&&c!=u;){const e=c;c=c.nextSibling,s(o,e)}}}(),n=function(){function e(e,s,n,i){const r=s[n];if(r!==e[n]){const o=t(n,e,"update",i);o||(e[n]=s[n]),r?o||e.setAttribute(n,""):t(n,e,"remove",i)||e.removeAttribute(n)}}function t(e,t,s,n){return!("value"!==e||!n.ignoreActiveValue||t!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(e,t,s)}function n(e,t){return!!t.ignoreActiveValue&&e===document.activeElement&&e!==document.body}return function(r,o,a){return a.ignoreActive&&r===document.activeElement?null:(!1===a.callbacks.beforeNodeMorphed(r,o)||(r instanceof HTMLHeadElement&&a.head.ignore||(r instanceof HTMLHeadElement&&"morph"!==a.head.style?i(r,o,a):(!function(s,i,r){let o=i.nodeType;if(1===o){const o=s,a=i,l=o.attributes,c=a.attributes;for(const e of c)t(e.name,o,"update",r)||o.getAttribute(e.name)!==e.value&&o.setAttribute(e.name,e.value);for(let e=l.length-1;0<=e;e--){const s=l[e];if(s&&!a.hasAttribute(s.name)){if(t(s.name,o,"remove",r))continue;o.removeAttribute(s.name)}}n(o,r)||function(s,n,i){if(s instanceof HTMLInputElement&&n instanceof HTMLInputElement&&"file"!==n.type){let r=n.value,o=s.value;e(s,n,"checked",i),e(s,n,"disabled",i),n.hasAttribute("value")?o!==r&&(t("value",s,"update",i)||(s.setAttribute("value",r),s.value=r)):t("value",s,"remove",i)||(s.value="",s.removeAttribute("value"))}else if(s instanceof HTMLOptionElement&&n instanceof HTMLOptionElement)e(s,n,"selected",i);else if(s instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement){let e=n.value,r=s.value;if(t("value",s,"update",i))return;e!==r&&(s.value=e),s.firstChild&&s.firstChild.nodeValue!==e&&(s.firstChild.nodeValue=e)}}(o,a,r)}8!==o&&3!==o||s.nodeValue!==i.nodeValue&&(s.nodeValue=i.nodeValue)}(r,o,a),n(r,a)||s(a,r,o))),a.callbacks.afterNodeMorphed(r,o)),r)}}();function i(e,t,s){let n=[],i=[],r=[],o=[],a=new Map;for(const e of t.children)a.set(e.outerHTML,e);for(const t of e.children){let e=a.has(t.outerHTML),n=s.head.shouldReAppend(t),l=s.head.shouldPreserve(t);e||l?n?i.push(t):(a.delete(t.outerHTML),r.push(t)):"append"===s.head.style?n&&(i.push(t),o.push(t)):!1!==s.head.shouldRemove(t)&&i.push(t)}o.push(...a.values());let l=[];for(const t of o){let i=document.createRange().createContextualFragment(t.outerHTML).firstChild;if(!1!==s.callbacks.beforeNodeAdded(i)){if("href"in i&&i.href||"src"in i&&i.src){let e,t=new Promise((function(t){e=t}));i.addEventListener("load",(function(){e()})),l.push(t)}e.appendChild(i),s.callbacks.afterNodeAdded(i),n.push(i)}}for(const t of i)!1!==s.callbacks.beforeNodeRemoved(t)&&(e.removeChild(t),s.callbacks.afterNodeRemoved(t));return s.head.afterHeadMorphed(e,{added:n,kept:r,removed:i}),l}const r=function(){function e(){const e=document.createElement("div");return e.hidden=!0,document.body.insertAdjacentElement("afterend",e),e}function s(e){let t=Array.from(e.querySelectorAll("[id]"));return e.id&&t.push(e),t}function n(e,t,s,n){for(const i of n)if(t.has(i.id)){let t=i;for(;t;){let n=e.get(t);if(null==n&&(n=new Set,e.set(t,n)),n.add(i.id),t===s)break;t=t.parentElement}}}return function(i,r,o){const{persistentIds:a,idMap:l}=function(e,t){const i=s(e),r=s(t),o=function(e,t){let s=new Set,n=new Map;for(const{id:t,tagName:i}of e)n.has(t)?s.add(t):n.set(t,i);let i=new Set;for(const{id:e,tagName:r}of t)i.has(e)?s.add(e):n.get(e)===r&&i.add(e);for(const e of s)i.delete(e);return i}(i,r);let a=new Map;n(a,o,e,i);const l=t.__idiomorphRoot||t;return n(a,o,l,r),{persistentIds:o,idMap:a}}(i,r),c=function(e){let s=Object.assign({},t);return Object.assign(s,e),s.callbacks=Object.assign({},t.callbacks,e.callbacks),s.head=Object.assign({},t.head,e.head),s}(o),u=c.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(u))throw`Do not understand how to morph style ${u}`;return{target:i,newContent:r,config:c,morphStyle:u,ignoreActive:c.ignoreActive,ignoreActiveValue:c.ignoreActiveValue,restoreFocus:c.restoreFocus,idMap:l,persistentIds:a,pantry:e(),callbacks:c.callbacks,head:c.head}}}(),{normalizeElement:o,normalizeParent:a}=function(){const e=new WeakSet;return{normalizeElement:function(e){return e instanceof Document?e.documentElement:e},normalizeParent:function t(s){if(null==s)return document.createElement("div");if("string"==typeof s)return t(function(t){let s=new DOMParser,n=t.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(n.match(/<\/html>/)||n.match(/<\/head>/)||n.match(/<\/body>/)){let i=s.parseFromString(t,"text/html");if(n.match(/<\/html>/))return e.add(i),i;{let t=i.firstChild;return t&&e.add(t),t}}{let n=s.parseFromString("","text/html").body.querySelector("template").content;return e.add(n),n}}(s));if(e.has(s))return s;if(s instanceof Node){if(s.parentNode)return function(e){return{childNodes:[e],querySelectorAll:t=>{const s=e.querySelectorAll(t);return e.matches(t)?[e,...s]:s},insertBefore:(t,s)=>e.parentNode.insertBefore(t,s),moveBefore:(t,s)=>e.parentNode.moveBefore(t,s),get __idiomorphRoot(){return e}}}(s);{const e=document.createElement("div");return e.append(s),e}}{const e=document.createElement("div");for(const t of[...s])e.append(t);return e}}}}();return{morph:function(e,t,n={}){e=o(e);const l=a(t),c=r(e,l,n),u=function(e,t){if(!e.config.restoreFocus)return t();let s=document.activeElement;if(!(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement))return t();const{id:n,selectionStart:i,selectionEnd:r}=s,o=t();n&&n!==document.activeElement?.id&&(s=e.target.querySelector(`#${n}`),s?.focus());s&&!s.selectionEnd&&r&&s.setSelectionRange(i,r);return o}(c,(()=>function(e,t,s,n){if(e.head.block){const r=t.querySelector("head"),o=s.querySelector("head");if(r&&o){const t=i(r,o,e);return Promise.all(t).then((()=>{const t=Object.assign(e,{head:{block:!1,ignore:!0}});return n(t)}))}}return n(e)}(c,e,l,(t=>"innerHTML"===t.morphStyle?(s(t,e,l),Array.from(e.childNodes)):function(e,t,n){const i=a(t);let r=Array.from(i.childNodes);const o=r.indexOf(t),l=r.length-(o+1);return s(e,i,n,t,t.nextSibling),r=Array.from(i.childNodes),r.slice(o,r.length-l)}(t,e,l)))));return c.pantry.remove(),u},defaults:t}}();function Ee(e,t,{callbacks:s,...n}={}){we.morph(e,t,{...n,callbacks:new Ce(s)})}function Se(e,t){Ee(e,t.childNodes,{morphStyle:"innerHTML"})}class Ce{#c;constructor({beforeNodeMorphed:e}={}){this.#c=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element){if(!e.hasAttribute("data-turbo-permanent")&&this.#c(e,t)){return!u("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented}return!1}};beforeAttributeUpdated=(e,t,s)=>!u("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:s}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&u("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}}class Te extends ye{static renderElement(e,t){u("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Se(e,t)}async preservingPermanentElements(e){return await e()}}class Ae{static animationDuration=300;static get defaultCSS(){return f` +/*! For license information please see backend.2486388b.js.LICENSE.txt */ +!function(){var e={63:function(e,t,s){"use strict";s.r(t);var n=s(891);t.default=class extends n.xI{static targets=["input"];delete(){this.inputTargets.forEach((e=>{e.value=""}))}}},71:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return a}});var n=s(891),i=s(931);const r=class extends n.xI{initialize(){this.onSave=this.onSave.bind(this)}connect(){this.picker=i.create({el:this.buttonTarget,theme:this.themeValue,default:this.inputTarget.value,swatches:this.swatches,components:this.componentOptions}),this.picker.on("save",this.onSave)}disconnect(){this.picker.destroy()}onSave(e){this.inputTarget.value=null,e&&(this.inputTarget.value=e.toHEXA().toString()),this.picker.hide()}get componentOptions(){return{preview:!0,hue:!0,interaction:{input:!0,clear:!0,save:!0}}}get swatches(){return["#A0AEC0","#F56565","#ED8936","#ECC94B","#48BB78","#38B2AC","#4299E1","#667EEA","#9F7AEA","#ED64A6"]}};r.targets=["button","input"],r.values={theme:{type:String,default:"classic"}};let o=r;var a=class extends o{onSave(e){if(this.inputTarget.value=null,e){let t=e.toHEXA().toString();"#"===t.charAt(0)&&(t=t.substring(1)),this.inputTarget.value=t.toLowerCase()}this.picker.hide()}}},89:function(e,t,s){"use strict";s.d(t,{YR:function(){return _t}}),function(e){function t(e,t,s){throw new e("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+t+".",s)}"function"!=typeof e.requestSubmit&&(e.requestSubmit=function(e){e?(!function(e,s){e instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==e.type||t(TypeError,"The specified element is not a submit button"),e.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}(e,this),e.click()):((e=document.createElement("input")).type="submit",e.hidden=!0,this.appendChild(e),e.click(),this.removeChild(e))})}(HTMLFormElement.prototype);const n=new WeakMap;function i(e){const t=function(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null,s=t?t.closest("input, button"):null;return"submit"==s?.type?s:null}(e.target);t&&t.form&&n.set(t.form,t)}!function(){if("submitter"in Event.prototype)return;let e=window.Event.prototype;if("SubmitEvent"in window){const t=window.SubmitEvent.prototype;if(!/Apple Computer/.test(navigator.vendor)||"submitter"in t)return;e=t}addEventListener("click",i,!0),Object.defineProperty(e,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return n.get(this.target)}})}();const r="eager",o="lazy";class a extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new a.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){"loading"==e?this.delegate.loadingStyleChanged():"src"==e?this.delegate.sourceURLChanged():"disabled"==e&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&"morph"===this.refresh}get loading(){return function(e){if("lazy"===e.toLowerCase())return o;return r}(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}}const l={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function c(e){if("false"==e.getAttribute("data-turbo-eval"))return e;{const t=document.createElement("script"),s=M();return s&&(t.nonce=s),t.textContent=e.textContent,t.async=!1,function(e,t){for(const{name:s,value:n}of t.attributes)e.setAttribute(s,n)}(t,e),t}}function u(e,{target:t,cancelable:s,detail:n}={}){const i=new CustomEvent(e,{cancelable:s,bubbles:!0,composed:!0,detail:n});return t&&t.isConnected?t.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function h(e){e.preventDefault(),e.stopImmediatePropagation()}function d(){return"hidden"===document.visibilityState?p():m()}function m(){return new Promise((e=>requestAnimationFrame((()=>e()))))}function p(){return new Promise((e=>setTimeout((()=>e()),0)))}function g(e=""){return(new DOMParser).parseFromString(e,"text/html")}function f(e,...t){const s=function(e,t){return e.reduce(((e,s,n)=>e+s+(null==t[n]?"":t[n])),"")}(e,t).replace(/^\n/,"").split("\n"),n=s[0].match(/^\s+/),i=n?n[0].length:0;return s.map((e=>e.slice(i))).join("\n")}function b(){return Array.from({length:36}).map(((e,t)=>8==t||13==t||18==t||23==t?"-":14==t?"4":19==t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16))).join("")}function v(e,...t){for(const s of t.map((t=>t?.getAttribute(e))))if("string"==typeof s)return s;return null}function y(...e){for(const t of e)"turbo-frame"==t.localName&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function w(...e){for(const t of e)"turbo-frame"==t.localName&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function E(e,t=2e3){return new Promise((s=>{const n=()=>{e.removeEventListener("error",n),e.removeEventListener("load",n),s()};e.addEventListener("load",n,{once:!0}),e.addEventListener("error",n,{once:!0}),setTimeout(s,t)}))}function S(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function C(...e){const t=v("data-turbo-action",...e);return function(e){return"advance"==e||"replace"==e||"restore"==e}(t)?t:null}function T(e){return document.querySelector(`meta[name="${e}"]`)}function A(e){const t=T(e);return t&&t.content}function M(){const e=T("csp-nonce");if(e){const{nonce:t,content:s}=e;return""==t?s:t}}function _(e,t){if(e instanceof Element)return e.closest(t)||_(e.assignedSlot||e.getRootNode()?.host,t)}function k(e){return!!e&&null==e.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")&&"function"==typeof e.focus}function L(e){return Array.from(e.querySelectorAll("[autofocus]")).find(k)}function x(e){if("_blank"===e)return!1;if(e){for(const t of document.getElementsByName(e))if(t instanceof HTMLIFrameElement)return!1;return!0}return!0}function R(e){return _(e,"a[href]:not([target^=_]):not([download])")}function O(e){return D(e.getAttribute("href")||"")}const I={"aria-disabled":{beforeSubmit:e=>{e.setAttribute("aria-disabled","true"),e.addEventListener("click",h)},afterSubmit:e=>{e.removeAttribute("aria-disabled"),e.removeEventListener("click",h)}},disabled:{beforeSubmit:e=>e.disabled=!0,afterSubmit:e=>e.disabled=!1}};const F=new class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=I[e]||e}}({mode:"on",submitter:"disabled"}),P={drive:l,forms:F};function D(e){return new URL(e.toString(),document.baseURI)}function N(e){let t;return e.hash?e.hash.slice(1):(t=e.href.match(/#(.*)$/))?t[1]:void 0}function $(e,t){return D(t?.getAttribute("formaction")||e.getAttribute("action")||e.action)}function q(e){return(function(e){return function(e){return e.pathname.split("/").slice(1)}(e).slice(-1)[0]}(e).match(/\.[^.]*$/)||[])[0]||""}function B(e,t){const s=function(e){return t=e.origin+e.pathname,t.endsWith("/")?t:t+"/";var t}(t);return e.href===D(s).href||e.href.startsWith(s)}function V(e,t){return B(e,t)&&!P.drive.unvisitableExtensions.has(q(e))}function H(e){const t=N(e);return null!=t?e.href.slice(0,-(t.length+1)):e.href}function j(e){return H(e)}class U{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 D(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}class K extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){const e=this.values().next().value;this.delete(e)}super.add(e)}}const z=new K(20),W=window.fetch;function G(e,t={}){const s=new Headers(t.headers||{}),n=b();return z.add(n),s.append("X-Turbo-Request-Id",n),W(e,{...t,headers:s})}function X(e){switch(e.toLowerCase()){case"get":return J.get;case"post":return J.post;case"put":return J.put;case"patch":return J.patch;case"delete":return J.delete}}const J={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};const Y={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};class Q{abortController=new AbortController;#t=e=>{};constructor(e,t,s,n=new URLSearchParams,i=null,r=Y.urlEncoded){const[o,a]=ee(D(s),t,n,r);this.delegate=e,this.url=o,this.target=i,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:a,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=r}get method(){return this.fetchOptions.method}set method(e){const t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=X(e)||J.get;this.url.search="";const[n,i]=ee(this.url,s,t,this.enctype);this.url=n,this.fetchOptions.body=i,this.fetchOptions.method=s.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this);const t=await this.#s(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=G(this.url.href,e);const s=await this.response;return await this.receive(s)}catch(e){if("AbortError"!==e.name)throw this.#n(e)&&this.delegate.requestErrored(this,e),e}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new U(e);return u("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 Z(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#s(e){const t=new Promise((e=>this.#t=e)),s=u("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#t},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await t,s}#n(e){return!u("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}}function Z(e){return X(e)==J.get}function ee(e,t,s,n){const i=Array.from(s).length>0?new URLSearchParams(te(s)):e.searchParams;return Z(t)?[se(e,i),null]:n==Y.urlEncoded?[e,i]:[e,s]}function te(e){const t=[];for(const[s,n]of e)n instanceof File||t.push([s,n]);return t}function se(e,t){const s=new URLSearchParams(te(t));return e.search=s.toString(),e}class ne{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{const t=e.slice(-1)[0];t?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}}class ie{static contentType="text/vnd.turbo-stream.html";static wrap(e){return"string"==typeof e?new this(function(e){const t=document.createElement("template");return t.innerHTML=e,t.content}(e)):e}constructor(e){this.fragment=function(e){for(const t of e.querySelectorAll("turbo-stream")){const e=document.importNode(t,!0);for(const t of e.templateElement.content.querySelectorAll("script"))t.replaceWith(c(t));t.replaceWith(e)}return e}(e)}}const re=new class{#i=null;#r=null;get(e){if(this.#r&&this.#r.url===e&&this.#r.expire>Date.now())return this.#r.request}setLater(e,t,s){this.clear(),this.#i=setTimeout((()=>{t.perform(),this.set(e,t,s),this.#i=null}),100)}set(e,t,s){this.#r={url:e,request:t,expire:new Date((new Date).getTime()+s)}}clear(){this.#i&&clearTimeout(this.#i),this.#r=null}},oe={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class ae{state=oe.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,s,n=!1){const i=function(e,t){const s=t?.getAttribute("formmethod")||e.getAttribute("method")||"";return X(s.toLowerCase())||J.get}(t,s),r=function(e,t){const s=D(e);Z(t)&&(s.search="");return s}(function(e,t){const s="string"==typeof e.action?e.action:null;return t?.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||s||""}(t,s),i),o=function(e,t){const s=new FormData(e),n=t?.getAttribute("name"),i=t?.getAttribute("value");n&&s.append(n,i||"");return s}(t,s),a=function(e,t){return function(e){switch(e.toLowerCase()){case Y.multipart:return Y.multipart;case Y.plain:return Y.plain;default:return Y.urlEncoded}}(t?.getAttribute("formenctype")||e.enctype)}(t,s);this.delegate=e,this.formElement=t,this.submitter=s,this.fetchRequest=new Q(this,i,r,o,t,a),this.mustRedirect=n}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=D(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}=oe,s=v("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof s){const e="function"==typeof P.forms.confirm?P.forms.confirm:ae.confirmMethod;if(!await e(s,this.formElement,this.submitter))return}if(this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=oe;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=function(e){if(null!=e){const t=(document.cookie?document.cookie.split("; "):[]).find((t=>t.startsWith(e)));if(t){const e=t.split("=").slice(1).join("=");return e?decodeURIComponent(e):void 0}}}(A("csrf-param"))||A("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(ie.contentType)}requestStarted(e){this.state=oe.waiting,this.submitter&&P.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),y(this.formElement),u("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){re.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(re.clear(),this.requestMustRedirect(e)&&function(e){return 200==e.statusCode&&!e.redirected}(t)){const e=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,e)}else this.state=oe.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=oe.stopped,this.submitter&&P.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),w(this.formElement),u("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")){this.submitter.value=this.originalSubmitText}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||function(e,...t){return t.some((t=>t&&t.hasAttribute(e)))}("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}}class le{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return null!=this.getElementForAnchor(e)}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return L(this.element)}get permanentElements(){return ue(this.element)}getPermanentElementById(e){return ce(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const s of this.permanentElements){const{id:n}=s,i=e.getPermanentElementById(n);i&&(t[n]=[s,i])}return t}}function ce(e,t){return e.querySelector(`#${t}[data-turbo-permanent]`)}function ue(e){return e.querySelectorAll("[id][data-turbo-permanent]")}class he{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,s=e.submitter||void 0;t&&function(e,t){const s=t?.getAttribute("formmethod")||e.getAttribute("method");return"dialog"!=s}(t,s)&&function(e,t){const s=t?.getAttribute("formtarget")||e.getAttribute("target");return x(s)}(t,s)&&this.delegate.willSubmitForm(t,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,s))}}}class de{#o=e=>{};#a=e=>{};constructor(e,t){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(N(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:n,newSnapshot:i}=e,r=n;if(s)try{this.renderPromise=new Promise((e=>this.#o=e)),this.renderer=e,await this.prepareToRenderSnapshot(e);const s=new Promise((e=>this.#a=e)),n={resume:this.#a,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(i,n)||await s,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(i,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#o(void 0),delete this.renderPromise}else r&&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()}}class me extends de{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new le(this.element)}}class pe{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){const t=e.composed?e.target?.parentElement:e.target,s=R(t)||t;return s instanceof Element&&s.closest("turbo-frame, html")==this.element}}class ge{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=R(e.composedPath&&e.composedPath()[0]||e.target);if(t&&x(t.target)){const s=O(t);this.delegate.willFollowLinkToLocation(t,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(t,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}}class fe{constructor(e,t){this.delegate=e,this.linkInterceptor=new ge(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");for(const[e,n]of t.searchParams)s.append(Object.assign(document.createElement("input"),{type:"hidden",name:e,value:n}));const n=Object.assign(t,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",n.href),s.setAttribute("hidden","");const i=e.getAttribute("data-turbo-method");i&&s.setAttribute("method",i);const r=e.getAttribute("data-turbo-frame");r&&s.setAttribute("data-turbo-frame",r);const o=C(e);o&&s.setAttribute("data-turbo-action",o);const a=e.getAttribute("data-turbo-confirm");a&&s.setAttribute("data-turbo-confirm",a);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 be{static async preservingPermanentElements(e,t,s){const n=new this(e,t);n.enter(),await s(),n.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=function(e){const t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",e.id),t}(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){const t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){const t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find((t=>t.content==e))}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class ve{#l=null;static renderElement(e,t){}constructor(e,t,s,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=n,this.renderElement=this.constructor.renderElement,this.promise=new Promise(((e,t)=>this.resolvingFunctions={resolve:e,reject:t}))}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await be.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){const e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#l||e.contains(this.currentSnapshot.activeElement)&&(this.#l=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#l)&&this.#l instanceof HTMLElement&&(this.#l.focus(),this.#l=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"}}class ye extends ve{static renderElement(e,t){const s=document.createRange();s.selectNodeContents(e),s.deleteContents();const n=t,i=n.ownerDocument?.createRange();i&&(i.selectNodeContents(n),e.appendChild(i.extractContents()))}constructor(e,t,s,n,i,r=!0){super(t,s,n,i,r),this.delegate=e}get shouldRender(){return!0}async render(){await d(),this.preservingPermanentElements((()=>{this.loadFrameElement()})),this.scrollFrameIntoView(),await d(),this.focusFirstAutofocusableElement(),await d(),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 s=this.currentElement.firstElementChild,n=(e=this.currentElement.getAttribute("data-autoscroll-block"),t="end","end"==e||"start"==e||"center"==e||"nearest"==e?e:t),i=function(e,t){return"auto"==e||"smooth"==e?e:t}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(s)return s.scrollIntoView({block:n,behavior:i}),!0}var e,t;return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=c(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}var we=function(){const e=()=>{},t={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:e=>"true"===e.getAttribute("im-preserve"),shouldReAppend:e=>"true"===e.getAttribute("im-re-append"),shouldRemove:e,afterHeadMorphed:e},restoreFocus:!0};const s=function(){function e(e,t,s,i){if(!1===i.callbacks.beforeNodeAdded(t))return null;if(i.idMap.has(t)){const r=document.createElement(t.tagName);return e.insertBefore(r,s),n(r,t,i),i.callbacks.afterNodeAdded(r),r}{const n=document.importNode(t,!0);return e.insertBefore(n,s),i.callbacks.afterNodeAdded(n),n}}const t=function(){function e(e,t,s){let n=e.idMap.get(t),i=e.idMap.get(s);if(!i||!n)return!1;for(const e of n)if(i.has(e))return!0;return!1}function t(e,t){const s=e,n=t;return s.nodeType===n.nodeType&&s.tagName===n.tagName&&(!s.id||s.id===n.id)}return function(s,n,i,r){let o=null,a=n.nextSibling,l=0,c=i;for(;c&&c!=r;){if(t(c,n)){if(e(s,c,n))return c;null===o&&(s.idMap.has(c)||(o=c))}if(null===o&&a&&t(c,a)&&(l++,a=a.nextSibling,l>=2&&(o=void 0)),c.contains(document.activeElement))break;c=c.nextSibling}return o||null}}();function s(e,t){if(e.idMap.has(t))o(e.pantry,t,null);else{if(!1===e.callbacks.beforeNodeRemoved(t))return;t.parentNode?.removeChild(t),e.callbacks.afterNodeRemoved(t)}}function i(e,t,n){let i=t;for(;i&&i!==n;){let t=i;i=i.nextSibling,s(e,t)}return i}function r(e,t,s,n){const i=n.target.querySelector(`#${t}`)||n.pantry.querySelector(`#${t}`);return function(e,t){const s=e.id;for(;e=e.parentNode;){let n=t.idMap.get(e);n&&(n.delete(s),n.size||t.idMap.delete(e))}}(i,n),o(e,i,s),i}function o(e,t,s){if(e.moveBefore)try{e.moveBefore(t,s)}catch(n){e.insertBefore(t,s)}else e.insertBefore(t,s)}return function(o,a,l,c=null,u=null){a instanceof HTMLTemplateElement&&l instanceof HTMLTemplateElement&&(a=a.content,l=l.content),c||=a.firstChild;for(const s of l.childNodes){if(c&&c!=u){const e=t(o,s,c,u);if(e){e!==c&&i(o,c,e),n(e,s,o),c=e.nextSibling;continue}}if(s instanceof Element&&o.persistentIds.has(s.id)){const e=r(a,s.id,c,o);n(e,s,o),c=e.nextSibling;continue}const l=e(a,s,c,o);l&&(c=l.nextSibling)}for(;c&&c!=u;){const e=c;c=c.nextSibling,s(o,e)}}}(),n=function(){function e(e,s,n,i){const r=s[n];if(r!==e[n]){const o=t(n,e,"update",i);o||(e[n]=s[n]),r?o||e.setAttribute(n,""):t(n,e,"remove",i)||e.removeAttribute(n)}}function t(e,t,s,n){return!("value"!==e||!n.ignoreActiveValue||t!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(e,t,s)}function n(e,t){return!!t.ignoreActiveValue&&e===document.activeElement&&e!==document.body}return function(r,o,a){return a.ignoreActive&&r===document.activeElement?null:(!1===a.callbacks.beforeNodeMorphed(r,o)||(r instanceof HTMLHeadElement&&a.head.ignore||(r instanceof HTMLHeadElement&&"morph"!==a.head.style?i(r,o,a):(!function(s,i,r){let o=i.nodeType;if(1===o){const o=s,a=i,l=o.attributes,c=a.attributes;for(const e of c)t(e.name,o,"update",r)||o.getAttribute(e.name)!==e.value&&o.setAttribute(e.name,e.value);for(let e=l.length-1;0<=e;e--){const s=l[e];if(s&&!a.hasAttribute(s.name)){if(t(s.name,o,"remove",r))continue;o.removeAttribute(s.name)}}n(o,r)||function(s,n,i){if(s instanceof HTMLInputElement&&n instanceof HTMLInputElement&&"file"!==n.type){let r=n.value,o=s.value;e(s,n,"checked",i),e(s,n,"disabled",i),n.hasAttribute("value")?o!==r&&(t("value",s,"update",i)||(s.setAttribute("value",r),s.value=r)):t("value",s,"remove",i)||(s.value="",s.removeAttribute("value"))}else if(s instanceof HTMLOptionElement&&n instanceof HTMLOptionElement)e(s,n,"selected",i);else if(s instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement){let e=n.value,r=s.value;if(t("value",s,"update",i))return;e!==r&&(s.value=e),s.firstChild&&s.firstChild.nodeValue!==e&&(s.firstChild.nodeValue=e)}}(o,a,r)}8!==o&&3!==o||s.nodeValue!==i.nodeValue&&(s.nodeValue=i.nodeValue)}(r,o,a),n(r,a)||s(a,r,o))),a.callbacks.afterNodeMorphed(r,o)),r)}}();function i(e,t,s){let n=[],i=[],r=[],o=[],a=new Map;for(const e of t.children)a.set(e.outerHTML,e);for(const t of e.children){let e=a.has(t.outerHTML),n=s.head.shouldReAppend(t),l=s.head.shouldPreserve(t);e||l?n?i.push(t):(a.delete(t.outerHTML),r.push(t)):"append"===s.head.style?n&&(i.push(t),o.push(t)):!1!==s.head.shouldRemove(t)&&i.push(t)}o.push(...a.values());let l=[];for(const t of o){let i=document.createRange().createContextualFragment(t.outerHTML).firstChild;if(!1!==s.callbacks.beforeNodeAdded(i)){if("href"in i&&i.href||"src"in i&&i.src){let e,t=new Promise((function(t){e=t}));i.addEventListener("load",(function(){e()})),l.push(t)}e.appendChild(i),s.callbacks.afterNodeAdded(i),n.push(i)}}for(const t of i)!1!==s.callbacks.beforeNodeRemoved(t)&&(e.removeChild(t),s.callbacks.afterNodeRemoved(t));return s.head.afterHeadMorphed(e,{added:n,kept:r,removed:i}),l}const r=function(){function e(){const e=document.createElement("div");return e.hidden=!0,document.body.insertAdjacentElement("afterend",e),e}function s(e){let t=Array.from(e.querySelectorAll("[id]"));return e.id&&t.push(e),t}function n(e,t,s,n){for(const i of n)if(t.has(i.id)){let t=i;for(;t;){let n=e.get(t);if(null==n&&(n=new Set,e.set(t,n)),n.add(i.id),t===s)break;t=t.parentElement}}}return function(i,r,o){const{persistentIds:a,idMap:l}=function(e,t){const i=s(e),r=s(t),o=function(e,t){let s=new Set,n=new Map;for(const{id:t,tagName:i}of e)n.has(t)?s.add(t):n.set(t,i);let i=new Set;for(const{id:e,tagName:r}of t)i.has(e)?s.add(e):n.get(e)===r&&i.add(e);for(const e of s)i.delete(e);return i}(i,r);let a=new Map;n(a,o,e,i);const l=t.__idiomorphRoot||t;return n(a,o,l,r),{persistentIds:o,idMap:a}}(i,r),c=function(e){let s=Object.assign({},t);return Object.assign(s,e),s.callbacks=Object.assign({},t.callbacks,e.callbacks),s.head=Object.assign({},t.head,e.head),s}(o),u=c.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(u))throw`Do not understand how to morph style ${u}`;return{target:i,newContent:r,config:c,morphStyle:u,ignoreActive:c.ignoreActive,ignoreActiveValue:c.ignoreActiveValue,restoreFocus:c.restoreFocus,idMap:l,persistentIds:a,pantry:e(),callbacks:c.callbacks,head:c.head}}}(),{normalizeElement:o,normalizeParent:a}=function(){const e=new WeakSet;return{normalizeElement:function(e){return e instanceof Document?e.documentElement:e},normalizeParent:function t(s){if(null==s)return document.createElement("div");if("string"==typeof s)return t(function(t){let s=new DOMParser,n=t.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(n.match(/<\/html>/)||n.match(/<\/head>/)||n.match(/<\/body>/)){let i=s.parseFromString(t,"text/html");if(n.match(/<\/html>/))return e.add(i),i;{let t=i.firstChild;return t&&e.add(t),t}}{let n=s.parseFromString("","text/html").body.querySelector("template").content;return e.add(n),n}}(s));if(e.has(s))return s;if(s instanceof Node){if(s.parentNode)return function(e){return{childNodes:[e],querySelectorAll:t=>{const s=e.querySelectorAll(t);return e.matches(t)?[e,...s]:s},insertBefore:(t,s)=>e.parentNode.insertBefore(t,s),moveBefore:(t,s)=>e.parentNode.moveBefore(t,s),get __idiomorphRoot(){return e}}}(s);{const e=document.createElement("div");return e.append(s),e}}{const e=document.createElement("div");for(const t of[...s])e.append(t);return e}}}}();return{morph:function(e,t,n={}){e=o(e);const l=a(t),c=r(e,l,n),u=function(e,t){if(!e.config.restoreFocus)return t();let s=document.activeElement;if(!(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement))return t();const{id:n,selectionStart:i,selectionEnd:r}=s,o=t();n&&n!==document.activeElement?.id&&(s=e.target.querySelector(`#${n}`),s?.focus());s&&!s.selectionEnd&&r&&s.setSelectionRange(i,r);return o}(c,(()=>function(e,t,s,n){if(e.head.block){const r=t.querySelector("head"),o=s.querySelector("head");if(r&&o){const t=i(r,o,e);return Promise.all(t).then((()=>{const t=Object.assign(e,{head:{block:!1,ignore:!0}});return n(t)}))}}return n(e)}(c,e,l,(t=>"innerHTML"===t.morphStyle?(s(t,e,l),Array.from(e.childNodes)):function(e,t,n){const i=a(t);let r=Array.from(i.childNodes);const o=r.indexOf(t),l=r.length-(o+1);return s(e,i,n,t,t.nextSibling),r=Array.from(i.childNodes),r.slice(o,r.length-l)}(t,e,l)))));return c.pantry.remove(),u},defaults:t}}();function Ee(e,t,{callbacks:s,...n}={}){we.morph(e,t,{...n,callbacks:new Ce(s)})}function Se(e,t){Ee(e,t.childNodes,{morphStyle:"innerHTML"})}class Ce{#c;constructor({beforeNodeMorphed:e}={}){this.#c=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element){if(!e.hasAttribute("data-turbo-permanent")&&this.#c(e,t)){return!u("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented}return!1}};beforeAttributeUpdated=(e,t,s)=>!u("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:s}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&u("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}}class Te extends ye{static renderElement(e,t){u("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Se(e,t)}async preservingPermanentElements(e){return await e()}}class Ae{static animationDuration=300;static get defaultCSS(){return f` .turbo-progress-bar { position: fixed; display: block; @@ -13,7 +13,7 @@ opacity ${Ae.animationDuration/2}ms ${Ae.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } - `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement((()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1})))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,1.5*Ae.animationDuration)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,Ae.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame((()=>{this.progressElement.style.width=10+90*this.value+"%"}))}createStylesheetElement(){const e=document.createElement("style");e.type="text/css",e.textContent=Ae.defaultCSS;const t=_();return t&&(e.nonce=t),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}}class _e extends le{detailsByOuterHTML=this.children.filter((e=>!function(e){const t=e.localName;return"noscript"==t}(e))).map((e=>function(e){e.hasAttribute("nonce")&&e.setAttribute("nonce","");return e}(e))).reduce(((e,t)=>{const{outerHTML:s}=t,n=s in e?e[s]:{type:Me(t),tracked:ke(t),elements:[]};return{...e,[s]:{...n,elements:[...n.elements,t]}}}),{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter((e=>this.detailsByOuterHTML[e].tracked)).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter((e=>!(e in t.detailsByOuterHTML))).map((e=>this.detailsByOuterHTML[e])).filter((({type:t})=>t==e)).map((({elements:[e]})=>e))}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce(((e,t)=>{const{type:s,tracked:n,elements:i}=this.detailsByOuterHTML[t];return null!=s||n?i.length>1?[...e,...i.slice(1)]:e:[...e,...i]}),[])}getMetaValue(e){const t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce(((t,s)=>{const{elements:[n]}=this.detailsByOuterHTML[s];return function(e,t){const s=e.localName;return"meta"==s&&e.getAttribute("name")==t}(n,e)?n:t}),0)}}function Me(e){return function(e){const t=e.localName;return"script"==t}(e)?"script":function(e){const t=e.localName;return"style"==t||"link"==t&&"stylesheet"==e.getAttribute("rel")}(e)?"stylesheet":void 0}function ke(e){return"reload"==e.getAttribute("data-turbo-track")}class Le extends le{static fromHTMLString(e=""){return this.fromDocument(g(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:s}){return new this(e,t,new _e(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[e,n]of t.entries()){const t=s[e];for(const e of t.selectedOptions)e.selected=!1;for(const e of n.selectedOptions)t.options[e.index].selected=!0}for(const t of e.querySelectorAll('input[type="password"]'))t.value="";return new Le(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){return D(this.getSetting("root")??"/")}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return"no-preview"!=this.cacheControlValue}get isCacheable(){return"no-cache"!=this.cacheControlValue}get isVisitable(){return"reload"!=this.getSetting("visit-control")}get prefersViewTransitions(){return"same-origin"===this.headSnapshot.getMetaValue("view-transition")}get shouldMorphPage(){return"morph"===this.getSetting("refresh-method")}get shouldPreserveScrollPosition(){return"preserve"===this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}}class xe{#u=!1;#h=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#u?(this.#u=!0,this.#h=this.#h.then((async()=>{await document.startViewTransition(t).finished}))):this.#h=this.#h.then(t),this.#h}get viewTransitionsAvailable(){return document.startViewTransition}}const Re={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Oe="visitStart",Ie="requestStart",Fe="requestEnd",Pe="visitEnd",De="initialized",Ne="started",$e="canceled",qe="failed",Be="completed",Ve=0,He=-1,je=-2,Ue={advance:"forward",restore:"back",replace:"none"};class Ke{identifier=b();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=De;viewTransitioner=new xe;constructor(e,t,s,n={}){this.delegate=e,this.location=t,this.restorationIdentifier=s||b();const{action:i,historyChanged:r,referrer:o,snapshot:a,snapshotHTML:l,response:c,visitCachedSnapshot:u,willRender:h,updateHistory:d,shouldCacheSnapshot:m,acceptsStreamResponse:p,direction:g}={...Re,...n};this.action=i,this.historyChanged=r,this.referrer=o,this.snapshot=a,this.snapshotHTML=l,this.response=c,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=u,this.willRender=h,this.updateHistory=d,this.scrolled=!h,this.shouldCacheSnapshot=m,this.acceptsStreamResponse=p,this.direction=g||Ue[i]}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==De&&(this.recordTimingMetric(Oe),this.state=Ne,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Ne&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=$e)}complete(){this.state==Ne&&(this.recordTimingMetric(Pe),this.adapter.visitCompleted(this),this.state=Be,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Ne&&(this.state=qe,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){const e=S(this.location.href===this.referrer?.href?"replace":this.action);this.history.update(e,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Q(this,J.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Ie),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;ze(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Fe),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,ze(e)&&null!=t){const e=Le.fromHTMLString(t);await this.renderPageSnapshot(e,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Le.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()}))}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!N(this.location)||e.hasAnchor(N(this.location)))&&("restore"==this.action||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Le.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return null!=this.getCachedSnapshot()}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(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render((async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)}))}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(ie.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){const s=await t.responseHTML,{redirected:n,statusCode:i}=t;null==s?this.recordResponse({statusCode:je,redirected:n}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:i,responseHTML:s,redirected:n}))}async requestFailedWithResponse(e,t){const s=await t.responseHTML,{redirected:n,statusCode:i}=t;null==s?this.recordResponse({statusCode:je,redirected:n}):this.recordResponse({statusCode:i,responseHTML:s,redirected:n})}requestErrored(e,t){this.recordResponse({statusCode:Ve,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||this.view.forceReloaded||this.view.shouldPreserveScrollPosition(this)||("restore"==this.action?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){const{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){const e=N(this.location);if(null!=e)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=(new Date).getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return"object"==typeof this.response}shouldIssueRequest(){return!this.isSamePage&&("restore"==this.action?!this.hasCachedSnapshot():this.willRender)}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then((e=>e&&this.visitCachedSnapshot(e))),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise((e=>{this.frame="hidden"===document.visibilityState?setTimeout((()=>e()),0):requestAnimationFrame((()=>e()))})),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 ze(e){return e>=200&&e<300}class We{progressBar=new Ae;constructor(e){this.session=e}visitProposedToLocation(e,t){V(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||b(),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()||"restore"!=e.action?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case Ve:case He:case je:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),null!=this.visitProgressBarTimeout&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){null==this.formProgressBarTimeout&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),null!=this.formProgressBarTimeout&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){u("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}}class Ge{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(const e of this.temporaryElements)e.remove()};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 Xe{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new pe(this,t),this.formSubmitObserver=new he(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,s){return this.#d(e)}linkClickIntercepted(e,t,s){const n=this.#m(e);n&&n.delegate.linkClickIntercepted(e,t,s)}willSubmitForm(e,t){return null==e.closest("turbo-frame")&&this.#p(e,t)&&this.#d(e,t)}formSubmitted(e,t){const s=this.#m(e,t);s&&s.delegate.formSubmitted(e,t)}#p(e,t){const s=$(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=D(n?.content??"/");return this.#d(e,t)&&V(s,i)}#d(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const s=this.#m(e,t);return!!s&&s!=e.closest("turbo-frame")}return!1}#m(e,t){const s=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(s&&"_top"!=s){const e=this.element.querySelector(`#${s}:not([disabled])`);if(e instanceof a)return e}}}class Je{location;restorationIdentifier=b();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,s=b()){e===history.pushState&&++this.currentIndex;const n={turbo:{restorationIdentifier:s,restorationIndex:this.currentIndex}};e.call(history,n,"",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(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){const{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);const{restorationIdentifier:e,restorationIndex:s}=t;this.restorationIdentifier=e;const n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,e,n),this.currentIndex=s}}};onPageLoad=async e=>{await Promise.resolve(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||"complete"==document.readyState}}class Ye{started=!1;#g=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||("loading"===this.eventTarget.readyState?this.eventTarget.addEventListener("DOMContentLoaded",this.#f,{once:!0}):this.#f())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#b,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#v,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#y,!0),this.started=!1)}#f=()=>{this.eventTarget.addEventListener("mouseenter",this.#b,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#v,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#y,!0),this.started=!0};#b=e=>{if("false"===A("turbo-prefetch"))return;const t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#w(t)){const e=t,s=O(e);if(this.delegate.canPrefetchRequestToLocation(e,s)){this.#g=e;const n=new Q(this,J.get,s,new URLSearchParams,t);re.setLater(s.toString(),n,this.#E)}}};#v=e=>{e.target===this.#g&&this.#S()};#S=()=>{re.clear(),this.#g=null};#y=e=>{if("FORM"!==e.target.tagName&&"GET"===e.detail.fetchOptions.method){const t=re.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),re.clear()}};prepareRequest(e){const t=e.target;e.headers["X-Sec-Purpose"]="prefetch";const s=t.closest("turbo-frame"),n=t.getAttribute("data-turbo-frame")||s?.getAttribute("target")||s?.id;n&&"_top"!==n&&(e.headers["Turbo-Frame"]=n)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#E(){return Number(A("turbo-prefetch-cache-time"))||1e4}#w(e){return!!e.getAttribute("href")&&(!Qe(e)&&(!Ze(e)&&(!et(e)&&(!tt(e)&&!nt(e)))))}}const Qe=e=>e.origin!==document.location.origin||!["http:","https:"].includes(e.protocol)||e.hasAttribute("target"),Ze=e=>e.pathname+e.search===document.location.pathname+document.location.search||e.href.startsWith("#"),et=e=>{if("false"===e.getAttribute("data-turbo-prefetch"))return!0;if("false"===e.getAttribute("data-turbo"))return!0;const t=M(e,"[data-turbo-prefetch]");return!(!t||"false"!==t.getAttribute("data-turbo-prefetch"))},tt=e=>{const t=e.getAttribute("data-turbo-method");return!(!t||"get"===t.toLowerCase())||(!!st(e)||(!!e.hasAttribute("data-turbo-confirm")||!!e.hasAttribute("data-turbo-stream")))},st=e=>e.hasAttribute("data-remote")||e.hasAttribute("data-behavior")||e.hasAttribute("data-confirm")||e.hasAttribute("data-method"),nt=e=>u("turbo:before-prefetch",{target:e,cancelable:!0}).defaultPrevented;class it{constructor(e){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 Ke(this,D(e),t,{referrer:this.location,...s}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new ae(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){"function"==typeof this.adapter.formSubmissionStarted&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){const s=await t.responseHTML;if(s){const n=e.isSafe;n||this.view.clearSnapshotCache();const{statusCode:i,redirected:r}=t,o={action:this.#C(e,t),shouldCacheSnapshot:n,response:{statusCode:i,responseHTML:s,redirected:r}};this.proposeVisit(t.location,o)}}}async formSubmissionFailedWithResponse(e,t){const s=await t.responseHTML;if(s){const e=Le.fromHTMLString(s);t.serverError?await this.view.renderError(e,this.currentVisit):await this.view.renderPage(e,!1,!0,this.currentVisit),e.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){"function"==typeof this.adapter.formSubmissionFinished&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return"function"!=typeof this.adapter.linkPrefetchingIsEnabledForLocation||this.adapter.linkPrefetchingIsEnabledForLocation(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){const s=N(e),n=N(this.view.lastRenderedLocation),i="restore"===t&&void 0===s;return"replace"!==t&&H(e)===H(this.view.lastRenderedLocation)&&(i||null!=s&&s!==n)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#C(e,t){const{submitter:s,formElement:n}=e;return C(s,n)||this.#T(t)}#T(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}}const rt=0,ot=1,at=2,lt=3;class ct{stage=rt;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==rt&&(this.stage=ot),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{const{readyState:e}=this;"interactive"==e?this.pageIsInteractive():"complete"==e&&this.pageIsComplete()};pageIsInteractive(){this.stage==ot&&(this.stage=at,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==at&&(this.stage=lt,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}}class ut{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}}class ht{render({fragment:e}){be.preservingPermanentElements(this,function(e){const t=ue(document.documentElement),s={};for(const n of t){const{id:t}=n;for(const i of e.querySelectorAll("turbo-stream")){const e=ce(i.templateElement.content,t);e&&(s[t]=[n,e])}}return s}(e),(()=>{!async function(e,t){const s=`turbo-stream-autofocus-${b()}`,n=e.querySelectorAll("turbo-stream"),i=function(e){for(const t of e){const e=L(t.templateElement.content);if(e)return e}return null}(n);let r=null;i&&(r=i.id?i.id:s,i.id=r);t(),await d();if((null==document.activeElement||document.activeElement==document.body)&&r){const e=document.getElementById(r);k(e)&&e.focus(),e&&e.id==s&&e.removeAttribute("id")}}(e,(()=>{!async function(e){const[t,s]=await async function(e,t){const s=t();return e(),await m(),[s,t()]}(e,(()=>document.activeElement)),n=t&&t.id;if(n){const e=document.getElementById(n);k(e)&&e!=s&&e.focus()}}((()=>{document.documentElement.appendChild(e)}))}))}))}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}class dt{sources=new Set;#A=!1;constructor(e){this.delegate=e}start(){this.#A||(this.#A=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#A&&(this.#A=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{const t=function(e){const t=e.detail?.fetchResponse;if(t instanceof U)return t}(e);t&&function(e){const t=e.contentType??"";return t.startsWith(ie.contentType)}(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#A&&"string"==typeof e.data&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){const t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(ie.wrap(e))}}class mt extends ve{static renderElement(e,t){const{documentElement:s,body:n}=document;s.replaceChild(t,n)}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=c(e);t.replaceChild(s,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}class pt extends ve{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(){return this.newSnapshot.isVisitable?this.trackedElementsAreIdentical?void 0:{reason:"tracked_element_mismatch"}:{reason:"turbo_visit_control_is_reload"}}async prepareToRender(){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}#_(){const{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){const e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements((async()=>{this.activateNewBody(),await this.assignNewBody()}))}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){const e=[];for(const t of this.newHeadStylesheetElements)e.push(E(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(const e of this.newHeadScriptElements)document.head.appendChild(c(e))}removeUnusedDynamicStylesheetElements(){for(const e of this.unusedDynamicStylesheetElements)document.head.removeChild(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[s,n]of t.entries()){if("TITLE"==e.tagName){if("TITLE"!=n.tagName)continue;if(e.innerHTML==n.innerHTML)return t.splice(s,1),!0}if(n.isEqualNode(e))return t.splice(s,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=c(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter((e=>"dynamic"===e.getAttribute("data-turbo-track")))}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")}}class gt extends pt{static renderElement(e,t){Ee(e,t,{callbacks:{beforeNodeMorphed:e=>!ft(e)}});for(const t of e.querySelectorAll("turbo-frame"))ft(t)&&t.reload();u("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}}function ft(e){return e instanceof a&&e.src&&"morph"===e.refresh&&!e.closest("[data-turbo-permanent]")}class bt{keys=[];snapshots={};constructor(e){this.size=e}has(e){return j(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[j(e)]}write(e,t){this.snapshots[j(e)]=t}touch(e){const t=j(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 vt extends de{snapshotCache=new bt(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,s=!0,n){const i=new(this.isPageRefresh(n)&&this.snapshot.shouldMorphPage?gt:pt)(this.snapshot,e,t,s);return i.shouldRender?n?.changeHistory():this.forceReloaded=!0,this.render(i)}renderError(e,t){t?.changeHistory();const s=new mt(this.snapshot,e,!1);return this.render(s)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:t}=this;await p();const s=e.clone();return this.snapshotCache.put(t,s),s}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&"replace"===e.action}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return Le.fromElement(this.element)}}class yt{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.#M):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#M)}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;const s=new Q(this,J.get,t,new URLSearchParams,e);await s.perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{const s=await t.responseHTML,n=Le.fromHTMLString(s);this.snapshotCache.put(e.url,n)}catch(e){}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#M=()=>{this.preloadOnLoadLinksForView(document.body)}}class wt{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#k("")}exemptPageFromCache(){this.#k("no-cache")}exemptPageFromPreview(){this.#k("no-preview")}#k(e){!function(e,t){let s=T(e);s||(s=document.createElement("meta"),s.setAttribute("name",e),document.head.appendChild(s)),s.setAttribute("content",t)}("turbo-cache-control",e)}}function Et(e){Object.defineProperties(e,St)}const St={absoluteURL:{get(){return this.toString()}}},Ct=new class{navigator=new it(this);history=new Je(this);view=new vt(this,document.documentElement);adapter=new We(this);pageObserver=new ct(this);cacheObserver=new Ge;linkPrefetchObserver=new Ye(this,document);linkClickObserver=new ge(this,window);formSubmitObserver=new he(this,document);scrollObserver=new ut(this);streamObserver=new dt(this);formLinkClickObserver=new fe(this,document.documentElement);frameRedirector=new Xe(this,document.documentElement);streamMessageRenderer=new ht;cache=new wt(this);enabled=!0;started=!1;#L=150;constructor(e){this.recentRequests=e,this.preloader=new yt(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 a){const n=t.action||C(s);s.delegate.proposeVisitIfNavigatedWithAction(s,n),s.src=e.toString()}else this.navigator.proposeVisit(D(e),t)}refresh(e,t){const s=t&&this.recentRequests.has(t),n=e===document.baseURI;s||this.navigator.currentVisit||!n||this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(ie.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){P.drive.progressBarDelay=e}get progressBarDelay(){return P.drive.progressBarDelay}set drive(e){P.drive.enabled=e}get drive(){return P.drive.enabled}set formMode(e){P.forms.mode=e}get formMode(){return P.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#L}set pageRefreshDebouncePeriod(e){this.refresh=function(e,t){let s=null;return(...n)=>{clearTimeout(s),s=setTimeout((()=>e.apply(this,n)),t)}}(this.debouncedRefresh.bind(this),e),this.#L=e}shouldPreloadLink(e){const t=e.hasAttribute("data-turbo-method"),s=e.hasAttribute("data-turbo-stream"),n=e.getAttribute("data-turbo-frame"),i="_top"==n?null:document.getElementById(n)||M(e,"turbo-frame:not([disabled])");if(t||s||i instanceof a)return!1;{const t=new URL(e.href);return this.elementIsNavigatable(e)&&V(t,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)&&V(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&V(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,s){return this.elementIsNavigatable(e)&&V(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,s)}followedLinkToLocation(e,t){const s=this.getActionForLink(e),n=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:s,acceptsStreamResponse:n})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Et(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(y(document.documentElement),this.view.markVisitDirection(e.direction)),Et(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),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 s=$(e,t);return this.submissionIsNavigatable(e,t)&&V(D(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(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){const s=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:n,detail:{render:i}}=s;return this.view.renderer&&i&&(this.view.renderer.renderElement=i),!n}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 u("turbo:click",{target:e,detail:{url:t.href,originalEvent:s},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return u("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return u("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return u("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return u("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return u("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return u("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 u("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return u("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if("off"==P.forms.mode)return!1;{const s=!t||this.elementIsNavigatable(t);return"optin"==P.forms.mode?s&&null!=e.closest('[data-turbo="true"]'):s&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=M(e,"[data-turbo]"),s=M(e,"turbo-frame");return P.drive.enabled||s?!t||"false"!=t.getAttribute("data-turbo"):!!t&&"true"==t.getAttribute("data-turbo")}getActionForLink(e){return C(e)||"advance"}get snapshot(){return this.view.snapshot}}(z),{cache:Tt,navigator:At}=Ct;function _t(){Ct.start()}function Mt(e,t){Ct.visit(e,t)}function kt(e){Ct.connectStreamSource(e)}function Lt(e){Ct.disconnectStreamSource(e)}var xt=Object.freeze({__proto__:null,navigator:At,session:Ct,cache:Tt,PageRenderer:pt,PageSnapshot:Le,FrameRenderer:ye,fetch:G,config:P,start:_t,registerAdapter:function(e){Ct.registerAdapter(e)},visit:Mt,connectStreamSource:kt,disconnectStreamSource:Lt,renderStreamMessage:function(e){Ct.renderStreamMessage(e)},clearCache:function(){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.`"),Ct.clearCache()},setProgressBarDelay:function(e){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),P.drive.progressBarDelay=e},setConfirmMethod:function(e){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),P.forms.confirm=e},setFormMode:function(e){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),P.forms.mode=e}});class Rt extends Error{}function Ot(e){if(null!=e){const t=document.getElementById(e);if(t instanceof a)return t}}function It(e,t){if(e){const n=e.getAttribute("src");if(null!=n&&null!=t&&(s=t,D(n).href==D(s).href))throw new Error(`Matching element has a source URL which references itself`);if(e.ownerDocument!==document&&(e=document.importNode(e,!0)),e instanceof a)return e.connectedCallback(),e.disconnectedCallback(),e}var s}const Ft={after(){this.targetElements.forEach((e=>e.parentElement?.insertBefore(this.templateContent,e.nextSibling)))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((e=>e.append(this.templateContent)))},before(){this.targetElements.forEach((e=>e.parentElement?.insertBefore(this.templateContent,e)))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((e=>e.prepend(this.templateContent)))},remove(){this.targetElements.forEach((e=>e.remove()))},replace(){const e=this.getAttribute("method");this.targetElements.forEach((t=>{"morph"===e?Ee(t,this.templateContent):t.replaceWith(this.templateContent)}))},update(){const e=this.getAttribute("method");this.targetElements.forEach((t=>{"morph"===e?Se(t,this.templateContent):(t.innerHTML="",t.append(this.templateContent))}))},refresh(){Ct.refresh(this.baseURI,this.requestId)}};class Pt extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{const e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await d(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach((e=>e.remove()))}get duplicateChildren(){const e=this.targetElements.flatMap((e=>[...e.children])).filter((e=>!!e.getAttribute("id"))),t=[...this.templateContent?.children||[]].filter((e=>!!e.getAttribute("id"))).map((e=>e.getAttribute("id")));return e.filter((e=>t.includes(e.getAttribute("id"))))}get performAction(){if(this.action){const e=Ft[this.action];if(e)return e;this.#x("unknown action")}this.#x("action attribute is missing")}get targetElements(){return this.target?this.targetElementsById:this.targets?this.targetElementsByQuery:void this.#x("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(null===this.firstElementChild){const e=this.ownerDocument.createElement("template");return this.appendChild(e),e}if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#x("first child element must be a