@openmrs/esm-extensions 4.5.1-pre.804 → 5.0.0

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.
@@ -1,2 +1,3 @@
1
- System.register(["@openmrs/esm-config","@openmrs/esm-state","@openmrs/esm-api","single-spa"],(function(t,e){var r={},n={},o={},i={};return{setters:[function(t){r.configExtensionStore=t.configExtensionStore,r.getExtensionConfigFromStore=t.getExtensionConfigFromStore,r.getExtensionSlotConfig=t.getExtensionSlotConfig,r.getExtensionSlotConfigFromStore=t.getExtensionSlotConfigFromStore,r.getExtensionSlotsConfigStore=t.getExtensionSlotsConfigStore,r.getExtensionsConfigStore=t.getExtensionsConfigStore},function(t){n.createGlobalStore=t.createGlobalStore,n.getGlobalStore=t.getGlobalStore},function(t){o.getSessionStore=t.getSessionStore,o.userHasAccess=t.userHasAccess},function(t){i.mountRootParcel=t.mountRootParcel}],execute:function(){t((()=>{var t={968:(t,e,r)=>{const n=r(577).R;e.s=function(t){if(t||(t=1),!r.y.meta||!r.y.meta.url)throw console.error("__system_context__",r.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");r.p=n(r.y.meta.url,t)}},577:(t,e,r)=>{e.R=function(t,e){var r=document.createElement("a");r.href=t;for(var n="/"===r.pathname[0]?r.pathname:"/"+r.pathname,o=0,i=n.length;o!==e&&i>=0;)"/"===n[--i]&&o++;if(o!==e)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+e+") is greater than the number of directories ("+o+") in the URL path "+t);var a=n.slice(0,i+1);return r.protocol+"//"+r.host+a};Number.isInteger},766:t=>{"use strict";t.exports=o},824:t=>{"use strict";t.exports=r},685:t=>{"use strict";t.exports=n},645:t=>{"use strict";t.exports=i}},a={};function s(e){var r=a[e];if(void 0!==r)return r.exports;var n=a[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.y=e,s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");r.length&&(t=r[r.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})();var c={};return(0,s(968).s)(1),(()=>{"use strict";s.r(c),s.d(c,{attach:()=>Pe,checkStatus:()=>De,checkStatusFor:()=>Re,detach:()=>Ie,detachAll:()=>Ne,extensionStore:()=>Ye,getAssignedExtensions:()=>Fe,getConnectedExtensions:()=>ze,getCustomProps:()=>$e,getExtensionInternalStore:()=>ae,getExtensionNameFromId:()=>xe,getExtensionRegistration:()=>Ee,getExtensionRegistrationFrom:()=>we,getExtensionStore:()=>ce,registerExtension:()=>Ae,registerExtensionSlot:()=>Te,renderExtension:()=>Qe,reset:()=>Me,updateInternalExtensionStore:()=>se});const t=function(t,e){return t===e||t!=t&&e!=e},e=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1};var r=Array.prototype.splice;function n(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}n.prototype.clear=function(){this.__data__=[],this.size=0},n.prototype.delete=function(t){var n=this.__data__,o=e(n,t);return!(o<0||(o==n.length-1?n.pop():r.call(n,o,1),--this.size,0))},n.prototype.get=function(t){var r=this.__data__,n=e(r,t);return n<0?void 0:r[n][1]},n.prototype.has=function(t){return e(this.__data__,t)>-1},n.prototype.set=function(t,r){var n=this.__data__,o=e(n,t);return o<0?(++this.size,n.push([t,r])):n[o][1]=r,this};const o=n,i="object"==typeof global&&global&&global.Object===Object&&global;var a="object"==typeof self&&self&&self.Object===Object&&self;const u=i||a||Function("return this")(),l=u.Symbol;var f=Object.prototype,p=f.hasOwnProperty,y=f.toString,b=l?l.toStringTag:void 0;var d=Object.prototype.toString;var v=l?l.toStringTag:void 0;const h=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":v&&v in Object(t)?function(t){var e=p.call(t,b),r=t[b];try{t[b]=void 0;var n=!0}catch(t){}var o=y.call(t);return n&&(e?t[b]=r:delete t[b]),o}(t):function(t){return d.call(t)}(t)},g=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},m=function(t){if(!g(t))return!1;var e=h(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},_=u["__core-js_shared__"];var j,S=(j=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||""))?"Symbol(src)_1."+j:"";var O=Function.prototype.toString;const x=function(t){if(null!=t){try{return O.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var w=/^\[object .+?Constructor\]$/,E=Function.prototype,A=Object.prototype,P=E.toString,I=A.hasOwnProperty,N=RegExp("^"+P.call(I).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const k=function(t){return!(!g(t)||(e=t,S&&S in e))&&(m(t)?N:w).test(x(t));var e},z=function(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return k(r)?r:void 0},C=z(u,"Map"),F=z(Object,"create");var T=Object.prototype.hasOwnProperty;var M=Object.prototype.hasOwnProperty;function D(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}D.prototype.clear=function(){this.__data__=F?F(null):{},this.size=0},D.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},D.prototype.get=function(t){var e=this.__data__;if(F){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return T.call(e,t)?e[t]:void 0},D.prototype.has=function(t){var e=this.__data__;return F?void 0!==e[t]:M.call(e,t)},D.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&void 0===e?"__lodash_hash_undefined__":e,this};const R=D,$=function(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map};function L(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}L.prototype.clear=function(){this.size=0,this.__data__={hash:new R,map:new(C||o),string:new R}},L.prototype.delete=function(t){var e=$(this,t).delete(t);return this.size-=e?1:0,e},L.prototype.get=function(t){return $(this,t).get(t)},L.prototype.has=function(t){return $(this,t).has(t)},L.prototype.set=function(t,e){var r=$(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};const B=L;function G(t){var e=this.__data__=new o(t);this.size=e.size}G.prototype.clear=function(){this.__data__=new o,this.size=0},G.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},G.prototype.get=function(t){return this.__data__.get(t)},G.prototype.has=function(t){return this.__data__.has(t)},G.prototype.set=function(t,e){var r=this.__data__;if(r instanceof o){var n=r.__data__;if(!C||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new B(n)}return r.set(t,e),this.size=r.size,this};const U=G;function V(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new B;++e<r;)this.add(t[e])}V.prototype.add=V.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},V.prototype.has=function(t){return this.__data__.has(t)};const H=V,W=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},q=function(t,e,r,n,o,i){var a=1&r,s=t.length,c=e.length;if(s!=c&&!(a&&c>s))return!1;var u=i.get(t),l=i.get(e);if(u&&l)return u==e&&l==t;var f=-1,p=!0,y=2&r?new H:void 0;for(i.set(t,e),i.set(e,t);++f<s;){var b=t[f],d=e[f];if(n)var v=a?n(d,b,f,e,t,i):n(b,d,f,t,e,i);if(void 0!==v){if(v)continue;p=!1;break}if(y){if(!W(e,(function(t,e){if(a=e,!y.has(a)&&(b===t||o(b,t,r,n,i)))return y.push(e);var a}))){p=!1;break}}else if(b!==d&&!o(b,d,r,n,i)){p=!1;break}}return i.delete(t),i.delete(e),p},J=u.Uint8Array,K=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r},Q=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r};var X=l?l.prototype:void 0,Y=X?X.valueOf:void 0;const Z=Array.isArray;var tt=Object.prototype.propertyIsEnumerable,et=Object.getOwnPropertySymbols;const rt=et?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}(et(t),(function(e){return tt.call(t,e)})))}:function(){return[]},nt=function(t){return null!=t&&"object"==typeof t},ot=function(t){return nt(t)&&"[object Arguments]"==h(t)};var it=Object.prototype,at=it.hasOwnProperty,st=it.propertyIsEnumerable,ct=ot(function(){return arguments}())?ot:function(t){return nt(t)&&at.call(t,"callee")&&!st.call(t,"callee")};const ut=ct;var lt="object"==typeof exports&&exports&&!exports.nodeType&&exports,ft=lt&&"object"==typeof module&&module&&!module.nodeType&&module,pt=ft&&ft.exports===lt?u.Buffer:void 0;const yt=(pt?pt.isBuffer:void 0)||function(){return!1};var bt=/^(?:0|[1-9]\d*)$/;const dt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&bt.test(t))&&t>-1&&t%1==0&&t<e},vt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var ht={};ht["[object Float32Array]"]=ht["[object Float64Array]"]=ht["[object Int8Array]"]=ht["[object Int16Array]"]=ht["[object Int32Array]"]=ht["[object Uint8Array]"]=ht["[object Uint8ClampedArray]"]=ht["[object Uint16Array]"]=ht["[object Uint32Array]"]=!0,ht["[object Arguments]"]=ht["[object Array]"]=ht["[object ArrayBuffer]"]=ht["[object Boolean]"]=ht["[object DataView]"]=ht["[object Date]"]=ht["[object Error]"]=ht["[object Function]"]=ht["[object Map]"]=ht["[object Number]"]=ht["[object Object]"]=ht["[object RegExp]"]=ht["[object Set]"]=ht["[object String]"]=ht["[object WeakMap]"]=!1;var gt="object"==typeof exports&&exports&&!exports.nodeType&&exports,mt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,_t=mt&&mt.exports===gt&&i.process,jt=function(){try{return mt&&mt.require&&mt.require("util").types||_t&&_t.binding&&_t.binding("util")}catch(t){}}(),St=jt&&jt.isTypedArray;const Ot=St?(xt=St,function(t){return xt(t)}):function(t){return nt(t)&&vt(t.length)&&!!ht[h(t)]};var xt,wt=Object.prototype.hasOwnProperty;const Et=function(t,e){var r=Z(t),n=!r&&ut(t),o=!r&&!n&&yt(t),i=!r&&!n&&!o&&Ot(t),a=r||n||o||i,s=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=s.length;for(var u in t)!e&&!wt.call(t,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||dt(u,c))||s.push(u);return s};var At=Object.prototype;const Pt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object);var It=Object.prototype.hasOwnProperty;const Nt=function(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||At))return Pt(t);var e,r,n=[];for(var o in Object(t))It.call(t,o)&&"constructor"!=o&&n.push(o);return n},kt=function(t){return null!=(e=t)&&vt(e.length)&&!m(e)?Et(t):Nt(t);var e},zt=function(t){return function(t,e,r){var n=e(t);return Z(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,kt,rt)};var Ct=Object.prototype.hasOwnProperty;const Ft=z(u,"DataView"),Tt=z(u,"Promise"),Mt=z(u,"Set"),Dt=z(u,"WeakMap");var Rt="[object Map]",$t="[object Promise]",Lt="[object Set]",Bt="[object WeakMap]",Gt="[object DataView]",Ut=x(Ft),Vt=x(C),Ht=x(Tt),Wt=x(Mt),qt=x(Dt),Jt=h;(Ft&&Jt(new Ft(new ArrayBuffer(1)))!=Gt||C&&Jt(new C)!=Rt||Tt&&Jt(Tt.resolve())!=$t||Mt&&Jt(new Mt)!=Lt||Dt&&Jt(new Dt)!=Bt)&&(Jt=function(t){var e=h(t),r="[object Object]"==e?t.constructor:void 0,n=r?x(r):"";if(n)switch(n){case Ut:return Gt;case Vt:return Rt;case Ht:return $t;case Wt:return Lt;case qt:return Bt}return e});const Kt=Jt;var Qt="[object Arguments]",Xt="[object Array]",Yt="[object Object]",Zt=Object.prototype.hasOwnProperty;const te=function(e,r,n,o,i,a){var s=Z(e),c=Z(r),u=s?Xt:Kt(e),l=c?Xt:Kt(r),f=(u=u==Qt?Yt:u)==Yt,p=(l=l==Qt?Yt:l)==Yt,y=u==l;if(y&&yt(e)){if(!yt(r))return!1;s=!0,f=!1}if(y&&!f)return a||(a=new U),s||Ot(e)?q(e,r,n,o,i,a):function(e,r,n,o,i,a,s){switch(n){case"[object DataView]":if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=r.byteLength||!a(new J(e),new J(r)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+r);case"[object Error]":return e.name==r.name&&e.message==r.message;case"[object RegExp]":case"[object String]":return e==r+"";case"[object Map]":var c=K;case"[object Set]":var u=1&o;if(c||(c=Q),e.size!=r.size&&!u)return!1;var l=s.get(e);if(l)return l==r;o|=2,s.set(e,r);var f=q(c(e),c(r),o,i,a,s);return s.delete(e),f;case"[object Symbol]":if(Y)return Y.call(e)==Y.call(r)}return!1}(e,r,u,n,o,i,a);if(!(1&n)){var b=f&&Zt.call(e,"__wrapped__"),d=p&&Zt.call(r,"__wrapped__");if(b||d){var v=b?e.value():e,h=d?r.value():r;return a||(a=new U),i(v,h,n,o,a)}}return!!y&&(a||(a=new U),function(t,e,r,n,o,i){var a=1&r,s=zt(t),c=s.length;if(c!=zt(e).length&&!a)return!1;for(var u=c;u--;){var l=s[u];if(!(a?l in e:Ct.call(e,l)))return!1}var f=i.get(t),p=i.get(e);if(f&&p)return f==e&&p==t;var y=!0;i.set(t,e),i.set(e,t);for(var b=a;++u<c;){var d=t[l=s[u]],v=e[l];if(n)var h=a?n(v,d,l,e,t,i):n(d,v,l,t,e,i);if(!(void 0===h?d===v||o(d,v,r,n,i):h)){y=!1;break}b||(b="constructor"==l)}if(y&&!b){var g=t.constructor,m=e.constructor;g==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m||(y=!1)}return i.delete(t),i.delete(e),y}(e,r,n,o,i,a))},ee=function t(e,r,n,o,i){return e===r||(null==e||null==r||!nt(e)&&!nt(r)?e!=e&&r!=r:te(e,r,n,o,t,i))},re=function(t,e){return ee(t,e)};var ne=s(824),oe=s(685),ie=(0,oe.createGlobalStore)("extensionsInternal",{slots:{},extensions:{}}),ae=function(){return(0,oe.getGlobalStore)("extensionsInternal",{slots:{},extensions:{}})};function se(t){var e=ie.getState(),r=t(e);r!==e&&ie.setState(r)}var ce=function(){return(0,oe.getGlobalStore)("extensions",{slots:{}})};function ue(t){var e=[],r=!0,n=!1,o=void 0;try{for(var i,a=Object.values(t.extensions)[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value,c=!0,u=!1,l=void 0;try{for(var f,p=s.instances[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var y=f.value;e.push({slotModuleName:y.slotModuleName,extensionModuleName:s.moduleName,slotName:y.slotName,extensionId:y.id})}}catch(t){u=!0,l=t}finally{try{c||null==p.return||p.return()}finally{if(u)throw l}}}}catch(t){n=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}re(ne.configExtensionStore.getState().mountedExtensions,e)||ne.configExtensionStore.setState({mountedExtensions:e})}ue(ie.getState()),ie.subscribe(ue);var le=s(766);function fe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ye(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){pe(t,e,r[e])}))}return t}function be(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}function de(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,e)||he(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ve(t){return function(t){if(Array.isArray(t))return fe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||he(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(t,e){if(t){if("string"==typeof t)return fe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fe(t,e):void 0}}var ge=ae(),me=ce(),_e=(0,ne.getExtensionSlotsConfigStore)(),je=(0,ne.getExtensionsConfigStore)();function Se(t,e,r){var n={},o=!0,i=!1,a=void 0;try{for(var s,c=Object.entries(t.slots)[Symbol.iterator]();!(o=(s=c.next()).done);o=!0){var u=de(s.value,2),l=u[0],f=u[1],p=Ce(l,t,(0,ne.getExtensionSlotConfigFromStore)(e,f.name).config,r);n[l]={moduleName:f.moduleName,assignedExtensions:p}}}catch(t){i=!0,a=t}finally{try{o||null==c.return||c.return()}finally{if(i)throw a}}re(me.getState().slots,n)||me.setState({slots:n})}function Oe(t,e){return{moduleName:e,name:t,attachedIds:[],config:null}}function xe(t){return de(t.split("#"),1)[0]}function we(t,e){var r=xe(e);return t.extensions[r]}function Ee(t){return we(ge.getState(),t)}ge.subscribe((function(t){Se(t,_e.getState(),je.getState())})),_e.subscribe((function(t){Se(ge.getState(),t,je.getState())})),je.subscribe((function(t){Se(ge.getState(),_e.getState(),t)}));var Ae=function(t){return ge.setState((function(e){return e.extensions[t.name]=be(ye({},t),{instances:[]}),e}))};function Pe(t,e){se((function(r){var n=r.slots[t];return be(ye({},r),n?{slots:be(ye({},r.slots),pe({},t,be(ye({},n),{attachedIds:ve(n.attachedIds).concat([e])})))}:{slots:be(ye({},r.slots),pe({},t,be(ye({},Oe(t)),{attachedIds:[e]})))})}))}function Ie(t,e){se((function(r){var n=r.slots[t];return n&&n.attachedIds.includes(e)?be(ye({},r),{slots:be(ye({},r.slots),pe({},t,be(ye({},n),{attachedIds:n.attachedIds.filter((function(t){return t!==e}))})))}):r}))}function Ne(t){se((function(e){var r=e.slots[t];return r?be(ye({},e),{slots:be(ye({},e.slots),pe({},t,be(ye({},r),{attachedIds:[]})))}):e}))}function ke(t,e,r,n){var o=e.indexOf(t);if(-1!==o)return o;if(void 0!==r)return 1e3+r;var i=n.indexOf(t);return-1!==i?2e3+i:-1}function ze(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=null!=e?e:navigator.onLine;return t.filter((function(t){return Re(r,t.online,t.offline)}))}function Ce(t,e,r,n){var o=function(t,e){var r=t.add||[],n=t.remove||[],o=t.order||[],i=ge.getState().extensions;return ve(e).concat(ve(r)).filter((function(t){return!n.includes(t)})).sort((function(t,r){var n,a,s=ke(t,o,null===(n=i[xe(t)])||void 0===n?void 0:n.order,e),c=ke(r,o,null===(a=i[xe(r)])||void 0===a?void 0:a.order,e);return-1===c?-1:-1===s?1:s-c}))}(r,e.slots[t].attachedIds),i=[],a=void 0,s=!0,c=!1,u=void 0;try{for(var l,f=o[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var p=l.value,y=(0,ne.getExtensionConfigFromStore)(n,t,p).config,b=xe(p),d=e.extensions[b];if(d){var v,h,g=null!==(h=null==y||null===(v=y["Display conditions"])||void 0===v?void 0:v.privileges)&&void 0!==h?h:d.privileges;if(g&&("string"==typeof g||Array.isArray(g)&&g.length>0)){var m;if(void 0===a&&(a=null===(m=(0,le.getSessionStore)().getState().session)||void 0===m?void 0:m.user),!a)continue;if(!(0,le.userHasAccess)(g,a))continue}i.push({id:p,name:b,moduleName:d.moduleName,config:y,meta:d.meta,online:d.online,offline:d.offline})}}}catch(t){c=!0,u=t}finally{try{s||null==f.return||f.return()}finally{if(c)throw u}}return i}function Fe(t){return Ce(t,ge.getState(),(0,ne.getExtensionSlotConfig)(t).config,je.getState())}var Te=function(t,e){return ge.setState((function(r){var n,o=null===(n=r.slots[e])||void 0===n?void 0:n.moduleName;if(o&&o!=t)return console.warn("An extension slot with the name '".concat(e,'\' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ').concat(o,".")),r;if(o&&o==t)return r;if(r.slots[e])return be(ye({},r),{slots:be(ye({},r.slots),pe({},e,be(ye({},r.slots[e]),{moduleName:t})))});var i=Oe(e,t);return be(ye({},r),{slots:be(ye({},r.slots),pe({},e,i))})}))},Me=function(){return me.setState((function(){return{slots:{},extensions:{}}}))};function De(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=navigator.onLine;return Re(r,t,e)}function Re(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Boolean(t?e:r)}function $e(t,e){var r=navigator.onLine?t:e;return"object"==typeof r?r:{}}var Le=s(645);function Be(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ge(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Ue(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Ge(i,n,o,a,s,"next",t)}function s(t){Ge(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Ve(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){Ve(t,e,r[e])}))}return t}function We(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}function qe(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Je(t){return function(t){if(Array.isArray(t))return Be(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Be(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Be(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ke=function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function Qe(t,e,r,n){return Xe.apply(this,arguments)}function Xe(){return Xe=Ue((function(t,e,r,n){var o,i,a,s,c,u,l,f,p,y,b,d,v,h=arguments;return Ke(this,(function(g){switch(g.label){case 0:if(o=h.length>4&&void 0!==h[4]?h[4]:function(t){return t},i=h.length>5&&void 0!==h[5]?h[5]:{},a=xe(n),s=Ee(n),c=null,!t)return[3,3];if(!s)throw Error("Couldn't find extension '".concat(a,"' to attach to '").concat(e,"'"));return u=s.load,l=s.online,f=s.offline,p=s.meta,y=s.moduleName,De(l,f)?(se((function(o){var i={domElement:t,id:n,slotName:e,slotModuleName:r};return We(He({},o),{extensions:We(He({},o.extensions),Ve({},a,We(He({},o.extensions[a]),{instances:Je(o.extensions[a].instances).concat([i])})))})})),[4,u()]):[3,2];case 1:b=g.sent(),d=b.default,v=qe(b,["default"]),c=(0,Le.mountRootParcel)(o(null!=d?d:v),We(He({},$e(l,f),i),{_meta:p,_extensionContext:{extensionId:n,extensionSlotName:e,extensionSlotModuleName:r,extensionModuleName:y},domElement:t})),g.label=2;case 2:return[3,4];case 3:console.warn("Tried to render ".concat(n," into ").concat(e," but no DOM element was available.")),g.label=4;case 4:return[2,c]}}))})),Xe.apply(this,arguments)}var Ye=ae()})(),c})())}}}));
1
+ /*! For license information please see openmrs-esm-extensions.js.LICENSE.txt */
2
+ var _openmrs_esm_extensions;(()=>{var e={840:(e,t,n)=>{function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}(()=>{var e={151:()=>{(()=>{var e={758:()=>{(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{dispatchActionableNotificationShown:()=>p,dispatchConnectivityChanged:()=>r,dispatchNotificationShown:()=>h,dispatchPrecacheStaticDependencies:()=>a,subscribeActionableNotificationShown:()=>y,subscribeConnectivity:()=>i,subscribeConnectivityChanged:()=>o,subscribeNotificationShown:()=>d,subscribePrecacheStaticDependencies:()=>u,subscribeToastShown:()=>m});const n="openmrs:connectivity-changed";function r(e){window.dispatchEvent(new CustomEvent(n,{detail:{online:e}}))}function o(e){const t=t=>e(t.detail);return window.addEventListener(n,t),()=>window.removeEventListener(n,t)}function i(e){return e({online:navigator.onLine}),o(e)}const s="openmrs:precache-static-dependencies";function a(e={}){window.dispatchEvent(new CustomEvent(s,{detail:e}))}function u(e){const t=t=>e(t.detail);return window.addEventListener(s,t),()=>window.removeEventListener(s,t)}const c="openmrs:notification-shown",l="openmrs:actionable-notification-shown",f="openmrs:toast-shown";function h(e){window.dispatchEvent(new CustomEvent(c,{detail:e}))}function p(e){window.dispatchEvent(new CustomEvent(l,{detail:e}))}function d(e){const t=t=>e(t.detail);return window.addEventListener(c,t),()=>window.removeEventListener(c,t)}function y(e){const t=t=>e(t.detail);return window.addEventListener(l,t),()=>window.removeEventListener(l,t)}function m(e){const t=t=>e(t.detail);return window.addEventListener(f,t),()=>window.removeEventListener(f,t)}})()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{createErrorHandler:()=>o,reportError:()=>t});var e=n(758);function t(e){const t=i(e);setTimeout((()=>{throw t}))}function o(){const e=Error();return n=>{i(n).stack+=`\nAsync stacktrace:\n${e.stack}`,t(n)}}function i(e){let t;if(e instanceof Error)return e;if(null===e)return Error("'null' was thrown as an error");if("object"==typeof e){try{t=`Object thrown as error: ${JSON.stringify(e)}`}catch(n){t=`Object thrown as error with the following properties: ${Object.keys(e)}`}return Error(t)}return void 0===e?Error("'undefined' was thrown as an error"):Error(e.toString())}window.onerror=function(t){return console.error("Unexpected error: ",t),(0,e.dispatchNotificationShown)({description:null!=t?t:"Oops! An unexpected error occurred.",kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(t){var n;console.error("Unhandled rejection: ",t.reason),(0,e.dispatchNotificationShown)({description:null!==(n=t.reason)&&void 0!==n?n:"Oops! An unhandled promise rejection occurred.",kind:"error",title:"Error"})}})()})()},403:()=>{(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{createAppState:()=>a,createGlobalStore:()=>i,getAppState:()=>u,getGlobalStore:()=>s,subscribeTo:()=>c});const n=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o)?o:Object.assign({},t,o),n.forEach((n=>n(t,e)))}},o=()=>t,i={setState:r,getState:o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,o,i),i},r=e=>e?n(e):n,o={};function i(e,t){const n=o[e];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(t,!0),n.active=!0,n.value;{const n=r()((()=>t));return o[e]={value:n,active:!0},n}}function s(e,t){const n=o[e];if(!n){const n=r()((()=>null!=t?t:{}));return o[e]={value:n,active:!1},n}return n.value}function a(e){return i("app",e)}function u(){return s("app",{})}function c(e,t,n){let r=t(e.getState());return e.subscribe((e=>{const o=t(e);o!==r&&(r=o,n(o))}))}})()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};(()=>{"use strict";r.r(s),r.d(s,{OpenmrsFetchError:()=>lr,VisitMode:()=>iu,VisitStatus:()=>su,backendDependencies:()=>fu,clearCurrentUser:()=>gr,defaultVisitCustomRepresentation:()=>eu,fetchCurrentPatient:()=>Ba,fhirBaseUrl:()=>ir,getCurrentUser:()=>mr,getLocations:()=>lu,getLoggedInUser:()=>_r,getSessionLocation:()=>Or,getSessionStore:()=>vr,getStartedVisit:()=>ou,getVisitTypes:()=>uu,getVisitsForPatient:()=>tu,makeUrl:()=>ar,openmrsFetch:()=>ur,openmrsObservableFetch:()=>cr,refetchCurrentUser:()=>br,restBaseUrl:()=>or,saveVisit:()=>nu,sessionEndpoint:()=>sr,setSessionLocation:()=>Sr,setupApiModule:()=>jr,toLocationObject:()=>cu,toVisitTypeObject:()=>au,updateVisit:()=>ru,userHasAccess:()=>wr});var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};function t(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function a(e){return"function"==typeof e}var u=!1,c={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack,u=e},get useDeprecatedSynchronousErrorHandling(){return u}};function l(e){setTimeout((function(){throw e}),0)}var f={closed:!0,next:function(e){},error:function(e){if(c.useDeprecatedSynchronousErrorHandling)throw e;l(e)},complete:function(){}},h=Array.isArray||function(e){return e&&"number"==typeof e.length};function p(e){return null!==e&&"object"==typeof e}var d=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}(),y=d,m=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var t;if(!this.closed){var n=this,r=n._parentOrParents,o=n._ctorUnsubscribe,i=n._unsubscribe,s=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof e)r.remove(this);else if(null!==r)for(var u=0;u<r.length;++u)r[u].remove(this);if(a(i)){o&&(this._unsubscribe=void 0);try{i.call(this)}catch(e){t=e instanceof y?v(e.errors):[e]}}if(h(s)){u=-1;for(var c=s.length;++u<c;){var l=s[u];if(p(l))try{l.unsubscribe()}catch(e){t=t||[],e instanceof y?t=t.concat(v(e.errors)):t.push(e)}}}if(t)throw new y(t)}},e.prototype.add=function(t){var n=t;if(!t)return e.EMPTY;switch(typeof t){case"function":n=new e(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof e)){var r=n;(n=new e)._subscriptions=[r]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=n._parentOrParents;if(null===o)n._parentOrParents=this;else if(o instanceof e){if(o===this)return n;n._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return n;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function v(e){return e.reduce((function(e,t){return e.concat(t instanceof y?t.errors:t)}),[])}var b="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),g=function(e){function n(t,r,o){var i=e.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=f;break;case 1:if(!t){i.destination=f;break}if("object"==typeof t){t instanceof n?(i.syncErrorThrowable=t.syncErrorThrowable,i.destination=t,t.add(i)):(i.syncErrorThrowable=!0,i.destination=new w(i,t));break}default:i.syncErrorThrowable=!0,i.destination=new w(i,t,r,o)}return i}return t(n,e),n.prototype[b]=function(){return this},n.create=function(e,t,r){var o=new n(e,t,r);return o.syncErrorThrowable=!1,o},n.prototype.next=function(e){this.isStopped||this._next(e)},n.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},n.prototype._next=function(e){this.destination.next(e)},n.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},n.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},n.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},n}(m),w=function(e){function n(t,n,r,o){var i,s=e.call(this)||this;s._parentSubscriber=t;var u=s;return a(n)?i=n:n&&(i=n.next,r=n.error,o=n.complete,n!==f&&(a((u=Object.create(n)).unsubscribe)&&s.add(u.unsubscribe.bind(u)),u.unsubscribe=s.unsubscribe.bind(s))),s._context=u,s._next=i,s._error=r,s._complete=o,s}return t(n,e),n.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;c.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},n.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,n=c.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)n?(t.syncErrorValue=e,t.syncErrorThrown=!0):l(e),this.unsubscribe();else{if(this.unsubscribe(),n)throw e;l(e)}}},n.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return e._complete.call(e._context)};c.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},n.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),c.useDeprecatedSynchronousErrorHandling)throw e;l(e)}},n.prototype.__tryOrSetError=function(e,t,n){if(!c.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,n)}catch(t){return c.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(l(t),!0)}return!1},n.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},n}(g),O="function"==typeof Symbol&&Symbol.observable||"@@observable";function S(e){return e}var E=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r=this.operator,o=function(e,t,n){if(e){if(e instanceof g)return e;if(e[b])return e[b]()}return e||t||n?new g(e,t,n):new g(f)}(e,t,n);if(r?o.add(r.call(o,this.source)):o.add(this.source||c.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),c.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){c.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),function(e){for(;e;){var t=e,n=t.closed,r=t.destination,o=t.isStopped;if(n||o)return!1;e=r&&r instanceof g?r:null}return!0}(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=j(t))((function(t,r){var o;o=n.subscribe((function(t){try{e(t)}catch(e){r(e),o&&o.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[O]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:(0===(n=e).length?S:1===n.length?n[0]:function(e){return n.reduce((function(e,t){return t(e)}),e)})(this);var n},e.prototype.toPromise=function(e){var t=this;return new(e=j(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function j(e){if(e||(e=c.Promise||Promise),!e)throw new Error("no Promise impl found");return e}const P="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;var x="object"==typeof self&&self&&self.Object===Object&&self;const A=(P||x||Function("return this")()).Symbol;var T=Object.prototype,k=T.hasOwnProperty,D=T.toString,I=A?A.toStringTag:void 0,N=Object.prototype.toString,C=A?A.toStringTag:void 0;const M=(B=Object.getPrototypeOf,U=Object,function(e){return B(U(e))});var B,U,R=Function.prototype,$=Object.prototype,K=R.toString,L=$.hasOwnProperty,F=K.call(Object);const q=function(e){if(!function(e){return null!=e&&"object"==typeof e}(e)||"[object Object]"!=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":C&&C in Object(e)?function(e){var t=k.call(e,I),n=e[I];try{e[I]=void 0;var r=!0}catch(e){}var o=D.call(e);return r&&(t?e[I]=n:delete e[I]),o}(e):function(e){return N.call(e)}(e)}(e))return!1;var t=M(e);if(null===t)return!0;var n=L.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&K.call(n)==F};function W(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function G(e){return function t(n){return 0===arguments.length||W(n)?t:e.apply(this,arguments)}}function z(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return W(n)?t:G((function(t){return e(n,t)}));default:return W(n)&&W(r)?t:W(n)?G((function(t){return e(t,r)})):W(r)?G((function(t){return e(n,t)})):e(n,r)}}}function V(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function H(e,t,n){for(var r=0,o=n.length;r<o;){if(e(t,n[r]))return!0;r+=1}return!1}function Y(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const J="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var Q=Object.prototype.toString,X=function(){return"[object Arguments]"===Q.call(arguments)?function(e){return"[object Arguments]"===Q.call(e)}:function(e){return Y("callee",e)}}();const Z=X;var ee=!{toString:null}.propertyIsEnumerable("toString"),te=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],ne=function(){return arguments.propertyIsEnumerable("length")}(),re=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1};const oe="function"!=typeof Object.keys||ne?G((function(e){if(Object(e)!==e)return[];var t,n,r=[],o=ne&&Z(e);for(t in e)!Y(t,e)||o&&"length"===t||(r[r.length]=t);if(ee)for(n=te.length-1;n>=0;)Y(t=te[n],e)&&!re(r,t)&&(r[r.length]=t),n-=1;return r})):G((function(e){return Object(e)!==e?[]:Object.keys(e)})),ie=G((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function se(e,t,n,r){var o=V(e);function i(e,t){return ae(e,t,n.slice(),r.slice())}return!H((function(e,t){return!H(i,t,e)}),V(t),o)}function ae(e,t,n,r){if(J(e,t))return!0;var o=ie(e);if(o!==ie(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!J(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!J(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=n.length-1;i>=0;){if(n[i]===e)return r[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&se(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&se(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var s=oe(e);if(s.length!==oe(t).length)return!1;var a=n.concat([e]),u=r.concat([t]);for(i=s.length-1;i>=0;){var c=s[i];if(!Y(c,t)||!ae(t[c],e[c],a,u))return!1;i-=1}return!0}var ue=z((function(e,t){return ae(e,t,[],[])}));const ce=ue;function le(e){return function t(n,r,o){switch(arguments.length){case 0:return t;case 1:return W(n)?t:z((function(t,r){return e(n,t,r)}));case 2:return W(n)&&W(r)?t:W(n)?z((function(t,n){return e(t,r,n)})):W(r)?z((function(t,r){return e(n,t,r)})):G((function(t){return e(n,r,t)}));default:return W(n)&&W(r)&&W(o)?t:W(n)&&W(r)?z((function(t,n){return e(t,n,o)})):W(n)&&W(o)?z((function(t,n){return e(t,r,n)})):W(r)&&W(o)?z((function(t,r){return e(n,t,r)})):W(n)?G((function(t){return e(t,r,o)})):W(r)?G((function(t){return e(n,t,o)})):W(o)?G((function(t){return e(n,r,t)})):e(n,r,o)}}}function fe(e){return"[object Object]"===Object.prototype.toString.call(e)}var he=le((function(e,t,n){var r,o={};for(r in t)Y(r,t)&&(o[r]=Y(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)Y(r,n)&&!Y(r,o)&&(o[r]=n[r]);return o}));const pe=he;var de=le((function e(t,n,r){return pe((function(n,r,o){return fe(r)&&fe(o)?e(t,r,o):t(n,r,o)}),n,r)}));const ye=de,me=z((function(e,t){return ye((function(e,t,n){return n}),e,t)})),ve=z((function(e,t){for(var n={},r={},o=0,i=e.length;o<i;)r[e[o]]=1,o+=1;for(var s in t)r.hasOwnProperty(s)||(n[s]=t[s]);return n}));function be(e,t,n,r){var o,i=function(o){for(var i=t.length,s=0;s<i;){if(e===t[s])return n[s];s+=1}for(var a in t[s+1]=e,n[s+1]=o,e)o[a]=r?be(e[a],t,n,!0):e[a];return o};switch(ie(e)){case"Object":return i({});case"Array":return i([]);case"Date":return new Date(e.valueOf());case"RegExp":return o=e,new RegExp(o.source,(o.global?"g":"")+(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.sticky?"y":"")+(o.unicode?"u":""));default:return e}}const ge=G((function(e){return null!=e&&"function"==typeof e.clone?e.clone():be(e,[],[],!0)})),we=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};var _e=G((function(e){return!!we(e)||!!e&&"object"==typeof e&&!function(e){return"[object String]"===Object.prototype.toString.call(e)}(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1))}));const Oe=_e;var Se=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),Ee=z((function(e,t){return function(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,i){return t.apply(this,arguments)};case 6:return function(e,n,r,o,i,s){return t.apply(this,arguments)};case 7:return function(e,n,r,o,i,s,a){return t.apply(this,arguments)};case 8:return function(e,n,r,o,i,s,a,u){return t.apply(this,arguments)};case 9:return function(e,n,r,o,i,s,a,u,c){return t.apply(this,arguments)};case 10:return function(e,n,r,o,i,s,a,u,c,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}(e.length,(function(){return e.apply(t,arguments)}))}));const je=Ee;function Pe(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function xe(e,t,n,r){return e["@@transducer/result"](n[r](je(e["@@transducer/step"],e),t))}var Ae="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";const Te=le((function(e,t,n){if("function"==typeof e&&(e=function(e){return new Se(e)}(e)),Oe(n))return function(e,t,n){for(var r=0,o=n.length;r<o;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}(e,t,n);if("function"==typeof n["fantasy-land/reduce"])return xe(e,t,n,"fantasy-land/reduce");if(null!=n[Ae])return Pe(e,t,n[Ae]());if("function"==typeof n.next)return Pe(e,t,n);if("function"==typeof n.reduce)return xe(e,t,n,"reduce");throw new TypeError("reduce: list must be array or iterable")}));var ke;function De(e,t){return n=>{if(!e(n))return"function"==typeof t?t(n):t}}!function(e){e.Array="Array",e.Boolean="Boolean",e.ConceptUuid="ConceptUuid",e.Number="Number",e.Object="Object",e.String="String",e.UUID="UUID",e.PersonAttributeTypeUuid="PersonAttributeTypeUuid",e.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid"}(ke||(ke={}));const Ie=De((e=>Array.isArray(e)),"must be an array"),Ne=De((e=>"boolean"==typeof e),"must be a boolean"),Ce=De((e=>"number"==typeof e),"must be a number"),Me=De((e=>"string"==typeof e),"must be a string"),Be=De((e=>"object"==typeof e&&!Array.isArray(e)&&null!==e),"must be an object (not an array or null)"),Ue=De((e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e)),"must be a valid UUID or a 36-character hexadecimal string");var Re=r(403);const $e=(0,Re.createGlobalStore)("config-internal",{providedConfigs:[],schemas:{}}),Ke=(0,Re.createGlobalStore)("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});Ke.subscribe((e=>{var t;t=e.config,localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}));const Le=(0,Re.createGlobalStore)("config-store-of-extension-state",{mountedExtensions:[]});function Fe(e){return(0,Re.getGlobalStore)(`config-module-${e}`,{config:null,loaded:!1})}const qe=(0,Re.createGlobalStore)("config-implementer-tools",{config:{}});function We(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ge(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){We(e,t,n[t])}))}return e}function ze(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Ve(e,t){for(let n of Object.keys(e.schemas)){const r=rt(n,e,t);Fe(n).setState({loaded:!0,config:r})}}function He(e,t){const n=function(e,t){const n=it(tt(e,t)),r=Object.keys(n).reduce(((e,t)=>{var r,o;return(null===(r=n[t])||void 0===r?void 0:r.extensionSlots)&&(e[t]=null===(o=n[t])||void 0===o?void 0:o.extensionSlots),e}),{});return function(e){for(let[t,n]of Object.entries(e))for(let[e,r]of Object.entries(n))et(r,t,e)}(r),Object.keys(r).reduce(((e,t)=>Ge({},e,r[t])),{})}(e,t),r=Object.fromEntries(Object.entries(n).map((([e,t])=>[e,{loaded:!0,config:t}]))),o=(0,Re.getGlobalStore)("config-extension-slots",{slots:{}}),i=o.getState(),s={slots:Ge({},i.slots,r)};ce(i,s)||o.setState(s)}function Ye(e,t){const n=function(e,t){let n=Xe(ge(e.schemas));const r=[...e.providedConfigs.map((e=>[e.config,e.source])),[t.config,"temporary config"]];for(let[e,t]of r)n=it([n,Ze(e,t)]);return n}(e,t);qe.setState({config:n})}function Je(e,t,n){const r={};for(let o of t.mountedExtensions){const t=Qe(o.slotModuleName,o.extensionModuleName,o.slotName,o.extensionId,e,n);r[o.slotName]=ze(Ge({},r[o.slotName]),{[o.extensionId]:{config:t,loaded:!0}})}(0,Re.getGlobalStore)("config-extensions",{configs:{}}).setState({configs:r})}function Qe(e,t,n,r,o,i){var s,a,u;const c=function(e){const[t]=e.split("#");return t}(r),l=o.schemas[c],f=l?c:t,h=tt(o,i),p=ot(e,h);var d;const y=null!==(d=null==p||null===(s=p.extensionSlots)||void 0===s||null===(a=s[n])||void 0===a||null===(u=a.configure)||void 0===u?void 0:u[r])&&void 0!==d?d:{},m=it([ot(f,h),y]),v=null!=l?l:o.schemas[t];st(v,m,f);const b=ft(v,m);return ut(v,b,f),delete b.extensionSlots,b}function Xe(e){return e.hasOwnProperty("_default")?ze(Ge({},e),{_value:e._default,_source:"default"}):pt(e)?Object.keys(e).reduce(((t,n)=>(t[n]=Xe(e[n]),t)),{}):{}}function Ze(e,t){return pt(e)?Object.keys(e).reduce(((n,r)=>(n[r]=Ze(e[r],t),n)),{}):{_value:e,_source:t}}function et(e,t,n){const r=`Extension slot config '${t}.extensionSlots.${n}`,o=Object.keys(e).filter((e=>!["add","remove","order","configure"].includes(e)));o.length&&console.error(r+`' contains invalid keys '${o.join("', '")}'`),e.add&&(Array.isArray(e.add)&&e.add.every((e=>"string"==typeof e))||console.error(r+".add' is invalid. Must be an array of strings (extension IDs)")),e.remove&&(Array.isArray(e.remove)&&e.remove.every((e=>"string"==typeof e))||console.error(r+".remove' is invalid. Must be an array of strings (extension IDs)")),e.order&&(Array.isArray(e.order)&&e.order.every((e=>"string"==typeof e))||console.error(r+".order' is invalid. Must be an array of strings (extension IDs)")),e.configure&&(pt(e.configure)||console.error(r+".configure' is invalid. Must be an object with extension IDs for keys"))}function tt(e,t){return[...e.providedConfigs.map((e=>e.config)),t.config]}function nt(e,t,n=""){const r="Please verify that you are running the latest version and, if so, alert the maintainer.";for(const o of Object.keys(t).filter((e=>!e.startsWith("_")))){const i=n+(n&&".")+o,s=t[o];if("Display conditions"===i&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${r}`),"Translation overrides"===i&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${r}`),!pt(s)){console.error(`${e} has bad config schema definition for key '${i}'. ${r}`);continue}s.hasOwnProperty("_default")||nt(e,s,i);const a=s._elements;if(ht(a)&&nt(e,a,i+"._elements"),s._validators)for(let t of s._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${i}' ${r}.\n\nIf you're the maintainer: validators must be functions that return either undefined or an error string. Received ${t}.`);const u=s._type;u&&!Object.values(ke).includes(u)&&console.error(`${e} has invalid type for key '${i}' ${r}.\n\nIf you're the maintainer: the allowed types are ${Object.values(ke).join(", ")}. Received '${u}'`),Object.keys(s).every((e=>["_description","_validators","_elements","_type"].includes(e)))&&!n.includes("._elements")&&console.error(`${e} has bad config schema definition for key '${i}'. ${r}.\n\nIf you're the maintainer: all config elements must have a default. Received ${JSON.stringify(s)}`),a&&u&&![ke.Array,ke.Object].includes(u)&&console.error(`${e} has bad config schema definition for key '${i}'. ${r}.\n\nIf you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. Received ${JSON.stringify(u)}`)}}function rt(e,t,n){if(!t.schemas.hasOwnProperty(e))throw Error("No config schema has been defined for "+e);const r=t.schemas[e],o=ot(e,tt(t,n));st(r,o,e);const i=ft(r,o);return ut(r,i,e),delete i.extensionSlots,i}function ot(e,t){return it(t.map((({[e]:t})=>t)).filter((e=>!!e)))}function it(e){return Te(me)({},e)}function st(e,t,n=""){for(const r of Object.keys(t)){const o=t[r],i=n+"."+r,s=e[r];e.hasOwnProperty(r)?at(s,o,i):"extensionSlots"===r&&""!==n||console.error(`Unknown config key '${i}' provided. Ignoring.`)}}function at(e,t,n){ct(n,e._type,t),pt(t)?e._type===ke.Object?function(e,t,n){if(e._elements)for(const r of Object.keys(t)){const o=t[r];st(e._elements,o,`${n}.${r}`)}}(e,t,n):e.hasOwnProperty("_default")||st(e,t,n):e._type===ke.Array&&function(e,t,n){if(ht(e._elements))for(let r=0;r<t.length;r++)at(e._elements,t[r],`${n}[${r}]`);for(let o=0;o<t.length;o++){var r;ct(`${n}[${o}]`,null===(r=e._elements)||void 0===r?void 0:r._type,t[o])}}(e,t,n)}function ut(e,t,n=""){if(e)if(t!==e._default&&lt(n,e._validators,t),pt(t))for(const r of Object.keys(t)){const o=t[r],i=n+"."+r,s=e[r];e._type===ke.Object&&e._elements?ut(e._elements,o,i):ut(s,o,i)}else if(Array.isArray(t)&&e._elements)for(let r=0;r<t.length;r++)ut(e._elements,t[r],`${n}[${r}]`)}function ct(e,t,n){t&&lt(e,[{Array:Ie,Boolean:Ne,ConceptUuid:Ue,Number:Ce,Object:Be,String:Me,UUID:Ue,PersonAttributeTypeUuid:Ue,PatientIdentifierTypeUuid:Ue}[t]],n)}function lt(e,t,n){if(t)try{for(let r of t){const t=r(n);"string"==typeof t&&("object"==typeof n?console.error(`Invalid configuration for ${e}: ${t}`):console.error(`Invalid configuration value ${n} for ${e}: ${t}`))}}catch(t){console.error(`Skipping invalid validator at "${e}". Encountered error\n\t${t}`)}}Ve($e.getState(),Ke.getState()),$e.subscribe((e=>Ve(e,Ke.getState()))),Ke.subscribe((e=>Ve($e.getState(),e))),Ye($e.getState(),Ke.getState()),$e.subscribe((e=>Ye(e,Ke.getState()))),Ke.subscribe((e=>Ye($e.getState(),e))),He($e.getState(),Ke.getState()),$e.subscribe((e=>He(e,Ke.getState()))),Ke.subscribe((e=>He($e.getState(),e))),Je($e.getState(),Le.getState(),Ke.getState()),$e.subscribe((e=>{Je(e,Le.getState(),Ke.getState())})),Le.subscribe((e=>{Je($e.getState(),e,Ke.getState())})),Ke.subscribe((e=>{Je($e.getState(),Le.getState(),e)}));const ft=(e,t)=>{const n=ge(t);if(!e)return n;for(const t of Object.keys(e)){const r=n[t],o=e[t];if(o&&o.hasOwnProperty("_default")){n.hasOwnProperty(t)||(n[t]=o._default);const e=o._elements;if(r&&ht(e))if(o._type===ke.Array&&Array.isArray(r)){const o=r.map((t=>ft(e,t)));n[t]=o}else if(o._type===ke.Object)for(let t of Object.keys(r))r[t]=ft(e,r[t])}else if(pt(o)){const e=n.hasOwnProperty(t)?r:{};pt(e)&&(n[t]=ft(o,e))}}return n};function ht(e){return!!e&&Object.keys(e).filter((e=>!["_default","_validators"].includes(e))).length>0}function pt(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}const dt={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:ke.Array,_default:[]}},"Translation overrides":{_description:"Per-language overrides for frontend translations should be keyed by language code and each language dictionary contains the translation key and the display value",_type:ke.Object,_default:{}}};var yt=Object.freeze({__proto__:null,get start(){return Jn},get ensureJQuerySupport(){return jn},get setBootstrapMaxTime(){return sn},get setMountMaxTime(){return an},get setUnmountMaxTime(){return un},get setUnloadMaxTime(){return cn},get registerApplication(){return Bn},get unregisterApplication(){return Rn},get getMountedApps(){return Nn},get getAppStatus(){return Mn},get unloadApplication(){return $n},get checkActivityFunctions(){return Un},get getAppNames(){return Cn},get pathToActiveWhen(){return Fn},get navigateToUrl(){return vn},get triggerAppChange(){return zn},get addErrorHandler(){return Ot},get removeErrorHandler(){return St},get mountRootParcel(){return en},get NOT_LOADED(){return Pt},get LOADING_SOURCE_CODE(){return xt},get NOT_BOOTSTRAPPED(){return At},get BOOTSTRAPPING(){return Tt},get NOT_MOUNTED(){return kt},get MOUNTING(){return Dt},get UPDATING(){return Nt},get LOAD_ERROR(){return Mt},get MOUNTED(){return It},get UNMOUNTING(){return Ct},get SKIP_BECAUSE_BROKEN(){return Bt}});function mt(e){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bt=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{}).CustomEvent,gt=function(){try{var e=new bt("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?bt:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=Boolean(t.bubbles),n.cancelable=Boolean(t.cancelable),n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n},wt=[];function _t(e,t,n){var r=jt(e,t,n);wt.length?wt.forEach((function(e){return e(r)})):setTimeout((function(){throw r}))}function Ot(e){if("function"!=typeof e)throw Error(Et(28,!1));wt.push(e)}function St(e){if("function"!=typeof e)throw Error(Et(29,!1));var t=!1;return wt=wt.filter((function(n){var r=n===e;return t=t||r,!r})),t}function Et(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(e,": ").concat(t?t+" ":"","See https://single-spa.js.org/error/?code=").concat(e).concat(r.length?"&arg=".concat(r.join("&arg=")):"")}function jt(e,t,n){var r,o="".concat(Lt(t)," '").concat($t(t),"' died in status ").concat(t.status,": ");if(e instanceof Error){try{e.message=o+e.message}catch(e){}r=e}else{console.warn(Et(30,!1,t.status,$t(t)));try{r=Error(o+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=$t(t),t.status=n,r}var Pt="NOT_LOADED",xt="LOADING_SOURCE_CODE",At="NOT_BOOTSTRAPPED",Tt="BOOTSTRAPPING",kt="NOT_MOUNTED",Dt="MOUNTING",It="MOUNTED",Nt="UPDATING",Ct="UNMOUNTING",Mt="LOAD_ERROR",Bt="SKIP_BECAUSE_BROKEN";function Ut(e){return e.status===It}function Rt(e){try{return e.activeWhen(window.location)}catch(t){return _t(t,e,Bt),!1}}function $t(e){return e.name}function Kt(e){return Boolean(e.unmountThisParcel)}function Lt(e){return Kt(e)?"parcel":"application"}function Ft(){for(var e=arguments.length-1;e>0;e--)for(var t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function qt(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function Wt(e){return e&&("function"==typeof e||(t=e,Array.isArray(t)&&!qt(t,(function(e){return"function"!=typeof e}))));var t}function Gt(e,t){var n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[function(){return Promise.resolve()}]);var r=Lt(e),o=$t(e);return function(e){return n.reduce((function(n,i,s){return n.then((function(){var n=i(e);return zt(n)?n:Promise.reject(Et(15,!1,r,o,t,s))}))}),Promise.resolve())}}function zt(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}function Vt(e,t){return Promise.resolve().then((function(){return e.status!==At?e:(e.status=Tt,e.bootstrap?ln(e,"bootstrap").then(n).catch((function(n){if(t)throw jt(n,e,Bt);return _t(n,e,Bt),e})):Promise.resolve().then(n))}));function n(){return e.status=kt,e}}function Ht(e,t){return Promise.resolve().then((function(){if(e.status!==It)return e;e.status=Ct;var n=Object.keys(e.parcels).map((function(t){return e.parcels[t].unmountThisParcel()}));return Promise.all(n).then(r,(function(n){return r().then((function(){var r=Error(n.message);if(t)throw jt(r,e,Bt);_t(r,e,Bt)}))})).then((function(){return e}));function r(){return ln(e,"unmount").then((function(){e.status=kt})).catch((function(n){if(t)throw jt(n,e,Bt);_t(n,e,Bt)}))}}))}var Yt=!1,Jt=!1;function Qt(e,t){return Promise.resolve().then((function(){return e.status!==kt?e:(Yt||(window.dispatchEvent(new gt("single-spa:before-first-mount")),Yt=!0),ln(e,"mount").then((function(){return e.status=It,Jt||(window.dispatchEvent(new gt("single-spa:first-mount")),Jt=!0),e})).catch((function(n){return e.status=It,Ht(e,!0).then(r,r);function r(){if(t)throw jt(n,e,Bt);return _t(n,e,Bt),e}})))}))}var Xt=0,Zt={parcels:{}};function en(){return tn.apply(Zt,arguments)}function tn(e,t){var n=this;if(!e||"object"!==mt(e)&&"function"!=typeof e)throw Error(Et(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(Et(3,!1,mt(e.name)));if("object"!==mt(t))throw Error(Et(4,!1,name,mt(t)));if(!t.domElement)throw Error(Et(5,!1,name));var r,o=Xt++,i="function"==typeof e,s=i?e:function(){return Promise.resolve(e)},a={id:o,parcels:{},status:i?xt:At,customProps:t,parentName:$t(n),unmountThisParcel:function(){return h.then((function(){if(a.status!==It)throw Error(Et(6,!1,name,a.status));return Ht(a,!0)})).then((function(e){return a.parentName&&delete n.parcels[a.id],e})).then((function(e){return c(e),e})).catch((function(e){throw a.status=Bt,l(e),e}))}};n.parcels[o]=a;var u=s();if(!u||"function"!=typeof u.then)throw Error(Et(7,!1));var c,l,f=(u=u.then((function(e){if(!e)throw Error(Et(8,!1));var t=e.name||"parcel-".concat(o);if(Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!Wt(e.bootstrap))throw Error(Et(9,!1,t));if(!Wt(e.mount))throw Error(Et(10,!1,t));if(!Wt(e.unmount))throw Error(Et(11,!1,t));if(e.update&&!Wt(e.update))throw Error(Et(12,!1,t));var n=Gt(e,"bootstrap"),i=Gt(e,"mount"),s=Gt(e,"unmount");a.status=At,a.name=t,a.bootstrap=n,a.mount=i,a.unmount=s,a.timeouts=fn(e.timeouts),e.update&&(a.update=Gt(e,"update"),r.update=function(e){return a.customProps=e,nn(function(e){return Promise.resolve().then((function(){if(e.status!==It)throw Error(Et(32,!1,$t(e)));return e.status=Nt,ln(e,"update").then((function(){return e.status=It,e})).catch((function(t){throw jt(t,e,Bt)}))}))}(a))})}))).then((function(){return Vt(a,!0)})),h=f.then((function(){return Qt(a,!0)})),p=new Promise((function(e,t){c=e,l=t}));return r={mount:function(){return nn(Promise.resolve().then((function(){if(a.status!==kt)throw Error(Et(13,!1,name,a.status));return n.parcels[o]=a,Qt(a)})))},unmount:function(){return nn(a.unmountThisParcel())},getStatus:function(){return a.status},loadPromise:nn(u),bootstrapPromise:nn(f),mountPromise:nn(h),unmountPromise:nn(p)}}function nn(e){return e.then((function(){return null}))}function rn(e){var t=$t(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!==mt(n)||null===n||Array.isArray(n))&&(n={},console.warn(Et(40,!1),t,n));var r=Ft({},n,{name:t,mountParcel:tn.bind(e),singleSpa:yt});return Kt(e)&&(r.unmountSelf=e.unmountThisParcel),r}var on={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function sn(e,t,n){if("number"!=typeof e||e<=0)throw Error(Et(16,!1));on.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function an(e,t,n){if("number"!=typeof e||e<=0)throw Error(Et(17,!1));on.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function un(e,t,n){if("number"!=typeof e||e<=0)throw Error(Et(18,!1));on.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function cn(e,t,n){if("number"!=typeof e||e<=0)throw Error(Et(19,!1));on.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function ln(e,t){var n=e.timeouts[t],r=n.warningMillis,o=Lt(e);return new Promise((function(i,s){var a=!1,u=!1;e[t](rn(e)).then((function(e){a=!0,i(e)})).catch((function(e){a=!0,s(e)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),n.millis);var c=Et(31,!1,t,o,$t(e),n.millis);function l(e){if(!a)if(!0===e)u=!0,n.dieOnTimeout?s(Error(c)):console.error(c);else if(!u){var t=e,o=t*r;console.warn(c),o+r<n.millis&&setTimeout((function(){return l(t+1)}),r)}}}))}function fn(e){var t={};for(var n in on)t[n]=Ft({},on[n],e&&e[n]||{});return t}function hn(e){return Promise.resolve().then((function(){return e.loadPromise?e.loadPromise:e.status!==Pt&&e.status!==Mt?e:(e.status=xt,e.loadPromise=Promise.resolve().then((function(){var r=e.loadApp(rn(e));if(!zt(r))throw n=!0,Error(Et(33,!1,$t(e)));return r.then((function(n){var r;e.loadErrorTime=null,"object"!==mt(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!Wt(t.bootstrap)&&(r=35),Wt(t.mount)||(r=36),Wt(t.unmount)||(r=37);var o=Lt(t);if(r){var i;try{i=JSON.stringify(t)}catch(e){}return console.error(Et(r,!1,o,$t(e),i),t),_t(void 0,e,Bt),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=Ft({},e.devtools.overlays,t.devtools.overlays)),e.status=At,e.bootstrap=Gt(t,"bootstrap"),e.mount=Gt(t,"mount"),e.unmount=Gt(t,"unmount"),e.unload=Gt(t,"unload"),e.timeouts=fn(t.timeouts),delete e.loadPromise,e}))})).catch((function(t){var r;return delete e.loadPromise,n?r=Bt:(r=Mt,e.loadErrorTime=(new Date).getTime()),_t(t,e,r),e})));var t,n}))}var pn,dn="undefined"!=typeof window,yn={hashchange:[],popstate:[]},mn=["hashchange","popstate"];function vn(e){var t;if("string"==typeof e)t=e;else if(this&&this.href)t=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(Et(14,!1));t=e.currentTarget.href,e.preventDefault()}var n=Sn(window.location.href),r=Sn(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)}function bn(e){var t=this;if(e){var n=e[0].type;mn.indexOf(n)>=0&&yn[n].forEach((function(n){try{n.apply(t,e)}catch(e){setTimeout((function(){throw e}))}}))}}function gn(){Vn([],arguments)}function wn(e,t){return function(){var n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return pn&&n===o||(Qn()?window.dispatchEvent(function(e,t){var n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)):Vn([])),r}}if(dn){window.addEventListener("hashchange",gn),window.addEventListener("popstate",gn);var _n=window.addEventListener,On=window.removeEventListener;window.addEventListener=function(e,t){if(!("function"==typeof t&&mn.indexOf(e)>=0)||qt(yn[e],(function(e){return e===t})))return _n.apply(this,arguments);yn[e].push(t)},window.removeEventListener=function(e,t){if(!("function"==typeof t&&mn.indexOf(e)>=0))return On.apply(this,arguments);yn[e]=yn[e].filter((function(e){return e!==t}))},window.history.pushState=wn(window.history.pushState,"pushState"),window.history.replaceState=wn(window.history.replaceState,"replaceState"),window.singleSpaNavigate?console.warn(Et(41,!1)):window.singleSpaNavigate=vn}function Sn(e){var t=document.createElement("a");return t.href=e,t}var En=!1;function jn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!En){var t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return Pn.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return Pn.call(this,n,window.removeEventListener,e,t,arguments)},En=!0}}function Pn(e,t,n,r,o){return"string"!=typeof n?e.apply(this,o):(n.split(/\s+/).forEach((function(e){mn.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))})),""===n.trim()?this:e.apply(this,o))}var xn={};function An(e){return Promise.resolve().then((function(){var t=xn[$t(e)];if(!t)return e;if(e.status===Pt)return Tn(e,t),e;if("UNLOADING"===e.status)return t.promise.then((function(){return e}));if(e.status!==kt&&e.status!==Mt)return e;var n=e.status===Mt?Promise.resolve():ln(e,"unload");return e.status="UNLOADING",n.then((function(){return Tn(e,t),e})).catch((function(n){return function(e,t,n){delete xn[$t(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,_t(n,e,Bt),t.reject(n)}(e,t,n),e}))}))}function Tn(e,t){delete xn[$t(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=Pt,t.resolve()}function kn(e,t,n,r){xn[$t(e)]={app:e,resolve:n,reject:r},Object.defineProperty(xn[$t(e)],"promise",{get:t})}function Dn(e){return xn[e]}var In=[];function Nn(){return In.filter(Ut).map($t)}function Cn(){return In.map($t)}function Mn(e){var t=qt(In,(function(t){return $t(t)===e}));return t?t.status:null}function Bn(e,t,n,r){var o=function(e,t,n,r){var o,i={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===mt(e)?(function(e){if(Array.isArray(e)||null===e)throw Error(Et(39,!1));var t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((function(e,n){return t.indexOf(n)>=0?e:e.concat(n)}),[]);if(0!==n.length)throw Error(Et(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length)throw Error(Et(20,!1));if("object"!==mt(e.app)&&"function"!=typeof e.app)throw Error(Et(20,!1));var r=function(e){return"string"==typeof e||"function"==typeof e};if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(Et(24,!1));if(!Ln(e.customProps))throw Error(Et(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(Et(20,!1));if(!t)throw Error(Et(23,!1));if("function"!=typeof n)throw Error(Et(24,!1));if(!Ln(r))throw Error(Et(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(o=i.loadApp)?function(){return Promise.resolve(o)}:o,i.customProps=function(e){return e||{}}(i.customProps),i.activeWhen=function(e){var t=Array.isArray(e)?e:[e];return t=t.map((function(e){return"function"==typeof e?e:Fn(e)})),function(e){return t.some((function(t){return t(e)}))}}(i.activeWhen),i}(e,t,n,r);if(-1!==Cn().indexOf(o.name))throw Error(Et(21,!1,o.name));In.push(Ft({loadErrorTime:null,status:Pt,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),dn&&(jn(),Vn())}function Un(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return In.filter((function(t){return t.activeWhen(e)})).map($t)}function Rn(e){if(0===In.filter((function(t){return $t(t)===e})).length)throw Error(Et(25,!1,e));return $n(e).then((function(){var t=In.map($t).indexOf(e);In.splice(t,1)}))}function $n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof e)throw Error(Et(26,!1));var n=qt(In,(function(t){return $t(t)===e}));if(!n)throw Error(Et(27,!1,e));var r,o=Dn($t(n));if(t&&t.waitForUnmount){if(o)return o.promise;var i=new Promise((function(e,t){kn(n,(function(){return i}),e,t)}));return i}return o?(r=o.promise,Kn(n,o.resolve,o.reject)):r=new Promise((function(e,t){kn(n,(function(){return r}),e,t),Kn(n,e,t)})),r}function Kn(e,t,n){Ht(e).then(An).then((function(){t(),setTimeout((function(){Vn()}))})).catch(n)}function Ln(e){return!e||"function"==typeof e||"object"===mt(e)&&null!==e&&!Array.isArray(e)}function Fn(e,t){var n=function(e,t){var n=0,r=!1,o="^";"/"!==e[0]&&(e="/"+e);for(var i=0;i<e.length;i++){var s=e[i];(!r&&":"===s||r&&"/"===s)&&a(i)}return a(e.length),new RegExp(o,"i");function a(i){var s=e.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===e.length)if(r)t&&(o+="$");else{var a=t?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}r=!r,n=i}}(e,t);return function(e){var t=e.origin;t||(t="".concat(e.protocol,"//").concat(e.host));var r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}}var qn=!1,Wn=[],Gn=dn&&window.location.href;function zn(){return Vn()}function Vn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(qn)return new Promise((function(e,n){Wn.push({resolve:e,reject:n,eventArguments:t})}));var n,r=function(){var e=[],t=[],n=[],r=[],o=(new Date).getTime();return In.forEach((function(i){var s=i.status!==Bt&&Rt(i);switch(i.status){case Mt:s&&o-i.loadErrorTime>=200&&n.push(i);break;case Pt:case xt:s&&n.push(i);break;case At:case kt:!s&&Dn($t(i))?e.push(i):s&&r.push(i);break;case It:s||t.push(i)}})),{appsToUnload:e,appsToUnmount:t,appsToLoad:n,appsToMount:r}}(),o=r.appsToUnload,i=r.appsToUnmount,s=r.appsToLoad,a=r.appsToMount,u=!1,c=Gn,l=Gn=window.location.href;return Qn()?(qn=!0,n=o.concat(s,i,a),Promise.resolve().then((function(){if(window.dispatchEvent(new gt(0===n.length?"single-spa:before-no-app-change":"single-spa:before-app-change",d(!0))),window.dispatchEvent(new gt("single-spa:before-routing-event",d(!0,{cancelNavigation:f}))),u)return window.dispatchEvent(new gt("single-spa:before-mount-routing-event",d(!0))),h(),void vn(c);var t=o.map(An),r=i.map(Ht).map((function(e){return e.then(An)})).concat(t),l=Promise.all(r);l.then((function(){window.dispatchEvent(new gt("single-spa:before-mount-routing-event",d(!0)))}));var y=s.map((function(e){return hn(e).then((function(e){return Hn(e,l)}))})),m=a.filter((function(e){return s.indexOf(e)<0})).map((function(e){return Hn(e,l)}));return l.catch((function(e){throw p(),e})).then((function(){return p(),Promise.all(y.concat(m)).catch((function(t){throw e.forEach((function(e){return e.reject(t)})),t})).then(h)}))}))):(n=s,Promise.resolve().then((function(){var e=s.map(hn);return Promise.all(e).then(p).then((function(){return[]})).catch((function(e){throw p(),e}))})));function f(){u=!0}function h(){var t=Nn();e.forEach((function(e){return e.resolve(t)}));try{var r=0===n.length?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new gt(r,d())),window.dispatchEvent(new gt("single-spa:routing-event",d()))}catch(e){setTimeout((function(){throw e}))}if(qn=!1,Wn.length>0){var o=Wn;Wn=[],Vn(o)}return t}function p(){e.forEach((function(e){bn(e.eventArguments)})),bn(t)}function d(){var e,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],f=arguments.length>1?arguments[1]:void 0,h={},p=(vt(e={},It,[]),vt(e,kt,[]),vt(e,Pt,[]),vt(e,Bt,[]),e);r?(s.concat(a).forEach((function(e,t){y(e,It)})),o.forEach((function(e){y(e,Pt)})),i.forEach((function(e){y(e,kt)}))):n.forEach((function(e){y(e)}));var d={detail:{newAppStatuses:h,appsByNewStatus:p,totalAppChanges:n.length,originalEvent:null==t?void 0:t[0],oldUrl:c,newUrl:l,navigationIsCanceled:u}};return f&&Ft(d.detail,f),d;function y(e,t){var n=$t(e);t=t||Mn(n),h[n]=t,(p[t]=p[t]||[]).push(n)}}}function Hn(e,t){return Rt(e)?Vt(e).then((function(e){return t.then((function(){return Rt(e)?Qt(e):e}))})):t.then((function(){return e}))}var Yn=!1;function Jn(e){var t;Yn=!0,e&&e.urlRerouteOnly&&(t=e.urlRerouteOnly,pn=t),dn&&Vn()}function Qn(){return Yn}dn&&setTimeout((function(){Yn||console.warn(Et(1,!1))}),5e3);var Xn={getRawAppData:function(){return[].concat(In)},reroute:Vn,NOT_LOADED:Pt,toLoadPromise:hn,toBootstrapPromise:Vt,unregisterApplication:Rn};function Zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}dn&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Xn);const er=e=>{const t=e.concat(["openmrsBase","openmrsSpaBase"]);return De((e=>{if(!e||"string"!=typeof e)return!1;const n=/\${(.*?)}/g;let r=n.exec(e);for(;r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0}),"Should be a URL or path. The allowed template parameters are "+t.map((e=>"${"+e+"}")).join(", "))},tr={inRange:(e,t)=>De((n=>e<=n&&n<=t),`must be between ${e} and ${t}`),isUrl:er([]),isUrlWithTemplateParameters:er,oneOf:e=>De((t=>e.includes(t)),`Must be one of the following: '${e.join("', '")}'.`)};function nr(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function rr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const or="/ws/rest/v1/",ir="/ws/fhir2/R4",sr=`${or}session`;function ar(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function ur(e,t={}){if("string"!=typeof e)throw Error("The first argument to @openmrs/api's openmrsFetch function must be a url string");if("object"!=typeof t)throw Error("The second argument to @openmrs/api's openmrsFetch function must be a plain object.");if(!window.openmrsBase)throw Error("@openmrs/api is running in a browser that doesn't have window.openmrsBase, which is provided by openmrs-module-spa's HTML file.");let n=ar(e);if(t.headers||(t.headers={}),q(t.body)&&(t.body=JSON.stringify(t.body)),void 0===t.headers.Accept&&(t.headers.Accept="application/json"),null===t.headers.Accept&&delete t.headers.Accept,e.startsWith(or)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(ir)){const e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}const r=Error();return window.fetch(n,t).then((o=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){nr(i,r,o,s,a,"next",e)}function a(e){nr(i,r,o,s,a,"throw",e)}s(void 0)}))}}((function*(e){const t=e;if(t.ok)return 204===t.status?(t.data=null,t):t.clone().text().then((e=>{try{e&&(t.data=JSON.parse(e))}catch(e){}return t}));{const{redirectAuthFailure:e}=yield new Promise((e=>{const t=Fe("@openmrs/esm-api");function n(t){if(t.loaded&&t.config){const n=ve(["Display conditions","Translation overrides"],t.config);e(n),r&&r()}}n(t.getState());const r=t.subscribe(n)}));return n===ar(sr)&&403===t.status||e.enabled&&e.errors.includes(t.status)?(function({to:e,templateParams:t}){const n=window.getOpenmrsSpaBase().replace(/\/$/,""),r=function(e,t){const n=window.getOpenmrsSpaBase().replace(/\/$/,"");return function(e,t){return Object.keys(t).reduce(((e,n)=>e.split("${"+n+"}").join(t[n])),e)}(e,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Zn(e,t,n[t])}))}return e}({openmrsBase:window.openmrsBase,openmrsSpaBase:n},t)).replace(/^\/\//,"/")}(e,t);r.startsWith(n)?vn(r):window.location.assign(r)}({to:e.url}),e.resolvePromise?Promise.resolve():new Promise((()=>{}))):t.clone().text().then((e=>{let o=e;try{o=JSON.parse(e)}catch(e){}throw new lr(n,t,o,r)}),(e=>{throw new lr(n,t,null,r)}))}})),function(e){return o.apply(this,arguments)}));var o}function cr(e,t={}){if("object"!=typeof t)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");const n=new AbortController;return t.signal=n.signal,new E((r=>{let o=!1;return ur(e,t).then((e=>{o=!0,r.next(e),r.complete()}),(e=>{o=!0,r.error(e)})),()=>{o||n.abort()}}))}let lr=class extends Error{constructor(e,t,n,r){super(),rr(this,"response",void 0),rr(this,"responseBody",void 0),this.message=`Server responded with ${t.status} (${t.statusText}) for url ${e}. Check err.responseBody or network tab in dev tools for more info`,r.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:\n${r.stack}\nStacktrace for incoming response:\n${this.stack}`}};var fr=r(151);const hr=function(e){return void 0===e};function pr(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}const dr=(0,Re.createGlobalStore)("session",{loaded:!1,session:null});let yr=0;function mr(e={includeAuthStatus:!0}){return(yr<Date.now()-6e4||!dr.getState().loaded)&&br(),new E((t=>{const n=n=>{var r;n.loaded&&(e.includeAuthStatus?t.next(n.session):t.next(null===(r=n.session)||void 0===r?void 0:r.user))};return n(dr.getState()),dr.subscribe(n)}))}function vr(){return(yr<Date.now()-6e4||!dr.getState().loaded)&&br(),dr}function br(){return new Promise(((e,t)=>{yr=Date.now(),ur(sr).then((n=>{if("object"!=typeof(null==n?void 0:n.data))return t(),Promise.reject();!function(e){var t,n,r;const o=null!==(r=null==e||null===(t=e.user)||void 0===t||null===(n=t.userProperties)||void 0===n?void 0:n.defaultLocale)&&void 0!==r?r:e.locale;o!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",o)}(n.data),e(n.data),dr.setState({loaded:!0,session:n.data})})).catch((e=>((0,fr.reportError)(`Failed to fetch new session information: ${e}`),t(e),{sessionId:"",authenticated:!1})))}))}function gr(){dr.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function wr(e,t){return void 0===t?Boolean(e):!Boolean(e)||function(e,t){return"string"==typeof e?!hr(t.privileges.find((t=>e===t.display))):Array.isArray(e)?e.every((e=>!hr(t.privileges.find((t=>e===t.display))))):(hr(e)||console.error(`Could not understand privileges "${e}"`),!0)}(e,t)||function(e){return!hr(e.roles.find((e=>"System Developer"===e.display)))}(t)}function _r(){let e,t;return new Promise(((n,r)=>{const o=r=>{r.loaded&&r.session.user&&(e=r.session.user,n(r.session.user),t&&t())};o(dr.getState()),e||(t=dr.subscribe(o))}))}function Or(){return new Promise(((e,t)=>{mr().subscribe((t=>{e(t.sessionLocation)}),t).unsubscribe()}))}function Sr(e,t){return Er.apply(this,arguments)}function Er(){return Er=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){pr(i,r,o,s,a,"next",e)}function a(e){pr(i,r,o,s,a,"throw",e)}s(void 0)}))}}((function*(e,t){yield ur(sr,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:t.signal}),yield br()})),Er.apply(this,arguments)}function jr(){!function(e,t){nt(e,t);const n=me(t,dt),r=$e.getState();$e.setState({schemas:ze(Ge({},r.schemas),{[e]:n})})}("@openmrs/esm-api",{redirectAuthFailure:{enabled:{_type:ke.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:ke.String,_default:"${openmrsSpaBase}/login",_validators:[tr.isUrl]},errors:{_type:ke.Array,_default:[401],_elements:{_type:ke.Number,_validators:[tr.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:ke.Boolean,_default:!1,_description:"Changes how requests that fail authentication are handled. Try messing with this if redirects to the login page aren't working correctly."}}}),br()}try{self["workbox:window:6.5.3"]&&_()}catch(mt){}function Pr(e,t){return new Promise((function(n){var r=new MessageChannel;r.port1.onmessage=function(e){n(e.data)},e.postMessage(t,[r.port2])}))}function xr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}try{self["workbox:core:6.5.3"]&&_()}catch(mt){}var Ar=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))};function Tr(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var kr=function(e,t){this.type=e,Object.assign(this,t)};function Dr(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function Ir(){}var Nr={type:"SKIP_WAITING"};function Cr(e,t){if(!t)return e&&e.then?e.then(Ir):Promise.resolve()}!function(e){var t,n;function r(t,n){var r,o;return void 0===n&&(n={}),(r=e.call(this)||this).nn={},r.tn=0,r.rn=new Ar,r.en=new Ar,r.on=new Ar,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!Tr(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener("updatefound",r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener("statechange",r.ln)},r.ln=function(e){var t=r.fn,n=e.target,o=n.state,i=n===r.vn,s={sw:n,isExternal:i,originalEvent:e};!i&&r.mn&&(s.isUpdate=!0),r.dispatchEvent(new kr(o,s)),"installed"===o?r.wn=self.setTimeout((function(){"installed"===o&&t.waiting===n&&r.dispatchEvent(new kr("waiting",s))}),200):"activating"===o&&(clearTimeout(r.wn),i||r.en.resolve(n))},r.dn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new kr("controlling",{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},r.gn=(o=function(e){var t=e.data,n=e.ports,o=e.source;return Dr(r.getSW(),(function(){r.an.has(o)&&r.dispatchEvent(new kr("message",{data:t,originalEvent:e,ports:n,sw:o}))}))},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(o.apply(this,e))}catch(e){return Promise.reject(e)}}),r.sn=t,r.nn=n,navigator.serviceWorker.addEventListener("message",r.gn),r}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o,i=r.prototype;i.register=function(e){var t=(void 0===e?{}:e).immediate,n=void 0!==t&&t;try{var r=this;return function(e,t){var n=e();return n&&n.then?n.then(t):t()}((function(){if(!n&&"complete"!==document.readyState)return Cr(new Promise((function(e){return window.addEventListener("load",e)})))}),(function(){return r.mn=Boolean(navigator.serviceWorker.controller),r.yn=r.pn(),Dr(r.bn(),(function(e){r.fn=e,r.yn&&(r.hn=r.yn,r.en.resolve(r.yn),r.on.resolve(r.yn),r.yn.addEventListener("statechange",r.ln,{once:!0}));var t=r.fn.waiting;return t&&Tr(t.scriptURL,r.sn.toString())&&(r.hn=t,Promise.resolve().then((function(){r.dispatchEvent(new kr("waiting",{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),r.hn&&(r.rn.resolve(r.hn),r.an.add(r.hn)),r.fn.addEventListener("updatefound",r.cn),navigator.serviceWorker.addEventListener("controllerchange",r.dn),r.fn}))}))}catch(e){return Promise.reject(e)}},i.update=function(){try{return this.fn?Cr(this.fn.update()):void 0}catch(e){return Promise.reject(e)}},i.getSW=function(){return void 0!==this.hn?Promise.resolve(this.hn):this.rn.promise},i.messageSW=function(e){try{return Dr(this.getSW(),(function(t){return Pr(t,e)}))}catch(e){return Promise.reject(e)}},i.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&Pr(this.fn.waiting,Nr)},i.pn=function(){var e=navigator.serviceWorker.controller;return e&&Tr(e.scriptURL,this.sn.toString())?e:void 0},i.bn=function(){try{var e=this;return function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){return Dr(navigator.serviceWorker.register(e.sn,e.nn),(function(t){return e.un=performance.now(),t}))}),(function(e){throw e}))}catch(e){return Promise.reject(e)}},(o=[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,o)}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.Sn(e).add(t)},t.removeEventListener=function(e,t){this.Sn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return xr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xr(e,t):void 0}}(e))){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(this.Sn(e.type));!(t=n()).done;)(0,t.value)(e)},t.Sn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());const Mr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Br=Object.keys,Ur=Array.isArray;function Rr(e,t){return"object"!=typeof t||Br(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||Mr.Promise||(Mr.Promise=Promise);const $r=Object.getPrototypeOf,Kr={}.hasOwnProperty;function Lr(e,t){return Kr.call(e,t)}function Fr(e,t){"function"==typeof t&&(t=t($r(e))),("undefined"==typeof Reflect?Br:Reflect.ownKeys)(t).forEach((n=>{Wr(e,n,t[n])}))}const qr=Object.defineProperty;function Wr(e,t,n,r){qr(e,t,Rr(n&&Lr(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function Gr(e){return{from:function(t){return e.prototype=Object.create(t.prototype),Wr(e.prototype,"constructor",e),{extend:Fr.bind(null,e.prototype)}}}}const zr=Object.getOwnPropertyDescriptor;function Vr(e,t){let n;return zr(e,t)||(n=$r(e))&&Vr(n,t)}const Hr=[].slice;function Yr(e,t,n){return Hr.call(e,t,n)}function Jr(e,t){return t(e)}function Qr(e){if(!e)throw new Error("Assertion Failed")}function Xr(e){Mr.setImmediate?setImmediate(e):setTimeout(e,0)}function Zr(e,t){return e.reduce(((e,n,r)=>{var o=t(n,r);return o&&(e[o[0]]=o[1]),e}),{})}function eo(e,t){if(Lr(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,o=t.length;r<o;++r){var i=eo(e,t[r]);n.push(i)}return n}var s=t.indexOf(".");if(-1!==s){var a=e[t.substr(0,s)];return void 0===a?void 0:eo(a,t.substr(s+1))}}function to(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){Qr("string"!=typeof n&&"length"in n);for(var r=0,o=t.length;r<o;++r)to(e,t[r],n[r])}else{var i=t.indexOf(".");if(-1!==i){var s=t.substr(0,i),a=t.substr(i+1);if(""===a)void 0===n?Ur(e)&&!isNaN(parseInt(s))?e.splice(s,1):delete e[s]:e[s]=n;else{var u=e[s];u&&Lr(e,s)||(u=e[s]={}),to(u,a,n)}}else void 0===n?Ur(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function no(e){var t={};for(var n in e)Lr(e,n)&&(t[n]=e[n]);return t}const ro=[].concat;function oo(e){return ro.apply([],e)}const io="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(oo([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>Mr[e])),so=io.map((e=>Mr[e]));Zr(io,(e=>[e,!0]));let ao=null;function uo(e){ao="undefined"!=typeof WeakMap&&new WeakMap;const t=co(e);return ao=null,t}function co(e){if(!e||"object"!=typeof e)return e;let t=ao&&ao.get(e);if(t)return t;if(Ur(e)){t=[],ao&&ao.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(co(e[n]))}else if(so.indexOf(e.constructor)>=0)t=e;else{const n=$r(e);for(var o in t=n===Object.prototype?{}:Object.create(n),ao&&ao.set(e,t),e)Lr(e,o)&&(t[o]=co(e[o]))}return t}const{toString:lo}={};function fo(e){return lo.call(e).slice(8,-1)}const ho="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",po="symbol"==typeof ho?function(e){var t;return null!=e&&(t=e[ho])&&t.apply(e)}:function(){return null},yo={};function mo(e){var t,n,r,o;if(1===arguments.length){if(Ur(e))return e.slice();if(this===yo&&"string"==typeof e)return[e];if(o=po(e)){for(n=[];!(r=o.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}const vo="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var bo="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function go(e,t){bo=e,wo=t}var wo=()=>!0;const _o=!new Error("").stack;function Oo(){if(_o)try{throw Oo.arguments,new Error}catch(e){return e}return new Error}function So(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(wo).map((e=>"\n"+e)).join("")):""}var Eo=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],jo=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Eo),Po={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 xo(e,t){this._e=Oo(),this.name=e,this.message=t}function Ao(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function To(e,t,n,r){this._e=Oo(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Ao(e,t)}function ko(e,t){this._e=Oo(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=Ao(e,t)}Gr(xo).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+So(this._e,2))}},toString:function(){return this.name+": "+this.message}}),Gr(To).from(xo),Gr(ko).from(xo);var Do=jo.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const Io=xo;var No=jo.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=Oo(),this.name=n,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=Po[t]||n,this.inner=null)}return Gr(r).from(Io),e[t]=r,e}),{});No.Syntax=SyntaxError,No.Type=TypeError,No.Range=RangeError;var Co=Eo.reduce(((e,t)=>(e[t+"Error"]=No[t],e)),{}),Mo=jo.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=No[t]),e)),{});function Bo(){}function Uo(e){return e}function Ro(e,t){return null==e||e===Uo?t:function(n){return t(e(n))}}function $o(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Ko(e,t){return e===Bo?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?$o(r,this.onsuccess):r),o&&(this.onerror=this.onerror?$o(o,this.onerror):o),void 0!==i?i:n}}function Lo(e,t){return e===Bo?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?$o(n,this.onsuccess):n),r&&(this.onerror=this.onerror?$o(r,this.onerror):r)}}function Fo(e,t){return e===Bo?t:function(n){var r=e.apply(this,arguments);Rr(n,r);var o=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var s=t.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?$o(o,this.onsuccess):o),i&&(this.onerror=this.onerror?$o(i,this.onerror):i),void 0===r?void 0===s?void 0:s:Rr(r,s)}}function qo(e,t){return e===Bo?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function Wo(e,t){return e===Bo?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,o=arguments.length,i=new Array(o);o--;)i[o]=arguments[o];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}Mo.ModifyError=To,Mo.DexieError=xo,Mo.BulkError=ko;var Go={};const[zo,Vo,Ho]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,$r(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,$r(t),e]})(),Yo=Vo&&Vo.then,Jo=zo&&zo.constructor,Qo=!!Ho;var Xo=!1,Zo=Ho?()=>{Ho.then(Oi)}:Mr.setImmediate?setImmediate.bind(null,Oi):Mr.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Oi(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Oi,0)},ei=function(e,t){ci.push([e,t]),ni&&(Zo(),ni=!1)},ti=!0,ni=!0,ri=[],oi=[],ii=null,si=Uo,ai={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:zi,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{zi(e[0],e[1])}catch(e){}}))}},ui=ai,ci=[],li=0,fi=[];function hi(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Bo,this._lib=!1;var t=this._PSD=ui;if(bo&&(this._stackHolder=Oo(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==Go)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&mi(this,this._value))}this._state=null,this._value=null,++t.ref,yi(this,e)}const pi={get:function(){var e=ui,t=Ii;function n(n,r){var o=!e.global&&(e!==ui||t!==Ii);const i=o&&!Bi();var s=new hi(((t,s)=>{bi(this,new di(Wi(n,e,o,i),Wi(r,e,o,i),t,s,e))}));return bo&&_i(s,this),s}return n.prototype=Go,n},set:function(e){Wr(this,"then",e&&e.prototype===Go?pi:{get:function(){return e},set:pi.set})}};function di(e,t,n,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=o}function yi(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Si();t&&"function"==typeof t.then?yi(e,((e,n)=>{t instanceof hi?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,vi(e)),n&&Ei()}}),mi.bind(null,e))}catch(t){mi(e,t)}}function mi(e,t){if(oi.push(t),null===e._state){var n=e._lib&&Si();t=si(t),e._state=!1,e._value=t,bo&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=Vr(t,"stack");t._promise=e,Wr(t,"stack",{get:()=>Xo?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ri.some((t=>t._value===e._value))||ri.push(e)}(e),vi(e),n&&Ei()}}function vi(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)bi(e,t[n]);var o=e._PSD;--o.ref||o.finalize(),0===li&&(++li,ei((()=>{0==--li&&ji()}),[]))}function bi(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++li,ei(gi,[n,e,t])}else e._listeners.push(t)}function gi(e,t,n){try{ii=t;var r,o=t._value;t._state?r=e(o):(oi.length&&(oi=[]),r=e(o),-1===oi.indexOf(o)&&function(e){for(var t=ri.length;t;)if(ri[--t]._value===e._value)return void ri.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{ii=null,0==--li&&ji(),--n.psd.ref||n.psd.finalize()}}function wi(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var o,i,s=e._value;null!=s?(o=s.name||"Error",i=s.message||s,r=So(s,0)):(o=s,i=""),t.push(o+(i?": "+i:"")+r)}return bo&&((r=So(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&wi(e._prev,t,n)),t}function _i(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Oi(){Si()&&Ei()}function Si(){var e=ti;return ti=!1,ni=!1,e}function Ei(){var e,t,n;do{for(;ci.length>0;)for(e=ci,ci=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(ci.length>0);ti=!0,ni=!0}function ji(){var e=ri;ri=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=fi.slice(0),n=t.length;n;)t[--n]()}function Pi(e){return new hi(Go,!1,e)}function xi(e,t){var n=ui;return function(){var r=Si(),o=ui;try{return Ki(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{Ki(o,!1),r&&Ei()}}}Fr(hi.prototype,{then:pi,_then:function(e,t){bi(this,new di(null,null,e,t,ui))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,(e=>e instanceof t?n(e):Pi(e))):this.then(null,(e=>e&&e.name===t?n(e):Pi(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Pi(t))))},stack:{get:function(){if(this._stack)return this._stack;try{Xo=!0;var e=wi(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{Xo=!1}}},timeout:function(e,t){return e<1/0?new hi(((n,r)=>{var o=setTimeout((()=>r(new No.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&Wr(hi.prototype,Symbol.toStringTag,"Dexie.Promise"),ai.env=Li(),Fr(hi,{all:function(){var e=mo.apply(null,arguments).map(Ui);return new hi((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((o,i)=>hi.resolve(o).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof hi)return e;if(e&&"function"==typeof e.then)return new hi(((t,n)=>{e.then(t,n)}));var t=new hi(Go,!0,e);return _i(t,ii),t},reject:Pi,race:function(){var e=mo.apply(null,arguments).map(Ui);return new hi(((t,n)=>{e.map((e=>hi.resolve(e).then(t,n)))}))},PSD:{get:()=>ui,set:e=>ui=e},totalEchoes:{get:()=>Ii},newPSD:Ci,usePSD:Fi,scheduler:{get:()=>ei,set:e=>{ei=e}},rejectionMapper:{get:()=>si,set:e=>{si=e}},follow:(e,t)=>new hi(((n,r)=>Ci(((t,n)=>{var r=ui;r.unhandleds=[],r.onunhandled=n,r.finalize=$o((function(){!function(e){fi.push((function t(){e(),fi.splice(fi.indexOf(t),1)})),++li,ei((()=>{0==--li&&ji()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),Jo&&(Jo.allSettled&&Wr(hi,"allSettled",(function(){const e=mo.apply(null,arguments).map(Ui);return new hi((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,o)=>hi.resolve(e).then((e=>r[o]={status:"fulfilled",value:e}),(e=>r[o]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),Jo.any&&"undefined"!=typeof AggregateError&&Wr(hi,"any",(function(){const e=mo.apply(null,arguments).map(Ui);return new hi(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const o=new Array(r);e.forEach(((e,i)=>hi.resolve(e).then((e=>t(e)),(e=>{o[i]=e,--r||n(new AggregateError(o))}))))}))})));const Ai={awaits:0,echoes:0,id:0};var Ti=0,ki=[],Di=0,Ii=0,Ni=0;function Ci(e,t,n,r){var o=ui,i=Object.create(o);i.parent=o,i.ref=0,i.global=!1,i.id=++Ni;var s=ai.env;i.env=Qo?{Promise:hi,PromiseProp:{value:hi,configurable:!0,writable:!0},all:hi.all,race:hi.race,allSettled:hi.allSettled,any:hi.any,resolve:hi.resolve,reject:hi.reject,nthen:Gi(s.nthen,i),gthen:Gi(s.gthen,i)}:{},t&&Rr(i,t),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=Fi(i,e,n,r);return 0===i.ref&&i.finalize(),a}function Mi(){return Ai.id||(Ai.id=++Ti),++Ai.awaits,Ai.echoes+=100,Ai.id}function Bi(){return!!Ai.awaits&&(0==--Ai.awaits&&(Ai.id=0),Ai.echoes=100*Ai.awaits,!0)}function Ui(e){return Ai.echoes&&e&&e.constructor===Jo?(Mi(),e.then((e=>(Bi(),e)),(e=>(Bi(),Vi(e))))):e}function Ri(e){++Ii,Ai.echoes&&0!=--Ai.echoes||(Ai.echoes=Ai.id=0),ki.push(ui),Ki(e,!0)}function $i(){var e=ki[ki.length-1];ki.pop(),Ki(e,!1)}function Ki(e,t){var n=ui;if((t?!Ai.echoes||Di++&&e===ui:!Di||--Di&&e===ui)||qi(t?Ri.bind(null,e):$i),e!==ui&&(ui=e,n===ai&&(ai.env=Li()),Qo)){var r=ai.env.Promise,o=e.env;Vo.then=o.nthen,r.prototype.then=o.gthen,(n.global||e.global)&&(Object.defineProperty(Mr,"Promise",o.PromiseProp),r.all=o.all,r.race=o.race,r.resolve=o.resolve,r.reject=o.reject,o.allSettled&&(r.allSettled=o.allSettled),o.any&&(r.any=o.any))}}function Li(){var e=Mr.Promise;return Qo?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(Mr,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:Vo.then,gthen:e.prototype.then}:{}}function Fi(e,t,n,r,o){var i=ui;try{return Ki(e,!0),t(n,r,o)}finally{Ki(i,!1)}}function qi(e){Yo.call(zo,e)}function Wi(e,t,n,r){return"function"!=typeof e?e:function(){var o=ui;n&&Mi(),Ki(t,!0);try{return e.apply(this,arguments)}finally{Ki(o,!1),r&&qi(Bi)}}}function Gi(e,t){return function(n,r){return e.call(this,Wi(n,t),Wi(r,t))}}function zi(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,o={promise:t,reason:e};if(Mr.document&&document.createEvent?((r=document.createEvent("Event")).initEvent("unhandledrejection",!0,!0),Rr(r,o)):Mr.CustomEvent&&Rr(r=new CustomEvent("unhandledrejection",{detail:o}),o),r&&Mr.dispatchEvent&&(dispatchEvent(r),!Mr.PromiseRejectionEvent&&Mr.onunhandledrejection))try{Mr.onunhandledrejection(r)}catch(e){}bo&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}-1===(""+Yo).indexOf("[native code]")&&(Mi=Bi=Bo);var Vi=hi.reject;function Hi(e,t,n,r){if(e.idbdb&&(e._state.openComplete||ui.letThrough||e._vip)){var o=e._createTransaction(t,n,e._dbSchema);try{o.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===Do.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Hi(e,t,n,r)))):Vi(o)}return o._promise(t,((e,t)=>Ci((()=>(ui.trans=o,r(e,t,o)))))).then((e=>o._completion.then((()=>e))))}if(e._state.openComplete)return Vi(new No.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return Vi(new No.DatabaseClosed);e.open().catch(Bo)}return e._state.dbReadyPromise.then((()=>Hi(e,t,n,r)))}const Yi=String.fromCharCode(65535),Ji="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Qi=[],Xi="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Zi=Xi,es=Xi,ts=e=>!/(dexie\.js|dexie\.min\.js)/.test(e);function ns(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const rs={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function os(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=uo(t))[e],t)}let is=class{_trans(e,t,n){const r=this._tx||ui.trans,o=this.name;function i(e,n,r){if(!r.schema[o])throw new No.NotFound("Table "+o+" not part of transaction");return t(r.idbtrans,r)}const s=Si();try{return r&&r.db===this.db?r===ui.trans?r._promise(e,i,n):Ci((()=>r._promise(e,i,n)),{trans:r,transless:ui.transless||ui}):Hi(this.db,e,[this.name],i)}finally{s&&Ei()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(Ur(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=Br(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const n=this.schema.indexes.concat(this.schema.primKey).filter((e=>e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))&&e.keyPath.every((e=>t.indexOf(e)>=0))))[0];if(n&&this.db._maxKey!==Yi)return this.where(n.name).equals(n.keyPath.map((t=>e[t])));!n&&bo&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:r}=this.schema,o=this.db._deps.indexedDB;function i(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[s,a]=t.reduce((([t,n],o)=>{const s=r[o],a=e[o];return[t||s,t||!s?ns(n,s&&s.multi?e=>{const t=eo(e,o);return Ur(t)&&t.some((e=>i(a,e)))}:e=>i(a,eo(e,o))):n]}),[null,null]);return s?this.where(s.name).equals(e[s.keyPath]).filter(a):n?this.filter(a):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,Ur(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(Lr(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){Rr(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let o=e;return r&&n&&(o=os(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[o]}))).then((e=>e.numFailures?hi.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{to(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||Ur(e))return this.where(":id").equals(e).modify(t);{const n=eo(e,this.schema.primKey.keyPath);if(void 0===n)return Vi(new No.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?Br(t).forEach((n=>{to(e,n,t[n])})):t(e,{value:e,primKey:n})}catch(e){}return this.where(":id").equals(n).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let o=e;return r&&n&&(o=os(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[o],keys:null!=t?[t]:null}))).then((e=>e.numFailures?hi.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{to(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?hi.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:rs}))).then((e=>e.numFailures?hi.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,o=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new No.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new No.InvalidArgument("Arguments objects and keys must have the same length");const s=e.length;let a=i&&n?e.map(os(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:o}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return o?t:n;throw new ko(`${this.name}.bulkAdd(): ${e} of ${s} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,o=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new No.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new No.InvalidArgument("Arguments objects and keys must have the same length");const s=e.length;let a=i&&n?e.map(os(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:o}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return o?t:n;throw new ko(`${this.name}.bulkPut(): ${e} of ${s} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new ko(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}};function ss(e){var t={},n=function(n,r){if(r){for(var o=arguments.length,i=new Array(o-1);--o;)i[o-1]=arguments[o];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};n.addEventType=i;for(var r=1,o=arguments.length;r<o;++r)i(arguments[r]);return n;function i(e,r,o){if("object"==typeof e)return function(e){Br(e).forEach((function(t){var n=e[t];if(Ur(n))i(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new No.InvalidArgument("Invalid event config");var r=i(t,Uo,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach((function(e){Xr((function(){e.apply(null,t)}))}))}))}}))}(e);r||(r=qo),o||(o=Bo);var s={subscribers:[],fire:o,subscribe:function(e){-1===s.subscribers.indexOf(e)&&(s.subscribers.push(e),s.fire=r(s.fire,e))},unsubscribe:function(e){s.subscribers=s.subscribers.filter((function(t){return t!==e})),s.fire=s.subscribers.reduce(r,o)}};return t[e]=n[e]=s,s}}function as(e,t){return Gr(t).from({prototype:e}),t}function us(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function cs(e,t){e.filter=ns(e.filter,t)}function ls(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>ns(r(),t()):t,e.justLimit=n&&!r}function fs(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new No.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function hs(e,t,n){const r=fs(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function ps(e,t,n,r){const o=e.replayFilter?ns(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},s=(e,n,r)=>{if(!o||o(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var s=n.primaryKey,a=""+s;"[object ArrayBuffer]"===a&&(a=""+new Uint8Array(s)),Lr(i,a)||(i[a]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(s,n),ds(hs(e,r,n),e.algorithm,s,!e.keysOnly&&e.valueMapper)])}return ds(hs(e,r,n),ns(e.algorithm,o),t,!e.keysOnly&&e.valueMapper)}function ds(e,t,n,r){var o=xi(r?(e,t,o)=>n(r(e),t,o):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=Bo}),(t=>{e.fail(t),n=Bo}))||o(e.value,e,(e=>n=e)),n()}))}))}function ys(e,t){try{const n=ms(e),r=ms(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(e,t){const n=e.length,r=t.length,o=n<r?n:r;for(let n=0;n<o;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(vs(e),vs(t));case"Array":return function(e,t){const n=e.length,r=t.length,o=n<r?n:r;for(let n=0;n<o;++n){const r=ys(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function ms(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=fo(e);return"ArrayBuffer"===n?"binary":n}function vs(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}let bs=class{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,Vi.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,Vi.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=ns(t.algorithm,e)}_iterate(e,t){return ps(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&Rr(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>ps(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(us(t,!0))return n.count({trans:e,query:{index:fs(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return ps(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],o=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var s="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,o),r=i(t,o);return n<r?-s:n>r?s:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&us(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=fs(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return ps(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,us(t)?ls(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):ls(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),ls(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return cs(this._ctx,(function(n,r,o){return!e(n.value)||(r(o),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return cs(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=ns(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&us(t,!0)&&t.limit>0)return this._read((e=>{var n=fs(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return cs(this._ctx,(function(e){var t=e.primaryKey.toString(),r=Lr(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((n=>{var r;if("function"==typeof e)r=e;else{var o=Br(e),i=o.length;r=function(t){for(var n=!1,r=0;r<i;++r){var s=o[r],a=e[s];eo(t,s)!==a&&(to(t,s,a),n=!0)}return n}}const s=t.table.core,{outbound:a,extractKey:u}=s.schema.primaryKey,c=this.db._options.modifyChunkSize||200,l=[];let f=0;const h=[],p=(e,t)=>{const{failures:n,numFailures:r}=t;f+=e-r;for(let e of Br(n))l.push(n[e])};return this.clone().primaryKeys().then((o=>{const i=l=>{const f=Math.min(c,o.length-l);return s.getMany({trans:n,keys:o.slice(l,l+f),cache:"immutable"}).then((h=>{const d=[],y=[],m=a?[]:null,v=[];for(let e=0;e<f;++e){const t=h[e],n={value:uo(t),primKey:o[l+e]};!1!==r.call(n,n.value,n)&&(null==n.value?v.push(o[l+e]):a||0===ys(u(t),u(n.value))?(y.push(n.value),a&&m.push(o[l+e])):(v.push(o[l+e]),d.push(n.value)))}const b=us(t)&&t.limit===1/0&&("function"!=typeof e||e===gs)&&{index:t.index,range:t.range};return Promise.resolve(d.length>0&&s.mutate({trans:n,type:"add",values:d}).then((e=>{for(let t in e.failures)v.splice(parseInt(t),1);p(d.length,e)}))).then((()=>(y.length>0||b&&"object"==typeof e)&&s.mutate({trans:n,type:"put",keys:m,values:y,criteria:b,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(v.length>0||b&&e===gs)&&s.mutate({trans:n,type:"delete",keys:v,criteria:b}).then((e=>p(v.length,e))))).then((()=>o.length>l+f&&i(l+c)))}))};return i(0).then((()=>{if(l.length>0)throw new To("Error modifying one or more objects",l,f,h);return o.length}))}))}))}delete(){var e=this._ctx,t=e.range;return us(e)&&(e.isPrimKey&&!es||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,o=t;return e.table.core.count({trans:n,query:{index:r,range:o}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:o}).then((({failures:e,lastResult:n,results:r,numFailures:o})=>{if(o)throw new To("Could not delete some values",Object.keys(e).map((t=>e[t])),t-o);return t-o}))))})):this.modify(gs)}};const gs=(e,t)=>t.value=null;function ws(e,t){return e<t?-1:e===t?0:1}function _s(e,t){return e>t?-1:e===t?0:1}function Os(e,t,n){var r=e instanceof As?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Ss(e){return new e.Collection(e,(()=>xs(""))).limit(0)}function Es(e,t,n,r,o,i){for(var s=Math.min(e.length,r.length),a=-1,u=0;u<s;++u){var c=t[u];if(c!==r[u])return o(e[u],n[u])<0?e.substr(0,u)+n[u]+n.substr(u+1):o(e[u],r[u])<0?e.substr(0,u)+r[u]+n.substr(u+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;o(e[u],c)<0&&(a=u)}return s<r.length&&"next"===i?e+n.substr(e.length):s<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function js(e,t,n,r){var o,i,s,a,u,c,l,f=n.length;if(!n.every((e=>"string"==typeof e)))return Os(e,"String expected.");function h(e){o=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),s="next"===e?ws:_s;var t=n.map((function(e){return{lower:i(e),upper:o(e)}})).sort((function(e,t){return s(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),u=t.map((function(e){return e.lower})),c=e,l="next"===e?"":r}h("next");var p=new e.Collection(e,(()=>Ps(a[0],u[f-1]+r)));p._ondirectionchange=function(e){h(e)};var d=0;return p._addAlgorithm((function(e,n,r){var o=e.key;if("string"!=typeof o)return!1;var h=i(o);if(t(h,u,d))return!0;for(var p=null,y=d;y<f;++y){var m=Es(o,h,a[y],u[y],s,c);null===m&&null===p?d=y+1:(null===p||s(p,m)>0)&&(p=m)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),p}function Ps(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function xs(e){return{type:1,lower:e,upper:e}}let As=class{get Collection(){return this._ctx.table.db.Collection}between(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Ss(this):new this.Collection(this,(()=>Ps(e,t,!n,!r)))}catch(e){return Os(this,Ji)}}equals(e){return null==e?Os(this,Ji):new this.Collection(this,(()=>xs(e)))}above(e){return null==e?Os(this,Ji):new this.Collection(this,(()=>Ps(e,void 0,!0)))}aboveOrEqual(e){return null==e?Os(this,Ji):new this.Collection(this,(()=>Ps(e,void 0,!1)))}below(e){return null==e?Os(this,Ji):new this.Collection(this,(()=>Ps(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Os(this,Ji):new this.Collection(this,(()=>Ps(void 0,e)))}startsWith(e){return"string"!=typeof e?Os(this,"String expected."):this.between(e,e+Yi,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):js(this,((e,t)=>0===e.indexOf(t[0])),[e],Yi)}equalsIgnoreCase(e){return js(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=mo.apply(yo,arguments);return 0===e.length?Ss(this):js(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=mo.apply(yo,arguments);return 0===e.length?Ss(this):js(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,Yi)}anyOf(){const e=mo.apply(yo,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Os(this,Ji)}if(0===e.length)return Ss(this);const n=new this.Collection(this,(()=>Ps(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,o,i)=>{const s=n.key;for(;t(s,e[r])>0;)if(++r,r===e.length)return o(i),!1;return 0===t(s,e[r])||(o((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=mo.apply(yo,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Os(this,Ji)}const t=e.reduce(((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,o=this._descending,i=this._min,s=this._max;if(0===e.length)return Ss(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Os(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",No.InvalidArgument);const a=!t||!1!==t.includeLowers,u=t&&!0===t.includeUppers;let c,l=r;function f(e,t){return l(e[0],t[0])}try{c=e.reduce((function(e,t){let r=0,o=e.length;for(;r<o;++r){const o=e[r];if(n(t[0],o[1])<0&&n(t[1],o[0])>0){o[0]=i(o[0],t[0]),o[1]=s(o[1],t[1]);break}}return r===o&&e.push(t),e}),[]),c.sort(f)}catch(e){return Os(this,Ji)}let h=0;const p=u?e=>r(e,c[h][1])>0:e=>r(e,c[h][1])>=0,d=a?e=>o(e,c[h][0])>0:e=>o(e,c[h][0])>=0;let y=p;const m=new this.Collection(this,(()=>Ps(c[0][0],c[c.length-1][1],!a,!u)));return m._ondirectionchange=e=>{"next"===e?(y=p,l=r):(y=d,l=o),c.sort(f)},m._addAlgorithm(((e,t,n)=>{for(var o=e.key;y(o);)if(++h,h===c.length)return t(n),!1;return!!function(e){return!p(e)&&!d(e)}(o)||(0===this._cmp(o,c[h][1])||0===this._cmp(o,c[h][0])||t((()=>{l===r?e.continue(c[h][0]):e.continue(c[h][1])})),!1)})),m}startsWithAnyOf(){const e=mo.apply(yo,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Ss(this):this.inAnyRange(e.map((e=>[e,e+Yi]))):Os(this,"startsWithAnyOf() only works with strings")}};function Ts(e){return xi((function(t){return ks(t),e(t.target.error),!1}))}function ks(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const Ds=ss(null,"storagemutated");let Is=class{_lock(){return Qr(!ui.global),++this._reculock,1!==this._reculock||ui.global||(ui.lockOwnerFor=this),this}_unlock(){if(Qr(!ui.global),0==--this._reculock)for(ui.global||(ui.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Fi(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&ui.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(Qr(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new No.DatabaseClosed(n);case"MissingAPIError":throw new No.MissingAPI(n.message,n);default:throw new No.OpenFailed(n)}if(!this.active)throw new No.TransactionInactive;return Qr(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=xi((t=>{ks(t),this._reject(e.error)})),e.onabort=xi((t=>{ks(t),this.active&&this._reject(new No.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=xi((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&Ds.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return Vi(new No.ReadOnly("Transaction is readonly"));if(!this.active)return Vi(new No.TransactionInactive);if(this._locked())return new hi(((r,o)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,o)},ui])}));if(n)return Ci((()=>{var e=new hi(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new hi(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=hi.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>n));else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var o=t._waitingFor;return new hi(((e,r)=>{n.then((n=>t._waitingQueue.push(xi(e.bind(null,n)))),(e=>t._waitingQueue.push(xi(r.bind(null,e))))).finally((()=>{t._waitingFor===o&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new No.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(Lr(t,e))return t[e];const n=this.schema[e];if(!n)throw new No.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}};function Ns(e,t,n,r,o,i,s){return{name:e,keyPath:t,unique:n,multi:r,auto:o,compound:i,src:(n&&!s?"&":"")+(r?"*":"")+(o?"++":"")+Cs(t)}}function Cs(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Ms(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:Zr(n,(e=>[e.name,e]))}}let Bs=e=>{try{return e.only([[]]),Bs=()=>[[]],[[]]}catch(e){return Bs=()=>Yi,Yi}};function Us(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>eo(t,e)}(e):t=>eo(t,e)}function Rs(e){return[].slice.call(e)}let $s=0;function Ks(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function Ls({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},i){const s=function(e,t){return t.reduce(((e,{create:t})=>o({},e,t(e))),e)}(function(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:o,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!o):t.bound(n,r,!!o,!!i)}const{schema:o,hasGetAll:i}=function(e,t){const n=Rs(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,r=Ur(t),o=null==t,i={},s={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:o,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Us(t)},indexes:Rs(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:r,keyPath:o}=e,s={name:t,compound:Ur(o),keyPath:o,unique:n,multiEntry:r,extractKey:Us(o)};return i[Ks(o)]=s,s})),getIndexByKeyPath:e=>i[Ks(e)]};return i[":id"]=s.primaryKey,null!=t&&(i[Ks(t)]=s.primaryKey),s}))},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,n),s=o.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:o,values:i,range:s}){return new Promise(((a,u)=>{a=xi(a);const c=e.objectStore(t),l=null==c.keyPath,f="put"===n||"add"===n;if(!f&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:h}=o||i||{length:1};if(o&&i&&o.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===h)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let p;const d=[],y=[];let m=0;const v=e=>{++m,ks(e)};if("deleteRange"===n){if(4===s.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===s.type?d.push(p=c.clear()):d.push(p=c.delete(r(s)))}else{const[e,t]=f?l?[i,o]:[i,null]:[o,null];if(f)for(let r=0;r<h;++r)d.push(p=t&&void 0!==t[r]?c[n](e[r],t[r]):c[n](e[r])),p.onerror=v;else for(let t=0;t<h;++t)d.push(p=c[n](e[t])),p.onerror=v}const b=e=>{const t=e.target.result;d.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?o:d.map((e=>e.result)),lastResult:t})};p.onerror=e=>{v(e),b(e)},p.onsuccess=b}))},getMany:({trans:e,keys:n})=>new Promise(((r,o)=>{r=xi(r);const i=e.objectStore(t),s=n.length,a=new Array(s);let u,c=0,l=0;const f=e=>{const t=e.target;a[t._pos]=t.result,++l===c&&r(a)},h=Ts(o);for(let e=0;e<s;++e)null!=n[e]&&(u=i.get(n[e]),u._pos=e,u.onsuccess=f,u.onerror=h,++c);0===c&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,o)=>{r=xi(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=Ts(o)})),query:function(e){return n=>new Promise(((o,i)=>{o=xi(o);const{trans:s,values:a,limit:u,query:c}=n,l=u===1/0?void 0:u,{index:f,range:h}=c,p=s.objectStore(t),d=f.isPrimaryKey?p:p.index(f.name),y=r(h);if(0===u)return o({result:[]});if(e){const e=a?d.getAll(y,l):d.getAllKeys(y,l);e.onsuccess=e=>o({result:e.target.result}),e.onerror=Ts(i)}else{let e=0;const t=a||!("openKeyCursor"in d)?d.openCursor(y):d.openKeyCursor(y),n=[];t.onsuccess=r=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===u?o({result:n}):void i.continue()):o({result:n})},t.onerror=Ts(i)}}))}(i),openCursor:function({trans:e,values:n,query:o,reverse:i,unique:s}){return new Promise(((a,u)=>{a=xi(a);const{index:c,range:l}=o,f=e.objectStore(t),h=c.isPrimaryKey?f:f.index(c.name),p=i?s?"prevunique":"prev":s?"nextunique":"next",d=n||!("openKeyCursor"in h)?h.openCursor(r(l),p):h.openKeyCursor(r(l),p);d.onerror=Ts(u),d.onsuccess=xi((t=>{const n=d.result;if(!n)return void a(null);n.___id=++$s,n.done=!1;const r=n.continue.bind(n);let o=n.continuePrimaryKey;o&&(o=o.bind(n));const i=n.advance.bind(n),s=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=xi(u),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=xi(e),d.onerror=Ts(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=s,e(t)}})),a=()=>{if(d.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return d.onsuccess=xi((e=>{d.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=o,n.advance=i,a(),t},a(n)}),u)}))},count({query:e,trans:n}){const{index:o,range:i}=e;return new Promise(((e,s)=>{const a=n.objectStore(t),u=o.isPrimaryKey?a:a.index(o.name),c=r(i),l=c?u.count(c):u.count();l.onsuccess=xi((t=>e(t.target.result))),l.onerror=Ts(s)}))}}}(e))),a={};return s.forEach((e=>a[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!a[e])throw new Error(`Table '${e}' not found`);return a[e]},MIN_KEY:-1/0,MAX_KEY:Bs(t),schema:o}}(t,n,i),e.dbcore);return{dbcore:s}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function Fs({_novip:e},t,n,r){n.forEach((n=>{const o=r[n];t.forEach((t=>{const r=Vr(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?Wr(t,n,{get(){return this.table(n)},set(e){qr(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,o))}))}))}function qs({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function Ws(e,t){return e._cfg.version-t._cfg.version}function Gs(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const o=e[r],i=t[r];if(o){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto&&!Xi)e.recreate=!0,n.change.push(e);else{const t=o.idxByName,r=i.idxByName;let s;for(s in t)r[s]||e.del.push(s);for(s in r){const n=t[s],o=r[s];n?n.src!==o.src&&e.change.push(o):e.add.push(o)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function zs(e,t,n,r){const o=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Vs(o,e))),o}function Vs(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Hs(e,t,n){const r={};return Yr(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let o=t.keyPath;const i=Ns(Cs(o),o||"",!1,!1,!!t.autoIncrement,o&&"string"!=typeof o,!0),s=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);o=n.keyPath;var a=Ns(n.name,o,!!n.unique,!!n.multiEntry,!1,o&&"string"!=typeof o,!1);s.push(a)}r[e]=Ms(e,i,s)})),r}function Ys({_novip:e},t,n){const r=n.db.objectStoreNames;for(let o=0;o<r.length;++o){const i=r[o],s=n.objectStore(i);e._hasGetAll="getAll"in s;for(let e=0;e<s.indexNames.length;++e){const n=s.indexNames[e],r=s.index(n).keyPath,o="string"==typeof r?r:"["+Yr(r).join("+")+"]";if(t[i]){const e=t[i].idxByName[o];e&&(e.name=n,delete t[i].idxByName[o],t[i].idxByName[n]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&Mr.WorkerGlobalScope&&Mr instanceof Mr.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}let Js=class{_parseStoresSpec(e,t){Br(e).forEach((n=>{if(null!==e[n]){var r=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Ns(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),Ur(r),0===t)})),o=r.shift();if(o.multi)throw new No.Schema("Primary key cannot be multi-valued");r.forEach((e=>{if(e.auto)throw new No.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new No.Schema("Index must have a name and cannot be an empty string")})),t[n]=Ms(n,o,r)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?Rr(this._cfg.storesSource,e):e;const n=t._versions,r={};let o={};return n.forEach((e=>{Rr(r,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(r,o)})),t._dbSchema=o,qs(t,[t._allTables,t,t.Transaction.prototype]),Fs(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],Br(o),o),t._storeNames=Br(o),this}upgrade(e){return this._cfg.contentUpgrade=Wo(this._cfg.contentUpgrade||Bo,e),this}};function Qs(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ba("__dbnames",{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Xs(e){return e&&"function"==typeof e.databases}function Zs(e){return Ci((function(){return ui.letThrough=!0,e()}))}function ea(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()})).finally((function(){return clearInterval(e)})):Promise.resolve()}function ta(e){var t=t=>e.next(t),n=o(t),r=o((t=>e.throw(t)));function o(e){return t=>{var o=e(t),i=o.value;return o.done?i:i&&"function"==typeof i.then?i.then(n,r):Ur(i)?Promise.all(i).then(n,r):n(i)}}return o(t)()}function na(e,t,n){var r=arguments.length;if(r<2)throw new No.InvalidArgument("Too few arguments");for(var o=new Array(r-1);--r;)o[r-1]=arguments[r];return n=o.pop(),[e,oo(o),n]}function ra(e,t,n,r,o){return hi.resolve().then((()=>{const i=ui.transless||ui,s=e._createTransaction(t,n,e._dbSchema,r),a={trans:s,transless:i};if(r)s.idbtrans=r.idbtrans;else try{s.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Do.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>ra(e,t,n,null,o)))):Vi(r)}const u=vo(o);let c;u&&Mi();const l=hi.follow((()=>{if(c=o.call(s,s),c)if(u){var e=Bi.bind(null,null);c.then(e,e)}else"function"==typeof c.next&&"function"==typeof c.throw&&(c=ta(c))}),a);return(c&&"function"==typeof c.then?hi.resolve(c).then((e=>s.active?e:Vi(new No.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):l.then((()=>c))).then((e=>(r&&s._resolve(),s._completion.then((()=>e))))).catch((e=>(s._reject(e),Vi(e))))}))}function oa(e,t,n){const r=Ur(e)?e.slice():[e];for(let e=0;e<n;++e)r.push(t);return r}const ia={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return i(o({},e),{table(t){const n=e.table(t),{schema:r}=n,s={},a=[];function u(e,t,n){const r=Ks(e),c=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,f=t>0,h=i(o({},n),{isVirtual:f,keyTail:t,keyLength:l,extractKey:Us(e),unique:!f&&n.unique});return c.push(h),h.isPrimaryKey||a.push(h),l>1&&u(2===l?e[0]:e.slice(0,l-1),t+1,n),c.sort(((e,t)=>e.keyTail-t.keyTail)),h}const c=u(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[c];for(const e of r.indexes)u(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?i(o({},t),{query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:oa(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:oa(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}):t;var r,s}const f=i(o({},n),{schema:i(o({},r),{primaryKey:c,indexes:a,getIndexByKeyPath:function(e){const t=s[Ks(e)];return t&&t[0]}}),count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:o,keyLength:i}=t.query.index;return o?n.openCursor(l(t)).then((n=>n&&function(n){const o=Object.create(n,{continue:{value:function(o){null!=o?n.continue(oa(o,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,o){n.continuePrimaryKey(oa(t,e.MAX_KEY,r),o)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return o}(n))):n.openCursor(t)}});return f}})}};function sa(e,t,n,r){return n=n||{},r=r||"",Br(e).forEach((o=>{if(Lr(t,o)){var i=e[o],s=t[o];if("object"==typeof i&&"object"==typeof s&&i&&s){const e=fo(i);e!==fo(s)?n[r+o]=t[o]:"Object"===e?sa(i,s,n,r+o+"."):i!==s&&(n[r+o]=t[o])}else i!==s&&(n[r+o]=t[o])}else n[r+o]=void 0})),Br(t).forEach((o=>{Lr(e,o)||(n[r+o]=t[o])})),n}const aa={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>i(o({},e),{table(t){const n=e.table(t),{primaryKey:r}=n.schema,s=i(o({},n),{mutate(e){const s=ui.trans,{deleting:a,creating:u,updating:c}=s.table(t).hook;switch(e.type){case"add":if(u.fire===Bo)break;return s._promise("readwrite",(()=>l(e)),!0);case"put":if(u.fire===Bo&&c.fire===Bo)break;return s._promise("readwrite",(()=>l(e)),!0);case"delete":if(a.fire===Bo)break;return s._promise("readwrite",(()=>l(e)),!0);case"deleteRange":if(a.fire===Bo)break;return s._promise("readwrite",(()=>function(e){return f(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function l(e){const t=ui.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?i(o({},e),{keys:s}):o({},e)).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((o=>{const i=s.map(((n,i)=>{const s=o[i],l={onerror:null,onsuccess:null};if("delete"===e.type)a.fire.call(l,n,s,t);else if("add"===e.type||void 0===s){const o=u.fire.call(l,n,e.values[i],t);null==n&&null!=o&&(n=o,e.keys[i]=n,r.outbound||to(e.values[i],r.keyPath,n))}else{const r=sa(s,e.values[i]),o=c.fire.call(l,r,n,s,t);if(o){const t=e.values[i];Object.keys(o).forEach((e=>{Lr(t,e)?t[e]=o[e]:to(t,e,o[e])}))}}return l}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:a})=>{for(let r=0;r<s.length;++r){const a=n?n[r]:s[r],u=i[r];null==a?u.onerror&&u.onerror(t[r]):u.onsuccess&&u.onsuccess("put"===e.type&&o[r]?e.values[r]:a)}return{failures:t,results:n,numFailures:r,lastResult:a}})).catch((e=>(i.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function f(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>l({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:f(e,i(o({},t),{lower:n[n.length-1],lowerOpen:!0}),s)))))}}});return s}})};function ua(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let o=0,i=0;o<t.keys.length&&i<e.length;++o)0===ys(t.keys[o],e[i])&&(r.push(n?uo(t.values[o]):t.values[o]),++i);return r.length===e.length?r:null}catch(e){return null}}const ca={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return i(o({},n),{getMany:e=>{if(!e.cache)return n.getMany(e);const t=ua(e.keys,e.trans._cache,"clone"===e.cache);return t?hi.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?uo(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))})}})};function la(e){return!("from"in e)}const fa=function(e,t){if(!this){const t=new fa;return e&&"d"in e&&Rr(t,e),t}Rr(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function ha(e,t,n){const r=ys(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(la(e))return Rr(e,{from:t,to:n,d:1});const o=e.l,i=e.r;if(ys(n,e.from)<0)return o?ha(o,t,n):e.l={from:t,to:n,d:1,l:null,r:null},ya(e);if(ys(t,e.to)>0)return i?ha(i,t,n):e.r={from:t,to:n,d:1,l:null,r:null},ya(e);ys(t,e.from)<0&&(e.from=t,e.l=null,e.d=i?i.d+1:1),ys(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const s=!e.r;o&&!e.l&&pa(e,o),i&&s&&pa(e,i)}function pa(e,t){la(t)||function e(t,{from:n,to:r,l:o,r:i}){ha(t,n,r),o&&e(t,o),i&&e(t,i)}(e,t)}function da(e){let t=la(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&ys(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||ys(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function ya(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),i=r>1?"r":r<-1?"l":"";if(i){const t="r"===i?"l":"r",n=o({},e),r=e[i];e.from=r.from,e.to=r.to,e[i]=r[i],n[i]=r[t],e[t]=n,n.d=ma(n)}e.d=ma(e)}function ma({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}Fr(fa.prototype,{add(e){return pa(this,e),this},addKey(e){return ha(this,e,e),this},addKeys(e){return e.forEach((e=>ha(this,e,e))),this},[ho](){return da(this)}});const va={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,n=new fa(e.MIN_KEY,e.MAX_KEY);return i(o({},e),{table:r=>{const s=e.table(r),{schema:a}=s,{primaryKey:u}=a,{extractKey:c,outbound:l}=u,f=i(o({},s),{mutate:e=>{const o=e.trans,i=o.mutatedParts||(o.mutatedParts={}),u=e=>{const n=`idb://${t}/${r}/${e}`;return i[n]||(i[n]=new fa)},c=u(""),l=u(":dels"),{type:f}=e;let[h,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const d=e.trans._cache;return s.mutate(e).then((e=>{if(Ur(h)){"delete"!==f&&(h=e.results),c.addKeys(h);const t=ua(h,d);t||"add"===f||l.addKeys(h),(t||p)&&function(e,t,n,r){t.indexes.forEach((function(t){const o=e(t.name||"");function i(e){return null!=e?t.extractKey(e):null}const s=e=>t.multiEntry&&Ur(e)?e.forEach((e=>o.addKey(e))):o.addKey(e);(n||r).forEach(((e,t)=>{const o=n&&i(n[t]),a=r&&i(r[t]);0!==ys(o,a)&&(null!=o&&s(o),null!=a&&s(a))}))}))}(u,a,t,p)}else if(h){const e={from:h.lower,to:h.upper};l.add(e),c.add(e)}else c.add(n),l.add(n),a.indexes.forEach((e=>u(e.name).add(n)));return e}))}}),h=({query:{index:t,range:n}})=>{var r,o;return[t,new fa(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(o=n.upper)&&void 0!==o?o:e.MAX_KEY)]},p={get:e=>[u,new fa(e.key)],getMany:e=>[u,(new fa).addKeys(e.keys)],count:h,query:h,openCursor:h};return Br(p).forEach((e=>{f[e]=function(a){const{subscr:u}=ui;if(u){const f=e=>{const n=`idb://${t}/${r}/${e}`;return u[n]||(u[n]=new fa)},h=f(""),d=f(":dels"),[y,m]=p[e](a);if(f(y.name||"").add(m),!y.isPrimaryKey){if("count"!==e){const t="query"===e&&l&&a.values&&s.query(i(o({},a),{values:!1}));return s[e].apply(this,arguments).then((n=>{if("query"===e){if(l&&a.values)return t.then((({result:e})=>(h.addKeys(e),n)));const e=a.values?n.result.map(c):n.result;a.values?h.addKeys(e):d.addKeys(e)}else if("openCursor"===e){const e=n,t=a.values;return e&&Object.create(e,{key:{get:()=>(d.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return d.addKey(t),t}},value:{get:()=>(t&&h.addKey(e.primaryKey),e.value)}})}return n}))}d.add(n)}}return s[e].apply(this,arguments)}})),f}})}};let ba=class e{version(e){if(isNaN(e)||e<.1)throw new No.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new No.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(Ws),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||ui.letThrough||this._vip)?e():new hi(((e,t)=>{if(this._state.openComplete)return t(new No.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new No.DatabaseClosed);this.open().catch(Bo)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const o=this._middlewares[e]||(this._middlewares[e]=[]);return o.push({stack:e,create:t,level:null==n?10:n,name:r}),o.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:n}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?Vi(t.dbOpenError):e));bo&&(t.openCanceller._stackHolder=Oo()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const r=t.openCanceller;function o(){if(t.openCanceller!==r)throw new No.DatabaseClosed("db.open() was cancelled")}let i=t.dbReadyResolve,s=null,a=!1;return hi.race([r,("undefined"==typeof navigator?hi.resolve():ea()).then((()=>new hi(((r,i)=>{if(o(),!n)throw new No.MissingAPI;const u=e.name,c=t.autoSchema?n.open(u):n.open(u,Math.round(10*e.verno));if(!c)throw new No.MissingAPI;c.onerror=Ts(i),c.onblocked=xi(e._fireOnBlocked),c.onupgradeneeded=xi((r=>{if(s=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=ks,s.abort(),c.result.close();const e=n.deleteDatabase(u);e.onsuccess=e.onerror=xi((()=>{i(new No.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{s.onerror=Ts(i);var o=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;a=o<1,e._novip.idbdb=c.result,function(e,t,n,r){const o=e._dbSchema,i=e._createTransaction("readwrite",e._storeNames,o);i.create(n),i._completion.catch(r);const s=i._reject.bind(i),a=ui.transless||ui;Ci((()=>{ui.trans=i,ui.transless=a,0===t?(Br(o).forEach((e=>{zs(n,e,o[e].primKey,o[e].indexes)})),Ls(e,n),hi.follow((()=>e.on.populate.fire(i))).catch(s)):function({_novip:e},t,n,r){const o=[],i=e._versions;let s=e._dbSchema=Hs(0,e.idbdb,r),a=!1;return i.filter((e=>e._cfg.version>=t)).forEach((i=>{o.push((()=>{const o=s,u=i._cfg.dbschema;Ys(e,o,r),Ys(e,u,r),s=e._dbSchema=u;const c=Gs(o,u);c.add.forEach((e=>{zs(r,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new No.Upgrade("Not yet support for changing primary key");{const t=r.objectStore(e.name);e.add.forEach((e=>Vs(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Vs(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const l=i._cfg.contentUpgrade;if(l&&i._cfg.version>t){Ls(e,r),n._memoizedTables={},a=!0;let t=no(u);c.del.forEach((e=>{t[e]=o[e]})),qs(e,[e.Transaction.prototype]),Fs(e,[e.Transaction.prototype],Br(t),t),n.schema=t;const i=vo(l);let s;i&&Mi();const f=hi.follow((()=>{if(s=l(n),s&&i){var e=Bi.bind(null,null);s.then(e,e)}}));return s&&"function"==typeof s.then?hi.resolve(s):f.then((()=>s))}})),o.push((t=>{a&&Zi||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(i._cfg.dbschema,t),qs(e,[e.Transaction.prototype]),Fs(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema}))})),function e(){return o.length?hi.resolve(o.shift()(n.idbtrans)).then(e):hi.resolve()}().then((()=>{var e,t;t=r,Br(e=s).forEach((n=>{t.db.objectStoreNames.contains(n)||zs(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,i,n).catch(s)}))}(e,o/10,s,i)}}),i),c.onsuccess=xi((()=>{s=null;const n=e._novip.idbdb=c.result,o=Yr(n.objectStoreNames);if(o.length>0)try{const r=n.transaction(1===(i=o).length?i[0]:i,"readonly");t.autoSchema?function({_novip:e},t,n){e.verno=t.version/10;const r=e._dbSchema=Hs(0,t,n);e._storeNames=Yr(t.objectStoreNames,0),Fs(e,[e._allTables],Br(r),r)}(e,n,r):(Ys(e,e._dbSchema,r),function(e,t){const n=Gs(Hs(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,r)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Ls(e,r)}catch(e){}var i;Qi.push(e),n.onversionchange=xi((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),n.onclose=xi((t=>{e.on("close").fire(t)})),a&&function({indexedDB:e,IDBKeyRange:t},n){!Xs(e)&&"__dbnames"!==n&&Qs(e,t).put({name:n}).catch(Bo)}(e._deps,u),r()}),i)}))))]).then((()=>(o(),t.onReadyBeingFired=[],hi.resolve(Zs((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(Wo,Bo);return t.onReadyBeingFired=[],hi.resolve(Zs((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{s&&s.abort()}catch(e){}return r===t.openCanceller&&e._close(),Vi(n)})).finally((()=>{t.openComplete=!0,i()}))}(this)}_close(){const e=this._state,t=Qi.indexOf(this);if(t>=0&&Qi.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new hi((t=>{e.dbReadyResolve=t})),e.openCanceller=new hi(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new No.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new hi(((n,r)=>{const o=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=xi((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!Xs(e)&&"__dbnames"!==n&&Qs(e,t).delete(n).catch(Bo)}(this._deps,this.name),n()})),e.onerror=Ts(r),e.onblocked=this._fireOnBlocked};if(e)throw new No.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(o):o()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return Br(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=na.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=ui.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const o=-1!==e.indexOf("?");let i,s;e=e.replace("!","").replace("?","");try{if(s=t.map((e=>{var t=e instanceof this.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t})),"r"==e||"readonly"===e)i="readonly";else{if("rw"!=e&&"readwrite"!=e)throw new No.InvalidArgument("Invalid transaction mode: "+e);i="readwrite"}if(r){if("readonly"===r.mode&&"readwrite"===i){if(!o)throw new No.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&s.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!o)throw new No.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),o&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):Vi(e)}const a=ra.bind(null,this,i,s,r,n);return r?r._promise(i,a,"lock"):ui.trans?Fi(ui.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!Lr(this._allTables,e))throw new No.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}constructor(t,n){this._middlewares={},this.verno=0;const r=e.dependencies;this._options=n=o({addons:e.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};const{addons:i}=n;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Bo,dbReadyPromise:null,cancelOpen:Bo,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var a;s.dbReadyPromise=new hi((e=>{s.dbReadyResolve=e})),s.openCanceller=new hi(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=t,this.on=ss(this,"populate","blocked","versionchange","close",{ready:[Wo,Bo]}),this.on.ready.subscribe=Jr(this.on.ready.subscribe,(t=>(n,r)=>{e.vip((()=>{const e=this._state;if(e.openComplete)e.dbOpenError||hi.resolve().then(n),r&&t(n);else if(e.onReadyBeingFired)e.onReadyBeingFired.push(n),r&&t(n);else{t(n);const e=this;r||t((function t(){e.on.ready.unsubscribe(n),e.on.ready.unsubscribe(t)}))}}))})),this.Collection=(a=this,as(bs.prototype,(function(e,t){this.db=a;let n=rs,r=null;if(t)try{n=t()}catch(e){r=e}const o=e._ctx,i=o.table,s=i.hook.reading.fire;this._ctx={table:i,index:o.index,isPrimKey:!o.index||i.schema.primKey.keyPath&&o.index===i.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:o.or,valueMapper:s!==Uo?s:null}}))),this.Table=function(e){return as(is.prototype,(function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:ss(null,{creating:[Ko,Bo],reading:[Ro,Uo],updating:[Fo,Bo],deleting:[Lo,Bo]})}))}(this),this.Transaction=function(e){return as(Is.prototype,(function(t,n,r,o,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=ss(this,"complete","error","abort"),this.parent=i||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 hi(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),Vi(e)}))}))}(this),this.Version=function(e){return as(Js.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return as(As.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const o=e._deps.indexedDB;if(!o)throw new No.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(e,t)=>o.cmp(t,e),this._max=(e,t)=>o.cmp(e,t)>0?e:t,this._min=(e,t)=>o.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=Bs(n.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),Qi.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(ia),this.use(aa),this.use(va),this.use(ca),this.vip=Object.create(this,{_vip:{value:!0}}),i.forEach((e=>e(this)))}};const ga="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";let wa,_a=class{subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[ga](){return this}constructor(e){this._subscribe=e}};function Oa(e,t){return Br(t).forEach((n=>{pa(e[n]||(e[n]=new fa),t[n])})),e}try{wa={indexedDB:Mr.indexedDB||Mr.mozIndexedDB||Mr.webkitIndexedDB||Mr.msIndexedDB,IDBKeyRange:Mr.IDBKeyRange||Mr.webkitIDBKeyRange}}catch(vt){wa={indexedDB:null,IDBKeyRange:null}}const Sa=ba;function Ea(e){let t=ja;try{ja=!0,Ds.storagemutated.fire(e)}finally{ja=t}}Fr(Sa,i(o({},Mo),{delete:e=>new Sa(e,{addons:[]}).delete(),exists:e=>new Sa(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return Xs(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>"__dbnames"!==e)))):Qs(e,t).toCollection().primaryKeys()}(Sa.dependencies).then(e)}catch(e){return Vi(new No.MissingAPI)}},defineClass:()=>function(e){Rr(this,e)},ignoreTransaction:e=>ui.trans?Fi(ui.transless,e):e(),vip:Zs,async:function(e){return function(){try{var t=ta(e.apply(this,arguments));return t&&"function"==typeof t.then?t:hi.resolve(t)}catch(e){return Vi(e)}}},spawn:function(e,t,n){try{var r=ta(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:hi.resolve(r)}catch(e){return Vi(e)}},currentTransaction:{get:()=>ui.trans||null},waitFor:function(e,t){const n=hi.resolve("function"==typeof e?Sa.ignoreTransaction(e):e).timeout(t||6e4);return ui.trans?ui.trans.waitFor(n):n},Promise:hi,debug:{get:()=>bo,set:e=>{go(e,"dexie"===e?()=>!0:ts)}},derive:Gr,extend:Rr,props:Fr,override:Jr,Events:ss,on:Ds,liveQuery:function(e){return new _a((t=>{const n=vo(e);let r=!1,o={},i={};const s={get closed(){return r},unsubscribe:()=>{r=!0,Ds.storagemutated.unsubscribe(l)}};t.start&&t.start(s);let a=!1,u=!1;function c(){return Br(i).some((e=>o[e]&&function(e,t){const n=da(t);let r=n.next();if(r.done)return!1;let o=r.value;const i=da(e);let s=i.next(o.from),a=s.value;for(;!r.done&&!s.done;){if(ys(a.from,o.to)<=0&&ys(a.to,o.from)>=0)return!0;ys(o.from,a.from)<0?o=(r=n.next(a.from)).value:a=(s=i.next(o.from)).value}return!1}(o[e],i[e])))}const l=e=>{Oa(o,e),c()&&f()},f=()=>{if(a||r)return;o={};const h={},p=function(t){n&&Mi();const r=()=>Ci(e,{subscr:t,trans:null}),o=ui.trans?Fi(ui.transless,r):r();return n&&o.then(Bi,Bi),o}(h);u||(Ds("storagemutated",l),u=!0),a=!0,Promise.resolve(p).then((e=>{a=!1,r||(c()?f():(o={},i=h,t.next&&t.next(e)))}),(e=>{a=!1,t.error&&t.error(e),s.unsubscribe()}))};return f(),s}))},extendObservabilitySet:Oa,getByKeyPath:eo,setByKeyPath:to,delByKeyPath:function(e,t){"string"==typeof t?to(e,t,void 0):"length"in t&&[].map.call(t,(function(t){to(e,t,void 0)}))},shallowClone:no,deepClone:uo,getObjectDiff:sa,cmp:ys,asap:Xr,minKey:-1/0,addons:[],connections:Qi,errnames:Do,dependencies:wa,semVer:"3.2.3",version:"3.2.3".split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))})),Sa.maxKey=Bs(Sa.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Ds("storagemutated",(e=>{if(!ja){let t;Xi?(t=document.createEvent("CustomEvent"),t.initCustomEvent("x-storagemutated-1",!0,!0,e)):t=new CustomEvent("x-storagemutated-1",{detail:e}),ja=!0,dispatchEvent(t),ja=!1}})),addEventListener("x-storagemutated-1",(({detail:e})=>{ja||Ea(e)})));let ja=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel("x-storagemutated-1");"function"==typeof e.unref&&e.unref(),Ds("storagemutated",(t=>{ja||e.postMessage(t)})),e.onmessage=e=>{e.data&&Ea(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){Ds("storagemutated",(e=>{try{ja||("undefined"!=typeof localStorage&&localStorage.setItem("x-storagemutated-1",JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:"x-storagemutated-1",changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if("x-storagemutated-1"===e.key){const t=JSON.parse(e.newValue);t&&Ea(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&"x-storagemutated-1"===e.type&&Ea(e.changedParts)}))}function Pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xa(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Aa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){xa(i,r,o,s,a,"next",e)}function a(e){xa(i,r,o,s,a,"throw",e)}s(void 0)}))}}hi.rejectionMapper=function(e,t){if(!e||e instanceof xo||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Co[e.name])return e;var n=new Co[e.name](t||e.message,e);return"stack"in e&&Wr(n,"stack",{get:function(){return this.inner.stack}}),n},go(bo,ts);const Ta=new class extends ba{constructor(){super("EsmOffline"),Pa(this,"syncQueue",void 0),Pa(this,"dynamicOfflineData",void 0),this.version(4).stores({syncQueue:"++id,userId,type,[userId+type]",dynamicOfflineData:"++id,type,identifier,*users,&[type+identifier]"}),this.syncQueue=this.table("syncQueue"),this.dynamicOfflineData=this.table("dynamicOfflineData")}};function ka(){return(ka=Aa((function*(){const e=yield _r();return(null==e?void 0:e.uuid)||"*"}))).apply(this,arguments)}function Da(){return Da=Aa((function*(e,t){return(yield function(e,t){return Ia.apply(this,arguments)}(e,t)).map((e=>e.content))})),Da.apply(this,arguments)}function Ia(){return(Ia=Aa((function*(e,t){const n=t?{type:t,userId:e}:{userId:e};return yield Ta.syncQueue.where(n).toArray().catch(ba.errnames.DatabaseClosed,(()=>[]))}))).apply(this,arguments)}function Na(){return Na=Aa((function*(e){const t=yield function(){return ka.apply(this,arguments)}();return yield function(e,t){return Da.apply(this,arguments)}(t,e)})),Na.apply(this,arguments)}function Ca(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Ma(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){Ca(i,r,o,s,a,"next",e)}function a(e){Ca(i,r,o,s,a,"throw",e)}s(void 0)}))}}function Ba(e,t){return Ua.apply(this,arguments)}function Ua(){return Ua=Ma((function*(e,t,n=!0){if(e){let r=null;const[o,i]=yield Promise.all([ur(`${ir}/Patient/${e}`,t).catch((e=>r=e)),n?Ra(e):Promise.resolve(null)]);if(o.ok)return o.data;if(i)return i;if(r)throw r}return null})),Ua.apply(this,arguments)}function Ra(e){return $a.apply(this,arguments)}function $a(){return $a=Ma((function*(e){const t=yield function(e){return Na.apply(this,arguments)}("patient-registration"),n=t.find((t=>t.fhirPatient.id===e));var r;return null!==(r=null==n?void 0:n.fhirPatient)&&void 0!==r?r:null})),$a.apply(this,arguments)}(0,Re.createGlobalStore)("offline-synchronization",{}),(0,Re.createGlobalStore)("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});var Ka=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),La=function(e){function n(t,n){var r=e.call(this)||this;return r.subject=t,r.subscriber=n,r.closed=!1,r}return t(n,e),n.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var n=t.indexOf(this.subscriber);-1!==n&&t.splice(n,1)}}},n}(m),Fa=function(e){function n(t){var n=e.call(this,t)||this;return n.destination=t,n}return t(n,e),n}(g),qa=function(e){function n(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t(n,e),n.prototype[b]=function(){return new Fa(this)},n.prototype.lift=function(e){var t=new Wa(this,this);return t.operator=e,t},n.prototype.next=function(e){if(this.closed)throw new Ka;if(!this.isStopped)for(var t=this.observers,n=t.length,r=t.slice(),o=0;o<n;o++)r[o].next(e)},n.prototype.error=function(e){if(this.closed)throw new Ka;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,n=t.length,r=t.slice(),o=0;o<n;o++)r[o].error(e);this.observers.length=0},n.prototype.complete=function(){if(this.closed)throw new Ka;this.isStopped=!0;for(var e=this.observers,t=e.length,n=e.slice(),r=0;r<t;r++)n[r].complete();this.observers.length=0},n.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},n.prototype._trySubscribe=function(t){if(this.closed)throw new Ka;return e.prototype._trySubscribe.call(this,t)},n.prototype._subscribe=function(e){if(this.closed)throw new Ka;return this.hasError?(e.error(this.thrownError),m.EMPTY):this.isStopped?(e.complete(),m.EMPTY):(this.observers.push(e),new La(this,e))},n.prototype.asObservable=function(){var e=new E;return e.source=this,e},n.create=function(e,t){return new Wa(e,t)},n}(E),Wa=function(e){function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t(n,e),n.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},n.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},n.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},n.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):m.EMPTY},n}(qa),Ga=function(e){function n(t){var n=e.call(this)||this;return n._value=t,n}return t(n,e),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n&&!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new Ka;return this._value},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},n}(qa),za=function(){function e(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return e.prototype=Object.create(Error.prototype),e}(),Va=new E((function(e){return e.complete()}));function Ha(e){return function(t){return 0===e?Va:t.lift(new Ya(e))}}var Ya=function(){function e(e){if(this.total=e,this.total<0)throw new za}return e.prototype.call=function(e,t){return t.subscribe(new Ja(e,this.total))},e}(),Ja=function(e){function n(t,n){var r=e.call(this,t)||this;return r.total=n,r.count=0,r}return t(n,e),n.prototype._next=function(e){var t=this.total,n=++this.count;n<=t&&(this.destination.next(e),n===t&&(this.destination.complete(),this.unsubscribe()))},n}(g);function Qa(e,t){return function(n){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new Xa(e,t))}}var Xa=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new Za(e,this.project,this.thisArg))},e}(),Za=function(e){function n(t,n,r){var o=e.call(this,t)||this;return o.project=n,o.count=0,o.thisArg=r||o,o}return t(n,e),n.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},n}(g);const eu="custom:(uuid,encounters:(uuid,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,uuid),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display),startDatetime,stopDatetime)";function tu(e,t,n){return cr(`/ws/rest/v1/visit?patient=${e}&v=${null!=n?n:eu}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}}).pipe(Ha(1)).pipe(Qa((e=>e)))}function nu(e,t){return cr("/ws/rest/v1/visit",{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ru(e,t,n){return cr(`/ws/rest/v1/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}const ou=new Ga(null);var iu,su;function au(e){return{uuid:e.uuid,display:e.display,name:e.name}}function uu(){return cr("/ws/rest/v1/visittype").pipe(Qa((e=>e.data.results.map(au)))).pipe(Ha(1))}function cu(e){return{uuid:e.uuid,display:e.display}}function lu(){return cr("/ws/rest/v1/location").pipe(Qa((e=>e.data.results.map(cu)))).pipe(Ha(1))}!function(e){e.NEWVISIT="startVisit",e.EDITVISIT="editVisit",e.LOADING="loadingVisit"}(iu||(iu={})),function(e){e.NOTSTARTED="notStarted",e.ONGOING="ongoing"}(su||(su={}));const fu={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"}})()})()},403:()=>{(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{createAppState:()=>a,createGlobalStore:()=>i,getAppState:()=>u,getGlobalStore:()=>s,subscribeTo:()=>c});const n=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o)?o:Object.assign({},t,o),n.forEach((n=>n(t,e)))}},o=()=>t,i={setState:r,getState:o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,o,i),i},r=e=>e?n(e):n,o={};function i(e,t){const n=o[e];if(n)return n.active?console.error("Cannot override an existing store. Make sure that stores are only created once."):n.value.setState(t,!0),n.active=!0,n.value;{const n=r()((()=>t));return o[e]={value:n,active:!0},n}}function s(e,t){const n=o[e];if(!n){const n=r()((()=>null!=t?t:{}));return o[e]={value:n,active:!1},n}return n.value}function a(e){return i("app",e)}function u(){return s("app",{})}function c(e,t,n){let r=t(e.getState());return e.subscribe((e=>{const o=t(e);o!==r&&(r=o,n(o))}))}})()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{attach:()=>Bo,checkStatus:()=>Go,checkStatusFor:()=>zo,detach:()=>Uo,detachAll:()=>Ro,extensionStore:()=>Zo,getAssignedExtensions:()=>Fo,getConnectedExtensions:()=>Ko,getExtensionInternalStore:()=>vo,getExtensionNameFromId:()=>Io,getExtensionRegistration:()=>Co,getExtensionRegistrationFrom:()=>No,getExtensionStore:()=>go,registerExtension:()=>Mo,registerExtensionSlot:()=>qo,renderExtension:()=>Qo,reset:()=>Wo,updateInternalExtensionStore:()=>bo});const e=function(e,t){return e===t||e!=e&&t!=t},t=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1};var o=Array.prototype.splice;function i(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}i.prototype.clear=function(){this.__data__=[],this.size=0},i.prototype.delete=function(e){var n=this.__data__,r=t(n,e);return!(r<0||(r==n.length-1?n.pop():o.call(n,r,1),--this.size,0))},i.prototype.get=function(e){var n=this.__data__,r=t(n,e);return r<0?void 0:n[r][1]},i.prototype.has=function(e){return t(this.__data__,e)>-1},i.prototype.set=function(e,n){var r=this.__data__,o=t(r,e);return o<0?(++this.size,r.push([e,n])):r[o][1]=n,this};const s=i,a="object"==typeof global&&global&&global.Object===Object&&global;var u="object"==typeof self&&self&&self.Object===Object&&self;const c=a||u||Function("return this")(),l=c.Symbol;var f=Object.prototype,h=f.hasOwnProperty,p=f.toString,d=l?l.toStringTag:void 0;var y=Object.prototype.toString;var m=l?l.toStringTag:void 0;const v=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?function(e){var t=h.call(e,d),n=e[d];try{e[d]=void 0;var r=!0}catch(e){}var o=p.call(e);return r&&(t?e[d]=n:delete e[d]),o}(e):function(e){return y.call(e)}(e)},b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},g=function(e){if(!b(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},w=c["__core-js_shared__"];var _,O=(_=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"";var S=Function.prototype.toString;const E=function(e){if(null!=e){try{return S.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var j=/^\[object .+?Constructor\]$/,P=Function.prototype,x=Object.prototype,A=P.toString,T=x.hasOwnProperty,k=RegExp("^"+A.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const D=function(e){return!(!b(e)||(t=e,O&&O in t))&&(g(e)?k:j).test(E(e));var t},I=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return D(n)?n:void 0},N=I(c,"Map"),C=I(Object,"create");var M=Object.prototype.hasOwnProperty;var B=Object.prototype.hasOwnProperty;function U(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}U.prototype.clear=function(){this.__data__=C?C(null):{},this.size=0},U.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},U.prototype.get=function(e){var t=this.__data__;if(C){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return M.call(t,e)?t[e]:void 0},U.prototype.has=function(e){var t=this.__data__;return C?void 0!==t[e]:B.call(t,e)},U.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=C&&void 0===t?"__lodash_hash_undefined__":t,this};const R=U,$=function(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map};function K(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}K.prototype.clear=function(){this.size=0,this.__data__={hash:new R,map:new(N||s),string:new R}},K.prototype.delete=function(e){var t=$(this,e).delete(e);return this.size-=t?1:0,t},K.prototype.get=function(e){return $(this,e).get(e)},K.prototype.has=function(e){return $(this,e).has(e)},K.prototype.set=function(e,t){var n=$(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};const L=K;function F(e){var t=this.__data__=new s(e);this.size=t.size}F.prototype.clear=function(){this.__data__=new s,this.size=0},F.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},F.prototype.get=function(e){return this.__data__.get(e)},F.prototype.has=function(e){return this.__data__.has(e)},F.prototype.set=function(e,t){var n=this.__data__;if(n instanceof s){var r=n.__data__;if(!N||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new L(r)}return n.set(e,t),this.size=n.size,this};const q=F;function W(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new L;++t<n;)this.add(e[t])}W.prototype.add=W.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},W.prototype.has=function(e){return this.__data__.has(e)};const G=W,z=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},V=function(e,t,n,r,o,i){var s=1&n,a=e.length,u=t.length;if(a!=u&&!(s&&u>a))return!1;var c=i.get(e),l=i.get(t);if(c&&l)return c==t&&l==e;var f=-1,h=!0,p=2&n?new G:void 0;for(i.set(e,t),i.set(t,e);++f<a;){var d=e[f],y=t[f];if(r)var m=s?r(y,d,f,t,e,i):r(d,y,f,e,t,i);if(void 0!==m){if(m)continue;h=!1;break}if(p){if(!z(t,(function(e,t){if(s=t,!p.has(s)&&(d===e||o(d,e,n,r,i)))return p.push(t);var s}))){h=!1;break}}else if(d!==y&&!o(d,y,n,r,i)){h=!1;break}}return i.delete(e),i.delete(t),h},H=c.Uint8Array,Y=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n},J=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var Q=l?l.prototype:void 0,X=Q?Q.valueOf:void 0;const Z=Array.isArray;var ee=Object.prototype.propertyIsEnumerable,te=Object.getOwnPropertySymbols;const ne=te?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}(te(e),(function(t){return ee.call(e,t)})))}:function(){return[]},re=function(e){return null!=e&&"object"==typeof e},oe=function(e){return re(e)&&"[object Arguments]"==v(e)};var ie=Object.prototype,se=ie.hasOwnProperty,ae=ie.propertyIsEnumerable;const ue=oe(function(){return arguments}())?oe:function(e){return re(e)&&se.call(e,"callee")&&!ae.call(e,"callee")};var ce="object"==typeof exports&&exports&&!exports.nodeType&&exports,le=ce&&"object"==typeof module&&module&&!module.nodeType&&module,fe=le&&le.exports===ce?c.Buffer:void 0;const he=(fe?fe.isBuffer:void 0)||function(){return!1};var pe=/^(?:0|[1-9]\d*)$/;const de=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&pe.test(e))&&e>-1&&e%1==0&&e<t},ye=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var me={};me["[object Float32Array]"]=me["[object Float64Array]"]=me["[object Int8Array]"]=me["[object Int16Array]"]=me["[object Int32Array]"]=me["[object Uint8Array]"]=me["[object Uint8ClampedArray]"]=me["[object Uint16Array]"]=me["[object Uint32Array]"]=!0,me["[object Arguments]"]=me["[object Array]"]=me["[object ArrayBuffer]"]=me["[object Boolean]"]=me["[object DataView]"]=me["[object Date]"]=me["[object Error]"]=me["[object Function]"]=me["[object Map]"]=me["[object Number]"]=me["[object Object]"]=me["[object RegExp]"]=me["[object Set]"]=me["[object String]"]=me["[object WeakMap]"]=!1;var ve="object"==typeof exports&&exports&&!exports.nodeType&&exports,be=ve&&"object"==typeof module&&module&&!module.nodeType&&module,ge=be&&be.exports===ve&&a.process,we=function(){try{return be&&be.require&&be.require("util").types||ge&&ge.binding&&ge.binding("util")}catch(e){}}(),_e=we&&we.isTypedArray;const Oe=_e?(Se=_e,function(e){return Se(e)}):function(e){return re(e)&&ye(e.length)&&!!me[v(e)]};var Se,Ee=Object.prototype.hasOwnProperty;const je=function(e,t){var n=Z(e),r=!n&&ue(e),o=!n&&!r&&he(e),i=!n&&!r&&!o&&Oe(e),s=n||r||o||i,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],u=a.length;for(var c in e)!t&&!Ee.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||de(c,u))||a.push(c);return a};var Pe=Object.prototype;const xe=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object);var Ae=Object.prototype.hasOwnProperty;const Te=function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||Pe))return xe(e);var t,n,r=[];for(var o in Object(e))Ae.call(e,o)&&"constructor"!=o&&r.push(o);return r},ke=function(e){return null!=(t=e)&&ye(t.length)&&!g(t)?je(e):Te(e);var t},De=function(e){return function(e,t,n){var r=t(e);return Z(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,ke,ne)};var Ie=Object.prototype.hasOwnProperty;const Ne=I(c,"DataView"),Ce=I(c,"Promise"),Me=I(c,"Set"),Be=I(c,"WeakMap");var Ue="[object Map]",Re="[object Promise]",$e="[object Set]",Ke="[object WeakMap]",Le="[object DataView]",Fe=E(Ne),qe=E(N),We=E(Ce),Ge=E(Me),ze=E(Be),Ve=v;(Ne&&Ve(new Ne(new ArrayBuffer(1)))!=Le||N&&Ve(new N)!=Ue||Ce&&Ve(Ce.resolve())!=Re||Me&&Ve(new Me)!=$e||Be&&Ve(new Be)!=Ke)&&(Ve=function(e){var t=v(e),n="[object Object]"==t?e.constructor:void 0,r=n?E(n):"";if(r)switch(r){case Fe:return Le;case qe:return Ue;case We:return Re;case Ge:return $e;case ze:return Ke}return t});const He=Ve;var Ye="[object Arguments]",Je="[object Array]",Qe="[object Object]",Xe=Object.prototype.hasOwnProperty;const Ze=function(t,n,r,o,i,s){var a=Z(t),u=Z(n),c=a?Je:He(t),l=u?Je:He(n),f=(c=c==Ye?Qe:c)==Qe,h=(l=l==Ye?Qe:l)==Qe,p=c==l;if(p&&he(t)){if(!he(n))return!1;a=!0,f=!1}if(p&&!f)return s||(s=new q),a||Oe(t)?V(t,n,r,o,i,s):function(t,n,r,o,i,s,a){switch(r){case"[object DataView]":if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=n.byteLength||!s(new H(t),new H(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return e(+t,+n);case"[object Error]":return t.name==n.name&&t.message==n.message;case"[object RegExp]":case"[object String]":return t==n+"";case"[object Map]":var u=Y;case"[object Set]":var c=1&o;if(u||(u=J),t.size!=n.size&&!c)return!1;var l=a.get(t);if(l)return l==n;o|=2,a.set(t,n);var f=V(u(t),u(n),o,i,s,a);return a.delete(t),f;case"[object Symbol]":if(X)return X.call(t)==X.call(n)}return!1}(t,n,c,r,o,i,s);if(!(1&r)){var d=f&&Xe.call(t,"__wrapped__"),y=h&&Xe.call(n,"__wrapped__");if(d||y){var m=d?t.value():t,v=y?n.value():n;return s||(s=new q),i(m,v,r,o,s)}}return!!p&&(s||(s=new q),function(e,t,n,r,o,i){var s=1&n,a=De(e),u=a.length;if(u!=De(t).length&&!s)return!1;for(var c=u;c--;){var l=a[c];if(!(s?l in t:Ie.call(t,l)))return!1}var f=i.get(e),h=i.get(t);if(f&&h)return f==t&&h==e;var p=!0;i.set(e,t),i.set(t,e);for(var d=s;++c<u;){var y=e[l=a[c]],m=t[l];if(r)var v=s?r(m,y,l,t,e,i):r(y,m,l,e,t,i);if(!(void 0===v?y===m||o(y,m,n,r,i):v)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,g=t.constructor;b==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g||(p=!1)}return i.delete(e),i.delete(t),p}(t,n,r,o,i,s))},et=function e(t,n,r,o,i){return t===n||(null==t||null==n||!re(t)&&!re(n)?t!=t&&n!=n:Ze(t,n,r,o,e,i))},tt=function(e,t){return et(e,t)};function nt(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function rt(e){return function t(n){return 0===arguments.length||nt(n)?t:e.apply(this,arguments)}}function ot(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return nt(n)?t:rt((function(t){return e(n,t)}));default:return nt(n)&&nt(r)?t:nt(n)?rt((function(t){return e(t,r)})):nt(r)?rt((function(t){return e(n,t)})):e(n,r)}}}function it(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function st(e,t,n){for(var r=0,o=n.length;r<o;){if(e(t,n[r]))return!0;r+=1}return!1}function at(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const ut="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var ct=Object.prototype.toString,lt=function(){return"[object Arguments]"===ct.call(arguments)?function(e){return"[object Arguments]"===ct.call(e)}:function(e){return at("callee",e)}}();const ft=lt;var ht=!{toString:null}.propertyIsEnumerable("toString"),pt=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],dt=function(){return arguments.propertyIsEnumerable("length")}(),yt=function(e,t){for(var n=0;n<e.length;){if(e[n]===t)return!0;n+=1}return!1};const mt="function"!=typeof Object.keys||dt?rt((function(e){if(Object(e)!==e)return[];var t,n,r=[],o=dt&&ft(e);for(t in e)!at(t,e)||o&&"length"===t||(r[r.length]=t);if(ht)for(n=pt.length-1;n>=0;)at(t=pt[n],e)&&!yt(r,t)&&(r[r.length]=t),n-=1;return r})):rt((function(e){return Object(e)!==e?[]:Object.keys(e)})),vt=rt((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function bt(e,t,n,r){var o=it(e);function i(e,t){return gt(e,t,n.slice(),r.slice())}return!st((function(e,t){return!st(i,t,e)}),it(t),o)}function gt(e,t,n,r){if(ut(e,t))return!0;var o=vt(e);if(o!==vt(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!ut(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!ut(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=n.length-1;i>=0;){if(n[i]===e)return r[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&bt(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&bt(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var s=mt(e);if(s.length!==mt(t).length)return!1;var a=n.concat([e]),u=r.concat([t]);for(i=s.length-1;i>=0;){var c=s[i];if(!at(c,t)||!gt(t[c],e[c],a,u))return!1;i-=1}return!0}var wt=ot((function(e,t){return gt(e,t,[],[])}));const _t=wt;function Ot(e,t,n,r){var o,i=function(o){for(var i=t.length,s=0;s<i;){if(e===t[s])return n[s];s+=1}for(var a in t[s+1]=e,n[s+1]=o,e)o[a]=r?Ot(e[a],t,n,!0):e[a];return o};switch(vt(e)){case"Object":return i({});case"Array":return i([]);case"Date":return new Date(e.valueOf());case"RegExp":return o=e,new RegExp(o.source,(o.global?"g":"")+(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.sticky?"y":"")+(o.unicode?"u":""));default:return e}}const St=rt((function(e){return null!=e&&"function"==typeof e.clone?e.clone():Ot(e,[],[],!0)}));function Et(e){return function t(n,r,o){switch(arguments.length){case 0:return t;case 1:return nt(n)?t:ot((function(t,r){return e(n,t,r)}));case 2:return nt(n)&&nt(r)?t:nt(n)?ot((function(t,n){return e(t,r,n)})):nt(r)?ot((function(t,r){return e(n,t,r)})):rt((function(t){return e(n,r,t)}));default:return nt(n)&&nt(r)&&nt(o)?t:nt(n)&&nt(r)?ot((function(t,n){return e(t,n,o)})):nt(n)&&nt(o)?ot((function(t,n){return e(t,r,n)})):nt(r)&&nt(o)?ot((function(t,r){return e(n,t,r)})):nt(n)?rt((function(t){return e(t,r,o)})):nt(r)?rt((function(t){return e(n,t,o)})):nt(o)?rt((function(t){return e(n,r,t)})):e(n,r,o)}}}const jt=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};var Pt=rt((function(e){return!!jt(e)||!!e&&"object"==typeof e&&!function(e){return"[object String]"===Object.prototype.toString.call(e)}(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1))}));const xt=Pt;var At=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),Tt=ot((function(e,t){return function(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,n){return t.apply(this,arguments)};case 3:return function(e,n,r){return t.apply(this,arguments)};case 4:return function(e,n,r,o){return t.apply(this,arguments)};case 5:return function(e,n,r,o,i){return t.apply(this,arguments)};case 6:return function(e,n,r,o,i,s){return t.apply(this,arguments)};case 7:return function(e,n,r,o,i,s,a){return t.apply(this,arguments)};case 8:return function(e,n,r,o,i,s,a,u){return t.apply(this,arguments)};case 9:return function(e,n,r,o,i,s,a,u,c){return t.apply(this,arguments)};case 10:return function(e,n,r,o,i,s,a,u,c,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}(e.length,(function(){return e.apply(t,arguments)}))}));const kt=Tt;function Dt(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function It(e,t,n,r){return e["@@transducer/result"](n[r](kt(e["@@transducer/step"],e),t))}var Nt="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function Ct(e,t,n){if("function"==typeof e&&(e=function(e){return new At(e)}(e)),xt(n))return function(e,t,n){for(var r=0,o=n.length;r<o;){if((t=e["@@transducer/step"](t,n[r]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r+=1}return e["@@transducer/result"](t)}(e,t,n);if("function"==typeof n["fantasy-land/reduce"])return It(e,t,n,"fantasy-land/reduce");if(null!=n[Nt])return Dt(e,t,n[Nt]());if("function"==typeof n.next)return Dt(e,t,n);if("function"==typeof n.reduce)return It(e,t,n,"reduce");throw new TypeError("reduce: list must be array or iterable")}const Mt=Et(Ct);function Bt(e){return"[object Object]"===Object.prototype.toString.call(e)}var Ut=Et((function(e,t,n){var r,o={};for(r in t)at(r,t)&&(o[r]=at(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)at(r,n)&&!at(r,o)&&(o[r]=n[r]);return o}));const Rt=Ut;var $t=Et((function e(t,n,r){return Rt((function(n,r,o){return Bt(r)&&Bt(o)?e(t,r,o):t(n,r,o)}),n,r)}));const Kt=$t,Lt=ot((function(e,t){return Kt((function(e,t,n){return n}),e,t)}));var Ft,qt;function Wt(e,t){return n=>{if(!e(n))return"function"==typeof t?t(n):t}}(qt=Ft||(Ft={})).Array="Array",qt.Boolean="Boolean",qt.ConceptUuid="ConceptUuid",qt.Number="Number",qt.Object="Object",qt.String="String",qt.UUID="UUID",qt.PersonAttributeTypeUuid="PersonAttributeTypeUuid",qt.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid";const Gt=Wt((e=>Array.isArray(e)),"must be an array"),zt=Wt((e=>"boolean"==typeof e),"must be a boolean"),Vt=Wt((e=>"number"==typeof e),"must be a number"),Ht=Wt((e=>"string"==typeof e),"must be a string"),Yt=Wt((e=>"object"==typeof e&&!Array.isArray(e)&&null!==e),"must be an object (not an array or null)"),Jt=Wt((e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e)),"must be a valid UUID or a 36-character hexadecimal string");var Qt=n(403);const Xt=(0,Qt.createGlobalStore)("config-internal",{providedConfigs:[],schemas:{}}),Zt=(0,Qt.createGlobalStore)("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});Zt.subscribe((e=>{var t;t=e.config,localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}));const en=(0,Qt.createGlobalStore)("config-store-of-extension-state",{mountedExtensions:[]});function tn(e){return(0,Qt.getGlobalStore)(`config-module-${e}`,{config:null,loaded:!1})}function nn(){return(0,Qt.getGlobalStore)("config-extension-slots",{slots:{}})}function rn(e,t){const n=e.slots[t];return null!=n?n:{loaded:!1,config:{}}}function on(){return(0,Qt.getGlobalStore)("config-extensions",{configs:{}})}function sn(e,t,n){var r;const o=null===(r=e.configs[t])||void 0===r?void 0:r[n];return null!=o?o:{loaded:!1,config:null}}const an=(0,Qt.createGlobalStore)("config-implementer-tools",{config:{}});function un(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){un(e,t,n[t])}))}return e}function ln(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function fn(e,t){for(let n of Object.keys(e.schemas)){const r=wn(n,e,t);tn(n).setState({loaded:!0,config:r})}}function hn(e,t){const n=function(e,t){const n=On(gn(e,t)),r=Object.keys(n).reduce(((e,t)=>{var r,o;return(null===(r=n[t])||void 0===r?void 0:r.extensionSlots)&&(e[t]=null===(o=n[t])||void 0===o?void 0:o.extensionSlots),e}),{});!function(e){for(let[t,n]of Object.entries(e))for(let[e,r]of Object.entries(n))bn(r,t,e)}(r);return Object.keys(r).reduce(((e,t)=>cn({},e,r[t])),{})}(e,t),r=Object.fromEntries(Object.entries(n).map((([e,t])=>[e,{loaded:!0,config:t}]))),o=nn(),i=o.getState(),s={slots:cn({},i.slots,r)};_t(i,s)||o.setState(s)}function pn(e,t){const n=function(e,t){let n=mn(St(e.schemas));const r=[...e.providedConfigs.map((e=>[e.config,e.source])),[t.config,"temporary config"]];for(let[e,t]of r)n=On([n,vn(e,t)]);return n}(e,t);an.setState({config:n})}function dn(e,t,n){const r={};for(let o of t.mountedExtensions){const t=yn(o.slotModuleName,o.extensionModuleName,o.slotName,o.extensionId,e,n);r[o.slotName]=ln(cn({},r[o.slotName]),{[o.extensionId]:{config:t,loaded:!0}})}on().setState({configs:r})}function yn(e,t,n,r,o,i){var s,a,u;const c=function(e){const[t]=e.split("#");return t}(r),l=o.schemas[c],f=l?c:t,h=gn(o,i),p=_n(e,h);var d;const y=null!==(d=null==p||null===(s=p.extensionSlots)||void 0===s||null===(a=s[n])||void 0===a||null===(u=a.configure)||void 0===u?void 0:u[r])&&void 0!==d?d:{},m=On([_n(f,h),y]),v=null!=l?l:o.schemas[t];Sn(v,m,f);const b=An(v,m);return jn(v,b,f),delete b.extensionSlots,b}function mn(e){return e.hasOwnProperty("_default")?ln(cn({},e),{_value:e._default,_source:"default"}):kn(e)?Object.keys(e).reduce(((t,n)=>(t[n]=mn(e[n]),t)),{}):{}}function vn(e,t){return kn(e)?Object.keys(e).reduce(((n,r)=>(n[r]=vn(e[r],t),n)),{}):{_value:e,_source:t}}function bn(e,t,n){const r=`Extension slot config '${t}.extensionSlots.${n}`,o=Object.keys(e).filter((e=>!["add","remove","order","configure"].includes(e)));o.length&&console.error(r+`' contains invalid keys '${o.join("', '")}'`),e.add&&(Array.isArray(e.add)&&e.add.every((e=>"string"==typeof e))||console.error(r+".add' is invalid. Must be an array of strings (extension IDs)")),e.remove&&(Array.isArray(e.remove)&&e.remove.every((e=>"string"==typeof e))||console.error(r+".remove' is invalid. Must be an array of strings (extension IDs)")),e.order&&(Array.isArray(e.order)&&e.order.every((e=>"string"==typeof e))||console.error(r+".order' is invalid. Must be an array of strings (extension IDs)")),e.configure&&(kn(e.configure)||console.error(r+".configure' is invalid. Must be an object with extension IDs for keys"))}function gn(e,t){return[...e.providedConfigs.map((e=>e.config)),t.config]}function wn(e,t,n){if(!t.schemas.hasOwnProperty(e))throw Error("No config schema has been defined for "+e);const r=t.schemas[e],o=_n(e,gn(t,n));Sn(r,o,e);const i=An(r,o);return jn(r,i,e),delete i.extensionSlots,i}function _n(e,t){const n=t.map((({[e]:t})=>t)).filter((e=>!!e));return On(n)}function On(e){return Mt(Lt)({},e)}function Sn(e,t,n=""){for(const r of Object.keys(t)){const o=t[r],i=n+"."+r,s=e[r];e.hasOwnProperty(r)?En(s,o,i):"extensionSlots"===r&&""!==n||console.error(`Unknown config key '${i}' provided. Ignoring.`)}}function En(e,t,n){Pn(n,e._type,t),kn(t)?e._type===Ft.Object?function(e,t,n){if(e._elements)for(const r of Object.keys(t)){const o=t[r];Sn(e._elements,o,`${n}.${r}`)}}(e,t,n):e.hasOwnProperty("_default")||Sn(e,t,n):e._type===Ft.Array&&function(e,t,n){if(Tn(e._elements))for(let r=0;r<t.length;r++)En(e._elements,t[r],`${n}[${r}]`);for(let o=0;o<t.length;o++){var r;Pn(`${n}[${o}]`,null===(r=e._elements)||void 0===r?void 0:r._type,t[o])}}(e,t,n)}function jn(e,t,n=""){if(e)if(t!==e._default&&xn(n,e._validators,t),kn(t))for(const r of Object.keys(t)){const o=t[r],i=n+"."+r,s=e[r];e._type===Ft.Object&&e._elements?jn(e._elements,o,i):jn(s,o,i)}else if(Array.isArray(t)&&e._elements)for(let r=0;r<t.length;r++)jn(e._elements,t[r],`${n}[${r}]`)}function Pn(e,t,n){t&&xn(e,[{Array:Gt,Boolean:zt,ConceptUuid:Jt,Number:Vt,Object:Yt,String:Ht,UUID:Jt,PersonAttributeTypeUuid:Jt,PatientIdentifierTypeUuid:Jt}[t]],n)}function xn(e,t,n){if(t)try{for(let r of t){const t=r(n);"string"==typeof t&&("object"==typeof n?console.error(`Invalid configuration for ${e}: ${t}`):console.error(`Invalid configuration value ${n} for ${e}: ${t}`))}}catch(t){console.error(`Skipping invalid validator at "${e}". Encountered error\n\t${t}`)}}fn(Xt.getState(),Zt.getState()),Xt.subscribe((e=>fn(e,Zt.getState()))),Zt.subscribe((e=>fn(Xt.getState(),e))),pn(Xt.getState(),Zt.getState()),Xt.subscribe((e=>pn(e,Zt.getState()))),Zt.subscribe((e=>pn(Xt.getState(),e))),hn(Xt.getState(),Zt.getState()),Xt.subscribe((e=>hn(e,Zt.getState()))),Zt.subscribe((e=>hn(Xt.getState(),e))),dn(Xt.getState(),en.getState(),Zt.getState()),Xt.subscribe((e=>{dn(e,en.getState(),Zt.getState())})),en.subscribe((e=>{dn(Xt.getState(),e,Zt.getState())})),Zt.subscribe((e=>{dn(Xt.getState(),en.getState(),e)}));const An=(e,t)=>{const n=St(t);if(!e)return n;for(const t of Object.keys(e)){const r=n[t],o=e[t];if(o&&o.hasOwnProperty("_default")){n.hasOwnProperty(t)||(n[t]=o._default);const e=o._elements;if(r&&Tn(e))if(o._type===Ft.Array&&Array.isArray(r)){const o=r.map((t=>An(e,t)));n[t]=o}else if(o._type===Ft.Object)for(let t of Object.keys(r))r[t]=An(e,r[t])}else if(kn(o)){const e=n.hasOwnProperty(t)?r:{};kn(e)&&(n[t]=An(o,e))}}return n};function Tn(e){return!!e&&Object.keys(e).filter((e=>!["_default","_validators"].includes(e))).length>0}function kn(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}Ft.Array,Ft.Object;var Dn=Object.freeze({__proto__:null,get start(){return ho},get ensureJQuerySupport(){return Kr},get setBootstrapMaxTime(){return _r},get setMountMaxTime(){return Or},get setUnmountMaxTime(){return Sr},get setUnloadMaxTime(){return Er},get registerApplication(){return Xr},get unregisterApplication(){return eo},get getMountedApps(){return Yr},get getAppStatus(){return Qr},get unloadApplication(){return to},get checkActivityFunctions(){return Zr},get getAppNames(){return Jr},get pathToActiveWhen(){return oo},get navigateToUrl(){return Ir},get triggerAppChange(){return uo},get addErrorHandler(){return Rn},get removeErrorHandler(){return $n},get mountRootParcel(){return mr},get NOT_LOADED(){return Fn},get LOADING_SOURCE_CODE(){return qn},get NOT_BOOTSTRAPPED(){return Wn},get BOOTSTRAPPING(){return Gn},get NOT_MOUNTED(){return zn},get MOUNTING(){return Vn},get UPDATING(){return Yn},get LOAD_ERROR(){return Qn},get MOUNTED(){return Hn},get UNMOUNTING(){return Jn},get SKIP_BECAUSE_BROKEN(){return Xn}});function In(e){return(In="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Nn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Cn=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{}).CustomEvent,Mn=function(){try{var e=new Cn("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?Cn:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=Boolean(t.bubbles),n.cancelable=Boolean(t.cancelable),n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n},Bn=[];function Un(e,t,n){var r=Ln(e,t,n);Bn.length?Bn.forEach((function(e){return e(r)})):setTimeout((function(){throw r}))}function Rn(e){if("function"!=typeof e)throw Error(Kn(28,!1));Bn.push(e)}function $n(e){if("function"!=typeof e)throw Error(Kn(29,!1));var t=!1;return Bn=Bn.filter((function(n){var r=n===e;return t=t||r,!r})),t}function Kn(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(e,": ").concat(t?t+" ":"","See https://single-spa.js.org/error/?code=").concat(e).concat(r.length?"&arg=".concat(r.join("&arg=")):"")}function Ln(e,t,n){var r,o="".concat(rr(t)," '").concat(tr(t),"' died in status ").concat(t.status,": ");if(e instanceof Error){try{e.message=o+e.message}catch(e){}r=e}else{console.warn(Kn(30,!1,t.status,tr(t)));try{r=Error(o+JSON.stringify(e))}catch(t){r=e}}return r.appOrParcelName=tr(t),t.status=n,r}var Fn="NOT_LOADED",qn="LOADING_SOURCE_CODE",Wn="NOT_BOOTSTRAPPED",Gn="BOOTSTRAPPING",zn="NOT_MOUNTED",Vn="MOUNTING",Hn="MOUNTED",Yn="UPDATING",Jn="UNMOUNTING",Qn="LOAD_ERROR",Xn="SKIP_BECAUSE_BROKEN";function Zn(e){return e.status===Hn}function er(e){try{return e.activeWhen(window.location)}catch(t){return Un(t,e,Xn),!1}}function tr(e){return e.name}function nr(e){return Boolean(e.unmountThisParcel)}function rr(e){return nr(e)?"parcel":"application"}function or(){for(var e=arguments.length-1;e>0;e--)for(var t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function ir(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function sr(e){return e&&("function"==typeof e||(t=e,Array.isArray(t)&&!ir(t,(function(e){return"function"!=typeof e}))));var t}function ar(e,t){var n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[function(){return Promise.resolve()}]);var r=rr(e),o=tr(e);return function(e){return n.reduce((function(n,i,s){return n.then((function(){var n=i(e);return ur(n)?n:Promise.reject(Kn(15,!1,r,o,t,s))}))}),Promise.resolve())}}function ur(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}function cr(e,t){return Promise.resolve().then((function(){return e.status!==Wn?e:(e.status=Gn,e.bootstrap?jr(e,"bootstrap").then(n).catch((function(n){if(t)throw Ln(n,e,Xn);return Un(n,e,Xn),e})):Promise.resolve().then(n))}));function n(){return e.status=zn,e}}function lr(e,t){return Promise.resolve().then((function(){if(e.status!==Hn)return e;e.status=Jn;var n=Object.keys(e.parcels).map((function(t){return e.parcels[t].unmountThisParcel()}));return Promise.all(n).then(r,(function(n){return r().then((function(){var r=Error(n.message);if(t)throw Ln(r,e,Xn);Un(r,e,Xn)}))})).then((function(){return e}));function r(){return jr(e,"unmount").then((function(){e.status=zn})).catch((function(n){if(t)throw Ln(n,e,Xn);Un(n,e,Xn)}))}}))}var fr=!1,hr=!1;function pr(e,t){return Promise.resolve().then((function(){return e.status!==zn?e:(fr||(window.dispatchEvent(new Mn("single-spa:before-first-mount")),fr=!0),jr(e,"mount").then((function(){return e.status=Hn,hr||(window.dispatchEvent(new Mn("single-spa:first-mount")),hr=!0),e})).catch((function(n){return e.status=Hn,lr(e,!0).then(r,r);function r(){if(t)throw Ln(n,e,Xn);return Un(n,e,Xn),e}})))}))}var dr=0,yr={parcels:{}};function mr(){return vr.apply(yr,arguments)}function vr(e,t){var n=this;if(!e||"object"!==In(e)&&"function"!=typeof e)throw Error(Kn(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(Kn(3,!1,In(e.name)));if("object"!==In(t))throw Error(Kn(4,!1,name,In(t)));if(!t.domElement)throw Error(Kn(5,!1,name));var r,o=dr++,i="function"==typeof e,s=i?e:function(){return Promise.resolve(e)},a={id:o,parcels:{},status:i?qn:Wn,customProps:t,parentName:tr(n),unmountThisParcel:function(){return h.then((function(){if(a.status!==Hn)throw Error(Kn(6,!1,name,a.status));return lr(a,!0)})).then((function(e){return a.parentName&&delete n.parcels[a.id],e})).then((function(e){return c(e),e})).catch((function(e){throw a.status=Xn,l(e),e}))}};n.parcels[o]=a;var u=s();if(!u||"function"!=typeof u.then)throw Error(Kn(7,!1));var c,l,f=(u=u.then((function(e){if(!e)throw Error(Kn(8,!1));var t=e.name||"parcel-".concat(o);if(Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!sr(e.bootstrap))throw Error(Kn(9,!1,t));if(!sr(e.mount))throw Error(Kn(10,!1,t));if(!sr(e.unmount))throw Error(Kn(11,!1,t));if(e.update&&!sr(e.update))throw Error(Kn(12,!1,t));var n=ar(e,"bootstrap"),i=ar(e,"mount"),s=ar(e,"unmount");a.status=Wn,a.name=t,a.bootstrap=n,a.mount=i,a.unmount=s,a.timeouts=Pr(e.timeouts),e.update&&(a.update=ar(e,"update"),r.update=function(e){return a.customProps=e,br(function(e){return Promise.resolve().then((function(){if(e.status!==Hn)throw Error(Kn(32,!1,tr(e)));return e.status=Yn,jr(e,"update").then((function(){return e.status=Hn,e})).catch((function(t){throw Ln(t,e,Xn)}))}))}(a))})}))).then((function(){return cr(a,!0)})),h=f.then((function(){return pr(a,!0)})),p=new Promise((function(e,t){c=e,l=t}));return r={mount:function(){return br(Promise.resolve().then((function(){if(a.status!==zn)throw Error(Kn(13,!1,name,a.status));return n.parcels[o]=a,pr(a)})))},unmount:function(){return br(a.unmountThisParcel())},getStatus:function(){return a.status},loadPromise:br(u),bootstrapPromise:br(f),mountPromise:br(h),unmountPromise:br(p)}}function br(e){return e.then((function(){return null}))}function gr(e){var t=tr(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!==In(n)||null===n||Array.isArray(n))&&(n={},console.warn(Kn(40,!1),t,n));var r=or({},n,{name:t,mountParcel:vr.bind(e),singleSpa:Dn});return nr(e)&&(r.unmountSelf=e.unmountThisParcel),r}var wr={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function _r(e,t,n){if("number"!=typeof e||e<=0)throw Error(Kn(16,!1));wr.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function Or(e,t,n){if("number"!=typeof e||e<=0)throw Error(Kn(17,!1));wr.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function Sr(e,t,n){if("number"!=typeof e||e<=0)throw Error(Kn(18,!1));wr.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function Er(e,t,n){if("number"!=typeof e||e<=0)throw Error(Kn(19,!1));wr.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function jr(e,t){var n=e.timeouts[t],r=n.warningMillis,o=rr(e);return new Promise((function(i,s){var a=!1,u=!1;e[t](gr(e)).then((function(e){a=!0,i(e)})).catch((function(e){a=!0,s(e)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),n.millis);var c=Kn(31,!1,t,o,tr(e),n.millis);function l(e){if(!a)if(!0===e)u=!0,n.dieOnTimeout?s(Error(c)):console.error(c);else if(!u){var t=e,o=t*r;console.warn(c),o+r<n.millis&&setTimeout((function(){return l(t+1)}),r)}}}))}function Pr(e){var t={};for(var n in wr)t[n]=or({},wr[n],e&&e[n]||{});return t}function xr(e){return Promise.resolve().then((function(){return e.loadPromise?e.loadPromise:e.status!==Fn&&e.status!==Qn?e:(e.status=qn,e.loadPromise=Promise.resolve().then((function(){var r=e.loadApp(gr(e));if(!ur(r))throw n=!0,Error(Kn(33,!1,tr(e)));return r.then((function(n){var r;e.loadErrorTime=null,"object"!==In(t=n)&&(r=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!sr(t.bootstrap)&&(r=35),sr(t.mount)||(r=36),sr(t.unmount)||(r=37);var o=rr(t);if(r){var i;try{i=JSON.stringify(t)}catch(e){}return console.error(Kn(r,!1,o,tr(e),i),t),Un(void 0,e,Xn),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=or({},e.devtools.overlays,t.devtools.overlays)),e.status=Wn,e.bootstrap=ar(t,"bootstrap"),e.mount=ar(t,"mount"),e.unmount=ar(t,"unmount"),e.unload=ar(t,"unload"),e.timeouts=Pr(t.timeouts),delete e.loadPromise,e}))})).catch((function(t){var r;return delete e.loadPromise,n?r=Xn:(r=Qn,e.loadErrorTime=(new Date).getTime()),Un(t,e,r),e})));var t,n}))}var Ar,Tr="undefined"!=typeof window,kr={hashchange:[],popstate:[]},Dr=["hashchange","popstate"];function Ir(e){var t;if("string"==typeof e)t=e;else if(this&&this.href)t=this.href;else{if(!(e&&e.currentTarget&&e.currentTarget.href&&e.preventDefault))throw Error(Kn(14,!1));t=e.currentTarget.href,e.preventDefault()}var n=Rr(window.location.href),r=Rr(t);0===t.indexOf("#")?window.location.hash=r.hash:n.host!==r.host&&r.host?window.location.href=t:r.pathname===n.pathname&&r.search===n.search?window.location.hash=r.hash:window.history.pushState(null,null,t)}function Nr(e){var t=this;if(e){var n=e[0].type;Dr.indexOf(n)>=0&&kr[n].forEach((function(n){try{n.apply(t,e)}catch(e){setTimeout((function(){throw e}))}}))}}function Cr(){co([],arguments)}function Mr(e,t){return function(){var n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return Ar&&n===o||(po()?window.dispatchEvent(function(e,t){var n;try{n=new PopStateEvent("popstate",{state:e})}catch(t){(n=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return n.singleSpa=!0,n.singleSpaTrigger=t,n}(window.history.state,t)):co([])),r}}if(Tr){window.addEventListener("hashchange",Cr),window.addEventListener("popstate",Cr);var Br=window.addEventListener,Ur=window.removeEventListener;window.addEventListener=function(e,t){if(!("function"==typeof t&&Dr.indexOf(e)>=0)||ir(kr[e],(function(e){return e===t})))return Br.apply(this,arguments);kr[e].push(t)},window.removeEventListener=function(e,t){if(!("function"==typeof t&&Dr.indexOf(e)>=0))return Ur.apply(this,arguments);kr[e]=kr[e].filter((function(e){return e!==t}))},window.history.pushState=Mr(window.history.pushState,"pushState"),window.history.replaceState=Mr(window.history.replaceState,"replaceState"),window.singleSpaNavigate?console.warn(Kn(41,!1)):window.singleSpaNavigate=Ir}function Rr(e){var t=document.createElement("a");return t.href=e,t}var $r=!1;function Kr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!$r){var t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return Lr.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return Lr.call(this,n,window.removeEventListener,e,t,arguments)},$r=!0}}function Lr(e,t,n,r,o){return"string"!=typeof n?e.apply(this,o):(n.split(/\s+/).forEach((function(e){Dr.indexOf(e)>=0&&(t(e,r),n=n.replace(e,""))})),""===n.trim()?this:e.apply(this,o))}var Fr={};function qr(e){return Promise.resolve().then((function(){var t=Fr[tr(e)];if(!t)return e;if(e.status===Fn)return Wr(e,t),e;if("UNLOADING"===e.status)return t.promise.then((function(){return e}));if(e.status!==zn&&e.status!==Qn)return e;var n=e.status===Qn?Promise.resolve():jr(e,"unload");return e.status="UNLOADING",n.then((function(){return Wr(e,t),e})).catch((function(n){return function(e,t,n){delete Fr[tr(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,Un(n,e,Xn),t.reject(n)}(e,t,n),e}))}))}function Wr(e,t){delete Fr[tr(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=Fn,t.resolve()}function Gr(e,t,n,r){Fr[tr(e)]={app:e,resolve:n,reject:r},Object.defineProperty(Fr[tr(e)],"promise",{get:t})}function zr(e){return Fr[e]}var Vr=[];function Hr(){var e=[],t=[],n=[],r=[],o=(new Date).getTime();return Vr.forEach((function(i){var s=i.status!==Xn&&er(i);switch(i.status){case Qn:s&&o-i.loadErrorTime>=200&&n.push(i);break;case Fn:case qn:s&&n.push(i);break;case Wn:case zn:!s&&zr(tr(i))?e.push(i):s&&r.push(i);break;case Hn:s||t.push(i)}})),{appsToUnload:e,appsToUnmount:t,appsToLoad:n,appsToMount:r}}function Yr(){return Vr.filter(Zn).map(tr)}function Jr(){return Vr.map(tr)}function Qr(e){var t=ir(Vr,(function(t){return tr(t)===e}));return t?t.status:null}function Xr(e,t,n,r){var o=function(e,t,n,r){var o,i={name:null,loadApp:null,activeWhen:null,customProps:null};return"object"===In(e)?(function(e){if(Array.isArray(e)||null===e)throw Error(Kn(39,!1));var t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((function(e,n){return t.indexOf(n)>=0?e:e.concat(n)}),[]);if(0!==n.length)throw Error(Kn(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length)throw Error(Kn(20,!1));if("object"!==In(e.app)&&"function"!=typeof e.app)throw Error(Kn(20,!1));var r=function(e){return"string"==typeof e||"function"==typeof e};if(!(r(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(r)))throw Error(Kn(24,!1));if(!ro(e.customProps))throw Error(Kn(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,r){if("string"!=typeof e||0===e.length)throw Error(Kn(20,!1));if(!t)throw Error(Kn(23,!1));if("function"!=typeof n)throw Error(Kn(24,!1));if(!ro(r))throw Error(Kn(22,!1))}(e,t,n,r),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=r),i.loadApp="function"!=typeof(o=i.loadApp)?function(){return Promise.resolve(o)}:o,i.customProps=function(e){return e||{}}(i.customProps),i.activeWhen=function(e){var t=Array.isArray(e)?e:[e];return t=t.map((function(e){return"function"==typeof e?e:oo(e)})),function(e){return t.some((function(t){return t(e)}))}}(i.activeWhen),i}(e,t,n,r);if(-1!==Jr().indexOf(o.name))throw Error(Kn(21,!1,o.name));Vr.push(or({loadErrorTime:null,status:Fn,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},o)),Tr&&(Kr(),co())}function Zr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location;return Vr.filter((function(t){return t.activeWhen(e)})).map(tr)}function eo(e){if(0===Vr.filter((function(t){return tr(t)===e})).length)throw Error(Kn(25,!1,e));return to(e).then((function(){var t=Vr.map(tr).indexOf(e);Vr.splice(t,1)}))}function to(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof e)throw Error(Kn(26,!1));var n=ir(Vr,(function(t){return tr(t)===e}));if(!n)throw Error(Kn(27,!1,e));var r,o=zr(tr(n));if(t&&t.waitForUnmount){if(o)return o.promise;var i=new Promise((function(e,t){Gr(n,(function(){return i}),e,t)}));return i}return o?(r=o.promise,no(n,o.resolve,o.reject)):r=new Promise((function(e,t){Gr(n,(function(){return r}),e,t),no(n,e,t)})),r}function no(e,t,n){lr(e).then(qr).then((function(){t(),setTimeout((function(){co()}))})).catch(n)}function ro(e){return!e||"function"==typeof e||"object"===In(e)&&null!==e&&!Array.isArray(e)}function oo(e,t){var n=function(e,t){var n=0,r=!1,o="^";"/"!==e[0]&&(e="/"+e);for(var i=0;i<e.length;i++){var s=e[i];(!r&&":"===s||r&&"/"===s)&&a(i)}return a(e.length),new RegExp(o,"i");function a(i){var s=e.slice(n,i).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=r?"[^/]+/?":s,i===e.length)if(r)t&&(o+="$");else{var a=t?"":".*";o="/"===o.charAt(o.length-1)?"".concat(o).concat(a,"$"):"".concat(o,"(/").concat(a,")?(#.*)?$")}r=!r,n=i}}(e,t);return function(e){var t=e.origin;t||(t="".concat(e.protocol,"//").concat(e.host));var r=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(r)}}var io=!1,so=[],ao=Tr&&window.location.href;function uo(){return co()}function co(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(io)return new Promise((function(e,n){so.push({resolve:e,reject:n,eventArguments:t})}));var n,r=Hr(),o=r.appsToUnload,i=r.appsToUnmount,s=r.appsToLoad,a=r.appsToMount,u=!1,c=ao,l=ao=window.location.href;return po()?(io=!0,n=o.concat(s,i,a),Promise.resolve().then((function(){if(window.dispatchEvent(new Mn(0===n.length?"single-spa:before-no-app-change":"single-spa:before-app-change",d(!0))),window.dispatchEvent(new Mn("single-spa:before-routing-event",d(!0,{cancelNavigation:f}))),u)return window.dispatchEvent(new Mn("single-spa:before-mount-routing-event",d(!0))),h(),void Ir(c);var t=o.map(qr),r=i.map(lr).map((function(e){return e.then(qr)})).concat(t),l=Promise.all(r);l.then((function(){window.dispatchEvent(new Mn("single-spa:before-mount-routing-event",d(!0)))}));var y=s.map((function(e){return xr(e).then((function(e){return lo(e,l)}))})),m=a.filter((function(e){return s.indexOf(e)<0})).map((function(e){return lo(e,l)}));return l.catch((function(e){throw p(),e})).then((function(){return p(),Promise.all(y.concat(m)).catch((function(t){throw e.forEach((function(e){return e.reject(t)})),t})).then(h)}))}))):(n=s,Promise.resolve().then((function(){var e=s.map(xr);return Promise.all(e).then(p).then((function(){return[]})).catch((function(e){throw p(),e}))})));function f(){u=!0}function h(){var t=Yr();e.forEach((function(e){return e.resolve(t)}));try{var r=0===n.length?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new Mn(r,d())),window.dispatchEvent(new Mn("single-spa:routing-event",d()))}catch(e){setTimeout((function(){throw e}))}if(io=!1,so.length>0){var o=so;so=[],co(o)}return t}function p(){e.forEach((function(e){Nr(e.eventArguments)})),Nr(t)}function d(){var e,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],f=arguments.length>1?arguments[1]:void 0,h={},p=(Nn(e={},Hn,[]),Nn(e,zn,[]),Nn(e,Fn,[]),Nn(e,Xn,[]),e);r?(s.concat(a).forEach((function(e,t){y(e,Hn)})),o.forEach((function(e){y(e,Fn)})),i.forEach((function(e){y(e,zn)}))):n.forEach((function(e){y(e)}));var d={detail:{newAppStatuses:h,appsByNewStatus:p,totalAppChanges:n.length,originalEvent:null==t?void 0:t[0],oldUrl:c,newUrl:l,navigationIsCanceled:u}};return f&&or(d.detail,f),d;function y(e,t){var n=tr(e);t=t||Qr(n),h[n]=t,(p[t]=p[t]||[]).push(n)}}}function lo(e,t){return er(e)?cr(e).then((function(e){return t.then((function(){return er(e)?pr(e):e}))})):t.then((function(){return e}))}var fo=!1;function ho(e){var t;fo=!0,e&&e.urlRerouteOnly&&(t=e.urlRerouteOnly,Ar=t),Tr&&co()}function po(){return fo}Tr&&setTimeout((function(){fo||console.warn(Kn(1,!1))}),5e3);var yo={getRawAppData:function(){return[].concat(Vr)},reroute:co,NOT_LOADED:Fn,toLoadPromise:xr,toBootstrapPromise:cr,unregisterApplication:eo};Tr&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=yo);const mo=((e=>{const t=e.concat(["openmrsBase","openmrsSpaBase"]);Wt((e=>{if(!e||"string"!=typeof e)return!1;const n=/\${(.*?)}/g;let r=n.exec(e);for(;r;){if(!t.includes(r[1]))return!1;r=n.exec(e)}return!0}),"Should be a URL or path. The allowed template parameters are "+t.map((e=>"${"+e+"}")).join(", "))})([]),(0,Qt.createGlobalStore)("extensionsInternal",{slots:{},extensions:{}})),vo=()=>(0,Qt.getGlobalStore)("extensionsInternal",{slots:{},extensions:{}});function bo(e){const t=mo.getState(),n=e(t);n!==t&&mo.setState(n)}const go=()=>(0,Qt.getGlobalStore)("extensions",{slots:{}});function wo(e){const t=[];for(let n of Object.values(e.extensions))for(let e of n.instances)t.push({slotModuleName:e.slotModuleName,extensionModuleName:n.moduleName,slotName:e.slotName,extensionId:e.id});tt(en.getState().mountedExtensions,t)||en.setState({mountedExtensions:t})}wo(mo.getState()),mo.subscribe(wo);var _o=n(840);const Oo=function(e){return void 0===e};function So(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){So(e,t,n[t])}))}return e}function jo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Po=vo(),xo=go(),Ao=nn(),To=on();function ko(e,t,n){const r={};for(let[o,i]of Object.entries(e.slots)){const{config:s}=rn(t,i.name),a=Lo(o,e,s,n);r[o]={moduleName:i.moduleName,assignedExtensions:a}}tt(xo.getState().slots,r)||xo.setState({slots:r})}function Do(e,t){return{moduleName:t,name:e,attachedIds:[],config:null}}function Io(e){const[t]=e.split("#");return t}function No(e,t){const n=Io(t);return e.extensions[n]}function Co(e){return No(Po.getState(),e)}Po.subscribe((e=>{ko(e,Ao.getState(),To.getState())})),Ao.subscribe((e=>{ko(Po.getState(),e,To.getState())})),To.subscribe((e=>{ko(Po.getState(),Ao.getState(),e)}));const Mo=e=>Po.setState((t=>(t.extensions[e.name]=jo(Eo({},e),{instances:[]}),t)));function Bo(e,t){bo((n=>{const r=n.slots[e];return jo(Eo({},n),r?{slots:jo(Eo({},n.slots),{[e]:jo(Eo({},r),{attachedIds:[...r.attachedIds,t]})})}:{slots:jo(Eo({},n.slots),{[e]:jo(Eo({},Do(e)),{attachedIds:[t]})})})}))}function Uo(e,t){bo((n=>{const r=n.slots[e];return r&&r.attachedIds.includes(t)?jo(Eo({},n),{slots:jo(Eo({},n.slots),{[e]:jo(Eo({},r),{attachedIds:r.attachedIds.filter((e=>e!==t))})})}):n}))}function Ro(e){bo((t=>{const n=t.slots[e];return n?jo(Eo({},t),{slots:jo(Eo({},t.slots),{[e]:jo(Eo({},n),{attachedIds:[]})})}):t}))}function $o(e,t,n,r){const o=t.indexOf(e);if(-1!==o)return o;if(void 0!==n)return 1e3+n;{const t=r.indexOf(e);return-1!==t?2e3+t:-1}}function Ko(e,t=null){const n=null!=t?t:navigator.onLine;return e.filter((e=>zo(n,e.online,e.offline)))}function Lo(e,t,n,r){const o=function(e,t){const n=e.add||[],r=e.remove||[],o=e.order||[],{extensions:i}=Po.getState();return[...t,...n].filter((e=>!r.includes(e))).sort(((e,n)=>{var r,s;const a=$o(e,o,null===(r=i[Io(e)])||void 0===r?void 0:r.order,t),u=$o(n,o,null===(s=i[Io(n)])||void 0===s?void 0:s.order,t);return-1===u?-1:-1===a?1:a-u}))}(n,t.slots[e].attachedIds),i=[];let s;for(let n of o){const{config:o}=sn(r,e,n),f=Io(n),h=t.extensions[f];if(h){var a,u,c;const e=null!==(c=null!==(u=null==o||null===(a=o["Display conditions"])||void 0===a?void 0:a.privileges)&&void 0!==u?u:h.privileges)&&void 0!==c?c:[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)){var l;if(Oo(s)&&(s=null===(l=(0,_o.getSessionStore)().getState().session)||void 0===l?void 0:l.user),!s)continue;if(!(0,_o.userHasAccess)(e,s))continue}i.push({id:n,name:f,moduleName:h.moduleName,config:o,meta:h.meta})}}return i}function Fo(e){const t=Po.getState(),{config:n}=function(e){return rn(nn().getState(),e)}(e);return Lo(e,t,n,To.getState())}const qo=(e,t)=>Po.setState((n=>{var r;const o=null===(r=n.slots[t])||void 0===r?void 0:r.moduleName;if(o&&o!=e)return console.warn(`An extension slot with the name '${t}' already exists. Refusing to register the same slot name twice (in "registerExtensionSlot"). The existing one is from module ${o}.`),n;if(o&&o==e)return n;if(n.slots[t])return jo(Eo({},n),{slots:jo(Eo({},n.slots),{[t]:jo(Eo({},n.slots[t]),{moduleName:e})})});const i=Do(t,e);return jo(Eo({},n),{slots:jo(Eo({},n.slots),{[t]:i})})})),Wo=()=>xo.setState((()=>({slots:{},extensions:{}})));function Go(e=!0,t=!1){return zo(navigator.onLine,e,t)}function zo(e,t=!0,n=!1){return Boolean(e?t:n)}function Vo(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Ho(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ho(e,t,n[t])}))}return e}function Jo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Qo(e,t,n,r){return Xo.apply(this,arguments)}function Xo(){var e;return e=function*(e,t,n,r,o=(e=>e),i={}){const s=Io(r),a=Co(r);let u=null;if(e){if(!a)throw Error(`Couldn't find extension '${s}' to attach to '${t}'`);const{load:c,meta:l,moduleName:f,online:h,offline:p}=a;if(Go(h,p)){bo((o=>{const i={domElement:e,id:r,slotName:t,slotModuleName:n};return Jo(Yo({},o),{extensions:Jo(Yo({},o.extensions),{[s]:Jo(Yo({},o.extensions[s]),{instances:[...o.extensions[s].instances,i]})})})}));const a=yield c(),{default:h}=a,p=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(a,["default"]);u=mr(o(null!=h?h:p),Jo(Yo({},i),{_meta:l,_extensionContext:{extensionId:r,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:f},domElement:e}))}}else console.warn(`Tried to render ${r} into ${t} but no DOM element was available.`);return u},Xo=function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){Vo(i,r,o,s,a,"next",e)}function a(e){Vo(i,r,o,s,a,"throw",e)}s(void 0)}))},Xo.apply(this,arguments)}const Zo=vo()})(),_openmrs_esm_extensions=r})();
2
3
  //# sourceMappingURL=openmrs-esm-extensions.js.map