@arbocollab/arbo-plugin-item-table 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,7 +100,7 @@ Expected function or array of functions, received type ${typeof e}.`),rs)}functi
100
100
  }
101
101
  `,document.head.appendChild(e)})();const qt={mounted(e,t){e.classList.add("arbo-tooltip-wrapper");const n=t.value;(typeof n=="string"?n:n!=null&&n.content)&&xt(()=>{u1(e,typeof n=="object"?n.bypassOverflowCheck:void 0,n)&&(e._tooltipInstance=c1(e,n))})},updated(e,t){xt(()=>{const n=t.value;if(!u1(e,typeof n=="object"?n.bypassOverflowCheck:void 0,n)||typeof n=="string"&&!n||typeof n=="object"&&!n.content){gg(e._tooltipInstance),delete e._tooltipInstance;return}t.value!==t.oldValue&&(typeof n=="string"?n:n!=null&&n.content)&&xW(e,n)})},beforeUnmount(e){gg(e._tooltipInstance),delete e._tooltipInstance},unmounted(e){gg(e._tooltipInstance),delete e._tooltipInstance}};var h1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function FW(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f1={exports:{}};(function(e,t){(function(n,s){e.exports=s()})(h1,function(){var n=function(g,y){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,I){_.__proto__=I}||function(_,I){for(var O in I)Object.prototype.hasOwnProperty.call(I,O)&&(_[O]=I[O])})(g,y)},s=function(){return(s=Object.assign||function(g){for(var y,_=1,I=arguments.length;_<I;_++)for(var O in y=arguments[_])Object.prototype.hasOwnProperty.call(y,O)&&(g[O]=y[O]);return g}).apply(this,arguments)};function o(g,y,_){for(var I,O=0,V=y.length;O<V;O++)!I&&O in y||((I=I||Array.prototype.slice.call(y,0,O))[O]=y[O]);return g.concat(I||Array.prototype.slice.call(y))}var i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:h1,r=Object.keys,a=Array.isArray;function l(g,y){return typeof y!="object"||r(y).forEach(function(_){g[_]=y[_]}),g}typeof Promise>"u"||i.Promise||(i.Promise=Promise);var u=Object.getPrototypeOf,c={}.hasOwnProperty;function d(g,y){return c.call(g,y)}function h(g,y){typeof y=="function"&&(y=y(u(g))),(typeof Reflect>"u"?r:Reflect.ownKeys)(y).forEach(function(_){p(g,_,y[_])})}var f=Object.defineProperty;function p(g,y,_,I){f(g,y,l(_&&d(_,"get")&&typeof _.get=="function"?{get:_.get,set:_.set,configurable:!0}:{value:_,configurable:!0,writable:!0},I))}function m(g){return{from:function(y){return g.prototype=Object.create(y.prototype),p(g.prototype,"constructor",g),{extend:h.bind(null,g.prototype)}}}}var v=Object.getOwnPropertyDescriptor,w=[].slice;function b(g,y,_){return w.call(g,y,_)}function S(g,y){return y(g)}function C(g){if(!g)throw new Error("Assertion Failed")}function R(g){i.setImmediate?setImmediate(g):setTimeout(g,0)}function E(g,y){if(typeof y=="string"&&d(g,y))return g[y];if(!y)return g;if(typeof y!="string"){for(var _=[],I=0,O=y.length;I<O;++I){var V=E(g,y[I]);_.push(V)}return _}var J=y.indexOf(".");if(J!==-1){var ie=g[y.substr(0,J)];return ie==null?void 0:E(ie,y.substr(J+1))}}function T(g,y,_){if(g&&y!==void 0&&!("isFrozen"in Object&&Object.isFrozen(g)))if(typeof y!="string"&&"length"in y){C(typeof _!="string"&&"length"in _);for(var I=0,O=y.length;I<O;++I)T(g,y[I],_[I])}else{var V,J,ie=y.indexOf(".");ie!==-1?(V=y.substr(0,ie),(J=y.substr(ie+1))===""?_===void 0?a(g)&&!isNaN(parseInt(V))?g.splice(V,1):delete g[V]:g[V]=_:T(ie=!(ie=g[V])||!d(g,V)?g[V]={}:ie,J,_)):_===void 0?a(g)&&!isNaN(parseInt(y))?g.splice(y,1):delete g[y]:g[y]=_}}function k(g){var y,_={};for(y in g)d(g,y)&&(_[y]=g[y]);return _}var M=[].concat;function x(g){return M.apply([],g)}var pa="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(x([8,16,32,64].map(function(g){return["Int","Uint","Float"].map(function(y){return y+g+"Array"})}))).filter(function(g){return i[g]}),D=new Set(pa.map(function(g){return i[g]})),F=null;function P(g){return F=new WeakMap,g=function y(_){if(!_||typeof _!="object")return _;var I=F.get(_);if(I)return I;if(a(_)){I=[],F.set(_,I);for(var O=0,V=_.length;O<V;++O)I.push(y(_[O]))}else if(D.has(_.constructor))I=_;else{var J,ie=u(_);for(J in I=ie===Object.prototype?{}:Object.create(ie),F.set(_,I),_)d(_,J)&&(I[J]=y(_[J]))}return I}(g),F=null,g}var ee={}.toString;function Z(g){return ee.call(g).slice(8,-1)}var B=typeof Symbol<"u"?Symbol.iterator:"@@iterator",ne=typeof B=="symbol"?function(g){var y;return g!=null&&(y=g[B])&&y.apply(g)}:function(){return null};function K(g,y){return y=g.indexOf(y),0<=y&&g.splice(y,1),0<=y}var oe={};function G(g){var y,_,I,O;if(arguments.length===1){if(a(g))return g.slice();if(this===oe&&typeof g=="string")return[g];if(O=ne(g)){for(_=[];!(I=O.next()).done;)_.push(I.value);return _}if(g==null)return[g];if(typeof(y=g.length)!="number")return[g];for(_=new Array(y);y--;)_[y]=g[y];return _}for(y=arguments.length,_=new Array(y);y--;)_[y]=arguments[y];return _}var Q=typeof Symbol<"u"?function(g){return g[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},de=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],ui=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(de),U={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 q(g,y){this.name=g,this.message=y}function re(g,y){return g+". Errors: "+Object.keys(y).map(function(_){return y[_].toString()}).filter(function(_,I,O){return O.indexOf(_)===I}).join(`
102
102
  `)}function Te(g,y,_,I){this.failures=y,this.failedKeys=I,this.successCount=_,this.message=re(g,y)}function We(g,y){this.name="BulkError",this.failures=Object.keys(y).map(function(_){return y[_]}),this.failuresByPos=y,this.message=re(g,this.failures)}m(q).from(Error).extend({toString:function(){return this.name+": "+this.message}}),m(Te).from(q),m(We).from(q);var he=ui.reduce(function(g,y){return g[y]=y+"Error",g},{}),ae=q,te=ui.reduce(function(g,y){var _=y+"Error";function I(O,V){this.name=_,O?typeof O=="string"?(this.message="".concat(O).concat(V?`
103
- `+V:""),this.inner=V||null):typeof O=="object"&&(this.message="".concat(O.name," ").concat(O.message),this.inner=O):(this.message=U[y]||_,this.inner=null)}return m(I).from(ae),g[y]=I,g},{});te.Syntax=SyntaxError,te.Type=TypeError,te.Range=RangeError;var Re=de.reduce(function(g,y){return g[y+"Error"]=te[y],g},{}),$e=ui.reduce(function(g,y){return["Syntax","Type","Range"].indexOf(y)===-1&&(g[y+"Error"]=te[y]),g},{});function Ge(){}function z(g){return g}function se(g,y){return g==null||g===z?y:function(_){return y(g(_))}}function be(g,y){return function(){g.apply(this,arguments),y.apply(this,arguments)}}function fe(g,y){return g===Ge?y:function(){var _=g.apply(this,arguments);_!==void 0&&(arguments[0]=_);var I=this.onsuccess,O=this.onerror;this.onsuccess=null,this.onerror=null;var V=y.apply(this,arguments);return I&&(this.onsuccess=this.onsuccess?be(I,this.onsuccess):I),O&&(this.onerror=this.onerror?be(O,this.onerror):O),V!==void 0?V:_}}function Se(g,y){return g===Ge?y:function(){g.apply(this,arguments);var _=this.onsuccess,I=this.onerror;this.onsuccess=this.onerror=null,y.apply(this,arguments),_&&(this.onsuccess=this.onsuccess?be(_,this.onsuccess):_),I&&(this.onerror=this.onerror?be(I,this.onerror):I)}}function A(g,y){return g===Ge?y:function(_){var I=g.apply(this,arguments);l(_,I);var O=this.onsuccess,V=this.onerror;return this.onsuccess=null,this.onerror=null,_=y.apply(this,arguments),O&&(this.onsuccess=this.onsuccess?be(O,this.onsuccess):O),V&&(this.onerror=this.onerror?be(V,this.onerror):V),I===void 0?_===void 0?void 0:_:l(I,_)}}function N(g,y){return g===Ge?y:function(){return y.apply(this,arguments)!==!1&&g.apply(this,arguments)}}function X(g,y){return g===Ge?y:function(){var _=g.apply(this,arguments);if(_&&typeof _.then=="function"){for(var I=this,O=arguments.length,V=new Array(O);O--;)V[O]=arguments[O];return _.then(function(){return y.apply(I,V)})}return y.apply(this,arguments)}}$e.ModifyError=Te,$e.DexieError=q,$e.BulkError=We;var me=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Pe(g){me=g}var ze={},Le=100,pa=typeof Promise>"u"?[]:function(){var g=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[g,u(g),g];var y=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[y,u(y),g]}(),de=pa[0],ui=pa[1],pa=pa[2],ui=ui&&ui.then,xe=de&&de.constructor,ut=!!pa,Et=function(g,y){wt.push([g,y]),cn&&(queueMicrotask(Er),cn=!1)},Mt=!0,cn=!0,Ht=[],yn=[],Mn=z,Me={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Ge,pgp:!1,env:{},finalize:Ge},He=Me,wt=[],It=0,Gt=[];function Je(g){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var y=this._PSD=He;if(typeof g!="function"){if(g!==ze)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&il(this,this._value))}this._state=null,this._value=null,++y.ref,function _(I,O){try{O(function(V){if(I._state===null){if(V===I)throw new TypeError("A promise cannot be resolved with itself.");var J=I._lib&&Ni();V&&typeof V.then=="function"?_(I,function(ie,ge){V instanceof Je?V._then(ie,ge):V.then(ie,ge)}):(I._state=!0,I._value=V,ai(I)),J&&li()}},il.bind(null,I))}catch(V){il(I,V)}}(this,g)}var hs={get:function(){var g=He,y=Nn;function _(I,O){var V=this,J=!g.global&&(g!==He||y!==Nn),ie=J&&!Li(),ge=new Je(function(we,_e){ua(V,new Mi(ap(I,g,J,ie),ap(O,g,J,ie),we,_e,g))});return this._consoleTask&&(ge._consoleTask=this._consoleTask),ge}return _.prototype=ze,_},set:function(g){p(this,"then",g&&g.prototype===ze?hs:{get:function(){return g},set:hs.set})}};function Mi(g,y,_,I,O){this.onFulfilled=typeof g=="function"?g:null,this.onRejected=typeof y=="function"?y:null,this.resolve=_,this.reject=I,this.psd=O}function il(g,y){var _,I;yn.push(y),g._state===null&&(_=g._lib&&Ni(),y=Mn(y),g._state=!1,g._value=y,I=g,Ht.some(function(O){return O._value===I._value})||Ht.push(I),ai(g),_&&li())}function ai(g){var y=g._listeners;g._listeners=[];for(var _=0,I=y.length;_<I;++_)ua(g,y[_]);var O=g._PSD;--O.ref||O.finalize(),It===0&&(++It,Et(function(){--It==0&&_r()},[]))}function ua(g,y){if(g._state!==null){var _=g._state?y.onFulfilled:y.onRejected;if(_===null)return(g._state?y.resolve:y.reject)(g._value);++y.psd.ref,++It,Et(rl,[_,g,y])}else g._listeners.push(y)}function rl(g,y,_){try{var I,O=y._value;!y._state&&yn.length&&(yn=[]),I=me&&y._consoleTask?y._consoleTask.run(function(){return g(O)}):g(O),y._state||yn.indexOf(O)!==-1||function(V){for(var J=Ht.length;J;)if(Ht[--J]._value===V._value)return Ht.splice(J,1)}(y),_.resolve(I)}catch(V){_.reject(V)}finally{--It==0&&_r(),--_.psd.ref||_.psd.finalize()}}function Er(){ha(Me,function(){Ni()&&li()})}function Ni(){var g=Mt;return cn=Mt=!1,g}function li(){var g,y,_;do for(;0<wt.length;)for(g=wt,wt=[],_=g.length,y=0;y<_;++y){var I=g[y];I[0].apply(null,I[1])}while(0<wt.length);cn=Mt=!0}function _r(){var g=Ht;Ht=[],g.forEach(function(I){I._PSD.onunhandled.call(null,I._value,I)});for(var y=Gt.slice(0),_=y.length;_;)y[--_]()}function Sd(g){return new Je(ze,!1,g)}function Fn(g,y){var _=He;return function(){var I=Ni(),O=He;try{return da(_,!0),g.apply(this,arguments)}catch(V){y&&y(V)}finally{da(O,!1),I&&li()}}}h(Je.prototype,{then:hs,_then:function(g,y){ua(this,new Mi(null,null,g,y,He))},catch:function(g){if(arguments.length===1)return this.then(null,g);var y=g,_=arguments[1];return typeof y=="function"?this.then(null,function(I){return(I instanceof y?_:Sd)(I)}):this.then(null,function(I){return(I&&I.name===y?_:Sd)(I)})},finally:function(g){return this.then(function(y){return Je.resolve(g()).then(function(){return y})},function(y){return Je.resolve(g()).then(function(){return Sd(y)})})},timeout:function(g,y){var _=this;return g<1/0?new Je(function(I,O){var V=setTimeout(function(){return O(new te.Timeout(y))},g);_.then(I,O).finally(clearTimeout.bind(null,V))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&p(Je.prototype,Symbol.toStringTag,"Dexie.Promise"),Me.env=Cy(),h(Je,{all:function(){var g=G.apply(null,arguments).map(al);return new Je(function(y,_){g.length===0&&y([]);var I=g.length;g.forEach(function(O,V){return Je.resolve(O).then(function(J){g[V]=J,--I||y(g)},_)})})},resolve:function(g){return g instanceof Je?g:g&&typeof g.then=="function"?new Je(function(y,_){g.then(y,_)}):new Je(ze,!0,g)},reject:Sd,race:function(){var g=G.apply(null,arguments).map(al);return new Je(function(y,_){g.map(function(I){return Je.resolve(I).then(y,_)})})},PSD:{get:function(){return He},set:function(g){return He=g}},totalEchoes:{get:function(){return Nn}},newPSD:As,usePSD:ha,scheduler:{get:function(){return Et},set:function(g){Et=g}},rejectionMapper:{get:function(){return Mn},set:function(g){Mn=g}},follow:function(g,y){return new Je(function(_,I){return As(function(O,V){var J=He;J.unhandleds=[],J.onunhandled=V,J.finalize=be(function(){var ie,ge=this;ie=function(){ge.unhandleds.length===0?O():V(ge.unhandleds[0])},Gt.push(function we(){ie(),Gt.splice(Gt.indexOf(we),1)}),++It,Et(function(){--It==0&&_r()},[])},J.finalize),g()},y,_,I)})}}),xe&&(xe.allSettled&&p(Je,"allSettled",function(){var g=G.apply(null,arguments).map(al);return new Je(function(y){g.length===0&&y([]);var _=g.length,I=new Array(_);g.forEach(function(O,V){return Je.resolve(O).then(function(J){return I[V]={status:"fulfilled",value:J}},function(J){return I[V]={status:"rejected",reason:J}}).then(function(){return--_||y(I)})})})}),xe.any&&typeof AggregateError<"u"&&p(Je,"any",function(){var g=G.apply(null,arguments).map(al);return new Je(function(y,_){g.length===0&&_(new AggregateError([]));var I=g.length,O=new Array(I);g.forEach(function(V,J){return Je.resolve(V).then(function(ie){return y(ie)},function(ie){O[J]=ie,--I||_(new AggregateError(O))})})})}),xe.withResolvers&&(Je.withResolvers=xe.withResolvers));var fs={awaits:0,echoes:0,id:0},p_=0,Ve=[],Qe=0,Nn=0,_n=0;function As(g,y,_,I){var O=He,V=Object.create(O);return V.parent=O,V.ref=0,V.global=!1,V.id=++_n,Me.env,V.env=ut?{Promise:Je,PromiseProp:{value:Je,configurable:!0,writable:!0},all:Je.all,race:Je.race,allSettled:Je.allSettled,any:Je.any,resolve:Je.resolve,reject:Je.reject}:{},y&&l(V,y),++O.ref,V.finalize=function(){--this.parent.ref||this.parent.finalize()},I=ha(V,g,_,I),V.ref===0&&V.finalize(),I}function ca(){return fs.id||(fs.id=++p_),++fs.awaits,fs.echoes+=Le,fs.id}function Li(){return!!fs.awaits&&(--fs.awaits==0&&(fs.id=0),fs.echoes=fs.awaits*Le,!0)}function al(g){return fs.echoes&&g&&g.constructor===xe?(ca(),g.then(function(y){return Li(),y},function(y){return Li(),ss(y)})):g}function rp(){var g=Ve[Ve.length-1];Ve.pop(),da(g,!1)}function da(g,y){var _,I=He;(y?!fs.echoes||Qe++&&g===He:!Qe||--Qe&&g===He)||queueMicrotask(y?(function(O){++Nn,fs.echoes&&--fs.echoes!=0||(fs.echoes=fs.awaits=fs.id=0),Ve.push(He),da(O,!0)}).bind(null,g):rp),g!==He&&(He=g,I===Me&&(Me.env=Cy()),ut&&(_=Me.env.Promise,y=g.env,(I.global||g.global)&&(Object.defineProperty(i,"Promise",y.PromiseProp),_.all=y.all,_.race=y.race,_.resolve=y.resolve,_.reject=y.reject,y.allSettled&&(_.allSettled=y.allSettled),y.any&&(_.any=y.any))))}function Cy(){var g=i.Promise;return ut?{Promise:g,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:g.all,race:g.race,allSettled:g.allSettled,any:g.any,resolve:g.resolve,reject:g.reject}:{}}function ha(g,y,_,I,O){var V=He;try{return da(g,!0),y(_,I,O)}finally{da(V,!1)}}function ap(g,y,_,I){return typeof g!="function"?g:function(){var O=He;_&&ca(),da(y,!0);try{return g.apply(this,arguments)}finally{da(O,!1),I&&queueMicrotask(Li)}}}function ll(g){Promise===xe&&fs.echoes===0?Qe===0?g():enqueueNativeMicroTask(g):setTimeout(g,0)}(""+ui).indexOf("[native code]")===-1&&(ca=Li=Ge);var ss=Je.reject,_u="￿",fa="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",aB="String expected.",Ed=[],by="__dbnames",g_="readonly",m_="readwrite";function Ru(g,y){return g?y?function(){return g.apply(this,arguments)&&y.apply(this,arguments)}:g:y}var lB={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Sy(g){return typeof g!="string"||/\./.test(g)?function(y){return y}:function(y){return y[g]===void 0&&g in y&&delete(y=P(y))[g],y}}function uB(){throw te.Type()}function en(g,y){try{var _=cB(g),I=cB(y);if(_!==I)return _==="Array"?1:I==="Array"?-1:_==="binary"?1:I==="binary"?-1:_==="string"?1:I==="string"?-1:_==="Date"?1:I!=="Date"?NaN:-1;switch(_){case"number":case"Date":case"string":return y<g?1:g<y?-1:0;case"binary":return function(O,V){for(var J=O.length,ie=V.length,ge=J<ie?J:ie,we=0;we<ge;++we)if(O[we]!==V[we])return O[we]<V[we]?-1:1;return J===ie?0:J<ie?-1:1}(dB(g),dB(y));case"Array":return function(O,V){for(var J=O.length,ie=V.length,ge=J<ie?J:ie,we=0;we<ge;++we){var _e=en(O[we],V[we]);if(_e!==0)return _e}return J===ie?0:J<ie?-1:1}(g,y)}}catch{}return NaN}function cB(g){var y=typeof g;return y!="object"?y:ArrayBuffer.isView(g)?"binary":(g=Z(g),g==="ArrayBuffer"?"binary":g)}function dB(g){return g instanceof Uint8Array?g:ArrayBuffer.isView(g)?new Uint8Array(g.buffer,g.byteOffset,g.byteLength):new Uint8Array(g)}var hB=(Ln.prototype._trans=function(g,y,_){var I=this._tx||He.trans,O=this.name,V=me&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(g==="readonly"?"read":"write"," ").concat(this.name));function J(we,_e,le){if(!le.schema[O])throw new te.NotFound("Table "+O+" not part of transaction");return y(le.idbtrans,le)}var ie=Ni();try{var ge=I&&I.db._novip===this.db._novip?I===He.trans?I._promise(g,J,_):As(function(){return I._promise(g,J,_)},{trans:I,transless:He.transless||He}):function we(_e,le,Fe,ve){if(_e.idbdb&&(_e._state.openComplete||He.letThrough||_e._vip)){var Ee=_e._createTransaction(le,Fe,_e._dbSchema);try{Ee.create(),_e._state.PR1398_maxLoop=3}catch(De){return De.name===he.InvalidState&&_e.isOpen()&&0<--_e._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),_e.close({disableAutoOpen:!1}),_e.open().then(function(){return we(_e,le,Fe,ve)})):ss(De)}return Ee._promise(le,function(De,Ce){return As(function(){return He.trans=Ee,ve(De,Ce,Ee)})}).then(function(De){if(le==="readwrite")try{Ee.idbtrans.commit()}catch{}return le==="readonly"?De:Ee._completion.then(function(){return De})})}if(_e._state.openComplete)return ss(new te.DatabaseClosed(_e._state.dbOpenError));if(!_e._state.isBeingOpened){if(!_e._state.autoOpen)return ss(new te.DatabaseClosed);_e.open().catch(Ge)}return _e._state.dbReadyPromise.then(function(){return we(_e,le,Fe,ve)})}(this.db,g,[this.name],J);return V&&(ge._consoleTask=V,ge=ge.catch(function(we){return console.trace(we),ss(we)})),ge}finally{ie&&li()}},Ln.prototype.get=function(g,y){var _=this;return g&&g.constructor===Object?this.where(g).first(y):g==null?ss(new te.Type("Invalid argument to Table.get()")):this._trans("readonly",function(I){return _.core.get({trans:I,key:g}).then(function(O){return _.hook.reading.fire(O)})}).then(y)},Ln.prototype.where=function(g){if(typeof g=="string")return new this.db.WhereClause(this,g);if(a(g))return new this.db.WhereClause(this,"[".concat(g.join("+"),"]"));var y=r(g);if(y.length===1)return this.where(y[0]).equals(g[y[0]]);var _=this.schema.indexes.concat(this.schema.primKey).filter(function(ie){if(ie.compound&&y.every(function(we){return 0<=ie.keyPath.indexOf(we)})){for(var ge=0;ge<y.length;++ge)if(y.indexOf(ie.keyPath[ge])===-1)return!1;return!0}return!1}).sort(function(ie,ge){return ie.keyPath.length-ge.keyPath.length})[0];if(_&&this.db._maxKey!==_u){var V=_.keyPath.slice(0,y.length);return this.where(V).equals(V.map(function(ge){return g[ge]}))}!_&&me&&console.warn("The query ".concat(JSON.stringify(g)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(y.join("+"),"]"));var I=this.schema.idxByName;function O(ie,ge){return en(ie,ge)===0}var J=y.reduce(function(le,ge){var we=le[0],_e=le[1],le=I[ge],Fe=g[ge];return[we||le,we||!le?Ru(_e,le&&le.multi?function(ve){return ve=E(ve,ge),a(ve)&&ve.some(function(Ee){return O(Fe,Ee)})}:function(ve){return O(Fe,E(ve,ge))}):_e]},[null,null]),V=J[0],J=J[1];return V?this.where(V.name).equals(g[V.keyPath]).filter(J):_?this.filter(J):this.where(y).equals("")},Ln.prototype.filter=function(g){return this.toCollection().and(g)},Ln.prototype.count=function(g){return this.toCollection().count(g)},Ln.prototype.offset=function(g){return this.toCollection().offset(g)},Ln.prototype.limit=function(g){return this.toCollection().limit(g)},Ln.prototype.each=function(g){return this.toCollection().each(g)},Ln.prototype.toArray=function(g){return this.toCollection().toArray(g)},Ln.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Ln.prototype.orderBy=function(g){return new this.db.Collection(new this.db.WhereClause(this,a(g)?"[".concat(g.join("+"),"]"):g))},Ln.prototype.reverse=function(){return this.toCollection().reverse()},Ln.prototype.mapToClass=function(g){var y,_=this.db,I=this.name;function O(){return y!==null&&y.apply(this,arguments)||this}(this.schema.mappedClass=g).prototype instanceof uB&&(function(ge,we){if(typeof we!="function"&&we!==null)throw new TypeError("Class extends value "+String(we)+" is not a constructor or null");function _e(){this.constructor=ge}n(ge,we),ge.prototype=we===null?Object.create(we):(_e.prototype=we.prototype,new _e)}(O,y=g),Object.defineProperty(O.prototype,"db",{get:function(){return _},enumerable:!1,configurable:!0}),O.prototype.table=function(){return I},g=O);for(var V=new Set,J=g.prototype;J;J=u(J))Object.getOwnPropertyNames(J).forEach(function(ge){return V.add(ge)});function ie(ge){if(!ge)return ge;var we,_e=Object.create(g.prototype);for(we in ge)if(!V.has(we))try{_e[we]=ge[we]}catch{}return _e}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=ie,this.hook("reading",ie),g},Ln.prototype.defineClass=function(){return this.mapToClass(function(g){l(this,g)})},Ln.prototype.add=function(g,y){var _=this,I=this.schema.primKey,O=I.auto,V=I.keyPath,J=g;return V&&O&&(J=Sy(V)(g)),this._trans("readwrite",function(ie){return _.core.mutate({trans:ie,type:"add",keys:y!=null?[y]:null,values:[J]})}).then(function(ie){return ie.numFailures?Je.reject(ie.failures[0]):ie.lastResult}).then(function(ie){if(V)try{T(g,V,ie)}catch{}return ie})},Ln.prototype.update=function(g,y){return typeof g!="object"||a(g)?this.where(":id").equals(g).modify(y):(g=E(g,this.schema.primKey.keyPath),g===void 0?ss(new te.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(g).modify(y))},Ln.prototype.put=function(g,y){var _=this,I=this.schema.primKey,O=I.auto,V=I.keyPath,J=g;return V&&O&&(J=Sy(V)(g)),this._trans("readwrite",function(ie){return _.core.mutate({trans:ie,type:"put",values:[J],keys:y!=null?[y]:null})}).then(function(ie){return ie.numFailures?Je.reject(ie.failures[0]):ie.lastResult}).then(function(ie){if(V)try{T(g,V,ie)}catch{}return ie})},Ln.prototype.delete=function(g){var y=this;return this._trans("readwrite",function(_){return y.core.mutate({trans:_,type:"delete",keys:[g]})}).then(function(_){return _.numFailures?Je.reject(_.failures[0]):void 0})},Ln.prototype.clear=function(){var g=this;return this._trans("readwrite",function(y){return g.core.mutate({trans:y,type:"deleteRange",range:lB})}).then(function(y){return y.numFailures?Je.reject(y.failures[0]):void 0})},Ln.prototype.bulkGet=function(g){var y=this;return this._trans("readonly",function(_){return y.core.getMany({keys:g,trans:_}).then(function(I){return I.map(function(O){return y.hook.reading.fire(O)})})})},Ln.prototype.bulkAdd=function(g,y,_){var I=this,O=Array.isArray(y)?y:void 0,V=(_=_||(O?void 0:y))?_.allKeys:void 0;return this._trans("readwrite",function(J){var we=I.schema.primKey,ie=we.auto,we=we.keyPath;if(we&&O)throw new te.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(O&&O.length!==g.length)throw new te.InvalidArgument("Arguments objects and keys must have the same length");var ge=g.length,we=we&&ie?g.map(Sy(we)):g;return I.core.mutate({trans:J,type:"add",keys:O,values:we,wantResults:V}).then(function(Ee){var le=Ee.numFailures,Fe=Ee.results,ve=Ee.lastResult,Ee=Ee.failures;if(le===0)return V?Fe:ve;throw new We("".concat(I.name,".bulkAdd(): ").concat(le," of ").concat(ge," operations failed"),Ee)})})},Ln.prototype.bulkPut=function(g,y,_){var I=this,O=Array.isArray(y)?y:void 0,V=(_=_||(O?void 0:y))?_.allKeys:void 0;return this._trans("readwrite",function(J){var we=I.schema.primKey,ie=we.auto,we=we.keyPath;if(we&&O)throw new te.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(O&&O.length!==g.length)throw new te.InvalidArgument("Arguments objects and keys must have the same length");var ge=g.length,we=we&&ie?g.map(Sy(we)):g;return I.core.mutate({trans:J,type:"put",keys:O,values:we,wantResults:V}).then(function(Ee){var le=Ee.numFailures,Fe=Ee.results,ve=Ee.lastResult,Ee=Ee.failures;if(le===0)return V?Fe:ve;throw new We("".concat(I.name,".bulkPut(): ").concat(le," of ").concat(ge," operations failed"),Ee)})})},Ln.prototype.bulkUpdate=function(g){var y=this,_=this.core,I=g.map(function(J){return J.key}),O=g.map(function(J){return J.changes}),V=[];return this._trans("readwrite",function(J){return _.getMany({trans:J,keys:I,cache:"clone"}).then(function(ie){var ge=[],we=[];g.forEach(function(le,Fe){var ve=le.key,Ee=le.changes,De=ie[Fe];if(De){for(var Ce=0,Ae=Object.keys(Ee);Ce<Ae.length;Ce++){var Oe=Ae[Ce],Ne=Ee[Oe];if(Oe===y.schema.primKey.keyPath){if(en(Ne,ve)!==0)throw new te.Constraint("Cannot update primary key in bulkUpdate()")}else T(De,Oe,Ne)}V.push(Fe),ge.push(ve),we.push(De)}});var _e=ge.length;return _.mutate({trans:J,type:"put",keys:ge,values:we,updates:{keys:I,changeSpecs:O}}).then(function(le){var Fe=le.numFailures,ve=le.failures;if(Fe===0)return _e;for(var Ee=0,De=Object.keys(ve);Ee<De.length;Ee++){var Ce,Ae=De[Ee],Oe=V[Number(Ae)];Oe!=null&&(Ce=ve[Ae],delete ve[Ae],ve[Oe]=Ce)}throw new We("".concat(y.name,".bulkUpdate(): ").concat(Fe," of ").concat(_e," operations failed"),ve)})})})},Ln.prototype.bulkDelete=function(g){var y=this,_=g.length;return this._trans("readwrite",function(I){return y.core.mutate({trans:I,type:"delete",keys:g})}).then(function(J){var O=J.numFailures,V=J.lastResult,J=J.failures;if(O===0)return V;throw new We("".concat(y.name,".bulkDelete(): ").concat(O," of ").concat(_," operations failed"),J)})},Ln);function Ln(){}function lp(g){function y(J,ie){if(ie){for(var ge=arguments.length,we=new Array(ge-1);--ge;)we[ge-1]=arguments[ge];return _[J].subscribe.apply(null,we),g}if(typeof J=="string")return _[J]}var _={};y.addEventType=V;for(var I=1,O=arguments.length;I<O;++I)V(arguments[I]);return y;function V(J,ie,ge){if(typeof J!="object"){var we;ie=ie||N;var _e={subscribers:[],fire:ge=ge||Ge,subscribe:function(le){_e.subscribers.indexOf(le)===-1&&(_e.subscribers.push(le),_e.fire=ie(_e.fire,le))},unsubscribe:function(le){_e.subscribers=_e.subscribers.filter(function(Fe){return Fe!==le}),_e.fire=_e.subscribers.reduce(ie,ge)}};return _[J]=y[J]=_e}r(we=J).forEach(function(le){var Fe=we[le];if(a(Fe))V(le,we[le][0],we[le][1]);else{if(Fe!=="asap")throw new te.InvalidArgument("Invalid event config");var ve=V(le,z,function(){for(var Ee=arguments.length,De=new Array(Ee);Ee--;)De[Ee]=arguments[Ee];ve.subscribers.forEach(function(Ce){R(function(){Ce.apply(null,De)})})})}})}}function up(g,y){return m(y).from({prototype:g}),y}function _d(g,y){return!(g.filter||g.algorithm||g.or)&&(y?g.justLimit:!g.replayFilter)}function v_(g,y){g.filter=Ru(g.filter,y)}function y_(g,y,_){var I=g.replayFilter;g.replayFilter=I?function(){return Ru(I(),y())}:y,g.justLimit=_&&!I}function Ey(g,y){if(g.isPrimKey)return y.primaryKey;var _=y.getIndexByKeyPath(g.index);if(!_)throw new te.Schema("KeyPath "+g.index+" on object store "+y.name+" is not indexed");return _}function fB(g,y,_){var I=Ey(g,y.schema);return y.openCursor({trans:_,values:!g.keysOnly,reverse:g.dir==="prev",unique:!!g.unique,query:{index:I,range:g.range}})}function _y(g,y,_,I){var O=g.replayFilter?Ru(g.filter,g.replayFilter()):g.filter;if(g.or){var V={},J=function(ie,ge,we){var _e,le;O&&!O(ge,we,function(Fe){return ge.stop(Fe)},function(Fe){return ge.fail(Fe)})||((le=""+(_e=ge.primaryKey))=="[object ArrayBuffer]"&&(le=""+new Uint8Array(_e)),d(V,le)||(V[le]=!0,y(ie,ge,we)))};return Promise.all([g.or._iterate(J,_),pB(fB(g,I,_),g.algorithm,J,!g.keysOnly&&g.valueMapper)])}return pB(fB(g,I,_),Ru(g.algorithm,O),y,!g.keysOnly&&g.valueMapper)}function pB(g,y,_,I){var O=Fn(I?function(V,J,ie){return _(I(V),J,ie)}:_);return g.then(function(V){if(V)return V.start(function(){var J=function(){return V.continue()};y&&!y(V,function(ie){return J=ie},function(ie){V.stop(ie),J=Ge},function(ie){V.fail(ie),J=Ge})||O(V.value,V,function(ie){return J=ie}),J()})})}var pa=Symbol(),cp=(gB.prototype.execute=function(g){if(this.add!==void 0){var y=this.add;if(a(y))return o(o([],a(g)?g:[],!0),y).sort();if(typeof y=="number")return(Number(g)||0)+y;if(typeof y=="bigint")try{return BigInt(g)+y}catch{return BigInt(0)+y}throw new TypeError("Invalid term ".concat(y))}if(this.remove!==void 0){var _=this.remove;if(a(_))return a(g)?g.filter(function(I){return!_.includes(I)}).sort():[];if(typeof _=="number")return Number(g)-_;if(typeof _=="bigint")try{return BigInt(g)-_}catch{return BigInt(0)-_}throw new TypeError("Invalid subtrahend ".concat(_))}return y=(y=this.replacePrefix)===null||y===void 0?void 0:y[0],y&&typeof g=="string"&&g.startsWith(y)?this.replacePrefix[1]+g.substring(y.length):g},gB);function gB(g){Object.assign(this,g)}var nCe=(dn.prototype._read=function(g,y){var _=this._ctx;return _.error?_.table._trans(null,ss.bind(null,_.error)):_.table._trans("readonly",g).then(y)},dn.prototype._write=function(g){var y=this._ctx;return y.error?y.table._trans(null,ss.bind(null,y.error)):y.table._trans("readwrite",g,"locked")},dn.prototype._addAlgorithm=function(g){var y=this._ctx;y.algorithm=Ru(y.algorithm,g)},dn.prototype._iterate=function(g,y){return _y(this._ctx,g,y,this._ctx.table.core)},dn.prototype.clone=function(g){var y=Object.create(this.constructor.prototype),_=Object.create(this._ctx);return g&&l(_,g),y._ctx=_,y},dn.prototype.raw=function(){return this._ctx.valueMapper=null,this},dn.prototype.each=function(g){var y=this._ctx;return this._read(function(_){return _y(y,g,_,y.table.core)})},dn.prototype.count=function(g){var y=this;return this._read(function(_){var I=y._ctx,O=I.table.core;if(_d(I,!0))return O.count({trans:_,query:{index:Ey(I,O.schema),range:I.range}}).then(function(J){return Math.min(J,I.limit)});var V=0;return _y(I,function(){return++V,!1},_,O).then(function(){return V})}).then(g)},dn.prototype.sortBy=function(g,y){var _=g.split(".").reverse(),I=_[0],O=_.length-1;function V(ge,we){return we?V(ge[_[we]],we-1):ge[I]}var J=this._ctx.dir==="next"?1:-1;function ie(ge,we){return en(V(ge,O),V(we,O))*J}return this.toArray(function(ge){return ge.sort(ie)}).then(y)},dn.prototype.toArray=function(g){var y=this;return this._read(function(_){var I=y._ctx;if(I.dir==="next"&&_d(I,!0)&&0<I.limit){var O=I.valueMapper,V=Ey(I,I.table.core.schema);return I.table.core.query({trans:_,limit:I.limit,values:!0,query:{index:V,range:I.range}}).then(function(ie){return ie=ie.result,O?ie.map(O):ie})}var J=[];return _y(I,function(ie){return J.push(ie)},_,I.table.core).then(function(){return J})},g)},dn.prototype.offset=function(g){var y=this._ctx;return g<=0||(y.offset+=g,_d(y)?y_(y,function(){var _=g;return function(I,O){return _===0||(_===1?--_:O(function(){I.advance(_),_=0}),!1)}}):y_(y,function(){var _=g;return function(){return--_<0}})),this},dn.prototype.limit=function(g){return this._ctx.limit=Math.min(this._ctx.limit,g),y_(this._ctx,function(){var y=g;return function(_,I,O){return--y<=0&&I(O),0<=y}},!0),this},dn.prototype.until=function(g,y){return v_(this._ctx,function(_,I,O){return!g(_.value)||(I(O),y)}),this},dn.prototype.first=function(g){return this.limit(1).toArray(function(y){return y[0]}).then(g)},dn.prototype.last=function(g){return this.reverse().first(g)},dn.prototype.filter=function(g){var y;return v_(this._ctx,function(_){return g(_.value)}),(y=this._ctx).isMatch=Ru(y.isMatch,g),this},dn.prototype.and=function(g){return this.filter(g)},dn.prototype.or=function(g){return new this.db.WhereClause(this._ctx.table,g,this)},dn.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},dn.prototype.desc=function(){return this.reverse()},dn.prototype.eachKey=function(g){var y=this._ctx;return y.keysOnly=!y.isMatch,this.each(function(_,I){g(I.key,I)})},dn.prototype.eachUniqueKey=function(g){return this._ctx.unique="unique",this.eachKey(g)},dn.prototype.eachPrimaryKey=function(g){var y=this._ctx;return y.keysOnly=!y.isMatch,this.each(function(_,I){g(I.primaryKey,I)})},dn.prototype.keys=function(g){var y=this._ctx;y.keysOnly=!y.isMatch;var _=[];return this.each(function(I,O){_.push(O.key)}).then(function(){return _}).then(g)},dn.prototype.primaryKeys=function(g){var y=this._ctx;if(y.dir==="next"&&_d(y,!0)&&0<y.limit)return this._read(function(I){var O=Ey(y,y.table.core.schema);return y.table.core.query({trans:I,values:!1,limit:y.limit,query:{index:O,range:y.range}})}).then(function(I){return I.result}).then(g);y.keysOnly=!y.isMatch;var _=[];return this.each(function(I,O){_.push(O.primaryKey)}).then(function(){return _}).then(g)},dn.prototype.uniqueKeys=function(g){return this._ctx.unique="unique",this.keys(g)},dn.prototype.firstKey=function(g){return this.limit(1).keys(function(y){return y[0]}).then(g)},dn.prototype.lastKey=function(g){return this.reverse().firstKey(g)},dn.prototype.distinct=function(){var g=this._ctx,g=g.index&&g.table.schema.idxByName[g.index];if(!g||!g.multi)return this;var y={};return v_(this._ctx,function(O){var I=O.primaryKey.toString(),O=d(y,I);return y[I]=!0,!O}),this},dn.prototype.modify=function(g){var y=this,_=this._ctx;return this._write(function(I){var O,V,J;J=typeof g=="function"?g:(O=r(g),V=O.length,function(Ce){for(var Ae=!1,Oe=0;Oe<V;++Oe){var Ne=O[Oe],Ue=g[Ne],et=E(Ce,Ne);Ue instanceof cp?(T(Ce,Ne,Ue.execute(et)),Ae=!0):et!==Ue&&(T(Ce,Ne,Ue),Ae=!0)}return Ae});var ie=_.table.core,le=ie.schema.primaryKey,ge=le.outbound,we=le.extractKey,_e=200,le=y.db._options.modifyChunkSize;le&&(_e=typeof le=="object"?le[ie.name]||le["*"]||200:le);function Fe(Ce,Ne){var Oe=Ne.failures,Ne=Ne.numFailures;Ee+=Ce-Ne;for(var Ue=0,et=r(Oe);Ue<et.length;Ue++){var ft=et[Ue];ve.push(Oe[ft])}}var ve=[],Ee=0,De=[];return y.clone().primaryKeys().then(function(Ce){function Ae(Ne){var Ue=Math.min(_e,Ce.length-Ne);return ie.getMany({trans:I,keys:Ce.slice(Ne,Ne+Ue),cache:"immutable"}).then(function(et){for(var ft=[],tt=[],ot=ge?[]:null,gt=[],ct=0;ct<Ue;++ct){var bt=et[ct],jt={value:P(bt),primKey:Ce[Ne+ct]};J.call(jt,jt.value,jt)!==!1&&(jt.value==null?gt.push(Ce[Ne+ct]):ge||en(we(bt),we(jt.value))===0?(tt.push(jt.value),ge&&ot.push(Ce[Ne+ct])):(gt.push(Ce[Ne+ct]),ft.push(jt.value)))}return Promise.resolve(0<ft.length&&ie.mutate({trans:I,type:"add",values:ft}).then(function(Xt){for(var Jt in Xt.failures)gt.splice(parseInt(Jt),1);Fe(ft.length,Xt)})).then(function(){return(0<tt.length||Oe&&typeof g=="object")&&ie.mutate({trans:I,type:"put",keys:ot,values:tt,criteria:Oe,changeSpec:typeof g!="function"&&g,isAdditionalChunk:0<Ne}).then(function(Xt){return Fe(tt.length,Xt)})}).then(function(){return(0<gt.length||Oe&&g===w_)&&ie.mutate({trans:I,type:"delete",keys:gt,criteria:Oe,isAdditionalChunk:0<Ne}).then(function(Xt){return Fe(gt.length,Xt)})}).then(function(){return Ce.length>Ne+Ue&&Ae(Ne+_e)})})}var Oe=_d(_)&&_.limit===1/0&&(typeof g!="function"||g===w_)&&{index:_.index,range:_.range};return Ae(0).then(function(){if(0<ve.length)throw new Te("Error modifying one or more objects",ve,Ee,De);return Ce.length})})})},dn.prototype.delete=function(){var g=this._ctx,y=g.range;return _d(g)&&(g.isPrimKey||y.type===3)?this._write(function(_){var I=g.table.core.schema.primaryKey,O=y;return g.table.core.count({trans:_,query:{index:I,range:O}}).then(function(V){return g.table.core.mutate({trans:_,type:"deleteRange",range:O}).then(function(J){var ie=J.failures;if(J.lastResult,J.results,J=J.numFailures,J)throw new Te("Could not delete some values",Object.keys(ie).map(function(ge){return ie[ge]}),V-J);return V-J})})}):this.modify(w_)},dn);function dn(){}var w_=function(g,y){return y.value=null};function sCe(g,y){return g<y?-1:g===y?0:1}function oCe(g,y){return y<g?-1:g===y?0:1}function Oo(g,y,_){return g=g instanceof vB?new g.Collection(g):g,g._ctx.error=new(_||TypeError)(y),g}function Rd(g){return new g.Collection(g,function(){return mB("")}).limit(0)}function Ry(g,y,_,I){var O,V,J,ie,ge,we,_e,le=_.length;if(!_.every(function(Ee){return typeof Ee=="string"}))return Oo(g,aB);function Fe(Ee){O=Ee==="next"?function(Ce){return Ce.toUpperCase()}:function(Ce){return Ce.toLowerCase()},V=Ee==="next"?function(Ce){return Ce.toLowerCase()}:function(Ce){return Ce.toUpperCase()},J=Ee==="next"?sCe:oCe;var De=_.map(function(Ce){return{lower:V(Ce),upper:O(Ce)}}).sort(function(Ce,Ae){return J(Ce.lower,Ae.lower)});ie=De.map(function(Ce){return Ce.upper}),ge=De.map(function(Ce){return Ce.lower}),_e=(we=Ee)==="next"?"":I}Fe("next"),g=new g.Collection(g,function(){return ul(ie[0],ge[le-1]+I)}),g._ondirectionchange=function(Ee){Fe(Ee)};var ve=0;return g._addAlgorithm(function(Ee,De,Ce){var Ae=Ee.key;if(typeof Ae!="string")return!1;var Oe=V(Ae);if(y(Oe,ge,ve))return!0;for(var Ne=null,Ue=ve;Ue<le;++Ue){var et=function(ft,tt,ot,gt,ct,bt){for(var jt=Math.min(ft.length,gt.length),Xt=-1,Jt=0;Jt<jt;++Jt){var Mo=tt[Jt];if(Mo!==gt[Jt])return ct(ft[Jt],ot[Jt])<0?ft.substr(0,Jt)+ot[Jt]+ot.substr(Jt+1):ct(ft[Jt],gt[Jt])<0?ft.substr(0,Jt)+gt[Jt]+ot.substr(Jt+1):0<=Xt?ft.substr(0,Xt)+tt[Xt]+ot.substr(Xt+1):null;ct(ft[Jt],Mo)<0&&(Xt=Jt)}return jt<gt.length&&bt==="next"?ft+ot.substr(ft.length):jt<ft.length&&bt==="prev"?ft.substr(0,ot.length):Xt<0?null:ft.substr(0,Xt)+gt[Xt]+ot.substr(Xt+1)}(Ae,Oe,ie[Ue],ge[Ue],J,we);et===null&&Ne===null?ve=Ue+1:(Ne===null||0<J(Ne,et))&&(Ne=et)}return De(Ne!==null?function(){Ee.continue(Ne+_e)}:Ce),!1}),g}function ul(g,y,_,I){return{type:2,lower:g,upper:y,lowerOpen:_,upperOpen:I}}function mB(g){return{type:1,lower:g,upper:g}}var vB=(Object.defineProperty(_s.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),_s.prototype.between=function(g,y,_,I){_=_!==!1,I=I===!0;try{return 0<this._cmp(g,y)||this._cmp(g,y)===0&&(_||I)&&(!_||!I)?Rd(this):new this.Collection(this,function(){return ul(g,y,!_,!I)})}catch{return Oo(this,fa)}},_s.prototype.equals=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return mB(g)})},_s.prototype.above=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(g,void 0,!0)})},_s.prototype.aboveOrEqual=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(g,void 0,!1)})},_s.prototype.below=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(void 0,g,!1,!0)})},_s.prototype.belowOrEqual=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(void 0,g)})},_s.prototype.startsWith=function(g){return typeof g!="string"?Oo(this,aB):this.between(g,g+_u,!0,!0)},_s.prototype.startsWithIgnoreCase=function(g){return g===""?this.startsWith(g):Ry(this,function(y,_){return y.indexOf(_[0])===0},[g],_u)},_s.prototype.equalsIgnoreCase=function(g){return Ry(this,function(y,_){return y===_[0]},[g],"")},_s.prototype.anyOfIgnoreCase=function(){var g=G.apply(oe,arguments);return g.length===0?Rd(this):Ry(this,function(y,_){return _.indexOf(y)!==-1},g,"")},_s.prototype.startsWithAnyOfIgnoreCase=function(){var g=G.apply(oe,arguments);return g.length===0?Rd(this):Ry(this,function(y,_){return _.some(function(I){return y.indexOf(I)===0})},g,_u)},_s.prototype.anyOf=function(){var g=this,y=G.apply(oe,arguments),_=this._cmp;try{y.sort(_)}catch{return Oo(this,fa)}if(y.length===0)return Rd(this);var I=new this.Collection(this,function(){return ul(y[0],y[y.length-1])});I._ondirectionchange=function(V){_=V==="next"?g._ascending:g._descending,y.sort(_)};var O=0;return I._addAlgorithm(function(V,J,ie){for(var ge=V.key;0<_(ge,y[O]);)if(++O===y.length)return J(ie),!1;return _(ge,y[O])===0||(J(function(){V.continue(y[O])}),!1)}),I},_s.prototype.notEqual=function(g){return this.inAnyRange([[-1/0,g],[g,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},_s.prototype.noneOf=function(){var g=G.apply(oe,arguments);if(g.length===0)return new this.Collection(this);try{g.sort(this._ascending)}catch{return Oo(this,fa)}var y=g.reduce(function(_,I){return _?_.concat([[_[_.length-1][1],I]]):[[-1/0,I]]},null);return y.push([g[g.length-1],this.db._maxKey]),this.inAnyRange(y,{includeLowers:!1,includeUppers:!1})},_s.prototype.inAnyRange=function(Ae,y){var _=this,I=this._cmp,O=this._ascending,V=this._descending,J=this._min,ie=this._max;if(Ae.length===0)return Rd(this);if(!Ae.every(function(Oe){return Oe[0]!==void 0&&Oe[1]!==void 0&&O(Oe[0],Oe[1])<=0}))return Oo(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",te.InvalidArgument);var ge=!y||y.includeLowers!==!1,we=y&&y.includeUppers===!0,_e,le=O;function Fe(Oe,Ne){return le(Oe[0],Ne[0])}try{(_e=Ae.reduce(function(Oe,Ne){for(var Ue=0,et=Oe.length;Ue<et;++Ue){var ft=Oe[Ue];if(I(Ne[0],ft[1])<0&&0<I(Ne[1],ft[0])){ft[0]=J(ft[0],Ne[0]),ft[1]=ie(ft[1],Ne[1]);break}}return Ue===et&&Oe.push(Ne),Oe},[])).sort(Fe)}catch{return Oo(this,fa)}var ve=0,Ee=we?function(Oe){return 0<O(Oe,_e[ve][1])}:function(Oe){return 0<=O(Oe,_e[ve][1])},De=ge?function(Oe){return 0<V(Oe,_e[ve][0])}:function(Oe){return 0<=V(Oe,_e[ve][0])},Ce=Ee,Ae=new this.Collection(this,function(){return ul(_e[0][0],_e[_e.length-1][1],!ge,!we)});return Ae._ondirectionchange=function(Oe){le=Oe==="next"?(Ce=Ee,O):(Ce=De,V),_e.sort(Fe)},Ae._addAlgorithm(function(Oe,Ne,Ue){for(var et,ft=Oe.key;Ce(ft);)if(++ve===_e.length)return Ne(Ue),!1;return!Ee(et=ft)&&!De(et)||(_._cmp(ft,_e[ve][1])===0||_._cmp(ft,_e[ve][0])===0||Ne(function(){le===O?Oe.continue(_e[ve][0]):Oe.continue(_e[ve][1])}),!1)}),Ae},_s.prototype.startsWithAnyOf=function(){var g=G.apply(oe,arguments);return g.every(function(y){return typeof y=="string"})?g.length===0?Rd(this):this.inAnyRange(g.map(function(y){return[y,y+_u]})):Oo(this,"startsWithAnyOf() only works with strings")},_s);function _s(){}function Rr(g){return Fn(function(y){return dp(y),g(y.target.error),!1})}function dp(g){g.stopPropagation&&g.stopPropagation(),g.preventDefault&&g.preventDefault()}var hp="storagemutated",C_="x-storagemutated-1",cl=lp(null,hp),iCe=(Dr.prototype._lock=function(){return C(!He.global),++this._reculock,this._reculock!==1||He.global||(He.lockOwnerFor=this),this},Dr.prototype._unlock=function(){if(C(!He.global),--this._reculock==0)for(He.global||(He.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var g=this._blockedFuncs.shift();try{ha(g[1],g[0])}catch{}}return this},Dr.prototype._locked=function(){return this._reculock&&He.lockOwnerFor!==this},Dr.prototype.create=function(g){var y=this;if(!this.mode)return this;var _=this.db.idbdb,I=this.db._state.dbOpenError;if(C(!this.idbtrans),!g&&!_)switch(I&&I.name){case"DatabaseClosedError":throw new te.DatabaseClosed(I);case"MissingAPIError":throw new te.MissingAPI(I.message,I);default:throw new te.OpenFailed(I)}if(!this.active)throw new te.TransactionInactive;return C(this._completion._state===null),(g=this.idbtrans=g||(this.db.core||_).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Fn(function(O){dp(O),y._reject(g.error)}),g.onabort=Fn(function(O){dp(O),y.active&&y._reject(new te.Abort(g.error)),y.active=!1,y.on("abort").fire(O)}),g.oncomplete=Fn(function(){y.active=!1,y._resolve(),"mutatedParts"in g&&cl.storagemutated.fire(g.mutatedParts)}),this},Dr.prototype._promise=function(g,y,_){var I=this;if(g==="readwrite"&&this.mode!=="readwrite")return ss(new te.ReadOnly("Transaction is readonly"));if(!this.active)return ss(new te.TransactionInactive);if(this._locked())return new Je(function(V,J){I._blockedFuncs.push([function(){I._promise(g,y,_).then(V,J)},He])});if(_)return As(function(){var V=new Je(function(J,ie){I._lock();var ge=y(J,ie,I);ge&&ge.then&&ge.then(J,ie)});return V.finally(function(){return I._unlock()}),V._lib=!0,V});var O=new Je(function(V,J){var ie=y(V,J,I);ie&&ie.then&&ie.then(V,J)});return O._lib=!0,O},Dr.prototype._root=function(){return this.parent?this.parent._root():this},Dr.prototype.waitFor=function(g){var y,_=this._root(),I=Je.resolve(g);_._waitingFor?_._waitingFor=_._waitingFor.then(function(){return I}):(_._waitingFor=I,_._waitingQueue=[],y=_.idbtrans.objectStore(_.storeNames[0]),function V(){for(++_._spinCount;_._waitingQueue.length;)_._waitingQueue.shift()();_._waitingFor&&(y.get(-1/0).onsuccess=V)}());var O=_._waitingFor;return new Je(function(V,J){I.then(function(ie){return _._waitingQueue.push(Fn(V.bind(null,ie)))},function(ie){return _._waitingQueue.push(Fn(J.bind(null,ie)))}).finally(function(){_._waitingFor===O&&(_._waitingFor=null)})})},Dr.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new te.Abort))},Dr.prototype.table=function(g){var y=this._memoizedTables||(this._memoizedTables={});if(d(y,g))return y[g];var _=this.schema[g];if(!_)throw new te.NotFound("Table "+g+" not part of transaction");return _=new this.db.Table(g,_,this),_.core=this.db.core.table(g),y[g]=_},Dr);function Dr(){}function b_(g,y,_,I,O,V,J){return{name:g,keyPath:y,unique:_,multi:I,auto:O,compound:V,src:(_&&!J?"&":"")+(I?"*":"")+(O?"++":"")+yB(y)}}function yB(g){return typeof g=="string"?g:g?"["+[].join.call(g,"+")+"]":""}function S_(g,y,_){return{name:g,primKey:y,indexes:_,mappedClass:null,idxByName:(I=function(O){return[O.name,O]},_.reduce(function(O,V,J){return J=I(V,J),J&&(O[J[0]]=J[1]),O},{}))};var I}var fp=function(g){try{return g.only([[]]),fp=function(){return[[]]},[[]]}catch{return fp=function(){return _u},_u}};function E_(g){return g==null?function(){}:typeof g=="string"?(y=g).split(".").length===1?function(_){return _[y]}:function(_){return E(_,y)}:function(_){return E(_,g)};var y}function wB(g){return[].slice.call(g)}var rCe=0;function pp(g){return g==null?":id":typeof g=="string"?g:"[".concat(g.join("+"),"]")}function aCe(g,y,ge){function I(Ce){if(Ce.type===3)return null;if(Ce.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var ve=Ce.lower,Ee=Ce.upper,De=Ce.lowerOpen,Ce=Ce.upperOpen;return ve===void 0?Ee===void 0?null:y.upperBound(Ee,!!Ce):Ee===void 0?y.lowerBound(ve,!!De):y.bound(ve,Ee,!!De,!!Ce)}function O(Fe){var ve,Ee=Fe.name;return{name:Ee,schema:Fe,mutate:function(De){var Ce=De.trans,Ae=De.type,Oe=De.keys,Ne=De.values,Ue=De.range;return new Promise(function(et,ft){et=Fn(et);var tt=Ce.objectStore(Ee),ot=tt.keyPath==null,gt=Ae==="put"||Ae==="add";if(!gt&&Ae!=="delete"&&Ae!=="deleteRange")throw new Error("Invalid operation type: "+Ae);var ct,bt=(Oe||Ne||{length:1}).length;if(Oe&&Ne&&Oe.length!==Ne.length)throw new Error("Given keys array must have same length as given values array.");if(bt===0)return et({numFailures:0,failures:{},results:[],lastResult:void 0});function jt(to){++Mo,dp(to)}var Xt=[],Jt=[],Mo=0;if(Ae==="deleteRange"){if(Ue.type===4)return et({numFailures:Mo,failures:Jt,results:[],lastResult:void 0});Ue.type===3?Xt.push(ct=tt.clear()):Xt.push(ct=tt.delete(I(Ue)))}else{var ot=gt?ot?[Ne,Oe]:[Ne,null]:[Oe,null],Ut=ot[0],Ks=ot[1];if(gt)for(var qs=0;qs<bt;++qs)Xt.push(ct=Ks&&Ks[qs]!==void 0?tt[Ae](Ut[qs],Ks[qs]):tt[Ae](Ut[qs])),ct.onerror=jt;else for(qs=0;qs<bt;++qs)Xt.push(ct=tt[Ae](Ut[qs])),ct.onerror=jt}function Vy(to){to=to.target.result,Xt.forEach(function(xu,H_){return xu.error!=null&&(Jt[H_]=xu.error)}),et({numFailures:Mo,failures:Jt,results:Ae==="delete"?Oe:Xt.map(function(xu){return xu.result}),lastResult:to})}ct.onerror=function(to){jt(to),Vy(to)},ct.onsuccess=Vy})},getMany:function(De){var Ce=De.trans,Ae=De.keys;return new Promise(function(Oe,Ne){Oe=Fn(Oe);for(var Ue,et=Ce.objectStore(Ee),ft=Ae.length,tt=new Array(ft),ot=0,gt=0,ct=function(Xt){Xt=Xt.target,tt[Xt._pos]=Xt.result,++gt===ot&&Oe(tt)},bt=Rr(Ne),jt=0;jt<ft;++jt)Ae[jt]!=null&&((Ue=et.get(Ae[jt]))._pos=jt,Ue.onsuccess=ct,Ue.onerror=bt,++ot);ot===0&&Oe(tt)})},get:function(De){var Ce=De.trans,Ae=De.key;return new Promise(function(Oe,Ne){Oe=Fn(Oe);var Ue=Ce.objectStore(Ee).get(Ae);Ue.onsuccess=function(et){return Oe(et.target.result)},Ue.onerror=Rr(Ne)})},query:(ve=we,function(De){return new Promise(function(Ce,Ae){Ce=Fn(Ce);var Oe,Ne,Ue,ot=De.trans,et=De.values,ft=De.limit,ct=De.query,tt=ft===1/0?void 0:ft,gt=ct.index,ct=ct.range,ot=ot.objectStore(Ee),gt=gt.isPrimaryKey?ot:ot.index(gt.name),ct=I(ct);if(ft===0)return Ce({result:[]});ve?((tt=et?gt.getAll(ct,tt):gt.getAllKeys(ct,tt)).onsuccess=function(bt){return Ce({result:bt.target.result})},tt.onerror=Rr(Ae)):(Oe=0,Ne=!et&&"openKeyCursor"in gt?gt.openKeyCursor(ct):gt.openCursor(ct),Ue=[],Ne.onsuccess=function(bt){var jt=Ne.result;return jt?(Ue.push(et?jt.value:jt.primaryKey),++Oe===ft?Ce({result:Ue}):void jt.continue()):Ce({result:Ue})},Ne.onerror=Rr(Ae))})}),openCursor:function(De){var Ce=De.trans,Ae=De.values,Oe=De.query,Ne=De.reverse,Ue=De.unique;return new Promise(function(et,ft){et=Fn(et);var gt=Oe.index,tt=Oe.range,ot=Ce.objectStore(Ee),ot=gt.isPrimaryKey?ot:ot.index(gt.name),gt=Ne?Ue?"prevunique":"prev":Ue?"nextunique":"next",ct=!Ae&&"openKeyCursor"in ot?ot.openKeyCursor(I(tt),gt):ot.openCursor(I(tt),gt);ct.onerror=Rr(ft),ct.onsuccess=Fn(function(bt){var jt,Xt,Jt,Mo,Ut=ct.result;Ut?(Ut.___id=++rCe,Ut.done=!1,jt=Ut.continue.bind(Ut),Xt=(Xt=Ut.continuePrimaryKey)&&Xt.bind(Ut),Jt=Ut.advance.bind(Ut),Mo=function(){throw new Error("Cursor not stopped")},Ut.trans=Ce,Ut.stop=Ut.continue=Ut.continuePrimaryKey=Ut.advance=function(){throw new Error("Cursor not started")},Ut.fail=Fn(ft),Ut.next=function(){var Ks=this,qs=1;return this.start(function(){return qs--?Ks.continue():Ks.stop()}).then(function(){return Ks})},Ut.start=function(Ks){function qs(){if(ct.result)try{Ks()}catch(to){Ut.fail(to)}else Ut.done=!0,Ut.start=function(){throw new Error("Cursor behind last entry")},Ut.stop()}var Vy=new Promise(function(to,xu){to=Fn(to),ct.onerror=Rr(xu),Ut.fail=xu,Ut.stop=function(H_){Ut.stop=Ut.continue=Ut.continuePrimaryKey=Ut.advance=Mo,to(H_)}});return ct.onsuccess=Fn(function(to){ct.onsuccess=qs,qs()}),Ut.continue=jt,Ut.continuePrimaryKey=Xt,Ut.advance=Jt,qs(),Vy},et(Ut)):et(null)},ft)})},count:function(De){var Ce=De.query,Ae=De.trans,Oe=Ce.index,Ne=Ce.range;return new Promise(function(Ue,et){var ft=Ae.objectStore(Ee),tt=Oe.isPrimaryKey?ft:ft.index(Oe.name),ft=I(Ne),tt=ft?tt.count(ft):tt.count();tt.onsuccess=Fn(function(ot){return Ue(ot.target.result)}),tt.onerror=Rr(et)})}}}var V,J,ie,_e=(J=ge,ie=wB((V=g).objectStoreNames),{schema:{name:V.name,tables:ie.map(function(Fe){return J.objectStore(Fe)}).map(function(Fe){var ve=Fe.keyPath,Ce=Fe.autoIncrement,Ee=a(ve),De={},Ce={name:Fe.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:ve==null,compound:Ee,keyPath:ve,autoIncrement:Ce,unique:!0,extractKey:E_(ve)},indexes:wB(Fe.indexNames).map(function(Ae){return Fe.index(Ae)}).map(function(Ue){var Oe=Ue.name,Ne=Ue.unique,et=Ue.multiEntry,Ue=Ue.keyPath,et={name:Oe,compound:a(Ue),keyPath:Ue,unique:Ne,multiEntry:et,extractKey:E_(Ue)};return De[pp(Ue)]=et}),getIndexByKeyPath:function(Ae){return De[pp(Ae)]}};return De[":id"]=Ce.primaryKey,ve!=null&&(De[pp(ve)]=Ce.primaryKey),Ce})},hasGetAll:0<ie.length&&"getAll"in J.objectStore(ie[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),ge=_e.schema,we=_e.hasGetAll,_e=ge.tables.map(O),le={};return _e.forEach(function(Fe){return le[Fe.name]=Fe}),{stack:"dbcore",transaction:g.transaction.bind(g),table:function(Fe){if(!le[Fe])throw new Error("Table '".concat(Fe,"' not found"));return le[Fe]},MIN_KEY:-1/0,MAX_KEY:fp(y),schema:ge}}function lCe(g,y,_,I){var O=_.IDBKeyRange;return _.indexedDB,{dbcore:(I=aCe(y,O,I),g.dbcore.reduce(function(V,J){return J=J.create,s(s({},V),J(V))},I))}}function Dy(g,I){var _=I.db,I=lCe(g._middlewares,_,g._deps,I);g.core=I.dbcore,g.tables.forEach(function(O){var V=O.name;g.core.schema.tables.some(function(J){return J.name===V})&&(O.core=g.core.table(V),g[V]instanceof g.Table&&(g[V].core=O.core))})}function Ty(g,y,_,I){_.forEach(function(O){var V=I[O];y.forEach(function(J){var ie=function ge(we,_e){return v(we,_e)||(we=u(we))&&ge(we,_e)}(J,O);(!ie||"value"in ie&&ie.value===void 0)&&(J===g.Transaction.prototype||J instanceof g.Transaction?p(J,O,{get:function(){return this.table(O)},set:function(ge){f(this,O,{value:ge,writable:!0,configurable:!0,enumerable:!0})}}):J[O]=new g.Table(O,V))})})}function __(g,y){y.forEach(function(_){for(var I in _)_[I]instanceof g.Table&&delete _[I]})}function uCe(g,y){return g._cfg.version-y._cfg.version}function cCe(g,y,_,I){var O=g._dbSchema;_.objectStoreNames.contains("$meta")&&!O.$meta&&(O.$meta=S_("$meta",bB("")[0],[]),g._storeNames.push("$meta"));var V=g._createTransaction("readwrite",g._storeNames,O);V.create(_),V._completion.catch(I);var J=V._reject.bind(V),ie=He.transless||He;As(function(){return He.trans=V,He.transless=ie,y!==0?(Dy(g,_),we=y,((ge=V).storeNames.includes("$meta")?ge.table("$meta").get("version").then(function(_e){return _e??we}):Je.resolve(we)).then(function(_e){return Fe=_e,ve=V,Ee=_,De=[],_e=(le=g)._versions,Ce=le._dbSchema=Fy(0,le.idbdb,Ee),(_e=_e.filter(function(Ae){return Ae._cfg.version>=Fe})).length!==0?(_e.forEach(function(Ae){De.push(function(){var Oe=Ce,Ne=Ae._cfg.dbschema;Iy(le,Oe,Ee),Iy(le,Ne,Ee),Ce=le._dbSchema=Ne;var Ue=R_(Oe,Ne);Ue.add.forEach(function(gt){D_(Ee,gt[0],gt[1].primKey,gt[1].indexes)}),Ue.change.forEach(function(gt){if(gt.recreate)throw new te.Upgrade("Not yet support for changing primary key");var ct=Ee.objectStore(gt.name);gt.add.forEach(function(bt){return xy(ct,bt)}),gt.change.forEach(function(bt){ct.deleteIndex(bt.name),xy(ct,bt)}),gt.del.forEach(function(bt){return ct.deleteIndex(bt)})});var et=Ae._cfg.contentUpgrade;if(et&&Ae._cfg.version>Fe){Dy(le,Ee),ve._memoizedTables={};var ft=k(Ne);Ue.del.forEach(function(gt){ft[gt]=Oe[gt]}),__(le,[le.Transaction.prototype]),Ty(le,[le.Transaction.prototype],r(ft),ft),ve.schema=ft;var tt,ot=Q(et);return ot&&ca(),Ue=Je.follow(function(){var gt;(tt=et(ve))&&ot&&(gt=Li.bind(null,null),tt.then(gt,gt))}),tt&&typeof tt.then=="function"?Je.resolve(tt):Ue.then(function(){return tt})}}),De.push(function(Oe){var Ne,Ue,et=Ae._cfg.dbschema;Ne=et,Ue=Oe,[].slice.call(Ue.db.objectStoreNames).forEach(function(ft){return Ne[ft]==null&&Ue.db.deleteObjectStore(ft)}),__(le,[le.Transaction.prototype]),Ty(le,[le.Transaction.prototype],le._storeNames,le._dbSchema),ve.schema=le._dbSchema}),De.push(function(Oe){le.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(le.idbdb.version/10)===Ae._cfg.version?(le.idbdb.deleteObjectStore("$meta"),delete le._dbSchema.$meta,le._storeNames=le._storeNames.filter(function(Ne){return Ne!=="$meta"})):Oe.objectStore("$meta").put(Ae._cfg.version,"version"))})}),function Ae(){return De.length?Je.resolve(De.shift()(ve.idbtrans)).then(Ae):Je.resolve()}().then(function(){CB(Ce,Ee)})):Je.resolve();var le,Fe,ve,Ee,De,Ce}).catch(J)):(r(O).forEach(function(_e){D_(_,_e,O[_e].primKey,O[_e].indexes)}),Dy(g,_),void Je.follow(function(){return g.on.populate.fire(V)}).catch(J));var ge,we})}function dCe(g,y){CB(g._dbSchema,y),y.db.version%10!=0||y.objectStoreNames.contains("$meta")||y.db.createObjectStore("$meta").add(Math.ceil(y.db.version/10-1),"version");var _=Fy(0,g.idbdb,y);Iy(g,g._dbSchema,y);for(var I=0,O=R_(_,g._dbSchema).change;I<O.length;I++){var V=function(J){if(J.change.length||J.recreate)return console.warn("Unable to patch indexes of table ".concat(J.name," because it has changes on the type of index or primary key.")),{value:void 0};var ie=y.objectStore(J.name);J.add.forEach(function(ge){me&&console.debug("Dexie upgrade patch: Creating missing index ".concat(J.name,".").concat(ge.src)),xy(ie,ge)})}(O[I]);if(typeof V=="object")return V.value}}function R_(g,y){var _,I={del:[],add:[],change:[]};for(_ in g)y[_]||I.del.push(_);for(_ in y){var O=g[_],V=y[_];if(O){var J={name:_,def:V,recreate:!1,del:[],add:[],change:[]};if(""+(O.primKey.keyPath||"")!=""+(V.primKey.keyPath||"")||O.primKey.auto!==V.primKey.auto)J.recreate=!0,I.change.push(J);else{var ie=O.idxByName,ge=V.idxByName,we=void 0;for(we in ie)ge[we]||J.del.push(we);for(we in ge){var _e=ie[we],le=ge[we];_e?_e.src!==le.src&&J.change.push(le):J.add.push(le)}(0<J.del.length||0<J.add.length||0<J.change.length)&&I.change.push(J)}}else I.add.push([_,V])}return I}function D_(g,y,_,I){var O=g.db.createObjectStore(y,_.keyPath?{keyPath:_.keyPath,autoIncrement:_.auto}:{autoIncrement:_.auto});return I.forEach(function(V){return xy(O,V)}),O}function CB(g,y){r(g).forEach(function(_){y.db.objectStoreNames.contains(_)||(me&&console.debug("Dexie: Creating missing table",_),D_(y,_,g[_].primKey,g[_].indexes))})}function xy(g,y){g.createIndex(y.name,y.keyPath,{unique:y.unique,multiEntry:y.multi})}function Fy(g,y,_){var I={};return b(y.objectStoreNames,0).forEach(function(O){for(var V=_.objectStore(O),J=b_(yB(we=V.keyPath),we||"",!0,!1,!!V.autoIncrement,we&&typeof we!="string",!0),ie=[],ge=0;ge<V.indexNames.length;++ge){var _e=V.index(V.indexNames[ge]),we=_e.keyPath,_e=b_(_e.name,we,!!_e.unique,!!_e.multiEntry,!1,we&&typeof we!="string",!1);ie.push(_e)}I[O]=S_(O,J,ie)}),I}function Iy(g,y,_){for(var I=_.db.objectStoreNames,O=0;O<I.length;++O){var V=I[O],J=_.objectStore(V);g._hasGetAll="getAll"in J;for(var ie=0;ie<J.indexNames.length;++ie){var ge=J.indexNames[ie],we=J.index(ge).keyPath,_e=typeof we=="string"?we:"["+b(we).join("+")+"]";!y[V]||(we=y[V].idxByName[_e])&&(we.name=ge,delete y[V].idxByName[_e],y[V].idxByName[ge]=we)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(g._hasGetAll=!1)}function bB(g){return g.split(",").map(function(y,_){var I=(y=y.trim()).replace(/([&*]|\+\+)/g,""),O=/^\[/.test(I)?I.match(/^\[(.*)\]$/)[1].split("+"):I;return b_(I,O||null,/\&/.test(y),/\*/.test(y),/\+\+/.test(y),a(O),_===0)})}var hCe=(Py.prototype._parseStoresSpec=function(g,y){r(g).forEach(function(_){if(g[_]!==null){var I=bB(g[_]),O=I.shift();if(O.unique=!0,O.multi)throw new te.Schema("Primary key cannot be multi-valued");I.forEach(function(V){if(V.auto)throw new te.Schema("Only primary key can be marked as autoIncrement (++)");if(!V.keyPath)throw new te.Schema("Index must have a name and cannot be an empty string")}),y[_]=S_(_,O,I)}})},Py.prototype.stores=function(_){var y=this.db;this._cfg.storesSource=this._cfg.storesSource?l(this._cfg.storesSource,_):_;var _=y._versions,I={},O={};return _.forEach(function(V){l(I,V._cfg.storesSource),O=V._cfg.dbschema={},V._parseStoresSpec(I,O)}),y._dbSchema=O,__(y,[y._allTables,y,y.Transaction.prototype]),Ty(y,[y._allTables,y,y.Transaction.prototype,this._cfg.tables],r(O),O),y._storeNames=r(O),this},Py.prototype.upgrade=function(g){return this._cfg.contentUpgrade=X(this._cfg.contentUpgrade||Ge,g),this},Py);function Py(){}function T_(g,y){var _=g._dbNamesDB;return _||(_=g._dbNamesDB=new ga(by,{addons:[],indexedDB:g,IDBKeyRange:y})).version(1).stores({dbnames:"name"}),_.table("dbnames")}function x_(g){return g&&typeof g.databases=="function"}function F_(g){return As(function(){return He.letThrough=!0,g()})}function I_(g){return!("from"in g)}var js=function(g,y){if(!this){var _=new js;return g&&"d"in g&&l(_,g),_}l(this,arguments.length?{d:1,from:g,to:1<arguments.length?y:g}:{d:0})};function gp(g,y,_){var I=en(y,_);if(!isNaN(I)){if(0<I)throw RangeError();if(I_(g))return l(g,{from:y,to:_,d:1});var O=g.l,I=g.r;if(en(_,g.from)<0)return O?gp(O,y,_):g.l={from:y,to:_,d:1,l:null,r:null},EB(g);if(0<en(y,g.to))return I?gp(I,y,_):g.r={from:y,to:_,d:1,l:null,r:null},EB(g);en(y,g.from)<0&&(g.from=y,g.l=null,g.d=I?I.d+1:1),0<en(_,g.to)&&(g.to=_,g.r=null,g.d=g.l?g.l.d+1:1),_=!g.r,O&&!g.l&&mp(g,O),I&&_&&mp(g,I)}}function mp(g,y){I_(y)||function _(I,ge){var V=ge.from,J=ge.to,ie=ge.l,ge=ge.r;gp(I,V,J),ie&&_(I,ie),ge&&_(I,ge)}(g,y)}function SB(g,y){var _=Ay(y),I=_.next();if(I.done)return!1;for(var O=I.value,V=Ay(g),J=V.next(O.from),ie=J.value;!I.done&&!J.done;){if(en(ie.from,O.to)<=0&&0<=en(ie.to,O.from))return!0;en(O.from,ie.from)<0?O=(I=_.next(ie.from)).value:ie=(J=V.next(O.from)).value}return!1}function Ay(g){var y=I_(g)?null:{s:0,n:g};return{next:function(_){for(var I=0<arguments.length;y;)switch(y.s){case 0:if(y.s=1,I)for(;y.n.l&&en(_,y.n.from)<0;)y={up:y,n:y.n.l,s:1};else for(;y.n.l;)y={up:y,n:y.n.l,s:1};case 1:if(y.s=2,!I||en(_,y.n.to)<=0)return{value:y.n,done:!1};case 2:if(y.n.r){y.s=3,y={up:y,n:y.n.r,s:0};continue}case 3:y=y.up}return{done:!0}}}}function EB(g){var y,_,I=(((y=g.r)===null||y===void 0?void 0:y.d)||0)-(((_=g.l)===null||_===void 0?void 0:_.d)||0),O=1<I?"r":I<-1?"l":"";O&&(y=O=="r"?"l":"r",_=s({},g),I=g[O],g.from=I.from,g.to=I.to,g[O]=I[O],_[O]=I[y],(g[y]=_).d=_B(_)),g.d=_B(g)}function _B(_){var y=_.r,_=_.l;return(y?_?Math.max(y.d,_.d):y.d:_?_.d:0)+1}function ky(g,y){return r(y).forEach(function(_){g[_]?mp(g[_],y[_]):g[_]=function I(O){var V,J,ie={};for(V in O)d(O,V)&&(J=O[V],ie[V]=!J||typeof J!="object"||D.has(J.constructor)?J:I(J));return ie}(y[_])}),g}function P_(g,y){return g.all||y.all||Object.keys(g).some(function(_){return y[_]&&SB(y[_],g[_])})}h(js.prototype,((ui={add:function(g){return mp(this,g),this},addKey:function(g){return gp(this,g,g),this},addKeys:function(g){var y=this;return g.forEach(function(_){return gp(y,_,_)}),this},hasKey:function(g){var y=Ay(this).next(g).value;return y&&en(y.from,g)<=0&&0<=en(y.to,g)}})[B]=function(){return Ay(this)},ui));var Du={},A_={},k_=!1;function Oy(g){ky(A_,g),k_||(k_=!0,setTimeout(function(){k_=!1,O_(A_,!(A_={}))},0))}function O_(g,y){y===void 0&&(y=!1);var _=new Set;if(g.all)for(var I=0,O=Object.values(Du);I<O.length;I++)RB(J=O[I],g,_,y);else for(var V in g){var J,ie=/^idb\:\/\/(.*)\/(.*)\//.exec(V);ie&&(V=ie[1],ie=ie[2],(J=Du["idb://".concat(V,"/").concat(ie)])&&RB(J,g,_,y))}_.forEach(function(ge){return ge()})}function RB(g,y,_,I){for(var O=[],V=0,J=Object.entries(g.queries.query);V<J.length;V++){for(var ie=J[V],ge=ie[0],we=[],_e=0,le=ie[1];_e<le.length;_e++){var Fe=le[_e];P_(y,Fe.obsSet)?Fe.subscribers.forEach(function(Ce){return _.add(Ce)}):I&&we.push(Fe)}I&&O.push([ge,we])}if(I)for(var ve=0,Ee=O;ve<Ee.length;ve++){var De=Ee[ve],ge=De[0],we=De[1];g.queries.query[ge]=we}}function fCe(g){var y=g._state,_=g._deps.indexedDB;if(y.isBeingOpened||g.idbdb)return y.dbReadyPromise.then(function(){return y.dbOpenError?ss(y.dbOpenError):g});y.isBeingOpened=!0,y.dbOpenError=null,y.openComplete=!1;var I=y.openCanceller,O=Math.round(10*g.verno),V=!1;function J(){if(y.openCanceller!==I)throw new te.DatabaseClosed("db.open() was cancelled")}function ie(){return new Je(function(Fe,ve){if(J(),!_)throw new te.MissingAPI;var Ee=g.name,De=y.autoSchema||!O?_.open(Ee):_.open(Ee,O);if(!De)throw new te.MissingAPI;De.onerror=Rr(ve),De.onblocked=Fn(g._fireOnBlocked),De.onupgradeneeded=Fn(function(Ce){var Ae;_e=De.transaction,y.autoSchema&&!g._options.allowEmptyDB?(De.onerror=dp,_e.abort(),De.result.close(),(Ae=_.deleteDatabase(Ee)).onsuccess=Ae.onerror=Fn(function(){ve(new te.NoSuchDatabase("Database ".concat(Ee," doesnt exist")))})):(_e.onerror=Rr(ve),Ce=Ce.oldVersion>Math.pow(2,62)?0:Ce.oldVersion,le=Ce<1,g.idbdb=De.result,V&&dCe(g,_e),cCe(g,Ce/10,_e,ve))},ve),De.onsuccess=Fn(function(){_e=null;var Ce,Ae,Oe,Ne,Ue,et=g.idbdb=De.result,ft=b(et.objectStoreNames);if(0<ft.length)try{var tt=et.transaction((Ne=ft).length===1?Ne[0]:Ne,"readonly");if(y.autoSchema)Ae=et,Oe=tt,(Ce=g).verno=Ae.version/10,Oe=Ce._dbSchema=Fy(0,Ae,Oe),Ce._storeNames=b(Ae.objectStoreNames,0),Ty(Ce,[Ce._allTables],r(Oe),Oe);else if(Iy(g,g._dbSchema,tt),((Ue=R_(Fy(0,(Ue=g).idbdb,tt),Ue._dbSchema)).add.length||Ue.change.some(function(ot){return ot.add.length||ot.change.length}))&&!V)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),et.close(),O=et.version+1,V=!0,Fe(ie());Dy(g,tt)}catch{}Ed.push(g),et.onversionchange=Fn(function(ot){y.vcFired=!0,g.on("versionchange").fire(ot)}),et.onclose=Fn(function(ot){g.on("close").fire(ot)}),le&&(Ue=g._deps,tt=Ee,et=Ue.indexedDB,Ue=Ue.IDBKeyRange,x_(et)||tt===by||T_(et,Ue).put({name:tt}).catch(Ge)),Fe()},ve)}).catch(function(Fe){switch(Fe==null?void 0:Fe.name){case"UnknownError":if(0<y.PR1398_maxLoop)return y.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),ie();break;case"VersionError":if(0<O)return O=0,ie()}return Je.reject(Fe)})}var ge,we=y.dbReadyResolve,_e=null,le=!1;return Je.race([I,(typeof navigator>"u"?Je.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Fe){function ve(){return indexedDB.databases().finally(Fe)}ge=setInterval(ve,100),ve()}).finally(function(){return clearInterval(ge)}):Promise.resolve()).then(ie)]).then(function(){return J(),y.onReadyBeingFired=[],Je.resolve(F_(function(){return g.on.ready.fire(g.vip)})).then(function Fe(){if(0<y.onReadyBeingFired.length){var ve=y.onReadyBeingFired.reduce(X,Ge);return y.onReadyBeingFired=[],Je.resolve(F_(function(){return ve(g.vip)})).then(Fe)}})}).finally(function(){y.openCanceller===I&&(y.onReadyBeingFired=null,y.isBeingOpened=!1)}).catch(function(Fe){y.dbOpenError=Fe;try{_e&&_e.abort()}catch{}return I===y.openCanceller&&g._close(),ss(Fe)}).finally(function(){y.openComplete=!0,we()}).then(function(){var Fe;return le&&(Fe={},g.tables.forEach(function(ve){ve.schema.indexes.forEach(function(Ee){Ee.name&&(Fe["idb://".concat(g.name,"/").concat(ve.name,"/").concat(Ee.name)]=new js(-1/0,[[[]]]))}),Fe["idb://".concat(g.name,"/").concat(ve.name,"/")]=Fe["idb://".concat(g.name,"/").concat(ve.name,"/:dels")]=new js(-1/0,[[[]]])}),cl(hp).fire(Fe),O_(Fe,!0)),g})}function M_(g){function y(V){return g.next(V)}var _=O(y),I=O(function(V){return g.throw(V)});function O(V){return function(ge){var ie=V(ge),ge=ie.value;return ie.done?ge:ge&&typeof ge.then=="function"?ge.then(_,I):a(ge)?Promise.all(ge).then(_,I):_(ge)}}return O(y)()}function My(g,y,_){for(var I=a(g)?g.slice():[g],O=0;O<_;++O)I.push(y);return I}var pCe={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(g){return s(s({},g),{table:function(y){var _=g.table(y),I=_.schema,O={},V=[];function J(le,Fe,ve){var Ee=pp(le),De=O[Ee]=O[Ee]||[],Ce=le==null?0:typeof le=="string"?1:le.length,Ae=0<Fe,Ae=s(s({},ve),{name:Ae?"".concat(Ee,"(virtual-from:").concat(ve.name,")"):ve.name,lowLevelIndex:ve,isVirtual:Ae,keyTail:Fe,keyLength:Ce,extractKey:E_(le),unique:!Ae&&ve.unique});return De.push(Ae),Ae.isPrimaryKey||V.push(Ae),1<Ce&&J(Ce===2?le[0]:le.slice(0,Ce-1),Fe+1,ve),De.sort(function(Oe,Ne){return Oe.keyTail-Ne.keyTail}),Ae}y=J(I.primaryKey.keyPath,0,I.primaryKey),O[":id"]=[y];for(var ie=0,ge=I.indexes;ie<ge.length;ie++){var we=ge[ie];J(we.keyPath,0,we)}function _e(le){var Fe,ve=le.query.index;return ve.isVirtual?s(s({},le),{query:{index:ve.lowLevelIndex,range:(Fe=le.query.range,ve=ve.keyTail,{type:Fe.type===1?2:Fe.type,lower:My(Fe.lower,Fe.lowerOpen?g.MAX_KEY:g.MIN_KEY,ve),lowerOpen:!0,upper:My(Fe.upper,Fe.upperOpen?g.MIN_KEY:g.MAX_KEY,ve),upperOpen:!0})}}):le}return s(s({},_),{schema:s(s({},I),{primaryKey:y,indexes:V,getIndexByKeyPath:function(le){return(le=O[pp(le)])&&le[0]}}),count:function(le){return _.count(_e(le))},query:function(le){return _.query(_e(le))},openCursor:function(le){var Fe=le.query.index,ve=Fe.keyTail,Ee=Fe.isVirtual,De=Fe.keyLength;return Ee?_.openCursor(_e(le)).then(function(Ae){return Ae&&Ce(Ae)}):_.openCursor(le);function Ce(Ae){return Object.create(Ae,{continue:{value:function(Oe){Oe!=null?Ae.continue(My(Oe,le.reverse?g.MAX_KEY:g.MIN_KEY,ve)):le.unique?Ae.continue(Ae.key.slice(0,De).concat(le.reverse?g.MIN_KEY:g.MAX_KEY,ve)):Ae.continue()}},continuePrimaryKey:{value:function(Oe,Ne){Ae.continuePrimaryKey(My(Oe,g.MAX_KEY,ve),Ne)}},primaryKey:{get:function(){return Ae.primaryKey}},key:{get:function(){var Oe=Ae.key;return De===1?Oe[0]:Oe.slice(0,De)}},value:{get:function(){return Ae.value}}})}}})}})}};function N_(g,y,_,I){return _=_||{},I=I||"",r(g).forEach(function(O){var V,J,ie;d(y,O)?(V=g[O],J=y[O],typeof V=="object"&&typeof J=="object"&&V&&J?(ie=Z(V))!==Z(J)?_[I+O]=y[O]:ie==="Object"?N_(V,J,_,I+O+"."):V!==J&&(_[I+O]=y[O]):V!==J&&(_[I+O]=y[O])):_[I+O]=void 0}),r(y).forEach(function(O){d(g,O)||(_[I+O]=y[O])}),_}function L_(g,y){return y.type==="delete"?y.keys:y.keys||y.values.map(g.extractKey)}var gCe={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(g){return s(s({},g),{table:function(y){var _=g.table(y),I=_.schema.primaryKey;return s(s({},_),{mutate:function(O){var V=He.trans,J=V.table(y).hook,ie=J.deleting,ge=J.creating,we=J.updating;switch(O.type){case"add":if(ge.fire===Ge)break;return V._promise("readwrite",function(){return _e(O)},!0);case"put":if(ge.fire===Ge&&we.fire===Ge)break;return V._promise("readwrite",function(){return _e(O)},!0);case"delete":if(ie.fire===Ge)break;return V._promise("readwrite",function(){return _e(O)},!0);case"deleteRange":if(ie.fire===Ge)break;return V._promise("readwrite",function(){return function le(Fe,ve,Ee){return _.query({trans:Fe,values:!1,query:{index:I,range:ve},limit:Ee}).then(function(De){var Ce=De.result;return _e({type:"delete",keys:Ce,trans:Fe}).then(function(Ae){return 0<Ae.numFailures?Promise.reject(Ae.failures[0]):Ce.length<Ee?{failures:[],numFailures:0,lastResult:void 0}:le(Fe,s(s({},ve),{lower:Ce[Ce.length-1],lowerOpen:!0}),Ee)})})}(O.trans,O.range,1e4)},!0)}return _.mutate(O);function _e(le){var Fe,ve,Ee,De=He.trans,Ce=le.keys||L_(I,le);if(!Ce)throw new Error("Keys missing");return(le=le.type==="add"||le.type==="put"?s(s({},le),{keys:Ce}):s({},le)).type!=="delete"&&(le.values=o([],le.values)),le.keys&&(le.keys=o([],le.keys)),Fe=_,Ee=Ce,((ve=le).type==="add"?Promise.resolve([]):Fe.getMany({trans:ve.trans,keys:Ee,cache:"immutable"})).then(function(Ae){var Oe=Ce.map(function(Ne,Ue){var et,ft,tt,ot=Ae[Ue],gt={onerror:null,onsuccess:null};return le.type==="delete"?ie.fire.call(gt,Ne,ot,De):le.type==="add"||ot===void 0?(et=ge.fire.call(gt,Ne,le.values[Ue],De),Ne==null&&et!=null&&(le.keys[Ue]=Ne=et,I.outbound||T(le.values[Ue],I.keyPath,Ne))):(et=N_(ot,le.values[Ue]),(ft=we.fire.call(gt,et,Ne,ot,De))&&(tt=le.values[Ue],Object.keys(ft).forEach(function(ct){d(tt,ct)?tt[ct]=ft[ct]:T(tt,ct,ft[ct])}))),gt});return _.mutate(le).then(function(Ne){for(var Ue=Ne.failures,et=Ne.results,ft=Ne.numFailures,Ne=Ne.lastResult,tt=0;tt<Ce.length;++tt){var ot=(et||Ce)[tt],gt=Oe[tt];ot==null?gt.onerror&&gt.onerror(Ue[tt]):gt.onsuccess&&gt.onsuccess(le.type==="put"&&Ae[tt]?le.values[tt]:ot)}return{failures:Ue,results:et,numFailures:ft,lastResult:Ne}}).catch(function(Ne){return Oe.forEach(function(Ue){return Ue.onerror&&Ue.onerror(Ne)}),Promise.reject(Ne)})})}}})}})}};function DB(g,y,_){try{if(!y||y.keys.length<g.length)return null;for(var I=[],O=0,V=0;O<y.keys.length&&V<g.length;++O)en(y.keys[O],g[V])===0&&(I.push(_?P(y.values[O]):y.values[O]),++V);return I.length===g.length?I:null}catch{return null}}var mCe={stack:"dbcore",level:-1,create:function(g){return{table:function(y){var _=g.table(y);return s(s({},_),{getMany:function(I){if(!I.cache)return _.getMany(I);var O=DB(I.keys,I.trans._cache,I.cache==="clone");return O?Je.resolve(O):_.getMany(I).then(function(V){return I.trans._cache={keys:I.keys,values:I.cache==="clone"?P(V):V},V})},mutate:function(I){return I.type!=="add"&&(I.trans._cache=null),_.mutate(I)}})}}}};function TB(g,y){return g.trans.mode==="readonly"&&!!g.subscr&&!g.trans.explicit&&g.trans.db._options.cache!=="disabled"&&!y.schema.primaryKey.outbound}function xB(g,y){switch(g){case"query":return y.values&&!y.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var vCe={stack:"dbcore",level:0,name:"Observability",create:function(g){var y=g.schema.name,_=new js(g.MIN_KEY,g.MAX_KEY);return s(s({},g),{transaction:function(I,O,V){if(He.subscr&&O!=="readonly")throw new te.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(He.querier));return g.transaction(I,O,V)},table:function(I){var O=g.table(I),V=O.schema,J=V.primaryKey,le=V.indexes,ie=J.extractKey,ge=J.outbound,we=J.autoIncrement&&le.filter(function(ve){return ve.compound&&ve.keyPath.includes(J.keyPath)}),_e=s(s({},O),{mutate:function(ve){function Ee(ct){return ct="idb://".concat(y,"/").concat(I,"/").concat(ct),Ne[ct]||(Ne[ct]=new js)}var De,Ce,Ae,Oe=ve.trans,Ne=ve.mutatedParts||(ve.mutatedParts={}),Ue=Ee(""),et=Ee(":dels"),ft=ve.type,gt=ve.type==="deleteRange"?[ve.range]:ve.type==="delete"?[ve.keys]:ve.values.length<50?[L_(J,ve).filter(function(ct){return ct}),ve.values]:[],tt=gt[0],ot=gt[1],gt=ve.trans._cache;return a(tt)?(Ue.addKeys(tt),(gt=ft==="delete"||tt.length===ot.length?DB(tt,gt):null)||et.addKeys(tt),(gt||ot)&&(De=Ee,Ce=gt,Ae=ot,V.indexes.forEach(function(ct){var bt=De(ct.name||"");function jt(Jt){return Jt!=null?ct.extractKey(Jt):null}function Xt(Jt){return ct.multiEntry&&a(Jt)?Jt.forEach(function(Mo){return bt.addKey(Mo)}):bt.addKey(Jt)}(Ce||Ae).forEach(function(Jt,Ks){var Ut=Ce&&jt(Ce[Ks]),Ks=Ae&&jt(Ae[Ks]);en(Ut,Ks)!==0&&(Ut!=null&&Xt(Ut),Ks!=null&&Xt(Ks))})}))):tt?(ot={from:(ot=tt.lower)!==null&&ot!==void 0?ot:g.MIN_KEY,to:(ot=tt.upper)!==null&&ot!==void 0?ot:g.MAX_KEY},et.add(ot),Ue.add(ot)):(Ue.add(_),et.add(_),V.indexes.forEach(function(ct){return Ee(ct.name).add(_)})),O.mutate(ve).then(function(ct){return!tt||ve.type!=="add"&&ve.type!=="put"||(Ue.addKeys(ct.results),we&&we.forEach(function(bt){for(var jt=ve.values.map(function(Ut){return bt.extractKey(Ut)}),Xt=bt.keyPath.findIndex(function(Ut){return Ut===J.keyPath}),Jt=0,Mo=ct.results.length;Jt<Mo;++Jt)jt[Jt][Xt]=ct.results[Jt];Ee(bt.name).addKeys(jt)})),Oe.mutatedParts=ky(Oe.mutatedParts||{},Ne),ct})}}),le=function(Ee){var De=Ee.query,Ee=De.index,De=De.range;return[Ee,new js((Ee=De.lower)!==null&&Ee!==void 0?Ee:g.MIN_KEY,(De=De.upper)!==null&&De!==void 0?De:g.MAX_KEY)]},Fe={get:function(ve){return[J,new js(ve.key)]},getMany:function(ve){return[J,new js().addKeys(ve.keys)]},count:le,query:le,openCursor:le};return r(Fe).forEach(function(ve){_e[ve]=function(Ee){var De=He.subscr,Ce=!!De,Ae=TB(He,O)&&xB(ve,Ee)?Ee.obsSet={}:De;if(Ce){var Oe=function(ot){return ot="idb://".concat(y,"/").concat(I,"/").concat(ot),Ae[ot]||(Ae[ot]=new js)},Ne=Oe(""),Ue=Oe(":dels"),De=Fe[ve](Ee),Ce=De[0],De=De[1];if((ve==="query"&&Ce.isPrimaryKey&&!Ee.values?Ue:Oe(Ce.name||"")).add(De),!Ce.isPrimaryKey){if(ve!=="count"){var et=ve==="query"&&ge&&Ee.values&&O.query(s(s({},Ee),{values:!1}));return O[ve].apply(this,arguments).then(function(ot){if(ve==="query"){if(ge&&Ee.values)return et.then(function(jt){return jt=jt.result,Ne.addKeys(jt),ot});var gt=Ee.values?ot.result.map(ie):ot.result;(Ee.values?Ne:Ue).addKeys(gt)}else if(ve==="openCursor"){var ct=ot,bt=Ee.values;return ct&&Object.create(ct,{key:{get:function(){return Ue.addKey(ct.primaryKey),ct.key}},primaryKey:{get:function(){var jt=ct.primaryKey;return Ue.addKey(jt),jt}},value:{get:function(){return bt&&Ne.addKey(ct.primaryKey),ct.value}}})}return ot})}Ue.add(_)}}return O[ve].apply(this,arguments)}}),_e}})}};function FB(g,y,_){if(_.numFailures===0)return y;if(y.type==="deleteRange")return null;var I=y.keys?y.keys.length:"values"in y&&y.values?y.values.length:1;return _.numFailures===I?null:(y=s({},y),a(y.keys)&&(y.keys=y.keys.filter(function(O,V){return!(V in _.failures)})),"values"in y&&a(y.values)&&(y.values=y.values.filter(function(O,V){return!(V in _.failures)})),y)}function V_(g,y){return _=g,((I=y).lower===void 0||(I.lowerOpen?0<en(_,I.lower):0<=en(_,I.lower)))&&(g=g,(y=y).upper===void 0||(y.upperOpen?en(g,y.upper)<0:en(g,y.upper)<=0));var _,I}function IB(g,y,Fe,I,O,V){if(!Fe||Fe.length===0)return g;var J=y.query.index,ie=J.multiEntry,ge=y.query.range,we=I.schema.primaryKey.extractKey,_e=J.extractKey,le=(J.lowLevelIndex||J).extractKey,Fe=Fe.reduce(function(ve,Ee){var De=ve,Ce=[];if(Ee.type==="add"||Ee.type==="put")for(var Ae=new js,Oe=Ee.values.length-1;0<=Oe;--Oe){var Ne,Ue=Ee.values[Oe],et=we(Ue);Ae.hasKey(et)||(Ne=_e(Ue),(ie&&a(Ne)?Ne.some(function(ct){return V_(ct,ge)}):V_(Ne,ge))&&(Ae.addKey(et),Ce.push(Ue)))}switch(Ee.type){case"add":var ft=new js().addKeys(y.values?ve.map(function(bt){return we(bt)}):ve),De=ve.concat(y.values?Ce.filter(function(bt){return bt=we(bt),!ft.hasKey(bt)&&(ft.addKey(bt),!0)}):Ce.map(function(bt){return we(bt)}).filter(function(bt){return!ft.hasKey(bt)&&(ft.addKey(bt),!0)}));break;case"put":var tt=new js().addKeys(Ee.values.map(function(bt){return we(bt)}));De=ve.filter(function(bt){return!tt.hasKey(y.values?we(bt):bt)}).concat(y.values?Ce:Ce.map(function(bt){return we(bt)}));break;case"delete":var ot=new js().addKeys(Ee.keys);De=ve.filter(function(bt){return!ot.hasKey(y.values?we(bt):bt)});break;case"deleteRange":var gt=Ee.range;De=ve.filter(function(bt){return!V_(we(bt),gt)})}return De},g);return Fe===g?g:(Fe.sort(function(ve,Ee){return en(le(ve),le(Ee))||en(we(ve),we(Ee))}),y.limit&&y.limit<1/0&&(Fe.length>y.limit?Fe.length=y.limit:g.length===y.limit&&Fe.length<y.limit&&(O.dirty=!0)),V?Object.freeze(Fe):Fe)}function PB(g,y){return en(g.lower,y.lower)===0&&en(g.upper,y.upper)===0&&!!g.lowerOpen==!!y.lowerOpen&&!!g.upperOpen==!!y.upperOpen}function yCe(g,y){return function(_,I,O,V){if(_===void 0)return I!==void 0?-1:0;if(I===void 0)return 1;if((I=en(_,I))===0){if(O&&V)return 0;if(O)return 1;if(V)return-1}return I}(g.lower,y.lower,g.lowerOpen,y.lowerOpen)<=0&&0<=function(_,I,O,V){if(_===void 0)return I!==void 0?1:0;if(I===void 0)return-1;if((I=en(_,I))===0){if(O&&V)return 0;if(O)return-1;if(V)return 1}return I}(g.upper,y.upper,g.upperOpen,y.upperOpen)}function wCe(g,y,_,I){g.subscribers.add(_),I.addEventListener("abort",function(){var O,V;g.subscribers.delete(_),g.subscribers.size===0&&(O=g,V=y,setTimeout(function(){O.subscribers.size===0&&K(V,O)},3e3))})}var CCe={stack:"dbcore",level:0,name:"Cache",create:function(g){var y=g.schema.name;return s(s({},g),{transaction:function(_,I,O){var V,J,ie=g.transaction(_,I,O);return I==="readwrite"&&(J=(V=new AbortController).signal,O=function(ge){return function(){if(V.abort(),I==="readwrite"){for(var we=new Set,_e=0,le=_;_e<le.length;_e++){var Fe=le[_e],ve=Du["idb://".concat(y,"/").concat(Fe)];if(ve){var Ee=g.table(Fe),De=ve.optimisticOps.filter(function(bt){return bt.trans===ie});if(ie._explicit&&ge&&ie.mutatedParts)for(var Ce=0,Ae=Object.values(ve.queries.query);Ce<Ae.length;Ce++)for(var Oe=0,Ne=(ft=Ae[Ce]).slice();Oe<Ne.length;Oe++)P_((tt=Ne[Oe]).obsSet,ie.mutatedParts)&&(K(ft,tt),tt.subscribers.forEach(function(bt){return we.add(bt)}));else if(0<De.length){ve.optimisticOps=ve.optimisticOps.filter(function(bt){return bt.trans!==ie});for(var Ue=0,et=Object.values(ve.queries.query);Ue<et.length;Ue++)for(var ft,tt,ot,gt=0,ct=(ft=et[Ue]).slice();gt<ct.length;gt++)(tt=ct[gt]).res!=null&&ie.mutatedParts&&(ge&&!tt.dirty?(ot=Object.isFrozen(tt.res),ot=IB(tt.res,tt.req,De,Ee,tt,ot),tt.dirty?(K(ft,tt),tt.subscribers.forEach(function(bt){return we.add(bt)})):ot!==tt.res&&(tt.res=ot,tt.promise=Je.resolve({result:ot}))):(tt.dirty&&K(ft,tt),tt.subscribers.forEach(function(bt){return we.add(bt)})))}}}we.forEach(function(bt){return bt()})}}},ie.addEventListener("abort",O(!1),{signal:J}),ie.addEventListener("error",O(!1),{signal:J}),ie.addEventListener("complete",O(!0),{signal:J})),ie},table:function(_){var I=g.table(_),O=I.schema.primaryKey;return s(s({},I),{mutate:function(V){var J=He.trans;if(O.outbound||J.db._options.cache==="disabled"||J.explicit||J.idbtrans.mode!=="readwrite")return I.mutate(V);var ie=Du["idb://".concat(y,"/").concat(_)];return ie?(J=I.mutate(V),V.type!=="add"&&V.type!=="put"||!(50<=V.values.length||L_(O,V).some(function(ge){return ge==null}))?(ie.optimisticOps.push(V),V.mutatedParts&&Oy(V.mutatedParts),J.then(function(ge){0<ge.numFailures&&(K(ie.optimisticOps,V),(ge=FB(0,V,ge))&&ie.optimisticOps.push(ge),V.mutatedParts&&Oy(V.mutatedParts))}),J.catch(function(){K(ie.optimisticOps,V),V.mutatedParts&&Oy(V.mutatedParts)})):J.then(function(ge){var we=FB(0,s(s({},V),{values:V.values.map(function(_e,le){var Fe;return ge.failures[le]?_e:(_e=(Fe=O.keyPath)!==null&&Fe!==void 0&&Fe.includes(".")?P(_e):s({},_e),T(_e,O.keyPath,ge.results[le]),_e)})}),ge);ie.optimisticOps.push(we),queueMicrotask(function(){return V.mutatedParts&&Oy(V.mutatedParts)})}),J):I.mutate(V)},query:function(V){if(!TB(He,I)||!xB("query",V))return I.query(V);var J=((we=He.trans)===null||we===void 0?void 0:we.db._options.cache)==="immutable",le=He,ie=le.requery,ge=le.signal,we=function(Ee,De,Ce,Ae){var Oe=Du["idb://".concat(Ee,"/").concat(De)];if(!Oe)return[];if(!(De=Oe.queries[Ce]))return[null,!1,Oe,null];var Ne=De[(Ae.query?Ae.query.index.name:null)||""];if(!Ne)return[null,!1,Oe,null];switch(Ce){case"query":var Ue=Ne.find(function(et){return et.req.limit===Ae.limit&&et.req.values===Ae.values&&PB(et.req.query.range,Ae.query.range)});return Ue?[Ue,!0,Oe,Ne]:[Ne.find(function(et){return("limit"in et.req?et.req.limit:1/0)>=Ae.limit&&(!Ae.values||et.req.values)&&yCe(et.req.query.range,Ae.query.range)}),!1,Oe,Ne];case"count":return Ue=Ne.find(function(et){return PB(et.req.query.range,Ae.query.range)}),[Ue,!!Ue,Oe,Ne]}}(y,_,"query",V),_e=we[0],le=we[1],Fe=we[2],ve=we[3];return _e&&le?_e.obsSet=V.obsSet:(le=I.query(V).then(function(Ee){var De=Ee.result;if(_e&&(_e.res=De),J){for(var Ce=0,Ae=De.length;Ce<Ae;++Ce)Object.freeze(De[Ce]);Object.freeze(De)}else Ee.result=P(De);return Ee}).catch(function(Ee){return ve&&_e&&K(ve,_e),Promise.reject(Ee)}),_e={obsSet:V.obsSet,promise:le,subscribers:new Set,type:"query",req:V,dirty:!1},ve?ve.push(_e):(ve=[_e],(Fe=Fe||(Du["idb://".concat(y,"/").concat(_)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[V.query.index.name||""]=ve)),wCe(_e,ve,ie,ge),_e.promise.then(function(Ee){return{result:IB(Ee.result,V,Fe==null?void 0:Fe.optimisticOps,I,_e,J)}})}})}})}};function Ny(g,y){return new Proxy(g,{get:function(_,I,O){return I==="db"?y:Reflect.get(_,I,O)}})}var ga=(os.prototype.version=function(g){if(isNaN(g)||g<.1)throw new te.Type("Given version is not a positive number");if(g=Math.round(10*g)/10,this.idbdb||this._state.isBeingOpened)throw new te.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,g);var y=this._versions,_=y.filter(function(I){return I._cfg.version===g})[0];return _||(_=new this.Version(g),y.push(_),y.sort(uCe),_.stores({}),this._state.autoSchema=!1,_)},os.prototype._whenReady=function(g){var y=this;return this.idbdb&&(this._state.openComplete||He.letThrough||this._vip)?g():new Je(function(_,I){if(y._state.openComplete)return I(new te.DatabaseClosed(y._state.dbOpenError));if(!y._state.isBeingOpened){if(!y._state.autoOpen)return void I(new te.DatabaseClosed);y.open().catch(Ge)}y._state.dbReadyPromise.then(_,I)}).then(g)},os.prototype.use=function(g){var y=g.stack,_=g.create,I=g.level,O=g.name;return O&&this.unuse({stack:y,name:O}),g=this._middlewares[y]||(this._middlewares[y]=[]),g.push({stack:y,create:_,level:I??10,name:O}),g.sort(function(V,J){return V.level-J.level}),this},os.prototype.unuse=function(g){var y=g.stack,_=g.name,I=g.create;return y&&this._middlewares[y]&&(this._middlewares[y]=this._middlewares[y].filter(function(O){return I?O.create!==I:!!_&&O.name!==_})),this},os.prototype.open=function(){var g=this;return ha(Me,function(){return fCe(g)})},os.prototype._close=function(){var g=this._state,y=Ed.indexOf(this);if(0<=y&&Ed.splice(y,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}g.isBeingOpened||(g.dbReadyPromise=new Je(function(_){g.dbReadyResolve=_}),g.openCanceller=new Je(function(_,I){g.cancelOpen=I}))},os.prototype.close=function(_){var y=(_===void 0?{disableAutoOpen:!0}:_).disableAutoOpen,_=this._state;y?(_.isBeingOpened&&_.cancelOpen(new te.DatabaseClosed),this._close(),_.autoOpen=!1,_.dbOpenError=new te.DatabaseClosed):(this._close(),_.autoOpen=this._options.autoOpen||_.isBeingOpened,_.openComplete=!1,_.dbOpenError=null)},os.prototype.delete=function(g){var y=this;g===void 0&&(g={disableAutoOpen:!0});var _=0<arguments.length&&typeof arguments[0]!="object",I=this._state;return new Je(function(O,V){function J(){y.close(g);var ie=y._deps.indexedDB.deleteDatabase(y.name);ie.onsuccess=Fn(function(){var ge,we,_e;ge=y._deps,we=y.name,_e=ge.indexedDB,ge=ge.IDBKeyRange,x_(_e)||we===by||T_(_e,ge).delete(we).catch(Ge),O()}),ie.onerror=Rr(V),ie.onblocked=y._fireOnBlocked}if(_)throw new te.InvalidArgument("Invalid closeOptions argument to db.delete()");I.isBeingOpened?I.dbReadyPromise.then(J):J()})},os.prototype.backendDB=function(){return this.idbdb},os.prototype.isOpen=function(){return this.idbdb!==null},os.prototype.hasBeenClosed=function(){var g=this._state.dbOpenError;return g&&g.name==="DatabaseClosed"},os.prototype.hasFailed=function(){return this._state.dbOpenError!==null},os.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(os.prototype,"tables",{get:function(){var g=this;return r(this._allTables).map(function(y){return g._allTables[y]})},enumerable:!1,configurable:!0}),os.prototype.transaction=function(){var g=(function(y,_,I){var O=arguments.length;if(O<2)throw new te.InvalidArgument("Too few arguments");for(var V=new Array(O-1);--O;)V[O-1]=arguments[O];return I=V.pop(),[y,x(V),I]}).apply(this,arguments);return this._transaction.apply(this,g)},os.prototype._transaction=function(g,y,_){var I=this,O=He.trans;O&&O.db===this&&g.indexOf("!")===-1||(O=null);var V,J,ie=g.indexOf("?")!==-1;g=g.replace("!","").replace("?","");try{if(J=y.map(function(we){if(we=we instanceof I.Table?we.name:we,typeof we!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return we}),g=="r"||g===g_)V=g_;else{if(g!="rw"&&g!=m_)throw new te.InvalidArgument("Invalid transaction mode: "+g);V=m_}if(O){if(O.mode===g_&&V===m_){if(!ie)throw new te.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");O=null}O&&J.forEach(function(we){if(O&&O.storeNames.indexOf(we)===-1){if(!ie)throw new te.SubTransaction("Table "+we+" not included in parent transaction.");O=null}}),ie&&O&&!O.active&&(O=null)}}catch(we){return O?O._promise(null,function(_e,le){le(we)}):ss(we)}var ge=(function we(_e,le,Fe,ve,Ee){return Je.resolve().then(function(){var De=He.transless||He,Ce=_e._createTransaction(le,Fe,_e._dbSchema,ve);if(Ce.explicit=!0,De={trans:Ce,transless:De},ve)Ce.idbtrans=ve.idbtrans;else try{Ce.create(),Ce.idbtrans._explicit=!0,_e._state.PR1398_maxLoop=3}catch(Ne){return Ne.name===he.InvalidState&&_e.isOpen()&&0<--_e._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),_e.close({disableAutoOpen:!1}),_e.open().then(function(){return we(_e,le,Fe,null,Ee)})):ss(Ne)}var Ae,Oe=Q(Ee);return Oe&&ca(),De=Je.follow(function(){var Ne;(Ae=Ee.call(Ce,Ce))&&(Oe?(Ne=Li.bind(null,null),Ae.then(Ne,Ne)):typeof Ae.next=="function"&&typeof Ae.throw=="function"&&(Ae=M_(Ae)))},De),(Ae&&typeof Ae.then=="function"?Je.resolve(Ae).then(function(Ne){return Ce.active?Ne:ss(new te.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):De.then(function(){return Ae})).then(function(Ne){return ve&&Ce._resolve(),Ce._completion.then(function(){return Ne})}).catch(function(Ne){return Ce._reject(Ne),ss(Ne)})})}).bind(null,this,V,J,O,_);return O?O._promise(V,ge,"lock"):He.trans?ha(He.transless,function(){return I._whenReady(ge)}):this._whenReady(ge)},os.prototype.table=function(g){if(!d(this._allTables,g))throw new te.InvalidTable("Table ".concat(g," does not exist"));return this._allTables[g]},os);function os(g,y){var _=this;this._middlewares={},this.verno=0;var I=os.dependencies;this._options=y=s({addons:os.addons,autoOpen:!0,indexedDB:I.indexedDB,IDBKeyRange:I.IDBKeyRange,cache:"cloned"},y),this._deps={indexedDB:y.indexedDB,IDBKeyRange:y.IDBKeyRange},I=y.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var O,V,J,ie,ge,we={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Ge,dbReadyPromise:null,cancelOpen:Ge,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:y.autoOpen};we.dbReadyPromise=new Je(function(le){we.dbReadyResolve=le}),we.openCanceller=new Je(function(le,Fe){we.cancelOpen=Fe}),this._state=we,this.name=g,this.on=lp(this,"populate","blocked","versionchange","close",{ready:[X,Ge]}),this.on.ready.subscribe=S(this.on.ready.subscribe,function(le){return function(Fe,ve){os.vip(function(){var Ee,De=_._state;De.openComplete?(De.dbOpenError||Je.resolve().then(Fe),ve&&le(Fe)):De.onReadyBeingFired?(De.onReadyBeingFired.push(Fe),ve&&le(Fe)):(le(Fe),Ee=_,ve||le(function Ce(){Ee.on.ready.unsubscribe(Fe),Ee.on.ready.unsubscribe(Ce)}))})}}),this.Collection=(O=this,up(nCe.prototype,function(Ae,Ce){this.db=O;var ve=lB,Ee=null;if(Ce)try{ve=Ce()}catch(Oe){Ee=Oe}var De=Ae._ctx,Ce=De.table,Ae=Ce.hook.reading.fire;this._ctx={table:Ce,index:De.index,isPrimKey:!De.index||Ce.schema.primKey.keyPath&&De.index===Ce.schema.primKey.name,range:ve,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:Ee,or:De.or,valueMapper:Ae!==z?Ae:null}})),this.Table=(V=this,up(hB.prototype,function(le,Fe,ve){this.db=V,this._tx=ve,this.name=le,this.schema=Fe,this.hook=V._allTables[le]?V._allTables[le].hook:lp(null,{creating:[fe,Ge],reading:[se,z],updating:[A,Ge],deleting:[Se,Ge]})})),this.Transaction=(J=this,up(iCe.prototype,function(le,Fe,ve,Ee,De){var Ce=this;this.db=J,this.mode=le,this.storeNames=Fe,this.schema=ve,this.chromeTransactionDurability=Ee,this.idbtrans=null,this.on=lp(this,"complete","error","abort"),this.parent=De||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 Je(function(Ae,Oe){Ce._resolve=Ae,Ce._reject=Oe}),this._completion.then(function(){Ce.active=!1,Ce.on.complete.fire()},function(Ae){var Oe=Ce.active;return Ce.active=!1,Ce.on.error.fire(Ae),Ce.parent?Ce.parent._reject(Ae):Oe&&Ce.idbtrans&&Ce.idbtrans.abort(),ss(Ae)})})),this.Version=(ie=this,up(hCe.prototype,function(le){this.db=ie,this._cfg={version:le,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(ge=this,up(vB.prototype,function(le,Fe,ve){if(this.db=ge,this._ctx={table:le,index:Fe===":id"?null:Fe,or:ve},this._cmp=this._ascending=en,this._descending=function(Ee,De){return en(De,Ee)},this._max=function(Ee,De){return 0<en(Ee,De)?Ee:De},this._min=function(Ee,De){return en(Ee,De)<0?Ee:De},this._IDBKeyRange=ge._deps.IDBKeyRange,!this._IDBKeyRange)throw new te.MissingAPI})),this.on("versionchange",function(le){0<le.newVersion?console.warn("Another connection wants to upgrade database '".concat(_.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(_.name,"'. Closing db now to resume the delete request.")),_.close({disableAutoOpen:!1})}),this.on("blocked",function(le){!le.newVersion||le.newVersion<le.oldVersion?console.warn("Dexie.delete('".concat(_.name,"') was blocked")):console.warn("Upgrade '".concat(_.name,"' blocked by other connection holding version ").concat(le.oldVersion/10))}),this._maxKey=fp(y.IDBKeyRange),this._createTransaction=function(le,Fe,ve,Ee){return new _.Transaction(le,Fe,ve,_._options.chromeTransactionDurability,Ee)},this._fireOnBlocked=function(le){_.on("blocked").fire(le),Ed.filter(function(Fe){return Fe.name===_.name&&Fe!==_&&!Fe._state.vcFired}).map(function(Fe){return Fe.on("versionchange").fire(le)})},this.use(mCe),this.use(CCe),this.use(vCe),this.use(pCe),this.use(gCe);var _e=new Proxy(this,{get:function(le,Fe,ve){if(Fe==="_vip")return!0;if(Fe==="table")return function(De){return Ny(_.table(De),_e)};var Ee=Reflect.get(le,Fe,ve);return Ee instanceof hB?Ny(Ee,_e):Fe==="tables"?Ee.map(function(De){return Ny(De,_e)}):Fe==="_createTransaction"?function(){return Ny(Ee.apply(this,arguments),_e)}:Ee}});this.vip=_e,I.forEach(function(le){return le(_)})}var Ly,ui=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",bCe=(B_.prototype.subscribe=function(g,y,_){return this._subscribe(g&&typeof g!="function"?g:{next:g,error:y,complete:_})},B_.prototype[ui]=function(){return this},B_);function B_(g){this._subscribe=g}try{Ly={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch{Ly={indexedDB:null,IDBKeyRange:null}}function AB(g){var y,_=!1,I=new bCe(function(O){var V=Q(g),J,ie=!1,ge={},we={},_e={get closed(){return ie},unsubscribe:function(){ie||(ie=!0,J&&J.abort(),le&&cl.storagemutated.unsubscribe(ve))}};O.start&&O.start(_e);var le=!1,Fe=function(){return ll(Ee)},ve=function(De){ky(ge,De),P_(we,ge)&&Fe()},Ee=function(){var De,Ce,Ae;!ie&&Ly.indexedDB&&(ge={},De={},J&&J.abort(),J=new AbortController,Ae=function(Oe){var Ne=Ni();try{V&&ca();var Ue=As(g,Oe);return Ue=V?Ue.finally(Li):Ue}finally{Ne&&li()}}(Ce={subscr:De,signal:J.signal,requery:Fe,querier:g,trans:null}),Promise.resolve(Ae).then(function(Oe){_=!0,y=Oe,ie||Ce.signal.aborted||(ge={},function(Ne){for(var Ue in Ne)if(d(Ne,Ue))return;return 1}(we=De)||le||(cl(hp,ve),le=!0),ll(function(){return!ie&&O.next&&O.next(Oe)}))},function(Oe){_=!1,["DatabaseClosedError","AbortError"].includes(Oe==null?void 0:Oe.name)||ie||ll(function(){ie||O.error&&O.error(Oe)})}))};return setTimeout(Fe,0),_e});return I.hasValue=function(){return _},I.getValue=function(){return y},I}var Tu=ga;function $_(g){var y=dl;try{dl=!0,cl.storagemutated.fire(g),O_(g,!0)}finally{dl=y}}h(Tu,s(s({},$e),{delete:function(g){return new Tu(g,{addons:[]}).delete()},exists:function(g){return new Tu(g,{addons:[]}).open().then(function(y){return y.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(g){try{return y=Tu.dependencies,_=y.indexedDB,y=y.IDBKeyRange,(x_(_)?Promise.resolve(_.databases()).then(function(I){return I.map(function(O){return O.name}).filter(function(O){return O!==by})}):T_(_,y).toCollection().primaryKeys()).then(g)}catch{return ss(new te.MissingAPI)}var y,_},defineClass:function(){return function(g){l(this,g)}},ignoreTransaction:function(g){return He.trans?ha(He.transless,g):g()},vip:F_,async:function(g){return function(){try{var y=M_(g.apply(this,arguments));return y&&typeof y.then=="function"?y:Je.resolve(y)}catch(_){return ss(_)}}},spawn:function(g,y,_){try{var I=M_(g.apply(_,y||[]));return I&&typeof I.then=="function"?I:Je.resolve(I)}catch(O){return ss(O)}},currentTransaction:{get:function(){return He.trans||null}},waitFor:function(g,y){return y=Je.resolve(typeof g=="function"?Tu.ignoreTransaction(g):g).timeout(y||6e4),He.trans?He.trans.waitFor(y):y},Promise:Je,debug:{get:function(){return me},set:function(g){Pe(g)}},derive:m,extend:l,props:h,override:S,Events:lp,on:cl,liveQuery:AB,extendObservabilitySet:ky,getByKeyPath:E,setByKeyPath:T,delByKeyPath:function(g,y){typeof y=="string"?T(g,y,void 0):"length"in y&&[].map.call(y,function(_){T(g,_,void 0)})},shallowClone:k,deepClone:P,getObjectDiff:N_,cmp:en,asap:R,minKey:-1/0,addons:[],connections:Ed,errnames:he,dependencies:Ly,cache:Du,semVer:"4.0.10",version:"4.0.10".split(".").map(function(g){return parseInt(g)}).reduce(function(g,y,_){return g+y/Math.pow(10,2*_)})})),Tu.maxKey=fp(Tu.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(cl(hp,function(g){dl||(g=new CustomEvent(C_,{detail:g}),dl=!0,dispatchEvent(g),dl=!1)}),addEventListener(C_,function(g){g=g.detail,dl||$_(g)}));var Dd,dl=!1,kB=function(){};return typeof BroadcastChannel<"u"&&((kB=function(){(Dd=new BroadcastChannel(C_)).onmessage=function(g){return g.data&&$_(g.data)}})(),typeof Dd.unref=="function"&&Dd.unref(),cl(hp,function(g){dl||Dd.postMessage(g)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(g){if(!ga.disableBfCache&&g.persisted){me&&console.debug("Dexie: handling persisted pagehide"),Dd!=null&&Dd.close();for(var y=0,_=Ed;y<_.length;y++)_[y].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(g){!ga.disableBfCache&&g.persisted&&(me&&console.debug("Dexie: handling persisted pageshow"),kB(),$_({all:new js(-1/0,[[]])}))})),Je.rejectionMapper=function(g,y){return!g||g instanceof q||g instanceof TypeError||g instanceof SyntaxError||!g.name||!Re[g.name]?g:(y=new Re[g.name](y||g.message,g),"stack"in g&&p(y,"stack",{get:function(){return this.inner.stack}}),y)},Pe(me),s(ga,Object.freeze({__proto__:null,Dexie:ga,liveQuery:AB,Entity:uB,cmp:en,PropModSymbol:pa,PropModification:cp,replacePrefix:function(g,y){return new cp({replacePrefix:[g,y]})},add:function(g){return new cp({add:g})},remove:function(g){return new cp({remove:g})},default:ga,RangeSet:js,mergeRanges:mp,rangesOverlap:SB}),{default:ga}),ga})})(f1);var IW=f1.exports;const rC=FW(IW),p1=Symbol.for("Dexie"),hh=globalThis[p1]||(globalThis[p1]=rC);if(rC.semVer!==hh.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${rC.semVer} and ${hh.semVer}`);const{liveQuery:FCe,mergeRanges:ICe,rangesOverlap:PCe,RangeSet:ACe,cmp:kCe,Entity:OCe,PropModSymbol:MCe,PropModification:NCe,replacePrefix:LCe,add:VCe,remove:BCe}=hh;class g1 extends hh{constructor(n){super(n);is(this,"icons");is(this,"visuals");is(this,"users");is(this,"columns");is(this,"general");this.version(1).stores({icons:"key",visuals:"key",users:"key",columns:"key",general:"key"})}getTable(n){return this[n]?this[n]:this.general}}const vg=new Map,PW=async e=>{if(!vg.has(e)){const t=new g1(e);try{await t.open(),vg.set(e,t)}catch(n){console.error("Failed to open database, attempting to delete and recreate:",n);try{await hh.delete(e);const s=new g1(e);await s.open(),vg.set(e,s)}catch(s){throw console.error("Failed to delete and recreate database:",s),s}}}return vg.get(e)},fh=({dbName:e,storeName:t})=>{const n=async()=>(await PW(e)).getTable(t);return{getCachedValue:async u=>{try{const c=await n();if(!c){console.error(`Store is undefined for key: ${u}`);return}const d=await c.get(u);return d==null?void 0:d.value}catch(c){console.error("Failed to get cached value:",c);return}},setCachedValue:async(u,c)=>{try{const d=await n();if(!d){console.error(`Store is undefined, cannot cache key: ${u}`);return}await d.put({key:u,value:c,timestamp:Date.now()})}catch(d){console.error("Failed to cache value:",d)}},deleteCachedValue:async u=>{try{const c=await n();if(!c){console.error(`Store is undefined, cannot delete key: ${u}`);return}await c.delete(u)}catch(c){console.error("Failed to delete cached value:",c)}},clearCache:async()=>{try{const u=await n();if(!u){console.error("Store is undefined, cannot clear cache");return}await u.clear()}catch(u){console.error("Failed to clear cache:",u)}},getAllKeys:async()=>{try{const u=await n();return u?(await u.toArray()).map(d=>d.key):(console.error("Store is undefined, cannot get all keys"),[])}catch(u){return console.error("Failed to get all keys:",u),[]}},getCachedValueWithTimestamp:async u=>{try{const c=await n();if(!c){console.error(`Store is undefined for key: ${u}`);return}return await c.get(u)}catch(c){console.error("Failed to get cached value with timestamp:",c);return}}}},AW=["404","ClickChart","ClickToCreate","NoAccess1","NoActivity","NoAssignedComment","NoAssignedScene","NoComment","NoData","NoData2","NoRendition1","NoRendition2","PrivateComment","PrivateScene","ReportAchievement","ReportCompletedScenes","ReportInvolvement","ReportMetric","ReportOverdueScenes","ReportProfessionalName","ReportSceneAssignment","ReportSceneStatus","ReportSceneStatusType","Successful1","Unsuccessful1","ConfirmDeletion","Waiting1","DefaultThumbnail","UploadReviewFile","ClickToSearch","NoDataSearchFilter"],kW=["UploadInProgress"],Eu=class Eu{constructor(){is(this,"KEY_PAIR",{workspaceCode:"ws.code",apiBaseUrl:"API_BASE_URL",assetUrl:"ASSET_URL",baseUrl:"BASE_URL",baseReviewUrl:"BASE_REVIEW_URL"});Object.values(this.KEY_PAIR).every(n=>{const s=sessionStorage.getItem(n);return(s==null||s==="")&&console.error(`[SessionStorageHelper] Key "${n}" is not set in sessionStorage.`),!0})||console.error("[SessionStorageHelper] Some expected keys are missing in sessionStorage. Please ensure all required keys are set.")}static getInstance(){return Eu.instance||(Eu.instance=new Eu),Eu.instance}setItem(t,n){try{sessionStorage.setItem(t,n)}catch(s){console.error("Error setting sessionStorage item:",s)}}getItem(t){try{const n=sessionStorage.getItem(t);return n===null?"":n}catch(n){throw console.error("Error getting sessionStorage item:",n),n}}};is(Eu,"instance");let Cn=Eu;const yg={},Ra={},m1=(e,t,n,s,o="base64")=>{const i=L(""),r=L(""),a=L(!0),l=j(()=>`${t}:${e.value.name}`),u=m=>new Promise((v,w)=>{const b=new FileReader;b.onload=()=>v(b.result),b.onerror=w,b.readAsDataURL(m)}),c=m=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,d=async(m,v)=>{if(Ra[v])return Ra[v];if(v in yg){const S=await yg[v];return S&&(Ra[v]=S),S}const w=await s(l.value);if(w&&typeof w=="string")return Ra[v]=w,w;const b=(async()=>{try{const S=await fetch(m,{cache:"no-cache"});if(!S.ok)throw new Error("Failed to fetch visual");const C=S.headers.get("Content-Type")||"";let R;if(C.includes("svg")||C.includes("xml")){const E=await S.text();if(!E.trim())throw new Error("Empty SVG content");R=o==="svg"?E:c(E),Ra[v]=R}else if(C.match(/image\/(jpeg|jpg|png|gif|webp)/)){const E=await S.blob();if(!E.size)throw new Error("Empty image blob");R=await u(E),Ra[v]=R}else throw new Error(`Unsupported content type: ${C}`);return await n(l.value,R),R}catch(S){return console.error("Error fetching visual:",S),""}})();return yg[v]=b,b.finally(()=>{delete yg[v]}),await b},h=async m=>{a.value=!0;try{if(Ra[l.value]){const R=Ra[l.value];i.value=R,R.startsWith("data:image/svg+xml")?r.value=decodeURIComponent(R.split(",")[1]):(R.startsWith("<svg")||R.includes("<svg"))&&(r.value=R),a.value=!1;return}const v=Cn.getInstance().getItem("ASSET_URL")||"",w={icon:`${v}/icon/tess/TESSRAPP_Icon_${m}`,visual:`${v}/icon/visual/TESSRAPP_Visual_${m}`,ratting:`${v}/icon/tess/rating/TESSRAPP_Icon_${m}_Outline`,flag:`${v}/icon/flags/4x3/${m}`},b=AW.includes(m)?"png":kW.includes(m)?"gif":"svg",S=`${w[t]}.${b}`,C=await d(S,l.value);C&&(i.value=C,C.startsWith("data:image/svg+xml")?r.value=decodeURIComponent(C.split(",")[1]):(C.startsWith("<svg")||C.includes("<svg"))&&(r.value=C))}catch(v){console.error("Error fetching remote visual:",v)}finally{a.value=!1}},f=async()=>{i.value="",r.value="",e.value.name&&(a.value=!0,await h(e.value.name),a.value=!1)},p=j(()=>r.value?r.value:"");return nt(()=>e,()=>{f()},{deep:!0,immediate:!0}),{svgContent:p,url:i,loading:a}},OW=["innerHTML","about"],MW="IconCache",NW="icons",LW=dt({__name:"Icon",props:{src:{},source:{default:"remote"},size:{default:14},color:{default:"currentColor"}},setup(e){mG(h=>({v7bb7ab38:h.size+"px"}));const t=e,n=h=>{if(typeof h=="number")return h;switch(h){case"small":return 8;case"medium":return 16;case"large":return 20;default:return typeof h=="string"?Number.parseInt(h,10):14}},s=j(()=>n(t.size)),o=j(()=>({width:s.value+"px",height:s.value+"px",color:t.color})),{getCachedValue:i,setCachedValue:r}=fh({dbName:MW,storeName:NW}),a=async h=>{const f=await i(h);if(typeof f=="string")return f},l=async(h,f)=>{await r(h,f)},u=j(()=>t.source==="rating"?"ratting":"icon"),c=j(()=>({name:t.src,size:s.value,color:t.color||"currentColor"})),{svgContent:d}=m1(c,u.value,l,a,"svg");return(h,f)=>(W(),ue("div",{class:Y(h.$style.iconWrapper),innerHTML:H(d),style:sn(o.value),about:t.src,"data-icon":"true"},null,14,OW))}}),VW={iconWrapper:"_iconWrapper_1n0y9_1"},_t=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},it=_t(LW,[["__cssModules",{$style:VW}]]);function BW(e,t,n){const s=document.createElement("div");s.className=n;const o=pT(e,t);return o.component("custom-icon",it),o.mount(s),{container:s,app:o}}function wg(e){if(!e)return;const t=e._vueApp;if(t)try{t.unmount(),delete e._vueApp}catch(n){console.warn("Error unmounting Vue app:",n)}}function $W(e,t){e._vueApp=t}const HW=e=>{const{container:t,app:n}=BW(Nq,{user:e.user,status:e.status,timezone:e.timezone,userConfig:e.userConfig,showInsightButton:e.showInsightButton,showCopyLinkButton:e.showCopyLinkButton,apiUpdateFunction:e.apiUpdateFunction,refreshInterval:e.refreshInterval,enableAutoRefresh:e.enableAutoRefresh,onInsightClick:e.onInsightClick,onCopyLink:e.onCopyLink},"user-profile-tooltip-content");return $W(t,n),t},v1=e=>{e._userProfileContainer&&(wg(e._userProfileContainer),delete e._userProfileContainer),e._userProfileInstance&&(gg(e._userProfileInstance),delete e._userProfileInstance),e.style.cursor="",e.classList.remove("user-profile-trigger")},GW={mounted(e,t){var s,o;if(!((s=t.value)!=null&&s.user)){console.warn("[UserProfile] User data is required");return}const n=t.value;n.onInsightClick=()=>{var i;(i=e._userProfileInstance)==null||i.hide()},e._userProfileInstance=a1(e,{...r1,delay:[300,0],content:((o=n.user)==null?void 0:o.name)||"User",placement:n.placement||"bottom-start",trigger:"mouseenter focus",onShow(i){e._userProfileContainer&&wg(e._userProfileContainer);const r=HW(n);e._userProfileContainer=r,i.setContent(r)},onHidden(){setTimeout(()=>{e._userProfileContainer&&(wg(e._userProfileContainer),e._userProfileContainer=void 0)},200)},onDestroy(){e._userProfileContainer&&(wg(e._userProfileContainer),e._userProfileContainer=void 0)}}),e._userProfileInstance.enable(),e.classList.add("user-profile-trigger")},updated(e,t){var n;if(!(!((n=t.value)!=null&&n.user)||!e._userProfileInstance)&&t.value!==t.oldValue)try{e._userProfileInstance.setProps({placement:t.value.placement||"bottom-start"}),e._userProfileInstance.hide()}catch(s){console.warn("Error updating tooltip props:",s)}},beforeUnmount(e){v1(e)},unmounted(e){v1(e)}},UW=["type","disabled","aria-readonly"],WW={key:0},mt=_t(dt({__name:"Button",props:{label:{default:""},variant:{default:"primary"},size:{default:"default"},disabled:{type:Boolean,default:!1},type:{default:"button"},rounded:{type:Boolean},highlightOnHover:{type:Boolean},border:{type:Boolean},action:{},readOnly:{type:Boolean,default:!1},actived:{type:Boolean,default:!1},loading:{type:Boolean}},emits:["handleClick"],setup(e,{expose:t,emit:n}){const s=qt,o=e,i=L(!1),r=L(null),a=()=>{o.disabled||(i.value=!0)},l=()=>{o.disabled||(i.value=!1)};Qt(()=>{r.value&&(r.value.addEventListener("mouseenter",a),r.value.addEventListener("mouseleave",l))}),Yn(()=>{r.value&&(r.value.removeEventListener("mouseenter",a),r.value.removeEventListener("mouseleave",l))});const u=n,c=new Set(["primary","secondary","tertiary","text","menu-item"]),d=j(()=>Array.isArray(o.variant)?o.variant:[o.variant]),h=ag(),f=j(()=>{const C=[h.customButton],R=d.value.find(E=>c.has(E))||"primary";return C.push(h[`is-${R}`]),d.value.includes("danger")&&C.push(h["is-danger"]),d.value.includes("icon")&&C.push(h["is-icon"]),o.readOnly&&C.push(h["is-readonly"]),o.rounded&&C.push(h["is-rounded"]),o.border&&C.push(h["has-border"]),o.highlightOnHover&&C.push(h["highlight-on-hover"]),b.value&&C.push(h["has-prefix"]),S.value&&C.push(h["has-suffix"]),o.actived&&C.push(h["is-active"]),o.disabled&&C.push(h.disabled),o.loading&&C.push(h["is-loading"]),typeof o.size=="string"&&C.push(h[`size-${o.size}`]),C}),p=j(()=>o.readOnly===!0),m=j(()=>typeof o.size=="number"?{"--button-size":`${o.size}px`}:{}),v=C=>{var R;o.disabled||o.readOnly||(u("handleClick",C),(R=o.action)==null||R.call(o))},w=mw(),b=j(()=>!!w.prefix),S=j(()=>!!w.suffix);return t({buttonRef:r,focus:()=>{var C;(C=r.value)==null||C.focus()}}),(C,R)=>(W(),ue("button",{class:Y(f.value),type:o.type,disabled:o.disabled,"aria-readonly":p.value,style:sn(m.value),onClick:v,ref_key:"buttonRef",ref:r},[Pt(C.$slots,"prefix"),Pt(C.$slots,"default",{hovered:i.value},()=>[e.label?qe((W(),ue("span",WW,[st(Ct(e.label),1)])),[[H(s),{content:e.label}]]):Ze("",!0)]),Pt(C.$slots,"suffix")],14,UW))}}),[["__cssModules",{$style:{customButton:"_customButton_14jr8_1","size-extra-small":"_size-extra-small_14jr8_21","size-small":"_size-small_14jr8_26","size-medium":"_size-medium_14jr8_31","size-large":"_size-large_14jr8_36","size-default":"_size-default_14jr8_41","is-primary":"_is-primary_14jr8_44","is-active":"_is-active_14jr8_52","is-danger":"_is-danger_14jr8_55","is-secondary":"_is-secondary_14jr8_64","is-tertiary":"_is-tertiary_14jr8_88","is-text":"_is-text_14jr8_108","is-menu-item":"_is-menu-item_14jr8_125","is-icon":"_is-icon_14jr8_157","is-readonly":"_is-readonly_14jr8_179","is-rounded":"_is-rounded_14jr8_182","has-border":"_has-border_14jr8_185","highlight-on-hover":"_highlight-on-hover_14jr8_188","icon-wrapper":"_icon-wrapper_14jr8_188","is-loading":"_is-loading_14jr8_191",spin:"_spin_14jr8_1"}}]]);/*!
103
+ `+V:""),this.inner=V||null):typeof O=="object"&&(this.message="".concat(O.name," ").concat(O.message),this.inner=O):(this.message=U[y]||_,this.inner=null)}return m(I).from(ae),g[y]=I,g},{});te.Syntax=SyntaxError,te.Type=TypeError,te.Range=RangeError;var Re=de.reduce(function(g,y){return g[y+"Error"]=te[y],g},{}),$e=ui.reduce(function(g,y){return["Syntax","Type","Range"].indexOf(y)===-1&&(g[y+"Error"]=te[y]),g},{});function Ge(){}function z(g){return g}function se(g,y){return g==null||g===z?y:function(_){return y(g(_))}}function be(g,y){return function(){g.apply(this,arguments),y.apply(this,arguments)}}function fe(g,y){return g===Ge?y:function(){var _=g.apply(this,arguments);_!==void 0&&(arguments[0]=_);var I=this.onsuccess,O=this.onerror;this.onsuccess=null,this.onerror=null;var V=y.apply(this,arguments);return I&&(this.onsuccess=this.onsuccess?be(I,this.onsuccess):I),O&&(this.onerror=this.onerror?be(O,this.onerror):O),V!==void 0?V:_}}function Se(g,y){return g===Ge?y:function(){g.apply(this,arguments);var _=this.onsuccess,I=this.onerror;this.onsuccess=this.onerror=null,y.apply(this,arguments),_&&(this.onsuccess=this.onsuccess?be(_,this.onsuccess):_),I&&(this.onerror=this.onerror?be(I,this.onerror):I)}}function A(g,y){return g===Ge?y:function(_){var I=g.apply(this,arguments);l(_,I);var O=this.onsuccess,V=this.onerror;return this.onsuccess=null,this.onerror=null,_=y.apply(this,arguments),O&&(this.onsuccess=this.onsuccess?be(O,this.onsuccess):O),V&&(this.onerror=this.onerror?be(V,this.onerror):V),I===void 0?_===void 0?void 0:_:l(I,_)}}function N(g,y){return g===Ge?y:function(){return y.apply(this,arguments)!==!1&&g.apply(this,arguments)}}function X(g,y){return g===Ge?y:function(){var _=g.apply(this,arguments);if(_&&typeof _.then=="function"){for(var I=this,O=arguments.length,V=new Array(O);O--;)V[O]=arguments[O];return _.then(function(){return y.apply(I,V)})}return y.apply(this,arguments)}}$e.ModifyError=Te,$e.DexieError=q,$e.BulkError=We;var me=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Pe(g){me=g}var ze={},Le=100,pa=typeof Promise>"u"?[]:function(){var g=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[g,u(g),g];var y=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[y,u(y),g]}(),de=pa[0],ui=pa[1],pa=pa[2],ui=ui&&ui.then,xe=de&&de.constructor,ut=!!pa,Et=function(g,y){wt.push([g,y]),cn&&(queueMicrotask(Er),cn=!1)},Mt=!0,cn=!0,Ht=[],yn=[],Mn=z,Me={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Ge,pgp:!1,env:{},finalize:Ge},He=Me,wt=[],It=0,Gt=[];function Je(g){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var y=this._PSD=He;if(typeof g!="function"){if(g!==ze)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&il(this,this._value))}this._state=null,this._value=null,++y.ref,function _(I,O){try{O(function(V){if(I._state===null){if(V===I)throw new TypeError("A promise cannot be resolved with itself.");var J=I._lib&&Ni();V&&typeof V.then=="function"?_(I,function(ie,ge){V instanceof Je?V._then(ie,ge):V.then(ie,ge)}):(I._state=!0,I._value=V,ai(I)),J&&li()}},il.bind(null,I))}catch(V){il(I,V)}}(this,g)}var hs={get:function(){var g=He,y=Nn;function _(I,O){var V=this,J=!g.global&&(g!==He||y!==Nn),ie=J&&!Li(),ge=new Je(function(we,_e){ua(V,new Mi(ap(I,g,J,ie),ap(O,g,J,ie),we,_e,g))});return this._consoleTask&&(ge._consoleTask=this._consoleTask),ge}return _.prototype=ze,_},set:function(g){p(this,"then",g&&g.prototype===ze?hs:{get:function(){return g},set:hs.set})}};function Mi(g,y,_,I,O){this.onFulfilled=typeof g=="function"?g:null,this.onRejected=typeof y=="function"?y:null,this.resolve=_,this.reject=I,this.psd=O}function il(g,y){var _,I;yn.push(y),g._state===null&&(_=g._lib&&Ni(),y=Mn(y),g._state=!1,g._value=y,I=g,Ht.some(function(O){return O._value===I._value})||Ht.push(I),ai(g),_&&li())}function ai(g){var y=g._listeners;g._listeners=[];for(var _=0,I=y.length;_<I;++_)ua(g,y[_]);var O=g._PSD;--O.ref||O.finalize(),It===0&&(++It,Et(function(){--It==0&&_r()},[]))}function ua(g,y){if(g._state!==null){var _=g._state?y.onFulfilled:y.onRejected;if(_===null)return(g._state?y.resolve:y.reject)(g._value);++y.psd.ref,++It,Et(rl,[_,g,y])}else g._listeners.push(y)}function rl(g,y,_){try{var I,O=y._value;!y._state&&yn.length&&(yn=[]),I=me&&y._consoleTask?y._consoleTask.run(function(){return g(O)}):g(O),y._state||yn.indexOf(O)!==-1||function(V){for(var J=Ht.length;J;)if(Ht[--J]._value===V._value)return Ht.splice(J,1)}(y),_.resolve(I)}catch(V){_.reject(V)}finally{--It==0&&_r(),--_.psd.ref||_.psd.finalize()}}function Er(){ha(Me,function(){Ni()&&li()})}function Ni(){var g=Mt;return cn=Mt=!1,g}function li(){var g,y,_;do for(;0<wt.length;)for(g=wt,wt=[],_=g.length,y=0;y<_;++y){var I=g[y];I[0].apply(null,I[1])}while(0<wt.length);cn=Mt=!0}function _r(){var g=Ht;Ht=[],g.forEach(function(I){I._PSD.onunhandled.call(null,I._value,I)});for(var y=Gt.slice(0),_=y.length;_;)y[--_]()}function Sd(g){return new Je(ze,!1,g)}function Fn(g,y){var _=He;return function(){var I=Ni(),O=He;try{return da(_,!0),g.apply(this,arguments)}catch(V){y&&y(V)}finally{da(O,!1),I&&li()}}}h(Je.prototype,{then:hs,_then:function(g,y){ua(this,new Mi(null,null,g,y,He))},catch:function(g){if(arguments.length===1)return this.then(null,g);var y=g,_=arguments[1];return typeof y=="function"?this.then(null,function(I){return(I instanceof y?_:Sd)(I)}):this.then(null,function(I){return(I&&I.name===y?_:Sd)(I)})},finally:function(g){return this.then(function(y){return Je.resolve(g()).then(function(){return y})},function(y){return Je.resolve(g()).then(function(){return Sd(y)})})},timeout:function(g,y){var _=this;return g<1/0?new Je(function(I,O){var V=setTimeout(function(){return O(new te.Timeout(y))},g);_.then(I,O).finally(clearTimeout.bind(null,V))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&p(Je.prototype,Symbol.toStringTag,"Dexie.Promise"),Me.env=Cy(),h(Je,{all:function(){var g=G.apply(null,arguments).map(al);return new Je(function(y,_){g.length===0&&y([]);var I=g.length;g.forEach(function(O,V){return Je.resolve(O).then(function(J){g[V]=J,--I||y(g)},_)})})},resolve:function(g){return g instanceof Je?g:g&&typeof g.then=="function"?new Je(function(y,_){g.then(y,_)}):new Je(ze,!0,g)},reject:Sd,race:function(){var g=G.apply(null,arguments).map(al);return new Je(function(y,_){g.map(function(I){return Je.resolve(I).then(y,_)})})},PSD:{get:function(){return He},set:function(g){return He=g}},totalEchoes:{get:function(){return Nn}},newPSD:As,usePSD:ha,scheduler:{get:function(){return Et},set:function(g){Et=g}},rejectionMapper:{get:function(){return Mn},set:function(g){Mn=g}},follow:function(g,y){return new Je(function(_,I){return As(function(O,V){var J=He;J.unhandleds=[],J.onunhandled=V,J.finalize=be(function(){var ie,ge=this;ie=function(){ge.unhandleds.length===0?O():V(ge.unhandleds[0])},Gt.push(function we(){ie(),Gt.splice(Gt.indexOf(we),1)}),++It,Et(function(){--It==0&&_r()},[])},J.finalize),g()},y,_,I)})}}),xe&&(xe.allSettled&&p(Je,"allSettled",function(){var g=G.apply(null,arguments).map(al);return new Je(function(y){g.length===0&&y([]);var _=g.length,I=new Array(_);g.forEach(function(O,V){return Je.resolve(O).then(function(J){return I[V]={status:"fulfilled",value:J}},function(J){return I[V]={status:"rejected",reason:J}}).then(function(){return--_||y(I)})})})}),xe.any&&typeof AggregateError<"u"&&p(Je,"any",function(){var g=G.apply(null,arguments).map(al);return new Je(function(y,_){g.length===0&&_(new AggregateError([]));var I=g.length,O=new Array(I);g.forEach(function(V,J){return Je.resolve(V).then(function(ie){return y(ie)},function(ie){O[J]=ie,--I||_(new AggregateError(O))})})})}),xe.withResolvers&&(Je.withResolvers=xe.withResolvers));var fs={awaits:0,echoes:0,id:0},p_=0,Ve=[],Qe=0,Nn=0,_n=0;function As(g,y,_,I){var O=He,V=Object.create(O);return V.parent=O,V.ref=0,V.global=!1,V.id=++_n,Me.env,V.env=ut?{Promise:Je,PromiseProp:{value:Je,configurable:!0,writable:!0},all:Je.all,race:Je.race,allSettled:Je.allSettled,any:Je.any,resolve:Je.resolve,reject:Je.reject}:{},y&&l(V,y),++O.ref,V.finalize=function(){--this.parent.ref||this.parent.finalize()},I=ha(V,g,_,I),V.ref===0&&V.finalize(),I}function ca(){return fs.id||(fs.id=++p_),++fs.awaits,fs.echoes+=Le,fs.id}function Li(){return!!fs.awaits&&(--fs.awaits==0&&(fs.id=0),fs.echoes=fs.awaits*Le,!0)}function al(g){return fs.echoes&&g&&g.constructor===xe?(ca(),g.then(function(y){return Li(),y},function(y){return Li(),ss(y)})):g}function rp(){var g=Ve[Ve.length-1];Ve.pop(),da(g,!1)}function da(g,y){var _,I=He;(y?!fs.echoes||Qe++&&g===He:!Qe||--Qe&&g===He)||queueMicrotask(y?(function(O){++Nn,fs.echoes&&--fs.echoes!=0||(fs.echoes=fs.awaits=fs.id=0),Ve.push(He),da(O,!0)}).bind(null,g):rp),g!==He&&(He=g,I===Me&&(Me.env=Cy()),ut&&(_=Me.env.Promise,y=g.env,(I.global||g.global)&&(Object.defineProperty(i,"Promise",y.PromiseProp),_.all=y.all,_.race=y.race,_.resolve=y.resolve,_.reject=y.reject,y.allSettled&&(_.allSettled=y.allSettled),y.any&&(_.any=y.any))))}function Cy(){var g=i.Promise;return ut?{Promise:g,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:g.all,race:g.race,allSettled:g.allSettled,any:g.any,resolve:g.resolve,reject:g.reject}:{}}function ha(g,y,_,I,O){var V=He;try{return da(g,!0),y(_,I,O)}finally{da(V,!1)}}function ap(g,y,_,I){return typeof g!="function"?g:function(){var O=He;_&&ca(),da(y,!0);try{return g.apply(this,arguments)}finally{da(O,!1),I&&queueMicrotask(Li)}}}function ll(g){Promise===xe&&fs.echoes===0?Qe===0?g():enqueueNativeMicroTask(g):setTimeout(g,0)}(""+ui).indexOf("[native code]")===-1&&(ca=Li=Ge);var ss=Je.reject,_u="￿",fa="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",aB="String expected.",Ed=[],by="__dbnames",g_="readonly",m_="readwrite";function Ru(g,y){return g?y?function(){return g.apply(this,arguments)&&y.apply(this,arguments)}:g:y}var lB={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Sy(g){return typeof g!="string"||/\./.test(g)?function(y){return y}:function(y){return y[g]===void 0&&g in y&&delete(y=P(y))[g],y}}function uB(){throw te.Type()}function en(g,y){try{var _=cB(g),I=cB(y);if(_!==I)return _==="Array"?1:I==="Array"?-1:_==="binary"?1:I==="binary"?-1:_==="string"?1:I==="string"?-1:_==="Date"?1:I!=="Date"?NaN:-1;switch(_){case"number":case"Date":case"string":return y<g?1:g<y?-1:0;case"binary":return function(O,V){for(var J=O.length,ie=V.length,ge=J<ie?J:ie,we=0;we<ge;++we)if(O[we]!==V[we])return O[we]<V[we]?-1:1;return J===ie?0:J<ie?-1:1}(dB(g),dB(y));case"Array":return function(O,V){for(var J=O.length,ie=V.length,ge=J<ie?J:ie,we=0;we<ge;++we){var _e=en(O[we],V[we]);if(_e!==0)return _e}return J===ie?0:J<ie?-1:1}(g,y)}}catch{}return NaN}function cB(g){var y=typeof g;return y!="object"?y:ArrayBuffer.isView(g)?"binary":(g=Z(g),g==="ArrayBuffer"?"binary":g)}function dB(g){return g instanceof Uint8Array?g:ArrayBuffer.isView(g)?new Uint8Array(g.buffer,g.byteOffset,g.byteLength):new Uint8Array(g)}var hB=(Ln.prototype._trans=function(g,y,_){var I=this._tx||He.trans,O=this.name,V=me&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(g==="readonly"?"read":"write"," ").concat(this.name));function J(we,_e,le){if(!le.schema[O])throw new te.NotFound("Table "+O+" not part of transaction");return y(le.idbtrans,le)}var ie=Ni();try{var ge=I&&I.db._novip===this.db._novip?I===He.trans?I._promise(g,J,_):As(function(){return I._promise(g,J,_)},{trans:I,transless:He.transless||He}):function we(_e,le,Fe,ve){if(_e.idbdb&&(_e._state.openComplete||He.letThrough||_e._vip)){var Ee=_e._createTransaction(le,Fe,_e._dbSchema);try{Ee.create(),_e._state.PR1398_maxLoop=3}catch(De){return De.name===he.InvalidState&&_e.isOpen()&&0<--_e._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),_e.close({disableAutoOpen:!1}),_e.open().then(function(){return we(_e,le,Fe,ve)})):ss(De)}return Ee._promise(le,function(De,Ce){return As(function(){return He.trans=Ee,ve(De,Ce,Ee)})}).then(function(De){if(le==="readwrite")try{Ee.idbtrans.commit()}catch{}return le==="readonly"?De:Ee._completion.then(function(){return De})})}if(_e._state.openComplete)return ss(new te.DatabaseClosed(_e._state.dbOpenError));if(!_e._state.isBeingOpened){if(!_e._state.autoOpen)return ss(new te.DatabaseClosed);_e.open().catch(Ge)}return _e._state.dbReadyPromise.then(function(){return we(_e,le,Fe,ve)})}(this.db,g,[this.name],J);return V&&(ge._consoleTask=V,ge=ge.catch(function(we){return console.trace(we),ss(we)})),ge}finally{ie&&li()}},Ln.prototype.get=function(g,y){var _=this;return g&&g.constructor===Object?this.where(g).first(y):g==null?ss(new te.Type("Invalid argument to Table.get()")):this._trans("readonly",function(I){return _.core.get({trans:I,key:g}).then(function(O){return _.hook.reading.fire(O)})}).then(y)},Ln.prototype.where=function(g){if(typeof g=="string")return new this.db.WhereClause(this,g);if(a(g))return new this.db.WhereClause(this,"[".concat(g.join("+"),"]"));var y=r(g);if(y.length===1)return this.where(y[0]).equals(g[y[0]]);var _=this.schema.indexes.concat(this.schema.primKey).filter(function(ie){if(ie.compound&&y.every(function(we){return 0<=ie.keyPath.indexOf(we)})){for(var ge=0;ge<y.length;++ge)if(y.indexOf(ie.keyPath[ge])===-1)return!1;return!0}return!1}).sort(function(ie,ge){return ie.keyPath.length-ge.keyPath.length})[0];if(_&&this.db._maxKey!==_u){var V=_.keyPath.slice(0,y.length);return this.where(V).equals(V.map(function(ge){return g[ge]}))}!_&&me&&console.warn("The query ".concat(JSON.stringify(g)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(y.join("+"),"]"));var I=this.schema.idxByName;function O(ie,ge){return en(ie,ge)===0}var J=y.reduce(function(le,ge){var we=le[0],_e=le[1],le=I[ge],Fe=g[ge];return[we||le,we||!le?Ru(_e,le&&le.multi?function(ve){return ve=E(ve,ge),a(ve)&&ve.some(function(Ee){return O(Fe,Ee)})}:function(ve){return O(Fe,E(ve,ge))}):_e]},[null,null]),V=J[0],J=J[1];return V?this.where(V.name).equals(g[V.keyPath]).filter(J):_?this.filter(J):this.where(y).equals("")},Ln.prototype.filter=function(g){return this.toCollection().and(g)},Ln.prototype.count=function(g){return this.toCollection().count(g)},Ln.prototype.offset=function(g){return this.toCollection().offset(g)},Ln.prototype.limit=function(g){return this.toCollection().limit(g)},Ln.prototype.each=function(g){return this.toCollection().each(g)},Ln.prototype.toArray=function(g){return this.toCollection().toArray(g)},Ln.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Ln.prototype.orderBy=function(g){return new this.db.Collection(new this.db.WhereClause(this,a(g)?"[".concat(g.join("+"),"]"):g))},Ln.prototype.reverse=function(){return this.toCollection().reverse()},Ln.prototype.mapToClass=function(g){var y,_=this.db,I=this.name;function O(){return y!==null&&y.apply(this,arguments)||this}(this.schema.mappedClass=g).prototype instanceof uB&&(function(ge,we){if(typeof we!="function"&&we!==null)throw new TypeError("Class extends value "+String(we)+" is not a constructor or null");function _e(){this.constructor=ge}n(ge,we),ge.prototype=we===null?Object.create(we):(_e.prototype=we.prototype,new _e)}(O,y=g),Object.defineProperty(O.prototype,"db",{get:function(){return _},enumerable:!1,configurable:!0}),O.prototype.table=function(){return I},g=O);for(var V=new Set,J=g.prototype;J;J=u(J))Object.getOwnPropertyNames(J).forEach(function(ge){return V.add(ge)});function ie(ge){if(!ge)return ge;var we,_e=Object.create(g.prototype);for(we in ge)if(!V.has(we))try{_e[we]=ge[we]}catch{}return _e}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=ie,this.hook("reading",ie),g},Ln.prototype.defineClass=function(){return this.mapToClass(function(g){l(this,g)})},Ln.prototype.add=function(g,y){var _=this,I=this.schema.primKey,O=I.auto,V=I.keyPath,J=g;return V&&O&&(J=Sy(V)(g)),this._trans("readwrite",function(ie){return _.core.mutate({trans:ie,type:"add",keys:y!=null?[y]:null,values:[J]})}).then(function(ie){return ie.numFailures?Je.reject(ie.failures[0]):ie.lastResult}).then(function(ie){if(V)try{T(g,V,ie)}catch{}return ie})},Ln.prototype.update=function(g,y){return typeof g!="object"||a(g)?this.where(":id").equals(g).modify(y):(g=E(g,this.schema.primKey.keyPath),g===void 0?ss(new te.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(g).modify(y))},Ln.prototype.put=function(g,y){var _=this,I=this.schema.primKey,O=I.auto,V=I.keyPath,J=g;return V&&O&&(J=Sy(V)(g)),this._trans("readwrite",function(ie){return _.core.mutate({trans:ie,type:"put",values:[J],keys:y!=null?[y]:null})}).then(function(ie){return ie.numFailures?Je.reject(ie.failures[0]):ie.lastResult}).then(function(ie){if(V)try{T(g,V,ie)}catch{}return ie})},Ln.prototype.delete=function(g){var y=this;return this._trans("readwrite",function(_){return y.core.mutate({trans:_,type:"delete",keys:[g]})}).then(function(_){return _.numFailures?Je.reject(_.failures[0]):void 0})},Ln.prototype.clear=function(){var g=this;return this._trans("readwrite",function(y){return g.core.mutate({trans:y,type:"deleteRange",range:lB})}).then(function(y){return y.numFailures?Je.reject(y.failures[0]):void 0})},Ln.prototype.bulkGet=function(g){var y=this;return this._trans("readonly",function(_){return y.core.getMany({keys:g,trans:_}).then(function(I){return I.map(function(O){return y.hook.reading.fire(O)})})})},Ln.prototype.bulkAdd=function(g,y,_){var I=this,O=Array.isArray(y)?y:void 0,V=(_=_||(O?void 0:y))?_.allKeys:void 0;return this._trans("readwrite",function(J){var we=I.schema.primKey,ie=we.auto,we=we.keyPath;if(we&&O)throw new te.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(O&&O.length!==g.length)throw new te.InvalidArgument("Arguments objects and keys must have the same length");var ge=g.length,we=we&&ie?g.map(Sy(we)):g;return I.core.mutate({trans:J,type:"add",keys:O,values:we,wantResults:V}).then(function(Ee){var le=Ee.numFailures,Fe=Ee.results,ve=Ee.lastResult,Ee=Ee.failures;if(le===0)return V?Fe:ve;throw new We("".concat(I.name,".bulkAdd(): ").concat(le," of ").concat(ge," operations failed"),Ee)})})},Ln.prototype.bulkPut=function(g,y,_){var I=this,O=Array.isArray(y)?y:void 0,V=(_=_||(O?void 0:y))?_.allKeys:void 0;return this._trans("readwrite",function(J){var we=I.schema.primKey,ie=we.auto,we=we.keyPath;if(we&&O)throw new te.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(O&&O.length!==g.length)throw new te.InvalidArgument("Arguments objects and keys must have the same length");var ge=g.length,we=we&&ie?g.map(Sy(we)):g;return I.core.mutate({trans:J,type:"put",keys:O,values:we,wantResults:V}).then(function(Ee){var le=Ee.numFailures,Fe=Ee.results,ve=Ee.lastResult,Ee=Ee.failures;if(le===0)return V?Fe:ve;throw new We("".concat(I.name,".bulkPut(): ").concat(le," of ").concat(ge," operations failed"),Ee)})})},Ln.prototype.bulkUpdate=function(g){var y=this,_=this.core,I=g.map(function(J){return J.key}),O=g.map(function(J){return J.changes}),V=[];return this._trans("readwrite",function(J){return _.getMany({trans:J,keys:I,cache:"clone"}).then(function(ie){var ge=[],we=[];g.forEach(function(le,Fe){var ve=le.key,Ee=le.changes,De=ie[Fe];if(De){for(var Ce=0,Ae=Object.keys(Ee);Ce<Ae.length;Ce++){var Oe=Ae[Ce],Ne=Ee[Oe];if(Oe===y.schema.primKey.keyPath){if(en(Ne,ve)!==0)throw new te.Constraint("Cannot update primary key in bulkUpdate()")}else T(De,Oe,Ne)}V.push(Fe),ge.push(ve),we.push(De)}});var _e=ge.length;return _.mutate({trans:J,type:"put",keys:ge,values:we,updates:{keys:I,changeSpecs:O}}).then(function(le){var Fe=le.numFailures,ve=le.failures;if(Fe===0)return _e;for(var Ee=0,De=Object.keys(ve);Ee<De.length;Ee++){var Ce,Ae=De[Ee],Oe=V[Number(Ae)];Oe!=null&&(Ce=ve[Ae],delete ve[Ae],ve[Oe]=Ce)}throw new We("".concat(y.name,".bulkUpdate(): ").concat(Fe," of ").concat(_e," operations failed"),ve)})})})},Ln.prototype.bulkDelete=function(g){var y=this,_=g.length;return this._trans("readwrite",function(I){return y.core.mutate({trans:I,type:"delete",keys:g})}).then(function(J){var O=J.numFailures,V=J.lastResult,J=J.failures;if(O===0)return V;throw new We("".concat(y.name,".bulkDelete(): ").concat(O," of ").concat(_," operations failed"),J)})},Ln);function Ln(){}function lp(g){function y(J,ie){if(ie){for(var ge=arguments.length,we=new Array(ge-1);--ge;)we[ge-1]=arguments[ge];return _[J].subscribe.apply(null,we),g}if(typeof J=="string")return _[J]}var _={};y.addEventType=V;for(var I=1,O=arguments.length;I<O;++I)V(arguments[I]);return y;function V(J,ie,ge){if(typeof J!="object"){var we;ie=ie||N;var _e={subscribers:[],fire:ge=ge||Ge,subscribe:function(le){_e.subscribers.indexOf(le)===-1&&(_e.subscribers.push(le),_e.fire=ie(_e.fire,le))},unsubscribe:function(le){_e.subscribers=_e.subscribers.filter(function(Fe){return Fe!==le}),_e.fire=_e.subscribers.reduce(ie,ge)}};return _[J]=y[J]=_e}r(we=J).forEach(function(le){var Fe=we[le];if(a(Fe))V(le,we[le][0],we[le][1]);else{if(Fe!=="asap")throw new te.InvalidArgument("Invalid event config");var ve=V(le,z,function(){for(var Ee=arguments.length,De=new Array(Ee);Ee--;)De[Ee]=arguments[Ee];ve.subscribers.forEach(function(Ce){R(function(){Ce.apply(null,De)})})})}})}}function up(g,y){return m(y).from({prototype:g}),y}function _d(g,y){return!(g.filter||g.algorithm||g.or)&&(y?g.justLimit:!g.replayFilter)}function v_(g,y){g.filter=Ru(g.filter,y)}function y_(g,y,_){var I=g.replayFilter;g.replayFilter=I?function(){return Ru(I(),y())}:y,g.justLimit=_&&!I}function Ey(g,y){if(g.isPrimKey)return y.primaryKey;var _=y.getIndexByKeyPath(g.index);if(!_)throw new te.Schema("KeyPath "+g.index+" on object store "+y.name+" is not indexed");return _}function fB(g,y,_){var I=Ey(g,y.schema);return y.openCursor({trans:_,values:!g.keysOnly,reverse:g.dir==="prev",unique:!!g.unique,query:{index:I,range:g.range}})}function _y(g,y,_,I){var O=g.replayFilter?Ru(g.filter,g.replayFilter()):g.filter;if(g.or){var V={},J=function(ie,ge,we){var _e,le;O&&!O(ge,we,function(Fe){return ge.stop(Fe)},function(Fe){return ge.fail(Fe)})||((le=""+(_e=ge.primaryKey))=="[object ArrayBuffer]"&&(le=""+new Uint8Array(_e)),d(V,le)||(V[le]=!0,y(ie,ge,we)))};return Promise.all([g.or._iterate(J,_),pB(fB(g,I,_),g.algorithm,J,!g.keysOnly&&g.valueMapper)])}return pB(fB(g,I,_),Ru(g.algorithm,O),y,!g.keysOnly&&g.valueMapper)}function pB(g,y,_,I){var O=Fn(I?function(V,J,ie){return _(I(V),J,ie)}:_);return g.then(function(V){if(V)return V.start(function(){var J=function(){return V.continue()};y&&!y(V,function(ie){return J=ie},function(ie){V.stop(ie),J=Ge},function(ie){V.fail(ie),J=Ge})||O(V.value,V,function(ie){return J=ie}),J()})})}var pa=Symbol(),cp=(gB.prototype.execute=function(g){if(this.add!==void 0){var y=this.add;if(a(y))return o(o([],a(g)?g:[],!0),y).sort();if(typeof y=="number")return(Number(g)||0)+y;if(typeof y=="bigint")try{return BigInt(g)+y}catch{return BigInt(0)+y}throw new TypeError("Invalid term ".concat(y))}if(this.remove!==void 0){var _=this.remove;if(a(_))return a(g)?g.filter(function(I){return!_.includes(I)}).sort():[];if(typeof _=="number")return Number(g)-_;if(typeof _=="bigint")try{return BigInt(g)-_}catch{return BigInt(0)-_}throw new TypeError("Invalid subtrahend ".concat(_))}return y=(y=this.replacePrefix)===null||y===void 0?void 0:y[0],y&&typeof g=="string"&&g.startsWith(y)?this.replacePrefix[1]+g.substring(y.length):g},gB);function gB(g){Object.assign(this,g)}var nCe=(dn.prototype._read=function(g,y){var _=this._ctx;return _.error?_.table._trans(null,ss.bind(null,_.error)):_.table._trans("readonly",g).then(y)},dn.prototype._write=function(g){var y=this._ctx;return y.error?y.table._trans(null,ss.bind(null,y.error)):y.table._trans("readwrite",g,"locked")},dn.prototype._addAlgorithm=function(g){var y=this._ctx;y.algorithm=Ru(y.algorithm,g)},dn.prototype._iterate=function(g,y){return _y(this._ctx,g,y,this._ctx.table.core)},dn.prototype.clone=function(g){var y=Object.create(this.constructor.prototype),_=Object.create(this._ctx);return g&&l(_,g),y._ctx=_,y},dn.prototype.raw=function(){return this._ctx.valueMapper=null,this},dn.prototype.each=function(g){var y=this._ctx;return this._read(function(_){return _y(y,g,_,y.table.core)})},dn.prototype.count=function(g){var y=this;return this._read(function(_){var I=y._ctx,O=I.table.core;if(_d(I,!0))return O.count({trans:_,query:{index:Ey(I,O.schema),range:I.range}}).then(function(J){return Math.min(J,I.limit)});var V=0;return _y(I,function(){return++V,!1},_,O).then(function(){return V})}).then(g)},dn.prototype.sortBy=function(g,y){var _=g.split(".").reverse(),I=_[0],O=_.length-1;function V(ge,we){return we?V(ge[_[we]],we-1):ge[I]}var J=this._ctx.dir==="next"?1:-1;function ie(ge,we){return en(V(ge,O),V(we,O))*J}return this.toArray(function(ge){return ge.sort(ie)}).then(y)},dn.prototype.toArray=function(g){var y=this;return this._read(function(_){var I=y._ctx;if(I.dir==="next"&&_d(I,!0)&&0<I.limit){var O=I.valueMapper,V=Ey(I,I.table.core.schema);return I.table.core.query({trans:_,limit:I.limit,values:!0,query:{index:V,range:I.range}}).then(function(ie){return ie=ie.result,O?ie.map(O):ie})}var J=[];return _y(I,function(ie){return J.push(ie)},_,I.table.core).then(function(){return J})},g)},dn.prototype.offset=function(g){var y=this._ctx;return g<=0||(y.offset+=g,_d(y)?y_(y,function(){var _=g;return function(I,O){return _===0||(_===1?--_:O(function(){I.advance(_),_=0}),!1)}}):y_(y,function(){var _=g;return function(){return--_<0}})),this},dn.prototype.limit=function(g){return this._ctx.limit=Math.min(this._ctx.limit,g),y_(this._ctx,function(){var y=g;return function(_,I,O){return--y<=0&&I(O),0<=y}},!0),this},dn.prototype.until=function(g,y){return v_(this._ctx,function(_,I,O){return!g(_.value)||(I(O),y)}),this},dn.prototype.first=function(g){return this.limit(1).toArray(function(y){return y[0]}).then(g)},dn.prototype.last=function(g){return this.reverse().first(g)},dn.prototype.filter=function(g){var y;return v_(this._ctx,function(_){return g(_.value)}),(y=this._ctx).isMatch=Ru(y.isMatch,g),this},dn.prototype.and=function(g){return this.filter(g)},dn.prototype.or=function(g){return new this.db.WhereClause(this._ctx.table,g,this)},dn.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},dn.prototype.desc=function(){return this.reverse()},dn.prototype.eachKey=function(g){var y=this._ctx;return y.keysOnly=!y.isMatch,this.each(function(_,I){g(I.key,I)})},dn.prototype.eachUniqueKey=function(g){return this._ctx.unique="unique",this.eachKey(g)},dn.prototype.eachPrimaryKey=function(g){var y=this._ctx;return y.keysOnly=!y.isMatch,this.each(function(_,I){g(I.primaryKey,I)})},dn.prototype.keys=function(g){var y=this._ctx;y.keysOnly=!y.isMatch;var _=[];return this.each(function(I,O){_.push(O.key)}).then(function(){return _}).then(g)},dn.prototype.primaryKeys=function(g){var y=this._ctx;if(y.dir==="next"&&_d(y,!0)&&0<y.limit)return this._read(function(I){var O=Ey(y,y.table.core.schema);return y.table.core.query({trans:I,values:!1,limit:y.limit,query:{index:O,range:y.range}})}).then(function(I){return I.result}).then(g);y.keysOnly=!y.isMatch;var _=[];return this.each(function(I,O){_.push(O.primaryKey)}).then(function(){return _}).then(g)},dn.prototype.uniqueKeys=function(g){return this._ctx.unique="unique",this.keys(g)},dn.prototype.firstKey=function(g){return this.limit(1).keys(function(y){return y[0]}).then(g)},dn.prototype.lastKey=function(g){return this.reverse().firstKey(g)},dn.prototype.distinct=function(){var g=this._ctx,g=g.index&&g.table.schema.idxByName[g.index];if(!g||!g.multi)return this;var y={};return v_(this._ctx,function(O){var I=O.primaryKey.toString(),O=d(y,I);return y[I]=!0,!O}),this},dn.prototype.modify=function(g){var y=this,_=this._ctx;return this._write(function(I){var O,V,J;J=typeof g=="function"?g:(O=r(g),V=O.length,function(Ce){for(var Ae=!1,Oe=0;Oe<V;++Oe){var Ne=O[Oe],Ue=g[Ne],et=E(Ce,Ne);Ue instanceof cp?(T(Ce,Ne,Ue.execute(et)),Ae=!0):et!==Ue&&(T(Ce,Ne,Ue),Ae=!0)}return Ae});var ie=_.table.core,le=ie.schema.primaryKey,ge=le.outbound,we=le.extractKey,_e=200,le=y.db._options.modifyChunkSize;le&&(_e=typeof le=="object"?le[ie.name]||le["*"]||200:le);function Fe(Ce,Ne){var Oe=Ne.failures,Ne=Ne.numFailures;Ee+=Ce-Ne;for(var Ue=0,et=r(Oe);Ue<et.length;Ue++){var ft=et[Ue];ve.push(Oe[ft])}}var ve=[],Ee=0,De=[];return y.clone().primaryKeys().then(function(Ce){function Ae(Ne){var Ue=Math.min(_e,Ce.length-Ne);return ie.getMany({trans:I,keys:Ce.slice(Ne,Ne+Ue),cache:"immutable"}).then(function(et){for(var ft=[],tt=[],ot=ge?[]:null,gt=[],ct=0;ct<Ue;++ct){var bt=et[ct],jt={value:P(bt),primKey:Ce[Ne+ct]};J.call(jt,jt.value,jt)!==!1&&(jt.value==null?gt.push(Ce[Ne+ct]):ge||en(we(bt),we(jt.value))===0?(tt.push(jt.value),ge&&ot.push(Ce[Ne+ct])):(gt.push(Ce[Ne+ct]),ft.push(jt.value)))}return Promise.resolve(0<ft.length&&ie.mutate({trans:I,type:"add",values:ft}).then(function(Xt){for(var Jt in Xt.failures)gt.splice(parseInt(Jt),1);Fe(ft.length,Xt)})).then(function(){return(0<tt.length||Oe&&typeof g=="object")&&ie.mutate({trans:I,type:"put",keys:ot,values:tt,criteria:Oe,changeSpec:typeof g!="function"&&g,isAdditionalChunk:0<Ne}).then(function(Xt){return Fe(tt.length,Xt)})}).then(function(){return(0<gt.length||Oe&&g===w_)&&ie.mutate({trans:I,type:"delete",keys:gt,criteria:Oe,isAdditionalChunk:0<Ne}).then(function(Xt){return Fe(gt.length,Xt)})}).then(function(){return Ce.length>Ne+Ue&&Ae(Ne+_e)})})}var Oe=_d(_)&&_.limit===1/0&&(typeof g!="function"||g===w_)&&{index:_.index,range:_.range};return Ae(0).then(function(){if(0<ve.length)throw new Te("Error modifying one or more objects",ve,Ee,De);return Ce.length})})})},dn.prototype.delete=function(){var g=this._ctx,y=g.range;return _d(g)&&(g.isPrimKey||y.type===3)?this._write(function(_){var I=g.table.core.schema.primaryKey,O=y;return g.table.core.count({trans:_,query:{index:I,range:O}}).then(function(V){return g.table.core.mutate({trans:_,type:"deleteRange",range:O}).then(function(J){var ie=J.failures;if(J.lastResult,J.results,J=J.numFailures,J)throw new Te("Could not delete some values",Object.keys(ie).map(function(ge){return ie[ge]}),V-J);return V-J})})}):this.modify(w_)},dn);function dn(){}var w_=function(g,y){return y.value=null};function sCe(g,y){return g<y?-1:g===y?0:1}function oCe(g,y){return y<g?-1:g===y?0:1}function Oo(g,y,_){return g=g instanceof vB?new g.Collection(g):g,g._ctx.error=new(_||TypeError)(y),g}function Rd(g){return new g.Collection(g,function(){return mB("")}).limit(0)}function Ry(g,y,_,I){var O,V,J,ie,ge,we,_e,le=_.length;if(!_.every(function(Ee){return typeof Ee=="string"}))return Oo(g,aB);function Fe(Ee){O=Ee==="next"?function(Ce){return Ce.toUpperCase()}:function(Ce){return Ce.toLowerCase()},V=Ee==="next"?function(Ce){return Ce.toLowerCase()}:function(Ce){return Ce.toUpperCase()},J=Ee==="next"?sCe:oCe;var De=_.map(function(Ce){return{lower:V(Ce),upper:O(Ce)}}).sort(function(Ce,Ae){return J(Ce.lower,Ae.lower)});ie=De.map(function(Ce){return Ce.upper}),ge=De.map(function(Ce){return Ce.lower}),_e=(we=Ee)==="next"?"":I}Fe("next"),g=new g.Collection(g,function(){return ul(ie[0],ge[le-1]+I)}),g._ondirectionchange=function(Ee){Fe(Ee)};var ve=0;return g._addAlgorithm(function(Ee,De,Ce){var Ae=Ee.key;if(typeof Ae!="string")return!1;var Oe=V(Ae);if(y(Oe,ge,ve))return!0;for(var Ne=null,Ue=ve;Ue<le;++Ue){var et=function(ft,tt,ot,gt,ct,bt){for(var jt=Math.min(ft.length,gt.length),Xt=-1,Jt=0;Jt<jt;++Jt){var Mo=tt[Jt];if(Mo!==gt[Jt])return ct(ft[Jt],ot[Jt])<0?ft.substr(0,Jt)+ot[Jt]+ot.substr(Jt+1):ct(ft[Jt],gt[Jt])<0?ft.substr(0,Jt)+gt[Jt]+ot.substr(Jt+1):0<=Xt?ft.substr(0,Xt)+tt[Xt]+ot.substr(Xt+1):null;ct(ft[Jt],Mo)<0&&(Xt=Jt)}return jt<gt.length&&bt==="next"?ft+ot.substr(ft.length):jt<ft.length&&bt==="prev"?ft.substr(0,ot.length):Xt<0?null:ft.substr(0,Xt)+gt[Xt]+ot.substr(Xt+1)}(Ae,Oe,ie[Ue],ge[Ue],J,we);et===null&&Ne===null?ve=Ue+1:(Ne===null||0<J(Ne,et))&&(Ne=et)}return De(Ne!==null?function(){Ee.continue(Ne+_e)}:Ce),!1}),g}function ul(g,y,_,I){return{type:2,lower:g,upper:y,lowerOpen:_,upperOpen:I}}function mB(g){return{type:1,lower:g,upper:g}}var vB=(Object.defineProperty(_s.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),_s.prototype.between=function(g,y,_,I){_=_!==!1,I=I===!0;try{return 0<this._cmp(g,y)||this._cmp(g,y)===0&&(_||I)&&(!_||!I)?Rd(this):new this.Collection(this,function(){return ul(g,y,!_,!I)})}catch{return Oo(this,fa)}},_s.prototype.equals=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return mB(g)})},_s.prototype.above=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(g,void 0,!0)})},_s.prototype.aboveOrEqual=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(g,void 0,!1)})},_s.prototype.below=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(void 0,g,!1,!0)})},_s.prototype.belowOrEqual=function(g){return g==null?Oo(this,fa):new this.Collection(this,function(){return ul(void 0,g)})},_s.prototype.startsWith=function(g){return typeof g!="string"?Oo(this,aB):this.between(g,g+_u,!0,!0)},_s.prototype.startsWithIgnoreCase=function(g){return g===""?this.startsWith(g):Ry(this,function(y,_){return y.indexOf(_[0])===0},[g],_u)},_s.prototype.equalsIgnoreCase=function(g){return Ry(this,function(y,_){return y===_[0]},[g],"")},_s.prototype.anyOfIgnoreCase=function(){var g=G.apply(oe,arguments);return g.length===0?Rd(this):Ry(this,function(y,_){return _.indexOf(y)!==-1},g,"")},_s.prototype.startsWithAnyOfIgnoreCase=function(){var g=G.apply(oe,arguments);return g.length===0?Rd(this):Ry(this,function(y,_){return _.some(function(I){return y.indexOf(I)===0})},g,_u)},_s.prototype.anyOf=function(){var g=this,y=G.apply(oe,arguments),_=this._cmp;try{y.sort(_)}catch{return Oo(this,fa)}if(y.length===0)return Rd(this);var I=new this.Collection(this,function(){return ul(y[0],y[y.length-1])});I._ondirectionchange=function(V){_=V==="next"?g._ascending:g._descending,y.sort(_)};var O=0;return I._addAlgorithm(function(V,J,ie){for(var ge=V.key;0<_(ge,y[O]);)if(++O===y.length)return J(ie),!1;return _(ge,y[O])===0||(J(function(){V.continue(y[O])}),!1)}),I},_s.prototype.notEqual=function(g){return this.inAnyRange([[-1/0,g],[g,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},_s.prototype.noneOf=function(){var g=G.apply(oe,arguments);if(g.length===0)return new this.Collection(this);try{g.sort(this._ascending)}catch{return Oo(this,fa)}var y=g.reduce(function(_,I){return _?_.concat([[_[_.length-1][1],I]]):[[-1/0,I]]},null);return y.push([g[g.length-1],this.db._maxKey]),this.inAnyRange(y,{includeLowers:!1,includeUppers:!1})},_s.prototype.inAnyRange=function(Ae,y){var _=this,I=this._cmp,O=this._ascending,V=this._descending,J=this._min,ie=this._max;if(Ae.length===0)return Rd(this);if(!Ae.every(function(Oe){return Oe[0]!==void 0&&Oe[1]!==void 0&&O(Oe[0],Oe[1])<=0}))return Oo(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",te.InvalidArgument);var ge=!y||y.includeLowers!==!1,we=y&&y.includeUppers===!0,_e,le=O;function Fe(Oe,Ne){return le(Oe[0],Ne[0])}try{(_e=Ae.reduce(function(Oe,Ne){for(var Ue=0,et=Oe.length;Ue<et;++Ue){var ft=Oe[Ue];if(I(Ne[0],ft[1])<0&&0<I(Ne[1],ft[0])){ft[0]=J(ft[0],Ne[0]),ft[1]=ie(ft[1],Ne[1]);break}}return Ue===et&&Oe.push(Ne),Oe},[])).sort(Fe)}catch{return Oo(this,fa)}var ve=0,Ee=we?function(Oe){return 0<O(Oe,_e[ve][1])}:function(Oe){return 0<=O(Oe,_e[ve][1])},De=ge?function(Oe){return 0<V(Oe,_e[ve][0])}:function(Oe){return 0<=V(Oe,_e[ve][0])},Ce=Ee,Ae=new this.Collection(this,function(){return ul(_e[0][0],_e[_e.length-1][1],!ge,!we)});return Ae._ondirectionchange=function(Oe){le=Oe==="next"?(Ce=Ee,O):(Ce=De,V),_e.sort(Fe)},Ae._addAlgorithm(function(Oe,Ne,Ue){for(var et,ft=Oe.key;Ce(ft);)if(++ve===_e.length)return Ne(Ue),!1;return!Ee(et=ft)&&!De(et)||(_._cmp(ft,_e[ve][1])===0||_._cmp(ft,_e[ve][0])===0||Ne(function(){le===O?Oe.continue(_e[ve][0]):Oe.continue(_e[ve][1])}),!1)}),Ae},_s.prototype.startsWithAnyOf=function(){var g=G.apply(oe,arguments);return g.every(function(y){return typeof y=="string"})?g.length===0?Rd(this):this.inAnyRange(g.map(function(y){return[y,y+_u]})):Oo(this,"startsWithAnyOf() only works with strings")},_s);function _s(){}function Rr(g){return Fn(function(y){return dp(y),g(y.target.error),!1})}function dp(g){g.stopPropagation&&g.stopPropagation(),g.preventDefault&&g.preventDefault()}var hp="storagemutated",C_="x-storagemutated-1",cl=lp(null,hp),iCe=(Dr.prototype._lock=function(){return C(!He.global),++this._reculock,this._reculock!==1||He.global||(He.lockOwnerFor=this),this},Dr.prototype._unlock=function(){if(C(!He.global),--this._reculock==0)for(He.global||(He.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var g=this._blockedFuncs.shift();try{ha(g[1],g[0])}catch{}}return this},Dr.prototype._locked=function(){return this._reculock&&He.lockOwnerFor!==this},Dr.prototype.create=function(g){var y=this;if(!this.mode)return this;var _=this.db.idbdb,I=this.db._state.dbOpenError;if(C(!this.idbtrans),!g&&!_)switch(I&&I.name){case"DatabaseClosedError":throw new te.DatabaseClosed(I);case"MissingAPIError":throw new te.MissingAPI(I.message,I);default:throw new te.OpenFailed(I)}if(!this.active)throw new te.TransactionInactive;return C(this._completion._state===null),(g=this.idbtrans=g||(this.db.core||_).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Fn(function(O){dp(O),y._reject(g.error)}),g.onabort=Fn(function(O){dp(O),y.active&&y._reject(new te.Abort(g.error)),y.active=!1,y.on("abort").fire(O)}),g.oncomplete=Fn(function(){y.active=!1,y._resolve(),"mutatedParts"in g&&cl.storagemutated.fire(g.mutatedParts)}),this},Dr.prototype._promise=function(g,y,_){var I=this;if(g==="readwrite"&&this.mode!=="readwrite")return ss(new te.ReadOnly("Transaction is readonly"));if(!this.active)return ss(new te.TransactionInactive);if(this._locked())return new Je(function(V,J){I._blockedFuncs.push([function(){I._promise(g,y,_).then(V,J)},He])});if(_)return As(function(){var V=new Je(function(J,ie){I._lock();var ge=y(J,ie,I);ge&&ge.then&&ge.then(J,ie)});return V.finally(function(){return I._unlock()}),V._lib=!0,V});var O=new Je(function(V,J){var ie=y(V,J,I);ie&&ie.then&&ie.then(V,J)});return O._lib=!0,O},Dr.prototype._root=function(){return this.parent?this.parent._root():this},Dr.prototype.waitFor=function(g){var y,_=this._root(),I=Je.resolve(g);_._waitingFor?_._waitingFor=_._waitingFor.then(function(){return I}):(_._waitingFor=I,_._waitingQueue=[],y=_.idbtrans.objectStore(_.storeNames[0]),function V(){for(++_._spinCount;_._waitingQueue.length;)_._waitingQueue.shift()();_._waitingFor&&(y.get(-1/0).onsuccess=V)}());var O=_._waitingFor;return new Je(function(V,J){I.then(function(ie){return _._waitingQueue.push(Fn(V.bind(null,ie)))},function(ie){return _._waitingQueue.push(Fn(J.bind(null,ie)))}).finally(function(){_._waitingFor===O&&(_._waitingFor=null)})})},Dr.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new te.Abort))},Dr.prototype.table=function(g){var y=this._memoizedTables||(this._memoizedTables={});if(d(y,g))return y[g];var _=this.schema[g];if(!_)throw new te.NotFound("Table "+g+" not part of transaction");return _=new this.db.Table(g,_,this),_.core=this.db.core.table(g),y[g]=_},Dr);function Dr(){}function b_(g,y,_,I,O,V,J){return{name:g,keyPath:y,unique:_,multi:I,auto:O,compound:V,src:(_&&!J?"&":"")+(I?"*":"")+(O?"++":"")+yB(y)}}function yB(g){return typeof g=="string"?g:g?"["+[].join.call(g,"+")+"]":""}function S_(g,y,_){return{name:g,primKey:y,indexes:_,mappedClass:null,idxByName:(I=function(O){return[O.name,O]},_.reduce(function(O,V,J){return J=I(V,J),J&&(O[J[0]]=J[1]),O},{}))};var I}var fp=function(g){try{return g.only([[]]),fp=function(){return[[]]},[[]]}catch{return fp=function(){return _u},_u}};function E_(g){return g==null?function(){}:typeof g=="string"?(y=g).split(".").length===1?function(_){return _[y]}:function(_){return E(_,y)}:function(_){return E(_,g)};var y}function wB(g){return[].slice.call(g)}var rCe=0;function pp(g){return g==null?":id":typeof g=="string"?g:"[".concat(g.join("+"),"]")}function aCe(g,y,ge){function I(Ce){if(Ce.type===3)return null;if(Ce.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var ve=Ce.lower,Ee=Ce.upper,De=Ce.lowerOpen,Ce=Ce.upperOpen;return ve===void 0?Ee===void 0?null:y.upperBound(Ee,!!Ce):Ee===void 0?y.lowerBound(ve,!!De):y.bound(ve,Ee,!!De,!!Ce)}function O(Fe){var ve,Ee=Fe.name;return{name:Ee,schema:Fe,mutate:function(De){var Ce=De.trans,Ae=De.type,Oe=De.keys,Ne=De.values,Ue=De.range;return new Promise(function(et,ft){et=Fn(et);var tt=Ce.objectStore(Ee),ot=tt.keyPath==null,gt=Ae==="put"||Ae==="add";if(!gt&&Ae!=="delete"&&Ae!=="deleteRange")throw new Error("Invalid operation type: "+Ae);var ct,bt=(Oe||Ne||{length:1}).length;if(Oe&&Ne&&Oe.length!==Ne.length)throw new Error("Given keys array must have same length as given values array.");if(bt===0)return et({numFailures:0,failures:{},results:[],lastResult:void 0});function jt(to){++Mo,dp(to)}var Xt=[],Jt=[],Mo=0;if(Ae==="deleteRange"){if(Ue.type===4)return et({numFailures:Mo,failures:Jt,results:[],lastResult:void 0});Ue.type===3?Xt.push(ct=tt.clear()):Xt.push(ct=tt.delete(I(Ue)))}else{var ot=gt?ot?[Ne,Oe]:[Ne,null]:[Oe,null],Ut=ot[0],Ks=ot[1];if(gt)for(var qs=0;qs<bt;++qs)Xt.push(ct=Ks&&Ks[qs]!==void 0?tt[Ae](Ut[qs],Ks[qs]):tt[Ae](Ut[qs])),ct.onerror=jt;else for(qs=0;qs<bt;++qs)Xt.push(ct=tt[Ae](Ut[qs])),ct.onerror=jt}function Vy(to){to=to.target.result,Xt.forEach(function(xu,H_){return xu.error!=null&&(Jt[H_]=xu.error)}),et({numFailures:Mo,failures:Jt,results:Ae==="delete"?Oe:Xt.map(function(xu){return xu.result}),lastResult:to})}ct.onerror=function(to){jt(to),Vy(to)},ct.onsuccess=Vy})},getMany:function(De){var Ce=De.trans,Ae=De.keys;return new Promise(function(Oe,Ne){Oe=Fn(Oe);for(var Ue,et=Ce.objectStore(Ee),ft=Ae.length,tt=new Array(ft),ot=0,gt=0,ct=function(Xt){Xt=Xt.target,tt[Xt._pos]=Xt.result,++gt===ot&&Oe(tt)},bt=Rr(Ne),jt=0;jt<ft;++jt)Ae[jt]!=null&&((Ue=et.get(Ae[jt]))._pos=jt,Ue.onsuccess=ct,Ue.onerror=bt,++ot);ot===0&&Oe(tt)})},get:function(De){var Ce=De.trans,Ae=De.key;return new Promise(function(Oe,Ne){Oe=Fn(Oe);var Ue=Ce.objectStore(Ee).get(Ae);Ue.onsuccess=function(et){return Oe(et.target.result)},Ue.onerror=Rr(Ne)})},query:(ve=we,function(De){return new Promise(function(Ce,Ae){Ce=Fn(Ce);var Oe,Ne,Ue,ot=De.trans,et=De.values,ft=De.limit,ct=De.query,tt=ft===1/0?void 0:ft,gt=ct.index,ct=ct.range,ot=ot.objectStore(Ee),gt=gt.isPrimaryKey?ot:ot.index(gt.name),ct=I(ct);if(ft===0)return Ce({result:[]});ve?((tt=et?gt.getAll(ct,tt):gt.getAllKeys(ct,tt)).onsuccess=function(bt){return Ce({result:bt.target.result})},tt.onerror=Rr(Ae)):(Oe=0,Ne=!et&&"openKeyCursor"in gt?gt.openKeyCursor(ct):gt.openCursor(ct),Ue=[],Ne.onsuccess=function(bt){var jt=Ne.result;return jt?(Ue.push(et?jt.value:jt.primaryKey),++Oe===ft?Ce({result:Ue}):void jt.continue()):Ce({result:Ue})},Ne.onerror=Rr(Ae))})}),openCursor:function(De){var Ce=De.trans,Ae=De.values,Oe=De.query,Ne=De.reverse,Ue=De.unique;return new Promise(function(et,ft){et=Fn(et);var gt=Oe.index,tt=Oe.range,ot=Ce.objectStore(Ee),ot=gt.isPrimaryKey?ot:ot.index(gt.name),gt=Ne?Ue?"prevunique":"prev":Ue?"nextunique":"next",ct=!Ae&&"openKeyCursor"in ot?ot.openKeyCursor(I(tt),gt):ot.openCursor(I(tt),gt);ct.onerror=Rr(ft),ct.onsuccess=Fn(function(bt){var jt,Xt,Jt,Mo,Ut=ct.result;Ut?(Ut.___id=++rCe,Ut.done=!1,jt=Ut.continue.bind(Ut),Xt=(Xt=Ut.continuePrimaryKey)&&Xt.bind(Ut),Jt=Ut.advance.bind(Ut),Mo=function(){throw new Error("Cursor not stopped")},Ut.trans=Ce,Ut.stop=Ut.continue=Ut.continuePrimaryKey=Ut.advance=function(){throw new Error("Cursor not started")},Ut.fail=Fn(ft),Ut.next=function(){var Ks=this,qs=1;return this.start(function(){return qs--?Ks.continue():Ks.stop()}).then(function(){return Ks})},Ut.start=function(Ks){function qs(){if(ct.result)try{Ks()}catch(to){Ut.fail(to)}else Ut.done=!0,Ut.start=function(){throw new Error("Cursor behind last entry")},Ut.stop()}var Vy=new Promise(function(to,xu){to=Fn(to),ct.onerror=Rr(xu),Ut.fail=xu,Ut.stop=function(H_){Ut.stop=Ut.continue=Ut.continuePrimaryKey=Ut.advance=Mo,to(H_)}});return ct.onsuccess=Fn(function(to){ct.onsuccess=qs,qs()}),Ut.continue=jt,Ut.continuePrimaryKey=Xt,Ut.advance=Jt,qs(),Vy},et(Ut)):et(null)},ft)})},count:function(De){var Ce=De.query,Ae=De.trans,Oe=Ce.index,Ne=Ce.range;return new Promise(function(Ue,et){var ft=Ae.objectStore(Ee),tt=Oe.isPrimaryKey?ft:ft.index(Oe.name),ft=I(Ne),tt=ft?tt.count(ft):tt.count();tt.onsuccess=Fn(function(ot){return Ue(ot.target.result)}),tt.onerror=Rr(et)})}}}var V,J,ie,_e=(J=ge,ie=wB((V=g).objectStoreNames),{schema:{name:V.name,tables:ie.map(function(Fe){return J.objectStore(Fe)}).map(function(Fe){var ve=Fe.keyPath,Ce=Fe.autoIncrement,Ee=a(ve),De={},Ce={name:Fe.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:ve==null,compound:Ee,keyPath:ve,autoIncrement:Ce,unique:!0,extractKey:E_(ve)},indexes:wB(Fe.indexNames).map(function(Ae){return Fe.index(Ae)}).map(function(Ue){var Oe=Ue.name,Ne=Ue.unique,et=Ue.multiEntry,Ue=Ue.keyPath,et={name:Oe,compound:a(Ue),keyPath:Ue,unique:Ne,multiEntry:et,extractKey:E_(Ue)};return De[pp(Ue)]=et}),getIndexByKeyPath:function(Ae){return De[pp(Ae)]}};return De[":id"]=Ce.primaryKey,ve!=null&&(De[pp(ve)]=Ce.primaryKey),Ce})},hasGetAll:0<ie.length&&"getAll"in J.objectStore(ie[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),ge=_e.schema,we=_e.hasGetAll,_e=ge.tables.map(O),le={};return _e.forEach(function(Fe){return le[Fe.name]=Fe}),{stack:"dbcore",transaction:g.transaction.bind(g),table:function(Fe){if(!le[Fe])throw new Error("Table '".concat(Fe,"' not found"));return le[Fe]},MIN_KEY:-1/0,MAX_KEY:fp(y),schema:ge}}function lCe(g,y,_,I){var O=_.IDBKeyRange;return _.indexedDB,{dbcore:(I=aCe(y,O,I),g.dbcore.reduce(function(V,J){return J=J.create,s(s({},V),J(V))},I))}}function Dy(g,I){var _=I.db,I=lCe(g._middlewares,_,g._deps,I);g.core=I.dbcore,g.tables.forEach(function(O){var V=O.name;g.core.schema.tables.some(function(J){return J.name===V})&&(O.core=g.core.table(V),g[V]instanceof g.Table&&(g[V].core=O.core))})}function Ty(g,y,_,I){_.forEach(function(O){var V=I[O];y.forEach(function(J){var ie=function ge(we,_e){return v(we,_e)||(we=u(we))&&ge(we,_e)}(J,O);(!ie||"value"in ie&&ie.value===void 0)&&(J===g.Transaction.prototype||J instanceof g.Transaction?p(J,O,{get:function(){return this.table(O)},set:function(ge){f(this,O,{value:ge,writable:!0,configurable:!0,enumerable:!0})}}):J[O]=new g.Table(O,V))})})}function __(g,y){y.forEach(function(_){for(var I in _)_[I]instanceof g.Table&&delete _[I]})}function uCe(g,y){return g._cfg.version-y._cfg.version}function cCe(g,y,_,I){var O=g._dbSchema;_.objectStoreNames.contains("$meta")&&!O.$meta&&(O.$meta=S_("$meta",bB("")[0],[]),g._storeNames.push("$meta"));var V=g._createTransaction("readwrite",g._storeNames,O);V.create(_),V._completion.catch(I);var J=V._reject.bind(V),ie=He.transless||He;As(function(){return He.trans=V,He.transless=ie,y!==0?(Dy(g,_),we=y,((ge=V).storeNames.includes("$meta")?ge.table("$meta").get("version").then(function(_e){return _e??we}):Je.resolve(we)).then(function(_e){return Fe=_e,ve=V,Ee=_,De=[],_e=(le=g)._versions,Ce=le._dbSchema=Fy(0,le.idbdb,Ee),(_e=_e.filter(function(Ae){return Ae._cfg.version>=Fe})).length!==0?(_e.forEach(function(Ae){De.push(function(){var Oe=Ce,Ne=Ae._cfg.dbschema;Iy(le,Oe,Ee),Iy(le,Ne,Ee),Ce=le._dbSchema=Ne;var Ue=R_(Oe,Ne);Ue.add.forEach(function(gt){D_(Ee,gt[0],gt[1].primKey,gt[1].indexes)}),Ue.change.forEach(function(gt){if(gt.recreate)throw new te.Upgrade("Not yet support for changing primary key");var ct=Ee.objectStore(gt.name);gt.add.forEach(function(bt){return xy(ct,bt)}),gt.change.forEach(function(bt){ct.deleteIndex(bt.name),xy(ct,bt)}),gt.del.forEach(function(bt){return ct.deleteIndex(bt)})});var et=Ae._cfg.contentUpgrade;if(et&&Ae._cfg.version>Fe){Dy(le,Ee),ve._memoizedTables={};var ft=k(Ne);Ue.del.forEach(function(gt){ft[gt]=Oe[gt]}),__(le,[le.Transaction.prototype]),Ty(le,[le.Transaction.prototype],r(ft),ft),ve.schema=ft;var tt,ot=Q(et);return ot&&ca(),Ue=Je.follow(function(){var gt;(tt=et(ve))&&ot&&(gt=Li.bind(null,null),tt.then(gt,gt))}),tt&&typeof tt.then=="function"?Je.resolve(tt):Ue.then(function(){return tt})}}),De.push(function(Oe){var Ne,Ue,et=Ae._cfg.dbschema;Ne=et,Ue=Oe,[].slice.call(Ue.db.objectStoreNames).forEach(function(ft){return Ne[ft]==null&&Ue.db.deleteObjectStore(ft)}),__(le,[le.Transaction.prototype]),Ty(le,[le.Transaction.prototype],le._storeNames,le._dbSchema),ve.schema=le._dbSchema}),De.push(function(Oe){le.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(le.idbdb.version/10)===Ae._cfg.version?(le.idbdb.deleteObjectStore("$meta"),delete le._dbSchema.$meta,le._storeNames=le._storeNames.filter(function(Ne){return Ne!=="$meta"})):Oe.objectStore("$meta").put(Ae._cfg.version,"version"))})}),function Ae(){return De.length?Je.resolve(De.shift()(ve.idbtrans)).then(Ae):Je.resolve()}().then(function(){CB(Ce,Ee)})):Je.resolve();var le,Fe,ve,Ee,De,Ce}).catch(J)):(r(O).forEach(function(_e){D_(_,_e,O[_e].primKey,O[_e].indexes)}),Dy(g,_),void Je.follow(function(){return g.on.populate.fire(V)}).catch(J));var ge,we})}function dCe(g,y){CB(g._dbSchema,y),y.db.version%10!=0||y.objectStoreNames.contains("$meta")||y.db.createObjectStore("$meta").add(Math.ceil(y.db.version/10-1),"version");var _=Fy(0,g.idbdb,y);Iy(g,g._dbSchema,y);for(var I=0,O=R_(_,g._dbSchema).change;I<O.length;I++){var V=function(J){if(J.change.length||J.recreate)return console.warn("Unable to patch indexes of table ".concat(J.name," because it has changes on the type of index or primary key.")),{value:void 0};var ie=y.objectStore(J.name);J.add.forEach(function(ge){me&&console.debug("Dexie upgrade patch: Creating missing index ".concat(J.name,".").concat(ge.src)),xy(ie,ge)})}(O[I]);if(typeof V=="object")return V.value}}function R_(g,y){var _,I={del:[],add:[],change:[]};for(_ in g)y[_]||I.del.push(_);for(_ in y){var O=g[_],V=y[_];if(O){var J={name:_,def:V,recreate:!1,del:[],add:[],change:[]};if(""+(O.primKey.keyPath||"")!=""+(V.primKey.keyPath||"")||O.primKey.auto!==V.primKey.auto)J.recreate=!0,I.change.push(J);else{var ie=O.idxByName,ge=V.idxByName,we=void 0;for(we in ie)ge[we]||J.del.push(we);for(we in ge){var _e=ie[we],le=ge[we];_e?_e.src!==le.src&&J.change.push(le):J.add.push(le)}(0<J.del.length||0<J.add.length||0<J.change.length)&&I.change.push(J)}}else I.add.push([_,V])}return I}function D_(g,y,_,I){var O=g.db.createObjectStore(y,_.keyPath?{keyPath:_.keyPath,autoIncrement:_.auto}:{autoIncrement:_.auto});return I.forEach(function(V){return xy(O,V)}),O}function CB(g,y){r(g).forEach(function(_){y.db.objectStoreNames.contains(_)||(me&&console.debug("Dexie: Creating missing table",_),D_(y,_,g[_].primKey,g[_].indexes))})}function xy(g,y){g.createIndex(y.name,y.keyPath,{unique:y.unique,multiEntry:y.multi})}function Fy(g,y,_){var I={};return b(y.objectStoreNames,0).forEach(function(O){for(var V=_.objectStore(O),J=b_(yB(we=V.keyPath),we||"",!0,!1,!!V.autoIncrement,we&&typeof we!="string",!0),ie=[],ge=0;ge<V.indexNames.length;++ge){var _e=V.index(V.indexNames[ge]),we=_e.keyPath,_e=b_(_e.name,we,!!_e.unique,!!_e.multiEntry,!1,we&&typeof we!="string",!1);ie.push(_e)}I[O]=S_(O,J,ie)}),I}function Iy(g,y,_){for(var I=_.db.objectStoreNames,O=0;O<I.length;++O){var V=I[O],J=_.objectStore(V);g._hasGetAll="getAll"in J;for(var ie=0;ie<J.indexNames.length;++ie){var ge=J.indexNames[ie],we=J.index(ge).keyPath,_e=typeof we=="string"?we:"["+b(we).join("+")+"]";!y[V]||(we=y[V].idxByName[_e])&&(we.name=ge,delete y[V].idxByName[_e],y[V].idxByName[ge]=we)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(g._hasGetAll=!1)}function bB(g){return g.split(",").map(function(y,_){var I=(y=y.trim()).replace(/([&*]|\+\+)/g,""),O=/^\[/.test(I)?I.match(/^\[(.*)\]$/)[1].split("+"):I;return b_(I,O||null,/\&/.test(y),/\*/.test(y),/\+\+/.test(y),a(O),_===0)})}var hCe=(Py.prototype._parseStoresSpec=function(g,y){r(g).forEach(function(_){if(g[_]!==null){var I=bB(g[_]),O=I.shift();if(O.unique=!0,O.multi)throw new te.Schema("Primary key cannot be multi-valued");I.forEach(function(V){if(V.auto)throw new te.Schema("Only primary key can be marked as autoIncrement (++)");if(!V.keyPath)throw new te.Schema("Index must have a name and cannot be an empty string")}),y[_]=S_(_,O,I)}})},Py.prototype.stores=function(_){var y=this.db;this._cfg.storesSource=this._cfg.storesSource?l(this._cfg.storesSource,_):_;var _=y._versions,I={},O={};return _.forEach(function(V){l(I,V._cfg.storesSource),O=V._cfg.dbschema={},V._parseStoresSpec(I,O)}),y._dbSchema=O,__(y,[y._allTables,y,y.Transaction.prototype]),Ty(y,[y._allTables,y,y.Transaction.prototype,this._cfg.tables],r(O),O),y._storeNames=r(O),this},Py.prototype.upgrade=function(g){return this._cfg.contentUpgrade=X(this._cfg.contentUpgrade||Ge,g),this},Py);function Py(){}function T_(g,y){var _=g._dbNamesDB;return _||(_=g._dbNamesDB=new ga(by,{addons:[],indexedDB:g,IDBKeyRange:y})).version(1).stores({dbnames:"name"}),_.table("dbnames")}function x_(g){return g&&typeof g.databases=="function"}function F_(g){return As(function(){return He.letThrough=!0,g()})}function I_(g){return!("from"in g)}var js=function(g,y){if(!this){var _=new js;return g&&"d"in g&&l(_,g),_}l(this,arguments.length?{d:1,from:g,to:1<arguments.length?y:g}:{d:0})};function gp(g,y,_){var I=en(y,_);if(!isNaN(I)){if(0<I)throw RangeError();if(I_(g))return l(g,{from:y,to:_,d:1});var O=g.l,I=g.r;if(en(_,g.from)<0)return O?gp(O,y,_):g.l={from:y,to:_,d:1,l:null,r:null},EB(g);if(0<en(y,g.to))return I?gp(I,y,_):g.r={from:y,to:_,d:1,l:null,r:null},EB(g);en(y,g.from)<0&&(g.from=y,g.l=null,g.d=I?I.d+1:1),0<en(_,g.to)&&(g.to=_,g.r=null,g.d=g.l?g.l.d+1:1),_=!g.r,O&&!g.l&&mp(g,O),I&&_&&mp(g,I)}}function mp(g,y){I_(y)||function _(I,ge){var V=ge.from,J=ge.to,ie=ge.l,ge=ge.r;gp(I,V,J),ie&&_(I,ie),ge&&_(I,ge)}(g,y)}function SB(g,y){var _=Ay(y),I=_.next();if(I.done)return!1;for(var O=I.value,V=Ay(g),J=V.next(O.from),ie=J.value;!I.done&&!J.done;){if(en(ie.from,O.to)<=0&&0<=en(ie.to,O.from))return!0;en(O.from,ie.from)<0?O=(I=_.next(ie.from)).value:ie=(J=V.next(O.from)).value}return!1}function Ay(g){var y=I_(g)?null:{s:0,n:g};return{next:function(_){for(var I=0<arguments.length;y;)switch(y.s){case 0:if(y.s=1,I)for(;y.n.l&&en(_,y.n.from)<0;)y={up:y,n:y.n.l,s:1};else for(;y.n.l;)y={up:y,n:y.n.l,s:1};case 1:if(y.s=2,!I||en(_,y.n.to)<=0)return{value:y.n,done:!1};case 2:if(y.n.r){y.s=3,y={up:y,n:y.n.r,s:0};continue}case 3:y=y.up}return{done:!0}}}}function EB(g){var y,_,I=(((y=g.r)===null||y===void 0?void 0:y.d)||0)-(((_=g.l)===null||_===void 0?void 0:_.d)||0),O=1<I?"r":I<-1?"l":"";O&&(y=O=="r"?"l":"r",_=s({},g),I=g[O],g.from=I.from,g.to=I.to,g[O]=I[O],_[O]=I[y],(g[y]=_).d=_B(_)),g.d=_B(g)}function _B(_){var y=_.r,_=_.l;return(y?_?Math.max(y.d,_.d):y.d:_?_.d:0)+1}function ky(g,y){return r(y).forEach(function(_){g[_]?mp(g[_],y[_]):g[_]=function I(O){var V,J,ie={};for(V in O)d(O,V)&&(J=O[V],ie[V]=!J||typeof J!="object"||D.has(J.constructor)?J:I(J));return ie}(y[_])}),g}function P_(g,y){return g.all||y.all||Object.keys(g).some(function(_){return y[_]&&SB(y[_],g[_])})}h(js.prototype,((ui={add:function(g){return mp(this,g),this},addKey:function(g){return gp(this,g,g),this},addKeys:function(g){var y=this;return g.forEach(function(_){return gp(y,_,_)}),this},hasKey:function(g){var y=Ay(this).next(g).value;return y&&en(y.from,g)<=0&&0<=en(y.to,g)}})[B]=function(){return Ay(this)},ui));var Du={},A_={},k_=!1;function Oy(g){ky(A_,g),k_||(k_=!0,setTimeout(function(){k_=!1,O_(A_,!(A_={}))},0))}function O_(g,y){y===void 0&&(y=!1);var _=new Set;if(g.all)for(var I=0,O=Object.values(Du);I<O.length;I++)RB(J=O[I],g,_,y);else for(var V in g){var J,ie=/^idb\:\/\/(.*)\/(.*)\//.exec(V);ie&&(V=ie[1],ie=ie[2],(J=Du["idb://".concat(V,"/").concat(ie)])&&RB(J,g,_,y))}_.forEach(function(ge){return ge()})}function RB(g,y,_,I){for(var O=[],V=0,J=Object.entries(g.queries.query);V<J.length;V++){for(var ie=J[V],ge=ie[0],we=[],_e=0,le=ie[1];_e<le.length;_e++){var Fe=le[_e];P_(y,Fe.obsSet)?Fe.subscribers.forEach(function(Ce){return _.add(Ce)}):I&&we.push(Fe)}I&&O.push([ge,we])}if(I)for(var ve=0,Ee=O;ve<Ee.length;ve++){var De=Ee[ve],ge=De[0],we=De[1];g.queries.query[ge]=we}}function fCe(g){var y=g._state,_=g._deps.indexedDB;if(y.isBeingOpened||g.idbdb)return y.dbReadyPromise.then(function(){return y.dbOpenError?ss(y.dbOpenError):g});y.isBeingOpened=!0,y.dbOpenError=null,y.openComplete=!1;var I=y.openCanceller,O=Math.round(10*g.verno),V=!1;function J(){if(y.openCanceller!==I)throw new te.DatabaseClosed("db.open() was cancelled")}function ie(){return new Je(function(Fe,ve){if(J(),!_)throw new te.MissingAPI;var Ee=g.name,De=y.autoSchema||!O?_.open(Ee):_.open(Ee,O);if(!De)throw new te.MissingAPI;De.onerror=Rr(ve),De.onblocked=Fn(g._fireOnBlocked),De.onupgradeneeded=Fn(function(Ce){var Ae;_e=De.transaction,y.autoSchema&&!g._options.allowEmptyDB?(De.onerror=dp,_e.abort(),De.result.close(),(Ae=_.deleteDatabase(Ee)).onsuccess=Ae.onerror=Fn(function(){ve(new te.NoSuchDatabase("Database ".concat(Ee," doesnt exist")))})):(_e.onerror=Rr(ve),Ce=Ce.oldVersion>Math.pow(2,62)?0:Ce.oldVersion,le=Ce<1,g.idbdb=De.result,V&&dCe(g,_e),cCe(g,Ce/10,_e,ve))},ve),De.onsuccess=Fn(function(){_e=null;var Ce,Ae,Oe,Ne,Ue,et=g.idbdb=De.result,ft=b(et.objectStoreNames);if(0<ft.length)try{var tt=et.transaction((Ne=ft).length===1?Ne[0]:Ne,"readonly");if(y.autoSchema)Ae=et,Oe=tt,(Ce=g).verno=Ae.version/10,Oe=Ce._dbSchema=Fy(0,Ae,Oe),Ce._storeNames=b(Ae.objectStoreNames,0),Ty(Ce,[Ce._allTables],r(Oe),Oe);else if(Iy(g,g._dbSchema,tt),((Ue=R_(Fy(0,(Ue=g).idbdb,tt),Ue._dbSchema)).add.length||Ue.change.some(function(ot){return ot.add.length||ot.change.length}))&&!V)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),et.close(),O=et.version+1,V=!0,Fe(ie());Dy(g,tt)}catch{}Ed.push(g),et.onversionchange=Fn(function(ot){y.vcFired=!0,g.on("versionchange").fire(ot)}),et.onclose=Fn(function(ot){g.on("close").fire(ot)}),le&&(Ue=g._deps,tt=Ee,et=Ue.indexedDB,Ue=Ue.IDBKeyRange,x_(et)||tt===by||T_(et,Ue).put({name:tt}).catch(Ge)),Fe()},ve)}).catch(function(Fe){switch(Fe==null?void 0:Fe.name){case"UnknownError":if(0<y.PR1398_maxLoop)return y.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),ie();break;case"VersionError":if(0<O)return O=0,ie()}return Je.reject(Fe)})}var ge,we=y.dbReadyResolve,_e=null,le=!1;return Je.race([I,(typeof navigator>"u"?Je.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Fe){function ve(){return indexedDB.databases().finally(Fe)}ge=setInterval(ve,100),ve()}).finally(function(){return clearInterval(ge)}):Promise.resolve()).then(ie)]).then(function(){return J(),y.onReadyBeingFired=[],Je.resolve(F_(function(){return g.on.ready.fire(g.vip)})).then(function Fe(){if(0<y.onReadyBeingFired.length){var ve=y.onReadyBeingFired.reduce(X,Ge);return y.onReadyBeingFired=[],Je.resolve(F_(function(){return ve(g.vip)})).then(Fe)}})}).finally(function(){y.openCanceller===I&&(y.onReadyBeingFired=null,y.isBeingOpened=!1)}).catch(function(Fe){y.dbOpenError=Fe;try{_e&&_e.abort()}catch{}return I===y.openCanceller&&g._close(),ss(Fe)}).finally(function(){y.openComplete=!0,we()}).then(function(){var Fe;return le&&(Fe={},g.tables.forEach(function(ve){ve.schema.indexes.forEach(function(Ee){Ee.name&&(Fe["idb://".concat(g.name,"/").concat(ve.name,"/").concat(Ee.name)]=new js(-1/0,[[[]]]))}),Fe["idb://".concat(g.name,"/").concat(ve.name,"/")]=Fe["idb://".concat(g.name,"/").concat(ve.name,"/:dels")]=new js(-1/0,[[[]]])}),cl(hp).fire(Fe),O_(Fe,!0)),g})}function M_(g){function y(V){return g.next(V)}var _=O(y),I=O(function(V){return g.throw(V)});function O(V){return function(ge){var ie=V(ge),ge=ie.value;return ie.done?ge:ge&&typeof ge.then=="function"?ge.then(_,I):a(ge)?Promise.all(ge).then(_,I):_(ge)}}return O(y)()}function My(g,y,_){for(var I=a(g)?g.slice():[g],O=0;O<_;++O)I.push(y);return I}var pCe={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(g){return s(s({},g),{table:function(y){var _=g.table(y),I=_.schema,O={},V=[];function J(le,Fe,ve){var Ee=pp(le),De=O[Ee]=O[Ee]||[],Ce=le==null?0:typeof le=="string"?1:le.length,Ae=0<Fe,Ae=s(s({},ve),{name:Ae?"".concat(Ee,"(virtual-from:").concat(ve.name,")"):ve.name,lowLevelIndex:ve,isVirtual:Ae,keyTail:Fe,keyLength:Ce,extractKey:E_(le),unique:!Ae&&ve.unique});return De.push(Ae),Ae.isPrimaryKey||V.push(Ae),1<Ce&&J(Ce===2?le[0]:le.slice(0,Ce-1),Fe+1,ve),De.sort(function(Oe,Ne){return Oe.keyTail-Ne.keyTail}),Ae}y=J(I.primaryKey.keyPath,0,I.primaryKey),O[":id"]=[y];for(var ie=0,ge=I.indexes;ie<ge.length;ie++){var we=ge[ie];J(we.keyPath,0,we)}function _e(le){var Fe,ve=le.query.index;return ve.isVirtual?s(s({},le),{query:{index:ve.lowLevelIndex,range:(Fe=le.query.range,ve=ve.keyTail,{type:Fe.type===1?2:Fe.type,lower:My(Fe.lower,Fe.lowerOpen?g.MAX_KEY:g.MIN_KEY,ve),lowerOpen:!0,upper:My(Fe.upper,Fe.upperOpen?g.MIN_KEY:g.MAX_KEY,ve),upperOpen:!0})}}):le}return s(s({},_),{schema:s(s({},I),{primaryKey:y,indexes:V,getIndexByKeyPath:function(le){return(le=O[pp(le)])&&le[0]}}),count:function(le){return _.count(_e(le))},query:function(le){return _.query(_e(le))},openCursor:function(le){var Fe=le.query.index,ve=Fe.keyTail,Ee=Fe.isVirtual,De=Fe.keyLength;return Ee?_.openCursor(_e(le)).then(function(Ae){return Ae&&Ce(Ae)}):_.openCursor(le);function Ce(Ae){return Object.create(Ae,{continue:{value:function(Oe){Oe!=null?Ae.continue(My(Oe,le.reverse?g.MAX_KEY:g.MIN_KEY,ve)):le.unique?Ae.continue(Ae.key.slice(0,De).concat(le.reverse?g.MIN_KEY:g.MAX_KEY,ve)):Ae.continue()}},continuePrimaryKey:{value:function(Oe,Ne){Ae.continuePrimaryKey(My(Oe,g.MAX_KEY,ve),Ne)}},primaryKey:{get:function(){return Ae.primaryKey}},key:{get:function(){var Oe=Ae.key;return De===1?Oe[0]:Oe.slice(0,De)}},value:{get:function(){return Ae.value}}})}}})}})}};function N_(g,y,_,I){return _=_||{},I=I||"",r(g).forEach(function(O){var V,J,ie;d(y,O)?(V=g[O],J=y[O],typeof V=="object"&&typeof J=="object"&&V&&J?(ie=Z(V))!==Z(J)?_[I+O]=y[O]:ie==="Object"?N_(V,J,_,I+O+"."):V!==J&&(_[I+O]=y[O]):V!==J&&(_[I+O]=y[O])):_[I+O]=void 0}),r(y).forEach(function(O){d(g,O)||(_[I+O]=y[O])}),_}function L_(g,y){return y.type==="delete"?y.keys:y.keys||y.values.map(g.extractKey)}var gCe={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(g){return s(s({},g),{table:function(y){var _=g.table(y),I=_.schema.primaryKey;return s(s({},_),{mutate:function(O){var V=He.trans,J=V.table(y).hook,ie=J.deleting,ge=J.creating,we=J.updating;switch(O.type){case"add":if(ge.fire===Ge)break;return V._promise("readwrite",function(){return _e(O)},!0);case"put":if(ge.fire===Ge&&we.fire===Ge)break;return V._promise("readwrite",function(){return _e(O)},!0);case"delete":if(ie.fire===Ge)break;return V._promise("readwrite",function(){return _e(O)},!0);case"deleteRange":if(ie.fire===Ge)break;return V._promise("readwrite",function(){return function le(Fe,ve,Ee){return _.query({trans:Fe,values:!1,query:{index:I,range:ve},limit:Ee}).then(function(De){var Ce=De.result;return _e({type:"delete",keys:Ce,trans:Fe}).then(function(Ae){return 0<Ae.numFailures?Promise.reject(Ae.failures[0]):Ce.length<Ee?{failures:[],numFailures:0,lastResult:void 0}:le(Fe,s(s({},ve),{lower:Ce[Ce.length-1],lowerOpen:!0}),Ee)})})}(O.trans,O.range,1e4)},!0)}return _.mutate(O);function _e(le){var Fe,ve,Ee,De=He.trans,Ce=le.keys||L_(I,le);if(!Ce)throw new Error("Keys missing");return(le=le.type==="add"||le.type==="put"?s(s({},le),{keys:Ce}):s({},le)).type!=="delete"&&(le.values=o([],le.values)),le.keys&&(le.keys=o([],le.keys)),Fe=_,Ee=Ce,((ve=le).type==="add"?Promise.resolve([]):Fe.getMany({trans:ve.trans,keys:Ee,cache:"immutable"})).then(function(Ae){var Oe=Ce.map(function(Ne,Ue){var et,ft,tt,ot=Ae[Ue],gt={onerror:null,onsuccess:null};return le.type==="delete"?ie.fire.call(gt,Ne,ot,De):le.type==="add"||ot===void 0?(et=ge.fire.call(gt,Ne,le.values[Ue],De),Ne==null&&et!=null&&(le.keys[Ue]=Ne=et,I.outbound||T(le.values[Ue],I.keyPath,Ne))):(et=N_(ot,le.values[Ue]),(ft=we.fire.call(gt,et,Ne,ot,De))&&(tt=le.values[Ue],Object.keys(ft).forEach(function(ct){d(tt,ct)?tt[ct]=ft[ct]:T(tt,ct,ft[ct])}))),gt});return _.mutate(le).then(function(Ne){for(var Ue=Ne.failures,et=Ne.results,ft=Ne.numFailures,Ne=Ne.lastResult,tt=0;tt<Ce.length;++tt){var ot=(et||Ce)[tt],gt=Oe[tt];ot==null?gt.onerror&&gt.onerror(Ue[tt]):gt.onsuccess&&gt.onsuccess(le.type==="put"&&Ae[tt]?le.values[tt]:ot)}return{failures:Ue,results:et,numFailures:ft,lastResult:Ne}}).catch(function(Ne){return Oe.forEach(function(Ue){return Ue.onerror&&Ue.onerror(Ne)}),Promise.reject(Ne)})})}}})}})}};function DB(g,y,_){try{if(!y||y.keys.length<g.length)return null;for(var I=[],O=0,V=0;O<y.keys.length&&V<g.length;++O)en(y.keys[O],g[V])===0&&(I.push(_?P(y.values[O]):y.values[O]),++V);return I.length===g.length?I:null}catch{return null}}var mCe={stack:"dbcore",level:-1,create:function(g){return{table:function(y){var _=g.table(y);return s(s({},_),{getMany:function(I){if(!I.cache)return _.getMany(I);var O=DB(I.keys,I.trans._cache,I.cache==="clone");return O?Je.resolve(O):_.getMany(I).then(function(V){return I.trans._cache={keys:I.keys,values:I.cache==="clone"?P(V):V},V})},mutate:function(I){return I.type!=="add"&&(I.trans._cache=null),_.mutate(I)}})}}}};function TB(g,y){return g.trans.mode==="readonly"&&!!g.subscr&&!g.trans.explicit&&g.trans.db._options.cache!=="disabled"&&!y.schema.primaryKey.outbound}function xB(g,y){switch(g){case"query":return y.values&&!y.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var vCe={stack:"dbcore",level:0,name:"Observability",create:function(g){var y=g.schema.name,_=new js(g.MIN_KEY,g.MAX_KEY);return s(s({},g),{transaction:function(I,O,V){if(He.subscr&&O!=="readonly")throw new te.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(He.querier));return g.transaction(I,O,V)},table:function(I){var O=g.table(I),V=O.schema,J=V.primaryKey,le=V.indexes,ie=J.extractKey,ge=J.outbound,we=J.autoIncrement&&le.filter(function(ve){return ve.compound&&ve.keyPath.includes(J.keyPath)}),_e=s(s({},O),{mutate:function(ve){function Ee(ct){return ct="idb://".concat(y,"/").concat(I,"/").concat(ct),Ne[ct]||(Ne[ct]=new js)}var De,Ce,Ae,Oe=ve.trans,Ne=ve.mutatedParts||(ve.mutatedParts={}),Ue=Ee(""),et=Ee(":dels"),ft=ve.type,gt=ve.type==="deleteRange"?[ve.range]:ve.type==="delete"?[ve.keys]:ve.values.length<50?[L_(J,ve).filter(function(ct){return ct}),ve.values]:[],tt=gt[0],ot=gt[1],gt=ve.trans._cache;return a(tt)?(Ue.addKeys(tt),(gt=ft==="delete"||tt.length===ot.length?DB(tt,gt):null)||et.addKeys(tt),(gt||ot)&&(De=Ee,Ce=gt,Ae=ot,V.indexes.forEach(function(ct){var bt=De(ct.name||"");function jt(Jt){return Jt!=null?ct.extractKey(Jt):null}function Xt(Jt){return ct.multiEntry&&a(Jt)?Jt.forEach(function(Mo){return bt.addKey(Mo)}):bt.addKey(Jt)}(Ce||Ae).forEach(function(Jt,Ks){var Ut=Ce&&jt(Ce[Ks]),Ks=Ae&&jt(Ae[Ks]);en(Ut,Ks)!==0&&(Ut!=null&&Xt(Ut),Ks!=null&&Xt(Ks))})}))):tt?(ot={from:(ot=tt.lower)!==null&&ot!==void 0?ot:g.MIN_KEY,to:(ot=tt.upper)!==null&&ot!==void 0?ot:g.MAX_KEY},et.add(ot),Ue.add(ot)):(Ue.add(_),et.add(_),V.indexes.forEach(function(ct){return Ee(ct.name).add(_)})),O.mutate(ve).then(function(ct){return!tt||ve.type!=="add"&&ve.type!=="put"||(Ue.addKeys(ct.results),we&&we.forEach(function(bt){for(var jt=ve.values.map(function(Ut){return bt.extractKey(Ut)}),Xt=bt.keyPath.findIndex(function(Ut){return Ut===J.keyPath}),Jt=0,Mo=ct.results.length;Jt<Mo;++Jt)jt[Jt][Xt]=ct.results[Jt];Ee(bt.name).addKeys(jt)})),Oe.mutatedParts=ky(Oe.mutatedParts||{},Ne),ct})}}),le=function(Ee){var De=Ee.query,Ee=De.index,De=De.range;return[Ee,new js((Ee=De.lower)!==null&&Ee!==void 0?Ee:g.MIN_KEY,(De=De.upper)!==null&&De!==void 0?De:g.MAX_KEY)]},Fe={get:function(ve){return[J,new js(ve.key)]},getMany:function(ve){return[J,new js().addKeys(ve.keys)]},count:le,query:le,openCursor:le};return r(Fe).forEach(function(ve){_e[ve]=function(Ee){var De=He.subscr,Ce=!!De,Ae=TB(He,O)&&xB(ve,Ee)?Ee.obsSet={}:De;if(Ce){var Oe=function(ot){return ot="idb://".concat(y,"/").concat(I,"/").concat(ot),Ae[ot]||(Ae[ot]=new js)},Ne=Oe(""),Ue=Oe(":dels"),De=Fe[ve](Ee),Ce=De[0],De=De[1];if((ve==="query"&&Ce.isPrimaryKey&&!Ee.values?Ue:Oe(Ce.name||"")).add(De),!Ce.isPrimaryKey){if(ve!=="count"){var et=ve==="query"&&ge&&Ee.values&&O.query(s(s({},Ee),{values:!1}));return O[ve].apply(this,arguments).then(function(ot){if(ve==="query"){if(ge&&Ee.values)return et.then(function(jt){return jt=jt.result,Ne.addKeys(jt),ot});var gt=Ee.values?ot.result.map(ie):ot.result;(Ee.values?Ne:Ue).addKeys(gt)}else if(ve==="openCursor"){var ct=ot,bt=Ee.values;return ct&&Object.create(ct,{key:{get:function(){return Ue.addKey(ct.primaryKey),ct.key}},primaryKey:{get:function(){var jt=ct.primaryKey;return Ue.addKey(jt),jt}},value:{get:function(){return bt&&Ne.addKey(ct.primaryKey),ct.value}}})}return ot})}Ue.add(_)}}return O[ve].apply(this,arguments)}}),_e}})}};function FB(g,y,_){if(_.numFailures===0)return y;if(y.type==="deleteRange")return null;var I=y.keys?y.keys.length:"values"in y&&y.values?y.values.length:1;return _.numFailures===I?null:(y=s({},y),a(y.keys)&&(y.keys=y.keys.filter(function(O,V){return!(V in _.failures)})),"values"in y&&a(y.values)&&(y.values=y.values.filter(function(O,V){return!(V in _.failures)})),y)}function V_(g,y){return _=g,((I=y).lower===void 0||(I.lowerOpen?0<en(_,I.lower):0<=en(_,I.lower)))&&(g=g,(y=y).upper===void 0||(y.upperOpen?en(g,y.upper)<0:en(g,y.upper)<=0));var _,I}function IB(g,y,Fe,I,O,V){if(!Fe||Fe.length===0)return g;var J=y.query.index,ie=J.multiEntry,ge=y.query.range,we=I.schema.primaryKey.extractKey,_e=J.extractKey,le=(J.lowLevelIndex||J).extractKey,Fe=Fe.reduce(function(ve,Ee){var De=ve,Ce=[];if(Ee.type==="add"||Ee.type==="put")for(var Ae=new js,Oe=Ee.values.length-1;0<=Oe;--Oe){var Ne,Ue=Ee.values[Oe],et=we(Ue);Ae.hasKey(et)||(Ne=_e(Ue),(ie&&a(Ne)?Ne.some(function(ct){return V_(ct,ge)}):V_(Ne,ge))&&(Ae.addKey(et),Ce.push(Ue)))}switch(Ee.type){case"add":var ft=new js().addKeys(y.values?ve.map(function(bt){return we(bt)}):ve),De=ve.concat(y.values?Ce.filter(function(bt){return bt=we(bt),!ft.hasKey(bt)&&(ft.addKey(bt),!0)}):Ce.map(function(bt){return we(bt)}).filter(function(bt){return!ft.hasKey(bt)&&(ft.addKey(bt),!0)}));break;case"put":var tt=new js().addKeys(Ee.values.map(function(bt){return we(bt)}));De=ve.filter(function(bt){return!tt.hasKey(y.values?we(bt):bt)}).concat(y.values?Ce:Ce.map(function(bt){return we(bt)}));break;case"delete":var ot=new js().addKeys(Ee.keys);De=ve.filter(function(bt){return!ot.hasKey(y.values?we(bt):bt)});break;case"deleteRange":var gt=Ee.range;De=ve.filter(function(bt){return!V_(we(bt),gt)})}return De},g);return Fe===g?g:(Fe.sort(function(ve,Ee){return en(le(ve),le(Ee))||en(we(ve),we(Ee))}),y.limit&&y.limit<1/0&&(Fe.length>y.limit?Fe.length=y.limit:g.length===y.limit&&Fe.length<y.limit&&(O.dirty=!0)),V?Object.freeze(Fe):Fe)}function PB(g,y){return en(g.lower,y.lower)===0&&en(g.upper,y.upper)===0&&!!g.lowerOpen==!!y.lowerOpen&&!!g.upperOpen==!!y.upperOpen}function yCe(g,y){return function(_,I,O,V){if(_===void 0)return I!==void 0?-1:0;if(I===void 0)return 1;if((I=en(_,I))===0){if(O&&V)return 0;if(O)return 1;if(V)return-1}return I}(g.lower,y.lower,g.lowerOpen,y.lowerOpen)<=0&&0<=function(_,I,O,V){if(_===void 0)return I!==void 0?1:0;if(I===void 0)return-1;if((I=en(_,I))===0){if(O&&V)return 0;if(O)return-1;if(V)return 1}return I}(g.upper,y.upper,g.upperOpen,y.upperOpen)}function wCe(g,y,_,I){g.subscribers.add(_),I.addEventListener("abort",function(){var O,V;g.subscribers.delete(_),g.subscribers.size===0&&(O=g,V=y,setTimeout(function(){O.subscribers.size===0&&K(V,O)},3e3))})}var CCe={stack:"dbcore",level:0,name:"Cache",create:function(g){var y=g.schema.name;return s(s({},g),{transaction:function(_,I,O){var V,J,ie=g.transaction(_,I,O);return I==="readwrite"&&(J=(V=new AbortController).signal,O=function(ge){return function(){if(V.abort(),I==="readwrite"){for(var we=new Set,_e=0,le=_;_e<le.length;_e++){var Fe=le[_e],ve=Du["idb://".concat(y,"/").concat(Fe)];if(ve){var Ee=g.table(Fe),De=ve.optimisticOps.filter(function(bt){return bt.trans===ie});if(ie._explicit&&ge&&ie.mutatedParts)for(var Ce=0,Ae=Object.values(ve.queries.query);Ce<Ae.length;Ce++)for(var Oe=0,Ne=(ft=Ae[Ce]).slice();Oe<Ne.length;Oe++)P_((tt=Ne[Oe]).obsSet,ie.mutatedParts)&&(K(ft,tt),tt.subscribers.forEach(function(bt){return we.add(bt)}));else if(0<De.length){ve.optimisticOps=ve.optimisticOps.filter(function(bt){return bt.trans!==ie});for(var Ue=0,et=Object.values(ve.queries.query);Ue<et.length;Ue++)for(var ft,tt,ot,gt=0,ct=(ft=et[Ue]).slice();gt<ct.length;gt++)(tt=ct[gt]).res!=null&&ie.mutatedParts&&(ge&&!tt.dirty?(ot=Object.isFrozen(tt.res),ot=IB(tt.res,tt.req,De,Ee,tt,ot),tt.dirty?(K(ft,tt),tt.subscribers.forEach(function(bt){return we.add(bt)})):ot!==tt.res&&(tt.res=ot,tt.promise=Je.resolve({result:ot}))):(tt.dirty&&K(ft,tt),tt.subscribers.forEach(function(bt){return we.add(bt)})))}}}we.forEach(function(bt){return bt()})}}},ie.addEventListener("abort",O(!1),{signal:J}),ie.addEventListener("error",O(!1),{signal:J}),ie.addEventListener("complete",O(!0),{signal:J})),ie},table:function(_){var I=g.table(_),O=I.schema.primaryKey;return s(s({},I),{mutate:function(V){var J=He.trans;if(O.outbound||J.db._options.cache==="disabled"||J.explicit||J.idbtrans.mode!=="readwrite")return I.mutate(V);var ie=Du["idb://".concat(y,"/").concat(_)];return ie?(J=I.mutate(V),V.type!=="add"&&V.type!=="put"||!(50<=V.values.length||L_(O,V).some(function(ge){return ge==null}))?(ie.optimisticOps.push(V),V.mutatedParts&&Oy(V.mutatedParts),J.then(function(ge){0<ge.numFailures&&(K(ie.optimisticOps,V),(ge=FB(0,V,ge))&&ie.optimisticOps.push(ge),V.mutatedParts&&Oy(V.mutatedParts))}),J.catch(function(){K(ie.optimisticOps,V),V.mutatedParts&&Oy(V.mutatedParts)})):J.then(function(ge){var we=FB(0,s(s({},V),{values:V.values.map(function(_e,le){var Fe;return ge.failures[le]?_e:(_e=(Fe=O.keyPath)!==null&&Fe!==void 0&&Fe.includes(".")?P(_e):s({},_e),T(_e,O.keyPath,ge.results[le]),_e)})}),ge);ie.optimisticOps.push(we),queueMicrotask(function(){return V.mutatedParts&&Oy(V.mutatedParts)})}),J):I.mutate(V)},query:function(V){if(!TB(He,I)||!xB("query",V))return I.query(V);var J=((we=He.trans)===null||we===void 0?void 0:we.db._options.cache)==="immutable",le=He,ie=le.requery,ge=le.signal,we=function(Ee,De,Ce,Ae){var Oe=Du["idb://".concat(Ee,"/").concat(De)];if(!Oe)return[];if(!(De=Oe.queries[Ce]))return[null,!1,Oe,null];var Ne=De[(Ae.query?Ae.query.index.name:null)||""];if(!Ne)return[null,!1,Oe,null];switch(Ce){case"query":var Ue=Ne.find(function(et){return et.req.limit===Ae.limit&&et.req.values===Ae.values&&PB(et.req.query.range,Ae.query.range)});return Ue?[Ue,!0,Oe,Ne]:[Ne.find(function(et){return("limit"in et.req?et.req.limit:1/0)>=Ae.limit&&(!Ae.values||et.req.values)&&yCe(et.req.query.range,Ae.query.range)}),!1,Oe,Ne];case"count":return Ue=Ne.find(function(et){return PB(et.req.query.range,Ae.query.range)}),[Ue,!!Ue,Oe,Ne]}}(y,_,"query",V),_e=we[0],le=we[1],Fe=we[2],ve=we[3];return _e&&le?_e.obsSet=V.obsSet:(le=I.query(V).then(function(Ee){var De=Ee.result;if(_e&&(_e.res=De),J){for(var Ce=0,Ae=De.length;Ce<Ae;++Ce)Object.freeze(De[Ce]);Object.freeze(De)}else Ee.result=P(De);return Ee}).catch(function(Ee){return ve&&_e&&K(ve,_e),Promise.reject(Ee)}),_e={obsSet:V.obsSet,promise:le,subscribers:new Set,type:"query",req:V,dirty:!1},ve?ve.push(_e):(ve=[_e],(Fe=Fe||(Du["idb://".concat(y,"/").concat(_)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[V.query.index.name||""]=ve)),wCe(_e,ve,ie,ge),_e.promise.then(function(Ee){return{result:IB(Ee.result,V,Fe==null?void 0:Fe.optimisticOps,I,_e,J)}})}})}})}};function Ny(g,y){return new Proxy(g,{get:function(_,I,O){return I==="db"?y:Reflect.get(_,I,O)}})}var ga=(os.prototype.version=function(g){if(isNaN(g)||g<.1)throw new te.Type("Given version is not a positive number");if(g=Math.round(10*g)/10,this.idbdb||this._state.isBeingOpened)throw new te.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,g);var y=this._versions,_=y.filter(function(I){return I._cfg.version===g})[0];return _||(_=new this.Version(g),y.push(_),y.sort(uCe),_.stores({}),this._state.autoSchema=!1,_)},os.prototype._whenReady=function(g){var y=this;return this.idbdb&&(this._state.openComplete||He.letThrough||this._vip)?g():new Je(function(_,I){if(y._state.openComplete)return I(new te.DatabaseClosed(y._state.dbOpenError));if(!y._state.isBeingOpened){if(!y._state.autoOpen)return void I(new te.DatabaseClosed);y.open().catch(Ge)}y._state.dbReadyPromise.then(_,I)}).then(g)},os.prototype.use=function(g){var y=g.stack,_=g.create,I=g.level,O=g.name;return O&&this.unuse({stack:y,name:O}),g=this._middlewares[y]||(this._middlewares[y]=[]),g.push({stack:y,create:_,level:I??10,name:O}),g.sort(function(V,J){return V.level-J.level}),this},os.prototype.unuse=function(g){var y=g.stack,_=g.name,I=g.create;return y&&this._middlewares[y]&&(this._middlewares[y]=this._middlewares[y].filter(function(O){return I?O.create!==I:!!_&&O.name!==_})),this},os.prototype.open=function(){var g=this;return ha(Me,function(){return fCe(g)})},os.prototype._close=function(){var g=this._state,y=Ed.indexOf(this);if(0<=y&&Ed.splice(y,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}g.isBeingOpened||(g.dbReadyPromise=new Je(function(_){g.dbReadyResolve=_}),g.openCanceller=new Je(function(_,I){g.cancelOpen=I}))},os.prototype.close=function(_){var y=(_===void 0?{disableAutoOpen:!0}:_).disableAutoOpen,_=this._state;y?(_.isBeingOpened&&_.cancelOpen(new te.DatabaseClosed),this._close(),_.autoOpen=!1,_.dbOpenError=new te.DatabaseClosed):(this._close(),_.autoOpen=this._options.autoOpen||_.isBeingOpened,_.openComplete=!1,_.dbOpenError=null)},os.prototype.delete=function(g){var y=this;g===void 0&&(g={disableAutoOpen:!0});var _=0<arguments.length&&typeof arguments[0]!="object",I=this._state;return new Je(function(O,V){function J(){y.close(g);var ie=y._deps.indexedDB.deleteDatabase(y.name);ie.onsuccess=Fn(function(){var ge,we,_e;ge=y._deps,we=y.name,_e=ge.indexedDB,ge=ge.IDBKeyRange,x_(_e)||we===by||T_(_e,ge).delete(we).catch(Ge),O()}),ie.onerror=Rr(V),ie.onblocked=y._fireOnBlocked}if(_)throw new te.InvalidArgument("Invalid closeOptions argument to db.delete()");I.isBeingOpened?I.dbReadyPromise.then(J):J()})},os.prototype.backendDB=function(){return this.idbdb},os.prototype.isOpen=function(){return this.idbdb!==null},os.prototype.hasBeenClosed=function(){var g=this._state.dbOpenError;return g&&g.name==="DatabaseClosed"},os.prototype.hasFailed=function(){return this._state.dbOpenError!==null},os.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(os.prototype,"tables",{get:function(){var g=this;return r(this._allTables).map(function(y){return g._allTables[y]})},enumerable:!1,configurable:!0}),os.prototype.transaction=function(){var g=(function(y,_,I){var O=arguments.length;if(O<2)throw new te.InvalidArgument("Too few arguments");for(var V=new Array(O-1);--O;)V[O-1]=arguments[O];return I=V.pop(),[y,x(V),I]}).apply(this,arguments);return this._transaction.apply(this,g)},os.prototype._transaction=function(g,y,_){var I=this,O=He.trans;O&&O.db===this&&g.indexOf("!")===-1||(O=null);var V,J,ie=g.indexOf("?")!==-1;g=g.replace("!","").replace("?","");try{if(J=y.map(function(we){if(we=we instanceof I.Table?we.name:we,typeof we!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return we}),g=="r"||g===g_)V=g_;else{if(g!="rw"&&g!=m_)throw new te.InvalidArgument("Invalid transaction mode: "+g);V=m_}if(O){if(O.mode===g_&&V===m_){if(!ie)throw new te.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");O=null}O&&J.forEach(function(we){if(O&&O.storeNames.indexOf(we)===-1){if(!ie)throw new te.SubTransaction("Table "+we+" not included in parent transaction.");O=null}}),ie&&O&&!O.active&&(O=null)}}catch(we){return O?O._promise(null,function(_e,le){le(we)}):ss(we)}var ge=(function we(_e,le,Fe,ve,Ee){return Je.resolve().then(function(){var De=He.transless||He,Ce=_e._createTransaction(le,Fe,_e._dbSchema,ve);if(Ce.explicit=!0,De={trans:Ce,transless:De},ve)Ce.idbtrans=ve.idbtrans;else try{Ce.create(),Ce.idbtrans._explicit=!0,_e._state.PR1398_maxLoop=3}catch(Ne){return Ne.name===he.InvalidState&&_e.isOpen()&&0<--_e._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),_e.close({disableAutoOpen:!1}),_e.open().then(function(){return we(_e,le,Fe,null,Ee)})):ss(Ne)}var Ae,Oe=Q(Ee);return Oe&&ca(),De=Je.follow(function(){var Ne;(Ae=Ee.call(Ce,Ce))&&(Oe?(Ne=Li.bind(null,null),Ae.then(Ne,Ne)):typeof Ae.next=="function"&&typeof Ae.throw=="function"&&(Ae=M_(Ae)))},De),(Ae&&typeof Ae.then=="function"?Je.resolve(Ae).then(function(Ne){return Ce.active?Ne:ss(new te.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):De.then(function(){return Ae})).then(function(Ne){return ve&&Ce._resolve(),Ce._completion.then(function(){return Ne})}).catch(function(Ne){return Ce._reject(Ne),ss(Ne)})})}).bind(null,this,V,J,O,_);return O?O._promise(V,ge,"lock"):He.trans?ha(He.transless,function(){return I._whenReady(ge)}):this._whenReady(ge)},os.prototype.table=function(g){if(!d(this._allTables,g))throw new te.InvalidTable("Table ".concat(g," does not exist"));return this._allTables[g]},os);function os(g,y){var _=this;this._middlewares={},this.verno=0;var I=os.dependencies;this._options=y=s({addons:os.addons,autoOpen:!0,indexedDB:I.indexedDB,IDBKeyRange:I.IDBKeyRange,cache:"cloned"},y),this._deps={indexedDB:y.indexedDB,IDBKeyRange:y.IDBKeyRange},I=y.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var O,V,J,ie,ge,we={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Ge,dbReadyPromise:null,cancelOpen:Ge,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:y.autoOpen};we.dbReadyPromise=new Je(function(le){we.dbReadyResolve=le}),we.openCanceller=new Je(function(le,Fe){we.cancelOpen=Fe}),this._state=we,this.name=g,this.on=lp(this,"populate","blocked","versionchange","close",{ready:[X,Ge]}),this.on.ready.subscribe=S(this.on.ready.subscribe,function(le){return function(Fe,ve){os.vip(function(){var Ee,De=_._state;De.openComplete?(De.dbOpenError||Je.resolve().then(Fe),ve&&le(Fe)):De.onReadyBeingFired?(De.onReadyBeingFired.push(Fe),ve&&le(Fe)):(le(Fe),Ee=_,ve||le(function Ce(){Ee.on.ready.unsubscribe(Fe),Ee.on.ready.unsubscribe(Ce)}))})}}),this.Collection=(O=this,up(nCe.prototype,function(Ae,Ce){this.db=O;var ve=lB,Ee=null;if(Ce)try{ve=Ce()}catch(Oe){Ee=Oe}var De=Ae._ctx,Ce=De.table,Ae=Ce.hook.reading.fire;this._ctx={table:Ce,index:De.index,isPrimKey:!De.index||Ce.schema.primKey.keyPath&&De.index===Ce.schema.primKey.name,range:ve,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:Ee,or:De.or,valueMapper:Ae!==z?Ae:null}})),this.Table=(V=this,up(hB.prototype,function(le,Fe,ve){this.db=V,this._tx=ve,this.name=le,this.schema=Fe,this.hook=V._allTables[le]?V._allTables[le].hook:lp(null,{creating:[fe,Ge],reading:[se,z],updating:[A,Ge],deleting:[Se,Ge]})})),this.Transaction=(J=this,up(iCe.prototype,function(le,Fe,ve,Ee,De){var Ce=this;this.db=J,this.mode=le,this.storeNames=Fe,this.schema=ve,this.chromeTransactionDurability=Ee,this.idbtrans=null,this.on=lp(this,"complete","error","abort"),this.parent=De||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 Je(function(Ae,Oe){Ce._resolve=Ae,Ce._reject=Oe}),this._completion.then(function(){Ce.active=!1,Ce.on.complete.fire()},function(Ae){var Oe=Ce.active;return Ce.active=!1,Ce.on.error.fire(Ae),Ce.parent?Ce.parent._reject(Ae):Oe&&Ce.idbtrans&&Ce.idbtrans.abort(),ss(Ae)})})),this.Version=(ie=this,up(hCe.prototype,function(le){this.db=ie,this._cfg={version:le,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(ge=this,up(vB.prototype,function(le,Fe,ve){if(this.db=ge,this._ctx={table:le,index:Fe===":id"?null:Fe,or:ve},this._cmp=this._ascending=en,this._descending=function(Ee,De){return en(De,Ee)},this._max=function(Ee,De){return 0<en(Ee,De)?Ee:De},this._min=function(Ee,De){return en(Ee,De)<0?Ee:De},this._IDBKeyRange=ge._deps.IDBKeyRange,!this._IDBKeyRange)throw new te.MissingAPI})),this.on("versionchange",function(le){0<le.newVersion?console.warn("Another connection wants to upgrade database '".concat(_.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(_.name,"'. Closing db now to resume the delete request.")),_.close({disableAutoOpen:!1})}),this.on("blocked",function(le){!le.newVersion||le.newVersion<le.oldVersion?console.warn("Dexie.delete('".concat(_.name,"') was blocked")):console.warn("Upgrade '".concat(_.name,"' blocked by other connection holding version ").concat(le.oldVersion/10))}),this._maxKey=fp(y.IDBKeyRange),this._createTransaction=function(le,Fe,ve,Ee){return new _.Transaction(le,Fe,ve,_._options.chromeTransactionDurability,Ee)},this._fireOnBlocked=function(le){_.on("blocked").fire(le),Ed.filter(function(Fe){return Fe.name===_.name&&Fe!==_&&!Fe._state.vcFired}).map(function(Fe){return Fe.on("versionchange").fire(le)})},this.use(mCe),this.use(CCe),this.use(vCe),this.use(pCe),this.use(gCe);var _e=new Proxy(this,{get:function(le,Fe,ve){if(Fe==="_vip")return!0;if(Fe==="table")return function(De){return Ny(_.table(De),_e)};var Ee=Reflect.get(le,Fe,ve);return Ee instanceof hB?Ny(Ee,_e):Fe==="tables"?Ee.map(function(De){return Ny(De,_e)}):Fe==="_createTransaction"?function(){return Ny(Ee.apply(this,arguments),_e)}:Ee}});this.vip=_e,I.forEach(function(le){return le(_)})}var Ly,ui=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",bCe=(B_.prototype.subscribe=function(g,y,_){return this._subscribe(g&&typeof g!="function"?g:{next:g,error:y,complete:_})},B_.prototype[ui]=function(){return this},B_);function B_(g){this._subscribe=g}try{Ly={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch{Ly={indexedDB:null,IDBKeyRange:null}}function AB(g){var y,_=!1,I=new bCe(function(O){var V=Q(g),J,ie=!1,ge={},we={},_e={get closed(){return ie},unsubscribe:function(){ie||(ie=!0,J&&J.abort(),le&&cl.storagemutated.unsubscribe(ve))}};O.start&&O.start(_e);var le=!1,Fe=function(){return ll(Ee)},ve=function(De){ky(ge,De),P_(we,ge)&&Fe()},Ee=function(){var De,Ce,Ae;!ie&&Ly.indexedDB&&(ge={},De={},J&&J.abort(),J=new AbortController,Ae=function(Oe){var Ne=Ni();try{V&&ca();var Ue=As(g,Oe);return Ue=V?Ue.finally(Li):Ue}finally{Ne&&li()}}(Ce={subscr:De,signal:J.signal,requery:Fe,querier:g,trans:null}),Promise.resolve(Ae).then(function(Oe){_=!0,y=Oe,ie||Ce.signal.aborted||(ge={},function(Ne){for(var Ue in Ne)if(d(Ne,Ue))return;return 1}(we=De)||le||(cl(hp,ve),le=!0),ll(function(){return!ie&&O.next&&O.next(Oe)}))},function(Oe){_=!1,["DatabaseClosedError","AbortError"].includes(Oe==null?void 0:Oe.name)||ie||ll(function(){ie||O.error&&O.error(Oe)})}))};return setTimeout(Fe,0),_e});return I.hasValue=function(){return _},I.getValue=function(){return y},I}var Tu=ga;function $_(g){var y=dl;try{dl=!0,cl.storagemutated.fire(g),O_(g,!0)}finally{dl=y}}h(Tu,s(s({},$e),{delete:function(g){return new Tu(g,{addons:[]}).delete()},exists:function(g){return new Tu(g,{addons:[]}).open().then(function(y){return y.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(g){try{return y=Tu.dependencies,_=y.indexedDB,y=y.IDBKeyRange,(x_(_)?Promise.resolve(_.databases()).then(function(I){return I.map(function(O){return O.name}).filter(function(O){return O!==by})}):T_(_,y).toCollection().primaryKeys()).then(g)}catch{return ss(new te.MissingAPI)}var y,_},defineClass:function(){return function(g){l(this,g)}},ignoreTransaction:function(g){return He.trans?ha(He.transless,g):g()},vip:F_,async:function(g){return function(){try{var y=M_(g.apply(this,arguments));return y&&typeof y.then=="function"?y:Je.resolve(y)}catch(_){return ss(_)}}},spawn:function(g,y,_){try{var I=M_(g.apply(_,y||[]));return I&&typeof I.then=="function"?I:Je.resolve(I)}catch(O){return ss(O)}},currentTransaction:{get:function(){return He.trans||null}},waitFor:function(g,y){return y=Je.resolve(typeof g=="function"?Tu.ignoreTransaction(g):g).timeout(y||6e4),He.trans?He.trans.waitFor(y):y},Promise:Je,debug:{get:function(){return me},set:function(g){Pe(g)}},derive:m,extend:l,props:h,override:S,Events:lp,on:cl,liveQuery:AB,extendObservabilitySet:ky,getByKeyPath:E,setByKeyPath:T,delByKeyPath:function(g,y){typeof y=="string"?T(g,y,void 0):"length"in y&&[].map.call(y,function(_){T(g,_,void 0)})},shallowClone:k,deepClone:P,getObjectDiff:N_,cmp:en,asap:R,minKey:-1/0,addons:[],connections:Ed,errnames:he,dependencies:Ly,cache:Du,semVer:"4.0.10",version:"4.0.10".split(".").map(function(g){return parseInt(g)}).reduce(function(g,y,_){return g+y/Math.pow(10,2*_)})})),Tu.maxKey=fp(Tu.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(cl(hp,function(g){dl||(g=new CustomEvent(C_,{detail:g}),dl=!0,dispatchEvent(g),dl=!1)}),addEventListener(C_,function(g){g=g.detail,dl||$_(g)}));var Dd,dl=!1,kB=function(){};return typeof BroadcastChannel<"u"&&((kB=function(){(Dd=new BroadcastChannel(C_)).onmessage=function(g){return g.data&&$_(g.data)}})(),typeof Dd.unref=="function"&&Dd.unref(),cl(hp,function(g){dl||Dd.postMessage(g)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(g){if(!ga.disableBfCache&&g.persisted){me&&console.debug("Dexie: handling persisted pagehide"),Dd!=null&&Dd.close();for(var y=0,_=Ed;y<_.length;y++)_[y].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(g){!ga.disableBfCache&&g.persisted&&(me&&console.debug("Dexie: handling persisted pageshow"),kB(),$_({all:new js(-1/0,[[]])}))})),Je.rejectionMapper=function(g,y){return!g||g instanceof q||g instanceof TypeError||g instanceof SyntaxError||!g.name||!Re[g.name]?g:(y=new Re[g.name](y||g.message,g),"stack"in g&&p(y,"stack",{get:function(){return this.inner.stack}}),y)},Pe(me),s(ga,Object.freeze({__proto__:null,Dexie:ga,liveQuery:AB,Entity:uB,cmp:en,PropModSymbol:pa,PropModification:cp,replacePrefix:function(g,y){return new cp({replacePrefix:[g,y]})},add:function(g){return new cp({add:g})},remove:function(g){return new cp({remove:g})},default:ga,RangeSet:js,mergeRanges:mp,rangesOverlap:SB}),{default:ga}),ga})})(f1);var IW=f1.exports;const rC=FW(IW),p1=Symbol.for("Dexie"),hh=globalThis[p1]||(globalThis[p1]=rC);if(rC.semVer!==hh.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${rC.semVer} and ${hh.semVer}`);const{liveQuery:FCe,mergeRanges:ICe,rangesOverlap:PCe,RangeSet:ACe,cmp:kCe,Entity:OCe,PropModSymbol:MCe,PropModification:NCe,replacePrefix:LCe,add:VCe,remove:BCe}=hh;class g1 extends hh{constructor(n){super(n);is(this,"icons");is(this,"visuals");is(this,"users");is(this,"columns");is(this,"general");this.version(1).stores({icons:"key",visuals:"key",users:"key",columns:"key",general:"key"})}getTable(n){return this[n]?this[n]:this.general}}const vg=new Map,PW=async e=>{if(!vg.has(e)){const t=new g1(e);try{await t.open(),vg.set(e,t)}catch(n){console.error("Failed to open database, attempting to delete and recreate:",n);try{await hh.delete(e);const s=new g1(e);await s.open(),vg.set(e,s)}catch(s){throw console.error("Failed to delete and recreate database:",s),s}}}return vg.get(e)},fh=({dbName:e,storeName:t})=>{const n=async()=>(await PW(e)).getTable(t);return{getCachedValue:async u=>{try{const c=await n();if(!c){console.error(`Store is undefined for key: ${u}`);return}const d=await c.get(u);return d==null?void 0:d.value}catch(c){console.error("Failed to get cached value:",c);return}},setCachedValue:async(u,c)=>{try{const d=await n();if(!d){console.error(`Store is undefined, cannot cache key: ${u}`);return}await d.put({key:u,value:c,timestamp:Date.now()})}catch(d){console.error("Failed to cache value:",d)}},deleteCachedValue:async u=>{try{const c=await n();if(!c){console.error(`Store is undefined, cannot delete key: ${u}`);return}await c.delete(u)}catch(c){console.error("Failed to delete cached value:",c)}},clearCache:async()=>{try{const u=await n();if(!u){console.error("Store is undefined, cannot clear cache");return}await u.clear()}catch(u){console.error("Failed to clear cache:",u)}},getAllKeys:async()=>{try{const u=await n();return u?(await u.toArray()).map(d=>d.key):(console.error("Store is undefined, cannot get all keys"),[])}catch(u){return console.error("Failed to get all keys:",u),[]}},getCachedValueWithTimestamp:async u=>{try{const c=await n();if(!c){console.error(`Store is undefined for key: ${u}`);return}return await c.get(u)}catch(c){console.error("Failed to get cached value with timestamp:",c);return}}}},AW=["404","ClickChart","ClickToCreate","NoAccess1","NoActivity","NoAssignedComment","NoAssignedScene","NoComment","NoData","NoData2","NoRendition1","NoRendition2","PrivateComment","PrivateScene","ReportAchievement","ReportCompletedScenes","ReportInvolvement","ReportMetric","ReportOverdueScenes","ReportProfessionalName","ReportSceneAssignment","ReportSceneStatus","ReportSceneStatusType","Successful1","Unsuccessful1","ConfirmDeletion","Waiting1","DefaultThumbnail","UploadReviewFile","ClickToSearch","NoDataSearchFilter"],kW=["UploadInProgress"],Eu=class Eu{constructor(){is(this,"KEY_PAIR",{workspaceCode:"ws.code",apiBaseUrl:"API_BASE_URL",assetUrl:"ASSET_URL",baseUrl:"BASE_URL",baseReviewUrl:"BASE_REVIEW_URL"});Object.values(this.KEY_PAIR).every(n=>{const s=sessionStorage.getItem(n);return(s==null||s==="")&&console.error(`[SessionStorageHelper] Key "${n}" is not set in sessionStorage.`),!0})||console.error("[SessionStorageHelper] Some expected keys are missing in sessionStorage. Please ensure all required keys are set.")}static getInstance(){return Eu.instance||(Eu.instance=new Eu),Eu.instance}setItem(t,n){try{sessionStorage.setItem(t,n)}catch(s){console.error("Error setting sessionStorage item:",s)}}getItem(t){try{const n=sessionStorage.getItem(t);return n===null?"":n}catch(n){throw console.error("Error getting sessionStorage item:",n),n}}};is(Eu,"instance");let Cn=Eu;const yg={},Ra={},m1=(e,t,n,s,o="base64")=>{const i=L(""),r=L(""),a=L(!0),l=j(()=>`${t}:${e.value.name}`),u=m=>new Promise((v,w)=>{const b=new FileReader;b.onload=()=>v(b.result),b.onerror=w,b.readAsDataURL(m)}),c=m=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,d=async(m,v)=>{if(Ra[v])return Ra[v];if(v in yg){const S=await yg[v];return S&&(Ra[v]=S),S}const w=await s(l.value);if(w&&typeof w=="string")return Ra[v]=w,w;const b=(async()=>{try{const S=await fetch(m,{cache:"no-cache"});if(!S.ok)throw new Error("Failed to fetch visual");const C=S.headers.get("Content-Type")||"";let R;if(C.includes("svg")||C.includes("xml")){const E=await S.text();if(!E.trim())throw new Error("Empty SVG content");R=o==="svg"?E:c(E),Ra[v]=R}else if(C.match(/image\/(jpeg|jpg|png|gif|webp)/)){const E=await S.blob();if(!E.size)throw new Error("Empty image blob");R=await u(E),Ra[v]=R}else throw new Error(`Unsupported content type: ${C}`);return await n(l.value,R),R}catch(S){return console.error("Error fetching visual:",S),""}})();return yg[v]=b,b.finally(()=>{delete yg[v]}),await b},h=async m=>{a.value=!0;try{if(Ra[l.value]){const R=Ra[l.value];i.value=R,R.startsWith("data:image/svg+xml")?r.value=decodeURIComponent(R.split(",")[1]):(R.startsWith("<svg")||R.includes("<svg"))&&(r.value=R),a.value=!1;return}const v=Cn.getInstance().getItem("ASSET_URL")||"",w={icon:`${v}/icon/tess/TESSRAPP_Icon_${m}`,visual:`${v}/icon/visual/TESSRAPP_Visual_${m}`,ratting:`${v}/icon/tess/rating/TESSRAPP_Icon_${m}_Outline`,flag:`${v}/icon/flags/4x3/${m}`},b=AW.includes(m)?"png":kW.includes(m)?"gif":"svg",S=`${w[t]}.${b}`,C=await d(S,l.value);C&&(i.value=C,C.startsWith("data:image/svg+xml")?r.value=decodeURIComponent(C.split(",")[1]):(C.startsWith("<svg")||C.includes("<svg"))&&(r.value=C))}catch(v){console.error("Error fetching remote visual:",v)}finally{a.value=!1}},f=async()=>{i.value="",r.value="",e.value.name&&(a.value=!0,await h(e.value.name),a.value=!1)},p=j(()=>r.value?r.value:"");return nt(()=>e,()=>{f()},{deep:!0,immediate:!0}),{svgContent:p,url:i,loading:a}},OW=["innerHTML","about"],MW="IconCache",NW="icons",LW=dt({__name:"Icon",props:{src:{},source:{default:"remote"},size:{default:14},color:{default:"currentColor"}},setup(e){mG(h=>({v7bb7ab38:h.size+"px"}));const t=e,n=h=>{if(typeof h=="number")return h;switch(h){case"small":return 8;case"medium":return 16;case"large":return 20;default:return typeof h=="string"?Number.parseInt(h,10):14}},s=j(()=>n(t.size)),o=j(()=>({width:s.value+"px",height:s.value+"px",color:t.color})),{getCachedValue:i,setCachedValue:r}=fh({dbName:MW,storeName:NW}),a=async h=>{const f=await i(h);if(typeof f=="string")return f},l=async(h,f)=>{await r(h,f)},u=j(()=>t.source==="rating"?"ratting":"icon"),c=j(()=>({name:t.src,size:s.value,color:t.color||"currentColor"})),{svgContent:d}=m1(c,u.value,l,a,"svg");return(h,f)=>(W(),ue("div",{class:Y(h.$style.iconWrapper),innerHTML:H(d),style:sn(o.value),about:t.src,"data-icon":"true"},null,14,OW))}}),VW={iconWrapper:"_iconWrapper_1n0y9_1"},_t=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},it=_t(LW,[["__cssModules",{$style:VW}]]);function BW(e,t,n){const s=document.createElement("div");s.className=n;const o=pT(e,t);return o.component("custom-icon",it),o.mount(s),{container:s,app:o}}function wg(e){if(!e)return;const t=e._vueApp;if(t)try{t.unmount(),delete e._vueApp}catch(n){console.warn("Error unmounting Vue app:",n)}}function $W(e,t){e._vueApp=t}const HW=e=>{const{container:t,app:n}=BW(Nq,{user:e.user,status:e.status,timezone:e.timezone,userConfig:e.userConfig,showInsightButton:e.showInsightButton,showCopyLinkButton:e.showCopyLinkButton,apiUpdateFunction:e.apiUpdateFunction,refreshInterval:e.refreshInterval,enableAutoRefresh:e.enableAutoRefresh,onInsightClick:e.onInsightClick,onCopyLink:e.onCopyLink},"user-profile-tooltip-content");return $W(t,n),t},v1=e=>{e._userProfileContainer&&(wg(e._userProfileContainer),delete e._userProfileContainer),e._userProfileInstance&&(gg(e._userProfileInstance),delete e._userProfileInstance),e.style.cursor="",e.classList.remove("user-profile-trigger")},GW={mounted(e,t){var s,o;if(!((s=t.value)!=null&&s.user)){console.warn("[UserProfile] User data is required");return}const n=t.value;n.onInsightClick=()=>{var i;(i=e._userProfileInstance)==null||i.hide()},e._userProfileInstance=a1(e,{...r1,delay:[300,0],content:((o=n.user)==null?void 0:o.name)||"User",placement:n.placement||"bottom-start",trigger:"mouseenter focus",onShow(i){e._userProfileContainer&&wg(e._userProfileContainer);const r=HW(n);e._userProfileContainer=r,i.setContent(r)},onHidden(){setTimeout(()=>{e._userProfileContainer&&(wg(e._userProfileContainer),e._userProfileContainer=void 0)},200)},onDestroy(){e._userProfileContainer&&(wg(e._userProfileContainer),e._userProfileContainer=void 0)}}),e._userProfileInstance.enable(),e.classList.add("user-profile-trigger")},updated(e,t){var n;if(!(!((n=t.value)!=null&&n.user)||!e._userProfileInstance)&&t.value!==t.oldValue)try{e._userProfileInstance.setProps({placement:t.value.placement||"bottom-start"}),e._userProfileInstance.hide()}catch(s){console.warn("Error updating tooltip props:",s)}},beforeUnmount(e){v1(e)},unmounted(e){v1(e)}},UW=["type","disabled","aria-readonly"],WW={key:0},mt=_t(dt({__name:"Button",props:{label:{default:""},variant:{default:"primary"},size:{default:"default"},disabled:{type:Boolean,default:!1},type:{default:"button"},rounded:{type:Boolean},highlightOnHover:{type:Boolean},border:{type:Boolean},action:{},readOnly:{type:Boolean,default:!1},actived:{type:Boolean,default:!1},loading:{type:Boolean}},emits:["handleClick"],setup(e,{expose:t,emit:n}){const s=qt,o=e,i=L(!1),r=L(null),a=()=>{o.disabled||(i.value=!0)},l=()=>{o.disabled||(i.value=!1)};Qt(()=>{r.value&&(r.value.addEventListener("mouseenter",a),r.value.addEventListener("mouseleave",l))}),Yn(()=>{r.value&&(r.value.removeEventListener("mouseenter",a),r.value.removeEventListener("mouseleave",l))});const u=n,c=new Set(["primary","secondary","tertiary","text","menu-item"]),d=j(()=>Array.isArray(o.variant)?o.variant:[o.variant]),h=ag(),f=j(()=>{const C=[h.customButton],R=d.value.find(E=>c.has(E))||"primary";return C.push(h[`is-${R}`]),d.value.includes("danger")&&C.push(h["is-danger"]),d.value.includes("icon")&&C.push(h["is-icon"]),o.readOnly&&C.push(h["is-readonly"]),o.rounded&&C.push(h["is-rounded"]),o.border&&C.push(h["has-border"]),o.highlightOnHover&&C.push(h["highlight-on-hover"]),b.value&&C.push(h["has-prefix"]),S.value&&C.push(h["has-suffix"]),o.actived&&C.push(h["is-active"]),o.disabled&&C.push(h.disabled),o.loading&&C.push(h["is-loading"]),typeof o.size=="string"&&C.push(h[`size-${o.size}`]),C}),p=j(()=>o.readOnly===!0),m=j(()=>typeof o.size=="number"?{"--button-size":`${o.size}px`}:{}),v=C=>{var R;o.disabled||o.readOnly||(u("handleClick",C),(R=o.action)==null||R.call(o))},w=mw(),b=j(()=>!!w.prefix),S=j(()=>!!w.suffix);return t({buttonRef:r,focus:()=>{var C;(C=r.value)==null||C.focus()}}),(C,R)=>(W(),ue("button",{class:Y(f.value),type:o.type,disabled:o.disabled,"aria-readonly":p.value,style:sn(m.value),onClick:v,ref_key:"buttonRef",ref:r},[Pt(C.$slots,"prefix"),Pt(C.$slots,"default",{hovered:i.value},()=>[e.label?qe((W(),ue("span",WW,[st(Ct(e.label),1)])),[[H(s),{content:e.label}]]):Ze("",!0)]),Pt(C.$slots,"suffix")],14,UW))}}),[["__cssModules",{$style:{customButton:"_customButton_1ssc5_1","size-extra-small":"_size-extra-small_1ssc5_21","size-small":"_size-small_1ssc5_26","size-medium":"_size-medium_1ssc5_31","size-large":"_size-large_1ssc5_36","size-default":"_size-default_1ssc5_41","is-primary":"_is-primary_1ssc5_44","is-active":"_is-active_1ssc5_52","is-danger":"_is-danger_1ssc5_55","is-secondary":"_is-secondary_1ssc5_64","is-tertiary":"_is-tertiary_1ssc5_88","is-text":"_is-text_1ssc5_108","is-menu-item":"_is-menu-item_1ssc5_125","is-icon":"_is-icon_1ssc5_157","is-readonly":"_is-readonly_1ssc5_179","is-rounded":"_is-rounded_1ssc5_182","has-border":"_has-border_1ssc5_185","highlight-on-hover":"_highlight-on-hover_1ssc5_188","icon-wrapper":"_icon-wrapper_1ssc5_188","is-loading":"_is-loading_1ssc5_191",spin:"_spin_1ssc5_1"}}]]);/*!
104
104
  * Compressor.js v1.2.1
105
105
  * https://fengyuanchen.github.io/compressorjs
106
106
  *
@@ -247,4 +247,4 @@ If you are trying to annotate ${s} with application data, use the '${s}.context'
247
247
  `+r.map(q2).join(`
248
248
  `):" "+q2(r[0]):"as no adapter specified";throw new zt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}const Y2={getAdapter:xwe,adapters:c_};function d_(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new bd(null,e)}function Z2(e){return d_(e),e.headers=mo.from(e.headers),e.data=u_.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Y2.getAdapter(e.adapter||np.adapter,e)(e).then(function(s){return d_(e),s.data=u_.call(e,e.transformResponse,s),s.headers=mo.from(s.headers),s},function(s){return M2(s)||(d_(e),s&&s.response&&(s.response.data=u_.call(e,e.transformResponse,s.response),s.response.headers=mo.from(s.response.headers))),Promise.reject(s)})}const X2="1.13.2",vy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{vy[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const J2={};vy.transitional=function(t,n,s){function o(i,r){return"[Axios v"+X2+"] Transitional option '"+i+"'"+r+(s?". "+s:"")}return(i,r,a)=>{if(t===!1)throw new zt(o(r," has been removed"+(n?" in "+n:"")),zt.ERR_DEPRECATED);return n&&!J2[r]&&(J2[r]=!0,console.warn(o(r," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,r,a):!0}},vy.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Fwe(e,t,n){if(typeof e!="object")throw new zt("options must be an object",zt.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const i=s[o],r=t[i];if(r){const a=e[i],l=a===void 0||r(a,i,e);if(l!==!0)throw new zt("option "+i+" must be "+l,zt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new zt("Unknown option "+i,zt.ERR_BAD_OPTION)}}const yy={assertOptions:Fwe,validators:vy},Sr=yy.validators;let Su=class{constructor(t){this.defaults=t||{},this.interceptors={request:new P2,response:new P2}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
249
249
  `+i):s.stack=i}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=bu(this.defaults,n);const{transitional:s,paramsSerializer:o,headers:i}=n;s!==void 0&&yy.assertOptions(s,{silentJSONParsing:Sr.transitional(Sr.boolean),forcedJSONParsing:Sr.transitional(Sr.boolean),clarifyTimeoutError:Sr.transitional(Sr.boolean)},!1),o!=null&&(ke.isFunction(o)?n.paramsSerializer={serialize:o}:yy.assertOptions(o,{encode:Sr.function,serialize:Sr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),yy.assertOptions(n,{baseUrl:Sr.spelling("baseURL"),withXsrfToken:Sr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let r=i&&ke.merge(i.common,i[n.method]);i&&ke.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),n.headers=mo.concat(r,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let c,d=0,h;if(!l){const p=[Z2.bind(this),void 0];for(p.unshift(...a),p.push(...u),h=p.length,c=Promise.resolve(n);d<h;)c=c.then(p[d++],p[d++]);return c}h=a.length;let f=n;for(;d<h;){const p=a[d++],m=a[d++];try{f=p(f)}catch(v){m.call(this,v);break}}try{c=Z2.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,h=u.length;d<h;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=bu(this.defaults,t);const n=B2(t.baseURL,t.url,t.allowAbsoluteUrls);return I2(n,t.params,t.paramsSerializer)}};ke.forEach(["delete","get","head","options"],function(t){Su.prototype[t]=function(n,s){return this.request(bu(s||{},{method:t,url:n,data:(s||{}).data}))}}),ke.forEach(["post","put","patch"],function(t){function n(s){return function(i,r,a){return this.request(bu(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:r}))}}Su.prototype[t]=n(),Su.prototype[t+"Form"]=n(!0)});let Iwe=class MB{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const s=this;this.promise.then(o=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](o);s._listeners=null}),this.promise.then=o=>{let i;const r=new Promise(a=>{s.subscribe(a),i=a}).then(o);return r.cancel=function(){s.unsubscribe(i)},r},t(function(i,r,a){s.reason||(s.reason=new bd(i,r,a),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new MB(function(o){t=o}),cancel:t}}};function Pwe(e){return function(n){return e.apply(null,n)}}function Awe(e){return ke.isObject(e)&&e.isAxiosError===!0}const h_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(h_).forEach(([e,t])=>{h_[t]=e});function Q2(e){const t=new Su(e),n=g2(Su.prototype.request,t);return ke.extend(n,Su.prototype,t,{allOwnKeys:!0}),ke.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Q2(bu(e,o))},n}const ns=Q2(np);ns.Axios=Su,ns.CanceledError=bd,ns.CancelToken=Iwe,ns.isCancel=M2,ns.VERSION=X2,ns.toFormData=fy,ns.AxiosError=zt,ns.Cancel=ns.CanceledError,ns.all=function(t){return Promise.all(t)},ns.spread=Pwe,ns.isAxiosError=Awe,ns.mergeConfig=bu,ns.AxiosHeaders=mo,ns.formToJSON=e=>k2(ke.isHTMLForm(e)?new FormData(e):e),ns.getAdapter=Y2.getAdapter,ns.HttpStatusCode=h_,ns.default=ns;const{Axios:bRe,AxiosError:SRe,CanceledError:ERe,isCancel:_Re,CancelToken:RRe,VERSION:DRe,all:TRe,Cancel:xRe,isAxiosError:kwe,spread:FRe,toFormData:IRe,AxiosHeaders:PRe,HttpStatusCode:ARe,formToJSON:kRe,getAdapter:ORe,mergeConfig:MRe}=ns,Owe=e=>{const n=`; ${document.cookie}`.split(`; ${e}=`);if(n.length===2){const s=n.pop();return(s==null?void 0:s.split(";").shift())??null}return null},Mwe=6e4,eB=e=>({[`/api/v1/workspace/${e}/item/2`]:1,[`/api/v1/workspace/${e}/item/2/metrics`]:5,default:5}),wy=new Map,tB=e=>{const t=e.match(/\/api\/v1\/workspace\/([^/]+)/);return t?t[1]:null},Nwe=e=>{const t=tB(e),n=eB(t||"none"),o=new URL(e,"https://dummy.com").pathname,i=Object.keys(n).find(a=>a!=="default"&&o===a)||"default";wy.has(i)||wy.set(i,{ongoing:0,queue:[]});const r=wy.get(i);return new Promise(a=>{r?r.ongoing<n[i]?(r.ongoing++,a()):r.queue.push(()=>{r.ongoing++,a()}):a()})},nB=e=>{const t=tB(e),n=eB(t||"none"),o=new URL(e,"https://dummy.com").pathname,i=Object.keys(n).find(a=>a!=="default"&&o===a)||"default",r=wy.get(i);if(r&&(r.ongoing--,r.queue.length>0)){const a=r.queue.shift();setTimeout(()=>{a==null||a()},1e3)}},Lwe=(()=>{const e=ns.create({timeout:Mwe,headers:{"Content-Type":"application/json"}});return e.interceptors.request.use(async t=>{const n=t.url||"";await Nwe(n);const s=Owe("account.token");return s&&t.headers&&(t.headers.Authorization=`Bearer ${s}`),t.headers&&(t.headers["Access-Control-Allow-Origin"]="*",t.headers["Access-Control-Allow-Headers"]="*",t.headers["Accept-Language"]="*"),t},t=>Promise.reject(t)),e.interceptors.response.use(t=>(nB(t.config.url||""),t),async t=>{var s,o;if(t.config&&nB(t.config.url||""),t.code==="ERR_NETWORK"||!navigator.onLine)return Promise.reject(t);const n=t.config;if(((s=t.response)==null?void 0:s.status)===429&&(!n._retryCount||n._retryCount<3)){n._retryCount=(n._retryCount||0)+1;const i=t.response.headers["retry-after"],r=i?parseInt(i)*1e3:Math.pow(2,n._retryCount)*1e3;return await new Promise(a=>setTimeout(a,r)),e(n)}return((o=t.response)==null?void 0:o.status)===401&&!n._retry&&(n._retry=!0),Promise.reject(t)}),e})();class op extends Error{constructor(t,n,s,o,i){super(t),this.name="ApiError",this.statusCode=n,this.code=s,this.details=o,this.type=i,Object.setPrototypeOf(this,op.prototype)}}const ip=e=>{var t,n;if(kwe(e)){const s=(t=e.response)==null?void 0:t.status,o=(n=e.response)==null?void 0:n.data,i=(o==null?void 0:o.message)||e.message||"An unexpected error occurred",r=(o==null?void 0:o.code)||e.code,a=(o==null?void 0:o.details)||o;let l="UNKNOWN";return!s||e.code==="ERR_NETWORK"||e.code==="ECONNABORTED"?l=e.code==="ECONNABORTED"?"TIMEOUT":"NETWORK":s>=500?l="SERVER":s===_c.UNAUTHORIZED||s===_c.FORBIDDEN?l="AUTH":s===_c.UNPROCESSABLE_ENTITY||s===_c.BAD_REQUEST?l="VALIDATION":s>=_c.BAD_REQUEST&&(l="CLIENT"),new op(i,s,r,a,l)}return e instanceof Error?new op(e.message,void 0,void 0,void 0,"UNKNOWN"):new op("An unknown error occurred",void 0,void 0,void 0,"UNKNOWN")};class Vwe{constructor(){this.axios=Lwe}buildUrl(t=""){const n=t.replace(/^\//,"");return!n.startsWith("http://")&&!n.startsWith("https://")?`/${n}`:n??""}buildQueryParams(t){const n=new URLSearchParams;Object.entries(t).forEach(([o,i])=>{i!=null&&i!==""&&(Array.isArray(i)?i.forEach(r=>n.append(o,String(r))):typeof i=="object"?n.append(o,JSON.stringify(i)):n.append(o,String(i)))});const s=n.toString();return s?`?${s}`:""}async get(t="",n,s){try{const o=this.buildUrl(t),i=n?this.buildQueryParams(n):"";return(await this.axios.get(`${o}${i}`,s)).data}catch(o){throw ip(o)}}async post(t="",n,s,o){try{const i=this.buildUrl(t),r=n?this.buildQueryParams(n):"";return(await this.axios.post(`${i}${r}`,s,o)).data}catch(i){throw ip(i)}}async put(t="",n,s){try{const o=this.buildUrl(t);return(await this.axios.put(o,n,s)).data}catch(o){throw ip(o)}}async patch(t="",n,s){try{const o=this.buildUrl(t);return(await this.axios.patch(o,n,s)).data}catch(o){throw ip(o)}}async delete(t="",n,s){try{const o=this.buildUrl(t);return(await this.axios.delete(o,{data:n,...s})).data}catch(o){throw ip(o)}}}const Bwe=({domainApi:e,wsCode:t,entityId:n})=>({list_cursor:{url:`${e}/v1/workspace/${t}/item/2`,method:"post",code:"list_cursor"},assignedUser:{url:`${e}/v1/workspace/${t}/item/2/assigned-users`,method:"post",code:"assignedUser"},metricValues:{url:`${e}/v1/workspace/${t}/item/2/metrics`,method:"post",code:"metricValues"},multipleAssignableUser:{url:`${e}/v1/workspace/${t}/item/2/assignable-users`,method:"post",code:"multipleAssignableUser"},assignableUser:{url:`${e}/v1/workspace/${t}/item/2/assignable-users`,method:"post",code:"assignableUser"},assignableStatus:{url:`${e}/v1/workspace/${t}/item/2/assignable-statuses`,method:"post",code:"assignableStatus"},delete_rendition:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-rendition`,method:"delete",code:"delete_rendition"},delete_thumbnail:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-thumbnail`,method:"delete",code:"delete_thumbnail"},archive_item:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"archive_item"},unarchive_item:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"unarchive_item"},removeAssignee:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete-assignee`,method:"delete",code:"removeAssignee"},basicInfor:{url:`${e}/v1/workspace/${t}/tile/people/ws-user-roles/{userId}/basic-info`,method:"get",code:"basicInfor"},bulkDelete:{url:`${e}/v1/workspace/${t}/item/2/bulk-delete`,method:"delete",code:"bulkDelete"},bulkArchive:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"bulkArchive"},bulkDateUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-date-update`,method:"put",code:"bulkDateUpdate"},bulkAssignUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-assignee-update`,method:"put",code:"bulkAssignUpdate"},bulkStatusUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-status-update`,method:"put",code:"bulkStatusUpdate"},bulkMetricUpdate:{url:`${e}/v1/workspace/${t}/item/2/bulk-metric-update`,method:"put",code:"bulkMetricUpdate"},getPermission:{url:`${e}/v1/workspace/${t}/item/2/permissions`,method:"post",code:"getPermission"},getUserPermission:{url:`${e}/v1/workspace/${t}/permissions`,method:"get",code:"getUserPermission"},bulkUnarchive:{url:`${e}/v1/workspace/${t}/item/2/bulk-archive`,method:"put",code:"bulkUnarchive"},downloadTemplate:{url:`${e}/v1/workspace/${t}/item/2/download-sample`,method:"get",code:"downloadTemplate"},importItems:{url:`${e}/v1/workspace/${t}/item/2/import-from-file`,method:"post",code:"importItems"},exportItems:{url:`${e}/v1/workspace/${t}/item/2/export`,method:"get",code:"exportItems"},updateFromFile:{url:`${e}/v1/workspace/${t}/item/2/update-from-file`,method:"post",code:"updateFromFile"},metricList:{url:`${e}/v1/workspace/${t}/entity/2/metrics`,method:"get",code:"metricList"},getEntityDetail:{url:`${e}/workspace/${t}/entities/${n}?include_permission=1`,method:"get",code:"getEntityDetail"},item:{url:`${e}/v1/workspace/${t}/item/2/update`,method:"put",code:"item"},me:{url:`${e}/v1/me`,method:"get",code:"me"},workspaces:{url:`${e}/v1/workspaces`,method:"get",code:"workspaces"},entityUserRoles:{url:`${e}/v1/workspace/${t}/entity/2/users`,method:"get",code:"entityUserRoles"},templateFlowStatuses:{url:`${e}/workspace/${t}/entities/${n}/template_flow_statuses`,method:"get",code:"templateFlowStatuses"},createNewItem:{url:`${e}/v1/workspace/${t}/item/2/new?entity_id=${n}`,method:"post",code:"createNewItem"},getAssignableStatuses:{url:`${e}/v1/workspace/${t}/entity/2/assignable-statuses`,method:"get",code:"getAssignableStatuses"},getAssignableAssignees:{url:`${e}/v1/workspace/${t}/entity/2/users`,method:"get",code:"getAssignableAssignees"}}),$we=(e,t)=>{const n=new Blob([e]),s=globalThis.URL.createObjectURL(n),o=document.createElement("a");o.href=s,o.download=t,document.body.appendChild(o),o.click(),o.remove(),globalThis.URL.revokeObjectURL(s)};class sB extends Vwe{constructor(t,n){const s=n==null?void 0:n.domainApi,o=(n==null?void 0:n.wsCode)||"w:yngazem",i=(n==null?void 0:n.entityId)||"";super(),this.events=Object.create(null);const r=Bwe({domainApi:s,wsCode:o,entityId:i}),a={};Object.entries(r).forEach(([l,u])=>{const c=l;t[c]?a[c]=t[c]:(console.warn(`API config for ${c} is missing, using base config.`),a[c]=u)}),this.apiConfig=a}on(t,n){var s;((s=this.events)[t]??(s[t]=[])).push(n)}off(t,n){const s=this.events[t];s&&(this.events[t]=s.filter(o=>o!==n))}emit(t,...n){const s=this.events[t];s!=null&&s.length&&s.forEach(o=>{try{o(...n)}catch(i){console.error(`Error in event listener for ${t}:`,i)}})}buildHeaders(t){return typeof FormData<"u"&&t instanceof FormData?{"Content-Type":"multipart/form-data"}:{}}async _requestHandler({method:t,path:n,params:s,payload:o,code:i,responseType:r}){var u,c;const a=this.buildHeaders(o);let l;try{if(l=await this.axios.request({method:t,url:n,params:s,data:o,headers:a,responseType:r}),(((u=l.headers)==null?void 0:u["content-type"])||"").includes("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")){const h=((c=l.headers)==null?void 0:c["content-disposition"])||"",f=h.includes("filename=")?h.split("filename=")[1]:"exported_items.xlsx";$we(l.data,f)}if(l.status>=400&&l.status<=500)throw new Error(`Client error (${l.status}): ${l.statusText}`);return this.emit("call-api",{apiCode:i,path:n,params:s,payload:o,res:l,success:!0}),l.data}catch(d){throw console.error("API Request Error:",d),d.code==="ERR_NETWORK"||!navigator.onLine?this.emit("call-api",{path:n,params:s,payload:o,error:new Error("You are currently offline. Please check your network connection."),success:!1,apiCode:"offline"}):this.emit("call-api",{path:n,params:s,payload:o,error:d,success:!1,apiCode:i,res:d==null?void 0:d.response}),d}}generateUrl(t,n){let s=t;return Object.entries(n).forEach(([o,i])=>{s=s.replace(`{${o}}`,String(i))}),s}async request(t,n,s={}){const{url:o,code:i,method:r}=this.apiConfig[t],a=this.generateUrl(o,n);return this._requestHandler({method:r,path:a,params:s.params,payload:s.payload,code:i,responseType:s.responseType})}async getAllItem_cursor(t){var i;const n=t.workspaceId,s={entity_ids:((i=t.entityIds)==null?void 0:i.join(","))||"",cursor:t.cursor||void 0,per_page:t.pageSize||t.perPage||20,offset:t.offset||void 0,search:t.search||t.q||void 0,include_signature:1,include:"last_updated_by,property,last_completed_by",include_permission:"{include_permission}",assignee_any_ina:(t==null?void 0:t.assignee_any_ina)||"",assignee_all_ina:(t==null?void 0:t.assignee_all_ina)||void 0,with_not_assigned:t.with_not_assigned||void 0,status_ina:t.status_ina||void 0,status_eq:t.status_eq||void 0,start_date_gte:t.start_date_gte||void 0,start_date_lte:t.start_date_lte||void 0,start_date_btw:t.start_date_btw||void 0,due_date_gte:t.due_date_gte||void 0,due_date_lte:t.due_date_lte||void 0,due_date_btw:t.due_date_btw||void 0,condition_combine_type:t.condition_combine_type||"or",preflight_status:t.preflight_status||void 0},o=t.sortBy;return this.request("list_cursor",{workspaceId:n},{params:s,payload:{sort_by:o}})}async getAssignedUser(t){const n={item_ids:t.item_ids||[],metric_ids:t.metric_ids||[]},s={per_page:t.per_page};return this.request("assignedUser",{workspaceId:t.workspaceId},{params:s,payload:n})}async getMetricList({workspaceId:t,entityId:n,page:s,query:o,per_page:i}){return this.request("metricList",{workspaceId:t,entityId:n},{params:{status_ed:1,include:"metric_type",entity_id:n,include_permission:1,per_page:i||100,page:s||1,name_like:o||void 0}})}async getMetricValues({workspaceId:t,item_ids:n,per_page:s,metric_ids:o}){const i={item_ids:n,metric_ids:o};return this.request("metricValues",{workspaceId:t},{params:{per_page:s,include_permission:1},payload:i})}async multipleAssignableUser(t){const n=t.workspaceId,s=t.itemIds,o={page:t.page||1,per_page:t.perPage,display_name_like:t.q||"",item_ids:s||[]};return this.request("multipleAssignableUser",{workspaceId:n},{payload:o})}async getAssignableStatus(t){const n=t.workspaceId,s={item_ids:t.itemIds||[],page:t.page||1,per_page:t.perPage||10,name_like:t.name_like||""};return this.request("assignableStatus",{workspaceId:n||""},{payload:s})}async updateSceneName({workspaceId:t,entityId:n,itemId:s,name:o}){const i={item_id:s,entity_id:n,name:o,include:"item_user_roles"};return this.request("item",{workspaceId:t,itemId:s},{payload:i})}async deleteScene(t,n,s){const o={item_ids:[s]};return this.request("bulkDelete",{workspaceId:t,entityId:n},{payload:o})}async deleteThumbnail({workspaceId:t,itemIds:n,entityId:s}){const o={item_ids:n,entity_id:s};return!n||n.length===0?o.item_ids=void 0:o.entity_id=void 0,this.request("delete_thumbnail",{workspaceId:t},{payload:o})}async deleteRendition({workspaceId:t,itemIds:n,deleteAll:s=!1,entityId:o}){const i={item_ids:n,delete_all:s?1:void 0,entity_id:o};return!n||n.length===0?i.item_ids=void 0:i.entity_id=void 0,this.request("delete_rendition",{workspaceId:t},{payload:i})}async archiveScene(t,n,s){const o={item_ids:s,status:0};return this.request("archive_item",{workspaceId:t,entityId:n},{payload:o})}async changeDate({workspaceId:t,itemIds:n,startDate:s,dueDate:o,entityId:i,filterParams:r}){const a={item_ids:n,start_date:s,due_date:o,entity_id:i};return this.request("bulkDateUpdate",{workspaceId:t},{payload:a,params:r})}async updateAssignee(t){const{workspaceId:n,itemIds:s,userIds:o,entityId:i}=t,r={item_ids:s,ws_user_role_ids:o,entity_id:i};return this.request("bulkAssignUpdate",{workspaceId:n},{payload:r,params:t.filterParams})}createUpdateEntityPayload(t){const{itemIds:n,userIds:s,entityId:o}=t,i={item_ids:n,ws_user_role_ids:s,entity_id:o};return!n||n.length===0?(i.item_ids=void 0,i.entity_id=o):(i.item_ids=n,i.entity_id=void 0),i}async removeAssignee(t){const n=this.createUpdateEntityPayload(t);return this.request("removeAssignee",{workspaceId:t.workspaceId},{payload:n,params:t.filterParams})}async replaceAssignee(t){const{workspaceId:n,itemIds:s,userIds:o,entityId:i}=t,r={item_ids:s,ws_user_role_ids:o,entity_id:i};return this.request("bulkAssignUpdate",{workspaceId:n},{params:{replace:1,...t.filterParams},payload:r})}async addAssignee({workspaceId:t,itemIds:n,userIds:s,entityId:o,filterParams:i}){const r={item_ids:n,ws_user_role_ids:s,entity_id:o};return this.request("bulkAssignUpdate",{workspaceId:t},{payload:r,params:i})}async unAssignAll(t){const{workspaceId:n,entityId:s,itemIds:o,filterParams:i}=t,r={item_ids:o,entity_id:s,ws_user_role_ids:[]};return!o||o.length===0?r.item_ids=void 0:r.entity_id=void 0,this.request("removeAssignee",{workspaceId:n,entityId:String(s)},{payload:r,params:i})}async updateItemStatus(t){const{workspaceId:n,itemIds:s=[],statusId:o,entityId:i}=t,r={item_ids:s,template_flow_status_id:o};return s.length||(r.item_ids=void 0,r.entity_id=i),this.request("bulkStatusUpdate",{workspaceId:n},{payload:r,params:t.filterParams})}async getUserInformation(t,n){return this.request("basicInfor",{workspaceId:t,userId:n})}async bulkDeleteItems({workspaceId:t,itemIds:n,entityId:s}){const o={item_ids:n,entity_id:s};return!n||n.length===0?o.item_ids=void 0:o.entity_id=void 0,this.request("bulkDelete",{workspaceId:t},{payload:o})}async bulkUnarchiveItems({workspaceId:t,itemIds:n,entityId:s}){const o={item_ids:n,status:1,entity_id:s};return!n||n.length===0?o.item_ids=void 0:o.entity_id=void 0,this.request("bulkUnarchive",{workspaceId:t},{payload:o})}async bulkArchiveItems({workspaceId:t,itemIds:n,entityId:s}){const o={item_ids:n,status:0,entity_id:s};return!n||n.length===0?o.item_ids=void 0:o.entity_id=void 0,this.request("bulkArchive",{workspaceId:t},{payload:o})}async bulkUpdateMetric(t){const{workspaceId:n,itemIds:s,metricId:o,value:i,clear:r}=t,a={item_ids:s,metric_id:o,metric_value:i,clear:r??(i==null?1:0),entity_id:t.entityId};return t.itemIds===void 0?(delete a.item_ids,a.entity_id=String(t.entityId)):(a.item_ids=s,a.entity_id=void 0),this.request("bulkMetricUpdate",{workspaceId:n},{payload:a,params:t.filterParams})}async getPermissionForItems({workspaceId:t,itemIds:n}){const s={item_ids:n};return this.request("getPermission",{workspaceId:t},{payload:s,params:{per_page:50}})}async unarchiveScene(t,n,s){const o={item_ids:s,status:1};return this.request("unarchive_item",{workspaceId:t,entityId:n},{payload:o})}async getUserPermission(t){return this.request("getUserPermission",{workspaceId:t})}async getEntityDetail(t,n){return this.request("getEntityDetail",{workspaceId:t,entityId:n})}async downloadTemplate(t,n){return this.request("downloadTemplate",{workspaceId:t,entityId:n},{responseType:"blob",params:{format:"xlsx",entity_id:n}})}async downloadExportedItemsFile(t,n){return this.request("exportItems",{workspaceId:t,exportId:n},{responseType:"blob",params:{format:"xlsx",entity_id:n}})}async addNewSceneViaImportFile(t,n,s){return this.request("importItems",{workspaceId:t,entityId:n},{payload:s})}async overwriteScenesViaImportFile(t,n,s){return this.request("updateFromFile",{workspaceId:t,entityId:n},{payload:s})}async getMe(){return this.request("me",{})}async getWorkspaces(t){const n={page:1,per_page:1,"ws_user_role>status_eq":1,include:"owner",include_ws:t};return this.request("workspaces",{},{params:n})}async getEntityUserRoles(t){const{workspaceId:n,page:s,per_page:o,display_name_like:i,entity_ids:r}=t;return this.request("entityUserRoles",{workspaceId:n},{params:{page:s,per_page:o,display_name_like:i,entity_ids:r}})}async getTemplateFlowStatuses(t){const{workspaceId:n,entityId:s}=t;return this.request("templateFlowStatuses",{workspaceId:n,entityId:s},{params:{per_page:100,page:t.page??1,all:1,name_like:t.name_like}})}async addNewItem(t,n,s){return this.request("createNewItem",{workspaceId:t,entityId:n},{payload:s})}async getAssignableStatuses(t,n){return this.request("getAssignableStatuses",{workspaceId:t},{params:n})}async getAssignableAssignees(t,n){return this.request("getAssignableAssignees",{workspaceId:t},{params:n})}}const Hwe=()=>{const e=Cn.getInstance().getItem("API_BASE_URL");return e!=null&&e.includes("v1")?e.slice(0,e.lastIndexOf("/v1")):String(e)},Gwe=e=>{var F,P,ee;const{showMessage:t,showErrorNetMessage:n}=Yh(),s=Rs(),o={domainApi:Hwe(),wsCode:Cn.getInstance().getItem("ws.code"),entityId:e.value.entityId},i=(ee=(P=(F=s==null?void 0:s.appContext)==null?void 0:F.config)==null?void 0:P.globalProperties)==null?void 0:ee.apiConfig;if(!i||o.domainApi===""||o.wsCode==="")throw new Error("API configuration is missing in useItems");const r=new sB(i,o);r.on("call-api",Z=>{Z.success?t(Z.apiCode,"success"):n(Z)});const a=No({}),l=L([]),u=L(!1),c=L(null),d=L(null),h=L(1),f=L(20);let p=Promise.resolve();const{setCachedUsers:m}=s7(),v=Z=>({workspaceId:e.value.workspaceId,entityIds:[e.value.entityId],orderBy:"id-asc",include_permission:"{include_permission}",include_permission_names:!0,q:Z}),w=50,b=async(Z,B,ne)=>{if(!Z.length)return[];const K=p4(Z,B);return(await Promise.all(K.map(ne))).flat()},S=async Z=>{try{return(await r.getPermissionForItems({workspaceId:e.value.workspaceId,itemIds:Z})).data.map(ne=>[ne.id,ne.permission])}catch(B){return console.error("Failed to fetch item permissions chunk:",B),[]}},C=async(Z,B)=>{try{const ne=await r.getMetricValues({workspaceId:e.value.workspaceId,item_ids:Z,per_page:Z.length*B.length,metric_ids:B}),K=ne.data.map(G=>{const Q=new Map(G.item_metrics.map(q=>[q.metric_id,{value:q.value,auth_permission:q==null?void 0:q.auth_permission}])),U=Object.fromEntries(B.map(q=>[q,Q.get(q)??null]));return[G.id,U]}),oe=new Set(ne.data.map(G=>G.id));for(const G of Z)if(!oe.has(G)){const Q=Object.fromEntries(B.map(U=>[U,{value:null,auth_permission:void 0}]));K.push([G,Q])}return K}catch(ne){return console.error("Failed to fetch a chunk of metric values:",ne),Z.map(oe=>[oe,Object.fromEntries(B.map(G=>[G,void 0]))])}},R=async Z=>{try{const B=await r.getAssignedUser({workspaceId:e.value.workspaceId,item_ids:Z,per_page:Z.length}),ne=B.data.flatMap(K=>K.assignees);return m(ne),B.data.map(K=>[K.id,K.assignees])}catch(B){return console.error("Failed to fetch a chunk of assigned users:",B),[]}},E=async Z=>{if(!Z.length)return console.warn("getPermissionForItems: Empty itemIds"),{};try{const B=await b(Z,w,S);return Object.fromEntries(B)}catch(B){return console.error("Failed to fetch item permissions:",B),{}}},T=async(Z,B)=>!Z.length||!B.length?{}:(p=p.then(async()=>{try{const oe=[];let G=0;for(let U=0;U<B.length;U+=5){G++;const q=B.slice(U,U+5),re=[];for(let We=0;We<q.length;We++){const he=q[We],ae=await b(Z,w,te=>C(te,[he]));re.push(ae),await new Promise(te=>setTimeout(te,500))}oe.push(...re);const Te=U+5>=B.length}const Q={};for(const U of oe.flat()){const[q,re]=U;Q[q]||(Q[q]={}),Object.assign(Q[q],re)}return Q}catch(ne){return console.error("Failed to fetch metric values:",ne),{}}}),p),k=async Z=>{if(!Z.length)return console.warn("getAssignedUsers: Empty itemIds"),{};try{const B=await b(Z,w,R);return Object.fromEntries(B)}catch(B){return console.error("Failed to fetch assigned users:",B),{}}};return{items:l,loading:u,error:c,pagination:d,currentPage:h,pageSize:f,cusorMap:a,fetchItems:async Z=>{const{cursor:B,offset:ne,size:K,searchQuery:oe}=Z;let G=[];u.value=!0,c.value=null;try{const Q=await r.getAllItem_cursor({...Z,cursor:B||void 0,offset:ne||void 0,pageSize:K||f.value,...v(oe),sortBy:Z.sort_by});return l.value=Q.data,d.value=Q.meta,h.value=Q.meta.current_page||0,G=Q.data.map(U=>U.id),Q}catch(Q){throw c.value=Q,console.error("Failed to fetch items (cursor):",Q),Q}finally{const Q=async()=>{try{const[U,q]=await Promise.all([k(G),E(G)]);e.value.updateItemData({assignees:U,permission:q},G);const re=await T(G,e.value.metricIds);e.value.setMetricValues(re,new Set(G),e.value.metricIds)}catch(U){console.error("Post-fetch processing failed:",U)}};u.value=!1,setTimeout(Q)}},getAssignableStatus:async Z=>{try{return await r.getAssignableStatus({workspaceId:e.value.workspaceId,itemIds:Z})}catch(B){throw console.error("Failed to fetch assignable status:",B),B}},getMetricList:async Z=>{try{return await r.getMetricList({workspaceId:e.value.workspaceId,entityId:Z})}catch(B){throw console.error("Failed to fetch metric list:",B),B}},getMetricValues:T,getAssignedUsers:k}};function Uwe(e){return{updateRowData:(s,o)=>{if(!e.value)return;const i=[],r=new Set,a=e.value.getColumnDefs();if(!a)return;const l=a.map(u=>{if(u.field&&u.field.startsWith("metric_")&&(u.hide===!1||u.hide===void 0))return u.field}).filter(Boolean);o.forEach(u=>{var d;const c=(d=e.value)==null?void 0:d.getRowNode(u);if(c){if(i.push(c),s.assignees){const h=WK((s.assignees[u]||[]).map(hI));c.data.assignees=h,r.add("assignees")}s.permission&&(c.data.permissions=s.permission[u]),l.forEach(h=>{c.data[h]=c.data[h]??null})}}),r.add("assignees"),r.add("status"),r.add("dateRange"),r.add("moreActions"),r.add("name"),e.value.refreshCells({rowNodes:i,columns:Array.from(r),force:!0})},setMetricValues:(s,o,i)=>{const r=e.value;if(!r)return;const a=new Map(Array.from(o).map(u=>[u,new Map(i.map(c=>[c,{value:null,auth_permission:void 0}]))]));Object.entries(s).forEach(([u,c])=>{Object.entries(c).forEach(([d,h])=>{var f;(f=a.get(u))==null||f.set(d,{value:h==null?void 0:h.value,auth_permission:h==null?void 0:h.auth_permission})})});const l=Array.from(a.entries()).map(([u,c])=>{const d=r.getRowNode(u);return d!=null&&d.data?(c.forEach((h,f)=>{const p=`metric_${f}`;d.data[p]=(h==null?void 0:h.value)||null;const m=`metric_permission_${f}`;d.data[p]=(h==null?void 0:h.value)||null,d.data[m]=(h==null?void 0:h.auth_permission)||null}),d):null});l.length>0&&r.refreshCells({rowNodes:l,columns:Array.from(i).map(u=>`metric_${u}`),force:!0})}}}function Wwe(e,t,n,s,o){let i=!0;return{async getRows(r){try{s(!0),i&&(o(!0),i=!1);const a=Math.floor(r.startRow/t)+1,{rows:l,total:u}=await e({page:a,pageSize:t,filterText:n(),sort_by:r.sortModel});let c=-1;Number.isFinite(u)?c=u:l.length<t&&(c=r.startRow+l.length),r.context={pageSize:t,text:n()},r.successCallback(l,c),s(!1),o(!1)}catch(a){console.error("Datasource fetch error:",a),r.failCallback(),s(!1),o(!1)}}}}function zwe(e){const{selectRowData:t,isSidebarOpen:n,quickFilterText:s,gridApi:o,fetcher:i}=e,r=L(!0),a=L(!0),l=L(!1),u=()=>{n.value=!n.value},c=v=>{if(r.value=!1,o.value=v,!v)return null;const{addEventListener:w,setGridOption:b}=v;if(!i)return console.error("Fetcher function is undefined"),null;const S=Wwe(i,e.perPage,()=>s.value,C=>{r.value=C},C=>{a.value=C});return b==null||b("datasource",S),w==null||w("selectionChanged",()=>{t.value=v.getSelectedRows()}),v||null},d=v=>{var w,b;if((w=o.value)==null||w.hideOverlay(),v!==void 0&&(s.value=v),(b=o.value)==null||b.deselectAll(),t.value=[],r.value=!0,!o.value||!i){console.error("Grid API or fetcher is not available"),r.value=!1;return}l.value=!0,a.value=!0,o.value.purgeInfiniteCache(),o.value.ensureIndexVisible(0,"top"),setTimeout(()=>{r.value=!1,setTimeout(()=>{l.value=!1},100)},300)},h=()=>{var v;(v=o.value)==null||v.deselectAll(),t.value=[]},f=Ci(v=>{d(v)},Qi),p=()=>{o.value},m=L(!1);return{isLoading:r,toggleSidebar:u,onGridReady:c,onSearch:f,handleUnSelect:h,firstLoad:a,cacheCleared:l,handleSelectAll:p,isSelectAll:m}}const jwe={changelog:{"1.0.1":{date:"2024-06-20",changes:["Fixed styling issues for archived and deleted rows."]},"1.0.0":{date:"2024-06-15",changes:["Initial release of the Item Table package."]},"0.0.1-alpha.8":{date:"2024-06-10",changes:["Improved performance of row updates.","Added support for custom cell renderers.","Add row hover effect for better UX.","Add loading skeleton for filter","Beta release with core functionalities implemented."]},"0.0.1-alpha.9":{date:"2024-06-05",changes:["Add row selection feature.","Fix bug with column resizing.","Optimize rendering for large datasets.","Implement getLog function to retrieve changelog entries based on version.","Display app version and changelog in the Item Table component tooltip.","Clean up unused autocomplete and memoized config composables.","Update styles for better consistency and readability."]},"0.0.1-alpha.11":{date:"2024-06-18",changes:["Add bulk process status display: items now show an hourglass icon and tooltip when being processed.","Update data model: added isProcessing and bulk_process properties to track item status.","Improve row focus: focused rows now flash for better visibility.","Set 'Last Updated' and 'Completed On' columns as read-only.","Fix: resolve visual fetching issue in useRemoteFiles composable.","Fix: use correct upload icon in PopupCreateScenes component.","Enhance data conversion to include processing status in item rows."]},"0.0.1-alpha.12":{date:"2024-06-12",changes:["feat: enhance Snackbar component and notification handling","Refactor Snackbar.vue for improved readability and styling, including color adjustments for icons and text.","Add showMessage function in notifications store to display messages based on API keys, improving notification management.","Introduce notificationMessage constant to centralize notification messages for various API actions, enhancing maintainability.","Remove unnecessary console logs from useRemoteFiles and improve logging in notification store for better debugging."]},"0.0.1-alpha.16":{date:"2024-06-20",changes:["Add onboarding tour feature and enhance UI components with new dependencies","Refactor UI components for improved styling and functionality","Updated RatingComponent.vue to streamline class bindings and improve accessibility attributes.","Enhanced SearchBox.vue by adding a clear event handler and simplifying icon rendering.","Modified AssigneeGroupEditor.vue and AssigneeGroupRenderer.vue to remove unnecessary size attributes from icons.","Adjusted DateRangeRenderer.vue to remove size attributes from icons for consistency.","Updated HeaderCheckbox.vue to set dropdown placement to 'bottom-start'.","Refined HeaderSorting.vue to simplify sort option labels and improve sorting logic.","Enhanced HeaderWrapper.vue to utilize reactive properties for sorting state.","Improved HyperLinkEditor.vue and HyperLinkInlineEditor.vue by removing size attributes from icons.","Updated PopupLayout.vue to use a CSS variable for box-shadow styling.","Refined Snackbar.vue to standardize icon colors and improve styling consistency.","Adjusted useTippy.ts to set default placement and arrow visibility for tooltips.","Modified notificationMessage.ts to remove error messages for list fetching.","Cleaned up notifications.ts by removing console logs for a cleaner codebase.","Updated sortStore.ts to comment out unnecessary console logs for better performance.","Enhanced styles.scss by defining new icon size variables and standardizing box-shadow styles."]},"0.0.99":{date:"2024-06-24",changes:["Fix: resolve issue with incorrect version display in Item Table component.","Update changelog retrieval logic to ensure accurate version matching.","Enhance tooltip display for app version and changelog in Item Table component."]}}},Kwe=e=>{var t;return(t=Object.entries(jwe.changelog).find(([n,s])=>n===e))==null?void 0:t[1].changes},qwe={key:1},Ywe=_t(dt({__name:"PopupOverwriteScenes",props:{workspaceId:{},entityId:{}},emits:["import-success"],setup(e,{expose:t,emit:n}){const s=L(null),o=e,i=()=>{s.value&&s.value.show()},r=L(""),a=L("idle"),l=L({file:null,format:null}),{apiServices:u}=Xn(!1,{}),c=L(!1),d=async()=>{c.value=!0;const T=o.workspaceId,k=o.entityId;if(!T||!k||!u.value){console.error("Workspace ID or Entity ID is missing");return}try{if(!await u.value.downloadExportedItemsFile(T,k))throw new Error("No response from downloadTemplate API")}catch(M){console.error("Error downloading template:",M)}c.value=!1},h=n,f=()=>{h("import-success"),b()},p=async T=>{var x,D,F;const k=new FormData,M=((x=T.name.split(".").pop())==null?void 0:x.toString())||"";if(k.append("file",T),k.append("format",M),k.append("entity_id",o.entityId||""),!u.value){console.error("API services not available");return}try{await u.value.overwriteScenesViaImportFile(o.workspaceId,o.entityId,k),m()}catch(P){throw console.error("Error uploading file:",P),v(((F=(D=P.response)==null?void 0:D.data)==null?void 0:F.message)||"An unknown error occurred during file upload."),P}},m=()=>{a.value="success"},v=T=>{r.value=T,a.value="error"},w=async()=>{!l.value||!l.value.file||await p(l.value.file)},b=()=>{var T;E(),(T=s.value)==null||T.hide()};t({close:b,open:i});const S=j(()=>({error:"Import failed",importing:"Import in progress",success:"Import successful",idle:"Update existing work"})[a.value]),C=j(()=>l.value.file?!1:(console.error("No file selected"),!0)),R=L(null),E=()=>{var T;(T=R.value)==null||T.clear(),r.value="",l.value={file:null,format:null},a.value="idle"};return(T,k)=>(W(),je(H(BA),{"popup-name":S.value,"show-overlay":!0,"overlay-opacity":.5,"close-on-overlay-click":!0,"close-on-escape":!0,ref_key:"popupRef",ref:s,onHidden:E},zd({default:ye(()=>[a.value==="importing"||a.value==="error"||a.value==="success"?(W(),je(GO,{key:0,state:a.value,"error-message":r.value,overwrite:!0},null,8,["state","error-message"])):(W(),ue("div",qwe,[pe("div",{class:Y(T.$style["step-section"])},[pe("span",{class:Y(T.$style["step-title"])},"Step 1: Download current data",2),pe("span",{class:Y(T.$style["step-description"])},[...k[1]||(k[1]=[st(" Download a file with all existing work and details. Edit it, then upload in Step 2. ",-1),pe("br",null,null,-1),pe("i",null,"Note: Empty cells and unchanged values will be skipped.",-1)])],2),ce(H(mt),{class:Y(T.$style["download-sample-btn"]),size:12,variant:"secondary",disabled:c.value,onHandleClick:d},{prefix:ye(()=>[ce(H(it),{src:"Download"})]),default:ye(()=>[k[2]||(k[2]=st(" Download file ",-1))]),_:1},8,["class","disabled"])],2),pe("div",{class:Y(T.$style["step-section"])},[pe("span",{class:Y(T.$style["step-title"])},"Step 2: Upload updated file (.xlsx, .xls, .csv)",2),ce(H(Rk),{modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=M=>l.value=M),ref_key:"filUploaderRef",ref:R},null,8,["modelValue"])],2),pe("div",{class:Y(T.$style["step-section"]),style:{"padding-top":"0","padding-bottom":"0"}},[ce(UO)],2)]))]),_:2},[a.value==="idle"?{name:"footer",fn:ye(()=>[ce(H(mt),{style:{flex:"1"},variant:"secondary",onClick:b},{default:ye(()=>[...k[3]||(k[3]=[st(" Cancel ",-1)])]),_:1}),ce(H(mt),{disabled:C.value,style:{flex:"1"},variant:"primary",onClick:w},{default:ye(()=>[...k[4]||(k[4]=[st(" Import ",-1)])]),_:1},8,["disabled"])]),key:"0"}:a.value==="success"?{name:"footer",fn:ye(()=>[ce(H(mt),{style:{flex:"1"},variant:"primary",onClick:f},{default:ye(()=>[...k[5]||(k[5]=[st(" Close ",-1)])]),_:1})]),key:"1"}:{name:"footer",fn:ye(()=>[ce(H(mt),{style:{flex:"1"},variant:"primary",onClick:E},{default:ye(()=>[...k[6]||(k[6]=[st(" Try Again ",-1)])]),_:1})]),key:"2"}]),1032,["popup-name"]))}}),[["__cssModules",{$style:{"step-section":"_step-section_13ctn_1","step-title":"_step-title_13ctn_11","step-title-2":"_step-title-2_13ctn_17","step-description":"_step-description_13ctn_23","date-format-guide":"_date-format-guide_13ctn_28","import-error":"_import-error_13ctn_39","drop-area":"_drop-area_13ctn_49","is-dragging":"_is-dragging_13ctn_49","drop-area-content":"_drop-area-content_13ctn_52",browse:"_browse_13ctn_61","download-sample-btn":"_download-sample-btn_13ctn_65"}}]]),Zwe={key:0},Xwe=_t(dt({__name:"OpenInTake",props:{entityId:{},workspaceId:{},loading:{type:Boolean}},setup(e){const t=qt,n=e,{triggerRef:s,popupRef:o}=Jn({placement:"bottom-end",offset:[0,0]}),i=Cn.getInstance().getItem("BASE_REVIEW_URL"),r=Cn.getInstance().getItem("BASE_URL"),a=()=>{const v=Ns({type:"review_take",config:{reviewDomain:i,ws_code:n.workspaceId,take_id:n.entityId}});window.open(v.url,"_blank")},l=()=>{const v=Ns({type:"update",config:{baseDomain:r,ws_code:n.workspaceId,entity_id:n.entityId}});window.open(v.url,"_blank")},u=()=>{const v=Ns({type:"woohoo",config:{baseDomain:r,ws_code:n.workspaceId,woohoo_id:n.entityId}});window.open(v.url,"_blank")},c=wm(),{userPermissions:d}=Js(c),h=j(()=>d.value.includes(Cm)),f=j(()=>d.value.includes(SA)),p=j(()=>d.value.includes(bA)),m=io;return(v,w)=>h.value||f.value||p.value?(W(),ue("div",Zwe,[pe("div",{ref_key:"triggerRef",ref:s},[qe((W(),je(H(mt),{variant:["secondary","icon"],width:"32px","data-tab-index":6},{default:ye(()=>[ce(H(it),{src:"ArrowUpRightFromSquare"})]),_:1})),[[H(m),{isLoading:e.loading,fullwidth:!0}],[H(t),"Open in"]])],512),pe("div",{ref_key:"popupRef",ref:o,style:{width:"200px"}},[h.value?(W(),je(H(mt),{key:0,variant:"menu-item",style:{width:"200px",borderLeft:"0"},onClick:At(a,["stop"])},{prefix:ye(()=>[pe("div",{class:Y(v.$style.icon)},[ce(H(it),{src:"PenRuler",color:"#A6A6A6"})],2)]),default:ye(()=>[w[0]||(w[0]=st(" Review ",-1))]),_:1})):Ze("",!0),f.value?(W(),je(H(mt),{key:1,variant:"menu-item",style:{width:"200px",borderLeft:"0"},onClick:At(l,["stop"])},{prefix:ye(()=>[pe("div",{class:Y(v.$style.icon)},[ce(H(it),{src:"UserCheck",color:"#A6A6A6"})],2)]),default:ye(()=>[w[1]||(w[1]=st(" Update ",-1))]),_:1})):Ze("",!0),p.value?(W(),je(H(mt),{key:2,variant:"menu-item",style:{width:"200px",borderLeft:"0"},onClick:At(u,["stop"])},{prefix:ye(()=>[pe("div",{class:Y(v.$style.icon)},[ce(H(it),{src:"ChartPie",color:"#A6A6A6"})],2)]),default:ye(()=>[w[2]||(w[2]=st(" Woohoo Details ",-1))]),_:1})):Ze("",!0)],512)])):Ze("",!0)}}),[["__cssModules",{$style:{icon:"_icon_a5uxo_1"}}]]),Jwe={style:{cursor:"help"}},Qwe=_t(dt({__name:"item-table",props:{entityId:{},workspaceId:{}},setup(e,{expose:t}){const n=io,s=wm(),{setUserPermissions:o,setEntityPermissions:i}=s,{entityPermissions:r}=Js(s),a=qt,l=L(null),u={ROWS_PER_PAGE:50,ROW_HEIGHT:38,GRID_HEIGHT:"650px"},c=L(""),d=j(()=>{var Qe;const Ve=((Qe=r.value)==null?void 0:Qe.has_create_item_permission)==1||!1;return[{label:"Create manually",value:"new_scene",icon:"Plus",type:"icon",id:"create_new_scene",hide:!Ve},{label:"Import from CSV or Excel",value:"import_scenes",icon:"FileImport",type:"icon",hide:!Ve,id:"import_scenes_option"},{label:"Update existing (CSV or Excel)",value:"overwrite_scenes",icon:"FilePen",type:"icon",hide:!Ve,id:"overwrite_scenes_option"}]}),h=e;gf.initialize({wrapVueCellRenderer:sv,wrapVueCellEditor:KO});const f=L(null),p=L([]),m=_m(),{rowCount:v}=Js(m),w=L(!1),b=L(""),S=L(),C=xA(),{metricList:R}=Js(C),E=L(""),T=L(!1),k=L(new Set),M=L(new Map),{apiServices:x}=Xn(!1,h),{columnDefs:D,checkboxColumn:F,saveColumnConfig:P}=uye(R,h.entityId,f),ee=L();nt(()=>D,()=>{var Ve;(Ve=ee.value)==null||Ve.updateColumnDefs(D.value)},{deep:!0});const Z=(Ve,Qe)=>{P(Ve,Qe)},{updateRowData:B,setMetricValues:ne}=Uwe(f),K=j(()=>({isSearching:b.value.length>0,isFiltering:Object.keys(z.value||{}).length>0})),oe=j(Jg),G=j(()=>D.value.filter(Ve=>{var Qe;return((Qe=Ve.field)==null?void 0:Qe.startsWith("metric_"))&&!Ve.hide}).map(Ve=>{var Qe;return((Qe=Ve.field)==null?void 0:Qe.replace("metric_",""))||""}));kr("timezone",oe);const Q=j(()=>({autoFetch:!1,workspaceId:h.workspaceId,entityId:h.entityId,metricIds:G.value,updateItemData:B,setMetricValues:ne})),{fetchItems:U,getMetricList:q,cusorMap:re,getMetricValues:Te}=Gwe(Q),We=j(()=>{if(!f.value)return!1;const Ve=f.value.getSelectedRows().length;return Ve>0&&Ve>=v.value.total}),he=j(()=>{var Ve;return((Ve=l.value)==null?void 0:Ve.name)||"Items"}),ae=(Ve,Qe)=>{var Nn,_n,As;v.value.total=Ve.meta.total??0,(Nn=Ve.meta.next)!=null&&Nn.cursor&&(re[Qe+1]=Ve.meta.next.cursor),E.value=Ve.meta["X-Tsr-signature"]||"",Ve.meta.total===0?(_n=f.value)==null||_n.showNoRowsOverlay():(As=f.value)==null||As.hideOverlay()},te=_k(),Re=L(null),{sortingAPIConfiguration:$e,isSortingRunning:Ge}=Js(te),z=L({preflight_status:"1"}),se=j(()=>({...z.value,search:b.value}));kr("filterParams",se);const be=L([]),fe=async({page:Ve,pageSize:Qe,filterText:Nn})=>{var Li;(Li=f.value)==null||Li.hideOverlay();const _n=re[Ve],As=!_n&&Ve>1?(Ve-1)*Qe:void 0,ca=$e.value;ca.length>0&&(Ge.value=!0);try{const al={cursor:_n,size:Qe,searchQuery:Nn,offset:As,sort_by:ca,...z.value},rp=await U(al);if(!rp)return{rows:[],total:0};const Cy=(ha=>{const ap=ha.data.map(ll=>pI(ll,oe.value));return ap.forEach(ll=>{k.value.add(String(ll.id)),M.value.set(String(ll.id),{})}),ap})(rp);return ae(rp,Ve),{rows:Cy,total:v.value.total}}catch(al){return console.error("Failed to fetch items:",al),{rows:[],total:0}}finally{Ge.value=!1}},{isLoading:Se,toggleSidebar:A,onGridReady:N,handleUnSelect:X,handleSelectAll:me,onSearch:Pe,firstLoad:ze}=zwe({selectRowData:L([]),isSidebarOpen:w,quickFilterText:b,gridApi:f,perPage:u.ROWS_PER_PAGE,fetcher:fe}),Le=L([]),de=()=>{var Ve;Le.value=((Ve=f.value)==null?void 0:Ve.getSelectedRows())||[]},xe=No({columnsDisplay:[],rowsDisplay:{fromIndex:0,toIndex:0}}),ut=j(()=>({blockLoadDebounceMillis:1e3,columnDefs:D.value,rowModelType:"infinite",cacheBlockSize:u.ROWS_PER_PAGE,infiniteInitialRowCount:20,popupParent:document.getElementById("item-table-layout-id")||void 0,rowSelection:{mode:"multiRow",checkboxes:!1,enableClickSelection:!1,enableSelectionWithoutKeys:!1},pagination:!1,rowHeight:u.ROW_HEIGHT,suppressHorizontalScroll:!1,suppressColumnVirtualisation:!1,debounceVerticalScrollbar:!1,animateRows:!1,suppressAnimationFrame:!1,suppressScrollOnNewData:!0,suppressScrollWhenPopupsAreOpen:!1,rowBuffer:20,enableCellTextSelection:!1,suppressDragLeaveHidesColumns:!0,suppressMaxRenderedRowRestriction:!1,height:u.GRID_HEIGHT,stopEditingWhenCellsLoseFocus:!0,onModelUpdated:Et,noRowsOverlayComponent:sv(wX),noRowsOverlayComponentParams:()=>K.value,defaultColDef:{editable:!1,filter:!1,sortable:!1,flex:1,minWidth:100,suppressNavigable:!1},getRowId:Ve=>Ve.data.id,getRowClass:Ve=>{if(!Ve.data)return["row-empty"];const Qe=["row-highlight"];return Ve.data.id||Qe.push("row-inactive"),Ve.data.isDeleted&&Qe.push("row-deleted"),Ve.data.isArchived&&Qe.push("row-archived"),Qe},suppressRowTransform:!1,singleClickEdit:!0,context:{workspaceId:h.workspaceId,entityId:h.entityId,apiServices:x.value,sorting:Ge.value},suppressKeyboardEvent:Ve=>{const Qe=Ve.event.key;return Ve.editing&&Qe==="Enter"?!1:Qe==="Enter"?(Ve.event.preventDefault(),Ve.event.stopPropagation(),!0):Qe==="ArrowUp"||Qe==="ArrowDown"||Qe==="ArrowLeft"||Qe==="ArrowRight"||Qe==="Tab"||Qe==="Enter"},navigateToNextCell:()=>null,onBodyScroll:Ve=>{const Qe=Ve.api.getFirstDisplayedRowIndex(),Nn=Ve.api.getLastDisplayedRowIndex();xe.rowsDisplay.fromIndex=Qe,xe.rowsDisplay.toIndex=Nn,xe.columnsDisplay=Ve.api.getAllDisplayedVirtualColumns().map(_n=>_n.getColId())},onViewportChanged:Ve=>{xe.columnsDisplay=Ve.api.getAllDisplayedVirtualColumns().map(Qe=>Qe.getColId())},suppressHeaderFocus:!0}));function Et(){if(!f.value)return;let Ve=0;f.value.forEachNode(Qe=>{Qe.data&&Ve++}),v.value.loaded=Math.min(Ve,v.value.total)}nt(()=>$e,()=>{f.value&&(E.value="",k.value.clear(),f.value.deselectAll(),Object.keys(re).forEach(Ve=>delete re[Number(Ve)]),f.value.purgeInfiniteCache(),f.value.ensureIndexVisible(0))},{deep:!0});const Mt=L(),cn=L(),Ht=()=>{var Ve;(Ve=cn.value)==null||Ve.open()},yn=()=>{var Ve;(Ve=Mt.value)==null||Ve.open()},Mn=async()=>{ze.value=!0,f.value&&(E.value="",k.value.clear(),Object.keys(re).forEach(Ve=>delete re[Number(Ve)]),await f.value.deselectAll(),await f.value.ensureIndexVisible(0,"top"),await f.value.purgeInfiniteCache(),await f.value.refreshInfiniteCache())},Me=j(()=>Cn.getInstance().getItem("ITEM_TABLE_APP_VERSION")||""),He=L(),wt=j(()=>{var Ve;return(Ve=Kwe(Me.value))==null?void 0:Ve.map(Qe=>`<div>• ${Qe}</div>`).join(`
250
- `)});function It(Ve){var Qe;Ve==="new_scene"?(Qe=He.value)==null||Qe.show():Ve==="import_scenes"?yn():Ve==="overwrite_scenes"&&Ht()}const Gt=Ve=>{p.value=Ve.api.getSelectedRows().map(Qe=>Qe.id)},Je=Ve=>{const Qe=N(Ve);return Qe&&(Qe.addEventListener("modelUpdated",Et),Qe.addEventListener("bodyScroll",()=>Qe.stopEditing()),Qe.addEventListener("selectionChanged",de),Qe.addEventListener("columnMoved",_n=>Z(_n,!0)),Qe.addEventListener("columnResized",_n=>Z(_n,!0)),Qe.addEventListener("firstDataRendered",()=>{ze.value=!1}),!document.querySelector(".ag-body-viewport")),Qe},hs=()=>{var Ve;c.value=(((Ve=document.getElementById("item-table-layout-id"))==null?void 0:Ve.clientHeight)??0)-78+"px"};Qt(()=>{xt(()=>{hs()}),window.addEventListener("resize",hs);function Ve(){requestAnimationFrame(Ve)}Ve()}),Yn(()=>{window.removeEventListener("resize",hs)});const Mi=async({code:Ve,name:Qe})=>{await Pe(Ve),setTimeout(()=>{var Nn;(Nn=S.value)==null||Nn.setValue(Qe)},300)},il=Ve=>{if(!f.value)return;const Qe=f.value.getRowNode(Ve);Qe?(f.value.ensureIndexVisible(Number(Qe.rowIndex),"middle"),f.value.flashCells({rowNodes:[Qe],flashDuration:3e3,fadeDuration:1e3})):f.value.ensureIndexVisible(v.value.total-1,"bottom")},ai=Ve=>Ve.metric_type.code==="number"?"number":"default",ua=async()=>{if(h.entityId)try{const Ve=await q(h.entityId);R.value=Ve.data.map(Qe=>({...Qe,sortType:ai(Qe)}))}catch(Ve){console.error("Failed to initialize metric list:",Ve),R.value=[]}},rl=async()=>{if(x.value)try{const Ve=await x.value.getUserPermission(h.workspaceId);o(Ve)}catch(Ve){console.error("Failed to fetch user permissions:",Ve)}},Er=async()=>{if(x.value)try{const Ve=await x.value.getEntityDetail(h.workspaceId,h.entityId);i(Ve.permission),l.value=Ve}catch(Ve){console.error("Failed to fetch entity details:",Ve)}},Ni=Km(),{setUser:li}=Ni,_r=async()=>{if(x.value)try{const Ve=await x.value.getMe();return li(Ve),Ve}catch(Ve){console.error("Failed to fetch user details:",Ve)}},Sd=async()=>{var Ve;if(x.value)try{const Qe=await x.value.getWorkspaces(h.workspaceId),Nn=(Ve=Qe.data[0])==null?void 0:Ve.ws_user_role_id;return Nn&&Ni.setUserRoleId(Nn),Qe}catch(Qe){console.error("Failed to fetch workspace details:",Qe)}};nt(()=>[h.entityId,h.workspaceId],async([Ve,Qe])=>{!Ve||!Qe||(_r(),Sd(),ua(),rl(),Er())},{immediate:!0,deep:!0}),nt(G,(Ve,Qe)=>{const Nn=Ve.filter(_n=>!(Qe!=null&&Qe.includes(_n)));Nn.length>0&&Te(Array.from(k.value),Nn).then(_n=>{ne(_n,k.value,Nn)})},{immediate:!0,deep:!0}),nt(E,(Ve,Qe)=>{T.value=!!(Qe&&Ve&&Qe!==Ve)}),t({refreshTable:Mn});const Fn=Ve=>{z.value=Ve,Mn()},fs=Ve=>{be.value=Ve,Mn()},p_=Ve=>{D.value=Ve||[],Z({},!0)};return(Ve,Qe)=>{const Nn=WR("custom-icon");return W(),je(H(UY),{"is-sidebar-open":w.value,onCloseSidebar:H(A),onSidebarClear:H(A),ref:"itemTableLayoutRef",id:"item-table-layout-id",onSidebarApply:H(A)},{"header-left":ye(()=>{var _n;return[ce(Nn,{src:"Check"}),pe("h1",{class:Y(Ve.$style.tableTitle)},"Scenes",2),pe("div",{class:Y(Ve.$style["beta-tag"])},"Beta",2),((_n=H(r))==null?void 0:_n.has_create_item_permission)==1?(W(),je(H(Kb),{key:0,variant:["primary"],options:d.value,onSelect:It,onHandleClick:Qe[1]||(Qe[1]=As=>It("new_scene")),id:"create_scene_dropdown"},{prefix:ye(()=>[ce(H(mt),{"data-tab-index":1,"data-focus-index":"1",id:"create_new_scene",variant:["primary"],onClick:Qe[0]||(Qe[0]=As=>It("new_scene")),label:"New"})]),triggerDropdown:ye(({open:As})=>[ce(H(mt),{"data-tab-index":2,ref:"mainButton",actived:As,class:Y(Ve.$style["button-dropdown-trigger"]),variant:["primary"],disabled:!1},{default:ye(()=>[ce(H(it),{class:Y(Ve.$style["icon-dropdown"]),src:"ChevronDown",source:"remote"},null,8,["class"])]),_:1},8,["actived","class"])]),_:1},8,["options"])):Ze("",!0),qe((W(),ue("span",Jwe,[st(Ct(Me.value),1)])),[[H(a),wt.value||""]])]}),"header-actions":ye(()=>[ce(H(tJ),{"onUpdate:assignees":fs,onApplyFilter:Fn,loading:H(ze),entityId:h.entityId},null,8,["loading","entityId"]),qe(ce(H(jb),{"data-tab-index":4,modelValue:b.value,"onUpdate:modelValue":Qe[2]||(Qe[2]=_n=>b.value=_n),onSearch:H(Pe),class:Y(Ve.$style.itemSearchBox),onClear:Qe[3]||(Qe[3]=_n=>H(Pe)("")),id:"item_search_box",ref_key:"searchBoxRef",ref:S},null,8,["modelValue","onSearch","class"]),[[H(n),{isLoading:H(ze),fullwidth:!0}]]),qe((W(),je(H(EA),{status:H(Se)?"busy":"active",size:10,id:"refresh_table","status-tooltip":"Data has changed, please refresh the table",color:"var(--warning-color)","show-badge":T.value},{default:ye(()=>[qe((W(),je(H(mt),{"data-tab-index":5,variant:["secondary","icon"],disabled:H(Se),onClick:Mn},{default:ye(()=>[ce(H(it),{src:"ArrowsRotate"})]),_:1},8,["disabled"])),[[H(a),"Refresh"]])]),_:1},8,["status","show-badge"])),[[H(n),{isLoading:H(ze),fullwidth:!0}]]),ce(Xwe,{loading:H(ze),entityId:h.entityId,workspaceId:h.workspaceId},null,8,["loading","entityId","workspaceId"]),qe(ce(H(pX),{"model-value":H(D),onChange:Qe[4]||(Qe[4]=_n=>p_(_n)),id:"table_customization",gridApi:f.value,ref_key:"tableCustomizationRef",ref:ee,"checkbox-column":H(F),tableHeight:c.value},null,8,["model-value","gridApi","checkbox-column","tableHeight"]),[[H(n),{isLoading:H(ze),fullwidth:!0}]])]),grid:ye(({availableHeight:_n})=>[ce(H(oye),Kt({id:"item_table_main",ref_key:"agGrid",ref:Re},ut.value,{height:_n+"px",isSorting:H(Ge),onOnGridReady:Je,onSelectionChanged:Gt}),null,16,["height","isSorting"])]),footer:ye(()=>[pe("div",{class:Y(Ve.$style.tableFooter),id:"table_footer"},[pe("span",null,[Qe[5]||(Qe[5]=st(" Showing ",-1)),pe("b",null,Ct(H(v).loaded)+" of "+Ct(H(v).total),1)])],2)]),"new-row":ye(()=>[ce(H(AX),{ref_key:"createNewSceneRef",ref:He,onSearchForCode:Mi,onFocusOnId:il},null,512)]),"bulk-update-actions":ye(()=>[qe(ce(H(MY),{selectRowData:Le.value,"workspace-id":h.workspaceId,"entity-id":h.entityId,"grid-api":f.value,onUnselect:H(X),onSelectAll:H(me),"take-name":he.value,"selected-all":We.value,"total-rows":H(v).total,"visible-rows":H(v).loaded,onUpdated:de,loading:H(Se)},null,8,["selectRowData","workspace-id","entity-id","grid-api","onUnselect","onSelectAll","take-name","selected-all","total-rows","visible-rows","loading"]),[[ji,!w.value&&p.value.length>0]])]),snackbar:ye(()=>[ce(H(_Z))]),popup:ye(()=>[ce(Vee,{ref_key:"popupCreateSceneRef",ref:Mt,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:Mn},null,8,["workspace-id","entity-id"]),ce(Ywe,{ref_key:"popupOverwriteScenesRef",ref:cn,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:Mn},null,8,["workspace-id","entity-id"])]),_:1},8,["is-sidebar-open","onCloseSidebar","onSidebarClear","onSidebarApply"])}}}),[["__cssModules",{$style:{tableTitle:"_tableTitle_1lefh_1",tableFooter:"_tableFooter_1lefh_7",footerStart:"_footerStart_1lefh_17",newRow:"_newRow_1lefh_25","warning-text":"_warning-text_1lefh_44","has-error":"_has-error_1lefh_49",itemSearchBox:"_itemSearchBox_1lefh_53","beta-tag":"_beta-tag_1lefh_57"}}]]),oB="0.1.4",eCe={key:0},tCe=_t(dt({__name:"app",setup(e){const t=j(()=>n.id.length===0||n.workspaceId.length===0),n=No({id:"",workspaceId:"",apiConfig:{}}),s=Yh(),{showMessage:o,showErrorNetMessage:i}=s,r=["basicInfor"],a=h=>{h.success?o(h.apiCode,"success"):r.includes(h.apiCode)||i(h)},l=L(null),u=()=>{const h=Cn.getInstance().getItem("API_BASE_URL");return h!=null&&h.includes("v1")?h.slice(0,h.lastIndexOf("/v1")):String(h)};zp(()=>{var h,f,p;sessionStorage.setItem("ITEM_TABLE_APP_VERSION",oB);try{if(l.value=Rs(),!l.value)throw new Error("Current instance is null");n.id=((h=l.value)==null?void 0:h.appContext.config.globalProperties.id)||"",n.workspaceId=((f=l.value)==null?void 0:f.appContext.config.globalProperties.workspaceId)||Cn.getInstance().getItem("ws.code");const m={domainApi:u(),wsCode:Cn.getInstance().getItem("ws.code"),entityId:n.id};if(n.apiConfig=(p=l.value)==null?void 0:p.appContext.config.globalProperties.apiConfig,!m.entityId||!m.wsCode||!m.domainApi)throw new Error("API configuration is missing in dashboardConfig");const v=new sB(n.apiConfig,m);v.on("call-api",a),l.value.appContext.config.globalProperties.apiServices=v}catch(m){console.error("Error getting current instance:",m)}}),Yn(()=>{l.value.appContext.config.globalProperties.apiServices.off("call-api",a)});const c=j(()=>n.id),d=j(()=>n.workspaceId);return kr("workspaceId",d),kr("entityId",c),(h,f)=>(W(),ue("div",{class:Y(h.$style.dashboardPluginWrapper)},[t.value?(W(),ue("span",eCe," There is no workspaceId or entityIds provided in global properties. Please set them to see the Item Table. ")):c.value?(W(),je(H(Qwe),{key:1,entityId:c.value,workspaceId:d.value},null,8,["entityId","workspaceId"])):Ze("",!0)],2))}}),[["__cssModules",{$style:{dashboardPluginWrapper:"_dashboardPluginWrapper_1f1og_1"}}]]),f_=async(e={},t={})=>{const n=pT(tCe),s=xq();n.use(s);const o=["apiConfig","workspaceId","id"],i={};Object.entries(e).forEach(([a,l])=>{l!==void 0&&(n.config.globalProperties[a]=l,i[a]=l,o.includes(a)&&typeof l=="string"?sessionStorage.setItem(a,l):console.error(`[Config Error] Key "${a}" has an invalid value and will not be persisted.`))}),n.config.globalProperties.$arboConfig=i,Object.values(t).forEach(a=>{a&&typeof a.install=="function"&&n.use(a)}),n.config.errorHandler=(a,l,u)=>{console.error("[Vue Error]",a),u&&console.error("[Info]",u)},console.log(`%cArbo Dashboard Plugin v${oB}`,"color: #4CAF50; font-weight: bold;"),console.log(n.config.globalProperties),globalThis.window.$switchInstance=n.config.globalProperties.switchInstance,n.provide("switchInstance",n.config.globalProperties.switchInstance),n.directive("tooltip",qt);const r=await Mee();return n.use(r),n};globalThis.window!==void 0&&(globalThis.window.arboDashboard=f_),In.default=f_,In.initDashboard=f_,Object.defineProperties(In,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
250
+ `)});function It(Ve){var Qe;Ve==="new_scene"?(Qe=He.value)==null||Qe.show():Ve==="import_scenes"?yn():Ve==="overwrite_scenes"&&Ht()}const Gt=Ve=>{p.value=Ve.api.getSelectedRows().map(Qe=>Qe.id)},Je=Ve=>{const Qe=N(Ve);return Qe&&(Qe.addEventListener("modelUpdated",Et),Qe.addEventListener("bodyScroll",()=>Qe.stopEditing()),Qe.addEventListener("selectionChanged",de),Qe.addEventListener("columnMoved",_n=>Z(_n,!0)),Qe.addEventListener("columnResized",_n=>Z(_n,!0)),Qe.addEventListener("firstDataRendered",()=>{ze.value=!1}),!document.querySelector(".ag-body-viewport")),Qe},hs=()=>{var Ve;c.value=(((Ve=document.getElementById("item-table-layout-id"))==null?void 0:Ve.clientHeight)??0)-78+"px"};Qt(()=>{xt(()=>{hs()}),window.addEventListener("resize",hs);function Ve(){requestAnimationFrame(Ve)}Ve()}),Yn(()=>{window.removeEventListener("resize",hs)});const Mi=async({code:Ve,name:Qe})=>{await Pe(Ve),setTimeout(()=>{var Nn;(Nn=S.value)==null||Nn.setValue(Qe)},300)},il=Ve=>{if(!f.value)return;const Qe=f.value.getRowNode(Ve);Qe?(f.value.ensureIndexVisible(Number(Qe.rowIndex),"middle"),f.value.flashCells({rowNodes:[Qe],flashDuration:3e3,fadeDuration:1e3})):f.value.ensureIndexVisible(v.value.total-1,"bottom")},ai=Ve=>Ve.metric_type.code==="number"?"number":"default",ua=async()=>{if(h.entityId)try{const Ve=await q(h.entityId);R.value=Ve.data.map(Qe=>({...Qe,sortType:ai(Qe)}))}catch(Ve){console.error("Failed to initialize metric list:",Ve),R.value=[]}},rl=async()=>{if(x.value)try{const Ve=await x.value.getUserPermission(h.workspaceId);o(Ve)}catch(Ve){console.error("Failed to fetch user permissions:",Ve)}},Er=async()=>{if(x.value)try{const Ve=await x.value.getEntityDetail(h.workspaceId,h.entityId);i(Ve.permission),l.value=Ve}catch(Ve){console.error("Failed to fetch entity details:",Ve)}},Ni=Km(),{setUser:li}=Ni,_r=async()=>{if(x.value)try{const Ve=await x.value.getMe();return li(Ve),Ve}catch(Ve){console.error("Failed to fetch user details:",Ve)}},Sd=async()=>{var Ve;if(x.value)try{const Qe=await x.value.getWorkspaces(h.workspaceId),Nn=(Ve=Qe.data[0])==null?void 0:Ve.ws_user_role_id;return Nn&&Ni.setUserRoleId(Nn),Qe}catch(Qe){console.error("Failed to fetch workspace details:",Qe)}};nt(()=>[h.entityId,h.workspaceId],async([Ve,Qe])=>{!Ve||!Qe||(_r(),Sd(),ua(),rl(),Er())},{immediate:!0,deep:!0}),nt(G,(Ve,Qe)=>{const Nn=Ve.filter(_n=>!(Qe!=null&&Qe.includes(_n)));Nn.length>0&&Te(Array.from(k.value),Nn).then(_n=>{ne(_n,k.value,Nn)})},{immediate:!0,deep:!0}),nt(E,(Ve,Qe)=>{T.value=!!(Qe&&Ve&&Qe!==Ve)}),t({refreshTable:Mn});const Fn=Ve=>{z.value=Ve,Mn()},fs=Ve=>{be.value=Ve,Mn()},p_=Ve=>{D.value=Ve||[],Z({},!0)};return(Ve,Qe)=>{const Nn=WR("custom-icon");return W(),je(H(UY),{"is-sidebar-open":w.value,onCloseSidebar:H(A),onSidebarClear:H(A),ref:"itemTableLayoutRef",id:"item-table-layout-id",onSidebarApply:H(A)},{"header-left":ye(()=>{var _n;return[ce(Nn,{src:"Check"}),pe("h1",{class:Y(Ve.$style.tableTitle)},"Scenes",2),pe("div",{class:Y(Ve.$style["beta-tag"])},"Beta",2),((_n=H(r))==null?void 0:_n.has_create_item_permission)==1?(W(),je(H(Kb),{key:0,variant:["primary"],options:d.value,onSelect:It,onHandleClick:Qe[1]||(Qe[1]=As=>It("new_scene")),id:"create_scene_dropdown"},{prefix:ye(()=>[ce(H(mt),{"data-tab-index":1,"data-focus-index":"1",id:"create_new_scene",variant:["primary"],onClick:Qe[0]||(Qe[0]=As=>It("new_scene")),label:"New"})]),triggerDropdown:ye(({open:As})=>[ce(H(mt),{"data-tab-index":2,ref:"mainButton",actived:As,class:Y(Ve.$style["button-dropdown-trigger"]),variant:["primary"],disabled:!1},{default:ye(()=>[ce(H(it),{class:Y(Ve.$style["icon-dropdown"]),src:"ChevronDown",source:"remote"},null,8,["class"])]),_:1},8,["actived","class"])]),_:1},8,["options"])):Ze("",!0),qe((W(),ue("span",Jwe,[st(Ct(Me.value),1)])),[[H(a),wt.value||""]])]}),"header-actions":ye(()=>[ce(H(tJ),{"onUpdate:assignees":fs,onApplyFilter:Fn,loading:H(ze),entityId:h.entityId},null,8,["loading","entityId"]),qe(ce(H(jb),{"data-tab-index":4,modelValue:b.value,"onUpdate:modelValue":Qe[2]||(Qe[2]=_n=>b.value=_n),onSearch:H(Pe),class:Y(Ve.$style.itemSearchBox),onClear:Qe[3]||(Qe[3]=_n=>H(Pe)("")),id:"item_search_box",ref_key:"searchBoxRef",ref:S},null,8,["modelValue","onSearch","class"]),[[H(n),{isLoading:H(ze),fullwidth:!0}]]),qe((W(),je(H(EA),{status:H(Se)?"busy":"active",size:10,id:"refresh_table","status-tooltip":"Data has changed, please refresh the table",color:"var(--warning-color)","show-badge":T.value},{default:ye(()=>[qe((W(),je(H(mt),{"data-tab-index":5,variant:["secondary","icon"],disabled:H(Se),onClick:Mn},{default:ye(()=>[ce(H(it),{src:"ArrowsRotate"})]),_:1},8,["disabled"])),[[H(a),"Refresh"]])]),_:1},8,["status","show-badge"])),[[H(n),{isLoading:H(ze),fullwidth:!0}]]),ce(Xwe,{loading:H(ze),entityId:h.entityId,workspaceId:h.workspaceId},null,8,["loading","entityId","workspaceId"]),qe(ce(H(pX),{"model-value":H(D),onChange:Qe[4]||(Qe[4]=_n=>p_(_n)),id:"table_customization",gridApi:f.value,ref_key:"tableCustomizationRef",ref:ee,"checkbox-column":H(F),tableHeight:c.value},null,8,["model-value","gridApi","checkbox-column","tableHeight"]),[[H(n),{isLoading:H(ze),fullwidth:!0}]])]),grid:ye(({availableHeight:_n})=>[ce(H(oye),Kt({id:"item_table_main",ref_key:"agGrid",ref:Re},ut.value,{height:_n+"px",isSorting:H(Ge),onOnGridReady:Je,onSelectionChanged:Gt}),null,16,["height","isSorting"])]),footer:ye(()=>[pe("div",{class:Y(Ve.$style.tableFooter),id:"table_footer"},[pe("span",null,[Qe[5]||(Qe[5]=st(" Showing ",-1)),pe("b",null,Ct(H(v).loaded)+" of "+Ct(H(v).total),1)])],2)]),"new-row":ye(()=>[ce(H(AX),{ref_key:"createNewSceneRef",ref:He,onSearchForCode:Mi,onFocusOnId:il},null,512)]),"bulk-update-actions":ye(()=>[qe(ce(H(MY),{selectRowData:Le.value,"workspace-id":h.workspaceId,"entity-id":h.entityId,"grid-api":f.value,onUnselect:H(X),onSelectAll:H(me),"take-name":he.value,"selected-all":We.value,"total-rows":H(v).total,"visible-rows":H(v).loaded,onUpdated:de,loading:H(Se)},null,8,["selectRowData","workspace-id","entity-id","grid-api","onUnselect","onSelectAll","take-name","selected-all","total-rows","visible-rows","loading"]),[[ji,!w.value&&p.value.length>0]])]),snackbar:ye(()=>[ce(H(_Z))]),popup:ye(()=>[ce(Vee,{ref_key:"popupCreateSceneRef",ref:Mt,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:Mn},null,8,["workspace-id","entity-id"]),ce(Ywe,{ref_key:"popupOverwriteScenesRef",ref:cn,"workspace-id":h.workspaceId,"entity-id":h.entityId,onImportSuccess:Mn},null,8,["workspace-id","entity-id"])]),_:1},8,["is-sidebar-open","onCloseSidebar","onSidebarClear","onSidebarApply"])}}}),[["__cssModules",{$style:{tableTitle:"_tableTitle_1lefh_1",tableFooter:"_tableFooter_1lefh_7",footerStart:"_footerStart_1lefh_17",newRow:"_newRow_1lefh_25","warning-text":"_warning-text_1lefh_44","has-error":"_has-error_1lefh_49",itemSearchBox:"_itemSearchBox_1lefh_53","beta-tag":"_beta-tag_1lefh_57"}}]]),oB="0.1.5",eCe={key:0},tCe=_t(dt({__name:"app",setup(e){const t=j(()=>n.id.length===0||n.workspaceId.length===0),n=No({id:"",workspaceId:"",apiConfig:{}}),s=Yh(),{showMessage:o,showErrorNetMessage:i}=s,r=["basicInfor"],a=h=>{h.success?o(h.apiCode,"success"):r.includes(h.apiCode)||i(h)},l=L(null),u=()=>{const h=Cn.getInstance().getItem("API_BASE_URL");return h!=null&&h.includes("v1")?h.slice(0,h.lastIndexOf("/v1")):String(h)};zp(()=>{var h,f,p;sessionStorage.setItem("ITEM_TABLE_APP_VERSION",oB);try{if(l.value=Rs(),!l.value)throw new Error("Current instance is null");n.id=((h=l.value)==null?void 0:h.appContext.config.globalProperties.id)||"",n.workspaceId=((f=l.value)==null?void 0:f.appContext.config.globalProperties.workspaceId)||Cn.getInstance().getItem("ws.code");const m={domainApi:u(),wsCode:Cn.getInstance().getItem("ws.code"),entityId:n.id};if(n.apiConfig=(p=l.value)==null?void 0:p.appContext.config.globalProperties.apiConfig,!m.entityId||!m.wsCode||!m.domainApi)throw new Error("API configuration is missing in dashboardConfig");const v=new sB(n.apiConfig,m);v.on("call-api",a),l.value.appContext.config.globalProperties.apiServices=v}catch(m){console.error("Error getting current instance:",m)}}),Yn(()=>{l.value.appContext.config.globalProperties.apiServices.off("call-api",a)});const c=j(()=>n.id),d=j(()=>n.workspaceId);return kr("workspaceId",d),kr("entityId",c),(h,f)=>(W(),ue("div",{class:Y(h.$style.dashboardPluginWrapper)},[t.value?(W(),ue("span",eCe," There is no workspaceId or entityIds provided in global properties. Please set them to see the Item Table. ")):c.value?(W(),je(H(Qwe),{key:1,entityId:c.value,workspaceId:d.value},null,8,["entityId","workspaceId"])):Ze("",!0)],2))}}),[["__cssModules",{$style:{dashboardPluginWrapper:"_dashboardPluginWrapper_1f1og_1"}}]]),f_=async(e={},t={})=>{const n=pT(tCe),s=xq();n.use(s);const o=["apiConfig","workspaceId","id"],i={};Object.entries(e).forEach(([a,l])=>{l!==void 0&&(n.config.globalProperties[a]=l,i[a]=l,o.includes(a)&&typeof l=="string"?sessionStorage.setItem(a,l):console.error(`[Config Error] Key "${a}" has an invalid value and will not be persisted.`))}),n.config.globalProperties.$arboConfig=i,Object.values(t).forEach(a=>{a&&typeof a.install=="function"&&n.use(a)}),n.config.errorHandler=(a,l,u)=>{console.error("[Vue Error]",a),u&&console.error("[Info]",u)},console.log(`%cArbo Dashboard Plugin v${oB}`,"color: #4CAF50; font-weight: bold;"),console.log(n.config.globalProperties),globalThis.window.$switchInstance=n.config.globalProperties.switchInstance,n.provide("switchInstance",n.config.globalProperties.switchInstance),n.directive("tooltip",qt);const r=await Mee();return n.use(r),n};globalThis.window!==void 0&&(globalThis.window.arboDashboard=f_),In.default=f_,In.initDashboard=f_,Object.defineProperties(In,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});