@openmrs/esm-fast-data-entry-app 1.5.1-pre.790 → 1.5.1-pre.794

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/1100.js CHANGED
@@ -9,7 +9,7 @@ If you're the maintainer: the allowed types are ${Object.values(eb).join(", ")}.
9
9
  If you're the maintainer: all config elements must have a default. Received ${JSON.stringify(i)}`),s&&l&&![eb.Array,eb.Object].includes(l)&&console.error(`${e} has bad config schema definition for key '${o}'. ${a}.
10
10
 
11
11
  If you're the maintainer: the 'elements' key only works with '_type' equal to 'Array' or 'Object'. Received ${JSON.stringify(l)}`)}}function eQ(e,t){return e0(t.map(({[e]:t})=>t).filter(e=>!!e))}function e0(e){return e.reduce((e,t)=>ej(e,t),{})}function e1(e,t,n=""){for(let a of Object.keys(t)){let r=t[a],o=n+"."+a,i=e[a];if(!e.hasOwnProperty(a)){("extensionSlots"!==a||""===n)&&e9(o,`Unknown config key '${o}' provided. Ignoring.`);continue}(function e(t,n,a){e3(a,t._type,n),e8(n)?t._type===eb.Object?function(t,n,a){if(t._elements)for(let r of Object.keys(n)){let o=n[r];e(t._elements,o,`${a}.${r}`)}}(t,n,a):t.hasOwnProperty("_default")||t.hasOwnProperty("_type")||e1(t,n,a):t._type===eb.Array&&function(t,n,a){if(e3(a,eb.Array,n)){if(e6(t._elements))for(let r=0;r<n.length;r++)e(t._elements,n[r],`${a}[${r}]`);for(let e=0;e<n.length;e++)e3(`${a}[${e}]`,t._elements?._type,n[e])}}(t,n,a)})(i,r,o)}}eL();function e2(e,t,n=""){if(e){if(t!==e._default&&e4(n,e._validators,t),e8(t))for(let a of Object.keys(t)){let r=t[a],o=n+"."+a,i=e[a];e._type===eb.Object&&e._elements?e2(e._elements,r,o):e2(i,r,o)}else if(Array.isArray(t)&&e._elements)for(let a=0;a<t.length;a++)e2(e._elements,t[a],`${n}[${a}]`)}}function e3(e,t,n){return!t||e4(e,[{Array:ev,Boolean:e$,ConceptUuid:ex,Number:eA,Object:ek,String:ew,UUID:ex,PersonAttributeTypeUuid:ex,PatientIdentifierTypeUuid:ex}[t]],n)}function e4(e,t,n){let a=!0;if(t)try{for(let r of t){let t=r(n);if("string"==typeof t){let r="object"==typeof n?`Invalid configuration for ${e}: ${t}`:`Invalid configuration value ${n} for ${e}: ${t}`;e9(e,r),a=!1}}}catch(t){console.error(`Skipping invalid validator at "${e}". Encountered error
12
- ${t}`)}return a}let e5=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let a=n[t],r=e[t];if(r&&(r.hasOwnProperty("_type")||r.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=r._default);let e=r._elements;if(a&&e6(e)){if(r._type===eb.Array&&Array.isArray(a)){let r=a.map(t=>e5(e,t));n[t]=r}else if(r._type===eb.Object)for(let t of Object.keys(a))a[t]=e5(e,a[t])}}else if(e8(r)){let e=a??{};e8(e)&&(n[t]=e5(r,e))}}return n};function e6(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function e8(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let e7=new Set;function e9(e,t){let n=`${e}:::${t}`;e7||(e7=new Set),e7.has(n)||(console.error(t),e7.add(n))}function te(e){e?e7.forEach(t=>{t.startsWith(e)&&e7.delete(t)}):e7.clear()}function tt(){eR.forEach(e=>e()),eR.length=0,eL()}let tn={"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:eb.Object,_default:{},_validators:[e_(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${t.join(", ")}.`})]}},ta={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:eb.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:eb.String,_default:void 0}},...tn},tr=(e,t)=>e_(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),to=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return e_(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,a=n.exec(e);for(;a;){if(!t.includes(a[1]))return!1;a=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},ti=to([]),ts=e=>e_(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),tl={inRange:tr,isUrl:ti,isUrlWithTemplateParameters:to,oneOf:ts};var tc=n(8067);let tu=V("breadcrumbs",[]);function tp(e){return td([e])}function td(e){let t=[...tf(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,tc.pathToRegexp)(e.matcher).regexp:(0,tc.pathToRegexp)(e.path).regexp,settings:e}))];tu.setState(t,!0)}function tf(){return tu.getState()}function th(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=th(e,n.join("/"));if(t)return t}}(e,t)}function tm(e,t){if(e.length>0){let n=th(e,t);if(n){let t=[n],a=th(e,n.settings.parent);for(;void 0!==a;)t.push(a),a=th(e,a.settings.parent);return t.reverse()}}return[]}function tg(e){return tm(tf(),e)}var ty=Object.freeze({__proto__:null,get start(){return nL},get ensureJQuerySupport(){return ng},get setBootstrapMaxTime(){return t8},get setMountMaxTime(){return t7},get setUnmountMaxTime(){return t9},get setUnloadMaxTime(){return ne},get registerApplication(){return nE},get unregisterApplication(){return nD},get getMountedApps(){return nw},get getAppStatus(){return nx},get unloadApplication(){return nM},get checkActivityFunctions(){return nS},get getAppNames(){return nk},get pathToActiveWhen(){return nP},get navigateToUrl(){return ns},get patchHistoryApi(){return nf},get triggerAppChange(){return nN},get addErrorHandler(){return tA},get removeErrorHandler(){return tw},get mountRootParcel(){return t2},get NOT_LOADED(){return tC},get LOADING_SOURCE_CODE(){return tE},get NOT_BOOTSTRAPPED(){return tS},get BOOTSTRAPPING(){return tD},get NOT_MOUNTED(){return tM},get MOUNTING(){return tz},get UPDATING(){return tP},get LOAD_ERROR(){return tI},get MOUNTED(){return tO},get UNLOADING(){return tB},get UNMOUNTING(){return tT},get SKIP_BECAUSE_BROKEN(){return tN}}),tb=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,t_=!function(){try{var e=new tb("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">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=!!t.bubbles,n.cancelable=!!t.cancelable,n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}:tb;let tv=[];function t$(e,t,n){let a=tx(e,t,n);tv.length?tv.forEach(e=>e(a)):setTimeout(()=>{throw a})}function tA(e){if("function"!=typeof e)throw Error(tk(28,!1));tv.push(e)}function tw(e){if("function"!=typeof e)throw Error(tk(29,!1));let t=!1;return tv=tv.filter(n=>{let a=n===e;return t=t||a,!a}),t}function tk(e,t,...n){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${n.length?`&arg=${n.join("&arg=")}`:""}`}function tx(e,t,n){let a,r=`${tW(t)} '${tF(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=r+e.message}catch(e){}a=e}else{console.warn(tk(30,!1,t.status,tF(t)));try{a=Error(r+JSON.stringify(e))}catch(t){a=e}}return a.appOrParcelName=tF(t),t.status=n,a}let tC="NOT_LOADED",tE="LOADING_SOURCE_CODE",tS="NOT_BOOTSTRAPPED",tD="BOOTSTRAPPING",tM="NOT_MOUNTED",tz="MOUNTING",tO="MOUNTED",tP="UPDATING",tT="UNMOUNTING",tB="UNLOADING",tI="LOAD_ERROR",tN="SKIP_BECAUSE_BROKEN";function tj(e){return e.status===tO}function tR(e){try{return e.activeWhen(window.location)}catch(t){return t$(t,e,tN),!1}}function tF(e){return e.name}function tL(e){return!!e.unmountThisParcel}function tW(e){return tL(e)?"parcel":"application"}function tG(){for(let e=arguments.length-1;e>0;e--)for(let t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function tV(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function tU(e){return e&&("function"==typeof e||Array.isArray(e)&&!tV(e,e=>"function"!=typeof e))}function tq(e,t){let n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[()=>Promise.resolve()]);let a=tW(e),r=tF(e);return function(e){return n.reduce((n,o,i)=>n.then(()=>{let n=o(e);return tH(n)?n:Promise.reject(tk(15,!1,a,r,t,i))}),Promise.resolve())}}function tH(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let tK=[];function tY(e,t){return Promise.resolve().then(()=>e.status!==tS?e:(e.status=tD,e.bootstrap?nt(e,"bootstrap").then(n).catch(n=>{if(t)throw tx(n,e,tN);return t$(n,e,tN),e}):Promise.resolve().then(n)));function n(){return e.status=tM,e}}function tJ(e,t){return Promise.resolve().then(()=>{if(e.status!==tO)return e;return e.status=tT,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(n,a=>n().then(()=>{let n=Error(a.message);if(t)throw tx(n,e,tN);t$(n,e,tN)})).then(()=>e);function n(){return nt(e,"unmount").then(()=>{e.status=tM},n=>{if(t)throw tx(n,e,tN);t$(n,e,tN)})}})}let tZ=!1,tX=!1;function tQ(e,t){return Promise.resolve().then(()=>e.status!==tM?e:(tZ||(window.dispatchEvent(new t_("single-spa:before-first-mount")),tZ=!0),e.status=tz,nt(e,"mount").then(()=>(e.status=tO,tX||(window.dispatchEvent(new t_("single-spa:first-mount")),tX=!0),e)).catch(n=>{return e.status=tO,tJ(e,!0).then(a,a);function a(){if(t)throw tx(n,e,tN);return t$(n,e,tN),e}})))}let t0=0,t1={parcels:{}};function t2(){return t3.apply(t1,arguments)}function t3(e,t){let n,a,r,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(tk(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(tk(3,!1,typeof e.name));let i=t0++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(tk(4,!1,s,typeof t));if(!t.domElement)throw Error(tk(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:i,parcels:{},status:l?tE:tS,customProps:t,parentName:tF(o),unmountThisParcel:()=>f.then(()=>{if(u.status!==tO)throw Error(tk(6,!1,s,u.status));return tJ(u,!0)}).then(e=>(u.parentName&&delete o.parcels[u.id],e)).then(e=>(a(e),e)).catch(e=>{throw u.status=tN,r(e),e})};o.parcels[i]=u;let p=c();if(!p||"function"!=typeof p.then)throw Error(tk(7,!1));let d=(p=p.then(e=>{if(!e)throw Error(tk(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!tU(e.bootstrap))throw Error(tk(9,!1,s));if(!tU(e.mount))throw Error(tk(10,!1,s));if(!tU(e.unmount))throw Error(tk(11,!1,s));if(e.update&&!tU(e.update))throw Error(tk(12,!1,s));let t=tq(e,"bootstrap"),a=tq(e,"mount"),r=tq(e,"unmount");u.status=tS,u.name=s,u.bootstrap=t,u.mount=a,u.unmount=r,u.timeouts=nn(e.timeouts),e.update&&(u.update=tq(e,"update"),n.update=function(e){return u.customProps=e,t4(Promise.resolve().then(()=>{if(u.status!==tO)throw Error(tk(32,!1,tF(u)));return u.status=tP,nt(u,"update").then(()=>(u.status=tO,u)).catch(e=>{throw tx(e,u,tN)})}))})})).then(()=>tY(u,!0)),f=d.then(()=>tQ(u,!0)),h=new Promise((e,t)=>{a=e,r=t});return n={mount:()=>t4(Promise.resolve().then(()=>{if(u.status!==tM)throw Error(tk(13,!1,s,u.status));return o.parcels[i]=u,tQ(u)})),unmount:()=>t4(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:t4(p),bootstrapPromise:t4(d),mountPromise:t4(f),unmountPromise:t4(h)}}function t4(e){return e.then(()=>null)}function t5(e){let t=tF(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(tk(40,!1),t,n));let a=tG({},n,{name:t,mountParcel:t3.bind(e),singleSpa:ty});return tL(e)&&(a.unmountSelf=e.unmountThisParcel),a}let t6={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 t8(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(16,!1));t6.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function t7(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(17,!1));t6.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function t9(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(18,!1));t6.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function ne(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(19,!1));t6.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function nt(e,t){let n=e.timeouts[t],a=n.warningMillis,r=tW(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](t5(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>u(1),a),setTimeout(()=>u(!0),n.millis);let c=tk(31,!1,t,r,tF(e),n.millis);function u(e){s||(!0===e?(l=!0,n.dieOnTimeout?i(Error(c)):console.error(c)):!l&&(console.warn(c),e*a+a<n.millis&&setTimeout(()=>u(e+1),a)))}})}function nn(e){let t={};for(let n in t6)t[n]=tG({},t6[n],e&&e[n]||{});return t}function na(e){return Promise.resolve().then(()=>{let t,n;return e.loadPromise?e.loadPromise:e.status!==tC&&e.status!==tI?e:(e.status=tE,e.loadPromise=Promise.resolve().then(()=>{let a=e.loadApp(t5(e));if(!tH(a))throw n=!0,Error(tk(33,!1,tF(e)));return a.then(n=>{let a;e.loadErrorTime=null,"object"!=typeof(t=n)&&(a=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!tU(t.bootstrap)&&(a=35),tU(t.mount)||(a=36),tU(t.unmount)||(a=37);let r=tW(t);if(a){let n;try{n=JSON.stringify(t)}catch(e){}return console.error(tk(a,!1,r,tF(e),n),t),t$(void 0,e,tN),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=tG({},e.devtools.overlays,t.devtools.overlays)),e.status=tS,e.bootstrap=tq(t,"bootstrap"),e.mount=tq(t,"mount"),e.unmount=tq(t,"unmount"),e.unload=tq(t,"unload"),e.timeouts=nn(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let a;return delete e.loadPromise,n?a=tN:(a=tI,e.loadErrorTime=(new Date).getTime()),t$(t,e,a),e}))})}let nr="u">typeof window,no={hashchange:[],popstate:[]},ni=["hashchange","popstate"];function ns(e){let 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(tk(14,!1));t=e.currentTarget.href,e.preventDefault()}let n=nh(window.location.href),a=nh(t);0===t.indexOf("#")?window.location.hash=a.hash:n.host!==a.host&&a.host?window.location.href=t:a.pathname===n.pathname&&a.search===n.search?window.location.hash=a.hash:window.history.pushState(null,null,t)}function nl(e){if(e){let t=e[0].type;ni.indexOf(t)>=0&&no[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function nc(){nj([],arguments)}function nu(e,t){return function(){let n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return a&&n===o||window.dispatchEvent(function(e,t){let 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)),r}}let np=null,nd=!1;function nf(e){if(nd)throw Error(tk(43,!1));a=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,nd=!0,np=window.history.replaceState,window.addEventListener("hashchange",nc),window.addEventListener("popstate",nc);let t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&ni.indexOf(e)>=0)||tV(no[e],e=>e===n))return t.apply(this,arguments);no[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&ni.indexOf(e)>=0&&(no[e]=no[e].filter(e=>e!==t)),n.apply(this,arguments)},window.history.pushState=nu(window.history.pushState,"pushState"),window.history.replaceState=nu(np,"replaceState")}function nh(e){let t=document.createElement("a");return t.href=e,t}nr&&(window.singleSpaNavigate?console.warn(tk(41,!1)):window.singleSpaNavigate=ns);let nm=!1;function ng(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!nm){let t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return ny.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return ny.call(this,n,window.removeEventListener,e,t,arguments)},nm=!0}}function ny(e,t,n,a,r){return"string"!=typeof n?e.apply(this,r):(n.split(/\s+/).forEach(e=>{ni.indexOf(e)>=0&&(t(e,a),n=n.replace(e,""))}),""===n.trim()?this:e.apply(this,r))}let nb={};function n_(e){return Promise.resolve().then(()=>{let t=nb[tF(e)];if(!t)return e;if(e.status===tC)return nv(e,t),e;if(e.status===tB)return t.promise.then(()=>e);if(e.status!==tM&&e.status!==tI)return e;let n=e.status===tI?Promise.resolve():nt(e,"unload");return e.status=tB,n.then(()=>(nv(e,t),e)).catch(n=>(delete nb[tF(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,t$(n,e,tN),t.reject(n),e))})}function nv(e,t){delete nb[tF(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=tC,t.resolve()}function n$(e,t,n,a){nb[tF(e)]={app:e,resolve:n,reject:a},Object.defineProperty(nb[tF(e)],"promise",{get:t})}let nA=[];function nw(){return nA.filter(tj).map(tF)}function nk(){return nA.map(tF)}function nx(e){let t=tV(nA,t=>tF(t)===e);return t?t.status:null}let nC=!1;function nE(e,t,n,a){var r,o;let i,s,l=(i={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(tk(39,!1));let t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((e,n)=>t.indexOf(n)>=0?e:e.concat(n),[]);if(0!==n.length)throw Error(tk(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(tk(20,!1));let a=e=>"string"==typeof e||"function"==typeof e;if(!(a(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(a)))throw Error(tk(24,!1));if(!nO(e.customProps))throw Error(tk(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,a){if("string"!=typeof e||0===e.length)throw Error(tk(20,!1));if(!t)throw Error(tk(23,!1));if("function"!=typeof n)throw Error(tk(24,!1));if(!nO(a))throw Error(tk(22,!1))}(e,t,n,a),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=a),i.loadApp="function"!=typeof(r=i.loadApp)?()=>Promise.resolve(r):r,i.customProps=i.customProps||{},s=(s=Array.isArray(o=i.activeWhen)?o:[o]).map(e=>"function"==typeof e?e:nP(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(nF||nC||(nC=!0,setTimeout(()=>{nF||console.warn(tk(1,!1))},5e3)),-1!==nk().indexOf(l.name))throw Error(tk(21,!1,l.name));nA.push(tG({loadErrorTime:null,status:tC,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),nr&&(ng(),nj())}function nS(e=window.location){return nA.filter(t=>t.activeWhen(e)).map(tF)}function nD(e){if(0===nA.filter(t=>tF(t)===e).length)throw Error(tk(25,!1,e));return(nr?nM(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=nA.map(tF).indexOf(e);nA.splice(t,1)})}function nM(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(tk(26,!1));let n=tV(nA,t=>tF(t)===e);if(!n)throw Error(tk(27,!1,e));let a=nb[tF(n)];if(t&&t.waitForUnmount){if(a)return a.promise;{let e=new Promise((t,a)=>{n$(n,()=>e,t,a)});return e}}{let e;return a?(e=a.promise,nz(n,a.resolve,a.reject)):e=new Promise((t,a)=>{n$(n,()=>e,t,a),nz(n,t,a)}),e}}function nz(e,t,n){Promise.resolve().then(()=>{if(tV(nS(),t=>t===tF(e)))return nN()}).then(()=>tJ(e).then(n_).then(()=>{t(),setTimeout(()=>{nj()})})).catch(n)}function nO(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function nP(e,t){let n=function(e,t){let n=0,a=!1,r="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let n=e[t],r=a&&"/"===n;(!a&&":"===n||r)&&o(t)}return o(e.length),RegExp(r,"i");function o(o){let i=e.slice(n,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(r+=a?"[^/]+/?":i,o===e.length)if(a)t&&(r+="$");else{let e=t?"":".*";r="/"===r.charAt(r.length-1)?`${r}${e}$`:`${r}(/${e})?(#.*)?$`}a=!a,n=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let a=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(a)}}let nT=!1,nB=[],nI=nr&&window.location.href;function nN(){return nj()}function nj(e=[],t,n=!1){let a,r,o,i,s;if(nT)return new Promise((e,n)=>{nB.push({resolve:e,reject:n,eventArguments:t})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:p}=(a=[],r=[],o=[],i=[],s=(new Date).getTime(),nA.forEach(e=>{let t=e.status!==tN&&tR(e);switch(e.status){case tI:t&&s-e.loadErrorTime>=200&&o.push(e);break;case tC:case tE:t&&o.push(e);break;case tS:case tM:!t&&nb[tF(e)]?a.push(e):t&&i.push(e);break;case tO:t||r.push(e)}}),{appsToUnload:a,appsToUnmount:r,appsToLoad:o,appsToMount:i}),d,f=[],h=nI,m=nI=window.location.href;return nF?(nT=!0,d=l.concat(u,c,p),Promise.resolve().then(()=>($(0===d.length?"before-no-app-change":"before-app-change",v(!0)),$("before-routing-event",v(!0,{cancelNavigation:g})),Promise.all(f).then(n=>{if(n.some(e=>e))return np.call(window.history,history.state,"",h.substring(location.origin.length)),nI=location.href,nT=!1,nj(e,t,!0);let a=l.map(n_),r=Promise.all(c.map(tJ).map(e=>e.then(n_)).concat(a));r.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let o=u.map(e=>na(e).then(e=>nR(e,r))),i=p.filter(e=>0>u.indexOf(e)).map(e=>nR(e,r));return r.catch(e=>{throw b(),e}).then(()=>(b(),Promise.all(o.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(d=u,Promise.resolve().then(()=>Promise.all(u.map(na)).then(b).then(()=>[]).catch(e=>{throw b(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);f.push(t.catch(e=>(console.warn(Error(tk(42,!1))),console.warn(e),!1)))}function y(){let t=nw();e.forEach(e=>e.resolve(t));try{$(0===d.length?"no-app-change":"app-change",v()),$("routing-event",v())}catch(e){setTimeout(()=>{throw e})}if(nT=!1,nB.length>0){let e=nB;nB=[],nj(e)}return t}function b(){n||(e.forEach(e=>{nl(e.eventArguments)}),nl(t))}function v(e=!1,n){let a={},r={[tO]:[],[tM]:[],[tC]:[],[tN]:[]};e?(u.concat(p).forEach((e,t)=>{i(e,tO)}),l.forEach(e=>{i(e,tC)}),c.forEach(e=>{i(e,tM)})):d.forEach(e=>{i(e)});let o={detail:{newAppStatuses:a,appsByNewStatus:r,totalAppChanges:d.length,originalEvent:null==t?void 0:t[0],oldUrl:h,newUrl:m}};return n&&tG(o.detail,n),o;function i(e,t){let n=tF(e);t=t||nx(n),a[n]=t,(r[t]=r[t]||[]).push(n)}}function $(e,t){n||window.dispatchEvent(new t_(`single-spa:${e}`,t))}}function nR(e,t){return tR(e)?tY(e).then(e=>t.then(()=>tR(e)?tQ(e):e)):t.then(()=>e)}let nF=!1;function nL(e){nF=!0,nr&&(nf(e),nj())}function nW(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,"");return nG(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t}).replace(/^\/\//,"/")}function nG(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function nV({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),a=nW(e,t).replace(window.location.origin,"");a.startsWith(n)?ns(a):window.location.assign(a)}nr&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...nA]},reroute:nj,NOT_LOADED:tC,toLoadPromise:na,toBootstrapPromise:tY,unregisterApplication:nD,getProfilerData:function(){return tK}});let nU="openmrs:history";function nq(e){let t=JSON.parse(sessionStorage.getItem(nU)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(nU,JSON.stringify(t))}function nH(){0===JSON.parse(sessionStorage.getItem(nU)??"[]").length&&document.referrer&&nq(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=nK();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(nU,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?nY({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&nq(window.location.href)})}function nK(){return JSON.parse(sessionStorage.getItem(nU)??"[]")}function nY({toUrl:e}){let t=nK(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);nV({to:t[n]}),sessionStorage.setItem(nU,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function nJ(){sessionStorage.removeItem(nU)}let nZ="${openmrsSpaBase}/login",nX={redirectAuthFailure:{enabled:{_type:eb.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:eb.String,_default:nZ,_validators:[tl.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:eb.Array,_default:[401],_elements:{_type:eb.Number,_validators:[tl.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:eb.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."}},followRedirects:{_type:eb.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function nQ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let n0="/ws/rest/v1",n1="/ws/fhir2/R4",n2=`${n0}/session`;function n3(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function n4(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=n3(e);if(t.headers||(t.headers={}),(0,ee.isPlainObject)(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(n0)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(n1)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let a=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:t,followRedirects:r}=await eK("@openmrs/esm-api");if(e.ok)if(204!==e.status)return e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e});else{if(r&&e.headers.has("location")){let t=e.headers.get("location");t&&nV({to:t})}return e.data=null,e}return n===n3(n2)&&403===e.status||t.enabled&&t.errors.includes(e.status)?(nJ(),nV({to:t.url||e.headers.get("location")||nZ}),t.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(t=>{let r=t;try{r=JSON.parse(t)}catch(e){}throw new n6(n,e,r,a)},t=>{throw new n6(n,e,null,a)})})}function n5(e,t={}){if("object"!=typeof t)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");let n=new AbortController;return t.signal=n.signal,new eg(a=>{let r=!1;return n4(e,t).then(e=>{r=!0,a.next(e),a.complete()},e=>{r=!0,a.error(e)}),()=>{r||n.abort()}})}class n6 extends Error{constructor(e,t,n,a){super(),nQ(this,"response",void 0),nQ(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`,a.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
12
+ ${t}`)}return a}let e5=(e,t)=>{let n=structuredClone(t);if(!e)return n;for(let t of Object.keys(e)){let a=n[t],r=e[t];if(r&&(r.hasOwnProperty("_type")||r.hasOwnProperty("_default"))){n.hasOwnProperty(t)||(n[t]=r._default);let e=r._elements;if(a&&e6(e)){if(r._type===eb.Array&&Array.isArray(a)){let r=a.map(t=>e5(e,t));n[t]=r}else if(r._type===eb.Object)for(let t of Object.keys(a))a[t]=e5(e,a[t])}}else if(e8(r)){let e=a??{};e8(e)&&(n[t]=e5(r,e))}}return n};function e6(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function e8(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}let e7=new Set;function e9(e,t){let n=`${e}:::${t}`;e7||(e7=new Set),e7.has(n)||(console.error(t),e7.add(n))}function te(e){e?e7.forEach(t=>{t.startsWith(e)&&e7.delete(t)}):e7.clear()}function tt(){eR.forEach(e=>e()),eR.length=0,eL()}let tn={"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:eb.Object,_default:{},_validators:[e_(e=>Object.keys(e).every(e=>/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e)),e=>{let t=Object.keys(e).filter(e=>!/^[a-z]{2,3}(-[A-Z]{2,3})?$/.test(e));return`The 'Translation overrides' object should have language codes for keys. Language codes must be in the form of a two-to-three letter language code optionally followed by a hyphen and a two-to-three letter country code. The following keys do not conform: ${t.join(", ")}.`})]}},ta={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:eb.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:eb.String,_default:void 0}},...tn},tr=(e,t)=>e_(n=>e<=n&&n<=t,`must be between ${e} and ${t}`),to=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return e_(e=>{if(!e||"string"!=typeof e)return!1;let n=/\${(.*?)}/g,a=n.exec(e);for(;a;){if(!t.includes(a[1]))return!1;a=n.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},ti=to([]),ts=e=>e_(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),tl={inRange:tr,isUrl:ti,isUrlWithTemplateParameters:to,oneOf:ts};var tc=n(8067);let tu=V("breadcrumbs",[]);function tp(e){return td([e])}function td(e){let t=[...tf(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,tc.pathToRegexp)(e.matcher).regexp:(0,tc.pathToRegexp)(e.path).regexp,settings:e}))];tu.setState(t,!0)}function tf(){return tu.getState()}function th(e,t){if(t)return function(e,t){let[n]=e.filter(e=>e.matcher.test(t));return n}(e,t)||function(e,t){let n=t.split("/");for(;n.length>1;){n.pop();let t=th(e,n.join("/"));if(t)return t}}(e,t)}function tm(e,t){if(e.length>0){let n=th(e,t);if(n){let t=[n],a=th(e,n.settings.parent);for(;void 0!==a;)t.push(a),a=th(e,a.settings.parent);return t.reverse()}}return[]}function tg(e){return tm(tf(),e)}var ty=Object.freeze({__proto__:null,get start(){return nL},get ensureJQuerySupport(){return ng},get setBootstrapMaxTime(){return t8},get setMountMaxTime(){return t7},get setUnmountMaxTime(){return t9},get setUnloadMaxTime(){return ne},get registerApplication(){return nE},get unregisterApplication(){return nD},get getMountedApps(){return nw},get getAppStatus(){return nx},get unloadApplication(){return nM},get checkActivityFunctions(){return nS},get getAppNames(){return nk},get pathToActiveWhen(){return nP},get navigateToUrl(){return ns},get patchHistoryApi(){return nf},get triggerAppChange(){return nN},get addErrorHandler(){return tA},get removeErrorHandler(){return tw},get mountRootParcel(){return t2},get NOT_LOADED(){return tC},get LOADING_SOURCE_CODE(){return tE},get NOT_BOOTSTRAPPED(){return tS},get BOOTSTRAPPING(){return tD},get NOT_MOUNTED(){return tM},get MOUNTING(){return tz},get UPDATING(){return tP},get LOAD_ERROR(){return tI},get MOUNTED(){return tO},get UNLOADING(){return tB},get UNMOUNTING(){return tT},get SKIP_BECAUSE_BROKEN(){return tN}}),tb=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,t_=!function(){try{var e=new tb("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?"u">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=!!t.bubbles,n.cancelable=!!t.cancelable,n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}:tb;let tv=[];function t$(e,t,n){let a=tx(e,t,n);tv.length?tv.forEach(e=>e(a)):setTimeout(()=>{throw a})}function tA(e){if("function"!=typeof e)throw Error(tk(28,!1));tv.push(e)}function tw(e){if("function"!=typeof e)throw Error(tk(29,!1));let t=!1;return tv=tv.filter(n=>{let a=n===e;return t=t||a,!a}),t}function tk(e,t,...n){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${n.length?`&arg=${n.join("&arg=")}`:""}`}function tx(e,t,n){let a,r=`${tW(t)} '${tF(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=r+e.message}catch(e){}a=e}else{console.warn(tk(30,!1,t.status,tF(t)));try{a=Error(r+JSON.stringify(e))}catch(t){a=e}}return a.appOrParcelName=tF(t),t.status=n,a}let tC="NOT_LOADED",tE="LOADING_SOURCE_CODE",tS="NOT_BOOTSTRAPPED",tD="BOOTSTRAPPING",tM="NOT_MOUNTED",tz="MOUNTING",tO="MOUNTED",tP="UPDATING",tT="UNMOUNTING",tB="UNLOADING",tI="LOAD_ERROR",tN="SKIP_BECAUSE_BROKEN";function tj(e){return e.status===tO}function tR(e){try{return e.activeWhen(window.location)}catch(t){return t$(t,e,tN),!1}}function tF(e){return e.name}function tL(e){return!!e.unmountThisParcel}function tW(e){return tL(e)?"parcel":"application"}function tG(){for(let e=arguments.length-1;e>0;e--)for(let t in arguments[e])"__proto__"!==t&&(arguments[e-1][t]=arguments[e][t]);return arguments[0]}function tV(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}function tU(e){return e&&("function"==typeof e||Array.isArray(e)&&!tV(e,e=>"function"!=typeof e))}function tq(e,t){let n=e[t]||[];0===(n=Array.isArray(n)?n:[n]).length&&(n=[()=>Promise.resolve()]);let a=tW(e),r=tF(e);return function(e){return n.reduce((n,o,i)=>n.then(()=>{let n=o(e);return tH(n)?n:Promise.reject(tk(15,!1,a,r,t,i))}),Promise.resolve())}}function tH(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let tK=[];function tY(e,t){return Promise.resolve().then(()=>e.status!==tS?e:(e.status=tD,e.bootstrap?nt(e,"bootstrap").then(n).catch(n=>{if(t)throw tx(n,e,tN);return t$(n,e,tN),e}):Promise.resolve().then(n)));function n(){return e.status=tM,e}}function tJ(e,t){return Promise.resolve().then(()=>{if(e.status!==tO)return e;return e.status=tT,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(n,a=>n().then(()=>{let n=Error(a.message);if(t)throw tx(n,e,tN);t$(n,e,tN)})).then(()=>e);function n(){return nt(e,"unmount").then(()=>{e.status=tM},n=>{if(t)throw tx(n,e,tN);t$(n,e,tN)})}})}let tZ=!1,tX=!1;function tQ(e,t){return Promise.resolve().then(()=>e.status!==tM?e:(tZ||(window.dispatchEvent(new t_("single-spa:before-first-mount")),tZ=!0),e.status=tz,nt(e,"mount").then(()=>(e.status=tO,tX||(window.dispatchEvent(new t_("single-spa:first-mount")),tX=!0),e)).catch(n=>{return e.status=tO,tJ(e,!0).then(a,a);function a(){if(t)throw tx(n,e,tN);return t$(n,e,tN),e}})))}let t0=0,t1={parcels:{}};function t2(){return t3.apply(t1,arguments)}function t3(e,t){let n,a,r,o=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(tk(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(tk(3,!1,typeof e.name));let i=t0++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(tk(4,!1,s,typeof t));if(!t.domElement)throw Error(tk(5,!1,s));let l="function"==typeof e,c=l?e:()=>Promise.resolve(e),u={id:i,parcels:{},status:l?tE:tS,customProps:t,parentName:tF(o),unmountThisParcel:()=>f.then(()=>{if(u.status!==tO)throw Error(tk(6,!1,s,u.status));return tJ(u,!0)}).then(e=>(u.parentName&&delete o.parcels[u.id],e)).then(e=>(a(e),e)).catch(e=>{throw u.status=tN,r(e),e})};o.parcels[i]=u;let p=c();if(!p||"function"!=typeof p.then)throw Error(tk(7,!1));let d=(p=p.then(e=>{if(!e)throw Error(tk(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!tU(e.bootstrap))throw Error(tk(9,!1,s));if(!tU(e.mount))throw Error(tk(10,!1,s));if(!tU(e.unmount))throw Error(tk(11,!1,s));if(e.update&&!tU(e.update))throw Error(tk(12,!1,s));let t=tq(e,"bootstrap"),a=tq(e,"mount"),r=tq(e,"unmount");u.status=tS,u.name=s,u.bootstrap=t,u.mount=a,u.unmount=r,u.timeouts=nn(e.timeouts),e.update&&(u.update=tq(e,"update"),n.update=function(e){return u.customProps=e,t4(Promise.resolve().then(()=>{if(u.status!==tO)throw Error(tk(32,!1,tF(u)));return u.status=tP,nt(u,"update").then(()=>(u.status=tO,u)).catch(e=>{throw tx(e,u,tN)})}))})})).then(()=>tY(u,!0)),f=d.then(()=>tQ(u,!0)),h=new Promise((e,t)=>{a=e,r=t});return n={mount:()=>t4(Promise.resolve().then(()=>{if(u.status!==tM)throw Error(tk(13,!1,s,u.status));return o.parcels[i]=u,tQ(u)})),unmount:()=>t4(u.unmountThisParcel()),getStatus:()=>u.status,loadPromise:t4(p),bootstrapPromise:t4(d),mountPromise:t4(f),unmountPromise:t4(h)}}function t4(e){return e.then(()=>null)}function t5(e){let t=tF(e),n="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof n||null===n||Array.isArray(n))&&(n={},console.warn(tk(40,!1),t,n));let a=tG({},n,{name:t,mountParcel:t3.bind(e),singleSpa:ty});return tL(e)&&(a.unmountSelf=e.unmountThisParcel),a}let t6={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 t8(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(16,!1));t6.bootstrap={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function t7(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(17,!1));t6.mount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function t9(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(18,!1));t6.unmount={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function ne(e,t,n){if("number"!=typeof e||e<=0)throw Error(tk(19,!1));t6.unload={millis:e,dieOnTimeout:t,warningMillis:n||1e3}}function nt(e,t){let n=e.timeouts[t],a=n.warningMillis,r=tW(e);return new Promise((o,i)=>{let s=!1,l=!1;e[t](t5(e)).then(e=>{s=!0,o(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>u(1),a),setTimeout(()=>u(!0),n.millis);let c=tk(31,!1,t,r,tF(e),n.millis);function u(e){s||(!0===e?(l=!0,n.dieOnTimeout?i(Error(c)):console.error(c)):!l&&(console.warn(c),e*a+a<n.millis&&setTimeout(()=>u(e+1),a)))}})}function nn(e){let t={};for(let n in t6)t[n]=tG({},t6[n],e&&e[n]||{});return t}function na(e){return Promise.resolve().then(()=>{let t,n;return e.loadPromise?e.loadPromise:e.status!==tC&&e.status!==tI?e:(e.status=tE,e.loadPromise=Promise.resolve().then(()=>{let a=e.loadApp(t5(e));if(!tH(a))throw n=!0,Error(tk(33,!1,tF(e)));return a.then(n=>{let a;e.loadErrorTime=null,"object"!=typeof(t=n)&&(a=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!tU(t.bootstrap)&&(a=35),tU(t.mount)||(a=36),tU(t.unmount)||(a=37);let r=tW(t);if(a){let n;try{n=JSON.stringify(t)}catch(e){}return console.error(tk(a,!1,r,tF(e),n),t),t$(void 0,e,tN),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=tG({},e.devtools.overlays,t.devtools.overlays)),e.status=tS,e.bootstrap=tq(t,"bootstrap"),e.mount=tq(t,"mount"),e.unmount=tq(t,"unmount"),e.unload=tq(t,"unload"),e.timeouts=nn(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let a;return delete e.loadPromise,n?a=tN:(a=tI,e.loadErrorTime=(new Date).getTime()),t$(t,e,a),e}))})}let nr="u">typeof window,no={hashchange:[],popstate:[]},ni=["hashchange","popstate"];function ns(e){let 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(tk(14,!1));t=e.currentTarget.href,e.preventDefault()}let n=nh(window.location.href),a=nh(t);0===t.indexOf("#")?window.location.hash=a.hash:n.host!==a.host&&a.host?window.location.href=t:a.pathname===n.pathname&&a.search===n.search?window.location.hash=a.hash:window.history.pushState(null,null,t)}function nl(e){if(e){let t=e[0].type;ni.indexOf(t)>=0&&no[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function nc(){nj([],arguments)}function nu(e,t){return function(){let n=window.location.href,r=e.apply(this,arguments),o=window.location.href;return a&&n===o||window.dispatchEvent(function(e,t){let 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)),r}}let np=null,nd=!1;function nf(e){if(nd)throw Error(tk(43,!1));a=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,nd=!0,np=window.history.replaceState,window.addEventListener("hashchange",nc),window.addEventListener("popstate",nc);let t=window.addEventListener,n=window.removeEventListener;window.addEventListener=function(e,n){if(!("function"==typeof n&&ni.indexOf(e)>=0)||tV(no[e],e=>e===n))return t.apply(this,arguments);no[e].push(n)},window.removeEventListener=function(e,t){return"function"==typeof t&&ni.indexOf(e)>=0&&(no[e]=no[e].filter(e=>e!==t)),n.apply(this,arguments)},window.history.pushState=nu(window.history.pushState,"pushState"),window.history.replaceState=nu(np,"replaceState")}function nh(e){let t=document.createElement("a");return t.href=e,t}nr&&(window.singleSpaNavigate?console.warn(tk(41,!1)):window.singleSpaNavigate=ns);let nm=!1;function ng(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!nm){let t=e.fn.on,n=e.fn.off;e.fn.on=function(e,n){return ny.call(this,t,window.addEventListener,e,n,arguments)},e.fn.off=function(e,t){return ny.call(this,n,window.removeEventListener,e,t,arguments)},nm=!0}}function ny(e,t,n,a,r){return"string"!=typeof n?e.apply(this,r):(n.split(/\s+/).forEach(e=>{ni.indexOf(e)>=0&&(t(e,a),n=n.replace(e,""))}),""===n.trim()?this:e.apply(this,r))}let nb={};function n_(e){return Promise.resolve().then(()=>{let t=nb[tF(e)];if(!t)return e;if(e.status===tC)return nv(e,t),e;if(e.status===tB)return t.promise.then(()=>e);if(e.status!==tM&&e.status!==tI)return e;let n=e.status===tI?Promise.resolve():nt(e,"unload");return e.status=tB,n.then(()=>(nv(e,t),e)).catch(n=>(delete nb[tF(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,t$(n,e,tN),t.reject(n),e))})}function nv(e,t){delete nb[tF(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=tC,t.resolve()}function n$(e,t,n,a){nb[tF(e)]={app:e,resolve:n,reject:a},Object.defineProperty(nb[tF(e)],"promise",{get:t})}let nA=[];function nw(){return nA.filter(tj).map(tF)}function nk(){return nA.map(tF)}function nx(e){let t=tV(nA,t=>tF(t)===e);return t?t.status:null}let nC=!1;function nE(e,t,n,a){var r,o;let i,s,l=(i={name:null,loadApp:null,activeWhen:null,customProps:null},"object"==typeof e?(function(e){if(Array.isArray(e)||null===e)throw Error(tk(39,!1));let t=["name","app","activeWhen","customProps"],n=Object.keys(e).reduce((e,n)=>t.indexOf(n)>=0?e:e.concat(n),[]);if(0!==n.length)throw Error(tk(38,!1,t.join(", "),n.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(tk(20,!1));let a=e=>"string"==typeof e||"function"==typeof e;if(!(a(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(a)))throw Error(tk(24,!1));if(!nO(e.customProps))throw Error(tk(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,n,a){if("string"!=typeof e||0===e.length)throw Error(tk(20,!1));if(!t)throw Error(tk(23,!1));if("function"!=typeof n)throw Error(tk(24,!1));if(!nO(a))throw Error(tk(22,!1))}(e,t,n,a),i.name=e,i.loadApp=t,i.activeWhen=n,i.customProps=a),i.loadApp="function"!=typeof(r=i.loadApp)?()=>Promise.resolve(r):r,i.customProps=i.customProps||{},s=(s=Array.isArray(o=i.activeWhen)?o:[o]).map(e=>"function"==typeof e?e:nP(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(nF||nC||(nC=!0,setTimeout(()=>{nF||console.warn(tk(1,!1))},5e3)),-1!==nk().indexOf(l.name))throw Error(tk(21,!1,l.name));nA.push(tG({loadErrorTime:null,status:tC,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),nr&&(ng(),nj())}function nS(e=window.location){return nA.filter(t=>t.activeWhen(e)).map(tF)}function nD(e){if(0===nA.filter(t=>tF(t)===e).length)throw Error(tk(25,!1,e));return(nr?nM(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=nA.map(tF).indexOf(e);nA.splice(t,1)})}function nM(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(tk(26,!1));let n=tV(nA,t=>tF(t)===e);if(!n)throw Error(tk(27,!1,e));let a=nb[tF(n)];if(t&&t.waitForUnmount){if(a)return a.promise;{let e=new Promise((t,a)=>{n$(n,()=>e,t,a)});return e}}{let e;return a?(e=a.promise,nz(n,a.resolve,a.reject)):e=new Promise((t,a)=>{n$(n,()=>e,t,a),nz(n,t,a)}),e}}function nz(e,t,n){Promise.resolve().then(()=>{if(tV(nS(),t=>t===tF(e)))return nN()}).then(()=>tJ(e).then(n_).then(()=>{t(),setTimeout(()=>{nj()})})).catch(n)}function nO(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function nP(e,t){let n=function(e,t){let n=0,a=!1,r="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let n=e[t],r=a&&"/"===n;(!a&&":"===n||r)&&o(t)}return o(e.length),RegExp(r,"i");function o(o){let i=e.slice(n,o).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(r+=a?"[^/]+/?":i,o===e.length)if(a)t&&(r+="$");else{let e=t?"":".*";r="/"===r.charAt(r.length-1)?`${r}${e}$`:`${r}(/${e})?(#.*)?$`}a=!a,n=o}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let a=e.href.replace(t,"").replace(e.search,"").split("?")[0];return n.test(a)}}let nT=!1,nB=[],nI=nr&&window.location.href;function nN(){return nj()}function nj(e=[],t,n=!1){let a,r,o,i,s;if(nT)return new Promise((e,n)=>{nB.push({resolve:e,reject:n,eventArguments:t})});let{appsToUnload:l,appsToUnmount:c,appsToLoad:u,appsToMount:p}=(a=[],r=[],o=[],i=[],s=(new Date).getTime(),nA.forEach(e=>{let t=e.status!==tN&&tR(e);switch(e.status){case tI:t&&s-e.loadErrorTime>=200&&o.push(e);break;case tC:case tE:t&&o.push(e);break;case tS:case tM:!t&&nb[tF(e)]?a.push(e):t&&i.push(e);break;case tO:t||r.push(e)}}),{appsToUnload:a,appsToUnmount:r,appsToLoad:o,appsToMount:i}),d,f=[],h=nI,m=nI=window.location.href;return nF?(nT=!0,d=l.concat(u,c,p),Promise.resolve().then(()=>($(0===d.length?"before-no-app-change":"before-app-change",v(!0)),$("before-routing-event",v(!0,{cancelNavigation:g})),Promise.all(f).then(n=>{if(n.some(e=>e))return np.call(window.history,history.state,"",h.substring(location.origin.length)),nI=location.href,nT=!1,nj(e,t,!0);let a=l.map(n_),r=Promise.all(c.map(tJ).map(e=>e.then(n_)).concat(a));r.then(()=>{$("before-mount-routing-event",v(!0))},e=>{throw e});let o=u.map(e=>na(e).then(e=>nR(e,r))),i=p.filter(e=>0>u.indexOf(e)).map(e=>nR(e,r));return r.catch(e=>{throw b(),e}).then(()=>(b(),Promise.all(o.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(d=u,Promise.resolve().then(()=>Promise.all(u.map(na)).then(b).then(()=>[]).catch(e=>{throw b(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);f.push(t.catch(e=>(console.warn(Error(tk(42,!1))),console.warn(e),!1)))}function y(){let t=nw();e.forEach(e=>e.resolve(t));try{$(0===d.length?"no-app-change":"app-change",v()),$("routing-event",v())}catch(e){setTimeout(()=>{throw e})}if(nT=!1,nB.length>0){let e=nB;nB=[],nj(e)}return t}function b(){n||(e.forEach(e=>{nl(e.eventArguments)}),nl(t))}function v(e=!1,n){let a={},r={[tO]:[],[tM]:[],[tC]:[],[tN]:[]};e?(u.concat(p).forEach((e,t)=>{i(e,tO)}),l.forEach(e=>{i(e,tC)}),c.forEach(e=>{i(e,tM)})):d.forEach(e=>{i(e)});let o={detail:{newAppStatuses:a,appsByNewStatus:r,totalAppChanges:d.length,originalEvent:null==t?void 0:t[0],oldUrl:h,newUrl:m}};return n&&tG(o.detail,n),o;function i(e,t){let n=tF(e);t=t||nx(n),a[n]=t,(r[t]=r[t]||[]).push(n)}}function $(e,t){n||window.dispatchEvent(new t_(`single-spa:${e}`,t))}}function nR(e,t){return tR(e)?tY(e).then(e=>t.then(()=>tR(e)?tQ(e):e)):t.then(()=>e)}let nF=!1;function nL(e){nF=!0,nr&&(nf(e),nj())}function nW(e,t){let n=window.getOpenmrsSpaBase().replace(/\/$/,"");return nG(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:n,...t}).replace(/^\/\//,"/")}function nG(e,t){return Object.keys(t).reduce((e,n)=>e.split("${"+n+"}").join(t[n]),e)}function nV({to:e,templateParams:t}){let n=window.getOpenmrsSpaBase().replace(/\/$/,""),a=nW(e,t).replace(window.location.origin,"");a.startsWith(n)?ns(a):window.location.assign(a)}nr&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...nA]},reroute:nj,NOT_LOADED:tC,toLoadPromise:na,toBootstrapPromise:tY,unregisterApplication:nD,getProfilerData:function(){return tK}});let nU="openmrs:history";function nq(e){let t=JSON.parse(sessionStorage.getItem(nU)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(nU,JSON.stringify(t))}function nH(){0===JSON.parse(sessionStorage.getItem(nU)??"[]").length&&document.referrer&&nq(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=nK();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(nU,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?nY({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&nq(window.location.href)})}function nK(){return JSON.parse(sessionStorage.getItem(nU)??"[]")}function nY({toUrl:e}){let t=nK(),n=t.lastIndexOf(e);if(-1!=n){let e=t.slice(0,n+1);nV({to:t[n]}),sessionStorage.setItem(nU,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function nJ(){sessionStorage.removeItem(nU)}let nZ="${openmrsSpaBase}/login",nX={redirectAuthFailure:{enabled:{_type:eb.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:eb.String,_default:nZ,_validators:[tl.isUrl],_description:"The url to which users will be redirected when they are logged out. If set to blank, the `location` header from the response will be used."},errors:{_type:eb.Array,_default:[401],_elements:{_type:eb.Number,_validators:[tl.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:eb.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."}},followRedirects:{_type:eb.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function nQ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let n0="/ws/rest/v1",n1="/ws/fhir2/R4",n2=`${n0}/session`;function n3(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function n4(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=n3(e);if(t.headers||(t.headers={}),(0,ee.isPlainObject)(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(n0)&&void 0===t.headers["Disable-WWW-Authenticate"]&&(t.headers["Disable-WWW-Authenticate"]="true"),e.startsWith(n1)){let e=new URL(n,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),n=e.toString())}let a=Error();return window.fetch(n,t).then(async e=>{let{redirectAuthFailure:t,followRedirects:r}=await eK("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(r&&t&&(n===n3(n2)||204===e.status)&&nV({to:t}),204===e.status)?(e.data=null,e):e.clone().text().then(t=>{try{t&&(e.data=JSON.parse(t))}catch(e){}return e})}return n===n3(n2)&&403===e.status||t.enabled&&t.errors.includes(e.status)?(nJ(),nV({to:t.url||e.headers.get("location")||nZ}),t.resolvePromise?Promise.resolve():new Promise(()=>{})):e.clone().text().then(t=>{let r=t;try{r=JSON.parse(t)}catch(e){}throw new n6(n,e,r,a)},t=>{throw new n6(n,e,null,a)})})}function n5(e,t={}){if("object"!=typeof t)throw Error("The second argument to openmrsObservableFetch must be either omitted or an object");let n=new AbortController;return t.signal=n.signal,new eg(a=>{let r=!1;return n4(e,t).then(e=>{r=!0,a.next(e),a.complete()},e=>{r=!0,a.error(e)}),()=>{r||n.abort()}})}class n6 extends Error{constructor(e,t,n,a){super(),nQ(this,"response",void 0),nQ(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`,a.message=this.message,this.responseBody=n,this.response=t,this.stack=`Stacktrace for outgoing request:
13
13
  ${a.stack}
14
14
  Stacktrace for incoming response:
15
15
  ${this.stack}`}}let n8=V("session",{loaded:!1,session:null}),n7=0;function n9(e={includeAuthStatus:!0}){return(n7<Date.now()-6e4||!n8.getState().loaded)&&an(),new eg(t=>{let n=n=>{n.loaded&&(e.includeAuthStatus?t.next(n.session):t.next(n.session?.user))};return n(n8.getState()),n8.subscribe(n)})}function ae(){return(n7<Date.now()-6e4||!n8.getState().loaded)&&an(),n8}function at(e){let t=e.locale??e.user?.userProperties?.defaultLocale;t&&t.includes("_")&&(t=t.replaceAll("_","-")),function(e){if(void 0===e||"string"!=typeof e)return!1;try{new Intl.Locale(e)}catch(e){return!1}return!0}(t)&&t!==document.documentElement.getAttribute("lang")&&document.documentElement.setAttribute("lang",t)}function an(e,t){n7=Date.now();let n={};return e&&t&&(n.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`),ac(n4(n2,{headers:n}))}function aa(){n8.setState({loaded:!0,session:{authenticated:!1,sessionId:""}})}function ar(e,t){var n,a;if(void 0===t)return!e;if(!e)return!0;return n=e,a=t,("string"==typeof n?!(0,ee.isUndefined)(a.privileges.find(e=>n===e.display)):Array.isArray(n)?n.every(e=>!(0,ee.isUndefined)(a.privileges.find(t=>e===t.display))):((0,ee.isUndefined)(n)||console.error(`Could not understand privileges "${n}"`),!0))||!(0,ee.isUndefined)(t.roles.find(e=>"System Developer"===e.display))}function ao(){let e,t;return new Promise(n=>{let a=a=>{a.loaded&&a.session.user&&(e=a.session.user,n(a.session.user),t&&t())};a(n8.getState()),e||(t=n8.subscribe(a))})}function ai(){return new Promise((e,t)=>{n9().subscribe(t=>{e(t.sessionLocation)},t).unsubscribe()})}async function as(e,t){return ac(n4(n2,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},signal:t.signal}))}async function al(e,t,n){return n||(n=new AbortController),await n4(`${n0}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:n.signal}),an()}function ac(e){return new Promise((t,n)=>{e.then(e=>{let a;"object"==typeof e?.data?(a={loaded:!0,session:e.data},n8.setState(a),t(a)):(a={loaded:!1,session:null},n8.setState(a),n(a))}).catch(e=>{T(`Failed to fetch new session information: ${e}`);let t={loaded:!1,session:null};n8.setState(t),n(t)})})}function au(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}n8.subscribe(e=>{e.loaded&&e.session&&at(e.session)});let ap={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function ad(){eW("@openmrs/esm-api",nX),an()}let af={address1:"Address line 1",address2:"Address line 2",address3:"Address line 3",address4:"Address line 4",address5:"Address line 5",address6:"Address line 6",city:"City",cityVillage:"City",country:"Country",countyDistrict:"District",district:"District",postalCode:"Postal code",state:"State",stateProvince:"State",closeAllOpenedWorkspaces:"Discard changes in {{count}} workspaces",closingAllWorkspacesPromptBody:"There may be unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",closingAllWorkspacesPromptTitle:"You have unsaved changes",discard:"Discard",hide:"Hide",maximize:"Maximize",minimize:"Minimize",openAnyway:"Open anyway",unsavedChangesInOpenedWorkspace:"You may have unsaved changes in the opened workspace. Do you want to discard these changes?",unsavedChangesInWorkspace:'There may be unsaved changes in "{{workspaceName}}". Please save them before opening another workspace.',unsavedChangesTitleText:"Unsaved changes",workspaceHeader:"Workspace header",closeWorkspaces2PromptTitle:"Close workspace(s)",closeWorkspaces2PromptBody:"You are about to close the following workspace(s), which might have unsaved changes:",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",delete:"Delete",discardChanges:"Discard changes",edit:"Edit",emptyStateText:"There are no {{displayText}} to display",error:"Error",errorCopy:"Sorry, there was a problem displaying this information. You can try to reload this page, or contact the site administrator and quote the error code above.",errorLoadingLoginLocations:"Unable to load login locations. Please try again or contact support if the problem persists.",female:"Female",leftNavigation:"Left navigation",loading:"Loading",male:"Male",noResultsToDisplay:"No results to display",notAvailable:"Not available",other:"Other",paginationItemsCount:"{{pageItemsCount}} / {{totalItems}} items",paginationOfPages:"of {{count}} pages",patientAvatarAlt:"Avatar for {{patientName}}",patientIdentifierSticker:"Patient identifier sticker",patientLists:"Patient lists",patientPhotoAlt:"Profile photo of {{patientName}}",patientPhotoPlaceholder:"Photo placeholder for {{patientName}}",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",resetOverrides:"Reset overrides",save:"Save",scriptLoadingFailed:"Error: Script failed to load",scriptLoadingError:"Failed to load overridden script from {{url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",searchForLocation:"Search for a location",seeAll:"See all",seeMoreLists:"See {{count}} more lists",selectAll:"Select all",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",toggleDevTools:"Toggle dev tools",unknown:"Unknown",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var ah=n(2284),am=n(3029),ag=n(2901);function ay(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var ab=n(3662);function a_(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&(0,ab.A)(e,t)}function av(e,t){if(t&&("object"==(0,ah.A)(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return ay(e)}function a$(e){return(a$=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var aA=n(4467),aw=n(6369),ak=n(3612),ax=n(6562);function aC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function aE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?aC(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var aS={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},aD=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,am.A)(this,e),this.init(t,n)}return(0,ag.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||aS,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,a){return a&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,aE(aE({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),aM=function(){function e(){(0,am.A)(this,e),this.observers={}}return(0,ag.A)(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach(function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)}),this}},{key:"off",value:function(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e]=this.observers[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];this.observers[e]&&[].concat(this.observers[e]).forEach(function(e){e.apply(void 0,n)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(function(t){t.apply(t,[e].concat(n))})}}]),e}();function az(){var e,t,n=new Promise(function(n,a){e=n,t=a});return n.resolve=e,n.reject=t,n}function aO(e){return null==e?"":""+e}function aP(e,t,n){function a(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(r())return{};var i=a(o.shift());!e[i]&&n&&(e[i]=new n),e=Object.prototype.hasOwnProperty.call(e,i)?e[i]:{}}return r()?{}:{obj:e,k:a(o.shift())}}function aT(e,t,n){var a=aP(e,t,Object);a.obj[a.k]=n}function aB(e,t){var n=aP(e,t),a=n.obj,r=n.k;if(a)return a[r]}function aI(e,t,n){var a=aB(e,n);return void 0!==a?a:aB(t,n)}function aN(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var aj={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function aR(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return aj[e]}):e}var aF="u">typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,aL=[" ",",","?","!",";"];function aW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function aG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?aW(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var aV=function(e){a_(a,e);var t,n=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=a$(a);return e=t?Reflect.construct(n,arguments,a$(this).constructor):n.apply(this,arguments),av(this,e)});function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return(0,am.A)(this,a),t=n.call(this),aF&&aM.call(ay(t)),t.data=e||{},t.options=r,void 0===t.options.keySeparator&&(t.options.keySeparator="."),void 0===t.options.ignoreJSONStructure&&(t.options.ignoreJSONStructure=!0),t}return(0,ag.A)(a,[{key:"addNamespaces",value:function(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,o=void 0!==a.ignoreJSONStructure?a.ignoreJSONStructure:this.options.ignoreJSONStructure,i=[e,t];n&&"string"!=typeof n&&(i=i.concat(n)),n&&"string"==typeof n&&(i=i.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(i=e.split("."));var s=aB(this.data,i);return s||!o||"string"!=typeof n?s:function e(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(t){if(t[n])return t[n];for(var r=n.split(a),o=t,i=0;i<r.length;++i){if(!o||"string"==typeof o[r[i]]&&i+1<r.length)return;if(void 0===o[r[i]]){for(var s=2,l=r.slice(i,i+s).join(a),c=o[l];void 0===c&&r.length>i+s;)s++,c=o[l=r.slice(i,i+s).join(a)];if(void 0===c)return;if(null===c)return null;if(n.endsWith(l)){if("string"==typeof c)return c;if(l&&"string"==typeof c[l])return c[l]}var u=r.slice(i+s).join(a);if(u)return e(c,u,a);return}o=o[r[i]]}return o}}(this.data&&this.data[e]&&this.data[e][t],n,r)}},{key:"addResource",value:function(e,t,n,a){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var i=[e,t];n&&(i=i.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(i=e.split("."),a=t,t=i[1]),this.addNamespaces(t),aT(this.data,i,a),r.silent||this.emit("added",e,t,n,a)}},{key:"addResources",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in n)("string"==typeof n[r]||"[object Array]"===Object.prototype.toString.apply(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});a.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,a,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),a=n,n=t,t=i[1]),this.addNamespaces(t);var s=aB(this.data,i)||{};a?function e(t,n,a){for(var r in n)"__proto__"!==r&&"constructor"!==r&&(r in t?"string"==typeof t[r]||t[r]instanceof String||"string"==typeof n[r]||n[r]instanceof String?a&&(t[r]=n[r]):e(t[r],n[r],a):t[r]=n[r]);return t}(s,n,r):s=aG(aG({},s),n),aT(this.data,i,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return(t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI)?aG(aG({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(function(e){return t[e]&&Object.keys(t[e]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),a}(aM),aU={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,a,r){var o=this;return e.forEach(function(e){o.processors[e]&&(t=o.processors[e].process(t,n,a,r))}),t}};function aq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function aH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?aq(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var aK={},aY=function(e){a_(a,e);var t,n=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=a$(a);return e=t?Reflect.construct(n,arguments,a$(this).constructor):n.apply(this,arguments),av(this,e)});function a(e){var t,r,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,am.A)(this,a),o=n.call(this),aF&&aM.call(ay(o)),t=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=ay(o),t.forEach(function(t){e[t]&&(r[t]=e[t])}),o.options=i,void 0===o.options.keySeparator&&(o.options.keySeparator="."),o.logger=aD.create("translator"),o}return(0,ag.A)(a,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,r=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,i=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!function(e,t,n){t=t||"",n=n||"";var a=aL.filter(function(e){return 0>t.indexOf(e)&&0>n.indexOf(e)});if(0===a.length)return!0;var r=new RegExp("(".concat(a.map(function(e){return"?"===e?"\\?":e}).join("|"),")")),o=!r.test(e);if(!o){var i=e.indexOf(n);i>0&&!r.test(e.substring(0,i))&&(o=!0)}return o}(e,n,a);if(o&&!i){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:r};var l=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(l[0])>-1)&&(r=l.shift()),e=l.join(a)}return"string"==typeof r&&(r=[r]),{key:e,namespaces:r}}},{key:"translate",value:function(e,t,n){var r=this;if("object"!==(0,ah.A)(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],p=t.lng||this.language,d=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&"cimode"===p.toLowerCase()){if(d){var f=t.nsSeparator||this.options.nsSeparator;return o?(h.res="".concat(u).concat(f).concat(l),h):"".concat(u).concat(f).concat(l)}return o?(h.res=l,h):l}var h=this.resolve(e,t),m=h&&h.res,g=h&&h.usedKey||l,y=h&&h.exactUsedKey||l,b=Object.prototype.toString.apply(m),v=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,$=!this.i18nFormat||this.i18nFormat.handleAsObject,A="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if($&&m&&A&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(b)&&("string"!=typeof v||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,aH(aH({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(h.res=w,h):w}if(i){var k="[object Array]"===b,x=k?[]:{},C=k?y:g;for(var E in m)if(Object.prototype.hasOwnProperty.call(m,E)){var S="".concat(C).concat(i).concat(E);x[E]=this.translate(S,aH(aH({},t),{joinArrays:!1,ns:c})),x[E]===S&&(x[E]=m[E])}m=x}}else if($&&"string"==typeof v&&"[object Array]"===b)(m=m.join(v))&&(m=this.extendTranslation(m,e,t,n));else{var D=!1,M=!1,z=void 0!==t.count&&"string"!=typeof t.count,O=a.hasDefaultValue(t),P=z?this.pluralResolver.getSuffix(p,t.count,t):"",T=t["defaultValue".concat(P)]||t.defaultValue;!this.isValidLookup(m)&&O&&(D=!0,m=T),this.isValidLookup(m)||(M=!0,m=l);var B=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&M?void 0:m,I=O&&T!==m&&this.options.updateMissing;if(M||D||I){if(this.logger.log(I?"updateKey":"missingKey",p,u,l,I?T:m),i){var N=this.resolve(l,aH(aH({},t),{},{keySeparator:!1}));N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var j=[],R=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&R&&R[0])for(var F=0;F<R.length;F++)j.push(R[F]);else"all"===this.options.saveMissingTo?j=this.languageUtils.toResolveHierarchy(t.lng||this.language):j.push(t.lng||this.language);var L=function(e,n,a){var o=O&&a!==m?a:B;r.options.missingKeyHandler?r.options.missingKeyHandler(e,u,n,o,I,t):r.backendConnector&&r.backendConnector.saveMissing&&r.backendConnector.saveMissing(e,u,n,o,I,t),r.emit("missingKey",e,u,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&z?j.forEach(function(e){r.pluralResolver.getSuffixes(e,t).forEach(function(n){L([e],l+n,t["defaultValue".concat(n)]||T)})}):L(j,l,T))}m=this.extendTranslation(m,e,t,h,n),M&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(M||D)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,D?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(h.res=m,h):m}},{key:"extendTranslation",value:function(e,t,n,a,r){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,aH(aH({},this.options.interpolation.defaultVariables),n),a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(aH(aH({},n),{interpolation:aH(aH({},this.options.interpolation),n.interpolation)}));var i,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var l=e.match(this.interpolator.nestingRegexp);i=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=aH(aH({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),s){var u=e.match(this.interpolator.nestingRegexp);i<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,a=Array(e),i=0;i<e;i++)a[i]=arguments[i];return r&&r[0]===a[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(a[0]," in key: ").concat(t[0])),null):o.translate.apply(o,a.concat([t]))},n)),n.interpolation&&this.interpolator.reset()}var p=n.postProcess||this.options.postProcess,d="string"==typeof p?[p]:p;return null!=e&&d&&d.length&&!1!==n.applyPostProcessor&&(e=aU.handle(d,e,t,this.options&&this.options.postProcessPassResolved?aH({i18nResolved:a},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,a,r,o,i=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!i.isValidLookup(t)){var l=i.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;i.options.fallbackNS&&(u=u.concat(i.options.fallbackNS));var p=void 0!==s.count&&"string"!=typeof s.count,d=p&&!s.ordinal&&0===s.count&&i.pluralResolver.shouldUseIntlApi(),f=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,h=s.lngs?s.lngs:i.languageUtils.toResolveHierarchy(s.lng||i.language,s.fallbackLng);u.forEach(function(e){i.isValidLookup(t)||(o=e,!aK["".concat(h[0],"-").concat(e)]&&i.utils&&i.utils.hasLoadedNamespace&&!i.utils.hasLoadedNamespace(o)&&(aK["".concat(h[0],"-").concat(e)]=!0,i.logger.warn('key "'.concat(n,'" for languages "').concat(h.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),h.forEach(function(n){if(!i.isValidLookup(t)){r=n;var o,l=[c];if(i.i18nFormat&&i.i18nFormat.addLookupKeys)i.i18nFormat.addLookupKeys(l,c,n,e,s);else{p&&(u=i.pluralResolver.getSuffix(n,s.count,s));var u,h="".concat(i.options.pluralSeparator,"zero");if(p&&(l.push(c+u),d&&l.push(c+h)),f){var m="".concat(c).concat(i.options.contextSeparator).concat(s.context);l.push(m),p&&(l.push(m+u),d&&l.push(m+h))}}for(;o=l.pop();)i.isValidLookup(t)||(a=o,t=i.getResource(n,e,o,s))}}))})}}),{res:t,usedKey:n,exactUsedKey:a,usedLng:r,usedNS:o}}},{key:"isValidLookup",value:function(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,a):this.resourceStore.getResource(e,t,n,a)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),a}(aM);function aJ(e){return e.charAt(0).toUpperCase()+e.slice(1)}var aZ=function(){function e(t){(0,am.A)(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=aD.create("languageUtils")}return(0,ag.A)(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return null;var t=e.split("-");return 2===t.length||(t.pop(),"x"===t[t.length-1].toLowerCase())?null:this.formatLanguageCode(t.join("-"))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map(function(e){return e.toLowerCase()}):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=aJ(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=aJ(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=aJ(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach(function(e){if(!t){var a=n.formatLanguageCode(e);(!n.options.supportedLngs||n.isSupportedCode(a))&&(t=a)}}),!t&&this.options.supportedLngs&&e.forEach(function(e){if(!t){var a=n.getLanguagePartFromCode(e);if(n.isSupportedCode(a))return t=a;t=n.options.supportedLngs.find(function(e){if(0===e.indexOf(a))return e})}}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,a=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],o=function(e){e&&(n.isSupportedCode(e)?r.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),a.forEach(function(e){0>r.indexOf(e)&&o(n.formatLanguageCode(e))}),r}}]),e}(),aX=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],aQ={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(+(1!=e&&(e%10!=1||e%100==11)))},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:3*(e%100==3||e%100==4))},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},a0=["v1","v2","v3"],a1={zero:0,one:1,two:2,few:3,many:4,other:5},a2=function(){function e(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,am.A)(this,e),this.languageUtils=t,this.options=a,this.logger=aD.create("pluralResolver"),(!this.options.compatibilityJSON||"v4"===this.options.compatibilityJSON)&&("u"<typeof Intl||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},aX.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:aQ[e.fc]}})}),n)}return(0,ag.A)(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(function(e){return"".concat(t).concat(e)})}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.getRule(e,n);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(e,t){return a1[e]-a1[t]}).map(function(e){return"".concat(t.options.prepend).concat(e)}):a.numbers.map(function(a){return t.getSuffix(e,a,n)}):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this.getRule(e,n);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(t)):this.getSuffixRetroCompatible(a,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,a=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),r=e.numbers[a];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));var o=function(){return n.options.prepend&&r.toString()?n.options.prepend+r.toString():r.toString()};return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?"_plural_".concat(r.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!a0.includes(this.options.compatibilityJSON)}}]),e}();function a3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function a4(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a3(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a3(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var a5=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,am.A)(this,e),this.logger=aD.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return(0,ag.A)(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:aR,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?aN(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?aN(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?aN(t.nestingPrefix):t.nestingPrefixEscaped||aN("$t("),this.nestingSuffix=t.nestingSuffix?aN(t.nestingSuffix):t.nestingSuffixEscaped||aN(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,a){var r,o,i,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(0>e.indexOf(s.formatSeparator)){var r=aI(t,l,e);return s.alwaysFormat?s.format(r,void 0,n,a4(a4(a4({},a),t),{},{interpolationkey:e})):r}var o=e.split(s.formatSeparator),i=o.shift().trim(),c=o.join(s.formatSeparator).trim();return s.format(aI(t,l,i),c,n,a4(a4(a4({},a),t),{},{interpolationkey:i}))};this.resetRegExp();var p=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,d=a&&a.interpolation&&void 0!==a.interpolation.skipOnVariables?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?c(s.escape(e)):c(e)}}].forEach(function(t){for(i=0;r=t.regex.exec(e);){var n=r[1].trim();if(void 0===(o=u(n)))if("function"==typeof p){var l=p(e,r,a);o="string"==typeof l?l:""}else if(a&&a.hasOwnProperty(n))o="";else if(d){o=r[0];continue}else s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o="";else"string"==typeof o||s.useRawValueToEscape||(o=aO(o));var c=t.safeValue(o);if(e=e.replace(r[0],c),d?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,++i>=s.maxReplaces)break}}),e}},{key:"nest",value:function(e,t){var n,a,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=a4({},o);function s(e,t){var n=this.nestingOptionsSeparator;if(0>e.indexOf(n))return e;var a=e.split(new RegExp("".concat(n,"[ ]*{"))),r="{".concat(a[1]);e=a[0];var o=(r=this.interpolate(r,i)).match(/'/g),s=r.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(r=r.replace(/'/g,'"'));try{i=JSON.parse(r),t&&(i=a4(a4({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(r)}return delete i.defaultValue,e}for(i.applyPostProcessor=!1,delete i.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map(function(e){return e.trim()});n[1]=u.shift(),l=u,c=!0}if((a=t(s.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof a)return a;"string"!=typeof a&&(a=aO(a)),a||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),a=""),c&&(a=l.reduce(function(e,t){return r.format(e,t,o.lng,a4(a4({},o),{},{interpolationkey:n[1].trim()}))},a.trim())),e=e.replace(n[0],a),this.regexp.lastIndex=0}return e}}]),e}();function a6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function a8(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a6(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a6(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a7(e){var t={};return function(n,a,r){var o=a+JSON.stringify(r),i=t[o];return i||(i=e(a,r),t[o]=i),i(n)}}var a9=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,am.A)(this,e),this.logger=aD.create("formatter"),this.options=t,this.formats={number:a7(function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}}),currency:a7(function(e,t){var n=new Intl.NumberFormat(e,a8(a8({},t),{},{style:"currency"}));return function(e){return n.format(e)}}),datetime:a7(function(e,t){var n=new Intl.DateTimeFormat(e,a8({},t));return function(e){return n.format(e)}}),relativetime:a7(function(e,t){var n=new Intl.RelativeTimeFormat(e,a8({},t));return function(e){return n.format(e,t.range||"day")}}),list:a7(function(e,t){var n=new Intl.ListFormat(e,a8({},t));return function(e){return n.format(e)}})},this.init(t)}return(0,ag.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=a7(t)}},{key:"format",value:function(e,t,n,a){var r=this;return t.split(this.formatSeparator).reduce(function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var a=e.split("(");t=a[0].toLowerCase().trim();var r=a[1].substring(0,a[1].length-1);"currency"===t&&0>r.indexOf(":")?n.currency||(n.currency=r.trim()):"relativetime"===t&&0>r.indexOf(":")?n.range||(n.range=r.trim()):r.split(";").forEach(function(e){if(e){var t,a=(t=e.split(":"),(0,aw.A)(t)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||(0,ak.A)(t)||(0,ax.A)()),r=a[0],o=a.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=o),"false"===o&&(n[r.trim()]=!1),"true"===o&&(n[r.trim()]=!0),isNaN(o)||(n[r.trim()]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}}(t),i=o.formatName,s=o.formatOptions;if(r.formats[i]){var l=e;try{var c=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},u=c.locale||c.lng||a.locale||a.lng||n;l=r.formats[i](e,u,a8(a8(a8({},s),a),c))}catch(e){r.logger.warn(e)}return l}return r.logger.warn("there was no format function for ".concat(i)),e},e)}}]),e}();function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function rt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var rn=function(e){a_(a,e);var t,n=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=a$(a);return e=t?Reflect.construct(n,arguments,a$(this).constructor):n.apply(this,arguments),av(this,e)});function a(e,t,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,am.A)(this,a),o=n.call(this),aF&&aM.call(ay(o)),o.backend=e,o.store=t,o.services=r,o.languageUtils=r.languageUtils,o.options=i,o.logger=aD.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=i.maxParallelReads||10,o.readingCalls=0,o.maxRetries=i.maxRetries>=0?i.maxRetries:5,o.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(r,i.backend,i),o}return(0,ag.A)(a,[{key:"queueLoad",value:function(e,t,n,a){var r=this,o={},i={},s={},l={};return e.forEach(function(e){var a=!0;t.forEach(function(t){var s="".concat(e,"|").concat(t);!n.reload&&r.store.hasResourceBundle(e,t)?r.state[s]=2:r.state[s]<0||(1===r.state[s]?void 0===i[s]&&(i[s]=!0):(r.state[s]=1,a=!1,void 0===i[s]&&(i[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))}),a||(s[e]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var a=e.split("|"),r=a[0],o=a[1];t&&this.emit("failedLoading",r,o,t),n&&this.store.addResourceBundle(r,o,n),this.state[e]=t?-1:2;var i={};this.queue.forEach(function(n){var a,s,l,c;a=n.loaded,(l=(s=aP(a,[r],Object)).obj)[c=s.k]=l[c]||[],l[c].push(o),void 0!==n.pending[e]&&(delete n.pending[e],n.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(function(e){i[e]||(i[e]={});var t=n.loaded[e];t.length&&t.forEach(function(t){void 0===i[e][t]&&(i[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,n){var a=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:o,callback:i}):(this.readingCalls++,this.backend[n](e,t,function(s,l){if(a.readingCalls--,a.waitingReads.length>0){var c=a.waitingReads.shift();a.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}s&&l&&r<a.maxRetries?setTimeout(function(){a.read.call(a,e,t,n,r+1,2*o,i)},o):i(s,l)})):i(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,a,r);if(!o.toLoad.length)return o.pending.length||r(),null;o.toLoad.forEach(function(e){n.loadOne(e)})}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=e.split("|"),r=a[0],o=a[1];this.read(r,o,"read",void 0,void 0,function(a,i){a&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(r," failed"),a),!a&&i&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(r),i),t.loaded(e,a,i)})}},{key:"saveMissing",value:function(e,t,n,a,r){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null==n||""===n||(this.backend&&this.backend.create&&this.backend.create(e,t,n,a,null,rt(rt({},o),{},{isUpdate:r})),e&&e[0]&&this.store.addResource(e[0],t,n,a))}}]),a}(aM);function ra(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&0>e.supportedLngs.indexOf("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function ro(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rr(Object(n),!0).forEach(function(t){(0,aA.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ri(){}var rs=function(e){a_(a,e);var t,n=(t=function(){if("u"<typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,n=a$(a);return e=t?Reflect.construct(n,arguments,a$(this).constructor):n.apply(this,arguments),av(this,e)});function a(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if((0,am.A)(this,a),t=n.call(this),aF&&aM.call(ay(t)),t.options=ra(r),t.services={},t.logger=aD,t.modules={external:[]},Object.getOwnPropertyNames(Object.getPrototypeOf(e=ay(t))).forEach(function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}),o&&!t.isInitialized&&!r.isClone){if(!t.options.initImmediate)return t.init(r,o),av(t,ay(t));setTimeout(function(){t.init(r,o)},0)}return t}return(0,ag.A)(a,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:0>t.ns.indexOf("translation")&&(t.defaultNS=t.ns[0]));var a={debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===(0,ah.A)(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===(0,ah.A)(e[2])||"object"===(0,ah.A)(e[3])){var n=e[3]||e[2];Object.keys(n).forEach(function(e){t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,n,a){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}};function r(e){return e?"function"==typeof e?new e:e:null}if(this.options=ro(ro(ro({},a),this.options),ra(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=ro(ro({},a.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){this.modules.logger?aD.init(r(this.modules.logger),this.options):aD.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"u">typeof Intl&&(o=a9);var o,i=new aZ(this.options);this.store=new aV(this.options.resources,this.options);var s=this.services;s.logger=aD,s.resourceStore=this.store,s.languageUtils=i,s.pluralResolver=new a2(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),o&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(s.formatter=r(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new a5(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new rn(r(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",function(t){for(var n=arguments.length,a=Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];e.emit.apply(e,[t].concat(a))}),this.modules.languageDetector&&(s.languageDetector=r(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=r(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new aY(this.services,this.options),this.translator.on("*",function(t){for(var n=arguments.length,a=Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];e.emit.apply(e,[t].concat(a))}),this.modules.external.forEach(function(t){t.init&&t.init(e)})}if(this.format=this.options.interpolation.format,n||(n=ri),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}});var c=az(),u=function(){var t=function(t,a){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),c.resolve(a),n(t,a)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ri,a=n,r="string"==typeof e?e:this.language;if("function"==typeof e&&(a=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return a();var o=[],i=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach(function(e){0>o.indexOf(e)&&o.push(e)})};r?i(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return i(e)}),this.options.preload&&this.options.preload.forEach(function(e){return i(e)}),this.services.backendConnector.load(o,this.options.ns,function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),a(e)})}else a(null)}},{key:"reloadResources",value:function(e,t,n){var a=az();return e||(e=this.languages),t||(t=this.options.ns),n||(n=ri),this.services.backendConnector.reload(e,t,function(e){a.resolve(),n(e)}),a}},{key:"use",value:function(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&aU.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var a=az();this.emit("languageChanging",e);var r=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(e,o){o?(r(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,a.resolve(function(){return n.t.apply(n,arguments)}),t&&t(e,function(){return n.t.apply(n,arguments)})},i=function(t){e||t||!n.services.languageDetector||(t=[]);var a="string"==typeof t?t:n.services.languageUtils.getBestMatchFromCodes(t);a&&(n.language||r(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,function(e){o(e,a)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),a}},{key:"getFixedT",value:function(e,t,n){var a=this,r=function e(t,r){if("object"!==(0,ah.A)(r)){for(var o,i=arguments.length,s=Array(i>2?i-2:0),l=2;l<i;l++)s[l-2]=arguments[l];o=a.options.overloadTranslationOptionHandler([t,r].concat(s))}else o=ro({},r);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=a.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return a.t(u,o)};return"string"==typeof e?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===a.toLowerCase())return!0;var i=function(e,n){var a=t.services.backendConnector.state["".concat(e,"|").concat(n)];return -1===a||2===a};if(n.precheck){var s=n.precheck(this,i);if(void 0!==s)return s}return!!(this.hasResourceBundle(a,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(a,e)&&(!r||i(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,a=az();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){0>n.options.ns.indexOf(e)&&n.options.ns.push(e)}),this.loadResources(function(e){a.resolve(),t&&t(e)}),a):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=az();"string"==typeof e&&(e=[e]);var a=this.options.preload||[],r=e.filter(function(e){return 0>a.indexOf(e)});return r.length?(this.options.preload=a.concat(r),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),e)?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr":"rtl"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ri,r=ro(ro(ro({},this.options),t),{isClone:!0}),o=new a(r);return(void 0!==t.debug||void 0!==t.prefix)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(function(t){o[t]=e[t]}),o.services=ro({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new aY(o.services,o.options),o.translator.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];o.emit.apply(o,[e].concat(n))}),o.init(r,n),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),a}(aM);(0,aA.A)(rs,"createInstance",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new rs(e,t)});var rl=rs.createInstance();rl.createInstance=rs.createInstance,rl.createInstance,rl.init,rl.loadResources,rl.reloadResources,rl.use,rl.changeLanguage,rl.getFixedT,rl.t,rl.exists,rl.setDefaultNamespace,rl.hasLoadedNamespace,rl.loadNamespaces,rl.loadLanguages;let rc=rl.default||rl;function ru(e,t,n,a){return rc.t(t,{ns:e,defaultValue:n,...a})}function rp(e,t,n){return af[e]?ru("core",e,t??af[e],n):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}rc.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let rd="import-map-override:",rf="import-map-overrides-disabled",rh="import-map-overrides:change",rm=!1,rg=null;async function ry(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[];for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return rb(t)}function rb(e){let t={imports:{}};for(let n of e)n?.imports&&Object.assign(t.imports,n.imports);return t}function r_(){let e={};try{let t=rk();for(let n=0;n<localStorage.length;n++){let a=localStorage.key(n);if(a?.startsWith(rd)){let n=a.slice(rd.length);if(!t.includes(n)){let t=localStorage.getItem(a);t&&(e[n]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function rv(){let e=await ry();return rm?rb([e,rg??r_()]):e}async function r$(){return ry()}async function rA(){return rm?rb([await ry(),r_()]):ry()}function rw(e){if(!rm)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(rd)){let t=localStorage.getItem(n);t&&(e[n.slice(rd.length)]=t)}}return{imports:e}}return r_()}function rk(){if(!rm)return[];try{let e=localStorage.getItem(rf);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function rx(e){return!!rm&&rk().includes(e)}function rC(e,t){if(!rm)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(rd+e,t),window.dispatchEvent(new CustomEvent(rh))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function rE(e){if(!rm)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(rd+e);let t=rk().filter(t=>t!==e);t.length>0?localStorage.setItem(rf,JSON.stringify(t)):localStorage.removeItem(rf),window.dispatchEvent(new CustomEvent(rh))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function rS(){if(!rm)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(rd)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(rf),window.dispatchEvent(new CustomEvent(rh))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function rD(e){if(!rm)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=rk().filter(t=>t!==e);t.length>0?localStorage.setItem(rf,JSON.stringify(t)):localStorage.removeItem(rf),window.dispatchEvent(new CustomEvent(rh))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let rM=!1;function rz(){!rM&&(rM=!0,(rm="development"===window.spaEnv)&&(rg=r_()))}function rO(e){return e.replace(/[\/\-@]/g,"_")}async function rP(e,t="./start",a){var r;let o,i=!a?.maxLoadingTime||a.maxLoadingTime<=0?6e5:a.maxLoadingTime;await Promise.race([rT(e,a?.importMap),new Promise((t,n)=>{o=setTimeout(()=>{var t;n(Error(`Could not resolve requested script, ${e}, within ${(t=i)<1e3?`${t} milliseconds`:t<6e4?`${Math.floor(t/1e3)} seconds`:t<36e5?`${Math.floor(t/6e4)} minutes`:t<864e5?`${Math.floor(t/36e5)} hours`:`${Math.floor(t/864e5)} days`}.`))},i)})]),o&&clearTimeout(o);let s=rO(e),l=window[s];if(!("object"==typeof(r=l)&&null!==r&&"init"in r&&"function"==typeof r.init&&"get"in r&&"function"==typeof r.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(n.S.default);let c=(await l.get(t))();if("object"!=typeof c||null===c){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return c}async function rT(e,t){if("string"!=typeof e||0===e.trim().length){let e="Attempted to call importDynamic() without supplying a package to load";throw console.error(e),Error(e)}let n=rO(e);if(!window[n]){let n=t??await rB();if(!n.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let a=n.imports[e];a.startsWith("./")&&(a=window.spaBase+a.substring(1));let r=e in rw().imports;try{return await new Promise((e,t)=>{!function(e,t,n){let a=document.head.querySelector(`script[src="${e}"]`),r=window[rI];if(r||(r=window[rI]=new Set([])),a)if(r.has(e)){let e,r,o;o=()=>{e&&a.removeEventListener("load",e),r&&a.removeEventListener("error",r)},e=()=>{o(),t(null)},r=e=>{o(),n(e.message)},a.addEventListener("load",e),a.addEventListener("error",r)}else console.warn(`Script at ${e} already loaded. Not loading it again.`),t(null);else{let a,o,i;r.add(e);let s=document.createElement("script");s.src=e,s.type="text/javascript",s.async=!0;let l=setTimeout(()=>{console.error(`The script at ${e} did not load within 5 seconds. This may indicate an issue with the imports in the script's entry-point file or with the script's bundler configuration.`)},5e3);i=()=>{clearTimeout(l),r.delete(e),a&&s.removeEventListener("load",a),o&&s.removeEventListener("error",o)},a=()=>{i(),t(null)},o=t=>{i();let a=`Failed to load script from ${e}`;console.error(a,t),n(t.message??a)},s.addEventListener("load",a),s.addEventListener("error",o),document.head.appendChild(s)}}(a,e,t)})}catch(e){return r&&D({kind:"error",title:rp("scriptLoadingFailed","Error: Script failed to load"),description:rp("scriptLoadingError","Failed to load overridden script from {{- url}}. Please check that the bundled script is available at the expected URL. Click the button below to reset all import map overrides.",{url:a}),actionButtonLabel:rp("resetOverrides","Reset overrides"),onActionButtonClick(){rS(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function rB(){return rv()}let rI=Symbol("__openmrs_script_loading");function rN(e){return!!e&&"object"==typeof e&&!(Object.hasOwn(e,"pages")&&(!e.pages||!Array.isArray(e.pages))||Object.hasOwn(e,"extensions")&&(!e.extensions||!Array.isArray(e.extensions))||Object.hasOwn(e,"workspaces")&&(!e.workspaces||!Array.isArray(e.workspaces))||Object.hasOwn(e,"modals")&&(!e.modals||!Array.isArray(e.modals)))}function rj(e){return!!e&&"object"==typeof e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&rN(t))}let rR="openmrs-routes:",rF="openmrs-routes:change",rL=!1,rW=null;async function rG(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[];for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&rj(e)&&t.push(e)}catch(e){console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return rV(t)}function rV(e){let t={};for(let n of e)n&&"object"==typeof n&&Object.assign(t,n);return t}async function rU(){let e={};try{let t=[];for(let e=0;e<localStorage.length;e++){let n=localStorage.key(e);if(n?.startsWith(rR)){let e=localStorage.getItem(n);e&&t.push({moduleName:n.slice(rR.length),raw:e})}}for(let n of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let n=JSON.parse(t);if(rN(n))return{moduleName:e,routes:n};if("string"==typeof n&&n.startsWith("http")){let t=await fetch(n),a=await t.json();if(rN(a))return{moduleName:e,routes:a};throw Error(`${n} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===n.status?e[n.value.moduleName]=n.value.routes:console.warn("[route-maps] Failed to load route override",n.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function rq(){let e=await rG();return rL?rV([e,rW??await rU()]):e}async function rH(){return rG()}async function rK(){return rL?rV([await rG(),await rU()]):rG()}function rY(){if(!rL)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(rR)){let t=localStorage.getItem(n);t&&(e[n.slice(rR.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function rJ(e,t){if(!rL)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(rR+e,JSON.stringify(t));else{let n=JSON.parse(t);if(!rN(n))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(rR+e,JSON.stringify(n))}else if(t instanceof URL)localStorage.setItem(rR+e,JSON.stringify(t.toString()));else{if(!rN(t))return void console.error(`Override for ${e} is not in a valid format. Expected either a Javascript Object, a JSON string of a Javascript object, or a URL`,t);localStorage.setItem(rR+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(rF))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function rZ(e){if(!rL)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(rR+e),window.dispatchEvent(new CustomEvent(rF))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function rX(){if(!rL)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(rR)&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(rF))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let rQ=null;function r0(){return rQ||(rQ=(rL="development"===window.spaEnv)?rU().then(e=>{rW=e}):Promise.resolve())}let r1=`${n0}/attachment`;function r2(e,t){return n4(`${r1}/${e}`,{signal:t.signal})}function r3(e,t,n){return n4(`${r1}?patient=${e}&includeEncounterless=${t}`,{signal:n.signal})}async function r4(e,t){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),n4(`${r1}`,{method:"POST",body:n})}function r5(e,t){return n4(`${r1}/${e}`,{method:"DELETE",signal:t.signal})}try{self["workbox:window:6.5.4"]&&_()}catch(e){}function r6(e,t){return new Promise(function(n){var a=new MessageChannel;a.port1.onmessage=function(e){n(e.data)},e.postMessage(t,[a.port2])})}function r8(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r7(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}try{self["workbox:core:6.5.4"]&&_()}catch(e){}var r9=function(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n})};function oe(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var ot=function(e,t){this.type=e,Object.assign(this,t)};function on(e,t,n){return n?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}function oa(){}var or={type:"SKIP_WAITING"};function oo(e,t){if(!t)return e&&e.then?e.then(oa):Promise.resolve()}var oi=function(e){function t(t,n){var a,r;return void 0===n&&(n={}),(a=e.call(this)||this).nn={},a.tn=0,a.rn=new r9,a.en=new r9,a.on=new r9,a.un=0,a.an=new Set,a.cn=function(){var e=a.fn,t=e.installing;a.tn>0||!oe(t.scriptURL,a.sn.toString())||performance.now()>a.un+6e4?(a.vn=t,e.removeEventListener("updatefound",a.cn)):(a.hn=t,a.an.add(t),a.rn.resolve(t)),++a.tn,t.addEventListener("statechange",a.ln)},a.ln=function(e){var t=a.fn,n=e.target,r=n.state,o=n===a.vn,i={sw:n,isExternal:o,originalEvent:e};!o&&a.mn&&(i.isUpdate=!0),a.dispatchEvent(new ot(r,i)),"installed"===r?a.wn=self.setTimeout(function(){"installed"===r&&t.waiting===n&&a.dispatchEvent(new ot("waiting",i))},200):"activating"===r&&(clearTimeout(a.wn),o||a.en.resolve(n))},a.dn=function(e){var t=a.hn,n=t!==navigator.serviceWorker.controller;a.dispatchEvent(new ot("controlling",{isExternal:n,originalEvent:e,sw:t,isUpdate:a.mn})),n||a.on.resolve(t)},r=function(e){var t=e.data,n=e.ports,r=e.source;return on(a.getSW(),function(){a.an.has(r)&&a.dispatchEvent(new ot("message",{data:t,originalEvent:e,ports:n,sw:r}))})},a.gn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(r.apply(this,e))}catch(e){return Promise.reject(e)}},a.sn=t,a.nn=n,navigator.serviceWorker.addEventListener("message",a.gn),a}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e;var n,a,r=t.prototype;return r.register=function(e){var t=(void 0===e?{}:e).immediate,n=void 0!==t&&t;try{var a,r,o,i=this;return a=function(){if(!n&&"complete"!==document.readyState)return oo(new Promise(function(e){return window.addEventListener("load",e)}))},r=function(){return i.mn=!!navigator.serviceWorker.controller,i.yn=i.pn(),on(i.bn(),function(e){i.fn=e,i.yn&&(i.hn=i.yn,i.en.resolve(i.yn),i.on.resolve(i.yn),i.yn.addEventListener("statechange",i.ln,{once:!0}));var t=i.fn.waiting;return t&&oe(t.scriptURL,i.sn.toString())&&(i.hn=t,Promise.resolve().then(function(){i.dispatchEvent(new ot("waiting",{sw:t,wasWaitingBeforeRegister:!0}))}).then(function(){})),i.hn&&(i.rn.resolve(i.hn),i.an.add(i.hn)),i.fn.addEventListener("updatefound",i.cn),navigator.serviceWorker.addEventListener("controllerchange",i.dn),i.fn})},(o=a())&&o.then?o.then(r):r(o)}catch(e){return Promise.reject(e)}},r.update=function(){try{return this.fn?oo(this.fn.update()):void 0}catch(e){return Promise.reject(e)}},r.getSW=function(){return void 0!==this.hn?Promise.resolve(this.hn):this.rn.promise},r.messageSW=function(e){try{return on(this.getSW(),function(t){return r6(t,e)})}catch(e){return Promise.reject(e)}},r.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&r6(this.fn.waiting,or)},r.pn=function(){var e=navigator.serviceWorker.controller;return e&&oe(e.scriptURL,this.sn.toString())?e:void 0},r.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 on(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)}},n=[{key:"active",get:function(){return this.en.promise}},{key:"controlling",get:function(){return this.on.promise}}],r8(t.prototype,n),a&&r8(t,a),t}(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){var t;if("u"<typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return r7(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r7(e,void 0):void 0}}(e))){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}(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}());function os(e,t){if(void 0!==u)return console.warn(`The application's Service Worker has already been registered. The new service worker at ${e} will not be registered.`),u;if(!("serviceWorker"in navigator))throw Error("Registering the Service Worker is not possible due to missing browser capabilities.");let n=new oi(e,t);return u=n.register().then(()=>n.controlling.then(()=>n))}function ol(){return u??Promise.resolve(void 0)}let oc="x-omrs-offline-response-body",ou="x-omrs-offline-response-status",op="x-omrs-offline-caching-strategy";async function od(e){let t=await ol();return t?await t.messageSW(e):{success:!1,result:void 0,error:"No service worker has been registered. This is typically the case when the application has been built without offline-related features."}}async function of(){let e=window.sessionStorage;try{e.setItem("someKeyHere","test"),e.removeItem("someKeyHere")}catch(t){if(t.code===DOMException.QUOTA_EXCEEDED_ERR&&0===e.length)return!0}return!1}async function oh(){return!window.indexedDB}async function om(){return new Promise(e=>{let t=indexedDB.open("test");t.onerror=()=>e(!0),t.onsuccess=()=>e(!1)})}async function og(){return await om()||await oh()||await of()}let oy="openmrs3:offline-mode",ob="unavailable";function o_(){return{current:ob,notAvailable:"unavailable"===ob,active:"on"===ob}}function ov(e){"unavailable"!==ob&&"unavailable"!==e&&(localStorage.setItem(oy,"on"===e?"active":"disabled"),ob=e)}async function o$(){await og()||(ob="active"===localStorage.getItem(oy)?"on":"off"),navigator.onLine}let oA="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:global,ow=Object.keys,ok=Array.isArray;function ox(e,t){return"object"!=typeof t||ow(t).forEach(function(n){e[n]=t[n]}),e}"u"<typeof Promise||oA.Promise||(oA.Promise=Promise);let oC=Object.getPrototypeOf,oE={}.hasOwnProperty;function oS(e,t){return oE.call(e,t)}function oD(e,t){"function"==typeof t&&(t=t(oC(e))),("u"<typeof Reflect?ow:Reflect.ownKeys)(t).forEach(n=>{oz(e,n,t[n])})}let oM=Object.defineProperty;function oz(e,t,n,a){oM(e,t,ox(n&&oS(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},a))}function oO(e){return{from:function(t){return e.prototype=Object.create(t.prototype),oz(e.prototype,"constructor",e),{extend:oD.bind(null,e.prototype)}}}}let oP=Object.getOwnPropertyDescriptor;function oT(e,t){let n;return oP(e,t)||(n=oC(e))&&oT(n,t)}let oB=[].slice;function oI(e,t,n){return oB.call(e,t,n)}function oN(e,t){return t(e)}function oj(e){if(!e)throw Error("Assertion Failed")}function oR(e){oA.setImmediate?setImmediate(e):setTimeout(e,0)}function oF(e,t){return e.reduce((e,n,a)=>{var r=t(n,a);return r&&(e[r[0]]=r[1]),e},{})}function oL(e,t){if(oS(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],a=0,r=t.length;a<r;++a){var o=oL(e,t[a]);n.push(o)}return n}var i=t.indexOf(".");if(-1!==i){var s=e[t.substr(0,i)];return void 0===s?void 0:oL(s,t.substr(i+1))}}function oW(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){oj("string"!=typeof n&&"length"in n);for(var a=0,r=t.length;a<r;++a)oW(e,t[a],n[a])}else{var o=t.indexOf(".");if(-1!==o){var i=t.substr(0,o),s=t.substr(o+1);if(""===s)void 0===n?ok(e)&&!isNaN(parseInt(i))?e.splice(i,1):delete e[i]:e[i]=n;else{var l=e[i];l&&oS(e,i)||(l=e[i]={}),oW(l,s,n)}}else void 0===n?ok(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function oG(e){var t={};for(var n in e)oS(e,n)&&(t[n]=e[n]);return t}let oV=[].concat;function oU(e){return oV.apply([],e)}let oq="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(oU([8,16,32,64].map(e=>["Int","Uint","Float"].map(t=>t+e+"Array")))).filter(e=>oA[e]),oH=oq.map(e=>oA[e]);oF(oq,e=>[e,!0]);let oK=null;function oY(e){oK="u">typeof WeakMap&&new WeakMap;let t=function e(t){if(!t||"object"!=typeof t)return t;let n=oK&&oK.get(t);if(n)return n;if(ok(t)){n=[],oK&&oK.set(t,n);for(var a=0,r=t.length;a<r;++a)n.push(e(t[a]))}else if(oH.indexOf(t.constructor)>=0)n=t;else{let a=oC(t);for(var o in n=a===Object.prototype?{}:Object.create(a),oK&&oK.set(t,n),t)oS(t,o)&&(n[o]=e(t[o]))}return n}(e);return oK=null,t}let{toString:oJ}={};function oZ(e){return oJ.call(e).slice(8,-1)}let oX="u">typeof Symbol?Symbol.iterator:"@@iterator",oQ="symbol"==typeof oX?function(e){var t;return null!=e&&(t=e[oX])&&t.apply(e)}:function(){return null},o0={};function o1(e){var t,n,a,r;if(1==arguments.length){if(ok(e))return e.slice();if(this===o0&&"string"==typeof e)return[e];if(r=oQ(e)){for(n=[];!(a=r.next()).done;)n.push(a.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}let o2="u">typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var o3="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),o4=()=>!0;let o5=!Error("").stack;function o6(){if(o5)try{throw o6.arguments,Error()}catch(e){return e}return Error()}function o8(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(o4).map(e=>"\n"+e).join("")):""}var o7=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],o9=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(o7),ie={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 it(e,t){this._e=o6(),this.name=e,this.message=t}function ia(e,t){return e+". Errors: "+Object.keys(t).map(e=>t[e].toString()).filter((e,t,n)=>n.indexOf(e)===t).join("\n")}function ir(e,t,n,a){this._e=o6(),this.failures=t,this.failedKeys=a,this.successCount=n,this.message=ia(e,t)}function io(e,t){this._e=o6(),this.name="BulkError",this.failures=Object.keys(t).map(e=>t[e]),this.failuresByPos=t,this.message=ia(e,t)}oO(it).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+o8(this._e,2))}},toString:function(){return this.name+": "+this.message}}),oO(ir).from(it),oO(io).from(it);var ii=o9.reduce((e,t)=>(e[t]=t+"Error",e),{}),is=o9.reduce((e,t)=>{var n=t+"Error";function a(e,a){this._e=o6(),this.name=n,e?"string"==typeof e?(this.message=`${e}${a?"\n "+a:""}`,this.inner=a||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=ie[t]||n,this.inner=null)}return oO(a).from(it),e[t]=a,e},{});is.Syntax=SyntaxError,is.Type=TypeError,is.Range=RangeError;var il=o7.reduce((e,t)=>(e[t+"Error"]=is[t],e),{}),ic=o9.reduce((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=is[t]),e),{});function iu(){}function ip(e){return e}function id(e,t){return null==e||e===ip?t:function(n){return t(e(n))}}function ih(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function im(e,t){return e===iu?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var a=this.onsuccess,r=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return a&&(this.onsuccess=this.onsuccess?ih(a,this.onsuccess):a),r&&(this.onerror=this.onerror?ih(r,this.onerror):r),void 0!==o?o:n}}function ig(e,t){return e===iu?t:function(){e.apply(this,arguments);var n=this.onsuccess,a=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?ih(n,this.onsuccess):n),a&&(this.onerror=this.onerror?ih(a,this.onerror):a)}}function iy(e,t){return e===iu?t:function(n){var a=e.apply(this,arguments);ox(n,a);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?ih(r,this.onsuccess):r),o&&(this.onerror=this.onerror?ih(o,this.onerror):o),void 0===a?void 0===i?void 0:i:ox(a,i)}}function ib(e,t){return e===iu?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function i_(e,t){return e===iu?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var a=this,r=arguments.length,o=Array(r);r--;)o[r]=arguments[r];return n.then(function(){return t.apply(a,o)})}return t.apply(this,arguments)}}ic.ModifyError=ir,ic.DexieError=it,ic.BulkError=io;var iv={};let[i$,iA,iw]="u"<typeof Promise?[]:(()=>{let e=Promise.resolve();if("u"<typeof crypto||!crypto.subtle)return[e,oC(e),e];let t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,oC(t),e]})(),ik=iA&&iA.then,ix=i$&&i$.constructor,iC=!!iw;var iE=!1,iS=iw?()=>{iw.then(iY)}:oA.setImmediate?setImmediate.bind(null,iY):oA.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver(()=>{iY(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(iY,0)},iD=function(e,t){ij.push([e,t]),iz&&(iS(),iz=!1)},iM=!0,iz=!0,iO=[],iP=[],iT=null,iB=ip,iI={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:sl,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{sl(e[0],e[1])}catch(e){}})}},iN=iI,ij=[],iR=0,iF=[];function iL(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=iu,this._lib=!1;var t=this._PSD=iN;if(o3&&(this._stackHolder=o6(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==iv)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&iV(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n(n=>{if(null===t._state){if(n===t)throw TypeError("A promise cannot be resolved with itself.");var a=t._lib&&iJ();n&&"function"==typeof n.then?e(t,(e,t)=>{n instanceof iL?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,iU(t)),a&&iZ()}},iV.bind(null,t))}catch(e){iV(t,e)}}(this,e)}let iW={get:function(){var e=iN,t=i5;function n(n,a){var r=!e.global&&(e!==iN||t!==i5);let o=r&&!i9();var i=new iL((t,i)=>{iq(this,new iG(si(n,e,r,o),si(a,e,r,o),t,i,e))});return o3&&iK(i,this),i}return n.prototype=iv,n},set:function(e){oz(this,"then",e&&e.prototype===iv?iW:{get:function(){return e},set:iW.set})}};function iG(e,t,n,a,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=a,this.psd=r}function iV(e,t){if(iP.push(t),null===e._state){var n=e._lib&&iJ();t=iB(t),e._state=!1,e._value=t,o3&&null!==t&&"object"==typeof t&&!t._promise&&function(e){try{e.apply(null,void 0)}catch(e){}}(()=>{var n=oT(t,"stack");t._promise=e,oz(t,"stack",{get:()=>iE?n&&(n.get?n.get.apply(t):n.value):e.stack})}),iO.some(t=>t._value===e._value)||iO.push(e),iU(e),n&&iZ()}}function iU(e){var t=e._listeners;e._listeners=[];for(var n=0,a=t.length;n<a;++n)iq(e,t[n]);var r=e._PSD;--r.ref||r.finalize(),0===iR&&(++iR,iD(()=>{0==--iR&&iX()},[]))}function iq(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,++iR,iD(iH,[n,e,t])}else e._listeners.push(t)}function iH(e,t,n){try{iT=t;var a,r=t._value;t._state?a=e(r):(iP.length&&(iP=[]),a=e(r),-1===iP.indexOf(r)&&function(e){for(var t=iO.length;t;)if(iO[--t]._value===e._value)return void iO.splice(t,1)}(t)),n.resolve(a)}catch(e){n.reject(e)}finally{iT=null,0==--iR&&iX(),--n.psd.ref||n.psd.finalize()}}function iK(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function iY(){iJ()&&iZ()}function iJ(){var e=iM;return iM=!1,iz=!1,e}function iZ(){var e,t,n;do for(;ij.length>0;)for(e=ij,ij=[],n=e.length,t=0;t<n;++t){var a=e[t];a[0].apply(null,a[1])}while(ij.length>0);iM=!0,iz=!0}function iX(){var e=iO;iO=[],e.forEach(e=>{e._PSD.onunhandled.call(null,e._value,e)});for(var t=iF.slice(0),n=t.length;n;)t[--n]()}function iQ(e){return new iL(iv,!1,e)}function i0(e,t){var n=iN;return function(){var a=iJ(),r=iN;try{return sa(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{sa(r,!1),a&&iZ()}}}oD(iL.prototype,{then:iW,_then:function(e,t){iq(this,new iG(null,null,e,t,iN))},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):iQ(e)):this.then(null,e=>e&&e.name===t?n(e):iQ(e))},finally:function(e){return this.then(t=>(e(),t),t=>(e(),iQ(t)))},stack:{get:function(){if(this._stack)return this._stack;try{iE=!0;var e=(function e(t,n,a){if(n.length===a)return n;var r="";if(!1===t._state){var o,i,s=t._value;null!=s?(o=s.name||"Error",i=s.message||s,r=o8(s,0)):(o=s,i=""),n.push(o+(i?": "+i:"")+r)}return o3&&((r=o8(t._stackHolder,2))&&-1===n.indexOf(r)&&n.push(r),t._prev&&e(t._prev,n,a)),n})(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{iE=!1}}},timeout:function(e,t){return e<1/0?new iL((n,a)=>{var r=setTimeout(()=>a(new is.Timeout(t)),e);this.then(n,a).finally(clearTimeout.bind(null,r))}):this}}),"u">typeof Symbol&&Symbol.toStringTag&&oz(iL.prototype,Symbol.toStringTag,"Dexie.Promise"),iI.env=sr(),oD(iL,{all:function(){var e=o1.apply(null,arguments).map(se);return new iL(function(t,n){0===e.length&&t([]);var a=e.length;e.forEach((r,o)=>iL.resolve(r).then(n=>{e[o]=n,--a||t(e)},n))})},resolve:e=>{if(e instanceof iL)return e;if(e&&"function"==typeof e.then)return new iL((t,n)=>{e.then(t,n)});var t=new iL(iv,!0,e);return iK(t,iT),t},reject:iQ,race:function(){var e=o1.apply(null,arguments).map(se);return new iL((t,n)=>{e.map(e=>iL.resolve(e).then(t,n))})},PSD:{get:()=>iN,set:e=>iN=e},totalEchoes:{get:()=>i5},newPSD:i8,usePSD:so,scheduler:{get:()=>iD,set:e=>{iD=e}},rejectionMapper:{get:()=>iB,set:e=>{iB=e}},follow:(e,t)=>new iL((n,a)=>i8((t,n)=>{var a=iN;a.unhandleds=[],a.onunhandled=n,a.finalize=ih(function(){var e;e=()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])},iF.push(function t(){e(),iF.splice(iF.indexOf(t),1)}),++iR,iD(()=>{0==--iR&&iX()},[])},a.finalize),e()},t,n,a))}),ix&&(ix.allSettled&&oz(iL,"allSettled",function(){let e=o1.apply(null,arguments).map(se);return new iL(t=>{0===e.length&&t([]);let n=e.length,a=Array(n);e.forEach((e,r)=>iL.resolve(e).then(e=>a[r]={status:"fulfilled",value:e},e=>a[r]={status:"rejected",reason:e}).then(()=>--n||t(a)))})}),ix.any&&"u">typeof AggregateError&&oz(iL,"any",function(){let e=o1.apply(null,arguments).map(se);return new iL((t,n)=>{0===e.length&&n(AggregateError([]));let a=e.length,r=Array(a);e.forEach((e,o)=>iL.resolve(e).then(e=>t(e),e=>{r[o]=e,--a||n(AggregateError(r))}))})}));let i1={awaits:0,echoes:0,id:0};var i2=0,i3=[],i4=0,i5=0,i6=0;function i8(e,t,n,a){var r=iN,o=Object.create(r);o.parent=r,o.ref=0,o.global=!1,o.id=++i6;var i=iI.env;o.env=iC?{Promise:iL,PromiseProp:{value:iL,configurable:!0,writable:!0},all:iL.all,race:iL.race,allSettled:iL.allSettled,any:iL.any,resolve:iL.resolve,reject:iL.reject,nthen:ss(i.nthen,o),gthen:ss(i.gthen,o)}:{},t&&ox(o,t),++r.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=so(o,e,n,a);return 0===o.ref&&o.finalize(),s}function i7(){return i1.id||(i1.id=++i2),++i1.awaits,i1.echoes+=100,i1.id}function i9(){return!!i1.awaits&&(0==--i1.awaits&&(i1.id=0),i1.echoes=100*i1.awaits,!0)}function se(e){return i1.echoes&&e&&e.constructor===ix?(i7(),e.then(e=>(i9(),e),e=>(i9(),sc(e)))):e}function st(e){++i5,i1.echoes&&0!=--i1.echoes||(i1.echoes=i1.id=0),i3.push(iN),sa(e,!0)}function sn(){var e=i3[i3.length-1];i3.pop(),sa(e,!1)}function sa(e,t){var n,a=iN;if((t?!i1.echoes||i4++&&e===iN:!i4||--i4&&e===iN)||(n=t?st.bind(null,e):sn,ik.call(i$,n)),e!==iN&&(iN=e,a===iI&&(iI.env=sr()),iC)){var r=iI.env.Promise,o=e.env;iA.then=o.nthen,r.prototype.then=o.gthen,(a.global||e.global)&&(Object.defineProperty(oA,"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 sr(){var e=oA.Promise;return iC?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(oA,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:iA.then,gthen:e.prototype.then}:{}}function so(e,t,n,a,r){var o=iN;try{return sa(e,!0),t(n,a,r)}finally{sa(o,!1)}}function si(e,t,n,a){return"function"!=typeof e?e:function(){var r,o=iN;n&&i7(),sa(t,!0);try{return e.apply(this,arguments)}finally{sa(o,!1),a&&(r=i9,ik.call(i$,r))}}}function ss(e,t){return function(n,a){return e.call(this,si(n,t),si(a,t))}}function sl(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var a,r={promise:t,reason:e};if(oA.document&&document.createEvent?((a=document.createEvent("Event")).initEvent("unhandledrejection",!0,!0),ox(a,r)):oA.CustomEvent&&ox(a=new CustomEvent("unhandledrejection",{detail:r}),r),a&&oA.dispatchEvent&&(dispatchEvent(a),!oA.PromiseRejectionEvent&&oA.onunhandledrejection))try{oA.onunhandledrejection(a)}catch(e){}o3&&a&&!a.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}-1===(""+ik).indexOf("[native code]")&&(i7=i9=iu);var sc=iL.reject;let su=String.fromCharCode(65535),sp="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",sd=[],sf="u">typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),sh=e=>!/(dexie\.js|dexie\.min\.js)/.test(e);function sm(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}let sg={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function sy(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=oY(t))[e],t)}class sb{_trans(e,t,n){let a=this._tx||iN.trans,r=this.name;function o(e,n,a){if(!a.schema[r])throw new is.NotFound("Table "+r+" not part of transaction");return t(a.idbtrans,a)}let i=iJ();try{return a&&a.db===this.db?a===iN.trans?a._promise(e,o,n):i8(()=>a._promise(e,o,n),{trans:a,transless:iN.transless||iN}):function e(t,n,a,r){if(t.idbdb&&(t._state.openComplete||iN.letThrough||t._vip)){var o=t._createTransaction(n,a,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===ii.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>e(t,n,a,r))):sc(o)}return o._promise(n,(e,t)=>i8(()=>(iN.trans=o,r(e,t,o)))).then(e=>o._completion.then(()=>e))}if(t._state.openComplete)return sc(new is.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return sc(new is.DatabaseClosed);t.open().catch(iu)}return t._state.dbReadyPromise.then(()=>e(t,n,a,r))}(this.db,e,[this.name],o)}finally{i&&iZ()}}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(ok(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);let t=ow(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);let 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!==su)return this.where(n.name).equals(n.keyPath.map(t=>e[t]));!n&&o3&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);let{idxByName:a}=this.schema,r=this.db._deps.indexedDB;function o(e,t){try{return 0===r.cmp(e,t)}catch(e){return!1}}let[i,s]=t.reduce(([t,n],r)=>{let i=a[r],s=e[r];return[t||i,t||!i?sm(n,i&&i.multi?e=>{let t=oL(e,r);return ok(t)&&t.some(e=>o(s,e))}:e=>o(s,oL(e,r))):n]},[null,null]);return i?this.where(i.name).equals(e[i.keyPath]).filter(s):n?this.filter(s):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,ok(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;let t=t=>{if(!t)return t;let n=Object.create(e.prototype);for(var a in t)if(oS(t,a))try{n[a]=t[a]}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){ox(this,e)})}add(e,t){let{auto:n,keyPath:a}=this.schema.primKey,r=e;return a&&n&&(r=sy(a)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[r]})).then(e=>e.numFailures?iL.reject(e.failures[0]):e.lastResult).then(t=>{if(a)try{oW(e,a,t)}catch(e){}return t})}update(e,t){if("object"!=typeof e||ok(e))return this.where(":id").equals(e).modify(t);{let n=oL(e,this.schema.primKey.keyPath);if(void 0===n)return sc(new is.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?ow(t).forEach(n=>{oW(e,n,t[n])}):t(e,{value:e,primKey:n})}catch(e){}return this.where(":id").equals(n).modify(t)}}put(e,t){let{auto:n,keyPath:a}=this.schema.primKey,r=e;return a&&n&&(r=sy(a)(e)),this._trans("readwrite",e=>this.core.mutate({trans:e,type:"put",values:[r],keys:null!=t?[t]:null})).then(e=>e.numFailures?iL.reject(e.failures[0]):e.lastResult).then(t=>{if(a)try{oW(e,a,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?iL.reject(e.failures[0]):void 0)}clear(){return this._trans("readwrite",e=>this.core.mutate({trans:e,type:"deleteRange",range:sg})).then(e=>e.numFailures?iL.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){let a=Array.isArray(t)?t:void 0,r=(n=n||(a?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",t=>{let{auto:n,keyPath:o}=this.schema.primKey;if(o&&a)throw new is.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(a&&a.length!==e.length)throw new is.InvalidArgument("Arguments objects and keys must have the same length");let i=e.length,s=o&&n?e.map(sy(o)):e;return this.core.mutate({trans:t,type:"add",keys:a,values:s,wantResults:r}).then(({numFailures:e,results:t,lastResult:n,failures:a})=>{if(0===e)return r?t:n;throw new io(`${this.name}.bulkAdd(): ${e} of ${i} operations failed`,a)})})}bulkPut(e,t,n){let a=Array.isArray(t)?t:void 0,r=(n=n||(a?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",t=>{let{auto:n,keyPath:o}=this.schema.primKey;if(o&&a)throw new is.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(a&&a.length!==e.length)throw new is.InvalidArgument("Arguments objects and keys must have the same length");let i=e.length,s=o&&n?e.map(sy(o)):e;return this.core.mutate({trans:t,type:"put",keys:a,values:s,wantResults:r}).then(({numFailures:e,results:t,lastResult:n,failures:a})=>{if(0===e)return r?t:n;throw new io(`${this.name}.bulkPut(): ${e} of ${i} operations failed`,a)})})}bulkDelete(e){let t=e.length;return this._trans("readwrite",t=>this.core.mutate({trans:t,type:"delete",keys:e})).then(({numFailures:e,lastResult:n,failures:a})=>{if(0===e)return n;throw new io(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,a)})}}function s_(e){var t={},n=function(n,a){if(a){for(var r=arguments.length,o=Array(r-1);--r;)o[r-1]=arguments[r];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=o;for(var a=1,r=arguments.length;a<r;++a)o(arguments[a]);return n;function o(e,a,r){if("object"==typeof e){var i;return void ow(i=e).forEach(function(e){var t=i[e];if(ok(t))o(e,i[e][0],i[e][1]);else{if("asap"!==t)throw new is.InvalidArgument("Invalid event config");var n=o(e,ip,function(){for(var e=arguments.length,t=Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach(function(e){oR(function(){e.apply(null,t)})})})}})}a||(a=ib),r||(r=iu);var s={subscribers:[],fire:r,subscribe:function(e){-1===s.subscribers.indexOf(e)&&(s.subscribers.push(e),s.fire=a(s.fire,e))},unsubscribe:function(e){s.subscribers=s.subscribers.filter(function(t){return t!==e}),s.fire=s.subscribers.reduce(a,r)}};return t[e]=n[e]=s,s}}function sv(e,t){return oO(t).from({prototype:e}),t}function s$(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function sA(e,t){e.filter=sm(e.filter,t)}function sw(e,t,n){var a=e.replayFilter;e.replayFilter=a?()=>sm(a(),t()):t,e.justLimit=n&&!a}function sk(e,t){if(e.isPrimKey)return t.primaryKey;let n=t.getIndexByKeyPath(e.index);if(!n)throw new is.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function sx(e,t,n){let a=sk(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:a,range:e.range}})}function sC(e,t,n,a){let r=e.replayFilter?sm(e.filter,e.replayFilter()):e.filter;if(e.or){let o={},i=(e,n,a)=>{if(!r||r(n,a,e=>n.stop(e),e=>n.fail(e))){var i=n.primaryKey,s=""+i;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(i)),oS(o,s)||(o[s]=!0,t(e,n,a))}};return Promise.all([e.or._iterate(i,n),sE(sx(e,a,n),e.algorithm,i,!e.keysOnly&&e.valueMapper)])}return sE(sx(e,a,n),sm(e.algorithm,r),t,!e.keysOnly&&e.valueMapper)}function sE(e,t,n,a){var r=i0(a?(e,t,r)=>n(a(e),t,r):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=iu},t=>{e.fail(t),n=iu})||r(e.value,e,e=>n=e),n()})})}function sS(e,t){try{let n=sD(e),a=sD(t);if(n!==a)return"Array"===n?1:"Array"===a?-1:"binary"===n?1:"binary"===a?-1:"string"===n?1:"string"===a?-1:"Date"===n?1:"Date"!==a?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return function(e,t){let n=e.length,a=t.length,r=n<a?n:a;for(let n=0;n<r;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===a?0:n<a?-1:1}(sM(e),sM(t));case"Array":return function(e,t){let n=e.length,a=t.length,r=n<a?n:a;for(let n=0;n<r;++n){let a=sS(e[n],t[n]);if(0!==a)return a}return n===a?0:n<a?-1:1}(e,t)}}catch(e){}return NaN}function sD(e){let t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";let n=oZ(e);return"ArrayBuffer"===n?"binary":n}function sM(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class sz{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,sc.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,sc.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=sm(t.algorithm,e)}_iterate(e,t){return sC(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&ox(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read(n=>sC(t,e,n,t.table.core))}count(e){return this._read(e=>{let t=this._ctx,n=t.table.core;if(s$(t,!0))return n.count({trans:e,query:{index:sk(t,n.schema),range:t.range}}).then(e=>Math.min(e,t.limit));var a=0;return sC(t,()=>(++a,!1),e,n).then(()=>a)}).then(e)}sortBy(e,t){let n=e.split(".").reverse(),a=n[0],r=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[a]}var i="next"===this._ctx.dir?1:-1;function s(e,t){var n=o(e,r),a=o(t,r);return n<a?-i:n>a?i:0}return this.toArray(function(e){return e.sort(s)}).then(t)}toArray(e){return this._read(e=>{var t=this._ctx;if("next"===t.dir&&s$(t,!0)&&t.limit>0){let{valueMapper:n}=t,a=sk(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:a,range:t.range}}).then(({result:e})=>n?e.map(n):e)}{let n=[];return sC(t,e=>n.push(e),e,t.table.core).then(()=>n)}},e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,s$(t)?sw(t,()=>{var t=e;return(e,n)=>0===t||(1===t?--t:n(()=>{e.advance(t),t=0}),!1)}):sw(t,()=>{var t=e;return()=>--t<0})),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),sw(this._ctx,()=>{var t=e;return function(e,n,a){return--t<=0&&n(a),t>=0}},!0),this}until(e,t){return sA(this._ctx,function(n,a,r){return!e(n.value)||(a(r),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;return sA(this._ctx,function(t){return e(t.value)}),(t=this._ctx).isMatch=sm(t.isMatch,e),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&&s$(t,!0)&&t.limit>0)return this._read(e=>{var n=sk(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 sA(this._ctx,function(e){var t=e.primaryKey.toString(),a=oS(n,t);return n[t]=!0,!a}),this}modify(e){var t=this._ctx;return this._write(n=>{var a;if("function"==typeof e)a=e;else{var r=ow(e),o=r.length;a=function(t){for(var n=!1,a=0;a<o;++a){var i=r[a],s=e[i];oL(t,i)!==s&&(oW(t,i,s),n=!0)}return n}}let i=t.table.core,{outbound:s,extractKey:l}=i.schema.primaryKey,c=this.db._options.modifyChunkSize||200,u=[],p=0,d=[],f=(e,t)=>{let{failures:n,numFailures:a}=t;for(let t of(p+=e-a,ow(n)))u.push(n[t])};return this.clone().primaryKeys().then(r=>{let o=u=>{let p=Math.min(c,r.length-u);return i.getMany({trans:n,keys:r.slice(u,u+p),cache:"immutable"}).then(d=>{let h=[],m=[],g=s?[]:null,y=[];for(let e=0;e<p;++e){let t=d[e],n={value:oY(t),primKey:r[u+e]};!1!==a.call(n,n.value,n)&&(null==n.value?y.push(r[u+e]):s||0===sS(l(t),l(n.value))?(m.push(n.value),s&&g.push(r[u+e])):(y.push(r[u+e]),h.push(n.value)))}let b=s$(t)&&t.limit===1/0&&("function"!=typeof e||e===sO)&&{index:t.index,range:t.range};return Promise.resolve(h.length>0&&i.mutate({trans:n,type:"add",values:h}).then(e=>{for(let t in e.failures)y.splice(parseInt(t),1);f(h.length,e)})).then(()=>(m.length>0||b&&"object"==typeof e)&&i.mutate({trans:n,type:"put",keys:g,values:m,criteria:b,changeSpec:"function"!=typeof e&&e}).then(e=>f(m.length,e))).then(()=>(y.length>0||b&&e===sO)&&i.mutate({trans:n,type:"delete",keys:y,criteria:b}).then(e=>f(y.length,e))).then(()=>r.length>u+p&&o(u+c))})};return o(0).then(()=>{if(u.length>0)throw new ir("Error modifying one or more objects",u,p,d);return r.length})})})}delete(){var e=this._ctx,t=e.range;return s$(e)&&(e.isPrimKey&&!sf||3===t.type)?this._write(n=>{let{primaryKey:a}=e.table.core.schema;return e.table.core.count({trans:n,query:{index:a,range:t}}).then(a=>e.table.core.mutate({trans:n,type:"deleteRange",range:t}).then(({failures:e,lastResult:t,results:n,numFailures:r})=>{if(r)throw new ir("Could not delete some values",Object.keys(e).map(t=>e[t]),a-r);return a-r}))}):this.modify(sO)}}let sO=(e,t)=>t.value=null;function sP(e,t){return e<t?-1:+(e!==t)}function sT(e,t){return e>t?-1:+(e!==t)}function sB(e,t,n){var a=e instanceof sF?new e.Collection(e):e;return a._ctx.error=n?new n(t):TypeError(t),a}function sI(e){return new e.Collection(e,()=>sR("")).limit(0)}function sN(e,t,n,a){var r,o,i,s,l,c,u,p=n.length;if(!n.every(e=>"string"==typeof e))return sB(e,"String expected.");function d(e){r="next"===e?e=>e.toUpperCase():e=>e.toLowerCase(),o="next"===e?e=>e.toLowerCase():e=>e.toUpperCase(),i="next"===e?sP:sT;var t=n.map(function(e){return{lower:o(e),upper:r(e)}}).sort(function(e,t){return i(e.lower,t.lower)});s=t.map(function(e){return e.upper}),l=t.map(function(e){return e.lower}),c=e,u="next"===e?"":a}d("next");var f=new e.Collection(e,()=>sj(s[0],l[p-1]+a));f._ondirectionchange=function(e){d(e)};var h=0;return f._addAlgorithm(function(e,n,a){var r=e.key;if("string"!=typeof r)return!1;var d=o(r);if(t(d,l,h))return!0;for(var f=null,m=h;m<p;++m){var g=function(e,t,n,a,r,o){for(var i=Math.min(e.length,a.length),s=-1,l=0;l<i;++l){var c=t[l];if(c!==a[l])return 0>r(e[l],n[l])?e.substr(0,l)+n[l]+n.substr(l+1):0>r(e[l],a[l])?e.substr(0,l)+a[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;0>r(e[l],c)&&(s=l)}return i<a.length&&"next"===o?e+n.substr(e.length):i<e.length&&"prev"===o?e.substr(0,n.length):s<0?null:e.substr(0,s)+a[s]+n.substr(s+1)}(r,d,s[m],l[m],i,c);null===g&&null===f?h=m+1:(null===f||i(f,g)>0)&&(f=g)}return n(null!==f?function(){e.continue(f+u)}:a),!1}),f}function sj(e,t,n,a){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:a}}function sR(e){return{type:1,lower:e,upper:e}}class sF{get Collection(){return this._ctx.table.db.Collection}between(e,t,n,a){n=!1!==n,a=!0===a;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||a)&&(!n||!a)?sI(this):new this.Collection(this,()=>sj(e,t,!n,!a))}catch(e){return sB(this,sp)}}equals(e){return null==e?sB(this,sp):new this.Collection(this,()=>sR(e))}above(e){return null==e?sB(this,sp):new this.Collection(this,()=>sj(e,void 0,!0))}aboveOrEqual(e){return null==e?sB(this,sp):new this.Collection(this,()=>sj(e,void 0,!1))}below(e){return null==e?sB(this,sp):new this.Collection(this,()=>sj(void 0,e,!1,!0))}belowOrEqual(e){return null==e?sB(this,sp):new this.Collection(this,()=>sj(void 0,e))}startsWith(e){return"string"!=typeof e?sB(this,"String expected."):this.between(e,e+su,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):sN(this,(e,t)=>0===e.indexOf(t[0]),[e],su)}equalsIgnoreCase(e){return sN(this,(e,t)=>e===t[0],[e],"")}anyOfIgnoreCase(){var e=o1.apply(o0,arguments);return 0===e.length?sI(this):sN(this,(e,t)=>-1!==t.indexOf(e),e,"")}startsWithAnyOfIgnoreCase(){var e=o1.apply(o0,arguments);return 0===e.length?sI(this):sN(this,(e,t)=>t.some(t=>0===e.indexOf(t)),e,su)}anyOf(){let e=o1.apply(o0,arguments),t=this._cmp;try{e.sort(t)}catch(e){return sB(this,sp)}if(0===e.length)return sI(this);let n=new this.Collection(this,()=>sj(e[0],e[e.length-1]));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let a=0;return n._addAlgorithm((n,r,o)=>{let i=n.key;for(;t(i,e[a])>0;)if(++a===e.length)return r(o),!1;return 0===t(i,e[a])||(r(()=>{n.continue(e[a])}),!1)}),n}notEqual(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){let e=o1.apply(o0,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return sB(this,sp)}let 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){let n=this._cmp,a=this._ascending,r=this._descending,o=this._min,i=this._max;if(0===e.length)return sI(this);if(!e.every(e=>void 0!==e[0]&&void 0!==e[1]&&0>=a(e[0],e[1])))return sB(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",is.InvalidArgument);let s=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,c,u=a;function p(e,t){return u(e[0],t[0])}try{(c=e.reduce(function(e,t){let a=0,r=e.length;for(;a<r;++a){let r=e[a];if(0>n(t[0],r[1])&&n(t[1],r[0])>0){r[0]=o(r[0],t[0]),r[1]=i(r[1],t[1]);break}}return a===r&&e.push(t),e},[])).sort(p)}catch(e){return sB(this,sp)}let d=0,f=l?e=>a(e,c[d][1])>0:e=>a(e,c[d][1])>=0,h=s?e=>r(e,c[d][0])>0:e=>r(e,c[d][0])>=0,m=f,g=new this.Collection(this,()=>sj(c[0][0],c[c.length-1][1],!s,!l));return g._ondirectionchange=e=>{"next"===e?(m=f,u=a):(m=h,u=r),c.sort(p)},g._addAlgorithm((e,t,n)=>{for(var r=e.key;m(r);)if(++d===c.length)return t(n),!1;return!!(!f(r)&&!h(r))||(0===this._cmp(r,c[d][1])||0===this._cmp(r,c[d][0])||t(()=>{u===a?e.continue(c[d][0]):e.continue(c[d][1])}),!1)}),g}startsWithAnyOf(){let e=o1.apply(o0,arguments);return e.every(e=>"string"==typeof e)?0===e.length?sI(this):this.inAnyRange(e.map(e=>[e,e+su])):sB(this,"startsWithAnyOf() only works with strings")}}function sL(e){return i0(function(t){return sW(t),e(t.target.error),!1})}function sW(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}let sG=s_(null,"storagemutated");class sV{_lock(){return oj(!iN.global),++this._reculock,1!==this._reculock||iN.global||(iN.lockOwnerFor=this),this}_unlock(){if(oj(!iN.global),0==--this._reculock)for(iN.global||(iN.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{so(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&iN.lockOwnerFor!==this}create(e){if(!this.mode)return this;let t=this.db.idbdb,n=this.db._state.dbOpenError;if(oj(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new is.DatabaseClosed(n);case"MissingAPIError":throw new is.MissingAPI(n.message,n);default:throw new is.OpenFailed(n)}if(!this.active)throw new is.TransactionInactive;return oj(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=i0(t=>{sW(t),this._reject(e.error)}),e.onabort=i0(t=>{sW(t),this.active&&this._reject(new is.Abort(e.error)),this.active=!1,this.on("abort").fire(t)}),e.oncomplete=i0(()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&sG.storagemutated.fire(e.mutatedParts)}),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return sc(new is.ReadOnly("Transaction is readonly"));if(!this.active)return sc(new is.TransactionInactive);if(this._locked())return new iL((a,r)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(a,r)},iN])});if(n)return i8(()=>{var e=new iL((e,n)=>{this._lock();let a=t(e,n,this);a&&a.then&&a.then(e,n)});return e.finally(()=>this._unlock()),e._lib=!0,e});var a=new iL((e,n)=>{var a=t(e,n,this);a&&a.then&&a.then(e,n)});return a._lib=!0,a}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();let n=iL.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then(()=>n);else{t._waitingFor=n,t._waitingQueue=[];var a=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(a.get(-1/0).onsuccess=e)}()}var r=t._waitingFor;return new iL((e,a)=>{n.then(n=>t._waitingQueue.push(i0(e.bind(null,n))),e=>t._waitingQueue.push(i0(a.bind(null,e)))).finally(()=>{t._waitingFor===r&&(t._waitingFor=null)})})}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new is.Abort))}table(e){let t=this._memoizedTables||(this._memoizedTables={});if(oS(t,e))return t[e];let n=this.schema[e];if(!n)throw new is.NotFound("Table "+e+" not part of transaction");let a=new this.db.Table(e,n,this);return a.core=this.db.core.table(e),t[e]=a,a}}function sU(e,t,n,a,r,o,i){return{name:e,keyPath:t,unique:n,multi:a,auto:r,compound:o,src:(n&&!i?"&":"")+(a?"*":"")+(r?"++":"")+sq(t)}}function sq(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function sH(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:oF(n,e=>[e.name,e])}}let sK=e=>{try{return e.only([[]]),sK=()=>[[]],[[]]}catch(e){return sK=()=>su,su}};function sY(e){return null==e?()=>{}:"string"==typeof e?1===e.split(".").length?t=>t[e]:t=>oL(t,e):t=>oL(t,e)}function sJ(e){return[].slice.call(e)}let sZ=0;function sX(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function sQ({_novip:e},t){let n=t.db,a=function(e,t,{IDBKeyRange:n,indexedDB:a},r){var o;return{dbcore:(o=function(e,t,n){let a;function r(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");let{lower:n,upper:a,lowerOpen:r,upperOpen:o}=e;return void 0===n?void 0===a?null:t.upperBound(a,!!o):void 0===a?t.lowerBound(n,!!r):t.bound(n,a,!!r,!!o)}let{schema:o,hasGetAll:i}=(a=sJ(e.objectStoreNames),{schema:{name:e.name,tables:a.map(e=>n.objectStore(e)).map(e=>{let{keyPath:t,autoIncrement:n}=e,a=ok(t),r=null==t,o={},i={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:r,compound:a,keyPath:t,autoIncrement:n,unique:!0,extractKey:sY(t)},indexes:sJ(e.indexNames).map(t=>e.index(t)).map(e=>{let{name:t,unique:n,multiEntry:a,keyPath:r}=e,i={name:t,compound:ok(r),keyPath:r,unique:n,multiEntry:a,extractKey:sY(r)};return o[sX(r)]=i,i}),getIndexByKeyPath:e=>o[sX(e)]};return o[":id"]=i.primaryKey,null!=t&&(o[sX(t)]=i.primaryKey),i})},hasGetAll:a.length>0&&"getAll"in n.objectStore(a[0])&&!("u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),s=o.tables.map(e=>{let t;return{name:t=e.name,schema:e,mutate:function({trans:e,type:n,keys:a,values:o,range:i}){return new Promise((s,l)=>{let c;s=i0(s);let u=e.objectStore(t),p=null==u.keyPath,d="put"===n||"add"===n;if(!d&&"delete"!==n&&"deleteRange"!==n)throw Error("Invalid operation type: "+n);let{length:f}=a||o||{length:1};if(a&&o&&a.length!==o.length)throw Error("Given keys array must have same length as given values array.");if(0===f)return s({numFailures:0,failures:{},results:[],lastResult:void 0});let h=[],m=[],g=0,y=e=>{++g,sW(e)};if("deleteRange"===n){if(4===i.type)return s({numFailures:g,failures:m,results:[],lastResult:void 0});3===i.type?h.push(c=u.clear()):h.push(c=u.delete(r(i)))}else{let[e,t]=d?p?[o,a]:[o,null]:[a,null];if(d)for(let a=0;a<f;++a)h.push(c=t&&void 0!==t[a]?u[n](e[a],t[a]):u[n](e[a])),c.onerror=y;else for(let t=0;t<f;++t)h.push(c=u[n](e[t])),c.onerror=y}let b=e=>{let t=e.target.result;h.forEach((e,t)=>null!=e.error&&(m[t]=e.error)),s({numFailures:g,failures:m,results:"delete"===n?a:h.map(e=>e.result),lastResult:t})};c.onerror=e=>{y(e),b(e)},c.onsuccess=b})},getMany:({trans:e,keys:n})=>new Promise((a,r)=>{a=i0(a);let o=e.objectStore(t),i=n.length,s=Array(i),l,c=0,u=0,p=e=>{let t=e.target;s[t._pos]=t.result,++u===c&&a(s)},d=sL(r);for(let e=0;e<i;++e)null!=n[e]&&((l=o.get(n[e]))._pos=e,l.onsuccess=p,l.onerror=d,++c);0===c&&a(s)}),get:({trans:e,key:n})=>new Promise((a,r)=>{a=i0(a);let o=e.objectStore(t).get(n);o.onsuccess=e=>a(e.target.result),o.onerror=sL(r)}),query:e=>new Promise((n,a)=>{n=i0(n);let{trans:o,values:s,limit:l,query:c}=e,u=l===1/0?void 0:l,{index:p,range:d}=c,f=o.objectStore(t),h=p.isPrimaryKey?f:f.index(p.name),m=r(d);if(0===l)return n({result:[]});if(i){let e=s?h.getAll(m,u):h.getAllKeys(m,u);e.onsuccess=e=>n({result:e.target.result}),e.onerror=sL(a)}else{let e=0,t=!s&&"openKeyCursor"in h?h.openKeyCursor(m):h.openCursor(m),r=[];t.onsuccess=a=>{let o=t.result;return o?(r.push(s?o.value:o.primaryKey),++e===l?n({result:r}):void o.continue()):n({result:r})},t.onerror=sL(a)}}),openCursor:function({trans:e,values:n,query:a,reverse:o,unique:i}){return new Promise((s,l)=>{s=i0(s);let{index:c,range:u}=a,p=e.objectStore(t),d=c.isPrimaryKey?p:p.index(c.name),f=o?i?"prevunique":"prev":i?"nextunique":"next",h=!n&&"openKeyCursor"in d?d.openKeyCursor(r(u),f):d.openCursor(r(u),f);h.onerror=sL(l),h.onsuccess=i0(t=>{let n=h.result;if(!n)return void s(null);n.___id=++sZ,n.done=!1;let a=n.continue.bind(n),r=n.continuePrimaryKey;r&&(r=r.bind(n));let o=n.advance.bind(n),i=()=>{throw Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw Error("Cursor not started")},n.fail=i0(l),n.next=function(){let e=1;return this.start(()=>e--?this.continue():this.stop()).then(()=>this)},n.start=e=>{let t=new Promise((e,t)=>{e=i0(e),h.onerror=sL(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=i,e(t)}}),s=()=>{if(h.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw Error("Cursor behind last entry")},n.stop()};return h.onsuccess=i0(e=>{h.onsuccess=s,s()}),n.continue=a,n.continuePrimaryKey=r,n.advance=o,s(),t},s(n)},l)})},count({query:e,trans:n}){let{index:a,range:o}=e;return new Promise((e,i)=>{let s=n.objectStore(t),l=a.isPrimaryKey?s:s.index(a.name),c=r(o),u=c?l.count(c):l.count();u.onsuccess=i0(t=>e(t.target.result)),u.onerror=sL(i)})}}}),l={};return s.forEach(e=>l[e.name]=e),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:sK(t),schema:o}}(t,n,r),e.dbcore.reduce((e,{create:t})=>({...e,...t(e)}),o))}}(e._middlewares,n,e._deps,t);e.core=a.dbcore,e.tables.forEach(t=>{let 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 s0({_novip:e},t,n,a){n.forEach(n=>{let r=a[n];t.forEach(t=>{let a=oT(t,n);(!a||"value"in a&&void 0===a.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?oz(t,n,{get(){return this.table(n)},set(e){oM(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,r))})})}function s1({_novip:e},t){t.forEach(t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]})}function s2(e,t){return e._cfg.version-t._cfg.version}function s3(e,t){let n,a={del:[],add:[],change:[]};for(n in e)t[n]||a.del.push(n);for(n in t){let r=e[n],o=t[n];if(r){let e={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(r.primKey.keyPath||"")==""+(o.primKey.keyPath||"")&&(r.primKey.auto===o.primKey.auto||sf)){let t,n=r.idxByName,i=o.idxByName;for(t in n)i[t]||e.del.push(t);for(t in i){let a=n[t],r=i[t];a?a.src!==r.src&&e.change.push(r):e.add.push(r)}(e.del.length>0||e.add.length>0||e.change.length>0)&&a.change.push(e)}else e.recreate=!0,a.change.push(e)}else a.add.push([n,o])}return a}function s4(e,t,n,a){let r=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return a.forEach(e=>s5(r,e)),r}function s5(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function s6(e,t,n){let a={};return oI(t.objectStoreNames,0).forEach(e=>{let t=n.objectStore(e),r=t.keyPath,o=sU(sq(r),r||"",!1,!1,!!t.autoIncrement,r&&"string"!=typeof r,!0),i=[];for(let e=0;e<t.indexNames.length;++e){let n=t.index(t.indexNames[e]);r=n.keyPath;var s=sU(n.name,r,!!n.unique,!!n.multiEntry,!1,r&&"string"!=typeof r,!1);i.push(s)}a[e]=sH(e,o,i)}),a}function s8({_novip:e},t,n){let a=n.db.objectStoreNames;for(let r=0;r<a.length;++r){let o=a[r],i=n.objectStore(o);e._hasGetAll="getAll"in i;for(let e=0;e<i.indexNames.length;++e){let n=i.indexNames[e],a=i.index(n).keyPath,r="string"==typeof a?a:"["+oI(a).join("+")+"]";if(t[o]){let e=t[o].idxByName[r];e&&(e.name=n,delete t[o].idxByName[r],t[o].idxByName[n]=e)}}}"u">typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&oA.WorkerGlobalScope&&oA instanceof oA.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class s7{_parseStoresSpec(e,t){ow(e).forEach(n=>{if(null!==e[n]){var a=e[n].split(",").map((e,t)=>{let n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),a=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return sU(n,a||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),ok(a),0===t)}),r=a.shift();if(r.multi)throw new is.Schema("Primary key cannot be multi-valued");a.forEach(e=>{if(e.auto)throw new is.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new is.Schema("Index must have a name and cannot be an empty string")}),t[n]=sH(n,r,a)}})}stores(e){let t=this.db;this._cfg.storesSource=this._cfg.storesSource?ox(this._cfg.storesSource,e):e;let n=t._versions,a={},r={};return n.forEach(e=>{ox(a,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(a,r)}),t._dbSchema=r,s1(t,[t._allTables,t,t.Transaction.prototype]),s0(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],ow(r),r),t._storeNames=ow(r),this}upgrade(e){return this._cfg.contentUpgrade=i_(this._cfg.contentUpgrade||iu,e),this}}function s9(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new lb("__dbnames",{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function le(e){return e&&"function"==typeof e.databases}function lt(e){return i8(function(){return iN.letThrough=!0,e()})}function ln(e){var t=t=>e.next(t),n=r(t),a=r(t=>e.throw(t));function r(e){return t=>{var r=e(t),o=r.value;return r.done?o:o&&"function"==typeof o.then?o.then(n,a):ok(o)?Promise.all(o).then(n,a):n(o)}}return r(t)()}function la(e,t,n){var a=arguments.length;if(a<2)throw new is.InvalidArgument("Too few arguments");for(var r=Array(a-1);--a;)r[a-1]=arguments[a];return n=r.pop(),[e,oU(r),n]}function lr(e,t,n){let a=ok(e)?e.slice():[e];for(let e=0;e<n;++e)a.push(t);return a}let lo={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){let n=e.table(t),{schema:a}=n,r={},o=[];function i(e,t,n){let a=sX(e),s=r[a]=r[a]||[],l=null==e?0:"string"==typeof e?1:e.length,c=t>0,u={...n,isVirtual:c,keyTail:t,keyLength:l,extractKey:sY(e),unique:!c&&n.unique};return s.push(u),u.isPrimaryKey||o.push(u),l>1&&i(2===l?e[0]:e.slice(0,l-1),t+1,n),s.sort((e,t)=>e.keyTail-t.keyTail),u}let s=i(a.primaryKey.keyPath,0,a.primaryKey);for(let e of(r[":id"]=[s],a.indexes))i(e.keyPath,0,e);function l(t){var n,a;let r=t.query.index;return r.isVirtual?{...t,query:{index:r,range:(n=t.query.range,a=r.keyTail,{type:1===n.type?2:n.type,lower:lr(n.lower,n.lowerOpen?e.MAX_KEY:e.MIN_KEY,a),lowerOpen:!0,upper:lr(n.upper,n.upperOpen?e.MIN_KEY:e.MAX_KEY,a),upperOpen:!0})}}:t}return{...n,schema:{...a,primaryKey:s,indexes:o,getIndexByKeyPath:function(e){let t=r[sX(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){let{keyTail:a,isVirtual:r,keyLength:o}=t.query.index;return r?n.openCursor(l(t)).then(n=>n&&Object.create(n,{continue:{value:function(r){null!=r?n.continue(lr(r,t.reverse?e.MAX_KEY:e.MIN_KEY,a)):t.unique?n.continue(n.key.slice(0,o).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,a)):n.continue()}},continuePrimaryKey:{value(t,r){n.continuePrimaryKey(lr(t,e.MAX_KEY,a),r)}},primaryKey:{get:()=>n.primaryKey},key:{get(){let e=n.key;return 1===o?e[0]:e.slice(0,o)}},value:{get:()=>n.value}})):n.openCursor(t)}}}}}};function li(e,t,n,a){return n=n||{},a=a||"",ow(e).forEach(r=>{if(oS(t,r)){var o=e[r],i=t[r];if("object"==typeof o&&"object"==typeof i&&o&&i){let e=oZ(o);e!==oZ(i)?n[a+r]=t[r]:"Object"===e?li(o,i,n,a+r+"."):o!==i&&(n[a+r]=t[r])}else o!==i&&(n[a+r]=t[r])}else n[a+r]=void 0}),ow(t).forEach(r=>{oS(e,r)||(n[a+r]=t[r])}),n}let ls={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){let n=e.table(t),{primaryKey:a}=n.schema;return{...n,mutate(e){let r=iN.trans,{deleting:o,creating:i,updating:s}=r.table(t).hook;switch(e.type){case"add":if(i.fire===iu)break;return r._promise("readwrite",()=>l(e),!0);case"put":if(i.fire===iu&&s.fire===iu)break;return r._promise("readwrite",()=>l(e),!0);case"delete":if(o.fire===iu)break;return r._promise("readwrite",()=>l(e),!0);case"deleteRange":if(o.fire===iu)break;return r._promise("readwrite",()=>(function e(t,r,o){return n.query({trans:t,values:!1,query:{index:a,range:r},limit:o}).then(({result:n})=>l({type:"delete",keys:n,trans:t}).then(a=>a.numFailures>0?Promise.reject(a.failures[0]):n.length<o?{failures:[],numFailures:0,lastResult:void 0}:e(t,{...r,lower:n[n.length-1],lowerOpen:!0},o)))})(e.trans,e.range,1e4),!0)}return n.mutate(e);function l(e){var t,r;let l=iN.trans,c=e.keys||("delete"===(t=e).type?t.keys:t.keys||t.values.map(a.extractKey));if(!c)throw Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:c}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),("add"===(r=e).type?Promise.resolve([]):n.getMany({trans:r.trans,keys:c,cache:"immutable"})).then(t=>{let r=c.map((n,r)=>{let c=t[r],u={onerror:null,onsuccess:null};if("delete"===e.type)o.fire.call(u,n,c,l);else if("add"===e.type||void 0===c){let t=i.fire.call(u,n,e.values[r],l);null==n&&null!=t&&(n=t,e.keys[r]=n,a.outbound||oW(e.values[r],a.keyPath,n))}else{let t=li(c,e.values[r]),a=s.fire.call(u,t,n,c,l);if(a){let t=e.values[r];Object.keys(a).forEach(e=>{oS(t,e)?t[e]=a[e]:oW(t,e,a[e])})}}return u});return n.mutate(e).then(({failures:n,results:a,numFailures:o,lastResult:i})=>{for(let o=0;o<c.length;++o){let i=a?a[o]:c[o],s=r[o];null==i?s.onerror&&s.onerror(n[o]):s.onsuccess&&s.onsuccess("put"===e.type&&t[o]?e.values[o]:i)}return{failures:n,results:a,numFailures:o,lastResult:i}}).catch(e=>(r.forEach(t=>t.onerror&&t.onerror(e)),Promise.reject(e)))})}}}}})};function ll(e,t,n){try{if(!t||t.keys.length<e.length)return null;let a=[];for(let r=0,o=0;r<t.keys.length&&o<e.length;++r)0===sS(t.keys[r],e[o])&&(a.push(n?oY(t.values[r]):t.values[r]),++o);return a.length===e.length?a:null}catch(e){return null}}let lc={stack:"dbcore",level:-1,create:e=>({table:t=>{let n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);let t=ll(e.keys,e.trans._cache,"clone"===e.cache);return t?iL.resolve(t):n.getMany(e).then(t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?oY(t):t},t))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function lu(e){return!("from"in e)}let lp=function(e,t){if(!this){let t=new lp;return e&&"d"in e&&ox(t,e),t}ox(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function ld(e,t,n){let a=sS(t,n);if(isNaN(a))return;if(a>0)throw RangeError();if(lu(e))return ox(e,{from:t,to:n,d:1});let r=e.l,o=e.r;if(0>sS(n,e.from))return r?ld(r,t,n):e.l={from:t,to:n,d:1,l:null,r:null},lm(e);if(sS(t,e.to)>0)return o?ld(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},lm(e);0>sS(t,e.from)&&(e.from=t,e.l=null,e.d=o?o.d+1:1),sS(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);let i=!e.r;r&&!e.l&&lf(e,r),o&&i&&lf(e,o)}function lf(e,t){lu(t)||function e(t,{from:n,to:a,l:r,r:o}){ld(t,n,a),r&&e(t,r),o&&e(t,o)}(e,t)}function lh(e){let t=lu(e)?null:{s:0,n:e};return{next(e){let n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&0>sS(e,t.n.from);)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||0>=sS(e,t.n.to))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 lm(e){var t,n;let a=((null==(t=e.r)?void 0:t.d)||0)-((null==(n=e.l)?void 0:n.d)||0),r=a>1?"r":a<-1?"l":"";if(r){let t="r"===r?"l":"r",n={...e},a=e[r];e.from=a.from,e.to=a.to,e[r]=a[r],n[r]=a[t],e[t]=n,n.d=lg(n)}e.d=lg(e)}function lg({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}oD(lp.prototype,{add(e){return lf(this,e),this},addKey(e){return ld(this,e,e),this},addKeys(e){return e.forEach(e=>ld(this,e,e)),this},[oX](){return lh(this)}});let ly={stack:"dbcore",level:0,create:e=>{let t=e.schema.name,n=new lp(e.MIN_KEY,e.MAX_KEY);return{...e,table:a=>{let r=e.table(a),{schema:o}=r,{primaryKey:i}=o,{extractKey:s,outbound:l}=i,c={...r,mutate:e=>{let i=e.trans,s=i.mutatedParts||(i.mutatedParts={}),l=e=>{let n=`idb://${t}/${a}/${e}`;return s[n]||(s[n]=new lp)},c=l(""),u=l(":dels"),{type:p}=e,[d,f]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[],h=e.trans._cache;return r.mutate(e).then(e=>{if(ok(d)){"delete"!==p&&(d=e.results),c.addKeys(d);let t=ll(d,h);t||"add"===p||u.addKeys(d),(t||f)&&o.indexes.forEach(function(e){let n=l(e.name||"");function a(t){return null!=t?e.extractKey(t):null}let r=t=>e.multiEntry&&ok(t)?t.forEach(e=>n.addKey(e)):n.addKey(t);(t||f).forEach((e,n)=>{let o=t&&a(t[n]),i=f&&a(f[n]);0!==sS(o,i)&&(null!=o&&r(o),null!=i&&r(i))})})}else if(d){let e={from:d.lower,to:d.upper};u.add(e),c.add(e)}else c.add(n),u.add(n),o.indexes.forEach(e=>l(e.name).add(n));return e})}},u=({query:{index:t,range:n}})=>{var a,r;return[t,new lp(null!=(a=n.lower)?a:e.MIN_KEY,null!=(r=n.upper)?r:e.MAX_KEY)]},p={get:e=>[i,new lp(e.key)],getMany:e=>[i,(new lp).addKeys(e.keys)],count:u,query:u,openCursor:u};return ow(p).forEach(e=>{c[e]=function(o){let{subscr:i}=iN;if(i){let c=e=>{let n=`idb://${t}/${a}/${e}`;return i[n]||(i[n]=new lp)},u=c(""),d=c(":dels"),[f,h]=p[e](o);if(c(f.name||"").add(h),!f.isPrimaryKey){if("count"!==e){let t="query"===e&&l&&o.values&&r.query({...o,values:!1});return r[e].apply(this,arguments).then(n=>{if("query"===e){if(l&&o.values)return t.then(({result:e})=>(u.addKeys(e),n));let e=o.values?n.result.map(s):n.result;o.values?u.addKeys(e):d.addKeys(e)}else if("openCursor"===e){let e=o.values;return n&&Object.create(n,{key:{get:()=>(d.addKey(n.primaryKey),n.key)},primaryKey:{get(){let e=n.primaryKey;return d.addKey(e),e}},value:{get:()=>(e&&u.addKey(n.primaryKey),n.value)}})}return n})}d.add(n)}}return r[e].apply(this,arguments)}}),c}}}};class lb{constructor(e,t){var n;this._middlewares={},this.verno=0;const a=lb.dependencies;this._options=t={addons:lb.addons,autoOpen:!0,indexedDB:a.indexedDB,IDBKeyRange:a.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:iu,dbReadyPromise:null,cancelOpen:iu,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};o.dbReadyPromise=new iL(e=>{o.dbReadyResolve=e}),o.openCanceller=new iL((e,t)=>{o.cancelOpen=t}),this._state=o,this.name=e,this.on=s_(this,"populate","blocked","versionchange","close",{ready:[i_,iu]}),this.on.ready.subscribe=oN(this.on.ready.subscribe,e=>(t,n)=>{lb.vip(()=>{let a=this._state;if(a.openComplete)a.dbOpenError||iL.resolve().then(t),n&&e(t);else if(a.onReadyBeingFired)a.onReadyBeingFired.push(t),n&&e(t);else{e(t);let a=this;n||e(function e(){a.on.ready.unsubscribe(t),a.on.ready.unsubscribe(e)})}})}),this.Collection=(n=this,sv(sz.prototype,function(e,t){this.db=n;let a=sg,r=null;if(t)try{a=t()}catch(e){r=e}let 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:a,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!==ip?s:null}})),this.Table=function(e){return sv(sb.prototype,function(t,n,a){this.db=e,this._tx=a,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:s_(null,{creating:[im,iu],reading:[id,ip],updating:[iy,iu],deleting:[ig,iu]})})}(this),this.Transaction=function(e){return sv(sV.prototype,function(t,n,a,r,o){this.db=e,this.mode=t,this.storeNames=n,this.schema=a,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=s_(this,"complete","error","abort"),this.parent=o||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new iL((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(),sc(e)})})}(this),this.Version=function(e){return sv(s7.prototype,function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}(this),this.WhereClause=function(e){return sv(sF.prototype,function(t,n,a){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:a};let r=e._deps.indexedDB;if(!r)throw new is.MissingAPI;this._cmp=this._ascending=r.cmp.bind(r),this._descending=(e,t)=>r.cmp(t,e),this._max=(e,t)=>r.cmp(e,t)>0?e:t,this._min=(e,t)=>0>r.cmp(e,t)?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=sK(t.IDBKeyRange),this._createTransaction=(e,t,n,a)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,a),this._fireOnBlocked=e=>{this.on("blocked").fire(e),sd.filter(e=>e.name===this.name&&e!==this&&!e._state.vcFired).map(t=>t.on("versionchange").fire(e))},this.use(lo),this.use(ls),this.use(ly),this.use(lc),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach(e=>e(this))}version(e){if(isNaN(e)||e<.1)throw new is.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new is.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);let 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(s2),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||iN.letThrough||this._vip)?e():new iL((e,t)=>{if(this._state.openComplete)return t(new is.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new is.DatabaseClosed);this.open().catch(iu)}this._state.dbReadyPromise.then(e,t)}).then(e)}use({stack:e,create:t,level:n,name:a}){a&&this.unuse({stack:e,name:a});let r=this._middlewares[e]||(this._middlewares[e]=[]);return r.push({stack:e,create:t,level:null==n?10:n,name:a}),r.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){var t;let n=e._state,{indexedDB:a}=e._deps;if(n.isBeingOpened||e.idbdb)return n.dbReadyPromise.then(()=>n.dbOpenError?sc(n.dbOpenError):e);o3&&(n.openCanceller._stackHolder=o6()),n.isBeingOpened=!0,n.dbOpenError=null,n.openComplete=!1;let r=n.openCanceller;function o(){if(n.openCanceller!==r)throw new is.DatabaseClosed("db.open() was cancelled")}let i=n.dbReadyResolve,s=null,l=!1;return iL.race([r,("u"<typeof navigator?iL.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100),n()}).finally(function(){return clearInterval(t)}):Promise.resolve()).then(()=>new iL((t,r)=>{if(o(),!a)throw new is.MissingAPI;let i=e.name,c=n.autoSchema?a.open(i):a.open(i,Math.round(10*e.verno));if(!c)throw new is.MissingAPI;c.onerror=sL(r),c.onblocked=i0(e._fireOnBlocked),c.onupgradeneeded=i0(t=>{if(s=c.transaction,n.autoSchema&&!e._options.allowEmptyDB){c.onerror=sW,s.abort(),c.result.close();let e=a.deleteDatabase(i);e.onsuccess=e.onerror=i0(()=>{r(new is.NoSuchDatabase(`Database ${i} doesnt exist`))})}else{let n,a,i,d;s.onerror=sL(r);var o,u,p=t.oldVersion>0x4000000000000000?0:t.oldVersion;l=p<1,e._novip.idbdb=c.result,o=p/10,u=s,n=e._dbSchema,(a=e._createTransaction("readwrite",e._storeNames,n)).create(u),a._completion.catch(r),i=a._reject.bind(a),d=iN.transless||iN,i8(()=>{iN.trans=a,iN.transless=d,0===o?(ow(n).forEach(e=>{s4(u,e,n[e].primKey,n[e].indexes)}),sQ(e,u),iL.follow(()=>e.on.populate.fire(a)).catch(i)):(function({_novip:e},t,n,a){let r=[],o=e._versions,i=e._dbSchema=s6(e,e.idbdb,a),s=!1;return o.filter(e=>e._cfg.version>=t).forEach(o=>{r.push(()=>{let r=i,l=o._cfg.dbschema;s8(e,r,a),s8(e,l,a),i=e._dbSchema=l;let c=s3(r,l);c.add.forEach(e=>{s4(a,e[0],e[1].primKey,e[1].indexes)}),c.change.forEach(e=>{if(e.recreate)throw new is.Upgrade("Not yet support for changing primary key");{let t=a.objectStore(e.name);e.add.forEach(e=>s5(t,e)),e.change.forEach(e=>{t.deleteIndex(e.name),s5(t,e)}),e.del.forEach(e=>t.deleteIndex(e))}});let u=o._cfg.contentUpgrade;if(u&&o._cfg.version>t){let t;sQ(e,a),n._memoizedTables={},s=!0;let o=oG(l);c.del.forEach(e=>{o[e]=r[e]}),s1(e,[e.Transaction.prototype]),s0(e,[e.Transaction.prototype],ow(o),o),n.schema=o;let i=o2(u);i&&i7();let p=iL.follow(()=>{if((t=u(n))&&i){var e=i9.bind(null,null);t.then(e,e)}});return t&&"function"==typeof t.then?iL.resolve(t):p.then(()=>t)}}),r.push(t=>{var a;s&&sf||(a=o._cfg.dbschema,[].slice.call(t.db.objectStoreNames).forEach(e=>null==a[e]&&t.db.deleteObjectStore(e))),s1(e,[e.Transaction.prototype]),s0(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema})}),(function e(){return r.length?iL.resolve(r.shift()(n.idbtrans)).then(e):iL.resolve()})().then(()=>{var e;ow(e=i).forEach(t=>{a.db.objectStoreNames.contains(t)||s4(a,t,e[t].primKey,e[t].indexes)})})})(e,o,a,u).catch(i)})}},r),c.onsuccess=i0(()=>{s=null;let a=e._novip.idbdb=c.result,r=oI(a.objectStoreNames);if(r.length>0)try{let t,o=a.transaction(1===r.length?r[0]:r,"readonly");n.autoSchema?function({_novip:e},t,n){e.verno=t.version/10;let a=e._dbSchema=s6(0,t,n);e._storeNames=oI(t.objectStoreNames,0),s0(e,[e._allTables],ow(a),a)}(e,a,o):(s8(e,e._dbSchema,o),((t=s3(s6(0,e.idbdb,o),e._dbSchema)).add.length||t.change.some(e=>e.add.length||e.change.length))&&console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),sQ(e,o)}catch(e){}sd.push(e),a.onversionchange=i0(t=>{n.vcFired=!0,e.on("versionchange").fire(t)}),a.onclose=i0(t=>{e.on("close").fire(t)}),l&&function({indexedDB:e,IDBKeyRange:t},n){le(e)||"__dbnames"===n||s9(e,t).put({name:n}).catch(iu)}(e._deps,i),t()},r)}))]).then(()=>(o(),n.onReadyBeingFired=[],iL.resolve(lt(()=>e.on.ready.fire(e.vip))).then(function t(){if(n.onReadyBeingFired.length>0){let a=n.onReadyBeingFired.reduce(i_,iu);return n.onReadyBeingFired=[],iL.resolve(lt(()=>a(e.vip))).then(t)}}))).finally(()=>{n.onReadyBeingFired=null,n.isBeingOpened=!1}).then(()=>e).catch(t=>{n.dbOpenError=t;try{s&&s.abort()}catch(e){}return r===n.openCanceller&&e._close(),sc(t)}).finally(()=>{n.openComplete=!0,i()})}(this)}_close(){let e=this._state,t=sd.indexOf(this);if(t>=0&&sd.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new iL(t=>{e.dbReadyResolve=t}),e.openCanceller=new iL((t,n)=>{e.cancelOpen=n})}close(){this._close();let e=this._state;this._options.autoOpen=!1,e.dbOpenError=new is.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){let e=arguments.length>0,t=this._state;return new iL((n,a)=>{let r=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=i0(()=>{!function({indexedDB:e,IDBKeyRange:t},n){le(e)||"__dbnames"===n||s9(e,t).delete(n).catch(iu)}(this._deps,this.name),n()}),e.onerror=sL(a),e.onblocked=this._fireOnBlocked};if(e)throw new is.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(r):r()})}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){let e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return ow(this._allTables).map(e=>this._allTables[e])}transaction(){let e=la.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let a,r,o=iN.trans;o&&o.db===this&&-1===e.indexOf("!")||(o=null);let i=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(r=t.map(e=>{var t=e instanceof this.Table?e.name:e;if("string"!=typeof t)throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}),"r"==e||"readonly"===e)a="readonly";else{if("rw"!=e&&"readwrite"!=e)throw new is.InvalidArgument("Invalid transaction mode: "+e);a="readwrite"}if(o){if("readonly"===o.mode&&"readwrite"===a){if(!i)throw new is.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o=null}o&&r.forEach(e=>{if(o&&-1===o.storeNames.indexOf(e)){if(!i)throw new is.SubTransaction("Table "+e+" not included in parent transaction.");o=null}}),i&&o&&!o.active&&(o=null)}}catch(e){return o?o._promise(null,(t,n)=>{n(e)}):sc(e)}let s=(function e(t,n,a,r,o){return iL.resolve().then(()=>{let i,s=iN.transless||iN,l=t._createTransaction(n,a,t._dbSchema,r);if(r)l.idbtrans=r.idbtrans;else try{l.create(),t._state.PR1398_maxLoop=3}catch(r){return r.name===ii.InvalidState&&t.isOpen()&&--t._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),t._close(),t.open().then(()=>e(t,n,a,null,o))):sc(r)}let c=o2(o);c&&i7();let u=iL.follow(()=>{if(i=o.call(l,l))if(c){var e=i9.bind(null,null);i.then(e,e)}else"function"==typeof i.next&&"function"==typeof i.throw&&(i=ln(i))},{trans:l,transless:s});return(i&&"function"==typeof i.then?iL.resolve(i).then(e=>l.active?e:sc(new is.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))):u.then(()=>i)).then(e=>(r&&l._resolve(),l._completion.then(()=>e))).catch(e=>(l._reject(e),sc(e)))})}).bind(null,this,a,r,o,n);return o?o._promise(a,s,"lock"):iN.trans?so(iN.transless,()=>this._whenReady(s)):this._whenReady(s)}table(e){if(!oS(this._allTables,e))throw new is.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}let l_="u">typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class lv{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[l_](){return this}}function l$(e,t){return ow(t).forEach(n=>{lf(e[n]||(e[n]=new lp),t[n])}),e}try{r={indexedDB:oA.indexedDB||oA.mozIndexedDB||oA.webkitIndexedDB||oA.msIndexedDB,IDBKeyRange:oA.IDBKeyRange||oA.webkitIDBKeyRange}}catch(e){r={indexedDB:null,IDBKeyRange:null}}function lA(e){let t=lw;try{lw=!0,sG.storagemutated.fire(e)}finally{lw=t}}oD(lb,{...ic,delete:e=>new lb(e,{addons:[]}).delete(),exists:e=>new lb(e,{addons:[]}).open().then(e=>(e.close(),!0)).catch("NoSuchDatabaseError",()=>!1),getDatabaseNames(e){try{return(function({indexedDB:e,IDBKeyRange:t}){return le(e)?Promise.resolve(e.databases()).then(e=>e.map(e=>e.name).filter(e=>"__dbnames"!==e)):s9(e,t).toCollection().primaryKeys()})(lb.dependencies).then(e)}catch(e){return sc(new is.MissingAPI)}},defineClass:()=>function(e){ox(this,e)},ignoreTransaction:e=>iN.trans?so(iN.transless,e):e(),vip:lt,async:function(e){return function(){try{var t=ln(e.apply(this,arguments));return t&&"function"==typeof t.then?t:iL.resolve(t)}catch(e){return sc(e)}}},spawn:function(e,t,n){try{var a=ln(e.apply(n,t||[]));return a&&"function"==typeof a.then?a:iL.resolve(a)}catch(e){return sc(e)}},currentTransaction:{get:()=>iN.trans||null},waitFor:function(e,t){let n=iL.resolve("function"==typeof e?lb.ignoreTransaction(e):e).timeout(t||6e4);return iN.trans?iN.trans.waitFor(n):n},Promise:iL,debug:{get:()=>o3,set:e=>{o3=e,o4="dexie"===e?()=>!0:sh}},derive:oO,extend:ox,props:oD,override:oN,Events:s_,on:sG,liveQuery:function(e){return new lv(t=>{let n=o2(e),a=!1,r={},o={},i={get closed(){return a},unsubscribe:()=>{a=!0,sG.storagemutated.unsubscribe(u)}};t.start&&t.start(i);let s=!1,l=!1;function c(){return ow(o).some(e=>r[e]&&function(e,t){let n=lh(t),a=n.next();if(a.done)return!1;let r=a.value,o=lh(e),i=o.next(r.from),s=i.value;for(;!a.done&&!i.done;){if(0>=sS(s.from,r.to)&&sS(s.to,r.from)>=0)return!0;0>sS(r.from,s.from)?r=(a=n.next(s.from)).value:s=(i=o.next(r.from)).value}return!1}(r[e],o[e]))}let u=e=>{l$(r,e),c()&&p()},p=()=>{let d,f;if(s||a)return;r={};let h={},m=(n&&i7(),d=()=>i8(e,{subscr:h,trans:null}),f=iN.trans?so(iN.transless,d):d(),n&&f.then(i9,i9),f);l||(sG("storagemutated",u),l=!0),s=!0,Promise.resolve(m).then(e=>{s=!1,a||(c()?p():(r={},o=h,t.next&&t.next(e)))},e=>{s=!1,t.error&&t.error(e),i.unsubscribe()})};return p(),i})},extendObservabilitySet:l$,getByKeyPath:oL,setByKeyPath:oW,delByKeyPath:function(e,t){"string"==typeof t?oW(e,t,void 0):"length"in t&&[].map.call(t,function(t){oW(e,t,void 0)})},shallowClone:oG,deepClone:oY,getObjectDiff:li,cmp:sS,asap:oR,minKey:-1/0,addons:[],connections:sd,errnames:ii,dependencies:r,semVer:"3.2.2",version:"3.2.2".split(".").map(e=>parseInt(e)).reduce((e,t,n)=>e+t/Math.pow(10,2*n))}),lb.maxKey=sK(lb.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(sG("storagemutated",e=>{if(!lw){let t;sf?(t=document.createEvent("CustomEvent")).initCustomEvent("x-storagemutated-1",!0,!0,e):t=new CustomEvent("x-storagemutated-1",{detail:e}),lw=!0,dispatchEvent(t),lw=!1}}),addEventListener("x-storagemutated-1",({detail:e})=>{lw||lA(e)}));let lw=!1;if("u">typeof BroadcastChannel){let e=new BroadcastChannel("x-storagemutated-1");sG("storagemutated",t=>{lw||e.postMessage(t)}),e.onmessage=e=>{e.data&&lA(e.data)}}else if("u">typeof self&&"u">typeof navigator){sG("storagemutated",e=>{try{lw||("u">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){}}),"u">typeof addEventListener&&addEventListener("storage",e=>{if("x-storagemutated-1"===e.key){let t=JSON.parse(e.newValue);t&&lA(t.changedParts)}});let e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",function({data:e}){e&&"x-storagemutated-1"===e.type&&lA(e.changedParts)})}function lk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}iL.rejectionMapper=function(e,t){if(!e||e instanceof it||e instanceof TypeError||e instanceof SyntaxError||!e.name||!il[e.name])return e;var n=new il[e.name](t||e.message,e);return"stack"in e&&oz(n,"stack",{get:function(){return this.inner.stack}}),n},o4=sh;class lx extends lb{constructor(){super("EsmOffline"),lk(this,"syncQueue",void 0),lk(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 lC(){return new lx}let lE=new lx,lS={},lD=V("offline-synchronization",{});function lM(){return lD}async function lz(){if(lD.getState().synchronization)return;let e=await lE.syncQueue.count(),t={},n=Object.entries(lS),a=n.length,r={},o=new AbortController,i=()=>{let e=lD.getState().synchronization;lD.setState({synchronization:{...e,pendingCount:e.pendingCount-1}})};try{lD.setState({synchronization:{totalCount:e,pendingCount:e,abortController:o}});for(let e=0;e<a&&n.length>0;e++)for(let e=n.length;e--;){let[a,s]=n[e],l=s.dependsOn.map(e=>t[e]);l.every(Boolean)&&(r[a]={},await Promise.all(l),t[a]=lO(s,r,o,i),n.splice(e,1))}await Promise.allSettled(Object.values(t))}finally{lD.setState({synchronization:void 0})}}async function lO({type:e,dependsOn:t,process:n},a,r,o){let i=[],s=[],l=await lP();await lE.syncQueue.where({type:e,userId:l}).each((e,t)=>{i.push([t.primaryKey,e.content,e.descriptor]),s.push(e.content)});for(let c=0;c<i.length;c++){let[u,p,{id:d,dependencies:f=[]}]=i[c];try{let o=await n(p,{abort:r,index:c,items:s,userId:l,dependencies:f.map(({id:e,type:n})=>t.includes(n)?a[n][e]:void 0)});void 0!==d&&(a[e][d]=o),await lE.syncQueue.delete(u)}catch(e){await lE.syncQueue.update(u,{lastError:{name:e?.name,message:e?.message??e?.toString()}})}finally{o()}}}async function lP(){let e=await ao();return e?.uuid||"*"}async function lT(e,t,n,a){let r=a&&a.id;return void 0!==r&&await lE.syncQueue.where({type:t,userId:e}).filter(e=>e?.descriptor.id===r).delete().catch(lb.errnames.DatabaseClosed),await lE.syncQueue.add({type:t,content:n,userId:e,descriptor:a||{},createdOn:new Date}).catch(lb.errnames.DatabaseClosed,()=>-1)}async function lB(e,t,n){let a=await lP();return await lT(a,e,t,n)}async function lI(e,t){return(await lN(e,t)).map(e=>e.content)}async function lN(e,t){return await lE.syncQueue.where(t?{type:t,userId:e}:{userId:e}).toArray().catch(lb.errnames.DatabaseClosed,()=>[])}async function lj(e){let t=await lP();return await lI(t,e)}async function lR(e){let t=await lP();return await lN(t,e)}async function lF(e){return await lE.syncQueue.get(e).catch(lb.errnames.DatabaseClosed,()=>void 0)}function lL(e){return!!lS[e]?.options.onBeginEditSyncItem}async function lW(e){let t=await lF(e);if(!t)throw Error(`No sync item with the ID ${e} exists.`);let n=lS[t.type]?.options.onBeginEditSyncItem;if(!n)throw Error(`A sync item with the ID ${e} exists, but the associated handler (if one exists) doesn't support editing the item. You can avoid this error by either verifying that sync items of this type can be edited via the "canEditSynchronizationItemsOfType(type: string)" function or alternatively ensure that the synchronizaton handler for sync items of type "${t.type}" supports editing items.`);n(t)}async function lG(e){await lE.syncQueue.delete(e).catch(lb.errnames.DatabaseClosed)}function lV(e,t,n,a={}){lS[e]={type:e,dependsOn:t,process:n,options:a}}var lU=n(8414);let lq="OFFLINE+";function lH(){return lq+(0,lU.A)()}function lK(e){return e.startsWith(lq)}let lY={};function lJ(){return Object.values(lY)}function lZ(e){lY[e.id]&&console.warn(`[setupDynamicOfflineDataHandler] Another second handler with the ID "${e.id}" was registered. This handler will override the previous one. This could be unintended as the previous handler might run different flows than the newly registered one. If this is the case, ensure that you are setting up the handlers with different IDs.`),lY[e.id]=e}async function lX(e){let t=await l6();return await lQ(t,e)}async function lQ(e,t){let n=new lx;return await n.dynamicOfflineData.where(t?{type:t,users:e}:{users:e}).toArray().catch(lb.errnames.DatabaseClosed,()=>[])}async function l0(e,t){let n=await l6();return await l1(n,e,t)}async function l1(e,t,n){let a=new lx,r=await a.dynamicOfflineData.get({type:t,identifier:n}).catch(lb.errnames.DatabaseClosed,()=>void 0);r?r.users.includes(e)||await a.dynamicOfflineData.update(r.id,{users:[...r.users,e]}).catch(lb.errnames.DatabaseClosed):await a.dynamicOfflineData.add({users:[e],type:t,identifier:n}).catch(lb.errnames.DatabaseClosed)}async function l2(e,t){let n=await l6();return await l3(n,e,t)}async function l3(e,t,n){let a=new lx,r=await a.dynamicOfflineData.get({type:t,identifier:n,users:e}).catch(lb.errnames.DatabaseClosed,()=>void 0);r&&(r.users.length>1?await a.dynamicOfflineData.update(r.id,{users:r.users.filter(t=>t!==e)}).catch(lb.errnames.DatabaseClosed):await a.dynamicOfflineData.delete(r.id).catch(lb.errnames.DatabaseClosed))}async function l4(e,t){let n=await lX(e);await Promise.all(n.map(async e=>l5(e.type,e.identifier,t)))}async function l5(e,t,n){await l0(e,t);let a=new lx,r=await l6(),o=await a.dynamicOfflineData.get({type:e,identifier:t}).catch(lb.errnames.DatabaseClosed,()=>void 0),i=lJ().filter(t=>t.type===e);if(!o)return;let s=await Promise.all(i.map(async e=>{try{return e.sync(t,n),{id:e.id,error:void 0}}catch(n){let t=n.message?.toString()??n.toString();return{id:e.id,error:t}}})),l=s.filter(e=>!e.error).map(e=>e.id),c=s.filter(e=>e.error).map(e=>e.id),u=s.filter(e=>e.error).map(e=>({handlerId:e.id,message:e.error})),p={syncedOn:new Date,syncedBy:r,succeededHandlers:l,erroredHandlers:c,errors:u};o.id&&await a.dynamicOfflineData.update(o.id,{syncState:p}).catch(lb.errnames.DatabaseClosed)}async function l6(){let e=(await ao()).uuid;if(!e)throw Error("Using the dynamic offline data API requires a logged in user.");return e}let l8=V("offline-patients",{offlinePatientDataSyncState:{},handlers:{}});function l7(){return ct(),l8}function l9(e,t){ct(),lZ({type:"patient",displayName:t.displayName,id:e,isSynced:()=>Promise.resolve(!0),sync:(e,n)=>t.onOfflinePatientAdded({patientUuid:e,signal:n??new AbortController().signal})})}async function ce(e){ct(),await l5("patient",e)}function ct(){console.warn("The offline patient API has been deprecated and will be removed in a future release. To prevent future crashes, the functions remain available for the moment, but any invocations should be migrated ASAP.")}async function cn(e,t,n=!0){if(e){let a=null,[r,o]=await Promise.all([n4(`${n1}/Patient/${e}`,t).catch(e=>a=e),n?ca(e):Promise.resolve(null)]);if(r.ok)return r.data;if(o)return o;if(a)throw a}return null}async function ca(e){let t=(await lj("patient-registration")).find(t=>t.fhirPatient.id===e);return t?.fhirPatient??null}function cr(e,t){let n=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(n)}function co(e,t){let n=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,n),()=>{window.removeEventListener(`openmrs:${e}`,n)}}var ci=n(6170);function cs(e){return{uuid:e.uuid,display:e.display}}function cl(e=null,t=null){let n=new URLSearchParams;e&&n.set("tag",e),t&&n.set("q",t);let a=n.toString();return n5(`${n0}/location${a?"?"+a:""}`).pipe((0,ci.map)(e=>e.data.results.map(cs))).pipe((0,ci.take)(1))}function cc(e){return{uuid:e.uuid,display:e.display,name:e.name}}function cu(){return n5(`${n0}/visittype`).pipe((0,ci.map)(e=>e.data.results.map(cc))).pipe((0,ci.take)(1))}var cp=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),cd=function(e){function t(t,n){var a=e.call(this)||this;return a.subject=t,a.subscriber=n,a.closed=!1,a}return en(t,e),t.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)}}},t}(eu),cf=function(e){function t(t){var n=e.call(this,t)||this;return n.destination=t,n}return en(t,e),t}(ef),ch=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return en(t,e),t.prototype[ed]=function(){return new cf(this)},t.prototype.lift=function(e){var t=new cm(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new cp;if(!this.isStopped)for(var t=this.observers,n=t.length,a=t.slice(),r=0;r<n;r++)a[r].next(e)},t.prototype.error=function(e){if(this.closed)throw new cp;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,n=t.length,a=t.slice(),r=0;r<n;r++)a[r].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new cp;this.isStopped=!0;for(var e=this.observers,t=e.length,n=e.slice(),a=0;a<t;a++)n[a].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(!this.closed)return e.prototype._trySubscribe.call(this,t);throw new cp},t.prototype._subscribe=function(e){if(this.closed)throw new cp;return this.hasError?(e.error(this.thrownError),eu.EMPTY):this.isStopped?(e.complete(),eu.EMPTY):(this.observers.push(e),new cd(this,e))},t.prototype.asObservable=function(){var e=new eg;return e.source=this,e},t.create=function(e,t){return new cm(e,t)},t}(eg),cm=function(e){function t(t,n){var a=e.call(this)||this;return a.destination=t,a.source=n,a}return en(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):eu.EMPTY},t}(ch),cg=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return en(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n&&!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(!this.closed)return this._value;throw new cp},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(ch),cy=((J={}).NEWVISIT="startVisit",J.EDITVISIT="editVisit",J.LOADING="loadingVisit",J),cb=((Z={}).NOTSTARTED="notStarted",Z.ONGOING="ongoing",Z);let c_="custom:(uuid,display,voided,indication,startDatetime,stopDatetime,encounters:(uuid,display,encounterDatetime,form:(uuid,name),location:ref,encounterType:ref,encounterProviders:(uuid,display,provider:(uuid,display))),patient:(uuid,display),visitType:(uuid,name,display),attributes:(uuid,display,attributeType:(name,datatypeClassname,uuid),value),location:(uuid,name,display))",cv=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null,mutateVisitCallbacks:{}};function c$(){return q("visit",cv)}function cA(e,t){c$().setState({patientUuid:e,manuallySetVisitUuid:t})}function cw(e,t){return n4(`${n0}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ck(e,t,n){return n4(`${n0}/visit/${e}`,{signal:n.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function cx(e,t,n){return n4(`${n0}/visit?patient=${e}&v=${n??c_}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}c$().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});let cC=new cg(null);class cE{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+cE.version}static addUnaryOp(e){return cE.max_unop_len=Math.max(e.length,cE.max_unop_len),cE.unary_ops[e]=1,cE}static addBinaryOp(e,t,n){return cE.max_binop_len=Math.max(e.length,cE.max_binop_len),cE.binary_ops[e]=t,n?cE.right_associative.add(e):cE.right_associative.delete(e),cE}static addIdentifierChar(e){return cE.additional_identifier_chars.add(e),cE}static addLiteral(e,t){return cE.literals[e]=t,cE}static removeUnaryOp(e){return delete cE.unary_ops[e],e.length===cE.max_unop_len&&(cE.max_unop_len=cE.getMaxKeyLen(cE.unary_ops)),cE}static removeAllUnaryOps(){return cE.unary_ops={},cE.max_unop_len=0,cE}static removeIdentifierChar(e){return cE.additional_identifier_chars.delete(e),cE}static removeBinaryOp(e){return delete cE.binary_ops[e],e.length===cE.max_binop_len&&(cE.max_binop_len=cE.getMaxKeyLen(cE.binary_ops)),cE.right_associative.delete(e),cE}static removeAllBinaryOps(){return cE.binary_ops={},cE.max_binop_len=0,cE}static removeLiteral(e){return delete cE.literals[e],cE}static removeAllLiterals(){return cE.literals={},cE}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new cE(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return cE.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!cE.binary_ops[String.fromCharCode(e)]||cE.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return cE.isIdentifierStart(e)||cE.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(cE.hooks[e]){let n={context:this,node:t};return cE.hooks.run(e,n),n.node}return t}searchHook(e){if(cE.hooks[e]){let t={context:this};return cE.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===cE.SPACE_CODE||e===cE.TAB_CODE||e===cE.LF_CODE||e===cE.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:cE.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],n,a;for(;this.index<this.expr.length;)if((n=this.code)===cE.SEMCOL_CODE||n===cE.COMMA_CODE)this.index++;else if(a=this.gobbleExpression())t.push(a);else if(this.index<this.expr.length){if(n===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,cE.max_binop_len),t=e.length;for(;t>0;){if(cE.binary_ops.hasOwnProperty(e)&&(!cE.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!cE.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,a,r,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(r={value:t,prec:cE.binaryPrecedence(t),right_a:cE.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),a=[o,r,i];t=this.gobbleBinaryOp();){if(0===(n=cE.binaryPrecedence(t))){this.index-=t.length;break}r={value:t,prec:n,right_a:cE.right_associative.has(t)},l=t;let s=e=>r.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;a.length>2&&s(a[a.length-2]);)i=a.pop(),t=a.pop().value,o=a.pop(),e={type:cE.BINARY_EXP,operator:t,left:o,right:i},a.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),a.push(r,e)}for(s=a.length-1,e=a[s];s>1;)e={type:cE.BINARY_EXP,operator:a[s-1].value,left:a[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,n,a;if(this.gobbleSpaces(),a=this.searchHook("gobble-token"))return this.runHook("after-token",a);if(e=this.code,cE.isDecimalDigit(e)||e===cE.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===cE.SQUOTE_CODE||e===cE.DQUOTE_CODE)a=this.gobbleStringLiteral();else if(e===cE.OBRACK_CODE)a=this.gobbleArray();else{for(n=(t=this.expr.substr(this.index,cE.max_unop_len)).length;n>0;){if(cE.unary_ops.hasOwnProperty(t)&&(!cE.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!cE.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:cE.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}cE.isIdentifierStart(e)?(a=this.gobbleIdentifier(),cE.literals.hasOwnProperty(a.name)?a={type:cE.LITERAL,value:cE.literals[a.name],raw:a.name}:a.name===cE.this_str&&(a={type:cE.THIS_EXP})):e===cE.OPAREN_CODE&&(a=this.gobbleGroup())}return a?(a=this.gobbleTokenProperty(a),this.runHook("after-token",a)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===cE.PERIOD_CODE||t===cE.OBRACK_CODE||t===cE.OPAREN_CODE||t===cE.QUMARK_CODE;){let n;if(t===cE.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==cE.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===cE.OBRACK_CODE?((e={type:cE.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==cE.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===cE.OPAREN_CODE?e={type:cE.CALL_EXP,arguments:this.gobbleArguments(cE.CPAREN_CODE),callee:e}:(t===cE.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:cE.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,n;for(;cE.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===cE.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);cE.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));cE.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);cE.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return n=this.code,cE.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(n===cE.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===cE.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:cE.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,n=this.expr.charAt(this.index++),a=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){a=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return a||this.throwError('Unclosed quote after "'+e+'"'),{type:cE.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(cE.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,cE.isIdentifierPart(e))this.index++;else break;return{type:cE.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],n=!1,a=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===e){n=!0,this.index++,e===cE.CPAREN_CODE&&a&&a>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(r===cE.COMMA_CODE){if(this.index++,++a!==t.length){if(e===cE.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===cE.CBRACK_CODE)for(let e=t.length;e<a;e++)t.push(null)}}else if(t.length!==a&&0!==a)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==cE.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(cE.CPAREN_CODE);if(this.code===cE.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:cE.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:cE.ARRAY_EXP,elements:this.gobbleArguments(cE.CBRACK_CODE)}}}Object.assign(cE,{hooks:new class{add(e,t,n){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(cE),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),cE.max_unop_len=cE.getMaxKeyLen(cE.unary_ops),cE.max_binop_len=cE.getMaxKeyLen(cE.binary_ops);let cS=e=>new cE(e).parse(),cD=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(cE).filter(e=>!cD.includes(e)&&void 0===cS[e]).forEach(e=>{cS[e]=cE[e]}),cS.Jsep=cE,cS.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,a=this.gobbleExpression();if(a||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:a,alternate:r},n.operator&&e.binary_ops[n.operator]<=.9){let a=n;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=n}}else this.throwError("Expected :")}})}});let cM="ArrowFunctionExpression",cz={Array,Boolean,Symbol,Infinity,NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},cO={...cz,Promise};function cP(e,t={}){return cR(e,t,cW)}async function cT(e,t={}){return cF(e,t,cW)}function cB(e,t={}){return cR(e,t,cG)}function cI(e,t={}){return cF(e,t,cG)}function cN(e,t={}){return cR(e,t,cV)}function cj(e,t={}){return cF(e,t,cV)}function cR(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let a=cH(t,cz),r=cU("string"==typeof e?cS(e):e,a);if(n(r))return r;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}}async function cF(e,t={},n){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))return Promise.reject(`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`);if("string"==typeof e&&0===e.trim().length)throw{type:"Empty expression",message:"Expression cannot be an empty string"};null==t&&(t={});let a=cH(t,cO);return Promise.resolve(cU("string"==typeof e?cS(e):e,a)).then(t=>{if(n(t))return t;throw{type:"Invalid result",message:"string"==typeof e?`The expression ${e} did not produce a valid result`:"The expression did not produce a valid result"}})}function cL(e){return cS(e)}function cW(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function cG(e){return"boolean"==typeof e}function cV(e){return"number"==typeof e}function cU(e,t){switch(e.type){case"UnaryExpression":var n,a,r,o,i,s,l,c,u,p,d,f,h=e,m=t;let g=cU(h.argument,m);switch(h.operator){case"+":return+g;case"-":return-g;case"~":return~g;case"!":return!g;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var y=e,b=t;let v=cU(y.left,b),$=cU(y.right,b);switch(y.operator){case"+":return v+$;case"-":return v-$;case"*":return v*$;case"/":return v/$;case"%":return v%$;case"**":return v**$;case"==":return v==$;case"===":return v===$;case"!=":return v!=$;case"!==":return v!==$;case">":return v>$;case">=":return v>=$;case"<":return v<$;case"<=":return v<=$;case"in":return v in $;case"&&":return v&&$;case"||":return v||$;case"??":return v??$;default:throw`Expression evaluator does not support operator '${y.operator}' operator`}case"ConditionalExpression":return n=e,a=t,cU(n.test,a)?cU(n.consequent,a):cU(n.alternate,a);case"CallExpression":var A=e,w=t;let k=A.arguments?.map(cK(w)),x=cU(A.callee,w);if(x){if("function"!=typeof x)throw`${cJ(A.callee)} is not a function`}else throw`No function named ${cJ(A.callee)} is defined in this context`;return x(...k);case"ArrowFunctionExpression":let C;return r=e,o=t,C=r.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<C.length)throw`Required argument(s) ${C.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(C.reduce((t,n,a)=>{let r=e[a];return function e(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"function"==typeof t||null===t||t instanceof RegExp)return!0;if("object"==typeof t){for(let n of Object.keys(t))if(!e(t[n]))return!1;return!0}if(Array.isArray(t)){for(let n of t)if(!e(n))break}return!1}(r)&&t.push([n,r]),t},[]));return cU(r.body,o.addVariables(t))}).bind(o.thisObj??null);case"MemberExpression":return function(e,t){let n,a=cU(e.object,t);if(void 0===a)switch(e.object.type){case"Identifier":{let n=cq(e.object,t);throw ReferenceError(`ReferenceError: ${n} is not defined`)}case"MemberExpression":{let n=cq(e.property,t);throw TypeError(`TypeError: cannot read properties of undefined (reading '${n}')`)}default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}let r=a;if("string"==typeof a)r=String.prototype;else if("number"==typeof a)r=Number.prototype;else if("function"==typeof a);else if("object"!=typeof a)throw`VisitMemberExpression does not support member access on type ${typeof a}`;switch(t.thisObj=r,e.property.type){case"Identifier":case"MemberExpression":n=cU(e.property,t);break;default:{let r=cU(e.property,t);if(void 0===r)throw{type:"Illegal property access",message:"No property was supplied to the property access"};cY(r),n=a[r]}}return"function"==typeof n?n.bind(a):n}(e,t);case"ArrayExpression":return i=e,s=t,i.elements?.map(cK(s));case"SequenceExpression":let E;return l=e,c=t,(E=l.expressions.map(cK(c)))[E.length-1];case"NewExpression":var S=e,D=t;if(S.callee&&"Identifier"===S.callee.type){let e=S.arguments?.map(cK(D));switch(S.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${S.callee.name}`}}if(S.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return cY((u=e).value),u.value;case"Identifier":var M=e,z=t;cY(M.name);let O=z.thisObj;if(O&&("object"==typeof O||"function"==typeof O)&&M.name in O){let e=O[M.name];return cY(e),e}if(z.variables&&M.name in z.variables){let e=z.variables[M.name];return cY(e),e}return M.name in z.globals?z.globals[M.name]:void 0;case"TemplateLiteral":let P,T;return p=e,d=t,P=p.expressions?.map(cK(d))??[],(T=p.quasis?.map(cK(d))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+P.join("")+T.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function cq(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return cq(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function cH(e,t){let n={thisObj:void 0,variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return n.addVariables.bind(n),n}function cK(e){return function(t){return null===t?null:cU(t,e)}}function cY(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}function cJ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function cZ(e){if("string"!=typeof e&&("object"!=typeof e||!e||!("type"in e)))throw`Unknown expression type ${e}. Expressions must either be a string or pre-compiled string.`;let t={globals:{...cO},isLocalExpression:!1,variables:new Set};return cX("string"==typeof e?cS(e):e,t),[...t.variables]}function cX(e,t){switch(e.type){case"UnaryExpression":return a=e,r=t,cX(a.argument,r);case"BinaryExpression":return o=e,i=t,[cX(o.left,i),cX(o.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[cX(s.consequent,l),cX(s.test,l),cX(s.alternate,l)].filter(Boolean);case"CallExpression":let n;return c=e,u=t,n=cX(c.callee,u),c.arguments?.map(cQ(u)),n;case"ArrowFunctionExpression":var a,r,o,i,s,l,c,u,p,d,f,h,m,g,y,b,v,$,A=e,w=t;let k={...w};k.isLocalExpression=!0;let x=A.params?.map(cQ(k))??[],C=cX(A.body,k)??[];if(C&&Array.isArray(C))for(let e of C)x.includes(e)||w.variables.add(e);return;case"MemberExpression":let E;return p=e,d=t,cX(p.object,d),void((E={...d}).isLocalExpression=!0,cX(p.property,E));case"ArrayExpression":return f=e,h=t,void f.elements?.map(cQ(h));case"SequenceExpression":return m=e,g=t,void m.expressions?.map(cQ(g));case"NewExpression":return y=e,b=t,void y.arguments?.map(cQ(b));case"Literal":case"TemplateElement":return;case"Identifier":var S=e,D=t;if(!(S.name in D.globals))if(D.isLocalExpression)return S.name;else D.variables.add(S.name);return;case"TemplateLiteral":return v=e,$=t,void(v.expressions?.map(cQ($)),v.quasis?.map(cQ($)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function cQ(e){return function(t){return null===t?null:cX(t,e)}}cS.plugins.register({name:"arrow",init(e){e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){let n=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let n=this.gobbleBinaryExpression();n||this.throwError("Expected expression after "+e),t.node={type:cM,params:null,body:n};return}}this.index=n}}),e.hooks.add("after-expression",function(t){!function t(n){n&&(Object.values(n).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===n.operator&&(n.type=cM,n.params=n.left?[n.left]:null,n.body=n.right,n.params&&n.params[0].type===e.SEQUENCE_EXP&&(n.params=n.params[0].expressions),delete n.left,delete n.right,delete n.operator))}(t.node)})}}),cS.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let n=t.node;if(n&&"new"===n.operator){n.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(n.argument.type)||this.throwError("Expected new function()"),t.node=n.argument;let a=t.node;for(;a.type===e.MEMBER_EXP||a.type===e.CALL_EXP&&a.callee.type===e.MEMBER_EXP;)a=a.type===e.MEMBER_EXP?a.object:a.callee.object;a.type="NewExpression"}})}}),cS.plugins.register({name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function n(t){let n=this.index,a="",r=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:a+=this.expr.charAt(this.index++)};r(),this.code===e.PERIOD_CODE&&(a+=this.expr.charAt(this.index++),r());let o=this.char;("e"===o||"E"===o)&&(a+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(a+=this.expr.charAt(this.index++)),r(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+a+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+a+this.char+")");else if(i===e.PERIOD_CODE){a.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:a},null,2)}`),this.index=n;return}t.node={type:e.LITERAL,value:parseFloat(a),raw:this.expr.substring(n,this.index)}}e.hooks.add("gobble-token",function(a){if(48===this.code){var r,o,i;let s=this.index,l=this.expr.charAt(this.index+1),c=t.call(this,l);if(!c)return;let u="";for(;r=this.code,o=c,95===r||o.some(([e,t])=>r>=e&&r<=t);)95===this.code?this.index++:u+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,n.call(this,a);return}this.throwError("unexpected char within number")}a.node={type:e.LITERAL,value:parseInt(u,"x"===(i=l)||"X"===i?16:"b"===i||"B"===i?2:8),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&n.call(this,a)})}}),cS.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let n=++this.index,a=!1;for(;this.index<this.expr.length;){if(47===this.code&&!a){let a,r=this.expr.slice(n,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{a=new RegExp(r,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:a,raw:this.expr.slice(n-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?a=!0:a&&this.code===e.CBRACK_CODE&&(a=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),cS.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let n=t.node,a=this.gobbleExpression();if(a||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:a,alternate:r},n.operator&&e.binary_ops[n.operator]<=.9){let a=n;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=n}}else this.throwError("Expected :")}})}}),cS.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,n=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},a="",r="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:r,cooked:a},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,n&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),r="",a="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(r+=i,i=this.expr.charAt(++this.index),r+=i,i){case"n":a+="\n";break;case"r":a+="\r";break;case"t":a+=" ";break;case"b":a+="\b";break;case"f":a+="\f";break;case"v":a+="\v";break;default:a+=i}else a+=i,r+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(n){if((n.node.type===e.IDENTIFIER||n.node.type===e.MEMBER_EXP)&&96===this.code)return n.node={type:"TaggedTemplateExpression",tag:n.node,quasi:t.bind(this)(n,!1)},n.node=this.gobbleTokenProperty(n.node),n.node})}}),cS.addBinaryOp("in",7),cS.addBinaryOp("??",1);let c0=q("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let n=t.replace("openmrs:feature-flag:",""),a=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${n}`)||"{}");e[n]={enabled:"true"===localStorage.getItem(t),...a}}return e}()});function c1(e,t,n){c0.setState(a=>({flags:{...a.flags,[e]:{enabled:a.flags[e]?.enabled??!1,label:t,description:n}}}))}function c2(){let e=c0.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let n=t.replace("openmrs:feature-flag:","");e[n]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${n}`))})}function c3(e){return c0.getState().flags[e].enabled}function c4(e,t){c0.subscribe(n=>{t(n.flags[e].enabled)})}function c5(e,t){c0.setState(n=>({flags:{...n.flags,[e]:{...n.flags[e],enabled:t}}}))}function c6(e){return!window.offlineEnabled||(e??navigator.onLine)}function c8(e=!0,t=!1){return c7(c6(),e,t)}function c7(e,t=!0,n=!1){return!!(e?t:n)}c0.subscribe(e=>{for(let[t,n]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,n.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:n.label,description:n.description}))});let c9=V("extensionsInternal",{slots:{},extensions:{}}),ue=()=>q("extensionsInternal",{slots:{},extensions:{}});function ut(e){let t=c9.getState(),n=e(t);n!==t&&c9.setState(n)}let un=()=>q("extensions",{slots:{}});function ua(e){let 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});(0,ee.isEqual)(eS.getState().mountedExtensions,t)||eS.setState({mountedExtensions:t})}ua(c9.getState()),c9.subscribe(ua);let ur=ue(),uo=un(),ui=eM(),us=eP();function ul(e,t,n,a,r){let o={},i=c6(),s=Object.entries(a.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[a,l]of Object.entries(e.slots)){let{config:c}=eO(t,l.name),u=u_(a,e,c,n,s,i,r.session);o[a]={moduleName:l.moduleName,assignedExtensions:u}}(0,ee.isEqual)(uo.getState().slots,o)||uo.setState({slots:o})}function uc(){ul(ur.getState(),ui.getState(),us.getState(),c0.getState(),n8.getState())}function uu(e,t,n){return{moduleName:t,name:e,attachedIds:[],config:null,state:n}}function up(e){let[t]=e.split("#");return t}function ud(e,t){let n=up(t);return e.extensions[n]}function uf(e){return ud(ur.getState(),e)}ur.subscribe(e=>{ul(e,ui.getState(),us.getState(),c0.getState(),n8.getState())}),ui.subscribe(e=>{ul(ur.getState(),e,us.getState(),c0.getState(),n8.getState())}),us.subscribe(e=>{ul(ur.getState(),ui.getState(),e,c0.getState(),n8.getState())}),c0.subscribe(e=>{ul(ur.getState(),ui.getState(),us.getState(),e,n8.getState())}),n8.subscribe(e=>{ul(ur.getState(),ui.getState(),us.getState(),c0.getState(),e)}),uc(),g(uc);let uh=e=>ur.setState(t=>(t.extensions[e.name]={...e,instances:[]},t));function um(e,t){ut(n=>{let a=n.slots[e];return a?{...n,slots:{...n.slots,[e]:{...a,attachedIds:[...a.attachedIds,t]}}}:{...n,slots:{...n.slots,[e]:{...uu(e),attachedIds:[t]}}}})}function ug(e,t){ut(n=>{let a=n.slots[e];return a&&a.attachedIds.includes(t)?{...n,slots:{...n.slots,[e]:{...a,attachedIds:a.attachedIds.filter(e=>e!==t)}}}:n})}function uy(e){ut(t=>{let n=t.slots[e];return n?{...t,slots:{...t.slots,[e]:{...n,attachedIds:[]}}}:t})}function ub(e,t,n,a){let r=t.indexOf(e);if(-1!==r)return r;{if(void 0!==n)return 1e3+n;let t=a.indexOf(e);return -1!==t?2e3+t:-1}}function u_(e,t,n,a,r,o,i){let s=function(e,t){let n=e.add||[],a=e.remove||[],r=e.order||[],{extensions:o}=ur.getState();return[...t,...n].filter(e=>!a.includes(e)).sort((e,n)=>{let a=ub(e,r,o[up(e)]?.order,t),i=ub(n,r,o[up(n)]?.order,t);return -1===i?-1:-1===a?1:a-i})}(n,t.slots[e].attachedIds),l=[],c=t.slots[e]?.state,u=c&&"object"==typeof c?{session:i,...c}:{session:i};for(let c of s){let{config:s}=eB(a,e,c),p=eI(n,e,c),d=(0,ee.merge)(s,p),f=up(c),h=t.extensions[f];if(h){let t=d?.["Display conditions"]?.privileges??h.privileges??[];if(t&&("string"==typeof t||Array.isArray(t)&&t.length>0)&&(!i?.user||!ar(t,i.user)))continue;let n=d?.["Display conditions"]?.expression||h.displayExpression;if(void 0!==n&&"string"==typeof n&&n.trim().length>0)try{if(!cB(n,u))continue}catch(t){console.error(`Error while evaluating expression '${n}' for extension ${f} in slot ${e}`,t);continue}if(h.featureFlag&&!r.includes(h.featureFlag)||window.offlineEnabled&&!c7(o,h.online,h.offline))continue;l.push({id:c,name:f,moduleName:h.moduleName,config:d,featureFlag:h.featureFlag,meta:h.meta,online:d?.["Display conditions"]?.online??h.online??!0,offline:d?.["Display conditions"]?.offline??h.offline??!1})}}return l}function uv(e){let t=ur.getState(),{config:n}=ez(e),a=us.getState(),r=c0.getState(),o=n8.getState(),i=c6();return u_(e,t,n,a,Object.entries(r.flags).filter(([,{enabled:e}])=>e).map(([e])=>e),i,o.session)}let u$=(e,t,n)=>ur.setState(a=>{let r=a.slots[t]?.moduleName;if(r&&r!=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 ${r}.`),a;if(r&&r==e)return a;if(a.slots[t])return{...a,slots:{...a.slots,[t]:{...a.slots[t],moduleName:e,state:n}}};let o=uu(t,e,n);return{...a,slots:{...a.slots,[t]:{...o}}}});function uA(e,t,n=!1){ur.setState(a=>{let r=n?(0,ee.merge)(a.slots[e].state,t):t;return{...a,slots:{...a.slots,[e]:{...a.slots[e],state:r}}}})}let uw=()=>uo.setState(()=>({slots:{},extensions:{}})),uk=V("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function ux({name:e,basePath:t,mode:n,componentContext:a,state:r}){uk.setState({slotName:e,basePath:t,mode:n??"normal",componentContext:a,state:r})}function uC(e){uk.getState().slotName===e&&uk.setState(uk.getInitialState(),!0)}let uE=V("modalRegistry",{modals:{}});function uS(e){uE.setState(t=>(t.modals[e.name]=e,t))}function uD(e){let t=uE.getState().modals[e];if(!t){let n=uf(e);n&&(t={name:e,load:n.load,moduleName:n.moduleName},console.warn(`Modal ${e} was registered as an extension. This is deprecated and will be removed in the future. Please register it in the "modals" section of routes.json instead of the "extensions" section.`),uS(t))}return t}let uM=V("workspaceRegistrations",{workspaces:{}}),uz=V("workspaceGroups",{workspaceGroups:{}});function uO(e){uM.setState(t=>({workspaces:{...t.workspaces,[e.name]:{...e,load:e.load,preferredWindowSize:e.preferredWindowSize??"normal",type:e.type??"form",canHide:e.canHide??!1,canMaximize:e.canMaximize??!1,width:e.width??"narrow",groups:e.groups??[]}}}))}function uP(e){uz.setState(t=>{let n=t.workspaceGroups[e.name];return n?{workspaceGroups:{...t.workspaceGroups,[e.name]:{...n,members:Array.from(new Set([...n.members,...e.members]))}}}:{workspaceGroups:{...t.workspaceGroups,[e.name]:{name:e.name,members:e.members}}}})}let uT=new Set;function uB(e){let t=uM.getState().workspaces;if(t[e])return t[e];{let t=uf(e);if(t){var n;let a;return uT.has(e)||(console.warn(`The workspace '${e}' is registered as an extension. This is deprecated. Please register it in the "workspaces" section of the routes.json file.`),uT.add(e)),{name:t.name,title:(n=t,"string"==typeof(a=n?.meta?.title)?a:a&&"object"==typeof a?ru(n.moduleName,a.key,a.default):n.name),moduleName:t.moduleName,preferredWindowSize:t.meta?.screenSize??"normal",load:t.load,type:t.meta?.type??"form",canHide:t.meta?.canHide??!1,canMaximize:t.meta?.canMaximize??!1,width:t.meta?.width??"narrow",groups:t.meta?.groups??[]}}throw Error(`No workspace named '${e}' has been registered.`)}}function uI(e){let t=uz.getState().workspaceGroups;if(t[e])return t[e];throw Error(`No workspace group named '${e}' has been registered.`)}let uN=V("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],workspaceTitleByWorkspaceName:{},isMostRecentlyOpenedWindowHidden:!1});function uj(e){let{registeredWorkspacesByName:t,registeredWindowsByName:n}=uN.getState(),a=t[e];if(a){let t=n[a.window];if(t)return t;throw Error(`No workspace window found with name: ${a.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function uR(e){let{registeredGroupsByName:t,registeredWindowsByName:n}=uN.getState(),a=n[e];if(a){let n=t[a.group];if(n)return n;throw Error(`No workspace group found with name: ${a.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function uF(e){let{openedWindows:t}=uN.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function uL(e,t){if(0==t.length)return;let{registeredGroupsByName:n}=uN.getState(),a={...n};for(let n of t){if(a[n.name])throw Error(`Cannot register workspace group ${n.name} more than once`);a[n.name]={...n,moduleName:e}}uN.setState({registeredGroupsByName:a})}function uW(e,t){if(0==t.length)return;let{registeredWindowsByName:n}=uN.getState(),a={...n};for(let n of t){if(a[n.name])throw Error(`Cannot register workspace window ${n.name} more than once`);let t={...n,moduleName:e};a[n.name]=t}uN.setState({registeredWindowsByName:a})}function uG(e,t){if(0==t.length)return;let{registeredWorkspacesByName:n}=uN.getState(),a={...n};for(let n of t){if(a[n.name])throw Error(`Cannot register workspace ${n.name} more than once`);let t={...n,moduleName:e};a[n.name]=t}uN.setState({registeredWorkspacesByName:a})}let uV=0;async function uU(e,t,n,a,r=e=>e,o={}){let i=up(a),s=uf(a),l=null;if(e){if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:u,online:p,offline:d,load:f}=s;if(c8(p,d)){ut(r=>({...r,extensions:{...r.extensions,[i]:{...r.extensions[i],instances:[...r.extensions[i].instances,{domElement:e,id:a,slotName:t,slotModuleName:n}]}}}));let s=await f(),p=uV++;l=t2(r({...s,name:`${t}/${i}-${p}`}),{...o,_meta:c,_extensionContext:{extensionId:a,extensionSlotName:t,extensionSlotModuleName:n,extensionModuleName:u},domElement:e})}}else console.warn(`Tried to render ${a} into ${t} but no DOM element was available.`);return l}var uq=n(7979),uH=n.n(uq);let uK=(0,uq.createContext)({moduleName:"",featureName:""});function uY({to:e,templateParams:t,onBeforeNavigate:n,children:a,...r}){return(0,uq.useEffect)(()=>{r.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${r.href}'`),r.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),uH().createElement("a",{onClick:a=>{0===a.button&&!a.ctrlKey&&!a.shiftKey&&!a.altKey&&!a.metaKey&&(a.preventDefault(),n?.(a),nV({to:e,templateParams:t})),0===a.button&&(a.ctrlKey||a.metaKey)&&n?.(a),0===a.button&&a.shiftKey&&n?.(a),1===a.button&&n?.(a)},href:nW(e,t),...r},a)}let uJ=({state:e,children:t,...n})=>{let{extension:a}=(0,uq.useContext)(uK),r=(0,uq.useRef)(null),o=(0,uq.useRef)(Promise.resolve()),i=(0,uq.useCallback)(t=>{a?.extensionSlotName&&a.extensionSlotModuleName&&a.extensionSlotModuleName&&!r.current&&uU(t,a.extensionSlotName,a.extensionSlotModuleName,a.extensionId,void 0,e).then(e=>{r.current=e})},[]);return(0,uq.useEffect)(()=>()=>{if(r&&r.current)switch(r.current.getStatus()){case"MOUNTING":r.current.mountPromise.then(()=>{r.current?.getStatus()==="MOUNTED"&&r.current.unmount()});break;case"MOUNTED":r.current.unmount();break;case"UPDATING":o.current&&o.current.then(()=>{r.current?.getStatus()==="MOUNTED"&&r.current.unmount()})}},[]),(0,uq.useEffect)(()=>{r.current&&r.current.update&&"UNMOUNTING"!==r.current.getStatus()&&Promise.all([r.current.mountPromise,o.current]).then(()=>{r?.current?.getStatus()==="MOUNTED"&&r.current.update&&(o.current=r.current.update({...e}).catch(e=>{if(!(e instanceof Error)||!e.message.includes("minified message #32")||r.current?.getStatus()==="MOUNTED")throw e}))})},[e]),a?uH().createElement("div",{ref:i,"data-extension-id":a?.extensionId,style:{position:"relative"},...n}):null};function uZ(e,t){"function"==typeof t&&(t=t(e));let n={};for(let[a,r]of Object.entries(t)){let t=function(...t){e.setState(e=>r(e,...t))};n[a]=t}return n}let uX=()=>e=>e;function uQ(e,t=uX(),n){let a=(0,uq.useCallback)(t=>e.subscribe(t),[e]),r=(0,uq.useCallback)(()=>t(e.getState()),[e,t]),o=(0,uq.useSyncExternalStore)(a,r,r),i=(0,uq.useMemo)(()=>n?uZ(e,n):{},[e,n]);return{...o,...i}}function u0(e,t){return uQ(e,uX(),t)}function u1(e){return function(t){let n=(0,uq.useCallback)(t=>e.subscribe(t),[]),a=(0,uq.useCallback)(()=>e.getState(),[]),r=(0,uq.useSyncExternalStore)(n,a,a),o=(0,uq.useMemo)(()=>t?uZ(e,t):{},[t]);return{...r,...o}}}let u2=e=>uQ(un(),t=>t.slots?.[e]);function u3(e){let t=u2(e);return t?.assignedExtensions??[]}function u4(e,t){let{moduleName:n}=(0,uq.useContext)(uK),a=(0,uq.useRef)(!0);if(!n)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,uq.useEffect)(()=>{u$(n,e,t),a.current=!1},[]),(0,uq.useEffect)(()=>{a.current||uA(e,t)},[e,t]),{extensions:u3(e),extensionSlotName:e,extensionSlotModuleName:n}}function u5(e){return e}function u6({name:e,extensionSlotName:t,select:n=u5,children:a,state:r,style:o,...i}){if(a&&r)throw Error("Both children and state have been provided. If children are provided, the state must be passed as a prop to the `Extension` component.");let s=e??t,l=(0,uq.useRef)(null),{extensions:c,extensionSlotModuleName:u}=u4(s,r),p=(0,uq.useMemo)(()=>n(c),[n,c]),d=(0,uq.useMemo)(()=>{if("function"==typeof a&&!uH().isValidElement(a))return p.map(e=>a(e,r))},[a,p]);return uH().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":u,style:{...o,position:"relative"},...i},s&&p?.map((e,t)=>uH().createElement(uK.Provider,{key:e.id,value:{moduleName:u,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:u}}},d?.[t]??("function"!=typeof a?a:null)??uH().createElement(uJ,{state:r}))))}var u8=n(5338);function u7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function u9(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u7(Object(n),!0).forEach(function(t){var a,r,o;a=e,r=t,o=n[t],r in a?Object.defineProperty(a,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):a[r]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pe(e){return(pe="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 pt(e){return(pt="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 pn(e,t){var n;if("function"!=typeof(n=t.domElement?function(){return t.domElement}:t.domElementGetter?t.domElementGetter:e.domElementGetter?e.domElementGetter:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa's dom-element-getter-helpers was not given an application name as a prop, so it can't make a unique dom element container for the react application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)))throw Error("single-spa's dom-element-getter-helpers was given an invalid domElementGetter for application or parcel '".concat(t.name,"'. Expected a function, received ").concat(pt(n)));return function(){var e=n(t);if(!(e instanceof HTMLElement))throw Error("single-spa's dom-element-getter-helpers: domElementGetter returned an invalid dom element for application or parcel '".concat(t.name,"'. Expected HTMLElement, received ").concat(pt(e)));return e}}var pa=null;try{pa=require("react").createContext()}catch(e){}var pr={React:null,ReactDOM:null,ReactDOMClient:null,rootComponent:null,loadRootComponent:null,errorBoundary:null,errorBoundaryClass:null,domElementGetter:null,parcelCanUpdate:!0,suppressComponentDidCatchWarning:!1,domElements:{},renderResults:{},updateResolves:{},unmountResolves:{}};function po(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function pi(e,t){return new Promise(function(n,a){e.suppressComponentDidCatchWarning||!function(e){if(!(e&&"string"==typeof e.version&&e.version.indexOf(".")>=0))return!1;var t=e.version.slice(0,e.version.indexOf("."));try{return Number(t)>=16}catch(e){return!1}}(e.React)||e.errorBoundary||e.errorBoundaryClass||(e.rootComponent.prototype?e.rootComponent.prototype.componentDidCatch||console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent should implement componentDidCatch to avoid accidentally unmounting the entire single-spa application.")):console.warn("single-spa-react: ".concat(t.name||t.appName||t.childAppName,"'s rootComponent does not implement an error boundary. If using a functional component, consider providing an opts.errorBoundary to singleSpaReact(opts).")));var r,o=pu(e,t,function(){n(this)}),i=pn(e,t)(),s=function(e){var t=e.reactDom,n=e.renderType,a=e.elementToRender,r=e.domElement,o=t[n];if("function"!=typeof o)throw Error('renderType "'.concat(n,'" did not return a function.'));switch(n){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(r);return i.render(a),i;case"hydrateRoot":return o(r,a);default:return o(a,r),null}}({elementToRender:o,domElement:i,reactDom:pc(e),renderType:"function"==typeof(r=e).renderType?r.renderType():r.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function ps(e,t){return new Promise(function(n){e.unmountResolves[t.name]=n;var a=e.renderResults[t.name];a&&a.unmount?a.unmount():pc(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function pl(e,t){return new Promise(function(n){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(n);var a=pu(e,t,null),r=e.renderResults[t.name];if(r&&r.render)r.render(a);else{var o=pn(e,t)();pc(e).render(a,o)}})}function pc(e){return e.ReactDOMClient||e.ReactDOM}function pu(e,t,n){var a=e.React.createElement(e.rootComponent,t),r=pa?e.React.createElement(pa.Provider,{value:t},a):a;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function n(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},n.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return n.prototype=Object.create(e.React.Component.prototype),n.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},n.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},n}(e,t),r=e.React.createElement(e.errorBoundaryClass,t,r)),r=e.React.createElement(e.SingleSpaRoot,u9(u9({},t),{},{mountFinished:n,updateFinished:function(){e.updateResolves[t.name]&&(e.updateResolves[t.name].forEach(function(e){return e()}),delete e.updateResolves[t.name])},unmountFinished:function(){e.unmountResolves[t.name]&&(e.unmountResolves[t.name](),delete e.unmountResolves[t.name])}}),r)}var pp=n(3826),pd=n(9324),pf=n(7956);let ph={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},pm=new Map;(0,pf.initCache)(pm);let pg={errorRetryCount:3,fetcher:n4,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof n6){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>pm};function py(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},ph,e),n={...pg,...t.swrConfig};return function(e){var a,r,o,i,s;return o=r=class extends(a=uH().Component){componentDidCatch(e,n){n&&n.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:n.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:n})}render(){if(this.state.caughtError)return uH().createElement("div",null,"An error has occurred. Please try reloading the page.");{let a=uH().createElement(uq.Suspense,{fallback:null},uH().createElement(pd.BE,{value:n},uH().createElement(uK.Provider,{value:this.state.config},t.disableTranslations?uH().createElement(e,this.props):uH().createElement(pp.I18nextProvider,{i18n:window.i18next,defaultNS:this.state.config.extension?`${this.state.config.moduleName}___${this.state.config.extension.extensionSlotName}___${this.state.config.extension.extensionId}`:this.state.config.moduleName},uH().createElement(e,this.props)))));return t.strictMode&&uH().StrictMode?uH().createElement(uH().StrictMode,null,a):a}}constructor(e){super(e),this.state={caughtError:null,caughtErrorInfo:null,config:{moduleName:t.moduleName,featureName:t.featureName,extension:e._extensionContext}}}},i="displayName",s=`OpenmrsReactComponent(${t.featureName})`,i in o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,r}}function pb(e,t){return function(e){if("object"!==pe(e))throw Error("single-spa-react requires a configuration object");var t,n=u9(u9({},pr),e);if(!n.React)throw Error("single-spa-react must be passed opts.React");if(!n.ReactDOM&&!n.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(n.renderType||(null!=(t=n.ReactDOMClient)&&t.createRoot?n.renderType="createRoot":n.renderType="render"),!n.rootComponent&&!n.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(n.errorBoundary&&"function"!=typeof n.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!pa&&n.React.createContext&&(pa=n.React.createContext()),n.SingleSpaRoot=function(e){function t(e){t.displayName="SingleSpaRoot(".concat(e.name,")")}return t.prototype=Object.create(e.React.Component.prototype),t.prototype.componentDidMount=function(){setTimeout(this.props.mountFinished)},t.prototype.componentWillUnmount=function(){setTimeout(this.props.unmountFinished)},t.prototype.render=function(){return setTimeout(this.props.updateFinished),this.props.children},t}(n);var a={bootstrap:po.bind(null,n),mount:pi.bind(null,n),unmount:ps.bind(null,n)};return n.parcelCanUpdate&&(a.update=pl.bind(null,n)),a}({React:uH(),ReactDOMClient:u8,rootComponent:py(t)(e)})}function p_(e,t){return()=>e().then(({default:e})=>pb(e,t))}function pv(e,t){return()=>Promise.resolve(pb(e,t))}let p$=p_,pA=L()(()=>({}));U("openmrs-app-context",pA);let pw={};function pk(e,t=e=>e){let n=pA.getState();return e in n?Object.freeze(Object.assign({},t?t(n[e]):n[e])):null}function px(e,t){pA.setState(n=>(e in n||(n[e]={}),n[e]=t(n[e]),Object.assign({},n)))}function pC(e){return null===e?null:Object.freeze(Object.assign({},e))}let pE=new Map;function pS(e,t){let n=(0,uq.useRef)(t??{}),a=(0,uq.useRef)(t=>px(e,t)),r=(0,uq.useRef)(Symbol());return(0,uq.useEffect)(()=>{let n=t??{},a=r.current;return null===pk(e)?!function(e,t=pw){pA.setState(n=>{if(e in n)throw Error(`Attempted to re-register namespace ${e} in the app context. Each namespace must be unregistered before the name can be registered again.`);return Object.assign({},n,{[e]:t===pw?{}:t})})}(e,n):(console.warn(`Namespace ${e} is already registered in the app context. This is likely a race condition during navigation, but may indicate two components are trying to own the same namespace. Updating the existing context.`),px(e,()=>n)),pE.set(e,a),()=>{pE.get(e)===a&&(pA.setState(t=>(e in t&&delete t[e],t)),pE.delete(e))}},[e]),(0,uq.useEffect)(()=>{let a=t??{};N(n.current,a)||(px(e,()=>a),n.current=a)},[t]),a.current}function pD({namespace:e,value:t}){return pS(e,t),null}let pM=({children:e,value:t,fallback:n})=>t?uH().createElement(uH().Fragment,null,e):n?uH().createElement(uH().Fragment,null,n):null;function pz(){let e=(0,uq.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,uq.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function pO(e,t=e=>e??{}){let[n,a]=(0,uq.useState)(()=>{if(pP(e))return;let n=pk(e);if(null!==n)return t?t(n):n});return(0,uq.useEffect)(()=>{if(pP(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,uq.useEffect)(()=>{var n;let r;return(n=e=>{if(null==e)return void a(void 0);let n=t?t(e):e;a(e=>N(e,n)?e:n)})(pC(r=pk(e))),pA.subscribe(t=>{let a=e in t?t[e]:null;a!==r&&(r=a,n(pC(a)))})},[e,t]),n}function pP(e){return"string"!=typeof e||0===e.trim().length}function pT(e){let[t,n]=(0,uq.useState)([]);return(0,uq.useEffect)(()=>un().subscribe(a=>{let r=a.slots[e]?.assignedExtensions.map(e=>e.id)??[];(0,ee.isEqual)(r,t)||n(r)}),[]),t}function pB(e,t){let{data:n,error:a,mutate:r,isLoading:o,isValidating:i}=(0,pd.Ay)(`${r1}?patient=${e}&includeEncounterless=${t}`,n4);return(0,uq.useMemo)(()=>({isLoading:o,data:n?.data.results??[],error:a,mutate:r,isValidating:i}),[n,a,o,i,r])}function pI(e){(0,uq.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let pN={},pj=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".