together-theme 0.0.16 → 0.0.19
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.
- checksums.yaml +4 -4
- data/_includes/article_nav.html +19 -3
- data/_includes/footer.html +1 -0
- data/_includes/sidebar.html +2 -2
- data/_js/index.js +78 -4
- data/_layouts/default.html +2 -0
- data/_sass/_article.scss +79 -0
- data/_sass/_layout.scss +1 -1
- data/assets/js/main.js +5 -5
- data/together-theme.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b136257f78bfb1a9ca16cb840f9cdd8c45b23f9ba30189c71261177981fe33
|
4
|
+
data.tar.gz: c840a8fb1c6402922b152d747ef30da5acdadc7ad02a5bf4b65858fda271fc60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18339447a6209ba5093e36aae9d016341de12c03a4ab180e387193a043b407c681302d3f33a768ea408d177a77c6abd038a17814b4bdd7ed8245f94177cdc757
|
7
|
+
data.tar.gz: 7e03270e7f1b22bc9f7305559e746228bfd872c7b0d3dd6b30330f078246fc603e88e3206526b629573b49803f26f6aec932ed7213a514ee80ac3e99bd65ca98
|
data/_includes/article_nav.html
CHANGED
@@ -1,15 +1,31 @@
|
|
1
1
|
<nav>
|
2
|
-
<
|
2
|
+
<div id="toc-wrapper">
|
3
|
+
<div id="toc-overlay"></div>
|
4
|
+
|
5
|
+
<div id="toc">
|
6
|
+
<h3>
|
7
|
+
<a href="{{ '/' | relative_url }}">
|
8
|
+
{{site.title}}
|
9
|
+
</a>
|
10
|
+
</h3>
|
11
|
+
|
12
|
+
<h4>{{page.title}}</h4>
|
13
|
+
|
14
|
+
<div id="toc-content"></div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<a href="{{ '/' | relative_url }}" id="toc-opener">
|
3
19
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
4
20
|
<path fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd" />
|
5
21
|
</svg>
|
6
22
|
</a>
|
7
23
|
|
8
|
-
{% if page.previous.url %}
|
24
|
+
<!-- {% if page.previous.url %}
|
9
25
|
<a href="{{page.previous.url}}">
|
10
26
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
11
27
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
|
12
28
|
</svg>
|
13
29
|
</a>
|
14
|
-
{% endif %}
|
30
|
+
{% endif %} -->
|
15
31
|
</nav>
|
@@ -0,0 +1 @@
|
|
1
|
+
footer.html
|
data/_includes/sidebar.html
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<aside>
|
2
|
-
{% if page.next.url %}
|
2
|
+
<!-- {% if page.next.url %}
|
3
3
|
<p class="next-article">
|
4
4
|
» Next<br>
|
5
5
|
<a class="next" href="{{page.next.url}}">
|
@@ -13,7 +13,7 @@
|
|
13
13
|
{{page.previous.title}}
|
14
14
|
</a>
|
15
15
|
</p>
|
16
|
-
{% endif %}
|
16
|
+
{% endif %} -->
|
17
17
|
|
18
18
|
<p>
|
19
19
|
{{site.together.sidebar.content}}
|
data/_js/index.js
CHANGED
@@ -86,15 +86,89 @@ const addSmoothChapterTransitions = ($children) => {
|
|
86
86
|
}, false)
|
87
87
|
}
|
88
88
|
|
89
|
-
const
|
89
|
+
const buildTOCItem = (textOnly) => {
|
90
|
+
return (item) => {
|
91
|
+
let output = '<li>'
|
92
|
+
|
93
|
+
if (textOnly) {
|
94
|
+
output += item.$el.innerText
|
95
|
+
} else {
|
96
|
+
output += `<a href="#${item.$el.id}">${item.$el.innerText}</a>`
|
97
|
+
}
|
98
|
+
|
99
|
+
if (item.children.length) {
|
100
|
+
output += `<ul>${item.children.map(buildTOCItem(true)).join('')}</ul>`
|
101
|
+
}
|
102
|
+
|
103
|
+
output += '</li>'
|
104
|
+
|
105
|
+
return output
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
const findHeadingParentForLevel = (newLevel, currentHeading) => {
|
110
|
+
while (currentHeading.level >= newLevel) {
|
111
|
+
currentHeading = currentHeading.parent
|
112
|
+
}
|
113
|
+
|
114
|
+
return currentHeading
|
115
|
+
}
|
116
|
+
|
117
|
+
const addTableOfContents = ($toc, $headings) => {
|
118
|
+
const root = { $el: $toc, children: [], level: 0 }
|
119
|
+
let currentHeading = root
|
120
|
+
|
121
|
+
$headings.forEach(($heading) => {
|
122
|
+
const newLevel = parseInt($heading.tagName.replace('H', ''))
|
123
|
+
const newHeading = { $el: $heading, children: [], level: newLevel, parent: currentHeading }
|
124
|
+
|
125
|
+
if (newLevel > currentHeading.level) {
|
126
|
+
currentHeading.children.push(newHeading)
|
127
|
+
currentHeading = newHeading
|
128
|
+
} else {
|
129
|
+
currentHeading = findHeadingParentForLevel(newLevel, currentHeading)
|
130
|
+
currentHeading.children.push(newHeading)
|
131
|
+
currentHeading = newHeading
|
132
|
+
}
|
133
|
+
})
|
134
|
+
|
135
|
+
$toc.innerHTML = `<ul>${root.children.map(buildTOCItem()).join('')}</ul>`
|
136
|
+
}
|
137
|
+
|
138
|
+
const listener = ($tocWrapper, preventDefault) => {
|
139
|
+
return (event) => {
|
140
|
+
if (preventDefault) {
|
141
|
+
event.preventDefault()
|
142
|
+
}
|
143
|
+
|
144
|
+
if ($tocWrapper.style.display === 'block') {
|
145
|
+
$tocWrapper.style.display = ''
|
146
|
+
} else {
|
147
|
+
$tocWrapper.style.display = 'block'
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
const tocToggler = ($tocWrapper, $tocOpener) => {
|
152
|
+
$tocOpener.addEventListener('click', listener($tocWrapper, true))
|
153
|
+
$tocWrapper.addEventListener('click', listener($tocWrapper), true)
|
154
|
+
}
|
155
|
+
|
156
|
+
const init = () => {
|
90
157
|
const $content = document.querySelector('main')
|
91
|
-
const $
|
158
|
+
const $chapters = [...$content.querySelectorAll('h2')]
|
159
|
+
addProgressBars($chapters)
|
92
160
|
|
93
|
-
|
161
|
+
const $toc = document.getElementById('toc-content')
|
162
|
+
const $headings = [...$content.querySelectorAll('h2, h3')]
|
163
|
+
addTableOfContents($toc, $headings)
|
94
164
|
|
95
165
|
const $children = [...$content.childNodes]
|
96
166
|
addSmoothChapterTransitions($children)
|
97
167
|
selectSection($children, window.location.hash.replace(/#/g, '') || $content.querySelector('h2').id)
|
168
|
+
|
169
|
+
const $tocWrapper = document.getElementById('toc-wrapper')
|
170
|
+
const $tocOpener = document.getElementById('toc-opener')
|
171
|
+
tocToggler($tocWrapper, $tocOpener)
|
98
172
|
}
|
99
173
|
|
100
|
-
document.addEventListener('turbo:load',
|
174
|
+
document.addEventListener('turbo:load', init)
|
data/_layouts/default.html
CHANGED
data/_sass/_article.scss
CHANGED
@@ -182,3 +182,82 @@ button, .button {
|
|
182
182
|
background: var(--link-color);
|
183
183
|
}
|
184
184
|
}
|
185
|
+
|
186
|
+
#toc-wrapper {
|
187
|
+
display: none;
|
188
|
+
}
|
189
|
+
|
190
|
+
#toc {
|
191
|
+
position: fixed;
|
192
|
+
top: 0;
|
193
|
+
width: 20rem;
|
194
|
+
bottom: 0;
|
195
|
+
left: 0;
|
196
|
+
overflow: auto;
|
197
|
+
-webkit-overflow-scrolling: touch;
|
198
|
+
background: var(--bg-color);
|
199
|
+
padding: var(--padding-xl);
|
200
|
+
color: var(--text-subtle);
|
201
|
+
border-right: 3px solid var(--text-supersubtle);
|
202
|
+
z-index: 9999;
|
203
|
+
font-family: var(--sans-serif);
|
204
|
+
line-height: var(--line-height);
|
205
|
+
|
206
|
+
@media (max-width: 640px) {
|
207
|
+
width: auto;
|
208
|
+
right: 10%;
|
209
|
+
}
|
210
|
+
|
211
|
+
h3 {
|
212
|
+
font-weight: var(--emphasis);
|
213
|
+
}
|
214
|
+
|
215
|
+
h4 {
|
216
|
+
margin-bottom: var(--padding-xl);
|
217
|
+
}
|
218
|
+
|
219
|
+
p {
|
220
|
+
font-size: var(--text-sm);
|
221
|
+
margin-bottom: var(--padding-xl);
|
222
|
+
}
|
223
|
+
|
224
|
+
ul {
|
225
|
+
li {
|
226
|
+
margin-bottom: var(--padding);
|
227
|
+
|
228
|
+
a {
|
229
|
+
margin-bottom: 0;
|
230
|
+
color: var(--text-brilliant);
|
231
|
+
|
232
|
+
&:hover {
|
233
|
+
color: var(--link-color);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
ul {
|
238
|
+
list-style: lower-roman;
|
239
|
+
|
240
|
+
li {
|
241
|
+
margin-left: 25px;
|
242
|
+
margin-bottom: var(--padding-sm);
|
243
|
+
font-size: var(--text-sm);
|
244
|
+
|
245
|
+
a {
|
246
|
+
color: var(--text-subtle);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
#toc-overlay {
|
255
|
+
position: fixed;
|
256
|
+
top: 0;
|
257
|
+
right: 0;
|
258
|
+
bottom: 0;
|
259
|
+
left: 0;
|
260
|
+
background: var(--bg-color);
|
261
|
+
opacity: 0.8;
|
262
|
+
z-index: 9998;
|
263
|
+
}
|
data/_sass/_layout.scss
CHANGED
data/assets/js/main.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
(()=>{(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let s=HTMLElement,e={HTMLElement:function(){return Reflect.construct(s,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=s.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,s)})();(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,r){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,r,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+r+".",n)}})(HTMLFormElement.prototype);var G=new WeakMap;function
|
1
|
+
(()=>{(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let s=HTMLElement,e={HTMLElement:function(){return Reflect.construct(s,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=s.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,s)})();(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(i){i?(e(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function e(i,r){i instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||t(TypeError,"The specified element is not a submit button"),i.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(i,r,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+r+".",n)}})(HTMLFormElement.prototype);var G=new WeakMap;function Pe(s){let e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function ke(s){let e=Pe(s.target);e&&e.form&&G.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))s=window.SubmitEvent.prototype;else{if("SubmitEvent"in window)return;s=window.Event.prototype}addEventListener("click",ke,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return G.get(this.target)}})})();var w;(function(s){s.eager="eager",s.lazy="lazy"})(w||(w={}));var g=class extends HTMLElement{constructor(){super();this.loaded=Promise.resolve(),this.delegate=new g.delegateConstructor(this)}static get observedAttributes(){return["disabled","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){let{src:e}=this;this.src=null,this.src=e}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return Ie(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}};function Ie(s){switch(s.toLowerCase()){case"lazy":return w.lazy;default:return w.eager}}function c(s){return new URL(s.toString(),document.baseURI)}function S(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function V(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return c(t)}function Me(s){return(Oe(s).match(/\.[^.]*$/)||[])[0]||""}function Fe(s){return!!Me(s).match(/^(?:|\.(?:htm|html|xhtml))$/)}function qe(s,e){let t=De(e);return s.href===c(t).href||s.href.startsWith(t)}function C(s,e){return qe(s,e)&&Fe(s)}function O(s){let e=S(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function P(s){return O(s)}function He(s,e){return c(s).href==c(e).href}function Be(s){return s.pathname.split("/").slice(1)}function Oe(s){return Be(s).slice(-1)[0]}function De(s){return Ne(s.origin+s.pathname)}function Ne(s){return s.endsWith("/")?s:s+"/"}var W=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return c(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function h(s,{target:e,cancelable:t,detail:i}={}){let r=new CustomEvent(s,{cancelable:t,bubbles:!0,detail:i});return e&&e.isConnected?e.dispatchEvent(r):document.documentElement.dispatchEvent(r),r}function k(){return new Promise(s=>requestAnimationFrame(()=>s()))}function Ve(){return new Promise(s=>setTimeout(()=>s(),0))}function We(){return Promise.resolve()}function Z(s=""){return new DOMParser().parseFromString(s,"text/html")}function ee(s,...e){let t=xe(s,e).replace(/^\n/,"").split(`
|
2
2
|
`),i=t[0].match(/^\s+/),r=i?i[0].length:0;return t.map(n=>n.slice(r)).join(`
|
3
|
-
`)}function We(s,e){return s.reduce((t,i,r)=>{let n=e[r]==null?"":e[r];return t+i+n},"")}function A(){return Array.apply(null,{length:36}).map((s,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function I(s,...e){for(let t of e.map(i=>i?.getAttribute(s)))if(typeof t=="string")return t;return null}function O(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function N(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}var a;(function(s){s[s.get=0]="get",s[s.post=1]="post",s[s.put=2]="put",s[s.patch=3]="patch",s[s.delete=4]="delete"})(a||(a={}));function Ve(s){switch(s.toLowerCase()){case"get":return a.get;case"post":return a.post;case"put":return a.put;case"patch":return a.patch;case"delete":return a.delete}}var M=class{constructor(e,t,i,r=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=r,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){var e,t;let{fetchOptions:i}=this;(t=(e=this.delegate).prepareHeadersForRequest)===null||t===void 0||t.call(e,this.headers,this),await this.allowRequestToBeIntercepted(i);try{this.delegate.requestStarted(this);let r=await fetch(this.url.href,i);return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new V(e);return h("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:a[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isIdempotent?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isIdempotent(){return this.method==a.get}get abortSignal(){return this.abortController.signal}async allowRequestToBeIntercepted(e){let t=new Promise(r=>this.resolveRequestPromise=r);h("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}},te=class{constructor(e,t){this.started=!1,this.intersect=i=>{let r=i.slice(-1)[0];r?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},L=class{constructor(e){this.templateElement=document.createElement("template"),this.templateElement.innerHTML=e}static wrap(e){return typeof e=="string"?new this(e):e}get fragment(){let e=document.createDocumentFragment();for(let t of this.foreignElements)e.appendChild(document.importNode(t,!0));return e}get foreignElements(){return this.templateChildren.reduce((e,t)=>t.tagName.toLowerCase()=="turbo-stream"?[...e,t]:e,[])}get templateChildren(){return Array.from(this.templateElement.content.children)}};L.contentType="text/vnd.turbo-stream.html";var v;(function(s){s[s.initialized=0]="initialized",s[s.requesting=1]="requesting",s[s.waiting=2]="waiting",s[s.receiving=3]="receiving",s[s.stopping=4]="stopping",s[s.stopped=5]="stopped"})(v||(v={}));var b;(function(s){s.urlEncoded="application/x-www-form-urlencoded",s.multipart="multipart/form-data",s.plain="text/plain"})(b||(b={}));function xe(s){switch(s.toLowerCase()){case b.multipart:return b.multipart;case b.plain:return b.plain;default:return b.urlEncoded}}var R=class{constructor(e,t,i,r=!1){this.state=v.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=Ue(t,i),this.location=c(this.action),this.method==a.get&&$e(this.location,[...this.body.entries()]),this.fetchRequest=new M(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=r}static confirmMethod(e,t){return confirm(e)}get method(){var e;let t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return Ve(t.toLowerCase())||a.get}get action(){var e;let t=typeof this.formElement.action=="string"?this.formElement.action:null;return((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formaction"))||this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==b.urlEncoded||this.method==a.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return xe(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isIdempotent(){return this.fetchRequest.isIdempotent}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}get confirmationMessage(){return this.formElement.getAttribute("data-turbo-confirm")}get needsConfirmation(){return this.confirmationMessage!==null}async start(){let{initialized:e,requesting:t}=v;if(!(this.needsConfirmation&&!R.confirmMethod(this.confirmationMessage,this.formElement))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=v;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareHeadersForRequest(e,t){if(!t.isIdempotent){let i=_e(K("csrf-param"))||K("csrf-token");i&&(e["X-CSRF-Token"]=i),e.Accept=[L.contentType,e.Accept].join(", ")}}requestStarted(e){var t;this.state=v.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),h("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&je(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=v.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=v.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),h("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}requestMustRedirect(e){return!e.isIdempotent&&this.mustRedirect}};function Ue(s,e){let t=new FormData(s),i=e?.getAttribute("name"),r=e?.getAttribute("value");return i&&r!=null&&t.get(i)!=r&&t.append(i,r),t}function _e(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(s));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function K(s){let e=document.querySelector(`meta[name="${s}"]`);return e&&e.content}function je(s){return s.statusCode==200&&!s.redirected}function $e(s,e){let t=new URLSearchParams;for(let[i,r]of e)r instanceof File||t.append(i,r);return s.search=t.toString(),s}var T=class{constructor(e){this.element=e}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return this.element.querySelector("[autofocus]")}get permanentElements(){return[...this.element.querySelectorAll("[id][data-turbo-permanent]")]}getPermanentElementById(e){return this.element.querySelector(`#${e}[data-turbo-permanent]`)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:r}=i,n=e.getPermanentElementById(r);n&&(t[r]=[i,n])}return t}},x=class{constructor(e,t){this.submitBubbled=i=>{let r=i.target;if(!i.defaultPrevented&&r instanceof HTMLFormElement&&r.closest("turbo-frame, html")==this.element){let n=i.submitter||void 0;(n?.getAttribute("formmethod")||r.method)!="dialog"&&this.delegate.shouldInterceptFormSubmission(r,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmissionIntercepted(r,n))}},this.delegate=e,this.element=t}start(){this.element.addEventListener("submit",this.submitBubbled)}stop(){this.element.removeEventListener("submit",this.submitBubbled)}},U=class{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(S(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:i,newSnapshot:r}=e;if(i)try{this.renderPromise=new Promise(m=>this.resolveRenderPromise=m),this.renderer=e,this.prepareToRenderSnapshot(e);let n=new Promise(m=>this.resolveInterceptionPromise=m);this.delegate.allowsImmediateRender(r,this.resolveInterceptionPromise)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(r,t),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate()}invalidate(){this.delegate.viewInvalidated()}prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},se=class extends U{invalidate(){this.element.innerHTML=""}get snapshot(){return new T(this.element)}},_=class{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url)),delete this.clickEvent},this.willVisit=()=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},ie=class{constructor(e){this.permanentElementMap=e}static preservingPermanentElements(e,t){let i=new this(e);i.enter(),t(),i.leave()}enter(){for(let e in this.permanentElementMap){let[,t]=this.permanentElementMap[e];this.replaceNewPermanentElementWithPlaceholder(t)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=ze(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function ze(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var F=class{constructor(e,t,i,r=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=r,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}createScriptElement(e){if(e.getAttribute("data-turbo-eval")=="false")return e;{let t=document.createElement("script");return this.cspNonce&&(t.nonce=this.cspNonce),t.textContent=e.textContent,t.async=!1,Ke(t,e),t}}preservingPermanentElements(e){ie.preservingPermanentElements(this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;Qe(e)&&e.focus()}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 cspNonce(){var e;return(e=document.head.querySelector('meta[name="csp-nonce"]'))===null||e===void 0?void 0:e.getAttribute("content")}};function Ke(s,e){for(let{name:t,value:i}of[...e.attributes])s.setAttribute(t,i)}function Qe(s){return s&&typeof s.focus=="function"}var re=class extends F{get shouldRender(){return!0}async render(){await k(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await k(),this.focusFirstAutofocusableElement(),await k(),this.activateScriptElements()}loadFrameElement(){var e;let t=document.createRange();t.selectNodeContents(this.currentElement),t.deleteContents();let i=this.newElement,r=(e=i.ownerDocument)===null||e===void 0?void 0:e.createRange();r&&(r.selectNodeContents(i),this.currentElement.appendChild(r.extractContents()))}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Xe(this.currentElement.getAttribute("data-autoscroll-block"),"end");if(e)return e.scrollIntoView({block:t}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Xe(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}var u=class{constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return ee`
|
3
|
+
`)}function xe(s,e){return s.reduce((t,i,r)=>{let n=e[r]==null?"":e[r];return t+i+n},"")}function T(){return Array.apply(null,{length:36}).map((s,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function I(s,...e){for(let t of e.map(i=>i?.getAttribute(s)))if(typeof t=="string")return t;return null}function D(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function N(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}var a;(function(s){s[s.get=0]="get",s[s.post=1]="post",s[s.put=2]="put",s[s.patch=3]="patch",s[s.delete=4]="delete"})(a||(a={}));function Ue(s){switch(s.toLowerCase()){case"get":return a.get;case"post":return a.post;case"put":return a.put;case"patch":return a.patch;case"delete":return a.delete}}var M=class{constructor(e,t,i,r=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.body=r,this.url=i,this.target=n}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){var e,t;let{fetchOptions:i}=this;(t=(e=this.delegate).prepareHeadersForRequest)===null||t===void 0||t.call(e,this.headers,this),await this.allowRequestToBeIntercepted(i);try{this.delegate.requestStarted(this);let r=await fetch(this.url.href,i);return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new W(e);return h("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:a[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isIdempotent?null:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isIdempotent(){return this.method==a.get}get abortSignal(){return this.abortController.signal}async allowRequestToBeIntercepted(e){let t=new Promise(r=>this.resolveRequestPromise=r);h("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await t}},te=class{constructor(e,t){this.started=!1,this.intersect=i=>{let r=i.slice(-1)[0];r?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},L=class{constructor(e){this.templateElement=document.createElement("template"),this.templateElement.innerHTML=e}static wrap(e){return typeof e=="string"?new this(e):e}get fragment(){let e=document.createDocumentFragment();for(let t of this.foreignElements)e.appendChild(document.importNode(t,!0));return e}get foreignElements(){return this.templateChildren.reduce((e,t)=>t.tagName.toLowerCase()=="turbo-stream"?[...e,t]:e,[])}get templateChildren(){return Array.from(this.templateElement.content.children)}};L.contentType="text/vnd.turbo-stream.html";var v;(function(s){s[s.initialized=0]="initialized",s[s.requesting=1]="requesting",s[s.waiting=2]="waiting",s[s.receiving=3]="receiving",s[s.stopping=4]="stopping",s[s.stopped=5]="stopped"})(v||(v={}));var b;(function(s){s.urlEncoded="application/x-www-form-urlencoded",s.multipart="multipart/form-data",s.plain="text/plain"})(b||(b={}));function _e(s){switch(s.toLowerCase()){case b.multipart:return b.multipart;case b.plain:return b.plain;default:return b.urlEncoded}}var R=class{constructor(e,t,i,r=!1){this.state=v.initialized,this.delegate=e,this.formElement=t,this.submitter=i,this.formData=je(t,i),this.location=c(this.action),this.method==a.get&&Ke(this.location,[...this.body.entries()]),this.fetchRequest=new M(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=r}static confirmMethod(e,t){return confirm(e)}get method(){var e;let t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return Ue(t.toLowerCase())||a.get}get action(){var e;let t=typeof this.formElement.action=="string"?this.formElement.action:null;return((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formaction"))||this.formElement.getAttribute("action")||t||""}get body(){return this.enctype==b.urlEncoded||this.method==a.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return _e(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isIdempotent(){return this.fetchRequest.isIdempotent}get stringFormData(){return[...this.formData].reduce((e,[t,i])=>e.concat(typeof i=="string"?[[t,i]]:[]),[])}get confirmationMessage(){return this.formElement.getAttribute("data-turbo-confirm")}get needsConfirmation(){return this.confirmationMessage!==null}async start(){let{initialized:e,requesting:t}=v;if(!(this.needsConfirmation&&!R.confirmMethod(this.confirmationMessage,this.formElement))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=v;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareHeadersForRequest(e,t){if(!t.isIdempotent){let i=$e(K("csrf-param"))||K("csrf-token");i&&(e["X-CSRF-Token"]=i),e.Accept=[L.contentType,e.Accept].join(", ")}}requestStarted(e){var t;this.state=v.waiting,(t=this.submitter)===null||t===void 0||t.setAttribute("disabled",""),h("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&ze(t)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=v.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){var t;this.state=v.stopped,(t=this.submitter)===null||t===void 0||t.removeAttribute("disabled"),h("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}requestMustRedirect(e){return!e.isIdempotent&&this.mustRedirect}};function je(s,e){let t=new FormData(s),i=e?.getAttribute("name"),r=e?.getAttribute("value");return i&&r!=null&&t.get(i)!=r&&t.append(i,r),t}function $e(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(s));if(t){let i=t.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function K(s){let e=document.querySelector(`meta[name="${s}"]`);return e&&e.content}function ze(s){return s.statusCode==200&&!s.redirected}function Ke(s,e){let t=new URLSearchParams;for(let[i,r]of e)r instanceof File||t.append(i,r);return s.search=t.toString(),s}var A=class{constructor(e){this.element=e}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return this.element.querySelector("[autofocus]")}get permanentElements(){return[...this.element.querySelectorAll("[id][data-turbo-permanent]")]}getPermanentElementById(e){return this.element.querySelector(`#${e}[data-turbo-permanent]`)}getPermanentElementMapForSnapshot(e){let t={};for(let i of this.permanentElements){let{id:r}=i,n=e.getPermanentElementById(r);n&&(t[r]=[i,n])}return t}},x=class{constructor(e,t){this.submitBubbled=i=>{let r=i.target;if(!i.defaultPrevented&&r instanceof HTMLFormElement&&r.closest("turbo-frame, html")==this.element){let n=i.submitter||void 0;(n?.getAttribute("formmethod")||r.method)!="dialog"&&this.delegate.shouldInterceptFormSubmission(r,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmissionIntercepted(r,n))}},this.delegate=e,this.element=t}start(){this.element.addEventListener("submit",this.submitBubbled)}stop(){this.element.removeEventListener("submit",this.submitBubbled)}},U=class{constructor(e,t){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(S(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:i,newSnapshot:r}=e;if(i)try{this.renderPromise=new Promise(m=>this.resolveRenderPromise=m),this.renderer=e,this.prepareToRenderSnapshot(e);let n=new Promise(m=>this.resolveInterceptionPromise=m);this.delegate.allowsImmediateRender(r,this.resolveInterceptionPromise)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(r,t),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate()}invalidate(){this.delegate.viewInvalidated()}prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},se=class extends U{invalidate(){this.element.innerHTML=""}get snapshot(){return new A(this.element)}},_=class{constructor(e,t){this.clickBubbled=i=>{this.respondsToEventTarget(i.target)?this.clickEvent=i:delete this.clickEvent},this.linkClicked=i=>{this.clickEvent&&this.respondsToEventTarget(i.target)&&i.target instanceof Element&&this.delegate.shouldInterceptLinkClick(i.target,i.detail.url)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url)),delete this.clickEvent},this.willVisit=()=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},ie=class{constructor(e){this.permanentElementMap=e}static preservingPermanentElements(e,t){let i=new this(e);i.enter(),t(),i.leave()}enter(){for(let e in this.permanentElementMap){let[,t]=this.permanentElementMap[e];this.replaceNewPermanentElementWithPlaceholder(t)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Qe(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let t=this.getPlaceholderById(e.id);t?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Qe(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var F=class{constructor(e,t,i,r=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=r,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}createScriptElement(e){if(e.getAttribute("data-turbo-eval")=="false")return e;{let t=document.createElement("script");return this.cspNonce&&(t.nonce=this.cspNonce),t.textContent=e.textContent,t.async=!1,Xe(t,e),t}}preservingPermanentElements(e){ie.preservingPermanentElements(this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;Ye(e)&&e.focus()}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 cspNonce(){var e;return(e=document.head.querySelector('meta[name="csp-nonce"]'))===null||e===void 0?void 0:e.getAttribute("content")}};function Xe(s,e){for(let{name:t,value:i}of[...e.attributes])s.setAttribute(t,i)}function Ye(s){return s&&typeof s.focus=="function"}var re=class extends F{get shouldRender(){return!0}async render(){await k(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await k(),this.focusFirstAutofocusableElement(),await k(),this.activateScriptElements()}loadFrameElement(){var e;let t=document.createRange();t.selectNodeContents(this.currentElement),t.deleteContents();let i=this.newElement,r=(e=i.ownerDocument)===null||e===void 0?void 0:e.createRange();r&&(r.selectNodeContents(i),this.currentElement.appendChild(r.extractContents()))}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Je(this.currentElement.getAttribute("data-autoscroll-block"),"end");if(e)return e.scrollIntoView({block:t}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Je(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}var u=class{constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return ee`
|
4
4
|
.turbo-progress-bar {
|
5
5
|
position: fixed;
|
6
6
|
display: block;
|
@@ -14,7 +14,7 @@
|
|
14
14
|
opacity ${u.animationDuration/2}ms ${u.animationDuration/2}ms ease-in;
|
15
15
|
transform: translate3d(0, 0, 0);
|
16
16
|
}
|
17
|
-
`}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,u.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,u.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=u.defaultCSS,e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}};u.animationDuration=300;var ne=class extends T{constructor(){super(...arguments);this.detailsByOuterHTML=this.children.filter(e=>!Ze(e)).map(e=>st(e)).reduce((e,t)=>{let{outerHTML:i}=t,r=i in e?e[i]:{type:Ye(t),tracked:Je(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},r),{elements:[...r.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:r,elements:n}=this.detailsByOuterHTML[t];return i==null&&!r?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{let{elements:[r]}=this.detailsByOuterHTML[i];return tt(r,e)?r:t},void 0)}};function Ye(s){if(Ge(s))return"script";if(et(s))return"stylesheet"}function Je(s){return s.getAttribute("data-turbo-track")=="reload"}function Ge(s){return s.tagName.toLowerCase()=="script"}function Ze(s){return s.tagName.toLowerCase()=="noscript"}function et(s){let e=s.tagName.toLowerCase();return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function tt(s,e){return s.tagName.toLowerCase()=="meta"&&s.getAttribute("name")==e}function st(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}var f=class extends T{constructor(e,t){super(e);this.headSnapshot=t}static fromHTMLString(e=""){return this.fromDocument(Z(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new ne(e))}clone(){return new f(this.element.cloneNode(!0),this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return c(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},y;(function(s){s.visitStart="visitStart",s.requestStart="requestStart",s.requestEnd="requestEnd",s.visitEnd="visitEnd"})(y||(y={}));var d;(function(s){s.initialized="initialized",s.started="started",s.canceled="canceled",s.failed="failed",s.completed="completed"})(d||(d={}));var it={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0},E;(function(s){s[s.networkFailure=0]="networkFailure",s[s.timeoutFailure=-1]="timeoutFailure",s[s.contentTypeMismatch=-2]="contentTypeMismatch"})(E||(E={}));var oe=class{constructor(e,t,i,r={}){this.identifier=A(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.snapshotCached=!1,this.state=d.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||A();let{action:n,historyChanged:o,referrer:m,snapshotHTML:q,response:H,visitCachedSnapshot:B,willRender:z}=Object.assign(Object.assign({},it),r);this.action=n,this.historyChanged=o,this.referrer=m,this.snapshotHTML=q,this.response=H,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=B,this.willRender=z,this.scrolled=!z}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==d.initialized&&(this.recordTimingMetric(y.visitStart),this.state=d.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==d.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=d.canceled)}complete(){this.state==d.started&&(this.recordTimingMetric(y.visitEnd),this.state=d.completed,this.adapter.visitCompleted(this),this.delegate.visitCompleted(this),this.followRedirect())}fail(){this.state==d.started&&(this.state=d.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged){let t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=this.getHistoryMethodForAction(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new M(this,a.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(y.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Q(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(y.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Q(e)&&t!=null?(await this.view.renderPage(f.fromHTMLString(t),!1,this.willRender),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(f.fromHTMLString(t)),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!S(this.location)||e.hasAnchor(S(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return f.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&((e=this.response)===null||e===void 0?void 0:e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.adapter.visitRendered(this)})}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:E.contentTypeMismatch,redirected:r}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:r}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:E.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:E.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=S(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot().then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame,this.performScroll()}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Q(s){return s>=200&&s<300}var ae=class{constructor(e){this.progressBar=new u,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,A(),t)}visitStarted(e){e.loadCachedSnapshot(),e.issueRequest(),e.changeHistory(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case E.networkFailure:case E.timeoutFailure:case E.contentTypeMismatch:return this.reload();default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(){this.reload()}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(){window.location.reload()}get navigator(){return this.session.navigator}},le=class{constructor(){this.started=!1}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeStaleElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeStaleElements,!1))}removeStaleElements(){let e=[...document.querySelectorAll('[data-turbo-cache="false"]')];for(let t of e)t.remove()}},ce=class{constructor(e){this.started=!1,this.submitCaptured=()=>{removeEventListener("submit",this.submitBubbled,!1),addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=t=>{if(!t.defaultPrevented){let i=t.target instanceof HTMLFormElement?t.target:void 0,r=t.submitter||void 0;i&&(r?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"&&this.delegate.willSubmitForm(i,r)&&(t.preventDefault(),this.delegate.formSubmitted(i,r))}},this.delegate=e}start(){this.started||(addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}},he=class{constructor(e){this.element=e,this.linkInterceptor=new _(this,e),this.formInterceptor=new x(this,e)}start(){this.linkInterceptor.start(),this.formInterceptor.start()}stop(){this.linkInterceptor.stop(),this.formInterceptor.stop()}shouldInterceptLinkClick(e,t){return this.shouldRedirect(e)}linkClickIntercepted(e,t){let i=this.findFrameElement(e);i&&i.delegate.linkClickIntercepted(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldSubmit(e,t)}formSubmissionIntercepted(e,t){let i=this.findFrameElement(e,t);i&&(i.removeAttribute("reloadable"),i.delegate.formSubmissionIntercepted(e,t))}shouldSubmit(e,t){var i;let r=W(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=c((i=n?.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&C(r,o)}shouldRedirect(e,t){let i=this.findFrameElement(e,t);return i?i!=e.closest("turbo-frame"):!1}findFrameElement(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let r=this.element.querySelector(`#${i}:not([disabled])`);if(r instanceof g)return r}}},de=class{constructor(e){this.restorationIdentifier=A(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){let{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);let{restorationIdentifier:r}=i;this.restorationIdentifier=r,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,r)}}},this.onPageLoad=async t=>{await Ne(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=A()){let r={turbo:{restorationIdentifier:i}};e.call(history,r,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},ue=class{constructor(e){this.started=!1,this.clickCaptured=()=>{removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=t=>{if(this.clickEventIsSignificant(t)){let i=t.composedPath&&t.composedPath()[0]||t.target,r=this.findLinkFromClickTarget(i);if(r){let n=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,n)&&(t.preventDefault(),this.delegate.followedLinkToLocation(r,n))}}},this.delegate=e}start(){this.started||(addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){if(e instanceof Element)return e.closest("a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return c(e.getAttribute("href")||"")}};function j(s){return s=="advance"||s=="replace"||s=="restore"}var me=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(C(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new oe(this,c(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new R(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let i=await t.responseHTML;if(i){e.method!=a.get&&this.view.clearSnapshotCache();let{statusCode:r,redirected:n}=t,m={action:this.getActionForFormSubmission(e),response:{statusCode:r,responseHTML:i,redirected:n}};this.proposeVisit(t.location,m)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let r=f.fromHTMLString(i);t.serverError?await this.view.renderError(r):await this.view.renderPage(r),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let i=S(e),r=S(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&D(e)===D(this.view.lastRenderedLocation)&&(n||i!=null&&i!==r)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission(e){let{formElement:t,submitter:i}=e,r=I("data-turbo-action",i,t);return j(r)?r:"advance"}},p;(function(s){s[s.initial=0]="initial",s[s.loading=1]="loading",s[s.interactive=2]="interactive",s[s.complete=3]="complete"})(p||(p={}));var pe=class{constructor(e){this.stage=p.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==p.initial&&(this.stage=p.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==p.loading&&(this.stage=p.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==p.interactive&&(this.stage=p.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},fe=class{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}},ge=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{let i=rt(t);i&&nt(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(new L(e))}};function rt(s){var e;let t=(e=s.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof V)return t}function nt(s){var e;return((e=s.contentType)!==null&&e!==void 0?e:"").startsWith(L.contentType)}var ve=class extends F{async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t,body:i}=document;e.replaceChild(this.newHead,t),e.replaceChild(this.newElement,i)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=this.createScriptElement(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return[...document.documentElement.querySelectorAll("script")]}},$=class extends F{get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}prepareToRender(){this.mergeHead()}async render(){this.willRender&&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}mergeHead(){this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()}replaceBody(){this.preservingPermanentElements(()=>{this.activateNewBody(),this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}copyNewHeadStylesheetElements(){for(let e of this.newHeadStylesheetElements)document.head.appendChild(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(this.createScriptElement(e))}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}assignNewBody(){document.body&&this.newElement instanceof HTMLBodyElement?document.body.replaceWith(this.newElement):document.documentElement.appendChild(this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},be=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return P(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[P(e)]}write(e,t){this.snapshots[P(e)]=t}touch(e){let t=P(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},we=class extends U{constructor(){super(...arguments);this.snapshotCache=new be(10),this.lastRenderedLocation=new URL(location.href)}renderPage(e,t=!1,i=!0){let r=new $(this.snapshot,e,t,i);return this.render(r)}renderError(e){let t=new ve(this.snapshot,e,!1);return this.render(t)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(){if(this.shouldCacheSnapshot){this.delegate.viewWillCacheSnapshot();let{snapshot:e,lastRenderedLocation:t}=this;await Oe();let i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return f.fromElement(this.element)}get shouldCacheSnapshot(){return this.snapshot.isCacheable}},Ee=class{constructor(){this.navigator=new me(this),this.history=new de(this),this.view=new we(this,document.documentElement),this.adapter=new ae(this),this.pageObserver=new pe(this),this.cacheObserver=new le,this.linkClickObserver=new ue(this),this.formSubmitObserver=new ce(this),this.scrollObserver=new fe(this),this.streamObserver=new ge(this),this.frameRedirector=new he(document.documentElement),this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){this.navigator.proposeVisit(c(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){document.documentElement.appendChild(L.wrap(e).fragment)}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willFollowLinkToLocation(e,t){return this.elementDriveEnabled(e)&&C(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t)}followedLinkToLocation(e,t){let i=this.getActionForLink(e);this.convertLinkWithMethodClickToFormSubmission(e)||this.visit(t.href,{action:i})}convertLinkWithMethodClickToFormSubmission(e){let t=e.getAttribute("data-turbo-method");if(t){let i=document.createElement("form");i.method=t,i.action=e.getAttribute("href")||"undefined",i.hidden=!0,e.hasAttribute("data-turbo-confirm")&&i.setAttribute("data-turbo-confirm",e.getAttribute("data-turbo-confirm"));let r=this.getTargetFrameForLink(e);return r?(i.setAttribute("data-turbo-frame",r),i.addEventListener("turbo:submit-start",()=>i.remove())):i.addEventListener("submit",()=>i.remove()),document.body.appendChild(i),h("submit",{cancelable:!0,target:i})}else return!1}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){X(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){X(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=W(e,t);return this.elementDriveEnabled(e)&&(!t||this.elementDriveEnabled(t))&&C(c(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){return!this.notifyApplicationBeforeRender(e,t).defaultPrevented}viewRenderedSnapshot(e,t){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}viewInvalidated(){this.adapter.pageInvalidated()}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t){return!this.notifyApplicationAfterClickingLinkToLocation(e,t).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t){return h("turbo:click",{target:e,detail:{url:t.href},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return h("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return O(document.documentElement),h("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return h("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return h("turbo:before-render",{detail:{newBody:e,resume:t},cancelable:!0})}notifyApplicationAfterRender(){return h("turbo:render")}notifyApplicationAfterPageLoad(e={}){return N(document.documentElement),h("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return h("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return h("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}elementDriveEnabled(e){let t=e?.closest("[data-turbo]");return this.drive?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){let t=e.getAttribute("data-turbo-action");return j(t)?t:"advance"}getTargetFrameForLink(e){let t=e.getAttribute("data-turbo-frame");if(t)return t;{let i=e.closest("turbo-frame");if(i)return i.id}}get snapshot(){return this.view.snapshot}};function X(s){Object.defineProperties(s,ot)}var ot={absoluteURL:{get(){return this.toString()}}},l=new Ee,{navigator:at}=l;function Se(){l.start()}function lt(s){l.registerAdapter(s)}function ct(s,e){l.visit(s,e)}function ht(s){l.connectStreamSource(s)}function dt(s){l.disconnectStreamSource(s)}function ut(s){l.renderStreamMessage(s)}function mt(){l.clearCache()}function pt(s){l.setProgressBarDelay(s)}function ft(s){R.confirmMethod=s}var gt=Object.freeze({__proto__:null,navigator:at,session:l,PageRenderer:$,PageSnapshot:f,start:Se,registerAdapter:lt,visit:ct,connectStreamSource:ht,disconnectStreamSource:dt,renderStreamMessage:ut,clearCache:mt,setProgressBarDelay:pt,setConfirmMethod:ft}),ye=class{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.settingSourceURL=!1,this.element=e,this.view=new se(this,this.element),this.appearanceObserver=new te(this,this.element),this.linkInterceptor=new _(this,this.element),this.formInterceptor=new x(this,this.element)}connect(){this.connected||(this.connected=!0,this.reloadable=!1,this.loadingStyle==w.lazy&&this.appearanceObserver.start(),this.linkInterceptor.start(),this.formInterceptor.start(),this.sourceURLChanged())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.linkInterceptor.stop(),this.formInterceptor.stop())}disabledChanged(){this.loadingStyle==w.eager&&this.loadSourceURL()}sourceURLChanged(){(this.loadingStyle==w.eager||this.hasBeenLoaded)&&this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==w.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){if(!this.settingSourceURL&&this.enabled&&this.isActive&&(this.reloadable||this.sourceURL!=this.currentURL)){let e=this.currentURL;if(this.currentURL=this.sourceURL,this.sourceURL)try{this.element.loaded=this.visit(c(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0}catch(t){throw this.currentURL=e,t}}}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let{body:i}=Z(t),r=new T(await this.extractForeignFrameElement(i)),n=new re(this.view.snapshot,r,!1,!1);this.view.renderPromise&&await this.view.renderPromise,await this.view.render(n),l.frameRendered(e,this.element),l.frameLoaded(this.element),this.fetchResponseLoaded(e)}}catch(t){console.error(t),this.view.invalidate()}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.loadSourceURL()}shouldInterceptLinkClick(e,t){return e.hasAttribute("data-turbo-method")?!1:this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.reloadable=!0,this.navigateFrame(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldInterceptNavigation(e,t)}formSubmissionIntercepted(e,t){this.formSubmission&&this.formSubmission.stop(),this.reloadable=!1,this.formSubmission=new R(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareHeadersForRequest(i.headers,i),this.formSubmission.start()}prepareHeadersForRequest(e,t){e["Turbo-Frame"]=this.id}requestStarted(e){O(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestFailedWithResponse(e,t){console.error(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){N(this.element)}formSubmissionStarted({formElement:e}){O(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){let i=this.findFrameElement(e.formElement,e.submitter);this.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t)}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t)}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){N(e,this.findFrameElement(e))}allowsImmediateRender(e,t){return!0}viewRenderedSnapshot(e,t){}viewInvalidated(){}async visit(e){var t;let i=new M(this,a.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(r=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,r()},i.perform()})}navigateFrame(e,t,i){let r=this.findFrameElement(e,i);this.proposeVisitIfNavigatedWithAction(r,e,i),r.setAttribute("reloadable",""),r.src=t}proposeVisitIfNavigatedWithAction(e,t,i){let r=I("data-turbo-action",i,t,e);if(j(r)){let{visitCachedSnapshot:n}=new Le(e);e.delegate.fetchResponseLoaded=o=>{if(e.src){let{statusCode:m,redirected:q}=o,H=e.ownerDocument.documentElement.outerHTML,B={statusCode:m,redirected:q,responseHTML:H};l.visit(e.src,{action:r,response:B,visitCachedSnapshot:n,willRender:!1})}}}}findFrameElement(e,t){var i;let r=I("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=Y(r))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=J(e.querySelector(`turbo-frame#${i}`),this.currentURL))return t;if(t=J(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.currentURL))return await t.loaded,await this.extractForeignFrameElement(t);console.error(`Response has no matching <turbo-frame id="${i}"> element`)}catch(r){console.error(r)}return new g}formActionIsVisitable(e,t){let i=W(e,t);return C(c(i),this.rootLocation)}shouldInterceptNavigation(e,t){let i=I("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){let r=Y(i);if(r)return!r.disabled}return!(!l.elementDriveEnabled(e)||t&&!l.elementDriveEnabled(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}get reloadable(){return this.findFrameElement(this.element).hasAttribute("reloadable")}set reloadable(e){let t=this.findFrameElement(this.element);e?t.setAttribute("reloadable",""):t.removeAttribute("reloadable")}set sourceURL(e){this.settingSourceURL=!0,this.element.src=e??null,this.currentURL=this.element.src,this.settingSourceURL=!1}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t?.content)!==null&&e!==void 0?e:"/";return c(i)}},Le=class{constructor(e){this.visitCachedSnapshot=({element:t})=>{var i;let{id:r,clone:n}=this;(i=t.querySelector("#"+r))===null||i===void 0||i.replaceWith(n)},this.clone=e.cloneNode(!0),this.id=e.id}};function Y(s){if(s!=null){let e=document.getElementById(s);if(e instanceof g)return e}}function J(s,e){if(s){let t=s.getAttribute("src");if(t!=null&&e!=null&&Fe(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof g)return s.connectedCallback(),s.disconnectedCallback(),s}}var vt={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})}},Re=class extends HTMLElement{async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{this.dispatchEvent(this.beforeRenderEvent)&&(await k(),this.performAction())})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),i=[...(e=this.templateContent)===null||e===void 0?void 0:e.children].filter(r=>!!r.id).map(r=>r.id);return t.filter(r=>i.includes(r.id))}get performAction(){if(this.action){let e=vt[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0})}get targetElementsById(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}};g.delegateConstructor=ye;customElements.define("turbo-frame",g);customElements.define("turbo-stream",Re);(()=>{let s=document.currentScript;if(!!s&&!s.hasAttribute("data-turbo-suppress-warning")){for(;s=s.parentElement;)if(s==document.body)return console.warn(ee`
|
17
|
+
`}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,u.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,u.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=u.defaultCSS,e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}};u.animationDuration=300;var ne=class extends A{constructor(){super(...arguments);this.detailsByOuterHTML=this.children.filter(e=>!tt(e)).map(e=>rt(e)).reduce((e,t)=>{let{outerHTML:i}=t,r=i in e?e[i]:{type:Ge(t),tracked:Ze(t),elements:[]};return Object.assign(Object.assign({},e),{[i]:Object.assign(Object.assign({},r),{elements:[...r.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in t.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==e).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:i,tracked:r,elements:n}=this.detailsByOuterHTML[t];return i==null&&!r?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,i)=>{let{elements:[r]}=this.detailsByOuterHTML[i];return it(r,e)?r:t},void 0)}};function Ge(s){if(et(s))return"script";if(st(s))return"stylesheet"}function Ze(s){return s.getAttribute("data-turbo-track")=="reload"}function et(s){return s.tagName.toLowerCase()=="script"}function tt(s){return s.tagName.toLowerCase()=="noscript"}function st(s){let e=s.tagName.toLowerCase();return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function it(s,e){return s.tagName.toLowerCase()=="meta"&&s.getAttribute("name")==e}function rt(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}var f=class extends A{constructor(e,t){super(e);this.headSnapshot=t}static fromHTMLString(e=""){return this.fromDocument(Z(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new ne(e))}clone(){return new f(this.element.cloneNode(!0),this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return c(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},y;(function(s){s.visitStart="visitStart",s.requestStart="requestStart",s.requestEnd="requestEnd",s.visitEnd="visitEnd"})(y||(y={}));var d;(function(s){s.initialized="initialized",s.started="started",s.canceled="canceled",s.failed="failed",s.completed="completed"})(d||(d={}));var nt={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0},E;(function(s){s[s.networkFailure=0]="networkFailure",s[s.timeoutFailure=-1]="timeoutFailure",s[s.contentTypeMismatch=-2]="contentTypeMismatch"})(E||(E={}));var oe=class{constructor(e,t,i,r={}){this.identifier=T(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.snapshotCached=!1,this.state=d.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=i||T();let{action:n,historyChanged:o,referrer:m,snapshotHTML:q,response:H,visitCachedSnapshot:B,willRender:z}=Object.assign(Object.assign({},nt),r);this.action=n,this.historyChanged=o,this.referrer=m,this.snapshotHTML=q,this.response=H,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=B,this.willRender=z,this.scrolled=!z}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==d.initialized&&(this.recordTimingMetric(y.visitStart),this.state=d.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==d.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=d.canceled)}complete(){this.state==d.started&&(this.recordTimingMetric(y.visitEnd),this.state=d.completed,this.adapter.visitCompleted(this),this.delegate.visitCompleted(this),this.followRedirect())}fail(){this.state==d.started&&(this.state=d.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged){let t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,i=this.getHistoryMethodForAction(t);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new M(this,a.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(y.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Q(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(y.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Q(e)&&t!=null?(await this.view.renderPage(f.fromHTMLString(t),!1,this.willRender),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(f.fromHTMLString(t)),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!S(this.location)||e.hasAnchor(S(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return f.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t,this.willRender),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){var e;this.redirectedToLocation&&!this.followedRedirect&&((e=this.response)===null||e===void 0?void 0:e.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.adapter.visitRendered(this)})}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:E.contentTypeMismatch,redirected:r}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:r}))}async requestFailedWithResponse(e,t){let i=await t.responseHTML,{redirected:r,statusCode:n}=t;i==null?this.recordResponse({statusCode:E.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:n,responseHTML:i,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:E.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=S(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot().then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame,this.performScroll()}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Q(s){return s>=200&&s<300}var ae=class{constructor(e){this.progressBar=new u,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,T(),t)}visitStarted(e){e.loadCachedSnapshot(),e.issueRequest(),e.changeHistory(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case E.networkFailure:case E.timeoutFailure:case E.contentTypeMismatch:return this.reload();default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(){this.reload()}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(){window.location.reload()}get navigator(){return this.session.navigator}},le=class{constructor(){this.started=!1}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeStaleElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeStaleElements,!1))}removeStaleElements(){let e=[...document.querySelectorAll('[data-turbo-cache="false"]')];for(let t of e)t.remove()}},ce=class{constructor(e){this.started=!1,this.submitCaptured=()=>{removeEventListener("submit",this.submitBubbled,!1),addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=t=>{if(!t.defaultPrevented){let i=t.target instanceof HTMLFormElement?t.target:void 0,r=t.submitter||void 0;i&&(r?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"&&this.delegate.willSubmitForm(i,r)&&(t.preventDefault(),this.delegate.formSubmitted(i,r))}},this.delegate=e}start(){this.started||(addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}},he=class{constructor(e){this.element=e,this.linkInterceptor=new _(this,e),this.formInterceptor=new x(this,e)}start(){this.linkInterceptor.start(),this.formInterceptor.start()}stop(){this.linkInterceptor.stop(),this.formInterceptor.stop()}shouldInterceptLinkClick(e,t){return this.shouldRedirect(e)}linkClickIntercepted(e,t){let i=this.findFrameElement(e);i&&i.delegate.linkClickIntercepted(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldSubmit(e,t)}formSubmissionIntercepted(e,t){let i=this.findFrameElement(e,t);i&&(i.removeAttribute("reloadable"),i.delegate.formSubmissionIntercepted(e,t))}shouldSubmit(e,t){var i;let r=V(e,t),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=c((i=n?.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(e,t)&&C(r,o)}shouldRedirect(e,t){let i=this.findFrameElement(e,t);return i?i!=e.closest("turbo-frame"):!1}findFrameElement(e,t){let i=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(i&&i!="_top"){let r=this.element.querySelector(`#${i}:not([disabled])`);if(r instanceof g)return r}}},de=class{constructor(e){this.restorationIdentifier=T(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){let{turbo:i}=t.state||{};if(i){this.location=new URL(window.location.href);let{restorationIdentifier:r}=i;this.restorationIdentifier=r,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,r)}}},this.onPageLoad=async t=>{await We(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,i=T()){let r={turbo:{restorationIdentifier:i}};e.call(history,r,"",t.href),this.location=t,this.restorationIdentifier=i}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,i=this.restorationData[t];this.restorationData[t]=Object.assign(Object.assign({},i),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},ue=class{constructor(e){this.started=!1,this.clickCaptured=()=>{removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=t=>{if(this.clickEventIsSignificant(t)){let i=t.composedPath&&t.composedPath()[0]||t.target,r=this.findLinkFromClickTarget(i);if(r){let n=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,n)&&(t.preventDefault(),this.delegate.followedLinkToLocation(r,n))}}},this.delegate=e}start(){this.started||(addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){if(e instanceof Element)return e.closest("a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return c(e.getAttribute("href")||"")}};function j(s){return s=="advance"||s=="replace"||s=="restore"}var me=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&(C(e,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(e,t):window.location.href=e.toString())}startVisit(e,t,i={}){this.stop(),this.currentVisit=new oe(this,c(e),t,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new R(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let i=await t.responseHTML;if(i){e.method!=a.get&&this.view.clearSnapshotCache();let{statusCode:r,redirected:n}=t,m={action:this.getActionForFormSubmission(e),response:{statusCode:r,responseHTML:i,redirected:n}};this.proposeVisit(t.location,m)}}}async formSubmissionFailedWithResponse(e,t){let i=await t.responseHTML;if(i){let r=f.fromHTMLString(i);t.serverError?await this.view.renderError(r):await this.view.renderPage(r),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let i=S(e),r=S(this.view.lastRenderedLocation),n=t==="restore"&&typeof i>"u";return t!=="replace"&&O(e)===O(this.view.lastRenderedLocation)&&(n||i!=null&&i!==r)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission(e){let{formElement:t,submitter:i}=e,r=I("data-turbo-action",i,t);return j(r)?r:"advance"}},p;(function(s){s[s.initial=0]="initial",s[s.loading=1]="loading",s[s.interactive=2]="interactive",s[s.complete=3]="complete"})(p||(p={}));var pe=class{constructor(e){this.stage=p.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==p.initial&&(this.stage=p.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==p.loading&&(this.stage=p.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==p.interactive&&(this.stage=p.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},fe=class{constructor(e){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(e){this.delegate.scrollPositionChanged(e)}},ge=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{let i=ot(t);i&&at(i)&&(t.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(new L(e))}};function ot(s){var e;let t=(e=s.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof W)return t}function at(s){var e;return((e=s.contentType)!==null&&e!==void 0?e:"").startsWith(L.contentType)}var ve=class extends F{async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t,body:i}=document;e.replaceChild(this.newHead,t),e.replaceChild(this.newElement,i)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let i=this.createScriptElement(e);t.replaceChild(i,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return[...document.documentElement.querySelectorAll("script")]}},$=class extends F{get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}prepareToRender(){this.mergeHead()}async render(){this.willRender&&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}mergeHead(){this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()}replaceBody(){this.preservingPermanentElements(()=>{this.activateNewBody(),this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}copyNewHeadStylesheetElements(){for(let e of this.newHeadStylesheetElements)document.head.appendChild(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(this.createScriptElement(e))}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}assignNewBody(){document.body&&this.newElement instanceof HTMLBodyElement?document.body.replaceWith(this.newElement):document.documentElement.appendChild(this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},be=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return P(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[P(e)]}write(e,t){this.snapshots[P(e)]=t}touch(e){let t=P(e),i=this.keys.indexOf(t);i>-1&&this.keys.splice(i,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},we=class extends U{constructor(){super(...arguments);this.snapshotCache=new be(10),this.lastRenderedLocation=new URL(location.href)}renderPage(e,t=!1,i=!0){let r=new $(this.snapshot,e,t,i);return this.render(r)}renderError(e){let t=new ve(this.snapshot,e,!1);return this.render(t)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(){if(this.shouldCacheSnapshot){this.delegate.viewWillCacheSnapshot();let{snapshot:e,lastRenderedLocation:t}=this;await Ve();let i=e.clone();return this.snapshotCache.put(t,i),i}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return f.fromElement(this.element)}get shouldCacheSnapshot(){return this.snapshot.isCacheable}},Ee=class{constructor(){this.navigator=new me(this),this.history=new de(this),this.view=new we(this,document.documentElement),this.adapter=new ae(this),this.pageObserver=new pe(this),this.cacheObserver=new le,this.linkClickObserver=new ue(this),this.formSubmitObserver=new ce(this),this.scrollObserver=new fe(this),this.streamObserver=new ge(this),this.frameRedirector=new he(document.documentElement),this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){this.navigator.proposeVisit(c(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){document.documentElement.appendChild(L.wrap(e).fragment)}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willFollowLinkToLocation(e,t){return this.elementDriveEnabled(e)&&C(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t)}followedLinkToLocation(e,t){let i=this.getActionForLink(e);this.convertLinkWithMethodClickToFormSubmission(e)||this.visit(t.href,{action:i})}convertLinkWithMethodClickToFormSubmission(e){let t=e.getAttribute("data-turbo-method");if(t){let i=document.createElement("form");i.method=t,i.action=e.getAttribute("href")||"undefined",i.hidden=!0,e.hasAttribute("data-turbo-confirm")&&i.setAttribute("data-turbo-confirm",e.getAttribute("data-turbo-confirm"));let r=this.getTargetFrameForLink(e);return r?(i.setAttribute("data-turbo-frame",r),i.addEventListener("turbo:submit-start",()=>i.remove())):i.addEventListener("submit",()=>i.remove()),document.body.appendChild(i),h("submit",{cancelable:!0,target:i})}else return!1}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){X(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){X(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let i=V(e,t);return this.elementDriveEnabled(e)&&(!t||this.elementDriveEnabled(t))&&C(c(i),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;!((e=this.navigator.currentVisit)===null||e===void 0)&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){return!this.notifyApplicationBeforeRender(e,t).defaultPrevented}viewRenderedSnapshot(e,t){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}viewInvalidated(){this.adapter.pageInvalidated()}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t){return!this.notifyApplicationAfterClickingLinkToLocation(e,t).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t){return h("turbo:click",{target:e,detail:{url:t.href},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return h("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return D(document.documentElement),h("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return h("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return h("turbo:before-render",{detail:{newBody:e,resume:t},cancelable:!0})}notifyApplicationAfterRender(){return h("turbo:render")}notifyApplicationAfterPageLoad(e={}){return N(document.documentElement),h("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return h("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return h("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}elementDriveEnabled(e){let t=e?.closest("[data-turbo]");return this.drive?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){let t=e.getAttribute("data-turbo-action");return j(t)?t:"advance"}getTargetFrameForLink(e){let t=e.getAttribute("data-turbo-frame");if(t)return t;{let i=e.closest("turbo-frame");if(i)return i.id}}get snapshot(){return this.view.snapshot}};function X(s){Object.defineProperties(s,lt)}var lt={absoluteURL:{get(){return this.toString()}}},l=new Ee,{navigator:ct}=l;function Se(){l.start()}function ht(s){l.registerAdapter(s)}function dt(s,e){l.visit(s,e)}function ut(s){l.connectStreamSource(s)}function mt(s){l.disconnectStreamSource(s)}function pt(s){l.renderStreamMessage(s)}function ft(){l.clearCache()}function gt(s){l.setProgressBarDelay(s)}function vt(s){R.confirmMethod=s}var bt=Object.freeze({__proto__:null,navigator:ct,session:l,PageRenderer:$,PageSnapshot:f,start:Se,registerAdapter:ht,visit:dt,connectStreamSource:ut,disconnectStreamSource:mt,renderStreamMessage:pt,clearCache:ft,setProgressBarDelay:gt,setConfirmMethod:vt}),ye=class{constructor(e){this.fetchResponseLoaded=t=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.settingSourceURL=!1,this.element=e,this.view=new se(this,this.element),this.appearanceObserver=new te(this,this.element),this.linkInterceptor=new _(this,this.element),this.formInterceptor=new x(this,this.element)}connect(){this.connected||(this.connected=!0,this.reloadable=!1,this.loadingStyle==w.lazy&&this.appearanceObserver.start(),this.linkInterceptor.start(),this.formInterceptor.start(),this.sourceURLChanged())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.linkInterceptor.stop(),this.formInterceptor.stop())}disabledChanged(){this.loadingStyle==w.eager&&this.loadSourceURL()}sourceURLChanged(){(this.loadingStyle==w.eager||this.hasBeenLoaded)&&this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==w.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){if(!this.settingSourceURL&&this.enabled&&this.isActive&&(this.reloadable||this.sourceURL!=this.currentURL)){let e=this.currentURL;if(this.currentURL=this.sourceURL,this.sourceURL)try{this.element.loaded=this.visit(c(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0}catch(t){throw this.currentURL=e,t}}}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let{body:i}=Z(t),r=new A(await this.extractForeignFrameElement(i)),n=new re(this.view.snapshot,r,!1,!1);this.view.renderPromise&&await this.view.renderPromise,await this.view.render(n),l.frameRendered(e,this.element),l.frameLoaded(this.element),this.fetchResponseLoaded(e)}}catch(t){console.error(t),this.view.invalidate()}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(e){this.loadSourceURL()}shouldInterceptLinkClick(e,t){return e.hasAttribute("data-turbo-method")?!1:this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.reloadable=!0,this.navigateFrame(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldInterceptNavigation(e,t)}formSubmissionIntercepted(e,t){this.formSubmission&&this.formSubmission.stop(),this.reloadable=!1,this.formSubmission=new R(this,e,t);let{fetchRequest:i}=this.formSubmission;this.prepareHeadersForRequest(i.headers,i),this.formSubmission.start()}prepareHeadersForRequest(e,t){e["Turbo-Frame"]=this.id}requestStarted(e){D(this.element)}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestFailedWithResponse(e,t){console.error(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){N(this.element)}formSubmissionStarted({formElement:e}){D(e,this.findFrameElement(e))}formSubmissionSucceededWithResponse(e,t){let i=this.findFrameElement(e.formElement,e.submitter);this.proposeVisitIfNavigatedWithAction(i,e.formElement,e.submitter),i.delegate.loadResponse(t)}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t)}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){N(e,this.findFrameElement(e))}allowsImmediateRender(e,t){return!0}viewRenderedSnapshot(e,t){}viewInvalidated(){}async visit(e){var t;let i=new M(this,a.get,e,new URLSearchParams,this.element);return(t=this.currentFetchRequest)===null||t===void 0||t.cancel(),this.currentFetchRequest=i,new Promise(r=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,r()},i.perform()})}navigateFrame(e,t,i){let r=this.findFrameElement(e,i);this.proposeVisitIfNavigatedWithAction(r,e,i),r.setAttribute("reloadable",""),r.src=t}proposeVisitIfNavigatedWithAction(e,t,i){let r=I("data-turbo-action",i,t,e);if(j(r)){let{visitCachedSnapshot:n}=new Le(e);e.delegate.fetchResponseLoaded=o=>{if(e.src){let{statusCode:m,redirected:q}=o,H=e.ownerDocument.documentElement.outerHTML,B={statusCode:m,redirected:q,responseHTML:H};l.visit(e.src,{action:r,response:B,visitCachedSnapshot:n,willRender:!1})}}}}findFrameElement(e,t){var i;let r=I("data-turbo-frame",t,e)||this.element.getAttribute("target");return(i=Y(r))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(e){let t,i=CSS.escape(this.id);try{if(t=J(e.querySelector(`turbo-frame#${i}`),this.currentURL))return t;if(t=J(e.querySelector(`turbo-frame[src][recurse~=${i}]`),this.currentURL))return await t.loaded,await this.extractForeignFrameElement(t);console.error(`Response has no matching <turbo-frame id="${i}"> element`)}catch(r){console.error(r)}return new g}formActionIsVisitable(e,t){let i=V(e,t);return C(c(i),this.rootLocation)}shouldInterceptNavigation(e,t){let i=I("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.formActionIsVisitable(e,t)||!this.enabled||i=="_top")return!1;if(i){let r=Y(i);if(r)return!r.disabled}return!(!l.elementDriveEnabled(e)||t&&!l.elementDriveEnabled(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}get reloadable(){return this.findFrameElement(this.element).hasAttribute("reloadable")}set reloadable(e){let t=this.findFrameElement(this.element);e?t.setAttribute("reloadable",""):t.removeAttribute("reloadable")}set sourceURL(e){this.settingSourceURL=!0,this.element.src=e??null,this.currentURL=this.element.src,this.settingSourceURL=!1}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var e;let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(e=t?.content)!==null&&e!==void 0?e:"/";return c(i)}},Le=class{constructor(e){this.visitCachedSnapshot=({element:t})=>{var i;let{id:r,clone:n}=this;(i=t.querySelector("#"+r))===null||i===void 0||i.replaceWith(n)},this.clone=e.cloneNode(!0),this.id=e.id}};function Y(s){if(s!=null){let e=document.getElementById(s);if(e instanceof g)return e}}function J(s,e){if(s){let t=s.getAttribute("src");if(t!=null&&e!=null&&He(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof g)return s.connectedCallback(),s.disconnectedCallback(),s}}var wt={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})}},Re=class extends HTMLElement{async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{this.dispatchEvent(this.beforeRenderEvent)&&(await k(),this.performAction())})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),i=[...(e=this.templateContent)===null||e===void 0?void 0:e.children].filter(r=>!!r.id).map(r=>r.id);return t.filter(r=>i.includes(r.id))}get performAction(){if(this.action){let e=wt[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0})}get targetElementsById(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}};g.delegateConstructor=ye;customElements.define("turbo-frame",g);customElements.define("turbo-stream",Re);(()=>{let s=document.currentScript;if(!!s&&!s.hasAttribute("data-turbo-suppress-warning")){for(;s=s.parentElement;)if(s==document.body)return console.warn(ee`
|
18
18
|
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
|
19
19
|
|
20
20
|
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
|
@@ -23,7 +23,7 @@
|
|
23
23
|
|
24
24
|
——
|
25
25
|
Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
|
26
|
-
`,s.outerHTML)}})();window.Turbo=
|
26
|
+
`,s.outerHTML)}})();window.Turbo=bt;Se();var Et=(s,e,t,i)=>{let r=document.createElement("div"),o=`<div class="bar">
|
27
27
|
<div class="progress" style="width: ${s/e*100}%;"></div>
|
28
28
|
</div>
|
29
29
|
<p>`;return t&&(o+=`<a href="#${t.id}" class="prev">
|
@@ -35,4 +35,4 @@
|
|
35
35
|
<span class="arrow">
|
36
36
|
»
|
37
37
|
</span>
|
38
|
-
</a>`),o+="</p>",r.className="progress-bar",r.innerHTML=o,r},
|
38
|
+
</a>`),o+="</p>",r.className="progress-bar",r.innerHTML=o,r},St=s=>{s.forEach((e,t)=>{let i=s[t+1],r=s[t-1],n=t===s.length-1;if(i||r){let o=Et(t+1,s.length,r,i);i&&i.parentNode.insertBefore(o,i)}})},Te=(s,e,t)=>{t&&window.scrollTo({top:0,behavior:"smooth"});let i=!1;for(let r=0;r<s.length;r++)typeof s[r].style=="object"&&(s[r].tagName==="H2"&&(i=!1),s[r].id===e&&(i=!0),i?s[r].style.display="block":s[r].style.display="none")},yt=s=>{window.addEventListener("hashchange",function(){Te(s,window.location.hash.replace(/#/g,""),!0)},!1)},Ae=s=>e=>{let t="<li>";return s?t+=e.$el.innerText:t+=`<a href="#${e.$el.id}">${e.$el.innerText}</a>`,e.children.length&&(t+=`<ul>${e.children.map(Ae(!0)).join("")}</ul>`),t+="</li>",t},Lt=(s,e)=>{for(;e.level>=s;)e=e.parent;return e},Rt=(s,e)=>{let t={$el:s,children:[],level:0},i=t;e.forEach(r=>{let n=parseInt(r.tagName.replace("H","")),o={$el:r,children:[],level:n,parent:i};n>i.level?(i.children.push(o),i=o):(i=Lt(n,i),i.children.push(o),i=o)}),s.innerHTML=`<ul>${t.children.map(Ae()).join("")}</ul>`},Ce=(s,e)=>t=>{e&&t.preventDefault(),s.style.display==="block"?s.style.display="":s.style.display="block"},Ct=(s,e)=>{e.addEventListener("click",Ce(s,!0)),s.addEventListener("click",Ce(s),!0)},Tt=()=>{let s=document.querySelector("main"),e=[...s.querySelectorAll("h2")];St(e);let t=document.getElementById("toc-content"),i=[...s.querySelectorAll("h2, h3")];Rt(t,i);let r=[...s.childNodes];yt(r),Te(r,window.location.hash.replace(/#/g,"")||s.querySelector("h2").id);let n=document.getElementById("toc-wrapper"),o=document.getElementById("toc-opener");Ct(n,o)};document.addEventListener("turbo:load",Tt);})();
|
data/together-theme.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: together-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dallas Read
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- _includes/article_footer.html
|
69
69
|
- _includes/article_header.html
|
70
70
|
- _includes/article_nav.html
|
71
|
+
- _includes/footer.html
|
71
72
|
- _includes/head.html
|
72
73
|
- _includes/meta.html
|
73
74
|
- _includes/sidebar.html
|