@banou/ripple 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -27
- package/build/app.webmanifest +65 -0
- package/build/assets/index-be95001c.js +211 -0
- package/build/assets/index-d5b720ec.js +109 -0
- package/build/assets/io-worker-bde41815.js +17681 -0
- package/build/assets/logo.png +0 -0
- package/build/assets/logo.svg +1 -0
- package/build/index-3576f032.js +14881 -0
- package/build/index-65b2197a.js +116 -0
- package/build/index.html +2 -0
- package/build/index.js +33826 -1
- package/build/io-worker-190cc8d7.js +2862 -0
- package/build/libav-worker.js +1 -1
- package/build/libav.wasm +0 -0
- package/build/shared-worker.js +13 -1
- package/build/worker.js +38 -1
- package/package.json +12 -8
- package/build/index-8227e1be.js +0 -121
- package/build/io-worker-67a3c2ed.js +0 -3
- package/build/settings-bc96f65e.js +0 -28
- package/build/shared-worker-05e72720.js +0 -1404
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import{R as _f}from"./index-9a320571.js";let d4,Kw,Q0,gf,xt,Pg,y4,m4,wf,b4,ry,Tr,Dr,h4,ke,u3,Ag,j3,p4,sr,v4,jg,g4,l4;let __tla=(async()=>{function k0(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};wf=function wf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e};var Tp={exports:{}},z={};var Vi=Symbol.for("react.element"),j0=Symbol.for("react.portal"),M0=Symbol.for("react.fragment"),D0=Symbol.for("react.strict_mode"),T0=Symbol.for("react.profiler"),F0=Symbol.for("react.provider"),L0=Symbol.for("react.context"),B0=Symbol.for("react.forward_ref"),N0=Symbol.for("react.suspense"),U0=Symbol.for("react.memo"),W0=Symbol.for("react.lazy"),Sd=Symbol.iterator;function q0(e){return e===null||typeof e!="object"?null:(e=Sd&&e[Sd]||e["@@iterator"],typeof e=="function"?e:null)}var Fp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Lp=Object.assign,Bp={};function Qn(e,t,r){this.props=e,this.context=t,this.refs=Bp,this.updater=r||Fp}Qn.prototype.isReactComponent={};Qn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Qn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Np(){}Np.prototype=Qn.prototype;function Of(e,t,r){this.props=e,this.context=t,this.refs=Bp,this.updater=r||Fp}var Sf=Of.prototype=new Np;Sf.constructor=Of;Lp(Sf,Qn.prototype);Sf.isPureReactComponent=!0;var Ed=Array.isArray,Up=Object.prototype.hasOwnProperty,Ef={current:null},Wp={key:!0,ref:!0,__self:!0,__source:!0};function qp(e,t,r){var n,i={},o=null,a=null;if(t!=null)for(n in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)Up.call(t,n)&&!Wp.hasOwnProperty(n)&&(i[n]=t[n]);var u=arguments.length-2;if(u===1)i.children=r;else if(1<u){for(var s=Array(u),c=0;c<u;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(n in u=e.defaultProps,u)i[n]===void 0&&(i[n]=u[n]);return{$$typeof:Vi,type:e,key:o,ref:a,props:i,_owner:Ef.current}}function K0(e,t){return{$$typeof:Vi,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Pf(e){return typeof e=="object"&&e!==null&&e.$$typeof===Vi}function H0(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var Pd=/\/+/g;function _c(e,t){return typeof e=="object"&&e!==null&&e.key!=null?H0(""+e.key):t.toString(36)}function ua(e,t,r,n,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Vi:case j0:a=!0}}if(a)return a=e,i=i(a),e=n===""?"."+_c(a,0):n,Ed(i)?(r="",e!=null&&(r=e.replace(Pd,"$&/")+"/"),ua(i,t,r,"",function(c){return c})):i!=null&&(Pf(i)&&(i=K0(i,r+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(Pd,"$&/")+"/")+e)),t.push(i)),1;if(a=0,n=n===""?".":n+":",Ed(e))for(var u=0;u<e.length;u++){o=e[u];var s=n+_c(o,u);a+=ua(o,t,r,s,i)}else if(s=q0(e),typeof s=="function")for(e=s.call(e),u=0;!(o=e.next()).done;)o=o.value,s=n+_c(o,u++),a+=ua(o,t,r,s,i);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Jo(e,t,r){if(e==null)return e;var n=[],i=0;return ua(e,n,"","",function(o){return t.call(r,o,i++)}),n}function V0(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Be={current:null},sa={transition:null},z0={ReactCurrentDispatcher:Be,ReactCurrentBatchConfig:sa,ReactCurrentOwner:Ef};z.Children={map:Jo,forEach:function(e,t,r){Jo(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Jo(e,function(){t++}),t},toArray:function(e){return Jo(e,function(t){return t})||[]},only:function(e){if(!Pf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};z.Component=Qn;z.Fragment=M0;z.Profiler=T0;z.PureComponent=Of;z.StrictMode=D0;z.Suspense=N0;z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=z0;z.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Lp({},e.props),i=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=Ef.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(s in t)Up.call(t,s)&&!Wp.hasOwnProperty(s)&&(n[s]=t[s]===void 0&&u!==void 0?u[s]:t[s])}var s=arguments.length-2;if(s===1)n.children=r;else if(1<s){u=Array(s);for(var c=0;c<s;c++)u[c]=arguments[c+2];n.children=u}return{$$typeof:Vi,type:e.type,key:i,ref:o,props:n,_owner:a}};z.createContext=function(e){return e={$$typeof:L0,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:F0,_context:e},e.Consumer=e};z.createElement=qp;z.createFactory=function(e){var t=qp.bind(null,e);return t.type=e,t};z.createRef=function(){return{current:null}};z.forwardRef=function(e){return{$$typeof:B0,render:e}};z.isValidElement=Pf;z.lazy=function(e){return{$$typeof:W0,_payload:{_status:-1,_result:e},_init:V0}};z.memo=function(e,t){return{$$typeof:U0,type:e,compare:t===void 0?null:t}};z.startTransition=function(e){var t=sa.transition;sa.transition={};try{e()}finally{sa.transition=t}};z.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};z.useCallback=function(e,t){return Be.current.useCallback(e,t)};z.useContext=function(e){return Be.current.useContext(e)};z.useDebugValue=function(){};z.useDeferredValue=function(e){return Be.current.useDeferredValue(e)};z.useEffect=function(e,t){return Be.current.useEffect(e,t)};z.useId=function(){return Be.current.useId()};z.useImperativeHandle=function(e,t,r){return Be.current.useImperativeHandle(e,t,r)};z.useInsertionEffect=function(e,t){return Be.current.useInsertionEffect(e,t)};z.useLayoutEffect=function(e,t){return Be.current.useLayoutEffect(e,t)};z.useMemo=function(e,t){return Be.current.useMemo(e,t)};z.useReducer=function(e,t,r){return Be.current.useReducer(e,t,r)};z.useRef=function(e){return Be.current.useRef(e)};z.useState=function(e){return Be.current.useState(e)};z.useSyncExternalStore=function(e,t,r){return Be.current.useSyncExternalStore(e,t,r)};z.useTransition=function(){return Be.current.useTransition()};z.version="18.2.0";Tp.exports=z;sr=Tp.exports;Q0=wf(sr);d4=k0({__proto__:null,default:Q0},[sr]);function Ii(e){"@babel/helpers - typeof";return Ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ii(e)}function G0(e,t){if(Ii(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ii(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Y0(e){var t=G0(e,"string");return Ii(t)==="symbol"?t:String(t)}function $d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y0(n.key),n)}}function cr(e,t,r){return t&&$d(e.prototype,t),r&&$d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function J0(e){return e[e.length-1]}function $f(e){return Array.isArray(e)?e.slice(0):[e]}function En(e){return Array.isArray(e)}function X0(e){return e!=null}function wc(e,t){var r=0,n=-1;for(var i of e){n=n+1;var o=t(i,n);if(o)r=r+1;else break}return r}function Mn(e,t){for(var r=t.length,n=0;n<r;++n){var i=t[n];e.push(i)}}function hl(e){var t=e.split("-");if(t.length!==2)throw new Error("malformatted revision: "+e);return{height:parseInt(t[0],10),hash:t[1]}}function Ad(e){var t=parseInt(e.split("-")[0],10);return t}function vl(e,t){var r=t?t._rev:null,n=r?hl(r).height:0,i=n+1;return i+"-"+e}var Af=1;function Ga(){return{lwt:Af}}function Ya(){return""}function Z0(e){return Object.assign({},e,{_meta:void 0,_deleted:void 0,_rev:void 0})}function ew(e,t,r){if(t.length!==r.length)return!1;for(var n=0,i=t.length;n<i;){var o=t[n],a=r[n];if(n++,o._rev!==a._rev||o[e]!==a[e])return!1}return!0}function tw(e){return(t,r)=>t._meta.lwt===r._meta.lwt?r[e]<t[e]?1:-1:t._meta.lwt-r._meta.lwt}function rw(e,t){return t.sort(tw(e))}class Jt{constructor(t,r){t=this.words=t||[],this.sigBytes=r===void 0?t.length*4:r}toString(t){return(t||nw).stringify(this)}concat(t){if(this.clamp(),this.sigBytes%4)for(let r=0;r<t.sigBytes;r++){const n=t.words[r>>>2]>>>24-r%4*8&255;this.words[this.sigBytes+r>>>2]|=n<<24-(this.sigBytes+r)%4*8}else for(let r=0;r<t.sigBytes;r+=4)this.words[this.sigBytes+r>>>2]=t.words[r>>>2];return this.sigBytes+=t.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new Jt([...this.words])}}const nw={stringify(e){const t=[];for(let r=0;r<e.sigBytes;r++){const n=e.words[r>>>2]>>>24-r%4*8&255;t.push((n>>>4).toString(16),(n&15).toString(16))}return t.join("")}},iw={parse(e){const t=e.length,r=[];for(let n=0;n<t;n++)r[n>>>2]|=(e.charCodeAt(n)&255)<<24-n%4*8;return new Jt(r,t)}},ow={parse(e){return iw.parse(unescape(encodeURIComponent(e)))}};class aw{constructor(){this._data=new Jt,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new Jt,this._nDataBytes=0}_append(t){typeof t=="string"&&(t=ow.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_doProcessBlock(t,r){}_process(t){let r,n=this._data.sigBytes/(this.blockSize*4);t?n=Math.ceil(n):n=Math.max((n|0)-this._minBufferSize,0);const i=n*this.blockSize,o=Math.min(i*4,this._data.sigBytes);if(i){for(let a=0;a<i;a+=this.blockSize)this._doProcessBlock(this._data.words,a);r=this._data.words.splice(0,i),this._data.sigBytes-=o}return new Jt(r,o)}}class uw extends aw{update(t){return this._append(t),this._process(),this}finalize(t){t&&this._append(t)}}const xd=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],sw=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],pr=[];class cw extends uw{constructor(){super(...arguments),this._hash=new Jt([...xd])}reset(){super.reset(),this._hash=new Jt([...xd])}_doProcessBlock(t,r){const n=this._hash.words;let i=n[0],o=n[1],a=n[2],u=n[3],s=n[4],c=n[5],l=n[6],f=n[7];for(let d=0;d<64;d++){if(d<16)pr[d]=t[r+d]|0;else{const E=pr[d-15],A=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,P=pr[d-2],x=(P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10;pr[d]=A+pr[d-7]+x+pr[d-16]}const p=s&c^~s&l,m=i&o^i&a^o&a,y=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),_=(s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25),w=f+_+p+sw[d]+pr[d],O=y+m;f=l,l=c,c=s,s=u+w|0,u=a,a=o,o=i,i=w+O|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0}finalize(t){super.finalize(t);const r=this._nDataBytes*8,n=this._data.sigBytes*8;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[(n+64>>>9<<4)+14]=Math.floor(r/4294967296),this._data.words[(n+64>>>9<<4)+15]=r,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function lw(e){return new cw().finalize(e).toString()}function fw(e){return Promise.resolve(lw(e))}async function dw(e){var t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t),n=Array.prototype.map.call(new Uint8Array(r),i=>("00"+i.toString(16)).slice(-2)).join("");return n}var hw=typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof crypto.subtle.digest=="function",vw=hw?dw:fw;function pw(){return new Promise(e=>setTimeout(e,0))}function yw(e=0){return new Promise(t=>setTimeout(t,e))}var mw=Promise.resolve(!0),Qt=Promise.resolve(!1),bw=Promise.resolve(null),Ct=Promise.resolve();function Kp(e=1e4){return typeof requestIdleCallback=="function"?new Promise(t=>{requestIdleCallback(()=>t(),{timeout:e})}):yw(0)}var Oc=Ct;function gw(e=void 0){return Oc=Oc.then(()=>Kp(e)),Oc}function _w(e,t){return e.reduce((r,n)=>r.then(n),Promise.resolve(t))}var ww=/\./g,Cd="abcdefghijklmnopqrstuvwxyz";function Ja(e=10){for(var t="",r=0;r<e;r++)t+=Cd.charAt(Math.floor(Math.random()*Cd.length));return t}function Hp(e){e+="";var t=e.charAt(0).toUpperCase();return t+e.substr(1)}function $r(e){for(;e.charAt(0)===".";)e=e.substr(1);for(;e.slice(-1)===".";)e=e.slice(0,-1);return e}function Vp(e){return!!(e.includes("/")||e.includes("\\"))}function Ri(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n;if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Ri(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var i=Object.keys(e);if(r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=r;n--!==0;){var o=i[n];if(!Ri(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}var Ow=e=>{var t=typeof e;return e!==null&&(t==="object"||t==="function")},Sc=new Set(["__proto__","prototype","constructor"]),Sw=new Set("0123456789");function Ew(e){var t=[],r="",n="start",i=!1;for(var o of e)switch(o){case"\\":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");i&&(r+=o),n="property",i=!i;break}case".":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(i){i=!1,r+=o;break}if(Sc.has(r))return[];t.push(r),r="",n="property";break}case"[":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(i){i=!1,r+=o;break}if(n==="property"){if(Sc.has(r))return[];t.push(r),r=""}n="index";break}case"]":{if(n==="index"){t.push(Number.parseInt(r,10)),r="",n="indexEnd";break}if(n==="indexEnd")throw new Error("Invalid character after an index")}default:{if(n==="index"&&!Sw.has(o))throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");n==="start"&&(n="property"),i&&(i=!1,r+="\\"),r+=o}}switch(i&&(r+="\\"),n){case"property":{if(Sc.has(r))return[];t.push(r);break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}function Pw(e,t){if(typeof t!="number"&&Array.isArray(e)){var r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function Gt(e,t,r){if(Array.isArray(t)&&(t=t.join(".")),!t.includes(".")&&!t.includes("["))return e[t];if(!Ow(e)||typeof t!="string")return r===void 0?e:r;var n=Ew(t);if(n.length===0)return r;for(var i=0;i<n.length;i++){var o=n[i];if(Pw(e,o)?e=i===n.length-1?void 0:null:e=e[o],e==null){if(i!==n.length-1)return r;break}}return e===void 0?r:e}function zp(e){return Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(t){e.hasOwnProperty(t)&&e[t]!==null&&(typeof e[t]=="object"||typeof e[t]=="function")&&!Object.isFrozen(e[t])&&zp(e[t])}),e}function $w(e){var t=e.split("."),r=t.length;return r===1?n=>n[e]:n=>{for(var i=n,o=0;o<r;++o){var a=t[o];if(i=i[a],typeof i>"u")return i}return i}}function pl(e){var t={};for(var r in e)if(e.hasOwnProperty(r))if(typeof e[r]=="object"){var n=pl(e[r]);for(var i in n)n.hasOwnProperty(i)&&(t[r+"."+i]=n[i])}else t[r]=e[r];return t}function xe(e){return Object.assign({},e)}function Aw(e){return Object.keys(e)[0]}function Sa(e,t=!1){if(!e)return e;if(!t&&Array.isArray(e))return e.sort((n,i)=>typeof n=="string"&&typeof i=="string"?n.localeCompare(i):typeof n=="object"?1:-1).map(n=>Sa(n,t));if(typeof e=="object"&&!Array.isArray(e)){var r={};return Object.keys(e).sort((n,i)=>n.localeCompare(i)).forEach(n=>{r[n]=Sa(e[n],t)}),r}return e}function yl(e){if(!e||e===null||typeof e!="object")return e;if(Array.isArray(e)){for(var t=new Array(e.length),r=t.length;r--;)t[r]=yl(e[r]);return t}var n={};for(var i in e)n[i]=yl(e[i]);return n}var Dn=yl;function Xt(e,t,r){return Object.defineProperty(e,t,{get:function(){return r}}),r}function ki(e,t){var r=e.get(t);if(typeof r>"u")throw new Error("missing value from map "+t);return r}function Dt(e,t,r,n){var i=e.get(t);return typeof i>"u"?(i=r(),e.set(t,i)):n&&n(i),i}function ae(e){var t=e.split("-"),r="RxDB";return t.forEach(n=>{r+=Hp(n)}),r+="Plugin",new Error(`You are using a function which must be overwritten by a plugin.
|
|
2
|
-
You should either prevent the usage of this function or add the plugin via:
|
|
3
|
-
import { `+r+" } from 'rxdb/plugins/"+e+`';
|
|
4
|
-
addRxPlugin(`+r+`);
|
|
5
|
-
`)}var Ec=0;function Ge(){var e=Date.now();e=e+.01,e<=Ec&&(e=Ec+.01);var t=parseFloat(e.toFixed(2));return Ec=t,t}function fe(e){if(!e)throw new Error("ensureNotFalsy() is falsy");return e}var Qp={bufferSize:1,refCount:!0},xw="15.0.0-beta.42";function ji(e,t){return ji=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ji(e,t)}function Gp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ji(e,t)}function ml(e){return ml=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ml(e)}function Cw(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function Iw(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ca(e,t,r){return Iw()?ca=Reflect.construct.bind():ca=function(i,o,a){var u=[null];u.push.apply(u,o);var s=Function.bind.apply(i,u),c=new s;return a&&ji(c,a.prototype),c},ca.apply(null,arguments)}function Ea(e){var t=typeof Map=="function"?new Map:void 0;return Ea=function(n){if(n===null||!Cw(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return ca(n,arguments,ml(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ji(i,n)},Ea(e)}var me={isDevMode(){return!1},deepFreezeWhenDevMode(e){return e},tunnelErrorMessage(e){return"RxDB Error-Code "+e+`.
|
|
6
|
-
Error messages are not included in RxDB core to reduce build size.
|
|
7
|
-
- To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html
|
|
8
|
-
- or search for the error code here: https://github.com/pubkey/rxdb/search?q=`+e+`
|
|
9
|
-
`}};function Rw(e){var t="";return Object.keys(e).length===0||(t+=`Given parameters: {
|
|
10
|
-
`,t+=Object.keys(e).map(r=>{var n="[object Object]";try{r==="errors"?n=e[r].map(i=>JSON.stringify(i,Object.getOwnPropertyNames(i))):n=JSON.stringify(e[r],function(i,o){return o===void 0?null:o},2)}catch{}return r+":"+n}).join(`
|
|
11
|
-
`),t+="}"),t}function Yp(e,t,r){return"RxError ("+t+`):
|
|
12
|
-
`+e+`
|
|
13
|
-
`+Rw(r)}var kw=function(e){Gp(t,e);function t(n,i,o={}){var a,u=Yp(i,n,o);return a=e.call(this,u)||this,a.code=n,a.message=u,a.parameters=o,a.rxdb=!0,a}var r=t.prototype;return r.toString=function(){return this.message},cr(t,[{key:"name",get:function(){return"RxError ("+this.code+")"}},{key:"typeError",get:function(){return!1}}]),t}(Ea(Error)),jw=function(e){Gp(t,e);function t(n,i,o={}){var a,u=Yp(i,n,o);return a=e.call(this,u)||this,a.code=n,a.message=u,a.parameters=o,a.rxdb=!0,a}var r=t.prototype;return r.toString=function(){return this.message},cr(t,[{key:"name",get:function(){return"RxTypeError ("+this.code+")"}},{key:"typeError",get:function(){return!0}}]),t}(Ea(TypeError));function I(e,t){return new kw(e,me.tunnelErrorMessage(e),t)}function ve(e,t){return new jw(e,me.tunnelErrorMessage(e),t)}function Jp(e){return e&&e.status===409?e:!1}var Mw={409:"document write conflict",422:"schema validation error",510:"attachment data missing"};function Dw(e){return I("COL20",{name:Mw[e.status],document:e.documentId,writeError:e})}var Mi={preAddRxPlugin:[],preCreateRxDatabase:[],createRxDatabase:[],preCreateRxCollection:[],createRxCollection:[],postDestroyRxCollection:[],postRemoveRxCollection:[],preCreateRxSchema:[],createRxSchema:[],preCreateRxQuery:[],prePrepareQuery:[],createRxDocument:[],postCreateRxDocument:[],preCreateRxStorageInstance:[],preMigrateDocument:[],postMigrateDocument:[],preDestroyRxDatabase:[],postRemoveRxDatabase:[],preReplicationMasterWrite:[],preReplicationMasterWriteDocumentsHandle:[]};function et(e,t){Mi[e]&&Mi[e].forEach(r=>r(t))}function zi(e,t){return Promise.all(Mi[e].map(r=>r(t)))}function tr(e,t){var r=t;r=r.replace(ww,".properties."),r="properties."+r,r=$r(r);var n=Gt(e,r);return n}function Xp(e,t,r){if(typeof t.primaryKey=="string")return r;var n=xf(t,r),i=r[e];if(i&&i!==n)throw I("DOC19",{args:{documentData:r,existingPrimary:i,newPrimary:n},schema:t});return r[e]=n,r}function ot(e){return typeof e=="string"?e:e.key}function xf(e,t){if(typeof e.primaryKey=="string")return t[e.primaryKey];var r=e.primaryKey;return r.fields.map(n=>{var i=Gt(t,n);if(typeof i>"u")throw I("DOC18",{args:{field:n,documentData:t}});return i}).join(r.separator)}function Tw(e){var t=Sa(e,!0);return t}function Zp(e){e=xe(e);var t=ot(e.primaryKey);e.properties=xe(e.properties),e.additionalProperties=!1,e.hasOwnProperty("keyCompression")||(e.keyCompression=!1),e.indexes=e.indexes?e.indexes.slice(0):[],e.required=e.required?e.required.slice(0):[],e.encrypted=e.encrypted?e.encrypted.slice(0):[],e.properties._rev={type:"string",minLength:1},e.properties._attachments={type:"object"},e.properties._deleted={type:"boolean"},e.properties._meta=Fw,e.required=e.required?e.required.slice(0):[],e.required.push("_deleted"),e.required.push("_rev"),e.required.push("_meta"),e.required.push("_attachments");var r=ey(e);return Mn(e.required,r),e.required=e.required.filter(n=>!n.includes(".")).filter((n,i,o)=>o.indexOf(n)===i),e.version=e.version||0,e.indexes&&(e.indexes=e.indexes.map(n=>{var i=En(n)?n.slice(0):[n];if(!i.includes(t)){var o=i.slice(0);return o.push(t),o}return i})),e}var Fw={type:"object",properties:{lwt:{type:"number",minimum:Af,maximum:1e15,multipleOf:.01}},additionalProperties:!0,required:["lwt"]};function ey(e){var t=Object.keys(e.properties).filter(n=>e.properties[n].final),r=ot(e.primaryKey);return t.push(r),typeof e.primaryKey!="string"&&e.primaryKey.fields.forEach(n=>t.push(n)),t}function Lw(e,t){for(var r=Object.keys(e.defaultValues),n=0;n<r.length;++n){var i=r[n];(!t.hasOwnProperty(i)||typeof t[i]>"u")&&(t[i]=e.defaultValues[i])}return t}var Bw={type:"object",properties:{id:{type:"string"},lwt:{type:"number"}},required:["id","lwt"],additionalProperties:!1},ty=function(){function e(r,n){this.jsonSchema=r,this.hashFunction=n,this.indexes=Nw(this.jsonSchema),this.primaryPath=ot(this.jsonSchema.primaryKey),this.finalFields=ey(this.jsonSchema)}var t=e.prototype;return t.validateChange=function(n,i){this.finalFields.forEach(o=>{if(!Ri(n[o],i[o]))throw I("DOC9",{dataBefore:n,dataAfter:i,fieldName:o,schema:this.jsonSchema})})},t.getDocumentPrototype=function(){var n={},i=tr(this.jsonSchema,"");return Object.keys(i).forEach(o=>{var a=o;n.__defineGetter__(o,function(){if(!(!this.get||typeof this.get!="function")){var u=this.get(a);return u}}),Object.defineProperty(n,o+"$",{get:function(){return this.get$(a)},enumerable:!1,configurable:!1}),Object.defineProperty(n,o+"_",{get:function(){return this.populate(a)},enumerable:!1,configurable:!1})}),Xt(this,"getDocumentPrototype",()=>n),n},t.getPrimaryOfDocumentData=function(n){return xf(this.jsonSchema,n)},cr(e,[{key:"version",get:function(){return this.jsonSchema.version}},{key:"defaultValues",get:function(){var r={};return Object.entries(this.jsonSchema.properties).filter(([,n])=>n.hasOwnProperty("default")).forEach(([n,i])=>r[n]=i.default),Xt(this,"defaultValues",r)}},{key:"hash",get:function(){return Xt(this,"hash",this.hashFunction(JSON.stringify(this.jsonSchema)))}}]),e}();function Nw(e){return(e.indexes||[]).map(t=>En(t)?t:[t])}function Uw(e){var t=e.version?e.version:0,r=0;return new Array(t).fill(0).map(()=>r++)}function Ww(e,t,r=!0){r&&et("preCreateRxSchema",e);var n=Zp(e);n=Tw(n),me.deepFreezeWhenDevMode(n);var i=new ty(n,t);return et("createRxSchema",i),i}function be(e){return typeof e=="function"}function qw(e){return be(e?.lift)}function Nt(e){return function(t){if(qw(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}var bl=function(e,t){return bl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},bl(e,t)};function Gn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");bl(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}Kw=function Kw(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function u(l){try{c(n.next(l))}catch(f){a(f)}}function s(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})};ry=function ry(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};function Tn(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}Dr=function Dr(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o};Tr=function Tr(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};function Pn(e){return this instanceof Pn?(this.v=e,this):new Pn(e)}function Hw(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(d){n[d]&&(i[d]=function(p){return new Promise(function(m,y){o.push([d,p,m,y])>1||u(d,p)})})}function u(d,p){try{s(n[d](p))}catch(m){f(o[0][3],m)}}function s(d){d.value instanceof Pn?Promise.resolve(d.value.v).then(c,l):f(o[0][2],d)}function c(d){u("next",d)}function l(d){u("throw",d)}function f(d,p){d(p),o.shift(),o.length&&u(o[0][0],o[0][1])}}function Vw(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Tn=="function"?Tn(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(a){return new Promise(function(u,s){a=e[o](a),i(u,s,a.done,a.value)})}}function i(o,a,u,s){Promise.resolve(s).then(function(c){o({value:c,done:u})},a)}}var ny=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function iy(e){return be(e?.then)}function oy(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Pc=oy(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
14
|
-
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
15
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function gl(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Xa=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=Tn(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(y){t={error:y}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(be(l))try{l()}catch(y){o=y instanceof Pc?y.errors:[y]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=Tn(f),p=d.next();!p.done;p=d.next()){var m=p.value;try{Id(m)}catch(y){o=o??[],y instanceof Pc?o=Tr(Tr([],Dr(o)),Dr(y.errors)):o.push(y)}}}catch(y){n={error:y}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}}if(o)throw new Pc(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Id(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&gl(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&gl(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),ay=Xa.EMPTY;function uy(e){return e instanceof Xa||e&&"closed"in e&&be(e.remove)&&be(e.add)&&be(e.unsubscribe)}function Id(e){be(e)?e():e.unsubscribe()}var sy={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},_l={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=_l.delegate;return i?.setTimeout?i.setTimeout.apply(i,Tr([e,t],Dr(r))):setTimeout.apply(void 0,Tr([e,t],Dr(r)))},clearTimeout:function(e){var t=_l.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function cy(e){_l.setTimeout(function(){throw e})}function Rd(){}function la(e){e()}var Cf=function(e){Gn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,uy(r)&&r.add(n)):n.destination=Yw,n}return t.create=function(r,n,i){return new Di(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Xa),zw=Function.prototype.bind;function $c(e,t){return zw.call(e,t)}var Qw=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Xo(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Xo(n)}else Xo(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Xo(r)}},e}(),Di=function(e){Gn(t,e);function t(r,n,i){var o=e.call(this)||this,a;if(be(r)||!r)a={next:r??void 0,error:n??void 0,complete:i??void 0};else{var u;o&&sy.useDeprecatedNextContext?(u=Object.create(r),u.unsubscribe=function(){return o.unsubscribe()},a={next:r.next&&$c(r.next,u),error:r.error&&$c(r.error,u),complete:r.complete&&$c(r.complete,u)}):a=r}return o.destination=new Qw(a),o}return t}(Cf);function Xo(e){cy(e)}function Gw(e){throw e}var Yw={closed:!0,next:Rd,error:Gw,complete:Rd},If=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Rf(e){return e}function Jw(e){return e.length===0?Rf:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var tt=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=Zw(t)?t:new Di(t,r,n);return la(function(){var a=i,u=a.operator,s=a.source;o.add(u?u.call(o,s):s?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=kd(r),new r(function(i,o){var a=new Di({next:function(u){try{t(u)}catch(s){o(s),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[If]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Jw(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=kd(t),new t(function(n,i){var o;r.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function kd(e){var t;return(t=e??sy.Promise)!==null&&t!==void 0?t:Promise}function Xw(e){return e&&be(e.next)&&be(e.error)&&be(e.complete)}function Zw(e){return e&&e instanceof Cf||Xw(e)&&uy(e)}function ly(e){return be(e[If])}function fy(e){return Symbol.asyncIterator&&be(e?.[Symbol.asyncIterator])}function dy(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function e1(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var hy=e1();function vy(e){return be(e?.[hy])}function py(e){return Hw(this,arguments,function(){var r,n,i,o;return ry(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Pn(r.read())];case 3:return n=a.sent(),i=n.value,o=n.done,o?[4,Pn(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Pn(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function yy(e){return be(e?.getReader)}function zr(e){if(e instanceof tt)return e;if(e!=null){if(ly(e))return t1(e);if(ny(e))return r1(e);if(iy(e))return n1(e);if(fy(e))return my(e);if(vy(e))return i1(e);if(yy(e))return o1(e)}throw dy(e)}function t1(e){return new tt(function(t){var r=e[If]();if(be(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function r1(e){return new tt(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function n1(e){return new tt(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,cy)})}function i1(e){return new tt(function(t){var r,n;try{for(var i=Tn(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function my(e){return new tt(function(t){a1(e,t).catch(function(r){return t.error(r)})})}function o1(e){return my(py(e))}function a1(e,t){var r,n,i,o;return Kw(this,void 0,void 0,function(){var a,u;return ry(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=Vw(e),s.label=1;case 1:return[4,r.next()];case 2:if(n=s.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),i={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Fn(e,t,r,n,i){return new u1(e,t,r,n,i)}var u1=function(e){Gn(t,e);function t(r,n,i,o,a,u){var s=e.call(this,r)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=n?function(c){try{n(c)}catch(l){r.error(l)}}:e.prototype._next,s._error=o?function(c){try{o(c)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=i?function(){try{i()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Cf),by={now:function(){return(by.delegate||Date).now()},delegate:void 0};function s1(e){return e&&be(e.schedule)}function gy(e){return e[e.length-1]}function kf(e){return s1(gy(e))?e.pop():void 0}function c1(e,t){return typeof gy(e)=="number"?e.pop():t}function Zt(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function _y(e,t){return t===void 0&&(t=0),Nt(function(r,n){r.subscribe(Fn(n,function(i){return Zt(n,e,function(){return n.next(i)},t)},function(){return Zt(n,e,function(){return n.complete()},t)},function(i){return Zt(n,e,function(){return n.error(i)},t)}))})}function wy(e,t){return t===void 0&&(t=0),Nt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function l1(e,t){return zr(e).pipe(wy(t),_y(t))}function f1(e,t){return zr(e).pipe(wy(t),_y(t))}function d1(e,t){return new tt(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function h1(e,t){return new tt(function(r){var n;return Zt(r,t,function(){n=e[hy](),Zt(r,t,function(){var i,o,a;try{i=n.next(),o=i.value,a=i.done}catch(u){r.error(u);return}a?r.complete():r.next(o)},0,!0)}),function(){return be(n?.return)&&n.return()}})}function Oy(e,t){if(!e)throw new Error("Iterable cannot be null");return new tt(function(r){Zt(r,t,function(){var n=e[Symbol.asyncIterator]();Zt(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}function v1(e,t){return Oy(py(e),t)}function p1(e,t){if(e!=null){if(ly(e))return l1(e,t);if(ny(e))return d1(e,t);if(iy(e))return f1(e,t);if(fy(e))return Oy(e,t);if(vy(e))return h1(e,t);if(yy(e))return v1(e,t)}throw dy(e)}function Sy(e,t){return t?p1(e,t):zr(e)}function _r(e,t){return Nt(function(r,n){var i=0;r.subscribe(Fn(n,function(o){n.next(e.call(t,o,i++))}))})}function y1(e,t,r,n,i,o,a,u){var s=[],c=0,l=0,f=!1,d=function(){f&&!s.length&&!c&&t.complete()},p=function(y){return c<n?m(y):s.push(y)},m=function(y){o&&t.next(y),c++;var _=!1;zr(r(y,l++)).subscribe(Fn(t,function(w){i?.(w),o?p(w):t.next(w)},function(){_=!0},void 0,function(){if(_)try{c--;for(var w=function(){var O=s.shift();a?Zt(t,a,function(){return m(O)}):m(O)};s.length&&c<n;)w();d()}catch(O){t.error(O)}}))};return e.subscribe(Fn(t,p,function(){f=!0,d()})),function(){u?.()}}function Za(e,t,r){return r===void 0&&(r=1/0),be(t)?Za(function(n,i){return _r(function(o,a){return t(n,o,i,a)})(zr(e(n,i)))},r):(typeof t=="number"&&(r=t),Nt(function(n,i){return y1(n,i,e,r)}))}var m1=Array.isArray;function b1(e){return e.length===1&&m1(e[0])?e[0]:e}function Ey(e){return e===void 0&&(e=1/0),Za(Rf,e)}function g1(){return Ey(1)}var _1=oy(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),jf=function(e){Gn(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new jd(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new _1},t.prototype.next=function(r){var n=this;la(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Tn(n.currentObservers),u=a.next();!u.done;u=a.next()){var s=u.value;s.next(r)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;la(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;la(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,a=i.isStopped,u=i.observers;return o||a?ay:(this.currentObservers=null,u.push(r),new Xa(function(){n.currentObservers=null,gl(u,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new tt;return r.source=this,r},t.create=function(r,n){return new jd(r,n)},t}(tt),jd=function(e){Gn(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:ay},t}(jf);function Md(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g1()(Sy(e,kf(e)))}function wl(e,t){return t===void 0&&(t=Rf),e=e??w1,Nt(function(r,n){var i,o=!0;r.subscribe(Fn(n,function(a){var u=t(a);(o||!e(i,u))&&(o=!1,i=u,n.next(a))}))})}function w1(e,t){return e===t}function $n(e,t){return Nt(function(r,n){var i=0;r.subscribe(Fn(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}function O1(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=kf(e),n=c1(e,1/0);return e=b1(e),Nt(function(i,o){Ey(n)(Sy(Tr([i],Dr(e)),r)).subscribe(o)})}function S1(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O1.apply(void 0,Tr([],Dr(e)))}var E1=function(e){Gn(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=by);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,a=n._infiniteTimeWindow,u=n._timestampProvider,s=n._windowTime;i||(o.push(r),!a&&o.push(u.now()+s)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,a=i._buffer,u=a.slice(),s=0;s<u.length&&!r.closed;s+=o?1:2)r.next(u[s]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,a=r._infiniteTimeWindow,u=(a?1:2)*n;if(n<1/0&&u<o.length&&o.splice(0,o.length-u),!a){for(var s=i.now(),c=0,l=1;l<o.length&&o[l]<=s;l+=2)c=l;c&&o.splice(0,c+1)}},t}(jf);function P1(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new jf}:t,n=e.resetOnError,i=n===void 0?!0:n,o=e.resetOnComplete,a=o===void 0?!0:o,u=e.resetOnRefCountZero,s=u===void 0?!0:u;return function(c){var l,f,d,p=0,m=!1,y=!1,_=function(){f?.unsubscribe(),f=void 0},w=function(){_(),l=d=void 0,m=y=!1},O=function(){var E=l;w(),E?.unsubscribe()};return Nt(function(E,A){p++,!y&&!m&&_();var P=d=d??r();A.add(function(){p--,p===0&&!y&&!m&&(f=Ac(O,s))}),P.subscribe(A),!l&&p>0&&(l=new Di({next:function(x){return P.next(x)},error:function(x){y=!0,_(),f=Ac(w,i,x),P.error(x)},complete:function(){m=!0,_(),f=Ac(w,a),P.complete()}}),zr(E).subscribe(l))})(c)}}function Ac(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(t===!0){e();return}if(t!==!1){var i=new Di({next:function(){i.unsubscribe(),e()}});return zr(t.apply(void 0,Tr([],Dr(r)))).subscribe(i)}}function Py(e,t,r){var n,i,o,a,u=!1;return e&&typeof e=="object"?(n=e.bufferSize,a=n===void 0?1/0:n,i=e.windowTime,t=i===void 0?1/0:i,o=e.refCount,u=o===void 0?!1:o,r=e.scheduler):a=e??1/0,P1({connector:function(){return new E1(a,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}function $y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=kf(e);return Nt(function(n,i){(r?Md(e,n,r):Md(e,n)).subscribe(i)})}function Ay(e){return e.documentData?e.documentData:e.previousDocumentData}function $1(e){switch(e.operation){case"INSERT":return{operation:e.operation,id:e.documentId,doc:e.documentData,previous:null};case"UPDATE":return{operation:e.operation,id:e.documentId,doc:me.deepFreezeWhenDevMode(e.documentData),previous:e.previousDocumentData?e.previousDocumentData:"UNKNOWN"};case"DELETE":return{operation:e.operation,id:e.documentId,doc:null,previous:e.previousDocumentData}}}let Z,Yn,X;ke={};Z={};Yn={};X={};Object.defineProperty(X,"__esModule",{value:!0});X.isFunction=void 0;function A1(e){return typeof e=="function"}X.isFunction=A1;var ge={},Qi={},yt={};Object.defineProperty(yt,"__esModule",{value:!0});yt.createErrorClass=void 0;function x1(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}yt.createErrorClass=x1;Object.defineProperty(Qi,"__esModule",{value:!0});Qi.UnsubscriptionError=void 0;var C1=yt;Qi.UnsubscriptionError=C1.createErrorClass(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
16
|
-
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
17
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});var at={};Object.defineProperty(at,"__esModule",{value:!0});at.arrRemove=void 0;function I1(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}at.arrRemove=I1;var Dd=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Td=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Fd=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ge,"__esModule",{value:!0});ge.isSubscription=ge.EMPTY_SUBSCRIPTION=ge.Subscription=void 0;var _i=X,xc=Qi,Ld=at,Mf=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=Dd(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(y){t={error:y}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(_i.isFunction(l))try{l()}catch(y){o=y instanceof xc.UnsubscriptionError?y.errors:[y]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=Dd(f),p=d.next();!p.done;p=d.next()){var m=p.value;try{Bd(m)}catch(y){o=o??[],y instanceof xc.UnsubscriptionError?o=Fd(Fd([],Td(o)),Td(y.errors)):o.push(y)}}}catch(y){n={error:y}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}}if(o)throw new xc.UnsubscriptionError(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Bd(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ld.arrRemove(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ld.arrRemove(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();ge.Subscription=Mf;ge.EMPTY_SUBSCRIPTION=Mf.EMPTY;function R1(e){return e instanceof Mf||e&&"closed"in e&&_i.isFunction(e.remove)&&_i.isFunction(e.add)&&_i.isFunction(e.unsubscribe)}ge.isSubscription=R1;function Bd(e){_i.isFunction(e)?e():e.unsubscribe()}var lr={};Object.defineProperty(lr,"__esModule",{value:!0});lr.config=void 0;lr.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Gi={},Df={};(function(e){var t=S&&S.__read||function(n,i){var o=typeof Symbol=="function"&&n[Symbol.iterator];if(!o)return n;var a=o.call(n),u,s=[],c;try{for(;(i===void 0||i-- >0)&&!(u=a.next()).done;)s.push(u.value)}catch(l){c={error:l}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(c)throw c.error}}return s},r=S&&S.__spreadArray||function(n,i){for(var o=0,a=i.length,u=n.length;o<a;o++,u++)n[u]=i[o];return n};Object.defineProperty(e,"__esModule",{value:!0}),e.timeoutProvider=void 0,e.timeoutProvider={setTimeout:function(n,i){for(var o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];var u=e.timeoutProvider.delegate;return u?.setTimeout?u.setTimeout.apply(u,r([n,i],t(o))):setTimeout.apply(void 0,r([n,i],t(o)))},clearTimeout:function(n){var i=e.timeoutProvider.delegate;return(i?.clearTimeout||clearTimeout)(n)},delegate:void 0}})(Df);Object.defineProperty(Gi,"__esModule",{value:!0});Gi.reportUnhandledError=void 0;var k1=lr,j1=Df;function M1(e){j1.timeoutProvider.setTimeout(function(){var t=k1.config.onUnhandledError;if(t)t(e);else throw e})}Gi.reportUnhandledError=M1;var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.noop=void 0;function D1(){}Oe.noop=D1;var vt={};Object.defineProperty(vt,"__esModule",{value:!0});vt.createNotification=vt.nextNotification=vt.errorNotification=vt.COMPLETE_NOTIFICATION=void 0;vt.COMPLETE_NOTIFICATION=function(){return eu("C",void 0,void 0)}();function T1(e){return eu("E",void 0,e)}vt.errorNotification=T1;function F1(e){return eu("N",e,void 0)}vt.nextNotification=F1;function eu(e,t,r){return{kind:e,value:t,error:r}}vt.createNotification=eu;var rr={};Object.defineProperty(rr,"__esModule",{value:!0});rr.captureError=rr.errorContext=void 0;var xy=lr,wr=null;function L1(e){if(xy.config.useDeprecatedSynchronousErrorHandling){var t=!wr;if(t&&(wr={errorThrown:!1,error:null}),e(),t){var r=wr,n=r.errorThrown,i=r.error;if(wr=null,n)throw i}}else e()}rr.errorContext=L1;function B1(e){xy.config.useDeprecatedSynchronousErrorHandling&&wr&&(wr.errorThrown=!0,wr.error=e)}rr.captureError=B1;(function(e){var t=S&&S.__extends||function(){var O=function(E,A){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,x){P.__proto__=x}||function(P,x){for(var C in x)Object.prototype.hasOwnProperty.call(x,C)&&(P[C]=x[C])},O(E,A)};return function(E,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");O(E,A);function P(){this.constructor=E}E.prototype=A===null?Object.create(A):(P.prototype=A.prototype,new P)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_OBSERVER=e.SafeSubscriber=e.Subscriber=void 0;var r=X,n=ge,i=lr,o=Gi,a=Oe,u=vt,s=Df,c=rr,l=function(O){t(E,O);function E(A){var P=O.call(this)||this;return P.isStopped=!1,A?(P.destination=A,n.isSubscription(A)&&A.add(P)):P.destination=e.EMPTY_OBSERVER,P}return E.create=function(A,P,x){return new m(A,P,x)},E.prototype.next=function(A){this.isStopped?w(u.nextNotification(A),this):this._next(A)},E.prototype.error=function(A){this.isStopped?w(u.errorNotification(A),this):(this.isStopped=!0,this._error(A))},E.prototype.complete=function(){this.isStopped?w(u.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},E.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,O.prototype.unsubscribe.call(this),this.destination=null)},E.prototype._next=function(A){this.destination.next(A)},E.prototype._error=function(A){try{this.destination.error(A)}finally{this.unsubscribe()}},E.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},E}(n.Subscription);e.Subscriber=l;var f=Function.prototype.bind;function d(O,E){return f.call(O,E)}var p=function(){function O(E){this.partialObserver=E}return O.prototype.next=function(E){var A=this.partialObserver;if(A.next)try{A.next(E)}catch(P){y(P)}},O.prototype.error=function(E){var A=this.partialObserver;if(A.error)try{A.error(E)}catch(P){y(P)}else y(E)},O.prototype.complete=function(){var E=this.partialObserver;if(E.complete)try{E.complete()}catch(A){y(A)}},O}(),m=function(O){t(E,O);function E(A,P,x){var C=O.call(this)||this,k;if(r.isFunction(A)||!A)k={next:A??void 0,error:P??void 0,complete:x??void 0};else{var M;C&&i.config.useDeprecatedNextContext?(M=Object.create(A),M.unsubscribe=function(){return C.unsubscribe()},k={next:A.next&&d(A.next,M),error:A.error&&d(A.error,M),complete:A.complete&&d(A.complete,M)}):k=A}return C.destination=new p(k),C}return E}(l);e.SafeSubscriber=m;function y(O){i.config.useDeprecatedSynchronousErrorHandling?c.captureError(O):o.reportUnhandledError(O)}function _(O){throw O}function w(O,E){var A=i.config.onStoppedNotification;A&&s.timeoutProvider.setTimeout(function(){return A(O,E)})}e.EMPTY_OBSERVER={closed:!0,next:a.noop,error:_,complete:a.noop}})(Yn);var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.observable=void 0;Qr.observable=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();var Tt={},Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.identity=void 0;function N1(e){return e}Se.identity=N1;Object.defineProperty(Tt,"__esModule",{value:!0});Tt.pipeFromArray=Tt.pipe=void 0;var U1=Se;function W1(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Cy(e)}Tt.pipe=W1;function Cy(e){return e.length===0?U1.identity:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}Tt.pipeFromArray=Cy;Object.defineProperty(Z,"__esModule",{value:!0});Z.Observable=void 0;var Ol=Yn,q1=ge,K1=Qr,H1=Tt,V1=lr,Cc=X,z1=rr,Q1=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=Y1(t)?t:new Ol.SafeSubscriber(t,r,n);return z1.errorContext(function(){var a=i,u=a.operator,s=a.source;o.add(u?u.call(o,s):s?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Nd(r),new r(function(i,o){var a=new Ol.SafeSubscriber({next:function(u){try{t(u)}catch(s){o(s),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[K1.observable]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return H1.pipeFromArray(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Nd(t),new t(function(n,i){var o;r.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();Z.Observable=Q1;function Nd(e){var t;return(t=e??V1.config.Promise)!==null&&t!==void 0?t:Promise}function G1(e){return e&&Cc.isFunction(e.next)&&Cc.isFunction(e.error)&&Cc.isFunction(e.complete)}function Y1(e){return e&&e instanceof Ol.Subscriber||G1(e)&&q1.isSubscription(e)}var Gr={},Yi={},D={};Object.defineProperty(D,"__esModule",{value:!0});D.operate=D.hasLift=void 0;var J1=X;function Iy(e){return J1.isFunction(e?.lift)}D.hasLift=Iy;function X1(e){return function(t){if(Iy(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}D.operate=X1;var F={},Z1=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(F,"__esModule",{value:!0});F.OperatorSubscriber=F.createOperatorSubscriber=void 0;var eO=Yn;function tO(e,t,r,n,i){return new Ry(e,t,r,n,i)}F.createOperatorSubscriber=tO;var Ry=function(e){Z1(t,e);function t(r,n,i,o,a,u){var s=e.call(this,r)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=n?function(c){try{n(c)}catch(l){r.error(l)}}:e.prototype._next,s._error=o?function(c){try{o(c)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=i?function(){try{i()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(eO.Subscriber);F.OperatorSubscriber=Ry;Object.defineProperty(Yi,"__esModule",{value:!0});Yi.refCount=void 0;var rO=D,nO=F;function iO(){return rO.operate(function(e,t){var r=null;e._refCount++;var n=nO.createOperatorSubscriber(t,void 0,void 0,void 0,function(){if(!e||e._refCount<=0||0<--e._refCount){r=null;return}var i=e._connection,o=r;r=null,i&&(!o||i===o)&&i.unsubscribe(),t.unsubscribe()});e.subscribe(n),n.closed||(r=e.connect())})}Yi.refCount=iO;var oO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.ConnectableObservable=void 0;var aO=Z,Ud=ge,uO=Yi,sO=F,cO=D,lO=function(e){oO(t,e);function t(r,n){var i=e.call(this)||this;return i.source=r,i.subjectFactory=n,i._subject=null,i._refCount=0,i._connection=null,cO.hasLift(r)&&(i.lift=r.lift),i}return t.prototype._subscribe=function(r){return this.getSubject().subscribe(r)},t.prototype.getSubject=function(){var r=this._subject;return(!r||r.isStopped)&&(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var r=this._connection;this._subject=this._connection=null,r?.unsubscribe()},t.prototype.connect=function(){var r=this,n=this._connection;if(!n){n=this._connection=new Ud.Subscription;var i=this.getSubject();n.add(this.source.subscribe(sO.createOperatorSubscriber(i,void 0,function(){r._teardown(),i.complete()},function(o){r._teardown(),i.error(o)},function(){return r._teardown()}))),n.closed&&(this._connection=null,n=Ud.Subscription.EMPTY)}return n},t.prototype.refCount=function(){return uO.refCount()(this)},t}(aO.Observable);Gr.ConnectableObservable=lO;var tu={},ky={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.performanceTimestampProvider=void 0,e.performanceTimestampProvider={now:function(){return(e.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}})(ky);var Tf={};(function(e){var t=S&&S.__read||function(i,o){var a=typeof Symbol=="function"&&i[Symbol.iterator];if(!a)return i;var u=a.call(i),s,c=[],l;try{for(;(o===void 0||o-- >0)&&!(s=u.next()).done;)c.push(s.value)}catch(f){l={error:f}}finally{try{s&&!s.done&&(a=u.return)&&a.call(u)}finally{if(l)throw l.error}}return c},r=S&&S.__spreadArray||function(i,o){for(var a=0,u=o.length,s=i.length;a<u;a++,s++)i[s]=o[a];return i};Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrameProvider=void 0;var n=ge;e.animationFrameProvider={schedule:function(i){var o=requestAnimationFrame,a=cancelAnimationFrame,u=e.animationFrameProvider.delegate;u&&(o=u.requestAnimationFrame,a=u.cancelAnimationFrame);var s=o(function(c){a=void 0,i(c)});return new n.Subscription(function(){return a?.(s)})},requestAnimationFrame:function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var a=e.animationFrameProvider.delegate;return(a?.requestAnimationFrame||requestAnimationFrame).apply(void 0,r([],t(i)))},cancelAnimationFrame:function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var a=e.animationFrameProvider.delegate;return(a?.cancelAnimationFrame||cancelAnimationFrame).apply(void 0,r([],t(i)))},delegate:void 0}})(Tf);Object.defineProperty(tu,"__esModule",{value:!0});tu.animationFrames=void 0;var fO=Z,dO=ky,Wd=Tf;function hO(e){return e?jy(e):vO}tu.animationFrames=hO;function jy(e){return new fO.Observable(function(t){var r=e||dO.performanceTimestampProvider,n=r.now(),i=0,o=function(){t.closed||(i=Wd.animationFrameProvider.requestAnimationFrame(function(a){i=0;var u=r.now();t.next({timestamp:e?u:a,elapsed:u-n}),o()}))};return o(),function(){i&&Wd.animationFrameProvider.cancelAnimationFrame(i)}})}var vO=jy(),de={},Ji={};Object.defineProperty(Ji,"__esModule",{value:!0});Ji.ObjectUnsubscribedError=void 0;var pO=yt;Ji.ObjectUnsubscribedError=pO.createErrorClass(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var My=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),yO=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(de,"__esModule",{value:!0});de.AnonymousSubject=de.Subject=void 0;var qd=Z,Sl=ge,mO=Ji,bO=at,Ic=rr,Dy=function(e){My(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new El(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new mO.ObjectUnsubscribedError},t.prototype.next=function(r){var n=this;Ic.errorContext(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=yO(n.currentObservers),u=a.next();!u.done;u=a.next()){var s=u.value;s.next(r)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;Ic.errorContext(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;Ic.errorContext(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,a=i.isStopped,u=i.observers;return o||a?Sl.EMPTY_SUBSCRIPTION:(this.currentObservers=null,u.push(r),new Sl.Subscription(function(){n.currentObservers=null,bO.arrRemove(u,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new qd.Observable;return r.source=this,r},t.create=function(r,n){return new El(r,n)},t}(qd.Observable);de.Subject=Dy;var El=function(e){My(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:Sl.EMPTY_SUBSCRIPTION},t}(Dy);de.AnonymousSubject=El;var Xi={},gO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Xi,"__esModule",{value:!0});Xi.BehaviorSubject=void 0;var _O=de,wO=function(e){gO(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,i=r.thrownError,o=r._value;if(n)throw i;return this._throwIfClosed(),o},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(_O.Subject);Xi.BehaviorSubject=wO;var Jn={},ru={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.dateTimestampProvider=void 0,e.dateTimestampProvider={now:function(){return(e.dateTimestampProvider.delegate||Date).now()},delegate:void 0}})(ru);var OO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Jn,"__esModule",{value:!0});Jn.ReplaySubject=void 0;var SO=de,EO=ru,PO=function(e){OO(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=EO.dateTimestampProvider);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,a=n._infiniteTimeWindow,u=n._timestampProvider,s=n._windowTime;i||(o.push(r),!a&&o.push(u.now()+s)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,a=i._buffer,u=a.slice(),s=0;s<u.length&&!r.closed;s+=o?1:2)r.next(u[s]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,a=r._infiniteTimeWindow,u=(a?1:2)*n;if(n<1/0&&u<o.length&&o.splice(0,o.length-u),!a){for(var s=i.now(),c=0,l=1;l<o.length&&o[l]<=s;l+=2)c=l;c&&o.splice(0,c+1)}},t}(SO.Subject);Jn.ReplaySubject=PO;var Xn={},$O=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Xn,"__esModule",{value:!0});Xn.AsyncSubject=void 0;var AO=de,xO=function(e){$O(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._value=null,r._hasValue=!1,r._isComplete=!1,r}return t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n._hasValue,a=n._value,u=n.thrownError,s=n.isStopped,c=n._isComplete;i?r.error(u):(s||c)&&(o&&r.next(a),r.complete())},t.prototype.next=function(r){this.isStopped||(this._value=r,this._hasValue=!0)},t.prototype.complete=function(){var r=this,n=r._hasValue,i=r._value,o=r._isComplete;o||(this._isComplete=!0,n&&e.prototype.next.call(this,i),e.prototype.complete.call(this))},t}(AO.Subject);Xn.AsyncSubject=xO;var Ty={},nu={},fr={},iu={},CO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(iu,"__esModule",{value:!0});iu.Action=void 0;var IO=ge,RO=function(e){CO(t,e);function t(r,n){return e.call(this)||this}return t.prototype.schedule=function(r,n){return this},t}(IO.Subscription);iu.Action=RO;var Fy={};(function(e){var t=S&&S.__read||function(n,i){var o=typeof Symbol=="function"&&n[Symbol.iterator];if(!o)return n;var a=o.call(n),u,s=[],c;try{for(;(i===void 0||i-- >0)&&!(u=a.next()).done;)s.push(u.value)}catch(l){c={error:l}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(c)throw c.error}}return s},r=S&&S.__spreadArray||function(n,i){for(var o=0,a=i.length,u=n.length;o<a;o++,u++)n[u]=i[o];return n};Object.defineProperty(e,"__esModule",{value:!0}),e.intervalProvider=void 0,e.intervalProvider={setInterval:function(n,i){for(var o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];var u=e.intervalProvider.delegate;return u?.setInterval?u.setInterval.apply(u,r([n,i],t(o))):setInterval.apply(void 0,r([n,i],t(o)))},clearInterval:function(n){var i=e.intervalProvider.delegate;return(i?.clearInterval||clearInterval)(n)},delegate:void 0}})(Fy);var kO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(fr,"__esModule",{value:!0});fr.AsyncAction=void 0;var jO=iu,Kd=Fy,MO=at,DO=function(e){kO(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.scheduler=r,i.work=n,i.pending=!1,i}return t.prototype.schedule=function(r,n){var i;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var o=this.id,a=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(a,o,n)),this.pending=!0,this.delay=n,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(a,this.id,n),this},t.prototype.requestAsyncId=function(r,n,i){return i===void 0&&(i=0),Kd.intervalProvider.setInterval(r.flush.bind(r,this),i)},t.prototype.recycleAsyncId=function(r,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;n!=null&&Kd.intervalProvider.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(r,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var i=!1,o;try{this.work(r)}catch(a){i=!0,o=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,i=r.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,MO.arrRemove(o,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(jO.Action);fr.AsyncAction=DO;var Ly={},Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.TestTools=Ln.Immediate=void 0;var TO=1,Rc,Pa={};function Hd(e){return e in Pa?(delete Pa[e],!0):!1}Ln.Immediate={setImmediate:function(e){var t=TO++;return Pa[t]=!0,Rc||(Rc=Promise.resolve()),Rc.then(function(){return Hd(t)&&e()}),t},clearImmediate:function(e){Hd(e)}};Ln.TestTools={pending:function(){return Object.keys(Pa).length}};(function(e){var t=S&&S.__read||function(a,u){var s=typeof Symbol=="function"&&a[Symbol.iterator];if(!s)return a;var c=s.call(a),l,f=[],d;try{for(;(u===void 0||u-- >0)&&!(l=c.next()).done;)f.push(l.value)}catch(p){d={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(d)throw d.error}}return f},r=S&&S.__spreadArray||function(a,u){for(var s=0,c=u.length,l=a.length;s<c;s++,l++)a[l]=u[s];return a};Object.defineProperty(e,"__esModule",{value:!0}),e.immediateProvider=void 0;var n=Ln,i=n.Immediate.setImmediate,o=n.Immediate.clearImmediate;e.immediateProvider={setImmediate:function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];var s=e.immediateProvider.delegate;return(s?.setImmediate||i).apply(void 0,r([],t(a)))},clearImmediate:function(a){var u=e.immediateProvider.delegate;return(u?.clearImmediate||o)(a)},delegate:void 0}})(Ly);var FO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(nu,"__esModule",{value:!0});nu.AsapAction=void 0;var LO=fr,Vd=Ly,BO=function(e){FO(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.scheduler=r,i.work=n,i}return t.prototype.requestAsyncId=function(r,n,i){return i===void 0&&(i=0),i!==null&&i>0?e.prototype.requestAsyncId.call(this,r,n,i):(r.actions.push(this),r._scheduled||(r._scheduled=Vd.immediateProvider.setImmediate(r.flush.bind(r,void 0))))},t.prototype.recycleAsyncId=function(r,n,i){var o;if(i===void 0&&(i=0),i!=null?i>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,i);var a=r.actions;n!=null&&((o=a[a.length-1])===null||o===void 0?void 0:o.id)!==n&&(Vd.immediateProvider.clearImmediate(n),r._scheduled===n&&(r._scheduled=void 0))},t}(LO.AsyncAction);nu.AsapAction=BO;var ou={},dr={},Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.Scheduler=void 0;var NO=ru,UO=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=NO.dateTimestampProvider.now,e}();Zi.Scheduler=UO;var WO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(dr,"__esModule",{value:!0});dr.AsyncScheduler=void 0;var zd=Zi,qO=function(e){WO(t,e);function t(r,n){n===void 0&&(n=zd.Scheduler.now);var i=e.call(this,r,n)||this;return i.actions=[],i._active=!1,i}return t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var i;this._active=!0;do if(i=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,i){for(;r=n.shift();)r.unsubscribe();throw i}},t}(zd.Scheduler);dr.AsyncScheduler=qO;var KO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(ou,"__esModule",{value:!0});ou.AsapScheduler=void 0;var HO=dr,VO=function(e){KO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var i=this.actions,o;r=r||i.shift();do if(o=r.execute(r.state,r.delay))break;while((r=i[0])&&r.id===n&&i.shift());if(this._active=!1,o){for(;(r=i[0])&&r.id===n&&i.shift();)r.unsubscribe();throw o}},t}(HO.AsyncScheduler);ou.AsapScheduler=VO;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.asap=e.asapScheduler=void 0;var t=nu,r=ou;e.asapScheduler=new r.AsapScheduler(t.AsapAction),e.asap=e.asapScheduler})(Ty);var qe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.async=e.asyncScheduler=void 0;var t=fr,r=dr;e.asyncScheduler=new r.AsyncScheduler(t.AsyncAction),e.async=e.asyncScheduler})(qe);var By={},au={},zO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(au,"__esModule",{value:!0});au.QueueAction=void 0;var QO=fr,GO=function(e){zO(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.scheduler=r,i.work=n,i}return t.prototype.schedule=function(r,n){return n===void 0&&(n=0),n>0?e.prototype.schedule.call(this,r,n):(this.delay=n,this.state=r,this.scheduler.flush(this),this)},t.prototype.execute=function(r,n){return n>0||this.closed?e.prototype.execute.call(this,r,n):this._execute(r,n)},t.prototype.requestAsyncId=function(r,n,i){return i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0?e.prototype.requestAsyncId.call(this,r,n,i):(r.flush(this),0)},t}(QO.AsyncAction);au.QueueAction=GO;var uu={},YO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(uu,"__esModule",{value:!0});uu.QueueScheduler=void 0;var JO=dr,XO=function(e){YO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(JO.AsyncScheduler);uu.QueueScheduler=XO;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.queue=e.queueScheduler=void 0;var t=au,r=uu;e.queueScheduler=new r.QueueScheduler(t.QueueAction),e.queue=e.queueScheduler})(By);var Ny={},su={},ZO=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(su,"__esModule",{value:!0});su.AnimationFrameAction=void 0;var eS=fr,Qd=Tf,tS=function(e){ZO(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.scheduler=r,i.work=n,i}return t.prototype.requestAsyncId=function(r,n,i){return i===void 0&&(i=0),i!==null&&i>0?e.prototype.requestAsyncId.call(this,r,n,i):(r.actions.push(this),r._scheduled||(r._scheduled=Qd.animationFrameProvider.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,i){var o;if(i===void 0&&(i=0),i!=null?i>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,i);var a=r.actions;n!=null&&((o=a[a.length-1])===null||o===void 0?void 0:o.id)!==n&&(Qd.animationFrameProvider.cancelAnimationFrame(n),r._scheduled=void 0)},t}(eS.AsyncAction);su.AnimationFrameAction=tS;var cu={},rS=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(cu,"__esModule",{value:!0});cu.AnimationFrameScheduler=void 0;var nS=dr,iS=function(e){rS(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var i=this.actions,o;r=r||i.shift();do if(o=r.execute(r.state,r.delay))break;while((r=i[0])&&r.id===n&&i.shift());if(this._active=!1,o){for(;(r=i[0])&&r.id===n&&i.shift();)r.unsubscribe();throw o}},t}(nS.AsyncScheduler);cu.AnimationFrameScheduler=iS;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.animationFrame=e.animationFrameScheduler=void 0;var t=su,r=cu;e.animationFrameScheduler=new r.AnimationFrameScheduler(t.AnimationFrameAction),e.animationFrame=e.animationFrameScheduler})(Ny);var Bn={},Uy=S&&S.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.VirtualAction=Bn.VirtualTimeScheduler=void 0;var oS=fr,aS=ge,uS=dr,sS=function(e){Uy(t,e);function t(r,n){r===void 0&&(r=Wy),n===void 0&&(n=1/0);var i=e.call(this,r,function(){return i.frame})||this;return i.maxFrames=n,i.frame=0,i.index=-1,i}return t.prototype.flush=function(){for(var r=this,n=r.actions,i=r.maxFrames,o,a;(a=n[0])&&a.delay<=i&&(n.shift(),this.frame=a.delay,!(o=a.execute(a.state,a.delay))););if(o){for(;a=n.shift();)a.unsubscribe();throw o}},t.frameTimeFactor=10,t}(uS.AsyncScheduler);Bn.VirtualTimeScheduler=sS;var Wy=function(e){Uy(t,e);function t(r,n,i){i===void 0&&(i=r.index+=1);var o=e.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.index=i,o.active=!0,o.index=r.index=i,o}return t.prototype.schedule=function(r,n){if(n===void 0&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}else return aS.Subscription.EMPTY},t.prototype.requestAsyncId=function(r,n,i){i===void 0&&(i=0),this.delay=r.frame+i;var o=r.actions;return o.push(this),o.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(r,n,i){},t.prototype._execute=function(r,n){if(this.active===!0)return e.prototype._execute.call(this,r,n)},t.sortActions=function(r,n){return r.delay===n.delay?r.index===n.index?0:r.index>n.index?1:-1:r.delay>n.delay?1:-1},t}(oS.AsyncAction);Bn.VirtualAction=Wy;var lu={},rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.empty=e.EMPTY=void 0;var t=Z;e.EMPTY=new t.Observable(function(i){return i.complete()});function r(i){return i?n(i):e.EMPTY}e.empty=r;function n(i){return new t.Observable(function(o){return i.schedule(function(){return o.complete()})})}})(rt);var Zn={},pe={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.isScheduler=void 0;var cS=X;function lS(e){return e&&cS.isFunction(e.schedule)}Yr.isScheduler=lS;Object.defineProperty(pe,"__esModule",{value:!0});pe.popNumber=pe.popScheduler=pe.popResultSelector=void 0;var fS=X,dS=Yr;function Ff(e){return e[e.length-1]}function hS(e){return fS.isFunction(Ff(e))?e.pop():void 0}pe.popResultSelector=hS;function vS(e){return dS.isScheduler(Ff(e))?e.pop():void 0}pe.popScheduler=vS;function pS(e,t){return typeof Ff(e)=="number"?e.pop():t}pe.popNumber=pS;var ut={},eo={},fu={},L={},ei={};Object.defineProperty(ei,"__esModule",{value:!0});ei.isArrayLike=void 0;ei.isArrayLike=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};var to={};Object.defineProperty(to,"__esModule",{value:!0});to.isPromise=void 0;var yS=X;function mS(e){return yS.isFunction(e?.then)}to.isPromise=mS;var ro={};Object.defineProperty(ro,"__esModule",{value:!0});ro.isInteropObservable=void 0;var bS=Qr,gS=X;function _S(e){return gS.isFunction(e[bS.observable])}ro.isInteropObservable=_S;var no={};Object.defineProperty(no,"__esModule",{value:!0});no.isAsyncIterable=void 0;var wS=X;function OS(e){return Symbol.asyncIterator&&wS.isFunction(e?.[Symbol.asyncIterator])}no.isAsyncIterable=OS;var io={};Object.defineProperty(io,"__esModule",{value:!0});io.createInvalidObservableTypeError=void 0;function SS(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}io.createInvalidObservableTypeError=SS;var oo={},Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.iterator=Fr.getSymbolIterator=void 0;function qy(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}Fr.getSymbolIterator=qy;Fr.iterator=qy();Object.defineProperty(oo,"__esModule",{value:!0});oo.isIterable=void 0;var ES=Fr,PS=X;function $S(e){return PS.isFunction(e?.[ES.iterator])}oo.isIterable=$S;var nr={},AS=S&&S.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},An=S&&S.__await||function(e){return this instanceof An?(this.v=e,this):new An(e)},xS=S&&S.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(d){n[d]&&(i[d]=function(p){return new Promise(function(m,y){o.push([d,p,m,y])>1||u(d,p)})})}function u(d,p){try{s(n[d](p))}catch(m){f(o[0][3],m)}}function s(d){d.value instanceof An?Promise.resolve(d.value.v).then(c,l):f(o[0][2],d)}function c(d){u("next",d)}function l(d){u("throw",d)}function f(d,p){d(p),o.shift(),o.length&&u(o[0][0],o[0][1])}};Object.defineProperty(nr,"__esModule",{value:!0});nr.isReadableStreamLike=nr.readableStreamLikeToAsyncGenerator=void 0;var CS=X;function IS(e){return xS(this,arguments,function(){var r,n,i,o;return AS(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,An(r.read())];case 3:return n=a.sent(),i=n.value,o=n.done,o?[4,An(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,An(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}nr.readableStreamLikeToAsyncGenerator=IS;function RS(e){return CS.isFunction(e?.getReader)}nr.isReadableStreamLike=RS;var kS=S&&S.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function u(l){try{c(n.next(l))}catch(f){a(f)}}function s(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})},jS=S&&S.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},MS=S&&S.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Pl=="function"?Pl(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(a){return new Promise(function(u,s){a=e[o](a),i(u,s,a.done,a.value)})}}function i(o,a,u,s){Promise.resolve(s).then(function(c){o({value:c,done:u})},a)}},Pl=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(L,"__esModule",{value:!0});L.fromReadableStreamLike=L.fromAsyncIterable=L.fromIterable=L.fromPromise=L.fromArrayLike=L.fromInteropObservable=L.innerFrom=void 0;var DS=ei,TS=to,ti=Z,FS=ro,LS=no,BS=io,NS=oo,Ky=nr,US=X,WS=Gi,qS=Qr;function KS(e){if(e instanceof ti.Observable)return e;if(e!=null){if(FS.isInteropObservable(e))return Hy(e);if(DS.isArrayLike(e))return Vy(e);if(TS.isPromise(e))return zy(e);if(LS.isAsyncIterable(e))return Lf(e);if(NS.isIterable(e))return Qy(e);if(Ky.isReadableStreamLike(e))return Gy(e)}throw BS.createInvalidObservableTypeError(e)}L.innerFrom=KS;function Hy(e){return new ti.Observable(function(t){var r=e[qS.observable]();if(US.isFunction(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}L.fromInteropObservable=Hy;function Vy(e){return new ti.Observable(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}L.fromArrayLike=Vy;function zy(e){return new ti.Observable(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,WS.reportUnhandledError)})}L.fromPromise=zy;function Qy(e){return new ti.Observable(function(t){var r,n;try{for(var i=Pl(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}L.fromIterable=Qy;function Lf(e){return new ti.Observable(function(t){HS(e,t).catch(function(r){return t.error(r)})})}L.fromAsyncIterable=Lf;function Gy(e){return Lf(Ky.readableStreamLikeToAsyncGenerator(e))}L.fromReadableStreamLike=Gy;function HS(e,t){var r,n,i,o;return kS(this,void 0,void 0,function(){var a,u;return jS(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=MS(e),s.label=1;case 1:return[4,r.next()];case 2:if(n=s.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),i={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}var Jr={},st={};Object.defineProperty(st,"__esModule",{value:!0});st.executeSchedule=void 0;function VS(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}st.executeSchedule=VS;Object.defineProperty(Jr,"__esModule",{value:!0});Jr.observeOn=void 0;var kc=st,zS=D,QS=F;function GS(e,t){return t===void 0&&(t=0),zS.operate(function(r,n){r.subscribe(QS.createOperatorSubscriber(n,function(i){return kc.executeSchedule(n,e,function(){return n.next(i)},t)},function(){return kc.executeSchedule(n,e,function(){return n.complete()},t)},function(i){return kc.executeSchedule(n,e,function(){return n.error(i)},t)}))})}Jr.observeOn=GS;var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.subscribeOn=void 0;var YS=D;function JS(e,t){return t===void 0&&(t=0),YS.operate(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}Xr.subscribeOn=JS;Object.defineProperty(fu,"__esModule",{value:!0});fu.scheduleObservable=void 0;var XS=L,ZS=Jr,eE=Xr;function tE(e,t){return XS.innerFrom(e).pipe(eE.subscribeOn(t),ZS.observeOn(t))}fu.scheduleObservable=tE;var du={};Object.defineProperty(du,"__esModule",{value:!0});du.schedulePromise=void 0;var rE=L,nE=Jr,iE=Xr;function oE(e,t){return rE.innerFrom(e).pipe(iE.subscribeOn(t),nE.observeOn(t))}du.schedulePromise=oE;var hu={};Object.defineProperty(hu,"__esModule",{value:!0});hu.scheduleArray=void 0;var aE=Z;function uE(e,t){return new aE.Observable(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}hu.scheduleArray=uE;var ao={};Object.defineProperty(ao,"__esModule",{value:!0});ao.scheduleIterable=void 0;var sE=Z,cE=Fr,lE=X,Gd=st;function fE(e,t){return new sE.Observable(function(r){var n;return Gd.executeSchedule(r,t,function(){n=e[cE.iterator](),Gd.executeSchedule(r,t,function(){var i,o,a;try{i=n.next(),o=i.value,a=i.done}catch(u){r.error(u);return}a?r.complete():r.next(o)},0,!0)}),function(){return lE.isFunction(n?.return)&&n.return()}})}ao.scheduleIterable=fE;var uo={};Object.defineProperty(uo,"__esModule",{value:!0});uo.scheduleAsyncIterable=void 0;var dE=Z,Yd=st;function hE(e,t){if(!e)throw new Error("Iterable cannot be null");return new dE.Observable(function(r){Yd.executeSchedule(r,t,function(){var n=e[Symbol.asyncIterator]();Yd.executeSchedule(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}uo.scheduleAsyncIterable=hE;var vu={};Object.defineProperty(vu,"__esModule",{value:!0});vu.scheduleReadableStreamLike=void 0;var vE=uo,pE=nr;function yE(e,t){return vE.scheduleAsyncIterable(pE.readableStreamLikeToAsyncGenerator(e),t)}vu.scheduleReadableStreamLike=yE;Object.defineProperty(eo,"__esModule",{value:!0});eo.scheduled=void 0;var mE=fu,bE=du,gE=hu,_E=ao,wE=uo,OE=ro,SE=to,EE=ei,PE=oo,$E=no,AE=io,xE=nr,CE=vu;function IE(e,t){if(e!=null){if(OE.isInteropObservable(e))return mE.scheduleObservable(e,t);if(EE.isArrayLike(e))return gE.scheduleArray(e,t);if(SE.isPromise(e))return bE.schedulePromise(e,t);if($E.isAsyncIterable(e))return wE.scheduleAsyncIterable(e,t);if(PE.isIterable(e))return _E.scheduleIterable(e,t);if(xE.isReadableStreamLike(e))return CE.scheduleReadableStreamLike(e,t)}throw AE.createInvalidObservableTypeError(e)}eo.scheduled=IE;Object.defineProperty(ut,"__esModule",{value:!0});ut.from=void 0;var RE=eo,kE=L;function jE(e,t){return t?RE.scheduled(e,t):kE.innerFrom(e)}ut.from=jE;Object.defineProperty(Zn,"__esModule",{value:!0});Zn.of=void 0;var ME=pe,DE=ut;function TE(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ME.popScheduler(e);return DE.from(e,r)}Zn.of=TE;var so={};Object.defineProperty(so,"__esModule",{value:!0});so.throwError=void 0;var FE=Z,LE=X;function BE(e,t){var r=LE.isFunction(e)?e:function(){return e},n=function(i){return i.error(r())};return new FE.Observable(t?function(i){return t.schedule(n,0,i)}:n)}so.throwError=BE;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.observeNotification=e.Notification=e.NotificationKind=void 0;var t=rt,r=Zn,n=so,i=X;(function(u){u.NEXT="N",u.ERROR="E",u.COMPLETE="C"})(e.NotificationKind||(e.NotificationKind={}));var o=function(){function u(s,c,l){this.kind=s,this.value=c,this.error=l,this.hasValue=s==="N"}return u.prototype.observe=function(s){return a(this,s)},u.prototype.do=function(s,c,l){var f=this,d=f.kind,p=f.value,m=f.error;return d==="N"?s?.(p):d==="E"?c?.(m):l?.()},u.prototype.accept=function(s,c,l){var f;return i.isFunction((f=s)===null||f===void 0?void 0:f.next)?this.observe(s):this.do(s,c,l)},u.prototype.toObservable=function(){var s=this,c=s.kind,l=s.value,f=s.error,d=c==="N"?r.of(l):c==="E"?n.throwError(function(){return f}):c==="C"?t.EMPTY:0;if(!d)throw new TypeError("Unexpected notification kind "+c);return d},u.createNext=function(s){return new u("N",s)},u.createError=function(s){return new u("E",void 0,s)},u.createComplete=function(){return u.completeNotification},u.completeNotification=new u("C"),u}();e.Notification=o;function a(u,s){var c,l,f,d=u,p=d.kind,m=d.value,y=d.error;if(typeof p!="string")throw new TypeError('Invalid notification, missing "kind"');p==="N"?(c=s.next)===null||c===void 0||c.call(s,m):p==="E"?(l=s.error)===null||l===void 0||l.call(s,y):(f=s.complete)===null||f===void 0||f.call(s)}e.observeNotification=a})(lu);var pu={};Object.defineProperty(pu,"__esModule",{value:!0});pu.isObservable=void 0;var NE=Z,Jd=X;function UE(e){return!!e&&(e instanceof NE.Observable||Jd.isFunction(e.lift)&&Jd.isFunction(e.subscribe))}pu.isObservable=UE;var yu={},mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.EmptyError=void 0;var WE=yt;mt.EmptyError=WE.createErrorClass(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});Object.defineProperty(yu,"__esModule",{value:!0});yu.lastValueFrom=void 0;var qE=mt;function KE(e,t){var r=typeof t=="object";return new Promise(function(n,i){var o=!1,a;e.subscribe({next:function(u){a=u,o=!0},error:i,complete:function(){o?n(a):r?n(t.defaultValue):i(new qE.EmptyError)}})})}yu.lastValueFrom=KE;var mu={};Object.defineProperty(mu,"__esModule",{value:!0});mu.firstValueFrom=void 0;var HE=mt,VE=Yn;function zE(e,t){var r=typeof t=="object";return new Promise(function(n,i){var o=new VE.SafeSubscriber({next:function(a){n(a),o.unsubscribe()},error:i,complete:function(){r?n(t.defaultValue):i(new HE.EmptyError)}});e.subscribe(o)})}mu.firstValueFrom=zE;var co={};Object.defineProperty(co,"__esModule",{value:!0});co.ArgumentOutOfRangeError=void 0;var QE=yt;co.ArgumentOutOfRangeError=QE.createErrorClass(function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}});var lo={};Object.defineProperty(lo,"__esModule",{value:!0});lo.NotFoundError=void 0;var GE=yt;lo.NotFoundError=GE.createErrorClass(function(e){return function(r){e(this),this.name="NotFoundError",this.message=r}});var fo={};Object.defineProperty(fo,"__esModule",{value:!0});fo.SequenceError=void 0;var YE=yt;fo.SequenceError=YE.createErrorClass(function(e){return function(r){e(this),this.name="SequenceError",this.message=r}});var $a={},ri={};Object.defineProperty(ri,"__esModule",{value:!0});ri.isValidDate=void 0;function JE(e){return e instanceof Date&&!isNaN(e)}ri.isValidDate=JE;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeout=e.TimeoutError=void 0;var t=qe,r=ri,n=D,i=L,o=yt,a=F,u=st;e.TimeoutError=o.createErrorClass(function(l){return function(d){d===void 0&&(d=null),l(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=d}});function s(l,f){var d=r.isValidDate(l)?{first:l}:typeof l=="number"?{each:l}:l,p=d.first,m=d.each,y=d.with,_=y===void 0?c:y,w=d.scheduler,O=w===void 0?f??t.asyncScheduler:w,E=d.meta,A=E===void 0?null:E;if(p==null&&m==null)throw new TypeError("No timeout provided.");return n.operate(function(P,x){var C,k,M=null,N=0,K=function(Y){k=u.executeSchedule(x,O,function(){try{C.unsubscribe(),i.innerFrom(_({meta:A,lastValue:M,seen:N})).subscribe(x)}catch(Q){x.error(Q)}},Y)};C=P.subscribe(a.createOperatorSubscriber(x,function(Y){k?.unsubscribe(),N++,x.next(M=Y),m>0&&K(m)},void 0,void 0,function(){k?.closed||k?.unsubscribe(),M=null})),!N&&K(p!=null?typeof p=="number"?p:+p-O.now():m)})}e.timeout=s;function c(l){throw new e.TimeoutError(l)}})($a);var bu={},ho={},bt={},gt={};Object.defineProperty(gt,"__esModule",{value:!0});gt.map=void 0;var XE=D,ZE=F;function eP(e,t){return XE.operate(function(r,n){var i=0;r.subscribe(ZE.createOperatorSubscriber(n,function(o){n.next(e.call(t,o,i++))}))})}gt.map=eP;var tP=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},rP=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(bt,"__esModule",{value:!0});bt.mapOneOrManyArgs=void 0;var nP=gt,iP=Array.isArray;function oP(e,t){return iP(t)?e.apply(void 0,rP([],tP(t))):e(t)}function aP(e){return nP.map(function(t){return oP(e,t)})}bt.mapOneOrManyArgs=aP;var uP=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Xd=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ho,"__esModule",{value:!0});ho.bindCallbackInternals=void 0;var sP=Yr,cP=Z,lP=Xr,fP=bt,dP=Jr,hP=Xn;function $l(e,t,r,n){if(r)if(sP.isScheduler(r))n=r;else return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return $l(e,t,n).apply(this,i).pipe(fP.mapOneOrManyArgs(r))};return n?function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return $l(e,t).apply(this,i).pipe(lP.subscribeOn(n),dP.observeOn(n))}:function(){for(var i=this,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var u=new hP.AsyncSubject,s=!0;return new cP.Observable(function(c){var l=u.subscribe(c);if(s){s=!1;var f=!1,d=!1;t.apply(i,Xd(Xd([],uP(o)),[function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];if(e){var y=p.shift();if(y!=null){u.error(y);return}}u.next(1<p.length?p:p[0]),d=!0,f&&u.complete()}])),d&&u.complete(),f=!0}return l})}}ho.bindCallbackInternals=$l;Object.defineProperty(bu,"__esModule",{value:!0});bu.bindCallback=void 0;var vP=ho;function pP(e,t,r){return vP.bindCallbackInternals(!1,e,t,r)}bu.bindCallback=pP;var gu={};Object.defineProperty(gu,"__esModule",{value:!0});gu.bindNodeCallback=void 0;var yP=ho;function mP(e,t,r){return yP.bindCallbackInternals(!0,e,t,r)}gu.bindNodeCallback=mP;var ir={},vo={};Object.defineProperty(vo,"__esModule",{value:!0});vo.argsArgArrayOrObject=void 0;var bP=Array.isArray,gP=Object.getPrototypeOf,_P=Object.prototype,wP=Object.keys;function OP(e){if(e.length===1){var t=e[0];if(bP(t))return{args:t,keys:null};if(SP(t)){var r=wP(t);return{args:r.map(function(n){return t[n]}),keys:r}}}return{args:e,keys:null}}vo.argsArgArrayOrObject=OP;function SP(e){return e&&typeof e=="object"&&gP(e)===_P}var po={};Object.defineProperty(po,"__esModule",{value:!0});po.createObject=void 0;function EP(e,t){return e.reduce(function(r,n,i){return r[n]=t[i],r},{})}po.createObject=EP;Object.defineProperty(ir,"__esModule",{value:!0});ir.combineLatestInit=ir.combineLatest=void 0;var PP=Z,$P=vo,Yy=ut,Jy=Se,AP=bt,Zd=pe,xP=po,CP=F,IP=st;function RP(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Zd.popScheduler(e),n=Zd.popResultSelector(e),i=$P.argsArgArrayOrObject(e),o=i.args,a=i.keys;if(o.length===0)return Yy.from([],r);var u=new PP.Observable(Xy(o,r,a?function(s){return xP.createObject(a,s)}:Jy.identity));return n?u.pipe(AP.mapOneOrManyArgs(n)):u}ir.combineLatest=RP;function Xy(e,t,r){return r===void 0&&(r=Jy.identity),function(n){eh(t,function(){for(var i=e.length,o=new Array(i),a=i,u=i,s=function(l){eh(t,function(){var f=Yy.from(e[l],t),d=!1;f.subscribe(CP.createOperatorSubscriber(n,function(p){o[l]=p,d||(d=!0,u--),u||n.next(r(o.slice()))},function(){--a||n.complete()}))},n)},c=0;c<i;c++)s(c)},n)}}ir.combineLatestInit=Xy;function eh(e,t,r){e?IP.executeSchedule(r,e,t):t()}var Zr={},ni={},en={},ct={},ii={};Object.defineProperty(ii,"__esModule",{value:!0});ii.mergeInternals=void 0;var kP=L,jP=st,th=F;function MP(e,t,r,n,i,o,a,u){var s=[],c=0,l=0,f=!1,d=function(){f&&!s.length&&!c&&t.complete()},p=function(y){return c<n?m(y):s.push(y)},m=function(y){o&&t.next(y),c++;var _=!1;kP.innerFrom(r(y,l++)).subscribe(th.createOperatorSubscriber(t,function(w){i?.(w),o?p(w):t.next(w)},function(){_=!0},void 0,function(){if(_)try{c--;for(var w=function(){var O=s.shift();a?jP.executeSchedule(t,a,function(){return m(O)}):m(O)};s.length&&c<n;)w();d()}catch(O){t.error(O)}}))};return e.subscribe(th.createOperatorSubscriber(t,p,function(){f=!0,d()})),function(){u?.()}}ii.mergeInternals=MP;Object.defineProperty(ct,"__esModule",{value:!0});ct.mergeMap=void 0;var DP=gt,TP=L,FP=D,LP=ii,BP=X;function Zy(e,t,r){return r===void 0&&(r=1/0),BP.isFunction(t)?Zy(function(n,i){return DP.map(function(o,a){return t(n,o,i,a)})(TP.innerFrom(e(n,i)))},r):(typeof t=="number"&&(r=t),FP.operate(function(n,i){return LP.mergeInternals(n,i,e,r)}))}ct.mergeMap=Zy;Object.defineProperty(en,"__esModule",{value:!0});en.mergeAll=void 0;var NP=ct,UP=Se;function WP(e){return e===void 0&&(e=1/0),NP.mergeMap(UP.identity,e)}en.mergeAll=WP;Object.defineProperty(ni,"__esModule",{value:!0});ni.concatAll=void 0;var qP=en;function KP(){return qP.mergeAll(1)}ni.concatAll=KP;Object.defineProperty(Zr,"__esModule",{value:!0});Zr.concat=void 0;var HP=ni,VP=pe,zP=ut;function QP(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return HP.concatAll()(zP.from(e,VP.popScheduler(e)))}Zr.concat=QP;var _u={},tn={};Object.defineProperty(tn,"__esModule",{value:!0});tn.defer=void 0;var GP=Z,YP=L;function JP(e){return new GP.Observable(function(t){YP.innerFrom(e()).subscribe(t)})}tn.defer=JP;Object.defineProperty(_u,"__esModule",{value:!0});_u.connectable=void 0;var XP=de,ZP=Z,e$=tn,t$={connector:function(){return new XP.Subject},resetOnDisconnect:!0};function r$(e,t){t===void 0&&(t=t$);var r=null,n=t.connector,i=t.resetOnDisconnect,o=i===void 0?!0:i,a=n(),u=new ZP.Observable(function(s){return a.subscribe(s)});return u.connect=function(){return(!r||r.closed)&&(r=e$.defer(function(){return e}).subscribe(a),o&&r.add(function(){return a=n()})),r},u}_u.connectable=r$;var wu={};Object.defineProperty(wu,"__esModule",{value:!0});wu.forkJoin=void 0;var n$=Z,i$=vo,o$=L,a$=pe,u$=F,s$=bt,c$=po;function l$(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=a$.popResultSelector(e),n=i$.argsArgArrayOrObject(e),i=n.args,o=n.keys,a=new n$.Observable(function(u){var s=i.length;if(!s){u.complete();return}for(var c=new Array(s),l=s,f=s,d=function(m){var y=!1;o$.innerFrom(i[m]).subscribe(u$.createOperatorSubscriber(u,function(_){y||(y=!0,f--),c[m]=_},function(){return l--},void 0,function(){(!l||!y)&&(f||u.next(o?c$.createObject(o,c):c),u.complete())}))},p=0;p<s;p++)d(p)});return r?a.pipe(s$.mapOneOrManyArgs(r)):a}wu.forkJoin=l$;var Ou={},f$=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.fromEvent=void 0;var d$=L,h$=Z,v$=ct,p$=ei,Lr=X,y$=bt,m$=["addListener","removeListener"],b$=["addEventListener","removeEventListener"],g$=["on","off"];function Al(e,t,r,n){if(Lr.isFunction(r)&&(n=r,r=void 0),n)return Al(e,t,r).pipe(y$.mapOneOrManyArgs(n));var i=f$(O$(e)?b$.map(function(u){return function(s){return e[u](t,s,r)}}):_$(e)?m$.map(rh(e,t)):w$(e)?g$.map(rh(e,t)):[],2),o=i[0],a=i[1];if(!o&&p$.isArrayLike(e))return v$.mergeMap(function(u){return Al(u,t,r)})(d$.innerFrom(e));if(!o)throw new TypeError("Invalid event target");return new h$.Observable(function(u){var s=function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];return u.next(1<c.length?c:c[0])};return o(s),function(){return a(s)}})}Ou.fromEvent=Al;function rh(e,t){return function(r){return function(n){return e[r](t,n)}}}function _$(e){return Lr.isFunction(e.addListener)&&Lr.isFunction(e.removeListener)}function w$(e){return Lr.isFunction(e.on)&&Lr.isFunction(e.off)}function O$(e){return Lr.isFunction(e.addEventListener)&&Lr.isFunction(e.removeEventListener)}var Su={};Object.defineProperty(Su,"__esModule",{value:!0});Su.fromEventPattern=void 0;var S$=Z,E$=X,P$=bt;function em(e,t,r){return r?em(e,t).pipe(P$.mapOneOrManyArgs(r)):new S$.Observable(function(n){var i=function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];return n.next(a.length===1?a[0]:a)},o=e(i);return E$.isFunction(t)?function(){return t(i,o)}:void 0})}Su.fromEventPattern=em;var Eu={},$$=S&&S.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.generate=void 0;var nh=Se,A$=Yr,x$=tn,C$=ao;function I$(e,t,r,n,i){var o,a,u,s;arguments.length===1?(o=e,s=o.initialState,t=o.condition,r=o.iterate,a=o.resultSelector,u=a===void 0?nh.identity:a,i=o.scheduler):(s=e,!n||A$.isScheduler(n)?(u=nh.identity,i=n):u=n);function c(){var l;return $$(this,function(f){switch(f.label){case 0:l=s,f.label=1;case 1:return!t||t(l)?[4,u(l)]:[3,4];case 2:f.sent(),f.label=3;case 3:return l=r(l),[3,1];case 4:return[2]}})}return x$.defer(i?function(){return C$.scheduleIterable(c(),i)}:c)}Eu.generate=I$;var Pu={};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.iif=void 0;var R$=tn;function k$(e,t,r){return R$.defer(function(){return e()?t:r})}Pu.iif=k$;var yo={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});_t.timer=void 0;var j$=Z,M$=qe,D$=Yr,T$=ri;function F$(e,t,r){e===void 0&&(e=0),r===void 0&&(r=M$.async);var n=-1;return t!=null&&(D$.isScheduler(t)?r=t:n=t),new j$.Observable(function(i){var o=T$.isValidDate(e)?+e-r.now():e;o<0&&(o=0);var a=0;return r.schedule(function(){i.closed||(i.next(a++),0<=n?this.schedule(void 0,n):i.complete())},o)})}_t.timer=F$;Object.defineProperty(yo,"__esModule",{value:!0});yo.interval=void 0;var L$=qe,B$=_t;function N$(e,t){return e===void 0&&(e=0),t===void 0&&(t=L$.asyncScheduler),e<0&&(e=0),B$.timer(e,e,t)}yo.interval=N$;var $u={};Object.defineProperty($u,"__esModule",{value:!0});$u.merge=void 0;var U$=en,W$=L,q$=rt,ih=pe,K$=ut;function H$(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ih.popScheduler(e),n=ih.popNumber(e,1/0),i=e;return i.length?i.length===1?W$.innerFrom(i[0]):U$.mergeAll(n)(K$.from(i,r)):q$.EMPTY}$u.merge=H$;var xl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.never=e.NEVER=void 0;var t=Z,r=Oe;e.NEVER=new t.Observable(r.noop);function n(){return e.NEVER}e.never=n})(xl);var mo={},Ut={};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.argsOrArgArray=void 0;var V$=Array.isArray;function z$(e){return e.length===1&&V$(e[0])?e[0]:e}Ut.argsOrArgArray=z$;Object.defineProperty(mo,"__esModule",{value:!0});mo.onErrorResumeNext=void 0;var Q$=Z,G$=Ut,Y$=F,oh=Oe,J$=L;function X$(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=G$.argsOrArgArray(e);return new Q$.Observable(function(n){var i=0,o=function(){if(i<r.length){var a=void 0;try{a=J$.innerFrom(r[i++])}catch{o();return}var u=new Y$.OperatorSubscriber(n,void 0,oh.noop,oh.noop);a.subscribe(u),u.add(o)}else n.complete()};o()})}mo.onErrorResumeNext=X$;var Au={};Object.defineProperty(Au,"__esModule",{value:!0});Au.pairs=void 0;var Z$=ut;function eA(e,t){return Z$.from(Object.entries(e),t)}Au.pairs=eA;var xu={},Cu={};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.not=void 0;function tA(e,t){return function(r,n){return!e.call(t,r,n)}}Cu.not=tA;var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});Wt.filter=void 0;var rA=D,nA=F;function iA(e,t){return rA.operate(function(r,n){var i=0;r.subscribe(nA.createOperatorSubscriber(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}Wt.filter=iA;Object.defineProperty(xu,"__esModule",{value:!0});xu.partition=void 0;var oA=Cu,ah=Wt,uh=L;function aA(e,t,r){return[ah.filter(t,r)(uh.innerFrom(e)),ah.filter(oA.not(t,r))(uh.innerFrom(e))]}xu.partition=aA;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.raceInit=Br.race=void 0;var uA=Z,tm=L,sA=Ut,cA=F;function lA(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e=sA.argsOrArgArray(e),e.length===1?tm.innerFrom(e[0]):new uA.Observable(rm(e))}Br.race=lA;function rm(e){return function(t){for(var r=[],n=function(o){r.push(tm.innerFrom(e[o]).subscribe(cA.createOperatorSubscriber(t,function(a){if(r){for(var u=0;u<r.length;u++)u!==o&&r[u].unsubscribe();r=null}t.next(a)})))},i=0;r&&!t.closed&&i<e.length;i++)n(i)}}Br.raceInit=rm;var Iu={};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.range=void 0;var fA=Z,dA=rt;function hA(e,t,r){if(t==null&&(t=e,e=0),t<=0)return dA.EMPTY;var n=t+e;return new fA.Observable(r?function(i){var o=e;return r.schedule(function(){o<n?(i.next(o++),this.schedule()):i.complete()})}:function(i){for(var o=e;o<n&&!i.closed;)i.next(o++);i.complete()})}Iu.range=hA;var Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.using=void 0;var vA=Z,pA=L,yA=rt;function mA(e,t){return new vA.Observable(function(r){var n=e(),i=t(n),o=i?pA.innerFrom(i):yA.EMPTY;return o.subscribe(r),function(){n&&n.unsubscribe()}})}Ru.using=mA;var oi={},bA=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},gA=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(oi,"__esModule",{value:!0});oi.zip=void 0;var _A=Z,wA=L,OA=Ut,SA=rt,EA=F,PA=pe;function $A(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=PA.popResultSelector(e),n=OA.argsOrArgArray(e);return n.length?new _A.Observable(function(i){var o=n.map(function(){return[]}),a=n.map(function(){return!1});i.add(function(){o=a=null});for(var u=function(c){wA.innerFrom(n[c]).subscribe(EA.createOperatorSubscriber(i,function(l){if(o[c].push(l),o.every(function(d){return d.length})){var f=o.map(function(d){return d.shift()});i.next(r?r.apply(void 0,gA([],bA(f))):f),o.some(function(d,p){return!d.length&&a[p]})&&i.complete()}},function(){a[c]=!0,!o[c].length&&i.complete()}))},s=0;!i.closed&&s<n.length;s++)u(s);return function(){o=a=null}}):SA.EMPTY}oi.zip=$A;var nm={};Object.defineProperty(nm,"__esModule",{value:!0});var bo={};Object.defineProperty(bo,"__esModule",{value:!0});bo.audit=void 0;var AA=D,xA=L,sh=F;function CA(e){return AA.operate(function(t,r){var n=!1,i=null,o=null,a=!1,u=function(){if(o?.unsubscribe(),o=null,n){n=!1;var c=i;i=null,r.next(c)}a&&r.complete()},s=function(){o=null,a&&r.complete()};t.subscribe(sh.createOperatorSubscriber(r,function(c){n=!0,i=c,o||xA.innerFrom(e(c)).subscribe(o=sh.createOperatorSubscriber(r,u,s))},function(){a=!0,(!n||!o||o.closed)&&r.complete()}))})}bo.audit=CA;var ku={};Object.defineProperty(ku,"__esModule",{value:!0});ku.auditTime=void 0;var IA=qe,RA=bo,kA=_t;function jA(e,t){return t===void 0&&(t=IA.asyncScheduler),RA.audit(function(){return kA.timer(e,t)})}ku.auditTime=jA;var ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.buffer=void 0;var MA=D,DA=Oe,ch=F,TA=L;function FA(e){return MA.operate(function(t,r){var n=[];return t.subscribe(ch.createOperatorSubscriber(r,function(i){return n.push(i)},function(){r.next(n),r.complete()})),TA.innerFrom(e).subscribe(ch.createOperatorSubscriber(r,function(){var i=n;n=[],r.next(i)},DA.noop)),function(){n=null}})}ju.buffer=FA;var Mu={},jc=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.bufferCount=void 0;var LA=D,BA=F,NA=at;function UA(e,t){return t===void 0&&(t=null),t=t??e,LA.operate(function(r,n){var i=[],o=0;r.subscribe(BA.createOperatorSubscriber(n,function(a){var u,s,c,l,f=null;o++%t===0&&i.push([]);try{for(var d=jc(i),p=d.next();!p.done;p=d.next()){var m=p.value;m.push(a),e<=m.length&&(f=f??[],f.push(m))}}catch(w){u={error:w}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(u)throw u.error}}if(f)try{for(var y=jc(f),_=y.next();!_.done;_=y.next()){var m=_.value;NA.arrRemove(i,m),n.next(m)}}catch(w){c={error:w}}finally{try{_&&!_.done&&(l=y.return)&&l.call(y)}finally{if(c)throw c.error}}},function(){var a,u;try{for(var s=jc(i),c=s.next();!c.done;c=s.next()){var l=c.value;n.next(l)}}catch(f){a={error:f}}finally{try{c&&!c.done&&(u=s.return)&&u.call(s)}finally{if(a)throw a.error}}n.complete()},void 0,function(){i=null}))})}Mu.bufferCount=UA;var Du={},WA=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Du,"__esModule",{value:!0});Du.bufferTime=void 0;var qA=ge,KA=D,HA=F,VA=at,zA=qe,QA=pe,lh=st;function GA(e){for(var t,r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=(t=QA.popScheduler(n))!==null&&t!==void 0?t:zA.asyncScheduler,a=(r=n[0])!==null&&r!==void 0?r:null,u=n[1]||1/0;return KA.operate(function(s,c){var l=[],f=!1,d=function(y){var _=y.buffer,w=y.subs;w.unsubscribe(),VA.arrRemove(l,y),c.next(_),f&&p()},p=function(){if(l){var y=new qA.Subscription;c.add(y);var _=[],w={buffer:_,subs:y};l.push(w),lh.executeSchedule(y,o,function(){return d(w)},e)}};a!==null&&a>=0?lh.executeSchedule(c,o,p,a,!0):f=!0,p();var m=HA.createOperatorSubscriber(c,function(y){var _,w,O=l.slice();try{for(var E=WA(O),A=E.next();!A.done;A=E.next()){var P=A.value,x=P.buffer;x.push(y),u<=x.length&&d(P)}}catch(C){_={error:C}}finally{try{A&&!A.done&&(w=E.return)&&w.call(E)}finally{if(_)throw _.error}}},function(){for(;l?.length;)c.next(l.shift().buffer);m?.unsubscribe(),c.complete(),c.unsubscribe()},void 0,function(){return l=null});s.subscribe(m)})}Du.bufferTime=GA;var Tu={},YA=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.bufferToggle=void 0;var JA=ge,XA=D,fh=L,Mc=F,dh=Oe,ZA=at;function ex(e,t){return XA.operate(function(r,n){var i=[];fh.innerFrom(e).subscribe(Mc.createOperatorSubscriber(n,function(o){var a=[];i.push(a);var u=new JA.Subscription,s=function(){ZA.arrRemove(i,a),n.next(a),u.unsubscribe()};u.add(fh.innerFrom(t(o)).subscribe(Mc.createOperatorSubscriber(n,s,dh.noop)))},dh.noop)),r.subscribe(Mc.createOperatorSubscriber(n,function(o){var a,u;try{for(var s=YA(i),c=s.next();!c.done;c=s.next()){var l=c.value;l.push(o)}}catch(f){a={error:f}}finally{try{c&&!c.done&&(u=s.return)&&u.call(s)}finally{if(a)throw a.error}}},function(){for(;i.length>0;)n.next(i.shift());n.complete()}))})}Tu.bufferToggle=ex;var Fu={};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.bufferWhen=void 0;var tx=D,rx=Oe,hh=F,nx=L;function ix(e){return tx.operate(function(t,r){var n=null,i=null,o=function(){i?.unsubscribe();var a=n;n=[],a&&r.next(a),nx.innerFrom(e()).subscribe(i=hh.createOperatorSubscriber(r,o,rx.noop))};o(),t.subscribe(hh.createOperatorSubscriber(r,function(a){return n?.push(a)},function(){n&&r.next(n),r.complete()},void 0,function(){return n=i=null}))})}Fu.bufferWhen=ix;var Lu={};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.catchError=void 0;var ox=L,ax=F,ux=D;function im(e){return ux.operate(function(t,r){var n=null,i=!1,o;n=t.subscribe(ax.createOperatorSubscriber(r,void 0,void 0,function(a){o=ox.innerFrom(e(a,im(e)(t))),n?(n.unsubscribe(),n=null,o.subscribe(r)):i=!0})),i&&(n.unsubscribe(),n=null,o.subscribe(r))})}Lu.catchError=im;var Bu={},go={},_o={},wo={},hr={},Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.scanInternals=void 0;var sx=F;function cx(e,t,r,n,i){return function(o,a){var u=r,s=t,c=0;o.subscribe(sx.createOperatorSubscriber(a,function(l){var f=c++;s=u?e(s,l,f):(u=!0,l),n&&a.next(s)},i&&function(){u&&a.next(s),a.complete()}))}}Oo.scanInternals=cx;Object.defineProperty(hr,"__esModule",{value:!0});hr.reduce=void 0;var lx=Oo,fx=D;function dx(e,t){return fx.operate(lx.scanInternals(e,t,arguments.length>=2,!1,!0))}hr.reduce=dx;Object.defineProperty(wo,"__esModule",{value:!0});wo.toArray=void 0;var hx=hr,vx=D,px=function(e,t){return e.push(t),e};function yx(){return vx.operate(function(e,t){hx.reduce(px,[])(e).subscribe(t)})}wo.toArray=yx;Object.defineProperty(_o,"__esModule",{value:!0});_o.joinAllInternals=void 0;var mx=Se,bx=bt,gx=Tt,_x=ct,wx=wo;function Ox(e,t){return gx.pipe(wx.toArray(),_x.mergeMap(function(r){return e(r)}),t?bx.mapOneOrManyArgs(t):mx.identity)}_o.joinAllInternals=Ox;Object.defineProperty(go,"__esModule",{value:!0});go.combineLatestAll=void 0;var Sx=ir,Ex=_o;function Px(e){return Ex.joinAllInternals(Sx.combineLatest,e)}go.combineLatestAll=Px;Object.defineProperty(Bu,"__esModule",{value:!0});Bu.combineAll=void 0;var $x=go;Bu.combineAll=$x.combineLatestAll;var Nu={},Uu={},vh=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},ph=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.combineLatest=void 0;var Ax=ir,xx=D,Cx=Ut,Ix=bt,Rx=Tt,kx=pe;function om(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=kx.popResultSelector(e);return r?Rx.pipe(om.apply(void 0,ph([],vh(e))),Ix.mapOneOrManyArgs(r)):xx.operate(function(n,i){Ax.combineLatestInit(ph([n],vh(Cx.argsOrArgArray(e))))(i)})}Uu.combineLatest=om;var jx=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Mx=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.combineLatestWith=void 0;var Dx=Uu;function Tx(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Dx.combineLatest.apply(void 0,Mx([],jx(e)))}Nu.combineLatestWith=Tx;var So={};Object.defineProperty(So,"__esModule",{value:!0});So.concatMap=void 0;var yh=ct,Fx=X;function Lx(e,t){return Fx.isFunction(t)?yh.mergeMap(e,t,1):yh.mergeMap(e,1)}So.concatMap=Lx;var Wu={};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.concatMapTo=void 0;var mh=So,Bx=X;function Nx(e,t){return Bx.isFunction(t)?mh.concatMap(function(){return e},t):mh.concatMap(function(){return e})}Wu.concatMapTo=Nx;var qu={},Ku={},Ux=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Wx=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.concat=void 0;var qx=D,Kx=ni,Hx=pe,Vx=ut;function zx(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Hx.popScheduler(e);return qx.operate(function(n,i){Kx.concatAll()(Vx.from(Wx([n],Ux(e)),r)).subscribe(i)})}Ku.concat=zx;var Qx=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Gx=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(qu,"__esModule",{value:!0});qu.concatWith=void 0;var Yx=Ku;function Jx(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Yx.concat.apply(void 0,Gx([],Qx(e)))}qu.concatWith=Jx;var ai={},Hu={};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.fromSubscribable=void 0;var Xx=Z;function Zx(e){return new Xx.Observable(function(t){return e.subscribe(t)})}Hu.fromSubscribable=Zx;Object.defineProperty(ai,"__esModule",{value:!0});ai.connect=void 0;var eC=de,tC=L,rC=D,nC=Hu,iC={connector:function(){return new eC.Subject}};function oC(e,t){t===void 0&&(t=iC);var r=t.connector;return rC.operate(function(n,i){var o=r();tC.innerFrom(e(nC.fromSubscribable(o))).subscribe(i),i.add(n.subscribe(o))})}ai.connect=oC;var Vu={};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.count=void 0;var aC=hr;function uC(e){return aC.reduce(function(t,r,n){return!e||e(r,n)?t+1:t},0)}Vu.count=uC;var zu={};Object.defineProperty(zu,"__esModule",{value:!0});zu.debounce=void 0;var sC=D,cC=Oe,bh=F,lC=L;function fC(e){return sC.operate(function(t,r){var n=!1,i=null,o=null,a=function(){if(o?.unsubscribe(),o=null,n){n=!1;var u=i;i=null,r.next(u)}};t.subscribe(bh.createOperatorSubscriber(r,function(u){o?.unsubscribe(),n=!0,i=u,o=bh.createOperatorSubscriber(r,a,cC.noop),lC.innerFrom(e(u)).subscribe(o)},function(){a(),r.complete()},void 0,function(){i=o=null}))})}zu.debounce=fC;var Qu={};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.debounceTime=void 0;var dC=qe,hC=D,vC=F;function pC(e,t){return t===void 0&&(t=dC.asyncScheduler),hC.operate(function(r,n){var i=null,o=null,a=null,u=function(){if(i){i.unsubscribe(),i=null;var c=o;o=null,n.next(c)}};function s(){var c=a+e,l=t.now();if(l<c){i=this.schedule(void 0,c-l),n.add(i);return}u()}r.subscribe(vC.createOperatorSubscriber(n,function(c){o=c,a=t.now(),i||(i=t.schedule(s,e),n.add(i))},function(){u(),n.complete()},void 0,function(){o=i=null}))})}Qu.debounceTime=pC;var rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.defaultIfEmpty=void 0;var yC=D,mC=F;function bC(e){return yC.operate(function(t,r){var n=!1;t.subscribe(mC.createOperatorSubscriber(r,function(i){n=!0,r.next(i)},function(){n||r.next(e),r.complete()}))})}rn.defaultIfEmpty=bC;var Gu={},Eo={},nn={};Object.defineProperty(nn,"__esModule",{value:!0});nn.take=void 0;var gC=rt,_C=D,wC=F;function OC(e){return e<=0?function(){return gC.EMPTY}:_C.operate(function(t,r){var n=0;t.subscribe(wC.createOperatorSubscriber(r,function(i){++n<=e&&(r.next(i),e<=n&&r.complete())}))})}nn.take=OC;var Po={};Object.defineProperty(Po,"__esModule",{value:!0});Po.ignoreElements=void 0;var SC=D,EC=F,PC=Oe;function $C(){return SC.operate(function(e,t){e.subscribe(EC.createOperatorSubscriber(t,PC.noop))})}Po.ignoreElements=$C;var $o={};Object.defineProperty($o,"__esModule",{value:!0});$o.mapTo=void 0;var AC=gt;function xC(e){return AC.map(function(){return e})}$o.mapTo=xC;Object.defineProperty(Eo,"__esModule",{value:!0});Eo.delayWhen=void 0;var CC=Zr,gh=nn,IC=Po,RC=$o,kC=ct,jC=L;function am(e,t){return t?function(r){return CC.concat(t.pipe(gh.take(1),IC.ignoreElements()),r.pipe(am(e)))}:kC.mergeMap(function(r,n){return jC.innerFrom(e(r,n)).pipe(gh.take(1),RC.mapTo(r))})}Eo.delayWhen=am;Object.defineProperty(Gu,"__esModule",{value:!0});Gu.delay=void 0;var MC=qe,DC=Eo,TC=_t;function FC(e,t){t===void 0&&(t=MC.asyncScheduler);var r=TC.timer(e,t);return DC.delayWhen(function(){return r})}Gu.delay=FC;var Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.dematerialize=void 0;var LC=lu,BC=D,NC=F;function UC(){return BC.operate(function(e,t){e.subscribe(NC.createOperatorSubscriber(t,function(r){return LC.observeNotification(r,t)}))})}Yu.dematerialize=UC;var Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.distinct=void 0;var WC=D,_h=F,qC=Oe,KC=L;function HC(e,t){return WC.operate(function(r,n){var i=new Set;r.subscribe(_h.createOperatorSubscriber(n,function(o){var a=e?e(o):o;i.has(a)||(i.add(a),n.next(o))})),t&&KC.innerFrom(t).subscribe(_h.createOperatorSubscriber(n,function(){return i.clear()},qC.noop))})}Ju.distinct=HC;var Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.distinctUntilChanged=void 0;var VC=Se,zC=D,QC=F;function GC(e,t){return t===void 0&&(t=VC.identity),e=e??YC,zC.operate(function(r,n){var i,o=!0;r.subscribe(QC.createOperatorSubscriber(n,function(a){var u=t(a);(o||!e(i,u))&&(o=!1,i=u,n.next(a))}))})}Ao.distinctUntilChanged=GC;function YC(e,t){return e===t}var Xu={};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.distinctUntilKeyChanged=void 0;var JC=Ao;function XC(e,t){return JC.distinctUntilChanged(function(r,n){return t?t(r[e],n[e]):r[e]===n[e]})}Xu.distinctUntilKeyChanged=XC;var Zu={},on={};Object.defineProperty(on,"__esModule",{value:!0});on.throwIfEmpty=void 0;var ZC=mt,eI=D,tI=F;function rI(e){return e===void 0&&(e=nI),eI.operate(function(t,r){var n=!1;t.subscribe(tI.createOperatorSubscriber(r,function(i){n=!0,r.next(i)},function(){return n?r.complete():r.error(e())}))})}on.throwIfEmpty=rI;function nI(){return new ZC.EmptyError}Object.defineProperty(Zu,"__esModule",{value:!0});Zu.elementAt=void 0;var wh=co,iI=Wt,oI=on,aI=rn,uI=nn;function sI(e,t){if(e<0)throw new wh.ArgumentOutOfRangeError;var r=arguments.length>=2;return function(n){return n.pipe(iI.filter(function(i,o){return o===e}),uI.take(1),r?aI.defaultIfEmpty(t):oI.throwIfEmpty(function(){return new wh.ArgumentOutOfRangeError}))}}Zu.elementAt=sI;var es={},cI=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},lI=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(es,"__esModule",{value:!0});es.endWith=void 0;var fI=Zr,dI=Zn;function hI(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(r){return fI.concat(r,dI.of.apply(void 0,lI([],cI(e))))}}es.endWith=hI;var ts={};Object.defineProperty(ts,"__esModule",{value:!0});ts.every=void 0;var vI=D,pI=F;function yI(e,t){return vI.operate(function(r,n){var i=0;r.subscribe(pI.createOperatorSubscriber(n,function(o){e.call(t,o,i++,r)||(n.next(!1),n.complete())},function(){n.next(!0),n.complete()}))})}ts.every=yI;var rs={},xo={},Co={};Object.defineProperty(Co,"__esModule",{value:!0});Co.exhaustMap=void 0;var mI=gt,Oh=L,bI=D,Sh=F;function um(e,t){return t?function(r){return r.pipe(um(function(n,i){return Oh.innerFrom(e(n,i)).pipe(mI.map(function(o,a){return t(n,o,i,a)}))}))}:bI.operate(function(r,n){var i=0,o=null,a=!1;r.subscribe(Sh.createOperatorSubscriber(n,function(u){o||(o=Sh.createOperatorSubscriber(n,void 0,function(){o=null,a&&n.complete()}),Oh.innerFrom(e(u,i++)).subscribe(o))},function(){a=!0,!o&&n.complete()}))})}Co.exhaustMap=um;Object.defineProperty(xo,"__esModule",{value:!0});xo.exhaustAll=void 0;var gI=Co,_I=Se;function wI(){return gI.exhaustMap(_I.identity)}xo.exhaustAll=wI;Object.defineProperty(rs,"__esModule",{value:!0});rs.exhaust=void 0;var OI=xo;rs.exhaust=OI.exhaustAll;var ns={};Object.defineProperty(ns,"__esModule",{value:!0});ns.expand=void 0;var SI=D,EI=ii;function PI(e,t,r){return t===void 0&&(t=1/0),t=(t||0)<1?1/0:t,SI.operate(function(n,i){return EI.mergeInternals(n,i,e,t,void 0,!0,r)})}ns.expand=PI;var is={};Object.defineProperty(is,"__esModule",{value:!0});is.finalize=void 0;var $I=D;function AI(e){return $I.operate(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}is.finalize=AI;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.createFind=Nr.find=void 0;var xI=D,CI=F;function II(e,t){return xI.operate(sm(e,t,"value"))}Nr.find=II;function sm(e,t,r){var n=r==="index";return function(i,o){var a=0;i.subscribe(CI.createOperatorSubscriber(o,function(u){var s=a++;e.call(t,u,s,i)&&(o.next(n?s:u),o.complete())},function(){o.next(n?-1:void 0),o.complete()}))}}Nr.createFind=sm;var os={};Object.defineProperty(os,"__esModule",{value:!0});os.findIndex=void 0;var RI=D,kI=Nr;function jI(e,t){return RI.operate(kI.createFind(e,t,"index"))}os.findIndex=jI;var as={};Object.defineProperty(as,"__esModule",{value:!0});as.first=void 0;var MI=mt,DI=Wt,TI=nn,FI=rn,LI=on,BI=Se;function NI(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?DI.filter(function(i,o){return e(i,o,n)}):BI.identity,TI.take(1),r?FI.defaultIfEmpty(t):LI.throwIfEmpty(function(){return new MI.EmptyError}))}}as.first=NI;var us={};Object.defineProperty(us,"__esModule",{value:!0});us.groupBy=void 0;var UI=Z,WI=L,qI=de,KI=D,Eh=F;function HI(e,t,r,n){return KI.operate(function(i,o){var a;!t||typeof t=="function"?a=t:(r=t.duration,a=t.element,n=t.connector);var u=new Map,s=function(m){u.forEach(m),m(o)},c=function(m){return s(function(y){return y.error(m)})},l=0,f=!1,d=new Eh.OperatorSubscriber(o,function(m){try{var y=e(m),_=u.get(y);if(!_){u.set(y,_=n?n():new qI.Subject);var w=p(y,_);if(o.next(w),r){var O=Eh.createOperatorSubscriber(_,function(){_.complete(),O?.unsubscribe()},void 0,void 0,function(){return u.delete(y)});d.add(WI.innerFrom(r(w)).subscribe(O))}}_.next(a?a(m):m)}catch(E){c(E)}},function(){return s(function(m){return m.complete()})},c,function(){return u.clear()},function(){return f=!0,l===0});i.subscribe(d);function p(m,y){var _=new UI.Observable(function(w){l++;var O=y.subscribe(w);return function(){O.unsubscribe(),--l===0&&f&&d.unsubscribe()}});return _.key=m,_}})}us.groupBy=HI;var ss={};Object.defineProperty(ss,"__esModule",{value:!0});ss.isEmpty=void 0;var VI=D,zI=F;function QI(){return VI.operate(function(e,t){e.subscribe(zI.createOperatorSubscriber(t,function(){t.next(!1),t.complete()},function(){t.next(!0),t.complete()}))})}ss.isEmpty=QI;var cs={},Io={},GI=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Io,"__esModule",{value:!0});Io.takeLast=void 0;var YI=rt,JI=D,XI=F;function ZI(e){return e<=0?function(){return YI.EMPTY}:JI.operate(function(t,r){var n=[];t.subscribe(XI.createOperatorSubscriber(r,function(i){n.push(i),e<n.length&&n.shift()},function(){var i,o;try{for(var a=GI(n),u=a.next();!u.done;u=a.next()){var s=u.value;r.next(s)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}r.complete()},void 0,function(){n=null}))})}Io.takeLast=ZI;Object.defineProperty(cs,"__esModule",{value:!0});cs.last=void 0;var eR=mt,tR=Wt,rR=Io,nR=on,iR=rn,oR=Se;function aR(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?tR.filter(function(i,o){return e(i,o,n)}):oR.identity,rR.takeLast(1),r?iR.defaultIfEmpty(t):nR.throwIfEmpty(function(){return new eR.EmptyError}))}}cs.last=aR;var ls={};Object.defineProperty(ls,"__esModule",{value:!0});ls.materialize=void 0;var Dc=lu,uR=D,sR=F;function cR(){return uR.operate(function(e,t){e.subscribe(sR.createOperatorSubscriber(t,function(r){t.next(Dc.Notification.createNext(r))},function(){t.next(Dc.Notification.createComplete()),t.complete()},function(r){t.next(Dc.Notification.createError(r)),t.complete()}))})}ls.materialize=cR;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});fs.max=void 0;var lR=hr,fR=X;function dR(e){return lR.reduce(fR.isFunction(e)?function(t,r){return e(t,r)>0?t:r}:function(t,r){return t>r?t:r})}fs.max=dR;var ds={};Object.defineProperty(ds,"__esModule",{value:!0});ds.flatMap=void 0;var hR=ct;ds.flatMap=hR.mergeMap;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});hs.mergeMapTo=void 0;var Ph=ct,vR=X;function pR(e,t,r){return r===void 0&&(r=1/0),vR.isFunction(t)?Ph.mergeMap(function(){return e},t,r):(typeof t=="number"&&(r=t),Ph.mergeMap(function(){return e},r))}hs.mergeMapTo=pR;var vs={};Object.defineProperty(vs,"__esModule",{value:!0});vs.mergeScan=void 0;var yR=D,mR=ii;function bR(e,t,r){return r===void 0&&(r=1/0),yR.operate(function(n,i){var o=t;return mR.mergeInternals(n,i,function(a,u){return e(o,a,u)},r,function(a){o=a},!1,void 0,function(){return o=null})})}vs.mergeScan=bR;var ps={},ys={},gR=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},_R=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ys,"__esModule",{value:!0});ys.merge=void 0;var wR=D,OR=Ut,SR=en,$h=pe,ER=ut;function PR(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=$h.popScheduler(e),n=$h.popNumber(e,1/0);return e=OR.argsOrArgArray(e),wR.operate(function(i,o){SR.mergeAll(n)(ER.from(_R([i],gR(e)),r)).subscribe(o)})}ys.merge=PR;var $R=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},AR=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ps,"__esModule",{value:!0});ps.mergeWith=void 0;var xR=ys;function CR(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xR.merge.apply(void 0,AR([],$R(e)))}ps.mergeWith=CR;var ms={};Object.defineProperty(ms,"__esModule",{value:!0});ms.min=void 0;var IR=hr,RR=X;function kR(e){return IR.reduce(RR.isFunction(e)?function(t,r){return e(t,r)<0?t:r}:function(t,r){return t<r?t:r})}ms.min=kR;var ui={};Object.defineProperty(ui,"__esModule",{value:!0});ui.multicast=void 0;var jR=Gr,Ah=X,MR=ai;function DR(e,t){var r=Ah.isFunction(e)?e:function(){return e};return Ah.isFunction(t)?MR.connect(t,{connector:r}):function(n){return new jR.ConnectableObservable(n,r)}}ui.multicast=DR;var Nn={},TR=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},FR=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.onErrorResumeNext=Nn.onErrorResumeNextWith=void 0;var LR=Ut,BR=mo;function cm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LR.argsOrArgArray(e);return function(n){return BR.onErrorResumeNext.apply(void 0,FR([n],TR(r)))}}Nn.onErrorResumeNextWith=cm;Nn.onErrorResumeNext=cm;var bs={};Object.defineProperty(bs,"__esModule",{value:!0});bs.pairwise=void 0;var NR=D,UR=F;function WR(){return NR.operate(function(e,t){var r,n=!1;e.subscribe(UR.createOperatorSubscriber(t,function(i){var o=r;r=i,n&&t.next([o,i]),n=!0}))})}bs.pairwise=WR;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.pluck=void 0;var qR=gt;function KR(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length;if(r===0)throw new Error("list of properties cannot be empty.");return qR.map(function(n){for(var i=n,o=0;o<r;o++){var a=i?.[e[o]];if(typeof a<"u")i=a;else return}return i})}gs.pluck=KR;var _s={};Object.defineProperty(_s,"__esModule",{value:!0});_s.publish=void 0;var HR=de,VR=ui,zR=ai;function QR(e){return e?function(t){return zR.connect(e)(t)}:function(t){return VR.multicast(new HR.Subject)(t)}}_s.publish=QR;var ws={};Object.defineProperty(ws,"__esModule",{value:!0});ws.publishBehavior=void 0;var GR=Xi,YR=Gr;function JR(e){return function(t){var r=new GR.BehaviorSubject(e);return new YR.ConnectableObservable(t,function(){return r})}}ws.publishBehavior=JR;var Os={};Object.defineProperty(Os,"__esModule",{value:!0});Os.publishLast=void 0;var XR=Xn,ZR=Gr;function ek(){return function(e){var t=new XR.AsyncSubject;return new ZR.ConnectableObservable(e,function(){return t})}}Os.publishLast=ek;var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});Ss.publishReplay=void 0;var tk=Jn,rk=ui,xh=X;function nk(e,t,r,n){r&&!xh.isFunction(r)&&(n=r);var i=xh.isFunction(r)?r:void 0;return function(o){return rk.multicast(new tk.ReplaySubject(e,t,n),i)(o)}}Ss.publishReplay=nk;var Es={},ik=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},ok=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Es,"__esModule",{value:!0});Es.raceWith=void 0;var ak=Br,uk=D,sk=Se;function ck(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?uk.operate(function(r,n){ak.raceInit(ok([r],ik(e)))(n)}):sk.identity}Es.raceWith=ck;var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.repeat=void 0;var lk=rt,fk=D,Ch=F,dk=L,hk=_t;function vk(e){var t,r=1/0,n;return e!=null&&(typeof e=="object"?(t=e.count,r=t===void 0?1/0:t,n=e.delay):r=e),r<=0?function(){return lk.EMPTY}:fk.operate(function(i,o){var a=0,u,s=function(){if(u?.unsubscribe(),u=null,n!=null){var l=typeof n=="number"?hk.timer(n):dk.innerFrom(n(a)),f=Ch.createOperatorSubscriber(o,function(){f.unsubscribe(),c()});l.subscribe(f)}else c()},c=function(){var l=!1;u=i.subscribe(Ch.createOperatorSubscriber(o,void 0,function(){++a<r?u?s():l=!0:o.complete()})),l&&s()};c()})}Ps.repeat=vk;var $s={};Object.defineProperty($s,"__esModule",{value:!0});$s.repeatWhen=void 0;var pk=L,yk=de,mk=D,Ih=F;function bk(e){return mk.operate(function(t,r){var n,i=!1,o,a=!1,u=!1,s=function(){return u&&a&&(r.complete(),!0)},c=function(){return o||(o=new yk.Subject,pk.innerFrom(e(o)).subscribe(Ih.createOperatorSubscriber(r,function(){n?l():i=!0},function(){a=!0,s()}))),o},l=function(){u=!1,n=t.subscribe(Ih.createOperatorSubscriber(r,void 0,function(){u=!0,!s()&&c().next()})),i&&(n.unsubscribe(),n=null,i=!1,l())};l()})}$s.repeatWhen=bk;var As={};Object.defineProperty(As,"__esModule",{value:!0});As.retry=void 0;var gk=D,Rh=F,_k=Se,wk=_t,Ok=L;function Sk(e){e===void 0&&(e=1/0);var t;e&&typeof e=="object"?t=e:t={count:e};var r=t.count,n=r===void 0?1/0:r,i=t.delay,o=t.resetOnSuccess,a=o===void 0?!1:o;return n<=0?_k.identity:gk.operate(function(u,s){var c=0,l,f=function(){var d=!1;l=u.subscribe(Rh.createOperatorSubscriber(s,function(p){a&&(c=0),s.next(p)},void 0,function(p){if(c++<n){var m=function(){l?(l.unsubscribe(),l=null,f()):d=!0};if(i!=null){var y=typeof i=="number"?wk.timer(i):Ok.innerFrom(i(p,c)),_=Rh.createOperatorSubscriber(s,function(){_.unsubscribe(),m()},function(){s.complete()});y.subscribe(_)}else m()}else s.error(p)})),d&&(l.unsubscribe(),l=null,f())};f()})}As.retry=Sk;var xs={};Object.defineProperty(xs,"__esModule",{value:!0});xs.retryWhen=void 0;var Ek=L,Pk=de,$k=D,kh=F;function Ak(e){return $k.operate(function(t,r){var n,i=!1,o,a=function(){n=t.subscribe(kh.createOperatorSubscriber(r,void 0,void 0,function(u){o||(o=new Pk.Subject,Ek.innerFrom(e(o)).subscribe(kh.createOperatorSubscriber(r,function(){return n?a():i=!0}))),o&&o.next(u)})),i&&(n.unsubscribe(),n=null,i=!1,a())};a()})}xs.retryWhen=Ak;var Ro={};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.sample=void 0;var xk=L,Ck=D,Ik=Oe,jh=F;function Rk(e){return Ck.operate(function(t,r){var n=!1,i=null;t.subscribe(jh.createOperatorSubscriber(r,function(o){n=!0,i=o})),xk.innerFrom(e).subscribe(jh.createOperatorSubscriber(r,function(){if(n){n=!1;var o=i;i=null,r.next(o)}},Ik.noop))})}Ro.sample=Rk;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.sampleTime=void 0;var kk=qe,jk=Ro,Mk=yo;function Dk(e,t){return t===void 0&&(t=kk.asyncScheduler),jk.sample(Mk.interval(e,t))}Cs.sampleTime=Dk;var Is={};Object.defineProperty(Is,"__esModule",{value:!0});Is.scan=void 0;var Tk=D,Fk=Oo;function Lk(e,t){return Tk.operate(Fk.scanInternals(e,t,arguments.length>=2,!0))}Is.scan=Lk;var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});Rs.sequenceEqual=void 0;var Bk=D,Nk=F,Uk=L;function Wk(e,t){return t===void 0&&(t=function(r,n){return r===n}),Bk.operate(function(r,n){var i=Mh(),o=Mh(),a=function(s){n.next(s),n.complete()},u=function(s,c){var l=Nk.createOperatorSubscriber(n,function(f){var d=c.buffer,p=c.complete;d.length===0?p?a(!1):s.buffer.push(f):!t(f,d.shift())&&a(!1)},function(){s.complete=!0;var f=c.complete,d=c.buffer;f&&a(d.length===0),l?.unsubscribe()});return l};r.subscribe(u(i,o)),Uk.innerFrom(e).subscribe(u(o,i))})}Rs.sequenceEqual=Wk;function Mh(){return{buffer:[],complete:!1}}var ko={},qk=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Kk=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(ko,"__esModule",{value:!0});ko.share=void 0;var lm=L,Hk=de,fm=Yn,Vk=D;function zk(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new Hk.Subject}:t,n=e.resetOnError,i=n===void 0?!0:n,o=e.resetOnComplete,a=o===void 0?!0:o,u=e.resetOnRefCountZero,s=u===void 0?!0:u;return function(c){var l,f,d,p=0,m=!1,y=!1,_=function(){f?.unsubscribe(),f=void 0},w=function(){_(),l=d=void 0,m=y=!1},O=function(){var E=l;w(),E?.unsubscribe()};return Vk.operate(function(E,A){p++,!y&&!m&&_();var P=d=d??r();A.add(function(){p--,p===0&&!y&&!m&&(f=Tc(O,s))}),P.subscribe(A),!l&&p>0&&(l=new fm.SafeSubscriber({next:function(x){return P.next(x)},error:function(x){y=!0,_(),f=Tc(w,i,x),P.error(x)},complete:function(){m=!0,_(),f=Tc(w,a),P.complete()}}),lm.innerFrom(E).subscribe(l))})(c)}}ko.share=zk;function Tc(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(t===!0){e();return}if(t!==!1){var i=new fm.SafeSubscriber({next:function(){i.unsubscribe(),e()}});return lm.innerFrom(t.apply(void 0,Kk([],qk(r)))).subscribe(i)}}var ks={};Object.defineProperty(ks,"__esModule",{value:!0});ks.shareReplay=void 0;var Qk=Jn,Gk=ko;function Yk(e,t,r){var n,i,o,a,u=!1;return e&&typeof e=="object"?(n=e.bufferSize,a=n===void 0?1/0:n,i=e.windowTime,t=i===void 0?1/0:i,o=e.refCount,u=o===void 0?!1:o,r=e.scheduler):a=e??1/0,Gk.share({connector:function(){return new Qk.ReplaySubject(a,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}ks.shareReplay=Yk;var js={};Object.defineProperty(js,"__esModule",{value:!0});js.single=void 0;var Jk=mt,Xk=fo,Zk=lo,ej=D,tj=F;function rj(e){return ej.operate(function(t,r){var n=!1,i,o=!1,a=0;t.subscribe(tj.createOperatorSubscriber(r,function(u){o=!0,(!e||e(u,a++,t))&&(n&&r.error(new Xk.SequenceError("Too many matching values")),n=!0,i=u)},function(){n?(r.next(i),r.complete()):r.error(o?new Zk.NotFoundError("No matching values"):new Jk.EmptyError)}))})}js.single=rj;var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.skip=void 0;var nj=Wt;function ij(e){return nj.filter(function(t,r){return e<=r})}Ms.skip=ij;var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.skipLast=void 0;var oj=Se,aj=D,uj=F;function sj(e){return e<=0?oj.identity:aj.operate(function(t,r){var n=new Array(e),i=0;return t.subscribe(uj.createOperatorSubscriber(r,function(o){var a=i++;if(a<e)n[a]=o;else{var u=a%e,s=n[u];n[u]=o,r.next(s)}})),function(){n=null}})}Ds.skipLast=sj;var Ts={};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.skipUntil=void 0;var cj=D,Dh=F,lj=L,fj=Oe;function dj(e){return cj.operate(function(t,r){var n=!1,i=Dh.createOperatorSubscriber(r,function(){i?.unsubscribe(),n=!0},fj.noop);lj.innerFrom(e).subscribe(i),t.subscribe(Dh.createOperatorSubscriber(r,function(o){return n&&r.next(o)}))})}Ts.skipUntil=dj;var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.skipWhile=void 0;var hj=D,vj=F;function pj(e){return hj.operate(function(t,r){var n=!1,i=0;t.subscribe(vj.createOperatorSubscriber(r,function(o){return(n||(n=!e(o,i++)))&&r.next(o)}))})}Fs.skipWhile=pj;var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});Ls.startWith=void 0;var Th=Zr,yj=pe,mj=D;function bj(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=yj.popScheduler(e);return mj.operate(function(n,i){(r?Th.concat(e,n,r):Th.concat(e,n)).subscribe(i)})}Ls.startWith=bj;var Bs={},an={};Object.defineProperty(an,"__esModule",{value:!0});an.switchMap=void 0;var gj=L,_j=D,Fh=F;function wj(e,t){return _j.operate(function(r,n){var i=null,o=0,a=!1,u=function(){return a&&!i&&n.complete()};r.subscribe(Fh.createOperatorSubscriber(n,function(s){i?.unsubscribe();var c=0,l=o++;gj.innerFrom(e(s,l)).subscribe(i=Fh.createOperatorSubscriber(n,function(f){return n.next(t?t(s,f,l,c++):f)},function(){i=null,u()}))},function(){a=!0,u()}))})}an.switchMap=wj;Object.defineProperty(Bs,"__esModule",{value:!0});Bs.switchAll=void 0;var Oj=an,Sj=Se;function Ej(){return Oj.switchMap(Sj.identity)}Bs.switchAll=Ej;var Ns={};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.switchMapTo=void 0;var Lh=an,Pj=X;function $j(e,t){return Pj.isFunction(t)?Lh.switchMap(function(){return e},t):Lh.switchMap(function(){return e})}Ns.switchMapTo=$j;var Us={};Object.defineProperty(Us,"__esModule",{value:!0});Us.switchScan=void 0;var Aj=an,xj=D;function Cj(e,t){return xj.operate(function(r,n){var i=t;return Aj.switchMap(function(o,a){return e(i,o,a)},function(o,a){return i=a,a})(r).subscribe(n),function(){i=null}})}Us.switchScan=Cj;var Ws={};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.takeUntil=void 0;var Ij=D,Rj=F,kj=L,jj=Oe;function Mj(e){return Ij.operate(function(t,r){kj.innerFrom(e).subscribe(Rj.createOperatorSubscriber(r,function(){return r.complete()},jj.noop)),!r.closed&&t.subscribe(r)})}Ws.takeUntil=Mj;var qs={};Object.defineProperty(qs,"__esModule",{value:!0});qs.takeWhile=void 0;var Dj=D,Tj=F;function Fj(e,t){return t===void 0&&(t=!1),Dj.operate(function(r,n){var i=0;r.subscribe(Tj.createOperatorSubscriber(n,function(o){var a=e(o,i++);(a||t)&&n.next(o),!a&&n.complete()}))})}qs.takeWhile=Fj;var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.tap=void 0;var Lj=X,Bj=D,Nj=F,Uj=Se;function Wj(e,t,r){var n=Lj.isFunction(e)||t||r?{next:e,error:t,complete:r}:e;return n?Bj.operate(function(i,o){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var u=!0;i.subscribe(Nj.createOperatorSubscriber(o,function(s){var c;(c=n.next)===null||c===void 0||c.call(n,s),o.next(s)},function(){var s;u=!1,(s=n.complete)===null||s===void 0||s.call(n),o.complete()},function(s){var c;u=!1,(c=n.error)===null||c===void 0||c.call(n,s),o.error(s)},function(){var s,c;u&&((s=n.unsubscribe)===null||s===void 0||s.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Uj.identity}Ks.tap=Wj;var jo={};Object.defineProperty(jo,"__esModule",{value:!0});jo.throttle=void 0;var qj=D,Bh=F,Kj=L;function Hj(e,t){return qj.operate(function(r,n){var i=t??{},o=i.leading,a=o===void 0?!0:o,u=i.trailing,s=u===void 0?!1:u,c=!1,l=null,f=null,d=!1,p=function(){f?.unsubscribe(),f=null,s&&(_(),d&&n.complete())},m=function(){f=null,d&&n.complete()},y=function(w){return f=Kj.innerFrom(e(w)).subscribe(Bh.createOperatorSubscriber(n,p,m))},_=function(){if(c){c=!1;var w=l;l=null,n.next(w),!d&&y(w)}};r.subscribe(Bh.createOperatorSubscriber(n,function(w){c=!0,l=w,!(f&&!f.closed)&&(a?_():y(w))},function(){d=!0,!(s&&c&&f&&!f.closed)&&n.complete()}))})}jo.throttle=Hj;var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.throttleTime=void 0;var Vj=qe,zj=jo,Qj=_t;function Gj(e,t,r){t===void 0&&(t=Vj.asyncScheduler);var n=Qj.timer(e,t);return zj.throttle(function(){return n},r)}Hs.throttleTime=Gj;var Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.TimeInterval=Un.timeInterval=void 0;var Yj=qe,Jj=D,Xj=F;function Zj(e){return e===void 0&&(e=Yj.asyncScheduler),Jj.operate(function(t,r){var n=e.now();t.subscribe(Xj.createOperatorSubscriber(r,function(i){var o=e.now(),a=o-n;n=o,r.next(new dm(i,a))}))})}Un.timeInterval=Zj;var dm=function(){function e(t,r){this.value=t,this.interval=r}return e}();Un.TimeInterval=dm;var Vs={};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.timeoutWith=void 0;var eM=qe,tM=ri,rM=$a;function nM(e,t,r){var n,i,o;if(r=r??eM.async,tM.isValidDate(e)?n=e:typeof e=="number"&&(i=e),t)o=function(){return t};else throw new TypeError("No observable provided to switch to");if(n==null&&i==null)throw new TypeError("No timeout provided.");return rM.timeout({first:n,each:i,scheduler:r,with:o})}Vs.timeoutWith=nM;var zs={};Object.defineProperty(zs,"__esModule",{value:!0});zs.timestamp=void 0;var iM=ru,oM=gt;function aM(e){return e===void 0&&(e=iM.dateTimestampProvider),oM.map(function(t){return{value:t,timestamp:e.now()}})}zs.timestamp=aM;var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.window=void 0;var Nh=de,uM=D,Uh=F,sM=Oe,cM=L;function lM(e){return uM.operate(function(t,r){var n=new Nh.Subject;r.next(n.asObservable());var i=function(o){n.error(o),r.error(o)};return t.subscribe(Uh.createOperatorSubscriber(r,function(o){return n?.next(o)},function(){n.complete(),r.complete()},i)),cM.innerFrom(e).subscribe(Uh.createOperatorSubscriber(r,function(){n.complete(),r.next(n=new Nh.Subject)},sM.noop,i)),function(){n?.unsubscribe(),n=null}})}Qs.window=lM;var Gs={},fM=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.windowCount=void 0;var Wh=de,dM=D,hM=F;function vM(e,t){t===void 0&&(t=0);var r=t>0?t:e;return dM.operate(function(n,i){var o=[new Wh.Subject],a=0;i.next(o[0].asObservable()),n.subscribe(hM.createOperatorSubscriber(i,function(u){var s,c;try{for(var l=fM(o),f=l.next();!f.done;f=l.next()){var d=f.value;d.next(u)}}catch(y){s={error:y}}finally{try{f&&!f.done&&(c=l.return)&&c.call(l)}finally{if(s)throw s.error}}var p=a-e+1;if(p>=0&&p%r===0&&o.shift().complete(),++a%r===0){var m=new Wh.Subject;o.push(m),i.next(m.asObservable())}},function(){for(;o.length>0;)o.shift().complete();i.complete()},function(u){for(;o.length>0;)o.shift().error(u);i.error(u)},function(){o=null}))})}Gs.windowCount=vM;var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.windowTime=void 0;var pM=de,yM=qe,mM=ge,bM=D,gM=F,_M=at,wM=pe,qh=st;function OM(e){for(var t,r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=(t=wM.popScheduler(n))!==null&&t!==void 0?t:yM.asyncScheduler,a=(r=n[0])!==null&&r!==void 0?r:null,u=n[1]||1/0;return bM.operate(function(s,c){var l=[],f=!1,d=function(_){var w=_.window,O=_.subs;w.complete(),O.unsubscribe(),_M.arrRemove(l,_),f&&p()},p=function(){if(l){var _=new mM.Subscription;c.add(_);var w=new pM.Subject,O={window:w,subs:_,seen:0};l.push(O),c.next(w.asObservable()),qh.executeSchedule(_,o,function(){return d(O)},e)}};a!==null&&a>=0?qh.executeSchedule(c,o,p,a,!0):f=!0,p();var m=function(_){return l.slice().forEach(_)},y=function(_){m(function(w){var O=w.window;return _(O)}),_(c),c.unsubscribe()};return s.subscribe(gM.createOperatorSubscriber(c,function(_){m(function(w){w.window.next(_),u<=++w.seen&&d(w)})},function(){return y(function(_){return _.complete()})},function(_){return y(function(w){return w.error(_)})})),function(){l=null}})}Ys.windowTime=OM;var Js={},SM=S&&S.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Js,"__esModule",{value:!0});Js.windowToggle=void 0;var EM=de,PM=ge,$M=D,Kh=L,Fc=F,Hh=Oe,AM=at;function xM(e,t){return $M.operate(function(r,n){var i=[],o=function(a){for(;0<i.length;)i.shift().error(a);n.error(a)};Kh.innerFrom(e).subscribe(Fc.createOperatorSubscriber(n,function(a){var u=new EM.Subject;i.push(u);var s=new PM.Subscription,c=function(){AM.arrRemove(i,u),u.complete(),s.unsubscribe()},l;try{l=Kh.innerFrom(t(a))}catch(f){o(f);return}n.next(u.asObservable()),s.add(l.subscribe(Fc.createOperatorSubscriber(n,c,Hh.noop,o)))},Hh.noop)),r.subscribe(Fc.createOperatorSubscriber(n,function(a){var u,s,c=i.slice();try{for(var l=SM(c),f=l.next();!f.done;f=l.next()){var d=f.value;d.next(a)}}catch(p){u={error:p}}finally{try{f&&!f.done&&(s=l.return)&&s.call(l)}finally{if(u)throw u.error}}},function(){for(;0<i.length;)i.shift().complete();n.complete()},o,function(){for(;0<i.length;)i.shift().unsubscribe()}))})}Js.windowToggle=xM;var Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.windowWhen=void 0;var CM=de,IM=D,Vh=F,RM=L;function kM(e){return IM.operate(function(t,r){var n,i,o=function(u){n.error(u),r.error(u)},a=function(){i?.unsubscribe(),n?.complete(),n=new CM.Subject,r.next(n.asObservable());var u;try{u=RM.innerFrom(e())}catch(s){o(s);return}u.subscribe(i=Vh.createOperatorSubscriber(r,a,a,o))};a(),t.subscribe(Vh.createOperatorSubscriber(r,function(u){return n.next(u)},function(){n.complete(),r.complete()},o,function(){i?.unsubscribe(),n=null}))})}Xs.windowWhen=kM;var Zs={},zh=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Qh=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.withLatestFrom=void 0;var jM=D,Gh=F,MM=L,DM=Se,TM=Oe,FM=pe;function LM(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=FM.popResultSelector(e);return jM.operate(function(n,i){for(var o=e.length,a=new Array(o),u=e.map(function(){return!1}),s=!1,c=function(f){MM.innerFrom(e[f]).subscribe(Gh.createOperatorSubscriber(i,function(d){a[f]=d,!s&&!u[f]&&(u[f]=!0,(s=u.every(DM.identity))&&(u=null))},TM.noop))},l=0;l<o;l++)c(l);n.subscribe(Gh.createOperatorSubscriber(i,function(f){if(s){var d=Qh([f],zh(a));i.next(r?r.apply(void 0,Qh([],zh(d))):d)}}))})}Zs.withLatestFrom=LM;var ec={};Object.defineProperty(ec,"__esModule",{value:!0});ec.zipAll=void 0;var BM=oi,NM=_o;function UM(e){return NM.joinAllInternals(BM.zip,e)}ec.zipAll=UM;var tc={},rc={},WM=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},qM=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(rc,"__esModule",{value:!0});rc.zip=void 0;var KM=oi,HM=D;function VM(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return HM.operate(function(r,n){KM.zip.apply(void 0,qM([r],WM(e))).subscribe(n)})}rc.zip=VM;var zM=S&&S.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},QM=S&&S.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(tc,"__esModule",{value:!0});tc.zipWith=void 0;var GM=rc;function YM(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return GM.zip.apply(void 0,QM([],zM(e)))}tc.zipWith=YM;(function(e){var t=S&&S.__createBinding||(Object.create?function(ln,fn,St,vr){vr===void 0&&(vr=St),Object.defineProperty(ln,vr,{enumerable:!0,get:function(){return fn[St]}})}:function(ln,fn,St,vr){vr===void 0&&(vr=St),ln[vr]=fn[St]}),r=S&&S.__exportStar||function(ln,fn){for(var St in ln)St!=="default"&&!Object.prototype.hasOwnProperty.call(fn,St)&&t(fn,ln,St)};Object.defineProperty(e,"__esModule",{value:!0}),e.interval=e.iif=e.generate=e.fromEventPattern=e.fromEvent=e.from=e.forkJoin=e.empty=e.defer=e.connectable=e.concat=e.combineLatest=e.bindNodeCallback=e.bindCallback=e.UnsubscriptionError=e.TimeoutError=e.SequenceError=e.ObjectUnsubscribedError=e.NotFoundError=e.EmptyError=e.ArgumentOutOfRangeError=e.firstValueFrom=e.lastValueFrom=e.isObservable=e.identity=e.noop=e.pipe=e.NotificationKind=e.Notification=e.Subscriber=e.Subscription=e.Scheduler=e.VirtualAction=e.VirtualTimeScheduler=e.animationFrameScheduler=e.animationFrame=e.queueScheduler=e.queue=e.asyncScheduler=e.async=e.asapScheduler=e.asap=e.AsyncSubject=e.ReplaySubject=e.BehaviorSubject=e.Subject=e.animationFrames=e.observable=e.ConnectableObservable=e.Observable=void 0,e.filter=e.expand=e.exhaustMap=e.exhaustAll=e.exhaust=e.every=e.endWith=e.elementAt=e.distinctUntilKeyChanged=e.distinctUntilChanged=e.distinct=e.dematerialize=e.delayWhen=e.delay=e.defaultIfEmpty=e.debounceTime=e.debounce=e.count=e.connect=e.concatWith=e.concatMapTo=e.concatMap=e.concatAll=e.combineLatestWith=e.combineLatestAll=e.combineAll=e.catchError=e.bufferWhen=e.bufferToggle=e.bufferTime=e.bufferCount=e.buffer=e.auditTime=e.audit=e.config=e.NEVER=e.EMPTY=e.scheduled=e.zip=e.using=e.timer=e.throwError=e.range=e.race=e.partition=e.pairs=e.onErrorResumeNext=e.of=e.never=e.merge=void 0,e.switchMap=e.switchAll=e.subscribeOn=e.startWith=e.skipWhile=e.skipUntil=e.skipLast=e.skip=e.single=e.shareReplay=e.share=e.sequenceEqual=e.scan=e.sampleTime=e.sample=e.refCount=e.retryWhen=e.retry=e.repeatWhen=e.repeat=e.reduce=e.raceWith=e.publishReplay=e.publishLast=e.publishBehavior=e.publish=e.pluck=e.pairwise=e.onErrorResumeNextWith=e.observeOn=e.multicast=e.min=e.mergeWith=e.mergeScan=e.mergeMapTo=e.mergeMap=e.flatMap=e.mergeAll=e.max=e.materialize=e.mapTo=e.map=e.last=e.isEmpty=e.ignoreElements=e.groupBy=e.first=e.findIndex=e.find=e.finalize=void 0,e.zipWith=e.zipAll=e.withLatestFrom=e.windowWhen=e.windowToggle=e.windowTime=e.windowCount=e.window=e.toArray=e.timestamp=e.timeoutWith=e.timeout=e.timeInterval=e.throwIfEmpty=e.throttleTime=e.throttle=e.tap=e.takeWhile=e.takeUntil=e.takeLast=e.take=e.switchScan=e.switchMapTo=void 0;var n=Z;Object.defineProperty(e,"Observable",{enumerable:!0,get:function(){return n.Observable}});var i=Gr;Object.defineProperty(e,"ConnectableObservable",{enumerable:!0,get:function(){return i.ConnectableObservable}});var o=Qr;Object.defineProperty(e,"observable",{enumerable:!0,get:function(){return o.observable}});var a=tu;Object.defineProperty(e,"animationFrames",{enumerable:!0,get:function(){return a.animationFrames}});var u=de;Object.defineProperty(e,"Subject",{enumerable:!0,get:function(){return u.Subject}});var s=Xi;Object.defineProperty(e,"BehaviorSubject",{enumerable:!0,get:function(){return s.BehaviorSubject}});var c=Jn;Object.defineProperty(e,"ReplaySubject",{enumerable:!0,get:function(){return c.ReplaySubject}});var l=Xn;Object.defineProperty(e,"AsyncSubject",{enumerable:!0,get:function(){return l.AsyncSubject}});var f=Ty;Object.defineProperty(e,"asap",{enumerable:!0,get:function(){return f.asap}}),Object.defineProperty(e,"asapScheduler",{enumerable:!0,get:function(){return f.asapScheduler}});var d=qe;Object.defineProperty(e,"async",{enumerable:!0,get:function(){return d.async}}),Object.defineProperty(e,"asyncScheduler",{enumerable:!0,get:function(){return d.asyncScheduler}});var p=By;Object.defineProperty(e,"queue",{enumerable:!0,get:function(){return p.queue}}),Object.defineProperty(e,"queueScheduler",{enumerable:!0,get:function(){return p.queueScheduler}});var m=Ny;Object.defineProperty(e,"animationFrame",{enumerable:!0,get:function(){return m.animationFrame}}),Object.defineProperty(e,"animationFrameScheduler",{enumerable:!0,get:function(){return m.animationFrameScheduler}});var y=Bn;Object.defineProperty(e,"VirtualTimeScheduler",{enumerable:!0,get:function(){return y.VirtualTimeScheduler}}),Object.defineProperty(e,"VirtualAction",{enumerable:!0,get:function(){return y.VirtualAction}});var _=Zi;Object.defineProperty(e,"Scheduler",{enumerable:!0,get:function(){return _.Scheduler}});var w=ge;Object.defineProperty(e,"Subscription",{enumerable:!0,get:function(){return w.Subscription}});var O=Yn;Object.defineProperty(e,"Subscriber",{enumerable:!0,get:function(){return O.Subscriber}});var E=lu;Object.defineProperty(e,"Notification",{enumerable:!0,get:function(){return E.Notification}}),Object.defineProperty(e,"NotificationKind",{enumerable:!0,get:function(){return E.NotificationKind}});var A=Tt;Object.defineProperty(e,"pipe",{enumerable:!0,get:function(){return A.pipe}});var P=Oe;Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return P.noop}});var x=Se;Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return x.identity}});var C=pu;Object.defineProperty(e,"isObservable",{enumerable:!0,get:function(){return C.isObservable}});var k=yu;Object.defineProperty(e,"lastValueFrom",{enumerable:!0,get:function(){return k.lastValueFrom}});var M=mu;Object.defineProperty(e,"firstValueFrom",{enumerable:!0,get:function(){return M.firstValueFrom}});var N=co;Object.defineProperty(e,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return N.ArgumentOutOfRangeError}});var K=mt;Object.defineProperty(e,"EmptyError",{enumerable:!0,get:function(){return K.EmptyError}});var Y=lo;Object.defineProperty(e,"NotFoundError",{enumerable:!0,get:function(){return Y.NotFoundError}});var Q=Ji;Object.defineProperty(e,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return Q.ObjectUnsubscribedError}});var H=fo;Object.defineProperty(e,"SequenceError",{enumerable:!0,get:function(){return H.SequenceError}});var Ie=$a;Object.defineProperty(e,"TimeoutError",{enumerable:!0,get:function(){return Ie.TimeoutError}});var Ce=Qi;Object.defineProperty(e,"UnsubscriptionError",{enumerable:!0,get:function(){return Ce.UnsubscriptionError}});var ne=bu;Object.defineProperty(e,"bindCallback",{enumerable:!0,get:function(){return ne.bindCallback}});var le=gu;Object.defineProperty(e,"bindNodeCallback",{enumerable:!0,get:function(){return le.bindNodeCallback}});var he=ir;Object.defineProperty(e,"combineLatest",{enumerable:!0,get:function(){return he.combineLatest}});var Ke=Zr;Object.defineProperty(e,"concat",{enumerable:!0,get:function(){return Ke.concat}});var oe=_u;Object.defineProperty(e,"connectable",{enumerable:!0,get:function(){return oe.connectable}});var Ee=tn;Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return Ee.defer}});var Pe=rt;Object.defineProperty(e,"empty",{enumerable:!0,get:function(){return Pe.empty}});var Re=wu;Object.defineProperty(e,"forkJoin",{enumerable:!0,get:function(){return Re.forkJoin}});var Ot=ut;Object.defineProperty(e,"from",{enumerable:!0,get:function(){return Ot.from}});var di=Ou;Object.defineProperty(e,"fromEvent",{enumerable:!0,get:function(){return di.fromEvent}});var yc=Su;Object.defineProperty(e,"fromEventPattern",{enumerable:!0,get:function(){return yc.fromEventPattern}});var hi=Eu;Object.defineProperty(e,"generate",{enumerable:!0,get:function(){return hi.generate}});var mc=Pu;Object.defineProperty(e,"iif",{enumerable:!0,get:function(){return mc.iif}});var bc=yo;Object.defineProperty(e,"interval",{enumerable:!0,get:function(){return bc.interval}});var Qo=$u;Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Qo.merge}});var sn=xl;Object.defineProperty(e,"never",{enumerable:!0,get:function(){return sn.never}});var ze=Zn;Object.defineProperty(e,"of",{enumerable:!0,get:function(){return ze.of}});var vi=mo;Object.defineProperty(e,"onErrorResumeNext",{enumerable:!0,get:function(){return vi.onErrorResumeNext}});var gc=Au;Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return gc.pairs}});var b=xu;Object.defineProperty(e,"partition",{enumerable:!0,get:function(){return b.partition}});var h=Br;Object.defineProperty(e,"race",{enumerable:!0,get:function(){return h.race}});var v=Iu;Object.defineProperty(e,"range",{enumerable:!0,get:function(){return v.range}});var g=so;Object.defineProperty(e,"throwError",{enumerable:!0,get:function(){return g.throwError}});var $=_t;Object.defineProperty(e,"timer",{enumerable:!0,get:function(){return $.timer}});var R=Ru;Object.defineProperty(e,"using",{enumerable:!0,get:function(){return R.using}});var j=oi;Object.defineProperty(e,"zip",{enumerable:!0,get:function(){return j.zip}});var G=eo;Object.defineProperty(e,"scheduled",{enumerable:!0,get:function(){return G.scheduled}});var ee=rt;Object.defineProperty(e,"EMPTY",{enumerable:!0,get:function(){return ee.EMPTY}});var ie=xl;Object.defineProperty(e,"NEVER",{enumerable:!0,get:function(){return ie.NEVER}}),r(nm,e);var $e=lr;Object.defineProperty(e,"config",{enumerable:!0,get:function(){return $e.config}});var se=bo;Object.defineProperty(e,"audit",{enumerable:!0,get:function(){return se.audit}});var cn=ku;Object.defineProperty(e,"auditTime",{enumerable:!0,get:function(){return cn.auditTime}});var Go=ju;Object.defineProperty(e,"buffer",{enumerable:!0,get:function(){return Go.buffer}});var Yo=Mu;Object.defineProperty(e,"bufferCount",{enumerable:!0,get:function(){return Yo.bufferCount}});var Fg=Du;Object.defineProperty(e,"bufferTime",{enumerable:!0,get:function(){return Fg.bufferTime}});var Lg=Tu;Object.defineProperty(e,"bufferToggle",{enumerable:!0,get:function(){return Lg.bufferToggle}});var Bg=Fu;Object.defineProperty(e,"bufferWhen",{enumerable:!0,get:function(){return Bg.bufferWhen}});var Ng=Lu;Object.defineProperty(e,"catchError",{enumerable:!0,get:function(){return Ng.catchError}});var Ug=Bu;Object.defineProperty(e,"combineAll",{enumerable:!0,get:function(){return Ug.combineAll}});var Wg=go;Object.defineProperty(e,"combineLatestAll",{enumerable:!0,get:function(){return Wg.combineLatestAll}});var qg=Nu;Object.defineProperty(e,"combineLatestWith",{enumerable:!0,get:function(){return qg.combineLatestWith}});var Kg=ni;Object.defineProperty(e,"concatAll",{enumerable:!0,get:function(){return Kg.concatAll}});var Hg=So;Object.defineProperty(e,"concatMap",{enumerable:!0,get:function(){return Hg.concatMap}});var Vg=Wu;Object.defineProperty(e,"concatMapTo",{enumerable:!0,get:function(){return Vg.concatMapTo}});var zg=qu;Object.defineProperty(e,"concatWith",{enumerable:!0,get:function(){return zg.concatWith}});var Qg=ai;Object.defineProperty(e,"connect",{enumerable:!0,get:function(){return Qg.connect}});var Gg=Vu;Object.defineProperty(e,"count",{enumerable:!0,get:function(){return Gg.count}});var Yg=zu;Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return Yg.debounce}});var Jg=Qu;Object.defineProperty(e,"debounceTime",{enumerable:!0,get:function(){return Jg.debounceTime}});var Xg=rn;Object.defineProperty(e,"defaultIfEmpty",{enumerable:!0,get:function(){return Xg.defaultIfEmpty}});var Zg=Gu;Object.defineProperty(e,"delay",{enumerable:!0,get:function(){return Zg.delay}});var e_=Eo;Object.defineProperty(e,"delayWhen",{enumerable:!0,get:function(){return e_.delayWhen}});var t_=Yu;Object.defineProperty(e,"dematerialize",{enumerable:!0,get:function(){return t_.dematerialize}});var r_=Ju;Object.defineProperty(e,"distinct",{enumerable:!0,get:function(){return r_.distinct}});var n_=Ao;Object.defineProperty(e,"distinctUntilChanged",{enumerable:!0,get:function(){return n_.distinctUntilChanged}});var i_=Xu;Object.defineProperty(e,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return i_.distinctUntilKeyChanged}});var o_=Zu;Object.defineProperty(e,"elementAt",{enumerable:!0,get:function(){return o_.elementAt}});var a_=es;Object.defineProperty(e,"endWith",{enumerable:!0,get:function(){return a_.endWith}});var u_=ts;Object.defineProperty(e,"every",{enumerable:!0,get:function(){return u_.every}});var s_=rs;Object.defineProperty(e,"exhaust",{enumerable:!0,get:function(){return s_.exhaust}});var c_=xo;Object.defineProperty(e,"exhaustAll",{enumerable:!0,get:function(){return c_.exhaustAll}});var l_=Co;Object.defineProperty(e,"exhaustMap",{enumerable:!0,get:function(){return l_.exhaustMap}});var f_=ns;Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return f_.expand}});var d_=Wt;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return d_.filter}});var h_=is;Object.defineProperty(e,"finalize",{enumerable:!0,get:function(){return h_.finalize}});var v_=Nr;Object.defineProperty(e,"find",{enumerable:!0,get:function(){return v_.find}});var p_=os;Object.defineProperty(e,"findIndex",{enumerable:!0,get:function(){return p_.findIndex}});var y_=as;Object.defineProperty(e,"first",{enumerable:!0,get:function(){return y_.first}});var m_=us;Object.defineProperty(e,"groupBy",{enumerable:!0,get:function(){return m_.groupBy}});var b_=Po;Object.defineProperty(e,"ignoreElements",{enumerable:!0,get:function(){return b_.ignoreElements}});var g_=ss;Object.defineProperty(e,"isEmpty",{enumerable:!0,get:function(){return g_.isEmpty}});var __=cs;Object.defineProperty(e,"last",{enumerable:!0,get:function(){return __.last}});var w_=gt;Object.defineProperty(e,"map",{enumerable:!0,get:function(){return w_.map}});var O_=$o;Object.defineProperty(e,"mapTo",{enumerable:!0,get:function(){return O_.mapTo}});var S_=ls;Object.defineProperty(e,"materialize",{enumerable:!0,get:function(){return S_.materialize}});var E_=fs;Object.defineProperty(e,"max",{enumerable:!0,get:function(){return E_.max}});var P_=en;Object.defineProperty(e,"mergeAll",{enumerable:!0,get:function(){return P_.mergeAll}});var $_=ds;Object.defineProperty(e,"flatMap",{enumerable:!0,get:function(){return $_.flatMap}});var A_=ct;Object.defineProperty(e,"mergeMap",{enumerable:!0,get:function(){return A_.mergeMap}});var x_=hs;Object.defineProperty(e,"mergeMapTo",{enumerable:!0,get:function(){return x_.mergeMapTo}});var C_=vs;Object.defineProperty(e,"mergeScan",{enumerable:!0,get:function(){return C_.mergeScan}});var I_=ps;Object.defineProperty(e,"mergeWith",{enumerable:!0,get:function(){return I_.mergeWith}});var R_=ms;Object.defineProperty(e,"min",{enumerable:!0,get:function(){return R_.min}});var k_=ui;Object.defineProperty(e,"multicast",{enumerable:!0,get:function(){return k_.multicast}});var j_=Jr;Object.defineProperty(e,"observeOn",{enumerable:!0,get:function(){return j_.observeOn}});var M_=Nn;Object.defineProperty(e,"onErrorResumeNextWith",{enumerable:!0,get:function(){return M_.onErrorResumeNextWith}});var D_=bs;Object.defineProperty(e,"pairwise",{enumerable:!0,get:function(){return D_.pairwise}});var T_=gs;Object.defineProperty(e,"pluck",{enumerable:!0,get:function(){return T_.pluck}});var F_=_s;Object.defineProperty(e,"publish",{enumerable:!0,get:function(){return F_.publish}});var L_=ws;Object.defineProperty(e,"publishBehavior",{enumerable:!0,get:function(){return L_.publishBehavior}});var B_=Os;Object.defineProperty(e,"publishLast",{enumerable:!0,get:function(){return B_.publishLast}});var N_=Ss;Object.defineProperty(e,"publishReplay",{enumerable:!0,get:function(){return N_.publishReplay}});var U_=Es;Object.defineProperty(e,"raceWith",{enumerable:!0,get:function(){return U_.raceWith}});var W_=hr;Object.defineProperty(e,"reduce",{enumerable:!0,get:function(){return W_.reduce}});var q_=Ps;Object.defineProperty(e,"repeat",{enumerable:!0,get:function(){return q_.repeat}});var K_=$s;Object.defineProperty(e,"repeatWhen",{enumerable:!0,get:function(){return K_.repeatWhen}});var H_=As;Object.defineProperty(e,"retry",{enumerable:!0,get:function(){return H_.retry}});var V_=xs;Object.defineProperty(e,"retryWhen",{enumerable:!0,get:function(){return V_.retryWhen}});var z_=Yi;Object.defineProperty(e,"refCount",{enumerable:!0,get:function(){return z_.refCount}});var Q_=Ro;Object.defineProperty(e,"sample",{enumerable:!0,get:function(){return Q_.sample}});var G_=Cs;Object.defineProperty(e,"sampleTime",{enumerable:!0,get:function(){return G_.sampleTime}});var Y_=Is;Object.defineProperty(e,"scan",{enumerable:!0,get:function(){return Y_.scan}});var J_=Rs;Object.defineProperty(e,"sequenceEqual",{enumerable:!0,get:function(){return J_.sequenceEqual}});var X_=ko;Object.defineProperty(e,"share",{enumerable:!0,get:function(){return X_.share}});var Z_=ks;Object.defineProperty(e,"shareReplay",{enumerable:!0,get:function(){return Z_.shareReplay}});var e0=js;Object.defineProperty(e,"single",{enumerable:!0,get:function(){return e0.single}});var t0=Ms;Object.defineProperty(e,"skip",{enumerable:!0,get:function(){return t0.skip}});var r0=Ds;Object.defineProperty(e,"skipLast",{enumerable:!0,get:function(){return r0.skipLast}});var n0=Ts;Object.defineProperty(e,"skipUntil",{enumerable:!0,get:function(){return n0.skipUntil}});var i0=Fs;Object.defineProperty(e,"skipWhile",{enumerable:!0,get:function(){return i0.skipWhile}});var o0=Ls;Object.defineProperty(e,"startWith",{enumerable:!0,get:function(){return o0.startWith}});var a0=Xr;Object.defineProperty(e,"subscribeOn",{enumerable:!0,get:function(){return a0.subscribeOn}});var u0=Bs;Object.defineProperty(e,"switchAll",{enumerable:!0,get:function(){return u0.switchAll}});var s0=an;Object.defineProperty(e,"switchMap",{enumerable:!0,get:function(){return s0.switchMap}});var c0=Ns;Object.defineProperty(e,"switchMapTo",{enumerable:!0,get:function(){return c0.switchMapTo}});var l0=Us;Object.defineProperty(e,"switchScan",{enumerable:!0,get:function(){return l0.switchScan}});var f0=nn;Object.defineProperty(e,"take",{enumerable:!0,get:function(){return f0.take}});var d0=Io;Object.defineProperty(e,"takeLast",{enumerable:!0,get:function(){return d0.takeLast}});var h0=Ws;Object.defineProperty(e,"takeUntil",{enumerable:!0,get:function(){return h0.takeUntil}});var v0=qs;Object.defineProperty(e,"takeWhile",{enumerable:!0,get:function(){return v0.takeWhile}});var p0=Ks;Object.defineProperty(e,"tap",{enumerable:!0,get:function(){return p0.tap}});var y0=jo;Object.defineProperty(e,"throttle",{enumerable:!0,get:function(){return y0.throttle}});var m0=Hs;Object.defineProperty(e,"throttleTime",{enumerable:!0,get:function(){return m0.throttleTime}});var b0=on;Object.defineProperty(e,"throwIfEmpty",{enumerable:!0,get:function(){return b0.throwIfEmpty}});var g0=Un;Object.defineProperty(e,"timeInterval",{enumerable:!0,get:function(){return g0.timeInterval}});var _0=$a;Object.defineProperty(e,"timeout",{enumerable:!0,get:function(){return _0.timeout}});var w0=Vs;Object.defineProperty(e,"timeoutWith",{enumerable:!0,get:function(){return w0.timeoutWith}});var O0=zs;Object.defineProperty(e,"timestamp",{enumerable:!0,get:function(){return O0.timestamp}});var S0=wo;Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return S0.toArray}});var E0=Qs;Object.defineProperty(e,"window",{enumerable:!0,get:function(){return E0.window}});var P0=Gs;Object.defineProperty(e,"windowCount",{enumerable:!0,get:function(){return P0.windowCount}});var $0=Ys;Object.defineProperty(e,"windowTime",{enumerable:!0,get:function(){return $0.windowTime}});var A0=Js;Object.defineProperty(e,"windowToggle",{enumerable:!0,get:function(){return A0.windowToggle}});var x0=Xs;Object.defineProperty(e,"windowWhen",{enumerable:!0,get:function(){return x0.windowWhen}});var C0=Zs;Object.defineProperty(e,"withLatestFrom",{enumerable:!0,get:function(){return C0.withLatestFrom}});var I0=ec;Object.defineProperty(e,"zipAll",{enumerable:!0,get:function(){return I0.zipAll}});var R0=tc;Object.defineProperty(e,"zipWith",{enumerable:!0,get:function(){return R0.zipWith}})})(ke);var JM="_rxdb_internal";async function XM(e,t){var r=await e.findDocumentsById([t],!1),n=r[0];if(n)return n}function ZM(e,t,r){var n=t.documentData,i=t.previousDocumentData,o={documentId:t.documentId,collectionName:r?r.name:void 0,isLocal:e,operation:t.operation,documentData:me.deepFreezeWhenDevMode(n),previousDocumentData:me.deepFreezeWhenDevMode(i)};return o}function Aa(e,t,r,n){if(n)throw n.status===409?I("CONFLICT",{collection:e.name,id:t,writeError:n,data:r}):n.status===422?I("VD2",{collection:e.name,id:t,writeError:n,data:r}):n}function eD(e,t,r,n,i,o,a){for(var u=!!e.schema.attachments,s=[],c=[],l=[],f=Ja(10),d={id:f,events:[],checkpoint:null,context:i,startTime:Ge(),endTime:0},p=d.events,m=[],y=[],_=[],w=r.size>0,O,E=n.length,A=function(){var x=n[P],C=x.document,k=x.previous,M=C[t],N=C._deleted,K=k&&k._deleted,Y=void 0;w&&(Y=r.get(M));var Q;if(Y){var Ce=Y._rev;if(!k||k&&Ce!==k._rev){var ne={isError:!0,status:409,documentId:M,writeRow:x,documentInDb:Y};return l.push(ne),1}var le=u?Lc(x):x;u&&(N?k&&Object.keys(k._attachments).forEach(Pe=>{y.push({documentId:M,attachmentId:Pe,digest:fe(k)._attachments[Pe].digest})}):(Object.entries(C._attachments).find(([Pe,Re])=>{var Ot=k?k._attachments[Pe]:void 0;return!Ot&&!Re.data&&(Q={documentId:M,documentInDb:Y,isError:!0,status:510,writeRow:x,attachmentId:Pe}),!0}),Q||Object.entries(C._attachments).forEach(([Pe,Re])=>{var Ot=k?k._attachments[Pe]:void 0;if(!Ot)m.push({documentId:M,attachmentId:Pe,attachmentData:Re,digest:Re.digest});else{var di=le.document._attachments[Pe].digest;Re.data&&Ot.digest!==di&&_.push({documentId:M,attachmentId:Pe,attachmentData:Re,digest:Re.digest})}}))),Q?l.push(Q):(u?(c.push(Lc(le)),a&&a(C)):(c.push(le),a&&a(C)),O=le);var he=null,Ke=null,oe=null;if(K&&!N)oe="INSERT",he=u?Or(C):C;else if(k&&!K&&!N)oe="UPDATE",he=u?Or(C):C,Ke=k;else if(N)oe="DELETE",he=fe(C),Ke=k;else throw I("SNH",{args:{writeRow:x}});var Ee={documentId:M,documentData:he,previousDocumentData:Ke,operation:oe};p.push(Ee)}else{var H=!!N;if(u&&Object.entries(C._attachments).forEach(([Pe,Re])=>{Re.data?m.push({documentId:M,attachmentId:Pe,attachmentData:Re,digest:Re.digest}):(Q={documentId:M,isError:!0,status:510,writeRow:x,attachmentId:Pe},l.push(Q))}),Q||(u?(s.push(Lc(x)),o&&o(C)):(s.push(x),o&&o(C)),O=x),!H){var Ie={documentId:M,operation:"INSERT",documentData:u?Or(C):C,previousDocumentData:u&&k?Or(k):k};p.push(Ie)}}},P=0;P<E;P++)A();return{bulkInsertDocs:s,bulkUpdateDocs:c,newestRow:O,errors:l,eventBulk:d,attachmentsAdd:m,attachmentsRemove:y,attachmentsUpdate:_}}function Lc(e){return{previous:e.previous,document:Or(e.document)}}function tD(e){return atob(e).length}function rD(e){var t=e.data;if(!t)return e;var r={length:tD(t),digest:e.digest,type:e.type};return r}function Or(e){if(!e._attachments||Object.keys(e._attachments).length===0)return e;var t=xe(e);return t._attachments={},Object.entries(e._attachments).forEach(([r,n])=>{t._attachments[r]=rD(n)}),t}function hm(e){var t=xe(e);return t._meta=xe(e._meta),t}function vm(e,t,r){me.deepFreezeWhenDevMode(r);var n=ot(r.primaryKey);function i(a){var u=xe(a.document);if(u._meta=xe(u._meta),me.isDevMode()){u=Xp(n,r,u);try{typeof structuredClone=="function"?structuredClone(a):JSON.parse(JSON.stringify(a))}catch{throw I("DOC24",{collection:t.collectionName,document:a.document})}a.previous,a.previous&&Object.keys(a.previous._meta).forEach(s=>{if(!a.document._meta.hasOwnProperty(s))throw I("SNH",{dataBefore:a.previous,dataAfter:a.document})})}return u._meta.lwt=Ge(),u._rev=vl(e.token,a.previous),{document:u,previous:a.previous}}var o={originalStorageInstance:t,schema:t.schema,internals:t.internals,collectionName:t.collectionName,databaseName:t.databaseName,options:t.options,bulkWrite(a,u){var s=a.map(c=>i(c));return e.lockedRun(()=>t.bulkWrite(s,u)).then(c=>{var l={error:[],success:c.success.slice(0)},f=c.error.filter(p=>p.status===409&&!p.writeRow.previous&&!p.writeRow.document._deleted&&fe(p.documentInDb)._deleted?!0:(l.error.push(p),!1));if(f.length>0){var d=f.map(p=>({previous:p.documentInDb,document:Object.assign({},p.writeRow.document,{_rev:vl(e.token,p.documentInDb)})}));return e.lockedRun(()=>t.bulkWrite(d,u)).then(p=>(Mn(l.error,p.error),Mn(l.success,p.success),l))}return c})},query(a){return e.lockedRun(()=>t.query(a))},count(a){return e.lockedRun(()=>t.count(a))},info(){return e.lockedRun(()=>t.info())},findDocumentsById(a,u){return e.lockedRun(()=>t.findDocumentsById(a,u))},getAttachmentData(a,u,s){return e.lockedRun(()=>t.getAttachmentData(a,u,s))},getChangedDocumentsSince(a,u){return e.lockedRun(()=>t.getChangedDocumentsSince(fe(a),u))},cleanup(a){return e.lockedRun(()=>t.cleanup(a))},remove(){return e.storageInstances.delete(o),e.lockedRun(()=>t.remove())},close(){return e.storageInstances.delete(o),e.lockedRun(()=>t.close())},changeStream(){return t.changeStream()},conflictResultionTasks(){return t.conflictResultionTasks()},resolveConflictResultionTask(a){if(a.output.isEqual)return t.resolveConflictResultionTask(a);var u=Object.assign({},a.output.documentData,{_meta:Ga(),_rev:Ya(),_attachments:{}}),s=xe(u);return delete s._meta,delete s._rev,delete s._attachments,t.resolveConflictResultionTask({id:a.id,output:{isEqual:!1,documentData:s}})}};return e.storageInstances.add(o),o}function nD(e){if(e.schema.keyCompression)throw I("UT5",{args:{params:e}});if(iD(e.schema))throw I("UT6",{args:{params:e}});if(e.schema.attachments&&e.schema.attachments.compression)throw I("UT7",{args:{params:e}})}function iD(e){return!!(e.encrypted&&e.encrypted.length>0||e.attachments&&e.attachments.encrypted)}var oD=function(){function e(r,n,i,o){this.queueByDocId=new Map,this.isRunning=!1,this.storageInstance=r,this.primaryPath=n,this.preWrite=i,this.postWrite=o}var t=e.prototype;return t.addWrite=function(n,i){var o=n[this.primaryPath],a=Dt(this.queueByDocId,o,()=>[]),u=new Promise((s,c)=>{var l={lastKnownDocumentState:n,modifier:i,resolve:s,reject:c};fe(a).push(l),this.triggerRun()});return u},t.triggerRun=async function(){if(!(this.isRunning===!0||this.queueByDocId.size===0)){this.isRunning=!0;var n=[],i=this.queueByDocId;this.queueByDocId=new Map,await Promise.all(Array.from(i.entries()).map(async([a,u])=>{var s=aD(u.map(f=>f.lastKnownDocumentState)),c=s;for(var l of u)try{c=await l.modifier(Dn(c))}catch(f){l.reject(f),l.reject=()=>{},l.resolve=()=>{}}try{await this.preWrite(c,s)}catch(f){u.forEach(d=>d.reject(f));return}n.push({previous:s,document:c})}));var o=n.length>0?await this.storageInstance.bulkWrite(n,"incremental-write"):{error:[],success:[]};return await Promise.all(o.success.map(a=>{var u=a[this.primaryPath];this.postWrite(a);var s=ki(i,u);s.forEach(c=>c.resolve(a))})),o.error.forEach(a=>{var u=a.documentId,s=ki(i,u),c=Jp(a);if(c){var l=Dt(this.queueByDocId,u,()=>[]);s.reverse().forEach(d=>{d.lastKnownDocumentState=fe(c.documentInDb),fe(l).unshift(d)})}else{var f=Dw(a);s.forEach(d=>d.reject(f))}}),this.isRunning=!1,this.triggerRun()}},e}();function Yh(e){var t=async r=>{var n=Z0(r);n._deleted=r._deleted;var i=await e(n),o=Object.assign({},i,{_meta:r._meta,_attachments:r._attachments,_rev:r._rev,_deleted:typeof i._deleted<"u"?i._deleted:r._deleted});return typeof o._deleted>"u"&&(o._deleted=!1),o};return t}function aD(e){var t=e[0],r=hl(t._rev).height;return e.forEach(n=>{var i=hl(n._rev).height;i>r&&(t=n,r=i)}),t}var Mo={get primaryPath(){var e=this;if(e.isInstanceOfRxDocument)return e.collection.schema.primaryPath},get primary(){var e=this;if(e.isInstanceOfRxDocument)return e._data[e.primaryPath]},get revision(){var e=this;if(e.isInstanceOfRxDocument)return e._data._rev},get deleted$(){var e=this;if(e.isInstanceOfRxDocument)return e.$.pipe(_r(t=>t._data._deleted))},get deleted(){var e=this;if(e.isInstanceOfRxDocument)return e._data._deleted},getLatest(){var e=this.collection._docCache.getLatestDocumentData(this.primary);return this.collection._docCache.getCachedRxDocument(e)},get $(){var e=this;return e.collection.$.pipe($n(t=>!t.isLocal),$n(t=>t.documentId===this.primary),_r(t=>Ay(t)),$y(e.collection._docCache.getLatestDocumentData(this.primary)),wl((t,r)=>t._rev===r._rev),_r(t=>this.collection._docCache.getCachedRxDocument(t)),Py(Qp))},get$(e){if(me.isDevMode()){if(e.includes(".item."))throw I("DOC1",{path:e});if(e===this.primaryPath)throw I("DOC2");if(this.collection.schema.finalFields.includes(e))throw I("DOC3",{path:e});var t=tr(this.collection.schema.jsonSchema,e);if(!t)throw I("DOC4",{path:e})}return this.$.pipe(_r(r=>Gt(r,e)),wl())},populate(e){var t=tr(this.collection.schema.jsonSchema,e),r=this.get(e);if(!r)return bw;if(!t)throw I("DOC5",{path:e});if(!t.ref)throw I("DOC6",{path:e,schemaObj:t});var n=this.collection.database.collections[t.ref];if(!n)throw I("DOC7",{ref:t.ref,path:e,schemaObj:t});return t.type==="array"?n.findByIds(r).exec().then(i=>{var o=i.values();return Array.from(o)}):n.findOne(r).exec()},get(e){return Dt(this._propertyCache,e,()=>{var t=Gt(this._data,e);if(typeof t!="object"||t===null||Array.isArray(t))return me.deepFreezeWhenDevMode(t);var r=this,n=new Proxy(xe(t),{get(i,o){if(typeof o!="string")return i[o];var a=o.charAt(o.length-1);if(a==="$"){var u=o.slice(0,-1);return r.get$($r(e+"."+u))}else if(a==="_"){var s=o.slice(0,-1);return r.populate($r(e+"."+s))}else return r.get($r(e+"."+o))}});return n})},toJSON(e=!1){if(e)return me.deepFreezeWhenDevMode(this._data);var t=xe(this._data);return delete t._rev,delete t._attachments,delete t._deleted,delete t._meta,me.deepFreezeWhenDevMode(t)},toMutableJSON(e=!1){return Dn(this.toJSON(e))},update(e){throw ae("update")},incrementalUpdate(e){throw ae("update")},updateCRDT(e){throw ae("crdt")},putAttachment(){throw ae("attachments")},getAttachment(){throw ae("attachments")},allAttachments(){throw ae("attachments")},get allAttachments$(){throw ae("attachments")},async modify(e,t){var r=this._data,n=await Yh(e)(r);return this._saveData(n,r)},incrementalModify(e,t){return this.collection.incrementalWriteQueue.addWrite(this._data,Yh(e)).then(r=>this.collection._docCache.getCachedRxDocument(r))},patch(e){var t=this._data,r=Dn(t);return Object.entries(e).forEach(([n,i])=>{r[n]=i}),this._saveData(r,t)},incrementalPatch(e){return this.incrementalModify(t=>(Object.entries(e).forEach(([r,n])=>{t[r]=n}),t))},async _saveData(e,t){if(e=xe(e),this._data._deleted)throw I("DOC11",{id:this.primary,document:this});await ym(this.collection,e,t);var r=await this.collection.storageInstance.bulkWrite([{previous:t,document:e}],"rx-document-save-data"),n=r.error[0];return Aa(this.collection,this.primary,e,n),await this.collection._runHooks("post","save",e,this),this.collection._docCache.getCachedRxDocument(r.success[0])},remove(){var e=this.collection;if(this.deleted)return Promise.reject(I("DOC13",{document:this,id:this.primary}));var t=xe(this._data),r;return e._runHooks("pre","remove",t,this).then(async()=>{t._deleted=!0;var n=await e.storageInstance.bulkWrite([{previous:this._data,document:t}],"rx-document-remove"),i=n.error[0];return Aa(e,this.primary,t,i),n.success[0]}).then(n=>(r=n,this.collection._runHooks("post","remove",t,this))).then(()=>this.collection._docCache.getCachedRxDocument(r))},incrementalRemove(){return this.incrementalModify(async e=>(await this.collection._runHooks("pre","remove",e,this),e._deleted=!0,e)).then(async e=>(await this.collection._runHooks("post","remove",e._data,e),e))},destroy(){throw I("DOC14")}};function pm(e=Mo){var t=function(n,i){this.collection=n,this._data=i,this._propertyCache=new Map,this.isInstanceOfRxDocument=!0};return t.prototype=e,t}function uD(e,t,r){var n=new e(t,r);return et("createRxDocument",n),n}function ym(e,t,r){return t._meta=Object.assign({},r._meta,t._meta),me.isDevMode()&&e.schema.validateChange(r,t),e._runHooks("pre","save",t,r)}function Bf(e){return e[e.length-1]}function sD(e){const t=typeof e;return e!==null&&(t==="object"||t==="function")}function Jh(e,t,r){if(Array.isArray(t)&&(t=t.join(".")),!sD(e)||typeof t!="string")return r===void 0?e:r;const n=t.split(".");if(n.length===0)return r;for(let i=0;i<n.length;i++){const o=n[i];if(cD(e,o)?e=i===n.length-1?void 0:null:e=e[o],e==null){if(i!==n.length-1)return r;break}}return e===void 0?r:e}function cD(e,t){if(typeof t!="number"&&Array.isArray(e)){const r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}const mm=e=>!!e.queryParams.limit,lD=e=>e.queryParams.limit===1,fD=e=>!!(e.queryParams.skip&&e.queryParams.skip>0),dD=e=>e.changeEvent.operation==="DELETE",hD=e=>e.changeEvent.operation==="INSERT",vD=e=>e.changeEvent.operation==="UPDATE",pD=e=>mm(e)&&e.previousResults.length>=e.queryParams.limit,yD=e=>{const t=e.queryParams.sortFields,r=e.changeEvent.previous,n=e.changeEvent.doc;if(!n)return!1;if(!r)return!0;for(let i=0;i<t.length;i++){const o=t[i],a=Jh(r,o),u=Jh(n,o);if(a!==u)return!0}return!1},mD=e=>{const t=e.changeEvent.id;if(e.keyDocumentMap)return e.keyDocumentMap.has(t);{const r=e.queryParams.primaryKey,n=e.previousResults;for(let i=0;i<n.length;i++)if(n[i][r]===t)return!0;return!1}},bD=e=>{const t=e.previousResults[0];return!!(t&&t[e.queryParams.primaryKey]===e.changeEvent.id)},gD=e=>{const t=Bf(e.previousResults);return!!(t&&t[e.queryParams.primaryKey]===e.changeEvent.id)},_D=e=>{const t=e.changeEvent.previous;if(!t)return!1;const r=e.previousResults[0];return r?r[e.queryParams.primaryKey]===e.changeEvent.id?!0:e.queryParams.sortComparator(t,r)<0:!1},wD=e=>{const t=e.changeEvent.previous;if(!t)return!1;const r=Bf(e.previousResults);return r?r[e.queryParams.primaryKey]===e.changeEvent.id?!0:e.queryParams.sortComparator(t,r)>0:!1},OD=e=>{const t=e.changeEvent.doc;if(!t)return!1;const r=e.previousResults[0];return r?r[e.queryParams.primaryKey]===e.changeEvent.id?!0:e.queryParams.sortComparator(t,r)<0:!1},SD=e=>{const t=e.changeEvent.doc;if(!t)return!1;const r=Bf(e.previousResults);return r?r[e.queryParams.primaryKey]===e.changeEvent.id?!0:e.queryParams.sortComparator(t,r)>0:!1},ED=e=>{const t=e.changeEvent.previous;return t?e.queryParams.queryMatcher(t):!1},PD=e=>{const t=e.changeEvent.doc;return t?e.queryParams.queryMatcher(t):!1},$D=e=>e.previousResults.length===0,AD={0:hD,1:vD,2:dD,3:mm,4:lD,5:fD,6:$D,7:pD,8:bD,9:gD,10:yD,11:mD,12:_D,13:wD,14:OD,15:SD,16:ED,17:PD};function xD(e,t,r,n){var i=e.length,o=i-1,a=0;if(i===0)return e.push(t),0;for(var u;n<=o;)a=n+(o-n>>1),u=e[a],r(u,t)<=0?n=a+1:o=a-1;return r(u,t)<=0&&a++,e.splice(a,0,t),a}const CD=e=>{},Nf=e=>{e.previousResults.unshift(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},Uf=e=>{e.previousResults.push(e.changeEvent.doc),e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,e.changeEvent.doc)},Wf=e=>{const t=e.previousResults.shift();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},qf=e=>{const t=e.previousResults.pop();e.keyDocumentMap&&t&&e.keyDocumentMap.delete(t[e.queryParams.primaryKey])},ID=e=>{Wf(e),Uf(e)},RD=e=>{qf(e),Nf(e)},kD=e=>{Wf(e),Nf(e)},jD=e=>{qf(e),Uf(e)},bm=e=>{e.keyDocumentMap&&e.keyDocumentMap.delete(e.changeEvent.id);const t=e.queryParams.primaryKey,r=e.previousResults;for(let n=0;n<r.length;n++)if(r[n][t]===e.changeEvent.id){r.splice(n,1);break}},MD=e=>{const t=e.changeEvent.doc,r=e.queryParams.primaryKey,n=e.previousResults;for(let i=0;i<n.length;i++)if(n[i][r]===e.changeEvent.id){n[i]=t,e.keyDocumentMap&&e.keyDocumentMap.set(e.changeEvent.id,t);break}},DD=e=>{const t={_id:"wrongHuman"+(new Date).getTime()};e.previousResults.length=0,e.previousResults.push(t),e.keyDocumentMap&&(e.keyDocumentMap.clear(),e.keyDocumentMap.set(t._id,t))},gm=e=>{const t=e.changeEvent.id,r=e.changeEvent.doc;if(e.keyDocumentMap){if(e.keyDocumentMap.has(t))return;e.keyDocumentMap.set(t,r)}else if(e.previousResults.find(i=>i[e.queryParams.primaryKey]===t))return;xD(e.previousResults,r,e.queryParams.sortComparator,0)},TD=e=>{bm(e),gm(e)},FD=e=>{throw new Error("Action runFullQueryAgain must be implemented by yourself")},LD=e=>{throw new Error("Action unknownAction should never be called")},BD=["doNothing","insertFirst","insertLast","removeFirstItem","removeLastItem","removeFirstInsertLast","removeLastInsertFirst","removeFirstInsertFirst","removeLastInsertLast","removeExisting","replaceExisting","alwaysWrong","insertAtSortPosition","removeExistingAndInsertAtSortPosition","runFullQueryAgain","unknownAction"],ND={doNothing:CD,insertFirst:Nf,insertLast:Uf,removeFirstItem:Wf,removeLastItem:qf,removeFirstInsertLast:ID,removeLastInsertFirst:RD,removeFirstInsertFirst:kD,removeLastInsertLast:jD,removeExisting:bm,replaceExisting:MD,alwaysWrong:DD,insertAtSortPosition:gm,removeExistingAndInsertAtSortPosition:TD,runFullQueryAgain:FD,unknownAction:LD},UD=40;function Bc(e){return e.charCodeAt(0)-UD}function WD(e){return e?"1":"0"}function Xh(e,t){const r=[];for(let n=0,i=e.length;n<i;n+=t)r.push(e.substring(n,n+t));return r}function qD(e){const t=new Map,n=2+parseInt(e.charAt(0)+e.charAt(1),10)*2,i=e.substring(2,n),o=Xh(i,2);for(let y=0;y<o.length;y++){const _=o[y],w=_.charAt(0),O=Bc(_.charAt(1));t.set(w,O)}const a=e.substring(n,e.length-3),u=Xh(a,4);for(let y=0;y<u.length;y++){const _=u[y],w=_.charAt(0),O=_.charAt(1),E=_.charAt(2),A=Bc(_.charAt(3));if(!t.has(O))throw new Error("missing node with id "+O);if(!t.has(E))throw new Error("missing node with id "+E);const P=t.get(O),x=t.get(E),C={l:A,0:P,1:x};t.set(w,C)}const s=e.slice(-3),c=s.charAt(0),l=s.charAt(1),f=Bc(s.charAt(2)),d=t.get(c),p=t.get(l);return{l:f,0:d,1:p}}function KD(e,t,r){let n=e,i=e.l;for(;;){const o=t[i](r),a=WD(o);if(n=n[a],typeof n=="number"||typeof n=="string")return n;i=n.l}}const HD="14a1b,c+d2e5f0g/h.i4j*k-l)m(n6obh9pce9qnh9rad9scm9tae9uan9vbf9wbe9xbn9ycg9zck9{cn9|nd9}ne9~nf9\x7fng9\xa1nm9\xa2nk9\xa3mh9\xa4mi9\xa5mj9\xa6mk9\xa7ml9\xa8mn9\xa9mc8\xaa\xa4{8\xab\xa5z8\xac\xa8s8\xad\xa8n8\xaemn8\xaf\xa8\xa18\xb0\xa8m8\xb1pz7\xb2\xaa\xab7\xb3{z7\xb4\xad\xae7\xb5}n7\xb6\xa4\xa57\xb7\xa8m7\xb8wo6\xb9\xb5}6\xbanq6\xbb\xb2\xac6\xbctu6\xbdwx6\xbe\xb4\xaf6\xbf\xb5n6\xc0\xae\xaf6\xc1\xb6\xa76\xc2\xb7\xa36\xc3\xb6\xa86\xc4\xb7\xa86\xc5m\xa66\xc6m\xa86\xc7\xa4\xa55\xc8\xa8m5\xc9m\xa94\xcam\xae4\xcb\xc7\xa74\xcc\xc8\xa34\xcd\xc7\xac4\xce\xc3\xbb4\xcf\xc8\xaf4\xd0\xc4\xbe4\xd1m\xa64\xd2m\xaf4\xd3\xc6\xc04\xd4ma3\xd5mn3\xd6\xc9a3\xd7\xcan3\xd8\xcbr3\xd9\xc1t3\xda\xcc|3\xdb\xc2\xb93\xdc\xcdr3\xdd\xce\xbc3\xde\xcf|3\xdf\xd0\xbf3\xe0\xd8\xd92\xe1v\xb82\xe2y\xb12\xe3\xda\xdb2\xe4~\xba2\xe5\x7f\xb52\xe6\xdc\xdd2\xe7v\xbd2\xe8y\xb32\xe9z{2\xea\xde\xdf2\xeb~n2\xec\x7fn2\xed\xd1\xc52\xee\xd2\xd32\xef\xa2n2\xf0\xd4b1\xf1\xd5n1\xf2\xd6b1\xf3\xd7n1\xf4\xe0\xe11\xf5\xe2z1\xf6\xe3\xe41\xf7\xe6\xe71\xf8\xe8\xe91\xf9\xea\xeb1\xfa\xf0c0\xfb\xf1n0\xfc\xf2c0\xfd\xf3n0\xfemn0\xff\xcan0Ā\xf4\xf50ā\xf6\xe50Ă\xf7\xf80ă\xf9\xec0Ą\xed\xef0ą\xee\xef0Ć\xfa\xfb/ć\xfc\xfd/ĈĀā/ĉĂă/Ċ\xc1\xc2/ċ\xc3\xc4/Č\xfam.č\xfcm.ĎĆm.ďćm.Đ\xfem.đ\xffm.ĒĀ\xa7.ēĂ\xb0.ĔĈ\xa7.ĕĉ\xb0.ĖĄ\xa7.ėą\xb0.Ę\xc1\xa7.ę\xc3\xa8.ĚĊ\xa7.ěċ\xa8.Ĝ\xc5\xa7.ĝ\xc6\xa8.ĞČč-ğĎď-ĠĐđ-ġĒē-ĢĔĕ-ģĖė-ĤĘę-ĥĚě-ĦĜĝ-ħğĠ,ĨĢģ,ĩĥĦ,ĪĞħ+īġĨ+ĬĤĩ+ĭĪī)ĭĬ(";let Nc;function VD(){return Nc||(Nc=qD(HD)),Nc}const zD=e=>KD(VD(),AD,e);function QD(e){const t=zD(e);return BD[t]}function GD(e,t,r,n,i){const o=ND[e];return o({queryParams:t,changeEvent:r,previousResults:n,keyDocumentMap:i}),n}var _n=String.fromCharCode(65535),Sr=Number.MIN_VALUE;function YD(e,t){var r=ot(e.primaryKey),n=t.selector,i=e.indexes?e.indexes.slice(0):[];t.index?i=[t.index]:i.push([r]);var o=t.sort.map(l=>Object.keys(l)[0]),a=o.join(","),u=!!t.sort.find(l=>Object.values(l)[0]==="desc"),s=-1,c;return i.forEach(l=>{var f=!0,d=!0,p=l.map(_=>{var w=n[_],O=w?Object.keys(w):[],E={};if(!w||!O.length){var A=d?Sr:_n;E={startKey:A,endKey:f?_n:Sr,inclusiveStart:!0,inclusiveEnd:!0}}else O.forEach(P=>{if(Kf.has(P)){var x=w[P],C=ZD(P,x);E=Object.assign(E,C)}});return typeof E.startKey>"u"&&(E.startKey=Sr),typeof E.endKey>"u"&&(E.endKey=_n),typeof E.inclusiveStart>"u"&&(E.inclusiveStart=!0),typeof E.inclusiveEnd>"u"&&(E.inclusiveEnd=!0),d&&!E.inclusiveStart&&(d=!1),f&&!E.inclusiveEnd&&(f=!1),E}),m={index:l,startKeys:p.map(_=>_.startKey),endKeys:p.map(_=>_.endKey),inclusiveEnd:f,inclusiveStart:d,sortFieldsSameAsIndexFields:!u&&a===l.join(","),selectorSatisfiedByIndex:Zh(l,t.selector)},y=eT(e,t,m);(y>0&&y>s||t.index)&&(s=y,c=m)}),c||(c={index:[r],startKeys:[Sr],endKeys:[_n],inclusiveEnd:!0,inclusiveStart:!0,sortFieldsSameAsIndexFields:!u&&a===r,selectorSatisfiedByIndex:Zh([r],t.selector)}),c}var Kf=new Set(["$eq","$gt","$gte","$lt","$lte"]),JD=new Set(["$eq","$gt","$gte"]),XD=new Set(["$eq","$lt","$lte"]);function Zh(e,t){var r=Object.entries(t),n=r.find(([l,f])=>{if(!e.includes(l))return!0;var d=Object.entries(f).find(([p,m])=>!Kf.has(p));return d});if(n)return!1;var i,o=e.find(l=>{var f=t[l];if(!f)return!1;var d=Object.keys(f).find(p=>JD.has(p));return i&&d?!0:(d!=="$eq"&&(i=d),!1)});if(o)return!1;var a,u=e.find(l=>{var f=t[l];if(!f)return!1;var d=Object.keys(f).find(p=>XD.has(p));return a&&d?!0:(d!=="$eq"&&(a=d),!1)});if(u)return!1;var s=new Set(Object.keys(t));for(var c of e){if(s.size===0)break;if(s.has(c))s.delete(c);else return!1}return!0}function ZD(e,t){switch(e){case"$eq":return{startKey:t,endKey:t};case"$lte":return{endKey:t};case"$gte":return{startKey:t};case"$lt":return{endKey:t,inclusiveEnd:!1};case"$gt":return{startKey:t,inclusiveStart:!1};default:throw new Error("SNH")}}function eT(e,t,r){var n=0,i=l=>{l>0&&(n=n+l)},o=10,a=wc(r.startKeys,l=>l!==Sr&&l!==_n);i(a*o);var u=wc(r.startKeys,l=>l!==_n&&l!==Sr);i(u*o);var s=wc(r.startKeys,(l,f)=>l===r.endKeys[f]);i(s*o*1.5);var c=r.sortFieldsSameAsIndexFields?5:0;return i(c),n}const tT=2147483647,rT=-2147483648,nT=Number.MAX_SAFE_INTEGER,iT=Number.MIN_SAFE_INTEGER,Ur=Symbol("missing"),_m=Object.freeze(new Error("mingo: cycle detected while processing object/array")),oT=Object.getPrototypeOf([]),wm=Object.getPrototypeOf({}),aT="[object Object]",uT=/^\[object ([a-zA-Z0-9]+)\]$/;class Hf{}class Vf{}const Wr=e=>e===null?Hf:e===void 0?Vf:e.constructor,nc=e=>{const t=hT(e);let r=0,n=t.length;for(;n;)r=(r<<5)-r^t.charCodeAt(--n);return r>>>0},Om=new Set(["null","undefined","boolean","number","string","date","regexp"]),ev=new Set([Vf,Hf,Boolean,String,Number]),pi=e=>e.toString(),Xe=e=>`${Wr(e).name}[${e.toString()}]`,xa=new Map([[Number,pi],[Boolean,pi],[RegExp,pi],[Function,pi],[Symbol,pi],[BigInt,e=>"0x"+e.toString(16)],[Date,e=>e.toISOString()],[String,JSON.stringify],[Hf,e=>"null"],[Vf,e=>"undefined"],[Int8Array,Xe],[Uint8Array,Xe],[Uint8ClampedArray,Xe],[Int16Array,Xe],[Uint16Array,Xe],[Int32Array,Xe],[Uint32Array,Xe],[Float32Array,Xe],[Float64Array,Xe],[BigInt64Array,Xe],[BigUint64Array,Xe]]),sT={null:0,undefined:0,number:1,string:2,object:3,array:4,boolean:5,date:6,regexp:7,function:8},nt=(e,t)=>{e===Ur&&(e=void 0),t===Ur&&(t=void 0);const[r,n]=[e,t].map(i=>sT[Ti(i).toLowerCase()]);return r!==n?r-n:r===1||r===2||r===6?e<t?-1:e>t?1:0:qr(e,t)?0:e<t?-1:e>t?1:0};function Ye(e,t){if(!e)throw new Error(t)}const cT=e=>{const t=Object.getPrototypeOf(Wr(e));return t&&t.name==="TypedArray"},tv=e=>{if(ev.has(Wr(e)))return e;const t=new Set,r=n=>{if(t.has(n))throw _m;const i=Wr(n);if(ev.has(i))return n;try{if(De(n))return t.add(n),n.map(r);if(we(n)){t.add(n);const o={};for(const a in n)o[a]=r(n[a]);return o}}finally{t.delete(n)}return i===Date||i===RegExp||cT(n)?new i(n):n};return r(e)},Ti=e=>uT.exec(Object.prototype.toString.call(e))[1],Uc=e=>typeof e=="boolean",Ft=e=>typeof e=="string",zt=e=>!isNaN(e)&&typeof e=="number",De=Array.isArray,we=e=>{if(!e)return!1;const t=Object.getPrototypeOf(e);return(t===wm||t===null)&&aT===Object.prototype.toString.call(e)},ic=e=>e===Object(e),rv=e=>e instanceof Date,fa=e=>e instanceof RegExp,oc=e=>typeof e=="function",Te=e=>e==null,Wn=(e,t)=>e.includes(t),Sm=(e,t)=>!Wn(e,t),lT=(e,t=!0)=>!!e||t&&e==="",si=e=>Te(e)||Ft(e)&&!e||e instanceof Array&&e.length===0||we(e)&&Object.keys(e).length===0,nv=e=>e===Ur,Do=e=>e instanceof Array?e:[e],er=(e,t)=>!!e&&Object.prototype.hasOwnProperty.call(e,t),fT=(e,t)=>we(e)&&we(t)||De(e)&&De(t);function Cl(e,t,r){if(r=r||{flatten:!1},nv(e)||Te(e))return t;if(nv(t)||Te(t))return e;if(!fT(e,t)){if(r.skipValidation)return t||e;throw Error("mismatched types. must both be array or object")}if(r.skipValidation=!0,De(e)){const n=e,i=t;if(r.flatten){let o=0,a=0;for(;o<n.length&&a<i.length;)n[o]=Cl(n[o++],i[a++],r);for(;a<i.length;)n.push(t[a++])}else To(n,i)}else for(const n in t)e[n]=Cl(e[n],t[n],r);return e}function iv(e,t=nc){const r=new Map;return e.forEach((n,i)=>{const o=$m(n,t);r.has(o)?r.get(o).some(a=>qr(e[a],n))||r.get(o).push(i):r.set(o,[i])}),r}function Em(e,t=nc){if(e.some(u=>u.length==0))return[];if(e.length===1)return Array.from(e);const r=vT(e.map((u,s)=>[s,u.length]),u=>u[1]),n=e[r[0][0]],i=iv(n,t),o=new Map,a=new Array;return i.forEach((u,s)=>{const c=u.map(p=>n[p]),l=c.map(p=>0),f=c.map(p=>[r[0][0],0]);let d=!1;for(let p=1;p<e.length;p++){const[m,y]=r[p],_=e[m];if(o.has(p)||o.set(p,iv(_)),o.get(p).has(s)){const w=o.get(p).get(s).map(O=>_[O]);d=c.map((O,E)=>w.some((A,P)=>{const x=l[E];return qr(O,A)&&(l[E]++,m<f[E][0]&&(f[E]=[m,o.get(p).get(s)[P]])),x<l[E]})).some(Boolean)}if(!d)return}d&&To(a,l.map((p,m)=>p===e.length-1?[c[m],f[m]]:Ur).filter(p=>p!==Ur))}),a.sort((u,s)=>{const[c,[l,f]]=u,[d,[p,m]]=s,y=nt(l,p);return y!==0?y:nt(f,m)}).map(u=>u[0])}function Pm(e,t=0){const r=new Array;function n(i,o){for(let a=0,u=i.length;a<u;a++)De(i[a])&&(o>0||o<0)?n(i[a],Math.max(-1,o-1)):r.push(i[a])}return n(e,t),r}const dT=e=>{let[t,r]=[Object.getPrototypeOf(e),Object.getOwnPropertyNames(e)],n=t;for(;!r.length&&t!==wm&&t!==oT;)n=t,r=Object.getOwnPropertyNames(t),t=Object.getPrototypeOf(t);const i={};return r.forEach(o=>i[o]=e[o]),[i,n]};function qr(e,t){const r=[[e,t]];for(;r.length>0;){if([e,t]=r.pop(),e===t)continue;const n=Wr(e);if(n!==Wr(t)||oc(e))return!1;if(xa.has(n)){const i=xa.get(n);if(i(e)!==i(t))return!1;continue}if(n===Array||n===Object){const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length||new Set(i.concat(o)).size!=i.length)return!1;for(const a of i)r.push([e[a],t[a]]);continue}return!1}return!r.length}function hT(e){const t=new Set,r=n=>{const i=Wr(n);if(xa.has(i))return xa.get(i)(n);const o=i===Object?"":i.name;if(oc(n.toJSON))return`${o}(${JSON.stringify(n)})`;if(t.has(n))throw _m;t.add(n);try{if(i===Array)return"["+n.map(r).join(",")+"]";if(i!==Object){const[u,s]=dT(n);if(De(n))return`${o}${r([...n,u])}`;n=u}const a=Object.keys(n);return a.sort(),`${o}{`+a.map(u=>`${u}:${r(n[u])}`).join(",")+"}"}finally{t.delete(n)}};return r(e)}function $m(e,t){return t=t||nc,Te(e)?null:t(e).toString()}function vT(e,t,r=nt){if(si(e))return e;const n=new Array,i=new Array;for(let o=0;o<e.length;o++){const a=e[o],u=t(a,o);Te(u)?i.push(a):n.push([u,a])}return n.sort((o,a)=>r(o[0],a[0])),To(i,n.map(o=>o[1]))}function pT(e,t,r=nc){if(e.length<1)return new Map;const n=new Map,i=new Map;for(let o=0;o<e.length;o++){const a=e[o],u=t(a,o),s=$m(u,r);if(s===null)i.has(null)?i.get(null).push(a):i.set(null,[a]);else{const c=n.has(s)?n.get(s).find(l=>qr(l,u)):null;Te(c)?(i.set(u,[a]),n.has(s)?n.get(s).push(u):n.set(s,[u])):i.get(c).push(a)}}return i}const Wc=5e4;function To(e,...t){return e instanceof Array?t.reduce((r,n)=>{let i=Math.ceil(n.length/Wc),o=0;for(;i-- >0;)Array.prototype.push.apply(r,n.slice(o,o+Wc)),o+=Wc;return r},e):t.filter(ic).reduce((r,n)=>(Object.assign(r,n),r),e)}function Il(e,t){return ic(e)?e[t]:void 0}function yT(e,t){if(t<1)return e;for(;t--&&e.length===1;)e=e[0];return e}function zf(e,t,r){let n=0;function i(a,u){let s=a;for(let c=0;c<u.length;c++){const l=u[c];if(/^\d+$/.exec(l)===null&&s instanceof Array){if(c===0&&n>0)break;n+=1;const d=u.slice(c);s=s.reduce((p,m)=>{const y=i(m,d);return y!==void 0&&p.push(y),p},[]);break}else s=Il(s,l);if(s===void 0)break}return s}const o=Om.has(Ti(e).toLowerCase())?e:i(e,t.split("."));return o instanceof Array&&r?.unwrapArray?yT(o,n):o}function da(e,t,r){const n=t.split("."),i=n[0],o=n.slice(1).join("."),a=/^\d+$/.exec(i)!==null,u=n.length>1;let s,c;if(e instanceof Array)if(a)s=Il(e,Number(i)),u&&(s=da(s,o,r)),s=[s];else{s=[];for(const l of e)c=da(l,t,r),r?.preserveMissing?(c===void 0&&(c=Ur),s.push(c)):c!==void 0&&s.push(c)}else{if(c=Il(e,i),u&&(c=da(c,o,r)),c===void 0)return;s=r?.preserveKeys?Object.assign({},e):{},s[i]=c}return s}function Rl(e){if(e instanceof Array)for(let t=e.length-1;t>=0;t--)e[t]===Ur?e.splice(t,1):Rl(e[t]);else if(we(e))for(const t in e)er(e,t)&&Rl(e[t])}const ov=/^\d+$/;function Ca(e,t,r,n){const i=t.split("."),o=i[0],a=i.slice(1).join(".");if(i.length===1)(we(e)||De(e)&&ov.test(o))&&r(e,o);else{n?.buildGraph&&Te(e[o])&&(e[o]={});const u=e[o];if(!u)return;const s=!!(i.length>1&&ov.test(i[1]));u instanceof Array&&n?.descendArray&&!s?u.forEach(c=>Ca(c,a,r,n)):Ca(u,a,r,n)}}function mT(e,t,r){Ca(e,t,(n,i)=>{n[i]=oc(r)?r(n[i]):r},{buildGraph:!0})}function av(e,t,r){Ca(e,t,(n,i)=>{if(n instanceof Array){if(/^\d+$/.test(i))n.splice(parseInt(i),1);else if(r&&r.descendArray)for(const o of n)we(o)&&delete o[i]}else we(n)&&delete n[i]},r)}const bT=/^\$[a-zA-Z0-9_]+$/;function ci(e){return bT.test(e)}function Am(e){if(Om.has(Ti(e).toLowerCase()))return fa(e)?{$regex:e}:{$eq:e};if(ic(e)){if(!Object.keys(e).some(ci))return{$eq:e};if(er(e,"$regex")){const r=Object.assign({},e);return r.$regex=new RegExp(e.$regex,e.$options),delete r.$options,r}}return e}var Yt;(function(e){e.CLONE_ALL="CLONE_ALL",e.CLONE_INPUT="CLONE_INPUT",e.CLONE_OUTPUT="CLONE_OUTPUT",e.CLONE_OFF="CLONE_OFF"})(Yt||(Yt={}));class Ar{constructor(t,r,n,i=Date.now()){this._opts=t,this._root=r,this._local=n,this.timestamp=i,this.update(r,n)}static init(t,r,n){return t instanceof Ar?new Ar(t._opts,Te(t.root)?r:t.root,Object.assign({},t.local,n)):new Ar(t,r,n)}update(t,r){var n;return this._root=t,this._local=r&&Object.assign({},r,{variables:Object.assign({},(n=this._local)===null||n===void 0?void 0:n.variables,r?.variables)}),this}getOptions(){return Object.freeze(Object.assign(Object.assign({},this._opts),{context:Ia.from(this._opts.context)}))}get root(){return this._root}get local(){return this._local}get idKey(){return this._opts.idKey}get collation(){var t;return(t=this._opts)===null||t===void 0?void 0:t.collation}get processingMode(){var t;return((t=this._opts)===null||t===void 0?void 0:t.processingMode)||Yt.CLONE_OFF}get useStrictMode(){var t;return(t=this._opts)===null||t===void 0?void 0:t.useStrictMode}get scriptEnabled(){var t;return(t=this._opts)===null||t===void 0?void 0:t.scriptEnabled}get useGlobalContext(){var t;return(t=this._opts)===null||t===void 0?void 0:t.useGlobalContext}get hashFunction(){var t;return(t=this._opts)===null||t===void 0?void 0:t.hashFunction}get collectionResolver(){var t;return(t=this._opts)===null||t===void 0?void 0:t.collectionResolver}get jsonSchemaValidator(){var t;return(t=this._opts)===null||t===void 0?void 0:t.jsonSchemaValidator}get variables(){var t;return(t=this._opts)===null||t===void 0?void 0:t.variables}get context(){var t;return(t=this._opts)===null||t===void 0?void 0:t.context}}function xm(e){return e instanceof Ar?e.getOptions():Object.freeze(Object.assign(Object.assign({idKey:"_id",scriptEnabled:!0,useStrictMode:!0,useGlobalContext:!0,processingMode:Yt.CLONE_OFF},e),{context:e?.context?Ia.from(e?.context):Ia.init({})}))}var te;(function(e){e.ACCUMULATOR="accumulator",e.EXPRESSION="expression",e.PIPELINE="pipeline",e.PROJECTION="projection",e.QUERY="query",e.WINDOW="window"})(te||(te={}));let Ia=class kl{constructor(t){this.operators={[te.ACCUMULATOR]:{},[te.EXPRESSION]:{},[te.PIPELINE]:{},[te.PROJECTION]:{},[te.QUERY]:{},[te.WINDOW]:{}};for(const[r,n]of Object.entries(t))this.addOperators(r,n)}static init(t={}){return new kl(t)}static from(t){return new kl(t.operators)}addOperators(t,r){for(const[n,i]of Object.entries(r))this.getOperator(t,n)||(this.operators[t][n]=i);return this}addAccumulatorOps(t){return this.addOperators(te.ACCUMULATOR,t)}addExpressionOps(t){return this.addOperators(te.EXPRESSION,t)}addQueryOps(t){return this.addOperators(te.QUERY,t)}addPipelineOps(t){return this.addOperators(te.PIPELINE,t)}addProjectionOps(t){return this.addOperators(te.PROJECTION,t)}addWindowOps(t){return this.addOperators(te.WINDOW,t)}getOperator(t,r){return t in this.operators&&this.operators[t][r]||null}};const gr=Ia.init();function uv(e,t){for(const[r,n]of Object.entries(t)){Ye(oc(n)&&ci(r),`'${r}' is not a valid operator`);const i=xr(e,r,null);Ye(!i||n===i,`${r} already exists for '${e}' operators. Cannot change operator function once registered.`)}switch(e){case te.ACCUMULATOR:gr.addAccumulatorOps(t);break;case te.EXPRESSION:gr.addExpressionOps(t);break;case te.PIPELINE:gr.addPipelineOps(t);break;case te.PROJECTION:gr.addProjectionOps(t);break;case te.QUERY:gr.addQueryOps(t);break;case te.WINDOW:gr.addWindowOps(t);break}}function xr(e,t,r){const{context:n,useGlobalContext:i}=r||{},o=n?n.getOperator(e,t):null;return!o&&i?gr.getOperator(e,t):o}const sv={$$ROOT(e,t,r){return r.root},$$CURRENT(e,t,r){return e},$$REMOVE(e,t,r){},$$NOW(e,t,r){return new Date(r.timestamp)}},jl={$$KEEP(e,t,r){return e},$$PRUNE(e,t,r){},$$DESCEND(e,t,r){if(!er(t,"$cond"))return e;let n;for(const[i,o]of Object.entries(e))if(ic(o)){if(o instanceof Array){const a=[];for(let u of o)we(u)&&(u=cv(u,t,r.update(u))),Te(u)||a.push(u);n=a}else n=cv(o,t,r.update(o));Te(n)?delete e[i]:e[i]=n}return e}};function dt(e,t,r,n){var i;const o=Ar.init(n,e);if(r=r||"",ci(r)){const a=xr(te.EXPRESSION,r,n);if(a)return a(e,t,o);const u=xr(te.ACCUMULATOR,r,n);if(u)return e instanceof Array||(e=dt(e,t,null,o),t=null),Ye(e instanceof Array,`'${r}' target must be an array.`),u(e,t,o.update(null,o.local));throw new Error(`operator '${r}' is not registered`)}if(Ft(t)&&t.length>0&&t[0]==="$"){if(er(jl,t))return t;let a=o.root;const u=t.split(".");if(er(sv,u[0]))a=sv[u[0]](e,null,o),t=t.slice(u[0].length+1);else if(u[0].slice(0,2)==="$$"){a=Object.assign({},o.variables,{this:e},(i=o.local)===null||i===void 0?void 0:i.variables);const s=u[0].slice(2);Ye(er(a,s),`Use of undefined variable: ${s}`),t=t.slice(2)}else t=t.slice(1);return t===""?a:zf(a,t)}if(De(t))return t.map(a=>dt(e,a,null,o));if(we(t)){const a={};for(const[u,s]of Object.entries(t))if(a[u]=dt(e,s,u,o),[te.EXPRESSION,te.ACCUMULATOR].some(c=>!!xr(c,u,n)))return Ye(Object.keys(t).length===1,"Invalid aggregation expression '"+JSON.stringify(t)+"'"),a[u];return a}return t}function cv(e,t,r){const n=dt(e,t,null,r);return er(jl,n)?jl[n](e,t,r):n}function qn(e){return e instanceof lv?e:new lv(e)}function gT(...e){let t=0;return qn(()=>{for(;t<e.length;){const r=e[t].next();if(!r.done)return r;t++}return{done:!0}})}function _T(e){return!!e&&typeof e=="object"&&e?.next instanceof Function}function wT(e,t){const r=e.slice(t+1);e.splice(t),Array.prototype.push.apply(e,r)}const Ml=new Error;var pt;(function(e){e[e.MAP=0]="MAP",e[e.FILTER=1]="FILTER",e[e.TAKE=2]="TAKE",e[e.DROP=3]="DROP"})(pt||(pt={}));function OT(e,t,r){let n=!1,i=-1,o=0;return function(a){try{e:for(;!n;){let u=e();i++;let s=-1;const c=t.length;let l=!1;for(;++s<c;){const f=t[s];switch(f.action){case pt.MAP:u=f.func(u,i);break;case pt.FILTER:if(!f.func(u,i))continue e;break;case pt.TAKE:--f.count,f.count||(l=!0);break;case pt.DROP:--f.count,f.count||wT(t,s);continue e;default:break e}}if(n=l,a)r[o++]=u;else return{value:u,done:!1}}}catch(u){if(u!==Ml)throw u}return n=!0,{done:n}}}class lv{constructor(t){this.iteratees=[],this.yieldedValues=[],this.isDone=!1;let r;if(t instanceof Function&&(t={next:t}),_T(t)){const n=t;r=()=>{const i=n.next();if(i.done)throw Ml;return i.value}}else if(t instanceof Array){const n=t,i=n.length;let o=0;r=()=>{if(o<i)return n[o++];throw Ml}}else if(!(t instanceof Function))throw new Error("Lazy must be initialized with an array, generator, or function.");this.getNext=OT(r,this.iteratees,this.yieldedValues)}push(t,r){return typeof r=="function"?this.iteratees.push({action:t,func:r}):typeof r=="number"&&this.iteratees.push({action:t,count:r}),this}next(){return this.getNext()}map(t){return this.push(pt.MAP,t)}filter(t){return this.push(pt.FILTER,t)}take(t){return t>0?this.push(pt.TAKE,t):this}drop(t){return t>0?this.push(pt.DROP,t):this}transform(t){const r=this;let n;return qn(()=>(n||(n=qn(t(r.value()))),n.next()))}value(){return this.isDone||(this.isDone=this.getNext(!0).done),this.yieldedValues}each(t){for(;;){const r=this.next();if(r.done)break;if(t(r.value)===!1)return!1}return!0}reduce(t,r){let n=this.next();for(r===void 0&&!n.done&&(r=n.value,n=this.next());!n.done;)r=t(r,n.value),n=this.next();return r}size(){return this.reduce((t,r)=>++t,0)}[Symbol.iterator](){return this}}class ST{constructor(t,r){this.pipeline=t,this.options=xm(r)}stream(t){let r=qn(t);const n=this.options.processingMode;(n==Yt.CLONE_ALL||n==Yt.CLONE_INPUT)&&r.map(tv);const i=new Array;if(!si(this.pipeline))for(const o of this.pipeline){const a=Object.keys(o),u=a[0],s=xr(te.PIPELINE,u,this.options);Ye(a.length===1&&!!s,`invalid pipeline operator ${u}`),i.push(u),r=s(r,o[u],this.options)}return(n==Yt.CLONE_OUTPUT||n==Yt.CLONE_ALL&&Em([["$group","$unwind"],i]).length)&&r.map(tv),r}run(t){return this.stream(t).value()}}class ET{constructor(t,r,n,i){this.source=t,this.predicate=r,this.projection=n,this.options=i,this.operators=[],this.result=null,this.buffer=[]}fetch(){return this.result?this.result:(we(this.projection)&&this.operators.push({$project:this.projection}),this.result=qn(this.source).filter(this.predicate),this.operators.length>0&&(this.result=new ST(this.operators,this.options).stream(this.result)),this.result)}fetchAll(){const t=qn([...this.buffer]);return this.buffer=[],gT(t,this.fetch())}all(){return this.fetchAll().value()}count(){return this.all().length}skip(t){return this.operators.push({$skip:t}),this}limit(t){return this.operators.push({$limit:t}),this}sort(t){return this.operators.push({$sort:t}),this}collation(t){return this.options=Object.assign(Object.assign({},this.options),{collation:t}),this}next(){if(this.buffer.length>0)return this.buffer.pop();const t=this.fetch().next();if(!t.done)return t.value}hasNext(){if(this.buffer.length>0)return!0;const t=this.fetch().next();return t.done?!1:(this.buffer.push(t.value),!0)}map(t){return this.all().map(t)}forEach(t){this.all().forEach(t)}[Symbol.iterator](){return this.fetchAll()}}class Fo{constructor(t,r){this.condition=t,this.options=xm(r),this.compiled=[],this.compile()}compile(){Ye(we(this.condition),`query criteria must be an object: ${JSON.stringify(this.condition)}`);const t={};for(const[r,n]of Object.entries(this.condition)){if(r==="$where")Object.assign(t,{field:r,expr:n});else if(Wn(["$and","$or","$nor","$expr","$jsonSchema"],r))this.processOperator(r,r,n);else{Ye(!ci(r),`unknown top level operator: ${r}`);for(const[i,o]of Object.entries(Am(n)))this.processOperator(r,i,o)}t.field&&this.processOperator(t.field,t.field,t.expr)}}processOperator(t,r,n){const i=xr(te.QUERY,r,this.options);if(!i)throw new Error(`unknown operator ${r}`);const o=i(t,n,this.options);this.compiled.push(o)}test(t){for(let r=0,n=this.compiled.length;r<n;r++)if(!this.compiled[r](t))return!1;return!0}find(t,r){return new ET(t,n=>this.test(n),r||{},this.options)}remove(t){return t.reduce((r,n)=>(this.test(n)||r.push(n),r),[])}}const PT=(e,t,r)=>{if(si(t)||!we(t))return e;let n=nt;const i=r.collation;return we(i)&&Ft(i.locale)&&(n=AT(i)),e.transform(o=>{const a=Object.keys(t);for(const u of a.reverse()){const s=pT(o,l=>zf(l,u),r.hashFunction),c=Array.from(s.keys()).sort(n);t[u]===-1&&c.reverse(),o=[],c.reduce((l,f)=>To(l,s.get(f)),o)}return o})},$T={1:"base",2:"accent",3:"variant"};function AT(e){const t={sensitivity:$T[e.strength||3],caseFirst:e.caseFirst==="off"?"false":e.caseFirst||"false",numeric:e.numericOrdering||!1,ignorePunctuation:e.alternate==="shifted"};(e.caseLevel||!1)===!0&&(t.sensitivity==="base"&&(t.sensitivity="case"),t.sensitivity==="accent"&&(t.sensitivity="variant"));const r=new Intl.Collator(e.locale,t);return(n,i)=>{if(!Ft(n)||!Ft(i))return nt(n,i);const o=r.compare(n,i);return o<0?-1:o>0?1:0}}function Ne(e){const t=(r,n,i)=>{const o={unwrapArray:!0},a=Math.max(1,r.split(".").length-1);return u=>{const s=zf(u,r,o);return e(s,n,Object.assign(Object.assign({},i),{depth:a}))}};return t.op="query",t}function Cm(e,t,r){if(qr(e,t)||Te(e)&&Te(t))return!0;if(e instanceof Array){const n=qr.bind(null,t);return e.some(n)||Pm(e,r?.depth).some(n)}return!1}function xT(e,t,r){return!Cm(e,t,r)}function Im(e,t,r){return Te(e)?t.some(n=>n===null):Em([Do(e),t],r?.hashFunction).length>0}function CT(e,t,r){return!Im(e,t,r)}function IT(e,t,r){return ac(e,t,(n,i)=>nt(n,i)<0)}function RT(e,t,r){return ac(e,t,(n,i)=>nt(n,i)<=0)}function kT(e,t,r){return ac(e,t,(n,i)=>nt(n,i)>0)}function jT(e,t,r){return ac(e,t,(n,i)=>nt(n,i)>=0)}function MT(e,t,r){return Do(e).some(n=>t.length===2&&n%t[0]===t[1])}function DT(e,t,r){const n=Do(e),i=o=>Ft(o)&&lT(t.exec(o),r?.useStrictMode);return n.some(i)||Pm(n,1).some(i)}function TT(e,t,r){return(t===!1||t===0)&&e===void 0||(t===!0||t===1)&&e!==void 0}function FT(e,t,r){if(!De(e)||!De(t)||!e.length||!t.length)return!1;let n=!0;for(const i of t){if(!n)break;we(i)&&Wn(Object.keys(i),"$elemMatch")?n=Rm(e,i.$elemMatch,r):i instanceof RegExp?n=e.some(o=>typeof o=="string"&&i.test(o)):n=e.some(o=>qr(i,o))}return n}function LT(e,t,r){return Array.isArray(e)&&e.length===t}function BT(e){return ci(e)&&["$and","$or","$nor"].indexOf(e)===-1}function Rm(e,t,r){if(De(e)&&!si(e)){let n=a=>a,i=t;Object.keys(t).every(BT)&&(i={temp:t},n=a=>({temp:a}));const o=new Fo(i,r);for(let a=0,u=e.length;a<u;a++)if(o.test(n(e[a])))return!0}return!1}const fv=e=>e===null,dv=e=>zt(e)&&e>=rT&&e<=tT&&e.toString().indexOf(".")===-1,hv=e=>zt(e)&&e>=iT&&e<=nT&&e.toString().indexOf(".")===-1,NT={array:De,bool:Uc,boolean:Uc,date:rv,decimal:zt,double:zt,int:dv,long:hv,number:zt,null:fv,object:we,regex:fa,regexp:fa,string:Ft,undefined:Te,function:e=>{throw new Error("unsupported type key `function`.")},1:zt,2:Ft,3:we,4:De,6:Te,8:Uc,9:rv,10:fv,11:fa,16:dv,18:hv,19:zt};function vv(e,t,r){const n=NT[t];return n?n(e):!1}function UT(e,t,r){return Array.isArray(t)?t.findIndex(n=>vv(e,n))>=0:vv(e,t)}function ac(e,t,r){return Do(e).some(n=>Ti(n)===Ti(t)&&r(n,t))}const pv=(e,t)=>{const r={};return e.split("").forEach((n,i)=>r[n]=t*(i+1)),r};Object.assign(Object.assign(Object.assign({},pv("ABCDEFGHIKLM",1)),pv("NOPQRSTUVWXY",-1)),{Z:0});const yv={undefined:null,null:null,NaN:NaN,Infinity:new Error,"-Infinity":new Error};function Ve(e,t=yv){const r=Object.assign({},yv,t),n=new Set(Object.keys(r));return(i,o,a)=>{const u=dt(i,o,null,a);if(n.has(`${u}`)){const s=r[`${u}`];if(s instanceof Error)throw new Error(`cannot apply $${e.name} to -inf, value must in (-inf,inf)`);return s}return e(u)}}Ve(Math.acos,{Infinity:1/0,0:new Error});Ve(Math.acosh,{Infinity:1/0,0:new Error});Ve(Math.asin);Ve(Math.asinh,{Infinity:1/0,"-Infinity":-1/0});Ve(Math.atan);Ve(Math.atanh,{1:1/0,"-1":-1/0});Ve(Math.cos);Ve(Math.cosh,{"-Infinity":1/0,Infinity:1/0});const WT=Math.PI/180;Ve(e=>e*WT,{Infinity:1/0,"-Infinity":1/0});const qT=180/Math.PI;Ve(e=>e*qT,{Infinity:1/0,"-Infinity":-1/0});Ve(Math.sin);Ve(Math.sinh,{"-Infinity":-1/0,Infinity:1/0});Ve(Math.tan);const KT=(e,t,r)=>{if(si(t))return e;let n=Object.keys(t),i=!1;km(t,r);const o=r.idKey;if(Wn(n,o)){const u=t[o];(u===0||u===!1)&&(n=n.filter(Sm.bind(null,[o])),i=n.length==0)}else n.push(o);const a=Ar.init(r);return e.map(u=>Dl(u,t,a.update(u),n,i))};function Dl(e,t,r,n,i){let o={},a=!1,u=!1;const s=[];i&&s.push(r.idKey);for(const c of n){let l;const f=t[c];if(c!==r.idKey&&Wn([0,!1],f)&&(u=!0),c===r.idKey&&si(f))l=e[c];else if(Ft(f))l=dt(e,f,c,r);else if(!Wn([1,!0],f))if(f instanceof Array)l=f.map(p=>{const m=dt(e,p,null,r);return Te(m)?null:m});else if(we(f)){const p=f,m=Object.keys(f),y=m.length==1?m[0]:"",_=xr(te.PROJECTION,y,r);if(_)y==="$slice"?Do(p[y]).every(zt)?(l=_(e,p[y],c,r),a=!0):l=dt(e,p,c,r):l=_(e,p[y],c,r);else if(ci(y))l=dt(e,p[y],y,r);else if(er(e,c)){km(p,r);let w=e[c];w instanceof Array?l=w.map(O=>Dl(O,p,r,m,!1)):(w=we(w)?w:e,l=Dl(w,p,r,m,!1))}else l=dt(e,f,null,r)}else{s.push(c);continue}const d=da(e,c,{preserveMissing:!0});d!==void 0&&Cl(o,d,{flatten:!0}),Sm([0,1,!1,!0],f)&&(l===void 0?av(o,c,{descendArray:!0}):mT(o,c,l))}if(Rl(o),(a||u||i)&&(o=To({},e,o),s.length>0))for(const c of s)av(o,c,{descendArray:!0});return o}function km(e,t){const r=[!1,!1];for(const[n,i]of Object.entries(e)){if(n===t?.idKey)return;i===0||i===!1?r[0]=!0:(i===1||i===!0)&&(r[1]=!0),Ye(!(r[0]&&r[1]),"Projection cannot have a mix of inclusion and exclusion.")}}const HT=(e,t,r)=>{Ye(De(t),"Invalid expression: $and expects value to be an Array.");const n=t.map(i=>new Fo(i,r));return i=>n.every(o=>o.test(i))},jm=(e,t,r)=>{Ye(De(t),"Invalid expression. $or expects value to be an Array");const n=t.map(i=>new Fo(i,r));return i=>n.some(o=>o.test(i))},VT=(e,t,r)=>{Ye(De(t),"Invalid expression. $nor expects value to be an array.");const n=jm("$or",t,r);return i=>!n(i)},zT=(e,t,r)=>{const n={};n[e]=Am(t);const i=new Fo(n,r);return o=>!i.test(o)},QT=Ne(Cm),GT=Ne(kT),YT=Ne(jT),JT=Ne(Im),XT=Ne(IT),ZT=Ne(RT),eF=Ne(xT),tF=Ne(CT),rF=Ne(MT),nF=Ne(DT);Ne(FT);const iF=Ne(Rm),oF=Ne(LT),aF=Ne(TT),uF=Ne(UT);var mv=!1;function sF(e){return mv||(uv(te.PIPELINE,{$sort:PT,$project:KT}),uv(te.QUERY,{$and:HT,$eq:QT,$elemMatch:iF,$exists:aF,$gt:GT,$gte:YT,$in:JT,$lt:XT,$lte:ZT,$ne:eF,$nin:tF,$mod:rF,$nor:VT,$not:zT,$or:jm,$regex:nF,$size:oF,$type:uF}),mv=!0),new Fo(e)}function Tl(e,t){var r=ot(e.primaryKey);t=xe(t);var n=Dn(t);if(typeof n.skip!="number"&&(n.skip=0),n.selector?(n.selector=n.selector,Object.entries(n.selector).forEach(([c,l])=>{(typeof l!="object"||l===null)&&(n.selector[c]={$eq:l})})):n.selector={},n.index){var i=$f(n.index);i.includes(r)||i.push(r),n.index=i}if(n.sort){var s=n.sort.find(c=>Aw(c)===r);s||(n.sort=n.sort.slice(0),n.sort.push({[r]:"asc"}))}else if(n.index)n.sort=n.index.map(c=>({[c]:"asc"}));else{if(e.indexes){var o=new Set;Object.entries(n.selector).forEach(([c,l])=>{var f=!1;typeof l=="object"&&l!==null?f=!!Object.keys(l).find(d=>Kf.has(d)):f=!0,f&&o.add(c)});var a=-1,u;e.indexes.forEach(c=>{var l=En(c)?c:[c],f=l.findIndex(d=>!o.has(d));f>0&&f>a&&(a=f,u=l)}),u&&(n.sort=u.map(c=>({[c]:"asc"})))}n.sort||(n.sort=[{[r]:"asc"}])}return n}function Mm(e,t){if(!t.sort)throw I("SNH",{query:t});var r=[];t.sort.forEach(i=>{var o=Object.keys(i)[0],a=Object.values(i)[0];r.push({key:o,direction:a,getValueFn:$w(o)})});var n=(i,o)=>{for(var a=0;a<r.length;++a){var u=r[a],s=u.getValueFn(i),c=u.getValueFn(o);if(s!==c){var l=u.direction==="asc"?nt(s,c):nt(c,s);return l}}};return n}function Qf(e,t){if(!t.sort)throw I("SNH",{query:t});var r=sF(t.selector),n=i=>i._deleted?!1:r.test(i);return n}function cF(e,t){return!t.sort||t.sort.length===0?[e]:t.sort.map(r=>Object.keys(r)[0])}var lF=new WeakMap;function fF(e){return Dt(lF,e,()=>{var t=e.collection,r=Tl(t.storageInstance.schema,Dn(e.mangoQuery)),n=t.schema.primaryPath,i=Mm(t.schema.jsonSchema,r),o=(c,l)=>{var f={docA:c,docB:l,rxQuery:e};return i(f.docA,f.docB)},a=Qf(t.schema.jsonSchema,r),u=c=>{var l={doc:c,rxQuery:e};return a(l.doc)},s={primaryKey:e.collection.schema.primaryPath,skip:r.skip,limit:r.limit,sortFields:cF(n,r),sortComparator:o,queryMatcher:u};return s})}function dF(e,t){if(!e.collection.database.eventReduce)return{runFullQueryAgain:!0};var r=fF(e),n=fe(e._result).docsData.slice(0),i=fe(e._result).docsDataMap,o=!1,a=t.map(s=>$1(s)).filter(X0),u=a.find(s=>{var c={queryParams:r,changeEvent:s,previousResults:n,keyDocumentMap:i},l=QD(c);if(l==="runFullQueryAgain")return!0;if(l!=="doNothing")return o=!0,GD(l,r,s,n,i),!1});return u?{runFullQueryAgain:!0}:{runFullQueryAgain:!1,changed:o,newResults:n}}var hF=function(){function e(){this._map=new Map}var t=e.prototype;return t.getByQuery=function(n){var i=n.toString();return Dt(this._map,i,()=>n)},e}();function vF(){return new hF}function bv(e,t){t.uncached=!0;var r=t.toString();e._map.delete(r)}function pF(e){return e.refCount$.observers.length}var yF=100,mF=30*1e3,bF=(e,t)=>(r,n)=>{if(!(n._map.size<e)){var i=Ge()-t,o=[],a=Array.from(n._map.values());for(var u of a)if(!(pF(u)>0)){if(u._lastEnsureEqual===0&&u._creationTime<i){bv(n,u);continue}o.push(u)}var s=o.length-e;if(!(s<=0)){var c=o.sort((f,d)=>f._lastEnsureEqual-d._lastEnsureEqual),l=c.slice(0,s);l.forEach(f=>bv(n,f))}}},Dm=bF(yF,mF),qc=new WeakSet;function gF(e){qc.has(e)||(qc.add(e),pw().then(()=>gw(200)).then(()=>{e.destroyed||e.cacheReplacementPolicy(e,e._queryCache),qc.delete(e)}))}var _F=function(){function e(r,n,i){this.cacheItemByDocId=new Map,this.registry=typeof FinalizationRegistry=="function"?new FinalizationRegistry(o=>{var a=o.docId,u=this.cacheItemByDocId.get(a);u&&(u.byRev.delete(o.revisionHeight),u.byRev.size===0&&this.cacheItemByDocId.delete(a))}):void 0,this.registerIdleTasks=[],this.primaryPath=r,this.changes$=n,this.documentCreator=i,n.subscribe(o=>{var a=o.documentId,u=this.cacheItemByDocId.get(a);if(u){var s=Ay(o);u.last=s}})}var t=e.prototype;return t.getLatestDocumentData=function(n){var i=ki(this.cacheItemByDocId,n);return i.last},t.getLatestDocumentDataIfExists=function(n){var i=this.cacheItemByDocId.get(n);if(i)return i.last},cr(e,[{key:"getCachedRxDocument",get:function(){var r=wF(this);return Xt(this,"getCachedRxDocument",r)}}]),e}();function wF(e){var t=e.primaryPath,r=e.cacheItemByDocId,n=e.registry,i=me.deepFreezeWhenDevMode,o=e.documentCreator,a=u=>{var s=u[t],c=Ad(u._rev),l=Dt(r,s,()=>OF(u)),f=l.byRev,d=f.get(c),p=d?d.deref():void 0;return p||(u=i(u),p=o(u),f.set(c,EF(p)),n&&(e.registerIdleTasks.push(p),e.registerIdlePromise||(e.registerIdlePromise=Kp().then(()=>{e.registerIdlePromise=void 0;var m=e.registerIdleTasks;m.length!==0&&(e.registerIdleTasks=[],m.forEach(y=>{n.register(y,{docId:y.primary,revisionHeight:Ad(y.revision)})}))})))),p};return a}function Tm(e,t){for(var r=e.getCachedRxDocument,n=[],i=0;i<t.length;i++){var o=t[i],a=r(o);n.push(a)}return n}function OF(e){return{byRev:new Map,last:e}}var SF=typeof WeakRef=="function",EF=SF?PF:$F;function PF(e){return new WeakRef(e)}function $F(e){return{deref(){return e}}}var gv=function(){function e(t,r,n){this.time=Ge(),this.collection=t,this.count=n,this.documents=Tm(this.collection._docCache,r)}return cr(e,[{key:"docsData",get:function(){return Xt(this,"docsData",this.documents.map(t=>t._data))}},{key:"docsDataMap",get:function(){var t=new Map;return this.documents.forEach(r=>{t.set(r.primary,r._data)}),Xt(this,"docsDataMap",t)}},{key:"docsMap",get:function(){for(var t=new Map,r=this.documents,n=0;n<r.length;n++){var i=r[n];t.set(i.primary,i)}return Xt(this,"docsMap",t)}}]),e}(),AF=0,xF=function(){return++AF},Fm=function(){function e(r,n,i,o={}){this.id=xF(),this._execOverDatabaseCount=0,this._creationTime=Ge(),this._lastEnsureEqual=0,this.uncached=!1,this.refCount$=new ke.BehaviorSubject(null),this._result=null,this._latestChangeEvent=-1,this._lastExecStart=0,this._lastExecEnd=0,this._ensureEqualQueue=Qt,this.op=r,this.mangoQuery=n,this.collection=i,this.other=o,n||(this.mangoQuery=ha()),this.isFindOneByIdQuery=kF(this.collection.schema.primaryPath,n)}var t=e.prototype;return t._setResultData=function(n){if(typeof n=="number"){this._result=new gv(this.collection,[],n);return}else n instanceof Map&&(n=Array.from(n.values()));var i=new gv(this.collection,n,n.length);this._result=i},t._execOverDatabase=async function(){if(this._execOverDatabaseCount=this._execOverDatabaseCount+1,this._lastExecStart=Ge(),this.op==="count"){var n=this.getPreparedQuery(),i=await this.collection.storageInstance.count(n);if(i.mode==="slow"&&!this.collection.database.allowSlowCount)throw I("QU14",{collection:this.collection,queryObj:this.mangoQuery});return i.count}if(this.op==="findByIds"){var o=fe(this.mangoQuery.selector)[this.collection.schema.primaryPath].$in,a=new Map,u=[];if(o.forEach(l=>{var f=this.collection._docCache.getLatestDocumentDataIfExists(l);if(f){if(!f._deleted){var d=this.collection._docCache.getCachedRxDocument(f);a.set(l,d)}}else u.push(l)}),u.length>0){var s=await this.collection.storageInstance.findDocumentsById(u,!1);s.forEach(l=>{var f=this.collection._docCache.getCachedRxDocument(l);a.set(f.primary,f)})}return a}var c=RF(this);return c.then(l=>(this._lastExecEnd=Ge(),l))},t.exec=function(n){if(n&&this.op!=="findOne")throw I("QU9",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return _v(this).then(()=>ke.firstValueFrom(this.$)).then(i=>{if(!i&&n)throw I("QU10",{collection:this.collection.name,query:this.mangoQuery,op:this.op});return i})},t.toString=function(){var n=Sa({op:this.op,query:this.mangoQuery,other:this.other},!0),i=JSON.stringify(n);return this.toString=()=>i,i},t.getPreparedQuery=function(){var n={rxQuery:this,mangoQuery:Tl(this.collection.schema.jsonSchema,this.mangoQuery)};et("prePrepareQuery",n);var i=this.collection.database.storage.statics.prepareQuery(this.collection.schema.jsonSchema,n.mangoQuery);return this.getPreparedQuery=()=>i,i},t.doesDocumentDataMatch=function(n){return n._deleted?!1:this.queryMatcher(n)},t.remove=function(){return this.exec().then(n=>Array.isArray(n)?Promise.all(n.map(i=>i.remove())):n.remove())},t.update=function(n){throw ae("update")},t.where=function(n){throw ae("query-builder")},t.sort=function(n){throw ae("query-builder")},t.skip=function(n){throw ae("query-builder")},t.limit=function(n){throw ae("query-builder")},cr(e,[{key:"$",get:function(){if(!this._$){var r=this.collection.$.pipe($n(n=>!n.isLocal),$y(null),Za(()=>_v(this)),_r(()=>this._result),Py(Qp),wl((n,i)=>!!(n&&n.time===fe(i).time)),$n(n=>!!n),_r(n=>{var i=fe(n);return this.op==="count"?i.count:this.op==="findOne"?i.documents.length===0?null:i.documents[0]:this.op==="findByIds"?i.docsMap:i.documents.slice(0)}));this._$=ke.merge(r,this.refCount$.pipe($n(()=>!1)))}return this._$}},{key:"queryMatcher",get:function(){var r=this.collection.schema.jsonSchema,n=Tl(this.collection.schema.jsonSchema,this.mangoQuery);return Xt(this,"queryMatcher",Qf(r,n))}},{key:"asRxQuery",get:function(){return this}}]),e}();function ha(){return{selector:{}}}function CF(e){return e.collection._queryCache.getByQuery(e)}function mn(e,t,r,n){et("preCreateRxQuery",{op:e,queryObj:t,collection:r,other:n});var i=new Fm(e,t,r,n);return i=CF(i),gF(r),i}function Lm(e){var t=e.asRxQuery.collection._changeEventBuffer.counter;return e._latestChangeEvent>=t}function _v(e){return e.collection.database.destroyed||Lm(e)?Qt:(e._ensureEqualQueue=e._ensureEqualQueue.then(()=>IF(e)),e._ensureEqualQueue)}function IF(e){if(e._lastEnsureEqual=Ge(),e.collection.database.destroyed||Lm(e))return Qt;var t=!1,r=!1;if(e._latestChangeEvent===-1&&(r=!0),!r){var n=e.asRxQuery.collection._changeEventBuffer.getFrom(e._latestChangeEvent+1);if(n===null)r=!0;else{e._latestChangeEvent=e.asRxQuery.collection._changeEventBuffer.counter;var i=e.asRxQuery.collection._changeEventBuffer.reduceByLastOfDoc(n);if(e.op==="count"){var o=fe(e._result).count,a=o;i.forEach(s=>{var c=s.previousDocumentData&&e.doesDocumentDataMatch(s.previousDocumentData),l=e.doesDocumentDataMatch(s.documentData);!c&&l&&a++,c&&!l&&a--}),a!==o&&(t=!0,e._setResultData(a))}else{var u=dF(e,i);u.runFullQueryAgain?r=!0:u.changed&&(t=!0,e._setResultData(u.newResults))}}}return r?e._execOverDatabase().then(s=>(e._latestChangeEvent=e.collection._changeEventBuffer.counter,typeof s=="number"?((!e._result||s!==e._result.count)&&(t=!0,e._setResultData(s)),t):((!e._result||!ew(e.collection.schema.primaryPath,s,e._result.docsData))&&(t=!0,e._setResultData(s)),t))):Promise.resolve(t)}async function RF(e){var t=[],r=e.collection;if(e.isFindOneByIdQuery)if(Array.isArray(e.isFindOneByIdQuery)){var n=e.isFindOneByIdQuery;if(n=n.filter(l=>{var f=e.collection._docCache.getLatestDocumentDataIfExists(l);return f?(f._deleted||t.push(f),!1):!0}),n.length>0){var i=await r.storageInstance.findDocumentsById(n,!1);Mn(t,i)}}else{var o=e.isFindOneByIdQuery,a=e.collection._docCache.getLatestDocumentDataIfExists(o);if(!a){var u=await r.storageInstance.findDocumentsById([o],!1);u[0]&&(a=u[0])}a&&!a._deleted&&t.push(a)}else{var s=e.getPreparedQuery(),c=await r.storageInstance.query(s);t=c.documents}return t}function kF(e,t){if(!t.skip&&t.selector&&Object.keys(t.selector).length===1&&t.selector[e]){var r=t.selector[e];if(typeof r=="string")return r;if(Object.keys(r).length===1&&typeof r.$eq=="string"||Object.keys(r).length===1&&Array.isArray(r.$eq)&&!r.$eq.find(n=>typeof n!="string"))return r.$eq}return!1}var wi="collection",Gf="storage-token",jF="rx-migration-status",MF="RxInternalDocument",Yf=Zp({version:0,title:MF,primaryKey:{key:"id",fields:["context","key"],separator:"|"},type:"object",properties:{id:{type:"string",maxLength:200},key:{type:"string"},context:{type:"string",enum:[wi,Gf,jF,"OTHER"]},data:{type:"object",additionalProperties:!0}},indexes:[],required:["key","context","data"],additionalProperties:!1,sharding:{shards:1,mode:"collection"}});function Fl(e,t){return xf(Yf,{key:e,context:t})}async function Bm(e,t){var r=e.prepareQuery(t.schema,{selector:{context:wi},sort:[{id:"asc"}],skip:0}),n=await t.query(r),i=n.documents;return i}var Nm="storageToken",DF=Fl(Nm,Gf);async function TF(e){var t=Ja(10),r=e.password?await e.hashFunction(JSON.stringify(e.password)):void 0,n={id:DF,context:Gf,key:Nm,data:{rxdbVersion:e.rxdbVersion,token:t,instanceToken:e.token,passwordHash:r},_deleted:!1,_meta:Ga(),_rev:Ya(),_attachments:{}},i=await e.internalStore.bulkWrite([{document:n}],"internal-add-storage-token");if(i.success[0])return i.success[0];var o=fe(i.error[0]);if(o.isError&&Jp(o)){var a=o;if(!FF(a.documentInDb.data.rxdbVersion,e.rxdbVersion))throw I("DM5",{args:{databaseStateVersion:a.documentInDb.data.rxdbVersion,codeVersion:e.rxdbVersion}});if(r&&r!==a.documentInDb.data.passwordHash)throw I("DB1",{passwordHash:r,existingPasswordHash:a.documentInDb.data.passwordHash});var u=a.documentInDb;return fe(u)}throw o}function FF(e,t){if(!e||t.includes("beta")&&t!==e)return!1;var r=e.split(".")[0],n=t.split(".")[0];return r===n}function wv(e,t){return e+"-"+t.version}function Kc(e,t){return t=xe(t),t=Lw(e,t),t=Xp(e.primaryPath,e.jsonSchema,t),t._meta=Ga(),t.hasOwnProperty("_deleted")||(t._deleted=!1),t.hasOwnProperty("_attachments")||(t._attachments={}),t.hasOwnProperty("_rev")||(t._rev=Ya()),t}async function LF(e,t){t.multiInstance=e.multiInstance;var r=await e.storage.createStorageInstance(t);return r}async function Um(e,t,r,n,i,o,a){var u=await Bm(e.statics,t),s=u.filter(d=>d.data.name===i),c=[];s.forEach(d=>{c.push({collectionName:d.data.name,schema:d.data.schema,isCollection:!0}),d.data.connectedStorages.forEach(p=>c.push({collectionName:p.collectionName,isCollection:!1,schema:p.schema}))});var l=new Set;if(c=c.filter(d=>{var p=d.collectionName+"||"+d.schema.version;return l.has(p)?!1:(l.add(p),!0)}),await Promise.all(c.map(async d=>{var p=await e.createStorageInstance({collectionName:d.collectionName,databaseInstanceToken:r,databaseName:n,multiInstance:!1,options:{},schema:d.schema,password:o,devMode:me.isDevMode()});await p.remove(),d.isCollection&&await zi("postRemoveRxCollection",{storage:e,databaseName:n,collectionName:i})})),a){var f=s.map(d=>{var p=hm(d);return p._deleted=!0,p._meta.lwt=Ge(),p._rev=vl(r,d),{previous:d,document:p}});await t.bulkWrite(f,"rx-database-remove-collection-all")}}var BF=function(){function e(r){this.subs=[],this.limit=100,this.counter=0,this.eventCounterMap=new WeakMap,this.buffer=[],this.collection=r,this.subs.push(this.collection.$.pipe($n(n=>!n.isLocal)).subscribe(n=>this._handleChangeEvent(n)))}var t=e.prototype;return t._handleChangeEvent=function(n){for(this.counter++,this.buffer.push(n),this.eventCounterMap.set(n,this.counter);this.buffer.length>this.limit;)this.buffer.shift()},t.getArrayIndexByPointer=function(n){var i=this.buffer[0],o=this.eventCounterMap.get(i);if(n<o)return null;var a=n-o;return a},t.getFrom=function(n){var i=[],o=this.getArrayIndexByPointer(n);if(o===null)return null;for(;;){var a=this.buffer[o];if(o++,a)i.push(a);else return i}},t.runFrom=function(n,i){var o=this.getFrom(n);if(o===null)throw new Error("out of bounds");o.forEach(a=>i(a))},t.reduceByLastOfDoc=function(n){return n.slice(0)},t.destroy=function(){this.subs.forEach(n=>n.unsubscribe())},e}();function NF(e){return new BF(e)}var UF=new WeakMap;function WF(e){var t=e.schema.getDocumentPrototype(),r=HF(e),n=Mo,i={};return[t,r,n].forEach(o=>{var a=Object.getOwnPropertyNames(o);a.forEach(u=>{var s=Object.getOwnPropertyDescriptor(o,u),c=!0;(u.startsWith("_")||u.endsWith("_")||u.startsWith("$")||u.endsWith("$"))&&(c=!1),typeof s.value=="function"?Object.defineProperty(i,u,{get(){return s.value.bind(this)},enumerable:c,configurable:!1}):(s.enumerable=c,s.configurable=!1,s.writable&&(s.writable=!1),Object.defineProperty(i,u,s))})}),i}function qF(e){return Dt(UF,e,()=>pm(WF(e)))}function KF(e,t){var r=uD(qF(e),e,me.deepFreezeWhenDevMode(t));return e._runHooksSync("post","create",t,r),et("postCreateRxDocument",r),r}function HF(e){var t={};return Object.entries(e.methods).forEach(([r,n])=>{t[r]=n}),t}var Wm=function(e,t){var r=Or(e.newDocumentState),n=Or(e.realMasterState);return Ri(r,n)?Promise.resolve({isEqual:!0}):Promise.resolve({isEqual:!1,documentData:e.realMasterState})},qm=["pre","post"],Km=["insert","save","remove","create"],Ov=!1,Jf=function(){function e(r,n,i,o,a={},u={},s={},c={},l={},f=Dm,d={},p=Wm){this.storageInstance={},this.timeouts=new Set,this.incrementalWriteQueue={},this._incrementalUpsertQueues=new Map,this.synced=!1,this.hooks={},this._subs=[],this._docCache={},this._queryCache=vF(),this.$={},this.checkpoint$={},this._changeEventBuffer={},this.onDestroy=[],this.destroyed=!1,this.database=r,this.name=n,this.schema=i,this.internalStorageInstance=o,this.instanceCreationOptions=a,this.migrationStrategies=u,this.methods=s,this.attachments=c,this.options=l,this.cacheReplacementPolicy=f,this.statics=d,this.conflictHandler=p,VF(this.asRxCollection)}var t=e.prototype;return t.prepare=async function(){this.storageInstance=vm(this.database,this.internalStorageInstance,this.schema.jsonSchema),this.incrementalWriteQueue=new oD(this.storageInstance,this.schema.primaryPath,(a,u)=>ym(this,a,u),a=>this._runHooks("post","save",a));var n=this.database.eventBulks$.pipe(ke.filter(a=>a.collectionName===this.name));this.$=n.pipe(ke.mergeMap(a=>a.events)),this.checkpoint$=n.pipe(ke.map(a=>a.checkpoint)),this._changeEventBuffer=NF(this.asRxCollection),this._docCache=new _F(this.schema.primaryPath,this.$.pipe(ke.filter(a=>!a.isLocal)),a=>KF(this.asRxCollection,a));var i=await this.database.storageToken,o=this.storageInstance.changeStream().subscribe(a=>{var u={id:a.id,internal:!1,collectionName:this.name,storageToken:i,events:a.events.map(s=>ZM(!1,s,this)),databaseToken:this.database.token,checkpoint:a.checkpoint,context:a.context,endTime:a.endTime,startTime:a.startTime};this.database.$emit(u)});return this._subs.push(o),this._subs.push(this.storageInstance.conflictResultionTasks().subscribe(a=>{this.conflictHandler(a.input,a.context).then(u=>{this.storageInstance.resolveConflictResultionTask({id:a.id,output:u})})})),Ct},t.cleanup=function(n){throw ae("cleanup")},t.migrationNeeded=function(){throw ae("migration")},t.getMigrationState=function(){throw ae("migration")},t.startMigration=function(n=10){return this.getMigrationState().startMigration(n)},t.migratePromise=function(n=10){return this.getMigrationState().migratePromise(n)},t.insert=async function(n){var i=await this.bulkInsert([n]),o=i.error[0];Aa(this,n[this.schema.primaryPath],n,o);var a=fe(i.success[0]);return a},t.bulkInsert=async function(n){if(n.length===0)return{success:[],error:[]};var i=this.schema.primaryPath,o=n.map(f=>{var d=Kc(this.schema,f);return d}),a=this.hasHooks("pre","insert")?await Promise.all(o.map(f=>this._runHooks("pre","insert",f).then(()=>f))):o,u=a.map(f=>{var d={document:f};return d}),s=await this.storageInstance.bulkWrite(u,"rx-collection-bulk-insert"),c=Tm(this._docCache,s.success);if(this.hasHooks("post","insert")){var l=new Map;a.forEach(f=>{l.set(f[i],f)}),await Promise.all(c.map(f=>this._runHooks("post","insert",l.get(f.primary),f)))}return{success:c,error:s.error}},t.bulkRemove=async function(n){var i=this.schema.primaryPath;if(n.length===0)return{success:[],error:[]};var o=await this.findByIds(n).exec(),a=[],u=new Map;Array.from(o.values()).forEach(d=>{var p=d.toMutableJSON(!0);a.push(p),u.set(d.primary,p)}),await Promise.all(a.map(d=>{var p=d[this.schema.primaryPath];return this._runHooks("pre","remove",d,o.get(p))}));var s=a.map(d=>{var p=xe(d);return p._deleted=!0,{previous:d,document:p}}),c=await this.storageInstance.bulkWrite(s,"rx-collection-bulk-remove"),l=c.success.map(d=>d[i]);await Promise.all(l.map(d=>this._runHooks("post","remove",u.get(d),o.get(d))));var f=l.map(d=>ki(o,d));return{success:f,error:c.error}},t.bulkUpsert=async function(n){var i=[],o=new Map;n.forEach(c=>{var l=Kc(this.schema,c),f=l[this.schema.primaryPath];if(!f)throw I("COL3",{primaryPath:this.schema.primaryPath,data:l,schema:this.schema.jsonSchema});o.set(f,l),i.push(l)});var a=await this.bulkInsert(i),u=a.success.slice(0),s=[];return await Promise.all(a.error.map(async c=>{if(c.status!==409)s.push(c);else{var l=c.documentId,f=ki(o,l),d=fe(c.documentInDb),p=this._docCache.getCachedRxDocument(d),m=await p.incrementalModify(()=>f);u.push(m)}})),{error:s,success:u}},t.upsert=async function(n){var i=await this.bulkUpsert([n]);return Aa(this.asRxCollection,n[this.schema.primaryPath],n,i.error[0]),i.success[0]},t.incrementalUpsert=function(n){var i=Kc(this.schema,n),o=i[this.schema.primaryPath];if(!o)throw I("COL4",{data:n});var a=this._incrementalUpsertQueues.get(o);return a||(a=Ct),a=a.then(()=>QF(this,o,i)).then(u=>u.inserted?u.doc:zF(u.doc,i)),this._incrementalUpsertQueues.set(o,a),a},t.find=function(n){if(typeof n=="string")throw I("COL5",{queryObj:n});n||(n=ha());var i=mn("find",n,this);return i},t.findOne=function(n){if(typeof n=="number"||Array.isArray(n))throw ve("COL6",{queryObj:n});var i;if(typeof n=="string")i=mn("findOne",{selector:{[this.schema.primaryPath]:n},limit:1},this);else{if(n||(n=ha()),n.limit)throw I("QU6");n=xe(n),n.limit=1,i=mn("findOne",n,this)}return i},t.count=function(n){n||(n=ha());var i=mn("count",n,this);return i},t.findByIds=function(n){var i={selector:{[this.schema.primaryPath]:{$in:n.slice(0)}}},o=mn("findByIds",i,this);return o},t.exportJSON=function(){throw ae("json-dump")},t.importJSON=function(n){throw ae("json-dump")},t.insertCRDT=function(n){throw ae("crdt")},t.addHook=function(n,i,o,a=!1){if(typeof o!="function")throw ve("COL7",{key:i,when:n});if(!qm.includes(n))throw ve("COL8",{key:i,when:n});if(!Km.includes(i))throw I("COL9",{key:i});if(n==="post"&&i==="create"&&a===!0)throw I("COL10",{when:n,key:i,parallel:a});var u=o.bind(this),s=a?"parallel":"series";this.hooks[i]=this.hooks[i]||{},this.hooks[i][n]=this.hooks[i][n]||{series:[],parallel:[]},this.hooks[i][n][s].push(u)},t.getHooks=function(n,i){return!this.hooks[i]||!this.hooks[i][n]?{series:[],parallel:[]}:this.hooks[i][n]},t.hasHooks=function(n,i){var o=this.getHooks(n,i);return o?o.series.length>0||o.parallel.length>0:!1},t._runHooks=function(n,i,o,a){var u=this.getHooks(n,i);if(!u)return Ct;var s=u.series.map(c=>()=>c(o,a));return _w(s).then(()=>Promise.all(u.parallel.map(c=>c(o,a))))},t._runHooksSync=function(n,i,o,a){var u=this.getHooks(n,i);u&&u.series.forEach(s=>s(o,a))},t.promiseWait=function(n){var i=new Promise(o=>{var a=setTimeout(()=>{this.timeouts.delete(a),o()},n);this.timeouts.add(a)});return i},t.destroy=function(){return this.destroyed?Qt:(this.destroyed=!0,Array.from(this.timeouts).forEach(n=>clearTimeout(n)),this._changeEventBuffer&&this._changeEventBuffer.destroy(),this.database.requestIdlePromise().then(()=>Promise.all(this.onDestroy.map(n=>n()))).then(()=>this.storageInstance.close()).then(()=>(this._subs.forEach(n=>n.unsubscribe()),delete this.database.collections[this.name],zi("postDestroyRxCollection",this).then(()=>!0))))},t.remove=async function(){await this.destroy(),await Um(this.database.storage,this.database.internalStore,this.database.token,this.database.name,this.name,this.database.password,this.database.hashFunction)},cr(e,[{key:"insert$",get:function(){return this.$.pipe(ke.filter(r=>r.operation==="INSERT"))}},{key:"update$",get:function(){return this.$.pipe(ke.filter(r=>r.operation==="UPDATE"))}},{key:"remove$",get:function(){return this.$.pipe(ke.filter(r=>r.operation==="DELETE"))}},{key:"asRxCollection",get:function(){return this}}]),e}();function VF(e){if(!Ov){Ov=!0;var t=Object.getPrototypeOf(e);Km.forEach(r=>{qm.map(n=>{var i=n+Hp(r);t[i]=function(o,a){return this.addHook(n,r,o,a)}})})}}function zF(e,t){return e.incrementalModify(r=>t)}function QF(e,t,r){var n=e._docCache.getLatestDocumentDataIfExists(t);return n?Promise.resolve({doc:e._docCache.getCachedRxDocument(n),inserted:!1}):e.findOne(t).exec().then(i=>i?{doc:i,inserted:!1}:e.insert(r).then(o=>({doc:o,inserted:!0})))}function GF({database:e,name:t,schema:r,instanceCreationOptions:n={},migrationStrategies:i={},autoMigrate:o=!0,statics:a={},methods:u={},attachments:s={},options:c={},localDocuments:l=!1,cacheReplacementPolicy:f=Dm,conflictHandler:d=Wm}){var p={databaseInstanceToken:e.token,databaseName:e.name,collectionName:t,schema:r.jsonSchema,options:n,multiInstance:e.multiInstance,password:e.password,devMode:me.isDevMode()};return et("preCreateRxStorageInstance",p),LF(e,p).then(m=>{var y=new Jf(e,t,r,m,n,i,u,s,c,f,a,d);return y.prepare().then(()=>{Object.entries(a).forEach(([w,O])=>{Object.defineProperty(y,w,{get:()=>O.bind(y)})});var _=Ct;return o&&y.schema.version!==0&&(_=y.migratePromise()),_}).then(()=>(et("createRxCollection",{collection:y,creator:{name:t,schema:r,storageInstance:m,instanceCreationOptions:n,migrationStrategies:i,methods:u,attachments:s,options:c,cacheReplacementPolicy:f,localDocuments:l,statics:a}}),y)).catch(_=>m.close().then(()=>Promise.reject(_)))})}var Hm=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this._parallels=t||1,this._qC=0,this._iC=new Set,this._lHN=0,this._hPM=new Map,this._pHM=new Map};Hm.prototype={isIdle:function(){return this._qC<this._parallels},lock:function(){this._qC++},unlock:function(){this._qC--,Ll(this)},wrapCall:function(t){var r=this;this.lock();var n;try{n=t()}catch(i){throw this.unlock(),i}return!n.then||typeof n.then!="function"?(this.unlock(),n):n.then(function(i){return r.unlock(),i}).catch(function(i){throw r.unlock(),i})},requestIdlePromise:function(t){var r=this;t=t||{};var n,i=new Promise(function(u){return n=u}),o=function(){Hc(r,i),n()};if(i._manRes=o,t.timeout){var a=setTimeout(function(){i._manRes()},t.timeout);i._timeoutObj=a}return this._iC.add(i),Ll(this),i},cancelIdlePromise:function(t){Hc(this,t)},requestIdleCallback:function(t,r){var n=this._lHN++,i=this.requestIdlePromise(r);return this._hPM.set(n,i),this._pHM.set(i,n),i.then(function(){return t()}),n},cancelIdleCallback:function(t){var r=this._hPM.get(t);this.cancelIdlePromise(r)},clear:function(){var t=this;this._iC.forEach(function(r){return Hc(t,r)}),this._qC=0,this._iC.clear(),this._hPM=new Map,this._pHM=new Map}};function YF(e){if(e._iC.size!==0){var t=e._iC.values(),r=t.next().value;r._manRes(),setTimeout(function(){return Ll(e)},0)}}function Hc(e,t){if(t){if(t._timeoutObj&&clearTimeout(t._timeoutObj),e._pHM.has(t)){var r=e._pHM.get(t);e._hPM.delete(r),e._pHM.delete(t)}e._iC.delete(t)}}function Ll(e){e._tryIR||e._iC.size===0||(e._tryIR=!0,setTimeout(function(){if(!e.isIdle()){e._tryIR=!1;return}setTimeout(function(){if(!e.isIdle()){e._tryIR=!1;return}YF(e),e._tryIR=!1},0)},0))}class Xf{ttl;map=new Map;_to=!1;constructor(t){this.ttl=t}has(t){return this.map.has(t)}add(t){this.map.set(t,Vm()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,JF(this)},0))}clear(){this.map.clear()}}function JF(e){const t=Vm()-e.ttl,r=e.map[Symbol.iterator]();for(;;){const n=r.next().value;if(!n)return;const i=n[0];if(n[1]<t)e.map.delete(i);else return}}function Vm(){return Date.now()}var Ra=new Set,Zf=function(){function e(r,n,i,o,a,u,s=!1,c={},l,f,d,p){this.idleQueue=new Hm,this.rxdbVersion=xw,this.storageInstances=new Set,this._subs=[],this.startupErrors=[],this.onDestroy=[],this.destroyed=!1,this.collections={},this.eventBulks$=new ke.Subject,this.observable$=this.eventBulks$.pipe(Za(m=>m.events)),this.storageToken=Qt,this.storageTokenDocument=Qt,this.emittedEventBulkIds=new Xf(60*1e3),this.name=r,this.token=n,this.storage=i,this.instanceCreationOptions=o,this.password=a,this.multiInstance=u,this.eventReduce=s,this.options=c,this.internalStore=l,this.hashFunction=f,this.cleanupPolicy=d,this.allowSlowCount=p,this.name!=="pseudoInstance"&&(this.internalStore=vm(this.asRxDatabase,l,Yf),this.storageTokenDocument=TF(this.asRxDatabase).catch(m=>this.startupErrors.push(m)),this.storageToken=this.storageTokenDocument.then(m=>m.data.token).catch(m=>this.startupErrors.push(m)))}var t=e.prototype;return t.$emit=function(n){this.emittedEventBulkIds.has(n.id)||(this.emittedEventBulkIds.add(n.id),this.eventBulks$.next(n))},t.removeCollectionDoc=async function(n,i){var o=await XM(this.internalStore,Fl(wv(n,i),wi));if(!o)throw I("SNH",{name:n,schema:i});var a=hm(o);a._deleted=!0,await this.internalStore.bulkWrite([{document:a,previous:o}],"rx-database-remove-collection")},t.addCollections=async function(n){var i={},o={},a=[],u={};await Promise.all(Object.entries(n).map(async([l,f])=>{var d=l,p=f.schema;i[d]=p;var m=Ww(p,this.hashFunction);if(o[d]=m,this.collections[l])throw I("DB3",{name:l});var y=wv(l,p),_={id:Fl(y,wi),key:y,context:wi,data:{name:d,schemaHash:await m.hash,schema:m.jsonSchema,version:m.version,connectedStorages:[]},_deleted:!1,_meta:Ga(),_rev:Ya(),_attachments:{}};a.push({document:_});var w=Object.assign({},f,{name:d,schema:m,database:this}),O=xe(f);O.database=this,O.name=l,et("preCreateRxCollection",O),w.conflictHandler=O.conflictHandler,u[d]=w}));var s=await this.internalStore.bulkWrite(a,"rx-database-add-collection");await t2(this),await Promise.all(s.error.map(async l=>{if(l.status!==409)throw I("DB12",{database:this.name,writeError:l});var f=fe(l.documentInDb),d=f.data.name,p=o[d];if(f.data.schemaHash!==await p.hash)throw I("DB6",{database:this.name,collection:d,previousSchemaHash:f.data.schemaHash,schemaHash:await p.hash,previousSchema:f.data.schema,schema:fe(i[d])})}));var c={};return await Promise.all(Object.keys(n).map(async l=>{var f=u[l],d=await GF(f);c[l]=d,this.collections[l]=d,this[l]||Object.defineProperty(this,l,{get:()=>this.collections[l]})})),c},t.lockedRun=function(n){return this.idleQueue.wrapCall(n)},t.requestIdlePromise=function(){return this.idleQueue.requestIdlePromise()},t.exportJSON=function(n){throw ae("json-dump")},t.importJSON=function(n){throw ae("json-dump")},t.backup=function(n){throw ae("backup")},t.leaderElector=function(){throw ae("leader-election")},t.isLeader=function(){throw ae("leader-election")},t.waitForLeadership=function(){throw ae("leader-election")},t.migrationStates=function(){throw ae("migration")},t.destroy=async function(){return this.destroyed||(this.destroyed=!0,await zi("preDestroyRxDatabase",this),this.eventBulks$.complete(),this._subs.map(n=>n.unsubscribe()),this.name==="pseudoInstance")?Qt:this.requestIdlePromise().then(()=>Promise.all(this.onDestroy.map(n=>n()))).then(()=>Promise.all(Object.keys(this.collections).map(n=>this.collections[n]).map(n=>n.destroy()))).then(()=>this.internalStore.close()).then(()=>Ra.delete(this.name)).then(()=>!0)},t.remove=function(){return this.destroy().then(()=>e2(this.name,this.storage,this.password))},cr(e,[{key:"$",get:function(){return this.observable$}},{key:"asRxDatabase",get:function(){return this}}]),e}();function XF(e){if(Ra.has(e))throw I("DB8",{name:e,link:"https://pubkey.github.io/rxdb/rx-database.html#ignoreduplicate"})}async function zm(e,t,r,n,i,o){var a=await t.createStorageInstance({databaseInstanceToken:e,databaseName:r,collectionName:JM,schema:Yf,options:n,multiInstance:i,password:o,devMode:me.isDevMode()});return a}function ZF({storage:e,instanceCreationOptions:t,name:r,password:n,multiInstance:i=!0,eventReduce:o=!0,ignoreDuplicate:a=!1,options:u={},cleanupPolicy:s,allowSlowCount:c=!1,localDocuments:l=!1,hashFunction:f=vw}){et("preCreateRxDatabase",{storage:e,instanceCreationOptions:t,name:r,password:n,multiInstance:i,eventReduce:o,ignoreDuplicate:a,options:u,localDocuments:l}),a||XF(r),Ra.add(r);var d=Ja(10);return zm(d,e,r,t,i,n).catch(p=>{throw Ra.delete(r),p}).then(p=>{var m=new Zf(r,d,e,t,n,i,o,u,p,f,s,c);return zi("createRxDatabase",{database:m,creator:{storage:e,instanceCreationOptions:t,name:r,password:n,multiInstance:i,eventReduce:o,ignoreDuplicate:a,options:u,localDocuments:l}}).then(()=>m)})}async function e2(e,t,r){var n=Ja(10),i=await zm(n,t,e,{},!1,r),o=await Bm(t.statics,i),a=new Set;o.forEach(s=>a.add(s.data.name));var u=Array.from(a);return await Promise.all(u.map(s=>Um(t,i,n,e,s,r))),await zi("postRemoveRxDatabase",{databaseName:e,storage:t}),await i.remove(),u}async function t2(e){if(await e.storageToken,e.startupErrors[0])throw e.startupErrors[0]}var r2={RxSchema:ty.prototype,RxDocument:Mo,RxQuery:Fm.prototype,RxCollection:Jf.prototype,RxDatabase:Zf.prototype},Vc=new Set,Sv=new Set;function uc(e){if(et("preAddRxPlugin",{plugin:e,plugins:Vc}),!Vc.has(e)){{if(Sv.has(e.name))throw I("PL3",{name:e.name,plugin:e});Vc.add(e),Sv.add(e.name)}if(!e.rxdb)throw ve("PL1",{plugin:e});e.init&&e.init(),e.prototypes&&Object.entries(e.prototypes).forEach(([t,r])=>r(r2[t])),e.overwritable&&Object.assign(me,e.overwritable),e.hooks&&Object.entries(e.hooks).forEach(([t,r])=>{r.after&&Mi[t].push(r.after),r.before&&Mi[t].unshift(r.before)})}}var n2={prepareQuery(e,t){if(!t.sort)throw I("SNH",{query:t});var r=YD(e,t);return{query:t,queryPlan:r}},checkpointSchema:Bw};function i2(e){return e&&typeof e.then=="function"}Promise.resolve(!1);var o2=Promise.resolve(!0),Rt=Promise.resolve();function Er(e,t){return e||(e=0),new Promise(function(r){return setTimeout(function(){return r(t)},e)})}function a2(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function Lo(){return Math.random().toString(36).substring(2)}var zc=0;function Bo(){var e=Date.now()*1e3;return e<=zc&&(e=zc+1),zc=e,e}function u2(){return typeof navigator<"u"&&typeof navigator.locks<"u"&&typeof navigator.locks.request=="function"}var s2=Bo,c2="native";function l2(e){var t={time:Bo(),messagesCallback:null,bc:new BroadcastChannel(e),subFns:[]};return t.bc.onmessage=function(r){t.messagesCallback&&t.messagesCallback(r.data)},t}function f2(e){e.bc.close(),e.subFns=[]}function d2(e,t){try{return e.bc.postMessage(t,!1),Rt}catch(r){return Promise.reject(r)}}function h2(e,t){e.messagesCallback=t}function v2(){if(typeof globalThis<"u"&&globalThis.Deno&&globalThis.Deno.args)return!0;if((typeof window<"u"||typeof self<"u")&&typeof BroadcastChannel=="function"){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}else return!1}function p2(){return 150}var y2={create:l2,close:f2,onMessage:h2,postMessage:d2,canBeUsed:v2,type:c2,averageResponseTime:p2,microSeconds:s2};function ed(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=JSON.parse(JSON.stringify(e));return typeof t.webWorkerSupport>"u"&&(t.webWorkerSupport=!0),t.idb||(t.idb={}),t.idb.ttl||(t.idb.ttl=1e3*45),t.idb.fallbackInterval||(t.idb.fallbackInterval=150),e.idb&&typeof e.idb.onclose=="function"&&(t.idb.onclose=e.idb.onclose),t.localstorage||(t.localstorage={}),t.localstorage.removeTimeout||(t.localstorage.removeTimeout=1e3*60),e.methods&&(t.methods=e.methods),t.node||(t.node={}),t.node.ttl||(t.node.ttl=1e3*60*2),t.node.maxParallelWrites||(t.node.maxParallelWrites=2048),typeof t.node.useFastPath>"u"&&(t.node.useFastPath=!0),t}var m2=Bo,b2="pubkey.broadcast-channel-0-",Lt="messages",sc={durability:"relaxed"},g2="idb";function Qm(){if(typeof indexedDB<"u")return indexedDB;if(typeof window<"u"){if(typeof window.mozIndexedDB<"u")return window.mozIndexedDB;if(typeof window.webkitIndexedDB<"u")return window.webkitIndexedDB;if(typeof window.msIndexedDB<"u")return window.msIndexedDB}return!1}function td(e){e.commit&&e.commit()}function _2(e){var t=Qm(),r=b2+e,n=t.open(r);return n.onupgradeneeded=function(i){var o=i.target.result;o.createObjectStore(Lt,{keyPath:"id",autoIncrement:!0})},new Promise(function(i,o){n.onerror=function(a){return o(a)},n.onsuccess=function(){i(n.result)}})}function w2(e,t,r){var n=Date.now(),i={uuid:t,time:n,data:r},o=e.transaction([Lt],"readwrite",sc);return new Promise(function(a,u){o.oncomplete=function(){return a()},o.onerror=function(c){return u(c)};var s=o.objectStore(Lt);s.add(i),td(o)})}function O2(e,t){var r=e.transaction(Lt,"readonly",sc),n=r.objectStore(Lt),i=[],o=IDBKeyRange.bound(t+1,1/0);if(n.getAll){var a=n.getAll(o);return new Promise(function(s,c){a.onerror=function(l){return c(l)},a.onsuccess=function(l){s(l.target.result)}})}function u(){try{return o=IDBKeyRange.bound(t+1,1/0),n.openCursor(o)}catch{return n.openCursor()}}return new Promise(function(s,c){var l=u();l.onerror=function(f){return c(f)},l.onsuccess=function(f){var d=f.target.result;d?d.value.id<t+1?d.continue(t+1):(i.push(d.value),d.continue()):(td(r),s(i))}})}function S2(e,t){if(e.closed)return Promise.resolve([]);var r=e.db.transaction(Lt,"readwrite",sc),n=r.objectStore(Lt);return Promise.all(t.map(function(i){var o=n.delete(i);return new Promise(function(a){o.onsuccess=function(){return a()}})}))}function E2(e,t){var r=Date.now()-t,n=e.transaction(Lt,"readonly",sc),i=n.objectStore(Lt),o=[];return new Promise(function(a){i.openCursor().onsuccess=function(u){var s=u.target.result;if(s){var c=s.value;c.time<r?(o.push(c),s.continue()):(td(n),a(o))}else a(o)}})}function P2(e){return E2(e.db,e.options.idb.ttl).then(function(t){return S2(e,t.map(function(r){return r.id}))})}function $2(e,t){return t=ed(t),_2(e).then(function(r){var n={closed:!1,lastCursorId:0,channelName:e,options:t,uuid:Lo(),eMIs:new Xf(t.idb.ttl*2),writeBlockPromise:Rt,messagesCallback:null,readQueuePromises:[],db:r};return r.onclose=function(){n.closed=!0,t.idb.onclose&&t.idb.onclose()},Gm(n),n})}function Gm(e){e.closed||Ym(e).then(function(){return Er(e.options.idb.fallbackInterval)}).then(function(){return Gm(e)})}function A2(e,t){return!(e.uuid===t.uuid||t.eMIs.has(e.id)||e.data.time<t.messagesCallbackTime)}function Ym(e){return e.closed||!e.messagesCallback?Rt:O2(e.db,e.lastCursorId).then(function(t){var r=t.filter(function(n){return!!n}).map(function(n){return n.id>e.lastCursorId&&(e.lastCursorId=n.id),n}).filter(function(n){return A2(n,e)}).sort(function(n,i){return n.time-i.time});return r.forEach(function(n){e.messagesCallback&&(e.eMIs.add(n.id),e.messagesCallback(n.data))}),Rt})}function x2(e){e.closed=!0,e.db.close()}function C2(e,t){return e.writeBlockPromise=e.writeBlockPromise.then(function(){return w2(e.db,e.uuid,t)}).then(function(){a2(0,10)===0&&P2(e)}),e.writeBlockPromise}function I2(e,t,r){e.messagesCallbackTime=r,e.messagesCallback=t,Ym(e)}function R2(){return!!Qm()}function k2(e){return e.idb.fallbackInterval*2}var j2={create:$2,close:x2,onMessage:I2,postMessage:C2,canBeUsed:R2,type:g2,averageResponseTime:k2,microSeconds:m2},M2=Bo,D2="pubkey.broadcastChannel-",T2="localstorage";function Jm(){var e;if(typeof window>"u")return null;try{e=window.localStorage,e=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return e}function Xm(e){return D2+e}function F2(e,t){return new Promise(function(r){Er().then(function(){var n=Xm(e.channelName),i={token:Lo(),time:Date.now(),data:t,uuid:e.uuid},o=JSON.stringify(i);Jm().setItem(n,o);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=n,a.newValue=o,window.dispatchEvent(a),r()})})}function L2(e,t){var r=Xm(e),n=function(o){o.key===r&&t(JSON.parse(o.newValue))};return window.addEventListener("storage",n),n}function B2(e){window.removeEventListener("storage",e)}function N2(e,t){if(t=ed(t),!Zm())throw new Error("BroadcastChannel: localstorage cannot be used");var r=Lo(),n=new Xf(t.localstorage.removeTimeout),i={channelName:e,uuid:r,eMIs:n};return i.listener=L2(e,function(o){i.messagesCallback&&o.uuid!==r&&(!o.token||n.has(o.token)||o.data.time&&o.data.time<i.messagesCallbackTime||(n.add(o.token),i.messagesCallback(o.data)))}),i}function U2(e){B2(e.listener)}function W2(e,t,r){e.messagesCallbackTime=r,e.messagesCallback=t}function Zm(){var e=Jm();if(!e)return!1;try{var t="__broadcastchannel_check";e.setItem(t,"works"),e.removeItem(t)}catch{return!1}return!0}function q2(){var e=120,t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")?e*2:e}var K2={create:N2,close:U2,onMessage:W2,postMessage:F2,canBeUsed:Zm,type:T2,averageResponseTime:q2,microSeconds:M2},eb=Bo,H2="simulate",rd=new Set;function V2(e){var t={time:eb(),name:e,messagesCallback:null};return rd.add(t),t}function z2(e){rd.delete(e)}var tb=5;function Q2(e,t){return new Promise(function(r){return setTimeout(function(){var n=Array.from(rd);n.forEach(function(i){i.name===e.name&&i!==e&&i.messagesCallback&&i.time<t.time&&i.messagesCallback(t)}),r()},tb)})}function G2(e,t){e.messagesCallback=t}function Y2(){return!0}function J2(){return tb}var X2={create:V2,close:z2,onMessage:G2,postMessage:Q2,canBeUsed:Y2,type:H2,averageResponseTime:J2,microSeconds:eb},Ev=[y2,j2,K2];function Z2(e){var t=[].concat(e.methods,Ev).filter(Boolean);if(e.type){if(e.type==="simulate")return X2;var r=t.find(function(i){return i.type===e.type});if(r)return r;throw new Error("method-type "+e.type+" not found")}e.webWorkerSupport||(t=t.filter(function(i){return i.type!=="idb"}));var n=t.find(function(i){return i.canBeUsed()});if(n)return n;throw new Error("No usable method found in "+JSON.stringify(Ev.map(function(i){return i.type})))}var rb=new Set,eL=0,cc=function(t,r){this.id=eL++,rb.add(this),this.name=t,Pv&&(r=Pv),this.options=ed(r),this.method=Z2(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,tL(this)};cc._pubkey=!0;var Pv;cc.prototype={postMessage:function(t){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(t));return $v(this,"message",t)},postInternal:function(t){return $v(this,"internal",t)},set onmessage(e){var t=this.method.microSeconds(),r={time:t,fn:e};xv(this,"message",this._onML),e&&typeof e=="function"?(this._onML=r,Av(this,"message",r)):this._onML=null},addEventListener:function(t,r){var n=this.method.microSeconds(),i={time:n,fn:r};Av(this,t,i)},removeEventListener:function(t,r){var n=this._addEL[t].find(function(i){return i.fn===r});xv(this,t,n)},close:function(){var t=this;if(!this.closed){rb.delete(this),this.closed=!0;var r=this._prepP?this._prepP:Rt;return this._onML=null,this._addEL.message=[],r.then(function(){return Promise.all(Array.from(t._uMP))}).then(function(){return Promise.all(t._befC.map(function(n){return n()}))}).then(function(){return t.method.close(t._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function $v(e,t,r){var n=e.method.microSeconds(),i={time:n,type:t,data:r},o=e._prepP?e._prepP:Rt;return o.then(function(){var a=e.method.postMessage(e._state,i);return e._uMP.add(a),a.catch().then(function(){return e._uMP.delete(a)}),a})}function tL(e){var t=e.method.create(e.name,e.options);i2(t)?(e._prepP=t,t.then(function(r){e._state=r})):e._state=t}function nb(e){return e._addEL.message.length>0||e._addEL.internal.length>0}function Av(e,t,r){e._addEL[t].push(r),rL(e)}function xv(e,t,r){e._addEL[t]=e._addEL[t].filter(function(n){return n!==r}),nL(e)}function rL(e){if(!e._iL&&nb(e)){var t=function(i){e._addEL[i.type].forEach(function(o){i.time>=o.time&&o.fn(i.data)})},r=e.method.microSeconds();e._prepP?e._prepP.then(function(){e._iL=!0,e.method.onMessage(e._state,t,r)}):(e._iL=!0,e.method.onMessage(e._state,t,r))}}function nL(e){if(e._iL&&!nb(e)){e._iL=!1;var t=e.method.microSeconds();e.method.onMessage(e._state,null,t)}}function iL(e){if(typeof WorkerGlobalScope=="function"&&self instanceof WorkerGlobalScope){var t=self.close.bind(self);self.close=function(){return e(),t()}}else{if(typeof window.addEventListener!="function")return;window.addEventListener("beforeunload",function(){e()},!0),window.addEventListener("unload",function(){e()},!0)}}function oL(e){process.on("exit",function(){return e()}),process.on("beforeExit",function(){return e().then(function(){return process.exit()})}),process.on("SIGINT",function(){return e().then(function(){return process.exit()})}),process.on("uncaughtException",function(t){return e().then(function(){console.trace(t),process.exit(101)})})}var aL=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",uL=aL?oL:iL,Oi=new Set,Cv=!1;function sL(){Cv||(Cv=!0,uL(lL))}function cL(e){if(sL(),typeof e!="function")throw new Error("Listener is no function");Oi.add(e);var t={remove:function(){return Oi.delete(e)},run:function(){return Oi.delete(e),e()}};return t}function lL(){var e=[];return Oi.forEach(function(t){e.push(t()),Oi.delete(t)}),Promise.all(e)}function Cr(e,t){var r={context:"leader",action:t,token:e.token};return e.broadcastChannel.postInternal(r)}function ib(e){e.isLeader=!0,e._hasLeader=!0;var t=cL(function(){return e.die()});e._unl.push(t);var r=function(i){i.context==="leader"&&i.action==="apply"&&Cr(e,"tell"),i.context==="leader"&&i.action==="tell"&&!e._dpLC&&(e._dpLC=!0,e._dpL(),Cr(e,"tell"))};return e.broadcastChannel.addEventListener("internal",r),e._lstns.push(r),Cr(e,"tell")}var ob=function(t,r){var n=this;this.broadcastChannel=t,t._befC.push(function(){return n.die()}),this._options=r,this.isLeader=!1,this.isDead=!1,this.token=Lo(),this._lstns=[],this._unl=[],this._dpL=function(){},this._dpLC=!1,this._wKMC={},this.lN="pubkey-bc||"+t.method.type+"||"+t.name};ob.prototype={hasLeader:function(){var t=this;return navigator.locks.query().then(function(r){var n=r.held?r.held.filter(function(i){return i.name===t.lN}):[];return!!(n&&n.length>0)})},awaitLeadership:function(){var t=this;if(!this._wLMP){this._wKMC.c=new AbortController;var r=new Promise(function(n,i){t._wKMC.res=n,t._wKMC.rej=i});this._wLMP=new Promise(function(n){navigator.locks.request(t.lN,{signal:t._wKMC.c.signal},function(){return t._wKMC.c=void 0,ib(t),n(),r}).catch(function(){})})}return this._wLMP},set onduplicate(e){},die:function(){var t=this;return this._lstns.forEach(function(r){return t.broadcastChannel.removeEventListener("internal",r)}),this._lstns=[],this._unl.forEach(function(r){return r.remove()}),this._unl=[],this.isLeader&&(this.isLeader=!1),this.isDead=!0,this._wKMC.res&&this._wKMC.res(),this._wKMC.c&&this._wKMC.c.abort("LeaderElectionWebLock.die() called"),Cr(this,"death")}};var ab=function(t,r){var n=this;this.broadcastChannel=t,this._options=r,this.isLeader=!1,this._hasLeader=!1,this.isDead=!1,this.token=Lo(),this._aplQ=Rt,this._aplQC=0,this._unl=[],this._lstns=[],this._dpL=function(){},this._dpLC=!1;var i=function(a){a.context==="leader"&&(a.action==="death"&&(n._hasLeader=!1),a.action==="tell"&&(n._hasLeader=!0))};this.broadcastChannel.addEventListener("internal",i),this._lstns.push(i)};ab.prototype={hasLeader:function(){return Promise.resolve(this._hasLeader)},applyOnce:function(t){var r=this;if(this.isLeader)return Er(0,!0);if(this.isDead)return Er(0,!1);if(this._aplQC>1)return this._aplQ;var n=function(){if(r.isLeader)return o2;var o=!1,a,u=new Promise(function(l){a=function(){o=!0,l()}}),s=function(f){f.context==="leader"&&f.token!=r.token&&(f.action==="apply"&&f.token>r.token&&a(),f.action==="tell"&&(a(),r._hasLeader=!0))};r.broadcastChannel.addEventListener("internal",s);var c=t?r._options.responseTime*4:r._options.responseTime;return Cr(r,"apply").then(function(){return Promise.race([Er(c),u.then(function(){return Promise.reject(new Error)})])}).then(function(){return Cr(r,"apply")}).then(function(){return Promise.race([Er(c),u.then(function(){return Promise.reject(new Error)})])}).catch(function(){}).then(function(){return r.broadcastChannel.removeEventListener("internal",s),o?!1:ib(r).then(function(){return!0})})};return this._aplQC=this._aplQC+1,this._aplQ=this._aplQ.then(function(){return n()}).then(function(){r._aplQC=r._aplQC-1}),this._aplQ.then(function(){return r.isLeader})},awaitLeadership:function(){return this._aLP||(this._aLP=fL(this)),this._aLP},set onduplicate(e){this._dpL=e},die:function(){var t=this;return this._lstns.forEach(function(r){return t.broadcastChannel.removeEventListener("internal",r)}),this._lstns=[],this._unl.forEach(function(r){return r.remove()}),this._unl=[],this.isLeader&&(this._hasLeader=!1,this.isLeader=!1),this.isDead=!0,Cr(this,"death")}};function fL(e){return e.isLeader?Rt:new Promise(function(t){var r=!1;function n(){r||(r=!0,e.broadcastChannel.removeEventListener("internal",o),t(!0))}e.applyOnce().then(function(){e.isLeader&&n()});var i=function a(){return Er(e._options.fallbackInterval).then(function(){if(!(e.isDead||r))if(e.isLeader)n();else return e.applyOnce(!0).then(function(){e.isLeader?n():a()})})};i();var o=function(u){u.context==="leader"&&u.action==="death"&&(e._hasLeader=!1,e.applyOnce().then(function(){e.isLeader&&n()}))};e.broadcastChannel.addEventListener("internal",o),e._lstns.push(o)})}function dL(e,t){return e||(e={}),e=JSON.parse(JSON.stringify(e)),e.fallbackInterval||(e.fallbackInterval=3e3),e.responseTime||(e.responseTime=t.method.averageResponseTime(t.options)),e}function hL(e,t){if(e._leaderElector)throw new Error("BroadcastChannel already has a leader-elector");t=dL(t,e);var r=u2()?new ob(e,t):new ab(e,t);return e._befC.push(function(){return r.die()}),e._leaderElector=r,r}var ka=new Map;function ub(e,t,r,n){var i=ka.get(t);return i||(i={bc:new cc(["RxDB:",e,r].join("|")),refs:new Set},ka.set(t,i)),i.refs.add(n),i.bc}function Bl(e,t){var r=ka.get(e);if(r&&(r.refs.delete(t),r.refs.size===0))return ka.delete(e),r.bc.close()}function vL(e,t,r,n){if(t.multiInstance){var i=n||ub(e,t.databaseInstanceToken,r.databaseName,r),o=new ke.Subject,a=d=>{d.storageName===e&&d.databaseName===t.databaseName&&d.collectionName===t.collectionName&&d.version===t.schema.version&&o.next(d.eventBulk)};i.addEventListener("message",a);var u=r.changeStream(),s=!1,c=u.subscribe(d=>{s||i.postMessage({storageName:e,databaseName:t.databaseName,collectionName:t.collectionName,version:t.schema.version,eventBulk:d})});r.changeStream=function(){return o.asObservable().pipe(S1(u))};var l=r.close.bind(r);r.close=async function(){return s=!0,c.unsubscribe(),i.removeEventListener("message",a),n||await Bl(t.databaseInstanceToken,r),l()};var f=r.remove.bind(r);r.remove=async function(){return s=!0,c.unsubscribe(),i.removeEventListener("message",a),n||await Bl(t.databaseInstanceToken,r),f()}}}var sb=new WeakMap,pL=new WeakMap;function Nl(e){return Dt(pL,e,()=>hL(e))}function yL(){var e=ub(this.storage.name,this.token,this.name,this),t=this.destroy.bind(this);this.destroy=function(){return Bl(this.token,this),t()};var r=Nl(e);return r||(r=Nl(e),sb.set(this,r)),this.leaderElector=()=>r,r}function mL(){return this.multiInstance?this.leaderElector().isLeader:!0}function bL(){return this.multiInstance?this.leaderElector().awaitLeadership().then(()=>!0):mw}function gL(e){var t=sb.get(e);t&&t.die()}var _L=!0,wL={RxDatabase:e=>{e.leaderElector=yL,e.isLeader=mL,e.waitForLeadership=bL}},OL={name:"leader-election",rxdb:_L,prototypes:wL,hooks:{preDestroyRxDatabase:{after:gL}}},SL=["__proto__","constructor","prototype"];function mi(e,t){Object.keys(t).forEach(r=>{SL.includes(r)||(typeof e[r]>"u"?e[r]=t[r]:Si(t[r])?mi(e[r],t[r]):e[r]=t[r])})}function Si(e){return e.toString()==="[object Object]"}var lc=function(){function e(r,n){if(this.options={},this._conditions={},this._fields={},this._path=n,r){var i=this;r.selector&&i.find(r.selector),r.limit&&i.limit(r.limit),r.skip&&i.skip(r.skip),r.sort&&r.sort.forEach(o=>i.sort(o))}}var t=e.prototype;return t.where=function(n,i){if(!arguments.length)return this;var o=typeof arguments[0];if(o==="string")return this._path=arguments[0],arguments.length===2&&(this._conditions[this._path]=arguments[1]),this;if(o==="object"&&!Array.isArray(arguments[0]))return this.merge(arguments[0]);throw ve("MQ1",{path:arguments[0]})},t.equals=function(n){this._ensurePath("equals");var i=this._path;return this._conditions[i]=n,this},t.eq=function(n){this._ensurePath("eq");var i=this._path;return this._conditions[i]=n,this},t.or=function(n){var i=this._conditions.$or||(this._conditions.$or=[]);return Array.isArray(n)||(n=[n]),i.push.apply(i,n),this},t.nor=function(n){var i=this._conditions.$nor||(this._conditions.$nor=[]);return Array.isArray(n)||(n=[n]),i.push.apply(i,n),this},t.and=function(n){var i=this._conditions.$and||(this._conditions.$and=[]);return Array.isArray(n)||(n=[n]),i.push.apply(i,n),this},t.mod=function(n,i){var o,a;arguments.length===1?(this._ensurePath("mod"),o=arguments[0],a=this._path):arguments.length===2&&!Array.isArray(arguments[1])?(this._ensurePath("mod"),o=arguments.slice(),a=this._path):arguments.length===3?(o=arguments.slice(1),a=arguments[0]):(o=arguments[1],a=arguments[0]);var u=this._conditions[a]||(this._conditions[a]={});return u.$mod=o,this},t.exists=function(n,i){var o,a;arguments.length===0?(this._ensurePath("exists"),o=this._path,a=!0):arguments.length===1?typeof arguments[0]=="boolean"?(this._ensurePath("exists"),o=this._path,a=arguments[0]):(o=arguments[0],a=!0):arguments.length===2&&(o=arguments[0],a=arguments[1]);var u=this._conditions[o]||(this._conditions[o]={});return u.$exists=a,this},t.elemMatch=function(n,i){if(arguments[0]===null)throw ve("MQ2");var o,a,u;if(typeof arguments[0]=="function")this._ensurePath("elemMatch"),a=this._path,o=arguments[0];else if(Si(arguments[0]))this._ensurePath("elemMatch"),a=this._path,u=arguments[0];else if(typeof arguments[1]=="function")a=arguments[0],o=arguments[1];else if(arguments[1]&&Si(arguments[1]))a=arguments[0],u=arguments[1];else throw ve("MQ2");o&&(u=new e,o(u),u=u._conditions);var s=this._conditions[a]||(this._conditions[a]={});return s.$elemMatch=u,this},t.sort=function(n){if(!n)return this;var i,o=typeof n;if(Array.isArray(n)){i=n.length;for(var a=0;a<n.length;++a)PL(this.options,n[a][0],n[a][1]);return this}if(arguments.length===1&&o==="string"){n=n.split(/\s+/),i=n.length;for(var u=0;u<i;++u){var s=n[u];if(s){var c=s[0]==="-"?-1:1;c===-1&&(s=s.substring(1)),Iv(this.options,s,c)}}return this}if(Si(n)){var l=Object.keys(n);return l.forEach(f=>Iv(this.options,f,n[f])),this}throw ve("MQ3",{args:arguments})},t.merge=function(n){if(!n)return this;if(!Rv(n))throw ve("MQ4",{source:n});return n instanceof e?(n._conditions&&mi(this._conditions,n._conditions),n._fields&&(this._fields||(this._fields={}),mi(this._fields,n._fields)),n.options&&(this.options||(this.options={}),mi(this.options,n.options)),n._distinct&&(this._distinct=n._distinct),this):(mi(this._conditions,n),this)},t.find=function(n){return Rv(n)&&this.merge(n),this},t._ensurePath=function(n){if(!this._path)throw I("MQ5",{method:n})},t.toJSON=function(){var n={selector:this._conditions};return this.options.skip&&(n.skip=this.options.skip),this.options.limit&&(n.limit=this.options.limit),this.options.sort&&(n.sort=EL(this.options.sort)),{query:n,path:this._path}},e}();function EL(e){return Object.entries(e).map(([t,r])=>{var n=r===1?"asc":"desc",i={[t]:n};return i})}var cb=["limit","skip","maxScan","batchSize","comment"];cb.forEach(function(e){lc.prototype[e]=function(t){return this.options[e]=t,this}});var lb=["gt","gte","lt","lte","ne","in","nin","all","regex","size"];lb.forEach(function(e){lc.prototype[e]=function(){var t,r;arguments.length===1?(this._ensurePath(e),r=arguments[0],t=this._path):(r=arguments[1],t=arguments[0]);var n=this._conditions[t]===null||typeof this._conditions[t]=="object"?this._conditions[t]:this._conditions[t]={};if(e==="regex"){if(r instanceof RegExp)throw I("QU16",{field:t,query:this._conditions});typeof r=="string"?n["$"+e]=r:(n["$"+e]=r.$regex,r.$options&&(n.$options=r.$options))}else n["$"+e]=r;return this}});function Iv(e,t,r){if(Array.isArray(e.sort))throw ve("MQ6",{opts:e,field:t,value:r});if(r&&r.$meta){var n=e.sort||(e.sort={});n[t]={$meta:r.$meta};return}var i=String(r||1).toLowerCase();if(!/^(?:ascending|asc|descending|desc|1|-1)$/.test(i))throw Array.isArray(r)&&(r="["+r+"]"),ve("MQ7",{field:t,value:r});var o=e.sort||(e.sort={}),a=r.toString().replace("asc","1").replace("ascending","1").replace("desc","-1").replace("descending","-1");o[t]=parseInt(a,10)}function PL(e,t,r){if(e.sort=e.sort||[],!Array.isArray(e.sort))throw ve("MQ8",{opts:e,field:t,value:r});e.sort.push([t,r])}function Rv(e){return e instanceof lc||Si(e)}function $L(e,t){return new lc(e,t)}var kv="queryBuilderPath";function AL(e,t,r){var n=$L(Dn(e.mangoQuery),e.other[kv]);n[t](r);var i=n.toJSON();return mn(e.op,i.query,e.collection,{...e.other,[kv]:i.path})}function Qc(e,t){e[t]=function(r){return AL(this,t,r)}}var xL={name:"query-builder",rxdb:!0,prototypes:{RxQuery(e){["where","equals","eq","or","nor","and","mod","exists","elemMatch","sort"].forEach(t=>{Qc(e,t)}),cb.forEach(t=>{Qc(e,t)}),lb.forEach(t=>{Qc(e,t)})}}},fb={exports:{}};(function(e){var t=function(){function r(d,p){return p!=null&&d instanceof p}var n;try{n=Map}catch{n=function(){}}var i;try{i=Set}catch{i=function(){}}var o;try{o=Promise}catch{o=function(){}}function a(d,p,m,y,_){typeof p=="object"&&(m=p.depth,y=p.prototype,_=p.includeNonEnumerable,p=p.circular);var w=[],O=[],E=typeof Buffer<"u";typeof p>"u"&&(p=!0),typeof m>"u"&&(m=1/0);function A(P,x){if(P===null)return null;if(x===0)return P;var C,k;if(typeof P!="object")return P;if(r(P,n))C=new n;else if(r(P,i))C=new i;else if(r(P,o))C=new o(function(ne,le){P.then(function(he){ne(A(he,x-1))},function(he){le(A(he,x-1))})});else if(a.__isArray(P))C=[];else if(a.__isRegExp(P))C=new RegExp(P.source,f(P)),P.lastIndex&&(C.lastIndex=P.lastIndex);else if(a.__isDate(P))C=new Date(P.getTime());else{if(E&&Buffer.isBuffer(P))return Buffer.allocUnsafe?C=Buffer.allocUnsafe(P.length):C=new Buffer(P.length),P.copy(C),C;r(P,Error)?C=Object.create(P):typeof y>"u"?(k=Object.getPrototypeOf(P),C=Object.create(k)):(C=Object.create(y),k=y)}if(p){var M=w.indexOf(P);if(M!=-1)return O[M];w.push(P),O.push(C)}r(P,n)&&P.forEach(function(ne,le){var he=A(le,x-1),Ke=A(ne,x-1);C.set(he,Ke)}),r(P,i)&&P.forEach(function(ne){var le=A(ne,x-1);C.add(le)});for(var N in P){var K;k&&(K=Object.getOwnPropertyDescriptor(k,N)),!(K&&K.set==null)&&(C[N]=A(P[N],x-1))}if(Object.getOwnPropertySymbols)for(var Y=Object.getOwnPropertySymbols(P),N=0;N<Y.length;N++){var Q=Y[N],H=Object.getOwnPropertyDescriptor(P,Q);H&&!H.enumerable&&!_||(C[Q]=A(P[Q],x-1),H.enumerable||Object.defineProperty(C,Q,{enumerable:!1}))}if(_)for(var Ie=Object.getOwnPropertyNames(P),N=0;N<Ie.length;N++){var Ce=Ie[N],H=Object.getOwnPropertyDescriptor(P,Ce);H&&H.enumerable||(C[Ce]=A(P[Ce],x-1),Object.defineProperty(C,Ce,{enumerable:!1}))}return C}return A(d,m)}a.clonePrototype=function(p){if(p===null)return null;var m=function(){};return m.prototype=p,new m};function u(d){return Object.prototype.toString.call(d)}a.__objToStr=u;function s(d){return typeof d=="object"&&u(d)==="[object Date]"}a.__isDate=s;function c(d){return typeof d=="object"&&u(d)==="[object Array]"}a.__isArray=c;function l(d){return typeof d=="object"&&u(d)==="[object RegExp]"}a.__isRegExp=l;function f(d){var p="";return d.global&&(p+="g"),d.ignoreCase&&(p+="i"),d.multiline&&(p+="m"),p}return a.__getRegExpFlags=f,a}();e.exports&&(e.exports=t)})(fb);var CL=fb.exports,jv=Object.prototype.toString,db=function(t){var r=jv.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jv.call(t.callee)==="[object Function]"),n},Gc,Mv;function IL(){if(Mv)return Gc;Mv=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=db,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],s=function(d){var p=d.constructor;return p&&p.prototype===d},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},l=function(){if(typeof window>"u")return!1;for(var d in window)try{if(!c["$"+d]&&t.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{s(window[d])}catch{return!0}}catch{return!0}return!1}(),f=function(d){if(typeof window>"u"||!l)return s(d);try{return s(d)}catch{return!1}};e=function(p){var m=p!==null&&typeof p=="object",y=r.call(p)==="[object Function]",_=n(p),w=m&&r.call(p)==="[object String]",O=[];if(!m&&!y&&!_)throw new TypeError("Object.keys called on a non-object");var E=a&&y;if(w&&p.length>0&&!t.call(p,0))for(var A=0;A<p.length;++A)O.push(String(A));if(_&&p.length>0)for(var P=0;P<p.length;++P)O.push(String(P));else for(var x in p)!(E&&x==="prototype")&&t.call(p,x)&&O.push(String(x));if(o)for(var C=f(p),k=0;k<u.length;++k)!(C&&u[k]==="constructor")&&t.call(p,u[k])&&O.push(u[k]);return O}}return Gc=e,Gc}var RL=Array.prototype.slice,kL=db,Dv=Object.keys,va=Dv?function(t){return Dv(t)}:IL(),Tv=Object.keys;va.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return kL(n)?Tv(RL.call(n)):Tv(n)})}else Object.keys=va;return Object.keys||va};var hb=va,vb=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(r in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,r);if(a.value!==i||a.enumerable!==!0)return!1}return!0},jL=vb,nd=function(){return jL()&&!!Symbol.toStringTag},Fv=typeof Symbol<"u"&&Symbol,ML=vb,DL=function(){return typeof Fv!="function"||typeof Symbol!="function"||typeof Fv("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ML()},Lv={foo:{}},TL=Object,FL=function(){return{__proto__:Lv}.foo===Lv.foo&&!({__proto__:null}instanceof TL)},LL="Function.prototype.bind called on incompatible ",Yc=Array.prototype.slice,BL=Object.prototype.toString,NL="[object Function]",UL=function(t){var r=this;if(typeof r!="function"||BL.call(r)!==NL)throw new TypeError(LL+r);for(var n=Yc.call(arguments,1),i,o=function(){if(this instanceof i){var l=r.apply(this,n.concat(Yc.call(arguments)));return Object(l)===l?l:this}else return r.apply(t,n.concat(Yc.call(arguments)))},a=Math.max(0,r.length-n.length),u=[],s=0;s<a;s++)u.push("$"+s);if(i=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var c=function(){};c.prototype=r.prototype,i.prototype=new c,c.prototype=null}return i},WL=UL,id=Function.prototype.bind||WL,qL=id,KL=qL.call(Function.call,Object.prototype.hasOwnProperty),V,Kn=SyntaxError,pb=Function,xn=TypeError,Jc=function(e){try{return pb('"use strict"; return ('+e+").constructor;")()}catch{}},Ir=Object.getOwnPropertyDescriptor;if(Ir)try{Ir({},"")}catch{Ir=null}var Xc=function(){throw new xn},HL=Ir?function(){try{return arguments.callee,Xc}catch{try{return Ir(arguments,"callee").get}catch{return Xc}}}():Xc,dn=DL(),VL=FL(),Ae=Object.getPrototypeOf||(VL?function(e){return e.__proto__}:null),bn={},zL=typeof Uint8Array>"u"||!Ae?V:Ae(Uint8Array),Rr={"%AggregateError%":typeof AggregateError>"u"?V:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?V:ArrayBuffer,"%ArrayIteratorPrototype%":dn&&Ae?Ae([][Symbol.iterator]()):V,"%AsyncFromSyncIteratorPrototype%":V,"%AsyncFunction%":bn,"%AsyncGenerator%":bn,"%AsyncGeneratorFunction%":bn,"%AsyncIteratorPrototype%":bn,"%Atomics%":typeof Atomics>"u"?V:Atomics,"%BigInt%":typeof BigInt>"u"?V:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?V:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?V:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?V:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?V:Float32Array,"%Float64Array%":typeof Float64Array>"u"?V:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?V:FinalizationRegistry,"%Function%":pb,"%GeneratorFunction%":bn,"%Int8Array%":typeof Int8Array>"u"?V:Int8Array,"%Int16Array%":typeof Int16Array>"u"?V:Int16Array,"%Int32Array%":typeof Int32Array>"u"?V:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dn&&Ae?Ae(Ae([][Symbol.iterator]())):V,"%JSON%":typeof JSON=="object"?JSON:V,"%Map%":typeof Map>"u"?V:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dn||!Ae?V:Ae((new Map)[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?V:Promise,"%Proxy%":typeof Proxy>"u"?V:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?V:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?V:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dn||!Ae?V:Ae((new Set)[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?V:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dn&&Ae?Ae(""[Symbol.iterator]()):V,"%Symbol%":dn?Symbol:V,"%SyntaxError%":Kn,"%ThrowTypeError%":HL,"%TypedArray%":zL,"%TypeError%":xn,"%Uint8Array%":typeof Uint8Array>"u"?V:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?V:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?V:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?V:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?V:WeakMap,"%WeakRef%":typeof WeakRef>"u"?V:WeakRef,"%WeakSet%":typeof WeakSet>"u"?V:WeakSet};if(Ae)try{null.error}catch(e){var QL=Ae(Ae(e));Rr["%Error.prototype%"]=QL}var GL=function e(t){var r;if(t==="%AsyncFunction%")r=Jc("async function () {}");else if(t==="%GeneratorFunction%")r=Jc("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Jc("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Ae&&(r=Ae(i.prototype))}return Rr[t]=r,r},Bv={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},No=id,ja=KL,YL=No.call(Function.call,Array.prototype.concat),JL=No.call(Function.apply,Array.prototype.splice),Nv=No.call(Function.call,String.prototype.replace),Ma=No.call(Function.call,String.prototype.slice),XL=No.call(Function.call,RegExp.prototype.exec),ZL=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,eB=/\\(\\)?/g,tB=function(t){var r=Ma(t,0,1),n=Ma(t,-1);if(r==="%"&&n!=="%")throw new Kn("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Kn("invalid intrinsic syntax, expected opening `%`");var i=[];return Nv(t,ZL,function(o,a,u,s){i[i.length]=u?Nv(s,eB,"$1"):a||o}),i},rB=function(t,r){var n=t,i;if(ja(Bv,n)&&(i=Bv[n],n="%"+i[0]+"%"),ja(Rr,n)){var o=Rr[n];if(o===bn&&(o=GL(n)),typeof o>"u"&&!r)throw new xn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new Kn("intrinsic "+t+" does not exist!")},Uo=function(t,r){if(typeof t!="string"||t.length===0)throw new xn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new xn('"allowMissing" argument must be a boolean');if(XL(/^%?[^%]*%?$/,t)===null)throw new Kn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=tB(t),i=n.length>0?n[0]:"",o=rB("%"+i+"%",r),a=o.name,u=o.value,s=!1,c=o.alias;c&&(i=c[0],JL(n,YL([0,1],c)));for(var l=1,f=!0;l<n.length;l+=1){var d=n[l],p=Ma(d,0,1),m=Ma(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Kn("property names with quotes must have matching quotes");if((d==="constructor"||!f)&&(s=!0),i+="."+d,a="%"+i+"%",ja(Rr,a))u=Rr[a];else if(u!=null){if(!(d in u)){if(!r)throw new xn("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ir&&l+1>=n.length){var y=Ir(u,d);f=!!y,f&&"get"in y&&!("originalValue"in y.get)?u=y.get:u=u[d]}else f=ja(u,d),u=u[d];f&&!s&&(Rr[a]=u)}}return u},yb={exports:{}};(function(e){var t=id,r=Uo,n=r("%Function.prototype.apply%"),i=r("%Function.prototype.call%"),o=r("%Reflect.apply%",!0)||t.call(i,n),a=r("%Object.getOwnPropertyDescriptor%",!0),u=r("%Object.defineProperty%",!0),s=r("%Math.max%");if(u)try{u({},"a",{value:1})}catch{u=null}e.exports=function(f){var d=o(t,i,arguments);if(a&&u){var p=a(d,"length");p.configurable&&u(d,"length",{value:1+s(0,f.length-(arguments.length-1))})}return d};var c=function(){return o(t,n,arguments)};u?u(e.exports,"apply",{value:c}):e.exports.apply=c})(yb);var od=yb.exports,mb=Uo,bb=od,nB=bb(mb("String.prototype.indexOf")),gb=function(t,r){var n=mb(t,!!r);return typeof n=="function"&&nB(t,".prototype.")>-1?bb(n):n},iB=nd(),oB=gb,Ul=oB("Object.prototype.toString"),fc=function(t){return iB&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Ul(t)==="[object Arguments]"},_b=function(t){return fc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ul(t)!=="[object Array]"&&Ul(t.callee)==="[object Function]"},aB=function(){return fc(arguments)}();fc.isLegacyArguments=_b;var uB=aB?fc:_b,sB=Uo,Wl=sB("%Object.defineProperty%",!0),ql=function(){if(Wl)try{return Wl({},"a",{value:1}),!0}catch{return!1}return!1};ql.hasArrayLengthDefineBug=function(){if(!ql())return null;try{return Wl([],"length",{value:1}).length!==1}catch{return!0}};var ad=ql,Zc,Uv;function cB(){if(Uv)return Zc;Uv=1;var e=Uo,t=e("%Object.getOwnPropertyDescriptor%",!0);if(t)try{t([],"length")}catch{t=null}return Zc=t,Zc}var lB=ad(),ud=Uo,Wv=lB&&ud("%Object.defineProperty%",!0),fB=ud("%SyntaxError%"),hn=ud("%TypeError%"),qv=cB(),wb=function(t,r,n){if(!t||typeof t!="object"&&typeof t!="function")throw new hn("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new hn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new hn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new hn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new hn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new hn("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,s=!!qv&&qv(t,r);if(Wv)Wv(t,r,{configurable:a===null&&s?s.configurable:!a,enumerable:i===null&&s?s.enumerable:!i,value:n,writable:o===null&&s?s.writable:!o});else if(u||!i&&!o&&!a)t[r]=n;else throw new fB("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},dB=hb,hB=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",vB=Object.prototype.toString,pB=Array.prototype.concat,Kv=wb,yB=function(e){return typeof e=="function"&&vB.call(e)==="[object Function]"},Ob=ad(),mB=function(e,t,r,n){if(t in e){if(n===!0){if(e[t]===r)return}else if(!yB(n)||!n())return}Ob?Kv(e,t,r,!0):Kv(e,t,r)},Sb=function(e,t){var r=arguments.length>2?arguments[2]:{},n=dB(t);hB&&(n=pB.call(n,Object.getOwnPropertySymbols(t)));for(var i=0;i<n.length;i+=1)mB(e,n[i],t[n[i]],r[n[i]])};Sb.supportsDescriptors=!!Ob;var Wo=Sb,Hv=function(e){return e!==e},Eb=function(t,r){return t===0&&r===0?1/t===1/r:!!(t===r||Hv(t)&&Hv(r))},bB=Eb,Pb=function(){return typeof Object.is=="function"?Object.is:bB},gB=Pb,_B=Wo,wB=function(){var t=gB();return _B(Object,{is:t},{is:function(){return Object.is!==t}}),t},OB=Wo,SB=od,EB=Eb,$b=Pb,PB=wB,Ab=SB($b(),Object);OB(Ab,{getPolyfill:$b,implementation:EB,shim:PB});var $B=Ab,Kl=gb,xb=nd(),Cb,Ib,Hl,Vl;if(xb){Cb=Kl("Object.prototype.hasOwnProperty"),Ib=Kl("RegExp.prototype.exec"),Hl={};var el=function(){throw Hl};Vl={toString:el,valueOf:el},typeof Symbol.toPrimitive=="symbol"&&(Vl[Symbol.toPrimitive]=el)}var AB=Kl("Object.prototype.toString"),xB=Object.getOwnPropertyDescriptor,CB="[object RegExp]",IB=xb?function(t){if(!t||typeof t!="object")return!1;var r=xB(t,"lastIndex"),n=r&&Cb(r,"value");if(!n)return!1;try{Ib(t,Vl)}catch(i){return i===Hl}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:AB(t)===CB},Fi=function(){return typeof function(){}.name=="string"},Ei=Object.getOwnPropertyDescriptor;if(Ei)try{Ei([],"length")}catch{Ei=null}Fi.functionsHaveConfigurableNames=function(){if(!Fi()||!Ei)return!1;var t=Ei(function(){},"name");return!!t&&!!t.configurable};var RB=Function.prototype.bind;Fi.boundFunctionsHaveNames=function(){return Fi()&&typeof RB=="function"&&function(){}.bind().name!==""};var kB=Fi,Vv=wb,jB=ad(),MB=kB.functionsHaveConfigurableNames(),DB=TypeError,TB=function(t,r){if(typeof t!="function")throw new DB("`fn` is not a function");var n=arguments.length>2&&!!arguments[2];return(!n||MB)&&(jB?Vv(t,"name",r,!0,!0):Vv(t,"name",r)),t},FB=TB,LB=Object,BB=TypeError,Rb=FB(function(){if(this!=null&&this!==LB(this))throw new BB("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),NB=Rb,UB=Wo.supportsDescriptors,WB=Object.getOwnPropertyDescriptor,kb=function(){if(UB&&/a/mig.flags==="gim"){var t=WB(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var r="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(n,"sticky",{get:function(){r+="y"}}),r==="dy")return t.get}}return NB},qB=Wo.supportsDescriptors,KB=kb,HB=Object.getOwnPropertyDescriptor,VB=Object.defineProperty,zB=TypeError,zv=Object.getPrototypeOf,QB=/a/,GB=function(){if(!qB||!zv)throw new zB("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=KB(),r=zv(QB),n=HB(r,"flags");return(!n||n.get!==t)&&VB(r,"flags",{configurable:!0,enumerable:!1,get:t}),t},YB=Wo,JB=od,XB=Rb,jb=kb,ZB=GB,Mb=JB(jb());YB(Mb,{getPolyfill:jb,implementation:XB,shim:ZB});var eN=Mb,tN=Date.prototype.getDay,rN=function(t){try{return tN.call(t),!0}catch{return!1}},nN=Object.prototype.toString,iN="[object Date]",oN=nd(),aN=function(t){return typeof t!="object"||t===null?!1:oN?rN(t):nN.call(t)===iN},Qv=hb,Gv=uB,Yv=$B,Jv=IB,Xv=eN,Zv=aN,ep=Date.prototype.getTime;function Db(e,t,r){var n=r||{};return(n.strict?Yv(e,t):e===t)?!0:!e||!t||typeof e!="object"&&typeof t!="object"?n.strict?Yv(e,t):e==t:uN(e,t,n)}function tp(e){return e==null}function rp(e){return!(!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number")}function uN(e,t,r){var n,i;if(typeof e!=typeof t||tp(e)||tp(t)||e.prototype!==t.prototype||Gv(e)!==Gv(t))return!1;var o=Jv(e),a=Jv(t);if(o!==a)return!1;if(o||a)return e.source===t.source&&Xv(e)===Xv(t);if(Zv(e)&&Zv(t))return ep.call(e)===ep.call(t);var u=rp(e),s=rp(t);if(u!==s)return!1;if(u||s){if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}if(typeof e!=typeof t)return!1;try{var c=Qv(e),l=Qv(t)}catch{return!1}if(c.length!==l.length)return!1;for(c.sort(),l.sort(),n=c.length-1;n>=0;n--)if(c[n]!=l[n])return!1;for(n=c.length-1;n>=0;n--)if(i=c[n],!Db(e[i],t[i],r))return!1;return!0}var sN=Db;function Tb(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var np=Tb(CL),ip=Tb(sN),wn=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},cN=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lN=function(e){return(typeof e>"u"?"undefined":wn(e))==="object"&&e!==null},fN=function(e,t){return e.every(function(r){return t&&t(r)||r})},dN=function(e,t){return e.hasOwnProperty(t)},hN=function(e){return Object.keys(e)},Fb=function(e,t){Object.keys(e).forEach(function(r){t(e[r],r)})},vN=function(e){return Array.isArray(e)},Lb=function(e){return!!(typeof Uint8Array<"u"&&e instanceof Uint8Array||e&&e.$Uint8ArrayPolyfill)},Bb={isArray:vN,each:Fb},Nb=function(t){return Bb.isArray(t)&&!Lb(t)},pN=function(t){return Nb(t)||sd(t)},yN=function(t,r){if(!sd(t))return!1;var n=void 0;return Bb.each(t,function(i,o){var a=o.substr(0,1)==="$";if(n===void 0)n=a;else if(n!==a){if(!r)throw new Error("Inconsistent operator: "+JSON.stringify(t));n=!1}}),!!n},mN=function(t){return/^[0-9]+$/.test(t)},sd=function(e){return!(!e||typeof e=="number"||typeof e=="string"||typeof e=="boolean"||Nb(e)||e===null||e instanceof RegExp||typeof e=="function"||e instanceof Date||Lb(e))},q=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&t.field&&(e+=" for field '"+t.field+"'");var r=new Error(e);return r.name="ModifyJsError",r},Ht={all:fN,each:Fb,keys:hN,has:dN,isObject:lN},bN=function(e,t,r){if(!(r&&r.each))return gN(e,t,cN({},r,{returnInsteadOfReplacing:!0}))},gN=function(t,r,n){if(n=n||{},!sd(r))throw q("Modifier must be an object");r=np(r);var i=yN(r),o;if(i?(o=np(t),Ht.each(r,function(a,u){var s=wN[u];if(!s)throw q("Invalid modifier specified "+u);Ht.each(a,function(c,l){if(l==="")throw q("An empty update path is not valid.");var f=l.split(".");if(!Ht.all(f))throw q("The update path '"+l+"' contains an empty field name, which is not allowed.");var d=Ub(o,f,{noCreate:_N[u],forbidArray:u==="$rename",arrayIndices:n.arrayIndices}),p=f.pop();s(d,p,c,l,o)})})):o=r,n.returnInsteadOfReplacing)return o;Ht.each(Ht.keys(t),function(a){a!=="_id"&&delete t[a]}),Ht.each(o,function(a,u){t[u]=a})},Ub=function(t,r,n){n=n||{};for(var i=!1,o=0;o<r.length;o++){var a=o===r.length-1,u=r[o],s=pN(t);if(!s){if(n.noCreate)return;var c=q("cannot use the part '"+u+"' to traverse "+t);throw c.setPropertyError=!0,c}if(t instanceof Array){if(n.forbidArray)return null;if(u==="$"){if(i)throw q("Too many positional (i.e. '$') elements");if(!n.arrayIndices||!n.arrayIndices.length)throw q("The positional operator did not find the match needed from the query");u=n.arrayIndices[0],i=!0}else if(mN(u))u=parseInt(u);else{if(n.noCreate)return;throw q("can't append to array using string field name ["+u+"]")}if(a&&(r[o]=u),n.noCreate&&u>=t.length)return;for(;t.length<u;)t.push(null);if(!a){if(t.length===u)t.push({});else if(wn(t[u])!=="object")throw q("can't modify field '"+r[o+1]+"' of list value "+JSON.stringify(t[u]))}}else if(!(u in t)){if(n.noCreate)return;a||(t[u]={})}if(a)return t;t=t[u]}},_N={$unset:!0,$pop:!0,$rename:!0,$pull:!0,$pullAll:!0},wN={$currentDate:function(t,r,n){if((typeof n>"u"?"undefined":wn(n))==="object"&&n.hasOwnProperty("$type")){if(n.$type!=="date")throw q("Minimongo does currently only support the date type in $currentDate modifiers",{field:r})}else if(n!==!0)throw q("Invalid $currentDate modifier",{field:r});t[r]=new Date},$min:function(t,r,n){if(typeof n!="number")throw q("Modifier $min allowed for numbers only",{field:r});if(r in t){if(typeof t[r]!="number")throw q("Cannot apply $min modifier to non-number",{field:r});t[r]>n&&(t[r]=n)}else t[r]=n},$max:function(t,r,n){if(typeof n!="number")throw q("Modifier $max allowed for numbers only",{field:r});if(r in t){if(typeof t[r]!="number")throw q("Cannot apply $max modifier to non-number",{field:r});t[r]<n&&(t[r]=n)}else t[r]=n},$inc:function(t,r,n){if(typeof n!="number")throw q("Modifier $inc allowed for numbers only",{field:r});if(r in t){if(typeof t[r]!="number")throw q("Cannot apply $inc modifier to non-number",{field:r});t[r]+=n}else t[r]=n},$set:function(t,r,n){if(!Ht.isObject(t)){var i=q("Cannot set property on non-object field",{field:r});throw i.setPropertyError=!0,i}if(t===null){var i=q("Cannot set property on null",{field:r});throw i.setPropertyError=!0,i}t[r]=n},$setOnInsert:function(t,r,n){},$unset:function(t,r,n){t!==void 0&&(t instanceof Array?r in t&&(t[r]=null):delete t[r])},$push:function(t,r,n){if(t[r]===void 0&&(t[r]=[]),!(t[r]instanceof Array))throw q("Cannot apply $push modifier to non-array",{field:r});if(!(n&&n.$each)){t[r].push(n);return}var i=n.$each;if(!(i instanceof Array))throw q("$each must be an array",{field:r});var o=void 0;if("$position"in n){if(typeof n.$position!="number")throw q("$position must be a numeric value",{field:r});if(n.$position<0)throw q("$position in $push must be zero or positive",{field:r});o=n.$position}var a=void 0;if("$slice"in n){if(typeof n.$slice!="number")throw q("$slice must be a numeric value",{field:r});if(n.$slice>0)throw q("$slice in $push must be zero or negative",{field:r});a=n.$slice}if(n.$sort)throw q("$sort in $push not implemented yet");if(o===void 0)for(var u=0;u<i.length;u++)t[r].push(i[u]);else{for(var s=[o,0],u=0;u<i.length;u++)s.push(i[u]);Array.prototype.splice.apply(t[r],s)}a!==void 0&&(a===0?t[r]=[]:t[r]=t[r].slice(a))},$pushAll:function(t,r,n){if(!((typeof n>"u"?"undefined":wn(n))==="object"&&n instanceof Array))throw q("Modifier $pushAll/pullAll allowed for arrays only");var i=t[r];if(i===void 0)t[r]=n;else if(i instanceof Array)for(var o=0;o<n.length;o++)i.push(n[o]);else throw q("Cannot apply $pushAll modifier to non-array",{field:r})},$addToSet:function(t,r,n){var i=!1;if((typeof n>"u"?"undefined":wn(n))==="object"){var o=Object.keys(n);o[0]==="$each"&&(i=!0)}var a=i?n.$each:[n],u=t[r];if(u===void 0)t[r]=a;else if(u instanceof Array)Ht.each(a,function(s){for(var c=0;c<u.length;c++)if(ip(s,u[c]))return;u.push(s)});else throw q("Cannot apply $addToSet modifier to non-array",{field:r})},$pop:function(t,r,n){if(t!==void 0){var i=t[r];if(i!==void 0)if(i instanceof Array)typeof n=="number"&&n<0?i.splice(0,1):i.pop();else throw q("Cannot apply $pop modifier to non-array",{field:r})}},$pull:function(t,r,n){if(t!==void 0){var i=t[r];if(i!==void 0)throw i instanceof Array?q("$pull not implemented yet"):q("Cannot apply $pull/pullAll modifier to non-array",{field:r})}},$pullAll:function(t,r,n){if(!((typeof n>"u"?"undefined":wn(n))==="object"&&n instanceof Array))throw q("Modifier $pushAll/pullAll allowed for arrays only",{field:r});if(t!==void 0){var i=t[r];if(i!==void 0)if(i instanceof Array){for(var o=[],a=0;a<i.length;a++){for(var u=!1,s=0;s<n.length;s++)if(ip(i[a],n[s])){u=!0;break}u||o.push(i[a])}t[r]=o}else throw q("Cannot apply $pull/pullAll modifier to non-array",{field:r})}},$rename:function(t,r,n,i,o){if(i===n)throw q("$rename source must differ from target",{field:r});if(t===null)throw q("$rename source field invalid",{field:r});if(typeof n!="string")throw q("$rename target must be a string",{field:r});if(n.indexOf("\x00")>-1)throw q("The 'to' field for $rename cannot contain an embedded null byte",{field:r});if(t!==void 0){var a=t[r];delete t[r];var u=n.split("."),s=Ub(o,u,{forbidArray:!0});if(s===null)throw q("$rename target field invalid",{field:r});var c=u.pop();s[c]=a}},$bit:function(t,r,n){throw q("$bit is not supported",{field:r})}},ON=bN;const Wb=wf(ON);function SN(e){return this.incrementalModify(t=>{var r=Wb(t,e);return r})}function EN(e){var t=this._data,r=Wb(t,e);return this._saveData(r,t)}function PN(e){return this.exec().then(t=>t?Array.isArray(t)?Promise.all(t.map(r=>r.update(e))).then(()=>t):t.update(e).then(()=>t):null)}var $N={name:"update",rxdb:!0,prototypes:{RxDocument:e=>{e.update=EN,e.incrementalUpdate=SN},RxQuery:e=>{e.update=PN}}},op={UT1:"given name is no string or empty",UT2:`collection- and database-names must match the regex to be compatible with couchdb databases.
|
|
18
|
-
See https://neighbourhood.ie/blog/2020/10/13/everything-you-need-to-know-about-couchdb-database-names/
|
|
19
|
-
info: if your database-name specifies a folder, the name must contain the slash-char '/' or '\\'`,UT3:"replication-direction must either be push or pull or both. But not none",UT4:"given leveldown is no valid adapter",UT5:"keyCompression is set to true in the schema but no key-compression handler is used in the storage",UT6:"schema contains encrypted fields but no encryption handler is used in the storage",UT7:"attachments.compression is enabled but no attachment-compression plugin is used",PL1:"Given plugin is not RxDB plugin.",PL3:"A plugin with the same name was already added but it was not the exact same JavaScript object",P2:"bulkWrite() cannot be called with an empty array",QU1:"RxQuery._execOverDatabase(): op not known",QU4:"RxQuery.regex(): You cannot use .regex() on the primary field",QU5:"RxQuery.sort(): does not work because key is not defined in the schema",QU6:"RxQuery.limit(): cannot be called on .findOne()",QU9:"throwIfMissing can only be used in findOne queries",QU10:"result empty and throwIfMissing: true",QU11:"RxQuery: no valid query params given",QU12:"Given index is not in schema",QU13:"A top level field of the query is not included in the schema",QU14:"Running a count() query in slow mode is now allowed. Either run a count() query with a selector that fully matches an index or set allowSlowCount=true when calling the createRxDatabase",QU15:"For count queries it is not allowed to use skip or limit",QU16:"$regex queries must be defined by a string, not an RegExp instance. This is because RegExp objects cannot be JSON stringified and also they are mutable which would be dangerous",MQ1:"path must be a string or object",MQ2:"Invalid argument",MQ3:"Invalid sort() argument. Must be a string, object, or array",MQ4:"Invalid argument. Expected instanceof mquery or plain object",MQ5:"method must be used after where() when called with these arguments",MQ6:"Can't mix sort syntaxes. Use either array or object | .sort([['field', 1], ['test', -1]]) | .sort({ field: 1, test: -1 })",MQ7:"Invalid sort value",MQ8:"Can't mix sort syntaxes. Use either array or object",DB1:"RxDocument.prepare(): another instance on this adapter has a different password",DB2:"RxDatabase.addCollections(): collection-names cannot start with underscore _",DB3:"RxDatabase.addCollections(): collection already exists. use myDatabase.[collectionName] to get it",DB4:"RxDatabase.addCollections(): schema is missing",DB5:"RxDatabase.addCollections(): collection-name not allowed",DB6:"RxDatabase.addCollections(): another instance created this collection with a different schema. Read this https://pubkey.github.io/rxdb/questions-answers.html#cant-change-the-schema",DB8:`RxDatabase.create(): A RxDatabase with the same name and adapter already exists.
|
|
20
|
-
Make sure to use this combination only once or set ignoreDuplicate to true if you do this intentional`,DB11:"createRxDatabase(): Invalid db-name, folder-paths must not have an ending slash",DB12:"RxDatabase.addCollections(): could not write to internal store",DB13:"createRxDatabase(): Invalid db-name or collection name, name contains the dollar sign",COL1:"RxDocument.insert() You cannot insert an existing document",COL2:"RxCollection.insert() fieldName ._id can only be used as primaryKey",COL3:"RxCollection.upsert() does not work without primary",COL4:"RxCollection.incrementalUpsert() does not work without primary",COL5:"RxCollection.find() if you want to search by _id, use .findOne(_id)",COL6:"RxCollection.findOne() needs a queryObject or string",COL7:"hook must be a function",COL8:"hooks-when not known",COL9:"RxCollection.addHook() hook-name not known",COL10:"RxCollection .postCreate-hooks cannot be async",COL11:"migrationStrategies must be an object",COL12:"A migrationStrategy is missing or too much",COL13:"migrationStrategy must be a function",COL14:"given static method-name is not a string",COL15:"static method-names cannot start with underscore _",COL16:"given static method is not a function",COL17:"RxCollection.ORM: statics-name not allowed",COL18:"collection-method not allowed because fieldname is in the schema",COL20:"Storage write error",CONFLICT:"Document update conflict. When changing a document you must work on the previous revision",DOC1:"RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed",DOC2:"cannot observe primary path",DOC3:"final fields cannot be observed",DOC4:"RxDocument.get$ cannot observe a non-existed field",DOC5:"RxDocument.populate() cannot populate a non-existed field",DOC6:"RxDocument.populate() cannot populate because path has no ref",DOC7:"RxDocument.populate() ref-collection not in database",DOC8:"RxDocument.set(): primary-key cannot be modified",DOC9:"final fields cannot be modified",DOC10:"RxDocument.set(): cannot set childpath when rootPath not selected",DOC11:"RxDocument.save(): can't save deleted document",DOC13:"RxDocument.remove(): Document is already deleted",DOC14:"RxDocument.destroy() does not exist",DOC15:"query cannot be an array",DOC16:"Since version 8.0.0 RxDocument.set() can only be called on temporary RxDocuments",DOC17:"Since version 8.0.0 RxDocument.save() can only be called on non-temporary documents",DOC18:"Document property for composed primary key is missing",DOC19:"Value of primary key(s) cannot be changed",DOC20:"PrimaryKey missing",DOC21:"PrimaryKey must be equal to PrimaryKey.trim(). It cannot start or end with a whitespace",DOC22:"PrimaryKey must not contain a linebreak",DOC23:'PrimaryKey must not contain a double-quote ["]',DOC24:"Given document data could not be structured cloned. This happens if you pass non-plain-json data into it, like a Date() or a Function. In vue.js this happens if you use ref() on the document data which transforms it into a Proxy object.",DM1:"migrate() Migration has already run",DM2:"migration of document failed final document does not match final schema",DM3:"migration already running",DM4:"Migration errored",DM5:"Cannot open database state with newer RxDB version. You have to migrate your database state first. See see https://rxdb.info/migration-storage.html",AT1:"to use attachments, please define this in your schema",EN1:"password is not valid",EN2:"validatePassword: min-length of password not complied",EN3:"Schema contains encrypted properties but no password is given",EN4:"Password not valid",JD1:"You must create the collections before you can import their data",JD2:"RxCollection.importJSON(): the imported json relies on a different schema",JD3:"RxCollection.importJSON(): json.passwordHash does not match the own",LD1:"RxDocument.allAttachments$ can't use attachments on local documents",LD2:"RxDocument.get(): objPath must be a string",LD3:"RxDocument.get$ cannot get observable of in-array fields because order cannot be guessed",LD4:"cannot observe primary path",LD5:"RxDocument.set() id cannot be modified",LD6:"LocalDocument: Function is not usable on local documents",LD7:"Local document already exists",LD8:"localDocuments not activated. Set localDocuments=true on creation, when you want to store local documents on the RxDatabase or RxCollection.",RC1:"Replication: already added",RC2:"replicateCouchDB() query must be from the same RxCollection",RC4:"RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication when live: true",RC5:"RxCouchDBReplicationState.awaitInitialReplication() cannot await initial replication if multiInstance because the replication might run on another instance",RC6:"syncFirestore() serverTimestampField MUST NOT be part of the collections schema and MUST NOT be nested.",RC_PULL:"RxReplication pull handler threw an error - see .errors for more details",RC_STREAM:"RxReplication pull stream$ threw an error - see .errors for more details",RC_PUSH:"RxReplication push handler threw an error - see .errors for more details",RC_PUSH_NO_AR:"RxReplication push handler did not return an array with the conflicts",RC_WEBRTC_PEER:"RxReplication WebRTC Peer has error",RC_COUCHDB_1:"replicateCouchDB() url must end with a slash like 'https://example.com/mydatabase/'",RC_COUCHDB_2:"replicateCouchDB() did not get valid result with rows.",SC1:"fieldnames do not match the regex",SC2:"SchemaCheck: name 'item' reserved for array-fields",SC3:"SchemaCheck: fieldname has a ref-array but items-type is not string",SC4:"SchemaCheck: fieldname has a ref but is not type string, [string,null] or array<string>",SC6:"SchemaCheck: primary can only be defined at top-level",SC7:"SchemaCheck: default-values can only be defined at top-level",SC8:"SchemaCheck: first level-fields cannot start with underscore _",SC10:"SchemaCheck: schema defines ._rev, this will be done automatically",SC11:"SchemaCheck: schema needs a number >=0 as version",SC13:"SchemaCheck: primary is always index, do not declare it as index",SC14:"SchemaCheck: primary is always unique, do not declare it as index",SC15:"SchemaCheck: primary cannot be encrypted",SC16:"SchemaCheck: primary must have type: string",SC17:"SchemaCheck: top-level fieldname is not allowed",SC18:"SchemaCheck: indexes must be an array",SC19:"SchemaCheck: indexes must contain strings or arrays of strings",SC20:"SchemaCheck: indexes.array must contain strings",SC21:"SchemaCheck: given index is not defined in schema",SC22:"SchemaCheck: given indexKey is not type:string",SC23:"SchemaCheck: fieldname is not allowed",SC24:"SchemaCheck: required fields must be set via array. See https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required",SC25:"SchemaCheck: compoundIndexes needs to be specified in the indexes field",SC26:"SchemaCheck: indexes needs to be specified at collection schema level",SC27:"SchemaCheck: encrypted fields need to be specified at collection schema level",SC28:"SchemaCheck: encrypted fields is not defined in the schema",SC29:"SchemaCheck: missing object key 'properties'",SC30:"SchemaCheck: primaryKey is required",SC32:"SchemaCheck: primary field must have the type string/number/integer",SC33:"SchemaCheck: used primary key is not a property in the schema",SC34:"Fields of type string that are used in an index, must have set the maxLength attribute in the schema",SC35:"Fields of type number/integer that are used in an index, must have set the multipleOf attribute in the schema",SC36:"A field of this type cannot be used as index",SC37:"Fields of type number that are used in an index, must have set the minimum and maximum attribute in the schema",SC38:"Fields of type boolean that are used in an index, must be required in the schema",SC39:"The primary key must have the maxLength attribute set",SC40:"$ref fields in the schema are not allowed. RxDB cannot resolve related schemas because it would have a negative performance impact.It would have to run http requests on runtime. $ref fields should be resolved during build time.",VD1:"Sub-schema not found, does the schemaPath exists in your schema?",VD2:"object does not match schema",S1:"You cannot create collections after calling RxDatabase.server()",GQL1:"GraphQL replication: cannot find sub schema by key",GQL3:"GraphQL replication: pull returns more documents then batchSize",CRDT1:"CRDT operations cannot be used because the crdt options are not set in the schema.",CRDT2:"RxDocument.incrementalModify() cannot be used when CRDTs are activated.",CRDT3:"To use CRDTs you MUST NOT set a conflictHandler because the default CRDT conflict handler must be used",DXE1:"The dexie.js RxStorage does not support boolean indexes, see https://rxdb.info/rx-storage-dexie.html#boolean-index",SNH:"This should never happen"},tl;function AN(){if(!tl){var e=new Jf,t=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(Object.getPrototypeOf(e));tl=[...t,...r]}return tl}var rl;function xN(){if(!rl){var e=new Zf("pseudoInstance","memory"),t=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(Object.getPrototypeOf(e));rl=[...t,...r],e.destroy()}return rl}var CN=pm(Mo),IN=new CN,nl;function qb(){if(!nl){var e=["deleted","synced"],t=Object.getOwnPropertyNames(IN),r=Object.getOwnPropertyNames(Mo);nl=[...t,...r,...e]}return nl}function RN(e){if(e!=="_deleted"){if(["properties"].includes(e))throw I("SC23",{fieldName:e});var t="^[a-zA-Z](?:[[a-zA-Z0-9_]*]?[a-zA-Z0-9])?$",r=new RegExp(t);if(e!=="_id"&&!e.match(r))throw I("SC1",{regex:t,fieldName:e})}}function kN(e){var t=ot(e.primaryKey);function r(i,o,a){if(typeof i=="string"&&typeof o=="object"&&!Array.isArray(o)&&a.split(".").pop()!=="patternProperties"&&RN(i),o.hasOwnProperty("item")&&o.type!=="array")throw I("SC2",{fieldName:i});if(o.hasOwnProperty("required")&&typeof o.required=="boolean")throw I("SC24",{fieldName:i});if(o.hasOwnProperty("$ref"))throw I("SC40",{fieldName:i});if(o.hasOwnProperty("ref"))if(Array.isArray(o.type)){if(o.type.length>2||!o.type.includes("string")||!o.type.includes("null"))throw I("SC4",{fieldName:i})}else switch(o.type){case"string":break;case"array":if(!o.items||!o.items.type||o.items.type!=="string")throw I("SC3",{fieldName:i});break;default:throw I("SC4",{fieldName:i})}var u=a.split(".").length>=2;if(u){if(o.primary)throw I("SC6",{path:a,primary:o.primary});if(o.default)throw I("SC7",{path:a})}if(!u){if(i==="_id"&&t!=="_id")throw I("COL2",{fieldName:i});if(i.charAt(0)==="_"){if(i==="_id"||i==="_deleted")return;throw I("SC8",{fieldName:i})}}}function n(i,o){!i||typeof i!="object"||Object.keys(i).forEach(a=>{var u=i[a];!i.properties&&u&&typeof u=="object"&&!Array.isArray(i)&&r(a,u,o);var s=o;a!=="properties"&&(s=s+"."+a),n(u,s)})}return n(e,""),!0}function jN(e){if(!e.primaryKey)throw I("SC30",{schema:e});function t(s){if(!s)throw I("SC33",{schema:e});var c=s.type;if(!c||!["string","number","integer"].includes(c))throw I("SC32",{schema:e,args:{schemaPart:s}})}if(typeof e.primaryKey=="string"){var r=e.primaryKey,n=e.properties[r];t(n)}else{var i=e.primaryKey,o=tr(e,i.key);t(o),i.fields.forEach(s=>{var c=tr(e,s);t(c)})}var a=ot(e.primaryKey),u=e.properties[a];if(!u.maxLength)throw I("SC39",{schema:e,args:{primaryPathSchemaPart:u}})}function ap(e){for(var t=e.split("."),r="",n=0;n<t.length;n+=1)t[n]!=="[]"?r=r.concat(".properties.".concat(t[n])):r=r.concat(".items");return $r(r)}function MN(e){if(!e.primaryKey)throw I("SC30",{schema:e});if(!e.hasOwnProperty("properties"))throw I("SC29",{schema:e});if(e.properties._rev)throw I("SC10",{schema:e});if(!e.hasOwnProperty("version")||typeof e.version!="number"||e.version<0)throw I("SC11",{version:e.version});if(kN(e),jN(e),Object.keys(e.properties).forEach(t=>{var r=e.properties[t];if(t===e.primaryKey){if(e.indexes&&e.indexes.includes(t))throw I("SC13",{value:r,schema:e});if(r.unique)throw I("SC14",{value:r,schema:e});if(e.encrypted&&e.encrypted.includes(t))throw I("SC15",{value:r,schema:e});if(r.type!=="string")throw I("SC16",{value:r,schema:e})}if(qb().includes(t))throw I("SC17",{key:t,schema:e})}),e.indexes){if(!En(e.indexes))throw I("SC18",{indexes:e.indexes,schema:e});e.indexes.forEach(t=>{if(!(typeof t=="string"||Array.isArray(t)))throw I("SC19",{index:t,schema:e});if(Array.isArray(t)){for(var r=0;r<t.length;r+=1)if(typeof t[r]!="string")throw I("SC20",{index:t,schema:e})}var n=En(t)?t:[t];n.forEach(i=>{var o=tr(e,i),a=o.type;switch(a){case"string":var u=o.maxLength;if(!u)throw I("SC34",{index:t,field:i,schema:e});break;case"number":case"integer":var s=o.multipleOf;if(!s)throw I("SC35",{index:t,field:i,schema:e});var c=o.maximum,l=o.minimum;if(typeof c>"u"||typeof l>"u")throw I("SC37",{index:t,field:i,schema:e});break;case"boolean":var f="",d=i;if(i.includes(".")){var p=i.split(".");d=p.pop(),f=p.join(".")}var m=f===""?e:tr(e,f);if(!m.required||!m.required.includes(d))throw I("SC38",{index:t,field:i,schema:e});break;default:throw I("SC36",{fieldName:i,type:o.type,schema:e})}})})}Object.keys(pl(e)).map(t=>{var r=t.split(".");return r.pop(),r.join(".")}).filter(t=>t!=="").filter((t,r,n)=>n.indexOf(t)===r).filter(t=>{var r=Gt(e,t);return r&&!!r.index}).forEach(t=>{throw t=t.replace("properties.",""),t=t.replace(/\.properties\./g,"."),I("SC26",{index:$r(t),schema:e})}),(e.indexes||[]).reduce((t,r)=>(En(r)?Mn(t,r):t.push(r),t),[]).filter((t,r,n)=>n.indexOf(t)===r).map(t=>{var r=ap(t),n=Gt(e,r);if(!n||typeof n!="object")throw I("SC21",{index:t,schema:e});return{indexPath:t,schemaObj:n}}).filter(t=>t.schemaObj.type!=="string"&&t.schemaObj.type!=="integer"&&t.schemaObj.type!=="number"&&t.schemaObj.type!=="boolean").forEach(t=>{throw I("SC22",{key:t.indexPath,type:t.schemaObj.type,schema:e})}),Object.keys(pl(e)).map(t=>{var r=t.split(".");return r.pop(),r.join(".")}).filter(t=>t!==""&&t!=="attachments").filter((t,r,n)=>n.indexOf(t)===r).filter(t=>{var r=Gt(e,t);return r&&!!r.encrypted}).forEach(t=>{throw t=t.replace("properties.",""),t=t.replace(/\.properties\./g,"."),I("SC27",{index:$r(t),schema:e})}),e.encrypted&&e.encrypted.forEach(t=>{var r=ap(t),n=Gt(e,r);if(!n||typeof n!="object")throw I("SC28",{field:t,schema:e})})}function il(e){e&&Object.entries(e).forEach(([t,r])=>{if(typeof t!="string")throw ve("COL14",{name:t});if(t.startsWith("_"))throw ve("COL15",{name:t});if(typeof r!="function")throw ve("COL16",{name:t,type:typeof t});if(AN().includes(t)||qb().includes(t))throw I("COL17",{name:t})})}function DN(e,t){var r=Object.keys(e.properties);t&&Object.keys(t).filter(n=>r.includes(n)).forEach(n=>{throw I("COL18",{funName:n})})}function TN(e,t){if(typeof t!="object"||Array.isArray(t))throw ve("COL11",{schema:e});var r=Uw(e);if(r.length!==Object.keys(t).length)throw I("COL12",{have:Object.keys(t),should:r});return r.map(n=>({v:n,s:t[n+1]})).filter(n=>typeof n.s!="function").forEach(n=>{throw ve("COL13",{version:n.v,type:typeof n,schema:e})}),!0}function FN(e){if(xN().includes(e.name))throw I("DB5",{name:e.name});Hb(e.name)}function LN(e){if(Hb(e.name),e.name.includes("$"))throw I("DB13",{name:e.name});if(Vp(e.name)&&(e.name.endsWith("/")||e.name.endsWith("\\")))throw I("DB11",{name:e.name})}var Kb="^[a-z][_$a-z0-9\\-]*$",BN=new RegExp(Kb);function Hb(e){if(typeof e!="string"||e.length===0)throw ve("UT1",{name:e});if(Vp(e))return!0;if(!e.match(BN)&&e!==":memory:")throw I("UT2",{regex:Kb,givenName:e});return!0}const ue=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ye=Object.keys,Me=Array.isArray;function Le(e,t){return typeof t!="object"||ye(t).forEach(function(r){e[r]=t[r]}),e}typeof Promise>"u"||ue.Promise||(ue.Promise=Promise);const Hn=Object.getPrototypeOf,NN={}.hasOwnProperty;function Je(e,t){return NN.call(e,t)}function Vn(e,t){typeof t=="function"&&(t=t(Hn(e))),(typeof Reflect>"u"?ye:Reflect.ownKeys)(t).forEach(r=>{kt(e,r,t[r])})}const Vb=Object.defineProperty;function kt(e,t,r,n){Vb(e,t,Le(r&&Je(r,"get")&&typeof r.get=="function"?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function Cn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),kt(e.prototype,"constructor",e),{extend:Vn.bind(null,e.prototype)}}}}const UN=Object.getOwnPropertyDescriptor;function cd(e,t){let r;return UN(e,t)||(r=Hn(e))&&cd(r,t)}const WN=[].slice;function Da(e,t,r){return WN.call(e,t,r)}function zb(e,t){return t(e)}function bi(e){if(!e)throw new Error("Assertion Failed")}function Qb(e){ue.setImmediate?setImmediate(e):setTimeout(e,0)}function Gb(e,t){return e.reduce((r,n,i)=>{var o=t(n,i);return o&&(r[o[0]]=o[1]),r},{})}function jt(e,t){if(Je(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var r=[],n=0,i=t.length;n<i;++n){var o=jt(e,t[n]);r.push(o)}return r}var a=t.indexOf(".");if(a!==-1){var u=e[t.substr(0,a)];return u===void 0?void 0:jt(u,t.substr(a+1))}}function Ze(e,t,r){if(e&&t!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){bi(typeof r!="string"&&"length"in r);for(var n=0,i=t.length;n<i;++n)Ze(e,t[n],r[n])}else{var o=t.indexOf(".");if(o!==-1){var a=t.substr(0,o),u=t.substr(o+1);if(u==="")r===void 0?Me(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=r;else{var s=e[a];s&&Je(e,a)||(s=e[a]={}),Ze(s,u,r)}}else r===void 0?Me(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=r}}function Yb(e){var t={};for(var r in e)Je(e,r)&&(t[r]=e[r]);return t}const qN=[].concat;function Jb(e){return qN.apply([],e)}const Xb="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Jb([8,16,32,64].map(e=>["Int","Uint","Float"].map(t=>t+e+"Array")))).filter(e=>ue[e]),KN=Xb.map(e=>ue[e]);Gb(Xb,e=>[e,!0]);let Vt=null;function qo(e){Vt=typeof WeakMap<"u"&&new WeakMap;const t=zl(e);return Vt=null,t}function zl(e){if(!e||typeof e!="object")return e;let t=Vt&&Vt.get(e);if(t)return t;if(Me(e)){t=[],Vt&&Vt.set(e,t);for(var r=0,n=e.length;r<n;++r)t.push(zl(e[r]))}else if(KN.indexOf(e.constructor)>=0)t=e;else{const o=Hn(e);for(var i in t=o===Object.prototype?{}:Object.create(o),Vt&&Vt.set(e,t),e)Je(e,i)&&(t[i]=zl(e[i]))}return t}const{toString:HN}={};function Ql(e){return HN.call(e).slice(8,-1)}const Gl=typeof Symbol<"u"?Symbol.iterator:"@@iterator",VN=typeof Gl=="symbol"?function(e){var t;return e!=null&&(t=e[Gl])&&t.apply(e)}:function(){return null},gn={};function At(e){var t,r,n,i;if(arguments.length===1){if(Me(e))return e.slice();if(this===gn&&typeof e=="string")return[e];if(i=VN(e)){for(r=[];!(n=i.next()).done;)r.push(n.value);return r}if(e==null)return[e];if(typeof(t=e.length)=="number"){for(r=new Array(t);t--;)r[t]=e[t];return r}return[e]}for(t=arguments.length,r=new Array(t);t--;)r[t]=arguments[t];return r}const ld=typeof Symbol<"u"?e=>e[Symbol.toStringTag]==="AsyncFunction":()=>!1;var wt=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Zb(e,t){wt=e,eg=t}var eg=()=>!0;const zN=!new Error("").stack;function un(){if(zN)try{throw un.arguments,new Error}catch(e){return e}return new Error}function Yl(e,t){var r=e.stack;return r?(t=t||0,r.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
|
|
21
|
-
`).length),r.split(`
|
|
22
|
-
`).slice(t).filter(eg).map(n=>`
|
|
23
|
-
`+n).join("")):""}var tg=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],fd=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(tg),QN={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 In(e,t){this._e=un(),this.name=e,this.message=t}function rg(e,t){return e+". Errors: "+Object.keys(t).map(r=>t[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
|
|
24
|
-
`)}function Ta(e,t,r,n){this._e=un(),this.failures=t,this.failedKeys=n,this.successCount=r,this.message=rg(e,t)}function Pi(e,t){this._e=un(),this.name="BulkError",this.failures=Object.keys(t).map(r=>t[r]),this.failuresByPos=t,this.message=rg(e,t)}Cn(In).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Yl(this._e,2))}},toString:function(){return this.name+": "+this.message}}),Cn(Ta).from(In),Cn(Pi).from(In);var dd=fd.reduce((e,t)=>(e[t]=t+"Error",e),{});const GN=In;var U=fd.reduce((e,t)=>{var r=t+"Error";function n(i,o){this._e=un(),this.name=r,i?typeof i=="string"?(this.message=`${i}${o?`
|
|
25
|
-
`+o:""}`,this.inner=o||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=QN[t]||r,this.inner=null)}return Cn(n).from(GN),e[t]=n,e},{});U.Syntax=SyntaxError,U.Type=TypeError,U.Range=RangeError;var up=tg.reduce((e,t)=>(e[t+"Error"]=U[t],e),{}),pa=fd.reduce((e,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=U[t]),e),{});function re(){}function Li(e){return e}function YN(e,t){return e==null||e===Li?t:function(r){return t(e(r))}}function Kr(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function JN(e,t){return e===re?t:function(){var r=e.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?Kr(n,this.onsuccess):n),i&&(this.onerror=this.onerror?Kr(i,this.onerror):i),o!==void 0?o:r}}function XN(e,t){return e===re?t:function(){e.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?Kr(r,this.onsuccess):r),n&&(this.onerror=this.onerror?Kr(n,this.onerror):n)}}function ZN(e,t){return e===re?t:function(r){var n=e.apply(this,arguments);Le(r,n);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?Kr(i,this.onsuccess):i),o&&(this.onerror=this.onerror?Kr(o,this.onerror):o),n===void 0?a===void 0?void 0:a:Le(n,a)}}function eU(e,t){return e===re?t:function(){return t.apply(this,arguments)!==!1&&e.apply(this,arguments)}}function hd(e,t){return e===re?t:function(){var r=e.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return r.then(function(){return t.apply(n,o)})}return t.apply(this,arguments)}}pa.ModifyError=Ta,pa.DexieError=In,pa.BulkError=Pi;var Bi={};const[Jl,Fa,Xl]=typeof Promise>"u"?[]:(()=>{let e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,Hn(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Hn(t),e]})(),ng=Fa&&Fa.then,ya=Jl&&Jl.constructor,vd=!!Xl;var Zl=!1,tU=Xl?()=>{Xl.then(Zo)}:ue.setImmediate?setImmediate.bind(null,Zo):ue.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{Zo(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Zo,0)},$i=function(e,t){gi.push([e,t]),La&&(tU(),La=!1)},ef=!0,La=!0,kr=[],ma=[],tf=null,rf=Li,Rn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:cp,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{cp(e[0],e[1])}catch{}})}},B=Rn,gi=[],jr=0,ba=[];function T(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=re,this._lib=!1;var t=this._PSD=B;if(wt&&(this._stackHolder=un(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==Bi)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&of(this,this._value))}this._state=null,this._value=null,++t.ref,og(this,e)}const nf={get:function(){var e=B,t=Ba;function r(n,i){var o=!e.global&&(e!==B||t!==Ba);const a=o&&!Bt();var u=new T((s,c)=>{pd(this,new ig(Na(n,e,o,a),Na(i,e,o,a),s,c,e))});return wt&&sg(u,this),u}return r.prototype=Bi,r},set:function(e){kt(this,"then",e&&e.prototype===Bi?nf:{get:function(){return e},set:nf.set})}};function ig(e,t,r,n,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=r,this.reject=n,this.psd=i}function og(e,t){try{t(r=>{if(e._state===null){if(r===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ko();r&&typeof r.then=="function"?og(e,(i,o)=>{r instanceof T?r._then(i,o):r.then(i,o)}):(e._state=!0,e._value=r,ag(e)),n&&Ho()}},of.bind(null,e))}catch(r){of(e,r)}}function of(e,t){if(ma.push(t),e._state===null){var r=e._lib&&Ko();t=rf(t),e._state=!1,e._value=t,wt&&t!==null&&typeof t=="object"&&!t._promise&&function(n,i,o){try{n.apply(null,o)}catch(a){i&&i(a)}}(()=>{var n=cd(t,"stack");t._promise=e,kt(t,"stack",{get:()=>Zl?n&&(n.get?n.get.apply(t):n.value):e.stack})}),function(n){kr.some(i=>i._value===n._value)||kr.push(n)}(e),ag(e),r&&Ho()}}function ag(e){var t=e._listeners;e._listeners=[];for(var r=0,n=t.length;r<n;++r)pd(e,t[r]);var i=e._PSD;--i.ref||i.finalize(),jr===0&&(++jr,$i(()=>{--jr==0&&yd()},[]))}function pd(e,t){if(e._state!==null){var r=e._state?t.onFulfilled:t.onRejected;if(r===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++jr,$i(rU,[r,e,t])}else e._listeners.push(t)}function rU(e,t,r){try{tf=t;var n,i=t._value;t._state?n=e(i):(ma.length&&(ma=[]),n=e(i),ma.indexOf(i)===-1&&function(o){for(var a=kr.length;a;)if(kr[--a]._value===o._value)return void kr.splice(a,1)}(t)),r.resolve(n)}catch(o){r.reject(o)}finally{tf=null,--jr==0&&yd(),--r.psd.ref||r.psd.finalize()}}function ug(e,t,r){if(t.length===r)return t;var n="";if(e._state===!1){var i,o,a=e._value;a!=null?(i=a.name||"Error",o=a.message||a,n=Yl(a,0)):(i=a,o=""),t.push(i+(o?": "+o:"")+n)}return wt&&((n=Yl(e._stackHolder,2))&&t.indexOf(n)===-1&&t.push(n),e._prev&&ug(e._prev,t,r)),t}function sg(e,t){var r=t?t._numPrev+1:0;r<100&&(e._prev=t,e._numPrev=r)}function Zo(){Ko()&&Ho()}function Ko(){var e=ef;return ef=!1,La=!1,e}function Ho(){var e,t,r;do for(;gi.length>0;)for(e=gi,gi=[],r=e.length,t=0;t<r;++t){var n=e[t];n[0].apply(null,n[1])}while(gi.length>0);ef=!0,La=!0}function yd(){var e=kr;kr=[],e.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var t=ba.slice(0),r=t.length;r;)t[--r]()}function ea(e){return new T(Bi,!1,e)}function ce(e,t){var r=B;return function(){var n=Ko(),i=B;try{return ar(r,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{ar(i,!1),n&&Ho()}}}Vn(T.prototype,{then:nf,_then:function(e,t){pd(this,new ig(null,null,e,t,B))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],r=arguments[1];return typeof t=="function"?this.then(null,n=>n instanceof t?r(n):ea(n)):this.then(null,n=>n&&n.name===t?r(n):ea(n))},finally:function(e){return this.then(t=>(e(),t),t=>(e(),ea(t)))},stack:{get:function(){if(this._stack)return this._stack;try{Zl=!0;var e=ug(this,[],20).join(`
|
|
26
|
-
From previous: `);return this._state!==null&&(this._stack=e),e}finally{Zl=!1}}},timeout:function(e,t){return e<1/0?new T((r,n)=>{var i=setTimeout(()=>n(new U.Timeout(t)),e);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&kt(T.prototype,Symbol.toStringTag,"Dexie.Promise"),Rn.env=cg(),Vn(T,{all:function(){var e=At.apply(null,arguments).map(ta);return new T(function(t,r){e.length===0&&t([]);var n=e.length;e.forEach((i,o)=>T.resolve(i).then(a=>{e[o]=a,--n||t(e)},r))})},resolve:e=>{if(e instanceof T)return e;if(e&&typeof e.then=="function")return new T((r,n)=>{e.then(r,n)});var t=new T(Bi,!0,e);return sg(t,tf),t},reject:ea,race:function(){var e=At.apply(null,arguments).map(ta);return new T((t,r)=>{e.map(n=>T.resolve(n).then(t,r))})},PSD:{get:()=>B,set:e=>B=e},totalEchoes:{get:()=>Ba},newPSD:or,usePSD:fi,scheduler:{get:()=>$i,set:e=>{$i=e}},rejectionMapper:{get:()=>rf,set:e=>{rf=e}},follow:(e,t)=>new T((r,n)=>or((i,o)=>{var a=B;a.unhandleds=[],a.onunhandled=o,a.finalize=Kr(function(){(function(u){function s(){u(),ba.splice(ba.indexOf(s),1)}ba.push(s),++jr,$i(()=>{--jr==0&&yd()},[])})(()=>{this.unhandleds.length===0?i():o(this.unhandleds[0])})},a.finalize),e()},t,r,n))}),ya&&(ya.allSettled&&kt(T,"allSettled",function(){const e=At.apply(null,arguments).map(ta);return new T(t=>{e.length===0&&t([]);let r=e.length;const n=new Array(r);e.forEach((i,o)=>T.resolve(i).then(a=>n[o]={status:"fulfilled",value:a},a=>n[o]={status:"rejected",reason:a}).then(()=>--r||t(n)))})}),ya.any&&typeof AggregateError<"u"&&kt(T,"any",function(){const e=At.apply(null,arguments).map(ta);return new T((t,r)=>{e.length===0&&r(new AggregateError([]));let n=e.length;const i=new Array(n);e.forEach((o,a)=>T.resolve(o).then(u=>t(u),u=>{i[a]=u,--n||r(new AggregateError(i))}))})}));const je={awaits:0,echoes:0,id:0};var nU=0,ga=[],ol=0,Ba=0,iU=0;function or(e,t,r,n){var i=B,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++iU;var a=Rn.env;o.env=vd?{Promise:T,PromiseProp:{value:T,configurable:!0,writable:!0},all:T.all,race:T.race,allSettled:T.allSettled,any:T.any,resolve:T.resolve,reject:T.reject,nthen:sp(a.nthen,o),gthen:sp(a.gthen,o)}:{},t&&Le(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=fi(o,e,r,n);return o.ref===0&&o.finalize(),u}function li(){return je.id||(je.id=++nU),++je.awaits,je.echoes+=100,je.id}function Bt(){return!!je.awaits&&(--je.awaits==0&&(je.id=0),je.echoes=100*je.awaits,!0)}function ta(e){return je.echoes&&e&&e.constructor===ya?(li(),e.then(t=>(Bt(),t),t=>(Bt(),_e(t)))):e}function oU(e){++Ba,je.echoes&&--je.echoes!=0||(je.echoes=je.id=0),ga.push(B),ar(e,!0)}function aU(){var e=ga[ga.length-1];ga.pop(),ar(e,!1)}function ar(e,t){var r=B;if((t?!je.echoes||ol++&&e===B:!ol||--ol&&e===B)||lg(t?oU.bind(null,e):aU),e!==B&&(B=e,r===Rn&&(Rn.env=cg()),vd)){var n=Rn.env.Promise,i=e.env;Fa.then=i.nthen,n.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(ue,"Promise",i.PromiseProp),n.all=i.all,n.race=i.race,n.resolve=i.resolve,n.reject=i.reject,i.allSettled&&(n.allSettled=i.allSettled),i.any&&(n.any=i.any))}}function cg(){var e=ue.Promise;return vd?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(ue,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:Fa.then,gthen:e.prototype.then}:{}}function fi(e,t,r,n,i){var o=B;try{return ar(e,!0),t(r,n,i)}finally{ar(o,!1)}}function lg(e){ng.call(Jl,e)}function Na(e,t,r,n){return typeof e!="function"?e:function(){var i=B;r&&li(),ar(t,!0);try{return e.apply(this,arguments)}finally{ar(i,!1),n&&lg(Bt)}}}function sp(e,t){return function(r,n){return e.call(this,Na(r,t),Na(n,t))}}(""+ng).indexOf("[native code]")===-1&&(li=Bt=re);function cp(e,t){var r;try{r=t.onuncatched(e)}catch{}if(r!==!1)try{var n,i={promise:t,reason:e};if(ue.document&&document.createEvent?((n=document.createEvent("Event")).initEvent("unhandledrejection",!0,!0),Le(n,i)):ue.CustomEvent&&Le(n=new CustomEvent("unhandledrejection",{detail:i}),i),n&&ue.dispatchEvent&&(dispatchEvent(n),!ue.PromiseRejectionEvent&&ue.onunhandledrejection))try{ue.onunhandledrejection(n)}catch{}wt&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch{}}var _e=T.reject;function af(e,t,r,n){if(e.idbdb&&(e._state.openComplete||B.letThrough||e._vip)){var i=e._createTransaction(t,r,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===dd.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(()=>af(e,t,r,n))):_e(o)}return i._promise(t,(o,a)=>or(()=>(B.trans=i,n(o,a,i)))).then(o=>i._completion.then(()=>o))}if(e._state.openComplete)return _e(new U.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return _e(new U.DatabaseClosed);e.open().catch(re)}return e._state.dbReadyPromise.then(()=>af(e,t,r,n))}const Pr=String.fromCharCode(65535),Et="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Ai=[],dc=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),uU=dc,sU=dc,fg=e=>!/(dexie\.js|dexie\.min\.js)/.test(e);function Hr(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const dg={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function ra(e){return typeof e!="string"||/\./.test(e)?t=>t:t=>(t[e]===void 0&&e in t&&delete(t=qo(t))[e],t)}function cU(){throw U.Type()}class lU{_trans(t,r,n){const i=this._tx||B.trans,o=this.name;function a(s,c,l){if(!l.schema[o])throw new U.NotFound("Table "+o+" not part of transaction");return r(l.idbtrans,l)}const u=Ko();try{return i&&i.db===this.db?i===B.trans?i._promise(t,a,n):or(()=>i._promise(t,a,n),{trans:i,transless:B.transless||B}):af(this.db,t,[this.name],a)}finally{u&&Ho()}}get(t,r){return t&&t.constructor===Object?this.where(t).first(r):this._trans("readonly",n=>this.core.get({trans:n,key:t}).then(i=>this.hook.reading.fire(i))).then(r)}where(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(Me(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const r=ye(t);if(r.length===1)return this.where(r[0]).equals(t[r[0]]);const n=this.schema.indexes.concat(this.schema.primKey).filter(c=>c.compound&&r.every(l=>c.keyPath.indexOf(l)>=0)&&c.keyPath.every(l=>r.indexOf(l)>=0))[0];if(n&&this.db._maxKey!==Pr)return this.where(n.name).equals(n.keyPath.map(c=>t[c]));!n&&wt&&console.warn(`The query ${JSON.stringify(t)} on ${this.name} would benefit of a compound index [${r.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(c,l){try{return o.cmp(c,l)===0}catch{return!1}}const[u,s]=r.reduce(([c,l],f)=>{const d=i[f],p=t[f];return[c||d,c||!d?Hr(l,d&&d.multi?m=>{const y=jt(m,f);return Me(y)&&y.some(_=>a(p,_))}:m=>a(p,jt(m,f))):l]},[null,null]);return u?this.where(u.name).equals(t[u.keyPath]).filter(s):n?this.filter(s):this.where(r).equals("")}filter(t){return this.toCollection().and(t)}count(t){return this.toCollection().count(t)}offset(t){return this.toCollection().offset(t)}limit(t){return this.toCollection().limit(t)}each(t){return this.toCollection().each(t)}toArray(t){return this.toCollection().toArray(t)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(t){return new this.db.Collection(new this.db.WhereClause(this,Me(t)?`[${t.join("+")}]`:t))}reverse(){return this.toCollection().reverse()}mapToClass(t){const{db:r,name:n}=this;this.schema.mappedClass=t,t.prototype instanceof cU&&(t=class extends t{get db(){return r}table(){return n}});const i=new Set;for(let a=t.prototype;a;a=Hn(a))Object.getOwnPropertyNames(a).forEach(u=>i.add(u));const o=a=>{if(!a)return a;const u=Object.create(t.prototype);for(let s in a)if(!i.has(s))try{u[s]=a[s]}catch{}return u};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=o,this.hook("reading",o),t}defineClass(){return this.mapToClass(function(t){Le(this,t)})}add(t,r){const{auto:n,keyPath:i}=this.schema.primKey;let o=t;return i&&n&&(o=ra(i)(t)),this._trans("readwrite",a=>this.core.mutate({trans:a,type:"add",keys:r!=null?[r]:null,values:[o]})).then(a=>a.numFailures?T.reject(a.failures[0]):a.lastResult).then(a=>{if(i)try{Ze(t,i,a)}catch{}return a})}update(t,r){if(typeof t!="object"||Me(t))return this.where(":id").equals(t).modify(r);{const n=jt(t,this.schema.primKey.keyPath);if(n===void 0)return _e(new U.InvalidArgument("Given object does not contain its primary key"));try{typeof r!="function"?ye(r).forEach(i=>{Ze(t,i,r[i])}):r(t,{value:t,primKey:n})}catch{}return this.where(":id").equals(n).modify(r)}}put(t,r){const{auto:n,keyPath:i}=this.schema.primKey;let o=t;return i&&n&&(o=ra(i)(t)),this._trans("readwrite",a=>this.core.mutate({trans:a,type:"put",values:[o],keys:r!=null?[r]:null})).then(a=>a.numFailures?T.reject(a.failures[0]):a.lastResult).then(a=>{if(i)try{Ze(t,i,a)}catch{}return a})}delete(t){return this._trans("readwrite",r=>this.core.mutate({trans:r,type:"delete",keys:[t]})).then(r=>r.numFailures?T.reject(r.failures[0]):void 0)}clear(){return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"deleteRange",range:dg})).then(t=>t.numFailures?T.reject(t.failures[0]):void 0)}bulkGet(t){return this._trans("readonly",r=>this.core.getMany({keys:t,trans:r}).then(n=>n.map(i=>this.hook.reading.fire(i))))}bulkAdd(t,r,n){const i=Array.isArray(r)?r:void 0,o=(n=n||(i?void 0:r))?n.allKeys:void 0;return this._trans("readwrite",a=>{const{auto:u,keyPath:s}=this.schema.primKey;if(s&&i)throw new U.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==t.length)throw new U.InvalidArgument("Arguments objects and keys must have the same length");const c=t.length;let l=s&&u?t.map(ra(s)):t;return this.core.mutate({trans:a,type:"add",keys:i,values:l,wantResults:o}).then(({numFailures:f,results:d,lastResult:p,failures:m})=>{if(f===0)return o?d:p;throw new Pi(`${this.name}.bulkAdd(): ${f} of ${c} operations failed`,m)})})}bulkPut(t,r,n){const i=Array.isArray(r)?r:void 0,o=(n=n||(i?void 0:r))?n.allKeys:void 0;return this._trans("readwrite",a=>{const{auto:u,keyPath:s}=this.schema.primKey;if(s&&i)throw new U.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==t.length)throw new U.InvalidArgument("Arguments objects and keys must have the same length");const c=t.length;let l=s&&u?t.map(ra(s)):t;return this.core.mutate({trans:a,type:"put",keys:i,values:l,wantResults:o}).then(({numFailures:f,results:d,lastResult:p,failures:m})=>{if(f===0)return o?d:p;throw new Pi(`${this.name}.bulkPut(): ${f} of ${c} operations failed`,m)})})}bulkDelete(t){const r=t.length;return this._trans("readwrite",n=>this.core.mutate({trans:n,type:"delete",keys:t})).then(({numFailures:n,lastResult:i,failures:o})=>{if(n===0)return i;throw new Pi(`${this.name}.bulkDelete(): ${n} of ${r} operations failed`,o)})}}function xi(e){var t={},r=function(u,s){if(s){for(var c=arguments.length,l=new Array(c-1);--c;)l[c-1]=arguments[c];return t[u].subscribe.apply(null,l),e}if(typeof u=="string")return t[u]};r.addEventType=o;for(var n=1,i=arguments.length;n<i;++n)o(arguments[n]);return r;function o(u,s,c){if(typeof u=="object")return a(u);s||(s=eU),c||(c=re);var l={subscribers:[],fire:c,subscribe:function(f){l.subscribers.indexOf(f)===-1&&(l.subscribers.push(f),l.fire=s(l.fire,f))},unsubscribe:function(f){l.subscribers=l.subscribers.filter(function(d){return d!==f}),l.fire=l.subscribers.reduce(s,c)}};return t[u]=r[u]=l,l}function a(u){ye(u).forEach(function(s){var c=u[s];if(Me(c))o(s,u[s][0],u[s][1]);else{if(c!=="asap")throw new U.InvalidArgument("Invalid event config");var l=o(s,Li,function(){for(var f=arguments.length,d=new Array(f);f--;)d[f]=arguments[f];l.subscribers.forEach(function(p){Qb(function(){p.apply(null,d)})})})}})}}function yi(e,t){return Cn(t).from({prototype:e}),t}function vn(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function al(e,t){e.filter=Hr(e.filter,t)}function ul(e,t,r){var n=e.replayFilter;e.replayFilter=n?()=>Hr(n(),t()):t,e.justLimit=r&&!n}function _a(e,t){if(e.isPrimKey)return t.primaryKey;const r=t.getIndexByKeyPath(e.index);if(!r)throw new U.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return r}function lp(e,t,r){const n=_a(e,t.schema);return t.openCursor({trans:r,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:n,range:e.range}})}function na(e,t,r,n){const i=e.replayFilter?Hr(e.filter,e.replayFilter()):e.filter;if(e.or){const o={},a=(u,s,c)=>{if(!i||i(s,c,d=>s.stop(d),d=>s.fail(d))){var l=s.primaryKey,f=""+l;f==="[object ArrayBuffer]"&&(f=""+new Uint8Array(l)),Je(o,f)||(o[f]=!0,t(u,s,c))}};return Promise.all([e.or._iterate(a,r),fp(lp(e,n,r),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return fp(lp(e,n,r),Hr(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function fp(e,t,r,n){var i=ce(n?(o,a,u)=>r(n(o),a,u):r);return e.then(o=>{if(o)return o.start(()=>{var a=()=>o.continue();t&&!t(o,u=>a=u,u=>{o.stop(u),a=re},u=>{o.fail(u),a=re})||i(o.value,o,u=>a=u),a()})})}function Fe(e,t){try{const r=dp(e),n=dp(t);if(r!==n)return r==="Array"?1:n==="Array"?-1:r==="binary"?1:n==="binary"?-1:r==="string"?1:n==="string"?-1:r==="Date"?1:n!=="Date"?NaN:-1;switch(r){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(i,o){const a=i.length,u=o.length,s=a<u?a:u;for(let c=0;c<s;++c)if(i[c]!==o[c])return i[c]<o[c]?-1:1;return a===u?0:a<u?-1:1}(hp(e),hp(t));case"Array":return function(i,o){const a=i.length,u=o.length,s=a<u?a:u;for(let c=0;c<s;++c){const l=Fe(i[c],o[c]);if(l!==0)return l}return a===u?0:a<u?-1:1}(e,t)}}catch{}return NaN}function dp(e){const t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";const r=Ql(e);return r==="ArrayBuffer"?"binary":r}function hp(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class fU{_read(t,r){var n=this._ctx;return n.error?n.table._trans(null,_e.bind(null,n.error)):n.table._trans("readonly",t).then(r)}_write(t){var r=this._ctx;return r.error?r.table._trans(null,_e.bind(null,r.error)):r.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var r=this._ctx;r.algorithm=Hr(r.algorithm,t)}_iterate(t,r){return na(this._ctx,t,r,this._ctx.table.core)}clone(t){var r=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return t&&Le(n,t),r._ctx=n,r}raw(){return this._ctx.valueMapper=null,this}each(t){var r=this._ctx;return this._read(n=>na(r,t,n,r.table.core))}count(t){return this._read(r=>{const n=this._ctx,i=n.table.core;if(vn(n,!0))return i.count({trans:r,query:{index:_a(n,i.schema),range:n.range}}).then(a=>Math.min(a,n.limit));var o=0;return na(n,()=>(++o,!1),r,i).then(()=>o)}).then(t)}sortBy(t,r){const n=t.split(".").reverse(),i=n[0],o=n.length-1;function a(c,l){return l?a(c[n[l]],l-1):c[i]}var u=this._ctx.dir==="next"?1:-1;function s(c,l){var f=a(c,o),d=a(l,o);return f<d?-u:f>d?u:0}return this.toArray(function(c){return c.sort(s)}).then(r)}toArray(t){return this._read(r=>{var n=this._ctx;if(n.dir==="next"&&vn(n,!0)&&n.limit>0){const{valueMapper:i}=n,o=_a(n,n.table.core.schema);return n.table.core.query({trans:r,limit:n.limit,values:!0,query:{index:o,range:n.range}}).then(({result:a})=>i?a.map(i):a)}{const i=[];return na(n,o=>i.push(o),r,n.table.core).then(()=>i)}},t)}offset(t){var r=this._ctx;return t<=0||(r.offset+=t,vn(r)?ul(r,()=>{var n=t;return(i,o)=>n===0||(n===1?(--n,!1):(o(()=>{i.advance(n),n=0}),!1))}):ul(r,()=>{var n=t;return()=>--n<0})),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),ul(this._ctx,()=>{var r=t;return function(n,i,o){return--r<=0&&i(o),r>=0}},!0),this}until(t,r){return al(this._ctx,function(n,i,o){return!t(n.value)||(i(o),r)}),this}first(t){return this.limit(1).toArray(function(r){return r[0]}).then(t)}last(t){return this.reverse().first(t)}filter(t){var r,n;return al(this._ctx,function(i){return t(i.value)}),r=this._ctx,n=t,r.isMatch=Hr(r.isMatch,n),this}and(t){return this.filter(t)}or(t){return new this.db.WhereClause(this._ctx.table,t,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(t){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){t(i.key,i)})}eachUniqueKey(t){return this._ctx.unique="unique",this.eachKey(t)}eachPrimaryKey(t){var r=this._ctx;return r.keysOnly=!r.isMatch,this.each(function(n,i){t(i.primaryKey,i)})}keys(t){var r=this._ctx;r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.key)}).then(function(){return n}).then(t)}primaryKeys(t){var r=this._ctx;if(r.dir==="next"&&vn(r,!0)&&r.limit>0)return this._read(i=>{var o=_a(r,r.table.core.schema);return r.table.core.query({trans:i,values:!1,limit:r.limit,query:{index:o,range:r.range}})}).then(({result:i})=>i).then(t);r.keysOnly=!r.isMatch;var n=[];return this.each(function(i,o){n.push(o.primaryKey)}).then(function(){return n}).then(t)}uniqueKeys(t){return this._ctx.unique="unique",this.keys(t)}firstKey(t){return this.limit(1).keys(function(r){return r[0]}).then(t)}lastKey(t){return this.reverse().firstKey(t)}distinct(){var t=this._ctx,r=t.index&&t.table.schema.idxByName[t.index];if(!r||!r.multi)return this;var n={};return al(this._ctx,function(i){var o=i.primaryKey.toString(),a=Je(n,o);return n[o]=!0,!a}),this}modify(t){var r=this._ctx;return this._write(n=>{var i;if(typeof t=="function")i=t;else{var o=ye(t),a=o.length;i=function(y){for(var _=!1,w=0;w<a;++w){var O=o[w],E=t[O];jt(y,O)!==E&&(Ze(y,O,E),_=!0)}return _}}const u=r.table.core,{outbound:s,extractKey:c}=u.schema.primaryKey,l=this.db._options.modifyChunkSize||200,f=[];let d=0;const p=[],m=(y,_)=>{const{failures:w,numFailures:O}=_;d+=y-O;for(let E of ye(w))f.push(w[E])};return this.clone().primaryKeys().then(y=>{const _=w=>{const O=Math.min(l,y.length-w);return u.getMany({trans:n,keys:y.slice(w,w+O),cache:"immutable"}).then(E=>{const A=[],P=[],x=s?[]:null,C=[];for(let M=0;M<O;++M){const N=E[M],K={value:qo(N),primKey:y[w+M]};i.call(K,K.value,K)!==!1&&(K.value==null?C.push(y[w+M]):s||Fe(c(N),c(K.value))===0?(P.push(K.value),s&&x.push(y[w+M])):(C.push(y[w+M]),A.push(K.value)))}const k=vn(r)&&r.limit===1/0&&(typeof t!="function"||t===sl)&&{index:r.index,range:r.range};return Promise.resolve(A.length>0&&u.mutate({trans:n,type:"add",values:A}).then(M=>{for(let N in M.failures)C.splice(parseInt(N),1);m(A.length,M)})).then(()=>(P.length>0||k&&typeof t=="object")&&u.mutate({trans:n,type:"put",keys:x,values:P,criteria:k,changeSpec:typeof t!="function"&&t}).then(M=>m(P.length,M))).then(()=>(C.length>0||k&&t===sl)&&u.mutate({trans:n,type:"delete",keys:C,criteria:k}).then(M=>m(C.length,M))).then(()=>y.length>w+O&&_(w+l))})};return _(0).then(()=>{if(f.length>0)throw new Ta("Error modifying one or more objects",f,d,p);return y.length})})})}delete(){var t=this._ctx,r=t.range;return vn(t)&&(t.isPrimKey&&!sU||r.type===3)?this._write(n=>{const{primaryKey:i}=t.table.core.schema,o=r;return t.table.core.count({trans:n,query:{index:i,range:o}}).then(a=>t.table.core.mutate({trans:n,type:"deleteRange",range:o}).then(({failures:u,lastResult:s,results:c,numFailures:l})=>{if(l)throw new Ta("Could not delete some values",Object.keys(u).map(f=>u[f]),a-l);return a-l}))}):this.modify(sl)}}const sl=(e,t)=>t.value=null;function dU(e,t){return e<t?-1:e===t?0:1}function hU(e,t){return e>t?-1:e===t?0:1}function He(e,t,r){var n=e instanceof vg?new e.Collection(e):e;return n._ctx.error=r?new r(t):new TypeError(t),n}function pn(e){return new e.Collection(e,()=>hg("")).limit(0)}function vU(e,t,r,n,i,o){for(var a=Math.min(e.length,n.length),u=-1,s=0;s<a;++s){var c=t[s];if(c!==n[s])return i(e[s],r[s])<0?e.substr(0,s)+r[s]+r.substr(s+1):i(e[s],n[s])<0?e.substr(0,s)+n[s]+r.substr(s+1):u>=0?e.substr(0,u)+t[u]+r.substr(u+1):null;i(e[s],c)<0&&(u=s)}return a<n.length&&o==="next"?e+r.substr(e.length):a<e.length&&o==="prev"?e.substr(0,r.length):u<0?null:e.substr(0,u)+n[u]+r.substr(u+1)}function ia(e,t,r,n){var i,o,a,u,s,c,l,f=r.length;if(!r.every(y=>typeof y=="string"))return He(e,"String expected.");function d(y){i=function(w){return w==="next"?O=>O.toUpperCase():O=>O.toLowerCase()}(y),o=function(w){return w==="next"?O=>O.toLowerCase():O=>O.toUpperCase()}(y),a=y==="next"?dU:hU;var _=r.map(function(w){return{lower:o(w),upper:i(w)}}).sort(function(w,O){return a(w.lower,O.lower)});u=_.map(function(w){return w.upper}),s=_.map(function(w){return w.lower}),c=y,l=y==="next"?"":n}d("next");var p=new e.Collection(e,()=>Kt(u[0],s[f-1]+n));p._ondirectionchange=function(y){d(y)};var m=0;return p._addAlgorithm(function(y,_,w){var O=y.key;if(typeof O!="string")return!1;var E=o(O);if(t(E,s,m))return!0;for(var A=null,P=m;P<f;++P){var x=vU(O,E,u[P],s[P],a,c);x===null&&A===null?m=P+1:(A===null||a(A,x)>0)&&(A=x)}return _(A!==null?function(){y.continue(A+l)}:w),!1}),p}function Kt(e,t,r,n){return{type:2,lower:e,upper:t,lowerOpen:r,upperOpen:n}}function hg(e){return{type:1,lower:e,upper:e}}class vg{get Collection(){return this._ctx.table.db.Collection}between(t,r,n,i){n=n!==!1,i=i===!0;try{return this._cmp(t,r)>0||this._cmp(t,r)===0&&(n||i)&&(!n||!i)?pn(this):new this.Collection(this,()=>Kt(t,r,!n,!i))}catch{return He(this,Et)}}equals(t){return t==null?He(this,Et):new this.Collection(this,()=>hg(t))}above(t){return t==null?He(this,Et):new this.Collection(this,()=>Kt(t,void 0,!0))}aboveOrEqual(t){return t==null?He(this,Et):new this.Collection(this,()=>Kt(t,void 0,!1))}below(t){return t==null?He(this,Et):new this.Collection(this,()=>Kt(void 0,t,!1,!0))}belowOrEqual(t){return t==null?He(this,Et):new this.Collection(this,()=>Kt(void 0,t))}startsWith(t){return typeof t!="string"?He(this,"String expected."):this.between(t,t+Pr,!0,!0)}startsWithIgnoreCase(t){return t===""?this.startsWith(t):ia(this,(r,n)=>r.indexOf(n[0])===0,[t],Pr)}equalsIgnoreCase(t){return ia(this,(r,n)=>r===n[0],[t],"")}anyOfIgnoreCase(){var t=At.apply(gn,arguments);return t.length===0?pn(this):ia(this,(r,n)=>n.indexOf(r)!==-1,t,"")}startsWithAnyOfIgnoreCase(){var t=At.apply(gn,arguments);return t.length===0?pn(this):ia(this,(r,n)=>n.some(i=>r.indexOf(i)===0),t,Pr)}anyOf(){const t=At.apply(gn,arguments);let r=this._cmp;try{t.sort(r)}catch{return He(this,Et)}if(t.length===0)return pn(this);const n=new this.Collection(this,()=>Kt(t[0],t[t.length-1]));n._ondirectionchange=o=>{r=o==="next"?this._ascending:this._descending,t.sort(r)};let i=0;return n._addAlgorithm((o,a,u)=>{const s=o.key;for(;r(s,t[i])>0;)if(++i,i===t.length)return a(u),!1;return r(s,t[i])===0||(a(()=>{o.continue(t[i])}),!1)}),n}notEqual(t){return this.inAnyRange([[-(1/0),t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=At.apply(gn,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return He(this,Et)}const r=t.reduce((n,i)=>n?n.concat([[n[n.length-1][1],i]]):[[-(1/0),i]],null);return r.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(r,{includeLowers:!1,includeUppers:!1})}inAnyRange(t,r){const n=this._cmp,i=this._ascending,o=this._descending,a=this._min,u=this._max;if(t.length===0)return pn(this);if(!t.every(O=>O[0]!==void 0&&O[1]!==void 0&&i(O[0],O[1])<=0))return He(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",U.InvalidArgument);const s=!r||r.includeLowers!==!1,c=r&&r.includeUppers===!0;let l,f=i;function d(O,E){return f(O[0],E[0])}try{l=t.reduce(function(O,E){let A=0,P=O.length;for(;A<P;++A){const x=O[A];if(n(E[0],x[1])<0&&n(E[1],x[0])>0){x[0]=a(x[0],E[0]),x[1]=u(x[1],E[1]);break}}return A===P&&O.push(E),O},[]),l.sort(d)}catch{return He(this,Et)}let p=0;const m=c?O=>i(O,l[p][1])>0:O=>i(O,l[p][1])>=0,y=s?O=>o(O,l[p][0])>0:O=>o(O,l[p][0])>=0;let _=m;const w=new this.Collection(this,()=>Kt(l[0][0],l[l.length-1][1],!s,!c));return w._ondirectionchange=O=>{O==="next"?(_=m,f=i):(_=y,f=o),l.sort(d)},w._addAlgorithm((O,E,A)=>{for(var P=O.key;_(P);)if(++p,p===l.length)return E(A),!1;return!!function(x){return!m(x)&&!y(x)}(P)||(this._cmp(P,l[p][1])===0||this._cmp(P,l[p][0])===0||E(()=>{f===i?O.continue(l[p][0]):O.continue(l[p][1])}),!1)}),w}startsWithAnyOf(){const t=At.apply(gn,arguments);return t.every(r=>typeof r=="string")?t.length===0?pn(this):this.inAnyRange(t.map(r=>[r,r+Pr])):He(this,"startsWithAnyOf() only works with strings")}}function ft(e){return ce(function(t){return Ni(t),e(t.target.error),!1})}function Ni(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const ur=xi(null,"storagemutated");class pU{_lock(){return bi(!B.global),++this._reculock,this._reculock!==1||B.global||(B.lockOwnerFor=this),this}_unlock(){if(bi(!B.global),--this._reculock==0)for(B.global||(B.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{fi(t[1],t[0])}catch{}}return this}_locked(){return this._reculock&&B.lockOwnerFor!==this}create(t){if(!this.mode)return this;const r=this.db.idbdb,n=this.db._state.dbOpenError;if(bi(!this.idbtrans),!t&&!r)switch(n&&n.name){case"DatabaseClosedError":throw new U.DatabaseClosed(n);case"MissingAPIError":throw new U.MissingAPI(n.message,n);default:throw new U.OpenFailed(n)}if(!this.active)throw new U.TransactionInactive;return bi(this._completion._state===null),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ce(i=>{Ni(i),this._reject(t.error)}),t.onabort=ce(i=>{Ni(i),this.active&&this._reject(new U.Abort(t.error)),this.active=!1,this.on("abort").fire(i)}),t.oncomplete=ce(()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&ur.storagemutated.fire(t.mutatedParts)}),this}_promise(t,r,n){if(t==="readwrite"&&this.mode!=="readwrite")return _e(new U.ReadOnly("Transaction is readonly"));if(!this.active)return _e(new U.TransactionInactive);if(this._locked())return new T((o,a)=>{this._blockedFuncs.push([()=>{this._promise(t,r,n).then(o,a)},B])});if(n)return or(()=>{var o=new T((a,u)=>{this._lock();const s=r(a,u,this);s&&s.then&&s.then(a,u)});return o.finally(()=>this._unlock()),o._lib=!0,o});var i=new T((o,a)=>{var u=r(o,a,this);u&&u.then&&u.then(o,a)});return i._lib=!0,i}_root(){return this.parent?this.parent._root():this}waitFor(t){var r=this._root();const n=T.resolve(t);if(r._waitingFor)r._waitingFor=r._waitingFor.then(()=>n);else{r._waitingFor=n,r._waitingQueue=[];var i=r.idbtrans.objectStore(r.storeNames[0]);(function a(){for(++r._spinCount;r._waitingQueue.length;)r._waitingQueue.shift()();r._waitingFor&&(i.get(-1/0).onsuccess=a)})()}var o=r._waitingFor;return new T((a,u)=>{n.then(s=>r._waitingQueue.push(ce(a.bind(null,s))),s=>r._waitingQueue.push(ce(u.bind(null,s)))).finally(()=>{r._waitingFor===o&&(r._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new U.Abort))}table(t){const r=this._memoizedTables||(this._memoizedTables={});if(Je(r,t))return r[t];const n=this.schema[t];if(!n)throw new U.NotFound("Table "+t+" not part of transaction");const i=new this.db.Table(t,n,this);return i.core=this.db.core.table(t),r[t]=i,i}}function uf(e,t,r,n,i,o,a){return{name:e,keyPath:t,unique:r,multi:n,auto:i,compound:o,src:(r&&!a?"&":"")+(n?"*":"")+(i?"++":"")+pg(t)}}function pg(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function yg(e,t,r){return{name:e,primKey:t,indexes:r,mappedClass:null,idxByName:Gb(r,n=>[n.name,n])}}let Ui=e=>{try{return e.only([[]]),Ui=()=>[[]],[[]]}catch{return Ui=()=>Pr,Pr}};function sf(e){return e==null?()=>{}:typeof e=="string"?function(t){return t.split(".").length===1?r=>r[t]:r=>jt(r,t)}(e):t=>jt(t,e)}function vp(e){return[].slice.call(e)}let yU=0;function Ci(e){return e==null?":id":typeof e=="string"?e:`[${e.join("+")}]`}function mU(e,t,r){function n(s){if(s.type===3)return null;if(s.type===4)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:c,upper:l,lowerOpen:f,upperOpen:d}=s;return c===void 0?l===void 0?null:t.upperBound(l,!!d):l===void 0?t.lowerBound(c,!!f):t.bound(c,l,!!f,!!d)}const{schema:i,hasGetAll:o}=function(s,c){const l=vp(s.objectStoreNames);return{schema:{name:s.name,tables:l.map(f=>c.objectStore(f)).map(f=>{const{keyPath:d,autoIncrement:p}=f,m=Me(d),y=d==null,_={},w={name:f.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:m,keyPath:d,autoIncrement:p,unique:!0,extractKey:sf(d)},indexes:vp(f.indexNames).map(O=>f.index(O)).map(O=>{const{name:E,unique:A,multiEntry:P,keyPath:x}=O,C={name:E,compound:Me(x),keyPath:x,unique:A,multiEntry:P,extractKey:sf(x)};return _[Ci(x)]=C,C}),getIndexByKeyPath:O=>_[Ci(O)]};return _[":id"]=w.primaryKey,d!=null&&(_[Ci(d)]=w.primaryKey),w})},hasGetAll:l.length>0&&"getAll"in c.objectStore(l[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,r),a=i.tables.map(s=>function(c){const l=c.name;return{name:l,schema:c,mutate:function({trans:f,type:d,keys:p,values:m,range:y}){return new Promise((_,w)=>{_=ce(_);const O=f.objectStore(l),E=O.keyPath==null,A=d==="put"||d==="add";if(!A&&d!=="delete"&&d!=="deleteRange")throw new Error("Invalid operation type: "+d);const{length:P}=p||m||{length:1};if(p&&m&&p.length!==m.length)throw new Error("Given keys array must have same length as given values array.");if(P===0)return _({numFailures:0,failures:{},results:[],lastResult:void 0});let x;const C=[],k=[];let M=0;const N=Y=>{++M,Ni(Y)};if(d==="deleteRange"){if(y.type===4)return _({numFailures:M,failures:k,results:[],lastResult:void 0});y.type===3?C.push(x=O.clear()):C.push(x=O.delete(n(y)))}else{const[Y,Q]=A?E?[m,p]:[m,null]:[p,null];if(A)for(let H=0;H<P;++H)C.push(x=Q&&Q[H]!==void 0?O[d](Y[H],Q[H]):O[d](Y[H])),x.onerror=N;else for(let H=0;H<P;++H)C.push(x=O[d](Y[H])),x.onerror=N}const K=Y=>{const Q=Y.target.result;C.forEach((H,Ie)=>H.error!=null&&(k[Ie]=H.error)),_({numFailures:M,failures:k,results:d==="delete"?p:C.map(H=>H.result),lastResult:Q})};x.onerror=Y=>{N(Y),K(Y)},x.onsuccess=K})},getMany:({trans:f,keys:d})=>new Promise((p,m)=>{p=ce(p);const y=f.objectStore(l),_=d.length,w=new Array(_);let O,E=0,A=0;const P=C=>{const k=C.target;w[k._pos]=k.result,++A===E&&p(w)},x=ft(m);for(let C=0;C<_;++C)d[C]!=null&&(O=y.get(d[C]),O._pos=C,O.onsuccess=P,O.onerror=x,++E);E===0&&p(w)}),get:({trans:f,key:d})=>new Promise((p,m)=>{p=ce(p);const y=f.objectStore(l).get(d);y.onsuccess=_=>p(_.target.result),y.onerror=ft(m)}),query:function(f){return d=>new Promise((p,m)=>{p=ce(p);const{trans:y,values:_,limit:w,query:O}=d,E=w===1/0?void 0:w,{index:A,range:P}=O,x=y.objectStore(l),C=A.isPrimaryKey?x:x.index(A.name),k=n(P);if(w===0)return p({result:[]});if(f){const M=_?C.getAll(k,E):C.getAllKeys(k,E);M.onsuccess=N=>p({result:N.target.result}),M.onerror=ft(m)}else{let M=0;const N=_||!("openKeyCursor"in C)?C.openCursor(k):C.openKeyCursor(k),K=[];N.onsuccess=Y=>{const Q=N.result;return Q?(K.push(_?Q.value:Q.primaryKey),++M===w?p({result:K}):void Q.continue()):p({result:K})},N.onerror=ft(m)}})}(o),openCursor:function({trans:f,values:d,query:p,reverse:m,unique:y}){return new Promise((_,w)=>{_=ce(_);const{index:O,range:E}=p,A=f.objectStore(l),P=O.isPrimaryKey?A:A.index(O.name),x=m?y?"prevunique":"prev":y?"nextunique":"next",C=d||!("openKeyCursor"in P)?P.openCursor(n(E),x):P.openKeyCursor(n(E),x);C.onerror=ft(w),C.onsuccess=ce(k=>{const M=C.result;if(!M)return void _(null);M.___id=++yU,M.done=!1;const N=M.continue.bind(M);let K=M.continuePrimaryKey;K&&(K=K.bind(M));const Y=M.advance.bind(M),Q=()=>{throw new Error("Cursor not stopped")};M.trans=f,M.stop=M.continue=M.continuePrimaryKey=M.advance=()=>{throw new Error("Cursor not started")},M.fail=ce(w),M.next=function(){let H=1;return this.start(()=>H--?this.continue():this.stop()).then(()=>this)},M.start=H=>{const Ie=new Promise((ne,le)=>{ne=ce(ne),C.onerror=ft(le),M.fail=le,M.stop=he=>{M.stop=M.continue=M.continuePrimaryKey=M.advance=Q,ne(he)}}),Ce=()=>{if(C.result)try{H()}catch(ne){M.fail(ne)}else M.done=!0,M.start=()=>{throw new Error("Cursor behind last entry")},M.stop()};return C.onsuccess=ce(ne=>{C.onsuccess=Ce,Ce()}),M.continue=N,M.continuePrimaryKey=K,M.advance=Y,Ce(),Ie},_(M)},w)})},count({query:f,trans:d}){const{index:p,range:m}=f;return new Promise((y,_)=>{const w=d.objectStore(l),O=p.isPrimaryKey?w:w.index(p.name),E=n(m),A=E?O.count(E):O.count();A.onsuccess=ce(P=>y(P.target.result)),A.onerror=ft(_)})}}}(s)),u={};return a.forEach(s=>u[s.name]=s),{stack:"dbcore",transaction:e.transaction.bind(e),table(s){if(!u[s])throw new Error(`Table '${s}' not found`);return u[s]},MIN_KEY:-1/0,MAX_KEY:Ui(t),schema:i}}function cf({_novip:e},t){const r=t.db,n=function(i,o,{IDBKeyRange:a,indexedDB:u},s){return{dbcore:function(l,f){return f.reduce((d,{create:p})=>({...d,...p(d)}),l)}(mU(o,a,s),i.dbcore)}}(e._middlewares,r,e._deps,t);e.core=n.dbcore,e.tables.forEach(i=>{const o=i.name;e.core.schema.tables.some(a=>a.name===o)&&(i.core=e.core.table(o),e[o]instanceof e.Table&&(e[o].core=i.core))})}function Ua({_novip:e},t,r,n){r.forEach(i=>{const o=n[i];t.forEach(a=>{const u=cd(a,i);(!u||"value"in u&&u.value===void 0)&&(a===e.Transaction.prototype||a instanceof e.Transaction?kt(a,i,{get(){return this.table(i)},set(s){Vb(this,i,{value:s,writable:!0,configurable:!0,enumerable:!0})}}):a[i]=new e.Table(i,o))})})}function lf({_novip:e},t){t.forEach(r=>{for(let n in r)r[n]instanceof e.Table&&delete r[n]})}function bU(e,t){return e._cfg.version-t._cfg.version}function gU(e,t,r,n){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(n);const a=o._reject.bind(o),u=B.transless||B;or(()=>{B.trans=o,B.transless=u,t===0?(ye(i).forEach(s=>{cl(r,s,i[s].primKey,i[s].indexes)}),cf(e,r),T.follow(()=>e.on.populate.fire(o)).catch(a)):function({_novip:s},c,l,f){const d=[],p=s._versions;let m=s._dbSchema=df(s,s.idbdb,f),y=!1;function _(){return d.length?T.resolve(d.shift()(l.idbtrans)).then(_):T.resolve()}return p.filter(w=>w._cfg.version>=c).forEach(w=>{d.push(()=>{const O=m,E=w._cfg.dbschema;hf(s,O,f),hf(s,E,f),m=s._dbSchema=E;const A=mg(O,E);A.add.forEach(x=>{cl(f,x[0],x[1].primKey,x[1].indexes)}),A.change.forEach(x=>{if(x.recreate)throw new U.Upgrade("Not yet support for changing primary key");{const C=f.objectStore(x.name);x.add.forEach(k=>ff(C,k)),x.change.forEach(k=>{C.deleteIndex(k.name),ff(C,k)}),x.del.forEach(k=>C.deleteIndex(k))}});const P=w._cfg.contentUpgrade;if(P&&w._cfg.version>c){cf(s,f),l._memoizedTables={},y=!0;let x=Yb(E);A.del.forEach(N=>{x[N]=O[N]}),lf(s,[s.Transaction.prototype]),Ua(s,[s.Transaction.prototype],ye(x),x),l.schema=x;const C=ld(P);let k;C&&li();const M=T.follow(()=>{if(k=P(l),k&&C){var N=Bt.bind(null,null);k.then(N,N)}});return k&&typeof k.then=="function"?T.resolve(k):M.then(()=>k)}}),d.push(O=>{(!y||!uU)&&function(E,A){[].slice.call(A.db.objectStoreNames).forEach(P=>E[P]==null&&A.db.deleteObjectStore(P))}(w._cfg.dbschema,O),lf(s,[s.Transaction.prototype]),Ua(s,[s.Transaction.prototype],s._storeNames,s._dbSchema),l.schema=s._dbSchema})}),_().then(()=>{var w,O;O=f,ye(w=m).forEach(E=>{O.db.objectStoreNames.contains(E)||cl(O,E,w[E].primKey,w[E].indexes)})})}(e,t,o,r).catch(a)})}function mg(e,t){const r={del:[],add:[],change:[]};let n;for(n in e)t[n]||r.del.push(n);for(n in t){const i=e[n],o=t[n];if(i){const a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!dc)a.recreate=!0,r.change.push(a);else{const u=i.idxByName,s=o.idxByName;let c;for(c in u)s[c]||a.del.push(c);for(c in s){const l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(a.del.length>0||a.add.length>0||a.change.length>0)&&r.change.push(a)}}else r.add.push([n,o])}return r}function cl(e,t,r,n){const i=e.db.createObjectStore(t,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach(o=>ff(i,o)),i}function ff(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function df(e,t,r){const n={};return Da(t.objectStoreNames,0).forEach(i=>{const o=r.objectStore(i);let a=o.keyPath;const u=uf(pg(a),a||"",!1,!1,!!o.autoIncrement,a&&typeof a!="string",!0),s=[];for(let l=0;l<o.indexNames.length;++l){const f=o.index(o.indexNames[l]);a=f.keyPath;var c=uf(f.name,a,!!f.unique,!!f.multiEntry,!1,a&&typeof a!="string",!1);s.push(c)}n[i]=yg(i,u,s)}),n}function hf({_novip:e},t,r){const n=r.db.objectStoreNames;for(let i=0;i<n.length;++i){const o=n[i],a=r.objectStore(o);e._hasGetAll="getAll"in a;for(let u=0;u<a.indexNames.length;++u){const s=a.indexNames[u],c=a.index(s).keyPath,l=typeof c=="string"?c:"["+Da(c).join("+")+"]";if(t[o]){const f=t[o].idxByName[l];f&&(f.name=s,delete t[o].idxByName[l],t[o].idxByName[s]=f)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&ue.WorkerGlobalScope&&ue instanceof ue.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class _U{_parseStoresSpec(t,r){ye(t).forEach(n=>{if(t[n]!==null){var i=t[n].split(",").map((a,u)=>{const s=(a=a.trim()).replace(/([&*]|\+\+)/g,""),c=/^\[/.test(s)?s.match(/^\[(.*)\]$/)[1].split("+"):s;return uf(s,c||null,/\&/.test(a),/\*/.test(a),/\+\+/.test(a),Me(c),u===0)}),o=i.shift();if(o.multi)throw new U.Schema("Primary key cannot be multi-valued");i.forEach(a=>{if(a.auto)throw new U.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new U.Schema("Index must have a name and cannot be an empty string")}),r[n]=yg(n,o,i)}})}stores(t){const r=this.db;this._cfg.storesSource=this._cfg.storesSource?Le(this._cfg.storesSource,t):t;const n=r._versions,i={};let o={};return n.forEach(a=>{Le(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),r._dbSchema=o,lf(r,[r._allTables,r,r.Transaction.prototype]),Ua(r,[r._allTables,r,r.Transaction.prototype,this._cfg.tables],ye(o),o),r._storeNames=ye(o),this}upgrade(t){return this._cfg.contentUpgrade=hd(this._cfg.contentUpgrade||re,t),this}}function md(e,t){let r=e._dbNamesDB;return r||(r=e._dbNamesDB=new Mr("__dbnames",{addons:[],indexedDB:e,IDBKeyRange:t}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function bd(e){return e&&typeof e.databases=="function"}function vf(e){return or(function(){return B.letThrough=!0,e()})}function wU(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(t){var r=function(){return indexedDB.databases().finally(t)};e=setInterval(r,100),r()}).finally(function(){return clearInterval(e)}):Promise.resolve()}function OU(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(()=>t.dbOpenError?_e(t.dbOpenError):e);wt&&(t.openCanceller._stackHolder=un()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const n=t.openCanceller;function i(){if(t.openCanceller!==n)throw new U.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,u=!1;return T.race([n,(typeof navigator>"u"?T.resolve():wU()).then(()=>new T((s,c)=>{if(i(),!r)throw new U.MissingAPI;const l=e.name,f=t.autoSchema?r.open(l):r.open(l,Math.round(10*e.verno));if(!f)throw new U.MissingAPI;f.onerror=ft(c),f.onblocked=ce(e._fireOnBlocked),f.onupgradeneeded=ce(d=>{if(a=f.transaction,t.autoSchema&&!e._options.allowEmptyDB){f.onerror=Ni,a.abort(),f.result.close();const m=r.deleteDatabase(l);m.onsuccess=m.onerror=ce(()=>{c(new U.NoSuchDatabase(`Database ${l} doesnt exist`))})}else{a.onerror=ft(c);var p=d.oldVersion>Math.pow(2,62)?0:d.oldVersion;u=p<1,e._novip.idbdb=f.result,gU(e,p/10,a,c)}},c),f.onsuccess=ce(()=>{a=null;const d=e._novip.idbdb=f.result,p=Da(d.objectStoreNames);if(p.length>0)try{const y=d.transaction((m=p).length===1?m[0]:m,"readonly");t.autoSchema?function({_novip:_},w,O){_.verno=w.version/10;const E=_._dbSchema=df(0,w,O);_._storeNames=Da(w.objectStoreNames,0),Ua(_,[_._allTables],ye(E),E)}(e,d,y):(hf(e,e._dbSchema,y),function(_,w){const O=mg(df(0,_.idbdb,w),_._dbSchema);return!(O.add.length||O.change.some(E=>E.add.length||E.change.length))}(e,y)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),cf(e,y)}catch{}var m;Ai.push(e),d.onversionchange=ce(y=>{t.vcFired=!0,e.on("versionchange").fire(y)}),d.onclose=ce(y=>{e.on("close").fire(y)}),u&&function({indexedDB:y,IDBKeyRange:_},w){!bd(y)&&w!=="__dbnames"&&md(y,_).put({name:w}).catch(re)}(e._deps,l),s()},c)}))]).then(()=>(i(),t.onReadyBeingFired=[],T.resolve(vf(()=>e.on.ready.fire(e.vip))).then(function s(){if(t.onReadyBeingFired.length>0){let c=t.onReadyBeingFired.reduce(hd,re);return t.onReadyBeingFired=[],T.resolve(vf(()=>c(e.vip))).then(s)}}))).finally(()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(()=>e).catch(s=>{t.dbOpenError=s;try{a&&a.abort()}catch{}return n===t.openCanceller&&e._close(),_e(s)}).finally(()=>{t.openComplete=!0,o()})}function pf(e){var t=o=>e.next(o),r=i(t),n=i(o=>e.throw(o));function i(o){return a=>{var u=o(a),s=u.value;return u.done?s:s&&typeof s.then=="function"?s.then(r,n):Me(s)?Promise.all(s).then(r,n):r(s)}}return i(t)()}function SU(e,t,r){var n=arguments.length;if(n<2)throw new U.InvalidArgument("Too few arguments");for(var i=new Array(n-1);--n;)i[n-1]=arguments[n];r=i.pop();var o=Jb(i);return[e,o,r]}function bg(e,t,r,n,i){return T.resolve().then(()=>{const o=B.transless||B,a=e._createTransaction(t,r,e._dbSchema,n),u={trans:a,transless:o};if(n)a.idbtrans=n.idbtrans;else try{a.create(),e._state.PR1398_maxLoop=3}catch(f){return f.name===dd.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(()=>bg(e,t,r,null,i))):_e(f)}const s=ld(i);let c;s&&li();const l=T.follow(()=>{if(c=i.call(a,a),c)if(s){var f=Bt.bind(null,null);c.then(f,f)}else typeof c.next=="function"&&typeof c.throw=="function"&&(c=pf(c))},u);return(c&&typeof c.then=="function"?T.resolve(c).then(f=>a.active?f:_e(new U.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):l.then(()=>c)).then(f=>(n&&a._resolve(),a._completion.then(()=>f))).catch(f=>(a._reject(f),_e(f)))})}function oa(e,t,r){const n=Me(e)?e.slice():[e];for(let i=0;i<r;++i)n.push(t);return n}const EU={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const r=e.table(t),{schema:n}=r,i={},o=[];function a(l,f,d){const p=Ci(l),m=i[p]=i[p]||[],y=l==null?0:typeof l=="string"?1:l.length,_=f>0,w={...d,isVirtual:_,keyTail:f,keyLength:y,extractKey:sf(l),unique:!_&&d.unique};return m.push(w),w.isPrimaryKey||o.push(w),y>1&&a(y===2?l[0]:l.slice(0,y-1),f+1,d),m.sort((O,E)=>O.keyTail-E.keyTail),w}const u=a(n.primaryKey.keyPath,0,n.primaryKey);i[":id"]=[u];for(const l of n.indexes)a(l.keyPath,0,l);function s(l){const f=l.query.index;return f.isVirtual?{...l,query:{index:f,range:(d=l.query.range,p=f.keyTail,{type:d.type===1?2:d.type,lower:oa(d.lower,d.lowerOpen?e.MAX_KEY:e.MIN_KEY,p),lowerOpen:!0,upper:oa(d.upper,d.upperOpen?e.MIN_KEY:e.MAX_KEY,p),upperOpen:!0})}}:l;var d,p}return{...r,schema:{...n,primaryKey:u,indexes:o,getIndexByKeyPath:function(l){const f=i[Ci(l)];return f&&f[0]}},count:l=>r.count(s(l)),query:l=>r.query(s(l)),openCursor(l){const{keyTail:f,isVirtual:d,keyLength:p}=l.query.index;return d?r.openCursor(s(l)).then(m=>m&&function(y){return Object.create(y,{continue:{value:function(w){w!=null?y.continue(oa(w,l.reverse?e.MAX_KEY:e.MIN_KEY,f)):l.unique?y.continue(y.key.slice(0,p).concat(l.reverse?e.MIN_KEY:e.MAX_KEY,f)):y.continue()}},continuePrimaryKey:{value(w,O){y.continuePrimaryKey(oa(w,e.MAX_KEY,f),O)}},primaryKey:{get:()=>y.primaryKey},key:{get(){const w=y.key;return p===1?w[0]:w.slice(0,p)}},value:{get:()=>y.value}})}(m)):r.openCursor(l)}}}}}};function gd(e,t,r,n){return r=r||{},n=n||"",ye(e).forEach(i=>{if(Je(t,i)){var o=e[i],a=t[i];if(typeof o=="object"&&typeof a=="object"&&o&&a){const u=Ql(o);u!==Ql(a)?r[n+i]=t[i]:u==="Object"?gd(o,a,r,n+i+"."):o!==a&&(r[n+i]=t[i])}else o!==a&&(r[n+i]=t[i])}else r[n+i]=void 0}),ye(t).forEach(i=>{Je(e,i)||(r[n+i]=t[i])}),r}const PU={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const r=e.table(t),{primaryKey:n}=r.schema;return{...r,mutate(o){const a=B.trans,{deleting:u,creating:s,updating:c}=a.table(t).hook;switch(o.type){case"add":if(s.fire===re)break;return a._promise("readwrite",()=>l(o),!0);case"put":if(s.fire===re&&c.fire===re)break;return a._promise("readwrite",()=>l(o),!0);case"delete":if(u.fire===re)break;return a._promise("readwrite",()=>l(o),!0);case"deleteRange":if(u.fire===re)break;return a._promise("readwrite",()=>function(d){return f(d.trans,d.range,1e4)}(o),!0)}return r.mutate(o);function l(d){const p=B.trans,m=d.keys||function(y,_){return _.type==="delete"?_.keys:_.keys||_.values.map(y.extractKey)}(n,d);if(!m)throw new Error("Keys missing");return(d=d.type==="add"||d.type==="put"?{...d,keys:m}:{...d}).type!=="delete"&&(d.values=[...d.values]),d.keys&&(d.keys=[...d.keys]),function(y,_,w){return _.type==="add"?Promise.resolve([]):y.getMany({trans:_.trans,keys:w,cache:"immutable"})}(r,d,m).then(y=>{const _=m.map((w,O)=>{const E=y[O],A={onerror:null,onsuccess:null};if(d.type==="delete")u.fire.call(A,w,E,p);else if(d.type==="add"||E===void 0){const P=s.fire.call(A,w,d.values[O],p);w==null&&P!=null&&(w=P,d.keys[O]=w,n.outbound||Ze(d.values[O],n.keyPath,w))}else{const P=gd(E,d.values[O]),x=c.fire.call(A,P,w,E,p);if(x){const C=d.values[O];Object.keys(x).forEach(k=>{Je(C,k)?C[k]=x[k]:Ze(C,k,x[k])})}}return A});return r.mutate(d).then(({failures:w,results:O,numFailures:E,lastResult:A})=>{for(let P=0;P<m.length;++P){const x=O?O[P]:m[P],C=_[P];x==null?C.onerror&&C.onerror(w[P]):C.onsuccess&&C.onsuccess(d.type==="put"&&y[P]?d.values[P]:x)}return{failures:w,results:O,numFailures:E,lastResult:A}}).catch(w=>(_.forEach(O=>O.onerror&&O.onerror(w)),Promise.reject(w)))})}function f(d,p,m){return r.query({trans:d,values:!1,query:{index:n,range:p},limit:m}).then(({result:y})=>l({type:"delete",keys:y,trans:d}).then(_=>_.numFailures>0?Promise.reject(_.failures[0]):y.length<m?{failures:[],numFailures:0,lastResult:void 0}:f(d,{...p,lower:y[y.length-1],lowerOpen:!0},m)))}}}}})};function gg(e,t,r){try{if(!t||t.keys.length<e.length)return null;const n=[];for(let i=0,o=0;i<t.keys.length&&o<e.length;++i)Fe(t.keys[i],e[o])===0&&(n.push(r?qo(t.values[i]):t.values[i]),++o);return n.length===e.length?n:null}catch{return null}}const $U={stack:"dbcore",level:-1,create:e=>({table:t=>{const r=e.table(t);return{...r,getMany:n=>{if(!n.cache)return r.getMany(n);const i=gg(n.keys,n.trans._cache,n.cache==="clone");return i?T.resolve(i):r.getMany(n).then(o=>(n.trans._cache={keys:n.keys,values:n.cache==="clone"?qo(o):o},o))},mutate:n=>(n.type!=="add"&&(n.trans._cache=null),r.mutate(n))}}})};function _d(e){return!("from"in e)}const $t=function(e,t){if(!this){const r=new $t;return e&&"d"in e&&Le(r,e),r}Le(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Wi(e,t,r){const n=Fe(t,r);if(isNaN(n))return;if(n>0)throw RangeError();if(_d(e))return Le(e,{from:t,to:r,d:1});const i=e.l,o=e.r;if(Fe(r,e.from)<0)return i?Wi(i,t,r):e.l={from:t,to:r,d:1,l:null,r:null},pp(e);if(Fe(t,e.to)>0)return o?Wi(o,t,r):e.r={from:t,to:r,d:1,l:null,r:null},pp(e);Fe(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Fe(r,e.to)>0&&(e.to=r,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wa(e,i),o&&a&&Wa(e,o)}function Wa(e,t){_d(t)||function r(n,{from:i,to:o,l:a,r:u}){Wi(n,i,o),a&&r(n,a),u&&r(n,u)}(e,t)}function AU(e,t){const r=yf(t);let n=r.next();if(n.done)return!1;let i=n.value;const o=yf(e);let a=o.next(i.from),u=a.value;for(;!n.done&&!a.done;){if(Fe(u.from,i.to)<=0&&Fe(u.to,i.from)>=0)return!0;Fe(i.from,u.from)<0?i=(n=r.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function yf(e){let t=_d(e)?null:{s:0,n:e};return{next(r){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Fe(r,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||Fe(r,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function pp(e){var t,r;const n=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((r=e.l)===null||r===void 0?void 0:r.d)||0),i=n>1?"r":n<-1?"l":"";if(i){const o=i==="r"?"l":"r",a={...e},u=e[i];e.from=u.from,e.to=u.to,e[i]=u[i],a[i]=u[o],e[o]=a,a.d=yp(a)}e.d=yp(e)}function yp({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}Vn($t.prototype,{add(e){return Wa(this,e),this},addKey(e){return Wi(this,e,e),this},addKeys(e){return e.forEach(t=>Wi(this,t,t)),this},[Gl](){return yf(this)}});const xU={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,r=new $t(e.MIN_KEY,e.MAX_KEY);return{...e,table:n=>{const i=e.table(n),{schema:o}=i,{primaryKey:a}=o,{extractKey:u,outbound:s}=a,c={...i,mutate:d=>{const p=d.trans,m=p.mutatedParts||(p.mutatedParts={}),y=x=>{const C=`idb://${t}/${n}/${x}`;return m[C]||(m[C]=new $t)},_=y(""),w=y(":dels"),{type:O}=d;let[E,A]=d.type==="deleteRange"?[d.range]:d.type==="delete"?[d.keys]:d.values.length<50?[[],d.values]:[];const P=d.trans._cache;return i.mutate(d).then(x=>{if(Me(E)){O!=="delete"&&(E=x.results),_.addKeys(E);const C=gg(E,P);C||O==="add"||w.addKeys(E),(C||A)&&function(k,M,N,K){function Y(Q){const H=k(Q.name||"");function Ie(ne){return ne!=null?Q.extractKey(ne):null}const Ce=ne=>Q.multiEntry&&Me(ne)?ne.forEach(le=>H.addKey(le)):H.addKey(ne);(N||K).forEach((ne,le)=>{const he=N&&Ie(N[le]),Ke=K&&Ie(K[le]);Fe(he,Ke)!==0&&(he!=null&&Ce(he),Ke!=null&&Ce(Ke))})}M.indexes.forEach(Y)}(y,o,C,A)}else if(E){const C={from:E.lower,to:E.upper};w.add(C),_.add(C)}else _.add(r),w.add(r),o.indexes.forEach(C=>y(C.name).add(r));return x})}},l=({query:{index:d,range:p}})=>{var m,y;return[d,new $t((m=p.lower)!==null&&m!==void 0?m:e.MIN_KEY,(y=p.upper)!==null&&y!==void 0?y:e.MAX_KEY)]},f={get:d=>[a,new $t(d.key)],getMany:d=>[a,new $t().addKeys(d.keys)],count:l,query:l,openCursor:l};return ye(f).forEach(d=>{c[d]=function(p){const{subscr:m}=B;if(m){const y=A=>{const P=`idb://${t}/${n}/${A}`;return m[P]||(m[P]=new $t)},_=y(""),w=y(":dels"),[O,E]=f[d](p);if(y(O.name||"").add(E),!O.isPrimaryKey){if(d!=="count"){const A=d==="query"&&s&&p.values&&i.query({...p,values:!1});return i[d].apply(this,arguments).then(P=>{if(d==="query"){if(s&&p.values)return A.then(({result:C})=>(_.addKeys(C),P));const x=p.values?P.result.map(u):P.result;p.values?_.addKeys(x):w.addKeys(x)}else if(d==="openCursor"){const x=P,C=p.values;return x&&Object.create(x,{key:{get:()=>(w.addKey(x.primaryKey),x.key)},primaryKey:{get(){const k=x.primaryKey;return w.addKey(k),k}},value:{get:()=>(C&&_.addKey(x.primaryKey),x.value)}})}return P})}w.add(r)}}return i[d].apply(this,arguments)}}),c}}}};class Mr{constructor(t,r){this._middlewares={},this.verno=0;const n=Mr.dependencies;this._options=r={addons:Mr.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...r},this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};const{addons:i}=r;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:re,dbReadyPromise:null,cancelOpen:re,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var a;o.dbReadyPromise=new T(u=>{o.dbReadyResolve=u}),o.openCanceller=new T((u,s)=>{o.cancelOpen=s}),this._state=o,this.name=t,this.on=xi(this,"populate","blocked","versionchange","close",{ready:[hd,re]}),this.on.ready.subscribe=zb(this.on.ready.subscribe,u=>(s,c)=>{Mr.vip(()=>{const l=this._state;if(l.openComplete)l.dbOpenError||T.resolve().then(s),c&&u(s);else if(l.onReadyBeingFired)l.onReadyBeingFired.push(s),c&&u(s);else{u(s);const f=this;c||u(function d(){f.on.ready.unsubscribe(s),f.on.ready.unsubscribe(d)})}})}),this.Collection=(a=this,yi(fU.prototype,function(u,s){this.db=a;let c=dg,l=null;if(s)try{c=s()}catch(m){l=m}const f=u._ctx,d=f.table,p=d.hook.reading.fire;this._ctx={table:d,index:f.index,isPrimKey:!f.index||d.schema.primKey.keyPath&&f.index===d.schema.primKey.name,range:c,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:l,or:f.or,valueMapper:p!==Li?p:null}})),this.Table=function(u){return yi(lU.prototype,function(s,c,l){this.db=u,this._tx=l,this.name=s,this.schema=c,this.hook=u._allTables[s]?u._allTables[s].hook:xi(null,{creating:[JN,re],reading:[YN,Li],updating:[ZN,re],deleting:[XN,re]})})}(this),this.Transaction=function(u){return yi(pU.prototype,function(s,c,l,f,d){this.db=u,this.mode=s,this.storeNames=c,this.schema=l,this.chromeTransactionDurability=f,this.idbtrans=null,this.on=xi(this,"complete","error","abort"),this.parent=d||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 T((p,m)=>{this._resolve=p,this._reject=m}),this._completion.then(()=>{this.active=!1,this.on.complete.fire()},p=>{var m=this.active;return this.active=!1,this.on.error.fire(p),this.parent?this.parent._reject(p):m&&this.idbtrans&&this.idbtrans.abort(),_e(p)})})}(this),this.Version=function(u){return yi(_U.prototype,function(s){this.db=u,this._cfg={version:s,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(u){return yi(vg.prototype,function(s,c,l){this.db=u,this._ctx={table:s,index:c===":id"?null:c,or:l};const f=u._deps.indexedDB;if(!f)throw new U.MissingAPI;this._cmp=this._ascending=f.cmp.bind(f),this._descending=(d,p)=>f.cmp(p,d),this._max=(d,p)=>f.cmp(d,p)>0?d:p,this._min=(d,p)=>f.cmp(d,p)<0?d:p,this._IDBKeyRange=u._deps.IDBKeyRange})}(this),this.on("versionchange",u=>{u.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()}),this.on("blocked",u=>{!u.newVersion||u.newVersion<u.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion/10}`)}),this._maxKey=Ui(r.IDBKeyRange),this._createTransaction=(u,s,c,l)=>new this.Transaction(u,s,c,this._options.chromeTransactionDurability,l),this._fireOnBlocked=u=>{this.on("blocked").fire(u),Ai.filter(s=>s.name===this.name&&s!==this&&!s._state.vcFired).map(s=>s.on("versionchange").fire(u))},this.use(EU),this.use(PU),this.use(xU),this.use($U),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach(u=>u(this))}version(t){if(isNaN(t)||t<.1)throw new U.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new U.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);const r=this._versions;var n=r.filter(i=>i._cfg.version===t)[0];return n||(n=new this.Version(t),r.push(n),r.sort(bU),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(t){return this.idbdb&&(this._state.openComplete||B.letThrough||this._vip)?t():new T((r,n)=>{if(this._state.openComplete)return n(new U.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void n(new U.DatabaseClosed);this.open().catch(re)}this._state.dbReadyPromise.then(r,n)}).then(t)}use({stack:t,create:r,level:n,name:i}){i&&this.unuse({stack:t,name:i});const o=this._middlewares[t]||(this._middlewares[t]=[]);return o.push({stack:t,create:r,level:n??10,name:i}),o.sort((a,u)=>a.level-u.level),this}unuse({stack:t,name:r,create:n}){return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(i=>n?i.create!==n:!!r&&i.name!==r)),this}open(){return OU(this)}_close(){const t=this._state,r=Ai.indexOf(this);if(r>=0&&Ai.splice(r,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new T(n=>{t.dbReadyResolve=n}),t.openCanceller=new T((n,i)=>{t.cancelOpen=i})}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new U.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,r=this._state;return new T((n,i)=>{const o=()=>{this.close();var a=this._deps.indexedDB.deleteDatabase(this.name);a.onsuccess=ce(()=>{(function({indexedDB:u,IDBKeyRange:s},c){!bd(u)&&c!=="__dbnames"&&md(u,s).delete(c).catch(re)})(this._deps,this.name),n()}),a.onerror=ft(i),a.onblocked=this._fireOnBlocked};if(t)throw new U.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(o):o()})}backendDB(){return this.idbdb}isOpen(){return this.idbdb!==null}hasBeenClosed(){const t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"}hasFailed(){return this._state.dbOpenError!==null}dynamicallyOpened(){return this._state.autoSchema}get tables(){return ye(this._allTables).map(t=>this._allTables[t])}transaction(){const t=SU.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,r,n){let i=B.trans;i&&i.db===this&&t.indexOf("!")===-1||(i=null);const o=t.indexOf("?")!==-1;let a,u;t=t.replace("!","").replace("?","");try{if(u=r.map(c=>{var l=c instanceof this.Table?c.name:c;if(typeof l!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return l}),t=="r"||t==="readonly")a="readonly";else{if(t!="rw"&&t!="readwrite")throw new U.InvalidArgument("Invalid transaction mode: "+t);a="readwrite"}if(i){if(i.mode==="readonly"&&a==="readwrite"){if(!o)throw new U.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&u.forEach(c=>{if(i&&i.storeNames.indexOf(c)===-1){if(!o)throw new U.SubTransaction("Table "+c+" not included in parent transaction.");i=null}}),o&&i&&!i.active&&(i=null)}}catch(c){return i?i._promise(null,(l,f)=>{f(c)}):_e(c)}const s=bg.bind(null,this,a,u,i,n);return i?i._promise(a,s,"lock"):B.trans?fi(B.transless,()=>this._whenReady(s)):this._whenReady(s)}table(t){if(!Je(this._allTables,t))throw new U.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const CU=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable";class IU{constructor(t){this._subscribe=t}subscribe(t,r,n){return this._subscribe(t&&typeof t!="function"?t:{next:t,error:r,complete:n})}[CU](){return this}}function _g(e,t){return ye(t).forEach(r=>{Wa(e[r]||(e[r]=new $t),t[r])}),e}function RU(e){return new IU(t=>{const r=ld(e);let n=!1,i={},o={};const a={get closed(){return n},unsubscribe:()=>{n=!0,ur.storagemutated.unsubscribe(l)}};t.start&&t.start(a);let u=!1,s=!1;function c(){return ye(o).some(d=>i[d]&&AU(i[d],o[d]))}const l=d=>{_g(i,d),c()&&f()},f=()=>{if(u||n)return;i={};const d={},p=function(m){r&&li();const y=()=>or(e,{subscr:m,trans:null}),_=B.trans?fi(B.transless,y):y();return r&&_.then(Bt,Bt),_}(d);s||(ur("storagemutated",l),s=!0),u=!0,Promise.resolve(p).then(m=>{u=!1,n||(c()?f():(i={},o=d,t.next&&t.next(m)))},m=>{["DatabaseClosedError","AbortError"].includes(m?.name)||(u=!1,t.error&&t.error(m),a.unsubscribe())})};return f(),a})}let mf;try{mf={indexedDB:ue.indexedDB||ue.mozIndexedDB||ue.webkitIndexedDB||ue.msIndexedDB,IDBKeyRange:ue.IDBKeyRange||ue.webkitIDBKeyRange}}catch{mf={indexedDB:null,IDBKeyRange:null}}const yr=Mr;function wa(e){let t=It;try{It=!0,ur.storagemutated.fire(e)}finally{It=t}}Vn(yr,{...pa,delete:e=>new yr(e,{addons:[]}).delete(),exists:e=>new yr(e,{addons:[]}).open().then(t=>(t.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return function({indexedDB:t,IDBKeyRange:r}){return bd(t)?Promise.resolve(t.databases()).then(n=>n.map(i=>i.name).filter(i=>i!=="__dbnames")):md(t,r).toCollection().primaryKeys()}(yr.dependencies).then(e)}catch{return _e(new U.MissingAPI)}},defineClass:()=>function(e){Le(this,e)},ignoreTransaction:e=>B.trans?fi(B.transless,e):e(),vip:vf,async:function(e){return function(){try{var t=pf(e.apply(this,arguments));return t&&typeof t.then=="function"?t:T.resolve(t)}catch(r){return _e(r)}}},spawn:function(e,t,r){try{var n=pf(e.apply(r,t||[]));return n&&typeof n.then=="function"?n:T.resolve(n)}catch(i){return _e(i)}},currentTransaction:{get:()=>B.trans||null},waitFor:function(e,t){const r=T.resolve(typeof e=="function"?yr.ignoreTransaction(e):e).timeout(t||6e4);return B.trans?B.trans.waitFor(r):r},Promise:T,debug:{get:()=>wt,set:e=>{Zb(e,e==="dexie"?()=>!0:fg)}},derive:Cn,extend:Le,props:Vn,override:zb,Events:xi,on:ur,liveQuery:RU,extendObservabilitySet:_g,getByKeyPath:jt,setByKeyPath:Ze,delByKeyPath:function(e,t){typeof t=="string"?Ze(e,t,void 0):"length"in t&&[].map.call(t,function(r){Ze(e,r,void 0)})},shallowClone:Yb,deepClone:qo,getObjectDiff:gd,cmp:Fe,asap:Qb,minKey:-(1/0),addons:[],connections:Ai,errnames:dd,dependencies:mf,semVer:"4.0.0-alpha.4",version:"4.0.0-alpha.4".split(".").map(e=>parseInt(e)).reduce((e,t,r)=>e+t/Math.pow(10,2*r))}),yr.maxKey=Ui(yr.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(ur("storagemutated",e=>{if(!It){let t;dc?(t=document.createEvent("CustomEvent"),t.initCustomEvent("x-storagemutated-1",!0,!0,e)):t=new CustomEvent("x-storagemutated-1",{detail:e}),It=!0,dispatchEvent(t),It=!1}}),addEventListener("x-storagemutated-1",({detail:e})=>{It||wa(e)}));let It=!1;if(typeof BroadcastChannel<"u"){const e=new BroadcastChannel("x-storagemutated-1");typeof e.unref=="function"&&e.unref(),ur("storagemutated",t=>{It||e.postMessage(t)}),e.onmessage=t=>{t.data&&wa(t.data)}}else if(typeof self<"u"&&typeof navigator<"u"){ur("storagemutated",t=>{try{It||(typeof localStorage<"u"&&localStorage.setItem("x-storagemutated-1",JSON.stringify({trig:Math.random(),changedParts:t})),typeof self.clients=="object"&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach(r=>r.postMessage({type:"x-storagemutated-1",changedParts:t})))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",t=>{if(t.key==="x-storagemutated-1"){const r=JSON.parse(t.newValue);r&&wa(r.changedParts)}});const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:t}){t&&t.type==="x-storagemutated-1"&&wa(t.changedParts)})}T.rejectionMapper=function(e,t){if(!e||e instanceof In||e instanceof TypeError||e instanceof SyntaxError||!e.name||!up[e.name])return e;var r=new up[e.name](t||e.message,e);return"stack"in e&&kt(r,"stack",{get:function(){return this.inner.stack}}),r},Zb(wt,fg);var qa="docs",mp="deleted-docs",kU="changes",wg="dexie",Og=n2,bp=new Map,Oa=new Map;function jU(e,t,r,n){var i=ot(n.primaryKey),o="rxdb-dexie-"+e+"--"+n.version+"--"+t,a=Dt(bp,o,()=>{var u=(async()=>{var s=xe(r);s.autoOpen=!1;var c=new Mr(o,s),l={[qa]:TU(n),[kU]:"++sequence, id",[mp]:i+",_meta.lwt,[_meta.lwt+"+i+"]"};return c.version(1).stores(l),await c.open(),{dexieDb:c,dexieTable:c[qa],dexieDeletedTable:c[mp]}})();return bp.set(o,a),Oa.set(a,0),u});return a}async function MU(e){var t=await e,r=Oa.get(e),n=r-1;n===0?(t.dexieDb.close(),Oa.delete(e)):Oa.set(e,n)}function DU(e){if(e.indexes){var t=new Set;e.indexes.forEach(r=>{var n=$f(r);n.forEach(i=>{if(!t.has(i)){t.add(i);var o=tr(e,i);if(o.type==="boolean")throw I("DXE1",{schema:e,index:r,field:i})}})})}}var bf="__";function Vr(e){var t=e.split(".");if(t.length>1)return t.map(n=>Vr(n)).join(".");if(e.startsWith("|")){var r=e.substring(1);return bf+r}else return e}function Sg(e){var t=e.split(".");if(t.length>1)return t.map(n=>Sg(n)).join(".");if(e.startsWith(bf)){var r=e.substring(bf.length);return"|"+r}else return e}function Ka(e){if(!e||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(r=>Ka(r));if(typeof e=="object"){var t={};return Object.entries(e).forEach(([r,n])=>{typeof n=="object"&&(n=Ka(n)),t[Vr(r)]=n}),t}}function kn(e){if(!e||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(r=>kn(r));if(typeof e=="object"){var t={};return Object.entries(e).forEach(([r,n])=>{(typeof n=="object"||Array.isArray(e))&&(n=kn(n)),t[Sg(r)]=n}),t}}function TU(e){var t=[],r=ot(e.primaryKey);return t.push([r]),e.indexes&&e.indexes.forEach(n=>{var i=$f(n);t.push(i)}),t.push(["_meta.lwt",r]),t=t.map(n=>n.map(i=>Vr(i))),t.map(n=>n.length===1?n[0]:"["+n.join("+")+"]").join(", ")}async function gp(e,t){var r=await e,[n,i]=await Promise.all([r.dexieTable.bulkGet(t),r.dexieDeletedTable.bulkGet(t)]),o=i.slice(0);return n.forEach((a,u)=>{a&&(o[u]=a)}),o}function _p(e){return e===Sr?-1/0:e}function Eg(e,t){if(!t){if(typeof window>"u")throw new Error("IDBKeyRange missing");t=window.IDBKeyRange}var r=e.startKeys.map(_p),n=e.endKeys.map(_p),i;if(e.index.length===1){var o=r[0]===n[0];i=t.bound(r[0],n[0],o?!1:!e.inclusiveStart,o?!1:!e.inclusiveEnd)}else i=t.bound(r,n,!e.inclusiveStart,!e.inclusiveEnd);return i}async function wp(e,t){var r=await e.internals,n=t.query,i=n.skip?n.skip:0,o=n.limit?n.limit:1/0,a=i+o,u=t.queryPlan,s=!1;u.selectorSatisfiedByIndex||(s=Qf(e.schema,t.query));var c=Eg(u,r.dexieDb._options.IDBKeyRange),l=u.index,f=[];if(await r.dexieDb.transaction("r",r.dexieTable,async p=>{var m=p.idbtrans,y=m.objectStore(qa),_;if(l.length===1&&l[0]===e.primaryPath)_=y;else{var w;l.length===1?w=Vr(l[0]):w="["+l.map(E=>Vr(E)).join("+")+"]",_=y.index(w)}var O=_.openCursor(c);await new Promise(E=>{O.onsuccess=function(A){var P=A.target.result;if(P){var x=kn(P.value);!x._deleted&&(!s||s(x))&&f.push(x),u.sortFieldsSameAsIndexFields&&f.length===a?E():P.continue()}else E()}})}),!u.sortFieldsSameAsIndexFields){var d=Mm(e.schema,t.query);f=f.sort(d)}return f=f.slice(i,a),{documents:f}}async function FU(e,t){var r=await e.internals,n=t.queryPlan,i=n.index,o=Eg(n,r.dexieDb._options.IDBKeyRange),a=-1;return await r.dexieDb.transaction("r",r.dexieTable,async u=>{var s=u.idbtrans,c=s.objectStore(qa),l;if(i.length===1&&i[0]===e.primaryPath)l=c;else{var f;i.length===1?f=Vr(i[0]):f="["+i.map(p=>Vr(p)).join("+")+"]",l=c.index(f)}var d=l.count(o);a=await new Promise((p,m)=>{d.onsuccess=function(){p(d.result)},d.onerror=y=>m(y)})}),a}var LU=Ge(),BU=function(){function e(r,n,i,o,a,u,s){this.changes$=new ke.Subject,this.instanceId=LU++,this.storage=r,this.databaseName=n,this.collectionName=i,this.schema=o,this.internals=a,this.options=u,this.settings=s,this.primaryPath=ot(this.schema.primaryKey)}var t=e.prototype;return t.bulkWrite=async function(n,i){qt(this),n.forEach(l=>{if(!l.document._rev||l.previous&&!l.previous._rev)throw I("SNH",{args:{row:l}})});var o=await this.internals,a={success:[],error:[]},u=n.map(l=>l.document[this.primaryPath]),s;if(await o.dexieDb.transaction("rw",o.dexieTable,o.dexieDeletedTable,async()=>{var l=new Map,f=await gp(this.internals,u);f.forEach(_=>{var w=_&&kn(_);return w&&l.set(w[this.primaryPath],w),w}),s=eD(this,this.primaryPath,l,n,i),a.error=s.errors;var d=[],p=[],m=[],y=[];s.bulkInsertDocs.forEach(_=>{a.success.push(_.document),d.push(_.document)}),s.bulkUpdateDocs.forEach(_=>{var w=_.document[this.primaryPath];if(a.success.push(_.document),_.document._deleted&&_.previous&&!_.previous._deleted)p.push(w),m.push(_.document);else if(_.document._deleted&&_.previous&&_.previous._deleted)m.push(_.document);else if(!_.document._deleted)d.push(_.document);else throw I("SNH",{args:{row:_}})}),await Promise.all([d.length>0?o.dexieTable.bulkPut(d.map(_=>Ka(_))):Ct,p.length>0?o.dexieTable.bulkDelete(p):Ct,m.length>0?o.dexieDeletedTable.bulkPut(m.map(_=>Ka(_))):Ct,y.length>0?o.dexieDeletedTable.bulkDelete(y):Ct])}),s=fe(s),s.eventBulk.events.length>0){var c=fe(s.newestRow).document;s.eventBulk.checkpoint={id:c[this.primaryPath],lwt:c._meta.lwt},s.eventBulk.endTime=Ge(),this.changes$.next(s.eventBulk)}return a},t.findDocumentsById=async function(n,i){qt(this);var o=await this.internals,a=[];return await o.dexieDb.transaction("r",o.dexieTable,o.dexieDeletedTable,async()=>{var u;i?u=await gp(this.internals,n):u=await o.dexieTable.bulkGet(n),n.forEach((s,c)=>{var l=u[c];l&&(!l._deleted||i)&&a.push(kn(l))})}),a},t.query=function(n){return qt(this),wp(this,n)},t.count=async function(n){if(n.queryPlan.selectorSatisfiedByIndex){var i=await FU(this,n);return{count:i,mode:"fast"}}else{var o=await wp(this,n);return{count:o.documents.length,mode:"slow"}}},t.info=async function(){var n=await this.internals,i={totalCount:-1};return await n.dexieDb.transaction("r",n.dexieTable,n.dexieDeletedTable,async o=>{var[a,u]=await Promise.all([n.dexieTable.count(),n.dexieDeletedTable.count()]);i.totalCount=a+u}),i},t.getChangedDocumentsSince=async function(n,i){qt(this);var o=i?i.lwt:Af,a=i?i.id:"",u=await this.internals,[s,c]=await Promise.all([u.dexieTable,u.dexieDeletedTable].map(async d=>{var p=d.where("[_meta.lwt+"+this.primaryPath+"]").above([o,a]).limit(n),m=await p.toArray();return m.map(y=>kn(y))})),l=s.slice(0);Mn(l,c),l=rw(this.primaryPath,l),l=l.slice(0,n);var f=J0(l);return{documents:l,checkpoint:f?{id:f[this.primaryPath],lwt:f._meta.lwt}:i||{id:"",lwt:0}}},t.changeStream=function(){return qt(this),this.changes$.asObservable()},t.cleanup=async function(n){qt(this);var i=await this.internals;return await i.dexieDb.transaction("rw",i.dexieDeletedTable,async()=>{var o=Ge()-n,a=await i.dexieDeletedTable.where("_meta.lwt").below(o).toArray(),u=a.map(s=>s[this.primaryPath]);await i.dexieDeletedTable.bulkDelete(u)}),!0},t.getAttachmentData=function(n,i,o){throw qt(this),new Error("Attachments are not implemented in the dexie RxStorage. Make a pull request.")},t.remove=async function(){qt(this);var n=await this.internals;return await Promise.all([n.dexieDeletedTable.clear(),n.dexieTable.clear()]),this.close()},t.close=function(){return this.closed?this.closed:(this.closed=(async()=>{this.changes$.complete(),await MU(this.internals)})(),this.closed)},t.conflictResultionTasks=function(){return new ke.Subject},t.resolveConflictResultionTask=async function(n){},e}();async function NU(e,t,r){var n=jU(t.databaseName,t.collectionName,r,t.schema),i=new BU(e,t.databaseName,t.collectionName,t.schema,n,t.options,r);return await vL(wg,t,i),Promise.resolve(i)}function qt(e){if(e.closed)throw new Error("RxStorageInstanceDexie is closed "+e.databaseName+"-"+e.collectionName)}var UU=function(){function e(r){this.name=wg,this.statics=Og,this.settings=r}var t=e.prototype;return t.createStorageInstance=function(n){return nD(n),DU(n.schema),NU(this,n,this.settings)},e}();function WU(e={}){var t=new UU(e);return t}function qU(e){var t=Object.prototype.toString.call(e.queryObj)==="[object Object]";if(!t)throw ve("QU11",{op:e.op,collection:e.collection.name,queryObj:e.queryObj});var r=["selector","limit","skip","sort","index"];if(Object.keys(e.queryObj).forEach(n=>{if(!r.includes(n))throw ve("QU11",{op:e.op,collection:e.collection.name,queryObj:e.queryObj,key:n,args:{validKeys:r}})}),e.op==="count"&&(e.queryObj.limit||e.queryObj.skip))throw I("QU15",{collection:e.collection.name,query:e.queryObj});Ha(e.queryObj)}function KU(e){var t=e.rxQuery.collection.schema.jsonSchema,r=e.mangoQuery.selector,n=Object.keys(t.properties);Object.keys(r).filter(u=>!u.startsWith("$")).filter(u=>!u.includes(".")).forEach(u=>{if(!n.includes(u))throw I("QU13",{schema:t,field:u,query:e.mangoQuery})});var i=t.indexes?t.indexes:[],o=e.mangoQuery.index;if(o){var a=i.find(u=>Ri(u,o));if(!a)throw I("QU12",{collection:e.rxQuery.collection.name,query:e.mangoQuery,schema:t})}if(e.rxQuery.op==="count"&&!HU(e.rxQuery.collection.schema.jsonSchema,e.mangoQuery)&&!e.rxQuery.collection.database.allowSlowCount)throw I("QU14",{collection:e.rxQuery.collection,query:e.mangoQuery});e.mangoQuery.sort&&e.mangoQuery.sort.map(u=>Object.keys(u)[0]).filter(u=>!u.includes(".")).forEach(u=>{if(!n.includes(u))throw I("QU13",{schema:t,field:u,query:e.mangoQuery})}),Ha(e.mangoQuery)}function HU(e,t){var r=Og.prepareQuery(e,t);return r.queryPlan.selectorSatisfiedByIndex}function Ha(e){if(!(typeof e!="object"||e===null)){var t=Object.keys(e);t.forEach(r=>{var n=e[r];if(n instanceof RegExp)throw I("QU16",{field:r,query:e});Array.isArray(n)?n.forEach(i=>Ha(i)):Ha(n)})}}function VU(e,t){if(!e)throw I("DOC20",{primaryKey:e,document:t});if(e!==e.trim())throw I("DOC21",{primaryKey:e,document:t});if(e.includes("\r")||e.includes(`
|
|
27
|
-
`))throw I("DOC22",{primaryKey:e,document:t});if(e.includes('"'))throw I("DOC23",{primaryKey:e,document:t})}function zU(e){return!e||typeof e=="string"||typeof e=="number"?e:zp(e)}var QU="dev-mode",GU={name:QU,rxdb:!0,init:()=>{console.warn(["-------------- RxDB dev-mode warning -------------------------------","you are seeing this because you use the RxDB dev-mode plugin https://rxdb.info/dev-mode.html ","This is great in development mode, because it will run many checks to ensure","that you use RxDB correct. If you see this in production mode,","you did something wrong because the dev-mode plugin will decrease the performance.","","\uD83E\uDD17 Hint: To get the most out of RxDB, check out the Premium Plugins","to get access to faster storages and more professional features: https://rxdb.info/premium","---------------------------------------------------------------------"].join(`
|
|
28
|
-
`))},overwritable:{isDevMode(){return!0},deepFreezeWhenDevMode:zU,tunnelErrorMessage(e){if(!op[e])throw console.error("RxDB: Error-Code not known: "+e),new Error("Error-Code "+e+" not known, contact the maintainer");return op[e]}},hooks:{preCreateRxSchema:{after:MN},preCreateRxDatabase:{after:function(e){LN(e)}},preCreateRxCollection:{after:function(e){if(FN(e),DN(e.schema,e.methods),e.name.charAt(0)==="_")throw I("DB2",{name:e.name});if(!e.schema)throw I("DB4",{name:e.name,args:e})}},createRxDocument:{before:function(e){VU(e.primary,e.toJSON(!0))}},preCreateRxQuery:{after:function(e){qU(e)}},prePrepareQuery:{after:e=>{KU(e)}},createRxCollection:{after:e=>{il(e.creator.statics),il(e.creator.methods),il(e.creator.attachments),e.creator.schema&&e.creator.migrationStrategies&&TN(e.creator.schema,e.creator.migrationStrategies)}}}};uc(GU);uc($N);uc(xL);uc(OL);let YU,JU,XU;YU=new cc("ripple");Pg=await ZF({name:"ripple",storage:WU(),multiInstance:!0,eventReduce:!0});h4=Nl(YU);JU={title:"Torrent schema",description:"Describes a torrent",version:0,primaryKey:"infoHash",type:"object",properties:{infoHash:{type:"string",maxLength:255},options:{type:"object",properties:{paused:{type:"boolean"}}},state:{type:"object",properties:{magnet:{type:"string",maxLength:2**15},torrentFile:{type:"object"},name:{type:"string",maxLength:2**11},status:{type:"string",enum:["paused","checkingFiles","downloadingMetadata","downloading","finished","seeding","error"]},progress:{type:"number"},size:{type:"number"},peers:{type:"array",items:{type:"object",properties:{ip:{type:"string",maxLength:255},port:{type:"number"}}}},pieces:{type:"array",items:{type:"number"}},addedAt:{type:"number"},remainingTime:{type:"number"},peersCount:{type:"number"},seedersCount:{type:"number"},leechersCount:{type:"number"},downloaded:{type:"number"},uploaded:{type:"number"},downloadSpeed:{type:"number"},uploadSpeed:{type:"number"},ratio:{type:"number"},path:{type:"string",maxLength:255},files:{type:"array",items:{type:"object",properties:{status:{type:"string",enum:["paused","checking","downloading","finished","seeding","error"]},index:{type:"number"},name:{type:"string",maxLength:255},path:{type:"string",maxLength:255},pathArray:{type:"array",items:{type:"string",maxLength:255}},offset:{type:"number"},length:{type:"number"},downloaded:{type:"number"},progress:{type:"number"},selected:{type:"boolean"},priority:{type:"number"},downloadedRanges:{type:"array",items:{type:"object",properties:{start:{type:"number"},end:{type:"number"}}}},downloadSpeed:{type:"number"},streamBandwithLogs:{type:"array",items:{type:"object",properties:{timestamp:{type:"number"},byteLength:{type:"number"}}}}}}},streamBandwithLogs:{type:"array",items:{type:"object",properties:{timestamp:{type:"number"},byteLength:{type:"number"}}}}}}},required:["infoHash"]};XU={title:"Settings schema",description:"Describes the settings of the app",version:0,primaryKey:"id",type:"object",properties:{id:{type:"string",maxLength:255},paused:{type:"boolean"},throttle:{type:"number"},maxConnections:{type:"number"},downloadSpeedLimit:{type:"number"},downloadSpeedLimitEnabled:{type:"boolean"}}};let hc;xt={};hc={};hc.byteLength=t3;hc.toByteArray=n3;hc.fromByteArray=a3;var ht=[],Qe=[],ZU=typeof Uint8Array<"u"?Uint8Array:Array,ll="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var yn=0,e3=ll.length;yn<e3;++yn)ht[yn]=ll[yn],Qe[ll.charCodeAt(yn)]=yn;Qe["-".charCodeAt(0)]=62;Qe["_".charCodeAt(0)]=63;function $g(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function t3(e){var t=$g(e),r=t[0],n=t[1];return(r+n)*3/4-n}function r3(e,t,r){return(t+r)*3/4-r}function n3(e){var t,r=$g(e),n=r[0],i=r[1],o=new ZU(r3(e,n,i)),a=0,u=i>0?n-4:n,s;for(s=0;s<u;s+=4)t=Qe[e.charCodeAt(s)]<<18|Qe[e.charCodeAt(s+1)]<<12|Qe[e.charCodeAt(s+2)]<<6|Qe[e.charCodeAt(s+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=Qe[e.charCodeAt(s)]<<2|Qe[e.charCodeAt(s+1)]>>4,o[a++]=t&255),i===1&&(t=Qe[e.charCodeAt(s)]<<10|Qe[e.charCodeAt(s+1)]<<4|Qe[e.charCodeAt(s+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}function i3(e){return ht[e>>18&63]+ht[e>>12&63]+ht[e>>6&63]+ht[e&63]}function o3(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(i3(n));return i.join("")}function a3(e){for(var t,r=e.length,n=r%3,i=[],o=16383,a=0,u=r-n;a<u;a+=o)i.push(o3(e,a,a+o>u?u:a+o));return n===1?(t=e[r-1],i.push(ht[t>>2]+ht[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(ht[t>>10]+ht[t>>4&63]+ht[t<<2&63]+"=")),i.join("")}var wd={};wd.read=function(e,t,r,n,i){var o,a,u=i*8-n-1,s=(1<<u)-1,c=s>>1,l=-7,f=r?i-1:0,d=r?-1:1,p=e[t+f];for(f+=d,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=o*256+e[t+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=a*256+e[t+f],f+=d,l-=8);if(o===0)o=1-c;else{if(o===s)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-c}return(p?-1:1)*a*Math.pow(2,o-n)};wd.write=function(e,t,r,n,i,o){var a,u,s,c=o*8-i-1,l=(1<<c)-1,f=l>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,m=n?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),a+f>=1?t+=d/s:t+=d*Math.pow(2,1-f),t*s>=2&&(a++,s/=2),a+f>=l?(u=0,a=l):a+f>=1?(u=(t*s-1)*Math.pow(2,i),a=a+f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=u&255,p+=m,u/=256,i-=8);for(a=a<<i|u,c+=i;c>0;e[r+p]=a&255,p+=m,a/=256,c-=8);e[r+p-m]|=y*128};(function(e){var t=hc,r=wd,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=O,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,u.TYPED_ARRAY_SUPPORT=o(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{var b=new Uint8Array(1),h={foo:function(){return 42}};return Object.setPrototypeOf(h,Uint8Array.prototype),Object.setPrototypeOf(b,h),b.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function a(b){if(b>i)throw new RangeError('The value "'+b+'" is invalid for option "size"');var h=new Uint8Array(b);return Object.setPrototypeOf(h,u.prototype),h}function u(b,h,v){if(typeof b=="number"){if(typeof h=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(b)}return s(b,h,v)}u.poolSize=8192;function s(b,h,v){if(typeof b=="string")return d(b,h);if(ArrayBuffer.isView(b))return m(b);if(b==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(ze(b,ArrayBuffer)||b&&ze(b.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ze(b,SharedArrayBuffer)||b&&ze(b.buffer,SharedArrayBuffer)))return y(b,h,v);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var g=b.valueOf&&b.valueOf();if(g!=null&&g!==b)return u.from(g,h,v);var $=_(b);if($)return $;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return u.from(b[Symbol.toPrimitive]("string"),h,v);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}u.from=function(b,h,v){return s(b,h,v)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function c(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(b<0)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function l(b,h,v){return c(b),b<=0?a(b):h!==void 0?typeof v=="string"?a(b).fill(h,v):a(b).fill(h):a(b)}u.alloc=function(b,h,v){return l(b,h,v)};function f(b){return c(b),a(b<0?0:w(b)|0)}u.allocUnsafe=function(b){return f(b)},u.allocUnsafeSlow=function(b){return f(b)};function d(b,h){if((typeof h!="string"||h==="")&&(h="utf8"),!u.isEncoding(h))throw new TypeError("Unknown encoding: "+h);var v=E(b,h)|0,g=a(v),$=g.write(b,h);return $!==v&&(g=g.slice(0,$)),g}function p(b){for(var h=b.length<0?0:w(b.length)|0,v=a(h),g=0;g<h;g+=1)v[g]=b[g]&255;return v}function m(b){if(ze(b,Uint8Array)){var h=new Uint8Array(b);return y(h.buffer,h.byteOffset,h.byteLength)}return p(b)}function y(b,h,v){if(h<0||b.byteLength<h)throw new RangeError('"offset" is outside of buffer bounds');if(b.byteLength<h+(v||0))throw new RangeError('"length" is outside of buffer bounds');var g;return h===void 0&&v===void 0?g=new Uint8Array(b):v===void 0?g=new Uint8Array(b,h):g=new Uint8Array(b,h,v),Object.setPrototypeOf(g,u.prototype),g}function _(b){if(u.isBuffer(b)){var h=w(b.length)|0,v=a(h);return v.length===0||b.copy(v,0,0,h),v}if(b.length!==void 0)return typeof b.length!="number"||vi(b.length)?a(0):p(b);if(b.type==="Buffer"&&Array.isArray(b.data))return p(b.data)}function w(b){if(b>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return b|0}function O(b){return+b!=b&&(b=0),u.alloc(+b)}u.isBuffer=function(h){return h!=null&&h._isBuffer===!0&&h!==u.prototype},u.compare=function(h,v){if(ze(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),ze(v,Uint8Array)&&(v=u.from(v,v.offset,v.byteLength)),!u.isBuffer(h)||!u.isBuffer(v))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(h===v)return 0;for(var g=h.length,$=v.length,R=0,j=Math.min(g,$);R<j;++R)if(h[R]!==v[R]){g=h[R],$=v[R];break}return g<$?-1:$<g?1:0},u.isEncoding=function(h){switch(String(h).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(h,v){if(!Array.isArray(h))throw new TypeError('"list" argument must be an Array of Buffers');if(h.length===0)return u.alloc(0);var g;if(v===void 0)for(v=0,g=0;g<h.length;++g)v+=h[g].length;var $=u.allocUnsafe(v),R=0;for(g=0;g<h.length;++g){var j=h[g];if(ze(j,Uint8Array))R+j.length>$.length?u.from(j).copy($,R):Uint8Array.prototype.set.call($,j,R);else if(u.isBuffer(j))j.copy($,R);else throw new TypeError('"list" argument must be an Array of Buffers');R+=j.length}return $};function E(b,h){if(u.isBuffer(b))return b.length;if(ArrayBuffer.isView(b)||ze(b,ArrayBuffer))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);var v=b.length,g=arguments.length>2&&arguments[2]===!0;if(!g&&v===0)return 0;for(var $=!1;;)switch(h){case"ascii":case"latin1":case"binary":return v;case"utf8":case"utf-8":return hi(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v*2;case"hex":return v>>>1;case"base64":return Qo(b).length;default:if($)return g?-1:hi(b).length;h=(""+h).toLowerCase(),$=!0}}u.byteLength=E;function A(b,h,v){var g=!1;if((h===void 0||h<0)&&(h=0),h>this.length||((v===void 0||v>this.length)&&(v=this.length),v<=0)||(v>>>=0,h>>>=0,v<=h))return"";for(b||(b="utf8");;)switch(b){case"hex":return he(this,h,v);case"utf8":case"utf-8":return H(this,h,v);case"ascii":return ne(this,h,v);case"latin1":case"binary":return le(this,h,v);case"base64":return Q(this,h,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ke(this,h,v);default:if(g)throw new TypeError("Unknown encoding: "+b);b=(b+"").toLowerCase(),g=!0}}u.prototype._isBuffer=!0;function P(b,h,v){var g=b[h];b[h]=b[v],b[v]=g}u.prototype.swap16=function(){var h=this.length;if(h%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var v=0;v<h;v+=2)P(this,v,v+1);return this},u.prototype.swap32=function(){var h=this.length;if(h%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var v=0;v<h;v+=4)P(this,v,v+3),P(this,v+1,v+2);return this},u.prototype.swap64=function(){var h=this.length;if(h%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var v=0;v<h;v+=8)P(this,v,v+7),P(this,v+1,v+6),P(this,v+2,v+5),P(this,v+3,v+4);return this},u.prototype.toString=function(){var h=this.length;return h===0?"":arguments.length===0?H(this,0,h):A.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(h){if(!u.isBuffer(h))throw new TypeError("Argument must be a Buffer");return this===h?!0:u.compare(this,h)===0},u.prototype.inspect=function(){var h="",v=e.INSPECT_MAX_BYTES;return h=this.toString("hex",0,v).replace(/(.{2})/g,"$1 ").trim(),this.length>v&&(h+=" ... "),"<Buffer "+h+">"},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(h,v,g,$,R){if(ze(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),!u.isBuffer(h))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof h);if(v===void 0&&(v=0),g===void 0&&(g=h?h.length:0),$===void 0&&($=0),R===void 0&&(R=this.length),v<0||g>h.length||$<0||R>this.length)throw new RangeError("out of range index");if($>=R&&v>=g)return 0;if($>=R)return-1;if(v>=g)return 1;if(v>>>=0,g>>>=0,$>>>=0,R>>>=0,this===h)return 0;for(var j=R-$,G=g-v,ee=Math.min(j,G),ie=this.slice($,R),$e=h.slice(v,g),se=0;se<ee;++se)if(ie[se]!==$e[se]){j=ie[se],G=$e[se];break}return j<G?-1:G<j?1:0};function x(b,h,v,g,$){if(b.length===0)return-1;if(typeof v=="string"?(g=v,v=0):v>2147483647?v=2147483647:v<-2147483648&&(v=-2147483648),v=+v,vi(v)&&(v=$?0:b.length-1),v<0&&(v=b.length+v),v>=b.length){if($)return-1;v=b.length-1}else if(v<0)if($)v=0;else return-1;if(typeof h=="string"&&(h=u.from(h,g)),u.isBuffer(h))return h.length===0?-1:C(b,h,v,g,$);if(typeof h=="number")return h=h&255,typeof Uint8Array.prototype.indexOf=="function"?$?Uint8Array.prototype.indexOf.call(b,h,v):Uint8Array.prototype.lastIndexOf.call(b,h,v):C(b,[h],v,g,$);throw new TypeError("val must be string, number or Buffer")}function C(b,h,v,g,$){var R=1,j=b.length,G=h.length;if(g!==void 0&&(g=String(g).toLowerCase(),g==="ucs2"||g==="ucs-2"||g==="utf16le"||g==="utf-16le")){if(b.length<2||h.length<2)return-1;R=2,j/=2,G/=2,v/=2}function ee(Go,Yo){return R===1?Go[Yo]:Go.readUInt16BE(Yo*R)}var ie;if($){var $e=-1;for(ie=v;ie<j;ie++)if(ee(b,ie)===ee(h,$e===-1?0:ie-$e)){if($e===-1&&($e=ie),ie-$e+1===G)return $e*R}else $e!==-1&&(ie-=ie-$e),$e=-1}else for(v+G>j&&(v=j-G),ie=v;ie>=0;ie--){for(var se=!0,cn=0;cn<G;cn++)if(ee(b,ie+cn)!==ee(h,cn)){se=!1;break}if(se)return ie}return-1}u.prototype.includes=function(h,v,g){return this.indexOf(h,v,g)!==-1},u.prototype.indexOf=function(h,v,g){return x(this,h,v,g,!0)},u.prototype.lastIndexOf=function(h,v,g){return x(this,h,v,g,!1)};function k(b,h,v,g){v=Number(v)||0;var $=b.length-v;g?(g=Number(g),g>$&&(g=$)):g=$;var R=h.length;g>R/2&&(g=R/2);for(var j=0;j<g;++j){var G=parseInt(h.substr(j*2,2),16);if(vi(G))return j;b[v+j]=G}return j}function M(b,h,v,g){return sn(hi(h,b.length-v),b,v,g)}function N(b,h,v,g){return sn(mc(h),b,v,g)}function K(b,h,v,g){return sn(Qo(h),b,v,g)}function Y(b,h,v,g){return sn(bc(h,b.length-v),b,v,g)}u.prototype.write=function(h,v,g,$){if(v===void 0)$="utf8",g=this.length,v=0;else if(g===void 0&&typeof v=="string")$=v,g=this.length,v=0;else if(isFinite(v))v=v>>>0,isFinite(g)?(g=g>>>0,$===void 0&&($="utf8")):($=g,g=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var R=this.length-v;if((g===void 0||g>R)&&(g=R),h.length>0&&(g<0||v<0)||v>this.length)throw new RangeError("Attempt to write outside buffer bounds");$||($="utf8");for(var j=!1;;)switch($){case"hex":return k(this,h,v,g);case"utf8":case"utf-8":return M(this,h,v,g);case"ascii":case"latin1":case"binary":return N(this,h,v,g);case"base64":return K(this,h,v,g);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,h,v,g);default:if(j)throw new TypeError("Unknown encoding: "+$);$=(""+$).toLowerCase(),j=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(b,h,v){return h===0&&v===b.length?t.fromByteArray(b):t.fromByteArray(b.slice(h,v))}function H(b,h,v){v=Math.min(b.length,v);for(var g=[],$=h;$<v;){var R=b[$],j=null,G=R>239?4:R>223?3:R>191?2:1;if($+G<=v){var ee,ie,$e,se;switch(G){case 1:R<128&&(j=R);break;case 2:ee=b[$+1],(ee&192)===128&&(se=(R&31)<<6|ee&63,se>127&&(j=se));break;case 3:ee=b[$+1],ie=b[$+2],(ee&192)===128&&(ie&192)===128&&(se=(R&15)<<12|(ee&63)<<6|ie&63,se>2047&&(se<55296||se>57343)&&(j=se));break;case 4:ee=b[$+1],ie=b[$+2],$e=b[$+3],(ee&192)===128&&(ie&192)===128&&($e&192)===128&&(se=(R&15)<<18|(ee&63)<<12|(ie&63)<<6|$e&63,se>65535&&se<1114112&&(j=se))}}j===null?(j=65533,G=1):j>65535&&(j-=65536,g.push(j>>>10&1023|55296),j=56320|j&1023),g.push(j),$+=G}return Ce(g)}var Ie=4096;function Ce(b){var h=b.length;if(h<=Ie)return String.fromCharCode.apply(String,b);for(var v="",g=0;g<h;)v+=String.fromCharCode.apply(String,b.slice(g,g+=Ie));return v}function ne(b,h,v){var g="";v=Math.min(b.length,v);for(var $=h;$<v;++$)g+=String.fromCharCode(b[$]&127);return g}function le(b,h,v){var g="";v=Math.min(b.length,v);for(var $=h;$<v;++$)g+=String.fromCharCode(b[$]);return g}function he(b,h,v){var g=b.length;(!h||h<0)&&(h=0),(!v||v<0||v>g)&&(v=g);for(var $="",R=h;R<v;++R)$+=gc[b[R]];return $}function Ke(b,h,v){for(var g=b.slice(h,v),$="",R=0;R<g.length-1;R+=2)$+=String.fromCharCode(g[R]+g[R+1]*256);return $}u.prototype.slice=function(h,v){var g=this.length;h=~~h,v=v===void 0?g:~~v,h<0?(h+=g,h<0&&(h=0)):h>g&&(h=g),v<0?(v+=g,v<0&&(v=0)):v>g&&(v=g),v<h&&(v=h);var $=this.subarray(h,v);return Object.setPrototypeOf($,u.prototype),$};function oe(b,h,v){if(b%1!==0||b<0)throw new RangeError("offset is not uint");if(b+h>v)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(h,v,g){h=h>>>0,v=v>>>0,g||oe(h,v,this.length);for(var $=this[h],R=1,j=0;++j<v&&(R*=256);)$+=this[h+j]*R;return $},u.prototype.readUintBE=u.prototype.readUIntBE=function(h,v,g){h=h>>>0,v=v>>>0,g||oe(h,v,this.length);for(var $=this[h+--v],R=1;v>0&&(R*=256);)$+=this[h+--v]*R;return $},u.prototype.readUint8=u.prototype.readUInt8=function(h,v){return h=h>>>0,v||oe(h,1,this.length),this[h]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(h,v){return h=h>>>0,v||oe(h,2,this.length),this[h]|this[h+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(h,v){return h=h>>>0,v||oe(h,2,this.length),this[h]<<8|this[h+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(h,v){return h=h>>>0,v||oe(h,4,this.length),(this[h]|this[h+1]<<8|this[h+2]<<16)+this[h+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(h,v){return h=h>>>0,v||oe(h,4,this.length),this[h]*16777216+(this[h+1]<<16|this[h+2]<<8|this[h+3])},u.prototype.readIntLE=function(h,v,g){h=h>>>0,v=v>>>0,g||oe(h,v,this.length);for(var $=this[h],R=1,j=0;++j<v&&(R*=256);)$+=this[h+j]*R;return R*=128,$>=R&&($-=Math.pow(2,8*v)),$},u.prototype.readIntBE=function(h,v,g){h=h>>>0,v=v>>>0,g||oe(h,v,this.length);for(var $=v,R=1,j=this[h+--$];$>0&&(R*=256);)j+=this[h+--$]*R;return R*=128,j>=R&&(j-=Math.pow(2,8*v)),j},u.prototype.readInt8=function(h,v){return h=h>>>0,v||oe(h,1,this.length),this[h]&128?(255-this[h]+1)*-1:this[h]},u.prototype.readInt16LE=function(h,v){h=h>>>0,v||oe(h,2,this.length);var g=this[h]|this[h+1]<<8;return g&32768?g|4294901760:g},u.prototype.readInt16BE=function(h,v){h=h>>>0,v||oe(h,2,this.length);var g=this[h+1]|this[h]<<8;return g&32768?g|4294901760:g},u.prototype.readInt32LE=function(h,v){return h=h>>>0,v||oe(h,4,this.length),this[h]|this[h+1]<<8|this[h+2]<<16|this[h+3]<<24},u.prototype.readInt32BE=function(h,v){return h=h>>>0,v||oe(h,4,this.length),this[h]<<24|this[h+1]<<16|this[h+2]<<8|this[h+3]},u.prototype.readFloatLE=function(h,v){return h=h>>>0,v||oe(h,4,this.length),r.read(this,h,!0,23,4)},u.prototype.readFloatBE=function(h,v){return h=h>>>0,v||oe(h,4,this.length),r.read(this,h,!1,23,4)},u.prototype.readDoubleLE=function(h,v){return h=h>>>0,v||oe(h,8,this.length),r.read(this,h,!0,52,8)},u.prototype.readDoubleBE=function(h,v){return h=h>>>0,v||oe(h,8,this.length),r.read(this,h,!1,52,8)};function Ee(b,h,v,g,$,R){if(!u.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>$||h<R)throw new RangeError('"value" argument is out of bounds');if(v+g>b.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(h,v,g,$){if(h=+h,v=v>>>0,g=g>>>0,!$){var R=Math.pow(2,8*g)-1;Ee(this,h,v,g,R,0)}var j=1,G=0;for(this[v]=h&255;++G<g&&(j*=256);)this[v+G]=h/j&255;return v+g},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(h,v,g,$){if(h=+h,v=v>>>0,g=g>>>0,!$){var R=Math.pow(2,8*g)-1;Ee(this,h,v,g,R,0)}var j=g-1,G=1;for(this[v+j]=h&255;--j>=0&&(G*=256);)this[v+j]=h/G&255;return v+g},u.prototype.writeUint8=u.prototype.writeUInt8=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,1,255,0),this[v]=h&255,v+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,2,65535,0),this[v]=h&255,this[v+1]=h>>>8,v+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,2,65535,0),this[v]=h>>>8,this[v+1]=h&255,v+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,4,4294967295,0),this[v+3]=h>>>24,this[v+2]=h>>>16,this[v+1]=h>>>8,this[v]=h&255,v+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,4,4294967295,0),this[v]=h>>>24,this[v+1]=h>>>16,this[v+2]=h>>>8,this[v+3]=h&255,v+4},u.prototype.writeIntLE=function(h,v,g,$){if(h=+h,v=v>>>0,!$){var R=Math.pow(2,8*g-1);Ee(this,h,v,g,R-1,-R)}var j=0,G=1,ee=0;for(this[v]=h&255;++j<g&&(G*=256);)h<0&&ee===0&&this[v+j-1]!==0&&(ee=1),this[v+j]=(h/G>>0)-ee&255;return v+g},u.prototype.writeIntBE=function(h,v,g,$){if(h=+h,v=v>>>0,!$){var R=Math.pow(2,8*g-1);Ee(this,h,v,g,R-1,-R)}var j=g-1,G=1,ee=0;for(this[v+j]=h&255;--j>=0&&(G*=256);)h<0&&ee===0&&this[v+j+1]!==0&&(ee=1),this[v+j]=(h/G>>0)-ee&255;return v+g},u.prototype.writeInt8=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,1,127,-128),h<0&&(h=255+h+1),this[v]=h&255,v+1},u.prototype.writeInt16LE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,2,32767,-32768),this[v]=h&255,this[v+1]=h>>>8,v+2},u.prototype.writeInt16BE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,2,32767,-32768),this[v]=h>>>8,this[v+1]=h&255,v+2},u.prototype.writeInt32LE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,4,2147483647,-2147483648),this[v]=h&255,this[v+1]=h>>>8,this[v+2]=h>>>16,this[v+3]=h>>>24,v+4},u.prototype.writeInt32BE=function(h,v,g){return h=+h,v=v>>>0,g||Ee(this,h,v,4,2147483647,-2147483648),h<0&&(h=4294967295+h+1),this[v]=h>>>24,this[v+1]=h>>>16,this[v+2]=h>>>8,this[v+3]=h&255,v+4};function Pe(b,h,v,g,$,R){if(v+g>b.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("Index out of range")}function Re(b,h,v,g,$){return h=+h,v=v>>>0,$||Pe(b,h,v,4),r.write(b,h,v,g,23,4),v+4}u.prototype.writeFloatLE=function(h,v,g){return Re(this,h,v,!0,g)},u.prototype.writeFloatBE=function(h,v,g){return Re(this,h,v,!1,g)};function Ot(b,h,v,g,$){return h=+h,v=v>>>0,$||Pe(b,h,v,8),r.write(b,h,v,g,52,8),v+8}u.prototype.writeDoubleLE=function(h,v,g){return Ot(this,h,v,!0,g)},u.prototype.writeDoubleBE=function(h,v,g){return Ot(this,h,v,!1,g)},u.prototype.copy=function(h,v,g,$){if(!u.isBuffer(h))throw new TypeError("argument should be a Buffer");if(g||(g=0),!$&&$!==0&&($=this.length),v>=h.length&&(v=h.length),v||(v=0),$>0&&$<g&&($=g),$===g||h.length===0||this.length===0)return 0;if(v<0)throw new RangeError("targetStart out of bounds");if(g<0||g>=this.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("sourceEnd out of bounds");$>this.length&&($=this.length),h.length-v<$-g&&($=h.length-v+g);var R=$-g;return this===h&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(v,g,$):Uint8Array.prototype.set.call(h,this.subarray(g,$),v),R},u.prototype.fill=function(h,v,g,$){if(typeof h=="string"){if(typeof v=="string"?($=v,v=0,g=this.length):typeof g=="string"&&($=g,g=this.length),$!==void 0&&typeof $!="string")throw new TypeError("encoding must be a string");if(typeof $=="string"&&!u.isEncoding($))throw new TypeError("Unknown encoding: "+$);if(h.length===1){var R=h.charCodeAt(0);($==="utf8"&&R<128||$==="latin1")&&(h=R)}}else typeof h=="number"?h=h&255:typeof h=="boolean"&&(h=Number(h));if(v<0||this.length<v||this.length<g)throw new RangeError("Out of range index");if(g<=v)return this;v=v>>>0,g=g===void 0?this.length:g>>>0,h||(h=0);var j;if(typeof h=="number")for(j=v;j<g;++j)this[j]=h;else{var G=u.isBuffer(h)?h:u.from(h,$),ee=G.length;if(ee===0)throw new TypeError('The value "'+h+'" is invalid for argument "value"');for(j=0;j<g-v;++j)this[j+v]=G[j%ee]}return this};var di=/[^+/0-9A-Za-z-_]/g;function yc(b){if(b=b.split("=")[0],b=b.trim().replace(di,""),b.length<2)return"";for(;b.length%4!==0;)b=b+"=";return b}function hi(b,h){h=h||1/0;for(var v,g=b.length,$=null,R=[],j=0;j<g;++j){if(v=b.charCodeAt(j),v>55295&&v<57344){if(!$){if(v>56319){(h-=3)>-1&&R.push(239,191,189);continue}else if(j+1===g){(h-=3)>-1&&R.push(239,191,189);continue}$=v;continue}if(v<56320){(h-=3)>-1&&R.push(239,191,189),$=v;continue}v=($-55296<<10|v-56320)+65536}else $&&(h-=3)>-1&&R.push(239,191,189);if($=null,v<128){if((h-=1)<0)break;R.push(v)}else if(v<2048){if((h-=2)<0)break;R.push(v>>6|192,v&63|128)}else if(v<65536){if((h-=3)<0)break;R.push(v>>12|224,v>>6&63|128,v&63|128)}else if(v<1114112){if((h-=4)<0)break;R.push(v>>18|240,v>>12&63|128,v>>6&63|128,v&63|128)}else throw new Error("Invalid code point")}return R}function mc(b){for(var h=[],v=0;v<b.length;++v)h.push(b.charCodeAt(v)&255);return h}function bc(b,h){for(var v,g,$,R=[],j=0;j<b.length&&!((h-=2)<0);++j)v=b.charCodeAt(j),g=v>>8,$=v%256,R.push($),R.push(g);return R}function Qo(b){return t.toByteArray(yc(b))}function sn(b,h,v,g){for(var $=0;$<g&&!($+v>=h.length||$>=b.length);++$)h[$+v]=b[$];return $}function ze(b,h){return b instanceof h||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===h.name}function vi(b){return b!==b}var gc=function(){for(var b="0123456789abcdef",h=new Array(256),v=0;v<16;++v)for(var g=v*16,$=0;$<16;++$)h[g+$]=b[v]+b[$];return h}()})(xt);let s3;Ag=e=>({...e,created:e.created?.getTime(),info:e.info&&{...e.info,files:e.info.files&&e.info.files.map(t=>({...t,path:t.path.map(r=>xt.Buffer.from(r).toString("utf-8"))})),name:xt.Buffer.from(e.name).toString("utf-8"),pieces:xt.Buffer.from(e.info.pieces).toString("base64")},infoBuffer:e.infoBuffer&&xt.Buffer.from(e.infoBuffer).toString("base64"),infoHashBuffer:xt.Buffer.from(e.infoHashBuffer).toString("base64")});u3=e=>({...e,created:e.created?new Date(e.created):void 0,info:e.info&&{...e.info,files:e.info.files&&e.info.files.map(t=>({...t,path:t.path})),name:e.info.name,pieces:new Uint8Array(xt.Buffer.from(e.info.pieces,"base64"))},infoBuffer:e.infoBuffer&&new Uint8Array(xt.Buffer.from(e.infoBuffer,"base64")),infoHashBuffer:new Uint8Array(xt.Buffer.from(e.infoHashBuffer,"base64"))});s3=e=>({magnet:e.magnet,path:e.path,pieces:e.pieces,name:e.torrentFile?.name||"",status:e.status??"checkingFiles",progress:e.progress??0,size:e.torrentFile?.length||0,peers:[],addedAt:e.addedAt??Date.now(),remainingTime:e.remainingTime??0,peersCount:e.peersCount??0,seedersCount:e.seedersCount??0,leechersCount:e.leechersCount??0,downloaded:e.downloaded??0,uploaded:e.uploaded??0,downloadSpeed:e.downloadSpeed??0,uploadSpeed:e.uploadSpeed??0,ratio:e.ratio??0,files:e.files??e.torrentFile?.files?.map((t,r)=>({index:r,status:"checking",name:t.name,path:t.path,pathArray:e.torrentFile?.info?.files?.[r]?.path??t.path.split("/"),offset:t.offset,length:t.length,downloaded:0,progress:0,selected:!0,priority:1,downloadedRanges:[],downloadSpeed:0,streamBandwithLogs:[]})),streamBandwithLogs:e.streamBandwithLogs??[],torrentFile:e.torrentFile});v4=e=>({infoHash:e.infoHash,options:{paused:e.options?.paused??!1},state:s3(e.state??{})});const Op="0123456789abcdef",xg=[],Va=[];for(let e=0;e<256;e++)xg[e]=Op[e>>4&15]+Op[e&15],e<16&&(e<10?Va[48+e]=e:Va[97-10+e]=e);const Mt=e=>{const t=e.length;let r="",n=0;for(;n<t;)r+=xg[e[n++]];return r},fl=e=>{const t=e.length>>1,r=t<<1,n=new Uint8Array(t);let i=0,o=0;for(;o<r;)n[i++]=Va[e.charCodeAt(o++)]<<4|Va[e.charCodeAt(o++)];return n},c3=(e,t=0)=>{const r=e.length||0;if(!t){let a=r;for(;a--;)t+=e[a].length}const n=new Uint8Array(t);let i=t,o=r;for(;o--;)i-=e[o].length,n.set(e[o],i);return n};var On="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l3=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var aa=0;aa<On.length;aa++)l3[On.charCodeAt(aa)]=aa;var f3=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=On[t[r]>>2],i+=On[(t[r]&3)<<4|t[r+1]>>4],i+=On[(t[r+1]&15)<<2|t[r+2]>>6],i+=On[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const d3=new TextDecoder,Pt=(e,t)=>t?new TextDecoder(t).decode(e):d3.decode(e),h3=new TextEncoder,it=e=>h3.encode(e),v3=e=>f3(e),Sp=typeof window<"u"?window:self,Ep=Sp.crypto||Sp.msCrypto||{},Pp=Ep.subtle||Ep.webkitSubtle,p3={hex:Mt,base64:v3},y3=async(e,t,r="sha-1")=>{if(!Pp)throw new Error("no web crypto support");typeof e=="string"&&(e=it(e));const n=new Uint8Array(await Pp.digest(r,e));return t?p3[t](n):n};function Vo(e){const t=e<0?1:0;return e=Math.abs(Number(e||1)),Math.floor(Math.log10(e))+1+t}function Cg(e){return ArrayBuffer.isView(e)?"arraybufferview":Array.isArray(e)?"array":e instanceof Number?"number":e instanceof Boolean?"boolean":e instanceof Set?"set":e instanceof Map?"map":e instanceof String?"string":e instanceof ArrayBuffer?"arraybuffer":typeof e}function J(e,t,r){const n=[];let i=null;return J._encode(n,e),i=c3(n),J.bytes=i.length,ArrayBuffer.isView(t)?(t.set(i,r),t):i}J.bytes=-1;J._floatConversionDetected=!1;J._encode=function(e,t){if(t!=null)switch(Cg(t)){case"object":J.dict(e,t);break;case"map":J.dictMap(e,t);break;case"array":J.list(e,t);break;case"set":J.listSet(e,t);break;case"string":J.string(e,t);break;case"number":J.number(e,t);break;case"boolean":J.number(e,t);break;case"arraybufferview":J.buffer(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength));break;case"arraybuffer":J.buffer(e,new Uint8Array(t));break}};const vc=new Uint8Array([101]),Ig=new Uint8Array([100]),Rg=new Uint8Array([108]);J.buffer=function(e,t){e.push(it(t.length+":"),t)};J.string=function(e,t){e.push(it(it(t).byteLength+":"+t))};J.number=function(e,t){if(Number.isInteger(t))return e.push(it("i"+BigInt(t)+"e"));const r=2147483648,n=t/r<<0,i=t%r<<0,o=n*r+i;e.push(it("i"+o+"e")),o!==t&&!J._floatConversionDetected&&(J._floatConversionDetected=!0,console.warn('WARNING: Possible data corruption detected with value "'+t+'":','Bencoding only defines support for integers, value was converted to "'+o+'"'),console.trace())};J.dict=function(e,t){e.push(Ig);let r=0,n;const i=Object.keys(t).sort(),o=i.length;for(;r<o;r++)n=i[r],t[n]!=null&&(J.string(e,n),J._encode(e,t[n]));e.push(vc)};J.dictMap=function(e,t){e.push(Ig);const r=Array.from(t.keys()).sort();for(const n of r)t.get(n)!=null&&(ArrayBuffer.isView(n)?J._encode(e,n):J.string(e,String(n)),J._encode(e,t.get(n)));e.push(vc)};J.list=function(e,t){let r=0;const n=t.length;for(e.push(Rg);r<n;r++)t[r]!=null&&J._encode(e,t[r]);e.push(vc)};J.listSet=function(e,t){e.push(Rg);for(const r of t)r!=null&&J._encode(e,r);e.push(vc)};const m3=105,b3=58,g3=100,_3=108,Od=101;function kg(e,t,r){let n=0,i=1;for(let o=t;o<r;o++){const a=e[o];if(a<58&&a>=48){n=n*10+(a-48);continue}if(!(o===t&&a===43)){if(o===t&&a===45){i=-1;continue}if(a===46)break;throw new Error("not a number: buffer["+o+"] = "+a)}}return n*i}function W(e,t,r,n){return e==null||e.length===0?null:(typeof t!="number"&&n==null&&(n=t,t=void 0),typeof r!="number"&&n==null&&(n=r,r=void 0),W.position=0,W.encoding=n||null,W.data=ArrayBuffer.isView(e)?new Uint8Array(e.slice(t,r)):it(e),W.bytes=W.data.length,W.next())}W.bytes=0;W.position=0;W.data=null;W.encoding=null;W.next=function(){switch(W.data[W.position]){case g3:return W.dictionary();case _3:return W.list();case m3:return W.integer();default:return W.buffer()}};W.find=function(e){let t=W.position;const r=W.data.length,n=W.data;for(;t<r;){if(n[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")};W.dictionary=function(){W.position++;const e={};for(;W.data[W.position]!==Od;){const t=W.buffer();let r=Pt(t);r.includes("�")&&(r=Mt(t)),e[r]=W.next()}return W.position++,e};W.list=function(){W.position++;const e=[];for(;W.data[W.position]!==Od;)e.push(W.next());return W.position++,e};W.integer=function(){const e=W.find(Od),t=kg(W.data,W.position+1,e);return W.position+=e+1-W.position,t};W.buffer=function(){let e=W.find(b3);const t=kg(W.data,W.position,e),r=++e+t;return W.position=r,W.encoding?Pt(W.data.slice(e,r)):W.data.slice(e,r)};function w3(e){let t=2;for(const r of e)t+=zo(r);return t}function O3(e){let t=2;for(const[r,n]of e){const i=it(r).byteLength;t+=Vo(i)+1+i,t+=zo(n)}return t}function S3(e){let t=2;const r=Object.keys(e);for(let n=0;n<r.length;n++){const i=it(r[n]).byteLength;t+=Vo(i)+1+i,t+=zo(e[r[n]])}return t}function E3(e){const t=it(e).byteLength;return Vo(t)+1+t}function P3(e){const t=e.byteLength-e.byteOffset;return Vo(t)+1+t}function zo(e){if(e==null)return 0;const r=Cg(e);switch(r){case"arraybufferview":return P3(e);case"string":return E3(e);case"array":case"set":return w3(e);case"number":return 1+Vo(Math.floor(e))+1;case"bigint":return 1+e.toString().length+1;case"object":return S3(e);case"map":return O3(e);default:throw new TypeError(`Unsupported value of type "${r}"`)}}const $3=zo,$p={encode:J,decode:W,byteLength:zo,encodingLength:$3},Ap=[255,255,26,27,28,29,30,31,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255],A3=function(e){if(!ArrayBuffer.isView(e)&&typeof e!="string")throw new TypeError("base32.decode only takes Buffer or string as parameter");let t=0,r=0,n,i=0;ArrayBuffer.isView(e)||(e=it(e));const o=new Uint8Array(Math.ceil(e.length*5/8));for(let a=0;a<e.length&&e[a]!==61;a++){const u=e[a]-48;if(u<Ap.length)r=Ap[u],t<=3?(t=(t+5)%8,t===0?(n|=r,o[i]=n,i++,n=0):n|=255&r<<8-t):(t=(t+5)%8,n|=255&r>>>t,o[i]=n,i++,n=255&r<<8-t);else throw new Error("Invalid input - it is not base32 encoded string")}return o.subarray(0,i)};function x3(e){return e.reduce((t,r,n,i)=>((n===0||r!==i[n-1]+1)&&t.push([]),t[t.length-1].push(r),t),[]).map(t=>t.length>1?`${t[0]}-${t[t.length-1]}`:`${t[0]}`)}function C3(e){const t=(r,n=r)=>Array.from({length:n-r+1},(i,o)=>o+r);return e.reduce((r,n,i,o)=>{const a=n.split("-").map(u=>parseInt(u));return r.concat(t(...a))},[])}function dl(e){const t={},r=e.split("magnet:?")[1];(r&&r.length>=0?r.split("&"):[]).forEach(o=>{const a=o.split("=");if(a.length!==2)return;const u=a[0];let s=a[1];u==="dn"&&(s=decodeURIComponent(s).replace(/\+/g," ")),(u==="tr"||u==="xs"||u==="as"||u==="ws")&&(s=decodeURIComponent(s)),u==="kt"&&(s=decodeURIComponent(s).split("+")),u==="ix"&&(s=Number(s)),u==="so"&&(s=C3(decodeURIComponent(s).split(","))),t[u]?(Array.isArray(t[u])||(t[u]=[t[u]]),t[u].push(s)):t[u]=s});let i;return t.xt&&(Array.isArray(t.xt)?t.xt:[t.xt]).forEach(a=>{(i=a.match(/^urn:btih:(.{40})/))?t.infoHash=i[1].toLowerCase():(i=a.match(/^urn:btih:(.{32})/))?t.infoHash=Mt(A3(i[1])):(i=a.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=i[1].toLowerCase())}),t.xs&&(Array.isArray(t.xs)?t.xs:[t.xs]).forEach(a=>{(i=a.match(/^urn:btpk:(.{64})/))&&(t.publicKey=i[1].toLowerCase())}),t.infoHash&&(t.infoHashBuffer=fl(t.infoHash)),t.infoHashV2&&(t.infoHashV2Buffer=fl(t.infoHashV2)),t.publicKey&&(t.publicKeyBuffer=fl(t.publicKey)),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],(typeof t.tr=="string"||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],(typeof t.as=="string"||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),(typeof t.ws=="string"||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],(typeof t["x.pe"]=="string"||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}function I3(e){e=Object.assign({},e);let t=new Set;e.xt&&typeof e.xt=="string"&&t.add(e.xt),e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt)),e.infoHashBuffer&&t.add(`urn:btih:${Mt(e.infoHashBuffer)}`),e.infoHash&&t.add(`urn:btih:${e.infoHash}`),e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${Mt(e.infoHashV2Buffer)}`),e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const r=Array.from(t);r.length===1&&(e.xt=r[0]),r.length>1&&(e.xt=r),e.publicKeyBuffer&&(e.xs=`urn:btpk:${Mt(e.publicKeyBuffer)}`),e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`),e.name&&(e.dn=e.name),e.keywords&&(e.kt=e.keywords),e.announce&&(e.tr=e.announce),e.urlList&&(e.ws=e.urlList,delete e.as),e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let n="magnet:?";return Object.keys(e).filter(i=>i.length===2||i==="x.pe").forEach((i,o)=>{const a=Array.isArray(e[i])?e[i]:[e[i]];a.forEach((u,s)=>{(o>0||s>0)&&(i!=="kt"&&i!=="so"||s===0)&&(n+="&"),i==="dn"&&(u=encodeURIComponent(u).replace(/%20/g,"+")),(i==="tr"||i==="as"||i==="ws")&&(u=encodeURIComponent(u)),i==="xs"&&!u.startsWith("urn:btpk:")&&(u=encodeURIComponent(u)),i==="kt"&&(u=encodeURIComponent(u)),i!=="so"&&(i==="kt"&&s>0?n+=`+${u}`:n+=`${i}=${u}`)}),i==="so"&&(n+=`${i}=${x3(a)}`)}),n}function lt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function xp(e,t){for(var r="",n=0,i=-1,o=0,a,u=0;u<=e.length;++u){if(u<e.length)a=e.charCodeAt(u);else{if(a===47)break;a=47}if(a===47){if(!(i===u-1||o===1))if(i!==u-1&&o===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var s=r.lastIndexOf("/");if(s!==r.length-1){s===-1?(r="",n=0):(r=r.slice(0,s),n=r.length-1-r.lastIndexOf("/")),i=u,o=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=u,o=0;continue}}t&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+e.slice(i+1,u):r=e.slice(i+1,u),n=u-i-1;i=u,o=0}else a===46&&o!==-1?++o:o=-1}return r}function R3(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}var jn={resolve:function(){for(var t="",r=!1,n,i=arguments.length-1;i>=-1&&!r;i--){var o;i>=0?o=arguments[i]:(n===void 0&&(n=process.cwd()),o=n),lt(o),o.length!==0&&(t=o+"/"+t,r=o.charCodeAt(0)===47)}return t=xp(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if(lt(t),t.length===0)return".";var r=t.charCodeAt(0)===47,n=t.charCodeAt(t.length-1)===47;return t=xp(t,!r),t.length===0&&!r&&(t="."),t.length>0&&n&&(t+="/"),r?"/"+t:t},isAbsolute:function(t){return lt(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,r=0;r<arguments.length;++r){var n=arguments[r];lt(n),n.length>0&&(t===void 0?t=n:t+="/"+n)}return t===void 0?".":jn.normalize(t)},relative:function(t,r){if(lt(t),lt(r),t===r||(t=jn.resolve(t),r=jn.resolve(r),t===r))return"";for(var n=1;n<t.length&&t.charCodeAt(n)===47;++n);for(var i=t.length,o=i-n,a=1;a<r.length&&r.charCodeAt(a)===47;++a);for(var u=r.length,s=u-a,c=o<s?o:s,l=-1,f=0;f<=c;++f){if(f===c){if(s>c){if(r.charCodeAt(a+f)===47)return r.slice(a+f+1);if(f===0)return r.slice(a+f)}else o>c&&(t.charCodeAt(n+f)===47?l=f:f===0&&(l=0));break}var d=t.charCodeAt(n+f),p=r.charCodeAt(a+f);if(d!==p)break;d===47&&(l=f)}var m="";for(f=n+l+1;f<=i;++f)(f===i||t.charCodeAt(f)===47)&&(m.length===0?m+="..":m+="/..");return m.length>0?m+r.slice(a+l):(a+=l,r.charCodeAt(a)===47&&++a,r.slice(a))},_makeLong:function(t){return t},dirname:function(t){if(lt(t),t.length===0)return".";for(var r=t.charCodeAt(0),n=r===47,i=-1,o=!0,a=t.length-1;a>=1;--a)if(r=t.charCodeAt(a),r===47){if(!o){i=a;break}}else o=!1;return i===-1?n?"/":".":n&&i===1?"//":t.slice(0,i)},basename:function(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');lt(t);var n=0,i=-1,o=!0,a;if(r!==void 0&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var u=r.length-1,s=-1;for(a=t.length-1;a>=0;--a){var c=t.charCodeAt(a);if(c===47){if(!o){n=a+1;break}}else s===-1&&(o=!1,s=a+1),u>=0&&(c===r.charCodeAt(u)?--u===-1&&(i=a):(u=-1,i=s))}return n===i?i=s:i===-1&&(i=t.length),t.slice(n,i)}else{for(a=t.length-1;a>=0;--a)if(t.charCodeAt(a)===47){if(!o){n=a+1;break}}else i===-1&&(o=!1,i=a+1);return i===-1?"":t.slice(n,i)}},extname:function(t){lt(t);for(var r=-1,n=0,i=-1,o=!0,a=0,u=t.length-1;u>=0;--u){var s=t.charCodeAt(u);if(s===47){if(!o){n=u+1;break}continue}i===-1&&(o=!1,i=u+1),s===46?r===-1?r=u:a!==1&&(a=1):r!==-1&&(a=-1)}return r===-1||i===-1||a===0||a===1&&r===i-1&&r===n+1?"":t.slice(r,i)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return R3("/",t)},parse:function(t){lt(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return r;var n=t.charCodeAt(0),i=n===47,o;i?(r.root="/",o=1):o=0;for(var a=-1,u=0,s=-1,c=!0,l=t.length-1,f=0;l>=o;--l){if(n=t.charCodeAt(l),n===47){if(!c){u=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:f!==1&&(f=1):a!==-1&&(f=-1)}return a===-1||s===-1||f===0||f===1&&a===s-1&&a===u+1?s!==-1&&(u===0&&i?r.base=r.name=t.slice(1,s):r.base=r.name=t.slice(u,s)):(u===0&&i?(r.name=t.slice(1,a),r.base=t.slice(1,s)):(r.name=t.slice(u,a),r.base=t.slice(u,s)),r.ext=t.slice(a,s)),u>0?r.dir=t.slice(0,u-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};jn.posix=jn;var k3=jn;const Cp=wf(k3);let Ip;typeof queueMicrotask=="function"&&queueMicrotask.bind(typeof window<"u"?window:S);j3=async function j3(e){if(typeof e=="string"&&/^(stream-)?magnet:/.test(e)){const t=dl(e);if(!t.infoHash)throw new Error("Invalid torrent identifier");return t}else{if(typeof e=="string"&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return dl(`magnet:?xt=urn:btih:${e}`);if(ArrayBuffer.isView(e)&&e.length===20)return dl(`magnet:?xt=urn:btih:${Mt(e)}`);if(ArrayBuffer.isView(e))return await M3(e);if(e&&e.infoHash)return e.infoHash=e.infoHash.toLowerCase(),e.announce||(e.announce=[]),typeof e.announce=="string"&&(e.announce=[e.announce]),e.urlList||(e.urlList=[]),e;throw new Error("Invalid torrent identifier")}};async function M3(e){ArrayBuffer.isView(e)&&(e=$p.decode(e)),mr(e.info,"info"),mr(e.info["name.utf-8"]||e.info.name,"info.name"),mr(e.info["piece length"],"info['piece length']"),mr(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach(i=>{mr(typeof i.length=="number","info.files[0].length"),mr(i["path.utf-8"]||i.path,"info.files[0].path")}):mr(typeof e.info.length=="number","info.length");const t={info:e.info,infoBuffer:$p.encode(e.info),name:Pt(e.info["name.utf-8"]||e.info.name),announce:[]};t.infoHashBuffer=await y3(t.infoBuffer),t.infoHash=Mt(t.infoHashBuffer),e.info.private!==void 0&&(t.private=!!e.info.private),e["creation date"]&&(t.created=new Date(e["creation date"]*1e3)),e["created by"]&&(t.createdBy=Pt(e["created by"])),ArrayBuffer.isView(e.comment)&&(t.comment=Pt(e.comment)),Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach(i=>{i.forEach(o=>{t.announce.push(Pt(o))})}):e.announce&&t.announce.push(Pt(e.announce)),ArrayBuffer.isView(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]),t.urlList=(e["url-list"]||[]).map(i=>Pt(i)),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList));const r=e.info.files||[e.info];t.files=r.map((i,o)=>{const a=[].concat(t.name,i["path.utf-8"]||i.path||[]).map(u=>ArrayBuffer.isView(u)?Pt(u):u);return{path:Cp.join.apply(null,[Cp.sep].concat(a)).slice(1),name:a[a.length-1],length:i.length,offset:r.slice(0,o).reduce(Rp,0)}}),t.length=r.reduce(Rp,0);const n=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(n.offset+n.length)%t.pieceLength||t.pieceLength,t.pieces=D3(e.info.pieces),t}function Rp(e,t){return e+t.length}function D3(e){const t=[];for(let r=0;r<e.length;r+=20)t.push(Mt(e.slice(r,r+20)));return t}function mr(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}let T3;p4=I3;({torrents:T3}=await Pg.addCollections({torrents:{schema:JU}}).catch(e=>{throw e}));jg=T3;jg.preInsert(e=>{e.state.torrentFile=Ag(e.state.torrentFile),e.state.addedAt=Date.now()},!0);jg.postCreate((e,t)=>{const r=u3(e.state.torrentFile);Object.defineProperty(t.state,"torrentFile",{get:()=>r})});y4=async e=>{const{default:t}=await import("./shared-worker-05e72720.js").then(async m=>{await m.__tla;return m}),{magnet:r,torrentFile:n}={magnet:"magnet"in e?e.magnet:void 0,torrentFile:"torrentFile"in e?e.torrentFile:void 0},i=n?.infoHash??j3(r).infoHash;await _f(t.port,{key:"shared-worker-fkn-api"})("addTorrent",{infoHash:i,magnet:r,torrentFile:n&&Ag(n)})};m4=async e=>{const{default:t}=await import("./shared-worker-05e72720.js").then(async m=>{await m.__tla;return m});await _f(t.port,{key:"shared-worker-fkn-api"})("removeTorrent",{infoHash:e.infoHash,removeFiles:e.removeFiles})};b4=async e=>{const{default:t}=await import("./shared-worker-05e72720.js").then(async m=>{await m.__tla;return m});return _f(t.port,{key:"shared-worker-fkn-api"})("readTorrentFile",{infoHash:e.infoHash,filePath:e.filePath,offset:e.offset,size:e.size})};let zn;gf={};zn={};Object.defineProperty(zn,"__esModule",{value:!0});var F3=sr,L3=(0,F3.createContext)(null);zn.default=L3;var za={},B3=S&&S.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),N3=S&&S.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),U3=S&&S.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&B3(t,e,r);return N3(t,e),t},W3=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(za,"__esModule",{value:!0});var kp=U3(sr),q3=W3(zn),K3=function(e){var t=e.db,r=e.children,n=(0,kp.useMemo)(function(){return{db:t}},[t]);return kp.default.createElement(q3.default.Provider,{value:n},r)};za.default=K3;var qi={},Ki={},H3=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ki,"__esModule",{value:!0});var V3=sr,z3=H3(zn);function Q3(){var e=(0,V3.useContext)(z3.default).db;return e}Ki.default=Q3;var G3=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qi,"__esModule",{value:!0});var jp=sr,Y3=G3(Ki);function J3(e){var t=(0,jp.useState)(null),r=t[0],n=t[1],i=(0,Y3.default)();return(0,jp.useEffect)(function(){if(i){var o=i[e];if(o&&n(o),i.newCollections$){var a=i.newCollections$.subscribe(function(u){u[e]&&n(u[e])});return function(){a.unsubscribe()}}}},[i,e]),r}qi.default=J3;var Qa={},Hi={},Mg={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isRxQuery=e.isObject=e.getCancelablePromise=void 0;var t=function(i){var o=!1,a=new Promise(function(u,s){i.then(function(c){o||u(c)},function(c){o||s(c)})});return[a,function(){o=!0}]};e.getCancelablePromise=t;var r=function(i){return typeof i=="object"&&i!==null};e.isObject=r;var n=function(i){return(0,e.isObject)(i)&&"skip"in i&&"limit"in i&&"$"in i&&(0,e.isObject)(i.$)&&"subscribe"in i.$&&typeof i.$.subscribe=="function"};e.isRxQuery=n})(Mg);var Ue=S&&S.__assign||function(){return Ue=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ue.apply(this,arguments)};Object.defineProperty(Hi,"__esModule",{value:!0});var br=sr,Mp=Mg,We;(function(e){e[e.Reset=0]="Reset",e[e.FetchMore=1]="FetchMore",e[e.FetchPage=2]="FetchPage",e[e.FetchSuccess=3]="FetchSuccess",e[e.CountPages=4]="CountPages",e[e.QueryChanged=5]="QueryChanged"})(We||(We={}));var X3=function(e,t){switch(t.type){case We.Reset:return Ue(Ue({},e),{result:[],isFetching:!0,page:1});case We.FetchMore:return Ue(Ue({},e),{isFetching:!0,page:e.page+1});case We.FetchPage:return Ue(Ue({},e),{isFetching:!0,page:t.page});case We.CountPages:return Ue(Ue({},e),{pageCount:t.pageCount});case We.FetchSuccess:return Ue(Ue({},e),{result:t.docs,isFetching:!1,isExhausted:t.pageSize?t.pagination==="Infinite"?t.docs.length<e.page*t.pageSize:!1:!0});case We.QueryChanged:return Ue(Ue({},e),{isFetching:!0});default:return e}},Z3=function(e,t){if(!e)return[];if(e instanceof Map)return Array.from(e,function(n){var i=n[1];return t?i.toJSON():i});var r=Array.isArray(e)?e:[e];return t?r.map(function(n){return n.toJSON()}):r},e4=function(e){var t=Array.isArray(e)?e:[e];return t.length};function t4(e,t){t===void 0&&(t={});var r=t.pageSize,n=t.pagination,i=n===void 0?"Infinite":n,o=t.json,a={result:[],page:r?1:void 0,isFetching:!0,isExhausted:!1,pageCount:0},u=(0,br.useReducer)(X3,a),s=u[0],c=u[1],l=(0,br.useCallback)(function(m){!r||i!=="Traditional"||m<1||m>s.pageCount||c({type:We.FetchPage,page:m})},[r,i,s.pageCount]),f=(0,br.useCallback)(function(){!r||i!=="Infinite"||s.isFetching||s.isExhausted||c({type:We.FetchMore})},[r,i,s.isFetching,s.isExhausted]),d=(0,br.useCallback)(function(){r&&s.page!==1&&c({type:We.Reset})},[r,s.page]),p=(0,br.useCallback)(function(m){var y=m;r&&i==="Traditional"&&(y=y.skip((s.page-1)*r).limit(r)),r&&i==="Infinite"&&(y=y.limit(s.page*r)),c({type:We.QueryChanged});var _=y.$.subscribe(function(w){var O=Z3(w,o);c({type:We.FetchSuccess,docs:O,pagination:i,pageSize:r})});return function(){_.unsubscribe()}},[o,r,i,s.page]);return(0,br.useEffect)(function(){if(e&&(0,Mp.isRxQuery)(e))return p(e)},[e,p]),(0,br.useEffect)(function(){if(!(!e||!r||i!=="Traditional"||"then"in e)&&(0,Mp.isRxQuery)(e)){var m=e.$.subscribe(function(y){var _=e4(y);c({type:We.CountPages,pageCount:Math.ceil(_/r)})});return function(){m.unsubscribe()}}},[e,r,i]),{result:s.result,isFetching:s.isFetching,isExhausted:s.isExhausted,pageCount:s.pageCount,currentPage:s.page,fetchPage:l,fetchMore:f,resetList:d}}Hi.default=t4;var Sn=S&&S.__assign||function(){return Sn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Sn.apply(this,arguments)},Dg=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qa,"__esModule",{value:!0});var r4=sr,n4=Dg(qi),Dp=Dg(Hi);function i4(e,t,r){r===void 0&&(r={});var n=(0,n4.default)(e),i=(0,r4.useMemo)(function(){return!n||typeof t!="function"?null:t(n)},[n,t]);return r.json?((0,Dp.default)(i,Sn(Sn({},r),{json:!0}))):((0,Dp.default)(i,Sn(Sn({},r),{json:!1})))}Qa.default=i4;var pc={},o4=S&&S.__awaiter||function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function u(l){try{c(n.next(l))}catch(f){a(f)}}function s(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})},a4=S&&S.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(pc,"__esModule",{value:!0});pc.observeNewCollections=void 0;var u4=ke;pc.observeNewCollections={name:"new-collection-observer",rxdb:!0,prototypes:{RxDatabase:function(e){var t=new u4.Subject;e.newCollections$=t;var r=e.addCollections;e.addCollections=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return o4(this,void 0,void 0,function(){var o;return a4(this,function(a){switch(a.label){case 0:return[4,r.apply(this,n)];case 1:return o=a.sent(),t.next(o),[2,o]}})})}}}};(function(e){var t=S&&S.__createBinding||(Object.create?function(l,f,d,p){p===void 0&&(p=d);var m=Object.getOwnPropertyDescriptor(f,d);(!m||("get"in m?!f.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return f[d]}}),Object.defineProperty(l,p,m)}:function(l,f,d,p){p===void 0&&(p=d),l[p]=f[d]}),r=S&&S.__exportStar||function(l,f){for(var d in l)d!=="default"&&!Object.prototype.hasOwnProperty.call(f,d)&&t(f,l,d)},n=S&&S.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(e,"__esModule",{value:!0}),e.useRxQuery=e.useRxDB=e.useRxData=e.useRxCollection=e.Provider=e.Context=void 0;var i=zn;Object.defineProperty(e,"Context",{enumerable:!0,get:function(){return n(i).default}}),r(zn,e);var o=za;Object.defineProperty(e,"Provider",{enumerable:!0,get:function(){return n(o).default}}),r(za,e);var a=qi;Object.defineProperty(e,"useRxCollection",{enumerable:!0,get:function(){return n(a).default}}),r(qi,e);var u=Qa;Object.defineProperty(e,"useRxData",{enumerable:!0,get:function(){return n(u).default}}),r(Qa,e);var s=Ki;Object.defineProperty(e,"useRxDB",{enumerable:!0,get:function(){return n(s).default}}),r(Ki,e);var c=Hi;Object.defineProperty(e,"useRxQuery",{enumerable:!0,get:function(){return n(c).default}}),r(Hi,e),r(pc,e)})(gf);let s4,Tg,c4;({settings:s4}=await Pg.addCollections({settings:{schema:XU}}).catch(e=>{throw e}));Tg=s4;c4={id:"settings",paused:!1,throttle:0,maxConnections:0,downloadSpeedLimit:1e7,downloadSpeedLimitEnabled:!0};g4=()=>{const t=gf.useRxCollection("settings")?.find({selector:{id:"settings"}}),{result:r}=gf.useRxQuery(t);return r[0]};l4=async()=>await Tg.findOne().exec();l4().then(e=>{e||Tg.insert(c4)})})();export{d4 as R,Kw as _,Q0 as a,gf as b,xt as c,Pg as d,y4 as e,m4 as f,wf as g,b4 as h,ry as i,Tr as j,Dr as k,h4 as l,ke as m,u3 as n,Ag as o,j3 as p,p4 as q,sr as r,v4 as s,jg as t,g4 as u,l4 as v,__tla};
|