/*!
Turbo 8.0.12
Copyright © 2024 37signals LLC
*/
!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 e = new WeakMap; function t(t) { const s = 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 }(t.target); s && s.form && e.set(s.form, s) } !function () { if ("submitter" in Event.prototype) return; let s = window.Event.prototype; if ("SubmitEvent" in window) { const e = window.SubmitEvent.prototype; if (!/Apple Computer/.test(navigator.vendor) || "submitter" in e) return; s = e } addEventListener("click", t, !0), Object.defineProperty(s, "submitter", { get() { if ("submit" == this.type && this.target instanceof HTMLFormElement) return e.get(this.target) } }) }(); const s = { eager: "eager", lazy: "lazy" }; class r extends HTMLElement { static delegateConstructor = void 0; loaded = Promise.resolve(); static get observedAttributes() { return ["disabled", "loading", "src"] } constructor() { super(), this.delegate = new r.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 s.lazy; return s.eager }(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 i = { 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 n(e) { if ("false" == e.getAttribute("data-turbo-eval")) return e; { const t = document.createElement("script"), s = E(); return s && (t.nonce = s), t.textContent = e.textContent, t.async = !1, function (e, t) { for (const { name: s, value: r } of t.attributes) e.setAttribute(s, r) }(t, e), t } } function o(e, { target: t, cancelable: s, detail: r } = {}) { const i = new CustomEvent(e, { cancelable: s, bubbles: !0, composed: !0, detail: r }); return t && t.isConnected ? t.dispatchEvent(i) : document.documentElement.dispatchEvent(i), i } function a(e) { e.preventDefault(), e.stopImmediatePropagation() } function c() { return "hidden" === document.visibilityState ? h() : l() } function l() { return new Promise((e => requestAnimationFrame((() => e())))) } function h() { return new Promise((e => setTimeout((() => e()), 0))) } function d(e = "") { return (new DOMParser).parseFromString(e, "text/html") } function u(e, ...t) { const s = function (e, t) { return e.reduce(((e, s, r) => e + s + (null == t[r] ? "" : t[r])), "") }(e, t).replace(/^\n/, "").split("\n"), r = s[0].match(/^\s+/), i = r ? r[0].length : 0; return s.map((e => e.slice(i))).join("\n") } function m() { 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 p(e, ...t) { for (const s of t.map((t => t?.getAttribute(e)))) if ("string" == typeof s) return s; return null } function f(...e) { for (const t of e) "turbo-frame" == t.localName && t.setAttribute("busy", ""), t.setAttribute("aria-busy", "true") } function g(...e) { for (const t of e) "turbo-frame" == t.localName && t.removeAttribute("busy"), t.removeAttribute("aria-busy") } function b(e, t = 2e3) { return new Promise((s => { const r = () => { e.removeEventListener("error", r), e.removeEventListener("load", r), s() }; e.addEventListener("load", r, { once: !0 }), e.addEventListener("error", r, { once: !0 }), setTimeout(s, t) })) } function v(e) { switch (e) { case "replace": return history.replaceState; case "advance": case "restore": return history.pushState } } function S(...e) { const t = p("data-turbo-action", ...e); return function (e) { return "advance" == e || "replace" == e || "restore" == e }(t) ? t : null } function w(e) { return document.querySelector(`meta[name="${e}"]`) } function y(e) { const t = w(e); return t && t.content } function E() { const e = w("csp-nonce"); if (e) { const { nonce: t, content: s } = e; return "" == t ? s : t } } function A(e, t) { if (e instanceof Element) return e.closest(t) || A(e.assignedSlot || e.getRootNode()?.host, t) } function R(e) { return !!e && null == e.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])") && "function" == typeof e.focus } function T(e) { return Array.from(e.querySelectorAll("[autofocus]")).find(R) } function L(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 C(e) { return A(e, "a[href]:not([target^=_]):not([download])") } function P(e) { return F(e.getAttribute("href") || "") } const k = { "aria-disabled": { beforeSubmit: e => { e.setAttribute("aria-disabled", "true"), e.addEventListener("click", a) }, afterSubmit: e => { e.removeAttribute("aria-disabled"), e.removeEventListener("click", a) } }, disabled: { beforeSubmit: e => e.disabled = !0, afterSubmit: e => e.disabled = !1 } }; const M = new class { #e = null; constructor(e) { Object.assign(this, e) } get submitter() { return this.#e } set submitter(e) { this.#e = k[e] || e } }({ mode: "on", submitter: "disabled" }), I = { drive: i, forms: M }; function F(e) { return new URL(e.toString(), document.baseURI) } function q(e) { let t; return e.hash ? e.hash.slice(1) : (t = e.href.match(/#(.*)$/)) ? t[1] : void 0 } function H(e, t) { return F(t?.getAttribute("formaction") || e.getAttribute("action") || e.action) } function O(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 === F(s).href || e.href.startsWith(s) } function N(e, t) { return B(e, t) && !I.drive.unvisitableExtensions.has(O(e)) } function D(e) { const t = q(e); return null != t ? e.href.slice(0, -(t.length + 1)) : e.href } function x(e) { return D(e) } class V { 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 F(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 W 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 U = new W(20), _ = window.fetch; function $(e, t = {}) { const s = new Headers(t.headers || {}), r = m(); return U.add(r), s.append("X-Turbo-Request-Id", r), _(e, { ...t, headers: s }) } function j(e) { switch (e.toLowerCase()) { case "get": return z.get; case "post": return z.post; case "put": return z.put; case "patch": return z.patch; case "delete": return z.delete } } const z = { get: "get", post: "post", put: "put", patch: "patch", delete: "delete" }; function G(e) { switch (e.toLowerCase()) { case J.multipart: return J.multipart; case J.plain: return J.plain; default: return J.urlEncoded } } const J = { urlEncoded: "application/x-www-form-urlencoded", multipart: "multipart/form-data", plain: "text/plain" }; class X { abortController = new AbortController; #t = e => { }; constructor(e, t, s, r = new URLSearchParams, i = null, n = J.urlEncoded) { const [o, a] = Q(F(s), t, r, n); 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 = n } get method() { return this.fetchOptions.method } set method(e) { const t = this.isSafe ? this.url.searchParams : this.fetchOptions.body || new FormData, s = j(e) || z.get; this.url.search = ""; const [r, i] = Q(this.url, s, t, this.enctype); this.url = r, 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 = $(this.url.href, e); const s = await this.response; return await this.receive(s) } catch (e) { if ("AbortError" !== e.name) throw this.#r(e) && this.delegate.requestErrored(this, e), e } finally { this.delegate.requestFinished(this) } } async receive(e) { const t = new V(e); return o("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 K(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 = o("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 } #r(e) { return !o("turbo:fetch-request-error", { target: this.target, cancelable: !0, detail: { request: this, error: e } }).defaultPrevented } } function K(e) { return j(e) == z.get } function Q(e, t, s, r) { const i = Array.from(s).length > 0 ? new URLSearchParams(Y(s)) : e.searchParams; return K(t) ? [Z(e, i), null] : r == J.urlEncoded ? [e, i] : [e, s] } function Y(e) { const t = []; for (const [s, r] of e) r instanceof File || t.push([s, r]); return t } function Z(e, t) { const s = new URLSearchParams(Y(t)); return e.search = s.toString(), e } class ee { 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 te { 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(n(t)); t.replaceWith(e) } return e }(e) } } const se = new class { #i = null; #n = null; get(e) { if (this.#n && this.#n.url === e && this.#n.expire > Date.now()) return this.#n.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.#n = { url: e, request: t, expire: new Date((new Date).getTime() + s) } } clear() { this.#i && clearTimeout(this.#i), this.#n = null } }, re = { initialized: "initialized", requesting: "requesting", waiting: "waiting", receiving: "receiving", stopping: "stopping", stopped: "stopped" }; class ie { state = re.initialized; static confirmMethod(e) { return Promise.resolve(confirm(e)) } constructor(e, t, s, r = !1) { const i = function (e, t) { const s = t?.getAttribute("formmethod") || e.getAttribute("method") || ""; return j(s.toLowerCase()) || z.get }(t, s), n = function (e, t) { const s = F(e); K(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), r = t?.getAttribute("name"), i = t?.getAttribute("value"); r && s.append(r, i || ""); return s }(t, s), a = function (e, t) { return G(t?.getAttribute("formenctype") || e.enctype) }(t, s); this.delegate = e, this.formElement = t, this.submitter = s, this.fetchRequest = new X(this, i, n, o, t, a), this.mustRedirect = r } 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 = F(e) } get body() { return this.fetchRequest.body } get enctype() { return this.fetchRequest.enctype } get isSafe() { return this.fetchRequest.isSafe } get location() { return this.fetchRequest.url } async start() { const { initialized: e, requesting: t } = re, s = p("data-turbo-confirm", this.submitter, this.formElement); if ("string" == typeof s) { const e = "function" == typeof I.forms.confirm ? I.forms.confirm : ie.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 } = re; 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 } } }(y("csrf-param")) || y("csrf-token"); t && (e.headers["X-CSRF-Token"] = t) } this.requestAcceptsTurboStreamResponse(e) && e.acceptResponseType(te.contentType) } requestStarted(e) { this.state = re.waiting, this.submitter && I.forms.submitter.beforeSubmit(this.submitter), this.setSubmitsWith(), f(this.formElement), o("turbo:submit-start", { target: this.formElement, detail: { formSubmission: this } }), this.delegate.formSubmissionStarted(this) } requestPreventedHandlingResponse(e, t) { se.clear(), this.result = { success: t.succeeded, fetchResponse: t } } requestSucceededWithResponse(e, t) { if (t.clientError || t.serverError) this.delegate.formSubmissionFailedWithResponse(this, t); else if (se.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 = re.receiving, this.result = { success: !0, fetchResponse: t }, this.delegate.formSubmissionSucceededWithResponse(this, t) } requestFailedWithResponse(e, t) { this.result = { success: !1, fetchResponse: t }, this.delegate.formSubmissionFailedWithResponse(this, t) } requestErrored(e, t) { this.result = { success: !1, error: t }, this.delegate.formSubmissionErrored(this, t) } requestFinished(e) { this.state = re.stopped, this.submitter && I.forms.submitter.afterSubmit(this.submitter), this.resetSubmitterText(), g(this.formElement), o("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 ne { 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 T(this.element) } get permanentElements() { return ae(this.element) } getPermanentElementById(e) { return oe(this.element, e) } getPermanentElementMapForSnapshot(e) { const t = {}; for (const s of this.permanentElements) { const { id: r } = s, i = e.getPermanentElementById(r); i && (t[r] = [s, i]) } return t } } function oe(e, t) { return e.querySelector(`#${t}[data-turbo-permanent]`) } function ae(e) { return e.querySelectorAll("[id][data-turbo-permanent]") } class ce { 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 L(s) }(t, s) && this.delegate.willSubmitForm(t, s) && (e.preventDefault(), e.stopImmediatePropagation(), this.delegate.formSubmitted(t, s)) } } } class le { #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(q(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: r, newSnapshot: i } = e, n = r; 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)), r = { resume: this.#a, render: this.renderer.renderElement, renderMethod: this.renderer.renderMethod }; this.delegate.allowsImmediateRender(i, r) || 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 n && 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 he extends le { missing() { this.element.innerHTML = 'Content missing' } get snapshot() { return new ne(this.element) } } class de { 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 = C(t) || t; return s instanceof Element && s.closest("turbo-frame, html") == this.element } } class ue { 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 = C(e.composedPath && e.composedPath()[0] || e.target); if (t && L(t.target)) { const s = P(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 me { constructor(e, t) { this.delegate = e, this.linkInterceptor = new ue(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, r] of t.searchParams) s.append(Object.assign(document.createElement("input"), { type: "hidden", name: e, value: r })); const r = Object.assign(t, { search: "" }); s.setAttribute("data-turbo", "true"), s.setAttribute("action", r.href), s.setAttribute("hidden", ""); const i = e.getAttribute("data-turbo-method"); i && s.setAttribute("method", i); const n = e.getAttribute("data-turbo-frame"); n && s.setAttribute("data-turbo-frame", n); const o = S(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 pe { static async preservingPermanentElements(e, t, s) { const r = new this(e, t); r.enter(), await s(), r.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 fe { #c = null; static renderElement(e, t) { } constructor(e, t, s, r = !0) { this.currentSnapshot = e, this.newSnapshot = t, this.isPreview = s, this.willRender = r, 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 pe.preservingPermanentElements(this, this.permanentElementMap, e) } focusFirstAutofocusableElement() { if (this.shouldAutofocus) { const e = this.connectedSnapshot.firstAutofocusableElement; e && e.focus() } } enteringBardo(e) { this.#c || e.contains(this.currentSnapshot.activeElement) && (this.#c = this.currentSnapshot.activeElement) } leavingBardo(e) { e.contains(this.#c) && this.#c instanceof HTMLElement && (this.#c.focus(), this.#c = 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 ge extends fe { static renderElement(e, t) { const s = document.createRange(); s.selectNodeContents(e), s.deleteContents(); const r = t, i = r.ownerDocument?.createRange(); i && (i.selectNodeContents(r), e.appendChild(i.extractContents())) } constructor(e, t, s, r, i, n = !0) { super(t, s, r, i, n), this.delegate = e } get shouldRender() { return !0 } async render() { await c(), this.preservingPermanentElements((() => { this.loadFrameElement() })), this.scrollFrameIntoView(), await c(), this.focusFirstAutofocusableElement(), await c(), 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, r = (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: r, behavior: i }), !0 } var e, t; return !1 } activateScriptElements() { for (const e of this.newScriptElements) { const t = n(e); e.replaceWith(t) } } get newScriptElements() { return this.currentElement.querySelectorAll("script") } } var be = 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 s(e, t, r) { if (r.head.block) { let i = e.querySelector("head"), n = t.querySelector("head"); if (i && n) { let o = c(n, i, r); return void Promise.all(o).then((function () { s(e, t, Object.assign(r, { head: { block: !1, ignore: !0 } })) })) } } if ("innerHTML" === r.morphStyle) return n(t, e, r), e.children; if ("outerHTML" === r.morphStyle || null == r.morphStyle) { let s = function (e, t, s) { let r; r = e.firstChild; let i = r, n = 0; for (; r;) { let e = f(r, t, s); e > n && (i = r, n = e), r = r.nextSibling } return i }(t, e, r), n = s?.previousSibling, o = s?.nextSibling, a = i(e, s, r); return s ? function (e, t, s) { let r = [], i = []; for (; null != e;)r.push(e), e = e.previousSibling; for (; r.length > 0;) { let e = r.pop(); i.push(e), t.parentElement.insertBefore(e, t) } i.push(t); for (; null != s;)r.push(s), i.push(s), s = s.nextSibling; for (; r.length > 0;)t.parentElement.insertBefore(r.pop(), t.nextSibling); return i }(n, a, o) : [] } throw "Do not understand how to morph style " + r.morphStyle } function r(e, t) { return t.ignoreActiveValue && e === document.activeElement && e !== document.body } function i(e, t, s) { if (!s.ignoreActive || e !== document.activeElement) return null == t ? !1 === s.callbacks.beforeNodeRemoved(e) ? e : (e.remove(), s.callbacks.afterNodeRemoved(e), null) : d(e, t) ? (!1 === s.callbacks.beforeNodeMorphed(e, t) || (e instanceof HTMLHeadElement && s.head.ignore || (e instanceof HTMLHeadElement && "morph" !== s.head.style ? c(t, e, s) : (!function (e, t, s) { let i = e.nodeType; if (1 === i) { const r = e.attributes, i = t.attributes; for (const e of r) o(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--) { const n = i[r]; o(n.name, t, "remove", s) || (e.hasAttribute(n.name) || t.removeAttribute(n.name)) } } 8 !== i && 3 !== i || t.nodeValue !== e.nodeValue && (t.nodeValue = e.nodeValue); r(t, s) || function (e, t, s) { if (e instanceof HTMLInputElement && t instanceof HTMLInputElement && "file" !== e.type) { let r = e.value, i = t.value; a(e, t, "checked", s), a(e, t, "disabled", s), e.hasAttribute("value") ? r !== i && (o("value", t, "update", s) || (t.setAttribute("value", r), t.value = r)) : o("value", t, "remove", s) || (t.value = "", t.removeAttribute("value")) } else if (e instanceof HTMLOptionElement) a(e, t, "selected", s); else if (e instanceof HTMLTextAreaElement && t instanceof HTMLTextAreaElement) { let r = e.value, i = t.value; if (o("value", t, "update", s)) return; r !== i && (t.value = r), t.firstChild && t.firstChild.nodeValue !== r && (t.firstChild.nodeValue = r) } }(e, t, s) }(t, e, s), r(e, s) || n(t, e, s))), s.callbacks.afterNodeMorphed(e, t)), e) : !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 n(e, t, s) { let r, n = e.firstChild, o = t.firstChild; for (; n;) { if (r = n, n = r.nextSibling, null == o) { if (!1 === s.callbacks.beforeNodeAdded(r)) return; t.appendChild(r), s.callbacks.afterNodeAdded(r), S(s, r); continue } if (h(r, o, s)) { i(o, r, s), o = o.nextSibling, S(s, r); continue } let a = m(e, t, r, o, s); if (a) { o = u(o, a, s), i(a, r, s), S(s, r); continue } let c = p(e, t, r, o, s); if (c) o = u(o, c, s), i(c, r, s), S(s, r); else { if (!1 === s.callbacks.beforeNodeAdded(r)) return; t.insertBefore(r, o), s.callbacks.afterNodeAdded(r), S(s, r) } } for (; null !== o;) { let e = o; o = o.nextSibling, g(e, s) } } function o(e, t, s, r) { return !("value" !== e || !r.ignoreActiveValue || t !== document.activeElement) || !1 === r.callbacks.beforeAttributeUpdated(e, t, s) } function a(e, t, s, r) { if (e[s] !== t[s]) { let i = o(s, t, "update", r); i || (t[s] = e[s]), e[s] ? i || t.setAttribute(s, e[s]) : o(s, t, "remove", r) || t.removeAttribute(s) } } function c(e, t, s) { let r = [], i = [], n = [], o = [], a = s.head.style, c = new Map; for (const t of e.children) c.set(t.outerHTML, t); for (const e of t.children) { let t = c.has(e.outerHTML), r = s.head.shouldReAppend(e), l = s.head.shouldPreserve(e); t || l ? r ? i.push(e) : (c.delete(e.outerHTML), n.push(e)) : "append" === a ? r && (i.push(e), o.push(e)) : !1 !== s.head.shouldRemove(e) && i.push(e) } o.push(...c.values()); let l = []; for (const e of o) { let i = document.createRange().createContextualFragment(e.outerHTML).firstChild; if (!1 !== s.callbacks.beforeNodeAdded(i)) { if (i.href || i.src) { let e = null, t = new Promise((function (t) { e = t })); i.addEventListener("load", (function () { e() })), l.push(t) } t.appendChild(i), s.callbacks.afterNodeAdded(i), r.push(i) } } for (const e of i) !1 !== s.callbacks.beforeNodeRemoved(e) && (t.removeChild(e), s.callbacks.afterNodeRemoved(e)); return s.head.afterHeadMorphed(t, { added: r, kept: n, removed: i }), l } function l() { } function h(e, t, s) { return null != e && null != t && (e.nodeType === t.nodeType && e.tagName === t.tagName && ("" !== e.id && e.id === t.id || w(s, e, t) > 0)) } function d(e, t) { return null != e && null != t && (e.nodeType === t.nodeType && e.tagName === t.tagName) } function u(e, t, s) { for (; e !== t;) { let t = e; e = e.nextSibling, g(t, s) } return S(s, t), t.nextSibling } function m(e, t, s, r, i) { let n = w(i, s, t); if (n > 0) { let t = r, o = 0; for (; null != t;) { if (h(s, t, i)) return t; if (o += w(i, t, e), o > n) return null; t = t.nextSibling } } return null } function p(e, t, s, r, i) { let n = r, o = s.nextSibling, a = 0; for (; null != n;) { if (w(i, n, e) > 0) return null; if (d(s, n)) return n; if (d(o, n) && (a++, o = o.nextSibling, a >= 2)) return null; n = n.nextSibling } return n } function f(e, t, s) { return d(e, t) ? .5 + w(s, e, t) : 0 } function g(e, t) { S(t, e), !1 !== t.callbacks.beforeNodeRemoved(e) && (e.remove(), t.callbacks.afterNodeRemoved(e)) } function b(e, t) { return !e.deadIds.has(t) } function v(t, s, r) { return (t.idMap.get(r) || e).has(s) } function S(t, s) { let r = t.idMap.get(s) || e; for (const e of r) t.deadIds.add(e) } function w(t, s, r) { let i = t.idMap.get(s) || e, n = 0; for (const e of i) b(t, e) && v(t, e, r) && ++n; return n } function y(e, t) { let s = e.parentElement, r = e.querySelectorAll("[id]"); for (const e of r) { let r = e; for (; r !== s && null != r;) { let s = t.get(r); null == s && (s = new Set, t.set(r, s)), s.add(e.id), r = r.parentElement } } } function E(e, t) { let s = new Map; return y(e, s), y(t, s), s } return { morph: function (e, r, i = {}) { e instanceof Document && (e = e.documentElement), "string" == typeof r && (r = function (e) { let t = new DOMParser, s = e.replace(/