You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
64 KiB
28 lines
64 KiB
import{X as Re}from"./index-BLqts8WY.js";var mn={};/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var fn=function(){return fn=Object.assign||function(v){for(var s,m=1,w=arguments.length;m<w;m++){s=arguments[m];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(v[p]=s[p])}return v},fn.apply(this,arguments)};function en(g,v,s,m){function w(p){return p instanceof s?p:new s(function(o){o(p)})}return new(s||(s=Promise))(function(p,o){function j(_){try{u(m.next(_))}catch(F){o(F)}}function R(_){try{u(m.throw(_))}catch(F){o(F)}}function u(_){_.done?p(_.value):w(_.value).then(j,R)}u((m=m.apply(g,[])).next())})}function We(g,v){var s={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},m,w,p,o;return o={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function j(u){return function(_){return R([u,_])}}function R(u){if(m)throw new TypeError("Generator is already executing.");for(;s;)try{if(m=1,w&&(p=u[0]&2?w.return:u[0]?w.throw||((p=w.return)&&p.call(w),0):w.next)&&!(p=p.call(w,u[1])).done)return p;switch(w=0,p&&(u=[u[0]&2,p.value]),u[0]){case 0:case 1:p=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,w=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(p=s.trys,!(p=p.length>0&&p[p.length-1])&&(u[0]===6||u[0]===2)){s=0;continue}if(u[0]===3&&(!p||u[1]>p[0]&&u[1]<p[3])){s.label=u[1];break}if(u[0]===6&&s.label<p[1]){s.label=p[1],p=u;break}if(p&&s.label<p[2]){s.label=p[2],s.ops.push(u);break}p[2]&&s.ops.pop(),s.trys.pop();continue}u=v.call(g,s)}catch(_){u=[6,_],w=0}finally{m=p=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function _n(g){var v=[g.schema.primKey].concat(g.schema.indexes);return v.map(function(s){return s.src}).join(",")}function Nn(g){for(var v={},s=0,m=g.tables;s<m.length;s++){var w=m[s];v[w.name]=w.schema}return v}function gn(g,v){return new Promise(function(s,m){var w=new FileReader;w.onabort=function(p){return m(new Error("file read aborted"))},w.onerror=function(p){return m(p.target.error)},w.onload=function(p){return s(p.target.result)},v==="binary"?w.readAsArrayBuffer(g):w.readAsText(g)})}function wn(g,v){if(typeof FileReaderSync>"u")throw new Error("FileReaderSync missing. Reading blobs synchronously requires code to run from within a web worker. Use TSON.encapsulateAsync() to do it from the main thread.");var s=new FileReaderSync,m=v==="binary"?s.readAsArrayBuffer(g):s.readAsText(g);return m}var hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bn(g,v){return v={exports:{}},g(v,v.exports),v.exports}var pn=bn(function(g,v){(function(s,m){g.exports=m()})(hn,function(){function s(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?s=function(y){return typeof y}:s=function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},s(l)}function m(l,y,h,d,A,G,H){try{var W=l[G](H),C=W.value}catch(Ae){h(Ae);return}W.done?y(C):Promise.resolve(C).then(d,A)}function w(l){return function(){var y=this,h=arguments;return new Promise(function(d,A){var G=l.apply(y,h);function H(C){m(G,d,A,H,W,"next",C)}function W(C){m(G,d,A,H,W,"throw",C)}H(void 0)})}}function p(l,y){if(!(l instanceof y))throw new TypeError("Cannot call a class as a function")}function o(l,y){for(var h=0;h<y.length;h++){var d=y[h];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(l,d.key,d)}}function j(l,y,h){return o(l.prototype,y),l}function R(l,y,h){return y in l?Object.defineProperty(l,y,{value:h,enumerable:!0,configurable:!0,writable:!0}):l[y]=h,l}function u(l,y){var h=Object.keys(l);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(l);y&&(d=d.filter(function(A){return Object.getOwnPropertyDescriptor(l,A).enumerable})),h.push.apply(h,d)}return h}function _(l){for(var y=1;y<arguments.length;y++){var h=arguments[y]!=null?arguments[y]:{};y%2?u(Object(h),!0).forEach(function(d){R(l,d,h[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(h)):u(Object(h)).forEach(function(d){Object.defineProperty(l,d,Object.getOwnPropertyDescriptor(h,d))})}return l}function F(l,y){return J(l)||ee(l,y)||me()}function pe(l){return ve(l)||V(l)||Ee()}function ve(l){if(Array.isArray(l)){for(var y=0,h=new Array(l.length);y<l.length;y++)h[y]=l[y];return h}}function J(l){if(Array.isArray(l))return l}function V(l){if(Symbol.iterator in Object(l)||Object.prototype.toString.call(l)==="[object Arguments]")return Array.from(l)}function ee(l,y){if(Symbol.iterator in Object(l)||Object.prototype.toString.call(l)==="[object Arguments]"){var h=[],d=!0,A=!1,G=void 0;try{for(var H=l[Symbol.iterator](),W;!(d=(W=H.next()).done)&&(h.push(W.value),!(y&&h.length===y));d=!0);}catch(C){A=!0,G=C}finally{try{!d&&H.return!=null&&H.return()}finally{if(A)throw G}}return h}}function Ee(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function me(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var N=function l(y){p(this,l),this.p=new Promise(y)};N.__typeson__type__="TypesonPromise",typeof Symbol<"u"&&(N.prototype[Symbol.toStringTag]="TypesonPromise"),N.prototype.then=function(l,y){var h=this;return new N(function(d,A){h.p.then(function(G){d(l?l(G):G)}).catch(function(G){return y?y(G):Promise.reject(G)}).then(d,A)})},N.prototype.catch=function(l){return this.then(null,l)},N.resolve=function(l){return new N(function(y){y(l)})},N.reject=function(l){return new N(function(y,h){h(l)})},["all","race"].forEach(function(l){N[l]=function(y){return new N(function(h,d){Promise[l](y.map(function(A){return A&&A.constructor&&A.constructor.__typeson__type__==="TypesonPromise"?A.p:A})).then(h,d)})}});var Ne={},K=Ne.toString,te={}.hasOwnProperty,re=Object.getPrototypeOf,Pe=te.toString;function c(l,y){return M(l)&&typeof l.then=="function"&&(!y||typeof l.catch=="function")}function r(l){return K.call(l).slice(8,-1)}function b(l,y){if(!l||s(l)!=="object")return!1;var h=re(l);if(!h)return y===null;var d=te.call(h,"constructor")&&h.constructor;return typeof d!="function"?y===null:y===d||y!==null&&Pe.call(d)===Pe.call(y)||typeof y=="function"&&typeof d.__typeson__type__=="string"&&d.__typeson__type__===y.__typeson__type__}function f(l){if(!l||r(l)!=="Object")return!1;var y=re(l);return y?b(l,Object):!0}function Z(l){if(!l||r(l)!=="Object")return!1;var y=re(l);return y?b(l,Object)||Z(y):!0}function M(l){return l&&s(l)==="object"}function ie(l){return l.replace(/~/g,"~0").replace(/\./g,"~1")}function he(l){return l.replace(/~1/g,".").replace(/~0/g,"~")}function Se(l,y){if(y==="")return l;var h=y.indexOf(".");if(h>-1){var d=l[he(y.slice(0,h))];return d===void 0?void 0:Se(d,y.slice(h+1))}return l[he(y)]}function Be(l,y,h){if(y==="")return h;var d=y.indexOf(".");if(d>-1){var A=l[he(y.slice(0,d))];return Be(A,y.slice(d+1),h)}return l[he(y)]=h,l}function _e(l){return l===null?"null":Array.isArray(l)?"array":s(l)}var ce=Object.keys,be=Array.isArray,Ce={}.hasOwnProperty,Me=["type","replaced","iterateIn","iterateUnsetNumeric"];function $(l,y){if(l.keypath==="")return-1;var h=l.keypath.match(/\./g)||0,d=y.keypath.match(/\./g)||0;return h&&(h=h.length),d&&(d=d.length),h>d?-1:h<d?1:l.keypath<y.keypath?-1:l.keypath>y.keypath}var ye=function(){function l(y){p(this,l),this.options=y,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return j(l,[{key:"stringify",value:function(h,d,A,G){G=_({},this.options,{},G,{stringification:!0});var H=this.encapsulate(h,null,G);return be(H)?JSON.stringify(H[0],d,A):H.then(function(W){return JSON.stringify(W,d,A)})}},{key:"stringifySync",value:function(h,d,A,G){return this.stringify(h,d,A,_({throwOnBadSyncType:!0},G,{sync:!0}))}},{key:"stringifyAsync",value:function(h,d,A,G){return this.stringify(h,d,A,_({throwOnBadSyncType:!0},G,{sync:!1}))}},{key:"parse",value:function(h,d,A){return A=_({},this.options,{},A,{parse:!0}),this.revive(JSON.parse(h,d),A)}},{key:"parseSync",value:function(h,d,A){return this.parse(h,d,_({throwOnBadSyncType:!0},A,{sync:!0}))}},{key:"parseAsync",value:function(h,d,A){return this.parse(h,d,_({throwOnBadSyncType:!0},A,{sync:!1}))}},{key:"specialTypeNames",value:function(h,d){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return A.returnTypeNames=!0,this.encapsulate(h,d,A)}},{key:"rootTypeName",value:function(h,d){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return A.iterateNone=!0,this.encapsulate(h,d,A)}},{key:"encapsulate",value:function(h,d,A){A=_({sync:!0},this.options,{},A);var G=A,H=G.sync,W=this,C={},Ae=[],Ue=[],xe=[],Ge="cyclic"in A?A.cyclic:!0,Ye=A,Xe=Ye.encapsulateObserver,Fe=ue("",h,Ge,d||{},xe);function qe(I){var t=Object.values(C);if(A.iterateNone)return t.length?t[0]:l.getJSONType(I);if(t.length){if(A.returnTypeNames)return pe(new Set(t));!I||!f(I)||Ce.call(I,"$types")?I={$:I,$types:{$:C}}:I.$types=C}else M(I)&&Ce.call(I,"$types")&&(I={$:I,$types:!0});return A.returnTypeNames?!1:I}function ge(I,t){return oe.apply(this,arguments)}function oe(){return oe=w(regeneratorRuntime.mark(function I(t,e){var n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,Promise.all(e.map(function(O){return O[1].p}));case 2:return n=a.sent,a.next=5,Promise.all(n.map(function(){var O=w(regeneratorRuntime.mark(function T(B){var E,L,Y,q,ae,Q,X,fe,le,D,Te,P,S,U;return regeneratorRuntime.wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(E=[],L=e.splice(0,1),Y=F(L,1),q=Y[0],ae=F(q,7),Q=ae[0],X=ae[2],fe=ae[3],le=ae[4],D=ae[5],Te=ae[6],P=ue(Q,B,X,fe,E,!0,Te),S=b(P,N),!(Q&&S)){x.next=11;break}return x.next=8,P.p;case 8:return U=x.sent,le[D]=U,x.abrupt("return",ge(t,E));case 11:return Q?le[D]=P:S?t=P.p:t=P,x.abrupt("return",ge(t,E));case 13:case"end":return x.stop()}},T)}));return function(T){return O.apply(this,arguments)}}()));case 5:return a.abrupt("return",t);case 6:case"end":return a.stop()}},I)})),oe.apply(this,arguments)}function ne(I,t,e){Object.assign(I,t);var n=Me.map(function(i){var a=I[i];return delete I[i],a});e(),Me.forEach(function(i,a){I[i]=n[a]})}function ue(I,t,e,n,i,a,O){var T,B={},E=s(t),L=Xe?function(S){var U=O||n.type||l.getJSONType(t);Xe(Object.assign(S||B,{keypath:I,value:t,cyclic:e,stateObj:n,promisesData:i,resolvingTypesonPromise:a,awaitingTypesonPromise:b(t,N)},{type:U}))}:null;if(["string","boolean","number","undefined"].includes(E))return t===void 0||E==="number"&&(isNaN(t)||t===-1/0||t===1/0)?(n.replaced?T=t:T=we(I,t,n,i,!1,a,L),T!==t&&(B={replaced:T})):T=t,L&&L(),T;if(t===null)return L&&L(),t;if(e&&!n.iterateIn&&!n.iterateUnsetNumeric&&t&&s(t)==="object"){var Y=Ae.indexOf(t);if(Y<0)e===!0&&(Ae.push(t),Ue.push(I));else return C[I]="#",L&&L({cyclicKeypath:Ue[Y]}),"#"+Ue[Y]}var q=f(t),ae=be(t),Q=(q||ae)&&(!W.plainObjectReplacers.length||n.replaced)||n.iterateIn?t:we(I,t,n,i,q||ae,null,L),X;if(Q!==t?(T=Q,B={replaced:Q}):I===""&&b(t,N)?(i.push([I,t,e,n,void 0,void 0,n.type]),T=t):ae&&n.iterateIn!=="object"||n.iterateIn==="array"?(X=new Array(t.length),B={clone:X}):!["function","symbol"].includes(s(t))&&!("toJSON"in t)&&!b(t,N)&&!b(t,Promise)&&!b(t,ArrayBuffer)||q||n.iterateIn==="object"?(X={},n.addLength&&(X.length=t.length),B={clone:X}):T=t,L&&L(),A.iterateNone)return X||T;if(!X)return T;if(n.iterateIn){var fe=function(U){var k={ownKeys:Ce.call(t,U)};ne(n,k,function(){var x=I+(I?".":"")+ie(U),z=ue(x,t[U],!!e,n,i,a);b(z,N)?i.push([x,z,!!e,n,X,U,n.type]):z!==void 0&&(X[U]=z)})};for(var le in t)fe(le);L&&L({endIterateIn:!0,end:!0})}else ce(t).forEach(function(S){var U=I+(I?".":"")+ie(S),k={ownKeys:!0};ne(n,k,function(){var x=ue(U,t[S],!!e,n,i,a);b(x,N)?i.push([U,x,!!e,n,X,S,n.type]):x!==void 0&&(X[S]=x)})}),L&&L({endIterateOwn:!0,end:!0});if(n.iterateUnsetNumeric){for(var D=t.length,Te=function(U){if(!(U in t)){var k=I+(I?".":"")+U,x={ownKeys:!1};ne(n,x,function(){var z=ue(k,void 0,!!e,n,i,a);b(z,N)?i.push([k,z,!!e,n,X,U,n.type]):z!==void 0&&(X[U]=z)})}},P=0;P<D;P++)Te(P);L&&L({endIterateUnsetNumeric:!0,end:!0})}return X}function we(I,t,e,n,i,a,O){for(var T=i?W.plainObjectReplacers:W.nonplainObjectReplacers,B=T.length;B--;){var E=T[B];if(E.test(t,e)){var L=E.type;if(W.revivers[L]){var Y=C[I];C[I]=Y?[L].concat(Y):L}if(Object.assign(e,{type:L,replaced:!0}),(H||!E.replaceAsync)&&!E.replace)return O&&O({typeDetected:!0}),ue(I,t,Ge&&"readonly",e,n,a,L);O&&O({replacing:!0});var q=H||!E.replaceAsync?"replace":"replaceAsync";return ue(I,E[q](t,e),Ge&&"readonly",e,n,a,L)}}return t}return xe.length?H&&A.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(ge(Fe,xe)).then(qe):!H&&A.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():A.stringification&&H?[qe(Fe)]:H?qe(Fe):Promise.resolve(qe(Fe))}},{key:"encapsulateSync",value:function(h,d,A){return this.encapsulate(h,d,_({throwOnBadSyncType:!0},A,{sync:!0}))}},{key:"encapsulateAsync",value:function(h,d,A){return this.encapsulate(h,d,_({throwOnBadSyncType:!0},A,{sync:!1}))}},{key:"revive",value:function(h,d){var A=h&&h.$types;if(!A)return h;if(A===!0)return h.$;d=_({sync:!0},this.options,{},d);var G=d,H=G.sync,W=[],C={},Ae=!0;A.$&&f(A.$)&&(h=h.$,A=A.$,Ae=!1);var Ue=this;function xe(oe,ne){var ue=Ue.revivers[oe]||[],we=F(ue,1),I=we[0];if(!I)throw new Error("Unregistered type: "+oe);return H&&!("revive"in I)?ne:I[H&&I.revive?"revive":!H&&I.reviveAsync?"reviveAsync":"revive"](ne,C)}function Ge(){var oe=[];if(Object.entries(A).forEach(function(ne){var ue=F(ne,2),we=ue[0],I=ue[1];I!=="#"&&[].concat(I).forEach(function(t){var e=Ue.revivers[t]||[null,{}],n=F(e,2),i=n[1].plain;i&&(oe.push({keypath:we,type:t}),delete A[we])})}),!!oe.length)return oe.sort($).reduce(function ne(ue,we){var I=we.keypath,t=we.type;if(c(ue))return ue.then(function(i){return ne(i,{keypath:I,type:t})});var e=Se(h,I);if(e=xe(t,e),b(e,N))return e.then(function(i){var a=Be(h,I,i);a===i&&(h=a)});var n=Be(h,I,e);n===e&&(h=n)},void 0)}var Ye=[];function Xe(oe,ne,ue,we,I){if(!(Ae&&oe==="$types")){var t=A[oe],e=be(ne);if(e||f(ne)){var n=e?new Array(ne.length):{};for(ce(ne).forEach(function(Y){var q=Xe(oe+(oe?".":"")+ie(Y),ne[Y],ue||n,n,Y),ae=function(X){return b(X,ke)?n[Y]=void 0:X!==void 0&&(n[Y]=X),X};b(q,N)?Ye.push(q.then(function(Q){return ae(Q)})):ae(q)}),ne=n;W.length;){var i=F(W[0],4),a=i[0],O=i[1],T=i[2],B=i[3],E=Se(a,O);if(E!==void 0)T[B]=E;else break;W.splice(0,1)}}if(!t)return ne;if(t==="#"){var L=Se(ue,ne.slice(1));return L===void 0&&W.push([ue,ne.slice(1),we,I]),L}return[].concat(t).reduce(function Y(q,ae){return b(q,N)?q.then(function(Q){return Y(Q,ae)}):xe(ae,q)},ne)}}function Fe(oe){return b(oe,ke)?void 0:oe}var qe=Ge(),ge;return b(qe,N)?ge=qe.then(function(){return h}):(ge=Xe("",h,null),Ye.length&&(ge=N.resolve(ge).then(function(oe){return N.all([oe].concat(Ye))}).then(function(oe){var ne=F(oe,1),ue=ne[0];return ue}))),c(ge)?H&&d.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():b(ge,N)?ge.p.then(Fe):ge:!H&&d.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():H?Fe(ge):Promise.resolve(Fe(ge))}},{key:"reviveSync",value:function(h,d){return this.revive(h,_({throwOnBadSyncType:!0},d,{sync:!0}))}},{key:"reviveAsync",value:function(h,d){return this.revive(h,_({throwOnBadSyncType:!0},d,{sync:!1}))}},{key:"register",value:function(h,d){return d=d||{},[].concat(h).forEach(function A(G){var H=this;if(be(G))return G.map(function(W){return A.call(H,W)});G&&ce(G).forEach(function(W){if(W==="#")throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(l.JSON_TYPES.includes(W))throw new TypeError("Plain JSON object types are reserved as type names");var C=G[W],Ae=C&&C.testPlainObjects?this.plainObjectReplacers:this.nonplainObjectReplacers,Ue=Ae.filter(function(ue){return ue.type===W});if(Ue.length&&(Ae.splice(Ae.indexOf(Ue[0]),1),delete this.revivers[W],delete this.types[W]),typeof C=="function"){var xe=C;C={test:function(we){return we&&we.constructor===xe},replace:function(we){return _({},we)},revive:function(we){return Object.assign(Object.create(xe.prototype),we)}}}else if(be(C)){var Ge=C,Ye=F(Ge,3),Xe=Ye[0],Fe=Ye[1],qe=Ye[2];C={test:Xe,replace:Fe,revive:qe}}if(!(!C||!C.test)){var ge={type:W,test:C.test.bind(C)};C.replace&&(ge.replace=C.replace.bind(C)),C.replaceAsync&&(ge.replaceAsync=C.replaceAsync.bind(C));var oe=typeof d.fallback=="number"?d.fallback:d.fallback?0:1/0;if(C.testPlainObjects?this.plainObjectReplacers.splice(oe,0,ge):this.nonplainObjectReplacers.splice(oe,0,ge),C.revive||C.reviveAsync){var ne={};C.revive&&(ne.revive=C.revive.bind(C)),C.reviveAsync&&(ne.reviveAsync=C.reviveAsync.bind(C)),this.revivers[W]=[ne,{plain:C.testPlainObjects}]}this.types[W]=C}},this)},this),this}}]),l}(),ke=function l(){p(this,l)};return ke.__typeson__type__="TypesonUndefined",ye.Undefined=ke,ye.Promise=N,ye.isThenable=c,ye.toStringTag=r,ye.hasConstructorOf=b,ye.isObject=M,ye.isPlainObject=f,ye.isUserObject=Z,ye.escapeKeyPathComponent=ie,ye.unescapeKeyPathComponent=he,ye.getByKeyPath=Se,ye.getJSONType=_e,ye.JSON_TYPES=["null","boolean","number","string","array","object"],ye})}),Pn=bn(function(g,v){(function(s,m){g.exports=m()})(hn,function(){function s(t){return(s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function m(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,i)}return n}function j(t){return function(n){if(Array.isArray(n))return R(n)}(t)||function(n){if(typeof Symbol<"u"&&Symbol.iterator in Object(n))return Array.from(n)}(t)||function(n,i){if(n){if(typeof n=="string")return R(n,i);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(n);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return R(n,i)}}(t)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function R(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function u(t){return(u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(t)}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function pe(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,i)}return n}function J(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ve(Object(n),!0).forEach(function(i){pe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ve(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function V(t,e){return function(i){if(Array.isArray(i))return i}(t)||function(i,a){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(i)))){var O=[],T=!0,B=!1,E=void 0;try{for(var L,Y=i[Symbol.iterator]();!(T=(L=Y.next()).done)&&(O.push(L.value),!a||O.length!==a);T=!0);}catch(q){B=!0,E=q}finally{try{T||Y.return==null||Y.return()}finally{if(B)throw E}}return O}}(t,e)||Ee(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ee(t){return function(n){if(Array.isArray(n))return me(n)}(t)||function(n){if(typeof Symbol<"u"&&Symbol.iterator in Object(n))return Array.from(n)}(t)||Ee(t)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ee(t,e){if(t){if(typeof t=="string")return me(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?me(t,e):void 0}}function me(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var N=function t(e){_(this,t),this.p=new Promise(e)};N.__typeson__type__="TypesonPromise",typeof Symbol<"u"&&(N.prototype[Symbol.toStringTag]="TypesonPromise"),N.prototype.then=function(t,e){var n=this;return new N(function(i,a){n.p.then(function(O){i(t?t(O):O)}).catch(function(O){return e?e(O):Promise.reject(O)}).then(i,a)})},N.prototype.catch=function(t){return this.then(null,t)},N.resolve=function(t){return new N(function(e){e(t)})},N.reject=function(t){return new N(function(e,n){n(t)})},["all","race"].forEach(function(t){N[t]=function(e){return new N(function(n,i){Promise[t](e.map(function(a){return a&&a.constructor&&a.constructor.__typeson__type__==="TypesonPromise"?a.p:a})).then(n,i)})}});var Ne={}.toString,K={}.hasOwnProperty,te=Object.getPrototypeOf,re=K.toString;function Pe(t,e){return f(t)&&typeof t.then=="function"&&(!e||typeof t.catch=="function")}function c(t){return Ne.call(t).slice(8,-1)}function r(t,e){if(!t||u(t)!=="object")return!1;var n=te(t);if(!n)return e===null;var i=K.call(n,"constructor")&&n.constructor;return typeof i!="function"?e===null:e===i||e!==null&&re.call(i)===re.call(e)||typeof e=="function"&&typeof i.__typeson__type__=="string"&&i.__typeson__type__===e.__typeson__type__}function b(t){return!(!t||c(t)!=="Object")&&(!te(t)||r(t,Object))}function f(t){return t&&u(t)==="object"}function Z(t){return t.replace(/~/g,"~0").replace(/\./g,"~1")}function M(t){return t.replace(/~1/g,".").replace(/~0/g,"~")}function ie(t,e){if(e==="")return t;var n=e.indexOf(".");if(n>-1){var i=t[M(e.slice(0,n))];return i===void 0?void 0:ie(i,e.slice(n+1))}return t[M(e)]}function he(t,e,n){if(e==="")return n;var i=e.indexOf(".");return i>-1?he(t[M(e.slice(0,i))],e.slice(i+1),n):(t[M(e)]=n,t)}function Se(t,e,n){return t&&t.then||(t=Promise.resolve(t)),e?t.then(e):t}var Be=Object.keys,_e=Array.isArray,ce={}.hasOwnProperty,be=["type","replaced","iterateIn","iterateUnsetNumeric"];function Ce(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return Promise.resolve(t.apply(this,e))}catch(i){return Promise.reject(i)}}}function Me(t,e){if(t.keypath==="")return-1;var n=t.keypath.match(/\./g)||0,i=e.keypath.match(/\./g)||0;return n&&(n=n.length),i&&(i=i.length),n>i?-1:n<i?1:t.keypath<e.keypath?-1:t.keypath>e.keypath}var $=function(){function t(e){_(this,t),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return function(n,i,a){return F(n.prototype,i),n}(t,[{key:"stringify",value:function(n,i,a,O){O=J(J(J({},this.options),O),{},{stringification:!0});var T=this.encapsulate(n,null,O);return _e(T)?JSON.stringify(T[0],i,a):T.then(function(B){return JSON.stringify(B,i,a)})}},{key:"stringifySync",value:function(n,i,a,O){return this.stringify(n,i,a,J(J({throwOnBadSyncType:!0},O),{},{sync:!0}))}},{key:"stringifyAsync",value:function(n,i,a,O){return this.stringify(n,i,a,J(J({throwOnBadSyncType:!0},O),{},{sync:!1}))}},{key:"parse",value:function(n,i,a){return a=J(J(J({},this.options),a),{},{parse:!0}),this.revive(JSON.parse(n,i),a)}},{key:"parseSync",value:function(n,i,a){return this.parse(n,i,J(J({throwOnBadSyncType:!0},a),{},{sync:!0}))}},{key:"parseAsync",value:function(n,i,a){return this.parse(n,i,J(J({throwOnBadSyncType:!0},a),{},{sync:!1}))}},{key:"specialTypeNames",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return a.returnTypeNames=!0,this.encapsulate(n,i,a)}},{key:"rootTypeName",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return a.iterateNone=!0,this.encapsulate(n,i,a)}},{key:"encapsulate",value:function(n,i,a){var O=Ce(function(P,S){return Se(Promise.all(S.map(function(U){return U[1].p})),function(U){return Se(Promise.all(U.map(Ce(function(k){var x=!1,z=[],Ke=V(S.splice(0,1),1),Oe=V(Ke[0],7),Le=Oe[0],De=Oe[2],se=Oe[3],Ve=Oe[4],de=Oe[5],$e=Oe[6],je=D(Le,k,De,se,z,!0,$e),ze=r(je,N);return function(yn,on){var tn=yn();return tn&&tn.then?tn.then(on):on(tn)}(function(){if(Le&&ze)return Se(je.p,function(He){return Ve[de]=He,x=!0,O(P,z)})},function(He){return x?He:(Le?Ve[de]=je:P=ze?je.p:je,O(P,z))})}))),function(){return P})})}),T=(a=J(J({sync:!0},this.options),a)).sync,B=this,E={},L=[],Y=[],q=[],ae=!("cyclic"in a)||a.cyclic,Q=a.encapsulateObserver,X=D("",n,ae,i||{},q);function fe(P){var S=Object.values(E);if(a.iterateNone)return S.length?S[0]:t.getJSONType(P);if(S.length){if(a.returnTypeNames)return ee(new Set(S));P&&b(P)&&!ce.call(P,"$types")?P.$types=E:P={$:P,$types:{$:E}}}else f(P)&&ce.call(P,"$types")&&(P={$:P,$types:!0});return!a.returnTypeNames&&P}function le(P,S,U){Object.assign(P,S);var k=be.map(function(x){var z=P[x];return delete P[x],z});U(),be.forEach(function(x,z){P[x]=k[z]})}function D(P,S,U,k,x,z,Ke){var Oe,Le={},De=u(S),se=Q?function(Ze){var Ie=Ke||k.type||t.getJSONType(S);Q(Object.assign(Ze||Le,{keypath:P,value:S,cyclic:U,stateObj:k,promisesData:x,resolvingTypesonPromise:z,awaitingTypesonPromise:r(S,N)},{type:Ie}))}:null;if(["string","boolean","number","undefined"].includes(De))return S===void 0||Number.isNaN(S)||S===Number.NEGATIVE_INFINITY||S===Number.POSITIVE_INFINITY?(Oe=k.replaced?S:Te(P,S,k,x,!1,z,se))!==S&&(Le={replaced:Oe}):Oe=S,se&&se(),Oe;if(S===null)return se&&se(),S;if(U&&!k.iterateIn&&!k.iterateUnsetNumeric&&S&&u(S)==="object"){var Ve=L.indexOf(S);if(!(Ve<0))return E[P]="#",se&&se({cyclicKeypath:Y[Ve]}),"#"+Y[Ve];U===!0&&(L.push(S),Y.push(P))}var de,$e=b(S),je=_e(S),ze=($e||je)&&(!B.plainObjectReplacers.length||k.replaced)||k.iterateIn?S:Te(P,S,k,x,$e||je,null,se);if(ze!==S?(Oe=ze,Le={replaced:ze}):P===""&&r(S,N)?(x.push([P,S,U,k,void 0,void 0,k.type]),Oe=S):je&&k.iterateIn!=="object"||k.iterateIn==="array"?(de=new Array(S.length),Le={clone:de}):(["function","symbol"].includes(u(S))||"toJSON"in S||r(S,N)||r(S,Promise)||r(S,ArrayBuffer))&&!$e&&k.iterateIn!=="object"?Oe=S:(de={},k.addLength&&(de.length=S.length),Le={clone:de}),se&&se(),a.iterateNone)return de||Oe;if(!de)return Oe;if(k.iterateIn){var He=function(Ie){var Qe={ownKeys:ce.call(S,Ie)};le(k,Qe,function(){var nn=P+(P?".":"")+Z(Ie),un=D(nn,S[Ie],!!U,k,x,z);r(un,N)?x.push([nn,un,!!U,k,de,Ie,k.type]):un!==void 0&&(de[Ie]=un)})};for(var yn in S)He(yn);se&&se({endIterateIn:!0,end:!0})}else Be(S).forEach(function(Ze){var Ie=P+(P?".":"")+Z(Ze);le(k,{ownKeys:!0},function(){var Qe=D(Ie,S[Ze],!!U,k,x,z);r(Qe,N)?x.push([Ie,Qe,!!U,k,de,Ze,k.type]):Qe!==void 0&&(de[Ze]=Qe)})}),se&&se({endIterateOwn:!0,end:!0});if(k.iterateUnsetNumeric){for(var on=S.length,tn=function(Ie){if(!(Ie in S)){var Qe=P+(P?".":"")+Ie;le(k,{ownKeys:!1},function(){var nn=D(Qe,void 0,!!U,k,x,z);r(nn,N)?x.push([Qe,nn,!!U,k,de,Ie,k.type]):nn!==void 0&&(de[Ie]=nn)})}},dn=0;dn<on;dn++)tn(dn);se&&se({endIterateUnsetNumeric:!0,end:!0})}return de}function Te(P,S,U,k,x,z,Ke){for(var Oe=x?B.plainObjectReplacers:B.nonplainObjectReplacers,Le=Oe.length;Le--;){var De=Oe[Le];if(De.test(S,U)){var se=De.type;if(B.revivers[se]){var Ve=E[P];E[P]=Ve?[se].concat(Ve):se}return Object.assign(U,{type:se,replaced:!0}),!T&&De.replaceAsync||De.replace?(Ke&&Ke({replacing:!0}),D(P,De[T||!De.replaceAsync?"replace":"replaceAsync"](S,U),ae&&"readonly",U,k,z,se)):(Ke&&Ke({typeDetected:!0}),D(P,S,ae&&"readonly",U,k,z,se))}}return S}return q.length?T&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(O(X,q)).then(fe):!T&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():a.stringification&&T?[fe(X)]:T?fe(X):Promise.resolve(fe(X))}},{key:"encapsulateSync",value:function(n,i,a){return this.encapsulate(n,i,J(J({throwOnBadSyncType:!0},a),{},{sync:!0}))}},{key:"encapsulateAsync",value:function(n,i,a){return this.encapsulate(n,i,J(J({throwOnBadSyncType:!0},a),{},{sync:!1}))}},{key:"revive",value:function(n,i){var a=n&&n.$types;if(!a)return n;if(a===!0)return n.$;var O=(i=J(J({sync:!0},this.options),i)).sync,T=[],B={},E=!0;a.$&&b(a.$)&&(n=n.$,a=a.$,E=!1);var L=this;function Y(fe,le){var D=V(L.revivers[fe]||[],1)[0];if(!D)throw new Error("Unregistered type: "+fe);return O&&!("revive"in D)?le:D[O&&D.revive?"revive":!O&&D.reviveAsync?"reviveAsync":"revive"](le,B)}var q=[];function ae(fe){return r(fe,ye)?void 0:fe}var Q,X=function(){var le=[];if(Object.entries(a).forEach(function(D){var Te=V(D,2),P=Te[0],S=Te[1];S!=="#"&&[].concat(S).forEach(function(U){V(L.revivers[U]||[null,{}],2)[1].plain&&(le.push({keypath:P,type:U}),delete a[P])})}),le.length)return le.sort(Me).reduce(function D(Te,P){var S=P.keypath,U=P.type;if(Pe(Te))return Te.then(function(z){return D(z,{keypath:S,type:U})});var k=ie(n,S);if(r(k=Y(U,k),N))return k.then(function(z){var Ke=he(n,S,z);Ke===z&&(n=Ke)});var x=he(n,S,k);x===k&&(n=x)},void 0)}();return r(X,N)?Q=X.then(function(){return n}):(Q=function fe(le,D,Te,P,S){if(!E||le!=="$types"){var U=a[le],k=_e(D);if(k||b(D)){var x=k?new Array(D.length):{};for(Be(D).forEach(function(de){var $e=fe(le+(le?".":"")+Z(de),D[de],Te||x,x,de),je=function(He){return r(He,ye)?x[de]=void 0:He!==void 0&&(x[de]=He),He};r($e,N)?q.push($e.then(function(ze){return je(ze)})):je($e)}),D=x;T.length;){var z=V(T[0],4),Ke=z[0],Oe=z[1],Le=z[2],De=z[3],se=ie(Ke,Oe);if(se===void 0)break;Le[De]=se,T.splice(0,1)}}if(!U)return D;if(U==="#"){var Ve=ie(Te,D.slice(1));return Ve===void 0&&T.push([Te,D.slice(1),P,S]),Ve}return[].concat(U).reduce(function de($e,je){return r($e,N)?$e.then(function(ze){return de(ze,je)}):Y(je,$e)},D)}}("",n,null),q.length&&(Q=N.resolve(Q).then(function(fe){return N.all([fe].concat(q))}).then(function(fe){return V(fe,1)[0]}))),Pe(Q)?O&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():r(Q,N)?Q.p.then(ae):Q:!O&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():O?ae(Q):Promise.resolve(ae(Q))}},{key:"reviveSync",value:function(n,i){return this.revive(n,J(J({throwOnBadSyncType:!0},i),{},{sync:!0}))}},{key:"reviveAsync",value:function(n,i){return this.revive(n,J(J({throwOnBadSyncType:!0},i),{},{sync:!1}))}},{key:"register",value:function(n,i){return i=i||{},[].concat(n).forEach(function a(O){var T=this;if(_e(O))return O.map(function(B){return a.call(T,B)});O&&Be(O).forEach(function(B){if(B==="#")throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(t.JSON_TYPES.includes(B))throw new TypeError("Plain JSON object types are reserved as type names");var E=O[B],L=E&&E.testPlainObjects?this.plainObjectReplacers:this.nonplainObjectReplacers,Y=L.filter(function(le){return le.type===B});if(Y.length&&(L.splice(L.indexOf(Y[0]),1),delete this.revivers[B],delete this.types[B]),typeof E=="function"){var q=E;E={test:function(D){return D&&D.constructor===q},replace:function(D){return J({},D)},revive:function(D){return Object.assign(Object.create(q.prototype),D)}}}else if(_e(E)){var ae=V(E,3);E={test:ae[0],replace:ae[1],revive:ae[2]}}if(E&&E.test){var Q={type:B,test:E.test.bind(E)};E.replace&&(Q.replace=E.replace.bind(E)),E.replaceAsync&&(Q.replaceAsync=E.replaceAsync.bind(E));var X=typeof i.fallback=="number"?i.fallback:i.fallback?0:Number.POSITIVE_INFINITY;if(E.testPlainObjects?this.plainObjectReplacers.splice(X,0,Q):this.nonplainObjectReplacers.splice(X,0,Q),E.revive||E.reviveAsync){var fe={};E.revive&&(fe.revive=E.revive.bind(E)),E.reviveAsync&&(fe.reviveAsync=E.reviveAsync.bind(E)),this.revivers[B]=[fe,{plain:E.testPlainObjects}]}this.types[B]=E}},this)},this),this}}]),t}(),ye=function t(){_(this,t)};ye.__typeson__type__="TypesonUndefined",$.Undefined=ye,$.Promise=N,$.isThenable=Pe,$.toStringTag=c,$.hasConstructorOf=r,$.isObject=f,$.isPlainObject=b,$.isUserObject=function t(e){if(!e||c(e)!=="Object")return!1;var n=te(e);return!n||r(e,Object)||t(n)},$.escapeKeyPathComponent=Z,$.unescapeKeyPathComponent=M,$.getByKeyPath=ie,$.getJSONType=function(e){return e===null?"null":Array.isArray(e)?"array":u(e)},$.JSON_TYPES=["null","boolean","number","string","array","object"];for(var ke={userObject:{test:function(e,n){return $.isUserObject(e)},replace:function(e){return function(i){for(var a=1;a<arguments.length;a++){var O=arguments[a]!=null?arguments[a]:{};a%2?o(Object(O),!0).forEach(function(T){p(i,T,O[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(O)):o(Object(O)).forEach(function(T){Object.defineProperty(i,T,Object.getOwnPropertyDescriptor(O,T))})}return i}({},e)},revive:function(e){return e}}},l=[{arrayNonindexKeys:{testPlainObjects:!0,test:function(e,n){return!!Array.isArray(e)&&(Object.keys(e).some(function(i){return String(Number.parseInt(i))!==i})&&(n.iterateIn="object",n.addLength=!0),!0)},replace:function(e,n){return n.iterateUnsetNumeric=!0,e},revive:function(e){if(Array.isArray(e))return e;var n=[];return Object.keys(e).forEach(function(i){var a=e[i];n[i]=a}),n}}},{sparseUndefined:{test:function(e,n){return e===void 0&&n.ownKeys===!1},replace:function(e){return 0},revive:function(e){}}}],y={undef:{test:function(e,n){return e===void 0&&(n.ownKeys||!("ownKeys"in n))},replace:function(e){return 0},revive:function(e){return new $.Undefined}}},h={StringObject:{test:function(e){return $.toStringTag(e)==="String"&&s(e)==="object"},replace:function(e){return String(e)},revive:function(e){return new String(e)}},BooleanObject:{test:function(e){return $.toStringTag(e)==="Boolean"&&s(e)==="object"},replace:function(e){return!!e},revive:function(e){return new Boolean(e)}},NumberObject:{test:function(e){return $.toStringTag(e)==="Number"&&s(e)==="object"},replace:function(e){return Number(e)},revive:function(e){return new Number(e)}}},d=[{nan:{test:function(e){return Number.isNaN(e)},replace:function(e){return"NaN"},revive:function(e){return Number.NaN}}},{infinity:{test:function(e){return e===Number.POSITIVE_INFINITY},replace:function(e){return"Infinity"},revive:function(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function(e){return e===Number.NEGATIVE_INFINITY},replace:function(e){return"-Infinity"},revive:function(e){return Number.NEGATIVE_INFINITY}}}],A={date:{test:function(e){return $.toStringTag(e)==="Date"},replace:function(e){var n=e.getTime();return Number.isNaN(n)?"NaN":n},revive:function(e){return e==="NaN"?new Date(Number.NaN):new Date(e)}}},G={regexp:{test:function(e){return $.toStringTag(e)==="RegExp"},replace:function(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function(e){var n=e.source,i=e.flags;return new RegExp(n,i)}}},H={map:{test:function(e){return $.toStringTag(e)==="Map"},replace:function(e){return j(e.entries())},revive:function(e){return new Map(e)}}},W={set:{test:function(e){return $.toStringTag(e)==="Set"},replace:function(e){return j(e.values())},revive:function(e){return new Set(e)}}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ae=new Uint8Array(256),Ue=0;Ue<C.length;Ue++)Ae[C.charCodeAt(Ue)]=Ue;var xe=function(e,n,i){i==null&&(i=e.byteLength);for(var a=new Uint8Array(e,0,i),O=a.length,T="",B=0;B<O;B+=3)T+=C[a[B]>>2],T+=C[(3&a[B])<<4|a[B+1]>>4],T+=C[(15&a[B+1])<<2|a[B+2]>>6],T+=C[63&a[B+2]];return O%3==2?T=T.slice(0,-1)+"=":O%3==1&&(T=T.slice(0,-2)+"=="),T},Ge=function(e){var n,i,a,O,T=e.length,B=.75*e.length,E=0;e[e.length-1]==="="&&(B--,e[e.length-2]==="="&&B--);for(var L=new ArrayBuffer(B),Y=new Uint8Array(L),q=0;q<T;q+=4)n=Ae[e.charCodeAt(q)],i=Ae[e.charCodeAt(q+1)],a=Ae[e.charCodeAt(q+2)],O=Ae[e.charCodeAt(q+3)],Y[E++]=n<<2|i>>4,Y[E++]=(15&i)<<4|a>>2,Y[E++]=(3&a)<<6|63&O;return L},Ye={arraybuffer:{test:function(e){return $.toStringTag(e)==="ArrayBuffer"},replace:function(e,n){n.buffers||(n.buffers=[]);var i=n.buffers.indexOf(e);return i>-1?{index:i}:(n.buffers.push(e),xe(e))},revive:function(e,n){if(n.buffers||(n.buffers=[]),s(e)==="object")return n.buffers[e.index];var i=Ge(e);return n.buffers.push(i),i}}},Xe=typeof self>"u"?hn:self,Fe={};["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"].forEach(function(t){var e=t,n=Xe[e];n&&(Fe[t.toLowerCase()]={test:function(a){return $.toStringTag(a)===e},replace:function(a,O){var T=a.buffer,B=a.byteOffset,E=a.length;O.buffers||(O.buffers=[]);var L=O.buffers.indexOf(T);return L>-1?{index:L,byteOffset:B,length:E}:(O.buffers.push(T),{encoded:xe(T),byteOffset:B,length:E})},revive:function(a,O){O.buffers||(O.buffers=[]);var T,B=a.byteOffset,E=a.length,L=a.encoded,Y=a.index;return"index"in a?T=O.buffers[Y]:(T=Ge(L),O.buffers.push(T)),new n(T,B,E)}})});var qe={dataview:{test:function(e){return $.toStringTag(e)==="DataView"},replace:function(e,n){var i=e.buffer,a=e.byteOffset,O=e.byteLength;n.buffers||(n.buffers=[]);var T=n.buffers.indexOf(i);return T>-1?{index:T,byteOffset:a,byteLength:O}:(n.buffers.push(i),{encoded:xe(i),byteOffset:a,byteLength:O})},revive:function(e,n){n.buffers||(n.buffers=[]);var i,a=e.byteOffset,O=e.byteLength,T=e.encoded,B=e.index;return"index"in e?i=n.buffers[B]:(i=Ge(T),n.buffers.push(i)),new DataView(i,a,O)}}},ge={IntlCollator:{test:function(e){return $.hasConstructorOf(e,Intl.Collator)},replace:function(e){return e.resolvedOptions()},revive:function(e){return new Intl.Collator(e.locale,e)}},IntlDateTimeFormat:{test:function(e){return $.hasConstructorOf(e,Intl.DateTimeFormat)},replace:function(e){return e.resolvedOptions()},revive:function(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function(e){return $.hasConstructorOf(e,Intl.NumberFormat)},replace:function(e){return e.resolvedOptions()},revive:function(e){return new Intl.NumberFormat(e.locale,e)}}};function oe(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e.buffer}var ne={file:{test:function(e){return $.toStringTag(e)==="File"},replace:function(e){var n=new XMLHttpRequest;if(n.overrideMimeType("text/plain; charset=x-user-defined"),n.open("GET",URL.createObjectURL(e),!1),n.send(),n.status!==200&&n.status!==0)throw new Error("Bad File access: "+n.status);return{type:e.type,stringContents:n.responseText,name:e.name,lastModified:e.lastModified}},revive:function(e){var n=e.name,i=e.type,a=e.stringContents,O=e.lastModified;return new File([oe(a)],n,{type:i,lastModified:O})},replaceAsync:function(e){return new $.Promise(function(n,i){var a=new FileReader;a.addEventListener("load",function(){n({type:e.type,stringContents:a.result,name:e.name,lastModified:e.lastModified})}),a.addEventListener("error",function(){i(a.error)}),a.readAsBinaryString(e)})}}},ue={bigint:{test:function(e){return typeof e=="bigint"},replace:function(e){return String(e)},revive:function(e){return BigInt(e)}}},we={bigintObject:{test:function(e){return s(e)==="object"&&$.hasConstructorOf(e,BigInt)},replace:function(e){return String(e)},revive:function(e){return new Object(BigInt(e))}}},I={cryptokey:{test:function(e){return $.toStringTag(e)==="CryptoKey"&&e.extractable},replaceAsync:function(e){return new $.Promise(function(n,i){crypto.subtle.exportKey("jwk",e).catch(function(a){i(a)}).then(function(a){n({jwk:a,algorithm:e.algorithm,usages:e.usages})})})},revive:function(e){var n=e.jwk,i=e.algorithm,a=e.usages;return crypto.subtle.importKey("jwk",n,i,!0,a)}}};return[ke,y,l,h,d,A,G,{imagedata:{test:function(e){return $.toStringTag(e)==="ImageData"},replace:function(e){return{array:j(e.data),width:e.width,height:e.height}},revive:function(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},{imagebitmap:{test:function(e){return $.toStringTag(e)==="ImageBitmap"||e&&e.dataset&&e.dataset.toStringTag==="ImageBitmap"},replace:function(e){var n=document.createElement("canvas");return n.getContext("2d").drawImage(e,0,0),n.toDataURL()},revive:function(e){var n=document.createElement("canvas"),i=n.getContext("2d"),a=document.createElement("img");return a.addEventListener("load",function(){i.drawImage(a,0,0)}),a.src=e,n},reviveAsync:function(e){var n=document.createElement("canvas"),i=n.getContext("2d"),a=document.createElement("img");return a.addEventListener("load",function(){i.drawImage(a,0,0)}),a.src=e,createImageBitmap(n)}}},ne,{file:ne.file,filelist:{test:function(e){return $.toStringTag(e)==="FileList"},replace:function(e){for(var n=[],i=0;i<e.length;i++)n[i]=e.item(i);return n},revive:function(e){return new(function(){function n(){m(this,n),this._files=arguments[0],this.length=this._files.length}return function(a,O,T){return w(a.prototype,O),a}(n,[{key:"item",value:function(a){return this._files[a]}},{key:Symbol.toStringTag,get:function(){return"FileList"}}]),n}())(e)}}},{blob:{test:function(e){return $.toStringTag(e)==="Blob"},replace:function(e){var n=new XMLHttpRequest;if(n.overrideMimeType("text/plain; charset=x-user-defined"),n.open("GET",URL.createObjectURL(e),!1),n.send(),n.status!==200&&n.status!==0)throw new Error("Bad Blob access: "+n.status);return{type:e.type,stringContents:n.responseText}},revive:function(e){var n=e.type,i=e.stringContents;return new Blob([oe(i)],{type:n})},replaceAsync:function(e){return new $.Promise(function(n,i){var a=new FileReader;a.addEventListener("load",function(){n({type:e.type,stringContents:a.result})}),a.addEventListener("error",function(){i(a.error)}),a.readAsBinaryString(e)})}}}].concat(typeof Map=="function"?H:[],typeof Set=="function"?W:[],typeof ArrayBuffer=="function"?Ye:[],typeof Uint8Array=="function"?Fe:[],typeof DataView=="function"?qe:[],typeof Intl<"u"?ge:[],typeof crypto<"u"?I:[],typeof BigInt<"u"?[ue,we]:[])})}),rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",an=new Uint8Array(256);for(var sn=0;sn<rn.length;sn++)an[rn.codePointAt(sn)]=sn;var vn=function(v,s,m){m==null&&(m=v.byteLength);for(var w=new Uint8Array(v,0,m),p=w.length,o="",j=0;j<p;j+=3)o+=rn[w[j]>>2],o+=rn[(w[j]&3)<<4|w[j+1]>>4],o+=rn[(w[j+1]&15)<<2|w[j+2]>>6],o+=rn[w[j+2]&63];return p%3===2?o=o.slice(0,-1)+"=":p%3===1&&(o=o.slice(0,-2)+"=="),o},On=function(v){var s=v.length,m=v.length*.75,w=0,p,o,j,R;v[v.length-1]==="="&&(m--,v[v.length-2]==="="&&m--);for(var u=new ArrayBuffer(m),_=new Uint8Array(u),F=0;F<s;F+=4)p=an[v.codePointAt(F)],o=an[v.codePointAt(F+1)],j=an[v.codePointAt(F+2)],R=an[v.codePointAt(F+3)],_[w++]=p<<2|o>>4,_[w++]=(o&15)<<4|j>>2,_[w++]=(j&3)<<6|R&63;return u},jn=typeof self>"u"?global:self,Sn={};["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"].forEach(function(g){var v=g,s=jn[v];s&&(Sn[g.toLowerCase()+"2"]={test:function(m){return pn.toStringTag(m)===v},replace:function(m){var w=m.buffer,p=m.byteOffset,o=m.length;return{buffer:w,byteOffset:p,length:o}},revive:function(m){var w=m.buffer,p=m.byteOffset,o=m.length;return new s(w,p,o)}})});var In={arraybuffer:{test:function(g){return pn.toStringTag(g)==="ArrayBuffer"},replace:function(g){return vn(g,0,g.byteLength)},revive:function(g){var v=On(g);return v}}},Je=new pn().register(Pn),Bn="FileReaderSync"in self,ln=[],cn=0;Je.register([In,Sn,{blob2:{test:function(g){return pn.toStringTag(g)==="Blob"},replace:function(g){if(g.isClosed)throw new Error("The Blob is closed");if(Bn){var v=wn(g,"binary"),s=vn(v,0,v.byteLength);return{type:g.type,data:s}}else{ln.push(g);var m={type:g.type,data:{start:cn,end:cn+g.size}};return cn+=g.size,m}},finalize:function(g,v){g.data=vn(v,0,v.byteLength)},revive:function(g){var v=g.type,s=g.data;return new Blob([On(s)],{type:v})}}}]);Je.mustFinalize=function(){return ln.length>0};Je.finalize=function(g){return en(void 0,void 0,void 0,function(){var v,s,m,w,p,o,j,R,u,_,F,pe;return We(this,function(ve){switch(ve.label){case 0:return[4,gn(new Blob(ln),"binary")];case 1:if(v=ve.sent(),g){for(s=0,m=g;s<m.length;s++)if(w=m[s],w.$types){p=w.$types,o=p.$,o&&(p=p.$);for(j in p)R=p[j],u=Je.types[R],u&&u.finalize&&(_=Re.getByKeyPath(w,o?"$."+j:j),u.finalize(_,v.slice((F=_.data)===null||F===void 0?void 0:F.start,(pe=_.data)===null||pe===void 0?void 0:pe.end)))}}return ln=[],cn=0,[2]}})})};var Cn=2e3;function kn(g,v){return en(this,void 0,void 0,function(){function s(){return en(this,void 0,void 0,function(){var F,pe,ve,J,V,ee,Ee,me,N,Ne;return We(this,function(K){switch(K.label){case 0:return[4,Promise.all(w.map(function(te){return te.count()}))];case 1:F=K.sent(),F.forEach(function(te,re){return o[re].rowCount=te}),_.totalRows=F.reduce(function(te,re){return te+re}),pe=JSON.stringify(R,void 0,j?2:void 0),ve=pe.lastIndexOf("]"),J=pe.substring(0,ve),p.push(J),V=v.filter,ee=v.transform,Ee=function(te){var re,Pe,c,r,b,f,Z,M,ie,he,Se,Be;return We(this,function(_e){switch(_e.label){case 0:re=g.table(te),Pe=re.schema.primKey,c=!!Pe.keyPath,r=v.numRowsPerChunk||Cn,b=c?{tableName:re.name,inbound:!0,rows:[]}:{tableName:re.name,inbound:!1,rows:[]},f=JSON.stringify(b,void 0,j?2:void 0),j&&(f=f.split(`
|
|
`).join(`
|
|
`)),Z=f.lastIndexOf("]"),p.push(f.substring(0,Z)),M=null,ie=0,he=!0,Se=function(){var ce,be,Ce,Me,$,y,ye,ke,l,y;return We(this,function(h){switch(h.label){case 0:return u&&Re.ignoreTransaction(function(){return u(_)}),ce=M==null?re.limit(r):re.where(":id").above(M).limit(r),[4,ce.toArray()];case 1:return be=h.sent(),be.length===0?[2,"break"]:(M!=null&&ie>0&&(p.push(","),j&&p.push(`
|
|
`)),he=be.length===r,c?(Ce=V?be.filter(function(d){return V(te,d)}):be,Me=ee?Ce.map(function(d){return ee(te,d).value}):Ce,$=Me.map(function(d){return Je.encapsulate(d)}),Je.mustFinalize()?[4,Re.waitFor(Je.finalize($))]:[3,3]):[3,4]);case 2:h.sent(),h.label=3;case 3:return y=JSON.stringify($,void 0,j?2:void 0),j&&(y=y.split(`
|
|
`).join(`
|
|
`)),p.push(new Blob([y.substring(1,y.length-1)])),ie=Me.length,M=be.length>0?Re.getByKeyPath(be[be.length-1],Pe.keyPath):null,[3,8];case 4:return[4,ce.primaryKeys()];case 5:return ye=h.sent(),ke=ye.map(function(d,A){return[d,be[A]]}),V&&(ke=ke.filter(function(d){var A=d[0],G=d[1];return V(te,G,A)})),ee&&(ke=ke.map(function(d){var A=d[0],G=d[1],H=ee(te,G,A);return[H.key,H.value]})),l=ke.map(function(d){return Je.encapsulate(d)}),Je.mustFinalize()?[4,Re.waitFor(Je.finalize(l))]:[3,7];case 6:h.sent(),h.label=7;case 7:y=JSON.stringify(l,void 0,j?2:void 0),j&&(y=y.split(`
|
|
`).join(`
|
|
`)),p.push(new Blob([y.substring(1,y.length-1)])),ie=ke.length,M=ye.length>0?ye[ye.length-1]:null,h.label=8;case 8:return _.completedRows+=be.length,[2]}})},_e.label=1;case 1:return he?[5,Se()]:[3,3];case 2:return Be=_e.sent(),Be==="break"?[3,3]:[3,1];case 3:return p.push(f.substr(Z)),_.completedTables+=1,_.completedTables<_.totalTables&&p.push(","),[2]}})},me=0,N=o,K.label=2;case 2:return me<N.length?(Ne=N[me].name,[5,Ee(Ne)]):[3,5];case 3:K.sent(),K.label=4;case 4:return me++,[3,2];case 5:return p.push(pe.substr(ve)),_.done=!0,u&&Re.ignoreTransaction(function(){return u(_)}),[2]}})})}var m,w,p,o,j,R,u,_;return We(this,function(F){switch(F.label){case 0:v=v||{},m=v.skipTables?v.skipTables:[],w=g.tables.filter(function(pe){return!m.includes(pe.name)}),p=[],o=w.map(function(pe){return{name:pe.name,schema:_n(pe),rowCount:0}}),j=v.prettyJson,R={formatName:"dexie",formatVersion:1,data:{databaseName:g.name,databaseVersion:g.verno,tables:o,data:[]}},u=v.progressCallback,_={done:!1,completedRows:0,completedTables:0,totalRows:NaN,totalTables:o.length},F.label=1;case 1:return F.trys.push([1,,6,7]),v.noTransaction?[4,s()]:[3,3];case 2:return F.sent(),[3,5];case 3:return[4,g.transaction("r",g.tables,s)];case 4:F.sent(),F.label=5;case 5:return[3,7];case 6:return Je.finalize(),[7];case 7:return[2,new Blob(p,{type:"text/json"})]}})})}var Un=1,Ln={Stream:function(){}},Rn=bn(function(g,v){(function(s){var m=typeof process=="object"&&mn?mn:self;s.parser=function(c){return new ve(c)},s.CParser=ve,s.CStream=V,s.createStream=J,s.MAX_BUFFER_LENGTH=10*1024*1024,s.DEBUG=m.CDEBUG==="debug",s.INFO=m.CDEBUG==="debug"||m.CDEBUG==="info",s.EVENTS=["value","string","key","openobject","closeobject","openarray","closearray","error","end","ready"];var w={textNode:void 0,numberNode:""},p=s.EVENTS.filter(function(c){return c!=="error"&&c!=="end"}),o=0,j;s.STATE={BEGIN:o++,VALUE:o++,OPEN_OBJECT:o++,CLOSE_OBJECT:o++,OPEN_ARRAY:o++,CLOSE_ARRAY:o++,TEXT_ESCAPE:o++,STRING:o++,BACKSLASH:o++,END:o++,OPEN_KEY:o++,CLOSE_KEY:o++,TRUE:o++,TRUE2:o++,TRUE3:o++,FALSE:o++,FALSE2:o++,FALSE3:o++,FALSE4:o++,NULL:o++,NULL2:o++,NULL3:o++,NUMBER_DECIMAL_POINT:o++,NUMBER_DIGIT:o++};for(var R in s.STATE)s.STATE[s.STATE[R]]=R;o=s.STATE;const u={tab:9,lineFeed:10,carriageReturn:13,space:32,doubleQuote:34,plus:43,comma:44,minus:45,period:46,_0:48,_9:57,colon:58,E:69,openBracket:91,backslash:92,closeBracket:93,a:97,b:98,e:101,f:102,l:108,n:110,r:114,s:115,t:116,u:117,openBrace:123,closeBrace:125};Object.create||(Object.create=function(c){function r(){this.__proto__=c}return r.prototype=c,new r}),Object.getPrototypeOf||(Object.getPrototypeOf=function(c){return c.__proto__}),Object.keys||(Object.keys=function(c){var r=[];for(var b in c)c.hasOwnProperty(b)&&r.push(b);return r});function _(c){var r=Math.max(s.MAX_BUFFER_LENGTH,10),b=0;for(var f in w){var Z=c[f]===void 0?0:c[f].length;if(Z>r)switch(f){case"text":closeText(c);break;default:K(c,"Max buffer length exceeded: "+f)}b=Math.max(b,Z)}c.bufferCheckPosition=s.MAX_BUFFER_LENGTH-b+c.position}function F(c){for(var r in w)c[r]=w[r]}var pe=/[\\"\n]/g;function ve(c){if(!(this instanceof ve))return new ve(c);var r=this;F(r),r.bufferCheckPosition=s.MAX_BUFFER_LENGTH,r.q=r.c=r.p="",r.opt=c||{},r.closed=r.closedRoot=r.sawRoot=!1,r.tag=r.error=null,r.state=o.BEGIN,r.stack=new Array,r.position=r.column=0,r.line=1,r.slashed=!1,r.unicodeI=0,r.unicodeS=null,r.depth=0,ee(r,"onready")}ve.prototype={end:function(){te(this)},write:Pe,resume:function(){return this.error=null,this},close:function(){return this.write(null)}};try{j=Ln.Stream}catch{j=function(){}}function J(c){return new V(c)}function V(c){if(!(this instanceof V))return new V(c);this._parser=new ve(c),this.writable=!0,this.readable=!0,this.bytes_remaining=0,this.bytes_in_sequence=0,this.temp_buffs={2:new Buffer(2),3:new Buffer(3),4:new Buffer(4)},this.string="";var r=this;j.apply(r),this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(b){r.emit("error",b),r._parser.error=null},p.forEach(function(b){Object.defineProperty(r,"on"+b,{get:function(){return r._parser["on"+b]},set:function(f){if(!f)return r.removeAllListeners(b),r._parser["on"+b]=f,f;r.on(b,f)},enumerable:!0,configurable:!1})})}V.prototype=Object.create(j.prototype,{constructor:{value:V}}),V.prototype.write=function(c){c=new Buffer(c);for(var r=0;r<c.length;r++){var b=c[r];if(this.bytes_remaining>0){for(var f=0;f<this.bytes_remaining;f++)this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence-this.bytes_remaining+f]=c[f];this.string=this.temp_buffs[this.bytes_in_sequence].toString(),this.bytes_in_sequence=this.bytes_remaining=0,r=r+f-1,this._parser.write(this.string),this.emit("data",this.string);continue}if(this.bytes_remaining===0&&b>=128)if(b>=194&&b<=223&&(this.bytes_in_sequence=2),b>=224&&b<=239&&(this.bytes_in_sequence=3),b>=240&&b<=244&&(this.bytes_in_sequence=4),this.bytes_in_sequence+r>c.length){for(var Z=0;Z<=c.length-1-r;Z++)this.temp_buffs[this.bytes_in_sequence][Z]=c[r+Z];return this.bytes_remaining=r+this.bytes_in_sequence-c.length,!0}else{this.string=c.slice(r,r+this.bytes_in_sequence).toString(),r=r+this.bytes_in_sequence-1,this._parser.write(this.string),this.emit("data",this.string);continue}for(var M=r;M<c.length&&!(c[M]>=128);M++);this.string=c.slice(r,M).toString(),this._parser.write(this.string),this.emit("data",this.string),r=M-1}},V.prototype.end=function(c){return c&&c.length&&this._parser.write(c.toString()),this._parser.end(),!0},V.prototype.on=function(c,r){var b=this;return!b._parser["on"+c]&&p.indexOf(c)!==-1&&(b._parser["on"+c]=function(){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);f.splice(0,0,c),b.emit.apply(b,f)}),j.prototype.on.call(b,c,r)},V.prototype.destroy=function(){F(this._parser),this.emit("close")};function ee(c,r,b){s.INFO&&console.log("-- emit",r,b),c[r]&&c[r](b)}function Ee(c,r,b){me(c),ee(c,r,b)}function me(c,r){c.textNode=Ne(c.opt,c.textNode),c.textNode!==void 0&&ee(c,r||"onvalue",c.textNode),c.textNode=void 0}function N(c){c.numberNode&&ee(c,"onvalue",parseFloat(c.numberNode)),c.numberNode=""}function Ne(c,r){return r===void 0||(c.trim&&(r=r.trim()),c.normalize&&(r=r.replace(/\s+/g," "))),r}function K(c,r){return me(c),r+=`
|
|
Line: `+c.line+`
|
|
Column: `+c.column+`
|
|
Char: `+c.c,r=new Error(r),c.error=r,ee(c,"onerror",r),c}function te(c){return(c.state!==o.VALUE||c.depth!==0)&&K(c,"Unexpected end"),me(c),c.c="",c.closed=!0,ee(c,"onend"),ve.call(c,c.opt),c}function re(c){return c===u.carriageReturn||c===u.lineFeed||c===u.space||c===u.tab}function Pe(c){var r=this;if(this.error)throw this.error;if(r.closed)return K(r,"Cannot write after close. Assign an onready handler.");if(c===null)return te(r);var b=0,f=c.charCodeAt(0),Z=r.p;for(s.DEBUG&&console.log("write -> ["+c+"]");f&&(Z=f,r.c=f=c.charCodeAt(b++),Z!==f?r.p=Z:Z=r.p,!!f);)switch(s.DEBUG&&console.log(b,f,s.STATE[r.state]),r.position++,f===u.lineFeed?(r.line++,r.column=0):r.column++,r.state){case o.BEGIN:f===u.openBrace?r.state=o.OPEN_OBJECT:f===u.openBracket?r.state=o.OPEN_ARRAY:re(f)||K(r,"Non-whitespace before {[.");continue;case o.OPEN_KEY:case o.OPEN_OBJECT:if(re(f))continue;if(r.state===o.OPEN_KEY)r.stack.push(o.CLOSE_KEY);else if(f===u.closeBrace){ee(r,"onopenobject"),this.depth++,ee(r,"oncloseobject"),this.depth--,r.state=r.stack.pop()||o.VALUE;continue}else r.stack.push(o.CLOSE_OBJECT);f===u.doubleQuote?r.state=o.STRING:K(r,'Malformed object key should start with "');continue;case o.CLOSE_KEY:case o.CLOSE_OBJECT:if(re(f))continue;r.state,o.CLOSE_KEY,f===u.colon?(r.state===o.CLOSE_OBJECT?(r.stack.push(o.CLOSE_OBJECT),me(r,"onopenobject"),this.depth++):me(r,"onkey"),r.state=o.VALUE):f===u.closeBrace?(Ee(r,"oncloseobject"),this.depth--,r.state=r.stack.pop()||o.VALUE):f===u.comma?(r.state===o.CLOSE_OBJECT&&r.stack.push(o.CLOSE_OBJECT),me(r),r.state=o.OPEN_KEY):K(r,"Bad object");continue;case o.OPEN_ARRAY:case o.VALUE:if(re(f))continue;if(r.state===o.OPEN_ARRAY)if(ee(r,"onopenarray"),this.depth++,r.state=o.VALUE,f===u.closeBracket){ee(r,"onclosearray"),this.depth--,r.state=r.stack.pop()||o.VALUE;continue}else r.stack.push(o.CLOSE_ARRAY);f===u.doubleQuote?r.state=o.STRING:f===u.openBrace?r.state=o.OPEN_OBJECT:f===u.openBracket?r.state=o.OPEN_ARRAY:f===u.t?r.state=o.TRUE:f===u.f?r.state=o.FALSE:f===u.n?r.state=o.NULL:f===u.minus?r.numberNode+="-":u._0<=f&&f<=u._9?(r.numberNode+=String.fromCharCode(f),r.state=o.NUMBER_DIGIT):K(r,"Bad value");continue;case o.CLOSE_ARRAY:if(f===u.comma)r.stack.push(o.CLOSE_ARRAY),me(r,"onvalue"),r.state=o.VALUE;else if(f===u.closeBracket)Ee(r,"onclosearray"),this.depth--,r.state=r.stack.pop()||o.VALUE;else{if(re(f))continue;K(r,"Bad array")}continue;case o.STRING:r.textNode===void 0&&(r.textNode="");var M=b-1,ie=r.slashed,he=r.unicodeI;e:for(;;){for(s.DEBUG&&console.log(b,f,s.STATE[r.state],ie);he>0;)if(r.unicodeS+=String.fromCharCode(f),f=c.charCodeAt(b++),r.position++,he===4?(r.textNode+=String.fromCharCode(parseInt(r.unicodeS,16)),he=0,M=b-1):he++,!f)break e;if(f===u.doubleQuote&&!ie){r.state=r.stack.pop()||o.VALUE,r.textNode+=c.substring(M,b-1),r.position+=b-1-M;break}if(f===u.backslash&&!ie&&(ie=!0,r.textNode+=c.substring(M,b-1),r.position+=b-1-M,f=c.charCodeAt(b++),r.position++,!f))break;if(ie){if(ie=!1,f===u.n?r.textNode+=`
|
|
`:f===u.r?r.textNode+="\r":f===u.t?r.textNode+=" ":f===u.f?r.textNode+="\f":f===u.b?r.textNode+="\b":f===u.u?(he=1,r.unicodeS=""):r.textNode+=String.fromCharCode(f),f=c.charCodeAt(b++),r.position++,M=b-1,f)continue;break}pe.lastIndex=b;var Se=pe.exec(c);if(Se===null){b=c.length+1,r.textNode+=c.substring(M,b-1),r.position+=b-1-M;break}if(b=Se.index+1,f=c.charCodeAt(Se.index),!f){r.textNode+=c.substring(M,b-1),r.position+=b-1-M;break}}r.slashed=ie,r.unicodeI=he;continue;case o.TRUE:f===u.r?r.state=o.TRUE2:K(r,"Invalid true started with t"+f);continue;case o.TRUE2:f===u.u?r.state=o.TRUE3:K(r,"Invalid true started with tr"+f);continue;case o.TRUE3:f===u.e?(ee(r,"onvalue",!0),r.state=r.stack.pop()||o.VALUE):K(r,"Invalid true started with tru"+f);continue;case o.FALSE:f===u.a?r.state=o.FALSE2:K(r,"Invalid false started with f"+f);continue;case o.FALSE2:f===u.l?r.state=o.FALSE3:K(r,"Invalid false started with fa"+f);continue;case o.FALSE3:f===u.s?r.state=o.FALSE4:K(r,"Invalid false started with fal"+f);continue;case o.FALSE4:f===u.e?(ee(r,"onvalue",!1),r.state=r.stack.pop()||o.VALUE):K(r,"Invalid false started with fals"+f);continue;case o.NULL:f===u.u?r.state=o.NULL2:K(r,"Invalid null started with n"+f);continue;case o.NULL2:f===u.l?r.state=o.NULL3:K(r,"Invalid null started with nu"+f);continue;case o.NULL3:f===u.l?(ee(r,"onvalue",null),r.state=r.stack.pop()||o.VALUE):K(r,"Invalid null started with nul"+f);continue;case o.NUMBER_DECIMAL_POINT:f===u.period?(r.numberNode+=".",r.state=o.NUMBER_DIGIT):K(r,"Leading zero not followed by .");continue;case o.NUMBER_DIGIT:u._0<=f&&f<=u._9?r.numberNode+=String.fromCharCode(f):f===u.period?(r.numberNode.indexOf(".")!==-1&&K(r,"Invalid number has two dots"),r.numberNode+="."):f===u.e||f===u.E?((r.numberNode.indexOf("e")!==-1||r.numberNode.indexOf("E")!==-1)&&K(r,"Invalid number has two exponential"),r.numberNode+="e"):f===u.plus||f===u.minus?(Z===u.e||Z===u.E||K(r,"Invalid symbol in number"),r.numberNode+=String.fromCharCode(f)):(N(r),b--,r.state=r.stack.pop()||o.VALUE);continue;default:K(r,"Unknown state: "+r.state)}return r.position>=r.bufferCheckPosition&&_(r),r}})(v)});function xn(g){var v=0,s=Fn(),m={pullAsync:function(w){return en(this,void 0,void 0,function(){var p,o,j;return We(this,function(R){switch(R.label){case 0:return p=g.slice(v,v+w),v+=w,[4,gn(p,"text")];case 1:return o=R.sent(),j=s.write(o),m.result=j||{},[2,j]}})})},pullSync:function(w){var p=g.slice(v,v+w);v+=w;var o=wn(p,"text"),j=s.write(o);return m.result=j||{},j},done:function(){return s.done()},eof:function(){return v>=g.size},result:{}};return m}function Fn(g){var v=Rn.parser(),s=0,m,w=[],p,o,j=!1,R=!1;return v.onopenobject=function(u){var _={};_.incomplete=!0,m||(m=_),p&&(w.push([o,p,R]),R?p.push(_):p[o]=_),p=_,o=u,R=!1,++s},v.onkey=function(u){return o=u},v.onvalue=function(u){return R?p.push(u):p[o]=u},v.oncloseobject=function(){var u;delete p.incomplete,o=null,--s===0?j=!0:(u=w.pop(),o=u[0],p=u[1],R=u[2])},v.onopenarray=function(){var u=[];u.incomplete=!0,m||(m=u),p&&(w.push([o,p,R]),R?p.push(u):p[o]=u),p=u,R=!0,o=null,++s},v.onclosearray=function(){var u;delete p.incomplete,o=null,--s===0?j=!0:(u=w.pop(),o=u[0],p=u[1],R=u[2])},{write:function(u){return v.write(u),m},done:function(){return j}}}var An=1024;function Kn(g,v){return en(this,void 0,void 0,function(){var s,m,w,p;return We(this,function(o){switch(o.label){case 0:return v=v||{},s=v.chunkSizeBytes||An*1024,[4,En(g,s)];case 1:return m=o.sent(),w=m.result.data,p=new Re(v.name!==void 0?v.name:w.databaseName),p.version(w.databaseVersion).stores(Nn(w)),[4,Tn(p,m,v.name!==void 0?fn(fn({},v),{acceptNameDiff:!0}):v)];case 2:return o.sent(),[2,p]}})})}function Tn(g,v,s){return en(this,void 0,void 0,function(){function m(){return en(this,void 0,void 0,function(){var V,ee,Ee,me,N;return We(this,function(Ne){switch(Ne.label){case 0:V=function(K){var te,re,Pe,c,r,b,f,Z,M,ie,he,Se,Be;return We(this,function(_e){switch(_e.label){case 0:if(u.includes(K.tableName))return[2,"continue"];if(!K.rows)return[2,"break"];if(!K.rows.incomplete&&K.rows.length===0)return[2,"continue"];if(_&&Re.ignoreTransaction(function(){return _(F)}),te=K.tableName,re=g.table(te),Pe=R.tables.filter(function(ce){return ce.name===te})[0].schema,!re){if(s.acceptMissingTables)return[2,"continue"];throw new Error("Exported table ".concat(K.tableName," is missing in installed database"))}if(!s.acceptChangedPrimaryKey&&Pe.split(",")[0]!=re.schema.primKey.src)throw new Error("Primary key differs for table ".concat(K.tableName,". "));for(c=K.rows,r=[],b=0;b<c.length&&(f=c[b],!f.incomplete);b++)r.push(Je.revive(f));return Z=s.filter,M=s.transform,ie=Z?K.inbound?r.filter(function(ce){return Z(te,ce)}):r.filter(function(ce){var be=ce[0],Ce=ce[1];return Z(te,Ce,be)}):r,M&&(ie=ie.map(K.inbound?function(ce){return M(te,ce).value}:function(ce){var be=ce[0],Ce=ce[1],Me=M(te,Ce,be);return[Me.key,Me.value]})),he=K.inbound?[void 0,ie]:[ie.map(function(ce){return ce[0]}),r.map(function(ce){return ce[1]})],Se=he[0],Be=he[1],s.overwriteValues?[4,re.bulkPut(Be,Se)]:[3,2];case 1:return _e.sent(),[3,4];case 2:return[4,re.bulkAdd(Be,Se)];case 3:_e.sent(),_e.label=4;case 4:return F.completedRows+=r.length,r.incomplete||(F.completedTables+=1),c.splice(0,r.length),[2]}})},ee=0,Ee=R.data,Ne.label=1;case 1:return ee<Ee.length?(me=Ee[ee],[5,V(me)]):[3,4];case 2:if(N=Ne.sent(),N==="break")return[3,4];Ne.label=3;case 3:return ee++,[3,1];case 4:for(;R.data.length>0&&R.data[0].rows&&!R.data[0].rows.incomplete;)R.data.splice(0,1);return!p.done()&&!p.eof()?j?(p.pullSync(w),[3,7]):[3,5]:[3,8];case 5:return[4,Re.waitFor(p.pullAsync(w))];case 6:Ne.sent(),Ne.label=7;case 7:return[3,9];case 8:return[3,10];case 9:return[3,0];case 10:return[2]}})})}var w,p,o,j,R,u,_,F,pe,ve,J;return We(this,function(V){switch(V.label){case 0:return s=s||{},w=s.chunkSizeBytes||An*1024,[4,En(v,w)];case 1:if(p=V.sent(),o=p.result,j="FileReaderSync"in self,R=o.data,u=s.skipTables?s.skipTables:[],!s.acceptNameDiff&&g.name!==R.databaseName)throw new Error("Name differs. Current database name is ".concat(g.name," but export is ").concat(R.databaseName));if(!s.acceptVersionDiff&&g.verno!==R.databaseVersion)throw new Error("Database version differs. Current database is in version ".concat(g.verno," but export is ").concat(R.databaseVersion));if(_=s.progressCallback,F={done:!1,completedRows:0,completedTables:0,totalRows:R.tables.reduce(function(ee,Ee){return ee+Ee.rowCount},0),totalTables:R.tables.length},_&&Re.ignoreTransaction(function(){return _(F)}),!s.clearTablesBeforeImport)return[3,5];pe=0,ve=g.tables,V.label=2;case 2:return pe<ve.length?(J=ve[pe],u.includes(J.name)?[3,4]:[4,J.clear()]):[3,5];case 3:V.sent(),V.label=4;case 4:return pe++,[3,2];case 5:return s.noTransaction?[4,m()]:[3,7];case 6:return V.sent(),[3,9];case 7:return[4,g.transaction("rw",g.tables,m)];case 8:V.sent(),V.label=9;case 9:return F.done=!0,_&&Re.ignoreTransaction(function(){return _(F)}),[2]}})})}function En(g,v){return en(this,void 0,void 0,function(){var s,m;return We(this,function(w){switch(w.label){case 0:s="slice"in g?xn(g):g,w.label=1;case 1:return s.eof()?[3,3]:[4,s.pullAsync(v)];case 2:return w.sent(),s.result.data&&s.result.data.data?[3,3]:[3,1];case 3:if(m=s.result,!m||m.formatName!="dexie")throw new Error("Given file is not a dexie export");if(m.formatVersion>Un)throw new Error("Format version ".concat(m.formatVersion," not supported"));if(!m.data)throw new Error("No data in export file");if(!m.data.databaseName)throw new Error("Missing databaseName in export file");if(!m.data.databaseVersion)throw new Error("Missing databaseVersion in export file");if(!m.data.tables)throw new Error("Missing tables in export file");return[2,s]}})})}Re.prototype.export=function(g){return kn(this,g)};Re.prototype.import=function(g,v){return Tn(this,g,v)};Re.import=function(g,v){return Kn(g,v)};
|
|
|