1(()=>{var ts=Object.create;var pr=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var rs=Object.getOwnPropertyNames;var is=Object.getPrototypeOf,ss=Object.prototype.hasOwnProperty;var U=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var ns=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of rs(t))!ss.call(r,s)&&s!==e&&pr(r,s,{get:()=>t[s],enumerable:!(i=es(t,s))||i.enumerable});return r};var mr=(r,t,e)=>(e=r!=null?ts(is(r)):{},ns(t||!r||!r.__esModule?pr(e,"default",{value:r,enumerable:!0}):e,r));var kr=U((pe,Cr)=>{(function(r,t){"use strict";typeof define=="function"&&define.amd?define("stackframe",[],t):typeof pe=="object"?Cr.exports=t():r.StackFrame=t()})(pe,function(){"use strict";function r(p){return!isNaN(parseFloat(p))&&isFinite(p)}function t(p){return p.charAt(0).toUpperCase()+p.substring(1)}function e(p){return function(){return this[p]}}var i=["isConstructor","isEval","isNative","isToplevel"],s=["columnNumber","lineNumber"],n=["fileName","functionName","source"],o=["args"],a=["evalOrigin"],c=i.concat(s,n,o,a);function l(p){if(p)for(var v=0;v<c.length;v++)p[c[v]]!==void 0&&this["set"+t(c[v])](p[c[v]])}l.prototype={getArgs:function(){return this.args},setArgs:function(p){if(Object.prototype.toString.call(p)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=p},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(p){if(p instanceof l)this.evalOrigin=p;else if(p instanceof Object)this.evalOrigin=new l(p);else throw new TypeError("Eval Origin must be an Object or StackFrame")},toString:function(){var p=this.getFileName()||"",v=this.getLineNumber()||"",_=this.getColumnNumber()||"",L=this.getFunctionName()||"";return this.getIsEval()?p?"[eval] ("+p+":"+v+":"+_+")":"[eval]:"+v+":"+_:L?L+" ("+p+":"+v+":"+_+")":p+":"+v+":"+_}},l.fromString=function(v){var _=v.indexOf("("),L=v.lastIndexOf(")"),Q=v.substring(0,_),Y=v.substring(_+1,L).split(","),Z=v.substring(L+1);if(Z.indexOf("@")===0)var C=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(Z,""),ae=C[1],ce=C[2],F=C[3];return new l({functionName:Q,args:Y||void 0,fileName:ae,lineNumber:ce||void 0,columnNumber:F||void 0})};for(var u=0;u<i.length;u++)l.prototype["get"+t(i[u])]=e(i[u]),l.prototype["set"+t(i[u])]=function(p){return function(v){this[p]=Boolean(v)}}(i[u]);for(var f=0;f<s.length;f++)l.prototype["get"+t(s[f])]=e(s[f]),l.prototype["set"+t(s[f])]=function(p){return function(v){if(!r(v))throw new TypeError(p+" must be a Number");this[p]=Number(v)}}(s[f]);for(var m=0;m<n.length;m++)l.prototype["get"+t(n[m])]=e(n[m]),l.prototype["set"+t(n[m])]=function(p){return function(v){this[p]=String(v)}}(n[m]);return l})});var Fr=U((me,Rr)=>{(function(r,t){"use strict";typeof define=="function"&&define.amd?define("error-stack-parser",["stackframe"],t):typeof me=="object"?Rr.exports=t(kr()):r.ErrorStackParser=t(r.StackFrame)})(me,function(t){"use strict";var e=/(^|@)\S+:\d+/,i=/^\s*at .*(\S+:\d+|\(native\))/m,s=/^(eval@)?(\[native code])?$/;return{parse:function(o){if(typeof o.stacktrace<"u"||typeof o["opera#sourceloc"]<"u")return this.parseOpera(o);if(o.stack&&o.stack.match(i))return this.parseV8OrIE(o);if(o.stack)return this.parseFFOrSafari(o);throw new Error("Cannot parse given Error object")},extractLocation:function(o){if(o.indexOf(":")===-1)return[o];var a=/(.+?)(?::(\d+))?(?::(\d+))?$/,c=a.exec(o.replace(/[()]/g,""));return[c[1],c[2]||void 0,c[3]||void 0]},parseV8OrIE:function(o){var a=o.stack.split(` 2`).filter(function(c){return!!c.match(i)},this);return a.map(function(c){c.indexOf("(eval ")>-1&&(c=c.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var l=c.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),u=l.match(/ (\(.+\)$)/);l=u?l.replace(u[0],""):l;var f=this.extractLocation(u?u[1]:l),m=u&&l||void 0,p=["eval","<anonymous>"].indexOf(f[0])>-1?void 0:f[0];return new t({functionName:m,fileName:p,lineNumber:f[1],columnNumber:f[2],source:c})},this)},parseFFOrSafari:function(o){var a=o.stack.split(` 3`).filter(function(c){return!c.match(s)},this);return a.map(function(c){if(c.indexOf(" > eval")>-1&&(c=c.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),c.indexOf("@")===-1&&c.indexOf(":")===-1)return new t({functionName:c});var l=/((.*".+"[^@]*)?[^@]*)(?:@)/,u=c.match(l),f=u&&u[1]?u[1]:void 0,m=this.extractLocation(c.replace(l,""));return new t({functionName:f,fileName:m[0],lineNumber:m[1],columnNumber:m[2],source:c})},this)},parseOpera:function(o){return!o.stacktrace||o.message.indexOf(` 4`)>-1&&o.message.split(` 5`).length>o.stacktrace.split(` 6`).length?this.parseOpera9(o):o.stack?this.parseOpera11(o):this.parseOpera10(o)},parseOpera9:function(o){for(var a=/Line (\d+).*script (?:in )?(\S+)/i,c=o.message.split(` 7`),l=[],u=2,f=c.length;u<f;u+=2){var m=a.exec(c[u]);m&&l.push(new t({fileName:m[2],lineNumber:m[1],source:c[u]}))}return l},parseOpera10:function(o){for(var a=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,c=o.stacktrace.split(` 8`),l=[],u=0,f=c.length;u<f;u+=2){var m=a.exec(c[u]);m&&l.push(new t({functionName:m[3]||void 0,fileName:m[2],lineNumber:m[1],source:c[u]}))}return l},parseOpera11:function(o){var a=o.stack.split(` 9`).filter(function(c){return!!c.match(e)&&!c.match(/^Error created at/)},this);return a.map(function(c){var l=c.split("@"),u=this.extractLocation(l.pop()),f=l.shift()||"",m=f.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,p;f.match(/\(([^)]*)\)/)&&(p=f.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var v=p===void 0||p==="[arguments not available]"?void 0:p.split(",");return new t({functionName:m,args:v,fileName:u[0],lineNumber:u[1],columnNumber:u[2],source:c})},this)}}})});var Hr=U((D,qr)=>{var jr=typeof self<"u"?self:D,Nt=function(){function r(){this.fetch=!1,this.DOMException=jr.DOMException}return r.prototype=jr,new r}();(function(r){var t=function(e){var i={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function s(h){return h&&DataView.prototype.isPrototypeOf(h)}if(i.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
9]"],o=ArrayBuffer.isView||function(h){return h&&n.indexOf(Object.prototype.toString.call(h))>-1};function a(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function c(h){return typeof h!="string"&&(h=String(h)),h}function l(h){var d={next:function(){var g=h.shift();return{done:g===void 0,value:g}}};return i.iterable&&(d[Symbol.iterator]=function(){return d}),d}function u(h){this.map={},h instanceof u?h.forEach(function(d,g){this.append(g,d)},this):Array.isArray(h)?h.forEach(function(d){this.append(d[0],d[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(d){this.append(d,h[d])},this)}u.prototype.append=function(h,d){h=a(h),d=c(d);var g=this.map[h];this.map[h]=g?g+", "+d:d},u.prototype.delete=function(h){delete this.map[a(h)]},u.prototype.get=function(h){return h=a(h),this.has(h)?this.map[h]:null},u.prototype.has=function(h){return this.map.hasOwnProperty(a(h))},u.prototype.set=function(h,d){this.map[a(h)]=c(d)},u.prototype.forEach=function(h,d){for(var g in this.map)this.map.hasOwnProperty(g)&&h.call(d,this.map[g],g,this)},u.prototype.keys=function(){var h=[];return this.forEach(function(d,g){h.push(g)}),l(h)},u.prototype.values=function(){var h=[];return this.forEach(function(d){h.push(d)}),l(h)},u.prototype.entries=function(){var h=[];return this.forEach(function(d,g){h.push([g,d])}),l(h)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function f(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function m(h){return new Promise(function(d,g){h.onload=function(){d(h.result)},h.onerror=function(){g(h.error)}})}function p(h){var d=new FileReader,g=m(d);return d.readAsArrayBuffer(h),g}function v(h){var d=new FileReader,g=m(d);return d.readAsText(h),g}function _(h){for(var d=new Uint8Array(h),g=new Array(d.length),T=0;T<d.length;T++)g[T]=String.fromCharCode(d[T]);return g.join("")}function L(h){if(h.slice)return h.slice(0);var d=new Uint8Array(h.byteLength);return d.set(new Uint8Array(h)),d.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(h){this._bodyInit=h,h?typeof h=="string"?this._bodyText=h:i.blob&&Blob.prototype.isPrototypeOf(h)?this._bodyBlob=h:i.formData&&FormData.prototype.isPrototypeOf(h)?this._bodyFormData=h:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)?this._bodyText=h.toString():i.arrayBuffer&&i.blob&&s(h)?(this._bodyArrayBuffer=L(h.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(h)||o(h))?this._bodyArrayBuffer=L(h):this._bodyText=h=Object.prototype.toString.call(h):this._bodyText="",this.headers.get("content-type")||(typeof h=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var h=f(this);if(h)return h;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var h=f(this);if(h)return h;if(this._bodyBlob)return v(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(ae)}),this.json=function(){return this.text().then(JSON.parse)},this}var Y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Z(h){var d=h.toUpperCase();return Y.indexOf(d)>-1?d:h}function C(h,d){d=d||{};var g=d.body;if(h instanceof C){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,d.headers||(this.headers=new u(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!g&&h._bodyInit!=null&&(g=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=d.credentials||this.credentials||"same-origin",(d.headers||!this.headers)&&(this.headers=new u(d.headers)),this.method=Z(d.method||this.method||"GET"),this.mode=d.mode||this.mode||null,this.signal=d.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&g)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(g)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function ae(h){var d=new FormData;return h.trim().split("&").forEach(function(g){if(g){var T=g.split("="),S=T.shift().replace(/\+/g," "),y=T.join("=").replace(/\+/g," ");d.append(decodeURIComponent(S),decodeURIComponent(y))}}),d}function ce(h){var d=new u,g=h.replace(/\r?\n[\t ]+/g," ");
9return g.split(/\r?\n/).forEach(function(T){var S=T.split(":"),y=S.shift().trim();if(y){var Rt=S.join(":").trim();d.append(y,Rt)}}),d}Q.call(C.prototype);function F(h,d){d||(d={}),this.type="default",this.status=d.status===void 0?200:d.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in d?d.statusText:"OK",this.headers=new u(d.headers),this.url=d.url||"",this._initBody(h)}Q.call(F.prototype),F.prototype.clone=function(){return new F(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},F.error=function(){var h=new F(null,{status:0,statusText:""});return h.type="error",h};var Zi=[301,302,303,307,308];F.redirect=function(h,d){if(Zi.indexOf(d)===-1)throw new RangeError("Invalid status code");return new F(null,{status:d,headers:{location:h}})},e.DOMException=r.DOMException;try{new e.DOMException}catch{e.DOMException=function(d,g){this.message=d,this.name=g;var T=Error(d);this.stack=T.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function he(h,d){return new Promise(function(g,T){var S=new C(h,d);if(S.signal&&S.signal.aborted)return T(new e.DOMException("Aborted","AbortError"));var y=new XMLHttpRequest;function Rt(){y.abort()}y.onload=function(){var ft={status:y.status,statusText:y.statusText,headers:ce(y.getAllResponseHeaders()||"")};ft.url="responseURL"in y?y.responseURL:ft.headers.get("X-Request-URL");var le="response"in y?y.response:y.responseText;g(new F(le,ft))},y.onerror=function(){T(new TypeError("Network request failed"))},y.ontimeout=function(){T(new TypeError("Network request failed"))},y.onabort=function(){T(new e.DOMException("Aborted","AbortError"))},y.open(S.method,S.url,!0),S.credentials==="include"?y.withCredentials=!0:S.credentials==="omit"&&(y.withCredentials=!1),"responseType"in y&&i.blob&&(y.responseType="blob"),S.headers.forEach(function(ft,le){y.setRequestHeader(le,ft)}),S.signal&&(S.signal.addEventListener("abort",Rt),y.onreadystatechange=function(){y.readyState===4&&S.signal.removeEventListener("abort",Rt)}),y.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return he.polyfill=!0,r.fetch||(r.fetch=he,r.Headers=u,r.Request=C,r.Response=F),e.Headers=u,e.Request=C,e.Response=F,e.fetch=he,Object.defineProperty(e,"__esModule",{value:!0}),e}({})})(Nt);Nt.fetch.ponyfill=!0;delete Nt.fetch.polyfill;var it=Nt;D=it.fetch;D.default=it.fetch;D.fetch=it.fetch;D.Headers=it.Headers;D.Request=it.Request;D.Response=it.Response;qr.exports=D});var ge=U((la,zr)=>{function N(){}N.prototype.clear=function(){this._root=null,this.size=0};N.prototype.find=function(r){for(var t=this._root;t!==null;){var e=this._comparator(r,t.data);if(e===0)return t.data;t=t.get_child(e>0)}return null};N.prototype.findIter=function(r){for(var t=this._root,e=this.iterator();t!==null;){var i=this._comparator(r,t.data);if(i===0)return e._cursor=t,e;e._ancestors.push(t),t=t.get_child(i>0)}return null};N.prototype.lowerBound=function(r){for(var t=this._root,e=this.iterator(),i=this._comparator;t!==null;){var s=i(r,t.data);if(s===0)return e._cursor=t,e;e._ancestors.push(t),t=t.get_child(s>0)}for(var n=e._ancestors.length-1;n>=0;--n)if(t=e._ancestors[n],i(r,t.data)<0)return e._cursor=t,e._ancestors.length=n,e;return e._ancestors.length=0,e};N.prototype.upperBound=function(r){for(var t=this.lowerBound(r),e=this._comparator;t.data()!==null&&e(t.data(),r)===0;)t.next();return t};N.prototype.min=function(){var r=this._root;if(r===null)return null;for(;r.left!==null;)r=r.left;return r.data};N.prototype.max=function(){var r=this._root;if(r===null)return null;for(;r.right!==null;)r=r.right;return r.data};N.prototype.iterator=function(){return new st(this)};N.prototype.each=function(r){for(var t=this.iterator(),e;(e=t.next())!==null;)if(r(e)===!1)return};N.prototype.reach=function(r){for(var t=this.iterator(),e;(e=t.prev())!==null;)if(r(e)===!1)return};function st(r){this._tree=r,this._ancestors=[],this._cursor=null}st.prototype.data=function(){return this._cursor!==null?this._cursor.data:null};st.prototype.next=function(){if(this._cursor===null){var r=this._tree._root;r!==null&&this._minNode(r)}else if(this._cursor.right===null){var t;do if(t=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===t)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null};st.prototype.prev=function(){if(this._cursor===null){var r=this._tree._root;r!==null&&this._maxNode(r)}else if(this._cursor.left===null){var t;do if(t=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===t)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null};st.prototype._minNode=function(r){for(;r.left!==null;)this._ancestors.push(r),r=r.left;this._cursor=r};st.prototype._maxNode=function(r){for(;r.right!==null;)this._ancestors.push(r),r=r.right;this._cursor=r};zr.exports=N});var Gr=U((ua,Xr)=>{var Ss=ge();function nt(r){this.data=r,this.left=null,this.right=null,this.red=!0}nt.prototype.get_child=function(r){return r?this.right:this.left};nt.prototype.set_child=function(r,t){r?this.right=t:this.left=t};function xt(r){this._root=null,this._comparator=r,this.size=0}xt.prototype=new Ss;xt.prototype.insert=function(r){var t=!1;if(this._root===null)this._root=new nt(r),t=!0,this.size++;else{var e=new nt(void 0),i=0,s=0,n=null,o=e,a=null,c=this._root;for(o.right=this._root;;){if(c===null?(c=new nt(r),a.set_child(i,c),t=!0,this.size++):M(c.left)&&M(c.right)&&(c.red=!0,c.left.red=!1,c.right.red=!1),M(c)&&M(a)){var l=o.right===n;c===a.get_child(s)?o.set_child(l,mt(n,!s)):o.set_child(l,Jr(n,!s))}var u=this._comparator(c.data,r);if(u===0)break;s=i,i=u<0,n!==null&&(o=n),n=a,a=c,c=c.get_child(i)}this._root=e.right}return this._root.red=!1,t};xt.prototype.remove=function(r){if(this._root===null)return!1;var t=new nt(void 0),e=t;e.right=this._root;for(var i=null,s=null,n=null,o=1;e.get_child(o)!==null;){var a=o;s=i,i=e,e=e.get_child(o);var c=this._comparator(r,e.data);if(o=c>0,c===0&&(n=e),!M(e)&&!M(e.get_child(o))){if(M(e.get_child(!o))){var l=mt(e,o);i.set_child(a,l),i=l}else if(!M(e.get_child(!o))){var u=i.get_child(!a);if(u!==null)if(!M(u.get_child(!a))&&!M(u.get_child(a)))i.red=!1,u.red=!0,e.red=!0;else{var f=s.right===i;M(u.get_child(a))?s.set_child(f,Jr(i,a)):M(u.get_child(!a))&&s.set_child(f,mt(i,a));var m=s.get_child(f);m.red=!0,e.red=!0,m.left.red=!1,m.right.red=!1}}}}return n!==null&&(n.data=e.data,i.set_child(i.right===e,e.get_child(e.left===null)),this.size--),this._root=t.right,this._root!==null&&(this._root.red=!1),n!==null};function M(r){return r!==null&&r.red}function mt(r,t){var e=r.get_child(!t);return r.set_child(!t,e.get_child(t)),e.set_child(t,r),r.red=!0,e.red=!1,e}function Jr(r,t){return r.set_child(!t,mt(r.get_child(!t),!t)),mt(r,t)}Xr.exports=xt});var Yr=U((da,Qr)=>{var As=ge();function gt(r){this.data=r,this.left=null,this.right=null}gt.prototype.get_child=function(r){return r?this.right:this.left};gt.prototype.set_child=function(r,t){r?this.right=t:this.left=t};function Pt(r){this._root=null,this._comparator=r,this.size=0}Pt.prototype=new As;Pt.prototype.insert=function(r){if(this._root===null)return this._root=new gt(r),this.size++,!0;for(var t=0,e=null,i=this._root;;){if(i===null)return i=new gt(r),e.set_child(t,i),ret=!0,this.size++,!0;if(this._comparator(i.data,r)===0)return!1;t=this._comparator(i.data,r)<0,e=i,i=i.get_child(t)}};Pt.prototype.remove=function(r){if(this._root===null)return!1;var t=new gt(void 0),e=t;e.right=this._root;for(var i=null,s=null,n=1;e.get_child(n)!==null;){i=e,e=e.get_child(n);var o=this._comparator(r,e.data);n=o>0,o===0&&(s=e)}return s!==null?(s.data=e.data,i.set_child(i.right===e,e.get_child(e.left===null)),this._root=t.right,this.size--,!0):!1};Qr.exports=Pt});var ti=U((fa,Zr)=>{Zr.exports={RBTree:Gr(),BinTree:Yr()}});var ii=U((pa,ri)=>{var Ts=ti().RBTree;function b(r,t,e){this.discrete=r===!1,this.delta=r||.01,this.K=t===void 0?25:t,this.CX=e===void 0?1.1:e,this.centroids=new Ts(ei),this.nreset=0,this.reset()}b.prototype.reset=function(){this.centroids.clear(),this.n=0,this.nreset+=1,this.last_cumulate=0};b.prototype.size=function(){return this.centroids.size};b.prototype.toArray=function(r){var t=[];return r?(this._cumulate(!0),this.centroids.each(function(e){t.push(e)})):this.centroids.each(function(e){t.push({mean:e.mean,n:e.n})}),t};b.prototype.summary=function(){var r=this.discrete?"exact ":"approximating ",t=[r+this.n+" samples using "+this.size()+" centroids","min = "+this.percentile(0),"Q1 = "+this.percentile(.25),"Q2 = "+this.percentile(.5),"Q3 = "+this.percentile(.75),"max = "+this.percentile(1)];return t.join(` 10`)};function ei(r,t){return r.mean>t.mean?1:r.mean<t.mean?-1:0}function Os(r,t){return r.mean_cumn-t.mean_cumn}b.prototype.push=function(r,t){t=t||1,r=Array.isArray(r)?r:[r];for(var e=0;e<r.length;e++)this._digest(r[e],t)};b.prototype.push_centroid=function(r){r=Array.isArray(r)?r:[r];for(var t=0;t<r.length;t++)this._digest(r[t].mean,r[t].n)};b.prototype._cumulate=function(r){if(!(this.n===this.last_cumulate||!r&&this.CX&&this.CX>this.n/this.last_cumulate)){var t=0;this.centroids.each(function(e){e.mean_cumn=t+e.n/2,t=e.cumn=t+e.n}),this.n=this.last_cumulate=t}};b.prototype.find_nearest=function(r){if(this.size()===0)return null;var t=this.centroids.lowerBound({mean:r}),e=t.data()===null?t.prev():t.data();if(e.mean===r||this.discrete)return e;var i=t.prev();return i&&Math.abs(i.mean-r)<Math.abs(e.mean-r)?i:e};b.prototype._new_centroid=function(r,t,e){var i={mean:r,n:t,cumn:e};return this.centroids.insert(i),this.n+=t,i};b.prototype._addweight=function(r,t,e){t!==r.mean&&(r.mean+=e*(t-r.mean)/(r.n+e)),r.cumn+=e,r.mean_cumn+=e/2,r.n+=e,this.n+=e};b.prototype._digest=function(r,t){var e=this.centroids.min(),i=this.centroids.max(),s=this.find_nearest(r);if(s&&s.mean===r)this._addweight(s,r,t);else if(s===e)this._new_centroid(r,t,0);else if(s===i)this._new_centroid(r,t,this.n);else if(this.discrete)this._new_centroid(r,t,s.cumn);
10else{var n=s.mean_cumn/this.n,o=Math.floor(4*this.n*this.delta*n*(1-n));o-s.n>=t?this._addweight(s,r,t):this._new_centroid(r,t,s.cumn)}this._cumulate(!1),!this.discrete&&this.K&&this.size()>this.K/this.delta&&this.compress()};b.prototype.bound_mean=function(r){var t=this.centroids.upperBound({mean:r}),e=t.prev(),i=e.mean===r?e:t.next();return[e,i]};b.prototype.p_rank=function(r){var t=Array.isArray(r)?r:[r],e=t.map(this._p_rank,this);return Array.isArray(r)?e:e[0]};b.prototype._p_rank=function(r){if(this.size()!==0){{if(r<this.centroids.min().mean)return 0;if(r>this.centroids.max().mean)return 1}this._cumulate(!0);var t=this.bound_mean(r),e=t[0],i=t[1];if(this.discrete)return e.cumn/this.n;var s=e.mean_cumn;return e!==i&&(s+=(r-e.mean)*(i.mean_cumn-e.mean_cumn)/(i.mean-e.mean)),s/this.n}};b.prototype.bound_mean_cumn=function(r){this.centroids._comparator=Os;var t=this.centroids.upperBound({mean_cumn:r});this.centroids._comparator=ei;var e=t.prev(),i=e&&e.mean_cumn===r?e:t.next();return[e,i]};b.prototype.percentile=function(r){var t=Array.isArray(r)?r:[r],e=t.map(this._percentile,this);return Array.isArray(r)?e:e[0]};b.prototype._percentile=function(r){if(this.size()!==0){this._cumulate(!0);var t=this.n*r,e=this.bound_mean_cumn(t),i=e[0],s=e[1];return s===i||i===null||s===null?(i||s).mean:this.discrete?t<=i.cumn?i.mean:s.mean:i.mean+(t-i.mean_cumn)*(s.mean-i.mean)/(s.mean_cumn-i.mean_cumn)}};function Ls(r){var t=Math.floor(Math.random()*r.length);return r.splice(t,1)[0]}b.prototype.compress=function(){if(!this.compressing){var r=this.toArray();for(this.reset(),this.compressing=!0;r.length>0;)this.push_centroid(Ls(r));this._cumulate(!0),this.compressing=!1}};function W(r){this.config=r||{},this.mode=this.config.mode||"auto",b.call(this,this.mode==="cont"?r.delta:!1),this.digest_ratio=this.config.ratio||.9,this.digest_thresh=this.config.thresh||1e3,this.n_unique=0}W.prototype=Object.create(b.prototype);W.prototype.constructor=W;W.prototype.push=function(r){b.prototype.push.call(this,r),this.check_continuous()};W.prototype._new_centroid=function(r,t,e){this.n_unique+=1,b.prototype._new_centroid.call(this,r,t,e)};W.prototype._addweight=function(r,t,e){r.n===1&&(this.n_unique-=1),b.prototype._addweight.call(this,r,t,e)};W.prototype.check_continuous=function(){return this.mode!=="auto"||this.size()<this.digest_thresh?!1:this.n_unique/this.size()>this.digest_ratio?(this.mode="cont",this.discrete=!1,this.delta=this.config.delta||.01,this.compress(),!0):!1};ri.exports={TDigest:b,Digest:W}});function os(r){var t=this.constructor;return this.then(function(e){return t.resolve(r()).then(function(){return e})},function(e){return t.resolve(r()).then(function(){return t.reject(e)})})}var gr=os;function as(r){var t=this;return new t(function(e,i){if(!(r&&typeof r.length<"u"))return i(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var s=Array.prototype.slice.call(r);if(s.length===0)return e([]);var n=s.length;function o(c,l){if(l&&(typeof l=="object"||typeof l=="function")){var u=l.then;if(typeof u=="function"){u.call(l,function(f){o(c,f)},function(f){s[c]={status:"rejected",reason:f},--n===0&&e(s)});return}}s[c]={status:"fulfilled",value:l},--n===0&&e(s)}for(var a=0;a<s.length;a++)o(a,s[a])})}var vr=as;function yr(r,t){this.name="AggregateError",this.errors=r,this.message=t||""}yr.prototype=Error.prototype;function cs(r){var t=this;return new t(function(e,i){if(!(r&&typeof r.length<"u"))return i(new TypeError("Promise.any accepts an array"));var s=Array.prototype.slice.call(r);if(s.length===0)return i();for(var n=[],o=0;o<s.length;o++)try{t.resolve(s[o]).then(e).catch(function(a){n.push(a),n.length===s.length&&i(new yr(n,"All promises were rejected"))})}catch(a){i(a)}})}var br=cs;var hs=setTimeout;function wr(r){return Boolean(r&&typeof r.length<"u")}function ls(){}function us(r,t){return function(){r.apply(t,arguments)}}function w(r){if(!(this instanceof w))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],_r(r,this)}function Er(r,t){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(t);return}r._handled=!0,w._immediateFn(function(){var e=r._state===1?t.onFulfilled:t.onRejected;if(e===null){(r._state===1?ue:pt)(t.promise,r._value);return}var i;try{i=e(r._value)}catch(s){pt(t.promise,s);return}ue(t.promise,i)})}function ue(r,t){try{if(t===r)throw new TypeError("A promise cannot be resolved with itself.");if(t&&(typeof t=="object"||typeof t=="function")){var e=t.then;if(t instanceof w){r._state=3,r._value=t,de(r);return}else if(typeof e=="function"){_r(us(e,t),r);return}}r._state=1,r._value=t,de(r)}catch(i){pt(r,i)}}function pt(r,t){r._state=2,r._value=t,de(r)}function de(r){r._state===2&&r._deferreds.length===0&&w._immediateFn(function(){r._handled||w._unhandledRejectionFn(r._value)});for(var t=0,e=r._deferreds.length;t<e;t++)Er(r,r._deferreds[t]);r._deferreds=null}function ds(r,t,e){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof t=="function"?t:null,this.promise=e}function _r(r,t){var e=!1;try{r(function(i){e||(e=!0,ue(t,i))},function(i){e||(e=!0,pt(t,i))})}catch(i){if(e)return;e=!0,pt(t,i)}}w.prototype.catch=function(r){return this.then(null,r)};w.prototype.then=function(r,t){var e=new this.constructor(ls);return Er(this,new ds(r,t,e)),e};w.prototype.finally=gr;w.all=function(r){return new w(function(t,e){if(!wr(r))return e(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return t([]);var s=i.length;function n(a,c){try{if(c&&(typeof c=="object"||typeof c=="function")){var l=c.then;if(typeof l=="function"){l.call(c,function(u){n(a,u)},e);return}}i[a]=c,--s===0&&t(i)}catch(u){e(u)}}for(var o=0;o<i.length;o++)n(o,i[o])})};w.any=br;w.allSettled=vr;w.resolve=function(r){return r&&typeof r=="object"&&r.constructor===w?r:new w(function(t){t(r)})};w.reject=function(r){return new w(function(t,e){e(r)})};w.race=function(r){return new w(function(t,e){if(!wr(r))return e(new TypeError("Promise.race accepts an array"));for(var i=0,s=r.length;i<s;i++)w.resolve(r[i]).then(t,e)})};w._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){hs(r,0)};w._unhandledRejectionFn=function(t){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var I=w;var fs="[Filtered]",Sr=128;function Tr(r,t){var e=t===void 0?{}:t,i=e.maxLength,s=i===void 0?64e3:i,n=e.keysBlocklist,o=n===void 0?[]:n;if(r.errors)for(var a=0;a<r.errors.length;a++){var c=new Or({keysBlocklist:o});r.errors[a]=c.truncate(r.errors[a])}for(var l="",u=["context","params","environment","session"],f=0;f<8;f++){for(var m={level:f,keysBlocklist:o},p=0,v=u;p<v.length;p++){var _=v[p],L=r[_];L&&(r[_]=ps(L,m))}if(l=JSON.stringify(r),l.length<s)return l}var Q={json:l.slice(0,Math.floor(s/2))+"..."};u.push("errors");for(var Y=0,Z=u;Y<Z.length;Y++){var _=Z[Y],L=r[_];L&&(l=JSON.stringify(L),Q[_]=l.length)}var C=new Error("airbrake: notice exceeds max length and can't be truncated");throw C.params=Q,C}function Ft(r,t){return r>>t||1}var Or=function(){function r(t){this.maxStringLength=1024,this.maxObjectLength=Sr,this.maxArrayLength=Sr,this.maxDepth=8,this.keys=[],this.keysBlocklist=[],this.seen=[];var e=t.level||0;this.keysBlocklist=t.keysBlocklist||[],this.maxStringLength=Ft(this.maxStringLength,e),this.maxObjectLength=Ft(this.maxObjectLength,e),this.maxArrayLength=Ft(this.maxArrayLength,e),this.maxDepth=Ft(this.maxDepth,e)}
10return r.prototype.truncate=function(t,e,i){if(e===void 0&&(e=""),i===void 0&&(i=0),t==null)return t;switch(typeof t){case"boolean":case"number":case"function":return t;case"string":return this.truncateString(t);case"object":break;default:return this.truncateString(String(t))}if(t instanceof String)return this.truncateString(t.toString());if(t instanceof Boolean||t instanceof Number||t instanceof Date||t instanceof RegExp)return t;if(t instanceof Error)return this.truncateString(t.toString());if(this.seen.indexOf(t)>=0)return"[Circular "+this.getPath(t)+"]";var s=ms(t);if(i++,i>this.maxDepth)return"[Truncated "+s+"]";switch(this.keys.push(e),this.seen.push(t),s){case"Array":return this.truncateArray(t,i);case"Object":return this.truncateObject(t,i);default:var n=this.maxDepth;this.maxDepth=0;var o=this.truncateObject(t,i);return o.__type=s,this.maxDepth=n,o}},r.prototype.getPath=function(t){for(var e=this.seen.indexOf(t),i=[this.keys[e]],s=e;s>=0;s--){var n=this.seen[s];n&&Ar(n,i[0])===t&&(t=n,i.unshift(this.keys[s]))}return"~"+i.join(".")},r.prototype.truncateString=function(t){return t.length>this.maxStringLength?t.slice(0,this.maxStringLength)+"...":t},r.prototype.truncateArray=function(t,e){e===void 0&&(e=0);for(var i=0,s=[],n=0;n<t.length;n++){var o=t[n];if(s.push(this.truncate(o,n.toString(),e)),i++,i>=this.maxArrayLength)break}return s},r.prototype.truncateObject=function(t,e){e===void 0&&(e=0);var i=0,s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(gs(n,this.keysBlocklist)){s[n]=fs;continue}var o=Ar(t,n);if(!(o===void 0||typeof o=="function")&&(s[n]=this.truncate(o,n,e),i++,i>=this.maxObjectLength))break}return s},r}();function ps(r,t){t===void 0&&(t={});var e=new Or(t);return e.truncate(r)}function Ar(r,t){try{return r[t]}catch{return}}function ms(r){var t=Object.prototype.toString.apply(r);return t.slice(8,-1)}function gs(r,t){for(var e=0,i=t;e<i.length;e++){var s=i[e];if(s===r||s instanceof RegExp&&r.match(s))return!0}return!1}var vs=function(){function r(t,e,i){this._dur=0,this._level=0,this._metric=t,this.name=e,this.startTime=i||new Date}return r.prototype.end=function(t){this.endTime=t||new Date,this._dur+=this.endTime.getTime()-this.startTime.getTime(),this._metric._incGroup(this.name,this._dur),this._metric=null},r.prototype._pause=function(){if(!this._paused()){var t=new Date;this._dur+=t.getTime()-this.startTime.getTime(),this.startTime=null}},r.prototype._resume=function(){this._paused()&&(this.startTime=new Date)},r.prototype._paused=function(){return this.startTime==null},r}();var Mt=function(){function r(){this._spans={},this._groups={},this.startTime=new Date}return r.prototype.end=function(t){this.endTime||(this.endTime=t||new Date)},r.prototype.isRecording=function(){return!0},r.prototype.startSpan=function(t,e){var i=this._spans[t];i?i._level++:(i=new vs(this,t,e),this._spans[t]=i)},r.prototype.endSpan=function(t,e){var i=this._spans[t];if(!i){console.error("airbrake: span=%s does not exist",t);return}i._level>0?i._level--:(i.end(e),delete this._spans[i.name])},r.prototype._incGroup=function(t,e){this._groups[t]=(this._groups[t]||0)+e},r.prototype._duration=function(){return this.endTime||(this.endTime=new Date),this.endTime.getTime()-this.startTime.getTime()},r}();var Lr=function(){function r(){}return r.prototype.isRecording=function(){return!1},r.prototype.startSpan=function(t,e){},r.prototype.endSpan=function(t,e){},r.prototype._incGroup=function(t,e){},r}();var rt=function(){return rt=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},rt.apply(this,arguments)},fe=function(){function r(){this._noopMetric=new Lr,this._context={},this._historyMaxLen=20,this._history=[]}return r.prototype.clone=function(){var t=new r;return t._context=rt({},this._context),t._history=this._history.slice(),t},r.prototype.setContext=function(t){this._context=rt(rt({},this._context),t)},r.prototype.context=function(){var t=rt({},this._context);return this._history.length>0&&(t.history=this._history.slice()),t},r.prototype.pushHistory=function(t){if(this._isDupState(t)){this._lastRecord.num?this._lastRecord.num++:this._lastRecord.num=2;return}t.date||(t.date=new Date),this._history.push(t),this._lastRecord=t,this._history.length>this._historyMaxLen&&(this._history=this._history.slice(-this._historyMaxLen))},r.prototype._isDupState=function(t){if(!this._lastRecord)return!1;for(var e in t)if(!(!t.hasOwnProperty(e)||e==="date")&&t[e]!==this._lastRecord[e])return!1;return!0},r.prototype.routeMetric=function(){return this._routeMetric||this._noopMetric},r.prototype.setRouteMetric=function(t){this._routeMetric=t},r.prototype.queueMetric=function(){return this._queueMetric||this._noopMetric},r.prototype.setQueueMetric=function(t){this._queueMetric=t},r}();var Nr=mr(Fr()),ys=typeof console=="object"&&console.warn;function Mr(r){try{return Nr.default.parse(r)}catch(t){ys&&r.stack&&console.warn("ErrorStackParser:",t.toString(),r.stack)}return r.fileName?[r]:[]}function xr(r){var t=[];if(r.noStack)t.push({function:r.functionName||"",file:r.fileName||"",line:r.lineNumber||0,column:r.columnNumber||0});else{var e=Mr(r);if(e.length===0)try{throw new Error("fake")}catch(c){e=Mr(c),e.shift(),e.shift()}for(var i=0,s=e;i<s.length;i++){var n=s[i];t.push({function:n.functionName||"",file:n.fileName||"",line:n.lineNumber||0,column:n.columnNumber||0})}}
10var o=r.name?r.name:"",a=r.message?String(r.message):String(r);return{type:o,message:a,backtrace:t}}var bs=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function Pr(r){var t=r.errors[0];if(t.type!==""&&t.type!=="Error")return r;var e=t.message.match(bs);return e!==null&&(t.type=e[1],t.message=e[2]),r}function Br(){var r,t;return function(e){var i=JSON.stringify(e.errors);return i===r?null:(t&&clearTimeout(t),r=i,t=setTimeout(function(){r=""},1e3),e)}}var ws=["Script error","Script error.","InvalidAccessError"];function Ir(r){var t=r.errors[0];if(t.type===""&&ws.indexOf(t.message)!==-1)return null;if(t.backtrace&&t.backtrace.length>0){var e=t.backtrace[0];if(e.file==="<anonymous>")return null}return r}var Es=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function Dr(r){var t=r.errors[0];if(t.type!==""&&t.type!=="Error")return r;var e=t.message.match(Es);return e!==null&&(t.type=e[1],t.message=e[2]),r}var $r=mr(Hr());var j={unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")};var Vr=0;function Ur(r){var t=Date.now()/1e3;if(t<Vr)return I.reject(j.ipRateLimited);var e={method:r.method,body:r.body};return(0,$r.default)(r.url,e).then(function(i){if(i.status===401)throw j.unauthorized;if(i.status===429){var s=i.headers.get("X-RateLimit-Delay");if(!s)throw j.ipRateLimited;var n=parseInt(s,10);throw n>0&&(Vr=Date.now()/1e3+n),j.ipRateLimited}if(i.status===204)return{json:null};if(i.status===404)throw new Error("404 Not Found");return i.status>=200&&i.status<300?i.json().then(function(o){return{json:o}}):i.status>=400&&i.status<500?i.json().then(function(o){var a=new Error(o.message);throw a}):i.text().then(function(o){var a=new Error("airbrake: fetch: unexpected response: code="+i.status+" body='"+o+"'");throw a})})}function Kr(r){return function(t){return _s(t,r)}}var Wr=0;function _s(r,t){var e=Date.now()/1e3;return e<Wr?I.reject(j.ipRateLimited):new I(function(i,s){t({url:r.url,method:r.method,body:r.body,headers:{"content-type":"application/json"},timeout:r.timeout},function(n,o,a){if(n){s(n);return}if(!o.statusCode){n=new Error("airbrake: request: response statusCode is "+o.statusCode),s(n);return}if(o.statusCode===401){s(j.unauthorized);return}if(o.statusCode===429){s(j.ipRateLimited);var c=o.headers["x-ratelimit-delay"];if(!c)return;var l=void 0;if(typeof c=="string")l=c;else if(c instanceof Array)l=c[0];else return;var u=parseInt(l,10);u>0&&(Wr=Date.now()/1e3+u);return}if(o.statusCode===204){i({json:null});return}if(o.statusCode>=200&&o.statusCode<300){var f=void 0;try{f=JSON.parse(a)}catch(m){s(m);return}i(f);return}if(o.statusCode>=400&&o.statusCode<500){var f=void 0;try{f=JSON.parse(a)}catch(p){s(p);return}n=new Error(f.message),s(n);return}a=a.trim(),n=new Error("airbrake: node: unexpected response: code="+o.statusCode+" body='"+a+"'"),s(n)})})}function q(r){return r.request?Kr(r.request):Ur}var Cs=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(t,e)};return function(t,e){r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),si,K=!1;try{si=ii(),K=!0}catch{}var ot=function(){function r(){this.count=0,this.sum=0,this.sumsq=0,this._td=new si.Digest}return r.prototype.add=function(t){t===0&&(t=1e-5),this.count+=1,this.sum+=t,this.sumsq+=t*t,this._td&&this._td.push(t)},r.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:ni(this._td)}},r}();var Bt=function(r){Cs(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.groups={},e}return t.prototype.addGroups=function(e,i){this.add(e);for(var s in i)i.hasOwnProperty(s)&&this.addGroup(s,i[s])},t.prototype.addGroup=function(e,i){var s=this.groups[e];s||(s=new ot,this.groups[e]=s),s.add(i)},t.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:ni(this._td),groups:this.groups}},t}(ot);function ni(r){var t=[],e=[];return r.centroids.each(function(i){t.push(i.mean),e.push(i.n)}),{mean:t,count:e}}var It=function(){return It=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},It.apply(this,arguments)},ks=15e3,oi=function(){function r(t){t===void 0&&(t=""),this.method="",this.route="",this.query="",this.func="",this.file="",this.line=0,this.startTime=new Date,this.query=t}return r.prototype._duration=function(){return this.endTime||(this.endTime=new Date),this.endTime.getTime()-this.startTime.getTime()},r}();var ai=function(){function r(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/queries-stats?key="+t.projectKey,this._requester=q(t)}return r.prototype.start=function(t){return t===void 0&&(t=""),new oi(t)},r.prototype.notify=function(t){var e=this;if(K){var i=t._duration(),s=60*1e3,n=new Date(Math.floor(t.startTime.getTime()/s)*s),o={method:t.method,route:t.route,query:t.query,func:t.func,file:t.file,line:t.line,time:n},a=JSON.stringify(o),c=this._m[a];c||(c=new ot,this._m[a]=c),c.add(i),!this._timer&&(this._timer=setTimeout(function(){e._flush()},ks))}},r.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var i=JSON.parse(e),s=It(It({},i),this._m[e].toJSON());t.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,queries:t}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(a){}).catch(function(a){console.error&&console.error("can not report queries stats",a)})},r}();var Rs=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(t,e)};return function(t,e){r(t,e);function i(){this.constructor=t}
10t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Dt=function(){return Dt=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Dt.apply(this,arguments)},Fs=15e3,ci=function(r){Rs(t,r);function t(e){var i=r.call(this)||this;return i.queue=e,i.startTime=new Date,i}return t}(Mt);var hi=function(){function r(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/queues-stats?key="+t.projectKey,this._requester=q(t)}return r.prototype.notify=function(t){var e=this;if(K){var i=t._duration();i===0&&(i=1e-5);var s=60*1e3,n=new Date(Math.floor(t.startTime.getTime()/s)*s),o={queue:t.queue,time:n},a=JSON.stringify(o),c=this._m[a];c||(c=new Bt,this._m[a]=c),c.addGroups(i,t._groups),!this._timer&&(this._timer=setTimeout(function(){e._flush()},Fs))}},r.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var i=JSON.parse(e),s=Dt(Dt({},i),this._m[e].toJSON());t.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,queues:t}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(a){}).catch(function(a){console.error&&console.error("can not report queues breakdowns",a)})},r}();var Ms=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(t,e)};return function(t,e){r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),at=function(){return at=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},at.apply(this,arguments)},li=15e3,ui=function(r){Ms(t,r);function t(e,i,s,n){e===void 0&&(e=""),i===void 0&&(i=""),s===void 0&&(s=0),n===void 0&&(n="");var o=r.call(this)||this;return o.method=e,o.route=i,o.statusCode=s,o.contentType=n,o.startTime=new Date,o}return t}(Mt);var di=function(){function r(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/routes-stats?key="+t.projectKey,this._requester=q(t)}return r.prototype.notify=function(t){var e=this;if(K){var i=t._duration(),s=60*1e3,n=new Date(Math.floor(t.startTime.getTime()/s)*s),o={method:t.method,route:t.route,statusCode:t.statusCode,time:n},a=JSON.stringify(o),c=this._m[a];c||(c=new ot,this._m[a]=c),c.add(i),!this._timer&&(this._timer=setTimeout(function(){e._flush()},li))}},r.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var i=JSON.parse(e),s=at(at({},i),this._m[e].toJSON());t.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,routes:t}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(a){}).catch(function(a){console.error&&console.error("can not report routes stats",a)})},r}();var fi=function(){function r(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/routes-breakdowns?key="+t.projectKey,this._requester=q(t)}return r.prototype.notify=function(t){var e=this;if(K&&!(t.statusCode<200||t.statusCode>=300&&t.statusCode<400||t.statusCode===404||Object.keys(t._groups).length===0)){var i=t._duration();i===0&&(i=1e-5);var s=60*1e3,n=new Date(Math.floor(t.startTime.getTime()/s)*s),o={method:t.method,route:t.route,responseType:this._responseType(t),time:n},a=JSON.stringify(o),c=this._m[a];c||(c=new Bt,this._m[a]=c),c.addGroups(i,t._groups),!this._timer&&(this._timer=setTimeout(function(){e._flush()},li))}},r.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var i=JSON.parse(e),s=at(at({},i),this._m[e].toJSON());t.push(s)}this._m={},this._timer=null;var n=JSON.stringify({environment:this._opt.environment,routes:t}),o={method:"POST",url:this._url,body:n};this._requester(o).then(function(a){}).catch(function(a){console.error&&console.error("can not report routes breakdowns",a)})},r.prototype._responseType=function(t){return t.statusCode>=500?"5xx":t.statusCode>=400?"4xx":t.contentType?t.contentType.split(";")[0].split("/")[-1]:""},r}();var pi="airbrake-js/browser",mi="1.4.2",gi="https://github.com/airbrake/airbrake-js/tree/master/packages/browser";var jt=function(){return jt=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},jt.apply(this,arguments)},ve=function(){function r(t){var e=this;if(this._filters=[],this._performanceFilters=[],this._scope=new fe,this._onClose=[],!t.projectId||!t.projectKey)throw new Error("airbrake: projectId and projectKey are required");this._opt=t,this._opt.host=this._opt.host||"https://api.airbrake.io",this._opt.timeout=this._opt.timeout||1e4,this._opt.keysBlocklist=this._opt.keysBlocklist||this._opt.keysBlacklist||[/password/,/secret/],this._url=this._opt.host+"/api/v3/projects/"+this._opt.projectId+"/notices?key="+this._opt.projectKey,this._processor=this._opt.processor||xr,this._requester=q(this._opt),this.addFilter(Ir),this.addFilter(Br()),this.addFilter(Dr),this.addFilter(Pr),this.addFilter(function(i){return i.context.notifier={name:pi,version:mi,url:gi},e._opt.environment&&(i.context.environment=e._opt.environment),i}),this.routes=new Ns(this),this.queues=new xs(this),this.queries=new ai(this._opt)}return r.prototype.close=function(){for(var t=0,e=this._onClose;t<e.length;t++){var i=e[t];i()}},r.prototype.scope=function(){return this._scope},r.prototype.setActiveScope=function(t){this._scope=t},r.prototype.addFilter=function(t){this._filters.push(t)},r.prototype.addPerformanceFilter=function(t){this._performanceFilters.push(t)},r.prototype.notify=function(t){var e={errors:[],context:jt(jt({severity:"error"},this.scope().context()),t.context),params:t.params||{},environment:t.environment||{},session:t.session||{}};if((typeof t!="object"||t.error===void 0)&&(t={error:t}),!t.error)return e.error=new Error("airbrake: got err="+JSON.stringify(t.error)+", wanted an Error"),I.resolve(e);var i=this._processor(t.error);e.errors.push(i);for(var s=0,n=this._filters;s<n.length;s++){var o=n[s],a=o(e);if(a===null)return e.error=new Error("airbrake: error is filtered"),I.resolve(e);e=a}return e.context||(e.context={}),e.context.language="JavaScript",this._sendNotice(e)},r.prototype._sendNotice=function(t){var e=Tr(t,{keysBlocklist:this._opt.keysBlocklist});if(this._opt.reporter){if(typeof this._opt.reporter=="function")return this._opt.reporter(t);console.warn("airbrake: options.reporter must be a function")}var i={method:"POST",url:this._url,body:e};return this._requester(i).then(function(s){return t.id=s.json.id,t.url=s.json.url,t}).catch(function(s){return t.error=s,t})},r.prototype.wrap=function(t,e){if(e===void 0&&(e=[]),t._airbrake)return t;var i=this,s=function(){var c=Array.prototype.slice.call(arguments),l=i._wrapArguments(c);try{return t.apply(this,l)}catch(u){throw i.notify({error:u,params:{arguments:c}}),this._ignoreNextWindowError(),u}};for(var n in t)t.hasOwnProperty(n)&&(s[n]=t[n]);for(var o=0,a=e;o<a.length;o++){var n=a[o];t.hasOwnProperty(n)&&(s[n]=t[n])}return s._airbrake=!0,s.inner=t,s},r.prototype._wrapArguments=function(t){for(var e=0;e<t.length;e++){var i=t[e];typeof i=="function"&&(t[e]=this.wrap(i))}return t},r.prototype._ignoreNextWindowError=function(){},r.prototype.call=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var s=this.wrap(t);
10return s.apply(this,Array.prototype.slice.call(arguments,1))},r}();var Ns=function(){function r(t){this._notifier=t,this._routes=new di(t._opt),this._breakdowns=new fi(t._opt)}return r.prototype.start=function(t,e,i,s){t===void 0&&(t=""),e===void 0&&(e=""),i===void 0&&(i=0),s===void 0&&(s="");var n=new ui(t,e,i,s),o=this._notifier.scope().clone();return o.setContext({httpMethod:t,route:e}),o.setRouteMetric(n),this._notifier.setActiveScope(o),n},r.prototype.notify=function(t){t.end();for(var e=0,i=this._notifier._performanceFilters;e<i.length;e++){var s=i[e];if(s(t)===null)return}this._routes.notify(t),this._breakdowns.notify(t)},r}(),xs=function(){function r(t){this._notifier=t,this._queues=new hi(t._opt)}return r.prototype.start=function(t){var e=new ci(t),i=this._notifier.scope().clone();return i.setContext({queue:t}),i.setQueueMetric(e),this._notifier.setActiveScope(i),e},r.prototype.notify=function(t){t.end(),this._queues.notify(t)},r}();function vi(r){return window.navigator&&window.navigator.userAgent&&(r.context.userAgent=window.navigator.userAgent),window.location&&(r.context.url=String(window.location),r.context.rootDirectory=window.location.protocol+"//"+window.location.host),r}var Ps=["debug","log","info","warn","error"];function yi(r){for(var t=function(n){if(!(n in console))return"continue";var o=console[n],a=function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];o.apply(console,c),r.scope().pushHistory({type:"log",severity:n,arguments:c})};a.inner=o,console[n]=a},e=0,i=Ps;e<i.length;e++){var s=i[e];t(s)}}var Bs=["type","name","src"];function bi(r){var t=Is(r);window.addEventListener&&(window.addEventListener("load",t),window.addEventListener("error",function(e){wi(e,"error")||t(e)},!0)),typeof document=="object"&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",t),document.addEventListener("click",t),document.addEventListener("keypress",t))}function Is(r){return function(t){var e=wi(t,"target");if(e){var i={type:t.type};try{i.target=qs(e)}catch(s){i.target="<"+String(s)+">"}r.scope().pushHistory(i)}}}function Ds(r){if(!r)return"";var t=[];if(r.tagName&&t.push(r.tagName.toLowerCase()),r.id&&(t.push("#"),t.push(r.id)),r.classList&&Array.from)t.push("."),t.push(Array.from(r.classList).join("."));else if(r.className){var e=js(r.className);e!==""&&(t.push("."),t.push(e))}if(r.getAttribute)for(var i=0,s=Bs;i<s.length;i++){var n=s[i],o=r.getAttribute(n);o&&t.push("["+n+'="'+o+'"]')}return t.join("")}function js(r){return r.split?r.split(" ").join("."):r.baseVal&&r.baseVal.split?r.baseVal.split(" ").join("."):(console.error("unsupported HTMLElement.className type",typeof r),"")}function qs(r){for(var t=10,e=[],i=r;i;){var s=Ds(i);if(s!==""&&(e.push(s),e.length>t))break;i=i.parentNode}return e.length===0?String(r):e.reverse().join(" > ")}function wi(r,t){try{return r[t]}catch{return null}}function Ei(r){var t=window.fetch;window.fetch=function(e,i){var s={type:"xhr",date:new Date};return s.method=i&&i.method?i.method:"GET",typeof e=="string"?s.url=e:(s.method=e.method,s.url=e.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),t.apply(this,arguments).then(function(n){return s.statusCode=n.status,s.duration=new Date().getTime()-s.date.getTime(),r.scope().pushHistory(s),n}).catch(function(n){throw s.error=n,s.duration=new Date().getTime()-s.date.getTime(),r.scope().pushHistory(s),n})}}var ye="";function _i(){return document.location&&document.location.pathname}function Ai(r){ye=_i();var t=window.onpopstate;window.onpopstate=function(s){var n=_i();if(n&&Si(r,n),t)return t.apply(this,arguments)};var e=history.pushState;history.pushState=function(s,n,o){o&&Si(r,o.toString()),e.apply(this,arguments)}}function Si(r,t){var e=t.indexOf("://");e>=0?(t=t.slice(e+3),e=t.indexOf("/"),t=e>=0?t.slice(e):"/"):t.charAt(0)!=="/"&&(t="/"+t),r.scope().pushHistory({type:"location",from:ye,to:t}),ye=t}function Ti(r){function t(s){var n=s.__state;n.statusCode=s.status,n.duration=new Date().getTime()-n.date.getTime(),r.scope().pushHistory(n)}var e=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(n,o,a,c,l){r._ignoreNextXHR===0&&(this.__state={type:"xhr",method:n,url:o}),e.apply(this,arguments)};var i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(n){var o=this.onreadystatechange;
10return this.onreadystatechange=function(a){if(this.readyState===4&&this.__state&&t(this),o)return o.apply(this,arguments)},this.__state&&(this.__state.date=new Date),i.apply(this,arguments)}}var Hs=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=s[n])},r(t,e)};return function(t,e){r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),qt=function(){return qt=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},qt.apply(this,arguments)},be=function(r){Hs(t,r);function t(e){var i=r.call(this,e)||this;return i.offline=!1,i.todo=[],i._ignoreWindowError=0,i._ignoreNextXHR=0,typeof window>"u"||(i.addFilter(vi),window.addEventListener&&(i.onOnline=i.onOnline.bind(i),window.addEventListener("online",i.onOnline),i.onOffline=i.onOffline.bind(i),window.addEventListener("offline",i.onOffline),i.onUnhandledrejection=i.onUnhandledrejection.bind(i),window.addEventListener("unhandledrejection",i.onUnhandledrejection),i._onClose.push(function(){window.removeEventListener("online",i.onOnline),window.removeEventListener("offline",i.onOffline),window.removeEventListener("unhandledrejection",i.onUnhandledrejection)})),i._opt.ignoreWindowError&&(e.instrumentation.onerror=!1),i._instrument(e.instrumentation)),i}return t.prototype._instrument=function(e){if(e===void 0&&(e={}),e.console===void 0&&(e.console=!Vs(this._opt.environment)),vt(e.onerror)){var i=this,s=window.onerror;window.onerror=function(){s&&s.apply(this,arguments),i.onerror.apply(i,arguments)}}bi(this),vt(e.fetch)&&typeof fetch=="function"&&Ei(this),vt(e.history)&&typeof history=="object"&&Ai(this),vt(e.console)&&typeof console=="object"&&yi(this),vt(e.xhr)&&typeof XMLHttpRequest<"u"&&Ti(this)},t.prototype.notify=function(e){var i=this;return this.offline?new I(function(s,n){for(i.todo.push({err:e,resolve:s,reject:n});i.todo.length>100;){var o=i.todo.shift();if(o===void 0)break;o.resolve({error:new Error("airbrake: offline queue is too large")})}}):r.prototype.notify.call(this,e)},t.prototype.onOnline=function(){this.offline=!1;for(var e=function(a){i.notify(a.err).then(function(c){a.resolve(c)})},i=this,s=0,n=this.todo;s<n.length;s++){var o=n[s];e(o)}this.todo=[]},t.prototype.onOffline=function(){this.offline=!0},t.prototype.onUnhandledrejection=function(e){var i=e.reason||e.detail&&e.detail.reason;if(i){var s=i.message||String(i);if(!(s.indexOf&&s.indexOf("airbrake: ")===0)){if(typeof i!="object"||i.error===void 0){this.notify({error:i,context:{unhandledRejection:!0}});return}this.notify(qt(qt({},i),{context:{unhandledRejection:!0}}))}}},t.prototype.onerror=function(e,i,s,n,o){if(!(this._ignoreWindowError>0)){if(o){this.notify({error:o,context:{windowError:!0}});return}!i||!s||this.notify({error:{message:e,fileName:i,lineNumber:s,columnNumber:n,noStack:!0},context:{windowError:!0}})}},t.prototype._ignoreNextWindowError=function(){var e=this;this._ignoreWindowError++,setTimeout(function(){return e._ignoreWindowError--})},t}(ve);function Vs(r){return r&&r.startsWith&&r.startsWith("dev")}function vt(r){return r===void 0||r===!0}(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let r=HTMLElement,t={HTMLElement:function(){return Reflect.construct(r,[],this.constructor)}};window.HTMLElement=t.HTMLElement,HTMLElement.prototype=r.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,r)})();(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(i){i?(t(i,this),i.click()):(i=document.createElement("input"),i.type="submit",i.hidden=!0,this.appendChild(i),i.click(),this.removeChild(i))};function t(i,s){i instanceof HTMLElement||e(TypeError,"parameter 1 is not of type 'HTMLElement'"),i.type=="submit"||e(TypeError,"The specified element is not a submit button"),i.form==s||e(DOMException,"The specified element is not owned by this form element","NotFoundError")}function e(i,s,n){throw new i("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+s+".",n)}})(HTMLFormElement.prototype);var Ri=new WeakMap;function $s(r){let t=r instanceof Element?r:r instanceof Node?r.parentElement:null,e=t?t.closest("input, button"):null;return e?.type=="submit"?e:null}function Us(r){let t=$s(r.target);t&&t.form&&Ri.set(t.form,t)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))r=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",Us,!0),Object.defineProperty(r,"submitter",{get(){if
10(this.type=="submit"&&this.target instanceof HTMLFormElement)return Ri.get(this.target)}})})();var X;(function(r){r.eager="eager",r.lazy="lazy"})(X||(X={}));var B=class extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new B.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="complete"?this.delegate.completeChanged():t=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get loading(){return Ws(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var t,e;return(e=(t=this.ownerDocument)===null||t===void 0?void 0:t.documentElement)===null||e===void 0?void 0:e.hasAttribute("data-turbo-preview")}};function Ws(r){switch(r.toLowerCase()){case"lazy":return X.lazy;default:return X.eager}}function O(r){return new URL(r.toString(),document.baseURI)}function tt(r){let t;if(r.hash)return r.hash.slice(1);if(t=r.href.match(/#(.*)$/))return t[1]}function Ue(r,t){let e=t?.getAttribute("formaction")||r.getAttribute("action")||r.action;return O(e)}function Ks(r){return(Qs(r).match(/\.[^.]*$/)||[])[0]||""}function zs(r){return!!Ks(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Js(r,t){let e=Ys(t);return r.href===O(e).href||r.href.startsWith(e)}function ht(r,t){return Js(r,t)&&zs(r)}function we(r){let t=tt(r);return t!=null?r.href.slice(0,-(t.length+1)):r.href}function Ht(r){return we(r)}function Xs(r,t){return O(r).href==O(t).href}function Gs(r){return r.pathname.split("/").slice(1)}function Qs(r){return Gs(r).slice(-1)[0]}function Ys(r){return Zs(r.origin+r.pathname)}function Zs(r){return r.endsWith("/")?r:r+"/"}var yt=class{constructor(t){this.response=t}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 O(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(t){return this.response.headers.get(t)}};function bt(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{let t=document.createElement("script"),e=Ut("csp-nonce");return e&&(t.nonce=e),t.textContent=r.textContent,t.async=!1,tn(t,r),t}}function tn(r,t){for(let{name:e,value:i}of t.attributes)r.setAttribute(e,i)}function en(r){let t=document.createElement("template");return t.innerHTML=r,t.content}function A(r,{target:t,cancelable:e,detail:i}={}){let s=new CustomEvent(r,{cancelable:e,bubbles:!0,composed:!0,detail:i});return t&&t.isConnected?t.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function Vt(){return new Promise(r=>requestAnimationFrame(()=>r()))}function rn(){return new Promise(r=>setTimeout(()=>r(),0))}function sn(){return Promise.resolve()}function Fi(r=""){return new DOMParser().parseFromString(r,"text/html")}function Mi(r,...t){let e=nn(r,t).replace(/^\n/,"").split(` 11`),i=e[0].match(/^\s+/),s=i?i[0].length:0;return e.map(n=>n.slice(s)).join(` 12`)}function nn(r,t){return r.reduce((e,i,s)=>{let n=t[s]==null?"":t[s];return e+i+n},"")}function lt(){return Array.from({length:36}).map((r,t)=>t==8||t==13||t==18||t==23?"-":t==14?"4":t==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function $t(r,...t){for(let e of t.map(i=>i?.getAttribute(r)))if(typeof e=="string")return e;return null}function on(r,...t){return t.some(e=>e&&e.hasAttribute(r))}function Ee(...r){for(let t of r)t.localName=="turbo-frame"&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function _e(...r){for(let t of r)t.localName=="turbo-frame"&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function an(r,t=2e3){return new Promise(e=>{let i=()=>{r.removeEventListener("error",i),r.removeEventListener("load",i),e()};r.addEventListener("load",i,{once:!0}),r.addEventListener("error",i,{once:!0}),setTimeout(e,t)})}function Ni(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function cn(r){return r=="advance"||r=="replace"||r=="restore"}function Yt(...r){let t=$t("data-turbo-action",...r);return cn(t)?t:null}function xi(r){return document.querySelector(`meta[name="${r}"]`)}function Ut(r){let t=xi(r);return t&&t.content}function hn(r,t){let e=xi(r);return e||(e=document.createElement("meta"),e.setAttribute("name",r),document.head.appendChild(e)),e.setAttribute("content",t),e}function Wt(r,t){var e;if(r instanceof Element)return r.closest(t)||Wt(r.assignedSlot||((e=r.getRootNode())===null||e===void 0?void 0:e.host),t)}var k;(function(r){r[r.get=0]="get",r[r.post=1]="post",r[r.put=2]="put",r[r.patch=3]="patch",r[r.delete=4]="delete"})(k||(k={}));function ln(r){switch(r.toLowerCase()){case"get":return k.get;case"post":return k.post;case"put":return k.put;case"patch":return k.patch;case"delete":return k.delete}}var wt=class{constructor(t,e,i,s=new URLSearchParams,n=null){this.abortController=new AbortController,this.resolveRequestPromise=o=>{},this.delegate=t,this.method=e,this.headers=this.defaultHeaders,this.body=s,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(){let{fetchOptions:t}=this;this.delegate.prepareRequest(this),await this.allowRequestToBeIntercepted(t);try{this.delegate.requestStarted(this);let e=await fetch(this.url.href,t);return await this.receive(e)}catch(e){if(e.name!=="AbortError")throw this.willDelegateErrorHandling(e)&&this.delegate.requestErrored(this,e),e}finally{this.delegate.requestFinished(this)}}async receive(t){let e=new yt(t);return A("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:e},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,e):e.succeeded?this.delegate.requestSucceededWithResponse(this,e):this.delegate.requestFailedWithResponse(this,e),e}get fetchOptions(){var t;return{method:k[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abort
12Signal,referrer:(t=this.delegate.referrer)===null||t===void 0?void 0:t.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===k.get}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}async allowRequestToBeIntercepted(t){let e=new Promise(s=>this.resolveRequestPromise=s);A("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&await e}willDelegateErrorHandling(t){return!A("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented}},Se=class{constructor(t,e){this.started=!1,this.intersect=i=>{let s=i.slice(-1)[0];s?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=t,this.element=e,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))}},V=class{static wrap(t){return typeof t=="string"?new this(en(t)):t}constructor(t){this.fragment=un(t)}};V.contentType="text/vnd.turbo-stream.html";function un(r){for(let t of r.querySelectorAll("turbo-stream")){let e=document.importNode(t,!0);for(let i of e.templateElement.content.querySelectorAll("script"))i.replaceWith(bt(i));t.replaceWith(e)}return r}var z;(function(r){r[r.initialized=0]="initialized",r[r.requesting=1]="requesting",r[r.waiting=2]="waiting",r[r.receiving=3]="receiving",r[r.stopping=4]="stopping",r[r.stopped=5]="stopped"})(z||(z={}));var J;(function(r){r.urlEncoded="application/x-www-form-urlencoded",r.multipart="multipart/form-data",r.plain="text/plain"})(J||(J={}));function dn(r){switch(r.toLowerCase()){case J.multipart:return J.multipart;case J.plain:return J.plain;default:return J.urlEncoded}}var et=class{static confirmMethod(t,e,i){return Promise.resolve(confirm(t))}constructor(t,e,i,s=!1){this.state=z.initialized,this.delegate=t,this.formElement=e,this.submitter=i,this.formData=fn(e,i),this.location=O(this.action),this.method==k.get&&gn(this.location,[...this.body.entries()]),this.fetchRequest=new wt(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=s}get method(){var t;let e=((t=this.submitter)===null||t===void 0?void 0:t.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return ln(e.toLowerCase())||k.get}get action(){var t;let e=typeof this.formElement.action=="string"?this.formElement.action:null;return!((t=this.submitter)===null||t===void 0)&&t.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||e||""}get body(){return this.enctype==J.urlEncoded||this.method==k.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var t;return dn(((t=this.submitter)===null||t===void 0?void 0:t.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[...this.formData].reduce((t,[e,i])=>
12t.concat(typeof i=="string"?[[e,i]]:[]),[])}async start(){let{initialized:t,requesting:e}=z,i=$t("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof i=="string"&&!await et.confirmMethod(i,this.formElement,this.submitter))&&this.state==t)return this.state=e,this.fetchRequest.perform()}stop(){let{stopping:t,stopped:e}=z;if(this.state!=t&&this.state!=e)return this.state=t,this.fetchRequest.cancel(),!0}prepareRequest(t){if(!t.isSafe){let e=pn(Ut("csrf-param"))||Ut("csrf-token");e&&(t.headers["X-CSRF-Token"]=e)}this.requestAcceptsTurboStreamResponse(t)&&t.acceptResponseType(V.contentType)}requestStarted(t){var e;this.state=z.waiting,(e=this.submitter)===null||e===void 0||e.setAttribute("disabled",""),this.setSubmitsWith(),A("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,e){this.result={success:e.succeeded,fetchResponse:e}}requestSucceededWithResponse(t,e){if(e.clientError||e.serverError)this.delegate.formSubmissionFailedWithResponse(this,e);else if(this.requestMustRedirect(t)&&mn(e)){let i=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,i)}else this.state=z.receiving,this.result={success:!0,fetchResponse:e},this.delegate.formSubmissionSucceededWithResponse(this,e)}requestFailedWithResponse(t,e){this.result={success:!1,fetchResponse:e},this.delegate.formSubmissionFailedWithResponse(this,e)}requestErrored(t,e){this.result={success:!1,error:e},this.delegate.formSubmissionErrored(this,e)}requestFinished(t){var e;this.state=z.stopped,(e=this.submitter)===null||e===void 0||e.removeAttribute("disabled"),this.resetSubmitterText(),A("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let t=this.submitter;this.originalSubmitText=t.value,t.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let t=this.submitter;t.value=this.originalSubmitText}}}requestMustRedirect(t){return!t.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(t){return!t.isSafe||on("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var t;return(t=this.submitter)===null||t===void 0?void 0:t.getAttribute("data-turbo-submits-with")}};function fn(r,t){let e=new FormData(r),i=t?.getAttribute("name"),s=t?.getAttribute("value");return i&&e.append(i,s||""),e}function pn(r){if(r!=null){let e=(document.cookie?document.cookie.split("; "):[]).find(i=>i.startsWith(r));if(e){let i=e.split("=").slice(1).join("=");return i?decodeURIComponent(i):void 0}}}function mn(r){return r.statusCode==200&&!r.redirected}function gn(r,t){let e=new URLSearchParams;for(let[i,s]of t)s instanceof File||e.append(i,s);return r.search=e.toString(),r}var ut=class{constructor(t){this.element=t}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(t){return this.getElementForAnchor(t)!=null}getElementForAnchor(t){return t?this.element.querySelector(`[id='${t}'], a[name='${t}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){let t="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";for(let e of this.element.querySelectorAll("[autofocus]"))if(e.closest(t)==null)return e;return null}get permanentElements(){return Bi(this.element)}getPermanentElementById(t){return Pi(this.element,t)}getPermanentElementMapForSnapshot(t){let e={};for(let i of this.permanentElements){let{id:s}=i,n=t.getPermanentElementById(s);n&&(e[s]=[i,n])}return e}};function Pi(r,t){return r.querySelector(`#${t}[data-turbo-permanent]`)}function Bi(r){return r.querySelectorAll("[id][data-turbo-permanent]")}var Et=class{constructor(t,e){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=i=>{if(!i.defaultPrevented){let s=i.target instanceof HTMLFormElement?i.target:void 0,n=i.submitter||void 0;s&&vn(s,n)&&yn(s,n)&&this.delegate.willSubmitForm(s,n)&&(i.preventDefault(),i.stopImmediatePropagation(),this.delegate.formSubmitted(s,n))}},this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}};function vn(r,t){return(t?.getAttribute("formmethod")||r.getAttribute("method"))!="dialog"}function yn(r,t){if(t?.hasAttribute("formtarget")||r.hasAttribute("target")){let e=t?.getAttribute("formtarget")||r.target;for(let i of document.getElementsByName(e))if(i instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Kt=class{constructor(t,e){this.resolveRenderPromise=i=>{},this.resolveInterceptionPromise=i=>{},this.delegate=t,this.element=e}scrollToAnchor(t){let e=this.snapshot.getElementForAnchor(t);e?(this.scrollToElement(e),this.focusElement(e)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(tt(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focu
12s(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:e}){this.scrollRoot.scrollTo(t,e)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){let{isPreview:e,shouldRender:i,newSnapshot:s}=t;if(i)try{this.renderPromise=new Promise(c=>this.resolveRenderPromise=c),this.renderer=t,await this.prepareToRenderSnapshot(t);let n=new Promise(c=>this.resolveInterceptionPromise=c),o={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(s,o)||await n,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(s,e),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(t.reloadReason)}invalidate(t){this.delegate.viewInvalidated(t)}async prepareToRenderSnapshot(t){this.markAsPreview(t.isPreview),await t.prepareToRender()}markAsPreview(t){t?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(t){await t.render()}finishRenderingSnapshot(t){t.finishRendering()}},Ae=class extends Kt{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new ut(this.element)}},zt=class{constructor(t,e){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,i.detail.originalEvent)&&(this.clickEvent.preventDefault(),i.preventDefault(),this.delegate.linkClickIntercepted(i.target,i.detail.url,i.detail.originalEvent)),delete this.clickEvent},this.willVisit=i=>{delete this.clickEvent},this.delegate=t,this.element=e}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(t){let e=t instanceof Element?t:t instanceof Node?t.parentElement:null;return e&&e.closest("turbo-frame, html")==this.element}},Jt=class{constructor(t,e){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=i=>{if(i instanceof MouseEvent&&this.clickEventIsSignificant(i)){let s=i.composedPath&&i.composedPath()[0]||i.target,n=this.findLinkFromClickTarget(s);if(n&&bn(n)){let o=this.getLocationForLink(n);this.delegate.willFollowLinkToLocation(n,o,i)&&(i.preventDefault(),this.delegate.followedLinkToLocation(n,o))}}},this.delegate=t,this.eventTarget=e}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}findLinkFromClickTarget(t){return Wt(t,"a[href]:not([target^=_]):not([download])")}getLocationForLink(t){return O(t.getAttribute("href")||"")}};function bn(r){if(r.hasAttribute("target")){for(let t of document.getElementsByName(r.target))if(t instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Xt=class{constructor(t,e){this.delegate=t,this.linkInterceptor=new Jt(this,e)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(t,e,i){return this.delegate.willSubmitFormLinkToLocation(t,e,i)&&t.hasAttribute("data-turbo-method")}followedLinkToLocation(t,e){let i=document.createElement("form"),s="hidden";for(let[f,m]of e.searchParams)i.append(Object.assign(document.createElement("input"),{type:s,name:f,value:m}));let n=Object.assign(e,{search:""});i.setAttribute("data-turbo","true"),i.setAttribute("action",n.href),i.setAttribute("hidden","");let o=t.getAttribute("data-turbo-method");o&&i.setAttribute("method",o);let a=t.getAttribute("data-turbo-frame");a&&i.setAttribute("data-turbo-frame",a);let c=Yt(t);c&&i.setAttribute("data-turbo-action",c);let l=t.getAttribute("data-turbo-confirm");l&&i.setAttribute("data-turbo-confirm",l),t.hasAttribute("data-turbo-stream")&&i.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,e,
12i),document.body.appendChild(i),i.addEventListener("turbo:submit-end",()=>i.remove(),{once:!0}),requestAnimationFrame(()=>i.requestSubmit())}},Gt=class{static async preservingPermanentElements(t,e,i){let s=new this(t,e);s.enter(),await i(),s.leave()}constructor(t,e){this.delegate=t,this.permanentElementMap=e}enter(){for(let t in this.permanentElementMap){let[e,i]=this.permanentElementMap[t];this.delegate.enteringBardo(e,i),this.replaceNewPermanentElementWithPlaceholder(i)}}leave(){for(let t in this.permanentElementMap){let[e]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(e),this.replacePlaceholderWithPermanentElement(e),this.delegate.leavingBardo(e)}}replaceNewPermanentElementWithPlaceholder(t){let e=wn(t);t.replaceWith(e)}replaceCurrentPermanentElementWithClone(t){let e=t.cloneNode(!0);t.replaceWith(e)}replacePlaceholderWithPermanentElement(t){let e=this.getPlaceholderById(t.id);e?.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find(e=>e.content==t)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function wn(r){let t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",r.id),t}var _t=class{constructor(t,e,i,s,n=!0){this.activeElement=null,this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=s,this.willRender=n,this.renderElement=i,this.promise=new Promise((o,a)=>this.resolvingFunctions={resolve:o,reject:a})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(t){await Gt.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){let t=this.connectedSnapshot.firstAutofocusableElement;En(t)&&t.focus()}enteringBardo(t){this.activeElement||t.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}};function En(r){return r&&typeof r.focus=="function"}var St=class extends _t{static renderElement(t,e){var i;let s=document.createRange();s.selectNodeContents(t),s.deleteContents();let n=e,o=(i=n.ownerDocument)===null||i===void 0?void 0:i.createRange();o&&(o.selectNodeContents(n),t.appendChild(o.extractContents()))}constructor(t,e,i,s,n,o=!0){super(e,i,s,n,o),this.delegate=t}get shouldRender(){return!0}async render(){await Vt(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Vt(),this.focusFirstAutofocusableElement(),await Vt(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let t=this.currentElement.firstElementChild,e=_n(this.currentElement.getAttribute("data-autoscroll-block"),"end"),i=Sn(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(t)return t.scrollIntoView({block:e,behavior:i}),!0}return!1}activateScriptElements(){for(let t of this.newScriptElements){let e=bt(t);t.replaceWith(e)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function _n(r,t){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:t}function Sn(r,t){return r=="auto"||r=="smooth"?r:t}var P=class{static get defaultCSS(){return Mi` 13 .turbo-progress-bar { 14 position: fixed; 15 display: block; 16 top: 0; 17 left: 0; 18 height: 3px; 19 background: #0076ff; 20 z-index: 2147483647; 21 transition: 22 width ${P.animationDuration}ms ease-out, 23 opacity ${P.animationDuration/2}ms ${P.animationDuration/2}ms ease-in; 24 transform: translate3d(0, 0, 0); 25 } 26 `}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)}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(t){this.value=t,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(t){this.progressElement.style.opacity="0",setTimeout(t,P.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,P.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let t=document.createElement("style");return t.type="text/css",t.textContent=P.defaultCSS,this.cspNonce&&(t.nonce=this.cspNonce),t}createProgressElement(){let t=document.createElement("div");return t.className="turbo-progress-bar",t}get cspNonce(){return Ut("csp-nonce")}};P.animationDuration=300;var Te=class extends ut{constructor(){super(...arguments),this.detailsByOuterHTML=this.children.filter(t=>!Ln(t)).map(t=>Rn(t)).reduce((t,e)=>{let{outerHTML:i}=e,s=i in t?t[i]:{type:An(e),tracked:Tn(e),elements:[]};return Object.assign(Object.assign({},t),{[i]:Object.assign(Object.assign({},s),{elements:[...s.elements,e]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(t=>this.detailsByOuterHTML[t].tracked).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,e){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in e.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==t).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,e)=>{let{type:i,tracked:s,elements:n}=this.detailsByOuterHTML[e];return i==null&&!s?[...t,...n]:n.length>1?[...t,...n.slice(1)]:t},[])}getMetaValue(t){let e=this.findMetaElementByName(t);return e?e.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((e,i)=>{let{elements:[s]}=this.detailsByOuterHTML[i];return kn(s,t)?s:e},void 0)}};function An(r){if(On(r))return"script";if(Cn(r))return"stylesheet"}function Tn(r){return r.getAttribute("data-turbo-track")=="reload"}function On(r){return r.localName=="script"}function Ln(r){return r.localName=="noscript"}function Cn(r){let t=r.localName;return t=="style"||t=="link"&&r.getAttribute("rel")=="stylesheet"}function kn(r,t){return r.localName=="meta"&&r.getAttribute("name")==t}function Rn(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}var R=class extends ut{static fromHTMLString(t=""){return this.fromDocument(Fi(t))}static fromElement(t){return this.fromDocument(t.ownerDocument)}static fromDocument({head:t,body:e}){return new this(e,new Te(t))}constructor(t,e){super(t),this.headSnapshot=e}clone(){let t=this.element.cloneNode(!0),e=this.element.querySelectorAll("select"),i=t.querySelectorAll("select");for(let[s,n]of e.entries()){let o=i[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of t.querySelectorAll('input[type="password"]'))s.value="";return new R(t,this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var t;let e=(t=this.getSetting("root"))!==null&&t!==void 0?t:"/";return O(e)}
26get 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(t){return this.headSnapshot.getMetaValue(`turbo-${t}`)}},ct;(function(r){r.visitStart="visitStart",r.requestStart="requestStart",r.requestEnd="requestEnd",r.visitEnd="visitEnd"})(ct||(ct={}));var x;(function(r){r.initialized="initialized",r.started="started",r.canceled="canceled",r.failed="failed",r.completed="completed"})(x||(x={}));var Fn={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},G;(function(r){r[r.networkFailure=0]="networkFailure",r[r.timeoutFailure=-1]="timeoutFailure",r[r.contentTypeMismatch=-2]="contentTypeMismatch"})(G||(G={}));var Oe=class{constructor(t,e,i,s={}){this.identifier=lt(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.shouldCacheSnapshot=!0,this.acceptsStreamResponse=!1,this.snapshotCached=!1,this.state=x.initialized,this.delegate=t,this.location=e,this.restorationIdentifier=i||lt();let{action:n,historyChanged:o,referrer:a,snapshot:c,snapshotHTML:l,response:u,visitCachedSnapshot:f,willRender:m,updateHistory:p,shouldCacheSnapshot:v,acceptsStreamResponse:_}=Object.assign(Object.assign({},Fn),s);this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=c,this.snapshotHTML=l,this.response=u,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=f,this.willRender=m,this.updateHistory=p,this.scrolled=!m,this.shouldCacheSnapshot=v,this.acceptsStreamResponse=_}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==x.initialized&&(this.recordTimingMetric(ct.visitStart),this.state=x.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==x.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=x.canceled)}complete(){this.state==x.started&&(this.recordTimingMetric(ct.visitEnd),this.state=x.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==x.started&&(this.state=x.failed,this.adapter.visitFailed(this))}changeHistory(){var t;if(!this.historyChanged&&this.updateHistory){let e=this.location.href===((t=this.referrer)===null||t===void 0?void 0:t.href)?"replace":this.action,i=Ni(e);this.history.update(i,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new wt(this,k.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(ct.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(t=this.response){if(this.response=t,t){let{statusCode:e}=t;Oi(e)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,e)}}finishRequest(){this.recordTimingMetric(ct.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:t,responseHTML:e}=this.response;this.render(async()=>{this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Oi(t)&&e!=null?(await this.view.renderPage(R.fromHTMLString(e),!1,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(R.fromHTMLString(e),this),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let t=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(t&&(!tt(this.location)||t.hasAnchor(tt(this.location)))&&(this.action=="restore"||t.isPreviewable))return t}getPreloadedSnapshot(){if(this.snapshotHTML)return R.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let t=this.getCachedSnapshot();if(t){let e=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(t,e,this.willRender,this),this.performScroll(),this.adapter.visitRendered(this),e||this.complete())})}}followRedirect(){var t;this.redirectedToLocation&&!this.followedRedirect&&(!((t=this.response)===null||t===void 0)&&t.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(t){this.acceptsStreamResponse&&t.acceptResponseType(V.contentType)}
26requestStarted(){this.startRequest()}requestPreventedHandlingResponse(t,e){}async requestSucceededWithResponse(t,e){let i=await e.responseHTML,{redirected:s,statusCode:n}=e;i==null?this.recordResponse({statusCode:G.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=e.redirected?e.location:void 0,this.recordResponse({statusCode:n,responseHTML:i,redirected:s}))}async requestFailedWithResponse(t,e){let i=await e.responseHTML,{redirected:s,statusCode:n}=e;i==null?this.recordResponse({statusCode:G.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:i,redirected:s})}requestErrored(t,e){this.recordResponse({statusCode:G.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&(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:t}=this.restorationData;if(t)return this.view.scrollToPosition(t),!0}scrollToAnchor(){let t=tt(this.location);if(t!=null)return this.view.scrollToAnchor(t),!0}recordTimingMetric(t){this.timingMetrics[t]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(t){switch(t){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(this.snapshot).then(t=>t&&this.visitCachedSnapshot(t)),this.snapshotCached=!0)}async render(t){this.cancelRender(),await new Promise(e=>{this.frame=requestAnimationFrame(()=>e())}),await t(),delete this.frame}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Oi(r){return r>=200&&r<300}var Le=class{constructor(t){this.progressBar=new P,this.showProgressBar=()=>{this.progressBar.show()},this.session=t}visitProposedToLocation(t,e){this.navigator.startVisit(t,e?.restorationIdentifier||lt(),e)}visitStarted(t){this.location=t.location,t.loadCachedSnapshot(),t.issueRequest(),t.goToSamePageAnchor()}visitRequestStarted(t){this.progressBar.setValue(0),t.hasCachedSnapshot()||t.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(t){t.loadResponse()}visitRequestFailedWithStatusCode(t,e){switch(e){case G.networkFailure:case G.timeoutFailure:case G.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:e}});default:return t.loadResponse()}}visitRequestFinished(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(t){}pageInvalidated(t){this.reload(t)}visitFailed(t){}visitRendered(t){}formSubmissionStarted(t){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(t){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(t){var e;A("turbo:reload",{detail:t}),window.location.href=((e=this.location)===null||e===void 0?void 0:e.toString())||window.location.href}get navigator(){return this.session.navigator}},Ce=class{constructor(){this.selector="[data-turbo-temporary]",this.deprecatedSelector="[data-turbo-cache=false]",this.started=!1,this.removeTemporaryElements=t=>{for(let e of this.temporaryElements)e.remove()}}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let t=document.querySelectorAll(this.deprecatedSelector);return t.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...t]}},ke=class{constructor(t,e){this.session=t,this.element=e,this.linkInterceptor=new zt(this,e),this.formSubmitObserver=new Et(this,e)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}
26shouldInterceptLinkClick(t,e,i){return this.shouldRedirect(t)}linkClickIntercepted(t,e,i){let s=this.findFrameElement(t);s&&s.delegate.linkClickIntercepted(t,e,i)}willSubmitForm(t,e){return t.closest("turbo-frame")==null&&this.shouldSubmit(t,e)&&this.shouldRedirect(t,e)}formSubmitted(t,e){let i=this.findFrameElement(t,e);i&&i.delegate.formSubmitted(t,e)}shouldSubmit(t,e){var i;let s=Ue(t,e),n=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),o=O((i=n?.content)!==null&&i!==void 0?i:"/");return this.shouldRedirect(t,e)&&ht(s,o)}shouldRedirect(t,e){if(t instanceof HTMLFormElement?this.session.submissionIsNavigatable(t,e):this.session.elementIsNavigatable(t)){let s=this.findFrameElement(t,e);return s?s!=t.closest("turbo-frame"):!1}else return!1}findFrameElement(t,e){let i=e?.getAttribute("data-turbo-frame")||t.getAttribute("data-turbo-frame");if(i&&i!="_top"){let s=this.element.querySelector(`#${i}:not([disabled])`);if(s instanceof B)return s}}},Re=class{constructor(t){this.restorationIdentifier=lt(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:i}=e.state||{};if(i){this.location=new URL(window.location.href);let{restorationIdentifier:s}=i;this.restorationIdentifier=s,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,s)}}},this.onPageLoad=async e=>{await sn(),this.pageLoaded=!0},this.delegate=t}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(t,e){this.update(history.pushState,t,e)}replace(t,e){this.update(history.replaceState,t,e)}update(t,e,i=lt()){let s={turbo:{restorationIdentifier:i}};t.call(history,s,"",e.href),this.location=e,this.restorationIdentifier=i}getRestorationDataForIdentifier(t){return this.restorationData[t]||{}}updateRestorationData(t){let{restorationIdentifier:e}=this,i=this.restorationData[e];this.restorationData[e]=Object.assign(Object.assign({},i),t)}assumeControlOfScrollRestoration(){var t;this.previousScrollRestoration||(this.previousScrollRestoration=(t=history.scrollRestoration)!==null&&t!==void 0?t:"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"}},Fe=class{constructor(t){this.delegate=t}proposeVisit(t,e={}){this.delegate.allowsVisitingLocationWithAction(t,e.action)&&(ht(t,this.view.snapshot.rootLocation)?this.delegate.visitProposedToLocation(t,e):window.location.href=t.toString())}startVisit(t,e,i={}){this.stop(),this.currentVisit=new Oe(this,O(t),e,Object.assign({referrer:this.location},i)),this.currentVisit.start()}submitForm(t,e){this.stop(),this.formSubmission=new et(this,t,e,!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(t){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(t)}async formSubmissionSucceededWithResponse(t,e){if(t==this.formSubmission){let i=await e.responseHTML;if(i){let s=t.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=e,c={action:this.getActionForFormSubmission(t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:i,redirected:o}};this.proposeVisit(e.location,c)}}}async formSubmissionFailedWithResponse(t,e){let i=await e.responseHTML;if(i){let s=R.fromHTMLString(i);e.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(t,e){console.error(e)}formSubmissionFinished(t){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(t)}visitStarted(t){this.delegate.visitStarted(t)}visitCompleted(t){this.delegate.visitCompleted(t)}locationWithActionIsSamePage(t,e){let i=tt(t),s=tt(this.view.lastRenderedLocation),n=e==="restore"&&typeof i>"u";return e!=="replace"&&we(t)===we(this.view.lastRenderedLocation)&&(n||i!=null&&i!==s)}visitScrolledToSamePageLocation(t,e){this.delegate.visitScrolledToSamePageLocation(t,e)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission({submitter:t,formElement:e}){return Yt(t,e)||"advance"}},H;(function(r){r[r.initial=0]="initial",r[r.loading=1]="loading",r[r.interactive=2]="interactive",r[r.complete=3]="complete"})(H||(H={}));var Me=class{constructor(t){this.stage=H.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:e}=this;
26e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=t}start(){this.started||(this.stage==H.initial&&(this.stage=H.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==H.loading&&(this.stage=H.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==H.interactive&&(this.stage=H.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},Ne=class{constructor(t){this.started=!1,this.onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},this.delegate=t}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(t){this.delegate.scrollPositionChanged(t)}},xe=class{render({fragment:t}){Gt.preservingPermanentElements(this,Mn(t),()=>document.documentElement.appendChild(t))}enteringBardo(t,e){e.replaceWith(t.cloneNode(!0))}leavingBardo(){}};function Mn(r){let t=Bi(document.documentElement),e={};for(let i of t){let{id:s}=i;for(let n of r.querySelectorAll("turbo-stream")){let o=Pi(n.templateElement.content,s);o&&(e[s]=[i,o])}}return e}var Pe=class{constructor(t){this.sources=new Set,this.started=!1,this.inspectFetchResponse=e=>{let i=Nn(e);i&&xn(i)&&(e.preventDefault(),this.receiveMessageResponse(i))},this.receiveMessageEvent=e=>{this.started&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)},this.delegate=t}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(t){this.streamSourceIsConnected(t)||(this.sources.add(t),t.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(t){this.streamSourceIsConnected(t)&&(this.sources.delete(t),t.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(t){return this.sources.has(t)}async receiveMessageResponse(t){let e=await t.responseHTML;e&&this.receiveMessageHTML(e)}receiveMessageHTML(t){this.delegate.receivedMessageFromStream(V.wrap(t))}};function Nn(r){var t;let e=(t=r.detail)===null||t===void 0?void 0:t.fetchResponse;if(e instanceof yt)return e}function xn(r){var t;return((t=r.contentType)!==null&&t!==void 0?t:"").startsWith(V.contentType)}var Qt=class extends _t{static renderElement(t,e){let{documentElement:i,body:s}=document;i.replaceChild(e,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:t,head:e}=document;t.replaceChild(this.newHead,e),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let t of this.scriptElements){let e=t.parentNode;if(e){let i=bt(t);e.replaceChild(i,t)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},At=class extends _t{static renderElement(t,e){document.body&&e instanceof HTMLBodyElement?document.body.replaceWith(e):document.documentElement.appendChild(e)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}
26get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){let t=this.mergeProvisionalElements(),e=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await e}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let t=[];for(let e of this.newHeadStylesheetElements)t.push(an(e)),document.head.appendChild(e);await Promise.all(t)}copyNewHeadScriptElements(){for(let t of this.newHeadScriptElements)document.head.appendChild(bt(t))}async mergeProvisionalElements(){let t=[...this.newHeadProvisionalElements];for(let e of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(e,t)||document.head.removeChild(e);for(let e of t)document.head.appendChild(e)}isCurrentElementInElementList(t,e){for(let[i,s]of e.entries()){if(t.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(t.innerHTML==s.innerHTML)return e.splice(i,1),!0}if(s.isEqualNode(t))return e.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(let t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let t of this.newBodyScriptElements){let e=bt(t);t.replaceWith(e)}}async assignNewBody(){await this.renderElement(this.currentElement,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(t){this.keys=[],this.snapshots={},this.size=t}has(t){return Ht(t)in this.snapshots}get(t){if(this.has(t)){let e=this.read(t);return this.touch(t),e}}put(t,e){return this.write(t,e),this.touch(t),e}clear(){this.snapshots={}}read(t){return this.snapshots[Ht(t)]}write(t,e){this.snapshots[Ht(t)]=e}touch(t){let e=Ht(t),i=this.keys.indexOf(e);i>-1&&this.keys.splice(i,1),this.keys.unshift(e),this.trim()}trim(){for(let t of this.keys.splice(this.size))delete this.snapshots[t]}},Ie=class extends Kt{constructor(){super(...arguments),this.snapshotCache=new Be(10),this.lastRenderedLocation=new URL(location.href),this.forceReloaded=!1}renderPage(t,e=!1,i=!0,s){let n=new At(this.snapshot,t,At.renderElement,e,i);return n.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(n)}renderError(t,e){e?.changeHistory();let i=new Qt(this.snapshot,t,Qt.renderElement,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:e}=this;await rn();let i=t.clone();return this.snapshotCache.put(e,i),i}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}get snapshot(){return R.fromElement(this.element)}},De=class{constructor(t){this.selector="a[data-turbo-preload]",this.delegate=t}get snapshotCache(){return this.delegate.navigator.view.snapshotCache}start(){if(document.readyState==="loading")return document.addEventListener("DOMContentLoaded",()=>{this.preloadOnLoadLinksForView(document.body)});this.preloadOnLoadLinksForView(document.body)}preloadOnLoadLinksForView(t){for(let e of t.querySelectorAll(this.selector))this.preloadURL(e)}async preloadURL(t){let e=new URL(t.href);if(!this.snapshotCache.has(e))try{let s=await(await fetch(e.toString(),{headers:{"VND.PREFETCH":"true",Accept:"text/html"}})).text(),n=R.fromHTMLString(s);this.snapshotCache.put(e,n)}catch{}}},je=class{constructor(){this.navigator=new Fe(this),this.history=new Re(this),this.preloader=new De(this),this.view=new Ie(this,document.documentElement),this.adapter=new Le(this),this.pageObserver=new Me(this),this.cacheObserver=new Ce,this.linkClickObserver=new Jt(this,window),this.formSubmitObserver=new Et(this,document),this.scrollObserver=new Ne(this),this.streamObserver=new Pe(this),this.formLinkClickObserver=new Xt(this,document.documentElement),this.frameRedirector=new ke(this,document.documentElement),this.streamMessageRenderer=new xe,this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1,this.formMode="on"}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(t){this.adapter=t}visit(t,e={}){let i=e.frame?document.getElementById(e.frame):null;i instanceof B?(i.src=t.toString(),i.loaded):this.navigator.proposeVisit(O(t),e)}connectStreamSource(t){this.streamObserver.connectStreamSource(t)}disconnectStreamSource(t){this.streamObserver.disconnectStreamSource(t)}renderStreamMessage(t){this.streamMessageRenderer.render(V.wrap(t))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(t){this.progressBarDelay=t}setFormMode(t){this.formMode=t}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(t,e){this.enabled?this.navigator.startVisit(t,e,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(t){this.history.updateRestorationData({scrollPosition:t})}willSubmitFormLinkToLocation(t,e){return this.elementIsNavigatable(t)&&ht(e,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}
26willFollowLinkToLocation(t,e,i){return this.elementIsNavigatable(t)&&ht(e,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(t,e,i)}followedLinkToLocation(t,e){let i=this.getActionForLink(t),s=t.hasAttribute("data-turbo-stream");this.visit(e.href,{action:i,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(t,e){return this.locationWithActionIsSamePage(t,e)||this.applicationAllowsVisitingLocation(t)}visitProposedToLocation(t,e){Li(t),this.adapter.visitProposedToLocation(t,e)}visitStarted(t){t.acceptsStreamResponse||Ee(document.documentElement),Li(t.location),t.silent||this.notifyApplicationAfterVisitingLocation(t.location,t.action)}visitCompleted(t){_e(document.documentElement),this.notifyApplicationAfterPageLoad(t.getTimingMetrics())}locationWithActionIsSamePage(t,e){return this.navigator.locationWithActionIsSamePage(t,e)}visitScrolledToSamePageLocation(t,e){this.notifyApplicationAfterVisitingSamePageLocation(t,e)}willSubmitForm(t,e){let i=Ue(t,e);return this.submissionIsNavigatable(t,e)&&ht(O(i),this.snapshot.rootLocation)}formSubmitted(t,e){this.navigator.submitForm(t,e)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(t){this.renderStreamMessage(t)}viewWillCacheSnapshot(){var t;!((t=this.navigator.currentVisit)===null||t===void 0)&&t.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:t},e){let i=this.notifyApplicationBeforeRender(t,e),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(t,e){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}preloadOnLoadLinksForView(t){this.preloader.preloadOnLoadLinksForView(t)}viewInvalidated(t){this.adapter.pageInvalidated(t)}frameLoaded(t){this.notifyApplicationAfterFrameLoad(t)}frameRendered(t,e){this.notifyApplicationAfterFrameRender(t,e)}applicationAllowsFollowingLinkToLocation(t,e,i){return!this.notifyApplicationAfterClickingLinkToLocation(t,e,i).defaultPrevented}applicationAllowsVisitingLocation(t){return!this.notifyApplicationBeforeVisitingLocation(t).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(t,e,i){return A("turbo:click",{target:t,detail:{url:e.href,originalEvent:i},cancelable:!0})}notifyApplicationBeforeVisitingLocation(t){return A("turbo:before-visit",{detail:{url:t.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(t,e){return A("turbo:visit",{detail:{url:t.href,action:e}})}notifyApplicationBeforeCachingSnapshot(){return A("turbo:before-cache")}notifyApplicationBeforeRender(t,e){return A("turbo:before-render",{detail:Object.assign({newBody:t},e),cancelable:!0})}notifyApplicationAfterRender(){return A("turbo:render")}notifyApplicationAfterPageLoad(t={}){return A("turbo:load",{detail:{url:this.location.href,timing:t}})}notifyApplicationAfterVisitingSamePageLocation(t,e){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:t.toString(),newURL:e.toString()}))}notifyApplicationAfterFrameLoad(t){return A("turbo:frame-load",{target:t})}notifyApplicationAfterFrameRender(t,e){return A("turbo:frame-render",{detail:{fetchResponse:t},target:e,cancelable:!0})}submissionIsNavigatable(t,e){if(this.formMode=="off")return!1;{let i=e?this.elementIsNavigatable(e):!0;return this.formMode=="optin"?i&&t.closest('[data-turbo="true"]')!=null:i&&this.elementIsNavigatable(t)}}elementIsNavigatable(t){let e=Wt(t,"[data-turbo]"),i=Wt(t,"turbo-frame");return this.drive||i?e?e.getAttribute("data-turbo")!="false":!0:e?e.getAttribute("data-turbo")=="true":!1}getActionForLink(t){return Yt(t)||"advance"}get snapshot(){return this.view.snapshot}};function Li(r){Object.defineProperties(r,Pn)}var Pn={absoluteURL:{get(){return this.toString()}}},qe=class{constructor(t){this.session=t}clear(){this.session.clearCache()}resetCacheControl(){this.setCacheControl("")}exemptPageFromCache(){this.setCacheControl("no-cache")}exemptPageFromPreview(){this.setCacheControl("no-preview")}setCacheControl(t){hn("turbo-cache-control",t)}}
26,Ii={after(){this.targetElements.forEach(r=>{var t;return(t=r.parentElement)===null||t===void 0?void 0:t.insertBefore(this.templateContent,r.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>{var t;return(t=r.parentElement)===null||t===void 0?void 0:t.insertBefore(this.templateContent,r)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})}},E=new je,Bn=new qe(E),{navigator:In}=E;function Zt(){E.start()}function Dn(r){E.registerAdapter(r)}function jn(r,t){E.visit(r,t)}function Di(r){E.connectStreamSource(r)}function ji(r){E.disconnectStreamSource(r)}function qn(r){E.renderStreamMessage(r)}function Hn(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),E.clearCache()}function Vn(r){E.setProgressBarDelay(r)}function $n(r){et.confirmMethod=r}function Un(r){E.setFormMode(r)}var Wn=Object.freeze({__proto__:null,navigator:In,session:E,cache:Bn,PageRenderer:At,PageSnapshot:R,FrameRenderer:St,start:Zt,registerAdapter:Dn,visit:jn,connectStreamSource:Di,disconnectStreamSource:ji,renderStreamMessage:qn,clearCache:Hn,setProgressBarDelay:Vn,setConfirmMethod:$n,setFormMode:Un,StreamActions:Ii}),He=class extends Error{},Ve=class{constructor(t){this.fetchResponseLoaded=e=>{},this.currentFetchRequest=null,this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.ignoredAttributes=new Set,this.action=null,this.visitCachedSnapshot=({element:e})=>{let i=e.querySelector("#"+this.element.id);i&&this.previousFrameElement&&i.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement},this.element=t,this.view=new Ae(this,this.element),this.appearanceObserver=new Se(this,this.element),this.formLinkClickObserver=new Xt(this,this.element),this.linkInterceptor=new zt(this,this.element),this.restorationIdentifier=lt(),this.formSubmitObserver=new Et(this,this.element)}connect(){this.connected||(this.connected=!0,this.loadingStyle==X.lazy?this.appearanceObserver.start():this.loadSourceURL(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==X.eager&&this.loadSourceURL()}sourceURLChanged(){this.isIgnoringChangesTo("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==X.eager||this.hasBeenLoaded)&&this.loadSourceURL())}sourceURLReloaded(){let{src:t}=this.element;return this.ignoringChangesToAttribute("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=t,this.element.loaded}completeChanged(){this.isIgnoringChangesTo("complete")||this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==X.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.visit(O(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0)}async loadResponse(t){(t.redirected||t.succeeded&&t.isHTML)&&(this.sourceURL=t.response.url);try{let e=await t.responseHTML;if(e){let i=Fi(e);R.fromDocument(i).isVisitable?await this.loadFrameResponse(t,i):await this.handleUnvisitableFrameResponse(t)}}finally{this.fetchResponseLoaded=()=>{}}}elementAppearedInViewport(t){this.proposeVisitIfNavigatedWithAction(t,t),this.loadSourceURL()}willSubmitFormLinkToLocation(t){return this.shouldInterceptNavigation(t)}submittedFormLinkToLocation(t,e,i){let s=this.findFrameElement(t);s&&i.setAttribute("data-turbo-frame",s.id)}
26shouldInterceptLinkClick(t,e,i){return this.shouldInterceptNavigation(t)}linkClickIntercepted(t,e){this.navigateFrame(t,e)}willSubmitForm(t,e){return t.closest("turbo-frame")==this.element&&this.shouldInterceptNavigation(t,e)}formSubmitted(t,e){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new et(this,t,e);let{fetchRequest:i}=this.formSubmission;this.prepareRequest(i),this.formSubmission.start()}prepareRequest(t){var e;t.headers["Turbo-Frame"]=this.id,!((e=this.currentNavigationElement)===null||e===void 0)&&e.hasAttribute("data-turbo-stream")&&t.acceptResponseType(V.contentType)}requestStarted(t){Ee(this.element)}requestPreventedHandlingResponse(t,e){this.resolveVisitPromise()}async requestSucceededWithResponse(t,e){await this.loadResponse(e),this.resolveVisitPromise()}async requestFailedWithResponse(t,e){await this.loadResponse(e),this.resolveVisitPromise()}requestErrored(t,e){console.error(e),this.resolveVisitPromise()}requestFinished(t){_e(this.element)}formSubmissionStarted({formElement:t}){Ee(t,this.findFrameElement(t))}formSubmissionSucceededWithResponse(t,e){let i=this.findFrameElement(t.formElement,t.submitter);i.delegate.proposeVisitIfNavigatedWithAction(i,t.formElement,t.submitter),i.delegate.loadResponse(e),t.isSafe||E.clearCache()}formSubmissionFailedWithResponse(t,e){this.element.delegate.loadResponse(e),E.clearCache()}formSubmissionErrored(t,e){console.error(e)}formSubmissionFinished({formElement:t}){_e(t,this.findFrameElement(t))}allowsImmediateRender({element:t},e){let i=A("turbo:before-frame-render",{target:this.element,detail:Object.assign({newFrame:t},e),cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=i;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(t,e){}preloadOnLoadLinksForView(t){E.preloadOnLoadLinksForView(t)}viewInvalidated(){}willRenderFrame(t,e){this.previousFrameElement=t.cloneNode(!0)}async loadFrameResponse(t,e){let i=await this.extractForeignFrameElement(e.body);if(i){let s=new ut(i),n=new St(this,this.view.snapshot,s,St.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,E.frameRendered(t,this.element),E.frameLoaded(this.element),this.fetchResponseLoaded(t)}else this.willHandleFrameMissingFromResponse(t)&&this.handleFrameMissingFromResponse(t)}async visit(t){var e;let i=new wt(this,k.get,t,new URLSearchParams,this.element);return(e=this.currentFetchRequest)===null||e===void 0||e.cancel(),this.currentFetchRequest=i,new Promise(s=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},this.currentFetchRequest=null,s()},i.perform()})}navigateFrame(t,e,i){let s=this.findFrameElement(t,i);s.delegate.proposeVisitIfNavigatedWithAction(s,t,i),this.withCurrentNavigationElement(t,()=>{s.src=e})}proposeVisitIfNavigatedWithAction(t,e,i){if(this.action=Yt(i,e,t),this.action){let s=R.fromElement(t).clone(),{visitCachedSnapshot:n}=t.delegate;t.delegate.fetchResponseLoaded=o=>{if(t.src){let{statusCode:a,redirected:c}=o,l=t.ownerDocument.documentElement.outerHTML,f={response:{statusCode:a,redirected:c,responseHTML:l},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(f.action=this.action),E.visit(t.src,f)}}}}changeHistory(){if(this.action){let t=Ni(this.action);E.history.update(t,O(this.element.src||""),this.restorationIdentifier)}}async handleUnvisitableFrameResponse(t){console.warn(`The response (${t.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.visitResponse(t.response)}willHandleFrameMissingFromResponse(t){this.element.setAttribute("complete","");let e=t.response,i=async(n,o={})=>{n instanceof Response?this.visitResponse(n):E.visit(n,o)};return!A("turbo:frame-missing",{target:this.element,detail:{response:e,visit:i},cancelable:!0}).defaultPrevented}handleFrameMissingFromResponse(t){this.view.missing(),this.throwFrameMissingError(t)}throwFrameMissingError(t){let e=`The response (${t.statusCode}) did not contain the expected <turbo-frame id="${this.element.i
26d}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new He(e)}async visitResponse(t){let e=new yt(t),i=await e.responseHTML,{location:s,redirected:n,statusCode:o}=e;return E.visit(s,{response:{redirected:n,statusCode:o,responseHTML:i}})}findFrameElement(t,e){var i;let s=$t("data-turbo-frame",e,t)||this.element.getAttribute("target");return(i=Ci(s))!==null&&i!==void 0?i:this.element}async extractForeignFrameElement(t){let e,i=CSS.escape(this.id);try{if(e=ki(t.querySelector(`turbo-frame#${i}`),this.sourceURL),e)return e;if(e=ki(t.querySelector(`turbo-frame[src][recurse~=${i}]`),this.sourceURL),e)return await e.loaded,await this.extractForeignFrameElement(e)}catch(s){return console.error(s),new B}return null}formActionIsVisitable(t,e){let i=Ue(t,e);return ht(O(i),this.rootLocation)}shouldInterceptNavigation(t,e){let i=$t("data-turbo-frame",e,t)||this.element.getAttribute("target");if(t instanceof HTMLFormElement&&!this.formActionIsVisitable(t,e)||!this.enabled||i=="_top")return!1;if(i){let s=Ci(i);if(s)return!s.disabled}return!(!E.elementIsNavigatable(t)||e&&!E.elementIsNavigatable(e))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(t){this.ignoringChangesToAttribute("src",()=>{this.element.src=t??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(t){this.ignoringChangesToAttribute("complete",()=>{t?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.connected}get rootLocation(){var t;let e=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),i=(t=e?.content)!==null&&t!==void 0?t:"/";return O(i)}isIgnoringChangesTo(t){return this.ignoredAttributes.has(t)}ignoringChangesToAttribute(t,e){this.ignoredAttributes.add(t),e(),this.ignoredAttributes.delete(t)}withCurrentNavigationElement(t,e){this.currentNavigationElement=t,e(),delete this.currentNavigationElement}};function Ci(r){if(r!=null){let t=document.getElementById(r);if(t instanceof B)return t}}function ki(r,t){if(r){let e=r.getAttribute("src");if(e!=null&&t!=null&&Xs(e,t))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof B)return r.connectedCallback(),r.disconnectedCallback(),r}}var Tt=class extends HTMLElement{static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){var t;return(t=this.renderPromise)!==null&&t!==void 0?t:this.renderPromise=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await Vt(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){var t;let e=this.targetElements.flatMap(s=>[...s.children]).filter(s=>!!s.id),i=[...((t=this.templateContent)===null||t===void 0?void 0:t.children)||[]].filter(s=>!!s.id).map(s=>s.id);return e.filter(s=>i.includes(s.id))}get performAction(){if(this.action){let t=Ii[this.action];if(t)return t;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===null){let t=this.ownerDocument.createElement("template");return this.appendChild(t),t}else 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(t){throw new Error(`${this.description}: ${t}`)}get description(){var t,e;return(e=((t=this.outerHTML.match(/<[^>]+>/))!==null&&t!==void 0?t:[])[0])!==null&&e!==void 0?e:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:Tt.renderElement}})}get targetElementsById(){var t;let e=(t=this.ownerDocument)===null||t===void 0?void 0:t.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){var t;let e=(t=this.ownerDocument)===null||t===void 0?void 0:t.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},$e=class extends HTMLElement{constructor(){super(...arguments),this.streamSource=null}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),Di(this.streamSource)}disconnectedCallback(){this.streamSource&&ji(this.streamSource)}get src(){return this.getAttribute("src")||""}};B.delegateConstructor=Ve;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",B);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Tt);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",$e);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(Mi` 27 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 28 29 Load your applicationâs JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 30 31 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 32 33 ââ 34 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 35 `,r.outerHTML);r=r.parentElement}})();window.Turbo=Wn;Zt();var We=class{constructor(t,e,i){this.eventTarget=t,this.eventName=e,this.eventOptions=i,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){let e=zn(t);for(let i of this.bindings){if(e.immediatePropagationStopped)break;i.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((t,e)=>{let i=t.index,s=e.index;return i<s?-1:i>s?1:0})}};function zn(r){if("immediatePropagationStopped"in r)return r;{let{stopImmediatePropagation:t}=r;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,t.call(this)}})}}var Ke=class{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEac
35h(t=>t.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(t=>t.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((t,e)=>t.concat(Array.from(e.values())),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,i={}){this.application.handleError(t,`Error ${e}`,i)}clearEventListenersForBinding(t){let e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){let{eventTarget:e,eventName:i,eventOptions:s}=t,n=this.fetchEventListenerMapForEventTarget(e),o=this.cacheKey(i,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){let{eventTarget:e,eventName:i,eventOptions:s}=t;return this.fetchEventListener(e,i,s)}fetchEventListener(t,e,i){let s=this.fetchEventListenerMapForEventTarget(t),n=this.cacheKey(e,i),o=s.get(n);return o||(o=this.createEventListener(t,e,i),s.set(n,o)),o}createEventListener(t,e,i){let s=new We(t,e,i);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){let i=[t];return Object.keys(e).sort().forEach(s=>{i.push(`${e[s]?"":"!"}${s}`)}),i.join(":")}},Jn={stop({event:r,value:t}){return t&&r.stopPropagation(),!0},prevent({event:r,value:t}){return t&&r.preventDefault(),!0},self({event:r,value:t,element:e}){return t?e===r.target:!0}},Xn=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Gn(r){let e=r.trim().match(Xn)||[],i=e[2],s=e[3];return s&&!["keydown","keyup","keypress"].includes(i)&&(i+=`.${s}`,s=""),{eventTarget:Qn(e[4]),eventName:i,eventOptions:e[7]?Yn(e[7]):{},identifier:e[5],methodName:e[6],keyFilter:e[1]||s}}function Qn(r){if(r=="window")return window;if(r=="document")return document}function Yn(r){return r.split(":").reduce((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)}),{})}function Zn(r){if(r==window)return"window";if(r==document)return"document"}function fr(r){return r.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function ze(r){return fr(r.replace(/--/g,"-").replace(/__/g,"_"))}function Ct(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Xi(r){return r.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function to(r){return r.match(/[^\s]+/g)||[]}function qi(r){return r!=null}function Je(r,t){return Object.prototype.hasOwnProperty.call(r,t)}var Hi=["meta","ctrl","alt","shift"],Xe=class{constructor(t,e,i,s){this.element=t,this.index=e,this.eventTarget=i.eventTarget||t,this.eventName=i.eventName||eo(t)||te("missing event name"),this.eventOptions=i.eventOptions||{},this.identifier=i.identifier||te("missing identifier"),this.methodName=i.methodName||te("missing method name"),this.keyFilter=i.keyFilter||"",this.schema=s}static forToken(t,e){return new this(t.element,t.index,Gn(t.content),e)}toString(){let t=this.keyFilter?`.${this.keyFilter}`:"",e=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(t){if(!this.keyFilter)return!1;let e=this.keyFilter.split("+");if(this.keyFilterDissatisfied(t,e))return!0;let i=e.filter(s=>!Hi.includes(s))[0];return i?(Je(this.keyMappings,i)||te(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[i].toLowerCase()!==t.key.toLowerCase()):!1}shouldIgnoreMouseEvent(t){if(!this.keyFilter)return!1;let e=[this.keyFilter];return!!this.keyFilterDissatisfied(t,e)}get params(){let t={},e=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:i,value:s}of Array.from(this.element.attributes)){let n=i.match(e),o=n&&n[1];o&&(t[fr(o)]=ro(s))}return t}get eventTargetName(){return Zn(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(t,e){let[i,s,n,o]=Hi.map(a=>e.includes(a));return t.metaKey!==i||t.ctrlKey!==s||t.altKey!==n||t.shiftKey!==o}},Vi={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function eo(r){let t=r.tagName.toLowerCase();if(t in Vi)return Vi[t](r)}function te(r){throw new Error(r)}function ro(r){try{return JSON.parse(r)}catch{return r}}var Ge=class{constructor(t,e){this.context=t,this.action=e}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}
35get identifier(){return this.context.identifier}handleEvent(t){let e=this.prepareActionEvent(t);this.willBeInvokedByEvent(t)&&this.applyEventModifiers(e)&&this.invokeWithEvent(e)}get eventName(){return this.action.eventName}get method(){let t=this.controller[this.methodName];if(typeof t=="function")return t;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(t){let{element:e}=this.action,{actionDescriptorFilters:i}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in i){let c=i[o];n=n&&c({name:o,value:a,event:t,element:e,controller:s})}else continue;return n}prepareActionEvent(t){return Object.assign(t,{params:this.action.params})}invokeWithEvent(t){let{target:e,currentTarget:i}=t;try{this.method.call(this.controller,t),this.context.logDebugActivity(this.methodName,{event:t,target:e,currentTarget:i,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:c}=this,l={identifier:n,controller:o,element:a,index:c,event:t};this.context.handleError(s,`invoking action "${this.action}"`,l)}}willBeInvokedByEvent(t){let e=t.target;return t instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(t)||t instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(t)?!1:this.element===e?!0:e instanceof Element&&this.element.contains(e)?this.scope.containsElement(e):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},ee=class{constructor(t,e){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=t,this.started=!1,this.delegate=e,this.elements=new Set,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(t){this.started&&(this.mutationObserver.disconnect(),this.started=!1),t(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let t=new Set(this.matchElementsInTree());for(let e of Array.from(this.elements))t.has(e)||this.removeElement(e);for(let e of Array.from(t))this.addElement(e)}}processMutations(t){if(this.started)for(let e of t)this.processMutation(e)}processMutation(t){t.type=="attributes"?this.processAttributeChange(t.target,t.attributeName):t.type=="childList"&&(this.processRemovedNodes(t.removedNodes),this.processAddedNodes(t.addedNodes))}processAttributeChange(t,e){this.elements.has(t)?this.delegate.elementAttributeChanged&&this.matchElement(t)?this.delegate.elementAttributeChanged(t,e):this.removeElement(t):this.matchElement(t)&&this.addElement(t)}processRemovedNodes(t){for(let e of Array.from(t)){let i=this.elementFromNode(e);i&&this.processTree(i,this.removeElement)}}processAddedNodes(t){for(let e of Array.from(t)){let i=this.elementFromNode(e);i&&this.elementIsActive(i)&&this.processTree(i,this.addElement)}}matchElement(t){return this.delegate.matchElement(t)}matchElementsInTree(t=this.element){return this.delegate.matchElementsInTree(t)}processTree(t,e){for(let i of this.matchElementsInTree(t))e.call(this,i)}elementFromNode(t){if(t.nodeType==Node.ELEMENT_NODE)return t}elementIsActive(t){return t.isConnected!=this.element.isConnected?!1:this.element.contains(t)}addElement(t){this.elements.has(t)||this.elementIsActive(t)&&(this.elements.add(t),this.delegate.elementMatched&&this.delegate.elementMatched(t))}removeElement(t){this.elements.has(t)&&(this.elements.delete(t),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(t))}},re=class{constructor(t,e,i){this.attributeName=e,this.delegate=i,this.elementObserver=new ee(t,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(t){return t.hasAttribute(this.attributeName)}matchElementsInTree(t){let e=this.matchElement(t)?[t]:[],i=Array.from(t.querySelectorAll(this.selector));return e.concat(i)}elementMatched(t){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(t,this.attributeName)}elementUnmatched(t){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(t,this.attributeName)}elementAttributeChanged(t,e){this.delegate.elementAttributeValueChanged&&this.attributeName==e&&this.delegate.elementAttributeValueChanged(t,e)}};function io(r,t,e){Gi(r,t).add(e)}function so(r,t,e){Gi(r,t).delete(e),no(r,t)}function Gi(r,t){let e=r.get(t);return e||(e=new Set,r.set(t,e)),e}function no(r,t){let e=r.get(t);e!=null&&e.size==0&&r.delete(t)}var $=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((e,i)=>e.concat(Array.from(i)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((e,i)=>e+i.size,0)}add(t,e){io(this.valuesByKey,t,e)}
35delete(t,e){so(this.valuesByKey,t,e)}has(t,e){let i=this.valuesByKey.get(t);return i!=null&&i.has(e)}hasKey(t){return this.valuesByKey.has(t)}hasValue(t){return Array.from(this.valuesByKey.values()).some(i=>i.has(t))}getValuesForKey(t){let e=this.valuesByKey.get(t);return e?Array.from(e):[]}getKeysForValue(t){return Array.from(this.valuesByKey).filter(([e,i])=>i.has(t)).map(([e,i])=>e)}};var Qe=class{constructor(t,e,i,s){this._selector=e,this.details=s,this.elementObserver=new ee(t,this),this.delegate=i,this.matchesByElement=new $}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(t){this._selector=t,this.refresh()}start(){this.elementObserver.start()}pause(t){this.elementObserver.pause(t)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(t){let{selector:e}=this;if(e){let i=t.matches(e);return this.delegate.selectorMatchElement?i&&this.delegate.selectorMatchElement(t,this.details):i}else return!1}matchElementsInTree(t){let{selector:e}=this;if(e){let i=this.matchElement(t)?[t]:[],s=Array.from(t.querySelectorAll(e)).filter(n=>this.matchElement(n));return i.concat(s)}else return[]}elementMatched(t){let{selector:e}=this;e&&this.selectorMatched(t,e)}elementUnmatched(t){let e=this.matchesByElement.getKeysForValue(t);for(let i of e)this.selectorUnmatched(t,i)}elementAttributeChanged(t,e){let{selector:i}=this;if(i){let s=this.matchElement(t),n=this.matchesByElement.has(i,t);s&&!n?this.selectorMatched(t,i):!s&&n&&this.selectorUnmatched(t,i)}}selectorMatched(t,e){this.delegate.selectorMatched(t,e,this.details),this.matchesByElement.add(e,t)}selectorUnmatched(t,e){this.delegate.selectorUnmatched(t,e,this.details),this.matchesByElement.delete(e,t)}},Ye=class{constructor(t,e){this.element=t,this.delegate=e,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(i=>this.processMutations(i))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let t of this.knownAttributeNames)this.refreshAttribute(t,null)}processMutations(t){if(this.started)for(let e of t)this.processMutation(e)}processMutation(t){let e=t.attributeName;e&&this.refreshAttribute(e,t.oldValue)}refreshAttribute(t,e){let i=this.delegate.getStringMapKeyForAttribute(t);if(i!=null){this.stringMap.has(t)||this.stringMapKeyAdded(i,t);let s=this.element.getAttribute(t);if(this.stringMap.get(t)!=s&&this.stringMapValueChanged(s,i,e),s==null){let n=this.stringMap.get(t);this.stringMap.delete(t),n&&this.stringMapKeyRemoved(i,t,n)}else this.stringMap.set(t,s)}}stringMapKeyAdded(t,e){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(t,e)}stringMapValueChanged(t,e,i){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(t,e,i)}stringMapKeyRemoved(t,e,i){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(t,e,i)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(t=>t.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},ie=class{constructor(t,e,i){this.attributeObserver=new re(t,e,this),this.delegate=i,this.tokensByElement=new $}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(t){this.attributeObserver.pause(t)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(t){this.tokensMatched(this.readTokensForElement(t))}elementAttributeValueChanged(t){let[e,i]=this.refreshTokensForElement(t);this.tokensUnmatched(e),this.tokensMatched(i)}elementUnmatchedAttribute(t){this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))}
35tokensMatched(t){t.forEach(e=>this.tokenMatched(e))}tokensUnmatched(t){t.forEach(e=>this.tokenUnmatched(e))}tokenMatched(t){this.delegate.tokenMatched(t),this.tokensByElement.add(t.element,t)}tokenUnmatched(t){this.delegate.tokenUnmatched(t),this.tokensByElement.delete(t.element,t)}refreshTokensForElement(t){let e=this.tokensByElement.getValuesForKey(t),i=this.readTokensForElement(t),s=ao(e,i).findIndex(([n,o])=>!co(n,o));return s==-1?[[],[]]:[e.slice(s),i.slice(s)]}readTokensForElement(t){let e=this.attributeName,i=t.getAttribute(e)||"";return oo(i,t,e)}};function oo(r,t,e){return r.trim().split(/\s+/).filter(i=>i.length).map((i,s)=>({element:t,attributeName:e,content:i,index:s}))}function ao(r,t){let e=Math.max(r.length,t.length);return Array.from({length:e},(i,s)=>[r[s],t[s]])}function co(r,t){return r&&t&&r.index==t.index&&r.content==t.content}var se=class{constructor(t,e,i){this.tokenListObserver=new ie(t,e,this),this.delegate=i,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(t){let{element:e}=t,{value:i}=this.fetchParseResultForToken(t);i&&(this.fetchValuesByTokenForElement(e).set(t,i),this.delegate.elementMatchedValue(e,i))}tokenUnmatched(t){let{element:e}=t,{value:i}=this.fetchParseResultForToken(t);i&&(this.fetchValuesByTokenForElement(e).delete(t),this.delegate.elementUnmatchedValue(e,i))}fetchParseResultForToken(t){let e=this.parseResultsByToken.get(t);return e||(e=this.parseToken(t),this.parseResultsByToken.set(t,e)),e}fetchValuesByTokenForElement(t){let e=this.valuesByTokenByElement.get(t);return e||(e=new Map,this.valuesByTokenByElement.set(t,e)),e}parseToken(t){try{return{value:this.delegate.parseValueForToken(t)}}catch(e){return{error:e}}}},Ze=class{constructor(t,e){this.context=t,this.delegate=e,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new se(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(t){let e=new Ge(this.context,t);this.bindingsByAction.set(t,e),this.delegate.bindingConnected(e)}disconnectAction(t){let e=this.bindingsByAction.get(t);e&&(this.bindingsByAction.delete(t),this.delegate.bindingDisconnected(e))}
35disconnectAllActions(){this.bindings.forEach(t=>this.delegate.bindingDisconnected(t,!0)),this.bindingsByAction.clear()}parseValueForToken(t){let e=Xe.forToken(t,this.schema);if(e.identifier==this.identifier)return e}elementMatchedValue(t,e){this.connectAction(e)}elementUnmatchedValue(t,e){this.disconnectAction(e)}},tr=class{constructor(t,e){this.context=t,this.receiver=e,this.stringMapObserver=new Ye(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(t){if(t in this.valueDescriptorMap)return this.valueDescriptorMap[t].name}stringMapKeyAdded(t,e){let i=this.valueDescriptorMap[e];this.hasValue(t)||this.invokeChangedCallback(t,i.writer(this.receiver[t]),i.writer(i.defaultValue))}stringMapValueChanged(t,e,i){let s=this.valueDescriptorNameMap[e];t!==null&&(i===null&&(i=s.writer(s.defaultValue)),this.invokeChangedCallback(e,t,i))}stringMapKeyRemoved(t,e,i){let s=this.valueDescriptorNameMap[t];this.hasValue(t)?this.invokeChangedCallback(t,s.writer(this.receiver[t]),i):this.invokeChangedCallback(t,s.writer(s.defaultValue),i)}invokeChangedCallbacksForDefaultValues(){for(let{key:t,name:e,defaultValue:i,writer:s}of this.valueDescriptors)i!=null&&!this.controller.data.has(t)&&this.invokeChangedCallback(e,s(i),void 0)}invokeChangedCallback(t,e,i){let s=`${t}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[t];try{let a=o.reader(e),c=i;i&&(c=o.reader(i)),n.call(this.receiver,a,c)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:t}=this;return Object.keys(t).map(e=>t[e])}get valueDescriptorNameMap(){let t={};return Object.keys(this.valueDescriptorMap).forEach(e=>{let i=this.valueDescriptorMap[e];t[i.name]=i}),t}hasValue(t){let e=this.valueDescriptorNameMap[t],i=`has${Ct(e.name)}`;return this.receiver[i]}},er=class{constructor(t,e){this.context=t,this.delegate=e,this.targetsByName=new $}start(){this.tokenListObserver||(this.tokenListObserver=new ie(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:t,content:e}){this.scope.containsElement(t)&&this.connectTarget(t,e)}tokenUnmatched({element:t,content:e}){this.disconnectTarget(t,e)}connectTarget(t,e){var i;this.targetsByName.has(e,t)||(this.targetsByName.add(e,t),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetConnected(t,e)))}disconnectTarget(t,e){var i;this.targetsByName.has(e,t)&&(this.targetsByName.delete(e,t),(i=this.tokenListObserver)===null||i===void 0||i.pause(()=>this.delegate.targetDisconnected(t,e)))}disconnectAllTargets(){for(let t of this.targetsByName.keys)for(let e of this.targetsByName.getValuesForKey(t))this.disconnectTarget(e,t)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function kt(r,t){let e=Qi(r);return Array.from(e.reduce((i,s)=>(lo(s,t).forEach(n=>i.add(n)),i),new Set))}function ho(r,t){return Qi(r).reduce((i,s)=>(i.push(...uo(s,t)),i),[])}function Qi(r){let t=[];for(;r;)t.push(r),r=Object.getPrototypeOf(r);return t.reverse()}function lo(r,t){let e=r[t];return Array.isArray(e)?e:[]}function uo(r,t){let e=r[t];return e?Object.keys(e).map(i=>[i,e[i]]):[]}var rr=class{constructor(t,e){this.started=!1,this.context=t,this.delegate=e,this.outletsByName=new $,this.outletElementsByName=new $,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(t=>{this.setupSelectorObserverForOutlet(t),this.setupAttributeObserverForOutlet(t)}
35),this.started=!0,this.dependentContexts.forEach(t=>t.refresh()))}refresh(){this.selectorObserverMap.forEach(t=>t.refresh()),this.attributeObserverMap.forEach(t=>t.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(t=>t.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(t=>t.stop()),this.attributeObserverMap.clear())}selectorMatched(t,e,{outletName:i}){let s=this.getOutlet(t,i);s&&this.connectOutlet(s,t,i)}selectorUnmatched(t,e,{outletName:i}){let s=this.getOutletFromMap(t,i);s&&this.disconnectOutlet(s,t,i)}selectorMatchElement(t,{outletName:e}){let i=this.selector(e),s=this.hasOutlet(t,e),n=t.matches(`[${this.schema.controllerAttribute}~=${e}]`);return i?s&&n&&t.matches(i):!1}elementMatchedAttribute(t,e){let i=this.getOutletNameFromOutletAttributeName(e);i&&this.updateSelectorObserverForOutlet(i)}elementAttributeValueChanged(t,e){let i=this.getOutletNameFromOutletAttributeName(e);i&&this.updateSelectorObserverForOutlet(i)}elementUnmatchedAttribute(t,e){let i=this.getOutletNameFromOutletAttributeName(e);i&&this.updateSelectorObserverForOutlet(i)}connectOutlet(t,e,i){var s;this.outletElementsByName.has(i,e)||(this.outletsByName.add(i,t),this.outletElementsByName.add(i,e),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(t,e,i)))}disconnectOutlet(t,e,i){var s;this.outletElementsByName.has(i,e)&&(this.outletsByName.delete(i,t),this.outletElementsByName.delete(i,e),(s=this.selectorObserverMap.get(i))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(t,e,i)))}disconnectAllOutlets(){for(let t of this.outletElementsByName.keys)for(let e of this.outletElementsByName.getValuesForKey(t))for(let i of this.outletsByName.getValuesForKey(t))this.disconnectOutlet(i,e,t)}updateSelectorObserverForOutlet(t){let e=this.selectorObserverMap.get(t);e&&(e.selector=this.selector(t))}setupSelectorObserverForOutlet(t){let e=this.selector(t),i=new Qe(document.body,e,this,{outletName:t});this.selectorObserverMap.set(t,i),i.start()}setupAttributeObserverForOutlet(t){let e=this.attributeNameForOutletName(t),i=new re(this.scope.element,e,this);this.attributeObserverMap.set(t,i),i.start()}selector(t){return this.scope.outlets.getSelectorForOutletName(t)}attributeNameForOutletName(t){return this.scope.schema.outletAttributeForScope(this.identifier,t)}getOutletNameFromOutletAttributeName(t){return this.outletDefinitions.find(e=>this.attributeNameForOutletName(e)===t)}get outletDependencies(){let t=new $;return this.router.modules.forEach(e=>{let i=e.definition.controllerConstructor;kt(i,"outlets").forEach(n=>t.add(n,e.identifier))}),t}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let t=this.dependentControllerIdentifiers;return this.router.contexts.filter(e=>t.includes(e.identifier))}hasOutlet(t,e){return!!this.getOutlet(t,e)||!!this.getOutletFromMap(t,e)}getOutlet(t,e){return this.application.getControllerForElementAndIdentifier(t,e)}getOutletFromMap(t,e){return this.outletsByName.getValuesForKey(e).find(i=>i.element===t)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},ir=class{constructor(t,e){this.logDebugActivity=(i,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,i,s)},this.module=t,this.scope=e,this.controller=new t.controllerConstructor(this),this.bindingObserver=new Ze(this,this.dispatcher),this.valueObserver=new tr(this,this.controller),this.targetObserver=new er(this,this),this.outletObserver=new rr(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(i){this.handleError(i,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(t){this.handleError(t,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(t){this.handleError(t,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}
35get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(t,e,i={}){let{identifier:s,controller:n,element:o}=this;i=Object.assign({identifier:s,controller:n,element:o},i),this.application.handleError(t,`Error ${e}`,i)}targetConnected(t,e){this.invokeControllerMethod(`${e}TargetConnected`,t)}targetDisconnected(t,e){this.invokeControllerMethod(`${e}TargetDisconnected`,t)}outletConnected(t,e,i){this.invokeControllerMethod(`${ze(i)}OutletConnected`,t,e)}outletDisconnected(t,e,i){this.invokeControllerMethod(`${ze(i)}OutletDisconnected`,t,e)}invokeControllerMethod(t,...e){let i=this.controller;typeof i[t]=="function"&&i[t](...e)}};function fo(r){return po(r,mo(r))}function po(r,t){let e=bo(r),i=go(r.prototype,t);return Object.defineProperties(e.prototype,i),e}function mo(r){return kt(r,"blessings").reduce((e,i)=>{let s=i(r);for(let n in s){let o=e[n]||{};e[n]=Object.assign(o,s[n])}return e},{})}function go(r,t){return yo(t).reduce((e,i)=>{let s=vo(r,t,i);return s&&Object.assign(e,{[i]:s}),e},{})}function vo(r,t,e){let i=Object.getOwnPropertyDescriptor(r,e);if(!(i&&"value"in i)){let n=Object.getOwnPropertyDescriptor(t,e).value;return i&&(n.get=i.get||n.get,n.set=i.set||n.set),n}}var yo=(()=>typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames)(),bo=(()=>{function r(e){function i(){return Reflect.construct(e,arguments,new.target)}return i.prototype=Object.create(e.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,e),i}function t(){let i=r(function(){this.a.call(this)});return i.prototype.a=function(){},new i}try{return t(),r}catch{return i=>class extends i{}}})();function wo(r){return{identifier:r.identifier,controllerConstructor:fo(r.controllerConstructor)}}var sr=class{constructor(t,e){this.application=t,this.definition=wo(e),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(t){let e=this.fetchContextForScope(t);this.connectedContexts.add(e),e.connect()}disconnectContextForScope(t){let e=this.contextsByScope.get(t);e&&(this.connectedContexts.delete(e),e.disconnect())}fetchContextForScope(t){let e=this.contextsByScope.get(t);return e||(e=new ir(this,t),this.contextsByScope.set(t,e)),e}},nr=class{constructor(t){this.scope=t}has(t){return this.data.has(this.getDataKey(t))}get(t){return this.getAll(t)[0]}getAll(t){let e=this.data.get(this.getDataKey(t))||"";return to(e)}getAttributeName(t){return this.data.getAttributeNameForKey(this.getDataKey(t))}getDataKey(t){return`${t}-class`}get data(){return this.scope.data}},or=class{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(t){let e=this.getAttributeNameForKey(t);return this.element.getAttribute(e)}set(t,e){let i=this.getAttributeNameForKey(t);return this.element.setAttribute(i,e),this.get(t)}has(t){let e=this.getAttributeNameForKey(t);return this.element.hasAttribute(e)}delete(t){if(this.has(t)){let e=this.getAttributeNameForKey(t);return this.element.removeAttribute(e),!0}else return!1}getAttributeNameForKey(t){return`data-${this.identifier}-${Xi(t)}`}},ar=class{constructor(t){this.warnedKeysByObject=new WeakMap,this.logger=t}warn(t,e,i){let s=this.warnedKeysByObject.get(t);s||(s=new Set,this.warnedKeysByObject.set(t,s)),s.has(e)||(s.add(e),this.logger.warn(i,t))}};function cr(r,t){return`[${r}~="${t}"]`}var hr=class{constructor(t){this.scope=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,i)=>e||this.findTarget(i)||this.findLegacyTarget(i),void 0)}findAll(...t){return t.reduce((e,i)=>[...e,...this.findAllTargets(i),...this.findAllLegacyTargets(i)],[])}findTarget(t){let e=this.getSelectorForTargetName(t);return this.scope.findElement(e)}findAllTargets(t){let e=this.getSelectorForTargetName(t);return this.scope.findAllElements(e)}getSelectorForTargetName(t){let e=this.schema.targetAttributeForScope(this.identifier);return cr(e,t)}findLegacyTarget(t){let e=this.getLegacySelectorForTargetName(t);return this.deprecate(this.scope.findElement(e),t)}findAllLegacyTargets(t){let e=this.getLegacySelectorForTargetName(t);return this.scope.findAllElements(e).map(i=>this.deprecate(i,t))}getLegacySelectorForTargetName(t){let e=`${this.identifier}.${t}`;return cr(this.schema.targetAttribute,e)}deprecate(t,e){if(t){let{identifier:i}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(i);this.guide.warn(t,`target:${e}`,`Please replace ${s}="${i}.${e}" with ${n}="${e}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return t}get guide(){return this.scope.guide}},lr=class{constructor(t,e){this.scope=t,this.controllerElement=e}
35get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(t){return this.find(t)!=null}find(...t){return t.reduce((e,i)=>e||this.findOutlet(i),void 0)}findAll(...t){return t.reduce((e,i)=>[...e,...this.findAllOutlets(i)],[])}getSelectorForOutletName(t){let e=this.schema.outletAttributeForScope(this.identifier,t);return this.controllerElement.getAttribute(e)}findOutlet(t){let e=this.getSelectorForOutletName(t);if(e)return this.findElement(e,t)}findAllOutlets(t){let e=this.getSelectorForOutletName(t);return e?this.findAllElements(e,t):[]}findElement(t,e){return this.scope.queryElements(t).filter(s=>this.matchesElement(s,t,e))[0]}findAllElements(t,e){return this.scope.queryElements(t).filter(s=>this.matchesElement(s,t,e))}matchesElement(t,e,i){let s=t.getAttribute(this.scope.schema.controllerAttribute)||"";return t.matches(e)&&s.split(" ").includes(i)}},Ot=class{constructor(t,e,i,s){this.targets=new hr(this),this.classes=new nr(this),this.data=new or(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=t,this.element=e,this.identifier=i,this.guide=new ar(s),this.outlets=new lr(this.documentScope,e)}findElement(t){return this.element.matches(t)?this.element:this.queryElements(t).find(this.containsElement)}findAllElements(t){return[...this.element.matches(t)?[this.element]:[],...this.queryElements(t).filter(this.containsElement)]}queryElements(t){return Array.from(this.element.querySelectorAll(t))}get controllerSelector(){return cr(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Ot(this.schema,document.documentElement,this.identifier,this.guide.logger)}},ur=class{constructor(t,e,i){this.element=t,this.schema=e,this.delegate=i,this.valueListObserver=new se(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(t){let{element:e,content:i}=t;return this.parseValueForElementAndIdentifier(e,i)}parseValueForElementAndIdentifier(t,e){let i=this.fetchScopesByIdentifierForElement(t),s=i.get(e);return s||(s=this.delegate.createScopeForElementAndIdentifier(t,e),i.set(e,s)),s}elementMatchedValue(t,e){let i=(this.scopeReferenceCounts.get(e)||0)+1;this.scopeReferenceCounts.set(e,i),i==1&&this.delegate.scopeConnected(e)}elementUnmatchedValue(t,e){let i=this.scopeReferenceCounts.get(e);i&&(this.scopeReferenceCounts.set(e,i-1),i==1&&this.delegate.scopeDisconnected(e))}fetchScopesByIdentifierForElement(t){let e=this.scopesByIdentifierByElement.get(t);return e||(e=new Map,this.scopesByIdentifierByElement.set(t,e)),e}},dr=class{constructor(t){this.application=t,this.scopeObserver=new ur(this.element,this.schema,this),this.scopesByIdentifier=new $,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((t,e)=>t.concat(e.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(t){this.unloadIdentifier(t.identifier);let e=new sr(this.application,t);this.connectModule(e);let i=t.controllerConstructor.afterLoad;i&&i.call(t.controllerConstructor,t.identifier,this.application)}unloadIdentifier(t){let e=this.modulesByIdentifier.get(t);e&&this.disconnectModule(e)}getContextForElementAndIdentifier(t,e){let i=this.modulesByIdentifier.get(e);if(i)return i.contexts.find(s=>s.element==t)}proposeToConnectScopeForElementAndIdentifier(t,e){let i=this.scopeObserver.parseValueForElementAndIdentifier(t,e);i?this.scopeObserver.elementMatchedValue(i.element,i):console.error(`Couldn't find or create scope for identifier: "${e}" and element:`,t)}handleError(t,e,i){this.application.handleError(t,e,i)}createScopeForElementAndIdentifier(t,e){return new Ot(this.schema,t,e,this.logger)}scopeConnected(t){this.scopesByIdentifier.add(t.identifier,t);let e=this.modulesByIdentifier.get(t.identifier);e&&e.connectContextForScope(t)}scopeDisconnected(t){this.scopesByIdentifier.delete(t.identifier,t);let e=this.modulesByIdentifier.get(t.identifier);e&&e.disconnectContextForScope(t)}
35connectModule(t){this.modulesByIdentifier.set(t.identifier,t),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(i=>t.connectContextForScope(i))}disconnectModule(t){this.modulesByIdentifier.delete(t.identifier),this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(i=>t.disconnectContextForScope(i))}},Eo={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:r=>`data-${r}-target`,outletAttributeForScope:(r,t)=>`data-${r}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},$i("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),$i("0123456789".split("").map(r=>[r,r])))};function $i(r){return r.reduce((t,[e,i])=>Object.assign(Object.assign({},t),{[e]:i}),{})}var ne=class{constructor(t=document.documentElement,e=Eo){this.logger=console,this.debug=!1,this.logDebugActivity=(i,s,n={})=>{this.debug&&this.logFormattedMessage(i,s,n)},this.element=t,this.schema=e,this.dispatcher=new Ke(this),this.router=new dr(this),this.actionDescriptorFilters=Object.assign({},Jn)}static start(t,e){let i=new this(t,e);return i.start(),i}async start(){await _o(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(t,e){this.load({identifier:t,controllerConstructor:e})}registerActionOption(t,e){this.actionDescriptorFilters[t]=e}load(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(t,...e){(Array.isArray(t)?t:[t,...e]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(t=>t.controller)}getControllerForElementAndIdentifier(t,e){let i=this.router.getContextForElementAndIdentifier(t,e);return i?i.controller:null}handleError(t,e,i){var s;this.logger.error(`%s 36 37%o 38 39%o`,e,t,i),(s=window.onerror)===null||s===void 0||s.call(window,e,"",0,0,t)}logFormattedMessage(t,e,i={}){i=Object.assign({application:this},i),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},i)),this.logger.groupEnd()}};function _o(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function So(r){return kt(r,"classes").reduce((e,i)=>Object.assign(e,Ao(i)),{})}function Ao(r){return{[`${r}Class`]:{get(){let{classes:t}=this;if(t.has(r))return t.get(r);{let e=t.getAttributeName(r);throw new Error(`Missing attribute "${e}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${Ct(r)}Class`]:{get(){return this.classes.has(r)}}}}function To(r){return kt(r,"outlets").reduce((e,i)=>Object.assign(e,Oo(i)),{})}function Ui(r,t,e){return r.application.getControllerForElementAndIdentifier(t,e)}function Wi(r,t,e){let i=Ui(r,t,e);if(i||(r.application.router.proposeToConnectScopeForElementAndIdentifier(t,e),i=Ui(r,t,e),i))return i}function Oo(r){let t=ze(r);return{[`${t}Outlet`]:{get(){let e=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(e){let s=Wi(this,e,r);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${t}Outlets`]:{get(){let e=this.outlets.findAll(r);return e.length>0?e.map(i=>{let s=Wi(this,i,r);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,i)}).filter(i=>i):[]}},[`${t}OutletElement`]:{get(){let e=this.outlets.find(r),i=this.outlets.getSelectorForOutletName(r);if(e)return e;throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${i}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${Ct(t)}Outlet`]:{get(){return this.outlets.has(r)}}}}function Lo(r){return kt(r,"targets").reduce((e,i)=>Object.assign(e,Co(i)),{})}function Co(r){return{[`${r}Target`]:{get(){let t=this.targets.find(r);if(t)return t;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${Ct(r)}Target`]:{get(){return this.targets.has(r)}}}}function ko(r){let t=ho(r,"values"),e={valueDescriptorMap:{get(){return t.reduce((i,s)=>{let n=Yi(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(i,{[o]:n})},{})}}};return t.reduce((i,s)=>Object.assign(i,Ro(s)),e)}function Ro(r,t){let e=Yi(r,t),{key:i,name:s,reader:n,writer:o}=e;return{[s]:{get(){let a=this.data.get(i);return a!==null?n(a):e.defaultValue},set(a){a===void 0?this.data.delete(i):this.data.set(i,o(a))}},[`has${Ct(s)}`]:{get(){return this.data.has(i)||e.hasCustomDefaultValue}}}}function Yi([r,t],e){return xo({controller:e,token:r,typeDefinition:t})}function oe(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Lt(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(r))return"array";if(Object.prototype.toString.call(r)==="[object Object]")return"object"}function Fo(r){let{controller:t,token:e,typeObject:i}=r,s=qi(i.type),n=qi(i.default),o=s&&n,a=s&&!n,c=!s&&n,l=oe(i.type),u=Lt(r.typeObject.default);if(a)return l;if(c)return u;if(l!==u){let f=t?`${t}.${e}`:e;throw new Error(`The specified default value for the Stimulus Value "${f}" must match the defined type "${l}". The provided default value of "${i.default}" is of type "${u}".`)}if(o)return l}function Mo(r){let{controller:t,token:e,typeDefinition:i}=r,n=Fo({controller:t,token:e,typeObject:i}),o=Lt(i),a=oe(i),c=n||o||a;if(c)return c;let l=t?`${t}.${i}`:e;throw new Error(`Unknown value type "${l}" for "${e}" value`)}function No(r){let t=oe(r);if(t)return Ki[t];let e=Je(r,"default"),i=Je(r,"type"),s=r;if(e)return s.default;if(i){let{type:n}=s,o=oe(n);if(o)return Ki[o]}return r}function xo(r){let{token:t,typeDefinition:e}
39=r,i=`${Xi(t)}-value`,s=Mo(r);return{type:s,key:i,name:fr(i),get defaultValue(){return No(e)},get hasCustomDefaultValue(){return Lt(e)!==void 0},reader:Po[s],writer:zi[s]||zi.default}}var Ki={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Po={array(r){let t=JSON.parse(r);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${r}" of type "${Lt(t)}"`);return t},boolean(r){return!(r=="0"||String(r).toLowerCase()=="false")},number(r){return Number(r.replace(/_/g,""))},object(r){let t=JSON.parse(r);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${r}" of type "${Lt(t)}"`);return t},string(r){return r}},zi={default:Bo,array:Ji,object:Ji};function Ji(r){return JSON.stringify(r)}function Bo(r){return`${r}`}var dt=class{constructor(t){this.context=t}static get shouldLoad(){return!0}static afterLoad(t,e){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:i={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${t}`:t,c=new CustomEvent(a,{detail:i,bubbles:n,cancelable:o});return e.dispatchEvent(c),c}};dt.blessings=[So,Lo,ko,To];dt.targets=[];dt.outlets=[];dt.values={};if(!window.device.bot&&window.env.JEKYLL_ENV==="production")try{window.airbrake=new be({projectId:window.env.AIRBRAKE_PROJECT_ID,projectKey:window.env.AIRBRAKE_PROJECT_KEY,host:"https://panel.sutty.nl"}),console.originalError=console.error,console.error=(...r)=>(window.airbrake.notify(r.join(" ")),console.originalError(...r))}catch(r){console.error(r)}Zt();window.Stimulus=ne.start();Stimulus.debug=window.env.JEKYLL_ENV!=="production";document.addEventListener("turbo:load",r=>{document.querySelectorAll("a[href^='http://'],a[href^='https://'],a[href^='//']").forEach(t=>{t.rel="noopener",t.target="_blank"})});})(); 40//# sourceMappingURL=pack.PZE3G6S4.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.