pocketbase/ui/dist/assets/index-Dxnq7b7H.js

158 lines
971 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = ["./FilterAutocompleteInput-BciXxpa7.js","./index-Bfjvydfy.js","./CodeEditor-dWSAtOWY.js","./ListApiDocs-3G-vtbW4.js","./SdkTabs-DtbewOeA.js","./SdkTabs-lBWmLVyw.css","./FieldsQueryParam-CVsneoOn.js","./ListApiDocs-DhdAtA7Y.css","./ViewApiDocs-DhKxMG-g.js","./CreateApiDocs-CgLTNHGL.js","./UpdateApiDocs-j5w0Dj65.js","./DeleteApiDocs-CiCJ2h6k.js","./RealtimeApiDocs-qRWOaWAy.js","./AuthWithPasswordDocs-KjuyjMk2.js","./AuthWithOAuth2Docs-9gZ9hwvH.js","./AuthRefreshDocs-DumPRy8C.js","./RequestVerificationDocs-DCqmh1ko.js","./ConfirmVerificationDocs-C7BVcs19.js","./RequestPasswordResetDocs-D-22DAmZ.js","./ConfirmPasswordResetDocs-BGsBiiVR.js","./RequestEmailChangeDocs-B2LJ-kfg.js","./ConfirmEmailChangeDocs-DKZCgH6q.js","./AuthMethodsDocs-kjjrBjEu.js","./ListExternalAuthsDocs-Vkl7ubaf.js","./UnlinkExternalAuthDocs-ApBY4X0Z.js"]
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
var u0=Object.defineProperty;var c0=(n,e,t)=>e in n?u0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Ge=(n,e,t)=>(c0(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(l){if(l.ep)return;l.ep=!0;const s=t(l);fetch(l.href,s)}})();function x(){}const bs=n=>n;function Ae(n,e){for(const t in e)n[t]=e[t];return n}function d0(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function Cg(n){return n()}function Ga(){return Object.create(null)}function Te(n){n.forEach(Cg)}function Ot(n){return typeof n=="function"}function he(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Es;function tn(n,e){return n===e?!0:(Es||(Es=document.createElement("a")),Es.href=e,n===Es.href)}function p0(n){return Object.keys(n).length===0}function ra(n,...e){if(n==null){for(const i of e)i(void 0);return x}const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Og(n){let e;return ra(n,t=>e=t)(),e}function We(n,e,t){n.$$.on_destroy.push(ra(e,t))}function St(n,e,t,i){if(n){const l=Mg(n,e,t,i);return n[0](l)}}function Mg(n,e,t,i){return n[1]&&i?Ae(t.ctx.slice(),n[1](i(e))):t.ctx}function $t(n,e,t,i){if(n[2]&&i){const l=n[2](i(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const s=[],o=Math.max(e.dirty.length,l.length);for(let r=0;r<o;r+=1)s[r]=e.dirty[r]|l[r];return s}return e.dirty|l}return e.dirty}function Tt(n,e,t,i,l,s){if(l){const o=Mg(e,t,i,s);n.p(o,l)}}function Ct(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let i=0;i<t;i++)e[i]=-1;return e}return-1}function Kt(n){const e={};for(const t in n)t[0]!=="$"&&(e[t]=n[t]);return e}function Xe(n,e){const t={};e=new Set(e);for(const i in n)!e.has(i)&&i[0]!=="$"&&(t[i]=n[i]);return t}function Yn(n){return n??""}function en(n,e,t){return n.set(t),e}function $e(n){return n&&Ot(n.destroy)?n.destroy:x}function Xa(n){const e=typeof n=="string"&&n.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[n,"px"]}const Dg=typeof window<"u";let Ro=Dg?()=>window.performance.now():()=>Date.now(),aa=Dg?n=>requestAnimationFrame(n):x;const kl=new Set;function Eg(n){kl.forEach(e=>{e.c(n)||(kl.delete(e),e.f())}),kl.size!==0&&aa(Eg)}function qo(n){let e;return kl.size===0&&aa(Eg),{promise:new Promise(t=>{kl.add(e={c:n,f:t})}),abort(){kl.delete(e)}}}function y(n,e){n.appendChild(e)}function Ig(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function m0(n){const e=b("style");return e.textContent="/* empty */",h0(Ig(n),e),e.sheet}function h0(n,e){return y(n.head||n,e),e.sheet}function S(n,e,t){n.insertBefore(e,t||null)}function w(n){n.parentNode&&n.parentNode.removeChild(n)}function rt(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function b(n){return document.createElement(n)}function J(n){return document.createTextNode(n)}function D(){return J(" ")}function ve(){return J("")}function Z(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function Ue(n){return function(e){return e.preventDefault(),n.call(this,e)}}function Cn(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}const _0=["width","height"];function ii(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value=n[i]=e[i]:t[i]&&t[i].set&&_0.indexOf(i)===-1?n[i]=e[i]:p(n,i,e[i])}function g0(n){let e;return{p(...t){e=t,e.forEach(i=>n.push(i))},r(){e.forEach(t=>n.splice(n.indexOf(t),1))}}}function lt(n){return n===""?null:+n}function b0(n){return Array.from(n.childNodes)}function re(n,e){e=""+e,n.data!==e&&(n.data=e)}function ae(n,e){n.value=e??""}function k0(n,e,t,i){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ee(n,e,t){n.classList.toggle(e,!!t)}function Ag(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function Et(n,e){return new n(e)}const ko=new Map;let yo=0;function y0(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function v0(n,e){const t={stylesheet:m0(e),rules:{}};return ko.set(n,t),t}function ls(n,e,t,i,l,s,o,r=0){const a=16.666/i;let f=`{
`;for(let g=0;g<=1;g+=a){const v=e+(t-e)*s(g);f+=g*100+`%{${o(v,1-v)}}
`}const u=f+`100% {${o(t,1-t)}}
}`,c=`__svelte_${y0(u)}_${r}`,d=Ig(n),{stylesheet:m,rules:h}=ko.get(d)||v0(d,n);h[c]||(h[c]=!0,m.insertRule(`@keyframes ${c} ${u}`,m.cssRules.length));const _=n.style.animation||"";return n.style.animation=`${_?`${_}, `:""}${c} ${i}ms linear ${l}ms 1 both`,yo+=1,c}function ss(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),l=t.length-i.length;l&&(n.style.animation=i.join(", "),yo-=l,yo||w0())}function w0(){aa(()=>{yo||(ko.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&w(e)}),ko.clear())})}function S0(n,e,t,i){if(!e)return x;const l=n.getBoundingClientRect();if(e.left===l.left&&e.right===l.right&&e.top===l.top&&e.bottom===l.bottom)return x;const{delay:s=0,duration:o=300,easing:r=bs,start:a=Ro()+s,end:f=a+o,tick:u=x,css:c}=t(n,{from:e,to:l},i);let d=!0,m=!1,h;function _(){c&&(h=ls(n,0,1,o,s,r,c)),s||(m=!0)}function g(){c&&ss(n,h),d=!1}return qo(v=>{if(!m&&v>=a&&(m=!0),m&&v>=f&&(u(1,0),g()),!d)return!1;if(m){const $=v-a,C=0+1*r($/o);u(C,1-C)}return!0}),_(),u(0,1),g}function $0(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,l=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,Lg(n,l)}}function Lg(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),l=i.transform==="none"?"":i.transform;n.style.transform=`${l} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let os;function pi(n){os=n}function ks(){if(!os)throw new Error("Function called outside component initialization");return os}function zt(n){ks().$$.on_mount.push(n)}function T0(n){ks().$$.after_update.push(n)}function ys(n){ks().$$.on_destroy.push(n)}function st(){const n=ks();return(e,t,{cancelable:i=!1}={})=>{const l=n.$$.callbacks[e];if(l){const s=Ag(e,t,{cancelable:i});return l.slice().forEach(o=>{o.call(n,s)}),!s.defaultPrevented}return!0}}function Oe(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const gl=[],te=[];let yl=[];const Rr=[],Ng=Promise.resolve();let qr=!1;function Pg(){qr||(qr=!0,Ng.then(fa))}function xt(){return Pg(),Ng}function Je(n){yl.push(n)}function ye(n){Rr.push(n)}const nr=new Set;let dl=0;function fa(){if(dl!==0)return;const n=os;do{try{for(;dl<gl.length;){const e=gl[dl];dl++,pi(e),C0(e.$$)}}catch(e){throw gl.length=0,dl=0,e}for(pi(null),gl.length=0,dl=0;te.length;)te.pop()();for(let e=0;e<yl.length;e+=1){const t=yl[e];nr.has(t)||(nr.add(t),t())}yl.length=0}while(gl.length);for(;Rr.length;)Rr.pop()();qr=!1,nr.clear(),pi(n)}function C0(n){if(n.fragment!==null){n.update(),Te(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Je)}}function O0(n){const e=[],t=[];yl.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),yl=e}let ql;function ua(){return ql||(ql=Promise.resolve(),ql.then(()=>{ql=null})),ql}function Ji(n,e,t){n.dispatchEvent(Ag(`${e?"intro":"outro"}${t}`))}const lo=new Set;let ti;function se(){ti={r:0,c:[],p:ti}}function oe(){ti.r||Te(ti.c),ti=ti.p}function I(n,e){n&&n.i&&(lo.delete(n),n.i(e))}function L(n,e,t,i){if(n&&n.o){if(lo.has(n))return;lo.add(n),ti.c.push(()=>{lo.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const ca={duration:0};function Fg(n,e,t){const i={direction:"in"};let l=e(n,t,i),s=!1,o,r,a=0;function f(){o&&ss(n,o)}function u(){const{delay:d=0,duration:m=300,easing:h=bs,tick:_=x,css:g}=l||ca;g&&(o=ls(n,0,1,m,d,h,g,a++)),_(0,1);const v=Ro()+d,$=v+m;r&&r.abort(),s=!0,Je(()=>Ji(n,!0,"start")),r=qo(C=>{if(s){if(C>=$)return _(1,0),Ji(n,!0,"end"),f(),s=!1;if(C>=v){const T=h((C-v)/m);_(T,1-T)}}return s})}let c=!1;return{start(){c||(c=!0,ss(n),Ot(l)?(l=l(i),ua().then(u)):u())},invalidate(){c=!1},end(){s&&(f(),s=!1)}}}function da(n,e,t){const i={direction:"out"};let l=e(n,t,i),s=!0,o;const r=ti;r.r+=1;let a;function f(){const{delay:u=0,duration:c=300,easing:d=bs,tick:m=x,css:h}=l||ca;h&&(o=ls(n,1,0,c,u,d,h));const _=Ro()+u,g=_+c;Je(()=>Ji(n,!1,"start")),"inert"in n&&(a=n.inert,n.inert=!0),qo(v=>{if(s){if(v>=g)return m(0,1),Ji(n,!1,"end"),--r.r||Te(r.c),!1;if(v>=_){const $=d((v-_)/c);m(1-$,$)}}return s})}return Ot(l)?ua().then(()=>{l=l(i),f()}):f(),{end(u){u&&"inert"in n&&(n.inert=a),u&&l.tick&&l.tick(1,0),s&&(o&&ss(n,o),s=!1)}}}function Re(n,e,t,i){let s=e(n,t,{direction:"both"}),o=i?0:1,r=null,a=null,f=null,u;function c(){f&&ss(n,f)}function d(h,_){const g=h.b-o;return _*=Math.abs(g),{a:o,b:h.b,d:g,duration:_,start:h.start,end:h.start+_,group:h.group}}function m(h){const{delay:_=0,duration:g=300,easing:v=bs,tick:$=x,css:C}=s||ca,T={start:Ro()+_,b:h};h||(T.group=ti,ti.r+=1),"inert"in n&&(h?u!==void 0&&(n.inert=u):(u=n.inert,n.inert=!0)),r||a?a=T:(C&&(c(),f=ls(n,o,h,g,_,v,C)),h&&$(0,1),r=d(T,g),Je(()=>Ji(n,h,"start")),qo(O=>{if(a&&O>a.start&&(r=d(a,g),a=null,Ji(n,r.b,"start"),C&&(c(),f=ls(n,o,r.b,r.duration,0,v,s.css))),r){if(O>=r.end)$(o=r.b,1-o),Ji(n,r.b,"end"),a||(r.b?c():--r.group.r||Te(r.group.c)),r=null;else if(O>=r.start){const M=O-r.start;o=r.a+r.d*v(M/r.duration),$(o,1-o)}}return!!(r||a)}))}return{run(h){Ot(s)?ua().then(()=>{s=s({direction:h?"in":"out"}),m(h)}):m(h)},end(){c(),r=a=null}}}function Qa(n,e){const t=e.token={};function i(l,s,o,r){if(e.token!==t)return;e.resolved=r;let a=e.ctx;o!==void 0&&(a=a.slice(),a[o]=r);const f=l&&(e.current=l)(a);let u=!1;e.block&&(e.blocks?e.blocks.forEach((c,d)=>{d!==s&&c&&(se(),L(c,1,1,()=>{e.blocks[d]===c&&(e.blocks[d]=null)}),oe())}):e.block.d(1),f.c(),I(f,1),f.m(e.mount(),e.anchor),u=!0),e.block=f,e.blocks&&(e.blocks[s]=f),u&&fa()}if(d0(n)){const l=ks();if(n.then(s=>{pi(l),i(e.then,1,e.value,s),pi(null)},s=>{if(pi(l),i(e.catch,2,e.error,s),pi(null),!e.hasCatch)throw s}),e.current!==e.pending)return i(e.pending,0),!0}else{if(e.current!==e.then)return i(e.then,1,e.value,n),!0;e.resolved=n}}function M0(n,e,t){const i=e.slice(),{resolved:l}=n;n.current===n.then&&(i[n.value]=l),n.current===n.catch&&(i[n.error]=l),n.block.p(i,t)}function ce(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Ai(n,e){n.d(1),e.delete(n.key)}function It(n,e){L(n,1,1,()=>{e.delete(n.key)})}function D0(n,e){n.f(),It(n,e)}function ft(n,e,t,i,l,s,o,r,a,f,u,c){let d=n.length,m=s.length,h=d;const _={};for(;h--;)_[n[h].key]=h;const g=[],v=new Map,$=new Map,C=[];for(h=m;h--;){const E=c(l,s,h),A=t(E);let N=o.get(A);N?i&&C.push(()=>N.p(E,e)):(N=f(A,E),N.c()),v.set(A,g[h]=N),A in _&&$.set(A,Math.abs(h-_[A]))}const T=new Set,O=new Set;function M(E){I(E,1),E.m(r,u),o.set(E.key,E),u=E.first,m--}for(;d&&m;){const E=g[m-1],A=n[d-1],N=E.key,q=A.key;E===A?(u=E.first,d--,m--):v.has(q)?!o.has(N)||T.has(N)?M(E):O.has(q)?d--:$.get(N)>$.get(q)?(O.add(N),M(E)):(T.add(q),d--):(a(A,o),d--)}for(;d--;){const E=n[d];v.has(E.key)||a(E,o)}for(;m;)M(g[m-1]);return Te(C),g}function mt(n,e){const t={},i={},l={$$scope:1};let s=n.length;for(;s--;){const o=n[s],r=e[s];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)l[a]||(t[a]=r[a],l[a]=1);n[s]=r}else for(const a in o)l[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function Mt(n){return typeof n=="object"&&n!==null?n:{}}function ke(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function B(n){n&&n.c()}function z(n,e,t){const{fragment:i,after_update:l}=n.$$;i&&i.m(e,t),Je(()=>{const s=n.$$.on_mount.map(Cg).filter(Ot);n.$$.on_destroy?n.$$.on_destroy.push(...s):Te(s),n.$$.on_mount=[]}),l.forEach(Je)}function V(n,e){const t=n.$$;t.fragment!==null&&(O0(t.after_update),Te(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function E0(n,e){n.$$.dirty[0]===-1&&(gl.push(n),Pg(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function ge(n,e,t,i,l,s,o=null,r=[-1]){const a=os;pi(n);const f=n.$$={fragment:null,ctx:[],props:s,update:x,not_equal:l,bound:Ga(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:Ga(),dirty:r,skip_bound:!1,root:e.target||a.$$.root};o&&o(f.root);let u=!1;if(f.ctx=t?t(n,e.props||{},(c,d,...m)=>{const h=m.length?m[0]:d;return f.ctx&&l(f.ctx[c],f.ctx[c]=h)&&(!f.skip_bound&&f.bound[c]&&f.bound[c](h),u&&E0(n,c)),d}):[],f.update(),u=!0,Te(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const c=b0(e.target);f.fragment&&f.fragment.l(c),c.forEach(w)}else f.fragment&&f.fragment.c();e.intro&&I(n.$$.fragment),z(n,e.target,e.anchor),fa()}pi(a)}class be{constructor(){Ge(this,"$$");Ge(this,"$$set")}$destroy(){V(this,1),this.$destroy=x}$on(e,t){if(!Ot(t))return x;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const l=i.indexOf(t);l!==-1&&i.splice(l,1)}}$set(e){this.$$set&&!p0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const I0="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(I0);const pl=[];function Rg(n,e){return{subscribe:On(n,e).subscribe}}function On(n,e=x){let t;const i=new Set;function l(r){if(he(n,r)&&(n=r,t)){const a=!pl.length;for(const f of i)f[1](),pl.push(f,n);if(a){for(let f=0;f<pl.length;f+=2)pl[f][0](pl[f+1]);pl.length=0}}}function s(r){l(r(n))}function o(r,a=x){const f=[r,a];return i.add(f),i.size===1&&(t=e(l,s)||x),r(n),()=>{i.delete(f),i.size===0&&t&&(t(),t=null)}}return{set:l,update:s,subscribe:o}}function qg(n,e,t){const i=!Array.isArray(n),l=i?[n]:n;if(!l.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Rg(t,(o,r)=>{let a=!1;const f=[];let u=0,c=x;const d=()=>{if(u)return;c();const h=e(i?f[0]:f,o,r);s?o(h):c=Ot(h)?h:x},m=l.map((h,_)=>ra(h,g=>{f[_]=g,u&=~(1<<_),a&&d()},()=>{u|=1<<_}));return a=!0,d(),function(){Te(m),c(),a=!1}})}function jg(n,e){if(n instanceof RegExp)return{keys:!1,pattern:n};var t,i,l,s,o=[],r="",a=n.split("/");for(a[0]||a.shift();l=a.shift();)t=l[0],t==="*"?(o.push("wild"),r+="/(.*)"):t===":"?(i=l.indexOf("?",1),s=l.indexOf(".",1),o.push(l.substring(1,~i?i:~s?s:l.length)),r+=~i&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(r+=(~i?"?":"")+"\\"+l.substring(s))):r+="/"+l;return{keys:o,pattern:new RegExp("^"+r+(e?"(?=$|/)":"/?$"),"i")}}function A0(n){let e,t,i;const l=[n[2]];var s=n[0];function o(r,a){let f={};for(let u=0;u<l.length;u+=1)f=Ae(f,l[u]);return a!==void 0&&a&4&&(f=Ae(f,mt(l,[Mt(r[2])]))),{props:f}}return s&&(e=Et(s,o(n)),e.$on("routeEvent",n[7])),{c(){e&&B(e.$$.fragment),t=ve()},m(r,a){e&&z(e,r,a),S(r,t,a),i=!0},p(r,a){if(a&1&&s!==(s=r[0])){if(e){se();const f=e;L(f.$$.fragment,1,0,()=>{V(f,1)}),oe()}s?(e=Et(s,o(r,a)),e.$on("routeEvent",r[7]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a&4?mt(l,[Mt(r[2])]):{};e.$set(f)}},i(r){i||(e&&I(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&w(t),e&&V(e,r)}}}function L0(n){let e,t,i;const l=[{params:n[1]},n[2]];var s=n[0];function o(r,a){let f={};for(let u=0;u<l.length;u+=1)f=Ae(f,l[u]);return a!==void 0&&a&6&&(f=Ae(f,mt(l,[a&2&&{params:r[1]},a&4&&Mt(r[2])]))),{props:f}}return s&&(e=Et(s,o(n)),e.$on("routeEvent",n[6])),{c(){e&&B(e.$$.fragment),t=ve()},m(r,a){e&&z(e,r,a),S(r,t,a),i=!0},p(r,a){if(a&1&&s!==(s=r[0])){if(e){se();const f=e;L(f.$$.fragment,1,0,()=>{V(f,1)}),oe()}s?(e=Et(s,o(r,a)),e.$on("routeEvent",r[6]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a&6?mt(l,[a&2&&{params:r[1]},a&4&&Mt(r[2])]):{};e.$set(f)}},i(r){i||(e&&I(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&w(t),e&&V(e,r)}}}function N0(n){let e,t,i,l;const s=[L0,A0],o=[];function r(a,f){return a[1]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,[f]){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}function xa(){const n=window.location.href.indexOf("#/");let e=n>-1?window.location.href.substr(n+1):"/";const t=e.indexOf("?");let i="";return t>-1&&(i=e.substr(t+1),e=e.substr(0,t)),{location:e,querystring:i}}const jo=Rg(null,function(e){e(xa());const t=()=>{e(xa())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});qg(jo,n=>n.location);const Ho=qg(jo,n=>n.querystring),ef=On(void 0);async function nl(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await xt();const e=(n.charAt(0)=="#"?"":"#")+n;try{const t={...history.state};delete t.__svelte_spa_router_scrollX,delete t.__svelte_spa_router_scrollY,window.history.replaceState(t,void 0,e)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function ln(n,e){if(e=nf(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with <a> tags');return tf(n,e),{update(t){t=nf(t),tf(n,t)}}}function P0(n){n?window.scrollTo(n.__svelte_spa_router_scrollX,n.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function tf(n,e){let t=e.href||n.getAttribute("href");if(t&&t.charAt(0)=="/")t="#"+t;else if(!t||t.length<2||t.slice(0,2)!="#/")throw Error('Invalid value for "href" attribute: '+t);n.setAttribute("href",t),n.addEventListener("click",i=>{i.preventDefault(),e.disabled||F0(i.currentTarget.getAttribute("href"))})}function nf(n){return n&&typeof n=="string"?{href:n}:n||{}}function F0(n){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=n}function R0(n,e,t){let{routes:i={}}=e,{prefix:l=""}=e,{restoreScrollState:s=!1}=e;class o{constructor(O,M){if(!M||typeof M!="function"&&(typeof M!="object"||M._sveltesparouter!==!0))throw Error("Invalid component object");if(!O||typeof O=="string"&&(O.length<1||O.charAt(0)!="/"&&O.charAt(0)!="*")||typeof O=="object"&&!(O instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:E,keys:A}=jg(O);this.path=O,typeof M=="object"&&M._sveltesparouter===!0?(this.component=M.component,this.conditions=M.conditions||[],this.userData=M.userData,this.props=M.props||{}):(this.component=()=>Promise.resolve(M),this.conditions=[],this.props={}),this._pattern=E,this._keys=A}match(O){if(l){if(typeof l=="string")if(O.startsWith(l))O=O.substr(l.length)||"/";else return null;else if(l instanceof RegExp){const N=O.match(l);if(N&&N[0])O=O.substr(N[0].length)||"/";else return null}}const M=this._pattern.exec(O);if(M===null)return null;if(this._keys===!1)return M;const E={};let A=0;for(;A<this._keys.length;){try{E[this._keys[A]]=decodeURIComponent(M[A+1]||"")||null}catch{E[this._keys[A]]=null}A++}return E}async checkConditions(O){for(let M=0;M<this.conditions.length;M++)if(!await this.conditions[M](O))return!1;return!0}}const r=[];i instanceof Map?i.forEach((T,O)=>{r.push(new o(O,T))}):Object.keys(i).forEach(T=>{r.push(new o(T,i[T]))});let a=null,f=null,u={};const c=st();async function d(T,O){await xt(),c(T,O)}let m=null,h=null;s&&(h=T=>{T.state&&(T.state.__svelte_spa_router_scrollY||T.state.__svelte_spa_router_scrollX)?m=T.state:m=null},window.addEventListener("popstate",h),T0(()=>{P0(m)}));let _=null,g=null;const v=jo.subscribe(async T=>{_=T;let O=0;for(;O<r.length;){const M=r[O].match(T.location);if(!M){O++;continue}const E={route:r[O].path,location:T.location,querystring:T.querystring,userData:r[O].userData,params:M&&typeof M=="object"&&Object.keys(M).length?M:null};if(!await r[O].checkConditions(E)){t(0,a=null),g=null,d("conditionsFailed",E);return}d("routeLoading",Object.assign({},E));const A=r[O].component;if(g!=A){A.loading?(t(0,a=A.loading),g=A,t(1,f=A.loadingParams),t(2,u={}),d("routeLoaded",Object.assign({},E,{component:a,name:a.name,params:f}))):(t(0,a=null),g=null);const N=await A();if(T!=_)return;t(0,a=N&&N.default||N),g=A}M&&typeof M=="object"&&Object.keys(M).length?t(1,f=M):t(1,f=null),t(2,u=r[O].props),d("routeLoaded",Object.assign({},E,{component:a,name:a.name,params:f})).then(()=>{ef.set(f)});return}t(0,a=null),g=null,ef.set(void 0)});ys(()=>{v(),h&&window.removeEventListener("popstate",h)});function $(T){Oe.call(this,n,T)}function C(T){Oe.call(this,n,T)}return n.$$set=T=>{"routes"in T&&t(3,i=T.routes),"prefix"in T&&t(4,l=T.prefix),"restoreScrollState"in T&&t(5,s=T.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=s?"manual":"auto")},[a,f,u,i,l,s,$,C]}class q0 extends be{constructor(e){super(),ge(this,e,R0,N0,he,{routes:3,prefix:4,restoreScrollState:5})}}const so=[];let Hg;function zg(n){const e=n.pattern.test(Hg);lf(n,n.className,e),lf(n,n.inactiveClassName,!e)}function lf(n,e,t){(e||"").split(" ").forEach(i=>{i&&(n.node.classList.remove(i),t&&n.node.classList.add(i))})}jo.subscribe(n=>{Hg=n.location+(n.querystring?"?"+n.querystring:""),so.map(zg)});function Nn(n,e){if(e&&(typeof e=="string"||typeof e=="object"&&e instanceof RegExp)?e={path:e}:e=e||{},!e.path&&n.hasAttribute("href")&&(e.path=n.getAttribute("href"),e.path&&e.path.length>1&&e.path.charAt(0)=="#"&&(e.path=e.path.substring(1))),e.className||(e.className="active"),!e.path||typeof e.path=="string"&&(e.path.length<1||e.path.charAt(0)!="/"&&e.path.charAt(0)!="*"))throw Error('Invalid value for "path" argument');const{pattern:t}=typeof e.path=="string"?jg(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return so.push(i),zg(i),{destroy(){so.splice(so.indexOf(i),1)}}}const j0="modulepreload",H0=function(n,e){return new URL(n,e).href},sf={},nt=function(e,t,i){let l=Promise.resolve();if(t&&t.length>0){const s=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),r=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));l=Promise.all(t.map(a=>{if(a=H0(a,i),a in sf)return;sf[a]=!0;const f=a.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(!!i)for(let m=s.length-1;m>=0;m--){const h=s[m];if(h.href===a&&(!f||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${u}`))return;const d=document.createElement("link");if(d.rel=f?"stylesheet":j0,f||(d.as="script",d.crossOrigin=""),d.href=a,r&&d.setAttribute("nonce",r),document.head.appendChild(d),f)return new Promise((m,h)=>{d.addEventListener("load",m),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}return l.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function Lt(n){if(!n)throw Error("Parameter args is required");if(!n.component==!n.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(n.component&&(n.asyncComponent=()=>Promise.resolve(n.component)),typeof n.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(n.conditions){Array.isArray(n.conditions)||(n.conditions=[n.conditions]);for(let t=0;t<n.conditions.length;t++)if(!n.conditions[t]||typeof n.conditions[t]!="function")throw Error("Invalid parameter conditions["+t+"]")}return n.loadingComponent&&(n.asyncComponent.loading=n.loadingComponent,n.asyncComponent.loadingParams=n.loadingParams||void 0),{component:n.asyncComponent,userData:n.userData,conditions:n.conditions&&n.conditions.length?n.conditions:void 0,props:n.props&&Object.keys(n.props).length?n.props:{},_sveltesparouter:!0}}class bn extends Error{constructor(e){var t,i,l,s;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,bn.prototype),e!==null&&typeof e=="object"&&(this.url=typeof e.url=="string"?e.url:"",this.status=typeof e.status=="number"?e.status:0,this.isAbort=!!e.isAbort,this.originalError=e.originalError,e.response!==null&&typeof e.response=="object"?this.response=e.response:e.data!==null&&typeof e.data=="object"?this.response=e.data:this.response={}),this.originalError||e instanceof bn||(this.originalError=e),typeof DOMException<"u"&&e instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(t=this.response)==null?void 0:t.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(s=(l=(i=this.originalError)==null?void 0:i.cause)==null?void 0:l.message)!=null&&s.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const Is=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function z0(n,e){const t={};if(typeof n!="string")return t;const i=Object.assign({},e||{}).decode||V0;let l=0;for(;l<n.length;){const s=n.indexOf("=",l);if(s===-1)break;let o=n.indexOf(";",l);if(o===-1)o=n.length;else if(o<s){l=n.lastIndexOf(";",s-1)+1;continue}const r=n.slice(l,s).trim();if(t[r]===void 0){let a=n.slice(s+1,o).trim();a.charCodeAt(0)===34&&(a=a.slice(1,-1));try{t[r]=i(a)}catch{t[r]=a}}l=o+1}return t}function of(n,e,t){const i=Object.assign({},t||{}),l=i.encode||B0;if(!Is.test(n))throw new TypeError("argument name is invalid");const s=l(e);if(s&&!Is.test(s))throw new TypeError("argument val is invalid");let o=n+"="+s;if(i.maxAge!=null){const r=i.maxAge-0;if(isNaN(r)||!isFinite(r))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(r)}if(i.domain){if(!Is.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain="+i.domain}if(i.path){if(!Is.test(i.path))throw new TypeError("option path is invalid");o+="; Path="+i.path}if(i.expires){if(!function(a){return Object.prototype.toString.call(a)==="[object Date]"||a instanceof Date}(i.expires)||isNaN(i.expires.valueOf()))throw new TypeError("option expires is invalid");o+="; Expires="+i.expires.toUTCString()}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.priority)switch(typeof i.priority=="string"?i.priority.toLowerCase():i.priority){case"low":o+="; Priority=Low";break;case"medium":o+="; Priority=Medium";break;case"high":o+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}if(i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o}function V0(n){return n.indexOf("%")!==-1?decodeURIComponent(n):n}function B0(n){return encodeURIComponent(n)}let Vg;function oo(n){if(n)try{const e=decodeURIComponent(Vg(n.split(".")[1]).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(e)||{}}catch{}return{}}function pa(n,e=0){let t=oo(n);return!(Object.keys(t).length>0&&(!t.exp||t.exp-e>Date.now()/1e3))}Vg=typeof atob=="function"?atob:n=>{let e=String(n).replace(/=+$/,"");if(e.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,i,l=0,s=0,o="";i=e.charAt(s++);~i&&(t=l%4?64*t+i:i,l++%4)?o+=String.fromCharCode(255&t>>(-2*l&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};const rf="pb_auth";class U0{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!pa(this.token)}get isAdmin(){return oo(this.token).type==="admin"}get isAuthRecord(){return oo(this.token).type==="authRecord"}save(e,t){this.baseToken=e||"",this.baseModel=t||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(e,t=rf){const i=z0(e||"")[t]||"";let l={};try{l=JSON.parse(i),(typeof l===null||typeof l!="object"||Array.isArray(l))&&(l={})}catch{}this.save(l.token||"",l.model||null)}exportToCookie(e,t=rf){var a,f;const i={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},l=oo(this.token);i.expires=l!=null&&l.exp?new Date(1e3*l.exp):new Date("1970-01-01"),e=Object.assign({},i,e);const s={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let o=of(t,JSON.stringify(s),e);const r=typeof Blob<"u"?new Blob([o]).size:o.length;if(s.model&&r>4096){s.model={id:(a=s==null?void 0:s.model)==null?void 0:a.id,email:(f=s==null?void 0:s.model)==null?void 0:f.email};const u=["collectionId","username","verified"];for(const c in this.model)u.includes(c)&&(s.model[c]=this.model[c]);o=of(t,JSON.stringify(s),e)}return o}onChange(e,t=!1){return this._onChangeCallbacks.push(e),t&&e(this.token,this.model),()=>{for(let i=this._onChangeCallbacks.length-1;i>=0;i--)if(this._onChangeCallbacks[i]==e)return delete this._onChangeCallbacks[i],void this._onChangeCallbacks.splice(i,1)}}triggerChange(){for(const e of this._onChangeCallbacks)e&&e(this.token,this.model)}}class Bg extends U0{constructor(e="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=e,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(e,t){this._storageSet(this.storageKey,{token:e,model:t}),super.save(e,t)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(e){if(typeof window<"u"&&(window!=null&&window.localStorage)){const t=window.localStorage.getItem(e)||"";try{return JSON.parse(t)}catch{return t}}return this.storageFallback[e]}_storageSet(e,t){if(typeof window<"u"&&(window!=null&&window.localStorage)){let i=t;typeof t!="string"&&(i=JSON.stringify(t)),window.localStorage.setItem(e,i)}else this.storageFallback[e]=t}_storageRemove(e){var t;typeof window<"u"&&(window!=null&&window.localStorage)&&((t=window.localStorage)==null||t.removeItem(e)),delete this.storageFallback[e]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",e=>{if(e.key!=this.storageKey)return;const t=this._storageGet(this.storageKey)||{};super.save(t.token||"",t.model||null)})}}class il{constructor(e){this.client=e}}class W0 extends il{async getAll(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/settings",e)}async update(e,t){return t=Object.assign({method:"PATCH",body:e},t),this.client.send("/api/settings",t)}async testS3(e="storage",t){return t=Object.assign({method:"POST",body:{filesystem:e}},t),this.client.send("/api/settings/test/s3",t).then(()=>!0)}async testEmail(e,t,i){return i=Object.assign({method:"POST",body:{email:e,template:t}},i),this.client.send("/api/settings/test/email",i).then(()=>!0)}async generateAppleClientSecret(e,t,i,l,s,o){return o=Object.assign({method:"POST",body:{clientId:e,teamId:t,keyId:i,privateKey:l,duration:s}},o),this.client.send("/api/settings/apple/generate-client-secret",o)}}class ma extends il{decode(e){return e}async getFullList(e,t){if(typeof e=="number")return this._getFullList(e,t);let i=500;return(t=Object.assign({},e,t)).batch&&(i=t.batch,delete t.batch),this._getFullList(i,t)}async getList(e=1,t=30,i){return(i=Object.assign({method:"GET"},i)).query=Object.assign({page:e,perPage:t},i.query),this.client.send(this.baseCrudPath,i).then(l=>{var s;return l.items=((s=l.items)==null?void 0:s.map(o=>this.decode(o)))||[],l})}async getFirstListItem(e,t){return(t=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+e},t)).query=Object.assign({filter:e,skipTotal:1},t.query),this.getList(1,1,t).then(i=>{var l;if(!((l=i==null?void 0:i.items)!=null&&l.length))throw new bn({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return i.items[0]})}async getOne(e,t){if(!e)throw new bn({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then(i=>this.decode(i))}async create(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send(this.baseCrudPath,t).then(i=>this.decode(i))}async update(e,t,i){return i=Object.assign({method:"PATCH",body:t},i),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),i).then(l=>this.decode(l))}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then(()=>!0)}_getFullList(e=500,t){(t=t||{}).query=Object.assign({skipTotal:1},t.query);let i=[],l=async s=>this.getList(s,e||500,t).then(o=>{const r=o.items;return i=i.concat(r),r.length==o.perPage?l(s+1):i});return l(1)}}function Sn(n,e,t,i){const l=i!==void 0;return l||t!==void 0?l?(console.warn(n),e.body=Object.assign({},e.body,t),e.query=Object.assign({},e.query,i),e):Object.assign(e,t):e}function ir(n){var e;(e=n._resetAutoRefresh)==null||e.call(n)}class Y0 extends ma{get baseCrudPath(){return"/api/admins"}async update(e,t,i){return super.update(e,t,i).then(l=>{var s,o;return((s=this.client.authStore.model)==null?void 0:s.id)===l.id&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,l),l})}async delete(e,t){return super.delete(e,t).then(i=>{var l,s;return i&&((l=this.client.authStore.model)==null?void 0:l.id)===e&&((s=this.client.authStore.model)==null?void 0:s.collectionId)===void 0&&this.client.authStore.clear(),i})}authResponse(e){const t=this.decode((e==null?void 0:e.admin)||{});return e!=null&&e.token&&(e!=null&&e.admin)&&this.client.authStore.save(e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",admin:t})}async authWithPassword(e,t,i,l){let s={method:"POST",body:{identity:e,password:t}};s=Sn("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",s,i,l);const o=s.autoRefreshThreshold;delete s.autoRefreshThreshold,s.autoRefresh||ir(this.client);let r=await this.client.send(this.baseCrudPath+"/auth-with-password",s);return r=this.authResponse(r),o&&function(f,u,c,d){ir(f);const m=f.beforeSend,h=f.authStore.model,_=f.authStore.onChange((g,v)=>{(!g||(v==null?void 0:v.id)!=(h==null?void 0:h.id)||(v!=null&&v.collectionId||h!=null&&h.collectionId)&&(v==null?void 0:v.collectionId)!=(h==null?void 0:h.collectionId))&&ir(f)});f._resetAutoRefresh=function(){_(),f.beforeSend=m,delete f._resetAutoRefresh},f.beforeSend=async(g,v)=>{var O;const $=f.authStore.token;if((O=v.query)!=null&&O.autoRefresh)return m?m(g,v):{url:g,sendOptions:v};let C=f.authStore.isValid;if(C&&pa(f.authStore.token,u))try{await c()}catch{C=!1}C||await d();const T=v.headers||{};for(let M in T)if(M.toLowerCase()=="authorization"&&$==T[M]&&f.authStore.token){T[M]=f.authStore.token;break}return v.headers=T,m?m(g,v):{url:g,sendOptions:v}}}(this.client,o,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(e,t,Object.assign({autoRefresh:!0},s))),r}async authRefresh(e,t){let i={method:"POST"};return i=Sn("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",i,e,t),this.client.send(this.baseCrudPath+"/auth-refresh",i).then(this.authResponse.bind(this))}async requestPasswordReset(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",l,t,i),this.client.send(this.baseCrudPath+"/request-password-reset",l).then(()=>!0)}async confirmPasswordReset(e,t,i,l,s){let o={method:"POST",body:{token:e,password:t,passwordConfirm:i}};return o=Sn("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",o,l,s),this.client.send(this.baseCrudPath+"/confirm-password-reset",o).then(()=>!0)}}const K0=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function Ug(n){if(n){n.query=n.query||{};for(let e in n)K0.includes(e)||(n.query[e]=n[e],delete n[e])}}class Wg extends il{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(e,t,i){var o;if(!e)throw new Error("topic must be set.");let l=e;if(i){Ug(i);const r="options="+encodeURIComponent(JSON.stringify({query:i.query,headers:i.headers}));l+=(l.includes("?")?"&":"?")+r}const s=function(r){const a=r;let f;try{f=JSON.parse(a==null?void 0:a.data)}catch{}t(f||{})};return this.subscriptions[l]||(this.subscriptions[l]=[]),this.subscriptions[l].push(s),this.isConnected?this.subscriptions[l].length===1?await this.submitSubscriptions():(o=this.eventSource)==null||o.addEventListener(l,s):await this.connect(),async()=>this.unsubscribeByTopicAndListener(e,s)}async unsubscribe(e){var i;let t=!1;if(e){const l=this.getSubscriptionsByTopic(e);for(let s in l)if(this.hasSubscriptionListeners(s)){for(let o of this.subscriptions[s])(i=this.eventSource)==null||i.removeEventListener(s,o);delete this.subscriptions[s],t||(t=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?t&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(e){var i;let t=!1;for(let l in this.subscriptions)if((l+"?").startsWith(e)){t=!0;for(let s of this.subscriptions[l])(i=this.eventSource)==null||i.removeEventListener(l,s);delete this.subscriptions[l]}t&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(e,t){var s;let i=!1;const l=this.getSubscriptionsByTopic(e);for(let o in l){if(!Array.isArray(this.subscriptions[o])||!this.subscriptions[o].length)continue;let r=!1;for(let a=this.subscriptions[o].length-1;a>=0;a--)this.subscriptions[o][a]===t&&(r=!0,delete this.subscriptions[o][a],this.subscriptions[o].splice(a,1),(s=this.eventSource)==null||s.removeEventListener(o,t));r&&(this.subscriptions[o].length||delete this.subscriptions[o],i||this.hasSubscriptionListeners(o)||(i=!0))}this.hasSubscriptionListeners()?i&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(e){var t,i;if(this.subscriptions=this.subscriptions||{},e)return!!((t=this.subscriptions[e])!=null&&t.length);for(let l in this.subscriptions)if((i=this.subscriptions[l])!=null&&i.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(e=>{if(!(e!=null&&e.isAbort))throw e})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(e){const t={};e=e.includes("?")?e:e+"?";for(let i in this.subscriptions)(i+"?").startsWith(e)&&(t[i]=this.subscriptions[i]);return t}getNonEmptySubscriptionKeys(){const e=[];for(let t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.addEventListener(e,t)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.removeEventListener(e,t)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((e,t)=>{this.pendingConnects.push({resolve:e,reject:t}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=e=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",e=>{const t=e;this.clientId=t==null?void 0:t.lastEventId,this.submitSubscriptions().then(async()=>{let i=3;for(;this.hasUnsentSubscriptions()&&i>0;)i--,await this.submitSubscriptions()}).then(()=>{for(let l of this.pendingConnects)l.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const i=this.getSubscriptionsByTopic("PB_CONNECT");for(let l in i)for(let s of i[l])s(e)}).catch(i=>{this.clientId="",this.connectErrorHandler(i)})})}hasUnsentSubscriptions(){const e=this.getNonEmptySubscriptionKeys();if(e.length!=this.lastSentSubscriptions.length)return!0;for(const t of e)if(!this.lastSentSubscriptions.includes(t))return!0;return!1}connectErrorHandler(e){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let i of this.pendingConnects)i.reject(new bn(e));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const t=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},t)}disconnect(e=!1){var t;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(t=this.eventSource)==null||t.close(),this.eventSource=null,this.clientId="",!e){this.reconnectAttempts=0;for(let i of this.pendingConnects)i.resolve();this.pendingConnects=[]}}}class J0 extends ma{constructor(e,t){super(e),this.collectionIdOrName=t}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(e,t,i){if(!e)throw new Error("Missing topic.");if(!t)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+e,t,i)}async unsubscribe(e){return e?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+e):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(e,t){if(typeof e=="number")return super.getFullList(e,t);const i=Object.assign({},e,t);return super.getFullList(i)}async getList(e=1,t=30,i){return super.getList(e,t,i)}async getFirstListItem(e,t){return super.getFirstListItem(e,t)}async getOne(e,t){return super.getOne(e,t)}async create(e,t){return super.create(e,t)}async update(e,t,i){return super.update(e,t,i).then(l=>{var s,o,r;return((s=this.client.authStore.model)==null?void 0:s.id)!==(l==null?void 0:l.id)||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((r=this.client.authStore.model)==null?void 0:r.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,l),l})}async delete(e,t){return super.delete(e,t).then(i=>{var l,s,o;return!i||((l=this.client.authStore.model)==null?void 0:l.id)!==e||((s=this.client.authStore.model)==null?void 0:s.collectionId)!==this.collectionIdOrName&&((o=this.client.authStore.model)==null?void 0:o.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),i})}authResponse(e){const t=this.decode((e==null?void 0:e.record)||{});return this.client.authStore.save(e==null?void 0:e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",record:t})}async listAuthMethods(e){return e=Object.assign({method:"GET"},e),this.client.send(this.baseCollectionPath+"/auth-methods",e).then(t=>Object.assign({},t,{usernamePassword:!!(t!=null&&t.usernamePassword),emailPassword:!!(t!=null&&t.emailPassword),authProviders:Array.isArray(t==null?void 0:t.authProviders)?t==null?void 0:t.authProviders:[]}))}async authWithPassword(e,t,i,l){let s={method:"POST",body:{identity:e,password:t}};return s=Sn("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",s,i,l),this.client.send(this.baseCollectionPath+"/auth-with-password",s).then(o=>this.authResponse(o))}async authWithOAuth2Code(e,t,i,l,s,o,r){let a={method:"POST",body:{provider:e,code:t,codeVerifier:i,redirectUrl:l,createData:s}};return a=Sn("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",a,o,r),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",a).then(f=>this.authResponse(f))}async authWithOAuth2(...e){if(e.length>1||typeof(e==null?void 0:e[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((e==null?void 0:e[0])||"",(e==null?void 0:e[1])||"",(e==null?void 0:e[2])||"",(e==null?void 0:e[3])||"",(e==null?void 0:e[4])||{},(e==null?void 0:e[5])||{},(e==null?void 0:e[6])||{});const t=(e==null?void 0:e[0])||{},i=(await this.listAuthMethods()).authProviders.find(a=>a.name===t.provider);if(!i)throw new bn(new Error(`Missing or invalid provider "${t.provider}".`));const l=this.client.buildUrl("/api/oauth2-redirect"),s=new Wg(this.client);let o=null;function r(){o==null||o.close(),s.unsubscribe()}return t.urlCallback||(o=af(void 0)),new Promise(async(a,f)=>{var u;try{await s.subscribe("@oauth2",async h=>{const _=s.clientId;try{if(!h.state||_!==h.state)throw new Error("State parameters don't match.");const g=Object.assign({},t);delete g.provider,delete g.scopes,delete g.createData,delete g.urlCallback;const v=await this.authWithOAuth2Code(i.name,h.code,i.codeVerifier,l,t.createData,g);a(v)}catch(g){f(new bn(g))}r()});const c={state:s.clientId};(u=t.scopes)!=null&&u.length&&(c.scope=t.scopes.join(" "));const d=this._replaceQueryParams(i.authUrl+l,c);await(t.urlCallback||function(h){o?o.location.href=h:o=af(h)})(d)}catch(c){r(),f(new bn(c))}})}async authRefresh(e,t){let i={method:"POST"};return i=Sn("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",i,e,t),this.client.send(this.baseCollectionPath+"/auth-refresh",i).then(l=>this.authResponse(l))}async requestPasswordReset(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-password-reset",l).then(()=>!0)}async confirmPasswordReset(e,t,i,l,s){let o={method:"POST",body:{token:e,password:t,passwordConfirm:i}};return o=Sn("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",o,l,s),this.client.send(this.baseCollectionPath+"/confirm-password-reset",o).then(()=>!0)}async requestVerification(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-verification",l).then(()=>!0)}async confirmVerification(e,t,i){let l={method:"POST",body:{token:e}};return l=Sn("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/confirm-verification",l).then(()=>!0)}async requestEmailChange(e,t,i){let l={method:"POST",body:{newEmail:e}};return l=Sn("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-email-change",l).then(()=>!0)}async confirmEmailChange(e,t,i,l){let s={method:"POST",body:{token:e,password:t}};return s=Sn("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",s,i,l),this.client.send(this.baseCollectionPath+"/confirm-email-change",s).then(()=>!0)}async listExternalAuths(e,t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",t)}async unlinkExternalAuth(e,t,i){return i=Object.assign({method:"DELETE"},i),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths/"+encodeURIComponent(t),i).then(()=>!0)}_replaceQueryParams(e,t={}){let i=e,l="";e.indexOf("?")>=0&&(i=e.substring(0,e.indexOf("?")),l=e.substring(e.indexOf("?")+1));const s={},o=l.split("&");for(const r of o){if(r=="")continue;const a=r.split("=");s[decodeURIComponent(a[0].replace(/\+/g," "))]=decodeURIComponent((a[1]||"").replace(/\+/g," "))}for(let r in t)t.hasOwnProperty(r)&&(t[r]==null?delete s[r]:s[r]=t[r]);l="";for(let r in s)s.hasOwnProperty(r)&&(l!=""&&(l+="&"),l+=encodeURIComponent(r.replace(/%20/g,"+"))+"="+encodeURIComponent(s[r].replace(/%20/g,"+")));return l!=""?i+"?"+l:i}}function af(n){if(typeof window>"u"||!(window!=null&&window.open))throw new bn(new Error("Not in a browser context - please pass a custom urlCallback function."));let e=1024,t=768,i=window.innerWidth,l=window.innerHeight;e=e>i?i:e,t=t>l?l:t;let s=i/2-e/2,o=l/2-t/2;return window.open(n,"popup_window","width="+e+",height="+t+",top="+o+",left="+s+",resizable,menubar=no")}class Z0 extends ma{get baseCrudPath(){return"/api/collections"}async import(e,t=!1,i){return i=Object.assign({method:"PUT",body:{collections:e,deleteMissing:t}},i),this.client.send(this.baseCrudPath+"/import",i).then(()=>!0)}}class G0 extends il{async getList(e=1,t=30,i){return(i=Object.assign({method:"GET"},i)).query=Object.assign({page:e,perPage:t},i.query),this.client.send("/api/logs",i)}async getOne(e,t){if(!e)throw new bn({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/"+encodeURIComponent(e),t)}async getStats(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/logs/stats",e)}}class X0 extends il{async check(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/health",e)}}class Q0 extends il{getUrl(e,t,i={}){if(!t||!(e!=null&&e.id)||!(e!=null&&e.collectionId)&&!(e!=null&&e.collectionName))return"";const l=[];l.push("api"),l.push("files"),l.push(encodeURIComponent(e.collectionId||e.collectionName)),l.push(encodeURIComponent(e.id)),l.push(encodeURIComponent(t));let s=this.client.buildUrl(l.join("/"));if(Object.keys(i).length){i.download===!1&&delete i.download;const o=new URLSearchParams(i);s+=(s.includes("?")?"&":"?")+o}return s}async getToken(e){return e=Object.assign({method:"POST"},e),this.client.send("/api/files/token",e).then(t=>(t==null?void 0:t.token)||"")}}class x0 extends il{async getFullList(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/backups",e)}async create(e,t){return t=Object.assign({method:"POST",body:{name:e}},t),this.client.send("/api/backups",t).then(()=>!0)}async upload(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send("/api/backups/upload",t).then(()=>!0)}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}`,t).then(()=>!0)}async restore(e,t){return t=Object.assign({method:"POST"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}/restore`,t).then(()=>!0)}getDownloadUrl(e,t){return this.client.buildUrl(`/api/backups/${encodeURIComponent(t)}?token=${encodeURIComponent(e)}`)}}class zo{constructor(e="/",t,i="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=e,this.lang=i,this.authStore=t||new Bg,this.admins=new Y0(this),this.collections=new Z0(this),this.files=new Q0(this),this.logs=new G0(this),this.settings=new W0(this),this.realtime=new Wg(this),this.health=new X0(this),this.backups=new x0(this)}collection(e){return this.recordServices[e]||(this.recordServices[e]=new J0(this,e)),this.recordServices[e]}autoCancellation(e){return this.enableAutoCancellation=!!e,this}cancelRequest(e){return this.cancelControllers[e]&&(this.cancelControllers[e].abort(),delete this.cancelControllers[e]),this}cancelAllRequests(){for(let e in this.cancelControllers)this.cancelControllers[e].abort();return this.cancelControllers={},this}filter(e,t){if(!t)return e;for(let i in t){let l=t[i];switch(typeof l){case"boolean":case"number":l=""+l;break;case"string":l="'"+l.replace(/'/g,"\\'")+"'";break;default:l=l===null?"null":l instanceof Date?"'"+l.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(l).replace(/'/g,"\\'")+"'"}e=e.replaceAll("{:"+i+"}",l)}return e}getFileUrl(e,t,i={}){return this.files.getUrl(e,t,i)}buildUrl(e){var i;let t=this.baseUrl;return typeof window>"u"||!window.location||t.startsWith("https://")||t.startsWith("http://")||(t=(i=window.location.origin)!=null&&i.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(t+=window.location.pathname||"/",t+=t.endsWith("/")?"":"/"),t+=this.baseUrl),e&&(t+=t.endsWith("/")?"":"/",t+=e.startsWith("/")?e.substring(1):e),t}async send(e,t){t=this.initSendOptions(e,t);let i=this.buildUrl(e);if(this.beforeSend){const l=Object.assign({},await this.beforeSend(i,t));l.url!==void 0||l.options!==void 0?(i=l.url||i,t=l.options||t):Object.keys(l).length&&(t=l,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(t.query!==void 0){const l=this.serializeQueryParams(t.query);l&&(i+=(i.includes("?")?"&":"?")+l),delete t.query}return this.getHeader(t.headers,"Content-Type")=="application/json"&&t.body&&typeof t.body!="string"&&(t.body=JSON.stringify(t.body)),(t.fetch||fetch)(i,t).then(async l=>{let s={};try{s=await l.json()}catch{}if(this.afterSend&&(s=await this.afterSend(l,s)),l.status>=400)throw new bn({url:l.url,status:l.status,data:s});return s}).catch(l=>{throw new bn(l)})}initSendOptions(e,t){if((t=Object.assign({method:"GET"},t)).body=this.convertToFormDataIfNeeded(t.body),Ug(t),t.query=Object.assign({},t.params,t.query),t.requestKey===void 0&&(t.$autoCancel===!1||t.query.$autoCancel===!1?t.requestKey=null:(t.$cancelKey||t.query.$cancelKey)&&(t.requestKey=t.$cancelKey||t.query.$cancelKey)),delete t.$autoCancel,delete t.query.$autoCancel,delete t.$cancelKey,delete t.query.$cancelKey,this.getHeader(t.headers,"Content-Type")!==null||this.isFormData(t.body)||(t.headers=Object.assign({},t.headers,{"Content-Type":"application/json"})),this.getHeader(t.headers,"Accept-Language")===null&&(t.headers=Object.assign({},t.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(t.headers,"Authorization")===null&&(t.headers=Object.assign({},t.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&t.requestKey!==null){const i=t.requestKey||(t.method||"GET")+e;delete t.requestKey,this.cancelRequest(i);const l=new AbortController;this.cancelControllers[i]=l,t.signal=l.signal}return t}convertToFormDataIfNeeded(e){if(typeof FormData>"u"||e===void 0||typeof e!="object"||e===null||this.isFormData(e)||!this.hasBlobField(e))return e;const t=new FormData;for(let i in e){const l=this.normalizeFormDataValue(e[i]),s=Array.isArray(l)?l:[l];if(s.length)for(const o of s)t.append(i,o);else t.append(i,"")}return t}normalizeFormDataValue(e){return e===null||typeof e!="object"||e instanceof Date||this.hasBlobField({data:e})||Array.isArray(e)&&!e.filter(t=>typeof t!="string").length?e:JSON.stringify(e)}hasBlobField(e){for(let t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let l of i)if(typeof Blob<"u"&&l instanceof Blob||typeof File<"u"&&l instanceof File)return!0}return!1}getHeader(e,t){e=e||{},t=t.toLowerCase();for(let i in e)if(i.toLowerCase()==t)return e[i];return null}isFormData(e){return e&&(e.constructor.name==="FormData"||typeof FormData<"u"&&e instanceof FormData)}serializeQueryParams(e){const t=[];for(const i in e){if(e[i]===null)continue;const l=e[i],s=encodeURIComponent(i);if(Array.isArray(l))for(const o of l)t.push(s+"="+encodeURIComponent(o));else l instanceof Date?t.push(s+"="+encodeURIComponent(l.toISOString())):typeof l!==null&&typeof l=="object"?t.push(s+"="+encodeURIComponent(JSON.stringify(l))):t.push(s+"="+encodeURIComponent(l))}return t.join("&")}}class ll extends Error{}class ek extends ll{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class tk extends ll{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class nk extends ll{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class bl extends ll{}class Yg extends ll{constructor(e){super(`Invalid unit ${e}`)}}class hn extends ll{}class yi extends ll{constructor(){super("Zone is an abstract class")}}const De="numeric",Kn="short",Tn="long",vo={year:De,month:De,day:De},Kg={year:De,month:Kn,day:De},ik={year:De,month:Kn,day:De,weekday:Kn},Jg={year:De,month:Tn,day:De},Zg={year:De,month:Tn,day:De,weekday:Tn},Gg={hour:De,minute:De},Xg={hour:De,minute:De,second:De},Qg={hour:De,minute:De,second:De,timeZoneName:Kn},xg={hour:De,minute:De,second:De,timeZoneName:Tn},e1={hour:De,minute:De,hourCycle:"h23"},t1={hour:De,minute:De,second:De,hourCycle:"h23"},n1={hour:De,minute:De,second:De,hourCycle:"h23",timeZoneName:Kn},i1={hour:De,minute:De,second:De,hourCycle:"h23",timeZoneName:Tn},l1={year:De,month:De,day:De,hour:De,minute:De},s1={year:De,month:De,day:De,hour:De,minute:De,second:De},o1={year:De,month:Kn,day:De,hour:De,minute:De},r1={year:De,month:Kn,day:De,hour:De,minute:De,second:De},lk={year:De,month:Kn,day:De,weekday:Kn,hour:De,minute:De},a1={year:De,month:Tn,day:De,hour:De,minute:De,timeZoneName:Kn},f1={year:De,month:Tn,day:De,hour:De,minute:De,second:De,timeZoneName:Kn},u1={year:De,month:Tn,day:De,weekday:Tn,hour:De,minute:De,timeZoneName:Tn},c1={year:De,month:Tn,day:De,weekday:Tn,hour:De,minute:De,second:De,timeZoneName:Tn};class vs{get type(){throw new yi}get name(){throw new yi}get ianaName(){return this.name}get isUniversal(){throw new yi}offsetName(e,t){throw new yi}formatOffset(e,t){throw new yi}offset(e){throw new yi}equals(e){throw new yi}get isValid(){throw new yi}}let lr=null;class Vo extends vs{static get instance(){return lr===null&&(lr=new Vo),lr}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return y1(e,t,i)}formatOffset(e,t){return Gl(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let ro={};function sk(n){return ro[n]||(ro[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),ro[n]}const ok={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function rk(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,l,s,o,r,a,f,u]=i;return[o,l,s,r,a,f,u]}function ak(n,e){const t=n.formatToParts(e),i=[];for(let l=0;l<t.length;l++){const{type:s,value:o}=t[l],r=ok[s];s==="era"?i[r]=o:Ye(r)||(i[r]=parseInt(o,10))}return i}let As={};class mi extends vs{static create(e){return As[e]||(As[e]=new mi(e)),As[e]}static resetCache(){As={},ro={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=mi.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return y1(e,t,i,this.name)}formatOffset(e,t){return Gl(this.offset(e),t)}offset(e){const t=new Date(e);if(isNaN(t))return NaN;const i=sk(this.name);let[l,s,o,r,a,f,u]=i.formatToParts?ak(i,t):rk(i,t);r==="BC"&&(l=-Math.abs(l)+1);const d=Uo({year:l,month:s,day:o,hour:a===24?0:a,minute:f,second:u,millisecond:0});let m=+t;const h=m%1e3;return m-=h>=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ff={};function fk(n,e={}){const t=JSON.stringify([n,e]);let i=ff[t];return i||(i=new Intl.ListFormat(n,e),ff[t]=i),i}let jr={};function Hr(n,e={}){const t=JSON.stringify([n,e]);let i=jr[t];return i||(i=new Intl.DateTimeFormat(n,e),jr[t]=i),i}let zr={};function uk(n,e={}){const t=JSON.stringify([n,e]);let i=zr[t];return i||(i=new Intl.NumberFormat(n,e),zr[t]=i),i}let Vr={};function ck(n,e={}){const{base:t,...i}=e,l=JSON.stringify([n,i]);let s=Vr[l];return s||(s=new Intl.RelativeTimeFormat(n,e),Vr[l]=s),s}let Yl=null;function dk(){return Yl||(Yl=new Intl.DateTimeFormat().resolvedOptions().locale,Yl)}let uf={};function pk(n){let e=uf[n];if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,uf[n]=e}return e}function mk(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let i,l;try{i=Hr(n).resolvedOptions(),l=n}catch{const a=n.substring(0,t);i=Hr(a).resolvedOptions(),l=a}const{numberingSystem:s,calendar:o}=i;return[l,s,o]}}function hk(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function _k(n){const e=[];for(let t=1;t<=12;t++){const i=He.utc(2009,t,1);e.push(n(i))}return e}function gk(n){const e=[];for(let t=1;t<=7;t++){const i=He.utc(2016,11,13+t);e.push(n(i))}return e}function Ls(n,e,t,i){const l=n.listingMode();return l==="error"?null:l==="en"?t(e):i(e)}function bk(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}class kk{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:l,floor:s,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=uk(e,r)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):ba(e,3);return Bt(t,this.padTo)}}}class yk{constructor(e,t,i){this.opts=i,this.originalZone=void 0;let l;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&mi.create(r).valid?(l=r,this.dt=e):(l="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,l=e.zone.name):(l="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||l,this.dtf=Hr(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:i}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class vk{constructor(e,t,i){this.opts={style:"long",...i},!t&&b1()&&(this.rtf=ck(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):zk(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const wk={firstDay:1,minimalDays:4,weekend:[6,7]};class yt{static fromOpts(e){return yt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,i,l,s=!1){const o=e||jt.defaultLocale,r=o||(s?"en-US":dk()),a=t||jt.defaultNumberingSystem,f=i||jt.defaultOutputCalendar,u=Br(l)||jt.defaultWeekSettings;return new yt(r,a,f,u,o)}static resetCache(){Yl=null,jr={},zr={},Vr={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i,weekSettings:l}={}){return yt.create(e,t,i,l)}constructor(e,t,i,l,s){const[o,r,a]=mk(e);this.locale=o,this.numberingSystem=t||r||null,this.outputCalendar=i||a||null,this.weekSettings=l,this.intl=hk(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=bk(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:yt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Br(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Ls(this,e,S1,()=>{const i=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=_k(s=>this.extract(s,i,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1){return Ls(this,e,C1,()=>{const i=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},l=t?"format":"standalone";return this.weekdaysCache[l][e]||(this.weekdaysCache[l][e]=gk(s=>this.extract(s,i,"weekday"))),this.weekdaysCache[l][e]})}meridiems(){return Ls(this,void 0,()=>O1,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[He.utc(2016,11,13,9),He.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Ls(this,e,M1,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[He.utc(-40,1,1),He.utc(2017,1,1)].map(i=>this.extract(i,t,"era"))),this.eraCache[e]})}extract(e,t,i){const l=this.dtFormatter(e,t),s=l.formatToParts(),o=s.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new kk(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new yk(e,this.intl,t)}relFormatter(e={}){return new vk(this.intl,this.isEnglish(),e)}listFormatter(e={}){return fk(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:k1()?pk(this.locale):wk}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let sr=null;class cn extends vs{static get utcInstance(){return sr===null&&(sr=new cn(0)),sr}static instance(e){return e===0?cn.utcInstance:new cn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new cn(Wo(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Gl(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Gl(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Gl(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Sk extends vs{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function $i(n,e){if(Ye(n)||n===null)return e;if(n instanceof vs)return n;if(Ck(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Vo.instance:t==="utc"||t==="gmt"?cn.utcInstance:cn.parseSpecifier(t)||mi.create(n)}else return Zi(n)?cn.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new Sk(n)}let cf=()=>Date.now(),df="system",pf=null,mf=null,hf=null,_f=60,gf,bf=null;class jt{static get now(){return cf}static set now(e){cf=e}static set defaultZone(e){df=e}static get defaultZone(){return $i(df,Vo.instance)}static get defaultLocale(){return pf}static set defaultLocale(e){pf=e}static get defaultNumberingSystem(){return mf}static set defaultNumberingSystem(e){mf=e}static get defaultOutputCalendar(){return hf}static set defaultOutputCalendar(e){hf=e}static get defaultWeekSettings(){return bf}static set defaultWeekSettings(e){bf=Br(e)}static get twoDigitCutoffYear(){return _f}static set twoDigitCutoffYear(e){_f=e%100}static get throwOnInvalid(){return gf}static set throwOnInvalid(e){gf=e}static resetCaches(){yt.resetCache(),mi.resetCache()}}class Vn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const d1=[0,31,59,90,120,151,181,212,243,273,304,334],p1=[0,31,60,91,121,152,182,213,244,274,305,335];function Pn(n,e){return new Vn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function ha(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const l=i.getUTCDay();return l===0?7:l}function m1(n,e,t){return t+(ws(n)?p1:d1)[e-1]}function h1(n,e){const t=ws(n)?p1:d1,i=t.findIndex(s=>s<e),l=e-t[i];return{month:i+1,day:l}}function _a(n,e){return(n-e+7)%7+1}function wo(n,e=4,t=1){const{year:i,month:l,day:s}=n,o=m1(i,l,s),r=_a(ha(i,l,s),t);let a=Math.floor((o-r+14-e)/7),f;return a<1?(f=i-1,a=rs(f,e,t)):a>rs(i,e,t)?(f=i+1,a=1):f=i,{weekYear:f,weekNumber:a,weekday:r,...Yo(n)}}function kf(n,e=4,t=1){const{weekYear:i,weekNumber:l,weekday:s}=n,o=_a(ha(i,1,e),t),r=vl(i);let a=l*7+s-o-7+e,f;a<1?(f=i-1,a+=vl(f)):a>r?(f=i+1,a-=vl(i)):f=i;const{month:u,day:c}=h1(f,a);return{year:f,month:u,day:c,...Yo(n)}}function or(n){const{year:e,month:t,day:i}=n,l=m1(e,t,i);return{year:e,ordinal:l,...Yo(n)}}function yf(n){const{year:e,ordinal:t}=n,{month:i,day:l}=h1(e,t);return{year:e,month:i,day:l,...Yo(n)}}function vf(n,e){if(!Ye(n.localWeekday)||!Ye(n.localWeekNumber)||!Ye(n.localWeekYear)){if(!Ye(n.weekday)||!Ye(n.weekNumber)||!Ye(n.weekYear))throw new bl("Cannot mix locale-based week fields with ISO-based week fields");return Ye(n.localWeekday)||(n.weekday=n.localWeekday),Ye(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),Ye(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function $k(n,e=4,t=1){const i=Bo(n.weekYear),l=Fn(n.weekNumber,1,rs(n.weekYear,e,t)),s=Fn(n.weekday,1,7);return i?l?s?!1:Pn("weekday",n.weekday):Pn("week",n.weekNumber):Pn("weekYear",n.weekYear)}function Tk(n){const e=Bo(n.year),t=Fn(n.ordinal,1,vl(n.year));return e?t?!1:Pn("ordinal",n.ordinal):Pn("year",n.year)}function _1(n){const e=Bo(n.year),t=Fn(n.month,1,12),i=Fn(n.day,1,So(n.year,n.month));return e?t?i?!1:Pn("day",n.day):Pn("month",n.month):Pn("year",n.year)}function g1(n){const{hour:e,minute:t,second:i,millisecond:l}=n,s=Fn(e,0,23)||e===24&&t===0&&i===0&&l===0,o=Fn(t,0,59),r=Fn(i,0,59),a=Fn(l,0,999);return s?o?r?a?!1:Pn("millisecond",l):Pn("second",i):Pn("minute",t):Pn("hour",e)}function Ye(n){return typeof n>"u"}function Zi(n){return typeof n=="number"}function Bo(n){return typeof n=="number"&&n%1===0}function Ck(n){return typeof n=="string"}function Ok(n){return Object.prototype.toString.call(n)==="[object Date]"}function b1(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function k1(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Mk(n){return Array.isArray(n)?n:[n]}function wf(n,e,t){if(n.length!==0)return n.reduce((i,l)=>{const s=[e(l),l];return i&&t(i[0],s[0])===i[0]?i:s},null)[1]}function Dk(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Cl(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Br(n){if(n==null)return null;if(typeof n!="object")throw new hn("Week settings must be an object");if(!Fn(n.firstDay,1,7)||!Fn(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Fn(e,1,7)))throw new hn("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Fn(n,e,t){return Bo(n)&&n>=e&&n<=t}function Ek(n,e){return n-e*Math.floor(n/e)}function Bt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function wi(n){if(!(Ye(n)||n===null||n===""))return parseInt(n,10)}function Pi(n){if(!(Ye(n)||n===null||n===""))return parseFloat(n)}function ga(n){if(!(Ye(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function ba(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function ws(n){return n%4===0&&(n%100!==0||n%400===0)}function vl(n){return ws(n)?366:365}function So(n,e){const t=Ek(e-1,12)+1,i=n+(e-t)/12;return t===2?ws(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Uo(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Sf(n,e,t){return-_a(ha(n,1,e),t)+e-1}function rs(n,e=4,t=1){const i=Sf(n,e,t),l=Sf(n+1,e,t);return(vl(n)-i+l)/7}function Ur(n){return n>99?n:n>jt.twoDigitCutoffYear?1900+n:2e3+n}function y1(n,e,t,i=null){const l=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(s.timeZone=i);const o={timeZoneName:e,...s},r=new Intl.DateTimeFormat(t,o).formatToParts(l).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Wo(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,l=t<0||Object.is(t,-0)?-i:i;return t*60+l}function v1(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new hn(`Invalid unit value ${n}`);return e}function $o(n,e){const t={};for(const i in n)if(Cl(n,i)){const l=n[i];if(l==null)continue;t[e(i)]=v1(l)}return t}function Gl(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),l=n>=0?"+":"-";switch(e){case"short":return`${l}${Bt(t,2)}:${Bt(i,2)}`;case"narrow":return`${l}${t}${i>0?`:${i}`:""}`;case"techie":return`${l}${Bt(t,2)}${Bt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Yo(n){return Dk(n,["hour","minute","second","millisecond"])}const Ik=["January","February","March","April","May","June","July","August","September","October","November","December"],w1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ak=["J","F","M","A","M","J","J","A","S","O","N","D"];function S1(n){switch(n){case"narrow":return[...Ak];case"short":return[...w1];case"long":return[...Ik];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const $1=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],T1=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Lk=["M","T","W","T","F","S","S"];function C1(n){switch(n){case"narrow":return[...Lk];case"short":return[...T1];case"long":return[...$1];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const O1=["AM","PM"],Nk=["Before Christ","Anno Domini"],Pk=["BC","AD"],Fk=["B","A"];function M1(n){switch(n){case"narrow":return[...Fk];case"short":return[...Pk];case"long":return[...Nk];default:return null}}function Rk(n){return O1[n.hour<12?0:1]}function qk(n,e){return C1(e)[n.weekday-1]}function jk(n,e){return S1(e)[n.month-1]}function Hk(n,e){return M1(e)[n.year<0?0:1]}function zk(n,e,t="always",i=!1){const l={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const c=n==="days";switch(e){case 1:return c?"tomorrow":`next ${l[n][0]}`;case-1:return c?"yesterday":`last ${l[n][0]}`;case 0:return c?"today":`this ${l[n][0]}`}}const o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,f=l[n],u=i?a?f[1]:f[2]||f[1]:a?l[n][0]:n;return o?`${r} ${u} ago`:`in ${r} ${u}`}function $f(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const Vk={D:vo,DD:Kg,DDD:Jg,DDDD:Zg,t:Gg,tt:Xg,ttt:Qg,tttt:xg,T:e1,TT:t1,TTT:n1,TTTT:i1,f:l1,ff:o1,fff:a1,ffff:u1,F:s1,FF:r1,FFF:f1,FFFF:c1};class sn{static create(e,t={}){return new sn(e,t)}static parseFormat(e){let t=null,i="",l=!1;const s=[];for(let o=0;o<e.length;o++){const r=e.charAt(o);r==="'"?(i.length>0&&s.push({literal:l||/^\s+$/.test(i),val:i}),t=null,i="",l=!l):l||r===t?i+=r:(i.length>0&&s.push({literal:/^\s+$/.test(i),val:i}),i=r,t=r)}return i.length>0&&s.push({literal:l||/^\s+$/.test(i),val:i}),s}static macroTokenToFormatOpts(e){return Vk[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return Bt(e,t);const i={...this.opts};return t>0&&(i.padTo=t),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const i=this.loc.listingMode()==="en",l=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(m,h)=>this.loc.extract(e,m,h),o=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",r=()=>i?Rk(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(m,h)=>i?jk(e,m):s(h?{month:m}:{month:m,day:"numeric"},"month"),f=(m,h)=>i?qk(e,m):s(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{const h=sn.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},c=m=>i?Hk(e,m):s({era:m},"era"),d=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return r();case"d":return l?s({day:"numeric"},"day"):this.num(e.day);case"dd":return l?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return l?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return l?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return l?s({month:"numeric"},"month"):this.num(e.month);case"MM":return l?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return l?s({year:"numeric"},"year"):this.num(e.year);case"yy":return l?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return l?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return l?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(m)}};return $f(sn.parseFormat(t),d)}formatDurationFromString(e,t){const i=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},l=a=>f=>{const u=i(f);return u?this.num(a.get(u),f.length):f},s=sn.parseFormat(t),o=s.reduce((a,{literal:f,val:u})=>f?a:a.concat(u),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return $f(s,l(r))}}const D1=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Il(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Al(...n){return e=>n.reduce(([t,i,l],s)=>{const[o,r,a]=s(e,l);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Ll(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const l=t.exec(n);if(l)return i(l)}return[null,null]}function E1(...n){return(e,t)=>{const i={};let l;for(l=0;l<n.length;l++)i[n[l]]=wi(e[t+l]);return[i,null,t+l]}}const I1=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Bk=`(?:${I1.source}?(?:\\[(${D1.source})\\])?)?`,ka=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,A1=RegExp(`${ka.source}${Bk}`),ya=RegExp(`(?:T${A1.source})?`),Uk=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Wk=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Yk=/(\d{4})-?(\d{3})/,Kk=E1("weekYear","weekNumber","weekDay"),Jk=E1("year","ordinal"),Zk=/(\d{4})-(\d\d)-(\d\d)/,L1=RegExp(`${ka.source} ?(?:${I1.source}|(${D1.source}))?`),Gk=RegExp(`(?: ${L1.source})?`);function wl(n,e,t){const i=n[e];return Ye(i)?t:wi(i)}function Xk(n,e){return[{year:wl(n,e),month:wl(n,e+1,1),day:wl(n,e+2,1)},null,e+3]}function Nl(n,e){return[{hours:wl(n,e,0),minutes:wl(n,e+1,0),seconds:wl(n,e+2,0),milliseconds:ga(n[e+3])},null,e+4]}function Ss(n,e){const t=!n[e]&&!n[e+1],i=Wo(n[e+1],n[e+2]),l=t?null:cn.instance(i);return[{},l,e+3]}function $s(n,e){const t=n[e]?mi.create(n[e]):null;return[{},t,e+1]}const Qk=RegExp(`^T?${ka.source}$`),xk=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function ey(n){const[e,t,i,l,s,o,r,a,f]=n,u=e[0]==="-",c=a&&a[0]==="-",d=(m,h=!1)=>m!==void 0&&(h||m&&u)?-m:m;return[{years:d(Pi(t)),months:d(Pi(i)),weeks:d(Pi(l)),days:d(Pi(s)),hours:d(Pi(o)),minutes:d(Pi(r)),seconds:d(Pi(a),a==="-0"),milliseconds:d(ga(f),c)}]}const ty={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function va(n,e,t,i,l,s,o){const r={year:e.length===2?Ur(wi(e)):wi(e),month:w1.indexOf(t)+1,day:wi(i),hour:wi(l),minute:wi(s)};return o&&(r.second=wi(o)),n&&(r.weekday=n.length>3?$1.indexOf(n)+1:T1.indexOf(n)+1),r}const ny=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function iy(n){const[,e,t,i,l,s,o,r,a,f,u,c]=n,d=va(e,l,i,t,s,o,r);let m;return a?m=ty[a]:f?m=0:m=Wo(u,c),[d,new cn(m)]}function ly(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const sy=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,oy=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ry=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Tf(n){const[,e,t,i,l,s,o,r]=n;return[va(e,l,i,t,s,o,r),cn.utcInstance]}function ay(n){const[,e,t,i,l,s,o,r]=n;return[va(e,r,t,i,l,s,o),cn.utcInstance]}const fy=Il(Uk,ya),uy=Il(Wk,ya),cy=Il(Yk,ya),dy=Il(A1),N1=Al(Xk,Nl,Ss,$s),py=Al(Kk,Nl,Ss,$s),my=Al(Jk,Nl,Ss,$s),hy=Al(Nl,Ss,$s);function _y(n){return Ll(n,[fy,N1],[uy,py],[cy,my],[dy,hy])}function gy(n){return Ll(ly(n),[ny,iy])}function by(n){return Ll(n,[sy,Tf],[oy,Tf],[ry,ay])}function ky(n){return Ll(n,[xk,ey])}const yy=Al(Nl);function vy(n){return Ll(n,[Qk,yy])}const wy=Il(Zk,Gk),Sy=Il(L1),$y=Al(Nl,Ss,$s);function Ty(n){return Ll(n,[wy,N1],[Sy,$y])}const Cf="Invalid Duration",P1={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Cy={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...P1},En=146097/400,ml=146097/4800,Oy={years:{quarters:4,months:12,weeks:En/7,days:En,hours:En*24,minutes:En*24*60,seconds:En*24*60*60,milliseconds:En*24*60*60*1e3},quarters:{months:3,weeks:En/28,days:En/4,hours:En*24/4,minutes:En*24*60/4,seconds:En*24*60*60/4,milliseconds:En*24*60*60*1e3/4},months:{weeks:ml/7,days:ml,hours:ml*24,minutes:ml*24*60,seconds:ml*24*60*60,milliseconds:ml*24*60*60*1e3},...P1},Wi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],My=Wi.slice(0).reverse();function vi(n,e,t=!1){const i={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new ot(i)}function F1(n,e){let t=e.milliseconds??0;for(const i of My.slice(1))e[i]&&(t+=e[i]*n[i].milliseconds);return t}function Of(n,e){const t=F1(n,e)<0?-1:1;Wi.reduceRight((i,l)=>{if(Ye(e[l]))return i;if(i){const s=e[i]*t,o=n[l][i],r=Math.floor(s/o);e[l]+=r*t,e[i]-=r*o*t}return l},null),Wi.reduce((i,l)=>{if(Ye(e[l]))return i;if(i){const s=e[i]%1;e[i]-=s,e[l]+=s*n[i][l]}return l},null)}function Dy(n){const e={};for(const[t,i]of Object.entries(n))i!==0&&(e[t]=i);return e}class ot{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let i=t?Oy:Cy;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||yt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,t){return ot.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new hn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ot({values:$o(e,ot.normalizeUnit),loc:yt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Zi(e))return ot.fromMillis(e);if(ot.isDuration(e))return e;if(typeof e=="object")return ot.fromObject(e);throw new hn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=ky(e);return i?ot.fromObject(i,t):ot.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=vy(e);return i?ot.fromObject(i,t):ot.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the Duration is invalid");const i=e instanceof Vn?e:new Vn(e,t);if(jt.throwOnInvalid)throw new nk(i);return new ot({invalid:i})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Yg(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const i={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?sn.create(this.loc,i).formatDurationFromString(this,e):Cf}toHuman(e={}){if(!this.isValid)return Cf;const t=Wi.map(i=>{const l=this.values[i];return Ye(l)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(l)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=ba(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},He.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?F1(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e),i={};for(const l of Wi)(Cl(t.values,l)||Cl(this.values,l))&&(i[l]=t.get(l)+this.get(l));return vi(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const i of Object.keys(this.values))t[i]=v1(e(this.values[i],i));return vi(this,{values:t},!0)}get(e){return this[ot.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...$o(e,ot.normalizeUnit)};return vi(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i,matrix:l}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:l,conversionAccuracy:i};return vi(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Of(this.matrix,e),vi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Dy(this.normalize().shiftToAll().toObject());return vi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ot.normalizeUnit(o));const t={},i={},l=this.toObject();let s;for(const o of Wi)if(e.indexOf(o)>=0){s=o;let r=0;for(const f in i)r+=this.matrix[f][o]*i[f],i[f]=0;Zi(l[o])&&(r+=l[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3}else Zi(l[o])&&(i[o]=l[o]);for(const o in i)i[o]!==0&&(t[s]+=o===s?i[o]:i[o]/this.matrix[s][o]);return Of(this.matrix,t),vi(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return vi(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(i,l){return i===void 0||i===0?l===void 0||l===0:i===l}for(const i of Wi)if(!t(this.values[i],e.values[i]))return!1;return!0}}const hl="Invalid Interval";function Ey(n,e){return!n||!n.isValid?Rt.invalid("missing or invalid start"):!e||!e.isValid?Rt.invalid("missing or invalid end"):e<n?Rt.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class Rt{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the Interval is invalid");const i=e instanceof Vn?e:new Vn(e,t);if(jt.throwOnInvalid)throw new tk(i);return new Rt({invalid:i})}static fromDateTimes(e,t){const i=Hl(e),l=Hl(t),s=Ey(i,l);return s??new Rt({start:i,end:l})}static after(e,t){const i=ot.fromDurationLike(t),l=Hl(e);return Rt.fromDateTimes(l,l.plus(i))}static before(e,t){const i=ot.fromDurationLike(t),l=Hl(e);return Rt.fromDateTimes(l.minus(i),l)}static fromISO(e,t){const[i,l]=(e||"").split("/",2);if(i&&l){let s,o;try{s=He.fromISO(i,t),o=s.isValid}catch{o=!1}let r,a;try{r=He.fromISO(l,t),a=r.isValid}catch{a=!1}if(o&&a)return Rt.fromDateTimes(s,r);if(o){const f=ot.fromISO(l,t);if(f.isValid)return Rt.after(s,f)}else if(a){const f=ot.fromISO(i,t);if(f.isValid)return Rt.before(r,f)}}return Rt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const i=this.start.startOf(e,t);let l;return t!=null&&t.useLocaleWeeks?l=this.end.reconfigure({locale:i.locale}):l=this.end,l=l.startOf(e,t),Math.floor(l.diff(i,e).get(e))+(l.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?Rt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Hl).filter(o=>this.contains(o)).sort((o,r)=>o.toMillis()-r.toMillis()),i=[];let{s:l}=this,s=0;for(;l<this.e;){const o=t[s]||this.e,r=+o>+this.e?this.e:o;i.push(Rt.fromDateTimes(l,r)),l=r,s+=1}return i}splitBy(e){const t=ot.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,l=1,s;const o=[];for(;i<this.e;){const r=this.start.plus(t.mapUnits(a=>a*l));s=+r>+this.e?this.e:r,o.push(Rt.fromDateTimes(i,s)),i=s,l+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,i=this.e<e.e?this.e:e.e;return t>=i?null:Rt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,i=this.e>e.e?this.e:e.e;return Rt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((l,s)=>l.s-s.s).reduce(([l,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[l,s.union(o)]:[l.concat([s]),o]:[l,o],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const l=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),r=o.sort((a,f)=>a.time-f.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&l.push(Rt.fromDateTimes(t,a.time)),t=null);return Rt.merge(l)}difference(...e){return Rt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} ${this.e.toISO()})`:hl}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=vo,t={}){return this.isValid?sn.create(this.s.loc.clone(t),e).formatInterval(this):hl}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:hl}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:hl}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:hl}toFormat(e,{separator:t=" "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:hl}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ot.invalid(this.invalidReason)}mapEndpoints(e){return Rt.fromDateTimes(e(this.s),e(this.e))}}class Ns{static hasDST(e=jt.defaultZone){const t=He.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return mi.isValidZone(e)}static normalizeZone(e){return $i(e,jt.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||yt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||yt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||yt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null,outputCalendar:s="gregory"}={}){return(l||yt.create(t,i,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null,outputCalendar:s="gregory"}={}){return(l||yt.create(t,i,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null}={}){return(l||yt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null}={}){return(l||yt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return yt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return yt.create(t,null,"gregory").eras(e)}static features(){return{relative:b1(),localeWeek:k1()}}}function Mf(n,e){const t=l=>l.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(ot.fromMillis(i).as("days"))}function Iy(n,e,t){const i=[["years",(a,f)=>f.year-a.year],["quarters",(a,f)=>f.quarter-a.quarter+(f.year-a.year)*4],["months",(a,f)=>f.month-a.month+(f.year-a.year)*12],["weeks",(a,f)=>{const u=Mf(a,f);return(u-u%7)/7}],["days",Mf]],l={},s=n;let o,r;for(const[a,f]of i)t.indexOf(a)>=0&&(o=a,l[a]=f(n,e),r=s.plus(l),r>e?(l[a]--,n=s.plus(l),n>e&&(r=n,l[a]--,n=s.plus(l))):n=r);return[n,l,r,o]}function Ay(n,e,t,i){let[l,s,o,r]=Iy(n,e,t);const a=e-l,f=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);f.length===0&&(o<e&&(o=l.plus({[r]:1})),o!==l&&(s[r]=(s[r]||0)+a/(o-l)));const u=ot.fromObject(s,i);return f.length>0?ot.fromMillis(a,i).shiftTo(...f).plus(u):u}const wa={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[-৯]",deva:"[-९]",fullwide:"[-]",gujr:"[-૯]",hanidec:"[|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[-೯]",laoo:"[-໙]",limb:"[᥆-᥏]",mlym:"[-൯]",mong:"[᠐-᠙]",mymr:"[-၉]",orya:"[-୯]",tamldec:"[-௯]",telu:"[-౯]",thai:"[-๙]",tibt:"[༠-༩]",latn:"\\d"},Df={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ly=wa.hanidec.replace(/[\[|\]]/g,"").split("");function Ny(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const i=n.charCodeAt(t);if(n[t].search(wa.hanidec)!==-1)e+=Ly.indexOf(n[t]);else for(const l in Df){const[s,o]=Df[l];i>=s&&i<=o&&(e+=i-s)}}return parseInt(e,10)}else return e}function Hn({numberingSystem:n},e=""){return new RegExp(`${wa[n||"latn"]}${e}`)}const Py="missing Intl.DateTimeFormat.formatToParts support";function dt(n,e=t=>t){return{regex:n,deser:([t])=>e(Ny(t))}}const Fy=" ",R1=`[ ${Fy}]`,q1=new RegExp(R1,"g");function Ry(n){return n.replace(/\./g,"\\.?").replace(q1,R1)}function Ef(n){return n.replace(/\./g,"").replace(q1," ").toLowerCase()}function zn(n,e){return n===null?null:{regex:RegExp(n.map(Ry).join("|")),deser:([t])=>n.findIndex(i=>Ef(t)===Ef(i))+e}}function If(n,e){return{regex:n,deser:([,t,i])=>Wo(t,i),groups:e}}function Ps(n){return{regex:n,deser:([e])=>e}}function qy(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function jy(n,e){const t=Hn(e),i=Hn(e,"{2}"),l=Hn(e,"{3}"),s=Hn(e,"{4}"),o=Hn(e,"{6}"),r=Hn(e,"{1,2}"),a=Hn(e,"{1,3}"),f=Hn(e,"{1,6}"),u=Hn(e,"{1,9}"),c=Hn(e,"{2,4}"),d=Hn(e,"{4,6}"),m=g=>({regex:RegExp(qy(g.val)),deser:([v])=>v,literal:!0}),_=(g=>{if(n.literal)return m(g);switch(g.val){case"G":return zn(e.eras("short"),0);case"GG":return zn(e.eras("long"),0);case"y":return dt(f);case"yy":return dt(c,Ur);case"yyyy":return dt(s);case"yyyyy":return dt(d);case"yyyyyy":return dt(o);case"M":return dt(r);case"MM":return dt(i);case"MMM":return zn(e.months("short",!0),1);case"MMMM":return zn(e.months("long",!0),1);case"L":return dt(r);case"LL":return dt(i);case"LLL":return zn(e.months("short",!1),1);case"LLLL":return zn(e.months("long",!1),1);case"d":return dt(r);case"dd":return dt(i);case"o":return dt(a);case"ooo":return dt(l);case"HH":return dt(i);case"H":return dt(r);case"hh":return dt(i);case"h":return dt(r);case"mm":return dt(i);case"m":return dt(r);case"q":return dt(r);case"qq":return dt(i);case"s":return dt(r);case"ss":return dt(i);case"S":return dt(a);case"SSS":return dt(l);case"u":return Ps(u);case"uu":return Ps(r);case"uuu":return dt(t);case"a":return zn(e.meridiems(),0);case"kkkk":return dt(s);case"kk":return dt(c,Ur);case"W":return dt(r);case"WW":return dt(i);case"E":case"c":return dt(t);case"EEE":return zn(e.weekdays("short",!1),1);case"EEEE":return zn(e.weekdays("long",!1),1);case"ccc":return zn(e.weekdays("short",!0),1);case"cccc":return zn(e.weekdays("long",!0),1);case"Z":case"ZZ":return If(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return If(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return Ps(/[a-z_+-/]{1,256}?/i);case" ":return Ps(/[^\S\n\r]/);default:return m(g)}})(n)||{invalidReason:Py};return _.token=n,_}const Hy={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function zy(n,e,t){const{type:i,value:l}=n;if(i==="literal"){const a=/^\s+$/.test(l);return{literal:!a,val:a?" ":l}}const s=e[i];let o=i;i==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let r=Hy[o];if(typeof r=="object"&&(r=r[s]),r)return{literal:!1,val:r}}function Vy(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function By(n,e,t){const i=n.match(e);if(i){const l={};let s=1;for(const o in t)if(Cl(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(l[r.token.val[0]]=r.deser(i.slice(s,s+a))),s+=a}return[i,l]}else return[i,{}]}function Uy(n){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,i;return Ye(n.z)||(t=mi.create(n.z)),Ye(n.Z)||(t||(t=new cn(n.Z)),i=n.Z),Ye(n.q)||(n.M=(n.q-1)*3+1),Ye(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),Ye(n.u)||(n.S=ga(n.u)),[Object.keys(n).reduce((s,o)=>{const r=e(o);return r&&(s[r]=n[o]),s},{}),t,i]}let rr=null;function Wy(){return rr||(rr=He.fromMillis(1555555555555)),rr}function Yy(n,e){if(n.literal)return n;const t=sn.macroTokenToFormatOpts(n.val),i=z1(t,e);return i==null||i.includes(void 0)?n:i}function j1(n,e){return Array.prototype.concat(...n.map(t=>Yy(t,e)))}function H1(n,e,t){const i=j1(sn.parseFormat(t),n),l=i.map(o=>jy(o,n)),s=l.find(o=>o.invalidReason);if(s)return{input:e,tokens:i,invalidReason:s.invalidReason};{const[o,r]=Vy(l),a=RegExp(o,"i"),[f,u]=By(e,a,r),[c,d,m]=u?Uy(u):[null,null,void 0];if(Cl(u,"a")&&Cl(u,"H"))throw new bl("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:a,rawMatches:f,matches:u,result:c,zone:d,specificOffset:m}}}function Ky(n,e,t){const{result:i,zone:l,specificOffset:s,invalidReason:o}=H1(n,e,t);return[i,l,s,o]}function z1(n,e){if(!n)return null;const i=sn.create(e,n).dtFormatter(Wy()),l=i.formatToParts(),s=i.resolvedOptions();return l.map(o=>zy(o,n,s))}const ar="Invalid DateTime",Af=864e13;function Fs(n){return new Vn("unsupported zone",`the zone "${n.name}" is not supported`)}function fr(n){return n.weekData===null&&(n.weekData=wo(n.c)),n.weekData}function ur(n){return n.localWeekData===null&&(n.localWeekData=wo(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function Fi(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new He({...t,...e,old:t})}function V1(n,e,t){let i=n-e*60*1e3;const l=t.offset(i);if(e===l)return[i,e];i-=(l-e)*60*1e3;const s=t.offset(i);return l===s?[i,l]:[n-Math.min(l,s)*60*1e3,Math.max(l,s)]}function Rs(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function ao(n,e,t){return V1(Uo(n),e,t)}function Lf(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),l=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:i,month:l,day:Math.min(n.c.day,So(i,l))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ot.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),r=Uo(s);let[a,f]=V1(r,t,n.zone);return o!==0&&(a+=o,f=n.zone.offset(a)),{ts:a,o:f}}function jl(n,e,t,i,l,s){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0||e){const a=e||r,f=He.fromObject(n,{...t,zone:a,specificOffset:s});return o?f:f.setZone(r)}else return He.invalid(new Vn("unparsable",`the input "${l}" can't be parsed as ${i}`))}function qs(n,e,t=!0){return n.isValid?sn.create(yt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function cr(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=Bt(n.c.year,t?6:4),e?(i+="-",i+=Bt(n.c.month),i+="-",i+=Bt(n.c.day)):(i+=Bt(n.c.month),i+=Bt(n.c.day)),i}function Nf(n,e,t,i,l,s){let o=Bt(n.c.hour);return e?(o+=":",o+=Bt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(o+=":")):o+=Bt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(o+=Bt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=Bt(n.c.millisecond,3))),l&&(n.isOffsetFixed&&n.offset===0&&!s?o+="Z":n.o<0?(o+="-",o+=Bt(Math.trunc(-n.o/60)),o+=":",o+=Bt(Math.trunc(-n.o%60))):(o+="+",o+=Bt(Math.trunc(n.o/60)),o+=":",o+=Bt(Math.trunc(n.o%60)))),s&&(o+="["+n.zone.ianaName+"]"),o}const B1={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Jy={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Zy={ordinal:1,hour:0,minute:0,second:0,millisecond:0},U1=["year","month","day","hour","minute","second","millisecond"],Gy=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Xy=["year","ordinal","hour","minute","second","millisecond"];function Qy(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Yg(n);return e}function Pf(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Qy(n)}}function Ff(n,e){const t=$i(e.zone,jt.defaultZone),i=yt.fromObject(e),l=jt.now();let s,o;if(Ye(n.year))s=l;else{for(const f of U1)Ye(n[f])&&(n[f]=B1[f]);const r=_1(n)||g1(n);if(r)return He.invalid(r);const a=t.offset(l);[s,o]=ao(n,a,t)}return new He({ts:s,zone:t,loc:i,o})}function Rf(n,e,t){const i=Ye(t.round)?!0:t.round,l=(o,r)=>(o=ba(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),s=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return l(s(t.unit),t.unit);for(const o of t.units){const r=s(o);if(Math.abs(r)>=1)return l(r,o)}return l(n>e?-0:0,t.units[t.units.length-1])}function qf(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}class He{constructor(e){const t=e.zone||jt.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new Vn("invalid input"):null)||(t.isValid?null:Fs(t));this.ts=Ye(e.ts)?jt.now():e.ts;let l=null,s=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[l,s]=[e.old.c,e.old.o];else{const r=t.offset(this.ts);l=Rs(this.ts,r),i=Number.isNaN(l.year)?new Vn("invalid input"):null,l=i?null:l,s=i?null:r}this._zone=t,this.loc=e.loc||yt.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=l,this.o=s,this.isLuxonDateTime=!0}static now(){return new He({})}static local(){const[e,t]=qf(arguments),[i,l,s,o,r,a,f]=t;return Ff({year:i,month:l,day:s,hour:o,minute:r,second:a,millisecond:f},e)}static utc(){const[e,t]=qf(arguments),[i,l,s,o,r,a,f]=t;return e.zone=cn.utcInstance,Ff({year:i,month:l,day:s,hour:o,minute:r,second:a,millisecond:f},e)}static fromJSDate(e,t={}){const i=Ok(e)?e.valueOf():NaN;if(Number.isNaN(i))return He.invalid("invalid input");const l=$i(t.zone,jt.defaultZone);return l.isValid?new He({ts:i,zone:l,loc:yt.fromObject(t)}):He.invalid(Fs(l))}static fromMillis(e,t={}){if(Zi(e))return e<-Af||e>Af?He.invalid("Timestamp out of range"):new He({ts:e,zone:$i(t.zone,jt.defaultZone),loc:yt.fromObject(t)});throw new hn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Zi(e))return new He({ts:e*1e3,zone:$i(t.zone,jt.defaultZone),loc:yt.fromObject(t)});throw new hn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=$i(t.zone,jt.defaultZone);if(!i.isValid)return He.invalid(Fs(i));const l=yt.fromObject(t),s=$o(e,Pf),{minDaysInFirstWeek:o,startOfWeek:r}=vf(s,l),a=jt.now(),f=Ye(t.specificOffset)?i.offset(a):t.specificOffset,u=!Ye(s.ordinal),c=!Ye(s.year),d=!Ye(s.month)||!Ye(s.day),m=c||d,h=s.weekYear||s.weekNumber;if((m||u)&&h)throw new bl("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new bl("Can't mix ordinal dates with month/day");const _=h||s.weekday&&!m;let g,v,$=Rs(a,f);_?(g=Gy,v=Jy,$=wo($,o,r)):u?(g=Xy,v=Zy,$=or($)):(g=U1,v=B1);let C=!1;for(const q of g){const R=s[q];Ye(R)?C?s[q]=v[q]:s[q]=$[q]:C=!0}const T=_?$k(s,o,r):u?Tk(s):_1(s),O=T||g1(s);if(O)return He.invalid(O);const M=_?kf(s,o,r):u?yf(s):s,[E,A]=ao(M,f,i),N=new He({ts:E,zone:i,o:A,loc:l});return s.weekday&&m&&e.weekday!==N.weekday?He.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${N.toISO()}`):N}static fromISO(e,t={}){const[i,l]=_y(e);return jl(i,l,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,l]=gy(e);return jl(i,l,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,l]=by(e);return jl(i,l,t,"HTTP",t)}static fromFormat(e,t,i={}){if(Ye(e)||Ye(t))throw new hn("fromFormat requires an input string and a format");const{locale:l=null,numberingSystem:s=null}=i,o=yt.fromOpts({locale:l,numberingSystem:s,defaultToEN:!0}),[r,a,f,u]=Ky(o,e,t);return u?He.invalid(u):jl(r,a,i,`format ${t}`,e,f)}static fromString(e,t,i={}){return He.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,l]=Ty(e);return jl(i,l,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the DateTime is invalid");const i=e instanceof Vn?e:new Vn(e,t);if(jt.throwOnInvalid)throw new ek(i);return new He({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const i=z1(e,yt.fromObject(t));return i?i.map(l=>l?l.val:null).join(""):null}static expandFormat(e,t={}){return j1(sn.parseFormat(e),yt.fromObject(t)).map(l=>l.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?fr(this).weekYear:NaN}get weekNumber(){return this.isValid?fr(this).weekNumber:NaN}get weekday(){return this.isValid?fr(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ur(this).weekday:NaN}get localWeekNumber(){return this.isValid?ur(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ur(this).weekYear:NaN}get ordinal(){return this.isValid?or(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ns.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ns.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ns.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ns.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,i=Uo(this.c),l=this.zone.offset(i-e),s=this.zone.offset(i+e),o=this.zone.offset(i-l*t),r=this.zone.offset(i-s*t);if(o===r)return[this];const a=i-o*t,f=i-r*t,u=Rs(a,o),c=Rs(f,r);return u.hour===c.hour&&u.minute===c.minute&&u.second===c.second&&u.millisecond===c.millisecond?[Fi(this,{ts:a}),Fi(this,{ts:f})]:[this]}get isInLeapYear(){return ws(this.year)}get daysInMonth(){return So(this.year,this.month)}get daysInYear(){return this.isValid?vl(this.year):NaN}get weeksInWeekYear(){return this.isValid?rs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?rs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:l}=sn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:l}}toUTC(e=0,t={}){return this.setZone(cn.instance(e),t)}toLocal(){return this.setZone(jt.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=$i(e,jt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let l=this.ts;if(t||i){const s=e.offset(this.ts),o=this.toObject();[l]=ao(o,s,e)}return Fi(this,{ts:l,zone:e})}else return He.invalid(Fs(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const l=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Fi(this,{loc:l})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=$o(e,Pf),{minDaysInFirstWeek:i,startOfWeek:l}=vf(t,this.loc),s=!Ye(t.weekYear)||!Ye(t.weekNumber)||!Ye(t.weekday),o=!Ye(t.ordinal),r=!Ye(t.year),a=!Ye(t.month)||!Ye(t.day),f=r||a,u=t.weekYear||t.weekNumber;if((f||o)&&u)throw new bl("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new bl("Can't mix ordinal dates with month/day");let c;s?c=kf({...wo(this.c,i,l),...t},i,l):Ye(t.ordinal)?(c={...this.toObject(),...t},Ye(t.day)&&(c.day=Math.min(So(c.year,c.month),c.day))):c=yf({...or(this.c),...t});const[d,m]=ao(c,this.o,this.zone);return Fi(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e);return Fi(this,Lf(this,t))}minus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e).negate();return Fi(this,Lf(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const i={},l=ot.normalizeUnit(e);switch(l){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(l==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(i.weekNumber=this.weekNumber-1),i.weekday=s}else i.weekday=1;if(l==="quarters"){const s=Math.ceil(this.month/3);i.month=(s-1)*3+1}return this.set(i)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?sn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ar}toLocaleString(e=vo,t={}){return this.isValid?sn.create(this.loc.clone(t),e).formatDateTime(this):ar}toLocaleParts(e={}){return this.isValid?sn.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:i=!1,includeOffset:l=!0,extendedZone:s=!1}={}){if(!this.isValid)return null;const o=e==="extended";let r=cr(this,o);return r+="T",r+=Nf(this,o,t,i,l,s),r}toISODate({format:e="extended"}={}){return this.isValid?cr(this,e==="extended"):null}toISOWeekDate(){return qs(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:i=!0,includePrefix:l=!1,extendedZone:s=!1,format:o="extended"}={}){return this.isValid?(l?"T":"")+Nf(this,o==="extended",t,e,i,s):null}toRFC2822(){return qs(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return qs(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?cr(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:i=!0}={}){let l="HH:mm:ss.SSS";return(t||e)&&(i&&(l+=" "),t?l+="z":e&&(l+="ZZ")),qs(this,l,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ar}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",i={}){if(!this.isValid||!e.isValid)return ot.invalid("created by diffing an invalid DateTime");const l={locale:this.locale,numberingSystem:this.numberingSystem,...i},s=Mk(t).map(ot.normalizeUnit),o=e.valueOf()>this.valueOf(),r=o?this:e,a=o?e:this,f=Ay(r,a,s,l);return o?f.negate():f}diffNow(e="milliseconds",t={}){return this.diff(He.now(),e,t)}until(e){return this.isValid?Rt.fromDateTimes(this,e):this}hasSame(e,t,i){if(!this.isValid)return!1;const l=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,i)<=l&&l<=s.endOf(t,i)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||He.fromObject({},{zone:this.zone}),i=e.padding?this<t?-e.padding:e.padding:0;let l=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(l=e.unit,s=void 0),Rf(t,this.plus(i),{...e,numeric:"always",units:l,unit:s})}toRelativeCalendar(e={}){return this.isValid?Rf(e.base||He.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(He.isDateTime))throw new hn("min requires all arguments be DateTimes");return wf(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(He.isDateTime))throw new hn("max requires all arguments be DateTimes");return wf(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:l=null,numberingSystem:s=null}=i,o=yt.fromOpts({locale:l,numberingSystem:s,defaultToEN:!0});return H1(o,e,t)}static fromStringExplain(e,t,i={}){return He.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return vo}static get DATE_MED(){return Kg}static get DATE_MED_WITH_WEEKDAY(){return ik}static get DATE_FULL(){return Jg}static get DATE_HUGE(){return Zg}static get TIME_SIMPLE(){return Gg}static get TIME_WITH_SECONDS(){return Xg}static get TIME_WITH_SHORT_OFFSET(){return Qg}static get TIME_WITH_LONG_OFFSET(){return xg}static get TIME_24_SIMPLE(){return e1}static get TIME_24_WITH_SECONDS(){return t1}static get TIME_24_WITH_SHORT_OFFSET(){return n1}static get TIME_24_WITH_LONG_OFFSET(){return i1}static get DATETIME_SHORT(){return l1}static get DATETIME_SHORT_WITH_SECONDS(){return s1}static get DATETIME_MED(){return o1}static get DATETIME_MED_WITH_SECONDS(){return r1}static get DATETIME_MED_WITH_WEEKDAY(){return lk}static get DATETIME_FULL(){return a1}static get DATETIME_FULL_WITH_SECONDS(){return f1}static get DATETIME_HUGE(){return u1}static get DATETIME_HUGE_WITH_SECONDS(){return c1}}function Hl(n){if(He.isDateTime(n))return n;if(n&&n.valueOf&&Zi(n.valueOf()))return He.fromJSDate(n);if(n&&typeof n=="object")return He.fromObject(n);throw new hn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const xy=[".jpg",".jpeg",".png",".svg",".gif",".jfif",".webp",".avif"],ev=[".mp4",".avi",".mov",".3gp",".wmv"],tv=[".aa",".aac",".m4v",".mp3",".ogg",".oga",".mogg",".amr"],nv=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odp",".odt",".ods",".txt"],W1=[{level:-4,label:"DEBUG",class:""},{level:0,label:"INFO",class:"label-success"},{level:4,label:"WARN",class:"label-warning"},{level:8,label:"ERROR",class:"label-danger"}];class H{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static clone(e){return typeof structuredClone<"u"?structuredClone(e):JSON.parse(JSON.stringify(e))}static zeroValue(e){switch(typeof e){case"string":return"";case"number":return 0;case"boolean":return!1;case"object":return e===null?null:Array.isArray(e)?[]:{};case"undefined":return;default:return null}}static isEmpty(e){return e===""||e===null||e==="00000000-0000-0000-0000-000000000000"||e==="0001-01-01 00:00:00.000Z"||e==="0001-01-01"||typeof e>"u"||Array.isArray(e)&&e.length===0||H.isObject(e)&&Object.keys(e).length===0}static isInput(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return t==="input"||t==="select"||t==="textarea"||(e==null?void 0:e.isContentEditable)}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return H.isInput(e)||t==="button"||t==="a"||t==="details"||(e==null?void 0:e.tabIndex)>=0}static hasNonEmptyProps(e){for(let t in e)if(!H.isEmpty(e[t]))return!0;return!1}static toArray(e,t=!1){return Array.isArray(e)?e.slice():(t||!H.isEmpty(e))&&typeof e<"u"?[e]:[]}static inArray(e,t){e=Array.isArray(e)?e:[];for(let i=e.length-1;i>=0;i--)if(e[i]==t)return!0;return!1}static removeByValue(e,t){e=Array.isArray(e)?e:[];for(let i=e.length-1;i>=0;i--)if(e[i]==t){e.splice(i,1);break}}static pushUnique(e,t){H.inArray(e,t)||e.push(t)}static findByKey(e,t,i){e=Array.isArray(e)?e:[];for(let l in e)if(e[l][t]==i)return e[l];return null}static groupByKey(e,t){e=Array.isArray(e)?e:[];const i={};for(let l in e)i[e[l][t]]=i[e[l][t]]||[],i[e[l][t]].push(e[l]);return i}static removeByKey(e,t,i){for(let l in e)if(e[l][t]==i){e.splice(l,1);break}}static pushOrReplaceByKey(e,t,i="id"){for(let l=e.length-1;l>=0;l--)if(e[l][i]==t[i]){e[l]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){e=Array.isArray(e)?e:[];const i={};for(const l of e)i[l[t]]=l;return Object.values(i)}static filterRedactedProps(e,t="******"){const i=JSON.parse(JSON.stringify(e||{}));for(let l in i)typeof i[l]=="object"&&i[l]!==null?i[l]=H.filterRedactedProps(i[l],t):i[l]===t&&delete i[l];return i}static getNestedVal(e,t,i=null,l="."){let s=e||{},o=(t||"").split(l);for(const r of o){if(!H.isObject(s)&&!Array.isArray(s)||typeof s[r]>"u")return i;s=s[r]}return s}static setByPath(e,t,i,l="."){if(e===null||typeof e!="object"){console.warn("setByPath: data not an object or array.");return}let s=e,o=t.split(l),r=o.pop();for(const a of o)(!H.isObject(s)&&!Array.isArray(s)||!H.isObject(s[a])&&!Array.isArray(s[a]))&&(s[a]={}),s=s[a];s[r]=i}static deleteByPath(e,t,i="."){let l=e||{},s=(t||"").split(i),o=s.pop();for(const r of s)(!H.isObject(l)&&!Array.isArray(l)||!H.isObject(l[r])&&!Array.isArray(l[r]))&&(l[r]={}),l=l[r];Array.isArray(l)?l.splice(o,1):H.isObject(l)&&delete l[o],s.length>0&&(Array.isArray(l)&&!l.length||H.isObject(l)&&!Object.keys(l).length)&&(Array.isArray(e)&&e.length>0||H.isObject(e)&&Object.keys(e).length>0)&&H.deleteByPath(e,s.join(i),i)}static randomString(e=10){let t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let l=0;l<e;l++)t+=i.charAt(Math.floor(Math.random()*i.length));return t}static randomSecret(e=15){if(typeof crypto>"u")return H.randomString(e);const t=new Uint8Array(e);crypto.getRandomValues(t);const i="-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";let l="";for(let s=0;s<e;s++)l+=i.charAt(t[s]%i.length);return l}static sentenize(e,t=!0){if(typeof e!="string")return"";if(e=e.trim().split("_").join(" "),e==="")return e;if(e=e[0].toUpperCase()+e.substring(1),t){let i=e[e.length-1];i!=="."&&i!=="?"&&i!=="!"&&(e+=".")}return e}static trimQuotedValue(e){return typeof e=="string"&&(e[0]=='"'||e[0]=="'"||e[0]=="`")&&e[0]==e[e.length-1]?e.slice(1,-1):e}static plainText(e){return e?(new DOMParser().parseFromString(e,"text/html").body.innerText||"").trim():""}static truncate(e,t=150,i=!0){return e=""+e,e.length<=t?e:e.substring(0,t)+(i?"...":"")}static truncateObject(e){const t={};for(let i in e){let l=e[i];typeof l=="string"&&(l=H.truncate(l,150,!0)),t[i]=l}return t}static slugify(e,t="_",i=[".","=","-"]){if(e==="")return"";const l={a:/а|à|á|å|â/gi,b:/б/gi,c:/ц|ç/gi,d:/д/gi,e:/е|è|é|ê|ẽ|ë/gi,f:/ф/gi,g:/г/gi,h:/х/gi,i:/й|и|ì|í|î/gi,j:/ж/gi,k:/к/gi,l:/л/gi,m:/м/gi,n:/н|ñ/gi,o:/о|ò|ó|ô|ø/gi,p:/п/gi,q:/я/gi,r:/р/gi,s:/с/gi,t:/т/gi,u:/ю|ù|ú|ů|û/gi,v:/в/gi,w:/в/gi,x:/ь/gi,y:/ъ/gi,z:/з/gi,ae:/ä|æ/gi,oe:/ö/gi,ue:/ü/gi,Ae:/Ä/gi,Ue:/Ü/gi,Oe:/Ö/gi,ss:/ß/gi,and:/&/gi};for(let s in l)e=e.replace(l[s],s);return e.replace(new RegExp("["+i.join("")+"]","g")," ").replace(/[^\w\ ]/gi,"").replace(/\s+/g,t)}static escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}static splitNonEmpty(e,t=","){const i=[],l=(e||"").replaceAll("\\"+t,"{_PB_ESCAPED_}").split(t).map(s=>s.replaceAll("{_PB_ESCAPED_}",t));for(let s of l)s=s.trim(),H.isEmpty(s)||i.push(s);return i}static joinNonEmpty(e,t=", "){e=e||[];const i=[],l=t.length>1?t.trim():t;for(let s of e)s=typeof s=="string"?s.trim():"",H.isEmpty(s)||i.push(s.replaceAll(l,"\\"+l));return i.join(t)}static getInitials(e){if(e=(e||"").split("@")[0].trim(),e.length<=2)return e.toUpperCase();const t=e.split(/[\.\_\-\ ]/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e[0].toUpperCase()}static formattedFileSize(e){const t=e?Math.floor(Math.log(e)/Math.log(1024)):0;return(e/Math.pow(1024,t)).toFixed(2)*1+" "+["B","KB","MB","GB","TB"][t]}static getDateTime(e){if(typeof e=="string"){const t={19:"yyyy-MM-dd HH:mm:ss",23:"yyyy-MM-dd HH:mm:ss.SSS",20:"yyyy-MM-dd HH:mm:ss'Z'",24:"yyyy-MM-dd HH:mm:ss.SSS'Z'"},i=t[e.length]||t[19];return He.fromFormat(e,i,{zone:"UTC"})}return He.fromJSDate(e)}static formatToUTCDate(e,t="yyyy-MM-dd HH:mm:ss"){return H.getDateTime(e).toUTC().toFormat(t)}static formatToLocalDate(e,t="yyyy-MM-dd HH:mm:ss"){return H.getDateTime(e).toLocal().toFormat(t)}static async copyToClipboard(e){var t;if(e=""+e,!(!e.length||!((t=window==null?void 0:window.navigator)!=null&&t.clipboard)))return window.navigator.clipboard.writeText(e).catch(i=>{console.warn("Failed to copy.",i)})}static download(e,t){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download",t),i.setAttribute("target","_blank"),i.click(),i.remove()}static downloadJson(e,t){t=t.endsWith(".json")?t:t+".json";const i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),l=window.URL.createObjectURL(i);H.download(l,t)}static getJWTPayload(e){const t=(e||"").split(".")[1]||"";if(t==="")return{};try{const i=decodeURIComponent(atob(t));return JSON.parse(i)||{}}catch(i){console.warn("Failed to parse JWT payload data.",i)}return{}}static hasImageExtension(e){return e=e||"",!!xy.find(t=>e.toLowerCase().endsWith(t))}static hasVideoExtension(e){return e=e||"",!!ev.find(t=>e.toLowerCase().endsWith(t))}static hasAudioExtension(e){return e=e||"",!!tv.find(t=>e.toLowerCase().endsWith(t))}static hasDocumentExtension(e){return e=e||"",!!nv.find(t=>e.toLowerCase().endsWith(t))}static getFileType(e){return H.hasImageExtension(e)?"image":H.hasDocumentExtension(e)?"document":H.hasVideoExtension(e)?"video":H.hasAudioExtension(e)?"audio":"file"}static generateThumb(e,t=100,i=100){return new Promise(l=>{let s=new FileReader;s.onload=function(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),f=a.getContext("2d"),u=r.width,c=r.height;return a.width=t,a.height=i,f.drawImage(r,u>c?(u-c)/2:0,0,u>c?c:u,u>c?c:u,0,0,t,i),l(a.toDataURL(e.type))},r.src=o.target.result},s.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(H.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const l of i)H.addValueToFormData(e,t,l);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):H.isObject(i)?e.append(t,JSON.stringify(i)):e.append(t,""+i)}static dummyCollectionRecord(e){var a,f,u,c,d,m,h;const t=(e==null?void 0:e.schema)||[],i=(e==null?void 0:e.type)==="auth",l=(e==null?void 0:e.type)==="view",s={id:"RECORD_ID",collectionId:e==null?void 0:e.id,collectionName:e==null?void 0:e.name};i&&(s.username="username123",s.verified=!1,s.emailVisibility=!0,s.email="test@example.com"),(!l||H.extractColumnsFromQuery((a=e==null?void 0:e.options)==null?void 0:a.query).includes("created"))&&(s.created="2022-01-01 01:00:00.123Z"),(!l||H.extractColumnsFromQuery((f=e==null?void 0:e.options)==null?void 0:f.query).includes("updated"))&&(s.updated="2022-01-01 23:59:59.456Z");for(const _ of t){let g=null;_.type==="number"?g=123:_.type==="date"?g="2022-01-01 10:00:00.123Z":_.type==="bool"?g=!0:_.type==="email"?g="test@example.com":_.type==="url"?g="https://example.com":_.type==="json"?g="JSON":_.type==="file"?(g="filename.jpg",((u=_.options)==null?void 0:u.maxSelect)!==1&&(g=[g])):_.type==="select"?(g=(d=(c=_.options)==null?void 0:c.values)==null?void 0:d[0],((m=_.options)==null?void 0:m.maxSelect)!==1&&(g=[g])):_.type==="relation"?(g="RELATION_RECORD_ID",((h=_.options)==null?void 0:h.maxSelect)!==1&&(g=[g])):g="test",s[_.name]=g}return s}static dummyCollectionSchemaData(e){var l,s,o,r;const t=(e==null?void 0:e.schema)||[],i={};for(const a of t){let f=null;if(a.type==="number")f=123;else if(a.type==="date")f="2022-01-01 10:00:00.123Z";else if(a.type==="bool")f=!0;else if(a.type==="email")f="test@example.com";else if(a.type==="url")f="https://example.com";else if(a.type==="json")f="JSON";else{if(a.type==="file")continue;a.type==="select"?(f=(s=(l=a.options)==null?void 0:l.values)==null?void 0:s[0],((o=a.options)==null?void 0:o.maxSelect)!==1&&(f=[f])):a.type==="relation"?(f="RELATION_RECORD_ID",((r=a.options)==null?void 0:r.maxSelect)!==1&&(f=[f])):f="test"}i[a.name]=f}return i}static getCollectionTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"auth":return"ri-group-line";case"view":return"ri-table-line";default:return"ri-folder-2-line"}}static getFieldTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"primary":return"ri-key-line";case"text":return"ri-text";case"number":return"ri-hashtag";case"date":return"ri-calendar-line";case"bool":return"ri-toggle-line";case"email":return"ri-mail-line";case"url":return"ri-link";case"editor":return"ri-edit-2-line";case"select":return"ri-list-check";case"json":return"ri-braces-line";case"file":return"ri-image-line";case"relation":return"ri-mind-map";case"user":return"ri-user-line";default:return"ri-star-s-line"}}static getFieldValueType(e){var t;switch(e==null?void 0:e.type){case"bool":return"Boolean";case"number":return"Number";case"file":return"File";case"select":case"relation":return((t=e==null?void 0:e.options)==null?void 0:t.maxSelect)===1?"String":"Array<String>";default:return"String"}}static zeroDefaultStr(e){var t;return(e==null?void 0:e.type)==="number"?"0":(e==null?void 0:e.type)==="bool"?"false":(e==null?void 0:e.type)==="json"?'null, "", [], {}':["select","relation","file"].includes(e==null?void 0:e.type)&&((t=e==null?void 0:e.options)==null?void 0:t.maxSelect)!=1?"[]":'""'}static getApiExampleUrl(e){return(window.location.href.substring(0,window.location.href.indexOf("/_"))||e||"/").replace("//localhost","//127.0.0.1")}static hasCollectionChanges(e,t,i=!1){if(e=e||{},t=t||{},e.id!=t.id)return!0;for(let f in e)if(f!=="schema"&&JSON.stringify(e[f])!==JSON.stringify(t[f]))return!0;const l=Array.isArray(e.schema)?e.schema:[],s=Array.isArray(t.schema)?t.schema:[],o=l.filter(f=>(f==null?void 0:f.id)&&!H.findByKey(s,"id",f.id)),r=s.filter(f=>(f==null?void 0:f.id)&&!H.findByKey(l,"id",f.id)),a=s.filter(f=>{const u=H.isObject(f)&&H.findByKey(l,"id",f.id);if(!u)return!1;for(let c in u)if(JSON.stringify(f[c])!=JSON.stringify(u[c]))return!0;return!1});return!!(r.length||a.length||i&&o.length)}static sortCollections(e=[]){const t=[],i=[],l=[];for(const o of e)o.type==="auth"?t.push(o):o.type==="base"?i.push(o):l.push(o);function s(o,r){return o.name>r.name?1:o.name<r.name?-1:0}return[].concat(t.sort(s),i.sort(s),l.sort(s))}static yieldToMain(){return new Promise(e=>{setTimeout(e,0)})}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static defaultEditorOptions(){const e=["DIV","P","A","EM","B","STRONG","H1","H2","H3","H4","H5","H6","TABLE","TR","TD","TH","TBODY","THEAD","TFOOT","BR","HR","Q","SUP","SUB","DEL","IMG","OL","UL","LI","CODE"];function t(l){let s=l.parentNode;for(;l.firstChild;)s.insertBefore(l.firstChild,l);s.removeChild(l)}function i(l){if(l){for(const s of l.children)i(s);e.includes(l.tagName)?(l.removeAttribute("style"),l.removeAttribute("class")):t(l)}}return{branding:!1,promotion:!1,menubar:!1,min_height:270,height:270,max_height:700,autoresize_bottom_margin:30,skin:"pocketbase",content_style:"body { font-size: 14px }",plugins:["autoresize","autolink","lists","link","image","searchreplace","fullscreen","media","table","code","codesample","directionality"],codesample_global_prismjs:!0,codesample_languages:[{text:"HTML/XML",value:"markup"},{text:"CSS",value:"css"},{text:"SQL",value:"sql"},{text:"JavaScript",value:"javascript"},{text:"Go",value:"go"},{text:"Dart",value:"dart"},{text:"Zig",value:"zig"},{text:"Rust",value:"rust"},{text:"Lua",value:"lua"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"},{text:"Markdown",value:"markdown"},{text:"Swift",value:"swift"},{text:"Kotlin",value:"kotlin"},{text:"Elixir",value:"elixir"},{text:"Scala",value:"scala"},{text:"Julia",value:"julia"},{text:"Haskell",value:"haskell"}],toolbar:"styles | alignleft aligncenter alignright | bold italic forecolor backcolor | bullist numlist | link image_picker table codesample direction | code fullscreen",paste_postprocess:(l,s)=>{i(s.node)},file_picker_types:"image",file_picker_callback:(l,s,o)=>{const r=document.createElement("input");r.setAttribute("type","file"),r.setAttribute("accept","image/*"),r.addEventListener("change",a=>{const f=a.target.files[0],u=new FileReader;u.addEventListener("load",()=>{if(!tinymce)return;const c="blobid"+new Date().getTime(),d=tinymce.activeEditor.editorUpload.blobCache,m=u.result.split(",")[1],h=d.create(c,f,m);d.add(h),l(h.blobUri(),{title:f.name})}),u.readAsDataURL(f)}),r.click()},setup:l=>{l.on("keydown",o=>{(o.ctrlKey||o.metaKey)&&o.code=="KeyS"&&l.formElement&&(o.preventDefault(),o.stopPropagation(),l.formElement.dispatchEvent(new KeyboardEvent("keydown",o)))});const s="tinymce_last_direction";l.on("init",()=>{var r;const o=(r=window==null?void 0:window.localStorage)==null?void 0:r.getItem(s);!l.isDirty()&&l.getContent()==""&&o=="rtl"&&l.execCommand("mceDirectionRTL")}),l.ui.registry.addMenuButton("direction",{icon:"visualchars",fetch:o=>{o([{type:"menuitem",text:"LTR content",icon:"ltr",onAction:()=>{var a;(a=window==null?void 0:window.localStorage)==null||a.setItem(s,"ltr"),l.execCommand("mceDirectionLTR")}},{type:"menuitem",text:"RTL content",icon:"rtl",onAction:()=>{var a;(a=window==null?void 0:window.localStorage)==null||a.setItem(s,"rtl"),l.execCommand("mceDirectionRTL")}}])}}),l.ui.registry.addMenuButton("image_picker",{icon:"image",fetch:o=>{o([{type:"menuitem",text:"From collection",icon:"gallery",onAction:()=>{l.dispatch("collections_file_picker",{})}},{type:"menuitem",text:"Inline",icon:"browse",onAction:()=>{l.execCommand("mceImage")}}])}})}}}static displayValue(e,t,i="N/A"){e=e||{},t=t||[];let l=[];for(const o of t){let r=e[o];typeof r>"u"||(r=H.stringifyValue(r,i),l.push(r))}if(l.length>0)return l.join(", ");const s=["title","name","slug","email","username","nickname","label","heading","message","key","identifier","id"];for(const o of s){let r=H.stringifyValue(e[o],"");if(r)return r}return i}static stringifyValue(e,t="N/A",i=150){if(H.isEmpty(e))return t;if(typeof e=="number")return""+e;if(typeof e=="boolean")return e?"True":"False";if(typeof e=="string")return e=e.indexOf("<")>=0?H.plainText(e):e,H.truncate(e,i)||t;if(Array.isArray(e)&&typeof e[0]!="object")return H.truncate(e.join(","),i);if(typeof e=="object")try{return H.truncate(JSON.stringify(e),i)||t}catch{return t}return e}static extractColumnsFromQuery(e){var o;const t="__GROUP__";e=(e||"").replace(/\([\s\S]+?\)/gm,t).replace(/[\t\r\n]|(?:\s\s)+/g," ");const i=e.match(/select\s+([\s\S]+)\s+from/),l=((o=i==null?void 0:i[1])==null?void 0:o.split(","))||[],s=[];for(let r of l){const a=r.trim().split(" ").pop();a!=""&&a!=t&&s.push(a.replace(/[\'\"\`\[\]\s]/g,""))}return s}static getAllCollectionIdentifiers(e,t=""){if(!e)return[];let i=[t+"id"];if(e.type==="view")for(let s of H.extractColumnsFromQuery(e.options.query))H.pushUnique(i,t+s);else e.type==="auth"?(i.push(t+"username"),i.push(t+"email"),i.push(t+"emailVisibility"),i.push(t+"verified"),i.push(t+"created"),i.push(t+"updated")):(i.push(t+"created"),i.push(t+"updated"));const l=e.schema||[];for(const s of l)H.pushUnique(i,t+s.name);return i}static getCollectionAutocompleteKeys(e,t,i="",l=0){var r,a,f;let s=e.find(u=>u.name==t||u.id==t);if(!s||l>=4)return[];s.schema=s.schema||[];let o=H.getAllCollectionIdentifiers(s,i);for(const u of s.schema){const c=i+u.name;if(u.type=="relation"&&((r=u.options)!=null&&r.collectionId)){const d=H.getCollectionAutocompleteKeys(e,u.options.collectionId,c+".",l+1);d.length&&(o=o.concat(d))}((a=u.options)==null?void 0:a.maxSelect)!=1&&["select","file","relation"].includes(u.type)&&(o.push(c+":each"),o.push(c+":length"))}for(const u of e){u.schema=u.schema||[];for(const c of u.schema)if(c.type=="relation"&&((f=c.options)==null?void 0:f.collectionId)==s.id){const d=i+u.name+"_via_"+c.name,m=H.getCollectionAutocompleteKeys(e,u.id,d+".",l+2);m.length&&(o=o.concat(m))}}return o}static getCollectionJoinAutocompleteKeys(e){const t=[];for(const i of e){const l="@collection."+i.name+".",s=H.getCollectionAutocompleteKeys(e,i.name,l);for(const o of s)t.push(o)}return t}static getRequestAutocompleteKeys(e,t){const i=[];i.push("@request.context"),i.push("@request.method"),i.push("@request.query."),i.push("@request.data."),i.push("@request.headers."),i.push("@request.auth.id"),i.push("@request.auth.collectionId"),i.push("@request.auth.collectionName"),i.push("@request.auth.verified"),i.push("@request.auth.username"),i.push("@request.auth.email"),i.push("@request.auth.emailVisibility"),i.push("@request.auth.created"),i.push("@request.auth.updated");const l=e.filter(s=>s.type==="auth");for(const s of l){const o=H.getCollectionAutocompleteKeys(e,s.id,"@request.auth.");for(const r of o)H.pushUnique(i,r)}if(t){const s=["created","updated"],o=H.getCollectionAutocompleteKeys(e,t,"@request.data.");for(const r of o){i.push(r);const a=r.split(".");a.length===3&&a[2].indexOf(":")===-1&&!s.includes(a[2])&&i.push(r+":isset")}}return i}static parseIndex(e){var a,f,u,c,d;const t={unique:!1,optional:!1,schemaName:"",indexName:"",tableName:"",columns:[],where:""},l=/create\s+(unique\s+)?\s*index\s*(if\s+not\s+exists\s+)?(\S*)\s+on\s+(\S*)\s*\(([\s\S]*)\)(?:\s*where\s+([\s\S]*))?/gmi.exec((e||"").trim());if((l==null?void 0:l.length)!=7)return t;const s=/^[\"\'\`\[\{}]|[\"\'\`\]\}]$/gm;t.unique=((a=l[1])==null?void 0:a.trim().toLowerCase())==="unique",t.optional=!H.isEmpty((f=l[2])==null?void 0:f.trim());const o=(l[3]||"").split(".");o.length==2?(t.schemaName=o[0].replace(s,""),t.indexName=o[1].replace(s,"")):(t.schemaName="",t.indexName=o[0].replace(s,"")),t.tableName=(l[4]||"").replace(s,"");const r=(l[5]||"").replace(/,(?=[^\(]*\))/gmi,"{PB_TEMP}").split(",");for(let m of r){m=m.trim().replaceAll("{PB_TEMP}",",");const _=/^([\s\S]+?)(?:\s+collate\s+([\w]+))?(?:\s+(asc|desc))?$/gmi.exec(m);if((_==null?void 0:_.length)!=4)continue;const g=(c=(u=_[1])==null?void 0:u.trim())==null?void 0:c.replace(s,"");g&&t.columns.push({name:g,collate:_[2]||"",sort:((d=_[3])==null?void 0:d.toUpperCase())||""})}return t.where=l[6]||"",t}static buildIndex(e){let t="CREATE ";e.unique&&(t+="UNIQUE "),t+="INDEX ",e.optional&&(t+="IF NOT EXISTS "),e.schemaName&&(t+=`\`${e.schemaName}\`.`),t+=`\`${e.indexName||"idx_"+H.randomString(7)}\` `,t+=`ON \`${e.tableName}\` (`;const i=e.columns.filter(l=>!!(l!=null&&l.name));return i.length>1&&(t+=`
`),t+=i.map(l=>{let s="";return l.name.includes("(")||l.name.includes(" ")?s+=l.name:s+="`"+l.name+"`",l.collate&&(s+=" COLLATE "+l.collate),l.sort&&(s+=" "+l.sort.toUpperCase()),s}).join(`,
`),i.length>1&&(t+=`
`),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const i=H.parseIndex(e);return i.tableName=t,H.buildIndex(i)}static replaceIndexColumn(e,t,i){if(t===i)return e;const l=H.parseIndex(e);let s=!1;for(let o of l.columns)o.name===t&&(o.name=i,s=!0);return s?H.buildIndex(l):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const i=["=","!=","~","!~",">",">=","<","<="];for(const l of i)if(e.includes(l))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(l=>`${l}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return H.normalizeSearchFilter(e,["level","message","data"].concat(t))}static initCollection(e){return Object.assign({id:"",created:"",updated:"",name:"",type:"base",system:!1,listRule:null,viewRule:null,createRule:null,updateRule:null,deleteRule:null,schema:[],indexes:[],options:{}},e)}static initSchemaField(e){return Object.assign({id:"",name:"",type:"text",system:!1,required:!1,options:{}},e)}static triggerResize(){window.dispatchEvent(new Event("resize"))}static getHashQueryParams(){let e="";const t=window.location.hash.indexOf("?");return t>-1&&(e=window.location.hash.substring(t+1)),Object.fromEntries(new URLSearchParams(e))}static replaceHashQueryParams(e){e=e||{};let t="",i=window.location.hash;const l=i.indexOf("?");l>-1&&(t=i.substring(l+1),i=i.substring(0,l));const s=new URLSearchParams(t);for(let a in e){const f=e[a];f===null?s.delete(a):s.set(a,f)}t=s.toString(),t!=""&&(i+="?"+t);let o=window.location.href;const r=o.indexOf("#");r>-1&&(o=o.substring(0,r)),window.location.replace(o+i)}}const Ko=On([]);function To(n,e=4e3){return Jo(n,"info",e)}function Nt(n,e=3e3){return Jo(n,"success",e)}function li(n,e=4500){return Jo(n,"error",e)}function iv(n,e=4500){return Jo(n,"warning",e)}function Jo(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{Y1(i)},t)};Ko.update(l=>($a(l,i.message),H.pushOrReplaceByKey(l,i,"message"),l))}function Y1(n){Ko.update(e=>($a(e,n),e))}function Sa(){Ko.update(n=>{for(let e of n)$a(n,e);return[]})}function $a(n,e){let t;typeof e=="string"?t=H.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),H.removeByKey(n,"message",t.message))}const hi=On({});function Gt(n){hi.set(n||{})}function si(n){hi.update(e=>(H.deleteByPath(e,n),e))}const Ta=On({});function Wr(n){Ta.set(n||{})}const qn=On([]),Jn=On({}),Co=On(!1),K1=On({});let Xl;typeof BroadcastChannel<"u"&&(Xl=new BroadcastChannel("collections"),Xl.onmessage=()=>{var n;Z1((n=Og(Jn))==null?void 0:n.id)});function J1(){Xl==null||Xl.postMessage("reload")}function lv(n){qn.update(e=>{const t=H.findByKey(e,"id",n);return t?Jn.set(t):e.length&&Jn.set(e[0]),e})}function sv(n){Jn.update(e=>H.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),qn.update(e=>(H.pushOrReplaceByKey(e,n,"id"),Ca(),J1(),H.sortCollections(e)))}function ov(n){qn.update(e=>(H.removeByKey(e,"id",n.id),Jn.update(t=>t.id===n.id?e[0]:t),Ca(),J1(),e))}async function Z1(n=null){Co.set(!0);try{let e=await fe.collections.getFullList(200,{sort:"+name"});e=H.sortCollections(e),qn.set(e);const t=n&&H.findByKey(e,"id",n);t?Jn.set(t):e.length&&Jn.set(e[0]),Ca()}catch(e){fe.error(e)}Co.set(!1)}function Ca(){K1.update(n=>(qn.update(e=>{var t;for(let i of e)n[i.id]=!!((t=i.schema)!=null&&t.find(l=>{var s;return l.type=="file"&&((s=l.options)==null?void 0:s.protected)}));return e}),n))}const dr="pb_admin_file_token";zo.prototype.logout=function(n=!0){this.authStore.clear(),n&&nl("/login")};zo.prototype.error=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,l=(n==null?void 0:n.data)||{},s=l.message||n.message||t;if(e&&s&&li(s),H.isEmpty(l.data)||Gt(l.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),nl("/")};zo.prototype.getAdminFileToken=async function(n=""){let e=!0;if(n){const i=Og(K1);e=typeof i[n]<"u"?i[n]:!0}if(!e)return"";let t=localStorage.getItem(dr)||"";return(!t||pa(t,10))&&(t&&localStorage.removeItem(dr),this._adminFileTokenRequest||(this._adminFileTokenRequest=this.files.getToken()),t=await this._adminFileTokenRequest,localStorage.setItem(dr,t),this._adminFileTokenRequest=null),t};class rv extends Bg{save(e,t){super.save(e,t),t&&!t.collectionId&&Wr(t)}clear(){super.clear(),Wr(null)}}const fo=new zo("../",new rv("pb_admin_auth"));fo.authStore.model&&!fo.authStore.model.collectionId&&Wr(fo.authStore.model);const fe=fo,av=n=>({}),jf=n=>({});function fv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;const h=n[3].default,_=St(h,n,n[2],null),g=n[3].footer,v=St(g,n,n[2],jf);return{c(){e=b("div"),t=b("main"),_&&_.c(),i=D(),l=b("footer"),v&&v.c(),s=D(),o=b("a"),o.innerHTML='<i class="ri-book-open-line txt-sm"></i> <span class="txt">Docs</span>',r=D(),a=b("span"),a.textContent="|",f=D(),u=b("a"),c=b("span"),c.textContent="PocketBase v0.22.9",p(t,"class","page-content"),p(o,"href","https://pocketbase.io/docs/"),p(o,"target","_blank"),p(o,"rel","noopener noreferrer"),p(a,"class","delimiter"),p(c,"class","txt"),p(u,"href","https://github.com/pocketbase/pocketbase/releases"),p(u,"target","_blank"),p(u,"rel","noopener noreferrer"),p(u,"title","Releases"),p(l,"class","page-footer"),p(e,"class",d="page-wrapper "+n[1]),ee(e,"center-content",n[0])},m($,C){S($,e,C),y(e,t),_&&_.m(t,null),y(e,i),y(e,l),v&&v.m(l,null),y(l,s),y(l,o),y(l,r),y(l,a),y(l,f),y(l,u),y(u,c),m=!0},p($,[C]){_&&_.p&&(!m||C&4)&&Tt(_,h,$,$[2],m?$t(h,$[2],C,null):Ct($[2]),null),v&&v.p&&(!m||C&4)&&Tt(v,g,$,$[2],m?$t(g,$[2],C,av):Ct($[2]),jf),(!m||C&2&&d!==(d="page-wrapper "+$[1]))&&p(e,"class",d),(!m||C&3)&&ee(e,"center-content",$[0])},i($){m||(I(_,$),I(v,$),m=!0)},o($){L(_,$),L(v,$),m=!1},d($){$&&w(e),_&&_.d($),v&&v.d($)}}}function uv(n,e,t){let{$$slots:i={},$$scope:l}=e,{center:s=!1}=e,{class:o=""}=e;return n.$$set=r=>{"center"in r&&t(0,s=r.center),"class"in r&&t(1,o=r.class),"$$scope"in r&&t(2,l=r.$$scope)},[s,o,l,i]}class kn extends be{constructor(e){super(),ge(this,e,uv,fv,he,{center:0,class:1})}}function Hf(n){let e,t,i;return{c(){e=b("div"),e.innerHTML='<figure class="logo"><img src="./images/logo.svg" alt="PocketBase logo" width="40" height="40"/> <span class="txt">Pocket<strong>Base</strong></span></figure>',t=D(),i=b("div"),p(e,"class","block txt-center m-b-lg"),p(i,"class","clearfix")},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},d(l){l&&(w(e),w(t),w(i))}}}function cv(n){let e,t,i,l=!n[0]&&Hf();const s=n[1].default,o=St(s,n,n[2],null);return{c(){e=b("div"),l&&l.c(),t=D(),o&&o.c(),p(e,"class","wrapper wrapper-sm m-b-xl panel-wrapper svelte-lxxzfu")},m(r,a){S(r,e,a),l&&l.m(e,null),y(e,t),o&&o.m(e,null),i=!0},p(r,a){r[0]?l&&(l.d(1),l=null):l||(l=Hf(),l.c(),l.m(e,t)),o&&o.p&&(!i||a&4)&&Tt(o,s,r,r[2],i?$t(s,r[2],a,null):Ct(r[2]),null)},i(r){i||(I(o,r),i=!0)},o(r){L(o,r),i=!1},d(r){r&&w(e),l&&l.d(),o&&o.d(r)}}}function dv(n){let e,t;return e=new kn({props:{class:"full-page",center:!0,$$slots:{default:[cv]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&5&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function pv(n,e,t){let{$$slots:i={},$$scope:l}=e,{nobranding:s=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,s=o.nobranding),"$$scope"in o&&t(2,l=o.$$scope)},[s,i,l]}class G1 extends be{constructor(e){super(),ge(this,e,pv,dv,he,{nobranding:0})}}function Zo(n){const e=n-1;return e*e*e+1}function as(n,{delay:e=0,duration:t=400,easing:i=bs}={}){const l=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:s=>`opacity: ${s*l}`}}function Rn(n,{delay:e=0,duration:t=400,easing:i=Zo,x:l=0,y:s=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,f=r.transform==="none"?"":r.transform,u=a*(1-o),[c,d]=Xa(l),[m,h]=Xa(s);return{delay:e,duration:t,easing:i,css:(_,g)=>`
transform: ${f} translate(${(1-_)*c}${d}, ${(1-_)*m}${h});
opacity: ${a-u*g}`}}function tt(n,{delay:e=0,duration:t=400,easing:i=Zo,axis:l="y"}={}){const s=getComputedStyle(n),o=+s.opacity,r=l==="y"?"height":"width",a=parseFloat(s[r]),f=l==="y"?["top","bottom"]:["left","right"],u=f.map(v=>`${v[0].toUpperCase()}${v.slice(1)}`),c=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),m=parseFloat(s[`margin${u[0]}`]),h=parseFloat(s[`margin${u[1]}`]),_=parseFloat(s[`border${u[0]}Width`]),g=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:t,easing:i,css:v=>`overflow: hidden;opacity: ${Math.min(v*20,1)*o};${r}: ${v*a}px;padding-${f[0]}: ${v*c}px;padding-${f[1]}: ${v*d}px;margin-${f[0]}: ${v*m}px;margin-${f[1]}: ${v*h}px;border-${f[0]}-width: ${v*_}px;border-${f[1]}-width: ${v*g}px;`}}function Yt(n,{delay:e=0,duration:t=400,easing:i=Zo,start:l=0,opacity:s=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,f=1-l,u=r*(1-s);return{delay:e,duration:t,easing:i,css:(c,d)=>`
transform: ${a} scale(${1-f*d});
opacity: ${r-u*d}
`}}let Yr,Ri;const Kr="app-tooltip";function zf(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Mi(){return Ri=Ri||document.querySelector("."+Kr),Ri||(Ri=document.createElement("div"),Ri.classList.add(Kr),document.body.appendChild(Ri)),Ri}function X1(n,e){let t=Mi();if(!t.classList.contains("active")||!(e!=null&&e.text)){Jr();return}t.textContent=e.text,t.className=Kr+" active",e.class&&t.classList.add(e.class),e.position&&t.classList.add(e.position),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,l=t.offsetWidth,s=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=s.top+s.height/2-i/2,r=s.left-l-a):e.position=="right"?(o=s.top+s.height/2-i/2,r=s.right+a):e.position=="top"?(o=s.top-i-a,r=s.left+s.width/2-l/2):e.position=="top-left"?(o=s.top-i-a,r=s.left):e.position=="top-right"?(o=s.top-i-a,r=s.right-l):e.position=="bottom-left"?(o=s.top+s.height+a,r=s.left):e.position=="bottom-right"?(o=s.top+s.height+a,r=s.right-l):(o=s.top+s.height+a,r=s.left+s.width/2-l/2),r+l>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-l),r=r>=0?r:0,o+i>document.documentElement.clientHeight&&(o=document.documentElement.clientHeight-i),o=o>=0?o:0,t.style.top=o+"px",t.style.left=r+"px"}function Jr(){clearTimeout(Yr),Mi().classList.remove("active"),Mi().activeNode=void 0}function mv(n,e){Mi().activeNode=n,clearTimeout(Yr),Yr=setTimeout(()=>{Mi().classList.add("active"),X1(n,e)},isNaN(e.delay)?0:e.delay)}function Fe(n,e){let t=zf(e);function i(){mv(n,t)}function l(){Jr()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",l),n.addEventListener("blur",l),(t.hideOnClick===!0||t.hideOnClick===null&&H.isFocusable(n))&&n.addEventListener("click",l),Mi(),{update(s){var o,r;t=zf(s),(r=(o=Mi())==null?void 0:o.activeNode)!=null&&r.contains(n)&&X1(n,t)},destroy(){var s,o;(o=(s=Mi())==null?void 0:s.activeNode)!=null&&o.contains(n)&&Jr(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",l),n.removeEventListener("blur",l),n.removeEventListener("click",l)}}}function Vf(n,e,t){const i=n.slice();return i[12]=e[t],i}const hv=n=>({}),Bf=n=>({uniqueId:n[4]});function _v(n){let e,t,i=ce(n[3]),l=[];for(let o=0;o<i.length;o+=1)l[o]=Uf(Vf(n,i,o));const s=o=>L(l[o],1,1,()=>{l[o]=null});return{c(){for(let o=0;o<l.length;o+=1)l[o].c();e=ve()},m(o,r){for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(o,r);S(o,e,r),t=!0},p(o,r){if(r&8){i=ce(o[3]);let a;for(a=0;a<i.length;a+=1){const f=Vf(o,i,a);l[a]?(l[a].p(f,r),I(l[a],1)):(l[a]=Uf(f),l[a].c(),I(l[a],1),l[a].m(e.parentNode,e))}for(se(),a=i.length;a<l.length;a+=1)s(a);oe()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)I(l[r]);t=!0}},o(o){l=l.filter(Boolean);for(let r=0;r<l.length;r+=1)L(l[r]);t=!1},d(o){o&&w(e),rt(l,o)}}}function gv(n){let e,t,i,l,s,o,r;return{c(){e=b("div"),t=b("i"),p(t,"class","ri-error-warning-fill txt-danger"),p(e,"class","form-field-addon inline-error-icon")},m(a,f){S(a,e,f),y(e,t),s=!0,o||(r=$e(i=Fe.call(null,t,{position:"left",text:n[3].map(Oo).join(`
`)})),o=!0)},p(a,f){i&&Ot(i.update)&&f&8&&i.update.call(null,{position:"left",text:a[3].map(Oo).join(`
`)})},i(a){s||(a&&Je(()=>{s&&(l||(l=Re(t,Yt,{duration:150,start:.7},!0)),l.run(1))}),s=!0)},o(a){a&&(l||(l=Re(t,Yt,{duration:150,start:.7},!1)),l.run(0)),s=!1},d(a){a&&w(e),a&&l&&l.end(),o=!1,r()}}}function Uf(n){let e,t,i=Oo(n[12])+"",l,s,o,r;return{c(){e=b("div"),t=b("pre"),l=J(i),s=D(),p(e,"class","help-block help-block-error")},m(a,f){S(a,e,f),y(e,t),y(t,l),y(e,s),r=!0},p(a,f){(!r||f&8)&&i!==(i=Oo(a[12])+"")&&re(l,i)},i(a){r||(a&&Je(()=>{r&&(o||(o=Re(e,tt,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=Re(e,tt,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&w(e),a&&o&&o.end()}}}function bv(n){let e,t,i,l,s,o,r;const a=n[9].default,f=St(a,n,n[8],Bf),u=[gv,_v],c=[];function d(m,h){return m[0]&&m[3].length?0:1}return i=d(n),l=c[i]=u[i](n),{c(){e=b("div"),f&&f.c(),t=D(),l.c(),p(e,"class",n[1]),ee(e,"error",n[3].length)},m(m,h){S(m,e,h),f&&f.m(e,null),y(e,t),c[i].m(e,null),n[11](e),s=!0,o||(r=Z(e,"click",n[10]),o=!0)},p(m,[h]){f&&f.p&&(!s||h&256)&&Tt(f,a,m,m[8],s?$t(a,m[8],h,hv):Ct(m[8]),Bf);let _=i;i=d(m),i===_?c[i].p(m,h):(se(),L(c[_],1,1,()=>{c[_]=null}),oe(),l=c[i],l?l.p(m,h):(l=c[i]=u[i](m),l.c()),I(l,1),l.m(e,null)),(!s||h&2)&&p(e,"class",m[1]),(!s||h&10)&&ee(e,"error",m[3].length)},i(m){s||(I(f,m),I(l),s=!0)},o(m){L(f,m),L(l),s=!1},d(m){m&&w(e),f&&f.d(m),c[i].d(),n[11](null),o=!1,r()}}}const Wf="Invalid value";function Oo(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||Wf:n||Wf}function kv(n,e,t){let i;We(n,hi,_=>t(7,i=_));let{$$slots:l={},$$scope:s}=e;const o="field_"+H.randomString(7);let{name:r=""}=e,{inlineError:a=!1}=e,{class:f=void 0}=e,u,c=[];function d(){si(r)}zt(()=>(u.addEventListener("input",d),u.addEventListener("change",d),()=>{u.removeEventListener("input",d),u.removeEventListener("change",d)}));function m(_){Oe.call(this,n,_)}function h(_){te[_?"unshift":"push"](()=>{u=_,t(2,u)})}return n.$$set=_=>{"name"in _&&t(5,r=_.name),"inlineError"in _&&t(0,a=_.inlineError),"class"in _&&t(1,f=_.class),"$$scope"in _&&t(8,s=_.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,c=H.toArray(H.getNestedVal(i,r)))},[a,f,u,c,o,r,d,i,s,l,m,h]}class de extends be{constructor(e){super(),ge(this,e,kv,bv,he,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}function yv(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Email"),l=D(),s=b("input"),p(e,"for",i=n[9]),p(s,"type","email"),p(s,"autocomplete","off"),p(s,"id",o=n[9]),s.required=!0,s.autofocus=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0]),s.focus(),r||(a=Z(s,"input",n[5]),r=!0)},p(f,u){u&512&&i!==(i=f[9])&&p(e,"for",i),u&512&&o!==(o=f[9])&&p(s,"id",o),u&1&&s.value!==f[0]&&ae(s,f[0])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function vv(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=J("Password"),l=D(),s=b("input"),r=D(),a=b("div"),a.textContent="Minimum 10 characters.",p(e,"for",i=n[9]),p(s,"type","password"),p(s,"autocomplete","new-password"),p(s,"minlength","10"),p(s,"id",o=n[9]),s.required=!0,p(a,"class","help-block")},m(c,d){S(c,e,d),y(e,t),S(c,l,d),S(c,s,d),ae(s,n[1]),S(c,r,d),S(c,a,d),f||(u=Z(s,"input",n[6]),f=!0)},p(c,d){d&512&&i!==(i=c[9])&&p(e,"for",i),d&512&&o!==(o=c[9])&&p(s,"id",o),d&2&&s.value!==c[1]&&ae(s,c[1])},d(c){c&&(w(e),w(l),w(s),w(r),w(a)),f=!1,u()}}}function wv(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Password confirm"),l=D(),s=b("input"),p(e,"for",i=n[9]),p(s,"type","password"),p(s,"minlength","10"),p(s,"id",o=n[9]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[2]),r||(a=Z(s,"input",n[7]),r=!0)},p(f,u){u&512&&i!==(i=f[9])&&p(e,"for",i),u&512&&o!==(o=f[9])&&p(s,"id",o),u&4&&s.value!==f[2]&&ae(s,f[2])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function Sv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return l=new de({props:{class:"form-field required",name:"email",$$slots:{default:[yv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field required",name:"password",$$slots:{default:[vv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),a=new de({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[wv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),t.innerHTML="<h4>Create your first admin account in order to continue</h4>",i=D(),B(l.$$.fragment),s=D(),B(o.$$.fragment),r=D(),B(a.$$.fragment),f=D(),u=b("button"),u.innerHTML='<span class="txt">Create and login</span> <i class="ri-arrow-right-line"></i>',p(t,"class","content txt-center m-b-base"),p(u,"type","submit"),p(u,"class","btn btn-lg btn-block btn-next"),ee(u,"btn-disabled",n[3]),ee(u,"btn-loading",n[3]),p(e,"class","block"),p(e,"autocomplete","off")},m(h,_){S(h,e,_),y(e,t),y(e,i),z(l,e,null),y(e,s),z(o,e,null),y(e,r),z(a,e,null),y(e,f),y(e,u),c=!0,d||(m=Z(e,"submit",Ue(n[4])),d=!0)},p(h,[_]){const g={};_&1537&&(g.$$scope={dirty:_,ctx:h}),l.$set(g);const v={};_&1538&&(v.$$scope={dirty:_,ctx:h}),o.$set(v);const $={};_&1540&&($.$$scope={dirty:_,ctx:h}),a.$set($),(!c||_&8)&&ee(u,"btn-disabled",h[3]),(!c||_&8)&&ee(u,"btn-loading",h[3])},i(h){c||(I(l.$$.fragment,h),I(o.$$.fragment,h),I(a.$$.fragment,h),c=!0)},o(h){L(l.$$.fragment,h),L(o.$$.fragment,h),L(a.$$.fragment,h),c=!1},d(h){h&&w(e),V(l),V(o),V(a),d=!1,m()}}}function $v(n,e,t){const i=st();let l="",s="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await fe.admins.create({email:l,password:s,passwordConfirm:o}),await fe.admins.authWithPassword(l,s),i("submit")}catch(d){fe.error(d)}t(3,r=!1)}}function f(){l=this.value,t(0,l)}function u(){s=this.value,t(1,s)}function c(){o=this.value,t(2,o)}return[l,s,o,r,a,f,u,c]}class Tv extends be{constructor(e){super(),ge(this,e,$v,Sv,he,{})}}function Yf(n){let e,t;return e=new G1({props:{$$slots:{default:[Cv]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&9&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Cv(n){let e,t;return e=new Tv({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p:x,i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Ov(n){let e,t,i=n[0]&&Yf(n);return{c(){i&&i.c(),e=ve()},m(l,s){i&&i.m(l,s),S(l,e,s),t=!0},p(l,[s]){l[0]?i?(i.p(l,s),s&1&&I(i,1)):(i=Yf(l),i.c(),I(i,1),i.m(e.parentNode,e)):i&&(se(),L(i,1,1,()=>{i=null}),oe())},i(l){t||(I(i),t=!0)},o(l){L(i),t=!1},d(l){l&&w(e),i&&i.d(l)}}}function Mv(n,e,t){let i=!1;l();function l(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){fe.logout(!1),t(0,i=!0);return}fe.authStore.isValid?nl("/collections"):fe.logout()}return[i,async()=>{t(0,i=!1),await xt(),window.location.search=""}]}class Dv extends be{constructor(e){super(),ge(this,e,Mv,Ov,he,{})}}const At=On(""),Mo=On(""),Qi=On(!1);function Ev(n){let e,t,i,l;return{c(){e=b("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(s,o){S(s,e,o),n[13](e),ae(e,n[7]),i||(l=Z(e,"input",n[14]),i=!0)},p(s,o){o&3&&t!==(t=s[0]||s[1])&&p(e,"placeholder",t),o&128&&e.value!==s[7]&&ae(e,s[7])},i:x,o:x,d(s){s&&w(e),n[13](null),i=!1,l()}}}function Iv(n){let e,t,i,l;function s(a){n[12](a)}var o=n[4];function r(a,f){let u={id:a[8],singleLine:!0,disableRequestKeys:!0,disableCollectionJoinKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return o&&(e=Et(o,r(n)),te.push(()=>ke(e,"value",s)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=ve()},m(a,f){e&&z(e,a,f),S(a,i,f),l=!0},p(a,f){if(f&16&&o!==(o=a[4])){if(e){se();const u=e;L(u.$$.fragment,1,0,()=>{V(u,1)}),oe()}o?(e=Et(o,r(a)),te.push(()=>ke(e,"value",s)),e.$on("submit",a[10]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const u={};f&8&&(u.extraAutocompleteKeys=a[3]),f&4&&(u.baseCollection=a[2]),f&3&&(u.placeholder=a[0]||a[1]),!t&&f&128&&(t=!0,u.value=a[7],ye(()=>t=!1)),e.$set(u)}},i(a){l||(e&&I(e.$$.fragment,a),l=!0)},o(a){e&&L(e.$$.fragment,a),l=!1},d(a){a&&w(i),e&&V(e,a)}}}function Kf(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Search</span>',p(e,"type","submit"),p(e,"class","btn btn-expanded-sm btn-sm btn-warning")},m(l,s){S(l,e,s),i=!0},i(l){i||(l&&Je(()=>{i&&(t||(t=Re(e,Rn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Re(e,Rn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(l){l&&w(e),l&&t&&t.end()}}}function Jf(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear</span>',p(e,"type","button"),p(e,"class","btn btn-transparent btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(o,r){S(o,e,r),i=!0,l||(s=Z(e,"click",n[15]),l=!0)},p:x,i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Rn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Rn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function Av(n){let e,t,i,l,s,o,r,a,f,u,c;const d=[Iv,Ev],m=[];function h(v,$){return v[4]&&!v[5]?0:1}s=h(n),o=m[s]=d[s](n);let _=(n[0].length||n[7].length)&&n[7]!=n[0]&&Kf(),g=(n[0].length||n[7].length)&&Jf(n);return{c(){e=b("form"),t=b("label"),i=b("i"),l=D(),o.c(),r=D(),_&&_.c(),a=D(),g&&g.c(),p(i,"class","ri-search-line"),p(t,"for",n[8]),p(t,"class","m-l-10 txt-xl"),p(e,"class","searchbar")},m(v,$){S(v,e,$),y(e,t),y(t,i),y(e,l),m[s].m(e,null),y(e,r),_&&_.m(e,null),y(e,a),g&&g.m(e,null),f=!0,u||(c=[Z(e,"click",Cn(n[11])),Z(e,"submit",Ue(n[10]))],u=!0)},p(v,[$]){let C=s;s=h(v),s===C?m[s].p(v,$):(se(),L(m[C],1,1,()=>{m[C]=null}),oe(),o=m[s],o?o.p(v,$):(o=m[s]=d[s](v),o.c()),I(o,1),o.m(e,r)),(v[0].length||v[7].length)&&v[7]!=v[0]?_?$&129&&I(_,1):(_=Kf(),_.c(),I(_,1),_.m(e,a)):_&&(se(),L(_,1,1,()=>{_=null}),oe()),v[0].length||v[7].length?g?(g.p(v,$),$&129&&I(g,1)):(g=Jf(v),g.c(),I(g,1),g.m(e,null)):g&&(se(),L(g,1,1,()=>{g=null}),oe())},i(v){f||(I(o),I(_),I(g),f=!0)},o(v){L(o),L(_),L(g),f=!1},d(v){v&&w(e),m[s].d(),_&&_.d(),g&&g.d(),u=!1,Te(c)}}}function Lv(n,e,t){const i=st(),l="search_"+H.randomString(7);let{value:s=""}=e,{placeholder:o='Search term or filter like created > "2022-01-01"...'}=e,{autocompleteCollection:r=H.initCollection()}=e,{extraAutocompleteKeys:a=[]}=e,f,u=!1,c,d="";function m(O=!0){t(7,d=""),O&&(c==null||c.focus()),i("clear")}function h(){t(0,s=d),i("submit",s)}async function _(){f||u||(t(5,u=!0),t(4,f=(await nt(()=>import("./FilterAutocompleteInput-BciXxpa7.js"),__vite__mapDeps([0,1]),import.meta.url)).default),t(5,u=!1))}zt(()=>{_()});function g(O){Oe.call(this,n,O)}function v(O){d=O,t(7,d),t(0,s)}function $(O){te[O?"unshift":"push"](()=>{c=O,t(6,c)})}function C(){d=this.value,t(7,d),t(0,s)}const T=()=>{m(!1),h()};return n.$$set=O=>{"value"in O&&t(0,s=O.value),"placeholder"in O&&t(1,o=O.placeholder),"autocompleteCollection"in O&&t(2,r=O.autocompleteCollection),"extraAutocompleteKeys"in O&&t(3,a=O.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof s=="string"&&t(7,d=s)},[s,o,r,a,f,u,c,d,l,m,h,g,v,$,C,T]}class Ts extends be{constructor(e){super(),ge(this,e,Lv,Av,he,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}function Nv(n){let e,t,i,l,s,o;return{c(){e=b("button"),t=b("i"),p(t,"class","ri-refresh-line svelte-1bvelc2"),p(e,"type","button"),p(e,"aria-label","Refresh"),p(e,"class",i="btn btn-transparent btn-circle "+n[1]+" svelte-1bvelc2"),ee(e,"refreshing",n[2])},m(r,a){S(r,e,a),y(e,t),s||(o=[$e(l=Fe.call(null,e,n[0])),Z(e,"click",n[3])],s=!0)},p(r,[a]){a&2&&i!==(i="btn btn-transparent btn-circle "+r[1]+" svelte-1bvelc2")&&p(e,"class",i),l&&Ot(l.update)&&a&1&&l.update.call(null,r[0]),a&6&&ee(e,"refreshing",r[2])},i:x,o:x,d(r){r&&w(e),s=!1,Te(o)}}}function Pv(n,e,t){const i=st();let{tooltip:l={text:"Refresh",position:"right"}}=e,{class:s=""}=e,o=null;function r(){i("refresh");const a=l;t(0,l=null),clearTimeout(o),t(2,o=setTimeout(()=>{t(2,o=null),t(0,l=a)},150))}return zt(()=>()=>clearTimeout(o)),n.$$set=a=>{"tooltip"in a&&t(0,l=a.tooltip),"class"in a&&t(1,s=a.class)},[l,s,o,r]}class Go extends be{constructor(e){super(),ge(this,e,Pv,Nv,he,{tooltip:0,class:1})}}function Fv(n){let e,t,i,l,s;const o=n[6].default,r=St(o,n,n[5],null);return{c(){e=b("th"),r&&r.c(),p(e,"tabindex","0"),p(e,"title",n[2]),p(e,"class",t="col-sort "+n[1]),ee(e,"col-sort-disabled",n[3]),ee(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),ee(e,"sort-desc",n[0]==="-"+n[2]),ee(e,"sort-asc",n[0]==="+"+n[2])},m(a,f){S(a,e,f),r&&r.m(e,null),i=!0,l||(s=[Z(e,"click",n[7]),Z(e,"keydown",n[8])],l=!0)},p(a,[f]){r&&r.p&&(!i||f&32)&&Tt(r,o,a,a[5],i?$t(o,a[5],f,null):Ct(a[5]),null),(!i||f&4)&&p(e,"title",a[2]),(!i||f&2&&t!==(t="col-sort "+a[1]))&&p(e,"class",t),(!i||f&10)&&ee(e,"col-sort-disabled",a[3]),(!i||f&7)&&ee(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),(!i||f&7)&&ee(e,"sort-desc",a[0]==="-"+a[2]),(!i||f&7)&&ee(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(I(r,a),i=!0)},o(a){L(r,a),i=!1},d(a){a&&w(e),r&&r.d(a),l=!1,Te(s)}}}function Rv(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function f(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}const u=()=>f(),c=d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),f())};return n.$$set=d=>{"class"in d&&t(1,s=d.class),"name"in d&&t(2,o=d.name),"sort"in d&&t(0,r=d.sort),"disable"in d&&t(3,a=d.disable),"$$scope"in d&&t(5,l=d.$$scope)},[r,s,o,a,f,l,i,u,c]}class $n extends be{constructor(e){super(),ge(this,e,Rv,Fv,he,{class:1,name:2,sort:0,disable:3})}}const qv=n=>({}),Zf=n=>({}),jv=n=>({}),Gf=n=>({});function Hv(n){let e,t,i,l,s,o,r,a;const f=n[11].before,u=St(f,n,n[10],Gf),c=n[11].default,d=St(c,n,n[10],null),m=n[11].after,h=St(m,n,n[10],Zf);return{c(){e=b("div"),u&&u.c(),t=D(),i=b("div"),d&&d.c(),s=D(),h&&h.c(),p(i,"class",l="scroller "+n[0]+" "+n[3]+" svelte-3a0gfs"),p(e,"class","scroller-wrapper svelte-3a0gfs")},m(_,g){S(_,e,g),u&&u.m(e,null),y(e,t),y(e,i),d&&d.m(i,null),n[12](i),y(e,s),h&&h.m(e,null),o=!0,r||(a=[Z(window,"resize",n[1]),Z(i,"scroll",n[1])],r=!0)},p(_,[g]){u&&u.p&&(!o||g&1024)&&Tt(u,f,_,_[10],o?$t(f,_[10],g,jv):Ct(_[10]),Gf),d&&d.p&&(!o||g&1024)&&Tt(d,c,_,_[10],o?$t(c,_[10],g,null):Ct(_[10]),null),(!o||g&9&&l!==(l="scroller "+_[0]+" "+_[3]+" svelte-3a0gfs"))&&p(i,"class",l),h&&h.p&&(!o||g&1024)&&Tt(h,m,_,_[10],o?$t(m,_[10],g,qv):Ct(_[10]),Zf)},i(_){o||(I(u,_),I(d,_),I(h,_),o=!0)},o(_){L(u,_),L(d,_),L(h,_),o=!1},d(_){_&&w(e),u&&u.d(_),d&&d.d(_),n[12](null),h&&h.d(_),r=!1,Te(a)}}}function zv(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let{class:o=""}=e,{vThreshold:r=0}=e,{hThreshold:a=0}=e,{dispatchOnNoScroll:f=!0}=e,u=null,c="",d=null,m,h,_,g,v;function $(){u&&t(2,u.scrollTop=0,u)}function C(){u&&t(2,u.scrollLeft=0,u)}function T(){u&&(t(3,c=""),_=u.clientWidth+2,g=u.clientHeight+2,m=u.scrollWidth-_,h=u.scrollHeight-g,h>0?(t(3,c+=" v-scroll"),r>=g&&t(4,r=0),u.scrollTop-r<=0&&(t(3,c+=" v-scroll-start"),s("vScrollStart")),u.scrollTop+r>=h&&(t(3,c+=" v-scroll-end"),s("vScrollEnd"))):f&&s("vScrollEnd"),m>0?(t(3,c+=" h-scroll"),a>=_&&t(5,a=0),u.scrollLeft-a<=0&&(t(3,c+=" h-scroll-start"),s("hScrollStart")),u.scrollLeft+a>=m&&(t(3,c+=" h-scroll-end"),s("hScrollEnd"))):f&&s("hScrollEnd"))}function O(){d||(d=setTimeout(()=>{T(),d=null},150))}zt(()=>(O(),v=new MutationObserver(O),v.observe(u,{attributeFilter:["width","height"],childList:!0,subtree:!0}),()=>{v==null||v.disconnect(),clearTimeout(d)}));function M(E){te[E?"unshift":"push"](()=>{u=E,t(2,u)})}return n.$$set=E=>{"class"in E&&t(0,o=E.class),"vThreshold"in E&&t(4,r=E.vThreshold),"hThreshold"in E&&t(5,a=E.hThreshold),"dispatchOnNoScroll"in E&&t(6,f=E.dispatchOnNoScroll),"$$scope"in E&&t(10,l=E.$$scope)},[o,O,u,c,r,a,f,$,C,T,l,i,M]}class Xo extends be{constructor(e){super(),ge(this,e,zv,Hv,he,{class:0,vThreshold:4,hThreshold:5,dispatchOnNoScroll:6,resetVerticalScroll:7,resetHorizontalScroll:8,refresh:9,throttleRefresh:1})}get resetVerticalScroll(){return this.$$.ctx[7]}get resetHorizontalScroll(){return this.$$.ctx[8]}get refresh(){return this.$$.ctx[9]}get throttleRefresh(){return this.$$.ctx[1]}}function Vv(n){let e,t,i=(n[1]||"UNKN")+"",l,s,o,r,a;return{c(){e=b("div"),t=b("span"),l=J(i),s=J(" ("),o=J(n[0]),r=J(")"),p(t,"class","txt"),p(e,"class",a="label log-level-label level-"+n[0]+" svelte-ha6hme")},m(f,u){S(f,e,u),y(e,t),y(t,l),y(t,s),y(t,o),y(t,r)},p(f,[u]){u&2&&i!==(i=(f[1]||"UNKN")+"")&&re(l,i),u&1&&re(o,f[0]),u&1&&a!==(a="label log-level-label level-"+f[0]+" svelte-ha6hme")&&p(e,"class",a)},i:x,o:x,d(f){f&&w(e)}}}function Bv(n,e,t){let i,{level:l}=e;return n.$$set=s=>{"level"in s&&t(0,l=s.level)},n.$$.update=()=>{var s;n.$$.dirty&1&&t(1,i=(s=W1.find(o=>o.level==l))==null?void 0:s.label)},[l,i]}class Q1 extends be{constructor(e){super(),ge(this,e,Bv,Vv,he,{level:0})}}function Uv(n){let e,t=n[0].replace("Z"," UTC")+"",i,l,s;return{c(){e=b("span"),i=J(t),p(e,"class","txt-nowrap")},m(o,r){S(o,e,r),y(e,i),l||(s=$e(Fe.call(null,e,n[1])),l=!0)},p(o,[r]){r&1&&t!==(t=o[0].replace("Z"," UTC")+"")&&re(i,t)},i:x,o:x,d(o){o&&w(e),l=!1,s()}}}function Wv(n,e,t){let{date:i}=e;const l={get text(){return H.formatToLocalDate(i,"yyyy-MM-dd HH:mm:ss.SSS")+" Local"}};return n.$$set=s=>{"date"in s&&t(0,i=s.date)},[i,l]}class x1 extends be{constructor(e){super(),ge(this,e,Wv,Uv,he,{date:0})}}function Xf(n,e,t){var o;const i=n.slice();i[31]=e[t];const l=((o=i[31].data)==null?void 0:o.type)=="request";i[32]=l;const s=i2(i[31]);return i[33]=s,i}function Qf(n,e,t){const i=n.slice();return i[36]=e[t],i}function Yv(n){let e,t,i,l,s,o,r;return{c(){e=b("div"),t=b("input"),l=D(),s=b("label"),p(t,"type","checkbox"),p(t,"id","checkbox_0"),t.disabled=i=!n[3].length,t.checked=n[8],p(s,"for","checkbox_0"),p(e,"class","form-field")},m(a,f){S(a,e,f),y(e,t),y(e,l),y(e,s),o||(r=Z(t,"change",n[18]),o=!0)},p(a,f){f[0]&8&&i!==(i=!a[3].length)&&(t.disabled=i),f[0]&256&&(t.checked=a[8])},d(a){a&&w(e),o=!1,r()}}}function Kv(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Jv(n){let e;return{c(){e=b("div"),e.innerHTML='<i class="ri-bookmark-line"></i> <span class="txt">level</span>',p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Zv(n){let e;return{c(){e=b("div"),e.innerHTML='<i class="ri-file-list-2-line"></i> <span class="txt">message</span>',p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Gv(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("date")} svelte-91v05h"></i> <span class="txt">created</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function xf(n){let e;function t(s,o){return s[7]?Qv:Xv}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function Xv(n){var r;let e,t,i,l,s,o=((r=n[0])==null?void 0:r.length)&&eu(n);return{c(){e=b("tr"),t=b("td"),i=b("h6"),i.textContent="No logs found.",l=D(),o&&o.c(),s=D(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,f){S(a,e,f),y(e,t),y(t,i),y(t,l),o&&o.m(t,null),y(e,s)},p(a,f){var u;(u=a[0])!=null&&u.length?o?o.p(a,f):(o=eu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&w(e),o&&o.d()}}}function Qv(n){let e;return{c(){e=b("tr"),e.innerHTML='<td colspan="99" class="p-xs"><span class="skeleton-loader m-0"></span></td> '},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function eu(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[25]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function tu(n){let e,t=ce(n[33]),i=[];for(let l=0;l<t.length;l+=1)i[l]=nu(Qf(n,t,l));return{c(){e=b("div");for(let l=0;l<i.length;l+=1)i[l].c();p(e,"class","flex flex-wrap flex-gap-10 m-t-10")},m(l,s){S(l,e,s);for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(e,null)},p(l,s){if(s[0]&8){t=ce(l[33]);let o;for(o=0;o<t.length;o+=1){const r=Qf(l,t,o);i[o]?i[o].p(r,s):(i[o]=nu(r),i[o].c(),i[o].m(e,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&w(e),rt(i,l)}}}function xv(n){let e=n[36].key+"",t,i,l=H.stringifyValue(n[31].data[n[36].key],"-",80)+"",s;return{c(){t=J(e),i=J(": "),s=J(l)},m(o,r){S(o,t,r),S(o,i,r),S(o,s,r)},p(o,r){r[0]&8&&e!==(e=o[36].key+"")&&re(t,e),r[0]&8&&l!==(l=H.stringifyValue(o[31].data[o[36].key],"-",80)+"")&&re(s,l)},d(o){o&&(w(t),w(i),w(s))}}}function e2(n){let e=n[36].key+"",t,i,l=n[31].data[n[36].key]+"",s,o;return{c(){t=J(e),i=J(": "),s=J(l),o=J("ms")},m(r,a){S(r,t,a),S(r,i,a),S(r,s,a),S(r,o,a)},p(r,a){a[0]&8&&e!==(e=r[36].key+"")&&re(t,e),a[0]&8&&l!==(l=r[31].data[r[36].key]+"")&&re(s,l)},d(r){r&&(w(t),w(i),w(s),w(o))}}}function nu(n){let e,t,i;function l(r,a){return r[32]&&r[36].key=="execTime"?e2:xv}let s=l(n),o=s(n);return{c(){e=b("span"),o.c(),t=D(),p(e,"class",i="label label-sm "+(n[36].label||"")+" svelte-91v05h")},m(r,a){S(r,e,a),o.m(e,null),y(e,t)},p(r,a){s===(s=l(r))&&o?o.p(r,a):(o.d(1),o=s(r),o&&(o.c(),o.m(e,t))),a[0]&8&&i!==(i="label label-sm "+(r[36].label||"")+" svelte-91v05h")&&p(e,"class",i)},d(r){r&&w(e),o.d()}}}function iu(n,e){let t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$=e[31].message+"",C,T,O,M,E,A,N,q,R,P,F;function j(){return e[22](e[31])}m=new Q1({props:{level:e[31].level}});let U=e[33].length&&tu(e);E=new x1({props:{date:e[31].created}});function Y(){return e[23](e[31])}function X(...W){return e[24](e[31],...W)}return{key:n,first:null,c(){t=b("tr"),i=b("td"),l=b("div"),s=b("input"),a=D(),f=b("label"),c=D(),d=b("td"),B(m.$$.fragment),h=D(),_=b("td"),g=b("div"),v=b("span"),C=J($),T=D(),U&&U.c(),O=D(),M=b("td"),B(E.$$.fragment),A=D(),N=b("td"),N.innerHTML='<i class="ri-arrow-right-line"></i>',q=D(),p(s,"type","checkbox"),p(s,"id",o="checkbox_"+e[31].id),s.checked=r=e[4][e[31].id],p(f,"for",u="checkbox_"+e[31].id),p(l,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(d,"class","col-type-text col-field-level min-width svelte-91v05h"),p(v,"class","txt-ellipsis"),p(g,"class","flex flex-gap-10"),p(_,"class","col-type-text col-field-message svelte-91v05h"),p(M,"class","col-type-date col-field-created"),p(N,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(W,K){S(W,t,K),y(t,i),y(i,l),y(l,s),y(l,a),y(l,f),y(t,c),y(t,d),z(m,d,null),y(t,h),y(t,_),y(_,g),y(g,v),y(v,C),y(_,T),U&&U.m(_,null),y(t,O),y(t,M),z(E,M,null),y(t,A),y(t,N),y(t,q),R=!0,P||(F=[Z(s,"change",j),Z(l,"click",Cn(e[17])),Z(t,"click",Y),Z(t,"keydown",X)],P=!0)},p(W,K){e=W,(!R||K[0]&8&&o!==(o="checkbox_"+e[31].id))&&p(s,"id",o),(!R||K[0]&24&&r!==(r=e[4][e[31].id]))&&(s.checked=r),(!R||K[0]&8&&u!==(u="checkbox_"+e[31].id))&&p(f,"for",u);const le={};K[0]&8&&(le.level=e[31].level),m.$set(le),(!R||K[0]&8)&&$!==($=e[31].message+"")&&re(C,$),e[33].length?U?U.p(e,K):(U=tu(e),U.c(),U.m(_,null)):U&&(U.d(1),U=null);const ne={};K[0]&8&&(ne.date=e[31].created),E.$set(ne)},i(W){R||(I(m.$$.fragment,W),I(E.$$.fragment,W),R=!0)},o(W){L(m.$$.fragment,W),L(E.$$.fragment,W),R=!1},d(W){W&&w(t),V(m),U&&U.d(),V(E),P=!1,Te(F)}}}function t2(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$=[],C=new Map,T;function O(X,W){return X[7]?Kv:Yv}let M=O(n),E=M(n);function A(X){n[19](X)}let N={disable:!0,class:"col-field-level min-width",name:"level",$$slots:{default:[Jv]},$$scope:{ctx:n}};n[1]!==void 0&&(N.sort=n[1]),o=new $n({props:N}),te.push(()=>ke(o,"sort",A));function q(X){n[20](X)}let R={disable:!0,class:"col-type-text col-field-message",name:"data",$$slots:{default:[Zv]},$$scope:{ctx:n}};n[1]!==void 0&&(R.sort=n[1]),f=new $n({props:R}),te.push(()=>ke(f,"sort",q));function P(X){n[21](X)}let F={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[Gv]},$$scope:{ctx:n}};n[1]!==void 0&&(F.sort=n[1]),d=new $n({props:F}),te.push(()=>ke(d,"sort",P));let j=ce(n[3]);const U=X=>X[31].id;for(let X=0;X<j.length;X+=1){let W=Xf(n,j,X),K=U(W);C.set(K,$[X]=iu(K,W))}let Y=null;return j.length||(Y=xf(n)),{c(){e=b("table"),t=b("thead"),i=b("tr"),l=b("th"),E.c(),s=D(),B(o.$$.fragment),a=D(),B(f.$$.fragment),c=D(),B(d.$$.fragment),h=D(),_=b("th"),g=D(),v=b("tbody");for(let X=0;X<$.length;X+=1)$[X].c();Y&&Y.c(),p(l,"class","bulk-select-col min-width"),p(_,"class","col-type-action min-width"),p(e,"class","table"),ee(e,"table-loading",n[7])},m(X,W){S(X,e,W),y(e,t),y(t,i),y(i,l),E.m(l,null),y(i,s),z(o,i,null),y(i,a),z(f,i,null),y(i,c),z(d,i,null),y(i,h),y(i,_),y(e,g),y(e,v);for(let K=0;K<$.length;K+=1)$[K]&&$[K].m(v,null);Y&&Y.m(v,null),T=!0},p(X,W){M===(M=O(X))&&E?E.p(X,W):(E.d(1),E=M(X),E&&(E.c(),E.m(l,null)));const K={};W[1]&256&&(K.$$scope={dirty:W,ctx:X}),!r&&W[0]&2&&(r=!0,K.sort=X[1],ye(()=>r=!1)),o.$set(K);const le={};W[1]&256&&(le.$$scope={dirty:W,ctx:X}),!u&&W[0]&2&&(u=!0,le.sort=X[1],ye(()=>u=!1)),f.$set(le);const ne={};W[1]&256&&(ne.$$scope={dirty:W,ctx:X}),!m&&W[0]&2&&(m=!0,ne.sort=X[1],ye(()=>m=!1)),d.$set(ne),W[0]&9369&&(j=ce(X[3]),se(),$=ft($,W,U,1,X,j,C,v,It,iu,null,Xf),oe(),!j.length&&Y?Y.p(X,W):j.length?Y&&(Y.d(1),Y=null):(Y=xf(X),Y.c(),Y.m(v,null))),(!T||W[0]&128)&&ee(e,"table-loading",X[7])},i(X){if(!T){I(o.$$.fragment,X),I(f.$$.fragment,X),I(d.$$.fragment,X);for(let W=0;W<j.length;W+=1)I($[W]);T=!0}},o(X){L(o.$$.fragment,X),L(f.$$.fragment,X),L(d.$$.fragment,X);for(let W=0;W<$.length;W+=1)L($[W]);T=!1},d(X){X&&w(e),E.d(),V(o),V(f),V(d);for(let W=0;W<$.length;W+=1)$[W].d();Y&&Y.d()}}}function lu(n){let e,t,i,l;return{c(){e=b("div"),t=b("button"),t.innerHTML='<span class="txt">Load more</span>',p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),ee(t,"btn-loading",n[7]),ee(t,"btn-disabled",n[7]),p(e,"class","block txt-center m-t-sm")},m(s,o){S(s,e,o),y(e,t),i||(l=Z(t,"click",n[26]),i=!0)},p(s,o){o[0]&128&&ee(t,"btn-loading",s[7]),o[0]&128&&ee(t,"btn-disabled",s[7])},d(s){s&&w(e),i=!1,l()}}}function su(n){let e,t,i,l,s,o,r=n[5]===1?"log":"logs",a,f,u,c,d,m,h,_,g,v,$;return{c(){e=b("div"),t=b("div"),i=J("Selected "),l=b("strong"),s=J(n[5]),o=D(),a=J(r),f=D(),u=b("button"),u.innerHTML='<span class="txt">Reset</span>',c=D(),d=b("div"),m=D(),h=b("button"),h.innerHTML='<span class="txt">Download as JSON</span>',p(t,"class","txt"),p(u,"type","button"),p(u,"class","btn btn-xs btn-transparent btn-outline p-l-5 p-r-5"),p(d,"class","flex-fill"),p(h,"type","button"),p(h,"class","btn btn-sm"),p(e,"class","bulkbar svelte-91v05h")},m(C,T){S(C,e,T),y(e,t),y(t,i),y(t,l),y(l,s),y(t,o),y(t,a),y(e,f),y(e,u),y(e,c),y(e,d),y(e,m),y(e,h),g=!0,v||($=[Z(u,"click",n[27]),Z(h,"click",n[14])],v=!0)},p(C,T){(!g||T[0]&32)&&re(s,C[5]),(!g||T[0]&32)&&r!==(r=C[5]===1?"log":"logs")&&re(a,r)},i(C){g||(C&&Je(()=>{g&&(_||(_=Re(e,Rn,{duration:150,y:5},!0)),_.run(1))}),g=!0)},o(C){C&&(_||(_=Re(e,Rn,{duration:150,y:5},!1)),_.run(0)),g=!1},d(C){C&&w(e),C&&_&&_.end(),v=!1,Te($)}}}function n2(n){let e,t,i,l,s;e=new Xo({props:{class:"table-wrapper",$$slots:{default:[t2]},$$scope:{ctx:n}}});let o=n[3].length&&n[9]&&lu(n),r=n[5]&&su(n);return{c(){B(e.$$.fragment),t=D(),o&&o.c(),i=D(),r&&r.c(),l=ve()},m(a,f){z(e,a,f),S(a,t,f),o&&o.m(a,f),S(a,i,f),r&&r.m(a,f),S(a,l,f),s=!0},p(a,f){const u={};f[0]&411|f[1]&256&&(u.$$scope={dirty:f,ctx:a}),e.$set(u),a[3].length&&a[9]?o?o.p(a,f):(o=lu(a),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null),a[5]?r?(r.p(a,f),f[0]&32&&I(r,1)):(r=su(a),r.c(),I(r,1),r.m(l.parentNode,l)):r&&(se(),L(r,1,1,()=>{r=null}),oe())},i(a){s||(I(e.$$.fragment,a),I(r),s=!0)},o(a){L(e.$$.fragment,a),L(r),s=!1},d(a){a&&(w(t),w(i),w(l)),V(e,a),o&&o.d(a),r&&r.d(a)}}}const ou=50,pr=/[-:\. ]/gi;function i2(n){let e=[];if(!n.data)return e;if(n.data.type=="request"){const t=["status","execTime","auth","userIp"];for(let i of t)typeof n.data[i]<"u"&&e.push({key:i});n.data.referer&&!n.data.referer.includes(window.location.host)&&e.push({key:"referer"})}else{const t=Object.keys(n.data);for(const i of t)i!="error"&&i!="details"&&e.length<6&&e.push({key:i})}return n.data.error&&e.push({key:"error",label:"label-danger"}),n.data.details&&e.push({key:"details",label:"label-warning"}),e}function l2(n,e,t){let i,l,s;const o=st();let{filter:r=""}=e,{presets:a=""}=e,{sort:f="-rowid"}=e,u=[],c=1,d=0,m=!1,h=0,_={};async function g(W=1,K=!0){t(7,m=!0);const le=[a,H.normalizeLogsFilter(r)].filter(Boolean).join("&&");return fe.logs.getList(W,ou,{sort:f,skipTotal:1,filter:le}).then(async ne=>{var Pe;W<=1&&v();const me=H.toArray(ne.items);if(t(7,m=!1),t(6,c=ne.page),t(16,d=((Pe=ne.items)==null?void 0:Pe.length)||0),o("load",u.concat(me)),K){const ze=++h;for(;me.length&&h==ze;){const Qe=me.splice(0,10);for(let et of Qe)H.pushOrReplaceByKey(u,et);t(3,u),await H.yieldToMain()}}else{for(let ze of me)H.pushOrReplaceByKey(u,ze);t(3,u)}}).catch(ne=>{ne!=null&&ne.isAbort||(t(7,m=!1),console.warn(ne),v(),fe.error(ne,!le||(ne==null?void 0:ne.status)!=400))})}function v(){t(3,u=[]),t(4,_={}),t(6,c=1),t(16,d=0)}function $(){s?C():T()}function C(){t(4,_={})}function T(){for(const W of u)t(4,_[W.id]=W,_);t(4,_)}function O(W){_[W.id]?delete _[W.id]:t(4,_[W.id]=W,_),t(4,_)}function M(){const W=Object.values(_).sort((ne,me)=>ne.created<me.created?1:ne.created>me.created?-1:0);if(!W.length)return;if(W.length==1)return H.downloadJson(W[0],"log_"+W[0].created.replaceAll(pr,"")+".json");const K=W[0].created.replaceAll(pr,""),le=W[W.length-1].created.replaceAll(pr,"");return H.downloadJson(W,`${W.length}_logs_${le}_to_${K}.json`)}function E(W){Oe.call(this,n,W)}const A=()=>$();function N(W){f=W,t(1,f)}function q(W){f=W,t(1,f)}function R(W){f=W,t(1,f)}const P=W=>O(W),F=W=>o("select",W),j=(W,K)=>{K.code==="Enter"&&(K.preventDefault(),o("select",W))},U=()=>t(0,r=""),Y=()=>g(c+1),X=()=>C();return n.$$set=W=>{"filter"in W&&t(0,r=W.filter),"presets"in W&&t(15,a=W.presets),"sort"in W&&t(1,f=W.sort)},n.$$.update=()=>{n.$$.dirty[0]&32771&&(typeof f<"u"||typeof r<"u"||typeof a<"u")&&(v(),g(1)),n.$$.dirty[0]&65536&&t(9,i=d>=ou),n.$$.dirty[0]&16&&t(5,l=Object.keys(_).length),n.$$.dirty[0]&40&&t(8,s=u.length&&l===u.length)},[r,f,g,u,_,l,c,m,s,i,o,$,C,O,M,a,d,E,A,N,q,R,P,F,j,U,Y,X]}class s2 extends be{constructor(e){super(),ge(this,e,l2,n2,he,{filter:0,presets:15,sort:1,load:2},null,[-1,-1])}get load(){return this.$$.ctx[2]}}/*!
* @kurkle/color v0.3.2
* https://github.com/kurkle/color#readme
* (c) 2023 Jukka Kurkela
* Released under the MIT License
*/function Cs(n){return n+.5|0}const Ti=(n,e,t)=>Math.max(Math.min(n,t),e);function Kl(n){return Ti(Cs(n*2.55),0,255)}function Di(n){return Ti(Cs(n*255),0,255)}function ci(n){return Ti(Cs(n/2.55)/100,0,1)}function ru(n){return Ti(Cs(n*100),0,100)}const In={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Zr=[..."0123456789ABCDEF"],o2=n=>Zr[n&15],r2=n=>Zr[(n&240)>>4]+Zr[n&15],js=n=>(n&240)>>4===(n&15),a2=n=>js(n.r)&&js(n.g)&&js(n.b)&&js(n.a);function f2(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&In[n[1]]*17,g:255&In[n[2]]*17,b:255&In[n[3]]*17,a:e===5?In[n[4]]*17:255}:(e===7||e===9)&&(t={r:In[n[1]]<<4|In[n[2]],g:In[n[3]]<<4|In[n[4]],b:In[n[5]]<<4|In[n[6]],a:e===9?In[n[7]]<<4|In[n[8]]:255})),t}const u2=(n,e)=>n<255?e(n):"";function c2(n){var e=a2(n)?o2:r2;return n?"#"+e(n.r)+e(n.g)+e(n.b)+u2(n.a,e):void 0}const d2=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function eb(n,e,t){const i=e*Math.min(t,1-t),l=(s,o=(s+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[l(0),l(8),l(4)]}function p2(n,e,t){const i=(l,s=(l+n/60)%6)=>t-t*e*Math.max(Math.min(s,4-s,1),0);return[i(5),i(3),i(1)]}function m2(n,e,t){const i=eb(n,1,.5);let l;for(e+t>1&&(l=1/(e+t),e*=l,t*=l),l=0;l<3;l++)i[l]*=1-e-t,i[l]+=e;return i}function h2(n,e,t,i,l){return n===l?(e-t)/i+(e<t?6:0):e===l?(t-n)/i+2:(n-e)/i+4}function Oa(n){const t=n.r/255,i=n.g/255,l=n.b/255,s=Math.max(t,i,l),o=Math.min(t,i,l),r=(s+o)/2;let a,f,u;return s!==o&&(u=s-o,f=r>.5?u/(2-s-o):u/(s+o),a=h2(t,i,l,u,s),a=a*60+.5),[a|0,f||0,r]}function Ma(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Di)}function Da(n,e,t){return Ma(eb,n,e,t)}function _2(n,e,t){return Ma(m2,n,e,t)}function g2(n,e,t){return Ma(p2,n,e,t)}function tb(n){return(n%360+360)%360}function b2(n){const e=d2.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Kl(+e[5]):Di(+e[5]));const l=tb(+e[2]),s=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=_2(l,s,o):e[1]==="hsv"?i=g2(l,s,o):i=Da(l,s,o),{r:i[0],g:i[1],b:i[2],a:t}}function k2(n,e){var t=Oa(n);t[0]=tb(t[0]+e),t=Da(t),n.r=t[0],n.g=t[1],n.b=t[2]}function y2(n){if(!n)return;const e=Oa(n),t=e[0],i=ru(e[1]),l=ru(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${l}%, ${ci(n.a)})`:`hsl(${t}, ${i}%, ${l}%)`}const au={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},fu={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function v2(){const n={},e=Object.keys(fu),t=Object.keys(au);let i,l,s,o,r;for(i=0;i<e.length;i++){for(o=r=e[i],l=0;l<t.length;l++)s=t[l],r=r.replace(s,au[s]);s=parseInt(fu[o],16),n[r]=[s>>16&255,s>>8&255,s&255]}return n}let Hs;function w2(n){Hs||(Hs=v2(),Hs.transparent=[0,0,0,0]);const e=Hs[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const S2=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function $2(n){const e=S2.exec(n);let t=255,i,l,s;if(e){if(e[7]!==i){const o=+e[7];t=e[8]?Kl(o):Ti(o*255,0,255)}return i=+e[1],l=+e[3],s=+e[5],i=255&(e[2]?Kl(i):Ti(i,0,255)),l=255&(e[4]?Kl(l):Ti(l,0,255)),s=255&(e[6]?Kl(s):Ti(s,0,255)),{r:i,g:l,b:s,a:t}}}function T2(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${ci(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const mr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,_l=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function C2(n,e,t){const i=_l(ci(n.r)),l=_l(ci(n.g)),s=_l(ci(n.b));return{r:Di(mr(i+t*(_l(ci(e.r))-i))),g:Di(mr(l+t*(_l(ci(e.g))-l))),b:Di(mr(s+t*(_l(ci(e.b))-s))),a:n.a+t*(e.a-n.a)}}function zs(n,e,t){if(n){let i=Oa(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Da(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function nb(n,e){return n&&Object.assign(e||{},n)}function uu(n){var e={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(e={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(e.a=Di(n[3]))):(e=nb(n,{r:0,g:0,b:0,a:1}),e.a=Di(e.a)),e}function O2(n){return n.charAt(0)==="r"?$2(n):b2(n)}class fs{constructor(e){if(e instanceof fs)return e;const t=typeof e;let i;t==="object"?i=uu(e):t==="string"&&(i=f2(e)||w2(e)||O2(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=nb(this._rgb);return e&&(e.a=ci(e.a)),e}set rgb(e){this._rgb=uu(e)}rgbString(){return this._valid?T2(this._rgb):void 0}hexString(){return this._valid?c2(this._rgb):void 0}hslString(){return this._valid?y2(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,l=e.rgb;let s;const o=t===s?.5:t,r=2*o-1,a=i.a-l.a,f=((r*a===-1?r:(r+a)/(1+r*a))+1)/2;s=1-f,i.r=255&f*i.r+s*l.r+.5,i.g=255&f*i.g+s*l.g+.5,i.b=255&f*i.b+s*l.b+.5,i.a=o*i.a+(1-o)*l.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=C2(this._rgb,e._rgb,t)),this}clone(){return new fs(this.rgb)}alpha(e){return this._rgb.a=Di(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=Cs(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return zs(this._rgb,2,e),this}darken(e){return zs(this._rgb,2,-e),this}saturate(e){return zs(this._rgb,1,e),this}desaturate(e){return zs(this._rgb,1,-e),this}rotate(e){return k2(this._rgb,e),this}}/*!
* Chart.js v4.4.2
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/function ai(){}const M2=(()=>{let n=0;return()=>n++})();function Ht(n){return n===null||typeof n>"u"}function Zt(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function it(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function rn(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Xn(n,e){return rn(n)?n:e}function wt(n,e){return typeof n>"u"?e:n}const D2=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function qt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function gt(n,e,t,i){let l,s,o;if(Zt(n))if(s=n.length,i)for(l=s-1;l>=0;l--)e.call(t,n[l],l);else for(l=0;l<s;l++)e.call(t,n[l],l);else if(it(n))for(o=Object.keys(n),s=o.length,l=0;l<s;l++)e.call(t,n[o[l]],o[l])}function Do(n,e){let t,i,l,s;if(!n||!e||n.length!==e.length)return!1;for(t=0,i=n.length;t<i;++t)if(l=n[t],s=e[t],l.datasetIndex!==s.datasetIndex||l.index!==s.index)return!1;return!0}function Eo(n){if(Zt(n))return n.map(Eo);if(it(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let l=0;for(;l<i;++l)e[t[l]]=Eo(n[t[l]]);return e}return n}function ib(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function E2(n,e,t,i){if(!ib(n))return;const l=e[n],s=t[n];it(l)&&it(s)?us(l,s,i):e[n]=Eo(s)}function us(n,e,t){const i=Zt(e)?e:[e],l=i.length;if(!it(n))return n;t=t||{};const s=t.merger||E2;let o;for(let r=0;r<l;++r){if(o=i[r],!it(o))continue;const a=Object.keys(o);for(let f=0,u=a.length;f<u;++f)s(a[f],n,o,t)}return n}function Ql(n,e){return us(n,e,{merger:I2})}function I2(n,e,t){if(!ib(n))return;const i=e[n],l=t[n];it(i)&&it(l)?Ql(i,l):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=Eo(l))}const cu={"":n=>n,x:n=>n.x,y:n=>n.y};function A2(n){const e=n.split("."),t=[];let i="";for(const l of e)i+=l,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function L2(n){const e=A2(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function Io(n,e){return(cu[e]||(cu[e]=L2(e)))(n)}function Ea(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Ao=n=>typeof n<"u",Ei=n=>typeof n=="function",du=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function N2(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const on=Math.PI,Wn=2*on,P2=Wn+on,Lo=Number.POSITIVE_INFINITY,F2=on/180,Bn=on/2,qi=on/4,pu=on*2/3,Gr=Math.log10,Ol=Math.sign;function xl(n,e,t){return Math.abs(n-e)<t}function mu(n){const e=Math.round(n);n=xl(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Gr(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function R2(n){const e=[],t=Math.sqrt(n);let i;for(i=1;i<t;i++)n%i===0&&(e.push(i),e.push(n/i));return t===(t|0)&&e.push(t),e.sort((l,s)=>l-s).pop(),e}function cs(n){return!isNaN(parseFloat(n))&&isFinite(n)}function q2(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function j2(n,e,t){let i,l,s;for(i=0,l=n.length;i<l;i++)s=n[i][t],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Yi(n){return n*(on/180)}function H2(n){return n*(180/on)}function hu(n){if(!rn(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function z2(n,e){const t=e.x-n.x,i=e.y-n.y,l=Math.sqrt(t*t+i*i);let s=Math.atan2(i,t);return s<-.5*on&&(s+=Wn),{angle:s,distance:l}}function Xr(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function V2(n,e){return(n-e+P2)%Wn-on}function ei(n){return(n%Wn+Wn)%Wn}function lb(n,e,t,i){const l=ei(n),s=ei(e),o=ei(t),r=ei(s-l),a=ei(o-l),f=ei(l-s),u=ei(l-o);return l===s||l===o||i&&s===o||r>a&&f<u}function Un(n,e,t){return Math.max(e,Math.min(t,n))}function B2(n){return Un(n,-32768,32767)}function sb(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Ia(n,e,t){t=t||(o=>n[o]<e);let i=n.length-1,l=0,s;for(;i-l>1;)s=l+i>>1,t(s)?l=s:i=s;return{lo:l,hi:i}}const Ki=(n,e,t,i)=>Ia(n,t,i?l=>{const s=n[l][e];return s<t||s===t&&n[l+1][e]===t}:l=>n[l][e]<t),U2=(n,e,t)=>Ia(n,t,i=>n[i][e]>=t);function W2(n,e,t){let i=0,l=n.length;for(;i<l&&n[i]<e;)i++;for(;l>i&&n[l-1]>t;)l--;return i>0||l<n.length?n.slice(i,l):n}const ob=["push","pop","shift","splice","unshift"];function Y2(n,e){if(n._chartjs){n._chartjs.listeners.push(e);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ob.forEach(t=>{const i="_onData"+Ea(t),l=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...s){const o=l.apply(this,s);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...s)}),o}})})}function _u(n,e){const t=n._chartjs;if(!t)return;const i=t.listeners,l=i.indexOf(e);l!==-1&&i.splice(l,1),!(i.length>0)&&(ob.forEach(s=>{delete n[s]}),delete n._chartjs)}function K2(n){const e=new Set(n);return e.size===n.length?n:Array.from(e)}const rb=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function ab(n,e){let t=[],i=!1;return function(...l){t=l,i||(i=!0,rb.call(window,()=>{i=!1,n.apply(e,t)}))}}function J2(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const Z2=n=>n==="start"?"left":n==="end"?"right":"center",gu=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function G2(n,e,t){const i=e.length;let l=0,s=i;if(n._sorted){const{iScale:o,_parsed:r}=n,a=o.axis,{min:f,max:u,minDefined:c,maxDefined:d}=o.getUserBounds();c&&(l=Un(Math.min(Ki(r,a,f).lo,t?i:Ki(e,a,o.getPixelForValue(f)).lo),0,i-1)),d?s=Un(Math.max(Ki(r,o.axis,u,!0).hi+1,t?0:Ki(e,a,o.getPixelForValue(u),!0).hi+1),l,i)-l:s=i-l}return{start:l,count:s}}function X2(n){const{xScale:e,yScale:t,_scaleRanges:i}=n,l={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!i)return n._scaleRanges=l,!0;const s=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==t.min||i.ymax!==t.max;return Object.assign(i,l),s}const Vs=n=>n===0||n===1,bu=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*Wn/t)),ku=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*Wn/t)+1,es={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*Bn)+1,easeOutSine:n=>Math.sin(n*Bn),easeInOutSine:n=>-.5*(Math.cos(on*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Vs(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Vs(n)?n:bu(n,.075,.3),easeOutElastic:n=>Vs(n)?n:ku(n,.075,.3),easeInOutElastic(n){return Vs(n)?n:n<.5?.5*bu(n*2,.1125,.45):.5+.5*ku(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let e=1.70158;return(n/=.5)<1?.5*(n*n*(((e*=1.525)+1)*n-e)):.5*((n-=2)*n*(((e*=1.525)+1)*n+e)+2)},easeInBounce:n=>1-es.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?es.easeInBounce(n*2)*.5:es.easeOutBounce(n*2-1)*.5+.5};function Aa(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function yu(n){return Aa(n)?n:new fs(n)}function hr(n){return Aa(n)?n:new fs(n).saturate(.5).darken(.1).hexString()}const Q2=["x","y","borderWidth","radius","tension"],x2=["color","borderColor","backgroundColor"];function ew(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),n.set("animations",{colors:{type:"color",properties:x2},numbers:{type:"number",properties:Q2}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function tw(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const vu=new Map;function nw(n,e){e=e||{};const t=n+JSON.stringify(e);let i=vu.get(t);return i||(i=new Intl.NumberFormat(n,e),vu.set(t,i)),i}function fb(n,e,t){return nw(e,t).format(n)}const ub={values(n){return Zt(n)?n:""+n},numeric(n,e,t){if(n===0)return"0";const i=this.chart.options.locale;let l,s=n;if(t.length>1){const f=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(f<1e-4||f>1e15)&&(l="scientific"),s=iw(n,t)}const o=Gr(Math.abs(s)),r=isNaN(o)?1:Math.max(Math.min(-1*Math.floor(o),20),0),a={notation:l,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(a,this.options.ticks.format),fb(n,i,a)},logarithmic(n,e,t){if(n===0)return"0";const i=t[e].significand||n/Math.pow(10,Math.floor(Gr(n)));return[1,2,3,5,10,15].includes(i)||e>.8*t.length?ub.numeric.call(this,n,e,t):""}};function iw(n,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&n!==Math.floor(n)&&(t=n-Math.floor(n)),t}var cb={formatters:ub};function lw(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:cb.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const xi=Object.create(null),Qr=Object.create(null);function ts(n,e){if(!e)return n;const t=e.split(".");for(let i=0,l=t.length;i<l;++i){const s=t[i];n=n[s]||(n[s]=Object.create(null))}return n}function _r(n,e,t){return typeof e=="string"?us(ts(n,e),t):us(ts(n,""),e)}class sw{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,l)=>hr(l.backgroundColor),this.hoverBorderColor=(i,l)=>hr(l.borderColor),this.hoverColor=(i,l)=>hr(l.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return _r(this,e,t)}get(e){return ts(this,e)}describe(e,t){return _r(Qr,e,t)}override(e,t){return _r(xi,e,t)}route(e,t,i,l){const s=ts(this,e),o=ts(this,i),r="_"+t;Object.defineProperties(s,{[r]:{value:s[t],writable:!0},[t]:{enumerable:!0,get(){const a=this[r],f=o[l];return it(a)?Object.assign({},f,a):wt(a,f)},set(a){this[r]=a}}})}apply(e){e.forEach(t=>t(this))}}var Wt=new sw({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[ew,tw,lw]);function ow(n){return!n||Ht(n.size)||Ht(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function wu(n,e,t,i,l){let s=e[l];return s||(s=e[l]=n.measureText(l).width,t.push(l)),s>i&&(i=s),i}function ji(n,e,t){const i=n.currentDevicePixelRatio,l=t!==0?Math.max(t/2,.5):0;return Math.round((e-l)*i)/i+l}function Su(n,e){e=e||n.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,n.width,n.height),e.restore()}function xr(n,e,t,i){rw(n,e,t,i,null)}function rw(n,e,t,i,l){let s,o,r,a,f,u,c,d;const m=e.pointStyle,h=e.rotation,_=e.radius;let g=(h||0)*F2;if(m&&typeof m=="object"&&(s=m.toString(),s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]")){n.save(),n.translate(t,i),n.rotate(g),n.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),n.restore();return}if(!(isNaN(_)||_<=0)){switch(n.beginPath(),m){default:l?n.ellipse(t,i,l/2,_,0,0,Wn):n.arc(t,i,_,0,Wn),n.closePath();break;case"triangle":u=l?l/2:_,n.moveTo(t+Math.sin(g)*u,i-Math.cos(g)*_),g+=pu,n.lineTo(t+Math.sin(g)*u,i-Math.cos(g)*_),g+=pu,n.lineTo(t+Math.sin(g)*u,i-Math.cos(g)*_),n.closePath();break;case"rectRounded":f=_*.516,a=_-f,o=Math.cos(g+qi)*a,c=Math.cos(g+qi)*(l?l/2-f:a),r=Math.sin(g+qi)*a,d=Math.sin(g+qi)*(l?l/2-f:a),n.arc(t-c,i-r,f,g-on,g-Bn),n.arc(t+d,i-o,f,g-Bn,g),n.arc(t+c,i+r,f,g,g+Bn),n.arc(t-d,i+o,f,g+Bn,g+on),n.closePath();break;case"rect":if(!h){a=Math.SQRT1_2*_,u=l?l/2:a,n.rect(t-u,i-a,2*u,2*a);break}g+=qi;case"rectRot":c=Math.cos(g)*(l?l/2:_),o=Math.cos(g)*_,r=Math.sin(g)*_,d=Math.sin(g)*(l?l/2:_),n.moveTo(t-c,i-r),n.lineTo(t+d,i-o),n.lineTo(t+c,i+r),n.lineTo(t-d,i+o),n.closePath();break;case"crossRot":g+=qi;case"cross":c=Math.cos(g)*(l?l/2:_),o=Math.cos(g)*_,r=Math.sin(g)*_,d=Math.sin(g)*(l?l/2:_),n.moveTo(t-c,i-r),n.lineTo(t+c,i+r),n.moveTo(t+d,i-o),n.lineTo(t-d,i+o);break;case"star":c=Math.cos(g)*(l?l/2:_),o=Math.cos(g)*_,r=Math.sin(g)*_,d=Math.sin(g)*(l?l/2:_),n.moveTo(t-c,i-r),n.lineTo(t+c,i+r),n.moveTo(t+d,i-o),n.lineTo(t-d,i+o),g+=qi,c=Math.cos(g)*(l?l/2:_),o=Math.cos(g)*_,r=Math.sin(g)*_,d=Math.sin(g)*(l?l/2:_),n.moveTo(t-c,i-r),n.lineTo(t+c,i+r),n.moveTo(t+d,i-o),n.lineTo(t-d,i+o);break;case"line":o=l?l/2:Math.cos(g)*_,r=Math.sin(g)*_,n.moveTo(t-o,i-r),n.lineTo(t+o,i+r);break;case"dash":n.moveTo(t,i),n.lineTo(t+Math.cos(g)*(l?l/2:_),i+Math.sin(g)*_);break;case!1:n.closePath();break}n.fill(),e.borderWidth>0&&n.stroke()}}function ds(n,e,t){return t=t||.5,!e||n&&n.x>e.left-t&&n.x<e.right+t&&n.y>e.top-t&&n.y<e.bottom+t}function La(n,e){n.save(),n.beginPath(),n.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),n.clip()}function Na(n){n.restore()}function aw(n,e,t,i,l){if(!e)return n.lineTo(t.x,t.y);if(l==="middle"){const s=(e.x+t.x)/2;n.lineTo(s,e.y),n.lineTo(s,t.y)}else l==="after"!=!!i?n.lineTo(e.x,t.y):n.lineTo(t.x,e.y);n.lineTo(t.x,t.y)}function fw(n,e,t,i){if(!e)return n.lineTo(t.x,t.y);n.bezierCurveTo(i?e.cp1x:e.cp2x,i?e.cp1y:e.cp2y,i?t.cp2x:t.cp1x,i?t.cp2y:t.cp1y,t.x,t.y)}function uw(n,e){e.translation&&n.translate(e.translation[0],e.translation[1]),Ht(e.rotation)||n.rotate(e.rotation),e.color&&(n.fillStyle=e.color),e.textAlign&&(n.textAlign=e.textAlign),e.textBaseline&&(n.textBaseline=e.textBaseline)}function cw(n,e,t,i,l){if(l.strikethrough||l.underline){const s=n.measureText(i),o=e-s.actualBoundingBoxLeft,r=e+s.actualBoundingBoxRight,a=t-s.actualBoundingBoxAscent,f=t+s.actualBoundingBoxDescent,u=l.strikethrough?(a+f)/2:f;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=l.decorationWidth||2,n.moveTo(o,u),n.lineTo(r,u),n.stroke()}}function dw(n,e){const t=n.fillStyle;n.fillStyle=e.color,n.fillRect(e.left,e.top,e.width,e.height),n.fillStyle=t}function $u(n,e,t,i,l,s={}){const o=Zt(e)?e:[e],r=s.strokeWidth>0&&s.strokeColor!=="";let a,f;for(n.save(),n.font=l.string,uw(n,s),a=0;a<o.length;++a)f=o[a],s.backdrop&&dw(n,s.backdrop),r&&(s.strokeColor&&(n.strokeStyle=s.strokeColor),Ht(s.strokeWidth)||(n.lineWidth=s.strokeWidth),n.strokeText(f,t,i,s.maxWidth)),n.fillText(f,t,i,s.maxWidth),cw(n,t,i,f,s),i+=Number(l.lineHeight);n.restore()}function Tu(n,e){const{x:t,y:i,w:l,h:s,radius:o}=e;n.arc(t+o.topLeft,i+o.topLeft,o.topLeft,1.5*on,on,!0),n.lineTo(t,i+s-o.bottomLeft),n.arc(t+o.bottomLeft,i+s-o.bottomLeft,o.bottomLeft,on,Bn,!0),n.lineTo(t+l-o.bottomRight,i+s),n.arc(t+l-o.bottomRight,i+s-o.bottomRight,o.bottomRight,Bn,0,!0),n.lineTo(t+l,i+o.topRight),n.arc(t+l-o.topRight,i+o.topRight,o.topRight,0,-Bn,!0),n.lineTo(t+o.topLeft,i)}const pw=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,mw=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function hw(n,e){const t=(""+n).match(pw);if(!t||t[1]==="normal")return e*1.2;switch(n=+t[2],t[3]){case"px":return n;case"%":n/=100;break}return e*n}const _w=n=>+n||0;function db(n,e){const t={},i=it(e),l=i?Object.keys(e):e,s=it(n)?i?o=>wt(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of l)t[o]=_w(s(o));return t}function gw(n){return db(n,{top:"y",right:"x",bottom:"y",left:"x"})}function uo(n){return db(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Ii(n){const e=gw(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ni(n,e){n=n||{},e=e||Wt.font;let t=wt(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=wt(n.style,e.style);i&&!(""+i).match(mw)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const l={family:wt(n.family,e.family),lineHeight:hw(wt(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:wt(n.weight,e.weight),string:""};return l.string=ow(l),l}function Bs(n,e,t,i){let l=!0,s,o,r;for(s=0,o=n.length;s<o;++s)if(r=n[s],r!==void 0&&(e!==void 0&&typeof r=="function"&&(r=r(e),l=!1),t!==void 0&&Zt(r)&&(r=r[t%r.length],l=!1),r!==void 0))return i&&!l&&(i.cacheable=!1),r}function bw(n,e,t){const{min:i,max:l}=n,s=D2(e,(l-i)/2),o=(r,a)=>t&&r===0?0:r+a;return{min:o(i,-Math.abs(s)),max:o(l,s)}}function sl(n,e){return Object.assign(Object.create(n),e)}function Pa(n,e=[""],t,i,l=()=>n[0]){const s=t||n;typeof i>"u"&&(i=_b("_fallback",n));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:s,_fallback:i,_getTarget:l,override:r=>Pa([r,...n],e,s,i)};return new Proxy(o,{deleteProperty(r,a){return delete r[a],delete r._keys,delete n[0][a],!0},get(r,a){return mb(r,a,()=>Cw(a,e,n,r))},getOwnPropertyDescriptor(r,a){return Reflect.getOwnPropertyDescriptor(r._scopes[0],a)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(r,a){return Ou(r).includes(a)},ownKeys(r){return Ou(r)},set(r,a,f){const u=r._storage||(r._storage=l());return r[a]=u[a]=f,delete r._keys,!0}})}function Ml(n,e,t,i){const l={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:pb(n,i),setContext:s=>Ml(n,s,t,i),override:s=>Ml(n.override(s),e,t,i)};return new Proxy(l,{deleteProperty(s,o){return delete s[o],delete n[o],!0},get(s,o,r){return mb(s,o,()=>yw(s,o,r))},getOwnPropertyDescriptor(s,o){return s._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(s,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(s,o,r){return n[o]=r,delete s[o],!0}})}function pb(n,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:i=e.indexable,_allKeys:l=e.allKeys}=n;return{allKeys:l,scriptable:t,indexable:i,isScriptable:Ei(t)?t:()=>t,isIndexable:Ei(i)?i:()=>i}}const kw=(n,e)=>n?n+Ea(e):e,Fa=(n,e)=>it(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function mb(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];const i=t();return n[e]=i,i}function yw(n,e,t){const{_proxy:i,_context:l,_subProxy:s,_descriptors:o}=n;let r=i[e];return Ei(r)&&o.isScriptable(e)&&(r=vw(e,r,n,t)),Zt(r)&&r.length&&(r=ww(e,r,n,o.isIndexable)),Fa(e,r)&&(r=Ml(r,l,s&&s[e],o)),r}function vw(n,e,t,i){const{_proxy:l,_context:s,_subProxy:o,_stack:r}=t;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);r.add(n);let a=e(s,o||i);return r.delete(n),Fa(n,a)&&(a=Ra(l._scopes,l,n,a)),a}function ww(n,e,t,i){const{_proxy:l,_context:s,_subProxy:o,_descriptors:r}=t;if(typeof s.index<"u"&&i(n))return e[s.index%e.length];if(it(e[0])){const a=e,f=l._scopes.filter(u=>u!==a);e=[];for(const u of a){const c=Ra(f,l,n,u);e.push(Ml(c,s,o&&o[n],r))}}return e}function hb(n,e,t){return Ei(n)?n(e,t):n}const Sw=(n,e)=>n===!0?e:typeof n=="string"?Io(e,n):void 0;function $w(n,e,t,i,l){for(const s of e){const o=Sw(t,s);if(o){n.add(o);const r=hb(o._fallback,t,l);if(typeof r<"u"&&r!==t&&r!==i)return r}else if(o===!1&&typeof i<"u"&&t!==i)return null}return!1}function Ra(n,e,t,i){const l=e._rootScopes,s=hb(e._fallback,t,i),o=[...n,...l],r=new Set;r.add(i);let a=Cu(r,o,t,s||t,i);return a===null||typeof s<"u"&&s!==t&&(a=Cu(r,o,s,a,i),a===null)?!1:Pa(Array.from(r),[""],l,s,()=>Tw(e,t,i))}function Cu(n,e,t,i,l){for(;t;)t=$w(n,e,t,i,l);return t}function Tw(n,e,t){const i=n._getTarget();e in i||(i[e]={});const l=i[e];return Zt(l)&&it(t)?t:l||{}}function Cw(n,e,t,i){let l;for(const s of e)if(l=_b(kw(s,n),t),typeof l<"u")return Fa(n,l)?Ra(t,i,n,l):l}function _b(n,e){for(const t of e){if(!t)continue;const i=t[n];if(typeof i<"u")return i}}function Ou(n){let e=n._keys;return e||(e=n._keys=Ow(n._scopes)),e}function Ow(n){const e=new Set;for(const t of n)for(const i of Object.keys(t).filter(l=>!l.startsWith("_")))e.add(i);return Array.from(e)}const Mw=Number.EPSILON||1e-14,Dl=(n,e)=>e<n.length&&!n[e].skip&&n[e],gb=n=>n==="x"?"y":"x";function Dw(n,e,t,i){const l=n.skip?e:n,s=e,o=t.skip?e:t,r=Xr(s,l),a=Xr(o,s);let f=r/(r+a),u=a/(r+a);f=isNaN(f)?0:f,u=isNaN(u)?0:u;const c=i*f,d=i*u;return{previous:{x:s.x-c*(o.x-l.x),y:s.y-c*(o.y-l.y)},next:{x:s.x+d*(o.x-l.x),y:s.y+d*(o.y-l.y)}}}function Ew(n,e,t){const i=n.length;let l,s,o,r,a,f=Dl(n,0);for(let u=0;u<i-1;++u)if(a=f,f=Dl(n,u+1),!(!a||!f)){if(xl(e[u],0,Mw)){t[u]=t[u+1]=0;continue}l=t[u]/e[u],s=t[u+1]/e[u],r=Math.pow(l,2)+Math.pow(s,2),!(r<=9)&&(o=3/Math.sqrt(r),t[u]=l*o*e[u],t[u+1]=s*o*e[u])}}function Iw(n,e,t="x"){const i=gb(t),l=n.length;let s,o,r,a=Dl(n,0);for(let f=0;f<l;++f){if(o=r,r=a,a=Dl(n,f+1),!r)continue;const u=r[t],c=r[i];o&&(s=(u-o[t])/3,r[`cp1${t}`]=u-s,r[`cp1${i}`]=c-s*e[f]),a&&(s=(a[t]-u)/3,r[`cp2${t}`]=u+s,r[`cp2${i}`]=c+s*e[f])}}function Aw(n,e="x"){const t=gb(e),i=n.length,l=Array(i).fill(0),s=Array(i);let o,r,a,f=Dl(n,0);for(o=0;o<i;++o)if(r=a,a=f,f=Dl(n,o+1),!!a){if(f){const u=f[e]-a[e];l[o]=u!==0?(f[t]-a[t])/u:0}s[o]=r?f?Ol(l[o-1])!==Ol(l[o])?0:(l[o-1]+l[o])/2:l[o-1]:l[o]}Ew(n,l,s),Iw(n,s,e)}function Us(n,e,t){return Math.max(Math.min(n,t),e)}function Lw(n,e){let t,i,l,s,o,r=ds(n[0],e);for(t=0,i=n.length;t<i;++t)o=s,s=r,r=t<i-1&&ds(n[t+1],e),s&&(l=n[t],o&&(l.cp1x=Us(l.cp1x,e.left,e.right),l.cp1y=Us(l.cp1y,e.top,e.bottom)),r&&(l.cp2x=Us(l.cp2x,e.left,e.right),l.cp2y=Us(l.cp2y,e.top,e.bottom)))}function Nw(n,e,t,i,l){let s,o,r,a;if(e.spanGaps&&(n=n.filter(f=>!f.skip)),e.cubicInterpolationMode==="monotone")Aw(n,l);else{let f=i?n[n.length-1]:n[0];for(s=0,o=n.length;s<o;++s)r=n[s],a=Dw(f,r,n[Math.min(s+1,o-(i?0:1))%o],e.tension),r.cp1x=a.previous.x,r.cp1y=a.previous.y,r.cp2x=a.next.x,r.cp2y=a.next.y,f=r}e.capBezierPoints&&Lw(n,t)}function qa(){return typeof window<"u"&&typeof document<"u"}function ja(n){let e=n.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function No(n,e,t){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*e.parentNode[t])):i=n,i}const Qo=n=>n.ownerDocument.defaultView.getComputedStyle(n,null);function Pw(n,e){return Qo(n).getPropertyValue(e)}const Fw=["top","right","bottom","left"];function Gi(n,e,t){const i={};t=t?"-"+t:"";for(let l=0;l<4;l++){const s=Fw[l];i[s]=parseFloat(n[e+"-"+s+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Rw=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function qw(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:l,offsetY:s}=i;let o=!1,r,a;if(Rw(l,s,n.target))r=l,a=s;else{const f=e.getBoundingClientRect();r=i.clientX-f.left,a=i.clientY-f.top,o=!0}return{x:r,y:a,box:o}}function Vi(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,l=Qo(t),s=l.boxSizing==="border-box",o=Gi(l,"padding"),r=Gi(l,"border","width"),{x:a,y:f,box:u}=qw(n,t),c=o.left+(u&&r.left),d=o.top+(u&&r.top);let{width:m,height:h}=e;return s&&(m-=o.width+r.width,h-=o.height+r.height),{x:Math.round((a-c)/m*t.width/i),y:Math.round((f-d)/h*t.height/i)}}function jw(n,e,t){let i,l;if(e===void 0||t===void 0){const s=ja(n);if(!s)e=n.clientWidth,t=n.clientHeight;else{const o=s.getBoundingClientRect(),r=Qo(s),a=Gi(r,"border","width"),f=Gi(r,"padding");e=o.width-f.width-a.width,t=o.height-f.height-a.height,i=No(r.maxWidth,s,"clientWidth"),l=No(r.maxHeight,s,"clientHeight")}}return{width:e,height:t,maxWidth:i||Lo,maxHeight:l||Lo}}const Ws=n=>Math.round(n*10)/10;function Hw(n,e,t,i){const l=Qo(n),s=Gi(l,"margin"),o=No(l.maxWidth,n,"clientWidth")||Lo,r=No(l.maxHeight,n,"clientHeight")||Lo,a=jw(n,e,t);let{width:f,height:u}=a;if(l.boxSizing==="content-box"){const d=Gi(l,"border","width"),m=Gi(l,"padding");f-=m.width+d.width,u-=m.height+d.height}return f=Math.max(0,f-s.width),u=Math.max(0,i?f/i:u-s.height),f=Ws(Math.min(f,o,a.maxWidth)),u=Ws(Math.min(u,r,a.maxHeight)),f&&!u&&(u=Ws(f/2)),(e!==void 0||t!==void 0)&&i&&a.height&&u>a.height&&(u=a.height,f=Ws(Math.floor(u*i))),{width:f,height:u}}function Mu(n,e,t){const i=e||1,l=Math.floor(n.height*i),s=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==l||o.width!==s?(n.currentDevicePixelRatio=i,o.height=l,o.width=s,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const zw=function(){let n=!1;try{const e={get passive(){return n=!0,!1}};qa()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return n}();function Du(n,e){const t=Pw(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Bi(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function Vw(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:i==="middle"?t<.5?n.y:e.y:i==="after"?t<1?n.y:e.y:t>0?e.y:n.y}}function Bw(n,e,t,i){const l={x:n.cp2x,y:n.cp2y},s={x:e.cp1x,y:e.cp1y},o=Bi(n,l,t),r=Bi(l,s,t),a=Bi(s,e,t),f=Bi(o,r,t),u=Bi(r,a,t);return Bi(f,u,t)}const Uw=function(n,e){return{x(t){return n+n+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,i){return t-i},leftForLtr(t,i){return t-i}}},Ww=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function gr(n,e,t){return n?Uw(e,t):Ww()}function Yw(n,e){let t,i;(e==="ltr"||e==="rtl")&&(t=n.canvas.style,i=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),n.prevTextDirection=i)}function Kw(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function bb(n){return n==="angle"?{between:lb,compare:V2,normalize:ei}:{between:sb,compare:(e,t)=>e-t,normalize:e=>e}}function Eu({start:n,end:e,count:t,loop:i,style:l}){return{start:n%t,end:e%t,loop:i&&(e-n+1)%t===0,style:l}}function Jw(n,e,t){const{property:i,start:l,end:s}=t,{between:o,normalize:r}=bb(i),a=e.length;let{start:f,end:u,loop:c}=n,d,m;if(c){for(f+=a,u+=a,d=0,m=a;d<m&&o(r(e[f%a][i]),l,s);++d)f--,u--;f%=a,u%=a}return u<f&&(u+=a),{start:f,end:u,loop:c,style:n.style}}function kb(n,e,t){if(!t)return[n];const{property:i,start:l,end:s}=t,o=e.length,{compare:r,between:a,normalize:f}=bb(i),{start:u,end:c,loop:d,style:m}=Jw(n,e,t),h=[];let _=!1,g=null,v,$,C;const T=()=>a(l,C,v)&&r(l,C)!==0,O=()=>r(s,v)===0||a(s,C,v),M=()=>_||T(),E=()=>!_||O();for(let A=u,N=u;A<=c;++A)$=e[A%o],!$.skip&&(v=f($[i]),v!==C&&(_=a(v,l,s),g===null&&M()&&(g=r(v,l)===0?A:N),g!==null&&E()&&(h.push(Eu({start:g,end:A,loop:d,count:o,style:m})),g=null),N=A,C=v));return g!==null&&h.push(Eu({start:g,end:c,loop:d,count:o,style:m})),h}function yb(n,e){const t=[],i=n.segments;for(let l=0;l<i.length;l++){const s=kb(i[l],n.points,e);s.length&&t.push(...s)}return t}function Zw(n,e,t,i){let l=0,s=e-1;if(t&&!i)for(;l<e&&!n[l].skip;)l++;for(;l<e&&n[l].skip;)l++;for(l%=e,t&&(s+=l);s>l&&n[s%e].skip;)s--;return s%=e,{start:l,end:s}}function Gw(n,e,t,i){const l=n.length,s=[];let o=e,r=n[e],a;for(a=e+1;a<=t;++a){const f=n[a%l];f.skip||f.stop?r.skip||(i=!1,s.push({start:e%l,end:(a-1)%l,loop:i}),e=o=f.stop?a:null):(o=a,r.skip&&(e=a)),r=f}return o!==null&&s.push({start:e%l,end:o%l,loop:i}),s}function Xw(n,e){const t=n.points,i=n.options.spanGaps,l=t.length;if(!l)return[];const s=!!n._loop,{start:o,end:r}=Zw(t,l,s,i);if(i===!0)return Iu(n,[{start:o,end:r,loop:s}],t,e);const a=r<o?r+l:r,f=!!n._fullLoop&&o===0&&r===l-1;return Iu(n,Gw(t,o,a,f),t,e)}function Iu(n,e,t,i){return!i||!i.setContext||!t?e:Qw(n,e,t,i)}function Qw(n,e,t,i){const l=n._chart.getContext(),s=Au(n.options),{_datasetIndex:o,options:{spanGaps:r}}=n,a=t.length,f=[];let u=s,c=e[0].start,d=c;function m(h,_,g,v){const $=r?-1:1;if(h!==_){for(h+=a;t[h%a].skip;)h-=$;for(;t[_%a].skip;)_+=$;h%a!==_%a&&(f.push({start:h%a,end:_%a,loop:g,style:v}),u=v,c=_%a)}}for(const h of e){c=r?c:h.start;let _=t[c%a],g;for(d=c+1;d<=h.end;d++){const v=t[d%a];g=Au(i.setContext(sl(l,{type:"segment",p0:_,p1:v,p0DataIndex:(d-1)%a,p1DataIndex:d%a,datasetIndex:o}))),xw(g,u)&&m(c,d-1,h.loop,u),_=v,u=g}c<d-1&&m(c,d-1,h.loop,u)}return f}function Au(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function xw(n,e){if(!e)return!1;const t=[],i=function(l,s){return Aa(s)?(t.includes(s)||t.push(s),t.indexOf(s)):s};return JSON.stringify(n,i)!==JSON.stringify(e,i)}/*!
* Chart.js v4.4.2
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/class e3{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,l){const s=t.listeners[l],o=t.duration;s.forEach(r=>r({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=rb.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,l)=>{if(!i.running||!i.items.length)return;const s=i.items;let o=s.length-1,r=!1,a;for(;o>=0;--o)a=s[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(s[o]=s[s.length-1],s.pop());r&&(l.draw(),this._notify(l,i,e,"progress")),s.length||(i.running=!1,this._notify(l,i,e,"complete"),i.initial=!1),t+=s.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,l)=>Math.max(i,l._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let l=i.length-1;for(;l>=0;--l)i[l].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var fi=new e3;const Lu="transparent",t3={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=yu(n||Lu),l=i.valid&&yu(e||Lu);return l&&l.valid?l.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class n3{constructor(e,t,i,l){const s=t[i];l=Bs([e.to,l,s,e.from]);const o=Bs([e.from,s,l]);this._active=!0,this._fn=e.fn||t3[e.type||typeof o],this._easing=es[e.easing]||es.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=l,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const l=this._target[this._prop],s=i-this._start,o=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=Bs([e.to,t,l,e.from]),this._from=Bs([e.from,l,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,l=this._prop,s=this._from,o=this._loop,r=this._to;let a;if(this._active=s!==r&&(o||t<i),!this._active){this._target[l]=r,this._notify(!0);return}if(t<0){this._target[l]=s;return}a=t/i%2,a=o&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[l]=this._fn(s,r,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let l=0;l<i.length;l++)i[l][t]()}}class vb{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!it(e))return;const t=Object.keys(Wt.animation),i=this._properties;Object.getOwnPropertyNames(e).forEach(l=>{const s=e[l];if(!it(s))return;const o={};for(const r of t)o[r]=s[r];(Zt(s.properties)&&s.properties||[l]).forEach(r=>{(r===l||!i.has(r))&&i.set(r,o)})})}_animateOptions(e,t){const i=t.options,l=l3(e,i);if(!l)return[];const s=this._createAnimations(l,i);return i.$shared&&i3(e.options.$animations,i).then(()=>{e.options=i},()=>{}),s}_createAnimations(e,t){const i=this._properties,l=[],s=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const f=o[a];if(f.charAt(0)==="$")continue;if(f==="options"){l.push(...this._animateOptions(e,t));continue}const u=t[f];let c=s[f];const d=i.get(f);if(c)if(d&&c.active()){c.update(d,u,r);continue}else c.cancel();if(!d||!d.duration){e[f]=u;continue}s[f]=c=new n3(d,e,f,u),l.push(c)}return l}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return fi.add(this._chart,i),!0}}function i3(n,e){const t=[],i=Object.keys(e);for(let l=0;l<i.length;l++){const s=n[i[l]];s&&s.active()&&t.push(s.wait())}return Promise.all(t)}function l3(n,e){if(!e)return;let t=n.options;if(!t){n.options=e;return}return t.$shared&&(n.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function Nu(n,e){const t=n&&n.options||{},i=t.reverse,l=t.min===void 0?e:0,s=t.max===void 0?e:0;return{start:i?s:l,end:i?l:s}}function s3(n,e,t){if(t===!1)return!1;const i=Nu(n,t),l=Nu(e,t);return{top:l.end,right:i.end,bottom:l.start,left:i.start}}function o3(n){let e,t,i,l;return it(n)?(e=n.top,t=n.right,i=n.bottom,l=n.left):e=t=i=l=n,{top:e,right:t,bottom:i,left:l,disabled:n===!1}}function wb(n,e){const t=[],i=n._getSortedDatasetMetas(e);let l,s;for(l=0,s=i.length;l<s;++l)t.push(i[l].index);return t}function Pu(n,e,t,i={}){const l=n.keys,s=i.mode==="single";let o,r,a,f;if(e!==null){for(o=0,r=l.length;o<r;++o){if(a=+l[o],a===t){if(i.all)continue;break}f=n.values[a],rn(f)&&(s||e===0||Ol(e)===Ol(f))&&(e+=f)}return e}}function r3(n){const e=Object.keys(n),t=new Array(e.length);let i,l,s;for(i=0,l=e.length;i<l;++i)s=e[i],t[i]={x:s,y:n[s]};return t}function Fu(n,e){const t=n&&n.options.stacked;return t||t===void 0&&e.stack!==void 0}function a3(n,e,t){return`${n.id}.${e.id}.${t.stack||t.type}`}function f3(n){const{min:e,max:t,minDefined:i,maxDefined:l}=n.getUserBounds();return{min:i?e:Number.NEGATIVE_INFINITY,max:l?t:Number.POSITIVE_INFINITY}}function u3(n,e,t){const i=n[e]||(n[e]={});return i[t]||(i[t]={})}function Ru(n,e,t,i){for(const l of e.getMatchingVisibleMetas(i).reverse()){const s=n[l.index];if(t&&s>0||!t&&s<0)return l.index}return null}function qu(n,e){const{chart:t,_cachedMeta:i}=n,l=t._stacks||(t._stacks={}),{iScale:s,vScale:o,index:r}=i,a=s.axis,f=o.axis,u=a3(s,o,i),c=e.length;let d;for(let m=0;m<c;++m){const h=e[m],{[a]:_,[f]:g}=h,v=h._stacks||(h._stacks={});d=v[f]=u3(l,u,_),d[r]=g,d._top=Ru(d,o,!0,i.type),d._bottom=Ru(d,o,!1,i.type);const $=d._visualValues||(d._visualValues={});$[r]=g}}function br(n,e){const t=n.scales;return Object.keys(t).filter(i=>t[i].axis===e).shift()}function c3(n,e){return sl(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function d3(n,e,t){return sl(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function zl(n,e){const t=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){e=e||n._parsed;for(const l of e){const s=l._stacks;if(!s||s[i]===void 0||s[i][t]===void 0)return;delete s[i][t],s[i]._visualValues!==void 0&&s[i]._visualValues[t]!==void 0&&delete s[i]._visualValues[t]}}}const kr=n=>n==="reset"||n==="none",ju=(n,e)=>e?n:Object.assign({},n),p3=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:wb(t,!0),values:null};class ns{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Fu(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&zl(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),l=(c,d,m,h)=>c==="x"?d:c==="r"?h:m,s=t.xAxisID=wt(i.xAxisID,br(e,"x")),o=t.yAxisID=wt(i.yAxisID,br(e,"y")),r=t.rAxisID=wt(i.rAxisID,br(e,"r")),a=t.indexAxis,f=t.iAxisID=l(a,s,o,r),u=t.vAxisID=l(a,o,s,r);t.xScale=this.getScaleForId(s),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(r),t.iScale=this.getScaleForId(f),t.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&_u(this._data,this),e._stacked&&zl(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(it(t))this._data=r3(t);else if(i!==t){if(i){_u(i,this);const l=this._cachedMeta;zl(l),l._parsed=[]}t&&Object.isExtensible(t)&&Y2(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let l=!1;this._dataCheck();const s=t._stacked;t._stacked=Fu(t.vScale,t),t.stack!==i.stack&&(l=!0,zl(t),t.stack=i.stack),this._resyncElements(e),(l||s!==t._stacked)&&qu(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:l}=this,{iScale:s,_stacked:o}=i,r=s.axis;let a=e===0&&t===l.length?!0:i._sorted,f=e>0&&i._parsed[e-1],u,c,d;if(this._parsing===!1)i._parsed=l,i._sorted=!0,d=l;else{Zt(l[e])?d=this.parseArrayData(i,l,e,t):it(l[e])?d=this.parseObjectData(i,l,e,t):d=this.parsePrimitiveData(i,l,e,t);const m=()=>c[r]===null||f&&c[r]<f[r];for(u=0;u<t;++u)i._parsed[u+e]=c=d[u],a&&(m()&&(a=!1),f=c);i._sorted=a}o&&qu(this,d)}parsePrimitiveData(e,t,i,l){const{iScale:s,vScale:o}=e,r=s.axis,a=o.axis,f=s.getLabels(),u=s===o,c=new Array(l);let d,m,h;for(d=0,m=l;d<m;++d)h=d+i,c[d]={[r]:u||s.parse(f[h],h),[a]:o.parse(t[h],h)};return c}parseArrayData(e,t,i,l){const{xScale:s,yScale:o}=e,r=new Array(l);let a,f,u,c;for(a=0,f=l;a<f;++a)u=a+i,c=t[u],r[a]={x:s.parse(c[0],u),y:o.parse(c[1],u)};return r}parseObjectData(e,t,i,l){const{xScale:s,yScale:o}=e,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,f=new Array(l);let u,c,d,m;for(u=0,c=l;u<c;++u)d=u+i,m=t[d],f[u]={x:s.parse(Io(m,r),d),y:o.parse(Io(m,a),d)};return f}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,i){const l=this.chart,s=this._cachedMeta,o=t[e.axis],r={keys:wb(l,!0),values:t._stacks[e.axis]._visualValues};return Pu(r,o,s.index,{mode:i})}updateRangeFromParsed(e,t,i,l){const s=i[t.axis];let o=s===null?NaN:s;const r=l&&i._stacks[t.axis];l&&r&&(l.values=r,o=Pu(l,s,this._cachedMeta.index)),e.min=Math.min(e.min,o),e.max=Math.max(e.max,o)}getMinMax(e,t){const i=this._cachedMeta,l=i._parsed,s=i._sorted&&e===i.iScale,o=l.length,r=this._getOtherScale(e),a=p3(t,i,this.chart),f={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:c}=f3(r);let d,m;function h(){m=l[d];const _=m[r.axis];return!rn(m[e.axis])||u>_||c<_}for(d=0;d<o&&!(!h()&&(this.updateRangeFromParsed(f,e,m,a),s));++d);if(s){for(d=o-1;d>=0;--d)if(!h()){this.updateRangeFromParsed(f,e,m,a);break}}return f}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let l,s,o;for(l=0,s=t.length;l<s;++l)o=t[l][e.axis],rn(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(e){const t=this._cachedMeta,i=t.iScale,l=t.vScale,s=this.getParsed(e);return{label:i?""+i.getLabelForValue(s[i.axis]):"",value:l?""+l.getLabelForValue(s[l.axis]):""}}_update(e){const t=this._cachedMeta;this.update(e||"default"),t._clip=o3(wt(this.options.clip,s3(t.xScale,t.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,t=this.chart,i=this._cachedMeta,l=i.data||[],s=t.chartArea,o=[],r=this._drawStart||0,a=this._drawCount||l.length-r,f=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(e,s,r,a),u=r;u<r+a;++u){const c=l[u];c.hidden||(c.active&&f?o.push(c):c.draw(e,s))}for(u=0;u<o.length;++u)o[u].draw(e,s)}getStyle(e,t){const i=t?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(e||0,i)}getContext(e,t,i){const l=this.getDataset();let s;if(e>=0&&e<this._cachedMeta.data.length){const o=this._cachedMeta.data[e];s=o.$context||(o.$context=d3(this.getContext(),e,o)),s.parsed=this.getParsed(e),s.raw=l.data[e],s.index=s.dataIndex=e}else s=this.$context||(this.$context=c3(this.chart.getContext(),this.index)),s.dataset=l,s.index=s.datasetIndex=this.index;return s.active=!!t,s.mode=i,s}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",i){const l=t==="active",s=this._cachedDataOpts,o=e+"-"+t,r=s[o],a=this.enableOptionSharing&&Ao(i);if(r)return ju(r,a);const f=this.chart.config,u=f.datasetElementScopeKeys(this._type,e),c=l?[`${e}Hover`,"hover",e,""]:[e,""],d=f.getOptionScopes(this.getDataset(),u),m=Object.keys(Wt.elements[e]),h=()=>this.getContext(i,l,t),_=f.resolveNamedOptions(d,m,h,c);return _.$shared&&(_.$shared=a,s[o]=Object.freeze(ju(_,a))),_}_resolveAnimations(e,t,i){const l=this.chart,s=this._cachedDataOpts,o=`animation-${t}`,r=s[o];if(r)return r;let a;if(l.options.animation!==!1){const u=this.chart.config,c=u.datasetAnimationScopeKeys(this._type,t),d=u.getOptionScopes(this.getDataset(),c);a=u.createResolver(d,this.getContext(e,i,t))}const f=new vb(l,a&&a.animations);return a&&a._cacheable&&(s[o]=Object.freeze(f)),f}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||kr(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),l=this._sharedOptions,s=this.getSharedOptions(i),o=this.includeOptions(t,s)||s!==l;return this.updateSharedOptions(s,t,i),{sharedOptions:s,includeOptions:o}}updateElement(e,t,i,l){kr(l)?Object.assign(e,i):this._resolveAnimations(t,l).update(e,i)}updateSharedOptions(e,t,i){e&&!kr(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,l){e.active=l;const s=this.getStyle(t,l);this._resolveAnimations(t,i,l).update(e,{options:!l&&this.getSharedOptions(s)||s})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[r,a,f]of this._syncList)this[r](a,f);this._syncList=[];const l=i.length,s=t.length,o=Math.min(s,l);o&&this.parse(0,o),s>l?this._insertElements(l,s-l,e):s<l&&this._removeElements(s,l-s)}_insertElements(e,t,i=!0){const l=this._cachedMeta,s=l.data,o=e+t;let r;const a=f=>{for(f.length+=t,r=f.length-1;r>=o;r--)f[r]=f[r-t]};for(a(s),r=e;r<o;++r)s[r]=new this.dataElementType;this._parsing&&a(l._parsed),this.parse(e,t),i&&this.updateElements(s,e,t,"reset")}updateElements(e,t,i,l){}_removeElements(e,t){const i=this._cachedMeta;if(this._parsing){const l=i._parsed.splice(e,t);i._stacked&&zl(i,l)}i.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[t,i,l]=e;this[t](i,l)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);const i=arguments.length-2;i&&this._sync(["_insertElements",e,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Ge(ns,"defaults",{}),Ge(ns,"datasetElementType",null),Ge(ns,"dataElementType",null);class co extends ns{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:l=[],_dataset:s}=t,o=this.chart._animationsDisabled;let{start:r,count:a}=G2(t,l,o);this._drawStart=r,this._drawCount=a,X2(t)&&(r=0,a=l.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!s._decimated,i.points=l;const f=this.resolveDatasetElementOptions(e);this.options.showLine||(f.borderWidth=0),f.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:f},e),this.updateElements(l,r,a,e)}updateElements(e,t,i,l){const s=l==="reset",{iScale:o,vScale:r,_stacked:a,_dataset:f}=this._cachedMeta,{sharedOptions:u,includeOptions:c}=this._getSharedOptions(t,l),d=o.axis,m=r.axis,{spanGaps:h,segment:_}=this.options,g=cs(h)?h:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||s||l==="none",$=t+i,C=e.length;let T=t>0&&this.getParsed(t-1);for(let O=0;O<C;++O){const M=e[O],E=v?M:{};if(O<t||O>=$){E.skip=!0;continue}const A=this.getParsed(O),N=Ht(A[m]),q=E[d]=o.getPixelForValue(A[d],O),R=E[m]=s||N?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,A,a):A[m],O);E.skip=isNaN(q)||isNaN(R)||N,E.stop=O>0&&Math.abs(A[d]-T[d])>g,_&&(E.parsed=A,E.raw=f.data[O]),c&&(E.options=u||this.resolveDataElementOptions(O,M.active?"active":l)),v||this.updateElement(M,O,E,l),T=A}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,l=e.data||[];if(!l.length)return i;const s=l[0].size(this.resolveDataElementOptions(0)),o=l[l.length-1].size(this.resolveDataElementOptions(l.length-1));return Math.max(i,s,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}Ge(co,"id","line"),Ge(co,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Ge(co,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Hi(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ha{constructor(e){Ge(this,"options");this.options=e||{}}static override(e){Object.assign(Ha.prototype,e)}init(){}formats(){return Hi()}parse(){return Hi()}format(){return Hi()}add(){return Hi()}diff(){return Hi()}startOf(){return Hi()}endOf(){return Hi()}}var Sb={_date:Ha};function m3(n,e,t,i){const{controller:l,data:s,_sorted:o}=n,r=l._cachedMeta.iScale;if(r&&e===r.axis&&e!=="r"&&o&&s.length){const a=r._reversePixels?U2:Ki;if(i){if(l._sharedOptions){const f=s[0],u=typeof f.getRange=="function"&&f.getRange(e);if(u){const c=a(s,e,t-u),d=a(s,e,t+u);return{lo:c.lo,hi:d.hi}}}}else return a(s,e,t)}return{lo:0,hi:s.length-1}}function Os(n,e,t,i,l){const s=n.getSortedVisibleDatasetMetas(),o=t[e];for(let r=0,a=s.length;r<a;++r){const{index:f,data:u}=s[r],{lo:c,hi:d}=m3(s[r],e,o,l);for(let m=c;m<=d;++m){const h=u[m];h.skip||i(h,f,m)}}}function h3(n){const e=n.indexOf("x")!==-1,t=n.indexOf("y")!==-1;return function(i,l){const s=e?Math.abs(i.x-l.x):0,o=t?Math.abs(i.y-l.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(o,2))}}function yr(n,e,t,i,l){const s=[];return!l&&!n.isPointInArea(e)||Os(n,t,e,function(r,a,f){!l&&!ds(r,n.chartArea,0)||r.inRange(e.x,e.y,i)&&s.push({element:r,datasetIndex:a,index:f})},!0),s}function _3(n,e,t,i){let l=[];function s(o,r,a){const{startAngle:f,endAngle:u}=o.getProps(["startAngle","endAngle"],i),{angle:c}=z2(o,{x:e.x,y:e.y});lb(c,f,u)&&l.push({element:o,datasetIndex:r,index:a})}return Os(n,t,e,s),l}function g3(n,e,t,i,l,s){let o=[];const r=h3(t);let a=Number.POSITIVE_INFINITY;function f(u,c,d){const m=u.inRange(e.x,e.y,l);if(i&&!m)return;const h=u.getCenterPoint(l);if(!(!!s||n.isPointInArea(h))&&!m)return;const g=r(e,h);g<a?(o=[{element:u,datasetIndex:c,index:d}],a=g):g===a&&o.push({element:u,datasetIndex:c,index:d})}return Os(n,t,e,f),o}function vr(n,e,t,i,l,s){return!s&&!n.isPointInArea(e)?[]:t==="r"&&!i?_3(n,e,t,l):g3(n,e,t,i,l,s)}function Hu(n,e,t,i,l){const s=[],o=t==="x"?"inXRange":"inYRange";let r=!1;return Os(n,t,e,(a,f,u)=>{a[o](e[t],l)&&(s.push({element:a,datasetIndex:f,index:u}),r=r||a.inRange(e.x,e.y,l))}),i&&!r?[]:s}var b3={evaluateInteractionItems:Os,modes:{index(n,e,t,i){const l=Vi(e,n),s=t.axis||"x",o=t.includeInvisible||!1,r=t.intersect?yr(n,l,s,i,o):vr(n,l,s,!1,i,o),a=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(f=>{const u=r[0].index,c=f.data[u];c&&!c.skip&&a.push({element:c,datasetIndex:f.index,index:u})}),a):[]},dataset(n,e,t,i){const l=Vi(e,n),s=t.axis||"xy",o=t.includeInvisible||!1;let r=t.intersect?yr(n,l,s,i,o):vr(n,l,s,!1,i,o);if(r.length>0){const a=r[0].datasetIndex,f=n.getDatasetMeta(a).data;r=[];for(let u=0;u<f.length;++u)r.push({element:f[u],datasetIndex:a,index:u})}return r},point(n,e,t,i){const l=Vi(e,n),s=t.axis||"xy",o=t.includeInvisible||!1;return yr(n,l,s,i,o)},nearest(n,e,t,i){const l=Vi(e,n),s=t.axis||"xy",o=t.includeInvisible||!1;return vr(n,l,s,t.intersect,i,o)},x(n,e,t,i){const l=Vi(e,n);return Hu(n,l,"x",t.intersect,i)},y(n,e,t,i){const l=Vi(e,n);return Hu(n,l,"y",t.intersect,i)}}};const $b=["left","top","right","bottom"];function Vl(n,e){return n.filter(t=>t.pos===e)}function zu(n,e){return n.filter(t=>$b.indexOf(t.pos)===-1&&t.box.axis===e)}function Bl(n,e){return n.sort((t,i)=>{const l=e?i:t,s=e?t:i;return l.weight===s.weight?l.index-s.index:l.weight-s.weight})}function k3(n){const e=[];let t,i,l,s,o,r;for(t=0,i=(n||[]).length;t<i;++t)l=n[t],{position:s,options:{stack:o,stackWeight:r=1}}=l,e.push({index:t,box:l,pos:s,horizontal:l.isHorizontal(),weight:l.weight,stack:o&&s+o,stackWeight:r});return e}function y3(n){const e={};for(const t of n){const{stack:i,pos:l,stackWeight:s}=t;if(!i||!$b.includes(l))continue;const o=e[i]||(e[i]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=s}return e}function v3(n,e){const t=y3(n),{vBoxMaxWidth:i,hBoxMaxHeight:l}=e;let s,o,r;for(s=0,o=n.length;s<o;++s){r=n[s];const{fullSize:a}=r.box,f=t[r.stack],u=f&&r.stackWeight/f.weight;r.horizontal?(r.width=u?u*i:a&&e.availableWidth,r.height=l):(r.width=i,r.height=u?u*l:a&&e.availableHeight)}return t}function w3(n){const e=k3(n),t=Bl(e.filter(f=>f.box.fullSize),!0),i=Bl(Vl(e,"left"),!0),l=Bl(Vl(e,"right")),s=Bl(Vl(e,"top"),!0),o=Bl(Vl(e,"bottom")),r=zu(e,"x"),a=zu(e,"y");return{fullSize:t,leftAndTop:i.concat(s),rightAndBottom:l.concat(a).concat(o).concat(r),chartArea:Vl(e,"chartArea"),vertical:i.concat(l).concat(a),horizontal:s.concat(o).concat(r)}}function Vu(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function Tb(n,e){n.top=Math.max(n.top,e.top),n.left=Math.max(n.left,e.left),n.bottom=Math.max(n.bottom,e.bottom),n.right=Math.max(n.right,e.right)}function S3(n,e,t,i){const{pos:l,box:s}=t,o=n.maxPadding;if(!it(l)){t.size&&(n[l]-=t.size);const c=i[t.stack]||{size:0,count:1};c.size=Math.max(c.size,t.horizontal?s.height:s.width),t.size=c.size/c.count,n[l]+=t.size}s.getPadding&&Tb(o,s.getPadding());const r=Math.max(0,e.outerWidth-Vu(o,n,"left","right")),a=Math.max(0,e.outerHeight-Vu(o,n,"top","bottom")),f=r!==n.w,u=a!==n.h;return n.w=r,n.h=a,t.horizontal?{same:f,other:u}:{same:u,other:f}}function $3(n){const e=n.maxPadding;function t(i){const l=Math.max(e[i]-n[i],0);return n[i]+=l,l}n.y+=t("top"),n.x+=t("left"),t("right"),t("bottom")}function T3(n,e){const t=e.maxPadding;function i(l){const s={left:0,top:0,right:0,bottom:0};return l.forEach(o=>{s[o]=Math.max(e[o],t[o])}),s}return i(n?["left","right"]:["top","bottom"])}function Jl(n,e,t,i){const l=[];let s,o,r,a,f,u;for(s=0,o=n.length,f=0;s<o;++s){r=n[s],a=r.box,a.update(r.width||e.w,r.height||e.h,T3(r.horizontal,e));const{same:c,other:d}=S3(e,t,r,i);f|=c&&l.length,u=u||d,a.fullSize||l.push(r)}return f&&Jl(l,e,t,i)||u}function Ys(n,e,t,i,l){n.top=t,n.left=e,n.right=e+i,n.bottom=t+l,n.width=i,n.height=l}function Bu(n,e,t,i){const l=t.padding;let{x:s,y:o}=e;for(const r of n){const a=r.box,f=i[r.stack]||{count:1,placed:0,weight:1},u=r.stackWeight/f.weight||1;if(r.horizontal){const c=e.w*u,d=f.size||a.height;Ao(f.start)&&(o=f.start),a.fullSize?Ys(a,l.left,o,t.outerWidth-l.right-l.left,d):Ys(a,e.left+f.placed,o,c,d),f.start=o,f.placed+=c,o=a.bottom}else{const c=e.h*u,d=f.size||a.width;Ao(f.start)&&(s=f.start),a.fullSize?Ys(a,s,l.top,d,t.outerHeight-l.bottom-l.top):Ys(a,s,e.top+f.placed,d,c),f.start=s,f.placed+=c,s=a.right}}e.x=s,e.y=o}var Ks={addBox(n,e){n.boxes||(n.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},n.boxes.push(e)},removeBox(n,e){const t=n.boxes?n.boxes.indexOf(e):-1;t!==-1&&n.boxes.splice(t,1)},configure(n,e,t){e.fullSize=t.fullSize,e.position=t.position,e.weight=t.weight},update(n,e,t,i){if(!n)return;const l=Ii(n.options.layout.padding),s=Math.max(e-l.width,0),o=Math.max(t-l.height,0),r=w3(n.boxes),a=r.vertical,f=r.horizontal;gt(n.boxes,_=>{typeof _.beforeLayout=="function"&&_.beforeLayout()});const u=a.reduce((_,g)=>g.box.options&&g.box.options.display===!1?_:_+1,0)||1,c=Object.freeze({outerWidth:e,outerHeight:t,padding:l,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/u,hBoxMaxHeight:o/2}),d=Object.assign({},l);Tb(d,Ii(i));const m=Object.assign({maxPadding:d,w:s,h:o,x:l.left,y:l.top},l),h=v3(a.concat(f),c);Jl(r.fullSize,m,c,h),Jl(a,m,c,h),Jl(f,m,c,h)&&Jl(a,m,c,h),$3(m),Bu(r.leftAndTop,m,c,h),m.x+=m.w,m.y+=m.h,Bu(r.rightAndBottom,m,c,h),n.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},gt(r.chartArea,_=>{const g=_.box;Object.assign(g,n.chartArea),g.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class Cb{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,l){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,l?Math.floor(t/l):i)}}isAttached(e){return!0}updateConfig(e){}}class C3 extends Cb{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const po="$chartjs",O3={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Uu=n=>n===null||n==="";function M3(n,e){const t=n.style,i=n.getAttribute("height"),l=n.getAttribute("width");if(n[po]={initial:{height:i,width:l,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",Uu(l)){const s=Du(n,"width");s!==void 0&&(n.width=s)}if(Uu(i))if(n.style.height==="")n.height=n.width/(e||2);else{const s=Du(n,"height");s!==void 0&&(n.height=s)}return n}const Ob=zw?{passive:!0}:!1;function D3(n,e,t){n&&n.addEventListener(e,t,Ob)}function E3(n,e,t){n&&n.canvas&&n.canvas.removeEventListener(e,t,Ob)}function I3(n,e){const t=O3[n.type]||n.type,{x:i,y:l}=Vi(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:l!==void 0?l:null}}function Po(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function A3(n,e,t){const i=n.canvas,l=new MutationObserver(s=>{let o=!1;for(const r of s)o=o||Po(r.addedNodes,i),o=o&&!Po(r.removedNodes,i);o&&t()});return l.observe(document,{childList:!0,subtree:!0}),l}function L3(n,e,t){const i=n.canvas,l=new MutationObserver(s=>{let o=!1;for(const r of s)o=o||Po(r.removedNodes,i),o=o&&!Po(r.addedNodes,i);o&&t()});return l.observe(document,{childList:!0,subtree:!0}),l}const ps=new Map;let Wu=0;function Mb(){const n=window.devicePixelRatio;n!==Wu&&(Wu=n,ps.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function N3(n,e){ps.size||window.addEventListener("resize",Mb),ps.set(n,e)}function P3(n){ps.delete(n),ps.size||window.removeEventListener("resize",Mb)}function F3(n,e,t){const i=n.canvas,l=i&&ja(i);if(!l)return;const s=ab((r,a)=>{const f=l.clientWidth;t(r,a),f<l.clientWidth&&t()},window),o=new ResizeObserver(r=>{const a=r[0],f=a.contentRect.width,u=a.contentRect.height;f===0&&u===0||s(f,u)});return o.observe(l),N3(n,s),o}function wr(n,e,t){t&&t.disconnect(),e==="resize"&&P3(n)}function R3(n,e,t){const i=n.canvas,l=ab(s=>{n.ctx!==null&&t(I3(s,n))},n);return D3(i,e,l),l}class q3 extends Cb{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(M3(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[po])return!1;const i=t[po].initial;["height","width"].forEach(s=>{const o=i[s];Ht(o)?t.removeAttribute(s):t.setAttribute(s,o)});const l=i.style||{};return Object.keys(l).forEach(s=>{t.style[s]=l[s]}),t.width=t.width,delete t[po],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const l=e.$proxies||(e.$proxies={}),o={attach:A3,detach:L3,resize:F3}[t]||R3;l[t]=o(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),l=i[t];if(!l)return;({attach:wr,detach:wr,resize:wr}[t]||E3)(e,t,l),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,l){return Hw(e,t,i,l)}isAttached(e){const t=ja(e);return!!(t&&t.isConnected)}}function j3(n){return!qa()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?C3:q3}class el{constructor(){Ge(this,"x");Ge(this,"y");Ge(this,"active",!1);Ge(this,"options");Ge(this,"$animations")}tooltipPosition(e){const{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}hasValue(){return cs(this.x)&&cs(this.y)}getProps(e,t){const i=this.$animations;if(!t||!i)return this;const l={};return e.forEach(s=>{l[s]=i[s]&&i[s].active()?i[s]._to:this[s]}),l}}Ge(el,"defaults",{}),Ge(el,"defaultRoutes");function H3(n,e){const t=n.options.ticks,i=z3(n),l=Math.min(t.maxTicksLimit||i,i),s=t.major.enabled?B3(e):[],o=s.length,r=s[0],a=s[o-1],f=[];if(o>l)return U3(e,f,s,o/l),f;const u=V3(s,e,l);if(o>0){let c,d;const m=o>1?Math.round((a-r)/(o-1)):null;for(Js(e,f,u,Ht(m)?0:r-m,r),c=0,d=o-1;c<d;c++)Js(e,f,u,s[c],s[c+1]);return Js(e,f,u,a,Ht(m)?e.length:a+m),f}return Js(e,f,u),f}function z3(n){const e=n.options.offset,t=n._tickSize(),i=n._length/t+(e?0:1),l=n._maxLength/t;return Math.floor(Math.min(i,l))}function V3(n,e,t){const i=W3(n),l=e.length/t;if(!i)return Math.max(l,1);const s=R2(i);for(let o=0,r=s.length-1;o<r;o++){const a=s[o];if(a>l)return a}return Math.max(l,1)}function B3(n){const e=[];let t,i;for(t=0,i=n.length;t<i;t++)n[t].major&&e.push(t);return e}function U3(n,e,t,i){let l=0,s=t[0],o;for(i=Math.ceil(i),o=0;o<n.length;o++)o===s&&(e.push(n[o]),l++,s=t[l*i])}function Js(n,e,t,i,l){const s=wt(i,0),o=Math.min(wt(l,n.length),n.length);let r=0,a,f,u;for(t=Math.ceil(t),l&&(a=l-i,t=a/Math.floor(a/t)),u=s;u<0;)r++,u=Math.round(s+r*t);for(f=Math.max(s,0);f<o;f++)f===u&&(e.push(n[f]),r++,u=Math.round(s+r*t))}function W3(n){const e=n.length;let t,i;if(e<2)return!1;for(i=n[0],t=1;t<e;++t)if(n[t]-n[t-1]!==i)return!1;return i}const Y3=n=>n==="left"?"right":n==="right"?"left":n,Yu=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t,Ku=(n,e)=>Math.min(e||n,n);function Ju(n,e){const t=[],i=n.length/e,l=n.length;let s=0;for(;s<l;s+=i)t.push(n[Math.floor(s)]);return t}function K3(n,e,t){const i=n.ticks.length,l=Math.min(e,i-1),s=n._startPixel,o=n._endPixel,r=1e-6;let a=n.getPixelForTick(l),f;if(!(t&&(i===1?f=Math.max(a-s,o-a):e===0?f=(n.getPixelForTick(1)-a)/2:f=(a-n.getPixelForTick(l-1))/2,a+=l<e?f:-f,a<s-r||a>o+r)))return a}function J3(n,e){gt(n,t=>{const i=t.gc,l=i.length/2;let s;if(l>e){for(s=0;s<l;++s)delete t.data[i[s]];i.splice(0,l)}})}function Ul(n){return n.drawTicks?n.tickLength:0}function Zu(n,e){if(!n.display)return 0;const t=ni(n.font,e),i=Ii(n.padding);return(Zt(n.text)?n.text.length:1)*t.lineHeight+i.height}function Z3(n,e){return sl(n,{scale:e,type:"scale"})}function G3(n,e,t){return sl(n,{tick:t,index:e,type:"tick"})}function X3(n,e,t){let i=Z2(n);return(t&&e!=="right"||!t&&e==="right")&&(i=Y3(i)),i}function Q3(n,e,t,i){const{top:l,left:s,bottom:o,right:r,chart:a}=n,{chartArea:f,scales:u}=a;let c=0,d,m,h;const _=o-l,g=r-s;if(n.isHorizontal()){if(m=gu(i,s,r),it(t)){const v=Object.keys(t)[0],$=t[v];h=u[v].getPixelForValue($)+_-e}else t==="center"?h=(f.bottom+f.top)/2+_-e:h=Yu(n,t,e);d=r-s}else{if(it(t)){const v=Object.keys(t)[0],$=t[v];m=u[v].getPixelForValue($)-g+e}else t==="center"?m=(f.left+f.right)/2-g+e:m=Yu(n,t,e);h=gu(i,o,l),c=t==="left"?-Bn:Bn}return{titleX:m,titleY:h,maxWidth:d,rotation:c}}class Ms extends el{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:i,_suggestedMax:l}=this;return e=Xn(e,Number.POSITIVE_INFINITY),t=Xn(t,Number.NEGATIVE_INFINITY),i=Xn(i,Number.POSITIVE_INFINITY),l=Xn(l,Number.NEGATIVE_INFINITY),{min:Xn(e,i),max:Xn(t,l),minDefined:rn(e),maxDefined:rn(t)}}getMinMax(e){let{min:t,max:i,minDefined:l,maxDefined:s}=this.getUserBounds(),o;if(l&&s)return{min:t,max:i};const r=this.getMatchingVisibleMetas();for(let a=0,f=r.length;a<f;++a)o=r[a].controller.getMinMax(this,e),l||(t=Math.min(t,o.min)),s||(i=Math.max(i,o.max));return t=s&&t>i?i:t,i=l&&t>i?t:i,{min:Xn(t,Xn(i,t)),max:Xn(i,Xn(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){qt(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:l,grace:s,ticks:o}=this.options,r=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=bw(this,s,l),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?Ju(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=H3(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,i;this.isHorizontal()?(t=this.left,i=this.right):(t=this.top,i=this.bottom,e=!e),this._startPixel=t,this._endPixel=i,this._reversePixels=e,this._length=i-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){qt(this.options.afterUpdate,[this])}beforeSetDimensions(){qt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){qt(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),qt(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){qt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const t=this.options.ticks;let i,l,s;for(i=0,l=e.length;i<l;i++)s=e[i],s.label=qt(t.callback,[s.value,i,e],this)}afterTickToLabelConversion(){qt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){qt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,t=e.ticks,i=Ku(this.ticks.length,e.ticks.maxTicksLimit),l=t.minRotation||0,s=t.maxRotation;let o=l,r,a,f;if(!this._isVisible()||!t.display||l>=s||i<=1||!this.isHorizontal()){this.labelRotation=l;return}const u=this._getLabelSizes(),c=u.widest.width,d=u.highest.height,m=Un(this.chart.width-c,0,this.maxWidth);r=e.offset?this.maxWidth/i:m/(i-1),c+6>r&&(r=m/(i-(e.offset?.5:1)),a=this.maxHeight-Ul(e.grid)-t.padding-Zu(e.title,this.chart.options.font),f=Math.sqrt(c*c+d*d),o=H2(Math.min(Math.asin(Un((u.highest.height+6)/r,-1,1)),Math.asin(Un(a/f,-1,1))-Math.asin(Un(d/f,-1,1)))),o=Math.max(l,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){qt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){qt(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:l,grid:s}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const a=Zu(l,t.options.font);if(r?(e.width=this.maxWidth,e.height=Ul(s)+a):(e.height=this.maxHeight,e.width=Ul(s)+a),i.display&&this.ticks.length){const{first:f,last:u,widest:c,highest:d}=this._getLabelSizes(),m=i.padding*2,h=Yi(this.labelRotation),_=Math.cos(h),g=Math.sin(h);if(r){const v=i.mirror?0:g*c.width+_*d.height;e.height=Math.min(this.maxHeight,e.height+v+m)}else{const v=i.mirror?0:_*c.width+g*d.height;e.width=Math.min(this.maxWidth,e.width+v+m)}this._calculatePadding(f,u,g,_)}}this._handleMargins(),r?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,l){const{ticks:{align:s,padding:o},position:r}=this.options,a=this.labelRotation!==0,f=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,m=0;a?f?(d=l*e.width,m=i*t.height):(d=i*e.height,m=l*t.width):s==="start"?m=t.width:s==="end"?d=e.width:s!=="inner"&&(d=e.width/2,m=t.width/2),this.paddingLeft=Math.max((d-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-c+o)*this.width/(this.width-c),0)}else{let u=t.height/2,c=e.height/2;s==="start"?(u=0,c=e.height):s==="end"&&(u=t.height,c=0),this.paddingTop=u+o,this.paddingBottom=c+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){qt(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t<i;t++)Ht(e[t].label)&&(e.splice(t,1),i--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const t=this.options.ticks.sampleSize;let i=this.ticks;t<i.length&&(i=Ju(i,t)),this._labelSizes=e=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,i){const{ctx:l,_longestTextCache:s}=this,o=[],r=[],a=Math.floor(t/Ku(t,i));let f=0,u=0,c,d,m,h,_,g,v,$,C,T,O;for(c=0;c<t;c+=a){if(h=e[c].label,_=this._resolveTickFontOptions(c),l.font=g=_.string,v=s[g]=s[g]||{data:{},gc:[]},$=_.lineHeight,C=T=0,!Ht(h)&&!Zt(h))C=wu(l,v.data,v.gc,C,h),T=$;else if(Zt(h))for(d=0,m=h.length;d<m;++d)O=h[d],!Ht(O)&&!Zt(O)&&(C=wu(l,v.data,v.gc,C,O),T+=$);o.push(C),r.push(T),f=Math.max(C,f),u=Math.max(T,u)}J3(s,t);const M=o.indexOf(f),E=r.indexOf(u),A=N=>({width:o[N]||0,height:r[N]||0});return{first:A(0),last:A(t-1),widest:A(M),highest:A(E),widths:o,heights:r}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return B2(this._alignToPixels?ji(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&e<t.length){const i=t[e];return i.$context||(i.$context=G3(this.getContext(),e,i))}return this.$context||(this.$context=Z3(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,t=Yi(this.labelRotation),i=Math.abs(Math.cos(t)),l=Math.abs(Math.sin(t)),s=this._getLabelSizes(),o=e.autoSkipPadding||0,r=s?s.widest.width+o:0,a=s?s.highest.height+o:0;return this.isHorizontal()?a*i>r*l?r/i:a/l:a*l<r*i?a/i:r/l}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const t=this.axis,i=this.chart,l=this.options,{grid:s,position:o,border:r}=l,a=s.offset,f=this.isHorizontal(),c=this.ticks.length+(a?1:0),d=Ul(s),m=[],h=r.setContext(this.getContext()),_=h.display?h.width:0,g=_/2,v=function(Y){return ji(i,Y,_)};let $,C,T,O,M,E,A,N,q,R,P,F;if(o==="top")$=v(this.bottom),E=this.bottom-d,N=$-g,R=v(e.top)+g,F=e.bottom;else if(o==="bottom")$=v(this.top),R=e.top,F=v(e.bottom)-g,E=$+g,N=this.top+d;else if(o==="left")$=v(this.right),M=this.right-d,A=$-g,q=v(e.left)+g,P=e.right;else if(o==="right")$=v(this.left),q=e.left,P=v(e.right)-g,M=$+g,A=this.left+d;else if(t==="x"){if(o==="center")$=v((e.top+e.bottom)/2+.5);else if(it(o)){const Y=Object.keys(o)[0],X=o[Y];$=v(this.chart.scales[Y].getPixelForValue(X))}R=e.top,F=e.bottom,E=$+g,N=E+d}else if(t==="y"){if(o==="center")$=v((e.left+e.right)/2);else if(it(o)){const Y=Object.keys(o)[0],X=o[Y];$=v(this.chart.scales[Y].getPixelForValue(X))}M=$-g,A=M-d,q=e.left,P=e.right}const j=wt(l.ticks.maxTicksLimit,c),U=Math.max(1,Math.ceil(c/j));for(C=0;C<c;C+=U){const Y=this.getContext(C),X=s.setContext(Y),W=r.setContext(Y),K=X.lineWidth,le=X.color,ne=W.dash||[],me=W.dashOffset,Pe=X.tickWidth,ze=X.tickColor,Qe=X.tickBorderDash||[],et=X.tickBorderDashOffset;T=K3(this,C,a),T!==void 0&&(O=ji(i,T,K),f?M=A=q=P=O:E=N=R=F=O,m.push({tx1:M,ty1:E,tx2:A,ty2:N,x1:q,y1:R,x2:P,y2:F,width:K,color:le,borderDash:ne,borderDashOffset:me,tickWidth:Pe,tickColor:ze,tickBorderDash:Qe,tickBorderDashOffset:et}))}return this._ticksLength=c,this._borderValue=$,m}_computeLabelItems(e){const t=this.axis,i=this.options,{position:l,ticks:s}=i,o=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:f,padding:u,mirror:c}=s,d=Ul(i.grid),m=d+u,h=c?-u:m,_=-Yi(this.labelRotation),g=[];let v,$,C,T,O,M,E,A,N,q,R,P,F="middle";if(l==="top")M=this.bottom-h,E=this._getXAxisLabelAlignment();else if(l==="bottom")M=this.top+h,E=this._getXAxisLabelAlignment();else if(l==="left"){const U=this._getYAxisLabelAlignment(d);E=U.textAlign,O=U.x}else if(l==="right"){const U=this._getYAxisLabelAlignment(d);E=U.textAlign,O=U.x}else if(t==="x"){if(l==="center")M=(e.top+e.bottom)/2+m;else if(it(l)){const U=Object.keys(l)[0],Y=l[U];M=this.chart.scales[U].getPixelForValue(Y)+m}E=this._getXAxisLabelAlignment()}else if(t==="y"){if(l==="center")O=(e.left+e.right)/2-m;else if(it(l)){const U=Object.keys(l)[0],Y=l[U];O=this.chart.scales[U].getPixelForValue(Y)}E=this._getYAxisLabelAlignment(d).textAlign}t==="y"&&(a==="start"?F="top":a==="end"&&(F="bottom"));const j=this._getLabelSizes();for(v=0,$=r.length;v<$;++v){C=r[v],T=C.label;const U=s.setContext(this.getContext(v));A=this.getPixelForTick(v)+s.labelOffset,N=this._resolveTickFontOptions(v),q=N.lineHeight,R=Zt(T)?T.length:1;const Y=R/2,X=U.color,W=U.textStrokeColor,K=U.textStrokeWidth;let le=E;o?(O=A,E==="inner"&&(v===$-1?le=this.options.reverse?"left":"right":v===0?le=this.options.reverse?"right":"left":le="center"),l==="top"?f==="near"||_!==0?P=-R*q+q/2:f==="center"?P=-j.highest.height/2-Y*q+q:P=-j.highest.height+q/2:f==="near"||_!==0?P=q/2:f==="center"?P=j.highest.height/2-Y*q:P=j.highest.height-R*q,c&&(P*=-1),_!==0&&!U.showLabelBackdrop&&(O+=q/2*Math.sin(_))):(M=A,P=(1-R)*q/2);let ne;if(U.showLabelBackdrop){const me=Ii(U.backdropPadding),Pe=j.heights[v],ze=j.widths[v];let Qe=P-me.top,et=0-me.left;switch(F){case"middle":Qe-=Pe/2;break;case"bottom":Qe-=Pe;break}switch(E){case"center":et-=ze/2;break;case"right":et-=ze;break;case"inner":v===$-1?et-=ze:v>0&&(et-=ze/2);break}ne={left:et,top:Qe,width:ze+me.width,height:Pe+me.height,color:U.backdropColor}}g.push({label:T,font:N,textOffset:P,options:{rotation:_,color:X,strokeColor:W,strokeWidth:K,textAlign:le,textBaseline:F,translation:[O,M],backdrop:ne}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-Yi(this.labelRotation))return e==="top"?"left":"right";let l="center";return t.align==="start"?l="left":t.align==="end"?l="right":t.align==="inner"&&(l="inner"),l}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:i,mirror:l,padding:s}}=this.options,o=this._getLabelSizes(),r=e+s,a=o.widest.width;let f,u;return t==="left"?l?(u=this.right+s,i==="near"?f="left":i==="center"?(f="center",u+=a/2):(f="right",u+=a)):(u=this.right-r,i==="near"?f="right":i==="center"?(f="center",u-=a/2):(f="left",u=this.left)):t==="right"?l?(u=this.left+s,i==="near"?f="right":i==="center"?(f="center",u-=a/2):(f="left",u-=a)):(u=this.left+r,i==="near"?f="left":i==="center"?(f="center",u+=a/2):(f="right",u=this.right)):f="right",{textAlign:f,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:i,top:l,width:s,height:o}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(i,l,s,o),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const l=this.ticks.findIndex(s=>s.value===e);return l>=0?t.setContext(this.getContext(l)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,l=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let s,o;const r=(a,f,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(f.x,f.y),i.stroke(),i.restore())};if(t.display)for(s=0,o=l.length;s<o;++s){const a=l[s];t.drawOnChartArea&&r({x:a.x1,y:a.y1},{x:a.x2,y:a.y2},a),t.drawTicks&&r({x:a.tx1,y:a.ty1},{x:a.tx2,y:a.ty2},{color:a.tickColor,width:a.tickWidth,borderDash:a.tickBorderDash,borderDashOffset:a.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:t,options:{border:i,grid:l}}=this,s=i.setContext(this.getContext()),o=i.display?s.width:0;if(!o)return;const r=l.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let f,u,c,d;this.isHorizontal()?(f=ji(e,this.left,o)-o/2,u=ji(e,this.right,r)+r/2,c=d=a):(c=ji(e,this.top,o)-o/2,d=ji(e,this.bottom,r)+r/2,f=u=a),t.save(),t.lineWidth=s.width,t.strokeStyle=s.color,t.beginPath(),t.moveTo(f,c),t.lineTo(u,d),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;const i=this.ctx,l=this._computeLabelArea();l&&La(i,l);const s=this.getLabelItems(e);for(const o of s){const r=o.options,a=o.font,f=o.label,u=o.textOffset;$u(i,f,0,u,a,r)}l&&Na(i)}drawTitle(){const{ctx:e,options:{position:t,title:i,reverse:l}}=this;if(!i.display)return;const s=ni(i.font),o=Ii(i.padding),r=i.align;let a=s.lineHeight/2;t==="bottom"||t==="center"||it(t)?(a+=o.bottom,Zt(i.text)&&(a+=s.lineHeight*(i.text.length-1))):a+=o.top;const{titleX:f,titleY:u,maxWidth:c,rotation:d}=Q3(this,a,t,r);$u(e,i.text,0,0,s,{color:i.color,maxWidth:c,rotation:d,textAlign:X3(r,t,l),textBaseline:"middle",translation:[f,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,t=e.ticks&&e.ticks.z||0,i=wt(e.grid&&e.grid.z,-1),l=wt(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Ms.prototype.draw?[{z:t,draw:s=>{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:l,draw:()=>{this.drawBorder()}},{z:t,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",l=[];let s,o;for(s=0,o=t.length;s<o;++s){const r=t[s];r[i]===this.id&&(!e||r.type===e)&&l.push(r)}return l}_resolveTickFontOptions(e){const t=this.options.ticks.setContext(this.getContext(e));return ni(t.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Zs{constructor(e,t,i){this.type=e,this.scope=t,this.override=i,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const t=Object.getPrototypeOf(e);let i;t4(t)&&(i=this.register(t));const l=this.items,s=e.id,o=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+e);return s in l||(l[s]=e,x3(e,o,i),this.override&&Wt.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){const t=this.items,i=e.id,l=this.scope;i in t&&delete t[i],l&&i in Wt[l]&&(delete Wt[l][i],this.override&&delete xi[i])}}function x3(n,e,t){const i=us(Object.create(null),[t?Wt.get(t):{},Wt.get(e),n.defaults]);Wt.set(e,i),n.defaultRoutes&&e4(e,n.defaultRoutes),n.descriptors&&Wt.describe(e,n.descriptors)}function e4(n,e){Object.keys(e).forEach(t=>{const i=t.split("."),l=i.pop(),s=[n].concat(i).join("."),o=e[t].split("."),r=o.pop(),a=o.join(".");Wt.route(s,l,a,r)})}function t4(n){return"id"in n&&"defaults"in n}class n4{constructor(){this.controllers=new Zs(ns,"datasets",!0),this.elements=new Zs(el,"elements"),this.plugins=new Zs(Object,"plugins"),this.scales=new Zs(Ms,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(l=>{const s=i||this._getRegistryForType(l);i||s.isForType(l)||s===this.plugins&&l.id?this._exec(e,s,l):gt(l,o=>{const r=i||this._getRegistryForType(o);this._exec(e,r,o)})})}_exec(e,t,i){const l=Ea(e);qt(i["before"+l],[],i),t[e](i),qt(i["after"+l],[],i)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const i=this._typedRegistries[t];if(i.isForType(e))return i}return this.plugins}_get(e,t,i){const l=t.get(e);if(l===void 0)throw new Error('"'+e+'" is not a registered '+i+".");return l}}var xn=new n4;class i4{constructor(){this._init=[]}notify(e,t,i,l){t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const s=l?this._descriptors(e).filter(l):this._descriptors(e),o=this._notify(s,e,t,i);return t==="afterDestroy"&&(this._notify(s,e,"stop"),this._notify(this._init,e,"uninstall")),o}_notify(e,t,i,l){l=l||{};for(const s of e){const o=s.plugin,r=o[i],a=[t,l,s.options];if(qt(r,a,o)===!1&&l.cancelable)return!1}return!0}invalidate(){Ht(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const i=e&&e.config,l=wt(i.options&&i.options.plugins,{}),s=l4(i);return l===!1&&!t?[]:o4(e,s,l,t)}_notifyStateChanges(e){const t=this._oldCache||[],i=this._cache,l=(s,o)=>s.filter(r=>!o.some(a=>r.plugin.id===a.plugin.id));this._notify(l(t,i),e,"stop"),this._notify(l(i,t),e,"start")}}function l4(n){const e={},t=[],i=Object.keys(xn.plugins.items);for(let s=0;s<i.length;s++)t.push(xn.getPlugin(i[s]));const l=n.plugins||[];for(let s=0;s<l.length;s++){const o=l[s];t.indexOf(o)===-1&&(t.push(o),e[o.id]=!0)}return{plugins:t,localIds:e}}function s4(n,e){return!e&&n===!1?null:n===!0?{}:n}function o4(n,{plugins:e,localIds:t},i,l){const s=[],o=n.getContext();for(const r of e){const a=r.id,f=s4(i[a],l);f!==null&&s.push({plugin:r,options:r4(n.config,{plugin:r,local:t[a]},f,o)})}return s}function r4(n,{plugin:e,local:t},i,l){const s=n.pluginScopeKeys(e),o=n.getOptionScopes(i,s);return t&&e.defaults&&o.push(e.defaults),n.createResolver(o,l,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ea(n,e){const t=Wt.datasets[n]||{};return((e.datasets||{})[n]||{}).indexAxis||e.indexAxis||t.indexAxis||"x"}function a4(n,e){let t=n;return n==="_index_"?t=e:n==="_value_"&&(t=e==="x"?"y":"x"),t}function f4(n,e){return n===e?"_index_":"_value_"}function Gu(n){if(n==="x"||n==="y"||n==="r")return n}function u4(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function ta(n,...e){if(Gu(n))return n;for(const t of e){const i=t.axis||u4(t.position)||n.length>1&&Gu(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Xu(n,e,t){if(t[e+"AxisID"]===n)return{axis:e}}function c4(n,e){if(e.data&&e.data.datasets){const t=e.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(t.length)return Xu(n,"x",t[0])||Xu(n,"y",t[0])}return{}}function d4(n,e){const t=xi[n.type]||{scales:{}},i=e.scales||{},l=ea(n.type,e),s=Object.create(null);return Object.keys(i).forEach(o=>{const r=i[o];if(!it(r))return console.error(`Invalid scale configuration for scale: ${o}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const a=ta(o,r,c4(o,n),Wt.scales[r.type]),f=f4(a,l),u=t.scales||{};s[o]=Ql(Object.create(null),[{axis:a},r,u[a],u[f]])}),n.data.datasets.forEach(o=>{const r=o.type||n.type,a=o.indexAxis||ea(r,e),u=(xi[r]||{}).scales||{};Object.keys(u).forEach(c=>{const d=a4(c,a),m=o[d+"AxisID"]||d;s[m]=s[m]||Object.create(null),Ql(s[m],[{axis:d},i[m],u[c]])})}),Object.keys(s).forEach(o=>{const r=s[o];Ql(r,[Wt.scales[r.type],Wt.scale])}),s}function Db(n){const e=n.options||(n.options={});e.plugins=wt(e.plugins,{}),e.scales=d4(n,e)}function Eb(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function p4(n){return n=n||{},n.data=Eb(n.data),Db(n),n}const Qu=new Map,Ib=new Set;function Gs(n,e){let t=Qu.get(n);return t||(t=e(),Qu.set(n,t),Ib.add(t)),t}const Wl=(n,e,t)=>{const i=Io(e,t);i!==void 0&&n.add(i)};class m4{constructor(e){this._config=p4(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Eb(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),Db(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Gs(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return Gs(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return Gs(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return Gs(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let l=i.get(e);return(!l||t)&&(l=new Map,i.set(e,l)),l}getOptionScopes(e,t,i){const{options:l,type:s}=this,o=this._cachedScopes(e,i),r=o.get(t);if(r)return r;const a=new Set;t.forEach(u=>{e&&(a.add(e),u.forEach(c=>Wl(a,e,c))),u.forEach(c=>Wl(a,l,c)),u.forEach(c=>Wl(a,xi[s]||{},c)),u.forEach(c=>Wl(a,Wt,c)),u.forEach(c=>Wl(a,Qr,c))});const f=Array.from(a);return f.length===0&&f.push(Object.create(null)),Ib.has(t)&&o.set(t,f),f}chartOptionScopes(){const{options:e,type:t}=this;return[e,xi[t]||{},Wt.datasets[t]||{},{type:t},Wt,Qr]}resolveNamedOptions(e,t,i,l=[""]){const s={$shared:!0},{resolver:o,subPrefixes:r}=xu(this._resolverCache,e,l);let a=o;if(_4(o,t)){s.$shared=!1,i=Ei(i)?i():i;const f=this.createResolver(e,i,r);a=Ml(o,i,f)}for(const f of t)s[f]=a[f];return s}createResolver(e,t,i=[""],l){const{resolver:s}=xu(this._resolverCache,e,i);return it(t)?Ml(s,t,void 0,l):s}}function xu(n,e,t){let i=n.get(e);i||(i=new Map,n.set(e,i));const l=t.join();let s=i.get(l);return s||(s={resolver:Pa(e,t),subPrefixes:t.filter(r=>!r.toLowerCase().includes("hover"))},i.set(l,s)),s}const h4=n=>it(n)&&Object.getOwnPropertyNames(n).some(e=>Ei(n[e]));function _4(n,e){const{isScriptable:t,isIndexable:i}=pb(n);for(const l of e){const s=t(l),o=i(l),r=(o||s)&&n[l];if(s&&(Ei(r)||h4(r))||o&&Zt(r))return!0}return!1}var g4="4.4.2";const b4=["top","bottom","left","right","chartArea"];function ec(n,e){return n==="top"||n==="bottom"||b4.indexOf(n)===-1&&e==="x"}function tc(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function nc(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),qt(t&&t.onComplete,[n],e)}function k4(n){const e=n.chart,t=e.options.animation;qt(t&&t.onProgress,[n],e)}function Ab(n){return qa()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const mo={},ic=n=>{const e=Ab(n);return Object.values(mo).filter(t=>t.canvas===e).pop()};function y4(n,e,t){const i=Object.keys(n);for(const l of i){const s=+l;if(s>=e){const o=n[l];delete n[l],(t>0||s>e)&&(n[s+t]=o)}}}function v4(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}function Xs(n,e,t){return n.options.clip?n[t]:e[t]}function w4(n,e){const{xScale:t,yScale:i}=n;return t&&i?{left:Xs(t,e,"left"),right:Xs(t,e,"right"),top:Xs(i,e,"top"),bottom:Xs(i,e,"bottom")}:e}class di{static register(...e){xn.add(...e),lc()}static unregister(...e){xn.remove(...e),lc()}constructor(e,t){const i=this.config=new m4(t),l=Ab(e),s=ic(l);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||j3(l)),this.platform.updateConfig(i);const r=this.platform.acquireContext(l,o.aspectRatio),a=r&&r.canvas,f=a&&a.height,u=a&&a.width;if(this.id=M2(),this.ctx=r,this.canvas=a,this.width=u,this.height=f,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new i4,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=J2(c=>this.update(c),o.resizeDelay||0),this._dataChanges=[],mo[this.id]=this,!r||!a){console.error("Failed to create chart: can't acquire context from the given item");return}fi.listen(this,"complete",nc),fi.listen(this,"progress",k4),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:l,_aspectRatio:s}=this;return Ht(e)?t&&s?s:l?i/l:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return xn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Mu(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Su(this.canvas,this.ctx),this}stop(){return fi.stop(this),this}resize(e,t){fi.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,l=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(l,e,t,s),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Mu(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),qt(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};gt(t,(i,l)=>{i.id=l})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,l=Object.keys(i).reduce((o,r)=>(o[r]=!1,o),{});let s=[];t&&(s=s.concat(Object.keys(t).map(o=>{const r=t[o],a=ta(o,r),f=a==="r",u=a==="x";return{options:r,dposition:f?"chartArea":u?"bottom":"left",dtype:f?"radialLinear":u?"category":"linear"}}))),gt(s,o=>{const r=o.options,a=r.id,f=ta(a,r),u=wt(r.type,o.dtype);(r.position===void 0||ec(r.position,f)!==ec(o.dposition))&&(r.position=o.dposition),l[a]=!0;let c=null;if(a in i&&i[a].type===u)c=i[a];else{const d=xn.getScale(u);c=new d({id:a,type:u,ctx:this.ctx,chart:this}),i[c.id]=c}c.init(r,e)}),gt(l,(o,r)=>{o||delete i[r]}),gt(i,o=>{Ks.configure(this,o,o.options),Ks.addBox(this,o)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((l,s)=>l.index-s.index),i>t){for(let l=t;l<i;++l)this._destroyDatasetMeta(l);e.splice(t,i-t)}this._sortedMetasets=e.slice(0).sort(tc("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((i,l)=>{t.filter(s=>s===i._dataset).length===0&&this._destroyDatasetMeta(l)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,l;for(this._removeUnreferencedMetasets(),i=0,l=t.length;i<l;i++){const s=t[i];let o=this.getDatasetMeta(i);const r=s.type||this.config.type;if(o.type&&o.type!==r&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=r,o.indexAxis=s.indexAxis||ea(r,this.options),o.order=s.order||0,o.index=i,o.label=""+s.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const a=xn.getController(r),{datasetElementType:f,dataElementType:u}=Wt.datasets[r];Object.assign(a,{dataElementType:xn.getElement(u),datasetElementType:f&&xn.getElement(f)}),o.controller=new a(this,i),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){gt(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),l=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let f=0,u=this.data.datasets.length;f<u;f++){const{controller:c}=this.getDatasetMeta(f),d=!l&&s.indexOf(c)===-1;c.buildOrUpdateElements(d),o=Math.max(+c.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),l||gt(s,f=>{f.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(tc("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){gt(this.scales,e=>{Ks.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!du(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:l,count:s}of t){const o=i==="_removeElements"?-s:s;y4(e,l,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=s=>new Set(e.filter(o=>o[0]===s).map((o,r)=>r+","+o.splice(1).join(","))),l=i(0);for(let s=1;s<t;s++)if(!du(l,i(s)))return;return Array.from(l).map(s=>s.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ks.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],gt(this.boxes,l=>{i&&l.position==="chartArea"||(l.configure&&l.configure(),this._layers.push(...l._layers()))},this),this._layers.forEach((l,s)=>{l._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t<i;++t)this.getDatasetMeta(t).controller.configure();for(let t=0,i=this.data.datasets.length;t<i;++t)this._updateDataset(t,Ei(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){const i=this.getDatasetMeta(e),l={meta:i,index:e,mode:t,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",l)!==!1&&(i.controller._update(t),l.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",l))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(fi.has(this)?this.attached&&!fi.running(this)&&fi.start(this):(this.draw(),nc({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:i,height:l}=this._resizeBeforeDraw;this._resize(i,l),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const t=this._sortedMetasets,i=[];let l,s;for(l=0,s=t.length;l<s;++l){const o=t[l];(!e||o.visible)&&i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,l=!i.disabled,s=w4(e,this.chartArea),o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(l&&La(t,{left:i.left===!1?0:s.left-i.left,right:i.right===!1?this.width:s.right+i.right,top:i.top===!1?0:s.top-i.top,bottom:i.bottom===!1?this.height:s.bottom+i.bottom}),e.controller.draw(),l&&Na(t),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return ds(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,l){const s=b3.modes[t];return typeof s=="function"?s(this,e,i,l):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let l=i.filter(s=>s&&s._dataset===t).pop();return l||(l={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(l)),l}getContext(){return this.$context||(this.$context=sl(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const l=i?"show":"hide",s=this.getDatasetMeta(e),o=s.controller._resolveAnimations(void 0,l);Ao(t)?(s.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(s,{visible:i}),this.update(r=>r.datasetIndex===e?l:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),fi.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Su(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete mo[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,t=this.platform,i=(s,o)=>{t.addEventListener(this,s,o),e[s]=o},l=(s,o,r)=>{s.offsetX=o,s.offsetY=r,this._eventHandler(s)};gt(this.options.events,s=>i(s,l))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(a,f)=>{t.addEventListener(this,a,f),e[a]=f},l=(a,f)=>{e[a]&&(t.removeEventListener(this,a,f),delete e[a])},s=(a,f)=>{this.canvas&&this.resize(a,f)};let o;const r=()=>{l("attach",r),this.attached=!0,this.resize(),i("resize",s),i("detach",o)};o=()=>{this.attached=!1,l("resize",s),this._stop(),this._resize(0,0),i("attach",r)},t.isAttached(this.canvas)?r():o()}unbindEvents(){gt(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},gt(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const l=i?"set":"remove";let s,o,r,a;for(t==="dataset"&&(s=this.getDatasetMeta(e[0].datasetIndex),s.controller["_"+l+"DatasetHoverStyle"]()),r=0,a=e.length;r<a;++r){o=e[r];const f=o&&this.getDatasetMeta(o.datasetIndex).controller;f&&f[l+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const t=this._active||[],i=e.map(({datasetIndex:s,index:o})=>{const r=this.getDatasetMeta(s);if(!r)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:r.data[o],index:o}});!Do(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,i){const l=this.options.hover,s=(a,f)=>a.filter(u=>!f.some(c=>u.datasetIndex===c.datasetIndex&&u.index===c.index)),o=s(t,e),r=i?e:s(e,t);o.length&&this.updateHoverStyle(o,l.mode,!1),r.length&&l.mode&&this.updateHoverStyle(r,l.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},l=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,l)===!1)return;const s=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,l),(s||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:l=[],options:s}=this,o=t,r=this._getActiveElements(e,l,i,o),a=N2(e),f=v4(e,this._lastEvent,i,a);i&&(this._lastEvent=null,qt(s.onHover,[e,r,this],this),a&&qt(s.onClick,[e,r,this],this));const u=!Do(r,l);return(u||t)&&(this._active=r,this._updateHoverStyles(r,l,t)),this._lastEvent=f,u}_getActiveElements(e,t,i,l){if(e.type==="mouseout")return[];if(!i)return t;const s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,l)}}Ge(di,"defaults",Wt),Ge(di,"instances",mo),Ge(di,"overrides",xi),Ge(di,"registry",xn),Ge(di,"version",g4),Ge(di,"getChart",ic);function lc(){return gt(di.instances,n=>n._plugins.invalidate())}function Lb(n,e,t=e){n.lineCap=wt(t.borderCapStyle,e.borderCapStyle),n.setLineDash(wt(t.borderDash,e.borderDash)),n.lineDashOffset=wt(t.borderDashOffset,e.borderDashOffset),n.lineJoin=wt(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=wt(t.borderWidth,e.borderWidth),n.strokeStyle=wt(t.borderColor,e.borderColor)}function S4(n,e,t){n.lineTo(t.x,t.y)}function $4(n){return n.stepped?aw:n.tension||n.cubicInterpolationMode==="monotone"?fw:S4}function Nb(n,e,t={}){const i=n.length,{start:l=0,end:s=i-1}=t,{start:o,end:r}=e,a=Math.max(l,o),f=Math.min(s,r),u=l<o&&s<o||l>r&&s>r;return{count:i,start:a,loop:e.loop,ilen:f<a&&!u?i+f-a:f-a}}function T4(n,e,t,i){const{points:l,options:s}=e,{count:o,start:r,loop:a,ilen:f}=Nb(l,t,i),u=$4(s);let{move:c=!0,reverse:d}=i||{},m,h,_;for(m=0;m<=f;++m)h=l[(r+(d?f-m:m))%o],!h.skip&&(c?(n.moveTo(h.x,h.y),c=!1):u(n,_,h,d,s.stepped),_=h);return a&&(h=l[(r+(d?f:0))%o],u(n,_,h,d,s.stepped)),!!a}function C4(n,e,t,i){const l=e.points,{count:s,start:o,ilen:r}=Nb(l,t,i),{move:a=!0,reverse:f}=i||{};let u=0,c=0,d,m,h,_,g,v;const $=T=>(o+(f?r-T:T))%s,C=()=>{_!==g&&(n.lineTo(u,g),n.lineTo(u,_),n.lineTo(u,v))};for(a&&(m=l[$(0)],n.moveTo(m.x,m.y)),d=0;d<=r;++d){if(m=l[$(d)],m.skip)continue;const T=m.x,O=m.y,M=T|0;M===h?(O<_?_=O:O>g&&(g=O),u=(c*u+T)/++c):(C(),n.lineTo(T,O),h=M,c=0,_=g=O),v=O}C()}function na(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?C4:T4}function O4(n){return n.stepped?Vw:n.tension||n.cubicInterpolationMode==="monotone"?Bw:Bi}function M4(n,e,t,i){let l=e._path;l||(l=e._path=new Path2D,e.path(l,t,i)&&l.closePath()),Lb(n,e.options),n.stroke(l)}function D4(n,e,t,i){const{segments:l,options:s}=e,o=na(e);for(const r of l)Lb(n,s,r.style),n.beginPath(),o(n,e,r,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const E4=typeof Path2D=="function";function I4(n,e,t,i){E4&&!e.options.segment?M4(n,e,t,i):D4(n,e,t,i)}class Ci extends el{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const l=i.spanGaps?this._loop:this._fullLoop;Nw(this._points,i,e,l,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Xw(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,l=e[t],s=this.points,o=yb(this,{property:t,start:l,end:l});if(!o.length)return;const r=[],a=O4(i);let f,u;for(f=0,u=o.length;f<u;++f){const{start:c,end:d}=o[f],m=s[c],h=s[d];if(m===h){r.push(m);continue}const _=Math.abs((l-m[t])/(h[t]-m[t])),g=a(m,h,_,i.stepped);g[t]=e[t],r.push(g)}return r.length===1?r[0]:r}pathSegment(e,t,i){return na(this)(e,this,t,i)}path(e,t,i){const l=this.segments,s=na(this);let o=this._loop;t=t||0,i=i||this.points.length-t;for(const r of l)o&=s(e,this,r,{start:t,end:t+i-1});return!!o}draw(e,t,i,l){const s=this.options||{};(this.points||[]).length&&s.borderWidth&&(e.save(),I4(e,this,i,l),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Ge(Ci,"id","line"),Ge(Ci,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Ge(Ci,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Ge(Ci,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function sc(n,e,t,i){const l=n.options,{[t]:s}=n.getProps([t],i);return Math.abs(e-s)<l.radius+l.hitRadius}class ho extends el{constructor(t){super();Ge(this,"parsed");Ge(this,"skip");Ge(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,i,l){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],l);return Math.pow(t-o,2)+Math.pow(i-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,i){return sc(this,t,"x",i)}inYRange(t,i){return sc(this,t,"y",i)}getCenterPoint(t){const{x:i,y:l}=this.getProps(["x","y"],t);return{x:i,y:l}}size(t){t=t||this.options||{};let i=t.radius||0;i=Math.max(i,i&&t.hoverRadius||0);const l=i&&t.borderWidth||0;return(i+l)*2}draw(t,i){const l=this.options;this.skip||l.radius<.1||!ds(this,i,this.size(l)/2)||(t.strokeStyle=l.borderColor,t.lineWidth=l.borderWidth,t.fillStyle=l.backgroundColor,xr(t,l,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}Ge(ho,"id","point"),Ge(ho,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Ge(ho,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function A4(n,e,t){const i=n.segments,l=n.points,s=e.points,o=[];for(const r of i){let{start:a,end:f}=r;f=za(a,f,l);const u=ia(t,l[a],l[f],r.loop);if(!e.segments){o.push({source:r,target:u,start:l[a],end:l[f]});continue}const c=yb(e,u);for(const d of c){const m=ia(t,s[d.start],s[d.end],d.loop),h=kb(r,l,m);for(const _ of h)o.push({source:_,target:d,start:{[t]:oc(u,m,"start",Math.max)},end:{[t]:oc(u,m,"end",Math.min)}})}}return o}function ia(n,e,t,i){if(i)return;let l=e[n],s=t[n];return n==="angle"&&(l=ei(l),s=ei(s)),{property:n,start:l,end:s}}function L4(n,e){const{x:t=null,y:i=null}=n||{},l=e.points,s=[];return e.segments.forEach(({start:o,end:r})=>{r=za(o,r,l);const a=l[o],f=l[r];i!==null?(s.push({x:a.x,y:i}),s.push({x:f.x,y:i})):t!==null&&(s.push({x:t,y:a.y}),s.push({x:t,y:f.y}))}),s}function za(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function oc(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function Pb(n,e){let t=[],i=!1;return Zt(n)?(i=!0,t=n):t=L4(n,e),t.length?new Ci({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function rc(n){return n&&n.fill!==!1}function N4(n,e,t){let l=n[e].fill;const s=[e];let o;if(!t)return l;for(;l!==!1&&s.indexOf(l)===-1;){if(!rn(l))return l;if(o=n[l],!o)return!1;if(o.visible)return l;s.push(l),l=o.fill}return!1}function P4(n,e,t){const i=j4(n);if(it(i))return isNaN(i.value)?!1:i;let l=parseFloat(i);return rn(l)&&Math.floor(l)===l?F4(i[0],e,l,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function F4(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function R4(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:it(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function q4(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:it(n)?i=n.value:i=e.getBaseValue(),i}function j4(n){const e=n.options,t=e.fill;let i=wt(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function H4(n){const{scale:e,index:t,line:i}=n,l=[],s=i.segments,o=i.points,r=z4(e,t);r.push(Pb({x:null,y:e.bottom},i));for(let a=0;a<s.length;a++){const f=s[a];for(let u=f.start;u<=f.end;u++)V4(l,o[u],r)}return new Ci({points:l,options:{}})}function z4(n,e){const t=[],i=n.getMatchingVisibleMetas("line");for(let l=0;l<i.length;l++){const s=i[l];if(s.index===e)break;s.hidden||t.unshift(s.dataset)}return t}function V4(n,e,t){const i=[];for(let l=0;l<t.length;l++){const s=t[l],{first:o,last:r,point:a}=B4(s,e,"x");if(!(!a||o&&r)){if(o)i.unshift(a);else if(n.push(a),!r)break}}n.push(...i)}function B4(n,e,t){const i=n.interpolate(e,t);if(!i)return{};const l=i[t],s=n.segments,o=n.points;let r=!1,a=!1;for(let f=0;f<s.length;f++){const u=s[f],c=o[u.start][t],d=o[u.end][t];if(sb(l,c,d)){r=l===c,a=l===d;break}}return{first:r,last:a,point:i}}class Fb{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,i){const{x:l,y:s,radius:o}=this;return t=t||{start:0,end:Wn},e.arc(l,s,o,t.end,t.start,!0),!i.bounds}interpolate(e){const{x:t,y:i,radius:l}=this,s=e.angle;return{x:t+Math.cos(s)*l,y:i+Math.sin(s)*l,angle:s}}}function U4(n){const{chart:e,fill:t,line:i}=n;if(rn(t))return W4(e,t);if(t==="stack")return H4(n);if(t==="shape")return!0;const l=Y4(n);return l instanceof Fb?l:Pb(l,i)}function W4(n,e){const t=n.getDatasetMeta(e);return t&&n.isDatasetVisible(e)?t.dataset:null}function Y4(n){return(n.scale||{}).getPointPositionForValue?J4(n):K4(n)}function K4(n){const{scale:e={},fill:t}=n,i=R4(t,e);if(rn(i)){const l=e.isHorizontal();return{x:l?i:null,y:l?null:i}}return null}function J4(n){const{scale:e,fill:t}=n,i=e.options,l=e.getLabels().length,s=i.reverse?e.max:e.min,o=q4(t,e,s),r=[];if(i.grid.circular){const a=e.getPointPositionForValue(0,s);return new Fb({x:a.x,y:a.y,radius:e.getDistanceFromCenterForValue(o)})}for(let a=0;a<l;++a)r.push(e.getPointPositionForValue(a,o));return r}function Sr(n,e,t){const i=U4(e),{line:l,scale:s,axis:o}=e,r=l.options,a=r.fill,f=r.backgroundColor,{above:u=f,below:c=f}=a||{};i&&l.points.length&&(La(n,t),Z4(n,{line:l,target:i,above:u,below:c,area:t,scale:s,axis:o}),Na(n))}function Z4(n,e){const{line:t,target:i,above:l,below:s,area:o,scale:r}=e,a=t._loop?"angle":e.axis;n.save(),a==="x"&&s!==l&&(ac(n,i,o.top),fc(n,{line:t,target:i,color:l,scale:r,property:a}),n.restore(),n.save(),ac(n,i,o.bottom)),fc(n,{line:t,target:i,color:s,scale:r,property:a}),n.restore()}function ac(n,e,t){const{segments:i,points:l}=e;let s=!0,o=!1;n.beginPath();for(const r of i){const{start:a,end:f}=r,u=l[a],c=l[za(a,f,l)];s?(n.moveTo(u.x,u.y),s=!1):(n.lineTo(u.x,t),n.lineTo(u.x,u.y)),o=!!e.pathSegment(n,r,{move:o}),o?n.closePath():n.lineTo(c.x,t)}n.lineTo(e.first().x,t),n.closePath(),n.clip()}function fc(n,e){const{line:t,target:i,property:l,color:s,scale:o}=e,r=A4(t,i,l);for(const{source:a,target:f,start:u,end:c}of r){const{style:{backgroundColor:d=s}={}}=a,m=i!==!0;n.save(),n.fillStyle=d,G4(n,o,m&&ia(l,u,c)),n.beginPath();const h=!!t.pathSegment(n,a);let _;if(m){h?n.closePath():uc(n,i,c,l);const g=!!i.pathSegment(n,f,{move:h,reverse:!0});_=h&&g,_||uc(n,i,u,l)}n.closePath(),n.fill(_?"evenodd":"nonzero"),n.restore()}}function G4(n,e,t){const{top:i,bottom:l}=e.chart.chartArea,{property:s,start:o,end:r}=t||{};s==="x"&&(n.beginPath(),n.rect(o,i,r-o,l-i),n.clip())}function uc(n,e,t,i){const l=e.interpolate(t,i);l&&n.lineTo(l.x,l.y)}var X4={id:"filler",afterDatasetsUpdate(n,e,t){const i=(n.data.datasets||[]).length,l=[];let s,o,r,a;for(o=0;o<i;++o)s=n.getDatasetMeta(o),r=s.dataset,a=null,r&&r.options&&r instanceof Ci&&(a={visible:n.isDatasetVisible(o),index:o,fill:P4(r,o,i),chart:n,axis:s.controller.options.indexAxis,scale:s.vScale,line:r}),s.$filler=a,l.push(a);for(o=0;o<i;++o)a=l[o],!(!a||a.fill===!1)&&(a.fill=N4(l,o,t.propagate))},beforeDraw(n,e,t){const i=t.drawTime==="beforeDraw",l=n.getSortedVisibleDatasetMetas(),s=n.chartArea;for(let o=l.length-1;o>=0;--o){const r=l[o].$filler;r&&(r.line.updateControlPoints(s,r.axis),i&&r.fill&&Sr(n.ctx,r,s))}},beforeDatasetsDraw(n,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let l=i.length-1;l>=0;--l){const s=i[l].$filler;rc(s)&&Sr(n.ctx,s,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!rc(i)||t.drawTime!=="beforeDatasetDraw"||Sr(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Zl={average(n){if(!n.length)return!1;let e,t,i=new Set,l=0,s=0;for(e=0,t=n.length;e<t;++e){const r=n[e].element;if(r&&r.hasValue()){const a=r.tooltipPosition();i.add(a.x),l+=a.y,++s}}return{x:[...i].reduce((r,a)=>r+a)/i.size,y:l/s}},nearest(n,e){if(!n.length)return!1;let t=e.x,i=e.y,l=Number.POSITIVE_INFINITY,s,o,r;for(s=0,o=n.length;s<o;++s){const a=n[s].element;if(a&&a.hasValue()){const f=a.getCenterPoint(),u=Xr(e,f);u<l&&(l=u,r=a)}}if(r){const a=r.tooltipPosition();t=a.x,i=a.y}return{x:t,y:i}}};function Qn(n,e){return e&&(Zt(e)?Array.prototype.push.apply(n,e):n.push(e)),n}function ui(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
`)>-1?n.split(`
`):n}function Q4(n,e){const{element:t,datasetIndex:i,index:l}=e,s=n.getDatasetMeta(i).controller,{label:o,value:r}=s.getLabelAndValue(l);return{chart:n,label:o,parsed:s.getParsed(l),raw:n.data.datasets[i].data[l],formattedValue:r,dataset:s.getDataset(),dataIndex:l,datasetIndex:i,element:t}}function cc(n,e){const t=n.chart.ctx,{body:i,footer:l,title:s}=n,{boxWidth:o,boxHeight:r}=e,a=ni(e.bodyFont),f=ni(e.titleFont),u=ni(e.footerFont),c=s.length,d=l.length,m=i.length,h=Ii(e.padding);let _=h.height,g=0,v=i.reduce((T,O)=>T+O.before.length+O.lines.length+O.after.length,0);if(v+=n.beforeBody.length+n.afterBody.length,c&&(_+=c*f.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),v){const T=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;_+=m*T+(v-m)*a.lineHeight+(v-1)*e.bodySpacing}d&&(_+=e.footerMarginTop+d*u.lineHeight+(d-1)*e.footerSpacing);let $=0;const C=function(T){g=Math.max(g,t.measureText(T).width+$)};return t.save(),t.font=f.string,gt(n.title,C),t.font=a.string,gt(n.beforeBody.concat(n.afterBody),C),$=e.displayColors?o+2+e.boxPadding:0,gt(i,T=>{gt(T.before,C),gt(T.lines,C),gt(T.after,C)}),$=0,t.font=u.string,gt(n.footer,C),t.restore(),g+=h.width,{width:g,height:_}}function x4(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function eS(n,e,t,i){const{x:l,width:s}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&l+s+o>e.width||n==="right"&&l-s-o<0)return!0}function tS(n,e,t,i){const{x:l,width:s}=t,{width:o,chartArea:{left:r,right:a}}=n;let f="center";return i==="center"?f=l<=(r+a)/2?"left":"right":l<=s/2?f="left":l>=o-s/2&&(f="right"),eS(f,n,e,t)&&(f="center"),f}function dc(n,e,t){const i=t.yAlign||e.yAlign||x4(n,t);return{xAlign:t.xAlign||e.xAlign||tS(n,e,t,i),yAlign:i}}function nS(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function iS(n,e,t){let{y:i,height:l}=n;return e==="top"?i+=t:e==="bottom"?i-=l+t:i-=l/2,i}function pc(n,e,t,i){const{caretSize:l,caretPadding:s,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,f=l+s,{topLeft:u,topRight:c,bottomLeft:d,bottomRight:m}=uo(o);let h=nS(e,r);const _=iS(e,a,f);return a==="center"?r==="left"?h+=f:r==="right"&&(h-=f):r==="left"?h-=Math.max(u,d)+l:r==="right"&&(h+=Math.max(c,m)+l),{x:Un(h,0,i.width-e.width),y:Un(_,0,i.height-e.height)}}function Qs(n,e,t){const i=Ii(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function mc(n){return Qn([],ui(n))}function lS(n,e,t){return sl(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function hc(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}const Rb={beforeTitle:ai,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex<i)return t[e.dataIndex]}return""},afterTitle:ai,beforeBody:ai,beforeLabel:ai,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let e=n.dataset.label||"";e&&(e+=": ");const t=n.formattedValue;return Ht(t)||(e+=t),e},labelColor(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){const t=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:ai,afterBody:ai,beforeFooter:ai,footer:ai,afterFooter:ai};function pn(n,e,t,i){const l=n[e].call(t,i);return typeof l>"u"?Rb[e].call(t,i):l}class la extends el{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),l=i.enabled&&t.options.animation&&i.animations,s=new vb(this.chart,l);return l._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=lS(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,l=pn(i,"beforeTitle",this,e),s=pn(i,"title",this,e),o=pn(i,"afterTitle",this,e);let r=[];return r=Qn(r,ui(l)),r=Qn(r,ui(s)),r=Qn(r,ui(o)),r}getBeforeBody(e,t){return mc(pn(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:i}=t,l=[];return gt(e,s=>{const o={before:[],lines:[],after:[]},r=hc(i,s);Qn(o.before,ui(pn(r,"beforeLabel",this,s))),Qn(o.lines,pn(r,"label",this,s)),Qn(o.after,ui(pn(r,"afterLabel",this,s))),l.push(o)}),l}getAfterBody(e,t){return mc(pn(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:i}=t,l=pn(i,"beforeFooter",this,e),s=pn(i,"footer",this,e),o=pn(i,"afterFooter",this,e);let r=[];return r=Qn(r,ui(l)),r=Qn(r,ui(s)),r=Qn(r,ui(o)),r}_createItems(e){const t=this._active,i=this.chart.data,l=[],s=[],o=[];let r=[],a,f;for(a=0,f=t.length;a<f;++a)r.push(Q4(this.chart,t[a]));return e.filter&&(r=r.filter((u,c,d)=>e.filter(u,c,d,i))),e.itemSort&&(r=r.sort((u,c)=>e.itemSort(u,c,i))),gt(r,u=>{const c=hc(e.callbacks,u);l.push(pn(c,"labelColor",this,u)),s.push(pn(c,"labelPointStyle",this,u)),o.push(pn(c,"labelTextColor",this,u))}),this.labelColors=l,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),l=this._active;let s,o=[];if(!l.length)this.opacity!==0&&(s={opacity:0});else{const r=Zl[i.position].call(this,l,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const a=this._size=cc(this,i),f=Object.assign({},r,a),u=dc(this.chart,i,f),c=pc(i,f,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,s={opacity:1,x:c.x,y:c.y,width:a.width,height:a.height,caretX:r.x,caretY:r.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,l){const s=this.getCaretPosition(e,i,l);t.lineTo(s.x1,s.y1),t.lineTo(s.x2,s.y2),t.lineTo(s.x3,s.y3)}getCaretPosition(e,t,i){const{xAlign:l,yAlign:s}=this,{caretSize:o,cornerRadius:r}=i,{topLeft:a,topRight:f,bottomLeft:u,bottomRight:c}=uo(r),{x:d,y:m}=e,{width:h,height:_}=t;let g,v,$,C,T,O;return s==="center"?(T=m+_/2,l==="left"?(g=d,v=g-o,C=T+o,O=T-o):(g=d+h,v=g+o,C=T-o,O=T+o),$=g):(l==="left"?v=d+Math.max(a,u)+o:l==="right"?v=d+h-Math.max(f,c)-o:v=this.caretX,s==="top"?(C=m,T=C-o,g=v-o,$=v+o):(C=m+_,T=C+o,g=v+o,$=v-o),O=C),{x1:g,x2:v,x3:$,y1:C,y2:T,y3:O}}drawTitle(e,t,i){const l=this.title,s=l.length;let o,r,a;if(s){const f=gr(i.rtl,this.x,this.width);for(e.x=Qs(this,i.titleAlign,i),t.textAlign=f.textAlign(i.titleAlign),t.textBaseline="middle",o=ni(i.titleFont),r=i.titleSpacing,t.fillStyle=i.titleColor,t.font=o.string,a=0;a<s;++a)t.fillText(l[a],f.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+r,a+1===s&&(e.y+=i.titleMarginBottom-r)}}_drawColorBox(e,t,i,l,s){const o=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:f}=s,u=ni(s.bodyFont),c=Qs(this,"left",s),d=l.x(c),m=a<u.lineHeight?(u.lineHeight-a)/2:0,h=t.y+m;if(s.usePointStyle){const _={radius:Math.min(f,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},g=l.leftForLtr(d,f)+f/2,v=h+a/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,xr(e,_,g,v),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,xr(e,_,g,v)}else{e.lineWidth=it(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const _=l.leftForLtr(d,f),g=l.leftForLtr(l.xPlus(d,1),f-2),v=uo(o.borderRadius);Object.values(v).some($=>$!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,Tu(e,{x:_,y:h,w:f,h:a,radius:v}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Tu(e,{x:g,y:h+1,w:f-2,h:a-2,radius:v}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(_,h,f,a),e.strokeRect(_,h,f,a),e.fillStyle=o.backgroundColor,e.fillRect(g,h+1,f-2,a-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:l}=this,{bodySpacing:s,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:f,boxPadding:u}=i,c=ni(i.bodyFont);let d=c.lineHeight,m=0;const h=gr(i.rtl,this.x,this.width),_=function(A){t.fillText(A,h.x(e.x+m),e.y+d/2),e.y+=d+s},g=h.textAlign(o);let v,$,C,T,O,M,E;for(t.textAlign=o,t.textBaseline="middle",t.font=c.string,e.x=Qs(this,g,i),t.fillStyle=i.bodyColor,gt(this.beforeBody,_),m=r&&g!=="right"?o==="center"?f/2+u:f+2+u:0,T=0,M=l.length;T<M;++T){for(v=l[T],$=this.labelTextColors[T],t.fillStyle=$,gt(v.before,_),C=v.lines,r&&C.length&&(this._drawColorBox(t,e,T,h,i),d=Math.max(c.lineHeight,a)),O=0,E=C.length;O<E;++O)_(C[O]),d=c.lineHeight;gt(v.after,_)}m=0,d=c.lineHeight,gt(this.afterBody,_),e.y-=s}drawFooter(e,t,i){const l=this.footer,s=l.length;let o,r;if(s){const a=gr(i.rtl,this.x,this.width);for(e.x=Qs(this,i.footerAlign,i),e.y+=i.footerMarginTop,t.textAlign=a.textAlign(i.footerAlign),t.textBaseline="middle",o=ni(i.footerFont),t.fillStyle=i.footerColor,t.font=o.string,r=0;r<s;++r)t.fillText(l[r],a.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+i.footerSpacing}}drawBackground(e,t,i,l){const{xAlign:s,yAlign:o}=this,{x:r,y:a}=e,{width:f,height:u}=i,{topLeft:c,topRight:d,bottomLeft:m,bottomRight:h}=uo(l.cornerRadius);t.fillStyle=l.backgroundColor,t.strokeStyle=l.borderColor,t.lineWidth=l.borderWidth,t.beginPath(),t.moveTo(r+c,a),o==="top"&&this.drawCaret(e,t,i,l),t.lineTo(r+f-d,a),t.quadraticCurveTo(r+f,a,r+f,a+d),o==="center"&&s==="right"&&this.drawCaret(e,t,i,l),t.lineTo(r+f,a+u-h),t.quadraticCurveTo(r+f,a+u,r+f-h,a+u),o==="bottom"&&this.drawCaret(e,t,i,l),t.lineTo(r+m,a+u),t.quadraticCurveTo(r,a+u,r,a+u-m),o==="center"&&s==="left"&&this.drawCaret(e,t,i,l),t.lineTo(r,a+c),t.quadraticCurveTo(r,a,r+c,a),t.closePath(),t.fill(),l.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,l=i&&i.x,s=i&&i.y;if(l||s){const o=Zl[e.position].call(this,this._active,this._eventPosition);if(!o)return;const r=this._size=cc(this,e),a=Object.assign({},o,this._size),f=dc(t,e,a),u=pc(e,a,f,t);(l._to!==u.x||s._to!==u.y)&&(this.xAlign=f.xAlign,this.yAlign=f.yAlign,this.width=r.width,this.height=r.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const l={width:this.width,height:this.height},s={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Ii(t.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&r&&(e.save(),e.globalAlpha=i,this.drawBackground(s,e,l,t),Yw(e,t.textDirection),s.y+=o.top,this.drawTitle(s,e,t),this.drawBody(s,e,t),this.drawFooter(s,e,t),Kw(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,l=e.map(({datasetIndex:r,index:a})=>{const f=this.chart.getDatasetMeta(r);if(!f)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:f.data[a],index:a}}),s=!Do(i,l),o=this._positionChanged(l,t);(s||o)&&(this._active=l,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const l=this.options,s=this._active||[],o=this._getActiveElements(e,s,t,i),r=this._positionChanged(o,e),a=t||!Do(o,s)||r;return a&&(this._active=o,(l.enabled||l.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),a}_getActiveElements(e,t,i,l){const s=this.options;if(e.type==="mouseout")return[];if(!l)return t.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,i);return s.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:i,caretY:l,options:s}=this,o=Zl[s.position].call(this,e,t);return o!==!1&&(i!==o.x||l!==o.y)}}Ge(la,"positioners",Zl);var sS={id:"tooltip",_element:la,positioners:Zl,afterInit(n,e,t){t&&(n.tooltip=new la({chart:n,options:t}))},beforeUpdate(n,e,t){n.tooltip&&n.tooltip.initialize(t)},reset(n,e,t){n.tooltip&&n.tooltip.initialize(t)},afterDraw(n){const e=n.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(n.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",t)}},afterEvent(n,e){if(n.tooltip){const t=e.replay;n.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,e)=>e.bodyFont.size,boxWidth:(n,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Rb},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function oS(n,e){const t=[],{bounds:l,step:s,min:o,max:r,precision:a,count:f,maxTicks:u,maxDigits:c,includeBounds:d}=n,m=s||1,h=u-1,{min:_,max:g}=e,v=!Ht(o),$=!Ht(r),C=!Ht(f),T=(g-_)/(c+1);let O=mu((g-_)/h/m)*m,M,E,A,N;if(O<1e-14&&!v&&!$)return[{value:_},{value:g}];N=Math.ceil(g/O)-Math.floor(_/O),N>h&&(O=mu(N*O/h/m)*m),Ht(a)||(M=Math.pow(10,a),O=Math.ceil(O*M)/M),l==="ticks"?(E=Math.floor(_/O)*O,A=Math.ceil(g/O)*O):(E=_,A=g),v&&$&&s&&q2((r-o)/s,O/1e3)?(N=Math.round(Math.min((r-o)/O,u)),O=(r-o)/N,E=o,A=r):C?(E=v?o:E,A=$?r:A,N=f-1,O=(A-E)/N):(N=(A-E)/O,xl(N,Math.round(N),O/1e3)?N=Math.round(N):N=Math.ceil(N));const q=Math.max(hu(O),hu(E));M=Math.pow(10,Ht(a)?q:a),E=Math.round(E*M)/M,A=Math.round(A*M)/M;let R=0;for(v&&(d&&E!==o?(t.push({value:o}),E<o&&R++,xl(Math.round((E+R*O)*M)/M,o,_c(o,T,n))&&R++):E<o&&R++);R<N;++R){const P=Math.round((E+R*O)*M)/M;if($&&P>r)break;t.push({value:P})}return $&&d&&A!==r?t.length&&xl(t[t.length-1].value,r,_c(r,T,n))?t[t.length-1].value=r:t.push({value:r}):(!$||A===r)&&t.push({value:A}),t}function _c(n,e,{horizontal:t,minRotation:i}){const l=Yi(i),s=(t?Math.sin(l):Math.cos(l))||.001,o=.75*e*(""+n).length;return Math.min(e/s,o)}class rS extends Ms{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return Ht(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:l,max:s}=this;const o=a=>l=t?l:a,r=a=>s=i?s:a;if(e){const a=Ol(l),f=Ol(s);a<0&&f<0?r(0):a>0&&f>0&&o(0)}if(l===s){let a=s===0?1:Math.abs(s*.05);r(s+a),e||o(l-a)}this.min=l,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,l;return i?(l=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,l>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${l} ticks. Limiting to 1000.`),l=1e3)):(l=this.computeTickLimit(),t=t||11),t&&(l=Math.min(t,l)),l}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const l={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},s=this._range||this,o=oS(l,s);return e.bounds==="ticks"&&j2(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const l=(i-t)/Math.max(e.length-1,1)/2;t-=l,i+=l}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return fb(e,this.chart.options.locale,this.options.ticks.format)}}class sa extends rS{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=rn(e)?e:0,this.max=rn(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=Yi(this.options.ticks.minRotation),l=(e?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,s.lineHeight/l))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Ge(sa,"id","linear"),Ge(sa,"defaults",{ticks:{callback:cb.formatters.numeric}});const xo={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},gn=Object.keys(xo);function gc(n,e){return n-e}function bc(n,e){if(Ht(e))return null;const t=n._adapter,{parser:i,round:l,isoWeekday:s}=n._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),rn(o)||(o=typeof i=="string"?t.parse(o,i):t.parse(o)),o===null?null:(l&&(o=l==="week"&&(cs(s)||s===!0)?t.startOf(o,"isoWeek",s):t.startOf(o,l)),+o)}function kc(n,e,t,i){const l=gn.length;for(let s=gn.indexOf(n);s<l-1;++s){const o=xo[gn[s]],r=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((t-e)/(r*o.size))<=i)return gn[s]}return gn[l-1]}function aS(n,e,t,i,l){for(let s=gn.length-1;s>=gn.indexOf(t);s--){const o=gn[s];if(xo[o].common&&n._adapter.diff(l,i,o)>=e-1)return o}return gn[t?gn.indexOf(t):0]}function fS(n){for(let e=gn.indexOf(n)+1,t=gn.length;e<t;++e)if(xo[gn[e]].common)return gn[e]}function yc(n,e,t){if(!t)n[e]=!0;else if(t.length){const{lo:i,hi:l}=Ia(t,e),s=t[i]>=e?t[i]:t[l];n[s]=!0}}function uS(n,e,t,i){const l=n._adapter,s=+l.startOf(e[0].value,i),o=e[e.length-1].value;let r,a;for(r=s;r<=o;r=+l.add(r,1,i))a=t[r],a>=0&&(e[a].major=!0);return e}function vc(n,e,t){const i=[],l={},s=e.length;let o,r;for(o=0;o<s;++o)r=e[o],l[r]=o,i.push({value:r,major:!1});return s===0||!t?i:uS(n,i,l,t)}class ms extends Ms{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){const i=e.time||(e.time={}),l=this._adapter=new Sb._date(e.adapters.date);l.init(t),Ql(i.displayFormats,l.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return e===void 0?null:bc(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,t=this._adapter,i=e.time.unit||"day";let{min:l,max:s,minDefined:o,maxDefined:r}=this.getUserBounds();function a(f){!o&&!isNaN(f.min)&&(l=Math.min(l,f.min)),!r&&!isNaN(f.max)&&(s=Math.max(s,f.max))}(!o||!r)&&(a(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&a(this.getMinMax(!1))),l=rn(l)&&!isNaN(l)?l:+t.startOf(Date.now(),i),s=rn(s)&&!isNaN(s)?s:+t.endOf(Date.now(),i)+1,this.min=Math.min(l,s-1),this.max=Math.max(l+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let t=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return e.length&&(t=e[0],i=e[e.length-1]),{min:t,max:i}}buildTicks(){const e=this.options,t=e.time,i=e.ticks,l=i.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&l.length&&(this.min=this._userMin||l[0],this.max=this._userMax||l[l.length-1]);const s=this.min,o=this.max,r=W2(l,s,o);return this._unit=t.unit||(i.autoSkip?kc(t.minUnit,this.min,this.max,this._getLabelCapacity(s)):aS(this,r.length,t.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:fS(this._unit),this.initOffsets(l),e.reverse&&r.reverse(),vc(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t=0,i=0,l,s;this.options.offset&&e.length&&(l=this.getDecimalForValue(e[0]),e.length===1?t=1-l:t=(this.getDecimalForValue(e[1])-l)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?i=s:i=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;t=Un(t,0,o),i=Un(i,0,o),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,l=this.options,s=l.time,o=s.unit||kc(s.minUnit,t,i,this._getLabelCapacity(t)),r=wt(l.ticks.stepSize,1),a=o==="week"?s.isoWeekday:!1,f=cs(a)||a===!0,u={};let c=t,d,m;if(f&&(c=+e.startOf(c,"isoWeek",a)),c=+e.startOf(c,f?"day":o),e.diff(i,t,o)>1e5*r)throw new Error(t+" and "+i+" are too far apart with stepSize of "+r+" "+o);const h=l.ticks.source==="data"&&this.getDataTimestamps();for(d=c,m=0;d<i;d=+e.add(d,r,o),m++)yc(u,d,h);return(d===i||l.bounds==="ticks"||m===1)&&yc(u,d,h),Object.keys(u).sort(gc).map(_=>+_)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){const l=this.options.time.displayFormats,s=this._unit,o=t||l[s];return this._adapter.format(e,o)}_tickFormatFunction(e,t,i,l){const s=this.options,o=s.ticks.callback;if(o)return qt(o,[e,t,i],this);const r=s.time.displayFormats,a=this._unit,f=this._majorUnit,u=a&&r[a],c=f&&r[f],d=i[t],m=f&&c&&d&&d.major;return this._adapter.format(e,l||(m?c:u))}generateTickLabels(e){let t,i,l;for(t=0,i=e.length;t<i;++t)l=e[t],l.label=this._tickFormatFunction(l.value,t,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const t=this._offsets,i=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+i)*t.factor)}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+i*(this.max-this.min)}_getLabelSize(e){const t=this.options.ticks,i=this.ctx.measureText(e).width,l=Yi(this.isHorizontal()?t.maxRotation:t.minRotation),s=Math.cos(l),o=Math.sin(l),r=this._resolveTickFontOptions(0).size;return{w:i*s+r*o,h:i*o+r*s}}_getLabelCapacity(e){const t=this.options.time,i=t.displayFormats,l=i[t.unit]||i.millisecond,s=this._tickFormatFunction(e,0,vc(this,[e],this._majorUnit),l),o=this._getLabelSize(s),r=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return r>0?r:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const l=this.getMatchingVisibleMetas();if(this._normalized&&l.length)return this._cache.data=l[0].controller.getAllParsedValues(this);for(t=0,i=l.length;t<i;++t)e=e.concat(l[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let t,i;if(e.length)return e;const l=this.getLabels();for(t=0,i=l.length;t<i;++t)e.push(bc(this,l[t]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return K2(e.sort(gc))}}Ge(ms,"id","time"),Ge(ms,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function xs(n,e,t){let i=0,l=n.length-1,s,o,r,a;t?(e>=n[i].pos&&e<=n[l].pos&&({lo:i,hi:l}=Ki(n,"pos",e)),{pos:s,time:r}=n[i],{pos:o,time:a}=n[l]):(e>=n[i].time&&e<=n[l].time&&({lo:i,hi:l}=Ki(n,"time",e)),{time:s,pos:r}=n[i],{time:o,pos:a}=n[l]);const f=o-s;return f?r+(a-r)*(e-s)/f:r}class wc extends ms{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=xs(t,this.min),this._tableRange=xs(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,l=[],s=[];let o,r,a,f,u;for(o=0,r=e.length;o<r;++o)f=e[o],f>=t&&f<=i&&l.push(f);if(l.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(o=0,r=l.length;o<r;++o)u=l[o+1],a=l[o-1],f=l[o],Math.round((u+a)/2)!==f&&s.push({time:f,pos:o/(r-1)});return s}_generate(){const e=this.min,t=this.max;let i=super.getDataTimestamps();return(!i.includes(e)||!i.length)&&i.splice(0,0,e),(!i.includes(t)||i.length===1)&&i.push(t),i.sort((l,s)=>l-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),i=this.getLabelTimestamps();return t.length&&i.length?e=this.normalize(t.concat(i)):e=t.length?t:i,e=this._cache.all=e,e}getDecimalForValue(e){return(xs(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return xs(this._table,i*this._tableRange+this._minPos,!0)}}Ge(wc,"id","timeseries"),Ge(wc,"defaults",ms.defaults);/*!
* chartjs-adapter-luxon v1.3.1
* https://www.chartjs.org
* (c) 2023 chartjs-adapter-luxon Contributors
* Released under the MIT license
*/const cS={datetime:He.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:He.TIME_WITH_SECONDS,minute:He.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};Sb._date.override({_id:"luxon",_create:function(n){return He.fromMillis(n,this.options)},init(n){this.options.locale||(this.options.locale=n.locale)},formats:function(){return cS},parse:function(n,e){const t=this.options,i=typeof n;return n===null||i==="undefined"?null:(i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=He.fromFormat(n,e,t):n=He.fromISO(n,t):n instanceof Date?n=He.fromJSDate(n,t):i==="object"&&!(n instanceof He)&&(n=He.fromObject(n,t)),n.isValid?n.valueOf():null)},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function Sc(n){let e,t,i;return{c(){e=b("div"),p(e,"class","chart-loader loader svelte-12c378i")},m(l,s){S(l,e,s),i=!0},i(l){i||(l&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Re(e,Yt,{duration:150},!1)),t.run(0)),i=!1},d(l){l&&w(e),l&&t&&t.end()}}}function dS(n){let e,t,i,l,s,o=n[1]==1?"log":"logs",r,a,f,u,c=n[2]&&Sc();return{c(){e=b("div"),t=b("div"),i=J("Found "),l=J(n[1]),s=D(),r=J(o),a=D(),c&&c.c(),f=D(),u=b("canvas"),p(t,"class","total-logs entrance-right svelte-12c378i"),ee(t,"hidden",n[2]),p(u,"class","chart-canvas svelte-12c378i"),p(e,"class","chart-wrapper svelte-12c378i"),ee(e,"loading",n[2])},m(d,m){S(d,e,m),y(e,t),y(t,i),y(t,l),y(t,s),y(t,r),y(e,a),c&&c.m(e,null),y(e,f),y(e,u),n[8](u)},p(d,[m]){m&2&&re(l,d[1]),m&2&&o!==(o=d[1]==1?"log":"logs")&&re(r,o),m&4&&ee(t,"hidden",d[2]),d[2]?c?m&4&&I(c,1):(c=Sc(),c.c(),I(c,1),c.m(e,f)):c&&(se(),L(c,1,1,()=>{c=null}),oe()),m&4&&ee(e,"loading",d[2])},i(d){I(c)},o(d){L(c)},d(d){d&&w(e),c&&c.d(),n[8](null)}}}function pS(n,e,t){let{filter:i=""}=e,{presets:l=""}=e,s,o,r=[],a=0,f=!1;async function u(){t(2,f=!0);const m=[l,H.normalizeLogsFilter(i)].filter(Boolean).join("&&");return fe.logs.getStats({filter:m}).then(h=>{c(),h=H.toArray(h);for(let _ of h)r.push({x:new Date(_.date),y:_.total}),t(1,a+=_.total)}).catch(h=>{h!=null&&h.isAbort||(c(),console.warn(h),fe.error(h,!m||(h==null?void 0:h.status)!=400))}).finally(()=>{t(2,f=!1)})}function c(){t(7,r=[]),t(1,a=0)}zt(()=>(di.register(Ci,ho,co,sa,ms,X4,sS),t(6,o=new di(s,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#e34562",pointBackgroundColor:"#e34562",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{resizeDelay:250,maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3"},border:{color:"#e4e9ec"},ticks:{precision:0,maxTicksLimit:4,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{color:m=>{var h;return(h=m.tick)!=null&&h.major?"#edf0f3":""}},color:"#e4e9ec",ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:m=>{var h;return(h=m.tick)!=null&&h.major?"#16161a":"#666f75"}}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(m){te[m?"unshift":"push"](()=>{s=m,t(0,s)})}return n.$$set=m=>{"filter"in m&&t(3,i=m.filter),"presets"in m&&t(4,l=m.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof l<"u")&&u(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[s,a,f,i,l,u,o,r,d]}class mS extends be{constructor(e){super(),ge(this,e,pS,dS,he,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}function hS(n){let e,t,i;return{c(){e=b("div"),t=b("code"),p(t,"class","svelte-s3jkbp"),p(e,"class",i="code-wrapper prism-light "+n[0]+" svelte-s3jkbp")},m(l,s){S(l,e,s),y(e,t),t.innerHTML=n[1]},p(l,[s]){s&2&&(t.innerHTML=l[1]),s&1&&i!==(i="code-wrapper prism-light "+l[0]+" svelte-s3jkbp")&&p(e,"class",i)},i:x,o:x,d(l){l&&w(e)}}}function _S(n,e,t){let{content:i=""}=e,{language:l="javascript"}=e,{class:s=""}=e,o="";function r(a){return a=typeof a=="string"?a:"",a=Prism.plugins.NormalizeWhitespace.normalize(a,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.highlight(a,Prism.languages[l]||Prism.languages.javascript,l)}return n.$$set=a=>{"content"in a&&t(2,i=a.content),"language"in a&&t(3,l=a.language),"class"in a&&t(0,s=a.class)},n.$$.update=()=>{n.$$.dirty&4&&typeof Prism<"u"&&i&&t(1,o=r(i))},[s,o,i,l]}class qb extends be{constructor(e){super(),ge(this,e,_S,hS,he,{content:2,language:3,class:0})}}const gS=n=>({}),$c=n=>({}),bS=n=>({}),Tc=n=>({});function Cc(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C=n[4]&&!n[2]&&Oc(n);const T=n[19].header,O=St(T,n,n[18],Tc);let M=n[4]&&n[2]&&Mc(n);const E=n[19].default,A=St(E,n,n[18],null),N=n[19].footer,q=St(N,n,n[18],$c);return{c(){e=b("div"),t=b("div"),l=D(),s=b("div"),o=b("div"),C&&C.c(),r=D(),O&&O.c(),a=D(),M&&M.c(),f=D(),u=b("div"),A&&A.c(),c=D(),d=b("div"),q&&q.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(u,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(s,"class",m="overlay-panel "+n[1]+" "+n[8]),ee(s,"popup",n[2]),p(e,"class","overlay-panel-container"),ee(e,"padded",n[2]),ee(e,"active",n[0])},m(R,P){S(R,e,P),y(e,t),y(e,l),y(e,s),y(s,o),C&&C.m(o,null),y(o,r),O&&O.m(o,null),y(o,a),M&&M.m(o,null),y(s,f),y(s,u),A&&A.m(u,null),n[21](u),y(s,c),y(s,d),q&&q.m(d,null),g=!0,v||($=[Z(t,"click",Ue(n[20])),Z(u,"scroll",n[22])],v=!0)},p(R,P){n=R,n[4]&&!n[2]?C?(C.p(n,P),P[0]&20&&I(C,1)):(C=Oc(n),C.c(),I(C,1),C.m(o,r)):C&&(se(),L(C,1,1,()=>{C=null}),oe()),O&&O.p&&(!g||P[0]&262144)&&Tt(O,T,n,n[18],g?$t(T,n[18],P,bS):Ct(n[18]),Tc),n[4]&&n[2]?M?M.p(n,P):(M=Mc(n),M.c(),M.m(o,null)):M&&(M.d(1),M=null),A&&A.p&&(!g||P[0]&262144)&&Tt(A,E,n,n[18],g?$t(E,n[18],P,null):Ct(n[18]),null),q&&q.p&&(!g||P[0]&262144)&&Tt(q,N,n,n[18],g?$t(N,n[18],P,gS):Ct(n[18]),$c),(!g||P[0]&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&p(s,"class",m),(!g||P[0]&262)&&ee(s,"popup",n[2]),(!g||P[0]&4)&&ee(e,"padded",n[2]),(!g||P[0]&1)&&ee(e,"active",n[0])},i(R){g||(R&&Je(()=>{g&&(i||(i=Re(t,as,{duration:Si,opacity:0},!0)),i.run(1))}),I(C),I(O,R),I(A,R),I(q,R),R&&Je(()=>{g&&(_&&_.end(1),h=Fg(s,Rn,n[2]?{duration:Si,y:-10}:{duration:Si,x:50}),h.start())}),g=!0)},o(R){R&&(i||(i=Re(t,as,{duration:Si,opacity:0},!1)),i.run(0)),L(C),L(O,R),L(A,R),L(q,R),h&&h.invalidate(),R&&(_=da(s,Rn,n[2]?{duration:Si,y:10}:{duration:Si,x:50})),g=!1},d(R){R&&w(e),R&&i&&i.end(),C&&C.d(),O&&O.d(R),M&&M.d(),A&&A.d(R),n[21](null),q&&q.d(R),R&&_&&_.end(),v=!1,Te($)}}}function Oc(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<i class="ri-close-line" aria-hidden="true"></i>',p(e,"type","button"),p(e,"aria-label","Close"),p(e,"class","overlay-close")},m(o,r){S(o,e,r),i=!0,l||(s=Z(e,"click",Ue(n[5])),l=!0)},p(o,r){n=o},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,as,{duration:Si},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,as,{duration:Si},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function Mc(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-close-line txt-lg" aria-hidden="true"></i>',p(e,"type","button"),p(e,"aria-label","Close"),p(e,"class","btn btn-sm btn-circle btn-transparent btn-close m-l-auto")},m(l,s){S(l,e,s),t||(i=Z(e,"click",Ue(n[5])),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function kS(n){let e,t,i,l,s=n[0]&&Cc(n);return{c(){e=b("div"),s&&s.c(),p(e,"class","overlay-panel-wrapper"),p(e,"tabindex","-1")},m(o,r){S(o,e,r),s&&s.m(e,null),n[23](e),t=!0,i||(l=[Z(window,"resize",n[10]),Z(window,"keydown",n[9])],i=!0)},p(o,r){o[0]?s?(s.p(o,r),r[0]&1&&I(s,1)):(s=Cc(o),s.c(),I(s,1),s.m(e,null)):s&&(se(),L(s,1,1,()=>{s=null}),oe())},i(o){t||(I(s),t=!0)},o(o){L(s),t=!1},d(o){o&&w(e),s&&s.d(),n[23](null),i=!1,Te(l)}}}let zi,$r=[];function jb(){return zi=zi||document.querySelector(".overlays"),zi||(zi=document.createElement("div"),zi.classList.add("overlays"),document.body.appendChild(zi)),zi}let Si=150;function Dc(){return 1e3+jb().querySelectorAll(".overlay-panel-container.active").length}function yS(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,{active:o=!1}=e,{popup:r=!1}=e,{overlayClose:a=!0}=e,{btnClose:f=!0}=e,{escClose:u=!0}=e,{beforeOpen:c=void 0}=e,{beforeHide:d=void 0}=e;const m=st(),h="op_"+H.randomString(10);let _,g,v,$,C="",T=o;function O(){typeof c=="function"&&c()===!1||t(0,o=!0)}function M(){typeof d=="function"&&d()===!1||t(0,o=!1)}function E(){return o}async function A(K){t(17,T=K),K?(v=document.activeElement,m("show"),_==null||_.focus()):(clearTimeout($),m("hide"),v==null||v.focus()),await xt(),N()}function N(){_&&(o?t(6,_.style.zIndex=Dc(),_):t(6,_.style="",_))}function q(){H.pushUnique($r,h),document.body.classList.add("overlay-active")}function R(){H.removeByValue($r,h),$r.length||document.body.classList.remove("overlay-active")}function P(K){o&&u&&K.code=="Escape"&&!H.isInput(K.target)&&_&&_.style.zIndex==Dc()&&(K.preventDefault(),M())}function F(K){o&&j(g)}function j(K,le){le&&t(8,C=""),!(!K||$)&&($=setTimeout(()=>{if(clearTimeout($),$=null,!K)return;if(K.scrollHeight-K.offsetHeight>0)t(8,C="scrollable");else{t(8,C="");return}K.scrollTop==0?t(8,C+=" scroll-top-reached"):K.scrollTop+K.offsetHeight==K.scrollHeight&&t(8,C+=" scroll-bottom-reached")},100))}zt(()=>(jb().appendChild(_),()=>{var K;clearTimeout($),R(),(K=_==null?void 0:_.classList)==null||K.add("hidden"),setTimeout(()=>{_==null||_.remove()},0)}));const U=()=>a?M():!0;function Y(K){te[K?"unshift":"push"](()=>{g=K,t(7,g)})}const X=K=>j(K.target);function W(K){te[K?"unshift":"push"](()=>{_=K,t(6,_)})}return n.$$set=K=>{"class"in K&&t(1,s=K.class),"active"in K&&t(0,o=K.active),"popup"in K&&t(2,r=K.popup),"overlayClose"in K&&t(3,a=K.overlayClose),"btnClose"in K&&t(4,f=K.btnClose),"escClose"in K&&t(12,u=K.escClose),"beforeOpen"in K&&t(13,c=K.beforeOpen),"beforeHide"in K&&t(14,d=K.beforeHide),"$$scope"in K&&t(18,l=K.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&131073&&T!=o&&A(o),n.$$.dirty[0]&128&&j(g,!0),n.$$.dirty[0]&64&&_&&N(),n.$$.dirty[0]&1&&(o?q():R())},[o,s,r,a,f,M,_,g,C,P,F,j,u,c,d,O,E,T,l,i,U,Y,X,W]}class Xt extends be{constructor(e){super(),ge(this,e,yS,kS,he,{class:1,active:0,popup:2,overlayClose:3,btnClose:4,escClose:12,beforeOpen:13,beforeHide:14,show:15,hide:5,isActive:16},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[5]}get isActive(){return this.$$.ctx[16]}}function vS(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"tabindex","-1"),p(e,"role","button"),p(e,"class",t=n[3]?n[2]:n[1]),p(e,"aria-label","Copy to clipboard")},m(o,r){S(o,e,r),l||(s=[$e(i=Fe.call(null,e,n[3]?void 0:n[0])),Z(e,"click",Cn(n[4]))],l=!0)},p(o,[r]){r&14&&t!==(t=o[3]?o[2]:o[1])&&p(e,"class",t),i&&Ot(i.update)&&r&9&&i.update.call(null,o[3]?void 0:o[0])},i:x,o:x,d(o){o&&w(e),l=!1,Te(s)}}}function wS(n,e,t){let{value:i=""}=e,{tooltip:l="Copy"}=e,{idleClasses:s="ri-file-copy-line txt-sm link-hint"}=e,{successClasses:o="ri-check-line txt-sm txt-success"}=e,{successDuration:r=500}=e,a;function f(){i&&(H.copyToClipboard(i),clearTimeout(a),t(3,a=setTimeout(()=>{clearTimeout(a),t(3,a=null)},r)))}return zt(()=>()=>{a&&clearTimeout(a)}),n.$$set=u=>{"value"in u&&t(5,i=u.value),"tooltip"in u&&t(0,l=u.tooltip),"idleClasses"in u&&t(1,s=u.idleClasses),"successClasses"in u&&t(2,o=u.successClasses),"successDuration"in u&&t(6,r=u.successDuration)},[l,s,o,a,f,i,r]}class ol extends be{constructor(e){super(),ge(this,e,wS,vS,he,{value:5,tooltip:0,idleClasses:1,successClasses:2,successDuration:6})}}function Ec(n,e,t){const i=n.slice();i[16]=e[t];const l=i[1].data[i[16]];i[17]=l;const s=i[17]!==null&&typeof i[17]=="object";return i[18]=s,i}function SS(n){let e,t,i,l,s,o,r,a,f,u,c=n[1].id+"",d,m,h,_,g,v,$,C,T,O,M,E,A,N,q,R;a=new ol({props:{value:n[1].id}}),$=new Q1({props:{level:n[1].level}}),A=new x1({props:{date:n[1].created}});let P=!n[4]&&Ic(n),F=ce(n[5](n[1].data)),j=[];for(let Y=0;Y<F.length;Y+=1)j[Y]=Ac(Ec(n,F,Y));const U=Y=>L(j[Y],1,1,()=>{j[Y]=null});return{c(){e=b("table"),t=b("tbody"),i=b("tr"),l=b("td"),l.textContent="id",s=D(),o=b("td"),r=b("div"),B(a.$$.fragment),f=D(),u=b("div"),d=J(c),m=D(),h=b("tr"),_=b("td"),_.textContent="level",g=D(),v=b("td"),B($.$$.fragment),C=D(),T=b("tr"),O=b("td"),O.textContent="created",M=D(),E=b("td"),B(A.$$.fragment),N=D(),P&&P.c(),q=D();for(let Y=0;Y<j.length;Y+=1)j[Y].c();p(l,"class","min-width txt-hint txt-bold"),p(u,"class","txt"),p(r,"class","label"),p(_,"class","min-width txt-hint txt-bold"),p(O,"class","min-width txt-hint txt-bold"),p(e,"class","table-border")},m(Y,X){S(Y,e,X),y(e,t),y(t,i),y(i,l),y(i,s),y(i,o),y(o,r),z(a,r,null),y(r,f),y(r,u),y(u,d),y(t,m),y(t,h),y(h,_),y(h,g),y(h,v),z($,v,null),y(t,C),y(t,T),y(T,O),y(T,M),y(T,E),z(A,E,null),y(t,N),P&&P.m(t,null),y(t,q);for(let W=0;W<j.length;W+=1)j[W]&&j[W].m(t,null);R=!0},p(Y,X){const W={};X&2&&(W.value=Y[1].id),a.$set(W),(!R||X&2)&&c!==(c=Y[1].id+"")&&re(d,c);const K={};X&2&&(K.level=Y[1].level),$.$set(K);const le={};if(X&2&&(le.date=Y[1].created),A.$set(le),Y[4]?P&&(P.d(1),P=null):P?P.p(Y,X):(P=Ic(Y),P.c(),P.m(t,q)),X&50){F=ce(Y[5](Y[1].data));let ne;for(ne=0;ne<F.length;ne+=1){const me=Ec(Y,F,ne);j[ne]?(j[ne].p(me,X),I(j[ne],1)):(j[ne]=Ac(me),j[ne].c(),I(j[ne],1),j[ne].m(t,null))}for(se(),ne=F.length;ne<j.length;ne+=1)U(ne);oe()}},i(Y){if(!R){I(a.$$.fragment,Y),I($.$$.fragment,Y),I(A.$$.fragment,Y);for(let X=0;X<F.length;X+=1)I(j[X]);R=!0}},o(Y){L(a.$$.fragment,Y),L($.$$.fragment,Y),L(A.$$.fragment,Y),j=j.filter(Boolean);for(let X=0;X<j.length;X+=1)L(j[X]);R=!1},d(Y){Y&&w(e),V(a),V($),V(A),P&&P.d(),rt(j,Y)}}}function $S(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","block txt-center")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function Ic(n){let e,t,i,l;function s(a,f){return a[1].message?CS:TS}let o=s(n),r=o(n);return{c(){e=b("tr"),t=b("td"),t.textContent="message",i=D(),l=b("td"),r.c(),p(t,"class","min-width txt-hint txt-bold")},m(a,f){S(a,e,f),y(e,t),y(e,i),y(e,l),r.m(l,null)},p(a,f){o===(o=s(a))&&r?r.p(a,f):(r.d(1),r=o(a),r&&(r.c(),r.m(l,null)))},d(a){a&&w(e),r.d()}}}function TS(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function CS(n){let e,t=n[1].message+"",i;return{c(){e=b("span"),i=J(t),p(e,"class","txt")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&2&&t!==(t=l[1].message+"")&&re(i,t)},d(l){l&&w(e)}}}function OS(n){let e,t=n[17]+"",i,l=n[4]&&n[16]=="execTime"?"ms":"",s;return{c(){e=b("span"),i=J(t),s=J(l),p(e,"class","txt")},m(o,r){S(o,e,r),y(e,i),y(e,s)},p(o,r){r&2&&t!==(t=o[17]+"")&&re(i,t),r&18&&l!==(l=o[4]&&o[16]=="execTime"?"ms":"")&&re(s,l)},i:x,o:x,d(o){o&&w(e)}}}function MS(n){let e,t;return e=new qb({props:{content:n[17],language:"html"}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.content=i[17]),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function DS(n){let e,t=n[17]+"",i;return{c(){e=b("span"),i=J(t),p(e,"class","label label-danger log-error-label svelte-144j2mz")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&2&&t!==(t=l[17]+"")&&re(i,t)},i:x,o:x,d(l){l&&w(e)}}}function ES(n){let e,t;return e=new qb({props:{content:JSON.stringify(n[17],null,2)}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.content=JSON.stringify(i[17],null,2)),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function IS(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function Ac(n){let e,t,i,l=n[16]+"",s,o,r,a,f,u,c,d;const m=[IS,ES,DS,MS,OS],h=[];function _(g,v){return v&2&&(a=null),a==null&&(a=!!H.isEmpty(g[17])),a?0:g[18]?1:g[16]=="error"?2:g[16]=="details"?3:4}return f=_(n,-1),u=h[f]=m[f](n),{c(){e=b("tr"),t=b("td"),i=J("data."),s=J(l),o=D(),r=b("td"),u.c(),c=D(),p(t,"class","min-width txt-hint txt-bold"),ee(t,"v-align-top",n[18])},m(g,v){S(g,e,v),y(e,t),y(t,i),y(t,s),y(e,o),y(e,r),h[f].m(r,null),y(e,c),d=!0},p(g,v){(!d||v&2)&&l!==(l=g[16]+"")&&re(s,l),(!d||v&34)&&ee(t,"v-align-top",g[18]);let $=f;f=_(g,v),f===$?h[f].p(g,v):(se(),L(h[$],1,1,()=>{h[$]=null}),oe(),u=h[f],u?u.p(g,v):(u=h[f]=m[f](g),u.c()),I(u,1),u.m(r,null))},i(g){d||(I(u),d=!0)},o(g){L(u),d=!1},d(g){g&&w(e),h[f].d()}}}function AS(n){let e,t,i,l;const s=[$S,SS],o=[];function r(a,f){var u;return a[3]?0:(u=a[1])!=null&&u.id?1:-1}return~(e=r(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),i=ve()},m(a,f){~e&&o[e].m(a,f),S(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?~e&&o[e].p(a,f):(t&&(se(),L(o[u],1,1,()=>{o[u]=null}),oe()),~e?(t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i)):t=null)},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),~e&&o[e].d(a)}}}function LS(n){let e;return{c(){e=b("h4"),e.textContent="Request log"},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function NS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),e.innerHTML='<span class="txt">Close</span>',t=D(),i=b("button"),l=b("i"),s=D(),o=b("span"),o.textContent="Download as JSON",p(e,"type","button"),p(e,"class","btn btn-transparent"),p(l,"class","ri-download-line"),p(o,"class","txt"),p(i,"type","button"),p(i,"class","btn btn-primary"),i.disabled=n[3]},m(f,u){S(f,e,u),S(f,t,u),S(f,i,u),y(i,l),y(i,s),y(i,o),r||(a=[Z(e,"click",n[9]),Z(i,"click",n[10])],r=!0)},p(f,u){u&8&&(i.disabled=f[3])},d(f){f&&(w(e),w(t),w(i)),r=!1,Te(a)}}}function PS(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[NS],header:[LS],default:[AS]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[11](e),e.$on("hide",n[7]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&2097178&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[11](null),V(e,l)}}}const Lc="log_view";function FS(n,e,t){let i;const l=st();let s,o={},r=!1;function a(C){return u(C).then(T=>{t(1,o=T),h()}),s==null?void 0:s.show()}function f(){return fe.cancelRequest(Lc),s==null?void 0:s.hide()}async function u(C){if(C&&typeof C!="string")return t(3,r=!1),C;t(3,r=!0);let T={};try{T=await fe.logs.getOne(C,{requestKey:Lc})}catch(O){O.isAbort||(f(),console.warn("resolveModel:",O),li(`Unable to load log with id "${C}"`))}return t(3,r=!1),T}const c=["execTime","type","auth","status","method","url","referer","remoteIp","userIp","userAgent","error","details"];function d(C){if(!C)return[];let T=[];for(let M of c)typeof C[M]<"u"&&T.push(M);const O=Object.keys(C);for(let M of O)T.includes(M)||T.push(M);return T}function m(){H.downloadJson(o,"log_"+o.created.replaceAll(/[-:\. ]/gi,"")+".json")}function h(){l("show",o)}function _(){l("hide",o),t(1,o={})}const g=()=>f(),v=()=>m();function $(C){te[C?"unshift":"push"](()=>{s=C,t(2,s)})}return n.$$.update=()=>{var C;n.$$.dirty&2&&t(4,i=((C=o.data)==null?void 0:C.type)=="request")},[f,o,s,r,i,d,m,_,a,g,v,$]}class RS extends be{constructor(e){super(),ge(this,e,FS,PS,he,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function qS(n,e,t){const i=n.slice();return i[1]=e[t],i}function jS(n){let e;return{c(){e=b("code"),e.textContent=`${n[1].level}:${n[1].label}`,p(e,"class","txt-xs")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function HS(n){let e,t,i,l=ce(W1),s=[];for(let o=0;o<l.length;o+=1)s[o]=jS(qS(n,l,o));return{c(){e=b("div"),t=J(`Default log levels:
`),i=b("div");for(let o=0;o<s.length;o+=1)s[o].c();p(i,"class","inline-flex flex-gap-5"),p(e,"class",n[0])},m(o,r){S(o,e,r),y(e,t),y(e,i);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(i,null)},p(o,[r]){r&1&&p(e,"class",o[0])},i:x,o:x,d(o){o&&w(e),rt(s,o)}}}function zS(n,e,t){let{class:i=""}=e;return n.$$set=l=>{"class"in l&&t(0,i=l.class)},[i]}class Hb extends be{constructor(e){super(),ge(this,e,zS,HS,he,{class:0})}}function VS(n){let e,t,i,l,s,o,r,a,f;return t=new de({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[US,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),l=new de({props:{class:"form-field",name:"logs.minLevel",$$slots:{default:[WS,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field form-field-toggle",name:"logs.logIp",$$slots:{default:[YS,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),B(t.$$.fragment),i=D(),B(l.$$.fragment),s=D(),B(o.$$.fragment),p(e,"id",n[6]),p(e,"class","grid"),p(e,"autocomplete","off")},m(u,c){S(u,e,c),z(t,e,null),y(e,i),z(l,e,null),y(e,s),z(o,e,null),r=!0,a||(f=Z(e,"submit",Ue(n[7])),a=!0)},p(u,c){const d={};c&12582914&&(d.$$scope={dirty:c,ctx:u}),t.$set(d);const m={};c&12582914&&(m.$$scope={dirty:c,ctx:u}),l.$set(m);const h={};c&12582914&&(h.$$scope={dirty:c,ctx:u}),o.$set(h)},i(u){r||(I(t.$$.fragment,u),I(l.$$.fragment,u),I(o.$$.fragment,u),r=!0)},o(u){L(t.$$.fragment,u),L(l.$$.fragment,u),L(o.$$.fragment,u),r=!1},d(u){u&&w(e),V(t),V(l),V(o),a=!1,f()}}}function BS(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="loader"></div>',p(e,"class","block txt-center")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function US(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=J("Max days retention"),l=D(),s=b("input"),r=D(),a=b("div"),a.innerHTML="Set to <code>0</code> to disable logs persistence.",p(e,"for",i=n[22]),p(s,"type","number"),p(s,"id",o=n[22]),s.required=!0,p(a,"class","help-block")},m(c,d){S(c,e,d),y(e,t),S(c,l,d),S(c,s,d),ae(s,n[1].logs.maxDays),S(c,r,d),S(c,a,d),f||(u=Z(s,"input",n[11]),f=!0)},p(c,d){d&4194304&&i!==(i=c[22])&&p(e,"for",i),d&4194304&&o!==(o=c[22])&&p(s,"id",o),d&2&&lt(s.value)!==c[1].logs.maxDays&&ae(s,c[1].logs.maxDays)},d(c){c&&(w(e),w(l),w(s),w(r),w(a)),f=!1,u()}}}function WS(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return u=new Hb({}),{c(){e=b("label"),t=J("Min log level"),l=D(),s=b("input"),o=D(),r=b("div"),a=b("p"),a.textContent="Logs with level below the minimum will be ignored.",f=D(),B(u.$$.fragment),p(e,"for",i=n[22]),p(s,"type","number"),s.required=!0,p(s,"min","-100"),p(s,"max","100"),p(r,"class","help-block")},m(h,_){S(h,e,_),y(e,t),S(h,l,_),S(h,s,_),ae(s,n[1].logs.minLevel),S(h,o,_),S(h,r,_),y(r,a),y(r,f),z(u,r,null),c=!0,d||(m=Z(s,"input",n[12]),d=!0)},p(h,_){(!c||_&4194304&&i!==(i=h[22]))&&p(e,"for",i),_&2&&lt(s.value)!==h[1].logs.minLevel&&ae(s,h[1].logs.minLevel)},i(h){c||(I(u.$$.fragment,h),c=!0)},o(h){L(u.$$.fragment,h),c=!1},d(h){h&&(w(e),w(l),w(s),w(o),w(r)),V(u),d=!1,m()}}}function YS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Enable IP logging"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(l,"for",o=n[22])},m(f,u){S(f,e,u),e.checked=n[1].logs.logIp,S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[13]),r=!0)},p(f,u){u&4194304&&t!==(t=f[22])&&p(e,"id",t),u&2&&(e.checked=f[1].logs.logIp),u&4194304&&o!==(o=f[22])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function KS(n){let e,t,i,l;const s=[BS,VS],o=[];function r(a,f){return a[4]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}function JS(n){let e;return{c(){e=b("h4"),e.textContent="Logs settings"},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function ZS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=D(),l=b("button"),s=b("span"),s.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[3],ee(l,"btn-loading",n[3])},m(f,u){S(f,e,u),y(e,t),S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"click",n[0]),r=!0)},p(f,u){u&8&&(e.disabled=f[3]),u&40&&o!==(o=!f[5]||f[3])&&(l.disabled=o),u&8&&ee(l,"btn-loading",f[3])},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function GS(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[14],$$slots:{footer:[ZS],header:[JS],default:[KS]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[15](e),e.$on("hide",n[16]),e.$on("show",n[17]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&8&&(o.beforeHide=l[14]),s&8388666&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[15](null),V(e,l)}}}function XS(n,e,t){let i,l;const s=st(),o="logs_settings_"+H.randomString(3);let r,a=!1,f=!1,u={},c={};function d(){return h(),_(),r==null?void 0:r.show()}function m(){return r==null?void 0:r.hide()}function h(){Gt(),t(9,u={}),t(1,c=JSON.parse(JSON.stringify(u||{})))}async function _(){t(4,f=!0);try{const N=await fe.settings.getAll()||{};v(N)}catch(N){fe.error(N)}t(4,f=!1)}async function g(){if(l){t(3,a=!0);try{const N=await fe.settings.update(H.filterRedactedProps(c));v(N),t(3,a=!1),m(),Nt("Successfully saved logs settings."),s("save",N)}catch(N){t(3,a=!1),fe.error(N)}}}function v(N={}){t(1,c={logs:(N==null?void 0:N.logs)||{}}),t(9,u=JSON.parse(JSON.stringify(c)))}function $(){c.logs.maxDays=lt(this.value),t(1,c)}function C(){c.logs.minLevel=lt(this.value),t(1,c)}function T(){c.logs.logIp=this.checked,t(1,c)}const O=()=>!a;function M(N){te[N?"unshift":"push"](()=>{r=N,t(2,r)})}function E(N){Oe.call(this,n,N)}function A(N){Oe.call(this,n,N)}return n.$$.update=()=>{n.$$.dirty&512&&t(10,i=JSON.stringify(u)),n.$$.dirty&1026&&t(5,l=i!=JSON.stringify(c))},[m,c,r,a,f,l,o,g,d,u,i,$,C,T,O,M,E,A]}class QS extends be{constructor(e){super(),ge(this,e,XS,GS,he,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function xS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Include requests by admins"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(l,"for",o=n[22])},m(f,u){S(f,e,u),e.checked=n[2],S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[11]),r=!0)},p(f,u){u&4194304&&t!==(t=f[22])&&p(e,"id",t),u&4&&(e.checked=f[2]),u&4194304&&o!==(o=f[22])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function Nc(n){let e,t;return e=new mS({props:{filter:n[1],presets:n[5]}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.filter=i[1]),l&32&&(s.presets=i[5]),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Pc(n){let e,t,i;function l(o){n[13](o)}let s={presets:n[5]};return n[1]!==void 0&&(s.filter=n[1]),e=new s2({props:s}),te.push(()=>ke(e,"filter",l)),e.$on("select",n[14]),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&32&&(a.presets=o[5]),!t&&r&2&&(t=!0,a.filter=o[1],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function e$(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T=n[4],O,M=n[4],E,A,N,q;f=new Go({}),f.$on("refresh",n[10]),h=new de({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[xS,({uniqueId:F})=>({22:F}),({uniqueId:F})=>F?4194304:0]},$$scope:{ctx:n}}}),g=new Ts({props:{value:n[1],placeholder:"Search term or filter like `level > 0 && data.auth = 'guest'`",extraAutocompleteKeys:["level","message","data."]}}),g.$on("submit",n[12]),$=new Hb({props:{class:"block txt-sm txt-hint m-t-xs m-b-base"}});let R=Nc(n),P=Pc(n);return{c(){e=b("div"),t=b("header"),i=b("nav"),l=b("div"),s=J(n[6]),o=D(),r=b("button"),r.innerHTML='<i class="ri-settings-4-line"></i>',a=D(),B(f.$$.fragment),u=D(),c=b("div"),d=D(),m=b("div"),B(h.$$.fragment),_=D(),B(g.$$.fragment),v=D(),B($.$$.fragment),C=D(),R.c(),O=D(),P.c(),E=ve(),p(l,"class","breadcrumb-item"),p(i,"class","breadcrumbs"),p(r,"type","button"),p(r,"aria-label","Logs settings"),p(r,"class","btn btn-transparent btn-circle"),p(c,"class","flex-fill"),p(m,"class","inline-flex"),p(t,"class","page-header"),p(e,"class","page-header-wrapper m-b-0")},m(F,j){S(F,e,j),y(e,t),y(t,i),y(i,l),y(l,s),y(t,o),y(t,r),y(t,a),z(f,t,null),y(t,u),y(t,c),y(t,d),y(t,m),z(h,m,null),y(e,_),z(g,e,null),y(e,v),z($,e,null),y(e,C),R.m(e,null),S(F,O,j),P.m(F,j),S(F,E,j),A=!0,N||(q=[$e(Fe.call(null,r,{text:"Logs settings",position:"right"})),Z(r,"click",n[9])],N=!0)},p(F,j){(!A||j&64)&&re(s,F[6]);const U={};j&12582916&&(U.$$scope={dirty:j,ctx:F}),h.$set(U);const Y={};j&2&&(Y.value=F[1]),g.$set(Y),j&16&&he(T,T=F[4])?(se(),L(R,1,1,x),oe(),R=Nc(F),R.c(),I(R,1),R.m(e,null)):R.p(F,j),j&16&&he(M,M=F[4])?(se(),L(P,1,1,x),oe(),P=Pc(F),P.c(),I(P,1),P.m(E.parentNode,E)):P.p(F,j)},i(F){A||(I(f.$$.fragment,F),I(h.$$.fragment,F),I(g.$$.fragment,F),I($.$$.fragment,F),I(R),I(P),A=!0)},o(F){L(f.$$.fragment,F),L(h.$$.fragment,F),L(g.$$.fragment,F),L($.$$.fragment,F),L(R),L(P),A=!1},d(F){F&&(w(e),w(O),w(E)),V(f),V(h),V(g),V($),R.d(F),P.d(F),N=!1,Te(q)}}}function t$(n){let e,t,i,l,s,o;e=new kn({props:{$$slots:{default:[e$]},$$scope:{ctx:n}}});let r={};i=new RS({props:r}),n[15](i),i.$on("show",n[16]),i.$on("hide",n[17]);let a={};return s=new QS({props:a}),n[18](s),s.$on("save",n[7]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),l=D(),B(s.$$.fragment)},m(f,u){z(e,f,u),S(f,t,u),z(i,f,u),S(f,l,u),z(s,f,u),o=!0},p(f,[u]){const c={};u&8388735&&(c.$$scope={dirty:u,ctx:f}),e.$set(c);const d={};i.$set(d);const m={};s.$set(m)},i(f){o||(I(e.$$.fragment,f),I(i.$$.fragment,f),I(s.$$.fragment,f),o=!0)},o(f){L(e.$$.fragment,f),L(i.$$.fragment,f),L(s.$$.fragment,f),o=!1},d(f){f&&(w(t),w(l)),V(e,f),n[15](null),V(i,f),n[18](null),V(s,f)}}}const eo="logId",Fc="adminRequests",Rc="adminLogRequests";function n$(n,e,t){var N;let i,l,s;We(n,Ho,q=>t(19,l=q)),We(n,At,q=>t(6,s=q)),en(At,s="Logs",s);const o=new URLSearchParams(l);let r,a,f=1,u=o.get("filter")||"",c=(o.get(Fc)||((N=window.localStorage)==null?void 0:N.getItem(Rc)))<<0,d=c;function m(){t(4,f++,f)}function h(q={}){let R={};R.filter=u||null,R[Fc]=c<<0||null,H.replaceHashQueryParams(Object.assign(R,q))}const _=()=>a==null?void 0:a.show(),g=()=>m();function v(){c=this.checked,t(2,c)}const $=q=>t(1,u=q.detail);function C(q){u=q,t(1,u)}const T=q=>r==null?void 0:r.show(q==null?void 0:q.detail);function O(q){te[q?"unshift":"push"](()=>{r=q,t(0,r)})}const M=q=>{var P;let R={};R[eo]=((P=q.detail)==null?void 0:P.id)||null,H.replaceHashQueryParams(R)},E=()=>{let q={};q[eo]=null,H.replaceHashQueryParams(q)};function A(q){te[q?"unshift":"push"](()=>{a=q,t(3,a)})}return n.$$.update=()=>{var q;n.$$.dirty&1&&o.get(eo)&&r&&r.show(o.get(eo)),n.$$.dirty&4&&t(5,i=c?"":'data.auth!="admin"'),n.$$.dirty&260&&d!=c&&(t(8,d=c),(q=window.localStorage)==null||q.setItem(Rc,c<<0),h()),n.$$.dirty&2&&typeof u<"u"&&h()},[r,u,c,a,f,i,s,m,d,_,g,v,$,C,T,O,M,E,A]}class i$ extends be{constructor(e){super(),ge(this,e,n$,t$,he,{})}}function l$(n){let e,t,i;return{c(){e=b("span"),p(e,"class","dragline svelte-1g2t3dj"),ee(e,"dragging",n[1])},m(l,s){S(l,e,s),n[4](e),t||(i=[Z(e,"mousedown",n[5]),Z(e,"touchstart",n[2])],t=!0)},p(l,[s]){s&2&&ee(e,"dragging",l[1])},i:x,o:x,d(l){l&&w(e),n[4](null),t=!1,Te(i)}}}function s$(n,e,t){const i=st();let{tolerance:l=0}=e,s,o=0,r=0,a=0,f=0,u=!1;function c(g){g.stopPropagation(),o=g.clientX,r=g.clientY,a=g.clientX-s.offsetLeft,f=g.clientY-s.offsetTop,document.addEventListener("touchmove",m),document.addEventListener("mousemove",m),document.addEventListener("touchend",d),document.addEventListener("mouseup",d)}function d(g){u&&(g.preventDefault(),t(1,u=!1),s.classList.remove("no-pointer-events"),i("dragstop",{event:g,elem:s})),document.removeEventListener("touchmove",m),document.removeEventListener("mousemove",m),document.removeEventListener("touchend",d),document.removeEventListener("mouseup",d)}function m(g){let v=g.clientX-o,$=g.clientY-r,C=g.clientX-a,T=g.clientY-f;!u&&Math.abs(C-s.offsetLeft)<l&&Math.abs(T-s.offsetTop)<l||(g.preventDefault(),u||(t(1,u=!0),s.classList.add("no-pointer-events"),i("dragstart",{event:g,elem:s})),i("dragging",{event:g,elem:s,diffX:v,diffY:$}))}function h(g){te[g?"unshift":"push"](()=>{s=g,t(0,s)})}const _=g=>{g.button==0&&c(g)};return n.$$set=g=>{"tolerance"in g&&t(3,l=g.tolerance)},[s,u,c,l,h,_]}class o$ extends be{constructor(e){super(),ge(this,e,s$,l$,he,{tolerance:3})}}function r$(n){let e,t,i,l,s;const o=n[5].default,r=St(o,n,n[4],null);return l=new o$({}),l.$on("dragstart",n[7]),l.$on("dragging",n[8]),l.$on("dragstop",n[9]),{c(){e=b("aside"),r&&r.c(),i=D(),B(l.$$.fragment),p(e,"class",t="page-sidebar "+n[0])},m(a,f){S(a,e,f),r&&r.m(e,null),n[6](e),S(a,i,f),z(l,a,f),s=!0},p(a,[f]){r&&r.p&&(!s||f&16)&&Tt(r,o,a,a[4],s?$t(o,a[4],f,null):Ct(a[4]),null),(!s||f&1&&t!==(t="page-sidebar "+a[0]))&&p(e,"class",t)},i(a){s||(I(r,a),I(l.$$.fragment,a),s=!0)},o(a){L(r,a),L(l.$$.fragment,a),s=!1},d(a){a&&(w(e),w(i)),r&&r.d(a),n[6](null),V(l,a)}}}const qc="@adminSidebarWidth";function a$(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,o,r,a=localStorage.getItem(qc)||null;function f(m){te[m?"unshift":"push"](()=>{o=m,t(1,o),t(2,a)})}const u=()=>{t(3,r=o.offsetWidth)},c=m=>{t(2,a=r+m.detail.diffX+"px")},d=()=>{H.triggerResize()};return n.$$set=m=>{"class"in m&&t(0,s=m.class),"$$scope"in m&&t(4,l=m.$$scope)},n.$$.update=()=>{n.$$.dirty&6&&a&&o&&(t(1,o.style.width=a,o),localStorage.setItem(qc,a))},[s,o,a,r,l,i,f,u,c,d]}class zb extends be{constructor(e){super(),ge(this,e,a$,r$,he,{class:0})}}const Va=On({});function un(n,e,t){Va.set({text:n,yesCallback:e,noCallback:t})}function Vb(){Va.set({})}function jc(n){let e,t,i;const l=n[18].default,s=St(l,n,n[17],null);return{c(){e=b("div"),s&&s.c(),p(e,"class",n[1]),ee(e,"active",n[0])},m(o,r){S(o,e,r),s&&s.m(e,null),n[19](e),i=!0},p(o,r){s&&s.p&&(!i||r[0]&131072)&&Tt(s,l,o,o[17],i?$t(l,o[17],r,null):Ct(o[17]),null),(!i||r[0]&2)&&p(e,"class",o[1]),(!i||r[0]&3)&&ee(e,"active",o[0])},i(o){i||(I(s,o),o&&Je(()=>{i&&(t||(t=Re(e,Rn,{duration:150,y:3},!0)),t.run(1))}),i=!0)},o(o){L(s,o),o&&(t||(t=Re(e,Rn,{duration:150,y:3},!1)),t.run(0)),i=!1},d(o){o&&w(e),s&&s.d(o),n[19](null),o&&t&&t.end()}}}function f$(n){let e,t,i,l,s=n[0]&&jc(n);return{c(){e=b("div"),s&&s.c(),p(e,"class","toggler-container"),p(e,"tabindex","-1"),p(e,"role","menu")},m(o,r){S(o,e,r),s&&s.m(e,null),n[20](e),t=!0,i||(l=[Z(window,"click",n[7]),Z(window,"mousedown",n[6]),Z(window,"keydown",n[5]),Z(window,"focusin",n[4])],i=!0)},p(o,r){o[0]?s?(s.p(o,r),r[0]&1&&I(s,1)):(s=jc(o),s.c(),I(s,1),s.m(e,null)):s&&(se(),L(s,1,1,()=>{s=null}),oe())},i(o){t||(I(s),t=!0)},o(o){L(s),t=!1},d(o){o&&w(e),s&&s.d(),n[20](null),i=!1,Te(l)}}}function u$(n,e,t){let{$$slots:i={},$$scope:l}=e,{trigger:s=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{autoScroll:a=!0}=e,{closableClass:f="closable"}=e,{class:u=""}=e,c,d,m,h,_,g=!1;const v=st();function $(K=0){o&&(clearTimeout(_),_=setTimeout(C,K))}function C(){o&&(t(0,o=!1),g=!1,clearTimeout(h),clearTimeout(_))}function T(){clearTimeout(_),clearTimeout(h),!o&&(t(0,o=!0),m!=null&&m.contains(c)||c==null||c.focus(),h=setTimeout(()=>{a&&(d!=null&&d.scrollIntoViewIfNeeded?d==null||d.scrollIntoViewIfNeeded():d!=null&&d.scrollIntoView&&(d==null||d.scrollIntoView({behavior:"smooth",block:"nearest"})))},180))}function O(){o?C():T()}function M(K){return!c||K.classList.contains(f)||c.contains(K)&&K.closest&&K.closest("."+f)}function E(K){A(),c==null||c.addEventListener("click",N),c==null||c.addEventListener("keydown",q),t(16,m=K||(c==null?void 0:c.parentNode)),m==null||m.addEventListener("click",R),m==null||m.addEventListener("keydown",P)}function A(){clearTimeout(h),clearTimeout(_),c==null||c.removeEventListener("click",N),c==null||c.removeEventListener("keydown",q),m==null||m.removeEventListener("click",R),m==null||m.removeEventListener("keydown",P)}function N(K){K.stopPropagation(),M(K.target)&&C()}function q(K){(K.code==="Enter"||K.code==="Space")&&(K.stopPropagation(),M(K.target)&&$(150))}function R(K){K.preventDefault(),K.stopPropagation(),O()}function P(K){(K.code==="Enter"||K.code==="Space")&&(K.preventDefault(),K.stopPropagation(),O())}function F(K){o&&!(m!=null&&m.contains(K.target))&&!(c!=null&&c.contains(K.target))&&O()}function j(K){o&&r&&K.code==="Escape"&&(K.preventDefault(),C())}function U(K){o&&(g=!(c!=null&&c.contains(K.target)))}function Y(K){var le;o&&g&&!(c!=null&&c.contains(K.target))&&!(m!=null&&m.contains(K.target))&&!((le=K.target)!=null&&le.closest(".flatpickr-calendar"))&&C()}zt(()=>(E(),()=>A()));function X(K){te[K?"unshift":"push"](()=>{d=K,t(3,d)})}function W(K){te[K?"unshift":"push"](()=>{c=K,t(2,c)})}return n.$$set=K=>{"trigger"in K&&t(8,s=K.trigger),"active"in K&&t(0,o=K.active),"escClose"in K&&t(9,r=K.escClose),"autoScroll"in K&&t(10,a=K.autoScroll),"closableClass"in K&&t(11,f=K.closableClass),"class"in K&&t(1,u=K.class),"$$scope"in K&&t(17,l=K.$$scope)},n.$$.update=()=>{var K,le;n.$$.dirty[0]&260&&c&&E(s),n.$$.dirty[0]&65537&&(o?((K=m==null?void 0:m.classList)==null||K.add("active"),m==null||m.setAttribute("aria-expanded",!0),v("show")):((le=m==null?void 0:m.classList)==null||le.remove("active"),m==null||m.setAttribute("aria-expanded",!1),v("hide")))},[o,u,c,d,F,j,U,Y,s,r,a,f,$,C,T,O,m,l,i,X,W]}class Mn extends be{constructor(e){super(),ge(this,e,u$,f$,he,{trigger:8,active:0,escClose:9,autoScroll:10,closableClass:11,class:1,hideWithDelay:12,hide:13,show:14,toggle:15},null,[-1,-1])}get hideWithDelay(){return this.$$.ctx[12]}get hide(){return this.$$.ctx[13]}get show(){return this.$$.ctx[14]}get toggle(){return this.$$.ctx[15]}}function Hc(n,e,t){const i=n.slice();return i[27]=e[t],i}function c$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("input"),l=D(),s=b("label"),o=J("Unique"),p(e,"type","checkbox"),p(e,"id",t=n[30]),e.checked=i=n[3].unique,p(s,"for",r=n[30])},m(u,c){S(u,e,c),S(u,l,c),S(u,s,c),y(s,o),a||(f=Z(e,"change",n[19]),a=!0)},p(u,c){c[0]&1073741824&&t!==(t=u[30])&&p(e,"id",t),c[0]&8&&i!==(i=u[3].unique)&&(e.checked=i),c[0]&1073741824&&r!==(r=u[30])&&p(s,"for",r)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function d$(n){let e,t,i,l;function s(a){n[20](a)}var o=n[7];function r(a,f){var c;let u={id:a[30],placeholder:`eg. CREATE INDEX idx_test on ${(c=a[0])==null?void 0:c.name} (created)`,language:"sql-create-index",minHeight:"85"};return a[2]!==void 0&&(u.value=a[2]),{props:u}}return o&&(e=Et(o,r(n)),te.push(()=>ke(e,"value",s))),{c(){e&&B(e.$$.fragment),i=ve()},m(a,f){e&&z(e,a,f),S(a,i,f),l=!0},p(a,f){var u;if(f[0]&128&&o!==(o=a[7])){if(e){se();const c=e;L(c.$$.fragment,1,0,()=>{V(c,1)}),oe()}o?(e=Et(o,r(a)),te.push(()=>ke(e,"value",s)),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const c={};f[0]&1073741824&&(c.id=a[30]),f[0]&1&&(c.placeholder=`eg. CREATE INDEX idx_test on ${(u=a[0])==null?void 0:u.name} (created)`),!t&&f[0]&4&&(t=!0,c.value=a[2],ye(()=>t=!1)),e.$set(c)}},i(a){l||(e&&I(e.$$.fragment,a),l=!0)},o(a){e&&L(e.$$.fragment,a),l=!1},d(a){a&&w(i),e&&V(e,a)}}}function p$(n){let e;return{c(){e=b("textarea"),e.disabled=!0,p(e,"rows","7"),p(e,"placeholder","Loading...")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function m$(n){let e,t,i,l;const s=[p$,d$],o=[];function r(a,f){return a[8]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}function zc(n){let e,t,i,l=ce(n[10]),s=[];for(let o=0;o<l.length;o+=1)s[o]=Vc(Hc(n,l,o));return{c(){e=b("div"),t=b("span"),t.textContent="Presets",i=D();for(let o=0;o<s.length;o+=1)s[o].c();p(t,"class","txt txt-hint"),p(e,"class","inline-flex gap-10")},m(o,r){S(o,e,r),y(e,t),y(e,i);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(e,null)},p(o,r){if(r[0]&9728){l=ce(o[10]);let a;for(a=0;a<l.length;a+=1){const f=Hc(o,l,a);s[a]?s[a].p(f,r):(s[a]=Vc(f),s[a].c(),s[a].m(e,null))}for(;a<s.length;a+=1)s[a].d(1);s.length=l.length}},d(o){o&&w(e),rt(s,o)}}}function Vc(n){let e,t=n[27]+"",i,l,s,o;function r(){return n[21](n[27])}return{c(){e=b("button"),i=J(t),l=D(),p(e,"type","button"),p(e,"class","label link-primary"),ee(e,"label-info",n[9].includes(n[27]))},m(a,f){S(a,e,f),y(e,i),y(e,l),s||(o=Z(e,"click",r),s=!0)},p(a,f){n=a,f[0]&1024&&t!==(t=n[27]+"")&&re(i,t),f[0]&1536&&ee(e,"label-info",n[9].includes(n[27]))},d(a){a&&w(e),s=!1,o()}}}function h$(n){let e,t,i,l,s,o;e=new de({props:{class:"form-field form-field-toggle m-b-sm",$$slots:{default:[c$,({uniqueId:a})=>({30:a}),({uniqueId:a})=>[a?1073741824:0]]},$$scope:{ctx:n}}}),i=new de({props:{class:"form-field required m-b-sm",name:`indexes.${n[6]||""}`,$$slots:{default:[m$,({uniqueId:a})=>({30:a}),({uniqueId:a})=>[a?1073741824:0]]},$$scope:{ctx:n}}});let r=n[10].length>0&&zc(n);return{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),l=D(),r&&r.c(),s=ve()},m(a,f){z(e,a,f),S(a,t,f),z(i,a,f),S(a,l,f),r&&r.m(a,f),S(a,s,f),o=!0},p(a,f){const u={};f[0]&1073741837|f[1]&1&&(u.$$scope={dirty:f,ctx:a}),e.$set(u);const c={};f[0]&64&&(c.name=`indexes.${a[6]||""}`),f[0]&1073742213|f[1]&1&&(c.$$scope={dirty:f,ctx:a}),i.$set(c),a[10].length>0?r?r.p(a,f):(r=zc(a),r.c(),r.m(s.parentNode,s)):r&&(r.d(1),r=null)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),o=!0)},o(a){L(e.$$.fragment,a),L(i.$$.fragment,a),o=!1},d(a){a&&(w(t),w(l),w(s)),V(e,a),V(i,a),r&&r.d(a)}}}function _$(n){let e,t=n[5]?"Update":"Create",i,l;return{c(){e=b("h4"),i=J(t),l=J(" index")},m(s,o){S(s,e,o),y(e,i),y(e,l)},p(s,o){o[0]&32&&t!==(t=s[5]?"Update":"Create")&&re(i,t)},d(s){s&&w(e)}}}function Bc(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-delete-bin-7-line"></i>',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-hint btn-transparent m-r-auto")},m(l,s){S(l,e,s),t||(i=[$e(Fe.call(null,e,{text:"Delete",position:"top"})),Z(e,"click",n[16])],t=!0)},p:x,d(l){l&&w(e),t=!1,Te(i)}}}function g$(n){let e,t,i,l,s,o,r=n[5]!=""&&Bc(n);return{c(){r&&r.c(),e=D(),t=b("button"),t.innerHTML='<span class="txt">Cancel</span>',i=D(),l=b("button"),l.innerHTML='<span class="txt">Set index</span>',p(t,"type","button"),p(t,"class","btn btn-transparent"),p(l,"type","button"),p(l,"class","btn"),ee(l,"btn-disabled",n[9].length<=0)},m(a,f){r&&r.m(a,f),S(a,e,f),S(a,t,f),S(a,i,f),S(a,l,f),s||(o=[Z(t,"click",n[17]),Z(l,"click",n[18])],s=!0)},p(a,f){a[5]!=""?r?r.p(a,f):(r=Bc(a),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null),f[0]&512&&ee(l,"btn-disabled",a[9].length<=0)},d(a){a&&(w(e),w(t),w(i),w(l)),r&&r.d(a),s=!1,Te(o)}}}function b$(n){let e,t;const i=[{popup:!0},n[14]];let l={$$slots:{footer:[g$],header:[_$],default:[h$]},$$scope:{ctx:n}};for(let s=0;s<i.length;s+=1)l=Ae(l,i[s]);return e=new Xt({props:l}),n[22](e),e.$on("hide",n[23]),e.$on("show",n[24]),{c(){B(e.$$.fragment)},m(s,o){z(e,s,o),t=!0},p(s,o){const r=o[0]&16384?mt(i,[i[0],Mt(s[14])]):{};o[0]&2029|o[1]&1&&(r.$$scope={dirty:o,ctx:s}),e.$set(r)},i(s){t||(I(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[22](null),V(e,s)}}}function k$(n,e,t){let i,l,s;const o=["collection","show","hide"];let r=Xe(e,o);const a=st();let{collection:f}=e,u,c="",d="",m="",h,_=!1;function g(U,Y){return t(6,m=H.isEmpty(Y)?"":Y),t(5,c=U||$()),t(2,d=c),u==null?void 0:u.show()}function v(){return u==null?void 0:u.hide()}function $(){const U=H.parseIndex("");return U.tableName=(f==null?void 0:f.name)||"",H.buildIndex(U)}function C(){a("remove",c),v()}function T(){s.length&&(a("submit",{old:c,new:d}),v())}function O(U){const Y=H.clone(l),X=Y.columns.find(W=>W.name==U);X?H.removeByValue(Y.columns,X):H.pushUnique(Y.columns,{name:U}),t(2,d=H.buildIndex(Y))}zt(async()=>{t(8,_=!0);try{t(7,h=(await nt(()=>import("./CodeEditor-dWSAtOWY.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(U){console.warn(U)}t(8,_=!1)});const M=()=>C(),E=()=>v(),A=()=>T(),N=U=>{t(3,l.unique=U.target.checked,l),t(3,l.tableName=l.tableName||(f==null?void 0:f.name),l),t(2,d=H.buildIndex(l))};function q(U){d=U,t(2,d)}const R=U=>O(U);function P(U){te[U?"unshift":"push"](()=>{u=U,t(4,u)})}function F(U){Oe.call(this,n,U)}function j(U){Oe.call(this,n,U)}return n.$$set=U=>{e=Ae(Ae({},e),Kt(U)),t(14,r=Xe(e,o)),"collection"in U&&t(0,f=U.collection)},n.$$.update=()=>{var U,Y,X;n.$$.dirty[0]&1&&t(10,i=(((Y=(U=f==null?void 0:f.schema)==null?void 0:U.filter(W=>!W.toDelete))==null?void 0:Y.map(W=>W.name))||[]).concat(["created","updated"])),n.$$.dirty[0]&4&&t(3,l=H.parseIndex(d)),n.$$.dirty[0]&8&&t(9,s=((X=l.columns)==null?void 0:X.map(W=>W.name))||[])},[f,v,d,l,u,c,m,h,_,s,i,C,T,O,r,g,M,E,A,N,q,R,P,F,j]}class y$ extends be{constructor(e){super(),ge(this,e,k$,b$,he,{collection:0,show:15,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[1]}}function Uc(n,e,t){const i=n.slice();i[10]=e[t],i[13]=t;const l=H.parseIndex(i[10]);return i[11]=l,i}function Wc(n){let e;return{c(){e=b("strong"),e.textContent="Unique:"},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Yc(n){var d;let e,t,i,l=((d=n[11].columns)==null?void 0:d.map(Kc).join(", "))+"",s,o,r,a,f,u=n[11].unique&&Wc();function c(){return n[4](n[10],n[13])}return{c(){var m,h;e=b("button"),u&&u.c(),t=D(),i=b("span"),s=J(l),p(i,"class","txt"),p(e,"type","button"),p(e,"class",o="label link-primary "+((h=(m=n[2].indexes)==null?void 0:m[n[13]])!=null&&h.message?"label-danger":"")+" svelte-167lbwu")},m(m,h){var _,g;S(m,e,h),u&&u.m(e,null),y(e,t),y(e,i),y(i,s),a||(f=[$e(r=Fe.call(null,e,((g=(_=n[2].indexes)==null?void 0:_[n[13]])==null?void 0:g.message)||"")),Z(e,"click",c)],a=!0)},p(m,h){var _,g,v,$,C;n=m,n[11].unique?u||(u=Wc(),u.c(),u.m(e,t)):u&&(u.d(1),u=null),h&1&&l!==(l=((_=n[11].columns)==null?void 0:_.map(Kc).join(", "))+"")&&re(s,l),h&4&&o!==(o="label link-primary "+((v=(g=n[2].indexes)==null?void 0:g[n[13]])!=null&&v.message?"label-danger":"")+" svelte-167lbwu")&&p(e,"class",o),r&&Ot(r.update)&&h&4&&r.update.call(null,((C=($=n[2].indexes)==null?void 0:$[n[13]])==null?void 0:C.message)||"")},d(m){m&&w(e),u&&u.d(),a=!1,Te(f)}}}function v$(n){var T,O,M;let e,t,i=(((O=(T=n[0])==null?void 0:T.indexes)==null?void 0:O.length)||0)+"",l,s,o,r,a,f,u,c,d,m,h,_,g=ce(((M=n[0])==null?void 0:M.indexes)||[]),v=[];for(let E=0;E<g.length;E+=1)v[E]=Yc(Uc(n,g,E));function $(E){n[7](E)}let C={};return n[0]!==void 0&&(C.collection=n[0]),c=new y$({props:C}),n[6](c),te.push(()=>ke(c,"collection",$)),c.$on("remove",n[8]),c.$on("submit",n[9]),{c(){e=b("div"),t=J("Unique constraints and indexes ("),l=J(i),s=J(")"),o=D(),r=b("div");for(let E=0;E<v.length;E+=1)v[E].c();a=D(),f=b("button"),f.innerHTML='<span class="txt">+</span> <span class="txt">New index</span>',u=D(),B(c.$$.fragment),p(e,"class","section-title"),p(f,"type","button"),p(f,"class","btn btn-xs btn-transparent btn-pill btn-outline"),p(r,"class","indexes-list svelte-167lbwu")},m(E,A){S(E,e,A),y(e,t),y(e,l),y(e,s),S(E,o,A),S(E,r,A);for(let N=0;N<v.length;N+=1)v[N]&&v[N].m(r,null);y(r,a),y(r,f),S(E,u,A),z(c,E,A),m=!0,h||(_=Z(f,"click",n[5]),h=!0)},p(E,[A]){var q,R,P;if((!m||A&1)&&i!==(i=(((R=(q=E[0])==null?void 0:q.indexes)==null?void 0:R.length)||0)+"")&&re(l,i),A&7){g=ce(((P=E[0])==null?void 0:P.indexes)||[]);let F;for(F=0;F<g.length;F+=1){const j=Uc(E,g,F);v[F]?v[F].p(j,A):(v[F]=Yc(j),v[F].c(),v[F].m(r,a))}for(;F<v.length;F+=1)v[F].d(1);v.length=g.length}const N={};!d&&A&1&&(d=!0,N.collection=E[0],ye(()=>d=!1)),c.$set(N)},i(E){m||(I(c.$$.fragment,E),m=!0)},o(E){L(c.$$.fragment,E),m=!1},d(E){E&&(w(e),w(o),w(r),w(u)),rt(v,E),n[6](null),V(c,E),h=!1,_()}}}const Kc=n=>n.name;function w$(n,e,t){let i;We(n,hi,m=>t(2,i=m));let{collection:l}=e,s;function o(m,h){for(let _=0;_<l.indexes.length;_++)if(l.indexes[_]==m){t(0,l.indexes[_]=h,l),si("indexes."+_);return}l.indexes.push(h),t(0,l)}const r=(m,h)=>s==null?void 0:s.show(m,h),a=()=>s==null?void 0:s.show();function f(m){te[m?"unshift":"push"](()=>{s=m,t(1,s)})}function u(m){l=m,t(0,l)}const c=m=>{for(let h=0;h<l.indexes.length;h++)if(l.indexes[h]==m.detail){l.indexes.splice(h,1),si("indexes."+h);break}t(0,l)},d=m=>{o(m.detail.old,m.detail.new)};return n.$$set=m=>{"collection"in m&&t(0,l=m.collection)},[l,s,i,o,r,a,f,u,c,d]}class S$ extends be{constructor(e){super(),ge(this,e,w$,v$,he,{collection:0})}}function Jc(n,e,t){const i=n.slice();return i[5]=e[t],i}function Zc(n){let e,t,i,l,s,o,r;function a(){return n[3](n[5])}return{c(){e=b("button"),t=b("i"),i=D(),l=b("span"),l.textContent=`${n[5].label}`,s=D(),p(t,"class","icon "+n[5].icon+" svelte-1gz9b6p"),p(t,"aria-hidden","true"),p(l,"class","txt"),p(e,"type","button"),p(e,"role","menuitem"),p(e,"class","dropdown-item svelte-1gz9b6p")},m(f,u){S(f,e,u),y(e,t),y(e,i),y(e,l),y(e,s),o||(r=Z(e,"click",a),o=!0)},p(f,u){n=f},d(f){f&&w(e),o=!1,r()}}}function $$(n){let e,t=ce(n[1]),i=[];for(let l=0;l<t.length;l+=1)i[l]=Zc(Jc(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);S(l,e,s)},p(l,s){if(s&6){t=ce(l[1]);let o;for(o=0;o<t.length;o+=1){const r=Jc(l,t,o);i[o]?i[o].p(r,s):(i[o]=Zc(r),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&w(e),rt(i,l)}}}function T$(n){let e,t,i,l,s,o,r,a;return o=new Mn({props:{class:"dropdown field-types-dropdown",$$slots:{default:[$$]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("i"),i=D(),l=b("div"),l.textContent="New field",s=D(),B(o.$$.fragment),p(t,"class","ri-add-line"),p(t,"aria-hidden","true"),p(l,"class","txt"),p(e,"tabindex","0"),p(e,"role","button"),p(e,"class",r="field-types-btn "+n[0]+" svelte-1gz9b6p")},m(f,u){S(f,e,u),y(e,t),y(e,i),y(e,l),y(e,s),z(o,e,null),a=!0},p(f,[u]){const c={};u&256&&(c.$$scope={dirty:u,ctx:f}),o.$set(c),(!a||u&1&&r!==(r="field-types-btn "+f[0]+" svelte-1gz9b6p"))&&p(e,"class",r)},i(f){a||(I(o.$$.fragment,f),a=!0)},o(f){L(o.$$.fragment,f),a=!1},d(f){f&&w(e),V(o)}}}function C$(n,e,t){let{class:i=""}=e;const l=st(),s=[{label:"Plain text",value:"text",icon:H.getFieldTypeIcon("text")},{label:"Rich editor",value:"editor",icon:H.getFieldTypeIcon("editor")},{label:"Number",value:"number",icon:H.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:H.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:H.getFieldTypeIcon("email")},{label:"Url",value:"url",icon:H.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:H.getFieldTypeIcon("date")},{label:"Select",value:"select",icon:H.getFieldTypeIcon("select")},{label:"File",value:"file",icon:H.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:H.getFieldTypeIcon("relation")},{label:"JSON",value:"json",icon:H.getFieldTypeIcon("json")}];function o(a){l("select",a)}const r=a=>o(a.value);return n.$$set=a=>{"class"in a&&t(0,i=a.class)},[i,s,o,r]}class O$ extends be{constructor(e){super(),ge(this,e,C$,T$,he,{class:0})}}const M$=n=>({interactive:n&64,hasErrors:n&32}),Gc=n=>({interactive:n[6],hasErrors:n[5]}),D$=n=>({interactive:n&64,hasErrors:n&32}),Xc=n=>({interactive:n[6],hasErrors:n[5]}),E$=n=>({interactive:n&64,hasErrors:n&32}),Qc=n=>({interactive:n[6],hasErrors:n[5]});function xc(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="drag-handle"></span>',p(e,"class","drag-handle-wrapper"),p(e,"draggable",!0),p(e,"aria-label","Sort")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function ed(n){let e,t,i;return{c(){e=b("div"),t=b("span"),i=J(n[4]),p(t,"class","label label-success"),p(e,"class","field-labels")},m(l,s){S(l,e,s),y(e,t),y(t,i)},p(l,s){s&16&&re(i,l[4])},d(l){l&&w(e)}}}function I$(n){let e,t,i,l,s,o,r,a,f,u,c,d,m=n[0].required&&ed(n);return{c(){m&&m.c(),e=D(),t=b("div"),i=b("i"),s=D(),o=b("input"),p(i,"class",l=H.getFieldTypeIcon(n[0].type)),p(t,"class","form-field-addon prefix no-pointer-events field-type-icon"),ee(t,"txt-disabled",!n[6]),p(o,"type","text"),o.required=!0,o.disabled=r=!n[6],o.readOnly=a=n[0].id&&n[0].system,p(o,"spellcheck","false"),o.autofocus=f=!n[0].id,p(o,"placeholder","Field name"),o.value=u=n[0].name},m(h,_){m&&m.m(h,_),S(h,e,_),S(h,t,_),y(t,i),S(h,s,_),S(h,o,_),n[15](o),n[0].id||o.focus(),c||(d=Z(o,"input",n[16]),c=!0)},p(h,_){h[0].required?m?m.p(h,_):(m=ed(h),m.c(),m.m(e.parentNode,e)):m&&(m.d(1),m=null),_&1&&l!==(l=H.getFieldTypeIcon(h[0].type))&&p(i,"class",l),_&64&&ee(t,"txt-disabled",!h[6]),_&64&&r!==(r=!h[6])&&(o.disabled=r),_&1&&a!==(a=h[0].id&&h[0].system)&&(o.readOnly=a),_&1&&f!==(f=!h[0].id)&&(o.autofocus=f),_&1&&u!==(u=h[0].name)&&o.value!==u&&(o.value=u)},d(h){h&&(w(e),w(t),w(s),w(o)),m&&m.d(h),n[15](null),c=!1,d()}}}function A$(n){let e;return{c(){e=b("span"),p(e,"class","separator")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function L$(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("i"),p(t,"class","ri-settings-3-line"),p(e,"type","button"),p(e,"aria-label","Toggle field options"),p(e,"class",i="btn btn-sm btn-circle options-trigger "+(n[3]?"btn-secondary":"btn-transparent")),p(e,"aria-expanded",n[3]),ee(e,"btn-hint",!n[3]&&!n[5]),ee(e,"btn-danger",n[5])},m(o,r){S(o,e,r),y(e,t),l||(s=Z(e,"click",n[12]),l=!0)},p(o,r){r&8&&i!==(i="btn btn-sm btn-circle options-trigger "+(o[3]?"btn-secondary":"btn-transparent"))&&p(e,"class",i),r&8&&p(e,"aria-expanded",o[3]),r&40&&ee(e,"btn-hint",!o[3]&&!o[5]),r&40&&ee(e,"btn-danger",o[5])},d(o){o&&w(e),l=!1,s()}}}function N$(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-restart-line"></i>',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-warning btn-transparent options-trigger"),p(e,"aria-label","Restore")},m(l,s){S(l,e,s),t||(i=[$e(Fe.call(null,e,"Restore")),Z(e,"click",n[9])],t=!0)},p:x,d(l){l&&w(e),t=!1,Te(i)}}}function td(n){let e,t,i,l,s,o,r,a,f,u,c;const d=n[14].options,m=St(d,n,n[19],Xc);s=new de({props:{class:"form-field form-field-toggle",name:"requried",$$slots:{default:[P$,({uniqueId:v})=>({25:v}),({uniqueId:v})=>v?33554432:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field form-field-toggle",name:"presentable",$$slots:{default:[F$,({uniqueId:v})=>({25:v}),({uniqueId:v})=>v?33554432:0]},$$scope:{ctx:n}}});const h=n[14].optionsFooter,_=St(h,n,n[19],Gc);let g=!n[0].toDelete&&nd(n);return{c(){e=b("div"),t=b("div"),m&&m.c(),i=D(),l=b("div"),B(s.$$.fragment),o=D(),B(r.$$.fragment),a=D(),_&&_.c(),f=D(),g&&g.c(),p(t,"class","hidden-empty m-b-sm"),p(l,"class","schema-field-options-footer"),p(e,"class","schema-field-options")},m(v,$){S(v,e,$),y(e,t),m&&m.m(t,null),y(e,i),y(e,l),z(s,l,null),y(l,o),z(r,l,null),y(l,a),_&&_.m(l,null),y(l,f),g&&g.m(l,null),c=!0},p(v,$){m&&m.p&&(!c||$&524384)&&Tt(m,d,v,v[19],c?$t(d,v[19],$,D$):Ct(v[19]),Xc);const C={};$&34078737&&(C.$$scope={dirty:$,ctx:v}),s.$set(C);const T={};$&34078721&&(T.$$scope={dirty:$,ctx:v}),r.$set(T),_&&_.p&&(!c||$&524384)&&Tt(_,h,v,v[19],c?$t(h,v[19],$,M$):Ct(v[19]),Gc),v[0].toDelete?g&&(se(),L(g,1,1,()=>{g=null}),oe()):g?(g.p(v,$),$&1&&I(g,1)):(g=nd(v),g.c(),I(g,1),g.m(l,null))},i(v){c||(I(m,v),I(s.$$.fragment,v),I(r.$$.fragment,v),I(_,v),I(g),v&&Je(()=>{c&&(u||(u=Re(e,tt,{duration:150},!0)),u.run(1))}),c=!0)},o(v){L(m,v),L(s.$$.fragment,v),L(r.$$.fragment,v),L(_,v),L(g),v&&(u||(u=Re(e,tt,{duration:150},!1)),u.run(0)),c=!1},d(v){v&&w(e),m&&m.d(v),V(s),V(r),_&&_.d(v),g&&g.d(),v&&u&&u.end()}}}function P$(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),o=J(n[4]),r=D(),a=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(s,"class","txt"),p(a,"class","ri-information-line link-hint"),p(l,"for",u=n[25])},m(m,h){S(m,e,h),e.checked=n[0].required,S(m,i,h),S(m,l,h),y(l,s),y(s,o),y(l,r),y(l,a),c||(d=[Z(e,"change",n[17]),$e(f=Fe.call(null,a,{text:`Requires the field value NOT to be ${H.zeroDefaultStr(n[0])}.`}))],c=!0)},p(m,h){h&33554432&&t!==(t=m[25])&&p(e,"id",t),h&1&&(e.checked=m[0].required),h&16&&re(o,m[4]),f&&Ot(f.update)&&h&1&&f.update.call(null,{text:`Requires the field value NOT to be ${H.zeroDefaultStr(m[0])}.`}),h&33554432&&u!==(u=m[25])&&p(l,"for",u)},d(m){m&&(w(e),w(i),w(l)),c=!1,Te(d)}}}function F$(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Presentable",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[25])},m(c,d){S(c,e,d),e.checked=n[0].presentable,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[18]),$e(Fe.call(null,r,{text:"Whether the field should be preferred in the Admin UI relation listings (default to auto)."}))],f=!0)},p(c,d){d&33554432&&t!==(t=c[25])&&p(e,"id",t),d&1&&(e.checked=c[0].presentable),d&33554432&&a!==(a=c[25])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function nd(n){let e,t,i,l,s,o,r;return o=new Mn({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[R$]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),l=b("i"),s=D(),B(o.$$.fragment),p(l,"class","ri-more-line"),p(l,"aria-hidden","true"),p(i,"tabindex","0"),p(i,"role","button"),p(i,"aria-label","More"),p(i,"class","btn btn-circle btn-sm btn-transparent"),p(t,"class","inline-flex flex-gap-sm flex-nowrap"),p(e,"class","m-l-auto txt-right")},m(a,f){S(a,e,f),y(e,t),y(t,i),y(i,l),y(i,s),z(o,i,null),r=!0},p(a,f){const u={};f&524288&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(I(o.$$.fragment,a),r=!0)},o(a){L(o.$$.fragment,a),r=!1},d(a){a&&w(e),V(o)}}}function R$(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Duplicate</span>',t=D(),i=b("button"),i.innerHTML='<span class="txt">Remove</span>',p(e,"type","button"),p(e,"class","dropdown-item"),p(e,"role","menuitem"),p(i,"type","button"),p(i,"class","dropdown-item"),p(i,"role","menuitem")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),l||(s=[Z(e,"click",Ue(n[10])),Z(i,"click",Ue(n[8]))],l=!0)},p:x,d(o){o&&(w(e),w(t),w(i)),l=!1,Te(s)}}}function q$(n){let e,t,i,l,s,o,r,a,f,u=n[6]&&xc();l=new de({props:{class:"form-field required m-0 "+(n[6]?"":"disabled"),name:"schema."+n[1]+".name",inlineError:!0,$$slots:{default:[I$]},$$scope:{ctx:n}}});const c=n[14].default,d=St(c,n,n[19],Qc),m=d||A$();function h($,C){if($[0].toDelete)return N$;if($[6])return L$}let _=h(n),g=_&&_(n),v=n[6]&&n[3]&&td(n);return{c(){e=b("div"),t=b("div"),u&&u.c(),i=D(),B(l.$$.fragment),s=D(),m&&m.c(),o=D(),g&&g.c(),r=D(),v&&v.c(),p(t,"class","schema-field-header"),p(e,"class","schema-field"),ee(e,"required",n[0].required),ee(e,"expanded",n[6]&&n[3]),ee(e,"deleted",n[0].toDelete)},m($,C){S($,e,C),y(e,t),u&&u.m(t,null),y(t,i),z(l,t,null),y(t,s),m&&m.m(t,null),y(t,o),g&&g.m(t,null),y(e,r),v&&v.m(e,null),f=!0},p($,[C]){$[6]?u||(u=xc(),u.c(),u.m(t,i)):u&&(u.d(1),u=null);const T={};C&64&&(T.class="form-field required m-0 "+($[6]?"":"disabled")),C&2&&(T.name="schema."+$[1]+".name"),C&524373&&(T.$$scope={dirty:C,ctx:$}),l.$set(T),d&&d.p&&(!f||C&524384)&&Tt(d,c,$,$[19],f?$t(c,$[19],C,E$):Ct($[19]),Qc),_===(_=h($))&&g?g.p($,C):(g&&g.d(1),g=_&&_($),g&&(g.c(),g.m(t,null))),$[6]&&$[3]?v?(v.p($,C),C&72&&I(v,1)):(v=td($),v.c(),I(v,1),v.m(e,null)):v&&(se(),L(v,1,1,()=>{v=null}),oe()),(!f||C&1)&&ee(e,"required",$[0].required),(!f||C&72)&&ee(e,"expanded",$[6]&&$[3]),(!f||C&1)&&ee(e,"deleted",$[0].toDelete)},i($){f||(I(l.$$.fragment,$),I(m,$),I(v),$&&Je(()=>{f&&(a||(a=Re(e,tt,{duration:150},!0)),a.run(1))}),f=!0)},o($){L(l.$$.fragment,$),L(m,$),L(v),$&&(a||(a=Re(e,tt,{duration:150},!1)),a.run(0)),f=!1},d($){$&&w(e),u&&u.d(),V(l),m&&m.d($),g&&g.d(),v&&v.d(),$&&a&&a.end()}}}let Tr=[];function j$(n,e,t){let i,l,s,o;We(n,hi,P=>t(13,o=P));let{$$slots:r={},$$scope:a}=e;const f="f_"+H.randomString(8),u=st(),c={bool:"Nonfalsey",number:"Nonzero"};let{key:d=""}=e,{field:m=H.initSchemaField()}=e,h,_=!1;function g(){m.id?t(0,m.toDelete=!0,m):(O(),u("remove"))}function v(){t(0,m.toDelete=!1,m),Gt({})}function $(){m.toDelete||(O(),u("duplicate"))}function C(P){return H.slugify(P)}function T(){t(3,_=!0),E()}function O(){t(3,_=!1)}function M(){_?O():T()}function E(){for(let P of Tr)P.id!=f&&P.collapse()}zt(()=>(Tr.push({id:f,collapse:O}),m.onMountSelect&&(t(0,m.onMountSelect=!1,m),h==null||h.select()),()=>{H.removeByKey(Tr,"id",f)}));function A(P){te[P?"unshift":"push"](()=>{h=P,t(2,h)})}const N=P=>{const F=m.name;t(0,m.name=C(P.target.value),m),P.target.value=m.name,u("rename",{oldName:F,newName:m.name})};function q(){m.required=this.checked,t(0,m)}function R(){m.presentable=this.checked,t(0,m)}return n.$$set=P=>{"key"in P&&t(1,d=P.key),"field"in P&&t(0,m=P.field),"$$scope"in P&&t(19,a=P.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&m.toDelete&&m.originalName&&m.name!==m.originalName&&t(0,m.name=m.originalName,m),n.$$.dirty&1&&!m.originalName&&m.name&&t(0,m.originalName=m.name,m),n.$$.dirty&1&&typeof m.toDelete>"u"&&t(0,m.toDelete=!1,m),n.$$.dirty&1&&m.required&&t(0,m.nullable=!1,m),n.$$.dirty&1&&t(6,i=!m.toDelete&&!(m.id&&m.system)),n.$$.dirty&8194&&t(5,l=!H.isEmpty(H.getNestedVal(o,`schema.${d}`))),n.$$.dirty&1&&t(4,s=c[m==null?void 0:m.type]||"Nonempty")},[m,d,h,_,s,l,i,u,g,v,$,C,M,o,r,A,N,q,R,a]}class oi extends be{constructor(e){super(),ge(this,e,j$,q$,he,{key:1,field:0})}}function H$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Min length"),l=D(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"step","1"),p(s,"min","0")},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.min),r||(a=Z(s,"input",n[3]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&&lt(s.value)!==f[0].options.min&&ae(s,f[0].options.min)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function z$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=J("Max length"),l=D(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"step","1"),p(s,"min",r=n[0].options.min||0)},m(u,c){S(u,e,c),y(e,t),S(u,l,c),S(u,s,c),ae(s,n[0].options.max),a||(f=Z(s,"input",n[4]),a=!0)},p(u,c){c&1024&&i!==(i=u[10])&&p(e,"for",i),c&1024&&o!==(o=u[10])&&p(s,"id",o),c&1&&r!==(r=u[0].options.min||0)&&p(s,"min",r),c&1&&lt(s.value)!==u[0].options.max&&ae(s,u[0].options.max)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function V$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Regex pattern"),l=D(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","text"),p(s,"id",o=n[10]),p(s,"placeholder","Valid Go regular expression, eg. ^\\w+$")},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.pattern),r||(a=Z(s,"input",n[5]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&&s.value!==f[0].options.pattern&&ae(s,f[0].options.pattern)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function B$(n){let e,t,i,l,s,o,r,a,f,u;return i=new de({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[H$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[z$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),f=new de({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[V$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),r=D(),a=b("div"),B(f.$$.fragment),p(t,"class","col-sm-3"),p(s,"class","col-sm-3"),p(a,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(c,d){S(c,e,d),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),y(e,r),y(e,a),z(f,a,null),u=!0},p(c,d){const m={};d&2&&(m.name="schema."+c[1]+".options.min"),d&3073&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const h={};d&2&&(h.name="schema."+c[1]+".options.max"),d&3073&&(h.$$scope={dirty:d,ctx:c}),o.$set(h);const _={};d&2&&(_.name="schema."+c[1]+".options.pattern"),d&3073&&(_.$$scope={dirty:d,ctx:c}),f.$set(_)},i(c){u||(I(i.$$.fragment,c),I(o.$$.fragment,c),I(f.$$.fragment,c),u=!0)},o(c){L(i.$$.fragment,c),L(o.$$.fragment,c),L(f.$$.fragment,c),u=!1},d(c){c&&w(e),V(i),V(o),V(f)}}}function U$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[6](r)}let o={$$slots:{options:[B$]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?mt(l,[a&2&&{key:r[1]},a&4&&Mt(r[2])]):{};a&2051&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function W$(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;function r(){s.options.min=lt(this.value),t(0,s)}function a(){s.options.max=lt(this.value),t(0,s)}function f(){s.options.pattern=this.value,t(0,s)}function u(h){s=h,t(0,s)}function c(h){Oe.call(this,n,h)}function d(h){Oe.call(this,n,h)}function m(h){Oe.call(this,n,h)}return n.$$set=h=>{e=Ae(Ae({},e),Kt(h)),t(2,l=Xe(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,l,r,a,f,u,c,d,m]}class Y$ extends be{constructor(e){super(),ge(this,e,W$,U$,he,{field:0,key:1})}}function K$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Min"),l=D(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10])},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.min),r||(a=Z(s,"input",n[4]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&&lt(s.value)!==f[0].options.min&&ae(s,f[0].options.min)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function J$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=J("Max"),l=D(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"min",r=n[0].options.min)},m(u,c){S(u,e,c),y(e,t),S(u,l,c),S(u,s,c),ae(s,n[0].options.max),a||(f=Z(s,"input",n[5]),a=!0)},p(u,c){c&1024&&i!==(i=u[10])&&p(e,"for",i),c&1024&&o!==(o=u[10])&&p(s,"id",o),c&1&&r!==(r=u[0].options.min)&&p(s,"min",r),c&1&&lt(s.value)!==u[0].options.max&&ae(s,u[0].options.max)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function Z$(n){let e,t,i,l,s,o,r;return i=new de({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[K$,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[J$,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,f){S(a,e,f),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),r=!0},p(a,f){const u={};f&2&&(u.name="schema."+a[1]+".options.min"),f&3073&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};f&2&&(c.name="schema."+a[1]+".options.max"),f&3073&&(c.$$scope={dirty:f,ctx:a}),o.$set(c)},i(a){r||(I(i.$$.fragment,a),I(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&w(e),V(i),V(o)}}}function G$(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="No decimals",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[10]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[10])},m(c,d){S(c,e,d),e.checked=n[0].options.noDecimal,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[3]),$e(Fe.call(null,r,{text:"Existing decimal numbers will not be affected."}))],f=!0)},p(c,d){d&1024&&t!==(t=c[10])&&p(e,"id",t),d&1&&(e.checked=c[0].options.noDecimal),d&1024&&a!==(a=c[10])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function X$(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle",name:"schema."+n[1]+".options.noDecimal",$$slots:{default:[G$,({uniqueId:i})=>({10:i}),({uniqueId:i})=>i?1024:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.noDecimal"),l&3073&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Q$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[6](r)}let o={$$slots:{optionsFooter:[X$],options:[Z$]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?mt(l,[a&2&&{key:r[1]},a&4&&Mt(r[2])]):{};a&2051&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function x$(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;function r(){s.options.noDecimal=this.checked,t(0,s)}function a(){s.options.min=lt(this.value),t(0,s)}function f(){s.options.max=lt(this.value),t(0,s)}function u(h){s=h,t(0,s)}function c(h){Oe.call(this,n,h)}function d(h){Oe.call(this,n,h)}function m(h){Oe.call(this,n,h)}return n.$$set=h=>{e=Ae(Ae({},e),Kt(h)),t(2,l=Xe(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,l,r,a,f,u,c,d,m]}class eT extends be{constructor(e){super(),ge(this,e,x$,Q$,he,{field:0,key:1})}}function tT(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[3](r)}let o={};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[4]),e.$on("remove",n[5]),e.$on("duplicate",n[6]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?mt(l,[a&2&&{key:r[1]},a&4&&Mt(r[2])]):{};!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function nT(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;function r(c){s=c,t(0,s)}function a(c){Oe.call(this,n,c)}function f(c){Oe.call(this,n,c)}function u(c){Oe.call(this,n,c)}return n.$$set=c=>{e=Ae(Ae({},e),Kt(c)),t(2,l=Xe(e,i)),"field"in c&&t(0,s=c.field),"key"in c&&t(1,o=c.key)},[s,o,l,r,a,f,u]}class iT extends be{constructor(e){super(),ge(this,e,nT,tT,he,{field:0,key:1})}}function lT(n){let e,t,i,l,s=[{type:t=n[5].type||"text"},{value:n[4]},{disabled:n[3]},{readOnly:n[2]},n[5]],o={};for(let r=0;r<s.length;r+=1)o=Ae(o,s[r]);return{c(){e=b("input"),ii(e,o)},m(r,a){S(r,e,a),"value"in o&&(e.value=o.value),e.autofocus&&e.focus(),i||(l=Z(e,"input",n[6]),i=!0)},p(r,[a]){ii(e,o=mt(s,[a&32&&t!==(t=r[5].type||"text")&&{type:t},a&16&&e.value!==r[4]&&{value:r[4]},a&8&&{disabled:r[3]},a&4&&{readOnly:r[2]},a&32&&r[5]])),"value"in o&&(e.value=o.value)},i:x,o:x,d(r){r&&w(e),i=!1,l()}}}function sT(n,e,t){let i;const l=["value","separator","readonly","disabled"];let s=Xe(e,l),{value:o=[]}=e,{separator:r=","}=e,{readonly:a=null}=e,{disabled:f=null}=e;const u=c=>{t(0,o=H.splitNonEmpty(c.target.value,r))};return n.$$set=c=>{e=Ae(Ae({},e),Kt(c)),t(5,s=Xe(e,l)),"value"in c&&t(0,o=c.value),"separator"in c&&t(1,r=c.separator),"readonly"in c&&t(2,a=c.readonly),"disabled"in c&&t(3,f=c.disabled)},n.$$.update=()=>{n.$$.dirty&3&&t(4,i=H.joinNonEmpty(o,r+" "))},[o,r,a,f,i,s,u]}class Pl extends be{constructor(e){super(),ge(this,e,sT,lT,he,{value:0,separator:1,readonly:2,disabled:3})}}function oT(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[3](g)}let _={id:n[9],disabled:!H.isEmpty(n[0].options.onlyDomains)};return n[0].options.exceptDomains!==void 0&&(_.value=n[0].options.exceptDomains),r=new Pl({props:_}),te.push(()=>ke(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Except domains",i=D(),l=b("i"),o=D(),B(r.$$.fragment),f=D(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[9]),p(u,"class","help-block")},m(g,v){S(g,e,v),y(e,t),y(e,i),y(e,l),S(g,o,v),z(r,g,v),S(g,f,v),S(g,u,v),c=!0,d||(m=$e(Fe.call(null,l,{text:`List of domains that are NOT allowed.
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(g,v){(!c||v&512&&s!==(s=g[9]))&&p(e,"for",s);const $={};v&512&&($.id=g[9]),v&1&&($.disabled=!H.isEmpty(g[0].options.onlyDomains)),!a&&v&1&&(a=!0,$.value=g[0].options.exceptDomains,ye(()=>a=!1)),r.$set($)},i(g){c||(I(r.$$.fragment,g),c=!0)},o(g){L(r.$$.fragment,g),c=!1},d(g){g&&(w(e),w(o),w(f),w(u)),V(r,g),d=!1,m()}}}function rT(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[4](g)}let _={id:n[9]+".options.onlyDomains",disabled:!H.isEmpty(n[0].options.exceptDomains)};return n[0].options.onlyDomains!==void 0&&(_.value=n[0].options.onlyDomains),r=new Pl({props:_}),te.push(()=>ke(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=D(),l=b("i"),o=D(),B(r.$$.fragment),f=D(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[9]+".options.onlyDomains"),p(u,"class","help-block")},m(g,v){S(g,e,v),y(e,t),y(e,i),y(e,l),S(g,o,v),z(r,g,v),S(g,f,v),S(g,u,v),c=!0,d||(m=$e(Fe.call(null,l,{text:`List of domains that are ONLY allowed.
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(g,v){(!c||v&512&&s!==(s=g[9]+".options.onlyDomains"))&&p(e,"for",s);const $={};v&512&&($.id=g[9]+".options.onlyDomains"),v&1&&($.disabled=!H.isEmpty(g[0].options.exceptDomains)),!a&&v&1&&(a=!0,$.value=g[0].options.onlyDomains,ye(()=>a=!1)),r.$set($)},i(g){c||(I(r.$$.fragment,g),c=!0)},o(g){L(r.$$.fragment,g),c=!1},d(g){g&&(w(e),w(o),w(f),w(u)),V(r,g),d=!1,m()}}}function aT(n){let e,t,i,l,s,o,r;return i=new de({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[oT,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[rT,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,f){S(a,e,f),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),r=!0},p(a,f){const u={};f&2&&(u.name="schema."+a[1]+".options.exceptDomains"),f&1537&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};f&2&&(c.name="schema."+a[1]+".options.onlyDomains"),f&1537&&(c.$$scope={dirty:f,ctx:a}),o.$set(c)},i(a){r||(I(i.$$.fragment,a),I(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&w(e),V(i),V(o)}}}function fT(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[5](r)}let o={$$slots:{options:[aT]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("duplicate",n[8]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?mt(l,[a&2&&{key:r[1]},a&4&&Mt(r[2])]):{};a&1027&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function uT(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;function r(m){n.$$.not_equal(s.options.exceptDomains,m)&&(s.options.exceptDomains=m,t(0,s))}function a(m){n.$$.not_equal(s.options.onlyDomains,m)&&(s.options.onlyDomains=m,t(0,s))}function f(m){s=m,t(0,s)}function u(m){Oe.call(this,n,m)}function c(m){Oe.call(this,n,m)}function d(m){Oe.call(this,n,m)}return n.$$set=m=>{e=Ae(Ae({},e),Kt(m)),t(2,l=Xe(e,i)),"field"in m&&t(0,s=m.field),"key"in m&&t(1,o=m.key)},[s,o,l,r,a,f,u,c,d]}class Bb extends be{constructor(e){super(),ge(this,e,uT,fT,he,{field:0,key:1})}}function cT(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[3](r)}let o={};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new Bb({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[4]),e.$on("remove",n[5]),e.$on("duplicate",n[6]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?mt(l,[a&2&&{key:r[1]},a&4&&Mt(r[2])]):{};!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function dT(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;function r(c){s=c,t(0,s)}function a(c){Oe.call(this,n,c)}function f(c){Oe.call(this,n,c)}function u(c){Oe.call(this,n,c)}return n.$$set=c=>{e=Ae(Ae({},e),Kt(c)),t(2,l=Xe(e,i)),"field"in c&&t(0,s=c.field),"key"in c&&t(1,o=c.key)},[s,o,l,r,a,f,u]}class pT extends be{constructor(e){super(),ge(this,e,dT,cT,he,{field:0,key:1})}}function mT(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Strip urls domain",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[9]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[9])},m(c,d){S(c,e,d),e.checked=n[0].options.convertUrls,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[3]),$e(Fe.call(null,r,{text:"This could help making the editor content more portable between environments since there will be no local base url to replace."}))],f=!0)},p(c,d){d&512&&t!==(t=c[9])&&p(e,"id",t),d&1&&(e.checked=c[0].options.convertUrls),d&512&&a!==(a=c[9])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function hT(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle",name:"schema."+n[1]+".options.convertUrls",$$slots:{default:[mT,({uniqueId:i})=>({9:i}),({uniqueId:i})=>i?512:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.convertUrls"),l&1537&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function _T(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[4](r)}let o={$$slots:{optionsFooter:[hT]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[5]),e.$on("remove",n[6]),e.$on("duplicate",n[7]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?mt(l,[a&2&&{key:r[1]},a&4&&Mt(r[2])]):{};a&1027&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function gT(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;function r(){t(0,s.options={convertUrls:!1},s)}function a(){s.options.convertUrls=this.checked,t(0,s)}function f(m){s=m,t(0,s)}function u(m){Oe.call(this,n,m)}function c(m){Oe.call(this,n,m)}function d(m){Oe.call(this,n,m)}return n.$$set=m=>{e=Ae(Ae({},e),Kt(m)),t(2,l=Xe(e,i)),"field"in m&&t(0,s=m.field),"key"in m&&t(1,o=m.key)},n.$$.update=()=>{n.$$.dirty&1&&H.isEmpty(s.options)&&r()},[s,o,l,a,f,u,c,d]}class bT extends be{constructor(e){super(),ge(this,e,gT,_T,he,{field:0,key:1})}}var Cr=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],Sl={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(n){return typeof console<"u"&&console.warn(n)},getWeek:function(n){var e=new Date(n.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},hs={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(n){var e=n%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},mn=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},An=function(n){return n===!0?1:0};function id(n,e){var t;return function(){var i=this,l=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,l)},e)}}var Or=function(n){return n instanceof Array?n:[n]};function fn(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function pt(n,e,t){var i=window.document.createElement(n);return e=e||"",t=t||"",i.className=e,t!==void 0&&(i.textContent=t),i}function to(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function Ub(n,e){if(e(n))return n;if(n.parentNode)return Ub(n.parentNode,e)}function no(n,e){var t=pt("div","numInputWrapper"),i=pt("input","numInput "+n),l=pt("span","arrowUp"),s=pt("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?i.type="number":(i.type="text",i.pattern="\\d*"),e!==void 0)for(var o in e)i.setAttribute(o,e[o]);return t.appendChild(i),t.appendChild(l),t.appendChild(s),t}function vn(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var Mr=function(){},Fo=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},kT={D:Mr,F:function(n,e,t){n.setMonth(t.months.longhand.indexOf(e))},G:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},H:function(n,e){n.setHours(parseFloat(e))},J:function(n,e){n.setDate(parseFloat(e))},K:function(n,e,t){n.setHours(n.getHours()%12+12*An(new RegExp(t.amPM[1],"i").test(e)))},M:function(n,e,t){n.setMonth(t.months.shorthand.indexOf(e))},S:function(n,e){n.setSeconds(parseFloat(e))},U:function(n,e){return new Date(parseFloat(e)*1e3)},W:function(n,e,t){var i=parseInt(e),l=new Date(n.getFullYear(),0,2+(i-1)*7,0,0,0,0);return l.setDate(l.getDate()-l.getDay()+t.firstDayOfWeek),l},Y:function(n,e){n.setFullYear(parseFloat(e))},Z:function(n,e){return new Date(e)},d:function(n,e){n.setDate(parseFloat(e))},h:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},i:function(n,e){n.setMinutes(parseFloat(e))},j:function(n,e){n.setDate(parseFloat(e))},l:Mr,m:function(n,e){n.setMonth(parseFloat(e)-1)},n:function(n,e){n.setMonth(parseFloat(e)-1)},s:function(n,e){n.setSeconds(parseFloat(e))},u:function(n,e){return new Date(parseFloat(e))},w:Mr,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},Ui={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},is={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[is.w(n,e,t)]},F:function(n,e,t){return Fo(is.n(n,e,t)-1,!1,e)},G:function(n,e,t){return mn(is.h(n,e,t))},H:function(n){return mn(n.getHours())},J:function(n,e){return e.ordinal!==void 0?n.getDate()+e.ordinal(n.getDate()):n.getDate()},K:function(n,e){return e.amPM[An(n.getHours()>11)]},M:function(n,e){return Fo(n.getMonth(),!0,e)},S:function(n){return mn(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return mn(n.getFullYear(),4)},d:function(n){return mn(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return mn(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return mn(n.getMonth()+1)},n:function(n){return n.getMonth()+1},s:function(n){return n.getSeconds()},u:function(n){return n.getTime()},w:function(n){return n.getDay()},y:function(n){return String(n.getFullYear()).substring(2)}},Wb=function(n){var e=n.config,t=e===void 0?Sl:e,i=n.l10n,l=i===void 0?hs:i,s=n.isMobile,o=s===void 0?!1:s;return function(r,a,f){var u=f||l;return t.formatDate!==void 0&&!o?t.formatDate(r,a,u):a.split("").map(function(c,d,m){return is[c]&&m[d-1]!=="\\"?is[c](r,u,t):c!=="\\"?c:""}).join("")}},oa=function(n){var e=n.config,t=e===void 0?Sl:e,i=n.l10n,l=i===void 0?hs:i;return function(s,o,r,a){if(!(s!==0&&!s)){var f=a||l,u,c=s;if(s instanceof Date)u=new Date(s.getTime());else if(typeof s!="string"&&s.toFixed!==void 0)u=new Date(s);else if(typeof s=="string"){var d=o||(t||Sl).dateFormat,m=String(s).trim();if(m==="today")u=new Date,r=!0;else if(t&&t.parseDate)u=t.parseDate(s,d);else if(/Z$/.test(m)||/GMT$/.test(m))u=new Date(s);else{for(var h=void 0,_=[],g=0,v=0,$="";g<d.length;g++){var C=d[g],T=C==="\\",O=d[g-1]==="\\"||T;if(Ui[C]&&!O){$+=Ui[C];var M=new RegExp($).exec(s);M&&(h=!0)&&_[C!=="Y"?"push":"unshift"]({fn:kT[C],val:M[++v]})}else T||($+=".")}u=!t||!t.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0)),_.forEach(function(E){var A=E.fn,N=E.val;return u=A(u,N,f)||u}),u=h?u:void 0}}if(!(u instanceof Date&&!isNaN(u.getTime()))){t.errorHandler(new Error("Invalid date provided: "+c));return}return r===!0&&u.setHours(0,0,0,0),u}}};function wn(n,e,t){return t===void 0&&(t=!0),t!==!1?new Date(n.getTime()).setHours(0,0,0,0)-new Date(e.getTime()).setHours(0,0,0,0):n.getTime()-e.getTime()}var yT=function(n,e,t){return n>Math.min(e,t)&&n<Math.max(e,t)},Dr=function(n,e,t){return n*3600+e*60+t},vT=function(n){var e=Math.floor(n/3600),t=(n-e*3600)/60;return[e,t,n-e*3600-t*60]},wT={DAY:864e5};function Er(n){var e=n.defaultHour,t=n.defaultMinute,i=n.defaultSeconds;if(n.minDate!==void 0){var l=n.minDate.getHours(),s=n.minDate.getMinutes(),o=n.minDate.getSeconds();e<l&&(e=l),e===l&&t<s&&(t=s),e===l&&t===s&&i<o&&(i=n.minDate.getSeconds())}if(n.maxDate!==void 0){var r=n.maxDate.getHours(),a=n.maxDate.getMinutes();e=Math.min(e,r),e===r&&(t=Math.min(a,t)),e===r&&t===a&&(i=n.maxDate.getSeconds())}return{hours:e,minutes:t,seconds:i}}typeof Object.assign!="function"&&(Object.assign=function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(!n)throw TypeError("Cannot convert undefined or null to object");for(var i=function(r){r&&Object.keys(r).forEach(function(a){return n[a]=r[a]})},l=0,s=e;l<s.length;l++){var o=s[l];i(o)}return n});var nn=function(){return nn=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&(n[l]=e[l])}return n},nn.apply(this,arguments)},ld=function(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),l=0,e=0;e<t;e++)for(var s=arguments[e],o=0,r=s.length;o<r;o++,l++)i[l]=s[o];return i},ST=300;function $T(n,e){var t={config:nn(nn({},Sl),Ut.defaultConfig),l10n:hs};t.parseDate=oa({config:t.config,l10n:t.l10n}),t._handlers=[],t.pluginElements=[],t.loadedPlugins=[],t._bind=_,t._setHoursFromDate=d,t._positionCalendar=Vt,t.changeMonth=ne,t.changeYear=Dt,t.clear=me,t.close=Pe,t.onMouseOver=Le,t._createElement=pt,t.createDay=M,t.destroy=ze,t.isEnabled=ut,t.jumpToDate=$,t.updateValue=Jt,t.open=bt,t.redraw=jn,t.set=Ie,t.setDate=Ni,t.toggle=ul;function i(){t.utils={getDaysInMonth:function(G,Q){return G===void 0&&(G=t.currentMonth),Q===void 0&&(Q=t.currentYear),G===1&&(Q%4===0&&Q%100!==0||Q%400===0)?29:t.l10n.daysInMonth[G]}}}function l(){t.element=t.input=n,t.isOpen=!1,we(),Ke(),Fl(),al(),i(),t.isMobile||O(),v(),(t.selectedDates.length||t.config.noCalendar)&&(t.config.enableTime&&d(t.config.noCalendar?t.latestSelectedDateObj:void 0),Jt(!1)),r();var G=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!t.isMobile&&G&&Vt(),kt("onReady")}function s(){var G;return((G=t.calendarContainer)===null||G===void 0?void 0:G.getRootNode()).activeElement||document.activeElement}function o(G){return G.bind(t)}function r(){var G=t.config;G.weekNumbers===!1&&G.showMonths===1||G.noCalendar!==!0&&window.requestAnimationFrame(function(){if(t.calendarContainer!==void 0&&(t.calendarContainer.style.visibility="hidden",t.calendarContainer.style.display="block"),t.daysContainer!==void 0){var Q=(t.days.offsetWidth+1)*G.showMonths;t.daysContainer.style.width=Q+"px",t.calendarContainer.style.width=Q+(t.weekWrapper!==void 0?t.weekWrapper.offsetWidth:0)+"px",t.calendarContainer.style.removeProperty("visibility"),t.calendarContainer.style.removeProperty("display")}})}function a(G){if(t.selectedDates.length===0){var Q=t.config.minDate===void 0||wn(new Date,t.config.minDate)>=0?new Date:new Date(t.config.minDate.getTime()),ie=Er(t.config);Q.setHours(ie.hours,ie.minutes,ie.seconds,Q.getMilliseconds()),t.selectedDates=[Q],t.latestSelectedDateObj=Q}G!==void 0&&G.type!=="blur"&&ri(G);var ue=t._input.value;c(),Jt(),t._input.value!==ue&&t._debouncedChange()}function f(G,Q){return G%12+12*An(Q===t.l10n.amPM[1])}function u(G){switch(G%24){case 0:case 12:return 12;default:return G%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var G=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,Q=(parseInt(t.minuteElement.value,10)||0)%60,ie=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(G=f(G,t.amPM.textContent));var ue=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&wn(t.latestSelectedDateObj,t.config.minDate,!0)===0,Ce=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&wn(t.latestSelectedDateObj,t.config.maxDate,!0)===0;if(t.config.maxTime!==void 0&&t.config.minTime!==void 0&&t.config.minTime>t.config.maxTime){var Ne=Dr(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),Ze=Dr(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),je=Dr(G,Q,ie);if(je>Ze&&je<Ne){var xe=vT(Ne);G=xe[0],Q=xe[1],ie=xe[2]}}else{if(Ce){var qe=t.config.maxTime!==void 0?t.config.maxTime:t.config.maxDate;G=Math.min(G,qe.getHours()),G===qe.getHours()&&(Q=Math.min(Q,qe.getMinutes())),Q===qe.getMinutes()&&(ie=Math.min(ie,qe.getSeconds()))}if(ue){var Be=t.config.minTime!==void 0?t.config.minTime:t.config.minDate;G=Math.max(G,Be.getHours()),G===Be.getHours()&&Q<Be.getMinutes()&&(Q=Be.getMinutes()),Q===Be.getMinutes()&&(ie=Math.max(ie,Be.getSeconds()))}}m(G,Q,ie)}}function d(G){var Q=G||t.latestSelectedDateObj;Q&&Q instanceof Date&&m(Q.getHours(),Q.getMinutes(),Q.getSeconds())}function m(G,Q,ie){t.latestSelectedDateObj!==void 0&&t.latestSelectedDateObj.setHours(G%24,Q,ie||0,0),!(!t.hourElement||!t.minuteElement||t.isMobile)&&(t.hourElement.value=mn(t.config.time_24hr?G:(12+G)%12+12*An(G%12===0)),t.minuteElement.value=mn(Q),t.amPM!==void 0&&(t.amPM.textContent=t.l10n.amPM[An(G>=12)]),t.secondElement!==void 0&&(t.secondElement.value=mn(ie)))}function h(G){var Q=vn(G),ie=parseInt(Q.value)+(G.delta||0);(ie/1e3>1||G.key==="Enter"&&!/[^\d]/.test(ie.toString()))&&Dt(ie)}function _(G,Q,ie,ue){if(Q instanceof Array)return Q.forEach(function(Ce){return _(G,Ce,ie,ue)});if(G instanceof Array)return G.forEach(function(Ce){return _(Ce,Q,ie,ue)});G.addEventListener(Q,ie,ue),t._handlers.push({remove:function(){return G.removeEventListener(Q,ie,ue)}})}function g(){kt("onChange")}function v(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(ie){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+ie+"]"),function(ue){return _(ue,"click",t[ie])})}),t.isMobile){fl();return}var G=id(Ve,50);if(t._debouncedChange=id(g,ST),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&_(t.daysContainer,"mouseover",function(ie){t.config.mode==="range"&&Le(vn(ie))}),_(t._input,"keydown",Ee),t.calendarContainer!==void 0&&_(t.calendarContainer,"keydown",Ee),!t.config.inline&&!t.config.static&&_(window,"resize",G),window.ontouchstart!==void 0?_(window.document,"touchstart",et):_(window.document,"mousedown",et),_(window.document,"focus",et,{capture:!0}),t.config.clickOpens===!0&&(_(t._input,"focus",t.open),_(t._input,"click",t.open)),t.daysContainer!==void 0&&(_(t.monthNav,"click",ct),_(t.monthNav,["keyup","increment"],h),_(t.daysContainer,"click",rl)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var Q=function(ie){return vn(ie).select()};_(t.timeContainer,["increment"],a),_(t.timeContainer,"blur",a,{capture:!0}),_(t.timeContainer,"click",C),_([t.hourElement,t.minuteElement],["focus","click"],Q),t.secondElement!==void 0&&_(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&_(t.amPM,"click",function(ie){a(ie)})}t.config.allowInput&&_(t._input,"blur",Qt)}function $(G,Q){var ie=G!==void 0?t.parseDate(G):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate<t.now?t.config.maxDate:t.now),ue=t.currentYear,Ce=t.currentMonth;try{ie!==void 0&&(t.currentYear=ie.getFullYear(),t.currentMonth=ie.getMonth())}catch(Ne){Ne.message="Invalid date supplied: "+ie,t.config.errorHandler(Ne)}Q&&t.currentYear!==ue&&(kt("onYearChange"),F()),Q&&(t.currentYear!==ue||t.currentMonth!==Ce)&&kt("onMonthChange"),t.redraw()}function C(G){var Q=vn(G);~Q.className.indexOf("arrow")&&T(G,Q.classList.contains("arrowUp")?1:-1)}function T(G,Q,ie){var ue=G&&vn(G),Ce=ie||ue&&ue.parentNode&&ue.parentNode.firstChild,Ne=at("increment");Ne.delta=Q,Ce&&Ce.dispatchEvent(Ne)}function O(){var G=window.document.createDocumentFragment();if(t.calendarContainer=pt("div","flatpickr-calendar"),t.calendarContainer.tabIndex=-1,!t.config.noCalendar){if(G.appendChild(Y()),t.innerContainer=pt("div","flatpickr-innerContainer"),t.config.weekNumbers){var Q=le(),ie=Q.weekWrapper,ue=Q.weekNumbers;t.innerContainer.appendChild(ie),t.weekNumbers=ue,t.weekWrapper=ie}t.rContainer=pt("div","flatpickr-rContainer"),t.rContainer.appendChild(W()),t.daysContainer||(t.daysContainer=pt("div","flatpickr-days"),t.daysContainer.tabIndex=-1),P(),t.rContainer.appendChild(t.daysContainer),t.innerContainer.appendChild(t.rContainer),G.appendChild(t.innerContainer)}t.config.enableTime&&G.appendChild(X()),fn(t.calendarContainer,"rangeMode",t.config.mode==="range"),fn(t.calendarContainer,"animate",t.config.animate===!0),fn(t.calendarContainer,"multiMonth",t.config.showMonths>1),t.calendarContainer.appendChild(G);var Ce=t.config.appendTo!==void 0&&t.config.appendTo.nodeType!==void 0;if((t.config.inline||t.config.static)&&(t.calendarContainer.classList.add(t.config.inline?"inline":"static"),t.config.inline&&(!Ce&&t.element.parentNode?t.element.parentNode.insertBefore(t.calendarContainer,t._input.nextSibling):t.config.appendTo!==void 0&&t.config.appendTo.appendChild(t.calendarContainer)),t.config.static)){var Ne=pt("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(Ne,t.element),Ne.appendChild(t.element),t.altInput&&Ne.appendChild(t.altInput),Ne.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function M(G,Q,ie,ue){var Ce=ut(Q,!0),Ne=pt("span",G,Q.getDate().toString());return Ne.dateObj=Q,Ne.$i=ue,Ne.setAttribute("aria-label",t.formatDate(Q,t.config.ariaDateFormat)),G.indexOf("hidden")===-1&&wn(Q,t.now)===0&&(t.todayDateElem=Ne,Ne.classList.add("today"),Ne.setAttribute("aria-current","date")),Ce?(Ne.tabIndex=-1,Dn(Q)&&(Ne.classList.add("selected"),t.selectedDateElem=Ne,t.config.mode==="range"&&(fn(Ne,"startRange",t.selectedDates[0]&&wn(Q,t.selectedDates[0],!0)===0),fn(Ne,"endRange",t.selectedDates[1]&&wn(Q,t.selectedDates[1],!0)===0),G==="nextMonthDay"&&Ne.classList.add("inRange")))):Ne.classList.add("flatpickr-disabled"),t.config.mode==="range"&&_e(Q)&&!Dn(Q)&&Ne.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&G!=="prevMonthDay"&&ue%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+t.config.getWeek(Q)+"</span>"),kt("onDayCreate",Ne),Ne}function E(G){G.focus(),t.config.mode==="range"&&Le(G)}function A(G){for(var Q=G>0?0:t.config.showMonths-1,ie=G>0?t.config.showMonths:-1,ue=Q;ue!=ie;ue+=G)for(var Ce=t.daysContainer.children[ue],Ne=G>0?0:Ce.children.length-1,Ze=G>0?Ce.children.length:-1,je=Ne;je!=Ze;je+=G){var xe=Ce.children[je];if(xe.className.indexOf("hidden")===-1&&ut(xe.dateObj))return xe}}function N(G,Q){for(var ie=G.className.indexOf("Month")===-1?G.dateObj.getMonth():t.currentMonth,ue=Q>0?t.config.showMonths:-1,Ce=Q>0?1:-1,Ne=ie-t.currentMonth;Ne!=ue;Ne+=Ce)for(var Ze=t.daysContainer.children[Ne],je=ie-t.currentMonth===Ne?G.$i+Q:Q<0?Ze.children.length-1:0,xe=Ze.children.length,qe=je;qe>=0&&qe<xe&&qe!=(Q>0?xe:-1);qe+=Ce){var Be=Ze.children[qe];if(Be.className.indexOf("hidden")===-1&&ut(Be.dateObj)&&Math.abs(G.$i-qe)>=Math.abs(Q))return E(Be)}t.changeMonth(Ce),q(A(Ce),0)}function q(G,Q){var ie=s(),ue=ht(ie||document.body),Ce=G!==void 0?G:ue?ie:t.selectedDateElem!==void 0&&ht(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&ht(t.todayDateElem)?t.todayDateElem:A(Q>0?1:-1);Ce===void 0?t._input.focus():ue?N(Ce,Q):E(Ce)}function R(G,Q){for(var ie=(new Date(G,Q,1).getDay()-t.l10n.firstDayOfWeek+7)%7,ue=t.utils.getDaysInMonth((Q-1+12)%12,G),Ce=t.utils.getDaysInMonth(Q,G),Ne=window.document.createDocumentFragment(),Ze=t.config.showMonths>1,je=Ze?"prevMonthDay hidden":"prevMonthDay",xe=Ze?"nextMonthDay hidden":"nextMonthDay",qe=ue+1-ie,Be=0;qe<=ue;qe++,Be++)Ne.appendChild(M("flatpickr-day "+je,new Date(G,Q-1,qe),qe,Be));for(qe=1;qe<=Ce;qe++,Be++)Ne.appendChild(M("flatpickr-day",new Date(G,Q,qe),qe,Be));for(var vt=Ce+1;vt<=42-ie&&(t.config.showMonths===1||Be%7!==0);vt++,Be++)Ne.appendChild(M("flatpickr-day "+xe,new Date(G,Q+1,vt%Ce),vt,Be));var Gn=pt("div","dayContainer");return Gn.appendChild(Ne),Gn}function P(){if(t.daysContainer!==void 0){to(t.daysContainer),t.weekNumbers&&to(t.weekNumbers);for(var G=document.createDocumentFragment(),Q=0;Q<t.config.showMonths;Q++){var ie=new Date(t.currentYear,t.currentMonth,1);ie.setMonth(t.currentMonth+Q),G.appendChild(R(ie.getFullYear(),ie.getMonth()))}t.daysContainer.appendChild(G),t.days=t.daysContainer.firstChild,t.config.mode==="range"&&t.selectedDates.length===1&&Le()}}function F(){if(!(t.config.showMonths>1||t.config.monthSelectorType!=="dropdown")){var G=function(ue){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&ue<t.config.minDate.getMonth()?!1:!(t.config.maxDate!==void 0&&t.currentYear===t.config.maxDate.getFullYear()&&ue>t.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var Q=0;Q<12;Q++)if(G(Q)){var ie=pt("option","flatpickr-monthDropdown-month");ie.value=new Date(t.currentYear,Q).getMonth().toString(),ie.textContent=Fo(Q,t.config.shorthandCurrentMonth,t.l10n),ie.tabIndex=-1,t.currentMonth===Q&&(ie.selected=!0),t.monthsDropdownContainer.appendChild(ie)}}}function j(){var G=pt("div","flatpickr-month"),Q=window.document.createDocumentFragment(),ie;t.config.showMonths>1||t.config.monthSelectorType==="static"?ie=pt("span","cur-month"):(t.monthsDropdownContainer=pt("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),_(t.monthsDropdownContainer,"change",function(Ze){var je=vn(Ze),xe=parseInt(je.value,10);t.changeMonth(xe-t.currentMonth),kt("onMonthChange")}),F(),ie=t.monthsDropdownContainer);var ue=no("cur-year",{tabindex:"-1"}),Ce=ue.getElementsByTagName("input")[0];Ce.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&Ce.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(Ce.setAttribute("max",t.config.maxDate.getFullYear().toString()),Ce.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var Ne=pt("div","flatpickr-current-month");return Ne.appendChild(ie),Ne.appendChild(ue),Q.appendChild(Ne),G.appendChild(Q),{container:G,yearElement:Ce,monthElement:ie}}function U(){to(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var G=t.config.showMonths;G--;){var Q=j();t.yearElements.push(Q.yearElement),t.monthElements.push(Q.monthElement),t.monthNav.appendChild(Q.container)}t.monthNav.appendChild(t.nextMonthNav)}function Y(){return t.monthNav=pt("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=pt("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=pt("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,U(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(G){t.__hidePrevMonthArrow!==G&&(fn(t.prevMonthNav,"flatpickr-disabled",G),t.__hidePrevMonthArrow=G)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(G){t.__hideNextMonthArrow!==G&&(fn(t.nextMonthNav,"flatpickr-disabled",G),t.__hideNextMonthArrow=G)}}),t.currentYearElement=t.yearElements[0],Me(),t.monthNav}function X(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var G=Er(t.config);t.timeContainer=pt("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var Q=pt("span","flatpickr-time-separator",":"),ie=no("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=ie.getElementsByTagName("input")[0];var ue=no("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=ue.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?G.hours:u(G.hours)),t.minuteElement.value=mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():G.minutes),t.hourElement.setAttribute("step",t.config.hourIncrement.toString()),t.minuteElement.setAttribute("step",t.config.minuteIncrement.toString()),t.hourElement.setAttribute("min",t.config.time_24hr?"0":"1"),t.hourElement.setAttribute("max",t.config.time_24hr?"23":"12"),t.hourElement.setAttribute("maxlength","2"),t.minuteElement.setAttribute("min","0"),t.minuteElement.setAttribute("max","59"),t.minuteElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(ie),t.timeContainer.appendChild(Q),t.timeContainer.appendChild(ue),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var Ce=no("flatpickr-second");t.secondElement=Ce.getElementsByTagName("input")[0],t.secondElement.value=mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():G.seconds),t.secondElement.setAttribute("step",t.minuteElement.getAttribute("step")),t.secondElement.setAttribute("min","0"),t.secondElement.setAttribute("max","59"),t.secondElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(pt("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(Ce)}return t.config.time_24hr||(t.amPM=pt("span","flatpickr-am-pm",t.l10n.amPM[An((t.latestSelectedDateObj?t.hourElement.value:t.config.defaultHour)>11)]),t.amPM.title=t.l10n.toggleTitle,t.amPM.tabIndex=-1,t.timeContainer.appendChild(t.amPM)),t.timeContainer}function W(){t.weekdayContainer?to(t.weekdayContainer):t.weekdayContainer=pt("div","flatpickr-weekdays");for(var G=t.config.showMonths;G--;){var Q=pt("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(Q)}return K(),t.weekdayContainer}function K(){if(t.weekdayContainer){var G=t.l10n.firstDayOfWeek,Q=ld(t.l10n.weekdays.shorthand);G>0&&G<Q.length&&(Q=ld(Q.splice(G,Q.length),Q.splice(0,G)));for(var ie=t.config.showMonths;ie--;)t.weekdayContainer.children[ie].innerHTML=`
<span class='flatpickr-weekday'>
`+Q.join("</span><span class='flatpickr-weekday'>")+`
</span>
`}}function le(){t.calendarContainer.classList.add("hasWeeks");var G=pt("div","flatpickr-weekwrapper");G.appendChild(pt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var Q=pt("div","flatpickr-weeks");return G.appendChild(Q),{weekWrapper:G,weekNumbers:Q}}function ne(G,Q){Q===void 0&&(Q=!0);var ie=Q?G:G-t.currentMonth;ie<0&&t._hidePrevMonthArrow===!0||ie>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=ie,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,kt("onYearChange"),F()),P(),kt("onMonthChange"),Me())}function me(G,Q){if(G===void 0&&(G=!0),Q===void 0&&(Q=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,Q===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var ie=Er(t.config),ue=ie.hours,Ce=ie.minutes,Ne=ie.seconds;m(ue,Ce,Ne)}t.redraw(),G&&kt("onChange")}function Pe(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),kt("onClose")}function ze(){t.config!==void 0&&kt("onDestroy");for(var G=t._handlers.length;G--;)t._handlers[G].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var Q=t.calendarContainer.parentNode;if(Q.lastChild&&Q.removeChild(Q.lastChild),Q.parentNode){for(;Q.firstChild;)Q.parentNode.insertBefore(Q.firstChild,Q);Q.parentNode.removeChild(Q)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(ie){try{delete t[ie]}catch{}})}function Qe(G){return t.calendarContainer.contains(G)}function et(G){if(t.isOpen&&!t.config.inline){var Q=vn(G),ie=Qe(Q),ue=Q===t.input||Q===t.altInput||t.element.contains(Q)||G.path&&G.path.indexOf&&(~G.path.indexOf(t.input)||~G.path.indexOf(t.altInput)),Ce=!ue&&!ie&&!Qe(G.relatedTarget),Ne=!t.config.ignoredFocusElements.some(function(Ze){return Ze.contains(Q)});Ce&&Ne&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function Dt(G){if(!(!G||t.config.minDate&&G<t.config.minDate.getFullYear()||t.config.maxDate&&G>t.config.maxDate.getFullYear())){var Q=G,ie=t.currentYear!==Q;t.currentYear=Q||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),ie&&(t.redraw(),kt("onYearChange"),F())}}function ut(G,Q){var ie;Q===void 0&&(Q=!0);var ue=t.parseDate(G,void 0,Q);if(t.config.minDate&&ue&&wn(ue,t.config.minDate,Q!==void 0?Q:!t.minDateHasTime)<0||t.config.maxDate&&ue&&wn(ue,t.config.maxDate,Q!==void 0?Q:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(ue===void 0)return!1;for(var Ce=!!t.config.enable,Ne=(ie=t.config.enable)!==null&&ie!==void 0?ie:t.config.disable,Ze=0,je=void 0;Ze<Ne.length;Ze++){if(je=Ne[Ze],typeof je=="function"&&je(ue))return Ce;if(je instanceof Date&&ue!==void 0&&je.getTime()===ue.getTime())return Ce;if(typeof je=="string"){var xe=t.parseDate(je,void 0,!0);return xe&&xe.getTime()===ue.getTime()?Ce:!Ce}else if(typeof je=="object"&&ue!==void 0&&je.from&&je.to&&ue.getTime()>=je.from.getTime()&&ue.getTime()<=je.to.getTime())return Ce}return!Ce}function ht(G){return t.daysContainer!==void 0?G.className.indexOf("hidden")===-1&&G.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(G):!1}function Qt(G){var Q=G.target===t._input,ie=t._input.value.trimEnd()!==_t();Q&&ie&&!(G.relatedTarget&&Qe(G.relatedTarget))&&t.setDate(t._input.value,!0,G.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function Ee(G){var Q=vn(G),ie=t.config.wrap?n.contains(Q):Q===t._input,ue=t.config.allowInput,Ce=t.isOpen&&(!ue||!ie),Ne=t.config.inline&&ie&&!ue;if(G.keyCode===13&&ie){if(ue)return t.setDate(t._input.value,!0,Q===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),Q.blur();t.open()}else if(Qe(Q)||Ce||Ne){var Ze=!!t.timeContainer&&t.timeContainer.contains(Q);switch(G.keyCode){case 13:Ze?(G.preventDefault(),a(),Li()):rl(G);break;case 27:G.preventDefault(),Li();break;case 8:case 46:ie&&!t.config.allowInput&&(G.preventDefault(),t.clear());break;case 37:case 39:if(!Ze&&!ie){G.preventDefault();var je=s();if(t.daysContainer!==void 0&&(ue===!1||je&&ht(je))){var xe=G.keyCode===39?1:-1;G.ctrlKey?(G.stopPropagation(),ne(xe),q(A(1),0)):q(void 0,xe)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:G.preventDefault();var qe=G.keyCode===40?1:-1;t.daysContainer&&Q.$i!==void 0||Q===t.input||Q===t.altInput?G.ctrlKey?(G.stopPropagation(),Dt(t.currentYear-qe),q(A(1),0)):Ze||q(void 0,qe*7):Q===t.currentYearElement?Dt(t.currentYear-qe):t.config.enableTime&&(!Ze&&t.hourElement&&t.hourElement.focus(),a(G),t._debouncedChange());break;case 9:if(Ze){var Be=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(yn){return yn}),vt=Be.indexOf(Q);if(vt!==-1){var Gn=Be[vt+(G.shiftKey?-1:1)];G.preventDefault(),(Gn||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains(Q)&&G.shiftKey&&(G.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&Q===t.amPM)switch(G.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],c(),Jt();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],c(),Jt();break}(ie||Qe(Q))&&kt("onKeyDown",G)}function Le(G,Q){if(Q===void 0&&(Q="flatpickr-day"),!(t.selectedDates.length!==1||G&&(!G.classList.contains(Q)||G.classList.contains("flatpickr-disabled")))){for(var ie=G?G.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),ue=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),Ce=Math.min(ie,t.selectedDates[0].getTime()),Ne=Math.max(ie,t.selectedDates[0].getTime()),Ze=!1,je=0,xe=0,qe=Ce;qe<Ne;qe+=wT.DAY)ut(new Date(qe),!0)||(Ze=Ze||qe>Ce&&qe<Ne,qe<ue&&(!je||qe>je)?je=qe:qe>ue&&(!xe||qe<xe)&&(xe=qe));var Be=Array.from(t.rContainer.querySelectorAll("*:nth-child(-n+"+t.config.showMonths+") > ."+Q));Be.forEach(function(vt){var Gn=vt.dateObj,yn=Gn.getTime(),Rl=je>0&&yn<je||xe>0&&yn>xe;if(Rl){vt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(cl){vt.classList.remove(cl)});return}else if(Ze&&!Rl)return;["startRange","inRange","endRange","notAllowed"].forEach(function(cl){vt.classList.remove(cl)}),G!==void 0&&(G.classList.add(ie<=t.selectedDates[0].getTime()?"startRange":"endRange"),ue<ie&&yn===ue?vt.classList.add("startRange"):ue>ie&&yn===ue&&vt.classList.add("endRange"),yn>=je&&(xe===0||yn<=xe)&&yT(yn,ue,ie)&&vt.classList.add("inRange"))})}}function Ve(){t.isOpen&&!t.config.static&&!t.config.inline&&Vt()}function bt(G,Q){if(Q===void 0&&(Q=t._positionElement),t.isMobile===!0){if(G){G.preventDefault();var ie=vn(G);ie&&ie.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),kt("onOpen");return}else if(t._input.disabled||t.config.inline)return;var ue=t.isOpen;t.isOpen=!0,ue||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),kt("onOpen"),Vt(Q)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(G===void 0||!t.timeContainer.contains(G.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function pe(G){return function(Q){var ie=t.config["_"+G+"Date"]=t.parseDate(Q,t.config.dateFormat),ue=t.config["_"+(G==="min"?"max":"min")+"Date"];ie!==void 0&&(t[G==="min"?"minDateHasTime":"maxDateHasTime"]=ie.getHours()>0||ie.getMinutes()>0||ie.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(Ce){return ut(Ce)}),!t.selectedDates.length&&G==="min"&&d(ie),Jt()),t.daysContainer&&(jn(),ie!==void 0?t.currentYearElement[G]=ie.getFullYear().toString():t.currentYearElement.removeAttribute(G),t.currentYearElement.disabled=!!ue&&ie!==void 0&&ue.getFullYear()===ie.getFullYear())}}function we(){var G=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],Q=nn(nn({},JSON.parse(JSON.stringify(n.dataset||{}))),e),ie={};t.config.parseDate=Q.parseDate,t.config.formatDate=Q.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(Be){t.config._enable=Zn(Be)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(Be){t.config._disable=Zn(Be)}});var ue=Q.mode==="time";if(!Q.dateFormat&&(Q.enableTime||ue)){var Ce=Ut.defaultConfig.dateFormat||Sl.dateFormat;ie.dateFormat=Q.noCalendar||ue?"H:i"+(Q.enableSeconds?":S":""):Ce+" H:i"+(Q.enableSeconds?":S":"")}if(Q.altInput&&(Q.enableTime||ue)&&!Q.altFormat){var Ne=Ut.defaultConfig.altFormat||Sl.altFormat;ie.altFormat=Q.noCalendar||ue?"h:i"+(Q.enableSeconds?":S K":" K"):Ne+(" h:i"+(Q.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:pe("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:pe("max")});var Ze=function(Be){return function(vt){t.config[Be==="min"?"_minTime":"_maxTime"]=t.parseDate(vt,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:Ze("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:Ze("max")}),Q.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,ie,Q);for(var je=0;je<G.length;je++)t.config[G[je]]=t.config[G[je]]===!0||t.config[G[je]]==="true";Cr.filter(function(Be){return t.config[Be]!==void 0}).forEach(function(Be){t.config[Be]=Or(t.config[Be]||[]).map(o)}),t.isMobile=!t.config.disableMobile&&!t.config.inline&&t.config.mode==="single"&&!t.config.disable.length&&!t.config.enable&&!t.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var je=0;je<t.config.plugins.length;je++){var xe=t.config.plugins[je](t)||{};for(var qe in xe)Cr.indexOf(qe)>-1?t.config[qe]=Or(xe[qe]).map(o).concat(t.config[qe]):typeof Q[qe]>"u"&&(t.config[qe]=xe[qe])}Q.altInputClass||(t.config.altInputClass=Se().className+" "+t.config.altInputClass),kt("onParseConfig")}function Se(){return t.config.wrap?n.querySelector("[data-input]"):n}function Ke(){typeof t.config.locale!="object"&&typeof Ut.l10ns[t.config.locale]>"u"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=nn(nn({},Ut.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?Ut.l10ns[t.config.locale]:void 0),Ui.D="("+t.l10n.weekdays.shorthand.join("|")+")",Ui.l="("+t.l10n.weekdays.longhand.join("|")+")",Ui.M="("+t.l10n.months.shorthand.join("|")+")",Ui.F="("+t.l10n.months.longhand.join("|")+")",Ui.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var G=nn(nn({},e),JSON.parse(JSON.stringify(n.dataset||{})));G.time_24hr===void 0&&Ut.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=Wb(t),t.parseDate=oa({config:t.config,l10n:t.l10n})}function Vt(G){if(typeof t.config.position=="function")return void t.config.position(t,G);if(t.calendarContainer!==void 0){kt("onPreCalendarPosition");var Q=G||t._positionElement,ie=Array.prototype.reduce.call(t.calendarContainer.children,function(a0,f0){return a0+f0.offsetHeight},0),ue=t.calendarContainer.offsetWidth,Ce=t.config.position.split(" "),Ne=Ce[0],Ze=Ce.length>1?Ce[1]:null,je=Q.getBoundingClientRect(),xe=window.innerHeight-je.bottom,qe=Ne==="above"||Ne!=="below"&&xe<ie&&je.top>ie,Be=window.pageYOffset+je.top+(qe?-ie-2:Q.offsetHeight+2);if(fn(t.calendarContainer,"arrowTop",!qe),fn(t.calendarContainer,"arrowBottom",qe),!t.config.inline){var vt=window.pageXOffset+je.left,Gn=!1,yn=!1;Ze==="center"?(vt-=(ue-je.width)/2,Gn=!0):Ze==="right"&&(vt-=ue-je.width,yn=!0),fn(t.calendarContainer,"arrowLeft",!Gn&&!yn),fn(t.calendarContainer,"arrowCenter",Gn),fn(t.calendarContainer,"arrowRight",yn);var Rl=window.document.body.offsetWidth-(window.pageXOffset+je.right),cl=vt+ue>window.document.body.offsetWidth,t0=Rl+ue>window.document.body.offsetWidth;if(fn(t.calendarContainer,"rightMost",cl),!t.config.static)if(t.calendarContainer.style.top=Be+"px",!cl)t.calendarContainer.style.left=vt+"px",t.calendarContainer.style.right="auto";else if(!t0)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=Rl+"px";else{var tr=dn();if(tr===void 0)return;var n0=window.document.body.offsetWidth,i0=Math.max(0,n0/2-ue/2),l0=".flatpickr-calendar.centerMost:before",s0=".flatpickr-calendar.centerMost:after",o0=tr.cssRules.length,r0="{left:"+je.left+"px;right:auto;}";fn(t.calendarContainer,"rightMost",!1),fn(t.calendarContainer,"centerMost",!0),tr.insertRule(l0+","+s0+r0,o0),t.calendarContainer.style.left=i0+"px",t.calendarContainer.style.right="auto"}}}}function dn(){for(var G=null,Q=0;Q<document.styleSheets.length;Q++){var ie=document.styleSheets[Q];if(ie.cssRules){try{ie.cssRules}catch{continue}G=ie;break}}return G??an()}function an(){var G=document.createElement("style");return document.head.appendChild(G),G.sheet}function jn(){t.config.noCalendar||t.isMobile||(F(),Me(),P())}function Li(){t._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(t.close,0):t.close()}function rl(G){G.preventDefault(),G.stopPropagation();var Q=function(Be){return Be.classList&&Be.classList.contains("flatpickr-day")&&!Be.classList.contains("flatpickr-disabled")&&!Be.classList.contains("notAllowed")},ie=Ub(vn(G),Q);if(ie!==void 0){var ue=ie,Ce=t.latestSelectedDateObj=new Date(ue.dateObj.getTime()),Ne=(Ce.getMonth()<t.currentMonth||Ce.getMonth()>t.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=ue,t.config.mode==="single")t.selectedDates=[Ce];else if(t.config.mode==="multiple"){var Ze=Dn(Ce);Ze?t.selectedDates.splice(parseInt(Ze),1):t.selectedDates.push(Ce)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=Ce,t.selectedDates.push(Ce),wn(Ce,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(Be,vt){return Be.getTime()-vt.getTime()}));if(c(),Ne){var je=t.currentYear!==Ce.getFullYear();t.currentYear=Ce.getFullYear(),t.currentMonth=Ce.getMonth(),je&&(kt("onYearChange"),F()),kt("onMonthChange")}if(Me(),P(),Jt(),!Ne&&t.config.mode!=="range"&&t.config.showMonths===1?E(ue):t.selectedDateElem!==void 0&&t.hourElement===void 0&&t.selectedDateElem&&t.selectedDateElem.focus(),t.hourElement!==void 0&&t.hourElement!==void 0&&t.hourElement.focus(),t.config.closeOnSelect){var xe=t.config.mode==="single"&&!t.config.enableTime,qe=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(xe||qe)&&Li()}g()}}var bi={locale:[Ke,K],showMonths:[U,r,W],minDate:[$],maxDate:[$],positionElement:[ki],clickOpens:[function(){t.config.clickOpens===!0?(_(t._input,"focus",t.open),_(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function Ie(G,Q){if(G!==null&&typeof G=="object"){Object.assign(t.config,G);for(var ie in G)bi[ie]!==void 0&&bi[ie].forEach(function(ue){return ue()})}else t.config[G]=Q,bi[G]!==void 0?bi[G].forEach(function(ue){return ue()}):Cr.indexOf(G)>-1&&(t.config[G]=Or(Q));t.redraw(),Jt(!0)}function Pt(G,Q){var ie=[];if(G instanceof Array)ie=G.map(function(ue){return t.parseDate(ue,Q)});else if(G instanceof Date||typeof G=="number")ie=[t.parseDate(G,Q)];else if(typeof G=="string")switch(t.config.mode){case"single":case"time":ie=[t.parseDate(G,Q)];break;case"multiple":ie=G.split(t.config.conjunction).map(function(ue){return t.parseDate(ue,Q)});break;case"range":ie=G.split(t.l10n.rangeSeparator).map(function(ue){return t.parseDate(ue,Q)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(G)));t.selectedDates=t.config.allowInvalidPreload?ie:ie.filter(function(ue){return ue instanceof Date&&ut(ue,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(ue,Ce){return ue.getTime()-Ce.getTime()})}function Ni(G,Q,ie){if(Q===void 0&&(Q=!1),ie===void 0&&(ie=t.config.dateFormat),G!==0&&!G||G instanceof Array&&G.length===0)return t.clear(Q);Pt(G,ie),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),$(void 0,Q),d(),t.selectedDates.length===0&&t.clear(!1),Jt(Q),Q&&kt("onChange")}function Zn(G){return G.slice().map(function(Q){return typeof Q=="string"||typeof Q=="number"||Q instanceof Date?t.parseDate(Q,void 0,!0):Q&&typeof Q=="object"&&Q.from&&Q.to?{from:t.parseDate(Q.from,void 0),to:t.parseDate(Q.to,void 0)}:Q}).filter(function(Q){return Q})}function al(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var G=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);G&&Pt(G,t.config.dateFormat),t._initialDate=t.selectedDates.length>0?t.selectedDates[0]:t.config.minDate&&t.config.minDate.getTime()>t.now.getTime()?t.config.minDate:t.config.maxDate&&t.config.maxDate.getTime()<t.now.getTime()?t.config.maxDate:t.now,t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth(),t.selectedDates.length>0&&(t.latestSelectedDateObj=t.selectedDates[0]),t.config.minTime!==void 0&&(t.config.minTime=t.parseDate(t.config.minTime,"H:i")),t.config.maxTime!==void 0&&(t.config.maxTime=t.parseDate(t.config.maxTime,"H:i")),t.minDateHasTime=!!t.config.minDate&&(t.config.minDate.getHours()>0||t.config.minDate.getMinutes()>0||t.config.minDate.getSeconds()>0),t.maxDateHasTime=!!t.config.maxDate&&(t.config.maxDate.getHours()>0||t.config.maxDate.getMinutes()>0||t.config.maxDate.getSeconds()>0)}function Fl(){if(t.input=Se(),!t.input){t.config.errorHandler(new Error("Invalid input element specified"));return}t.input._type=t.input.type,t.input.type="text",t.input.classList.add("flatpickr-input"),t._input=t.input,t.config.altInput&&(t.altInput=pt(t.input.nodeName,t.config.altInputClass),t._input=t.altInput,t.altInput.placeholder=t.input.placeholder,t.altInput.disabled=t.input.disabled,t.altInput.required=t.input.required,t.altInput.tabIndex=t.input.tabIndex,t.altInput.type="text",t.input.setAttribute("type","hidden"),!t.config.static&&t.input.parentNode&&t.input.parentNode.insertBefore(t.altInput,t.input.nextSibling)),t.config.allowInput||t._input.setAttribute("readonly","readonly"),ki()}function ki(){t._positionElement=t.config.positionElement||t._input}function fl(){var G=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=pt("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=G,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=G==="datetime-local"?"Y-m-d\\TH:i:S":G==="date"?"Y-m-d":"H:i:S",t.selectedDates.length>0&&(t.mobileInput.defaultValue=t.mobileInput.value=t.formatDate(t.selectedDates[0],t.mobileFormatStr)),t.config.minDate&&(t.mobileInput.min=t.formatDate(t.config.minDate,"Y-m-d")),t.config.maxDate&&(t.mobileInput.max=t.formatDate(t.config.maxDate,"Y-m-d")),t.input.getAttribute("step")&&(t.mobileInput.step=String(t.input.getAttribute("step"))),t.input.type="hidden",t.altInput!==void 0&&(t.altInput.type="hidden");try{t.input.parentNode&&t.input.parentNode.insertBefore(t.mobileInput,t.input.nextSibling)}catch{}_(t.mobileInput,"change",function(Q){t.setDate(vn(Q).value,!1,t.mobileFormatStr),kt("onChange"),kt("onClose")})}function ul(G){if(t.isOpen===!0)return t.close();t.open(G)}function kt(G,Q){if(t.config!==void 0){var ie=t.config[G];if(ie!==void 0&&ie.length>0)for(var ue=0;ie[ue]&&ue<ie.length;ue++)ie[ue](t.selectedDates,t.input.value,t,Q);G==="onChange"&&(t.input.dispatchEvent(at("change")),t.input.dispatchEvent(at("input")))}}function at(G){var Q=document.createEvent("Event");return Q.initEvent(G,!0,!0),Q}function Dn(G){for(var Q=0;Q<t.selectedDates.length;Q++){var ie=t.selectedDates[Q];if(ie instanceof Date&&wn(ie,G)===0)return""+Q}return!1}function _e(G){return t.config.mode!=="range"||t.selectedDates.length<2?!1:wn(G,t.selectedDates[0])>=0&&wn(G,t.selectedDates[1])<=0}function Me(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(G,Q){var ie=new Date(t.currentYear,t.currentMonth,1);ie.setMonth(t.currentMonth+Q),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[Q].textContent=Fo(ie.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=ie.getMonth().toString(),G.value=ie.getFullYear().toString()}),t._hidePrevMonthArrow=t.config.minDate!==void 0&&(t.currentYear===t.config.minDate.getFullYear()?t.currentMonth<=t.config.minDate.getMonth():t.currentYear<t.config.minDate.getFullYear()),t._hideNextMonthArrow=t.config.maxDate!==void 0&&(t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth+1>t.config.maxDate.getMonth():t.currentYear>t.config.maxDate.getFullYear()))}function _t(G){var Q=G||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(ie){return t.formatDate(ie,Q)}).filter(function(ie,ue,Ce){return t.config.mode!=="range"||t.config.enableTime||Ce.indexOf(ie)===ue}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function Jt(G){G===void 0&&(G=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=_t(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=_t(t.config.altFormat)),G!==!1&&kt("onValueUpdate")}function ct(G){var Q=vn(G),ie=t.prevMonthNav.contains(Q),ue=t.nextMonthNav.contains(Q);ie||ue?ne(ie?-1:1):t.yearElements.indexOf(Q)>=0?Q.select():Q.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):Q.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function ri(G){G.preventDefault();var Q=G.type==="keydown",ie=vn(G),ue=ie;t.amPM!==void 0&&ie===t.amPM&&(t.amPM.textContent=t.l10n.amPM[An(t.amPM.textContent===t.l10n.amPM[0])]);var Ce=parseFloat(ue.getAttribute("min")),Ne=parseFloat(ue.getAttribute("max")),Ze=parseFloat(ue.getAttribute("step")),je=parseInt(ue.value,10),xe=G.delta||(Q?G.which===38?1:-1:0),qe=je+Ze*xe;if(typeof ue.value<"u"&&ue.value.length===2){var Be=ue===t.hourElement,vt=ue===t.minuteElement;qe<Ce?(qe=Ne+qe+An(!Be)+(An(Be)&&An(!t.amPM)),vt&&T(void 0,-1,t.hourElement)):qe>Ne&&(qe=ue===t.hourElement?qe-Ne-An(!t.amPM):Ce,vt&&T(void 0,1,t.hourElement)),t.amPM&&Be&&(Ze===1?qe+je===23:Math.abs(qe-je)>Ze)&&(t.amPM.textContent=t.l10n.amPM[An(t.amPM.textContent===t.l10n.amPM[0])]),ue.value=mn(qe)}}return l(),t}function $l(n,e){for(var t=Array.prototype.slice.call(n).filter(function(o){return o instanceof HTMLElement}),i=[],l=0;l<t.length;l++){var s=t[l];try{if(s.getAttribute("data-fp-omit")!==null)continue;s._flatpickr!==void 0&&(s._flatpickr.destroy(),s._flatpickr=void 0),s._flatpickr=$T(s,e||{}),i.push(s._flatpickr)}catch(o){console.error(o)}}return i.length===1?i[0]:i}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(n){return $l(this,n)},HTMLElement.prototype.flatpickr=function(n){return $l([this],n)});var Ut=function(n,e){return typeof n=="string"?$l(window.document.querySelectorAll(n),e):n instanceof Node?$l([n],e):$l(n,e)};Ut.defaultConfig={};Ut.l10ns={en:nn({},hs),default:nn({},hs)};Ut.localize=function(n){Ut.l10ns.default=nn(nn({},Ut.l10ns.default),n)};Ut.setDefaults=function(n){Ut.defaultConfig=nn(nn({},Ut.defaultConfig),n)};Ut.parseDate=oa({});Ut.formatDate=Wb({});Ut.compareDates=wn;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(n){return $l(this,n)});Date.prototype.fp_incr=function(n){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof n=="string"?parseInt(n,10):n))};typeof window<"u"&&(window.flatpickr=Ut);function TT(n){let e,t=[n[1]],i={};for(let l=0;l<t.length;l+=1)i=Ae(i,t[l]);return{c(){e=b("input"),ii(e,i)},m(l,s){S(l,e,s),e.autofocus&&e.focus(),n[11](e)},p(l,s){ii(e,i=mt(t,[s&2&&l[1]]))},d(l){l&&w(e),n[11](null)}}}function CT(n){let e;const t=n[10].default,i=St(t,n,n[9],null),l=i||TT(n);return{c(){l&&l.c()},m(s,o){l&&l.m(s,o),e=!0},p(s,[o]){i?i.p&&(!e||o&512)&&Tt(i,t,s,s[9],e?$t(t,s[9],o,null):Ct(s[9]),null):l&&l.p&&(!e||o&3)&&l.p(s,e?o:-1)},i(s){e||(I(l,s),e=!0)},o(s){L(l,s),e=!1},d(s){l&&l.d(s)}}}function OT(n){return n.charAt(2).toLowerCase()+n.substring(3)}function sd(n,e){var i;return(((i=n==null?void 0:n.config)==null?void 0:i.mode)??"single")==="single"?e[0]:e}function od(n,e){return!!(n==e||n instanceof Date&&e instanceof Date&&n.valueOf()===e.valueOf()||Array.isArray(n)&&Array.isArray(e)&&n.length===e.length&&n.every((t,i)=>t===e[i]))}function MT(n,e,t){const i=["value","formattedValue","element","dateFormat","options","input","flatpickr"];let l=Xe(e,i),{$$slots:s={},$$scope:o}=e;const r=new Set(["onChange","onOpen","onClose","onMonthChange","onYearChange","onReady","onValueUpdate","onDayCreate"]);let{value:a=void 0,formattedValue:f="",element:u=void 0,dateFormat:c=void 0}=e,{options:d={}}=e,m=!1,{input:h=void 0,flatpickr:_=void 0}=e;zt(()=>{const T=u??h,O=v(d);return O.onReady.push((M,E,A)=>{a===void 0&&$(M,E,A),xt().then(()=>{t(8,m=!0)})}),t(3,_=Ut(T,Object.assign(O,u?{wrap:!0}:{}))),()=>{_.destroy()}});const g=st();function v(T={}){T=Object.assign({},T);for(const O of r){const M=(E,A,N)=>{g(OT(O),[E,A,N])};O in T?(Array.isArray(T[O])||(T[O]=[T[O]]),T[O].push(M)):T[O]=[M]}return T.onChange&&!T.onChange.includes($)&&T.onChange.push($),T}function $(T,O,M){const E=sd(M,T);!od(a,E)&&(a||E)&&t(2,a=E),t(4,f=O)}function C(T){te[T?"unshift":"push"](()=>{h=T,t(0,h)})}return n.$$set=T=>{e=Ae(Ae({},e),Kt(T)),t(1,l=Xe(e,i)),"value"in T&&t(2,a=T.value),"formattedValue"in T&&t(4,f=T.formattedValue),"element"in T&&t(5,u=T.element),"dateFormat"in T&&t(6,c=T.dateFormat),"options"in T&&t(7,d=T.options),"input"in T&&t(0,h=T.input),"flatpickr"in T&&t(3,_=T.flatpickr),"$$scope"in T&&t(9,o=T.$$scope)},n.$$.update=()=>{if(n.$$.dirty&332&&_&&m&&(od(a,sd(_,_.selectedDates))||_.setDate(a,!0,c)),n.$$.dirty&392&&_&&m)for(const[T,O]of Object.entries(v(d)))_.set(T,O)},[h,l,a,_,f,u,c,d,m,o,s,C]}class Ba extends be{constructor(e){super(),ge(this,e,MT,CT,he,{value:2,formattedValue:4,element:5,dateFormat:6,options:7,input:0,flatpickr:3})}}function DT(n){let e,t,i,l,s,o,r,a;function f(d){n[6](d)}function u(d){n[7](d)}let c={id:n[16],options:H.defaultFlatpickrOptions()};return n[2]!==void 0&&(c.value=n[2]),n[0].options.min!==void 0&&(c.formattedValue=n[0].options.min),s=new Ba({props:c}),te.push(()=>ke(s,"value",f)),te.push(()=>ke(s,"formattedValue",u)),s.$on("close",n[8]),{c(){e=b("label"),t=J("Min date (UTC)"),l=D(),B(s.$$.fragment),p(e,"for",i=n[16])},m(d,m){S(d,e,m),y(e,t),S(d,l,m),z(s,d,m),a=!0},p(d,m){(!a||m&65536&&i!==(i=d[16]))&&p(e,"for",i);const h={};m&65536&&(h.id=d[16]),!o&&m&4&&(o=!0,h.value=d[2],ye(()=>o=!1)),!r&&m&1&&(r=!0,h.formattedValue=d[0].options.min,ye(()=>r=!1)),s.$set(h)},i(d){a||(I(s.$$.fragment,d),a=!0)},o(d){L(s.$$.fragment,d),a=!1},d(d){d&&(w(e),w(l)),V(s,d)}}}function ET(n){let e,t,i,l,s,o,r,a;function f(d){n[9](d)}function u(d){n[10](d)}let c={id:n[16],options:H.defaultFlatpickrOptions()};return n[3]!==void 0&&(c.value=n[3]),n[0].options.max!==void 0&&(c.formattedValue=n[0].options.max),s=new Ba({props:c}),te.push(()=>ke(s,"value",f)),te.push(()=>ke(s,"formattedValue",u)),s.$on("close",n[11]),{c(){e=b("label"),t=J("Max date (UTC)"),l=D(),B(s.$$.fragment),p(e,"for",i=n[16])},m(d,m){S(d,e,m),y(e,t),S(d,l,m),z(s,d,m),a=!0},p(d,m){(!a||m&65536&&i!==(i=d[16]))&&p(e,"for",i);const h={};m&65536&&(h.id=d[16]),!o&&m&8&&(o=!0,h.value=d[3],ye(()=>o=!1)),!r&&m&1&&(r=!0,h.formattedValue=d[0].options.max,ye(()=>r=!1)),s.$set(h)},i(d){a||(I(s.$$.fragment,d),a=!0)},o(d){L(s.$$.fragment,d),a=!1},d(d){d&&(w(e),w(l)),V(s,d)}}}function IT(n){let e,t,i,l,s,o,r;return i=new de({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[DT,({uniqueId:a})=>({16:a}),({uniqueId:a})=>a?65536:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[ET,({uniqueId:a})=>({16:a}),({uniqueId:a})=>a?65536:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,f){S(a,e,f),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),r=!0},p(a,f){const u={};f&2&&(u.name="schema."+a[1]+".options.min"),f&196613&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};f&2&&(c.name="schema."+a[1]+".options.max"),f&196617&&(c.$$scope={dirty:f,ctx:a}),o.$set(c)},i(a){r||(I(i.$$.fragment,a),I(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&w(e),V(i),V(o)}}}function AT(n){let e,t,i;const l=[{key:n[1]},n[5]];function s(r){n[12](r)}let o={$$slots:{options:[IT]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[13]),e.$on("remove",n[14]),e.$on("duplicate",n[15]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&34?mt(l,[a&2&&{key:r[1]},a&32&&Mt(r[5])]):{};a&131087&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function LT(n,e,t){var T,O;const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e,r=(T=s==null?void 0:s.options)==null?void 0:T.min,a=(O=s==null?void 0:s.options)==null?void 0:O.max;function f(M,E){M.detail&&M.detail.length==3&&t(0,s.options[E]=M.detail[1],s)}function u(M){r=M,t(2,r),t(0,s)}function c(M){n.$$.not_equal(s.options.min,M)&&(s.options.min=M,t(0,s))}const d=M=>f(M,"min");function m(M){a=M,t(3,a),t(0,s)}function h(M){n.$$.not_equal(s.options.max,M)&&(s.options.max=M,t(0,s))}const _=M=>f(M,"max");function g(M){s=M,t(0,s)}function v(M){Oe.call(this,n,M)}function $(M){Oe.call(this,n,M)}function C(M){Oe.call(this,n,M)}return n.$$set=M=>{e=Ae(Ae({},e),Kt(M)),t(5,l=Xe(e,i)),"field"in M&&t(0,s=M.field),"key"in M&&t(1,o=M.key)},n.$$.update=()=>{var M,E,A,N;n.$$.dirty&5&&r!=((M=s==null?void 0:s.options)==null?void 0:M.min)&&t(2,r=(E=s==null?void 0:s.options)==null?void 0:E.min),n.$$.dirty&9&&a!=((A=s==null?void 0:s.options)==null?void 0:A.max)&&t(3,a=(N=s==null?void 0:s.options)==null?void 0:N.max)},[s,o,r,a,f,l,u,c,d,m,h,_,g,v,$,C]}class NT extends be{constructor(e){super(),ge(this,e,LT,AT,he,{field:0,key:1})}}const PT=n=>({}),rd=n=>({});function ad(n,e,t){const i=n.slice();return i[48]=e[t],i}const FT=n=>({}),fd=n=>({});function ud(n,e,t){const i=n.slice();return i[48]=e[t],i[52]=t,i}function cd(n){let e,t,i;return{c(){e=b("div"),t=J(n[2]),i=D(),p(e,"class","block txt-placeholder"),ee(e,"link-hint",!n[5]&&!n[6])},m(l,s){S(l,e,s),y(e,t),y(e,i)},p(l,s){s[0]&4&&re(t,l[2]),s[0]&96&&ee(e,"link-hint",!l[5]&&!l[6])},d(l){l&&w(e)}}}function RT(n){let e,t=n[48]+"",i;return{c(){e=b("span"),i=J(t),p(e,"class","txt")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s[0]&1&&t!==(t=l[48]+"")&&re(i,t)},i:x,o:x,d(l){l&&w(e)}}}function qT(n){let e,t,i;const l=[{item:n[48]},n[11]];var s=n[10];function o(r,a){let f={};for(let u=0;u<l.length;u+=1)f=Ae(f,l[u]);return a!==void 0&&a[0]&2049&&(f=Ae(f,mt(l,[a[0]&1&&{item:r[48]},a[0]&2048&&Mt(r[11])]))),{props:f}}return s&&(e=Et(s,o(n))),{c(){e&&B(e.$$.fragment),t=ve()},m(r,a){e&&z(e,r,a),S(r,t,a),i=!0},p(r,a){if(a[0]&1024&&s!==(s=r[10])){if(e){se();const f=e;L(f.$$.fragment,1,0,()=>{V(f,1)}),oe()}s?(e=Et(s,o(r,a)),B(e.$$.fragment),I(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a[0]&2049?mt(l,[a[0]&1&&{item:r[48]},a[0]&2048&&Mt(r[11])]):{};e.$set(f)}},i(r){i||(e&&I(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&w(t),e&&V(e,r)}}}function dd(n){let e,t,i;function l(){return n[36](n[48])}return{c(){e=b("span"),e.innerHTML='<i class="ri-close-line"></i>',p(e,"class","clear")},m(s,o){S(s,e,o),t||(i=[$e(Fe.call(null,e,"Clear")),Z(e,"click",Cn(Ue(l)))],t=!0)},p(s,o){n=s},d(s){s&&w(e),t=!1,Te(i)}}}function pd(n){let e,t,i,l,s,o;const r=[qT,RT],a=[];function f(c,d){return c[10]?0:1}t=f(n),i=a[t]=r[t](n);let u=(n[4]||n[8])&&dd(n);return{c(){e=b("div"),i.c(),l=D(),u&&u.c(),s=D(),p(e,"class","option")},m(c,d){S(c,e,d),a[t].m(e,null),y(e,l),u&&u.m(e,null),y(e,s),o=!0},p(c,d){let m=t;t=f(c),t===m?a[t].p(c,d):(se(),L(a[m],1,1,()=>{a[m]=null}),oe(),i=a[t],i?i.p(c,d):(i=a[t]=r[t](c),i.c()),I(i,1),i.m(e,l)),c[4]||c[8]?u?u.p(c,d):(u=dd(c),u.c(),u.m(e,s)):u&&(u.d(1),u=null)},i(c){o||(I(i),o=!0)},o(c){L(i),o=!1},d(c){c&&w(e),a[t].d(),u&&u.d()}}}function md(n){let e,t,i={class:"dropdown dropdown-block options-dropdown dropdown-left "+(n[7]?"dropdown-upside":""),trigger:n[20],$$slots:{default:[zT]},$$scope:{ctx:n}};return e=new Mn({props:i}),n[41](e),e.$on("show",n[26]),e.$on("hide",n[42]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,s){const o={};s[0]&128&&(o.class="dropdown dropdown-block options-dropdown dropdown-left "+(l[7]?"dropdown-upside":"")),s[0]&1048576&&(o.trigger=l[20]),s[0]&6451722|s[1]&8192&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[41](null),V(e,l)}}}function hd(n){let e,t,i,l,s,o,r,a,f=n[17].length&&_d(n);return{c(){e=b("div"),t=b("label"),i=b("div"),i.innerHTML='<i class="ri-search-line"></i>',l=D(),s=b("input"),o=D(),f&&f.c(),p(i,"class","addon p-r-0"),s.autofocus=!0,p(s,"type","text"),p(s,"placeholder",n[3]),p(t,"class","input-group"),p(e,"class","form-field form-field-sm options-search")},m(u,c){S(u,e,c),y(e,t),y(t,i),y(t,l),y(t,s),ae(s,n[17]),y(t,o),f&&f.m(t,null),s.focus(),r||(a=Z(s,"input",n[38]),r=!0)},p(u,c){c[0]&8&&p(s,"placeholder",u[3]),c[0]&131072&&s.value!==u[17]&&ae(s,u[17]),u[17].length?f?f.p(u,c):(f=_d(u),f.c(),f.m(t,null)):f&&(f.d(1),f=null)},d(u){u&&w(e),f&&f.d(),r=!1,a()}}}function _d(n){let e,t,i,l;return{c(){e=b("div"),t=b("button"),t.innerHTML='<i class="ri-close-line"></i>',p(t,"type","button"),p(t,"class","btn btn-sm btn-circle btn-transparent clear"),p(e,"class","addon suffix p-r-5")},m(s,o){S(s,e,o),y(e,t),i||(l=Z(t,"click",Cn(Ue(n[23]))),i=!0)},p:x,d(s){s&&w(e),i=!1,l()}}}function gd(n){let e,t=n[1]&&bd(n);return{c(){t&&t.c(),e=ve()},m(i,l){t&&t.m(i,l),S(i,e,l)},p(i,l){i[1]?t?t.p(i,l):(t=bd(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){i&&w(e),t&&t.d(i)}}}function bd(n){let e,t;return{c(){e=b("div"),t=J(n[1]),p(e,"class","txt-missing")},m(i,l){S(i,e,l),y(e,t)},p(i,l){l[0]&2&&re(t,i[1])},d(i){i&&w(e)}}}function jT(n){let e=n[48]+"",t;return{c(){t=J(e)},m(i,l){S(i,t,l)},p(i,l){l[0]&4194304&&e!==(e=i[48]+"")&&re(t,e)},i:x,o:x,d(i){i&&w(t)}}}function HT(n){let e,t,i;const l=[{item:n[48]},n[13]];var s=n[12];function o(r,a){let f={};for(let u=0;u<l.length;u+=1)f=Ae(f,l[u]);return a!==void 0&&a[0]&4202496&&(f=Ae(f,mt(l,[a[0]&4194304&&{item:r[48]},a[0]&8192&&Mt(r[13])]))),{props:f}}return s&&(e=Et(s,o(n))),{c(){e&&B(e.$$.fragment),t=ve()},m(r,a){e&&z(e,r,a),S(r,t,a),i=!0},p(r,a){if(a[0]&4096&&s!==(s=r[12])){if(e){se();const f=e;L(f.$$.fragment,1,0,()=>{V(f,1)}),oe()}s?(e=Et(s,o(r,a)),B(e.$$.fragment),I(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a[0]&4202496?mt(l,[a[0]&4194304&&{item:r[48]},a[0]&8192&&Mt(r[13])]):{};e.$set(f)}},i(r){i||(e&&I(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&w(t),e&&V(e,r)}}}function kd(n){let e,t,i,l,s,o,r;const a=[HT,jT],f=[];function u(m,h){return m[12]?0:1}t=u(n),i=f[t]=a[t](n);function c(...m){return n[39](n[48],...m)}function d(...m){return n[40](n[48],...m)}return{c(){e=b("div"),i.c(),l=D(),p(e,"tabindex","0"),p(e,"class","dropdown-item option"),p(e,"role","menuitem"),ee(e,"closable",n[9]),ee(e,"selected",n[21](n[48]))},m(m,h){S(m,e,h),f[t].m(e,null),y(e,l),s=!0,o||(r=[Z(e,"click",c),Z(e,"keydown",d)],o=!0)},p(m,h){n=m;let _=t;t=u(n),t===_?f[t].p(n,h):(se(),L(f[_],1,1,()=>{f[_]=null}),oe(),i=f[t],i?i.p(n,h):(i=f[t]=a[t](n),i.c()),I(i,1),i.m(e,l)),(!s||h[0]&512)&&ee(e,"closable",n[9]),(!s||h[0]&6291456)&&ee(e,"selected",n[21](n[48]))},i(m){s||(I(i),s=!0)},o(m){L(i),s=!1},d(m){m&&w(e),f[t].d(),o=!1,Te(r)}}}function zT(n){let e,t,i,l,s,o=n[14]&&hd(n);const r=n[35].beforeOptions,a=St(r,n,n[44],fd);let f=ce(n[22]),u=[];for(let _=0;_<f.length;_+=1)u[_]=kd(ad(n,f,_));const c=_=>L(u[_],1,1,()=>{u[_]=null});let d=null;f.length||(d=gd(n));const m=n[35].afterOptions,h=St(m,n,n[44],rd);return{c(){o&&o.c(),e=D(),a&&a.c(),t=D(),i=b("div");for(let _=0;_<u.length;_+=1)u[_].c();d&&d.c(),l=D(),h&&h.c(),p(i,"class","options-list")},m(_,g){o&&o.m(_,g),S(_,e,g),a&&a.m(_,g),S(_,t,g),S(_,i,g);for(let v=0;v<u.length;v+=1)u[v]&&u[v].m(i,null);d&&d.m(i,null),S(_,l,g),h&&h.m(_,g),s=!0},p(_,g){if(_[14]?o?o.p(_,g):(o=hd(_),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),a&&a.p&&(!s||g[1]&8192)&&Tt(a,r,_,_[44],s?$t(r,_[44],g,FT):Ct(_[44]),fd),g[0]&56635906){f=ce(_[22]);let v;for(v=0;v<f.length;v+=1){const $=ad(_,f,v);u[v]?(u[v].p($,g),I(u[v],1)):(u[v]=kd($),u[v].c(),I(u[v],1),u[v].m(i,null))}for(se(),v=f.length;v<u.length;v+=1)c(v);oe(),!f.length&&d?d.p(_,g):f.length?d&&(d.d(1),d=null):(d=gd(_),d.c(),d.m(i,null))}h&&h.p&&(!s||g[1]&8192)&&Tt(h,m,_,_[44],s?$t(m,_[44],g,PT):Ct(_[44]),rd)},i(_){if(!s){I(a,_);for(let g=0;g<f.length;g+=1)I(u[g]);I(h,_),s=!0}},o(_){L(a,_),u=u.filter(Boolean);for(let g=0;g<u.length;g+=1)L(u[g]);L(h,_),s=!1},d(_){_&&(w(e),w(t),w(i),w(l)),o&&o.d(_),a&&a.d(_),rt(u,_),d&&d.d(),h&&h.d(_)}}}function VT(n){let e,t,i,l,s,o,r=ce(H.toArray(n[0])),a=[];for(let d=0;d<r.length;d+=1)a[d]=pd(ud(n,r,d));const f=d=>L(a[d],1,1,()=>{a[d]=null});let u=null;r.length||(u=cd(n));let c=!n[5]&&!n[6]&&md(n);return{c(){e=b("div"),t=b("div");for(let d=0;d<a.length;d+=1)a[d].c();u&&u.c(),l=D(),c&&c.c(),p(t,"tabindex",i=n[5]||n[6]?"-1":"0"),p(t,"class","selected-container"),p(t,"role","button"),ee(t,"disabled",n[5]),ee(t,"readonly",n[6]),p(e,"class",s="select "+n[15]),ee(e,"upside",n[7]),ee(e,"multiple",n[4]),ee(e,"disabled",n[5]),ee(e,"readonly",n[6])},m(d,m){S(d,e,m),y(e,t);for(let h=0;h<a.length;h+=1)a[h]&&a[h].m(t,null);u&&u.m(t,null),n[37](t),y(e,l),c&&c.m(e,null),n[43](e),o=!0},p(d,m){if(m[0]&68981){r=ce(H.toArray(d[0]));let h;for(h=0;h<r.length;h+=1){const _=ud(d,r,h);a[h]?(a[h].p(_,m),I(a[h],1)):(a[h]=pd(_),a[h].c(),I(a[h],1),a[h].m(t,null))}for(se(),h=r.length;h<a.length;h+=1)f(h);oe(),!r.length&&u?u.p(d,m):r.length?u&&(u.d(1),u=null):(u=cd(d),u.c(),u.m(t,null))}(!o||m[0]&96&&i!==(i=d[5]||d[6]?"-1":"0"))&&p(t,"tabindex",i),(!o||m[0]&32)&&ee(t,"disabled",d[5]),(!o||m[0]&64)&&ee(t,"readonly",d[6]),!d[5]&&!d[6]?c?(c.p(d,m),m[0]&96&&I(c,1)):(c=md(d),c.c(),I(c,1),c.m(e,null)):c&&(se(),L(c,1,1,()=>{c=null}),oe()),(!o||m[0]&32768&&s!==(s="select "+d[15]))&&p(e,"class",s),(!o||m[0]&32896)&&ee(e,"upside",d[7]),(!o||m[0]&32784)&&ee(e,"multiple",d[4]),(!o||m[0]&32800)&&ee(e,"disabled",d[5]),(!o||m[0]&32832)&&ee(e,"readonly",d[6])},i(d){if(!o){for(let m=0;m<r.length;m+=1)I(a[m]);I(c),o=!0}},o(d){a=a.filter(Boolean);for(let m=0;m<a.length;m+=1)L(a[m]);L(c),o=!1},d(d){d&&w(e),rt(a,d),u&&u.d(),n[37](null),c&&c.d(),n[43](null)}}}function BT(n,e){let t=(""+e).replace(/\s+/g,"").toLowerCase(),i=n;try{typeof n=="object"&&n!==null&&(i=JSON.stringify(n))}catch{}return(""+i).replace(/\s+/g,"").toLowerCase().includes(t)}function UT(n,e,t){let i,l,{$$slots:s={},$$scope:o}=e,{id:r=""}=e,{noOptionsText:a="No options found"}=e,{selectPlaceholder:f="- Select -"}=e,{searchPlaceholder:u="Search..."}=e,{items:c=[]}=e,{multiple:d=!1}=e,{disabled:m=!1}=e,{readonly:h=!1}=e,{upside:_=!1}=e,{selected:g=d?[]:void 0}=e,{toggle:v=d}=e,{closable:$=!0}=e,{labelComponent:C=void 0}=e,{labelComponentProps:T={}}=e,{optionComponent:O=void 0}=e,{optionComponentProps:M={}}=e,{searchable:E=!1}=e,{searchFunc:A=void 0}=e,{class:N=""}=e,q,R="",P,F;function j(pe){if(H.isEmpty(g))return;let we=H.toArray(g);H.inArray(we,pe)&&(H.removeByValue(we,pe),t(0,g=we)),P==null||P.dispatchEvent(new CustomEvent("change",{detail:g,bubbles:!0}))}function U(pe){if(d){let we=H.toArray(g);H.inArray(we,pe)||t(0,g=[...we,pe])}else t(0,g=pe);P==null||P.dispatchEvent(new CustomEvent("change",{detail:g,bubbles:!0}))}function Y(pe){return l(pe)?j(pe):U(pe)}function X(){t(0,g=d?[]:void 0)}function W(){q!=null&&q.show&&(q==null||q.show())}function K(){q!=null&&q.hide&&(q==null||q.hide())}function le(){if(H.isEmpty(g)||H.isEmpty(c))return;let pe=H.toArray(g),we=[];for(const Se of pe)H.inArray(c,Se)||we.push(Se);if(we.length){for(const Se of we)H.removeByValue(pe,Se);t(0,g=d?pe:pe[0])}}function ne(){t(17,R="")}function me(pe,we){pe=pe||[];const Se=A||BT;return pe.filter(Ke=>Se(Ke,we))||[]}function Pe(pe,we){pe.preventDefault(),v&&d?Y(we):U(we)}function ze(pe,we){(pe.code==="Enter"||pe.code==="Space")&&(Pe(pe,we),$&&K())}function Qe(){ne(),setTimeout(()=>{const pe=P==null?void 0:P.querySelector(".dropdown-item.option.selected");pe&&(pe.focus(),pe.scrollIntoView({block:"nearest"}))},0)}function et(pe){pe.stopPropagation(),!h&&!m&&(q==null||q.toggle())}zt(()=>{const pe=document.querySelectorAll(`label[for="${r}"]`);for(const we of pe)we.addEventListener("click",et);return()=>{for(const we of pe)we.removeEventListener("click",et)}});const Dt=pe=>j(pe);function ut(pe){te[pe?"unshift":"push"](()=>{F=pe,t(20,F)})}function ht(){R=this.value,t(17,R)}const Qt=(pe,we)=>Pe(we,pe),Ee=(pe,we)=>ze(we,pe);function Le(pe){te[pe?"unshift":"push"](()=>{q=pe,t(18,q)})}function Ve(pe){Oe.call(this,n,pe)}function bt(pe){te[pe?"unshift":"push"](()=>{P=pe,t(19,P)})}return n.$$set=pe=>{"id"in pe&&t(27,r=pe.id),"noOptionsText"in pe&&t(1,a=pe.noOptionsText),"selectPlaceholder"in pe&&t(2,f=pe.selectPlaceholder),"searchPlaceholder"in pe&&t(3,u=pe.searchPlaceholder),"items"in pe&&t(28,c=pe.items),"multiple"in pe&&t(4,d=pe.multiple),"disabled"in pe&&t(5,m=pe.disabled),"readonly"in pe&&t(6,h=pe.readonly),"upside"in pe&&t(7,_=pe.upside),"selected"in pe&&t(0,g=pe.selected),"toggle"in pe&&t(8,v=pe.toggle),"closable"in pe&&t(9,$=pe.closable),"labelComponent"in pe&&t(10,C=pe.labelComponent),"labelComponentProps"in pe&&t(11,T=pe.labelComponentProps),"optionComponent"in pe&&t(12,O=pe.optionComponent),"optionComponentProps"in pe&&t(13,M=pe.optionComponentProps),"searchable"in pe&&t(14,E=pe.searchable),"searchFunc"in pe&&t(29,A=pe.searchFunc),"class"in pe&&t(15,N=pe.class),"$$scope"in pe&&t(44,o=pe.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&268435456&&c&&(le(),ne()),n.$$.dirty[0]&268566528&&t(22,i=me(c,R)),n.$$.dirty[0]&1&&t(21,l=function(pe){const we=H.toArray(g);return H.inArray(we,pe)})},[g,a,f,u,d,m,h,_,v,$,C,T,O,M,E,N,j,R,q,P,F,l,i,ne,Pe,ze,Qe,r,c,A,U,Y,X,W,K,s,Dt,ut,ht,Qt,Ee,Le,Ve,bt,o]}class Yb extends be{constructor(e){super(),ge(this,e,UT,VT,he,{id:27,noOptionsText:1,selectPlaceholder:2,searchPlaceholder:3,items:28,multiple:4,disabled:5,readonly:6,upside:7,selected:0,toggle:8,closable:9,labelComponent:10,labelComponentProps:11,optionComponent:12,optionComponentProps:13,searchable:14,searchFunc:29,class:15,deselectItem:16,selectItem:30,toggleItem:31,reset:32,showDropdown:33,hideDropdown:34},null,[-1,-1])}get deselectItem(){return this.$$.ctx[16]}get selectItem(){return this.$$.ctx[30]}get toggleItem(){return this.$$.ctx[31]}get reset(){return this.$$.ctx[32]}get showDropdown(){return this.$$.ctx[33]}get hideDropdown(){return this.$$.ctx[34]}}function yd(n){let e,t;return{c(){e=b("i"),p(e,"class",t="icon "+n[0].icon)},m(i,l){S(i,e,l)},p(i,l){l&1&&t!==(t="icon "+i[0].icon)&&p(e,"class",t)},d(i){i&&w(e)}}}function WT(n){let e,t,i=(n[0].label||n[0].name||n[0].title||n[0].id||n[0].value)+"",l,s=n[0].icon&&yd(n);return{c(){s&&s.c(),e=D(),t=b("span"),l=J(i),p(t,"class","txt")},m(o,r){s&&s.m(o,r),S(o,e,r),S(o,t,r),y(t,l)},p(o,[r]){o[0].icon?s?s.p(o,r):(s=yd(o),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),r&1&&i!==(i=(o[0].label||o[0].name||o[0].title||o[0].id||o[0].value)+"")&&re(l,i)},i:x,o:x,d(o){o&&(w(e),w(t)),s&&s.d(o)}}}function YT(n,e,t){let{item:i={}}=e;return n.$$set=l=>{"item"in l&&t(0,i=l.item)},[i]}class vd extends be{constructor(e){super(),ge(this,e,YT,WT,he,{item:0})}}const KT=n=>({}),wd=n=>({});function JT(n){let e;const t=n[8].afterOptions,i=St(t,n,n[12],wd);return{c(){i&&i.c()},m(l,s){i&&i.m(l,s),e=!0},p(l,s){i&&i.p&&(!e||s&4096)&&Tt(i,t,l,l[12],e?$t(t,l[12],s,KT):Ct(l[12]),wd)},i(l){e||(I(i,l),e=!0)},o(l){L(i,l),e=!1},d(l){i&&i.d(l)}}}function ZT(n){let e,t,i;const l=[{items:n[1]},{multiple:n[2]},{labelComponent:n[3]},{optionComponent:n[4]},n[5]];function s(r){n[9](r)}let o={$$slots:{afterOptions:[JT]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.selected=n[0]),e=new Yb({props:o}),te.push(()=>ke(e,"selected",s)),e.$on("show",n[10]),e.$on("hide",n[11]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&62?mt(l,[a&2&&{items:r[1]},a&4&&{multiple:r[2]},a&8&&{labelComponent:r[3]},a&16&&{optionComponent:r[4]},a&32&&Mt(r[5])]):{};a&4096&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.selected=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function GT(n,e,t){const i=["items","multiple","selected","labelComponent","optionComponent","selectionKey","keyOfSelected"];let l=Xe(e,i),{$$slots:s={},$$scope:o}=e,{items:r=[]}=e,{multiple:a=!1}=e,{selected:f=a?[]:void 0}=e,{labelComponent:u=vd}=e,{optionComponent:c=vd}=e,{selectionKey:d="value"}=e,{keyOfSelected:m=a?[]:void 0}=e;function h(C){C=H.toArray(C,!0);let T=[];for(let O of C){const M=H.findByKey(r,d,O);M&&T.push(M)}C.length&&!T.length||t(0,f=a?T:T[0])}async function _(C){let T=H.toArray(C,!0).map(O=>O[d]);r.length&&t(6,m=a?T:T[0])}function g(C){f=C,t(0,f)}function v(C){Oe.call(this,n,C)}function $(C){Oe.call(this,n,C)}return n.$$set=C=>{e=Ae(Ae({},e),Kt(C)),t(5,l=Xe(e,i)),"items"in C&&t(1,r=C.items),"multiple"in C&&t(2,a=C.multiple),"selected"in C&&t(0,f=C.selected),"labelComponent"in C&&t(3,u=C.labelComponent),"optionComponent"in C&&t(4,c=C.optionComponent),"selectionKey"in C&&t(7,d=C.selectionKey),"keyOfSelected"in C&&t(6,m=C.keyOfSelected),"$$scope"in C&&t(12,o=C.$$scope)},n.$$.update=()=>{n.$$.dirty&66&&r&&h(m),n.$$.dirty&1&&_(f)},[f,r,a,u,c,l,m,d,s,g,v,$,o]}class _i extends be{constructor(e){super(),ge(this,e,GT,ZT,he,{items:1,multiple:2,selected:0,labelComponent:3,optionComponent:4,selectionKey:7,keyOfSelected:6})}}function XT(n){let e,t,i,l,s,o;function r(f){n[7](f)}let a={id:n[14],placeholder:"Choices: eg. optionA, optionB",required:!0,readonly:!n[15]};return n[0].options.values!==void 0&&(a.value=n[0].options.values),t=new Pl({props:a}),te.push(()=>ke(t,"value",r)),{c(){e=b("div"),B(t.$$.fragment)},m(f,u){S(f,e,u),z(t,e,null),l=!0,s||(o=$e(Fe.call(null,e,{text:"Choices (comma separated)",position:"top-left",delay:700})),s=!0)},p(f,u){const c={};u&16384&&(c.id=f[14]),u&32768&&(c.readonly=!f[15]),!i&&u&1&&(i=!0,c.value=f[0].options.values,ye(()=>i=!1)),t.$set(c)},i(f){l||(I(t.$$.fragment,f),l=!0)},o(f){L(t.$$.fragment,f),l=!1},d(f){f&&w(e),V(t),s=!1,o()}}}function QT(n){let e,t,i;function l(o){n[8](o)}let s={id:n[14],items:n[3],readonly:!n[15]};return n[2]!==void 0&&(s.keyOfSelected=n[2]),e=new _i({props:s}),te.push(()=>ke(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&16384&&(a.id=o[14]),r&32768&&(a.readonly=!o[15]),!t&&r&4&&(t=!0,a.keyOfSelected=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function xT(n){let e,t,i,l,s,o,r,a,f,u;return i=new de({props:{class:"form-field required "+(n[15]?"":"readonly"),inlineError:!0,name:"schema."+n[1]+".options.values",$$slots:{default:[XT,({uniqueId:c})=>({14:c}),({uniqueId:c})=>c?16384:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field form-field-single-multiple-select "+(n[15]?"":"readonly"),inlineError:!0,$$slots:{default:[QT,({uniqueId:c})=>({14:c}),({uniqueId:c})=>c?16384:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=D(),B(i.$$.fragment),l=D(),s=b("div"),o=D(),B(r.$$.fragment),a=D(),f=b("div"),p(e,"class","separator"),p(s,"class","separator"),p(f,"class","separator")},m(c,d){S(c,e,d),S(c,t,d),z(i,c,d),S(c,l,d),S(c,s,d),S(c,o,d),z(r,c,d),S(c,a,d),S(c,f,d),u=!0},p(c,d){const m={};d&32768&&(m.class="form-field required "+(c[15]?"":"readonly")),d&2&&(m.name="schema."+c[1]+".options.values"),d&114689&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const h={};d&32768&&(h.class="form-field form-field-single-multiple-select "+(c[15]?"":"readonly")),d&114692&&(h.$$scope={dirty:d,ctx:c}),r.$set(h)},i(c){u||(I(i.$$.fragment,c),I(r.$$.fragment,c),u=!0)},o(c){L(i.$$.fragment,c),L(r.$$.fragment,c),u=!1},d(c){c&&(w(e),w(t),w(l),w(s),w(o),w(a),w(f)),V(i,c),V(r,c)}}}function Sd(n){let e,t;return e=new de({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[eC,({uniqueId:i})=>({14:i}),({uniqueId:i})=>i?16384:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.maxSelect"),l&81921&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function eC(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Max select"),l=D(),s=b("input"),p(e,"for",i=n[14]),p(s,"id",o=n[14]),p(s,"type","number"),p(s,"step","1"),p(s,"min","2"),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.maxSelect),r||(a=Z(s,"input",n[6]),r=!0)},p(f,u){u&16384&&i!==(i=f[14])&&p(e,"for",i),u&16384&&o!==(o=f[14])&&p(s,"id",o),u&1&&lt(s.value)!==f[0].options.maxSelect&&ae(s,f[0].options.maxSelect)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function tC(n){let e,t,i=!n[2]&&Sd(n);return{c(){i&&i.c(),e=ve()},m(l,s){i&&i.m(l,s),S(l,e,s),t=!0},p(l,s){l[2]?i&&(se(),L(i,1,1,()=>{i=null}),oe()):i?(i.p(l,s),s&4&&I(i,1)):(i=Sd(l),i.c(),I(i,1),i.m(e.parentNode,e))},i(l){t||(I(i),t=!0)},o(l){L(i),t=!1},d(l){l&&w(e),i&&i.d(l)}}}function nC(n){let e,t,i;const l=[{key:n[1]},n[4]];function s(r){n[9](r)}let o={$$slots:{options:[tC],default:[xT,({interactive:r})=>({15:r}),({interactive:r})=>r?32768:0]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[10]),e.$on("remove",n[11]),e.$on("duplicate",n[12]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&18?mt(l,[a&2&&{key:r[1]},a&16&&Mt(r[4])]):{};a&98311&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function iC(n,e,t){var $;const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;const r=[{label:"Single",value:!0},{label:"Multiple",value:!1}];let a=(($=s.options)==null?void 0:$.maxSelect)<=1,f=a;function u(){t(0,s.options={maxSelect:1,values:[]},s),t(2,a=!0),t(5,f=a)}function c(){s.options.maxSelect=lt(this.value),t(0,s),t(5,f),t(2,a)}function d(C){n.$$.not_equal(s.options.values,C)&&(s.options.values=C,t(0,s),t(5,f),t(2,a))}function m(C){a=C,t(2,a)}function h(C){s=C,t(0,s),t(5,f),t(2,a)}function _(C){Oe.call(this,n,C)}function g(C){Oe.call(this,n,C)}function v(C){Oe.call(this,n,C)}return n.$$set=C=>{e=Ae(Ae({},e),Kt(C)),t(4,l=Xe(e,i)),"field"in C&&t(0,s=C.field),"key"in C&&t(1,o=C.key)},n.$$.update=()=>{var C,T;n.$$.dirty&37&&f!=a&&(t(5,f=a),a?t(0,s.options.maxSelect=1,s):t(0,s.options.maxSelect=((T=(C=s.options)==null?void 0:C.values)==null?void 0:T.length)||2,s)),n.$$.dirty&1&&H.isEmpty(s.options)&&u()},[s,o,a,r,l,f,c,d,m,h,_,g,v]}class lC extends be{constructor(e){super(),ge(this,e,iC,nC,he,{field:0,key:1})}}function sC(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=J("Max size "),i=b("small"),i.textContent="(bytes)",s=D(),o=b("input"),p(e,"for",l=n[11]),p(o,"type","number"),p(o,"id",r=n[11]),p(o,"step","1"),p(o,"min","0")},m(u,c){S(u,e,c),y(e,t),y(e,i),S(u,s,c),S(u,o,c),ae(o,n[0].options.maxSize),a||(f=Z(o,"input",n[4]),a=!0)},p(u,c){c&2048&&l!==(l=u[11])&&p(e,"for",l),c&2048&&r!==(r=u[11])&&p(o,"id",r),c&1&&lt(o.value)!==u[0].options.maxSize&&ae(o,u[0].options.maxSize)},d(u){u&&(w(e),w(s),w(o)),a=!1,f()}}}function oC(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-down-s-line txt-sm")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function rC(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-up-s-line txt-sm")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function $d(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E='"{"a":1,"b":2}"',A,N,q,R,P,F,j,U,Y,X,W,K,le;return{c(){e=b("div"),t=b("div"),i=b("div"),l=J("In order to support seamlessly both "),s=b("code"),s.textContent="application/json",o=J(` and
`),r=b("code"),r.textContent="multipart/form-data",a=J(`
requests, the following normalization rules are applied if the `),f=b("code"),f.textContent="json",u=J(` field
is a
`),c=b("strong"),c.textContent="plain string",d=J(`:
`),m=b("ul"),h=b("li"),h.innerHTML="&quot;true&quot; is converted to the json <code>true</code>",_=D(),g=b("li"),g.innerHTML="&quot;false&quot; is converted to the json <code>false</code>",v=D(),$=b("li"),$.innerHTML="&quot;null&quot; is converted to the json <code>null</code>",C=D(),T=b("li"),T.innerHTML="&quot;[1,2,3]&quot; is converted to the json <code>[1,2,3]</code>",O=D(),M=b("li"),A=J(E),N=J(" is converted to the json "),q=b("code"),q.textContent='{"a":1,"b":2}',R=D(),P=b("li"),P.textContent="numeric strings are converted to json number",F=D(),j=b("li"),j.textContent="double quoted strings are left as they are (aka. without normalizations)",U=D(),Y=b("li"),Y.textContent="any other string (empty string too) is double quoted",X=J(`
Alternatively, if you want to avoid the string value normalizations, you can wrap your
data inside an object, eg.`),W=b("code"),W.textContent='{"data": anything}',p(i,"class","content"),p(t,"class","alert alert-warning m-b-0 m-t-10"),p(e,"class","block")},m(ne,me){S(ne,e,me),y(e,t),y(t,i),y(i,l),y(i,s),y(i,o),y(i,r),y(i,a),y(i,f),y(i,u),y(i,c),y(i,d),y(i,m),y(m,h),y(m,_),y(m,g),y(m,v),y(m,$),y(m,C),y(m,T),y(m,O),y(m,M),y(M,A),y(M,N),y(M,q),y(m,R),y(m,P),y(m,F),y(m,j),y(m,U),y(m,Y),y(i,X),y(i,W),le=!0},i(ne){le||(ne&&Je(()=>{le&&(K||(K=Re(e,tt,{duration:150},!0)),K.run(1))}),le=!0)},o(ne){ne&&(K||(K=Re(e,tt,{duration:150},!1)),K.run(0)),le=!1},d(ne){ne&&w(e),ne&&K&&K.end()}}}function aC(n){let e,t,i,l,s,o,r,a,f,u,c;e=new de({props:{class:"form-field required m-b-sm",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[sC,({uniqueId:g})=>({11:g}),({uniqueId:g})=>g?2048:0]},$$scope:{ctx:n}}});function d(g,v){return g[2]?rC:oC}let m=d(n),h=m(n),_=n[2]&&$d();return{c(){B(e.$$.fragment),t=D(),i=b("button"),l=b("strong"),l.textContent="String value normalizations",s=D(),h.c(),r=D(),_&&_.c(),a=ve(),p(l,"class","txt"),p(i,"type","button"),p(i,"class",o="btn btn-sm "+(n[2]?"btn-secondary":"btn-hint btn-transparent"))},m(g,v){z(e,g,v),S(g,t,v),S(g,i,v),y(i,l),y(i,s),h.m(i,null),S(g,r,v),_&&_.m(g,v),S(g,a,v),f=!0,u||(c=Z(i,"click",n[5]),u=!0)},p(g,v){const $={};v&2&&($.name="schema."+g[1]+".options.maxSize"),v&6145&&($.$$scope={dirty:v,ctx:g}),e.$set($),m!==(m=d(g))&&(h.d(1),h=m(g),h&&(h.c(),h.m(i,null))),(!f||v&4&&o!==(o="btn btn-sm "+(g[2]?"btn-secondary":"btn-hint btn-transparent")))&&p(i,"class",o),g[2]?_?v&4&&I(_,1):(_=$d(),_.c(),I(_,1),_.m(a.parentNode,a)):_&&(se(),L(_,1,1,()=>{_=null}),oe())},i(g){f||(I(e.$$.fragment,g),I(_),f=!0)},o(g){L(e.$$.fragment,g),L(_),f=!1},d(g){g&&(w(t),w(i),w(r),w(a)),V(e,g),h.d(),_&&_.d(g),u=!1,c()}}}function fC(n){let e,t,i;const l=[{key:n[1]},n[3]];function s(r){n[6](r)}let o={$$slots:{options:[aC]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&10?mt(l,[a&2&&{key:r[1]},a&8&&Mt(r[3])]):{};a&4103&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function uC(n,e,t){const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e,r=!1;function a(){t(0,s.options={maxSize:2e6},s)}function f(){s.options.maxSize=lt(this.value),t(0,s)}const u=()=>{t(2,r=!r)};function c(_){s=_,t(0,s)}function d(_){Oe.call(this,n,_)}function m(_){Oe.call(this,n,_)}function h(_){Oe.call(this,n,_)}return n.$$set=_=>{e=Ae(Ae({},e),Kt(_)),t(3,l=Xe(e,i)),"field"in _&&t(0,s=_.field),"key"in _&&t(1,o=_.key)},n.$$.update=()=>{n.$$.dirty&1&&H.isEmpty(s.options)&&a()},[s,o,r,l,f,u,c,d,m,h]}class cC extends be{constructor(e){super(),ge(this,e,uC,fC,he,{field:0,key:1})}}function dC(n){let e,t=(n[0].ext||"N/A")+"",i,l,s,o=n[0].mimeType+"",r;return{c(){e=b("span"),i=J(t),l=D(),s=b("small"),r=J(o),p(e,"class","txt"),p(s,"class","txt-hint")},m(a,f){S(a,e,f),y(e,i),S(a,l,f),S(a,s,f),y(s,r)},p(a,[f]){f&1&&t!==(t=(a[0].ext||"N/A")+"")&&re(i,t),f&1&&o!==(o=a[0].mimeType+"")&&re(r,o)},i:x,o:x,d(a){a&&(w(e),w(l),w(s))}}}function pC(n,e,t){let{item:i={}}=e;return n.$$set=l=>{"item"in l&&t(0,i=l.item)},[i]}class Td extends be{constructor(e){super(),ge(this,e,pC,dC,he,{item:0})}}const mC=[{ext:".xpm",mimeType:"image/x-xpixmap"},{ext:".7z",mimeType:"application/x-7z-compressed"},{ext:".zip",mimeType:"application/zip"},{ext:".xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},{ext:".docx",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},{ext:".pptx",mimeType:"application/vnd.openxmlformats-officedocument.presentationml.presentation"},{ext:".epub",mimeType:"application/epub+zip"},{ext:".jar",mimeType:"application/jar"},{ext:".odt",mimeType:"application/vnd.oasis.opendocument.text"},{ext:".ott",mimeType:"application/vnd.oasis.opendocument.text-template"},{ext:".ods",mimeType:"application/vnd.oasis.opendocument.spreadsheet"},{ext:".ots",mimeType:"application/vnd.oasis.opendocument.spreadsheet-template"},{ext:".odp",mimeType:"application/vnd.oasis.opendocument.presentation"},{ext:".otp",mimeType:"application/vnd.oasis.opendocument.presentation-template"},{ext:".odg",mimeType:"application/vnd.oasis.opendocument.graphics"},{ext:".otg",mimeType:"application/vnd.oasis.opendocument.graphics-template"},{ext:".odf",mimeType:"application/vnd.oasis.opendocument.formula"},{ext:".odc",mimeType:"application/vnd.oasis.opendocument.chart"},{ext:".sxc",mimeType:"application/vnd.sun.xml.calc"},{ext:".pdf",mimeType:"application/pdf"},{ext:".fdf",mimeType:"application/vnd.fdf"},{ext:"",mimeType:"application/x-ole-storage"},{ext:".msi",mimeType:"application/x-ms-installer"},{ext:".aaf",mimeType:"application/octet-stream"},{ext:".msg",mimeType:"application/vnd.ms-outlook"},{ext:".xls",mimeType:"application/vnd.ms-excel"},{ext:".pub",mimeType:"application/vnd.ms-publisher"},{ext:".ppt",mimeType:"application/vnd.ms-powerpoint"},{ext:".doc",mimeType:"application/msword"},{ext:".ps",mimeType:"application/postscript"},{ext:".psd",mimeType:"image/vnd.adobe.photoshop"},{ext:".p7s",mimeType:"application/pkcs7-signature"},{ext:".ogg",mimeType:"application/ogg"},{ext:".oga",mimeType:"audio/ogg"},{ext:".ogv",mimeType:"video/ogg"},{ext:".png",mimeType:"image/png"},{ext:".png",mimeType:"image/vnd.mozilla.apng"},{ext:".jpg",mimeType:"image/jpeg"},{ext:".jxl",mimeType:"image/jxl"},{ext:".jp2",mimeType:"image/jp2"},{ext:".jpf",mimeType:"image/jpx"},{ext:".jpm",mimeType:"image/jpm"},{ext:".jxs",mimeType:"image/jxs"},{ext:".gif",mimeType:"image/gif"},{ext:".webp",mimeType:"image/webp"},{ext:".exe",mimeType:"application/vnd.microsoft.portable-executable"},{ext:"",mimeType:"application/x-elf"},{ext:"",mimeType:"application/x-object"},{ext:"",mimeType:"application/x-executable"},{ext:".so",mimeType:"application/x-sharedlib"},{ext:"",mimeType:"application/x-coredump"},{ext:".a",mimeType:"application/x-archive"},{ext:".deb",mimeType:"application/vnd.debian.binary-package"},{ext:".tar",mimeType:"application/x-tar"},{ext:".xar",mimeType:"application/x-xar"},{ext:".bz2",mimeType:"application/x-bzip2"},{ext:".fits",mimeType:"application/fits"},{ext:".tiff",mimeType:"image/tiff"},{ext:".bmp",mimeType:"image/bmp"},{ext:".ico",mimeType:"image/x-icon"},{ext:".mp3",mimeType:"audio/mpeg"},{ext:".flac",mimeType:"audio/flac"},{ext:".midi",mimeType:"audio/midi"},{ext:".ape",mimeType:"audio/ape"},{ext:".mpc",mimeType:"audio/musepack"},{ext:".amr",mimeType:"audio/amr"},{ext:".wav",mimeType:"audio/wav"},{ext:".aiff",mimeType:"audio/aiff"},{ext:".au",mimeType:"audio/basic"},{ext:".mpeg",mimeType:"video/mpeg"},{ext:".mov",mimeType:"video/quicktime"},{ext:".mqv",mimeType:"video/quicktime"},{ext:".mp4",mimeType:"video/mp4"},{ext:".webm",mimeType:"video/webm"},{ext:".3gp",mimeType:"video/3gpp"},{ext:".3g2",mimeType:"video/3gpp2"},{ext:".avi",mimeType:"video/x-msvideo"},{ext:".flv",mimeType:"video/x-flv"},{ext:".mkv",mimeType:"video/x-matroska"},{ext:".asf",mimeType:"video/x-ms-asf"},{ext:".aac",mimeType:"audio/aac"},{ext:".voc",mimeType:"audio/x-unknown"},{ext:".mp4",mimeType:"audio/mp4"},{ext:".m4a",mimeType:"audio/x-m4a"},{ext:".m3u",mimeType:"application/vnd.apple.mpegurl"},{ext:".m4v",mimeType:"video/x-m4v"},{ext:".rmvb",mimeType:"application/vnd.rn-realmedia-vbr"},{ext:".gz",mimeType:"application/gzip"},{ext:".class",mimeType:"application/x-java-applet"},{ext:".swf",mimeType:"application/x-shockwave-flash"},{ext:".crx",mimeType:"application/x-chrome-extension"},{ext:".ttf",mimeType:"font/ttf"},{ext:".woff",mimeType:"font/woff"},{ext:".woff2",mimeType:"font/woff2"},{ext:".otf",mimeType:"font/otf"},{ext:".ttc",mimeType:"font/collection"},{ext:".eot",mimeType:"application/vnd.ms-fontobject"},{ext:".wasm",mimeType:"application/wasm"},{ext:".shx",mimeType:"application/vnd.shx"},{ext:".shp",mimeType:"application/vnd.shp"},{ext:".dbf",mimeType:"application/x-dbf"},{ext:".dcm",mimeType:"application/dicom"},{ext:".rar",mimeType:"application/x-rar-compressed"},{ext:".djvu",mimeType:"image/vnd.djvu"},{ext:".mobi",mimeType:"application/x-mobipocket-ebook"},{ext:".lit",mimeType:"application/x-ms-reader"},{ext:".bpg",mimeType:"image/bpg"},{ext:".sqlite",mimeType:"application/vnd.sqlite3"},{ext:".dwg",mimeType:"image/vnd.dwg"},{ext:".nes",mimeType:"application/vnd.nintendo.snes.rom"},{ext:".lnk",mimeType:"application/x-ms-shortcut"},{ext:".macho",mimeType:"application/x-mach-binary"},{ext:".qcp",mimeType:"audio/qcelp"},{ext:".icns",mimeType:"image/x-icns"},{ext:".heic",mimeType:"image/heic"},{ext:".heic",mimeType:"image/heic-sequence"},{ext:".heif",mimeType:"image/heif"},{ext:".heif",mimeType:"image/heif-sequence"},{ext:".hdr",mimeType:"image/vnd.radiance"},{ext:".mrc",mimeType:"application/marc"},{ext:".mdb",mimeType:"application/x-msaccess"},{ext:".accdb",mimeType:"application/x-msaccess"},{ext:".zst",mimeType:"application/zstd"},{ext:".cab",mimeType:"application/vnd.ms-cab-compressed"},{ext:".rpm",mimeType:"application/x-rpm"},{ext:".xz",mimeType:"application/x-xz"},{ext:".lz",mimeType:"application/lzip"},{ext:".torrent",mimeType:"application/x-bittorrent"},{ext:".cpio",mimeType:"application/x-cpio"},{ext:"",mimeType:"application/tzif"},{ext:".xcf",mimeType:"image/x-xcf"},{ext:".pat",mimeType:"image/x-gimp-pat"},{ext:".gbr",mimeType:"image/x-gimp-gbr"},{ext:".glb",mimeType:"model/gltf-binary"},{ext:".avif",mimeType:"image/avif"},{ext:".cab",mimeType:"application/x-installshield"},{ext:".jxr",mimeType:"image/jxr"},{ext:".txt",mimeType:"text/plain"},{ext:".html",mimeType:"text/html"},{ext:".svg",mimeType:"image/svg+xml"},{ext:".xml",mimeType:"text/xml"},{ext:".rss",mimeType:"application/rss+xml"},{ext:".atom",mimeType:"applicatiotom+xml"},{ext:".x3d",mimeType:"model/x3d+xml"},{ext:".kml",mimeType:"application/vnd.google-earth.kml+xml"},{ext:".xlf",mimeType:"application/x-xliff+xml"},{ext:".dae",mimeType:"model/vnd.collada+xml"},{ext:".gml",mimeType:"application/gml+xml"},{ext:".gpx",mimeType:"application/gpx+xml"},{ext:".tcx",mimeType:"application/vnd.garmin.tcx+xml"},{ext:".amf",mimeType:"application/x-amf"},{ext:".3mf",mimeType:"application/vnd.ms-package.3dmanufacturing-3dmodel+xml"},{ext:".xfdf",mimeType:"application/vnd.adobe.xfdf"},{ext:".owl",mimeType:"application/owl+xml"},{ext:".php",mimeType:"text/x-php"},{ext:".js",mimeType:"application/javascript"},{ext:".lua",mimeType:"text/x-lua"},{ext:".pl",mimeType:"text/x-perl"},{ext:".py",mimeType:"text/x-python"},{ext:".json",mimeType:"application/json"},{ext:".geojson",mimeType:"application/geo+json"},{ext:".har",mimeType:"application/json"},{ext:".ndjson",mimeType:"application/x-ndjson"},{ext:".rtf",mimeType:"text/rtf"},{ext:".srt",mimeType:"application/x-subrip"},{ext:".tcl",mimeType:"text/x-tcl"},{ext:".csv",mimeType:"text/csv"},{ext:".tsv",mimeType:"text/tab-separated-values"},{ext:".vcf",mimeType:"text/vcard"},{ext:".ics",mimeType:"text/calendar"},{ext:".warc",mimeType:"application/warc"},{ext:".vtt",mimeType:"text/vtt"},{ext:"",mimeType:"application/octet-stream"}];function hC(n){let e,t,i;function l(o){n[16](o)}let s={id:n[23],items:n[4],readonly:!n[24]};return n[2]!==void 0&&(s.keyOfSelected=n[2]),e=new _i({props:s}),te.push(()=>ke(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&8388608&&(a.id=o[23]),r&16777216&&(a.readonly=!o[24]),!t&&r&4&&(t=!0,a.keyOfSelected=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function _C(n){let e,t,i,l,s,o;return i=new de({props:{class:"form-field form-field-single-multiple-select "+(n[24]?"":"readonly"),inlineError:!0,$$slots:{default:[hC,({uniqueId:r})=>({23:r}),({uniqueId:r})=>r?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=D(),B(i.$$.fragment),l=D(),s=b("div"),p(e,"class","separator"),p(s,"class","separator")},m(r,a){S(r,e,a),S(r,t,a),z(i,r,a),S(r,l,a),S(r,s,a),o=!0},p(r,a){const f={};a&16777216&&(f.class="form-field form-field-single-multiple-select "+(r[24]?"":"readonly")),a&58720260&&(f.$$scope={dirty:a,ctx:r}),i.$set(f)},i(r){o||(I(i.$$.fragment,r),o=!0)},o(r){L(i.$$.fragment,r),o=!1},d(r){r&&(w(e),w(t),w(l),w(s)),V(i,r)}}}function gC(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("button"),e.innerHTML='<span class="txt">Images (jpg, png, svg, gif, webp)</span>',t=D(),i=b("button"),i.innerHTML='<span class="txt">Documents (pdf, doc/docx, xls/xlsx)</span>',l=D(),s=b("button"),s.innerHTML='<span class="txt">Videos (mp4, avi, mov, 3gp)</span>',o=D(),r=b("button"),r.innerHTML='<span class="txt">Archives (zip, 7zip, rar)</span>',p(e,"type","button"),p(e,"class","dropdown-item closable"),p(e,"role","menuitem"),p(i,"type","button"),p(i,"class","dropdown-item closable"),p(i,"role","menuitem"),p(s,"type","button"),p(s,"class","dropdown-item closable"),p(s,"role","menuitem"),p(r,"type","button"),p(r,"class","dropdown-item closable"),p(r,"role","menuitem")},m(u,c){S(u,e,c),S(u,t,c),S(u,i,c),S(u,l,c),S(u,s,c),S(u,o,c),S(u,r,c),a||(f=[Z(e,"click",n[9]),Z(i,"click",n[10]),Z(s,"click",n[11]),Z(r,"click",n[12])],a=!0)},p:x,d(u){u&&(w(e),w(t),w(i),w(l),w(s),w(o),w(r)),a=!1,Te(f)}}}function bC(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C;function T(M){n[8](M)}let O={id:n[23],multiple:!0,searchable:!0,closable:!1,selectionKey:"mimeType",selectPlaceholder:"No restriction",items:n[3],labelComponent:Td,optionComponent:Td};return n[0].options.mimeTypes!==void 0&&(O.keyOfSelected=n[0].options.mimeTypes),r=new _i({props:O}),te.push(()=>ke(r,"keyOfSelected",T)),g=new Mn({props:{class:"dropdown dropdown-sm dropdown-nowrap dropdown-left",$$slots:{default:[gC]},$$scope:{ctx:n}}}),{c(){e=b("label"),t=b("span"),t.textContent="Allowed mime types",i=D(),l=b("i"),o=D(),B(r.$$.fragment),f=D(),u=b("div"),c=b("div"),d=b("span"),d.textContent="Choose presets",m=D(),h=b("i"),_=D(),B(g.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[23]),p(d,"class","txt link-primary"),p(h,"class","ri-arrow-drop-down-fill"),p(h,"aria-hidden","true"),p(c,"tabindex","0"),p(c,"role","button"),p(c,"class","inline-flex flex-gap-0"),p(u,"class","help-block")},m(M,E){S(M,e,E),y(e,t),y(e,i),y(e,l),S(M,o,E),z(r,M,E),S(M,f,E),S(M,u,E),y(u,c),y(c,d),y(c,m),y(c,h),y(c,_),z(g,c,null),v=!0,$||(C=$e(Fe.call(null,l,{text:`Allow files ONLY with the listed mime types.
Leave empty for no restriction.`,position:"top"})),$=!0)},p(M,E){(!v||E&8388608&&s!==(s=M[23]))&&p(e,"for",s);const A={};E&8388608&&(A.id=M[23]),E&8&&(A.items=M[3]),!a&&E&1&&(a=!0,A.keyOfSelected=M[0].options.mimeTypes,ye(()=>a=!1)),r.$set(A);const N={};E&33554433&&(N.$$scope={dirty:E,ctx:M}),g.$set(N)},i(M){v||(I(r.$$.fragment,M),I(g.$$.fragment,M),v=!0)},o(M){L(r.$$.fragment,M),L(g.$$.fragment,M),v=!1},d(M){M&&(w(e),w(o),w(f),w(u)),V(r,M),V(g),$=!1,C()}}}function kC(n){let e;return{c(){e=b("ul"),e.innerHTML=`<li><strong>WxH</strong>
(eg. 100x50) - crop to WxH viewbox (from center)</li> <li><strong>WxHt</strong>
(eg. 100x50t) - crop to WxH viewbox (from top)</li> <li><strong>WxHb</strong>
(eg. 100x50b) - crop to WxH viewbox (from bottom)</li> <li><strong>WxHf</strong>
(eg. 100x50f) - fit inside a WxH viewbox (without cropping)</li> <li><strong>0xH</strong>
(eg. 0x50) - resize to H height preserving the aspect ratio</li> <li><strong>Wx0</strong>
(eg. 100x0) - resize to W width preserving the aspect ratio</li>`,p(e,"class","m-0")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function yC(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O;function M(A){n[13](A)}let E={id:n[23],placeholder:"eg. 50x50, 480x720"};return n[0].options.thumbs!==void 0&&(E.value=n[0].options.thumbs),r=new Pl({props:E}),te.push(()=>ke(r,"value",M)),$=new Mn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[kC]},$$scope:{ctx:n}}}),{c(){e=b("label"),t=b("span"),t.textContent="Thumb sizes",i=D(),l=b("i"),o=D(),B(r.$$.fragment),f=D(),u=b("div"),c=b("span"),c.textContent="Use comma as separator.",d=D(),m=b("button"),h=b("span"),h.textContent="Supported formats",_=D(),g=b("i"),v=D(),B($.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[23]),p(c,"class","txt"),p(h,"class","txt link-primary"),p(g,"class","ri-arrow-drop-down-fill"),p(g,"aria-hidden","true"),p(m,"type","button"),p(m,"class","inline-flex flex-gap-0"),p(u,"class","help-block")},m(A,N){S(A,e,N),y(e,t),y(e,i),y(e,l),S(A,o,N),z(r,A,N),S(A,f,N),S(A,u,N),y(u,c),y(u,d),y(u,m),y(m,h),y(m,_),y(m,g),y(m,v),z($,m,null),C=!0,T||(O=$e(Fe.call(null,l,{text:"List of additional thumb sizes for image files, along with the default thumb size of 100x100. The thumbs are generated lazily on first access.",position:"top"})),T=!0)},p(A,N){(!C||N&8388608&&s!==(s=A[23]))&&p(e,"for",s);const q={};N&8388608&&(q.id=A[23]),!a&&N&1&&(a=!0,q.value=A[0].options.thumbs,ye(()=>a=!1)),r.$set(q);const R={};N&33554432&&(R.$$scope={dirty:N,ctx:A}),$.$set(R)},i(A){C||(I(r.$$.fragment,A),I($.$$.fragment,A),C=!0)},o(A){L(r.$$.fragment,A),L($.$$.fragment,A),C=!1},d(A){A&&(w(e),w(o),w(f),w(u)),V(r,A),V($),T=!1,O()}}}function vC(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=J("Max file size"),l=D(),s=b("input"),r=D(),a=b("div"),a.textContent="Must be in bytes.",p(e,"for",i=n[23]),p(s,"type","number"),p(s,"id",o=n[23]),p(s,"step","1"),p(s,"min","0"),p(a,"class","help-block")},m(c,d){S(c,e,d),y(e,t),S(c,l,d),S(c,s,d),ae(s,n[0].options.maxSize),S(c,r,d),S(c,a,d),f||(u=Z(s,"input",n[14]),f=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(s,"id",o),d&1&&lt(s.value)!==c[0].options.maxSize&&ae(s,c[0].options.maxSize)},d(c){c&&(w(e),w(l),w(s),w(r),w(a)),f=!1,u()}}}function Cd(n){let e,t,i;return t=new de({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[wC,({uniqueId:l})=>({23:l}),({uniqueId:l})=>l?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","col-sm-3")},m(l,s){S(l,e,s),z(t,e,null),i=!0},p(l,s){const o={};s&2&&(o.name="schema."+l[1]+".options.maxSelect"),s&41943041&&(o.$$scope={dirty:s,ctx:l}),t.$set(o)},i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){L(t.$$.fragment,l),i=!1},d(l){l&&w(e),V(t)}}}function wC(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Max select"),l=D(),s=b("input"),p(e,"for",i=n[23]),p(s,"id",o=n[23]),p(s,"type","number"),p(s,"step","1"),p(s,"min","2"),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.maxSelect),r||(a=Z(s,"input",n[15]),r=!0)},p(f,u){u&8388608&&i!==(i=f[23])&&p(e,"for",i),u&8388608&&o!==(o=f[23])&&p(s,"id",o),u&1&&lt(s.value)!==f[0].options.maxSelect&&ae(s,f[0].options.maxSelect)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function SC(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;i=new de({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[bC,({uniqueId:_})=>({23:_}),({uniqueId:_})=>_?8388608:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[yC,({uniqueId:_})=>({23:_}),({uniqueId:_})=>_?8388608:0]},$$scope:{ctx:n}}}),u=new de({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[vC,({uniqueId:_})=>({23:_}),({uniqueId:_})=>_?8388608:0]},$$scope:{ctx:n}}});let h=!n[2]&&Cd(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),a=D(),f=b("div"),B(u.$$.fragment),d=D(),h&&h.c(),p(t,"class","col-sm-12"),p(s,"class",r=n[2]?"col-sm-8":"col-sm-6"),p(f,"class",c=n[2]?"col-sm-4":"col-sm-3"),p(e,"class","grid grid-sm")},m(_,g){S(_,e,g),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),y(e,a),y(e,f),z(u,f,null),y(e,d),h&&h.m(e,null),m=!0},p(_,g){const v={};g&2&&(v.name="schema."+_[1]+".options.mimeTypes"),g&41943049&&(v.$$scope={dirty:g,ctx:_}),i.$set(v);const $={};g&2&&($.name="schema."+_[1]+".options.thumbs"),g&41943041&&($.$$scope={dirty:g,ctx:_}),o.$set($),(!m||g&4&&r!==(r=_[2]?"col-sm-8":"col-sm-6"))&&p(s,"class",r);const C={};g&2&&(C.name="schema."+_[1]+".options.maxSize"),g&41943041&&(C.$$scope={dirty:g,ctx:_}),u.$set(C),(!m||g&4&&c!==(c=_[2]?"col-sm-4":"col-sm-3"))&&p(f,"class",c),_[2]?h&&(se(),L(h,1,1,()=>{h=null}),oe()):h?(h.p(_,g),g&4&&I(h,1)):(h=Cd(_),h.c(),I(h,1),h.m(e,null))},i(_){m||(I(i.$$.fragment,_),I(o.$$.fragment,_),I(u.$$.fragment,_),I(h),m=!0)},o(_){L(i.$$.fragment,_),L(o.$$.fragment,_),L(u.$$.fragment,_),L(h),m=!1},d(_){_&&w(e),V(i),V(o),V(u),h&&h.d()}}}function $C(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Protected",r=D(),a=b("a"),a.textContent="(Learn more)",p(e,"type","checkbox"),p(e,"id",t=n[23]),p(s,"class","txt"),p(l,"for",o=n[23]),p(a,"href","https://pocketbase.io/docs/files-handling/#protected-files"),p(a,"class","toggle-info txt-sm txt-hint m-l-5"),p(a,"target","_blank"),p(a,"rel","noopener")},m(c,d){S(c,e,d),e.checked=n[0].options.protected,S(c,i,d),S(c,l,d),y(l,s),S(c,r,d),S(c,a,d),f||(u=Z(e,"change",n[7]),f=!0)},p(c,d){d&8388608&&t!==(t=c[23])&&p(e,"id",t),d&1&&(e.checked=c[0].options.protected),d&8388608&&o!==(o=c[23])&&p(l,"for",o)},d(c){c&&(w(e),w(i),w(l),w(r),w(a)),f=!1,u()}}}function TC(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle",name:"schema."+n[1]+".options.protected",$$slots:{default:[$C,({uniqueId:i})=>({23:i}),({uniqueId:i})=>i?8388608:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.protected"),l&41943041&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function CC(n){let e,t,i;const l=[{key:n[1]},n[5]];function s(r){n[17](r)}let o={$$slots:{optionsFooter:[TC],options:[SC],default:[_C,({interactive:r})=>({24:r}),({interactive:r})=>r?16777216:0]},$$scope:{ctx:n}};for(let r=0;r<l.length;r+=1)o=Ae(o,l[r]);return n[0]!==void 0&&(o.field=n[0]),e=new oi({props:o}),te.push(()=>ke(e,"field",s)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&34?mt(l,[a&2&&{key:r[1]},a&32&&Mt(r[5])]):{};a&50331663&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ye(()=>t=!1)),e.$set(f)},i(r){i||(I(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function OC(n,e,t){var R;const i=["field","key"];let l=Xe(e,i),{field:s}=e,{key:o=""}=e;const r=[{label:"Single",value:!0},{label:"Multiple",value:!1}];let a=mC.slice(),f=((R=s.options)==null?void 0:R.maxSelect)<=1,u=f;function c(){t(0,s.options={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]},s),t(2,f=!0),t(6,u=f)}function d(){if(H.isEmpty(s.options.mimeTypes))return;const P=[];for(const F of s.options.mimeTypes)a.find(j=>j.mimeType===F)||P.push({mimeType:F});P.length&&t(3,a=a.concat(P))}function m(){s.options.protected=this.checked,t(0,s),t(6,u),t(2,f)}function h(P){n.$$.not_equal(s.options.mimeTypes,P)&&(s.options.mimeTypes=P,t(0,s),t(6,u),t(2,f))}const _=()=>{t(0,s.options.mimeTypes=["image/jpeg","image/png","image/svg+xml","image/gif","image/webp"],s)},g=()=>{t(0,s.options.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],s)},v=()=>{t(0,s.options.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},$=()=>{t(0,s.options.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function C(P){n.$$.not_equal(s.options.thumbs,P)&&(s.options.thumbs=P,t(0,s),t(6,u),t(2,f))}function T(){s.options.maxSize=lt(this.value),t(0,s),t(6,u),t(2,f)}function O(){s.options.maxSelect=lt(this.value),t(0,s),t(6,u),t(2,f)}function M(P){f=P,t(2,f)}function E(P){s=P,t(0,s),t(6,u),t(2,f)}function A(P){Oe.call(this,n,P)}function N(P){Oe.call(this,n,P)}function q(P){Oe.call(this,n,P)}return n.$$set=P=>{e=Ae(Ae({},e),Kt(P)),t(5,l=Xe(e,i)),"field"in P&&t(0,s=P.field),"key"in P&&t(1,o=P.key)},n.$$.update=()=>{var P,F;n.$$.dirty&69&&u!=f&&(t(6,u=f),f?t(0,s.options.maxSelect=1,s):t(0,s.options.maxSelect=((F=(P=s.options)==null?void 0:P.values)==null?void 0:F.length)||99,s)),n.$$.dirty&1&&(H.isEmpty(s.options)?c():d())},[s,o,f,a,r,l,u,m,h,_,g,v,$,C,T,O,M,E,A,N,q]}class MC extends be{constructor(e){super(),ge(this,e,OC,CC,he,{field:0,key:1})}}function DC(n){let e,t,i,l,s;return{c(){e=b("hr"),t=D(),i=b("button"),i.innerHTML='<i class="ri-add-line"></i> <span class="txt">New collection</span>',p(i,"type","button"),p(i,"class","btn btn-transparent btn-block btn-sm")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),l||(s=Z(i,"click",n[14]),l=!0)},p:x,d(o){o&&(w(e),w(t),w(i)),l=!1,s()}}}function EC(n){let e,t,i;function l(o){n[15](o)}let s={id:n[24],searchable:n[5].length>5,selectPlaceholder:"Select collection *",noOptionsText:"No collections found",selectionKey:"id",items:n[5],readonly:!n[25]||n[0].id,$$slots:{afterOptions:[DC]},$$scope:{ctx:n}};return n[0].options.collectionId!==void 0&&(s.keyOfSelected=n[0].options.collectionId),e=new _i({props:s}),te.push(()=>ke(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&16777216&&(a.id=o[24]),r&32&&(a.searchable=o[5].length>5),r&32&&(a.items=o[5]),r&33554433&&(a.readonly=!o[25]||o[0].id),r&67108872&&(a.$$scope={dirty:r,ctx:o}),!t&&r&1&&(t=!0,a.keyOfSelected=o[0].options.collectionId,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function IC(n){let e,t,i;function l(o){n[16](o)}let s={id:n[24],items:n[6],readonly:!n[25]};return n[2]!==void 0&&(s.keyOfSelected=n[2]),e=new _i({props:s}),te.push(()=>ke(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&16777216&&(a.id=o[24]),r&33554432&&(a.readonly=!o[25]),!t&&r&4&&(t=!0,a.keyOfSelected=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function AC(n){let e,t,i,l,s,o,r,a,f,u;return i=new de({props:{class:"form-field required "+(n[25]?"":"readonly"),inlineError:!0,name:"schema."+n[1]+".options.collectionId",$$slots:{default:[EC,({uniqueId:c})=>({24:c}),({uniqueId:c})=>c?16777216:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field form-field-single-multiple-select "+(n[25]?"":"readonly"),inlineError:!0,$$slots:{default:[IC,({uniqueId:c})=>({24:c}),({uniqueId:c})=>c?16777216:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=D(),B(i.$$.fragment),l=D(),s=b("div"),o=D(),B(r.$$.fragment),a=D(),f=b("div"),p(e,"class","separator"),p(s,"class","separator"),p(f,"class","separator")},m(c,d){S(c,e,d),S(c,t,d),z(i,c,d),S(c,l,d),S(c,s,d),S(c,o,d),z(r,c,d),S(c,a,d),S(c,f,d),u=!0},p(c,d){const m={};d&33554432&&(m.class="form-field required "+(c[25]?"":"readonly")),d&2&&(m.name="schema."+c[1]+".options.collectionId"),d&117440553&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const h={};d&33554432&&(h.class="form-field form-field-single-multiple-select "+(c[25]?"":"readonly")),d&117440516&&(h.$$scope={dirty:d,ctx:c}),r.$set(h)},i(c){u||(I(i.$$.fragment,c),I(r.$$.fragment,c),u=!0)},o(c){L(i.$$.fragment,c),L(r.$$.fragment,c),u=!1},d(c){c&&(w(e),w(t),w(l),w(s),w(o),w(a),w(f)),V(i,c),V(r,c)}}}function Od(n){let e,t,i,l,s,o;return t=new de({props:{class:"form-field",name:"schema."+n[1]+".options.minSelect",$$slots:{default:[LC,({uniqueId:r})=>({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}}),s=new de({props:{class:"form-field",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[NC,({uniqueId:r})=>({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),B(t.$$.fragment),i=D(),l=b("div"),B(s.$$.fragment),p(e,"class","col-sm-6"),p(l,"class","col-sm-6")},m(r,a){S(r,e,a),z(t,e,null),S(r,i,a),S(r,l,a),z(s,l,null),o=!0},p(r,a){const f={};a&2&&(f.name="schema."+r[1]+".options.minSelect"),a&83886081&&(f.$$scope={dirty:a,ctx:r}),t.$set(f);const u={};a&2&&(u.name="schema."+r[1]+".options.maxSelect"),a&83886081&&(u.$$scope={dirty:a,ctx:r}),s.$set(u)},i(r){o||(I(t.$$.fragment,r),I(s.$$.fragment,r),o=!0)},o(r){L(t.$$.fragment,r),L(s.$$.fragment,r),o=!1},d(r){r&&(w(e),w(i),w(l)),V(t),V(s)}}}function LC(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Min select"),l=D(),s=b("input"),p(e,"for",i=n[24]),p(s,"type","number"),p(s,"id",o=n[24]),p(s,"step","1"),p(s,"min","1"),p(s,"placeholder","No min limit")},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.minSelect),r||(a=Z(s,"input",n[11]),r=!0)},p(f,u){u&16777216&&i!==(i=f[24])&&p(e,"for",i),u&16777216&&o!==(o=f[24])&&p(s,"id",o),u&1&&lt(s.value)!==f[0].options.minSelect&&ae(s,f[0].options.minSelect)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function NC(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=J("Max select"),l=D(),s=b("input"),p(e,"for",i=n[24]),p(s,"type","number"),p(s,"id",o=n[24]),p(s,"step","1"),p(s,"placeholder","No max limit"),p(s,"min",r=n[0].options.minSelect||2)},m(u,c){S(u,e,c),y(e,t),S(u,l,c),S(u,s,c),ae(s,n[0].options.maxSelect),a||(f=Z(s,"input",n[12]),a=!0)},p(u,c){c&16777216&&i!==(i=u[24])&&p(e,"for",i),c&16777216&&o!==(o=u[24])&&p(s,"id",o),c&1&&r!==(r=u[0].options.minSelect||2)&&p(s,"min",r),c&1&&lt(s.value)!==u[0].options.maxSelect&&ae(s,u[0].options.maxSelect)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function PC(n){let e,t,i,l,s,o,r,a,f,u,c,d;function m(_){n[13](_)}let h={id:n[24],items:n[7]};return n[0].options.cascadeDelete!==void 0&&(h.keyOfSelected=n[0].options.cascadeDelete),a=new _i({props:h}),te.push(()=>ke(a,"keyOfSelected",m)),{c(){e=b("label"),t=b("span"),t.textContent="Cascade delete",i=D(),l=b("i"),r=D(),B(a.$$.fragment),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",o=n[24])},m(_,g){var v,$;S(_,e,g),y(e,t),y(e,i),y(e,l),S(_,r,g),z(a,_,g),u=!0,c||(d=$e(s=Fe.call(null,l,{text:[`Whether on ${((v=n[4])==null?void 0:v.name)||"relation"} record deletion to delete also the current corresponding collection record(s).`,n[2]?null:`For "Multiple" relation fields the cascade delete is triggered only when all ${(($=n[4])==null?void 0:$.name)||"relation"} ids are removed from the corresponding record.`].filter(Boolean).join(`
`),position:"top"})),c=!0)},p(_,g){var $,C;s&&Ot(s.update)&&g&20&&s.update.call(null,{text:[`Whether on ${(($=_[4])==null?void 0:$.name)||"relation"} record deletion to delete also the current corresponding collection record(s).`,_[2]?null:`For "Multiple" relation fields the cascade delete is triggered only when all ${((C=_[4])==null?void 0:C.name)||"relation"} ids are removed from the corresponding record.`].filter(Boolean).join(`
`),position:"top"}),(!u||g&16777216&&o!==(o=_[24]))&&p(e,"for",o);const v={};g&16777216&&(v.id=_[24]),!f&&g&1&&(f=!0,v.keyOfSelected=_[0].options.cascadeDelete,ye(()=>f=!1)),a.$set(v)},i(_){u||(I(a.$$.fragment,_),u=!0)},o(_){L(a.$$.fragment,_),u=!1},d(_){_&&(w(e),w(r)),V(a,_),c=!1,d()}}}function FC(n){let e,t,i,l,s,o=!n[2]&&Od(n);return l=new de({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[PC,({uniqueId:r})=>({24:r}),({uniqueId:r})=>r?16777216:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),o&&o.c(),t=D(),i=b("div"),B(l.$$.fragment),p(i,"class","col-sm-12"),p(e,"class","grid grid-sm")},m(r,a){S(r,e,a),o&&o.m(e,null),y(e,t),y(e,i),z(l,i,null),s=!0},p(r,a){r[2]?o&&(se(),L(o,1,1,()=>{o=null}),oe()):o?(o.p(r,a),a&4&&I(o,1)):(o=Od(r),o.c(),I(o,1),o.m(e,t));const f={};a&2&&(f.name="schema."+r[1]+".options.cascadeDelete"),a&83886101&&(f.$$scope={dirty:a,ctx:r}),l.$set(f)},i(r){s||(I(o),I(l.$$.fragment,r),s=!0)},o(r){L(o),L(l.$$.fragment,r),s=!1},d(r){r&&w(e),o&&o.d(),V(l)}}}function RC(n){let e,t,i,l,s;const o=[{key:n[1]},n[8]];function r(u){n[17](u)}let a={$$slots:{options:[FC],default:[AC,({interactive:u})=>({25:u}),({interactive:u})=>u?33554432:0]},$$scope:{ctx:n}};for(let u=0;u<o.length;u+=1)a=Ae(a,o[u]);n[0]!==void 0&&(a.field=n[0]),e=new oi({props:a}),te.push(()=>ke(e,"field",r)),e.$on("rename",n[18]),e.$on("remove",n[19]),e.$on("duplicate",n[20]);let f={};return l=new Ua({props:f}),n[21](l),l.$on("save",n[22]),{c(){B(e.$$.fragment),i=D(),B(l.$$.fragment)},m(u,c){z(e,u,c),S(u,i,c),z(l,u,c),s=!0},p(u,[c]){const d=c&258?mt(o,[c&2&&{key:u[1]},c&256&&Mt(u[8])]):{};c&100663359&&(d.$$scope={dirty:c,ctx:u}),!t&&c&1&&(t=!0,d.field=u[0],ye(()=>t=!1)),e.$set(d);const m={};l.$set(m)},i(u){s||(I(e.$$.fragment,u),I(l.$$.fragment,u),s=!0)},o(u){L(e.$$.fragment,u),L(l.$$.fragment,u),s=!1},d(u){u&&w(i),V(e,u),n[21](null),V(l,u)}}}function qC(n,e,t){var P;let i,l;const s=["field","key"];let o=Xe(e,s),r;We(n,qn,F=>t(10,r=F));let{field:a}=e,{key:f=""}=e;const u=[{label:"Single",value:!0},{label:"Multiple",value:!1}],c=[{label:"False",value:!1},{label:"True",value:!0}];let d=null,m=((P=a.options)==null?void 0:P.maxSelect)==1,h=m;function _(){t(0,a.options={maxSelect:1,collectionId:null,cascadeDelete:!1},a),t(2,m=!0),t(9,h=m)}function g(){a.options.minSelect=lt(this.value),t(0,a),t(9,h),t(2,m)}function v(){a.options.maxSelect=lt(this.value),t(0,a),t(9,h),t(2,m)}function $(F){n.$$.not_equal(a.options.cascadeDelete,F)&&(a.options.cascadeDelete=F,t(0,a),t(9,h),t(2,m))}const C=()=>d==null?void 0:d.show();function T(F){n.$$.not_equal(a.options.collectionId,F)&&(a.options.collectionId=F,t(0,a),t(9,h),t(2,m))}function O(F){m=F,t(2,m)}function M(F){a=F,t(0,a),t(9,h),t(2,m)}function E(F){Oe.call(this,n,F)}function A(F){Oe.call(this,n,F)}function N(F){Oe.call(this,n,F)}function q(F){te[F?"unshift":"push"](()=>{d=F,t(3,d)})}const R=F=>{var j,U;(U=(j=F==null?void 0:F.detail)==null?void 0:j.collection)!=null&&U.id&&F.detail.collection.type!="view"&&t(0,a.options.collectionId=F.detail.collection.id,a)};return n.$$set=F=>{e=Ae(Ae({},e),Kt(F)),t(8,o=Xe(e,s)),"field"in F&&t(0,a=F.field),"key"in F&&t(1,f=F.key)},n.$$.update=()=>{n.$$.dirty&1024&&t(5,i=r.filter(F=>F.type!="view")),n.$$.dirty&516&&h!=m&&(t(9,h=m),m?(t(0,a.options.minSelect=null,a),t(0,a.options.maxSelect=1,a)):t(0,a.options.maxSelect=null,a)),n.$$.dirty&1&&H.isEmpty(a.options)&&_(),n.$$.dirty&1025&&t(4,l=r.find(F=>F.id==a.options.collectionId)||null)},[a,f,m,d,l,i,u,c,o,h,r,g,v,$,C,T,O,M,E,A,N,q,R]}class jC extends be{constructor(e){super(),ge(this,e,qC,RC,he,{field:0,key:1})}}const HC=n=>({dragging:n&4,dragover:n&8}),Md=n=>({dragging:n[2],dragover:n[3]});function zC(n){let e,t,i,l,s;const o=n[10].default,r=St(o,n,n[9],Md);return{c(){e=b("div"),r&&r.c(),p(e,"draggable",t=!n[1]),p(e,"class","draggable svelte-28orm4"),ee(e,"dragging",n[2]),ee(e,"dragover",n[3])},m(a,f){S(a,e,f),r&&r.m(e,null),i=!0,l||(s=[Z(e,"dragover",Ue(n[11])),Z(e,"dragleave",Ue(n[12])),Z(e,"dragend",n[13]),Z(e,"dragstart",n[14]),Z(e,"drop",n[15])],l=!0)},p(a,[f]){r&&r.p&&(!i||f&524)&&Tt(r,o,a,a[9],i?$t(o,a[9],f,HC):Ct(a[9]),Md),(!i||f&2&&t!==(t=!a[1]))&&p(e,"draggable",t),(!i||f&4)&&ee(e,"dragging",a[2]),(!i||f&8)&&ee(e,"dragover",a[3])},i(a){i||(I(r,a),i=!0)},o(a){L(r,a),i=!1},d(a){a&&w(e),r&&r.d(a),l=!1,Te(s)}}}function VC(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let{index:o}=e,{list:r=[]}=e,{group:a="default"}=e,{disabled:f=!1}=e,{dragHandleClass:u=""}=e,c=!1,d=!1;function m(T,O){if(!(!T||f)){if(u&&!T.target.classList.contains(u)){t(3,d=!1),t(2,c=!1),T.preventDefault();return}t(2,c=!0),T.dataTransfer.effectAllowed="move",T.dataTransfer.dropEffect="move",T.dataTransfer.setData("text/plain",JSON.stringify({index:O,group:a})),s("drag",T)}}function h(T,O){if(t(3,d=!1),t(2,c=!1),!T||f)return;T.dataTransfer.dropEffect="move";let M={};try{M=JSON.parse(T.dataTransfer.getData("text/plain"))}catch{}if(M.group!=a)return;const E=M.index<<0;E<O?(r.splice(O+1,0,r[E]),r.splice(E,1)):(r.splice(O,0,r[E]),r.splice(E+1,1)),t(6,r),s("sort",{oldIndex:E,newIndex:O,list:r})}const _=()=>{t(3,d=!0)},g=()=>{t(3,d=!1)},v=()=>{t(3,d=!1),t(2,c=!1)},$=T=>m(T,o),C=T=>h(T,o);return n.$$set=T=>{"index"in T&&t(0,o=T.index),"list"in T&&t(6,r=T.list),"group"in T&&t(7,a=T.group),"disabled"in T&&t(1,f=T.disabled),"dragHandleClass"in T&&t(8,u=T.dragHandleClass),"$$scope"in T&&t(9,l=T.$$scope)},[o,f,c,d,m,h,r,a,u,l,i,_,g,v,$,C]}class Ds extends be{constructor(e){super(),ge(this,e,VC,zC,he,{index:0,list:6,group:7,disabled:1,dragHandleClass:8})}}function Dd(n,e,t){const i=n.slice();return i[19]=e[t],i[20]=e,i[21]=t,i}function Ed(n){let e,t,i,l,s,o,r,a;return{c(){e=J(`,
`),t=b("code"),t.textContent="username",i=J(` ,
`),l=b("code"),l.textContent="email",s=J(` ,
`),o=b("code"),o.textContent="emailVisibility",r=J(` ,
`),a=b("code"),a.textContent="verified",p(t,"class","txt-sm"),p(l,"class","txt-sm"),p(o,"class","txt-sm"),p(a,"class","txt-sm")},m(f,u){S(f,e,u),S(f,t,u),S(f,i,u),S(f,l,u),S(f,s,u),S(f,o,u),S(f,r,u),S(f,a,u)},d(f){f&&(w(e),w(t),w(i),w(l),w(s),w(o),w(r),w(a))}}}function BC(n){let e,t,i,l;function s(u){n[7](u,n[19],n[20],n[21])}function o(){return n[8](n[21])}function r(){return n[9](n[21])}var a=n[1][n[19].type];function f(u,c){let d={key:u[5](u[19])};return u[19]!==void 0&&(d.field=u[19]),{props:d}}return a&&(e=Et(a,f(n)),te.push(()=>ke(e,"field",s)),e.$on("remove",o),e.$on("duplicate",r),e.$on("rename",n[10])),{c(){e&&B(e.$$.fragment),i=D()},m(u,c){e&&z(e,u,c),S(u,i,c),l=!0},p(u,c){if(n=u,c&1&&a!==(a=n[1][n[19].type])){if(e){se();const d=e;L(d.$$.fragment,1,0,()=>{V(d,1)}),oe()}a?(e=Et(a,f(n)),te.push(()=>ke(e,"field",s)),e.$on("remove",o),e.$on("duplicate",r),e.$on("rename",n[10]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(a){const d={};c&1&&(d.key=n[5](n[19])),!t&&c&1&&(t=!0,d.field=n[19],ye(()=>t=!1)),e.$set(d)}},i(u){l||(e&&I(e.$$.fragment,u),l=!0)},o(u){e&&L(e.$$.fragment,u),l=!1},d(u){u&&w(i),e&&V(e,u)}}}function Id(n,e){let t,i,l,s;function o(a){e[11](a)}let r={index:e[21],disabled:e[19].toDelete||e[19].id&&e[19].system,dragHandleClass:"drag-handle-wrapper",$$slots:{default:[BC]},$$scope:{ctx:e}};return e[0].schema!==void 0&&(r.list=e[0].schema),i=new Ds({props:r}),te.push(()=>ke(i,"list",o)),i.$on("drag",e[12]),i.$on("sort",e[13]),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&1&&(u.index=e[21]),f&1&&(u.disabled=e[19].toDelete||e[19].id&&e[19].system),f&4194305&&(u.$$scope={dirty:f,ctx:e}),!l&&f&1&&(l=!0,u.list=e[0].schema,ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function UC(n){let e,t,i,l,s,o,r,a,f,u,c,d,m=[],h=new Map,_,g,v,$,C,T,O,M,E=n[0].type==="auth"&&Ed(),A=ce(n[0].schema);const N=P=>P[19];for(let P=0;P<A.length;P+=1){let F=Dd(n,A,P),j=N(F);h.set(j,m[P]=Id(j,F))}g=new O$({props:{class:"btn btn-block btn-outline"}}),g.$on("select",n[14]);function q(P){n[15](P)}let R={};return n[0]!==void 0&&(R.collection=n[0]),T=new S$({props:R}),te.push(()=>ke(T,"collection",q)),{c(){e=b("div"),t=b("p"),i=J(`System fields:
`),l=b("code"),l.textContent="id",s=J(` ,
`),o=b("code"),o.textContent="created",r=J(` ,
`),a=b("code"),a.textContent="updated",f=D(),E&&E.c(),u=J(`
.`),c=D(),d=b("div");for(let P=0;P<m.length;P+=1)m[P].c();_=D(),B(g.$$.fragment),v=D(),$=b("hr"),C=D(),B(T.$$.fragment),p(l,"class","txt-sm"),p(o,"class","txt-sm"),p(a,"class","txt-sm"),p(t,"class","txt-sm"),p(e,"class","block m-b-25"),p(d,"class","schema-fields")},m(P,F){S(P,e,F),y(e,t),y(t,i),y(t,l),y(t,s),y(t,o),y(t,r),y(t,a),y(t,f),E&&E.m(t,null),y(t,u),S(P,c,F),S(P,d,F);for(let j=0;j<m.length;j+=1)m[j]&&m[j].m(d,null);S(P,_,F),z(g,P,F),S(P,v,F),S(P,$,F),S(P,C,F),z(T,P,F),M=!0},p(P,[F]){P[0].type==="auth"?E||(E=Ed(),E.c(),E.m(t,u)):E&&(E.d(1),E=null),F&111&&(A=ce(P[0].schema),se(),m=ft(m,F,N,1,P,A,h,d,It,Id,null,Dd),oe());const j={};!O&&F&1&&(O=!0,j.collection=P[0],ye(()=>O=!1)),T.$set(j)},i(P){if(!M){for(let F=0;F<A.length;F+=1)I(m[F]);I(g.$$.fragment,P),I(T.$$.fragment,P),M=!0}},o(P){for(let F=0;F<m.length;F+=1)L(m[F]);L(g.$$.fragment,P),L(T.$$.fragment,P),M=!1},d(P){P&&(w(e),w(c),w(d),w(_),w(v),w($),w(C)),E&&E.d();for(let F=0;F<m.length;F+=1)m[F].d();V(g,P),V(T,P)}}}function WC(n,e,t){let i,{collection:l}=e;const s={text:Y$,number:eT,bool:iT,email:Bb,url:pT,editor:bT,date:NT,select:lC,json:cC,file:MC,relation:jC};function o(M){l.schema[M]&&(l.schema.splice(M,1),t(0,l))}function r(M){const E=l.schema[M];if(!E)return;E.onMountSelect=!1;const A=structuredClone(E);A.id="",A.name=f(A.name+"_copy"),A.onMountSelect=!0,l.schema.splice(M+1,0,A),t(0,l)}function a(M="text"){const E=H.initSchemaField({name:f(),type:M});E.onMountSelect=!0,l.schema.push(E),t(0,l)}function f(M="field"){var R;let E=M,A=2,N=((R=M.match(/\d+$/))==null?void 0:R[0])||"",q=N?M.substring(0,M.length-N.length):M;for(;u(E);)E=q+((N<<0)+A),A++;return E}function u(M){var E;return!!((E=l==null?void 0:l.schema)!=null&&E.find(A=>A.name===M))}function c(M){return i.findIndex(E=>E===M)}function d(M,E){var A,N;!((A=l==null?void 0:l.schema)!=null&&A.length)||M===E||!E||(N=l==null?void 0:l.schema)!=null&&N.find(q=>q.name==M&&!q.toDelete)||t(0,l.indexes=l.indexes.map(q=>H.replaceIndexColumn(q,M,E)),l)}function m(M,E,A,N){A[N]=M,t(0,l)}const h=M=>o(M),_=M=>r(M),g=M=>d(M.detail.oldName,M.detail.newName);function v(M){n.$$.not_equal(l.schema,M)&&(l.schema=M,t(0,l))}const $=M=>{if(!M.detail)return;const E=M.detail.target;E.style.opacity=0,setTimeout(()=>{var A;(A=E==null?void 0:E.style)==null||A.removeProperty("opacity")},0),M.detail.dataTransfer.setDragImage(E,0,0)},C=()=>{Gt({})},T=M=>a(M.detail);function O(M){l=M,t(0,l)}return n.$$set=M=>{"collection"in M&&t(0,l=M.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof l.schema>"u"&&t(0,l.schema=[],l),n.$$.dirty&1&&(i=l.schema.filter(M=>!M.toDelete)||[])},[l,s,o,r,a,c,d,m,h,_,g,v,$,C,T,O]}class YC extends be{constructor(e){super(),ge(this,e,WC,UC,he,{collection:0})}}const KC=n=>({isAdminOnly:n&512}),Ad=n=>({isAdminOnly:n[9]}),JC=n=>({isAdminOnly:n&512}),Ld=n=>({isAdminOnly:n[9]}),ZC=n=>({isAdminOnly:n&512}),Nd=n=>({isAdminOnly:n[9]});function GC(n){let e,t;return e=new de({props:{class:"form-field rule-field "+(n[4]?"requied":"")+" "+(n[9]?"disabled":""),name:n[3],$$slots:{default:[QC,({uniqueId:i})=>({18:i}),({uniqueId:i})=>i?262144:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&528&&(s.class="form-field rule-field "+(i[4]?"requied":"")+" "+(i[9]?"disabled":"")),l&8&&(s.name=i[3]),l&295655&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function XC(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","txt-center")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function Pd(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-lock-line"></i> <span class="txt">Set Admins only</span>',p(e,"type","button"),p(e,"class","btn btn-sm btn-transparent btn-hint lock-toggle svelte-1akuazq")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[11]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function Fd(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<small class="txt svelte-1akuazq">Unlock and set custom rule</small> <div class="icon svelte-1akuazq"><i class="ri-lock-unlock-line svelte-1akuazq"></i></div>',p(e,"type","button"),p(e,"class","unlock-overlay svelte-1akuazq"),p(e,"aria-label","Unlock and set custom rule")},m(o,r){S(o,e,r),i=!0,l||(s=Z(e,"click",n[10]),l=!0)},p:x,i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.98},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.98},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function QC(n){let e,t,i,l,s,o,r=n[9]?"- Admins only":"",a,f,u,c,d,m,h,_,g,v,$;const C=n[12].beforeLabel,T=St(C,n,n[15],Nd),O=n[12].afterLabel,M=St(O,n,n[15],Ld);let E=!n[9]&&Pd(n);function A(j){n[14](j)}var N=n[7];function q(j,U){let Y={id:j[18],baseCollection:j[1],disabled:j[9],placeholder:j[9]?"":j[5]};return j[0]!==void 0&&(Y.value=j[0]),{props:Y}}N&&(m=Et(N,q(n)),n[13](m),te.push(()=>ke(m,"value",A)));let R=n[9]&&Fd(n);const P=n[12].default,F=St(P,n,n[15],Ad);return{c(){e=b("div"),t=b("label"),T&&T.c(),i=D(),l=b("span"),s=J(n[2]),o=D(),a=J(r),f=D(),M&&M.c(),u=D(),E&&E.c(),d=D(),m&&B(m.$$.fragment),_=D(),R&&R.c(),g=D(),v=b("div"),F&&F.c(),p(l,"class","txt"),ee(l,"txt-hint",n[9]),p(t,"for",c=n[18]),p(e,"class","input-wrapper svelte-1akuazq"),p(v,"class","help-block")},m(j,U){S(j,e,U),y(e,t),T&&T.m(t,null),y(t,i),y(t,l),y(l,s),y(l,o),y(l,a),y(t,f),M&&M.m(t,null),y(t,u),E&&E.m(t,null),y(e,d),m&&z(m,e,null),y(e,_),R&&R.m(e,null),S(j,g,U),S(j,v,U),F&&F.m(v,null),$=!0},p(j,U){if(T&&T.p&&(!$||U&33280)&&Tt(T,C,j,j[15],$?$t(C,j[15],U,ZC):Ct(j[15]),Nd),(!$||U&4)&&re(s,j[2]),(!$||U&512)&&r!==(r=j[9]?"- Admins only":"")&&re(a,r),(!$||U&512)&&ee(l,"txt-hint",j[9]),M&&M.p&&(!$||U&33280)&&Tt(M,O,j,j[15],$?$t(O,j[15],U,JC):Ct(j[15]),Ld),j[9]?E&&(E.d(1),E=null):E?E.p(j,U):(E=Pd(j),E.c(),E.m(t,null)),(!$||U&262144&&c!==(c=j[18]))&&p(t,"for",c),U&128&&N!==(N=j[7])){if(m){se();const Y=m;L(Y.$$.fragment,1,0,()=>{V(Y,1)}),oe()}N?(m=Et(N,q(j)),j[13](m),te.push(()=>ke(m,"value",A)),B(m.$$.fragment),I(m.$$.fragment,1),z(m,e,_)):m=null}else if(N){const Y={};U&262144&&(Y.id=j[18]),U&2&&(Y.baseCollection=j[1]),U&512&&(Y.disabled=j[9]),U&544&&(Y.placeholder=j[9]?"":j[5]),!h&&U&1&&(h=!0,Y.value=j[0],ye(()=>h=!1)),m.$set(Y)}j[9]?R?(R.p(j,U),U&512&&I(R,1)):(R=Fd(j),R.c(),I(R,1),R.m(e,null)):R&&(se(),L(R,1,1,()=>{R=null}),oe()),F&&F.p&&(!$||U&33280)&&Tt(F,P,j,j[15],$?$t(P,j[15],U,KC):Ct(j[15]),Ad)},i(j){$||(I(T,j),I(M,j),m&&I(m.$$.fragment,j),I(R),I(F,j),$=!0)},o(j){L(T,j),L(M,j),m&&L(m.$$.fragment,j),L(R),L(F,j),$=!1},d(j){j&&(w(e),w(g),w(v)),T&&T.d(j),M&&M.d(j),E&&E.d(),n[13](null),m&&V(m),R&&R.d(),F&&F.d(j)}}}function xC(n){let e,t,i,l;const s=[XC,GC],o=[];function r(a,f){return a[8]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,[f]){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}let Rd;function e5(n,e,t){let i,{$$slots:l={},$$scope:s}=e,{collection:o=null}=e,{rule:r=null}=e,{label:a="Rule"}=e,{formKey:f="rule"}=e,{required:u=!1}=e,{placeholder:c="Leave empty to grant everyone access..."}=e,d=null,m=null,h=Rd,_=!1;g();async function g(){h||_||(t(8,_=!0),t(7,h=(await nt(()=>import("./FilterAutocompleteInput-BciXxpa7.js"),__vite__mapDeps([0,1]),import.meta.url)).default),Rd=h,t(8,_=!1))}async function v(){t(0,r=m||""),await xt(),d==null||d.focus()}async function $(){m=r,t(0,r=null)}function C(O){te[O?"unshift":"push"](()=>{d=O,t(6,d)})}function T(O){r=O,t(0,r)}return n.$$set=O=>{"collection"in O&&t(1,o=O.collection),"rule"in O&&t(0,r=O.rule),"label"in O&&t(2,a=O.label),"formKey"in O&&t(3,f=O.formKey),"required"in O&&t(4,u=O.required),"placeholder"in O&&t(5,c=O.placeholder),"$$scope"in O&&t(15,s=O.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=r===null)},[r,o,a,f,u,c,d,h,_,i,v,$,l,C,T,s]}class Tl extends be{constructor(e){super(),ge(this,e,e5,xC,he,{collection:1,rule:0,label:2,formKey:3,required:4,placeholder:5})}}function qd(n,e,t){const i=n.slice();return i[11]=e[t],i}function jd(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E,A,N=ce(n[2]),q=[];for(let R=0;R<N.length;R+=1)q[R]=Hd(qd(n,N,R));return{c(){e=b("div"),t=b("div"),i=b("div"),l=b("p"),l.textContent="The following record fields are available:",s=D(),o=b("div");for(let R=0;R<q.length;R+=1)q[R].c();r=D(),a=b("hr"),f=D(),u=b("p"),u.innerHTML="The request fields could be accessed with the special <em>@request</em> filter:",c=D(),d=b("div"),d.innerHTML="<code>@request.headers.*</code> <code>@request.query.*</code> <code>@request.data.*</code> <code>@request.auth.*</code>",m=D(),h=b("hr"),_=D(),g=b("p"),g.innerHTML="You could also add constraints and query other collections using the <em>@collection</em> filter:",v=D(),$=b("div"),$.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",C=D(),T=b("hr"),O=D(),M=b("p"),M.innerHTML=`Example rule:
<br/> <code>@request.auth.id != &quot;&quot; &amp;&amp; created &gt; &quot;2022-01-01 00:00:00&quot;</code>`,p(l,"class","m-b-0"),p(o,"class","inline-flex flex-gap-5"),p(a,"class","m-t-10 m-b-5"),p(u,"class","m-b-0"),p(d,"class","inline-flex flex-gap-5"),p(h,"class","m-t-10 m-b-5"),p(g,"class","m-b-0"),p($,"class","inline-flex flex-gap-5"),p(T,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(R,P){S(R,e,P),y(e,t),y(t,i),y(i,l),y(i,s),y(i,o);for(let F=0;F<q.length;F+=1)q[F]&&q[F].m(o,null);y(i,r),y(i,a),y(i,f),y(i,u),y(i,c),y(i,d),y(i,m),y(i,h),y(i,_),y(i,g),y(i,v),y(i,$),y(i,C),y(i,T),y(i,O),y(i,M),A=!0},p(R,P){if(P&4){N=ce(R[2]);let F;for(F=0;F<N.length;F+=1){const j=qd(R,N,F);q[F]?q[F].p(j,P):(q[F]=Hd(j),q[F].c(),q[F].m(o,null))}for(;F<q.length;F+=1)q[F].d(1);q.length=N.length}},i(R){A||(R&&Je(()=>{A&&(E||(E=Re(e,tt,{duration:150},!0)),E.run(1))}),A=!0)},o(R){R&&(E||(E=Re(e,tt,{duration:150},!1)),E.run(0)),A=!1},d(R){R&&w(e),rt(q,R),R&&E&&E.end()}}}function Hd(n){let e,t=n[11]+"",i;return{c(){e=b("code"),i=J(t)},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&4&&t!==(t=l[11]+"")&&re(i,t)},d(l){l&&w(e)}}}function zd(n){let e,t,i,l,s,o,r,a,f;function u(g){n[6](g)}let c={label:"Create rule",formKey:"createRule",collection:n[0],$$slots:{afterLabel:[t5,({isAdminOnly:g})=>({10:g}),({isAdminOnly:g})=>g?1024:0]},$$scope:{ctx:n}};n[0].createRule!==void 0&&(c.rule=n[0].createRule),e=new Tl({props:c}),te.push(()=>ke(e,"rule",u));function d(g){n[7](g)}let m={label:"Update rule",formKey:"updateRule",collection:n[0]};n[0].updateRule!==void 0&&(m.rule=n[0].updateRule),l=new Tl({props:m}),te.push(()=>ke(l,"rule",d));function h(g){n[8](g)}let _={label:"Delete rule",formKey:"deleteRule",collection:n[0]};return n[0].deleteRule!==void 0&&(_.rule=n[0].deleteRule),r=new Tl({props:_}),te.push(()=>ke(r,"rule",h)),{c(){B(e.$$.fragment),i=D(),B(l.$$.fragment),o=D(),B(r.$$.fragment)},m(g,v){z(e,g,v),S(g,i,v),z(l,g,v),S(g,o,v),z(r,g,v),f=!0},p(g,v){const $={};v&1&&($.collection=g[0]),v&17408&&($.$$scope={dirty:v,ctx:g}),!t&&v&1&&(t=!0,$.rule=g[0].createRule,ye(()=>t=!1)),e.$set($);const C={};v&1&&(C.collection=g[0]),!s&&v&1&&(s=!0,C.rule=g[0].updateRule,ye(()=>s=!1)),l.$set(C);const T={};v&1&&(T.collection=g[0]),!a&&v&1&&(a=!0,T.rule=g[0].deleteRule,ye(()=>a=!1)),r.$set(T)},i(g){f||(I(e.$$.fragment,g),I(l.$$.fragment,g),I(r.$$.fragment,g),f=!0)},o(g){L(e.$$.fragment,g),L(l.$$.fragment,g),L(r.$$.fragment,g),f=!1},d(g){g&&(w(i),w(o)),V(e,g),V(l,g),V(r,g)}}}function Vd(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-information-line link-hint")},m(l,s){S(l,e,s),t||(i=$e(Fe.call(null,e,{text:'The Create rule is executed after a "dry save" of the submitted data, giving you access to the main record fields as in every other rule.',position:"top"})),t=!0)},d(l){l&&w(e),t=!1,i()}}}function t5(n){let e,t=!n[10]&&Vd();return{c(){t&&t.c(),e=ve()},m(i,l){t&&t.m(i,l),S(i,e,l)},p(i,l){i[10]?t&&(t.d(1),t=null):t||(t=Vd(),t.c(),t.m(e.parentNode,e))},d(i){i&&w(e),t&&t.d(i)}}}function Bd(n){let e,t,i;function l(o){n[9](o)}let s={label:"Manage rule",formKey:"options.manageRule",placeholder:"",required:n[0].options.manageRule!==null,collection:n[0],$$slots:{default:[n5]},$$scope:{ctx:n}};return n[0].options.manageRule!==void 0&&(s.rule=n[0].options.manageRule),e=new Tl({props:s}),te.push(()=>ke(e,"rule",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&1&&(a.required=o[0].options.manageRule!==null),r&1&&(a.collection=o[0]),r&16384&&(a.$$scope={dirty:r,ctx:o}),!t&&r&1&&(t=!0,a.rule=o[0].options.manageRule,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function n5(n){let e,t,i;return{c(){e=b("p"),e.textContent=`This API rule gives admin-like permissions to allow fully managing the auth record(s), eg.
changing the password without requiring to enter the old one, directly updating the verified
state or email, etc.`,t=D(),i=b("p"),i.innerHTML="This rule is executed in addition to the <code>create</code> and <code>update</code> API rules."},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},p:x,d(l){l&&(w(e),w(t),w(i))}}}function i5(n){var P,F;let e,t,i,l,s,o=n[1]?"Hide available fields":"Show available fields",r,a,f,u,c,d,m,h,_,g,v,$,C,T,O=n[1]&&jd(n);function M(j){n[4](j)}let E={label:"List/Search rule",formKey:"listRule",collection:n[0]};n[0].listRule!==void 0&&(E.rule=n[0].listRule),u=new Tl({props:E}),te.push(()=>ke(u,"rule",M));function A(j){n[5](j)}let N={label:"View rule",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(N.rule=n[0].viewRule),m=new Tl({props:N}),te.push(()=>ke(m,"rule",A));let q=((P=n[0])==null?void 0:P.type)!=="view"&&zd(n),R=((F=n[0])==null?void 0:F.type)==="auth"&&Bd(n);return{c(){e=b("div"),t=b("div"),i=b("p"),i.innerHTML=`All rules follow the
<a href="https://pocketbase.io/docs/api-rules-and-filters/" target="_blank" rel="noopener noreferrer">PocketBase filter syntax and operators
</a>.`,l=D(),s=b("button"),r=J(o),a=D(),O&&O.c(),f=D(),B(u.$$.fragment),d=D(),B(m.$$.fragment),_=D(),q&&q.c(),g=D(),R&&R.c(),v=ve(),p(s,"type","button"),p(s,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),p(t,"class","flex txt-sm txt-hint m-b-5"),p(e,"class","block m-b-sm handle")},m(j,U){S(j,e,U),y(e,t),y(t,i),y(t,l),y(t,s),y(s,r),y(e,a),O&&O.m(e,null),S(j,f,U),z(u,j,U),S(j,d,U),z(m,j,U),S(j,_,U),q&&q.m(j,U),S(j,g,U),R&&R.m(j,U),S(j,v,U),$=!0,C||(T=Z(s,"click",n[3]),C=!0)},p(j,[U]){var W,K;(!$||U&2)&&o!==(o=j[1]?"Hide available fields":"Show available fields")&&re(r,o),j[1]?O?(O.p(j,U),U&2&&I(O,1)):(O=jd(j),O.c(),I(O,1),O.m(e,null)):O&&(se(),L(O,1,1,()=>{O=null}),oe());const Y={};U&1&&(Y.collection=j[0]),!c&&U&1&&(c=!0,Y.rule=j[0].listRule,ye(()=>c=!1)),u.$set(Y);const X={};U&1&&(X.collection=j[0]),!h&&U&1&&(h=!0,X.rule=j[0].viewRule,ye(()=>h=!1)),m.$set(X),((W=j[0])==null?void 0:W.type)!=="view"?q?(q.p(j,U),U&1&&I(q,1)):(q=zd(j),q.c(),I(q,1),q.m(g.parentNode,g)):q&&(se(),L(q,1,1,()=>{q=null}),oe()),((K=j[0])==null?void 0:K.type)==="auth"?R?(R.p(j,U),U&1&&I(R,1)):(R=Bd(j),R.c(),I(R,1),R.m(v.parentNode,v)):R&&(se(),L(R,1,1,()=>{R=null}),oe())},i(j){$||(I(O),I(u.$$.fragment,j),I(m.$$.fragment,j),I(q),I(R),$=!0)},o(j){L(O),L(u.$$.fragment,j),L(m.$$.fragment,j),L(q),L(R),$=!1},d(j){j&&(w(e),w(f),w(d),w(_),w(g),w(v)),O&&O.d(),V(u,j),V(m,j),q&&q.d(j),R&&R.d(j),C=!1,T()}}}function l5(n,e,t){let i,{collection:l}=e,s=!1;const o=()=>t(1,s=!s);function r(m){n.$$.not_equal(l.listRule,m)&&(l.listRule=m,t(0,l))}function a(m){n.$$.not_equal(l.viewRule,m)&&(l.viewRule=m,t(0,l))}function f(m){n.$$.not_equal(l.createRule,m)&&(l.createRule=m,t(0,l))}function u(m){n.$$.not_equal(l.updateRule,m)&&(l.updateRule=m,t(0,l))}function c(m){n.$$.not_equal(l.deleteRule,m)&&(l.deleteRule=m,t(0,l))}function d(m){n.$$.not_equal(l.options.manageRule,m)&&(l.options.manageRule=m,t(0,l))}return n.$$set=m=>{"collection"in m&&t(0,l=m.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=H.getAllCollectionIdentifiers(l))},[l,s,i,o,r,a,f,u,c,d]}class s5 extends be{constructor(e){super(),ge(this,e,l5,i5,he,{collection:0})}}function Ud(n,e,t){const i=n.slice();return i[9]=e[t],i}function o5(n){let e,t,i,l;function s(a){n[5](a)}var o=n[1];function r(a,f){let u={id:a[8],placeholder:"eg. SELECT id, name from posts",language:"sql-select",minHeight:"150"};return a[0].options.query!==void 0&&(u.value=a[0].options.query),{props:u}}return o&&(e=Et(o,r(n)),te.push(()=>ke(e,"value",s)),e.$on("change",n[6])),{c(){e&&B(e.$$.fragment),i=ve()},m(a,f){e&&z(e,a,f),S(a,i,f),l=!0},p(a,f){if(f&2&&o!==(o=a[1])){if(e){se();const u=e;L(u.$$.fragment,1,0,()=>{V(u,1)}),oe()}o?(e=Et(o,r(a)),te.push(()=>ke(e,"value",s)),e.$on("change",a[6]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const u={};f&256&&(u.id=a[8]),!t&&f&1&&(t=!0,u.value=a[0].options.query,ye(()=>t=!1)),e.$set(u)}},i(a){l||(e&&I(e.$$.fragment,a),l=!0)},o(a){e&&L(e.$$.fragment,a),l=!1},d(a){a&&w(i),e&&V(e,a)}}}function r5(n){let e;return{c(){e=b("textarea"),e.disabled=!0,p(e,"rows","7"),p(e,"placeholder","Loading...")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function Wd(n){let e,t,i=ce(n[3]),l=[];for(let s=0;s<i.length;s+=1)l[s]=Yd(Ud(n,i,s));return{c(){e=b("div"),t=b("div");for(let s=0;s<l.length;s+=1)l[s].c();p(t,"class","content"),p(e,"class","help-block help-block-error")},m(s,o){S(s,e,o),y(e,t);for(let r=0;r<l.length;r+=1)l[r]&&l[r].m(t,null)},p(s,o){if(o&8){i=ce(s[3]);let r;for(r=0;r<i.length;r+=1){const a=Ud(s,i,r);l[r]?l[r].p(a,o):(l[r]=Yd(a),l[r].c(),l[r].m(t,null))}for(;r<l.length;r+=1)l[r].d(1);l.length=i.length}},d(s){s&&w(e),rt(l,s)}}}function Yd(n){let e,t=n[9]+"",i;return{c(){e=b("p"),i=J(t)},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&8&&t!==(t=l[9]+"")&&re(i,t)},d(l){l&&w(e)}}}function a5(n){let e,t,i,l,s,o,r,a,f,u,c;const d=[r5,o5],m=[];function h(g,v){return g[2]?0:1}s=h(n),o=m[s]=d[s](n);let _=n[3].length&&Wd(n);return{c(){e=b("label"),t=b("span"),t.textContent="Select query",l=D(),o.c(),r=D(),a=b("div"),a.innerHTML=`<ul><li>Wildcard columns (<code>*</code>) are not supported.</li> <li>The query must have a unique <code>id</code> column.
<br/>
If your query doesn&#39;t have a suitable one, you can use the universal
<code>(ROW_NUMBER() OVER()) as id</code>.</li> <li>Expressions must be aliased with a valid formatted field name (eg.
<code>MAX(balance) as maxBalance</code>).</li></ul>`,f=D(),_&&_.c(),u=ve(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(g,v){S(g,e,v),y(e,t),S(g,l,v),m[s].m(g,v),S(g,r,v),S(g,a,v),S(g,f,v),_&&_.m(g,v),S(g,u,v),c=!0},p(g,v){(!c||v&256&&i!==(i=g[8]))&&p(e,"for",i);let $=s;s=h(g),s===$?m[s].p(g,v):(se(),L(m[$],1,1,()=>{m[$]=null}),oe(),o=m[s],o?o.p(g,v):(o=m[s]=d[s](g),o.c()),I(o,1),o.m(r.parentNode,r)),g[3].length?_?_.p(g,v):(_=Wd(g),_.c(),_.m(u.parentNode,u)):_&&(_.d(1),_=null)},i(g){c||(I(o),c=!0)},o(g){L(o),c=!1},d(g){g&&(w(e),w(l),w(r),w(a),w(f),w(u)),m[s].d(g),_&&_.d(g)}}}function f5(n){let e,t;return e=new de({props:{class:"form-field required "+(n[3].length?"error":""),name:"options.query",$$slots:{default:[a5,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&8&&(s.class="form-field required "+(i[3].length?"error":"")),l&4367&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function u5(n,e,t){let i;We(n,hi,c=>t(4,i=c));let{collection:l}=e,s,o=!1,r=[];function a(c){var h;t(3,r=[]);const d=H.getNestedVal(c,"schema",null);if(H.isEmpty(d))return;if(d!=null&&d.message){r.push(d==null?void 0:d.message);return}const m=H.extractColumnsFromQuery((h=l==null?void 0:l.options)==null?void 0:h.query);H.removeByValue(m,"id"),H.removeByValue(m,"created"),H.removeByValue(m,"updated");for(let _ in d)for(let g in d[_]){const v=d[_][g].message,$=m[_]||_;r.push(H.sentenize($+": "+v))}}zt(async()=>{t(2,o=!0);try{t(1,s=(await nt(()=>import("./CodeEditor-dWSAtOWY.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(c){console.warn(c)}t(2,o=!1)});function f(c){n.$$.not_equal(l.options.query,c)&&(l.options.query=c,t(0,l))}const u=()=>{r.length&&si("schema")};return n.$$set=c=>{"collection"in c&&t(0,l=c.collection)},n.$$.update=()=>{n.$$.dirty&16&&a(i)},[l,s,o,r,i,f,u]}class c5 extends be{constructor(e){super(),ge(this,e,u5,f5,he,{collection:0})}}const d5=n=>({active:n&1}),Kd=n=>({active:n[0]});function Jd(n){let e,t,i;const l=n[15].default,s=St(l,n,n[14],null);return{c(){e=b("div"),s&&s.c(),p(e,"class","accordion-content")},m(o,r){S(o,e,r),s&&s.m(e,null),i=!0},p(o,r){s&&s.p&&(!i||r&16384)&&Tt(s,l,o,o[14],i?$t(l,o[14],r,null):Ct(o[14]),null)},i(o){i||(I(s,o),o&&Je(()=>{i&&(t||(t=Re(e,tt,{duration:150},!0)),t.run(1))}),i=!0)},o(o){L(s,o),o&&(t||(t=Re(e,tt,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&w(e),s&&s.d(o),o&&t&&t.end()}}}function p5(n){let e,t,i,l,s,o,r;const a=n[15].header,f=St(a,n,n[14],Kd);let u=n[0]&&Jd(n);return{c(){e=b("div"),t=b("button"),f&&f.c(),i=D(),u&&u.c(),p(t,"type","button"),p(t,"class","accordion-header"),p(t,"draggable",n[2]),p(t,"aria-expanded",n[0]),ee(t,"interactive",n[3]),p(e,"class",l="accordion "+(n[7]?"drag-over":"")+" "+n[1]),ee(e,"active",n[0])},m(c,d){S(c,e,d),y(e,t),f&&f.m(t,null),y(e,i),u&&u.m(e,null),n[22](e),s=!0,o||(r=[Z(t,"click",Ue(n[17])),Z(t,"drop",Ue(n[18])),Z(t,"dragstart",n[19]),Z(t,"dragenter",n[20]),Z(t,"dragleave",n[21]),Z(t,"dragover",Ue(n[16]))],o=!0)},p(c,[d]){f&&f.p&&(!s||d&16385)&&Tt(f,a,c,c[14],s?$t(a,c[14],d,d5):Ct(c[14]),Kd),(!s||d&4)&&p(t,"draggable",c[2]),(!s||d&1)&&p(t,"aria-expanded",c[0]),(!s||d&8)&&ee(t,"interactive",c[3]),c[0]?u?(u.p(c,d),d&1&&I(u,1)):(u=Jd(c),u.c(),I(u,1),u.m(e,null)):u&&(se(),L(u,1,1,()=>{u=null}),oe()),(!s||d&130&&l!==(l="accordion "+(c[7]?"drag-over":"")+" "+c[1]))&&p(e,"class",l),(!s||d&131)&&ee(e,"active",c[0])},i(c){s||(I(f,c),I(u),s=!0)},o(c){L(f,c),L(u),s=!1},d(c){c&&w(e),f&&f.d(c),u&&u.d(),n[22](null),o=!1,Te(r)}}}function m5(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let o,r,{class:a=""}=e,{draggable:f=!1}=e,{active:u=!1}=e,{interactive:c=!0}=e,{single:d=!1}=e,m=!1;function h(){return!!u}function _(){$(),t(0,u=!0),s("expand")}function g(){t(0,u=!1),clearTimeout(r),s("collapse")}function v(){s("toggle"),u?g():_()}function $(){if(d&&o.closest(".accordions")){const q=o.closest(".accordions").querySelectorAll(".accordion.active .accordion-header.interactive");for(const R of q)R.click()}}zt(()=>()=>clearTimeout(r));function C(q){Oe.call(this,n,q)}const T=()=>c&&v(),O=q=>{f&&(t(7,m=!1),$(),s("drop",q))},M=q=>f&&s("dragstart",q),E=q=>{f&&(t(7,m=!0),s("dragenter",q))},A=q=>{f&&(t(7,m=!1),s("dragleave",q))};function N(q){te[q?"unshift":"push"](()=>{o=q,t(6,o)})}return n.$$set=q=>{"class"in q&&t(1,a=q.class),"draggable"in q&&t(2,f=q.draggable),"active"in q&&t(0,u=q.active),"interactive"in q&&t(3,c=q.interactive),"single"in q&&t(9,d=q.single),"$$scope"in q&&t(14,l=q.$$scope)},n.$$.update=()=>{n.$$.dirty&8257&&u&&(clearTimeout(r),t(13,r=setTimeout(()=>{o!=null&&o.scrollIntoViewIfNeeded?o.scrollIntoViewIfNeeded():o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},200)))},[u,a,f,c,v,$,o,m,s,d,h,_,g,r,l,i,C,T,O,M,E,A,N]}class _o extends be{constructor(e){super(),ge(this,e,m5,p5,he,{class:1,draggable:2,active:0,interactive:3,single:9,isExpanded:10,expand:11,collapse:12,toggle:4,collapseSiblings:5})}get isExpanded(){return this.$$.ctx[10]}get expand(){return this.$$.ctx[11]}get collapse(){return this.$$.ctx[12]}get toggle(){return this.$$.ctx[4]}get collapseSiblings(){return this.$$.ctx[5]}}function h5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){S(f,e,u),e.checked=n[0].options.allowUsernameAuth,S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[5]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowUsernameAuth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function _5(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowUsernameAuth",$$slots:{default:[h5,({uniqueId:i})=>({13:i}),({uniqueId:i})=>i?8192:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&24577&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function g5(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function b5(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Zd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,l||(s=$e(Fe.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function k5(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowUsernameAuth?b5:g5}let a=r(n),f=a(n),u=n[3]&&Zd();return{c(){e=b("div"),e.innerHTML='<i class="ri-user-star-line"></i> <span class="txt">Username/Password</span>',t=D(),i=b("div"),l=D(),f.c(),s=D(),u&&u.c(),o=ve(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){S(c,e,d),S(c,t,d),S(c,i,d),S(c,l,d),f.m(c,d),S(c,s,d),u&&u.m(c,d),S(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[3]?u?d&8&&I(u,1):(u=Zd(),u.c(),I(u,1),u.m(o.parentNode,o)):u&&(se(),L(u,1,1,()=>{u=null}),oe())},d(c){c&&(w(e),w(t),w(i),w(l),w(s),w(o)),f.d(c),u&&u.d(c)}}}function y5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){S(f,e,u),e.checked=n[0].options.allowEmailAuth,S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[6]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowEmailAuth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function Gd(n){let e,t,i,l,s,o,r,a;return i=new de({props:{class:"form-field "+(H.isEmpty(n[0].options.onlyEmailDomains)?"":"disabled"),name:"options.exceptEmailDomains",$$slots:{default:[v5,({uniqueId:f})=>({13:f}),({uniqueId:f})=>f?8192:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field "+(H.isEmpty(n[0].options.exceptEmailDomains)?"":"disabled"),name:"options.onlyEmailDomains",$$slots:{default:[w5,({uniqueId:f})=>({13:f}),({uniqueId:f})=>f?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(e,"class","grid grid-sm p-t-sm")},m(f,u){S(f,e,u),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),a=!0},p(f,u){const c={};u&1&&(c.class="form-field "+(H.isEmpty(f[0].options.onlyEmailDomains)?"":"disabled")),u&24577&&(c.$$scope={dirty:u,ctx:f}),i.$set(c);const d={};u&1&&(d.class="form-field "+(H.isEmpty(f[0].options.exceptEmailDomains)?"":"disabled")),u&24577&&(d.$$scope={dirty:u,ctx:f}),o.$set(d)},i(f){a||(I(i.$$.fragment,f),I(o.$$.fragment,f),f&&Je(()=>{a&&(r||(r=Re(e,tt,{duration:150},!0)),r.run(1))}),a=!0)},o(f){L(i.$$.fragment,f),L(o.$$.fragment,f),f&&(r||(r=Re(e,tt,{duration:150},!1)),r.run(0)),a=!1},d(f){f&&w(e),V(i),V(o),f&&r&&r.end()}}}function v5(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[7](g)}let _={id:n[13],disabled:!H.isEmpty(n[0].options.onlyEmailDomains)};return n[0].options.exceptEmailDomains!==void 0&&(_.value=n[0].options.exceptEmailDomains),r=new Pl({props:_}),te.push(()=>ke(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Except domains",i=D(),l=b("i"),o=D(),B(r.$$.fragment),f=D(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13]),p(u,"class","help-block")},m(g,v){S(g,e,v),y(e,t),y(e,i),y(e,l),S(g,o,v),z(r,g,v),S(g,f,v),S(g,u,v),c=!0,d||(m=$e(Fe.call(null,l,{text:`Email domains that are NOT allowed to sign up.
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(g,v){(!c||v&8192&&s!==(s=g[13]))&&p(e,"for",s);const $={};v&8192&&($.id=g[13]),v&1&&($.disabled=!H.isEmpty(g[0].options.onlyEmailDomains)),!a&&v&1&&(a=!0,$.value=g[0].options.exceptEmailDomains,ye(()=>a=!1)),r.$set($)},i(g){c||(I(r.$$.fragment,g),c=!0)},o(g){L(r.$$.fragment,g),c=!1},d(g){g&&(w(e),w(o),w(f),w(u)),V(r,g),d=!1,m()}}}function w5(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[8](g)}let _={id:n[13],disabled:!H.isEmpty(n[0].options.exceptEmailDomains)};return n[0].options.onlyEmailDomains!==void 0&&(_.value=n[0].options.onlyEmailDomains),r=new Pl({props:_}),te.push(()=>ke(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=D(),l=b("i"),o=D(),B(r.$$.fragment),f=D(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13]),p(u,"class","help-block")},m(g,v){S(g,e,v),y(e,t),y(e,i),y(e,l),S(g,o,v),z(r,g,v),S(g,f,v),S(g,u,v),c=!0,d||(m=$e(Fe.call(null,l,{text:`Email domains that are ONLY allowed to sign up.
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(g,v){(!c||v&8192&&s!==(s=g[13]))&&p(e,"for",s);const $={};v&8192&&($.id=g[13]),v&1&&($.disabled=!H.isEmpty(g[0].options.exceptEmailDomains)),!a&&v&1&&(a=!0,$.value=g[0].options.onlyEmailDomains,ye(()=>a=!1)),r.$set($)},i(g){c||(I(r.$$.fragment,g),c=!0)},o(g){L(r.$$.fragment,g),c=!1},d(g){g&&(w(e),w(o),w(f),w(u)),V(r,g),d=!1,m()}}}function S5(n){let e,t,i,l;e=new de({props:{class:"form-field form-field-toggle m-0",name:"options.allowEmailAuth",$$slots:{default:[y5,({uniqueId:o})=>({13:o}),({uniqueId:o})=>o?8192:0]},$$scope:{ctx:n}}});let s=n[0].options.allowEmailAuth&&Gd(n);return{c(){B(e.$$.fragment),t=D(),s&&s.c(),i=ve()},m(o,r){z(e,o,r),S(o,t,r),s&&s.m(o,r),S(o,i,r),l=!0},p(o,r){const a={};r&24577&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowEmailAuth?s?(s.p(o,r),r&1&&I(s,1)):(s=Gd(o),s.c(),I(s,1),s.m(i.parentNode,i)):s&&(se(),L(s,1,1,()=>{s=null}),oe())},i(o){l||(I(e.$$.fragment,o),I(s),l=!0)},o(o){L(e.$$.fragment,o),L(s),l=!1},d(o){o&&(w(t),w(i)),V(e,o),s&&s.d(o)}}}function $5(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function T5(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Xd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,l||(s=$e(Fe.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function C5(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowEmailAuth?T5:$5}let a=r(n),f=a(n),u=n[2]&&Xd();return{c(){e=b("div"),e.innerHTML='<i class="ri-mail-star-line"></i> <span class="txt">Email/Password</span>',t=D(),i=b("div"),l=D(),f.c(),s=D(),u&&u.c(),o=ve(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){S(c,e,d),S(c,t,d),S(c,i,d),S(c,l,d),f.m(c,d),S(c,s,d),u&&u.m(c,d),S(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[2]?u?d&4&&I(u,1):(u=Xd(),u.c(),I(u,1),u.m(o.parentNode,o)):u&&(se(),L(u,1,1,()=>{u=null}),oe())},d(c){c&&(w(e),w(t),w(i),w(l),w(s),w(o)),f.d(c),u&&u.d(c)}}}function O5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){S(f,e,u),e.checked=n[0].options.allowOAuth2Auth,S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[9]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowOAuth2Auth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function Qd(n){let e,t,i;return{c(){e=b("div"),e.innerHTML='<div class="flex p-t-base"><a href="#/settings/auth-providers" target="_blank" class="btn btn-sm btn-outline"><span class="txt">Manage OAuth2 providers</span></a></div>',p(e,"class","block")},m(l,s){S(l,e,s),i=!0},i(l){i||(l&&Je(()=>{i&&(t||(t=Re(e,tt,{duration:150},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Re(e,tt,{duration:150},!1)),t.run(0)),i=!1},d(l){l&&w(e),l&&t&&t.end()}}}function M5(n){let e,t,i,l;e=new de({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowOAuth2Auth",$$slots:{default:[O5,({uniqueId:o})=>({13:o}),({uniqueId:o})=>o?8192:0]},$$scope:{ctx:n}}});let s=n[0].options.allowOAuth2Auth&&Qd();return{c(){B(e.$$.fragment),t=D(),s&&s.c(),i=ve()},m(o,r){z(e,o,r),S(o,t,r),s&&s.m(o,r),S(o,i,r),l=!0},p(o,r){const a={};r&24577&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowOAuth2Auth?s?r&1&&I(s,1):(s=Qd(),s.c(),I(s,1),s.m(i.parentNode,i)):s&&(se(),L(s,1,1,()=>{s=null}),oe())},i(o){l||(I(e.$$.fragment,o),I(s),l=!0)},o(o){L(e.$$.fragment,o),L(s),l=!1},d(o){o&&(w(t),w(i)),V(e,o),s&&s.d(o)}}}function D5(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function E5(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function xd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,l||(s=$e(Fe.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function I5(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowOAuth2Auth?E5:D5}let a=r(n),f=a(n),u=n[1]&&xd();return{c(){e=b("div"),e.innerHTML='<i class="ri-shield-star-line"></i> <span class="txt">OAuth2</span>',t=D(),i=b("div"),l=D(),f.c(),s=D(),u&&u.c(),o=ve(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){S(c,e,d),S(c,t,d),S(c,i,d),S(c,l,d),f.m(c,d),S(c,s,d),u&&u.m(c,d),S(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[1]?u?d&2&&I(u,1):(u=xd(),u.c(),I(u,1),u.m(o.parentNode,o)):u&&(se(),L(u,1,1,()=>{u=null}),oe())},d(c){c&&(w(e),w(t),w(i),w(l),w(s),w(o)),f.d(c),u&&u.d(c)}}}function A5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Minimum password length"),l=D(),s=b("input"),p(e,"for",i=n[13]),p(s,"type","number"),p(s,"id",o=n[13]),s.required=!0,p(s,"min","6"),p(s,"max","72")},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].options.minPasswordLength),r||(a=Z(s,"input",n[10]),r=!0)},p(f,u){u&8192&&i!==(i=f[13])&&p(e,"for",i),u&8192&&o!==(o=f[13])&&p(s,"id",o),u&1&&lt(s.value)!==f[0].options.minPasswordLength&&ae(s,f[0].options.minPasswordLength)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function L5(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Always require email",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(s,"class","txt"),p(r,"class","ri-information-line txt-sm link-hint"),p(l,"for",a=n[13])},m(c,d){S(c,e,d),e.checked=n[0].options.requireEmail,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[11]),$e(Fe.call(null,r,{text:`The constraint is applied only for new records.
Also note that some OAuth2 providers (like Twitter), don't return an email and the authentication may fail if the email field is required.`,position:"right"}))],f=!0)},p(c,d){d&8192&&t!==(t=c[13])&&p(e,"id",t),d&1&&(e.checked=c[0].options.requireEmail),d&8192&&a!==(a=c[13])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function N5(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Forbid authentication for unverified users",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(s,"class","txt"),p(r,"class","ri-information-line txt-sm link-hint"),p(l,"for",a=n[13])},m(c,d){S(c,e,d),e.checked=n[0].options.onlyVerified,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[12]),$e(Fe.call(null,r,{text:["If enabled, it returns 403 for new unverified user authentication requests.","If you need more granular control, don't enable this option and instead use the `@request.auth.verified = true` rule in the specific collection(s) you are targeting."].join(`
`),position:"right"}))],f=!0)},p(c,d){d&8192&&t!==(t=c[13])&&p(e,"id",t),d&1&&(e.checked=c[0].options.onlyVerified),d&8192&&a!==(a=c[13])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function P5(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C;return l=new _o({props:{single:!0,$$slots:{header:[k5],default:[_5]},$$scope:{ctx:n}}}),o=new _o({props:{single:!0,$$slots:{header:[C5],default:[S5]},$$scope:{ctx:n}}}),a=new _o({props:{single:!0,$$slots:{header:[I5],default:[M5]},$$scope:{ctx:n}}}),h=new de({props:{class:"form-field required",name:"options.minPasswordLength",$$slots:{default:[A5,({uniqueId:T})=>({13:T}),({uniqueId:T})=>T?8192:0]},$$scope:{ctx:n}}}),g=new de({props:{class:"form-field form-field-toggle m-b-sm",name:"options.requireEmail",$$slots:{default:[L5,({uniqueId:T})=>({13:T}),({uniqueId:T})=>T?8192:0]},$$scope:{ctx:n}}}),$=new de({props:{class:"form-field form-field-toggle m-b-sm",name:"options.onlyVerified",$$slots:{default:[N5,({uniqueId:T})=>({13:T}),({uniqueId:T})=>T?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("h4"),e.textContent="Auth methods",t=D(),i=b("div"),B(l.$$.fragment),s=D(),B(o.$$.fragment),r=D(),B(a.$$.fragment),f=D(),u=b("hr"),c=D(),d=b("h4"),d.textContent="General",m=D(),B(h.$$.fragment),_=D(),B(g.$$.fragment),v=D(),B($.$$.fragment),p(e,"class","section-title"),p(i,"class","accordions"),p(d,"class","section-title")},m(T,O){S(T,e,O),S(T,t,O),S(T,i,O),z(l,i,null),y(i,s),z(o,i,null),y(i,r),z(a,i,null),S(T,f,O),S(T,u,O),S(T,c,O),S(T,d,O),S(T,m,O),z(h,T,O),S(T,_,O),z(g,T,O),S(T,v,O),z($,T,O),C=!0},p(T,[O]){const M={};O&16393&&(M.$$scope={dirty:O,ctx:T}),l.$set(M);const E={};O&16389&&(E.$$scope={dirty:O,ctx:T}),o.$set(E);const A={};O&16387&&(A.$$scope={dirty:O,ctx:T}),a.$set(A);const N={};O&24577&&(N.$$scope={dirty:O,ctx:T}),h.$set(N);const q={};O&24577&&(q.$$scope={dirty:O,ctx:T}),g.$set(q);const R={};O&24577&&(R.$$scope={dirty:O,ctx:T}),$.$set(R)},i(T){C||(I(l.$$.fragment,T),I(o.$$.fragment,T),I(a.$$.fragment,T),I(h.$$.fragment,T),I(g.$$.fragment,T),I($.$$.fragment,T),C=!0)},o(T){L(l.$$.fragment,T),L(o.$$.fragment,T),L(a.$$.fragment,T),L(h.$$.fragment,T),L(g.$$.fragment,T),L($.$$.fragment,T),C=!1},d(T){T&&(w(e),w(t),w(i),w(f),w(u),w(c),w(d),w(m),w(_),w(v)),V(l),V(o),V(a),V(h,T),V(g,T),V($,T)}}}function F5(n,e,t){let i,l,s,o;We(n,hi,g=>t(4,o=g));let{collection:r}=e;function a(){r.options.allowUsernameAuth=this.checked,t(0,r)}function f(){r.options.allowEmailAuth=this.checked,t(0,r)}function u(g){n.$$.not_equal(r.options.exceptEmailDomains,g)&&(r.options.exceptEmailDomains=g,t(0,r))}function c(g){n.$$.not_equal(r.options.onlyEmailDomains,g)&&(r.options.onlyEmailDomains=g,t(0,r))}function d(){r.options.allowOAuth2Auth=this.checked,t(0,r)}function m(){r.options.minPasswordLength=lt(this.value),t(0,r)}function h(){r.options.requireEmail=this.checked,t(0,r)}function _(){r.options.onlyVerified=this.checked,t(0,r)}return n.$$set=g=>{"collection"in g&&t(0,r=g.collection)},n.$$.update=()=>{var g,v,$,C;n.$$.dirty&1&&r.type==="auth"&&H.isEmpty(r.options)&&t(0,r.options={allowEmailAuth:!0,allowUsernameAuth:!0,allowOAuth2Auth:!0,minPasswordLength:8},r),n.$$.dirty&16&&t(2,l=!H.isEmpty((g=o==null?void 0:o.options)==null?void 0:g.allowEmailAuth)||!H.isEmpty((v=o==null?void 0:o.options)==null?void 0:v.onlyEmailDomains)||!H.isEmpty(($=o==null?void 0:o.options)==null?void 0:$.exceptEmailDomains)),n.$$.dirty&16&&t(1,s=!H.isEmpty((C=o==null?void 0:o.options)==null?void 0:C.allowOAuth2Auth))},t(3,i=!1),[r,s,l,i,o,a,f,u,c,d,m,h,_]}class R5 extends be{constructor(e){super(),ge(this,e,F5,P5,he,{collection:0})}}function ep(n,e,t){const i=n.slice();return i[18]=e[t],i}function tp(n,e,t){const i=n.slice();return i[18]=e[t],i}function np(n,e,t){const i=n.slice();return i[18]=e[t],i}function ip(n){let e;return{c(){e=b("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function lp(n){let e,t,i,l,s=n[3]&&sp(n),o=!n[4]&&op(n);return{c(){e=b("h6"),e.textContent="Changes:",t=D(),i=b("ul"),s&&s.c(),l=D(),o&&o.c(),p(i,"class","changes-list svelte-xqpcsf")},m(r,a){S(r,e,a),S(r,t,a),S(r,i,a),s&&s.m(i,null),y(i,l),o&&o.m(i,null)},p(r,a){r[3]?s?s.p(r,a):(s=sp(r),s.c(),s.m(i,l)):s&&(s.d(1),s=null),r[4]?o&&(o.d(1),o=null):o?o.p(r,a):(o=op(r),o.c(),o.m(i,null))},d(r){r&&(w(e),w(t),w(i)),s&&s.d(),o&&o.d()}}}function sp(n){var m,h;let e,t,i,l,s=((m=n[1])==null?void 0:m.name)+"",o,r,a,f,u,c=((h=n[2])==null?void 0:h.name)+"",d;return{c(){e=b("li"),t=b("div"),i=J(`Renamed collection
`),l=b("strong"),o=J(s),r=D(),a=b("i"),f=D(),u=b("strong"),d=J(c),p(l,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(u,"class","txt"),p(t,"class","inline-flex"),p(e,"class","svelte-xqpcsf")},m(_,g){S(_,e,g),y(e,t),y(t,i),y(t,l),y(l,o),y(t,r),y(t,a),y(t,f),y(t,u),y(u,d)},p(_,g){var v,$;g&2&&s!==(s=((v=_[1])==null?void 0:v.name)+"")&&re(o,s),g&4&&c!==(c=(($=_[2])==null?void 0:$.name)+"")&&re(d,c)},d(_){_&&w(e)}}}function op(n){let e,t,i,l=ce(n[6]),s=[];for(let u=0;u<l.length;u+=1)s[u]=rp(np(n,l,u));let o=ce(n[8]),r=[];for(let u=0;u<o.length;u+=1)r[u]=ap(tp(n,o,u));let a=ce(n[7]),f=[];for(let u=0;u<a.length;u+=1)f[u]=fp(ep(n,a,u));return{c(){for(let u=0;u<s.length;u+=1)s[u].c();e=D();for(let u=0;u<r.length;u+=1)r[u].c();t=D();for(let u=0;u<f.length;u+=1)f[u].c();i=ve()},m(u,c){for(let d=0;d<s.length;d+=1)s[d]&&s[d].m(u,c);S(u,e,c);for(let d=0;d<r.length;d+=1)r[d]&&r[d].m(u,c);S(u,t,c);for(let d=0;d<f.length;d+=1)f[d]&&f[d].m(u,c);S(u,i,c)},p(u,c){if(c&64){l=ce(u[6]);let d;for(d=0;d<l.length;d+=1){const m=np(u,l,d);s[d]?s[d].p(m,c):(s[d]=rp(m),s[d].c(),s[d].m(e.parentNode,e))}for(;d<s.length;d+=1)s[d].d(1);s.length=l.length}if(c&256){o=ce(u[8]);let d;for(d=0;d<o.length;d+=1){const m=tp(u,o,d);r[d]?r[d].p(m,c):(r[d]=ap(m),r[d].c(),r[d].m(t.parentNode,t))}for(;d<r.length;d+=1)r[d].d(1);r.length=o.length}if(c&128){a=ce(u[7]);let d;for(d=0;d<a.length;d+=1){const m=ep(u,a,d);f[d]?f[d].p(m,c):(f[d]=fp(m),f[d].c(),f[d].m(i.parentNode,i))}for(;d<f.length;d+=1)f[d].d(1);f.length=a.length}},d(u){u&&(w(e),w(t),w(i)),rt(s,u),rt(r,u),rt(f,u)}}}function rp(n){let e,t,i,l=n[18].name+"",s,o,r;return{c(){e=b("li"),t=J(`Multiple to single value conversion of field
`),i=b("strong"),s=J(l),o=D(),r=b("em"),r.textContent="(will keep only the last array item)",p(r,"class","txt-sm"),p(e,"class","svelte-xqpcsf")},m(a,f){S(a,e,f),y(e,t),y(e,i),y(i,s),y(e,o),y(e,r)},p(a,f){f&64&&l!==(l=a[18].name+"")&&re(s,l)},d(a){a&&w(e)}}}function ap(n){let e,t,i,l,s=n[18].originalName+"",o,r,a,f,u,c=n[18].name+"",d;return{c(){e=b("li"),t=b("div"),i=J(`Renamed field
`),l=b("strong"),o=J(s),r=D(),a=b("i"),f=D(),u=b("strong"),d=J(c),p(l,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(u,"class","txt"),p(t,"class","inline-flex"),p(e,"class","svelte-xqpcsf")},m(m,h){S(m,e,h),y(e,t),y(t,i),y(t,l),y(l,o),y(t,r),y(t,a),y(t,f),y(t,u),y(u,d)},p(m,h){h&256&&s!==(s=m[18].originalName+"")&&re(o,s),h&256&&c!==(c=m[18].name+"")&&re(d,c)},d(m){m&&w(e)}}}function fp(n){let e,t,i,l=n[18].name+"",s,o;return{c(){e=b("li"),t=J("Removed field "),i=b("span"),s=J(l),o=D(),p(i,"class","txt-bold"),p(e,"class","txt-danger svelte-xqpcsf")},m(r,a){S(r,e,a),y(e,t),y(e,i),y(i,s),y(e,o)},p(r,a){a&128&&l!==(l=r[18].name+"")&&re(s,l)},d(r){r&&w(e)}}}function q5(n){let e,t,i,l,s,o,r,a,f=n[7].length&&ip(),u=n[9]&&lp(n);return{c(){e=b("div"),t=b("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=D(),l=b("div"),s=b("p"),s.textContent=`If any of the collection changes is part of another collection rule, filter or view query,
you'll have to update it manually!`,o=D(),f&&f.c(),r=D(),u&&u.c(),a=ve(),p(t,"class","icon"),p(l,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),y(l,s),y(l,o),f&&f.m(l,null),S(c,r,d),u&&u.m(c,d),S(c,a,d)},p(c,d){c[7].length?f||(f=ip(),f.c(),f.m(l,null)):f&&(f.d(1),f=null),c[9]?u?u.p(c,d):(u=lp(c),u.c(),u.m(a.parentNode,a)):u&&(u.d(1),u=null)},d(c){c&&(w(e),w(r),w(a)),f&&f.d(),u&&u.d(c)}}}function j5(n){let e;return{c(){e=b("h4"),e.textContent="Confirm collection changes"},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function H5(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Cancel</span>',t=D(),i=b("button"),i.innerHTML='<span class="txt">Confirm</span>',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent"),p(i,"type","button"),p(i,"class","btn btn-expanded")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),e.focus(),l||(s=[Z(e,"click",n[12]),Z(i,"click",n[13])],l=!0)},p:x,d(o){o&&(w(e),w(t),w(i)),l=!1,Te(s)}}}function z5(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[H5],header:[j5],default:[q5]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[14](e),e.$on("hide",n[15]),e.$on("show",n[16]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&33555422&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[14](null),V(e,l)}}}function V5(n,e,t){let i,l,s,o,r,a;const f=st();let u,c,d;async function m(O,M){t(1,c=O),t(2,d=M),await xt(),i||s.length||o.length||r.length?u==null||u.show():_()}function h(){u==null||u.hide()}function _(){h(),f("confirm")}const g=()=>h(),v=()=>_();function $(O){te[O?"unshift":"push"](()=>{u=O,t(5,u)})}function C(O){Oe.call(this,n,O)}function T(O){Oe.call(this,n,O)}return n.$$.update=()=>{var O,M,E;n.$$.dirty&6&&t(3,i=(c==null?void 0:c.name)!=(d==null?void 0:d.name)),n.$$.dirty&4&&t(4,l=(d==null?void 0:d.type)==="view"),n.$$.dirty&4&&t(8,s=((O=d==null?void 0:d.schema)==null?void 0:O.filter(A=>A.id&&!A.toDelete&&A.originalName!=A.name))||[]),n.$$.dirty&4&&t(7,o=((M=d==null?void 0:d.schema)==null?void 0:M.filter(A=>A.id&&A.toDelete))||[]),n.$$.dirty&6&&t(6,r=((E=d==null?void 0:d.schema)==null?void 0:E.filter(A=>{var q,R,P;const N=(q=c==null?void 0:c.schema)==null?void 0:q.find(F=>F.id==A.id);return N?((R=N.options)==null?void 0:R.maxSelect)!=1&&((P=A.options)==null?void 0:P.maxSelect)==1:!1}))||[]),n.$$.dirty&24&&t(9,a=!l||i)},[h,c,d,i,l,u,r,o,s,a,_,m,g,v,$,C,T]}class B5 extends be{constructor(e){super(),ge(this,e,V5,z5,he,{show:11,hide:0})}get show(){return this.$$.ctx[11]}get hide(){return this.$$.ctx[0]}}function up(n,e,t){const i=n.slice();return i[50]=e[t][0],i[51]=e[t][1],i}function U5(n){let e,t,i;function l(o){n[36](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new YC({props:s}),te.push(()=>ke(e,"collection",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function W5(n){let e,t,i;function l(o){n[35](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new c5({props:s}),te.push(()=>ke(e,"collection",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function cp(n){let e,t,i,l;function s(r){n[37](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new s5({props:o}),te.push(()=>ke(t,"collection",s)),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){S(r,e,a),z(t,e,null),l=!0},p(r,a){const f={};!i&&a[0]&4&&(i=!0,f.collection=r[2],ye(()=>i=!1)),t.$set(f)},i(r){l||(I(t.$$.fragment,r),l=!0)},o(r){L(t.$$.fragment,r),l=!1},d(r){r&&w(e),V(t)}}}function dp(n){let e,t,i,l;function s(r){n[38](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new R5({props:o}),te.push(()=>ke(t,"collection",s)),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item"),ee(e,"active",n[3]===El)},m(r,a){S(r,e,a),z(t,e,null),l=!0},p(r,a){const f={};!i&&a[0]&4&&(i=!0,f.collection=r[2],ye(()=>i=!1)),t.$set(f),(!l||a[0]&8)&&ee(e,"active",r[3]===El)},i(r){l||(I(t.$$.fragment,r),l=!0)},o(r){L(t.$$.fragment,r),l=!1},d(r){r&&w(e),V(t)}}}function Y5(n){let e,t,i,l,s,o,r;const a=[W5,U5],f=[];function u(m,h){return m[14]?0:1}i=u(n),l=f[i]=a[i](n);let c=n[3]===_s&&cp(n),d=n[15]&&dp(n);return{c(){e=b("div"),t=b("div"),l.c(),s=D(),c&&c.c(),o=D(),d&&d.c(),p(t,"class","tab-item"),ee(t,"active",n[3]===Oi),p(e,"class","tabs-content svelte-12y0yzb")},m(m,h){S(m,e,h),y(e,t),f[i].m(t,null),y(e,s),c&&c.m(e,null),y(e,o),d&&d.m(e,null),r=!0},p(m,h){let _=i;i=u(m),i===_?f[i].p(m,h):(se(),L(f[_],1,1,()=>{f[_]=null}),oe(),l=f[i],l?l.p(m,h):(l=f[i]=a[i](m),l.c()),I(l,1),l.m(t,null)),(!r||h[0]&8)&&ee(t,"active",m[3]===Oi),m[3]===_s?c?(c.p(m,h),h[0]&8&&I(c,1)):(c=cp(m),c.c(),I(c,1),c.m(e,o)):c&&(se(),L(c,1,1,()=>{c=null}),oe()),m[15]?d?(d.p(m,h),h[0]&32768&&I(d,1)):(d=dp(m),d.c(),I(d,1),d.m(e,null)):d&&(se(),L(d,1,1,()=>{d=null}),oe())},i(m){r||(I(l),I(c),I(d),r=!0)},o(m){L(l),L(c),L(d),r=!1},d(m){m&&w(e),f[i].d(),c&&c.d(),d&&d.d()}}}function pp(n){let e,t,i,l,s,o,r;return o=new Mn({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[K5]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=D(),i=b("div"),l=b("i"),s=D(),B(o.$$.fragment),p(e,"class","flex-fill"),p(l,"class","ri-more-line"),p(l,"aria-hidden","true"),p(i,"tabindex","0"),p(i,"role","button"),p(i,"aria-label","More collection options"),p(i,"class","btn btn-sm btn-circle btn-transparent flex-gap-0")},m(a,f){S(a,e,f),S(a,t,f),S(a,i,f),y(i,l),y(i,s),z(o,i,null),r=!0},p(a,f){const u={};f[1]&8388608&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(I(o.$$.fragment,a),r=!0)},o(a){L(o.$$.fragment,a),r=!1},d(a){a&&(w(e),w(t),w(i)),V(o)}}}function K5(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<i class="ri-file-copy-line" aria-hidden="true"></i> <span class="txt">Duplicate</span>',t=D(),i=b("button"),i.innerHTML='<i class="ri-delete-bin-7-line" aria-hidden="true"></i> <span class="txt">Delete</span>',p(e,"type","button"),p(e,"class","dropdown-item"),p(e,"role","menuitem"),p(i,"type","button"),p(i,"class","dropdown-item txt-danger"),p(i,"role","menuitem")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),l||(s=[Z(e,"click",n[27]),Z(i,"click",Cn(Ue(n[28])))],l=!0)},p:x,d(o){o&&(w(e),w(t),w(i)),l=!1,Te(s)}}}function mp(n){let e,t,i,l;return i=new Mn({props:{class:"dropdown dropdown-right dropdown-nowrap m-t-5",$$slots:{default:[J5]},$$scope:{ctx:n}}}),{c(){e=b("i"),t=D(),B(i.$$.fragment),p(e,"class","ri-arrow-down-s-fill"),p(e,"aria-hidden","true")},m(s,o){S(s,e,o),S(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&68|o[1]&8388608&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(i.$$.fragment,s),l=!0)},o(s){L(i.$$.fragment,s),l=!1},d(s){s&&(w(e),w(t)),V(i,s)}}}function hp(n){let e,t,i,l,s,o=n[51]+"",r,a,f,u,c;function d(){return n[30](n[50])}return{c(){e=b("button"),t=b("i"),l=D(),s=b("span"),r=J(o),a=J(" collection"),f=D(),p(t,"class",i=Yn(H.getCollectionTypeIcon(n[50]))+" svelte-12y0yzb"),p(t,"aria-hidden","true"),p(s,"class","txt"),p(e,"type","button"),p(e,"role","menuitem"),p(e,"class","dropdown-item closable"),ee(e,"selected",n[50]==n[2].type)},m(m,h){S(m,e,h),y(e,t),y(e,l),y(e,s),y(s,r),y(s,a),y(e,f),u||(c=Z(e,"click",d),u=!0)},p(m,h){n=m,h[0]&64&&i!==(i=Yn(H.getCollectionTypeIcon(n[50]))+" svelte-12y0yzb")&&p(t,"class",i),h[0]&64&&o!==(o=n[51]+"")&&re(r,o),h[0]&68&&ee(e,"selected",n[50]==n[2].type)},d(m){m&&w(e),u=!1,c()}}}function J5(n){let e,t=ce(Object.entries(n[6])),i=[];for(let l=0;l<t.length;l+=1)i[l]=hp(up(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);S(l,e,s)},p(l,s){if(s[0]&524356){t=ce(Object.entries(l[6]));let o;for(o=0;o<t.length;o+=1){const r=up(l,t,o);i[o]?i[o].p(r,s):(i[o]=hp(r),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&w(e),rt(i,l)}}}function _p(n){let e;return{c(){e=b("div"),e.textContent="System collection",p(e,"class","help-block")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Z5(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v=(n[6][n[2].type]||"N/A")+"",$,C,T,O,M,E,A,N,q,R,P=!n[2].id&&mp(n),F=n[2].system&&_p();return{c(){e=b("label"),t=J("Name"),l=D(),s=b("input"),u=D(),c=b("div"),d=b("div"),m=b("span"),h=D(),_=b("span"),g=J("Type: "),$=J(v),C=D(),P&&P.c(),E=D(),F&&F.c(),A=ve(),p(e,"for",i=n[49]),p(s,"type","text"),p(s,"id",o=n[49]),s.required=!0,s.disabled=n[13],p(s,"spellcheck","false"),s.autofocus=r=!n[2].id,p(s,"placeholder",a=n[15]?'eg. "users"':'eg. "posts"'),s.value=f=n[2].name,p(m,"aria-hidden","true"),p(_,"class","txt"),p(d,"tabindex",T=n[2].id?-1:0),p(d,"role",O=n[2].id?"":"button"),p(d,"aria-label","View types"),p(d,"class",M="btn btn-sm p-r-10 p-l-10 "+(n[2].id?"btn-transparent":"btn-outline")),ee(d,"btn-disabled",!!n[2].id),p(c,"class","form-field-addon")},m(j,U){S(j,e,U),y(e,t),S(j,l,U),S(j,s,U),S(j,u,U),S(j,c,U),y(c,d),y(d,m),y(d,h),y(d,_),y(_,g),y(_,$),y(d,C),P&&P.m(d,null),S(j,E,U),F&&F.m(j,U),S(j,A,U),N=!0,n[2].id||s.focus(),q||(R=Z(s,"input",n[29]),q=!0)},p(j,U){(!N||U[1]&262144&&i!==(i=j[49]))&&p(e,"for",i),(!N||U[1]&262144&&o!==(o=j[49]))&&p(s,"id",o),(!N||U[0]&8192)&&(s.disabled=j[13]),(!N||U[0]&4&&r!==(r=!j[2].id))&&(s.autofocus=r),(!N||U[0]&32768&&a!==(a=j[15]?'eg. "users"':'eg. "posts"'))&&p(s,"placeholder",a),(!N||U[0]&4&&f!==(f=j[2].name)&&s.value!==f)&&(s.value=f),(!N||U[0]&68)&&v!==(v=(j[6][j[2].type]||"N/A")+"")&&re($,v),j[2].id?P&&(se(),L(P,1,1,()=>{P=null}),oe()):P?(P.p(j,U),U[0]&4&&I(P,1)):(P=mp(j),P.c(),I(P,1),P.m(d,null)),(!N||U[0]&4&&T!==(T=j[2].id?-1:0))&&p(d,"tabindex",T),(!N||U[0]&4&&O!==(O=j[2].id?"":"button"))&&p(d,"role",O),(!N||U[0]&4&&M!==(M="btn btn-sm p-r-10 p-l-10 "+(j[2].id?"btn-transparent":"btn-outline")))&&p(d,"class",M),(!N||U[0]&4)&&ee(d,"btn-disabled",!!j[2].id),j[2].system?F||(F=_p(),F.c(),F.m(A.parentNode,A)):F&&(F.d(1),F=null)},i(j){N||(I(P),N=!0)},o(j){L(P),N=!1},d(j){j&&(w(e),w(l),w(s),w(u),w(c),w(E),w(A)),P&&P.d(),F&&F.d(j),q=!1,R()}}}function gp(n){let e,t,i,l,s,o;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,a){S(r,e,a),l=!0,s||(o=$e(t=Fe.call(null,e,n[11])),s=!0)},p(r,a){t&&Ot(t.update)&&a[0]&2048&&t.update.call(null,r[11])},i(r){l||(r&&Je(()=>{l&&(i||(i=Re(e,Yt,{duration:150,start:.7},!0)),i.run(1))}),l=!0)},o(r){r&&(i||(i=Re(e,Yt,{duration:150,start:.7},!1)),i.run(0)),l=!1},d(r){r&&w(e),r&&i&&i.end(),s=!1,o()}}}function bp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,l||(s=$e(Fe.call(null,e,"Has errors")),l=!0)},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function kp(n){var a,f,u;let e,t,i,l=!H.isEmpty((a=n[5])==null?void 0:a.options)&&!((u=(f=n[5])==null?void 0:f.options)!=null&&u.manageRule),s,o,r=l&&yp();return{c(){e=b("button"),t=b("span"),t.textContent="Options",i=D(),r&&r.c(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","tab-item"),ee(e,"active",n[3]===El)},m(c,d){S(c,e,d),y(e,t),y(e,i),r&&r.m(e,null),s||(o=Z(e,"click",n[34]),s=!0)},p(c,d){var m,h,_;d[0]&32&&(l=!H.isEmpty((m=c[5])==null?void 0:m.options)&&!((_=(h=c[5])==null?void 0:h.options)!=null&&_.manageRule)),l?r?d[0]&32&&I(r,1):(r=yp(),r.c(),I(r,1),r.m(e,null)):r&&(se(),L(r,1,1,()=>{r=null}),oe()),d[0]&8&&ee(e,"active",c[3]===El)},d(c){c&&w(e),r&&r.d(),s=!1,o()}}}function yp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,l||(s=$e(Fe.call(null,e,"Has errors")),l=!0)},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function G5(n){var U,Y,X,W,K,le,ne;let e,t=n[2].id?"Edit collection":"New collection",i,l,s,o,r,a,f,u,c,d,m,h=n[14]?"Query":"Fields",_,g,v=!H.isEmpty(n[11]),$,C,T,O,M=!H.isEmpty((U=n[5])==null?void 0:U.listRule)||!H.isEmpty((Y=n[5])==null?void 0:Y.viewRule)||!H.isEmpty((X=n[5])==null?void 0:X.createRule)||!H.isEmpty((W=n[5])==null?void 0:W.updateRule)||!H.isEmpty((K=n[5])==null?void 0:K.deleteRule)||!H.isEmpty((ne=(le=n[5])==null?void 0:le.options)==null?void 0:ne.manageRule),E,A,N,q,R=!!n[2].id&&!n[2].system&&pp(n);r=new de({props:{class:"form-field collection-field-name required m-b-0 "+(n[13]?"disabled":""),name:"name",$$slots:{default:[Z5,({uniqueId:me})=>({49:me}),({uniqueId:me})=>[0,me?262144:0]]},$$scope:{ctx:n}}});let P=v&&gp(n),F=M&&bp(),j=n[15]&&kp(n);return{c(){e=b("h4"),i=J(t),l=D(),R&&R.c(),s=D(),o=b("form"),B(r.$$.fragment),a=D(),f=b("input"),u=D(),c=b("div"),d=b("button"),m=b("span"),_=J(h),g=D(),P&&P.c(),$=D(),C=b("button"),T=b("span"),T.textContent="API Rules",O=D(),F&&F.c(),E=D(),j&&j.c(),p(e,"class","upsert-panel-title svelte-12y0yzb"),p(f,"type","submit"),p(f,"class","hidden"),p(f,"tabindex","-1"),p(o,"class","block"),p(m,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),ee(d,"active",n[3]===Oi),p(T,"class","txt"),p(C,"type","button"),p(C,"class","tab-item"),ee(C,"active",n[3]===_s),p(c,"class","tabs-header stretched")},m(me,Pe){S(me,e,Pe),y(e,i),S(me,l,Pe),R&&R.m(me,Pe),S(me,s,Pe),S(me,o,Pe),z(r,o,null),y(o,a),y(o,f),S(me,u,Pe),S(me,c,Pe),y(c,d),y(d,m),y(m,_),y(d,g),P&&P.m(d,null),y(c,$),y(c,C),y(C,T),y(C,O),F&&F.m(C,null),y(c,E),j&&j.m(c,null),A=!0,N||(q=[Z(o,"submit",Ue(n[31])),Z(d,"click",n[32]),Z(C,"click",n[33])],N=!0)},p(me,Pe){var Qe,et,Dt,ut,ht,Qt,Ee;(!A||Pe[0]&4)&&t!==(t=me[2].id?"Edit collection":"New collection")&&re(i,t),me[2].id&&!me[2].system?R?(R.p(me,Pe),Pe[0]&4&&I(R,1)):(R=pp(me),R.c(),I(R,1),R.m(s.parentNode,s)):R&&(se(),L(R,1,1,()=>{R=null}),oe());const ze={};Pe[0]&8192&&(ze.class="form-field collection-field-name required m-b-0 "+(me[13]?"disabled":"")),Pe[0]&41028|Pe[1]&8650752&&(ze.$$scope={dirty:Pe,ctx:me}),r.$set(ze),(!A||Pe[0]&16384)&&h!==(h=me[14]?"Query":"Fields")&&re(_,h),Pe[0]&2048&&(v=!H.isEmpty(me[11])),v?P?(P.p(me,Pe),Pe[0]&2048&&I(P,1)):(P=gp(me),P.c(),I(P,1),P.m(d,null)):P&&(se(),L(P,1,1,()=>{P=null}),oe()),(!A||Pe[0]&8)&&ee(d,"active",me[3]===Oi),Pe[0]&32&&(M=!H.isEmpty((Qe=me[5])==null?void 0:Qe.listRule)||!H.isEmpty((et=me[5])==null?void 0:et.viewRule)||!H.isEmpty((Dt=me[5])==null?void 0:Dt.createRule)||!H.isEmpty((ut=me[5])==null?void 0:ut.updateRule)||!H.isEmpty((ht=me[5])==null?void 0:ht.deleteRule)||!H.isEmpty((Ee=(Qt=me[5])==null?void 0:Qt.options)==null?void 0:Ee.manageRule)),M?F?Pe[0]&32&&I(F,1):(F=bp(),F.c(),I(F,1),F.m(C,null)):F&&(se(),L(F,1,1,()=>{F=null}),oe()),(!A||Pe[0]&8)&&ee(C,"active",me[3]===_s),me[15]?j?j.p(me,Pe):(j=kp(me),j.c(),j.m(c,null)):j&&(j.d(1),j=null)},i(me){A||(I(R),I(r.$$.fragment,me),I(P),I(F),A=!0)},o(me){L(R),L(r.$$.fragment,me),L(P),L(F),A=!1},d(me){me&&(w(e),w(l),w(s),w(o),w(u),w(c)),R&&R.d(me),V(r),P&&P.d(),F&&F.d(),j&&j.d(),N=!1,Te(q)}}}function X5(n){let e,t,i,l,s,o=n[2].id?"Save changes":"Create",r,a,f,u;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=D(),l=b("button"),s=b("span"),r=J(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[9],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-expanded"),l.disabled=a=!n[12]||n[9],ee(l,"btn-loading",n[9])},m(c,d){S(c,e,d),y(e,t),S(c,i,d),S(c,l,d),y(l,s),y(s,r),f||(u=[Z(e,"click",n[25]),Z(l,"click",n[26])],f=!0)},p(c,d){d[0]&512&&(e.disabled=c[9]),d[0]&4&&o!==(o=c[2].id?"Save changes":"Create")&&re(r,o),d[0]&4608&&a!==(a=!c[12]||c[9])&&(l.disabled=a),d[0]&512&&ee(l,"btn-loading",c[9])},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function Q5(n){let e,t,i,l,s={class:"overlay-panel-lg colored-header collection-panel",escClose:!1,overlayClose:!n[9],beforeHide:n[39],$$slots:{footer:[X5],header:[G5],default:[Y5]},$$scope:{ctx:n}};e=new Xt({props:s}),n[40](e),e.$on("hide",n[41]),e.$on("show",n[42]);let o={};return i=new B5({props:o}),n[43](i),i.$on("confirm",n[44]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(r,a){z(e,r,a),S(r,t,a),z(i,r,a),l=!0},p(r,a){const f={};a[0]&512&&(f.overlayClose=!r[9]),a[0]&1040&&(f.beforeHide=r[39]),a[0]&64108|a[1]&8388608&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};i.$set(u)},i(r){l||(I(e.$$.fragment,r),I(i.$$.fragment,r),l=!0)},o(r){L(e.$$.fragment,r),L(i.$$.fragment,r),l=!1},d(r){r&&w(t),n[40](null),V(e,r),n[43](null),V(i,r)}}}const Oi="schema",_s="api_rules",El="options",x5="base",vp="auth",wp="view";function Ir(n){return JSON.stringify(n)}function e6(n,e,t){let i,l,s,o,r,a;We(n,hi,we=>t(5,a=we));const f={};f[x5]="Base",f[wp]="View",f[vp]="Auth";const u=st();let c,d,m=null,h=H.initCollection(),_=!1,g=!1,v=Oi,$=Ir(h),C="";function T(we){t(3,v=we)}function O(we){return A(we),t(10,g=!0),T(Oi),c==null?void 0:c.show()}function M(){return c==null?void 0:c.hide()}function E(){t(10,g=!1),M()}async function A(we){Gt({}),typeof we<"u"?(t(23,m=we),t(2,h=structuredClone(we))):(t(23,m=null),t(2,h=H.initCollection())),t(2,h.schema=h.schema||[],h),t(2,h.originalName=h.name||"",h),await xt(),t(24,$=Ir(h))}function N(){h.id?d==null||d.show(m,h):q()}function q(){if(_)return;t(9,_=!0);const we=R();let Se;h.id?Se=fe.collections.update(h.id,we):Se=fe.collections.create(we),Se.then(Ke=>{Sa(),sv(Ke),t(10,g=!1),M(),Nt(h.id?"Successfully updated collection.":"Successfully created collection."),u("save",{isNew:!h.id,collection:Ke})}).catch(Ke=>{fe.error(Ke)}).finally(()=>{t(9,_=!1)})}function R(){const we=Object.assign({},h);we.schema=we.schema.slice(0);for(let Se=we.schema.length-1;Se>=0;Se--)we.schema[Se].toDelete&&we.schema.splice(Se,1);return we}function P(){m!=null&&m.id&&un(`Do you really want to delete collection "${m.name}" and all its records?`,()=>fe.collections.delete(m.id).then(()=>{M(),Nt(`Successfully deleted collection "${m.name}".`),u("delete",m),ov(m)}).catch(we=>{fe.error(we)}))}function F(we){t(2,h.type=we,h),si("schema")}function j(){o?un("You have unsaved changes. Do you really want to discard them?",()=>{U()}):U()}async function U(){const we=m?structuredClone(m):null;if(we){if(we.id="",we.created="",we.updated="",we.name+="_duplicate",!H.isEmpty(we.schema))for(const Se of we.schema)Se.id="";if(!H.isEmpty(we.indexes))for(let Se=0;Se<we.indexes.length;Se++){const Ke=H.parseIndex(we.indexes[Se]);Ke.indexName="idx_"+H.randomString(7),Ke.tableName=we.name,we.indexes[Se]=H.buildIndex(Ke)}}O(we),await xt(),t(24,$="")}const Y=()=>M(),X=()=>N(),W=()=>j(),K=()=>P(),le=we=>{t(2,h.name=H.slugify(we.target.value),h),we.target.value=h.name},ne=we=>F(we),me=()=>{r&&N()},Pe=()=>T(Oi),ze=()=>T(_s),Qe=()=>T(El);function et(we){h=we,t(2,h),t(23,m)}function Dt(we){h=we,t(2,h),t(23,m)}function ut(we){h=we,t(2,h),t(23,m)}function ht(we){h=we,t(2,h),t(23,m)}const Qt=()=>o&&g?(un("You have unsaved changes. Do you really want to close the panel?",()=>{t(10,g=!1),M()}),!1):!0;function Ee(we){te[we?"unshift":"push"](()=>{c=we,t(7,c)})}function Le(we){Oe.call(this,n,we)}function Ve(we){Oe.call(this,n,we)}function bt(we){te[we?"unshift":"push"](()=>{d=we,t(8,d)})}const pe=()=>q();return n.$$.update=()=>{var we,Se;n.$$.dirty[0]&4&&h.type==="view"&&(t(2,h.createRule=null,h),t(2,h.updateRule=null,h),t(2,h.deleteRule=null,h),t(2,h.indexes=[],h)),n.$$.dirty[0]&8388612&&h.name&&(m==null?void 0:m.name)!=h.name&&h.indexes.length>0&&t(2,h.indexes=(we=h.indexes)==null?void 0:we.map(Ke=>H.replaceIndexTableName(Ke,h.name)),h),n.$$.dirty[0]&4&&t(15,i=h.type===vp),n.$$.dirty[0]&4&&t(14,l=h.type===wp),n.$$.dirty[0]&32&&(a.schema||(Se=a.options)!=null&&Se.query?t(11,C=H.getNestedVal(a,"schema.message")||"Has errors"):t(11,C="")),n.$$.dirty[0]&4&&t(13,s=!!h.id&&h.system),n.$$.dirty[0]&16777220&&t(4,o=$!=Ir(h)),n.$$.dirty[0]&20&&t(12,r=!h.id||o),n.$$.dirty[0]&12&&v===El&&h.type!=="auth"&&T(Oi)},[T,M,h,v,o,a,f,c,d,_,g,C,r,s,l,i,N,q,P,F,j,O,E,m,$,Y,X,W,K,le,ne,me,Pe,ze,Qe,et,Dt,ut,ht,Qt,Ee,Le,Ve,bt,pe]}class Ua extends be{constructor(e){super(),ge(this,e,e6,Q5,he,{changeTab:0,show:21,hide:1,forceHide:22},null,[-1,-1])}get changeTab(){return this.$$.ctx[0]}get show(){return this.$$.ctx[21]}get hide(){return this.$$.ctx[1]}get forceHide(){return this.$$.ctx[22]}}function t6(n){let e;return{c(){e=b("i"),p(e,"class","ri-pushpin-line m-l-auto svelte-1u3ag8h")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function n6(n){let e;return{c(){e=b("i"),p(e,"class","ri-unpin-line svelte-1u3ag8h")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function i6(n){let e,t,i,l,s,o=n[0].name+"",r,a,f,u,c,d,m,h;function _($,C){return $[1]?n6:t6}let g=_(n),v=g(n);return{c(){var $;e=b("a"),t=b("i"),l=D(),s=b("span"),r=J(o),a=D(),f=b("span"),v.c(),p(t,"class",i=Yn(H.getCollectionTypeIcon(n[0].type))+" svelte-1u3ag8h"),p(t,"aria-hidden","true"),p(s,"class","txt m-r-auto"),p(f,"class","btn btn-xs btn-circle btn-hint btn-transparent pin-collection svelte-1u3ag8h"),p(f,"aria-label","Pin collection"),p(f,"aria-hidden","true"),p(e,"href",c="/collections?collectionId="+n[0].id),p(e,"class","sidebar-list-item svelte-1u3ag8h"),p(e,"title",d=n[0].name),ee(e,"active",(($=n[2])==null?void 0:$.id)===n[0].id)},m($,C){S($,e,C),y(e,t),y(e,l),y(e,s),y(s,r),y(e,a),y(e,f),v.m(f,null),m||(h=[$e(u=Fe.call(null,f,{position:"right",text:(n[1]?"Unpin":"Pin")+" collection"})),Z(f,"click",Cn(Ue(n[5]))),$e(ln.call(null,e))],m=!0)},p($,[C]){var T;C&1&&i!==(i=Yn(H.getCollectionTypeIcon($[0].type))+" svelte-1u3ag8h")&&p(t,"class",i),C&1&&o!==(o=$[0].name+"")&&re(r,o),g!==(g=_($))&&(v.d(1),v=g($),v&&(v.c(),v.m(f,null))),u&&Ot(u.update)&&C&2&&u.update.call(null,{position:"right",text:($[1]?"Unpin":"Pin")+" collection"}),C&1&&c!==(c="/collections?collectionId="+$[0].id)&&p(e,"href",c),C&1&&d!==(d=$[0].name)&&p(e,"title",d),C&5&&ee(e,"active",((T=$[2])==null?void 0:T.id)===$[0].id)},i:x,o:x,d($){$&&w(e),v.d(),m=!1,Te(h)}}}function l6(n,e,t){let i,l;We(n,Jn,f=>t(2,l=f));let{collection:s}=e,{pinnedIds:o}=e;function r(f){o.includes(f.id)?H.removeByValue(o,f.id):o.push(f.id),t(4,o)}const a=()=>r(s);return n.$$set=f=>{"collection"in f&&t(0,s=f.collection),"pinnedIds"in f&&t(4,o=f.pinnedIds)},n.$$.update=()=>{n.$$.dirty&17&&t(1,i=o.includes(s.id))},[s,i,l,r,o,a]}class Kb extends be{constructor(e){super(),ge(this,e,l6,i6,he,{collection:0,pinnedIds:4})}}function Sp(n,e,t){const i=n.slice();return i[22]=e[t],i}function $p(n,e,t){const i=n.slice();return i[22]=e[t],i}function Tp(n){let e,t,i=[],l=new Map,s,o,r=ce(n[6]);const a=f=>f[22].id;for(let f=0;f<r.length;f+=1){let u=$p(n,r,f),c=a(u);l.set(c,i[f]=Cp(c,u))}return{c(){e=b("div"),e.textContent="Pinned",t=D();for(let f=0;f<i.length;f+=1)i[f].c();s=ve(),p(e,"class","sidebar-title")},m(f,u){S(f,e,u),S(f,t,u);for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(f,u);S(f,s,u),o=!0},p(f,u){u&66&&(r=ce(f[6]),se(),i=ft(i,u,a,1,f,r,l,s.parentNode,It,Cp,s,$p),oe())},i(f){if(!o){for(let u=0;u<r.length;u+=1)I(i[u]);o=!0}},o(f){for(let u=0;u<i.length;u+=1)L(i[u]);o=!1},d(f){f&&(w(e),w(t),w(s));for(let u=0;u<i.length;u+=1)i[u].d(f)}}}function Cp(n,e){let t,i,l,s;function o(a){e[14](a)}let r={collection:e[22]};return e[1]!==void 0&&(r.pinnedIds=e[1]),i=new Kb({props:r}),te.push(()=>ke(i,"pinnedIds",o)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&64&&(u.collection=e[22]),!l&&f&2&&(l=!0,u.pinnedIds=e[1],ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function Op(n){let e,t=[],i=new Map,l,s,o=n[6].length&&Mp(),r=ce(n[5]);const a=f=>f[22].id;for(let f=0;f<r.length;f+=1){let u=Sp(n,r,f),c=a(u);i.set(c,t[f]=Dp(c,u))}return{c(){o&&o.c(),e=D();for(let f=0;f<t.length;f+=1)t[f].c();l=ve()},m(f,u){o&&o.m(f,u),S(f,e,u);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(f,u);S(f,l,u),s=!0},p(f,u){f[6].length?o||(o=Mp(),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),u&34&&(r=ce(f[5]),se(),t=ft(t,u,a,1,f,r,i,l.parentNode,It,Dp,l,Sp),oe())},i(f){if(!s){for(let u=0;u<r.length;u+=1)I(t[u]);s=!0}},o(f){for(let u=0;u<t.length;u+=1)L(t[u]);s=!1},d(f){f&&(w(e),w(l)),o&&o.d(f);for(let u=0;u<t.length;u+=1)t[u].d(f)}}}function Mp(n){let e;return{c(){e=b("div"),e.textContent="Others",p(e,"class","sidebar-title")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Dp(n,e){let t,i,l,s;function o(a){e[15](a)}let r={collection:e[22]};return e[1]!==void 0&&(r.pinnedIds=e[1]),i=new Kb({props:r}),te.push(()=>ke(i,"pinnedIds",o)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&32&&(u.collection=e[22]),!l&&f&2&&(l=!0,u.pinnedIds=e[1],ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function Ep(n){let e;return{c(){e=b("p"),e.textContent="No collections found.",p(e,"class","txt-hint m-t-10 m-b-10 txt-center")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Ip(n){let e,t,i,l;return{c(){e=b("footer"),t=b("button"),t.innerHTML='<i class="ri-add-line"></i> <span class="txt">New collection</span>',p(t,"type","button"),p(t,"class","btn btn-block btn-outline"),p(e,"class","sidebar-footer")},m(s,o){S(s,e,o),y(e,t),i||(l=Z(t,"click",n[16]),i=!0)},p:x,d(s){s&&w(e),i=!1,l()}}}function s6(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$=n[6].length&&Tp(n),C=n[5].length&&Op(n),T=n[3].length&&!n[2].length&&Ep(),O=!n[9]&&Ip(n);return{c(){e=b("header"),t=b("div"),i=b("div"),l=b("button"),l.innerHTML='<i class="ri-close-line"></i>',s=D(),o=b("input"),r=D(),a=b("hr"),f=D(),u=b("div"),$&&$.c(),c=D(),C&&C.c(),d=D(),T&&T.c(),m=D(),O&&O.c(),h=ve(),p(l,"type","button"),p(l,"class","btn btn-xs btn-transparent btn-circle btn-clear"),ee(l,"hidden",!n[7]),p(i,"class","form-field-addon"),p(o,"type","text"),p(o,"placeholder","Search collections..."),p(o,"name","collections-search"),p(t,"class","form-field search"),ee(t,"active",n[7]),p(e,"class","sidebar-header"),p(a,"class","m-t-5 m-b-xs"),p(u,"class","sidebar-content"),ee(u,"fade",n[8]),ee(u,"sidebar-content-compact",n[2].length>20)},m(M,E){S(M,e,E),y(e,t),y(t,i),y(i,l),y(t,s),y(t,o),ae(o,n[0]),S(M,r,E),S(M,a,E),S(M,f,E),S(M,u,E),$&&$.m(u,null),y(u,c),C&&C.m(u,null),y(u,d),T&&T.m(u,null),S(M,m,E),O&&O.m(M,E),S(M,h,E),_=!0,g||(v=[Z(l,"click",n[12]),Z(o,"input",n[13])],g=!0)},p(M,E){(!_||E&128)&&ee(l,"hidden",!M[7]),E&1&&o.value!==M[0]&&ae(o,M[0]),(!_||E&128)&&ee(t,"active",M[7]),M[6].length?$?($.p(M,E),E&64&&I($,1)):($=Tp(M),$.c(),I($,1),$.m(u,c)):$&&(se(),L($,1,1,()=>{$=null}),oe()),M[5].length?C?(C.p(M,E),E&32&&I(C,1)):(C=Op(M),C.c(),I(C,1),C.m(u,d)):C&&(se(),L(C,1,1,()=>{C=null}),oe()),M[3].length&&!M[2].length?T||(T=Ep(),T.c(),T.m(u,null)):T&&(T.d(1),T=null),(!_||E&256)&&ee(u,"fade",M[8]),(!_||E&4)&&ee(u,"sidebar-content-compact",M[2].length>20),M[9]?O&&(O.d(1),O=null):O?O.p(M,E):(O=Ip(M),O.c(),O.m(h.parentNode,h))},i(M){_||(I($),I(C),_=!0)},o(M){L($),L(C),_=!1},d(M){M&&(w(e),w(r),w(a),w(f),w(u),w(m),w(h)),$&&$.d(),C&&C.d(),T&&T.d(),O&&O.d(M),g=!1,Te(v)}}}function o6(n){let e,t,i,l;e=new zb({props:{class:"collection-sidebar",$$slots:{default:[s6]},$$scope:{ctx:n}}});let s={};return i=new Ua({props:s}),n[17](i),i.$on("save",n[18]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(o,r){z(e,o,r),S(o,t,r),z(i,o,r),l=!0},p(o,[r]){const a={};r&134218751&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const f={};i.$set(f)},i(o){l||(I(e.$$.fragment,o),I(i.$$.fragment,o),l=!0)},o(o){L(e.$$.fragment,o),L(i.$$.fragment,o),l=!1},d(o){o&&w(t),V(e,o),n[17](null),V(i,o)}}}const Ap="@pinnedCollections";function r6(){setTimeout(()=>{const n=document.querySelector(".collection-sidebar .sidebar-list-item.active");n&&(n==null||n.scrollIntoView({block:"nearest"}))},0)}function a6(n,e,t){let i,l,s,o,r,a,f,u,c;We(n,qn,N=>t(11,a=N)),We(n,Jn,N=>t(19,f=N)),We(n,Co,N=>t(8,u=N)),We(n,Qi,N=>t(9,c=N));let d,m="",h=[];g();function _(N){en(Jn,f=N,f)}function g(){t(1,h=[]);try{const N=localStorage.getItem(Ap);N&&t(1,h=JSON.parse(N)||[])}catch{}}function v(){t(1,h=h.filter(N=>!!a.find(q=>q.id==N)))}const $=()=>t(0,m="");function C(){m=this.value,t(0,m)}function T(N){h=N,t(1,h)}function O(N){h=N,t(1,h)}const M=()=>d==null?void 0:d.show();function E(N){te[N?"unshift":"push"](()=>{d=N,t(4,d)})}const A=N=>{var q;(q=N.detail)!=null&&q.isNew&&N.detail.collection&&_(N.detail.collection)};return n.$$.update=()=>{n.$$.dirty&2048&&a&&(v(),r6()),n.$$.dirty&1&&t(3,i=m.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(7,l=m!==""),n.$$.dirty&2&&h&&localStorage.setItem(Ap,JSON.stringify(h)),n.$$.dirty&2057&&t(2,s=a.filter(N=>N.id==m||N.name.replace(/\s+/g,"").toLowerCase().includes(i))),n.$$.dirty&6&&t(6,o=s.filter(N=>h.includes(N.id))),n.$$.dirty&6&&t(5,r=s.filter(N=>!h.includes(N.id)))},[m,h,s,i,d,r,o,l,u,c,_,a,$,C,T,O,M,E,A]}class f6 extends be{constructor(e){super(),ge(this,e,a6,o6,he,{})}}function Lp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i}function Np(n){n[18]=n[19].default}function Pp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i[21]=t,i}function Fp(n){let e;return{c(){e=b("hr"),p(e,"class","m-t-sm m-b-sm")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Rp(n,e){let t,i=e[21]===Object.keys(e[6]).length,l,s,o=e[15].label+"",r,a,f,u,c=i&&Fp();function d(){return e[9](e[14])}return{key:n,first:null,c(){t=ve(),c&&c.c(),l=D(),s=b("button"),r=J(o),a=D(),p(s,"type","button"),p(s,"class","sidebar-item"),ee(s,"active",e[5]===e[14]),this.first=t},m(m,h){S(m,t,h),c&&c.m(m,h),S(m,l,h),S(m,s,h),y(s,r),y(s,a),f||(u=Z(s,"click",d),f=!0)},p(m,h){e=m,h&8&&(i=e[21]===Object.keys(e[6]).length),i?c||(c=Fp(),c.c(),c.m(l.parentNode,l)):c&&(c.d(1),c=null),h&8&&o!==(o=e[15].label+"")&&re(r,o),h&40&&ee(s,"active",e[5]===e[14])},d(m){m&&(w(t),w(l),w(s)),c&&c.d(m),f=!1,u()}}}function qp(n){let e,t,i,l={ctx:n,current:null,token:null,hasCatch:!1,pending:d6,then:c6,catch:u6,value:19,blocks:[,,,]};return Qa(t=n[15].component,l),{c(){e=ve(),l.block.c()},m(s,o){S(s,e,o),l.block.m(s,l.anchor=o),l.mount=()=>e.parentNode,l.anchor=e,i=!0},p(s,o){n=s,l.ctx=n,o&8&&t!==(t=n[15].component)&&Qa(t,l)||M0(l,n,o)},i(s){i||(I(l.block),i=!0)},o(s){for(let o=0;o<3;o+=1){const r=l.blocks[o];L(r)}i=!1},d(s){s&&w(e),l.block.d(s),l.token=null,l=null}}}function u6(n){return{c:x,m:x,p:x,i:x,o:x,d:x}}function c6(n){Np(n);let e,t,i;return e=new n[18]({props:{collection:n[2]}}),{c(){B(e.$$.fragment),t=D()},m(l,s){z(e,l,s),S(l,t,s),i=!0},p(l,s){Np(l);const o={};s&4&&(o.collection=l[2]),e.$set(o)},i(l){i||(I(e.$$.fragment,l),i=!0)},o(l){L(e.$$.fragment,l),i=!1},d(l){l&&w(t),V(e,l)}}}function d6(n){return{c:x,m:x,p:x,i:x,o:x,d:x}}function jp(n,e){let t,i,l,s=e[5]===e[14]&&qp(e);return{key:n,first:null,c(){t=ve(),s&&s.c(),i=ve(),this.first=t},m(o,r){S(o,t,r),s&&s.m(o,r),S(o,i,r),l=!0},p(o,r){e=o,e[5]===e[14]?s?(s.p(e,r),r&40&&I(s,1)):(s=qp(e),s.c(),I(s,1),s.m(i.parentNode,i)):s&&(se(),L(s,1,1,()=>{s=null}),oe())},i(o){l||(I(s),l=!0)},o(o){L(s),l=!1},d(o){o&&(w(t),w(i)),s&&s.d(o)}}}function p6(n){let e,t,i,l=[],s=new Map,o,r,a=[],f=new Map,u,c=ce(Object.entries(n[3]));const d=_=>_[14];for(let _=0;_<c.length;_+=1){let g=Pp(n,c,_),v=d(g);s.set(v,l[_]=Rp(v,g))}let m=ce(Object.entries(n[3]));const h=_=>_[14];for(let _=0;_<m.length;_+=1){let g=Lp(n,m,_),v=h(g);f.set(v,a[_]=jp(v,g))}return{c(){var _;e=b("div"),t=b("aside"),i=b("nav");for(let g=0;g<l.length;g+=1)l[g].c();o=D(),r=b("div");for(let g=0;g<a.length;g+=1)a[g].c();p(i,"class","sidebar-content"),p(t,"class","docs-sidebar"),ee(t,"compact",((_=n[2])==null?void 0:_.type)==="auth"),p(r,"class","docs-content"),p(e,"class","docs-content-wrapper")},m(_,g){S(_,e,g),y(e,t),y(t,i);for(let v=0;v<l.length;v+=1)l[v]&&l[v].m(i,null);y(e,o),y(e,r);for(let v=0;v<a.length;v+=1)a[v]&&a[v].m(r,null);u=!0},p(_,g){var v;g&106&&(c=ce(Object.entries(_[3])),l=ft(l,g,d,1,_,c,s,i,Ai,Rp,null,Pp)),(!u||g&4)&&ee(t,"compact",((v=_[2])==null?void 0:v.type)==="auth"),g&44&&(m=ce(Object.entries(_[3])),se(),a=ft(a,g,h,1,_,m,f,r,It,jp,null,Lp),oe())},i(_){if(!u){for(let g=0;g<m.length;g+=1)I(a[g]);u=!0}},o(_){for(let g=0;g<a.length;g+=1)L(a[g]);u=!1},d(_){_&&w(e);for(let g=0;g<l.length;g+=1)l[g].d();for(let g=0;g<a.length;g+=1)a[g].d()}}}function m6(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Close</span>',p(e,"type","button"),p(e,"class","btn btn-transparent")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[8]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function h6(n){let e,t,i={class:"docs-panel",$$slots:{footer:[m6],default:[p6]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&4194348&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[10](null),V(e,l)}}}function _6(n,e,t){const i={list:{label:"List/Search",component:nt(()=>import("./ListApiDocs-3G-vtbW4.js"),__vite__mapDeps([3,4,5,6,7]),import.meta.url)},view:{label:"View",component:nt(()=>import("./ViewApiDocs-DhKxMG-g.js"),__vite__mapDeps([8,4,5,6]),import.meta.url)},create:{label:"Create",component:nt(()=>import("./CreateApiDocs-CgLTNHGL.js"),__vite__mapDeps([9,4,5,6]),import.meta.url)},update:{label:"Update",component:nt(()=>import("./UpdateApiDocs-j5w0Dj65.js"),__vite__mapDeps([10,4,5,6]),import.meta.url)},delete:{label:"Delete",component:nt(()=>import("./DeleteApiDocs-CiCJ2h6k.js"),__vite__mapDeps([11,4,5]),import.meta.url)},realtime:{label:"Realtime",component:nt(()=>import("./RealtimeApiDocs-qRWOaWAy.js"),__vite__mapDeps([12,4,5]),import.meta.url)}},l={"auth-with-password":{label:"Auth with password",component:nt(()=>import("./AuthWithPasswordDocs-KjuyjMk2.js"),__vite__mapDeps([13,4,5,6]),import.meta.url)},"auth-with-oauth2":{label:"Auth with OAuth2",component:nt(()=>import("./AuthWithOAuth2Docs-9gZ9hwvH.js"),__vite__mapDeps([14,4,5,6]),import.meta.url)},refresh:{label:"Auth refresh",component:nt(()=>import("./AuthRefreshDocs-DumPRy8C.js"),__vite__mapDeps([15,4,5,6]),import.meta.url)},"request-verification":{label:"Request verification",component:nt(()=>import("./RequestVerificationDocs-DCqmh1ko.js"),__vite__mapDeps([16,4,5]),import.meta.url)},"confirm-verification":{label:"Confirm verification",component:nt(()=>import("./ConfirmVerificationDocs-C7BVcs19.js"),__vite__mapDeps([17,4,5]),import.meta.url)},"request-password-reset":{label:"Request password reset",component:nt(()=>import("./RequestPasswordResetDocs-D-22DAmZ.js"),__vite__mapDeps([18,4,5]),import.meta.url)},"confirm-password-reset":{label:"Confirm password reset",component:nt(()=>import("./ConfirmPasswordResetDocs-BGsBiiVR.js"),__vite__mapDeps([19,4,5]),import.meta.url)},"request-email-change":{label:"Request email change",component:nt(()=>import("./RequestEmailChangeDocs-B2LJ-kfg.js"),__vite__mapDeps([20,4,5]),import.meta.url)},"confirm-email-change":{label:"Confirm email change",component:nt(()=>import("./ConfirmEmailChangeDocs-DKZCgH6q.js"),__vite__mapDeps([21,4,5]),import.meta.url)},"list-auth-methods":{label:"List auth methods",component:nt(()=>import("./AuthMethodsDocs-kjjrBjEu.js"),__vite__mapDeps([22,4,5,6]),import.meta.url)},"list-linked-accounts":{label:"List OAuth2 accounts",component:nt(()=>import("./ListExternalAuthsDocs-Vkl7ubaf.js"),__vite__mapDeps([23,4,5,6]),import.meta.url)},"unlink-account":{label:"Unlink OAuth2 account",component:nt(()=>import("./UnlinkExternalAuthDocs-ApBY4X0Z.js"),__vite__mapDeps([24,4,5]),import.meta.url)}};let s,o={},r,a=[];a.length&&(r=Object.keys(a)[0]);function f(v){return t(2,o=v),c(Object.keys(a)[0]),s==null?void 0:s.show()}function u(){return s==null?void 0:s.hide()}function c(v){t(5,r=v)}const d=()=>u(),m=v=>c(v);function h(v){te[v?"unshift":"push"](()=>{s=v,t(4,s)})}function _(v){Oe.call(this,n,v)}function g(v){Oe.call(this,n,v)}return n.$$.update=()=>{n.$$.dirty&12&&(o.type==="auth"?(t(3,a=Object.assign({},i,l)),!o.options.allowUsernameAuth&&!o.options.allowEmailAuth&&delete a["auth-with-password"],o.options.allowOAuth2Auth||delete a["auth-with-oauth2"]):o.type==="view"?(t(3,a=Object.assign({},i)),delete a.create,delete a.update,delete a.delete,delete a.realtime):t(3,a=Object.assign({},i)))},[u,c,o,a,s,r,i,f,d,m,h,_,g]}class g6 extends be{constructor(e){super(),ge(this,e,_6,h6,he,{show:7,hide:0,changeTab:1})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}get changeTab(){return this.$$.ctx[1]}}function b6(n){let e,t,i,l;return{c(){e=b("i"),p(e,"class","ri-calendar-event-line txt-disabled")},m(s,o){S(s,e,o),i||(l=$e(t=Fe.call(null,e,{text:n[0].join(`
`),position:"left"})),i=!0)},p(s,[o]){t&&Ot(t.update)&&o&1&&t.update.call(null,{text:s[0].join(`
`),position:"left"})},i:x,o:x,d(s){s&&w(e),i=!1,l()}}}const Hp="yyyy-MM-dd HH:mm:ss.SSS";function k6(n,e,t){let{model:i}=e,l=[];function s(){t(0,l=[]),i.created&&l.push("Created: "+H.formatToLocalDate(i.created,Hp)+" Local"),i.updated&&l.push("Updated: "+H.formatToLocalDate(i.updated,Hp)+" Local")}return n.$$set=o=>{"model"in o&&t(1,i=o.model)},n.$$.update=()=>{n.$$.dirty&2&&i&&s()},[l,i]}class Jb extends be{constructor(e){super(),ge(this,e,k6,b6,he,{model:1})}}function y6(n){let e,t,i,l,s,o,r,a,f,u;return s=new ol({props:{value:n[1]}}),{c(){e=b("div"),t=b("span"),i=J(n[1]),l=D(),B(s.$$.fragment),o=D(),r=b("i"),p(t,"class","secret svelte-1md8247"),p(r,"class","ri-refresh-line txt-sm link-hint"),p(r,"aria-label","Refresh"),p(e,"class","flex flex-gap-5 p-5")},m(c,d){S(c,e,d),y(e,t),y(t,i),n[6](t),y(e,l),z(s,e,null),y(e,o),y(e,r),a=!0,f||(u=[$e(Fe.call(null,r,"Refresh")),Z(r,"click",n[4])],f=!0)},p(c,d){(!a||d&2)&&re(i,c[1]);const m={};d&2&&(m.value=c[1]),s.$set(m)},i(c){a||(I(s.$$.fragment,c),a=!0)},o(c){L(s.$$.fragment,c),a=!1},d(c){c&&w(e),n[6](null),V(s),f=!1,Te(u)}}}function v6(n){let e,t,i,l,s,o,r,a,f,u;function c(m){n[7](m)}let d={class:"dropdown dropdown-upside dropdown-center dropdown-nowrap",$$slots:{default:[y6]},$$scope:{ctx:n}};return n[3]!==void 0&&(d.active=n[3]),l=new Mn({props:d}),te.push(()=>ke(l,"active",c)),l.$on("show",n[4]),{c(){e=b("button"),t=b("i"),i=D(),B(l.$$.fragment),p(t,"class","ri-sparkling-line"),p(t,"aria-hidden","true"),p(e,"tabindex","-1"),p(e,"type","button"),p(e,"aria-label","Generate"),p(e,"class",o="btn btn-circle "+n[0]+" svelte-1md8247")},m(m,h){S(m,e,h),y(e,t),y(e,i),z(l,e,null),a=!0,f||(u=$e(r=Fe.call(null,e,n[3]?"":"Generate")),f=!0)},p(m,[h]){const _={};h&518&&(_.$$scope={dirty:h,ctx:m}),!s&&h&8&&(s=!0,_.active=m[3],ye(()=>s=!1)),l.$set(_),(!a||h&1&&o!==(o="btn btn-circle "+m[0]+" svelte-1md8247"))&&p(e,"class",o),r&&Ot(r.update)&&h&8&&r.update.call(null,m[3]?"":"Generate")},i(m){a||(I(l.$$.fragment,m),a=!0)},o(m){L(l.$$.fragment,m),a=!1},d(m){m&&w(e),V(l),f=!1,u()}}}function w6(n,e,t){const i=st();let{class:l="btn-sm btn-hint btn-transparent"}=e,{length:s=32}=e,o="",r,a=!1;async function f(){if(t(1,o=H.randomSecret(s)),i("generate",o),await xt(),r){let d=document.createRange();d.selectNode(r),window.getSelection().removeAllRanges(),window.getSelection().addRange(d)}}function u(d){te[d?"unshift":"push"](()=>{r=d,t(2,r)})}function c(d){a=d,t(3,a)}return n.$$set=d=>{"class"in d&&t(0,l=d.class),"length"in d&&t(5,s=d.length)},[l,o,r,a,f,s,u,c]}class Zb extends be{constructor(e){super(),ge(this,e,w6,v6,he,{class:0,length:5})}}function S6(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Username",o=D(),r=b("input"),p(t,"class",H.getFieldTypeIcon("user")),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","text"),p(r,"requried",a=!n[2]),p(r,"placeholder",f=n[2]?"Leave empty to auto generate...":n[4]),p(r,"id",u=n[13])},m(m,h){S(m,e,h),y(e,t),y(e,i),y(e,l),S(m,o,h),S(m,r,h),ae(r,n[0].username),c||(d=Z(r,"input",n[5]),c=!0)},p(m,h){h&8192&&s!==(s=m[13])&&p(e,"for",s),h&4&&a!==(a=!m[2])&&p(r,"requried",a),h&4&&f!==(f=m[2]?"Leave empty to auto generate...":m[4])&&p(r,"placeholder",f),h&8192&&u!==(u=m[13])&&p(r,"id",u),h&1&&r.value!==m[0].username&&ae(r,m[0].username)},d(m){m&&(w(e),w(o),w(r)),c=!1,d()}}}function $6(n){let e,t,i,l,s,o,r,a,f,u,c=n[0].emailVisibility?"On":"Off",d,m,h,_,g,v,$,C;return{c(){var T;e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Email",o=D(),r=b("div"),a=b("button"),f=b("span"),u=J("Public: "),d=J(c),h=D(),_=b("input"),p(t,"class",H.getFieldTypeIcon("email")),p(l,"class","txt"),p(e,"for",s=n[13]),p(f,"class","txt"),p(a,"type","button"),p(a,"class",m="btn btn-sm btn-transparent "+(n[0].emailVisibility?"btn-success":"btn-hint")),p(r,"class","form-field-addon email-visibility-addon svelte-1751a4d"),p(_,"type","email"),_.autofocus=n[2],p(_,"autocomplete","off"),p(_,"id",g=n[13]),_.required=v=(T=n[1].options)==null?void 0:T.requireEmail,p(_,"class","svelte-1751a4d")},m(T,O){S(T,e,O),y(e,t),y(e,i),y(e,l),S(T,o,O),S(T,r,O),y(r,a),y(a,f),y(f,u),y(f,d),S(T,h,O),S(T,_,O),ae(_,n[0].email),n[2]&&_.focus(),$||(C=[$e(Fe.call(null,a,{text:"Make email public or private",position:"top-right"})),Z(a,"click",Ue(n[6])),Z(_,"input",n[7])],$=!0)},p(T,O){var M;O&8192&&s!==(s=T[13])&&p(e,"for",s),O&1&&c!==(c=T[0].emailVisibility?"On":"Off")&&re(d,c),O&1&&m!==(m="btn btn-sm btn-transparent "+(T[0].emailVisibility?"btn-success":"btn-hint"))&&p(a,"class",m),O&4&&(_.autofocus=T[2]),O&8192&&g!==(g=T[13])&&p(_,"id",g),O&2&&v!==(v=(M=T[1].options)==null?void 0:M.requireEmail)&&(_.required=v),O&1&&_.value!==T[0].email&&ae(_,T[0].email)},d(T){T&&(w(e),w(o),w(r),w(h),w(_)),$=!1,Te(C)}}}function zp(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[T6,({uniqueId:i})=>({13:i}),({uniqueId:i})=>i?8192:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&24584&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function T6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){S(f,e,u),e.checked=n[3],S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[8]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&8&&(e.checked=f[3]),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function Vp(n){let e,t,i,l,s,o,r,a,f;return l=new de({props:{class:"form-field required",name:"password",$$slots:{default:[C6,({uniqueId:u})=>({13:u}),({uniqueId:u})=>u?8192:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[O6,({uniqueId:u})=>({13:u}),({uniqueId:u})=>u?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=D(),o=b("div"),B(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),ee(t,"p-t-xs",n[3]),p(e,"class","block")},m(u,c){S(u,e,c),y(e,t),y(t,i),z(l,i,null),y(t,s),y(t,o),z(r,o,null),f=!0},p(u,c){const d={};c&24579&&(d.$$scope={dirty:c,ctx:u}),l.$set(d);const m={};c&24577&&(m.$$scope={dirty:c,ctx:u}),r.$set(m),(!f||c&8)&&ee(t,"p-t-xs",u[3])},i(u){f||(I(l.$$.fragment,u),I(r.$$.fragment,u),u&&Je(()=>{f&&(a||(a=Re(e,tt,{duration:150},!0)),a.run(1))}),f=!0)},o(u){L(l.$$.fragment,u),L(r.$$.fragment,u),u&&(a||(a=Re(e,tt,{duration:150},!1)),a.run(0)),f=!1},d(u){u&&w(e),V(l),V(r),u&&a&&a.end()}}}function C6(n){var _,g;let e,t,i,l,s,o,r,a,f,u,c,d,m,h;return c=new Zb({props:{length:Math.max(15,((g=(_=n[1])==null?void 0:_.options)==null?void 0:g.minPasswordLength)||0)}}),{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Password",o=D(),r=b("input"),f=D(),u=b("div"),B(c.$$.fragment),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[13]),r.required=!0,p(u,"class","form-field-addon")},m(v,$){S(v,e,$),y(e,t),y(e,i),y(e,l),S(v,o,$),S(v,r,$),ae(r,n[0].password),S(v,f,$),S(v,u,$),z(c,u,null),d=!0,m||(h=Z(r,"input",n[9]),m=!0)},p(v,$){var T,O;(!d||$&8192&&s!==(s=v[13]))&&p(e,"for",s),(!d||$&8192&&a!==(a=v[13]))&&p(r,"id",a),$&1&&r.value!==v[0].password&&ae(r,v[0].password);const C={};$&2&&(C.length=Math.max(15,((O=(T=v[1])==null?void 0:T.options)==null?void 0:O.minPasswordLength)||0)),c.$set(C)},i(v){d||(I(c.$$.fragment,v),d=!0)},o(v){L(c.$$.fragment,v),d=!1},d(v){v&&(w(e),w(o),w(r),w(f),w(u)),V(c),m=!1,h()}}}function O6(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Password confirm",o=D(),r=b("input"),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[13]),r.required=!0},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),S(c,o,d),S(c,r,d),ae(r,n[0].passwordConfirm),f||(u=Z(r,"input",n[10]),f=!0)},p(c,d){d&8192&&s!==(s=c[13])&&p(e,"for",s),d&8192&&a!==(a=c[13])&&p(r,"id",a),d&1&&r.value!==c[0].passwordConfirm&&ae(r,c[0].passwordConfirm)},d(c){c&&(w(e),w(o),w(r)),f=!1,u()}}}function M6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Verified"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){S(f,e,u),e.checked=n[0].verified,S(f,i,u),S(f,l,u),y(l,s),r||(a=[Z(e,"change",n[11]),Z(e,"change",Ue(n[12]))],r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].verified),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,Te(a)}}}function D6(n){var g;let e,t,i,l,s,o,r,a,f,u,c,d,m;i=new de({props:{class:"form-field "+(n[2]?"":"required"),name:"username",$$slots:{default:[S6,({uniqueId:v})=>({13:v}),({uniqueId:v})=>v?8192:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field "+((g=n[1].options)!=null&&g.requireEmail?"required":""),name:"email",$$slots:{default:[$6,({uniqueId:v})=>({13:v}),({uniqueId:v})=>v?8192:0]},$$scope:{ctx:n}}});let h=!n[2]&&zp(n),_=(n[2]||n[3])&&Vp(n);return d=new de({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[M6,({uniqueId:v})=>({13:v}),({uniqueId:v})=>v?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),r=D(),a=b("div"),h&&h.c(),f=D(),_&&_.c(),u=D(),c=b("div"),B(d.$$.fragment),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(a,"class","col-lg-12"),p(c,"class","col-lg-12"),p(e,"class","grid m-b-base")},m(v,$){S(v,e,$),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),y(e,r),y(e,a),h&&h.m(a,null),y(a,f),_&&_.m(a,null),y(e,u),y(e,c),z(d,c,null),m=!0},p(v,[$]){var M;const C={};$&4&&(C.class="form-field "+(v[2]?"":"required")),$&24581&&(C.$$scope={dirty:$,ctx:v}),i.$set(C);const T={};$&2&&(T.class="form-field "+((M=v[1].options)!=null&&M.requireEmail?"required":"")),$&24583&&(T.$$scope={dirty:$,ctx:v}),o.$set(T),v[2]?h&&(se(),L(h,1,1,()=>{h=null}),oe()):h?(h.p(v,$),$&4&&I(h,1)):(h=zp(v),h.c(),I(h,1),h.m(a,f)),v[2]||v[3]?_?(_.p(v,$),$&12&&I(_,1)):(_=Vp(v),_.c(),I(_,1),_.m(a,null)):_&&(se(),L(_,1,1,()=>{_=null}),oe());const O={};$&24581&&(O.$$scope={dirty:$,ctx:v}),d.$set(O)},i(v){m||(I(i.$$.fragment,v),I(o.$$.fragment,v),I(h),I(_),I(d.$$.fragment,v),m=!0)},o(v){L(i.$$.fragment,v),L(o.$$.fragment,v),L(h),L(_),L(d.$$.fragment,v),m=!1},d(v){v&&w(e),V(i),V(o),h&&h.d(),_&&_.d(),V(d)}}}function E6(n,e,t){let{record:i}=e,{collection:l}=e,{isNew:s=!(i!=null&&i.id)}=e,o=i.username||null,r=!1;function a(){i.username=this.value,t(0,i),t(3,r)}const f=()=>t(0,i.emailVisibility=!i.emailVisibility,i);function u(){i.email=this.value,t(0,i),t(3,r)}function c(){r=this.checked,t(3,r)}function d(){i.password=this.value,t(0,i),t(3,r)}function m(){i.passwordConfirm=this.value,t(0,i),t(3,r)}function h(){i.verified=this.checked,t(0,i),t(3,r)}const _=g=>{s||un("Do you really want to manually change the verified account state?",()=>{},()=>{t(0,i.verified=!g.target.checked,i)})};return n.$$set=g=>{"record"in g&&t(0,i=g.record),"collection"in g&&t(1,l=g.collection),"isNew"in g&&t(2,s=g.isNew)},n.$$.update=()=>{n.$$.dirty&1&&!i.username&&i.username!==null&&t(0,i.username=null,i),n.$$.dirty&8&&(r||(t(0,i.password=null,i),t(0,i.passwordConfirm=null,i),si("password"),si("passwordConfirm")))},[i,l,s,r,o,a,f,u,c,d,m,h,_]}class I6 extends be{constructor(e){super(),ge(this,e,E6,D6,he,{record:0,collection:1,isNew:2})}}function A6(n){let e,t,i,l=[n[3]],s={};for(let o=0;o<l.length;o+=1)s=Ae(s,l[o]);return{c(){e=b("textarea"),ii(e,s),ee(e,"svelte-1x1pbts",!0)},m(o,r){S(o,e,r),e.autofocus&&e.focus(),n[5](e),ae(e,n[0]),t||(i=[Z(e,"input",n[6]),Z(e,"keydown",n[2])],t=!0)},p(o,[r]){ii(e,s=mt(l,[r&8&&o[3]])),r&1&&ae(e,o[0]),ee(e,"svelte-1x1pbts",!0)},i:x,o:x,d(o){o&&w(e),n[5](null),t=!1,Te(i)}}}function L6(n,e,t){const i=["value","maxHeight"];let l=Xe(e,i),{value:s=""}=e,{maxHeight:o=200}=e,r,a;function f(){clearTimeout(a),a=setTimeout(()=>{r&&(t(1,r.style.height="",r),t(1,r.style.height=Math.min(r.scrollHeight,o)+"px",r))},0)}function u(m){if((m==null?void 0:m.code)==="Enter"&&!(m!=null&&m.shiftKey)&&!(m!=null&&m.isComposing)){m.preventDefault();const h=r.closest("form");h!=null&&h.requestSubmit&&h.requestSubmit()}}zt(()=>(f(),()=>clearTimeout(a)));function c(m){te[m?"unshift":"push"](()=>{r=m,t(1,r)})}function d(){s=this.value,t(0,s)}return n.$$set=m=>{e=Ae(Ae({},e),Kt(m)),t(3,l=Xe(e,i)),"value"in m&&t(0,s=m.value),"maxHeight"in m&&t(4,o=m.maxHeight)},n.$$.update=()=>{n.$$.dirty&1&&typeof s!==void 0&&f()},[s,r,u,l,o,c,d]}class N6 extends be{constructor(e){super(),ge(this,e,L6,A6,he,{value:0,maxHeight:4})}}function P6(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d;function m(_){n[2](_)}let h={id:n[3],required:n[1].required};return n[0]!==void 0&&(h.value=n[0]),u=new N6({props:h}),te.push(()=>ke(u,"value",m)),{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),B(u.$$.fragment),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3])},m(_,g){S(_,e,g),y(e,t),y(e,l),y(e,s),y(s,r),S(_,f,g),z(u,_,g),d=!0},p(_,g){(!d||g&2&&i!==(i=H.getFieldTypeIcon(_[1].type)))&&p(t,"class",i),(!d||g&2)&&o!==(o=_[1].name+"")&&re(r,o),(!d||g&8&&a!==(a=_[3]))&&p(e,"for",a);const v={};g&8&&(v.id=_[3]),g&2&&(v.required=_[1].required),!c&&g&1&&(c=!0,v.value=_[0],ye(()=>c=!1)),u.$set(v)},i(_){d||(I(u.$$.fragment,_),d=!0)},o(_){L(u.$$.fragment,_),d=!1},d(_){_&&(w(e),w(f)),V(u,_)}}}function F6(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[P6,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function R6(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(o){l=o,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class q6 extends be{constructor(e){super(),ge(this,e,R6,F6,he,{field:1,value:0})}}function j6(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g;return{c(){var v,$;e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","number"),p(u,"id",c=n[3]),u.required=d=n[1].required,p(u,"min",m=(v=n[1].options)==null?void 0:v.min),p(u,"max",h=($=n[1].options)==null?void 0:$.max),p(u,"step","any")},m(v,$){S(v,e,$),y(e,t),y(e,l),y(e,s),y(s,r),S(v,f,$),S(v,u,$),ae(u,n[0]),_||(g=Z(u,"input",n[2]),_=!0)},p(v,$){var C,T;$&2&&i!==(i=H.getFieldTypeIcon(v[1].type))&&p(t,"class",i),$&2&&o!==(o=v[1].name+"")&&re(r,o),$&8&&a!==(a=v[3])&&p(e,"for",a),$&8&&c!==(c=v[3])&&p(u,"id",c),$&2&&d!==(d=v[1].required)&&(u.required=d),$&2&&m!==(m=(C=v[1].options)==null?void 0:C.min)&&p(u,"min",m),$&2&&h!==(h=(T=v[1].options)==null?void 0:T.max)&&p(u,"max",h),$&1&&lt(u.value)!==v[0]&&ae(u,v[0])},d(v){v&&(w(e),w(f),w(u)),_=!1,g()}}}function H6(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[j6,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function z6(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=lt(this.value),t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class V6 extends be{constructor(e){super(),ge(this,e,z6,H6,he,{field:1,value:0})}}function B6(n){let e,t,i,l,s=n[1].name+"",o,r,a,f;return{c(){e=b("input"),i=D(),l=b("label"),o=J(s),p(e,"type","checkbox"),p(e,"id",t=n[3]),p(l,"for",r=n[3])},m(u,c){S(u,e,c),e.checked=n[0],S(u,i,c),S(u,l,c),y(l,o),a||(f=Z(e,"change",n[2]),a=!0)},p(u,c){c&8&&t!==(t=u[3])&&p(e,"id",t),c&1&&(e.checked=u[0]),c&2&&s!==(s=u[1].name+"")&&re(o,s),c&8&&r!==(r=u[3])&&p(l,"for",r)},d(u){u&&(w(e),w(i),w(l)),a=!1,f()}}}function U6(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[B6,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field form-field-toggle "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function W6(n,e,t){let{field:i}=e,{value:l=!1}=e;function s(){l=this.checked,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class Y6 extends be{constructor(e){super(),ge(this,e,W6,U6,he,{field:1,value:0})}}function K6(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;return{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","email"),p(u,"id",c=n[3]),u.required=d=n[1].required},m(_,g){S(_,e,g),y(e,t),y(e,l),y(e,s),y(s,r),S(_,f,g),S(_,u,g),ae(u,n[0]),m||(h=Z(u,"input",n[2]),m=!0)},p(_,g){g&2&&i!==(i=H.getFieldTypeIcon(_[1].type))&&p(t,"class",i),g&2&&o!==(o=_[1].name+"")&&re(r,o),g&8&&a!==(a=_[3])&&p(e,"for",a),g&8&&c!==(c=_[3])&&p(u,"id",c),g&2&&d!==(d=_[1].required)&&(u.required=d),g&1&&u.value!==_[0]&&ae(u,_[0])},d(_){_&&(w(e),w(f),w(u)),m=!1,h()}}}function J6(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[K6,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Z6(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=this.value,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class G6 extends be{constructor(e){super(),ge(this,e,Z6,J6,he,{field:1,value:0})}}function X6(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;return{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","url"),p(u,"id",c=n[3]),u.required=d=n[1].required},m(_,g){S(_,e,g),y(e,t),y(e,l),y(e,s),y(s,r),S(_,f,g),S(_,u,g),ae(u,n[0]),m||(h=Z(u,"input",n[2]),m=!0)},p(_,g){g&2&&i!==(i=H.getFieldTypeIcon(_[1].type))&&p(t,"class",i),g&2&&o!==(o=_[1].name+"")&&re(r,o),g&8&&a!==(a=_[3])&&p(e,"for",a),g&8&&c!==(c=_[3])&&p(u,"id",c),g&2&&d!==(d=_[1].required)&&(u.required=d),g&1&&u.value!==_[0]&&ae(u,_[0])},d(_){_&&(w(e),w(f),w(u)),m=!1,h()}}}function Q6(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[X6,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function x6(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=this.value,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class eO extends be{constructor(e){super(),ge(this,e,x6,Q6,he,{field:1,value:0})}}function Bp(n){let e,t,i,l;return{c(){e=b("div"),t=b("button"),t.innerHTML='<i class="ri-close-line"></i>',p(t,"type","button"),p(t,"class","link-hint clear-btn svelte-11df51y"),p(e,"class","form-field-addon")},m(s,o){S(s,e,o),y(e,t),i||(l=[$e(Fe.call(null,t,"Clear")),Z(t,"click",n[5])],i=!0)},p:x,d(s){s&&w(e),i=!1,Te(l)}}}function tO(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g=n[0]&&!n[1].required&&Bp(n);function v(T){n[6](T)}function $(T){n[7](T)}let C={id:n[8],options:H.defaultFlatpickrOptions()};return n[2]!==void 0&&(C.value=n[2]),n[0]!==void 0&&(C.formattedValue=n[0]),d=new Ba({props:C}),te.push(()=>ke(d,"value",v)),te.push(()=>ke(d,"formattedValue",$)),d.$on("close",n[3]),{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),a=J(" (UTC)"),u=D(),g&&g.c(),c=D(),B(d.$$.fragment),p(t,"class",i=Yn(H.getFieldTypeIcon(n[1].type))+" svelte-11df51y"),p(s,"class","txt"),p(e,"for",f=n[8])},m(T,O){S(T,e,O),y(e,t),y(e,l),y(e,s),y(s,r),y(s,a),S(T,u,O),g&&g.m(T,O),S(T,c,O),z(d,T,O),_=!0},p(T,O){(!_||O&2&&i!==(i=Yn(H.getFieldTypeIcon(T[1].type))+" svelte-11df51y"))&&p(t,"class",i),(!_||O&2)&&o!==(o=T[1].name+"")&&re(r,o),(!_||O&256&&f!==(f=T[8]))&&p(e,"for",f),T[0]&&!T[1].required?g?g.p(T,O):(g=Bp(T),g.c(),g.m(c.parentNode,c)):g&&(g.d(1),g=null);const M={};O&256&&(M.id=T[8]),!m&&O&4&&(m=!0,M.value=T[2],ye(()=>m=!1)),!h&&O&1&&(h=!0,M.formattedValue=T[0],ye(()=>h=!1)),d.$set(M)},i(T){_||(I(d.$$.fragment,T),_=!0)},o(T){L(d.$$.fragment,T),_=!1},d(T){T&&(w(e),w(u),w(c)),g&&g.d(T),V(d,T)}}}function nO(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[tO,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&775&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function iO(n,e,t){let{field:i}=e,{value:l=void 0}=e,s=l;function o(c){c.detail&&c.detail.length==3&&t(0,l=c.detail[1])}function r(){t(0,l="")}const a=()=>r();function f(c){s=c,t(2,s),t(0,l)}function u(c){l=c,t(0,l)}return n.$$set=c=>{"field"in c&&t(1,i=c.field),"value"in c&&t(0,l=c.value)},n.$$.update=()=>{n.$$.dirty&1&&l&&l.length>19&&t(0,l=l.substring(0,19)),n.$$.dirty&5&&s!=l&&t(2,s=l)},[l,i,s,o,r,a,f,u]}class lO extends be{constructor(e){super(),ge(this,e,iO,nO,he,{field:1,value:0})}}function Up(n){let e,t,i=n[1].options.maxSelect+"",l,s;return{c(){e=b("div"),t=J("Select up to "),l=J(i),s=J(" items."),p(e,"class","help-block")},m(o,r){S(o,e,r),y(e,t),y(e,l),y(e,s)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&re(l,i)},d(o){o&&w(e)}}}function sO(n){var $,C,T,O,M,E;let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;function _(A){n[3](A)}let g={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],closable:!n[2]||(($=n[0])==null?void 0:$.length)>=((C=n[1].options)==null?void 0:C.maxSelect),items:(T=n[1].options)==null?void 0:T.values,searchable:((M=(O=n[1].options)==null?void 0:O.values)==null?void 0:M.length)>5};n[0]!==void 0&&(g.selected=n[0]),u=new Yb({props:g}),te.push(()=>ke(u,"selected",_));let v=((E=n[1].options)==null?void 0:E.maxSelect)>1&&Up(n);return{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),B(u.$$.fragment),d=D(),v&&v.c(),m=ve(),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[4])},m(A,N){S(A,e,N),y(e,t),y(e,l),y(e,s),y(s,r),S(A,f,N),z(u,A,N),S(A,d,N),v&&v.m(A,N),S(A,m,N),h=!0},p(A,N){var R,P,F,j,U,Y;(!h||N&2&&i!==(i=H.getFieldTypeIcon(A[1].type)))&&p(t,"class",i),(!h||N&2)&&o!==(o=A[1].name+"")&&re(r,o),(!h||N&16&&a!==(a=A[4]))&&p(e,"for",a);const q={};N&16&&(q.id=A[4]),N&6&&(q.toggle=!A[1].required||A[2]),N&4&&(q.multiple=A[2]),N&7&&(q.closable=!A[2]||((R=A[0])==null?void 0:R.length)>=((P=A[1].options)==null?void 0:P.maxSelect)),N&2&&(q.items=(F=A[1].options)==null?void 0:F.values),N&2&&(q.searchable=((U=(j=A[1].options)==null?void 0:j.values)==null?void 0:U.length)>5),!c&&N&1&&(c=!0,q.selected=A[0],ye(()=>c=!1)),u.$set(q),((Y=A[1].options)==null?void 0:Y.maxSelect)>1?v?v.p(A,N):(v=Up(A),v.c(),v.m(m.parentNode,m)):v&&(v.d(1),v=null)},i(A){h||(I(u.$$.fragment,A),h=!0)},o(A){L(u.$$.fragment,A),h=!1},d(A){A&&(w(e),w(f),w(d),w(m)),V(u,A),v&&v.d(A)}}}function oO(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[sO,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&55&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function rO(n,e,t){let i,{field:l}=e,{value:s=void 0}=e;function o(r){s=r,t(0,s),t(2,i),t(1,l)}return n.$$set=r=>{"field"in r&&t(1,l=r.field),"value"in r&&t(0,s=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=l.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&5&&typeof s>"u"&&t(0,s=i?[]:""),n.$$.dirty&7&&i&&Array.isArray(s)&&s.length>l.options.maxSelect&&t(0,s=s.slice(s.length-l.options.maxSelect))},[s,l,i,o]}class aO extends be{constructor(e){super(),ge(this,e,rO,oO,he,{field:1,value:0})}}function fO(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function uO(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function cO(n){let e;return{c(){e=b("input"),p(e,"type","text"),p(e,"class","txt-mono"),e.value="Loading...",e.disabled=!0},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function dO(n){let e,t,i;var l=n[3];function s(o,r){return{props:{id:o[6],maxHeight:"500",language:"json",value:o[2]}}}return l&&(e=Et(l,s(n)),e.$on("change",n[5])),{c(){e&&B(e.$$.fragment),t=ve()},m(o,r){e&&z(e,o,r),S(o,t,r),i=!0},p(o,r){if(r&8&&l!==(l=o[3])){if(e){se();const a=e;L(a.$$.fragment,1,0,()=>{V(a,1)}),oe()}l?(e=Et(l,s(o)),e.$on("change",o[5]),B(e.$$.fragment),I(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(l){const a={};r&64&&(a.id=o[6]),r&4&&(a.value=o[2]),e.$set(a)}},i(o){i||(e&&I(e.$$.fragment,o),i=!0)},o(o){e&&L(e.$$.fragment,o),i=!1},d(o){o&&w(t),e&&V(e,o)}}}function pO(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g,v,$;function C(N,q){return N[4]?uO:fO}let T=C(n),O=T(n);const M=[dO,cO],E=[];function A(N,q){return N[3]?0:1}return m=A(n),h=E[m]=M[m](n),{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),a=D(),f=b("span"),O.c(),d=D(),h.c(),_=ve(),p(t,"class",i=Yn(H.getFieldTypeIcon(n[1].type))+" svelte-p6ecb8"),p(s,"class","txt"),p(f,"class","json-state svelte-p6ecb8"),p(e,"for",c=n[6])},m(N,q){S(N,e,q),y(e,t),y(e,l),y(e,s),y(s,r),y(e,a),y(e,f),O.m(f,null),S(N,d,q),E[m].m(N,q),S(N,_,q),g=!0,v||($=$e(u=Fe.call(null,f,{position:"left",text:n[4]?"Valid JSON":"Invalid JSON"})),v=!0)},p(N,q){(!g||q&2&&i!==(i=Yn(H.getFieldTypeIcon(N[1].type))+" svelte-p6ecb8"))&&p(t,"class",i),(!g||q&2)&&o!==(o=N[1].name+"")&&re(r,o),T!==(T=C(N))&&(O.d(1),O=T(N),O&&(O.c(),O.m(f,null))),u&&Ot(u.update)&&q&16&&u.update.call(null,{position:"left",text:N[4]?"Valid JSON":"Invalid JSON"}),(!g||q&64&&c!==(c=N[6]))&&p(e,"for",c);let R=m;m=A(N),m===R?E[m].p(N,q):(se(),L(E[R],1,1,()=>{E[R]=null}),oe(),h=E[m],h?h.p(N,q):(h=E[m]=M[m](N),h.c()),I(h,1),h.m(_.parentNode,_))},i(N){g||(I(h),g=!0)},o(N){L(h),g=!1},d(N){N&&(w(e),w(d),w(_)),O.d(),E[m].d(N),v=!1,$()}}}function mO(n){let e,t;return e=new de({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[pO,({uniqueId:i})=>({6:i}),({uniqueId:i})=>i?64:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&223&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Wp(n){return typeof n=="string"&&Gb(n)?n:JSON.stringify(typeof n>"u"?null:n,null,2)}function Gb(n){try{return JSON.parse(n===""?null:n),!0}catch{}return!1}function hO(n,e,t){let i,{field:l}=e,{value:s=void 0}=e,o,r=Wp(s);zt(async()=>{try{t(3,o=(await nt(()=>import("./CodeEditor-dWSAtOWY.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(f){console.warn(f)}});const a=f=>{t(2,r=f.detail),t(0,s=r.trim())};return n.$$set=f=>{"field"in f&&t(1,l=f.field),"value"in f&&t(0,s=f.value)},n.$$.update=()=>{n.$$.dirty&5&&s!==(r==null?void 0:r.trim())&&(t(2,r=Wp(s)),t(0,s=r)),n.$$.dirty&4&&t(4,i=Gb(r))},[s,l,r,o,i,a]}class _O extends be{constructor(e){super(),ge(this,e,hO,mO,he,{field:1,value:0})}}function gO(n){let e,t;return{c(){e=b("i"),p(e,"class","ri-file-line"),p(e,"alt",t=n[0].name)},m(i,l){S(i,e,l)},p(i,l){l&1&&t!==(t=i[0].name)&&p(e,"alt",t)},d(i){i&&w(e)}}}function bO(n){let e,t,i;return{c(){e=b("img"),p(e,"draggable",!1),tn(e.src,t=n[2])||p(e,"src",t),p(e,"width",n[1]),p(e,"height",n[1]),p(e,"alt",i=n[0].name)},m(l,s){S(l,e,s)},p(l,s){s&4&&!tn(e.src,t=l[2])&&p(e,"src",t),s&2&&p(e,"width",l[1]),s&2&&p(e,"height",l[1]),s&1&&i!==(i=l[0].name)&&p(e,"alt",i)},d(l){l&&w(e)}}}function kO(n){let e;function t(s,o){return s[2]?bO:gO}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:x,o:x,d(s){s&&w(e),l.d(s)}}}function yO(n,e,t){let i,{file:l}=e,{size:s=50}=e;function o(){H.hasImageExtension(l==null?void 0:l.name)?H.generateThumb(l,s,s).then(r=>{t(2,i=r)}).catch(r=>{t(2,i=""),console.warn("Unable to generate thumb: ",r)}):t(2,i="")}return n.$$set=r=>{"file"in r&&t(0,l=r.file),"size"in r&&t(1,s=r.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof l<"u"&&o()},t(2,i=""),[l,s,i]}class vO extends be{constructor(e){super(),ge(this,e,yO,kO,he,{file:0,size:1})}}function Yp(n){let e;function t(s,o){return s[4]==="image"?SO:wO}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function wO(n){let e,t;return{c(){e=b("object"),t=J("Cannot preview the file."),p(e,"title",n[2]),p(e,"data",n[1])},m(i,l){S(i,e,l),y(e,t)},p(i,l){l&4&&p(e,"title",i[2]),l&2&&p(e,"data",i[1])},d(i){i&&w(e)}}}function SO(n){let e,t,i;return{c(){e=b("img"),tn(e.src,t=n[1])||p(e,"src",t),p(e,"alt",i="Preview "+n[2])},m(l,s){S(l,e,s)},p(l,s){s&2&&!tn(e.src,t=l[1])&&p(e,"src",t),s&4&&i!==(i="Preview "+l[2])&&p(e,"alt",i)},d(l){l&&w(e)}}}function $O(n){var l;let e=(l=n[3])==null?void 0:l.isActive(),t,i=e&&Yp(n);return{c(){i&&i.c(),t=ve()},m(s,o){i&&i.m(s,o),S(s,t,o)},p(s,o){var r;o&8&&(e=(r=s[3])==null?void 0:r.isActive()),e?i?i.p(s,o):(i=Yp(s),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(s){s&&w(t),i&&i.d(s)}}}function TO(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-close-line"></i>',p(e,"type","button"),p(e,"class","overlay-close")},m(l,s){S(l,e,s),t||(i=Z(e,"click",Ue(n[0])),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function CO(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("a"),t=J(n[2]),i=D(),l=b("i"),s=D(),o=b("div"),r=D(),a=b("button"),a.textContent="Close",p(l,"class","ri-external-link-line"),p(e,"href",n[1]),p(e,"title",n[2]),p(e,"target","_blank"),p(e,"rel","noreferrer noopener"),p(e,"class","link-hint txt-ellipsis inline-flex"),p(o,"class","flex-fill"),p(a,"type","button"),p(a,"class","btn btn-transparent")},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),S(c,s,d),S(c,o,d),S(c,r,d),S(c,a,d),f||(u=Z(a,"click",n[0]),f=!0)},p(c,d){d&4&&re(t,c[2]),d&2&&p(e,"href",c[1]),d&4&&p(e,"title",c[2])},d(c){c&&(w(e),w(s),w(o),w(r),w(a)),f=!1,u()}}}function OO(n){let e,t,i={class:"preview preview-"+n[4],btnClose:!1,popup:!0,$$slots:{footer:[CO],header:[TO],default:[$O]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[7](e),e.$on("show",n[8]),e.$on("hide",n[9]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.class="preview preview-"+l[4]),s&1054&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[7](null),V(e,l)}}}function MO(n,e,t){let i,l,s,o,r="";function a(m){m!==""&&(t(1,r=m),o==null||o.show())}function f(){return o==null?void 0:o.hide()}function u(m){te[m?"unshift":"push"](()=>{o=m,t(3,o)})}function c(m){Oe.call(this,n,m)}function d(m){Oe.call(this,n,m)}return n.$$.update=()=>{n.$$.dirty&2&&t(6,i=r.indexOf("?")),n.$$.dirty&66&&t(2,l=r.substring(r.lastIndexOf("/")+1,i>0?i:void 0)),n.$$.dirty&4&&t(4,s=H.getFileType(l))},[f,r,l,o,s,a,i,u,c,d]}class DO extends be{constructor(e){super(),ge(this,e,MO,OO,he,{show:5,hide:0})}get show(){return this.$$.ctx[5]}get hide(){return this.$$.ctx[0]}}function EO(n){let e,t,i,l,s;function o(f,u){return f[3]==="image"?NO:f[3]==="video"||f[3]==="audio"?LO:AO}let r=o(n),a=r(n);return{c(){e=b("a"),a.c(),p(e,"draggable",!1),p(e,"class",t="thumb "+(n[1]?`thumb-${n[1]}`:"")),p(e,"href",n[6]),p(e,"target","_blank"),p(e,"rel","noreferrer"),p(e,"title",i=(n[7]?"Preview":"Download")+" "+n[0])},m(f,u){S(f,e,u),a.m(e,null),l||(s=Z(e,"click",Cn(n[11])),l=!0)},p(f,u){r===(r=o(f))&&a?a.p(f,u):(a.d(1),a=r(f),a&&(a.c(),a.m(e,null))),u&2&&t!==(t="thumb "+(f[1]?`thumb-${f[1]}`:""))&&p(e,"class",t),u&64&&p(e,"href",f[6]),u&129&&i!==(i=(f[7]?"Preview":"Download")+" "+f[0])&&p(e,"title",i)},d(f){f&&w(e),a.d(),l=!1,s()}}}function IO(n){let e,t;return{c(){e=b("div"),p(e,"class",t="thumb "+(n[1]?`thumb-${n[1]}`:""))},m(i,l){S(i,e,l)},p(i,l){l&2&&t!==(t="thumb "+(i[1]?`thumb-${i[1]}`:""))&&p(e,"class",t)},d(i){i&&w(e)}}}function AO(n){let e;return{c(){e=b("i"),p(e,"class","ri-file-3-line")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function LO(n){let e;return{c(){e=b("i"),p(e,"class","ri-video-line")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function NO(n){let e,t,i,l,s;return{c(){e=b("img"),p(e,"draggable",!1),p(e,"loading","lazy"),tn(e.src,t=n[5])||p(e,"src",t),p(e,"alt",n[0]),p(e,"title",i="Preview "+n[0])},m(o,r){S(o,e,r),l||(s=Z(e,"error",n[8]),l=!0)},p(o,r){r&32&&!tn(e.src,t=o[5])&&p(e,"src",t),r&1&&p(e,"alt",o[0]),r&1&&i!==(i="Preview "+o[0])&&p(e,"title",i)},d(o){o&&w(e),l=!1,s()}}}function Kp(n){let e,t,i={};return e=new DO({props:i}),n[12](e),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,s){const o={};e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[12](null),V(e,l)}}}function PO(n){let e,t,i;function l(a,f){return a[2]?IO:EO}let s=l(n),o=s(n),r=n[7]&&Kp(n);return{c(){o.c(),e=D(),r&&r.c(),t=ve()},m(a,f){o.m(a,f),S(a,e,f),r&&r.m(a,f),S(a,t,f),i=!0},p(a,[f]){s===(s=l(a))&&o?o.p(a,f):(o.d(1),o=s(a),o&&(o.c(),o.m(e.parentNode,e))),a[7]?r?(r.p(a,f),f&128&&I(r,1)):(r=Kp(a),r.c(),I(r,1),r.m(t.parentNode,t)):r&&(se(),L(r,1,1,()=>{r=null}),oe())},i(a){i||(I(r),i=!0)},o(a){L(r),i=!1},d(a){a&&(w(e),w(t)),o.d(a),r&&r.d(a)}}}function FO(n,e,t){let i,l,{record:s=null}=e,{filename:o=""}=e,{size:r=""}=e,a,f="",u="",c="",d=!0;m();async function m(){t(2,d=!0);try{t(10,c=await fe.getAdminFileToken(s.collectionId))}catch(v){console.warn("File token failure:",v)}t(2,d=!1)}function h(){t(5,f="")}const _=v=>{l&&(v.preventDefault(),a==null||a.show(u))};function g(v){te[v?"unshift":"push"](()=>{a=v,t(4,a)})}return n.$$set=v=>{"record"in v&&t(9,s=v.record),"filename"in v&&t(0,o=v.filename),"size"in v&&t(1,r=v.size)},n.$$.update=()=>{n.$$.dirty&1&&t(3,i=H.getFileType(o)),n.$$.dirty&9&&t(7,l=["image","audio","video"].includes(i)||o.endsWith(".pdf")),n.$$.dirty&1541&&t(6,u=d?"":fe.files.getUrl(s,o,{token:c})),n.$$.dirty&1541&&t(5,f=d?"":fe.files.getUrl(s,o,{thumb:"100x100",token:c}))},[o,r,d,i,a,f,u,l,h,s,c,_,g]}class Wa extends be{constructor(e){super(),ge(this,e,FO,PO,he,{record:9,filename:0,size:1})}}function Jp(n,e,t){const i=n.slice();return i[29]=e[t],i[31]=t,i}function Zp(n,e,t){const i=n.slice();i[34]=e[t],i[31]=t;const l=i[2].includes(i[34]);return i[35]=l,i}function RO(n){let e,t,i;function l(){return n[17](n[34])}return{c(){e=b("button"),e.innerHTML='<i class="ri-close-line"></i>',p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove")},m(s,o){S(s,e,o),t||(i=[$e(Fe.call(null,e,"Remove file")),Z(e,"click",l)],t=!0)},p(s,o){n=s},d(s){s&&w(e),t=!1,Te(i)}}}function qO(n){let e,t,i;function l(){return n[16](n[34])}return{c(){e=b("button"),e.innerHTML='<span class="txt">Restore</span>',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-transparent")},m(s,o){S(s,e,o),t||(i=Z(e,"click",l),t=!0)},p(s,o){n=s},d(s){s&&w(e),t=!1,i()}}}function jO(n){let e,t,i,l,s,o,r=n[34]+"",a,f,u,c,d,m;i=new Wa({props:{record:n[3],filename:n[34]}});function h(v,$){return v[35]?qO:RO}let _=h(n),g=_(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),o=b("a"),a=J(r),c=D(),d=b("div"),g.c(),ee(t,"fade",n[35]),p(o,"draggable",!1),p(o,"href",f=fe.files.getUrl(n[3],n[34],{token:n[10]})),p(o,"class",u="txt-ellipsis "+(n[35]?"txt-strikethrough txt-hint":"link-primary")),p(o,"title","Download"),p(o,"target","_blank"),p(o,"rel","noopener noreferrer"),p(s,"class","content"),p(d,"class","actions"),p(e,"class","list-item"),ee(e,"dragging",n[32]),ee(e,"dragover",n[33])},m(v,$){S(v,e,$),y(e,t),z(i,t,null),y(e,l),y(e,s),y(s,o),y(o,a),y(e,c),y(e,d),g.m(d,null),m=!0},p(v,$){const C={};$[0]&8&&(C.record=v[3]),$[0]&32&&(C.filename=v[34]),i.$set(C),(!m||$[0]&36)&&ee(t,"fade",v[35]),(!m||$[0]&32)&&r!==(r=v[34]+"")&&re(a,r),(!m||$[0]&1064&&f!==(f=fe.files.getUrl(v[3],v[34],{token:v[10]})))&&p(o,"href",f),(!m||$[0]&36&&u!==(u="txt-ellipsis "+(v[35]?"txt-strikethrough txt-hint":"link-primary")))&&p(o,"class",u),_===(_=h(v))&&g?g.p(v,$):(g.d(1),g=_(v),g&&(g.c(),g.m(d,null))),(!m||$[1]&2)&&ee(e,"dragging",v[32]),(!m||$[1]&4)&&ee(e,"dragover",v[33])},i(v){m||(I(i.$$.fragment,v),m=!0)},o(v){L(i.$$.fragment,v),m=!1},d(v){v&&w(e),V(i),g.d()}}}function Gp(n,e){let t,i,l,s;function o(a){e[18](a)}let r={group:e[4].name+"_uploaded",index:e[31],disabled:!e[6],$$slots:{default:[jO,({dragging:a,dragover:f})=>({32:a,33:f}),({dragging:a,dragover:f})=>[0,(a?2:0)|(f?4:0)]]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.list=e[0]),i=new Ds({props:r}),te.push(()=>ke(i,"list",o)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&16&&(u.group=e[4].name+"_uploaded"),f[0]&32&&(u.index=e[31]),f[0]&64&&(u.disabled=!e[6]),f[0]&1068|f[1]&70&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&1&&(l=!0,u.list=e[0],ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function HO(n){let e,t,i,l,s,o,r,a,f=n[29].name+"",u,c,d,m,h,_,g;i=new vO({props:{file:n[29]}});function v(){return n[19](n[31])}return{c(){e=b("div"),t=b("figure"),B(i.$$.fragment),l=D(),s=b("div"),o=b("small"),o.textContent="New",r=D(),a=b("span"),u=J(f),d=D(),m=b("button"),m.innerHTML='<i class="ri-close-line"></i>',p(t,"class","thumb"),p(o,"class","label label-success m-r-5"),p(a,"class","txt"),p(s,"class","filename m-r-auto"),p(s,"title",c=n[29].name),p(m,"type","button"),p(m,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove"),p(e,"class","list-item"),ee(e,"dragging",n[32]),ee(e,"dragover",n[33])},m($,C){S($,e,C),y(e,t),z(i,t,null),y(e,l),y(e,s),y(s,o),y(s,r),y(s,a),y(a,u),y(e,d),y(e,m),h=!0,_||(g=[$e(Fe.call(null,m,"Remove file")),Z(m,"click",v)],_=!0)},p($,C){n=$;const T={};C[0]&2&&(T.file=n[29]),i.$set(T),(!h||C[0]&2)&&f!==(f=n[29].name+"")&&re(u,f),(!h||C[0]&2&&c!==(c=n[29].name))&&p(s,"title",c),(!h||C[1]&2)&&ee(e,"dragging",n[32]),(!h||C[1]&4)&&ee(e,"dragover",n[33])},i($){h||(I(i.$$.fragment,$),h=!0)},o($){L(i.$$.fragment,$),h=!1},d($){$&&w(e),V(i),_=!1,Te(g)}}}function Xp(n,e){let t,i,l,s;function o(a){e[20](a)}let r={group:e[4].name+"_new",index:e[31],disabled:!e[6],$$slots:{default:[HO,({dragging:a,dragover:f})=>({32:a,33:f}),({dragging:a,dragover:f})=>[0,(a?2:0)|(f?4:0)]]},$$scope:{ctx:e}};return e[1]!==void 0&&(r.list=e[1]),i=new Ds({props:r}),te.push(()=>ke(i,"list",o)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&16&&(u.group=e[4].name+"_new"),f[0]&2&&(u.index=e[31]),f[0]&64&&(u.disabled=!e[6]),f[0]&2|f[1]&70&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&2&&(l=!0,u.list=e[1],ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function zO(n){let e,t,i,l,s,o=n[4].name+"",r,a,f,u,c=[],d=new Map,m,h=[],_=new Map,g,v,$,C,T,O,M,E,A,N,q,R,P=ce(n[5]);const F=Y=>Y[34]+Y[3].id;for(let Y=0;Y<P.length;Y+=1){let X=Zp(n,P,Y),W=F(X);d.set(W,c[Y]=Gp(W,X))}let j=ce(n[1]);const U=Y=>Y[29].name+Y[31];for(let Y=0;Y<j.length;Y+=1){let X=Jp(n,j,Y),W=U(X);_.set(W,h[Y]=Xp(W,X))}return{c(){var Y,X;e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),u=b("div");for(let W=0;W<c.length;W+=1)c[W].c();m=D();for(let W=0;W<h.length;W+=1)h[W].c();g=D(),v=b("div"),$=b("input"),T=D(),O=b("button"),M=b("i"),E=D(),A=b("span"),A.textContent="Upload new file",p(t,"class",i=H.getFieldTypeIcon(n[4].type)),p(s,"class","txt"),p(e,"for",a=n[28]),p($,"type","file"),p($,"class","hidden"),p($,"accept",C=((X=(Y=n[4].options)==null?void 0:Y.mimeTypes)==null?void 0:X.join(","))||null),$.multiple=n[6],p(M,"class","ri-upload-cloud-line"),p(A,"class","txt"),p(O,"type","button"),p(O,"class","btn btn-transparent btn-sm btn-block"),O.disabled=n[11],p(v,"class","list-item list-item-btn"),p(u,"class","list")},m(Y,X){S(Y,e,X),y(e,t),y(e,l),y(e,s),y(s,r),S(Y,f,X),S(Y,u,X);for(let W=0;W<c.length;W+=1)c[W]&&c[W].m(u,null);y(u,m);for(let W=0;W<h.length;W+=1)h[W]&&h[W].m(u,null);y(u,g),y(u,v),y(v,$),n[21]($),y(v,T),y(v,O),y(O,M),y(O,E),y(O,A),n[24](u),N=!0,q||(R=[Z($,"change",n[22]),Z(O,"click",n[23])],q=!0)},p(Y,X){var W,K;(!N||X[0]&16&&i!==(i=H.getFieldTypeIcon(Y[4].type)))&&p(t,"class",i),(!N||X[0]&16)&&o!==(o=Y[4].name+"")&&re(r,o),(!N||X[0]&268435456&&a!==(a=Y[28]))&&p(e,"for",a),X[0]&13437|X[1]&6&&(P=ce(Y[5]),se(),c=ft(c,X,F,1,Y,P,d,u,It,Gp,m,Zp),oe()),X[0]&16466|X[1]&6&&(j=ce(Y[1]),se(),h=ft(h,X,U,1,Y,j,_,u,It,Xp,g,Jp),oe()),(!N||X[0]&16&&C!==(C=((K=(W=Y[4].options)==null?void 0:W.mimeTypes)==null?void 0:K.join(","))||null))&&p($,"accept",C),(!N||X[0]&64)&&($.multiple=Y[6]),(!N||X[0]&2048)&&(O.disabled=Y[11])},i(Y){if(!N){for(let X=0;X<P.length;X+=1)I(c[X]);for(let X=0;X<j.length;X+=1)I(h[X]);N=!0}},o(Y){for(let X=0;X<c.length;X+=1)L(c[X]);for(let X=0;X<h.length;X+=1)L(h[X]);N=!1},d(Y){Y&&(w(e),w(f),w(u));for(let X=0;X<c.length;X+=1)c[X].d();for(let X=0;X<h.length;X+=1)h[X].d();n[21](null),n[24](null),q=!1,Te(R)}}}function VO(n){let e,t,i,l,s;return t=new de({props:{class:`
form-field form-field-list form-field-file
`+(n[4].required?"required":"")+`
`+(n[9]?"dragover":"")+`
`,name:n[4].name,$$slots:{default:[zO,({uniqueId:o})=>({28:o}),({uniqueId:o})=>[o?268435456:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","block")},m(o,r){S(o,e,r),z(t,e,null),i=!0,l||(s=[Z(e,"dragover",Ue(n[25])),Z(e,"dragleave",n[26]),Z(e,"drop",n[15])],l=!0)},p(o,r){const a={};r[0]&528&&(a.class=`
form-field form-field-list form-field-file
`+(o[4].required?"required":"")+`
`+(o[9]?"dragover":"")+`
`),r[0]&16&&(a.name=o[4].name),r[0]&268439039|r[1]&64&&(a.$$scope={dirty:r,ctx:o}),t.$set(a)},i(o){i||(I(t.$$.fragment,o),i=!0)},o(o){L(t.$$.fragment,o),i=!1},d(o){o&&w(e),V(t),l=!1,Te(s)}}}function BO(n,e,t){let i,l,s,{record:o}=e,{field:r}=e,{value:a=""}=e,{uploadedFiles:f=[]}=e,{deletedFileNames:u=[]}=e,c,d,m=!1,h="";function _(U){H.removeByValue(u,U),t(2,u)}function g(U){H.pushUnique(u,U),t(2,u)}function v(U){H.isEmpty(f[U])||f.splice(U,1),t(1,f)}function $(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:a,uploadedFiles:f,deletedFileNames:u},bubbles:!0}))}function C(U){var X,W;U.preventDefault(),t(9,m=!1);const Y=((X=U.dataTransfer)==null?void 0:X.files)||[];if(!(s||!Y.length)){for(const K of Y){const le=l.length+f.length-u.length;if(((W=r.options)==null?void 0:W.maxSelect)<=le)break;f.push(K)}t(1,f)}}zt(async()=>{t(10,h=await fe.getAdminFileToken(o.collectionId))});const T=U=>_(U),O=U=>g(U);function M(U){a=U,t(0,a),t(6,i),t(4,r)}const E=U=>v(U);function A(U){f=U,t(1,f)}function N(U){te[U?"unshift":"push"](()=>{c=U,t(7,c)})}const q=()=>{for(let U of c.files)f.push(U);t(1,f),t(7,c.value=null,c)},R=()=>c==null?void 0:c.click();function P(U){te[U?"unshift":"push"](()=>{d=U,t(8,d)})}const F=()=>{t(9,m=!0)},j=()=>{t(9,m=!1)};return n.$$set=U=>{"record"in U&&t(3,o=U.record),"field"in U&&t(4,r=U.field),"value"in U&&t(0,a=U.value),"uploadedFiles"in U&&t(1,f=U.uploadedFiles),"deletedFileNames"in U&&t(2,u=U.deletedFileNames)},n.$$.update=()=>{var U,Y;n.$$.dirty[0]&2&&(Array.isArray(f)||t(1,f=H.toArray(f))),n.$$.dirty[0]&4&&(Array.isArray(u)||t(2,u=H.toArray(u))),n.$$.dirty[0]&16&&t(6,i=((U=r.options)==null?void 0:U.maxSelect)>1),n.$$.dirty[0]&65&&H.isEmpty(a)&&t(0,a=i?[]:""),n.$$.dirty[0]&1&&t(5,l=H.toArray(a)),n.$$.dirty[0]&54&&t(11,s=(l.length||f.length)&&((Y=r.options)==null?void 0:Y.maxSelect)<=l.length+f.length-u.length),n.$$.dirty[0]&6&&(f!==-1||u!==-1)&&$()},[a,f,u,o,r,l,i,c,d,m,h,s,_,g,v,C,T,O,M,E,A,N,q,R,P,F,j]}class UO extends be{constructor(e){super(),ge(this,e,BO,VO,he,{record:3,field:4,value:0,uploadedFiles:1,deletedFileNames:2},null,[-1,-1])}}function Qp(n){return typeof n=="function"?{threshold:100,callback:n}:n||{}}function WO(n,e){e=Qp(e),e!=null&&e.callback&&e.callback();function t(i){if(!(e!=null&&e.callback))return;i.target.scrollHeight-i.target.clientHeight-i.target.scrollTop<=e.threshold&&e.callback()}return n.addEventListener("scroll",t),n.addEventListener("resize",t),{update(i){e=Qp(i)},destroy(){n.removeEventListener("scroll",t),n.removeEventListener("resize",t)}}}function xp(n,e,t){const i=n.slice();i[6]=e[t];const l=H.toArray(i[0][i[6]]).slice(0,5);return i[7]=l,i}function em(n,e,t){const i=n.slice();return i[10]=e[t],i}function tm(n){let e,t;return e=new Wa({props:{record:n[0],filename:n[10],size:"xs"}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&1&&(s.record=i[0]),l&3&&(s.filename=i[10]),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function nm(n){let e=!H.isEmpty(n[10]),t,i,l=e&&tm(n);return{c(){l&&l.c(),t=ve()},m(s,o){l&&l.m(s,o),S(s,t,o),i=!0},p(s,o){o&3&&(e=!H.isEmpty(s[10])),e?l?(l.p(s,o),o&3&&I(l,1)):(l=tm(s),l.c(),I(l,1),l.m(t.parentNode,t)):l&&(se(),L(l,1,1,()=>{l=null}),oe())},i(s){i||(I(l),i=!0)},o(s){L(l),i=!1},d(s){s&&w(t),l&&l.d(s)}}}function im(n){let e,t,i=ce(n[7]),l=[];for(let o=0;o<i.length;o+=1)l[o]=nm(em(n,i,o));const s=o=>L(l[o],1,1,()=>{l[o]=null});return{c(){for(let o=0;o<l.length;o+=1)l[o].c();e=ve()},m(o,r){for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(o,r);S(o,e,r),t=!0},p(o,r){if(r&3){i=ce(o[7]);let a;for(a=0;a<i.length;a+=1){const f=em(o,i,a);l[a]?(l[a].p(f,r),I(l[a],1)):(l[a]=nm(f),l[a].c(),I(l[a],1),l[a].m(e.parentNode,e))}for(se(),a=i.length;a<l.length;a+=1)s(a);oe()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)I(l[r]);t=!0}},o(o){l=l.filter(Boolean);for(let r=0;r<l.length;r+=1)L(l[r]);t=!1},d(o){o&&w(e),rt(l,o)}}}function YO(n){let e,t,i,l,s,o,r=H.truncate(H.displayValue(n[0],n[2]),70)+"",a,f,u,c,d=ce(n[1]),m=[];for(let _=0;_<d.length;_+=1)m[_]=im(xp(n,d,_));const h=_=>L(m[_],1,1,()=>{m[_]=null});return{c(){e=b("div"),t=b("i"),l=D();for(let _=0;_<m.length;_+=1)m[_].c();s=D(),o=b("span"),a=J(r),p(t,"class","link-hint txt-sm ri-information-line"),p(o,"class","txt txt-ellipsis"),p(e,"class","record-info svelte-q8liga")},m(_,g){S(_,e,g),y(e,t),y(e,l);for(let v=0;v<m.length;v+=1)m[v]&&m[v].m(e,null);y(e,s),y(e,o),y(o,a),f=!0,u||(c=$e(i=Fe.call(null,t,{text:H.truncate(JSON.stringify(H.truncateObject(n[0]),null,2),800,!0),class:"code",position:"left"})),u=!0)},p(_,[g]){if(i&&Ot(i.update)&&g&1&&i.update.call(null,{text:H.truncate(JSON.stringify(H.truncateObject(_[0]),null,2),800,!0),class:"code",position:"left"}),g&3){d=ce(_[1]);let v;for(v=0;v<d.length;v+=1){const $=xp(_,d,v);m[v]?(m[v].p($,g),I(m[v],1)):(m[v]=im($),m[v].c(),I(m[v],1),m[v].m(e,s))}for(se(),v=d.length;v<m.length;v+=1)h(v);oe()}(!f||g&5)&&r!==(r=H.truncate(H.displayValue(_[0],_[2]),70)+"")&&re(a,r)},i(_){if(!f){for(let g=0;g<d.length;g+=1)I(m[g]);f=!0}},o(_){m=m.filter(Boolean);for(let g=0;g<m.length;g+=1)L(m[g]);f=!1},d(_){_&&w(e),rt(m,_),u=!1,c()}}}function KO(n,e,t){let i,l;We(n,qn,f=>t(4,l=f));let{record:s}=e,o=[],r=[];function a(){const f=(i==null?void 0:i.schema)||[];if(t(1,o=f.filter(u=>u.presentable&&u.type=="file").map(u=>u.name)),t(2,r=f.filter(u=>u.presentable&&u.type!="file").map(u=>u.name)),!o.length&&!r.length){const u=f.find(c=>{var d,m,h;return c.type=="file"&&((d=c.options)==null?void 0:d.maxSelect)==1&&((h=(m=c.options)==null?void 0:m.mimeTypes)==null?void 0:h.find(_=>_.startsWith("image/")))});u&&o.push(u.name)}}return n.$$set=f=>{"record"in f&&t(0,s=f.record)},n.$$.update=()=>{n.$$.dirty&17&&t(3,i=l==null?void 0:l.find(f=>f.id==(s==null?void 0:s.collectionId))),n.$$.dirty&8&&i&&a()},[s,o,r,i,l]}class er extends be{constructor(e){super(),ge(this,e,KO,YO,he,{record:0})}}function lm(n,e,t){const i=n.slice();return i[49]=e[t],i[51]=t,i}function sm(n,e,t){const i=n.slice();i[49]=e[t];const l=i[9](i[49]);return i[6]=l,i}function om(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<div class="txt">New record</div>',p(e,"type","button"),p(e,"class","btn btn-pill btn-transparent btn-hint p-l-xs p-r-xs")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[31]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function rm(n){let e,t=!n[13]&&am(n);return{c(){t&&t.c(),e=ve()},m(i,l){t&&t.m(i,l),S(i,e,l)},p(i,l){i[13]?t&&(t.d(1),t=null):t?t.p(i,l):(t=am(i),t.c(),t.m(e.parentNode,e))},d(i){i&&w(e),t&&t.d(i)}}}function am(n){var s;let e,t,i,l=((s=n[2])==null?void 0:s.length)&&fm(n);return{c(){e=b("div"),t=b("span"),t.textContent="No records found.",i=D(),l&&l.c(),p(t,"class","txt txt-hint"),p(e,"class","list-item")},m(o,r){S(o,e,r),y(e,t),y(e,i),l&&l.m(e,null)},p(o,r){var a;(a=o[2])!=null&&a.length?l?l.p(o,r):(l=fm(o),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},d(o){o&&w(e),l&&l.d()}}}function fm(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-sm")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[35]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function JO(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-blank-circle-line txt-disabled")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function ZO(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function um(n){let e,t,i,l;function s(){return n[32](n[49])}return{c(){e=b("div"),t=b("button"),t.innerHTML='<i class="ri-pencil-line"></i>',p(t,"type","button"),p(t,"class","btn btn-sm btn-circle btn-transparent btn-hint m-l-auto"),p(e,"class","actions nonintrusive")},m(o,r){S(o,e,r),y(e,t),i||(l=[$e(Fe.call(null,t,"Edit")),Z(t,"keydown",Cn(n[27])),Z(t,"click",Cn(s))],i=!0)},p(o,r){n=o},d(o){o&&w(e),i=!1,Te(l)}}}function cm(n,e){let t,i,l,s,o,r,a,f;function u(g,v){return g[6]?ZO:JO}let c=u(e),d=c(e);s=new er({props:{record:e[49]}});let m=!e[11]&&um(e);function h(){return e[33](e[49])}function _(...g){return e[34](e[49],...g)}return{key:n,first:null,c(){t=b("div"),d.c(),i=D(),l=b("div"),B(s.$$.fragment),o=D(),m&&m.c(),p(l,"class","content"),p(t,"tabindex","0"),p(t,"class","list-item handle"),ee(t,"selected",e[6]),ee(t,"disabled",!e[6]&&e[4]>1&&!e[10]),this.first=t},m(g,v){S(g,t,v),d.m(t,null),y(t,i),y(t,l),z(s,l,null),y(t,o),m&&m.m(t,null),r=!0,a||(f=[Z(t,"click",h),Z(t,"keydown",_)],a=!0)},p(g,v){e=g,c!==(c=u(e))&&(d.d(1),d=c(e),d&&(d.c(),d.m(t,i)));const $={};v[0]&256&&($.record=e[49]),s.$set($),e[11]?m&&(m.d(1),m=null):m?m.p(e,v):(m=um(e),m.c(),m.m(t,null)),(!r||v[0]&768)&&ee(t,"selected",e[6]),(!r||v[0]&1808)&&ee(t,"disabled",!e[6]&&e[4]>1&&!e[10])},i(g){r||(I(s.$$.fragment,g),r=!0)},o(g){L(s.$$.fragment,g),r=!1},d(g){g&&w(t),d.d(),V(s),m&&m.d(),a=!1,Te(f)}}}function dm(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="block txt-center"><span class="loader loader-sm active"></span></div>',p(e,"class","list-item")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function pm(n){let e,t=n[6].length+"",i,l,s,o;return{c(){e=J("("),i=J(t),l=J(" of MAX "),s=J(n[4]),o=J(")")},m(r,a){S(r,e,a),S(r,i,a),S(r,l,a),S(r,s,a),S(r,o,a)},p(r,a){a[0]&64&&t!==(t=r[6].length+"")&&re(i,t),a[0]&16&&re(s,r[4])},d(r){r&&(w(e),w(i),w(l),w(s),w(o))}}}function GO(n){let e;return{c(){e=b("p"),e.textContent="No selected records.",p(e,"class","txt-hint")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function XO(n){let e,t,i=ce(n[6]),l=[];for(let o=0;o<i.length;o+=1)l[o]=mm(lm(n,i,o));const s=o=>L(l[o],1,1,()=>{l[o]=null});return{c(){e=b("div");for(let o=0;o<l.length;o+=1)l[o].c();p(e,"class","selected-list svelte-1u8jhky")},m(o,r){S(o,e,r);for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(e,null);t=!0},p(o,r){if(r[0]&65600|r[1]&6291456){i=ce(o[6]);let a;for(a=0;a<i.length;a+=1){const f=lm(o,i,a);l[a]?(l[a].p(f,r),I(l[a],1)):(l[a]=mm(f),l[a].c(),I(l[a],1),l[a].m(e,null))}for(se(),a=i.length;a<l.length;a+=1)s(a);oe()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)I(l[r]);t=!0}},o(o){l=l.filter(Boolean);for(let r=0;r<l.length;r+=1)L(l[r]);t=!1},d(o){o&&w(e),rt(l,o)}}}function QO(n){let e,t,i,l,s,o,r,a;t=new er({props:{record:n[49]}});function f(){return n[37](n[49])}return{c(){e=b("span"),B(t.$$.fragment),i=D(),l=b("button"),l.innerHTML='<i class="ri-close-line"></i>',s=D(),p(l,"type","button"),p(l,"title","Remove"),p(l,"class","btn btn-circle btn-transparent btn-hint btn-xs"),p(e,"class","label"),ee(e,"label-danger",n[52]),ee(e,"label-warning",n[53])},m(u,c){S(u,e,c),z(t,e,null),y(e,i),y(e,l),S(u,s,c),o=!0,r||(a=Z(l,"click",f),r=!0)},p(u,c){n=u;const d={};c[0]&64&&(d.record=n[49]),t.$set(d),(!o||c[1]&2097152)&&ee(e,"label-danger",n[52]),(!o||c[1]&4194304)&&ee(e,"label-warning",n[53])},i(u){o||(I(t.$$.fragment,u),o=!0)},o(u){L(t.$$.fragment,u),o=!1},d(u){u&&(w(e),w(s)),V(t),r=!1,a()}}}function mm(n){let e,t,i;function l(o){n[38](o)}let s={index:n[51],$$slots:{default:[QO,({dragging:o,dragover:r})=>({52:o,53:r}),({dragging:o,dragover:r})=>[0,(o?2097152:0)|(r?4194304:0)]]},$$scope:{ctx:n}};return n[6]!==void 0&&(s.list=n[6]),e=new Ds({props:s}),te.push(()=>ke(e,"list",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[0]&64|r[1]&39845888&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&64&&(t=!0,a.list=o[6],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function xO(n){let e,t,i,l,s,o=[],r=new Map,a,f,u,c,d,m,h,_,g,v,$,C;t=new Ts({props:{value:n[2],autocompleteCollection:n[5]}}),t.$on("submit",n[30]);let T=!n[11]&&om(n),O=ce(n[8]);const M=F=>F[49].id;for(let F=0;F<O.length;F+=1){let j=sm(n,O,F),U=M(j);r.set(U,o[F]=cm(U,j))}let E=null;O.length||(E=rm(n));let A=n[13]&&dm(),N=n[4]>1&&pm(n);const q=[XO,GO],R=[];function P(F,j){return F[6].length?0:1}return h=P(n),_=R[h]=q[h](n),{c(){e=b("div"),B(t.$$.fragment),i=D(),T&&T.c(),l=D(),s=b("div");for(let F=0;F<o.length;F+=1)o[F].c();E&&E.c(),a=D(),A&&A.c(),u=D(),c=b("h5"),d=J(`Selected
`),N&&N.c(),m=D(),_.c(),g=ve(),p(e,"class","flex m-b-base flex-gap-10"),p(s,"class","list picker-list m-b-base svelte-1u8jhky"),p(c,"class","section-title")},m(F,j){S(F,e,j),z(t,e,null),y(e,i),T&&T.m(e,null),S(F,l,j),S(F,s,j);for(let U=0;U<o.length;U+=1)o[U]&&o[U].m(s,null);E&&E.m(s,null),y(s,a),A&&A.m(s,null),S(F,u,j),S(F,c,j),y(c,d),N&&N.m(c,null),S(F,m,j),R[h].m(F,j),S(F,g,j),v=!0,$||(C=$e(f=WO.call(null,s,n[36])),$=!0)},p(F,j){const U={};j[0]&4&&(U.value=F[2]),j[0]&32&&(U.autocompleteCollection=F[5]),t.$set(U),F[11]?T&&(T.d(1),T=null):T?T.p(F,j):(T=om(F),T.c(),T.m(e,null)),j[0]&143252&&(O=ce(F[8]),se(),o=ft(o,j,M,1,F,O,r,s,It,cm,a,sm),oe(),!O.length&&E?E.p(F,j):O.length?E&&(E.d(1),E=null):(E=rm(F),E.c(),E.m(s,a))),F[13]?A||(A=dm(),A.c(),A.m(s,null)):A&&(A.d(1),A=null),f&&Ot(f.update)&&j[0]&4104&&f.update.call(null,F[36]),F[4]>1?N?N.p(F,j):(N=pm(F),N.c(),N.m(c,null)):N&&(N.d(1),N=null);let Y=h;h=P(F),h===Y?R[h].p(F,j):(se(),L(R[Y],1,1,()=>{R[Y]=null}),oe(),_=R[h],_?_.p(F,j):(_=R[h]=q[h](F),_.c()),I(_,1),_.m(g.parentNode,g))},i(F){if(!v){I(t.$$.fragment,F);for(let j=0;j<O.length;j+=1)I(o[j]);I(_),v=!0}},o(F){L(t.$$.fragment,F);for(let j=0;j<o.length;j+=1)L(o[j]);L(_),v=!1},d(F){F&&(w(e),w(l),w(s),w(u),w(c),w(m),w(g)),V(t),T&&T.d();for(let j=0;j<o.length;j+=1)o[j].d();E&&E.d(),A&&A.d(),N&&N.d(),R[h].d(F),$=!1,C()}}}function eM(n){var r;let e,t,i,l=(((r=n[5])==null?void 0:r.name)||"")+"",s,o;return{c(){e=b("h4"),t=J("Select "),i=b("strong"),s=J(l),o=J(" records")},m(a,f){S(a,e,f),y(e,t),y(e,i),y(i,s),y(e,o)},p(a,f){var u;f[0]&32&&l!==(l=(((u=a[5])==null?void 0:u.name)||"")+"")&&re(s,l)},d(a){a&&w(e)}}}function tM(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='<span class="txt">Cancel</span>',t=D(),i=b("button"),i.innerHTML='<span class="txt">Set selection</span>',p(e,"type","button"),p(e,"class","btn btn-transparent"),p(i,"type","button"),p(i,"class","btn")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),l||(s=[Z(e,"click",n[28]),Z(i,"click",n[29])],l=!0)},p:x,d(o){o&&(w(e),w(t),w(i)),l=!1,Te(s)}}}function nM(n){let e,t,i,l;const s=[{popup:!0},{class:"overlay-panel-xl"},n[19]];let o={$$slots:{footer:[tM],header:[eM],default:[xO]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=Ae(o,s[a]);e=new Xt({props:o}),n[39](e),e.$on("hide",n[40]),e.$on("show",n[41]);let r={collection:n[5]};return i=new Ka({props:r}),n[42](i),i.$on("save",n[43]),i.$on("delete",n[44]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(a,f){z(e,a,f),S(a,t,f),z(i,a,f),l=!0},p(a,f){const u=f[0]&524288?mt(s,[s[0],s[1],Mt(a[19])]):{};f[0]&16380|f[1]&33554432&&(u.$$scope={dirty:f,ctx:a}),e.$set(u);const c={};f[0]&32&&(c.collection=a[5]),i.$set(c)},i(a){l||(I(e.$$.fragment,a),I(i.$$.fragment,a),l=!0)},o(a){L(e.$$.fragment,a),L(i.$$.fragment,a),l=!1},d(a){a&&w(t),n[39](null),V(e,a),n[42](null),V(i,a)}}}const io=50;function iM(n,e,t){let i,l,s,o,r,a,f,u;const c=["value","field","show","hide"];let d=Xe(e,c),m;We(n,qn,Se=>t(26,m=Se));const h=st(),_="picker_"+H.randomString(5);let{value:g}=e,{field:v}=e,$,C,T="",O=[],M=[],E=1,A=0,N=!1,q=!1;function R(){return t(2,T=""),t(8,O=[]),t(6,M=[]),F(),j(!0),$==null?void 0:$.show()}function P(){return $==null?void 0:$.hide()}async function F(){const Se=H.toArray(g);if(!l||!Se.length)return;t(24,q=!0);let Ke=[];const Vt=Se.slice(),dn=[];for(;Vt.length>0;){const an=[];for(const jn of Vt.splice(0,io))an.push(`id="${jn}"`);dn.push(fe.collection(l).getFullList({batch:io,filter:an.join("||"),fields:"*:excerpt(200)",requestKey:null}))}try{await Promise.all(dn).then(an=>{Ke=Ke.concat(...an)}),t(6,M=[]);for(const an of Se){const jn=H.findByKey(Ke,"id",an);jn&&M.push(jn)}T.trim()||t(8,O=H.filterDuplicatesByKey(M.concat(O))),t(24,q=!1)}catch(an){an.isAbort||(fe.error(an),t(24,q=!1))}}async function j(Se=!1){if(l){t(3,N=!0),Se&&(T.trim()?t(8,O=[]):t(8,O=H.toArray(M).slice()));try{const Ke=Se?1:E+1,Vt=H.getAllCollectionIdentifiers(s),dn=await fe.collection(l).getList(Ke,io,{filter:H.normalizeSearchFilter(T,Vt),sort:o?"":"-created",fields:"*:excerpt(200)",skipTotal:1,requestKey:_+"loadList"});t(8,O=H.filterDuplicatesByKey(O.concat(dn.items))),E=dn.page,t(23,A=dn.items.length),t(3,N=!1)}catch(Ke){Ke.isAbort||(fe.error(Ke),t(3,N=!1))}}}function U(Se){i==1?t(6,M=[Se]):f&&(H.pushOrReplaceByKey(M,Se),t(6,M))}function Y(Se){H.removeByKey(M,"id",Se.id),t(6,M)}function X(Se){u(Se)?Y(Se):U(Se)}function W(){var Se;i!=1?t(20,g=M.map(Ke=>Ke.id)):t(20,g=((Se=M==null?void 0:M[0])==null?void 0:Se.id)||""),h("save",M),P()}function K(Se){Oe.call(this,n,Se)}const le=()=>P(),ne=()=>W(),me=Se=>t(2,T=Se.detail),Pe=()=>C==null?void 0:C.show(),ze=Se=>C==null?void 0:C.show(Se),Qe=Se=>X(Se),et=(Se,Ke)=>{(Ke.code==="Enter"||Ke.code==="Space")&&(Ke.preventDefault(),Ke.stopPropagation(),X(Se))},Dt=()=>t(2,T=""),ut=()=>{a&&!N&&j()},ht=Se=>Y(Se);function Qt(Se){M=Se,t(6,M)}function Ee(Se){te[Se?"unshift":"push"](()=>{$=Se,t(1,$)})}function Le(Se){Oe.call(this,n,Se)}function Ve(Se){Oe.call(this,n,Se)}function bt(Se){te[Se?"unshift":"push"](()=>{C=Se,t(7,C)})}const pe=Se=>{H.removeByKey(O,"id",Se.detail.record.id),O.unshift(Se.detail.record),t(8,O),U(Se.detail.record)},we=Se=>{H.removeByKey(O,"id",Se.detail.id),t(8,O),Y(Se.detail)};return n.$$set=Se=>{e=Ae(Ae({},e),Kt(Se)),t(19,d=Xe(e,c)),"value"in Se&&t(20,g=Se.value),"field"in Se&&t(21,v=Se.field)},n.$$.update=()=>{var Se,Ke;n.$$.dirty[0]&2097152&&t(4,i=((Se=v==null?void 0:v.options)==null?void 0:Se.maxSelect)||null),n.$$.dirty[0]&2097152&&t(25,l=(Ke=v==null?void 0:v.options)==null?void 0:Ke.collectionId),n.$$.dirty[0]&100663296&&t(5,s=m.find(Vt=>Vt.id==l)||null),n.$$.dirty[0]&6&&typeof T<"u"&&$!=null&&$.isActive()&&j(!0),n.$$.dirty[0]&32&&t(11,o=(s==null?void 0:s.type)==="view"),n.$$.dirty[0]&16777224&&t(13,r=N||q),n.$$.dirty[0]&8388608&&t(12,a=A==io),n.$$.dirty[0]&80&&t(10,f=i===null||i>M.length),n.$$.dirty[0]&64&&t(9,u=function(Vt){return H.findByKey(M,"id",Vt.id)})},[P,$,T,N,i,s,M,C,O,u,f,o,a,r,j,U,Y,X,W,d,g,v,R,A,q,l,m,K,le,ne,me,Pe,ze,Qe,et,Dt,ut,ht,Qt,Ee,Le,Ve,bt,pe,we]}class lM extends be{constructor(e){super(),ge(this,e,iM,nM,he,{value:20,field:21,show:22,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[22]}get hide(){return this.$$.ctx[0]}}function hm(n,e,t){const i=n.slice();return i[21]=e[t],i[23]=t,i}function _m(n,e,t){const i=n.slice();return i[26]=e[t],i}function gm(n){let e,t,i,l;return{c(){e=b("i"),p(e,"class","ri-error-warning-line link-hint m-l-auto flex-order-10")},m(s,o){S(s,e,o),i||(l=$e(t=Fe.call(null,e,{position:"left",text:"The following relation ids were removed from the list because they are missing or invalid: "+n[6].join(", ")})),i=!0)},p(s,o){t&&Ot(t.update)&&o&64&&t.update.call(null,{position:"left",text:"The following relation ids were removed from the list because they are missing or invalid: "+s[6].join(", ")})},d(s){s&&w(e),i=!1,l()}}}function bm(n){let e,t=n[5]&&km(n);return{c(){t&&t.c(),e=ve()},m(i,l){t&&t.m(i,l),S(i,e,l)},p(i,l){i[5]?t?t.p(i,l):(t=km(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){i&&w(e),t&&t.d(i)}}}function km(n){let e,t=ce(H.toArray(n[0]).slice(0,10)),i=[];for(let l=0;l<t.length;l+=1)i[l]=ym(_m(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);S(l,e,s)},p(l,s){if(s&1){t=ce(H.toArray(l[0]).slice(0,10));let o;for(o=0;o<t.length;o+=1){const r=_m(l,t,o);i[o]?i[o].p(r,s):(i[o]=ym(),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&w(e),rt(i,l)}}}function ym(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="skeleton-loader"></div> ',p(e,"class","list-item")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function sM(n){let e,t,i,l,s,o,r,a,f,u;i=new er({props:{record:n[21]}});function c(){return n[11](n[21])}return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),o=b("button"),o.innerHTML='<i class="ri-close-line"></i>',r=D(),p(t,"class","content"),p(o,"type","button"),p(o,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove"),p(s,"class","actions"),p(e,"class","list-item"),ee(e,"dragging",n[24]),ee(e,"dragover",n[25])},m(d,m){S(d,e,m),y(e,t),z(i,t,null),y(e,l),y(e,s),y(s,o),S(d,r,m),a=!0,f||(u=[$e(Fe.call(null,o,"Remove")),Z(o,"click",c)],f=!0)},p(d,m){n=d;const h={};m&16&&(h.record=n[21]),i.$set(h),(!a||m&16777216)&&ee(e,"dragging",n[24]),(!a||m&33554432)&&ee(e,"dragover",n[25])},i(d){a||(I(i.$$.fragment,d),a=!0)},o(d){L(i.$$.fragment,d),a=!1},d(d){d&&(w(e),w(r)),V(i),f=!1,Te(u)}}}function vm(n,e){let t,i,l,s;function o(a){e[12](a)}let r={group:e[2].name+"_relation",index:e[23],disabled:!e[7],$$slots:{default:[sM,({dragging:a,dragover:f})=>({24:a,25:f}),({dragging:a,dragover:f})=>(a?16777216:0)|(f?33554432:0)]},$$scope:{ctx:e}};return e[4]!==void 0&&(r.list=e[4]),i=new Ds({props:r}),te.push(()=>ke(i,"list",o)),i.$on("sort",e[13]),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&4&&(u.group=e[2].name+"_relation"),f&16&&(u.index=e[23]),f&128&&(u.disabled=!e[7]),f&587202576&&(u.$$scope={dirty:f,ctx:e}),!l&&f&16&&(l=!0,u.list=e[4],ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function oM(n){let e,t,i,l,s,o=n[2].name+"",r,a,f,u,c,d,m=[],h=new Map,_,g,v,$,C,T,O=n[6].length&&gm(n),M=ce(n[4]);const E=N=>N[21].id;for(let N=0;N<M.length;N+=1){let q=hm(n,M,N),R=E(q);h.set(R,m[N]=vm(R,q))}let A=null;return M.length||(A=bm(n)),{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),a=D(),O&&O.c(),u=D(),c=b("div"),d=b("div");for(let N=0;N<m.length;N+=1)m[N].c();A&&A.c(),_=D(),g=b("div"),v=b("button"),v.innerHTML='<i class="ri-magic-line"></i> <span class="txt">Open picker</span>',p(t,"class",i=Yn(H.getFieldTypeIcon(n[2].type))+" svelte-1ynw0pc"),p(s,"class","txt"),p(e,"for",f=n[20]),p(d,"class","relations-list svelte-1ynw0pc"),p(v,"type","button"),p(v,"class","btn btn-transparent btn-sm btn-block"),p(g,"class","list-item list-item-btn"),p(c,"class","list")},m(N,q){S(N,e,q),y(e,t),y(e,l),y(e,s),y(s,r),y(e,a),O&&O.m(e,null),S(N,u,q),S(N,c,q),y(c,d);for(let R=0;R<m.length;R+=1)m[R]&&m[R].m(d,null);A&&A.m(d,null),y(c,_),y(c,g),y(g,v),$=!0,C||(T=Z(v,"click",n[14]),C=!0)},p(N,q){(!$||q&4&&i!==(i=Yn(H.getFieldTypeIcon(N[2].type))+" svelte-1ynw0pc"))&&p(t,"class",i),(!$||q&4)&&o!==(o=N[2].name+"")&&re(r,o),N[6].length?O?O.p(N,q):(O=gm(N),O.c(),O.m(e,null)):O&&(O.d(1),O=null),(!$||q&1048576&&f!==(f=N[20]))&&p(e,"for",f),q&50332597&&(M=ce(N[4]),se(),m=ft(m,q,E,1,N,M,h,d,It,vm,null,hm),oe(),!M.length&&A?A.p(N,q):M.length?A&&(A.d(1),A=null):(A=bm(N),A.c(),A.m(d,null)))},i(N){if(!$){for(let q=0;q<M.length;q+=1)I(m[q]);$=!0}},o(N){for(let q=0;q<m.length;q+=1)L(m[q]);$=!1},d(N){N&&(w(e),w(u),w(c)),O&&O.d();for(let q=0;q<m.length;q+=1)m[q].d();A&&A.d(),C=!1,T()}}}function rM(n){let e,t,i,l,s={class:"form-field form-field-list "+(n[2].required?"required":""),name:n[2].name,$$slots:{default:[oM,({uniqueId:r})=>({20:r}),({uniqueId:r})=>r?1048576:0]},$$scope:{ctx:n}};e=new de({props:s}),n[15](e);let o={value:n[0],field:n[2]};return i=new lM({props:o}),n[16](i),i.$on("save",n[17]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(r,a){z(e,r,a),S(r,t,a),z(i,r,a),l=!0},p(r,[a]){const f={};a&4&&(f.class="form-field form-field-list "+(r[2].required?"required":"")),a&4&&(f.name=r[2].name),a&537919735&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};a&1&&(u.value=r[0]),a&4&&(u.field=r[2]),i.$set(u)},i(r){l||(I(e.$$.fragment,r),I(i.$$.fragment,r),l=!0)},o(r){L(e.$$.fragment,r),L(i.$$.fragment,r),l=!1},d(r){r&&w(t),n[15](null),V(e,r),n[16](null),V(i,r)}}}const wm=100;function aM(n,e,t){let i,{field:l}=e,{value:s}=e,{picker:o}=e,r,a=[],f=!1,u,c=[];function d(){if(f)return!1;const E=H.toArray(s);return t(4,a=a.filter(A=>E.includes(A.id))),E.length!=a.length}async function m(){var q,R;const E=H.toArray(s);if(t(4,a=[]),t(6,c=[]),!((q=l==null?void 0:l.options)!=null&&q.collectionId)||!E.length){t(5,f=!1);return}t(5,f=!0);const A=E.slice(),N=[];for(;A.length>0;){const P=[];for(const F of A.splice(0,wm))P.push(`id="${F}"`);N.push(fe.collection((R=l==null?void 0:l.options)==null?void 0:R.collectionId).getFullList(wm,{filter:P.join("||"),fields:"*:excerpt(200)",requestKey:null}))}try{let P=[];await Promise.all(N).then(F=>{P=P.concat(...F)});for(const F of E){const j=H.findByKey(P,"id",F);j?a.push(j):c.push(F)}t(4,a),_()}catch(P){fe.error(P)}t(5,f=!1)}function h(E){H.removeByKey(a,"id",E.id),t(4,a),_()}function _(){var E;i?t(0,s=a.map(A=>A.id)):t(0,s=((E=a[0])==null?void 0:E.id)||"")}ys(()=>{clearTimeout(u)});const g=E=>h(E);function v(E){a=E,t(4,a)}const $=()=>{_()},C=()=>o==null?void 0:o.show();function T(E){te[E?"unshift":"push"](()=>{r=E,t(3,r)})}function O(E){te[E?"unshift":"push"](()=>{o=E,t(1,o)})}const M=E=>{var A;t(4,a=E.detail||[]),t(0,s=i?a.map(N=>N.id):((A=a[0])==null?void 0:A.id)||"")};return n.$$set=E=>{"field"in E&&t(2,l=E.field),"value"in E&&t(0,s=E.value),"picker"in E&&t(1,o=E.picker)},n.$$.update=()=>{var E;n.$$.dirty&4&&t(7,i=((E=l.options)==null?void 0:E.maxSelect)!=1),n.$$.dirty&9&&typeof s<"u"&&(r==null||r.changed()),n.$$.dirty&1041&&d()&&(t(5,f=!0),clearTimeout(u),t(10,u=setTimeout(m,0)))},[s,o,l,r,a,f,c,i,h,_,u,g,v,$,C,T,O,M]}class fM extends be{constructor(e){super(),ge(this,e,aM,rM,he,{field:2,value:0,picker:1})}}function uM(n){let e;return{c(){e=b("textarea"),p(e,"id",n[0]),k0(e,"visibility","hidden")},m(t,i){S(t,e,i),n[15](e)},p(t,i){i&1&&p(e,"id",t[0])},d(t){t&&w(e),n[15](null)}}}function cM(n){let e;return{c(){e=b("div"),p(e,"id",n[0])},m(t,i){S(t,e,i),n[14](e)},p(t,i){i&1&&p(e,"id",t[0])},d(t){t&&w(e),n[14](null)}}}function dM(n){let e;function t(s,o){return s[1]?cM:uM}let i=t(n),l=i(n);return{c(){e=b("div"),l.c(),p(e,"class",n[2])},m(s,o){S(s,e,o),l.m(e,null),n[16](e)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e,null))),o&4&&p(e,"class",s[2])},i:x,o:x,d(s){s&&w(e),l.d(),n[16](null)}}}function pM(){let n={listeners:[],scriptLoaded:!1,injected:!1};function e(i,l,s){n.injected=!0;const o=i.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.src=l,o.onload=()=>{s()},i.head&&i.head.appendChild(o)}function t(i,l,s){n.scriptLoaded?s():(n.listeners.push(s),n.injected||e(i,l,()=>{n.listeners.forEach(o=>o()),n.scriptLoaded=!0}))}return{load:t}}let mM=pM();function Ar(){return window&&window.tinymce?window.tinymce:null}function hM(n,e,t){let{id:i="tinymce_svelte"+H.randomString(7)}=e,{inline:l=void 0}=e,{disabled:s=!1}=e,{scriptSrc:o="./libs/tinymce/tinymce.min.js"}=e,{conf:r={}}=e,{modelEvents:a="change input undo redo"}=e,{value:f=""}=e,{text:u=""}=e,{cssClass:c="tinymce-wrapper"}=e;const d=["Activate","AddUndo","BeforeAddUndo","BeforeExecCommand","BeforeGetContent","BeforeRenderUI","BeforeSetContent","BeforePaste","Blur","Change","ClearUndos","Click","ContextMenu","Copy","Cut","Dblclick","Deactivate","Dirty","Drag","DragDrop","DragEnd","DragGesture","DragOver","Drop","ExecCommand","Focus","FocusIn","FocusOut","GetContent","Hide","Init","KeyDown","KeyPress","KeyUp","LoadContent","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","NodeChange","ObjectResizeStart","ObjectResized","ObjectSelected","Paste","PostProcess","PostRender","PreProcess","ProgressState","Redo","Remove","Reset","ResizeEditor","SaveContent","SelectionChange","SetAttrib","SetContent","Show","Submit","Undo","VisualAid"],m=(A,N)=>{d.forEach(q=>{A.on(q,R=>{N(q.toLowerCase(),{eventName:q,event:R,editor:A})})})};let h,_,g,v=f,$=s;const C=st();function T(){const A={...r,target:_,inline:l!==void 0?l:r.inline!==void 0?r.inline:!1,readonly:s,setup:N=>{t(11,g=N),N.on("init",()=>{N.setContent(f),N.on(a,()=>{t(12,v=N.getContent()),v!==f&&(t(5,f=v),t(6,u=N.getContent({format:"text"})))})}),m(N,C),typeof r.setup=="function"&&r.setup(N)}};t(4,_.style.visibility="",_),Ar().init(A)}zt(()=>(Ar()!==null?T():mM.load(h.ownerDocument,o,()=>{h&&T()}),()=>{var A,N;try{g&&((A=g.dom)==null||A.unbind(document),(N=Ar())==null||N.remove(g))}catch{}}));function O(A){te[A?"unshift":"push"](()=>{_=A,t(4,_)})}function M(A){te[A?"unshift":"push"](()=>{_=A,t(4,_)})}function E(A){te[A?"unshift":"push"](()=>{h=A,t(3,h)})}return n.$$set=A=>{"id"in A&&t(0,i=A.id),"inline"in A&&t(1,l=A.inline),"disabled"in A&&t(7,s=A.disabled),"scriptSrc"in A&&t(8,o=A.scriptSrc),"conf"in A&&t(9,r=A.conf),"modelEvents"in A&&t(10,a=A.modelEvents),"value"in A&&t(5,f=A.value),"text"in A&&t(6,u=A.text),"cssClass"in A&&t(2,c=A.cssClass)},n.$$.update=()=>{var A;if(n.$$.dirty&14496)try{g&&v!==f&&(g.setContent(f),t(6,u=g.getContent({format:"text"}))),g&&s!==$&&(t(13,$=s),typeof((A=g.mode)==null?void 0:A.set)=="function"?g.mode.set(s?"readonly":"design"):g.setMode(s?"readonly":"design"))}catch(N){console.warn("TinyMCE reactive error:",N)}},[i,l,c,h,_,f,u,s,o,r,a,g,v,$,O,M,E]}class Ya extends be{constructor(e){super(),ge(this,e,hM,dM,he,{id:0,inline:1,disabled:7,scriptSrc:8,conf:9,modelEvents:10,value:5,text:6,cssClass:2})}}function Sm(n,e,t){const i=n.slice();i[44]=e[t];const l=i[19](i[44]);return i[45]=l,i}function $m(n,e,t){const i=n.slice();return i[48]=e[t],i}function Tm(n,e,t){const i=n.slice();return i[51]=e[t],i}function _M(n){let e,t,i=[],l=new Map,s,o,r,a,f,u,c,d,m,h,_,g=ce(n[7]);const v=$=>$[51].id;for(let $=0;$<g.length;$+=1){let C=Tm(n,g,$),T=v(C);l.set(T,i[$]=Cm(T,C))}return a=new Ts({props:{value:n[4],placeholder:"Record search term or filter...",autocompleteCollection:n[8]}}),a.$on("submit",n[30]),d=new Xo({props:{class:"files-list",vThreshold:100,$$slots:{default:[wM]},$$scope:{ctx:n}}}),d.$on("vScrollEnd",n[32]),{c(){e=b("div"),t=b("aside");for(let $=0;$<i.length;$+=1)i[$].c();s=D(),o=b("div"),r=b("div"),B(a.$$.fragment),f=D(),u=b("button"),u.innerHTML='<div class="txt">New record</div>',c=D(),B(d.$$.fragment),p(t,"class","file-picker-sidebar"),p(u,"type","button"),p(u,"class","btn btn-pill btn-transparent btn-hint p-l-xs p-r-xs"),p(r,"class","flex m-b-base flex-gap-10"),p(o,"class","file-picker-content"),p(e,"class","file-picker")},m($,C){S($,e,C),y(e,t);for(let T=0;T<i.length;T+=1)i[T]&&i[T].m(t,null);y(e,s),y(e,o),y(o,r),z(a,r,null),y(r,f),y(r,u),y(o,c),z(d,o,null),m=!0,h||(_=Z(u,"click",n[31]),h=!0)},p($,C){C[0]&384&&(g=ce($[7]),i=ft(i,C,v,1,$,g,l,t,Ai,Cm,null,Tm));const T={};C[0]&16&&(T.value=$[4]),C[0]&256&&(T.autocompleteCollection=$[8]),a.$set(T);const O={};C[0]&98416|C[1]&8388608&&(O.$$scope={dirty:C,ctx:$}),d.$set(O)},i($){m||(I(a.$$.fragment,$),I(d.$$.fragment,$),m=!0)},o($){L(a.$$.fragment,$),L(d.$$.fragment,$),m=!1},d($){$&&w(e);for(let C=0;C<i.length;C+=1)i[C].d();V(a),V(d),h=!1,_()}}}function gM(n){let e;return{c(){e=b("h6"),e.innerHTML="You currently don&#39;t have any collection with <code>file</code> field.",p(e,"class","txt-center txt-hint")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function Cm(n,e){let t,i=e[51].name+"",l,s,o,r;function a(){return e[29](e[51])}return{key:n,first:null,c(){var f;t=b("button"),l=J(i),s=D(),p(t,"type","button"),p(t,"class","sidebar-item"),ee(t,"active",((f=e[8])==null?void 0:f.id)==e[51].id),this.first=t},m(f,u){S(f,t,u),y(t,l),y(t,s),o||(r=Z(t,"click",Ue(a)),o=!0)},p(f,u){var c;e=f,u[0]&128&&i!==(i=e[51].name+"")&&re(l,i),u[0]&384&&ee(t,"active",((c=e[8])==null?void 0:c.id)==e[51].id)},d(f){f&&w(t),o=!1,r()}}}function bM(n){var s;let e,t,i,l=((s=n[4])==null?void 0:s.length)&&Om(n);return{c(){e=b("div"),t=b("span"),t.textContent="No records with images found.",i=D(),l&&l.c(),p(t,"class","txt txt-hint"),p(e,"class","inline-flex")},m(o,r){S(o,e,r),y(e,t),y(e,i),l&&l.m(e,null)},p(o,r){var a;(a=o[4])!=null&&a.length?l?l.p(o,r):(l=Om(o),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},d(o){o&&w(e),l&&l.d()}}}function kM(n){let e=[],t=new Map,i,l=ce(n[5]);const s=o=>o[44].id;for(let o=0;o<l.length;o+=1){let r=Sm(n,l,o),a=s(r);t.set(a,e[o]=Dm(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=ve()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&1638432&&(l=ce(o[5]),e=ft(e,r,s,1,o,l,t,i.parentNode,Ai,Dm,i,Sm))},d(o){o&&w(i);for(let r=0;r<e.length;r+=1)e[r].d(o)}}}function Om(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear filter</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-sm")},m(l,s){S(l,e,s),t||(i=Z(e,"click",Ue(n[17])),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function yM(n){let e;return{c(){e=b("i"),p(e,"class","ri-file-3-line")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function vM(n){let e,t,i;return{c(){e=b("img"),p(e,"loading","lazy"),tn(e.src,t=fe.files.getUrl(n[44],n[48],{thumb:"100x100"}))||p(e,"src",t),p(e,"alt",i=n[48])},m(l,s){S(l,e,s)},p(l,s){s[0]&32&&!tn(e.src,t=fe.files.getUrl(l[44],l[48],{thumb:"100x100"}))&&p(e,"src",t),s[0]&32&&i!==(i=l[48])&&p(e,"alt",i)},d(l){l&&w(e)}}}function Mm(n){let e,t,i,l,s,o;function r(u,c){return c[0]&32&&(t=null),t==null&&(t=!!H.hasImageExtension(u[48])),t?vM:yM}let a=r(n,[-1,-1]),f=a(n);return{c(){e=b("button"),f.c(),i=D(),p(e,"type","button"),p(e,"class","thumb handle"),ee(e,"thumb-warning",n[16](n[44],n[48]))},m(u,c){S(u,e,c),f.m(e,null),y(e,i),s||(o=[$e(l=Fe.call(null,e,n[48]+`
(record: `+n[44].id+")")),Z(e,"click",Ue(function(){Ot(n[20](n[44],n[48]))&&n[20](n[44],n[48]).apply(this,arguments)}))],s=!0)},p(u,c){n=u,a===(a=r(n,c))&&f?f.p(n,c):(f.d(1),f=a(n),f&&(f.c(),f.m(e,i))),l&&Ot(l.update)&&c[0]&32&&l.update.call(null,n[48]+`
(record: `+n[44].id+")"),c[0]&589856&&ee(e,"thumb-warning",n[16](n[44],n[48]))},d(u){u&&w(e),f.d(),s=!1,Te(o)}}}function Dm(n,e){let t,i,l=ce(e[45]),s=[];for(let o=0;o<l.length;o+=1)s[o]=Mm($m(e,l,o));return{key:n,first:null,c(){t=ve();for(let o=0;o<s.length;o+=1)s[o].c();i=ve(),this.first=t},m(o,r){S(o,t,r);for(let a=0;a<s.length;a+=1)s[a]&&s[a].m(o,r);S(o,i,r)},p(o,r){if(e=o,r[0]&1638432){l=ce(e[45]);let a;for(a=0;a<l.length;a+=1){const f=$m(e,l,a);s[a]?s[a].p(f,r):(s[a]=Mm(f),s[a].c(),s[a].m(i.parentNode,i))}for(;a<s.length;a+=1)s[a].d(1);s.length=l.length}},d(o){o&&(w(t),w(i)),rt(s,o)}}}function Em(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader loader-sm active"></span>',p(e,"class","block txt-center")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function wM(n){let e,t;function i(r,a){if(r[15])return kM;if(!r[6])return bM}let l=i(n),s=l&&l(n),o=n[6]&&Em();return{c(){s&&s.c(),e=D(),o&&o.c(),t=ve()},m(r,a){s&&s.m(r,a),S(r,e,a),o&&o.m(r,a),S(r,t,a)},p(r,a){l===(l=i(r))&&s?s.p(r,a):(s&&s.d(1),s=l&&l(r),s&&(s.c(),s.m(e.parentNode,e))),r[6]?o||(o=Em(),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null)},d(r){r&&(w(e),w(t)),s&&s.d(r),o&&o.d(r)}}}function SM(n){let e,t,i,l;const s=[gM,_M],o=[];function r(a,f){return a[7].length?1:0}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}function $M(n){let e,t;return{c(){e=b("h4"),t=J(n[0])},m(i,l){S(i,e,l),y(e,t)},p(i,l){l[0]&1&&re(t,i[0])},d(i){i&&w(e)}}}function Im(n){let e,t;return e=new de({props:{class:"form-field file-picker-size-select",$$slots:{default:[TM,({uniqueId:i})=>({23:i}),({uniqueId:i})=>[i?8388608:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[0]&8402944|l[1]&8388608&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function TM(n){let e,t,i;function l(o){n[28](o)}let s={upside:!0,id:n[23],items:n[11],disabled:!n[13],selectPlaceholder:"Select size"};return n[12]!==void 0&&(s.keyOfSelected=n[12]),e=new _i({props:s}),te.push(()=>ke(e,"keyOfSelected",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[0]&8388608&&(a.id=o[23]),r[0]&2048&&(a.items=o[11]),r[0]&8192&&(a.disabled=!o[13]),!t&&r[0]&4096&&(t=!0,a.keyOfSelected=o[12],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function CM(n){var h;let e,t,i,l=H.hasImageExtension((h=n[9])==null?void 0:h.name),s,o,r,a,f,u,c,d,m=l&&Im(n);return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=D(),m&&m.c(),s=D(),o=b("button"),r=b("span"),a=J(n[1]),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent m-r-auto"),e.disabled=n[6],p(r,"class","txt"),p(o,"type","button"),p(o,"class","btn btn-expanded"),o.disabled=f=!n[13]},m(_,g){S(_,e,g),y(e,t),S(_,i,g),m&&m.m(_,g),S(_,s,g),S(_,o,g),y(o,r),y(r,a),u=!0,c||(d=[Z(e,"click",n[2]),Z(o,"click",n[21])],c=!0)},p(_,g){var v;(!u||g[0]&64)&&(e.disabled=_[6]),g[0]&512&&(l=H.hasImageExtension((v=_[9])==null?void 0:v.name)),l?m?(m.p(_,g),g[0]&512&&I(m,1)):(m=Im(_),m.c(),I(m,1),m.m(s.parentNode,s)):m&&(se(),L(m,1,1,()=>{m=null}),oe()),(!u||g[0]&2)&&re(a,_[1]),(!u||g[0]&8192&&f!==(f=!_[13]))&&(o.disabled=f)},i(_){u||(I(m),u=!0)},o(_){L(m),u=!1},d(_){_&&(w(e),w(i),w(s),w(o)),m&&m.d(_),c=!1,Te(d)}}}function OM(n){let e,t,i,l;const s=[{popup:!0},{class:"file-picker-popup"},n[22]];let o={$$slots:{footer:[CM],header:[$M],default:[SM]},$$scope:{ctx:n}};for(let a=0;a<s.length;a+=1)o=Ae(o,s[a]);e=new Xt({props:o}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]);let r={collection:n[8]};return i=new Ka({props:r}),n[36](i),i.$on("save",n[37]),i.$on("delete",n[38]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(a,f){z(e,a,f),S(a,t,f),z(i,a,f),l=!0},p(a,f){const u=f[0]&4194304?mt(s,[s[0],s[1],Mt(a[22])]):{};f[0]&131059|f[1]&8388608&&(u.$$scope={dirty:f,ctx:a}),e.$set(u);const c={};f[0]&256&&(c.collection=a[8]),i.$set(c)},i(a){l||(I(e.$$.fragment,a),I(i.$$.fragment,a),l=!0)},o(a){L(e.$$.fragment,a),L(i.$$.fragment,a),l=!1},d(a){a&&w(t),n[33](null),V(e,a),n[36](null),V(i,a)}}}const Am=50;function MM(n,e,t){let i,l,s,o;const r=["title","submitText","fileTypes","show","hide"];let a=Xe(e,r),f;We(n,qn,Le=>t(27,f=Le));const u=st(),c="file_picker_"+H.randomString(5);let{title:d="Select a file"}=e,{submitText:m="Insert"}=e,{fileTypes:h=["image","document","video","audio","file"]}=e,_,g,v="",$=[],C=1,T=0,O=!1,M=[],E=[],A=[],N={},q={},R="";function P(){return Y(!0),_==null?void 0:_.show()}function F(){return _==null?void 0:_.hide()}function j(){t(5,$=[]),t(9,q={}),t(12,R="")}function U(){t(4,v="")}async function Y(Le=!1){if(N!=null&&N.id){t(6,O=!0),Le&&j();try{const Ve=Le?1:C+1,bt=H.getAllCollectionIdentifiers(N);let pe=H.normalizeSearchFilter(v,bt)||"";pe&&(pe+=" && "),pe+="("+E.map(Se=>`${Se.name}:length>0`).join("||")+")";const we=await fe.collection(N.id).getList(Ve,Am,{filter:pe,sort:"-created",fields:"*:excerpt(100)",skipTotal:1,requestKey:c+"loadImagePicker"});t(5,$=H.filterDuplicatesByKey($.concat(we.items))),C=we.page,t(26,T=we.items.length),t(6,O=!1)}catch(Ve){Ve.isAbort||(fe.error(Ve),t(6,O=!1))}}}function X(){var Ve,bt;let Le=["100x100"];if((Ve=q==null?void 0:q.record)!=null&&Ve.id){for(const pe of E)if(H.toArray(q.record[pe.name]).includes(q.name)){Le=Le.concat(H.toArray((bt=pe.options)==null?void 0:bt.thumbs));break}}t(11,A=[{label:"Original size",value:""}]);for(const pe of Le)A.push({label:`${pe} thumb`,value:pe});R&&!Le.includes(R)&&t(12,R="")}function W(Le){let Ve=[];for(const bt of E){const pe=H.toArray(Le[bt.name]);for(const we of pe)h.includes(H.getFileType(we))&&Ve.push(we)}return Ve}function K(Le,Ve){t(9,q={record:Le,name:Ve})}function le(){o&&(u("submit",Object.assign({size:R},q)),F())}function ne(Le){R=Le,t(12,R)}const me=Le=>{t(8,N=Le)},Pe=Le=>t(4,v=Le.detail),ze=()=>g==null?void 0:g.show(),Qe=()=>{s&&Y()};function et(Le){te[Le?"unshift":"push"](()=>{_=Le,t(3,_)})}function Dt(Le){Oe.call(this,n,Le)}function ut(Le){Oe.call(this,n,Le)}function ht(Le){te[Le?"unshift":"push"](()=>{g=Le,t(10,g)})}const Qt=Le=>{H.removeByKey($,"id",Le.detail.record.id),$.unshift(Le.detail.record),t(5,$);const Ve=W(Le.detail.record);Ve.length>0&&K(Le.detail.record,Ve[0])},Ee=Le=>{var Ve;((Ve=q==null?void 0:q.record)==null?void 0:Ve.id)==Le.detail.id&&t(9,q={}),H.removeByKey($,"id",Le.detail.id),t(5,$)};return n.$$set=Le=>{e=Ae(Ae({},e),Kt(Le)),t(22,a=Xe(e,r)),"title"in Le&&t(0,d=Le.title),"submitText"in Le&&t(1,m=Le.submitText),"fileTypes"in Le&&t(24,h=Le.fileTypes)},n.$$.update=()=>{var Le;n.$$.dirty[0]&134217728&&t(7,M=f.filter(Ve=>Ve.type!=="view"&&!!H.toArray(Ve.schema).find(bt=>{var pe,we,Se,Ke,Vt;return bt.type==="file"&&!((pe=bt.options)!=null&&pe.protected)&&(!((Se=(we=bt.options)==null?void 0:we.mimeTypes)!=null&&Se.length)||!!((Vt=(Ke=bt.options)==null?void 0:Ke.mimeTypes)!=null&&Vt.find(dn=>dn.startsWith("image/"))))}))),n.$$.dirty[0]&384&&!(N!=null&&N.id)&&M.length>0&&t(8,N=M[0]),n.$$.dirty[0]&256&&(E=(Le=N==null?void 0:N.schema)==null?void 0:Le.filter(Ve=>{var bt;return Ve.type==="file"&&!((bt=Ve.options)!=null&&bt.protected)})),n.$$.dirty[0]&256&&N!=null&&N.id&&(U(),X()),n.$$.dirty[0]&512&&q!=null&&q.name&&X(),n.$$.dirty[0]&280&&typeof v<"u"&&N!=null&&N.id&&_!=null&&_.isActive()&&Y(!0),n.$$.dirty[0]&512&&t(16,i=(Ve,bt)=>{var pe;return(q==null?void 0:q.name)==bt&&((pe=q==null?void 0:q.record)==null?void 0:pe.id)==Ve.id}),n.$$.dirty[0]&32&&t(15,l=$.find(Ve=>W(Ve).length>0)),n.$$.dirty[0]&67108928&&t(14,s=!O&&T==Am),n.$$.dirty[0]&576&&t(13,o=!O&&!!(q!=null&&q.name))},[d,m,F,_,v,$,O,M,N,q,g,A,R,o,s,l,i,U,Y,W,K,le,a,c,h,P,T,f,ne,me,Pe,ze,Qe,et,Dt,ut,ht,Qt,Ee]}class DM extends be{constructor(e){super(),ge(this,e,MM,OM,he,{title:0,submitText:1,fileTypes:24,show:25,hide:2},null,[-1,-1])}get show(){return this.$$.ctx[25]}get hide(){return this.$$.ctx[2]}}function EM(n){let e;return{c(){e=b("div"),p(e,"class","tinymce-wrapper")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function IM(n){let e,t,i;function l(o){n[6](o)}let s={id:n[11],conf:n[5]};return n[0]!==void 0&&(s.value=n[0]),e=new Ya({props:s}),te.push(()=>ke(e,"value",l)),e.$on("init",n[7]),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&2048&&(a.id=o[11]),r&32&&(a.conf=o[5]),!t&&r&1&&(t=!0,a.value=o[0],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function AM(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m;const h=[IM,EM],_=[];function g(v,$){return v[4]?0:1}return u=g(n),c=_[u]=h[u](n),{c(){e=b("label"),t=b("i"),l=D(),s=b("span"),r=J(o),f=D(),c.c(),d=ve(),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[11])},m(v,$){S(v,e,$),y(e,t),y(e,l),y(e,s),y(s,r),S(v,f,$),_[u].m(v,$),S(v,d,$),m=!0},p(v,$){(!m||$&2&&i!==(i=H.getFieldTypeIcon(v[1].type)))&&p(t,"class",i),(!m||$&2)&&o!==(o=v[1].name+"")&&re(r,o),(!m||$&2048&&a!==(a=v[11]))&&p(e,"for",a);let C=u;u=g(v),u===C?_[u].p(v,$):(se(),L(_[C],1,1,()=>{_[C]=null}),oe(),c=_[u],c?c.p(v,$):(c=_[u]=h[u](v),c.c()),I(c,1),c.m(d.parentNode,d))},i(v){m||(I(c),m=!0)},o(v){L(c),m=!1},d(v){v&&(w(e),w(f),w(d)),_[u].d(v)}}}function LM(n){let e,t,i,l;e=new de({props:{class:"form-field form-field-editor "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[AM,({uniqueId:o})=>({11:o}),({uniqueId:o})=>o?2048:0]},$$scope:{ctx:n}}});let s={title:"Select an image",fileTypes:["image"]};return i=new DM({props:s}),n[8](i),i.$on("submit",n[9]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(o,r){z(e,o,r),S(o,t,r),z(i,o,r),l=!0},p(o,[r]){const a={};r&2&&(a.class="form-field form-field-editor "+(o[1].required?"required":"")),r&2&&(a.name=o[1].name),r&6207&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const f={};i.$set(f)},i(o){l||(I(e.$$.fragment,o),I(i.$$.fragment,o),l=!0)},o(o){L(e.$$.fragment,o),L(i.$$.fragment,o),l=!1},d(o){o&&w(t),V(e,o),n[8](null),V(i,o)}}}function NM(n,e,t){let i,{field:l}=e,{value:s=""}=e,o,r,a=!1,f=null;zt(async()=>(typeof s>"u"&&t(0,s=""),f=setTimeout(()=>{t(4,a=!0)},100),()=>{clearTimeout(f)}));function u(h){s=h,t(0,s)}const c=h=>{t(3,r=h.detail.editor),r.on("collections_file_picker",()=>{o==null||o.show()})};function d(h){te[h?"unshift":"push"](()=>{o=h,t(2,o)})}const m=h=>{r==null||r.execCommand("InsertImage",!1,fe.files.getUrl(h.detail.record,h.detail.name,{thumb:h.detail.size}))};return n.$$set=h=>{"field"in h&&t(1,l=h.field),"value"in h&&t(0,s=h.value)},n.$$.update=()=>{var h;n.$$.dirty&2&&t(5,i=Object.assign(H.defaultEditorOptions(),{convert_urls:(h=l.options)==null?void 0:h.convertUrls,relative_urls:!1})),n.$$.dirty&1&&typeof s>"u"&&t(0,s="")},[s,l,o,r,a,i,u,c,d,m]}class PM extends be{constructor(e){super(),ge(this,e,NM,LM,he,{field:1,value:0})}}function FM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Auth URL"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","url"),p(s,"id",o=n[8]),s.required=n[3]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].authUrl),r||(a=Z(s,"input",n[5]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&8&&(s.required=f[3]),u&1&&s.value!==f[0].authUrl&&ae(s,f[0].authUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function RM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Token URL"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","url"),p(s,"id",o=n[8]),s.required=n[3]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].tokenUrl),r||(a=Z(s,"input",n[6]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&8&&(s.required=f[3]),u&1&&s.value!==f[0].tokenUrl&&ae(s,f[0].tokenUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function qM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("User API URL"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","url"),p(s,"id",o=n[8]),s.required=n[3]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].userApiUrl),r||(a=Z(s,"input",n[7]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&8&&(s.required=f[3]),u&1&&s.value!==f[0].userApiUrl&&ae(s,f[0].userApiUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function jM(n){let e,t,i,l,s,o,r,a,f;return l=new de({props:{class:"form-field "+(n[3]?"required":""),name:n[1]+".authUrl",$$slots:{default:[FM,({uniqueId:u})=>({8:u}),({uniqueId:u})=>u?256:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field "+(n[3]?"required":""),name:n[1]+".tokenUrl",$$slots:{default:[RM,({uniqueId:u})=>({8:u}),({uniqueId:u})=>u?256:0]},$$scope:{ctx:n}}}),a=new de({props:{class:"form-field "+(n[3]?"required":""),name:n[1]+".userApiUrl",$$slots:{default:[qM,({uniqueId:u})=>({8:u}),({uniqueId:u})=>u?256:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=J(n[2]),i=D(),B(l.$$.fragment),s=D(),B(o.$$.fragment),r=D(),B(a.$$.fragment),p(e,"class","section-title")},m(u,c){S(u,e,c),y(e,t),S(u,i,c),z(l,u,c),S(u,s,c),z(o,u,c),S(u,r,c),z(a,u,c),f=!0},p(u,[c]){(!f||c&4)&&re(t,u[2]);const d={};c&8&&(d.class="form-field "+(u[3]?"required":"")),c&2&&(d.name=u[1]+".authUrl"),c&777&&(d.$$scope={dirty:c,ctx:u}),l.$set(d);const m={};c&8&&(m.class="form-field "+(u[3]?"required":"")),c&2&&(m.name=u[1]+".tokenUrl"),c&777&&(m.$$scope={dirty:c,ctx:u}),o.$set(m);const h={};c&8&&(h.class="form-field "+(u[3]?"required":"")),c&2&&(h.name=u[1]+".userApiUrl"),c&777&&(h.$$scope={dirty:c,ctx:u}),a.$set(h)},i(u){f||(I(l.$$.fragment,u),I(o.$$.fragment,u),I(a.$$.fragment,u),f=!0)},o(u){L(l.$$.fragment,u),L(o.$$.fragment,u),L(a.$$.fragment,u),f=!1},d(u){u&&(w(e),w(i),w(s),w(r)),V(l,u),V(o,u),V(a,u)}}}function HM(n,e,t){let i,{key:l=""}=e,{config:s={}}=e,{required:o=!1}=e,{title:r="Provider endpoints"}=e;function a(){s.authUrl=this.value,t(0,s)}function f(){s.tokenUrl=this.value,t(0,s)}function u(){s.userApiUrl=this.value,t(0,s)}return n.$$set=c=>{"key"in c&&t(1,l=c.key),"config"in c&&t(0,s=c.config),"required"in c&&t(4,o=c.required),"title"in c&&t(2,r=c.title)},n.$$.update=()=>{n.$$.dirty&17&&t(3,i=o&&(s==null?void 0:s.enabled))},[s,l,r,i,o,a,f,u]}class Lr extends be{constructor(e){super(),ge(this,e,HM,jM,he,{key:1,config:0,required:4,title:2})}}function zM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Display name"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","text"),p(s,"id",o=n[8]),s.required=n[2]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].displayName),r||(a=Z(s,"input",n[3]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&4&&(s.required=f[2]),u&1&&s.value!==f[0].displayName&&ae(s,f[0].displayName)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function VM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Auth URL"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","url"),p(s,"id",o=n[8]),s.required=n[2]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].authUrl),r||(a=Z(s,"input",n[4]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&4&&(s.required=f[2]),u&1&&s.value!==f[0].authUrl&&ae(s,f[0].authUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function BM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Token URL"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","url"),p(s,"id",o=n[8]),s.required=n[2]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].tokenUrl),r||(a=Z(s,"input",n[5]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&4&&(s.required=f[2]),u&1&&s.value!==f[0].tokenUrl&&ae(s,f[0].tokenUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function UM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("User API URL"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","url"),p(s,"id",o=n[8]),s.required=n[2]},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].userApiUrl),r||(a=Z(s,"input",n[6]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&4&&(s.required=f[2]),u&1&&s.value!==f[0].userApiUrl&&ae(s,f[0].userApiUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function WM(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Support PKCE",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[8]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[8])},m(c,d){S(c,e,d),e.checked=n[0].pkce,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[7]),$e(Fe.call(null,r,{text:"Usually it should be safe to be always enabled as most providers will just ignore the extra query parameters if they don't support PKCE.",position:"right"}))],f=!0)},p(c,d){d&256&&t!==(t=c[8])&&p(e,"id",t),d&1&&(e.checked=c[0].pkce),d&256&&a!==(a=c[8])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function YM(n){let e,t,i,l,s,o,r,a,f,u,c,d;return e=new de({props:{class:"form-field "+(n[2]?"required":""),name:n[1]+".displayName",$$slots:{default:[zM,({uniqueId:m})=>({8:m}),({uniqueId:m})=>m?256:0]},$$scope:{ctx:n}}}),s=new de({props:{class:"form-field "+(n[2]?"required":""),name:n[1]+".authUrl",$$slots:{default:[VM,({uniqueId:m})=>({8:m}),({uniqueId:m})=>m?256:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field "+(n[2]?"required":""),name:n[1]+".tokenUrl",$$slots:{default:[BM,({uniqueId:m})=>({8:m}),({uniqueId:m})=>m?256:0]},$$scope:{ctx:n}}}),f=new de({props:{class:"form-field "+(n[2]?"required":""),name:n[1]+".userApiUrl",$$slots:{default:[UM,({uniqueId:m})=>({8:m}),({uniqueId:m})=>m?256:0]},$$scope:{ctx:n}}}),c=new de({props:{class:"form-field",name:n[1]+".pkce",$$slots:{default:[WM,({uniqueId:m})=>({8:m}),({uniqueId:m})=>m?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),i=b("div"),i.textContent="Endpoints",l=D(),B(s.$$.fragment),o=D(),B(r.$$.fragment),a=D(),B(f.$$.fragment),u=D(),B(c.$$.fragment),p(i,"class","section-title")},m(m,h){z(e,m,h),S(m,t,h),S(m,i,h),S(m,l,h),z(s,m,h),S(m,o,h),z(r,m,h),S(m,a,h),z(f,m,h),S(m,u,h),z(c,m,h),d=!0},p(m,[h]){const _={};h&4&&(_.class="form-field "+(m[2]?"required":"")),h&2&&(_.name=m[1]+".displayName"),h&773&&(_.$$scope={dirty:h,ctx:m}),e.$set(_);const g={};h&4&&(g.class="form-field "+(m[2]?"required":"")),h&2&&(g.name=m[1]+".authUrl"),h&773&&(g.$$scope={dirty:h,ctx:m}),s.$set(g);const v={};h&4&&(v.class="form-field "+(m[2]?"required":"")),h&2&&(v.name=m[1]+".tokenUrl"),h&773&&(v.$$scope={dirty:h,ctx:m}),r.$set(v);const $={};h&4&&($.class="form-field "+(m[2]?"required":"")),h&2&&($.name=m[1]+".userApiUrl"),h&773&&($.$$scope={dirty:h,ctx:m}),f.$set($);const C={};h&2&&(C.name=m[1]+".pkce"),h&769&&(C.$$scope={dirty:h,ctx:m}),c.$set(C)},i(m){d||(I(e.$$.fragment,m),I(s.$$.fragment,m),I(r.$$.fragment,m),I(f.$$.fragment,m),I(c.$$.fragment,m),d=!0)},o(m){L(e.$$.fragment,m),L(s.$$.fragment,m),L(r.$$.fragment,m),L(f.$$.fragment,m),L(c.$$.fragment,m),d=!1},d(m){m&&(w(t),w(i),w(l),w(o),w(a),w(u)),V(e,m),V(s,m),V(r,m),V(f,m),V(c,m)}}}function KM(n,e,t){let i,{key:l=""}=e,{config:s={}}=e;H.isEmpty(s.pkce)&&(s.pkce=!0),s.displayName||(s.displayName="OIDC");function o(){s.displayName=this.value,t(0,s)}function r(){s.authUrl=this.value,t(0,s)}function a(){s.tokenUrl=this.value,t(0,s)}function f(){s.userApiUrl=this.value,t(0,s)}function u(){s.pkce=this.checked,t(0,s)}return n.$$set=c=>{"key"in c&&t(1,l=c.key),"config"in c&&t(0,s=c.config)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=!!s.enabled)},[s,l,i,o,r,a,f,u]}class Nr extends be{constructor(e){super(),ge(this,e,KM,YM,he,{key:1,config:0})}}function JM(n){let e,t,i,l,s,o,r,a,f,u,c;return{c(){e=b("label"),t=J("Auth URL"),l=D(),s=b("input"),a=D(),f=b("div"),f.textContent="Eg. https://login.microsoftonline.com/YOUR_DIRECTORY_TENANT_ID/oauth2/v2.0/authorize",p(e,"for",i=n[4]),p(s,"type","url"),p(s,"id",o=n[4]),s.required=r=n[0].enabled,p(f,"class","help-block")},m(d,m){S(d,e,m),y(e,t),S(d,l,m),S(d,s,m),ae(s,n[0].authUrl),S(d,a,m),S(d,f,m),u||(c=Z(s,"input",n[2]),u=!0)},p(d,m){m&16&&i!==(i=d[4])&&p(e,"for",i),m&16&&o!==(o=d[4])&&p(s,"id",o),m&1&&r!==(r=d[0].enabled)&&(s.required=r),m&1&&s.value!==d[0].authUrl&&ae(s,d[0].authUrl)},d(d){d&&(w(e),w(l),w(s),w(a),w(f)),u=!1,c()}}}function ZM(n){let e,t,i,l,s,o,r,a,f,u,c;return{c(){e=b("label"),t=J("Token URL"),l=D(),s=b("input"),a=D(),f=b("div"),f.textContent="Eg. https://login.microsoftonline.com/YOUR_DIRECTORY_TENANT_ID/oauth2/v2.0/token",p(e,"for",i=n[4]),p(s,"type","url"),p(s,"id",o=n[4]),s.required=r=n[0].enabled,p(f,"class","help-block")},m(d,m){S(d,e,m),y(e,t),S(d,l,m),S(d,s,m),ae(s,n[0].tokenUrl),S(d,a,m),S(d,f,m),u||(c=Z(s,"input",n[3]),u=!0)},p(d,m){m&16&&i!==(i=d[4])&&p(e,"for",i),m&16&&o!==(o=d[4])&&p(s,"id",o),m&1&&r!==(r=d[0].enabled)&&(s.required=r),m&1&&s.value!==d[0].tokenUrl&&ae(s,d[0].tokenUrl)},d(d){d&&(w(e),w(l),w(s),w(a),w(f)),u=!1,c()}}}function GM(n){let e,t,i,l,s,o;return i=new de({props:{class:"form-field "+(n[0].enabled?"required":""),name:n[1]+".authUrl",$$slots:{default:[JM,({uniqueId:r})=>({4:r}),({uniqueId:r})=>r?16:0]},$$scope:{ctx:n}}}),s=new de({props:{class:"form-field "+(n[0].enabled?"required":""),name:n[1]+".tokenUrl",$$slots:{default:[ZM,({uniqueId:r})=>({4:r}),({uniqueId:r})=>r?16:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),e.textContent="Azure AD endpoints",t=D(),B(i.$$.fragment),l=D(),B(s.$$.fragment),p(e,"class","section-title")},m(r,a){S(r,e,a),S(r,t,a),z(i,r,a),S(r,l,a),z(s,r,a),o=!0},p(r,[a]){const f={};a&1&&(f.class="form-field "+(r[0].enabled?"required":"")),a&2&&(f.name=r[1]+".authUrl"),a&49&&(f.$$scope={dirty:a,ctx:r}),i.$set(f);const u={};a&1&&(u.class="form-field "+(r[0].enabled?"required":"")),a&2&&(u.name=r[1]+".tokenUrl"),a&49&&(u.$$scope={dirty:a,ctx:r}),s.$set(u)},i(r){o||(I(i.$$.fragment,r),I(s.$$.fragment,r),o=!0)},o(r){L(i.$$.fragment,r),L(s.$$.fragment,r),o=!1},d(r){r&&(w(e),w(t),w(l)),V(i,r),V(s,r)}}}function XM(n,e,t){let{key:i=""}=e,{config:l={}}=e;function s(){l.authUrl=this.value,t(0,l)}function o(){l.tokenUrl=this.value,t(0,l)}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"config"in r&&t(0,l=r.config)},[l,i,s,o]}class QM extends be{constructor(e){super(),ge(this,e,XM,GM,he,{key:1,config:0})}}function xM(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Client ID"),l=D(),s=b("input"),p(e,"for",i=n[23]),p(s,"type","text"),p(s,"id",o=n[23]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[2]),r||(a=Z(s,"input",n[12]),r=!0)},p(f,u){u&8388608&&i!==(i=f[23])&&p(e,"for",i),u&8388608&&o!==(o=f[23])&&p(s,"id",o),u&4&&s.value!==f[2]&&ae(s,f[2])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function e8(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Team ID"),l=D(),s=b("input"),p(e,"for",i=n[23]),p(s,"type","text"),p(s,"id",o=n[23]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[3]),r||(a=Z(s,"input",n[13]),r=!0)},p(f,u){u&8388608&&i!==(i=f[23])&&p(e,"for",i),u&8388608&&o!==(o=f[23])&&p(s,"id",o),u&8&&s.value!==f[3]&&ae(s,f[3])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function t8(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Key ID"),l=D(),s=b("input"),p(e,"for",i=n[23]),p(s,"type","text"),p(s,"id",o=n[23]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[4]),r||(a=Z(s,"input",n[14]),r=!0)},p(f,u){u&8388608&&i!==(i=f[23])&&p(e,"for",i),u&8388608&&o!==(o=f[23])&&p(s,"id",o),u&16&&s.value!==f[4]&&ae(s,f[4])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function n8(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("span"),t.textContent="Duration (in seconds)",i=D(),l=b("i"),o=D(),r=b("input"),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[23]),p(r,"type","text"),p(r,"id",a=n[23]),p(r,"max",go),r.required=!0},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),S(c,o,d),S(c,r,d),ae(r,n[6]),f||(u=[$e(Fe.call(null,l,{text:`Max ${go} seconds (~${go/(60*60*24*30)<<0} months).`,position:"top"})),Z(r,"input",n[15])],f=!0)},p(c,d){d&8388608&&s!==(s=c[23])&&p(e,"for",s),d&8388608&&a!==(a=c[23])&&p(r,"id",a),d&64&&r.value!==c[6]&&ae(r,c[6])},d(c){c&&(w(e),w(o),w(r)),f=!1,Te(u)}}}function i8(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=J("Private key"),l=D(),s=b("textarea"),r=D(),a=b("div"),a.textContent="The key is not stored on the server and it is used only for generating the signed JWT.",p(e,"for",i=n[23]),p(s,"id",o=n[23]),s.required=!0,p(s,"rows","8"),p(s,"placeholder",`-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----`),p(a,"class","help-block")},m(c,d){S(c,e,d),y(e,t),S(c,l,d),S(c,s,d),ae(s,n[5]),S(c,r,d),S(c,a,d),f||(u=Z(s,"input",n[16]),f=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(s,"id",o),d&32&&ae(s,c[5])},d(c){c&&(w(e),w(l),w(s),w(r),w(a)),f=!1,u()}}}function l8(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$;return l=new de({props:{class:"form-field required",name:"clientId",$$slots:{default:[xM,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field required",name:"teamId",$$slots:{default:[e8,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),u=new de({props:{class:"form-field required",name:"keyId",$$slots:{default:[t8,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),m=new de({props:{class:"form-field required",name:"duration",$$slots:{default:[n8,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),_=new de({props:{class:"form-field required",name:"privateKey",$$slots:{default:[i8,({uniqueId:C})=>({23:C}),({uniqueId:C})=>C?8388608:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),i=b("div"),B(l.$$.fragment),s=D(),o=b("div"),B(r.$$.fragment),a=D(),f=b("div"),B(u.$$.fragment),c=D(),d=b("div"),B(m.$$.fragment),h=D(),B(_.$$.fragment),p(i,"class","col-lg-6"),p(o,"class","col-lg-6"),p(f,"class","col-lg-6"),p(d,"class","col-lg-6"),p(t,"class","grid"),p(e,"id",n[9]),p(e,"autocomplete","off")},m(C,T){S(C,e,T),y(e,t),y(t,i),z(l,i,null),y(t,s),y(t,o),z(r,o,null),y(t,a),y(t,f),z(u,f,null),y(t,c),y(t,d),z(m,d,null),y(t,h),z(_,t,null),g=!0,v||($=Z(e,"submit",Ue(n[17])),v=!0)},p(C,T){const O={};T&25165828&&(O.$$scope={dirty:T,ctx:C}),l.$set(O);const M={};T&25165832&&(M.$$scope={dirty:T,ctx:C}),r.$set(M);const E={};T&25165840&&(E.$$scope={dirty:T,ctx:C}),u.$set(E);const A={};T&25165888&&(A.$$scope={dirty:T,ctx:C}),m.$set(A);const N={};T&25165856&&(N.$$scope={dirty:T,ctx:C}),_.$set(N)},i(C){g||(I(l.$$.fragment,C),I(r.$$.fragment,C),I(u.$$.fragment,C),I(m.$$.fragment,C),I(_.$$.fragment,C),g=!0)},o(C){L(l.$$.fragment,C),L(r.$$.fragment,C),L(u.$$.fragment,C),L(m.$$.fragment,C),L(_.$$.fragment,C),g=!1},d(C){C&&w(e),V(l),V(r),V(u),V(m),V(_),v=!1,$()}}}function s8(n){let e;return{c(){e=b("h4"),e.textContent="Generate Apple client secret",p(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function o8(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("button"),t=J("Close"),i=D(),l=b("button"),s=b("i"),o=D(),r=b("span"),r.textContent="Generate and set secret",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[7],p(s,"class","ri-key-line"),p(r,"class","txt"),p(l,"type","submit"),p(l,"form",n[9]),p(l,"class","btn btn-expanded"),l.disabled=a=!n[8]||n[7],ee(l,"btn-loading",n[7])},m(c,d){S(c,e,d),y(e,t),S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=Z(e,"click",n[0]),f=!0)},p(c,d){d&128&&(e.disabled=c[7]),d&384&&a!==(a=!c[8]||c[7])&&(l.disabled=a),d&128&&ee(l,"btn-loading",c[7])},d(c){c&&(w(e),w(i),w(l)),f=!1,u()}}}function r8(n){let e,t,i={overlayClose:!n[7],escClose:!n[7],beforeHide:n[18],popup:!0,$$slots:{footer:[o8],header:[s8],default:[l8]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[19](e),e.$on("show",n[20]),e.$on("hide",n[21]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&128&&(o.overlayClose=!l[7]),s&128&&(o.escClose=!l[7]),s&128&&(o.beforeHide=l[18]),s&16777724&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[19](null),V(e,l)}}}const go=15777e3;function a8(n,e,t){let i;const l=st(),s="apple_secret_"+H.randomString(5);let o,r,a,f,u,c,d=!1;function m(q={}){t(2,r=q.clientId||""),t(3,a=q.teamId||""),t(4,f=q.keyId||""),t(5,u=q.privateKey||""),t(6,c=q.duration||go),Gt({}),o==null||o.show()}function h(){return o==null?void 0:o.hide()}async function _(){t(7,d=!0);try{const q=await fe.settings.generateAppleClientSecret(r,a,f,u.trim(),c);t(7,d=!1),Nt("Successfully generated client secret."),l("submit",q),o==null||o.hide()}catch(q){fe.error(q)}t(7,d=!1)}function g(){r=this.value,t(2,r)}function v(){a=this.value,t(3,a)}function $(){f=this.value,t(4,f)}function C(){c=this.value,t(6,c)}function T(){u=this.value,t(5,u)}const O=()=>_(),M=()=>!d;function E(q){te[q?"unshift":"push"](()=>{o=q,t(1,o)})}function A(q){Oe.call(this,n,q)}function N(q){Oe.call(this,n,q)}return t(8,i=!0),[h,o,r,a,f,u,c,d,i,s,_,m,g,v,$,C,T,O,M,E,A,N]}class f8 extends be{constructor(e){super(),ge(this,e,a8,r8,he,{show:11,hide:0})}get show(){return this.$$.ctx[11]}get hide(){return this.$$.ctx[0]}}function u8(n){let e,t,i,l,s,o,r,a,f,u,c={};return r=new f8({props:c}),n[4](r),r.$on("submit",n[5]),{c(){e=b("button"),t=b("i"),i=D(),l=b("span"),l.textContent="Generate secret",o=D(),B(r.$$.fragment),p(t,"class","ri-key-line"),p(l,"class","txt"),p(e,"type","button"),p(e,"class",s="btn btn-sm btn-secondary btn-provider-"+n[1])},m(d,m){S(d,e,m),y(e,t),y(e,i),y(e,l),S(d,o,m),z(r,d,m),a=!0,f||(u=Z(e,"click",n[3]),f=!0)},p(d,[m]){(!a||m&2&&s!==(s="btn btn-sm btn-secondary btn-provider-"+d[1]))&&p(e,"class",s);const h={};r.$set(h)},i(d){a||(I(r.$$.fragment,d),a=!0)},o(d){L(r.$$.fragment,d),a=!1},d(d){d&&(w(e),w(o)),n[4](null),V(r,d),f=!1,u()}}}function c8(n,e,t){let{key:i=""}=e,{config:l={}}=e,s;const o=()=>s==null?void 0:s.show({clientId:l.clientId});function r(f){te[f?"unshift":"push"](()=>{s=f,t(2,s)})}const a=f=>{var u;t(0,l.clientSecret=((u=f.detail)==null?void 0:u.secret)||"",l)};return n.$$set=f=>{"key"in f&&t(1,i=f.key),"config"in f&&t(0,l=f.config)},[l,i,s,o,r,a]}class d8 extends be{constructor(e){super(),ge(this,e,c8,u8,he,{key:1,config:0})}}const bo=[{key:"appleAuth",title:"Apple",logo:"apple.svg",optionsComponent:d8},{key:"googleAuth",title:"Google",logo:"google.svg"},{key:"microsoftAuth",title:"Microsoft",logo:"microsoft.svg",optionsComponent:QM},{key:"yandexAuth",title:"Yandex",logo:"yandex.svg"},{key:"facebookAuth",title:"Facebook",logo:"facebook.svg"},{key:"instagramAuth",title:"Instagram",logo:"instagram.svg"},{key:"githubAuth",title:"GitHub",logo:"github.svg"},{key:"gitlabAuth",title:"GitLab",logo:"gitlab.svg",optionsComponent:Lr,optionsComponentProps:{title:"Self-hosted endpoints (optional)"}},{key:"bitbucketAuth",title:"Bitbucket",logo:"bitbucket.svg"},{key:"giteeAuth",title:"Gitee",logo:"gitee.svg"},{key:"giteaAuth",title:"Gitea",logo:"gitea.svg",optionsComponent:Lr,optionsComponentProps:{title:"Self-hosted endpoints (optional)"}},{key:"discordAuth",title:"Discord",logo:"discord.svg"},{key:"twitterAuth",title:"Twitter",logo:"twitter.svg"},{key:"kakaoAuth",title:"Kakao",logo:"kakao.svg"},{key:"vkAuth",title:"VK",logo:"vk.svg"},{key:"spotifyAuth",title:"Spotify",logo:"spotify.svg"},{key:"twitchAuth",title:"Twitch",logo:"twitch.svg"},{key:"patreonAuth",title:"Patreon (v2)",logo:"patreon.svg"},{key:"stravaAuth",title:"Strava",logo:"strava.svg"},{key:"livechatAuth",title:"LiveChat",logo:"livechat.svg"},{key:"mailcowAuth",title:"mailcow",logo:"mailcow.svg",optionsComponent:Lr,optionsComponentProps:{required:!0}},{key:"planningcenterAuth",title:"Planning Center",logo:"planningcenter.svg"},{key:"oidcAuth",title:"OpenID Connect",logo:"oidc.svg",optionsComponent:Nr},{key:"oidc2Auth",title:"(2) OpenID Connect",logo:"oidc.svg",optionsComponent:Nr},{key:"oidc3Auth",title:"(3) OpenID Connect",logo:"oidc.svg",optionsComponent:Nr}];function Lm(n,e,t){const i=n.slice();return i[9]=e[t],i}function p8(n){let e;return{c(){e=b("h6"),e.textContent="No linked OAuth2 providers.",p(e,"class","txt-hint txt-center m-t-sm m-b-sm")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function m8(n){let e,t=ce(n[1]),i=[];for(let l=0;l<t.length;l+=1)i[l]=Nm(Lm(n,t,l));return{c(){e=b("div");for(let l=0;l<i.length;l+=1)i[l].c();p(e,"class","list")},m(l,s){S(l,e,s);for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(e,null)},p(l,s){if(s&58){t=ce(l[1]);let o;for(o=0;o<t.length;o+=1){const r=Lm(l,t,o);i[o]?i[o].p(r,s):(i[o]=Nm(r),i[o].c(),i[o].m(e,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&w(e),rt(i,l)}}}function h8(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","block txt-center")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Nm(n){let e,t,i,l,s,o,r=n[4](n[9].provider)+"",a,f,u,c,d=n[9].providerId+"",m,h,_,g,v,$;function C(){return n[6](n[9])}return{c(){var T;e=b("div"),t=b("figure"),i=b("img"),s=D(),o=b("span"),a=J(r),f=D(),u=b("div"),c=J("ID: "),m=J(d),h=D(),_=b("button"),_.innerHTML='<i class="ri-close-line"></i>',g=D(),tn(i.src,l="./images/oauth2/"+((T=n[3](n[9].provider))==null?void 0:T.logo))||p(i,"src",l),p(i,"alt","Provider logo"),p(t,"class","provider-logo"),p(o,"class","txt"),p(u,"class","txt-hint"),p(_,"type","button"),p(_,"class","btn btn-transparent link-hint btn-circle btn-sm m-l-auto"),p(e,"class","list-item")},m(T,O){S(T,e,O),y(e,t),y(t,i),y(e,s),y(e,o),y(o,a),y(e,f),y(e,u),y(u,c),y(u,m),y(e,h),y(e,_),y(e,g),v||($=Z(_,"click",C),v=!0)},p(T,O){var M;n=T,O&2&&!tn(i.src,l="./images/oauth2/"+((M=n[3](n[9].provider))==null?void 0:M.logo))&&p(i,"src",l),O&2&&r!==(r=n[4](n[9].provider)+"")&&re(a,r),O&2&&d!==(d=n[9].providerId+"")&&re(m,d)},d(T){T&&w(e),v=!1,$()}}}function _8(n){let e;function t(s,o){var r;return s[2]?h8:(r=s[0])!=null&&r.id&&s[1].length?m8:p8}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:x,o:x,d(s){s&&w(e),l.d(s)}}}function g8(n,e,t){const i=st();let{record:l}=e,s=[],o=!1;function r(d){return bo.find(m=>m.key==d+"Auth")||{}}function a(d){var m;return((m=r(d))==null?void 0:m.title)||H.sentenize(d,!1)}async function f(){if(!(l!=null&&l.id)){t(1,s=[]),t(2,o=!1);return}t(2,o=!0);try{t(1,s=await fe.collection(l.collectionId).listExternalAuths(l.id))}catch(d){fe.error(d)}t(2,o=!1)}function u(d){!(l!=null&&l.id)||!d||un(`Do you really want to unlink the ${a(d)} provider?`,()=>fe.collection(l.collectionId).unlinkExternalAuth(l.id,d).then(()=>{Nt(`Successfully unlinked the ${a(d)} provider.`),i("unlink",d),f()}).catch(m=>{fe.error(m)}))}f();const c=d=>u(d.provider);return n.$$set=d=>{"record"in d&&t(0,l=d.record)},[l,s,o,r,a,u,c]}class b8 extends be{constructor(e){super(),ge(this,e,g8,_8,he,{record:0})}}function Pm(n,e,t){const i=n.slice();return i[71]=e[t],i[72]=e,i[73]=t,i}function Fm(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_;return{c(){e=b("div"),t=b("div"),i=b("div"),i.innerHTML='<i class="ri-information-line"></i>',l=D(),s=b("div"),o=J(`The record has previous unsaved changes.
`),r=b("button"),r.textContent="Restore draft",a=D(),f=b("button"),f.innerHTML='<i class="ri-close-line"></i>',u=D(),c=b("div"),p(i,"class","icon"),p(r,"type","button"),p(r,"class","btn btn-sm btn-secondary"),p(s,"class","flex flex-gap-xs"),p(f,"type","button"),p(f,"class","close"),p(f,"aria-label","Discard draft"),p(t,"class","alert alert-info m-0"),p(c,"class","clearfix p-b-base"),p(e,"class","block")},m(g,v){S(g,e,v),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),y(s,r),y(t,a),y(t,f),y(e,u),y(e,c),m=!0,h||(_=[Z(r,"click",n[39]),$e(Fe.call(null,f,"Discard draft")),Z(f,"click",Ue(n[40]))],h=!0)},p:x,i(g){m||(d&&d.end(1),m=!0)},o(g){g&&(d=da(e,tt,{duration:150})),m=!1},d(g){g&&w(e),g&&d&&d.end(),h=!1,Te(_)}}}function Rm(n){let e,t,i;return t=new Jb({props:{model:n[3]}}),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","form-field-addon")},m(l,s){S(l,e,s),z(t,e,null),i=!0},p(l,s){const o={};s[0]&8&&(o.model=l[3]),t.$set(o)},i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){L(t.$$.fragment,l),i=!1},d(l){l&&w(e),V(t)}}}function k8(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v=!n[6]&&Rm(n);return{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="id",s=D(),o=b("span"),a=D(),v&&v.c(),f=D(),u=b("input"),p(t,"class",Yn(H.getFieldTypeIcon("primary"))+" svelte-qc5ngu"),p(l,"class","txt"),p(o,"class","flex-fill"),p(e,"for",r=n[74]),p(u,"type","text"),p(u,"id",c=n[74]),p(u,"placeholder",d=n[7]?"":"Leave empty to auto generate..."),p(u,"minlength","15"),u.readOnly=m=!n[6]},m($,C){S($,e,C),y(e,t),y(e,i),y(e,l),y(e,s),y(e,o),S($,a,C),v&&v.m($,C),S($,f,C),S($,u,C),ae(u,n[3].id),h=!0,_||(g=Z(u,"input",n[41]),_=!0)},p($,C){(!h||C[2]&4096&&r!==(r=$[74]))&&p(e,"for",r),$[6]?v&&(se(),L(v,1,1,()=>{v=null}),oe()):v?(v.p($,C),C[0]&64&&I(v,1)):(v=Rm($),v.c(),I(v,1),v.m(f.parentNode,f)),(!h||C[2]&4096&&c!==(c=$[74]))&&p(u,"id",c),(!h||C[0]&128&&d!==(d=$[7]?"":"Leave empty to auto generate..."))&&p(u,"placeholder",d),(!h||C[0]&64&&m!==(m=!$[6]))&&(u.readOnly=m),C[0]&8&&u.value!==$[3].id&&ae(u,$[3].id)},i($){h||(I(v),h=!0)},o($){L(v),h=!1},d($){$&&(w(e),w(a),w(f),w(u)),v&&v.d($),_=!1,g()}}}function qm(n){var f,u;let e,t,i,l,s;function o(c){n[42](c)}let r={isNew:n[6],collection:n[0]};n[3]!==void 0&&(r.record=n[3]),e=new I6({props:r}),te.push(()=>ke(e,"record",o));let a=((u=(f=n[0])==null?void 0:f.schema)==null?void 0:u.length)&&jm();return{c(){B(e.$$.fragment),i=D(),a&&a.c(),l=ve()},m(c,d){z(e,c,d),S(c,i,d),a&&a.m(c,d),S(c,l,d),s=!0},p(c,d){var h,_;const m={};d[0]&64&&(m.isNew=c[6]),d[0]&1&&(m.collection=c[0]),!t&&d[0]&8&&(t=!0,m.record=c[3],ye(()=>t=!1)),e.$set(m),(_=(h=c[0])==null?void 0:h.schema)!=null&&_.length?a||(a=jm(),a.c(),a.m(l.parentNode,l)):a&&(a.d(1),a=null)},i(c){s||(I(e.$$.fragment,c),s=!0)},o(c){L(e.$$.fragment,c),s=!1},d(c){c&&(w(i),w(l)),V(e,c),a&&a.d(c)}}}function jm(n){let e;return{c(){e=b("hr")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function y8(n){let e,t,i;function l(o){n[55](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new fM({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function v8(n){let e,t,i,l,s;function o(u){n[52](u,n[71])}function r(u){n[53](u,n[71])}function a(u){n[54](u,n[71])}let f={field:n[71],record:n[3]};return n[3][n[71].name]!==void 0&&(f.value=n[3][n[71].name]),n[4][n[71].name]!==void 0&&(f.uploadedFiles=n[4][n[71].name]),n[5][n[71].name]!==void 0&&(f.deletedFileNames=n[5][n[71].name]),e=new UO({props:f}),te.push(()=>ke(e,"value",o)),te.push(()=>ke(e,"uploadedFiles",r)),te.push(()=>ke(e,"deletedFileNames",a)),{c(){B(e.$$.fragment)},m(u,c){z(e,u,c),s=!0},p(u,c){n=u;const d={};c[0]&1&&(d.field=n[71]),c[0]&8&&(d.record=n[3]),!t&&c[0]&9&&(t=!0,d.value=n[3][n[71].name],ye(()=>t=!1)),!i&&c[0]&17&&(i=!0,d.uploadedFiles=n[4][n[71].name],ye(()=>i=!1)),!l&&c[0]&33&&(l=!0,d.deletedFileNames=n[5][n[71].name],ye(()=>l=!1)),e.$set(d)},i(u){s||(I(e.$$.fragment,u),s=!0)},o(u){L(e.$$.fragment,u),s=!1},d(u){V(e,u)}}}function w8(n){let e,t,i;function l(o){n[51](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new _O({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function S8(n){let e,t,i;function l(o){n[50](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new aO({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function $8(n){let e,t,i;function l(o){n[49](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new lO({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function T8(n){let e,t,i;function l(o){n[48](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new PM({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function C8(n){let e,t,i;function l(o){n[47](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new eO({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function O8(n){let e,t,i;function l(o){n[46](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new G6({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function M8(n){let e,t,i;function l(o){n[45](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new Y6({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function D8(n){let e,t,i;function l(o){n[44](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new V6({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function E8(n){let e,t,i;function l(o){n[43](o,n[71])}let s={field:n[71]};return n[3][n[71].name]!==void 0&&(s.value=n[3][n[71].name]),e=new q6({props:s}),te.push(()=>ke(e,"value",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[71]),!t&&r[0]&9&&(t=!0,a.value=n[3][n[71].name],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function Hm(n,e){let t,i,l,s,o;const r=[E8,D8,M8,O8,C8,T8,$8,S8,w8,v8,y8],a=[];function f(u,c){return u[71].type==="text"?0:u[71].type==="number"?1:u[71].type==="bool"?2:u[71].type==="email"?3:u[71].type==="url"?4:u[71].type==="editor"?5:u[71].type==="date"?6:u[71].type==="select"?7:u[71].type==="json"?8:u[71].type==="file"?9:u[71].type==="relation"?10:-1}return~(i=f(e))&&(l=a[i]=r[i](e)),{key:n,first:null,c(){t=ve(),l&&l.c(),s=ve(),this.first=t},m(u,c){S(u,t,c),~i&&a[i].m(u,c),S(u,s,c),o=!0},p(u,c){e=u;let d=i;i=f(e),i===d?~i&&a[i].p(e,c):(l&&(se(),L(a[d],1,1,()=>{a[d]=null}),oe()),~i?(l=a[i],l?l.p(e,c):(l=a[i]=r[i](e),l.c()),I(l,1),l.m(s.parentNode,s)):l=null)},i(u){o||(I(l),o=!0)},o(u){L(l),o=!1},d(u){u&&(w(t),w(s)),~i&&a[i].d(u)}}}function zm(n){let e,t,i;return t=new b8({props:{record:n[3]}}),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item"),ee(e,"active",n[13]===gs)},m(l,s){S(l,e,s),z(t,e,null),i=!0},p(l,s){const o={};s[0]&8&&(o.record=l[3]),t.$set(o),(!i||s[0]&8192)&&ee(e,"active",l[13]===gs)},i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){L(t.$$.fragment,l),i=!1},d(l){l&&w(e),V(t)}}}function I8(n){var $;let e,t,i,l,s,o,r=[],a=new Map,f,u,c,d,m=!n[8]&&n[10]&&!n[7]&&Fm(n);l=new de({props:{class:"form-field "+(n[6]?"":"readonly"),name:"id",$$slots:{default:[k8,({uniqueId:C})=>({74:C}),({uniqueId:C})=>[0,0,C?4096:0]]},$$scope:{ctx:n}}});let h=n[14]&&qm(n),_=ce((($=n[0])==null?void 0:$.schema)||[]);const g=C=>C[71].name;for(let C=0;C<_.length;C+=1){let T=Pm(n,_,C),O=g(T);a.set(O,r[C]=Hm(O,T))}let v=n[14]&&!n[6]&&zm(n);return{c(){e=b("div"),t=b("form"),m&&m.c(),i=D(),B(l.$$.fragment),s=D(),h&&h.c(),o=D();for(let C=0;C<r.length;C+=1)r[C].c();f=D(),v&&v.c(),p(t,"id",n[17]),p(t,"class","tab-item"),ee(t,"no-pointer-events",n[7]),ee(t,"active",n[13]===Xi),p(e,"class","tabs-content no-animations")},m(C,T){S(C,e,T),y(e,t),m&&m.m(t,null),y(t,i),z(l,t,null),y(t,s),h&&h.m(t,null),y(t,o);for(let O=0;O<r.length;O+=1)r[O]&&r[O].m(t,null);y(e,f),v&&v.m(e,null),u=!0,c||(d=[Z(t,"submit",Ue(n[21])),Z(t,"keydown",n[26])],c=!0)},p(C,T){var M;!C[8]&&C[10]&&!C[7]?m?(m.p(C,T),T[0]&1408&&I(m,1)):(m=Fm(C),m.c(),I(m,1),m.m(t,i)):m&&(se(),L(m,1,1,()=>{m=null}),oe());const O={};T[0]&64&&(O.class="form-field "+(C[6]?"":"readonly")),T[0]&200|T[2]&12288&&(O.$$scope={dirty:T,ctx:C}),l.$set(O),C[14]?h?(h.p(C,T),T[0]&16384&&I(h,1)):(h=qm(C),h.c(),I(h,1),h.m(t,o)):h&&(se(),L(h,1,1,()=>{h=null}),oe()),T[0]&57&&(_=ce(((M=C[0])==null?void 0:M.schema)||[]),se(),r=ft(r,T,g,1,C,_,a,t,It,Hm,null,Pm),oe()),(!u||T[0]&128)&&ee(t,"no-pointer-events",C[7]),(!u||T[0]&8192)&&ee(t,"active",C[13]===Xi),C[14]&&!C[6]?v?(v.p(C,T),T[0]&16448&&I(v,1)):(v=zm(C),v.c(),I(v,1),v.m(e,null)):v&&(se(),L(v,1,1,()=>{v=null}),oe())},i(C){if(!u){I(m),I(l.$$.fragment,C),I(h);for(let T=0;T<_.length;T+=1)I(r[T]);I(v),u=!0}},o(C){L(m),L(l.$$.fragment,C),L(h);for(let T=0;T<r.length;T+=1)L(r[T]);L(v),u=!1},d(C){C&&w(e),m&&m.d(),V(l),h&&h.d();for(let T=0;T<r.length;T+=1)r[T].d();v&&v.d(),c=!1,Te(d)}}}function A8(n){var m;let e,t=n[6]?"New":"Edit",i,l,s,o=((m=n[0])==null?void 0:m.name)+"",r,a,f,u,c,d=!n[6]&&Vm(n);return{c(){e=b("h4"),i=J(t),l=D(),s=b("strong"),r=J(o),a=J(" record"),f=D(),d&&d.c(),u=ve(),p(e,"class","panel-title svelte-qc5ngu")},m(h,_){S(h,e,_),y(e,i),y(e,l),y(e,s),y(s,r),y(e,a),S(h,f,_),d&&d.m(h,_),S(h,u,_),c=!0},p(h,_){var g;(!c||_[0]&64)&&t!==(t=h[6]?"New":"Edit")&&re(i,t),(!c||_[0]&1)&&o!==(o=((g=h[0])==null?void 0:g.name)+"")&&re(r,o),h[6]?d&&(se(),L(d,1,1,()=>{d=null}),oe()):d?(d.p(h,_),_[0]&64&&I(d,1)):(d=Vm(h),d.c(),I(d,1),d.m(u.parentNode,u))},i(h){c||(I(d),c=!0)},o(h){L(d),c=!1},d(h){h&&(w(e),w(f),w(u)),d&&d.d(h)}}}function L8(n){let e,t,i;return{c(){e=b("span"),t=D(),i=b("h4"),i.textContent="Loading...",p(e,"class","loader loader-sm"),p(i,"class","panel-title txt-hint svelte-qc5ngu")},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},p:x,i:x,o:x,d(l){l&&(w(e),w(t),w(i))}}}function Vm(n){let e,t,i,l,s,o,r;return o=new Mn({props:{class:"dropdown dropdown-right dropdown-nowrap",$$slots:{default:[N8]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=D(),i=b("div"),l=b("i"),s=D(),B(o.$$.fragment),p(e,"class","flex-fill"),p(l,"class","ri-more-line"),p(l,"aria-hidden","true"),p(i,"tabindex","0"),p(i,"role","button"),p(i,"aria-label","More record options"),p(i,"class","btn btn-sm btn-circle btn-transparent flex-gap-0")},m(a,f){S(a,e,f),S(a,t,f),S(a,i,f),y(i,l),y(i,s),z(o,i,null),r=!0},p(a,f){const u={};f[0]&16388|f[2]&8192&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(I(o.$$.fragment,a),r=!0)},o(a){L(o.$$.fragment,a),r=!1},d(a){a&&(w(e),w(t),w(i)),V(o)}}}function Bm(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-mail-check-line"></i> <span class="txt">Send verification email</span>',p(e,"type","button"),p(e,"class","dropdown-item closable"),p(e,"role","menuitem")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[33]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function Um(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-mail-lock-line"></i> <span class="txt">Send password reset email</span>',p(e,"type","button"),p(e,"class","dropdown-item closable"),p(e,"role","menuitem")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[34]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function N8(n){let e,t,i,l,s,o,r,a=n[14]&&!n[2].verified&&n[2].email&&Bm(n),f=n[14]&&n[2].email&&Um(n);return{c(){a&&a.c(),e=D(),f&&f.c(),t=D(),i=b("button"),i.innerHTML='<i class="ri-file-copy-line"></i> <span class="txt">Duplicate</span>',l=D(),s=b("button"),s.innerHTML='<i class="ri-delete-bin-7-line"></i> <span class="txt">Delete</span>',p(i,"type","button"),p(i,"class","dropdown-item closable"),p(i,"role","menuitem"),p(s,"type","button"),p(s,"class","dropdown-item txt-danger closable"),p(s,"role","menuitem")},m(u,c){a&&a.m(u,c),S(u,e,c),f&&f.m(u,c),S(u,t,c),S(u,i,c),S(u,l,c),S(u,s,c),o||(r=[Z(i,"click",n[35]),Z(s,"click",Cn(Ue(n[36])))],o=!0)},p(u,c){u[14]&&!u[2].verified&&u[2].email?a?a.p(u,c):(a=Bm(u),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),u[14]&&u[2].email?f?f.p(u,c):(f=Um(u),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null)},d(u){u&&(w(e),w(t),w(i),w(l),w(s)),a&&a.d(u),f&&f.d(u),o=!1,Te(r)}}}function Wm(n){let e,t,i,l,s,o;return{c(){e=b("div"),t=b("button"),t.textContent="Account",i=D(),l=b("button"),l.textContent="Authorized providers",p(t,"type","button"),p(t,"class","tab-item"),ee(t,"active",n[13]===Xi),p(l,"type","button"),p(l,"class","tab-item"),ee(l,"active",n[13]===gs),p(e,"class","tabs-header stretched")},m(r,a){S(r,e,a),y(e,t),y(e,i),y(e,l),s||(o=[Z(t,"click",n[37]),Z(l,"click",n[38])],s=!0)},p(r,a){a[0]&8192&&ee(t,"active",r[13]===Xi),a[0]&8192&&ee(l,"active",r[13]===gs)},d(r){r&&w(e),s=!1,Te(o)}}}function P8(n){let e,t,i,l,s;const o=[L8,A8],r=[];function a(u,c){return u[7]?0:1}e=a(n),t=r[e]=o[e](n);let f=n[14]&&!n[6]&&Wm(n);return{c(){t.c(),i=D(),f&&f.c(),l=ve()},m(u,c){r[e].m(u,c),S(u,i,c),f&&f.m(u,c),S(u,l,c),s=!0},p(u,c){let d=e;e=a(u),e===d?r[e].p(u,c):(se(),L(r[d],1,1,()=>{r[d]=null}),oe(),t=r[e],t?t.p(u,c):(t=r[e]=o[e](u),t.c()),I(t,1),t.m(i.parentNode,i)),u[14]&&!u[6]?f?f.p(u,c):(f=Wm(u),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null)},i(u){s||(I(t),s=!0)},o(u){L(t),s=!1},d(u){u&&(w(i),w(l)),r[e].d(u),f&&f.d(u)}}}function F8(n){let e,t,i,l,s,o,r=n[6]?"Create":"Save changes",a,f,u,c;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",l=D(),s=b("button"),o=b("span"),a=J(r),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=i=n[11]||n[7],p(o,"class","txt"),p(s,"type","submit"),p(s,"form",n[17]),p(s,"class","btn btn-expanded"),s.disabled=f=!n[15]||n[11],ee(s,"btn-loading",n[11]||n[7])},m(d,m){S(d,e,m),y(e,t),S(d,l,m),S(d,s,m),y(s,o),y(o,a),u||(c=Z(e,"click",n[32]),u=!0)},p(d,m){m[0]&2176&&i!==(i=d[11]||d[7])&&(e.disabled=i),m[0]&64&&r!==(r=d[6]?"Create":"Save changes")&&re(a,r),m[0]&34816&&f!==(f=!d[15]||d[11])&&(s.disabled=f),m[0]&2176&&ee(s,"btn-loading",d[11]||d[7])},d(d){d&&(w(e),w(l),w(s)),u=!1,c()}}}function R8(n){let e,t,i={class:`
record-panel
`+(n[16]?"overlay-panel-xl":"overlay-panel-lg")+`
`+(n[14]&&!n[6]?"colored-header":"")+`
`,btnClose:!n[7],escClose:!n[7],overlayClose:!n[7],beforeHide:n[56],$$slots:{footer:[F8],header:[P8],default:[I8]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[57](e),e.$on("hide",n[58]),e.$on("show",n[59]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,s){const o={};s[0]&81984&&(o.class=`
record-panel
`+(l[16]?"overlay-panel-xl":"overlay-panel-lg")+`
`+(l[14]&&!l[6]?"colored-header":"")+`
`),s[0]&128&&(o.btnClose=!l[7]),s[0]&128&&(o.escClose=!l[7]),s[0]&128&&(o.overlayClose=!l[7]),s[0]&4352&&(o.beforeHide=l[56]),s[0]&60925|s[2]&8192&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[57](null),V(e,l)}}}const Xi="form",gs="providers";function q8(n,e,t){let i,l,s,o,r;const a=st(),f="record_"+H.randomString(5);let{collection:u}=e,c,d={},m={},h=null,_=!1,g=!1,v={},$={},C=JSON.stringify(d),T=C,O=Xi,M=!0,E=!0,A=u;function N(_e){return j(_e),t(12,g=!0),t(13,O=Xi),c==null?void 0:c.show()}function q(){return c==null?void 0:c.hide()}function R(){t(12,g=!1),q()}function P(){t(30,A=u),c!=null&&c.isActive()&&(W(JSON.stringify(m)),R())}async function F(_e){if(_e&&typeof _e=="string"){try{return await fe.collection(u.id).getOne(_e)}catch(Me){Me.isAbort||(R(),console.warn("resolveModel:",Me),li(`Unable to load record with id "${_e}"`))}return null}return _e}async function j(_e){t(7,E=!0),Gt({}),t(4,v={}),t(5,$={}),t(2,d=typeof _e=="string"?{id:_e,collectionId:u==null?void 0:u.id,collectionName:u==null?void 0:u.name}:_e||{}),t(3,m=structuredClone(d)),t(2,d=await F(_e)||{}),t(3,m=structuredClone(d)),await xt(),t(10,h=X()),!h||le(m,h)?t(10,h=null):(delete h.password,delete h.passwordConfirm),t(28,C=JSON.stringify(m)),t(7,E=!1)}async function U(_e){var _t,Jt;Gt({}),t(2,d=_e||{}),t(4,v={}),t(5,$={});const Me=((Jt=(_t=u==null?void 0:u.schema)==null?void 0:_t.filter(ct=>ct.type!="file"))==null?void 0:Jt.map(ct=>ct.name))||[];for(let ct in _e)Me.includes(ct)||t(3,m[ct]=_e[ct],m);await xt(),t(28,C=JSON.stringify(m)),ne()}function Y(){return"record_draft_"+((u==null?void 0:u.id)||"")+"_"+((d==null?void 0:d.id)||"")}function X(_e){try{const Me=window.localStorage.getItem(Y());if(Me)return JSON.parse(Me)}catch{}return _e}function W(_e){try{window.localStorage.setItem(Y(),_e)}catch(Me){console.warn("updateDraft failure:",Me),window.localStorage.removeItem(Y())}}function K(){h&&(t(3,m=h),t(10,h=null))}function le(_e,Me){var G;const _t=structuredClone(_e||{}),Jt=structuredClone(Me||{}),ct=(G=u==null?void 0:u.schema)==null?void 0:G.filter(Q=>Q.type==="file");for(let Q of ct)delete _t[Q.name],delete Jt[Q.name];const ri=["expand","password","passwordConfirm"];for(let Q of ri)delete _t[Q],delete Jt[Q];return JSON.stringify(_t)==JSON.stringify(Jt)}function ne(){t(10,h=null),window.localStorage.removeItem(Y())}async function me(_e=!0){if(!(_||!r||!(u!=null&&u.id))){t(11,_=!0);try{const Me=ze();let _t;M?_t=await fe.collection(u.id).create(Me):_t=await fe.collection(u.id).update(m.id,Me),Nt(M?"Successfully created record.":"Successfully updated record."),ne(),_e?R():U(_t),a("save",{isNew:M,record:_t})}catch(Me){fe.error(Me)}t(11,_=!1)}}function Pe(){d!=null&&d.id&&un("Do you really want to delete the selected record?",()=>fe.collection(d.collectionId).delete(d.id).then(()=>{q(),Nt("Successfully deleted record."),a("delete",d)}).catch(_e=>{fe.error(_e)}))}function ze(){const _e=structuredClone(m||{}),Me=new FormData,_t={id:_e.id},Jt={};for(const ct of(u==null?void 0:u.schema)||[])_t[ct.name]=!0,ct.type=="json"&&(Jt[ct.name]=!0);i&&(_t.username=!0,_t.email=!0,_t.emailVisibility=!0,_t.password=!0,_t.passwordConfirm=!0,_t.verified=!0);for(const ct in _e)if(_t[ct]){if(typeof _e[ct]>"u"&&(_e[ct]=null),Jt[ct]&&_e[ct]!=="")try{JSON.parse(_e[ct])}catch(ri){const G={};throw G[ct]={code:"invalid_json",message:ri.toString()},new bn({status:400,response:{data:G}})}H.addValueToFormData(Me,ct,_e[ct])}for(const ct in v){const ri=H.toArray(v[ct]);for(const G of ri)Me.append(ct,G)}for(const ct in $){const ri=H.toArray($[ct]);for(const G of ri)Me.append(ct+"."+G,"")}return Me}function Qe(){!(u!=null&&u.id)||!(d!=null&&d.email)||un(`Do you really want to sent verification email to ${d.email}?`,()=>fe.collection(u.id).requestVerification(d.email).then(()=>{Nt(`Successfully sent verification email to ${d.email}.`)}).catch(_e=>{fe.error(_e)}))}function et(){!(u!=null&&u.id)||!(d!=null&&d.email)||un(`Do you really want to sent password reset email to ${d.email}?`,()=>fe.collection(u.id).requestPasswordReset(d.email).then(()=>{Nt(`Successfully sent password reset email to ${d.email}.`)}).catch(_e=>{fe.error(_e)}))}function Dt(){o?un("You have unsaved changes. Do you really want to discard them?",()=>{ut()}):ut()}async function ut(){let _e=d?structuredClone(d):null;if(_e){_e.id="",_e.created="",_e.updated="";const Me=(u==null?void 0:u.schema)||[];for(const _t of Me)_t.type==="file"&&delete _e[_t.name]}ne(),N(_e),await xt(),t(28,C="")}function ht(_e){(_e.ctrlKey||_e.metaKey)&&_e.code=="KeyS"&&(_e.preventDefault(),_e.stopPropagation(),me(!1))}const Qt=()=>q(),Ee=()=>Qe(),Le=()=>et(),Ve=()=>Dt(),bt=()=>Pe(),pe=()=>t(13,O=Xi),we=()=>t(13,O=gs),Se=()=>K(),Ke=()=>ne();function Vt(){m.id=this.value,t(3,m)}function dn(_e){m=_e,t(3,m)}function an(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function jn(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function Li(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function rl(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function bi(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function Ie(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function Pt(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function Ni(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function Zn(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function al(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}function Fl(_e,Me){n.$$.not_equal(v[Me.name],_e)&&(v[Me.name]=_e,t(4,v))}function ki(_e,Me){n.$$.not_equal($[Me.name],_e)&&($[Me.name]=_e,t(5,$))}function fl(_e,Me){n.$$.not_equal(m[Me.name],_e)&&(m[Me.name]=_e,t(3,m))}const ul=()=>o&&g?(un("You have unsaved changes. Do you really want to close the panel?",()=>{R()}),!1):(Gt({}),ne(),!0);function kt(_e){te[_e?"unshift":"push"](()=>{c=_e,t(9,c)})}function at(_e){Oe.call(this,n,_e)}function Dn(_e){Oe.call(this,n,_e)}return n.$$set=_e=>{"collection"in _e&&t(0,u=_e.collection)},n.$$.update=()=>{var _e;n.$$.dirty[0]&1&&t(14,i=(u==null?void 0:u.type)==="auth"),n.$$.dirty[0]&1&&t(16,l=!!((_e=u==null?void 0:u.schema)!=null&&_e.find(Me=>Me.type==="editor"))),n.$$.dirty[0]&48&&t(31,s=H.hasNonEmptyProps(v)||H.hasNonEmptyProps($)),n.$$.dirty[0]&8&&t(29,T=JSON.stringify(m)),n.$$.dirty[0]&805306368|n.$$.dirty[1]&1&&t(8,o=s||C!=T),n.$$.dirty[0]&4&&t(6,M=!d||!d.id),n.$$.dirty[0]&448&&t(15,r=!E&&(M||o)),n.$$.dirty[0]&536871040&&(E||W(T)),n.$$.dirty[0]&1073741825&&u&&(A==null?void 0:A.id)!=(u==null?void 0:u.id)&&P()},[u,q,d,m,v,$,M,E,o,c,h,_,g,O,i,r,l,f,R,K,ne,me,Pe,Qe,et,Dt,ht,N,C,T,A,s,Qt,Ee,Le,Ve,bt,pe,we,Se,Ke,Vt,dn,an,jn,Li,rl,bi,Ie,Pt,Ni,Zn,al,Fl,ki,fl,ul,kt,at,Dn]}class Ka extends be{constructor(e){super(),ge(this,e,q8,R8,he,{collection:0,show:27,hide:1},null,[-1,-1,-1])}get show(){return this.$$.ctx[27]}get hide(){return this.$$.ctx[1]}}function j8(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function H8(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("div"),t=b("div"),i=J(n[2]),l=D(),s=b("div"),o=J(n[1]),r=J(" UTC"),p(t,"class","date"),p(s,"class","time svelte-5pjd03"),p(e,"class","datetime svelte-5pjd03")},m(u,c){S(u,e,c),y(e,t),y(t,i),y(e,l),y(e,s),y(s,o),y(s,r),a||(f=$e(Fe.call(null,e,n[3])),a=!0)},p(u,c){c&4&&re(i,u[2]),c&2&&re(o,u[1])},d(u){u&&w(e),a=!1,f()}}}function z8(n){let e;function t(s,o){return s[0]?H8:j8}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:x,o:x,d(s){s&&w(e),l.d(s)}}}function V8(n,e,t){let i,l,{date:s=""}=e;const o={get text(){return H.formatToLocalDate(s)+" Local"}};return n.$$set=r=>{"date"in r&&t(0,s=r.date)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=s?s.substring(0,10):null),n.$$.dirty&1&&t(1,l=s?s.substring(10,19):null)},[s,l,i,o]}class tl extends be{constructor(e){super(),ge(this,e,V8,z8,he,{date:0})}}function Ym(n,e,t){const i=n.slice();return i[18]=e[t],i[8]=t,i}function Km(n,e,t){const i=n.slice();return i[13]=e[t],i}function Jm(n,e,t){const i=n.slice();return i[6]=e[t],i[8]=t,i}function Zm(n,e,t){const i=n.slice();return i[6]=e[t],i[8]=t,i}function B8(n){const e=n.slice(),t=H.toArray(e[3]);e[16]=t;const i=e[2]?10:500;return e[17]=i,e}function U8(n){var s,o;const e=n.slice(),t=H.toArray(e[3]);e[9]=t;const i=H.toArray((o=(s=e[0])==null?void 0:s.expand)==null?void 0:o[e[1].name]);e[10]=i;const l=e[2]?20:500;return e[11]=l,e}function W8(n){const e=n.slice(),t=H.trimQuotedValue(JSON.stringify(e[3]))||'""';return e[5]=t,e}function Y8(n){let e,t;return{c(){e=b("div"),t=J(n[3]),p(e,"class","block txt-break fallback-block svelte-jdf51v")},m(i,l){S(i,e,l),y(e,t)},p(i,l){l&8&&re(t,i[3])},i:x,o:x,d(i){i&&w(e)}}}function K8(n){let e,t=H.truncate(n[3])+"",i,l;return{c(){e=b("span"),i=J(t),p(e,"class","txt txt-ellipsis"),p(e,"title",l=H.truncate(n[3]))},m(s,o){S(s,e,o),y(e,i)},p(s,o){o&8&&t!==(t=H.truncate(s[3])+"")&&re(i,t),o&8&&l!==(l=H.truncate(s[3]))&&p(e,"title",l)},i:x,o:x,d(s){s&&w(e)}}}function J8(n){let e,t=[],i=new Map,l,s,o=ce(n[16].slice(0,n[17]));const r=f=>f[8]+f[18];for(let f=0;f<o.length;f+=1){let u=Ym(n,o,f),c=r(u);i.set(c,t[f]=Gm(c,u))}let a=n[16].length>n[17]&&Xm();return{c(){var f;e=b("div");for(let u=0;u<t.length;u+=1)t[u].c();l=D(),a&&a.c(),p(e,"class","inline-flex"),ee(e,"multiple",((f=n[1].options)==null?void 0:f.maxSelect)!=1)},m(f,u){S(f,e,u);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);y(e,l),a&&a.m(e,null),s=!0},p(f,u){var c;u&13&&(o=ce(f[16].slice(0,f[17])),se(),t=ft(t,u,r,1,f,o,i,e,It,Gm,l,Ym),oe()),f[16].length>f[17]?a||(a=Xm(),a.c(),a.m(e,null)):a&&(a.d(1),a=null),(!s||u&2)&&ee(e,"multiple",((c=f[1].options)==null?void 0:c.maxSelect)!=1)},i(f){if(!s){for(let u=0;u<o.length;u+=1)I(t[u]);s=!0}},o(f){for(let u=0;u<t.length;u+=1)L(t[u]);s=!1},d(f){f&&w(e);for(let u=0;u<t.length;u+=1)t[u].d();a&&a.d()}}}function Z8(n){let e,t,i,l,s;const o=[sD,lD],r=[];function a(u,c){return u[10].length?0:1}t=a(n),i=r[t]=o[t](n);let f=n[9].length>n[11]&&eh();return{c(){e=b("div"),i.c(),l=D(),f&&f.c(),p(e,"class","inline-flex")},m(u,c){S(u,e,c),r[t].m(e,null),y(e,l),f&&f.m(e,null),s=!0},p(u,c){let d=t;t=a(u),t===d?r[t].p(u,c):(se(),L(r[d],1,1,()=>{r[d]=null}),oe(),i=r[t],i?i.p(u,c):(i=r[t]=o[t](u),i.c()),I(i,1),i.m(e,l)),u[9].length>u[11]?f||(f=eh(),f.c(),f.m(e,null)):f&&(f.d(1),f=null)},i(u){s||(I(i),s=!0)},o(u){L(i),s=!1},d(u){u&&w(e),r[t].d(),f&&f.d()}}}function G8(n){let e,t=[],i=new Map,l=ce(H.toArray(n[3]));const s=o=>o[8]+o[6];for(let o=0;o<l.length;o+=1){let r=Zm(n,l,o),a=s(r);i.set(a,t[o]=th(a,r))}return{c(){e=b("div");for(let o=0;o<t.length;o+=1)t[o].c();p(e,"class","inline-flex")},m(o,r){S(o,e,r);for(let a=0;a<t.length;a+=1)t[a]&&t[a].m(e,null)},p(o,r){r&8&&(l=ce(H.toArray(o[3])),t=ft(t,r,s,1,o,l,i,e,Ai,th,null,Zm))},i:x,o:x,d(o){o&&w(e);for(let r=0;r<t.length;r+=1)t[r].d()}}}function X8(n){let e,t;return e=new tl({props:{date:n[3]}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&8&&(s.date=i[3]),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Q8(n){let e,t,i,l;const s=[rD,oD],o=[];function r(a,f){return a[2]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}function x8(n){let e,t=H.truncate(n[3])+"",i,l,s;return{c(){e=b("a"),i=J(t),p(e,"class","txt-ellipsis"),p(e,"href",n[3]),p(e,"target","_blank"),p(e,"rel","noopener noreferrer")},m(o,r){S(o,e,r),y(e,i),l||(s=[$e(Fe.call(null,e,"Open in new tab")),Z(e,"click",Cn(n[4]))],l=!0)},p(o,r){r&8&&t!==(t=H.truncate(o[3])+"")&&re(i,t),r&8&&p(e,"href",o[3])},i:x,o:x,d(o){o&&w(e),l=!1,Te(s)}}}function eD(n){let e,t;return{c(){e=b("span"),t=J(n[3]),p(e,"class","txt")},m(i,l){S(i,e,l),y(e,t)},p(i,l){l&8&&re(t,i[3])},i:x,o:x,d(i){i&&w(e)}}}function tD(n){let e,t=n[3]?"True":"False",i;return{c(){e=b("span"),i=J(t),p(e,"class","txt")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&8&&t!==(t=l[3]?"True":"False")&&re(i,t)},i:x,o:x,d(l){l&&w(e)}}}function nD(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function iD(n){let e,t,i,l;const s=[fD,aD],o=[];function r(a,f){return a[2]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ve()},m(a,f){o[e].m(a,f),S(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),L(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),I(t,1),t.m(i.parentNode,i))},i(a){l||(I(t),l=!0)},o(a){L(t),l=!1},d(a){a&&w(i),o[e].d(a)}}}function Gm(n,e){let t,i,l;return i=new Wa({props:{record:e[0],filename:e[18],size:"sm"}}),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(s,o){S(s,t,o),z(i,s,o),l=!0},p(s,o){e=s;const r={};o&1&&(r.record=e[0]),o&12&&(r.filename=e[18]),i.$set(r)},i(s){l||(I(i.$$.fragment,s),l=!0)},o(s){L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(i,s)}}}function Xm(n){let e;return{c(){e=J("...")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function lD(n){let e,t=ce(n[9].slice(0,n[11])),i=[];for(let l=0;l<t.length;l+=1)i[l]=Qm(Km(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);S(l,e,s)},p(l,s){if(s&12){t=ce(l[9].slice(0,l[11]));let o;for(o=0;o<t.length;o+=1){const r=Km(l,t,o);i[o]?i[o].p(r,s):(i[o]=Qm(r),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},i:x,o:x,d(l){l&&w(e),rt(i,l)}}}function sD(n){let e=[],t=new Map,i,l,s=ce(n[10].slice(0,n[11]));const o=r=>r[8]+r[6];for(let r=0;r<s.length;r+=1){let a=Jm(n,s,r),f=o(a);t.set(f,e[r]=xm(f,a))}return{c(){for(let r=0;r<e.length;r+=1)e[r].c();i=ve()},m(r,a){for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(r,a);S(r,i,a),l=!0},p(r,a){a&7&&(s=ce(r[10].slice(0,r[11])),se(),e=ft(e,a,o,1,r,s,t,i.parentNode,It,xm,i,Jm),oe())},i(r){if(!l){for(let a=0;a<s.length;a+=1)I(e[a]);l=!0}},o(r){for(let a=0;a<e.length;a+=1)L(e[a]);l=!1},d(r){r&&w(i);for(let a=0;a<e.length;a+=1)e[a].d(r)}}}function Qm(n){let e,t=n[13]+"",i;return{c(){e=b("span"),i=J(t),p(e,"class","label")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&12&&t!==(t=l[13]+"")&&re(i,t)},d(l){l&&w(e)}}}function xm(n,e){let t,i,l,s;return i=new er({props:{record:e[6]}}),{key:n,first:null,c(){t=b("span"),B(i.$$.fragment),l=D(),p(t,"class","label"),this.first=t},m(o,r){S(o,t,r),z(i,t,null),y(t,l),s=!0},p(o,r){e=o;const a={};r&7&&(a.record=e[6]),i.$set(a)},i(o){s||(I(i.$$.fragment,o),s=!0)},o(o){L(i.$$.fragment,o),s=!1},d(o){o&&w(t),V(i)}}}function eh(n){let e;return{c(){e=J("...")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function th(n,e){let t,i=e[6]+"",l;return{key:n,first:null,c(){t=b("span"),l=J(i),p(t,"class","label"),this.first=t},m(s,o){S(s,t,o),y(t,l)},p(s,o){e=s,o&8&&i!==(i=e[6]+"")&&re(l,i)},d(s){s&&w(t)}}}function oD(n){let e,t;return e=new Ya({props:{cssClass:"tinymce-preview",conf:{branding:!1,promotion:!1,menubar:!1,statusbar:!1,min_height:30,height:59,max_height:500,autoresize_bottom_margin:5,resize:!1,content_style:"body { font-size: 14px }",toolbar:"",plugins:["autoresize"],skin:"pocketbase"},value:n[3],disabled:!0}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&8&&(s.value=i[3]),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function rD(n){let e,t=H.truncate(H.plainText(n[3]),195)+"",i;return{c(){e=b("span"),i=J(t),p(e,"class","txt")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&8&&t!==(t=H.truncate(H.plainText(l[3]),195)+"")&&re(i,t)},i:x,o:x,d(l){l&&w(e)}}}function aD(n){let e,t=H.truncate(n[5],500,!0)+"",i,l,s,o,r=n[5].length>500&&nh(n);return{c(){e=b("span"),i=J(t),l=D(),r&&r.c(),s=ve(),p(e,"class","txt")},m(a,f){S(a,e,f),y(e,i),S(a,l,f),r&&r.m(a,f),S(a,s,f),o=!0},p(a,f){(!o||f&8)&&t!==(t=H.truncate(a[5],500,!0)+"")&&re(i,t),a[5].length>500?r?(r.p(a,f),f&8&&I(r,1)):(r=nh(a),r.c(),I(r,1),r.m(s.parentNode,s)):r&&(se(),L(r,1,1,()=>{r=null}),oe())},i(a){o||(I(r),o=!0)},o(a){L(r),o=!1},d(a){a&&(w(e),w(l),w(s)),r&&r.d(a)}}}function fD(n){let e,t=H.truncate(n[5])+"",i;return{c(){e=b("span"),i=J(t),p(e,"class","txt txt-ellipsis")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s&8&&t!==(t=H.truncate(l[5])+"")&&re(i,t)},i:x,o:x,d(l){l&&w(e)}}}function nh(n){let e,t;return e=new ol({props:{value:JSON.stringify(n[3],null,2)}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&8&&(s.value=JSON.stringify(i[3],null,2)),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function uD(n){let e,t,i,l,s;const o=[iD,nD,tD,eD,x8,Q8,X8,G8,Z8,J8,K8,Y8],r=[];function a(u,c){return c&8&&(e=null),u[1].type==="json"?0:(e==null&&(e=!!H.isEmpty(u[3])),e?1:u[1].type==="bool"?2:u[1].type==="number"?3:u[1].type==="url"?4:u[1].type==="editor"?5:u[1].type==="date"?6:u[1].type==="select"?7:u[1].type==="relation"?8:u[1].type==="file"?9:u[2]?10:11)}function f(u,c){return c===0?W8(u):c===8?U8(u):c===9?B8(u):u}return t=a(n,-1),i=r[t]=o[t](f(n,t)),{c(){i.c(),l=ve()},m(u,c){r[t].m(u,c),S(u,l,c),s=!0},p(u,[c]){let d=t;t=a(u,c),t===d?r[t].p(f(u,t),c):(se(),L(r[d],1,1,()=>{r[d]=null}),oe(),i=r[t],i?i.p(f(u,t),c):(i=r[t]=o[t](f(u,t)),i.c()),I(i,1),i.m(l.parentNode,l))},i(u){s||(I(i),s=!0)},o(u){L(i),s=!1},d(u){u&&w(l),r[t].d(u)}}}function cD(n,e,t){let i,{record:l}=e,{field:s}=e,{short:o=!1}=e;function r(a){Oe.call(this,n,a)}return n.$$set=a=>{"record"in a&&t(0,l=a.record),"field"in a&&t(1,s=a.field),"short"in a&&t(2,o=a.short)},n.$$.update=()=>{n.$$.dirty&3&&t(3,i=l==null?void 0:l[s.name])},[l,s,o,i,r]}class Xb extends be{constructor(e){super(),ge(this,e,cD,uD,he,{record:0,field:1,short:2})}}function ih(n,e,t){const i=n.slice();return i[13]=e[t],i}function lh(n){let e,t,i=n[13].name+"",l,s,o,r,a;return r=new Xb({props:{field:n[13],record:n[3]}}),{c(){e=b("tr"),t=b("td"),l=J(i),s=D(),o=b("td"),B(r.$$.fragment),p(t,"class","min-width txt-hint txt-bold"),p(o,"class","col-field svelte-1nt58f7")},m(f,u){S(f,e,u),y(e,t),y(t,l),y(e,s),y(e,o),z(r,o,null),a=!0},p(f,u){(!a||u&1)&&i!==(i=f[13].name+"")&&re(l,i);const c={};u&1&&(c.field=f[13]),u&8&&(c.record=f[3]),r.$set(c)},i(f){a||(I(r.$$.fragment,f),a=!0)},o(f){L(r.$$.fragment,f),a=!1},d(f){f&&w(e),V(r)}}}function sh(n){let e,t,i,l,s,o;return s=new tl({props:{date:n[3].created}}),{c(){e=b("tr"),t=b("td"),t.textContent="created",i=D(),l=b("td"),B(s.$$.fragment),p(t,"class","min-width txt-hint txt-bold"),p(l,"class","col-field svelte-1nt58f7")},m(r,a){S(r,e,a),y(e,t),y(e,i),y(e,l),z(s,l,null),o=!0},p(r,a){const f={};a&8&&(f.date=r[3].created),s.$set(f)},i(r){o||(I(s.$$.fragment,r),o=!0)},o(r){L(s.$$.fragment,r),o=!1},d(r){r&&w(e),V(s)}}}function oh(n){let e,t,i,l,s,o;return s=new tl({props:{date:n[3].updated}}),{c(){e=b("tr"),t=b("td"),t.textContent="updated",i=D(),l=b("td"),B(s.$$.fragment),p(t,"class","min-width txt-hint txt-bold"),p(l,"class","col-field svelte-1nt58f7")},m(r,a){S(r,e,a),y(e,t),y(e,i),y(e,l),z(s,l,null),o=!0},p(r,a){const f={};a&8&&(f.date=r[3].updated),s.$set(f)},i(r){o||(I(s.$$.fragment,r),o=!0)},o(r){L(s.$$.fragment,r),o=!1},d(r){r&&w(e),V(s)}}}function dD(n){var M;let e,t,i,l,s,o,r,a,f,u,c=(n[3].id||"...")+"",d,m,h,_,g;a=new ol({props:{value:n[3].id}});let v=ce((M=n[0])==null?void 0:M.schema),$=[];for(let E=0;E<v.length;E+=1)$[E]=lh(ih(n,v,E));const C=E=>L($[E],1,1,()=>{$[E]=null});let T=n[3].created&&sh(n),O=n[3].updated&&oh(n);return{c(){e=b("table"),t=b("tbody"),i=b("tr"),l=b("td"),l.textContent="id",s=D(),o=b("td"),r=b("div"),B(a.$$.fragment),f=D(),u=b("span"),d=J(c),m=D();for(let E=0;E<$.length;E+=1)$[E].c();h=D(),T&&T.c(),_=D(),O&&O.c(),p(l,"class","min-width txt-hint txt-bold"),p(u,"class","txt"),p(r,"class","label"),p(o,"class","col-field svelte-1nt58f7"),p(e,"class","table-border preview-table"),ee(e,"table-loading",n[4])},m(E,A){S(E,e,A),y(e,t),y(t,i),y(i,l),y(i,s),y(i,o),y(o,r),z(a,r,null),y(r,f),y(r,u),y(u,d),y(t,m);for(let N=0;N<$.length;N+=1)$[N]&&$[N].m(t,null);y(t,h),T&&T.m(t,null),y(t,_),O&&O.m(t,null),g=!0},p(E,A){var q;const N={};if(A&8&&(N.value=E[3].id),a.$set(N),(!g||A&8)&&c!==(c=(E[3].id||"...")+"")&&re(d,c),A&9){v=ce((q=E[0])==null?void 0:q.schema);let R;for(R=0;R<v.length;R+=1){const P=ih(E,v,R);$[R]?($[R].p(P,A),I($[R],1)):($[R]=lh(P),$[R].c(),I($[R],1),$[R].m(t,h))}for(se(),R=v.length;R<$.length;R+=1)C(R);oe()}E[3].created?T?(T.p(E,A),A&8&&I(T,1)):(T=sh(E),T.c(),I(T,1),T.m(t,_)):T&&(se(),L(T,1,1,()=>{T=null}),oe()),E[3].updated?O?(O.p(E,A),A&8&&I(O,1)):(O=oh(E),O.c(),I(O,1),O.m(t,null)):O&&(se(),L(O,1,1,()=>{O=null}),oe()),(!g||A&16)&&ee(e,"table-loading",E[4])},i(E){if(!g){I(a.$$.fragment,E);for(let A=0;A<v.length;A+=1)I($[A]);I(T),I(O),g=!0}},o(E){L(a.$$.fragment,E),$=$.filter(Boolean);for(let A=0;A<$.length;A+=1)L($[A]);L(T),L(O),g=!1},d(E){E&&w(e),V(a),rt($,E),T&&T.d(),O&&O.d()}}}function pD(n){var o;let e,t,i=((o=n[0])==null?void 0:o.name)+"",l,s;return{c(){e=b("h4"),t=b("strong"),l=J(i),s=J(" record preview")},m(r,a){S(r,e,a),y(e,t),y(t,l),y(e,s)},p(r,a){var f;a&1&&i!==(i=((f=r[0])==null?void 0:f.name)+"")&&re(l,i)},d(r){r&&w(e)}}}function mD(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Close</span>',p(e,"type","button"),p(e,"class","btn btn-transparent")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[7]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function hD(n){let e,t,i={class:"record-preview-panel "+(n[5]?"overlay-panel-xl":"overlay-panel-lg"),$$slots:{footer:[mD],header:[pD],default:[dD]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[8](e),e.$on("hide",n[9]),e.$on("show",n[10]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&32&&(o.class="record-preview-panel "+(l[5]?"overlay-panel-xl":"overlay-panel-lg")),s&65561&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[8](null),V(e,l)}}}function _D(n,e,t){let i,{collection:l}=e,s,o={},r=!1;function a(g){return u(g),s==null?void 0:s.show()}function f(){return t(4,r=!1),s==null?void 0:s.hide()}async function u(g){t(3,o={}),t(4,r=!0),t(3,o=await c(g)||{}),t(4,r=!1)}async function c(g){if(g&&typeof g=="string"){try{return await fe.collection(l.id).getOne(g)}catch(v){v.isAbort||(f(),console.warn("resolveModel:",v),li(`Unable to load record with id "${g}"`))}return null}return g}const d=()=>f();function m(g){te[g?"unshift":"push"](()=>{s=g,t(2,s)})}function h(g){Oe.call(this,n,g)}function _(g){Oe.call(this,n,g)}return n.$$set=g=>{"collection"in g&&t(0,l=g.collection)},n.$$.update=()=>{var g;n.$$.dirty&1&&t(5,i=!!((g=l==null?void 0:l.schema)!=null&&g.find(v=>v.type==="editor")))},[l,f,s,o,r,i,a,d,m,h,_]}class gD extends be{constructor(e){super(),ge(this,e,_D,hD,he,{collection:0,show:6,hide:1})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[1]}}function rh(n,e,t){const i=n.slice();return i[63]=e[t],i}function ah(n,e,t){const i=n.slice();return i[66]=e[t],i}function fh(n,e,t){const i=n.slice();return i[66]=e[t],i}function uh(n,e,t){const i=n.slice();return i[59]=e[t],i}function ch(n){let e;function t(s,o){return s[13]?kD:bD}let i=t(n),l=i(n);return{c(){e=b("th"),l.c(),p(e,"class","bulk-select-col min-width")},m(s,o){S(s,e,o),l.m(e,null)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e,null)))},d(s){s&&w(e),l.d()}}}function bD(n){let e,t,i,l,s,o,r;return{c(){e=b("div"),t=b("input"),l=D(),s=b("label"),p(t,"type","checkbox"),p(t,"id","checkbox_0"),t.disabled=i=!n[3].length,t.checked=n[17],p(s,"for","checkbox_0"),p(e,"class","form-field")},m(a,f){S(a,e,f),y(e,t),y(e,l),y(e,s),o||(r=Z(t,"change",n[32]),o=!0)},p(a,f){f[0]&8&&i!==(i=!a[3].length)&&(t.disabled=i),f[0]&131072&&(t.checked=a[17])},d(a){a&&w(e),o=!1,r()}}}function kD(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function dh(n){let e,t,i;function l(o){n[33](o)}let s={class:"col-type-text col-field-id",name:"id",$$slots:{default:[yD]},$$scope:{ctx:n}};return n[0]!==void 0&&(s.sort=n[0]),e=new $n({props:s}),te.push(()=>ke(e,"sort",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[2]&512&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&1&&(t=!0,a.sort=o[0],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function yD(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("primary")}"></i> <span class="txt">id</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function ph(n){let e=!n[5].includes("@username"),t,i=!n[5].includes("@email"),l,s,o=e&&mh(n),r=i&&hh(n);return{c(){o&&o.c(),t=D(),r&&r.c(),l=ve()},m(a,f){o&&o.m(a,f),S(a,t,f),r&&r.m(a,f),S(a,l,f),s=!0},p(a,f){f[0]&32&&(e=!a[5].includes("@username")),e?o?(o.p(a,f),f[0]&32&&I(o,1)):(o=mh(a),o.c(),I(o,1),o.m(t.parentNode,t)):o&&(se(),L(o,1,1,()=>{o=null}),oe()),f[0]&32&&(i=!a[5].includes("@email")),i?r?(r.p(a,f),f[0]&32&&I(r,1)):(r=hh(a),r.c(),I(r,1),r.m(l.parentNode,l)):r&&(se(),L(r,1,1,()=>{r=null}),oe())},i(a){s||(I(o),I(r),s=!0)},o(a){L(o),L(r),s=!1},d(a){a&&(w(t),w(l)),o&&o.d(a),r&&r.d(a)}}}function mh(n){let e,t,i;function l(o){n[34](o)}let s={class:"col-type-text col-field-id",name:"username",$$slots:{default:[vD]},$$scope:{ctx:n}};return n[0]!==void 0&&(s.sort=n[0]),e=new $n({props:s}),te.push(()=>ke(e,"sort",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[2]&512&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&1&&(t=!0,a.sort=o[0],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function vD(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("user")}"></i> <span class="txt">username</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function hh(n){let e,t,i;function l(o){n[35](o)}let s={class:"col-type-email col-field-email",name:"email",$$slots:{default:[wD]},$$scope:{ctx:n}};return n[0]!==void 0&&(s.sort=n[0]),e=new $n({props:s}),te.push(()=>ke(e,"sort",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[2]&512&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&1&&(t=!0,a.sort=o[0],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function wD(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("email")}"></i> <span class="txt">email</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function SD(n){let e,t,i,l,s,o=n[66].name+"",r;return{c(){e=b("div"),t=b("i"),l=D(),s=b("span"),r=J(o),p(t,"class",i=H.getFieldTypeIcon(n[66].type)),p(s,"class","txt"),p(e,"class","col-header-content")},m(a,f){S(a,e,f),y(e,t),y(e,l),y(e,s),y(s,r)},p(a,f){f[0]&524288&&i!==(i=H.getFieldTypeIcon(a[66].type))&&p(t,"class",i),f[0]&524288&&o!==(o=a[66].name+"")&&re(r,o)},d(a){a&&w(e)}}}function _h(n,e){let t,i,l,s;function o(a){e[36](a)}let r={class:"col-type-"+e[66].type+" col-field-"+e[66].name,name:e[66].name,$$slots:{default:[SD]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.sort=e[0]),i=new $n({props:r}),te.push(()=>ke(i,"sort",o)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(a,f){S(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&524288&&(u.class="col-type-"+e[66].type+" col-field-"+e[66].name),f[0]&524288&&(u.name=e[66].name),f[0]&524288|f[2]&512&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&1&&(l=!0,u.sort=e[0],ye(()=>l=!1)),i.$set(u)},i(a){s||(I(i.$$.fragment,a),s=!0)},o(a){L(i.$$.fragment,a),s=!1},d(a){a&&w(t),V(i,a)}}}function gh(n){let e,t,i;function l(o){n[37](o)}let s={class:"col-type-date col-field-created",name:"created",$$slots:{default:[$D]},$$scope:{ctx:n}};return n[0]!==void 0&&(s.sort=n[0]),e=new $n({props:s}),te.push(()=>ke(e,"sort",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[2]&512&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&1&&(t=!0,a.sort=o[0],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function $D(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("date")}"></i> <span class="txt">created</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function bh(n){let e,t,i;function l(o){n[38](o)}let s={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[TD]},$$scope:{ctx:n}};return n[0]!==void 0&&(s.sort=n[0]),e=new $n({props:s}),te.push(()=>ke(e,"sort",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[2]&512&&(a.$$scope={dirty:r,ctx:o}),!t&&r[0]&1&&(t=!0,a.sort=o[0],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function TD(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("date")}"></i> <span class="txt">updated</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function kh(n){let e;return{c(){e=b("button"),e.innerHTML='<i class="ri-more-line"></i>',p(e,"type","button"),p(e,"aria-label","Toggle columns"),p(e,"class","btn btn-sm btn-transparent p-0")},m(t,i){S(t,e,i),n[39](e)},p:x,d(t){t&&w(e),n[39](null)}}}function yh(n){let e;function t(s,o){return s[13]?OD:CD}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function CD(n){let e,t,i,l;function s(a,f){var u;if((u=a[1])!=null&&u.length)return DD;if(!a[10])return MD}let o=s(n),r=o&&o(n);return{c(){e=b("tr"),t=b("td"),i=b("h6"),i.textContent="No records found.",l=D(),r&&r.c(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,f){S(a,e,f),y(e,t),y(t,i),y(t,l),r&&r.m(t,null)},p(a,f){o===(o=s(a))&&r?r.p(a,f):(r&&r.d(1),r=o&&o(a),r&&(r.c(),r.m(t,null)))},d(a){a&&w(e),r&&r.d()}}}function OD(n){let e;return{c(){e=b("tr"),e.innerHTML='<td colspan="99" class="p-xs"><span class="skeleton-loader m-0"></span></td>'},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function MD(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-add-line"></i> <span class="txt">New record</span>',p(e,"type","button"),p(e,"class","btn btn-secondary btn-expanded m-t-sm")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[44]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function DD(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[43]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function vh(n){let e,t,i,l,s,o,r,a,f,u;function c(){return n[40](n[63])}return{c(){e=b("td"),t=b("div"),i=b("input"),o=D(),r=b("label"),p(i,"type","checkbox"),p(i,"id",l="checkbox_"+n[63].id),i.checked=s=n[4][n[63].id],p(r,"for",a="checkbox_"+n[63].id),p(t,"class","form-field"),p(e,"class","bulk-select-col min-width")},m(d,m){S(d,e,m),y(e,t),y(t,i),y(t,o),y(t,r),f||(u=[Z(i,"change",c),Z(t,"click",Cn(n[30]))],f=!0)},p(d,m){n=d,m[0]&8&&l!==(l="checkbox_"+n[63].id)&&p(i,"id",l),m[0]&24&&s!==(s=n[4][n[63].id])&&(i.checked=s),m[0]&8&&a!==(a="checkbox_"+n[63].id)&&p(r,"for",a)},d(d){d&&w(e),f=!1,Te(u)}}}function wh(n){let e,t,i,l,s,o,r=n[63].id+"",a,f,u;l=new ol({props:{value:n[63].id}});let c=n[9]&&Sh(n);return{c(){e=b("td"),t=b("div"),i=b("div"),B(l.$$.fragment),s=D(),o=b("div"),a=J(r),f=D(),c&&c.c(),p(o,"class","txt txt-ellipsis"),p(i,"class","label"),p(t,"class","flex flex-gap-5"),p(e,"class","col-type-text col-field-id")},m(d,m){S(d,e,m),y(e,t),y(t,i),z(l,i,null),y(i,s),y(i,o),y(o,a),y(t,f),c&&c.m(t,null),u=!0},p(d,m){const h={};m[0]&8&&(h.value=d[63].id),l.$set(h),(!u||m[0]&8)&&r!==(r=d[63].id+"")&&re(a,r),d[9]?c?c.p(d,m):(c=Sh(d),c.c(),c.m(t,null)):c&&(c.d(1),c=null)},i(d){u||(I(l.$$.fragment,d),u=!0)},o(d){L(l.$$.fragment,d),u=!1},d(d){d&&w(e),V(l),c&&c.d()}}}function Sh(n){let e;function t(s,o){return s[63].verified?ID:ED}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i!==(i=t(s))&&(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function ED(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-sm txt-hint")},m(l,s){S(l,e,s),t||(i=$e(Fe.call(null,e,"Unverified")),t=!0)},d(l){l&&w(e),t=!1,i()}}}function ID(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-sm txt-success")},m(l,s){S(l,e,s),t||(i=$e(Fe.call(null,e,"Verified")),t=!0)},d(l){l&&w(e),t=!1,i()}}}function $h(n){let e=!n[5].includes("@username"),t,i=!n[5].includes("@email"),l,s=e&&Th(n),o=i&&Ch(n);return{c(){s&&s.c(),t=D(),o&&o.c(),l=ve()},m(r,a){s&&s.m(r,a),S(r,t,a),o&&o.m(r,a),S(r,l,a)},p(r,a){a[0]&32&&(e=!r[5].includes("@username")),e?s?s.p(r,a):(s=Th(r),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null),a[0]&32&&(i=!r[5].includes("@email")),i?o?o.p(r,a):(o=Ch(r),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null)},d(r){r&&(w(t),w(l)),s&&s.d(r),o&&o.d(r)}}}function Th(n){let e,t;function i(o,r){return r[0]&8&&(t=null),t==null&&(t=!!H.isEmpty(o[63].username)),t?LD:AD}let l=i(n,[-1,-1,-1]),s=l(n);return{c(){e=b("td"),s.c(),p(e,"class","col-type-text col-field-username")},m(o,r){S(o,e,r),s.m(e,null)},p(o,r){l===(l=i(o,r))&&s?s.p(o,r):(s.d(1),s=l(o),s&&(s.c(),s.m(e,null)))},d(o){o&&w(e),s.d()}}}function AD(n){let e,t=n[63].username+"",i,l;return{c(){e=b("span"),i=J(t),p(e,"class","txt txt-ellipsis"),p(e,"title",l=n[63].username)},m(s,o){S(s,e,o),y(e,i)},p(s,o){o[0]&8&&t!==(t=s[63].username+"")&&re(i,t),o[0]&8&&l!==(l=s[63].username)&&p(e,"title",l)},d(s){s&&w(e)}}}function LD(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Ch(n){let e,t;function i(o,r){return r[0]&8&&(t=null),t==null&&(t=!!H.isEmpty(o[63].email)),t?PD:ND}let l=i(n,[-1,-1,-1]),s=l(n);return{c(){e=b("td"),s.c(),p(e,"class","col-type-text col-field-email")},m(o,r){S(o,e,r),s.m(e,null)},p(o,r){l===(l=i(o,r))&&s?s.p(o,r):(s.d(1),s=l(o),s&&(s.c(),s.m(e,null)))},d(o){o&&w(e),s.d()}}}function ND(n){let e,t=n[63].email+"",i,l;return{c(){e=b("span"),i=J(t),p(e,"class","txt txt-ellipsis"),p(e,"title",l=n[63].email)},m(s,o){S(s,e,o),y(e,i)},p(s,o){o[0]&8&&t!==(t=s[63].email+"")&&re(i,t),o[0]&8&&l!==(l=s[63].email)&&p(e,"title",l)},d(s){s&&w(e)}}}function PD(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Oh(n,e){let t,i,l,s;return i=new Xb({props:{short:!0,record:e[63],field:e[66]}}),{key:n,first:null,c(){t=b("td"),B(i.$$.fragment),p(t,"class",l="col-type-"+e[66].type+" col-field-"+e[66].name),this.first=t},m(o,r){S(o,t,r),z(i,t,null),s=!0},p(o,r){e=o;const a={};r[0]&8&&(a.record=e[63]),r[0]&524288&&(a.field=e[66]),i.$set(a),(!s||r[0]&524288&&l!==(l="col-type-"+e[66].type+" col-field-"+e[66].name))&&p(t,"class",l)},i(o){s||(I(i.$$.fragment,o),s=!0)},o(o){L(i.$$.fragment,o),s=!1},d(o){o&&w(t),V(i)}}}function Mh(n){let e,t,i;return t=new tl({props:{date:n[63].created}}),{c(){e=b("td"),B(t.$$.fragment),p(e,"class","col-type-date col-field-created")},m(l,s){S(l,e,s),z(t,e,null),i=!0},p(l,s){const o={};s[0]&8&&(o.date=l[63].created),t.$set(o)},i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){L(t.$$.fragment,l),i=!1},d(l){l&&w(e),V(t)}}}function Dh(n){let e,t,i;return t=new tl({props:{date:n[63].updated}}),{c(){e=b("td"),B(t.$$.fragment),p(e,"class","col-type-date col-field-updated")},m(l,s){S(l,e,s),z(t,e,null),i=!0},p(l,s){const o={};s[0]&8&&(o.date=l[63].updated),t.$set(o)},i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){L(t.$$.fragment,l),i=!1},d(l){l&&w(e),V(t)}}}function Eh(n,e){let t,i,l=!e[5].includes("@id"),s,o,r=[],a=new Map,f,u=e[8]&&!e[5].includes("@created"),c,d=e[7]&&!e[5].includes("@updated"),m,h,_,g,v,$=!e[10]&&vh(e),C=l&&wh(e),T=e[9]&&$h(e),O=ce(e[19]);const M=R=>R[66].name;for(let R=0;R<O.length;R+=1){let P=ah(e,O,R),F=M(P);a.set(F,r[R]=Oh(F,P))}let E=u&&Mh(e),A=d&&Dh(e);function N(){return e[41](e[63])}function q(...R){return e[42](e[63],...R)}return{key:n,first:null,c(){t=b("tr"),$&&$.c(),i=D(),C&&C.c(),s=D(),T&&T.c(),o=D();for(let R=0;R<r.length;R+=1)r[R].c();f=D(),E&&E.c(),c=D(),A&&A.c(),m=D(),h=b("td"),h.innerHTML='<i class="ri-arrow-right-line"></i>',p(h,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(R,P){S(R,t,P),$&&$.m(t,null),y(t,i),C&&C.m(t,null),y(t,s),T&&T.m(t,null),y(t,o);for(let F=0;F<r.length;F+=1)r[F]&&r[F].m(t,null);y(t,f),E&&E.m(t,null),y(t,c),A&&A.m(t,null),y(t,m),y(t,h),_=!0,g||(v=[Z(t,"click",N),Z(t,"keydown",q)],g=!0)},p(R,P){e=R,e[10]?$&&($.d(1),$=null):$?$.p(e,P):($=vh(e),$.c(),$.m(t,i)),P[0]&32&&(l=!e[5].includes("@id")),l?C?(C.p(e,P),P[0]&32&&I(C,1)):(C=wh(e),C.c(),I(C,1),C.m(t,s)):C&&(se(),L(C,1,1,()=>{C=null}),oe()),e[9]?T?T.p(e,P):(T=$h(e),T.c(),T.m(t,o)):T&&(T.d(1),T=null),P[0]&524296&&(O=ce(e[19]),se(),r=ft(r,P,M,1,e,O,a,t,It,Oh,f,ah),oe()),P[0]&288&&(u=e[8]&&!e[5].includes("@created")),u?E?(E.p(e,P),P[0]&288&&I(E,1)):(E=Mh(e),E.c(),I(E,1),E.m(t,c)):E&&(se(),L(E,1,1,()=>{E=null}),oe()),P[0]&160&&(d=e[7]&&!e[5].includes("@updated")),d?A?(A.p(e,P),P[0]&160&&I(A,1)):(A=Dh(e),A.c(),I(A,1),A.m(t,m)):A&&(se(),L(A,1,1,()=>{A=null}),oe())},i(R){if(!_){I(C);for(let P=0;P<O.length;P+=1)I(r[P]);I(E),I(A),_=!0}},o(R){L(C);for(let P=0;P<r.length;P+=1)L(r[P]);L(E),L(A),_=!1},d(R){R&&w(t),$&&$.d(),C&&C.d(),T&&T.d();for(let P=0;P<r.length;P+=1)r[P].d();E&&E.d(),A&&A.d(),g=!1,Te(v)}}}function Ih(n){let e,t,i,l,s,o;return{c(){e=b("tr"),t=b("td"),i=b("button"),l=b("span"),l.textContent="Load more",p(l,"class","txt"),p(i,"class","btn btn-expanded-lg btn-secondary btn-horizontal-sticky"),i.disabled=n[13],ee(i,"btn-loading",n[13]),p(t,"colspan","99"),p(t,"class","txt-center")},m(r,a){S(r,e,a),y(e,t),y(t,i),y(i,l),s||(o=Z(i,"click",Ue(n[45])),s=!0)},p(r,a){a[0]&8192&&(i.disabled=r[13]),a[0]&8192&&ee(i,"btn-loading",r[13])},d(r){r&&w(e),s=!1,o()}}}function FD(n){let e,t,i,l,s=!n[5].includes("@id"),o,r,a=[],f=new Map,u,c=n[8]&&!n[5].includes("@created"),d,m=n[7]&&!n[5].includes("@updated"),h,_,g,v,$=[],C=new Map,T,O,M=!n[10]&&ch(n),E=s&&dh(n),A=n[9]&&ph(n),N=ce(n[19]);const q=W=>W[66].name;for(let W=0;W<N.length;W+=1){let K=fh(n,N,W),le=q(K);f.set(le,a[W]=_h(le,K))}let R=c&&gh(n),P=m&&bh(n),F=n[16].length&&kh(n),j=ce(n[3]);const U=W=>W[10]?W[63]:W[63].id;for(let W=0;W<j.length;W+=1){let K=rh(n,j,W),le=U(K);C.set(le,$[W]=Eh(le,K))}let Y=null;j.length||(Y=yh(n));let X=n[3].length&&n[18]&&Ih(n);return{c(){e=b("table"),t=b("thead"),i=b("tr"),M&&M.c(),l=D(),E&&E.c(),o=D(),A&&A.c(),r=D();for(let W=0;W<a.length;W+=1)a[W].c();u=D(),R&&R.c(),d=D(),P&&P.c(),h=D(),_=b("th"),F&&F.c(),g=D(),v=b("tbody");for(let W=0;W<$.length;W+=1)$[W].c();Y&&Y.c(),T=D(),X&&X.c(),p(_,"class","col-type-action min-width"),p(e,"class","table"),ee(e,"table-loading",n[13])},m(W,K){S(W,e,K),y(e,t),y(t,i),M&&M.m(i,null),y(i,l),E&&E.m(i,null),y(i,o),A&&A.m(i,null),y(i,r);for(let le=0;le<a.length;le+=1)a[le]&&a[le].m(i,null);y(i,u),R&&R.m(i,null),y(i,d),P&&P.m(i,null),y(i,h),y(i,_),F&&F.m(_,null),y(e,g),y(e,v);for(let le=0;le<$.length;le+=1)$[le]&&$[le].m(v,null);Y&&Y.m(v,null),y(v,T),X&&X.m(v,null),O=!0},p(W,K){W[10]?M&&(M.d(1),M=null):M?M.p(W,K):(M=ch(W),M.c(),M.m(i,l)),K[0]&32&&(s=!W[5].includes("@id")),s?E?(E.p(W,K),K[0]&32&&I(E,1)):(E=dh(W),E.c(),I(E,1),E.m(i,o)):E&&(se(),L(E,1,1,()=>{E=null}),oe()),W[9]?A?(A.p(W,K),K[0]&512&&I(A,1)):(A=ph(W),A.c(),I(A,1),A.m(i,r)):A&&(se(),L(A,1,1,()=>{A=null}),oe()),K[0]&524289&&(N=ce(W[19]),se(),a=ft(a,K,q,1,W,N,f,i,It,_h,u,fh),oe()),K[0]&288&&(c=W[8]&&!W[5].includes("@created")),c?R?(R.p(W,K),K[0]&288&&I(R,1)):(R=gh(W),R.c(),I(R,1),R.m(i,d)):R&&(se(),L(R,1,1,()=>{R=null}),oe()),K[0]&160&&(m=W[7]&&!W[5].includes("@updated")),m?P?(P.p(W,K),K[0]&160&&I(P,1)):(P=bh(W),P.c(),I(P,1),P.m(i,h)):P&&(se(),L(P,1,1,()=>{P=null}),oe()),W[16].length?F?F.p(W,K):(F=kh(W),F.c(),F.m(_,null)):F&&(F.d(1),F=null),K[0]&9971642&&(j=ce(W[3]),se(),$=ft($,K,U,1,W,j,C,v,It,Eh,T,rh),oe(),!j.length&&Y?Y.p(W,K):j.length?Y&&(Y.d(1),Y=null):(Y=yh(W),Y.c(),Y.m(v,T))),W[3].length&&W[18]?X?X.p(W,K):(X=Ih(W),X.c(),X.m(v,null)):X&&(X.d(1),X=null),(!O||K[0]&8192)&&ee(e,"table-loading",W[13])},i(W){if(!O){I(E),I(A);for(let K=0;K<N.length;K+=1)I(a[K]);I(R),I(P);for(let K=0;K<j.length;K+=1)I($[K]);O=!0}},o(W){L(E),L(A);for(let K=0;K<a.length;K+=1)L(a[K]);L(R),L(P);for(let K=0;K<$.length;K+=1)L($[K]);O=!1},d(W){W&&w(e),M&&M.d(),E&&E.d(),A&&A.d();for(let K=0;K<a.length;K+=1)a[K].d();R&&R.d(),P&&P.d(),F&&F.d();for(let K=0;K<$.length;K+=1)$[K].d();Y&&Y.d(),X&&X.d()}}}function Ah(n){let e,t;return e=new Mn({props:{class:"dropdown dropdown-right dropdown-nowrap columns-dropdown",trigger:n[15],$$slots:{default:[qD]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[0]&32768&&(s.trigger=i[15]),l[0]&65568|l[2]&512&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function RD(n){let e,t,i,l,s,o=n[59].name+"",r,a,f,u,c;function d(...m){return n[31](n[59],...m)}return{c(){e=b("input"),l=D(),s=b("label"),r=J(o),f=D(),p(e,"type","checkbox"),p(e,"id",t=n[62]),e.checked=i=!n[5].includes(n[59].id),p(s,"for",a=n[62])},m(m,h){S(m,e,h),S(m,l,h),S(m,s,h),y(s,r),S(m,f,h),u||(c=Z(e,"change",d),u=!0)},p(m,h){n=m,h[2]&1&&t!==(t=n[62])&&p(e,"id",t),h[0]&65568&&i!==(i=!n[5].includes(n[59].id))&&(e.checked=i),h[0]&65536&&o!==(o=n[59].name+"")&&re(r,o),h[2]&1&&a!==(a=n[62])&&p(s,"for",a)},d(m){m&&(w(e),w(l),w(s),w(f)),u=!1,c()}}}function Lh(n,e){let t,i,l;return i=new de({props:{class:"form-field form-field-sm form-field-toggle m-0 p-5",$$slots:{default:[RD,({uniqueId:s})=>({62:s}),({uniqueId:s})=>[0,0,s?1:0]]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(s,o){S(s,t,o),z(i,s,o),l=!0},p(s,o){e=s;const r={};o[0]&65568|o[2]&513&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(s){l||(I(i.$$.fragment,s),l=!0)},o(s){L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(i,s)}}}function qD(n){let e,t,i=[],l=new Map,s,o,r=ce(n[16]);const a=f=>f[59].id+f[59].name;for(let f=0;f<r.length;f+=1){let u=uh(n,r,f),c=a(u);l.set(c,i[f]=Lh(c,u))}return{c(){e=b("div"),e.textContent="Toggle columns",t=D();for(let f=0;f<i.length;f+=1)i[f].c();s=ve(),p(e,"class","txt-hint txt-sm p-5 m-b-5")},m(f,u){S(f,e,u),S(f,t,u);for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(f,u);S(f,s,u),o=!0},p(f,u){u[0]&65568|u[2]&1&&(r=ce(f[16]),se(),i=ft(i,u,a,1,f,r,l,s.parentNode,It,Lh,s,uh),oe())},i(f){if(!o){for(let u=0;u<r.length;u+=1)I(i[u]);o=!0}},o(f){for(let u=0;u<i.length;u+=1)L(i[u]);o=!1},d(f){f&&(w(e),w(t),w(s));for(let u=0;u<i.length;u+=1)i[u].d(f)}}}function jD(n){let e,t,i=n[15]&&Ah(n);return{c(){i&&i.c(),e=ve()},m(l,s){i&&i.m(l,s),S(l,e,s),t=!0},p(l,s){l[15]?i?(i.p(l,s),s[0]&32768&&I(i,1)):(i=Ah(l),i.c(),I(i,1),i.m(e.parentNode,e)):i&&(se(),L(i,1,1,()=>{i=null}),oe())},i(l){t||(I(i),t=!0)},o(l){L(i),t=!1},d(l){l&&w(e),i&&i.d(l)}}}function Nh(n){let e,t,i,l,s,o,r=n[6]===1?"record":"records",a,f,u,c,d,m,h,_,g,v,$;return{c(){e=b("div"),t=b("div"),i=J("Selected "),l=b("strong"),s=J(n[6]),o=D(),a=J(r),f=D(),u=b("button"),u.innerHTML='<span class="txt">Reset</span>',c=D(),d=b("div"),m=D(),h=b("button"),h.innerHTML='<span class="txt">Delete selected</span>',p(t,"class","txt"),p(u,"type","button"),p(u,"class","btn btn-xs btn-transparent btn-outline p-l-5 p-r-5"),ee(u,"btn-disabled",n[14]),p(d,"class","flex-fill"),p(h,"type","button"),p(h,"class","btn btn-sm btn-transparent btn-danger"),ee(h,"btn-loading",n[14]),ee(h,"btn-disabled",n[14]),p(e,"class","bulkbar")},m(C,T){S(C,e,T),y(e,t),y(t,i),y(t,l),y(l,s),y(t,o),y(t,a),y(e,f),y(e,u),y(e,c),y(e,d),y(e,m),y(e,h),g=!0,v||($=[Z(u,"click",n[47]),Z(h,"click",n[48])],v=!0)},p(C,T){(!g||T[0]&64)&&re(s,C[6]),(!g||T[0]&64)&&r!==(r=C[6]===1?"record":"records")&&re(a,r),(!g||T[0]&16384)&&ee(u,"btn-disabled",C[14]),(!g||T[0]&16384)&&ee(h,"btn-loading",C[14]),(!g||T[0]&16384)&&ee(h,"btn-disabled",C[14])},i(C){g||(C&&Je(()=>{g&&(_||(_=Re(e,Rn,{duration:150,y:5},!0)),_.run(1))}),g=!0)},o(C){C&&(_||(_=Re(e,Rn,{duration:150,y:5},!1)),_.run(0)),g=!1},d(C){C&&w(e),C&&_&&_.end(),v=!1,Te($)}}}function HD(n){let e,t,i,l,s={class:"table-wrapper",$$slots:{before:[jD],default:[FD]},$$scope:{ctx:n}};e=new Xo({props:s}),n[46](e);let o=n[6]&&Nh(n);return{c(){B(e.$$.fragment),t=D(),o&&o.c(),i=ve()},m(r,a){z(e,r,a),S(r,t,a),o&&o.m(r,a),S(r,i,a),l=!0},p(r,a){const f={};a[0]&1030075|a[2]&512&&(f.$$scope={dirty:a,ctx:r}),e.$set(f),r[6]?o?(o.p(r,a),a[0]&64&&I(o,1)):(o=Nh(r),o.c(),I(o,1),o.m(i.parentNode,i)):o&&(se(),L(o,1,1,()=>{o=null}),oe())},i(r){l||(I(e.$$.fragment,r),I(o),l=!0)},o(r){L(e.$$.fragment,r),L(o),l=!1},d(r){r&&(w(t),w(i)),n[46](null),V(e,r),o&&o.d(r)}}}const zD=/^([\+\-])?(\w+)$/,Ph=40;function VD(n,e,t){let i,l,s,o,r,a,f,u,c,d,m,h;We(n,qn,Ie=>t(53,h=Ie));const _=st();let{collection:g}=e,{sort:v=""}=e,{filter:$=""}=e,C,T=[],O=1,M=0,E={},A=!0,N=!1,q=0,R,P=[],F=[],j="";function U(){g!=null&&g.id&&(P.length?localStorage.setItem(j,JSON.stringify(P)):localStorage.removeItem(j))}function Y(){if(t(5,P=[]),!!(g!=null&&g.id))try{const Ie=localStorage.getItem(j);Ie&&t(5,P=JSON.parse(Ie)||[])}catch{}}function X(Ie){return!!T.find(Pt=>Pt.id)}async function W(){const Ie=O;for(let Pt=1;Pt<=Ie;Pt++)(Pt===1||f)&&await K(Pt,!1)}async function K(Ie=1,Pt=!0){var fl,ul,kt;if(!(g!=null&&g.id))return;t(13,A=!0);let Ni=v;const Zn=Ni.match(zD),al=Zn?r.find(at=>at.name===Zn[2]):null;if(Zn&&al){const at=((kt=(ul=(fl=h==null?void 0:h.find(_e=>{var Me;return _e.id==((Me=al.options)==null?void 0:Me.collectionId)}))==null?void 0:fl.schema)==null?void 0:ul.filter(_e=>_e.presentable))==null?void 0:kt.map(_e=>_e.name))||[],Dn=[];for(const _e of at)Dn.push((Zn[1]||"")+Zn[2]+"."+_e);Dn.length>0&&(Ni=Dn.join(","))}const Fl=H.getAllCollectionIdentifiers(g),ki=o.map(at=>at.name+":excerpt(200)").concat(r.map(at=>"expand."+at.name+".*:excerpt(200)"));return ki.length&&ki.unshift("*"),fe.collection(g.id).getList(Ie,Ph,{sort:Ni,skipTotal:1,filter:H.normalizeSearchFilter($,Fl),expand:r.map(at=>at.name).join(","),fields:ki.join(","),requestKey:"records_list"}).then(async at=>{var Dn;if(Ie<=1&&le(),t(13,A=!1),t(12,O=at.page),t(28,M=at.items.length),_("load",T.concat(at.items)),o.length)for(let _e of at.items)_e._partial=!0;if(Pt){const _e=++q;for(;(Dn=at.items)!=null&&Dn.length&&q==_e;){const Me=at.items.splice(0,20);for(let _t of Me)H.pushOrReplaceByKey(T,_t);t(3,T),await H.yieldToMain()}}else{for(let _e of at.items)H.pushOrReplaceByKey(T,_e);t(3,T)}}).catch(at=>{at!=null&&at.isAbort||(t(13,A=!1),console.warn(at),le(),fe.error(at,!$||(at==null?void 0:at.status)!=400))})}function le(){C==null||C.resetVerticalScroll(),t(3,T=[]),t(12,O=1),t(28,M=0),t(4,E={})}function ne(){c?me():Pe()}function me(){t(4,E={})}function Pe(){for(const Ie of T)t(4,E[Ie.id]=Ie,E);t(4,E)}function ze(Ie){E[Ie.id]?delete E[Ie.id]:t(4,E[Ie.id]=Ie,E),t(4,E)}function Qe(){un(`Do you really want to delete the selected ${u===1?"record":"records"}?`,et)}async function et(){if(N||!u||!(g!=null&&g.id))return;let Ie=[];for(const Pt of Object.keys(E))Ie.push(fe.collection(g.id).delete(Pt));return t(14,N=!0),Promise.all(Ie).then(()=>{Nt(`Successfully deleted the selected ${u===1?"record":"records"}.`),_("delete",E),me()}).catch(Pt=>{fe.error(Pt)}).finally(()=>(t(14,N=!1),W()))}function Dt(Ie){Oe.call(this,n,Ie)}const ut=(Ie,Pt)=>{Pt.target.checked?H.removeByValue(P,Ie.id):H.pushUnique(P,Ie.id),t(5,P)},ht=()=>ne();function Qt(Ie){v=Ie,t(0,v)}function Ee(Ie){v=Ie,t(0,v)}function Le(Ie){v=Ie,t(0,v)}function Ve(Ie){v=Ie,t(0,v)}function bt(Ie){v=Ie,t(0,v)}function pe(Ie){v=Ie,t(0,v)}function we(Ie){te[Ie?"unshift":"push"](()=>{R=Ie,t(15,R)})}const Se=Ie=>ze(Ie),Ke=Ie=>_("select",Ie),Vt=(Ie,Pt)=>{Pt.code==="Enter"&&(Pt.preventDefault(),_("select",Ie))},dn=()=>t(1,$=""),an=()=>_("new"),jn=()=>K(O+1);function Li(Ie){te[Ie?"unshift":"push"](()=>{C=Ie,t(11,C)})}const rl=()=>me(),bi=()=>Qe();return n.$$set=Ie=>{"collection"in Ie&&t(25,g=Ie.collection),"sort"in Ie&&t(0,v=Ie.sort),"filter"in Ie&&t(1,$=Ie.filter)},n.$$.update=()=>{n.$$.dirty[0]&33554432&&g!=null&&g.id&&(j=g.id+"@hiddenColumns",Y(),le()),n.$$.dirty[0]&33554432&&t(10,i=(g==null?void 0:g.type)==="view"),n.$$.dirty[0]&33554432&&t(9,l=(g==null?void 0:g.type)==="auth"),n.$$.dirty[0]&33554432&&t(29,s=(g==null?void 0:g.schema)||[]),n.$$.dirty[0]&536870912&&(o=s.filter(Ie=>Ie.type==="editor")),n.$$.dirty[0]&536870912&&(r=s.filter(Ie=>Ie.type==="relation")),n.$$.dirty[0]&536870944&&t(19,a=s.filter(Ie=>!P.includes(Ie.id))),n.$$.dirty[0]&33554435&&g!=null&&g.id&&v!==-1&&$!==-1&&K(1),n.$$.dirty[0]&268435456&&t(18,f=M>=Ph),n.$$.dirty[0]&16&&t(6,u=Object.keys(E).length),n.$$.dirty[0]&72&&t(17,c=T.length&&u===T.length),n.$$.dirty[0]&32&&P!==-1&&U(),n.$$.dirty[0]&1032&&t(8,d=!i||T.length>0&&typeof T[0].created<"u"),n.$$.dirty[0]&1032&&t(7,m=!i||T.length>0&&typeof T[0].updated<"u"),n.$$.dirty[0]&536871808&&t(16,F=[].concat(l?[{id:"@username",name:"username"},{id:"@email",name:"email"}]:[],s.map(Ie=>({id:Ie.id,name:Ie.name})),d?{id:"@created",name:"created"}:[],m?{id:"@updated",name:"updated"}:[]))},[v,$,K,T,E,P,u,m,d,l,i,C,O,A,N,R,F,c,f,a,_,ne,me,ze,Qe,g,X,W,M,s,Dt,ut,ht,Qt,Ee,Le,Ve,bt,pe,we,Se,Ke,Vt,dn,an,jn,Li,rl,bi]}class BD extends be{constructor(e){super(),ge(this,e,VD,HD,he,{collection:25,sort:0,filter:1,hasRecord:26,reloadLoadedPages:27,load:2},null,[-1,-1,-1])}get hasRecord(){return this.$$.ctx[26]}get reloadLoadedPages(){return this.$$.ctx[27]}get load(){return this.$$.ctx[2]}}function UD(n){let e,t,i,l,s=(n[2]?"...":n[0])+"",o,r;return{c(){e=b("div"),t=b("span"),t.textContent="Total found:",i=D(),l=b("span"),o=J(s),p(t,"class","txt"),p(l,"class","txt"),p(e,"class",r="inline-flex flex-gap-5 records-counter "+n[1])},m(a,f){S(a,e,f),y(e,t),y(e,i),y(e,l),y(l,o)},p(a,[f]){f&5&&s!==(s=(a[2]?"...":a[0])+"")&&re(o,s),f&2&&r!==(r="inline-flex flex-gap-5 records-counter "+a[1])&&p(e,"class",r)},i:x,o:x,d(a){a&&w(e)}}}function WD(n,e,t){const i=st();let{collection:l}=e,{filter:s=""}=e,{totalCount:o=0}=e,{class:r=void 0}=e,a=!1;async function f(){if(l!=null&&l.id){t(2,a=!0),t(0,o=0);try{const u=H.getAllCollectionIdentifiers(l),c=await fe.collection(l.id).getList(1,1,{filter:H.normalizeSearchFilter(s,u),fields:"id",requestKey:"records_count"});t(0,o=c.totalItems),i("count",o),t(2,a=!1)}catch(u){u!=null&&u.isAbort||(t(2,a=!1),console.warn(u))}}}return n.$$set=u=>{"collection"in u&&t(3,l=u.collection),"filter"in u&&t(4,s=u.filter),"totalCount"in u&&t(0,o=u.totalCount),"class"in u&&t(1,r=u.class)},n.$$.update=()=>{n.$$.dirty&24&&l!=null&&l.id&&s!==-1&&f()},[o,r,a,l,s,f]}class YD extends be{constructor(e){super(),ge(this,e,WD,UD,he,{collection:3,filter:4,totalCount:0,class:1,reload:5})}get reload(){return this.$$.ctx[5]}}function KD(n){let e,t,i,l;return e=new f6({}),i=new kn({props:{class:"flex-content",$$slots:{footer:[XD],default:[GD]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&6135|o[1]&8192&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}function JD(n){let e,t;return e=new kn({props:{center:!0,$$slots:{default:[eE]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[0]&4112|l[1]&8192&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function ZD(n){let e,t;return e=new kn({props:{center:!0,$$slots:{default:[tE]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[1]&8192&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Fh(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-settings-4-line"></i>',p(e,"type","button"),p(e,"aria-label","Edit collection"),p(e,"class","btn btn-transparent btn-circle")},m(l,s){S(l,e,s),t||(i=[$e(Fe.call(null,e,{text:"Edit collection",position:"right"})),Z(e,"click",n[20])],t=!0)},p:x,d(l){l&&w(e),t=!1,Te(i)}}}function Rh(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-add-line"></i> <span class="txt">New record</span>',p(e,"type","button"),p(e,"class","btn btn-expanded")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[23]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function GD(n){let e,t,i,l,s,o=n[2].name+"",r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E,A,N,q,R=!n[12]&&Fh(n);c=new Go({}),c.$on("refresh",n[21]);let P=n[2].type!=="view"&&Rh(n);v=new Ts({props:{value:n[0],autocompleteCollection:n[2]}}),v.$on("submit",n[24]);function F(Y){n[26](Y)}function j(Y){n[27](Y)}let U={collection:n[2]};return n[0]!==void 0&&(U.filter=n[0]),n[1]!==void 0&&(U.sort=n[1]),O=new BD({props:U}),n[25](O),te.push(()=>ke(O,"filter",F)),te.push(()=>ke(O,"sort",j)),O.$on("select",n[28]),O.$on("delete",n[29]),O.$on("new",n[30]),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Collections",l=D(),s=b("div"),r=J(o),a=D(),f=b("div"),R&&R.c(),u=D(),B(c.$$.fragment),d=D(),m=b("div"),h=b("button"),h.innerHTML='<i class="ri-code-s-slash-line"></i> <span class="txt">API Preview</span>',_=D(),P&&P.c(),g=D(),B(v.$$.fragment),$=D(),C=b("div"),T=D(),B(O.$$.fragment),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(f,"class","inline-flex gap-5"),p(h,"type","button"),p(h,"class","btn btn-outline"),p(m,"class","btns-group"),p(e,"class","page-header"),p(C,"class","clearfix m-b-sm")},m(Y,X){S(Y,e,X),y(e,t),y(t,i),y(t,l),y(t,s),y(s,r),y(e,a),y(e,f),R&&R.m(f,null),y(f,u),z(c,f,null),y(e,d),y(e,m),y(m,h),y(m,_),P&&P.m(m,null),S(Y,g,X),z(v,Y,X),S(Y,$,X),S(Y,C,X),S(Y,T,X),z(O,Y,X),A=!0,N||(q=Z(h,"click",n[22]),N=!0)},p(Y,X){(!A||X[0]&4)&&o!==(o=Y[2].name+"")&&re(r,o),Y[12]?R&&(R.d(1),R=null):R?R.p(Y,X):(R=Fh(Y),R.c(),R.m(f,u)),Y[2].type!=="view"?P?P.p(Y,X):(P=Rh(Y),P.c(),P.m(m,null)):P&&(P.d(1),P=null);const W={};X[0]&1&&(W.value=Y[0]),X[0]&4&&(W.autocompleteCollection=Y[2]),v.$set(W);const K={};X[0]&4&&(K.collection=Y[2]),!M&&X[0]&1&&(M=!0,K.filter=Y[0],ye(()=>M=!1)),!E&&X[0]&2&&(E=!0,K.sort=Y[1],ye(()=>E=!1)),O.$set(K)},i(Y){A||(I(c.$$.fragment,Y),I(v.$$.fragment,Y),I(O.$$.fragment,Y),A=!0)},o(Y){L(c.$$.fragment,Y),L(v.$$.fragment,Y),L(O.$$.fragment,Y),A=!1},d(Y){Y&&(w(e),w(g),w($),w(C),w(T)),R&&R.d(),V(c),P&&P.d(),V(v,Y),n[25](null),V(O,Y),N=!1,q()}}}function XD(n){let e,t,i;function l(o){n[19](o)}let s={class:"m-r-auto txt-sm txt-hint",collection:n[2],filter:n[0]};return n[10]!==void 0&&(s.totalCount=n[10]),e=new YD({props:s}),n[18](e),te.push(()=>ke(e,"totalCount",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r[0]&4&&(a.collection=o[2]),r[0]&1&&(a.filter=o[0]),!t&&r[0]&1024&&(t=!0,a.totalCount=o[10],ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){n[18](null),V(e,o)}}}function QD(n){let e,t,i,l,s;return{c(){e=b("h1"),e.textContent="Create your first collection to add records!",t=D(),i=b("button"),i.innerHTML='<i class="ri-add-line"></i> <span class="txt">Create new collection</span>',p(e,"class","m-b-10"),p(i,"type","button"),p(i,"class","btn btn-expanded-lg btn-lg")},m(o,r){S(o,e,r),S(o,t,r),S(o,i,r),l||(s=Z(i,"click",n[17]),l=!0)},p:x,d(o){o&&(w(e),w(t),w(i)),l=!1,s()}}}function xD(n){let e;return{c(){e=b("h1"),e.textContent="You don't have any collections yet.",p(e,"class","m-b-10")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function eE(n){let e,t,i;function l(r,a){return r[12]?xD:QD}let s=l(n),o=s(n);return{c(){e=b("div"),t=b("div"),t.innerHTML='<i class="ri-database-2-line"></i>',i=D(),o.c(),p(t,"class","icon"),p(e,"class","placeholder-section m-b-base")},m(r,a){S(r,e,a),y(e,t),y(e,i),o.m(e,null)},p(r,a){s===(s=l(r))&&o?o.p(r,a):(o.d(1),o=s(r),o&&(o.c(),o.m(e,null)))},d(r){r&&w(e),o.d()}}}function tE(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="loader loader-lg"></span> <h1>Loading collections...</h1>',p(e,"class","placeholder-section m-b-base")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function nE(n){let e,t,i,l,s,o,r,a,f,u,c;const d=[ZD,JD,KD],m=[];function h(C,T){return C[3]&&!C[11].length?0:C[11].length?2:1}e=h(n),t=m[e]=d[e](n);let _={};l=new Ua({props:_}),n[31](l);let g={};o=new g6({props:g}),n[32](o);let v={collection:n[2]};a=new Ka({props:v}),n[33](a),a.$on("hide",n[34]),a.$on("save",n[35]),a.$on("delete",n[36]);let $={collection:n[2]};return u=new gD({props:$}),n[37](u),u.$on("hide",n[38]),{c(){t.c(),i=D(),B(l.$$.fragment),s=D(),B(o.$$.fragment),r=D(),B(a.$$.fragment),f=D(),B(u.$$.fragment)},m(C,T){m[e].m(C,T),S(C,i,T),z(l,C,T),S(C,s,T),z(o,C,T),S(C,r,T),z(a,C,T),S(C,f,T),z(u,C,T),c=!0},p(C,T){let O=e;e=h(C),e===O?m[e].p(C,T):(se(),L(m[O],1,1,()=>{m[O]=null}),oe(),t=m[e],t?t.p(C,T):(t=m[e]=d[e](C),t.c()),I(t,1),t.m(i.parentNode,i));const M={};l.$set(M);const E={};o.$set(E);const A={};T[0]&4&&(A.collection=C[2]),a.$set(A);const N={};T[0]&4&&(N.collection=C[2]),u.$set(N)},i(C){c||(I(t),I(l.$$.fragment,C),I(o.$$.fragment,C),I(a.$$.fragment,C),I(u.$$.fragment,C),c=!0)},o(C){L(t),L(l.$$.fragment,C),L(o.$$.fragment,C),L(a.$$.fragment,C),L(u.$$.fragment,C),c=!1},d(C){C&&(w(i),w(s),w(r),w(f)),m[e].d(C),n[31](null),V(l,C),n[32](null),V(o,C),n[33](null),V(a,C),n[37](null),V(u,C)}}}function iE(n,e,t){let i,l,s,o,r,a,f;We(n,Jn,Ee=>t(2,l=Ee)),We(n,At,Ee=>t(39,s=Ee)),We(n,Co,Ee=>t(3,o=Ee)),We(n,Ho,Ee=>t(16,r=Ee)),We(n,qn,Ee=>t(11,a=Ee)),We(n,Qi,Ee=>t(12,f=Ee));const u=new URLSearchParams(r);let c,d,m,h,_,g,v=u.get("filter")||"",$=u.get("sort")||"-created",C=u.get("collectionId")||(l==null?void 0:l.id),T=0;Z1(C);async function O(Ee){await xt(),(l==null?void 0:l.type)==="view"?h.show(Ee):m==null||m.show(Ee)}function M(){t(14,C=l==null?void 0:l.id),t(0,v=""),t(1,$="-created"),A({recordId:null}),E(),c==null||c.forceHide(),d==null||d.hide()}async function E(){if(!$)return;const Ee=H.getAllCollectionIdentifiers(l),Le=$.split(",").map(Ve=>Ve.startsWith("+")||Ve.startsWith("-")?Ve.substring(1):Ve);Le.filter(Ve=>Ee.includes(Ve)).length!=Le.length&&(Ee.includes("created")?t(1,$="-created"):t(1,$=""))}function A(Ee={}){const Le=Object.assign({collectionId:(l==null?void 0:l.id)||"",filter:v,sort:$},Ee);H.replaceHashQueryParams(Le)}const N=()=>c==null?void 0:c.show();function q(Ee){te[Ee?"unshift":"push"](()=>{g=Ee,t(9,g)})}function R(Ee){T=Ee,t(10,T)}const P=()=>c==null?void 0:c.show(l),F=()=>{_==null||_.load(),g==null||g.reload()},j=()=>d==null?void 0:d.show(l),U=()=>m==null?void 0:m.show(),Y=Ee=>t(0,v=Ee.detail);function X(Ee){te[Ee?"unshift":"push"](()=>{_=Ee,t(8,_)})}function W(Ee){v=Ee,t(0,v)}function K(Ee){$=Ee,t(1,$)}const le=Ee=>{A({recordId:Ee.detail.id});let Le=Ee.detail._partial?Ee.detail.id:Ee.detail;l.type==="view"?h==null||h.show(Le):m==null||m.show(Le)},ne=()=>{g==null||g.reload()},me=()=>m==null?void 0:m.show();function Pe(Ee){te[Ee?"unshift":"push"](()=>{c=Ee,t(4,c)})}function ze(Ee){te[Ee?"unshift":"push"](()=>{d=Ee,t(5,d)})}function Qe(Ee){te[Ee?"unshift":"push"](()=>{m=Ee,t(6,m)})}const et=()=>{A({recordId:null})},Dt=Ee=>{v?g==null||g.reload():Ee.detail.isNew&&t(10,T++,T),_==null||_.reloadLoadedPages()},ut=Ee=>{(!v||_!=null&&_.hasRecord(Ee.detail.id))&&t(10,T--,T),_==null||_.reloadLoadedPages()};function ht(Ee){te[Ee?"unshift":"push"](()=>{h=Ee,t(7,h)})}const Qt=()=>{A({recordId:null})};return n.$$.update=()=>{n.$$.dirty[0]&65536&&t(15,i=new URLSearchParams(r)),n.$$.dirty[0]&49160&&!o&&i.get("collectionId")&&i.get("collectionId")!=C&&lv(i.get("collectionId")),n.$$.dirty[0]&16388&&l!=null&&l.id&&C!=l.id&&M(),n.$$.dirty[0]&4&&l!=null&&l.id&&E(),n.$$.dirty[0]&8&&!o&&u.get("recordId")&&O(u.get("recordId")),n.$$.dirty[0]&15&&!o&&($||v||l!=null&&l.id)&&A(),n.$$.dirty[0]&4&&en(At,s=(l==null?void 0:l.name)||"Collections",s)},[v,$,l,o,c,d,m,h,_,g,T,a,f,A,C,i,r,N,q,R,P,F,j,U,Y,X,W,K,le,ne,me,Pe,ze,Qe,et,Dt,ut,ht,Qt]}class lE extends be{constructor(e){super(),ge(this,e,iE,nE,he,{},null,[-1,-1])}}function qh(n){let e,t,i,l,s,o,r;return{c(){e=b("div"),e.innerHTML='<span class="txt">Sync</span>',t=D(),i=b("a"),i.innerHTML='<i class="ri-uninstall-line" aria-hidden="true"></i> <span class="txt">Export collections</span>',l=D(),s=b("a"),s.innerHTML='<i class="ri-install-line" aria-hidden="true"></i> <span class="txt">Import collections</span>',p(e,"class","sidebar-title"),p(i,"href","/settings/export-collections"),p(i,"class","sidebar-list-item"),p(s,"href","/settings/import-collections"),p(s,"class","sidebar-list-item")},m(a,f){S(a,e,f),S(a,t,f),S(a,i,f),S(a,l,f),S(a,s,f),o||(r=[$e(Nn.call(null,i,{path:"/settings/export-collections/?.*"})),$e(ln.call(null,i)),$e(Nn.call(null,s,{path:"/settings/import-collections/?.*"})),$e(ln.call(null,s))],o=!0)},d(a){a&&(w(e),w(t),w(i),w(l),w(s)),o=!1,Te(r)}}}function sE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M=!n[0]&&qh();return{c(){e=b("div"),t=b("div"),t.textContent="System",i=D(),l=b("a"),l.innerHTML='<i class="ri-home-gear-line" aria-hidden="true"></i> <span class="txt">Application</span>',s=D(),o=b("a"),o.innerHTML='<i class="ri-send-plane-2-line" aria-hidden="true"></i> <span class="txt">Mail settings</span>',r=D(),a=b("a"),a.innerHTML='<i class="ri-archive-drawer-line" aria-hidden="true"></i> <span class="txt">Files storage</span>',f=D(),u=b("a"),u.innerHTML='<i class="ri-archive-line" aria-hidden="true"></i> <span class="txt">Backups</span>',c=D(),M&&M.c(),d=D(),m=b("div"),m.textContent="Authentication",h=D(),_=b("a"),_.innerHTML='<i class="ri-lock-password-line" aria-hidden="true"></i> <span class="txt">Auth providers</span>',g=D(),v=b("a"),v.innerHTML='<i class="ri-key-line" aria-hidden="true"></i> <span class="txt">Token options</span>',$=D(),C=b("a"),C.innerHTML='<i class="ri-shield-user-line" aria-hidden="true"></i> <span class="txt">Admins</span>',p(t,"class","sidebar-title"),p(l,"href","/settings"),p(l,"class","sidebar-list-item"),p(o,"href","/settings/mail"),p(o,"class","sidebar-list-item"),p(a,"href","/settings/storage"),p(a,"class","sidebar-list-item"),p(u,"href","/settings/backups"),p(u,"class","sidebar-list-item"),p(m,"class","sidebar-title"),p(_,"href","/settings/auth-providers"),p(_,"class","sidebar-list-item"),p(v,"href","/settings/tokens"),p(v,"class","sidebar-list-item"),p(C,"href","/settings/admins"),p(C,"class","sidebar-list-item"),p(e,"class","sidebar-content")},m(E,A){S(E,e,A),y(e,t),y(e,i),y(e,l),y(e,s),y(e,o),y(e,r),y(e,a),y(e,f),y(e,u),y(e,c),M&&M.m(e,null),y(e,d),y(e,m),y(e,h),y(e,_),y(e,g),y(e,v),y(e,$),y(e,C),T||(O=[$e(Nn.call(null,l,{path:"/settings"})),$e(ln.call(null,l)),$e(Nn.call(null,o,{path:"/settings/mail/?.*"})),$e(ln.call(null,o)),$e(Nn.call(null,a,{path:"/settings/storage/?.*"})),$e(ln.call(null,a)),$e(Nn.call(null,u,{path:"/settings/backups/?.*"})),$e(ln.call(null,u)),$e(Nn.call(null,_,{path:"/settings/auth-providers/?.*"})),$e(ln.call(null,_)),$e(Nn.call(null,v,{path:"/settings/tokens/?.*"})),$e(ln.call(null,v)),$e(Nn.call(null,C,{path:"/settings/admins/?.*"})),$e(ln.call(null,C))],T=!0)},p(E,A){E[0]?M&&(M.d(1),M=null):M||(M=qh(),M.c(),M.m(e,d))},d(E){E&&w(e),M&&M.d(),T=!1,Te(O)}}}function oE(n){let e,t;return e=new zb({props:{class:"settings-sidebar",$$slots:{default:[sE]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&3&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function rE(n,e,t){let i;return We(n,Qi,l=>t(0,i=l)),[i]}class gi extends be{constructor(e){super(),ge(this,e,rE,oE,he,{})}}function jh(n,e,t){const i=n.slice();return i[31]=e[t],i}function Hh(n){let e,t;return e=new de({props:{class:"form-field readonly",name:"id",$$slots:{default:[aE,({uniqueId:i})=>({30:i}),({uniqueId:i})=>[i?1073741824:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[0]&1073741826|l[1]&8&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function aE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return a=new Jb({props:{model:n[1]}}),{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="id",o=D(),r=b("div"),B(a.$$.fragment),f=D(),u=b("input"),p(t,"class",H.getFieldTypeIcon("primary")),p(l,"class","txt"),p(e,"for",s=n[30]),p(r,"class","form-field-addon"),p(u,"type","text"),p(u,"id",c=n[30]),u.value=d=n[1].id,u.readOnly=!0},m(h,_){S(h,e,_),y(e,t),y(e,i),y(e,l),S(h,o,_),S(h,r,_),z(a,r,null),S(h,f,_),S(h,u,_),m=!0},p(h,_){(!m||_[0]&1073741824&&s!==(s=h[30]))&&p(e,"for",s);const g={};_[0]&2&&(g.model=h[1]),a.$set(g),(!m||_[0]&1073741824&&c!==(c=h[30]))&&p(u,"id",c),(!m||_[0]&2&&d!==(d=h[1].id)&&u.value!==d)&&(u.value=d)},i(h){m||(I(a.$$.fragment,h),m=!0)},o(h){L(a.$$.fragment,h),m=!1},d(h){h&&(w(e),w(o),w(r),w(f),w(u)),V(a)}}}function zh(n){let e,t,i,l,s,o,r;function a(){return n[18](n[31])}return{c(){e=b("button"),t=b("img"),l=D(),tn(t.src,i="./images/avatars/avatar"+n[31]+".svg")||p(t,"src",i),p(t,"alt","Avatar "+n[31]),p(e,"type","button"),p(e,"class",s="link-fade thumb thumb-circle "+(n[31]==n[2]?"thumb-primary":"thumb-sm"))},m(f,u){S(f,e,u),y(e,t),y(e,l),o||(r=Z(e,"click",a),o=!0)},p(f,u){n=f,u[0]&4&&s!==(s="link-fade thumb thumb-circle "+(n[31]==n[2]?"thumb-primary":"thumb-sm"))&&p(e,"class",s)},d(f){f&&w(e),o=!1,r()}}}function fE(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Email",o=D(),r=b("input"),p(t,"class",H.getFieldTypeIcon("email")),p(l,"class","txt"),p(e,"for",s=n[30]),p(r,"type","email"),p(r,"autocomplete","off"),p(r,"id",a=n[30]),r.required=!0},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),S(c,o,d),S(c,r,d),ae(r,n[3]),f||(u=Z(r,"input",n[19]),f=!0)},p(c,d){d[0]&1073741824&&s!==(s=c[30])&&p(e,"for",s),d[0]&1073741824&&a!==(a=c[30])&&p(r,"id",a),d[0]&8&&r.value!==c[3]&&ae(r,c[3])},d(c){c&&(w(e),w(o),w(r)),f=!1,u()}}}function Vh(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle",$$slots:{default:[uE,({uniqueId:i})=>({30:i}),({uniqueId:i})=>[i?1073741824:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[0]&1073741840|l[1]&8&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function uE(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[30]),p(l,"for",o=n[30])},m(f,u){S(f,e,u),e.checked=n[4],S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[20]),r=!0)},p(f,u){u[0]&1073741824&&t!==(t=f[30])&&p(e,"id",t),u[0]&16&&(e.checked=f[4]),u[0]&1073741824&&o!==(o=f[30])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function Bh(n){let e,t,i,l,s,o,r,a,f;return l=new de({props:{class:"form-field required",name:"password",$$slots:{default:[cE,({uniqueId:u})=>({30:u}),({uniqueId:u})=>[u?1073741824:0]]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[dE,({uniqueId:u})=>({30:u}),({uniqueId:u})=>[u?1073741824:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=D(),o=b("div"),B(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),p(e,"class","col-12")},m(u,c){S(u,e,c),y(e,t),y(t,i),z(l,i,null),y(t,s),y(t,o),z(r,o,null),f=!0},p(u,c){const d={};c[0]&1073742336|c[1]&8&&(d.$$scope={dirty:c,ctx:u}),l.$set(d);const m={};c[0]&1073742848|c[1]&8&&(m.$$scope={dirty:c,ctx:u}),r.$set(m)},i(u){f||(I(l.$$.fragment,u),I(r.$$.fragment,u),u&&Je(()=>{f&&(a||(a=Re(t,tt,{duration:150},!0)),a.run(1))}),f=!0)},o(u){L(l.$$.fragment,u),L(r.$$.fragment,u),u&&(a||(a=Re(t,tt,{duration:150},!1)),a.run(0)),f=!1},d(u){u&&w(e),V(l),V(r),u&&a&&a.end()}}}function cE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h;return c=new Zb({}),{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Password",o=D(),r=b("input"),f=D(),u=b("div"),B(c.$$.fragment),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[30]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[30]),r.required=!0,p(u,"class","form-field-addon")},m(_,g){S(_,e,g),y(e,t),y(e,i),y(e,l),S(_,o,g),S(_,r,g),ae(r,n[9]),S(_,f,g),S(_,u,g),z(c,u,null),d=!0,m||(h=Z(r,"input",n[21]),m=!0)},p(_,g){(!d||g[0]&1073741824&&s!==(s=_[30]))&&p(e,"for",s),(!d||g[0]&1073741824&&a!==(a=_[30]))&&p(r,"id",a),g[0]&512&&r.value!==_[9]&&ae(r,_[9])},i(_){d||(I(c.$$.fragment,_),d=!0)},o(_){L(c.$$.fragment,_),d=!1},d(_){_&&(w(e),w(o),w(r),w(f),w(u)),V(c),m=!1,h()}}}function dE(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("i"),i=D(),l=b("span"),l.textContent="Password confirm",o=D(),r=b("input"),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[30]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[30]),r.required=!0},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),S(c,o,d),S(c,r,d),ae(r,n[10]),f||(u=Z(r,"input",n[22]),f=!0)},p(c,d){d[0]&1073741824&&s!==(s=c[30])&&p(e,"for",s),d[0]&1073741824&&a!==(a=c[30])&&p(r,"id",a),d[0]&1024&&r.value!==c[10]&&ae(r,c[10])},d(c){c&&(w(e),w(o),w(r)),f=!1,u()}}}function pE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h=!n[5]&&Hh(n),_=ce([0,1,2,3,4,5,6,7,8,9]),g=[];for(let C=0;C<10;C+=1)g[C]=zh(jh(n,_,C));a=new de({props:{class:"form-field required",name:"email",$$slots:{default:[fE,({uniqueId:C})=>({30:C}),({uniqueId:C})=>[C?1073741824:0]]},$$scope:{ctx:n}}});let v=!n[5]&&Vh(n),$=(n[5]||n[4])&&Bh(n);return{c(){e=b("form"),h&&h.c(),t=D(),i=b("div"),l=b("p"),l.textContent="Avatar",s=D(),o=b("div");for(let C=0;C<10;C+=1)g[C].c();r=D(),B(a.$$.fragment),f=D(),v&&v.c(),u=D(),$&&$.c(),p(l,"class","section-title"),p(o,"class","flex flex-gap-xs flex-wrap"),p(i,"class","content"),p(e,"id",n[12]),p(e,"class","grid"),p(e,"autocomplete","off")},m(C,T){S(C,e,T),h&&h.m(e,null),y(e,t),y(e,i),y(i,l),y(i,s),y(i,o);for(let O=0;O<10;O+=1)g[O]&&g[O].m(o,null);y(e,r),z(a,e,null),y(e,f),v&&v.m(e,null),y(e,u),$&&$.m(e,null),c=!0,d||(m=Z(e,"submit",Ue(n[13])),d=!0)},p(C,T){if(C[5]?h&&(se(),L(h,1,1,()=>{h=null}),oe()):h?(h.p(C,T),T[0]&32&&I(h,1)):(h=Hh(C),h.c(),I(h,1),h.m(e,t)),T[0]&4){_=ce([0,1,2,3,4,5,6,7,8,9]);let M;for(M=0;M<10;M+=1){const E=jh(C,_,M);g[M]?g[M].p(E,T):(g[M]=zh(E),g[M].c(),g[M].m(o,null))}for(;M<10;M+=1)g[M].d(1)}const O={};T[0]&1073741832|T[1]&8&&(O.$$scope={dirty:T,ctx:C}),a.$set(O),C[5]?v&&(se(),L(v,1,1,()=>{v=null}),oe()):v?(v.p(C,T),T[0]&32&&I(v,1)):(v=Vh(C),v.c(),I(v,1),v.m(e,u)),C[5]||C[4]?$?($.p(C,T),T[0]&48&&I($,1)):($=Bh(C),$.c(),I($,1),$.m(e,null)):$&&(se(),L($,1,1,()=>{$=null}),oe())},i(C){c||(I(h),I(a.$$.fragment,C),I(v),I($),c=!0)},o(C){L(h),L(a.$$.fragment,C),L(v),L($),c=!1},d(C){C&&w(e),h&&h.d(),rt(g,C),V(a),v&&v.d(),$&&$.d(),d=!1,m()}}}function mE(n){let e,t=n[5]?"New admin":"Edit admin",i;return{c(){e=b("h4"),i=J(t)},m(l,s){S(l,e,s),y(e,i)},p(l,s){s[0]&32&&t!==(t=l[5]?"New admin":"Edit admin")&&re(i,t)},d(l){l&&w(e)}}}function Uh(n){let e,t,i,l,s,o,r,a,f;return o=new Mn({props:{class:"dropdown dropdown-upside dropdown-left dropdown-nowrap",$$slots:{default:[hE]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("span"),i=D(),l=b("i"),s=D(),B(o.$$.fragment),r=D(),a=b("div"),p(t,"aria-hidden","true"),p(l,"class","ri-more-line"),p(l,"aria-hidden","true"),p(e,"tabindex","0"),p(e,"role","button"),p(e,"aria-label","More admin options"),p(e,"class","btn btn-sm btn-circle btn-transparent"),p(a,"class","flex-fill")},m(u,c){S(u,e,c),y(e,t),y(e,i),y(e,l),y(e,s),z(o,e,null),S(u,r,c),S(u,a,c),f=!0},p(u,c){const d={};c[1]&8&&(d.$$scope={dirty:c,ctx:u}),o.$set(d)},i(u){f||(I(o.$$.fragment,u),f=!0)},o(u){L(o.$$.fragment,u),f=!1},d(u){u&&(w(e),w(r),w(a)),V(o)}}}function hE(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-delete-bin-7-line" aria-hidden="true"></i> <span class="txt">Delete</span>',p(e,"type","button"),p(e,"class","dropdown-item txt-danger"),p(e,"role","menuitem")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[16]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function _E(n){let e,t,i,l,s,o,r=n[5]?"Create":"Save changes",a,f,u,c,d,m=!n[5]&&Uh(n);return{c(){m&&m.c(),e=D(),t=b("button"),i=b("span"),i.textContent="Cancel",l=D(),s=b("button"),o=b("span"),a=J(r),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-transparent"),t.disabled=n[7],p(o,"class","txt"),p(s,"type","submit"),p(s,"form",n[12]),p(s,"class","btn btn-expanded"),s.disabled=f=!n[11]||n[7],ee(s,"btn-loading",n[7])},m(h,_){m&&m.m(h,_),S(h,e,_),S(h,t,_),y(t,i),S(h,l,_),S(h,s,_),y(s,o),y(o,a),u=!0,c||(d=Z(t,"click",n[17]),c=!0)},p(h,_){h[5]?m&&(se(),L(m,1,1,()=>{m=null}),oe()):m?(m.p(h,_),_[0]&32&&I(m,1)):(m=Uh(h),m.c(),I(m,1),m.m(e.parentNode,e)),(!u||_[0]&128)&&(t.disabled=h[7]),(!u||_[0]&32)&&r!==(r=h[5]?"Create":"Save changes")&&re(a,r),(!u||_[0]&2176&&f!==(f=!h[11]||h[7]))&&(s.disabled=f),(!u||_[0]&128)&&ee(s,"btn-loading",h[7])},i(h){u||(I(m),u=!0)},o(h){L(m),u=!1},d(h){h&&(w(e),w(t),w(l),w(s)),m&&m.d(h),c=!1,d()}}}function gE(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[23],$$slots:{footer:[_E],header:[mE],default:[pE]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[24](e),e.$on("hide",n[25]),e.$on("show",n[26]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,s){const o={};s[0]&2304&&(o.beforeHide=l[23]),s[0]&3774|s[1]&8&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[24](null),V(e,l)}}}function bE(n,e,t){let i,l;const s=st(),o="admin_"+H.randomString(5);let r,a={},f=!1,u=!1,c=0,d="",m="",h="",_=!1;function g(X){return $(X),t(8,u=!0),r==null?void 0:r.show()}function v(){return r==null?void 0:r.hide()}function $(X){t(1,a=structuredClone(X||{})),C()}function C(){t(4,_=!1),t(3,d=(a==null?void 0:a.email)||""),t(2,c=(a==null?void 0:a.avatar)||0),t(9,m=""),t(10,h=""),Gt({})}function T(){if(f||!l)return;t(7,f=!0);const X={email:d,avatar:c};(i||_)&&(X.password=m,X.passwordConfirm=h);let W;i?W=fe.admins.create(X):W=fe.admins.update(a.id,X),W.then(async K=>{var le;t(8,u=!1),v(),Nt(i?"Successfully created admin.":"Successfully updated admin."),((le=fe.authStore.model)==null?void 0:le.id)===K.id&&fe.authStore.save(fe.authStore.token,K),s("save",K)}).catch(K=>{fe.error(K)}).finally(()=>{t(7,f=!1)})}function O(){a!=null&&a.id&&un("Do you really want to delete the selected admin?",()=>fe.admins.delete(a.id).then(()=>{t(8,u=!1),v(),Nt("Successfully deleted admin."),s("delete",a)}).catch(X=>{fe.error(X)}))}const M=()=>O(),E=()=>v(),A=X=>t(2,c=X);function N(){d=this.value,t(3,d)}function q(){_=this.checked,t(4,_)}function R(){m=this.value,t(9,m)}function P(){h=this.value,t(10,h)}const F=()=>l&&u?(un("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,u=!1),v()}),!1):!0;function j(X){te[X?"unshift":"push"](()=>{r=X,t(6,r)})}function U(X){Oe.call(this,n,X)}function Y(X){Oe.call(this,n,X)}return n.$$.update=()=>{n.$$.dirty[0]&2&&t(5,i=!(a!=null&&a.id)),n.$$.dirty[0]&62&&t(11,l=i&&d!=""||_||d!==a.email||c!==a.avatar)},[v,a,c,d,_,i,r,f,u,m,h,l,o,T,O,g,M,E,A,N,q,R,P,F,j,U,Y]}class kE extends be{constructor(e){super(),ge(this,e,bE,gE,he,{show:15,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[0]}}function Wh(n,e,t){const i=n.slice();return i[24]=e[t],i}function yE(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("primary")}"></i> <span class="txt">id</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function vE(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("email")}"></i> <span class="txt">email</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function wE(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("date")}"></i> <span class="txt">created</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function SE(n){let e;return{c(){e=b("div"),e.innerHTML=`<i class="${H.getFieldTypeIcon("date")}"></i> <span class="txt">updated</span>`,p(e,"class","col-header-content")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Yh(n){let e;function t(s,o){return s[5]?TE:$E}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function $E(n){var r;let e,t,i,l,s,o=((r=n[1])==null?void 0:r.length)&&Kh(n);return{c(){e=b("tr"),t=b("td"),i=b("h6"),i.textContent="No admins found.",l=D(),o&&o.c(),s=D(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,f){S(a,e,f),y(e,t),y(t,i),y(t,l),o&&o.m(t,null),y(e,s)},p(a,f){var u;(u=a[1])!=null&&u.length?o?o.p(a,f):(o=Kh(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&w(e),o&&o.d()}}}function TE(n){let e;return{c(){e=b("tr"),e.innerHTML='<td colspan="99" class="p-xs"><span class="skeleton-loader m-0"></span></td> '},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function Kh(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[17]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function Jh(n){let e;return{c(){e=b("span"),e.textContent="You",p(e,"class","label label-warning m-l-5")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Zh(n,e){let t,i,l,s,o,r,a,f,u,c,d,m=e[24].id+"",h,_,g,v,$,C=e[24].email+"",T,O,M,E,A,N,q,R,P,F,j,U,Y,X;u=new ol({props:{value:e[24].id}});let W=e[24].id===e[7].id&&Jh();A=new tl({props:{date:e[24].created}}),R=new tl({props:{date:e[24].updated}});function K(){return e[15](e[24])}function le(...ne){return e[16](e[24],...ne)}return{key:n,first:null,c(){t=b("tr"),i=b("td"),l=b("figure"),s=b("img"),r=D(),a=b("td"),f=b("div"),B(u.$$.fragment),c=D(),d=b("span"),h=J(m),_=D(),W&&W.c(),g=D(),v=b("td"),$=b("span"),T=J(C),M=D(),E=b("td"),B(A.$$.fragment),N=D(),q=b("td"),B(R.$$.fragment),P=D(),F=b("td"),F.innerHTML='<i class="ri-arrow-right-line"></i>',j=D(),tn(s.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg")||p(s,"src",o),p(s,"alt","Admin avatar"),p(l,"class","thumb thumb-sm thumb-circle"),p(i,"class","min-width"),p(d,"class","txt"),p(f,"class","label"),p(a,"class","col-type-text col-field-id"),p($,"class","txt txt-ellipsis"),p($,"title",O=e[24].email),p(v,"class","col-type-email col-field-email"),p(E,"class","col-type-date col-field-created"),p(q,"class","col-type-date col-field-updated"),p(F,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(ne,me){S(ne,t,me),y(t,i),y(i,l),y(l,s),y(t,r),y(t,a),y(a,f),z(u,f,null),y(f,c),y(f,d),y(d,h),y(a,_),W&&W.m(a,null),y(t,g),y(t,v),y(v,$),y($,T),y(t,M),y(t,E),z(A,E,null),y(t,N),y(t,q),z(R,q,null),y(t,P),y(t,F),y(t,j),U=!0,Y||(X=[Z(t,"click",K),Z(t,"keydown",le)],Y=!0)},p(ne,me){e=ne,(!U||me&16&&!tn(s.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg"))&&p(s,"src",o);const Pe={};me&16&&(Pe.value=e[24].id),u.$set(Pe),(!U||me&16)&&m!==(m=e[24].id+"")&&re(h,m),e[24].id===e[7].id?W||(W=Jh(),W.c(),W.m(a,null)):W&&(W.d(1),W=null),(!U||me&16)&&C!==(C=e[24].email+"")&&re(T,C),(!U||me&16&&O!==(O=e[24].email))&&p($,"title",O);const ze={};me&16&&(ze.date=e[24].created),A.$set(ze);const Qe={};me&16&&(Qe.date=e[24].updated),R.$set(Qe)},i(ne){U||(I(u.$$.fragment,ne),I(A.$$.fragment,ne),I(R.$$.fragment,ne),U=!0)},o(ne){L(u.$$.fragment,ne),L(A.$$.fragment,ne),L(R.$$.fragment,ne),U=!1},d(ne){ne&&w(t),V(u),W&&W.d(),V(A),V(R),Y=!1,Te(X)}}}function CE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O=[],M=new Map,E;function A(K){n[11](K)}let N={class:"col-type-text",name:"id",$$slots:{default:[yE]},$$scope:{ctx:n}};n[2]!==void 0&&(N.sort=n[2]),o=new $n({props:N}),te.push(()=>ke(o,"sort",A));function q(K){n[12](K)}let R={class:"col-type-email col-field-email",name:"email",$$slots:{default:[vE]},$$scope:{ctx:n}};n[2]!==void 0&&(R.sort=n[2]),f=new $n({props:R}),te.push(()=>ke(f,"sort",q));function P(K){n[13](K)}let F={class:"col-type-date col-field-created",name:"created",$$slots:{default:[wE]},$$scope:{ctx:n}};n[2]!==void 0&&(F.sort=n[2]),d=new $n({props:F}),te.push(()=>ke(d,"sort",P));function j(K){n[14](K)}let U={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[SE]},$$scope:{ctx:n}};n[2]!==void 0&&(U.sort=n[2]),_=new $n({props:U}),te.push(()=>ke(_,"sort",j));let Y=ce(n[4]);const X=K=>K[24].id;for(let K=0;K<Y.length;K+=1){let le=Wh(n,Y,K),ne=X(le);M.set(ne,O[K]=Zh(ne,le))}let W=null;return Y.length||(W=Yh(n)),{c(){e=b("table"),t=b("thead"),i=b("tr"),l=b("th"),s=D(),B(o.$$.fragment),a=D(),B(f.$$.fragment),c=D(),B(d.$$.fragment),h=D(),B(_.$$.fragment),v=D(),$=b("th"),C=D(),T=b("tbody");for(let K=0;K<O.length;K+=1)O[K].c();W&&W.c(),p(l,"class","min-width"),p($,"class","col-type-action min-width"),p(e,"class","table"),ee(e,"table-loading",n[5])},m(K,le){S(K,e,le),y(e,t),y(t,i),y(i,l),y(i,s),z(o,i,null),y(i,a),z(f,i,null),y(i,c),z(d,i,null),y(i,h),z(_,i,null),y(i,v),y(i,$),y(e,C),y(e,T);for(let ne=0;ne<O.length;ne+=1)O[ne]&&O[ne].m(T,null);W&&W.m(T,null),E=!0},p(K,le){const ne={};le&134217728&&(ne.$$scope={dirty:le,ctx:K}),!r&&le&4&&(r=!0,ne.sort=K[2],ye(()=>r=!1)),o.$set(ne);const me={};le&134217728&&(me.$$scope={dirty:le,ctx:K}),!u&&le&4&&(u=!0,me.sort=K[2],ye(()=>u=!1)),f.$set(me);const Pe={};le&134217728&&(Pe.$$scope={dirty:le,ctx:K}),!m&&le&4&&(m=!0,Pe.sort=K[2],ye(()=>m=!1)),d.$set(Pe);const ze={};le&134217728&&(ze.$$scope={dirty:le,ctx:K}),!g&&le&4&&(g=!0,ze.sort=K[2],ye(()=>g=!1)),_.$set(ze),le&186&&(Y=ce(K[4]),se(),O=ft(O,le,X,1,K,Y,M,T,It,Zh,null,Wh),oe(),!Y.length&&W?W.p(K,le):Y.length?W&&(W.d(1),W=null):(W=Yh(K),W.c(),W.m(T,null))),(!E||le&32)&&ee(e,"table-loading",K[5])},i(K){if(!E){I(o.$$.fragment,K),I(f.$$.fragment,K),I(d.$$.fragment,K),I(_.$$.fragment,K);for(let le=0;le<Y.length;le+=1)I(O[le]);E=!0}},o(K){L(o.$$.fragment,K),L(f.$$.fragment,K),L(d.$$.fragment,K),L(_.$$.fragment,K);for(let le=0;le<O.length;le+=1)L(O[le]);E=!1},d(K){K&&w(e),V(o),V(f),V(d),V(_);for(let le=0;le<O.length;le+=1)O[le].d();W&&W.d()}}}function OE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M;return a=new Go({}),a.$on("refresh",n[8]),_=new Ts({props:{value:n[1],placeholder:"Search term or filter like email='test@example.com'",extraAutocompleteKeys:["email"]}}),_.$on("submit",n[10]),C=new Xo({props:{class:"table-wrapper",$$slots:{default:[CE]},$$scope:{ctx:n}}}),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[6]),r=D(),B(a.$$.fragment),f=D(),u=b("div"),c=D(),d=b("div"),m=b("button"),m.innerHTML='<i class="ri-add-line"></i> <span class="txt">New admin</span>',h=D(),B(_.$$.fragment),g=D(),v=b("div"),$=D(),B(C.$$.fragment),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(u,"class","flex-fill"),p(m,"type","button"),p(m,"class","btn btn-expanded"),p(d,"class","btns-group"),p(e,"class","page-header"),p(v,"class","clearfix m-b-base")},m(E,A){S(E,e,A),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),y(e,r),z(a,e,null),y(e,f),y(e,u),y(e,c),y(e,d),y(d,m),S(E,h,A),z(_,E,A),S(E,g,A),S(E,v,A),S(E,$,A),z(C,E,A),T=!0,O||(M=Z(m,"click",n[9]),O=!0)},p(E,A){(!T||A&64)&&re(o,E[6]);const N={};A&2&&(N.value=E[1]),_.$set(N);const q={};A&134217918&&(q.$$scope={dirty:A,ctx:E}),C.$set(q)},i(E){T||(I(a.$$.fragment,E),I(_.$$.fragment,E),I(C.$$.fragment,E),T=!0)},o(E){L(a.$$.fragment,E),L(_.$$.fragment,E),L(C.$$.fragment,E),T=!1},d(E){E&&(w(e),w(h),w(g),w(v),w($)),V(a),V(_,E),V(C,E),O=!1,M()}}}function ME(n){let e,t,i=n[4].length+"",l;return{c(){e=b("div"),t=J("Total found: "),l=J(i),p(e,"class","m-r-auto txt-sm txt-hint")},m(s,o){S(s,e,o),y(e,t),y(e,l)},p(s,o){o&16&&i!==(i=s[4].length+"")&&re(l,i)},d(s){s&&w(e)}}}function DE(n){let e,t,i,l,s,o;e=new gi({}),i=new kn({props:{$$slots:{footer:[ME],default:[OE]},$$scope:{ctx:n}}});let r={};return s=new kE({props:r}),n[18](s),s.$on("save",n[19]),s.$on("delete",n[20]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),l=D(),B(s.$$.fragment)},m(a,f){z(e,a,f),S(a,t,f),z(i,a,f),S(a,l,f),z(s,a,f),o=!0},p(a,[f]){const u={};f&134217982&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};s.$set(c)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),I(s.$$.fragment,a),o=!0)},o(a){L(e.$$.fragment,a),L(i.$$.fragment,a),L(s.$$.fragment,a),o=!1},d(a){a&&(w(t),w(l)),V(e,a),V(i,a),n[18](null),V(s,a)}}}function EE(n,e,t){let i,l,s;We(n,Ho,R=>t(21,i=R)),We(n,At,R=>t(6,l=R)),We(n,Ta,R=>t(7,s=R)),en(At,l="Admins",l);const o=new URLSearchParams(i);let r,a=[],f=!1,u=o.get("filter")||"",c=o.get("sort")||"-created";function d(){t(5,f=!0),t(4,a=[]);const R=H.normalizeSearchFilter(u,["id","email","created","updated"]);return fe.admins.getFullList(100,{sort:c||"-created",filter:R}).then(P=>{t(4,a=P),t(5,f=!1)}).catch(P=>{P!=null&&P.isAbort||(t(5,f=!1),console.warn(P),m(),fe.error(P,!R||(P==null?void 0:P.status)!=400))})}function m(){t(4,a=[])}const h=()=>d(),_=()=>r==null?void 0:r.show(),g=R=>t(1,u=R.detail);function v(R){c=R,t(2,c)}function $(R){c=R,t(2,c)}function C(R){c=R,t(2,c)}function T(R){c=R,t(2,c)}const O=R=>r==null?void 0:r.show(R),M=(R,P)=>{(P.code==="Enter"||P.code==="Space")&&(P.preventDefault(),r==null||r.show(R))},E=()=>t(1,u="");function A(R){te[R?"unshift":"push"](()=>{r=R,t(3,r)})}const N=()=>d(),q=()=>d();return n.$$.update=()=>{if(n.$$.dirty&6&&c!==-1&&u!==-1){const R=new URLSearchParams({filter:u,sort:c}).toString();nl("/settings/admins?"+R),d()}},[d,u,c,r,a,f,l,s,h,_,g,v,$,C,T,O,M,E,A,N,q]}class IE extends be{constructor(e){super(),ge(this,e,EE,DE,he,{loadAdmins:0})}get loadAdmins(){return this.$$.ctx[0]}}function AE(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Email"),l=D(),s=b("input"),p(e,"for",i=n[8]),p(s,"type","email"),p(s,"id",o=n[8]),s.required=!0,s.autofocus=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0]),s.focus(),r||(a=Z(s,"input",n[4]),r=!0)},p(f,u){u&256&&i!==(i=f[8])&&p(e,"for",i),u&256&&o!==(o=f[8])&&p(s,"id",o),u&1&&s.value!==f[0]&&ae(s,f[0])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function LE(n){let e,t,i,l,s,o,r,a,f,u,c;return{c(){e=b("label"),t=J("Password"),l=D(),s=b("input"),r=D(),a=b("div"),f=b("a"),f.textContent="Forgotten password?",p(e,"for",i=n[8]),p(s,"type","password"),p(s,"id",o=n[8]),s.required=!0,p(f,"href","/request-password-reset"),p(f,"class","link-hint"),p(a,"class","help-block")},m(d,m){S(d,e,m),y(e,t),S(d,l,m),S(d,s,m),ae(s,n[1]),S(d,r,m),S(d,a,m),y(a,f),u||(c=[Z(s,"input",n[5]),$e(ln.call(null,f))],u=!0)},p(d,m){m&256&&i!==(i=d[8])&&p(e,"for",i),m&256&&o!==(o=d[8])&&p(s,"id",o),m&2&&s.value!==d[1]&&ae(s,d[1])},d(d){d&&(w(e),w(l),w(s),w(r),w(a)),u=!1,Te(c)}}}function NE(n){let e,t,i,l,s,o,r,a,f,u,c;return l=new de({props:{class:"form-field required",name:"identity",$$slots:{default:[AE,({uniqueId:d})=>({8:d}),({uniqueId:d})=>d?256:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field required",name:"password",$$slots:{default:[LE,({uniqueId:d})=>({8:d}),({uniqueId:d})=>d?256:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),t.innerHTML="<h4>Admin sign in</h4>",i=D(),B(l.$$.fragment),s=D(),B(o.$$.fragment),r=D(),a=b("button"),a.innerHTML='<span class="txt">Login</span> <i class="ri-arrow-right-line"></i>',p(t,"class","content txt-center m-b-base"),p(a,"type","submit"),p(a,"class","btn btn-lg btn-block btn-next"),ee(a,"btn-disabled",n[2]),ee(a,"btn-loading",n[2]),p(e,"class","block")},m(d,m){S(d,e,m),y(e,t),y(e,i),z(l,e,null),y(e,s),z(o,e,null),y(e,r),y(e,a),f=!0,u||(c=Z(e,"submit",Ue(n[3])),u=!0)},p(d,m){const h={};m&769&&(h.$$scope={dirty:m,ctx:d}),l.$set(h);const _={};m&770&&(_.$$scope={dirty:m,ctx:d}),o.$set(_),(!f||m&4)&&ee(a,"btn-disabled",d[2]),(!f||m&4)&&ee(a,"btn-loading",d[2])},i(d){f||(I(l.$$.fragment,d),I(o.$$.fragment,d),f=!0)},o(d){L(l.$$.fragment,d),L(o.$$.fragment,d),f=!1},d(d){d&&w(e),V(l),V(o),u=!1,c()}}}function PE(n){let e,t;return e=new G1({props:{$$slots:{default:[NE]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&519&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function FE(n,e,t){let i;We(n,Ho,c=>t(6,i=c));const l=new URLSearchParams(i);let s=l.get("demoEmail")||"",o=l.get("demoPassword")||"",r=!1;function a(){if(!r)return t(2,r=!0),fe.admins.authWithPassword(s,o).then(()=>{Sa(),nl("/")}).catch(()=>{li("Invalid login credentials.")}).finally(()=>{t(2,r=!1)})}function f(){s=this.value,t(0,s)}function u(){o=this.value,t(1,o)}return[s,o,r,a,f,u]}class RE extends be{constructor(e){super(),ge(this,e,FE,PE,he,{})}}function qE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C;i=new de({props:{class:"form-field required",name:"meta.appName",$$slots:{default:[HE,({uniqueId:O})=>({18:O}),({uniqueId:O})=>O?262144:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field required",name:"meta.appUrl",$$slots:{default:[zE,({uniqueId:O})=>({18:O}),({uniqueId:O})=>O?262144:0]},$$scope:{ctx:n}}}),a=new de({props:{class:"form-field form-field-toggle",name:"meta.hideControls",$$slots:{default:[VE,({uniqueId:O})=>({18:O}),({uniqueId:O})=>O?262144:0]},$$scope:{ctx:n}}});let T=n[3]&&Gh(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),r=D(),B(a.$$.fragment),f=D(),u=b("div"),c=b("div"),d=D(),T&&T.c(),m=D(),h=b("button"),_=b("span"),_.textContent="Save changes",p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(c,"class","flex-fill"),p(_,"class","txt"),p(h,"type","submit"),p(h,"class","btn btn-expanded"),h.disabled=g=!n[3]||n[2],ee(h,"btn-loading",n[2]),p(u,"class","col-lg-12 flex"),p(e,"class","grid")},m(O,M){S(O,e,M),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),y(e,r),z(a,e,null),y(e,f),y(e,u),y(u,c),y(u,d),T&&T.m(u,null),y(u,m),y(u,h),y(h,_),v=!0,$||(C=Z(h,"click",n[12]),$=!0)},p(O,M){const E={};M&786433&&(E.$$scope={dirty:M,ctx:O}),i.$set(E);const A={};M&786433&&(A.$$scope={dirty:M,ctx:O}),o.$set(A);const N={};M&786433&&(N.$$scope={dirty:M,ctx:O}),a.$set(N),O[3]?T?T.p(O,M):(T=Gh(O),T.c(),T.m(u,m)):T&&(T.d(1),T=null),(!v||M&12&&g!==(g=!O[3]||O[2]))&&(h.disabled=g),(!v||M&4)&&ee(h,"btn-loading",O[2])},i(O){v||(I(i.$$.fragment,O),I(o.$$.fragment,O),I(a.$$.fragment,O),v=!0)},o(O){L(i.$$.fragment,O),L(o.$$.fragment,O),L(a.$$.fragment,O),v=!1},d(O){O&&w(e),V(i),V(o),V(a),T&&T.d(),$=!1,C()}}}function jE(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function HE(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Application name"),l=D(),s=b("input"),p(e,"for",i=n[18]),p(s,"type","text"),p(s,"id",o=n[18]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].meta.appName),r||(a=Z(s,"input",n[8]),r=!0)},p(f,u){u&262144&&i!==(i=f[18])&&p(e,"for",i),u&262144&&o!==(o=f[18])&&p(s,"id",o),u&1&&s.value!==f[0].meta.appName&&ae(s,f[0].meta.appName)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function zE(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Application URL"),l=D(),s=b("input"),p(e,"for",i=n[18]),p(s,"type","text"),p(s,"id",o=n[18]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].meta.appUrl),r||(a=Z(s,"input",n[9]),r=!0)},p(f,u){u&262144&&i!==(i=f[18])&&p(e,"for",i),u&262144&&o!==(o=f[18])&&p(s,"id",o),u&1&&s.value!==f[0].meta.appUrl&&ae(s,f[0].meta.appUrl)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function VE(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Hide collection create and edit controls",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[18]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[18])},m(c,d){S(c,e,d),e.checked=n[0].meta.hideControls,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[10]),$e(Fe.call(null,r,{text:"This could prevent making accidental schema changes when in production environment.",position:"right"}))],f=!0)},p(c,d){d&262144&&t!==(t=c[18])&&p(e,"id",t),d&1&&(e.checked=c[0].meta.hideControls),d&262144&&a!==(a=c[18])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function Gh(n){let e,t,i,l;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[2]},m(s,o){S(s,e,o),y(e,t),i||(l=Z(e,"click",n[11]),i=!0)},p(s,o){o&4&&(e.disabled=s[2])},d(s){s&&w(e),i=!1,l()}}}function BE(n){let e,t,i,l,s,o,r,a,f;const u=[jE,qE],c=[];function d(m,h){return m[1]?0:1}return s=d(n),o=c[s]=u[s](n),{c(){e=b("header"),e.innerHTML='<nav class="breadcrumbs"><div class="breadcrumb-item">Settings</div> <div class="breadcrumb-item">Application</div></nav>',t=D(),i=b("div"),l=b("form"),o.c(),p(e,"class","page-header"),p(l,"class","panel"),p(l,"autocomplete","off"),p(i,"class","wrapper")},m(m,h){S(m,e,h),S(m,t,h),S(m,i,h),y(i,l),c[s].m(l,null),r=!0,a||(f=Z(l,"submit",Ue(n[4])),a=!0)},p(m,h){let _=s;s=d(m),s===_?c[s].p(m,h):(se(),L(c[_],1,1,()=>{c[_]=null}),oe(),o=c[s],o?o.p(m,h):(o=c[s]=u[s](m),o.c()),I(o,1),o.m(l,null))},i(m){r||(I(o),r=!0)},o(m){L(o),r=!1},d(m){m&&(w(e),w(t),w(i)),c[s].d(),a=!1,f()}}}function UE(n){let e,t,i,l;return e=new gi({}),i=new kn({props:{$$slots:{default:[BE]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,[o]){const r={};o&524303&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}function WE(n,e,t){let i,l,s,o;We(n,Qi,O=>t(13,l=O)),We(n,Mo,O=>t(14,s=O)),We(n,At,O=>t(15,o=O)),en(At,o="Application settings",o);let r={},a={},f=!1,u=!1,c="";d();async function d(){t(1,f=!0);try{const O=await fe.settings.getAll()||{};h(O)}catch(O){fe.error(O)}t(1,f=!1)}async function m(){if(!(u||!i)){t(2,u=!0);try{const O=await fe.settings.update(H.filterRedactedProps(a));h(O),Nt("Successfully saved application settings.")}catch(O){fe.error(O)}t(2,u=!1)}}function h(O={}){var M,E;en(Mo,s=(M=O==null?void 0:O.meta)==null?void 0:M.appName,s),en(Qi,l=!!((E=O==null?void 0:O.meta)!=null&&E.hideControls),l),t(0,a={meta:(O==null?void 0:O.meta)||{}}),t(6,r=JSON.parse(JSON.stringify(a)))}function _(){t(0,a=JSON.parse(JSON.stringify(r||{})))}function g(){a.meta.appName=this.value,t(0,a)}function v(){a.meta.appUrl=this.value,t(0,a)}function $(){a.meta.hideControls=this.checked,t(0,a)}const C=()=>_(),T=()=>m();return n.$$.update=()=>{n.$$.dirty&64&&t(7,c=JSON.stringify(r)),n.$$.dirty&129&&t(3,i=c!=JSON.stringify(a))},[a,f,u,i,m,_,r,c,g,v,$,C,T]}class YE extends be{constructor(e){super(),ge(this,e,WE,UE,he,{})}}function KE(n){let e,t,i,l=[{type:"password"},{autocomplete:"new-password"},n[5]],s={};for(let o=0;o<l.length;o+=1)s=Ae(s,l[o]);return{c(){e=b("input"),ii(e,s)},m(o,r){S(o,e,r),e.autofocus&&e.focus(),n[7](e),ae(e,n[0]),t||(i=Z(e,"input",n[8]),t=!0)},p(o,r){ii(e,s=mt(l,[{type:"password"},{autocomplete:"new-password"},r&32&&o[5]])),r&1&&e.value!==o[0]&&ae(e,o[0])},d(o){o&&w(e),n[7](null),t=!1,i()}}}function JE(n){let e,t,i,l,s,o,r=[{readOnly:!0},{type:"text"},{placeholder:n[1]},n[5]],a={};for(let f=0;f<r.length;f+=1)a=Ae(a,r[f]);return{c(){e=b("div"),t=b("button"),t.innerHTML='<i class="ri-key-line"></i>',i=D(),l=b("input"),p(t,"type","button"),p(t,"class","btn btn-transparent btn-circle"),p(e,"class","form-field-addon"),ii(l,a)},m(f,u){S(f,e,u),y(e,t),S(f,i,u),S(f,l,u),l.autofocus&&l.focus(),s||(o=[$e(Fe.call(null,t,{position:"left",text:"Set new value"})),Z(t,"click",n[6])],s=!0)},p(f,u){ii(l,a=mt(r,[{readOnly:!0},{type:"text"},u&2&&{placeholder:f[1]},u&32&&f[5]]))},d(f){f&&(w(e),w(i),w(l)),s=!1,Te(o)}}}function ZE(n){let e;function t(s,o){return s[3]?JE:KE}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:x,o:x,d(s){s&&w(e),l.d(s)}}}function GE(n,e,t){const i=["value","mask"];let l=Xe(e,i),{value:s=""}=e,{mask:o="******"}=e,r,a=!1;async function f(){t(0,s=""),t(3,a=!1),await xt(),r==null||r.focus()}const u=()=>f();function c(m){te[m?"unshift":"push"](()=>{r=m,t(2,r)})}function d(){s=this.value,t(0,s)}return n.$$set=m=>{e=Ae(Ae({},e),Kt(m)),t(5,l=Xe(e,i)),"value"in m&&t(0,s=m.value),"mask"in m&&t(1,o=m.mask)},n.$$.update=()=>{n.$$.dirty&3&&t(3,a=s===o)},[s,o,r,a,f,l,u,c,d]}class Ja extends be{constructor(e){super(),ge(this,e,GE,ZE,he,{value:0,mask:1})}}function XE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_;return{c(){e=b("label"),t=J("Subject"),l=D(),s=b("input"),r=D(),a=b("div"),f=J(`Available placeholder parameters:
`),u=b("button"),u.textContent="{APP_NAME} ",c=J(`,
`),d=b("button"),d.textContent="{APP_URL} ",m=J("."),p(e,"for",i=n[31]),p(s,"type","text"),p(s,"id",o=n[31]),p(s,"spellcheck","false"),s.required=!0,p(u,"type","button"),p(u,"class","label label-sm link-primary txt-mono"),p(d,"type","button"),p(d,"class","label label-sm link-primary txt-mono"),p(a,"class","help-block")},m(g,v){S(g,e,v),y(e,t),S(g,l,v),S(g,s,v),ae(s,n[0].subject),S(g,r,v),S(g,a,v),y(a,f),y(a,u),y(a,c),y(a,d),y(a,m),h||(_=[Z(s,"input",n[13]),Z(u,"click",n[14]),Z(d,"click",n[15])],h=!0)},p(g,v){v[1]&1&&i!==(i=g[31])&&p(e,"for",i),v[1]&1&&o!==(o=g[31])&&p(s,"id",o),v[0]&1&&s.value!==g[0].subject&&ae(s,g[0].subject)},d(g){g&&(w(e),w(l),w(s),w(r),w(a)),h=!1,Te(_)}}}function QE(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v;return{c(){e=b("label"),t=J("Action URL"),l=D(),s=b("input"),r=D(),a=b("div"),f=J(`Available placeholder parameters:
`),u=b("button"),u.textContent="{APP_NAME} ",c=J(`,
`),d=b("button"),d.textContent="{APP_URL} ",m=J(`,
`),h=b("button"),h.textContent="{TOKEN} ",_=J("."),p(e,"for",i=n[31]),p(s,"type","text"),p(s,"id",o=n[31]),p(s,"spellcheck","false"),s.required=!0,p(u,"type","button"),p(u,"class","label label-sm link-primary txt-mono"),p(d,"type","button"),p(d,"class","label label-sm link-primary txt-mono"),p(h,"type","button"),p(h,"class","label label-sm link-primary txt-mono"),p(h,"title","Required parameter"),p(a,"class","help-block")},m($,C){S($,e,C),y(e,t),S($,l,C),S($,s,C),ae(s,n[0].actionUrl),S($,r,C),S($,a,C),y(a,f),y(a,u),y(a,c),y(a,d),y(a,m),y(a,h),y(a,_),g||(v=[Z(s,"input",n[16]),Z(u,"click",n[17]),Z(d,"click",n[18]),Z(h,"click",n[19])],g=!0)},p($,C){C[1]&1&&i!==(i=$[31])&&p(e,"for",i),C[1]&1&&o!==(o=$[31])&&p(s,"id",o),C[0]&1&&s.value!==$[0].actionUrl&&ae(s,$[0].actionUrl)},d($){$&&(w(e),w(l),w(s),w(r),w(a)),g=!1,Te(v)}}}function xE(n){let e,t,i,l;return{c(){e=b("textarea"),p(e,"id",t=n[31]),p(e,"class","txt-mono"),p(e,"spellcheck","false"),p(e,"rows","14"),e.required=!0},m(s,o){S(s,e,o),ae(e,n[0].body),i||(l=Z(e,"input",n[21]),i=!0)},p(s,o){o[1]&1&&t!==(t=s[31])&&p(e,"id",t),o[0]&1&&ae(e,s[0].body)},i:x,o:x,d(s){s&&w(e),i=!1,l()}}}function eI(n){let e,t,i,l;function s(a){n[20](a)}var o=n[4];function r(a,f){let u={id:a[31],language:"html"};return a[0].body!==void 0&&(u.value=a[0].body),{props:u}}return o&&(e=Et(o,r(n)),te.push(()=>ke(e,"value",s))),{c(){e&&B(e.$$.fragment),i=ve()},m(a,f){e&&z(e,a,f),S(a,i,f),l=!0},p(a,f){if(f[0]&16&&o!==(o=a[4])){if(e){se();const u=e;L(u.$$.fragment,1,0,()=>{V(u,1)}),oe()}o?(e=Et(o,r(a)),te.push(()=>ke(e,"value",s)),B(e.$$.fragment),I(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const u={};f[1]&1&&(u.id=a[31]),!t&&f[0]&1&&(t=!0,u.value=a[0].body,ye(()=>t=!1)),e.$set(u)}},i(a){l||(e&&I(e.$$.fragment,a),l=!0)},o(a){e&&L(e.$$.fragment,a),l=!1},d(a){a&&w(i),e&&V(e,a)}}}function tI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T;const O=[eI,xE],M=[];function E(A,N){return A[4]&&!A[5]?0:1}return s=E(n),o=M[s]=O[s](n),{c(){e=b("label"),t=J("Body (HTML)"),l=D(),o.c(),r=D(),a=b("div"),f=J(`Available placeholder parameters:
`),u=b("button"),u.textContent="{APP_NAME} ",c=J(`,
`),d=b("button"),d.textContent="{APP_URL} ",m=J(`,
`),h=b("button"),h.textContent="{TOKEN} ",_=J(`,
`),g=b("button"),g.textContent="{ACTION_URL} ",v=J("."),p(e,"for",i=n[31]),p(u,"type","button"),p(u,"class","label label-sm link-primary txt-mono"),p(d,"type","button"),p(d,"class","label label-sm link-primary txt-mono"),p(h,"type","button"),p(h,"class","label label-sm link-primary txt-mono"),p(g,"type","button"),p(g,"class","label label-sm link-primary txt-mono"),p(g,"title","Required parameter"),p(a,"class","help-block")},m(A,N){S(A,e,N),y(e,t),S(A,l,N),M[s].m(A,N),S(A,r,N),S(A,a,N),y(a,f),y(a,u),y(a,c),y(a,d),y(a,m),y(a,h),y(a,_),y(a,g),y(a,v),$=!0,C||(T=[Z(u,"click",n[22]),Z(d,"click",n[23]),Z(h,"click",n[24]),Z(g,"click",n[25])],C=!0)},p(A,N){(!$||N[1]&1&&i!==(i=A[31]))&&p(e,"for",i);let q=s;s=E(A),s===q?M[s].p(A,N):(se(),L(M[q],1,1,()=>{M[q]=null}),oe(),o=M[s],o?o.p(A,N):(o=M[s]=O[s](A),o.c()),I(o,1),o.m(r.parentNode,r))},i(A){$||(I(o),$=!0)},o(A){L(o),$=!1},d(A){A&&(w(e),w(l),w(r),w(a)),M[s].d(A),C=!1,Te(T)}}}function nI(n){let e,t,i,l,s,o;return e=new de({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[XE,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),i=new de({props:{class:"form-field required",name:n[1]+".actionUrl",$$slots:{default:[QE,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),s=new de({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[tI,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),l=D(),B(s.$$.fragment)},m(r,a){z(e,r,a),S(r,t,a),z(i,r,a),S(r,l,a),z(s,r,a),o=!0},p(r,a){const f={};a[0]&2&&(f.name=r[1]+".subject"),a[0]&1|a[1]&3&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};a[0]&2&&(u.name=r[1]+".actionUrl"),a[0]&1|a[1]&3&&(u.$$scope={dirty:a,ctx:r}),i.$set(u);const c={};a[0]&2&&(c.name=r[1]+".body"),a[0]&49|a[1]&3&&(c.$$scope={dirty:a,ctx:r}),s.$set(c)},i(r){o||(I(e.$$.fragment,r),I(i.$$.fragment,r),I(s.$$.fragment,r),o=!0)},o(r){L(e.$$.fragment,r),L(i.$$.fragment,r),L(s.$$.fragment,r),o=!1},d(r){r&&(w(t),w(l)),V(e,r),V(i,r),V(s,r)}}}function Xh(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){S(o,e,r),i=!0,l||(s=$e(Fe.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Je(()=>{i&&(t||(t=Re(e,Yt,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Re(e,Yt,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&w(e),o&&t&&t.end(),l=!1,s()}}}function iI(n){let e,t,i,l,s,o,r,a,f,u=n[6]&&Xh();return{c(){e=b("div"),t=b("i"),i=D(),l=b("span"),s=J(n[2]),o=D(),r=b("div"),a=D(),u&&u.c(),f=ve(),p(t,"class","ri-draft-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),y(l,s),S(c,o,d),S(c,r,d),S(c,a,d),u&&u.m(c,d),S(c,f,d)},p(c,d){d[0]&4&&re(s,c[2]),c[6]?u?d[0]&64&&I(u,1):(u=Xh(),u.c(),I(u,1),u.m(f.parentNode,f)):u&&(se(),L(u,1,1,()=>{u=null}),oe())},d(c){c&&(w(e),w(o),w(r),w(a),w(f)),u&&u.d(c)}}}function lI(n){let e,t;const i=[n[8]];let l={$$slots:{header:[iI],default:[nI]},$$scope:{ctx:n}};for(let s=0;s<i.length;s+=1)l=Ae(l,i[s]);return e=new _o({props:l}),n[26](e),e.$on("expand",n[27]),e.$on("collapse",n[28]),e.$on("toggle",n[29]),{c(){B(e.$$.fragment)},m(s,o){z(e,s,o),t=!0},p(s,o){const r=o[0]&256?mt(i,[Mt(s[8])]):{};o[0]&119|o[1]&2&&(r.$$scope={dirty:o,ctx:s}),e.$set(r)},i(s){t||(I(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[26](null),V(e,s)}}}let Qh;function sI(n,e,t){let i;const l=["key","title","config","expand","collapse","collapseSiblings"];let s=Xe(e,l),o;We(n,hi,K=>t(12,o=K));let{key:r}=e,{title:a}=e,{config:f={}}=e,u,c=Qh,d=!1;function m(){u==null||u.expand()}function h(){u==null||u.collapse()}function _(){u==null||u.collapseSiblings()}async function g(){c||d||(t(5,d=!0),t(4,c=(await nt(()=>import("./CodeEditor-dWSAtOWY.js"),__vite__mapDeps([2,1]),import.meta.url)).default),Qh=c,t(5,d=!1))}function v(K){H.copyToClipboard(K),To(`Copied ${K} to clipboard`,2e3)}g();function $(){f.subject=this.value,t(0,f)}const C=()=>v("{APP_NAME}"),T=()=>v("{APP_URL}");function O(){f.actionUrl=this.value,t(0,f)}const M=()=>v("{APP_NAME}"),E=()=>v("{APP_URL}"),A=()=>v("{TOKEN}");function N(K){n.$$.not_equal(f.body,K)&&(f.body=K,t(0,f))}function q(){f.body=this.value,t(0,f)}const R=()=>v("{APP_NAME}"),P=()=>v("{APP_URL}"),F=()=>v("{TOKEN}"),j=()=>v("{ACTION_URL}");function U(K){te[K?"unshift":"push"](()=>{u=K,t(3,u)})}function Y(K){Oe.call(this,n,K)}function X(K){Oe.call(this,n,K)}function W(K){Oe.call(this,n,K)}return n.$$set=K=>{e=Ae(Ae({},e),Kt(K)),t(8,s=Xe(e,l)),"key"in K&&t(1,r=K.key),"title"in K&&t(2,a=K.title),"config"in K&&t(0,f=K.config)},n.$$.update=()=>{n.$$.dirty[0]&4098&&t(6,i=!H.isEmpty(H.getNestedVal(o,r))),n.$$.dirty[0]&3&&(f.enabled||si(r))},[f,r,a,u,c,d,i,v,s,m,h,_,o,$,C,T,O,M,E,A,N,q,R,P,F,j,U,Y,X,W]}class Za extends be{constructor(e){super(),ge(this,e,sI,lI,he,{key:1,title:2,config:0,expand:9,collapse:10,collapseSiblings:11},null,[-1,-1])}get expand(){return this.$$.ctx[9]}get collapse(){return this.$$.ctx[10]}get collapseSiblings(){return this.$$.ctx[11]}}function xh(n,e,t){const i=n.slice();return i[21]=e[t],i}function e_(n,e){let t,i,l,s,o,r=e[21].label+"",a,f,u,c,d,m;return c=g0(e[11][0]),{key:n,first:null,c(){t=b("div"),i=b("input"),s=D(),o=b("label"),a=J(r),u=D(),p(i,"type","radio"),p(i,"name","template"),p(i,"id",l=e[20]+e[21].value),i.__value=e[21].value,ae(i,i.__value),p(o,"for",f=e[20]+e[21].value),p(t,"class","form-field-block"),c.p(i),this.first=t},m(h,_){S(h,t,_),y(t,i),i.checked=i.__value===e[2],y(t,s),y(t,o),y(o,a),y(t,u),d||(m=Z(i,"change",e[10]),d=!0)},p(h,_){e=h,_&1048576&&l!==(l=e[20]+e[21].value)&&p(i,"id",l),_&4&&(i.checked=i.__value===e[2]),_&1048576&&f!==(f=e[20]+e[21].value)&&p(o,"for",f)},d(h){h&&w(t),c.r(),d=!1,m()}}}function oI(n){let e=[],t=new Map,i,l=ce(n[7]);const s=o=>o[21].value;for(let o=0;o<l.length;o+=1){let r=xh(n,l,o),a=s(r);t.set(a,e[o]=e_(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=ve()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r&1048708&&(l=ce(o[7]),e=ft(e,r,s,1,o,l,t,i.parentNode,Ai,e_,i,xh))},d(o){o&&w(i);for(let r=0;r<e.length;r+=1)e[r].d(o)}}}function rI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("To email address"),l=D(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","email"),p(s,"id",o=n[20]),s.autofocus=!0,s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[1]),s.focus(),r||(a=Z(s,"input",n[12]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&2&&s.value!==f[1]&&ae(s,f[1])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function aI(n){let e,t,i,l,s,o,r;return t=new de({props:{class:"form-field required",name:"template",$$slots:{default:[oI,({uniqueId:a})=>({20:a}),({uniqueId:a})=>a?1048576:0]},$$scope:{ctx:n}}}),l=new de({props:{class:"form-field required m-0",name:"email",$$slots:{default:[rI,({uniqueId:a})=>({20:a}),({uniqueId:a})=>a?1048576:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),B(t.$$.fragment),i=D(),B(l.$$.fragment),p(e,"id",n[6]),p(e,"autocomplete","off")},m(a,f){S(a,e,f),z(t,e,null),y(e,i),z(l,e,null),s=!0,o||(r=Z(e,"submit",Ue(n[13])),o=!0)},p(a,f){const u={};f&17825796&&(u.$$scope={dirty:f,ctx:a}),t.$set(u);const c={};f&17825794&&(c.$$scope={dirty:f,ctx:a}),l.$set(c)},i(a){s||(I(t.$$.fragment,a),I(l.$$.fragment,a),s=!0)},o(a){L(t.$$.fragment,a),L(l.$$.fragment,a),s=!1},d(a){a&&w(e),V(t),V(l),o=!1,r()}}}function fI(n){let e;return{c(){e=b("h4"),e.textContent="Send test email",p(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function uI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("button"),t=J("Close"),i=D(),l=b("button"),s=b("i"),o=D(),r=b("span"),r.textContent="Send",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","ri-mail-send-line"),p(r,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=a=!n[5]||n[4],ee(l,"btn-loading",n[4])},m(c,d){S(c,e,d),y(e,t),S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=Z(e,"click",n[0]),f=!0)},p(c,d){d&16&&(e.disabled=c[4]),d&48&&a!==(a=!c[5]||c[4])&&(l.disabled=a),d&16&&ee(l,"btn-loading",c[4])},d(c){c&&(w(e),w(i),w(l)),f=!1,u()}}}function cI(n){let e,t,i={class:"overlay-panel-sm email-test-popup",overlayClose:!n[4],escClose:!n[4],beforeHide:n[14],popup:!0,$$slots:{footer:[uI],header:[fI],default:[aI]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[15](e),e.$on("show",n[16]),e.$on("hide",n[17]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.overlayClose=!l[4]),s&16&&(o.escClose=!l[4]),s&16&&(o.beforeHide=l[14]),s&16777270&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[15](null),V(e,l)}}}const Pr="last_email_test",t_="email_test_request";function dI(n,e,t){let i;const l=st(),s="email_test_"+H.randomString(5),o=[{label:'"Verification" template',value:"verification"},{label:'"Password reset" template',value:"password-reset"},{label:'"Confirm email change" template',value:"email-change"}];let r,a=localStorage.getItem(Pr),f=o[0].value,u=!1,c=null;function d(E="",A=""){t(1,a=E||localStorage.getItem(Pr)),t(2,f=A||o[0].value),Gt({}),r==null||r.show()}function m(){return clearTimeout(c),r==null?void 0:r.hide()}async function h(){if(!(!i||u)){t(4,u=!0),localStorage==null||localStorage.setItem(Pr,a),clearTimeout(c),c=setTimeout(()=>{fe.cancelRequest(t_),li("Test email send timeout.")},3e4);try{await fe.settings.testEmail(a,f,{$cancelKey:t_}),Nt("Successfully sent test email."),l("submit"),t(4,u=!1),await xt(),m()}catch(E){t(4,u=!1),fe.error(E)}clearTimeout(c)}}const _=[[]];function g(){f=this.__value,t(2,f)}function v(){a=this.value,t(1,a)}const $=()=>h(),C=()=>!u;function T(E){te[E?"unshift":"push"](()=>{r=E,t(3,r)})}function O(E){Oe.call(this,n,E)}function M(E){Oe.call(this,n,E)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=!!a&&!!f)},[m,a,f,r,u,i,s,o,h,d,g,_,v,$,C,T,O,M]}class pI extends be{constructor(e){super(),ge(this,e,dI,cI,he,{show:9,hide:0})}get show(){return this.$$.ctx[9]}get hide(){return this.$$.ctx[0]}}function mI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T;i=new de({props:{class:"form-field required",name:"meta.senderName",$$slots:{default:[_I,({uniqueId:P})=>({34:P}),({uniqueId:P})=>[0,P?8:0]]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field required",name:"meta.senderAddress",$$slots:{default:[gI,({uniqueId:P})=>({34:P}),({uniqueId:P})=>[0,P?8:0]]},$$scope:{ctx:n}}});let O=!n[0].meta.verificationTemplate.hidden&&n_(n),M=!n[0].meta.resetPasswordTemplate.hidden&&i_(n),E=!n[0].meta.confirmEmailChangeTemplate.hidden&&l_(n);h=new de({props:{class:"form-field form-field-toggle m-b-sm",$$slots:{default:[bI,({uniqueId:P})=>({34:P}),({uniqueId:P})=>[0,P?8:0]]},$$scope:{ctx:n}}});let A=n[0].smtp.enabled&&s_(n);function N(P,F){return P[5]?DI:MI}let q=N(n),R=q(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),r=D(),a=b("div"),O&&O.c(),f=D(),M&&M.c(),u=D(),E&&E.c(),c=D(),d=b("hr"),m=D(),B(h.$$.fragment),_=D(),A&&A.c(),g=D(),v=b("div"),$=b("div"),C=D(),R.c(),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(e,"class","grid m-b-base"),p(a,"class","accordions"),p($,"class","flex-fill"),p(v,"class","flex")},m(P,F){S(P,e,F),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),S(P,r,F),S(P,a,F),O&&O.m(a,null),y(a,f),M&&M.m(a,null),y(a,u),E&&E.m(a,null),S(P,c,F),S(P,d,F),S(P,m,F),z(h,P,F),S(P,_,F),A&&A.m(P,F),S(P,g,F),S(P,v,F),y(v,$),y(v,C),R.m(v,null),T=!0},p(P,F){const j={};F[0]&1|F[1]&24&&(j.$$scope={dirty:F,ctx:P}),i.$set(j);const U={};F[0]&1|F[1]&24&&(U.$$scope={dirty:F,ctx:P}),o.$set(U),P[0].meta.verificationTemplate.hidden?O&&(se(),L(O,1,1,()=>{O=null}),oe()):O?(O.p(P,F),F[0]&1&&I(O,1)):(O=n_(P),O.c(),I(O,1),O.m(a,f)),P[0].meta.resetPasswordTemplate.hidden?M&&(se(),L(M,1,1,()=>{M=null}),oe()):M?(M.p(P,F),F[0]&1&&I(M,1)):(M=i_(P),M.c(),I(M,1),M.m(a,u)),P[0].meta.confirmEmailChangeTemplate.hidden?E&&(se(),L(E,1,1,()=>{E=null}),oe()):E?(E.p(P,F),F[0]&1&&I(E,1)):(E=l_(P),E.c(),I(E,1),E.m(a,null));const Y={};F[0]&1|F[1]&24&&(Y.$$scope={dirty:F,ctx:P}),h.$set(Y),P[0].smtp.enabled?A?(A.p(P,F),F[0]&1&&I(A,1)):(A=s_(P),A.c(),I(A,1),A.m(g.parentNode,g)):A&&(se(),L(A,1,1,()=>{A=null}),oe()),q===(q=N(P))&&R?R.p(P,F):(R.d(1),R=q(P),R&&(R.c(),R.m(v,null)))},i(P){T||(I(i.$$.fragment,P),I(o.$$.fragment,P),I(O),I(M),I(E),I(h.$$.fragment,P),I(A),T=!0)},o(P){L(i.$$.fragment,P),L(o.$$.fragment,P),L(O),L(M),L(E),L(h.$$.fragment,P),L(A),T=!1},d(P){P&&(w(e),w(r),w(a),w(c),w(d),w(m),w(_),w(g),w(v)),V(i),V(o),O&&O.d(),M&&M.d(),E&&E.d(),V(h,P),A&&A.d(P),R.d()}}}function hI(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function _I(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Sender name"),l=D(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].meta.senderName),r||(a=Z(s,"input",n[13]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].meta.senderName&&ae(s,f[0].meta.senderName)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function gI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Sender address"),l=D(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","email"),p(s,"id",o=n[34]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].meta.senderAddress),r||(a=Z(s,"input",n[14]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].meta.senderAddress&&ae(s,f[0].meta.senderAddress)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function n_(n){let e,t,i;function l(o){n[15](o)}let s={single:!0,key:"meta.verificationTemplate",title:'Default "Verification" email template'};return n[0].meta.verificationTemplate!==void 0&&(s.config=n[0].meta.verificationTemplate),e=new Za({props:s}),te.push(()=>ke(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.verificationTemplate,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function i_(n){let e,t,i;function l(o){n[16](o)}let s={single:!0,key:"meta.resetPasswordTemplate",title:'Default "Password reset" email template'};return n[0].meta.resetPasswordTemplate!==void 0&&(s.config=n[0].meta.resetPasswordTemplate),e=new Za({props:s}),te.push(()=>ke(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.resetPasswordTemplate,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function l_(n){let e,t,i;function l(o){n[17](o)}let s={single:!0,key:"meta.confirmEmailChangeTemplate",title:'Default "Confirm email change" email template'};return n[0].meta.confirmEmailChangeTemplate!==void 0&&(s.config=n[0].meta.confirmEmailChangeTemplate),e=new Za({props:s}),te.push(()=>ke(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.confirmEmailChangeTemplate,ye(()=>t=!1)),e.$set(a)},i(o){i||(I(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function bI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.innerHTML="Use SMTP mail server <strong>(recommended)</strong>",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[34]),e.required=!0,p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[34])},m(c,d){S(c,e,d),e.checked=n[0].smtp.enabled,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[18]),$e(Fe.call(null,r,{text:'By default PocketBase uses the unix "sendmail" command for sending emails. For better emails deliverability it is recommended to use a SMTP mail server.',position:"top"}))],f=!0)},p(c,d){d[1]&8&&t!==(t=c[34])&&p(e,"id",t),d[0]&1&&(e.checked=c[0].smtp.enabled),d[1]&8&&a!==(a=c[34])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function s_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T;l=new de({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[kI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[yI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}}),u=new de({props:{class:"form-field",name:"smtp.username",$$slots:{default:[vI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}}),m=new de({props:{class:"form-field",name:"smtp.password",$$slots:{default:[wI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}});function O(N,q){return N[4]?$I:SI}let M=O(n),E=M(n),A=n[4]&&o_(n);return{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=D(),o=b("div"),B(r.$$.fragment),a=D(),f=b("div"),B(u.$$.fragment),c=D(),d=b("div"),B(m.$$.fragment),h=D(),_=b("button"),E.c(),g=D(),A&&A.c(),p(i,"class","col-lg-4"),p(o,"class","col-lg-2"),p(f,"class","col-lg-3"),p(d,"class","col-lg-3"),p(t,"class","grid"),p(_,"type","button"),p(_,"class","btn btn-sm btn-secondary m-t-sm m-b-sm")},m(N,q){S(N,e,q),y(e,t),y(t,i),z(l,i,null),y(t,s),y(t,o),z(r,o,null),y(t,a),y(t,f),z(u,f,null),y(t,c),y(t,d),z(m,d,null),y(e,h),y(e,_),E.m(_,null),y(e,g),A&&A.m(e,null),$=!0,C||(T=Z(_,"click",Ue(n[23])),C=!0)},p(N,q){const R={};q[0]&1|q[1]&24&&(R.$$scope={dirty:q,ctx:N}),l.$set(R);const P={};q[0]&1|q[1]&24&&(P.$$scope={dirty:q,ctx:N}),r.$set(P);const F={};q[0]&1|q[1]&24&&(F.$$scope={dirty:q,ctx:N}),u.$set(F);const j={};q[0]&1|q[1]&24&&(j.$$scope={dirty:q,ctx:N}),m.$set(j),M!==(M=O(N))&&(E.d(1),E=M(N),E&&(E.c(),E.m(_,null))),N[4]?A?(A.p(N,q),q[0]&16&&I(A,1)):(A=o_(N),A.c(),I(A,1),A.m(e,null)):A&&(se(),L(A,1,1,()=>{A=null}),oe())},i(N){$||(I(l.$$.fragment,N),I(r.$$.fragment,N),I(u.$$.fragment,N),I(m.$$.fragment,N),I(A),N&&Je(()=>{$&&(v||(v=Re(e,tt,{duration:150},!0)),v.run(1))}),$=!0)},o(N){L(l.$$.fragment,N),L(r.$$.fragment,N),L(u.$$.fragment,N),L(m.$$.fragment,N),L(A),N&&(v||(v=Re(e,tt,{duration:150},!1)),v.run(0)),$=!1},d(N){N&&w(e),V(l),V(r),V(u),V(m),E.d(),A&&A.d(),N&&v&&v.end(),C=!1,T()}}}function kI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("SMTP server host"),l=D(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].smtp.host),r||(a=Z(s,"input",n[19]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].smtp.host&&ae(s,f[0].smtp.host)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function yI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Port"),l=D(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","number"),p(s,"id",o=n[34]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].smtp.port),r||(a=Z(s,"input",n[20]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&lt(s.value)!==f[0].smtp.port&&ae(s,f[0].smtp.port)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function vI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Username"),l=D(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34])},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].smtp.username),r||(a=Z(s,"input",n[21]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].smtp.username&&ae(s,f[0].smtp.username)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function wI(n){let e,t,i,l,s,o,r;function a(u){n[22](u)}let f={id:n[34]};return n[0].smtp.password!==void 0&&(f.value=n[0].smtp.password),s=new Ja({props:f}),te.push(()=>ke(s,"value",a)),{c(){e=b("label"),t=J("Password"),l=D(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){S(u,e,c),y(e,t),S(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.value=u[0].smtp.password,ye(()=>o=!1)),s.$set(d)},i(u){r||(I(s.$$.fragment,u),r=!0)},o(u){L(s.$$.fragment,u),r=!1},d(u){u&&(w(e),w(l)),V(s,u)}}}function SI(n){let e,t,i;return{c(){e=b("span"),e.textContent="Show more options",t=D(),i=b("i"),p(e,"class","txt"),p(i,"class","ri-arrow-down-s-line")},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},d(l){l&&(w(e),w(t),w(i))}}}function $I(n){let e,t,i;return{c(){e=b("span"),e.textContent="Hide more options",t=D(),i=b("i"),p(e,"class","txt"),p(i,"class","ri-arrow-up-s-line")},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},d(l){l&&(w(e),w(t),w(i))}}}function o_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return i=new de({props:{class:"form-field",name:"smtp.tls",$$slots:{default:[TI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field",name:"smtp.authMethod",$$slots:{default:[CI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),f=new de({props:{class:"form-field",name:"smtp.localName",$$slots:{default:[OI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),r=D(),a=b("div"),B(f.$$.fragment),u=D(),c=b("div"),p(t,"class","col-lg-3"),p(s,"class","col-lg-3"),p(a,"class","col-lg-6"),p(c,"class","col-lg-12"),p(e,"class","grid")},m(h,_){S(h,e,_),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),y(e,r),y(e,a),z(f,a,null),y(e,u),y(e,c),m=!0},p(h,_){const g={};_[0]&1|_[1]&24&&(g.$$scope={dirty:_,ctx:h}),i.$set(g);const v={};_[0]&1|_[1]&24&&(v.$$scope={dirty:_,ctx:h}),o.$set(v);const $={};_[0]&1|_[1]&24&&($.$$scope={dirty:_,ctx:h}),f.$set($)},i(h){m||(I(i.$$.fragment,h),I(o.$$.fragment,h),I(f.$$.fragment,h),h&&Je(()=>{m&&(d||(d=Re(e,tt,{duration:150},!0)),d.run(1))}),m=!0)},o(h){L(i.$$.fragment,h),L(o.$$.fragment,h),L(f.$$.fragment,h),h&&(d||(d=Re(e,tt,{duration:150},!1)),d.run(0)),m=!1},d(h){h&&w(e),V(i),V(o),V(f),h&&d&&d.end()}}}function TI(n){let e,t,i,l,s,o,r;function a(u){n[24](u)}let f={id:n[34],items:n[7]};return n[0].smtp.tls!==void 0&&(f.keyOfSelected=n[0].smtp.tls),s=new _i({props:f}),te.push(()=>ke(s,"keyOfSelected",a)),{c(){e=b("label"),t=J("TLS encryption"),l=D(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){S(u,e,c),y(e,t),S(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.keyOfSelected=u[0].smtp.tls,ye(()=>o=!1)),s.$set(d)},i(u){r||(I(s.$$.fragment,u),r=!0)},o(u){L(s.$$.fragment,u),r=!1},d(u){u&&(w(e),w(l)),V(s,u)}}}function CI(n){let e,t,i,l,s,o,r;function a(u){n[25](u)}let f={id:n[34],items:n[8]};return n[0].smtp.authMethod!==void 0&&(f.keyOfSelected=n[0].smtp.authMethod),s=new _i({props:f}),te.push(()=>ke(s,"keyOfSelected",a)),{c(){e=b("label"),t=J("AUTH method"),l=D(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){S(u,e,c),y(e,t),S(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.keyOfSelected=u[0].smtp.authMethod,ye(()=>o=!1)),s.$set(d)},i(u){r||(I(s.$$.fragment,u),r=!0)},o(u){L(s.$$.fragment,u),r=!1},d(u){u&&(w(e),w(l)),V(s,u)}}}function OI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("span"),t.textContent="EHLO/HELO domain",i=D(),l=b("i"),o=D(),r=b("input"),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[34]),p(r,"type","text"),p(r,"id",a=n[34]),p(r,"placeholder","Default to localhost")},m(c,d){S(c,e,d),y(e,t),y(e,i),y(e,l),S(c,o,d),S(c,r,d),ae(r,n[0].smtp.localName),f||(u=[$e(Fe.call(null,l,{text:"Some SMTP servers, such as the Gmail SMTP-relay, requires a proper domain name in the inital EHLO/HELO exchange and will reject attempts to use localhost.",position:"top"})),Z(r,"input",n[26])],f=!0)},p(c,d){d[1]&8&&s!==(s=c[34])&&p(e,"for",s),d[1]&8&&a!==(a=c[34])&&p(r,"id",a),d[0]&1&&r.value!==c[0].smtp.localName&&ae(r,c[0].smtp.localName)},d(c){c&&(w(e),w(o),w(r)),f=!1,Te(u)}}}function MI(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<i class="ri-mail-check-line"></i> <span class="txt">Send test email</span>',p(e,"type","button"),p(e,"class","btn btn-expanded btn-outline")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[29]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function DI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=D(),l=b("button"),s=b("span"),s.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[3],ee(l,"btn-loading",n[3])},m(f,u){S(f,e,u),y(e,t),S(f,i,u),S(f,l,u),y(l,s),r||(a=[Z(e,"click",n[27]),Z(l,"click",n[28])],r=!0)},p(f,u){u[0]&8&&(e.disabled=f[3]),u[0]&40&&o!==(o=!f[5]||f[3])&&(l.disabled=o),u[0]&8&&ee(l,"btn-loading",f[3])},d(f){f&&(w(e),w(i),w(l)),r=!1,Te(a)}}}function EI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;const v=[hI,mI],$=[];function C(T,O){return T[2]?0:1}return d=C(n),m=$[d]=v[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[6]),r=D(),a=b("div"),f=b("form"),u=b("div"),u.innerHTML="<p>Configure common settings for sending emails.</p>",c=D(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","content txt-xl m-b-base"),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m(T,O){S(T,e,O),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S(T,r,O),S(T,a,O),y(a,f),y(f,u),y(f,c),$[d].m(f,null),h=!0,_||(g=Z(f,"submit",Ue(n[30])),_=!0)},p(T,O){(!h||O[0]&64)&&re(o,T[6]);let M=d;d=C(T),d===M?$[d].p(T,O):(se(),L($[M],1,1,()=>{$[M]=null}),oe(),m=$[d],m?m.p(T,O):(m=$[d]=v[d](T),m.c()),I(m,1),m.m(f,null))},i(T){h||(I(m),h=!0)},o(T){L(m),h=!1},d(T){T&&(w(e),w(r),w(a)),$[d].d(),_=!1,g()}}}function II(n){let e,t,i,l,s,o;e=new gi({}),i=new kn({props:{$$slots:{default:[EI]},$$scope:{ctx:n}}});let r={};return s=new pI({props:r}),n[31](s),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),l=D(),B(s.$$.fragment)},m(a,f){z(e,a,f),S(a,t,f),z(i,a,f),S(a,l,f),z(s,a,f),o=!0},p(a,f){const u={};f[0]&127|f[1]&16&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};s.$set(c)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),I(s.$$.fragment,a),o=!0)},o(a){L(e.$$.fragment,a),L(i.$$.fragment,a),L(s.$$.fragment,a),o=!1},d(a){a&&(w(t),w(l)),V(e,a),V(i,a),n[31](null),V(s,a)}}}function AI(n,e,t){let i,l,s;We(n,At,ne=>t(6,s=ne));const o=[{label:"Auto (StartTLS)",value:!1},{label:"Always",value:!0}],r=[{label:"PLAIN (default)",value:"PLAIN"},{label:"LOGIN",value:"LOGIN"}];en(At,s="Mail settings",s);let a,f={},u={},c=!1,d=!1,m=!1;h();async function h(){t(2,c=!0);try{const ne=await fe.settings.getAll()||{};g(ne)}catch(ne){fe.error(ne)}t(2,c=!1)}async function _(){if(!(d||!l)){t(3,d=!0);try{const ne=await fe.settings.update(H.filterRedactedProps(u));g(ne),Gt({}),Nt("Successfully saved mail settings.")}catch(ne){fe.error(ne)}t(3,d=!1)}}function g(ne={}){t(0,u={meta:(ne==null?void 0:ne.meta)||{},smtp:(ne==null?void 0:ne.smtp)||{}}),u.smtp.authMethod||t(0,u.smtp.authMethod=r[0].value,u),t(11,f=JSON.parse(JSON.stringify(u)))}function v(){t(0,u=JSON.parse(JSON.stringify(f||{})))}function $(){u.meta.senderName=this.value,t(0,u)}function C(){u.meta.senderAddress=this.value,t(0,u)}function T(ne){n.$$.not_equal(u.meta.verificationTemplate,ne)&&(u.meta.verificationTemplate=ne,t(0,u))}function O(ne){n.$$.not_equal(u.meta.resetPasswordTemplate,ne)&&(u.meta.resetPasswordTemplate=ne,t(0,u))}function M(ne){n.$$.not_equal(u.meta.confirmEmailChangeTemplate,ne)&&(u.meta.confirmEmailChangeTemplate=ne,t(0,u))}function E(){u.smtp.enabled=this.checked,t(0,u)}function A(){u.smtp.host=this.value,t(0,u)}function N(){u.smtp.port=lt(this.value),t(0,u)}function q(){u.smtp.username=this.value,t(0,u)}function R(ne){n.$$.not_equal(u.smtp.password,ne)&&(u.smtp.password=ne,t(0,u))}const P=()=>{t(4,m=!m)};function F(ne){n.$$.not_equal(u.smtp.tls,ne)&&(u.smtp.tls=ne,t(0,u))}function j(ne){n.$$.not_equal(u.smtp.authMethod,ne)&&(u.smtp.authMethod=ne,t(0,u))}function U(){u.smtp.localName=this.value,t(0,u)}const Y=()=>v(),X=()=>_(),W=()=>a==null?void 0:a.show(),K=()=>_();function le(ne){te[ne?"unshift":"push"](()=>{a=ne,t(1,a)})}return n.$$.update=()=>{n.$$.dirty[0]&2048&&t(12,i=JSON.stringify(f)),n.$$.dirty[0]&4097&&t(5,l=i!=JSON.stringify(u))},[u,a,c,d,m,l,s,o,r,_,v,f,i,$,C,T,O,M,E,A,N,q,R,P,F,j,U,Y,X,W,K,le]}class LI extends be{constructor(e){super(),ge(this,e,AI,II,he,{},null,[-1,-1])}}const NI=n=>({isTesting:n&4,testError:n&2,enabled:n&1}),r_=n=>({isTesting:n[2],testError:n[1],enabled:n[0].enabled});function PI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J(n[4]),p(e,"type","checkbox"),p(e,"id",t=n[20]),e.required=!0,p(l,"for",o=n[20])},m(f,u){S(f,e,u),e.checked=n[0].enabled,S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[8]),r=!0)},p(f,u){u&1048576&&t!==(t=f[20])&&p(e,"id",t),u&1&&(e.checked=f[0].enabled),u&16&&re(s,f[4]),u&1048576&&o!==(o=f[20])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function a_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M;return i=new de({props:{class:"form-field required",name:n[3]+".endpoint",$$slots:{default:[FI,({uniqueId:E})=>({20:E}),({uniqueId:E})=>E?1048576:0]},$$scope:{ctx:n}}}),o=new de({props:{class:"form-field required",name:n[3]+".bucket",$$slots:{default:[RI,({uniqueId:E})=>({20:E}),({uniqueId:E})=>E?1048576:0]},$$scope:{ctx:n}}}),f=new de({props:{class:"form-field required",name:n[3]+".region",$$slots:{default:[qI,({uniqueId:E})=>({20:E}),({uniqueId:E})=>E?1048576:0]},$$scope:{ctx:n}}}),d=new de({props:{class:"form-field required",name:n[3]+".accessKey",$$slots:{default:[jI,({uniqueId:E})=>({20:E}),({uniqueId:E})=>E?1048576:0]},$$scope:{ctx:n}}}),_=new de({props:{class:"form-field required",name:n[3]+".secret",$$slots:{default:[HI,({uniqueId:E})=>({20:E}),({uniqueId:E})=>E?1048576:0]},$$scope:{ctx:n}}}),$=new de({props:{class:"form-field",name:n[3]+".forcePathStyle",$$slots:{default:[zI,({uniqueId:E})=>({20:E}),({uniqueId:E})=>E?1048576:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=D(),s=b("div"),B(o.$$.fragment),r=D(),a=b("div"),B(f.$$.fragment),u=D(),c=b("div"),B(d.$$.fragment),m=D(),h=b("div"),B(_.$$.fragment),g=D(),v=b("div"),B($.$$.fragment),C=D(),T=b("div"),p(t,"class","col-lg-6"),p(s,"class","col-lg-3"),p(a,"class","col-lg-3"),p(c,"class","col-lg-6"),p(h,"class","col-lg-6"),p(v,"class","col-lg-12"),p(T,"class","col-lg-12"),p(e,"class","grid")},m(E,A){S(E,e,A),y(e,t),z(i,t,null),y(e,l),y(e,s),z(o,s,null),y(e,r),y(e,a),z(f,a,null),y(e,u),y(e,c),z(d,c,null),y(e,m),y(e,h),z(_,h,null),y(e,g),y(e,v),z($,v,null),y(e,C),y(e,T),M=!0},p(E,A){const N={};A&8&&(N.name=E[3]+".endpoint"),A&1081345&&(N.$$scope={dirty:A,ctx:E}),i.$set(N);const q={};A&8&&(q.name=E[3]+".bucket"),A&1081345&&(q.$$scope={dirty:A,ctx:E}),o.$set(q);const R={};A&8&&(R.name=E[3]+".region"),A&1081345&&(R.$$scope={dirty:A,ctx:E}),f.$set(R);const P={};A&8&&(P.name=E[3]+".accessKey"),A&1081345&&(P.$$scope={dirty:A,ctx:E}),d.$set(P);const F={};A&8&&(F.name=E[3]+".secret"),A&1081345&&(F.$$scope={dirty:A,ctx:E}),_.$set(F);const j={};A&8&&(j.name=E[3]+".forcePathStyle"),A&1081345&&(j.$$scope={dirty:A,ctx:E}),$.$set(j)},i(E){M||(I(i.$$.fragment,E),I(o.$$.fragment,E),I(f.$$.fragment,E),I(d.$$.fragment,E),I(_.$$.fragment,E),I($.$$.fragment,E),E&&Je(()=>{M&&(O||(O=Re(e,tt,{duration:150},!0)),O.run(1))}),M=!0)},o(E){L(i.$$.fragment,E),L(o.$$.fragment,E),L(f.$$.fragment,E),L(d.$$.fragment,E),L(_.$$.fragment,E),L($.$$.fragment,E),E&&(O||(O=Re(e,tt,{duration:150},!1)),O.run(0)),M=!1},d(E){E&&w(e),V(i),V(o),V(f),V(d),V(_),V($),E&&O&&O.end()}}}function FI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Endpoint"),l=D(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].endpoint),r||(a=Z(s,"input",n[9]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].endpoint&&ae(s,f[0].endpoint)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function RI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Bucket"),l=D(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].bucket),r||(a=Z(s,"input",n[10]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].bucket&&ae(s,f[0].bucket)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function qI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Region"),l=D(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].region),r||(a=Z(s,"input",n[11]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].region&&ae(s,f[0].region)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function jI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Access key"),l=D(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[0].accessKey),r||(a=Z(s,"input",n[12]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].accessKey&&ae(s,f[0].accessKey)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function HI(n){let e,t,i,l,s,o,r;function a(u){n[13](u)}let f={id:n[20],required:!0};return n[0].secret!==void 0&&(f.value=n[0].secret),s=new Ja({props:f}),te.push(()=>ke(s,"value",a)),{c(){e=b("label"),t=J("Secret"),l=D(),B(s.$$.fragment),p(e,"for",i=n[20])},m(u,c){S(u,e,c),y(e,t),S(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c&1048576&&i!==(i=u[20]))&&p(e,"for",i);const d={};c&1048576&&(d.id=u[20]),!o&&c&1&&(o=!0,d.value=u[0].secret,ye(()=>o=!1)),s.$set(d)},i(u){r||(I(s.$$.fragment,u),r=!0)},o(u){L(s.$$.fragment,u),r=!1},d(u){u&&(w(e),w(l)),V(s,u)}}}function zI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=D(),l=b("label"),s=b("span"),s.textContent="Force path-style addressing",o=D(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[20]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[20])},m(c,d){S(c,e,d),e.checked=n[0].forcePathStyle,S(c,i,d),S(c,l,d),y(l,s),y(l,o),y(l,r),f||(u=[Z(e,"change",n[14]),$e(Fe.call(null,r,{text:'Forces the request to use path-style addressing, eg. "https://s3.amazonaws.com/BUCKET/KEY" instead of the default "https://BUCKET.s3.amazonaws.com/KEY".',position:"top"}))],f=!0)},p(c,d){d&1048576&&t!==(t=c[20])&&p(e,"id",t),d&1&&(e.checked=c[0].forcePathStyle),d&1048576&&a!==(a=c[20])&&p(l,"for",a)},d(c){c&&(w(e),w(i),w(l)),f=!1,Te(u)}}}function VI(n){let e,t,i,l,s;e=new de({props:{class:"form-field form-field-toggle",$$slots:{default:[PI,({uniqueId:f})=>({20:f}),({uniqueId:f})=>f?1048576:0]},$$scope:{ctx:n}}});const o=n[7].default,r=St(o,n,n[15],r_);let a=n[0].enabled&&a_(n);return{c(){B(e.$$.fragment),t=D(),r&&r.c(),i=D(),a&&a.c(),l=ve()},m(f,u){z(e,f,u),S(f,t,u),r&&r.m(f,u),S(f,i,u),a&&a.m(f,u),S(f,l,u),s=!0},p(f,[u]){const c={};u&1081361&&(c.$$scope={dirty:u,ctx:f}),e.$set(c),r&&r.p&&(!s||u&32775)&&Tt(r,o,f,f[15],s?$t(o,f[15],u,NI):Ct(f[15]),r_),f[0].enabled?a?(a.p(f,u),u&1&&I(a,1)):(a=a_(f),a.c(),I(a,1),a.m(l.parentNode,l)):a&&(se(),L(a,1,1,()=>{a=null}),oe())},i(f){s||(I(e.$$.fragment,f),I(r,f),I(a),s=!0)},o(f){L(e.$$.fragment,f),L(r,f),L(a),s=!1},d(f){f&&(w(t),w(i),w(l)),V(e,f),r&&r.d(f),a&&a.d(f)}}}const Fr="s3_test_request";function BI(n,e,t){let{$$slots:i={},$$scope:l}=e,{originalConfig:s={}}=e,{config:o={}}=e,{configKey:r="s3"}=e,{toggleLabel:a="Enable S3"}=e,{testFilesystem:f="storage"}=e,{testError:u=null}=e,{isTesting:c=!1}=e,d=null,m=null;function h(E){t(2,c=!0),clearTimeout(m),m=setTimeout(()=>{_()},E)}async function _(){if(t(1,u=null),!o.enabled)return t(2,c=!1),u;fe.cancelRequest(Fr),clearTimeout(d),d=setTimeout(()=>{fe.cancelRequest(Fr),t(1,u=new Error("S3 test connection timeout.")),t(2,c=!1)},3e4),t(2,c=!0);let E;try{await fe.settings.testS3(f,{$cancelKey:Fr})}catch(A){E=A}return E!=null&&E.isAbort||(t(1,u=E),t(2,c=!1),clearTimeout(d)),u}zt(()=>()=>{clearTimeout(d),clearTimeout(m)});function g(){o.enabled=this.checked,t(0,o)}function v(){o.endpoint=this.value,t(0,o)}function $(){o.bucket=this.value,t(0,o)}function C(){o.region=this.value,t(0,o)}function T(){o.accessKey=this.value,t(0,o)}function O(E){n.$$.not_equal(o.secret,E)&&(o.secret=E,t(0,o))}function M(){o.forcePathStyle=this.checked,t(0,o)}return n.$$set=E=>{"originalConfig"in E&&t(5,s=E.originalConfig),"config"in E&&t(0,o=E.config),"configKey"in E&&t(3,r=E.configKey),"toggleLabel"in E&&t(4,a=E.toggleLabel),"testFilesystem"in E&&t(6,f=E.testFilesystem),"testError"in E&&t(1,u=E.testError),"isTesting"in E&&t(2,c=E.isTesting),"$$scope"in E&&t(15,l=E.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&s!=null&&s.enabled&&h(100),n.$$.dirty&9&&(o.enabled||si(r))},[o,u,c,r,a,s,f,i,g,v,$,C,T,O,M,l]}class Qb extends be{constructor(e){super(),ge(this,e,BI,VI,he,{originalConfig:5,config:0,configKey:3,toggleLabel:4,testFilesystem:6,testError:1,isTesting:2})}}function UI(n){var E;let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;function v(A){n[11](A)}function $(A){n[12](A)}function C(A){n[13](A)}let T={toggleLabel:"Use S3 storage",originalConfig:n[0].s3,$$slots:{default:[YI]},$$scope:{ctx:n}};n[1].s3!==void 0&&(T.config=n[1].s3),n[4]!==void 0&&(T.isTesting=n[4]),n[5]!==void 0&&(T.testError=n[5]),e=new Qb({props:T}),te.push(()=>ke(e,"config",v)),te.push(()=>ke(e,"isTesting",$)),te.push(()=>ke(e,"testError",C));let O=((E=n[1].s3)==null?void 0:E.enabled)&&!n[6]&&!n[3]&&u_(n),M=n[6]&&c_(n);return{c(){B(e.$$.fragment),s=D(),o=b("div"),r=b("div"),a=D(),O&&O.c(),f=D(),M&&M.c(),u=D(),c=b("button"),d=b("span"),d.textContent="Save changes",p(r,"class","flex-fill"),p(d,"class","txt"),p(c,"type","submit"),p(c,"class","btn btn-expanded"),c.disabled=m=!n[6]||n[3],ee(c,"btn-loading",n[3]),p(o,"class","flex")},m(A,N){z(e,A,N),S(A,s,N),S(A,o,N),y(o,r),y(o,a),O&&O.m(o,null),y(o,f),M&&M.m(o,null),y(o,u),y(o,c),y(c,d),h=!0,_||(g=Z(c,"click",n[15]),_=!0)},p(A,N){var R;const q={};N&1&&(q.originalConfig=A[0].s3),N&524291&&(q.$$scope={dirty:N,ctx:A}),!t&&N&2&&(t=!0,q.config=A[1].s3,ye(()=>t=!1)),!i&&N&16&&(i=!0,q.isTesting=A[4],ye(()=>i=!1)),!l&&N&32&&(l=!0,q.testError=A[5],ye(()=>l=!1)),e.$set(q),(R=A[1].s3)!=null&&R.enabled&&!A[6]&&!A[3]?O?O.p(A,N):(O=u_(A),O.c(),O.m(o,f)):O&&(O.d(1),O=null),A[6]?M?M.p(A,N):(M=c_(A),M.c(),M.m(o,u)):M&&(M.d(1),M=null),(!h||N&72&&m!==(m=!A[6]||A[3]))&&(c.disabled=m),(!h||N&8)&&ee(c,"btn-loading",A[3])},i(A){h||(I(e.$$.fragment,A),h=!0)},o(A){L(e.$$.fragment,A),h=!1},d(A){A&&(w(s),w(o)),V(e,A),O&&O.d(),M&&M.d(),_=!1,g()}}}function WI(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function f_(n){var N;let e,t,i,l,s,o,r,a=(N=n[0].s3)!=null&&N.enabled?"S3 storage":"local file system",f,u,c,d=n[1].s3.enabled?"S3 storage":"local file system",m,h,_,g,v,$,C,T,O,M,E,A;return{c(){e=b("div"),t=b("div"),i=b("div"),i.innerHTML='<i class="ri-error-warning-line"></i>',l=D(),s=b("div"),o=J(`If you have existing uploaded files, you'll have to migrate them manually
from the
`),r=b("strong"),f=J(a),u=J(`
to the
`),c=b("strong"),m=J(d),h=J(`.
`),_=b("br"),g=J(`
There are numerous command line tools that can help you, such as:
`),v=b("a"),v.textContent=`rclone
`,$=J(`,
`),C=b("a"),C.textContent=`s5cmd
`,T=J(", etc."),O=D(),M=b("div"),p(i,"class","icon"),p(v,"href","https://github.com/rclone/rclone"),p(v,"target","_blank"),p(v,"rel","noopener noreferrer"),p(v,"class","txt-bold"),p(C,"href","https://github.com/peak/s5cmd"),p(C,"target","_blank"),p(C,"rel","noopener noreferrer"),p(C,"class","txt-bold"),p(s,"class","content"),p(t,"class","alert alert-warning m-0"),p(M,"class","clearfix m-t-base")},m(q,R){S(q,e,R),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),y(s,r),y(r,f),y(s,u),y(s,c),y(c,m),y(s,h),y(s,_),y(s,g),y(s,v),y(s,$),y(s,C),y(s,T),y(e,O),y(e,M),A=!0},p(q,R){var P;(!A||R&1)&&a!==(a=(P=q[0].s3)!=null&&P.enabled?"S3 storage":"local file system")&&re(f,a),(!A||R&2)&&d!==(d=q[1].s3.enabled?"S3 storage":"local file system")&&re(m,d)},i(q){A||(q&&Je(()=>{A&&(E||(E=Re(e,tt,{duration:150},!0)),E.run(1))}),A=!0)},o(q){q&&(E||(E=Re(e,tt,{duration:150},!1)),E.run(0)),A=!1},d(q){q&&w(e),q&&E&&E.end()}}}function YI(n){var i;let e,t=((i=n[0].s3)==null?void 0:i.enabled)!=n[1].s3.enabled&&f_(n);return{c(){t&&t.c(),e=ve()},m(l,s){t&&t.m(l,s),S(l,e,s)},p(l,s){var o;((o=l[0].s3)==null?void 0:o.enabled)!=l[1].s3.enabled?t?(t.p(l,s),s&3&&I(t,1)):(t=f_(l),t.c(),I(t,1),t.m(e.parentNode,e)):t&&(se(),L(t,1,1,()=>{t=null}),oe())},d(l){l&&w(e),t&&t.d(l)}}}function u_(n){let e;function t(s,o){return s[4]?ZI:s[5]?JI:KI}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function KI(n){let e;return{c(){e=b("div"),e.innerHTML='<i class="ri-checkbox-circle-line txt-success"></i> <span class="txt">S3 connected successfully</span>',p(e,"class","label label-sm label-success entrance-right")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function JI(n){let e,t,i,l;return{c(){e=b("div"),e.innerHTML='<i class="ri-error-warning-line txt-warning"></i> <span class="txt">Failed to establish S3 connection</span>',p(e,"class","label label-sm label-warning entrance-right")},m(s,o){var r;S(s,e,o),i||(l=$e(t=Fe.call(null,e,(r=n[5].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&Ot(t.update)&&o&32&&t.update.call(null,(r=s[5].data)==null?void 0:r.message)},d(s){s&&w(e),i=!1,l()}}}function ZI(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function c_(n){let e,t,i,l;return{c(){e=b("button"),t=b("span"),t.textContent="Reset",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3]},m(s,o){S(s,e,o),y(e,t),i||(l=Z(e,"click",n[14]),i=!0)},p(s,o){o&8&&(e.disabled=s[3])},d(s){s&&w(e),i=!1,l()}}}function GI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;const v=[WI,UI],$=[];function C(T,O){return T[2]?0:1}return d=C(n),m=$[d]=v[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[7]),r=D(),a=b("div"),f=b("form"),u=b("div"),u.innerHTML="<p>By default PocketBase uses the local file system to store uploaded files.</p> <p>If you have limited disk space, you could optionally connect to an S3 compatible storage.</p>",c=D(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","content txt-xl m-b-base"),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m(T,O){S(T,e,O),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S(T,r,O),S(T,a,O),y(a,f),y(f,u),y(f,c),$[d].m(f,null),h=!0,_||(g=Z(f,"submit",Ue(n[16])),_=!0)},p(T,O){(!h||O&128)&&re(o,T[7]);let M=d;d=C(T),d===M?$[d].p(T,O):(se(),L($[M],1,1,()=>{$[M]=null}),oe(),m=$[d],m?m.p(T,O):(m=$[d]=v[d](T),m.c()),I(m,1),m.m(f,null))},i(T){h||(I(m),h=!0)},o(T){L(m),h=!1},d(T){T&&(w(e),w(r),w(a)),$[d].d(),_=!1,g()}}}function XI(n){let e,t,i,l;return e=new gi({}),i=new kn({props:{$$slots:{default:[GI]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,[o]){const r={};o&524543&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}const QI="s3_test_request";function xI(n,e,t){let i,l,s;We(n,At,M=>t(7,s=M)),en(At,s="Files storage",s);let o={},r={},a=!1,f=!1,u=!1,c=null;d();async function d(){t(2,a=!0);try{const M=await fe.settings.getAll()||{};h(M)}catch(M){fe.error(M)}t(2,a=!1)}async function m(){if(!(f||!l)){t(3,f=!0);try{fe.cancelRequest(QI);const M=await fe.settings.update(H.filterRedactedProps(r));Gt({}),await h(M),Sa(),c?iv("Successfully saved but failed to establish S3 connection."):Nt("Successfully saved files storage settings.")}catch(M){fe.error(M)}t(3,f=!1)}}async function h(M={}){t(1,r={s3:(M==null?void 0:M.s3)||{}}),t(0,o=JSON.parse(JSON.stringify(r)))}async function _(){t(1,r=JSON.parse(JSON.stringify(o||{})))}function g(M){n.$$.not_equal(r.s3,M)&&(r.s3=M,t(1,r))}function v(M){u=M,t(4,u)}function $(M){c=M,t(5,c)}const C=()=>_(),T=()=>m(),O=()=>m();return n.$$.update=()=>{n.$$.dirty&1&&t(10,i=JSON.stringify(o)),n.$$.dirty&1026&&t(6,l=i!=JSON.stringify(r))},[o,r,a,f,u,c,l,s,m,_,i,g,v,$,C,T,O]}class eA extends be{constructor(e){super(),ge(this,e,xI,XI,he,{})}}function tA(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[20]),p(l,"for",o=n[20])},m(f,u){S(f,e,u),e.checked=n[1].enabled,S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[11]),r=!0)},p(f,u){u&1048576&&t!==(t=f[20])&&p(e,"id",t),u&2&&(e.checked=f[1].enabled),u&1048576&&o!==(o=f[20])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function nA(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=J("Client ID"),l=D(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=r=n[1].enabled},m(u,c){S(u,e,c),y(e,t),S(u,l,c),S(u,s,c),ae(s,n[1].clientId),a||(f=Z(s,"input",n[12]),a=!0)},p(u,c){c&1048576&&i!==(i=u[20])&&p(e,"for",i),c&1048576&&o!==(o=u[20])&&p(s,"id",o),c&2&&r!==(r=u[1].enabled)&&(s.required=r),c&2&&s.value!==u[1].clientId&&ae(s,u[1].clientId)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function iA(n){let e,t,i,l,s,o,r;function a(u){n[13](u)}let f={id:n[20],required:n[1].enabled};return n[1].clientSecret!==void 0&&(f.value=n[1].clientSecret),s=new Ja({props:f}),te.push(()=>ke(s,"value",a)),{c(){e=b("label"),t=J("Client secret"),l=D(),B(s.$$.fragment),p(e,"for",i=n[20])},m(u,c){S(u,e,c),y(e,t),S(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c&1048576&&i!==(i=u[20]))&&p(e,"for",i);const d={};c&1048576&&(d.id=u[20]),c&2&&(d.required=u[1].enabled),!o&&c&2&&(o=!0,d.value=u[1].clientSecret,ye(()=>o=!1)),s.$set(d)},i(u){r||(I(s.$$.fragment,u),r=!0)},o(u){L(s.$$.fragment,u),r=!1},d(u){u&&(w(e),w(l)),V(s,u)}}}function d_(n){let e,t,i,l;const s=[{key:n[3].key},n[3].optionsComponentProps||{}];function o(f){n[14](f)}var r=n[3].optionsComponent;function a(f,u){let c={};for(let d=0;d<s.length;d+=1)c=Ae(c,s[d]);return u!==void 0&&u&8&&(c=Ae(c,mt(s,[{key:f[3].key},Mt(f[3].optionsComponentProps||{})]))),f[1]!==void 0&&(c.config=f[1]),{props:c}}return r&&(t=Et(r,a(n)),te.push(()=>ke(t,"config",o))),{c(){e=b("div"),t&&B(t.$$.fragment),p(e,"class","col-lg-12")},m(f,u){S(f,e,u),t&&z(t,e,null),l=!0},p(f,u){if(u&8&&r!==(r=f[3].optionsComponent)){if(t){se();const c=t;L(c.$$.fragment,1,0,()=>{V(c,1)}),oe()}r?(t=Et(r,a(f,u)),te.push(()=>ke(t,"config",o)),B(t.$$.fragment),I(t.$$.fragment,1),z(t,e,null)):t=null}else if(r){const c=u&8?mt(s,[{key:f[3].key},Mt(f[3].optionsComponentProps||{})]):{};!i&&u&2&&(i=!0,c.config=f[1],ye(()=>i=!1)),t.$set(c)}},i(f){l||(t&&I(t.$$.fragment,f),l=!0)},o(f){t&&L(t.$$.fragment,f),l=!1},d(f){f&&w(e),t&&V(t)}}}function lA(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;i=new de({props:{class:"form-field form-field-toggle m-b-0",name:n[3].key+".enabled",$$slots:{default:[tA,({uniqueId:_})=>({20:_}),({uniqueId:_})=>_?1048576:0]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field "+(n[1].enabled?"required":""),name:n[3].key+".clientId",$$slots:{default:[nA,({uniqueId:_})=>({20:_}),({uniqueId:_})=>_?1048576:0]},$$scope:{ctx:n}}}),f=new de({props:{class:"form-field "+(n[1].enabled?"required":""),name:n[3].key+".clientSecret",$$slots:{default:[iA,({uniqueId:_})=>({20:_}),({uniqueId:_})=>_?1048576:0]},$$scope:{ctx:n}}});let h=n[3].optionsComponent&&d_(n);return{c(){e=b("form"),t=b("div"),B(i.$$.fragment),l=D(),s=b("button"),s.innerHTML='<span class="txt">Clear all fields</span>',o=D(),B(r.$$.fragment),a=D(),B(f.$$.fragment),u=D(),h&&h.c(),p(s,"type","button"),p(s,"class","btn btn-sm btn-transparent btn-hint m-l-auto"),p(t,"class","flex m-b-base"),p(e,"id",n[6]),p(e,"autocomplete","off")},m(_,g){S(_,e,g),y(e,t),z(i,t,null),y(t,l),y(t,s),y(e,o),z(r,e,null),y(e,a),z(f,e,null),y(e,u),h&&h.m(e,null),c=!0,d||(m=[Z(s,"click",n[8]),Z(e,"submit",Ue(n[15]))],d=!0)},p(_,g){const v={};g&8&&(v.name=_[3].key+".enabled"),g&3145730&&(v.$$scope={dirty:g,ctx:_}),i.$set(v);const $={};g&2&&($.class="form-field "+(_[1].enabled?"required":"")),g&8&&($.name=_[3].key+".clientId"),g&3145730&&($.$$scope={dirty:g,ctx:_}),r.$set($);const C={};g&2&&(C.class="form-field "+(_[1].enabled?"required":"")),g&8&&(C.name=_[3].key+".clientSecret"),g&3145730&&(C.$$scope={dirty:g,ctx:_}),f.$set(C),_[3].optionsComponent?h?(h.p(_,g),g&8&&I(h,1)):(h=d_(_),h.c(),I(h,1),h.m(e,null)):h&&(se(),L(h,1,1,()=>{h=null}),oe())},i(_){c||(I(i.$$.fragment,_),I(r.$$.fragment,_),I(f.$$.fragment,_),I(h),c=!0)},o(_){L(i.$$.fragment,_),L(r.$$.fragment,_),L(f.$$.fragment,_),L(h),c=!1},d(_){_&&w(e),V(i),V(r),V(f),h&&h.d(),d=!1,Te(m)}}}function sA(n){let e,t=(n[3].title||n[3].key)+"",i,l;return{c(){e=b("h4"),i=J(t),l=J(" provider"),p(e,"class","center txt-break")},m(s,o){S(s,e,o),y(e,i),y(e,l)},p(s,o){o&8&&t!==(t=(s[3].title||s[3].key)+"")&&re(i,t)},d(s){s&&w(e)}}}function oA(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=J("Close"),i=D(),l=b("button"),s=b("span"),s.textContent="Save changes",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[4],ee(l,"btn-loading",n[4])},m(f,u){S(f,e,u),y(e,t),S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"click",n[0]),r=!0)},p(f,u){u&16&&(e.disabled=f[4]),u&48&&o!==(o=!f[5]||f[4])&&(l.disabled=o),u&16&&ee(l,"btn-loading",f[4])},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function rA(n){let e,t,i={overlayClose:!n[4],escClose:!n[4],$$slots:{footer:[oA],header:[sA],default:[lA]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[16](e),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.overlayClose=!l[4]),s&16&&(o.escClose=!l[4]),s&2097210&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[16](null),V(e,l)}}}function aA(n,e,t){let i;const l=st(),s="provider_popup_"+H.randomString(5);let o,r={},a={},f=!1,u="";function c(E,A){Gt({}),t(3,r=Object.assign({},E)),t(1,a=Object.assign({enabled:!0},A)),t(10,u=JSON.stringify(a)),o==null||o.show()}function d(){return o==null?void 0:o.hide()}async function m(){t(4,f=!0);try{const E={};E[r.key]=H.filterRedactedProps(a);const A=await fe.settings.update(E);Gt({}),Nt("Successfully updated provider settings."),l("submit",A),d()}catch(E){fe.error(E)}t(4,f=!1)}function h(){var E;for(let A in a)t(1,a[A]=H.zeroValue(a[A]),a);(E=r.key)!=null&&E.startsWith("oidc")?t(1,a[k].pkce=!1,a):t(1,a[k].pkce=null,a)}function _(){a.enabled=this.checked,t(1,a)}function g(){a.clientId=this.value,t(1,a)}function v(E){n.$$.not_equal(a.clientSecret,E)&&(a.clientSecret=E,t(1,a))}function $(E){a=E,t(1,a)}const C=()=>m();function T(E){te[E?"unshift":"push"](()=>{o=E,t(2,o)})}function O(E){Oe.call(this,n,E)}function M(E){Oe.call(this,n,E)}return n.$$.update=()=>{n.$$.dirty&1026&&t(5,i=JSON.stringify(a)!=u)},[d,a,o,r,f,i,s,m,h,c,u,_,g,v,$,C,T,O,M]}class fA extends be{constructor(e){super(),ge(this,e,aA,rA,he,{show:9,hide:0})}get show(){return this.$$.ctx[9]}get hide(){return this.$$.ctx[0]}}function p_(n){let e,t,i;return{c(){e=b("img"),tn(e.src,t="./images/oauth2/"+n[1].logo)||p(e,"src",t),p(e,"alt",i=n[1].title+" logo")},m(l,s){S(l,e,s)},p(l,s){s&2&&!tn(e.src,t="./images/oauth2/"+l[1].logo)&&p(e,"src",t),s&2&&i!==(i=l[1].title+" logo")&&p(e,"alt",i)},d(l){l&&w(e)}}}function m_(n){let e;return{c(){e=b("div"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function uA(n){let e,t,i,l,s=n[1].title+"",o,r,a,f,u=n[1].key.slice(0,-4)+"",c,d,m,h,_,g,v,$,C,T,O=n[1].logo&&p_(n),M=n[0].enabled&&m_(),E={};return v=new fA({props:E}),n[4](v),v.$on("submit",n[5]),{c(){e=b("div"),t=b("figure"),O&&O.c(),i=D(),l=b("div"),o=J(s),r=D(),a=b("em"),f=J("("),c=J(u),d=J(")"),m=D(),M&&M.c(),h=D(),_=b("button"),_.innerHTML='<i class="ri-settings-4-line"></i>',g=D(),B(v.$$.fragment),p(t,"class","provider-logo"),p(l,"class","title"),p(a,"class","txt-hint txt-sm m-r-auto"),p(_,"type","button"),p(_,"class","btn btn-circle btn-hint btn-transparent"),p(_,"aria-label","Provider settings"),p(e,"class","provider-card")},m(A,N){S(A,e,N),y(e,t),O&&O.m(t,null),y(e,i),y(e,l),y(l,o),y(e,r),y(e,a),y(a,f),y(a,c),y(a,d),y(e,m),M&&M.m(e,null),y(e,h),y(e,_),S(A,g,N),z(v,A,N),$=!0,C||(T=Z(_,"click",n[3]),C=!0)},p(A,[N]){A[1].logo?O?O.p(A,N):(O=p_(A),O.c(),O.m(t,null)):O&&(O.d(1),O=null),(!$||N&2)&&s!==(s=A[1].title+"")&&re(o,s),(!$||N&2)&&u!==(u=A[1].key.slice(0,-4)+"")&&re(c,u),A[0].enabled?M||(M=m_(),M.c(),M.m(e,h)):M&&(M.d(1),M=null);const q={};v.$set(q)},i(A){$||(I(v.$$.fragment,A),$=!0)},o(A){L(v.$$.fragment,A),$=!1},d(A){A&&(w(e),w(g)),O&&O.d(),M&&M.d(),n[4](null),V(v,A),C=!1,T()}}}function cA(n,e,t){let{provider:i={}}=e,{config:l={}}=e,s;const o=()=>{s==null||s.show(i,Object.assign({},l,{enabled:l.clientId?l.enabled:!0,pkce:l.clientId?l.pkce:null}))};function r(f){te[f?"unshift":"push"](()=>{s=f,t(2,s)})}const a=f=>{f.detail[i.key]&&t(0,l=f.detail[i.key])};return n.$$set=f=>{"provider"in f&&t(1,i=f.provider),"config"in f&&t(0,l=f.config)},[l,i,s,o,r,a]}class xb extends be{constructor(e){super(),ge(this,e,cA,uA,he,{provider:1,config:0})}}function h_(n,e,t){const i=n.slice();return i[9]=e[t],i[10]=e,i[11]=t,i}function __(n,e,t){const i=n.slice();return i[9]=e[t],i[12]=e,i[13]=t,i}function dA(n){let e,t=[],i=new Map,l,s,o,r=[],a=new Map,f,u=ce(n[3]);const c=_=>_[9].key;for(let _=0;_<u.length;_+=1){let g=__(n,u,_),v=c(g);i.set(v,t[_]=g_(v,g))}let d=n[3].length>0&&n[2].length>0&&b_(),m=ce(n[2]);const h=_=>_[9].key;for(let _=0;_<m.length;_+=1){let g=h_(n,m,_),v=h(g);a.set(v,r[_]=k_(v,g))}return{c(){e=b("div");for(let _=0;_<t.length;_+=1)t[_].c();l=D(),d&&d.c(),s=D(),o=b("div");for(let _=0;_<r.length;_+=1)r[_].c();p(e,"class","grid grid-sm"),p(o,"class","grid grid-sm")},m(_,g){S(_,e,g);for(let v=0;v<t.length;v+=1)t[v]&&t[v].m(e,null);S(_,l,g),d&&d.m(_,g),S(_,s,g),S(_,o,g);for(let v=0;v<r.length;v+=1)r[v]&&r[v].m(o,null);f=!0},p(_,g){g&9&&(u=ce(_[3]),se(),t=ft(t,g,c,1,_,u,i,e,It,g_,null,__),oe()),_[3].length>0&&_[2].length>0?d||(d=b_(),d.c(),d.m(s.parentNode,s)):d&&(d.d(1),d=null),g&5&&(m=ce(_[2]),se(),r=ft(r,g,h,1,_,m,a,o,It,k_,null,h_),oe())},i(_){if(!f){for(let g=0;g<u.length;g+=1)I(t[g]);for(let g=0;g<m.length;g+=1)I(r[g]);f=!0}},o(_){for(let g=0;g<t.length;g+=1)L(t[g]);for(let g=0;g<r.length;g+=1)L(r[g]);f=!1},d(_){_&&(w(e),w(l),w(s),w(o));for(let g=0;g<t.length;g+=1)t[g].d();d&&d.d(_);for(let g=0;g<r.length;g+=1)r[g].d()}}}function pA(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function g_(n,e){let t,i,l,s,o;function r(f){e[5](f,e[9])}let a={provider:e[9]};return e[0][e[9].key]!==void 0&&(a.config=e[0][e[9].key]),i=new xb({props:a}),te.push(()=>ke(i,"config",r)),{key:n,first:null,c(){t=b("div"),B(i.$$.fragment),s=D(),p(t,"class","col-lg-6"),this.first=t},m(f,u){S(f,t,u),z(i,t,null),y(t,s),o=!0},p(f,u){e=f;const c={};u&8&&(c.provider=e[9]),!l&&u&9&&(l=!0,c.config=e[0][e[9].key],ye(()=>l=!1)),i.$set(c)},i(f){o||(I(i.$$.fragment,f),o=!0)},o(f){L(i.$$.fragment,f),o=!1},d(f){f&&w(t),V(i)}}}function b_(n){let e;return{c(){e=b("hr")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function k_(n,e){let t,i,l,s,o;function r(f){e[6](f,e[9])}let a={provider:e[9]};return e[0][e[9].key]!==void 0&&(a.config=e[0][e[9].key]),i=new xb({props:a}),te.push(()=>ke(i,"config",r)),{key:n,first:null,c(){t=b("div"),B(i.$$.fragment),s=D(),p(t,"class","col-lg-6"),this.first=t},m(f,u){S(f,t,u),z(i,t,null),y(t,s),o=!0},p(f,u){e=f;const c={};u&4&&(c.provider=e[9]),!l&&u&5&&(l=!0,c.config=e[0][e[9].key],ye(()=>l=!1)),i.$set(c)},i(f){o||(I(i.$$.fragment,f),o=!0)},o(f){L(i.$$.fragment,f),o=!1},d(f){f&&w(t),V(i)}}}function mA(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h;const _=[pA,dA],g=[];function v($,C){return $[1]?0:1}return d=v(n),m=g[d]=_[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[4]),r=D(),a=b("div"),f=b("div"),u=b("h6"),u.textContent="Manage the allowed users OAuth2 sign-in/sign-up methods.",c=D(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","m-b-base"),p(f,"class","panel"),p(a,"class","wrapper")},m($,C){S($,e,C),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S($,r,C),S($,a,C),y(a,f),y(f,u),y(f,c),g[d].m(f,null),h=!0},p($,C){(!h||C&16)&&re(o,$[4]);let T=d;d=v($),d===T?g[d].p($,C):(se(),L(g[T],1,1,()=>{g[T]=null}),oe(),m=g[d],m?m.p($,C):(m=g[d]=_[d]($),m.c()),I(m,1),m.m(f,null))},i($){h||(I(m),h=!0)},o($){L(m),h=!1},d($){$&&(w(e),w(r),w(a)),g[d].d()}}}function hA(n){let e,t,i,l;return e=new gi({}),i=new kn({props:{$$slots:{default:[mA]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,[o]){const r={};o&16415&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}function _A(n,e,t){let i,l,s;We(n,At,d=>t(4,s=d)),en(At,s="Auth providers",s);let o=!1,r={};a();async function a(){t(1,o=!0);try{const d=await fe.settings.getAll()||{};f(d)}catch(d){fe.error(d)}t(1,o=!1)}function f(d){d=d||{},t(0,r={});for(const m of bo)t(0,r[m.key]=Object.assign({enabled:!1},d[m.key]),r)}function u(d,m){n.$$.not_equal(r[m.key],d)&&(r[m.key]=d,t(0,r))}function c(d,m){n.$$.not_equal(r[m.key],d)&&(r[m.key]=d,t(0,r))}return n.$$.update=()=>{n.$$.dirty&1&&t(3,i=bo.filter(d=>{var m;return(m=r[d.key])==null?void 0:m.enabled})),n.$$.dirty&1&&t(2,l=bo.filter(d=>{var m;return!((m=r[d.key])!=null&&m.enabled)}))},[r,o,l,i,s,u,c]}class gA extends be{constructor(e){super(),ge(this,e,_A,hA,he,{})}}function bA(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("label"),t=J(n[3]),i=J(" duration (in seconds)"),s=D(),o=b("input"),a=D(),f=b("div"),u=b("span"),u.textContent="Invalidate all previously issued tokens",p(e,"for",l=n[6]),p(o,"type","number"),p(o,"id",r=n[6]),o.required=!0,p(u,"class","link-primary"),ee(u,"txt-success",!!n[1]),p(f,"class","help-block")},m(m,h){S(m,e,h),y(e,t),y(e,i),S(m,s,h),S(m,o,h),ae(o,n[0]),S(m,a,h),S(m,f,h),y(f,u),c||(d=[Z(o,"input",n[4]),Z(u,"click",n[5])],c=!0)},p(m,h){h&8&&re(t,m[3]),h&64&&l!==(l=m[6])&&p(e,"for",l),h&64&&r!==(r=m[6])&&p(o,"id",r),h&1&&lt(o.value)!==m[0]&&ae(o,m[0]),h&2&&ee(u,"txt-success",!!m[1])},d(m){m&&(w(e),w(s),w(o),w(a),w(f)),c=!1,Te(d)}}}function kA(n){let e,t;return e=new de({props:{class:"form-field required",name:n[2]+".duration",$$slots:{default:[bA,({uniqueId:i})=>({6:i}),({uniqueId:i})=>i?64:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&4&&(s.name=i[2]+".duration"),l&203&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function yA(n,e,t){let{key:i}=e,{label:l}=e,{duration:s}=e,{secret:o}=e;function r(){s=lt(this.value),t(0,s)}const a=()=>{o?t(1,o=void 0):t(1,o=H.randomSecret(50))};return n.$$set=f=>{"key"in f&&t(2,i=f.key),"label"in f&&t(3,l=f.label),"duration"in f&&t(0,s=f.duration),"secret"in f&&t(1,o=f.secret)},[s,o,i,l,r,a]}class e0 extends be{constructor(e){super(),ge(this,e,yA,kA,he,{key:2,label:3,duration:0,secret:1})}}function y_(n,e,t){const i=n.slice();return i[19]=e[t],i[20]=e,i[21]=t,i}function v_(n,e,t){const i=n.slice();return i[19]=e[t],i[22]=e,i[23]=t,i}function vA(n){let e,t,i=[],l=new Map,s,o,r,a,f,u=[],c=new Map,d,m,h,_,g,v,$,C,T,O,M,E=ce(n[5]);const A=P=>P[19].key;for(let P=0;P<E.length;P+=1){let F=v_(n,E,P),j=A(F);l.set(j,i[P]=w_(j,F))}let N=ce(n[6]);const q=P=>P[19].key;for(let P=0;P<N.length;P+=1){let F=y_(n,N,P),j=q(F);c.set(j,u[P]=S_(j,F))}let R=n[3]&&$_(n);return{c(){e=b("h3"),e.textContent="Record tokens",t=D();for(let P=0;P<i.length;P+=1)i[P].c();s=D(),o=b("hr"),r=D(),a=b("h3"),a.textContent="Admin tokens",f=D();for(let P=0;P<u.length;P+=1)u[P].c();d=D(),m=b("div"),h=b("div"),_=D(),R&&R.c(),g=D(),v=b("button"),$=b("span"),$.textContent="Save changes",p(e,"class","section-title"),p(a,"class","section-title"),p(h,"class","flex-fill"),p($,"class","txt"),p(v,"type","submit"),p(v,"class","btn btn-expanded"),v.disabled=C=!n[3]||n[2],ee(v,"btn-loading",n[2]),p(m,"class","flex")},m(P,F){S(P,e,F),S(P,t,F);for(let j=0;j<i.length;j+=1)i[j]&&i[j].m(P,F);S(P,s,F),S(P,o,F),S(P,r,F),S(P,a,F),S(P,f,F);for(let j=0;j<u.length;j+=1)u[j]&&u[j].m(P,F);S(P,d,F),S(P,m,F),y(m,h),y(m,_),R&&R.m(m,null),y(m,g),y(m,v),y(v,$),T=!0,O||(M=Z(v,"click",n[16]),O=!0)},p(P,F){F&33&&(E=ce(P[5]),se(),i=ft(i,F,A,1,P,E,l,s.parentNode,It,w_,s,v_),oe()),F&65&&(N=ce(P[6]),se(),u=ft(u,F,q,1,P,N,c,d.parentNode,It,S_,d,y_),oe()),P[3]?R?R.p(P,F):(R=$_(P),R.c(),R.m(m,g)):R&&(R.d(1),R=null),(!T||F&12&&C!==(C=!P[3]||P[2]))&&(v.disabled=C),(!T||F&4)&&ee(v,"btn-loading",P[2])},i(P){if(!T){for(let F=0;F<E.length;F+=1)I(i[F]);for(let F=0;F<N.length;F+=1)I(u[F]);T=!0}},o(P){for(let F=0;F<i.length;F+=1)L(i[F]);for(let F=0;F<u.length;F+=1)L(u[F]);T=!1},d(P){P&&(w(e),w(t),w(s),w(o),w(r),w(a),w(f),w(d),w(m));for(let F=0;F<i.length;F+=1)i[F].d(P);for(let F=0;F<u.length;F+=1)u[F].d(P);R&&R.d(),O=!1,M()}}}function wA(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function w_(n,e){let t,i,l,s,o;function r(u){e[11](u,e[19])}function a(u){e[12](u,e[19])}let f={key:e[19].key,label:e[19].label};return e[0][e[19].key].duration!==void 0&&(f.duration=e[0][e[19].key].duration),e[0][e[19].key].secret!==void 0&&(f.secret=e[0][e[19].key].secret),i=new e0({props:f}),te.push(()=>ke(i,"duration",r)),te.push(()=>ke(i,"secret",a)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(u,c){S(u,t,c),z(i,u,c),o=!0},p(u,c){e=u;const d={};!l&&c&33&&(l=!0,d.duration=e[0][e[19].key].duration,ye(()=>l=!1)),!s&&c&33&&(s=!0,d.secret=e[0][e[19].key].secret,ye(()=>s=!1)),i.$set(d)},i(u){o||(I(i.$$.fragment,u),o=!0)},o(u){L(i.$$.fragment,u),o=!1},d(u){u&&w(t),V(i,u)}}}function S_(n,e){let t,i,l,s,o;function r(u){e[13](u,e[19])}function a(u){e[14](u,e[19])}let f={key:e[19].key,label:e[19].label};return e[0][e[19].key].duration!==void 0&&(f.duration=e[0][e[19].key].duration),e[0][e[19].key].secret!==void 0&&(f.secret=e[0][e[19].key].secret),i=new e0({props:f}),te.push(()=>ke(i,"duration",r)),te.push(()=>ke(i,"secret",a)),{key:n,first:null,c(){t=ve(),B(i.$$.fragment),this.first=t},m(u,c){S(u,t,c),z(i,u,c),o=!0},p(u,c){e=u;const d={};!l&&c&65&&(l=!0,d.duration=e[0][e[19].key].duration,ye(()=>l=!1)),!s&&c&65&&(s=!0,d.secret=e[0][e[19].key].secret,ye(()=>s=!1)),i.$set(d)},i(u){o||(I(i.$$.fragment,u),o=!0)},o(u){L(i.$$.fragment,u),o=!1},d(u){u&&w(t),V(i,u)}}}function $_(n){let e,t,i,l;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[2]},m(s,o){S(s,e,o),y(e,t),i||(l=Z(e,"click",n[15]),i=!0)},p(s,o){o&4&&(e.disabled=s[2])},d(s){s&&w(e),i=!1,l()}}}function SA(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;const v=[wA,vA],$=[];function C(T,O){return T[1]?0:1}return d=C(n),m=$[d]=v[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[4]),r=D(),a=b("div"),f=b("form"),u=b("div"),u.innerHTML="<p>Adjust common token options.</p>",c=D(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","content m-b-sm txt-xl"),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m(T,O){S(T,e,O),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S(T,r,O),S(T,a,O),y(a,f),y(f,u),y(f,c),$[d].m(f,null),h=!0,_||(g=Z(f,"submit",Ue(n[7])),_=!0)},p(T,O){(!h||O&16)&&re(o,T[4]);let M=d;d=C(T),d===M?$[d].p(T,O):(se(),L($[M],1,1,()=>{$[M]=null}),oe(),m=$[d],m?m.p(T,O):(m=$[d]=v[d](T),m.c()),I(m,1),m.m(f,null))},i(T){h||(I(m),h=!0)},o(T){L(m),h=!1},d(T){T&&(w(e),w(r),w(a)),$[d].d(),_=!1,g()}}}function $A(n){let e,t,i,l;return e=new gi({}),i=new kn({props:{$$slots:{default:[SA]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,[o]){const r={};o&16777247&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}function TA(n,e,t){let i,l,s;We(n,At,M=>t(4,s=M));const o=[{key:"recordAuthToken",label:"Auth record authentication token"},{key:"recordVerificationToken",label:"Auth record email verification token"},{key:"recordPasswordResetToken",label:"Auth record password reset token"},{key:"recordEmailChangeToken",label:"Auth record email change token"},{key:"recordFileToken",label:"Records protected file access token"}],r=[{key:"adminAuthToken",label:"Admins auth token"},{key:"adminPasswordResetToken",label:"Admins password reset token"},{key:"adminFileToken",label:"Admins protected file access token"}];en(At,s="Token options",s);let a={},f={},u=!1,c=!1;d();async function d(){t(1,u=!0);try{const M=await fe.settings.getAll()||{};h(M)}catch(M){fe.error(M)}t(1,u=!1)}async function m(){if(!(c||!l)){t(2,c=!0);try{const M=await fe.settings.update(H.filterRedactedProps(f));h(M),Nt("Successfully saved tokens options.")}catch(M){fe.error(M)}t(2,c=!1)}}function h(M){var A;M=M||{},t(0,f={});const E=o.concat(r);for(const N of E)t(0,f[N.key]={duration:((A=M[N.key])==null?void 0:A.duration)||0},f);t(9,a=JSON.parse(JSON.stringify(f)))}function _(){t(0,f=JSON.parse(JSON.stringify(a||{})))}function g(M,E){n.$$.not_equal(f[E.key].duration,M)&&(f[E.key].duration=M,t(0,f))}function v(M,E){n.$$.not_equal(f[E.key].secret,M)&&(f[E.key].secret=M,t(0,f))}function $(M,E){n.$$.not_equal(f[E.key].duration,M)&&(f[E.key].duration=M,t(0,f))}function C(M,E){n.$$.not_equal(f[E.key].secret,M)&&(f[E.key].secret=M,t(0,f))}const T=()=>_(),O=()=>m();return n.$$.update=()=>{n.$$.dirty&512&&t(10,i=JSON.stringify(a)),n.$$.dirty&1025&&t(3,l=i!=JSON.stringify(f))},[f,u,c,l,s,o,r,m,_,a,i,g,v,$,C,T,O]}class CA extends be{constructor(e){super(),ge(this,e,TA,$A,he,{})}}function T_(n,e,t){const i=n.slice();return i[22]=e[t],i}function OA(n){let e,t,i,l,s,o,r,a=[],f=new Map,u,c,d,m,h,_,g,v,$,C,T,O,M,E,A,N,q,R,P;o=new de({props:{class:"form-field",$$slots:{default:[DA,({uniqueId:U})=>({12:U}),({uniqueId:U})=>U?4096:0]},$$scope:{ctx:n}}});let F=ce(n[0]);const j=U=>U[22].id;for(let U=0;U<F.length;U+=1){let Y=T_(n,F,U),X=j(Y);f.set(X,a[U]=C_(X,Y))}return{c(){e=b("div"),e.innerHTML=`<p>Below you&#39;ll find your current collections configuration that you could import in
another PocketBase environment.</p>`,t=D(),i=b("div"),l=b("div"),s=b("div"),B(o.$$.fragment),r=D();for(let U=0;U<a.length;U+=1)a[U].c();u=D(),c=b("div"),d=b("button"),m=b("span"),m.textContent="Copy",_=D(),g=b("pre"),v=D(),$=b("div"),C=b("div"),T=D(),O=b("button"),M=b("i"),E=D(),A=b("span"),A.textContent="Download as JSON",p(e,"class","content txt-xl m-b-base"),p(s,"class","list-item list-item-section"),p(l,"class","export-list"),p(m,"class","txt"),p(d,"type","button"),p(d,"class","btn btn-sm btn-transparent fade copy-schema"),d.disabled=h=!n[2],p(g,"class","code-wrapper"),p(c,"tabindex","0"),p(c,"class","export-preview"),p(i,"class","export-panel"),p(C,"class","flex-fill"),p(M,"class","ri-download-line"),p(A,"class","txt"),p(O,"type","button"),p(O,"class","btn btn-expanded"),O.disabled=N=!n[2],p($,"class","flex m-t-base")},m(U,Y){S(U,e,Y),S(U,t,Y),S(U,i,Y),y(i,l),y(l,s),z(o,s,null),y(l,r);for(let X=0;X<a.length;X+=1)a[X]&&a[X].m(l,null);y(i,u),y(i,c),y(c,d),y(d,m),y(c,_),y(c,g),g.innerHTML=n[6],n[16](c),S(U,v,Y),S(U,$,Y),y($,C),y($,T),y($,O),y(O,M),y(O,E),y(O,A),q=!0,R||(P=[Z(d,"click",n[15]),Z(c,"keydown",n[17]),Z(O,"click",n[18])],R=!0)},p(U,Y){const X={};Y&33558561&&(X.$$scope={dirty:Y,ctx:U}),o.$set(X),Y&6147&&(F=ce(U[0]),se(),a=ft(a,Y,j,1,U,F,f,l,It,C_,null,T_),oe()),(!q||Y&4&&h!==(h=!U[2]))&&(d.disabled=h),(!q||Y&64)&&(g.innerHTML=U[6]),(!q||Y&4&&N!==(N=!U[2]))&&(O.disabled=N)},i(U){if(!q){I(o.$$.fragment,U);for(let Y=0;Y<F.length;Y+=1)I(a[Y]);q=!0}},o(U){L(o.$$.fragment,U);for(let Y=0;Y<a.length;Y+=1)L(a[Y]);q=!1},d(U){U&&(w(e),w(t),w(i),w(v),w($)),V(o);for(let Y=0;Y<a.length;Y+=1)a[Y].d();n[16](null),R=!1,Te(P)}}}function MA(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function DA(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("input"),l=D(),s=b("label"),o=J("Select all"),p(e,"type","checkbox"),p(e,"id",t=n[12]),e.disabled=i=!n[0].length,e.checked=n[5],p(s,"for",r=n[12])},m(u,c){S(u,e,c),S(u,l,c),S(u,s,c),y(s,o),a||(f=Z(e,"change",n[13]),a=!0)},p(u,c){c&4096&&t!==(t=u[12])&&p(e,"id",t),c&1&&i!==(i=!u[0].length)&&(e.disabled=i),c&32&&(e.checked=u[5]),c&4096&&r!==(r=u[12])&&p(s,"for",r)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function EA(n){let e,t,i,l,s,o=n[22].name+"",r,a,f,u,c;function d(){return n[14](n[22])}return{c(){e=b("input"),l=D(),s=b("label"),r=J(o),p(e,"type","checkbox"),p(e,"id",t=n[12]),e.checked=i=n[1][n[22].id],p(s,"for",a=n[12]),p(s,"title",f=n[22].name)},m(m,h){S(m,e,h),S(m,l,h),S(m,s,h),y(s,r),u||(c=Z(e,"change",d),u=!0)},p(m,h){n=m,h&4096&&t!==(t=n[12])&&p(e,"id",t),h&3&&i!==(i=n[1][n[22].id])&&(e.checked=i),h&1&&o!==(o=n[22].name+"")&&re(r,o),h&4096&&a!==(a=n[12])&&p(s,"for",a),h&1&&f!==(f=n[22].name)&&p(s,"title",f)},d(m){m&&(w(e),w(l),w(s)),u=!1,c()}}}function C_(n,e){let t,i,l,s;return i=new de({props:{class:"form-field",$$slots:{default:[EA,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=b("div"),B(i.$$.fragment),l=D(),p(t,"class","list-item list-item-collection"),this.first=t},m(o,r){S(o,t,r),z(i,t,null),y(t,l),s=!0},p(o,r){e=o;const a={};r&33558531&&(a.$$scope={dirty:r,ctx:e}),i.$set(a)},i(o){s||(I(i.$$.fragment,o),s=!0)},o(o){L(i.$$.fragment,o),s=!1},d(o){o&&w(t),V(i)}}}function IA(n){let e,t,i,l,s,o,r,a,f,u,c,d;const m=[MA,OA],h=[];function _(g,v){return g[4]?0:1}return u=_(n),c=h[u]=m[u](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[7]),r=D(),a=b("div"),f=b("div"),c.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","panel"),p(a,"class","wrapper")},m(g,v){S(g,e,v),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S(g,r,v),S(g,a,v),y(a,f),h[u].m(f,null),d=!0},p(g,v){(!d||v&128)&&re(o,g[7]);let $=u;u=_(g),u===$?h[u].p(g,v):(se(),L(h[$],1,1,()=>{h[$]=null}),oe(),c=h[u],c?c.p(g,v):(c=h[u]=m[u](g),c.c()),I(c,1),c.m(f,null))},i(g){d||(I(c),d=!0)},o(g){L(c),d=!1},d(g){g&&(w(e),w(r),w(a)),h[u].d()}}}function AA(n){let e,t,i,l;return e=new gi({}),i=new kn({props:{$$slots:{default:[IA]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,[o]){const r={};o&33554687&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}function LA(n,e,t){let i,l,s,o;We(n,At,N=>t(7,o=N)),en(At,o="Export collections",o);const r="export_"+H.randomString(5);let a,f=[],u={},c=!1;d();async function d(){t(4,c=!0);try{t(0,f=await fe.collections.getFullList({batch:100,$cancelKey:r})),t(0,f=H.sortCollections(f));for(let N of f)delete N.created,delete N.updated;v()}catch(N){fe.error(N)}t(4,c=!1)}function m(){H.downloadJson(Object.values(u),"pb_schema")}function h(){H.copyToClipboard(i),To("The configuration was copied to your clipboard!",3e3)}function _(){s?g():v()}function g(){t(1,u={})}function v(){t(1,u={});for(const N of f)t(1,u[N.id]=N,u)}function $(N){u[N.id]?delete u[N.id]:t(1,u[N.id]=N,u),t(1,u)}const C=()=>_(),T=N=>$(N),O=()=>h();function M(N){te[N?"unshift":"push"](()=>{a=N,t(3,a)})}const E=N=>{if(N.ctrlKey&&N.code==="KeyA"){N.preventDefault();const q=window.getSelection(),R=document.createRange();R.selectNodeContents(a),q.removeAllRanges(),q.addRange(R)}},A=()=>m();return n.$$.update=()=>{n.$$.dirty&2&&t(6,i=JSON.stringify(Object.values(u),null,4)),n.$$.dirty&2&&t(2,l=Object.keys(u).length),n.$$.dirty&5&&t(5,s=f.length&&l===f.length)},[f,u,l,a,c,s,i,o,m,h,_,$,r,C,T,O,M,E,A]}class NA extends be{constructor(e){super(),ge(this,e,LA,AA,he,{})}}function O_(n,e,t){const i=n.slice();return i[14]=e[t],i}function M_(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function D_(n,e,t){const i=n.slice();return i[14]=e[t],i}function E_(n,e,t){const i=n.slice();return i[17]=e[t][0],i[23]=e[t][1],i}function I_(n,e,t){const i=n.slice();return i[14]=e[t],i}function A_(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function L_(n,e,t){const i=n.slice();return i[30]=e[t],i}function PA(n){let e,t,i,l,s=n[1].name+"",o,r=n[9]&&N_(),a=n[0].name!==n[1].name&&P_(n);return{c(){e=b("div"),r&&r.c(),t=D(),a&&a.c(),i=D(),l=b("strong"),o=J(s),p(l,"class","txt"),p(e,"class","inline-flex fleg-gap-5")},m(f,u){S(f,e,u),r&&r.m(e,null),y(e,t),a&&a.m(e,null),y(e,i),y(e,l),y(l,o)},p(f,u){f[9]?r||(r=N_(),r.c(),r.m(e,t)):r&&(r.d(1),r=null),f[0].name!==f[1].name?a?a.p(f,u):(a=P_(f),a.c(),a.m(e,i)):a&&(a.d(1),a=null),u[0]&2&&s!==(s=f[1].name+"")&&re(o,s)},d(f){f&&w(e),r&&r.d(),a&&a.d()}}}function FA(n){var o;let e,t,i,l=((o=n[0])==null?void 0:o.name)+"",s;return{c(){e=b("span"),e.textContent="Deleted",t=D(),i=b("strong"),s=J(l),p(e,"class","label label-danger")},m(r,a){S(r,e,a),S(r,t,a),S(r,i,a),y(i,s)},p(r,a){var f;a[0]&1&&l!==(l=((f=r[0])==null?void 0:f.name)+"")&&re(s,l)},d(r){r&&(w(e),w(t),w(i))}}}function RA(n){var o;let e,t,i,l=((o=n[1])==null?void 0:o.name)+"",s;return{c(){e=b("span"),e.textContent="Added",t=D(),i=b("strong"),s=J(l),p(e,"class","label label-success")},m(r,a){S(r,e,a),S(r,t,a),S(r,i,a),y(i,s)},p(r,a){var f;a[0]&2&&l!==(l=((f=r[1])==null?void 0:f.name)+"")&&re(s,l)},d(r){r&&(w(e),w(t),w(i))}}}function N_(n){let e;return{c(){e=b("span"),e.textContent="Changed",p(e,"class","label label-warning")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function P_(n){let e,t=n[0].name+"",i,l,s;return{c(){e=b("strong"),i=J(t),l=D(),s=b("i"),p(e,"class","txt-strikethrough txt-hint"),p(s,"class","ri-arrow-right-line txt-sm")},m(o,r){S(o,e,r),y(e,i),S(o,l,r),S(o,s,r)},p(o,r){r[0]&1&&t!==(t=o[0].name+"")&&re(i,t)},d(o){o&&(w(e),w(l),w(s))}}}function F_(n){var h,_;let e,t,i,l,s,o,r=n[12]((h=n[0])==null?void 0:h[n[30]])+"",a,f,u,c,d=n[12]((_=n[1])==null?void 0:_[n[30]])+"",m;return{c(){var g,v,$,C,T,O;e=b("tr"),t=b("td"),i=b("span"),i.textContent=`${n[30]}`,l=D(),s=b("td"),o=b("pre"),a=J(r),f=D(),u=b("td"),c=b("pre"),m=J(d),p(t,"class","min-width svelte-lmkr38"),p(o,"class","txt"),p(s,"class","svelte-lmkr38"),ee(s,"changed-old-col",!n[10]&&_n((g=n[0])==null?void 0:g[n[30]],(v=n[1])==null?void 0:v[n[30]])),ee(s,"changed-none-col",n[10]),p(c,"class","txt"),p(u,"class","svelte-lmkr38"),ee(u,"changed-new-col",!n[5]&&_n(($=n[0])==null?void 0:$[n[30]],(C=n[1])==null?void 0:C[n[30]])),ee(u,"changed-none-col",n[5]),p(e,"class","svelte-lmkr38"),ee(e,"txt-primary",_n((T=n[0])==null?void 0:T[n[30]],(O=n[1])==null?void 0:O[n[30]]))},m(g,v){S(g,e,v),y(e,t),y(t,i),y(e,l),y(e,s),y(s,o),y(o,a),y(e,f),y(e,u),y(u,c),y(c,m)},p(g,v){var $,C,T,O,M,E,A,N;v[0]&1&&r!==(r=g[12](($=g[0])==null?void 0:$[g[30]])+"")&&re(a,r),v[0]&3075&&ee(s,"changed-old-col",!g[10]&&_n((C=g[0])==null?void 0:C[g[30]],(T=g[1])==null?void 0:T[g[30]])),v[0]&1024&&ee(s,"changed-none-col",g[10]),v[0]&2&&d!==(d=g[12]((O=g[1])==null?void 0:O[g[30]])+"")&&re(m,d),v[0]&2083&&ee(u,"changed-new-col",!g[5]&&_n((M=g[0])==null?void 0:M[g[30]],(E=g[1])==null?void 0:E[g[30]])),v[0]&32&&ee(u,"changed-none-col",g[5]),v[0]&2051&&ee(e,"txt-primary",_n((A=g[0])==null?void 0:A[g[30]],(N=g[1])==null?void 0:N[g[30]]))},d(g){g&&w(e)}}}function R_(n){let e,t=ce(n[6]),i=[];for(let l=0;l<t.length;l+=1)i[l]=j_(I_(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);S(l,e,s)},p(l,s){if(s[0]&4160){t=ce(l[6]);let o;for(o=0;o<t.length;o+=1){const r=I_(l,t,o);i[o]?i[o].p(r,s):(i[o]=j_(r),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},d(l){l&&w(e),rt(i,l)}}}function q_(n){let e,t,i=n[17]+"",l,s,o,r,a=n[12](n[18])+"",f,u,c,d;return{c(){e=b("tr"),t=b("td"),l=J(i),s=D(),o=b("td"),r=b("pre"),f=J(a),u=D(),c=b("td"),d=D(),p(t,"class","min-width field-key-col svelte-lmkr38"),p(r,"class","txt"),p(o,"class","changed-old-col svelte-lmkr38"),p(c,"class","changed-none-col svelte-lmkr38"),p(e,"class","txt-primary svelte-lmkr38")},m(m,h){S(m,e,h),y(e,t),y(t,l),y(e,s),y(e,o),y(o,r),y(r,f),y(e,u),y(e,c),y(e,d)},p(m,h){h[0]&64&&i!==(i=m[17]+"")&&re(l,i),h[0]&64&&a!==(a=m[12](m[18])+"")&&re(f,a)},d(m){m&&w(e)}}}function j_(n){let e,t,i,l,s=n[14].name+"",o,r,a,f,u,c,d,m=n[14].name+"",h,_,g,v,$=ce(Object.entries(n[14])),C=[];for(let T=0;T<$.length;T+=1)C[T]=q_(A_(n,$,T));return{c(){e=b("tr"),t=b("th"),i=b("span"),l=J("field: "),o=J(s),r=D(),a=b("span"),f=J("Deleted - "),u=b("small"),c=J("All stored data related to "),d=b("strong"),h=J(m),_=J(" will be deleted!"),g=D();for(let T=0;T<C.length;T+=1)C[T].c();v=ve(),p(i,"class","txt"),p(a,"class","label label-danger m-l-5 svelte-lmkr38"),p(t,"class","min-width svelte-lmkr38"),p(t,"colspan","3"),p(e,"class","svelte-lmkr38")},m(T,O){S(T,e,O),y(e,t),y(t,i),y(i,l),y(i,o),y(t,r),y(t,a),y(a,f),y(a,u),y(u,c),y(u,d),y(d,h),y(u,_),S(T,g,O);for(let M=0;M<C.length;M+=1)C[M]&&C[M].m(T,O);S(T,v,O)},p(T,O){if(O[0]&64&&s!==(s=T[14].name+"")&&re(o,s),O[0]&64&&m!==(m=T[14].name+"")&&re(h,m),O[0]&4160){$=ce(Object.entries(T[14]));let M;for(M=0;M<$.length;M+=1){const E=A_(T,$,M);C[M]?C[M].p(E,O):(C[M]=q_(E),C[M].c(),C[M].m(v.parentNode,v))}for(;M<C.length;M+=1)C[M].d(1);C.length=$.length}},d(T){T&&(w(e),w(g),w(v)),rt(C,T)}}}function H_(n){let e;return{c(){e=b("span"),e.textContent="Changed",p(e,"class","label label-warning m-l-5 svelte-lmkr38")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function z_(n){var _;let e,t,i=n[17]+"",l,s,o,r,a=n[12]((_=Ln(n[3],n[14].id))==null?void 0:_[n[17]])+"",f,u,c,d,m=n[12](n[23])+"",h;return{c(){var g,v,$;e=b("tr"),t=b("td"),l=J(i),s=D(),o=b("td"),r=b("pre"),f=J(a),u=D(),c=b("td"),d=b("pre"),h=J(m),p(t,"class","min-width field-key-col svelte-lmkr38"),p(r,"class","txt"),p(o,"class","svelte-lmkr38"),ee(o,"changed-old-col",_n((g=Ln(n[3],n[14].id))==null?void 0:g[n[17]],n[23])),p(d,"class","txt"),p(c,"class","svelte-lmkr38"),ee(c,"changed-new-col",_n((v=Ln(n[3],n[14].id))==null?void 0:v[n[17]],n[23])),p(e,"class","svelte-lmkr38"),ee(e,"txt-primary",_n(($=Ln(n[3],n[14].id))==null?void 0:$[n[17]],n[23]))},m(g,v){S(g,e,v),y(e,t),y(t,l),y(e,s),y(e,o),y(o,r),y(r,f),y(e,u),y(e,c),y(c,d),y(d,h)},p(g,v){var $,C,T,O;v[0]&128&&i!==(i=g[17]+"")&&re(l,i),v[0]&136&&a!==(a=g[12](($=Ln(g[3],g[14].id))==null?void 0:$[g[17]])+"")&&re(f,a),v[0]&136&&ee(o,"changed-old-col",_n((C=Ln(g[3],g[14].id))==null?void 0:C[g[17]],g[23])),v[0]&128&&m!==(m=g[12](g[23])+"")&&re(h,m),v[0]&136&&ee(c,"changed-new-col",_n((T=Ln(g[3],g[14].id))==null?void 0:T[g[17]],g[23])),v[0]&136&&ee(e,"txt-primary",_n((O=Ln(g[3],g[14].id))==null?void 0:O[g[17]],g[23]))},d(g){g&&w(e)}}}function V_(n){let e,t,i,l,s=n[14].name+"",o,r,a=_n(Ln(n[3],n[14].id),Ln(n[4],n[14].id)),f,u,c=a&&H_(),d=ce(Object.entries(n[14])),m=[];for(let h=0;h<d.length;h+=1)m[h]=z_(E_(n,d,h));return{c(){e=b("tr"),t=b("th"),i=b("span"),l=J("field: "),o=J(s),r=D(),c&&c.c(),f=D();for(let h=0;h<m.length;h+=1)m[h].c();u=ve(),p(i,"class","txt"),p(t,"class","min-width svelte-lmkr38"),p(t,"colspan","3"),p(e,"class","svelte-lmkr38")},m(h,_){S(h,e,_),y(e,t),y(t,i),y(i,l),y(i,o),y(t,r),c&&c.m(t,null),S(h,f,_);for(let g=0;g<m.length;g+=1)m[g]&&m[g].m(h,_);S(h,u,_)},p(h,_){if(_[0]&128&&s!==(s=h[14].name+"")&&re(o,s),_[0]&152&&(a=_n(Ln(h[3],h[14].id),Ln(h[4],h[14].id))),a?c||(c=H_(),c.c(),c.m(t,null)):c&&(c.d(1),c=null),_[0]&4232){d=ce(Object.entries(h[14]));let g;for(g=0;g<d.length;g+=1){const v=E_(h,d,g);m[g]?m[g].p(v,_):(m[g]=z_(v),m[g].c(),m[g].m(u.parentNode,u))}for(;g<m.length;g+=1)m[g].d(1);m.length=d.length}},d(h){h&&(w(e),w(f),w(u)),c&&c.d(),rt(m,h)}}}function B_(n){let e,t,i=n[17]+"",l,s,o,r,a,f,u=n[12](n[18])+"",c,d;return{c(){e=b("tr"),t=b("td"),l=J(i),s=D(),o=b("td"),r=D(),a=b("td"),f=b("pre"),c=J(u),d=D(),p(t,"class","min-width field-key-col svelte-lmkr38"),p(o,"class","changed-none-col svelte-lmkr38"),p(f,"class","txt"),p(a,"class","changed-new-col svelte-lmkr38"),p(e,"class","txt-primary svelte-lmkr38")},m(m,h){S(m,e,h),y(e,t),y(t,l),y(e,s),y(e,o),y(e,r),y(e,a),y(a,f),y(f,c),y(e,d)},p(m,h){h[0]&256&&i!==(i=m[17]+"")&&re(l,i),h[0]&256&&u!==(u=m[12](m[18])+"")&&re(c,u)},d(m){m&&w(e)}}}function U_(n){let e,t,i,l,s=n[14].name+"",o,r,a,f,u,c=ce(Object.entries(n[14])),d=[];for(let m=0;m<c.length;m+=1)d[m]=B_(M_(n,c,m));return{c(){e=b("tr"),t=b("th"),i=b("span"),l=J("field: "),o=J(s),r=D(),a=b("span"),a.textContent="Added",f=D();for(let m=0;m<d.length;m+=1)d[m].c();u=ve(),p(i,"class","txt"),p(a,"class","label label-success m-l-5 svelte-lmkr38"),p(t,"class","min-width svelte-lmkr38"),p(t,"colspan","3"),p(e,"class","svelte-lmkr38")},m(m,h){S(m,e,h),y(e,t),y(t,i),y(i,l),y(i,o),y(t,r),y(t,a),S(m,f,h);for(let _=0;_<d.length;_+=1)d[_]&&d[_].m(m,h);S(m,u,h)},p(m,h){if(h[0]&256&&s!==(s=m[14].name+"")&&re(o,s),h[0]&4352){c=ce(Object.entries(m[14]));let _;for(_=0;_<c.length;_+=1){const g=M_(m,c,_);d[_]?d[_].p(g,h):(d[_]=B_(g),d[_].c(),d[_].m(u.parentNode,u))}for(;_<d.length;_+=1)d[_].d(1);d.length=c.length}},d(m){m&&(w(e),w(f),w(u)),rt(d,m)}}}function qA(n){let e,t,i,l,s,o,r,a,f;function u(T,O){var M,E;return(M=T[0])!=null&&M.id?(E=T[1])!=null&&E.id?PA:FA:RA}let c=u(n),d=c(n),m=ce(n[11]),h=[];for(let T=0;T<m.length;T+=1)h[T]=F_(L_(n,m,T));let _=(n[2]||n[5])&&R_(n),g=ce(n[7]),v=[];for(let T=0;T<g.length;T+=1)v[T]=V_(D_(n,g,T));let $=ce(n[8]),C=[];for(let T=0;T<$.length;T+=1)C[T]=U_(O_(n,$,T));return{c(){e=b("div"),d.c(),t=D(),i=b("table"),l=b("thead"),l.innerHTML='<tr class="svelte-lmkr38"><th class="svelte-lmkr38">Props</th> <th width="10%" class="svelte-lmkr38">Old</th> <th width="10%" class="svelte-lmkr38">New</th></tr>',s=D(),o=b("tbody");for(let T=0;T<h.length;T+=1)h[T].c();r=D(),_&&_.c(),a=D();for(let T=0;T<v.length;T+=1)v[T].c();f=D();for(let T=0;T<C.length;T+=1)C[T].c();p(e,"class","section-title"),p(i,"class","table collections-diff-table m-b-base svelte-lmkr38")},m(T,O){S(T,e,O),d.m(e,null),S(T,t,O),S(T,i,O),y(i,l),y(i,s),y(i,o);for(let M=0;M<h.length;M+=1)h[M]&&h[M].m(o,null);y(o,r),_&&_.m(o,null),y(o,a);for(let M=0;M<v.length;M+=1)v[M]&&v[M].m(o,null);y(o,f);for(let M=0;M<C.length;M+=1)C[M]&&C[M].m(o,null)},p(T,O){if(c===(c=u(T))&&d?d.p(T,O):(d.d(1),d=c(T),d&&(d.c(),d.m(e,null))),O[0]&7203){m=ce(T[11]);let M;for(M=0;M<m.length;M+=1){const E=L_(T,m,M);h[M]?h[M].p(E,O):(h[M]=F_(E),h[M].c(),h[M].m(o,r))}for(;M<h.length;M+=1)h[M].d(1);h.length=m.length}if(T[2]||T[5]?_?_.p(T,O):(_=R_(T),_.c(),_.m(o,a)):_&&(_.d(1),_=null),O[0]&4248){g=ce(T[7]);let M;for(M=0;M<g.length;M+=1){const E=D_(T,g,M);v[M]?v[M].p(E,O):(v[M]=V_(E),v[M].c(),v[M].m(o,f))}for(;M<v.length;M+=1)v[M].d(1);v.length=g.length}if(O[0]&4352){$=ce(T[8]);let M;for(M=0;M<$.length;M+=1){const E=O_(T,$,M);C[M]?C[M].p(E,O):(C[M]=U_(E),C[M].c(),C[M].m(o,null))}for(;M<C.length;M+=1)C[M].d(1);C.length=$.length}},i:x,o:x,d(T){T&&(w(e),w(t),w(i)),d.d(),rt(h,T),_&&_.d(),rt(v,T),rt(C,T)}}}function Ln(n,e){n=n||[];for(let t of n)if(t.id==e)return t;return null}function _n(n,e){return n===e?!1:JSON.stringify(n)!==JSON.stringify(e)}function jA(n,e,t){let i,l,s,{collectionA:o=H.initCollection()}=e,{collectionB:r=H.initCollection()}=e,{deleteMissing:a=!1}=e,f=[],u=[],c=[],d=[],m=[];const h=Object.keys(H.initCollection()).filter(v=>!["schema","created","updated"].includes(v));function _(){t(4,u=Array.isArray(r==null?void 0:r.schema)?r==null?void 0:r.schema.concat():[]),a||t(4,u=u.concat(f.filter(v=>!u.find($=>v.id==$.id))))}function g(v){return typeof v>"u"?"":H.isObject(v)?JSON.stringify(v,null,4):v}return n.$$set=v=>{"collectionA"in v&&t(0,o=v.collectionA),"collectionB"in v&&t(1,r=v.collectionB),"deleteMissing"in v&&t(2,a=v.deleteMissing)},n.$$.update=()=>{n.$$.dirty[0]&2&&t(5,i=!(r!=null&&r.id)&&!(r!=null&&r.name)),n.$$.dirty[0]&33&&t(10,l=!i&&!(o!=null&&o.id)),n.$$.dirty[0]&1&&t(3,f=Array.isArray(o==null?void 0:o.schema)?o==null?void 0:o.schema.concat():[]),n.$$.dirty[0]&7&&(typeof(o==null?void 0:o.schema)<"u"||typeof(r==null?void 0:r.schema)<"u"||typeof a<"u")&&_(),n.$$.dirty[0]&24&&t(6,c=f.filter(v=>!u.find($=>v.id==$.id))),n.$$.dirty[0]&24&&t(7,d=u.filter(v=>f.find($=>$.id==v.id))),n.$$.dirty[0]&24&&t(8,m=u.filter(v=>!f.find($=>$.id==v.id))),n.$$.dirty[0]&7&&t(9,s=H.hasCollectionChanges(o,r,a))},[o,r,a,f,u,i,c,d,m,s,l,h,g]}class HA extends be{constructor(e){super(),ge(this,e,jA,qA,he,{collectionA:0,collectionB:1,deleteMissing:2},null,[-1,-1])}}function W_(n,e,t){const i=n.slice();return i[17]=e[t],i}function Y_(n){let e,t;return e=new HA({props:{collectionA:n[17].old,collectionB:n[17].new,deleteMissing:n[3]}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&4&&(s.collectionA=i[17].old),l&4&&(s.collectionB=i[17].new),l&8&&(s.deleteMissing=i[3]),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function zA(n){let e,t,i=ce(n[2]),l=[];for(let o=0;o<i.length;o+=1)l[o]=Y_(W_(n,i,o));const s=o=>L(l[o],1,1,()=>{l[o]=null});return{c(){for(let o=0;o<l.length;o+=1)l[o].c();e=ve()},m(o,r){for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(o,r);S(o,e,r),t=!0},p(o,r){if(r&12){i=ce(o[2]);let a;for(a=0;a<i.length;a+=1){const f=W_(o,i,a);l[a]?(l[a].p(f,r),I(l[a],1)):(l[a]=Y_(f),l[a].c(),I(l[a],1),l[a].m(e.parentNode,e))}for(se(),a=i.length;a<l.length;a+=1)s(a);oe()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)I(l[r]);t=!0}},o(o){l=l.filter(Boolean);for(let r=0;r<l.length;r+=1)L(l[r]);t=!1},d(o){o&&w(e),rt(l,o)}}}function VA(n){let e;return{c(){e=b("h4"),e.textContent="Side-by-side diff",p(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function BA(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=J("Close"),i=D(),l=b("button"),s=b("span"),s.textContent="Confirm and import",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-expanded"),l.disabled=n[4],ee(l,"btn-loading",n[4])},m(a,f){S(a,e,f),y(e,t),S(a,i,f),S(a,l,f),y(l,s),o||(r=[Z(e,"click",n[0]),Z(l,"click",n[9])],o=!0)},p(a,f){f&16&&(e.disabled=a[4]),f&16&&(l.disabled=a[4]),f&16&&ee(l,"btn-loading",a[4])},d(a){a&&(w(e),w(i),w(l)),o=!1,Te(r)}}}function UA(n){let e,t,i={class:"full-width-popup import-popup",overlayClose:!1,escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[BA],header:[VA],default:[zA]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.escClose=!l[4]),s&16&&(o.beforeHide=l[10]),s&1048604&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[11](null),V(e,l)}}}function WA(n,e,t){const i=st();let l,s=[],o=[],r=[],a=!1,f=!1;function u(T,O,M=!1){t(7,s=T),t(8,o=O),t(3,a=M),l==null||l.show()}function c(){return l==null?void 0:l.hide()}function d(){t(2,r=[]);for(const T of s){const O=H.findByKey(o,"id",T.id)||null;(a&&!(O!=null&&O.id)||O!=null&&O.id&&H.hasCollectionChanges(T,O,a))&&r.push({old:T,new:O})}for(const T of o){const O=H.findByKey(s,"id",T.id)||null;O!=null&&O.id||r.push({old:O,new:T})}}function m(){const T=[];if(a)for(const O of s){const M=H.findByKey(o,"id",O.id);if(!M)T.push(O.name+".*");else{const E=Array.isArray(O.schema)?O.schema:[];for(const A of E)H.findByKey(M.schema,"id",A.id)||T.push(`${O.name}.${A.name} (${A.id})`)}}T.length?un(`Do you really want to delete the following collection fields and their related records data:
- ${T.join(`
- `)}`,()=>{h()}):h()}async function h(){if(!f){t(4,f=!0);try{await fe.collections.import(o,a),Nt("Successfully imported collections configuration."),i("submit")}catch(T){fe.error(T)}t(4,f=!1),c()}}const _=()=>m(),g=()=>!f;function v(T){te[T?"unshift":"push"](()=>{l=T,t(1,l)})}function $(T){Oe.call(this,n,T)}function C(T){Oe.call(this,n,T)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(s)&&Array.isArray(o)&&d()},[c,l,r,a,f,m,u,s,o,_,g,v,$,C]}class YA extends be{constructor(e){super(),ge(this,e,WA,UA,he,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function K_(n,e,t){const i=n.slice();return i[33]=e[t],i}function J_(n,e,t){const i=n.slice();return i[36]=e[t],i}function Z_(n,e,t){const i=n.slice();return i[33]=e[t],i}function KA(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E,A;a=new de({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[ZA,({uniqueId:U})=>({41:U}),({uniqueId:U})=>[0,U?1024:0]]},$$scope:{ctx:n}}});let N=n[1].length&&X_(n),q=!1,R=n[6]&&n[1].length&&!n[7]&&Q_(),P=n[6]&&n[1].length&&n[7]&&x_(n),F=n[13].length&&ug(n),j=!!n[0]&&cg(n);return{c(){e=b("input"),t=D(),i=b("div"),l=b("p"),s=J(`Paste below the collections configuration you want to import or
`),o=b("button"),o.innerHTML='<span class="txt">Load from JSON file</span>',r=D(),B(a.$$.fragment),f=D(),N&&N.c(),u=D(),c=D(),R&&R.c(),d=D(),P&&P.c(),m=D(),F&&F.c(),h=D(),_=b("div"),j&&j.c(),g=D(),v=b("div"),$=D(),C=b("button"),T=b("span"),T.textContent="Review",p(e,"type","file"),p(e,"class","hidden"),p(e,"accept",".json"),p(o,"class","btn btn-outline btn-sm m-l-5"),ee(o,"btn-loading",n[12]),p(i,"class","content txt-xl m-b-base"),p(v,"class","flex-fill"),p(T,"class","txt"),p(C,"type","button"),p(C,"class","btn btn-expanded btn-warning m-l-auto"),C.disabled=O=!n[14],p(_,"class","flex m-t-base")},m(U,Y){S(U,e,Y),n[21](e),S(U,t,Y),S(U,i,Y),y(i,l),y(l,s),y(l,o),S(U,r,Y),z(a,U,Y),S(U,f,Y),N&&N.m(U,Y),S(U,u,Y),S(U,c,Y),R&&R.m(U,Y),S(U,d,Y),P&&P.m(U,Y),S(U,m,Y),F&&F.m(U,Y),S(U,h,Y),S(U,_,Y),j&&j.m(_,null),y(_,g),y(_,v),y(_,$),y(_,C),y(C,T),M=!0,E||(A=[Z(e,"change",n[22]),Z(o,"click",n[23]),Z(C,"click",n[19])],E=!0)},p(U,Y){(!M||Y[0]&4096)&&ee(o,"btn-loading",U[12]);const X={};Y[0]&64&&(X.class="form-field "+(U[6]?"":"field-error")),Y[0]&65|Y[1]&3072&&(X.$$scope={dirty:Y,ctx:U}),a.$set(X),U[1].length?N?(N.p(U,Y),Y[0]&2&&I(N,1)):(N=X_(U),N.c(),I(N,1),N.m(u.parentNode,u)):N&&(se(),L(N,1,1,()=>{N=null}),oe()),U[6]&&U[1].length&&!U[7]?R||(R=Q_(),R.c(),R.m(d.parentNode,d)):R&&(R.d(1),R=null),U[6]&&U[1].length&&U[7]?P?P.p(U,Y):(P=x_(U),P.c(),P.m(m.parentNode,m)):P&&(P.d(1),P=null),U[13].length?F?F.p(U,Y):(F=ug(U),F.c(),F.m(h.parentNode,h)):F&&(F.d(1),F=null),U[0]?j?j.p(U,Y):(j=cg(U),j.c(),j.m(_,g)):j&&(j.d(1),j=null),(!M||Y[0]&16384&&O!==(O=!U[14]))&&(C.disabled=O)},i(U){M||(I(a.$$.fragment,U),I(N),I(q),M=!0)},o(U){L(a.$$.fragment,U),L(N),L(q),M=!1},d(U){U&&(w(e),w(t),w(i),w(r),w(f),w(u),w(c),w(d),w(m),w(h),w(_)),n[21](null),V(a,U),N&&N.d(U),R&&R.d(U),P&&P.d(U),F&&F.d(U),j&&j.d(),E=!1,Te(A)}}}function JA(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){S(t,e,i)},p:x,i:x,o:x,d(t){t&&w(e)}}}function G_(n){let e;return{c(){e=b("div"),e.textContent="Invalid collections configuration.",p(e,"class","help-block help-block-error")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function ZA(n){let e,t,i,l,s,o,r,a,f,u,c=!!n[0]&&!n[6]&&G_();return{c(){e=b("label"),t=J("Collections"),l=D(),s=b("textarea"),r=D(),c&&c.c(),a=ve(),p(e,"for",i=n[41]),p(e,"class","p-b-10"),p(s,"id",o=n[41]),p(s,"class","code"),p(s,"spellcheck","false"),p(s,"rows","15"),s.required=!0},m(d,m){S(d,e,m),y(e,t),S(d,l,m),S(d,s,m),ae(s,n[0]),S(d,r,m),c&&c.m(d,m),S(d,a,m),f||(u=Z(s,"input",n[24]),f=!0)},p(d,m){m[1]&1024&&i!==(i=d[41])&&p(e,"for",i),m[1]&1024&&o!==(o=d[41])&&p(s,"id",o),m[0]&1&&ae(s,d[0]),d[0]&&!d[6]?c||(c=G_(),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(d){d&&(w(e),w(l),w(s),w(r),w(a)),c&&c.d(d),f=!1,u()}}}function X_(n){let e,t;return e=new de({props:{class:"form-field form-field-toggle",$$slots:{default:[GA,({uniqueId:i})=>({41:i}),({uniqueId:i})=>[0,i?1024:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l[0]&96|l[1]&3072&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(I(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function GA(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("input"),l=D(),s=b("label"),o=J("Merge with the existing collections"),p(e,"type","checkbox"),p(e,"id",t=n[41]),e.disabled=i=!n[6],p(s,"for",r=n[41])},m(u,c){S(u,e,c),e.checked=n[5],S(u,l,c),S(u,s,c),y(s,o),a||(f=Z(e,"change",n[25]),a=!0)},p(u,c){c[1]&1024&&t!==(t=u[41])&&p(e,"id",t),c[0]&64&&i!==(i=!u[6])&&(e.disabled=i),c[0]&32&&(e.checked=u[5]),c[1]&1024&&r!==(r=u[41])&&p(s,"for",r)},d(u){u&&(w(e),w(l),w(s)),a=!1,f()}}}function Q_(n){let e;return{c(){e=b("div"),e.innerHTML='<div class="icon"><i class="ri-information-line"></i></div> <div class="content"><string>Your collections configuration is already up-to-date!</string></div>',p(e,"class","alert alert-info")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function x_(n){let e,t,i,l,s,o=n[9].length&&eg(n),r=n[3].length&&ig(n),a=n[8].length&&rg(n);return{c(){e=b("h5"),e.textContent="Detected changes",t=D(),i=b("div"),o&&o.c(),l=D(),r&&r.c(),s=D(),a&&a.c(),p(e,"class","section-title"),p(i,"class","list")},m(f,u){S(f,e,u),S(f,t,u),S(f,i,u),o&&o.m(i,null),y(i,l),r&&r.m(i,null),y(i,s),a&&a.m(i,null)},p(f,u){f[9].length?o?o.p(f,u):(o=eg(f),o.c(),o.m(i,l)):o&&(o.d(1),o=null),f[3].length?r?r.p(f,u):(r=ig(f),r.c(),r.m(i,s)):r&&(r.d(1),r=null),f[8].length?a?a.p(f,u):(a=rg(f),a.c(),a.m(i,null)):a&&(a.d(1),a=null)},d(f){f&&(w(e),w(t),w(i)),o&&o.d(),r&&r.d(),a&&a.d()}}}function eg(n){let e=[],t=new Map,i,l=ce(n[9]);const s=o=>o[33].id;for(let o=0;o<l.length;o+=1){let r=Z_(n,l,o),a=s(r);t.set(a,e[o]=ng(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=ve()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&512&&(l=ce(o[9]),e=ft(e,r,s,1,o,l,t,i.parentNode,Ai,ng,i,Z_))},d(o){o&&w(i);for(let r=0;r<e.length;r+=1)e[r].d(o)}}}function tg(n){let e,t=n[33].id+"",i;return{c(){e=b("small"),i=J(t),p(e,"class","txt-hint")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s[0]&512&&t!==(t=l[33].id+"")&&re(i,t)},d(l){l&&w(e)}}}function ng(n,e){let t,i,l,s,o,r=e[33].name+"",a,f,u,c=e[33].id&&tg(e);return{key:n,first:null,c(){t=b("div"),i=b("span"),i.textContent="Deleted",l=D(),s=b("div"),o=b("strong"),a=J(r),f=D(),c&&c.c(),u=D(),p(i,"class","label label-danger list-label svelte-1jx20fl"),p(s,"class","inline-flex flex-gap-5"),p(t,"class","list-item"),this.first=t},m(d,m){S(d,t,m),y(t,i),y(t,l),y(t,s),y(s,o),y(o,a),y(s,f),c&&c.m(s,null),y(t,u)},p(d,m){e=d,m[0]&512&&r!==(r=e[33].name+"")&&re(a,r),e[33].id?c?c.p(e,m):(c=tg(e),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},d(d){d&&w(t),c&&c.d()}}}function ig(n){let e=[],t=new Map,i,l=ce(n[3]);const s=o=>o[36].old.id+o[36].new.id;for(let o=0;o<l.length;o+=1){let r=J_(n,l,o),a=s(r);t.set(a,e[o]=og(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=ve()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&8&&(l=ce(o[3]),e=ft(e,r,s,1,o,l,t,i.parentNode,Ai,og,i,J_))},d(o){o&&w(i);for(let r=0;r<e.length;r+=1)e[r].d(o)}}}function lg(n){let e,t=n[36].old.name+"",i,l,s;return{c(){e=b("strong"),i=J(t),l=D(),s=b("i"),p(e,"class","txt-strikethrough txt-hint"),p(s,"class","ri-arrow-right-line txt-sm")},m(o,r){S(o,e,r),y(e,i),S(o,l,r),S(o,s,r)},p(o,r){r[0]&8&&t!==(t=o[36].old.name+"")&&re(i,t)},d(o){o&&(w(e),w(l),w(s))}}}function sg(n){let e,t=n[36].new.id+"",i;return{c(){e=b("small"),i=J(t),p(e,"class","txt-hint")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s[0]&8&&t!==(t=l[36].new.id+"")&&re(i,t)},d(l){l&&w(e)}}}function og(n,e){let t,i,l,s,o,r,a=e[36].new.name+"",f,u,c,d=e[36].old.name!==e[36].new.name&&lg(e),m=e[36].new.id&&sg(e);return{key:n,first:null,c(){t=b("div"),i=b("span"),i.textContent="Changed",l=D(),s=b("div"),d&&d.c(),o=D(),r=b("strong"),f=J(a),u=D(),m&&m.c(),c=D(),p(i,"class","label label-warning list-label svelte-1jx20fl"),p(s,"class","inline-flex flex-gap-5"),p(t,"class","list-item"),this.first=t},m(h,_){S(h,t,_),y(t,i),y(t,l),y(t,s),d&&d.m(s,null),y(s,o),y(s,r),y(r,f),y(s,u),m&&m.m(s,null),y(t,c)},p(h,_){e=h,e[36].old.name!==e[36].new.name?d?d.p(e,_):(d=lg(e),d.c(),d.m(s,o)):d&&(d.d(1),d=null),_[0]&8&&a!==(a=e[36].new.name+"")&&re(f,a),e[36].new.id?m?m.p(e,_):(m=sg(e),m.c(),m.m(s,null)):m&&(m.d(1),m=null)},d(h){h&&w(t),d&&d.d(),m&&m.d()}}}function rg(n){let e=[],t=new Map,i,l=ce(n[8]);const s=o=>o[33].id;for(let o=0;o<l.length;o+=1){let r=K_(n,l,o),a=s(r);t.set(a,e[o]=fg(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=ve()},m(o,r){for(let a=0;a<e.length;a+=1)e[a]&&e[a].m(o,r);S(o,i,r)},p(o,r){r[0]&256&&(l=ce(o[8]),e=ft(e,r,s,1,o,l,t,i.parentNode,Ai,fg,i,K_))},d(o){o&&w(i);for(let r=0;r<e.length;r+=1)e[r].d(o)}}}function ag(n){let e,t=n[33].id+"",i;return{c(){e=b("small"),i=J(t),p(e,"class","txt-hint")},m(l,s){S(l,e,s),y(e,i)},p(l,s){s[0]&256&&t!==(t=l[33].id+"")&&re(i,t)},d(l){l&&w(e)}}}function fg(n,e){let t,i,l,s,o,r=e[33].name+"",a,f,u,c=e[33].id&&ag(e);return{key:n,first:null,c(){t=b("div"),i=b("span"),i.textContent="Added",l=D(),s=b("div"),o=b("strong"),a=J(r),f=D(),c&&c.c(),u=D(),p(i,"class","label label-success list-label svelte-1jx20fl"),p(s,"class","inline-flex flex-gap-5"),p(t,"class","list-item"),this.first=t},m(d,m){S(d,t,m),y(t,i),y(t,l),y(t,s),y(s,o),y(o,a),y(s,f),c&&c.m(s,null),y(t,u)},p(d,m){e=d,m[0]&256&&r!==(r=e[33].name+"")&&re(a,r),e[33].id?c?c.p(e,m):(c=ag(e),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},d(d){d&&w(t),c&&c.d()}}}function ug(n){let e,t,i,l,s,o,r,a;return{c(){e=b("div"),t=b("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=D(),l=b("div"),l.innerHTML=`<string>Some of the imported collections share the same name and/or fields but are
imported with different IDs. You can replace them in the import if you want
to.</string>`,s=D(),o=b("button"),o.innerHTML='<span class="txt">Replace with original ids</span>',p(t,"class","icon"),p(l,"class","content"),p(o,"type","button"),p(o,"class","btn btn-warning btn-sm btn-outline"),p(e,"class","alert alert-warning m-t-base")},m(f,u){S(f,e,u),y(e,t),y(e,i),y(e,l),y(e,s),y(e,o),r||(a=Z(o,"click",n[27]),r=!0)},p:x,d(f){f&&w(e),r=!1,a()}}}function cg(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='<span class="txt">Clear</span>',p(e,"type","button"),p(e,"class","btn btn-transparent link-hint")},m(l,s){S(l,e,s),t||(i=Z(e,"click",n[28]),t=!0)},p:x,d(l){l&&w(e),t=!1,i()}}}function XA(n){let e,t,i,l,s,o,r,a,f,u,c,d;const m=[JA,KA],h=[];function _(g,v){return g[4]?0:1}return u=_(n),c=h[u]=m[u](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[15]),r=D(),a=b("div"),f=b("div"),c.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","panel"),p(a,"class","wrapper")},m(g,v){S(g,e,v),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S(g,r,v),S(g,a,v),y(a,f),h[u].m(f,null),d=!0},p(g,v){(!d||v[0]&32768)&&re(o,g[15]);let $=u;u=_(g),u===$?h[u].p(g,v):(se(),L(h[$],1,1,()=>{h[$]=null}),oe(),c=h[u],c?c.p(g,v):(c=h[u]=m[u](g),c.c()),I(c,1),c.m(f,null))},i(g){d||(I(c),d=!0)},o(g){L(c),d=!1},d(g){g&&(w(e),w(r),w(a)),h[u].d()}}}function QA(n){let e,t,i,l,s,o;e=new gi({}),i=new kn({props:{$$slots:{default:[XA]},$$scope:{ctx:n}}});let r={};return s=new YA({props:r}),n[29](s),s.$on("submit",n[18]),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment),l=D(),B(s.$$.fragment)},m(a,f){z(e,a,f),S(a,t,f),z(i,a,f),S(a,l,f),z(s,a,f),o=!0},p(a,f){const u={};f[0]&63487|f[1]&2048&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};s.$set(c)},i(a){o||(I(e.$$.fragment,a),I(i.$$.fragment,a),I(s.$$.fragment,a),o=!0)},o(a){L(e.$$.fragment,a),L(i.$$.fragment,a),L(s.$$.fragment,a),o=!1},d(a){a&&(w(t),w(l)),V(e,a),V(i,a),n[29](null),V(s,a)}}}function xA(n,e,t){let i,l,s,o,r,a,f;We(n,At,le=>t(15,f=le)),en(At,f="Import collections",f);let u,c,d="",m=!1,h=[],_=[],g=!0,v=[],$=!1,C=!1;T();async function T(){t(4,$=!0);try{t(20,_=await fe.collections.getFullList(200));for(let le of _)delete le.created,delete le.updated}catch(le){fe.error(le)}t(4,$=!1)}function O(){if(t(3,v=[]),!!i)for(let le of h){const ne=H.findByKey(_,"id",le.id);!(ne!=null&&ne.id)||!H.hasCollectionChanges(ne,le,g)||v.push({new:le,old:ne})}}function M(){t(1,h=[]);try{t(1,h=JSON.parse(d))}catch{}Array.isArray(h)?t(1,h=H.filterDuplicatesByKey(h)):t(1,h=[]);for(let le of h)delete le.created,delete le.updated,le.schema=H.filterDuplicatesByKey(le.schema)}function E(){var le,ne;for(let me of h){const Pe=H.findByKey(_,"name",me.name)||H.findByKey(_,"id",me.id);if(!Pe)continue;const ze=me.id,Qe=Pe.id;me.id=Qe;const et=Array.isArray(Pe.schema)?Pe.schema:[],Dt=Array.isArray(me.schema)?me.schema:[];for(const ut of Dt){const ht=H.findByKey(et,"name",ut.name);ht&&ht.id&&(ut.id=ht.id)}for(let ut of h)if(Array.isArray(ut.schema))for(let ht of ut.schema)(le=ht.options)!=null&&le.collectionId&&((ne=ht.options)==null?void 0:ne.collectionId)===ze&&(ht.options.collectionId=Qe)}t(0,d=JSON.stringify(h,null,4))}function A(le){t(12,m=!0);const ne=new FileReader;ne.onload=async me=>{t(12,m=!1),t(10,u.value="",u),t(0,d=me.target.result),await xt(),h.length||(li("Invalid collections configuration."),N())},ne.onerror=me=>{console.warn(me),li("Failed to load the imported JSON."),t(12,m=!1),t(10,u.value="",u)},ne.readAsText(le)}function N(){t(0,d=""),t(10,u.value="",u),Gt({})}function q(){const le=C?H.filterDuplicatesByKey(_.concat(h)):h;c==null||c.show(_,le,g)}function R(le){te[le?"unshift":"push"](()=>{u=le,t(10,u)})}const P=()=>{u.files.length&&A(u.files[0])},F=()=>{u.click()};function j(){d=this.value,t(0,d)}function U(){C=this.checked,t(5,C)}function Y(){g=this.checked,t(2,g)}const X=()=>E(),W=()=>N();function K(le){te[le?"unshift":"push"](()=>{c=le,t(11,c)})}return n.$$.update=()=>{n.$$.dirty[0]&33&&typeof d<"u"&&C!==null&&M(),n.$$.dirty[0]&3&&t(6,i=!!d&&h.length&&h.length===h.filter(le=>!!le.id&&!!le.name).length),n.$$.dirty[0]&1048678&&t(9,l=_.filter(le=>i&&!C&&g&&!H.findByKey(h,"id",le.id))),n.$$.dirty[0]&1048642&&t(8,s=h.filter(le=>i&&!H.findByKey(_,"id",le.id))),n.$$.dirty[0]&6&&(typeof h<"u"||typeof g<"u")&&O(),n.$$.dirty[0]&777&&t(7,o=!!d&&(l.length||s.length||v.length)),n.$$.dirty[0]&208&&t(14,r=!$&&i&&o),n.$$.dirty[0]&1048578&&t(13,a=h.filter(le=>{let ne=H.findByKey(_,"name",le.name)||H.findByKey(_,"id",le.id);if(!ne)return!1;if(ne.id!=le.id)return!0;const me=Array.isArray(ne.schema)?ne.schema:[],Pe=Array.isArray(le.schema)?le.schema:[];for(const ze of Pe){if(H.findByKey(me,"id",ze.id))continue;const et=H.findByKey(me,"name",ze.name);if(et&&ze.id!=et.id)return!0}return!1}))},[d,h,g,v,$,C,i,o,s,l,u,c,m,a,r,f,E,A,N,q,_,R,P,F,j,U,Y,X,W,K]}class e7 extends be{constructor(e){super(),ge(this,e,xA,QA,he,{},null,[-1,-1])}}function t7(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=J("Backup name"),l=D(),s=b("input"),r=D(),a=b("em"),a.textContent="Must be in the format [a-z0-9_-].zip",p(e,"for",i=n[15]),p(s,"type","text"),p(s,"id",o=n[15]),p(s,"placeholder","Leave empty to autogenerate"),p(s,"pattern","^[a-z0-9_-]+\\.zip$"),p(a,"class","help-block")},m(c,d){S(c,e,d),y(e,t),S(c,l,d),S(c,s,d),ae(s,n[2]),S(c,r,d),S(c,a,d),f||(u=Z(s,"input",n[7]),f=!0)},p(c,d){d&32768&&i!==(i=c[15])&&p(e,"for",i),d&32768&&o!==(o=c[15])&&p(s,"id",o),d&4&&s.value!==c[2]&&ae(s,c[2])},d(c){c&&(w(e),w(l),w(s),w(r),w(a)),f=!1,u()}}}function n7(n){let e,t,i,l,s,o,r;return l=new de({props:{class:"form-field m-0",name:"name",$$slots:{default:[t7,({uniqueId:a})=>({15:a}),({uniqueId:a})=>a?32768:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),e.innerHTML=`<div class="icon"><i class="ri-information-line"></i></div> <div class="content"><p>Please note that during the backup other concurrent write requests may fail since the
database will be temporary &quot;locked&quot; (this usually happens only during the ZIP generation).</p> <p class="txt-bold">If you are using S3 storage for the collections file upload, you&#39;ll have to backup them
separately since they are not locally stored and will not be included in the final backup!</p></div>`,t=D(),i=b("form"),B(l.$$.fragment),p(e,"class","alert alert-info"),p(i,"id",n[4]),p(i,"autocomplete","off")},m(a,f){S(a,e,f),S(a,t,f),S(a,i,f),z(l,i,null),s=!0,o||(r=Z(i,"submit",Ue(n[5])),o=!0)},p(a,f){const u={};f&98308&&(u.$$scope={dirty:f,ctx:a}),l.$set(u)},i(a){s||(I(l.$$.fragment,a),s=!0)},o(a){L(l.$$.fragment,a),s=!1},d(a){a&&(w(e),w(t),w(i)),V(l),o=!1,r()}}}function i7(n){let e;return{c(){e=b("h4"),e.textContent="Initialize new backup",p(e,"class","center txt-break")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function l7(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=D(),l=b("button"),s=b("span"),s.textContent="Start backup",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[4]),p(l,"class","btn btn-expanded"),l.disabled=n[3],ee(l,"btn-loading",n[3])},m(a,f){S(a,e,f),y(e,t),S(a,i,f),S(a,l,f),y(l,s),o||(r=Z(e,"click",n[0]),o=!0)},p(a,f){f&8&&(e.disabled=a[3]),f&8&&(l.disabled=a[3]),f&8&&ee(l,"btn-loading",a[3])},d(a){a&&(w(e),w(i),w(l)),o=!1,r()}}}function s7(n){let e,t,i={class:"backup-create-panel",beforeOpen:n[8],beforeHide:n[9],popup:!0,$$slots:{footer:[l7],header:[i7],default:[n7]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[10](e),e.$on("show",n[11]),e.$on("hide",n[12]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&8&&(o.beforeOpen=l[8]),s&8&&(o.beforeHide=l[9]),s&65548&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[10](null),V(e,l)}}}function o7(n,e,t){const i=st(),l="backup_create_"+H.randomString(5);let s,o="",r=!1,a;function f($){Gt({}),t(3,r=!1),t(2,o=$||""),s==null||s.show()}function u(){return s==null?void 0:s.hide()}async function c(){if(!r){t(3,r=!0),clearTimeout(a),a=setTimeout(()=>{u()},1500);try{await fe.backups.create(o,{$cancelKey:l}),t(3,r=!1),u(),i("submit"),Nt("Successfully generated new backup.")}catch($){$.isAbort||fe.error($)}clearTimeout(a),t(3,r=!1)}}ys(()=>{clearTimeout(a)});function d(){o=this.value,t(2,o)}const m=()=>r?(To("A backup has already been started, please wait."),!1):!0,h=()=>(r&&To("The backup was started but may take a while to complete. You can come back later.",4500),!0);function _($){te[$?"unshift":"push"](()=>{s=$,t(1,s)})}function g($){Oe.call(this,n,$)}function v($){Oe.call(this,n,$)}return[u,s,o,r,l,c,f,d,m,h,_,g,v]}class r7 extends be{constructor(e){super(),ge(this,e,o7,s7,he,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function a7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Backup name"),l=D(),s=b("input"),p(e,"for",i=n[15]),p(s,"type","text"),p(s,"id",o=n[15]),s.required=!0},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[2]),r||(a=Z(s,"input",n[9]),r=!0)},p(f,u){u&32768&&i!==(i=f[15])&&p(e,"for",i),u&32768&&o!==(o=f[15])&&p(s,"id",o),u&4&&s.value!==f[2]&&ae(s,f[2])},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function f7(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;return f=new ol({props:{value:n[1]}}),m=new de({props:{class:"form-field required m-0",name:"name",$$slots:{default:[a7,({uniqueId:v})=>({15:v}),({uniqueId:v})=>v?32768:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),e.innerHTML=`<div class="icon"><i class="ri-alert-line"></i></div> <div class="content"><p class="txt-bold">Please proceed with caution and use it only with trusted backups!</p> <p>Backup restore is experimental and works only on UNIX based systems.</p> <p>The restore operation will attempt to replace your existing <code>pb_data</code> with the one from
the backup and will restart the application process.</p> <p>This means that on success all of your data (including app settings, users, admins, etc.) will
be replaced with the ones from the backup.</p> <p>Nothing will happen if the backup is invalid or incompatible (ex. missing
<code>data.db</code> file).</p></div>`,t=D(),i=b("div"),l=J(`Type the backup name
`),s=b("div"),o=b("span"),r=J(n[1]),a=D(),B(f.$$.fragment),u=J(`
to confirm:`),c=D(),d=b("form"),B(m.$$.fragment),p(e,"class","alert alert-danger"),p(o,"class","txt"),p(s,"class","label"),p(i,"class","content m-b-xs"),p(d,"id",n[6]),p(d,"autocomplete","off")},m(v,$){S(v,e,$),S(v,t,$),S(v,i,$),y(i,l),y(i,s),y(s,o),y(o,r),y(s,a),z(f,s,null),y(i,u),S(v,c,$),S(v,d,$),z(m,d,null),h=!0,_||(g=Z(d,"submit",Ue(n[7])),_=!0)},p(v,$){(!h||$&2)&&re(r,v[1]);const C={};$&2&&(C.value=v[1]),f.$set(C);const T={};$&98308&&(T.$$scope={dirty:$,ctx:v}),m.$set(T)},i(v){h||(I(f.$$.fragment,v),I(m.$$.fragment,v),h=!0)},o(v){L(f.$$.fragment,v),L(m.$$.fragment,v),h=!1},d(v){v&&(w(e),w(t),w(i),w(c),w(d)),V(f),V(m),_=!1,g()}}}function u7(n){let e,t,i,l;return{c(){e=b("h4"),t=J("Restore "),i=b("strong"),l=J(n[1]),p(e,"class","popup-title txt-ellipsis svelte-1fcgldh")},m(s,o){S(s,e,o),y(e,t),y(e,i),y(i,l)},p(s,o){o&2&&re(l,s[1])},d(s){s&&w(e)}}}function c7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=J("Cancel"),i=D(),l=b("button"),s=b("span"),s.textContent="Restore backup",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[4],ee(l,"btn-loading",n[4])},m(f,u){S(f,e,u),y(e,t),S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"click",n[0]),r=!0)},p(f,u){u&16&&(e.disabled=f[4]),u&48&&o!==(o=!f[5]||f[4])&&(l.disabled=o),u&16&&ee(l,"btn-loading",f[4])},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function d7(n){let e,t,i={class:"backup-restore-panel",overlayClose:!n[4],escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[c7],header:[u7],default:[f7]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.overlayClose=!l[4]),s&16&&(o.escClose=!l[4]),s&16&&(o.beforeHide=l[10]),s&65590&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[11](null),V(e,l)}}}function p7(n,e,t){let i;const l="backup_restore_"+H.randomString(5);let s,o="",r="",a=!1,f=null;function u($){Gt({}),t(2,r=""),t(1,o=$),t(4,a=!1),s==null||s.show()}function c(){return s==null?void 0:s.hide()}async function d(){var $;if(!(!i||a)){clearTimeout(f),t(4,a=!0);try{await fe.backups.restore(o),f=setTimeout(()=>{window.location.reload()},2e3)}catch(C){clearTimeout(f),C!=null&&C.isAbort||(t(4,a=!1),li((($=C.response)==null?void 0:$.message)||C.message))}}}ys(()=>{clearTimeout(f)});function m(){r=this.value,t(2,r)}const h=()=>!a;function _($){te[$?"unshift":"push"](()=>{s=$,t(3,s)})}function g($){Oe.call(this,n,$)}function v($){Oe.call(this,n,$)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=r!=""&&o==r)},[c,o,r,s,a,i,l,d,u,m,h,_,g,v]}class m7 extends be{constructor(e){super(),ge(this,e,p7,d7,he,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function dg(n,e,t){const i=n.slice();return i[22]=e[t],i}function pg(n,e,t){const i=n.slice();return i[19]=e[t],i}function h7(n){let e=[],t=new Map,i,l,s=ce(n[3]);const o=a=>a[22].key;for(let a=0;a<s.length;a+=1){let f=dg(n,s,a),u=o(f);t.set(u,e[a]=hg(u,f))}let r=null;return s.length||(r=mg()),{c(){for(let a=0;a<e.length;a+=1)e[a].c();i=ve(),r&&r.c()},m(a,f){for(let u=0;u<e.length;u+=1)e[u]&&e[u].m(a,f);S(a,i,f),r&&r.m(a,f),l=!0},p(a,f){f&876&&(s=ce(a[3]),se(),e=ft(e,f,o,1,a,s,t,i.parentNode,It,hg,i,dg),oe(),!s.length&&r?r.p(a,f):s.length?r&&(r.d(1),r=null):(r=mg(),r.c(),r.m(i.parentNode,i)))},i(a){if(!l){for(let f=0;f<s.length;f+=1)I(e[f]);l=!0}},o(a){for(let f=0;f<e.length;f+=1)L(e[f]);l=!1},d(a){a&&w(i);for(let f=0;f<e.length;f+=1)e[f].d(a);r&&r.d(a)}}}function _7(n){let e,t=ce(Array(n[3].length||1)),i=[];for(let l=0;l<t.length;l+=1)i[l]=_g(pg(n,t,l));return{c(){for(let l=0;l<i.length;l+=1)i[l].c();e=ve()},m(l,s){for(let o=0;o<i.length;o+=1)i[o]&&i[o].m(l,s);S(l,e,s)},p(l,s){if(s&8){t=ce(Array(l[3].length||1));let o;for(o=0;o<t.length;o+=1){const r=pg(l,t,o);i[o]?i[o].p(r,s):(i[o]=_g(),i[o].c(),i[o].m(e.parentNode,e))}for(;o<i.length;o+=1)i[o].d(1);i.length=t.length}},i:x,o:x,d(l){l&&w(e),rt(i,l)}}}function mg(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="txt">No backups yet.</span> ',p(e,"class","list-item list-item-placeholder svelte-1ulbkf5")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function hg(n,e){let t,i,l,s,o,r=e[22].key+"",a,f,u,c,d,m=H.formattedFileSize(e[22].size)+"",h,_,g,v,$,C,T,O,M,E,A,N,q,R,P,F,j,U,Y,X;function W(){return e[10](e[22])}function K(){return e[11](e[22])}function le(){return e[12](e[22])}return{key:n,first:null,c(){t=b("div"),i=b("i"),l=D(),s=b("div"),o=b("span"),a=J(r),u=D(),c=b("span"),d=J("("),h=J(m),_=J(")"),g=D(),v=b("div"),$=b("button"),C=b("i"),O=D(),M=b("button"),E=b("i"),N=D(),q=b("button"),R=b("i"),F=D(),p(i,"class","ri-folder-zip-line"),p(o,"class","name backup-name svelte-1ulbkf5"),p(o,"title",f=e[22].key),p(c,"class","size txt-hint txt-nowrap"),p(s,"class","content"),p(C,"class","ri-download-line"),p($,"type","button"),p($,"class","btn btn-sm btn-circle btn-hint btn-transparent"),$.disabled=T=e[6][e[22].key]||e[5][e[22].key],p($,"aria-label","Download"),ee($,"btn-loading",e[5][e[22].key]),p(E,"class","ri-restart-line"),p(M,"type","button"),p(M,"class","btn btn-sm btn-circle btn-hint btn-transparent"),M.disabled=A=e[6][e[22].key],p(M,"aria-label","Restore"),p(R,"class","ri-delete-bin-7-line"),p(q,"type","button"),p(q,"class","btn btn-sm btn-circle btn-hint btn-transparent"),q.disabled=P=e[6][e[22].key],p(q,"aria-label","Delete"),ee(q,"btn-loading",e[6][e[22].key]),p(v,"class","actions nonintrusive"),p(t,"class","list-item svelte-1ulbkf5"),this.first=t},m(ne,me){S(ne,t,me),y(t,i),y(t,l),y(t,s),y(s,o),y(o,a),y(s,u),y(s,c),y(c,d),y(c,h),y(c,_),y(t,g),y(t,v),y(v,$),y($,C),y(v,O),y(v,M),y(M,E),y(v,N),y(v,q),y(q,R),y(t,F),U=!0,Y||(X=[$e(Fe.call(null,$,"Download")),Z($,"click",Ue(W)),$e(Fe.call(null,M,"Restore")),Z(M,"click",Ue(K)),$e(Fe.call(null,q,"Delete")),Z(q,"click",Ue(le))],Y=!0)},p(ne,me){e=ne,(!U||me&8)&&r!==(r=e[22].key+"")&&re(a,r),(!U||me&8&&f!==(f=e[22].key))&&p(o,"title",f),(!U||me&8)&&m!==(m=H.formattedFileSize(e[22].size)+"")&&re(h,m),(!U||me&104&&T!==(T=e[6][e[22].key]||e[5][e[22].key]))&&($.disabled=T),(!U||me&40)&&ee($,"btn-loading",e[5][e[22].key]),(!U||me&72&&A!==(A=e[6][e[22].key]))&&(M.disabled=A),(!U||me&72&&P!==(P=e[6][e[22].key]))&&(q.disabled=P),(!U||me&72)&&ee(q,"btn-loading",e[6][e[22].key])},i(ne){U||(ne&&Je(()=>{U&&(j||(j=Re(t,tt,{duration:150},!0)),j.run(1))}),U=!0)},o(ne){ne&&(j||(j=Re(t,tt,{duration:150},!1)),j.run(0)),U=!1},d(ne){ne&&w(t),ne&&j&&j.end(),Y=!1,Te(X)}}}function _g(n){let e;return{c(){e=b("div"),e.innerHTML='<span class="skeleton-loader"></span> ',p(e,"class","list-item list-item-loader svelte-1ulbkf5")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function g7(n){let e,t,i;return{c(){e=b("span"),t=D(),i=b("span"),i.textContent="Backup/restore operation is in process",p(e,"class","loader loader-sm"),p(i,"class","txt")},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},d(l){l&&(w(e),w(t),w(i))}}}function b7(n){let e,t,i;return{c(){e=b("i"),t=D(),i=b("span"),i.textContent="Initialize new backup",p(e,"class","ri-play-circle-line"),p(i,"class","txt")},m(l,s){S(l,e,s),S(l,t,s),S(l,i,s)},d(l){l&&(w(e),w(t),w(i))}}}function k7(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_;const g=[_7,h7],v=[];function $(A,N){return A[4]?0:1}i=$(n),l=v[i]=g[i](n);function C(A,N){return A[7]?b7:g7}let T=C(n),O=T(n),M={};u=new r7({props:M}),n[14](u),u.$on("submit",n[15]);let E={};return d=new m7({props:E}),n[16](d),{c(){e=b("div"),t=b("div"),l.c(),s=D(),o=b("div"),r=b("button"),O.c(),f=D(),B(u.$$.fragment),c=D(),B(d.$$.fragment),p(t,"class","list-content svelte-1ulbkf5"),p(r,"type","button"),p(r,"class","btn btn-block btn-transparent"),r.disabled=a=n[4]||!n[7],p(o,"class","list-item list-item-btn"),p(e,"class","list list-compact")},m(A,N){S(A,e,N),y(e,t),v[i].m(t,null),y(e,s),y(e,o),y(o,r),O.m(r,null),S(A,f,N),z(u,A,N),S(A,c,N),z(d,A,N),m=!0,h||(_=Z(r,"click",n[13]),h=!0)},p(A,[N]){let q=i;i=$(A),i===q?v[i].p(A,N):(se(),L(v[q],1,1,()=>{v[q]=null}),oe(),l=v[i],l?l.p(A,N):(l=v[i]=g[i](A),l.c()),I(l,1),l.m(t,null)),T!==(T=C(A))&&(O.d(1),O=T(A),O&&(O.c(),O.m(r,null))),(!m||N&144&&a!==(a=A[4]||!A[7]))&&(r.disabled=a);const R={};u.$set(R);const P={};d.$set(P)},i(A){m||(I(l),I(u.$$.fragment,A),I(d.$$.fragment,A),m=!0)},o(A){L(l),L(u.$$.fragment,A),L(d.$$.fragment,A),m=!1},d(A){A&&(w(e),w(f),w(c)),v[i].d(),O.d(),n[14](null),V(u,A),n[16](null),V(d,A),h=!1,_()}}}function y7(n,e,t){let i,l,s=[],o=!1,r={},a={},f=!0;u(),h();async function u(){t(4,o=!0);try{t(3,s=await fe.backups.getFullList()),s.sort((M,E)=>M.modified<E.modified?1:M.modified>E.modified?-1:0),t(4,o=!1)}catch(M){M.isAbort||(fe.error(M),t(4,o=!1))}}async function c(M){if(!r[M]){t(5,r[M]=!0,r);try{const E=await fe.getAdminFileToken(),A=fe.backups.getDownloadUrl(E,M);H.download(A)}catch(E){E.isAbort||fe.error(E)}delete r[M],t(5,r)}}function d(M){un(`Do you really want to delete ${M}?`,()=>m(M))}async function m(M){if(!a[M]){t(6,a[M]=!0,a);try{await fe.backups.delete(M),H.removeByKey(s,"name",M),u(),Nt(`Successfully deleted ${M}.`)}catch(E){E.isAbort||fe.error(E)}delete a[M],t(6,a)}}async function h(){var M;try{const E=await fe.health.check({$autoCancel:!1}),A=f;t(7,f=((M=E==null?void 0:E.data)==null?void 0:M.canBackup)||!1),A!=f&&f&&u()}catch{}}zt(()=>{let M=setInterval(()=>{h()},3e3);return()=>{clearInterval(M)}});const _=M=>c(M.key),g=M=>l.show(M.key),v=M=>d(M.key),$=()=>i==null?void 0:i.show();function C(M){te[M?"unshift":"push"](()=>{i=M,t(1,i)})}const T=()=>{u()};function O(M){te[M?"unshift":"push"](()=>{l=M,t(2,l)})}return[u,i,l,s,o,r,a,f,c,d,_,g,v,$,C,T,O]}class v7 extends be{constructor(e){super(),ge(this,e,y7,k7,he,{loadBackups:0})}get loadBackups(){return this.$$.ctx[0]}}function w7(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=b("i"),l=D(),s=b("input"),p(t,"class","ri-upload-cloud-line"),p(e,"type","button"),p(e,"class",i="btn btn-circle btn-transparent "+n[0]),p(e,"aria-label","Upload backup"),ee(e,"btn-loading",n[2]),ee(e,"btn-disabled",n[2]),p(s,"type","file"),p(s,"accept","application/zip"),p(s,"class","hidden")},m(a,f){S(a,e,f),y(e,t),S(a,l,f),S(a,s,f),n[5](s),o||(r=[$e(Fe.call(null,e,"Upload backup")),Z(e,"click",n[4]),Z(s,"change",n[3])],o=!0)},p(a,[f]){f&1&&i!==(i="btn btn-circle btn-transparent "+a[0])&&p(e,"class",i),f&5&&ee(e,"btn-loading",a[2]),f&5&&ee(e,"btn-disabled",a[2])},i:x,o:x,d(a){a&&(w(e),w(l),w(s)),n[5](null),o=!1,Te(r)}}}const gg="upload_backup";function S7(n,e,t){const i=st();let{class:l=""}=e,s,o=!1;async function r(u){var d,m,h,_,g;if(o||!((m=(d=u==null?void 0:u.target)==null?void 0:d.files)!=null&&m.length))return;t(2,o=!0);const c=new FormData;c.set("file",u.target.files[0]);try{await fe.backups.upload(c,{requestKey:gg}),t(2,o=!1),i("success"),Nt("Successfully uploaded a new backup.")}catch(v){v.isAbort||(t(2,o=!1),(g=(_=(h=v.response)==null?void 0:h.data)==null?void 0:_.file)!=null&&g.message?li(v.response.data.file.message):fe.error(v))}}ys(()=>{fe.cancelRequest(gg)});const a=()=>s==null?void 0:s.click();function f(u){te[u?"unshift":"push"](()=>{s=u,t(1,s)})}return n.$$set=u=>{"class"in u&&t(0,l=u.class)},[l,s,o,r,a,f]}class $7 extends be{constructor(e){super(),ge(this,e,S7,w7,he,{class:0})}}function T7(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-down-s-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function C7(n){let e;return{c(){e=b("i"),p(e,"class","ri-arrow-up-s-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function bg(n){var U,Y,X;let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E;t=new de({props:{class:"form-field form-field-toggle m-t-base m-b-0",$$slots:{default:[O7,({uniqueId:W})=>({31:W}),({uniqueId:W})=>[0,W?1:0]]},$$scope:{ctx:n}}});let A=n[2]&&kg(n);function N(W){n[24](W)}function q(W){n[25](W)}function R(W){n[26](W)}let P={toggleLabel:"Store backups in S3 storage",testFilesystem:"backups",configKey:"backups.s3",originalConfig:(U=n[0].backups)==null?void 0:U.s3};n[1].backups.s3!==void 0&&(P.config=n[1].backups.s3),n[7]!==void 0&&(P.isTesting=n[7]),n[8]!==void 0&&(P.testError=n[8]),r=new Qb({props:P}),te.push(()=>ke(r,"config",N)),te.push(()=>ke(r,"isTesting",q)),te.push(()=>ke(r,"testError",R));let F=((X=(Y=n[1].backups)==null?void 0:Y.s3)==null?void 0:X.enabled)&&!n[9]&&!n[5]&&yg(n),j=n[9]&&vg(n);return{c(){e=b("form"),B(t.$$.fragment),i=D(),A&&A.c(),l=D(),s=b("div"),o=D(),B(r.$$.fragment),c=D(),d=b("div"),m=b("div"),h=D(),F&&F.c(),_=D(),j&&j.c(),g=D(),v=b("button"),$=b("span"),$.textContent="Save changes",p(s,"class","clearfix m-b-base"),p(m,"class","flex-fill"),p($,"class","txt"),p(v,"type","submit"),p(v,"class","btn btn-expanded"),v.disabled=C=!n[9]||n[5],ee(v,"btn-loading",n[5]),p(d,"class","flex"),p(e,"class","block"),p(e,"autocomplete","off")},m(W,K){S(W,e,K),z(t,e,null),y(e,i),A&&A.m(e,null),y(e,l),y(e,s),y(e,o),z(r,e,null),y(e,c),y(e,d),y(d,m),y(d,h),F&&F.m(d,null),y(d,_),j&&j.m(d,null),y(d,g),y(d,v),y(v,$),O=!0,M||(E=[Z(v,"click",n[28]),Z(e,"submit",Ue(n[11]))],M=!0)},p(W,K){var me,Pe,ze;const le={};K[0]&4|K[1]&3&&(le.$$scope={dirty:K,ctx:W}),t.$set(le),W[2]?A?(A.p(W,K),K[0]&4&&I(A,1)):(A=kg(W),A.c(),I(A,1),A.m(e,l)):A&&(se(),L(A,1,1,()=>{A=null}),oe());const ne={};K[0]&1&&(ne.originalConfig=(me=W[0].backups)==null?void 0:me.s3),!a&&K[0]&2&&(a=!0,ne.config=W[1].backups.s3,ye(()=>a=!1)),!f&&K[0]&128&&(f=!0,ne.isTesting=W[7],ye(()=>f=!1)),!u&&K[0]&256&&(u=!0,ne.testError=W[8],ye(()=>u=!1)),r.$set(ne),(ze=(Pe=W[1].backups)==null?void 0:Pe.s3)!=null&&ze.enabled&&!W[9]&&!W[5]?F?F.p(W,K):(F=yg(W),F.c(),F.m(d,_)):F&&(F.d(1),F=null),W[9]?j?j.p(W,K):(j=vg(W),j.c(),j.m(d,g)):j&&(j.d(1),j=null),(!O||K[0]&544&&C!==(C=!W[9]||W[5]))&&(v.disabled=C),(!O||K[0]&32)&&ee(v,"btn-loading",W[5])},i(W){O||(I(t.$$.fragment,W),I(A),I(r.$$.fragment,W),W&&Je(()=>{O&&(T||(T=Re(e,tt,{duration:150},!0)),T.run(1))}),O=!0)},o(W){L(t.$$.fragment,W),L(A),L(r.$$.fragment,W),W&&(T||(T=Re(e,tt,{duration:150},!1)),T.run(0)),O=!1},d(W){W&&w(e),V(t),A&&A.d(),V(r),F&&F.d(),j&&j.d(),W&&T&&T.end(),M=!1,Te(E)}}}function O7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=D(),l=b("label"),s=J("Enable auto backups"),p(e,"type","checkbox"),p(e,"id",t=n[31]),e.required=!0,p(l,"for",o=n[31])},m(f,u){S(f,e,u),e.checked=n[2],S(f,i,u),S(f,l,u),y(l,s),r||(a=Z(e,"change",n[17]),r=!0)},p(f,u){u[1]&1&&t!==(t=f[31])&&p(e,"id",t),u[0]&4&&(e.checked=f[2]),u[1]&1&&o!==(o=f[31])&&p(l,"for",o)},d(f){f&&(w(e),w(i),w(l)),r=!1,a()}}}function kg(n){let e,t,i,l,s,o,r,a,f;return l=new de({props:{class:"form-field required",name:"backups.cron",$$slots:{default:[D7,({uniqueId:u})=>({31:u}),({uniqueId:u})=>[0,u?1:0]]},$$scope:{ctx:n}}}),r=new de({props:{class:"form-field required",name:"backups.cronMaxKeep",$$slots:{default:[E7,({uniqueId:u})=>({31:u}),({uniqueId:u})=>[0,u?1:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=D(),o=b("div"),B(r.$$.fragment),p(i,"class","col-lg-6"),p(o,"class","col-lg-6"),p(t,"class","grid p-t-base p-b-sm"),p(e,"class","block")},m(u,c){S(u,e,c),y(e,t),y(t,i),z(l,i,null),y(t,s),y(t,o),z(r,o,null),f=!0},p(u,c){const d={};c[0]&3|c[1]&3&&(d.$$scope={dirty:c,ctx:u}),l.$set(d);const m={};c[0]&2|c[1]&3&&(m.$$scope={dirty:c,ctx:u}),r.$set(m)},i(u){f||(I(l.$$.fragment,u),I(r.$$.fragment,u),u&&Je(()=>{f&&(a||(a=Re(e,tt,{duration:150},!0)),a.run(1))}),f=!0)},o(u){L(l.$$.fragment,u),L(r.$$.fragment,u),u&&(a||(a=Re(e,tt,{duration:150},!1)),a.run(0)),f=!1},d(u){u&&w(e),V(l),V(r),u&&a&&a.end()}}}function M7(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("button"),e.innerHTML='<span class="txt">Every day at 00:00h</span>',t=D(),i=b("button"),i.innerHTML='<span class="txt">Every sunday at 00:00h</span>',l=D(),s=b("button"),s.innerHTML='<span class="txt">Every Mon and Wed at 00:00h</span>',o=D(),r=b("button"),r.innerHTML='<span class="txt">Every first day of the month at 00:00h</span>',p(e,"type","button"),p(e,"class","dropdown-item closable"),p(i,"type","button"),p(i,"class","dropdown-item closable"),p(s,"type","button"),p(s,"class","dropdown-item closable"),p(r,"type","button"),p(r,"class","dropdown-item closable")},m(u,c){S(u,e,c),S(u,t,c),S(u,i,c),S(u,l,c),S(u,s,c),S(u,o,c),S(u,r,c),a||(f=[Z(e,"click",n[19]),Z(i,"click",n[20]),Z(s,"click",n[21]),Z(r,"click",n[22])],a=!0)},p:x,d(u){u&&(w(e),w(t),w(i),w(l),w(s),w(o),w(r)),a=!1,Te(f)}}}function D7(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E,A,N,q;return _=new Mn({props:{class:"dropdown dropdown-nowrap dropdown-right",$$slots:{default:[M7]},$$scope:{ctx:n}}}),{c(){var R,P;e=b("label"),t=J("Cron expression"),l=D(),s=b("input"),a=D(),f=b("div"),u=b("button"),c=b("span"),c.textContent="Presets",d=D(),m=b("i"),h=D(),B(_.$$.fragment),g=D(),v=b("div"),$=b("p"),C=J(`Supports numeric list, steps, ranges or
`),T=b("span"),T.textContent="macros",O=J(`.
`),M=b("br"),E=J(`
The timezone is in UTC.`),p(e,"for",i=n[31]),s.required=!0,p(s,"type","text"),p(s,"id",o=n[31]),p(s,"class","txt-lg txt-mono"),p(s,"placeholder","* * * * *"),s.autofocus=r=!((P=(R=n[0])==null?void 0:R.backups)!=null&&P.cron),p(c,"class","txt"),p(m,"class","ri-arrow-drop-down-fill"),p(u,"type","button"),p(u,"class","btn btn-sm btn-outline p-r-0"),p(f,"class","form-field-addon"),p(T,"class","link-primary"),p(v,"class","help-block")},m(R,P){var F,j;S(R,e,P),y(e,t),S(R,l,P),S(R,s,P),ae(s,n[1].backups.cron),S(R,a,P),S(R,f,P),y(f,u),y(u,c),y(u,d),y(u,m),y(u,h),z(_,u,null),S(R,g,P),S(R,v,P),y(v,$),y($,C),y($,T),y($,O),y($,M),y($,E),A=!0,(j=(F=n[0])==null?void 0:F.backups)!=null&&j.cron||s.focus(),N||(q=[Z(s,"input",n[18]),$e(Fe.call(null,T,`@yearly
@annually
@monthly
@weekly
@daily
@midnight
@hourly`))],N=!0)},p(R,P){var j,U;(!A||P[1]&1&&i!==(i=R[31]))&&p(e,"for",i),(!A||P[1]&1&&o!==(o=R[31]))&&p(s,"id",o),(!A||P[0]&1&&r!==(r=!((U=(j=R[0])==null?void 0:j.backups)!=null&&U.cron)))&&(s.autofocus=r),P[0]&2&&s.value!==R[1].backups.cron&&ae(s,R[1].backups.cron);const F={};P[0]&2|P[1]&2&&(F.$$scope={dirty:P,ctx:R}),_.$set(F)},i(R){A||(I(_.$$.fragment,R),A=!0)},o(R){L(_.$$.fragment,R),A=!1},d(R){R&&(w(e),w(l),w(s),w(a),w(f),w(g),w(v)),V(_),N=!1,Te(q)}}}function E7(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=J("Max @auto backups to keep"),l=D(),s=b("input"),p(e,"for",i=n[31]),p(s,"type","number"),p(s,"id",o=n[31]),p(s,"min","1")},m(f,u){S(f,e,u),y(e,t),S(f,l,u),S(f,s,u),ae(s,n[1].backups.cronMaxKeep),r||(a=Z(s,"input",n[23]),r=!0)},p(f,u){u[1]&1&&i!==(i=f[31])&&p(e,"for",i),u[1]&1&&o!==(o=f[31])&&p(s,"id",o),u[0]&2&&lt(s.value)!==f[1].backups.cronMaxKeep&&ae(s,f[1].backups.cronMaxKeep)},d(f){f&&(w(e),w(l),w(s)),r=!1,a()}}}function yg(n){let e;function t(s,o){return s[7]?L7:s[8]?A7:I7}let i=t(n),l=i(n);return{c(){l.c(),e=ve()},m(s,o){l.m(s,o),S(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&w(e),l.d(s)}}}function I7(n){let e;return{c(){e=b("div"),e.innerHTML='<i class="ri-checkbox-circle-line txt-success"></i> <span class="txt">S3 connected successfully</span>',p(e,"class","label label-sm label-success entrance-right")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function A7(n){let e,t,i,l;return{c(){e=b("div"),e.innerHTML='<i class="ri-error-warning-line txt-warning"></i> <span class="txt">Failed to establish S3 connection</span>',p(e,"class","label label-sm label-warning entrance-right")},m(s,o){var r;S(s,e,o),i||(l=$e(t=Fe.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&Ot(t.update)&&o[0]&256&&t.update.call(null,(r=s[8].data)==null?void 0:r.message)},d(s){s&&w(e),i=!1,l()}}}function L7(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){S(t,e,i)},p:x,d(t){t&&w(e)}}}function vg(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("span"),t.textContent="Reset",p(t,"class","txt"),p(e,"type","submit"),p(e,"class","btn btn-hint btn-transparent"),e.disabled=i=!n[9]||n[5]},m(o,r){S(o,e,r),y(e,t),l||(s=Z(e,"click",n[27]),l=!0)},p(o,r){r[0]&544&&i!==(i=!o[9]||o[5])&&(e.disabled=i)},d(o){o&&w(e),l=!1,s()}}}function N7(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$,C,T,O,M,E,A,N,q,R;m=new Go({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),_=new $7({props:{class:"btn-sm"}}),_.$on("success",n[13]);let P={};v=new v7({props:P}),n[15](v);function F(X,W){return X[6]?C7:T7}let j=F(n),U=j(n),Y=n[6]&&!n[4]&&bg(n);return{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=D(),s=b("div"),o=J(n[10]),r=D(),a=b("div"),f=b("div"),u=b("div"),c=b("span"),c.textContent="Backup and restore your PocketBase data",d=D(),B(m.$$.fragment),h=D(),B(_.$$.fragment),g=D(),B(v.$$.fragment),$=D(),C=b("hr"),T=D(),O=b("button"),M=b("span"),M.textContent="Backups options",E=D(),U.c(),A=D(),Y&&Y.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(c,"class","txt-xl"),p(u,"class","flex m-b-sm flex-gap-10"),p(M,"class","txt"),p(O,"type","button"),p(O,"class","btn btn-secondary"),O.disabled=n[4],ee(O,"btn-loading",n[4]),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m(X,W){S(X,e,W),y(e,t),y(t,i),y(t,l),y(t,s),y(s,o),S(X,r,W),S(X,a,W),y(a,f),y(f,u),y(u,c),y(u,d),z(m,u,null),y(u,h),z(_,u,null),y(f,g),z(v,f,null),y(f,$),y(f,C),y(f,T),y(f,O),y(O,M),y(O,E),U.m(O,null),y(f,A),Y&&Y.m(f,null),N=!0,q||(R=[Z(O,"click",n[16]),Z(f,"submit",Ue(n[11]))],q=!0)},p(X,W){(!N||W[0]&1024)&&re(o,X[10]);const K={};v.$set(K),j!==(j=F(X))&&(U.d(1),U=j(X),U&&(U.c(),U.m(O,null))),(!N||W[0]&16)&&(O.disabled=X[4]),(!N||W[0]&16)&&ee(O,"btn-loading",X[4]),X[6]&&!X[4]?Y?(Y.p(X,W),W[0]&80&&I(Y,1)):(Y=bg(X),Y.c(),I(Y,1),Y.m(f,null)):Y&&(se(),L(Y,1,1,()=>{Y=null}),oe())},i(X){N||(I(m.$$.fragment,X),I(_.$$.fragment,X),I(v.$$.fragment,X),I(Y),N=!0)},o(X){L(m.$$.fragment,X),L(_.$$.fragment,X),L(v.$$.fragment,X),L(Y),N=!1},d(X){X&&(w(e),w(r),w(a)),V(m),V(_),n[15](null),V(v),U.d(),Y&&Y.d(),q=!1,Te(R)}}}function P7(n){let e,t,i,l;return e=new gi({}),i=new kn({props:{$$slots:{default:[N7]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=D(),B(i.$$.fragment)},m(s,o){z(e,s,o),S(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&2047|o[1]&2&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(I(e.$$.fragment,s),I(i.$$.fragment,s),l=!0)},o(s){L(e.$$.fragment,s),L(i.$$.fragment,s),l=!1},d(s){s&&w(t),V(e,s),V(i,s)}}}function F7(n,e,t){let i,l;We(n,At,W=>t(10,l=W)),en(At,l="Backups",l);let s,o={},r={},a=!1,f=!1,u="",c=!1,d=!1,m=!1,h=null;_();async function _(){t(4,a=!0);try{const W=await fe.settings.getAll()||{};v(W)}catch(W){fe.error(W)}t(4,a=!1)}async function g(){if(!(f||!i)){t(5,f=!0);try{const W=await fe.settings.update(H.filterRedactedProps(r));await C(),v(W),Nt("Successfully saved application settings.")}catch(W){fe.error(W)}t(5,f=!1)}}function v(W={}){t(1,r={backups:(W==null?void 0:W.backups)||{}}),t(2,c=r.backups.cron!=""),t(0,o=JSON.parse(JSON.stringify(r)))}function $(){t(1,r=JSON.parse(JSON.stringify(o||{backups:{}}))),t(2,c=r.backups.cron!="")}async function C(){return s==null?void 0:s.loadBackups()}function T(W){te[W?"unshift":"push"](()=>{s=W,t(3,s)})}const O=()=>t(6,d=!d);function M(){c=this.checked,t(2,c)}function E(){r.backups.cron=this.value,t(1,r),t(2,c)}const A=()=>{t(1,r.backups.cron="0 0 * * *",r)},N=()=>{t(1,r.backups.cron="0 0 * * 0",r)},q=()=>{t(1,r.backups.cron="0 0 * * 1,3",r)},R=()=>{t(1,r.backups.cron="0 0 1 * *",r)};function P(){r.backups.cronMaxKeep=lt(this.value),t(1,r),t(2,c)}function F(W){n.$$.not_equal(r.backups.s3,W)&&(r.backups.s3=W,t(1,r),t(2,c))}function j(W){m=W,t(7,m)}function U(W){h=W,t(8,h)}const Y=()=>$(),X=()=>g();return n.$$.update=()=>{var W;n.$$.dirty[0]&1&&t(14,u=JSON.stringify(o)),n.$$.dirty[0]&6&&!c&&(W=r==null?void 0:r.backups)!=null&&W.cron&&(si("backups.cron"),t(1,r.backups.cron="",r)),n.$$.dirty[0]&16386&&t(9,i=u!=JSON.stringify(r))},[o,r,c,s,a,f,d,m,h,i,l,g,$,C,u,T,O,M,E,A,N,q,R,P,F,j,U,Y,X]}class R7 extends be{constructor(e){super(),ge(this,e,F7,P7,he,{},null,[-1,-1])}}const Ft=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("installer")?nl("/"):!0}],q7={"/login":Lt({component:RE,conditions:Ft.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":Lt({asyncComponent:()=>nt(()=>import("./PageAdminRequestPasswordReset-YiMTSXzD.js"),[],import.meta.url),conditions:Ft.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":Lt({asyncComponent:()=>nt(()=>import("./PageAdminConfirmPasswordReset-COG5qBhz.js"),[],import.meta.url),conditions:Ft.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":Lt({component:lE,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":Lt({component:i$,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings":Lt({component:YE,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/admins":Lt({component:IE,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/mail":Lt({component:LI,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/storage":Lt({component:eA,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/auth-providers":Lt({component:gA,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/tokens":Lt({component:CA,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/export-collections":Lt({component:NA,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/import-collections":Lt({component:e7,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/backups":Lt({component:R7,conditions:Ft.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/users/confirm-password-reset/:token":Lt({asyncComponent:()=>nt(()=>import("./PageRecordConfirmPasswordReset-DeGlOKdO.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/auth/confirm-password-reset/:token":Lt({asyncComponent:()=>nt(()=>import("./PageRecordConfirmPasswordReset-DeGlOKdO.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/users/confirm-verification/:token":Lt({asyncComponent:()=>nt(()=>import("./PageRecordConfirmVerification-DNNy9Eo1.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/auth/confirm-verification/:token":Lt({asyncComponent:()=>nt(()=>import("./PageRecordConfirmVerification-DNNy9Eo1.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/users/confirm-email-change/:token":Lt({asyncComponent:()=>nt(()=>import("./PageRecordConfirmEmailChange-wRJIF1Bh.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/auth/confirm-email-change/:token":Lt({asyncComponent:()=>nt(()=>import("./PageRecordConfirmEmailChange-wRJIF1Bh.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/auth/oauth2-redirect-success":Lt({asyncComponent:()=>nt(()=>import("./PageOAuth2RedirectSuccess-DMTakx-f.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"/auth/oauth2-redirect-failure":Lt({asyncComponent:()=>nt(()=>import("./PageOAuth2RedirectFailure-CJLP00Sc.js"),[],import.meta.url),conditions:Ft,userData:{showAppSidebar:!1}}),"*":Lt({component:Dv,userData:{showAppSidebar:!1}})};function j7(n,{from:e,to:t},i={}){const l=getComputedStyle(n),s=l.transform==="none"?"":l.transform,[o,r]=l.transformOrigin.split(" ").map(parseFloat),a=e.left+e.width*o/t.width-(t.left+o),f=e.top+e.height*r/t.height-(t.top+r),{delay:u=0,duration:c=m=>Math.sqrt(m)*120,easing:d=Zo}=i;return{delay:u,duration:Ot(c)?c(Math.sqrt(a*a+f*f)):c,easing:d,css:(m,h)=>{const _=h*a,g=h*f,v=m+h*e.width/t.width,$=m+h*e.height/t.height;return`transform: ${s} translate(${_}px, ${g}px) scale(${v}, ${$});`}}}function wg(n,e,t){const i=n.slice();return i[2]=e[t],i}function H7(n){let e;return{c(){e=b("i"),p(e,"class","ri-alert-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function z7(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function V7(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function B7(n){let e;return{c(){e=b("i"),p(e,"class","ri-information-line")},m(t,i){S(t,e,i)},d(t){t&&w(e)}}}function Sg(n,e){let t,i,l,s,o=e[2].message+"",r,a,f,u,c,d,m,h=x,_,g,v;function $(M,E){return M[2].type==="info"?B7:M[2].type==="success"?V7:M[2].type==="warning"?z7:H7}let C=$(e),T=C(e);function O(){return e[1](e[2])}return{key:n,first:null,c(){t=b("div"),i=b("div"),T.c(),l=D(),s=b("div"),r=J(o),a=D(),f=b("button"),f.innerHTML='<i class="ri-close-line"></i>',u=D(),p(i,"class","icon"),p(s,"class","content"),p(f,"type","button"),p(f,"class","close"),p(t,"class","alert txt-break"),ee(t,"alert-info",e[2].type=="info"),ee(t,"alert-success",e[2].type=="success"),ee(t,"alert-danger",e[2].type=="error"),ee(t,"alert-warning",e[2].type=="warning"),this.first=t},m(M,E){S(M,t,E),y(t,i),T.m(i,null),y(t,l),y(t,s),y(s,r),y(t,a),y(t,f),y(t,u),_=!0,g||(v=Z(f,"click",Ue(O)),g=!0)},p(M,E){e=M,C!==(C=$(e))&&(T.d(1),T=C(e),T&&(T.c(),T.m(i,null))),(!_||E&1)&&o!==(o=e[2].message+"")&&re(r,o),(!_||E&1)&&ee(t,"alert-info",e[2].type=="info"),(!_||E&1)&&ee(t,"alert-success",e[2].type=="success"),(!_||E&1)&&ee(t,"alert-danger",e[2].type=="error"),(!_||E&1)&&ee(t,"alert-warning",e[2].type=="warning")},r(){m=t.getBoundingClientRect()},f(){$0(t),h(),Lg(t,m)},a(){h(),h=S0(t,m,j7,{duration:150})},i(M){_||(M&&Je(()=>{_&&(d&&d.end(1),c=Fg(t,tt,{duration:150}),c.start())}),_=!0)},o(M){c&&c.invalidate(),M&&(d=da(t,as,{duration:150})),_=!1},d(M){M&&w(t),T.d(),M&&d&&d.end(),g=!1,v()}}}function U7(n){let e,t=[],i=new Map,l,s=ce(n[0]);const o=r=>r[2].message;for(let r=0;r<s.length;r+=1){let a=wg(n,s,r),f=o(a);i.set(f,t[r]=Sg(f,a))}return{c(){e=b("div");for(let r=0;r<t.length;r+=1)t[r].c();p(e,"class","toasts-wrapper")},m(r,a){S(r,e,a);for(let f=0;f<t.length;f+=1)t[f]&&t[f].m(e,null);l=!0},p(r,[a]){if(a&1){s=ce(r[0]),se();for(let f=0;f<t.length;f+=1)t[f].r();t=ft(t,a,o,1,r,s,i,e,D0,Sg,null,wg);for(let f=0;f<t.length;f+=1)t[f].a();oe()}},i(r){if(!l){for(let a=0;a<s.length;a+=1)I(t[a]);l=!0}},o(r){for(let a=0;a<t.length;a+=1)L(t[a]);l=!1},d(r){r&&w(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function W7(n,e,t){let i;return We(n,Ko,s=>t(0,i=s)),[i,s=>Y1(s)]}class Y7 extends be{constructor(e){super(),ge(this,e,W7,U7,he,{})}}function K7(n){var l;let e,t=((l=n[1])==null?void 0:l.text)+"",i;return{c(){e=b("h4"),i=J(t),p(e,"class","block center txt-break"),p(e,"slot","header")},m(s,o){S(s,e,o),y(e,i)},p(s,o){var r;o&2&&t!==(t=((r=s[1])==null?void 0:r.text)+"")&&re(i,t)},d(s){s&&w(e)}}}function J7(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="No",i=D(),l=b("button"),s=b("span"),s.textContent="Yes",p(t,"class","txt"),e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent btn-expanded-sm"),e.disabled=n[2],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-danger btn-expanded"),l.disabled=n[2],ee(l,"btn-loading",n[2])},m(a,f){S(a,e,f),y(e,t),S(a,i,f),S(a,l,f),y(l,s),e.focus(),o||(r=[Z(e,"click",n[4]),Z(l,"click",n[5])],o=!0)},p(a,f){f&4&&(e.disabled=a[2]),f&4&&(l.disabled=a[2]),f&4&&ee(l,"btn-loading",a[2])},d(a){a&&(w(e),w(i),w(l)),o=!1,Te(r)}}}function Z7(n){let e,t,i={class:"confirm-popup hide-content overlay-panel-sm",overlayClose:!n[2],escClose:!n[2],btnClose:!1,popup:!0,$$slots:{footer:[J7],header:[K7]},$$scope:{ctx:n}};return e=new Xt({props:i}),n[6](e),e.$on("hide",n[7]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&4&&(o.overlayClose=!l[2]),s&4&&(o.escClose=!l[2]),s&271&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(I(e.$$.fragment,l),t=!0)},o(l){L(e.$$.fragment,l),t=!1},d(l){n[6](null),V(e,l)}}}function G7(n,e,t){let i;We(n,Va,c=>t(1,i=c));let l,s=!1,o=!1;const r=()=>{t(3,o=!1),l==null||l.hide()},a=async()=>{i!=null&&i.yesCallback&&(t(2,s=!0),await Promise.resolve(i.yesCallback()),t(2,s=!1)),t(3,o=!0),l==null||l.hide()};function f(c){te[c?"unshift":"push"](()=>{l=c,t(0,l)})}const u=async()=>{!o&&(i!=null&&i.noCallback)&&i.noCallback(),await xt(),t(3,o=!1),Vb()};return n.$$.update=()=>{n.$$.dirty&3&&i!=null&&i.text&&(t(3,o=!1),l==null||l.show())},[l,i,s,o,r,a,f,u]}class X7 extends be{constructor(e){super(),ge(this,e,G7,Z7,he,{})}}function $g(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,v,$;return _=new Mn({props:{class:"dropdown dropdown-nowrap dropdown-upside dropdown-left",$$slots:{default:[Q7]},$$scope:{ctx:n}}}),{c(){var C;e=b("aside"),t=b("a"),t.innerHTML='<img src="./images/logo.svg" alt="PocketBase logo" width="40" height="40"/>',i=D(),l=b("nav"),s=b("a"),s.innerHTML='<i class="ri-database-2-line"></i>',o=D(),r=b("a"),r.innerHTML='<i class="ri-line-chart-line"></i>',a=D(),f=b("a"),f.innerHTML='<i class="ri-tools-line"></i>',u=D(),c=b("div"),d=b("img"),h=D(),B(_.$$.fragment),p(t,"href","/"),p(t,"class","logo logo-sm"),p(s,"href","/collections"),p(s,"class","menu-item"),p(s,"aria-label","Collections"),p(r,"href","/logs"),p(r,"class","menu-item"),p(r,"aria-label","Logs"),p(f,"href","/settings"),p(f,"class","menu-item"),p(f,"aria-label","Settings"),p(l,"class","main-menu"),tn(d.src,m="./images/avatars/avatar"+(((C=n[0])==null?void 0:C.avatar)||0)+".svg")||p(d,"src",m),p(d,"alt","Avatar"),p(d,"aria-hidden","true"),p(c,"tabindex","0"),p(c,"role","button"),p(c,"aria-label","Logged admin menu"),p(c,"class","thumb thumb-circle link-hint closable"),p(e,"class","app-sidebar")},m(C,T){S(C,e,T),y(e,t),y(e,i),y(e,l),y(l,s),y(l,o),y(l,r),y(l,a),y(l,f),y(e,u),y(e,c),y(c,d),y(c,h),z(_,c,null),g=!0,v||($=[$e(ln.call(null,t)),$e(ln.call(null,s)),$e(Nn.call(null,s,{path:"/collections/?.*",className:"current-route"})),$e(Fe.call(null,s,{text:"Collections",position:"right"})),$e(ln.call(null,r)),$e(Nn.call(null,r,{path:"/logs/?.*",className:"current-route"})),$e(Fe.call(null,r,{text:"Logs",position:"right"})),$e(ln.call(null,f)),$e(Nn.call(null,f,{path:"/settings/?.*",className:"current-route"})),$e(Fe.call(null,f,{text:"Settings",position:"right"}))],v=!0)},p(C,T){var M;(!g||T&1&&!tn(d.src,m="./images/avatars/avatar"+(((M=C[0])==null?void 0:M.avatar)||0)+".svg"))&&p(d,"src",m);const O={};T&4096&&(O.$$scope={dirty:T,ctx:C}),_.$set(O)},i(C){g||(I(_.$$.fragment,C),g=!0)},o(C){L(_.$$.fragment,C),g=!1},d(C){C&&w(e),V(_),v=!1,Te($)}}}function Q7(n){let e,t,i,l,s,o,r;return{c(){e=b("a"),e.innerHTML='<i class="ri-shield-user-line" aria-hidden="true"></i> <span class="txt">Manage admins</span>',t=D(),i=b("hr"),l=D(),s=b("button"),s.innerHTML='<i class="ri-logout-circle-line" aria-hidden="true"></i> <span class="txt">Logout</span>',p(e,"href","/settings/admins"),p(e,"class","dropdown-item closable"),p(e,"role","menuitem"),p(s,"type","button"),p(s,"class","dropdown-item closable"),p(s,"role","menuitem")},m(a,f){S(a,e,f),S(a,t,f),S(a,i,f),S(a,l,f),S(a,s,f),o||(r=[$e(ln.call(null,e)),Z(s,"click",n[7])],o=!0)},p:x,d(a){a&&(w(e),w(t),w(i),w(l),w(s)),o=!1,Te(r)}}}function Tg(n){let e,t,i;return t=new Ya({props:{conf:H.defaultEditorOptions()}}),t.$on("init",n[8]),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tinymce-preloader hidden")},m(l,s){S(l,e,s),z(t,e,null),i=!0},p:x,i(l){i||(I(t.$$.fragment,l),i=!0)},o(l){L(t.$$.fragment,l),i=!1},d(l){l&&w(e),V(t)}}}function x7(n){var g;let e,t,i,l,s,o,r,a,f,u,c,d,m;document.title=e=H.joinNonEmpty([n[4],n[3],"PocketBase"]," - ");let h=((g=n[0])==null?void 0:g.id)&&n[1]&&$g(n);o=new q0({props:{routes:q7}}),o.$on("routeLoading",n[5]),o.$on("conditionsFailed",n[6]),a=new Y7({}),u=new X7({});let _=n[1]&&!n[2]&&Tg(n);return{c(){t=D(),i=b("div"),h&&h.c(),l=D(),s=b("div"),B(o.$$.fragment),r=D(),B(a.$$.fragment),f=D(),B(u.$$.fragment),c=D(),_&&_.c(),d=ve(),p(s,"class","app-body"),p(i,"class","app-layout")},m(v,$){S(v,t,$),S(v,i,$),h&&h.m(i,null),y(i,l),y(i,s),z(o,s,null),y(s,r),z(a,s,null),S(v,f,$),z(u,v,$),S(v,c,$),_&&_.m(v,$),S(v,d,$),m=!0},p(v,[$]){var C;(!m||$&24)&&e!==(e=H.joinNonEmpty([v[4],v[3],"PocketBase"]," - "))&&(document.title=e),(C=v[0])!=null&&C.id&&v[1]?h?(h.p(v,$),$&3&&I(h,1)):(h=$g(v),h.c(),I(h,1),h.m(i,l)):h&&(se(),L(h,1,1,()=>{h=null}),oe()),v[1]&&!v[2]?_?(_.p(v,$),$&6&&I(_,1)):(_=Tg(v),_.c(),I(_,1),_.m(d.parentNode,d)):_&&(se(),L(_,1,1,()=>{_=null}),oe())},i(v){m||(I(h),I(o.$$.fragment,v),I(a.$$.fragment,v),I(u.$$.fragment,v),I(_),m=!0)},o(v){L(h),L(o.$$.fragment,v),L(a.$$.fragment,v),L(u.$$.fragment,v),L(_),m=!1},d(v){v&&(w(t),w(i),w(f),w(c),w(d)),h&&h.d(),V(o),V(a),V(u,v),_&&_.d(v)}}}function eL(n,e,t){let i,l,s,o;We(n,Qi,_=>t(10,i=_)),We(n,Mo,_=>t(3,l=_)),We(n,Ta,_=>t(0,s=_)),We(n,At,_=>t(4,o=_));let r,a=!1,f=!1;function u(_){var g,v,$,C;((g=_==null?void 0:_.detail)==null?void 0:g.location)!==r&&(t(1,a=!!(($=(v=_==null?void 0:_.detail)==null?void 0:v.userData)!=null&&$.showAppSidebar)),r=(C=_==null?void 0:_.detail)==null?void 0:C.location,en(At,o="",o),Gt({}),Vb())}function c(){nl("/")}async function d(){var _,g;if(s!=null&&s.id)try{const v=await fe.settings.getAll({$cancelKey:"initialAppSettings"});en(Mo,l=((_=v==null?void 0:v.meta)==null?void 0:_.appName)||"",l),en(Qi,i=!!((g=v==null?void 0:v.meta)!=null&&g.hideControls),i)}catch(v){v!=null&&v.isAbort||console.warn("Failed to load app settings.",v)}}function m(){fe.logout()}const h=()=>{t(2,f=!0)};return n.$$.update=()=>{n.$$.dirty&1&&s!=null&&s.id&&d()},[s,a,f,l,o,u,c,m,h]}class tL extends be{constructor(e){super(),ge(this,e,eL,x7,he,{})}}new tL({target:document.getElementById("app")});export{fe as A,Nt as B,H as C,nl as D,ve as E,G1 as F,zo as G,oo as H,zt as I,We as J,qn as K,st as L,te as M,qb as N,ce as O,ft as P,Ai as Q,It as R,be as S,rt as T,k0 as U,L as a,D as b,B as c,V as d,b as e,p as f,S as g,y as h,ge as i,$e as j,se as k,ln as l,z as m,oe as n,w as o,de as p,ee as q,Z as r,he as s,I as t,Ue as u,J as v,re as w,x,ae as y,Te as z};