rails_nexus 2.0.6 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +110 -0
  3. data/README.md +33 -6
  4. data/SECURITY.md +11 -0
  5. data/THIRD_PARTY_NOTICES.md +14 -0
  6. data/app/assets/config/rails_nexus_manifest.js +1 -1
  7. data/app/assets/javascripts/rails_nexus/application.js +55 -0
  8. data/app/assets/javascripts/rails_nexus/controllers.js +82 -5
  9. data/app/assets/stylesheets/rails_nexus/application.css +170 -60
  10. data/app/controllers/rails_nexus/analytics_controller.rb +13 -26
  11. data/app/controllers/rails_nexus/application_controller.rb +6 -2
  12. data/app/controllers/rails_nexus/backup_controller.rb +22 -19
  13. data/app/controllers/rails_nexus/cron_jobs_controller.rb +1 -9
  14. data/app/controllers/rails_nexus/database_health_controller.rb +0 -10
  15. data/app/controllers/rails_nexus/logged_exceptions_controller.rb +0 -2
  16. data/app/controllers/rails_nexus/n1_patterns_controller.rb +0 -2
  17. data/app/controllers/rails_nexus/settings_controller.rb +1 -39
  18. data/app/controllers/rails_nexus/source_code_controller.rb +9 -13
  19. data/app/controllers/rails_nexus/stats_controller.rb +43 -43
  20. data/app/helpers/rails_nexus/application_helper.rb +5 -0
  21. data/app/helpers/rails_nexus/logged_exceptions_helper.rb +4 -49
  22. data/app/helpers/rails_nexus/source_code_helper.rb +49 -10
  23. data/app/javascript/controllers/rails_nexus_controller.js +6 -2
  24. data/app/javascript/controllers/rails_nexus_sidebar_controller.js +71 -3
  25. data/app/javascript/rails_nexus/application.js +15 -3
  26. data/app/jobs/rails_nexus/backup_job.rb +18 -0
  27. data/app/models/rails_nexus/backup.rb +11 -11
  28. data/app/models/rails_nexus/backup_config.rb +38 -2
  29. data/app/models/rails_nexus/logged_exception.rb +27 -13
  30. data/app/services/rails_nexus/backup_service.rb +342 -120
  31. data/app/views/layouts/rails_nexus/_sidebar_navigation.html.erb +40 -10
  32. data/app/views/layouts/rails_nexus/application.html.erb +72 -14
  33. data/app/views/rails_nexus/backup/_form.html.erb +3 -0
  34. data/app/views/rails_nexus/backup/history.html.erb +17 -2
  35. data/app/views/rails_nexus/backup/index.html.erb +29 -72
  36. data/app/views/rails_nexus/logged_exceptions/_exceptions.html.erb +12 -44
  37. data/app/views/rails_nexus/logged_exceptions/index.html.erb +21 -99
  38. data/app/views/rails_nexus/stats/index.html.erb +1 -1
  39. data/db/seeds/backup_configs.rb +5 -4
  40. data/lib/generators/rails_nexus/install_generator.rb +1 -1
  41. data/lib/generators/rails_nexus/templates/INSTALL.md +1 -0
  42. data/lib/generators/rails_nexus/templates/migration.rb +8 -2
  43. data/lib/generators/rails_nexus/templates/rails_nexus.rb +3 -0
  44. data/lib/generators/rails_nexus/templates/views/layouts/rails_nexus/application.html.erb +1 -1
  45. data/lib/rails_nexus/configuration.rb +10 -0
  46. data/lib/rails_nexus/database_adapter.rb +53 -0
  47. data/lib/rails_nexus/engine.rb +0 -13
  48. data/lib/rails_nexus/logger.rb +1 -12
  49. data/lib/rails_nexus/notifications.rb +27 -20
  50. data/lib/rails_nexus/version.rb +1 -1
  51. data/lib/rails_nexus/webhook_client.rb +151 -0
  52. data/lib/rails_nexus.rb +37 -23
  53. data/lib/tasks/rails_nexus.rake +4 -4
  54. data/rails_nexus.gemspec +3 -2
  55. metadata +9 -16
  56. data/config/importmap.rb +0 -15
@@ -0,0 +1,55 @@
1
+ /*! RailsNexus bundle; includes Turbo and Stimulus (MIT) */
2
+ (()=>{var C3=Object.defineProperty;var L3=(V)=>V;function M3(V,Z){this[V]=L3.bind(null,Z)}var q3=(V,Z)=>{for(var I in Z)C3(V,I,{get:Z[I],enumerable:!0,configurable:!0,set:M3.bind(Z,I)})};var z3=(V,Z)=>()=>(V&&(Z=V(V=0)),Z);var U3={};q3(U3,{cable:()=>X4,Turbo:()=>K3});function J0(V){if(V.getAttribute("data-turbo-eval")=="false")return V;{let Z=document.createElement("script"),I=X2();return I&&(Z.nonce=I),Z.textContent=V.textContent,Z.async=!1,function(J,G){for(let{name:K,value:$}of G.attributes)J.setAttribute(K,$)}(Z,V),Z}}function Q(V,{target:Z,cancelable:I,detail:J}={}){let G=new CustomEvent(V,{cancelable:I,bubbles:!0,composed:!0,detail:J});return Z&&Z.isConnected?Z.dispatchEvent(G):document.documentElement.dispatchEvent(G),G}function i1(V){V.preventDefault(),V.stopImmediatePropagation()}function V0(){return document.visibilityState==="hidden"?B2():$2()}function $2(){return new Promise((V)=>requestAnimationFrame(()=>V()))}function B2(){return new Promise((V)=>setTimeout(()=>V(),0))}function W2(V=""){return new DOMParser().parseFromString(V,"text/html")}function S2(V,...Z){let I=function(K,$){return K.reduce((T,X,C)=>T+X+($[C]==null?"":$[C]),"")}(V,Z).replace(/^\n/,"").split(`
3
+ `),J=I[0].match(/^\s+/),G=J?J[0].length:0;return I.map((K)=>K.slice(G)).join(`
4
+ `)}function u(){return Array.from({length:36}).map((V,Z)=>Z==8||Z==13||Z==18||Z==23?"-":Z==14?"4":Z==19?(Math.floor(4*Math.random())+8).toString(16):Math.floor(16*Math.random()).toString(16)).join("")}function F0(V,...Z){for(let I of Z.map((J)=>J?.getAttribute(V)))if(typeof I=="string")return I;return null}function j0(...V){for(let Z of V)Z.localName=="turbo-frame"&&Z.setAttribute("busy",""),Z.setAttribute("aria-busy","true")}function C0(...V){for(let Z of V)Z.localName=="turbo-frame"&&Z.removeAttribute("busy"),Z.removeAttribute("aria-busy")}function x3(V,Z=2000){return new Promise((I)=>{let J=()=>{V.removeEventListener("error",J),V.removeEventListener("load",J),I()};V.addEventListener("load",J,{once:!0}),V.addEventListener("error",J,{once:!0}),setTimeout(I,Z)})}function T2(V){switch(V){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function b(...V){let Z=F0("data-turbo-action",...V);return function(I){return I=="advance"||I=="replace"||I=="restore"}(Z)?Z:null}function s0(V){return document.querySelector(`meta[name="${V}"]`)}function L0(V){let Z=s0(V);return Z&&Z.content}function X2(){let V=s0("csp-nonce");if(V){let{nonce:Z,content:I}=V;return Z==""?I:Z}}function i(V,Z){if(V instanceof Element)return V.closest(Z)||i(V.assignedSlot||V.getRootNode()?.host,Z)}function v0(V){return!!V&&V.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof V.focus=="function"}function H2(V){return Array.from(V.querySelectorAll("[autofocus]")).find(v0)}function A2(V){if(V==="_blank")return!1;if(V){for(let Z of document.getElementsByName(V))if(Z instanceof HTMLIFrameElement)return!1;return!0}return!0}function O2(V){let Z=i(V,"a[href], a[xlink\\:href]");if(!Z)return null;if(Z.href.startsWith("#"))return null;if(Z.hasAttribute("download"))return null;let I=Z.getAttribute("target");return I&&I!=="_self"?null:Z}function E(V){return new URL(V.toString(),document.baseURI)}function Z0(V){let Z;return V.hash?V.hash.slice(1):(Z=V.href.match(/#(.*)$/))?Z[1]:void 0}function t0(V,Z){return E(Z?.getAttribute("formaction")||V.getAttribute("action")||V.action)}function m3(V){return(function(Z){return function(I){return I.pathname.split("/").slice(1)}(Z).slice(-1)[0]}(V).match(/\.[^.]*$/)||[])[0]||""}function p(V,Z){return function(I,J){let G=n1(J.origin+J.pathname);return n1(I.href)===G||I.href.startsWith(G)}(V,Z)&&!f.drive.unvisitableExtensions.has(m3(V))}function U2(V){return E(V.getAttribute("href")||"")}function U0(V){return function(Z){let I=Z0(Z);return I!=null?Z.href.slice(0,-(I.length+1)):Z.href}(V)}function F2(V,Z){return E(V).href==E(Z).href}function n1(V){return V.endsWith("/")?V:V+"/"}class G0{constructor(V){this.response=V}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 E(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(V){return this.response.headers.get(V)}}function e0(V,Z={}){let I=new Headers(Z.headers||{}),J=u();return C2.add(J),I.append("X-Turbo-Request-Id",J),window.fetch(V,{...Z,headers:I})}function z0(V){switch(V.toLowerCase()){case"get":return Y.get;case"post":return Y.post;case"put":return Y.put;case"patch":return Y.patch;case"delete":return Y.delete}}function L2(V){switch(V.toLowerCase()){case m.multipart:return m.multipart;case m.plain:return m.plain;default:return m.urlEncoded}}class l{abortController=new AbortController;#V=(V)=>{};constructor(V,Z,I,J=new URLSearchParams,G=null,K=m.urlEncoded){let[$,T]=r1(E(I),Z,J,K);this.delegate=V,this.url=$,this.target=G,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:Z.toUpperCase(),headers:{...this.defaultHeaders},body:T,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=K}get method(){return this.fetchOptions.method}set method(V){let Z=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,I=z0(V)||Y.get;this.url.search="";let[J,G]=r1(this.url,I,Z,this.enctype);this.url=J,this.fetchOptions.body=G,this.fetchOptions.method=I.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(V){this.fetchOptions.headers=V}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(V){this.fetchOptions.body=V}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:V}=this;this.delegate.prepareRequest(this);let Z=await this.#Z(V);try{this.delegate.requestStarted(this),Z.detail.fetchRequest?this.response=Z.detail.fetchRequest.response:this.response=e0(this.url.href,V);let I=await this.response;return await this.receive(I)}catch(I){if(I.name!=="AbortError")throw this.#I(I)&&this.delegate.requestErrored(this,I),I}finally{this.delegate.requestFinished(this)}}async receive(V){let Z=new G0(V);return Q("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:Z},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,Z):Z.succeeded?this.delegate.requestSucceededWithResponse(this,Z):this.delegate.requestFailedWithResponse(this,Z),Z}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return w0(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(V){this.headers.Accept=[V,this.headers.Accept].join(", ")}async#Z(V){let Z=new Promise((J)=>this.#V=J),I=Q("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:V,url:this.url,resume:this.#V},target:this.target});return this.url=I.detail.url,I.defaultPrevented&&await Z,I}#I(V){return!Q("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:V}}).defaultPrevented}}function w0(V){return z0(V)==Y.get}function r1(V,Z,I,J){let G=Array.from(I).length>0?new URLSearchParams(M2(I)):V.searchParams;return w0(Z)?[u3(V,G),null]:J==m.urlEncoded?[V,G]:[V,I]}function M2(V){let Z=[];for(let[I,J]of V)J instanceof File||Z.push([I,J]);return Z}function u3(V,Z){let I=new URLSearchParams(M2(Z));return V.search=I.toString(),V}class q2{started=!1;constructor(V,Z){this.delegate=V,this.element=Z,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=(V)=>{V.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}}class v{static contentType="text/vnd.turbo-stream.html";static wrap(V){return typeof V=="string"?new this(function(Z){let I=document.createElement("template");return I.innerHTML=Z,I.content}(V)):V}constructor(V){this.fragment=function(Z){for(let I of Z.querySelectorAll("turbo-stream")){let J=document.importNode(I,!0);for(let G of J.templateElement.content.querySelectorAll("script"))G.replaceWith(J0(G));I.replaceWith(J)}return Z}(V)}}class V1{keys=[];entries={};#V;constructor(V,Z=d3){this.size=V,this.#V=Z}has(V){return this.#V(V)in this.entries}get(V){if(this.has(V)){let Z=this.read(V);return this.touch(V),Z}}put(V,Z){return this.write(V,Z),this.touch(V),Z}clear(){for(let V of Object.keys(this.entries))this.evict(V)}read(V){return this.entries[this.#V(V)]}write(V,Z){this.entries[this.#V(V)]=Z}touch(V){V=this.#V(V);let Z=this.keys.indexOf(V);Z>-1&&this.keys.splice(Z,1),this.keys.unshift(V),this.trim()}trim(){for(let V of this.keys.splice(this.size))this.evict(V)}evict(V){delete this.entries[V]}}class D0{state=o.initialized;static confirmMethod(V){return Promise.resolve(confirm(V))}constructor(V,Z,I,J=!1){let G=function(X,C){let O=C?.getAttribute("formmethod")||X.getAttribute("method")||"";return z0(O.toLowerCase())||Y.get}(Z,I),K=function(X,C){let O=E(X);return w0(C)&&(O.search=""),O}(function(X,C){let O=typeof X.action=="string"?X.action:null;return C?.hasAttribute("formaction")?C.getAttribute("formaction")||"":X.getAttribute("action")||O||""}(Z,I),G),$=function(X,C){let O=new FormData(X),H=C?.getAttribute("name"),S=C?.getAttribute("value");return H&&O.append(H,S||""),O}(Z,I),T=function(X,C){return L2(C?.getAttribute("formenctype")||X.enctype)}(Z,I);this.delegate=V,this.formElement=Z,this.submitter=I,this.fetchRequest=new l(this,G,K,$,Z,T),this.mustRedirect=J}get method(){return this.fetchRequest.method}set method(V){this.fetchRequest.method=V}get action(){return this.fetchRequest.url.toString()}set action(V){this.fetchRequest.url=E(V)}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:V,requesting:Z}=o,I=F0("data-turbo-confirm",this.submitter,this.formElement);if(typeof I=="string"){if(!await(typeof f.forms.confirm=="function"?f.forms.confirm:D0.confirmMethod)(I,this.formElement,this.submitter))return}if(this.state==V)return this.state=Z,this.fetchRequest.perform()}stop(){let{stopping:V,stopped:Z}=o;if(this.state!=V&&this.state!=Z)return this.state=V,this.fetchRequest.cancel(),!0}prepareRequest(V){if(!V.isSafe){let Z=function(I){if(I!=null){let J=(document.cookie?document.cookie.split("; "):[]).find((G)=>G.startsWith(I));if(J){let G=J.split("=").slice(1).join("=");return G?decodeURIComponent(G):void 0}}}(L0("csrf-param"))||L0("csrf-token");Z&&(V.headers["X-CSRF-Token"]=Z)}this.requestAcceptsTurboStreamResponse(V)&&V.acceptResponseType(v.contentType)}requestStarted(V){this.state=o.waiting,this.submitter&&f.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),j0(this.formElement),Q("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(V,Z){a.clear(),this.result={success:Z.succeeded,fetchResponse:Z}}requestSucceededWithResponse(V,Z){if(Z.clientError||Z.serverError)this.delegate.formSubmissionFailedWithResponse(this,Z);else if(a.clear(),this.requestMustRedirect(V)&&function(I){return I.statusCode==200&&!I.redirected}(Z)){let I=Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,I)}else this.state=o.receiving,this.result={success:!0,fetchResponse:Z},this.delegate.formSubmissionSucceededWithResponse(this,Z)}requestFailedWithResponse(V,Z){this.result={success:!1,fetchResponse:Z},this.delegate.formSubmissionFailedWithResponse(this,Z)}requestErrored(V,Z){this.result={success:!1,error:Z},this.delegate.formSubmissionErrored(this,Z)}requestFinished(V){this.state=o.stopped,this.submitter&&f.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),C0(this.formElement),Q("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 V=this.submitter;this.originalSubmitText=V.value,V.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(V){return!V.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(V){return!V.isSafe||function(Z,...I){return I.some((J)=>J&&J.hasAttribute(Z))}("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}}class K0{constructor(V){this.element=V}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(V){return this.getElementForAnchor(V)!=null}getElementForAnchor(V){return V?this.element.querySelector(`[id='${V}'], a[name='${V}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return H2(this.element)}get permanentElements(){return D2(this.element)}getPermanentElementById(V){return w2(this.element,V)}getPermanentElementMapForSnapshot(V){let Z={};for(let I of this.permanentElements){let{id:J}=I,G=V.getPermanentElementById(J);G&&(Z[J]=[I,G])}return Z}}function w2(V,Z){return V.querySelector(`#${Z}[data-turbo-permanent]`)}function D2(V){return V.querySelectorAll("[id][data-turbo-permanent]")}class Q0{started=!1;constructor(V,Z){this.delegate=V,this.eventTarget=Z}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=(V)=>{if(!V.defaultPrevented){let Z=V.target instanceof HTMLFormElement?V.target:void 0,I=V.submitter||void 0;Z&&function(J,G){return(G?.getAttribute("formmethod")||J.getAttribute("method"))!="dialog"}(Z,I)&&function(J,G){let K=G?.getAttribute("formtarget")||J.getAttribute("target");return A2(K)}(Z,I)&&this.delegate.willSubmitForm(Z,I)&&(V.preventDefault(),V.stopImmediatePropagation(),this.delegate.formSubmitted(Z,I))}}}class Z1{#V=(V)=>{};#Z=(V)=>{};constructor(V,Z){this.delegate=V,this.element=Z}scrollToAnchor(V){let Z=this.snapshot.getElementForAnchor(V);Z?(this.focusElement(Z),this.scrollToElement(Z)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(V){this.scrollToAnchor(Z0(V))}scrollToElement(V){V.scrollIntoView()}focusElement(V){V instanceof HTMLElement&&(V.hasAttribute("tabindex")?V.focus():(V.setAttribute("tabindex","-1"),V.focus(),V.removeAttribute("tabindex")))}scrollToPosition({x:V,y:Z}){this.scrollRoot.scrollTo(V,Z)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(V){let{isPreview:Z,shouldRender:I,willRender:J,newSnapshot:G}=V,K=J;if(I)try{this.renderPromise=new Promise((X)=>this.#V=X),this.renderer=V,await this.prepareToRenderSnapshot(V);let $=new Promise((X)=>this.#Z=X),T={resume:this.#Z,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(G,T)||await $,await this.renderSnapshot(V),this.delegate.viewRenderedSnapshot(G,Z,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(V)}finally{delete this.renderer,this.#V(void 0),delete this.renderPromise}else K&&this.invalidate(V.reloadReason)}invalidate(V){this.delegate.viewInvalidated(V)}async prepareToRenderSnapshot(V){this.markAsPreview(V.isPreview),await V.prepareToRender()}markAsPreview(V){V?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(V){this.element.setAttribute("data-turbo-visit-direction",V)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(V){await V.render()}finishRenderingSnapshot(V){V.finishRendering()}}class I1{constructor(V,Z){this.delegate=V,this.element=Z}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=(V)=>{this.clickEventIsSignificant(V)?this.clickEvent=V:delete this.clickEvent};linkClicked=(V)=>{this.clickEvent&&this.clickEventIsSignificant(V)&&this.delegate.shouldInterceptLinkClick(V.target,V.detail.url,V.detail.originalEvent)&&(this.clickEvent.preventDefault(),V.preventDefault(),this.delegate.linkClickIntercepted(V.target,V.detail.url,V.detail.originalEvent)),delete this.clickEvent};willVisit=(V)=>{delete this.clickEvent};clickEventIsSignificant(V){let Z=V.composed?V.target?.parentElement:V.target,I=O2(Z)||Z;return I instanceof Element&&I.closest("turbo-frame, html")==this.element}}class J1{started=!1;constructor(V,Z){this.delegate=V,this.eventTarget=Z}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=(V)=>{if(V instanceof MouseEvent&&this.clickEventIsSignificant(V)){let Z=O2(V.composedPath&&V.composedPath()[0]||V.target);if(Z&&A2(Z.target)){let I=U2(Z);this.delegate.willFollowLinkToLocation(Z,I,V)&&(V.preventDefault(),this.delegate.followedLinkToLocation(Z,I))}}};clickEventIsSignificant(V){return!(V.target&&V.target.isContentEditable||V.defaultPrevented||V.which>1||V.altKey||V.ctrlKey||V.metaKey||V.shiftKey)}}class G1{constructor(V,Z){this.delegate=V,this.linkInterceptor=new J1(this,Z)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(V,Z){return!1}prefetchAndCacheRequestToLocation(V,Z){}willFollowLinkToLocation(V,Z,I){return this.delegate.willSubmitFormLinkToLocation(V,Z,I)&&(V.hasAttribute("data-turbo-method")||V.hasAttribute("data-turbo-stream"))}followedLinkToLocation(V,Z){let I=document.createElement("form");for(let[X,C]of Z.searchParams)I.append(Object.assign(document.createElement("input"),{type:"hidden",name:X,value:C}));let J=Object.assign(Z,{search:""});I.setAttribute("data-turbo","true"),I.setAttribute("action",J.href),I.setAttribute("hidden","");let G=V.getAttribute("data-turbo-method");G&&I.setAttribute("method",G);let K=V.getAttribute("data-turbo-frame");K&&I.setAttribute("data-turbo-frame",K);let $=b(V);$&&I.setAttribute("data-turbo-action",$);let T=V.getAttribute("data-turbo-confirm");T&&I.setAttribute("data-turbo-confirm",T),V.hasAttribute("data-turbo-stream")&&I.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(V,Z,I),document.body.appendChild(I),I.addEventListener("turbo:submit-end",()=>I.remove(),{once:!0}),requestAnimationFrame(()=>I.requestSubmit())}}class K1{static async preservingPermanentElements(V,Z,I){let J=new this(V,Z);J.enter(),await I(),J.leave()}constructor(V,Z){this.delegate=V,this.permanentElementMap=Z}enter(){for(let V in this.permanentElementMap){let[Z,I]=this.permanentElementMap[V];this.delegate.enteringBardo(Z,I),this.replaceNewPermanentElementWithPlaceholder(I)}}leave(){for(let V in this.permanentElementMap){let[Z]=this.permanentElementMap[V];this.replaceCurrentPermanentElementWithClone(Z),this.replacePlaceholderWithPermanentElement(Z),this.delegate.leavingBardo(Z)}}replaceNewPermanentElementWithPlaceholder(V){let Z=function(I){let J=document.createElement("meta");return J.setAttribute("name","turbo-permanent-placeholder"),J.setAttribute("content",I.id),J}(V);V.replaceWith(Z)}replaceCurrentPermanentElementWithClone(V){let Z=V.cloneNode(!0);V.replaceWith(Z)}replacePlaceholderWithPermanentElement(V){this.getPlaceholderById(V.id)?.replaceWith(V)}getPlaceholderById(V){return this.placeholders.find((Z)=>Z.content==V)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class _0{#V=null;static renderElement(V,Z){}constructor(V,Z,I,J=!0){this.currentSnapshot=V,this.newSnapshot=Z,this.isPreview=I,this.willRender=J,this.renderElement=this.constructor.renderElement,this.promise=new Promise((G,K)=>this.resolvingFunctions={resolve:G,reject:K})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(V){await K1.preservingPermanentElements(this,this.permanentElementMap,V)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let V=this.connectedSnapshot.firstAutofocusableElement;V&&V.focus()}}enteringBardo(V){this.#V||V.contains(this.currentSnapshot.activeElement)&&(this.#V=this.currentSnapshot.activeElement)}leavingBardo(V){V.contains(this.#V)&&this.#V instanceof HTMLElement&&(this.#V.focus(),this.#V=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}}function B0(V,Z,{callbacks:I,...J}={}){b3.morph(V,Z,{...J,callbacks:new E2(I)})}function f0(V,Z,I={}){B0(V,Z.childNodes,{...I,morphStyle:"innerHTML"})}function _2(V,Z){return V instanceof N&&V.shouldReloadWithMorph&&(!Z||function(I,J){return J instanceof Element&&J.nodeName==="TURBO-FRAME"&&I.id===J.id&&(!J.getAttribute("src")||F2(I.src,J.getAttribute("src")))}(V,Z))&&!V.closest("[data-turbo-permanent]")}function f2(V){return V.parentElement.closest("turbo-frame[src][refresh=morph]")}class E2{#V;constructor({beforeNodeMorphed:V}={}){this.#V=V||(()=>!0)}beforeNodeAdded=(V)=>!(V.id&&V.hasAttribute("data-turbo-permanent")&&document.getElementById(V.id));beforeNodeMorphed=(V,Z)=>{if(V instanceof Element){if(!V.hasAttribute("data-turbo-permanent")&&this.#V(V,Z))return!Q("turbo:before-morph-element",{cancelable:!0,target:V,detail:{currentElement:V,newElement:Z}}).defaultPrevented;return!1}};beforeAttributeUpdated=(V,Z,I)=>!Q("turbo:before-morph-attribute",{cancelable:!0,target:Z,detail:{attributeName:V,mutationType:I}}).defaultPrevented;beforeNodeRemoved=(V)=>this.beforeNodeMorphed(V);afterNodeMorphed=(V,Z)=>{V instanceof Element&&Q("turbo:morph-element",{target:V,detail:{currentElement:V,newElement:Z}})}}class P{static animationDuration=300;static get defaultCSS(){return S2`
5
+ .turbo-progress-bar {
6
+ position: fixed;
7
+ display: block;
8
+ top: 0;
9
+ left: 0;
10
+ height: 3px;
11
+ background: #0076ff;
12
+ z-index: 2147483647;
13
+ transition:
14
+ width ${P.animationDuration}ms ease-out,
15
+ opacity ${P.animationDuration/2}ms ${P.animationDuration/2}ms ease-in;
16
+ transform: translate3d(0, 0, 0);
17
+ }
18
+ `}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(V){this.value=V,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(V){this.progressElement.style.opacity="0",setTimeout(V,1.5*P.animationDuration)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,P.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 V=document.createElement("style");V.type="text/css",V.textContent=P.defaultCSS;let Z=X2();return Z&&(V.nonce=Z),V}createProgressElement(){let V=document.createElement("div");return V.className="turbo-progress-bar",V}}function v3(V){return function(Z){return Z.localName=="script"}(V)?"script":function(Z){let I=Z.localName;return I=="style"||I=="link"&&Z.getAttribute("rel")=="stylesheet"}(V)?"stylesheet":void 0}function l3(V){return V.getAttribute("data-turbo-track")=="reload"}class R2{#V=!1;#Z=Promise.resolve();renderChange(V,Z){return V&&this.viewTransitionsAvailable&&!this.#V?(this.#V=!0,this.#Z=this.#Z.then(async()=>{await document.startViewTransition(Z).finished})):this.#Z=this.#Z.then(Z),this.#Z}get viewTransitionsAvailable(){return document.startViewTransition}}class Y2{identifier=u();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=s1;viewTransitioner=new R2;constructor(V,Z,I,J={}){this.delegate=V,this.location=Z,this.restorationIdentifier=I||u();let{action:G,historyChanged:K,referrer:$,snapshot:T,snapshotHTML:X,response:C,visitCachedSnapshot:O,willRender:H,updateHistory:S,shouldCacheSnapshot:j,acceptsStreamResponse:W,direction:U,refresh:F}={...o3,...J};this.action=G,this.historyChanged=K,this.referrer=$,this.snapshot=T,this.snapshotHTML=X,this.response=C,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=O,this.willRender=H,this.updateHistory=S,this.scrolled=!H,this.shouldCacheSnapshot=j,this.acceptsStreamResponse=W,this.direction=U||Z4[G],this.refresh=F}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)}start(){this.state==s1&&(this.recordTimingMetric(a3),this.state=A0,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==A0&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=s3)}complete(){this.state==A0&&(this.recordTimingMetric(r3),this.adapter.visitCompleted(this),this.state=e3,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==A0&&(this.state=t3,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let V=T2(this.location.href===this.referrer?.href?"replace":this.action);this.history.update(V,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new l(this,Y.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(i3),this.adapter.visitRequestStarted(this)}recordResponse(V=this.response){if(this.response=V,V){let{statusCode:Z}=V;t1(Z)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,Z)}}finishRequest(){this.recordTimingMetric(n3),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:V,responseHTML:Z}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,t1(V)&&Z!=null){let I=g.fromHTMLString(Z);await this.renderPageSnapshot(I,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(g.fromHTMLString(Z),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let V=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(V&&(!Z0(this.location)||V.hasAnchor(Z0(this.location)))&&(this.action=="restore"||V.isPreviewable))return V}getPreloadedSnapshot(){if(this.snapshotHTML)return g.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let V=this.getCachedSnapshot();if(V){let Z=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(V,Z),this.adapter.visitRendered(this),Z||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)}prepareRequest(V){this.acceptsStreamResponse&&V.acceptResponseType(v.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(V,Z){}async requestSucceededWithResponse(V,Z){let I=await Z.responseHTML,{redirected:J,statusCode:G}=Z;I==null?this.recordResponse({statusCode:l0,redirected:J}):(this.redirectedToLocation=Z.redirected?Z.location:void 0,this.recordResponse({statusCode:G,responseHTML:I,redirected:J}))}async requestFailedWithResponse(V,Z){let I=await Z.responseHTML,{redirected:J,statusCode:G}=Z;I==null?this.recordResponse({statusCode:l0,redirected:J}):this.recordResponse({statusCode:G,responseHTML:I,redirected:J})}requestErrored(V,Z){this.recordResponse({statusCode:N2,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||this.view.forceReloaded||this.view.shouldPreserveScrollPosition(this)||(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:V}=this.restorationData;if(V)return this.view.scrollToPosition(V),!0}scrollToAnchor(){let V=Z0(this.location);if(V!=null)return this.view.scrollToAnchor(V),!0}recordTimingMetric(V){this.timingMetrics[V]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then((V)=>V&&this.visitCachedSnapshot(V)),this.snapshotCached=!0)}async render(V){this.cancelRender(),await new Promise((Z)=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>Z(),0):requestAnimationFrame(()=>Z())}),await V(),delete this.frame}async renderPageSnapshot(V,Z){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(V),async()=>{await this.view.renderPage(V,Z,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function t1(V){return V>=200&&V<300}class k2{progressBar=new P;constructor(V){this.session=V}visitProposedToLocation(V,Z){p(V,this.navigator.rootLocation)?this.navigator.startVisit(V,Z?.restorationIdentifier||u(),Z):window.location.href=V.toString()}visitStarted(V){this.location=V.location,this.redirectedToLocation=null,V.loadCachedSnapshot(),V.issueRequest()}visitRequestStarted(V){this.progressBar.setValue(0),V.hasCachedSnapshot()||V.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(V){V.loadResponse(),V.response.redirected&&(this.redirectedToLocation=V.redirectedToLocation)}visitRequestFailedWithStatusCode(V,Z){switch(Z){case N2:case V4:case l0:return this.reload({reason:"request_failed",context:{statusCode:Z}});default:return V.loadResponse()}}visitRequestFinished(V){}visitCompleted(V){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(V){this.reload(V)}visitFailed(V){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(V){}linkPrefetchingIsEnabledForLocation(V){return!0}formSubmissionStarted(V){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(V){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(V){Q("turbo:reload",{detail:V}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}}class g2{selector="[data-turbo-temporary]";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=(V)=>{for(let Z of this.temporaryElements)Z.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}}class c2{constructor(V,Z){this.session=V,this.element=Z,this.linkInterceptor=new I1(this,Z),this.formSubmitObserver=new Q0(this,Z)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(V,Z,I){return this.#Z(V)}linkClickIntercepted(V,Z,I){let J=this.#I(V);J&&J.delegate.linkClickIntercepted(V,Z,I)}willSubmitForm(V,Z){return V.closest("turbo-frame")==null&&this.#V(V,Z)&&this.#Z(V,Z)}formSubmitted(V,Z){let I=this.#I(V,Z);I&&I.delegate.formSubmitted(V,Z)}#V(V,Z){let I=t0(V,Z),J=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),G=E(J?.content??"/");return this.#Z(V,Z)&&p(I,G)}#Z(V,Z){if(V instanceof HTMLFormElement?this.session.submissionIsNavigatable(V,Z):this.session.elementIsNavigatable(V)){let I=this.#I(V,Z);return!!I&&I!=V.closest("turbo-frame")}return!1}#I(V,Z){let I=Z?.getAttribute("data-turbo-frame")||V.getAttribute("data-turbo-frame");if(I&&I!="_top"){let J=this.element.querySelector(`#${I}:not([disabled])`);if(J instanceof N)return J}}}class h2{location;restorationIdentifier=u();restorationData={};started=!1;currentIndex=0;constructor(V){this.delegate=V}start(){this.started||(addEventListener("popstate",this.onPopState,!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),this.started=!1)}push(V,Z){this.update(history.pushState,V,Z)}replace(V,Z){this.update(history.replaceState,V,Z)}update(V,Z,I=u()){V===history.pushState&&++this.currentIndex;let J={turbo:{restorationIdentifier:I,restorationIndex:this.currentIndex}};V.call(history,J,"",Z.href),this.location=Z,this.restorationIdentifier=I}getRestorationDataForIdentifier(V){return this.restorationData[V]||{}}updateRestorationData(V){let{restorationIdentifier:Z}=this,I=this.restorationData[Z];this.restorationData[Z]={...I,...V}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=(V)=>{let{turbo:Z}=V.state||{};if(this.location=new URL(window.location.href),Z){let{restorationIdentifier:I,restorationIndex:J}=Z;this.restorationIdentifier=I;let G=J>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,I,G),this.currentIndex=J}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}}class x2{started=!1;#V=null;constructor(V,Z){this.delegate=V,this.eventTarget=Z}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#Z,{once:!0}):this.#Z())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#I,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#$,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#G,!0),this.started=!1)}#Z=()=>{this.eventTarget.addEventListener("mouseenter",this.#I,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#$,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#G,!0),this.started=!0};#I=(V)=>{if(L0("turbo-prefetch")==="false")return;let Z=V.target;if(Z.matches&&Z.matches("a[href]:not([target^=_]):not([download])")&&this.#W(Z)){let I=Z,J=U2(I);if(this.delegate.canPrefetchRequestToLocation(I,J)){this.#V=I;let G=new l(this,Y.get,J,new URLSearchParams,Z);G.fetchOptions.priority="low",a.putLater(J,G,this.#J)}}};#$=(V)=>{V.target===this.#V&&this.#B()};#B=()=>{a.clear(),this.#V=null};#G=(V)=>{if(V.target.tagName!=="FORM"&&V.detail.fetchOptions.method==="GET"){let Z=a.get(V.detail.url);Z&&(V.detail.fetchRequest=Z),a.clear()}};prepareRequest(V){let Z=V.target;V.headers["X-Sec-Purpose"]="prefetch";let I=Z.closest("turbo-frame"),J=Z.getAttribute("data-turbo-frame")||I?.getAttribute("target")||I?.id;J&&J!=="_top"&&(V.headers["Turbo-Frame"]=J)}requestSucceededWithResponse(){}requestStarted(V){}requestErrored(V){}requestFinished(V){}requestPreventedHandlingResponse(V,Z){}requestFailedWithResponse(V,Z){}get#J(){return Number(L0("turbo-prefetch-cache-time"))||z2}#W(V){return!!V.getAttribute("href")&&(!I4(V)&&(!J4(V)&&(!G4(V)&&(!K4(V)&&!B4(V)))))}}class P2{constructor(V){this.delegate=V}proposeVisit(V,Z={}){this.delegate.allowsVisitingLocationWithAction(V,Z.action)&&this.delegate.visitProposedToLocation(V,Z)}startVisit(V,Z,I={}){this.stop(),this.currentVisit=new Y2(this,E(V),Z,{referrer:this.location,...I}),this.currentVisit.start()}submitForm(V,Z){this.stop(),this.formSubmission=new D0(this,V,Z,!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(V){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(V)}async formSubmissionSucceededWithResponse(V,Z){if(V==this.formSubmission){let I=await Z.responseHTML;if(I){let J=V.isSafe;J||this.view.clearSnapshotCache();let{statusCode:G,redirected:K}=Z,$={action:this.#V(V,Z),shouldCacheSnapshot:J,response:{statusCode:G,responseHTML:I,redirected:K}};this.proposeVisit(Z.location,$)}}}async formSubmissionFailedWithResponse(V,Z){let I=await Z.responseHTML;if(I){let J=g.fromHTMLString(I);Z.serverError?await this.view.renderError(J,this.currentVisit):await this.view.renderPage(J,!1,!0,this.currentVisit),J.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(V,Z){console.error(Z)}formSubmissionFinished(V){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(V)}linkPrefetchingIsEnabledForLocation(V){return typeof this.adapter.linkPrefetchingIsEnabledForLocation!="function"||this.adapter.linkPrefetchingIsEnabledForLocation(V)}visitStarted(V){this.delegate.visitStarted(V)}visitCompleted(V){this.delegate.visitCompleted(V),delete this.currentVisit}locationWithActionIsSamePage(V,Z){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#V(V,Z){let{submitter:I,formElement:J}=V;return b(I,J)||this.#Z(Z)}#Z(V){return V.redirected&&V.location.href===this.location?.href?"replace":"advance"}}class p2{stage=e1;started=!1;constructor(V){this.delegate=V}start(){this.started||(this.stage==e1&&(this.stage=V2),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:V}=this;V=="interactive"?this.pageIsInteractive():V=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==V2&&(this.stage=Z2,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Z2&&(this.stage=W4,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}}class m2{started=!1;constructor(V){this.delegate=V}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(V){this.delegate.scrollPositionChanged(V)}}class u2{render({fragment:V}){K1.preservingPermanentElements(this,function(Z){let I=D2(document.documentElement),J={};for(let G of I){let{id:K}=G;for(let $ of Z.querySelectorAll("turbo-stream")){let T=w2($.templateElement.content,K);T&&(J[K]=[G,T])}}return J}(V),()=>{(async function(Z,I){let J=`turbo-stream-autofocus-${u()}`,G=Z.querySelectorAll("turbo-stream"),K=function(T){for(let X of T){let C=H2(X.templateElement.content);if(C)return C}return null}(G),$=null;if(K&&($=K.id?K.id:J,K.id=$),I(),await V0(),(document.activeElement==null||document.activeElement==document.body)&&$){let T=document.getElementById($);v0(T)&&T.focus(),T&&T.id==J&&T.removeAttribute("id")}})(V,()=>{(async function(Z){let[I,J]=await async function(K,$){let T=$();return K(),await $2(),[T,$()]}(Z,()=>document.activeElement),G=I&&I.id;if(G){let K=document.getElementById(G);v0(K)&&K!=J&&K.focus()}})(()=>{document.documentElement.appendChild(V)})})})}enteringBardo(V,Z){Z.replaceWith(V.cloneNode(!0))}leavingBardo(){}}class d2{sources=new Set;#V=!1;constructor(V){this.delegate=V}start(){this.#V||(this.#V=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#V&&(this.#V=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(V){this.streamSourceIsConnected(V)||(this.sources.add(V),V.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(V){this.streamSourceIsConnected(V)&&(this.sources.delete(V),V.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(V){return this.sources.has(V)}inspectFetchResponse=(V)=>{let Z=function(I){let J=I.detail?.fetchResponse;if(J instanceof G0)return J}(V);Z&&function(I){return(I.contentType??"").startsWith(v.contentType)}(Z)&&(V.preventDefault(),this.receiveMessageResponse(Z))};receiveMessageEvent=(V)=>{this.#V&&typeof V.data=="string"&&this.receiveMessageHTML(V.data)};async receiveMessageResponse(V){let Z=await V.responseHTML;Z&&this.receiveMessageHTML(Z)}receiveMessageHTML(V){this.delegate.receivedMessageFromStream(v.wrap(V))}}class o2{selector="a[data-turbo-preload]";constructor(V,Z){this.delegate=V,this.snapshotCache=Z}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#V):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#V)}preloadOnLoadLinksForView(V){for(let Z of V.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(Z)&&this.preloadURL(Z)}async preloadURL(V){let Z=new URL(V.href);if(this.snapshotCache.has(Z))return;await new l(this,Y.get,Z,new URLSearchParams,V).perform()}prepareRequest(V){V.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(V,Z){try{let I=await Z.responseHTML,J=g.fromHTMLString(I);this.snapshotCache.put(V.url,J)}catch(I){}}requestStarted(V){}requestErrored(V){}requestFinished(V){}requestPreventedHandlingResponse(V,Z){}requestFailedWithResponse(V,Z){}#V=()=>{this.preloadOnLoadLinksForView(document.body)}}class a2{constructor(V){this.session=V}clear(){this.session.clearCache()}resetCacheControl(){this.#V("")}exemptPageFromCache(){this.#V("no-cache")}exemptPageFromPreview(){this.#V("no-preview")}#V(V){(function(Z,I){let J=s0(Z);J||(J=document.createElement("meta"),J.setAttribute("name",Z),document.head.appendChild(J)),J.setAttribute("content",I)})("turbo-cache-control",V)}}function I2(V){Object.defineProperties(V,S4)}function W1(){_.start()}function r2(V){_.registerAdapter(V)}function s2(V,Z){_.visit(V,Z)}function E0(V){_.connectStreamSource(V)}function y0(V){_.disconnectStreamSource(V)}function t2(V){_.renderStreamMessage(V)}function e2(V){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),f.drive.progressBarDelay=V}function V3(V){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),f.forms.confirm=V}function Z3(V){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),f.forms.mode=V}function I3(V,Z){B1.renderElement(V,Z)}function J3(V,Z){$1.renderElement(V,Z)}function J2(V,Z){if(V){let I=V.getAttribute("src");if(I!=null&&Z!=null&&F2(I,Z))throw Error(`Matching <turbo-frame id="${V.id}"> element has a source URL which references itself`);if(V.ownerDocument!==document&&(V=document.importNode(V,!0)),V instanceof N)return V.connectedCallback(),V.disconnectedCallback(),V}}async function B3(){return $3||o0(W3().then(o0))}function o0(V){return $3=V}async function W3(){let{createConsumer:V}=await Promise.resolve().then(function(){return A4});return V()}async function S3(V,Z){let{subscriptions:I}=await B3();return I.create(V,Z)}function a0(V){return V&&typeof V=="object"?V instanceof Date||V instanceof RegExp?V:Array.isArray(V)?V.map(a0):Object.keys(V).reduce(function(Z,I){return Z[I[0].toLowerCase()+I.slice(1).replace(/([A-Z]+)/g,function(J,G){return"_"+G.toLowerCase()})]=a0(V[I]),Z},{}):V}class M0{constructor(V){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=V,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=e(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),D.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=e(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),D.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=e()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,D.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=e(),D.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:V,reconnectionBackoffRate:Z}=this.constructor;return 1000*V*Math.pow(1+Z,Math.min(this.reconnectAttempts,10))*(1+(this.reconnectAttempts===0?1:Z)*Math.random())}reconnectIfStale(){this.connectionIsStale()&&(D.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${O0(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?D.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${O0(this.disconnectedAt)} s`):(D.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return O0(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&O0(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{!this.connectionIsStale()&&this.connection.isOpen()||(D.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}}class q0{constructor(V){this.open=this.open.bind(this),this.consumer=V,this.subscriptions=this.consumer.subscriptions,this.monitor=new X3(this),this.disconnected=!0}send(V){return!!this.isOpen()&&(this.webSocket.send(JSON.stringify(V)),!0)}open(){if(this.isActive())return D.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let V=[...n0,...this.consumer.subprotocols||[]];return D.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${V}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new I0.WebSocket(this.consumer.url,V),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:V}={allowReconnect:!0}){if(V||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(D.log(`Reopening WebSocket, current state is ${this.getState()}`),!this.isActive())return this.open();try{return this.close()}catch(V){D.log("Failed to reopen WebSocket",V)}finally{D.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return G2.call(H4,this.getProtocol())>=0}isState(...V){return G2.call(V,this.getState())>=0}getState(){if(this.webSocket){for(let V in I0.WebSocket)if(I0.WebSocket[V]===this.webSocket.readyState)return V.toLowerCase()}return null}installEventHandlers(){for(let V in this.events){let Z=this.events[V].bind(this);this.webSocket[`on${V}`]=Z}}uninstallEventHandlers(){for(let V in this.events)this.webSocket[`on${V}`]=function(){}}}class X1{constructor(V,Z={},I){this.consumer=V,this.identifier=JSON.stringify(Z),function(J,G){if(G!=null)for(let K in G){let $=G[K];J[K]=$}}(this,I)}perform(V,Z={}){return Z.action=V,this.send(Z)}send(V){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(V)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}class H1{constructor(V){this.consumer=V,this.guarantor=new A3(this),this.subscriptions=[]}create(V,Z){let I=typeof V=="object"?V:{channel:V},J=new X1(this.consumer,I,Z);return this.add(J)}add(V){return this.subscriptions.push(V),this.consumer.ensureActiveConnection(),this.notify(V,"initialized"),this.subscribe(V),V}remove(V){return this.forget(V),this.findAll(V.identifier).length||this.sendCommand(V,"unsubscribe"),V}reject(V){return this.findAll(V).map((Z)=>(this.forget(Z),this.notify(Z,"rejected"),Z))}forget(V){return this.guarantor.forget(V),this.subscriptions=this.subscriptions.filter((Z)=>Z!==V),V}findAll(V){return this.subscriptions.filter((Z)=>Z.identifier===V)}reload(){return this.subscriptions.map((V)=>this.subscribe(V))}notifyAll(V,...Z){return this.subscriptions.map((I)=>this.notify(I,V,...Z))}notify(V,Z,...I){let J;return J=typeof V=="string"?this.findAll(V):[V],J.map((G)=>typeof G[Z]=="function"?G[Z](...I):void 0)}subscribe(V){this.sendCommand(V,"subscribe")&&this.guarantor.guarantee(V)}confirmSubscription(V){D.log(`Subscription confirmed ${V}`),this.findAll(V).map((Z)=>this.guarantor.forget(Z))}sendCommand(V,Z){let{identifier:I}=V;return this.consumer.send({command:Z,identifier:I})}}class r0{constructor(V){this._url=V,this.subscriptions=new H1(this),this.connection=new H3(this),this.subprotocols=[]}get url(){return O3(this._url)}send(V){return this.connection.send(V)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(V){this.subprotocols=[...this.subprotocols,V]}}function O3(V){if(typeof V=="function"&&(V=V()),V&&!/^wss?:/i.test(V)){let Z=document.createElement("a");return Z.href=V,Z.href=Z.href,Z.protocol=Z.protocol.replace("http","ws"),Z.href}return V}function K2(V){let Z=document.head.querySelector(`meta[name='action-cable-${V}']`);if(Z)return Z.getAttribute("content")}var d,N,h3,P3,p3,f,j2,C2,Y,m,d3=(V)=>V,z2=1e4,a,o,Q2,$0,b3,$1,y2,g,o3,a3="visitStart",i3="requestStart",n3="requestEnd",r3="visitEnd",s1="initialized",A0="started",s3="canceled",t3="failed",e3="completed",N2=0,V4=-1,l0=-2,Z4,I4=(V)=>V.origin!==document.location.origin||!["http:","https:"].includes(V.protocol)||V.hasAttribute("target"),J4=(V)=>V.pathname+V.search===document.location.pathname+document.location.search||V.href.startsWith("#"),G4=(V)=>{if(V.getAttribute("data-turbo-prefetch")==="false")return!0;if(V.getAttribute("data-turbo")==="false")return!0;let Z=i(V,"[data-turbo-prefetch]");return!(!Z||Z.getAttribute("data-turbo-prefetch")!=="false")},K4=(V)=>{let Z=V.getAttribute("data-turbo-method");return!(!Z||Z.toLowerCase()==="get")||(!!$4(V)||(!!V.hasAttribute("data-turbo-confirm")||!!V.hasAttribute("data-turbo-stream")))},$4=(V)=>V.hasAttribute("data-remote")||V.hasAttribute("data-behavior")||V.hasAttribute("data-confirm")||V.hasAttribute("data-method"),B4=(V)=>Q("turbo:before-prefetch",{target:V,cancelable:!0}).defaultPrevented,e1=0,V2=1,Z2=2,W4=3,b2,W0,B1,v2,l2,S4,_,i2,n2,T4,G3,S1,R0,T1,K3,$3,X4,T3,I0,D,e=()=>new Date().getTime(),O0=(V)=>(e()-V)/1000,X3,i0,t,n0,H4,G2,H3,A3=class{constructor(V){this.subscriptions=V,this.pendingSubscriptions=[]}guarantee(V){this.pendingSubscriptions.indexOf(V)==-1?(D.log(`SubscriptionGuarantor guaranteeing ${V.identifier}`),this.pendingSubscriptions.push(V)):D.log(`SubscriptionGuarantor already guaranteeing ${V.identifier}`),this.startGuaranteeing()}forget(V){D.log(`SubscriptionGuarantor forgetting ${V.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter((Z)=>Z!==V)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map((V)=>{D.log(`SubscriptionGuarantor resubscribing ${V.identifier}`),this.subscriptions.subscribe(V)})},500)}},A4;var F3=z3(()=>{/*!
19
+ Turbo 8.0.23
20
+ Copyright © 2026 37signals LLC
21
+ */d={eager:"eager",lazy:"lazy"};N=class N extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new N.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(V){V=="loading"?this.delegate.loadingStyleChanged():V=="src"?this.delegate.sourceURLChanged():V=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(V){V?this.setAttribute("src",V):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(V){V?this.setAttribute("refresh",V):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return function(V){if(V.toLowerCase()==="lazy")return d.lazy;return d.eager}(this.getAttribute("loading")||"")}set loading(V){V?this.setAttribute("loading",V):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(V){V?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(V){V?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")}};h3={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"])};P3={"aria-disabled":{beforeSubmit:(V)=>{V.setAttribute("aria-disabled","true"),V.addEventListener("click",i1)},afterSubmit:(V)=>{V.removeAttribute("aria-disabled"),V.removeEventListener("click",i1)}},disabled:{beforeSubmit:(V)=>V.disabled=!0,afterSubmit:(V)=>V.disabled=!1}},p3=new class{#V=null;constructor(V){Object.assign(this,V)}get submitter(){return this.#V}set submitter(V){this.#V=P3[V]||V}}({mode:"on",submitter:"disabled"}),f={drive:h3,forms:p3};j2=class j2 extends Set{constructor(V){super(),this.maxSize=V}add(V){if(this.size>=this.maxSize){let Z=this.values().next().value;this.delete(Z)}super.add(V)}};C2=new j2(20);Y={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};m={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};a=new class extends V1{#V=null;#Z={};constructor(V=1,Z=100){super(V,U0),this.prefetchDelay=Z}putLater(V,Z,I){this.#V=setTimeout(()=>{Z.perform(),this.put(V,Z,I),this.#V=null},this.prefetchDelay)}put(V,Z,I=z2){super.put(V,Z),this.#Z[U0(V)]=new Date(new Date().getTime()+I)}clear(){super.clear(),this.#V&&clearTimeout(this.#V)}evict(V){super.evict(V),delete this.#Z[V]}has(V){if(super.has(V)){let Z=this.#Z[U0(V)];return Z&&Z>Date.now()}return!1}},o={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};Q2=class Q2 extends Z1{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new K0(this.element)}};$0=class $0 extends _0{static renderElement(V,Z){let I=document.createRange();I.selectNodeContents(V),I.deleteContents();let J=Z,G=J.ownerDocument?.createRange();G&&(G.selectNodeContents(J),V.appendChild(G.extractContents()))}constructor(V,Z,I,J,G,K=!0){super(Z,I,J,G,K),this.delegate=V}get shouldRender(){return!0}async render(){await V0(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await V0(),this.focusFirstAutofocusableElement(),await V0(),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 I=this.currentElement.firstElementChild,J=(V=this.currentElement.getAttribute("data-autoscroll-block"),Z="end",V=="end"||V=="start"||V=="center"||V=="nearest"?V:Z),G=function(K,$){return K=="auto"||K=="smooth"?K:$}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(I)return I.scrollIntoView({block:J,behavior:G}),!0}var V,Z;return!1}activateScriptElements(){for(let V of this.newScriptElements){let Z=J0(V);V.replaceWith(Z)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};b3=function(){let V=()=>{},Z={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:V,afterNodeAdded:V,beforeNodeMorphed:V,afterNodeMorphed:V,beforeNodeRemoved:V,afterNodeRemoved:V,beforeAttributeUpdated:V},head:{style:"merge",shouldPreserve:(X)=>X.getAttribute("im-preserve")==="true",shouldReAppend:(X)=>X.getAttribute("im-re-append")==="true",shouldRemove:V,afterHeadMorphed:V},restoreFocus:!0},I=function(){function X(W,U,F,B){if(B.callbacks.beforeNodeAdded(U)===!1)return null;if(B.idMap.has(U)){let A=document.createElement(U.tagName);return W.insertBefore(A,F),J(A,U,B),B.callbacks.afterNodeAdded(A),A}{let A=document.importNode(U,!0);return W.insertBefore(A,F),B.callbacks.afterNodeAdded(A),A}}let C=function(){function W(F,B,A){let L=F.idMap.get(B),q=F.idMap.get(A);if(!q||!L)return!1;for(let w of L)if(q.has(w))return!0;return!1}function U(F,B){let A=F,L=B;return A.nodeType===L.nodeType&&A.tagName===L.tagName&&(!A.getAttribute?.("id")||A.getAttribute?.("id")===L.getAttribute?.("id"))}return function(F,B,A,L){let q=null,w=B.nextSibling,M=0,z=A;for(;z&&z!=L;){if(U(z,B)){if(W(F,z,B))return z;q===null&&(F.idMap.has(z)||(q=z))}if(q===null&&w&&U(z,w)&&(M++,w=w.nextSibling,M>=2&&(q=void 0)),F.activeElementAndParents.includes(z))break;z=z.nextSibling}return q||null}}();function O(W,U){if(W.idMap.has(U))j(W.pantry,U,null);else{if(W.callbacks.beforeNodeRemoved(U)===!1)return;U.parentNode?.removeChild(U),W.callbacks.afterNodeRemoved(U)}}function H(W,U,F){let B=U;for(;B&&B!==F;){let A=B;B=B.nextSibling,O(W,A)}return B}function S(W,U,F,B){let A=B.target.getAttribute?.("id")===U&&B.target||B.target.querySelector(`[id="${U}"]`)||B.pantry.querySelector(`[id="${U}"]`);return function(L,q){let w=L.getAttribute("id");for(;L=L.parentNode;){let M=q.idMap.get(L);M&&(M.delete(w),M.size||q.idMap.delete(L))}}(A,B),j(W,A,F),A}function j(W,U,F){if(W.moveBefore)try{W.moveBefore(U,F)}catch(B){W.insertBefore(U,F)}else W.insertBefore(U,F)}return function(W,U,F,B=null,A=null){U instanceof HTMLTemplateElement&&F instanceof HTMLTemplateElement&&(U=U.content,F=F.content),B||=U.firstChild;for(let L of F.childNodes){if(B&&B!=A){let w=C(W,L,B,A);if(w){w!==B&&H(W,B,w),J(w,L,W),B=w.nextSibling;continue}}if(L instanceof Element){let w=L.getAttribute("id");if(W.persistentIds.has(w)){let M=S(U,w,B,W);J(M,L,W),B=M.nextSibling;continue}}let q=X(U,L,B,W);q&&(B=q.nextSibling)}for(;B&&B!=A;){let L=B;B=B.nextSibling,O(W,L)}}}(),J=function(){function X(H,S,j,W){let U=S[j];if(U!==H[j]){let F=C(j,H,"update",W);F||(H[j]=S[j]),U?F||H.setAttribute(j,""):C(j,H,"remove",W)||H.removeAttribute(j)}}function C(H,S,j,W){return!(H!=="value"||!W.ignoreActiveValue||S!==document.activeElement)||W.callbacks.beforeAttributeUpdated(H,S,j)===!1}function O(H,S){return!!S.ignoreActiveValue&&H===document.activeElement&&H!==document.body}return function(H,S,j){return j.ignoreActive&&H===document.activeElement?null:(j.callbacks.beforeNodeMorphed(H,S)===!1||(H instanceof HTMLHeadElement&&j.head.ignore||(H instanceof HTMLHeadElement&&j.head.style!=="morph"?G(H,S,j):(function(W,U,F){let B=U.nodeType;if(B===1){let A=W,L=U,q=A.attributes,w=L.attributes;for(let M of w)C(M.name,A,"update",F)||A.getAttribute(M.name)!==M.value&&A.setAttribute(M.name,M.value);for(let M=q.length-1;0<=M;M--){let z=q[M];if(z&&!L.hasAttribute(z.name)){if(C(z.name,A,"remove",F))continue;A.removeAttribute(z.name)}}O(A,F)||function(M,z,k){if(M instanceof HTMLInputElement&&z instanceof HTMLInputElement&&z.type!=="file"){let y=z.value,h=M.value;X(M,z,"checked",k),X(M,z,"disabled",k),z.hasAttribute("value")?h!==y&&(C("value",M,"update",k)||(M.setAttribute("value",y),M.value=y)):C("value",M,"remove",k)||(M.value="",M.removeAttribute("value"))}else if(M instanceof HTMLOptionElement&&z instanceof HTMLOptionElement)X(M,z,"selected",k);else if(M instanceof HTMLTextAreaElement&&z instanceof HTMLTextAreaElement){let y=z.value,h=M.value;if(C("value",M,"update",k))return;y!==h&&(M.value=y),M.firstChild&&M.firstChild.nodeValue!==y&&(M.firstChild.nodeValue=y)}}(A,L,F)}B!==8&&B!==3||W.nodeValue!==U.nodeValue&&(W.nodeValue=U.nodeValue)}(H,S,j),O(H,j)||I(j,H,S))),j.callbacks.afterNodeMorphed(H,S)),H)}}();function G(X,C,O){let H=[],S=[],j=[],W=[],U=new Map;for(let B of C.children)U.set(B.outerHTML,B);for(let B of X.children){let A=U.has(B.outerHTML),L=O.head.shouldReAppend(B),q=O.head.shouldPreserve(B);A||q?L?S.push(B):(U.delete(B.outerHTML),j.push(B)):O.head.style==="append"?L&&(S.push(B),W.push(B)):O.head.shouldRemove(B)!==!1&&S.push(B)}W.push(...U.values());let F=[];for(let B of W){let A=document.createRange().createContextualFragment(B.outerHTML).firstChild;if(O.callbacks.beforeNodeAdded(A)!==!1){if("href"in A&&A.href||"src"in A&&A.src){let L,q=new Promise(function(w){L=w});A.addEventListener("load",function(){L()}),F.push(q)}X.appendChild(A),O.callbacks.afterNodeAdded(A),H.push(A)}}for(let B of S)O.callbacks.beforeNodeRemoved(B)!==!1&&(X.removeChild(B),O.callbacks.afterNodeRemoved(B));return O.head.afterHeadMorphed(X,{added:H,kept:j,removed:S}),F}let K=function(){function X(){let S=document.createElement("div");return S.hidden=!0,document.body.insertAdjacentElement("afterend",S),S}function C(S){let j=[],W=document.activeElement;if(W?.tagName!=="BODY"&&S.contains(W))for(;W&&(j.push(W),W!==S);)W=W.parentElement;return j}function O(S){let j=Array.from(S.querySelectorAll("[id]"));return S.getAttribute?.("id")&&j.push(S),j}function H(S,j,W,U){for(let F of U){let B=F.getAttribute("id");if(j.has(B)){let A=F;for(;A;){let L=S.get(A);if(L==null&&(L=new Set,S.set(A,L)),L.add(B),A===W)break;A=A.parentElement}}}}return function(S,j,W){let{persistentIds:U,idMap:F}=function(L,q){let w=O(L),M=O(q),z=function(h,j3){let N0=new Set,Y0=new Map;for(let{id:c,tagName:k0}of h)Y0.has(c)?N0.add(c):Y0.set(c,k0);let T0=new Set;for(let{id:c,tagName:k0}of j3)T0.has(c)?N0.add(c):Y0.get(c)===k0&&T0.add(c);for(let c of N0)T0.delete(c);return T0}(w,M),k=new Map;H(k,z,L,w);let y=q.__idiomorphRoot||q;return H(k,z,y,M),{persistentIds:z,idMap:k}}(S,j),B=function(L){let q=Object.assign({},Z);return Object.assign(q,L),q.callbacks=Object.assign({},Z.callbacks,L.callbacks),q.head=Object.assign({},Z.head,L.head),q}(W),A=B.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(A))throw`Do not understand how to morph style ${A}`;return{target:S,newContent:j,config:B,morphStyle:A,ignoreActive:B.ignoreActive,ignoreActiveValue:B.ignoreActiveValue,restoreFocus:B.restoreFocus,idMap:F,persistentIds:U,pantry:X(),activeElementAndParents:C(S),callbacks:B.callbacks,head:B.head}}}(),{normalizeElement:$,normalizeParent:T}=function(){let X=new WeakSet;class C{constructor(O){this.originalNode=O,this.realParentNode=O.parentNode,this.previousSibling=O.previousSibling,this.nextSibling=O.nextSibling}get childNodes(){let O=[],H=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;H&&H!=this.nextSibling;)O.push(H),H=H.nextSibling;return O}querySelectorAll(O){return this.childNodes.reduce((H,S)=>{if(S instanceof Element){S.matches(O)&&H.push(S);let j=S.querySelectorAll(O);for(let W=0;W<j.length;W++)H.push(j[W])}return H},[])}insertBefore(O,H){return this.realParentNode.insertBefore(O,H)}moveBefore(O,H){return this.realParentNode.moveBefore(O,H)}get __idiomorphRoot(){return this.originalNode}}return{normalizeElement:function(O){return O instanceof Document?O.documentElement:O},normalizeParent:function O(H){if(H==null)return document.createElement("div");if(typeof H=="string")return O(function(S){let j=new DOMParser,W=S.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(W.match(/<\/html>/)||W.match(/<\/head>/)||W.match(/<\/body>/)){let U=j.parseFromString(S,"text/html");if(W.match(/<\/html>/))return X.add(U),U;{let F=U.firstChild;return F&&X.add(F),F}}{let U=j.parseFromString("<body><template>"+S+"</template></body>","text/html").body.querySelector("template").content;return X.add(U),U}}(H));if(X.has(H))return H;if(H instanceof Node){if(H.parentNode)return new C(H);{let S=document.createElement("div");return S.append(H),S}}{let S=document.createElement("div");for(let j of[...H])S.append(j);return S}}}}();return{morph:function(X,C,O={}){X=$(X);let H=T(C),S=K(X,H,O),j=function(W,U){if(!W.config.restoreFocus)return U();let F=document.activeElement;if(!(F instanceof HTMLInputElement||F instanceof HTMLTextAreaElement))return U();let{id:B,selectionStart:A,selectionEnd:L}=F,q=U();return B&&B!==document.activeElement?.getAttribute("id")&&(F=W.target.querySelector(`[id="${B}"]`),F?.focus()),F&&!F.selectionEnd&&L&&F.setSelectionRange(A,L),q}(S,()=>function(W,U,F,B){if(W.head.block){let A=U.querySelector("head"),L=F.querySelector("head");if(A&&L){let q=G(A,L,W);return Promise.all(q).then(()=>{let w=Object.assign(W,{head:{block:!1,ignore:!0}});return B(w)})}}return B(W)}(S,X,H,(W)=>W.morphStyle==="innerHTML"?(I(W,X,H),Array.from(X.childNodes)):function(U,F,B){let A=T(F);return I(U,A,B,F,F.nextSibling),Array.from(A.childNodes)}(W,X,H)));return S.pantry.remove(),j},defaults:Z}}();$1=class $1 extends $0{static renderElement(V,Z){Q("turbo:before-frame-morph",{target:V,detail:{currentElement:V,newElement:Z}}),f0(V,Z,{callbacks:{beforeNodeMorphed:(I,J)=>!_2(I,J)||f2(I)!==V||(I.reload(),!1)}})}async preservingPermanentElements(V){return await V()}};y2=class y2 extends K0{detailsByOuterHTML=this.children.filter((V)=>!function(Z){return Z.localName=="noscript"}(V)).map((V)=>function(Z){return Z.hasAttribute("nonce")&&Z.setAttribute("nonce",""),Z}(V)).reduce((V,Z)=>{let{outerHTML:I}=Z,J=I in V?V[I]:{type:v3(Z),tracked:l3(Z),elements:[]};return{...V,[I]:{...J,elements:[...J.elements,Z]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter((V)=>this.detailsByOuterHTML[V].tracked).join("")}getScriptElementsNotInSnapshot(V){return this.getElementsMatchingTypeNotInSnapshot("script",V)}getStylesheetElementsNotInSnapshot(V){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",V)}getElementsMatchingTypeNotInSnapshot(V,Z){return Object.keys(this.detailsByOuterHTML).filter((I)=>!(I in Z.detailsByOuterHTML)).map((I)=>this.detailsByOuterHTML[I]).filter(({type:I})=>I==V).map(({elements:[I]})=>I)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((V,Z)=>{let{type:I,tracked:J,elements:G}=this.detailsByOuterHTML[Z];return I!=null||J?G.length>1?[...V,...G.slice(1)]:V:[...V,...G]},[])}getMetaValue(V){let Z=this.findMetaElementByName(V);return Z?Z.getAttribute("content"):null}findMetaElementByName(V){return Object.keys(this.detailsByOuterHTML).reduce((Z,I)=>{let{elements:[J]}=this.detailsByOuterHTML[I];return function(G,K){return G.localName=="meta"&&G.getAttribute("name")==K}(J,V)?J:Z},0)}};g=class g extends K0{static fromHTMLString(V=""){return this.fromDocument(W2(V))}static fromElement(V){return this.fromDocument(V.ownerDocument)}static fromDocument({documentElement:V,body:Z,head:I}){return new this(V,Z,new y2(I))}constructor(V,Z,I){super(Z),this.documentElement=V,this.headSnapshot=I}clone(){let V=this.element.cloneNode(!0),Z=this.element.querySelectorAll("select"),I=V.querySelectorAll("select");for(let[J,G]of Z.entries()){let K=I[J];for(let $ of K.selectedOptions)$.selected=!1;for(let $ of G.selectedOptions)K.options[$.index].selected=!0}for(let J of V.querySelectorAll('input[type="password"]'))J.value="";for(let J of V.querySelectorAll("noscript"))J.remove();return new g(this.documentElement,V,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){return E(this.getSetting("root")??"/")}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(V){return this.headSnapshot.getMetaValue(`turbo-${V}`)}};o3={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},Z4={advance:"forward",restore:"back",replace:"none"};b2=class b2 extends _0{static renderElement(V,Z){let{documentElement:I,body:J}=document;I.replaceChild(Z,J)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:V,head:Z}=document;V.replaceChild(this.newHead,Z),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let V of this.scriptElements){let Z=V.parentNode;if(Z){let I=J0(V);Z.replaceChild(I,V)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}};W0=class W0 extends _0{static renderElement(V,Z){document.body&&Z instanceof HTMLBodyElement?document.body.replaceWith(Z):document.documentElement.appendChild(Z)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){return this.newSnapshot.isVisitable?this.trackedElementsAreIdentical?void 0:{reason:"tracked_element_mismatch"}:{reason:"turbo_visit_control_is_reload"}}async prepareToRender(){this.#V(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#V(){let{documentElement:V}=this.currentSnapshot,{dir:Z,lang:I}=this.newSnapshot;I?V.setAttribute("lang",I):V.removeAttribute("lang"),Z?V.setAttribute("dir",Z):V.removeAttribute("dir")}async mergeHead(){let V=this.mergeProvisionalElements(),Z=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await V,await Z,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let V=[];for(let Z of this.newHeadStylesheetElements)V.push(x3(Z)),document.head.appendChild(Z);await Promise.all(V)}copyNewHeadScriptElements(){for(let V of this.newHeadScriptElements)document.head.appendChild(J0(V))}removeUnusedDynamicStylesheetElements(){for(let V of this.unusedDynamicStylesheetElements)document.head.removeChild(V)}async mergeProvisionalElements(){let V=[...this.newHeadProvisionalElements];for(let Z of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(Z,V)||document.head.removeChild(Z);for(let Z of V)document.head.appendChild(Z)}isCurrentElementInElementList(V,Z){for(let[I,J]of Z.entries()){if(V.tagName=="TITLE"){if(J.tagName!="TITLE")continue;if(V.innerHTML==J.innerHTML)return Z.splice(I,1),!0}if(J.isEqualNode(V))return Z.splice(I,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let V of this.currentHeadProvisionalElements)document.head.removeChild(V)}copyNewHeadProvisionalElements(){for(let V of this.newHeadProvisionalElements)document.head.appendChild(V)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let V of this.newElement.querySelectorAll("noscript"))V.remove()}activateNewBodyScriptElements(){for(let V of this.newBodyScriptElements){let Z=J0(V);V.replaceWith(Z)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter((V)=>V.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}};B1=class B1 extends W0{static renderElement(V,Z){B0(V,Z,{callbacks:{beforeNodeMorphed:(I,J)=>!(_2(I,J)&&!f2(I))||(I.reload(),!1)}}),Q("turbo:morph",{detail:{currentElement:V,newElement:Z}})}async preservingPermanentElements(V){return await V()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}};v2=class v2 extends V1{constructor(V){super(V,U0)}get snapshots(){return this.entries}};l2=class l2 extends Z1{snapshotCache=new v2(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(V){return this.snapshot.prefersViewTransitions&&V.prefersViewTransitions}renderPage(V,Z=!1,I=!0,J){let G=new(this.isPageRefresh(J)&&(J?.refresh?.method||this.snapshot.refreshMethod)==="morph"?B1:W0)(this.snapshot,V,Z,I);return G.shouldRender?J?.changeHistory():this.forceReloaded=!0,this.render(G)}renderError(V,Z){Z?.changeHistory();let I=new b2(this.snapshot,V,!1);return this.render(I)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(V=this.snapshot){if(V.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:Z}=this;await B2();let I=V.clone();return this.snapshotCache.put(Z,I),I}}getCachedSnapshotForLocation(V){return this.snapshotCache.get(V)}isPageRefresh(V){return!V||this.lastRenderedLocation.pathname===V.location.pathname&&V.action==="replace"}shouldPreserveScrollPosition(V){return this.isPageRefresh(V)&&(V?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return g.fromElement(this.element)}};S4={absoluteURL:{get(){return this.toString()}}},_=new class{navigator=new P2(this);history=new h2(this);view=new l2(this,document.documentElement);adapter=new k2(this);pageObserver=new p2(this);cacheObserver=new g2;linkPrefetchObserver=new x2(this,document);linkClickObserver=new J1(this,window);formSubmitObserver=new Q0(this,document);scrollObserver=new m2(this);streamObserver=new d2(this);formLinkClickObserver=new G1(this,document.documentElement);frameRedirector=new c2(this,document.documentElement);streamMessageRenderer=new u2;cache=new a2(this);enabled=!0;started=!1;#V=150;constructor(V){this.recentRequests=V,this.preloader=new o2(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(V){this.adapter=V}visit(V,Z={}){let I=Z.frame?document.getElementById(Z.frame):null;if(I instanceof N){let J=Z.action||b(I);I.delegate.proposeVisitIfNavigatedWithAction(I,J),I.src=V.toString()}else this.navigator.proposeVisit(E(V),Z)}refresh(V,Z={}){Z=typeof Z=="string"?{requestId:Z}:Z;let{method:I,requestId:J,scroll:G}=Z,K=J&&this.recentRequests.has(J),$=V===document.baseURI;K||this.navigator.currentVisit||!$||this.visit(V,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:I,scroll:G}})}connectStreamSource(V){this.streamObserver.connectStreamSource(V)}disconnectStreamSource(V){this.streamObserver.disconnectStreamSource(V)}renderStreamMessage(V){this.streamMessageRenderer.render(v.wrap(V))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(V){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=V}set progressBarDelay(V){f.drive.progressBarDelay=V}get progressBarDelay(){return f.drive.progressBarDelay}set drive(V){f.drive.enabled=V}get drive(){return f.drive.enabled}set formMode(V){f.forms.mode=V}get formMode(){return f.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#V}set pageRefreshDebouncePeriod(V){this.refresh=function(Z,I){let J=null;return(...G)=>{clearTimeout(J),J=setTimeout(()=>Z.apply(this,G),I)}}(this.debouncedRefresh.bind(this),V),this.#V=V}shouldPreloadLink(V){let Z=V.hasAttribute("data-turbo-method"),I=V.hasAttribute("data-turbo-stream"),J=V.getAttribute("data-turbo-frame"),G=J=="_top"?null:document.getElementById(J)||i(V,"turbo-frame:not([disabled])");if(Z||I||G instanceof N)return!1;{let K=new URL(V.href);return this.elementIsNavigatable(V)&&p(K,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(V,Z,I){this.enabled?this.navigator.startVisit(V,Z,{action:"restore",historyChanged:!0,direction:I}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(V){this.history.replace(V),this.view.lastRenderedLocation=V,this.view.cacheSnapshot()}scrollPositionChanged(V){this.history.updateRestorationData({scrollPosition:V})}willSubmitFormLinkToLocation(V,Z){return this.elementIsNavigatable(V)&&p(Z,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(V,Z){return this.elementIsNavigatable(V)&&p(Z,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(Z)}willFollowLinkToLocation(V,Z,I){return this.elementIsNavigatable(V)&&p(Z,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(V,Z,I)}followedLinkToLocation(V,Z){let I=this.getActionForLink(V),J=V.hasAttribute("data-turbo-stream");this.visit(Z.href,{action:I,acceptsStreamResponse:J})}allowsVisitingLocationWithAction(V,Z){return this.applicationAllowsVisitingLocation(V)}visitProposedToLocation(V,Z){I2(V),this.adapter.visitProposedToLocation(V,Z)}visitStarted(V){V.acceptsStreamResponse||(j0(document.documentElement),this.view.markVisitDirection(V.direction)),I2(V.location),this.notifyApplicationAfterVisitingLocation(V.location,V.action)}visitCompleted(V){this.view.unmarkVisitDirection(),C0(document.documentElement),this.notifyApplicationAfterPageLoad(V.getTimingMetrics())}willSubmitForm(V,Z){let I=t0(V,Z);return this.submissionIsNavigatable(V,Z)&&p(E(I),this.snapshot.rootLocation)}formSubmitted(V,Z){this.navigator.submitForm(V,Z)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(V){this.renderStreamMessage(V)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:V},Z){let I=this.notifyApplicationBeforeRender(V,Z),{defaultPrevented:J,detail:{render:G}}=I;return this.view.renderer&&G&&(this.view.renderer.renderElement=G),!J}viewRenderedSnapshot(V,Z,I){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(I)}preloadOnLoadLinksForView(V){this.preloader.preloadOnLoadLinksForView(V)}viewInvalidated(V){this.adapter.pageInvalidated(V)}frameLoaded(V){this.notifyApplicationAfterFrameLoad(V)}frameRendered(V,Z){this.notifyApplicationAfterFrameRender(V,Z)}applicationAllowsFollowingLinkToLocation(V,Z,I){return!this.notifyApplicationAfterClickingLinkToLocation(V,Z,I).defaultPrevented}applicationAllowsVisitingLocation(V){return!this.notifyApplicationBeforeVisitingLocation(V).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(V,Z,I){return Q("turbo:click",{target:V,detail:{url:Z.href,originalEvent:I},cancelable:!0})}notifyApplicationBeforeVisitingLocation(V){return Q("turbo:before-visit",{detail:{url:V.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(V,Z){return Q("turbo:visit",{detail:{url:V.href,action:Z}})}notifyApplicationBeforeCachingSnapshot(){return Q("turbo:before-cache")}notifyApplicationBeforeRender(V,Z){return Q("turbo:before-render",{detail:{newBody:V,...Z},cancelable:!0})}notifyApplicationAfterRender(V){return Q("turbo:render",{detail:{renderMethod:V}})}notifyApplicationAfterPageLoad(V={}){return Q("turbo:load",{detail:{url:this.location.href,timing:V}})}notifyApplicationAfterFrameLoad(V){return Q("turbo:frame-load",{target:V})}notifyApplicationAfterFrameRender(V,Z){return Q("turbo:frame-render",{detail:{fetchResponse:V},target:Z,cancelable:!0})}submissionIsNavigatable(V,Z){if(f.forms.mode=="off")return!1;{let I=!Z||this.elementIsNavigatable(Z);return f.forms.mode=="optin"?I&&V.closest('[data-turbo="true"]')!=null:I&&this.elementIsNavigatable(V)}}elementIsNavigatable(V){let Z=i(V,"[data-turbo]"),I=i(V,"turbo-frame");return f.drive.enabled||I?!Z||Z.getAttribute("data-turbo")!="false":!!Z&&Z.getAttribute("data-turbo")=="true"}getActionForLink(V){return b(V)||"advance"}get snapshot(){return this.view.snapshot}}(C2),{cache:i2,navigator:n2}=_;T4=Object.freeze({__proto__:null,PageRenderer:W0,PageSnapshot:g,FrameRenderer:$0,fetch:e0,config:f,session:_,cache:i2,navigator:n2,start:W1,registerAdapter:r2,visit:s2,connectStreamSource:E0,disconnectStreamSource:y0,renderStreamMessage:t2,setProgressBarDelay:e2,setConfirmMethod:V3,setFormMode:Z3,morphBodyElements:I3,morphTurboFrameElements:J3,morphChildren:f0,morphElements:B0});G3=class G3 extends Error{};S1={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach((V)=>V.parentElement?.insertBefore(this.templateContent,V.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((V)=>V.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach((V)=>V.parentElement?.insertBefore(this.templateContent,V))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach((V)=>V.prepend(this.templateContent))},remove(){this.targetElements.forEach((V)=>V.remove())},replace(){let V=this.getAttribute("method");this.targetElements.forEach((Z)=>{V==="morph"?B0(Z,this.templateContent):Z.replaceWith(this.templateContent)})},update(){let V=this.getAttribute("method");this.targetElements.forEach((Z)=>{V==="morph"?f0(Z,this.templateContent):(Z.innerHTML="",Z.append(this.templateContent))})},refresh(){let V=this.getAttribute("method"),Z=this.requestId,I=this.getAttribute("scroll");_.refresh(this.baseURI,{method:V,requestId:Z,scroll:I})}};R0=class R0 extends HTMLElement{static async renderElement(V){await V.performAction()}async connectedCallback(){try{await this.render()}catch(V){console.error(V)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let V=this.beforeRenderEvent;this.dispatchEvent(V)&&(await V0(),await V.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach((V)=>V.remove())}get duplicateChildren(){let V=this.targetElements.flatMap((I)=>[...I.children]).filter((I)=>!!I.getAttribute("id")),Z=[...this.templateContent?.children||[]].filter((I)=>!!I.getAttribute("id")).map((I)=>I.getAttribute("id"));return V.filter((I)=>Z.includes(I.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach((V)=>V.remove())}get duplicateSiblings(){let V=this.targetElements.flatMap((I)=>[...I.parentElement.children]).filter((I)=>!!I.id),Z=[...this.templateContent?.children||[]].filter((I)=>!!I.id).map((I)=>I.id);return V.filter((I)=>Z.includes(I.id))}get performAction(){if(this.action){let V=S1[this.action];if(V)return V;this.#V("unknown action")}this.#V("action attribute is missing")}get targetElements(){return this.target?this.targetElementsById:this.targets?this.targetElementsByQuery:void this.#V("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let V=this.ownerDocument.createElement("template");return this.appendChild(V),V}if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#V("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#V(V){throw Error(`${this.description}: ${V}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:R0.renderElement}})}get targetElementsById(){let V=this.ownerDocument?.getElementById(this.target);return V!==null?[V]:[]}get targetElementsByQuery(){let V=this.ownerDocument?.querySelectorAll(this.targets);return V.length!==0?Array.prototype.slice.call(V):[]}};T1=class T1 extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),E0(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),y0(this.streamSource))}get src(){return this.getAttribute("src")||""}};N.delegateConstructor=class{fetchResponseLoaded=(V)=>Promise.resolve();#V=null;#Z=()=>{};#I=!1;#$=!1;#B=new Set;#G=!1;action=null;constructor(V){this.element=V,this.view=new Q2(this,this.element),this.appearanceObserver=new q2(this,this.element),this.formLinkClickObserver=new G1(this,this.element),this.linkInterceptor=new I1(this,this.element),this.restorationIdentifier=u(),this.formSubmitObserver=new Q0(this,this.element)}connect(){this.#I||(this.#I=!0,this.loadingStyle==d.lazy?this.appearanceObserver.start():this.#J(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#I&&(this.#I=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#V?.cancel())}disabledChanged(){this.disabled?this.#V?.cancel():this.loadingStyle==d.eager&&this.#J()}sourceURLChanged(){this.#L("src")||(this.sourceURL||this.#V?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==d.eager||this.#$)&&this.#J())}sourceURLReloaded(){let{refresh:V,src:Z}=this.element;return this.#G=Z&&V==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=Z,this.element.loaded}loadingStyleChanged(){this.loadingStyle==d.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#J())}async#J(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#H(E(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#$=!0)}async loadResponse(V){(V.redirected||V.succeeded&&V.isHTML)&&(this.sourceURL=V.response.url);try{let Z=await V.responseHTML;if(Z){let I=W2(Z);g.fromDocument(I).isVisitable?await this.#W(V,I):await this.#O(V)}}finally{this.#G=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(V){this.proposeVisitIfNavigatedWithAction(V,b(V)),this.#J()}willSubmitFormLinkToLocation(V){return this.#S(V)}submittedFormLinkToLocation(V,Z,I){let J=this.#K(V);J&&I.setAttribute("data-turbo-frame",J.id)}shouldInterceptLinkClick(V,Z,I){return this.#S(V)}linkClickIntercepted(V,Z){this.#A(V,Z)}willSubmitForm(V,Z){return V.closest("turbo-frame")==this.element&&this.#S(V,Z)}formSubmitted(V,Z){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new D0(this,V,Z);let{fetchRequest:I}=this.formSubmission,J=this.#K(V,Z);this.prepareRequest(I,J),this.formSubmission.start()}prepareRequest(V,Z=this){V.headers["Turbo-Frame"]=Z.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&V.acceptResponseType(v.contentType)}requestStarted(V){j0(this.element)}requestPreventedHandlingResponse(V,Z){this.#Z()}async requestSucceededWithResponse(V,Z){await this.loadResponse(Z),this.#Z()}async requestFailedWithResponse(V,Z){await this.loadResponse(Z),this.#Z()}requestErrored(V,Z){console.error(Z),this.#Z()}requestFinished(V){C0(this.element)}formSubmissionStarted({formElement:V}){j0(V,this.#K(V))}formSubmissionSucceededWithResponse(V,Z){let I=this.#K(V.formElement,V.submitter);I.delegate.proposeVisitIfNavigatedWithAction(I,b(V.submitter,V.formElement,I)),I.delegate.loadResponse(Z),V.isSafe||_.clearCache()}formSubmissionFailedWithResponse(V,Z){this.element.delegate.loadResponse(Z),_.clearCache()}formSubmissionErrored(V,Z){console.error(Z)}formSubmissionFinished({formElement:V}){C0(V,this.#K(V))}allowsImmediateRender({element:V},Z){let I=Q("turbo:before-frame-render",{target:this.element,detail:{newFrame:V,...Z},cancelable:!0}),{defaultPrevented:J,detail:{render:G}}=I;return this.view.renderer&&G&&(this.view.renderer.renderElement=G),!J}viewRenderedSnapshot(V,Z,I){}preloadOnLoadLinksForView(V){_.preloadOnLoadLinksForView(V)}viewInvalidated(){}willRenderFrame(V,Z){this.previousFrameElement=V.cloneNode(!0)}visitCachedSnapshot=({element:V})=>{let Z=V.querySelector("#"+this.element.id);Z&&this.previousFrameElement&&Z.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#W(V,Z){let I=await this.extractForeignFrameElement(Z.body),J=this.#G?$1:$0;if(I){let G=new K0(I),K=new J(this,this.view.snapshot,G,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(K),this.complete=!0,_.frameRendered(V,this.element),_.frameLoaded(this.element),await this.fetchResponseLoaded(V)}else this.#U(V)&&this.#F(V)}async#H(V){let Z=new l(this,Y.get,V,new URLSearchParams,this.element);return this.#V?.cancel(),this.#V=Z,new Promise((I)=>{this.#Z=()=>{this.#Z=()=>{},this.#V=null,I()},Z.perform()})}#A(V,Z,I){let J=this.#K(V,I);J.delegate.proposeVisitIfNavigatedWithAction(J,b(I,V,J)),this.#q(V,()=>{J.src=Z})}proposeVisitIfNavigatedWithAction(V,Z=null){if(this.action=Z,this.action){let I=g.fromElement(V).clone(),{visitCachedSnapshot:J}=V.delegate;V.delegate.fetchResponseLoaded=async(G)=>{if(V.src){let{statusCode:K,redirected:$}=G,T={response:{statusCode:K,redirected:$,responseHTML:await G.responseHTML},visitCachedSnapshot:J,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:I};this.action&&(T.action=this.action),_.visit(V.src,T)}}}}changeHistory(){if(this.action){let V=T2(this.action);_.history.update(V,E(this.element.src||""),this.restorationIdentifier)}}async#O(V){console.warn(`The response (${V.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#T(V.response)}#U(V){this.element.setAttribute("complete","");let Z=V.response;return!Q("turbo:frame-missing",{target:this.element,detail:{response:Z,visit:async(I,J)=>{I instanceof Response?this.#T(I):_.visit(I,J)}},cancelable:!0}).defaultPrevented}#F(V){this.view.missing(),this.#j(V)}#j(V){let Z=`The response (${V.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new G3(Z)}async#T(V){let Z=new G0(V),I=await Z.responseHTML,{location:J,redirected:G,statusCode:K}=Z;return _.visit(J,{response:{redirected:G,statusCode:K,responseHTML:I}})}#K(V,Z){let I=F0("data-turbo-frame",Z,V)||this.element.getAttribute("target"),J=this.#X(I);return J instanceof N?J:this.element}async extractForeignFrameElement(V){let Z,I=CSS.escape(this.id);try{if(Z=J2(V.querySelector(`turbo-frame#${I}`),this.sourceURL),Z)return Z;if(Z=J2(V.querySelector(`turbo-frame[src][recurse~=${I}]`),this.sourceURL),Z)return await Z.loaded,await this.extractForeignFrameElement(Z)}catch(J){return console.error(J),new N}return null}#C(V,Z){return p(E(t0(V,Z)),this.rootLocation)}#S(V,Z){let I=F0("data-turbo-frame",Z,V)||this.element.getAttribute("target");if(V instanceof HTMLFormElement&&!this.#C(V,Z))return!1;if(!this.enabled||I=="_top")return!1;if(I){let J=this.#X(I);if(J)return!J.disabled;if(I=="_parent")return!1}return!!_.elementIsNavigatable(V)&&!(Z&&!_.elementIsNavigatable(Z))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(V){this.#M("src",()=>{this.element.src=V??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#Z()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(V){V?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#I}get rootLocation(){let V=this.element.ownerDocument.querySelector('meta[name="turbo-root"]');return E(V?.content??"/")}#L(V){return this.#B.has(V)}#M(V,Z){this.#B.add(V),Z(),this.#B.delete(V)}#q(V,Z){this.currentNavigationElement=V,Z(),delete this.currentNavigationElement}#X(V){if(V!=null){let Z=V==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(V);if(Z instanceof N)return Z}}},customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",N),customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",R0),customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",T1),(()=>{let V=document.currentScript;if(!V)return;if(V.hasAttribute("data-turbo-suppress-warning"))return;let Z=V.parentElement;for(;Z;){if(Z==document.body)return console.warn(S2`
22
+ You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
23
+
24
+ Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
25
+
26
+ For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
27
+
28
+ ——
29
+ Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
30
+ `,V.outerHTML);Z=Z.parentElement}})(),window.Turbo={...T4,StreamActions:S1},W1();K3=Object.freeze({__proto__:null,FetchEnctype:m,FetchMethod:Y,FetchRequest:l,FetchResponse:G0,FrameElement:N,FrameLoadingStyle:d,FrameRenderer:$0,PageRenderer:W0,PageSnapshot:g,StreamActions:S1,StreamElement:R0,StreamSourceElement:T1,cache:i2,config:f,connectStreamSource:E0,disconnectStreamSource:y0,fetch:e0,fetchEnctypeFromString:L2,fetchMethodFromString:z0,isSafe:w0,morphBodyElements:I3,morphChildren:f0,morphElements:B0,morphTurboFrameElements:J3,navigator:n2,registerAdapter:r2,renderStreamMessage:t2,session:_,setConfirmMethod:V3,setFormMode:Z3,setProgressBarDelay:e2,start:W1,visit:s2});X4=Object.freeze({__proto__:null,getConsumer:B3,setConsumer:o0,createConsumer:W3,subscribeTo:S3});T3=class T3 extends HTMLElement{static observedAttributes=["channel","signed-stream-name"];async connectedCallback(){E0(this),this.subscription=await S3(this.channel,{received:this.dispatchMessageEvent.bind(this),connected:this.subscriptionConnected.bind(this),disconnected:this.subscriptionDisconnected.bind(this)})}disconnectedCallback(){y0(this),this.subscription&&this.subscription.unsubscribe(),this.subscriptionDisconnected()}attributeChangedCallback(){this.subscription&&(this.disconnectedCallback(),this.connectedCallback())}dispatchMessageEvent(V){let Z=new MessageEvent("message",{data:V});return this.dispatchEvent(Z)}subscriptionConnected(){this.setAttribute("connected","")}subscriptionDisconnected(){this.removeAttribute("connected")}get channel(){return{channel:this.getAttribute("channel"),signed_stream_name:this.getAttribute("signed-stream-name"),...a0({...this.dataset})}}};customElements.get("turbo-cable-stream-source")===void 0&&customElements.define("turbo-cable-stream-source",T3),window.Turbo=K3,addEventListener("turbo:before-fetch-request",function(V){if(V.target instanceof HTMLFormElement){let{target:Z,detail:{fetchOptions:I}}=V;Z.addEventListener("turbo:submit-start",({detail:{formSubmission:{submitter:J}}})=>{let G=function($){return $ instanceof FormData||$ instanceof URLSearchParams}(I.body)?I.body:new URLSearchParams,K=function($,T,X){let C=function(S){return S instanceof HTMLButtonElement||S instanceof HTMLInputElement?S.name==="_method"?S.value:S.hasAttribute("formmethod")?S.formMethod:null:null}($),O=T.get("_method"),H=X.getAttribute("method")||"get";return typeof C=="string"?C:typeof O=="string"?O:H}(J,G,Z);/get/i.test(K)||(/post/i.test(K)?G.delete("_method"):G.set("_method",K),I.method="post")},{once:!0})}});I0={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0},D={log(...V){this.enabled&&(V.push(Date.now()),I0.logger.log("[ActionCable]",...V))}};M0.staleThreshold=6,M0.reconnectionBackoffRate=0.15;X3=M0,i0={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},{message_types:t,protocols:n0}=i0,H4=n0.slice(0,n0.length-1),G2=[].indexOf;q0.reopenDelay=500,q0.prototype.events={message(V){if(!this.isProtocolSupported())return;let{identifier:Z,message:I,reason:J,reconnect:G,type:K}=JSON.parse(V.data);switch(this.monitor.recordMessage(),K){case t.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case t.disconnect:return D.log(`Disconnecting. Reason: ${J}`),this.close({allowReconnect:G});case t.ping:return null;case t.confirmation:return this.subscriptions.confirmSubscription(Z),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(Z,"connected",{reconnected:!0})):this.subscriptions.notify(Z,"connected",{reconnected:!1});case t.rejection:return this.subscriptions.reject(Z);default:return this.subscriptions.notify(Z,"received",I)}},open(){if(D.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return D.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(V){if(D.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){D.log("WebSocket onerror event")}};H3=q0;A4=Object.freeze({__proto__:null,Connection:H3,ConnectionMonitor:X3,Consumer:r0,INTERNAL:i0,Subscription:X1,Subscriptions:H1,SubscriptionGuarantor:A3,adapters:I0,createWebSocketURL:O3,logger:D,createConsumer:function(V=K2("url")||i0.default_mount_path){return new r0(V)},getConfig:K2})});class w1{constructor(V,Z,I){this.eventTarget=V,this.eventName=Z,this.eventOptions=I,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(V){this.unorderedBindings.add(V)}bindingDisconnected(V){this.unorderedBindings.delete(V)}handleEvent(V){let Z=function(I){if("immediatePropagationStopped"in I)return I;{let{stopImmediatePropagation:J}=I;return Object.assign(I,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,J.call(this)}})}}(V);for(let I of this.bindings){if(Z.immediatePropagationStopped)break;I.handleEvent(Z)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((V,Z)=>{let I=V.index,J=Z.index;return I<J?-1:I>J?1:0})}}class D1{constructor(V){this.application=V,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((V)=>V.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((V)=>V.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((V,Z)=>V.concat(Array.from(Z.values())),[])}bindingConnected(V){this.fetchEventListenerForBinding(V).bindingConnected(V)}bindingDisconnected(V,Z=!1){this.fetchEventListenerForBinding(V).bindingDisconnected(V),Z&&this.clearEventListenersForBinding(V)}handleError(V,Z,I={}){this.application.handleError(V,`Error ${Z}`,I)}clearEventListenersForBinding(V){let Z=this.fetchEventListenerForBinding(V);Z.hasBindings()||(Z.disconnect(),this.removeMappedEventListenerFor(V))}removeMappedEventListenerFor(V){let{eventTarget:Z,eventName:I,eventOptions:J}=V,G=this.fetchEventListenerMapForEventTarget(Z),K=this.cacheKey(I,J);G.delete(K),G.size==0&&this.eventListenerMaps.delete(Z)}fetchEventListenerForBinding(V){let{eventTarget:Z,eventName:I,eventOptions:J}=V;return this.fetchEventListener(Z,I,J)}fetchEventListener(V,Z,I){let J=this.fetchEventListenerMapForEventTarget(V),G=this.cacheKey(Z,I),K=J.get(G);return K||(K=this.createEventListener(V,Z,I),J.set(G,K)),K}createEventListener(V,Z,I){let J=new w1(V,Z,I);return this.started&&J.connect(),J}fetchEventListenerMapForEventTarget(V){let Z=this.eventListenerMaps.get(V);return Z||(Z=new Map,this.eventListenerMaps.set(V,Z)),Z}cacheKey(V,Z){let I=[V];return Object.keys(Z).sort().forEach((J)=>{I.push(`${Z[J]?"":"!"}${J}`)}),I.join(":")}}var w3={stop:({event:V,value:Z})=>(Z&&V.stopPropagation(),!0),prevent:({event:V,value:Z})=>(Z&&V.preventDefault(),!0),self:({event:V,value:Z,element:I})=>!Z||I===V.target},D3=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Q3(V){return V=="window"?window:V=="document"?document:void 0}function x0(V){return V.replace(/(?:[_-])([a-z0-9])/g,(Z,I)=>I.toUpperCase())}function g0(V){return x0(V.replace(/--/g,"-").replace(/__/g,"_"))}function n(V){return V.charAt(0).toUpperCase()+V.slice(1)}function Q1(V){return V.replace(/([A-Z])/g,(Z,I)=>`-${I.toLowerCase()}`)}function A1(V){return V!=null}function c0(V,Z){return Object.prototype.hasOwnProperty.call(V,Z)}var O1=["meta","ctrl","alt","shift"],U1={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:(V)=>V.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function X0(V){throw Error(V)}function _3(V){try{return JSON.parse(V)}catch(Z){return V}}class _1{constructor(V,Z){this.context=V,this.action=Z}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(V){let Z=this.prepareActionEvent(V);this.willBeInvokedByEvent(V)&&this.applyEventModifiers(Z)&&this.invokeWithEvent(Z)}get eventName(){return this.action.eventName}get method(){let V=this.controller[this.methodName];if(typeof V=="function")return V;throw Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(V){let{element:Z}=this.action,{actionDescriptorFilters:I}=this.context.application,{controller:J}=this.context,G=!0;for(let[K,$]of Object.entries(this.eventOptions))if(K in I){let T=I[K];G=G&&T({name:K,value:$,event:V,element:Z,controller:J})}return G}prepareActionEvent(V){return Object.assign(V,{params:this.action.params})}invokeWithEvent(V){let{target:Z,currentTarget:I}=V;try{this.method.call(this.controller,V),this.context.logDebugActivity(this.methodName,{event:V,target:Z,currentTarget:I,action:this.methodName})}catch(J){let{identifier:G,controller:K,element:$,index:T}=this,X={identifier:G,controller:K,element:$,index:T,event:V};this.context.handleError(J,`invoking action "${this.action}"`,X)}}willBeInvokedByEvent(V){let Z=V.target;return!(V instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(V))&&(!(V instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(V))&&(this.element===Z||(Z instanceof Element&&this.element.contains(Z)?this.scope.containsElement(Z):this.scope.containsElement(this.action.element))))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class P0{constructor(V,Z){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=V,this.started=!1,this.delegate=Z,this.elements=new Set,this.mutationObserver=new MutationObserver((I)=>this.processMutations(I))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(V){this.started&&(this.mutationObserver.disconnect(),this.started=!1),V(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let V=new Set(this.matchElementsInTree());for(let Z of Array.from(this.elements))V.has(Z)||this.removeElement(Z);for(let Z of Array.from(V))this.addElement(Z)}}processMutations(V){if(this.started)for(let Z of V)this.processMutation(Z)}processMutation(V){V.type=="attributes"?this.processAttributeChange(V.target,V.attributeName):V.type=="childList"&&(this.processRemovedNodes(V.removedNodes),this.processAddedNodes(V.addedNodes))}processAttributeChange(V,Z){this.elements.has(V)?this.delegate.elementAttributeChanged&&this.matchElement(V)?this.delegate.elementAttributeChanged(V,Z):this.removeElement(V):this.matchElement(V)&&this.addElement(V)}processRemovedNodes(V){for(let Z of Array.from(V)){let I=this.elementFromNode(Z);I&&this.processTree(I,this.removeElement)}}processAddedNodes(V){for(let Z of Array.from(V)){let I=this.elementFromNode(Z);I&&this.elementIsActive(I)&&this.processTree(I,this.addElement)}}matchElement(V){return this.delegate.matchElement(V)}matchElementsInTree(V=this.element){return this.delegate.matchElementsInTree(V)}processTree(V,Z){for(let I of this.matchElementsInTree(V))Z.call(this,I)}elementFromNode(V){if(V.nodeType==Node.ELEMENT_NODE)return V}elementIsActive(V){return V.isConnected==this.element.isConnected&&this.element.contains(V)}addElement(V){this.elements.has(V)||this.elementIsActive(V)&&(this.elements.add(V),this.delegate.elementMatched&&this.delegate.elementMatched(V))}removeElement(V){this.elements.has(V)&&(this.elements.delete(V),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(V))}}class p0{constructor(V,Z,I){this.attributeName=Z,this.delegate=I,this.elementObserver=new P0(V,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(V){this.elementObserver.pause(V)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(V){return V.hasAttribute(this.attributeName)}matchElementsInTree(V){let Z=this.matchElement(V)?[V]:[],I=Array.from(V.querySelectorAll(this.selector));return Z.concat(I)}elementMatched(V){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(V,this.attributeName)}elementUnmatched(V){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(V,this.attributeName)}elementAttributeChanged(V,Z){this.delegate.elementAttributeValueChanged&&this.attributeName==Z&&this.delegate.elementAttributeValueChanged(V,Z)}}function f3(V,Z,I){f1(V,Z).add(I)}function E3(V,Z,I){f1(V,Z).delete(I),y3(V,Z)}function f1(V,Z){let I=V.get(Z);return I||(I=new Set,V.set(Z,I)),I}function y3(V,Z){let I=V.get(Z);I!=null&&I.size==0&&V.delete(Z)}class x{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((V,Z)=>V.concat(Array.from(Z)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((V,Z)=>V+Z.size,0)}add(V,Z){f3(this.valuesByKey,V,Z)}delete(V,Z){E3(this.valuesByKey,V,Z)}has(V,Z){let I=this.valuesByKey.get(V);return I!=null&&I.has(Z)}hasKey(V){return this.valuesByKey.has(V)}hasValue(V){return Array.from(this.valuesByKey.values()).some((Z)=>Z.has(V))}getValuesForKey(V){let Z=this.valuesByKey.get(V);return Z?Array.from(Z):[]}getKeysForValue(V){return Array.from(this.valuesByKey).filter(([Z,I])=>I.has(V)).map(([Z,I])=>Z)}}class E1{constructor(V,Z,I,J){this._selector=Z,this.details=J,this.elementObserver=new P0(V,this),this.delegate=I,this.matchesByElement=new x}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(V){this._selector=V,this.refresh()}start(){this.elementObserver.start()}pause(V){this.elementObserver.pause(V)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(V){let{selector:Z}=this;if(Z){let I=V.matches(Z);return this.delegate.selectorMatchElement?I&&this.delegate.selectorMatchElement(V,this.details):I}return!1}matchElementsInTree(V){let{selector:Z}=this;if(Z){let I=this.matchElement(V)?[V]:[],J=Array.from(V.querySelectorAll(Z)).filter((G)=>this.matchElement(G));return I.concat(J)}return[]}elementMatched(V){let{selector:Z}=this;Z&&this.selectorMatched(V,Z)}elementUnmatched(V){let Z=this.matchesByElement.getKeysForValue(V);for(let I of Z)this.selectorUnmatched(V,I)}elementAttributeChanged(V,Z){let{selector:I}=this;if(I){let J=this.matchElement(V),G=this.matchesByElement.has(I,V);J&&!G?this.selectorMatched(V,I):!J&&G&&this.selectorUnmatched(V,I)}}selectorMatched(V,Z){this.delegate.selectorMatched(V,Z,this.details),this.matchesByElement.add(Z,V)}selectorUnmatched(V,Z){this.delegate.selectorUnmatched(V,Z,this.details),this.matchesByElement.delete(Z,V)}}class y1{constructor(V,Z){this.element=V,this.delegate=Z,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver((I)=>this.processMutations(I))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let V of this.knownAttributeNames)this.refreshAttribute(V,null)}processMutations(V){if(this.started)for(let Z of V)this.processMutation(Z)}processMutation(V){let Z=V.attributeName;Z&&this.refreshAttribute(Z,V.oldValue)}refreshAttribute(V,Z){let I=this.delegate.getStringMapKeyForAttribute(V);if(I!=null){this.stringMap.has(V)||this.stringMapKeyAdded(I,V);let J=this.element.getAttribute(V);if(this.stringMap.get(V)!=J&&this.stringMapValueChanged(J,I,Z),J==null){let G=this.stringMap.get(V);this.stringMap.delete(V),G&&this.stringMapKeyRemoved(I,V,G)}else this.stringMap.set(V,J)}}stringMapKeyAdded(V,Z){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(V,Z)}stringMapValueChanged(V,Z,I){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(V,Z,I)}stringMapKeyRemoved(V,Z,I){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(V,Z,I)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((V)=>V.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class m0{constructor(V,Z,I){this.attributeObserver=new p0(V,Z,this),this.delegate=I,this.tokensByElement=new x}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(V){this.attributeObserver.pause(V)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(V){this.tokensMatched(this.readTokensForElement(V))}elementAttributeValueChanged(V){let[Z,I]=this.refreshTokensForElement(V);this.tokensUnmatched(Z),this.tokensMatched(I)}elementUnmatchedAttribute(V){this.tokensUnmatched(this.tokensByElement.getValuesForKey(V))}tokensMatched(V){V.forEach((Z)=>this.tokenMatched(Z))}tokensUnmatched(V){V.forEach((Z)=>this.tokenUnmatched(Z))}tokenMatched(V){this.delegate.tokenMatched(V),this.tokensByElement.add(V.element,V)}tokenUnmatched(V){this.delegate.tokenUnmatched(V),this.tokensByElement.delete(V.element,V)}refreshTokensForElement(V){let Z=this.tokensByElement.getValuesForKey(V),I=this.readTokensForElement(V),J=function(G,K){let $=Math.max(G.length,K.length);return Array.from({length:$},(T,X)=>[G[X],K[X]])}(Z,I).findIndex(([G,K])=>{return T=K,!(($=G)&&T&&$.index==T.index&&$.content==T.content);var $,T});return J==-1?[[],[]]:[Z.slice(J),I.slice(J)]}readTokensForElement(V){let Z=this.attributeName;return function(I,J,G){return I.trim().split(/\s+/).filter((K)=>K.length).map((K,$)=>({element:J,attributeName:G,content:K,index:$}))}(V.getAttribute(Z)||"",V,Z)}}class u0{constructor(V,Z,I){this.tokenListObserver=new m0(V,Z,this),this.delegate=I,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(V){let{element:Z}=V,{value:I}=this.fetchParseResultForToken(V);I&&(this.fetchValuesByTokenForElement(Z).set(V,I),this.delegate.elementMatchedValue(Z,I))}tokenUnmatched(V){let{element:Z}=V,{value:I}=this.fetchParseResultForToken(V);I&&(this.fetchValuesByTokenForElement(Z).delete(V),this.delegate.elementUnmatchedValue(Z,I))}fetchParseResultForToken(V){let Z=this.parseResultsByToken.get(V);return Z||(Z=this.parseToken(V),this.parseResultsByToken.set(V,Z)),Z}fetchValuesByTokenForElement(V){let Z=this.valuesByTokenByElement.get(V);return Z||(Z=new Map,this.valuesByTokenByElement.set(V,Z)),Z}parseToken(V){try{return{value:this.delegate.parseValueForToken(V)}}catch(Z){return{error:Z}}}}class R1{constructor(V,Z){this.context=V,this.delegate=Z,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new u0(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(V){let Z=new _1(this.context,V);this.bindingsByAction.set(V,Z),this.delegate.bindingConnected(Z)}disconnectAction(V){let Z=this.bindingsByAction.get(V);Z&&(this.bindingsByAction.delete(V),this.delegate.bindingDisconnected(Z))}disconnectAllActions(){this.bindings.forEach((V)=>this.delegate.bindingDisconnected(V,!0)),this.bindingsByAction.clear()}parseValueForToken(V){let Z=class{constructor(I,J,G,K){this.element=I,this.index=J,this.eventTarget=G.eventTarget||I,this.eventName=G.eventName||function($){let T=$.tagName.toLowerCase();if(T in U1)return U1[T]($)}(I)||X0("missing event name"),this.eventOptions=G.eventOptions||{},this.identifier=G.identifier||X0("missing identifier"),this.methodName=G.methodName||X0("missing method name"),this.keyFilter=G.keyFilter||"",this.schema=K}static forToken(I,J){return new this(I.element,I.index,function(G){let K=G.trim().match(D3)||[],$=K[2],T=K[3];return T&&!["keydown","keyup","keypress"].includes($)&&($+=`.${T}`,T=""),{eventTarget:Q3(K[4]),eventName:$,eventOptions:K[7]?(X=K[7],X.split(":").reduce((C,O)=>Object.assign(C,{[O.replace(/^!/,"")]:!/^!/.test(O)}),{})):{},identifier:K[5],methodName:K[6],keyFilter:K[1]||T};var X}(I.content),J)}toString(){let I=this.keyFilter?`.${this.keyFilter}`:"",J=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${I}${J}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(I){if(!this.keyFilter)return!1;let J=this.keyFilter.split("+");if(this.keyFilterDissatisfied(I,J))return!0;let G=J.filter((K)=>!O1.includes(K))[0];return!!G&&(c0(this.keyMappings,G)||X0(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[G].toLowerCase()!==I.key.toLowerCase())}shouldIgnoreMouseEvent(I){if(!this.keyFilter)return!1;let J=[this.keyFilter];return!!this.keyFilterDissatisfied(I,J)}get params(){let I={},J=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:G,value:K}of Array.from(this.element.attributes)){let $=G.match(J),T=$&&$[1];T&&(I[x0(T)]=_3(K))}return I}get eventTargetName(){return(I=this.eventTarget)==window?"window":I==document?"document":void 0;var I}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(I,J){let[G,K,$,T]=O1.map((X)=>J.includes(X));return I.metaKey!==G||I.ctrlKey!==K||I.altKey!==$||I.shiftKey!==T}}.forToken(V,this.schema);if(Z.identifier==this.identifier)return Z}elementMatchedValue(V,Z){this.connectAction(Z)}elementUnmatchedValue(V,Z){this.disconnectAction(Z)}}class N1{constructor(V,Z){this.context=V,this.receiver=Z,this.stringMapObserver=new y1(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(V){if(V in this.valueDescriptorMap)return this.valueDescriptorMap[V].name}stringMapKeyAdded(V,Z){let I=this.valueDescriptorMap[Z];this.hasValue(V)||this.invokeChangedCallback(V,I.writer(this.receiver[V]),I.writer(I.defaultValue))}stringMapValueChanged(V,Z,I){let J=this.valueDescriptorNameMap[Z];V!==null&&(I===null&&(I=J.writer(J.defaultValue)),this.invokeChangedCallback(Z,V,I))}stringMapKeyRemoved(V,Z,I){let J=this.valueDescriptorNameMap[V];this.hasValue(V)?this.invokeChangedCallback(V,J.writer(this.receiver[V]),I):this.invokeChangedCallback(V,J.writer(J.defaultValue),I)}invokeChangedCallbacksForDefaultValues(){for(let{key:V,name:Z,defaultValue:I,writer:J}of this.valueDescriptors)I==null||this.controller.data.has(V)||this.invokeChangedCallback(Z,J(I),void 0)}invokeChangedCallback(V,Z,I){let J=`${V}Changed`,G=this.receiver[J];if(typeof G=="function"){let K=this.valueDescriptorNameMap[V];try{let $=K.reader(Z),T=I;I&&(T=K.reader(I)),G.call(this.receiver,$,T)}catch($){throw $ instanceof TypeError&&($.message=`Stimulus Value "${this.context.identifier}.${K.name}" - ${$.message}`),$}}}get valueDescriptors(){let{valueDescriptorMap:V}=this;return Object.keys(V).map((Z)=>V[Z])}get valueDescriptorNameMap(){let V={};return Object.keys(this.valueDescriptorMap).forEach((Z)=>{let I=this.valueDescriptorMap[Z];V[I.name]=I}),V}hasValue(V){let Z=`has${n(this.valueDescriptorNameMap[V].name)}`;return this.receiver[Z]}}class Y1{constructor(V,Z){this.context=V,this.delegate=Z,this.targetsByName=new x}start(){this.tokenListObserver||(this.tokenListObserver=new m0(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:V,content:Z}){this.scope.containsElement(V)&&this.connectTarget(V,Z)}tokenUnmatched({element:V,content:Z}){this.disconnectTarget(V,Z)}connectTarget(V,Z){var I;this.targetsByName.has(Z,V)||(this.targetsByName.add(Z,V),(I=this.tokenListObserver)===null||I===void 0||I.pause(()=>this.delegate.targetConnected(V,Z)))}disconnectTarget(V,Z){var I;this.targetsByName.has(Z,V)&&(this.targetsByName.delete(Z,V),(I=this.tokenListObserver)===null||I===void 0||I.pause(()=>this.delegate.targetDisconnected(V,Z)))}disconnectAllTargets(){for(let V of this.targetsByName.keys)for(let Z of this.targetsByName.getValuesForKey(V))this.disconnectTarget(Z,V)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function r(V,Z){let I=k1(V);return Array.from(I.reduce((J,G)=>(function(K,$){let T=K[$];return Array.isArray(T)?T:[]}(G,Z).forEach((K)=>J.add(K)),J),new Set))}function R3(V,Z){return k1(V).reduce((I,J)=>(I.push(...function(G,K){let $=G[K];return $?Object.keys($).map((T)=>[T,$[T]]):[]}(J,Z)),I),[])}function k1(V){let Z=[];for(;V;)Z.push(V),V=Object.getPrototypeOf(V);return Z.reverse()}class g1{constructor(V,Z){this.started=!1,this.context=V,this.delegate=Z,this.outletsByName=new x,this.outletElementsByName=new x,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach((V)=>{this.setupSelectorObserverForOutlet(V),this.setupAttributeObserverForOutlet(V)}),this.started=!0,this.dependentContexts.forEach((V)=>V.refresh()))}refresh(){this.selectorObserverMap.forEach((V)=>V.refresh()),this.attributeObserverMap.forEach((V)=>V.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach((V)=>V.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach((V)=>V.stop()),this.attributeObserverMap.clear())}selectorMatched(V,Z,{outletName:I}){let J=this.getOutlet(V,I);J&&this.connectOutlet(J,V,I)}selectorUnmatched(V,Z,{outletName:I}){let J=this.getOutletFromMap(V,I);J&&this.disconnectOutlet(J,V,I)}selectorMatchElement(V,{outletName:Z}){let I=this.selector(Z),J=this.hasOutlet(V,Z),G=V.matches(`[${this.schema.controllerAttribute}~=${Z}]`);return!!I&&(J&&G&&V.matches(I))}elementMatchedAttribute(V,Z){let I=this.getOutletNameFromOutletAttributeName(Z);I&&this.updateSelectorObserverForOutlet(I)}elementAttributeValueChanged(V,Z){let I=this.getOutletNameFromOutletAttributeName(Z);I&&this.updateSelectorObserverForOutlet(I)}elementUnmatchedAttribute(V,Z){let I=this.getOutletNameFromOutletAttributeName(Z);I&&this.updateSelectorObserverForOutlet(I)}connectOutlet(V,Z,I){var J;this.outletElementsByName.has(I,Z)||(this.outletsByName.add(I,V),this.outletElementsByName.add(I,Z),(J=this.selectorObserverMap.get(I))===null||J===void 0||J.pause(()=>this.delegate.outletConnected(V,Z,I)))}disconnectOutlet(V,Z,I){var J;this.outletElementsByName.has(I,Z)&&(this.outletsByName.delete(I,V),this.outletElementsByName.delete(I,Z),(J=this.selectorObserverMap.get(I))===null||J===void 0||J.pause(()=>this.delegate.outletDisconnected(V,Z,I)))}disconnectAllOutlets(){for(let V of this.outletElementsByName.keys)for(let Z of this.outletElementsByName.getValuesForKey(V))for(let I of this.outletsByName.getValuesForKey(V))this.disconnectOutlet(I,Z,V)}updateSelectorObserverForOutlet(V){let Z=this.selectorObserverMap.get(V);Z&&(Z.selector=this.selector(V))}setupSelectorObserverForOutlet(V){let Z=this.selector(V),I=new E1(document.body,Z,this,{outletName:V});this.selectorObserverMap.set(V,I),I.start()}setupAttributeObserverForOutlet(V){let Z=this.attributeNameForOutletName(V),I=new p0(this.scope.element,Z,this);this.attributeObserverMap.set(V,I),I.start()}selector(V){return this.scope.outlets.getSelectorForOutletName(V)}attributeNameForOutletName(V){return this.scope.schema.outletAttributeForScope(this.identifier,V)}getOutletNameFromOutletAttributeName(V){return this.outletDefinitions.find((Z)=>this.attributeNameForOutletName(Z)===V)}get outletDependencies(){let V=new x;return this.router.modules.forEach((Z)=>{r(Z.definition.controllerConstructor,"outlets").forEach((I)=>V.add(I,Z.identifier))}),V}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let V=this.dependentControllerIdentifiers;return this.router.contexts.filter((Z)=>V.includes(Z.identifier))}hasOutlet(V,Z){return!!this.getOutlet(V,Z)||!!this.getOutletFromMap(V,Z)}getOutlet(V,Z){return this.application.getControllerForElementAndIdentifier(V,Z)}getOutletFromMap(V,Z){return this.outletsByName.getValuesForKey(Z).find((I)=>I.element===V)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class c1{constructor(V,Z){this.logDebugActivity=(I,J={})=>{let{identifier:G,controller:K,element:$}=this;J=Object.assign({identifier:G,controller:K,element:$},J),this.application.logDebugActivity(this.identifier,I,J)},this.module=V,this.scope=Z,this.controller=new V.controllerConstructor(this),this.bindingObserver=new R1(this,this.dispatcher),this.valueObserver=new N1(this,this.controller),this.targetObserver=new Y1(this,this),this.outletObserver=new g1(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(I){this.handleError(I,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(V){this.handleError(V,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(V){this.handleError(V,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(V,Z,I={}){let{identifier:J,controller:G,element:K}=this;I=Object.assign({identifier:J,controller:G,element:K},I),this.application.handleError(V,`Error ${Z}`,I)}targetConnected(V,Z){this.invokeControllerMethod(`${Z}TargetConnected`,V)}targetDisconnected(V,Z){this.invokeControllerMethod(`${Z}TargetDisconnected`,V)}outletConnected(V,Z,I){this.invokeControllerMethod(`${g0(I)}OutletConnected`,V,Z)}outletDisconnected(V,Z,I){this.invokeControllerMethod(`${g0(I)}OutletDisconnected`,V,Z)}invokeControllerMethod(V,...Z){let I=this.controller;typeof I[V]=="function"&&I[V](...Z)}}function N3(V){return function(Z,I){let J=k3(Z),G=function(K,$){return Y3($).reduce((T,X)=>{let C=function(O,H,S){let j=Object.getOwnPropertyDescriptor(O,S);if(!j||!("value"in j)){let W=Object.getOwnPropertyDescriptor(H,S).value;return j&&(W.get=j.get||W.get,W.set=j.set||W.set),W}}(K,$,X);return C&&Object.assign(T,{[X]:C}),T},{})}(Z.prototype,I);return Object.defineProperties(J.prototype,G),J}(V,function(Z){return r(Z,"blessings").reduce((I,J)=>{let G=J(Z);for(let K in G){let $=I[K]||{};I[K]=Object.assign($,G[K])}return I},{})}(V))}var Y3=typeof Object.getOwnPropertySymbols=="function"?(V)=>[...Object.getOwnPropertyNames(V),...Object.getOwnPropertySymbols(V)]:Object.getOwnPropertyNames,k3=(()=>{function V(Z){function I(){return Reflect.construct(Z,arguments,new.target)}return I.prototype=Object.create(Z.prototype,{constructor:{value:I}}),Reflect.setPrototypeOf(I,Z),I}try{return function(){let Z=V(function(){this.a.call(this)});Z.prototype.a=function(){},new Z}(),V}catch(Z){return(I)=>class extends I{}}})();class h1{constructor(V,Z){this.application=V,this.definition=function(I){return{identifier:I.identifier,controllerConstructor:N3(I.controllerConstructor)}}(Z),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(V){let Z=this.fetchContextForScope(V);this.connectedContexts.add(Z),Z.connect()}disconnectContextForScope(V){let Z=this.contextsByScope.get(V);Z&&(this.connectedContexts.delete(Z),Z.disconnect())}fetchContextForScope(V){let Z=this.contextsByScope.get(V);return Z||(Z=new c1(this,V),this.contextsByScope.set(V,Z)),Z}}class x1{constructor(V){this.scope=V}has(V){return this.data.has(this.getDataKey(V))}get(V){return this.getAll(V)[0]}getAll(V){return(this.data.get(this.getDataKey(V))||"").match(/[^\s]+/g)||[]}getAttributeName(V){return this.data.getAttributeNameForKey(this.getDataKey(V))}getDataKey(V){return`${V}-class`}get data(){return this.scope.data}}class P1{constructor(V){this.scope=V}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(V){let Z=this.getAttributeNameForKey(V);return this.element.getAttribute(Z)}set(V,Z){let I=this.getAttributeNameForKey(V);return this.element.setAttribute(I,Z),this.get(V)}has(V){let Z=this.getAttributeNameForKey(V);return this.element.hasAttribute(Z)}delete(V){if(this.has(V)){let Z=this.getAttributeNameForKey(V);return this.element.removeAttribute(Z),!0}return!1}getAttributeNameForKey(V){return`data-${this.identifier}-${Q1(V)}`}}class p1{constructor(V){this.warnedKeysByObject=new WeakMap,this.logger=V}warn(V,Z,I){let J=this.warnedKeysByObject.get(V);J||(J=new Set,this.warnedKeysByObject.set(V,J)),J.has(Z)||(J.add(Z),this.logger.warn(I,V))}}function h0(V,Z){return`[${V}~="${Z}"]`}class m1{constructor(V){this.scope=V}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(V){return this.find(V)!=null}find(...V){return V.reduce((Z,I)=>Z||this.findTarget(I)||this.findLegacyTarget(I),void 0)}findAll(...V){return V.reduce((Z,I)=>[...Z,...this.findAllTargets(I),...this.findAllLegacyTargets(I)],[])}findTarget(V){let Z=this.getSelectorForTargetName(V);return this.scope.findElement(Z)}findAllTargets(V){let Z=this.getSelectorForTargetName(V);return this.scope.findAllElements(Z)}getSelectorForTargetName(V){return h0(this.schema.targetAttributeForScope(this.identifier),V)}findLegacyTarget(V){let Z=this.getLegacySelectorForTargetName(V);return this.deprecate(this.scope.findElement(Z),V)}findAllLegacyTargets(V){let Z=this.getLegacySelectorForTargetName(V);return this.scope.findAllElements(Z).map((I)=>this.deprecate(I,V))}getLegacySelectorForTargetName(V){let Z=`${this.identifier}.${V}`;return h0(this.schema.targetAttribute,Z)}deprecate(V,Z){if(V){let{identifier:I}=this,J=this.schema.targetAttribute,G=this.schema.targetAttributeForScope(I);this.guide.warn(V,`target:${Z}`,`Please replace ${J}="${I}.${Z}" with ${G}="${Z}". The ${J} attribute is deprecated and will be removed in a future version of Stimulus.`)}return V}get guide(){return this.scope.guide}}class u1{constructor(V,Z){this.scope=V,this.controllerElement=Z}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(V){return this.find(V)!=null}find(...V){return V.reduce((Z,I)=>Z||this.findOutlet(I),void 0)}findAll(...V){return V.reduce((Z,I)=>[...Z,...this.findAllOutlets(I)],[])}getSelectorForOutletName(V){let Z=this.schema.outletAttributeForScope(this.identifier,V);return this.controllerElement.getAttribute(Z)}findOutlet(V){let Z=this.getSelectorForOutletName(V);if(Z)return this.findElement(Z,V)}findAllOutlets(V){let Z=this.getSelectorForOutletName(V);return Z?this.findAllElements(Z,V):[]}findElement(V,Z){return this.scope.queryElements(V).filter((I)=>this.matchesElement(I,V,Z))[0]}findAllElements(V,Z){return this.scope.queryElements(V).filter((I)=>this.matchesElement(I,V,Z))}matchesElement(V,Z,I){let J=V.getAttribute(this.scope.schema.controllerAttribute)||"";return V.matches(Z)&&J.split(" ").includes(I)}}class d0{constructor(V,Z,I,J){this.targets=new m1(this),this.classes=new x1(this),this.data=new P1(this),this.containsElement=(G)=>G.closest(this.controllerSelector)===this.element,this.schema=V,this.element=Z,this.identifier=I,this.guide=new p1(J),this.outlets=new u1(this.documentScope,Z)}findElement(V){return this.element.matches(V)?this.element:this.queryElements(V).find(this.containsElement)}findAllElements(V){return[...this.element.matches(V)?[this.element]:[],...this.queryElements(V).filter(this.containsElement)]}queryElements(V){return Array.from(this.element.querySelectorAll(V))}get controllerSelector(){return h0(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new d0(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class d1{constructor(V,Z,I){this.element=V,this.schema=Z,this.delegate=I,this.valueListObserver=new u0(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(V){let{element:Z,content:I}=V;return this.parseValueForElementAndIdentifier(Z,I)}parseValueForElementAndIdentifier(V,Z){let I=this.fetchScopesByIdentifierForElement(V),J=I.get(Z);return J||(J=this.delegate.createScopeForElementAndIdentifier(V,Z),I.set(Z,J)),J}elementMatchedValue(V,Z){let I=(this.scopeReferenceCounts.get(Z)||0)+1;this.scopeReferenceCounts.set(Z,I),I==1&&this.delegate.scopeConnected(Z)}elementUnmatchedValue(V,Z){let I=this.scopeReferenceCounts.get(Z);I&&(this.scopeReferenceCounts.set(Z,I-1),I==1&&this.delegate.scopeDisconnected(Z))}fetchScopesByIdentifierForElement(V){let Z=this.scopesByIdentifierByElement.get(V);return Z||(Z=new Map,this.scopesByIdentifierByElement.set(V,Z)),Z}}class b1{constructor(V){this.application=V,this.scopeObserver=new d1(this.element,this.schema,this),this.scopesByIdentifier=new x,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((V,Z)=>V.concat(Z.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(V){this.unloadIdentifier(V.identifier);let Z=new h1(this.application,V);this.connectModule(Z);let I=V.controllerConstructor.afterLoad;I&&I.call(V.controllerConstructor,V.identifier,this.application)}unloadIdentifier(V){let Z=this.modulesByIdentifier.get(V);Z&&this.disconnectModule(Z)}getContextForElementAndIdentifier(V,Z){let I=this.modulesByIdentifier.get(Z);if(I)return I.contexts.find((J)=>J.element==V)}proposeToConnectScopeForElementAndIdentifier(V,Z){let I=this.scopeObserver.parseValueForElementAndIdentifier(V,Z);I?this.scopeObserver.elementMatchedValue(I.element,I):console.error(`Couldn't find or create scope for identifier: "${Z}" and element:`,V)}handleError(V,Z,I){this.application.handleError(V,Z,I)}createScopeForElementAndIdentifier(V,Z){return new d0(this.schema,V,Z,this.logger)}scopeConnected(V){this.scopesByIdentifier.add(V.identifier,V);let Z=this.modulesByIdentifier.get(V.identifier);Z&&Z.connectContextForScope(V)}scopeDisconnected(V){this.scopesByIdentifier.delete(V.identifier,V);let Z=this.modulesByIdentifier.get(V.identifier);Z&&Z.disconnectContextForScope(V)}connectModule(V){this.modulesByIdentifier.set(V.identifier,V),this.scopesByIdentifier.getValuesForKey(V.identifier).forEach((Z)=>V.connectContextForScope(Z))}disconnectModule(V){this.modulesByIdentifier.delete(V.identifier),this.scopesByIdentifier.getValuesForKey(V.identifier).forEach((Z)=>V.disconnectContextForScope(Z))}}var g3={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:(V)=>`data-${V}-target`,outletAttributeForScope:(V,Z)=>`data-${V}-${Z}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},F1("abcdefghijklmnopqrstuvwxyz".split("").map((V)=>[V,V]))),F1("0123456789".split("").map((V)=>[V,V])))};function F1(V){return V.reduce((Z,[I,J])=>Object.assign(Object.assign({},Z),{[I]:J}),{})}class b0{constructor(V=document.documentElement,Z=g3){this.logger=console,this.debug=!1,this.logDebugActivity=(I,J,G={})=>{this.debug&&this.logFormattedMessage(I,J,G)},this.element=V,this.schema=Z,this.dispatcher=new D1(this),this.router=new b1(this),this.actionDescriptorFilters=Object.assign({},w3)}static start(V,Z){let I=new this(V,Z);return I.start(),I}async start(){await new Promise((V)=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>V()):V()}),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(V,Z){this.load({identifier:V,controllerConstructor:Z})}registerActionOption(V,Z){this.actionDescriptorFilters[V]=Z}load(V,...Z){(Array.isArray(V)?V:[V,...Z]).forEach((I)=>{I.controllerConstructor.shouldLoad&&this.router.loadDefinition(I)})}unload(V,...Z){(Array.isArray(V)?V:[V,...Z]).forEach((I)=>this.router.unloadIdentifier(I))}get controllers(){return this.router.contexts.map((V)=>V.controller)}getControllerForElementAndIdentifier(V,Z){let I=this.router.getContextForElementAndIdentifier(V,Z);return I?I.controller:null}handleError(V,Z,I){var J;this.logger.error(`%s
31
+
32
+ %o
33
+
34
+ %o`,Z,V,I),(J=window.onerror)===null||J===void 0||J.call(window,Z,"",0,0,V)}logFormattedMessage(V,Z,I={}){I=Object.assign({application:this},I),this.logger.groupCollapsed(`${V} #${Z}`),this.logger.log("details:",Object.assign({},I)),this.logger.groupEnd()}}function j1(V,Z,I){return V.application.getControllerForElementAndIdentifier(Z,I)}function C1(V,Z,I){let J=j1(V,Z,I);return J||(V.application.router.proposeToConnectScopeForElementAndIdentifier(Z,I),J=j1(V,Z,I),J||void 0)}function L1([V,Z],I){return function(J){let{token:G,typeDefinition:K}=J,$=`${Q1(G)}-value`,T=function(X){let{controller:C,token:O,typeDefinition:H}=X,S=function(F){let{controller:B,token:A,typeObject:L}=F,q=A1(L.type),w=A1(L.default),M=q&&w,z=q&&!w,k=!q&&w,y=H0(L.type),h=s(F.typeObject.default);if(z)return y;if(k)return h;if(y!==h)throw Error(`The specified default value for the Stimulus Value "${B?`${B}.${A}`:A}" must match the defined type "${y}". The provided default value of "${L.default}" is of type "${h}".`);if(M)return y}({controller:C,token:O,typeObject:H}),j=s(H),W=H0(H),U=S||j||W;if(U)return U;throw Error(`Unknown value type "${C?`${C}.${H}`:O}" for "${O}" value`)}(J);return{type:T,key:$,name:x0($),get defaultValue(){return function(X){let C=H0(X);if(C)return M1[C];let O=c0(X,"default"),H=c0(X,"type"),S=X;if(O)return S.default;if(H){let{type:j}=S,W=H0(j);if(W)return M1[W]}return X}(K)},get hasCustomDefaultValue(){return s(K)!==void 0},reader:c3[T],writer:q1[T]||q1.default}}({controller:I,token:V,typeDefinition:Z})}function H0(V){switch(V){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function s(V){switch(typeof V){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(V)?"array":Object.prototype.toString.call(V)==="[object Object]"?"object":void 0}var M1={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},c3={array(V){let Z=JSON.parse(V);if(!Array.isArray(Z))throw TypeError(`expected value of type "array" but instead got value "${V}" of type "${s(Z)}"`);return Z},boolean:(V)=>!(V=="0"||String(V).toLowerCase()=="false"),number:(V)=>Number(V.replace(/_/g,"")),object(V){let Z=JSON.parse(V);if(Z===null||typeof Z!="object"||Array.isArray(Z))throw TypeError(`expected value of type "object" but instead got value "${V}" of type "${s(Z)}"`);return Z},string:(V)=>V},q1={default:function(V){return`${V}`},array:z1,object:z1};function z1(V){return JSON.stringify(V)}class R{constructor(V){this.context=V}static get shouldLoad(){return!0}static afterLoad(V,Z){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(V,{target:Z=this.element,detail:I={},prefix:J=this.identifier,bubbles:G=!0,cancelable:K=!0}={}){let $=new CustomEvent(J?`${J}:${V}`:V,{detail:I,bubbles:G,cancelable:K});return Z.dispatchEvent($),$}}R.blessings=[function(V){return r(V,"classes").reduce((Z,I)=>{return Object.assign(Z,{[`${J=I}Class`]:{get(){let{classes:G}=this;if(G.has(J))return G.get(J);{let K=G.getAttributeName(J);throw Error(`Missing attribute "${K}"`)}}},[`${J}Classes`]:{get(){return this.classes.getAll(J)}},[`has${n(J)}Class`]:{get(){return this.classes.has(J)}}});var J},{})},function(V){return r(V,"targets").reduce((Z,I)=>{return Object.assign(Z,{[`${J=I}Target`]:{get(){let G=this.targets.find(J);if(G)return G;throw Error(`Missing target element "${J}" for "${this.identifier}" controller`)}},[`${J}Targets`]:{get(){return this.targets.findAll(J)}},[`has${n(J)}Target`]:{get(){return this.targets.has(J)}}});var J},{})},function(V){let Z=R3(V,"values"),I={valueDescriptorMap:{get(){return Z.reduce((J,G)=>{let K=L1(G,this.identifier),$=this.data.getAttributeNameForKey(K.key);return Object.assign(J,{[$]:K})},{})}}};return Z.reduce((J,G)=>Object.assign(J,function(K,$){let T=L1(K,$),{key:X,name:C,reader:O,writer:H}=T;return{[C]:{get(){let S=this.data.get(X);return S!==null?O(S):T.defaultValue},set(S){S===void 0?this.data.delete(X):this.data.set(X,H(S))}},[`has${n(C)}`]:{get(){return this.data.has(X)||T.hasCustomDefaultValue}}}}(G)),I)},function(V){return r(V,"outlets").reduce((Z,I)=>Object.assign(Z,function(J){let G=g0(J);return{[`${G}Outlet`]:{get(){let K=this.outlets.find(J),$=this.outlets.getSelectorForOutletName(J);if(K){let T=C1(this,K,J);if(T)return T;throw Error(`The provided outlet element is missing an outlet controller "${J}" instance for host controller "${this.identifier}"`)}throw Error(`Missing outlet element "${J}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${$}".`)}},[`${G}Outlets`]:{get(){let K=this.outlets.findAll(J);return K.length>0?K.map(($)=>{let T=C1(this,$,J);if(T)return T;console.warn(`The provided outlet element is missing an outlet controller "${J}" instance for host controller "${this.identifier}"`,$)}).filter(($)=>$):[]}},[`${G}OutletElement`]:{get(){let K=this.outlets.find(J),$=this.outlets.getSelectorForOutletName(J);if(K)return K;throw Error(`Missing outlet element "${J}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${$}".`)}},[`${G}OutletElements`]:{get(){return this.outlets.findAll(J)}},[`has${n(G)}Outlet`]:{get(){return this.outlets.has(J)}}}}(I)),{})}],R.targets=[],R.outlets=[],R.values={};class v1 extends R{static targets=["activity","shortcutsDialog","tabs","tabContent","exceptionList","backtraceHidden","backtraceContent"];static values={shortcuts:Boolean};connect(){if(this.selectedIndex=-1,this.rows=[],this.showActivity=this.showActivity.bind(this),this.hideActivity=this.hideActivity.bind(this),document.addEventListener("turbo:before-fetch-request",this.showActivity),document.addEventListener("turbo:before-fetch-response",this.hideActivity),document.addEventListener("turbo:submit-end",this.hideActivity),this.shortcutsValue)this.boundKeydown=this.handleKeydown.bind(this),document.addEventListener("keydown",this.boundKeydown)}disconnect(){if(document.removeEventListener("turbo:before-fetch-request",this.showActivity),document.removeEventListener("turbo:before-fetch-response",this.hideActivity),document.removeEventListener("turbo:submit-end",this.hideActivity),this.boundKeydown)document.removeEventListener("keydown",this.boundKeydown)}handleKeydown(V){let Z=V.target.tagName.toLowerCase();if(Z==="input"||Z==="textarea"||Z==="select"){if(V.key==="Escape")V.target.blur(),V.preventDefault();return}switch(V.key){case"/":V.preventDefault(),this.focusSearch();break;case"j":case"ArrowDown":V.preventDefault(),this.navigateDown();break;case"k":case"ArrowUp":V.preventDefault(),this.navigateUp();break;case"Enter":V.preventDefault(),this.openSelected();break;case"p":case"ArrowLeft":V.preventDefault(),this.navigateToPrev();break;case"n":case"ArrowRight":V.preventDefault(),this.navigateToNext();break;case"t":V.preventDefault(),this.toggleTheme();break;case"Escape":V.preventDefault(),this.closeDetails(V),this.closeShortcuts();break;case"?":V.preventDefault(),this.toggleShortcuts();break;case"1":case"2":case"3":case"4":case"5":V.preventDefault(),this.switchTabByIndex(parseInt(V.key)-1);break}}focusSearch(){let V=this.element.querySelector(".rn-search .rn-input, input[type='search']");if(V)V.focus(),V.select()}refreshRows(){if(this.hasExceptionListTarget)this.rows=Array.from(this.exceptionListTarget.querySelectorAll("tr[data-url]"));else this.rows=Array.from(this.element.querySelectorAll("tr[data-url]"))}navigateDown(){if(this.refreshRows(),this.rows.length===0)return;this.selectedIndex=Math.min(this.selectedIndex+1,this.rows.length-1),this.highlightRow()}navigateUp(){if(this.refreshRows(),this.rows.length===0)return;this.selectedIndex=Math.max(this.selectedIndex-1,0),this.highlightRow()}highlightRow(){this.rows.forEach((Z,I)=>{Z.classList.toggle("selected",I===this.selectedIndex)});let V=this.rows[this.selectedIndex];if(V)V.scrollIntoView({block:"nearest",behavior:"smooth"})}openSelected(){if(this.refreshRows(),this.selectedIndex<0||this.selectedIndex>=this.rows.length)return;let V=this.rows[this.selectedIndex];if(V.dataset.url)this.selectRow({currentTarget:V,preventDefault:()=>{}})}selectRow(V){V.preventDefault();let Z=V.currentTarget,I=Z.dataset.url;if(!I)return;this.refreshRows(),this.rows.forEach((K)=>K.classList.remove("selected")),Z.classList.add("selected");let J=document.getElementById("exception-detail-desktop");if(J)J.hidden=!1,J.classList.remove("hidden");let G=document.getElementById("exception-details");if(G)G.innerHTML="",G.src=I}stopPropagation(V){V.stopPropagation()}closeDetails(V){V.preventDefault(),this.refreshRows(),this.rows.forEach((J)=>J.classList.remove("selected")),this.selectedIndex=-1;let Z=document.getElementById("exception-detail-desktop");if(Z)Z.hidden=!0,Z.classList.add("hidden");let I=document.getElementById("exception-details");if(I)I.innerHTML=`
35
+ <div class="text-center py-12">
36
+ <div class="w-10 h-10 rounded-full flex items-center justify-center mx-auto" style="background: var(--rn-bg-secondary)">
37
+ <svg class="w-5 h-5" style="color: var(--rn-text-muted)" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
38
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />
39
+ </svg>
40
+ </div>
41
+ <p class="mt-2 text-xs" style="color: var(--rn-text-muted)">Select an exception to view details</p>
42
+ <p class="mt-1 text-xs" style="color: var(--rn-text-muted)">Click a row or press <span class="rn-kbd">↓</span> <span class="rn-kbd">↑</span> to navigate</p>
43
+ </div>
44
+ `}switchTab(V){let Z=V.currentTarget.dataset.flTabParam||V.currentTarget.dataset.flTab;this.activateTab(Z)}switchTabByIndex(V){if(!this.hasTabsTarget)return;let Z=this.tabsTarget.querySelectorAll(".rn-tab");if(V>=0&&V<Z.length){let I=Z[V].dataset.flTabParam||Z[V].dataset.flTab;this.activateTab(I)}}activateTab(V){if(this.hasTabsTarget)this.tabsTarget.querySelectorAll(".rn-tab").forEach((Z)=>{let I=(Z.dataset.flTabParam||Z.dataset.flTab)===V;Z.classList.toggle("active",I)});this.tabContentTargets.forEach((Z)=>{let I=Z.dataset.flTabContent===V;Z.style.display=I?"":"none"})}toggleTheme(){let V=this.application.getControllerForElementAndIdentifier(document.documentElement,"rails_nexus-theme");if(V)V.toggle();else{let Z=document.documentElement,I=Z.classList.contains("dark");Z.classList.remove("dark","light"),Z.classList.add(I?"light":"dark"),localStorage.setItem("rails_nexus-theme",I?"light":"dark")}}toggleShortcuts(){if(!this.hasShortcutsDialogTarget)return;if(this.shortcutsDialogTarget.classList.contains("open"))this.closeShortcuts();else this.shortcutsDialogTarget.classList.add("open"),document.getElementById("rn-shortcuts-button")?.setAttribute("aria-expanded","true")}closeShortcuts(){if(this.hasShortcutsDialogTarget)this.shortcutsDialogTarget.classList.remove("open"),document.getElementById("rn-shortcuts-button")?.setAttribute("aria-expanded","false")}navigateToPrev(){let V=document.querySelector(".rn-nav-link[href*='logged_exceptions']");if(V&&V.querySelector(".rn-nav-link-label")?.textContent==="Previous")V.click()}navigateToNext(){let V=document.querySelectorAll(".rn-nav-link[href*='logged_exceptions']"),Z=Array.from(V).find((I)=>I.querySelector(".rn-nav-link-label")?.textContent==="Next");if(Z)Z.click()}copyId(V){let Z=V.currentTarget.dataset.rails_nexusIdValue;if(Z)this.copyToClipboard(Z,V.currentTarget)}copyMessage(V){let Z=V.currentTarget.dataset.rails_nexusMessageValue;if(Z)this.copyToClipboard(Z,V.currentTarget)}copyBacktrace(V){let Z=V.currentTarget.dataset.rails_nexusBacktraceValue;if(Z)this.copyToClipboard(Z,V.currentTarget)}async copyToClipboard(V,Z){try{await navigator.clipboard.writeText(V);let I=Z.innerHTML;Z.classList.add("copied"),Z.innerHTML='<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" /></svg> Copied!',setTimeout(()=>{Z.classList.remove("copied"),Z.innerHTML=I},2000)}catch(I){let J=document.createElement("textarea");J.value=V,J.style.position="fixed",J.style.opacity="0",document.body.appendChild(J),J.select(),document.execCommand("copy"),document.body.removeChild(J)}}expandBacktrace(V){V.preventDefault();let Z=this.backtraceHiddenTarget;if(Z)Z.style.display=Z.style.display==="none"?"":"none",V.currentTarget.textContent=Z.style.display==="none"?`Show ${Z.textContent.split(`
45
+ `).length} more frames`:"Hide additional frames"}submit(){this.showActivity();let V=this.element.querySelector("form[data-turbo-frame]");if(V)V.requestSubmit()}debouncedSubmit(V){clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this.submit()},400)}showActivity(){if(!this.hasActivityTarget)return;this.activityTarget.hidden=!1,this.activityTarget.classList.remove("hidden")}hideActivity(){if(!this.hasActivityTarget)return;this.activityTarget.hidden=!0,this.activityTarget.classList.add("hidden")}}class l1 extends R{static targets=["tabs","tabContent","backtraceContent","backtraceHidden","sourcePanel"];switchTab(V){let Z=V.params.tab||V.currentTarget.getAttribute("data-rn-tab-param");if(!Z)return;this.tabsTarget.querySelectorAll(".rn-tab").forEach((I)=>{let J=I.getAttribute("data-rn-tab-param")===Z;I.classList.toggle("active",J)}),this.tabContentTargets.forEach((I)=>{let J=I.getAttribute("data-rn-tab-content")===Z;I.style.display=J?"":"none"})}copyId(V){let Z=V.currentTarget.getAttribute("data-rails_nexus-detail-id-value")||V.currentTarget.dataset.rails_nexusDetailIdValue;if(Z)this.copyToClipboard(Z,V.currentTarget)}copyMessage(V){let Z=V.currentTarget.getAttribute("data-rails_nexus-detail-message-value")||V.currentTarget.dataset.rails_nexusDetailMessageValue;if(Z)this.copyToClipboard(Z,V.currentTarget)}copyBacktrace(V){let Z=V.currentTarget.getAttribute("data-rails_nexus-detail-backtrace-value")||V.currentTarget.dataset.rails_nexusDetailBacktraceValue;if(Z)this.copyToClipboard(Z,V.currentTarget)}async copyToClipboard(V,Z){try{await navigator.clipboard.writeText(V)}catch{let J=document.createElement("textarea");J.value=V,J.style.position="fixed",J.style.opacity="0",document.body.appendChild(J),J.select(),document.execCommand("copy"),document.body.removeChild(J)}let I=Z.innerHTML;Z.classList.add("copied"),Z.innerHTML='<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" /></svg> Copied!',setTimeout(()=>{Z.classList.remove("copied"),Z.innerHTML=I},2000)}expandBacktrace(V){V.preventDefault();let Z=this.backtraceHiddenTarget;if(Z)Z.style.display=Z.style.display==="none"?"":"none",V.currentTarget.textContent=Z.style.display==="none"?"Show more frames":"Hide additional frames"}toggleSource(V){V.preventDefault();let Z=V.currentTarget,I=Z.dataset.file,J=Z.dataset.line,G=this.sourcePanelTargets.find((K)=>K.dataset.file===I&&K.dataset.line===J);if(!G)return;if(G.style.display==="none"){G.style.display="";let K=G.querySelector(".rn-source-loading");if(K)K.style.display="";fetch(`/rails_nexus/source_code?file=${encodeURIComponent(I)}&line=${J}&context=5`,{headers:{Accept:"application/json"}}).then(($)=>$.json()).then(($)=>{if($.source)G.innerHTML=this.renderSourceSnippet($.source,$.blame);else G.innerHTML='<div class="text-xs" style="color: var(--rn-text-muted); padding: 0.5rem">Source not available</div>'}).catch(()=>{G.innerHTML='<div class="text-xs" style="color: var(--rn-text-muted); padding: 0.5rem">Failed to load source</div>'})}else G.style.display="none"}renderSourceSnippet(V,Z){let I='<div class="rn-source-code rounded" style="background: var(--rn-bg-primary); border: 1px solid var(--rn-border-light); overflow-x: auto; font-size: 0.75rem; font-family: monospace">';if(Z)I+='<div class="flex items-center gap-2 px-3 py-1.5" style="background: var(--rn-bg-secondary); border-bottom: 1px solid var(--rn-border-light); font-size: 0.7rem; color: var(--rn-text-muted)">',I+=`<span style="color: var(--rn-primary)">${Z.author||"unknown"}</span>`,I+="<span>·</span>",I+=`<span>${Z.date||""}</span>`,I+="<span>·</span>",I+=`<span style="color: var(--rn-text-muted)">${Z.message||""}</span>`,I+=`<span class="ml-auto font-mono" style="color: var(--rn-text-muted)">${Z.sha||""}</span>`,I+="</div>";return V.lines.forEach((J)=>{let G=J.is_error?"var(--rn-bg-warning-subtle)":"transparent";I+=`<div class="flex" style="background: ${G}; padding: 0 0.75rem">`,I+=`<span style="min-width: 2.5rem; text-align: right; color: var(--rn-text-muted); user-select: none; padding-right: 1rem">${J.number}</span>`,I+=`<span style="white-space: pre; color: var(--rn-text)">${(J.content||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</span>`,I+="</div>"}),I+="</div>",I}closeDetails(){let V=document.getElementById("exception-details");if(V)V.innerHTML=`
46
+ <div class="text-center py-12">
47
+ <div class="w-10 h-10 rounded-full flex items-center justify-center mx-auto" style="background: var(--rn-bg-secondary)">
48
+ <svg class="w-5 h-5" style="color: var(--rn-text-muted)" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
49
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />
50
+ </svg>
51
+ </div>
52
+ <p class="mt-2 text-xs" style="color: var(--rn-text-muted)">Select an exception to view details</p>
53
+ <p class="mt-1 text-xs" style="color: var(--rn-text-muted)">Click a row or press <span class="rn-kbd">↓</span> <span class="rn-kbd">↑</span> to navigate</p>
54
+ </div>
55
+ `;document.querySelectorAll(".rn-table tbody tr.selected").forEach((Z)=>Z.classList.remove("selected"))}}class o1 extends R{static targets=["drawer","overlay","sidebar","toggleButton"];connect(){if(this.handleResize=this.syncButtonState.bind(this),window.addEventListener("resize",this.handleResize),this.desktop()&&this.sidebarHidden())this.sidebarTarget.classList.add("is-hidden");this.syncButtonState()}disconnect(){window.removeEventListener("resize",this.handleResize)}toggle(){if(this.desktop()){let V=this.sidebarTarget.classList.toggle("is-hidden");this.storeSidebarState(V)}else{let V=!this.drawerTarget.classList.contains("open");this.drawerTarget.classList.toggle("open",V),this.overlayTarget.classList.toggle("open",V)}this.syncButtonState()}close(){this.drawerTarget.classList.remove("open"),this.overlayTarget.classList.remove("open"),this.syncButtonState()}desktop(){return window.matchMedia("(min-width: 1024px)").matches}sidebarHidden(){try{return localStorage.getItem("rails_nexus-sidebar-hidden")==="true"}catch(V){return!1}}storeSidebarState(V){try{localStorage.setItem("rails_nexus-sidebar-hidden",V.toString())}catch(Z){}}syncButtonState(){if(!this.hasToggleButtonTarget)return;let V=this.desktop()?!this.sidebarTarget.classList.contains("is-hidden"):this.drawerTarget.classList.contains("open");this.toggleButtonTarget.setAttribute("aria-expanded",V.toString()),this.toggleButtonTarget.setAttribute("aria-label",V?"Hide navigation":"Show navigation"),this.toggleButtonTarget.title=V?"Hide navigation":"Show navigation"}closeOtherMenus(V){let Z=V.currentTarget;if(!Z.open)return;let I=Z.closest(".rn-sidebar-nav");if(!I)return;I.querySelectorAll("details.rn-nav-section[open]").forEach((J)=>{if(J!==Z)J.open=!1})}toggleShortcuts(V){let Z=document.querySelector("[data-rails_nexus-target='shortcutsDialog']");if(!Z)return;let I=!Z.classList.contains("open");if(Z.classList.toggle("open",I),V.currentTarget.setAttribute("aria-expanded",I.toString()),I)Z.querySelector("button")?.focus()}}class a1 extends R{static values={theme:String};connect(){let V=localStorage.getItem("rails_nexus-theme");if(V)this.applyTheme(V);else if(this.themeValue&&this.themeValue!=="auto")this.applyTheme(this.themeValue);else{let Z=window.matchMedia("(prefers-color-scheme: dark)").matches;this.applyTheme(Z?"dark":"light")}}toggle(){let I=document.documentElement.classList.contains("dark")?"light":"dark";this.applyTheme(I)}applyTheme(V){let Z=document.documentElement;Z.classList.remove("dark","light"),Z.classList.add(V),localStorage.setItem("rails_nexus-theme",V)}}async function O4(){if(window.Turbo)return;let V=await Promise.resolve().then(() => (F3(),U3));window.Turbo=V.Turbo}var S0=window.Stimulus?.register?window.Stimulus:window.RailsNexusStimulus||=b0.start();S0.debug=!1;S0.register("rails_nexus",v1);S0.register("rails_nexus-theme",a1);S0.register("rails_nexus-sidebar",o1);S0.register("rails_nexus-detail",l1);O4();})();
@@ -43,16 +43,89 @@
43
43
  // ═══════════════════════════════════════════════════════════════
44
44
 
45
45
  class RailsNexusSidebarController {
46
- static get targets() { return ["drawer", "overlay"] }
46
+ static get targets() { return ["drawer", "overlay", "sidebar", "toggleButton"] }
47
+
48
+ connect() {
49
+ this.handleResize = this.syncButtonState.bind(this)
50
+ window.addEventListener("resize", this.handleResize)
51
+
52
+ if (this.desktop() && this.sidebarHidden() && this.hasSidebarTarget) {
53
+ this.sidebarTarget.classList.add("is-hidden")
54
+ }
55
+
56
+ this.syncButtonState()
57
+ }
58
+
59
+ disconnect() {
60
+ window.removeEventListener("resize", this.handleResize)
61
+ }
47
62
 
48
63
  toggle() {
49
- if (this.hasDrawerTarget) this.drawerTarget.classList.toggle("open")
50
- if (this.hasOverlayTarget) this.overlayTarget.classList.toggle("open")
64
+ if (this.desktop()) {
65
+ if (this.hasSidebarTarget) {
66
+ var hidden = this.sidebarTarget.classList.toggle("is-hidden")
67
+ this.storeSidebarState(hidden)
68
+ }
69
+ } else if (this.hasDrawerTarget) {
70
+ var opening = !this.drawerTarget.classList.contains("open")
71
+ this.drawerTarget.classList.toggle("open", opening)
72
+ if (this.hasOverlayTarget) this.overlayTarget.classList.toggle("open", opening)
73
+ }
74
+
75
+ this.syncButtonState()
51
76
  }
52
77
 
53
78
  close() {
54
79
  if (this.hasDrawerTarget) this.drawerTarget.classList.remove("open")
55
80
  if (this.hasOverlayTarget) this.overlayTarget.classList.remove("open")
81
+ this.syncButtonState()
82
+ }
83
+
84
+ desktop() {
85
+ return window.matchMedia("(min-width: 1024px)").matches
86
+ }
87
+
88
+ sidebarHidden() {
89
+ try {
90
+ return localStorage.getItem("rails_nexus-sidebar-hidden") === "true"
91
+ } catch (_error) {
92
+ return false
93
+ }
94
+ }
95
+
96
+ storeSidebarState(hidden) {
97
+ try {
98
+ localStorage.setItem("rails_nexus-sidebar-hidden", hidden.toString())
99
+ } catch (_error) {
100
+ // The toggle still works when storage is unavailable.
101
+ }
102
+ }
103
+
104
+ syncButtonState() {
105
+ if (!this.hasToggleButtonTarget) return
106
+
107
+ var expanded
108
+ if (this.desktop()) {
109
+ expanded = this.hasSidebarTarget && !this.sidebarTarget.classList.contains("is-hidden")
110
+ } else {
111
+ expanded = this.hasDrawerTarget && this.drawerTarget.classList.contains("open")
112
+ }
113
+
114
+ this.toggleButtonTarget.setAttribute("aria-expanded", expanded.toString())
115
+ this.toggleButtonTarget.setAttribute("aria-label", expanded ? "Hide navigation" : "Show navigation")
116
+ this.toggleButtonTarget.title = expanded ? "Hide navigation" : "Show navigation"
117
+ }
118
+
119
+ closeOtherMenus(event) {
120
+ var currentMenu = event.currentTarget
121
+ if (!currentMenu.open) return
122
+
123
+ var navigation = currentMenu.closest(".rn-sidebar-nav")
124
+ if (!navigation) return
125
+
126
+ navigation.querySelectorAll("details.rn-nav-section[open]").forEach(function(menu) {
127
+ if (menu !== currentMenu) menu.open = false
128
+ })
56
129
  }
57
130
 
58
131
  toggleShortcuts(event) {
@@ -393,11 +466,15 @@
393
466
  // ─── Loading State ────────────────────────────────────────
394
467
 
395
468
  showActivity() {
396
- if (this.hasActivityTarget) this.activityTarget.classList.remove("hidden")
469
+ if (!this.hasActivityTarget) return
470
+ this.activityTarget.hidden = false
471
+ this.activityTarget.classList.remove("hidden")
397
472
  }
398
473
 
399
474
  hideActivity() {
400
- if (this.hasActivityTarget) this.activityTarget.classList.add("hidden")
475
+ if (!this.hasActivityTarget) return
476
+ this.activityTarget.hidden = true
477
+ this.activityTarget.classList.add("hidden")
401
478
  }
402
479
  }
403
480