From 93bcb91cf0ef0caa0d63913231e5df7535e7d5b2 Mon Sep 17 00:00:00 2001 From: Niek Date: Mon, 23 Oct 2023 08:16:00 +0000 Subject: [PATCH] deploy: 711c10d77b0b1b002e9404b2e99ae93a9623dd8d --- assets/{index-8cab04f7.js => index-840e3920.js} | 4 ++-- index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename assets/{index-8cab04f7.js => index-840e3920.js} (97%) diff --git a/assets/index-8cab04f7.js b/assets/index-840e3920.js similarity index 97% rename from assets/index-8cab04f7.js rename to assets/index-840e3920.js index a06f28dc..7a362693 100644 --- a/assets/index-8cab04f7.js +++ b/assets/index-840e3920.js @@ -1,10 +1,10 @@ -var U7=Object.defineProperty;var k7=(I,l,d)=>l in I?U7(I,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):I[l]=d;var R2=(I,l,d)=>(k7(I,typeof l!="symbol"?l+"":l,d),d);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const G of document.querySelectorAll('link[rel="modulepreload"]'))c(G);new MutationObserver(G=>{for(const b of G)if(b.type==="childList")for(const W of b.addedNodes)W.tagName==="LINK"&&W.rel==="modulepreload"&&c(W)}).observe(document,{childList:!0,subtree:!0});function d(G){const b={};return G.integrity&&(b.integrity=G.integrity),G.referrerPolicy&&(b.referrerPolicy=G.referrerPolicy),G.crossOrigin==="use-credentials"?b.credentials="include":G.crossOrigin==="anonymous"?b.credentials="omit":b.credentials="same-origin",b}function c(G){if(G.ep)return;G.ep=!0;const b=d(G);fetch(G.href,b)}})();function c2(){}function e0(I,l){for(const d in l)I[d]=l[d];return I}function x7(I){return!!I&&(typeof I=="object"||typeof I=="function")&&typeof I.then=="function"}function id(I){return I()}function S4(){return Object.create(null)}function a0(I){I.forEach(id)}function y1(I){return typeof I=="function"}function g2(I,l){return I!=I?l==l:I!==l||I&&typeof I=="object"||typeof I=="function"}let Ll;function v1(I,l){return Ll||(Ll=document.createElement("a")),Ll.href=l,I===Ll.href}function M7(I){return Object.keys(I).length===0}function q9(I,...l){if(I==null)return c2;const d=I.subscribe(...l);return d.unsubscribe?()=>d.unsubscribe():d}function w2(I){let l;return q9(I,d=>l=d)(),l}function y2(I,l,d){I.$$.on_destroy.push(q9(l,d))}function O2(I,l,d,c){if(I){const G=wd(I,l,d,c);return I[0](G)}}function wd(I,l,d,c){return I[1]&&c?e0(d.ctx.slice(),I[1](c(l))):d.ctx}function P2(I,l,d,c){if(I[2]&&c){const G=I[2](c(d));if(l.dirty===void 0)return G;if(typeof G=="object"){const b=[],W=Math.max(l.dirty.length,G.length);for(let t=0;t32){const l=[],d=I.ctx.length/32;for(let c=0;cI.removeEventListener(l,d,c)}function B2(I){return function(l){return l.preventDefault(),I.call(this,l)}}function il(I){return function(l){return l.stopPropagation(),I.call(this,l)}}function m(I,l,d){d==null?I.removeAttribute(l):I.getAttribute(l)!==d&&I.setAttribute(l,d)}const S7=["width","height"];function z4(I,l){const d=Object.getOwnPropertyDescriptors(I.__proto__);for(const c in l)l[c]==null?I.removeAttribute(c):c==="style"?I.style.cssText=l[c]:c==="__value"?I.value=I[c]=l[c]:d[c]&&d[c].set&&S7.indexOf(c)===-1?I[c]=l[c]:m(I,c,l[c])}function z7(I){return Array.from(I.childNodes)}function T2(I,l){l=""+l,I.data!==l&&(I.data=l)}function T4(I,l){I.value=l??""}function G1(I,l,d,c){d==null?I.style.removeProperty(l):I.style.setProperty(l,d,c?"important":"")}function f(I,l,d){I.classList[d?"add":"remove"](l)}function T7(I,l,{bubbles:d=!1,cancelable:c=!1}={}){const G=document.createEvent("CustomEvent");return G.initCustomEvent(I,d,c,l),G}class wl{constructor(l=!1){this.is_svg=!1,this.is_svg=l,this.e=this.n=null}c(l){this.h(l)}m(l,d,c=null){this.e||(this.is_svg?this.e=q1(d.nodeName):this.e=X(d.nodeType===11?"TEMPLATE":d.nodeName),this.t=d.tagName!=="TEMPLATE"?d:d.content,this.c(l)),this.i(c)}h(l){this.e.innerHTML=l,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(l){for(let d=0;d{const G=I.$$.callbacks[l];if(G){const b=T7(l,d,{cancelable:c});return G.slice().forEach(W=>{W.call(I,b)}),!b.defaultPrevented}return!0}}function f7(I,l){return n3().$$.context.set(I,l),l}function j7(I){return n3().$$.context.get(I)}function f4(I,l){const d=I.$$.callbacks[l.type];d&&d.slice().forEach(c=>c.call(this,l))}const i3=[],_0=[];let K3=[];const F9=[],Nd=Promise.resolve();let o9=!1;function Cd(){o9||(o9=!0,Nd.then($9))}function Hd(){return Cd(),Nd}function Al(I){K3.push(I)}function Nl(I){F9.push(I)}const O5=new Set;let u3=0;function $9(){if(u3!==0)return;const I=pl;do{try{for(;u3I.indexOf(c)===-1?l.push(c):d.push(c)),d.forEach(c=>c()),K3=l}const l5=new Set;let O1;function a2(){O1={r:0,c:[],p:O1}}function t2(){O1.r||a0(O1.c),O1=O1.p}function h(I,l){I&&I.i&&(l5.delete(I),I.i(l))}function i(I,l,d,c){if(I&&I.o){if(l5.has(I))return;l5.add(I),O1.c.push(()=>{l5.delete(I),c&&(d&&I.d(1),c())}),I.o(l)}else c&&c()}function j4(I,l){const d=l.token={};function c(G,b,W,t){if(l.token!==d)return;l.resolved=t;let a=l.ctx;W!==void 0&&(a=a.slice(),a[W]=t);const Z=G&&(l.current=G)(a);let e=!1;l.block&&(l.blocks?l.blocks.forEach((n,s)=>{s!==b&&n&&(a2(),i(n,1,1,()=>{l.blocks[s]===n&&(l.blocks[s]=null)}),t2())}):l.block.d(1),Z.c(),h(Z,1),Z.m(l.mount(),l.anchor),e=!0),l.block=Z,l.blocks&&(l.blocks[b]=Z),e&&$9()}if(x7(I)){const G=n3();if(I.then(b=>{A1(G),c(l.then,1,l.value,b),A1(null)},b=>{if(A1(G),c(l.catch,2,l.error,b),A1(null),!l.hasCatch)throw b}),l.current!==l.pending)return c(l.pending,0),!0}else{if(l.current!==l.then)return c(l.then,1,l.value,I),!0;l.resolved=I}}function P7(I,l,d){const c=l.slice(),{resolved:G}=I;I.current===I.then&&(c[I.value]=G),I.current===I.catch&&(c[I.error]=G),I.block.p(c,d)}function q7(I,l){i(I,1,1,()=>{l.delete(I.key)})}function _7(I,l,d,c,G,b,W,t,a,Z,e,n){let s=I.length,p=b.length,A=s;const Q={};for(;A--;)Q[I[A].key]=A;const o=[],V=new Map,g=new Map,B=[];for(A=p;A--;){const Y=n(G,b,A),E=d(Y);let y=W.get(E);y?c&&B.push(()=>y.p(Y,l)):(y=Z(E,Y),y.c()),V.set(E,o[A]=y),E in Q&&g.set(E,Math.abs(A-Q[E]))}const R=new Set,r=new Set;function u(Y){h(Y,1),Y.m(t,e),W.set(Y.key,Y),e=Y.first,p--}for(;s&&p;){const Y=o[p-1],E=I[s-1],y=Y.key,C=E.key;Y===E?(e=Y.first,s--,p--):V.has(C)?!W.has(y)||R.has(y)?u(Y):r.has(C)?s--:g.get(y)>g.get(C)?(r.add(y),u(Y)):(R.add(C),s--):(a(E,W),s--)}for(;s--;){const Y=I[s];V.has(Y.key)||a(Y,W)}for(;p;)u(o[p-1]);return a0(B),o}function O0(I,l){const d={},c={},G={$$scope:1};let b=I.length;for(;b--;){const W=I[b],t=l[b];if(t){for(const a in W)a in t||(c[a]=1);for(const a in t)G[a]||(d[a]=t[a],G[a]=1);I[b]=t}else for(const a in W)G[a]=1}for(const W in c)W in d||(d[W]=void 0);return d}function $0(I){return typeof I=="object"&&I!==null?I:{}}function Cl(I,l,d){const c=I.$$.props[l];c!==void 0&&(I.$$.bound[c]=d,d(I.$$.ctx[c]))}function P(I){I&&I.c()}function D(I,l,d,c){const{fragment:G,after_update:b}=I.$$;G&&G.m(l,d),c||Al(()=>{const W=I.$$.on_mount.map(id).filter(y1);I.$$.on_destroy?I.$$.on_destroy.push(...W):a0(W),I.$$.on_mount=[]}),b.forEach(Al)}function O(I,l){const d=I.$$;d.fragment!==null&&(O7(d.after_update),a0(d.on_destroy),d.fragment&&d.fragment.d(l),d.on_destroy=d.fragment=null,d.ctx=[])}function $7(I,l){I.$$.dirty[0]===-1&&(i3.push(I),Cd(),I.$$.dirty.fill(0)),I.$$.dirty[l/31|0]|=1<{const A=p.length?p[0]:s;return Z.ctx&&G(Z.ctx[n],Z.ctx[n]=A)&&(!Z.skip_bound&&Z.bound[n]&&Z.bound[n](A),e&&$7(I,n)),s}):[],Z.update(),e=!0,a0(Z.before_update),Z.fragment=c?c(Z.ctx):!1,l.target){if(l.hydrate){const n=z7(l.target);Z.fragment&&Z.fragment.l(n),n.forEach(H)}else Z.fragment&&Z.fragment.c();l.intro&&h(I.$$.fragment),D(I,l.target,l.anchor,l.customElement),$9()}A1(a)}class C2{$destroy(){O(this,1),this.$destroy=c2}$on(l,d){if(!y1(d))return c2;const c=this.$$.callbacks[l]||(this.$$.callbacks[l]=[]);return c.push(d),()=>{const G=c.indexOf(d);G!==-1&&c.splice(G,1)}}$set(l){this.$$set&&!M7(l)&&(this.$$.skip_bound=!0,this.$$set(l),this.$$.skip_bound=!1)}}function D4(I){if(!I)throw Error("Parameter args is required");if(!I.component==!I.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(I.component&&(I.asyncComponent=()=>Promise.resolve(I.component)),typeof I.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(I.conditions){Array.isArray(I.conditions)||(I.conditions=[I.conditions]);for(let d=0;d{c.delete(Z),c.size===0&&d&&(d(),d=null)}}return{set:G,update:b,subscribe:W}}function Ed(I,l,d){const c=!Array.isArray(I),G=c?[I]:I,b=l.length<2;return Kd(d,W=>{let t=!1;const a=[];let Z=0,e=c2;const n=()=>{if(Z)return;e();const p=l(c?a[0]:a,W);b?W(p):e=y1(p)?p:c2},s=G.map((p,A)=>q9(p,Q=>{a[A]=Q,Z&=~(1<{Z|=1<{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("routeEvent",t[7]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){t&&H(d),l&&O(l,t)}}}function dc(I){let l,d,c;const G=[{params:I[1]},I[2]];var b=I[0];function W(t){let a={};for(let Z=0;Z{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("routeEvent",t[6]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){t&&H(d),l&&O(l,t)}}}function cc(I){let l,d,c,G;const b=[dc,Ic],W=[];function t(a,Z){return a[1]?0:1}return l=t(I),d=W[l]=b[l](I),{c(){d.c(),c=r2()},m(a,Z){W[l].m(a,Z),K(a,c,Z),G=!0},p(a,[Z]){let e=l;l=t(a),l===e?W[l].p(a,Z):(a2(),i(W[e],1,1,()=>{W[e]=null}),t2(),d=W[l],d?d.p(a,Z):(d=W[l]=b[l](a),d.c()),h(d,1),d.m(c.parentNode,c))},i(a){G||(h(d),G=!0)},o(a){i(d),G=!1},d(a){W[l].d(a),a&&H(c)}}}function O4(){const I=window.location.href.indexOf("#/");let l=I>-1?window.location.href.substr(I+1):"/";const d=l.indexOf("?");let c="";return d>-1&&(c=l.substr(d+1),l=l.substr(0,d)),{location:l,querystring:c}}const l4=Kd(null,function(l){l(O4());const d=()=>{l(O4())};return window.addEventListener("hashchange",d,!1),function(){window.removeEventListener("hashchange",d,!1)}}),Gc=Ed(l4,I=>I.location),Jd=Ed(l4,I=>I.querystring),n5=B0(void 0);async function q0(I){if(!I||I.length<1||I.charAt(0)!="/"&&I.indexOf("#/")!==0)throw Error("Invalid parameter location");await Hd();const l=(I.charAt(0)=="#"?"":"#")+I;try{const d={...history.state};delete d.__svelte_spa_router_scrollX,delete d.__svelte_spa_router_scrollY,window.history.replaceState(d,void 0,l)}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 bc(I){I?window.scrollTo(I.__svelte_spa_router_scrollX,I.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function Wc(I,l,d){let{routes:c={}}=l,{prefix:G=""}=l,{restoreScrollState:b=!1}=l;class W{constructor(r,u){if(!u||typeof u!="function"&&(typeof u!="object"||u._sveltesparouter!==!0))throw Error("Invalid component object");if(!r||typeof r=="string"&&(r.length<1||r.charAt(0)!="/"&&r.charAt(0)!="*")||typeof r=="object"&&!(r instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:Y,keys:E}=lc(r);this.path=r,typeof u=="object"&&u._sveltesparouter===!0?(this.component=u.component,this.conditions=u.conditions||[],this.userData=u.userData,this.props=u.props||{}):(this.component=()=>Promise.resolve(u),this.conditions=[],this.props={}),this._pattern=Y,this._keys=E}match(r){if(G){if(typeof G=="string")if(r.startsWith(G))r=r.substr(G.length)||"/";else return null;else if(G instanceof RegExp){const y=r.match(G);if(y&&y[0])r=r.substr(y[0].length)||"/";else return null}}const u=this._pattern.exec(r);if(u===null)return null;if(this._keys===!1)return u;const Y={};let E=0;for(;E{t.push(new W(r,R))}):Object.keys(c).forEach(R=>{t.push(new W(R,c[R]))});let a=null,Z=null,e={};const n=Yl();async function s(R,r){await Hd(),n(R,r)}let p=null,A=null;b&&(A=R=>{R.state&&(R.state.__svelte_spa_router_scrollY||R.state.__svelte_spa_router_scrollX)?p=R.state:p=null},window.addEventListener("popstate",A),s3(()=>{bc(p)}));let Q=null,o=null;const V=l4.subscribe(async R=>{Q=R;let r=0;for(;r{n5.set(Z)});return}d(0,a=null),o=null,n5.set(void 0)});Yd(()=>{V(),A&&window.removeEventListener("popstate",A)});function g(R){f4.call(this,I,R)}function B(R){f4.call(this,I,R)}return I.$$set=R=>{"routes"in R&&d(3,c=R.routes),"prefix"in R&&d(4,G=R.prefix),"restoreScrollState"in R&&d(5,b=R.restoreScrollState)},I.$$.update=()=>{I.$$.dirty&32&&(history.scrollRestoration=b?"manual":"auto")},[a,Z,e,c,G,b,g,B]}class ac extends C2{constructor(l){super(),N2(this,l,Wc,cc,g2,{routes:3,prefix:4,restoreScrollState:5})}}let Ul;const tc=new Uint8Array(16);function Zc(){if(!Ul&&(Ul=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ul))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ul(tc)}const Q0=[];for(let I=0;I<256;++I)Q0.push((I+256).toString(16).slice(1));function ec(I,l=0){return Q0[I[l+0]]+Q0[I[l+1]]+Q0[I[l+2]]+Q0[I[l+3]]+"-"+Q0[I[l+4]]+Q0[I[l+5]]+"-"+Q0[I[l+6]]+Q0[I[l+7]]+"-"+Q0[I[l+8]]+Q0[I[l+9]]+"-"+Q0[I[l+10]]+Q0[I[l+11]]+Q0[I[l+12]]+Q0[I[l+13]]+Q0[I[l+14]]+Q0[I[l+15]]}const nc=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),P4={randomUUID:nc};function h0(I,l,d){if(P4.randomUUID&&!l&&!I)return P4.randomUUID();I=I||{};const c=I.random||(I.rng||Zc)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){d=d||0;for(let G=0;G<16;++G)l[d+G]=c[G];return l}return ec(c)}const F0=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,m0=Object.keys,r0=Array.isArray;function S0(I,l){return typeof l!="object"||m0(l).forEach(function(d){I[d]=l[d]}),I}typeof Promise>"u"||F0.Promise||(F0.Promise=Promise);const L3=Object.getPrototypeOf,sc={}.hasOwnProperty;function v0(I,l){return sc.call(I,l)}function U3(I,l){typeof l=="function"&&(l=l(L3(I))),(typeof Reflect>"u"?m0:Reflect.ownKeys)(l).forEach(d=>{o1(I,d,l[d])})}const yd=Object.defineProperty;function o1(I,l,d,c){yd(I,l,S0(d&&v0(d,"get")&&typeof d.get=="function"?{get:d.get,set:d.set,configurable:!0}:{value:d,configurable:!0,writable:!0},c))}function E3(I){return{from:function(l){return I.prototype=Object.create(l.prototype),o1(I.prototype,"constructor",I),{extend:U3.bind(null,I.prototype)}}}}const mc=Object.getOwnPropertyDescriptor;function I4(I,l){let d;return mc(I,l)||(d=L3(I))&&I4(d,l)}const pc=[].slice;function s5(I,l,d){return pc.call(I,l,d)}function vd(I,l){return l(I)}function dl(I){if(!I)throw new Error("Assertion Failed")}function Ld(I){F0.setImmediate?setImmediate(I):setTimeout(I,0)}function V1(I,l){if(v0(I,l))return I[l];if(!l)return I;if(typeof l!="string"){for(var d=[],c=0,G=l.length;c["Int","Uint","Float"].map(l=>l+I+"Array")))).filter(I=>F0[I]),xd=new Set(Qc.map(I=>F0[I]));function Md(I){const l={};for(const d in I)if(v0(I,d)){const c=I[d];l[d]=!c||typeof c!="object"||xd.has(c.constructor)?c:Md(c)}return l}let al=null;function L1(I){al=new WeakMap;const l=V9(I);return al=null,l}function V9(I){if(!I||typeof I!="object")return I;let l=al.get(I);if(l)return l;if(r0(I)){l=[],al.set(I,l);for(var d=0,c=I.length;d=0&&I.splice(d,1),d>=0}const w3={};function p1(I){var l,d,c,G;if(arguments.length===1){if(r0(I))return I.slice();if(this===w3&&typeof I=="string")return[I];if(G=oc(I)){for(d=[];!(c=G.next()).done;)d.push(c.value);return d}if(I==null)return[I];if(typeof(l=I.length)=="number"){for(d=new Array(l);l--;)d[l]=I[l];return d}return[I]}for(l=arguments.length,d=new Array(l);l--;)d[l]=arguments[l];return d}const d4=typeof Symbol<"u"?I=>I[Symbol.toStringTag]==="AsyncFunction":()=>!1;var h1=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Sd(I,l){h1=I,zd=l}var zd=()=>!0;const Vc=!new Error("").stack;function m3(){if(Vc)try{throw m3.arguments,new Error}catch(I){return I}return new Error}function u9(I,l){var d=I.stack;return d?(l=l||0,d.indexOf(I.name)===0&&(l+=(I.name+I.message).split(` +var U7=Object.defineProperty;var k7=(I,l,d)=>l in I?U7(I,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):I[l]=d;var R2=(I,l,d)=>(k7(I,typeof l!="symbol"?l+"":l,d),d);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const G of document.querySelectorAll('link[rel="modulepreload"]'))c(G);new MutationObserver(G=>{for(const b of G)if(b.type==="childList")for(const W of b.addedNodes)W.tagName==="LINK"&&W.rel==="modulepreload"&&c(W)}).observe(document,{childList:!0,subtree:!0});function d(G){const b={};return G.integrity&&(b.integrity=G.integrity),G.referrerPolicy&&(b.referrerPolicy=G.referrerPolicy),G.crossOrigin==="use-credentials"?b.credentials="include":G.crossOrigin==="anonymous"?b.credentials="omit":b.credentials="same-origin",b}function c(G){if(G.ep)return;G.ep=!0;const b=d(G);fetch(G.href,b)}})();function c2(){}function e0(I,l){for(const d in l)I[d]=l[d];return I}function x7(I){return!!I&&(typeof I=="object"||typeof I=="function")&&typeof I.then=="function"}function id(I){return I()}function S4(){return Object.create(null)}function a0(I){I.forEach(id)}function y1(I){return typeof I=="function"}function g2(I,l){return I!=I?l==l:I!==l||I&&typeof I=="object"||typeof I=="function"}let Ll;function v1(I,l){return Ll||(Ll=document.createElement("a")),Ll.href=l,I===Ll.href}function M7(I){return Object.keys(I).length===0}function q9(I,...l){if(I==null)return c2;const d=I.subscribe(...l);return d.unsubscribe?()=>d.unsubscribe():d}function w2(I){let l;return q9(I,d=>l=d)(),l}function y2(I,l,d){I.$$.on_destroy.push(q9(l,d))}function O2(I,l,d,c){if(I){const G=wd(I,l,d,c);return I[0](G)}}function wd(I,l,d,c){return I[1]&&c?e0(d.ctx.slice(),I[1](c(l))):d.ctx}function P2(I,l,d,c){if(I[2]&&c){const G=I[2](c(d));if(l.dirty===void 0)return G;if(typeof G=="object"){const b=[],W=Math.max(l.dirty.length,G.length);for(let t=0;t32){const l=[],d=I.ctx.length/32;for(let c=0;cI.removeEventListener(l,d,c)}function B2(I){return function(l){return l.preventDefault(),I.call(this,l)}}function il(I){return function(l){return l.stopPropagation(),I.call(this,l)}}function m(I,l,d){d==null?I.removeAttribute(l):I.getAttribute(l)!==d&&I.setAttribute(l,d)}const S7=["width","height"];function z4(I,l){const d=Object.getOwnPropertyDescriptors(I.__proto__);for(const c in l)l[c]==null?I.removeAttribute(c):c==="style"?I.style.cssText=l[c]:c==="__value"?I.value=I[c]=l[c]:d[c]&&d[c].set&&S7.indexOf(c)===-1?I[c]=l[c]:m(I,c,l[c])}function z7(I){return Array.from(I.childNodes)}function T2(I,l){l=""+l,I.data!==l&&(I.data=l)}function T4(I,l){I.value=l??""}function G1(I,l,d,c){d==null?I.style.removeProperty(l):I.style.setProperty(l,d,c?"important":"")}function f(I,l,d){I.classList[d?"add":"remove"](l)}function T7(I,l,{bubbles:d=!1,cancelable:c=!1}={}){const G=document.createEvent("CustomEvent");return G.initCustomEvent(I,d,c,l),G}class wl{constructor(l=!1){this.is_svg=!1,this.is_svg=l,this.e=this.n=null}c(l){this.h(l)}m(l,d,c=null){this.e||(this.is_svg?this.e=q1(d.nodeName):this.e=X(d.nodeType===11?"TEMPLATE":d.nodeName),this.t=d.tagName!=="TEMPLATE"?d:d.content,this.c(l)),this.i(c)}h(l){this.e.innerHTML=l,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(l){for(let d=0;d{const G=I.$$.callbacks[l];if(G){const b=T7(l,d,{cancelable:c});return G.slice().forEach(W=>{W.call(I,b)}),!b.defaultPrevented}return!0}}function f7(I,l){return n3().$$.context.set(I,l),l}function j7(I){return n3().$$.context.get(I)}function f4(I,l){const d=I.$$.callbacks[l.type];d&&d.slice().forEach(c=>c.call(this,l))}const i3=[],_0=[];let K3=[];const F9=[],Nd=Promise.resolve();let o9=!1;function Cd(){o9||(o9=!0,Nd.then($9))}function Hd(){return Cd(),Nd}function Al(I){K3.push(I)}function Nl(I){F9.push(I)}const O5=new Set;let u3=0;function $9(){if(u3!==0)return;const I=pl;do{try{for(;u3I.indexOf(c)===-1?l.push(c):d.push(c)),d.forEach(c=>c()),K3=l}const l5=new Set;let O1;function a2(){O1={r:0,c:[],p:O1}}function t2(){O1.r||a0(O1.c),O1=O1.p}function h(I,l){I&&I.i&&(l5.delete(I),I.i(l))}function i(I,l,d,c){if(I&&I.o){if(l5.has(I))return;l5.add(I),O1.c.push(()=>{l5.delete(I),c&&(d&&I.d(1),c())}),I.o(l)}else c&&c()}function j4(I,l){const d=l.token={};function c(G,b,W,t){if(l.token!==d)return;l.resolved=t;let a=l.ctx;W!==void 0&&(a=a.slice(),a[W]=t);const Z=G&&(l.current=G)(a);let e=!1;l.block&&(l.blocks?l.blocks.forEach((n,s)=>{s!==b&&n&&(a2(),i(n,1,1,()=>{l.blocks[s]===n&&(l.blocks[s]=null)}),t2())}):l.block.d(1),Z.c(),h(Z,1),Z.m(l.mount(),l.anchor),e=!0),l.block=Z,l.blocks&&(l.blocks[b]=Z),e&&$9()}if(x7(I)){const G=n3();if(I.then(b=>{A1(G),c(l.then,1,l.value,b),A1(null)},b=>{if(A1(G),c(l.catch,2,l.error,b),A1(null),!l.hasCatch)throw b}),l.current!==l.pending)return c(l.pending,0),!0}else{if(l.current!==l.then)return c(l.then,1,l.value,I),!0;l.resolved=I}}function P7(I,l,d){const c=l.slice(),{resolved:G}=I;I.current===I.then&&(c[I.value]=G),I.current===I.catch&&(c[I.error]=G),I.block.p(c,d)}function q7(I,l){i(I,1,1,()=>{l.delete(I.key)})}function _7(I,l,d,c,G,b,W,t,a,Z,e,n){let s=I.length,p=b.length,A=s;const Q={};for(;A--;)Q[I[A].key]=A;const o=[],V=new Map,g=new Map,B=[];for(A=p;A--;){const Y=n(G,b,A),E=d(Y);let y=W.get(E);y?c&&B.push(()=>y.p(Y,l)):(y=Z(E,Y),y.c()),V.set(E,o[A]=y),E in Q&&g.set(E,Math.abs(A-Q[E]))}const R=new Set,r=new Set;function u(Y){h(Y,1),Y.m(t,e),W.set(Y.key,Y),e=Y.first,p--}for(;s&&p;){const Y=o[p-1],E=I[s-1],y=Y.key,C=E.key;Y===E?(e=Y.first,s--,p--):V.has(C)?!W.has(y)||R.has(y)?u(Y):r.has(C)?s--:g.get(y)>g.get(C)?(r.add(y),u(Y)):(R.add(C),s--):(a(E,W),s--)}for(;s--;){const Y=I[s];V.has(Y.key)||a(Y,W)}for(;p;)u(o[p-1]);return a0(B),o}function O0(I,l){const d={},c={},G={$$scope:1};let b=I.length;for(;b--;){const W=I[b],t=l[b];if(t){for(const a in W)a in t||(c[a]=1);for(const a in t)G[a]||(d[a]=t[a],G[a]=1);I[b]=t}else for(const a in W)G[a]=1}for(const W in c)W in d||(d[W]=void 0);return d}function $0(I){return typeof I=="object"&&I!==null?I:{}}function Cl(I,l,d){const c=I.$$.props[l];c!==void 0&&(I.$$.bound[c]=d,d(I.$$.ctx[c]))}function P(I){I&&I.c()}function D(I,l,d,c){const{fragment:G,after_update:b}=I.$$;G&&G.m(l,d),c||Al(()=>{const W=I.$$.on_mount.map(id).filter(y1);I.$$.on_destroy?I.$$.on_destroy.push(...W):a0(W),I.$$.on_mount=[]}),b.forEach(Al)}function O(I,l){const d=I.$$;d.fragment!==null&&(O7(d.after_update),a0(d.on_destroy),d.fragment&&d.fragment.d(l),d.on_destroy=d.fragment=null,d.ctx=[])}function $7(I,l){I.$$.dirty[0]===-1&&(i3.push(I),Cd(),I.$$.dirty.fill(0)),I.$$.dirty[l/31|0]|=1<{const A=p.length?p[0]:s;return Z.ctx&&G(Z.ctx[n],Z.ctx[n]=A)&&(!Z.skip_bound&&Z.bound[n]&&Z.bound[n](A),e&&$7(I,n)),s}):[],Z.update(),e=!0,a0(Z.before_update),Z.fragment=c?c(Z.ctx):!1,l.target){if(l.hydrate){const n=z7(l.target);Z.fragment&&Z.fragment.l(n),n.forEach(H)}else Z.fragment&&Z.fragment.c();l.intro&&h(I.$$.fragment),D(I,l.target,l.anchor,l.customElement),$9()}A1(a)}class C2{$destroy(){O(this,1),this.$destroy=c2}$on(l,d){if(!y1(d))return c2;const c=this.$$.callbacks[l]||(this.$$.callbacks[l]=[]);return c.push(d),()=>{const G=c.indexOf(d);G!==-1&&c.splice(G,1)}}$set(l){this.$$set&&!M7(l)&&(this.$$.skip_bound=!0,this.$$set(l),this.$$.skip_bound=!1)}}function D4(I){if(!I)throw Error("Parameter args is required");if(!I.component==!I.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(I.component&&(I.asyncComponent=()=>Promise.resolve(I.component)),typeof I.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(I.conditions){Array.isArray(I.conditions)||(I.conditions=[I.conditions]);for(let d=0;d{c.delete(Z),c.size===0&&d&&(d(),d=null)}}return{set:G,update:b,subscribe:W}}function Ed(I,l,d){const c=!Array.isArray(I),G=c?[I]:I,b=l.length<2;return Kd(d,W=>{let t=!1;const a=[];let Z=0,e=c2;const n=()=>{if(Z)return;e();const p=l(c?a[0]:a,W);b?W(p):e=y1(p)?p:c2},s=G.map((p,A)=>q9(p,Q=>{a[A]=Q,Z&=~(1<{Z|=1<{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("routeEvent",t[7]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){t&&H(d),l&&O(l,t)}}}function dc(I){let l,d,c;const G=[{params:I[1]},I[2]];var b=I[0];function W(t){let a={};for(let Z=0;Z{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("routeEvent",t[6]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){t&&H(d),l&&O(l,t)}}}function cc(I){let l,d,c,G;const b=[dc,Ic],W=[];function t(a,Z){return a[1]?0:1}return l=t(I),d=W[l]=b[l](I),{c(){d.c(),c=r2()},m(a,Z){W[l].m(a,Z),K(a,c,Z),G=!0},p(a,[Z]){let e=l;l=t(a),l===e?W[l].p(a,Z):(a2(),i(W[e],1,1,()=>{W[e]=null}),t2(),d=W[l],d?d.p(a,Z):(d=W[l]=b[l](a),d.c()),h(d,1),d.m(c.parentNode,c))},i(a){G||(h(d),G=!0)},o(a){i(d),G=!1},d(a){W[l].d(a),a&&H(c)}}}function O4(){const I=window.location.href.indexOf("#/");let l=I>-1?window.location.href.substr(I+1):"/";const d=l.indexOf("?");let c="";return d>-1&&(c=l.substr(d+1),l=l.substr(0,d)),{location:l,querystring:c}}const l4=Kd(null,function(l){l(O4());const d=()=>{l(O4())};return window.addEventListener("hashchange",d,!1),function(){window.removeEventListener("hashchange",d,!1)}}),Gc=Ed(l4,I=>I.location),Jd=Ed(l4,I=>I.querystring),n5=B0(void 0);async function q0(I){if(!I||I.length<1||I.charAt(0)!="/"&&I.indexOf("#/")!==0)throw Error("Invalid parameter location");await Hd();const l=(I.charAt(0)=="#"?"":"#")+I;try{const d={...history.state};delete d.__svelte_spa_router_scrollX,delete d.__svelte_spa_router_scrollY,window.history.replaceState(d,void 0,l)}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 bc(I){I?window.scrollTo(I.__svelte_spa_router_scrollX,I.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function Wc(I,l,d){let{routes:c={}}=l,{prefix:G=""}=l,{restoreScrollState:b=!1}=l;class W{constructor(r,u){if(!u||typeof u!="function"&&(typeof u!="object"||u._sveltesparouter!==!0))throw Error("Invalid component object");if(!r||typeof r=="string"&&(r.length<1||r.charAt(0)!="/"&&r.charAt(0)!="*")||typeof r=="object"&&!(r instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:Y,keys:E}=lc(r);this.path=r,typeof u=="object"&&u._sveltesparouter===!0?(this.component=u.component,this.conditions=u.conditions||[],this.userData=u.userData,this.props=u.props||{}):(this.component=()=>Promise.resolve(u),this.conditions=[],this.props={}),this._pattern=Y,this._keys=E}match(r){if(G){if(typeof G=="string")if(r.startsWith(G))r=r.substr(G.length)||"/";else return null;else if(G instanceof RegExp){const y=r.match(G);if(y&&y[0])r=r.substr(y[0].length)||"/";else return null}}const u=this._pattern.exec(r);if(u===null)return null;if(this._keys===!1)return u;const Y={};let E=0;for(;E{t.push(new W(r,R))}):Object.keys(c).forEach(R=>{t.push(new W(R,c[R]))});let a=null,Z=null,e={};const n=Yl();async function s(R,r){await Hd(),n(R,r)}let p=null,A=null;b&&(A=R=>{R.state&&(R.state.__svelte_spa_router_scrollY||R.state.__svelte_spa_router_scrollX)?p=R.state:p=null},window.addEventListener("popstate",A),s3(()=>{bc(p)}));let Q=null,o=null;const V=l4.subscribe(async R=>{Q=R;let r=0;for(;r{n5.set(Z)});return}d(0,a=null),o=null,n5.set(void 0)});Yd(()=>{V(),A&&window.removeEventListener("popstate",A)});function g(R){f4.call(this,I,R)}function B(R){f4.call(this,I,R)}return I.$$set=R=>{"routes"in R&&d(3,c=R.routes),"prefix"in R&&d(4,G=R.prefix),"restoreScrollState"in R&&d(5,b=R.restoreScrollState)},I.$$.update=()=>{I.$$.dirty&32&&(history.scrollRestoration=b?"manual":"auto")},[a,Z,e,c,G,b,g,B]}class ac extends C2{constructor(l){super(),N2(this,l,Wc,cc,g2,{routes:3,prefix:4,restoreScrollState:5})}}let Ul;const tc=new Uint8Array(16);function Zc(){if(!Ul&&(Ul=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ul))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ul(tc)}const Q0=[];for(let I=0;I<256;++I)Q0.push((I+256).toString(16).slice(1));function ec(I,l=0){return Q0[I[l+0]]+Q0[I[l+1]]+Q0[I[l+2]]+Q0[I[l+3]]+"-"+Q0[I[l+4]]+Q0[I[l+5]]+"-"+Q0[I[l+6]]+Q0[I[l+7]]+"-"+Q0[I[l+8]]+Q0[I[l+9]]+"-"+Q0[I[l+10]]+Q0[I[l+11]]+Q0[I[l+12]]+Q0[I[l+13]]+Q0[I[l+14]]+Q0[I[l+15]]}const nc=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),P4={randomUUID:nc};function h0(I,l,d){if(P4.randomUUID&&!l&&!I)return P4.randomUUID();I=I||{};const c=I.random||(I.rng||Zc)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){d=d||0;for(let G=0;G<16;++G)l[d+G]=c[G];return l}return ec(c)}const F0=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,m0=Object.keys,r0=Array.isArray;function S0(I,l){return typeof l!="object"||m0(l).forEach(function(d){I[d]=l[d]}),I}typeof Promise>"u"||F0.Promise||(F0.Promise=Promise);const L3=Object.getPrototypeOf,sc={}.hasOwnProperty;function v0(I,l){return sc.call(I,l)}function U3(I,l){typeof l=="function"&&(l=l(L3(I))),(typeof Reflect>"u"?m0:Reflect.ownKeys)(l).forEach(d=>{o1(I,d,l[d])})}const yd=Object.defineProperty;function o1(I,l,d,c){yd(I,l,S0(d&&v0(d,"get")&&typeof d.get=="function"?{get:d.get,set:d.set,configurable:!0}:{value:d,configurable:!0,writable:!0},c))}function E3(I){return{from:function(l){return I.prototype=Object.create(l.prototype),o1(I.prototype,"constructor",I),{extend:U3.bind(null,I.prototype)}}}}const mc=Object.getOwnPropertyDescriptor;function I4(I,l){let d;return mc(I,l)||(d=L3(I))&&I4(d,l)}const pc=[].slice;function s5(I,l,d){return pc.call(I,l,d)}function vd(I,l){return l(I)}function dl(I){if(!I)throw new Error("Assertion Failed")}function Ld(I){F0.setImmediate?setImmediate(I):setTimeout(I,0)}function V1(I,l){if(typeof l=="string"&&v0(I,l))return I[l];if(!l)return I;if(typeof l!="string"){for(var d=[],c=0,G=l.length;c["Int","Uint","Float"].map(l=>l+I+"Array")))).filter(I=>F0[I]),xd=new Set(Qc.map(I=>F0[I]));function Md(I){const l={};for(const d in I)if(v0(I,d)){const c=I[d];l[d]=!c||typeof c!="object"||xd.has(c.constructor)?c:Md(c)}return l}let al=null;function L1(I){al=new WeakMap;const l=V9(I);return al=null,l}function V9(I){if(!I||typeof I!="object")return I;let l=al.get(I);if(l)return l;if(r0(I)){l=[],al.set(I,l);for(var d=0,c=I.length;d=0&&I.splice(d,1),d>=0}const w3={};function p1(I){var l,d,c,G;if(arguments.length===1){if(r0(I))return I.slice();if(this===w3&&typeof I=="string")return[I];if(G=oc(I)){for(d=[];!(c=G.next()).done;)d.push(c.value);return d}if(I==null)return[I];if(typeof(l=I.length)=="number"){for(d=new Array(l);l--;)d[l]=I[l];return d}return[I]}for(l=arguments.length,d=new Array(l);l--;)d[l]=arguments[l];return d}const d4=typeof Symbol<"u"?I=>I[Symbol.toStringTag]==="AsyncFunction":()=>!1;var h1=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Sd(I,l){h1=I,zd=l}var zd=()=>!0;const Vc=!new Error("").stack;function m3(){if(Vc)try{throw m3.arguments,new Error}catch(I){return I}return new Error}function u9(I,l){var d=I.stack;return d?(l=l||0,d.indexOf(I.name)===0&&(l+=(I.name+I.message).split(` `).length),d.split(` `).slice(l).filter(zd).map(c=>` `+c).join("")):""}var Td=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],c4=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Td),Xc={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function J3(I,l){this._e=m3(),this.name=I,this.message=l}function fd(I,l){return I+". Errors: "+Object.keys(l).map(d=>l[d].toString()).filter((d,c,G)=>G.indexOf(d)===c).join(` `)}function m5(I,l,d,c){this._e=m3(),this.failures=l,this.failedKeys=c,this.successCount=d,this.message=fd(I,l)}function N3(I,l){this._e=m3(),this.name="BulkError",this.failures=Object.keys(l).map(d=>l[d]),this.failuresByPos=l,this.message=fd(I,this.failures)}E3(J3).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+u9(this._e,2))}},toString:function(){return this.name+": "+this.message}}),E3(m5).from(J3),E3(N3).from(J3);var G4=c4.reduce((I,l)=>(I[l]=l+"Error",I),{});const gc=J3;var h2=c4.reduce((I,l)=>{var d=l+"Error";function c(G,b){this._e=m3(),this.name=d,G?typeof G=="string"?(this.message=`${G}${b?` `+b:""}`,this.inner=b||null):typeof G=="object"&&(this.message=`${G.name} ${G.message}`,this.inner=G):(this.message=Xc[l]||d,this.inner=null)}return E3(c).from(gc),I[l]=c,I},{});h2.Syntax=SyntaxError,h2.Type=TypeError,h2.Range=RangeError;var q4=Td.reduce((I,l)=>(I[l+"Error"]=h2[l],I),{}),I5=c4.reduce((I,l)=>(["Syntax","Type","Range"].indexOf(l)===-1&&(I[l+"Error"]=h2[l]),I),{});function D2(){}function Ql(I){return I}function uc(I,l){return I==null||I===Ql?l:function(d){return l(I(d))}}function b3(I,l){return function(){I.apply(this,arguments),l.apply(this,arguments)}}function Rc(I,l){return I===D2?l:function(){var d=I.apply(this,arguments);d!==void 0&&(arguments[0]=d);var c=this.onsuccess,G=this.onerror;this.onsuccess=null,this.onerror=null;var b=l.apply(this,arguments);return c&&(this.onsuccess=this.onsuccess?b3(c,this.onsuccess):c),G&&(this.onerror=this.onerror?b3(G,this.onerror):G),b!==void 0?b:d}}function hc(I,l){return I===D2?l:function(){I.apply(this,arguments);var d=this.onsuccess,c=this.onerror;this.onsuccess=this.onerror=null,l.apply(this,arguments),d&&(this.onsuccess=this.onsuccess?b3(d,this.onsuccess):d),c&&(this.onerror=this.onerror?b3(c,this.onerror):c)}}function rc(I,l){return I===D2?l:function(d){var c=I.apply(this,arguments);S0(d,c);var G=this.onsuccess,b=this.onerror;this.onsuccess=null,this.onerror=null;var W=l.apply(this,arguments);return G&&(this.onsuccess=this.onsuccess?b3(G,this.onsuccess):G),b&&(this.onerror=this.onerror?b3(b,this.onerror):b),c===void 0?W===void 0?void 0:W:S0(c,W)}}function Bc(I,l){return I===D2?l:function(){return l.apply(this,arguments)!==!1&&I.apply(this,arguments)}}function b4(I,l){return I===D2?l:function(){var d=I.apply(this,arguments);if(d&&typeof d.then=="function"){for(var c=this,G=arguments.length,b=new Array(G);G--;)b[G]=arguments[G];return d.then(function(){return l.apply(c,b)})}return l.apply(this,arguments)}}I5.ModifyError=m5,I5.DexieError=J3,I5.BulkError=N3;var Fl={};const[_4,p5,ic]=typeof Promise>"u"?[]:(()=>{let I=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[I,L3(I),I];const l=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[l,L3(l),I]})(),wc=p5&&p5.then,d5=_4&&_4.constructor,W4=!!ic;var R9=!1,tl=function(I,l){Gl.push([I,l]),A5&&(queueMicrotask(Nc),A5=!1)},h9=!0,A5=!0,_1=[],c5=[],r9=null,B9=Ql,E1={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:D2,pgp:!1,env:{},finalize:D2},X2=E1,Gl=[],$1=0,G5=[];function m2(I){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var l=this._PSD=X2;if(h1&&(this._stackHolder=m3(),this._prev=null,this._numPrev=0),typeof I!="function"){if(I!==Fl)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&w9(this,this._value))}this._state=null,this._value=null,++l.ref,Dd(this,I)}const i9={get:function(){var I=X2,l=Q5;function d(c,G){var b=!I.global&&(I!==X2||l!==Q5);const W=b&&!k1();var t=new m2((a,Z)=>{a4(this,new jd(F5(c,I,b,W),F5(G,I,b,W),a,Z,I))});return h1&&qd(t,this),t}return d.prototype=Fl,d},set:function(I){o1(this,"then",I&&I.prototype===Fl?i9:{get:function(){return I},set:i9.set})}};function jd(I,l,d,c,G){this.onFulfilled=typeof I=="function"?I:null,this.onRejected=typeof l=="function"?l:null,this.resolve=d,this.reject=c,this.psd=G}function Dd(I,l){try{l(d=>{if(I._state===null){if(d===I)throw new TypeError("A promise cannot be resolved with itself.");var c=I._lib&&T3();d&&typeof d.then=="function"?Dd(I,(G,b)=>{d instanceof m2?d._then(G,b):d.then(G,b)}):(I._state=!0,I._value=d,Od(I)),c&&f3()}},w9.bind(null,I))}catch(d){w9(I,d)}}function w9(I,l){if(c5.push(l),I._state===null){var d=I._lib&&T3();l=B9(l),I._state=!1,I._value=l,h1&&l!==null&&typeof l=="object"&&!l._promise&&function(c,G,b){try{c.apply(null,b)}catch(W){G&&G(W)}}(()=>{var c=I4(l,"stack");l._promise=I,o1(l,"stack",{get:()=>R9?c&&(c.get?c.get.apply(l):c.value):I.stack})}),function(c){_1.some(G=>G._value===c._value)||_1.push(c)}(I),Od(I),d&&f3()}}function Od(I){var l=I._listeners;I._listeners=[];for(var d=0,c=l.length;d{--$1==0&&t4()},[]))}function a4(I,l){if(I._state!==null){var d=I._state?l.onFulfilled:l.onRejected;if(d===null)return(I._state?l.resolve:l.reject)(I._value);++l.psd.ref,++$1,tl(Yc,[d,I,l])}else I._listeners.push(l)}function Yc(I,l,d){try{r9=l;var c,G=l._value;l._state?c=I(G):(c5.length&&(c5=[]),c=I(G),c5.indexOf(G)===-1&&function(b){for(var W=_1.length;W;)if(_1[--W]._value===b._value)return void _1.splice(W,1)}(l)),d.resolve(c)}catch(b){d.reject(b)}finally{r9=null,--$1==0&&t4(),--d.psd.ref||d.psd.finalize()}}function Pd(I,l,d){if(l.length===d)return l;var c="";if(I._state===!1){var G,b,W=I._value;W!=null?(G=W.name||"Error",b=W.message||W,c=u9(W,0)):(G=W,b=""),l.push(G+(b?": "+b:"")+c)}return h1&&((c=u9(I._stackHolder,2))&&l.indexOf(c)===-1&&l.push(c),I._prev&&Pd(I._prev,l,d)),l}function qd(I,l){var d=l?l._numPrev+1:0;d<100&&(I._prev=l,I._numPrev=d)}function Nc(){W3(E1,()=>{T3()&&f3()})}function T3(){var I=h9;return h9=!1,A5=!1,I}function f3(){var I,l,d;do for(;Gl.length>0;)for(I=Gl,Gl=[],d=I.length,l=0;l0);h9=!0,A5=!0}function t4(){var I=_1;_1=[],I.forEach(c=>{c._PSD.onunhandled.call(null,c._value,c)});for(var l=G5.slice(0),d=l.length;d;)l[--d]()}function kl(I){return new m2(Fl,!1,I)}function d0(I,l){var d=X2;return function(){var c=T3(),G=X2;try{return x1(d,!0),I.apply(this,arguments)}catch(b){l&&l(b)}finally{x1(G,!1),c&&f3()}}}U3(m2.prototype,{then:i9,_then:function(I,l){a4(this,new jd(null,null,I,l,X2))},catch:function(I){if(arguments.length===1)return this.then(null,I);var l=arguments[0],d=arguments[1];return typeof l=="function"?this.then(null,c=>c instanceof l?d(c):kl(c)):this.then(null,c=>c&&c.name===l?d(c):kl(c))},finally:function(I){return this.then(l=>(I(),l),l=>(I(),kl(l)))},stack:{get:function(){if(this._stack)return this._stack;try{R9=!0;var I=Pd(this,[],20).join(` -From previous: `);return this._state!==null&&(this._stack=I),I}finally{R9=!1}}},timeout:function(I,l){return I<1/0?new m2((d,c)=>{var G=setTimeout(()=>c(new h2.Timeout(l)),I);this.then(d,c).finally(clearTimeout.bind(null,G))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&o1(m2.prototype,Symbol.toStringTag,"Dexie.Promise"),E1.env=_d(),U3(m2,{all:function(){var I=p1.apply(null,arguments).map(xl);return new m2(function(l,d){I.length===0&&l([]);var c=I.length;I.forEach((G,b)=>m2.resolve(G).then(W=>{I[b]=W,--c||l(I)},d))})},resolve:I=>{if(I instanceof m2)return I;if(I&&typeof I.then=="function")return new m2((d,c)=>{I.then(d,c)});var l=new m2(Fl,!0,I);return qd(l,r9),l},reject:kl,race:function(){var I=p1.apply(null,arguments).map(xl);return new m2((l,d)=>{I.map(c=>m2.resolve(c).then(l,d))})},PSD:{get:()=>X2,set:I=>X2=I},totalEchoes:{get:()=>Q5},newPSD:U1,usePSD:W3,scheduler:{get:()=>tl,set:I=>{tl=I}},rejectionMapper:{get:()=>B9,set:I=>{B9=I}},follow:(I,l)=>new m2((d,c)=>U1((G,b)=>{var W=X2;W.unhandleds=[],W.onunhandled=b,W.finalize=b3(function(){(function(t){function a(){t(),G5.splice(G5.indexOf(a),1)}G5.push(a),++$1,tl(()=>{--$1==0&&t4()},[])})(()=>{this.unhandleds.length===0?G():b(this.unhandleds[0])})},W.finalize),I()},l,d,c))}),d5&&(d5.allSettled&&o1(m2,"allSettled",function(){const I=p1.apply(null,arguments).map(xl);return new m2(l=>{I.length===0&&l([]);let d=I.length;const c=new Array(d);I.forEach((G,b)=>m2.resolve(G).then(W=>c[b]={status:"fulfilled",value:W},W=>c[b]={status:"rejected",reason:W}).then(()=>--d||l(c)))})}),d5.any&&typeof AggregateError<"u"&&o1(m2,"any",function(){const I=p1.apply(null,arguments).map(xl);return new m2((l,d)=>{I.length===0&&d(new AggregateError([]));let c=I.length;const G=new Array(c);I.forEach((b,W)=>m2.resolve(b).then(t=>l(t),t=>{G[W]=t,--c||d(new AggregateError(G))}))})}));const R0={awaits:0,echoes:0,id:0};var Cc=0,b5=[],P5=0,Q5=0,Hc=0;function U1(I,l,d,c){var G=X2,b=Object.create(G);b.parent=G,b.ref=0,b.global=!1,b.id=++Hc;var W=E1.env;b.env=W4?{Promise:m2,PromiseProp:{value:m2,configurable:!0,writable:!0},all:m2.all,race:m2.race,allSettled:m2.allSettled,any:m2.any,resolve:m2.resolve,reject:m2.reject,nthen:$4(W.nthen,b),gthen:$4(W.gthen,b)}:{},l&&S0(b,l),++G.ref,b.finalize=function(){--this.parent.ref||this.parent.finalize()};var t=W3(b,I,d,c);return b.ref===0&&b.finalize(),t}function j3(){return R0.id||(R0.id=++Cc),++R0.awaits,R0.echoes+=100,R0.id}function k1(){return!!R0.awaits&&(--R0.awaits==0&&(R0.id=0),R0.echoes=100*R0.awaits,!0)}function xl(I){return R0.echoes&&I&&I.constructor===d5?(j3(),I.then(l=>(k1(),l),l=>(k1(),Z0(l)))):I}function Kc(I){++Q5,R0.echoes&&--R0.echoes!=0||(R0.echoes=R0.id=0),b5.push(X2),x1(I,!0)}function Ec(){var I=b5[b5.length-1];b5.pop(),x1(I,!1)}function x1(I,l){var d=X2;if((l?!R0.echoes||P5++&&I===X2:!P5||--P5&&I===X2)||queueMicrotask(l?Kc.bind(null,I):Ec),I!==X2&&(X2=I,d===E1&&(E1.env=_d()),W4)){var c=E1.env.Promise,G=I.env;p5.then=G.nthen,c.prototype.then=G.gthen,(d.global||I.global)&&(Object.defineProperty(F0,"Promise",G.PromiseProp),c.all=G.all,c.race=G.race,c.resolve=G.resolve,c.reject=G.reject,G.allSettled&&(c.allSettled=G.allSettled),G.any&&(c.any=G.any))}}function _d(){var I=F0.Promise;return W4?{Promise:I,PromiseProp:Object.getOwnPropertyDescriptor(F0,"Promise"),all:I.all,race:I.race,allSettled:I.allSettled,any:I.any,resolve:I.resolve,reject:I.reject,nthen:p5.then,gthen:I.prototype.then}:{}}function W3(I,l,d,c,G){var b=X2;try{return x1(I,!0),l(d,c,G)}finally{x1(b,!1)}}function F5(I,l,d,c){return typeof I!="function"?I:function(){var G=X2;d&&j3(),x1(l,!0);try{return I.apply(this,arguments)}finally{x1(G,!1),c&&queueMicrotask(k1)}}}function $4(I,l){return function(d,c){return I.call(this,F5(d,l),F5(c,l))}}(""+wc).indexOf("[native code]")===-1&&(j3=k1=D2);var Z0=m2.reject;function Y9(I,l,d,c){if(I.idbdb&&(I._state.openComplete||X2.letThrough||I._vip)){var G=I._createTransaction(l,d,I._dbSchema);try{G.create(),I._state.PR1398_maxLoop=3}catch(b){return b.name===G4.InvalidState&&I.isOpen()&&--I._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),I._close(),I.open().then(()=>Y9(I,l,d,c))):Z0(b)}return G._promise(l,(b,W)=>U1(()=>(X2.trans=G,c(b,W,G)))).then(b=>{if(l==="readwrite")try{G.idbtrans.commit()}catch{}return l==="readonly"?b:G._completion.then(()=>b)})}if(I._state.openComplete)return Z0(new h2.DatabaseClosed(I._state.dbOpenError));if(!I._state.isBeingOpened){if(!I._options.autoOpen)return Z0(new h2.DatabaseClosed);I.open().catch(D2)}return I._state.dbReadyPromise.then(()=>Y9(I,l,d,c))}const P1=String.fromCharCode(65535),s1="Invalid key provided. Keys must be of type string, number, Date or Array.",Zl=[],v5=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Jc=v5,yc=v5,$d=I=>!/(dexie\.js|dexie\.min\.js)/.test(I);function a3(I,l){return I?l?function(){return I.apply(this,arguments)&&l.apply(this,arguments)}:I:l}const l6={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Ml(I){return typeof I!="string"||/\./.test(I)?l=>l:l=>(l[I]===void 0&&I in l&&delete(l=L1(l))[I],l)}function vc(){throw h2.Type()}function S2(I,l){try{const d=lI(I),c=lI(l);if(d!==c)return d==="Array"?1:c==="Array"?-1:d==="binary"?1:c==="binary"?-1:d==="string"?1:c==="string"?-1:d==="Date"?1:c!=="Date"?NaN:-1;switch(d){case"number":case"Date":case"string":return I>l?1:IG._promise(l,W,c),{trans:G,transless:X2.transless||X2}):Y9(this.db,l,[this.name],W)}finally{t&&f3()}}get(l,d){return l&&l.constructor===Object?this.where(l).first(d):this._trans("readonly",c=>this.core.get({trans:c,key:l}).then(G=>this.hook.reading.fire(G))).then(d)}where(l){if(typeof l=="string")return new this.db.WhereClause(this,l);if(r0(l))return new this.db.WhereClause(this,`[${l.join("+")}]`);const d=m0(l);if(d.length===1)return this.where(d[0]).equals(l[d[0]]);const c=this.schema.indexes.concat(this.schema.primKey).filter(Z=>{if(Z.compound&&d.every(e=>Z.keyPath.indexOf(e)>=0)){for(let e=0;eZ.keyPath.length-e.keyPath.length)[0];if(c&&this.db._maxKey!==P1){const Z=c.keyPath.slice(0,d.length);return this.where(Z).equals(Z.map(e=>l[e]))}!c&&h1&&console.warn(`The query ${JSON.stringify(l)} on ${this.name} would benefit of a compound index [${d.join("+")}]`);const{idxByName:G}=this.schema,b=this.db._deps.indexedDB;function W(Z,e){return b.cmp(Z,e)===0}const[t,a]=d.reduce(([Z,e],n)=>{const s=G[n],p=l[n];return[Z||s,Z||!s?a3(e,s&&s.multi?A=>{const Q=V1(A,n);return r0(Q)&&Q.some(o=>W(p,o))}:A=>W(p,V1(A,n))):e]},[null,null]);return t?this.where(t.name).equals(l[t.keyPath]).filter(a):c?this.filter(a):this.where(d).equals("")}filter(l){return this.toCollection().and(l)}count(l){return this.toCollection().count(l)}offset(l){return this.toCollection().offset(l)}limit(l){return this.toCollection().limit(l)}each(l){return this.toCollection().each(l)}toArray(l){return this.toCollection().toArray(l)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(l){return new this.db.Collection(new this.db.WhereClause(this,r0(l)?`[${l.join("+")}]`:l))}reverse(){return this.toCollection().reverse()}mapToClass(l){const{db:d,name:c}=this;this.schema.mappedClass=l,l.prototype instanceof vc&&(l=class extends l{get db(){return d}table(){return c}});const G=new Set;for(let W=l.prototype;W;W=L3(W))Object.getOwnPropertyNames(W).forEach(t=>G.add(t));const b=W=>{if(!W)return W;const t=Object.create(l.prototype);for(let a in W)if(!G.has(a))try{t[a]=W[a]}catch{}return t};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=b,this.hook("reading",b),l}defineClass(){return this.mapToClass(function(l){S0(this,l)})}add(l,d){const{auto:c,keyPath:G}=this.schema.primKey;let b=l;return G&&c&&(b=Ml(G)(l)),this._trans("readwrite",W=>this.core.mutate({trans:W,type:"add",keys:d!=null?[d]:null,values:[b]})).then(W=>W.numFailures?m2.reject(W.failures[0]):W.lastResult).then(W=>{if(G)try{f0(l,G,W)}catch{}return W})}update(l,d){if(typeof l!="object"||r0(l))return this.where(":id").equals(l).modify(d);{const c=V1(l,this.schema.primKey.keyPath);return c===void 0?Z0(new h2.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(c).modify(d)}}put(l,d){const{auto:c,keyPath:G}=this.schema.primKey;let b=l;return G&&c&&(b=Ml(G)(l)),this._trans("readwrite",W=>this.core.mutate({trans:W,type:"put",values:[b],keys:d!=null?[d]:null})).then(W=>W.numFailures?m2.reject(W.failures[0]):W.lastResult).then(W=>{if(G)try{f0(l,G,W)}catch{}return W})}delete(l){return this._trans("readwrite",d=>this.core.mutate({trans:d,type:"delete",keys:[l]})).then(d=>d.numFailures?m2.reject(d.failures[0]):void 0)}clear(){return this._trans("readwrite",l=>this.core.mutate({trans:l,type:"deleteRange",range:l6})).then(l=>l.numFailures?m2.reject(l.failures[0]):void 0)}bulkGet(l){return this._trans("readonly",d=>this.core.getMany({keys:l,trans:d}).then(c=>c.map(G=>this.hook.reading.fire(G))))}bulkAdd(l,d,c){const G=Array.isArray(d)?d:void 0,b=(c=c||(G?void 0:d))?c.allKeys:void 0;return this._trans("readwrite",W=>{const{auto:t,keyPath:a}=this.schema.primKey;if(a&&G)throw new h2.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(G&&G.length!==l.length)throw new h2.InvalidArgument("Arguments objects and keys must have the same length");const Z=l.length;let e=a&&t?l.map(Ml(a)):l;return this.core.mutate({trans:W,type:"add",keys:G,values:e,wantResults:b}).then(({numFailures:n,results:s,lastResult:p,failures:A})=>{if(n===0)return b?s:p;throw new N3(`${this.name}.bulkAdd(): ${n} of ${Z} operations failed`,A)})})}bulkPut(l,d,c){const G=Array.isArray(d)?d:void 0,b=(c=c||(G?void 0:d))?c.allKeys:void 0;return this._trans("readwrite",W=>{const{auto:t,keyPath:a}=this.schema.primKey;if(a&&G)throw new h2.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(G&&G.length!==l.length)throw new h2.InvalidArgument("Arguments objects and keys must have the same length");const Z=l.length;let e=a&&t?l.map(Ml(a)):l;return this.core.mutate({trans:W,type:"put",keys:G,values:e,wantResults:b}).then(({numFailures:n,results:s,lastResult:p,failures:A})=>{if(n===0)return b?s:p;throw new N3(`${this.name}.bulkPut(): ${n} of ${Z} operations failed`,A)})})}bulkUpdate(l){const d=this.core,c=l.map(W=>W.key),G=l.map(W=>W.changes),b=[];return this._trans("readwrite",W=>d.getMany({trans:W,keys:c,cache:"clone"}).then(t=>{const a=[],Z=[];l.forEach(({key:n,changes:s},p)=>{const A=t[p];if(A){for(const Q of Object.keys(s)){const o=s[Q];if(Q===this.schema.primKey.keyPath){if(S2(o,n)!==0)throw new h2.Constraint("Cannot update primary key in bulkUpdate()")}else f0(A,Q,o)}b.push(p),a.push(n),Z.push(A)}});const e=a.length;return d.mutate({trans:W,type:"put",keys:a,values:Z,updates:{keys:c,changeSpecs:G}}).then(({numFailures:n,failures:s})=>{if(n===0)return e;for(const p of Object.keys(s)){const A=b[Number(p)];if(A!=null){const Q=s[p];delete s[p],s[A]=Q}}throw new N3(`${this.name}.bulkUpdate(): ${n} of ${e} operations failed`,s)})}))}bulkDelete(l){const d=l.length;return this._trans("readwrite",c=>this.core.mutate({trans:c,type:"delete",keys:l})).then(({numFailures:c,lastResult:G,failures:b})=>{if(c===0)return G;throw new N3(`${this.name}.bulkDelete(): ${c} of ${d} operations failed`,b)})}}function el(I){var l={},d=function(t,a){if(a){for(var Z=arguments.length,e=new Array(Z-1);--Z;)e[Z-1]=arguments[Z];return l[t].subscribe.apply(null,e),I}if(typeof t=="string")return l[t]};d.addEventType=b;for(var c=1,G=arguments.length;ca3(c(),l()):l,I.justLimit=d&&!c}function W5(I,l){if(I.isPrimKey)return l.primaryKey;const d=l.getIndexByKeyPath(I.index);if(!d)throw new h2.Schema("KeyPath "+I.index+" on object store "+l.name+" is not indexed");return d}function cI(I,l,d){const c=W5(I,l.schema);return l.openCursor({trans:d,values:!I.keysOnly,reverse:I.dir==="prev",unique:!!I.unique,query:{index:c,range:I.range}})}function Sl(I,l,d,c){const G=I.replayFilter?a3(I.filter,I.replayFilter()):I.filter;if(I.or){const b={},W=(t,a,Z)=>{if(!G||G(a,Z,s=>a.stop(s),s=>a.fail(s))){var e=a.primaryKey,n=""+e;n==="[object ArrayBuffer]"&&(n=""+new Uint8Array(e)),v0(b,n)||(b[n]=!0,l(t,a,Z))}};return Promise.all([I.or._iterate(W,d),GI(cI(I,c,d),I.algorithm,W,!I.keysOnly&&I.valueMapper)])}return GI(cI(I,c,d),a3(I.algorithm,G),l,!I.keysOnly&&I.valueMapper)}function GI(I,l,d,c){var G=d0(c?(b,W,t)=>d(c(b),W,t):d);return I.then(b=>{if(b)return b.start(()=>{var W=()=>b.continue();l&&!l(b,t=>W=t,t=>{b.stop(t),W=D2},t=>{b.fail(t),W=D2})||G(b.value,b,t=>W=t),W()})})}class Lc{_read(l,d){var c=this._ctx;return c.error?c.table._trans(null,Z0.bind(null,c.error)):c.table._trans("readonly",l).then(d)}_write(l){var d=this._ctx;return d.error?d.table._trans(null,Z0.bind(null,d.error)):d.table._trans("readwrite",l,"locked")}_addAlgorithm(l){var d=this._ctx;d.algorithm=a3(d.algorithm,l)}_iterate(l,d){return Sl(this._ctx,l,d,this._ctx.table.core)}clone(l){var d=Object.create(this.constructor.prototype),c=Object.create(this._ctx);return l&&S0(c,l),d._ctx=c,d}raw(){return this._ctx.valueMapper=null,this}each(l){var d=this._ctx;return this._read(c=>Sl(d,l,c,d.table.core))}count(l){return this._read(d=>{const c=this._ctx,G=c.table.core;if(h3(c,!0))return G.count({trans:d,query:{index:W5(c,G.schema),range:c.range}}).then(W=>Math.min(W,c.limit));var b=0;return Sl(c,()=>(++b,!1),d,G).then(()=>b)}).then(l)}sortBy(l,d){const c=l.split(".").reverse(),G=c[0],b=c.length-1;function W(Z,e){return e?W(Z[c[e]],e-1):Z[G]}var t=this._ctx.dir==="next"?1:-1;function a(Z,e){var n=W(Z,b),s=W(e,b);return ns?t:0}return this.toArray(function(Z){return Z.sort(a)}).then(d)}toArray(l){return this._read(d=>{var c=this._ctx;if(c.dir==="next"&&h3(c,!0)&&c.limit>0){const{valueMapper:G}=c,b=W5(c,c.table.core.schema);return c.table.core.query({trans:d,limit:c.limit,values:!0,query:{index:b,range:c.range}}).then(({result:W})=>G?W.map(G):W)}{const G=[];return Sl(c,b=>G.push(b),d,c.table.core).then(()=>G)}},l)}offset(l){var d=this._ctx;return l<=0||(d.offset+=l,h3(d)?_5(d,()=>{var c=l;return(G,b)=>c===0||(c===1?(--c,!1):(b(()=>{G.advance(c),c=0}),!1))}):_5(d,()=>{var c=l;return()=>--c<0})),this}limit(l){return this._ctx.limit=Math.min(this._ctx.limit,l),_5(this._ctx,()=>{var d=l;return function(c,G,b){return--d<=0&&G(b),d>=0}},!0),this}until(l,d){return q5(this._ctx,function(c,G,b){return!l(c.value)||(G(b),d)}),this}first(l){return this.limit(1).toArray(function(d){return d[0]}).then(l)}last(l){return this.reverse().first(l)}filter(l){var d,c;return q5(this._ctx,function(G){return l(G.value)}),d=this._ctx,c=l,d.isMatch=a3(d.isMatch,c),this}and(l){return this.filter(l)}or(l){return new this.db.WhereClause(this._ctx.table,l,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(l){var d=this._ctx;return d.keysOnly=!d.isMatch,this.each(function(c,G){l(G.key,G)})}eachUniqueKey(l){return this._ctx.unique="unique",this.eachKey(l)}eachPrimaryKey(l){var d=this._ctx;return d.keysOnly=!d.isMatch,this.each(function(c,G){l(G.primaryKey,G)})}keys(l){var d=this._ctx;d.keysOnly=!d.isMatch;var c=[];return this.each(function(G,b){c.push(b.key)}).then(function(){return c}).then(l)}primaryKeys(l){var d=this._ctx;if(d.dir==="next"&&h3(d,!0)&&d.limit>0)return this._read(G=>{var b=W5(d,d.table.core.schema);return d.table.core.query({trans:G,values:!1,limit:d.limit,query:{index:b,range:d.range}})}).then(({result:G})=>G).then(l);d.keysOnly=!d.isMatch;var c=[];return this.each(function(G,b){c.push(b.primaryKey)}).then(function(){return c}).then(l)}uniqueKeys(l){return this._ctx.unique="unique",this.keys(l)}firstKey(l){return this.limit(1).keys(function(d){return d[0]}).then(l)}lastKey(l){return this.reverse().firstKey(l)}distinct(){var l=this._ctx,d=l.index&&l.table.schema.idxByName[l.index];if(!d||!d.multi)return this;var c={};return q5(this._ctx,function(G){var b=G.primaryKey.toString(),W=v0(c,b);return c[b]=!0,!W}),this}modify(l){var d=this._ctx;return this._write(c=>{var G;if(typeof l=="function")G=l;else{var b=m0(l),W=b.length;G=function(Q){for(var o=!1,V=0;V{const{failures:V,numFailures:g}=o;s+=Q-g;for(let B of m0(V))n.push(V[B])};return this.clone().primaryKeys().then(Q=>{const o=V=>{const g=Math.min(e,Q.length-V);return t.getMany({trans:c,keys:Q.slice(V,V+g),cache:"immutable"}).then(B=>{const R=[],r=[],u=a?[]:null,Y=[];for(let y=0;y0&&t.mutate({trans:c,type:"add",values:R}).then(y=>{for(let C in y.failures)Y.splice(parseInt(C),1);A(R.length,y)})).then(()=>(r.length>0||E&&typeof l=="object")&&t.mutate({trans:c,type:"put",keys:u,values:r,criteria:E,changeSpec:typeof l!="function"&&l}).then(y=>A(r.length,y))).then(()=>(Y.length>0||E&&l===$5)&&t.mutate({trans:c,type:"delete",keys:Y,criteria:E}).then(y=>A(Y.length,y))).then(()=>Q.length>V+g&&o(V+e))})};return o(0).then(()=>{if(n.length>0)throw new m5("Error modifying one or more objects",n,s,p);return Q.length})})})}delete(){var l=this._ctx,d=l.range;return h3(l)&&(l.isPrimKey&&!yc||d.type===3)?this._write(c=>{const{primaryKey:G}=l.table.core.schema,b=d;return l.table.core.count({trans:c,query:{index:G,range:b}}).then(W=>l.table.core.mutate({trans:c,type:"deleteRange",range:b}).then(({failures:t,lastResult:a,results:Z,numFailures:e})=>{if(e)throw new m5("Could not delete some values",Object.keys(t).map(n=>t[n]),W-e);return W-e}))}):this.modify($5)}}const $5=(I,l)=>l.value=null;function Uc(I,l){return Il?-1:I===l?0:1}function M0(I,l,d){var c=I instanceof d6?new I.Collection(I):I;return c._ctx.error=d?new d(l):new TypeError(l),c}function r3(I){return new I.Collection(I,()=>I6("")).limit(0)}function xc(I,l,d,c,G,b){for(var W=Math.min(I.length,c.length),t=-1,a=0;a=0?I.substr(0,t)+l[t]+d.substr(t+1):null;G(I[a],Z)<0&&(t=a)}return Wtypeof Q=="string"))return M0(I,"String expected.");function s(Q){G=function(V){return V==="next"?g=>g.toUpperCase():g=>g.toLowerCase()}(Q),b=function(V){return V==="next"?g=>g.toLowerCase():g=>g.toUpperCase()}(Q),W=Q==="next"?Uc:kc;var o=d.map(function(V){return{lower:b(V),upper:G(V)}}).sort(function(V,g){return W(V.lower,g.lower)});t=o.map(function(V){return V.upper}),a=o.map(function(V){return V.lower}),Z=Q,e=Q==="next"?"":c}s("next");var p=new I.Collection(I,()=>N1(t[0],a[n-1]+c));p._ondirectionchange=function(Q){s(Q)};var A=0;return p._addAlgorithm(function(Q,o,V){var g=Q.key;if(typeof g!="string")return!1;var B=b(g);if(l(B,a,A))return!0;for(var R=null,r=A;r0)&&(R=u)}return o(R!==null?function(){Q.continue(R+e)}:V),!1}),p}function N1(I,l,d,c){return{type:2,lower:I,upper:l,lowerOpen:d,upperOpen:c}}function I6(I){return{type:1,lower:I,upper:I}}class d6{get Collection(){return this._ctx.table.db.Collection}between(l,d,c,G){c=c!==!1,G=G===!0;try{return this._cmp(l,d)>0||this._cmp(l,d)===0&&(c||G)&&(!c||!G)?r3(this):new this.Collection(this,()=>N1(l,d,!c,!G))}catch{return M0(this,s1)}}equals(l){return l==null?M0(this,s1):new this.Collection(this,()=>I6(l))}above(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(l,void 0,!0))}aboveOrEqual(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(l,void 0,!1))}below(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(void 0,l,!1,!0))}belowOrEqual(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(void 0,l))}startsWith(l){return typeof l!="string"?M0(this,"String expected."):this.between(l,l+P1,!0,!0)}startsWithIgnoreCase(l){return l===""?this.startsWith(l):zl(this,(d,c)=>d.indexOf(c[0])===0,[l],P1)}equalsIgnoreCase(l){return zl(this,(d,c)=>d===c[0],[l],"")}anyOfIgnoreCase(){var l=p1.apply(w3,arguments);return l.length===0?r3(this):zl(this,(d,c)=>c.indexOf(d)!==-1,l,"")}startsWithAnyOfIgnoreCase(){var l=p1.apply(w3,arguments);return l.length===0?r3(this):zl(this,(d,c)=>c.some(G=>d.indexOf(G)===0),l,P1)}anyOf(){const l=p1.apply(w3,arguments);let d=this._cmp;try{l.sort(d)}catch{return M0(this,s1)}if(l.length===0)return r3(this);const c=new this.Collection(this,()=>N1(l[0],l[l.length-1]));c._ondirectionchange=b=>{d=b==="next"?this._ascending:this._descending,l.sort(d)};let G=0;return c._addAlgorithm((b,W,t)=>{const a=b.key;for(;d(a,l[G])>0;)if(++G,G===l.length)return W(t),!1;return d(a,l[G])===0||(W(()=>{b.continue(l[G])}),!1)}),c}notEqual(l){return this.inAnyRange([[-(1/0),l],[l,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const l=p1.apply(w3,arguments);if(l.length===0)return new this.Collection(this);try{l.sort(this._ascending)}catch{return M0(this,s1)}const d=l.reduce((c,G)=>c?c.concat([[c[c.length-1][1],G]]):[[-(1/0),G]],null);return d.push([l[l.length-1],this.db._maxKey]),this.inAnyRange(d,{includeLowers:!1,includeUppers:!1})}inAnyRange(l,d){const c=this._cmp,G=this._ascending,b=this._descending,W=this._min,t=this._max;if(l.length===0)return r3(this);if(!l.every(g=>g[0]!==void 0&&g[1]!==void 0&&G(g[0],g[1])<=0))return M0(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",h2.InvalidArgument);const a=!d||d.includeLowers!==!1,Z=d&&d.includeUppers===!0;let e,n=G;function s(g,B){return n(g[0],B[0])}try{e=l.reduce(function(g,B){let R=0,r=g.length;for(;R0){u[0]=W(u[0],B[0]),u[1]=t(u[1],B[1]);break}}return R===r&&g.push(B),g},[]),e.sort(s)}catch{return M0(this,s1)}let p=0;const A=Z?g=>G(g,e[p][1])>0:g=>G(g,e[p][1])>=0,Q=a?g=>b(g,e[p][0])>0:g=>b(g,e[p][0])>=0;let o=A;const V=new this.Collection(this,()=>N1(e[0][0],e[e.length-1][1],!a,!Z));return V._ondirectionchange=g=>{g==="next"?(o=A,n=G):(o=Q,n=b),e.sort(s)},V._addAlgorithm((g,B,R)=>{for(var r=g.key;o(r);)if(++p,p===e.length)return B(R),!1;return!!function(u){return!A(u)&&!Q(u)}(r)||(this._cmp(r,e[p][1])===0||this._cmp(r,e[p][0])===0||B(()=>{n===G?g.continue(e[p][0]):g.continue(e[p][1])}),!1)}),V}startsWithAnyOf(){const l=p1.apply(w3,arguments);return l.every(d=>typeof d=="string")?l.length===0?r3(this):this.inAnyRange(l.map(d=>[d,d+P1])):M0(this,"startsWithAnyOf() only works with strings")}}function c1(I){return d0(function(l){return ol(l),I(l.target.error),!1})}function ol(I){I.stopPropagation&&I.stopPropagation(),I.preventDefault&&I.preventDefault()}const g1=el(null,"storagemutated");class Mc{_lock(){return dl(!X2.global),++this._reculock,this._reculock!==1||X2.global||(X2.lockOwnerFor=this),this}_unlock(){if(dl(!X2.global),--this._reculock==0)for(X2.global||(X2.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var l=this._blockedFuncs.shift();try{W3(l[1],l[0])}catch{}}return this}_locked(){return this._reculock&&X2.lockOwnerFor!==this}create(l){if(!this.mode)return this;const d=this.db.idbdb,c=this.db._state.dbOpenError;if(dl(!this.idbtrans),!l&&!d)switch(c&&c.name){case"DatabaseClosedError":throw new h2.DatabaseClosed(c);case"MissingAPIError":throw new h2.MissingAPI(c.message,c);default:throw new h2.OpenFailed(c)}if(!this.active)throw new h2.TransactionInactive;return dl(this._completion._state===null),(l=this.idbtrans=l||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):d.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=d0(G=>{ol(G),this._reject(l.error)}),l.onabort=d0(G=>{ol(G),this.active&&this._reject(new h2.Abort(l.error)),this.active=!1,this.on("abort").fire(G)}),l.oncomplete=d0(()=>{this.active=!1,this._resolve(),"mutatedParts"in l&&g1.storagemutated.fire(l.mutatedParts)}),this}_promise(l,d,c){if(l==="readwrite"&&this.mode!=="readwrite")return Z0(new h2.ReadOnly("Transaction is readonly"));if(!this.active)return Z0(new h2.TransactionInactive);if(this._locked())return new m2((b,W)=>{this._blockedFuncs.push([()=>{this._promise(l,d,c).then(b,W)},X2])});if(c)return U1(()=>{var b=new m2((W,t)=>{this._lock();const a=d(W,t,this);a&&a.then&&a.then(W,t)});return b.finally(()=>this._unlock()),b._lib=!0,b});var G=new m2((b,W)=>{var t=d(b,W,this);t&&t.then&&t.then(b,W)});return G._lib=!0,G}_root(){return this.parent?this.parent._root():this}waitFor(l){var d=this._root();const c=m2.resolve(l);if(d._waitingFor)d._waitingFor=d._waitingFor.then(()=>c);else{d._waitingFor=c,d._waitingQueue=[];var G=d.idbtrans.objectStore(d.storeNames[0]);(function W(){for(++d._spinCount;d._waitingQueue.length;)d._waitingQueue.shift()();d._waitingFor&&(G.get(-1/0).onsuccess=W)})()}var b=d._waitingFor;return new m2((W,t)=>{c.then(a=>d._waitingQueue.push(d0(W.bind(null,a))),a=>d._waitingQueue.push(d0(t.bind(null,a)))).finally(()=>{d._waitingFor===b&&(d._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new h2.Abort))}table(l){const d=this._memoizedTables||(this._memoizedTables={});if(v0(d,l))return d[l];const c=this.schema[l];if(!c)throw new h2.NotFound("Table "+l+" not part of transaction");const G=new this.db.Table(l,c,this);return G.core=this.db.core.table(l),d[l]=G,G}}function N9(I,l,d,c,G,b,W){return{name:I,keyPath:l,unique:d,multi:c,auto:G,compound:b,src:(d&&!W?"&":"")+(c?"*":"")+(G?"++":"")+c6(l)}}function c6(I){return typeof I=="string"?I:I?"["+[].join.call(I,"+")+"]":""}function G6(I,l,d){return{name:I,primKey:l,indexes:d,mappedClass:null,idxByName:(c=d,G=b=>[b.name,b],c.reduce((b,W,t)=>{var a=G(W,t);return a&&(b[a[0]]=a[1]),b},{}))};var c,G}let Vl=I=>{try{return I.only([[]]),Vl=()=>[[]],[[]]}catch{return Vl=()=>P1,P1}};function C9(I){return I==null?()=>{}:typeof I=="string"?function(l){return l.split(".").length===1?d=>d[l]:d=>V1(d,l)}(I):l=>V1(l,I)}function bI(I){return[].slice.call(I)}let Sc=0;function nl(I){return I==null?":id":typeof I=="string"?I:`[${I.join("+")}]`}function zc(I,l,d){function c(a){if(a.type===3)return null;if(a.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:Z,upper:e,lowerOpen:n,upperOpen:s}=a;return Z===void 0?e===void 0?null:l.upperBound(e,!!s):e===void 0?l.lowerBound(Z,!!n):l.bound(Z,e,!!n,!!s)}const{schema:G,hasGetAll:b}=function(a,Z){const e=bI(a.objectStoreNames);return{schema:{name:a.name,tables:e.map(n=>Z.objectStore(n)).map(n=>{const{keyPath:s,autoIncrement:p}=n,A=r0(s),Q=s==null,o={},V={name:n.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:Q,compound:A,keyPath:s,autoIncrement:p,unique:!0,extractKey:C9(s)},indexes:bI(n.indexNames).map(g=>n.index(g)).map(g=>{const{name:B,unique:R,multiEntry:r,keyPath:u}=g,Y={name:B,compound:r0(u),keyPath:u,unique:R,multiEntry:r,extractKey:C9(u)};return o[nl(u)]=Y,Y}),getIndexByKeyPath:g=>o[nl(g)]};return o[":id"]=V.primaryKey,s!=null&&(o[nl(s)]=V.primaryKey),V})},hasGetAll:e.length>0&&"getAll"in Z.objectStore(e[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(I,d),W=G.tables.map(a=>function(Z){const e=Z.name;return{name:e,schema:Z,mutate:function({trans:n,type:s,keys:p,values:A,range:Q}){return new Promise((o,V)=>{o=d0(o);const g=n.objectStore(e),B=g.keyPath==null,R=s==="put"||s==="add";if(!R&&s!=="delete"&&s!=="deleteRange")throw new Error("Invalid operation type: "+s);const{length:r}=p||A||{length:1};if(p&&A&&p.length!==A.length)throw new Error("Given keys array must have same length as given values array.");if(r===0)return o({numFailures:0,failures:{},results:[],lastResult:void 0});let u;const Y=[],E=[];let y=0;const C=L=>{++y,ol(L)};if(s==="deleteRange"){if(Q.type===4)return o({numFailures:y,failures:E,results:[],lastResult:void 0});Q.type===3?Y.push(u=g.clear()):Y.push(u=g.delete(c(Q)))}else{const[L,J]=R?B?[A,p]:[A,null]:[p,null];if(R)for(let U=0;U{const J=L.target.result;Y.forEach((U,z)=>U.error!=null&&(E[z]=U.error)),o({numFailures:y,failures:E,results:s==="delete"?p:Y.map(U=>U.result),lastResult:J})};u.onerror=L=>{C(L),k(L)},u.onsuccess=k})},getMany:({trans:n,keys:s})=>new Promise((p,A)=>{p=d0(p);const Q=n.objectStore(e),o=s.length,V=new Array(o);let g,B=0,R=0;const r=Y=>{const E=Y.target;V[E._pos]=E.result,++R===B&&p(V)},u=c1(A);for(let Y=0;Ynew Promise((p,A)=>{p=d0(p);const Q=n.objectStore(e).get(s);Q.onsuccess=o=>p(o.target.result),Q.onerror=c1(A)}),query:function(n){return s=>new Promise((p,A)=>{p=d0(p);const{trans:Q,values:o,limit:V,query:g}=s,B=V===1/0?void 0:V,{index:R,range:r}=g,u=Q.objectStore(e),Y=R.isPrimaryKey?u:u.index(R.name),E=c(r);if(V===0)return p({result:[]});if(n){const y=o?Y.getAll(E,B):Y.getAllKeys(E,B);y.onsuccess=C=>p({result:C.target.result}),y.onerror=c1(A)}else{let y=0;const C=o||!("openKeyCursor"in Y)?Y.openCursor(E):Y.openKeyCursor(E),k=[];C.onsuccess=L=>{const J=C.result;return J?(k.push(o?J.value:J.primaryKey),++y===V?p({result:k}):void J.continue()):p({result:k})},C.onerror=c1(A)}})}(b),openCursor:function({trans:n,values:s,query:p,reverse:A,unique:Q}){return new Promise((o,V)=>{o=d0(o);const{index:g,range:B}=p,R=n.objectStore(e),r=g.isPrimaryKey?R:R.index(g.name),u=A?Q?"prevunique":"prev":Q?"nextunique":"next",Y=s||!("openKeyCursor"in r)?r.openCursor(c(B),u):r.openKeyCursor(c(B),u);Y.onerror=c1(V),Y.onsuccess=d0(E=>{const y=Y.result;if(!y)return void o(null);y.___id=++Sc,y.done=!1;const C=y.continue.bind(y);let k=y.continuePrimaryKey;k&&(k=k.bind(y));const L=y.advance.bind(y),J=()=>{throw new Error("Cursor not stopped")};y.trans=n,y.stop=y.continue=y.continuePrimaryKey=y.advance=()=>{throw new Error("Cursor not started")},y.fail=d0(V),y.next=function(){let U=1;return this.start(()=>U--?this.continue():this.stop()).then(()=>this)},y.start=U=>{const z=new Promise((N,w)=>{N=d0(N),Y.onerror=c1(w),y.fail=w,y.stop=v=>{y.stop=y.continue=y.continuePrimaryKey=y.advance=J,N(v)}}),S=()=>{if(Y.result)try{U()}catch(N){y.fail(N)}else y.done=!0,y.start=()=>{throw new Error("Cursor behind last entry")},y.stop()};return Y.onsuccess=d0(N=>{Y.onsuccess=S,S()}),y.continue=C,y.continuePrimaryKey=k,y.advance=L,S(),z},o(y)},V)})},count({query:n,trans:s}){const{index:p,range:A}=n;return new Promise((Q,o)=>{const V=s.objectStore(e),g=p.isPrimaryKey?V:V.index(p.name),B=c(A),R=B?g.count(B):g.count();R.onsuccess=d0(r=>Q(r.target.result)),R.onerror=c1(o)})}}}(a)),t={};return W.forEach(a=>t[a.name]=a),{stack:"dbcore",transaction:I.transaction.bind(I),table(a){if(!t[a])throw new Error(`Table '${a}' not found`);return t[a]},MIN_KEY:-1/0,MAX_KEY:Vl(l),schema:G}}function H9(I,l){const d=l.db,c=function(G,b,{IDBKeyRange:W,indexedDB:t},a){return{dbcore:function(e,n){return n.reduce((s,{create:p})=>({...s,...p(s)}),e)}(zc(b,W,a),G.dbcore)}}(I._middlewares,d,I._deps,l);I.core=c.dbcore,I.tables.forEach(G=>{const b=G.name;I.core.schema.tables.some(W=>W.name===b)&&(G.core=I.core.table(b),I[b]instanceof I.Table&&(I[b].core=G.core))})}function o5(I,l,d,c){d.forEach(G=>{const b=c[G];l.forEach(W=>{const t=I4(W,G);(!t||"value"in t&&t.value===void 0)&&(W===I.Transaction.prototype||W instanceof I.Transaction?o1(W,G,{get(){return this.table(G)},set(a){yd(this,G,{value:a,writable:!0,configurable:!0,enumerable:!0})}}):W[G]=new I.Table(G,b))})})}function K9(I,l){l.forEach(d=>{for(let c in d)d[c]instanceof I.Table&&delete d[c]})}function Tc(I,l){return I._cfg.version-l._cfg.version}function fc(I,l,d,c){const G=I._dbSchema,b=I._createTransaction("readwrite",I._storeNames,G);b.create(d),b._completion.catch(c);const W=b._reject.bind(b),t=X2.transless||X2;U1(()=>{X2.trans=b,X2.transless=t,l===0?(m0(G).forEach(a=>{l9(d,a,G[a].primKey,G[a].indexes)}),H9(I,d),m2.follow(()=>I.on.populate.fire(b)).catch(W)):function(a,Z,e,n){const s=[],p=a._versions;let A=a._dbSchema=J9(a,a.idbdb,n),Q=!1;function o(){return s.length?m2.resolve(s.shift()(e.idbtrans)).then(o):m2.resolve()}return p.filter(V=>V._cfg.version>=Z).forEach(V=>{s.push(()=>{const g=A,B=V._cfg.dbschema;y9(a,g,n),y9(a,B,n),A=a._dbSchema=B;const R=b6(g,B);R.add.forEach(u=>{l9(n,u[0],u[1].primKey,u[1].indexes)}),R.change.forEach(u=>{if(u.recreate)throw new h2.Upgrade("Not yet support for changing primary key");{const Y=n.objectStore(u.name);u.add.forEach(E=>E9(Y,E)),u.change.forEach(E=>{Y.deleteIndex(E.name),E9(Y,E)}),u.del.forEach(E=>Y.deleteIndex(E))}});const r=V._cfg.contentUpgrade;if(r&&V._cfg.version>Z){H9(a,n),e._memoizedTables={},Q=!0;let u=Ud(B);R.del.forEach(C=>{u[C]=g[C]}),K9(a,[a.Transaction.prototype]),o5(a,[a.Transaction.prototype],m0(u),u),e.schema=u;const Y=d4(r);let E;Y&&j3();const y=m2.follow(()=>{if(E=r(e),E&&Y){var C=k1.bind(null,null);E.then(C,C)}});return E&&typeof E.then=="function"?m2.resolve(E):y.then(()=>E)}}),s.push(g=>{(!Q||!Jc)&&function(B,R){[].slice.call(R.db.objectStoreNames).forEach(r=>B[r]==null&&R.db.deleteObjectStore(r))}(V._cfg.dbschema,g),K9(a,[a.Transaction.prototype]),o5(a,[a.Transaction.prototype],a._storeNames,a._dbSchema),e.schema=a._dbSchema})}),o().then(()=>{var V,g;g=n,m0(V=A).forEach(B=>{g.db.objectStoreNames.contains(B)||l9(g,B,V[B].primKey,V[B].indexes)})})}(I,l,b,d).catch(W)})}function b6(I,l){const d={del:[],add:[],change:[]};let c;for(c in I)l[c]||d.del.push(c);for(c in l){const G=I[c],b=l[c];if(G){const W={name:c,def:b,recreate:!1,del:[],add:[],change:[]};if(""+(G.primKey.keyPath||"")!=""+(b.primKey.keyPath||"")||G.primKey.auto!==b.primKey.auto&&!v5)W.recreate=!0,d.change.push(W);else{const t=G.idxByName,a=b.idxByName;let Z;for(Z in t)a[Z]||W.del.push(Z);for(Z in a){const e=t[Z],n=a[Z];e?e.src!==n.src&&W.change.push(n):W.add.push(n)}(W.del.length>0||W.add.length>0||W.change.length>0)&&d.change.push(W)}}else d.add.push([c,b])}return d}function l9(I,l,d,c){const G=I.db.createObjectStore(l,d.keyPath?{keyPath:d.keyPath,autoIncrement:d.auto}:{autoIncrement:d.auto});return c.forEach(b=>E9(G,b)),G}function E9(I,l){I.createIndex(l.name,l.keyPath,{unique:l.unique,multiEntry:l.multi})}function J9(I,l,d){const c={};return s5(l.objectStoreNames,0).forEach(G=>{const b=d.objectStore(G);let W=b.keyPath;const t=N9(c6(W),W||"",!1,!1,!!b.autoIncrement,W&&typeof W!="string",!0),a=[];for(let e=0;e{if(l[c]!==null){var G=l[c].split(",").map((W,t)=>{const a=(W=W.trim()).replace(/([&*]|\+\+)/g,""),Z=/^\[/.test(a)?a.match(/^\[(.*)\]$/)[1].split("+"):a;return N9(a,Z||null,/\&/.test(W),/\*/.test(W),/\+\+/.test(W),r0(Z),t===0)}),b=G.shift();if(b.multi)throw new h2.Schema("Primary key cannot be multi-valued");G.forEach(W=>{if(W.auto)throw new h2.Schema("Only primary key can be marked as autoIncrement (++)");if(!W.keyPath)throw new h2.Schema("Index must have a name and cannot be an empty string")}),d[c]=G6(c,b,G)}})}stores(l){const d=this.db;this._cfg.storesSource=this._cfg.storesSource?S0(this._cfg.storesSource,l):l;const c=d._versions,G={};let b={};return c.forEach(W=>{S0(G,W._cfg.storesSource),b=W._cfg.dbschema={},W._parseStoresSpec(G,b)}),d._dbSchema=b,K9(d,[d._allTables,d,d.Transaction.prototype]),o5(d,[d._allTables,d,d.Transaction.prototype,this._cfg.tables],m0(b),b),d._storeNames=m0(b),this}upgrade(l){return this._cfg.contentUpgrade=b4(this._cfg.contentUpgrade||D2,l),this}}function Z4(I,l){let d=I._dbNamesDB;return d||(d=I._dbNamesDB=new l3("__dbnames",{addons:[],indexedDB:I,IDBKeyRange:l}),d.version(1).stores({dbnames:"name"})),d.table("dbnames")}function e4(I){return I&&typeof I.databases=="function"}function v9(I){return U1(function(){return X2.letThrough=!0,I()})}function Dc(){var I;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(l){var d=function(){return indexedDB.databases().finally(l)};I=setInterval(d,100),d()}).finally(function(){return clearInterval(I)}):Promise.resolve()}function n4(I){return!("from"in I)}const E0=function(I,l){if(!this){const d=new E0;return I&&"d"in I&&S0(d,I),d}S0(this,arguments.length?{d:1,from:I,to:arguments.length>1?l:I}:{d:0})};function Xl(I,l,d){const c=S2(l,d);if(isNaN(c))return;if(c>0)throw RangeError();if(n4(I))return S0(I,{from:l,to:d,d:1});const G=I.l,b=I.r;if(S2(d,I.from)<0)return G?Xl(G,l,d):I.l={from:l,to:d,d:1,l:null,r:null},WI(I);if(S2(l,I.to)>0)return b?Xl(b,l,d):I.r={from:l,to:d,d:1,l:null,r:null},WI(I);S2(l,I.from)<0&&(I.from=l,I.l=null,I.d=b?b.d+1:1),S2(d,I.to)>0&&(I.to=d,I.r=null,I.d=I.l?I.l.d+1:1);const W=!I.r;G&&!I.l&&V5(I,G),b&&W&&V5(I,b)}function V5(I,l){n4(l)||function d(c,{from:G,to:b,l:W,r:t}){Xl(c,G,b),W&&d(c,W),t&&d(c,t)}(I,l)}function L9(I,l){const d=U9(l);let c=d.next();if(c.done)return!1;let G=c.value;const b=U9(I);let W=b.next(G.from),t=W.value;for(;!c.done&&!W.done;){if(S2(t.from,G.to)<=0&&S2(t.to,G.from)>=0)return!0;S2(G.from,t.from)<0?G=(c=d.next(t.from)).value:t=(W=b.next(G.from)).value}return!1}function U9(I){let l=n4(I)?null:{s:0,n:I};return{next(d){const c=arguments.length>0;for(;l;)switch(l.s){case 0:if(l.s=1,c)for(;l.n.l&&S2(d,l.n.from)<0;)l={up:l,n:l.n.l,s:1};else for(;l.n.l;)l={up:l,n:l.n.l,s:1};case 1:if(l.s=2,!c||S2(d,l.n.to)<=0)return{value:l.n,done:!1};case 2:if(l.n.r){l.s=3,l={up:l,n:l.n.r,s:0};continue}case 3:l=l.up}return{done:!0}}}}function WI(I){var l,d;const c=(((l=I.r)===null||l===void 0?void 0:l.d)||0)-(((d=I.l)===null||d===void 0?void 0:d.d)||0),G=c>1?"r":c<-1?"l":"";if(G){const b=G==="r"?"l":"r",W={...I},t=I[G];I.from=t.from,I.to=t.to,I[G]=t[G],W[G]=t[b],I[b]=W,W.d=aI(W)}I.d=aI(I)}function aI({r:I,l}){return(I?l?Math.max(I.d,l.d):I.d:l?l.d:0)+1}function L5(I,l){return m0(l).forEach(d=>{I[d]?V5(I[d],l[d]):I[d]=Md(l[d])}),I}function W6(I,l){return Object.keys(I).some(d=>l[d]&&L9(l[d],I[d]))}U3(E0.prototype,{add(I){return V5(this,I),this},addKey(I){return Xl(this,I,I),this},addKeys(I){return I.forEach(l=>Xl(this,l,l)),this},[g9](){return U9(this)}});const C3={};let I9={},d9=!1;function c9(I){L5(I9,I),d9||(d9=!0,queueMicrotask(()=>{d9=!1;const l=I9;I9={},s4(l)}))}function s4(I,l=!1){const d=new Set;for(const c in I){const G=/^idb\:\/\/(.*)\/(.*)\//.exec(c);if(G){const[,b,W]=G,t=C3[`idb://${b}/${W}`];t&&Oc(t,I,d,l)}}d.forEach(c=>c())}function Oc(I,l,d,c){const G=c&&[];for(const[b,W]of Object.entries(I.queries.query)){const t=c&&[];for(const a of W)a.obsSet&&W6(l,a.obsSet)?a.subscribers.forEach(Z=>d.add(Z)):c&&t.push(a);c&&G.push([b,t])}if(c)for(const[b,W]of G)I.queries.query[b]=W}function Pc(I){const l=I._state,{indexedDB:d}=I._deps;if(l.isBeingOpened||I.idbdb)return l.dbReadyPromise.then(()=>l.dbOpenError?Z0(l.dbOpenError):I);h1&&(l.openCanceller._stackHolder=m3()),l.isBeingOpened=!0,l.dbOpenError=null,l.openComplete=!1;const c=l.openCanceller;function G(){if(l.openCanceller!==c)throw new h2.DatabaseClosed("db.open() was cancelled")}let b=l.dbReadyResolve,W=null,t=!1;return m2.race([c,(typeof navigator>"u"?m2.resolve():Dc()).then(()=>new m2((a,Z)=>{if(G(),!d)throw new h2.MissingAPI;const e=I.name,n=l.autoSchema?d.open(e):d.open(e,Math.round(10*I.verno));if(!n)throw new h2.MissingAPI;n.onerror=c1(Z),n.onblocked=d0(I._fireOnBlocked),n.onupgradeneeded=d0(s=>{if(W=n.transaction,l.autoSchema&&!I._options.allowEmptyDB){n.onerror=ol,W.abort(),n.result.close();const A=d.deleteDatabase(e);A.onsuccess=A.onerror=d0(()=>{Z(new h2.NoSuchDatabase(`Database ${e} doesnt exist`))})}else{W.onerror=c1(Z);var p=s.oldVersion>Math.pow(2,62)?0:s.oldVersion;t=p<1,I.idbdb=n.result,fc(I,p/10,W,Z)}},Z),n.onsuccess=d0(()=>{W=null;const s=I.idbdb=n.result,p=s5(s.objectStoreNames);if(p.length>0)try{const Q=s.transaction((A=p).length===1?A[0]:A,"readonly");l.autoSchema?function(o,V,g){o.verno=V.version/10;const B=o._dbSchema=J9(0,V,g);o._storeNames=s5(V.objectStoreNames,0),o5(o,[o._allTables],m0(B),B)}(I,s,Q):(y9(I,I._dbSchema,Q),function(o,V){const g=b6(J9(0,o.idbdb,V),o._dbSchema);return!(g.add.length||g.change.some(B=>B.add.length||B.change.length))}(I,Q)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),H9(I,Q)}catch{}var A;Zl.push(I),s.onversionchange=d0(Q=>{l.vcFired=!0,I.on("versionchange").fire(Q)}),s.onclose=d0(Q=>{I.on("close").fire(Q)}),t&&function({indexedDB:Q,IDBKeyRange:o},V){!e4(Q)&&V!=="__dbnames"&&Z4(Q,o).put({name:V}).catch(D2)}(I._deps,e),a()},Z)}))]).then(()=>(G(),l.onReadyBeingFired=[],m2.resolve(v9(()=>I.on.ready.fire(I.vip))).then(function a(){if(l.onReadyBeingFired.length>0){let Z=l.onReadyBeingFired.reduce(b4,D2);return l.onReadyBeingFired=[],m2.resolve(v9(()=>Z(I.vip))).then(a)}}))).finally(()=>{l.openCanceller===c&&(l.onReadyBeingFired=null,l.isBeingOpened=!1)}).catch(a=>{l.dbOpenError=a;try{W&&W.abort()}catch{}return c===l.openCanceller&&I._close(),Z0(a)}).finally(()=>{l.openComplete=!0,b()}).then(()=>{if(t){const a={};I.tables.forEach(Z=>{Z.schema.indexes.forEach(e=>{e.name&&(a[`idb://${I.name}/${Z.name}/${e.name}`]=new E0(-1/0,[[[]]]))}),a[`idb://${I.name}/${Z.name}/`]=a[`idb://${I.name}/${Z.name}/:dels`]=new E0(-1/0,[[[]]])}),g1("storagemutated").fire(a),s4(a,!0)}return I})}function k9(I){var l=b=>I.next(b),d=G(l),c=G(b=>I.throw(b));function G(b){return W=>{var t=b(W),a=t.value;return t.done?a:a&&typeof a.then=="function"?a.then(d,c):r0(a)?Promise.all(a).then(d,c):d(a)}}return G(l)()}function qc(I,l,d){var c=arguments.length;if(c<2)throw new h2.InvalidArgument("Too few arguments");for(var G=new Array(c-1);--c;)G[c-1]=arguments[c];d=G.pop();var b=kd(G);return[I,b,d]}function a6(I,l,d,c,G){return m2.resolve().then(()=>{const b=X2.transless||X2,W=I._createTransaction(l,d,I._dbSchema,c);W.explicit=!0;const t={trans:W,transless:b};if(c)W.idbtrans=c.idbtrans;else try{W.create(),I._state.PR1398_maxLoop=3}catch(n){return n.name===G4.InvalidState&&I.isOpen()&&--I._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),I._close(),I.open().then(()=>a6(I,l,d,null,G))):Z0(n)}const a=d4(G);let Z;a&&j3();const e=m2.follow(()=>{if(Z=G.call(W,W),Z)if(a){var n=k1.bind(null,null);Z.then(n,n)}else typeof Z.next=="function"&&typeof Z.throw=="function"&&(Z=k9(Z))},t);return(Z&&typeof Z.then=="function"?m2.resolve(Z).then(n=>W.active?n:Z0(new h2.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):e.then(()=>Z)).then(n=>(c&&W._resolve(),W._completion.then(()=>n))).catch(n=>(W._reject(n),Z0(n)))})}function Tl(I,l,d){const c=r0(I)?I.slice():[I];for(let G=0;G0,V={...s,name:o?`${p}(virtual-from:${s.name})`:s.name,lowLevelIndex:s,isVirtual:o,keyTail:n,keyLength:Q,extractKey:C9(e),unique:!o&&s.unique};return A.push(V),V.isPrimaryKey||b.push(V),Q>1&&W(Q===2?e[0]:e.slice(0,Q-1),n+1,s),A.sort((g,B)=>g.keyTail-B.keyTail),V}const t=W(c.primaryKey.keyPath,0,c.primaryKey);G[":id"]=[t];for(const e of c.indexes)W(e.keyPath,0,e);function a(e){const n=e.query.index;return n.isVirtual?{...e,query:{index:n.lowLevelIndex,range:(s=e.query.range,p=n.keyTail,{type:s.type===1?2:s.type,lower:Tl(s.lower,s.lowerOpen?I.MAX_KEY:I.MIN_KEY,p),lowerOpen:!0,upper:Tl(s.upper,s.upperOpen?I.MIN_KEY:I.MAX_KEY,p),upperOpen:!0})}}:e;var s,p}return{...d,schema:{...c,primaryKey:t,indexes:b,getIndexByKeyPath:function(e){const n=G[nl(e)];return n&&n[0]}},count:e=>d.count(a(e)),query:e=>d.query(a(e)),openCursor(e){const{keyTail:n,isVirtual:s,keyLength:p}=e.query.index;return s?d.openCursor(a(e)).then(A=>A&&function(Q){return Object.create(Q,{continue:{value:function(V){V!=null?Q.continue(Tl(V,e.reverse?I.MAX_KEY:I.MIN_KEY,n)):e.unique?Q.continue(Q.key.slice(0,p).concat(e.reverse?I.MIN_KEY:I.MAX_KEY,n)):Q.continue()}},continuePrimaryKey:{value(V,g){Q.continuePrimaryKey(Tl(V,I.MAX_KEY,n),g)}},primaryKey:{get:()=>Q.primaryKey},key:{get(){const V=Q.key;return p===1?V[0]:V.slice(0,p)}},value:{get:()=>Q.value}})}(A)):d.openCursor(e)}}}}}};function m4(I,l,d,c){return d=d||{},c=c||"",m0(I).forEach(G=>{if(v0(l,G)){var b=I[G],W=l[G];if(typeof b=="object"&&typeof W=="object"&&b&&W){const t=X9(b);t!==X9(W)?d[c+G]=l[G]:t==="Object"?m4(b,W,d,c+G+"."):b!==W&&(d[c+G]=l[G])}else b!==W&&(d[c+G]=l[G])}else d[c+G]=void 0}),m0(l).forEach(G=>{v0(I,G)||(d[c+G]=l[G])}),d}function p4(I,l){return l.type==="delete"?l.keys:l.keys||l.values.map(I.extractKey)}const $c={stack:"dbcore",name:"HooksMiddleware",level:2,create:I=>({...I,table(l){const d=I.table(l),{primaryKey:c}=d.schema;return{...d,mutate(b){const W=X2.trans,{deleting:t,creating:a,updating:Z}=W.table(l).hook;switch(b.type){case"add":if(a.fire===D2)break;return W._promise("readwrite",()=>e(b),!0);case"put":if(a.fire===D2&&Z.fire===D2)break;return W._promise("readwrite",()=>e(b),!0);case"delete":if(t.fire===D2)break;return W._promise("readwrite",()=>e(b),!0);case"deleteRange":if(t.fire===D2)break;return W._promise("readwrite",()=>function(s){return n(s.trans,s.range,1e4)}(b),!0)}return d.mutate(b);function e(s){const p=X2.trans,A=s.keys||p4(c,s);if(!A)throw new Error("Keys missing");return(s=s.type==="add"||s.type==="put"?{...s,keys:A}:{...s}).type!=="delete"&&(s.values=[...s.values]),s.keys&&(s.keys=[...s.keys]),function(Q,o,V){return o.type==="add"?Promise.resolve([]):Q.getMany({trans:o.trans,keys:V,cache:"immutable"})}(d,s,A).then(Q=>{const o=A.map((V,g)=>{const B=Q[g],R={onerror:null,onsuccess:null};if(s.type==="delete")t.fire.call(R,V,B,p);else if(s.type==="add"||B===void 0){const r=a.fire.call(R,V,s.values[g],p);V==null&&r!=null&&(V=r,s.keys[g]=V,c.outbound||f0(s.values[g],c.keyPath,V))}else{const r=m4(B,s.values[g]),u=Z.fire.call(R,r,V,B,p);if(u){const Y=s.values[g];Object.keys(u).forEach(E=>{v0(Y,E)?Y[E]=u[E]:f0(Y,E,u[E])})}}return R});return d.mutate(s).then(({failures:V,results:g,numFailures:B,lastResult:R})=>{for(let r=0;r(o.forEach(g=>g.onerror&&g.onerror(V)),Promise.reject(V)))})}function n(s,p,A){return d.query({trans:s,values:!1,query:{index:c,range:p},limit:A}).then(({result:Q})=>e({type:"delete",keys:Q,trans:s}).then(o=>o.numFailures>0?Promise.reject(o.failures[0]):Q.length({table:l=>{const d=I.table(l);return{...d,getMany:c=>{if(!c.cache)return d.getMany(c);const G=t6(c.keys,c.trans._cache,c.cache==="clone");return G?m2.resolve(G):d.getMany(c).then(b=>(c.trans._cache={keys:c.keys,values:c.cache==="clone"?L1(b):b},b))},mutate:c=>(c.type!=="add"&&(c.trans._cache=null),d.mutate(c))}}})};function Z6(I,l){return I.trans.mode==="readonly"&&!!I.subscr&&!I.trans.explicit&&I.trans.db._options.cache!=="disabled"&&!l.schema.primaryKey.outbound}function e6(I,l){switch(I){case"query":return l.values&&!l.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}const IG={stack:"dbcore",level:0,name:"Observability",create:I=>{const l=I.schema.name,d=new E0(I.MIN_KEY,I.MAX_KEY);return{...I,transaction:(c,G,b)=>{if(X2.subscr&&G!=="readonly")throw new h2.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${X2.querier}`);return I.transaction(c,G,b)},table:c=>{const G=I.table(c),{schema:b}=G,{primaryKey:W}=b,{extractKey:t,outbound:a}=W,Z={...G,mutate:s=>{const p=s.trans,A=s.mutatedParts||(s.mutatedParts={}),Q=u=>{const Y=`idb://${l}/${c}/${u}`;return A[Y]||(A[Y]=new E0)},o=Q(""),V=Q(":dels"),{type:g}=s;let[B,R]=s.type==="deleteRange"?[s.range]:s.type==="delete"?[s.keys]:s.values.length<50?[p4(W,s).filter(u=>u),s.values]:[];const r=s.trans._cache;if(r0(B)){o.addKeys(B);const u=g==="delete"||B.length===R.length?t6(B,r):null;u||g==="add"||V.addKeys(B),(u||R)&&function(Y,E,y,C){function k(L){const J=Y(L.name||"");function U(S){return S!=null?L.extractKey(S):null}const z=S=>L.multiEntry&&r0(S)?S.forEach(N=>J.addKey(N)):J.addKey(S);(y||C).forEach((S,N)=>{const w=y&&U(y[N]),v=C&&U(C[N]);S2(w,v)!==0&&(w!=null&&z(w),v!=null&&z(v))})}E.indexes.forEach(k)}(Q,b,u,R)}else if(B){const u={from:B.lower,to:B.upper};V.add(u),o.add(u)}else o.add(d),V.add(d),b.indexes.forEach(u=>Q(u.name).add(d));return G.mutate(s).then(u=>(!B||s.type!=="add"&&s.type!=="put"||o.addKeys(u.results),p.mutatedParts=L5(p.mutatedParts||{},A),u))}},e=({query:{index:s,range:p}})=>{var A,Q;return[s,new E0((A=p.lower)!==null&&A!==void 0?A:I.MIN_KEY,(Q=p.upper)!==null&&Q!==void 0?Q:I.MAX_KEY)]},n={get:s=>[W,new E0(s.key)],getMany:s=>[W,new E0().addKeys(s.keys)],count:e,query:e,openCursor:e};return m0(n).forEach(s=>{Z[s]=function(p){const{subscr:A}=X2,Q=!!A,V=Z6(X2,G)&&e6(s,p)?p.obsSet={}:A;if(Q){const g=Y=>{const E=`idb://${l}/${c}/${Y}`;return V[E]||(V[E]=new E0)},B=g(""),R=g(":dels"),[r,u]=n[s](p);if(g(r.name||"").add(u),!r.isPrimaryKey){if(s!=="count"){const Y=s==="query"&&a&&p.values&&G.query({...p,values:!1});return G[s].apply(this,arguments).then(E=>{if(s==="query"){if(a&&p.values)return Y.then(({result:C})=>(B.addKeys(C),E));const y=p.values?E.result.map(t):E.result;p.values?B.addKeys(y):R.addKeys(y)}else if(s==="openCursor"){const y=E,C=p.values;return y&&Object.create(y,{key:{get:()=>(R.addKey(y.primaryKey),y.key)},primaryKey:{get(){const k=y.primaryKey;return R.addKey(k),k}},value:{get:()=>(C&&B.addKey(y.primaryKey),y.value)}})}return E})}R.add(d)}}return G[s].apply(this,arguments)}}),Z}}}};function tI(I,l){return function(d,c){return c.lower===void 0||(c.lowerOpen?S2(d,c.lower)>0:S2(d,c.lower)>=0)}(I,l)&&function(d,c){return c.upper===void 0||(c.upperOpen?S2(d,c.upper)<0:S2(d,c.upper)<=0)}(I,l)}function ZI(I,l,d,c,G,b){if(!d||d.length===0)return I;const W=l.query.index,t=c.schema.primaryKey.extractKey,a=W.extractKey,Z=(W.lowLevelIndex||W).extractKey;let e=d.reduce((n,s)=>{let p=n;const A=s.type==="add"||s.type==="put"?s.values.filter(Q=>tI(a(Q),l.query.range)).map(Q=>(Q=L1(Q),b&&Object.freeze(Q),Q)):[];switch(s.type){case"add":p=n.concat(l.values?A:A.map(g=>t(g)));break;case"put":const Q=new E0().addKeys(s.values.map(g=>t(g)));p=n.filter(g=>{const B=l.values?t(g):g;return!L9(new E0(B),Q)}).concat(l.values?A:A.map(g=>t(g)));break;case"delete":const o=new E0().addKeys(s.keys);p=n.filter(g=>{const B=l.values?t(g):g;return!L9(new E0(B),o)});break;case"deleteRange":const V=s.range;p=n.filter(g=>!tI(t(g),V))}return p},I);return e===I?I:(e.sort((n,s)=>S2(Z(n),Z(s))||S2(t(n),t(s))),l.limit&&l.limit<1/0&&(e.length>l.limit?e.length=l.limit:I.length===l.limit&&e.length=0}function cG(I,l,d,c){I.subscribers.add(d),c.addEventListener("abort",()=>{I.subscribers.delete(d),I.subscribers.size===0&&function(G,b){setTimeout(()=>{G.subscribers.size===0&&cl(b,G)},3e3)}(I,l)})}const GG={stack:"dbcore",level:0,name:"Cache",create:I=>{const l=I.schema.name;return{...I,transaction:(c,G,b)=>{const W=I.transaction(c,G,b);if(G==="readwrite"){const t=new AbortController,{signal:a}=t,Z=e=>()=>{if(t.abort(),G==="readwrite"){const n=new Set;for(const s of c){const p=C3[`idb://${l}/${s}`],A=I.table(s);if(p){const Q=p.optimisticOps.filter(o=>o.trans===W);if(Q.length>0){p.optimisticOps=p.optimisticOps.filter(o=>o.trans!==W);for(const o of Object.values(p.queries.query))for(const V of o.slice())if(V.res!=null&&W.mutatedParts)if(e&&!V.dirty){const g=Object.isFrozen(V.res),B=ZI(V.res,V.req,Q,A,V,g);V.dirty?(cl(o,V),V.subscribers.forEach(R=>n.add(R))):B!==V.res&&(V.res=B,V.promise=m2.resolve({result:B}))}else V.dirty&&cl(o,V),V.subscribers.forEach(g=>n.add(g))}}}n.forEach(s=>s())}};W.addEventListener("abort",Z(!1),{signal:a}),W.addEventListener("error",Z(!1),{signal:a}),W.addEventListener("complete",Z(!0),{signal:a})}return W},table(c){const G=I.table(c),b=G.schema.primaryKey;return{...G,mutate(t){if(b.outbound||X2.trans.db._options.cache==="disabled")return G.mutate(t);const a=C3[`idb://${l}/${c}`];if(!a)return G.mutate(t);const Z=G.mutate(t);return t.type!=="add"&&t.type!=="put"||!(t.values.length>=50||p4(b,t).some(e=>e==null))?(a.optimisticOps.push(t),c9(t.mutatedParts),Z.catch(()=>{cl(a.optimisticOps,t),c9(t.mutatedParts)})):Z.then(e=>{const n={...t,values:t.values.map((s,p)=>{const A=b.keyPath.includes(".")?L1(s):{...s};return f0(A,b.keyPath,e.results[p]),A})};a.optimisticOps.push(n),queueMicrotask(()=>c9(t.mutatedParts))}),Z},query(t){if(!Z6(X2,G)||!e6("query",t))return G.query(t);const a=X2.trans.db._options.cache==="immutable",{requery:Z,signal:e}=X2;let[n,s,p,A]=function(Q,o,V,g){const B=C3[`idb://${Q}/${o}`];if(!B)return[];const R=B.queries[V];if(!R)return[null,!1,B,null];const r=R[(g.query?g.query.index.name:null)||""];if(!r)return[null,!1,B,null];switch(V){case"query":const u=r.find(E=>E.req.limit===g.limit&&E.req.values===g.values&&eI(E.req.query.range,g.query.range));return u?[u,!0,B,r]:[r.find(E=>("limit"in E.req?E.req.limit:1/0)>=g.limit&&(!g.values||E.req.values)&&dG(E.req.query.range,g.query.range)),!1,B,r];case"count":const Y=r.find(E=>eI(E.req.query.range,g.query.range));return[Y,!!Y,B,r]}}(l,c,"query",t);if(n&&s)n.obsSet=t.obsSet;else{const Q=G.query(t).then(o=>{const V=o.result;if(n.res=V,a){for(let g=0,B=V.length;g(A&&n&&cl(A,n),Promise.reject(o)));n={obsSet:t.obsSet,promise:Q,subscribers:new Set,type:"query",req:t,dirty:!1},A?A.push(n):(A=[n],p||(p=C3[`idb://${l}/${c}`]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}}),p.queries.query[t.query.index.name||""]=A)}return cG(n,A,Z,e),n.promise.then(Q=>({result:ZI(Q.result,t,p==null?void 0:p.optimisticOps,G,n,a)}))}}}}}};function fl(I,l){return new Proxy(I,{get:(d,c,G)=>c==="db"?l:Reflect.get(d,c,G)})}class l3{constructor(l,d){this._middlewares={},this.verno=0;const c=l3.dependencies;this._options=d={addons:l3.addons,autoOpen:!0,indexedDB:c.indexedDB,IDBKeyRange:c.IDBKeyRange,cache:"cloned",...d},this._deps={indexedDB:d.indexedDB,IDBKeyRange:d.IDBKeyRange};const{addons:G}=d;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const b={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:D2,dbReadyPromise:null,cancelOpen:D2,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var W;b.dbReadyPromise=new m2(a=>{b.dbReadyResolve=a}),b.openCanceller=new m2((a,Z)=>{b.cancelOpen=Z}),this._state=b,this.name=l,this.on=el(this,"populate","blocked","versionchange","close",{ready:[b4,D2]}),this.on.ready.subscribe=vd(this.on.ready.subscribe,a=>(Z,e)=>{l3.vip(()=>{const n=this._state;if(n.openComplete)n.dbOpenError||m2.resolve().then(Z),e&&a(Z);else if(n.onReadyBeingFired)n.onReadyBeingFired.push(Z),e&&a(Z);else{a(Z);const s=this;e||a(function p(){s.on.ready.unsubscribe(Z),s.on.ready.unsubscribe(p)})}})}),this.Collection=(W=this,Il(Lc.prototype,function(a,Z){this.db=W;let e=l6,n=null;if(Z)try{e=Z()}catch(Q){n=Q}const s=a._ctx,p=s.table,A=p.hook.reading.fire;this._ctx={table:p,index:s.index,isPrimKey:!s.index||p.schema.primKey.keyPath&&s.index===p.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:n,or:s.or,valueMapper:A!==Ql?A:null}})),this.Table=function(a){return Il(dI.prototype,function(Z,e,n){this.db=a,this._tx=n,this.name=Z,this.schema=e,this.hook=a._allTables[Z]?a._allTables[Z].hook:el(null,{creating:[Rc,D2],reading:[uc,Ql],updating:[rc,D2],deleting:[hc,D2]})})}(this),this.Transaction=function(a){return Il(Mc.prototype,function(Z,e,n,s,p){this.db=a,this.mode=Z,this.storeNames=e,this.schema=n,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=el(this,"complete","error","abort"),this.parent=p||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new m2((A,Q)=>{this._resolve=A,this._reject=Q}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},A=>{var Q=this.active;return this.active=!1,this.on.error.fire(A),this.parent?this.parent._reject(A):Q&&this.idbtrans&&this.idbtrans.abort(),Z0(A)})})}(this),this.Version=function(a){return Il(jc.prototype,function(Z){this.db=a,this._cfg={version:Z,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(a){return Il(d6.prototype,function(Z,e,n){if(this.db=a,this._ctx={table:Z,index:e===":id"?null:e,or:n},this._cmp=this._ascending=S2,this._descending=(s,p)=>S2(p,s),this._max=(s,p)=>S2(s,p)>0?s:p,this._min=(s,p)=>S2(s,p)<0?s:p,this._IDBKeyRange=a._deps.IDBKeyRange,!this._IDBKeyRange)throw new h2.MissingAPI})}(this),this.on("versionchange",a=>{a.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close({disableAutoOpen:!1}),this._state.openComplete=!1}),this.on("blocked",a=>{!a.newVersion||a.newVersionnew this.Transaction(a,Z,e,this._options.chromeTransactionDurability,n),this._fireOnBlocked=a=>{this.on("blocked").fire(a),Zl.filter(Z=>Z.name===this.name&&Z!==this&&!Z._state.vcFired).map(Z=>Z.on("versionchange").fire(a))},this.use(lG),this.use(GG),this.use(IG),this.use(_c),this.use($c);const t=new Proxy(this,{get:(a,Z,e)=>{if(Z==="_vip")return!0;if(Z==="table")return s=>fl(this.table(s),t);const n=Reflect.get(a,Z,e);return n instanceof dI?fl(n,t):Z==="tables"?n.map(s=>fl(s,t)):Z==="_createTransaction"?function(){const s=n.apply(this,arguments);return fl(s,t)}:n}});this.vip=t,G.forEach(a=>a(this))}version(l){if(isNaN(l)||l<.1)throw new h2.Type("Given version is not a positive number");if(l=Math.round(10*l)/10,this.idbdb||this._state.isBeingOpened)throw new h2.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,l);const d=this._versions;var c=d.filter(G=>G._cfg.version===l)[0];return c||(c=new this.Version(l),d.push(c),d.sort(Tc),c.stores({}),this._state.autoSchema=!1,c)}_whenReady(l){return this.idbdb&&(this._state.openComplete||X2.letThrough||this._vip)?l():new m2((d,c)=>{if(this._state.openComplete)return c(new h2.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void c(new h2.DatabaseClosed);this.open().catch(D2)}this._state.dbReadyPromise.then(d,c)}).then(l)}use({stack:l,create:d,level:c,name:G}){G&&this.unuse({stack:l,name:G});const b=this._middlewares[l]||(this._middlewares[l]=[]);return b.push({stack:l,create:d,level:c??10,name:G}),b.sort((W,t)=>W.level-t.level),this}unuse({stack:l,name:d,create:c}){return l&&this._middlewares[l]&&(this._middlewares[l]=this._middlewares[l].filter(G=>c?G.create!==c:!!d&&G.name!==d)),this}open(){return W3(E1,()=>Pc(this))}_close(){const l=this._state,d=Zl.indexOf(this);if(d>=0&&Zl.splice(d,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}l.dbReadyPromise=new m2(c=>{l.dbReadyResolve=c}),l.openCanceller=new m2((c,G)=>{l.cancelOpen=G})}close({disableAutoOpen:l}={disableAutoOpen:!0}){this._close();const d=this._state;l&&(this._options.autoOpen=!1),d.dbOpenError=new h2.DatabaseClosed,d.isBeingOpened&&d.cancelOpen(d.dbOpenError)}delete(){const l=arguments.length>0,d=this._state;return new m2((c,G)=>{const b=()=>{this.close({disableAutoOpen:!1});var W=this._deps.indexedDB.deleteDatabase(this.name);W.onsuccess=d0(()=>{(function({indexedDB:t,IDBKeyRange:a},Z){!e4(t)&&Z!=="__dbnames"&&Z4(t,a).delete(Z).catch(D2)})(this._deps,this.name),c()}),W.onerror=c1(G),W.onblocked=this._fireOnBlocked};if(l)throw new h2.InvalidArgument("Arguments not allowed in db.delete()");d.isBeingOpened?d.dbReadyPromise.then(b):b()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const l=this._state.dbOpenError;return l&&l.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return m0(this._allTables).map(l=>this._allTables[l])}transaction(){const l=qc.apply(this,arguments);return this._transaction.apply(this,l)}_transaction(l,d,c){let G=X2.trans;G&&G.db===this&&l.indexOf("!")===-1||(G=null);const b=l.indexOf("?")!==-1;let W,t;l=l.replace("!","").replace("?","");try{if(t=d.map(Z=>{var e=Z instanceof this.Table?Z.name:Z;if(typeof e!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e}),l=="r"||l==="readonly")W="readonly";else{if(l!="rw"&&l!="readwrite")throw new h2.InvalidArgument("Invalid transaction mode: "+l);W="readwrite"}if(G){if(G.mode==="readonly"&&W==="readwrite"){if(!b)throw new h2.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");G=null}G&&t.forEach(Z=>{if(G&&G.storeNames.indexOf(Z)===-1){if(!b)throw new h2.SubTransaction("Table "+Z+" not included in parent transaction.");G=null}}),b&&G&&!G.active&&(G=null)}}catch(Z){return G?G._promise(null,(e,n)=>{n(Z)}):Z0(Z)}const a=a6.bind(null,this,W,t,G,c);return G?G._promise(W,a,"lock"):X2.trans?W3(X2.transless,()=>this._whenReady(a)):this._whenReady(a)}table(l){if(!v0(this._allTables,l))throw new h2.InvalidTable(`Table ${l} does not exist`);return this._allTables[l]}}const bG=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class WG{constructor(l){this._subscribe=l}subscribe(l,d,c){return this._subscribe(l&&typeof l!="function"?l:{next:l,error:d,complete:c})}[bG](){return this}}let X5;try{X5={indexedDB:F0.indexedDB||F0.mozIndexedDB||F0.webkitIndexedDB||F0.msIndexedDB,IDBKeyRange:F0.IDBKeyRange||F0.webkitIDBKeyRange}}catch{X5={indexedDB:null,IDBKeyRange:null}}function aG(I){let l,d=!1;const c=new WG(G=>{const b=d4(I);let W,t=!1,a={},Z={};const e={get closed(){return t},unsubscribe:()=>{t||(t=!0,W&&W.abort(),n&&g1.storagemutated.unsubscribe(s))}};G.start&&G.start(e);let n=!1;const s=A=>{L5(a,A),W6(Z,a)&&p()},p=()=>{if(t||!X5.indexedDB)return;a={};const A={};W&&W.abort(),W=new AbortController;const Q={subscr:A,signal:W.signal,requery:p,querier:I,trans:null},o=function(V){const g=T3();try{b&&j3();const B=U1(I,V);return b&&B.finally(k1),B}finally{g&&f3()}}(Q);Promise.resolve(o).then(V=>{d=!0,l=V,t||Q.signal.aborted||(a={},Z=A,function(g){for(const B in g)if(v0(g,B))return!1;return!0}(Z)||n||(g1("storagemutated",s),n=!0),G.next&&G.next(V))},V=>{if(d=!1,!["DatabaseClosedError","AbortError"].includes(V==null?void 0:V.name)){if(t)return;G.error&&G.error(V)}})};return p(),e});return c.hasValue=()=>d,c.getValue=()=>l,c}const j1=l3;function a5(I){let l=Q1;try{Q1=!0,g1.storagemutated.fire(I),s4(I,!0)}finally{Q1=l}}U3(j1,{...I5,delete:I=>new j1(I,{addons:[]}).delete(),exists:I=>new j1(I,{addons:[]}).open().then(l=>(l.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(I){try{return function({indexedDB:l,IDBKeyRange:d}){return e4(l)?Promise.resolve(l.databases()).then(c=>c.map(G=>G.name).filter(G=>G!=="__dbnames")):Z4(l,d).toCollection().primaryKeys()}(j1.dependencies).then(I)}catch{return Z0(new h2.MissingAPI)}},defineClass:()=>function(I){S0(this,I)},ignoreTransaction:I=>X2.trans?W3(X2.transless,I):I(),vip:v9,async:function(I){return function(){try{var l=k9(I.apply(this,arguments));return l&&typeof l.then=="function"?l:m2.resolve(l)}catch(d){return Z0(d)}}},spawn:function(I,l,d){try{var c=k9(I.apply(d,l||[]));return c&&typeof c.then=="function"?c:m2.resolve(c)}catch(G){return Z0(G)}},currentTransaction:{get:()=>X2.trans||null},waitFor:function(I,l){const d=m2.resolve(typeof I=="function"?j1.ignoreTransaction(I):I).timeout(l||6e4);return X2.trans?X2.trans.waitFor(d):d},Promise:m2,debug:{get:()=>h1,set:I=>{Sd(I,I==="dexie"?()=>!0:$d)}},derive:E3,extend:S0,props:U3,override:vd,Events:el,on:g1,liveQuery:aG,extendObservabilitySet:L5,getByKeyPath:V1,setByKeyPath:f0,delByKeyPath:function(I,l){typeof l=="string"?f0(I,l,void 0):"length"in l&&[].map.call(l,function(d){f0(I,d,void 0)})},shallowClone:Ud,deepClone:L1,getObjectDiff:m4,cmp:S2,asap:Ld,minKey:-(1/0),addons:[],connections:Zl,errnames:G4,dependencies:X5,cache:C3,semVer:"4.0.1-alpha.25",version:"4.0.1-alpha.25".split(".").map(I=>parseInt(I)).reduce((I,l,d)=>I+l/Math.pow(10,2*d))}),j1.maxKey=Vl(j1.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(g1("storagemutated",I=>{if(!Q1){let l;v5?(l=document.createEvent("CustomEvent"),l.initCustomEvent("x-storagemutated-1",!0,!0,I)):l=new CustomEvent("x-storagemutated-1",{detail:I}),Q1=!0,dispatchEvent(l),Q1=!1}}),addEventListener("x-storagemutated-1",({detail:I})=>{Q1||a5(I)}));let Q1=!1;if(typeof BroadcastChannel<"u"){const I=new BroadcastChannel("x-storagemutated-1");typeof I.unref=="function"&&I.unref(),g1("storagemutated",l=>{Q1||I.postMessage(l)}),I.onmessage=l=>{l.data&&a5(l.data)}}else if(typeof self<"u"&&typeof navigator<"u"){g1("storagemutated",l=>{try{Q1||(typeof localStorage<"u"&&localStorage.setItem("x-storagemutated-1",JSON.stringify({trig:Math.random(),changedParts:l})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(d=>d.postMessage({type:"x-storagemutated-1",changedParts:l})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",l=>{if(l.key==="x-storagemutated-1"){const d=JSON.parse(l.newValue);d&&a5(d.changedParts)}});const I=self.document&&navigator.serviceWorker;I&&I.addEventListener("message",function({data:l}){l&&l.type==="x-storagemutated-1"&&a5(l.changedParts)})}m2.rejectionMapper=function(I,l){if(!I||I instanceof J3||I instanceof TypeError||I instanceof SyntaxError||!I.name||!q4[I.name])return I;var d=new q4[I.name](l||I.message,I);return"stack"in I&&o1(d,"stack",{get:function(){return this.inner.stack}}),d},Sd(h1,$d);let M1=!!window.indexedDB;const tG=M1&&window.indexedDB.open("test");M1&&(tG.onerror=()=>{M1=!1});let t3={};class ZG extends l3{constructor(){super("chatImageStore");R2(this,"images");this.version(1).stores({images:"id"})}}const k3=new ZG,n6=async I=>{let l=t3[I];return l||!M1||(l=await k3.images.get(I),t3[I]=l),l},s6=async(I,l)=>{var c,G,b,W;const d=t3[l];if(d&&(d.chats=(c=d.chats)==null?void 0:c.filter(t=>t!==I)),(G=d==null?void 0:d.chats)!=null&&G.length||delete t3[l],M1){const t=await k3.images.get({id:l});t&&(t.chats=(b=t.chats)==null?void 0:b.filter(a=>a!==I)),(W=t==null?void 0:t.chats)!=null&&W.length?t&&await A4(I,t):k3.images.delete(l)}},eG=async()=>{t3={},M1&&k3.images.clear()},A4=async(I,l)=>{l.id=l.id||h0();let d;M1?d=await k3.images.get({id:l.id}):d=t3[l.id],d=d||l,d.chats=d.chats||[],I in d.chats||d.chats.push(I),t3[d.id]=d,M1&&k3.images.put(d,d.id);const c=JSON.parse(JSON.stringify(d));return delete c.b64image,delete c.chats,c},I3=B0(!1),d3=B0(null),c3=B0([]),m6=B0(null);function nG(I=1){var c,G;const l=w2(c3).length,d=w2(c3)[l-1];return w2(d3)||(c=d==null?void 0:d.callbacks)!=null&&c.onBeforeClose&&((G=d==null?void 0:d.callbacks)==null?void 0:G.onBeforeClose())===!1?!1:(w2(I3)&&l>0&&d3.set(!0),I3.set(!1),m6.set("pop"),sG(I),!0)}function x3(){return nG(1)}function b1(I,l,d){w2(d3)||(m6.set("push"),w2(I3)&&w2(c3).length&&d3.set(!0),I3.set(!1),d!=null&&d.replace?c3.update(c=>[...c.slice(0,c.length-1),{component:I,props:l}]):c3.update(c=>[...c,{component:I,props:l}]))}function sG(I=1){c3.update(l=>l.slice(0,Math.max(0,l.length-I)))}function nI(I,l,d){const c=I.slice();return c[9]=l[d],c[11]=d,c}const mG=I=>({}),sI=I=>({}),pG=I=>({}),mI=I=>({});function pI(I){let l;const d=I[4].backdrop,c=O2(d,I,I[3],mI);return{c(){c&&c.c()},m(G,b){c&&c.m(G,b),l=!0},p(G,b){c&&c.p&&(!l||b&8)&&q2(c,d,G,G[3],l?P2(d,G[3],b,pG):_2(G[3]),mI)},i(G){l||(h(c,G),l=!0)},o(G){i(c,G),l=!1},d(G){c&&c.d(G)}}}function AG(I){let l,d,c;const G=[{isOpen:I[11]===I[0].length-1&&!I[1]},I[9].props];var b=I[9].component;function W(t){let a={};for(let Z=0;Z{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("introstart",t[7]),l.$on("outroend",t[8]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){t&&H(d),l&&O(l,t)}}}function QG(I){let l,d,c,G={ctx:I,current:null,token:null,hasCatch:!1,pending:VG,then:oG,catch:FG,value:12,blocks:[,,,]};return j4(d=QI(I[9].component),G),{c(){l=r2(),G.block.c()},m(b,W){K(b,l,W),G.block.m(b,G.anchor=W),G.mount=()=>l.parentNode,G.anchor=l,c=!0},p(b,W){I=b,G.ctx=I,W&1&&d!==(d=QI(I[9].component))&&j4(d,G)||P7(G,I,W)},i(b){c||(h(G.block),c=!0)},o(b){for(let W=0;W<3;W+=1){const t=G.blocks[W];i(t)}c=!1},d(b){b&&H(l),G.block.d(b),G.token=null,G=null}}}function FG(I){return{c:c2,m:c2,p:c2,i:c2,o:c2,d:c2}}function oG(I){let l,d,c;const G=[{isOpen:I[11]===I[0].length-1&&!I[1]},I[9].props];var b=I[12];function W(t){let a={};for(let Z=0;Z{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("introstart",t[5]),l.$on("outroend",t[6]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){l&&O(l,t),t&&H(d)}}}function VG(I){let l,d;const c=I[4].loading,G=O2(c,I,I[3],sI);return{c(){G&&G.c(),l=x()},m(b,W){G&&G.m(b,W),K(b,l,W),d=!0},p(b,W){G&&G.p&&(!d||W&8)&&q2(G,c,b,b[3],d?P2(c,b[3],W,mG):_2(b[3]),sI)},i(b){d||(h(G,b),d=!0)},o(b){i(G,b),d=!1},d(b){G&&G.d(b),b&&H(l)}}}function AI(I,l){let d,c,G,b,W,t;const a=[QG,AG],Z=[];function e(n,s){return s&1&&(c=null),c==null&&(c=!!uG(n[9].component)),c?0:1}return G=e(l,-1),b=Z[G]=a[G](l),{key:I,first:null,c(){d=r2(),b.c(),W=r2(),this.first=d},m(n,s){K(n,d,s),Z[G].m(n,s),K(n,W,s),t=!0},p(n,s){l=n;let p=G;G=e(l,s),G===p?Z[G].p(l,s):(a2(),i(Z[p],1,1,()=>{Z[p]=null}),t2(),b=Z[G],b?b.p(l,s):(b=Z[G]=a[G](l),b.c()),h(b,1),b.m(W.parentNode,W))},i(n){t||(h(b),t=!0)},o(n){i(b),t=!1},d(n){n&&H(d),Z[G].d(n),n&&H(W)}}}function XG(I){let l=[],d=new Map,c,G,b=I[0];const W=t=>t[11];for(let t=0;t0&&pI(I);const G=I[4].default,b=O2(G,I,I[3],null),W=b||XG(I);return{c(){c&&c.c(),l=x(),W&&W.c()},m(t,a){c&&c.m(t,a),K(t,l,a),W&&W.m(t,a),d=!0},p(t,[a]){t[0].length>0?c?(c.p(t,a),a&1&&h(c,1)):(c=pI(t),c.c(),h(c,1),c.m(l.parentNode,l)):c&&(a2(),i(c,1,1,()=>{c=null}),t2()),b?b.p&&(!d||a&8)&&q2(b,G,t,t[3],d?P2(G,t[3],a,null):_2(t[3]),null):W&&W.p&&(!d||a&15)&&W.p(t,d?a:-1)},i(t){d||(h(c),h(W,t),d=!0)},o(t){i(c),i(W,t),d=!1},d(t){c&&c.d(t),t&&H(l),W&&W.d(t)}}}function uG(I){return typeof I.prototype>"u"}async function QI(I){return I().then(l=>l.default)}function RG(I,l,d){let c,G,b;y2(I,c3,s=>d(0,c=s)),y2(I,d3,s=>d(1,G=s)),y2(I,I3,s=>d(2,b=s));let{$$slots:W={},$$scope:t}=l;const a=()=>{c0(I3,b=!0,b)},Z=()=>{c0(d3,G=!1,G)},e=()=>{c0(I3,b=!0,b)},n=()=>{c0(d3,G=!1,G)};return I.$$set=s=>{"$$scope"in s&&d(3,t=s.$$scope)},[c,G,b,t,W,a,Z,e,n]}class hG extends C2{constructor(l){super(),N2(this,l,RG,gG,g2,{})}}function FI(I){let l,d,c,G,b,W,t,a,Z,e,n,s,p,A,Q,o,V,g,B,R,r,u,Y,E,y;function C(J,U){return J[3]?BG:rG}let k=C(I),L=k(I);return{c(){l=X("div"),d=X("div"),c=x(),G=X("div"),b=X("article"),W=X("div"),t=X("p"),a=s2(I[1]),Z=x(),e=X("button"),n=x(),s=X("div"),L.c(),p=x(),A=X("div"),Q=X("div"),o=X("div"),V=x(),g=X("div"),B=X("div"),R=X("button"),r=s2(I[4]),m(d,"class","modal-background"),m(e,"class","delete"),m(e,"aria-label","close"),m(e,"type","button"),m(W,"class","message-header"),m(s,"class","message-body"),m(o,"class","level-right"),m(R,"class",u="button "+I[5]),m(R,"type","button"),m(B,"class","level-item"),m(g,"class","level-right"),m(Q,"class","level is-mobile"),m(A,"class","message-footer"),m(b,"class",Y="message "+I[6]),m(G,"class","modal-content nomax"),m(l,"class","modal is-active")},m(J,U){K(J,l,U),F(l,d),F(l,c),F(l,G),F(G,b),F(b,W),F(W,t),F(t,a),F(W,Z),F(W,e),F(b,n),F(b,s),L.m(s,null),F(b,p),F(b,A),F(A,Q),F(Q,o),F(Q,V),F(Q,g),F(g,B),F(B,R),F(R,r),E||(y=[_(d,"click",I[7]),_(e,"click",I[7]),_(R,"click",I[7]),_(l,"modal-esc",I[7])],E=!0)},p(J,U){U&2&&T2(a,J[1]),k===(k=C(J))&&L?L.p(J,U):(L.d(1),L=k(J),L&&(L.c(),L.m(s,null))),U&16&&T2(r,J[4]),U&32&&u!==(u="button "+J[5])&&m(R,"class",u),U&64&&Y!==(Y="message "+J[6])&&m(b,"class",Y)},d(J){J&&H(l),L.d(),E=!1,a0(y)}}}function rG(I){let l;return{c(){l=s2(I[2])},m(d,c){K(d,l,c)},p(d,c){c&4&&T2(l,d[2])},d(d){d&&H(l)}}}function BG(I){let l,d;return{c(){l=new wl(!1),d=r2(),l.a=d},m(c,G){l.m(I[2],c,G),K(c,d,G)},p(c,G){G&4&&l.p(c[2])},d(c){c&&H(d),c&&l.d()}}}function iG(I){let l,d=I[0]&&FI(I);return{c(){d&&d.c(),l=r2()},m(c,G){d&&d.m(c,G),K(c,l,G)},p(c,[G]){c[0]?d?d.p(c,G):(d=FI(c),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i:c2,o:c2,d(c){d&&d.d(c),c&&H(l)}}}function wG(I,l,d){let{isOpen:c}=l,{title:G}=l,{message:b}=l,{asHtml:W=!1}=l,{onConfirm:t=null}=l,{confirmButton:a="Close"}=l,{confirmButtonClass:Z="is-info"}=l,{class:e=""}=l;const n=()=>{(!t||!t())&&x3()};return I.$$set=s=>{"isOpen"in s&&d(0,c=s.isOpen),"title"in s&&d(1,G=s.title),"message"in s&&d(2,b=s.message),"asHtml"in s&&d(3,W=s.asHtml),"onConfirm"in s&&d(8,t=s.onConfirm),"confirmButton"in s&&d(4,a=s.confirmButton),"confirmButtonClass"in s&&d(5,Z=s.confirmButtonClass),"class"in s&&d(6,e=s.class)},[c,G,b,W,a,Z,e,n,t]}class YG extends C2{constructor(l){super(),N2(this,l,wG,iG,g2,{isOpen:0,title:1,message:2,asHtml:3,onConfirm:8,confirmButton:4,confirmButtonClass:5,class:6})}}function NG(I,l){if(I===l)throw new Error("Cannot compare node with itself");const d={a:XI(I),b:XI(l)};let c;for(;d.a.at(-1)===d.b.at(-1);)I=d.a.pop(),l=d.b.pop(),c=I;const G={a:VI(oI(d.a)),b:VI(oI(d.b))};if(G.a===G.b){const b=c.childNodes,W={a:d.a.at(-1),b:d.b.at(-1)};let t=b.length;for(;t--;){const a=b[t];if(a===W.a)return 1;if(a===W.b)return-1}}return Math.sign(G.a-G.b)}const CG=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function HG(I){const l=getComputedStyle(p6(I)).display;return l==="flex"||l==="inline-flex"}function KG(I){const l=getComputedStyle(I);return!!(l.position==="fixed"||l.zIndex!=="auto"&&l.position!=="static"||HG(I)||+l.opacity<1||"transform"in l&&l.transform!=="none"||"webkitTransform"in l&&l.webkitTransform!=="none"||"mixBlendMode"in l&&l.mixBlendMode!=="normal"||"filter"in l&&l.filter!=="none"||"webkitFilter"in l&&l.webkitFilter!=="none"||"isolation"in l&&l.isolation==="isolate"||CG.test(l.willChange)||l.webkitOverflowScrolling==="touch")}function oI(I){let l=I.length;for(;l--;)if(KG(I[l]))return I[l];return null}function VI(I){return I&&Number(getComputedStyle(I).zIndex)||0}function XI(I){const l=[];for(;I;)l.push(I),I=p6(I);return l}function p6(I){var l;return((l=I.parentNode)==null?void 0:l.host)||I.parentNode}const x9=I=>{const l=document.querySelectorAll("textarea.auto-size");for(let d=0,c=l.length;d{I.target!==null&&(I.target.__didAutoGrow=!1,A6(I.target))},A6=(I,l)=>{const d=I;(l||!d.__didAutoGrow)&&(I.style.height="38px"),I.style.height=I.scrollHeight+"px",setTimeout(()=>{I.scrollHeight>I.getBoundingClientRect().height+5?I.style.overflowY="auto":I.style.overflowY=""},0),d.__didAutoGrow=!0},EG=(I,l,d=!1,c=!1)=>{const G=d?"instant":"smooth";c?window.scrollTo({behavior:G,top:I.getBoundingClientRect().bottom-document.body.getBoundingClientRect().top-(window.innerHeight-l)}):window.scrollTo({behavior:G,top:I.getBoundingClientRect().top-document.body.getBoundingClientRect().top-l})},g5=(I,l=60,d=!1,c=!1)=>{if(Array.isArray(I)&&(I=I[0]),!I){console.error("Not a valid uuid",I);return}const G=document.getElementById("message-"+I);G?EG(G,l,d,c):console.error("Can't find element with message ID",I)},t5=(I=!1)=>{setTimeout(()=>{var l;return(l=document.querySelector("body"))==null?void 0:l.scrollIntoView({behavior:I?"instant":"smooth",block:"end"})},0)},JG=I=>{!I||I.key!=="Escape"||Q6()},Q6=()=>{const I=Array.from(document.querySelectorAll(".modal, .has-esc")).filter(d=>window.getComputedStyle(d).getPropertyValue("display")!=="none"),l=I.length===1?I[0]:I.find(d=>I.find(c=>d!==c&&NG(d,c)>0&&d));if(l){const d=new CustomEvent("modal-esc",{detail:l});l.dispatchEvent(d)}},yG=I=>I.replace(/[\u00A0-\u9999<>&]/g,l=>`&#${l.charCodeAt(0)};`),g0=(I,l=void 0)=>{b1(YG,{title:"Error",class:"is-danger",message:I+(l?"
"+l.message:""),asHtml:!0,onConfirm:()=>{}})},vG=I=>{const l=ul(D0(I).settings);q0(`/chat/${l}`)},S9=(I,l)=>{(()=>{const c=ul(l);q0(`/chat/${c}`)})()},u0=(I,l)=>typeof l=="function"?l(I):l,LG=I=>I.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&"),G0={};typeof window<"u"&&(window.llamaTokenizer=G0);const F6=function(I){return atob(I)},o6=function(I,l){return G0.vocabById[I]+" "+G0.vocabById[l]},UG=function(I){const l=F6(I),d=new Uint8Array(l.length);for(let b=0;bc.charCodeAt(0));return new TextDecoder("utf-8").decode(l).split(` +From previous: `);return this._state!==null&&(this._stack=I),I}finally{R9=!1}}},timeout:function(I,l){return I<1/0?new m2((d,c)=>{var G=setTimeout(()=>c(new h2.Timeout(l)),I);this.then(d,c).finally(clearTimeout.bind(null,G))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&o1(m2.prototype,Symbol.toStringTag,"Dexie.Promise"),E1.env=_d(),U3(m2,{all:function(){var I=p1.apply(null,arguments).map(xl);return new m2(function(l,d){I.length===0&&l([]);var c=I.length;I.forEach((G,b)=>m2.resolve(G).then(W=>{I[b]=W,--c||l(I)},d))})},resolve:I=>{if(I instanceof m2)return I;if(I&&typeof I.then=="function")return new m2((d,c)=>{I.then(d,c)});var l=new m2(Fl,!0,I);return qd(l,r9),l},reject:kl,race:function(){var I=p1.apply(null,arguments).map(xl);return new m2((l,d)=>{I.map(c=>m2.resolve(c).then(l,d))})},PSD:{get:()=>X2,set:I=>X2=I},totalEchoes:{get:()=>Q5},newPSD:U1,usePSD:W3,scheduler:{get:()=>tl,set:I=>{tl=I}},rejectionMapper:{get:()=>B9,set:I=>{B9=I}},follow:(I,l)=>new m2((d,c)=>U1((G,b)=>{var W=X2;W.unhandleds=[],W.onunhandled=b,W.finalize=b3(function(){(function(t){function a(){t(),G5.splice(G5.indexOf(a),1)}G5.push(a),++$1,tl(()=>{--$1==0&&t4()},[])})(()=>{this.unhandleds.length===0?G():b(this.unhandleds[0])})},W.finalize),I()},l,d,c))}),d5&&(d5.allSettled&&o1(m2,"allSettled",function(){const I=p1.apply(null,arguments).map(xl);return new m2(l=>{I.length===0&&l([]);let d=I.length;const c=new Array(d);I.forEach((G,b)=>m2.resolve(G).then(W=>c[b]={status:"fulfilled",value:W},W=>c[b]={status:"rejected",reason:W}).then(()=>--d||l(c)))})}),d5.any&&typeof AggregateError<"u"&&o1(m2,"any",function(){const I=p1.apply(null,arguments).map(xl);return new m2((l,d)=>{I.length===0&&d(new AggregateError([]));let c=I.length;const G=new Array(c);I.forEach((b,W)=>m2.resolve(b).then(t=>l(t),t=>{G[W]=t,--c||d(new AggregateError(G))}))})}));const R0={awaits:0,echoes:0,id:0};var Cc=0,b5=[],P5=0,Q5=0,Hc=0;function U1(I,l,d,c){var G=X2,b=Object.create(G);b.parent=G,b.ref=0,b.global=!1,b.id=++Hc;var W=E1.env;b.env=W4?{Promise:m2,PromiseProp:{value:m2,configurable:!0,writable:!0},all:m2.all,race:m2.race,allSettled:m2.allSettled,any:m2.any,resolve:m2.resolve,reject:m2.reject,nthen:$4(W.nthen,b),gthen:$4(W.gthen,b)}:{},l&&S0(b,l),++G.ref,b.finalize=function(){--this.parent.ref||this.parent.finalize()};var t=W3(b,I,d,c);return b.ref===0&&b.finalize(),t}function j3(){return R0.id||(R0.id=++Cc),++R0.awaits,R0.echoes+=100,R0.id}function k1(){return!!R0.awaits&&(--R0.awaits==0&&(R0.id=0),R0.echoes=100*R0.awaits,!0)}function xl(I){return R0.echoes&&I&&I.constructor===d5?(j3(),I.then(l=>(k1(),l),l=>(k1(),Z0(l)))):I}function Kc(I){++Q5,R0.echoes&&--R0.echoes!=0||(R0.echoes=R0.id=0),b5.push(X2),x1(I,!0)}function Ec(){var I=b5[b5.length-1];b5.pop(),x1(I,!1)}function x1(I,l){var d=X2;if((l?!R0.echoes||P5++&&I===X2:!P5||--P5&&I===X2)||queueMicrotask(l?Kc.bind(null,I):Ec),I!==X2&&(X2=I,d===E1&&(E1.env=_d()),W4)){var c=E1.env.Promise,G=I.env;p5.then=G.nthen,c.prototype.then=G.gthen,(d.global||I.global)&&(Object.defineProperty(F0,"Promise",G.PromiseProp),c.all=G.all,c.race=G.race,c.resolve=G.resolve,c.reject=G.reject,G.allSettled&&(c.allSettled=G.allSettled),G.any&&(c.any=G.any))}}function _d(){var I=F0.Promise;return W4?{Promise:I,PromiseProp:Object.getOwnPropertyDescriptor(F0,"Promise"),all:I.all,race:I.race,allSettled:I.allSettled,any:I.any,resolve:I.resolve,reject:I.reject,nthen:p5.then,gthen:I.prototype.then}:{}}function W3(I,l,d,c,G){var b=X2;try{return x1(I,!0),l(d,c,G)}finally{x1(b,!1)}}function F5(I,l,d,c){return typeof I!="function"?I:function(){var G=X2;d&&j3(),x1(l,!0);try{return I.apply(this,arguments)}finally{x1(G,!1),c&&queueMicrotask(k1)}}}function $4(I,l){return function(d,c){return I.call(this,F5(d,l),F5(c,l))}}(""+wc).indexOf("[native code]")===-1&&(j3=k1=D2);var Z0=m2.reject;function Y9(I,l,d,c){if(I.idbdb&&(I._state.openComplete||X2.letThrough||I._vip)){var G=I._createTransaction(l,d,I._dbSchema);try{G.create(),I._state.PR1398_maxLoop=3}catch(b){return b.name===G4.InvalidState&&I.isOpen()&&--I._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),I._close(),I.open().then(()=>Y9(I,l,d,c))):Z0(b)}return G._promise(l,(b,W)=>U1(()=>(X2.trans=G,c(b,W,G)))).then(b=>{if(l==="readwrite")try{G.idbtrans.commit()}catch{}return l==="readonly"?b:G._completion.then(()=>b)})}if(I._state.openComplete)return Z0(new h2.DatabaseClosed(I._state.dbOpenError));if(!I._state.isBeingOpened){if(!I._options.autoOpen)return Z0(new h2.DatabaseClosed);I.open().catch(D2)}return I._state.dbReadyPromise.then(()=>Y9(I,l,d,c))}const P1=String.fromCharCode(65535),s1="Invalid key provided. Keys must be of type string, number, Date or Array.",Zl=[],v5=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Jc=v5,yc=v5,$d=I=>!/(dexie\.js|dexie\.min\.js)/.test(I);function a3(I,l){return I?l?function(){return I.apply(this,arguments)&&l.apply(this,arguments)}:I:l}const l6={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Ml(I){return typeof I!="string"||/\./.test(I)?l=>l:l=>(l[I]===void 0&&I in l&&delete(l=L1(l))[I],l)}function vc(){throw h2.Type()}function S2(I,l){try{const d=lI(I),c=lI(l);if(d!==c)return d==="Array"?1:c==="Array"?-1:d==="binary"?1:c==="binary"?-1:d==="string"?1:c==="string"?-1:d==="Date"?1:c!=="Date"?NaN:-1;switch(d){case"number":case"Date":case"string":return I>l?1:IG._promise(l,W,c),{trans:G,transless:X2.transless||X2}):Y9(this.db,l,[this.name],W)}finally{t&&f3()}}get(l,d){return l&&l.constructor===Object?this.where(l).first(d):this._trans("readonly",c=>this.core.get({trans:c,key:l}).then(G=>this.hook.reading.fire(G))).then(d)}where(l){if(typeof l=="string")return new this.db.WhereClause(this,l);if(r0(l))return new this.db.WhereClause(this,`[${l.join("+")}]`);const d=m0(l);if(d.length===1)return this.where(d[0]).equals(l[d[0]]);const c=this.schema.indexes.concat(this.schema.primKey).filter(Z=>{if(Z.compound&&d.every(e=>Z.keyPath.indexOf(e)>=0)){for(let e=0;eZ.keyPath.length-e.keyPath.length)[0];if(c&&this.db._maxKey!==P1){const Z=c.keyPath.slice(0,d.length);return this.where(Z).equals(Z.map(e=>l[e]))}!c&&h1&&console.warn(`The query ${JSON.stringify(l)} on ${this.name} would benefit of a compound index [${d.join("+")}]`);const{idxByName:G}=this.schema,b=this.db._deps.indexedDB;function W(Z,e){return b.cmp(Z,e)===0}const[t,a]=d.reduce(([Z,e],n)=>{const s=G[n],p=l[n];return[Z||s,Z||!s?a3(e,s&&s.multi?A=>{const Q=V1(A,n);return r0(Q)&&Q.some(o=>W(p,o))}:A=>W(p,V1(A,n))):e]},[null,null]);return t?this.where(t.name).equals(l[t.keyPath]).filter(a):c?this.filter(a):this.where(d).equals("")}filter(l){return this.toCollection().and(l)}count(l){return this.toCollection().count(l)}offset(l){return this.toCollection().offset(l)}limit(l){return this.toCollection().limit(l)}each(l){return this.toCollection().each(l)}toArray(l){return this.toCollection().toArray(l)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(l){return new this.db.Collection(new this.db.WhereClause(this,r0(l)?`[${l.join("+")}]`:l))}reverse(){return this.toCollection().reverse()}mapToClass(l){const{db:d,name:c}=this;this.schema.mappedClass=l,l.prototype instanceof vc&&(l=class extends l{get db(){return d}table(){return c}});const G=new Set;for(let W=l.prototype;W;W=L3(W))Object.getOwnPropertyNames(W).forEach(t=>G.add(t));const b=W=>{if(!W)return W;const t=Object.create(l.prototype);for(let a in W)if(!G.has(a))try{t[a]=W[a]}catch{}return t};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=b,this.hook("reading",b),l}defineClass(){return this.mapToClass(function(l){S0(this,l)})}add(l,d){const{auto:c,keyPath:G}=this.schema.primKey;let b=l;return G&&c&&(b=Ml(G)(l)),this._trans("readwrite",W=>this.core.mutate({trans:W,type:"add",keys:d!=null?[d]:null,values:[b]})).then(W=>W.numFailures?m2.reject(W.failures[0]):W.lastResult).then(W=>{if(G)try{f0(l,G,W)}catch{}return W})}update(l,d){if(typeof l!="object"||r0(l))return this.where(":id").equals(l).modify(d);{const c=V1(l,this.schema.primKey.keyPath);return c===void 0?Z0(new h2.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(c).modify(d)}}put(l,d){const{auto:c,keyPath:G}=this.schema.primKey;let b=l;return G&&c&&(b=Ml(G)(l)),this._trans("readwrite",W=>this.core.mutate({trans:W,type:"put",values:[b],keys:d!=null?[d]:null})).then(W=>W.numFailures?m2.reject(W.failures[0]):W.lastResult).then(W=>{if(G)try{f0(l,G,W)}catch{}return W})}delete(l){return this._trans("readwrite",d=>this.core.mutate({trans:d,type:"delete",keys:[l]})).then(d=>d.numFailures?m2.reject(d.failures[0]):void 0)}clear(){return this._trans("readwrite",l=>this.core.mutate({trans:l,type:"deleteRange",range:l6})).then(l=>l.numFailures?m2.reject(l.failures[0]):void 0)}bulkGet(l){return this._trans("readonly",d=>this.core.getMany({keys:l,trans:d}).then(c=>c.map(G=>this.hook.reading.fire(G))))}bulkAdd(l,d,c){const G=Array.isArray(d)?d:void 0,b=(c=c||(G?void 0:d))?c.allKeys:void 0;return this._trans("readwrite",W=>{const{auto:t,keyPath:a}=this.schema.primKey;if(a&&G)throw new h2.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(G&&G.length!==l.length)throw new h2.InvalidArgument("Arguments objects and keys must have the same length");const Z=l.length;let e=a&&t?l.map(Ml(a)):l;return this.core.mutate({trans:W,type:"add",keys:G,values:e,wantResults:b}).then(({numFailures:n,results:s,lastResult:p,failures:A})=>{if(n===0)return b?s:p;throw new N3(`${this.name}.bulkAdd(): ${n} of ${Z} operations failed`,A)})})}bulkPut(l,d,c){const G=Array.isArray(d)?d:void 0,b=(c=c||(G?void 0:d))?c.allKeys:void 0;return this._trans("readwrite",W=>{const{auto:t,keyPath:a}=this.schema.primKey;if(a&&G)throw new h2.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(G&&G.length!==l.length)throw new h2.InvalidArgument("Arguments objects and keys must have the same length");const Z=l.length;let e=a&&t?l.map(Ml(a)):l;return this.core.mutate({trans:W,type:"put",keys:G,values:e,wantResults:b}).then(({numFailures:n,results:s,lastResult:p,failures:A})=>{if(n===0)return b?s:p;throw new N3(`${this.name}.bulkPut(): ${n} of ${Z} operations failed`,A)})})}bulkUpdate(l){const d=this.core,c=l.map(W=>W.key),G=l.map(W=>W.changes),b=[];return this._trans("readwrite",W=>d.getMany({trans:W,keys:c,cache:"clone"}).then(t=>{const a=[],Z=[];l.forEach(({key:n,changes:s},p)=>{const A=t[p];if(A){for(const Q of Object.keys(s)){const o=s[Q];if(Q===this.schema.primKey.keyPath){if(S2(o,n)!==0)throw new h2.Constraint("Cannot update primary key in bulkUpdate()")}else f0(A,Q,o)}b.push(p),a.push(n),Z.push(A)}});const e=a.length;return d.mutate({trans:W,type:"put",keys:a,values:Z,updates:{keys:c,changeSpecs:G}}).then(({numFailures:n,failures:s})=>{if(n===0)return e;for(const p of Object.keys(s)){const A=b[Number(p)];if(A!=null){const Q=s[p];delete s[p],s[A]=Q}}throw new N3(`${this.name}.bulkUpdate(): ${n} of ${e} operations failed`,s)})}))}bulkDelete(l){const d=l.length;return this._trans("readwrite",c=>this.core.mutate({trans:c,type:"delete",keys:l})).then(({numFailures:c,lastResult:G,failures:b})=>{if(c===0)return G;throw new N3(`${this.name}.bulkDelete(): ${c} of ${d} operations failed`,b)})}}function el(I){var l={},d=function(t,a){if(a){for(var Z=arguments.length,e=new Array(Z-1);--Z;)e[Z-1]=arguments[Z];return l[t].subscribe.apply(null,e),I}if(typeof t=="string")return l[t]};d.addEventType=b;for(var c=1,G=arguments.length;ca3(c(),l()):l,I.justLimit=d&&!c}function W5(I,l){if(I.isPrimKey)return l.primaryKey;const d=l.getIndexByKeyPath(I.index);if(!d)throw new h2.Schema("KeyPath "+I.index+" on object store "+l.name+" is not indexed");return d}function cI(I,l,d){const c=W5(I,l.schema);return l.openCursor({trans:d,values:!I.keysOnly,reverse:I.dir==="prev",unique:!!I.unique,query:{index:c,range:I.range}})}function Sl(I,l,d,c){const G=I.replayFilter?a3(I.filter,I.replayFilter()):I.filter;if(I.or){const b={},W=(t,a,Z)=>{if(!G||G(a,Z,s=>a.stop(s),s=>a.fail(s))){var e=a.primaryKey,n=""+e;n==="[object ArrayBuffer]"&&(n=""+new Uint8Array(e)),v0(b,n)||(b[n]=!0,l(t,a,Z))}};return Promise.all([I.or._iterate(W,d),GI(cI(I,c,d),I.algorithm,W,!I.keysOnly&&I.valueMapper)])}return GI(cI(I,c,d),a3(I.algorithm,G),l,!I.keysOnly&&I.valueMapper)}function GI(I,l,d,c){var G=d0(c?(b,W,t)=>d(c(b),W,t):d);return I.then(b=>{if(b)return b.start(()=>{var W=()=>b.continue();l&&!l(b,t=>W=t,t=>{b.stop(t),W=D2},t=>{b.fail(t),W=D2})||G(b.value,b,t=>W=t),W()})})}class Lc{_read(l,d){var c=this._ctx;return c.error?c.table._trans(null,Z0.bind(null,c.error)):c.table._trans("readonly",l).then(d)}_write(l){var d=this._ctx;return d.error?d.table._trans(null,Z0.bind(null,d.error)):d.table._trans("readwrite",l,"locked")}_addAlgorithm(l){var d=this._ctx;d.algorithm=a3(d.algorithm,l)}_iterate(l,d){return Sl(this._ctx,l,d,this._ctx.table.core)}clone(l){var d=Object.create(this.constructor.prototype),c=Object.create(this._ctx);return l&&S0(c,l),d._ctx=c,d}raw(){return this._ctx.valueMapper=null,this}each(l){var d=this._ctx;return this._read(c=>Sl(d,l,c,d.table.core))}count(l){return this._read(d=>{const c=this._ctx,G=c.table.core;if(h3(c,!0))return G.count({trans:d,query:{index:W5(c,G.schema),range:c.range}}).then(W=>Math.min(W,c.limit));var b=0;return Sl(c,()=>(++b,!1),d,G).then(()=>b)}).then(l)}sortBy(l,d){const c=l.split(".").reverse(),G=c[0],b=c.length-1;function W(Z,e){return e?W(Z[c[e]],e-1):Z[G]}var t=this._ctx.dir==="next"?1:-1;function a(Z,e){var n=W(Z,b),s=W(e,b);return ns?t:0}return this.toArray(function(Z){return Z.sort(a)}).then(d)}toArray(l){return this._read(d=>{var c=this._ctx;if(c.dir==="next"&&h3(c,!0)&&c.limit>0){const{valueMapper:G}=c,b=W5(c,c.table.core.schema);return c.table.core.query({trans:d,limit:c.limit,values:!0,query:{index:b,range:c.range}}).then(({result:W})=>G?W.map(G):W)}{const G=[];return Sl(c,b=>G.push(b),d,c.table.core).then(()=>G)}},l)}offset(l){var d=this._ctx;return l<=0||(d.offset+=l,h3(d)?_5(d,()=>{var c=l;return(G,b)=>c===0||(c===1?(--c,!1):(b(()=>{G.advance(c),c=0}),!1))}):_5(d,()=>{var c=l;return()=>--c<0})),this}limit(l){return this._ctx.limit=Math.min(this._ctx.limit,l),_5(this._ctx,()=>{var d=l;return function(c,G,b){return--d<=0&&G(b),d>=0}},!0),this}until(l,d){return q5(this._ctx,function(c,G,b){return!l(c.value)||(G(b),d)}),this}first(l){return this.limit(1).toArray(function(d){return d[0]}).then(l)}last(l){return this.reverse().first(l)}filter(l){var d,c;return q5(this._ctx,function(G){return l(G.value)}),d=this._ctx,c=l,d.isMatch=a3(d.isMatch,c),this}and(l){return this.filter(l)}or(l){return new this.db.WhereClause(this._ctx.table,l,this)}reverse(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(l){var d=this._ctx;return d.keysOnly=!d.isMatch,this.each(function(c,G){l(G.key,G)})}eachUniqueKey(l){return this._ctx.unique="unique",this.eachKey(l)}eachPrimaryKey(l){var d=this._ctx;return d.keysOnly=!d.isMatch,this.each(function(c,G){l(G.primaryKey,G)})}keys(l){var d=this._ctx;d.keysOnly=!d.isMatch;var c=[];return this.each(function(G,b){c.push(b.key)}).then(function(){return c}).then(l)}primaryKeys(l){var d=this._ctx;if(d.dir==="next"&&h3(d,!0)&&d.limit>0)return this._read(G=>{var b=W5(d,d.table.core.schema);return d.table.core.query({trans:G,values:!1,limit:d.limit,query:{index:b,range:d.range}})}).then(({result:G})=>G).then(l);d.keysOnly=!d.isMatch;var c=[];return this.each(function(G,b){c.push(b.primaryKey)}).then(function(){return c}).then(l)}uniqueKeys(l){return this._ctx.unique="unique",this.keys(l)}firstKey(l){return this.limit(1).keys(function(d){return d[0]}).then(l)}lastKey(l){return this.reverse().firstKey(l)}distinct(){var l=this._ctx,d=l.index&&l.table.schema.idxByName[l.index];if(!d||!d.multi)return this;var c={};return q5(this._ctx,function(G){var b=G.primaryKey.toString(),W=v0(c,b);return c[b]=!0,!W}),this}modify(l){var d=this._ctx;return this._write(c=>{var G;if(typeof l=="function")G=l;else{var b=m0(l),W=b.length;G=function(Q){for(var o=!1,V=0;V{const{failures:V,numFailures:g}=o;s+=Q-g;for(let B of m0(V))n.push(V[B])};return this.clone().primaryKeys().then(Q=>{const o=V=>{const g=Math.min(e,Q.length-V);return t.getMany({trans:c,keys:Q.slice(V,V+g),cache:"immutable"}).then(B=>{const R=[],r=[],u=a?[]:null,Y=[];for(let y=0;y0&&t.mutate({trans:c,type:"add",values:R}).then(y=>{for(let C in y.failures)Y.splice(parseInt(C),1);A(R.length,y)})).then(()=>(r.length>0||E&&typeof l=="object")&&t.mutate({trans:c,type:"put",keys:u,values:r,criteria:E,changeSpec:typeof l!="function"&&l}).then(y=>A(r.length,y))).then(()=>(Y.length>0||E&&l===$5)&&t.mutate({trans:c,type:"delete",keys:Y,criteria:E}).then(y=>A(Y.length,y))).then(()=>Q.length>V+g&&o(V+e))})};return o(0).then(()=>{if(n.length>0)throw new m5("Error modifying one or more objects",n,s,p);return Q.length})})})}delete(){var l=this._ctx,d=l.range;return h3(l)&&(l.isPrimKey&&!yc||d.type===3)?this._write(c=>{const{primaryKey:G}=l.table.core.schema,b=d;return l.table.core.count({trans:c,query:{index:G,range:b}}).then(W=>l.table.core.mutate({trans:c,type:"deleteRange",range:b}).then(({failures:t,lastResult:a,results:Z,numFailures:e})=>{if(e)throw new m5("Could not delete some values",Object.keys(t).map(n=>t[n]),W-e);return W-e}))}):this.modify($5)}}const $5=(I,l)=>l.value=null;function Uc(I,l){return Il?-1:I===l?0:1}function M0(I,l,d){var c=I instanceof d6?new I.Collection(I):I;return c._ctx.error=d?new d(l):new TypeError(l),c}function r3(I){return new I.Collection(I,()=>I6("")).limit(0)}function xc(I,l,d,c,G,b){for(var W=Math.min(I.length,c.length),t=-1,a=0;a=0?I.substr(0,t)+l[t]+d.substr(t+1):null;G(I[a],Z)<0&&(t=a)}return Wtypeof Q=="string"))return M0(I,"String expected.");function s(Q){G=function(V){return V==="next"?g=>g.toUpperCase():g=>g.toLowerCase()}(Q),b=function(V){return V==="next"?g=>g.toLowerCase():g=>g.toUpperCase()}(Q),W=Q==="next"?Uc:kc;var o=d.map(function(V){return{lower:b(V),upper:G(V)}}).sort(function(V,g){return W(V.lower,g.lower)});t=o.map(function(V){return V.upper}),a=o.map(function(V){return V.lower}),Z=Q,e=Q==="next"?"":c}s("next");var p=new I.Collection(I,()=>N1(t[0],a[n-1]+c));p._ondirectionchange=function(Q){s(Q)};var A=0;return p._addAlgorithm(function(Q,o,V){var g=Q.key;if(typeof g!="string")return!1;var B=b(g);if(l(B,a,A))return!0;for(var R=null,r=A;r0)&&(R=u)}return o(R!==null?function(){Q.continue(R+e)}:V),!1}),p}function N1(I,l,d,c){return{type:2,lower:I,upper:l,lowerOpen:d,upperOpen:c}}function I6(I){return{type:1,lower:I,upper:I}}class d6{get Collection(){return this._ctx.table.db.Collection}between(l,d,c,G){c=c!==!1,G=G===!0;try{return this._cmp(l,d)>0||this._cmp(l,d)===0&&(c||G)&&(!c||!G)?r3(this):new this.Collection(this,()=>N1(l,d,!c,!G))}catch{return M0(this,s1)}}equals(l){return l==null?M0(this,s1):new this.Collection(this,()=>I6(l))}above(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(l,void 0,!0))}aboveOrEqual(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(l,void 0,!1))}below(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(void 0,l,!1,!0))}belowOrEqual(l){return l==null?M0(this,s1):new this.Collection(this,()=>N1(void 0,l))}startsWith(l){return typeof l!="string"?M0(this,"String expected."):this.between(l,l+P1,!0,!0)}startsWithIgnoreCase(l){return l===""?this.startsWith(l):zl(this,(d,c)=>d.indexOf(c[0])===0,[l],P1)}equalsIgnoreCase(l){return zl(this,(d,c)=>d===c[0],[l],"")}anyOfIgnoreCase(){var l=p1.apply(w3,arguments);return l.length===0?r3(this):zl(this,(d,c)=>c.indexOf(d)!==-1,l,"")}startsWithAnyOfIgnoreCase(){var l=p1.apply(w3,arguments);return l.length===0?r3(this):zl(this,(d,c)=>c.some(G=>d.indexOf(G)===0),l,P1)}anyOf(){const l=p1.apply(w3,arguments);let d=this._cmp;try{l.sort(d)}catch{return M0(this,s1)}if(l.length===0)return r3(this);const c=new this.Collection(this,()=>N1(l[0],l[l.length-1]));c._ondirectionchange=b=>{d=b==="next"?this._ascending:this._descending,l.sort(d)};let G=0;return c._addAlgorithm((b,W,t)=>{const a=b.key;for(;d(a,l[G])>0;)if(++G,G===l.length)return W(t),!1;return d(a,l[G])===0||(W(()=>{b.continue(l[G])}),!1)}),c}notEqual(l){return this.inAnyRange([[-(1/0),l],[l,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const l=p1.apply(w3,arguments);if(l.length===0)return new this.Collection(this);try{l.sort(this._ascending)}catch{return M0(this,s1)}const d=l.reduce((c,G)=>c?c.concat([[c[c.length-1][1],G]]):[[-(1/0),G]],null);return d.push([l[l.length-1],this.db._maxKey]),this.inAnyRange(d,{includeLowers:!1,includeUppers:!1})}inAnyRange(l,d){const c=this._cmp,G=this._ascending,b=this._descending,W=this._min,t=this._max;if(l.length===0)return r3(this);if(!l.every(g=>g[0]!==void 0&&g[1]!==void 0&&G(g[0],g[1])<=0))return M0(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",h2.InvalidArgument);const a=!d||d.includeLowers!==!1,Z=d&&d.includeUppers===!0;let e,n=G;function s(g,B){return n(g[0],B[0])}try{e=l.reduce(function(g,B){let R=0,r=g.length;for(;R0){u[0]=W(u[0],B[0]),u[1]=t(u[1],B[1]);break}}return R===r&&g.push(B),g},[]),e.sort(s)}catch{return M0(this,s1)}let p=0;const A=Z?g=>G(g,e[p][1])>0:g=>G(g,e[p][1])>=0,Q=a?g=>b(g,e[p][0])>0:g=>b(g,e[p][0])>=0;let o=A;const V=new this.Collection(this,()=>N1(e[0][0],e[e.length-1][1],!a,!Z));return V._ondirectionchange=g=>{g==="next"?(o=A,n=G):(o=Q,n=b),e.sort(s)},V._addAlgorithm((g,B,R)=>{for(var r=g.key;o(r);)if(++p,p===e.length)return B(R),!1;return!!function(u){return!A(u)&&!Q(u)}(r)||(this._cmp(r,e[p][1])===0||this._cmp(r,e[p][0])===0||B(()=>{n===G?g.continue(e[p][0]):g.continue(e[p][1])}),!1)}),V}startsWithAnyOf(){const l=p1.apply(w3,arguments);return l.every(d=>typeof d=="string")?l.length===0?r3(this):this.inAnyRange(l.map(d=>[d,d+P1])):M0(this,"startsWithAnyOf() only works with strings")}}function c1(I){return d0(function(l){return ol(l),I(l.target.error),!1})}function ol(I){I.stopPropagation&&I.stopPropagation(),I.preventDefault&&I.preventDefault()}const g1=el(null,"storagemutated");class Mc{_lock(){return dl(!X2.global),++this._reculock,this._reculock!==1||X2.global||(X2.lockOwnerFor=this),this}_unlock(){if(dl(!X2.global),--this._reculock==0)for(X2.global||(X2.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var l=this._blockedFuncs.shift();try{W3(l[1],l[0])}catch{}}return this}_locked(){return this._reculock&&X2.lockOwnerFor!==this}create(l){if(!this.mode)return this;const d=this.db.idbdb,c=this.db._state.dbOpenError;if(dl(!this.idbtrans),!l&&!d)switch(c&&c.name){case"DatabaseClosedError":throw new h2.DatabaseClosed(c);case"MissingAPIError":throw new h2.MissingAPI(c.message,c);default:throw new h2.OpenFailed(c)}if(!this.active)throw new h2.TransactionInactive;return dl(this._completion._state===null),(l=this.idbtrans=l||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):d.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=d0(G=>{ol(G),this._reject(l.error)}),l.onabort=d0(G=>{ol(G),this.active&&this._reject(new h2.Abort(l.error)),this.active=!1,this.on("abort").fire(G)}),l.oncomplete=d0(()=>{this.active=!1,this._resolve(),"mutatedParts"in l&&g1.storagemutated.fire(l.mutatedParts)}),this}_promise(l,d,c){if(l==="readwrite"&&this.mode!=="readwrite")return Z0(new h2.ReadOnly("Transaction is readonly"));if(!this.active)return Z0(new h2.TransactionInactive);if(this._locked())return new m2((b,W)=>{this._blockedFuncs.push([()=>{this._promise(l,d,c).then(b,W)},X2])});if(c)return U1(()=>{var b=new m2((W,t)=>{this._lock();const a=d(W,t,this);a&&a.then&&a.then(W,t)});return b.finally(()=>this._unlock()),b._lib=!0,b});var G=new m2((b,W)=>{var t=d(b,W,this);t&&t.then&&t.then(b,W)});return G._lib=!0,G}_root(){return this.parent?this.parent._root():this}waitFor(l){var d=this._root();const c=m2.resolve(l);if(d._waitingFor)d._waitingFor=d._waitingFor.then(()=>c);else{d._waitingFor=c,d._waitingQueue=[];var G=d.idbtrans.objectStore(d.storeNames[0]);(function W(){for(++d._spinCount;d._waitingQueue.length;)d._waitingQueue.shift()();d._waitingFor&&(G.get(-1/0).onsuccess=W)})()}var b=d._waitingFor;return new m2((W,t)=>{c.then(a=>d._waitingQueue.push(d0(W.bind(null,a))),a=>d._waitingQueue.push(d0(t.bind(null,a)))).finally(()=>{d._waitingFor===b&&(d._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new h2.Abort))}table(l){const d=this._memoizedTables||(this._memoizedTables={});if(v0(d,l))return d[l];const c=this.schema[l];if(!c)throw new h2.NotFound("Table "+l+" not part of transaction");const G=new this.db.Table(l,c,this);return G.core=this.db.core.table(l),d[l]=G,G}}function N9(I,l,d,c,G,b,W){return{name:I,keyPath:l,unique:d,multi:c,auto:G,compound:b,src:(d&&!W?"&":"")+(c?"*":"")+(G?"++":"")+c6(l)}}function c6(I){return typeof I=="string"?I:I?"["+[].join.call(I,"+")+"]":""}function G6(I,l,d){return{name:I,primKey:l,indexes:d,mappedClass:null,idxByName:(c=d,G=b=>[b.name,b],c.reduce((b,W,t)=>{var a=G(W,t);return a&&(b[a[0]]=a[1]),b},{}))};var c,G}let Vl=I=>{try{return I.only([[]]),Vl=()=>[[]],[[]]}catch{return Vl=()=>P1,P1}};function C9(I){return I==null?()=>{}:typeof I=="string"?function(l){return l.split(".").length===1?d=>d[l]:d=>V1(d,l)}(I):l=>V1(l,I)}function bI(I){return[].slice.call(I)}let Sc=0;function nl(I){return I==null?":id":typeof I=="string"?I:`[${I.join("+")}]`}function zc(I,l,d){function c(a){if(a.type===3)return null;if(a.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:Z,upper:e,lowerOpen:n,upperOpen:s}=a;return Z===void 0?e===void 0?null:l.upperBound(e,!!s):e===void 0?l.lowerBound(Z,!!n):l.bound(Z,e,!!n,!!s)}const{schema:G,hasGetAll:b}=function(a,Z){const e=bI(a.objectStoreNames);return{schema:{name:a.name,tables:e.map(n=>Z.objectStore(n)).map(n=>{const{keyPath:s,autoIncrement:p}=n,A=r0(s),Q=s==null,o={},V={name:n.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:Q,compound:A,keyPath:s,autoIncrement:p,unique:!0,extractKey:C9(s)},indexes:bI(n.indexNames).map(g=>n.index(g)).map(g=>{const{name:B,unique:R,multiEntry:r,keyPath:u}=g,Y={name:B,compound:r0(u),keyPath:u,unique:R,multiEntry:r,extractKey:C9(u)};return o[nl(u)]=Y,Y}),getIndexByKeyPath:g=>o[nl(g)]};return o[":id"]=V.primaryKey,s!=null&&(o[nl(s)]=V.primaryKey),V})},hasGetAll:e.length>0&&"getAll"in Z.objectStore(e[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(I,d),W=G.tables.map(a=>function(Z){const e=Z.name;return{name:e,schema:Z,mutate:function({trans:n,type:s,keys:p,values:A,range:Q}){return new Promise((o,V)=>{o=d0(o);const g=n.objectStore(e),B=g.keyPath==null,R=s==="put"||s==="add";if(!R&&s!=="delete"&&s!=="deleteRange")throw new Error("Invalid operation type: "+s);const{length:r}=p||A||{length:1};if(p&&A&&p.length!==A.length)throw new Error("Given keys array must have same length as given values array.");if(r===0)return o({numFailures:0,failures:{},results:[],lastResult:void 0});let u;const Y=[],E=[];let y=0;const C=L=>{++y,ol(L)};if(s==="deleteRange"){if(Q.type===4)return o({numFailures:y,failures:E,results:[],lastResult:void 0});Q.type===3?Y.push(u=g.clear()):Y.push(u=g.delete(c(Q)))}else{const[L,J]=R?B?[A,p]:[A,null]:[p,null];if(R)for(let U=0;U{const J=L.target.result;Y.forEach((U,z)=>U.error!=null&&(E[z]=U.error)),o({numFailures:y,failures:E,results:s==="delete"?p:Y.map(U=>U.result),lastResult:J})};u.onerror=L=>{C(L),k(L)},u.onsuccess=k})},getMany:({trans:n,keys:s})=>new Promise((p,A)=>{p=d0(p);const Q=n.objectStore(e),o=s.length,V=new Array(o);let g,B=0,R=0;const r=Y=>{const E=Y.target;V[E._pos]=E.result,++R===B&&p(V)},u=c1(A);for(let Y=0;Ynew Promise((p,A)=>{p=d0(p);const Q=n.objectStore(e).get(s);Q.onsuccess=o=>p(o.target.result),Q.onerror=c1(A)}),query:function(n){return s=>new Promise((p,A)=>{p=d0(p);const{trans:Q,values:o,limit:V,query:g}=s,B=V===1/0?void 0:V,{index:R,range:r}=g,u=Q.objectStore(e),Y=R.isPrimaryKey?u:u.index(R.name),E=c(r);if(V===0)return p({result:[]});if(n){const y=o?Y.getAll(E,B):Y.getAllKeys(E,B);y.onsuccess=C=>p({result:C.target.result}),y.onerror=c1(A)}else{let y=0;const C=o||!("openKeyCursor"in Y)?Y.openCursor(E):Y.openKeyCursor(E),k=[];C.onsuccess=L=>{const J=C.result;return J?(k.push(o?J.value:J.primaryKey),++y===V?p({result:k}):void J.continue()):p({result:k})},C.onerror=c1(A)}})}(b),openCursor:function({trans:n,values:s,query:p,reverse:A,unique:Q}){return new Promise((o,V)=>{o=d0(o);const{index:g,range:B}=p,R=n.objectStore(e),r=g.isPrimaryKey?R:R.index(g.name),u=A?Q?"prevunique":"prev":Q?"nextunique":"next",Y=s||!("openKeyCursor"in r)?r.openCursor(c(B),u):r.openKeyCursor(c(B),u);Y.onerror=c1(V),Y.onsuccess=d0(E=>{const y=Y.result;if(!y)return void o(null);y.___id=++Sc,y.done=!1;const C=y.continue.bind(y);let k=y.continuePrimaryKey;k&&(k=k.bind(y));const L=y.advance.bind(y),J=()=>{throw new Error("Cursor not stopped")};y.trans=n,y.stop=y.continue=y.continuePrimaryKey=y.advance=()=>{throw new Error("Cursor not started")},y.fail=d0(V),y.next=function(){let U=1;return this.start(()=>U--?this.continue():this.stop()).then(()=>this)},y.start=U=>{const z=new Promise((N,w)=>{N=d0(N),Y.onerror=c1(w),y.fail=w,y.stop=v=>{y.stop=y.continue=y.continuePrimaryKey=y.advance=J,N(v)}}),S=()=>{if(Y.result)try{U()}catch(N){y.fail(N)}else y.done=!0,y.start=()=>{throw new Error("Cursor behind last entry")},y.stop()};return Y.onsuccess=d0(N=>{Y.onsuccess=S,S()}),y.continue=C,y.continuePrimaryKey=k,y.advance=L,S(),z},o(y)},V)})},count({query:n,trans:s}){const{index:p,range:A}=n;return new Promise((Q,o)=>{const V=s.objectStore(e),g=p.isPrimaryKey?V:V.index(p.name),B=c(A),R=B?g.count(B):g.count();R.onsuccess=d0(r=>Q(r.target.result)),R.onerror=c1(o)})}}}(a)),t={};return W.forEach(a=>t[a.name]=a),{stack:"dbcore",transaction:I.transaction.bind(I),table(a){if(!t[a])throw new Error(`Table '${a}' not found`);return t[a]},MIN_KEY:-1/0,MAX_KEY:Vl(l),schema:G}}function H9(I,l){const d=l.db,c=function(G,b,{IDBKeyRange:W,indexedDB:t},a){return{dbcore:function(e,n){return n.reduce((s,{create:p})=>({...s,...p(s)}),e)}(zc(b,W,a),G.dbcore)}}(I._middlewares,d,I._deps,l);I.core=c.dbcore,I.tables.forEach(G=>{const b=G.name;I.core.schema.tables.some(W=>W.name===b)&&(G.core=I.core.table(b),I[b]instanceof I.Table&&(I[b].core=G.core))})}function o5(I,l,d,c){d.forEach(G=>{const b=c[G];l.forEach(W=>{const t=I4(W,G);(!t||"value"in t&&t.value===void 0)&&(W===I.Transaction.prototype||W instanceof I.Transaction?o1(W,G,{get(){return this.table(G)},set(a){yd(this,G,{value:a,writable:!0,configurable:!0,enumerable:!0})}}):W[G]=new I.Table(G,b))})})}function K9(I,l){l.forEach(d=>{for(let c in d)d[c]instanceof I.Table&&delete d[c]})}function Tc(I,l){return I._cfg.version-l._cfg.version}function fc(I,l,d,c){const G=I._dbSchema,b=I._createTransaction("readwrite",I._storeNames,G);b.create(d),b._completion.catch(c);const W=b._reject.bind(b),t=X2.transless||X2;U1(()=>{X2.trans=b,X2.transless=t,l===0?(m0(G).forEach(a=>{l9(d,a,G[a].primKey,G[a].indexes)}),H9(I,d),m2.follow(()=>I.on.populate.fire(b)).catch(W)):function(a,Z,e,n){const s=[],p=a._versions;let A=a._dbSchema=J9(a,a.idbdb,n),Q=!1;function o(){return s.length?m2.resolve(s.shift()(e.idbtrans)).then(o):m2.resolve()}return p.filter(V=>V._cfg.version>=Z).forEach(V=>{s.push(()=>{const g=A,B=V._cfg.dbschema;y9(a,g,n),y9(a,B,n),A=a._dbSchema=B;const R=b6(g,B);R.add.forEach(u=>{l9(n,u[0],u[1].primKey,u[1].indexes)}),R.change.forEach(u=>{if(u.recreate)throw new h2.Upgrade("Not yet support for changing primary key");{const Y=n.objectStore(u.name);u.add.forEach(E=>E9(Y,E)),u.change.forEach(E=>{Y.deleteIndex(E.name),E9(Y,E)}),u.del.forEach(E=>Y.deleteIndex(E))}});const r=V._cfg.contentUpgrade;if(r&&V._cfg.version>Z){H9(a,n),e._memoizedTables={},Q=!0;let u=Ud(B);R.del.forEach(C=>{u[C]=g[C]}),K9(a,[a.Transaction.prototype]),o5(a,[a.Transaction.prototype],m0(u),u),e.schema=u;const Y=d4(r);let E;Y&&j3();const y=m2.follow(()=>{if(E=r(e),E&&Y){var C=k1.bind(null,null);E.then(C,C)}});return E&&typeof E.then=="function"?m2.resolve(E):y.then(()=>E)}}),s.push(g=>{(!Q||!Jc)&&function(B,R){[].slice.call(R.db.objectStoreNames).forEach(r=>B[r]==null&&R.db.deleteObjectStore(r))}(V._cfg.dbschema,g),K9(a,[a.Transaction.prototype]),o5(a,[a.Transaction.prototype],a._storeNames,a._dbSchema),e.schema=a._dbSchema})}),o().then(()=>{var V,g;g=n,m0(V=A).forEach(B=>{g.db.objectStoreNames.contains(B)||l9(g,B,V[B].primKey,V[B].indexes)})})}(I,l,b,d).catch(W)})}function b6(I,l){const d={del:[],add:[],change:[]};let c;for(c in I)l[c]||d.del.push(c);for(c in l){const G=I[c],b=l[c];if(G){const W={name:c,def:b,recreate:!1,del:[],add:[],change:[]};if(""+(G.primKey.keyPath||"")!=""+(b.primKey.keyPath||"")||G.primKey.auto!==b.primKey.auto&&!v5)W.recreate=!0,d.change.push(W);else{const t=G.idxByName,a=b.idxByName;let Z;for(Z in t)a[Z]||W.del.push(Z);for(Z in a){const e=t[Z],n=a[Z];e?e.src!==n.src&&W.change.push(n):W.add.push(n)}(W.del.length>0||W.add.length>0||W.change.length>0)&&d.change.push(W)}}else d.add.push([c,b])}return d}function l9(I,l,d,c){const G=I.db.createObjectStore(l,d.keyPath?{keyPath:d.keyPath,autoIncrement:d.auto}:{autoIncrement:d.auto});return c.forEach(b=>E9(G,b)),G}function E9(I,l){I.createIndex(l.name,l.keyPath,{unique:l.unique,multiEntry:l.multi})}function J9(I,l,d){const c={};return s5(l.objectStoreNames,0).forEach(G=>{const b=d.objectStore(G);let W=b.keyPath;const t=N9(c6(W),W||"",!1,!1,!!b.autoIncrement,W&&typeof W!="string",!0),a=[];for(let e=0;e{if(l[c]!==null){var G=l[c].split(",").map((W,t)=>{const a=(W=W.trim()).replace(/([&*]|\+\+)/g,""),Z=/^\[/.test(a)?a.match(/^\[(.*)\]$/)[1].split("+"):a;return N9(a,Z||null,/\&/.test(W),/\*/.test(W),/\+\+/.test(W),r0(Z),t===0)}),b=G.shift();if(b.multi)throw new h2.Schema("Primary key cannot be multi-valued");G.forEach(W=>{if(W.auto)throw new h2.Schema("Only primary key can be marked as autoIncrement (++)");if(!W.keyPath)throw new h2.Schema("Index must have a name and cannot be an empty string")}),d[c]=G6(c,b,G)}})}stores(l){const d=this.db;this._cfg.storesSource=this._cfg.storesSource?S0(this._cfg.storesSource,l):l;const c=d._versions,G={};let b={};return c.forEach(W=>{S0(G,W._cfg.storesSource),b=W._cfg.dbschema={},W._parseStoresSpec(G,b)}),d._dbSchema=b,K9(d,[d._allTables,d,d.Transaction.prototype]),o5(d,[d._allTables,d,d.Transaction.prototype,this._cfg.tables],m0(b),b),d._storeNames=m0(b),this}upgrade(l){return this._cfg.contentUpgrade=b4(this._cfg.contentUpgrade||D2,l),this}}function Z4(I,l){let d=I._dbNamesDB;return d||(d=I._dbNamesDB=new l3("__dbnames",{addons:[],indexedDB:I,IDBKeyRange:l}),d.version(1).stores({dbnames:"name"})),d.table("dbnames")}function e4(I){return I&&typeof I.databases=="function"}function v9(I){return U1(function(){return X2.letThrough=!0,I()})}function Dc(){var I;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(l){var d=function(){return indexedDB.databases().finally(l)};I=setInterval(d,100),d()}).finally(function(){return clearInterval(I)}):Promise.resolve()}function n4(I){return!("from"in I)}const E0=function(I,l){if(!this){const d=new E0;return I&&"d"in I&&S0(d,I),d}S0(this,arguments.length?{d:1,from:I,to:arguments.length>1?l:I}:{d:0})};function Xl(I,l,d){const c=S2(l,d);if(isNaN(c))return;if(c>0)throw RangeError();if(n4(I))return S0(I,{from:l,to:d,d:1});const G=I.l,b=I.r;if(S2(d,I.from)<0)return G?Xl(G,l,d):I.l={from:l,to:d,d:1,l:null,r:null},WI(I);if(S2(l,I.to)>0)return b?Xl(b,l,d):I.r={from:l,to:d,d:1,l:null,r:null},WI(I);S2(l,I.from)<0&&(I.from=l,I.l=null,I.d=b?b.d+1:1),S2(d,I.to)>0&&(I.to=d,I.r=null,I.d=I.l?I.l.d+1:1);const W=!I.r;G&&!I.l&&V5(I,G),b&&W&&V5(I,b)}function V5(I,l){n4(l)||function d(c,{from:G,to:b,l:W,r:t}){Xl(c,G,b),W&&d(c,W),t&&d(c,t)}(I,l)}function L9(I,l){const d=U9(l);let c=d.next();if(c.done)return!1;let G=c.value;const b=U9(I);let W=b.next(G.from),t=W.value;for(;!c.done&&!W.done;){if(S2(t.from,G.to)<=0&&S2(t.to,G.from)>=0)return!0;S2(G.from,t.from)<0?G=(c=d.next(t.from)).value:t=(W=b.next(G.from)).value}return!1}function U9(I){let l=n4(I)?null:{s:0,n:I};return{next(d){const c=arguments.length>0;for(;l;)switch(l.s){case 0:if(l.s=1,c)for(;l.n.l&&S2(d,l.n.from)<0;)l={up:l,n:l.n.l,s:1};else for(;l.n.l;)l={up:l,n:l.n.l,s:1};case 1:if(l.s=2,!c||S2(d,l.n.to)<=0)return{value:l.n,done:!1};case 2:if(l.n.r){l.s=3,l={up:l,n:l.n.r,s:0};continue}case 3:l=l.up}return{done:!0}}}}function WI(I){var l,d;const c=(((l=I.r)===null||l===void 0?void 0:l.d)||0)-(((d=I.l)===null||d===void 0?void 0:d.d)||0),G=c>1?"r":c<-1?"l":"";if(G){const b=G==="r"?"l":"r",W={...I},t=I[G];I.from=t.from,I.to=t.to,I[G]=t[G],W[G]=t[b],I[b]=W,W.d=aI(W)}I.d=aI(I)}function aI({r:I,l}){return(I?l?Math.max(I.d,l.d):I.d:l?l.d:0)+1}function L5(I,l){return m0(l).forEach(d=>{I[d]?V5(I[d],l[d]):I[d]=Md(l[d])}),I}function W6(I,l){return Object.keys(I).some(d=>l[d]&&L9(l[d],I[d]))}U3(E0.prototype,{add(I){return V5(this,I),this},addKey(I){return Xl(this,I,I),this},addKeys(I){return I.forEach(l=>Xl(this,l,l)),this},[g9](){return U9(this)}});const C3={};let I9={},d9=!1;function c9(I){L5(I9,I),d9||(d9=!0,setTimeout(()=>{d9=!1;const l=I9;I9={},s4(l)},0))}function s4(I,l=!1){const d=new Set;for(const c in I){const G=/^idb\:\/\/(.*)\/(.*)\//.exec(c);if(G){const[,b,W]=G,t=C3[`idb://${b}/${W}`];t&&Oc(t,I,d,l)}}d.forEach(c=>c())}function Oc(I,l,d,c){const G=c&&[];for(const[b,W]of Object.entries(I.queries.query)){const t=c&&[];for(const a of W)a.obsSet&&W6(l,a.obsSet)?a.subscribers.forEach(Z=>d.add(Z)):c&&t.push(a);c&&G.push([b,t])}if(c)for(const[b,W]of G)I.queries.query[b]=W}function Pc(I){const l=I._state,{indexedDB:d}=I._deps;if(l.isBeingOpened||I.idbdb)return l.dbReadyPromise.then(()=>l.dbOpenError?Z0(l.dbOpenError):I);h1&&(l.openCanceller._stackHolder=m3()),l.isBeingOpened=!0,l.dbOpenError=null,l.openComplete=!1;const c=l.openCanceller;function G(){if(l.openCanceller!==c)throw new h2.DatabaseClosed("db.open() was cancelled")}let b=l.dbReadyResolve,W=null,t=!1;return m2.race([c,(typeof navigator>"u"?m2.resolve():Dc()).then(()=>new m2((a,Z)=>{if(G(),!d)throw new h2.MissingAPI;const e=I.name,n=l.autoSchema?d.open(e):d.open(e,Math.round(10*I.verno));if(!n)throw new h2.MissingAPI;n.onerror=c1(Z),n.onblocked=d0(I._fireOnBlocked),n.onupgradeneeded=d0(s=>{if(W=n.transaction,l.autoSchema&&!I._options.allowEmptyDB){n.onerror=ol,W.abort(),n.result.close();const A=d.deleteDatabase(e);A.onsuccess=A.onerror=d0(()=>{Z(new h2.NoSuchDatabase(`Database ${e} doesnt exist`))})}else{W.onerror=c1(Z);var p=s.oldVersion>Math.pow(2,62)?0:s.oldVersion;t=p<1,I.idbdb=n.result,fc(I,p/10,W,Z)}},Z),n.onsuccess=d0(()=>{W=null;const s=I.idbdb=n.result,p=s5(s.objectStoreNames);if(p.length>0)try{const Q=s.transaction((A=p).length===1?A[0]:A,"readonly");l.autoSchema?function(o,V,g){o.verno=V.version/10;const B=o._dbSchema=J9(0,V,g);o._storeNames=s5(V.objectStoreNames,0),o5(o,[o._allTables],m0(B),B)}(I,s,Q):(y9(I,I._dbSchema,Q),function(o,V){const g=b6(J9(0,o.idbdb,V),o._dbSchema);return!(g.add.length||g.change.some(B=>B.add.length||B.change.length))}(I,Q)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),H9(I,Q)}catch{}var A;Zl.push(I),s.onversionchange=d0(Q=>{l.vcFired=!0,I.on("versionchange").fire(Q)}),s.onclose=d0(Q=>{I.on("close").fire(Q)}),t&&function({indexedDB:Q,IDBKeyRange:o},V){!e4(Q)&&V!=="__dbnames"&&Z4(Q,o).put({name:V}).catch(D2)}(I._deps,e),a()},Z)}))]).then(()=>(G(),l.onReadyBeingFired=[],m2.resolve(v9(()=>I.on.ready.fire(I.vip))).then(function a(){if(l.onReadyBeingFired.length>0){let Z=l.onReadyBeingFired.reduce(b4,D2);return l.onReadyBeingFired=[],m2.resolve(v9(()=>Z(I.vip))).then(a)}}))).finally(()=>{l.openCanceller===c&&(l.onReadyBeingFired=null,l.isBeingOpened=!1)}).catch(a=>{l.dbOpenError=a;try{W&&W.abort()}catch{}return c===l.openCanceller&&I._close(),Z0(a)}).finally(()=>{l.openComplete=!0,b()}).then(()=>{if(t){const a={};I.tables.forEach(Z=>{Z.schema.indexes.forEach(e=>{e.name&&(a[`idb://${I.name}/${Z.name}/${e.name}`]=new E0(-1/0,[[[]]]))}),a[`idb://${I.name}/${Z.name}/`]=a[`idb://${I.name}/${Z.name}/:dels`]=new E0(-1/0,[[[]]])}),g1("storagemutated").fire(a),s4(a,!0)}return I})}function k9(I){var l=b=>I.next(b),d=G(l),c=G(b=>I.throw(b));function G(b){return W=>{var t=b(W),a=t.value;return t.done?a:a&&typeof a.then=="function"?a.then(d,c):r0(a)?Promise.all(a).then(d,c):d(a)}}return G(l)()}function qc(I,l,d){var c=arguments.length;if(c<2)throw new h2.InvalidArgument("Too few arguments");for(var G=new Array(c-1);--c;)G[c-1]=arguments[c];d=G.pop();var b=kd(G);return[I,b,d]}function a6(I,l,d,c,G){return m2.resolve().then(()=>{const b=X2.transless||X2,W=I._createTransaction(l,d,I._dbSchema,c);W.explicit=!0;const t={trans:W,transless:b};if(c)W.idbtrans=c.idbtrans;else try{W.create(),I._state.PR1398_maxLoop=3}catch(n){return n.name===G4.InvalidState&&I.isOpen()&&--I._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),I._close(),I.open().then(()=>a6(I,l,d,null,G))):Z0(n)}const a=d4(G);let Z;a&&j3();const e=m2.follow(()=>{if(Z=G.call(W,W),Z)if(a){var n=k1.bind(null,null);Z.then(n,n)}else typeof Z.next=="function"&&typeof Z.throw=="function"&&(Z=k9(Z))},t);return(Z&&typeof Z.then=="function"?m2.resolve(Z).then(n=>W.active?n:Z0(new h2.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):e.then(()=>Z)).then(n=>(c&&W._resolve(),W._completion.then(()=>n))).catch(n=>(W._reject(n),Z0(n)))})}function Tl(I,l,d){const c=r0(I)?I.slice():[I];for(let G=0;G0,V={...s,name:o?`${p}(virtual-from:${s.name})`:s.name,lowLevelIndex:s,isVirtual:o,keyTail:n,keyLength:Q,extractKey:C9(e),unique:!o&&s.unique};return A.push(V),V.isPrimaryKey||b.push(V),Q>1&&W(Q===2?e[0]:e.slice(0,Q-1),n+1,s),A.sort((g,B)=>g.keyTail-B.keyTail),V}const t=W(c.primaryKey.keyPath,0,c.primaryKey);G[":id"]=[t];for(const e of c.indexes)W(e.keyPath,0,e);function a(e){const n=e.query.index;return n.isVirtual?{...e,query:{index:n.lowLevelIndex,range:(s=e.query.range,p=n.keyTail,{type:s.type===1?2:s.type,lower:Tl(s.lower,s.lowerOpen?I.MAX_KEY:I.MIN_KEY,p),lowerOpen:!0,upper:Tl(s.upper,s.upperOpen?I.MIN_KEY:I.MAX_KEY,p),upperOpen:!0})}}:e;var s,p}return{...d,schema:{...c,primaryKey:t,indexes:b,getIndexByKeyPath:function(e){const n=G[nl(e)];return n&&n[0]}},count:e=>d.count(a(e)),query:e=>d.query(a(e)),openCursor(e){const{keyTail:n,isVirtual:s,keyLength:p}=e.query.index;return s?d.openCursor(a(e)).then(A=>A&&function(Q){return Object.create(Q,{continue:{value:function(V){V!=null?Q.continue(Tl(V,e.reverse?I.MAX_KEY:I.MIN_KEY,n)):e.unique?Q.continue(Q.key.slice(0,p).concat(e.reverse?I.MIN_KEY:I.MAX_KEY,n)):Q.continue()}},continuePrimaryKey:{value(V,g){Q.continuePrimaryKey(Tl(V,I.MAX_KEY,n),g)}},primaryKey:{get:()=>Q.primaryKey},key:{get(){const V=Q.key;return p===1?V[0]:V.slice(0,p)}},value:{get:()=>Q.value}})}(A)):d.openCursor(e)}}}}}};function m4(I,l,d,c){return d=d||{},c=c||"",m0(I).forEach(G=>{if(v0(l,G)){var b=I[G],W=l[G];if(typeof b=="object"&&typeof W=="object"&&b&&W){const t=X9(b);t!==X9(W)?d[c+G]=l[G]:t==="Object"?m4(b,W,d,c+G+"."):b!==W&&(d[c+G]=l[G])}else b!==W&&(d[c+G]=l[G])}else d[c+G]=void 0}),m0(l).forEach(G=>{v0(I,G)||(d[c+G]=l[G])}),d}function p4(I,l){return l.type==="delete"?l.keys:l.keys||l.values.map(I.extractKey)}const $c={stack:"dbcore",name:"HooksMiddleware",level:2,create:I=>({...I,table(l){const d=I.table(l),{primaryKey:c}=d.schema;return{...d,mutate(b){const W=X2.trans,{deleting:t,creating:a,updating:Z}=W.table(l).hook;switch(b.type){case"add":if(a.fire===D2)break;return W._promise("readwrite",()=>e(b),!0);case"put":if(a.fire===D2&&Z.fire===D2)break;return W._promise("readwrite",()=>e(b),!0);case"delete":if(t.fire===D2)break;return W._promise("readwrite",()=>e(b),!0);case"deleteRange":if(t.fire===D2)break;return W._promise("readwrite",()=>function(s){return n(s.trans,s.range,1e4)}(b),!0)}return d.mutate(b);function e(s){const p=X2.trans,A=s.keys||p4(c,s);if(!A)throw new Error("Keys missing");return(s=s.type==="add"||s.type==="put"?{...s,keys:A}:{...s}).type!=="delete"&&(s.values=[...s.values]),s.keys&&(s.keys=[...s.keys]),function(Q,o,V){return o.type==="add"?Promise.resolve([]):Q.getMany({trans:o.trans,keys:V,cache:"immutable"})}(d,s,A).then(Q=>{const o=A.map((V,g)=>{const B=Q[g],R={onerror:null,onsuccess:null};if(s.type==="delete")t.fire.call(R,V,B,p);else if(s.type==="add"||B===void 0){const r=a.fire.call(R,V,s.values[g],p);V==null&&r!=null&&(V=r,s.keys[g]=V,c.outbound||f0(s.values[g],c.keyPath,V))}else{const r=m4(B,s.values[g]),u=Z.fire.call(R,r,V,B,p);if(u){const Y=s.values[g];Object.keys(u).forEach(E=>{v0(Y,E)?Y[E]=u[E]:f0(Y,E,u[E])})}}return R});return d.mutate(s).then(({failures:V,results:g,numFailures:B,lastResult:R})=>{for(let r=0;r(o.forEach(g=>g.onerror&&g.onerror(V)),Promise.reject(V)))})}function n(s,p,A){return d.query({trans:s,values:!1,query:{index:c,range:p},limit:A}).then(({result:Q})=>e({type:"delete",keys:Q,trans:s}).then(o=>o.numFailures>0?Promise.reject(o.failures[0]):Q.length({table:l=>{const d=I.table(l);return{...d,getMany:c=>{if(!c.cache)return d.getMany(c);const G=t6(c.keys,c.trans._cache,c.cache==="clone");return G?m2.resolve(G):d.getMany(c).then(b=>(c.trans._cache={keys:c.keys,values:c.cache==="clone"?L1(b):b},b))},mutate:c=>(c.type!=="add"&&(c.trans._cache=null),d.mutate(c))}}})};function Z6(I,l){return I.trans.mode==="readonly"&&!!I.subscr&&!I.trans.explicit&&I.trans.db._options.cache!=="disabled"&&!l.schema.primaryKey.outbound}function e6(I,l){switch(I){case"query":return l.values&&!l.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}const IG={stack:"dbcore",level:0,name:"Observability",create:I=>{const l=I.schema.name,d=new E0(I.MIN_KEY,I.MAX_KEY);return{...I,transaction:(c,G,b)=>{if(X2.subscr&&G!=="readonly")throw new h2.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${X2.querier}`);return I.transaction(c,G,b)},table:c=>{const G=I.table(c),{schema:b}=G,{primaryKey:W}=b,{extractKey:t,outbound:a}=W,Z={...G,mutate:s=>{const p=s.trans,A=s.mutatedParts||(s.mutatedParts={}),Q=u=>{const Y=`idb://${l}/${c}/${u}`;return A[Y]||(A[Y]=new E0)},o=Q(""),V=Q(":dels"),{type:g}=s;let[B,R]=s.type==="deleteRange"?[s.range]:s.type==="delete"?[s.keys]:s.values.length<50?[p4(W,s).filter(u=>u),s.values]:[];const r=s.trans._cache;if(r0(B)){o.addKeys(B);const u=g==="delete"||B.length===R.length?t6(B,r):null;u||g==="add"||V.addKeys(B),(u||R)&&function(Y,E,y,C){function k(L){const J=Y(L.name||"");function U(S){return S!=null?L.extractKey(S):null}const z=S=>L.multiEntry&&r0(S)?S.forEach(N=>J.addKey(N)):J.addKey(S);(y||C).forEach((S,N)=>{const w=y&&U(y[N]),v=C&&U(C[N]);S2(w,v)!==0&&(w!=null&&z(w),v!=null&&z(v))})}E.indexes.forEach(k)}(Q,b,u,R)}else if(B){const u={from:B.lower,to:B.upper};V.add(u),o.add(u)}else o.add(d),V.add(d),b.indexes.forEach(u=>Q(u.name).add(d));return G.mutate(s).then(u=>(!B||s.type!=="add"&&s.type!=="put"||o.addKeys(u.results),p.mutatedParts=L5(p.mutatedParts||{},A),u))}},e=({query:{index:s,range:p}})=>{var A,Q;return[s,new E0((A=p.lower)!==null&&A!==void 0?A:I.MIN_KEY,(Q=p.upper)!==null&&Q!==void 0?Q:I.MAX_KEY)]},n={get:s=>[W,new E0(s.key)],getMany:s=>[W,new E0().addKeys(s.keys)],count:e,query:e,openCursor:e};return m0(n).forEach(s=>{Z[s]=function(p){const{subscr:A}=X2,Q=!!A,V=Z6(X2,G)&&e6(s,p)?p.obsSet={}:A;if(Q){const g=Y=>{const E=`idb://${l}/${c}/${Y}`;return V[E]||(V[E]=new E0)},B=g(""),R=g(":dels"),[r,u]=n[s](p);if(g(r.name||"").add(u),!r.isPrimaryKey){if(s!=="count"){const Y=s==="query"&&a&&p.values&&G.query({...p,values:!1});return G[s].apply(this,arguments).then(E=>{if(s==="query"){if(a&&p.values)return Y.then(({result:C})=>(B.addKeys(C),E));const y=p.values?E.result.map(t):E.result;p.values?B.addKeys(y):R.addKeys(y)}else if(s==="openCursor"){const y=E,C=p.values;return y&&Object.create(y,{key:{get:()=>(R.addKey(y.primaryKey),y.key)},primaryKey:{get(){const k=y.primaryKey;return R.addKey(k),k}},value:{get:()=>(C&&B.addKey(y.primaryKey),y.value)}})}return E})}R.add(d)}}return G[s].apply(this,arguments)}}),Z}}}};function tI(I,l){return function(d,c){return c.lower===void 0||(c.lowerOpen?S2(d,c.lower)>0:S2(d,c.lower)>=0)}(I,l)&&function(d,c){return c.upper===void 0||(c.upperOpen?S2(d,c.upper)<0:S2(d,c.upper)<=0)}(I,l)}function ZI(I,l,d,c,G,b){if(!d||d.length===0)return I;const W=l.query.index,t=c.schema.primaryKey.extractKey,a=W.extractKey,Z=(W.lowLevelIndex||W).extractKey;let e=d.reduce((n,s)=>{let p=n;const A=s.type==="add"||s.type==="put"?s.values.filter(Q=>tI(a(Q),l.query.range)).map(Q=>(Q=L1(Q),b&&Object.freeze(Q),Q)):[];switch(s.type){case"add":p=n.concat(l.values?A:A.map(g=>t(g)));break;case"put":const Q=new E0().addKeys(s.values.map(g=>t(g)));p=n.filter(g=>{const B=l.values?t(g):g;return!L9(new E0(B),Q)}).concat(l.values?A:A.map(g=>t(g)));break;case"delete":const o=new E0().addKeys(s.keys);p=n.filter(g=>{const B=l.values?t(g):g;return!L9(new E0(B),o)});break;case"deleteRange":const V=s.range;p=n.filter(g=>!tI(t(g),V))}return p},I);return e===I?I:(e.sort((n,s)=>S2(Z(n),Z(s))||S2(t(n),t(s))),l.limit&&l.limit<1/0&&(e.length>l.limit?e.length=l.limit:I.length===l.limit&&e.length=0}function cG(I,l,d,c){I.subscribers.add(d),c.addEventListener("abort",()=>{I.subscribers.delete(d),I.subscribers.size===0&&function(G,b){setTimeout(()=>{G.subscribers.size===0&&cl(b,G)},3e3)}(I,l)})}const GG={stack:"dbcore",level:0,name:"Cache",create:I=>{const l=I.schema.name;return{...I,transaction:(c,G,b)=>{const W=I.transaction(c,G,b);if(G==="readwrite"){const t=new AbortController,{signal:a}=t,Z=e=>()=>{if(t.abort(),G==="readwrite"){const n=new Set;for(const s of c){const p=C3[`idb://${l}/${s}`],A=I.table(s);if(p){const Q=p.optimisticOps.filter(o=>o.trans===W);if(Q.length>0){p.optimisticOps=p.optimisticOps.filter(o=>o.trans!==W);for(const o of Object.values(p.queries.query))for(const V of o.slice())if(V.res!=null&&W.mutatedParts)if(e&&!V.dirty){const g=Object.isFrozen(V.res),B=ZI(V.res,V.req,Q,A,V,g);V.dirty?(cl(o,V),V.subscribers.forEach(R=>n.add(R))):B!==V.res&&(V.res=B,V.promise=m2.resolve({result:B}))}else V.dirty&&cl(o,V),V.subscribers.forEach(g=>n.add(g))}}}n.forEach(s=>s())}};W.addEventListener("abort",Z(!1),{signal:a}),W.addEventListener("error",Z(!1),{signal:a}),W.addEventListener("complete",Z(!0),{signal:a})}return W},table(c){const G=I.table(c),b=G.schema.primaryKey;return{...G,mutate(t){if(b.outbound||X2.trans.db._options.cache==="disabled")return G.mutate(t);const a=C3[`idb://${l}/${c}`];if(!a)return G.mutate(t);const Z=G.mutate(t);return t.type!=="add"&&t.type!=="put"||!(t.values.length>=50||p4(b,t).some(e=>e==null))?(a.optimisticOps.push(t),c9(t.mutatedParts),Z.catch(()=>{cl(a.optimisticOps,t),c9(t.mutatedParts)})):Z.then(e=>{const n={...t,values:t.values.map((s,p)=>{const A=b.keyPath.includes(".")?L1(s):{...s};return f0(A,b.keyPath,e.results[p]),A})};a.optimisticOps.push(n),queueMicrotask(()=>c9(t.mutatedParts))}),Z},query(t){if(!Z6(X2,G)||!e6("query",t))return G.query(t);const a=X2.trans.db._options.cache==="immutable",{requery:Z,signal:e}=X2;let[n,s,p,A]=function(Q,o,V,g){const B=C3[`idb://${Q}/${o}`];if(!B)return[];const R=B.queries[V];if(!R)return[null,!1,B,null];const r=R[(g.query?g.query.index.name:null)||""];if(!r)return[null,!1,B,null];switch(V){case"query":const u=r.find(E=>E.req.limit===g.limit&&E.req.values===g.values&&eI(E.req.query.range,g.query.range));return u?[u,!0,B,r]:[r.find(E=>("limit"in E.req?E.req.limit:1/0)>=g.limit&&(!g.values||E.req.values)&&dG(E.req.query.range,g.query.range)),!1,B,r];case"count":const Y=r.find(E=>eI(E.req.query.range,g.query.range));return[Y,!!Y,B,r]}}(l,c,"query",t);if(n&&s)n.obsSet=t.obsSet;else{const Q=G.query(t).then(o=>{const V=o.result;if(n.res=V,a){for(let g=0,B=V.length;g(A&&n&&cl(A,n),Promise.reject(o)));n={obsSet:t.obsSet,promise:Q,subscribers:new Set,type:"query",req:t,dirty:!1},A?A.push(n):(A=[n],p||(p=C3[`idb://${l}/${c}`]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}}),p.queries.query[t.query.index.name||""]=A)}return cG(n,A,Z,e),n.promise.then(Q=>({result:ZI(Q.result,t,p==null?void 0:p.optimisticOps,G,n,a)}))}}}}}};function fl(I,l){return new Proxy(I,{get:(d,c,G)=>c==="db"?l:Reflect.get(d,c,G)})}class l3{constructor(l,d){this._middlewares={},this.verno=0;const c=l3.dependencies;this._options=d={addons:l3.addons,autoOpen:!0,indexedDB:c.indexedDB,IDBKeyRange:c.IDBKeyRange,cache:"cloned",...d},this._deps={indexedDB:d.indexedDB,IDBKeyRange:d.IDBKeyRange};const{addons:G}=d;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const b={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:D2,dbReadyPromise:null,cancelOpen:D2,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var W;b.dbReadyPromise=new m2(a=>{b.dbReadyResolve=a}),b.openCanceller=new m2((a,Z)=>{b.cancelOpen=Z}),this._state=b,this.name=l,this.on=el(this,"populate","blocked","versionchange","close",{ready:[b4,D2]}),this.on.ready.subscribe=vd(this.on.ready.subscribe,a=>(Z,e)=>{l3.vip(()=>{const n=this._state;if(n.openComplete)n.dbOpenError||m2.resolve().then(Z),e&&a(Z);else if(n.onReadyBeingFired)n.onReadyBeingFired.push(Z),e&&a(Z);else{a(Z);const s=this;e||a(function p(){s.on.ready.unsubscribe(Z),s.on.ready.unsubscribe(p)})}})}),this.Collection=(W=this,Il(Lc.prototype,function(a,Z){this.db=W;let e=l6,n=null;if(Z)try{e=Z()}catch(Q){n=Q}const s=a._ctx,p=s.table,A=p.hook.reading.fire;this._ctx={table:p,index:s.index,isPrimKey:!s.index||p.schema.primKey.keyPath&&s.index===p.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:n,or:s.or,valueMapper:A!==Ql?A:null}})),this.Table=function(a){return Il(dI.prototype,function(Z,e,n){this.db=a,this._tx=n,this.name=Z,this.schema=e,this.hook=a._allTables[Z]?a._allTables[Z].hook:el(null,{creating:[Rc,D2],reading:[uc,Ql],updating:[rc,D2],deleting:[hc,D2]})})}(this),this.Transaction=function(a){return Il(Mc.prototype,function(Z,e,n,s,p){this.db=a,this.mode=Z,this.storeNames=e,this.schema=n,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=el(this,"complete","error","abort"),this.parent=p||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new m2((A,Q)=>{this._resolve=A,this._reject=Q}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},A=>{var Q=this.active;return this.active=!1,this.on.error.fire(A),this.parent?this.parent._reject(A):Q&&this.idbtrans&&this.idbtrans.abort(),Z0(A)})})}(this),this.Version=function(a){return Il(jc.prototype,function(Z){this.db=a,this._cfg={version:Z,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(a){return Il(d6.prototype,function(Z,e,n){if(this.db=a,this._ctx={table:Z,index:e===":id"?null:e,or:n},this._cmp=this._ascending=S2,this._descending=(s,p)=>S2(p,s),this._max=(s,p)=>S2(s,p)>0?s:p,this._min=(s,p)=>S2(s,p)<0?s:p,this._IDBKeyRange=a._deps.IDBKeyRange,!this._IDBKeyRange)throw new h2.MissingAPI})}(this),this.on("versionchange",a=>{a.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close({disableAutoOpen:!1}),this._state.openComplete=!1}),this.on("blocked",a=>{!a.newVersion||a.newVersionnew this.Transaction(a,Z,e,this._options.chromeTransactionDurability,n),this._fireOnBlocked=a=>{this.on("blocked").fire(a),Zl.filter(Z=>Z.name===this.name&&Z!==this&&!Z._state.vcFired).map(Z=>Z.on("versionchange").fire(a))},this.use(lG),this.use(GG),this.use(IG),this.use(_c),this.use($c);const t=new Proxy(this,{get:(a,Z,e)=>{if(Z==="_vip")return!0;if(Z==="table")return s=>fl(this.table(s),t);const n=Reflect.get(a,Z,e);return n instanceof dI?fl(n,t):Z==="tables"?n.map(s=>fl(s,t)):Z==="_createTransaction"?function(){const s=n.apply(this,arguments);return fl(s,t)}:n}});this.vip=t,G.forEach(a=>a(this))}version(l){if(isNaN(l)||l<.1)throw new h2.Type("Given version is not a positive number");if(l=Math.round(10*l)/10,this.idbdb||this._state.isBeingOpened)throw new h2.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,l);const d=this._versions;var c=d.filter(G=>G._cfg.version===l)[0];return c||(c=new this.Version(l),d.push(c),d.sort(Tc),c.stores({}),this._state.autoSchema=!1,c)}_whenReady(l){return this.idbdb&&(this._state.openComplete||X2.letThrough||this._vip)?l():new m2((d,c)=>{if(this._state.openComplete)return c(new h2.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void c(new h2.DatabaseClosed);this.open().catch(D2)}this._state.dbReadyPromise.then(d,c)}).then(l)}use({stack:l,create:d,level:c,name:G}){G&&this.unuse({stack:l,name:G});const b=this._middlewares[l]||(this._middlewares[l]=[]);return b.push({stack:l,create:d,level:c??10,name:G}),b.sort((W,t)=>W.level-t.level),this}unuse({stack:l,name:d,create:c}){return l&&this._middlewares[l]&&(this._middlewares[l]=this._middlewares[l].filter(G=>c?G.create!==c:!!d&&G.name!==d)),this}open(){return W3(E1,()=>Pc(this))}_close(){const l=this._state,d=Zl.indexOf(this);if(d>=0&&Zl.splice(d,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}l.dbReadyPromise=new m2(c=>{l.dbReadyResolve=c}),l.openCanceller=new m2((c,G)=>{l.cancelOpen=G})}close({disableAutoOpen:l}={disableAutoOpen:!0}){this._close();const d=this._state;l&&(this._options.autoOpen=!1),d.dbOpenError=new h2.DatabaseClosed,d.isBeingOpened&&d.cancelOpen(d.dbOpenError)}delete(){const l=arguments.length>0,d=this._state;return new m2((c,G)=>{const b=()=>{this.close({disableAutoOpen:!1});var W=this._deps.indexedDB.deleteDatabase(this.name);W.onsuccess=d0(()=>{(function({indexedDB:t,IDBKeyRange:a},Z){!e4(t)&&Z!=="__dbnames"&&Z4(t,a).delete(Z).catch(D2)})(this._deps,this.name),c()}),W.onerror=c1(G),W.onblocked=this._fireOnBlocked};if(l)throw new h2.InvalidArgument("Arguments not allowed in db.delete()");d.isBeingOpened?d.dbReadyPromise.then(b):b()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const l=this._state.dbOpenError;return l&&l.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return m0(this._allTables).map(l=>this._allTables[l])}transaction(){const l=qc.apply(this,arguments);return this._transaction.apply(this,l)}_transaction(l,d,c){let G=X2.trans;G&&G.db===this&&l.indexOf("!")===-1||(G=null);const b=l.indexOf("?")!==-1;let W,t;l=l.replace("!","").replace("?","");try{if(t=d.map(Z=>{var e=Z instanceof this.Table?Z.name:Z;if(typeof e!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e}),l=="r"||l==="readonly")W="readonly";else{if(l!="rw"&&l!="readwrite")throw new h2.InvalidArgument("Invalid transaction mode: "+l);W="readwrite"}if(G){if(G.mode==="readonly"&&W==="readwrite"){if(!b)throw new h2.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");G=null}G&&t.forEach(Z=>{if(G&&G.storeNames.indexOf(Z)===-1){if(!b)throw new h2.SubTransaction("Table "+Z+" not included in parent transaction.");G=null}}),b&&G&&!G.active&&(G=null)}}catch(Z){return G?G._promise(null,(e,n)=>{n(Z)}):Z0(Z)}const a=a6.bind(null,this,W,t,G,c);return G?G._promise(W,a,"lock"):X2.trans?W3(X2.transless,()=>this._whenReady(a)):this._whenReady(a)}table(l){if(!v0(this._allTables,l))throw new h2.InvalidTable(`Table ${l} does not exist`);return this._allTables[l]}}const bG=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class WG{constructor(l){this._subscribe=l}subscribe(l,d,c){return this._subscribe(l&&typeof l!="function"?l:{next:l,error:d,complete:c})}[bG](){return this}}let X5;try{X5={indexedDB:F0.indexedDB||F0.mozIndexedDB||F0.webkitIndexedDB||F0.msIndexedDB,IDBKeyRange:F0.IDBKeyRange||F0.webkitIDBKeyRange}}catch{X5={indexedDB:null,IDBKeyRange:null}}function aG(I){let l,d=!1;const c=new WG(G=>{const b=d4(I);let W,t=!1,a={},Z={};const e={get closed(){return t},unsubscribe:()=>{t||(t=!0,W&&W.abort(),n&&g1.storagemutated.unsubscribe(s))}};G.start&&G.start(e);let n=!1;const s=A=>{L5(a,A),W6(Z,a)&&p()},p=()=>{if(t||!X5.indexedDB)return;a={};const A={};W&&W.abort(),W=new AbortController;const Q={subscr:A,signal:W.signal,requery:p,querier:I,trans:null},o=function(V){const g=T3();try{b&&j3();const B=U1(I,V);return b&&B.finally(k1),B}finally{g&&f3()}}(Q);Promise.resolve(o).then(V=>{d=!0,l=V,t||Q.signal.aborted||(a={},Z=A,function(g){for(const B in g)if(v0(g,B))return!1;return!0}(Z)||n||(g1("storagemutated",s),n=!0),G.next&&G.next(V))},V=>{if(d=!1,!["DatabaseClosedError","AbortError"].includes(V==null?void 0:V.name)){if(t)return;G.error&&G.error(V)}})};return p(),e});return c.hasValue=()=>d,c.getValue=()=>l,c}const j1=l3;function a5(I){let l=Q1;try{Q1=!0,g1.storagemutated.fire(I),s4(I,!0)}finally{Q1=l}}U3(j1,{...I5,delete:I=>new j1(I,{addons:[]}).delete(),exists:I=>new j1(I,{addons:[]}).open().then(l=>(l.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(I){try{return function({indexedDB:l,IDBKeyRange:d}){return e4(l)?Promise.resolve(l.databases()).then(c=>c.map(G=>G.name).filter(G=>G!=="__dbnames")):Z4(l,d).toCollection().primaryKeys()}(j1.dependencies).then(I)}catch{return Z0(new h2.MissingAPI)}},defineClass:()=>function(I){S0(this,I)},ignoreTransaction:I=>X2.trans?W3(X2.transless,I):I(),vip:v9,async:function(I){return function(){try{var l=k9(I.apply(this,arguments));return l&&typeof l.then=="function"?l:m2.resolve(l)}catch(d){return Z0(d)}}},spawn:function(I,l,d){try{var c=k9(I.apply(d,l||[]));return c&&typeof c.then=="function"?c:m2.resolve(c)}catch(G){return Z0(G)}},currentTransaction:{get:()=>X2.trans||null},waitFor:function(I,l){const d=m2.resolve(typeof I=="function"?j1.ignoreTransaction(I):I).timeout(l||6e4);return X2.trans?X2.trans.waitFor(d):d},Promise:m2,debug:{get:()=>h1,set:I=>{Sd(I,I==="dexie"?()=>!0:$d)}},derive:E3,extend:S0,props:U3,override:vd,Events:el,on:g1,liveQuery:aG,extendObservabilitySet:L5,getByKeyPath:V1,setByKeyPath:f0,delByKeyPath:function(I,l){typeof l=="string"?f0(I,l,void 0):"length"in l&&[].map.call(l,function(d){f0(I,d,void 0)})},shallowClone:Ud,deepClone:L1,getObjectDiff:m4,cmp:S2,asap:Ld,minKey:-(1/0),addons:[],connections:Zl,errnames:G4,dependencies:X5,cache:C3,semVer:"4.0.1-beta.1",version:"4.0.1-beta.1".split(".").map(I=>parseInt(I)).reduce((I,l,d)=>I+l/Math.pow(10,2*d))}),j1.maxKey=Vl(j1.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(g1("storagemutated",I=>{if(!Q1){let l;v5?(l=document.createEvent("CustomEvent"),l.initCustomEvent("x-storagemutated-1",!0,!0,I)):l=new CustomEvent("x-storagemutated-1",{detail:I}),Q1=!0,dispatchEvent(l),Q1=!1}}),addEventListener("x-storagemutated-1",({detail:I})=>{Q1||a5(I)}));let Q1=!1;if(typeof BroadcastChannel<"u"){const I=new BroadcastChannel("x-storagemutated-1");typeof I.unref=="function"&&I.unref(),g1("storagemutated",l=>{Q1||I.postMessage(l)}),I.onmessage=l=>{l.data&&a5(l.data)}}else if(typeof self<"u"&&typeof navigator<"u"){g1("storagemutated",l=>{try{Q1||(typeof localStorage<"u"&&localStorage.setItem("x-storagemutated-1",JSON.stringify({trig:Math.random(),changedParts:l})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(d=>d.postMessage({type:"x-storagemutated-1",changedParts:l})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",l=>{if(l.key==="x-storagemutated-1"){const d=JSON.parse(l.newValue);d&&a5(d.changedParts)}});const I=self.document&&navigator.serviceWorker;I&&I.addEventListener("message",function({data:l}){l&&l.type==="x-storagemutated-1"&&a5(l.changedParts)})}m2.rejectionMapper=function(I,l){if(!I||I instanceof J3||I instanceof TypeError||I instanceof SyntaxError||!I.name||!q4[I.name])return I;var d=new q4[I.name](l||I.message,I);return"stack"in I&&o1(d,"stack",{get:function(){return this.inner.stack}}),d},Sd(h1,$d);let M1=!!window.indexedDB;const tG=M1&&window.indexedDB.open("test");M1&&(tG.onerror=()=>{M1=!1});let t3={};class ZG extends l3{constructor(){super("chatImageStore");R2(this,"images");this.version(1).stores({images:"id"})}}const k3=new ZG,n6=async I=>{let l=t3[I];return l||!M1||(l=await k3.images.get(I),t3[I]=l),l},s6=async(I,l)=>{var c,G,b,W;const d=t3[l];if(d&&(d.chats=(c=d.chats)==null?void 0:c.filter(t=>t!==I)),(G=d==null?void 0:d.chats)!=null&&G.length||delete t3[l],M1){const t=await k3.images.get({id:l});t&&(t.chats=(b=t.chats)==null?void 0:b.filter(a=>a!==I)),(W=t==null?void 0:t.chats)!=null&&W.length?t&&await A4(I,t):k3.images.delete(l)}},eG=async()=>{t3={},M1&&k3.images.clear()},A4=async(I,l)=>{l.id=l.id||h0();let d;M1?d=await k3.images.get({id:l.id}):d=t3[l.id],d=d||l,d.chats=d.chats||[],I in d.chats||d.chats.push(I),t3[d.id]=d,M1&&k3.images.put(d,d.id);const c=JSON.parse(JSON.stringify(d));return delete c.b64image,delete c.chats,c},I3=B0(!1),d3=B0(null),c3=B0([]),m6=B0(null);function nG(I=1){var c,G;const l=w2(c3).length,d=w2(c3)[l-1];return w2(d3)||(c=d==null?void 0:d.callbacks)!=null&&c.onBeforeClose&&((G=d==null?void 0:d.callbacks)==null?void 0:G.onBeforeClose())===!1?!1:(w2(I3)&&l>0&&d3.set(!0),I3.set(!1),m6.set("pop"),sG(I),!0)}function x3(){return nG(1)}function b1(I,l,d){w2(d3)||(m6.set("push"),w2(I3)&&w2(c3).length&&d3.set(!0),I3.set(!1),d!=null&&d.replace?c3.update(c=>[...c.slice(0,c.length-1),{component:I,props:l}]):c3.update(c=>[...c,{component:I,props:l}]))}function sG(I=1){c3.update(l=>l.slice(0,Math.max(0,l.length-I)))}function nI(I,l,d){const c=I.slice();return c[9]=l[d],c[11]=d,c}const mG=I=>({}),sI=I=>({}),pG=I=>({}),mI=I=>({});function pI(I){let l;const d=I[4].backdrop,c=O2(d,I,I[3],mI);return{c(){c&&c.c()},m(G,b){c&&c.m(G,b),l=!0},p(G,b){c&&c.p&&(!l||b&8)&&q2(c,d,G,G[3],l?P2(d,G[3],b,pG):_2(G[3]),mI)},i(G){l||(h(c,G),l=!0)},o(G){i(c,G),l=!1},d(G){c&&c.d(G)}}}function AG(I){let l,d,c;const G=[{isOpen:I[11]===I[0].length-1&&!I[1]},I[9].props];var b=I[9].component;function W(t){let a={};for(let Z=0;Z{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("introstart",t[7]),l.$on("outroend",t[8]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){t&&H(d),l&&O(l,t)}}}function QG(I){let l,d,c,G={ctx:I,current:null,token:null,hasCatch:!1,pending:VG,then:oG,catch:FG,value:12,blocks:[,,,]};return j4(d=QI(I[9].component),G),{c(){l=r2(),G.block.c()},m(b,W){K(b,l,W),G.block.m(b,G.anchor=W),G.mount=()=>l.parentNode,G.anchor=l,c=!0},p(b,W){I=b,G.ctx=I,W&1&&d!==(d=QI(I[9].component))&&j4(d,G)||P7(G,I,W)},i(b){c||(h(G.block),c=!0)},o(b){for(let W=0;W<3;W+=1){const t=G.blocks[W];i(t)}c=!1},d(b){b&&H(l),G.block.d(b),G.token=null,G=null}}}function FG(I){return{c:c2,m:c2,p:c2,i:c2,o:c2,d:c2}}function oG(I){let l,d,c;const G=[{isOpen:I[11]===I[0].length-1&&!I[1]},I[9].props];var b=I[12];function W(t){let a={};for(let Z=0;Z{O(e,1)}),t2()}b?(l=U2(b,W()),l.$on("introstart",t[5]),l.$on("outroend",t[6]),P(l.$$.fragment),h(l.$$.fragment,1),D(l,d.parentNode,d)):l=null}else b&&l.$set(Z)},i(t){c||(l&&h(l.$$.fragment,t),c=!0)},o(t){l&&i(l.$$.fragment,t),c=!1},d(t){l&&O(l,t),t&&H(d)}}}function VG(I){let l,d;const c=I[4].loading,G=O2(c,I,I[3],sI);return{c(){G&&G.c(),l=x()},m(b,W){G&&G.m(b,W),K(b,l,W),d=!0},p(b,W){G&&G.p&&(!d||W&8)&&q2(G,c,b,b[3],d?P2(c,b[3],W,mG):_2(b[3]),sI)},i(b){d||(h(G,b),d=!0)},o(b){i(G,b),d=!1},d(b){G&&G.d(b),b&&H(l)}}}function AI(I,l){let d,c,G,b,W,t;const a=[QG,AG],Z=[];function e(n,s){return s&1&&(c=null),c==null&&(c=!!uG(n[9].component)),c?0:1}return G=e(l,-1),b=Z[G]=a[G](l),{key:I,first:null,c(){d=r2(),b.c(),W=r2(),this.first=d},m(n,s){K(n,d,s),Z[G].m(n,s),K(n,W,s),t=!0},p(n,s){l=n;let p=G;G=e(l,s),G===p?Z[G].p(l,s):(a2(),i(Z[p],1,1,()=>{Z[p]=null}),t2(),b=Z[G],b?b.p(l,s):(b=Z[G]=a[G](l),b.c()),h(b,1),b.m(W.parentNode,W))},i(n){t||(h(b),t=!0)},o(n){i(b),t=!1},d(n){n&&H(d),Z[G].d(n),n&&H(W)}}}function XG(I){let l=[],d=new Map,c,G,b=I[0];const W=t=>t[11];for(let t=0;t0&&pI(I);const G=I[4].default,b=O2(G,I,I[3],null),W=b||XG(I);return{c(){c&&c.c(),l=x(),W&&W.c()},m(t,a){c&&c.m(t,a),K(t,l,a),W&&W.m(t,a),d=!0},p(t,[a]){t[0].length>0?c?(c.p(t,a),a&1&&h(c,1)):(c=pI(t),c.c(),h(c,1),c.m(l.parentNode,l)):c&&(a2(),i(c,1,1,()=>{c=null}),t2()),b?b.p&&(!d||a&8)&&q2(b,G,t,t[3],d?P2(G,t[3],a,null):_2(t[3]),null):W&&W.p&&(!d||a&15)&&W.p(t,d?a:-1)},i(t){d||(h(c),h(W,t),d=!0)},o(t){i(c),i(W,t),d=!1},d(t){c&&c.d(t),t&&H(l),W&&W.d(t)}}}function uG(I){return typeof I.prototype>"u"}async function QI(I){return I().then(l=>l.default)}function RG(I,l,d){let c,G,b;y2(I,c3,s=>d(0,c=s)),y2(I,d3,s=>d(1,G=s)),y2(I,I3,s=>d(2,b=s));let{$$slots:W={},$$scope:t}=l;const a=()=>{c0(I3,b=!0,b)},Z=()=>{c0(d3,G=!1,G)},e=()=>{c0(I3,b=!0,b)},n=()=>{c0(d3,G=!1,G)};return I.$$set=s=>{"$$scope"in s&&d(3,t=s.$$scope)},[c,G,b,t,W,a,Z,e,n]}class hG extends C2{constructor(l){super(),N2(this,l,RG,gG,g2,{})}}function FI(I){let l,d,c,G,b,W,t,a,Z,e,n,s,p,A,Q,o,V,g,B,R,r,u,Y,E,y;function C(J,U){return J[3]?BG:rG}let k=C(I),L=k(I);return{c(){l=X("div"),d=X("div"),c=x(),G=X("div"),b=X("article"),W=X("div"),t=X("p"),a=s2(I[1]),Z=x(),e=X("button"),n=x(),s=X("div"),L.c(),p=x(),A=X("div"),Q=X("div"),o=X("div"),V=x(),g=X("div"),B=X("div"),R=X("button"),r=s2(I[4]),m(d,"class","modal-background"),m(e,"class","delete"),m(e,"aria-label","close"),m(e,"type","button"),m(W,"class","message-header"),m(s,"class","message-body"),m(o,"class","level-right"),m(R,"class",u="button "+I[5]),m(R,"type","button"),m(B,"class","level-item"),m(g,"class","level-right"),m(Q,"class","level is-mobile"),m(A,"class","message-footer"),m(b,"class",Y="message "+I[6]),m(G,"class","modal-content nomax"),m(l,"class","modal is-active")},m(J,U){K(J,l,U),F(l,d),F(l,c),F(l,G),F(G,b),F(b,W),F(W,t),F(t,a),F(W,Z),F(W,e),F(b,n),F(b,s),L.m(s,null),F(b,p),F(b,A),F(A,Q),F(Q,o),F(Q,V),F(Q,g),F(g,B),F(B,R),F(R,r),E||(y=[_(d,"click",I[7]),_(e,"click",I[7]),_(R,"click",I[7]),_(l,"modal-esc",I[7])],E=!0)},p(J,U){U&2&&T2(a,J[1]),k===(k=C(J))&&L?L.p(J,U):(L.d(1),L=k(J),L&&(L.c(),L.m(s,null))),U&16&&T2(r,J[4]),U&32&&u!==(u="button "+J[5])&&m(R,"class",u),U&64&&Y!==(Y="message "+J[6])&&m(b,"class",Y)},d(J){J&&H(l),L.d(),E=!1,a0(y)}}}function rG(I){let l;return{c(){l=s2(I[2])},m(d,c){K(d,l,c)},p(d,c){c&4&&T2(l,d[2])},d(d){d&&H(l)}}}function BG(I){let l,d;return{c(){l=new wl(!1),d=r2(),l.a=d},m(c,G){l.m(I[2],c,G),K(c,d,G)},p(c,G){G&4&&l.p(c[2])},d(c){c&&H(d),c&&l.d()}}}function iG(I){let l,d=I[0]&&FI(I);return{c(){d&&d.c(),l=r2()},m(c,G){d&&d.m(c,G),K(c,l,G)},p(c,[G]){c[0]?d?d.p(c,G):(d=FI(c),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i:c2,o:c2,d(c){d&&d.d(c),c&&H(l)}}}function wG(I,l,d){let{isOpen:c}=l,{title:G}=l,{message:b}=l,{asHtml:W=!1}=l,{onConfirm:t=null}=l,{confirmButton:a="Close"}=l,{confirmButtonClass:Z="is-info"}=l,{class:e=""}=l;const n=()=>{(!t||!t())&&x3()};return I.$$set=s=>{"isOpen"in s&&d(0,c=s.isOpen),"title"in s&&d(1,G=s.title),"message"in s&&d(2,b=s.message),"asHtml"in s&&d(3,W=s.asHtml),"onConfirm"in s&&d(8,t=s.onConfirm),"confirmButton"in s&&d(4,a=s.confirmButton),"confirmButtonClass"in s&&d(5,Z=s.confirmButtonClass),"class"in s&&d(6,e=s.class)},[c,G,b,W,a,Z,e,n,t]}class YG extends C2{constructor(l){super(),N2(this,l,wG,iG,g2,{isOpen:0,title:1,message:2,asHtml:3,onConfirm:8,confirmButton:4,confirmButtonClass:5,class:6})}}function NG(I,l){if(I===l)throw new Error("Cannot compare node with itself");const d={a:XI(I),b:XI(l)};let c;for(;d.a.at(-1)===d.b.at(-1);)I=d.a.pop(),l=d.b.pop(),c=I;const G={a:VI(oI(d.a)),b:VI(oI(d.b))};if(G.a===G.b){const b=c.childNodes,W={a:d.a.at(-1),b:d.b.at(-1)};let t=b.length;for(;t--;){const a=b[t];if(a===W.a)return 1;if(a===W.b)return-1}}return Math.sign(G.a-G.b)}const CG=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function HG(I){const l=getComputedStyle(p6(I)).display;return l==="flex"||l==="inline-flex"}function KG(I){const l=getComputedStyle(I);return!!(l.position==="fixed"||l.zIndex!=="auto"&&l.position!=="static"||HG(I)||+l.opacity<1||"transform"in l&&l.transform!=="none"||"webkitTransform"in l&&l.webkitTransform!=="none"||"mixBlendMode"in l&&l.mixBlendMode!=="normal"||"filter"in l&&l.filter!=="none"||"webkitFilter"in l&&l.webkitFilter!=="none"||"isolation"in l&&l.isolation==="isolate"||CG.test(l.willChange)||l.webkitOverflowScrolling==="touch")}function oI(I){let l=I.length;for(;l--;)if(KG(I[l]))return I[l];return null}function VI(I){return I&&Number(getComputedStyle(I).zIndex)||0}function XI(I){const l=[];for(;I;)l.push(I),I=p6(I);return l}function p6(I){var l;return((l=I.parentNode)==null?void 0:l.host)||I.parentNode}const x9=I=>{const l=document.querySelectorAll("textarea.auto-size");for(let d=0,c=l.length;d{I.target!==null&&(I.target.__didAutoGrow=!1,A6(I.target))},A6=(I,l)=>{const d=I;(l||!d.__didAutoGrow)&&(I.style.height="38px"),I.style.height=I.scrollHeight+"px",setTimeout(()=>{I.scrollHeight>I.getBoundingClientRect().height+5?I.style.overflowY="auto":I.style.overflowY=""},0),d.__didAutoGrow=!0},EG=(I,l,d=!1,c=!1)=>{const G=d?"instant":"smooth";c?window.scrollTo({behavior:G,top:I.getBoundingClientRect().bottom-document.body.getBoundingClientRect().top-(window.innerHeight-l)}):window.scrollTo({behavior:G,top:I.getBoundingClientRect().top-document.body.getBoundingClientRect().top-l})},g5=(I,l=60,d=!1,c=!1)=>{if(Array.isArray(I)&&(I=I[0]),!I){console.error("Not a valid uuid",I);return}const G=document.getElementById("message-"+I);G?EG(G,l,d,c):console.error("Can't find element with message ID",I)},t5=(I=!1)=>{setTimeout(()=>{var l;return(l=document.querySelector("body"))==null?void 0:l.scrollIntoView({behavior:I?"instant":"smooth",block:"end"})},0)},JG=I=>{!I||I.key!=="Escape"||Q6()},Q6=()=>{const I=Array.from(document.querySelectorAll(".modal, .has-esc")).filter(d=>window.getComputedStyle(d).getPropertyValue("display")!=="none"),l=I.length===1?I[0]:I.find(d=>I.find(c=>d!==c&&NG(d,c)>0&&d));if(l){const d=new CustomEvent("modal-esc",{detail:l});l.dispatchEvent(d)}},yG=I=>I.replace(/[\u00A0-\u9999<>&]/g,l=>`&#${l.charCodeAt(0)};`),g0=(I,l=void 0)=>{b1(YG,{title:"Error",class:"is-danger",message:I+(l?"
"+l.message:""),asHtml:!0,onConfirm:()=>{}})},vG=I=>{const l=ul(D0(I).settings);q0(`/chat/${l}`)},S9=(I,l)=>{(()=>{const c=ul(l);q0(`/chat/${c}`)})()},u0=(I,l)=>typeof l=="function"?l(I):l,LG=I=>I.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&"),G0={};typeof window<"u"&&(window.llamaTokenizer=G0);const F6=function(I){return atob(I)},o6=function(I,l){return G0.vocabById[I]+" "+G0.vocabById[l]},UG=function(I){const l=F6(I),d=new Uint8Array(l.length);for(let b=0;bc.charCodeAt(0));return new TextDecoder("utf-8").decode(l).split(` `)},gI=I=>`<0x${I.toString(16).toUpperCase().padStart(2,"0")}>`,xG=I=>{const l=I.replace(/<0x|>/g,"");return parseInt(l,16)},V6=new TextEncoder,MG=new TextDecoder("utf-8");class SG{constructor(l=(d,c)=>d>c){this._heap=[],this._comparator=l}size(){return this._heap.length}isEmpty(){return this.size()==0}peek(){return this._heap[0]}push(...l){return l.forEach(d=>{this._heap.push(d),this._siftUp()}),this.size()}pop(){const l=this.peek(),d=this.size()-1;return d>0&&this._swap(0,d),this._heap.pop(),this._siftDown(),l}replace(l){const d=this.peek();return this._heap[0]=l,this._siftDown(),d}_parent(l){return(l+1>>>1)-1}_left(l){return(l<<1)+1}_right(l){return l+1<<1}_greater(l,d){return this._comparator(this._heap[l],this._heap[d])}_swap(l,d){[this._heap[l],this._heap[d]]=[this._heap[d],this._heap[l]]}_siftUp(){let l=this.size()-1;for(;l>0&&this._greater(l,this._parent(l));)this._swap(l,this._parent(l)),l=this._parent(l)}_siftDown(){let l=0;for(;this._left(l){const c=[];l&&c.push(1),d&&(I=" "+I);const G=I.replaceAll(" ",G0.vocabById[29871]),b=Array.from(G);for(let W=0;W=0||(console.log("Encountered unknown character "+t+" (partial UTF-8 byte "+a[Z]+" + hex + "+gI(a[Z])+")"),c[c.length-1]=0)}}}return c},X6=(I,l=!0,d=!0,c=!1)=>{let G=null;if(c&&(G=performance.now()),!G0.vocabById||!G0.vocabByString||!G0.merges){console.log("Tokenizer not initialized properly!");return}if(I.length===0)return[];const b=zG(I,l,d),W=new SG((n,s)=>n.mergePrio")){const n=xG(e);c.push(n)}else V6.encode(e).forEach(s=>c.push(s))}const b=new Uint8Array(c),t=MG.decode(b).replaceAll(G0.vocabById[29871]," ");return d?t.slice(1):t};function TG(){function I(d,c){return d.length===c.length&&d.every(function(G,b){return G===c[b]})}function l(d,c){const G=X6(d,!0,!0,!0);if(!I(G,c))throw`Test failed. LLaMA Tokenizer Encoder returned unexpected result: expected tokenize(${d}) === ${c}, actual was: ${G}`;if(d!==z9(G))throw`Test failed. LLaMA Tokenizer Decoder returned unexpected result: expected decode(${G}) === ${d}, actual was: ${z9(G)}`}return l("grabbed",[1,2646,1327,287]),l(" grabbed",[1,29871,2646,1327,287]),l(" grabbed",[1,9651,2646,1327,287]),l(` `,[1,29871,13]),l(` `,[1,259,13]),l(" tabs out here",[1,29871,12,21175,12,12,12,12,449,1244]),l(`ax diff --git a/index.html b/index.html index ff20b734..121caa24 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ ChatGPT-web - +