diff --git a/CHANGELOG.md b/CHANGELOG.md
index 59b273d3..aa2feb9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,39 @@
# Changelog of Flus
+## 2024-11-01 - v1.0.4
+
+### Improvements
+
+- Use the system dialog to share URLs to Flus on mobile (not sure if it works :)) ([7a837c2e](https://github.com/flusio/Flus/commit/7a837c2e))
+- Display the total number of links in the news ([26edbade](https://github.com/flusio/Flus/commit/26edbade))
+- Improve the feedback of the disabled buttons ([8991c212](https://github.com/flusio/Flus/commit/8991c212))
+- Explain that Markdown can be used in comments ([0010f425](https://github.com/flusio/Flus/commit/0010f425))
+- Improve the description of Flus ([54c52978](https://github.com/flusio/Flus/commit/54c52978))
+
+### Bug fixes
+
+- Fix the position of the inner circle of radio buttons ([4542d36b](https://github.com/flusio/Flus/commit/4542d36b))
+- Fix the Collection group's default value in forms ([c7083afb](https://github.com/flusio/Flus/commit/c7083afb))
+- Fix the z-index of group headers ([dffbdd63](https://github.com/flusio/Flus/commit/dffbdd63))
+- Generate correct links to tags in the "direct" Atom feeds ([ccbcbbc2](https://github.com/flusio/Flus/commit/ccbcbbc2))
+- Handle the Pocket links without URL ([f14335ae](https://github.com/flusio/Flus/commit/f14335ae))
+
+### Technical
+
+- Remove the `apple-mobile-web-app*` meta tags ([0b77f022](https://github.com/flusio/Flus/commit/0b77f022))
+- Add screenshots to the webmanifest ([8043f060](https://github.com/flusio/Flus/commit/8043f060))
+
+### Developers
+
+- Replace Parcel by esbuild ([5a988874](https://github.com/flusio/Flus/commit/5a988874))
+
+### Beta
+
+- Ignore case when searching for tags ([b8e55544](https://github.com/flusio/Flus/commit/b8e55544))
+- Import Pocket tags as links tags ([8d36730f](https://github.com/flusio/Flus/commit/8d36730f))
+- Explain that tags can be used ([0010f425](https://github.com/flusio/Flus/commit/0010f425))
+- (tec) Add a GIN index on links.tags ([4faef23b](https://github.com/flusio/Flus/commit/4faef23b))
+
## 2024-10-18 - v1.0.3
### Improvements
diff --git a/VERSION.txt b/VERSION.txt
index 21e8796a..ee90284c 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-1.0.3
+1.0.4
diff --git a/public/assets/angle-down-4TO4WV26.svg b/public/assets/angle-down-4TO4WV26.svg
new file mode 100644
index 00000000..bbd55834
--- /dev/null
+++ b/public/assets/angle-down-4TO4WV26.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/angle-down.8d3ef7ca.svg b/public/assets/angle-down.8d3ef7ca.svg
deleted file mode 100644
index 6e9ef249..00000000
--- a/public/assets/angle-down.8d3ef7ca.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/backup-PX73UY7P.svg b/public/assets/backup-PX73UY7P.svg
new file mode 100644
index 00000000..28ed9358
--- /dev/null
+++ b/public/assets/backup-PX73UY7P.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/backup.9b6b1a14.svg b/public/assets/backup.9b6b1a14.svg
deleted file mode 100644
index f0d1a584..00000000
--- a/public/assets/backup.9b6b1a14.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/block-quote-YYCDKVSM.svg b/public/assets/block-quote-YYCDKVSM.svg
new file mode 100644
index 00000000..1d3bfe45
--- /dev/null
+++ b/public/assets/block-quote-YYCDKVSM.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/block-quote.def20ef5.svg b/public/assets/block-quote.def20ef5.svg
deleted file mode 100644
index 233ad26a..00000000
--- a/public/assets/block-quote.def20ef5.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/bundle-RWTT6F5I.svg b/public/assets/bundle-RWTT6F5I.svg
new file mode 100644
index 00000000..7f7b0da2
--- /dev/null
+++ b/public/assets/bundle-RWTT6F5I.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/bundle.aa8686d4.svg b/public/assets/bundle.aa8686d4.svg
deleted file mode 100644
index 5b18fe2c..00000000
--- a/public/assets/bundle.aa8686d4.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/check-QEPAP33I.svg b/public/assets/check-QEPAP33I.svg
new file mode 100644
index 00000000..d5a02a49
--- /dev/null
+++ b/public/assets/check-QEPAP33I.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/check.1fae1ce5.svg b/public/assets/check.1fae1ce5.svg
deleted file mode 100644
index d7e9c8b8..00000000
--- a/public/assets/check.1fae1ce5.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/comfortaa-v28-latin-700.b5ffad37.woff b/public/assets/comfortaa-v28-latin-700-BXCF363Q.woff
similarity index 100%
rename from public/assets/comfortaa-v28-latin-700.b5ffad37.woff
rename to public/assets/comfortaa-v28-latin-700-BXCF363Q.woff
diff --git a/public/assets/comfortaa-v28-latin-700.779733df.woff2 b/public/assets/comfortaa-v28-latin-700-QBTKBVYR.woff2
similarity index 100%
rename from public/assets/comfortaa-v28-latin-700.779733df.woff2
rename to public/assets/comfortaa-v28-latin-700-QBTKBVYR.woff2
diff --git a/public/assets/connect-QLRLF2WG.svg b/public/assets/connect-QLRLF2WG.svg
new file mode 100644
index 00000000..452ee667
--- /dev/null
+++ b/public/assets/connect-QLRLF2WG.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/connect.64f3f7c4.svg b/public/assets/connect.64f3f7c4.svg
deleted file mode 100644
index b93c029d..00000000
--- a/public/assets/connect.64f3f7c4.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/credit-card-OG7PNARI.svg b/public/assets/credit-card-OG7PNARI.svg
new file mode 100644
index 00000000..f8893f8d
--- /dev/null
+++ b/public/assets/credit-card-OG7PNARI.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/credit-card.5e96e736.svg b/public/assets/credit-card.5e96e736.svg
deleted file mode 100644
index 7da8489f..00000000
--- a/public/assets/credit-card.5e96e736.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/error-red-6X5IOCLS.svg b/public/assets/error-red-6X5IOCLS.svg
new file mode 100644
index 00000000..23893830
--- /dev/null
+++ b/public/assets/error-red-6X5IOCLS.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/error-red.06d175ba.svg b/public/assets/error-red.06d175ba.svg
deleted file mode 100644
index 5c9ca88b..00000000
--- a/public/assets/error-red.06d175ba.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/info-35TZKYE6.svg b/public/assets/info-35TZKYE6.svg
new file mode 100644
index 00000000..c4bc8030
--- /dev/null
+++ b/public/assets/info-35TZKYE6.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/info-purple-YJTXIMZ2.svg b/public/assets/info-purple-YJTXIMZ2.svg
new file mode 100644
index 00000000..fb2248f3
--- /dev/null
+++ b/public/assets/info-purple-YJTXIMZ2.svg
@@ -0,0 +1 @@
+
diff --git a/public/assets/info-purple.513e23fd.svg b/public/assets/info-purple.513e23fd.svg
deleted file mode 100644
index 503076ea..00000000
--- a/public/assets/info-purple.513e23fd.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/info.194ce779.svg b/public/assets/info.194ce779.svg
deleted file mode 100644
index b47e34dd..00000000
--- a/public/assets/info.194ce779.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/assets/javascripts/application.js b/public/assets/javascripts/application.js
index 57be00af..fab9c8d6 100644
--- a/public/assets/javascripts/application.js
+++ b/public/assets/javascripts/application.js
@@ -1,7 +1,6 @@
-(()=>{!/*!
-Turbo 8.0.4
-Copyright © 2024 37signals LLC
- */function(e){"function"!=typeof e.requestSubmit&&(e.requestSubmit=function(e){var r;e?((r=e)instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==r.type||t(TypeError,"The specified element is not a submit button"),r.form==this||t(DOMException,"The specified element is not owned by this form element","NotFoundError"),e.click()):((e=document.createElement("input")).type="submit",e.hidden=!0,this.appendChild(e),e.click(),this.removeChild(e))});function t(e,t,r){throw new e("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+t+".",r)}}(HTMLFormElement.prototype);let e=new WeakMap;function t(t){let r=function(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null,r=t?t.closest("input, button"):null;return r?.type=="submit"?r:null}(t.target);r&&r.form&&e.set(r.form,r)}!function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(!/Apple Computer/.test(navigator.vendor)||"submitter"in e)return;r=e}addEventListener("click",t,!0),Object.defineProperty(r,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return e.get(this.target)}})}();let r={eager:"eager",lazy:"lazy"};class s extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new s.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 loading(){return"lazy"===(this.getAttribute("loading")||"").toLowerCase()?r.lazy:r.eager}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}}function i(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 o(e,t){return i(t?.getAttribute("formaction")||e.getAttribute("action")||e.action)}function a(e,t){return function(e,t){var r;let s=(r=t.origin+t.pathname).endsWith("/")?r:r+"/";return e.href===i(s).href||e.href.startsWith(s)}(e,t)&&!!((e.pathname.split("/").slice(1).slice(-1)[0].match(/\.[^.]*$/)||[])[0]||"").match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function l(e){let t=n(e);return null!=t?e.href.slice(0,-(t.length+1)):e.href}class h{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 i(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}}function c(e){if("false"==e.getAttribute("data-turbo-eval"))return e;{let t=document.createElement("script"),r=T("csp-nonce");return r&&(t.nonce=r),t.textContent=e.textContent,t.async=!1,function(e,t){for(let{name:r,value:s}of t.attributes)e.setAttribute(r,s)}(t,e),t}}function d(e,{target:t,cancelable:r,detail:s}={}){let i=new CustomEvent(e,{cancelable:r,bubbles:!0,composed:!0,detail:s});return t&&t.isConnected?t.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function u(){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){let r=e.reduce((e,r,s)=>e+r+(void 0==t[s]?"":t[s]),"").replace(/^\n/,"").split("\n"),s=r[0].match(/^\s+/),i=s?s[0].length:0;return r.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(let r of t.map(t=>t?.getAttribute(e)))if("string"==typeof r)return r;return null}function y(...e){for(let t of e)"turbo-frame"==t.localName&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function E(...e){for(let t of e)"turbo-frame"==t.localName&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function w(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function S(...e){let t=v("data-turbo-action",...e);return"advance"==t||"replace"==t||"restore"==t?t:null}function A(e){return document.querySelector(`meta[name="${e}"]`)}function T(e){let t=A(e);return t&&t.content}function L(e,t){if(e instanceof Element)return e.closest(t)||L(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 C(e){return Array.from(e.querySelectorAll("[autofocus]")).find(k)}async function O(e,t){let r=t();return e(),await m(),[r,t()]}function M(e){return i(e.getAttribute("href")||"")}class R extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let e=this.values().next().value;this.delete(e)}super.add(e)}}let F=new R(20),P=window.fetch;function N(e,t={}){let r=new Headers(t.headers||{}),s=b();return F.add(s),r.append("X-Turbo-Request-Id",s),P(e,{...t,headers:r})}function I(e){switch(e.toLowerCase()){case"get":return B.get;case"post":return B.post;case"put":return B.put;case"patch":return B.patch;case"delete":return B.delete}}let B={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"},x={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};class q{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=x.urlEncoded){let[a,l]=D(i(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=I(e)||B.get;this.url.search="";let[s,i]=D(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=i,this.fetchOptions.method=r}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=N(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(e){if("AbortError"!==e.name)throw this.#r(e)&&this.delegate.requestErrored(this,e),e}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new h(e);return d("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 H(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async #t(e){let t=new Promise(e=>this.#e=e),r=d("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#r(e){return!d("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}}function H(e){return I(e)==B.get}function D(e,t,r,s){let i=Array.from(r).length>0?new URLSearchParams(V(r)):e.searchParams;return H(t)?[function(e,t){let r=new URLSearchParams(V(t));return e.search=r.toString(),e}(e,i),null]:s==x.urlEncoded?[e,i]:[e,r]}function V(e){let t=[];for(let[r,s]of e)s instanceof File||t.push([r,s]);return t}class ${started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{let t=e.slice(-1)[0];t?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}}class U{static contentType="text/vnd.turbo-stream.html";static wrap(e){return"string"==typeof e?new this(function(e){let t=document.createElement("template");return t.innerHTML=e,t.content}(e)):e}constructor(e){this.fragment=function(e){for(let t of e.querySelectorAll("turbo-stream")){let e=document.importNode(t,!0);for(let t of e.templateElement.content.querySelectorAll("script"))t.replaceWith(c(t));t.replaceWith(e)}return e}(e)}}let j=new class{#s=null;#i=null;get(e){if(this.#i&&this.#i.url===e&&this.#i.expire>Date.now())return this.#i.request}setLater(e,t,r){this.clear(),this.#s=setTimeout(()=>{t.perform(),this.set(e,t,r),this.#s=null},100)}set(e,t,r){this.#i={url:e,request:t,expire:new Date(new Date().getTime()+r)}}clear(){this.#s&&clearTimeout(this.#s),this.#i=null}},W={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class K{state=W.initialized;static confirmMethod(e,t,r){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=I((r?.getAttribute("formmethod")||t.getAttribute("method")||"").toLowerCase())||B.get,o=function(e,t){let r=i(e);return H(t)&&(r.search=""),r}(function(e,t){let r="string"==typeof e.action?e.action:null;return t?.hasAttribute("formaction")?t.getAttribute("formaction")||"":e.getAttribute("action")||r||""}(t,r),n),a=function(e,t){let r=new FormData(e),s=t?.getAttribute("name"),i=t?.getAttribute("value");return s&&r.append(s,i||""),r}(t,r),l=function(e){switch(e.toLowerCase()){case x.multipart:return x.multipart;case x.plain:return x.plain;default:return x.urlEncoded}}(r?.getAttribute("formenctype")||t.enctype);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new q(this,n,o,a,t,l),this.mustRedirect=s}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=i(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=W,r=v("data-turbo-confirm",this.submitter,this.formElement);if(("string"!=typeof r||await K.confirmMethod(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=W;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=function(e){if(null!=e){let t=(document.cookie?document.cookie.split("; "):[]).find(t=>t.startsWith(e));if(t){let e=t.split("=").slice(1).join("=");return e?decodeURIComponent(e):void 0}}}(T("csrf-param"))||T("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(U.contentType)}requestStarted(e){this.state=W.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),y(this.formElement),d("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){j.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){var r;if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(j.clear(),this.requestMustRedirect(e)&&200==(r=t).statusCode&&!r.redirected){let e=Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,e)}else this.state=W.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=W.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),E(this.formElement),d("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(this.submitter&&this.submitsWith){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){this.submitter&&this.originalSubmitText&&(this.submitter.matches("button")?this.submitter.innerHTML=this.originalSubmitText: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 z{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 C(this.element)}get permanentElements(){return J(this.element)}getPermanentElementById(e){return _(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,i=e.getPermanentElementById(s);i&&(t[s]=[r,i])}return t}}function _(e,t){return e.querySelector(`#${t}[data-turbo-permanent]`)}function J(e){return e.querySelectorAll("[id][data-turbo-permanent]")}class G{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&"dialog"!=(r?.getAttribute("formmethod")||t.getAttribute("method"))&&function(e,t){if(!(t?.hasAttribute("formtarget")||e.hasAttribute("target")))return!0;{let r=t?.getAttribute("formtarget")||e.target;for(let e of document.getElementsByName(r))if(e instanceof HTMLIFrameElement)return!1;return!0}}(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}}class X{#n=e=>{};#o=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(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){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:i}=e;if(r)try{this.renderPromise=new Promise(e=>this.#n=e),this.renderer=e,await this.prepareToRenderSnapshot(e);let r=new Promise(e=>this.#o=e),s={resume:this.#o,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(i,s)||await r,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.#n(void 0),delete this.renderPromise}else s&&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 Y extends X{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new z(this.element)}}class Q{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}}class Z{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=L(e.composedPath&&e.composedPath()[0]||e.target,"a[href]:not([target^=_]):not([download])");if(t&&function(e){if(e.hasAttribute("target")){for(let t of document.getElementsByName(e.target))if(t instanceof HTMLIFrameElement)return!1}return!0}(t)){let r=M(t);this.delegate.willFollowLinkToLocation(t,r,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(t,r))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}}class ee{constructor(e,t){this.delegate=e,this.linkInterceptor=new Z(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form");for(let[e,s]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:"hidden",name:e,value:s}));let s=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",s.href),r.setAttribute("hidden","");let i=e.getAttribute("data-turbo-method");i&&r.setAttribute("method",i);let n=e.getAttribute("data-turbo-frame");n&&r.setAttribute("data-turbo-frame",n);let o=S(e);o&&r.setAttribute("data-turbo-action",o);let a=e.getAttribute("data-turbo-confirm");a&&r.setAttribute("data-turbo-confirm",a),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}}class et{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=function(e){let t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",e.id),t}(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class er{#a=null;constructor(e,t,r,s,i=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=s,this.willRender=i,this.renderElement=r,this.promise=new Promise((e,t)=>this.resolvingFunctions={resolve:e,reject:t})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await et.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){!this.#a&&e.contains(this.currentSnapshot.activeElement)&&(this.#a=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#a)&&this.#a instanceof HTMLElement&&(this.#a.focus(),this.#a=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 es extends er{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t.ownerDocument?.createRange();s&&(s.selectNodeContents(t),e.appendChild(s.extractContents()))}constructor(e,t,r,s,i,n=!0){super(t,r,s,i,n),this.delegate=e}get shouldRender(){return!0}async render(){await u(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await u(),this.focusFirstAutofocusableElement(),await u(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){var e,t;let r=this.currentElement.firstElementChild,s="end"==(e=this.currentElement.getAttribute("data-autoscroll-block"))||"start"==e||"center"==e||"nearest"==e?e:"end",i="auto"==(t=this.currentElement.getAttribute("data-autoscroll-behavior"))||"smooth"==t?t:"auto";if(r)return r.scrollIntoView({block:s,behavior:i}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=c(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}class ei{static animationDuration=300;static get defaultCSS(){return f`
+(()=>{(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(r){r?(e(r,this),r.click()):(r=document.createElement("input"),r.type="submit",r.hidden=!0,this.appendChild(r),r.click(),this.removeChild(r))};function e(r,i){r instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),r.type=="submit"||t(TypeError,"The specified element is not a submit button"),r.form==i||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(r,i,n){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",n)}})(HTMLFormElement.prototype);var us=new WeakMap;function Qs(s){let e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function er(s){let e=Qs(s.target);e&&e.form&&us.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))s=e;else return}addEventListener("click",er,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return us.get(this.target)}})})();var z={eager:"eager",lazy:"lazy"},O=class s extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new s.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return tr(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function tr(s){switch(s.toLowerCase()){case"lazy":return z.lazy;default:return z.eager}}function S(s){return new URL(s.toString(),document.baseURI)}function $(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function Lt(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return S(t)}function sr(s){return(ar(s).match(/\.[^.]*$/)||[])[0]||""}function rr(s){return!!sr(s).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function ir(s,e){let t=lr(e);return s.href===S(t).href||s.href.startsWith(t)}function B(s,e){return ir(s,e)&&rr(s)}function Ye(s){let e=$(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function me(s){return Ye(s)}function nr(s,e){return S(s).href==S(e).href}function or(s){return s.pathname.split("/").slice(1)}function ar(s){return or(s).slice(-1)[0]}function lr(s){return cr(s.origin+s.pathname)}function cr(s){return s.endsWith("/")?s:s+"/"}var re=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return S(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function ie(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{let e=document.createElement("script"),t=Z("csp-nonce");return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,hr(e,s),e}}function hr(s,e){for(let{name:t,value:r}of e.attributes)s.setAttribute(t,r)}function ur(s){let e=document.createElement("template");return e.innerHTML=s,e.content}function v(s,{target:e,cancelable:t,detail:r}={}){let i=new CustomEvent(s,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function G(){return document.visibilityState==="hidden"?ms():ds()}function ds(){return new Promise(s=>requestAnimationFrame(()=>s()))}function ms(){return new Promise(s=>setTimeout(()=>s(),0))}function dr(){return Promise.resolve()}function fs(s=""){return new DOMParser().parseFromString(s,"text/html")}function ps(s,...e){let t=mr(s,e).replace(/^\n/,"").split(`
+`),r=t[0].match(/^\s+/),i=r?r[0].length:0;return t.map(n=>n.slice(i)).join(`
+`)}function mr(s,e){return s.reduce((t,r,i)=>{let n=e[i]==null?"":e[i];return t+r+n},"")}function N(){return Array.from({length:36}).map((s,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function pe(s,...e){for(let t of e.map(r=>r?.getAttribute(s)))if(typeof t=="string")return t;return null}function fr(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function ge(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function be(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function pr(s,e=2e3){return new Promise(t=>{let r=()=>{s.removeEventListener("error",r),s.removeEventListener("load",r),t()};s.addEventListener("load",r,{once:!0}),s.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function gs(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function gr(s){return s=="advance"||s=="replace"||s=="restore"}function W(...s){let e=pe("data-turbo-action",...s);return gr(e)?e:null}function bs(s){return document.querySelector(`meta[name="${s}"]`)}function Z(s){let e=bs(s);return e&&e.content}function br(s,e){let t=bs(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function X(s,e){if(s instanceof Element)return s.closest(e)||X(s.assignedSlot||s.getRootNode()?.host,e)}function Mt(s){return!!s&&s.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof s.focus=="function"}function vs(s){return Array.from(s.querySelectorAll("[autofocus]")).find(Mt)}async function vr(s,e){let t=e();s(),await ds();let r=e();return[t,r]}function yr(s){if(s.hasAttribute("target")){for(let e of document.getElementsByName(s.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function Er(s){return X(s,"a[href]:not([target^=_]):not([download])")}function ys(s){return S(s.getAttribute("href")||"")}function wr(s,e){let t=null;return(...r)=>{let i=()=>s.apply(this,r);clearTimeout(t),t=setTimeout(i,e)}}var Ze=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Es=new Ze(20),Sr=window.fetch;function ws(s,e={}){let t=new Headers(e.headers||{}),r=N();return Es.add(r),t.append("X-Turbo-Request-Id",r),Sr(s,{...e,headers:t})}function kt(s){switch(s.toLowerCase()){case"get":return L.get;case"post":return L.post;case"put":return L.put;case"patch":return L.patch;case"delete":return L.delete}}var L={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Ar(s){switch(s.toLowerCase()){case V.multipart:return V.multipart;case V.plain:return V.plain;default:return V.urlEncoded}}var V={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},j=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,i=new URLSearchParams,n=null,c=V.urlEncoded){let[h,p]=os(S(r),t,i,c);this.delegate=e,this.url=h,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:p,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=c}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=kt(e)||L.get;this.url.search="";let[i,n]=os(this.url,r,t,this.enctype);this.url=i,this.fetchOptions.body=n,this.fetchOptions.method=r}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=ws(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#s(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new re(e);return v("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Ot(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(i=>this.#e=i),r=v("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#s(e){return!v("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function Ot(s){return kt(s)==L.get}function os(s,e,t,r){let i=Array.from(t).length>0?new URLSearchParams(Ss(t)):s.searchParams;return Ot(e)?[Tr(s,i),null]:r==V.urlEncoded?[s,i]:[s,t]}function Ss(s){let e=[];for(let[t,r]of s)r instanceof File||e.push([t,r]);return e}function Tr(s,e){let t=new URLSearchParams(Ss(e));return s.search=t.toString(),s}var Qe=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},q=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(ur(e)):e}constructor(e){this.fragment=Cr(e)}};function Cr(s){for(let e of s.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(ie(r));e.replaceWith(t)}return s}var Lr=100,et=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,r){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,r),this.#e=null},Lr)}set(e,t,r){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+r)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},Mr=10*1e3,J=new et,K={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},ne=class s{state=K.initialized;static confirmMethod(e,t,r){return Promise.resolve(confirm(e))}constructor(e,t,r,i=!1){let n=Ir(t,r),c=Pr(Fr(t,r),n),h=kr(t,r),p=Br(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new j(this,n,c,h,t,p),this.mustRedirect=i}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=S(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=K,r=pe("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await s.confirmMethod(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=K;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=Or(Z("csrf-param"))||Z("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(q.contentType)}requestStarted(e){this.state=K.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),ge(this.formElement),v("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){J.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(J.clear(),this.requestMustRedirect(e)&&Rr(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=K.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=K.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),be(this.formElement),v("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||fr("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function kr(s,e){let t=new FormData(s),r=e?.getAttribute("name"),i=e?.getAttribute("value");return r&&t.append(r,i||""),t}function Or(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(s));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Rr(s){return s.statusCode==200&&!s.redirected}function Fr(s,e){let t=typeof s.action=="string"?s.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":s.getAttribute("action")||t||""}function Pr(s,e){let t=S(s);return Ot(e)&&(t.search=""),t}function Ir(s,e){let t=e?.getAttribute("formmethod")||s.getAttribute("method")||"";return kt(t.toLowerCase())||L.get}function Br(s,e){return Ar(e?.getAttribute("formenctype")||s.enctype)}var Q=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return vs(this.element)}get permanentElements(){return Ts(this.element)}getPermanentElementById(e){return As(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:i}=r,n=e.getPermanentElementById(i);n&&(t[i]=[r,n])}return t}};function As(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function Ts(s){return s.querySelectorAll("[id][data-turbo-permanent]")}var oe=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Nr(t,r)&&qr(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Nr(s,e){return(e?.getAttribute("formmethod")||s.getAttribute("method"))!="dialog"}function qr(s,e){if(e?.hasAttribute("formtarget")||s.hasAttribute("target")){let t=e?.getAttribute("formtarget")||s.target;for(let r of document.getElementsByName(t))if(r instanceof HTMLIFrameElement)return!1;return!0}else return!0}var ve=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor($(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:i,newSnapshot:n}=e,c=i;if(r)try{this.renderPromise=new Promise(T=>this.#e=T),this.renderer=e,await this.prepareToRenderSnapshot(e);let h=new Promise(T=>this.#t=T),p={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,p)||await h,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else c&&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()}},tt=class extends ve{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new Q(this.element)}},ye=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},Ee=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=Er(t);if(r&&yr(r)){let i=ys(r);this.delegate.willFollowLinkToLocation(r,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,i))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},we=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Ee(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),i="hidden";for(let[I,C]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:i,name:I,value:C}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let c=e.getAttribute("data-turbo-method");c&&r.setAttribute("method",c);let h=e.getAttribute("data-turbo-frame");h&&r.setAttribute("data-turbo-frame",h);let p=W(e);p&&r.setAttribute("data-turbo-action",p);let y=e.getAttribute("data-turbo-confirm");y&&r.setAttribute("data-turbo-confirm",y),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},Se=class{static async preservingPermanentElements(e,t,r){let i=new this(e,t);i.enter(),await r(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Dr(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Dr(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var ae=class{#e=null;constructor(e,t,r,i,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=n,this.renderElement=r,this.promise=new Promise((c,h)=>this.resolvingFunctions={resolve:c,reject:h})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Se.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},le=class extends ae{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let i=t,n=i.ownerDocument?.createRange();n&&(n.selectNodeContents(i),e.appendChild(n.extractContents()))}constructor(e,t,r,i,n,c=!0){super(t,r,i,n,c),this.delegate=e}get shouldRender(){return!0}async render(){await G(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await G(),this.focusFirstAutofocusableElement(),await G(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=xr(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=Hr(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=ie(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function xr(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function Hr(s,e){return s=="auto"||s=="smooth"?s:e}var st=class s{static animationDuration=300;static get defaultCSS(){return ps`
.turbo-progress-bar {
position: fixed;
display: block;
@@ -11,11 +10,11 @@ Copyright © 2024 37signals LLC
background: #0076ff;
z-index: 2147483647;
transition:
- width ${ei.animationDuration}ms ease-out,
- opacity ${ei.animationDuration/2}ms ${ei.animationDuration/2}ms ease-in;
+ width ${s.animationDuration}ms ease-out,
+ opacity ${s.animationDuration/2}ms ${s.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*ei.animationDuration)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,ei.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(){let e=document.createElement("style");return e.type="text/css",e.textContent=ei.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return T("csp-nonce")}}class en extends z{detailsByOuterHTML=this.children.filter(e=>"noscript"!=e.localName).map(e=>(e.hasAttribute("nonce")&&e.setAttribute("nonce",""),e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:"script"==t.localName?"script":!function(e){let t=e.localName;return"style"==t||"link"==t&&"stylesheet"==e.getAttribute("rel")}(t)?void 0:"stylesheet",tracked:"reload"==t.getAttribute("data-turbo-track"),elements:[]};return{...e,[r]:{...s,elements:[...s.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)=>{let{type:r,tracked:s,elements:i}=this.detailsByOuterHTML[t];return null!=r||s?i.length>1?[...e,...i.slice(1)]:e:[...e,...i]},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return"meta"==s.localName&&s.getAttribute("name")==e?s:t},0)}}class eo extends z{static fromHTMLString(e=""){return this.fromDocument(g(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new en(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[e,s]of t.entries()){let t=r[e];for(let e of t.selectedOptions)e.selected=!1;for(let e of s.selectedOptions)t.options[e.index].selected=!0}for(let t of e.querySelectorAll('input[type="password"]'))t.value="";return new eo(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){return i(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 ea{#l=!1;#h=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#l?(this.#l=!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}}let el={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},eh={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},ec={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ed={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},eu={advance:"forward",restore:"back",replace:"none"};class em{identifier=b();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=ec.initialized;viewTransitioner=new ea;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||b();let{action:i,historyChanged:n,referrer:o,snapshot:a,snapshotHTML:l,response:h,visitCachedSnapshot:c,willRender:d,updateHistory:u,shouldCacheSnapshot:m,acceptsStreamResponse:p,direction:g}={...el,...s};this.action=i,this.historyChanged=n,this.referrer=o,this.snapshot=a,this.snapshotHTML=l,this.response=h,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=c,this.willRender=d,this.updateHistory=u,this.scrolled=!d,this.shouldCacheSnapshot=m,this.acceptsStreamResponse=p,this.direction=g||eu[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==ec.initialized&&(this.recordTimingMetric(eh.visitStart),this.state=ec.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==ec.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=ec.canceled)}complete(){this.state!=ec.started||(this.recordTimingMetric(eh.visitEnd),this.adapter.visitCompleted(this),this.state=ec.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==ec.started&&(this.state=ec.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=w(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,B.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(eh.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;ep(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(eh.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,ep(e)&&null!=t){let e=eo.fromHTMLString(t);await this.renderPageSnapshot(e,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(eo.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let 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 eo.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return null!=this.getCachedSnapshot()}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(U.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:i}=t;void 0==r?this.recordResponse({statusCode:ed.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:i,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:i}=t;void 0==r?this.recordResponse({statusCode:ed.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:i,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:ed.networkFailure,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(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let 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}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}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(),this.frame=await u(),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 ep(e){return e>=200&&e<300}class eg{progressBar=new ei;constructor(e){this.session=e}visitProposedToLocation(e,t){a(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 ed.networkFailure:case ed.timeoutFailure:case ed.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),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){d("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}}class ef{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let e of this.temporaryElements)e.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}}class eb{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Q(this,t),this.formSubmitObserver=new G(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#c(e)}linkClickIntercepted(e,t,r){let s=this.#d(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return null==e.closest("turbo-frame")&&this.#u(e,t)&&this.#c(e,t)}formSubmitted(e,t){let r=this.#d(e,t);r&&r.delegate.formSubmitted(e,t)}#u(e,t){let r=o(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=i(s?.content??"/");return this.#c(e,t)&&a(r,n)}#c(e,t){if(!(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)))return!1;{let r=this.#d(e,t);return!!r&&r!=e.closest("turbo-frame")}}#d(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&"_top"!=r){let e=this.element.querySelector(`#${r}:not([disabled])`);if(e instanceof s)return e}}}class ev{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,r=b()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:e,restorationIndex:r}=t;this.restorationIdentifier=e;let s=r>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,e,s),this.currentIndex=r}}};onPageLoad=async e=>{await Promise.resolve(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||"complete"==document.readyState}}class ey{started=!1;#m=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||("loading"===this.eventTarget.readyState?this.eventTarget.addEventListener("DOMContentLoaded",this.#p,{once:!0}):this.#p())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#g,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#f,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#b,!0),this.started=!1)}#p=()=>{this.eventTarget.addEventListener("mouseenter",this.#g,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#f,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#b,!0),this.started=!0};#g=e=>{if("false"===T("turbo-prefetch"))return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#v(t)){let e=M(t);if(this.delegate.canPrefetchRequestToLocation(t,e)){this.#m=t;let r=new q(this,B.get,e,new URLSearchParams,t);j.setLater(e.toString(),r,this.#y)}}};#f=e=>{e.target===this.#m&&this.#E()};#E=()=>{j.clear(),this.#m=null};#b=e=>{if("FORM"!==e.target.tagName&&"get"===e.detail.fetchOptions.method){let t=j.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),j.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&"_top"!==s&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get #y(){return Number(T("turbo-prefetch-cache-time"))||1e4}#v(e){return!(!e.getAttribute("href")||eE(e)||ew(e)||eS(e)||eA(e)||eL(e))}}let eE=e=>e.origin!==document.location.origin||!["http:","https:"].includes(e.protocol)||e.hasAttribute("target"),ew=e=>e.pathname+e.search===document.location.pathname+document.location.search||e.href.startsWith("#"),eS=e=>{if("false"===e.getAttribute("data-turbo-prefetch")||"false"===e.getAttribute("data-turbo"))return!0;let t=L(e,"[data-turbo-prefetch]");return!!t&&"false"===t.getAttribute("data-turbo-prefetch")},eA=e=>{let t=e.getAttribute("data-turbo-method");return!!(t&&"get"!==t.toLowerCase()||eT(e)||e.hasAttribute("data-turbo-confirm")||e.hasAttribute("data-turbo-stream"))},eT=e=>e.hasAttribute("data-remote")||e.hasAttribute("data-behavior")||e.hasAttribute("data-confirm")||e.hasAttribute("data-method"),eL=e=>d("turbo:before-prefetch",{target:e,cancelable:!0}).defaultPrevented;class ek{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new em(this,i(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new K(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get 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){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:i,redirected:n}=t,o=this.#w(e,t);this.proposeVisit(t.location,{action:o,shouldCacheSnapshot:s,response:{statusCode:i,responseHTML:r,redirected:n}})}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let e=eo.fromHTMLString(r);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)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let r=n(e),s=n(this.view.lastRenderedLocation);return"replace"!==t&&l(e)===l(this.view.lastRenderedLocation)&&("restore"===t&&void 0===r||null!=r&&r!==s)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#w(e,t){let{submitter:r,formElement:s}=e;return S(r,s)||this.#S(t)}#S(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}}let eC={initial:0,loading:1,interactive:2,complete:3};class eO{stage=eC.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==eC.initial&&(this.stage=eC.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;"interactive"==e?this.pageIsInteractive():"complete"==e&&this.pageIsComplete()};pageIsInteractive(){this.stage==eC.loading&&(this.stage=eC.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==eC.interactive&&(this.stage=eC.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}}class eM{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 eR{render({fragment:e}){et.preservingPermanentElements(this,function(e){let t=J(document.documentElement),r={};for(let s of t){let{id:t}=s;for(let i of e.querySelectorAll("turbo-stream")){let e=_(i.templateElement.content,t);e&&(r[t]=[s,e])}}return r}(e),()=>{eF(e,()=>{eP(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}async function eF(e,t){let r=`turbo-stream-autofocus-${b()}`,s=function(e){for(let t of e){let e=C(t.templateElement.content);if(e)return e}return null}(e.querySelectorAll("turbo-stream")),i=null;if(s&&(i=s.id?s.id:r,s.id=i),t(),await u(),(null==document.activeElement||document.activeElement==document.body)&&i){let e=document.getElementById(i);k(e)&&e.focus(),e&&e.id==r&&e.removeAttribute("id")}}async function eP(e){let[t,r]=await O(e,()=>document.activeElement),s=t&&t.id;if(s){let e=document.getElementById(s);k(e)&&e!=r&&e.focus()}}class eN{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=>{let t=function(e){let t=e.detail?.fetchResponse;if(t instanceof h)return t}(e);t&&(t.contentType??"").startsWith(U.contentType)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#A&&"string"==typeof e.data&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(U.wrap(e))}}class eI extends er{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=c(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}var eB=function(){let e=new Set,t={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:l,afterNodeAdded:l,beforeNodeMorphed:l,afterNodeMorphed:l,beforeNodeRemoved:l,afterNodeRemoved:l,beforeAttributeUpdated:l},head:{style:"merge",shouldPreserve:function(e){return"true"===e.getAttribute("im-preserve")},shouldReAppend:function(e){return"true"===e.getAttribute("im-re-append")},shouldRemove:l,afterHeadMorphed:l}};function r(e,t){return t.ignoreActiveValue&&e===document.activeElement&&e!==document.body}function s(e,t,s){if(s.ignoreActive&&e===document.activeElement);else if(null==t)return!1===s.callbacks.beforeNodeRemoved(e)?e:(e.remove(),s.callbacks.afterNodeRemoved(e),null);else if(c(e,t))return!1===s.callbacks.beforeNodeMorphed(e,t)||(e instanceof HTMLHeadElement&&s.head.ignore||(e instanceof HTMLHeadElement&&"morph"!==s.head.style?a(t,e,s):(function(e,t,s){let i=e.nodeType;if(1===i){let r=e.attributes,i=t.attributes;for(let e of r)n(e.name,t,"update",s)||t.getAttribute(e.name)===e.value||t.setAttribute(e.name,e.value);for(let r=i.length-1;0<=r;r--){let o=i[r];n(o.name,t,"remove",s)||e.hasAttribute(o.name)||t.removeAttribute(o.name)}}(8===i||3===i)&&t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue),r(t,s)||function(e,t,r){if(e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&"file"!==e.type){let s=e.value,i=t.value;o(e,t,"checked",r),o(e,t,"disabled",r),e.hasAttribute("value")?s===i||n("value",t,"update",r)||(t.setAttribute("value",s),t.value=s):n("value",t,"remove",r)||(t.value="",t.removeAttribute("value"))}else if(e instanceof HTMLOptionElement)o(e,t,"selected",r);else if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){let s=e.value,i=t.value;if(n("value",t,"update",r))return;s!==i&&(t.value=s),t.firstChild&&t.firstChild.nodeValue!==s&&(t.firstChild.nodeValue=s)}}(e,t,s)}(t,e,s),r(e,s)||i(t,e,s))),s.callbacks.afterNodeMorphed(e,t)),e;else return!1===s.callbacks.beforeNodeRemoved(e)||!1===s.callbacks.beforeNodeAdded(t)?e:(e.parentElement.replaceChild(t,e),s.callbacks.afterNodeAdded(t),s.callbacks.afterNodeRemoved(e),t)}function i(e,t,r){let i,n=e.firstChild,o=t.firstChild;for(;n;){if(n=(i=n).nextSibling,null==o){if(!1===r.callbacks.beforeNodeAdded(i))return;t.appendChild(i),r.callbacks.afterNodeAdded(i),m(r,i);continue}if(h(i,o,r)){s(o,i,r),o=o.nextSibling,m(r,i);continue}let a=function(e,t,r,s,i){let n=p(i,r,t);if(n>0){let t=s,o=0;for(;null!=t;){if(h(r,t,i))return t;if((o+=p(i,t,e))>n)break;t=t.nextSibling}}return null}(e,t,i,o,r);if(a){o=d(o,a,r),s(a,i,r),m(r,i);continue}let l=function(e,t,r,s,i){let n=s,o=r.nextSibling,a=0;for(;null!=n;){if(p(i,n,e)>0)return null;if(c(r,n))break;if(c(o,n)&&(a++,o=o.nextSibling,a>=2))return null;n=n.nextSibling}return n}(e,0,i,o,r);if(l){o=d(o,l,r),s(l,i,r),m(r,i);continue}if(!1===r.callbacks.beforeNodeAdded(i))return;t.insertBefore(i,o),r.callbacks.afterNodeAdded(i),m(r,i)}for(;null!==o;){let e=o;o=o.nextSibling,u(e,r)}}function n(e,t,r,s){return"value"===e&&!!s.ignoreActiveValue&&t===document.activeElement||!1===s.callbacks.beforeAttributeUpdated(e,t,r)}function o(e,t,r,s){if(e[r]!==t[r]){let i=n(r,t,"update",s);i||(t[r]=e[r]),e[r]?i||t.setAttribute(r,e[r]):n(r,t,"remove",s)||t.removeAttribute(r)}}function a(e,t,r){let s=[],i=[],n=[],o=[],a=r.head.style,l=new Map;for(let t of e.children)l.set(t.outerHTML,t);for(let e of t.children){let t=l.has(e.outerHTML),s=r.head.shouldReAppend(e),h=r.head.shouldPreserve(e);t||h?s?i.push(e):(l.delete(e.outerHTML),n.push(e)):"append"===a?s&&(i.push(e),o.push(e)):!1!==r.head.shouldRemove(e)&&i.push(e)}o.push(...l.values());let h=[];for(let e of o){let i=document.createRange().createContextualFragment(e.outerHTML).firstChild;if(!1!==r.callbacks.beforeNodeAdded(i)){if(i.href||i.src){let e=null,t=new Promise(function(t){e=t});i.addEventListener("load",function(){e()}),h.push(t)}t.appendChild(i),r.callbacks.afterNodeAdded(i),s.push(i)}}for(let e of i)!1!==r.callbacks.beforeNodeRemoved(e)&&(t.removeChild(e),r.callbacks.afterNodeRemoved(e));return r.head.afterHeadMorphed(t,{added:s,kept:n,removed:i}),h}function l(){}function h(e,t,r){return null!=e&&null!=t&&e.nodeType===t.nodeType&&e.tagName===t.tagName&&(""!==e.id&&e.id===t.id||p(r,e,t)>0)}function c(e,t){return null!=e&&null!=t&&e.nodeType===t.nodeType&&e.tagName===t.tagName}function d(e,t,r){for(;e!==t;){let t=e;e=e.nextSibling,u(t,r)}return m(r,t),t.nextSibling}function u(e,t){m(t,e),!1!==t.callbacks.beforeNodeRemoved(e)&&(e.remove(),t.callbacks.afterNodeRemoved(e))}function m(t,r){for(let s of t.idMap.get(r)||e)t.deadIds.add(s)}function p(t,r,s){let i=t.idMap.get(r)||e,n=0;for(let r of i)!t.deadIds.has(r)&&(t.idMap.get(s)||e).has(r)&&++n;return n}function g(e,t){let r=e.parentElement;for(let s of e.querySelectorAll("[id]")){let e=s;for(;e!==r&&null!=e;){let r=t.get(e);null==r&&(r=new Set,t.set(e,r)),r.add(s.id),e=e.parentElement}}}return{morph:function(e,r,n={}){var o,l,h;let d,u;e instanceof Document&&(e=e.documentElement),"string"==typeof r&&(r=function(e){let t=new DOMParser,r=e.replace(/