Repository navigation
Expand file tree
/
Copy pathsmi-webpush-sw.js
More file actions
14 lines (14 loc) · 168 KB
/
Copy pathsmi-webpush-sw.js
File metadata and controls
14 lines (14 loc) · 168 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=183)}([function(t,e,n){"use strict";(function(e){var n=function(t){return t&&t.Math===Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()}).call(this,n(116))},function(t,e,n){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";var r="object"==typeof document&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},function(t,e,n){"use strict";var r=n(42),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);t.exports=r?a:function(t){return function(){return o.apply(t,arguments)}}},function(t,e,n){"use strict";var r=n(42),i=Function.prototype.call;t.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},function(t,e,n){"use strict";var r=n(0),i=n(52),o=n(8),a=n(55),s=n(76),u=n(75),c=r.Symbol,f=i("wks"),l=u?c.for||c:c&&c.withoutSetter||a;t.exports=function(t){return o(f,t)||(f[t]=s&&o(c,t)?c[t]:l("Symbol."+t)),f[t]}},function(t,e,n){"use strict";var r=n(1);t.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,n){"use strict";var r=n(10),i=String,o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not an object")}},function(t,e,n){"use strict";var r=n(3),i=n(21),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},function(t,e,n){"use strict";n.d(e,"b",(function(){return O})),n.d(e,"a",(function(){return A})),n.d(e,"c",(function(){return j}));n(12);var r=n(13);let i,o;const a=new WeakMap,s=new WeakMap,u=new WeakMap,c=new WeakMap,f=new WeakMap;let l={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return s.get(t);if("objectStoreNames"===e)return t.objectStoreNames||u.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return d(t[e])},has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function h(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(o||(o=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(v(this),e),d(a.get(this))}:function(...e){return d(t.apply(v(this),e))}:function(e,...n){const r=t.call(v(this),e,...n);return u.set(r,e.sort?e.sort():[e]),d(r)}}function p(t){return"function"==typeof t?h(t):(t instanceof IDBTransaction&&function(t){if(s.has(t))return;const e=new Promise((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{e(),r()},o=()=>{n(t.error),r()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});s.set(t,e)}(t),e=t,(i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,l):t);var e}function d(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{e(d(t.result)),r()},o=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(e=>{e instanceof IDBCursor&&a.set(e,t)}).catch(()=>{}),f.set(e,t),e}(t);if(c.has(t))return c.get(t);const e=p(t);return e!==t&&(c.set(t,e),f.set(e,t)),e}const v=t=>f.get(t);const y=["get","getKey","getAll","getAllKeys","count"],m=["put","add","delete","clear"],g=new Map;function b(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(g.get(e))return g.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=m.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!y.includes(n))return;const o=async function(t,...e){const o=this.transaction(t,i?"readwrite":"readonly");let a=o.store;r&&(a=a.index(e.shift()));const s=a[n](...e);return i&&await o.done,s};return g.set(e,o),o}function w(){const t=Date.now();return Math.round(t/1e3)}l=(t=>({get:(e,n,r)=>b(e,n)||t.get(e,n,r),has:(e,n)=>!!b(e,n)||t.has(e,n)}))(l);class x{constructor(t){this.name=t,this.version=1,this.tables={},this._db=null}openDB(){const t=this;return function(t,e,{blocked:n,upgrade:r,blocking:i}={}){const o=indexedDB.open(t,e),a=d(o);return r&&o.addEventListener("upgradeneeded",t=>{r(d(o.result),t.oldVersion,t.newVersion,d(o.transaction))}),n&&o.addEventListener("blocked",()=>n()),i&&a.then(t=>t.addEventListener("versionchange",i)),a}(this.name,this.version,{upgrade(e){const{tables:n}=t;for(let t in n)n[t].createObjectStore(e)}})}_getDb(){return null===this._db&&(this._db=this.openDB()),this._db}async get(t,e){return(await this._getDb()).get(t,e)}async set(t,e,n){return(await this._getDb()).put(t,e,n)}async del(t,e){return(await this._getDb()).delete(t,e)}createTable(t,e){const{tables:n}=this;return n[t]||(n[t]=new _(this,t,e)),n[t]}getTable(t){return this.tables[t]}}class _{constructor(t,e,n){this.database=t,this.name=e,this.options=n}createObjectStore(t){t.createObjectStore(this.name,this.options)}async get(t){try{const e=await this.database.get(this.name,t);return this.cleanResult(t,e)}catch(t){return null}}set(t,e,n){let r=null;return n&&(r=w()+n),this.database.set(this.name,{key:t,value:e,expireTime:r})}del(t){return this.database.del(this.name,t)}async cleanResult(t,e){if(!e)return null;const{value:n,expireTime:r}=e;return r&&function(t){return t<w()}(r)?(await this.database.del(this.name,t),null):n}}n(40),n(46),n(114),n(68),n(98),n(99),n(100),n(101);class S{constructor(t){this.optionTable=t}getSubscription(){return this.optionTable.get("subscription")}setSubscription(t){return this.optionTable.set("subscription",t)}async getOrCreateUserId(){let t=await this.getUserId();return t||(t=function(){let t="",e=null;return"undefined"!=typeof window&&(e=window.crypto||window.msCrypto),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e?t=>{var n=e.getRandomValues(new Uint8Array(1))[0]%16|0;return("x"==t?n:3&n|8).toString(16)}:t=>{var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}),t}(),this.setUserId(t)),t}getUserId(){return this.optionTable.get("user_id")}setUserId(t){return this.optionTable.set("user_id",t)}async getProjectConfig(t){const e=await this.optionTable.get("project_config");return e&&t&&e.project_id!==t?null:e}setProjectConfig(t){return this.optionTable.set("project_config",t,3600)}async getExtraData(){const t=await this.getSubscription();if(!t)return null;const{extra_data:e=null}=t;return e}setCustomPromptPermission(t){return this.optionTable.set("custom_prompt_permission",t)}getCustomPromptPermission(){return this.optionTable.get("custom_prompt_permission")}}class C{constructor(t){this.endpoint=t}getProjectConfig(t){return this.get(`projects/${t}/config`)}saveProjectSubscription(t){return this.post("subscriptions",t)}get(t,e){return this.call("GET",t,e)}post(t,e){return this.call("POST",t,e)}async call(t,e,n){const i={"Smi-Webpush-Version":"sw-"+r.d,"Content-Type":"application/json;charset=UTF-8"};await async function(t){if("userAgentData"in navigator){const e=await navigator.userAgentData.getHighEntropyValues(["architecture","bitness","brands","mobile","model","platform","platformVersion","uaFullVersion","fullVersionList","wow64"]);t["X-Sec-CH-UA"]=e.brands.map(t=>`"${t.brand}";v="${t.version}"`).join(", "),t["X-Sec-CH-UA-Full-Version-List"]=e.fullVersionList.map(t=>`"${t.brand}";v="${t.version}"`).join(", "),t["X-Sec-CH-UA-Platform"]=e.platform,t["X-Sec-CH-UA-Platform-Version"]=e.platformVersion,t["X-Sec-CH-UA-Arch"]=e.architecture,t["X-Sec-CH-UA-Mobile"]=""+(e.mobile?1:0),t["X-Sec-CH-UA-Full-Version"]=e.uaFullVersion,t["X-Sec-CH-UA-Wow64"]=""+(e.wow64?1:0),t["X-Sec-CH-UA-Bitness"]=e.bitness,t["X-Sec-CH-UA-Model"]=e.model}}(i);const o={method:t,headers:i,cache:"no-cache"};return n&&(o.body=JSON.stringify(n)),fetch(`${this.endpoint}/${e}`,o)}}var E=n(24);const k=n.n(E)()("smi-webpush:ResourceLoader");class P{constructor(t){this.appCssUrl=t,this.cache={}}loadAppCss(){return k("load app css"),this.loadCss(this.appCssUrl)}loadCss(t){const e=this.cache[t];if(e)return e;const n=new Promise((e,n)=>{const r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href",t),r.onerror=()=>{k("Failed to load "+t),n(1)},r.onload=()=>e(0);const i=document.querySelector("head");if(!i)return k("Cannot find head"),void n(1);i.appendChild(r)});return this.cache[t]=n,n}}const O=function(){const t=new x(r.b).createTable("Option",{keyPath:"key"});return new S(t)}(),A=new C(r.c),j=new P(r.a)},function(t,e,n){"use strict";var r=n(2);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},function(t,e,n){"use strict";var r=n(0),i=n(71).f,o=n(22),a=n(14),s=n(54),u=n(105),c=n(82);t.exports=function(t,e){var n,f,l,h,p,d=t.target,v=t.global,y=t.stat;if(n=v?r:y?r[d]||s(d,{}):r[d]&&r[d].prototype)for(f in e){if(h=e[f],l=t.dontCallGetSet?(p=i(n,f))&&p.value:n[f],!c(v?f:d+(y?".":"#")+f,t.forced)&&void 0!==l){if(typeof h==typeof l)continue;u(h,l)}(t.sham||l&&l.sham)&&o(h,"sham",!0),a(n,f,h,t)}}},function(t,e,n){"use strict";n(124),n(135),n(137),n(138),n(139),n(140)},function(t,e,n){"use strict";n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"e",(function(){return s})),n.d(e,"a",(function(){return u}));const r="https://justpush.ai",i="25.1.31.40749",o=r+"/api/v0",a="smiwebpush",s="/sw.js",u=`${r}/css/smi-webpush.css?v=${i}`},function(t,e,n){"use strict";var r=n(2),i=n(17),o=n(79),a=n(54);t.exports=function(t,e,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:e;if(r(n)&&o(n,c,s),s.global)u?t[e]=n:a(e,n);else{try{s.unsafe?t[e]&&(u=!0):delete t[e]}catch(t){}u?t[e]=n:i.f(t,e,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return t}},function(t,e,n){"use strict";var r=n(2),i=n(31),o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not a function")}},function(t,e,n){"use strict";t.exports=!1},function(t,e,n){"use strict";var r=n(6),i=n(77),o=n(78),a=n(7),s=n(72),u=TypeError,c=Object.defineProperty,f=Object.getOwnPropertyDescriptor;e.f=r?o?function(t,e,n){if(a(t),e=s(e),a(n),"function"==typeof t&&"prototype"===e&&"value"in n&&"writable"in n&&!n.writable){var r=f(t,e);r&&r.writable&&(t[e]=n.value,n={configurable:"configurable"in n?n.configurable:r.configurable,enumerable:"enumerable"in n?n.enumerable:r.enumerable,writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(a(t),e=s(e),a(n),i)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){"use strict";var r=n(0).navigator,i=r&&r.userAgent;t.exports=i?String(i):""},function(t,e,n){"use strict";var r=n(0),i=n(2),o=function(t){return i(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?o(r[t]):r[t]&&r[t][e]}},function(t,e,n){"use strict";var r,i,o,a=n(118),s=n(0),u=n(10),c=n(22),f=n(8),l=n(53),h=n(58),p=n(59),d=s.TypeError,v=s.WeakMap;if(a||l.state){var y=l.state||(l.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,r=function(t,e){if(y.has(t))throw new d("Object already initialized");return e.facade=t,y.set(t,e),e},i=function(t){return y.get(t)||{}},o=function(t){return y.has(t)}}else{var m=h("state");p[m]=!0,r=function(t,e){if(f(t,m))throw new d("Object already initialized");return e.facade=t,c(t,m,e),e},i=function(t){return f(t,m)?t[m]:{}},o=function(t){return f(t,m)}}t.exports={set:r,get:i,has:o,enforce:function(t){return o(t)?i(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!u(e)||(n=i(e)).type!==t)throw new d("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){"use strict";var r=n(29),i=Object;t.exports=function(t){return i(r(t))}},function(t,e,n){"use strict";var r=n(6),i=n(17),o=n(43);t.exports=r?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){"use strict";var r=n(26),i=String;t.exports=function(t){if("Symbol"===r(t))throw new TypeError("Cannot convert a Symbol value to a string");return i(t)}},function(t,e,n){(function(r){e.log=function(...t){return"object"==typeof console&&console.log&&console.log(...t)},e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(i=r))}),e.splice(i,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==r&&"env"in r&&(t=r.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=n(143)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,n(142))},function(t,e,n){"use strict";var r=n(3);t.exports=r({}.isPrototypeOf)},function(t,e,n){"use strict";var r=n(123),i=n(2),o=n(28),a=n(5)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());t.exports=r?o:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=s(t),a))?n:u?o(e):"Object"===(r=o(e))&&i(e.callee)?"Arguments":r}},function(t,e,n){"use strict";var r=n(104),i=n(29);t.exports=function(t){return r(i(t))}},function(t,e,n){"use strict";var r=n(3),i=r({}.toString),o=r("".slice);t.exports=function(t){return o(i(t),8,-1)}},function(t,e,n){"use strict";var r=n(30),i=TypeError;t.exports=function(t){if(r(t))throw new i("Can't call method on "+t);return t}},function(t,e,n){"use strict";t.exports=function(t){return null==t}},function(t,e,n){"use strict";var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},function(t,e,n){"use strict";var r=n(122);t.exports=function(t){var e=+t;return e!=e||0===e?0:r(e)}},function(t,e,n){"use strict";var r=n(17).f,i=n(8),o=n(5)("toStringTag");t.exports=function(t,e,n){t&&!n&&(t=t.prototype),t&&!i(t,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){"use strict";var r=n(0);t.exports=r.Promise},function(t,e,n){"use strict";var r=n(0),i=n(34),o=n(2),a=n(82),s=n(57),u=n(5),c=n(83),f=n(16),l=n(51),h=i&&i.prototype,p=u("species"),d=!1,v=o(r.PromiseRejectionEvent),y=a("Promise",(function(){var t=s(i),e=t!==String(i);if(!e&&66===l)return!0;if(f&&(!h.catch||!h.finally))return!0;if(!l||l<51||!/native code/.test(t)){var n=new i((function(t){t(1)})),r=function(t){t((function(){}),(function(){}))};if((n.constructor={})[p]=r,!(d=n.then((function(){}))instanceof r))return!0}return!(e||"BROWSER"!==c&&"DENO"!==c||v)}));t.exports={CONSTRUCTOR:y,REJECTION_EVENT:v,SUBCLASSING:d}},function(t,e,n){"use strict";var r=n(15),i=TypeError,o=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new i("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";var r=n(81);t.exports=function(t){return r(t.length)}},function(t,e,n){"use strict";var r=n(86),i=n(15),o=n(42),a=r(r.bind);t.exports=function(t,e){return i(t),void 0===e?t:o?a(t,e):function(){return t.apply(e,arguments)}}},function(t,e,n){"use strict";var r=n(27),i=n(145),o=n(37),a=n(20),s=n(17).f,u=n(112),c=n(95),f=n(16),l=n(6),h=a.set,p=a.getterFor("Array Iterator");t.exports=u(Array,"Array",(function(t,e){h(this,{type:"Array Iterator",target:r(t),index:0,kind:e})}),(function(){var t=p(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,c(void 0,!0);switch(t.kind){case"keys":return c(n,!1);case"values":return c(e[n],!1)}return c([n,e[n]],!1)}),"values");var d=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!f&&l&&"values"!==d.name)try{s(d,"name",{value:"values"})}catch(t){}},function(t,e,n){"use strict";var r,i=n(7),o=n(146),a=n(60),s=n(59),u=n(87),c=n(45),f=n(58),l=f("IE_PROTO"),h=function(){},p=function(t){return"<script>"+t+"<\/script>"},d=function(t){t.write(p("")),t.close();var e=t.parentWindow.Object;return t=null,e},v=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}var t,e;v="undefined"!=typeof document?document.domain&&r?d(r):((e=c("iframe")).style.display="none",u.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(p("document.F=Object")),t.close(),t.F):d(r);for(var n=a.length;n--;)delete v.prototype[a[n]];return v()};s[l]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(h.prototype=i(t),n=new h,h.prototype=null,n[l]=t):n=v(),void 0===e?n:o.f(n,e)}},function(t,e,n){"use strict";var r=n(1);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},function(t,e,n){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(15),i=n(30);t.exports=function(t,e){var n=t[e];return i(n)?void 0:r(n)}},function(t,e,n){"use strict";var r=n(0),i=n(10),o=r.document,a=i(o)&&i(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},function(t,e,n){"use strict";var r=n(11),i=n(67);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},function(t,e,n){"use strict";var r,i,o,a=n(159),s=n(6),u=n(0),c=n(2),f=n(10),l=n(8),h=n(26),p=n(31),d=n(22),v=n(14),y=n(48),m=n(25),g=n(66),b=n(62),w=n(5),x=n(55),_=n(20),S=_.enforce,C=_.get,E=u.Int8Array,k=E&&E.prototype,P=u.Uint8ClampedArray,O=P&&P.prototype,A=E&&g(E),j=k&&g(k),T=Object.prototype,I=u.TypeError,R=w("toStringTag"),F=x("TYPED_ARRAY_TAG"),D=a&&!!b&&"Opera"!==h(u.opera),B=!1,K={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},L={BigInt64Array:8,BigUint64Array:8},U=function(t){var e=g(t);if(f(e)){var n=C(e);return n&&l(n,"TypedArrayConstructor")?n.TypedArrayConstructor:U(e)}},M=function(t){if(!f(t))return!1;var e=h(t);return l(K,e)||l(L,e)};for(r in K)(o=(i=u[r])&&i.prototype)?S(o).TypedArrayConstructor=i:D=!1;for(r in L)(o=(i=u[r])&&i.prototype)&&(S(o).TypedArrayConstructor=i);if((!D||!c(A)||A===Function.prototype)&&(A=function(){throw new I("Incorrect invocation")},D))for(r in K)u[r]&&b(u[r],A);if((!D||!j||j===T)&&(j=A.prototype,D))for(r in K)u[r]&&b(u[r].prototype,j);if(D&&g(O)!==j&&b(O,j),s&&!l(j,R))for(r in B=!0,y(j,R,{configurable:!0,get:function(){return f(this)?this[F]:void 0}}),K)u[r]&&d(u[r],F,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:D,TYPED_ARRAY_TAG:B&&F,aTypedArray:function(t){if(M(t))return t;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!b||m(A,t)))return t;throw new I(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,r){if(s){if(n)for(var i in K){var o=u[i];if(o&&l(o.prototype,t))try{delete o.prototype[t]}catch(n){try{o.prototype[t]=e}catch(t){}}}j[t]&&!n||v(j,t,n?e:D&&k[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,n){var r,i;if(s){if(b){if(n)for(r in K)if((i=u[r])&&l(i,t))try{delete i[t]}catch(t){}if(A[t]&&!n)return;try{return v(A,t,n?e:D&&A[t]||e)}catch(t){}}for(r in K)!(i=u[r])||i[t]&&!n||v(i,t,e)}},getTypedArrayConstructor:U,isView:function(t){if(!f(t))return!1;var e=h(t);return"DataView"===e||l(K,e)||l(L,e)},isTypedArray:M,TypedArray:A,TypedArrayPrototype:j}},function(t,e,n){"use strict";var r=n(79),i=n(17);t.exports=function(t,e,n){return n.get&&r(n.get,e,{getter:!0}),n.set&&r(n.set,e,{setter:!0}),i.f(t,e,n)}},function(t,e,n){"use strict";var r=n(3);t.exports=r([].slice)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"b",(function(){return a}));n(12);var r=n(9);async function i(t,e){const n={userVisibleOnly:!0,applicationServerKey:t};try{return e.pushManager.subscribe(n)}catch(t){const r=await e.pushManager.getSubscription();if(r)return await r.unsubscribe(),e.pushManager.subscribe(n);throw t}}async function o(t){if(!(await r.a.saveProjectSubscription(t)).ok)throw new Error("Cannot save subscription");const{new_subscription:e}=t;if(e)return r.b.setSubscription(e)}async function a(t){const e=await r.b.getSubscription(),n=e?e.subscription:null;return n&&n.endpoint===t.endpoint}},function(t,e,n){"use strict";var r,i,o=n(0),a=n(18),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,f=c&&c.v8;f&&(i=(r=f.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]),t.exports=i},function(t,e,n){"use strict";var r=n(53);t.exports=function(t,e){return r[t]||(r[t]=e||{})}},function(t,e,n){"use strict";var r=n(16),i=n(0),o=n(54),a=t.exports=i["__core-js_shared__"]||o("__core-js_shared__",{});(a.versions||(a.versions=[])).push({version:"3.39.0",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},function(t,e,n){"use strict";var r=n(0),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},function(t,e,n){"use strict";var r=n(3),i=0,o=Math.random(),a=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++i+o,36)}},function(t,e,n){"use strict";var r=n(6),i=n(8),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(o,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},function(t,e,n){"use strict";var r=n(3),i=n(2),o=n(53),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(t){return a(t)}),t.exports=o.inspectSource},function(t,e,n){"use strict";var r=n(52),i=n(55),o=r("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,n){"use strict";var r=n(83);t.exports="NODE"===r},function(t,e,n){"use strict";var r=n(125),i=n(10),o=n(29),a=n(126);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=r(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return o(n),a(r),i(n)?(e?t(n,r):n.__proto__=r,n):n}}():void 0)},function(t,e,n){"use strict";var r=n(42),i=Function.prototype,o=i.apply,a=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},function(t,e,n){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},function(t,e,n){"use strict";var r=n(26),i=n(44),o=n(30),a=n(37),s=n(5)("iterator");t.exports=function(t){if(!o(t))return i(t,s)||i(t,"@@iterator")||a[r(t)]}},function(t,e,n){"use strict";var r=n(8),i=n(2),o=n(21),a=n(58),s=n(147),u=a("IE_PROTO"),c=Object,f=c.prototype;t.exports=s?c.getPrototypeOf:function(t){var e=o(t);if(r(e,u))return e[u];var n=e.constructor;return i(n)&&e instanceof n?n.prototype:e instanceof c?f:null}},function(t,e,n){"use strict";var r,i,o=n(4),a=n(3),s=n(23),u=n(96),c=n(151),f=n(52),l=n(41),h=n(20).get,p=n(152),d=n(153),v=f("native-string-replace",String.prototype.replace),y=RegExp.prototype.exec,m=y,g=a("".charAt),b=a("".indexOf),w=a("".replace),x=a("".slice),_=(i=/b*/g,o(y,r=/a/,"a"),o(y,i,"a"),0!==r.lastIndex||0!==i.lastIndex),S=c.BROKEN_CARET,C=void 0!==/()??/.exec("")[1];(_||C||S||p||d)&&(m=function(t){var e,n,r,i,a,c,f,p=this,d=h(p),E=s(t),k=d.raw;if(k)return k.lastIndex=p.lastIndex,e=o(m,k,E),p.lastIndex=k.lastIndex,e;var P=d.groups,O=S&&p.sticky,A=o(u,p),j=p.source,T=0,I=E;if(O&&(A=w(A,"y",""),-1===b(A,"g")&&(A+="g"),I=x(E,p.lastIndex),p.lastIndex>0&&(!p.multiline||p.multiline&&"\n"!==g(E,p.lastIndex-1))&&(j="(?: "+j+")",I=" "+I,T++),n=new RegExp("^(?:"+j+")",A)),C&&(n=new RegExp("^"+j+"$(?!\\s)",A)),_&&(r=p.lastIndex),i=o(y,O?n:p,I),O?i?(i.input=x(i.input,T),i[0]=x(i[0],T),i.index=p.lastIndex,p.lastIndex+=i[0].length):p.lastIndex=0:_&&i&&(p.lastIndex=p.global?i.index+i[0].length:r),C&&i&&i.length>1&&o(v,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&P)for(i.groups=c=l(null),a=0;a<P.length;a++)c[(f=P[a])[0]]=i[f[1]];return i}),t.exports=m},function(t,e,n){"use strict";var r=n(63),i=n(4),o=n(3),a=n(155),s=n(1),u=n(7),c=n(2),f=n(30),l=n(32),h=n(81),p=n(23),d=n(29),v=n(156),y=n(44),m=n(157),g=n(158),b=n(5)("replace"),w=Math.max,x=Math.min,_=o([].concat),S=o([].push),C=o("".indexOf),E=o("".slice),k="$0"==="a".replace(/./,"$0"),P=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(t,e,n){var o=P?"$":"$0";return[function(t,n){var r=d(this),o=f(t)?void 0:y(t,b);return o?i(o,t,r,n):i(e,p(r),t,n)},function(t,i){var a=u(this),s=p(t);if("string"==typeof i&&-1===C(i,o)&&-1===C(i,"$<")){var f=n(e,a,s,i);if(f.done)return f.value}var d=c(i);d||(i=p(i));var y,b=a.global;b&&(y=a.unicode,a.lastIndex=0);for(var k,P=[];null!==(k=g(a,s))&&(S(P,k),b);){""===p(k[0])&&(a.lastIndex=v(s,h(a.lastIndex),y))}for(var O,A="",j=0,T=0;T<P.length;T++){for(var I,R=p((k=P[T])[0]),F=w(x(l(k.index),s.length),0),D=[],B=1;B<k.length;B++)S(D,void 0===(O=k[B])?O:String(O));var K=k.groups;if(d){var L=_([R],D,F,s);void 0!==K&&S(L,K),I=p(r(i,void 0,L))}else I=m(R,s,F,D,K,i);F>=j&&(A+=E(s,j,F)+I,j=F+R.length)}return A+E(s,j)}]}),!!s((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!k||P)},function(t,e,n){"use strict";var r=n(32),i=Math.max,o=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):o(n,e)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));n(12);var r=n(9);class i{constructor(t){this.projectId=t.project_id,this.vapidPublicKey=t.vapid_public_key,this.scope=t.scope,this.customPromptConfig=t.custom_prompt_config}toOptions(){return{project_id:this.projectId,vapid_public_key:this.vapidPublicKey,scope:this.scope,custom_prompt_config:this.customPromptConfig}}static async getFromApi(t){const e=await r.a.getProjectConfig(t);if(!e.ok)throw Error("Cannot fetch project config");const n=await e.json();return new i(n)}static async getFromDatabase(t){const e=await r.b.getProjectConfig(t);if(!e)throw Error("No project in database");return new i(e)}static async getFromDatabaseOrApi(t){try{return await i.getFromDatabase(t)}catch(t){}if(!t)return null;let e=null;try{e=await i.getFromApi(t)}catch(t){}return e&&await r.b.setProjectConfig(e.toOptions()),e}}},function(t,e,n){"use strict";var r=n(6),i=n(4),o=n(103),a=n(43),s=n(27),u=n(72),c=n(8),f=n(77),l=Object.getOwnPropertyDescriptor;e.f=r?l:function(t,e){if(t=s(t),e=u(e),f)try{return l(t,e)}catch(t){}if(c(t,e))return a(!i(o.f,t,e),t[e])}},function(t,e,n){"use strict";var r=n(73),i=n(74);t.exports=function(t){var e=r(t,"string");return i(e)?e:e+""}},function(t,e,n){"use strict";var r=n(4),i=n(10),o=n(74),a=n(44),s=n(117),u=n(5),c=TypeError,f=u("toPrimitive");t.exports=function(t,e){if(!i(t)||o(t))return t;var n,u=a(t,f);if(u){if(void 0===e&&(e="default"),n=r(u,t,e),!i(n)||o(n))return n;throw new c("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},function(t,e,n){"use strict";var r=n(19),i=n(2),o=n(25),a=n(75),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return i(e)&&o(e.prototype,s(t))}},function(t,e,n){"use strict";var r=n(76);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,n){"use strict";var r=n(51),i=n(1),o=n(0).String;t.exports=!!Object.getOwnPropertySymbols&&!i((function(){var t=Symbol("symbol detection");return!o(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},function(t,e,n){"use strict";var r=n(6),i=n(1),o=n(45);t.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){"use strict";var r=n(6),i=n(1);t.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(t,e,n){"use strict";var r=n(3),i=n(1),o=(n(2),n(8)),a=n(6),s=n(56).CONFIGURABLE,u=(n(57),n(20)),c=u.enforce,f=(u.get,String),l=Object.defineProperty,h=r("".slice),p=r("".replace),d=r([].join),v=a&&!i((function(){return 8!==l((function(){}),"length",{value:8}).length})),y=String(String).split("String");t.exports=function(t,e,n){"Symbol("===h(f(e),0,7)&&(e="["+p(f(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!o(t,"name")||s&&t.name!==e)&&(a?l(t,"name",{value:e,configurable:!0}):t.name=e),v&&n&&o(n,"arity")&&t.length!==n.arity&&l(t,"length",{value:n.arity});try{n&&o(n,"constructor")&&n.constructor?a&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=c(t);return o(r,"source")||(r.source=d(y,"string"==typeof e?e:"")),t}},function(t,e,n){"use strict";var r=n(3),i=n(8),o=n(27),a=n(121).indexOf,s=n(59),u=r([].push);t.exports=function(t,e){var n,r=o(t),c=0,f=[];for(n in r)!i(s,n)&&i(r,n)&&u(f,n);for(;e.length>c;)i(r,n=e[c++])&&(~a(f,n)||u(f,n));return f}},function(t,e,n){"use strict";var r=n(32),i=Math.min;t.exports=function(t){var e=r(t);return e>0?i(e,9007199254740991):0}},function(t,e,n){"use strict";var r=n(1),i=n(2),o=/#|\.prototype\./,a=function(t,e){var n=u[s(t)];return n===f||n!==c&&(i(e)?r(e):!!e)},s=a.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",f=a.POLYFILL="P";t.exports=a},function(t,e,n){"use strict";var r=n(0),i=n(18),o=n(28),a=function(t){return i.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},function(t,e,n){"use strict";var r=n(25),i=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new i("Incorrect invocation")}},function(t,e,n){"use strict";var r,i,o,a,s=n(0),u=n(63),c=n(39),f=n(2),l=n(8),h=n(1),p=n(87),d=n(49),v=n(45),y=n(88),m=n(89),g=n(61),b=s.setImmediate,w=s.clearImmediate,x=s.process,_=s.Dispatch,S=s.Function,C=s.MessageChannel,E=s.String,k=0,P={};h((function(){r=s.location}));var O=function(t){if(l(P,t)){var e=P[t];delete P[t],e()}},A=function(t){return function(){O(t)}},j=function(t){O(t.data)},T=function(t){s.postMessage(E(t),r.protocol+"//"+r.host)};b&&w||(b=function(t){y(arguments.length,1);var e=f(t)?t:S(t),n=d(arguments,1);return P[++k]=function(){u(e,void 0,n)},i(k),k},w=function(t){delete P[t]},g?i=function(t){x.nextTick(A(t))}:_&&_.now?i=function(t){_.now(A(t))}:C&&!m?(a=(o=new C).port2,o.port1.onmessage=j,i=c(a.postMessage,a)):s.addEventListener&&f(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!h(T)?(i=T,s.addEventListener("message",j,!1)):i="onreadystatechange"in v("script")?function(t){p.appendChild(v("script")).onreadystatechange=function(){p.removeChild(this),O(t)}}:function(t){setTimeout(A(t),0)}),t.exports={set:b,clear:w}},function(t,e,n){"use strict";var r=n(28),i=n(3);t.exports=function(t){if("Function"===r(t))return i(t)}},function(t,e,n){"use strict";var r=n(19);t.exports=r("document","documentElement")},function(t,e,n){"use strict";var r=TypeError;t.exports=function(t,e){if(t<e)throw new r("Not enough arguments");return t}},function(t,e,n){"use strict";var r=n(18);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},function(t,e,n){"use strict";var r=function(){this.head=null,this.tail=null};r.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},t.exports=r},function(t,e,n){"use strict";var r=n(39),i=n(4),o=n(7),a=n(31),s=n(109),u=n(38),c=n(25),f=n(92),l=n(65),h=n(110),p=TypeError,d=function(t,e){this.stopped=t,this.result=e},v=d.prototype;t.exports=function(t,e,n){var y,m,g,b,w,x,_,S=n&&n.that,C=!(!n||!n.AS_ENTRIES),E=!(!n||!n.IS_RECORD),k=!(!n||!n.IS_ITERATOR),P=!(!n||!n.INTERRUPTED),O=r(e,S),A=function(t){return y&&h(y,"normal",t),new d(!0,t)},j=function(t){return C?(o(t),P?O(t[0],t[1],A):O(t[0],t[1])):P?O(t,A):O(t)};if(E)y=t.iterator;else if(k)y=t;else{if(!(m=l(t)))throw new p(a(t)+" is not iterable");if(s(m)){for(g=0,b=u(t);b>g;g++)if((w=j(t[g]))&&c(v,w))return w;return new d(!1)}y=f(t,m)}for(x=E?t.next:y.next;!(_=i(x,y)).done;){try{w=j(_.value)}catch(t){h(y,"throw",t)}if("object"==typeof w&&w&&c(v,w))return w}return new d(!1)}},function(t,e,n){"use strict";var r=n(4),i=n(15),o=n(7),a=n(31),s=n(65),u=TypeError;t.exports=function(t,e){var n=arguments.length<2?s(t):e;if(i(n))return o(r(n,t));throw new u(a(t)+" is not iterable")}},function(t,e,n){"use strict";var r=n(34),i=n(136),o=n(35).CONSTRUCTOR;t.exports=o||!i((function(t){r.all(t).then(void 0,(function(){}))}))},function(t,e,n){"use strict";var r,i,o,a=n(1),s=n(2),u=n(10),c=n(41),f=n(66),l=n(14),h=n(5),p=n(16),d=h("iterator"),v=!1;[].keys&&("next"in(o=[].keys())?(i=f(f(o)))!==Object.prototype&&(r=i):v=!0),!u(r)||a((function(){var t={};return r[d].call(t)!==t}))?r={}:p&&(r=c(r)),s(r[d])||l(r,d,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:v}},function(t,e,n){"use strict";t.exports=function(t,e){return{value:t,done:e}}},function(t,e,n){"use strict";var r=n(7);t.exports=function(){var t=r(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},function(t,e,n){"use strict";var r=n(3),i=n(32),o=n(23),a=n(29),s=r("".charAt),u=r("".charCodeAt),c=r("".slice),f=function(t){return function(e,n){var r,f,l=o(a(e)),h=i(n),p=l.length;return h<0||h>=p?t?"":void 0:(r=u(l,h))<55296||r>56319||h+1===p||(f=u(l,h+1))<56320||f>57343?t?s(l,h):r:t?c(l,h,h+2):f-56320+(r-55296<<10)+65536}};t.exports={codeAt:f(!1),charAt:f(!0)}},function(t,e,n){"use strict";var r=n(47),i=n(160),o=n(161),a=n(26),s=n(4),u=n(3),c=n(1),f=r.aTypedArray,l=r.exportTypedArrayMethod,h=u("".slice);l("fill",(function(t){var e=arguments.length;f(this);var n="Big"===h(a(this),0,3)?o(t):+t;return s(i,this,n,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)}),c((function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t})))},function(t,e,n){"use strict";var r=n(0),i=n(4),o=n(47),a=n(38),s=n(162),u=n(21),c=n(1),f=r.RangeError,l=r.Int8Array,h=l&&l.prototype,p=h&&h.set,d=o.aTypedArray,v=o.exportTypedArrayMethod,y=!c((function(){var t=new Uint8ClampedArray(2);return i(p,t,{length:1,0:3},1),3!==t[1]})),m=y&&o.NATIVE_ARRAY_BUFFER_VIEWS&&c((function(){var t=new l(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]}));v("set",(function(t){d(this);var e=s(arguments.length>1?arguments[1]:void 0,1),n=u(t);if(y)return i(p,this,n,e);var r=this.length,o=a(n),c=0;if(o+e>r)throw new f("Wrong length");for(;c<o;)this[e+c]=n[c++]}),!y||m)},function(t,e,n){"use strict";var r=n(0),i=n(86),o=n(1),a=n(15),s=n(115),u=n(47),c=n(164),f=n(165),l=n(51),h=n(166),p=u.aTypedArray,d=u.exportTypedArrayMethod,v=r.Uint16Array,y=v&&i(v.prototype.sort),m=!(!y||o((function(){y(new v(2),null)}))&&o((function(){y(new v(2),{})}))),g=!!y&&!o((function(){if(l)return l<74;if(c)return c<67;if(f)return!0;if(h)return h<602;var t,e,n=new v(516),r=Array(516);for(t=0;t<516;t++)e=t%4,n[t]=515-t,r[t]=t-2*e+3;for(y(n,(function(t,e){return(t/4|0)-(e/4|0)})),t=0;t<516;t++)if(n[t]!==r[t])return!0}));d("sort",(function(t){return void 0!==t&&a(t),g?y(this,t):s(p(this),function(t){return function(e,n){return void 0!==t?+t(e,n)||0:n!=n?-1:e!=e?1:0===e&&0===n?1/e>0&&1/n<0?1:-1:e>n}}(t))}),!g||m)},function(t,e,n){"use strict";var r=n(0),i=n(63),o=n(47),a=n(1),s=n(49),u=r.Int8Array,c=o.aTypedArray,f=o.exportTypedArrayMethod,l=[].toLocaleString,h=!!u&&a((function(){l.call(new u(1))}));f("toLocaleString",(function(){return i(l,h?s(c(this)):c(this),s(arguments))}),a((function(){return[1,2].toLocaleString()!==new u([1,2]).toLocaleString()}))||!a((function(){u.prototype.toLocaleString.call([1,2])})))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));n(40),n(46),n(68),n(98),n(99),n(100),n(101);function r(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),n=atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;++t)r[t]=n.charCodeAt(t);return r}},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!r.call({1:2},1);e.f=o?function(t){var e=i(this,t);return!!e&&e.enumerable}:r},function(t,e,n){"use strict";var r=n(3),i=n(1),o=n(28),a=Object,s=r("".split);t.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(t){return"String"===o(t)?s(t,""):a(t)}:a},function(t,e,n){"use strict";var r=n(8),i=n(119),o=n(71),a=n(17);t.exports=function(t,e,n){for(var s=i(e),u=a.f,c=o.f,f=0;f<s.length;f++){var l=s[f];r(t,l)||n&&r(n,l)||u(t,l,c(e,l))}}},function(t,e,n){"use strict";e.f=Object.getOwnPropertySymbols},function(t,e,n){"use strict";var r=n(3),i=n(1),o=n(2),a=n(26),s=n(19),u=n(57),c=function(){},f=s("Reflect","construct"),l=/^\s*(?:class|function)\b/,h=r(l.exec),p=!l.test(c),d=function(t){if(!o(t))return!1;try{return f(c,[],t),!0}catch(t){return!1}},v=function(t){if(!o(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!h(l,u(t))}catch(t){return!0}};v.sham=!0,t.exports=!f||i((function(){var t;return d(d.call)||!d(Object)||!d((function(){t=!0}))||t}))?v:d},function(t,e,n){"use strict";var r=n(0),i=n(6),o=Object.getOwnPropertyDescriptor;t.exports=function(t){if(!i)return r[t];var e=o(r,t);return e&&e.value}},function(t,e,n){"use strict";var r=n(5),i=n(37),o=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||a[o]===t)}},function(t,e,n){"use strict";var r=n(4),i=n(7),o=n(44);t.exports=function(t,e,n){var a,s;i(t);try{if(!(a=o(t,"return"))){if("throw"===e)throw n;return n}a=r(a,t)}catch(t){s=!0,a=t}if("throw"===e)throw n;if(s)throw a;return i(a),n}},function(t,e,n){"use strict";var r=n(80),i=n(60);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){"use strict";var r=n(11),i=n(4),o=n(16),a=n(56),s=n(2),u=n(113),c=n(66),f=n(62),l=n(33),h=n(22),p=n(14),d=n(5),v=n(37),y=n(94),m=a.PROPER,g=a.CONFIGURABLE,b=y.IteratorPrototype,w=y.BUGGY_SAFARI_ITERATORS,x=d("iterator"),_=function(){return this};t.exports=function(t,e,n,a,d,y,S){u(n,e,a);var C,E,k,P=function(t){if(t===d&&I)return I;if(!w&&t&&t in j)return j[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},O=e+" Iterator",A=!1,j=t.prototype,T=j[x]||j["@@iterator"]||d&&j[d],I=!w&&T||P(d),R="Array"===e&&j.entries||T;if(R&&(C=c(R.call(new t)))!==Object.prototype&&C.next&&(o||c(C)===b||(f?f(C,b):s(C[x])||p(C,x,_)),l(C,O,!0,!0),o&&(v[O]=_)),m&&"values"===d&&T&&"values"!==T.name&&(!o&&g?h(j,"name","values"):(A=!0,I=function(){return i(T,this)})),d)if(E={values:P("values"),keys:y?I:P("keys"),entries:P("entries")},S)for(k in E)(w||A||!(k in j))&&p(j,k,E[k]);else r({target:e,proto:!0,forced:w||A},E);return o&&!S||j[x]===I||p(j,x,I,{name:d}),v[e]=I,E}},function(t,e,n){"use strict";var r=n(94).IteratorPrototype,i=n(41),o=n(43),a=n(33),s=n(37),u=function(){return this};t.exports=function(t,e,n,c){var f=e+" Iterator";return t.prototype=i(r,{next:o(+!c,n)}),a(t,f,!1,!0),s[f]=u,t}},function(t,e,n){"use strict";var r=n(56).PROPER,i=n(14),o=n(7),a=n(23),s=n(1),u=n(154),c=RegExp.prototype,f=c.toString,l=s((function(){return"/a/b"!==f.call({source:"a",flags:"b"})})),h=r&&"toString"!==f.name;(l||h)&&i(c,"toString",(function(){var t=o(this);return"/"+a(t.source)+"/"+a(u(t))}),{unsafe:!0})},function(t,e,n){"use strict";var r=n(49),i=Math.floor,o=function(t,e){var n=t.length;if(n<8)for(var a,s,u=1;u<n;){for(s=u,a=t[u];s&&e(t[s-1],a)>0;)t[s]=t[--s];s!==u++&&(t[s]=a)}else for(var c=i(n/2),f=o(r(t,0,c),e),l=o(r(t,c),e),h=f.length,p=l.length,d=0,v=0;d<h||v<p;)t[d+v]=d<h&&v<p?e(f[d],l[v])<=0?f[d++]:l[v++]:d<h?f[d++]:l[v++];return t};t.exports=o},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var r=n(4),i=n(2),o=n(10),a=TypeError;t.exports=function(t,e){var n,s;if("string"===e&&i(n=t.toString)&&!o(s=r(n,t)))return s;if(i(n=t.valueOf)&&!o(s=r(n,t)))return s;if("string"!==e&&i(n=t.toString)&&!o(s=r(n,t)))return s;throw new a("Can't convert object to primitive value")}},function(t,e,n){"use strict";var r=n(0),i=n(2),o=r.WeakMap;t.exports=i(o)&&/native code/.test(String(o))},function(t,e,n){"use strict";var r=n(19),i=n(3),o=n(120),a=n(106),s=n(7),u=i([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(s(t)),n=a.f;return n?u(e,n(t)):e}},function(t,e,n){"use strict";var r=n(80),i=n(60).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){"use strict";var r=n(27),i=n(69),o=n(38),a=function(t){return function(e,n,a){var s=r(e),u=o(s);if(0===u)return!t&&-1;var c,f=i(a,u);if(t&&n!=n){for(;u>f;)if((c=s[f++])!=c)return!0}else for(;u>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},function(t,e,n){"use strict";var r=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?i:r)(e)}},function(t,e,n){"use strict";var r={};r[n(5)("toStringTag")]="z",t.exports="[object z]"===String(r)},function(t,e,n){"use strict";var r,i,o,a=n(11),s=n(16),u=n(61),c=n(0),f=n(4),l=n(14),h=n(62),p=n(33),d=n(128),v=n(15),y=n(2),m=n(10),g=n(84),b=n(129),w=n(85).set,x=n(131),_=n(134),S=n(64),C=n(90),E=n(20),k=n(34),P=n(35),O=n(36),A=P.CONSTRUCTOR,j=P.REJECTION_EVENT,T=P.SUBCLASSING,I=E.getterFor("Promise"),R=E.set,F=k&&k.prototype,D=k,B=F,K=c.TypeError,L=c.document,U=c.process,M=O.f,N=M,q=!!(L&&L.createEvent&&c.dispatchEvent),H=function(t){var e;return!(!m(t)||!y(e=t.then))&&e},V=function(t,e){var n,r,i,o=e.value,a=1===e.state,s=a?t.ok:t.fail,u=t.resolve,c=t.reject,l=t.domain;try{s?(a||(2===e.rejection&&Y(e),e.rejection=1),!0===s?n=o:(l&&l.enter(),n=s(o),l&&(l.exit(),i=!0)),n===t.promise?c(new K("Promise-chain cycle")):(r=H(n))?f(r,n,u,c):u(n)):c(o)}catch(t){l&&!i&&l.exit(),c(t)}},z=function(t,e){t.notified||(t.notified=!0,x((function(){for(var n,r=t.reactions;n=r.get();)V(n,t);t.notified=!1,e&&!t.rejection&&$(t)})))},W=function(t,e,n){var r,i;q?((r=L.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),c.dispatchEvent(r)):r={promise:e,reason:n},!j&&(i=c["on"+t])?i(r):"unhandledrejection"===t&&_("Unhandled promise rejection",n)},$=function(t){f(w,c,(function(){var e,n=t.facade,r=t.value;if(G(t)&&(e=S((function(){u?U.emit("unhandledRejection",r,n):W("unhandledrejection",n,r)})),t.rejection=u||G(t)?2:1,e.error))throw e.value}))},G=function(t){return 1!==t.rejection&&!t.parent},Y=function(t){f(w,c,(function(){var e=t.facade;u?U.emit("rejectionHandled",e):W("rejectionhandled",e,t.value)}))},X=function(t,e,n){return function(r){t(e,r,n)}},J=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,z(t,!0))},Q=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw new K("Promise can't be resolved itself");var r=H(e);r?x((function(){var n={done:!1};try{f(r,e,X(Q,n,t),X(J,n,t))}catch(e){J(n,e,t)}})):(t.value=e,t.state=1,z(t,!1))}catch(e){J({done:!1},e,t)}}};if(A&&(B=(D=function(t){g(this,B),v(t),f(r,this);var e=I(this);try{t(X(Q,e),X(J,e))}catch(t){J(e,t)}}).prototype,(r=function(t){R(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:new C,rejection:!1,state:0,value:null})}).prototype=l(B,"then",(function(t,e){var n=I(this),r=M(b(this,D));return n.parent=!0,r.ok=!y(t)||t,r.fail=y(e)&&e,r.domain=u?U.domain:void 0,0===n.state?n.reactions.add(r):x((function(){V(r,n)})),r.promise})),i=function(){var t=new r,e=I(t);this.promise=t,this.resolve=X(Q,e),this.reject=X(J,e)},O.f=M=function(t){return t===D||void 0===t?new i(t):N(t)},!s&&y(k)&&F!==Object.prototype)){o=F.then,T||l(F,"then",(function(t,e){var n=this;return new D((function(t,e){f(o,n,t,e)})).then(t,e)}),{unsafe:!0});try{delete F.constructor}catch(t){}h&&h(F,B)}a({global:!0,constructor:!0,wrap:!0,forced:A},{Promise:D}),p(D,"Promise",!1,!0),d("Promise")},function(t,e,n){"use strict";var r=n(3),i=n(15);t.exports=function(t,e,n){try{return r(i(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}}},function(t,e,n){"use strict";var r=n(127),i=String,o=TypeError;t.exports=function(t){if(r(t))return t;throw new o("Can't set "+i(t)+" as a prototype")}},function(t,e,n){"use strict";var r=n(10);t.exports=function(t){return r(t)||null===t}},function(t,e,n){"use strict";var r=n(19),i=n(48),o=n(5),a=n(6),s=o("species");t.exports=function(t){var e=r(t);a&&e&&!e[s]&&i(e,s,{configurable:!0,get:function(){return this}})}},function(t,e,n){"use strict";var r=n(7),i=n(130),o=n(30),a=n(5)("species");t.exports=function(t,e){var n,s=r(t).constructor;return void 0===s||o(n=r(s)[a])?e:i(n)}},function(t,e,n){"use strict";var r=n(107),i=n(31),o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not a constructor")}},function(t,e,n){"use strict";var r,i,o,a,s,u=n(0),c=n(108),f=n(39),l=n(85).set,h=n(90),p=n(89),d=n(132),v=n(133),y=n(61),m=u.MutationObserver||u.WebKitMutationObserver,g=u.document,b=u.process,w=u.Promise,x=c("queueMicrotask");if(!x){var _=new h,S=function(){var t,e;for(y&&(t=b.domain)&&t.exit();e=_.get();)try{e()}catch(t){throw _.head&&r(),t}t&&t.enter()};p||y||v||!m||!g?!d&&w&&w.resolve?((a=w.resolve(void 0)).constructor=w,s=f(a.then,a),r=function(){s(S)}):y?r=function(){b.nextTick(S)}:(l=f(l,u),r=function(){l(S)}):(i=!0,o=g.createTextNode(""),new m(S).observe(o,{characterData:!0}),r=function(){o.data=i=!i}),x=function(t){_.head||r(),_.add(t)}}t.exports=x},function(t,e,n){"use strict";var r=n(18);t.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},function(t,e,n){"use strict";var r=n(18);t.exports=/web0s(?!.*chrome)/i.test(r)},function(t,e,n){"use strict";t.exports=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}}},function(t,e,n){"use strict";var r=n(11),i=n(4),o=n(15),a=n(36),s=n(64),u=n(91);r({target:"Promise",stat:!0,forced:n(93)},{all:function(t){var e=this,n=a.f(e),r=n.resolve,c=n.reject,f=s((function(){var n=o(e.resolve),a=[],s=0,f=1;u(t,(function(t){var o=s++,u=!1;f++,i(n,e,t).then((function(t){u||(u=!0,a[o]=t,--f||r(a))}),c)})),--f||r(a)}));return f.error&&c(f.value),n.promise}})},function(t,e,n){"use strict";var r=n(5)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){try{if(!e&&!i)return!1}catch(t){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},t(o)}catch(t){}return n}},function(t,e,n){"use strict";var r=n(11),i=n(16),o=n(35).CONSTRUCTOR,a=n(34),s=n(19),u=n(2),c=n(14),f=a&&a.prototype;if(r({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(t){return this.then(void 0,t)}}),!i&&u(a)){var l=s("Promise").prototype.catch;f.catch!==l&&c(f,"catch",l,{unsafe:!0})}},function(t,e,n){"use strict";var r=n(11),i=n(4),o=n(15),a=n(36),s=n(64),u=n(91);r({target:"Promise",stat:!0,forced:n(93)},{race:function(t){var e=this,n=a.f(e),r=n.reject,c=s((function(){var a=o(e.resolve);u(t,(function(t){i(a,e,t).then(n.resolve,r)}))}));return c.error&&r(c.value),n.promise}})},function(t,e,n){"use strict";var r=n(11),i=n(36);r({target:"Promise",stat:!0,forced:n(35).CONSTRUCTOR},{reject:function(t){var e=i.f(this);return(0,e.reject)(t),e.promise}})},function(t,e,n){"use strict";var r=n(11),i=n(19),o=n(16),a=n(34),s=n(35).CONSTRUCTOR,u=n(141),c=i("Promise"),f=o&&!s;r({target:"Promise",stat:!0,forced:o||s},{resolve:function(t){return u(f&&this===c?a:this,t)}})},function(t,e,n){"use strict";var r=n(7),i=n(10),o=n(36);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!f){var t=s(h);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function v(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||f||s(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports=function(t){function e(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return r.colors[Math.abs(e)%r.colors.length]}function r(t){let n;function a(...t){if(!a.enabled)return;const e=a,i=Number(new Date),o=i-(n||i);e.diff=o,e.prev=n,e.curr=i,n=i,t[0]=r.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let s=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(n,i)=>{if("%%"===n)return n;s++;const o=r.formatters[i];if("function"==typeof o){const r=t[s];n=o.call(e,r),t.splice(s,1),s--}return n}),r.formatArgs.call(e,t);(e.log||r.log).apply(e,t)}return a.namespace=t,a.enabled=r.enabled(t),a.useColors=r.useColors(),a.color=e(t),a.destroy=i,a.extend=o,"function"==typeof r.init&&r.init(a),r.instances.push(a),a}function i(){const t=r.instances.indexOf(this);return-1!==t&&(r.instances.splice(t,1),!0)}function o(t,e){const n=r(this.namespace+(void 0===e?":":e)+t);return n.log=this.log,n}function a(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},r.disable=function(){const t=[...r.names.map(a),...r.skips.map(a).map(t=>"-"+t)].join(",");return r.enable(""),t},r.enable=function(t){let e;r.save(t),r.names=[],r.skips=[];const n=("string"==typeof t?t:"").split(/[\s,]+/),i=n.length;for(e=0;e<i;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+t.substr(1)+"$")):r.names.push(new RegExp("^"+t+"$")));for(e=0;e<r.instances.length;e++){const t=r.instances[e];t.enabled=r.enabled(t.namespace)}},r.enabled=function(t){if("*"===t[t.length-1])return!0;let e,n;for(e=0,n=r.skips.length;e<n;e++)if(r.skips[e].test(t))return!1;for(e=0,n=r.names.length;e<n;e++)if(r.names[e].test(t))return!0;return!1},r.humanize=n(144),Object.keys(t).forEach(e=>{r[e]=t[e]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=e,r.enable(r.load()),r}},function(t,e){var n=1e3,r=6e4,i=60*r,o=24*i;function a(t,e,n,r){var i=e>=1.5*n;return Math.round(t/n)+" "+r+(i?"s":"")}t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(t);if("number"===s&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=o)return a(t,e,o,"day");if(e>=i)return a(t,e,i,"hour");if(e>=r)return a(t,e,r,"minute");if(e>=n)return a(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=o)return Math.round(t/o)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){"use strict";var r=n(5),i=n(41),o=n(17).f,a=r("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),t.exports=function(t){s[a][t]=!0}},function(t,e,n){"use strict";var r=n(6),i=n(78),o=n(17),a=n(7),s=n(27),u=n(111);e.f=r&&!i?Object.defineProperties:function(t,e){a(t);for(var n,r=s(e),i=u(e),c=i.length,f=0;c>f;)o.f(t,n=i[f++],r[n]);return t}},function(t,e,n){"use strict";var r=n(1);t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},function(t,e,n){"use strict";var r=n(0),i=n(149),o=n(150),a=n(40),s=n(22),u=n(33),c=n(5)("iterator"),f=a.values,l=function(t,e){if(t){if(t[c]!==f)try{s(t,c,f)}catch(e){t[c]=f}if(u(t,e,!0),i[e])for(var n in a)if(t[n]!==a[n])try{s(t,n,a[n])}catch(e){t[n]=a[n]}}};for(var h in i)l(r[h]&&r[h].prototype,h);l(o,"DOMTokenList")},function(t,e,n){"use strict";t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,n){"use strict";var r=n(45)("span").classList,i=r&&r.constructor&&r.constructor.prototype;t.exports=i===Object.prototype?void 0:i},function(t,e,n){"use strict";var r=n(1),i=n(0).RegExp,o=r((function(){var t=i("a","y");return t.lastIndex=2,null!==t.exec("abcd")})),a=o||r((function(){return!i("a","y").sticky})),s=o||r((function(){var t=i("^r","gy");return t.lastIndex=2,null!==t.exec("str")}));t.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},function(t,e,n){"use strict";var r=n(1),i=n(0).RegExp;t.exports=r((function(){var t=i(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)}))},function(t,e,n){"use strict";var r=n(1),i=n(0).RegExp;t.exports=r((function(){var t=i("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))},function(t,e,n){"use strict";var r=n(4),i=n(8),o=n(25),a=n(96),s=RegExp.prototype;t.exports=function(t){var e=t.flags;return void 0!==e||"flags"in s||i(t,"flags")||!o(s,t)?e:r(a,t)}},function(t,e,n){"use strict";n(46);var r=n(4),i=n(14),o=n(67),a=n(1),s=n(5),u=n(22),c=s("species"),f=RegExp.prototype;t.exports=function(t,e,n,l){var h=s(t),p=!a((function(){var e={};return e[h]=function(){return 7},7!==""[t](e)})),d=p&&!a((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return e=!0,null},n[h](""),!e}));if(!p||!d||n){var v=/./[h],y=e(h,""[t],(function(t,e,n,i,a){var s=e.exec;return s===o||s===f.exec?p&&!a?{done:!0,value:r(v,e,n,i)}:{done:!0,value:r(t,n,e,i)}:{done:!1}}));i(String.prototype,t,y[0]),i(f,h,y[1])}l&&u(f[h],"sham",!0)}},function(t,e,n){"use strict";var r=n(97).charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){"use strict";var r=n(3),i=n(21),o=Math.floor,a=r("".charAt),s=r("".replace),u=r("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,f=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,r,l,h){var p=n+t.length,d=r.length,v=f;return void 0!==l&&(l=i(l),v=c),s(h,v,(function(i,s){var c;switch(a(s,0)){case"$":return"$";case"&":return t;case"`":return u(e,0,n);case"'":return u(e,p);case"<":c=l[u(s,1,-1)];break;default:var f=+s;if(0===f)return i;if(f>d){var h=o(f/10);return 0===h?i:h<=d?void 0===r[h-1]?a(s,1):r[h-1]+a(s,1):i}c=r[f-1]}return void 0===c?"":c}))}},function(t,e,n){"use strict";var r=n(4),i=n(7),o=n(2),a=n(28),s=n(67),u=TypeError;t.exports=function(t,e){var n=t.exec;if(o(n)){var c=r(n,t,e);return null!==c&&i(c),c}if("RegExp"===a(t))return r(s,t,e);throw new u("RegExp#exec called on incompatible receiver")}},function(t,e,n){"use strict";t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},function(t,e,n){"use strict";var r=n(21),i=n(69),o=n(38);t.exports=function(t){for(var e=r(this),n=o(e),a=arguments.length,s=i(a>1?arguments[1]:void 0,n),u=a>2?arguments[2]:void 0,c=void 0===u?n:i(u,n);c>s;)e[s++]=t;return e}},function(t,e,n){"use strict";var r=n(73),i=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw new i("Can't convert number to bigint");return BigInt(e)}},function(t,e,n){"use strict";var r=n(163),i=RangeError;t.exports=function(t,e){var n=r(t);if(n%e)throw new i("Wrong offset");return n}},function(t,e,n){"use strict";var r=n(32),i=RangeError;t.exports=function(t){var e=r(t);if(e<0)throw new i("The argument can't be less than 0");return e}},function(t,e,n){"use strict";var r=n(18).match(/firefox\/(\d+)/i);t.exports=!!r&&+r[1]},function(t,e,n){"use strict";var r=n(18);t.exports=/MSIE|Trident/.test(r)},function(t,e,n){"use strict";var r=n(18).match(/AppleWebKit\/(\d+)\./);t.exports=!!r&&+r[1]},,function(t,e,n){"use strict";var r=n(1),i=n(5),o=n(6),a=n(16),s=i("iterator");t.exports=!r((function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,n=new URLSearchParams("a=1&a=2&b=3"),r="";return t.pathname="c%20d",e.forEach((function(t,n){e.delete("b"),r+=n+t})),n.delete("a",2),n.delete("b",void 0),a&&(!t.toJSON||!n.has("a",1)||n.has("a",2)||!n.has("a",void 0)||n.has("b"))||!e.size&&(a||!o)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[s]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host}))},,,function(t,e,n){"use strict";n(172)},function(t,e,n){"use strict";n(173);var r,i=n(11),o=n(6),a=n(168),s=n(0),u=n(39),c=n(3),f=n(14),l=n(48),h=n(84),p=n(8),d=n(174),v=n(175),y=n(49),m=n(97).codeAt,g=n(178),b=n(23),w=n(33),x=n(88),_=n(179),S=n(20),C=S.set,E=S.getterFor("URL"),k=_.URLSearchParams,P=_.getState,O=s.URL,A=s.TypeError,j=s.parseInt,T=Math.floor,I=Math.pow,R=c("".charAt),F=c(/./.exec),D=c([].join),B=c(1..toString),K=c([].pop),L=c([].push),U=c("".replace),M=c([].shift),N=c("".split),q=c("".slice),H=c("".toLowerCase),V=c([].unshift),z=/[a-z]/i,W=/[\d+-.a-z]/i,$=/\d/,G=/^0x/i,Y=/^[0-7]+$/,X=/^\d+$/,J=/^[\da-f]+$/i,Q=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Z=/[\0\t\n\r #/:<>?@[\\\]^|]/,tt=/^[\u0000-\u0020]+/,et=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,nt=/[\t\n\r]/g,rt=function(t){var e,n,r,i;if("number"==typeof t){for(e=[],n=0;n<4;n++)V(e,t%256),t=T(t/256);return D(e,".")}if("object"==typeof t){for(e="",r=function(t){for(var e=null,n=1,r=null,i=0,o=0;o<8;o++)0!==t[o]?(i>n&&(e=r,n=i),r=null,i=0):(null===r&&(r=o),++i);return i>n?r:e}(t),n=0;n<8;n++)i&&0===t[n]||(i&&(i=!1),r===n?(e+=n?":":"::",i=!0):(e+=B(t[n],16),n<7&&(e+=":")));return"["+e+"]"}return t},it={},ot=d({},it,{" ":1,'"':1,"<":1,">":1,"`":1}),at=d({},ot,{"#":1,"?":1,"{":1,"}":1}),st=d({},at,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ut=function(t,e){var n=m(t,0);return n>32&&n<127&&!p(e,t)?t:encodeURIComponent(t)},ct={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ft=function(t,e){var n;return 2===t.length&&F(z,R(t,0))&&(":"===(n=R(t,1))||!e&&"|"===n)},lt=function(t){var e;return t.length>1&&ft(q(t,0,2))&&(2===t.length||"/"===(e=R(t,2))||"\\"===e||"?"===e||"#"===e)},ht=function(t){return"."===t||"%2e"===H(t)},pt={},dt={},vt={},yt={},mt={},gt={},bt={},wt={},xt={},_t={},St={},Ct={},Et={},kt={},Pt={},Ot={},At={},jt={},Tt={},It={},Rt={},Ft=function(t,e,n){var r,i,o,a=b(t);if(e){if(i=this.parse(a))throw new A(i);this.searchParams=null}else{if(void 0!==n&&(r=new Ft(n,!0)),i=this.parse(a,null,r))throw new A(i);(o=P(new k)).bindURL(this),this.searchParams=o}};Ft.prototype={type:"URL",parse:function(t,e,n){var i,o,a,s,u,c=this,f=e||pt,l=0,h="",d=!1,m=!1,g=!1;for(t=b(t),e||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,t=U(t,tt,""),t=U(t,et,"$1")),t=U(t,nt,""),i=v(t);l<=i.length;){switch(o=i[l],f){case pt:if(!o||!F(z,o)){if(e)return"Invalid scheme";f=vt;continue}h+=H(o),f=dt;break;case dt:if(o&&(F(W,o)||"+"===o||"-"===o||"."===o))h+=H(o);else{if(":"!==o){if(e)return"Invalid scheme";h="",f=vt,l=0;continue}if(e&&(c.isSpecial()!==p(ct,h)||"file"===h&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=h,e)return void(c.isSpecial()&&ct[c.scheme]===c.port&&(c.port=null));h="","file"===c.scheme?f=kt:c.isSpecial()&&n&&n.scheme===c.scheme?f=yt:c.isSpecial()?f=wt:"/"===i[l+1]?(f=mt,l++):(c.cannotBeABaseURL=!0,L(c.path,""),f=Tt)}break;case vt:if(!n||n.cannotBeABaseURL&&"#"!==o)return"Invalid scheme";if(n.cannotBeABaseURL&&"#"===o){c.scheme=n.scheme,c.path=y(n.path),c.query=n.query,c.fragment="",c.cannotBeABaseURL=!0,f=Rt;break}f="file"===n.scheme?kt:gt;continue;case yt:if("/"!==o||"/"!==i[l+1]){f=gt;continue}f=xt,l++;break;case mt:if("/"===o){f=_t;break}f=jt;continue;case gt:if(c.scheme=n.scheme,o===r)c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=y(n.path),c.query=n.query;else if("/"===o||"\\"===o&&c.isSpecial())f=bt;else if("?"===o)c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=y(n.path),c.query="",f=It;else{if("#"!==o){c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=y(n.path),c.path.length--,f=jt;continue}c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=y(n.path),c.query=n.query,c.fragment="",f=Rt}break;case bt:if(!c.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,f=jt;continue}f=_t}else f=xt;break;case wt:if(f=xt,"/"!==o||"/"!==R(h,l+1))continue;l++;break;case xt:if("/"!==o&&"\\"!==o){f=_t;continue}break;case _t:if("@"===o){d&&(h="%40"+h),d=!0,a=v(h);for(var w=0;w<a.length;w++){var x=a[w];if(":"!==x||g){var _=ut(x,st);g?c.password+=_:c.username+=_}else g=!0}h=""}else if(o===r||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()){if(d&&""===h)return"Invalid authority";l-=v(h).length+1,h="",f=St}else h+=o;break;case St:case Ct:if(e&&"file"===c.scheme){f=Ot;continue}if(":"!==o||m){if(o===r||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()){if(c.isSpecial()&&""===h)return"Invalid host";if(e&&""===h&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(h))return s;if(h="",f=At,e)return;continue}"["===o?m=!0:"]"===o&&(m=!1),h+=o}else{if(""===h)return"Invalid host";if(s=c.parseHost(h))return s;if(h="",f=Et,e===Ct)return}break;case Et:if(!F($,o)){if(o===r||"/"===o||"?"===o||"#"===o||"\\"===o&&c.isSpecial()||e){if(""!==h){var S=j(h,10);if(S>65535)return"Invalid port";c.port=c.isSpecial()&&S===ct[c.scheme]?null:S,h=""}if(e)return;f=At;continue}return"Invalid port"}h+=o;break;case kt:if(c.scheme="file","/"===o||"\\"===o)f=Pt;else{if(!n||"file"!==n.scheme){f=jt;continue}switch(o){case r:c.host=n.host,c.path=y(n.path),c.query=n.query;break;case"?":c.host=n.host,c.path=y(n.path),c.query="",f=It;break;case"#":c.host=n.host,c.path=y(n.path),c.query=n.query,c.fragment="",f=Rt;break;default:lt(D(y(i,l),""))||(c.host=n.host,c.path=y(n.path),c.shortenPath()),f=jt;continue}}break;case Pt:if("/"===o||"\\"===o){f=Ot;break}n&&"file"===n.scheme&&!lt(D(y(i,l),""))&&(ft(n.path[0],!0)?L(c.path,n.path[0]):c.host=n.host),f=jt;continue;case Ot:if(o===r||"/"===o||"\\"===o||"?"===o||"#"===o){if(!e&&ft(h))f=jt;else if(""===h){if(c.host="",e)return;f=At}else{if(s=c.parseHost(h))return s;if("localhost"===c.host&&(c.host=""),e)return;h="",f=At}continue}h+=o;break;case At:if(c.isSpecial()){if(f=jt,"/"!==o&&"\\"!==o)continue}else if(e||"?"!==o)if(e||"#"!==o){if(o!==r&&(f=jt,"/"!==o))continue}else c.fragment="",f=Rt;else c.query="",f=It;break;case jt:if(o===r||"/"===o||"\\"===o&&c.isSpecial()||!e&&("?"===o||"#"===o)){if(".."===(u=H(u=h))||"%2e."===u||".%2e"===u||"%2e%2e"===u?(c.shortenPath(),"/"===o||"\\"===o&&c.isSpecial()||L(c.path,"")):ht(h)?"/"===o||"\\"===o&&c.isSpecial()||L(c.path,""):("file"===c.scheme&&!c.path.length&&ft(h)&&(c.host&&(c.host=""),h=R(h,0)+":"),L(c.path,h)),h="","file"===c.scheme&&(o===r||"?"===o||"#"===o))for(;c.path.length>1&&""===c.path[0];)M(c.path);"?"===o?(c.query="",f=It):"#"===o&&(c.fragment="",f=Rt)}else h+=ut(o,at);break;case Tt:"?"===o?(c.query="",f=It):"#"===o?(c.fragment="",f=Rt):o!==r&&(c.path[0]+=ut(o,it));break;case It:e||"#"!==o?o!==r&&("'"===o&&c.isSpecial()?c.query+="%27":c.query+="#"===o?"%23":ut(o,it)):(c.fragment="",f=Rt);break;case Rt:o!==r&&(c.fragment+=ut(o,ot))}l++}},parseHost:function(t){var e,n,r;if("["===R(t,0)){if("]"!==R(t,t.length-1))return"Invalid host";if(!(e=function(t){var e,n,r,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,f=null,l=0,h=function(){return R(t,l)};if(":"===h()){if(":"!==R(t,1))return;l+=2,f=++c}for(;h();){if(8===c)return;if(":"!==h()){for(e=n=0;n<4&&F(J,h());)e=16*e+j(h(),16),l++,n++;if("."===h()){if(0===n)return;if(l-=n,c>6)return;for(r=0;h();){if(i=null,r>0){if(!("."===h()&&r<4))return;l++}if(!F($,h()))return;for(;F($,h());){if(o=j(h(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;l++}u[c]=256*u[c]+i,2!==++r&&4!==r||c++}if(4!==r)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;u[c++]=e}else{if(null!==f)return;l++,f=++c}}if(null!==f)for(a=c-f,c=7;0!==c&&a>0;)s=u[c],u[c--]=u[f+a-1],u[f+--a]=s;else if(8!==c)return;return u}(q(t,1,-1))))return"Invalid host";this.host=e}else if(this.isSpecial()){if(t=g(t),F(Q,t))return"Invalid host";if(null===(e=function(t){var e,n,r,i,o,a,s,u=N(t,".");if(u.length&&""===u[u.length-1]&&u.length--,(e=u.length)>4)return t;for(n=[],r=0;r<e;r++){if(""===(i=u[r]))return t;if(o=10,i.length>1&&"0"===R(i,0)&&(o=F(G,i)?16:8,i=q(i,8===o?1:2)),""===i)a=0;else{if(!F(10===o?X:8===o?Y:J,i))return t;a=j(i,o)}L(n,a)}for(r=0;r<e;r++)if(a=n[r],r===e-1){if(a>=I(256,5-e))return null}else if(a>255)return null;for(s=K(n),r=0;r<n.length;r++)s+=n[r]*I(256,3-r);return s}(t)))return"Invalid host";this.host=e}else{if(F(Z,t))return"Invalid host";for(e="",n=v(t),r=0;r<n.length;r++)e+=ut(n[r],it);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return p(ct,this.scheme)},shortenPath:function(){var t=this.path,e=t.length;!e||"file"===this.scheme&&1===e&&ft(t[0],!0)||t.length--},serialize:function(){var t=this,e=t.scheme,n=t.username,r=t.password,i=t.host,o=t.port,a=t.path,s=t.query,u=t.fragment,c=e+":";return null!==i?(c+="//",t.includesCredentials()&&(c+=n+(r?":"+r:"")+"@"),c+=rt(i),null!==o&&(c+=":"+o)):"file"===e&&(c+="//"),c+=t.cannotBeABaseURL?a[0]:a.length?"/"+D(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(t){var e=this.parse(t);if(e)throw new A(e);this.searchParams.update()},getOrigin:function(){var t=this.scheme,e=this.port;if("blob"===t)try{return new Dt(t.path[0]).origin}catch(t){return"null"}return"file"!==t&&this.isSpecial()?t+"://"+rt(this.host)+(null!==e?":"+e:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(b(t)+":",pt)},getUsername:function(){return this.username},setUsername:function(t){var e=v(b(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<e.length;n++)this.username+=ut(e[n],st)}},getPassword:function(){return this.password},setPassword:function(t){var e=v(b(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<e.length;n++)this.password+=ut(e[n],st)}},getHost:function(){var t=this.host,e=this.port;return null===t?"":null===e?rt(t):rt(t)+":"+e},setHost:function(t){this.cannotBeABaseURL||this.parse(t,St)},getHostname:function(){var t=this.host;return null===t?"":rt(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Ct)},getPort:function(){var t=this.port;return null===t?"":b(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""===(t=b(t))?this.port=null:this.parse(t,Et))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+D(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,At))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""===(t=b(t))?this.query=null:("?"===R(t,0)&&(t=q(t,1)),this.query="",this.parse(t,It)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!==(t=b(t))?("#"===R(t,0)&&(t=q(t,1)),this.fragment="",this.parse(t,Rt)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Dt=function(t){var e=h(this,Bt),n=x(arguments.length,1)>1?arguments[1]:void 0,r=C(e,new Ft(t,!1,n));o||(e.href=r.serialize(),e.origin=r.getOrigin(),e.protocol=r.getProtocol(),e.username=r.getUsername(),e.password=r.getPassword(),e.host=r.getHost(),e.hostname=r.getHostname(),e.port=r.getPort(),e.pathname=r.getPathname(),e.search=r.getSearch(),e.searchParams=r.getSearchParams(),e.hash=r.getHash())},Bt=Dt.prototype,Kt=function(t,e){return{get:function(){return E(this)[t]()},set:e&&function(t){return E(this)[e](t)},configurable:!0,enumerable:!0}};if(o&&(l(Bt,"href",Kt("serialize","setHref")),l(Bt,"origin",Kt("getOrigin")),l(Bt,"protocol",Kt("getProtocol","setProtocol")),l(Bt,"username",Kt("getUsername","setUsername")),l(Bt,"password",Kt("getPassword","setPassword")),l(Bt,"host",Kt("getHost","setHost")),l(Bt,"hostname",Kt("getHostname","setHostname")),l(Bt,"port",Kt("getPort","setPort")),l(Bt,"pathname",Kt("getPathname","setPathname")),l(Bt,"search",Kt("getSearch","setSearch")),l(Bt,"searchParams",Kt("getSearchParams")),l(Bt,"hash",Kt("getHash","setHash"))),f(Bt,"toJSON",(function(){return E(this).serialize()}),{enumerable:!0}),f(Bt,"toString",(function(){return E(this).serialize()}),{enumerable:!0}),O){var Lt=O.createObjectURL,Ut=O.revokeObjectURL;Lt&&f(Dt,"createObjectURL",u(Lt,O)),Ut&&f(Dt,"revokeObjectURL",u(Ut,O))}w(Dt,"URL"),i({global:!0,constructor:!0,forced:!a,sham:!o},{URL:Dt})},function(t,e,n){"use strict";var r=n(97).charAt,i=n(23),o=n(20),a=n(112),s=n(95),u=o.set,c=o.getterFor("String Iterator");a(String,"String",(function(t){u(this,{type:"String Iterator",string:i(t),index:0})}),(function(){var t,e=c(this),n=e.string,i=e.index;return i>=n.length?s(void 0,!0):(t=r(n,i),e.index+=t.length,s(t,!1))}))},function(t,e,n){"use strict";var r=n(6),i=n(3),o=n(4),a=n(1),s=n(111),u=n(106),c=n(103),f=n(21),l=n(104),h=Object.assign,p=Object.defineProperty,d=i([].concat);t.exports=!h||a((function(){if(r&&1!==h({b:1},h(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol("assign detection");return t[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){e[t]=t})),7!==h({},t)[n]||"abcdefghijklmnopqrst"!==s(h({},e)).join("")}))?function(t,e){for(var n=f(t),i=arguments.length,a=1,h=u.f,p=c.f;i>a;)for(var v,y=l(arguments[a++]),m=h?d(s(y),h(y)):s(y),g=m.length,b=0;g>b;)v=m[b++],r&&!o(p,y,v)||(n[v]=y[v]);return n}:h},function(t,e,n){"use strict";var r=n(39),i=n(4),o=n(21),a=n(176),s=n(109),u=n(107),c=n(38),f=n(177),l=n(92),h=n(65),p=Array;t.exports=function(t){var e=o(t),n=u(this),d=arguments.length,v=d>1?arguments[1]:void 0,y=void 0!==v;y&&(v=r(v,d>2?arguments[2]:void 0));var m,g,b,w,x,_,S=h(e),C=0;if(!S||this===p&&s(S))for(m=c(e),g=n?new this(m):p(m);m>C;C++)_=y?v(e[C],C):e[C],f(g,C,_);else for(g=n?new this:[],x=(w=l(e,S)).next;!(b=i(x,w)).done;C++)_=y?a(w,v,[b.value,C],!0):b.value,f(g,C,_);return g.length=C,g}},function(t,e,n){"use strict";var r=n(7),i=n(110);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){i(t,"throw",e)}}},function(t,e,n){"use strict";var r=n(6),i=n(17),o=n(43);t.exports=function(t,e,n){r?i.f(t,e,o(0,n)):t[e]=n}},function(t,e,n){"use strict";var r=n(3),i=/[^\0-\u007E]/,o=/[.\u3002\uFF0E\uFF61]/g,a="Overflow: input needs wider integers to process",s=RangeError,u=r(o.exec),c=Math.floor,f=String.fromCharCode,l=r("".charCodeAt),h=r([].join),p=r([].push),d=r("".replace),v=r("".split),y=r("".toLowerCase),m=function(t){return t+22+75*(t<26)},g=function(t,e,n){var r=0;for(t=n?c(t/700):t>>1,t+=c(t/e);t>455;)t=c(t/35),r+=36;return c(r+36*t/(t+38))},b=function(t){var e,n,r=[],i=(t=function(t){for(var e=[],n=0,r=t.length;n<r;){var i=l(t,n++);if(i>=55296&&i<=56319&&n<r){var o=l(t,n++);56320==(64512&o)?p(e,((1023&i)<<10)+(1023&o)+65536):(p(e,i),n--)}else p(e,i)}return e}(t)).length,o=128,u=0,d=72;for(e=0;e<t.length;e++)(n=t[e])<128&&p(r,f(n));var v=r.length,y=v;for(v&&p(r,"-");y<i;){var b=2147483647;for(e=0;e<t.length;e++)(n=t[e])>=o&&n<b&&(b=n);var w=y+1;if(b-o>c((2147483647-u)/w))throw new s(a);for(u+=(b-o)*w,o=b,e=0;e<t.length;e++){if((n=t[e])<o&&++u>2147483647)throw new s(a);if(n===o){for(var x=u,_=36;;){var S=_<=d?1:_>=d+26?26:_-d;if(x<S)break;var C=x-S,E=36-S;p(r,f(m(S+C%E))),x=c(C/E),_+=36}p(r,f(m(x))),d=g(u,w,y===v),u=0,y++}}u++,o++}return h(r,"")};t.exports=function(t){var e,n,r=[],a=v(d(y(t),o,"."),".");for(e=0;e<a.length;e++)n=a[e],p(r,u(i,n)?"xn--"+b(n):n);return h(r,".")}},function(t,e,n){"use strict";n(40),n(180);var r=n(11),i=n(0),o=n(108),a=n(19),s=n(4),u=n(3),c=n(6),f=n(168),l=n(14),h=n(48),p=n(181),d=n(33),v=n(113),y=n(20),m=n(84),g=n(2),b=n(8),w=n(39),x=n(26),_=n(7),S=n(10),C=n(23),E=n(41),k=n(43),P=n(92),O=n(65),A=n(95),j=n(88),T=n(5),I=n(115),R=T("iterator"),F=y.set,D=y.getterFor("URLSearchParams"),B=y.getterFor("URLSearchParamsIterator"),K=o("fetch"),L=o("Request"),U=o("Headers"),M=L&&L.prototype,N=U&&U.prototype,q=i.TypeError,H=i.encodeURIComponent,V=String.fromCharCode,z=a("String","fromCodePoint"),W=parseInt,$=u("".charAt),G=u([].join),Y=u([].push),X=u("".replace),J=u([].shift),Q=u([].splice),Z=u("".split),tt=u("".slice),et=u(/./.exec),nt=/\+/g,rt=/^[0-9a-f]+$/i,it=function(t,e){var n=tt(t,e,e+2);return et(rt,n)?W(n,16):NaN},ot=function(t){for(var e=0,n=128;n>0&&0!=(t&n);n>>=1)e++;return e},at=function(t){var e=null;switch(t.length){case 1:e=t[0];break;case 2:e=(31&t[0])<<6|63&t[1];break;case 3:e=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:e=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return e>1114111?null:e},st=function(t){for(var e=(t=X(t,nt," ")).length,n="",r=0;r<e;){var i=$(t,r);if("%"===i){if("%"===$(t,r+1)||r+3>e){n+="%",r++;continue}var o=it(t,r+1);if(o!=o){n+=i,r++;continue}r+=2;var a=ot(o);if(0===a)i=V(o);else{if(1===a||a>4){n+="�",r++;continue}for(var s=[o],u=1;u<a&&!(++r+3>e||"%"!==$(t,r));){var c=it(t,r+1);if(c!=c){r+=3;break}if(c>191||c<128)break;Y(s,c),r+=2,u++}if(s.length!==a){n+="�";continue}var f=at(s);null===f?n+="�":i=z(f)}}n+=i,r++}return n},ut=/[!'()~]|%20/g,ct={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ft=function(t){return ct[t]},lt=function(t){return X(H(t),ut,ft)},ht=v((function(t,e){F(this,{type:"URLSearchParamsIterator",target:D(t).entries,index:0,kind:e})}),"URLSearchParams",(function(){var t=B(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,A(void 0,!0);var r=e[n];switch(t.kind){case"keys":return A(r.key,!1);case"values":return A(r.value,!1)}return A([r.key,r.value],!1)}),!0),pt=function(t){this.entries=[],this.url=null,void 0!==t&&(S(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===$(t,0)?tt(t,1):t:C(t)))};pt.prototype={type:"URLSearchParams",bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var e,n,r,i,o,a,u,c=this.entries,f=O(t);if(f)for(n=(e=P(t,f)).next;!(r=s(n,e)).done;){if(o=(i=P(_(r.value))).next,(a=s(o,i)).done||(u=s(o,i)).done||!s(o,i).done)throw new q("Expected sequence with length 2");Y(c,{key:C(a.value),value:C(u.value)})}else for(var l in t)b(t,l)&&Y(c,{key:l,value:C(t[l])})},parseQuery:function(t){if(t)for(var e,n,r=this.entries,i=Z(t,"&"),o=0;o<i.length;)(e=i[o++]).length&&(n=Z(e,"="),Y(r,{key:st(J(n)),value:st(G(n,"="))}))},serialize:function(){for(var t,e=this.entries,n=[],r=0;r<e.length;)t=e[r++],Y(n,lt(t.key)+"="+lt(t.value));return G(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var dt=function(){m(this,vt);var t=arguments.length>0?arguments[0]:void 0,e=F(this,new pt(t));c||(this.size=e.entries.length)},vt=dt.prototype;if(p(vt,{append:function(t,e){var n=D(this);j(arguments.length,2),Y(n.entries,{key:C(t),value:C(e)}),c||this.length++,n.updateURL()},delete:function(t){for(var e=D(this),n=j(arguments.length,1),r=e.entries,i=C(t),o=n<2?void 0:arguments[1],a=void 0===o?o:C(o),s=0;s<r.length;){var u=r[s];if(u.key!==i||void 0!==a&&u.value!==a)s++;else if(Q(r,s,1),void 0!==a)break}c||(this.size=r.length),e.updateURL()},get:function(t){var e=D(this).entries;j(arguments.length,1);for(var n=C(t),r=0;r<e.length;r++)if(e[r].key===n)return e[r].value;return null},getAll:function(t){var e=D(this).entries;j(arguments.length,1);for(var n=C(t),r=[],i=0;i<e.length;i++)e[i].key===n&&Y(r,e[i].value);return r},has:function(t){for(var e=D(this).entries,n=j(arguments.length,1),r=C(t),i=n<2?void 0:arguments[1],o=void 0===i?i:C(i),a=0;a<e.length;){var s=e[a++];if(s.key===r&&(void 0===o||s.value===o))return!0}return!1},set:function(t,e){var n=D(this);j(arguments.length,1);for(var r,i=n.entries,o=!1,a=C(t),s=C(e),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?Q(i,u--,1):(o=!0,r.value=s));o||Y(i,{key:a,value:s}),c||(this.size=i.length),n.updateURL()},sort:function(){var t=D(this);I(t.entries,(function(t,e){return t.key>e.key?1:-1})),t.updateURL()},forEach:function(t){for(var e,n=D(this).entries,r=w(t,arguments.length>1?arguments[1]:void 0),i=0;i<n.length;)r((e=n[i++]).value,e.key,this)},keys:function(){return new ht(this,"keys")},values:function(){return new ht(this,"values")},entries:function(){return new ht(this,"entries")}},{enumerable:!0}),l(vt,R,vt.entries,{name:"entries"}),l(vt,"toString",(function(){return D(this).serialize()}),{enumerable:!0}),c&&h(vt,"size",{get:function(){return D(this).entries.length},configurable:!0,enumerable:!0}),d(dt,"URLSearchParams"),r({global:!0,constructor:!0,forced:!f},{URLSearchParams:dt}),!f&&g(U)){var yt=u(N.has),mt=u(N.set),gt=function(t){if(S(t)){var e,n=t.body;if("URLSearchParams"===x(n))return e=t.headers?new U(t.headers):new U,yt(e,"content-type")||mt(e,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),E(t,{body:k(0,C(n)),headers:k(0,e)})}return t};if(g(K)&&r({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return K(t,arguments.length>1?gt(arguments[1]):{})}}),g(L)){var bt=function(t){return m(this,M),new L(t,arguments.length>1?gt(arguments[1]):{})};M.constructor=bt,bt.prototype=M,r({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:bt})}}t.exports={URLSearchParams:dt,getState:D}},function(t,e,n){"use strict";var r=n(11),i=n(3),o=n(69),a=RangeError,s=String.fromCharCode,u=String.fromCodePoint,c=i([].join);r({target:"String",stat:!0,arity:1,forced:!!u&&1!==u.length},{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,i=0;r>i;){if(e=+arguments[i++],o(e,1114111)!==e)throw new a(e+" is not a valid code point");n[i]=e<65536?s(e):s(55296+((e-=65536)>>10),e%1024+56320)}return c(n,"")}})},function(t,e,n){"use strict";var r=n(14);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},,function(t,e,n){"use strict";n.r(e);n(40),n(12),n(46),n(114),n(68),n(148),n(171);var r=n(13),i=n(9),o=n(102),a=n(70),s=n(50);function u(t){return t&&t.name?fetch(t.name,{method:"DELETE"}).catch(()=>null):null}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var c=function(){return(c=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function f(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,h=Object.keys,p=Array.isArray;function d(t,e){return"object"!=typeof e||h(e).forEach((function(n){t[n]=e[n]})),t}"undefined"==typeof Promise||l.Promise||(l.Promise=Promise);var v=Object.getPrototypeOf,y={}.hasOwnProperty;function m(t,e){return y.call(t,e)}function g(t,e){"function"==typeof e&&(e=e(v(t))),("undefined"==typeof Reflect?h:Reflect.ownKeys)(e).forEach((function(n){w(t,n,e[n])}))}var b=Object.defineProperty;function w(t,e,n,r){b(t,e,d(n&&m(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function x(t){return{from:function(e){return t.prototype=Object.create(e.prototype),w(t.prototype,"constructor",t),{extend:g.bind(null,t.prototype)}}}}var _=Object.getOwnPropertyDescriptor;function S(t,e){var n;return _(t,e)||(n=v(t))&&S(n,e)}var C=[].slice;function E(t,e,n){return C.call(t,e,n)}function k(t,e){return e(t)}function P(t){if(!t)throw new Error("Assertion Failed")}function O(t){l.setImmediate?setImmediate(t):setTimeout(t,0)}function A(t,e){return t.reduce((function(t,n,r){var i=e(n,r);return i&&(t[i[0]]=i[1]),t}),{})}function j(t,e){if(m(t,e))return t[e];if(!e)return t;if("string"!=typeof e){for(var n=[],r=0,i=e.length;r<i;++r){var o=j(t,e[r]);n.push(o)}return n}var a=e.indexOf(".");if(-1!==a){var s=t[e.substr(0,a)];return void 0===s?void 0:j(s,e.substr(a+1))}}function T(t,e,n){if(t&&void 0!==e&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if("string"!=typeof e&&"length"in e){P("string"!=typeof n&&"length"in n);for(var r=0,i=e.length;r<i;++r)T(t,e[r],n[r])}else{var o=e.indexOf(".");if(-1!==o){var a=e.substr(0,o),s=e.substr(o+1);if(""===s)void 0===n?p(t)&&!isNaN(parseInt(a))?t.splice(a,1):delete t[a]:t[a]=n;else{var u=t[a];u&&m(t,a)||(u=t[a]={}),T(u,s,n)}}else void 0===n?p(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=n}}function I(t){var e={};for(var n in t)m(t,n)&&(e[n]=t[n]);return e}var R=[].concat;function F(t){return R.apply([],t)}var D="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(F([8,16,32,64].map((function(t){return["Int","Uint","Float"].map((function(e){return e+t+"Array"}))})))).filter((function(t){return l[t]})),B=D.map((function(t){return l[t]}));A(D,(function(t){return[t,!0]}));var K=null;function L(t){K="undefined"!=typeof WeakMap&&new WeakMap;var e=function t(e){if(!e||"object"!=typeof e)return e;var n=K&&K.get(e);if(n)return n;if(p(e)){n=[],K&&K.set(e,n);for(var r=0,i=e.length;r<i;++r)n.push(t(e[r]))}else if(B.indexOf(e.constructor)>=0)n=e;else{var o=v(e);for(var a in n=o===Object.prototype?{}:Object.create(o),K&&K.set(e,n),e)m(e,a)&&(n[a]=t(e[a]))}return n}(t);return K=null,e}var U={}.toString;function M(t){return U.call(t).slice(8,-1)}var N="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",q="symbol"==typeof N?function(t){var e;return null!=t&&(e=t[N])&&e.apply(t)}:function(){return null},H={};function V(t){var e,n,r,i;if(1===arguments.length){if(p(t))return t.slice();if(this===H&&"string"==typeof t)return[t];if(i=q(t)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==t)return[t];if("number"==typeof(e=t.length)){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}var z="undefined"!=typeof Symbol?function(t){return"AsyncFunction"===t[Symbol.toStringTag]}:function(){return!1},W="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function $(t,e){W=t,G=e}var G=function(){return!0},Y=!new Error("").stack;function X(){if(Y)try{throw X.arguments,new Error}catch(t){return t}return new Error}function J(t,e){var n=t.stack;return n?(e=e||0,0===n.indexOf(t.name)&&(e+=(t.name+t.message).split("\n").length),n.split("\n").slice(e).filter(G).map((function(t){return"\n"+t})).join("")):""}var Q=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Z=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Q),tt={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 et(t,e){this._e=X(),this.name=t,this.message=e}function nt(t,e){return t+". Errors: "+Object.keys(e).map((function(t){return e[t].toString()})).filter((function(t,e,n){return n.indexOf(t)===e})).join("\n")}function rt(t,e,n,r){this._e=X(),this.failures=e,this.failedKeys=r,this.successCount=n,this.message=nt(t,e)}function it(t,e){this._e=X(),this.name="BulkError",this.failures=Object.keys(e).map((function(t){return e[t]})),this.failuresByPos=e,this.message=nt(t,e)}x(et).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+J(this._e,2))}},toString:function(){return this.name+": "+this.message}}),x(rt).from(et),x(it).from(et);var ot=Z.reduce((function(t,e){return t[e]=e+"Error",t}),{}),at=et,st=Z.reduce((function(t,e){var n=e+"Error";function r(t,r){this._e=X(),this.name=n,t?"string"==typeof t?(this.message=t+(r?"\n "+r:""),this.inner=r||null):"object"==typeof t&&(this.message=t.name+" "+t.message,this.inner=t):(this.message=tt[e]||n,this.inner=null)}return x(r).from(at),t[e]=r,t}),{});st.Syntax=SyntaxError,st.Type=TypeError,st.Range=RangeError;var ut=Q.reduce((function(t,e){return t[e+"Error"]=st[e],t}),{});var ct=Z.reduce((function(t,e){return-1===["Syntax","Type","Range"].indexOf(e)&&(t[e+"Error"]=st[e]),t}),{});function ft(){}function lt(t){return t}function ht(t,e){return null==t||t===lt?e:function(n){return e(t(n))}}function pt(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function dt(t,e){return t===ft?e:function(){var n=t.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=e.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?pt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?pt(i,this.onerror):i),void 0!==o?o:n}}function vt(t,e){return t===ft?e:function(){t.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?pt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?pt(r,this.onerror):r)}}function yt(t,e){return t===ft?e:function(n){var r=t.apply(this,arguments);d(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=e.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?pt(i,this.onsuccess):i),o&&(this.onerror=this.onerror?pt(o,this.onerror):o),void 0===r?void 0===a?void 0:a:d(r,a)}}function mt(t,e){return t===ft?e:function(){return!1!==e.apply(this,arguments)&&t.apply(this,arguments)}}function gt(t,e){return t===ft?e:function(){var n=t.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then((function(){return e.apply(r,o)}))}return e.apply(this,arguments)}}ct.ModifyError=rt,ct.DexieError=et,ct.BulkError=it;var bt={},wt="undefined"==typeof Promise?[]:function(){var t=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[t,v(t),t];var e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,v(e),t]}(),xt=wt[0],_t=wt[1],St=wt[2],Ct=_t&&_t.then,Et=xt&&xt.constructor,kt=!!St,Pt=!1,Ot=St?function(){St.then(Xt)}:l.setImmediate?setImmediate.bind(null,Xt):l.MutationObserver?function(){var t=document.createElement("div");new MutationObserver((function(){Xt(),t=null})).observe(t,{attributes:!0}),t.setAttribute("i","1")}:function(){setTimeout(Xt,0)},At=function(t,e){Lt.push([t,e]),Tt&&(Ot(),Tt=!1)},jt=!0,Tt=!0,It=[],Rt=[],Ft=null,Dt=lt,Bt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:we,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((function(t){try{we(t[0],t[1])}catch(t){}}))}},Kt=Bt,Lt=[],Ut=0,Mt=[];function Nt(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ft,this._lib=!1;var e=this._PSD=Kt;if(W&&(this._stackHolder=X(),this._prev=null,this._numPrev=0),"function"!=typeof t){if(t!==bt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&zt(this,this._value))}this._state=null,this._value=null,++e.ref,Vt(this,t)}var qt={get:function(){var t=Kt,e=ae;function n(n,r){var i=this,o=!t.global&&(t!==Kt||e!==ae),a=o&&!fe(),s=new Nt((function(e,s){$t(i,new Ht(ge(n,t,o,a),ge(r,t,o,a),e,s,t))}));return W&&Yt(s,this),s}return n.prototype=bt,n},set:function(t){w(this,"then",t&&t.prototype===bt?qt:{get:function(){return t},set:qt.set})}};function Ht(t,e,n,r,i){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=r,this.psd=i}function Vt(t,e){try{e((function(e){if(null===t._state){if(e===t)throw new TypeError("A promise cannot be resolved with itself.");var n=t._lib&&Jt();e&&"function"==typeof e.then?Vt(t,(function(t,n){e instanceof Nt?e._then(t,n):e.then(t,n)})):(t._state=!0,t._value=e,Wt(t)),n&&Qt()}}),zt.bind(null,t))}catch(e){zt(t,e)}}function zt(t,e){if(Rt.push(e),null===t._state){var n=t._lib&&Jt();e=Dt(e),t._state=!1,t._value=e,W&&null!==e&&"object"==typeof e&&!e._promise&&function(t,e,n){try{t.apply(null,n)}catch(t){e&&e(t)}}((function(){var n=S(e,"stack");e._promise=t,w(e,"stack",{get:function(){return Pt?n&&(n.get?n.get.apply(e):n.value):t.stack}})})),function(t){It.some((function(e){return e._value===t._value}))||It.push(t)}(t),Wt(t),n&&Qt()}}function Wt(t){var e=t._listeners;t._listeners=[];for(var n=0,r=e.length;n<r;++n)$t(t,e[n]);var i=t._PSD;--i.ref||i.finalize(),0===Ut&&(++Ut,At((function(){0==--Ut&&Zt()}),[]))}function $t(t,e){if(null!==t._state){var n=t._state?e.onFulfilled:e.onRejected;if(null===n)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++Ut,At(Gt,[n,t,e])}else t._listeners.push(e)}function Gt(t,e,n){try{Ft=e;var r,i=e._value;e._state?r=t(i):(Rt.length&&(Rt=[]),r=t(i),-1===Rt.indexOf(i)&&function(t){var e=It.length;for(;e;)if(It[--e]._value===t._value)return void It.splice(e,1)}(e)),n.resolve(r)}catch(t){n.reject(t)}finally{Ft=null,0==--Ut&&Zt(),--n.psd.ref||n.psd.finalize()}}function Yt(t,e){var n=e?e._numPrev+1:0;n<100&&(t._prev=e,t._numPrev=n)}function Xt(){Jt()&&Qt()}function Jt(){var t=jt;return jt=!1,Tt=!1,t}function Qt(){var t,e,n;do{for(;Lt.length>0;)for(t=Lt,Lt=[],n=t.length,e=0;e<n;++e){var r=t[e];r[0].apply(null,r[1])}}while(Lt.length>0);jt=!0,Tt=!0}function Zt(){var t=It;It=[],t.forEach((function(t){t._PSD.onunhandled.call(null,t._value,t)}));for(var e=Mt.slice(0),n=e.length;n;)e[--n]()}function te(t){return new Nt(bt,!1,t)}function ee(t,e){var n=Kt;return function(){var r=Jt(),i=Kt;try{return de(n,!0),t.apply(this,arguments)}catch(t){e&&e(t)}finally{de(i,!1),r&&Qt()}}}g(Nt.prototype,{then:qt,_then:function(t,e){$t(this,new Ht(null,null,t,e,Kt))},catch:function(t){if(1===arguments.length)return this.then(null,t);var e=arguments[0],n=arguments[1];return"function"==typeof e?this.then(null,(function(t){return t instanceof e?n(t):te(t)})):this.then(null,(function(t){return t&&t.name===e?n(t):te(t)}))},finally:function(t){return this.then((function(e){return t(),e}),(function(e){return t(),te(e)}))},stack:{get:function(){if(this._stack)return this._stack;try{Pt=!0;var t=function t(e,n,r){if(n.length===r)return n;var i="";if(!1===e._state){var o,a,s=e._value;null!=s?(o=s.name||"Error",a=s.message||s,i=J(s,0)):(o=s,a=""),n.push(o+(a?": "+a:"")+i)}W&&((i=J(e._stackHolder,2))&&-1===n.indexOf(i)&&n.push(i),e._prev&&t(e._prev,n,r));return n}(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{Pt=!1}}},timeout:function(t,e){var n=this;return t<1/0?new Nt((function(r,i){var o=setTimeout((function(){return i(new st.Timeout(e))}),t);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&w(Nt.prototype,Symbol.toStringTag,"Dexie.Promise"),Bt.env=ve(),g(Nt,{all:function(){var t=V.apply(null,arguments).map(le);return new Nt((function(e,n){0===t.length&&e([]);var r=t.length;t.forEach((function(i,o){return Nt.resolve(i).then((function(n){t[o]=n,--r||e(t)}),n)}))}))},resolve:function(t){if(t instanceof Nt)return t;if(t&&"function"==typeof t.then)return new Nt((function(e,n){t.then(e,n)}));var e=new Nt(bt,!0,t);return Yt(e,Ft),e},reject:te,race:function(){var t=V.apply(null,arguments).map(le);return new Nt((function(e,n){t.map((function(t){return Nt.resolve(t).then(e,n)}))}))},PSD:{get:function(){return Kt},set:function(t){return Kt=t}},totalEchoes:{get:function(){return ae}},newPSD:ue,usePSD:ye,scheduler:{get:function(){return At},set:function(t){At=t}},rejectionMapper:{get:function(){return Dt},set:function(t){Dt=t}},follow:function(t,e){return new Nt((function(n,r){return ue((function(e,n){var r=Kt;r.unhandleds=[],r.onunhandled=n,r.finalize=pt((function(){var t=this;!function(t){Mt.push((function e(){t(),Mt.splice(Mt.indexOf(e),1)})),++Ut,At((function(){0==--Ut&&Zt()}),[])}((function(){0===t.unhandleds.length?e():n(t.unhandleds[0])}))}),r.finalize),t()}),e,n,r)}))}}),Et&&(Et.allSettled&&w(Nt,"allSettled",(function(){var t=V.apply(null,arguments).map(le);return new Nt((function(e){0===t.length&&e([]);var n=t.length,r=new Array(n);t.forEach((function(t,i){return Nt.resolve(t).then((function(t){return r[i]={status:"fulfilled",value:t}}),(function(t){return r[i]={status:"rejected",reason:t}})).then((function(){return--n||e(r)}))}))}))})),Et.any&&"undefined"!=typeof AggregateError&&w(Nt,"any",(function(){var t=V.apply(null,arguments).map(le);return new Nt((function(e,n){0===t.length&&n(new AggregateError([]));var r=t.length,i=new Array(r);t.forEach((function(t,o){return Nt.resolve(t).then((function(t){return e(t)}),(function(t){i[o]=t,--r||n(new AggregateError(i))}))}))}))})));var ne={awaits:0,echoes:0,id:0},re=0,ie=[],oe=0,ae=0,se=0;function ue(t,e,n,r){var i=Kt,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++se;var a=Bt.env;o.env=kt?{Promise:Nt,PromiseProp:{value:Nt,configurable:!0,writable:!0},all:Nt.all,race:Nt.race,allSettled:Nt.allSettled,any:Nt.any,resolve:Nt.resolve,reject:Nt.reject,nthen:be(a.nthen,o),gthen:be(a.gthen,o)}:{},e&&d(o,e),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=ye(o,t,n,r);return 0===o.ref&&o.finalize(),s}function ce(){return ne.id||(ne.id=++re),++ne.awaits,ne.echoes+=100,ne.id}function fe(){return!!ne.awaits&&(0==--ne.awaits&&(ne.id=0),ne.echoes=100*ne.awaits,!0)}function le(t){return ne.echoes&&t&&t.constructor===Et?(ce(),t.then((function(t){return fe(),t}),(function(t){return fe(),xe(t)}))):t}function he(t){++ae,ne.echoes&&0!=--ne.echoes||(ne.echoes=ne.id=0),ie.push(Kt),de(t,!0)}function pe(){var t=ie[ie.length-1];ie.pop(),de(t,!1)}function de(t,e){var n=Kt;if((e?!ne.echoes||oe++&&t===Kt:!oe||--oe&&t===Kt)||me(e?he.bind(null,t):pe),t!==Kt&&(Kt=t,n===Bt&&(Bt.env=ve()),kt)){var r=Bt.env.Promise,i=t.env;_t.then=i.nthen,r.prototype.then=i.gthen,(n.global||t.global)&&(Object.defineProperty(l,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function ve(){var t=l.Promise;return kt?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(l,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:_t.then,gthen:t.prototype.then}:{}}function ye(t,e,n,r,i){var o=Kt;try{return de(t,!0),e(n,r,i)}finally{de(o,!1)}}function me(t){Ct.call(xt,t)}function ge(t,e,n,r){return"function"!=typeof t?t:function(){var i=Kt;n&&ce(),de(e,!0);try{return t.apply(this,arguments)}finally{de(i,!1),r&&me(fe)}}}function be(t,e){return function(n,r){return t.call(this,ge(n,e),ge(r,e))}}-1===(""+Ct).indexOf("[native code]")&&(ce=fe=ft);function we(t,e){var n;try{n=e.onuncatched(t)}catch(t){}if(!1!==n)try{var r,i={promise:e,reason:t};if(l.document&&document.createEvent?((r=document.createEvent("Event")).initEvent("unhandledrejection",!0,!0),d(r,i)):l.CustomEvent&&d(r=new CustomEvent("unhandledrejection",{detail:i}),i),r&&l.dispatchEvent&&(dispatchEvent(r),!l.PromiseRejectionEvent&&l.onunhandledrejection))try{l.onunhandledrejection(r)}catch(t){}W&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(t.stack||t))}catch(t){}}var xe=Nt.reject;var _e=String.fromCharCode(65535),Se="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Ce=[],Ee="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ke=Ee,Pe=Ee,Oe=function(t){return!/(dexie\.js|dexie\.min\.js)/.test(t)};function Ae(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}var je={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Te(t){return"string"!=typeof t||/\./.test(t)?function(t){return t}:function(e){return void 0===e[t]&&t in e&&delete(e=L(e))[t],e}}var Ie=function(){function t(){}return t.prototype._trans=function(t,e,n){var r=this._tx||Kt.trans,i=this.name;function o(t,n,r){if(!r.schema[i])throw new st.NotFound("Table "+i+" not part of transaction");return e(r.idbtrans,r)}var a=Jt();try{return r&&r.db===this.db?r===Kt.trans?r._promise(t,o,n):ue((function(){return r._promise(t,o,n)}),{trans:r,transless:Kt.transless||Kt}):function t(e,n,r,i){if(e.idbdb&&(e._state.openComplete||Kt.letThrough||e._vip)){var o=e._createTransaction(n,r,e._dbSchema);try{o.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===ot.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((function(){return t(e,n,r,i)}))):xe(o)}return o._promise(n,(function(t,e){return ue((function(){return Kt.trans=o,i(t,e,o)}))})).then((function(t){return o._completion.then((function(){return t}))}))}if(e._state.openComplete)return xe(new st.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return xe(new st.DatabaseClosed);e.open().catch(ft)}return e._state.dbReadyPromise.then((function(){return t(e,n,r,i)}))}(this.db,t,[this.name],o)}finally{a&&Qt()}},t.prototype.get=function(t,e){var n=this;return t&&t.constructor===Object?this.where(t).first(e):this._trans("readonly",(function(e){return n.core.get({trans:e,key:t}).then((function(t){return n.hook.reading.fire(t)}))})).then(e)},t.prototype.where=function(t){if("string"==typeof t)return new this.db.WhereClause(this,t);if(p(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var e=h(t);if(1===e.length)return this.where(e[0]).equals(t[e[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter((function(t){return t.compound&&e.every((function(e){return t.keyPath.indexOf(e)>=0}))&&t.keyPath.every((function(t){return e.indexOf(t)>=0}))}))[0];if(n&&this.db._maxKey!==_e)return this.where(n.name).equals(n.keyPath.map((function(e){return t[e]})));!n&&W&&console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a compound index ["+e.join("+")+"]");var r=this.schema.idxByName,i=this.db._deps.indexedDB;function o(t,e){try{return 0===i.cmp(t,e)}catch(t){return!1}}var a=e.reduce((function(e,n){var i=e[0],a=e[1],s=r[n],u=t[n];return[i||s,i||!s?Ae(a,s&&s.multi?function(t){var e=j(t,n);return p(e)&&e.some((function(t){return o(u,t)}))}:function(t){return o(u,j(t,n))}):a]}),[null,null]),s=a[0],u=a[1];return s?this.where(s.name).equals(t[s.keyPath]).filter(u):n?this.filter(u):this.where(e).equals("")},t.prototype.filter=function(t){return this.toCollection().and(t)},t.prototype.count=function(t){return this.toCollection().count(t)},t.prototype.offset=function(t){return this.toCollection().offset(t)},t.prototype.limit=function(t){return this.toCollection().limit(t)},t.prototype.each=function(t){return this.toCollection().each(t)},t.prototype.toArray=function(t){return this.toCollection().toArray(t)},t.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},t.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,p(t)?"["+t.join("+")+"]":t))},t.prototype.reverse=function(){return this.toCollection().reverse()},t.prototype.mapToClass=function(t){this.schema.mappedClass=t;var e=function(e){if(!e)return e;var n=Object.create(t.prototype);for(var r in e)if(m(e,r))try{n[r]=e[r]}catch(t){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=e,this.hook("reading",e),t},t.prototype.defineClass=function(){return this.mapToClass((function(t){d(this,t)}))},t.prototype.add=function(t,e){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=t;return o&&i&&(a=Te(o)(t)),this._trans("readwrite",(function(t){return n.core.mutate({trans:t,type:"add",keys:null!=e?[e]:null,values:[a]})})).then((function(t){return t.numFailures?Nt.reject(t.failures[0]):t.lastResult})).then((function(e){if(o)try{T(t,o,e)}catch(t){}return e}))},t.prototype.update=function(t,e){if("object"!=typeof t||p(t))return this.where(":id").equals(t).modify(e);var n=j(t,this.schema.primKey.keyPath);if(void 0===n)return xe(new st.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof e?h(e).forEach((function(n){T(t,n,e[n])})):e(t,{value:t,primKey:n})}catch(t){}return this.where(":id").equals(n).modify(e)},t.prototype.put=function(t,e){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=t;return o&&i&&(a=Te(o)(t)),this._trans("readwrite",(function(t){return n.core.mutate({trans:t,type:"put",values:[a],keys:null!=e?[e]:null})})).then((function(t){return t.numFailures?Nt.reject(t.failures[0]):t.lastResult})).then((function(e){if(o)try{T(t,o,e)}catch(t){}return e}))},t.prototype.delete=function(t){var e=this;return this._trans("readwrite",(function(n){return e.core.mutate({trans:n,type:"delete",keys:[t]})})).then((function(t){return t.numFailures?Nt.reject(t.failures[0]):void 0}))},t.prototype.clear=function(){var t=this;return this._trans("readwrite",(function(e){return t.core.mutate({trans:e,type:"deleteRange",range:je})})).then((function(t){return t.numFailures?Nt.reject(t.failures[0]):void 0}))},t.prototype.bulkGet=function(t){var e=this;return this._trans("readonly",(function(n){return e.core.getMany({keys:t,trans:n}).then((function(t){return t.map((function(t){return e.hook.reading.fire(t)}))}))}))},t.prototype.bulkAdd=function(t,e,n){var r=this,i=Array.isArray(e)?e:void 0,o=(n=n||(i?void 0:e))?n.allKeys:void 0;return this._trans("readwrite",(function(e){var n=r.schema.primKey,a=n.auto,s=n.keyPath;if(s&&i)throw new st.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==t.length)throw new st.InvalidArgument("Arguments objects and keys must have the same length");var u=t.length,c=s&&a?t.map(Te(s)):t;return r.core.mutate({trans:e,type:"add",keys:i,values:c,wantResults:o}).then((function(t){var e=t.numFailures,n=t.results,i=t.lastResult,a=t.failures;if(0===e)return o?n:i;throw new it(r.name+".bulkAdd(): "+e+" of "+u+" operations failed",a)}))}))},t.prototype.bulkPut=function(t,e,n){var r=this,i=Array.isArray(e)?e:void 0,o=(n=n||(i?void 0:e))?n.allKeys:void 0;return this._trans("readwrite",(function(e){var n=r.schema.primKey,a=n.auto,s=n.keyPath;if(s&&i)throw new st.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==t.length)throw new st.InvalidArgument("Arguments objects and keys must have the same length");var u=t.length,c=s&&a?t.map(Te(s)):t;return r.core.mutate({trans:e,type:"put",keys:i,values:c,wantResults:o}).then((function(t){var e=t.numFailures,n=t.results,i=t.lastResult,a=t.failures;if(0===e)return o?n:i;throw new it(r.name+".bulkPut(): "+e+" of "+u+" operations failed",a)}))}))},t.prototype.bulkDelete=function(t){var e=this,n=t.length;return this._trans("readwrite",(function(n){return e.core.mutate({trans:n,type:"delete",keys:t})})).then((function(t){var r=t.numFailures,i=t.lastResult,o=t.failures;if(0===r)return i;throw new it(e.name+".bulkDelete(): "+r+" of "+n+" operations failed",o)}))},t}();function Re(t){var e={},n=function(n,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return e[n].subscribe.apply(null,o),t}if("string"==typeof n)return e[n]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(t,r,i){if("object"==typeof t)return a(t);r||(r=mt),i||(i=ft);var o={subscribers:[],fire:i,subscribe:function(t){-1===o.subscribers.indexOf(t)&&(o.subscribers.push(t),o.fire=r(o.fire,t))},unsubscribe:function(t){o.subscribers=o.subscribers.filter((function(e){return e!==t})),o.fire=o.subscribers.reduce(r,i)}};return e[t]=n[t]=o,o}function a(t){h(t).forEach((function(e){var n=t[e];if(p(n))o(e,t[e][0],t[e][1]);else{if("asap"!==n)throw new st.InvalidArgument("Invalid event config");var r=o(e,lt,(function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];r.subscribers.forEach((function(t){O((function(){t.apply(null,e)}))}))}))}}))}}function Fe(t,e){return x(e).from({prototype:t}),e}function De(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function Be(t,e){t.filter=Ae(t.filter,e)}function Ke(t,e,n){var r=t.replayFilter;t.replayFilter=r?function(){return Ae(r(),e())}:e,t.justLimit=n&&!r}function Le(t,e){if(t.isPrimKey)return e.primaryKey;var n=e.getIndexByKeyPath(t.index);if(!n)throw new st.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return n}function Ue(t,e,n){var r=Le(t,e.schema);return e.openCursor({trans:n,values:!t.keysOnly,reverse:"prev"===t.dir,unique:!!t.unique,query:{index:r,range:t.range}})}function Me(t,e,n,r){var i=t.replayFilter?Ae(t.filter,t.replayFilter()):t.filter;if(t.or){var o={},a=function(t,n,r){if(!i||i(n,r,(function(t){return n.stop(t)}),(function(t){return n.fail(t)}))){var a=n.primaryKey,s=""+a;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(a)),m(o,s)||(o[s]=!0,e(t,n,r))}};return Promise.all([t.or._iterate(a,n),Ne(Ue(t,r,n),t.algorithm,a,!t.keysOnly&&t.valueMapper)])}return Ne(Ue(t,r,n),Ae(t.algorithm,i),e,!t.keysOnly&&t.valueMapper)}function Ne(t,e,n,r){var i=ee(r?function(t,e,i){return n(r(t),e,i)}:n);return t.then((function(t){if(t)return t.start((function(){var n=function(){return t.continue()};e&&!e(t,(function(t){return n=t}),(function(e){t.stop(e),n=ft}),(function(e){t.fail(e),n=ft}))||i(t.value,t,(function(t){return n=t})),n()}))}))}function qe(t,e){try{var n=He(t),r=He(e);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t>e?1:t<e?-1:0;case"binary":return function(t,e){for(var n=t.length,r=e.length,i=n<r?n:r,o=0;o<i;++o)if(t[o]!==e[o])return t[o]<e[o]?-1:1;return n===r?0:n<r?-1:1}(Ve(t),Ve(e));case"Array":return function(t,e){for(var n=t.length,r=e.length,i=n<r?n:r,o=0;o<i;++o){var a=qe(t[o],e[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(t,e)}}catch(t){}return NaN}function He(t){var e=typeof t;if("object"!==e)return e;if(ArrayBuffer.isView(t))return"binary";var n=M(t);return"ArrayBuffer"===n?"binary":n}function Ve(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}var ze=function(){function t(){}return t.prototype._read=function(t,e){var n=this._ctx;return n.error?n.table._trans(null,xe.bind(null,n.error)):n.table._trans("readonly",t).then(e)},t.prototype._write=function(t){var e=this._ctx;return e.error?e.table._trans(null,xe.bind(null,e.error)):e.table._trans("readwrite",t,"locked")},t.prototype._addAlgorithm=function(t){var e=this._ctx;e.algorithm=Ae(e.algorithm,t)},t.prototype._iterate=function(t,e){return Me(this._ctx,t,e,this._ctx.table.core)},t.prototype.clone=function(t){var e=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return t&&d(n,t),e._ctx=n,e},t.prototype.raw=function(){return this._ctx.valueMapper=null,this},t.prototype.each=function(t){var e=this._ctx;return this._read((function(n){return Me(e,t,n,e.table.core)}))},t.prototype.count=function(t){var e=this;return this._read((function(t){var n=e._ctx,r=n.table.core;if(De(n,!0))return r.count({trans:t,query:{index:Le(n,r.schema),range:n.range}}).then((function(t){return Math.min(t,n.limit)}));var i=0;return Me(n,(function(){return++i,!1}),t,r).then((function(){return i}))})).then(t)},t.prototype.sortBy=function(t,e){var n=t.split(".").reverse(),r=n[0],i=n.length-1;function o(t,e){return e?o(t[n[e]],e-1):t[r]}var a="next"===this._ctx.dir?1:-1;function s(t,e){var n=o(t,i),r=o(e,i);return n<r?-a:n>r?a:0}return this.toArray((function(t){return t.sort(s)})).then(e)},t.prototype.toArray=function(t){var e=this;return this._read((function(t){var n=e._ctx;if("next"===n.dir&&De(n,!0)&&n.limit>0){var r=n.valueMapper,i=Le(n,n.table.core.schema);return n.table.core.query({trans:t,limit:n.limit,values:!0,query:{index:i,range:n.range}}).then((function(t){var e=t.result;return r?e.map(r):e}))}var o=[];return Me(n,(function(t){return o.push(t)}),t,n.table.core).then((function(){return o}))}),t)},t.prototype.offset=function(t){var e=this._ctx;return t<=0||(e.offset+=t,De(e)?Ke(e,(function(){var e=t;return function(t,n){return 0===e||(1===e?(--e,!1):(n((function(){t.advance(e),e=0})),!1))}})):Ke(e,(function(){var e=t;return function(){return--e<0}}))),this},t.prototype.limit=function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Ke(this._ctx,(function(){var e=t;return function(t,n,r){return--e<=0&&n(r),e>=0}}),!0),this},t.prototype.until=function(t,e){return Be(this._ctx,(function(n,r,i){return!t(n.value)||(r(i),e)})),this},t.prototype.first=function(t){return this.limit(1).toArray((function(t){return t[0]})).then(t)},t.prototype.last=function(t){return this.reverse().first(t)},t.prototype.filter=function(t){var e,n;return Be(this._ctx,(function(e){return t(e.value)})),e=this._ctx,n=t,e.isMatch=Ae(e.isMatch,n),this},t.prototype.and=function(t){return this.filter(t)},t.prototype.or=function(t){return new this.db.WhereClause(this._ctx.table,t,this)},t.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},t.prototype.desc=function(){return this.reverse()},t.prototype.eachKey=function(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each((function(e,n){t(n.key,n)}))},t.prototype.eachUniqueKey=function(t){return this._ctx.unique="unique",this.eachKey(t)},t.prototype.eachPrimaryKey=function(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each((function(e,n){t(n.primaryKey,n)}))},t.prototype.keys=function(t){var e=this._ctx;e.keysOnly=!e.isMatch;var n=[];return this.each((function(t,e){n.push(e.key)})).then((function(){return n})).then(t)},t.prototype.primaryKeys=function(t){var e=this._ctx;if("next"===e.dir&&De(e,!0)&&e.limit>0)return this._read((function(t){var n=Le(e,e.table.core.schema);return e.table.core.query({trans:t,values:!1,limit:e.limit,query:{index:n,range:e.range}})})).then((function(t){return t.result})).then(t);e.keysOnly=!e.isMatch;var n=[];return this.each((function(t,e){n.push(e.primaryKey)})).then((function(){return n})).then(t)},t.prototype.uniqueKeys=function(t){return this._ctx.unique="unique",this.keys(t)},t.prototype.firstKey=function(t){return this.limit(1).keys((function(t){return t[0]})).then(t)},t.prototype.lastKey=function(t){return this.reverse().firstKey(t)},t.prototype.distinct=function(){var t=this._ctx,e=t.index&&t.table.schema.idxByName[t.index];if(!e||!e.multi)return this;var n={};return Be(this._ctx,(function(t){var e=t.primaryKey.toString(),r=m(n,e);return n[e]=!0,!r})),this},t.prototype.modify=function(t){var e=this,n=this._ctx;return this._write((function(r){var i;if("function"==typeof t)i=t;else{var o=h(t),a=o.length;i=function(e){for(var n=!1,r=0;r<a;++r){var i=o[r],s=t[i];j(e,i)!==s&&(T(e,i,s),n=!0)}return n}}var s=n.table.core,u=s.schema.primaryKey,c=u.outbound,f=u.extractKey,l=e.db._options.modifyChunkSize||200,p=[],d=0,v=[],y=function(t,e){var n=e.failures,r=e.numFailures;d+=t-r;for(var i=0,o=h(n);i<o.length;i++){var a=o[i];p.push(n[a])}};return e.clone().primaryKeys().then((function(e){var o=function(a){var u=Math.min(l,e.length-a);return s.getMany({trans:r,keys:e.slice(a,a+u),cache:"immutable"}).then((function(h){for(var p=[],d=[],v=c?[]:null,m=[],g=0;g<u;++g){var b=h[g],w={value:L(b),primKey:e[a+g]};!1!==i.call(w,w.value,w)&&(null==w.value?m.push(e[a+g]):c||0===qe(f(b),f(w.value))?(d.push(w.value),c&&v.push(e[a+g])):(m.push(e[a+g]),p.push(w.value)))}var x=De(n)&&n.limit===1/0&&("function"!=typeof t||t===We)&&{index:n.index,range:n.range};return Promise.resolve(p.length>0&&s.mutate({trans:r,type:"add",values:p}).then((function(t){for(var e in t.failures)m.splice(parseInt(e),1);y(p.length,t)}))).then((function(){return(d.length>0||x&&"object"==typeof t)&&s.mutate({trans:r,type:"put",keys:v,values:d,criteria:x,changeSpec:"function"!=typeof t&&t}).then((function(t){return y(d.length,t)}))})).then((function(){return(m.length>0||x&&t===We)&&s.mutate({trans:r,type:"delete",keys:m,criteria:x}).then((function(t){return y(m.length,t)}))})).then((function(){return e.length>a+u&&o(a+l)}))}))};return o(0).then((function(){if(p.length>0)throw new rt("Error modifying one or more objects",p,d,v);return e.length}))}))}))},t.prototype.delete=function(){var t=this._ctx,e=t.range;return De(t)&&(t.isPrimKey&&!Pe||3===e.type)?this._write((function(n){var r=t.table.core.schema.primaryKey,i=e;return t.table.core.count({trans:n,query:{index:r,range:i}}).then((function(e){return t.table.core.mutate({trans:n,type:"deleteRange",range:i}).then((function(t){var n=t.failures;t.lastResult,t.results;var r=t.numFailures;if(r)throw new rt("Could not delete some values",Object.keys(n).map((function(t){return n[t]})),e-r);return e-r}))}))})):this.modify(We)},t}(),We=function(t,e){return e.value=null};function $e(t,e){return t<e?-1:t===e?0:1}function Ge(t,e){return t>e?-1:t===e?0:1}function Ye(t,e,n){var r=t instanceof en?new t.Collection(t):t;return r._ctx.error=n?new n(e):new TypeError(e),r}function Xe(t){return new t.Collection(t,(function(){return tn("")})).limit(0)}function Je(t,e,n,r,i,o){for(var a=Math.min(t.length,r.length),s=-1,u=0;u<a;++u){var c=e[u];if(c!==r[u])return i(t[u],n[u])<0?t.substr(0,u)+n[u]+n.substr(u+1):i(t[u],r[u])<0?t.substr(0,u)+r[u]+n.substr(u+1):s>=0?t.substr(0,s)+e[s]+n.substr(s+1):null;i(t[u],c)<0&&(s=u)}return a<r.length&&"next"===o?t+n.substr(t.length):a<t.length&&"prev"===o?t.substr(0,n.length):s<0?null:t.substr(0,s)+r[s]+n.substr(s+1)}function Qe(t,e,n,r){var i,o,a,s,u,c,f,l=n.length;if(!n.every((function(t){return"string"==typeof t})))return Ye(t,"String expected.");function h(t){i=function(t){return"next"===t?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}(t),o=function(t){return"next"===t?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}(t),a="next"===t?$e:Ge;var e=n.map((function(t){return{lower:o(t),upper:i(t)}})).sort((function(t,e){return a(t.lower,e.lower)}));s=e.map((function(t){return t.upper})),u=e.map((function(t){return t.lower})),c=t,f="next"===t?"":r}h("next");var p=new t.Collection(t,(function(){return Ze(s[0],u[l-1]+r)}));p._ondirectionchange=function(t){h(t)};var d=0;return p._addAlgorithm((function(t,n,r){var i=t.key;if("string"!=typeof i)return!1;var h=o(i);if(e(h,u,d))return!0;for(var p=null,v=d;v<l;++v){var y=Je(i,h,s[v],u[v],a,c);null===y&&null===p?d=v+1:(null===p||a(p,y)>0)&&(p=y)}return n(null!==p?function(){t.continue(p+f)}:r),!1})),p}function Ze(t,e,n,r){return{type:2,lower:t,upper:e,lowerOpen:n,upperOpen:r}}function tn(t){return{type:1,lower:t,upper:t}}var en=function(){function t(){}return Object.defineProperty(t.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),t.prototype.between=function(t,e,n,r){n=!1!==n,r=!0===r;try{return this._cmp(t,e)>0||0===this._cmp(t,e)&&(n||r)&&(!n||!r)?Xe(this):new this.Collection(this,(function(){return Ze(t,e,!n,!r)}))}catch(t){return Ye(this,Se)}},t.prototype.equals=function(t){return null==t?Ye(this,Se):new this.Collection(this,(function(){return tn(t)}))},t.prototype.above=function(t){return null==t?Ye(this,Se):new this.Collection(this,(function(){return Ze(t,void 0,!0)}))},t.prototype.aboveOrEqual=function(t){return null==t?Ye(this,Se):new this.Collection(this,(function(){return Ze(t,void 0,!1)}))},t.prototype.below=function(t){return null==t?Ye(this,Se):new this.Collection(this,(function(){return Ze(void 0,t,!1,!0)}))},t.prototype.belowOrEqual=function(t){return null==t?Ye(this,Se):new this.Collection(this,(function(){return Ze(void 0,t)}))},t.prototype.startsWith=function(t){return"string"!=typeof t?Ye(this,"String expected."):this.between(t,t+_e,!0,!0)},t.prototype.startsWithIgnoreCase=function(t){return""===t?this.startsWith(t):Qe(this,(function(t,e){return 0===t.indexOf(e[0])}),[t],_e)},t.prototype.equalsIgnoreCase=function(t){return Qe(this,(function(t,e){return t===e[0]}),[t],"")},t.prototype.anyOfIgnoreCase=function(){var t=V.apply(H,arguments);return 0===t.length?Xe(this):Qe(this,(function(t,e){return-1!==e.indexOf(t)}),t,"")},t.prototype.startsWithAnyOfIgnoreCase=function(){var t=V.apply(H,arguments);return 0===t.length?Xe(this):Qe(this,(function(t,e){return e.some((function(e){return 0===t.indexOf(e)}))}),t,_e)},t.prototype.anyOf=function(){var t=this,e=V.apply(H,arguments),n=this._cmp;try{e.sort(n)}catch(t){return Ye(this,Se)}if(0===e.length)return Xe(this);var r=new this.Collection(this,(function(){return Ze(e[0],e[e.length-1])}));r._ondirectionchange=function(r){n="next"===r?t._ascending:t._descending,e.sort(n)};var i=0;return r._addAlgorithm((function(t,r,o){for(var a=t.key;n(a,e[i])>0;)if(++i===e.length)return r(o),!1;return 0===n(a,e[i])||(r((function(){t.continue(e[i])})),!1)})),r},t.prototype.notEqual=function(t){return this.inAnyRange([[-1/0,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},t.prototype.noneOf=function(){var t=V.apply(H,arguments);if(0===t.length)return new this.Collection(this);try{t.sort(this._ascending)}catch(t){return Ye(this,Se)}var e=t.reduce((function(t,e){return t?t.concat([[t[t.length-1][1],e]]):[[-1/0,e]]}),null);return e.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})},t.prototype.inAnyRange=function(t,e){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,s=this._max;if(0===t.length)return Xe(this);if(!t.every((function(t){return void 0!==t[0]&&void 0!==t[1]&&i(t[0],t[1])<=0})))return Ye(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",st.InvalidArgument);var u=!e||!1!==e.includeLowers,c=e&&!0===e.includeUppers;var f,l=i;function h(t,e){return l(t[0],e[0])}try{(f=t.reduce((function(t,e){for(var n=0,i=t.length;n<i;++n){var o=t[n];if(r(e[0],o[1])<0&&r(e[1],o[0])>0){o[0]=a(o[0],e[0]),o[1]=s(o[1],e[1]);break}}return n===i&&t.push(e),t}),[])).sort(h)}catch(t){return Ye(this,Se)}var p=0,d=c?function(t){return i(t,f[p][1])>0}:function(t){return i(t,f[p][1])>=0},v=u?function(t){return o(t,f[p][0])>0}:function(t){return o(t,f[p][0])>=0};var y=d,m=new this.Collection(this,(function(){return Ze(f[0][0],f[f.length-1][1],!u,!c)}));return m._ondirectionchange=function(t){"next"===t?(y=d,l=i):(y=v,l=o),f.sort(h)},m._addAlgorithm((function(t,e,r){for(var o=t.key;y(o);)if(++p===f.length)return e(r),!1;return!!function(t){return!d(t)&&!v(t)}(o)||(0===n._cmp(o,f[p][1])||0===n._cmp(o,f[p][0])||e((function(){l===i?t.continue(f[p][0]):t.continue(f[p][1])})),!1)})),m},t.prototype.startsWithAnyOf=function(){var t=V.apply(H,arguments);return t.every((function(t){return"string"==typeof t}))?0===t.length?Xe(this):this.inAnyRange(t.map((function(t){return[t,t+_e]}))):Ye(this,"startsWithAnyOf() only works with strings")},t}();function nn(t){return ee((function(e){return rn(e),t(e.target.error),!1}))}function rn(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}var on=Re(null,"storagemutated"),an=function(){function t(){}return t.prototype._lock=function(){return P(!Kt.global),++this._reculock,1!==this._reculock||Kt.global||(Kt.lockOwnerFor=this),this},t.prototype._unlock=function(){if(P(!Kt.global),0==--this._reculock)for(Kt.global||(Kt.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{ye(t[1],t[0])}catch(t){}}return this},t.prototype._locked=function(){return this._reculock&&Kt.lockOwnerFor!==this},t.prototype.create=function(t){var e=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(P(!this.idbtrans),!t&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new st.DatabaseClosed(r);case"MissingAPIError":throw new st.MissingAPI(r.message,r);default:throw new st.OpenFailed(r)}if(!this.active)throw new st.TransactionInactive;return P(null===this._completion._state),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ee((function(n){rn(n),e._reject(t.error)})),t.onabort=ee((function(n){rn(n),e.active&&e._reject(new st.Abort(t.error)),e.active=!1,e.on("abort").fire(n)})),t.oncomplete=ee((function(){e.active=!1,e._resolve(),"mutatedParts"in t&&on.storagemutated.fire(t.mutatedParts)})),this},t.prototype._promise=function(t,e,n){var r=this;if("readwrite"===t&&"readwrite"!==this.mode)return xe(new st.ReadOnly("Transaction is readonly"));if(!this.active)return xe(new st.TransactionInactive);if(this._locked())return new Nt((function(i,o){r._blockedFuncs.push([function(){r._promise(t,e,n).then(i,o)},Kt])}));if(n)return ue((function(){var t=new Nt((function(t,n){r._lock();var i=e(t,n,r);i&&i.then&&i.then(t,n)}));return t.finally((function(){return r._unlock()})),t._lib=!0,t}));var i=new Nt((function(t,n){var i=e(t,n,r);i&&i.then&&i.then(t,n)}));return i._lib=!0,i},t.prototype._root=function(){return this.parent?this.parent._root():this},t.prototype.waitFor=function(t){var e=this._root(),n=Nt.resolve(t);if(e._waitingFor)e._waitingFor=e._waitingFor.then((function(){return n}));else{e._waitingFor=n,e._waitingQueue=[];var r=e.idbtrans.objectStore(e.storeNames[0]);!function t(){for(++e._spinCount;e._waitingQueue.length;)e._waitingQueue.shift()();e._waitingFor&&(r.get(-1/0).onsuccess=t)}()}var i=e._waitingFor;return new Nt((function(t,r){n.then((function(n){return e._waitingQueue.push(ee(t.bind(null,n)))}),(function(t){return e._waitingQueue.push(ee(r.bind(null,t)))})).finally((function(){e._waitingFor===i&&(e._waitingFor=null)}))}))},t.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new st.Abort))},t.prototype.table=function(t){var e=this._memoizedTables||(this._memoizedTables={});if(m(e,t))return e[t];var n=this.schema[t];if(!n)throw new st.NotFound("Table "+t+" not part of transaction");var r=new this.db.Table(t,n,this);return r.core=this.db.core.table(t),e[t]=r,r},t}();function sn(t,e,n,r,i,o,a){return{name:t,keyPath:e,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+un(e)}}function un(t){return"string"==typeof t?t:t?"["+[].join.call(t,"+")+"]":""}function cn(t,e,n){return{name:t,primKey:e,indexes:n,mappedClass:null,idxByName:A(n,(function(t){return[t.name,t]}))}}var fn=function(t){try{return t.only([[]]),fn=function(){return[[]]},[[]]}catch(t){return fn=function(){return _e},_e}};function ln(t){return null==t?function(){}:"string"==typeof t?function(t){return 1===t.split(".").length?function(e){return e[t]}:function(e){return j(e,t)}}(t):function(e){return j(e,t)}}function hn(t){return[].slice.call(t)}var pn=0;function dn(t){return null==t?":id":"string"==typeof t?t:"["+t.join("+")+"]"}function vn(t,e,n){function r(t){if(3===t.type)return null;if(4===t.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=t.lower,r=t.upper,i=t.lowerOpen,o=t.upperOpen;return void 0===n?void 0===r?null:e.upperBound(r,!!o):void 0===r?e.lowerBound(n,!!i):e.bound(n,r,!!i,!!o)}var i=function(t,e){var n=hn(t.objectStoreNames);return{schema:{name:t.name,tables:n.map((function(t){return e.objectStore(t)})).map((function(t){var e=t.keyPath,n=t.autoIncrement,r=p(e),i=null==e,o={},a={name:t.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:e,autoIncrement:n,unique:!0,extractKey:ln(e)},indexes:hn(t.indexNames).map((function(e){return t.index(e)})).map((function(t){var e=t.name,n=t.unique,r=t.multiEntry,i=t.keyPath,a={name:e,compound:p(i),keyPath:i,unique:n,multiEntry:r,extractKey:ln(i)};return o[dn(i)]=a,a})),getIndexByKeyPath:function(t){return o[dn(t)]}};return o[":id"]=a.primaryKey,null!=e&&(o[dn(e)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in e.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,n),o=i.schema,a=i.hasGetAll,s=o.tables.map((function(t){return function(t){var e=t.name;return{name:e,schema:t,mutate:function(t){var n=t.trans,i=t.type,o=t.keys,a=t.values,s=t.range;return new Promise((function(t,u){t=ee(t);var c=n.objectStore(e),f=null==c.keyPath,l="put"===i||"add"===i;if(!l&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var h,p=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===p)return t({numFailures:0,failures:{},results:[],lastResult:void 0});var d=[],v=[],y=0,m=function(t){++y,rn(t)};if("deleteRange"===i){if(4===s.type)return t({numFailures:y,failures:v,results:[],lastResult:void 0});3===s.type?d.push(h=c.clear()):d.push(h=c.delete(r(s)))}else{var g=l?f?[a,o]:[a,null]:[o,null],b=g[0],w=g[1];if(l)for(var x=0;x<p;++x)d.push(h=w&&void 0!==w[x]?c[i](b[x],w[x]):c[i](b[x])),h.onerror=m;else for(x=0;x<p;++x)d.push(h=c[i](b[x])),h.onerror=m}var _=function(e){var n=e.target.result;d.forEach((function(t,e){return null!=t.error&&(v[e]=t.error)})),t({numFailures:y,failures:v,results:"delete"===i?o:d.map((function(t){return t.result})),lastResult:n})};h.onerror=function(t){m(t),_(t)},h.onsuccess=_}))},getMany:function(t){var n=t.trans,r=t.keys;return new Promise((function(t,i){t=ee(t);for(var o,a=n.objectStore(e),s=r.length,u=new Array(s),c=0,f=0,l=function(e){var n=e.target;u[n._pos]=n.result,++f===c&&t(u)},h=nn(i),p=0;p<s;++p){null!=r[p]&&((o=a.get(r[p]))._pos=p,o.onsuccess=l,o.onerror=h,++c)}0===c&&t(u)}))},get:function(t){var n=t.trans,r=t.key;return new Promise((function(t,i){t=ee(t);var o=n.objectStore(e).get(r);o.onsuccess=function(e){return t(e.target.result)},o.onerror=nn(i)}))},query:function(t){return function(n){return new Promise((function(i,o){i=ee(i);var a=n.trans,s=n.values,u=n.limit,c=n.query,f=u===1/0?void 0:u,l=c.index,h=c.range,p=a.objectStore(e),d=l.isPrimaryKey?p:p.index(l.name),v=r(h);if(0===u)return i({result:[]});if(t){var y=s?d.getAll(v,f):d.getAllKeys(v,f);y.onsuccess=function(t){return i({result:t.target.result})},y.onerror=nn(o)}else{var m=0,g=s||!("openKeyCursor"in d)?d.openCursor(v):d.openKeyCursor(v),b=[];g.onsuccess=function(t){var e=g.result;return e?(b.push(s?e.value:e.primaryKey),++m===u?i({result:b}):void e.continue()):i({result:b})},g.onerror=nn(o)}}))}}(a),openCursor:function(t){var n=t.trans,i=t.values,o=t.query,a=t.reverse,s=t.unique;return new Promise((function(t,u){t=ee(t);var c=o.index,f=o.range,l=n.objectStore(e),h=c.isPrimaryKey?l:l.index(c.name),p=a?s?"prevunique":"prev":s?"nextunique":"next",d=i||!("openKeyCursor"in h)?h.openCursor(r(f),p):h.openKeyCursor(r(f),p);d.onerror=nn(u),d.onsuccess=ee((function(e){var r=d.result;if(r){r.___id=++pn,r.done=!1;var i=r.continue.bind(r),o=r.continuePrimaryKey;o&&(o=o.bind(r));var a=r.advance.bind(r),s=function(){throw new Error("Cursor not stopped")};r.trans=n,r.stop=r.continue=r.continuePrimaryKey=r.advance=function(){throw new Error("Cursor not started")},r.fail=ee(u),r.next=function(){var t=this,e=1;return this.start((function(){return e--?t.continue():t.stop()})).then((function(){return t}))},r.start=function(t){var e=new Promise((function(t,e){t=ee(t),d.onerror=nn(e),r.fail=e,r.stop=function(e){r.stop=r.continue=r.continuePrimaryKey=r.advance=s,t(e)}})),n=function(){if(d.result)try{t()}catch(t){r.fail(t)}else r.done=!0,r.start=function(){throw new Error("Cursor behind last entry")},r.stop()};return d.onsuccess=ee((function(t){d.onsuccess=n,n()})),r.continue=i,r.continuePrimaryKey=o,r.advance=a,n(),e},t(r)}else t(null)}),u)}))},count:function(t){var n=t.query,i=t.trans,o=n.index,a=n.range;return new Promise((function(t,n){var s=i.objectStore(e),u=o.isPrimaryKey?s:s.index(o.name),c=r(a),f=c?u.count(c):u.count();f.onsuccess=ee((function(e){return t(e.target.result)})),f.onerror=nn(n)}))}}}(t)})),u={};return s.forEach((function(t){return u[t.name]=t})),{stack:"dbcore",transaction:t.transaction.bind(t),table:function(t){if(!u[t])throw new Error("Table '"+t+"' not found");return u[t]},MIN_KEY:-1/0,MAX_KEY:fn(e),schema:o}}function yn(t,e,n,r){var i=n.IDBKeyRange;return n.indexedDB,{dbcore:function(t,e){return e.reduce((function(t,e){var n=e.create;return c(c({},t),n(t))}),t)}(vn(e,i,r),t.dbcore)}}function mn(t,e){var n=t._novip,r=e.db,i=yn(n._middlewares,r,n._deps,e);n.core=i.dbcore,n.tables.forEach((function(t){var e=t.name;n.core.schema.tables.some((function(t){return t.name===e}))&&(t.core=n.core.table(e),n[e]instanceof n.Table&&(n[e].core=t.core))}))}function gn(t,e,n,r){var i=t._novip;n.forEach((function(t){var n=r[t];e.forEach((function(e){var r=S(e,t);(!r||"value"in r&&void 0===r.value)&&(e===i.Transaction.prototype||e instanceof i.Transaction?w(e,t,{get:function(){return this.table(t)},set:function(e){b(this,t,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):e[t]=new i.Table(t,n))}))}))}function bn(t,e){var n=t._novip;e.forEach((function(t){for(var e in t)t[e]instanceof n.Table&&delete t[e]}))}function wn(t,e){return t._cfg.version-e._cfg.version}function xn(t,e,n,r){var i=t._dbSchema,o=t._createTransaction("readwrite",t._storeNames,i);o.create(n),o._completion.catch(r);var a=o._reject.bind(o),s=Kt.transless||Kt;ue((function(){Kt.trans=o,Kt.transless=s,0===e?(h(i).forEach((function(t){Sn(n,t,i[t].primKey,i[t].indexes)})),mn(t,n),Nt.follow((function(){return t.on.populate.fire(o)})).catch(a)):function(t,e,n,r){var i=t._novip,o=[],a=i._versions,s=i._dbSchema=En(i,i.idbdb,r),u=!1;function c(){return o.length?Nt.resolve(o.shift()(n.idbtrans)).then(c):Nt.resolve()}return a.filter((function(t){return t._cfg.version>=e})).forEach((function(t){o.push((function(){var o=s,a=t._cfg.dbschema;kn(i,o,r),kn(i,a,r),s=i._dbSchema=a;var c=_n(o,a);c.add.forEach((function(t){Sn(r,t[0],t[1].primKey,t[1].indexes)})),c.change.forEach((function(t){if(t.recreate)throw new st.Upgrade("Not yet support for changing primary key");var e=r.objectStore(t.name);t.add.forEach((function(t){return Cn(e,t)})),t.change.forEach((function(t){e.deleteIndex(t.name),Cn(e,t)})),t.del.forEach((function(t){return e.deleteIndex(t)}))}));var f=t._cfg.contentUpgrade;if(f&&t._cfg.version>e){mn(i,r),n._memoizedTables={},u=!0;var l=I(a);c.del.forEach((function(t){l[t]=o[t]})),bn(i,[i.Transaction.prototype]),gn(i,[i.Transaction.prototype],h(l),l),n.schema=l;var p,d=z(f);d&&ce();var v=Nt.follow((function(){if((p=f(n))&&d){var t=fe.bind(null,null);p.then(t,t)}}));return p&&"function"==typeof p.then?Nt.resolve(p):v.then((function(){return p}))}})),o.push((function(e){u&&ke||function(t,e){[].slice.call(e.db.objectStoreNames).forEach((function(n){return null==t[n]&&e.db.deleteObjectStore(n)}))}(t._cfg.dbschema,e);bn(i,[i.Transaction.prototype]),gn(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema}))})),c().then((function(){var t,e;e=r,h(t=s).forEach((function(n){e.db.objectStoreNames.contains(n)||Sn(e,n,t[n].primKey,t[n].indexes)}))}))}(t,e,o,n).catch(a)}))}function _n(t,e){var n,r={del:[],add:[],change:[]};for(n in t)e[n]||r.del.push(n);for(n in e){var i=t[n],o=e[n];if(i){var a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!Ee)a.recreate=!0,r.change.push(a);else{var s=i.idxByName,u=o.idxByName,c=void 0;for(c in s)u[c]||a.del.push(c);for(c in u){var f=s[c],l=u[c];f?f.src!==l.src&&a.change.push(l):a.add.push(l)}(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 Sn(t,e,n,r){var i=t.db.createObjectStore(e,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(t){return Cn(i,t)})),i}function Cn(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function En(t,e,n){var r={};return E(e.objectStoreNames,0).forEach((function(t){for(var e=n.objectStore(t),i=e.keyPath,o=sn(un(i),i||"",!1,!1,!!e.autoIncrement,i&&"string"!=typeof i,!0),a=[],s=0;s<e.indexNames.length;++s){var u=e.index(e.indexNames[s]);i=u.keyPath;var c=sn(u.name,i,!!u.unique,!!u.multiEntry,!1,i&&"string"!=typeof i,!1);a.push(c)}r[t]=cn(t,o,a)})),r}function kn(t,e,n){for(var r=t._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],s=n.objectStore(a);r._hasGetAll="getAll"in s;for(var u=0;u<s.indexNames.length;++u){var c=s.indexNames[u],f=s.index(c).keyPath,h="string"==typeof f?f:"["+E(f).join("+")+"]";if(e[a]){var p=e[a].idxByName[h];p&&(p.name=c,delete e[a].idxByName[h],e[a].idxByName[c]=p)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&l.WorkerGlobalScope&&l instanceof l.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}var Pn=function(){function t(){}return t.prototype._parseStoresSpec=function(t,e){h(t).forEach((function(n){if(null!==t[n]){var r=t[n].split(",").map((function(t,e){var n=(t=t.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return sn(n,r||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),p(r),0===e)})),i=r.shift();if(i.multi)throw new st.Schema("Primary key cannot be multi-valued");r.forEach((function(t){if(t.auto)throw new st.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new st.Schema("Index must have a name and cannot be an empty string")})),e[n]=cn(n,i,r)}}))},t.prototype.stores=function(t){var e=this.db;this._cfg.storesSource=this._cfg.storesSource?d(this._cfg.storesSource,t):t;var n=e._versions,r={},i={};return n.forEach((function(t){d(r,t._cfg.storesSource),i=t._cfg.dbschema={},t._parseStoresSpec(r,i)})),e._dbSchema=i,bn(e,[e._allTables,e,e.Transaction.prototype]),gn(e,[e._allTables,e,e.Transaction.prototype,this._cfg.tables],h(i),i),e._storeNames=h(i),this},t.prototype.upgrade=function(t){return this._cfg.contentUpgrade=gt(this._cfg.contentUpgrade||ft,t),this},t}();function On(t,e){var n=t._dbNamesDB;return n||(n=t._dbNamesDB=new Zn("__dbnames",{addons:[],indexedDB:t,IDBKeyRange:e})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function An(t){return t&&"function"==typeof t.databases}function jn(t,e){var n=t.indexedDB,r=t.IDBKeyRange;!An(n)&&"__dbnames"!==e&&On(n,r).delete(e).catch(ft)}function Tn(t){return ue((function(){return Kt.letThrough=!0,t()}))}function In(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()})).finally((function(){return clearInterval(t)})):Promise.resolve()}function Rn(t){var e=t._state,n=t._deps.indexedDB;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then((function(){return e.dbOpenError?xe(e.dbOpenError):t}));W&&(e.openCanceller._stackHolder=X()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;var r=e.openCanceller;function i(){if(e.openCanceller!==r)throw new st.DatabaseClosed("db.open() was cancelled")}var o=e.dbReadyResolve,a=null,s=!1;return Nt.race([r,("undefined"==typeof navigator?Nt.resolve():In()).then((function(){return new Nt((function(r,o){if(i(),!n)throw new st.MissingAPI;var u=t.name,c=e.autoSchema?n.open(u):n.open(u,Math.round(10*t.verno));if(!c)throw new st.MissingAPI;c.onerror=nn(o),c.onblocked=ee(t._fireOnBlocked),c.onupgradeneeded=ee((function(r){if(a=c.transaction,e.autoSchema&&!t._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();var i=n.deleteDatabase(u);i.onsuccess=i.onerror=ee((function(){o(new st.NoSuchDatabase("Database "+u+" doesnt exist"))}))}else{a.onerror=nn(o);var f=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;s=f<1,t._novip.idbdb=c.result,xn(t,f/10,a,o)}}),o),c.onsuccess=ee((function(){a=null;var n,i=t._novip.idbdb=c.result,o=E(i.objectStoreNames);if(o.length>0)try{var f=i.transaction(1===(n=o).length?n[0]:n,"readonly");e.autoSchema?function(t,e,n){var r=t._novip;r.verno=e.version/10;var i=r._dbSchema=En(0,e,n);r._storeNames=E(e.objectStoreNames,0),gn(r,[r._allTables],h(i),i)}(t,i,f):(kn(t,t._dbSchema,f),function(t,e){var n=_n(En(0,t.idbdb,e),t._dbSchema);return!(n.add.length||n.change.some((function(t){return t.add.length||t.change.length})))}(t,f)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),mn(t,f)}catch(t){}Ce.push(t),i.onversionchange=ee((function(n){e.vcFired=!0,t.on("versionchange").fire(n)})),i.onclose=ee((function(e){t.on("close").fire(e)})),s&&function(t,e){var n=t.indexedDB,r=t.IDBKeyRange;!An(n)&&"__dbnames"!==e&&On(n,r).put({name:e}).catch(ft)}(t._deps,u),r()}),o)}))}))]).then((function(){return i(),e.onReadyBeingFired=[],Nt.resolve(Tn((function(){return t.on.ready.fire(t.vip)}))).then((function n(){if(e.onReadyBeingFired.length>0){var r=e.onReadyBeingFired.reduce(gt,ft);return e.onReadyBeingFired=[],Nt.resolve(Tn((function(){return r(t.vip)}))).then(n)}}))})).finally((function(){e.onReadyBeingFired=null,e.isBeingOpened=!1})).then((function(){return t})).catch((function(n){e.dbOpenError=n;try{a&&a.abort()}catch(t){}return r===e.openCanceller&&t._close(),xe(n)})).finally((function(){e.openComplete=!0,o()}))}function Fn(t){var e=function(e){return t.next(e)},n=i(e),r=i((function(e){return t.throw(e)}));function i(t){return function(e){var i=t(e),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,r):p(o)?Promise.all(o).then(n,r):n(o)}}return i(e)()}function Dn(t,e,n){var r=arguments.length;if(r<2)throw new st.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=F(i);return[t,o,n]}function Bn(t,e,n,r,i){return Nt.resolve().then((function(){var o=Kt.transless||Kt,a=t._createTransaction(e,n,t._dbSchema,r),s={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),t._state.PR1398_maxLoop=3}catch(r){return r.name===ot.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then((function(){return Bn(t,e,n,null,i)}))):xe(r)}var u,c=z(i);c&&ce();var f=Nt.follow((function(){if(u=i.call(a,a))if(c){var t=fe.bind(null,null);u.then(t,t)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Fn(u))}),s);return(u&&"function"==typeof u.then?Nt.resolve(u).then((function(t){return a.active?t:xe(new st.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):f.then((function(){return u}))).then((function(t){return r&&a._resolve(),a._completion.then((function(){return t}))})).catch((function(t){return a._reject(t),xe(t)}))}))}function Kn(t,e,n){for(var r=p(t)?t.slice():[t],i=0;i<n;++i)r.push(e);return r}var Ln={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return c(c({},t),{table:function(e){var n=t.table(e),r=n.schema,i={},o=[];function a(t,e,n){var r=dn(t),s=i[r]=i[r]||[],u=null==t?0:"string"==typeof t?1:t.length,f=e>0,l=c(c({},n),{isVirtual:f,keyTail:e,keyLength:u,extractKey:ln(t),unique:!f&&n.unique});(s.push(l),l.isPrimaryKey||o.push(l),u>1)&&a(2===u?t[0]:t.slice(0,u-1),e+1,n);return s.sort((function(t,e){return t.keyTail-e.keyTail})),l}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var u=0,f=r.indexes;u<f.length;u++){var l=f[u];a(l.keyPath,0,l)}function h(e){var n,r,i=e.query.index;return i.isVirtual?c(c({},e),{query:{index:i,range:(n=e.query.range,r=i.keyTail,{type:1===n.type?2:n.type,lower:Kn(n.lower,n.lowerOpen?t.MAX_KEY:t.MIN_KEY,r),lowerOpen:!0,upper:Kn(n.upper,n.upperOpen?t.MIN_KEY:t.MAX_KEY,r),upperOpen:!0})}}):e}return c(c({},n),{schema:c(c({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:function(t){var e=i[dn(t)];return e&&e[0]}}),count:function(t){return n.count(h(t))},query:function(t){return n.query(h(t))},openCursor:function(e){var r=e.query.index,i=r.keyTail,o=r.isVirtual,a=r.keyLength;if(!o)return n.openCursor(e);return n.openCursor(h(e)).then((function(n){return n&&function(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(Kn(r,e.reverse?t.MAX_KEY:t.MIN_KEY,i)):e.unique?n.continue(n.key.slice(0,a).concat(e.reverse?t.MIN_KEY:t.MAX_KEY,i)):n.continue()}},continuePrimaryKey:{value:function(e,r){n.continuePrimaryKey(Kn(e,t.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var t=n.key;return 1===a?t[0]:t.slice(0,a)}},value:{get:function(){return n.value}}})}(n)}))}})}})}};function Un(t,e,n,r){return n=n||{},r=r||"",h(t).forEach((function(i){if(m(e,i)){var o=t[i],a=e[i];if("object"==typeof o&&"object"==typeof a&&o&&a){var s=M(o);s!==M(a)?n[r+i]=e[i]:"Object"===s?Un(o,a,n,r+i+"."):o!==a&&(n[r+i]=e[i])}else o!==a&&(n[r+i]=e[i])}else n[r+i]=void 0})),h(e).forEach((function(i){m(t,i)||(n[r+i]=e[i])})),n}var Mn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(t){return c(c({},t),{table:function(e){var n=t.table(e),r=n.schema.primaryKey;return c(c({},n),{mutate:function(t){var i=Kt.trans,o=i.table(e).hook,a=o.deleting,s=o.creating,u=o.updating;switch(t.type){case"add":if(s.fire===ft)break;return i._promise("readwrite",(function(){return l(t)}),!0);case"put":if(s.fire===ft&&u.fire===ft)break;return i._promise("readwrite",(function(){return l(t)}),!0);case"delete":if(a.fire===ft)break;return i._promise("readwrite",(function(){return l(t)}),!0);case"deleteRange":if(a.fire===ft)break;return i._promise("readwrite",(function(){return function(t){return function t(e,i,o){return n.query({trans:e,values:!1,query:{index:r,range:i},limit:o}).then((function(n){var r=n.result;return l({type:"delete",keys:r,trans:e}).then((function(n){return n.numFailures>0?Promise.reject(n.failures[0]):r.length<o?{failures:[],numFailures:0,lastResult:void 0}:t(e,c(c({},i),{lower:r[r.length-1],lowerOpen:!0}),o)}))}))}(t.trans,t.range,1e4)}(t)}),!0)}return n.mutate(t);function l(t){var e=Kt.trans,i=t.keys||function(t,e){return"delete"===e.type?e.keys:e.keys||e.values.map(t.extractKey)}(r,t);if(!i)throw new Error("Keys missing");return"delete"!==(t="add"===t.type||"put"===t.type?c(c({},t),{keys:i}):c({},t)).type&&(t.values=f([],t.values,!0)),t.keys&&(t.keys=f([],t.keys,!0)),function(t,e,n){return"add"===e.type?Promise.resolve([]):t.getMany({trans:e.trans,keys:n,cache:"immutable"})}(n,t,i).then((function(o){var c=i.map((function(n,i){var c=o[i],f={onerror:null,onsuccess:null};if("delete"===t.type)a.fire.call(f,n,c,e);else if("add"===t.type||void 0===c){var l=s.fire.call(f,n,t.values[i],e);null==n&&null!=l&&(n=l,t.keys[i]=n,r.outbound||T(t.values[i],r.keyPath,n))}else{var h=Un(c,t.values[i]),p=u.fire.call(f,h,n,c,e);if(p){var d=t.values[i];Object.keys(p).forEach((function(t){m(d,t)?d[t]=p[t]:T(d,t,p[t])}))}}return f}));return n.mutate(t).then((function(e){for(var n=e.failures,r=e.results,a=e.numFailures,s=e.lastResult,u=0;u<i.length;++u){var f=r?r[u]:i[u],l=c[u];null==f?l.onerror&&l.onerror(n[u]):l.onsuccess&&l.onsuccess("put"===t.type&&o[u]?t.values[u]:f)}return{failures:n,results:r,numFailures:a,lastResult:s}})).catch((function(t){return c.forEach((function(e){return e.onerror&&e.onerror(t)})),Promise.reject(t)}))}))}}})}})}};function Nn(t,e,n){try{if(!e)return null;if(e.keys.length<t.length)return null;for(var r=[],i=0,o=0;i<e.keys.length&&o<t.length;++i)0===qe(e.keys[i],t[o])&&(r.push(n?L(e.values[i]):e.values[i]),++o);return r.length===t.length?r:null}catch(t){return null}}var qn,Hn={stack:"dbcore",level:-1,create:function(t){return{table:function(e){var n=t.table(e);return c(c({},n),{getMany:function(t){if(!t.cache)return n.getMany(t);var e=Nn(t.keys,t.trans._cache,"clone"===t.cache);return e?Nt.resolve(e):n.getMany(t).then((function(e){return t.trans._cache={keys:t.keys,values:"clone"===t.cache?L(e):e},e}))},mutate:function(t){return"add"!==t.type&&(t.trans._cache=null),n.mutate(t)}})}}}};function Vn(t){return!("from"in t)}var zn=function(t,e){if(!this){var n=new zn;return t&&"d"in t&&d(n,t),n}d(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0})};function Wn(t,e,n){var r=qe(e,n);if(!isNaN(r)){if(r>0)throw RangeError();if(Vn(t))return d(t,{from:e,to:n,d:1});var i=t.l,o=t.r;if(qe(n,t.from)<0)return i?Wn(i,e,n):t.l={from:e,to:n,d:1,l:null,r:null},Yn(t);if(qe(e,t.to)>0)return o?Wn(o,e,n):t.r={from:e,to:n,d:1,l:null,r:null},Yn(t);qe(e,t.from)<0&&(t.from=e,t.l=null,t.d=o?o.d+1:1),qe(n,t.to)>0&&(t.to=n,t.r=null,t.d=t.l?t.l.d+1:1);var a=!t.r;i&&!t.l&&$n(t,i),o&&a&&$n(t,o)}}function $n(t,e){Vn(e)||function t(e,n){var r=n.from,i=n.to,o=n.l,a=n.r;Wn(e,r,i),o&&t(e,o),a&&t(e,a)}(t,e)}function Gn(t){var e=Vn(t)?null:{s:0,n:t};return{next:function(t){for(var n=arguments.length>0;e;)switch(e.s){case 0:if(e.s=1,n)for(;e.n.l&&qe(t,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!n||qe(t,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function Yn(t){var e,n,r=((null===(e=t.r)||void 0===e?void 0:e.d)||0)-((null===(n=t.l)||void 0===n?void 0:n.d)||0),i=r>1?"r":r<-1?"l":"";if(i){var o="r"===i?"l":"r",a=c({},t),s=t[i];t.from=s.from,t.to=s.to,t[i]=s[i],a[i]=s[o],t[o]=a,a.d=Xn(a)}t.d=Xn(t)}function Xn(t){var e=t.r,n=t.l;return(e?n?Math.max(e.d,n.d):e.d:n?n.d:0)+1}g(zn.prototype,((qn={add:function(t){return $n(this,t),this},addKey:function(t){return Wn(this,t,t),this},addKeys:function(t){var e=this;return t.forEach((function(t){return Wn(e,t,t)})),this}})[N]=function(){return Gn(this)},qn));var Jn={stack:"dbcore",level:0,create:function(t){var e=t.schema.name,n=new zn(t.MIN_KEY,t.MAX_KEY);return c(c({},t),{table:function(r){var i=t.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,u=a.outbound,f=c(c({},i),{mutate:function(t){var a=t.trans,s=a.mutatedParts||(a.mutatedParts={}),u=function(t){var n="idb://"+e+"/"+r+"/"+t;return s[n]||(s[n]=new zn)},c=u(""),f=u(":dels"),l=t.type,h="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[[],t.values]:[],d=h[0],v=h[1],y=t.trans._cache;return i.mutate(t).then((function(t){if(p(d)){"delete"!==l&&(d=t.results),c.addKeys(d);var e=Nn(d,y);e||"add"===l||f.addKeys(d),(e||v)&&function(t,e,n,r){e.indexes.forEach((function(e){var i=t(e.name||"");function o(t){return null!=t?e.extractKey(t):null}var a=function(t){return e.multiEntry&&p(t)?t.forEach((function(t){return i.addKey(t)})):i.addKey(t)};(n||r).forEach((function(t,e){var i=n&&o(n[e]),s=r&&o(r[e]);0!==qe(i,s)&&(null!=i&&a(i),null!=s&&a(s))}))}))}(u,o,e,v)}else if(d){var r={from:d.lower,to:d.upper};f.add(r),c.add(r)}else c.add(n),f.add(n),o.indexes.forEach((function(t){return u(t.name).add(n)}));return t}))}}),l=function(e){var n,r,i=e.query,o=i.index,a=i.range;return[o,new zn(null!==(n=a.lower)&&void 0!==n?n:t.MIN_KEY,null!==(r=a.upper)&&void 0!==r?r:t.MAX_KEY)]},d={get:function(t){return[a,new zn(t.key)]},getMany:function(t){return[a,(new zn).addKeys(t.keys)]},count:l,query:l,openCursor:l};return h(d).forEach((function(t){f[t]=function(o){var a=Kt.subscr;if(a){var f=function(t){var n="idb://"+e+"/"+r+"/"+t;return a[n]||(a[n]=new zn)},l=f(""),h=f(":dels"),p=d[t](o),v=p[0],y=p[1];if(f(v.name||"").add(y),!v.isPrimaryKey){if("count"!==t){var m="query"===t&&u&&o.values&&i.query(c(c({},o),{values:!1}));return i[t].apply(this,arguments).then((function(e){if("query"===t){if(u&&o.values)return m.then((function(t){var n=t.result;return l.addKeys(n),e}));var n=o.values?e.result.map(s):e.result;o.values?l.addKeys(n):h.addKeys(n)}else if("openCursor"===t){var r=e,i=o.values;return r&&Object.create(r,{key:{get:function(){return h.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var t=r.primaryKey;return h.addKey(t),t}},value:{get:function(){return i&&l.addKey(r.primaryKey),r.value}}})}return e}))}h.add(n)}}return i[t].apply(this,arguments)}})),f}})}};var Qn,Zn=function(){function t(e,n){var r=this;this._middlewares={},this.verno=0;var i=t.dependencies;this._options=n=c({addons:t.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};var o=n.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var a={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:ft,dbReadyPromise:null,cancelOpen:ft,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new Nt((function(t){a.dbReadyResolve=t})),a.openCanceller=new Nt((function(t,e){a.cancelOpen=e})),this._state=a,this.name=e,this.on=Re(this,"populate","blocked","versionchange","close",{ready:[gt,ft]}),this.on.ready.subscribe=k(this.on.ready.subscribe,(function(e){return function(n,i){t.vip((function(){var t=r._state;if(t.openComplete)t.dbOpenError||Nt.resolve().then(n),i&&e(n);else if(t.onReadyBeingFired)t.onReadyBeingFired.push(n),i&&e(n);else{e(n);var o=r;i||e((function t(){o.on.ready.unsubscribe(n),o.on.ready.unsubscribe(t)}))}}))}})),this.Collection=function(t){return Fe(ze.prototype,(function(e,n){this.db=t;var r=je,i=null;if(n)try{r=n()}catch(t){i=t}var o=e._ctx,a=o.table,s=a.hook.reading.fire;this._ctx={table:a,index:o.index,isPrimKey:!o.index||a.schema.primKey.keyPath&&o.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:i,or:o.or,valueMapper:s!==lt?s:null}}))}(this),this.Table=function(t){return Fe(Ie.prototype,(function(e,n,r){this.db=t,this._tx=r,this.name=e,this.schema=n,this.hook=t._allTables[e]?t._allTables[e].hook:Re(null,{creating:[dt,ft],reading:[ht,lt],updating:[yt,ft],deleting:[vt,ft]})}))}(this),this.Transaction=function(t){return Fe(an.prototype,(function(e,n,r,i,o){var a=this;this.db=t,this.mode=e,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=Re(this,"complete","error","abort"),this.parent=o||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 Nt((function(t,e){a._resolve=t,a._reject=e})),this._completion.then((function(){a.active=!1,a.on.complete.fire()}),(function(t){var e=a.active;return a.active=!1,a.on.error.fire(t),a.parent?a.parent._reject(t):e&&a.idbtrans&&a.idbtrans.abort(),xe(t)}))}))}(this),this.Version=function(t){return Fe(Pn.prototype,(function(e){this.db=t,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(t){return Fe(en.prototype,(function(e,n,r){this.db=t,this._ctx={table:e,index:":id"===n?null:n,or:r};var i=t._deps.indexedDB;if(!i)throw new st.MissingAPI;this._cmp=this._ascending=i.cmp.bind(i),this._descending=function(t,e){return i.cmp(e,t)},this._max=function(t,e){return i.cmp(t,e)>0?t:e},this._min=function(t,e){return i.cmp(t,e)<0?t:e},this._IDBKeyRange=t._deps.IDBKeyRange}))}(this),this.on("versionchange",(function(t){t.newVersion>0?console.warn("Another connection wants to upgrade database '"+r.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+r.name+"'. Closing db now to resume the delete request."),r.close()})),this.on("blocked",(function(t){!t.newVersion||t.newVersion<t.oldVersion?console.warn("Dexie.delete('"+r.name+"') was blocked"):console.warn("Upgrade '"+r.name+"' blocked by other connection holding version "+t.oldVersion/10)})),this._maxKey=fn(n.IDBKeyRange),this._createTransaction=function(t,e,n,i){return new r.Transaction(t,e,n,r._options.chromeTransactionDurability,i)},this._fireOnBlocked=function(t){r.on("blocked").fire(t),Ce.filter((function(t){return t.name===r.name&&t!==r&&!t._state.vcFired})).map((function(e){return e.on("versionchange").fire(t)}))},this.use(Ln),this.use(Mn),this.use(Jn),this.use(Hn),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach((function(t){return t(r)}))}return t.prototype.version=function(t){if(isNaN(t)||t<.1)throw new st.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new st.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var e=this._versions,n=e.filter((function(e){return e._cfg.version===t}))[0];return n||(n=new this.Version(t),e.push(n),e.sort(wn),n.stores({}),this._state.autoSchema=!1,n)},t.prototype._whenReady=function(t){var e=this;return this.idbdb&&(this._state.openComplete||Kt.letThrough||this._vip)?t():new Nt((function(t,n){if(e._state.openComplete)return n(new st.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return void n(new st.DatabaseClosed);e.open().catch(ft)}e._state.dbReadyPromise.then(t,n)})).then(t)},t.prototype.use=function(t){var e=t.stack,n=t.create,r=t.level,i=t.name;i&&this.unuse({stack:e,name:i});var o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:n,level:null==r?10:r,name:i}),o.sort((function(t,e){return t.level-e.level})),this},t.prototype.unuse=function(t){var e=t.stack,n=t.name,r=t.create;return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((function(t){return r?t.create!==r:!!n&&t.name!==n}))),this},t.prototype.open=function(){return Rn(this)},t.prototype._close=function(){var t=this._state,e=Ce.indexOf(this);if(e>=0&&Ce.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(t){}this._novip.idbdb=null}t.dbReadyPromise=new Nt((function(e){t.dbReadyResolve=e})),t.openCanceller=new Nt((function(e,n){t.cancelOpen=n}))},t.prototype.close=function(){this._close();var t=this._state;this._options.autoOpen=!1,t.dbOpenError=new st.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)},t.prototype.delete=function(){var t=this,e=arguments.length>0,n=this._state;return new Nt((function(r,i){var o=function(){t.close();var e=t._deps.indexedDB.deleteDatabase(t.name);e.onsuccess=ee((function(){jn(t._deps,t.name),r()})),e.onerror=nn(i),e.onblocked=t._fireOnBlocked};if(e)throw new st.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(o):o()}))},t.prototype.backendDB=function(){return this.idbdb},t.prototype.isOpen=function(){return null!==this.idbdb},t.prototype.hasBeenClosed=function(){var t=this._state.dbOpenError;return t&&"DatabaseClosed"===t.name},t.prototype.hasFailed=function(){return null!==this._state.dbOpenError},t.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(t.prototype,"tables",{get:function(){var t=this;return h(this._allTables).map((function(e){return t._allTables[e]}))},enumerable:!1,configurable:!0}),t.prototype.transaction=function(){var t=Dn.apply(this,arguments);return this._transaction.apply(this,t)},t.prototype._transaction=function(t,e,n){var r=this,i=Kt.trans;i&&i.db===this&&-1===t.indexOf("!")||(i=null);var o,a,s=-1!==t.indexOf("?");t=t.replace("!","").replace("?","");try{if(a=e.map((function(t){var e=t instanceof r.Table?t.name:t;if("string"!=typeof e)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==t||"readonly"===t)o="readonly";else{if("rw"!=t&&"readwrite"!=t)throw new st.InvalidArgument("Invalid transaction mode: "+t);o="readwrite"}if(i){if("readonly"===i.mode&&"readwrite"===o){if(!s)throw new st.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach((function(t){if(i&&-1===i.storeNames.indexOf(t)){if(!s)throw new st.SubTransaction("Table "+t+" not included in parent transaction.");i=null}})),s&&i&&!i.active&&(i=null)}}catch(t){return i?i._promise(null,(function(e,n){n(t)})):xe(t)}var u=Bn.bind(null,this,o,a,i,n);return i?i._promise(o,u,"lock"):Kt.trans?ye(Kt.transless,(function(){return r._whenReady(u)})):this._whenReady(u)},t.prototype.table=function(t){if(!m(this._allTables,t))throw new st.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},t}(),tr="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",er=function(){function t(t){this._subscribe=t}return t.prototype.subscribe=function(t,e,n){return this._subscribe(t&&"function"!=typeof t?t:{next:t,error:e,complete:n})},t.prototype[tr]=function(){return this},t}();function nr(t,e){return h(e).forEach((function(n){$n(t[n]||(t[n]=new zn),e[n])})),t}try{Qn={indexedDB:l.indexedDB||l.mozIndexedDB||l.webkitIndexedDB||l.msIndexedDB,IDBKeyRange:l.IDBKeyRange||l.webkitIDBKeyRange}}catch(t){Qn={indexedDB:null,IDBKeyRange:null}}var rr=Zn;function ir(t){var e=or;try{or=!0,on.storagemutated.fire(t)}finally{or=e}}g(rr,c(c({},ct),{delete:function(t){return new rr(t,{addons:[]}).delete()},exists:function(t){return new rr(t,{addons:[]}).open().then((function(t){return t.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(t){try{return function(t){var e=t.indexedDB,n=t.IDBKeyRange;return An(e)?Promise.resolve(e.databases()).then((function(t){return t.map((function(t){return t.name})).filter((function(t){return"__dbnames"!==t}))})):On(e,n).toCollection().primaryKeys()}(rr.dependencies).then(t)}catch(t){return xe(new st.MissingAPI)}},defineClass:function(){return function(t){d(this,t)}},ignoreTransaction:function(t){return Kt.trans?ye(Kt.transless,t):t()},vip:Tn,async:function(t){return function(){try{var e=Fn(t.apply(this,arguments));return e&&"function"==typeof e.then?e:Nt.resolve(e)}catch(t){return xe(t)}}},spawn:function(t,e,n){try{var r=Fn(t.apply(n,e||[]));return r&&"function"==typeof r.then?r:Nt.resolve(r)}catch(t){return xe(t)}},currentTransaction:{get:function(){return Kt.trans||null}},waitFor:function(t,e){var n=Nt.resolve("function"==typeof t?rr.ignoreTransaction(t):t).timeout(e||6e4);return Kt.trans?Kt.trans.waitFor(n):n},Promise:Nt,debug:{get:function(){return W},set:function(t){$(t,"dexie"===t?function(){return!0}:Oe)}},derive:x,extend:d,props:g,override:k,Events:Re,on:on,liveQuery:function(t){var e=!1,n=void 0,r=new er((function(r){var i=z(t);var o=!1,a={},s={},u={get closed(){return o},unsubscribe:function(){o=!0,on.storagemutated.unsubscribe(p)}};r.start&&r.start(u);var c=!1,f=!1;function l(){return h(s).some((function(t){return a[t]&&function(t,e){var n=Gn(e),r=n.next();if(r.done)return!1;for(var i=r.value,o=Gn(t),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(qe(s.from,i.to)<=0&&qe(s.to,i.from)>=0)return!0;qe(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}(a[t],s[t])}))}var p=function(t){nr(a,t),l()&&d()},d=function(){if(!c&&!o){a={};var h={},v=function(e){i&&ce();var n=function(){return ue(t,{subscr:e,trans:null})},r=Kt.trans?ye(Kt.transless,n):n();return i&&r.then(fe,fe),r}(h);f||(on("storagemutated",p),f=!0),c=!0,Promise.resolve(v).then((function(t){e=!0,n=t,c=!1,o||(l()?d():(a={},s=h,r.next&&r.next(t)))}),(function(t){c=!1,e=!1,r.error&&r.error(t),u.unsubscribe()}))}};return d(),u}));return r.hasValue=function(){return e},r.getValue=function(){return n},r},extendObservabilitySet:nr,getByKeyPath:j,setByKeyPath:T,delByKeyPath:function(t,e){"string"==typeof e?T(t,e,void 0):"length"in e&&[].map.call(e,(function(e){T(t,e,void 0)}))},shallowClone:I,deepClone:L,getObjectDiff:Un,cmp:qe,asap:O,minKey:-1/0,addons:[],connections:Ce,errnames:ot,dependencies:Qn,semVer:"3.2.4",version:"3.2.4".split(".").map((function(t){return parseInt(t)})).reduce((function(t,e,n){return t+e/Math.pow(10,2*n)}))})),rr.maxKey=fn(rr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(on("storagemutated",(function(t){var e;or||(Ee?(e=document.createEvent("CustomEvent")).initCustomEvent("x-storagemutated-1",!0,!0,t):e=new CustomEvent("x-storagemutated-1",{detail:t}),or=!0,dispatchEvent(e),or=!1)})),addEventListener("x-storagemutated-1",(function(t){var e=t.detail;or||ir(e)})));var or=!1;if("undefined"!=typeof BroadcastChannel){var ar=new BroadcastChannel("x-storagemutated-1");"function"==typeof ar.unref&&ar.unref(),on("storagemutated",(function(t){or||ar.postMessage(t)})),ar.onmessage=function(t){t.data&&ir(t.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){on("storagemutated",(function(t){try{or||("undefined"!=typeof localStorage&&localStorage.setItem("x-storagemutated-1",JSON.stringify({trig:Math.random(),changedParts:t})),"object"==typeof self.clients&&f([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach((function(e){return e.postMessage({type:"x-storagemutated-1",changedParts:t})})))}catch(t){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(function(t){if("x-storagemutated-1"===t.key){var e=JSON.parse(t.newValue);e&&ir(e.changedParts)}}));var sr=self.document&&navigator.serviceWorker;sr&&sr.addEventListener("message",(function(t){var e=t.data;e&&"x-storagemutated-1"===e.type&&ir(e.changedParts)}))}Nt.rejectionMapper=function(t,e){if(!t||t instanceof et||t instanceof TypeError||t instanceof SyntaxError||!t.name||!ut[t.name])return t;var n=new ut[t.name](e||t.message,t);return"stack"in t&&w(n,"stack",{get:function(){return this.inner.stack}}),n},$(W,Oe);const ur=new Zn("smidb");ur.version(1).stores({teasers:"\n id,\n expires\n "});class cr{constructor(){}init(){self.addEventListener("install",t=>{console.log("install"),this.onInstall(t)}),self.addEventListener("activate",t=>{console.log("activate"),this.onActivate(t)}),self.addEventListener("push",t=>{console.log("push"),this.onPush(t)}),self.addEventListener("pushsubscriptionchange",t=>{this.onSubChange(t)}),self.addEventListener("notificationclick",t=>{this.onNotificationClick(t)})}onInstall(t){t.waitUntil(this._onInstall())}onActivate(t){t.waitUntil(this._onActivate())}onPush(t){t.waitUntil(this._onPush(t))}onSubChange(t){t.waitUntil(this._onSubChange(t))}onNotificationClick(t){t.waitUntil(this._onNotificationClick(t))}_onInstall(){return self.skipWaiting()}_onActivate(){return self.clients.claim()}async _onPush(t){if(console.log("1111"),this.log(lr.pushReceived()).catch(hr),!t.data)return console.log("event.data is empty"),console.log(t),void this.log(lr.error(fr.PUSH_IS_EMPTY)).catch(hr);let e;try{console.log(t.data.json()),e=t.data.json()}catch(t){return void this.log(lr.error(fr.PUSH_PARSE_FAILED)).catch(hr)}return e.data_url?this._showRTBNotification(e):this._showDefaultNotification(e)}async _onNotificationClick(t){this.log(lr.userClickedOnPush()).catch(hr);const e=t.notification;e.close();const n=e.data;n&&n.url&&await self.clients.openWindow(n.url),n&&await function(t){if(!t||!t.name)return null;let e;try{e=t.name.replace("/messages/","/clicks/")}catch(t){return null}return fetch(e,{method:"DELETE"}).catch(()=>null)}(n)}async _onSubChange(t){let{oldSubscription:e,newSubscription:n}=t;const r=await this.getProjectId();if(r){if(!n){const t=await this.getApplicationServerKey(r);t&&(n=await Object(s.a)(t,self.registration))}await this.subscribe(r,n,e)}}async subscribe(t,e,n){if(!e&&!n)return;let r=void 0,i=void 0;return e&&(r={subscription:e,expiration_time:e.expirationTime,extra_data:await this.getExtraData()}),n&&(i={subscription:n,expiration_time:n.expirationTime}),Object(s.c)({project_id:t,new_subscription:r,old_subscription:i})}async getExtraData(){const t=await i.b.getExtraData();return t?(t.version=r.d,t):null}async getApplicationServerKey(t){const e=await a.a.getFromDatabaseOrApi(t);if(!e)return null;const{vapidPublicKey:n}=e;return Object(o.a)(n)}async getProjectId(){const t=new URL(self.location.toString()).searchParams.get("projectId");if(t)return t;try{const{projectId:t}=await a.a.getFromDatabase();return t}catch(t){this.log(lr.error(fr.MISSING_PROJECT_ID)).catch(hr)}return null}async _showDefaultNotification(t){const{title:e,options:n}=function(t){let e="";const n={},r={};return t.title&&(e=t.title),t.body&&(r.body=t.body),t.image&&(r.image=t.image),t.icon&&(r.icon=t.icon),t.tag&&(r.tag=t.tag),t.badge&&(r.badge=t.badge),t.url&&(n.url=t.url),t.name&&(n.name=t.name),r.data=n,{title:e,options:r}}(t);return await self.registration.showNotification(e,n),u(t)}async _showRTBNotification(t){const e=Date.now();await ur.teasers.where("expires").below(e).delete();const n=await ur.teasers.where("expires").above(e).primaryKeys();let r=t.data_url;0!==n.length&&(r+="&"+n.map(t=>"extids="+t).join("&"));const i=await fetch(r);if(!i.ok)return this.log(lr.error(fr.RTB_REQUEST_FAILED)).catch(hr),this._showDefaultNotification(t);const o=await i.json();if(!o||!o.news||0===o.news.length)return this.log(lr.error(fr.RTB_RESPONSE_IS_EMPTY)).catch(hr),this._showDefaultNotification(t);const a=o.news[0];return await self.registration.showNotification(a.title,{icon:a.img.replace(/100_100/,"192_192"),image:a.img.replace(/100_100/,"300_250"),data:{url:a.url}}),await ur.teasers.add({id:a.id,expires:Date.now()+864e5}),u(t)}async log(t){const e=await this.getProjectId();if(!e)throw new Error("projectId is required");if(!(await i.a.post(`projects/${e}/event`,t)).ok)throw new Error("Failed to log event")}}const fr={PUSH_IS_EMPTY:1,PUSH_PARSE_FAILED:2,RTB_REQUEST_FAILED:3,RTB_RESPONSE_IS_EMPTY:4,MISSING_PROJECT_ID:5};class lr{static userClickedOnPush(){return{event:"user_clicked_on_push"}}static pushReceived(){return{event:"push_received"}}static error(t){return{event:"error",error_code:t}}}function hr(){}if("undefined"!=typeof self){(new cr).init()}}]);