@openmrs/esm-cohort-builder-app 4.0.8-pre.1560 → 4.0.8-pre.1572
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/199.js +2 -2
- package/dist/199.js.map +1 -1
- package/dist/openmrs-esm-cohort-builder-app.js +2 -2
- package/dist/routes.json +1 -1
- package/package.json +1 -1
package/dist/199.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(globalThis.webpackChunk_openmrs_esm_cohort_builder_app=globalThis.webpackChunk_openmrs_esm_cohort_builder_app||[]).push([["199"],{7581(e){e.exports=function(e,t,r){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=r();return this.format(e)===t.format(e)}}},5238(e){e.exports=function(e,t,r){var n=t.prototype,o=function(e){var t=e.date,o=e.utc,a={};if(!(null===t||t instanceof Date||t instanceof Array||n.$utils().u(t)||"Object"!==t.constructor.name)){if(!Object.keys(t).length)return new Date;var i=o?r.utc():r();Object.keys(t).forEach(function(e){var r;a["date"===(r=n.$utils().p(e))?"day":r]=t[e]});var s=a.day||(a.year||a.month>=0?1:i.date()),l=a.year||i.year(),u=a.month>=0?a.month:a.year||a.day?0:i.month(),c=a.hour||0,d=a.minute||0,f=a.second||0,p=a.millisecond||0;return o?new Date(Date.UTC(l,u,s,c,d,f,p)):new Date(l,u,s,c,d,f,p)}return t},a=n.parse;n.parse=function(e){e.date=o.bind(this)(e),a.bind(this)(e)};var i=n.set,s=n.add,l=n.subtract,u=function(e,t,r,n){void 0===n&&(n=1);var o=Object.keys(t),a=this;return o.forEach(function(r){a=e.bind(a)(t[r]*n,r)}),a};n.set=function(e,t){return t=void 0===t?e:t,"Object"===e.constructor.name?u.bind(this)(function(e,t){return i.bind(this)(t,e)},t,e):i.bind(this)(e,t)},n.add=function(e,t){return"Object"===e.constructor.name?u.bind(this)(s,e,t):s.bind(this)(e,t)},n.subtract=function(e,t){return"Object"===e.constructor.name?u.bind(this)(s,e,t,-1):l.bind(this)(e,t)}}},3826(e){e.exports=function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(e){var t={date:e,utc:!0,args:arguments};return new o(t)},i.utc=function(t){var r=a(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),e):r},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var s=i.parse;i.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var l=i.init;i.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else l.call(this)};var u=i.utcOffset;i.utcOffset=function(n,o){var a=this.$utils().u;if(a(n))return this.$u?0:a(this.$offset)?u.call(this):this.$offset;if("string"==typeof n&&null===(n=function(e){void 0===e&&(e="");var n=e.match(t);if(!n)return null;var o=(""+n[0]).match(r)||["-",0,0],a=o[0],i=60*o[1]+ +o[2];return 0===i?0:"+"===a?i:-i}(n)))return this;var i=16>=Math.abs(n)?60*n:n,s=this;if(o)return s.$offset=i,s.$u=0===n,s;if(0!==n){var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(s=this.local().add(i+l,e)).$offset=i,s.$x.$localOffset=l}else s=this.utc();return s};var c=i.format;i.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,t)},i.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var d=i.toDate;i.toDate=function(e){return"s"===e&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var f=i.diff;i.diff=function(e,t,r){if(e&&this.$u===e.$u)return f.call(this,e,t,r);var n=this.local(),o=a(e).local();return f.call(n,o,t,r)}}}()},2849(e){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;function n(e){if(!e||"[object Object]"!==r.call(e)||e.nodeType||e.setInterval)return!1;var n,o=t.call(e,"constructor"),a=t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!a)return!1;for(n in e);return void 0===n||t.call(e,n)}e.exports=function e(){var t,r,o,a,i,s,l=arguments[0]||{},u=1,c=arguments.length,d=!1;for("boolean"==typeof l&&(d=l,l=arguments[1]||{},u=2),"object"!=typeof l&&"function"!=typeof l&&(l={});u<c;u++)if(null!=(t=arguments[u]))for(r in t)o=l[r],l!==(a=t[r])&&(d&&a&&(n(a)||(i=Array.isArray(a)))?(i?(i=!1,s=o&&Array.isArray(o)?o:[]):s=o&&n(o)?o:{},l[r]=e(d,s,a)):void 0!==a&&(l[r]=a));return l}},6767(e,t,r){!function(t){"use strict";var n=r(6974);function o(e){return function(t,r){return"object"==typeof t&&(r=t,t=null),null==t&&(t=new Date().toString()),r||(r={}),e.call(this,t,r)}}var a=e.exports={generate:o(function(e,t){return new n(e,t)})};t&&(t.fn.geopattern=o(function(e,r){return this.each(function(){var n=t(this).attr("data-title-sha");n&&(r=t.extend({hash:n},r));var o=a.generate(e,r);t(this).css("background-image",o.toDataUrl())})}))}("u">typeof jQuery?jQuery:null)},2467(e){"use strict";e.exports={hex2rgb:function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,r,n){return t+t+r+r+n+n});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},rgb2hex:function(e){return"#"+["r","g","b"].map(function(t){return("0"+e[t].toString(16)).slice(-2)}).join("")},rgb2hsl:function(e){var t,r,n=e.r,o=e.g,a=e.b,i=Math.max(n/=255,o/=255,a/=255),s=Math.min(n,o,a),l=(i+s)/2;if(i===s)t=r=0;else{var u=i-s;switch(r=l>.5?u/(2-i-s):u/(i+s),i){case n:t=(o-a)/u+6*(o<a);break;case o:t=(a-n)/u+2;break;case a:t=(n-o)/u+4}t/=6}return{h:t,s:r,l:l}},hsl2rgb:function(e){function t(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}var r,n,o,a=e.h,i=e.s,s=e.l;if(0===i)r=n=o=s;else{var l=s<.5?s*(1+i):s+i-s*i,u=2*s-l;r=t(u,l,a+1/3),n=t(u,l,a),o=t(u,l,a-1/3)}return{r:Math.round(255*r),g:Math.round(255*n),b:Math.round(255*o)}},rgb2rgbString:function(e){return"rgb("+[e.r,e.g,e.b].join(",")+")"}}},6974(e,t,r){"use strict";var n=r(2849),o=r(2467),a=r(6743),i=r(8502),s={baseColor:"#933c3c"},l=["octogons","overlappingCircles","plusSigns","xes","sineWaves","hexagons","overlappingRings","plaid","triangles","squares","concentricCircles","diamonds","tessellation","nestedSquares","mosaicSquares","chevrons"],u="#000";function c(e,t,r){return parseInt(e.substr(t,r||1),16)}function d(e,t,r,n,o){return(parseFloat(e)-t)*(o-n)/(r-t)+n}function f(e){return e%2==0?"#ddd":"#222"}function p(e){return d(e,0,15,.02,.15)}var m=e.exports=function(e,t){return this.opts=n({},s,t),this.hash=t.hash||a(e),this.svg=new i,this.generateBackground(),this.generatePattern(),this};function h(e){return[[e,0,e,3*e],[0,e,3*e,e]]}function g(e){return[0,0,e,e,0,e,0,0].join(",")}function y(e,t,r,n,o){var a=g(n),i=p(o[0]),s=f(o[0]),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i,fill:s};e.polyline(a,l).transform({translate:[t+n,r],scale:[-1,1]}),e.polyline(a,l).transform({translate:[t+n,r+2*n],scale:[1,-1]}),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i=p(o[1]),fill:s=f(o[1])},e.polyline(a,l).transform({translate:[t+n,r+2*n],scale:[-1,-1]}),e.polyline(a,l).transform({translate:[t+n,r],scale:[1,1]})}function v(e,t,r,n,o){var a=p(o),i=f(o),s=g(n),l={stroke:u,"stroke-opacity":.02,"fill-opacity":a,fill:i};e.polyline(s,l).transform({translate:[t,r+n],scale:[1,-1]}),e.polyline(s,l).transform({translate:[t+2*n,r+n],scale:[-1,-1]}),e.polyline(s,l).transform({translate:[t,r+n],scale:[1,1]}),e.polyline(s,l).transform({translate:[t+2*n,r+n],scale:[-1,1]})}m.prototype.toSvg=function(){return this.svg.toString()},m.prototype.toString=function(){return this.toSvg()},m.prototype.toBase64=function(){var e=this.toSvg();return"u">typeof window&&"function"==typeof window.btoa?window.btoa(e):new Buffer(e).toString("base64")},m.prototype.toDataUri=function(){return"data:image/svg+xml;base64,"+this.toBase64()},m.prototype.toDataUrl=function(){return'url("'+this.toDataUri()+'")'},m.prototype.generateBackground=function(){var e,t,r,n;this.opts.color?r=o.hex2rgb(this.opts.color):(t=d(c(this.hash,14,3),0,4095,0,359),n=c(this.hash,17),(e=o.rgb2hsl(o.hex2rgb(this.opts.baseColor))).h=(360*e.h-t+360)%360/360,n%2==0?e.s=Math.min(1,(100*e.s+n)/100):e.s=Math.max(0,(100*e.s-n)/100),r=o.hsl2rgb(e)),this.color=o.rgb2hex(r),this.svg.rect(0,0,"100%","100%",{fill:o.rgb2rgbString(r)})},m.prototype.generatePattern=function(){var e=this.opts.generator;if(e){if(0>l.indexOf(e))throw Error("The generator "+e+" does not exist.")}else e=l[c(this.hash,20)];return this["geo"+e.slice(0,1).toUpperCase()+e.slice(1)]()},m.prototype.geoHexagons=function(){var e,t,r,n,o,a,i,s,l,m=d(c(this.hash,0),0,15,8,60),h=m*Math.sqrt(3),g=2*m,y=(s=m/2,[0,l=Math.sin(60*Math.PI/180)*m,s,0,s+m,0,2*m,l,s+m,2*l,s,2*l,0,l].join(","));for(this.svg.setWidth(3*g+3*m),this.svg.setHeight(6*h),t=0,i=0;i<6;i++)for(a=0;a<6;a++)o=c(this.hash,t),e=a%2==0?i*h:i*h+h/2,r=p(o),n={fill:f(o),"fill-opacity":r,stroke:u,"stroke-opacity":.02},this.svg.polyline(y,n).transform({translate:[a*m*1.5-g/2,e-h/2]}),0===a&&this.svg.polyline(y,n).transform({translate:[6*m*1.5-g/2,e-h/2]}),0===i&&(e=a%2==0?6*h:6*h+h/2,this.svg.polyline(y,n).transform({translate:[a*m*1.5-g/2,e-h/2]})),0===a&&0===i&&this.svg.polyline(y,n).transform({translate:[6*m*1.5-g/2,5*h+h/2]}),t++},m.prototype.geoSineWaves=function(){var e,t,r,n,o,a,i,s=Math.floor(d(c(this.hash,0),0,15,100,400)),l=Math.floor(d(c(this.hash,1),0,15,30,100)),u=Math.floor(d(c(this.hash,2),0,15,3,30));for(this.svg.setWidth(s),this.svg.setHeight(36*u),t=0;t<36;t++)r=p(a=c(this.hash,t)),e=f(a),i=s/4*.7,o={fill:"none",stroke:e,opacity:r,"stroke-width":""+u+"px"},n="M0 "+l+" C "+i+" 0, "+(s/2-i)+" 0, "+s/2+" "+l+" S "+(s-i)+" "+2*l+", "+s+" "+l+" S "+(1.5*s-i)+" 0, "+1.5*s+", "+l,this.svg.path(n,o).transform({translate:[-s/4,u*t-1.5*l]}),this.svg.path(n,o).transform({translate:[-s/4,u*t-1.5*l+36*u]})},m.prototype.geoChevrons=function(){var e,t,r,n,o,a,i,s=d(c(this.hash,0),0,15,30,80),l=d(c(this.hash,0),0,15,30,80),m=(e=.66*l,[[0,0,s/2,l-e,s/2,l,0,e,0,0],[s/2,l-e,s,0,s,e,s/2,l,s/2,l-e]].map(function(e){return e.join(",")}));for(this.svg.setWidth(6*s),this.svg.setHeight(6*l*.66),t=0,i=0;i<6;i++)for(a=0;a<6;a++)r=p(o=c(this.hash,t)),n={stroke:u,"stroke-opacity":.02,fill:f(o),"fill-opacity":r,"stroke-width":1},this.svg.group(n).transform({translate:[a*s,i*l*.66-l/2]}).polyline(m).end(),0===i&&this.svg.group(n).transform({translate:[a*s,6*l*.66-l/2]}).polyline(m).end(),t+=1},m.prototype.geoPlusSigns=function(){var e,t,r,n,o,a,i,s,l=d(c(this.hash,0),0,15,10,25),m=3*l,g=h(l);for(this.svg.setWidth(12*l),this.svg.setHeight(12*l),r=0,s=0;s<6;s++)for(i=0;i<6;i++)n=p(a=c(this.hash,r)),t=f(a),e=+(s%2!=0),o={fill:t,stroke:u,"stroke-opacity":.02,"fill-opacity":n},this.svg.group(o).transform({translate:[i*m-i*l+e*l-l,s*m-s*l-m/2]}).rect(g).end(),0===i&&this.svg.group(o).transform({translate:[4*m-i*l+e*l-l,s*m-s*l-m/2]}).rect(g).end(),0===s&&this.svg.group(o).transform({translate:[i*m-i*l+e*l-l,4*m-s*l-m/2]}).rect(g).end(),0===i&&0===s&&this.svg.group(o).transform({translate:[4*m-i*l+e*l-l,4*m-s*l-m/2]}).rect(g).end(),r++},m.prototype.geoXes=function(){var e,t,r,n,o,a,i,s=d(c(this.hash,0),0,15,10,25),l=h(s),u=3*s*.943;for(this.svg.setWidth(3*u),this.svg.setHeight(3*u),t=0,i=0;i<6;i++)for(a=0;a<6;a++)r=p(o=c(this.hash,t)),e=a%2==0?i*u-.5*u:i*u-.5*u+u/4,n={fill:f(o),opacity:r},this.svg.group(n).transform({translate:[a*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===a&&this.svg.group(n).transform({translate:[6*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===i&&(e=a%2==0?6*u-u/2:6*u-u/2+u/4,this.svg.group(n).transform({translate:[a*u/2-u/2,e-6*u/2],rotate:[45,u/2,u/2]}).rect(l).end()),5===i&&this.svg.group(n).transform({translate:[a*u/2-u/2,e-11*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===a&&0===i&&this.svg.group(n).transform({translate:[6*u/2-u/2,e-6*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),t++},m.prototype.geoOverlappingCircles=function(){var e,t,r,n,o,a,i=d(c(this.hash,0),0,15,25,200)/2;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,a=0;a<6;a++)for(o=0;o<6;o++)t=p(n=c(this.hash,e)),r={fill:f(n),opacity:t},this.svg.circle(o*i,a*i,i,r),0===o&&this.svg.circle(6*i,a*i,i,r),0===a&&this.svg.circle(o*i,6*i,i,r),0===o&&0===a&&this.svg.circle(6*i,6*i,i,r),e++},m.prototype.geoOctogons=function(){var e,t,r,n,o,a,i,s=d(c(this.hash,0),0,15,10,60),l=[e=.33*s,0,s-e,0,s,e,s,s-e,s-e,s,e,s,0,s-e,0,e,e,0].join(",");for(this.svg.setWidth(6*s),this.svg.setHeight(6*s),r=0,i=0;i<6;i++)for(a=0;a<6;a++)n=p(o=c(this.hash,r)),t=f(o),this.svg.polyline(l,{fill:t,"fill-opacity":n,stroke:u,"stroke-opacity":.02}).transform({translate:[a*s,i*s]}),r+=1},m.prototype.geoSquares=function(){var e,t,r,n,o,a,i=d(c(this.hash,0),0,15,10,60);for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),t=0,a=0;a<6;a++)for(o=0;o<6;o++)r=p(n=c(this.hash,t)),e=f(n),this.svg.rect(o*i,a*i,i,i,{fill:e,"fill-opacity":r,stroke:u,"stroke-opacity":.02}),t+=1},m.prototype.geoConcentricCircles=function(){var e,t,r,n,o,a,i=d(c(this.hash,0),0,15,10,60),s=i/5;for(this.svg.setWidth((i+s)*6),this.svg.setHeight((i+s)*6),t=0,a=0;a<6;a++)for(o=0;o<6;o++)r=p(n=c(this.hash,t)),e=f(n),this.svg.circle(o*i+o*s+(i+s)/2,a*i+a*s+(i+s)/2,i/2,{fill:"none",stroke:e,opacity:r,"stroke-width":s+"px"}),r=p(n=c(this.hash,39-t)),e=f(n),this.svg.circle(o*i+o*s+(i+s)/2,a*i+a*s+(i+s)/2,i/4,{fill:e,"fill-opacity":r}),t+=1},m.prototype.geoOverlappingRings=function(){var e,t,r,n,o,a,i=d(c(this.hash,0),0,15,10,60),s=i/4;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,a=0;a<6;a++)for(o=0;o<6;o++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:f(n),opacity:t,"stroke-width":s+"px"},this.svg.circle(o*i,a*i,i-s/2,r),0===o&&this.svg.circle(6*i,a*i,i-s/2,r),0===a&&this.svg.circle(o*i,6*i,i-s/2,r),0===o&&0===a&&this.svg.circle(6*i,6*i,i-s/2,r),e+=1},m.prototype.geoTriangles=function(){var e,t,r,n,o,a,i,s,l=d(c(this.hash,0),0,15,15,80),m=l/2*Math.sqrt(3),h=[s=l/2,0,l,m,0,m,s,0].join(",");for(this.svg.setWidth(3*l),this.svg.setHeight(6*m),e=0,i=0;i<6;i++)for(a=0;a<6;a++)t=p(o=c(this.hash,e)),n={fill:f(o),"fill-opacity":t,stroke:u,"stroke-opacity":.02},r=i%2==0?180*(a%2==0):180*(a%2!=0),this.svg.polyline(h,n).transform({translate:[a*l*.5-l/2,m*i],rotate:[r,l/2,m/2]}),0===a&&this.svg.polyline(h,n).transform({translate:[6*l*.5-l/2,m*i],rotate:[r,l/2,m/2]}),e+=1},m.prototype.geoDiamonds=function(){var e,t,r,n,o,a,i,s=d(c(this.hash,0),0,15,10,50),l=d(c(this.hash,1),0,15,10,50),m=[s/2,0,s,l/2,s/2,l,0,l/2].join(",");for(this.svg.setWidth(6*s),this.svg.setHeight(3*l),t=0,i=0;i<6;i++)for(a=0;a<6;a++)r=p(o=c(this.hash,t)),n={fill:f(o),"fill-opacity":r,stroke:u,"stroke-opacity":.02},e=i%2==0?0:s/2,this.svg.polyline(m,n).transform({translate:[a*s-s/2+e,l/2*i-l/2]}),0===a&&this.svg.polyline(m,n).transform({translate:[6*s-s/2+e,l/2*i-l/2]}),0===i&&this.svg.polyline(m,n).transform({translate:[a*s-s/2+e,l/2*6-l/2]}),0===a&&0===i&&this.svg.polyline(m,n).transform({translate:[6*s-s/2+e,l/2*6-l/2]}),t+=1},m.prototype.geoNestedSquares=function(){var e,t,r,n,o,a,i=d(c(this.hash,0),0,15,4,12),s=7*i;for(this.svg.setWidth((s+i)*6+6*i),this.svg.setHeight((s+i)*6+6*i),e=0,a=0;a<6;a++)for(o=0;o<6;o++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:f(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(o*s+o*i*2+i/2,a*s+a*i*2+i/2,s,s,r),t=p(n=c(this.hash,39-e)),r={fill:"none",stroke:f(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(o*s+o*i*2+i/2+2*i,a*s+a*i*2+i/2+2*i,3*i,3*i,r),e+=1},m.prototype.geoMosaicSquares=function(){var e,t,r,n=d(c(this.hash,0),0,15,15,50);for(this.svg.setWidth(8*n),this.svg.setHeight(8*n),e=0,r=0;r<4;r++)for(t=0;t<4;t++)t%2==0?r%2==0?v(this.svg,t*n*2,r*n*2,n,c(this.hash,e)):y(this.svg,t*n*2,r*n*2,n,[c(this.hash,e),c(this.hash,e+1)]):r%2==0?y(this.svg,t*n*2,r*n*2,n,[c(this.hash,e),c(this.hash,e+1)]):v(this.svg,t*n*2,r*n*2,n,c(this.hash,e)),e+=1},m.prototype.geoPlaid=function(){var e,t,r,n,o,a,i=0,s=0;for(t=0;t<36;)i+=c(this.hash,t)+5,r=p(a=c(this.hash,t+1)),e=f(a),n=a+5,this.svg.rect(0,i,"100%",n,{opacity:r,fill:e}),i+=n,t+=2;for(t=0;t<36;)s+=c(this.hash,t)+5,r=p(a=c(this.hash,t+1)),e=f(a),o=a+5,this.svg.rect(s,0,o,"100%",{opacity:r,fill:e}),s+=o,t+=2;this.svg.setWidth(s),this.svg.setHeight(i)},m.prototype.geoTessellation=function(){var e,t,r,n,o=d(c(this.hash,0),0,15,5,40),a=o*Math.sqrt(3),i=2*o,s=o/2*Math.sqrt(3),l=[0,0,s,o/2,0,o,0,0].join(","),m=3*o+2*s,h=2*a+2*o;for(this.svg.setWidth(m),this.svg.setHeight(h),e=0;e<20;e++)switch(t=p(n=c(this.hash,e)),r={stroke:u,"stroke-opacity":.02,fill:f(n),"fill-opacity":t,"stroke-width":1},e){case 0:this.svg.rect(-o/2,-o/2,o,o,r),this.svg.rect(m-o/2,-o/2,o,o,r),this.svg.rect(-o/2,h-o/2,o,o,r),this.svg.rect(m-o/2,h-o/2,o,o,r);break;case 1:this.svg.rect(i/2+s,a/2,o,o,r);break;case 2:this.svg.rect(-o/2,h/2-o/2,o,o,r),this.svg.rect(m-o/2,h/2-o/2,o,o,r);break;case 3:this.svg.rect(i/2+s,1.5*a+o,o,o,r);break;case 4:this.svg.polyline(l,r).transform({translate:[o/2,-o/2],rotate:[0,o/2,s/2]}),this.svg.polyline(l,r).transform({translate:[o/2,h- -o/2],rotate:[0,o/2,s/2],scale:[1,-1]});break;case 5:this.svg.polyline(l,r).transform({translate:[m-o/2,-o/2],rotate:[0,o/2,s/2],scale:[-1,1]}),this.svg.polyline(l,r).transform({translate:[m-o/2,h+o/2],rotate:[0,o/2,s/2],scale:[-1,-1]});break;case 6:this.svg.polyline(l,r).transform({translate:[m/2+o/2,a/2]});break;case 7:this.svg.polyline(l,r).transform({translate:[m-m/2-o/2,a/2],scale:[-1,1]});break;case 8:this.svg.polyline(l,r).transform({translate:[m/2+o/2,h-a/2],scale:[1,-1]});break;case 9:this.svg.polyline(l,r).transform({translate:[m-m/2-o/2,h-a/2],scale:[-1,-1]});break;case 10:this.svg.polyline(l,r).transform({translate:[o/2,h/2-o/2]});break;case 11:this.svg.polyline(l,r).transform({translate:[m-o/2,h/2-o/2],scale:[-1,1]});break;case 12:this.svg.rect(0,0,o,o,r).transform({translate:[o/2,o/2],rotate:[-30,0,0]});break;case 13:this.svg.rect(0,0,o,o,r).transform({scale:[-1,1],translate:[-m+o/2,o/2],rotate:[-30,0,0]});break;case 14:this.svg.rect(0,0,o,o,r).transform({translate:[o/2,h/2-o/2-o],rotate:[30,0,o]});break;case 15:this.svg.rect(0,0,o,o,r).transform({scale:[-1,1],translate:[-m+o/2,h/2-o/2-o],rotate:[30,0,o]});break;case 16:this.svg.rect(0,0,o,o,r).transform({scale:[1,-1],translate:[o/2,-h+h/2-o/2-o],rotate:[30,0,o]});break;case 17:this.svg.rect(0,0,o,o,r).transform({scale:[-1,-1],translate:[-m+o/2,-h+h/2-o/2-o],rotate:[30,0,o]});break;case 18:this.svg.rect(0,0,o,o,r).transform({scale:[1,-1],translate:[o/2,-h+o/2],rotate:[-30,0,0]});break;case 19:this.svg.rect(0,0,o,o,r).transform({scale:[-1,-1],translate:[-m+o/2,-h+o/2],rotate:[-30,0,0]})}}},6743(e){"use strict";function t(){var e=0x67452301,t=0xefcdab89,r=0x98badcfe,n=0x10325476,o=0xc3d2e1f0,a=new Uint32Array(80),i=0,s=24,l=0;function u(){for(var s,l,u=16;u<80;u++){var c=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=c<<1|c>>>31}var d=e,f=t,p=r,m=n,h=o;for(u=0;u<80;u++){u<20?(s=m^f&(p^m),l=0x5a827999):u<40?(s=f^p^m,l=0x6ed9eba1):u<60?(s=f&p|m&(f|p),l=0x8f1bbcdc):(s=f^p^m,l=0xca62c1d6);var g=(d<<5|d>>>27)+s+h+l+(0|a[u]);h=m,m=p,p=f<<30|f>>>2,f=d,d=g}for(u=0,e=e+d|0,t=t+f|0,r=r+p|0,n=n+m|0,o=o+h|0,i=0;u<16;u++)a[u]=0}function c(e){a[i]|=(255&e)<<s,s?s-=8:(i++,s=24),16===i&&u()}function d(e){for(var t="",r=28;r>=0;r-=4)t+=(e>>r&15).toString(16);return t}return{update:function(e){if("string"==typeof e){var t=e.length;l+=8*t;for(var r=0;r<t;r++)c(e.charCodeAt(r));return}var n=e.length;l+=8*n;for(var o=0;o<n;o++)c(e[o])},digest:function(){c(128),(i>14||14===i&&s<24)&&u(),i=14,s=24,c(0),c(0),c(l>0xffffffffff?l/0x10000000000:0),c(l>0xffffffff?l/0x100000000:0);for(var a=24;a>=0;a-=8)c(l>>a);return d(e)+d(t)+d(r)+d(n)+d(o)}}}e.exports=function(e){if(void 0===e)return t();var r=t();return r.update(e),r.digest()}},8502(e,t,r){"use strict";var n=r(2849),o=r(6541);function a(){return this.width=100,this.height=100,this.svg=o("svg"),this.context=[],this.setAttributes(this.svg,{xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height}),this}e.exports=a,a.prototype.currentContext=function(){return this.context[this.context.length-1]||this.svg},a.prototype.end=function(){return this.context.pop(),this},a.prototype.currentNode=function(){var e=this.currentContext();return e.lastChild||e},a.prototype.transform=function(e){return this.currentNode().setAttribute("transform",Object.keys(e).map(function(t){return t+"("+e[t].join(",")+")"}).join(" ")),this},a.prototype.setAttributes=function(e,t){Object.keys(t).forEach(function(r){e.setAttribute(r,t[r])})},a.prototype.setWidth=function(e){this.svg.setAttribute("width",Math.floor(e))},a.prototype.setHeight=function(e){this.svg.setAttribute("height",Math.floor(e))},a.prototype.toString=function(){return this.svg.toString()},a.prototype.rect=function(e,t,r,a,i){var s=this;if(Array.isArray(e))return e.forEach(function(e){s.rect.apply(s,e.concat(i))}),this;var l=o("rect");return this.currentContext().appendChild(l),this.setAttributes(l,n({x:e,y:t,width:r,height:a},i)),this},a.prototype.circle=function(e,t,r,a){var i=o("circle");return this.currentContext().appendChild(i),this.setAttributes(i,n({cx:e,cy:t,r:r},a)),this},a.prototype.path=function(e,t){var r=o("path");return this.currentContext().appendChild(r),this.setAttributes(r,n({d:e},t)),this},a.prototype.polyline=function(e,t){var r=this;if(Array.isArray(e))return e.forEach(function(e){r.polyline(e,t)}),this;var a=o("polyline");return this.currentContext().appendChild(a),this.setAttributes(a,n({points:e},t)),this},a.prototype.group=function(e){var t=o("g");return this.currentContext().appendChild(t),this.context.push(t),this.setAttributes(t,n({},e)),this}},6541(e){"use strict";var t=e.exports=function(e){return this instanceof t?(this.tagName=e,this.attributes=Object.create(null),this.children=[],this.lastChild=null,this):new t(e)};t.prototype.appendChild=function(e){return this.children.push(e),this.lastChild=e,this},t.prototype.setAttribute=function(e,t){return this.attributes[e]=t,this},t.prototype.toString=function(){var e=this;return["<",e.tagName,Object.keys(e.attributes).map(function(t){return[" ",t,'="',e.attributes[t],'"'].join("")}).join(""),">",e.children.map(function(e){return e.toString()}).join(""),"</",e.tagName,">"].join("")}},8067(e,t){"use strict";t.pathToRegexp=function(e,t={}){let{delimiter:u="/",end:c=!0,sensitive:d=!1,trailing:f=!0}=t,p=[],m=[];for(let c of function e(t,r){if(Array.isArray(t))for(let n of t)e(n,r);else r.push(t);return r}(e,[])){let e="object"==typeof c?c:function(e,t={}){let{encodePath:i=r}=t,u=[...e],c=[],d=0,f=0;function p(){let t="";if(n.test(u[d]))do t+=u[d++];while(o.test(u[d]));else if('"'===u[d]){let r=d;for(;d++<u.length;){if('"'===u[d]){d++,r=0;break}"\\"===u[d]&&d++,t+=u[d]}if(r)throw new l(`Unterminated quote at index ${r}`,e)}if(!t)throw new l(`Missing parameter name at index ${d}`,e);return t}for(;d<u.length;){let e=u[d],t=a[e];t?c.push({type:t,index:d++,value:e}):"\\"===e?c.push({type:"escape",index:d++,value:u[d++]}):":"===e?c.push({type:"param",index:d++,value:p()}):"*"===e?c.push({type:"wildcard",index:d++,value:p()}):c.push({type:"char",index:d++,value:e})}return c.push({type:"end",index:d,value:""}),new s(function t(r){let n=[];for(;;){let o=c[f++];if(o.type===r)break;if("char"===o.type||"escape"===o.type){let e=o.value,t=c[f];for(;"char"===t.type||"escape"===t.type;)e+=t.value,t=c[++f];n.push({type:"text",value:i(e)});continue}if("param"===o.type||"wildcard"===o.type){n.push({type:o.type,name:o.value});continue}if("{"===o.type){n.push({type:"group",tokens:t("}")});continue}throw new l(`Unexpected ${o.type} at index ${o.index}, expected ${r}`,e)}return n}("end"),e)}(c,t);for(let t of function* e(t,r,n){if(r===t.length)return yield n;let o=t[r];if("group"===o.type)for(let a of e(o.tokens,0,n.slice()))yield*e(t,r+1,a);else n.push(o);yield*e(t,r+1,n)}(e.tokens,0,[]))m.push(function(e,t,r,n){let o="",a="",s=!0;for(let d of e){if("text"===d.type){o+=i(d.value),a+=d.value,s||(s=d.value.includes(t));continue}if("param"===d.type||"wildcard"===d.type){var u,c;if(!s&&!a)throw new l(`Missing text before "${d.name}" ${d.type}`,n);"param"===d.type?o+=`(${u=t,(c=s?"":a).length<2?u.length<2?`[^${i(u+c)}]`:`(?:(?!${i(u)})[^${i(c)}])`:u.length<2?`(?:(?!${i(c)})[^${i(u)}])`:`(?:(?!${i(c)}|${i(u)})[\\s\\S])`}+)`:o+="([\\s\\S]+)",r.push(d),a="",s=!1;continue}}return o}(t,u,p,e.originalPath))}let h=`^(?:${m.join("|")})`;return f&&(h+=`(?:${i(u)}$)?`),{regexp:new RegExp(h+=c?"$":`(?=${i(u)}|$)`,d?"":"i"),keys:p}};let r=e=>e,n=/^[$_\p{ID_Start}]$/u,o=/^[$\u200c\u200d\p{ID_Continue}]$/u,a={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function i(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class s{constructor(e,t){this.tokens=e,this.originalPath=t}}class l extends TypeError{constructor(e,t){let r=e;t&&(r+=`: ${t}`),super(r+="; visit https://git.new/pathToRegexpError for info"),this.originalPath=t}}},5338(e,t,r){"use strict";var n=r(1779);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},3904(e,t,r){"use strict";let n=Symbol("SemVer ANY");class o{static get ANY(){return n}constructor(e,t){if(t=a(t),e instanceof o)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof o))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=a(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=o;let a=r(968),{safeRe:i,t:s}=r(9718),l=r(2111),u=r(7272),c=r(3908),d=r(8311)},8311(e,t,r){"use strict";let n=/\s+/g;class o{constructor(e,t){if(t=i(t),e instanceof o)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new o(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(n," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!y(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&h)|(this.options.loose&&g))+":"+e,r=a.get(t);if(r)return r;let n=this.options.loose,o=n?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];l("hyphen replace",e=e.replace(o,R(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[d.COMPARATORTRIM],f)),l("tilde trim",e=e.replace(c[d.TILDETRIM],p)),l("caret trim",e=e.replace(c[d.CARETTRIM],m));let i=e.split(" ").map(e=>w(e,this.options)).join(" ").split(/\s+/).map(e=>O(e,this.options));n&&(i=i.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",i);let u=new Map;for(let e of i.map(e=>new s(e,this.options))){if(y(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let v=[...u.values()];return a.set(t,v),v}intersects(e,t){if(!(e instanceof o))throw TypeError("a Range is required");return this.set.some(r=>b(r,t)&&e.set.some(e=>b(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(T(this.set[t],e,this.options))return!0;return!1}}e.exports=o;let a=new(r(8794)),i=r(968),s=r(3904),l=r(7272),u=r(3908),{safeRe:c,t:d,comparatorTrimReplace:f,tildeTrimReplace:p,caretTrimReplace:m}=r(9718),{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:g}=r(6874),y=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,b=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();for(;r&&n.length;)r=n.every(e=>o.intersects(e,t)),o=n.pop();return r},w=(e,t)=>(l("comp",e=e.replace(c[d.BUILD],""),t),l("caret",e=_(e,t)),l("tildes",e=x(e,t)),l("xrange",e=C(e,t)),l("stars",e=P(e,t)),e),E=e=>!e||"x"===e.toLowerCase()||"*"===e,x=(e,t)=>e.trim().split(/\s+/).map(e=>D(e,t)).join(" "),D=(e,t)=>{let r=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(r,(t,r,n,o,a)=>{let i;return l("tilde",e,t,r,n,o,a),E(r)?i="":E(n)?i=`>=${r}.0.0 <${+r+1}.0.0-0`:E(o)?i=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(l("replaceTilde pr",a),i=`>=${r}.${n}.${o}-${a} <${r}.${+n+1}.0-0`):i=`>=${r}.${n}.${o} <${r}.${+n+1}.0-0`,l("tilde return",i),i})},_=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(" "),S=(e,t)=>{l("caret",e,t);let r=t.loose?c[d.CARETLOOSE]:c[d.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,o,a,i)=>{let s;return l("caret",e,t,r,o,a,i),E(r)?s="":E(o)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:E(a)?s="0"===r?`>=${r}.${o}.0${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.0${n} <${+r+1}.0.0-0`:i?(l("replaceCaret pr",i),s="0"===r?"0"===o?`>=${r}.${o}.${a}-${i} <${r}.${o}.${+a+1}-0`:`>=${r}.${o}.${a}-${i} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${a}-${i} <${+r+1}.0.0-0`):(l("no pr"),s="0"===r?"0"===o?`>=${r}.${o}.${a}${n} <${r}.${o}.${+a+1}-0`:`>=${r}.${o}.${a}${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${a} <${+r+1}.0.0-0`),l("caret return",s),s})},C=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>k(e,t)).join(" ")),k=(e,t)=>{e=e.trim();let r=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(r,(r,n,o,a,i,s)=>{l("xRange",e,r,n,o,a,i,s);let u=E(o),c=u||E(a),d=c||E(i);return"="===n&&d&&(n=""),s=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(c&&(a=0),i=0,">"===n?(n=">=",c?(o=+o+1,a=0):a=+a+1,i=0):"<="===n&&(n="<",c?o=+o+1:a=+a+1),"<"===n&&(s="-0"),r=`${n+o}.${a}.${i}${s}`):c?r=`>=${o}.0.0${s} <${+o+1}.0.0-0`:d&&(r=`>=${o}.${a}.0${s} <${o}.${+a+1}.0-0`),l("xRange return",r),r})},P=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),O=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),R=e=>(t,r,n,o,a,i,s,l,u,c,d,f)=>(r=E(n)?"":E(o)?`>=${n}.0.0${e?"-0":""}`:E(a)?`>=${n}.${o}.0${e?"-0":""}`:i?`>=${r}`:`>=${r}${e?"-0":""}`,l=E(u)?"":E(c)?`<${+u+1}.0.0-0`:E(d)?`<${u}.${+c+1}.0-0`:f?`<=${u}.${c}.${d}-${f}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),T=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==s.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}},3908(e,t,r){"use strict";let n=r(7272),{MAX_LENGTH:o,MAX_SAFE_INTEGER:a}=r(6874),{safeRe:i,t:s}=r(9718),l=r(968),{compareIdentifiers:u}=r(1123);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>o)throw TypeError(`version is longer than ${o} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?i[s.LOOSE]:i[s.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>a||this.major<0)throw TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<a)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],o=e.prerelease[t];if(n("prerelease compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return -1;else if(r===o)continue;else return u(r,o)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],o=e.build[t];if(n("build compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return -1;else if(r===o)continue;else return u(r,o)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?i[s.PRERELEASELOOSE]:i[s.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},2111(e,t,r){"use strict";let n=r(4641),o=r(3999),a=r(5580),i=r(4089),s=r(7059),l=r(5200);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return o(e,r,u);case">":return a(e,r,u);case">=":return i(e,r,u);case"<":return s(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},560(e,t,r){"use strict";let n=r(3908);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},4641(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0===n(e,t,r)},5580(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>n(e,t,r)>0},4089(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>n(e,t,r)>=0},7059(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0>n(e,t,r)},5200(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0>=n(e,t,r)},3999(e,t,r){"use strict";let n=r(560);e.exports=(e,t,r)=>0!==n(e,t,r)},7638(e,t,r){"use strict";let n=r(8311);e.exports=(e,t,r)=>{try{t=new n(t,r)}catch(e){return!1}return t.test(e)}},6874(e){"use strict";e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},7272(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},1123(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let n=t.test(e),o=t.test(r);return n&&o&&(e*=1,r*=1),e===r?0:n&&!o?-1:o&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},8794(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},968(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},9718(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:a}=r(6874),i=r(7272),s=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},f=0,p="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",a],[p,o]],h=(e,t,r)=>{let n=(e=>{for(let[t,r]of m)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=f++;i(e,o,t),d[e]=o,u[o]=t,c[o]=n,s[o]=new RegExp(t,r?"g":void 0),l[o]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),h("FULL",`^${u[d.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),h("LOOSE",`^${u[d.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),h("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),h("COERCERTL",u[d.COERCE],!0),h("COERCERTLFULL",u[d.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},6369(e,t,r){"use strict";function n(e){if(Array.isArray(e))return e}r.d(t,{A:()=>n})},3029(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}r.d(t,{A:()=>n})},2901(e,t,r){"use strict";r.d(t,{A:()=>a});var n=r(6192);function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(0,n.A)(o.key),o)}}function a(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}},4467(e,t,r){"use strict";r.d(t,{A:()=>o});var n=r(6192);function o(e,t,r){return(t=(0,n.A)(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},6562(e,t,r){"use strict";function n(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}r.d(t,{A:()=>n})},6192(e,t,r){"use strict";r.d(t,{A:()=>o});var n=r(2284);function o(e){var t=function(e,t){if("object"!=(0,n.A)(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=(0,n.A)(o))return o;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==(0,n.A)(t)?t:t+""}},2284(e,t,r){"use strict";function n(e){return(n="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)}r.d(t,{A:()=>n})},3612(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){if(e){if("string"==typeof e)return n(e,t);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}r.d(t,{A:()=>o})},2602(e,t,r){"use strict";let n,o,a,i,s,l,u,c,d,f,p;r.r(t),r.d(t,{GenderUnknownIcon:()=>pp,evaluateAsNumber:()=>lF,getImportMapOverrideMap:()=>sI,StockManagementPictogram:()=>_D,ChemistryIcon:()=>f6,BabyIcon:()=>fZ,DashboardExtension:()=>mp,openmrsComponentDecorator:()=>cZ,tryRegisterExtension:()=>fn,pictogramIds:()=>D2,ActivityIcon:()=>fV,compile:()=>lW,removeRouteMapOverride:()=>lr,TableBatchActions:()=>fw,getAsyncLifecycle:()=>cq,subscribeOpenmrsEvent:()=>lm,PasswordIcon:()=>pM,Assessment2Pictogram:()=>D5,CloseIcon:()=>pe,setupRouteMapOverrides:()=>la,useFeatureFlag:()=>dw,reset:()=>uq,ConceptDictionaryPictogram:()=>_e,LabOrderIcon:()=>pD,VisitMode:()=>lw,useLocations:()=>dU,getLifecycle:()=>cY,formatDatetime:()=>E2,getVisitsForPatient:()=>lP,formatPartialDate:()=>EX,CustomOverflowMenu:()=>fk,LocationIcon:()=>pS,GroupIcon:()=>ph,createUseStore:()=>cv,VisitStatus:()=>lE,getSessionLocation:()=>sd,getCurrentImportMap:()=>sZ,usePatient:()=>dZ,useRenderableExtensions:()=>dq,getOpenedWindowIndexByWorkspace:()=>u5,setLeftNav:()=>uX,clearHistory:()=>i0,clearConfigErrors:()=>on,formatTime:()=>E1,isDevEnabled:()=>sw,CohortsPictogram:()=>D7,closeWorkspaceGroup2:()=>_q,getCurrentRouteMap:()=>s9,ConfigurableLink:()=>cd,sessionStore:()=>se,setSessionLocale:()=>sp,subscribeSnackbarShown:()=>S,getLoggedInUser:()=>sc,GenderMaleIcon:()=>pd,getExtensionSlotConfigFromStore:()=>nv,evaluateAsNumberAsync:()=>lB,getImportMapDefaultMap:()=>sA,unregisterExtensionRendering:()=>ug,implementerToolsConfigStore:()=>nT,Type:()=>no,InPatientPictogram:()=>_u,cleanupObsoleteFeatureFlags:()=>ut,getAttachmentsUrl:()=>lu,showSnackbar:()=>_L,PatientBannerActionsMenu:()=>DY,PatientSearchPictogram:()=>_h,DocumentAttachmentIcon:()=>po,Snackbar:()=>_j,CardiologyPictogram:()=>D8,ImageMedicalIcon:()=>pv,ActionableNotificationComponent:()=>Dm,DiagnosisTags:()=>xX,openChildWorkspaceInWindow:()=>_3,iconIds:()=>fU,PatientsPictogram:()=>_g,interpolateUrl:()=>iK,setupHistory:()=>iJ,subscribeToastShown:()=>_,detachAll:()=>uz,convertToLocaleCalendar:()=>E4,DocumentIcon:()=>pn,configInternalStore:()=>nf,ActionMenuButton2:()=>Sk,setupDynamicOfflineDataHandler:()=>SJ,makeUrl:()=>i9,oneOf:()=>oc,selectPreferredName:()=>DM,MobileCheckIcon:()=>pT,createErrorHandler:()=>P,parseDate:()=>EK,getAttachmentByUuid:()=>ls,LeftNavMenu:()=>x6,getExtensionRegistration:()=>uU,ShoppingCartAddItemIcon:()=>mc,ReferralOrderIcon:()=>pW,ReportIcon:()=>pz,dispatchToastShown:()=>E,getImportMapNextPageMap:()=>s$,registerExtension:()=>uV,setupOfflineSync:()=>Sq,DownloadIcon:()=>pa,useConnectivity:()=>S2,provide:()=>nG,ShoppingCartArrowDownIcon:()=>pX,featureFlagsStore:()=>l7,jsep:()=>lR,GeriatricsPictogram:()=>_s,SearchIcon:()=>pZ,reportError:()=>k,slugify:()=>sz,isOmrsDateToday:()=>EW,getExtensionStore:()=>uy,BloodBankPictogram:()=>D9,TriagePictogram:()=>_C,Workspace2:()=>So,refetchCurrentUser:()=>ss,CheckmarkOutlineIcon:()=>f3,registerExtensionSlot:()=>uY,AllergiesIcon:()=>mi,ArrowDownIcon:()=>fH,useOpenmrsInfinite:()=>dO,getExtensionConfigFromExtensionSlotStore:()=>nE,OpenmrsDatePicker:()=>xA,getExtensionConfigFromStore:()=>nw,getDynamicOfflineDataEntries:()=>SX,getLocaleDisplayName:()=>El,messageOmrsServiceWorker:()=>S0,navigate:()=>iZ,launchWorkspace2:()=>_J,getGroupByWindowName:()=>u6,CustomOverflowMenuItem:()=>fP,isUrl:()=>ou,CaretDownIcon:()=>fJ,ArrowLeftIcon:()=>fz,FacilityPictogram:()=>_i,ViewOffIcon:()=>mn,updateInternalExtensionStore:()=>uc,dispatchActionableNotificationShown:()=>b,resetRouteMapOverrides:()=>ln,formatDurationBetween:()=>xt,defaultVisitCustomRepresentation:()=>lx,getBreadcrumbsFor:()=>ob,useOpenmrsPagination:()=>dx,Pagination:()=>DN,CheckmarkFilledIcon:()=>f4,clearCurrentUser:()=>sl,showModal:()=>Du,ChevronUpIcon:()=>f7,saveVisit:()=>lC,useAttachments:()=>dn,Pictogram:()=>_T,useExtensionSlot:()=>c_,ChevronDownIcon:()=>f5,OpenmrsDateRangePicker:()=>x$,deleteAttachmentPermanently:()=>ld,getVisitTypes:()=>lb,OverflowMenuHorizontalIcon:()=>p$,EventScheduleIcon:()=>pl,getSessionStore:()=>sa,ProcedureOrderIcon:()=>pU,preloadImport:()=>sG,registerWorkspaceWindows2:()=>u8,useOnVisible:()=>dW,setSessionLocation:()=>sf,userHasAccess:()=>su,ChartAverageIcon:()=>f1,getFeatureFlag:()=>ur,UserAvatarIcon:()=>p7,renderExtension:()=>cs,useFhirInfinite:()=>dA,toVisitTypeObject:()=>ly,useSession:()=>dJ,EmergencyDepartmentPictogram:()=>_a,Notification:()=>Df,dispatchSnackbarShown:()=>w,formatDate:()=>EQ,workspace2StoreActions:()=>_9,SwitcherIcon:()=>pq,esmStyleGuideSchema:()=>fy,getImportMapDisabledOverrides:()=>sM,useAssignedExtensionIds:()=>dt,CaretRightIcon:()=>fQ,evaluateAsType:()=>lU,PageHeader:()=>DR,TranslateIcon:()=>p6,setUserProperties:()=>sm,MovementIcon:()=>pA,renderInlineNotifications:()=>DE,subscribePrecacheStaticDependencies:()=>S1,PaymentsDeskPictogram:()=>_y,usePrimaryIdentifierCode:()=>dY,useLayoutType:()=>dI,getCurrentUser:()=>so,closeWorkspaceInWindow:()=>_4,XrayPictogram:()=>_k,CaretUpIcon:()=>f0,renderActionableNotifications:()=>DD,OpenmrsAppContext:()=>c5,setupModals:()=>Dl,getDefaultsFromConfigSchema:()=>function e(t){let r={};for(let n of Object.keys(t))if(SH(t[n])&&t[n].hasOwnProperty("_default"))r[n]=t[n]._default;else{if(n.startsWith("_"))continue;SH(t[n])?r[n]=e(t[n]):r[n]=t[n]}return r},subscribeTo:()=>H,recordConfigDerivationError:()=>nO,useAbortController:()=>c8,Extension:()=>cf,getFhirServerPaginationHandlers:()=>dC,useConnectedExtensions:()=>dc,registerApp:()=>fa,HospitalBedIcon:()=>py,useExtensionInternalStore:()=>dy,configExtensionStore:()=>nm,getSynchronizationItems:()=>SQ,getExtensionSlotsConfigStore:()=>ng,registerExtensionRendering:()=>uh,RenderIfValueIsTruthy:()=>c9,registerFeatureFlag:()=>ue,useFhirFetchAll:()=>dj,restBaseUrl:()=>i3,CalendarHeatMapIcon:()=>fY,isImportMapOverrideDisabled:()=>sL,resetConfigSystem:()=>oo,getExtensionInternalStore:()=>ul,registerGlobalStore:()=>V,evaluateAsBoolean:()=>lM,PatientBannerPatientInfo:()=>DG,addRouteMapOverride:()=>lt,getDefaultCalendar:()=>Eq,SettingsIcon:()=>pY,DrugOrderIcon:()=>pi,ProgramsIcon:()=>pV,useAssignedExtensions:()=>cD,CloseFilledIcon:()=>pt,canAccessStorage:()=>SW,registerDefaultCalendar:()=>EY,TreeViewAltIcon:()=>p9,OverflowMenuVerticalIcon:()=>pI,clearConfigDerivationError:()=>nR,getConfigStore:()=>nh,InformationSquareIcon:()=>pE,EmptyCard:()=>x2,ChevronLeftIcon:()=>f9,RadiologyIcon:()=>mu,useCandidateExtensions:()=>dr,renderToasts:()=>_W,isDesktop:()=>dM,integrateBreakpoints:()=>fc,RegistrationPictogram:()=>_w,CardHeader:()=>fm,getExtensionRegistrationFrom:()=>uB,InformationIcon:()=>pb,SystemAdministrationPictogram:()=>__,TrashCanIcon:()=>p5,useShallowStableValue:()=>cp,PatientDocumentsPictogram:()=>_m,useOpenmrsSWR:()=>dH,Assessment1Pictogram:()=>D6,finishRegisteringAllApps:()=>fi,importDynamic:()=>sK,useFhirPagination:()=>dS,useVisitContextStore:()=>d6,ArrowUpIcon:()=>fG,showActionableNotification:()=>D_,useForceUpdate:()=>dE,useVisit:()=>d5,PatientBannerPatientIdentifiers:()=>DW,TransferPictogram:()=>_S,usePagination:()=>dz,Breakpoint:()=>fs,PatientBannerToggleContactDetailsButton:()=>SP,CloseOutlineIcon:()=>pr,ObstetricsPictogram:()=>_p,parseDateInput:()=>E6,ReportsPictogram:()=>_E,getConfig:()=>nY,attach:()=>uW,getLocale:()=>Eu,isUrlWithTemplateParameters:()=>ol,useEmrConfiguration:()=>dh,useLeftNav:()=>dL,ToolsIcon:()=>p3,ErrorState:()=>x4,detach:()=>uH,setCurrentVisit:()=>lS,ConditionsIcon:()=>ml,SaveIcon:()=>pG,useConfig:()=>du,validator:()=>na,CalendarIcon:()=>fq,getHistory:()=>iX,StickyNoteAddIcon:()=>pQ,useWorkspace2Store:()=>_8,getPatientName:()=>Dj,getVisitStore:()=>l_,getCoreTranslation:()=>iz,registerModuleWithConfigSystem:()=>nW,updateOpenedWorkspaceInWindow:()=>_6,registerModuleLoad:()=>nH,getBreadcrumbs:()=>og,extractVariableNames:()=>l5,translateFrom:()=>iH,useStoreWithActions:()=>cy,EditIcon:()=>ps,getCandidateExtensions:()=>uZ,shallowEqual:()=>R,subscribeNotificationShown:()=>x,MaximizeIcon:()=>pk,promptForClosingWorkspaces:()=>_1,WarningIcon:()=>ma,fhirBaseUrl:()=>i6,matchLocale:()=>SV,usePatientPhoto:()=>DX,registerBreadcrumb:()=>om,EventsIcon:()=>pu,createGlobalStore:()=>B,subscribeToFeatureFlag:()=>un,useExtensionStore:()=>db,createAttachment:()=>lc,useLeftNavStore:()=>dF,TableIcon:()=>p2,Icon:()=>mf,InformationFilledIcon:()=>pw,getCurrentPageMap:()=>sj,LaboratoryPictogram:()=>_c,temporaryConfigStore:()=>np,toDateObjectStrict:()=>EH,defineConfigSchema:()=>nV,filterBreadcrumbs:()=>ov,invalidateImplementerToolsConfig:()=>nk,PatientBannerContactDetails:()=>SA,getAssignedExtensions:()=>uG,promptForClosingWorkspacesInWindow:()=>_2,PatientPhoto:()=>D1,MaterialOrderIcon:()=>pC,MicroscopeIcon:()=>pR,visitTypesUrl:()=>lv,getOpenedWindowWidth:()=>St,scheduleRecomputation:()=>ux,PharmacyPictogram:()=>_v,AttachmentIcon:()=>ms,MoneyIcon:()=>pN,getAttachments:()=>ll,PageHeaderContent:()=>DT,MedicationIcon:()=>pP,PrinterIcon:()=>pB,PatientListsPictogram:()=>_O,useAppContext:()=>c7,isOpenmrsRoutes:()=>sJ,AppointmentsAltPictogram:()=>D3,GenericOrderTypeIcon:()=>pm,batchExtensionUpdates:()=>uw,useExtensionSlotStore:()=>cE,ViewIcon:()=>mo,formattedName:()=>DI,sessionEndpoint:()=>i5,duration:()=>E7,resetImportMapOverrides:()=>sU,TableOfContentsIcon:()=>p1,CaretLeftIcon:()=>fX,getTranslationOverrides:()=>nq,isVersionSatisfied:()=>SG,EmptyCardIllustration:()=>x1,PenIcon:()=>pF,verifyTotpCode:()=>sh,validators:()=>od,setupImportMapOverrides:()=>sH,showToast:()=>_H,useDefineAppContext:()=>c6,getGlobalStore:()=>W,useOnClickOutside:()=>dV,getWindowByWorkspaceName:()=>u3,ArrowRightIcon:()=>fK,loadLifeCycles:()=>fe,registerBreadcrumbs:()=>oh,MotherIcon:()=>pj,fetchCurrentPatient:()=>lf,Toast:()=>_F,MessageQueueIcon:()=>pO,TwoFactorAuthenticationIcon:()=>p8,Pharmacy2Pictogram:()=>_b,goBackInHistory:()=>iQ,GroupAccessIcon:()=>pg,getExtensionRenderingsStore:()=>uu,setImplementerToolsConfigRecomputer:()=>nC,getAsyncExtensionLifecycle:()=>cX,setupApiModule:()=>sx,renderLoadingSpinner:()=>S$,showNotification:()=>Dx,getModalRegistration:()=>u2,ListCheckedIcon:()=>p_,ResponsiveWrapper:()=>_N,GynaecologyPictogram:()=>_l,ShoppingCartIcon:()=>pJ,getRouteMapNextPageMap:()=>s7,MetadataExportPictogram:()=>_f,updateVisit:()=>lk,backendDependencies:()=>sE,MaybePictogram:()=>_R,createParcelMounter:()=>ca,openmrsFetch:()=>i8,useStore:()=>cg,isOpenmrsAppRoutes:()=>sq,ExportedWorkspace:()=>SE,DentistryPictogram:()=>_n,HomePictogram:()=>_P,ServiceQueuesPictogram:()=>_x,createExportedWorkspaceWindow:()=>Sn,setFeatureFlag:()=>uo,toLanguageTag:()=>Es,DigitalTrustPictogram:()=>_o,NumericObservation:()=>DP,attachmentUrl:()=>li,interpolateString:()=>iG,inRange:()=>os,useExtensionSlotMeta:()=>dv,AppointmentsPictogram:()=>D4,renderSnackbars:()=>_M,getRegisteredWorkspace2Names:()=>Se,logout:()=>sg,toLocationObject:()=>lh,ChartLineIcon:()=>f2,UserHasAccess:()=>dX,evaluateAsBooleanAsync:()=>lL,createDashboard:()=>mm,getLocations:()=>lg,useExtensionContext:()=>dg,getExtensionsConfigStore:()=>nb,getRouteMapDefaultMap:()=>s8,age:()=>DF,isOmrsDateStrict:()=>EV,registerWorkspaceGroups2:()=>u9,usePaginationInfo:()=>dK,evaluateAsync:()=>lI,useOpenmrsFetchAll:()=>dT,removeImportMapOverride:()=>sB,useVisitTypes:()=>d8,ageAsDuration:()=>DL,getExtensionNameFromId:()=>uF,DataEntryPictogram:()=>_r,renderParcel:()=>co,ResetIcon:()=>pK,RenewIcon:()=>pH,useWorkspace2Context:()=>_7,subscribeActionableNotificationShown:()=>D,ErrorCard:()=>x3,GenderFemaleIcon:()=>pc,enableImportMapOverride:()=>sV,retry:()=>SZ,ComponentContext:()=>cc,ExtensionSlot:()=>cC,unsetLeftNav:()=>uQ,addImportMapOverride:()=>sF,MaybeIcon:()=>md,useCustomOverflowMenu:()=>fC,PedestrianFamilyIcon:()=>pL,CtScanPictogram:()=>_t,dispatchNotificationShown:()=>v,leftNavStore:()=>uJ,OpenmrsFetchError:()=>i7,UserFollowIcon:()=>me,launchWorkspaceGroup2:()=>_Y,ChevronRightIcon:()=>f8,UserXrayIcon:()=>mt,GenderOtherIcon:()=>pf,formatDuration:()=>E3,toOmrsIsoString:()=>Ez,Labs2Pictogram:()=>_d,workspace2Store:()=>u4,setUserLanguage:()=>si,useBodyScrollLock:()=>da,SyringeIcon:()=>p0,LocationPicker:()=>x5,useDebounce:()=>dd,TimeIcon:()=>p4,getExtensionSlotConfig:()=>ny,AddIcon:()=>fW,getRouteMapOverrideMap:()=>le,processConfig:()=>nJ,InventoryManagementIcon:()=>px,registerWorkspaces2:()=>u7,UserIcon:()=>mr,formatPatientName:()=>D$,fireOpenmrsEvent:()=>lp,registerModal:()=>u1,registerTranslationNamespace:()=>nz,displayName:()=>DA,createLocalStore:()=>U,evaluate:()=>l$,defineExtensionConfigSchema:()=>nK,getSyncLifecycle:()=>cJ,renderWorkspaceWindowsAndMenu:()=>SF,evaluateAsTypeAsync:()=>lV});let m="openmrs:notification-shown",h="openmrs:actionable-notification-shown",g="openmrs:toast-shown",y="openmrs:snack-bar-shown";function v(e){window.dispatchEvent(new CustomEvent(m,{detail:e}))}function b(e){window.dispatchEvent(new CustomEvent(h,{detail:e}))}function w(e){window.dispatchEvent(new CustomEvent(y,{detail:e}))}function E(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function x(e){let t=t=>e(t.detail);return window.addEventListener(m,t),()=>window.removeEventListener(m,t)}function D(e){let t=t=>e(t.detail);return window.addEventListener(h,t),()=>window.removeEventListener(h,t)}function _(e){let t=t=>e(t.detail);return window.addEventListener(g,t),()=>window.removeEventListener(g,t)}function S(e){let t=t=>e(t.detail);return window.addEventListener(y,t),()=>window.removeEventListener(y,t)}function C(e,t){let{message:r}=O(e);return"string"==typeof r&&r?r:t}function k(e){let t=O(e);setTimeout(()=>{throw t})}function P(){let e=Error();return t=>{let r=O(t);r.stack+=`
|
|
2
2
|
Async stacktrace:
|
|
3
|
-
${e.stack}`,k(t)}}function O(e){let t;if(e instanceof Error)return e;if(null===e)return Error("'null' was thrown as an error");if("object"==typeof e){try{t=`Object thrown as error: ${JSON.stringify(e)}`}catch(r){t=`Object thrown as error with the following properties: ${Object.keys(e)}`}return Error(t)}if(void 0===e)return Error("'undefined' was thrown as an error");return Error(e.toString())}function R(e,t){if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}if(Array.isArray(t)||"object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);return r.length===n.length&&r.every(r=>e[r]===t[r])}function T(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),a=null!=(n=r.getItem(e))?n:null;return a instanceof Promise?a.then(o):o(a)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)}}window.onerror=function(e,t,r,n,o){return console.error("Unexpected error: ",o??e),E({description:C(o,"Oops! An unexpected error occurred."),kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(e){console.error("Unhandled rejection: ",e.reason),E({description:C(e.reason,"Oops! An unhandled promise rejection occurred."),kind:"error",title:"Error"})};let N=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>N(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>N(t)(e)}}},j=e=>{let t,r=new Set,n=(e,n)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach(r=>r(t,e))}},o=()=>t,a={setState:n,getState:o,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},i=t=e(n,o,a);return a},A=e=>e?j(e):j;function $(){try{return"u">typeof process&&("true"===process.env.VITEST||void 0!==process.env.JEST_WORKER_ID)||"u">typeof globalThis&&("__vitest_worker__"in globalThis||"__jest__"in globalThis)}catch{return!1}}let I={},M=Symbol.for("openmrs.esm-state.instanceCount"),L=globalThis,F=(L[M]??0)+1;function B(e,t,r="none"){let n=I[e];if(n)return n.active?$()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):n.value.setState(t,!0),n.active=!0,n.value;{let n=z(e,t,r);return I[e]={value:n,active:!0},n}}function U(e){return A()(()=>e)}function V(e,t){let r=I[e];return r?(r.active?$()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):r.value=t,r.active=!0,r.value):(I[e]={value:t,active:!0},t)}function W(e,t,r="none"){let n=I[e];if(!n){let n=z(e,t??{},r);return I[e]={value:n,active:!1},n}return n.value}function H(...e){let[t,r,n]=e,o=void 0===n?r:n,a=void 0===n?e=>e:r,i=a(t.getState());return o(i),t.subscribe(e=>{let t=a(e);R(i,t)||(i=t,o(t))})}function z(e,t,r){return"sessionStorage"===r?A()(((e,t)=>{if("getStorage"in t||"serialize"in t||"deserialize"in t)return console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),(r,n,o)=>{let a,i,s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},l=!1,u=new Set,c=new Set;try{a=s.getStorage()}catch(e){}if(!a)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},n,o);let d=N(s.serialize),f=()=>{let e,t=d({state:s.partialize({...n()}),version:s.version}).then(e=>a.setItem(s.name,e)).catch(t=>{e=t});if(e)throw e;return t},p=o.setState;o.setState=(e,t)=>{p(e,t),f()};let m=e((...e)=>{r(...e),f()},n,o),h=()=>{var e;if(!a)return;l=!1,u.forEach(e=>e(n()));let t=(null==(e=s.onRehydrateStorage)?void 0:e.call(s,n()))||void 0;return N(a.getItem.bind(a))(s.name).then(e=>{if(e)return s.deserialize(e)}).then(e=>{if(e)if("number"!=typeof e.version||e.version===s.version)return e.state;else{if(s.migrate)return s.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}}).then(e=>{var t;return r(i=s.merge(e,null!=(t=n())?t:m),!0),f()}).then(()=>{null==t||t(i,void 0),l=!0,c.forEach(e=>e(i))}).catch(e=>{null==t||t(void 0,e)})};return o.persist={setOptions:e=>{s={...s,...e},e.getStorage&&(a=e.getStorage())},clearStorage:()=>{null==a||a.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:e=>(u.add(e),()=>{u.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},h(),i||m};return(r,n,o)=>{let a,i={storage:T(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1,l=new Set,u=new Set,c=i.storage;if(!c)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),r(...e)},n,o);let d=()=>{let e=i.partialize({...n()});return c.setItem(i.name,{state:e,version:i.version})},f=o.setState;o.setState=(e,t)=>{f(e,t),d()};let p=e((...e)=>{r(...e),d()},n,o);o.getInitialState=()=>p;let m=()=>{var e,t;if(!c)return;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let o=(null==(t=i.onRehydrateStorage)?void 0:t.call(i,null!=(e=n())?e:p))||void 0;return N(c.getItem.bind(c))(i.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===i.version)return[!1,e.state];else{if(i.migrate)return[!0,i.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;let[o,s]=e;if(r(a=i.merge(s,null!=(t=n())?t:p),!0),o)return d()}).then(()=>{null==o||o(a,void 0),a=n(),s=!0,u.forEach(e=>e(a))}).catch(e=>{null==o||o(void 0,e)})};return o.persist={setOptions:e=>{i={...i,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},i.skipHydration||m(),a||p}})(()=>t,{name:e,storage:T(()=>sessionStorage)})):A()(()=>t)}L[M]=F,F>1&&!$()&&console.error(`Detected ${F} copies of @openmrs/esm-framework running on this page. Each copy keeps its own store registry, so stores, configuration and extension state are not shared between them. This usually means a frontend module loaded its own bundled framework instead of the one the app shell provides.`),globalThis.setTimeout?.(()=>{"u">typeof window&&"development"===window.spaEnv&&(window.stores=I)},1e3);let K=function(e){return void 0===e};var G,Z,Y,q,J,X,Q,ee,et,er,en,eo,ea,ei,es=r(8348);let el=function(e,t){return function(r){return e(t(r))}};var eu=el(Object.getPrototypeOf,Object),ec=r(3098),ed=Object.prototype,ef=Function.prototype.toString,ep=ed.hasOwnProperty,em=ef.call(Object);let eh=function(e){if(!(0,ec.A)(e)||"[object Object]"!=(0,es.A)(e))return!1;var t=eu(e);if(null===t)return!0;var r=ep.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ef.call(r)==em},eg=function(e,t){return e===t||e!=e&&t!=t},ey=function(e,t){for(var r=e.length;r--;)if(eg(e[r][0],t))return r;return -1};var ev=Array.prototype.splice;function eb(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}eb.prototype.clear=function(){this.__data__=[],this.size=0},eb.prototype.delete=function(e){var t=this.__data__,r=ey(t,e);return!(r<0)&&(r==t.length-1?t.pop():ev.call(t,r,1),--this.size,!0)},eb.prototype.get=function(e){var t=this.__data__,r=ey(t,e);return r<0?void 0:t[r][1]},eb.prototype.has=function(e){return ey(this.__data__,e)>-1},eb.prototype.set=function(e,t){var r=this.__data__,n=ey(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var ew=r(3149);let eE=function(e){if(!(0,ew.A)(e))return!1;var t=(0,es.A)(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var ex=r(1917),eD=ex.A["__core-js_shared__"],e_=(G=/[^.]+$/.exec(eD&&eD.keys&&eD.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",eS=Function.prototype.toString;let eC=function(e){if(null!=e){try{return eS.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var ek=/^\[object .+?Constructor\]$/,eP=Object.prototype,eO=Function.prototype.toString,eR=eP.hasOwnProperty,eT=RegExp("^"+eO.call(eR).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eN=function(e){return!!(0,ew.A)(e)&&(!e_||!(e_ in e))&&(eE(e)?eT:ek).test(eC(e))},ej=function(e,t){var r=null==e?void 0:e[t];return eN(r)?r:void 0};var eA=ej(ex.A,"Map"),e$=ej(Object,"create"),eI=Object.prototype.hasOwnProperty,eM=Object.prototype.hasOwnProperty;function eL(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}eL.prototype.clear=function(){this.__data__=e$?e$(null):{},this.size=0},eL.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},eL.prototype.get=function(e){var t=this.__data__;if(e$){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return eI.call(t,e)?t[e]:void 0},eL.prototype.has=function(e){var t=this.__data__;return e$?void 0!==t[e]:eM.call(t,e)},eL.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=e$&&void 0===t?"__lodash_hash_undefined__":t,this};let eF=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eB=function(e,t){var r=e.__data__;return eF(t)?r["string"==typeof t?"string":"hash"]:r.map};function eU(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eV(e){var t=this.__data__=new eb(e);this.size=t.size}eU.prototype.clear=function(){this.size=0,this.__data__={hash:new eL,map:new(eA||eb),string:new eL}},eU.prototype.delete=function(e){var t=eB(this,e).delete(e);return this.size-=!!t,t},eU.prototype.get=function(e){return eB(this,e).get(e)},eU.prototype.has=function(e){return eB(this,e).has(e)},eU.prototype.set=function(e,t){var r=eB(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},eV.prototype.clear=function(){this.__data__=new eb,this.size=0},eV.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},eV.prototype.get=function(e){return this.__data__.get(e)},eV.prototype.has=function(e){return this.__data__.has(e)},eV.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!eA||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new eU(n)}return r.set(e,t),this.size=r.size,this};var eW=function(){try{var e=ej(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let eH=function(e,t,r){"__proto__"==t&&eW?eW(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},ez=function(e,t,r){(void 0===r||eg(e[t],r))&&(void 0!==r||t in e)||eH(e,t,r)},eK=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var s=a[++n];if(!1===t(o[s],s,o))break}return e};var eG="object"==typeof exports&&exports&&!exports.nodeType&&exports,eZ=eG&&"object"==typeof module&&module&&!module.nodeType&&module,eY=eZ&&eZ.exports===eG?ex.A.Buffer:void 0,eq=eY?eY.allocUnsafe:void 0;let eJ=function(e,t){if(t)return e.slice();var r=e.length,n=eq?eq(r):new e.constructor(r);return e.copy(n),n};var eX=ex.A.Uint8Array;let eQ=function(e){var t=new e.constructor(e.byteLength);return new eX(t).set(new eX(e)),t},e0=function(e,t){var r=t?eQ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},e1=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t};var e2=Object.create,e4=function(){function e(){}return function(t){if(!(0,ew.A)(t))return{};if(e2)return e2(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),e3=Object.prototype;let e6=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||e3)},e5=function(e){return"function"!=typeof e.constructor||e6(e)?{}:e4(eu(e))},e9=function(e){return(0,ec.A)(e)&&"[object Arguments]"==(0,es.A)(e)};var e8=Object.prototype,e7=e8.hasOwnProperty,te=e8.propertyIsEnumerable,tt=e9(function(){return arguments}())?e9:function(e){return(0,ec.A)(e)&&e7.call(e,"callee")&&!te.call(e,"callee")},tr=Array.isArray;let tn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},to=function(e){return null!=e&&tn(e.length)&&!eE(e)};var ta="object"==typeof exports&&exports&&!exports.nodeType&&exports,ti=ta&&"object"==typeof module&&module&&!module.nodeType&&module,ts=ti&&ti.exports===ta?ex.A.Buffer:void 0;let tl=(ts?ts.isBuffer:void 0)||function(){return!1};var tu={};tu["[object Float32Array]"]=tu["[object Float64Array]"]=tu["[object Int8Array]"]=tu["[object Int16Array]"]=tu["[object Int32Array]"]=tu["[object Uint8Array]"]=tu["[object Uint8ClampedArray]"]=tu["[object Uint16Array]"]=tu["[object Uint32Array]"]=!0,tu["[object Arguments]"]=tu["[object Array]"]=tu["[object ArrayBuffer]"]=tu["[object Boolean]"]=tu["[object DataView]"]=tu["[object Date]"]=tu["[object Error]"]=tu["[object Function]"]=tu["[object Map]"]=tu["[object Number]"]=tu["[object Object]"]=tu["[object RegExp]"]=tu["[object Set]"]=tu["[object String]"]=tu["[object WeakMap]"]=!1;let tc=function(e){return function(t){return e(t)}};var td=r(2136),tf="object"==typeof exports&&exports&&!exports.nodeType&&exports,tp=tf&&"object"==typeof module&&module&&!module.nodeType&&module,tm=tp&&tp.exports===tf&&td.A.process,th=function(){try{var e=tp&&tp.require&&tp.require("util").types;if(e)return e;return tm&&tm.binding&&tm.binding("util")}catch(e){}}(),tg=th&&th.isTypedArray,ty=tg?tc(tg):function(e){return(0,ec.A)(e)&&tn(e.length)&&!!tu[(0,es.A)(e)]};let tv=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tb=Object.prototype.hasOwnProperty;let tw=function(e,t,r){var n=e[t];tb.call(e,t)&&eg(n,r)&&(void 0!==r||t in e)||eH(e,t,r)},tE=function(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var s=t[a],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),o?eH(r,s,l):tw(r,s,l)}return r},tx=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tD=/^(?:0|[1-9]\d*)$/;let t_=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&tD.test(e))&&e>-1&&e%1==0&&e<t};var tS=Object.prototype.hasOwnProperty;let tC=function(e,t){var r=tr(e),n=!r&&tt(e),o=!r&&!n&&tl(e),a=!r&&!n&&!o&&ty(e),i=r||n||o||a,s=i?tx(e.length,String):[],l=s.length;for(var u in e)(t||tS.call(e,u))&&!(i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||t_(u,l)))&&s.push(u);return s},tk=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t};var tP=Object.prototype.hasOwnProperty;let tO=function(e){if(!(0,ew.A)(e))return tk(e);var t=e6(e),r=[];for(var n in e)"constructor"==n&&(t||!tP.call(e,n))||r.push(n);return r},tR=function(e){return to(e)?tC(e,!0):tO(e)},tT=function(e,t,r,n,o,a,i){var s=tv(e,r),l=tv(t,r),u=i.get(l);if(u)return void ez(e,r,u);var c=a?a(s,l,r+"",e,t,i):void 0,d=void 0===c;if(d){var f=tr(l),p=!f&&tl(l),m=!f&&!p&&ty(l);(c=l,f||p||m)?tr(s)?c=s:(0,ec.A)(s)&&to(s)?c=e1(s):p?(d=!1,c=eJ(l,!0)):m?(d=!1,c=e0(l,!0)):c=[]:eh(l)||tt(l)?(c=s,tt(s))?c=tE(s,tR(s)):(!(0,ew.A)(s)||eE(s))&&(c=e5(l)):d=!1}d&&(i.set(l,c),o(c,l,n,a,i),i.delete(l)),ez(e,r,c)},tN=function e(t,r,n,o,a){t!==r&&eK(r,function(i,s){if(a||(a=new eV),(0,ew.A)(i))tT(t,r,s,n,e,o,a);else{var l=o?o(tv(t,s),i,s+"",t,r,a):void 0;void 0===l&&(l=i),ez(t,s,l)}},tR)},tj=function(e){return e},tA=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)};var t$=Math.max;let tI=function(e,t,r){return t=t$(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=t$(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),tA(e,this,s)}};var tM=Date.now,tL=(Z=eW?function(e,t){return eW(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:tj,Y=0,q=0,function(){var e=tM(),t=16-(e-q);if(q=e,t>0){if(++Y>=800)return arguments[0]}else Y=0;return Z.apply(void 0,arguments)});let tF=function(e,t,r){if(!(0,ew.A)(r))return!1;var n=typeof t;return("number"==n?!!(to(r)&&t_(t,r.length)):"string"==n&&t in r)&&eg(r[t],e)},tB=function(e){var t;return tL(tI(t=function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,i=o>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,i&&tF(r[0],r[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++n<o;){var s=r[n];s&&e(t,s,n,a)}return t},void 0,tj),t+"")};var tU=tB(function(e,t,r,n){tN(e,t,r,n)});function tV(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new eU;++t<r;)this.add(e[t])}tV.prototype.add=tV.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tV.prototype.has=function(e){return this.__data__.has(e)};let tW=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},tH=function(e,t,r,n,o,a){var i=1&r,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,p=2&r?new tV:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(n)var g=i?n(h,m,d,t,e,a):n(m,h,d,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!tW(t,function(e,t){if(!p.has(t)&&(m===e||o(m,e,r,n,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||o(m,h,r,n,a))){f=!1;break}}return a.delete(e),a.delete(t),f};var tz=r(241);let tK=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r},tG=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r};var tZ=tz.A?tz.A.prototype:void 0,tY=tZ?tZ.valueOf:void 0;let tq=function(e,t,r,n,o,a,i){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!a(new eX(e),new eX(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return eg(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=tK;case"[object Set]":var l=1&n;if(s||(s=tG),e.size!=t.size&&!l)break;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var c=tH(s(e),s(t),n,o,a,i);return i.delete(e),c;case"[object Symbol]":if(tY)return tY.call(e)==tY.call(t)}return!1},tJ=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},tX=function(e,t,r){var n=t(e);return tr(e)?n:tJ(n,r(e))},tQ=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a},t0=function(){return[]};var t1=Object.prototype.propertyIsEnumerable,t2=Object.getOwnPropertySymbols,t4=t2?function(e){return null==e?[]:tQ(t2(e=Object(e)),function(t){return t1.call(e,t)})}:t0,t3=el(Object.keys,Object),t6=Object.prototype.hasOwnProperty;let t5=function(e){if(!e6(e))return t3(e);var t=[];for(var r in Object(e))t6.call(e,r)&&"constructor"!=r&&t.push(r);return t},t9=function(e){return to(e)?tC(e):t5(e)},t8=function(e){return tX(e,t9,t4)};var t7=Object.prototype.hasOwnProperty;let re=function(e,t,r,n,o,a){var i=1&r,s=t8(e),l=s.length;if(l!=t8(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:t7.call(t,c)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=i;++u<l;){var h=e[c=s[u]],g=t[c];if(n)var y=i?n(g,h,c,t,e,a):n(h,g,c,e,t,a);if(!(void 0===y?h===g||o(h,g,r,n,a):y)){p=!1;break}m||(m="constructor"==c)}if(p&&!m){var v=e.constructor,b=t.constructor;v!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b)&&(p=!1)}return a.delete(e),a.delete(t),p};var rt=ej(ex.A,"DataView"),rr=ej(ex.A,"Promise"),rn=ej(ex.A,"Set"),ro=ej(ex.A,"WeakMap"),ra="[object Map]",ri="[object Promise]",rs="[object Set]",rl="[object WeakMap]",ru="[object DataView]",rc=eC(rt),rd=eC(eA),rf=eC(rr),rp=eC(rn),rm=eC(ro),rh=es.A;(rt&&rh(new rt(new ArrayBuffer(1)))!=ru||eA&&rh(new eA)!=ra||rr&&rh(rr.resolve())!=ri||rn&&rh(new rn)!=rs||ro&&rh(new ro)!=rl)&&(rh=function(e){var t=(0,es.A)(e),r="[object Object]"==t?e.constructor:void 0,n=r?eC(r):"";if(n)switch(n){case rc:return ru;case rd:return ra;case rf:return ri;case rp:return rs;case rm:return rl}return t});let rg=rh;var ry="[object Arguments]",rv="[object Array]",rb="[object Object]",rw=Object.prototype.hasOwnProperty;let rE=function(e,t,r,n,o,a){var i=tr(e),s=tr(t),l=i?rv:rg(e),u=s?rv:rg(t);l=l==ry?rb:l,u=u==ry?rb:u;var c=l==rb,d=u==rb,f=l==u;if(f&&tl(e)){if(!tl(t))return!1;i=!0,c=!1}if(f&&!c)return a||(a=new eV),i||ty(e)?tH(e,t,r,n,o,a):tq(e,t,l,r,n,o,a);if(!(1&r)){var p=c&&rw.call(e,"__wrapped__"),m=d&&rw.call(t,"__wrapped__");if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||(a=new eV),o(h,g,r,n,a)}}return!!f&&(a||(a=new eV),re(e,t,r,n,o,a))},rx=function(e,t){return function e(t,r,n,o,a){return t===r||(null!=t&&null!=r&&((0,ec.A)(t)||(0,ec.A)(r))?rE(t,r,n,o,e,a):t!=t&&r!=r)}(e,t)},rD=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},r_=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e};var rS=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tJ(t,t4(e)),e=eu(e);return t}:t0;let rC=function(e){return tX(e,tR,rS)};var rk=Object.prototype.hasOwnProperty;let rP=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&rk.call(e,"index")&&(r.index=e.index,r.input=e.input),r},rO=function(e,t){var r=t?eQ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)};var rR=/\w*$/;let rT=function(e){var t=new e.constructor(e.source,rR.exec(e));return t.lastIndex=e.lastIndex,t};var rN=tz.A?tz.A.prototype:void 0,rj=rN?rN.valueOf:void 0;let rA=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return eQ(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return rO(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e0(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return rT(e);case"[object Symbol]":return rj?Object(rj.call(e)):{}}};var r$=th&&th.isMap,rI=r$?tc(r$):function(e){return(0,ec.A)(e)&&"[object Map]"==rg(e)},rM=th&&th.isSet,rL=rM?tc(rM):function(e){return(0,ec.A)(e)&&"[object Set]"==rg(e)},rF="[object Arguments]",rB="[object Function]",rU="[object Object]",rV={};rV[rF]=rV["[object Array]"]=rV["[object ArrayBuffer]"]=rV["[object DataView]"]=rV["[object Boolean]"]=rV["[object Date]"]=rV["[object Float32Array]"]=rV["[object Float64Array]"]=rV["[object Int8Array]"]=rV["[object Int16Array]"]=rV["[object Int32Array]"]=rV["[object Map]"]=rV["[object Number]"]=rV[rU]=rV["[object RegExp]"]=rV["[object Set]"]=rV["[object String]"]=rV["[object Symbol]"]=rV["[object Uint8Array]"]=rV["[object Uint8ClampedArray]"]=rV["[object Uint16Array]"]=rV["[object Uint32Array]"]=!0,rV["[object Error]"]=rV[rB]=rV["[object WeakMap]"]=!1;let rW=function e(t,r,n,o,a,i){var s,l=1&r,u=2&r,c=4&r;if(n&&(s=a?n(t,o,a,i):n(t)),void 0!==s)return s;if(!(0,ew.A)(t))return t;var d=tr(t);if(d){if(s=rP(t),!l)return e1(t,s)}else{var f,p,m,h,g=rg(t),y=g==rB||"[object GeneratorFunction]"==g;if(tl(t))return eJ(t,l);if(g==rU||g==rF||y&&!a){if(s=u||y?{}:e5(t),!l)return u?(p=(f=s)&&tE(t,tR(t),f),tE(t,rS(t),p)):(h=(m=s)&&tE(t,t9(t),m),tE(t,t4(t),h))}else{if(!rV[g])return a?t:{};s=rA(t,g,l)}}i||(i=new eV);var v=i.get(t);if(v)return v;i.set(t,s),rL(t)?t.forEach(function(o){s.add(e(o,r,n,o,t,i))}):rI(t)&&t.forEach(function(o,a){s.set(a,e(o,r,n,a,t,i))});var b=c?u?rC:t8:u?tR:t9,w=d?void 0:b(t);return r_(w||t,function(o,a){w&&(o=t[a=o]),tw(s,a,e(o,r,n,a,t,i))}),s};var rH=r(1882),rz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rK=/^\w*$/;let rG=function(e,t){if(tr(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||(0,rH.A)(e))||rK.test(e)||!rz.test(e)||null!=t&&e in Object(t)};function rZ(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(rZ.Cache||eU),r}rZ.Cache=eU;var rY=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rq=/\\(\\)?/g,rJ=(X=(J=rZ(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rY,function(e,r,n,o){t.push(n?o.replace(rq,"$1"):r||e)}),t},function(e){return 500===X.size&&X.clear(),e})).cache,J),rX=1/0,rQ=tz.A?tz.A.prototype:void 0,r0=rQ?rQ.toString:void 0;let r1=function e(t){if("string"==typeof t)return t;if(tr(t))return rD(t,e)+"";if((0,rH.A)(t))return r0?r0.call(t):"";var r=t+"";return"0"==r&&1/t==-rX?"-0":r},r2=function(e,t){return tr(e)?e:rG(e,t)?[e]:rJ(null==e?"":r1(e))},r4=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var r3=1/0;let r6=function(e){if("string"==typeof e||(0,rH.A)(e))return e;var t=e+"";return"0"==t&&1/e==-r3?"-0":t},r5=function(e,t){t=r2(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[r6(t[r++])];return r&&r==n?e:void 0},r9=function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a},r8=function(e,t){var r,n;return t=r2(t,e),r=e,null==(e=(n=t).length<2?r:r5(r,r9(n,0,-1)))||delete e[r6(r4(t))]},r7=function(e){return eh(e)?void 0:e};var ne=tz.A?tz.A.isConcatSpreadable:void 0;let nt=function(e){return tr(e)||tt(e)||!!(ne&&e&&e[ne])},nr=function e(t,r,n,o,a){var i=-1,s=t.length;for(n||(n=nt),a||(a=[]);++i<s;){var l=t[i];r>0&&n(l)?r>1?e(l,r-1,n,o,a):tJ(a,l):o||(a[a.length]=l)}return a};var nn=tL(tI(Q=function(e,t){var r={};if(null==e)return r;var n=!1;t=rD(t,function(t){return t=r2(t,e),n||(n=t.length>1),t}),tE(e,rC(e),r),n&&(r=rW(r,7,r7));for(var o=t.length;o--;)r8(r,t[o]);return r},void 0,function(e){return(null==e?0:e.length)?nr(e,1):[]}),Q+""),no=((ee={}).Array="Array",ee.Boolean="Boolean",ee.ConceptUuid="ConceptUuid",ee.Number="Number",ee.Object="Object",ee.String="String",ee.UUID="UUID",ee.PersonAttributeTypeUuid="PersonAttributeTypeUuid",ee.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid",ee);function na(e,t){return r=>{if(!e(r))if("function"==typeof t)return t(r);else return t}}let ni=na(e=>Array.isArray(e),"must be an array"),ns=na(e=>"boolean"==typeof e,"must be a boolean"),nl=na(e=>"number"==typeof e,"must be a number"),nu=na(e=>"string"==typeof e,"must be a string"),nc=na(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),nd=na(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e),"must be a valid UUID or a 36-character hexadecimal string"),nf=B("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{}}),np=B("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});np.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let nm=B("config-store-of-extension-state",{mountedExtensions:[]});function nh(e){return W(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function ng(){return W("config-extension-slots",{slots:{}})}function ny(e){return nv(ng().getState(),e)}function nv(e,t){return e.slots[t]??{loaded:!1,config:{}}}function nb(){return W("config-extensions",{configs:{}})}function nw(e,t,r){return e.configs[t]?.[r]??{loaded:!1,config:null}}function nE(e,t,r){return e.configure?.[r]??null}let nx=A()(()=>({config:{}})),nD=0,n_=!0,nS=!1;function nC(e){n=e}function nk(){n_=!0,nD>0&&nP()}function nP(){if(n_&&n&&!nS){nS=!0,n_=!1;try{n()}catch(e){n_=!0,nO(e),console.error("Failed to derive the implementer tools config",e)}finally{nS=!1}}}function nO(e){nx.setState({derivationError:e instanceof Error?e.message:String(e)})}function nR(){nx.getState().derivationError&&nx.setState({derivationError:void 0})}let nT=V("config-implementer-tools",{...nx,getState:()=>(0===nD&&nP(),nx.getState()),setState:(...e)=>(n_=!1,nx.setState(...e)),subscribe(e){nD++,nP();let t=nx.subscribe(e),r=!1;return()=>{!r&&(r=!0,nD--),t()}}});function nN(e,t){if(Array.isArray(t))return t}function nj(e,t){return tU({},e,t,nN)}let nA=[],n$=new Set,nI=null,nM=new WeakMap;function nL(){n=()=>{var e,t;let r,n;return e=nf.getState(),t=np.getState(),r=nT.getState(),n={config:function(e,t){let r=function(e){let t={};for(let[r,n]of Object.entries(e)){let e=n0.get(r);if(e&&e.schema===n)t[r]=e.annotated;else{let e=function e(t){return t.hasOwnProperty("_default")?{...t,_value:t._default,_source:"default"}:ot(t)?Object.keys(t).reduce((r,n)=>(r[n]=e(t[n]),r),{}):{}}(rW(n,5));n0.set(r,{schema:n,annotated:e}),t[r]=e}}return t}(e.schemas),n=[...e.providedConfigs.map(e=>[e.config,e.source]),[t.config,"temporary config"]],o=new Set(Object.keys(r));for(let[e]of n)for(let t of Object.keys(e))o.add(t);let a={};for(let e of o){let t=r[e],o=n.map(([t])=>t[e]),i=n.map(([,e])=>e),s=nQ.get(e);if(s&&s.annotatedSchema===t&&s.configSlices.length===o.length&&s.configSlices.every((e,t)=>e===o[t])&&s.sources.every((e,t)=>e===i[t])){a[e]=s.result;continue}let l=t??{};n.forEach(([,e],t)=>{let r=o[t];void 0!==r&&(l=nj(l,function e(t,r){return ot(t)?Object.keys(t).reduce((n,o)=>(n[o]=e(t[o],r),n),{}):{_value:t,_source:r}}(r,e)))}),nQ.set(e,{annotatedSchema:t,configSlices:o,sources:i,result:l}),a[e]=l}return a}(e,t)},void(rx(r.config,n.config)||nT.setState(n))},nF(),nA.push(nf.subscribe(nF),np.subscribe(nF),nm.subscribe(nF))}function nF(){nR();try{!function(){let e=nf.getState(),t=np.getState(),r=nm.getState();if(nI?.configState===e&&nI.tempConfigState===t)return nU(e,r,t,nI.slotConfigs,!0);!function(e,t){for(let r of Object.keys(e.schemas)){let n,o=nh(r),a=e.schemas[r],i=!!e.moduleLoaded[r],s=nB.get(r);if(s&&s.schema===a&&s.moduleLoaded===i&&s.providedConfigs===e.providedConfigs&&s.temporaryConfig===t.config)n=s.state;else{let o=i?function(e,t,r){let n=t.schemas[e],o=n4(e,n1(t,r));n6(n,o,e);let a=n7(n,o);return n5(n,a,e),delete a.extensionSlots,a}(r,e,t):function(e,t,r){let n=n7(oi,n4(e,n1(t,r)));return n5(oi,n,e),delete n.extensionSlots,n}(r,e,t);n={translationOverridesLoaded:!0,loaded:i,config:o},nB.set(r,{schema:a,moduleLoaded:i,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:n})}let l=o.getState();l.loaded===n.loaded&&l.translationOverridesLoaded===n.translationOverridesLoaded&&rx(l.config,n.config)||o.setState(n)}}(e,t);let n=function(e,t){let r=n3(n1(e,t)),n=Object.keys(r).reduce((e,t)=>(r[t]?.extensionSlots&&(e[t]=r[t]?.extensionSlots),e),{});var o=n;for(let[e,t]of Object.entries(o))for(let[r,n]of Object.entries(t))!function(e,t,r){let n=`${t}.extensionSlots.${r}`,o=`Extension slot config '${n}'`,a=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));a.length&&or(n,o+`' contains invalid keys '${a.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||or(n,o+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||or(n,o+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||or(n,o+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!ot(e.configure)&&or(n,o+".configure' is invalid. Must be an object with extension IDs for keys")}(n,e,r);let a={},i={};for(let e of Object.values(n))for(let[t,r]of Object.entries(e))a[t]=r,r.configure&&(i[t]??(i[t]=[])).push(r.configure);for(let[e,t]of Object.entries(i)){let r=1===t.length?t[0]:n3(t);a[e].configure!==r&&(a[e]={...a[e],configure:r})}return a}(e,t);(function(e){let t=ng(),r=t.getState().slots,n={},o=!1;for(let[t,a]of Object.entries(e)){let e=r[t];e?.loaded&&rx(e.config,a)?n[t]=e:(n[t]={loaded:!0,config:a},o=!0)}(o||Object.keys(r).length!==Object.keys(n).length)&&t.setState({slots:n})})(n),nU(e,r,t,n,!1),nI={configState:e,tempConfigState:t,slotConfigs:n},nk()}()}catch(e){nO(e),console.error("Failed to recompute the configuration",e)}}nL();let nB=new Map;function nU(e,t,r,n,o){let a=nb(),i=a.getState().configs,s={},l=!1,u=0;for(let a of t.mountedExtensions){let t,c=i[a.slotName]?.[a.extensionId],d=c&&nM.get(c);if(o&&c?.loaded&&d?.slotModuleName===a.slotModuleName&&d.extensionModuleName===a.extensionModuleName)t=c;else{let o=function(e,t,r,n,o,a,i){let s=function(e){let[t]=e.split("#");return t}(n),l=o.schemas[s],u=JSON.stringify([r,n,e,t]),c=nX.get(u);if(c&&c.extensionSchema===l&&c.extensionModuleSchema===o.schemas[t]&&c.providedConfigs===o.providedConfigs&&c.temporaryConfig===a.config)return c.config;let d=l?s:t,f=n1(o,a),p=i?.configure?.[n]??{},m=n4(e,f),h=m?.extensionSlots?.[r]?.configure?.[n]??{},g=n3([n4(d,f),p,h]),y=l??o.schemas[t];n6(y,g,d);let v=n7(y,g);return n5(y,v,d),delete v.extensionSlots,nX.set(u,{extensionSchema:l,extensionModuleSchema:o.schemas[t],providedConfigs:o.providedConfigs,temporaryConfig:a.config,config:v}),v}(a.slotModuleName,a.extensionModuleName,a.slotName,a.extensionId,e,r,n[a.slotName]);t=c?.loaded&&rx(c.config,o)?c:{config:o,loaded:!0}}nM.set(t,a),t!==c&&(l=!0),s[a.slotName]||(s[a.slotName]={}),s[a.slotName][a.extensionId]=t,u++}for(let[e,t]of Object.entries(s)){let r=i[e];r&&Object.keys(r).length===Object.keys(t).length&&Object.entries(t).every(([e,t])=>r[e]===t)&&(s[e]=r)}l||(l=Object.keys(i).length!==Object.keys(s).length||Object.values(i).reduce((e,t)=>e+Object.keys(t).length,0)!==u),l&&a.setState({configs:s})}function nV(e,t){n2(e,t);let r=nj(t,oi);nf.setState(t=>({...t,schemas:{...t.schemas,[e]:r},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nW(e){nf.setState(t=>({...t,schemas:{...t.schemas,[e]:oi}}))}function nH(e){nf.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nz(e){nf.setState(t=>({...t,schemas:{...t.schemas,[e]:oa}}))}function nK(e,t){n2(e,t);let r=nj(t,oi);nf.getState().schemas[e]&&console.error(`Config schema for extension ${e} already exists. If there are multiple extensions with this same name, one will probably crash.`),nf.setState(t=>({...t,schemas:{...t.schemas,[e]:r}}))}function nG(e,t="provided"){nf.setState(r=>({...r,providedConfigs:[...r.providedConfigs,{source:t,config:e}]}))}function nZ(e,t,r){return new Promise(n=>{let o,a=!1;function i(e){!a&&t(e)&&(a=!0,n(r(e)),o?.())}i(e.getState()),a||(o=e.subscribe(i))})}function nY(e){return nZ(nh(e),e=>!!(e.loaded&&e.config),e=>nn(e.config,["Display conditions","Translation overrides"]))}function nq(e,t,r){let n=[e in nf.getState().schemas?nZ(nh(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&r){let e=nw(nb().getState(),t,r),o=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};n.push(Promise.resolve(o))}return Promise.all(n)}function nJ(e,t,r){n6(e,t,r);let n=n7(e,t);return n5(e,n,r),n}let nX=new Map,nQ=new Map,n0=new Map;function n1(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function n2(e,t,r=""){let n="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let o of Object.keys(t).filter(e=>!e.startsWith("_"))){let a=r+(r&&".")+o,i=t[o];if("Display conditions"===a&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${n}`),"Translation overrides"===a&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${n}`),!ot(i)){console.error(`${e} has bad config schema definition for key '${a}'. ${n}`);continue}i.hasOwnProperty("_default")||n2(e,i,a);let s=i._elements;if(oe(s)&&n2(e,s,a+"._elements"),i._validators)for(let t of i._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${a}' ${n}.
|
|
3
|
+
${e.stack}`,k(t)}}function O(e){let t;if(e instanceof Error)return e;if(null===e)return Error("'null' was thrown as an error");if("object"==typeof e){try{t=`Object thrown as error: ${JSON.stringify(e)}`}catch(r){t=`Object thrown as error with the following properties: ${Object.keys(e)}`}return Error(t)}if(void 0===e)return Error("'undefined' was thrown as an error");return Error(e.toString())}function R(e,t){if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}if(Array.isArray(t)||"object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);return r.length===n.length&&r.every(r=>e[r]===t[r])}function T(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),a=null!=(n=r.getItem(e))?n:null;return a instanceof Promise?a.then(o):o(a)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,null==t?void 0:t.replacer)),removeItem:e=>r.removeItem(e)}}window.onerror=function(e,t,r,n,o){return console.error("Unexpected error: ",o??e),E({description:C(o,"Oops! An unexpected error occurred."),kind:"error",title:"Error"}),!1},window.onunhandledrejection=function(e){console.error("Unhandled rejection: ",e.reason),E({description:C(e.reason,"Oops! An unhandled promise rejection occurred."),kind:"error",title:"Error"})};let N=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>N(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>N(t)(e)}}},j=e=>{let t,r=new Set,n=(e,n)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach(r=>r(t,e))}},o=()=>t,a={setState:n,getState:o,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},i=t=e(n,o,a);return a},A=e=>e?j(e):j;function $(){try{return"u">typeof process&&("true"===process.env.VITEST||void 0!==process.env.JEST_WORKER_ID)||"u">typeof globalThis&&("__vitest_worker__"in globalThis||"__jest__"in globalThis)}catch{return!1}}let I={},M=Symbol.for("openmrs.esm-state.instanceCount"),L=globalThis,F=(L[M]??0)+1;function B(e,t,r="none"){let n=I[e];if(n)return n.active?$()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):n.value.setState(t,!0),n.active=!0,n.value;{let n=z(e,t,r);return I[e]={value:n,active:!0},n}}function U(e){return A()(()=>e)}function V(e,t){let r=I[e];return r?(r.active?$()||console.error(`Attempted to override the existing store ${e}. Make sure that stores are only created once.`):r.value=t,r.active=!0,r.value):(I[e]={value:t,active:!0},t)}function W(e,t,r="none"){let n=I[e];if(!n){let n=z(e,t??{},r);return I[e]={value:n,active:!1},n}return n.value}function H(...e){let[t,r,n]=e,o=void 0===n?r:n,a=void 0===n?e=>e:r,i=a(t.getState());return o(i),t.subscribe(e=>{let t=a(e);R(i,t)||(i=t,o(t))})}function z(e,t,r){return"sessionStorage"===r?A()(((e,t)=>{if("getStorage"in t||"serialize"in t||"deserialize"in t)return console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),(r,n,o)=>{let a,i,s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},l=!1,u=new Set,c=new Set;try{a=s.getStorage()}catch(e){}if(!a)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},n,o);let d=N(s.serialize),f=()=>{let e,t=d({state:s.partialize({...n()}),version:s.version}).then(e=>a.setItem(s.name,e)).catch(t=>{e=t});if(e)throw e;return t},p=o.setState;o.setState=(e,t)=>{p(e,t),f()};let m=e((...e)=>{r(...e),f()},n,o),h=()=>{var e;if(!a)return;l=!1,u.forEach(e=>e(n()));let t=(null==(e=s.onRehydrateStorage)?void 0:e.call(s,n()))||void 0;return N(a.getItem.bind(a))(s.name).then(e=>{if(e)return s.deserialize(e)}).then(e=>{if(e)if("number"!=typeof e.version||e.version===s.version)return e.state;else{if(s.migrate)return s.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}}).then(e=>{var t;return r(i=s.merge(e,null!=(t=n())?t:m),!0),f()}).then(()=>{null==t||t(i,void 0),l=!0,c.forEach(e=>e(i))}).catch(e=>{null==t||t(void 0,e)})};return o.persist={setOptions:e=>{s={...s,...e},e.getStorage&&(a=e.getStorage())},clearStorage:()=>{null==a||a.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:e=>(u.add(e),()=>{u.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},h(),i||m};return(r,n,o)=>{let a,i={storage:T(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1,l=new Set,u=new Set,c=i.storage;if(!c)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),r(...e)},n,o);let d=()=>{let e=i.partialize({...n()});return c.setItem(i.name,{state:e,version:i.version})},f=o.setState;o.setState=(e,t)=>{f(e,t),d()};let p=e((...e)=>{r(...e),d()},n,o);o.getInitialState=()=>p;let m=()=>{var e,t;if(!c)return;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let o=(null==(t=i.onRehydrateStorage)?void 0:t.call(i,null!=(e=n())?e:p))||void 0;return N(c.getItem.bind(c))(i.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===i.version)return[!1,e.state];else{if(i.migrate)return[!0,i.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;let[o,s]=e;if(r(a=i.merge(s,null!=(t=n())?t:p),!0),o)return d()}).then(()=>{null==o||o(a,void 0),a=n(),s=!0,u.forEach(e=>e(a))}).catch(e=>{null==o||o(void 0,e)})};return o.persist={setOptions:e=>{i={...i,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},i.skipHydration||m(),a||p}})(()=>t,{name:e,storage:T(()=>sessionStorage)})):A()(()=>t)}L[M]=F,F>1&&!$()&&console.error(`Detected ${F} copies of @openmrs/esm-framework running on this page. Each copy keeps its own store registry, so stores, configuration and extension state are not shared between them. This usually means a frontend module loaded its own bundled framework instead of the one the app shell provides.`),globalThis.setTimeout?.(()=>{"u">typeof window&&"development"===window.spaEnv&&(window.stores=I)},1e3);let K=function(e){return void 0===e};var G,Z,Y,q,J,X,Q,ee,et,er,en,eo,ea,ei,es=r(8348);let el=function(e,t){return function(r){return e(t(r))}};var eu=el(Object.getPrototypeOf,Object),ec=r(3098),ed=Object.prototype,ef=Function.prototype.toString,ep=ed.hasOwnProperty,em=ef.call(Object);let eh=function(e){if(!(0,ec.A)(e)||"[object Object]"!=(0,es.A)(e))return!1;var t=eu(e);if(null===t)return!0;var r=ep.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ef.call(r)==em},eg=function(e,t){return e===t||e!=e&&t!=t},ey=function(e,t){for(var r=e.length;r--;)if(eg(e[r][0],t))return r;return -1};var ev=Array.prototype.splice;function eb(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}eb.prototype.clear=function(){this.__data__=[],this.size=0},eb.prototype.delete=function(e){var t=this.__data__,r=ey(t,e);return!(r<0)&&(r==t.length-1?t.pop():ev.call(t,r,1),--this.size,!0)},eb.prototype.get=function(e){var t=this.__data__,r=ey(t,e);return r<0?void 0:t[r][1]},eb.prototype.has=function(e){return ey(this.__data__,e)>-1},eb.prototype.set=function(e,t){var r=this.__data__,n=ey(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var ew=r(3149);let eE=function(e){if(!(0,ew.A)(e))return!1;var t=(0,es.A)(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var ex=r(1917),eD=ex.A["__core-js_shared__"],e_=(G=/[^.]+$/.exec(eD&&eD.keys&&eD.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",eS=Function.prototype.toString;let eC=function(e){if(null!=e){try{return eS.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var ek=/^\[object .+?Constructor\]$/,eP=Object.prototype,eO=Function.prototype.toString,eR=eP.hasOwnProperty,eT=RegExp("^"+eO.call(eR).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eN=function(e){return!!(0,ew.A)(e)&&(!e_||!(e_ in e))&&(eE(e)?eT:ek).test(eC(e))},ej=function(e,t){var r=null==e?void 0:e[t];return eN(r)?r:void 0};var eA=ej(ex.A,"Map"),e$=ej(Object,"create"),eI=Object.prototype.hasOwnProperty,eM=Object.prototype.hasOwnProperty;function eL(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}eL.prototype.clear=function(){this.__data__=e$?e$(null):{},this.size=0},eL.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},eL.prototype.get=function(e){var t=this.__data__;if(e$){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return eI.call(t,e)?t[e]:void 0},eL.prototype.has=function(e){var t=this.__data__;return e$?void 0!==t[e]:eM.call(t,e)},eL.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=e$&&void 0===t?"__lodash_hash_undefined__":t,this};let eF=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eB=function(e,t){var r=e.__data__;return eF(t)?r["string"==typeof t?"string":"hash"]:r.map};function eU(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eV(e){var t=this.__data__=new eb(e);this.size=t.size}eU.prototype.clear=function(){this.size=0,this.__data__={hash:new eL,map:new(eA||eb),string:new eL}},eU.prototype.delete=function(e){var t=eB(this,e).delete(e);return this.size-=!!t,t},eU.prototype.get=function(e){return eB(this,e).get(e)},eU.prototype.has=function(e){return eB(this,e).has(e)},eU.prototype.set=function(e,t){var r=eB(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},eV.prototype.clear=function(){this.__data__=new eb,this.size=0},eV.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},eV.prototype.get=function(e){return this.__data__.get(e)},eV.prototype.has=function(e){return this.__data__.has(e)},eV.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!eA||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new eU(n)}return r.set(e,t),this.size=r.size,this};var eW=function(){try{var e=ej(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let eH=function(e,t,r){"__proto__"==t&&eW?eW(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},ez=function(e,t,r){(void 0===r||eg(e[t],r))&&(void 0!==r||t in e)||eH(e,t,r)},eK=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var s=a[++n];if(!1===t(o[s],s,o))break}return e};var eG="object"==typeof exports&&exports&&!exports.nodeType&&exports,eZ=eG&&"object"==typeof module&&module&&!module.nodeType&&module,eY=eZ&&eZ.exports===eG?ex.A.Buffer:void 0,eq=eY?eY.allocUnsafe:void 0;let eJ=function(e,t){if(t)return e.slice();var r=e.length,n=eq?eq(r):new e.constructor(r);return e.copy(n),n};var eX=ex.A.Uint8Array;let eQ=function(e){var t=new e.constructor(e.byteLength);return new eX(t).set(new eX(e)),t},e0=function(e,t){var r=t?eQ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},e1=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t};var e2=Object.create,e4=function(){function e(){}return function(t){if(!(0,ew.A)(t))return{};if(e2)return e2(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),e3=Object.prototype;let e6=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||e3)},e5=function(e){return"function"!=typeof e.constructor||e6(e)?{}:e4(eu(e))},e9=function(e){return(0,ec.A)(e)&&"[object Arguments]"==(0,es.A)(e)};var e8=Object.prototype,e7=e8.hasOwnProperty,te=e8.propertyIsEnumerable,tt=e9(function(){return arguments}())?e9:function(e){return(0,ec.A)(e)&&e7.call(e,"callee")&&!te.call(e,"callee")},tr=Array.isArray;let tn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},to=function(e){return null!=e&&tn(e.length)&&!eE(e)};var ta="object"==typeof exports&&exports&&!exports.nodeType&&exports,ti=ta&&"object"==typeof module&&module&&!module.nodeType&&module,ts=ti&&ti.exports===ta?ex.A.Buffer:void 0;let tl=(ts?ts.isBuffer:void 0)||function(){return!1};var tu={};tu["[object Float32Array]"]=tu["[object Float64Array]"]=tu["[object Int8Array]"]=tu["[object Int16Array]"]=tu["[object Int32Array]"]=tu["[object Uint8Array]"]=tu["[object Uint8ClampedArray]"]=tu["[object Uint16Array]"]=tu["[object Uint32Array]"]=!0,tu["[object Arguments]"]=tu["[object Array]"]=tu["[object ArrayBuffer]"]=tu["[object Boolean]"]=tu["[object DataView]"]=tu["[object Date]"]=tu["[object Error]"]=tu["[object Function]"]=tu["[object Map]"]=tu["[object Number]"]=tu["[object Object]"]=tu["[object RegExp]"]=tu["[object Set]"]=tu["[object String]"]=tu["[object WeakMap]"]=!1;let tc=function(e){return function(t){return e(t)}};var td=r(2136),tf="object"==typeof exports&&exports&&!exports.nodeType&&exports,tp=tf&&"object"==typeof module&&module&&!module.nodeType&&module,tm=tp&&tp.exports===tf&&td.A.process,th=function(){try{var e=tp&&tp.require&&tp.require("util").types;if(e)return e;return tm&&tm.binding&&tm.binding("util")}catch(e){}}(),tg=th&&th.isTypedArray,ty=tg?tc(tg):function(e){return(0,ec.A)(e)&&tn(e.length)&&!!tu[(0,es.A)(e)]};let tv=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tb=Object.prototype.hasOwnProperty;let tw=function(e,t,r){var n=e[t];tb.call(e,t)&&eg(n,r)&&(void 0!==r||t in e)||eH(e,t,r)},tE=function(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var s=t[a],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),o?eH(r,s,l):tw(r,s,l)}return r},tx=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tD=/^(?:0|[1-9]\d*)$/;let t_=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&tD.test(e))&&e>-1&&e%1==0&&e<t};var tS=Object.prototype.hasOwnProperty;let tC=function(e,t){var r=tr(e),n=!r&&tt(e),o=!r&&!n&&tl(e),a=!r&&!n&&!o&&ty(e),i=r||n||o||a,s=i?tx(e.length,String):[],l=s.length;for(var u in e)(t||tS.call(e,u))&&!(i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||t_(u,l)))&&s.push(u);return s},tk=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t};var tP=Object.prototype.hasOwnProperty;let tO=function(e){if(!(0,ew.A)(e))return tk(e);var t=e6(e),r=[];for(var n in e)"constructor"==n&&(t||!tP.call(e,n))||r.push(n);return r},tR=function(e){return to(e)?tC(e,!0):tO(e)},tT=function(e,t,r,n,o,a,i){var s=tv(e,r),l=tv(t,r),u=i.get(l);if(u)return void ez(e,r,u);var c=a?a(s,l,r+"",e,t,i):void 0,d=void 0===c;if(d){var f=tr(l),p=!f&&tl(l),m=!f&&!p&&ty(l);(c=l,f||p||m)?tr(s)?c=s:(0,ec.A)(s)&&to(s)?c=e1(s):p?(d=!1,c=eJ(l,!0)):m?(d=!1,c=e0(l,!0)):c=[]:eh(l)||tt(l)?(c=s,tt(s))?c=tE(s,tR(s)):(!(0,ew.A)(s)||eE(s))&&(c=e5(l)):d=!1}d&&(i.set(l,c),o(c,l,n,a,i),i.delete(l)),ez(e,r,c)},tN=function e(t,r,n,o,a){t!==r&&eK(r,function(i,s){if(a||(a=new eV),(0,ew.A)(i))tT(t,r,s,n,e,o,a);else{var l=o?o(tv(t,s),i,s+"",t,r,a):void 0;void 0===l&&(l=i),ez(t,s,l)}},tR)},tj=function(e){return e},tA=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)};var t$=Math.max;let tI=function(e,t,r){return t=t$(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=t$(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),tA(e,this,s)}};var tM=Date.now,tL=(Z=eW?function(e,t){return eW(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:tj,Y=0,q=0,function(){var e=tM(),t=16-(e-q);if(q=e,t>0){if(++Y>=800)return arguments[0]}else Y=0;return Z.apply(void 0,arguments)});let tF=function(e,t,r){if(!(0,ew.A)(r))return!1;var n=typeof t;return("number"==n?!!(to(r)&&t_(t,r.length)):"string"==n&&t in r)&&eg(r[t],e)},tB=function(e){var t;return tL(tI(t=function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,i=o>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,i&&tF(r[0],r[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++n<o;){var s=r[n];s&&e(t,s,n,a)}return t},void 0,tj),t+"")};var tU=tB(function(e,t,r,n){tN(e,t,r,n)});function tV(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new eU;++t<r;)this.add(e[t])}tV.prototype.add=tV.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tV.prototype.has=function(e){return this.__data__.has(e)};let tW=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},tH=function(e,t,r,n,o,a){var i=1&r,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,p=2&r?new tV:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(n)var g=i?n(h,m,d,t,e,a):n(m,h,d,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!tW(t,function(e,t){if(!p.has(t)&&(m===e||o(m,e,r,n,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||o(m,h,r,n,a))){f=!1;break}}return a.delete(e),a.delete(t),f};var tz=r(241);let tK=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r},tG=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r};var tZ=tz.A?tz.A.prototype:void 0,tY=tZ?tZ.valueOf:void 0;let tq=function(e,t,r,n,o,a,i){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!a(new eX(e),new eX(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return eg(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=tK;case"[object Set]":var l=1&n;if(s||(s=tG),e.size!=t.size&&!l)break;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var c=tH(s(e),s(t),n,o,a,i);return i.delete(e),c;case"[object Symbol]":if(tY)return tY.call(e)==tY.call(t)}return!1},tJ=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},tX=function(e,t,r){var n=t(e);return tr(e)?n:tJ(n,r(e))},tQ=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a},t0=function(){return[]};var t1=Object.prototype.propertyIsEnumerable,t2=Object.getOwnPropertySymbols,t4=t2?function(e){return null==e?[]:tQ(t2(e=Object(e)),function(t){return t1.call(e,t)})}:t0,t3=el(Object.keys,Object),t6=Object.prototype.hasOwnProperty;let t5=function(e){if(!e6(e))return t3(e);var t=[];for(var r in Object(e))t6.call(e,r)&&"constructor"!=r&&t.push(r);return t},t9=function(e){return to(e)?tC(e):t5(e)},t8=function(e){return tX(e,t9,t4)};var t7=Object.prototype.hasOwnProperty;let re=function(e,t,r,n,o,a){var i=1&r,s=t8(e),l=s.length;if(l!=t8(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:t7.call(t,c)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=i;++u<l;){var h=e[c=s[u]],g=t[c];if(n)var y=i?n(g,h,c,t,e,a):n(h,g,c,e,t,a);if(!(void 0===y?h===g||o(h,g,r,n,a):y)){p=!1;break}m||(m="constructor"==c)}if(p&&!m){var v=e.constructor,b=t.constructor;v!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b)&&(p=!1)}return a.delete(e),a.delete(t),p};var rt=ej(ex.A,"DataView"),rr=ej(ex.A,"Promise"),rn=ej(ex.A,"Set"),ro=ej(ex.A,"WeakMap"),ra="[object Map]",ri="[object Promise]",rs="[object Set]",rl="[object WeakMap]",ru="[object DataView]",rc=eC(rt),rd=eC(eA),rf=eC(rr),rp=eC(rn),rm=eC(ro),rh=es.A;(rt&&rh(new rt(new ArrayBuffer(1)))!=ru||eA&&rh(new eA)!=ra||rr&&rh(rr.resolve())!=ri||rn&&rh(new rn)!=rs||ro&&rh(new ro)!=rl)&&(rh=function(e){var t=(0,es.A)(e),r="[object Object]"==t?e.constructor:void 0,n=r?eC(r):"";if(n)switch(n){case rc:return ru;case rd:return ra;case rf:return ri;case rp:return rs;case rm:return rl}return t});let rg=rh;var ry="[object Arguments]",rv="[object Array]",rb="[object Object]",rw=Object.prototype.hasOwnProperty;let rE=function(e,t,r,n,o,a){var i=tr(e),s=tr(t),l=i?rv:rg(e),u=s?rv:rg(t);l=l==ry?rb:l,u=u==ry?rb:u;var c=l==rb,d=u==rb,f=l==u;if(f&&tl(e)){if(!tl(t))return!1;i=!0,c=!1}if(f&&!c)return a||(a=new eV),i||ty(e)?tH(e,t,r,n,o,a):tq(e,t,l,r,n,o,a);if(!(1&r)){var p=c&&rw.call(e,"__wrapped__"),m=d&&rw.call(t,"__wrapped__");if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||(a=new eV),o(h,g,r,n,a)}}return!!f&&(a||(a=new eV),re(e,t,r,n,o,a))},rx=function(e,t){return function e(t,r,n,o,a){return t===r||(null!=t&&null!=r&&((0,ec.A)(t)||(0,ec.A)(r))?rE(t,r,n,o,e,a):t!=t&&r!=r)}(e,t)},rD=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},r_=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e};var rS=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tJ(t,t4(e)),e=eu(e);return t}:t0;let rC=function(e){return tX(e,tR,rS)};var rk=Object.prototype.hasOwnProperty;let rP=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&rk.call(e,"index")&&(r.index=e.index,r.input=e.input),r},rO=function(e,t){var r=t?eQ(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)};var rR=/\w*$/;let rT=function(e){var t=new e.constructor(e.source,rR.exec(e));return t.lastIndex=e.lastIndex,t};var rN=tz.A?tz.A.prototype:void 0,rj=rN?rN.valueOf:void 0;let rA=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return eQ(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return rO(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return e0(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return rT(e);case"[object Symbol]":return rj?Object(rj.call(e)):{}}};var r$=th&&th.isMap,rI=r$?tc(r$):function(e){return(0,ec.A)(e)&&"[object Map]"==rg(e)},rM=th&&th.isSet,rL=rM?tc(rM):function(e){return(0,ec.A)(e)&&"[object Set]"==rg(e)},rF="[object Arguments]",rB="[object Function]",rU="[object Object]",rV={};rV[rF]=rV["[object Array]"]=rV["[object ArrayBuffer]"]=rV["[object DataView]"]=rV["[object Boolean]"]=rV["[object Date]"]=rV["[object Float32Array]"]=rV["[object Float64Array]"]=rV["[object Int8Array]"]=rV["[object Int16Array]"]=rV["[object Int32Array]"]=rV["[object Map]"]=rV["[object Number]"]=rV[rU]=rV["[object RegExp]"]=rV["[object Set]"]=rV["[object String]"]=rV["[object Symbol]"]=rV["[object Uint8Array]"]=rV["[object Uint8ClampedArray]"]=rV["[object Uint16Array]"]=rV["[object Uint32Array]"]=!0,rV["[object Error]"]=rV[rB]=rV["[object WeakMap]"]=!1;let rW=function e(t,r,n,o,a,i){var s,l=1&r,u=2&r,c=4&r;if(n&&(s=a?n(t,o,a,i):n(t)),void 0!==s)return s;if(!(0,ew.A)(t))return t;var d=tr(t);if(d){if(s=rP(t),!l)return e1(t,s)}else{var f,p,m,h,g=rg(t),y=g==rB||"[object GeneratorFunction]"==g;if(tl(t))return eJ(t,l);if(g==rU||g==rF||y&&!a){if(s=u||y?{}:e5(t),!l)return u?(p=(f=s)&&tE(t,tR(t),f),tE(t,rS(t),p)):(h=(m=s)&&tE(t,t9(t),m),tE(t,t4(t),h))}else{if(!rV[g])return a?t:{};s=rA(t,g,l)}}i||(i=new eV);var v=i.get(t);if(v)return v;i.set(t,s),rL(t)?t.forEach(function(o){s.add(e(o,r,n,o,t,i))}):rI(t)&&t.forEach(function(o,a){s.set(a,e(o,r,n,a,t,i))});var b=c?u?rC:t8:u?tR:t9,w=d?void 0:b(t);return r_(w||t,function(o,a){w&&(o=t[a=o]),tw(s,a,e(o,r,n,a,t,i))}),s};var rH=r(1882),rz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rK=/^\w*$/;let rG=function(e,t){if(tr(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||(0,rH.A)(e))||rK.test(e)||!rz.test(e)||null!=t&&e in Object(t)};function rZ(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(rZ.Cache||eU),r}rZ.Cache=eU;var rY=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rq=/\\(\\)?/g,rJ=(X=(J=rZ(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rY,function(e,r,n,o){t.push(n?o.replace(rq,"$1"):r||e)}),t},function(e){return 500===X.size&&X.clear(),e})).cache,J),rX=1/0,rQ=tz.A?tz.A.prototype:void 0,r0=rQ?rQ.toString:void 0;let r1=function e(t){if("string"==typeof t)return t;if(tr(t))return rD(t,e)+"";if((0,rH.A)(t))return r0?r0.call(t):"";var r=t+"";return"0"==r&&1/t==-rX?"-0":r},r2=function(e,t){return tr(e)?e:rG(e,t)?[e]:rJ(null==e?"":r1(e))},r4=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var r3=1/0;let r6=function(e){if("string"==typeof e||(0,rH.A)(e))return e;var t=e+"";return"0"==t&&1/e==-r3?"-0":t},r5=function(e,t){t=r2(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[r6(t[r++])];return r&&r==n?e:void 0},r9=function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a},r8=function(e,t){var r,n;return t=r2(t,e),r=e,null==(e=(n=t).length<2?r:r5(r,r9(n,0,-1)))||delete e[r6(r4(t))]},r7=function(e){return eh(e)?void 0:e};var ne=tz.A?tz.A.isConcatSpreadable:void 0;let nt=function(e){return tr(e)||tt(e)||!!(ne&&e&&e[ne])},nr=function e(t,r,n,o,a){var i=-1,s=t.length;for(n||(n=nt),a||(a=[]);++i<s;){var l=t[i];r>0&&n(l)?r>1?e(l,r-1,n,o,a):tJ(a,l):o||(a[a.length]=l)}return a};var nn=tL(tI(Q=function(e,t){var r={};if(null==e)return r;var n=!1;t=rD(t,function(t){return t=r2(t,e),n||(n=t.length>1),t}),tE(e,rC(e),r),n&&(r=rW(r,7,r7));for(var o=t.length;o--;)r8(r,t[o]);return r},void 0,function(e){return(null==e?0:e.length)?nr(e,1):[]}),Q+""),no=((ee={}).Array="Array",ee.Boolean="Boolean",ee.ConceptUuid="ConceptUuid",ee.Number="Number",ee.Object="Object",ee.String="String",ee.UUID="UUID",ee.PersonAttributeTypeUuid="PersonAttributeTypeUuid",ee.PatientIdentifierTypeUuid="PatientIdentifierTypeUuid",ee);function na(e,t){return r=>{if(!e(r))if("function"==typeof t)return t(r);else return t}}let ni=na(e=>Array.isArray(e),"must be an array"),ns=na(e=>"boolean"==typeof e,"must be a boolean"),nl=na(e=>"number"==typeof e,"must be a number"),nu=na(e=>"string"==typeof e,"must be a string"),nc=na(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),nd=na(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)||/^[0-9a-f]{36}$/i.test(e),"must be a valid UUID or a 36-character hexadecimal string"),nf=B("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{},moduleStarted:{}}),np=B("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});np.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let nm=B("config-store-of-extension-state",{mountedExtensions:[]});function nh(e){return W(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function ng(){return W("config-extension-slots",{slots:{}})}function ny(e){return nv(ng().getState(),e)}function nv(e,t){return e.slots[t]??{loaded:!1,config:{}}}function nb(){return W("config-extensions",{configs:{}})}function nw(e,t,r){return e.configs[t]?.[r]??{loaded:!1,config:null}}function nE(e,t,r){return e.configure?.[r]??null}let nx=A()(()=>({config:{}})),nD=0,n_=!0,nS=!1;function nC(e){n=e}function nk(){n_=!0,nD>0&&nP()}function nP(){if(n_&&n&&!nS){nS=!0,n_=!1;try{n()}catch(e){n_=!0,nO(e),console.error("Failed to derive the implementer tools config",e)}finally{nS=!1}}}function nO(e){nx.setState({derivationError:e instanceof Error?e.message:String(e)})}function nR(){nx.getState().derivationError&&nx.setState({derivationError:void 0})}let nT=V("config-implementer-tools",{...nx,getState:()=>(0===nD&&nP(),nx.getState()),setState:(...e)=>(n_=!1,nx.setState(...e)),subscribe(e){nD++,nP();let t=nx.subscribe(e),r=!1;return()=>{!r&&(r=!0,nD--),t()}}});function nN(e,t){if(Array.isArray(t))return t}function nj(e,t){return tU({},e,t,nN)}let nA=[],n$=new Set,nI=null,nM=new WeakMap;function nL(){n=()=>{var e,t;let r,n;return e=nf.getState(),t=np.getState(),r=nT.getState(),n={config:function(e,t){let r=function(e){let t={};for(let[r,n]of Object.entries(e)){let e=n0.get(r);if(e&&e.schema===n)t[r]=e.annotated;else{let e=function e(t){return t.hasOwnProperty("_default")?{...t,_value:t._default,_source:"default"}:ot(t)?Object.keys(t).reduce((r,n)=>(r[n]=e(t[n]),r),{}):{}}(rW(n,5));n0.set(r,{schema:n,annotated:e}),t[r]=e}}return t}(e.schemas),n=[...e.providedConfigs.map(e=>[e.config,e.source]),[t.config,"temporary config"]],o=new Set(Object.keys(r));for(let[e]of n)for(let t of Object.keys(e))o.add(t);let a={};for(let e of o){let t=r[e],o=n.map(([t])=>t[e]),i=n.map(([,e])=>e),s=nQ.get(e);if(s&&s.annotatedSchema===t&&s.configSlices.length===o.length&&s.configSlices.every((e,t)=>e===o[t])&&s.sources.every((e,t)=>e===i[t])){a[e]=s.result;continue}let l=t??{};n.forEach(([,e],t)=>{let r=o[t];void 0!==r&&(l=nj(l,function e(t,r){return ot(t)?Object.keys(t).reduce((n,o)=>(n[o]=e(t[o],r),n),{}):{_value:t,_source:r}}(r,e)))}),nQ.set(e,{annotatedSchema:t,configSlices:o,sources:i,result:l}),a[e]=l}return a}(e,t)},void(rx(r.config,n.config)||nT.setState(n))},nF(),nA.push(nf.subscribe(nF),np.subscribe(nF),nm.subscribe(nF))}function nF(){nR();try{!function(){let e=nf.getState(),t=np.getState(),r=nm.getState();if(nI?.configState===e&&nI.tempConfigState===t)return nU(e,r,t,nI.slotConfigs,!0);!function(e,t){for(let r of Object.keys(e.schemas)){let n,o=nh(r),a=e.schemas[r],i=!!e.moduleLoaded[r],s=nB.get(r);if(s&&s.schema===a&&s.moduleLoaded===i&&s.providedConfigs===e.providedConfigs&&s.temporaryConfig===t.config)n=s.state;else{let o=i?function(e,t,r){let n=t.schemas[e],o=n4(e,n1(t,r));n6(n,o,e);let a=n7(n,o);return n5(n,a,e),delete a.extensionSlots,a}(r,e,t):function(e,t,r){let n=n7(oi,n4(e,n1(t,r)));return n5(oi,n,e),delete n.extensionSlots,n}(r,e,t);n={translationOverridesLoaded:!0,loaded:i,config:o},nB.set(r,{schema:a,moduleLoaded:i,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:n})}let l=o.getState();l.loaded===n.loaded&&l.translationOverridesLoaded===n.translationOverridesLoaded&&rx(l.config,n.config)||o.setState(n)}}(e,t);let n=function(e,t){let r=n3(n1(e,t)),n=Object.keys(r).reduce((e,t)=>(r[t]?.extensionSlots&&(e[t]=r[t]?.extensionSlots),e),{});var o=n;for(let[e,t]of Object.entries(o))for(let[r,n]of Object.entries(t))!function(e,t,r){let n=`${t}.extensionSlots.${r}`,o=`Extension slot config '${n}'`,a=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));a.length&&or(n,o+`' contains invalid keys '${a.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||or(n,o+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||or(n,o+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||or(n,o+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!ot(e.configure)&&or(n,o+".configure' is invalid. Must be an object with extension IDs for keys")}(n,e,r);let a={},i={};for(let e of Object.values(n))for(let[t,r]of Object.entries(e))a[t]=r,r.configure&&(i[t]??(i[t]=[])).push(r.configure);for(let[e,t]of Object.entries(i)){let r=1===t.length?t[0]:n3(t);a[e].configure!==r&&(a[e]={...a[e],configure:r})}return a}(e,t);(function(e){let t=ng(),r=t.getState().slots,n={},o=!1;for(let[t,a]of Object.entries(e)){let e=r[t];e?.loaded&&rx(e.config,a)?n[t]=e:(n[t]={loaded:!0,config:a},o=!0)}(o||Object.keys(r).length!==Object.keys(n).length)&&t.setState({slots:n})})(n),nU(e,r,t,n,!1),nI={configState:e,tempConfigState:t,slotConfigs:n},nk()}()}catch(e){nO(e),console.error("Failed to recompute the configuration",e)}}nL();let nB=new Map;function nU(e,t,r,n,o){let a=nb(),i=a.getState().configs,s={},l=!1,u=0;for(let a of t.mountedExtensions){let t,c=i[a.slotName]?.[a.extensionId],d=c&&nM.get(c);if(o&&c?.loaded&&d?.slotModuleName===a.slotModuleName&&d.extensionModuleName===a.extensionModuleName)t=c;else{let o=function(e,t,r,n,o,a,i){let s=function(e){let[t]=e.split("#");return t}(n),l=o.schemas[s],u=!!o.moduleStarted[t],c=JSON.stringify([r,n,e,t]),d=nX.get(c);if(d&&d.extensionSchema===l&&d.extensionModuleSchema===o.schemas[t]&&d.extensionModuleStarted===u&&d.providedConfigs===o.providedConfigs&&d.temporaryConfig===a.config)return d.config;let f=l?s:t,p=n1(o,a),m=i?.configure?.[n]??{},h=n4(e,p),g=h?.extensionSlots?.[r]?.configure?.[n]??{},y=n3([n4(f,p),m,g]),v=l??o.schemas[t];(l||u)&&n6(v,y,f);let b=n7(v,y);return n5(v,b,f),delete b.extensionSlots,nX.set(c,{extensionSchema:l,extensionModuleSchema:o.schemas[t],extensionModuleStarted:u,providedConfigs:o.providedConfigs,temporaryConfig:a.config,config:b}),b}(a.slotModuleName,a.extensionModuleName,a.slotName,a.extensionId,e,r,n[a.slotName]);t=c?.loaded&&rx(c.config,o)?c:{config:o,loaded:!0}}nM.set(t,a),t!==c&&(l=!0),s[a.slotName]||(s[a.slotName]={}),s[a.slotName][a.extensionId]=t,u++}for(let[e,t]of Object.entries(s)){let r=i[e];r&&Object.keys(r).length===Object.keys(t).length&&Object.entries(t).every(([e,t])=>r[e]===t)&&(s[e]=r)}l||(l=Object.keys(i).length!==Object.keys(s).length||Object.values(i).reduce((e,t)=>e+Object.keys(t).length,0)!==u),l&&a.setState({configs:s})}function nV(e,t){n2(e,t);let r=nj(t,oi);nf.setState(t=>({...t,schemas:{...t.schemas,[e]:r},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nW(e){nf.setState(t=>({...t,schemas:{...t.schemas,[e]:oi}}))}function nH(e){nf.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0},moduleStarted:{...t.moduleStarted,[e]:!0}}))}function nz(e){nf.setState(t=>({...t,schemas:{...t.schemas,[e]:oa}}))}function nK(e,t){n2(e,t);let r=nj(t,oi);nf.getState().schemas[e]&&console.error(`Config schema for extension ${e} already exists. If there are multiple extensions with this same name, one will probably crash.`),nf.setState(t=>({...t,schemas:{...t.schemas,[e]:r}}))}function nG(e,t="provided"){nf.setState(r=>({...r,providedConfigs:[...r.providedConfigs,{source:t,config:e}]}))}function nZ(e,t,r){return new Promise(n=>{let o,a=!1;function i(e){!a&&t(e)&&(a=!0,n(r(e)),o?.())}i(e.getState()),a||(o=e.subscribe(i))})}function nY(e){return nZ(nh(e),e=>!!(e.loaded&&e.config),e=>nn(e.config,["Display conditions","Translation overrides"]))}function nq(e,t,r){let n=[e in nf.getState().schemas?nZ(nh(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&r){let e=nw(nb().getState(),t,r),o=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};n.push(Promise.resolve(o))}return Promise.all(n)}function nJ(e,t,r){n6(e,t,r);let n=n7(e,t);return n5(e,n,r),n}let nX=new Map,nQ=new Map,n0=new Map;function n1(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function n2(e,t,r=""){let n="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let o of Object.keys(t).filter(e=>!e.startsWith("_"))){let a=r+(r&&".")+o,i=t[o];if("Display conditions"===a&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${n}`),"Translation overrides"===a&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${n}`),!ot(i)){console.error(`${e} has bad config schema definition for key '${a}'. ${n}`);continue}i.hasOwnProperty("_default")||n2(e,i,a);let s=i._elements;if(oe(s)&&n2(e,s,a+"._elements"),i._validators)for(let t of i._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${a}' ${n}.
|
|
4
4
|
|
|
5
5
|
If you're the maintainer: validators must be functions that return either undefined or an error string. Received ${t}.`);let l=i._type;l&&!Object.values(no).includes(l)&&console.error(`${e} has invalid type for key '${a}' ${n}.
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ If you're the maintainer: the 'elements' key only works with '_type' equal to 'A
|
|
|
12
12
|
${t}`)}return n}let n7=(e,t)=>{let r=structuredClone(t);if(!e)return r;for(let t of Object.keys(e)){let n=r[t],o=e[t];if(o&&(o.hasOwnProperty("_type")||o.hasOwnProperty("_default"))){r.hasOwnProperty(t)||(r[t]=o._default);let e=o._elements;if(n&&oe(e)){if(o._type===no.Array&&Array.isArray(n)){let o=n.map(t=>n7(e,t));r[t]=o}else if(o._type===no.Object)for(let t of Object.keys(n))n[t]=n7(e,n[t])}}else if(ot(o)){let e=n??{};ot(e)&&(r[t]=n7(o,e))}}return r};function oe(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function ot(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function or(e,t){let r=`${e}:::${t}`;n$.has(r)||(console.error(t),n$.add(r))}function on(e){e?n$.forEach(t=>{t.startsWith(e)&&n$.delete(t)}):n$.clear()}function oo(){nA.forEach(e=>e()),nA.length=0,nB.clear(),nX.clear(),n0.clear(),nQ.clear(),nI=null,nM=new WeakMap,nL()}let oa={"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:no.Object,_default:{},_validators:[na(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(", ")}.`})]}},oi={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:no.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:no.String,_default:void 0}},...oa},os=(e,t)=>na(r=>e<=r&&r<=t,`must be between ${e} and ${t}`),ol=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return na(e=>{if(!e||"string"!=typeof e)return!1;let r=/\${(.*?)}/g,n=r.exec(e);for(;n;){if(!t.includes(n[1]))return!1;n=r.exec(e)}return!0},"Should be a URL or path. The allowed template parameters are "+t.map(e=>"${"+e+"}").join(", "))},ou=ol([]),oc=e=>na(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),od={inRange:os,isUrl:ou,isUrlWithTemplateParameters:ol,oneOf:oc};var of=r(8067);let op=B("breadcrumbs",[]);function om(e){return oh([e])}function oh(e){let t=[...og(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,of.pathToRegexp)(e.matcher).regexp:(0,of.pathToRegexp)(e.path).regexp,settings:e}))];op.setState(t,!0)}function og(){return op.getState()}function oy(e,t){if(t)return function(e,t){let[r]=e.filter(e=>e.matcher.test(t));return r}(e,t)||function(e,t){let r=t.split("/");for(;r.length>1;){r.pop();let t=oy(e,r.join("/"));if(t)return t}}(e,t)}function ov(e,t){if(e.length>0){let r=oy(e,t);if(r){let t=[r],n=oy(e,r.settings.parent);for(;void 0!==n;)t.push(n),n=oy(e,n.settings.parent);return t.reverse()}}return[]}function ob(e){return ov(og(),e)}var ow=Object.freeze({__proto__:null,get start(){return aH},get ensureJQuerySupport(){return ab},get setBootstrapMaxTime(){return ae},get setMountMaxTime(){return at},get setUnmountMaxTime(){return ar},get setUnloadMaxTime(){return an},get registerApplication(){return aR},get unregisterApplication(){return aN},get getMountedApps(){return aC},get getAppStatus(){return aP},get unloadApplication(){return aj},get checkActivityFunctions(){return aT},get getAppNames(){return ak},get pathToActiveWhen(){return aI},get navigateToUrl(){return ac},get patchHistoryApi(){return ag},get triggerAppChange(){return aB},get addErrorHandler(){return oS},get removeErrorHandler(){return oC},get mountRootParcel(){return o6},get NOT_LOADED(){return oO},get LOADING_SOURCE_CODE(){return oR},get NOT_BOOTSTRAPPED(){return oT},get BOOTSTRAPPING(){return oN},get NOT_MOUNTED(){return oj},get MOUNTING(){return oA},get UPDATING(){return oI},get LOAD_ERROR(){return oF},get MOUNTED(){return o$},get UNLOADING(){return oL},get UNMOUNTING(){return oM},get SKIP_BECAUSE_BROKEN(){return oB}}),oE=("u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{}).CustomEvent,ox=!function(){try{var e=new oE("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 r=document.createEvent("CustomEvent");return t?r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):r.initCustomEvent(e,!1,!1,void 0),r}:function(e,t){var r=document.createEventObject();return r.type=e,t?(r.bubbles=!!t.bubbles,r.cancelable=!!t.cancelable,r.detail=t.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r}:oE;let oD=[];function o_(e,t,r){let n=oP(e,t,r);oD.length?oD.forEach(e=>e(n)):setTimeout(()=>{throw n})}function oS(e){if("function"!=typeof e)throw Error(ok(28,!1));oD.push(e)}function oC(e){if("function"!=typeof e)throw Error(ok(29,!1));let t=!1;return oD=oD.filter(r=>{let n=r===e;return t=t||n,!n}),t}function ok(e,t,...r){return`single-spa minified message #${e}: ${t?t+" ":""}See https://single-spa.js.org/error/?code=${e}${r.length?`&arg=${r.join("&arg=")}`:""}`}function oP(e,t,r){let n,o=`${oz(t)} '${oW(t)}' died in status ${t.status}: `;if(e instanceof Error){try{e.message=o+e.message}catch(e){}n=e}else{console.warn(ok(30,!1,t.status,oW(t)));try{n=Error(o+JSON.stringify(e))}catch(t){n=e}}return n.appOrParcelName=oW(t),t.status=r,n}let oO="NOT_LOADED",oR="LOADING_SOURCE_CODE",oT="NOT_BOOTSTRAPPED",oN="BOOTSTRAPPING",oj="NOT_MOUNTED",oA="MOUNTING",o$="MOUNTED",oI="UPDATING",oM="UNMOUNTING",oL="UNLOADING",oF="LOAD_ERROR",oB="SKIP_BECAUSE_BROKEN";function oU(e){return e.status===o$}function oV(e){try{return e.activeWhen(window.location)}catch(t){return o_(t,e,oB),!1}}function oW(e){return e.name}function oH(e){return!!e.unmountThisParcel}function oz(e){return oH(e)?"parcel":"application"}function oK(){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 oG(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r];return null}function oZ(e){return e&&("function"==typeof e||Array.isArray(e)&&!oG(e,e=>"function"!=typeof e))}function oY(e,t){let r=e[t]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[()=>Promise.resolve()]);let n=oz(e),o=oW(e);return function(e){return r.reduce((r,a,i)=>r.then(()=>{let r=a(e);return oq(r)?r:Promise.reject(ok(15,!1,n,o,t,i))}),Promise.resolve())}}function oq(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}let oJ=[];function oX(e,t){return Promise.resolve().then(()=>e.status!==oT?e:(e.status=oN,e.bootstrap?ao(e,"bootstrap").then(r).catch(r=>{if(t)throw oP(r,e,oB);return o_(r,e,oB),e}):Promise.resolve().then(r)));function r(){return e.status=oj,e}}function oQ(e,t){return Promise.resolve().then(()=>{if(e.status!==o$)return e;return e.status=oM,Promise.all(Object.keys(e.parcels).map(t=>e.parcels[t].unmountThisParcel())).then(r,n=>r().then(()=>{let r=Error(n.message);if(t)throw oP(r,e,oB);o_(r,e,oB)})).then(()=>e);function r(){return ao(e,"unmount").then(()=>{e.status=oj},r=>{if(t)throw oP(r,e,oB);o_(r,e,oB)})}})}let o0=!1,o1=!1;function o2(e,t){return Promise.resolve().then(()=>e.status!==oj?e:(o0||(window.dispatchEvent(new ox("single-spa:before-first-mount")),o0=!0),e.status=oA,ao(e,"mount").then(()=>(e.status=o$,o1||(window.dispatchEvent(new ox("single-spa:first-mount")),o1=!0),e)).catch(r=>{return e.status=o$,oQ(e,!0).then(n,n);function n(){if(t)throw oP(r,e,oB);return o_(r,e,oB),e}})))}let o4=0,o3={parcels:{}};function o6(){return o5.apply(o3,arguments)}function o5(e,t){let r,n,o,a=this;if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error(ok(2,!1));if(e.name&&"string"!=typeof e.name)throw Error(ok(3,!1,typeof e.name));let i=o4++,s=e.name||`parcel-${i}`;if("object"!=typeof t)throw Error(ok(4,!1,s,typeof t));if(!t.domElement)throw Error(ok(5,!1,s));let l="function"==typeof e,u=l?e:()=>Promise.resolve(e),c={id:i,parcels:{},status:l?oR:oT,customProps:t,parentName:oW(a),unmountThisParcel:()=>p.then(()=>{if(c.status!==o$)throw Error(ok(6,!1,s,c.status));return oQ(c,!0)}).then(e=>(c.parentName&&delete a.parcels[c.id],e)).then(e=>(n(e),e)).catch(e=>{throw c.status=oB,o(e),e})};a.parcels[i]=c;let d=u();if(!d||"function"!=typeof d.then)throw Error(ok(7,!1));let f=(d=d.then(e=>{if(!e)throw Error(ok(8,!1));if(s=e.name||`parcel-${i}`,Object.prototype.hasOwnProperty.call(e,"bootstrap")&&!oZ(e.bootstrap))throw Error(ok(9,!1,s));if(!oZ(e.mount))throw Error(ok(10,!1,s));if(!oZ(e.unmount))throw Error(ok(11,!1,s));if(e.update&&!oZ(e.update))throw Error(ok(12,!1,s));let t=oY(e,"bootstrap"),n=oY(e,"mount"),o=oY(e,"unmount");c.status=oT,c.name=s,c.bootstrap=t,c.mount=n,c.unmount=o,c.timeouts=aa(e.timeouts),e.update&&(c.update=oY(e,"update"),r.update=function(e){return c.customProps=e,o9(Promise.resolve().then(()=>{if(c.status!==o$)throw Error(ok(32,!1,oW(c)));return c.status=oI,ao(c,"update").then(()=>(c.status=o$,c)).catch(e=>{throw oP(e,c,oB)})}))})})).then(()=>oX(c,!0)),p=f.then(()=>o2(c,!0)),m=new Promise((e,t)=>{n=e,o=t});return r={mount:()=>o9(Promise.resolve().then(()=>{if(c.status!==oj)throw Error(ok(13,!1,s,c.status));return a.parcels[i]=c,o2(c)})),unmount:()=>o9(c.unmountThisParcel()),getStatus:()=>c.status,loadPromise:o9(d),bootstrapPromise:o9(f),mountPromise:o9(p),unmountPromise:o9(m)}}function o9(e){return e.then(()=>null)}function o8(e){let t=oW(e),r="function"==typeof e.customProps?e.customProps(t,window.location):e.customProps;("object"!=typeof r||null===r||Array.isArray(r))&&(r={},console.warn(ok(40,!1),t,r));let n=oK({},r,{name:t,mountParcel:o5.bind(e),singleSpa:ow});return oH(e)&&(n.unmountSelf=e.unmountThisParcel),n}let o7={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 ae(e,t,r){if("number"!=typeof e||e<=0)throw Error(ok(16,!1));o7.bootstrap={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function at(e,t,r){if("number"!=typeof e||e<=0)throw Error(ok(17,!1));o7.mount={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function ar(e,t,r){if("number"!=typeof e||e<=0)throw Error(ok(18,!1));o7.unmount={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function an(e,t,r){if("number"!=typeof e||e<=0)throw Error(ok(19,!1));o7.unload={millis:e,dieOnTimeout:t,warningMillis:r||1e3}}function ao(e,t){let r=e.timeouts[t],n=r.warningMillis,o=oz(e);return new Promise((a,i)=>{let s=!1,l=!1;e[t](o8(e)).then(e=>{s=!0,a(e)}).catch(e=>{s=!0,i(e)}),setTimeout(()=>c(1),n),setTimeout(()=>c(!0),r.millis);let u=ok(31,!1,t,o,oW(e),r.millis);function c(e){s||(!0===e?(l=!0,r.dieOnTimeout?i(Error(u)):console.error(u)):!l&&(console.warn(u),e*n+n<r.millis&&setTimeout(()=>c(e+1),n)))}})}function aa(e){let t={};for(let r in o7)t[r]=oK({},o7[r],e&&e[r]||{});return t}function ai(e){return Promise.resolve().then(()=>{let t,r;return e.loadPromise?e.loadPromise:e.status!==oO&&e.status!==oF?e:(e.status=oR,e.loadPromise=Promise.resolve().then(()=>{let n=e.loadApp(o8(e));if(!oq(n))throw r=!0,Error(ok(33,!1,oW(e)));return n.then(r=>{let n;e.loadErrorTime=null,"object"!=typeof(t=r)&&(n=34),Object.prototype.hasOwnProperty.call(t,"bootstrap")&&!oZ(t.bootstrap)&&(n=35),oZ(t.mount)||(n=36),oZ(t.unmount)||(n=37);let o=oz(t);if(n){let r;try{r=JSON.stringify(t)}catch(e){}return console.error(ok(n,!1,o,oW(e),r),t),o_(void 0,e,oB),e}return t.devtools&&t.devtools.overlays&&(e.devtools.overlays=oK({},e.devtools.overlays,t.devtools.overlays)),e.status=oT,e.bootstrap=oY(t,"bootstrap"),e.mount=oY(t,"mount"),e.unmount=oY(t,"unmount"),e.unload=oY(t,"unload"),e.timeouts=aa(t.timeouts),delete e.loadPromise,e})}).catch(t=>{let n;return delete e.loadPromise,r?n=oB:(n=oF,e.loadErrorTime=(new Date).getTime()),o_(t,e,n),e}))})}let as="u">typeof window,al={hashchange:[],popstate:[]},au=["hashchange","popstate"];function ac(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(ok(14,!1));t=e.currentTarget.href,e.preventDefault()}let r=ay(window.location.href),n=ay(t);0===t.indexOf("#")?window.location.hash=n.hash:r.host!==n.host&&n.host?window.location.href=t:n.pathname===r.pathname&&n.search===r.search?window.location.hash=n.hash:window.history.pushState(null,null,t)}function ad(e){if(e){let t=e[0].type;au.indexOf(t)>=0&&al[t].forEach(t=>{try{t.apply(this,e)}catch(e){setTimeout(()=>{throw e})}})}}function af(){aU([],arguments)}function ap(e,t){return function(){let r=window.location.href,n=e.apply(this,arguments),a=window.location.href;return o&&r===a||window.dispatchEvent(function(e,t){let r;try{r=new PopStateEvent("popstate",{state:e})}catch(t){(r=document.createEvent("PopStateEvent")).initPopStateEvent("popstate",!1,!1,e)}return r.singleSpa=!0,r.singleSpaTrigger=t,r}(window.history.state,t)),n}}let am=null,ah=!1;function ag(e){if(ah)throw Error(ok(43,!1));o=!e||!e.hasOwnProperty("urlRerouteOnly")||e.urlRerouteOnly,ah=!0,am=window.history.replaceState,window.addEventListener("hashchange",af),window.addEventListener("popstate",af);let t=window.addEventListener,r=window.removeEventListener;window.addEventListener=function(e,r){if(!("function"==typeof r&&au.indexOf(e)>=0)||oG(al[e],e=>e===r))return t.apply(this,arguments);al[e].push(r)},window.removeEventListener=function(e,t){return"function"==typeof t&&au.indexOf(e)>=0&&(al[e]=al[e].filter(e=>e!==t)),r.apply(this,arguments)},window.history.pushState=ap(window.history.pushState,"pushState"),window.history.replaceState=ap(am,"replaceState")}function ay(e){let t=document.createElement("a");return t.href=e,t}as&&(window.singleSpaNavigate?console.warn(ok(41,!1)):window.singleSpaNavigate=ac);let av=!1;function ab(e=window.jQuery){if(e||window.$&&window.$.fn&&window.$.fn.jquery&&(e=window.$),e&&!av){let t=e.fn.on,r=e.fn.off;e.fn.on=function(e,r){return aw.call(this,t,window.addEventListener,e,r,arguments)},e.fn.off=function(e,t){return aw.call(this,r,window.removeEventListener,e,t,arguments)},av=!0}}function aw(e,t,r,n,o){return"string"!=typeof r?e.apply(this,o):(r.split(/\s+/).forEach(e=>{au.indexOf(e)>=0&&(t(e,n),r=r.replace(e,""))}),""===r.trim()?this:e.apply(this,o))}let aE={};function ax(e){return Promise.resolve().then(()=>{let t=aE[oW(e)];if(!t)return e;if(e.status===oO)return aD(e,t),e;if(e.status===oL)return t.promise.then(()=>e);if(e.status!==oj&&e.status!==oF)return e;let r=e.status===oF?Promise.resolve():ao(e,"unload");return e.status=oL,r.then(()=>(aD(e,t),e)).catch(r=>(delete aE[oW(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,o_(r,e,oB),t.reject(r),e))})}function aD(e,t){delete aE[oW(e)],delete e.bootstrap,delete e.mount,delete e.unmount,delete e.unload,e.status=oO,t.resolve()}function a_(e,t,r,n){aE[oW(e)]={app:e,resolve:r,reject:n},Object.defineProperty(aE[oW(e)],"promise",{get:t})}let aS=[];function aC(){return aS.filter(oU).map(oW)}function ak(){return aS.map(oW)}function aP(e){let t=oG(aS,t=>oW(t)===e);return t?t.status:null}let aO=!1;function aR(e,t,r,n){var o,a;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(ok(39,!1));let t=["name","app","activeWhen","customProps"],r=Object.keys(e).reduce((e,r)=>t.indexOf(r)>=0?e:e.concat(r),[]);if(0!==r.length)throw Error(ok(38,!1,t.join(", "),r.join(", ")));if("string"!=typeof e.name||0===e.name.length||"object"!=typeof e.app&&"function"!=typeof e.app)throw Error(ok(20,!1));let n=e=>"string"==typeof e||"function"==typeof e;if(!(n(e.activeWhen)||Array.isArray(e.activeWhen)&&e.activeWhen.every(n)))throw Error(ok(24,!1));if(!a$(e.customProps))throw Error(ok(22,!1))}(e),i.name=e.name,i.loadApp=e.app,i.activeWhen=e.activeWhen,i.customProps=e.customProps):(function(e,t,r,n){if("string"!=typeof e||0===e.length)throw Error(ok(20,!1));if(!t)throw Error(ok(23,!1));if("function"!=typeof r)throw Error(ok(24,!1));if(!a$(n))throw Error(ok(22,!1))}(e,t,r,n),i.name=e,i.loadApp=t,i.activeWhen=r,i.customProps=n),i.loadApp="function"!=typeof(o=i.loadApp)?()=>Promise.resolve(o):o,i.customProps=i.customProps||{},s=(s=Array.isArray(a=i.activeWhen)?a:[a]).map(e=>"function"==typeof e?e:aI(e)),i.activeWhen=e=>s.some(t=>t(e)),i);if(aW||aO||(aO=!0,setTimeout(()=>{aW||console.warn(ok(1,!1))},5e3)),-1!==ak().indexOf(l.name))throw Error(ok(21,!1,l.name));aS.push(oK({loadErrorTime:null,status:oO,parcels:{},devtools:{overlays:{options:{},selectors:[]}}},l)),as&&(ab(),aU())}function aT(e=window.location){return aS.filter(t=>t.activeWhen(e)).map(oW)}function aN(e){if(0===aS.filter(t=>oW(t)===e).length)throw Error(ok(25,!1,e));return(as?aj(e,{waitForUnmount:!1}):Promise.resolve()).then(()=>{let t=aS.map(oW).indexOf(e);aS.splice(t,1)})}function aj(e,t={waitForUnmount:!1}){if("string"!=typeof e)throw Error(ok(26,!1));let r=oG(aS,t=>oW(t)===e);if(!r)throw Error(ok(27,!1,e));let n=aE[oW(r)];if(t&&t.waitForUnmount){if(n)return n.promise;{let e=new Promise((t,n)=>{a_(r,()=>e,t,n)});return e}}{let e;return n?(e=n.promise,aA(r,n.resolve,n.reject)):e=new Promise((t,n)=>{a_(r,()=>e,t,n),aA(r,t,n)}),e}}function aA(e,t,r){Promise.resolve().then(()=>{if(oG(aT(),t=>t===oW(e)))return aB()}).then(()=>oQ(e).then(ax).then(()=>{t(),setTimeout(()=>{aU()})})).catch(r)}function a$(e){return!e||"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)}function aI(e,t){let r=function(e,t){let r=0,n=!1,o="^";"/"!==e[0]&&(e="/"+e);for(let t=0;t<e.length;t++){let r=e[t],o=n&&"/"===r;(!n&&":"===r||o)&&a(t)}return a(e.length),RegExp(o,"i");function a(a){let i=e.slice(r,a).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&");if(o+=n?"[^/]+/?":i,a===e.length)if(n)t&&(o+="$");else{let e=t?"":".*";o="/"===o.charAt(o.length-1)?`${o}${e}$`:`${o}(/${e})?(#.*)?$`}n=!n,r=a}}(e,t);return e=>{let t=e.origin;t||(t=`${e.protocol}//${e.host}`);let n=e.href.replace(t,"").replace(e.search,"").split("?")[0];return r.test(n)}}let aM=!1,aL=[],aF=as&&window.location.href;function aB(){return aU()}function aU(e=[],t,r=!1){let n,o,a,i,s;if(aM)return new Promise((e,r)=>{aL.push({resolve:e,reject:r,eventArguments:t})});let{appsToUnload:l,appsToUnmount:u,appsToLoad:c,appsToMount:d}=(n=[],o=[],a=[],i=[],s=(new Date).getTime(),aS.forEach(e=>{let t=e.status!==oB&&oV(e);switch(e.status){case oF:t&&s-e.loadErrorTime>=200&&a.push(e);break;case oO:case oR:t&&a.push(e);break;case oT:case oj:!t&&aE[oW(e)]?n.push(e):t&&i.push(e);break;case o$:t||o.push(e)}}),{appsToUnload:n,appsToUnmount:o,appsToLoad:a,appsToMount:i}),f,p=[],m=aF,h=aF=window.location.href;return aW?(aM=!0,f=l.concat(c,u,d),Promise.resolve().then(()=>(w(0===f.length?"before-no-app-change":"before-app-change",b(!0)),w("before-routing-event",b(!0,{cancelNavigation:g})),Promise.all(p).then(r=>{if(r.some(e=>e))return am.call(window.history,history.state,"",m.substring(location.origin.length)),aF=location.href,aM=!1,aU(e,t,!0);let n=l.map(ax),o=Promise.all(u.map(oQ).map(e=>e.then(ax)).concat(n));o.then(()=>{w("before-mount-routing-event",b(!0))},e=>{throw e});let a=c.map(e=>ai(e).then(e=>aV(e,o))),i=d.filter(e=>0>c.indexOf(e)).map(e=>aV(e,o));return o.catch(e=>{throw v(),e}).then(()=>(v(),Promise.all(a.concat(i)).catch(t=>{throw e.forEach(e=>e.reject(t)),t}).then(y).then(()=>{},e=>{throw e})))})))):(f=c,Promise.resolve().then(()=>Promise.all(c.map(ai)).then(v).then(()=>[]).catch(e=>{throw v(),e}).finally(()=>{})));function g(e=!0){let t="function"==typeof(null==e?void 0:e.then)?e:Promise.resolve(e);p.push(t.catch(e=>(console.warn(Error(ok(42,!1))),console.warn(e),!1)))}function y(){let t=aC();e.forEach(e=>e.resolve(t));try{w(0===f.length?"no-app-change":"app-change",b()),w("routing-event",b())}catch(e){setTimeout(()=>{throw e})}if(aM=!1,aL.length>0){let e=aL;aL=[],aU(e)}return t}function v(){r||(e.forEach(e=>{ad(e.eventArguments)}),ad(t))}function b(e=!1,r){let n={},o={[o$]:[],[oj]:[],[oO]:[],[oB]:[]};e?(c.concat(d).forEach((e,t)=>{i(e,o$)}),l.forEach(e=>{i(e,oO)}),u.forEach(e=>{i(e,oj)})):f.forEach(e=>{i(e)});let a={detail:{newAppStatuses:n,appsByNewStatus:o,totalAppChanges:f.length,originalEvent:null==t?void 0:t[0],oldUrl:m,newUrl:h}};return r&&oK(a.detail,r),a;function i(e,t){let r=oW(e);t=t||aP(r),n[r]=t,(o[t]=o[t]||[]).push(r)}}function w(e,t){r||window.dispatchEvent(new ox(`single-spa:${e}`,t))}}function aV(e,t){return oV(e)?oX(e).then(e=>t.then(()=>oV(e)?o2(e):e)):t.then(()=>e)}let aW=!1;function aH(e){aW=!0,as&&(ag(e),aU())}as&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods={getRawAppData:function(){return[...aS]},reroute:aU,NOT_LOADED:oO,toLoadPromise:ai,toBootstrapPromise:oX,unregisterApplication:aN,getProfilerData:function(){return oJ}});let az={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",discardUnsavedChangesPromptBodyMultiple:"{{count}} workspaces have unsaved changes. Closing them will discard the changes:",discardUnsavedChangesPromptBodySingle:"<strong>{{workspaceTitle}}</strong> has unsaved changes. Closing it will discard them.",discardUnsavedChangesPromptTitle:"Discard unsaved changes?",keepEditing:"Keep editing",abnormalValue:"Abnormal value",actions:"Actions",actionableNotification:"Actionable notification",address:"Address",age:"Age",applicationError:"Application Error",batchActionItemSelected:"{{totalSelected}} item selected",batchActionsItemsSelected:"{{totalSelected}} items selected",cancel:"Cancel",change:"Change",Clinic:"Clinic",clearDevOverrides:"Clear dev overrides",close:"Close",closesActionableNotification:"Close actionable notification",closeSnackbar:"Close snackbar",confirm:"Confirm",contactAdministratorIfIssuePersists:"Contact your system administrator if the problem persists.",contactDetails:"Contact details",copied:"Copied!",copyToClipboard:"Copy to clipboard",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",localVersion:"Local Build",male:"Male",navigateNonHttp:"Could not navigate to the requested page as it is not a safe URL",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}}",prereleaseVersion:"Prerelease",print:"Print",printError:"Print error",printErrorExplainer:"An error occurred in {{errorLocation}}",printIdentifierSticker:"Print identifier sticker",printing:"Printing",provisional:"Provisional",recordNewEntry:"Record {{displayText}}",relationships:"Relationships",reload:"Reload",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",serverStartingUp:"The server is starting",serverStartingUpExplainer:"This can take a few minutes. OpenMRS will open automatically when the server is ready.",serverStartingUpSlowExplainer:"This is taking longer than usual. First startup after an upgrade can take 10 minutes or more. You can leave this page open.",sex:"Sex",showLess:"Show less",showMore:"Show more",snackbarNotification:"Snackbar notification",somethingWentWrongTryReloading:"Something went wrong. Please try reloading.",toggleDevTools:"Toggle dev tools",unknown:"Unknown",viewSetupProgress:"View setup progress",waitingForServer:"Waiting for the server",yearAbbreviation:"yr",yearsAbbreviation:"yrs"};var aK=r(2284),aG=r(3029),aZ=r(2901);function aY(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var aq=r(3662);function aJ(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,aq.A)(e,t)}function aX(e,t){if(t&&("object"==(0,aK.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 aQ(e){return(aQ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var a0=r(4467),a1=r(6369),a2=r(3612),a4=r(6562);function a3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function a6(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a3(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a3(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var a5={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)}},a9=new(function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,aG.A)(this,e),this.init(t,r)}return(0,aZ.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||a5,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),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,a6(a6({},{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}()),a8=function(){function e(){(0,aG.A)(this,e),this.observers={}}return(0,aZ.A)(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach(function(e){r.observers[e]=r.observers[e]||[],r.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,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach(function(e){e.apply(void 0,r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(function(t){t.apply(t,[e].concat(r))})}}]),e}();function a7(){var e,t,r=new Promise(function(r,n){e=r,t=n});return r.resolve=e,r.reject=t,r}function ie(e){return null==e?"":""+e}function it(e,t,r){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var a="string"!=typeof t?[].concat(t):t.split(".");a.length>1;){if(o())return{};var i=n(a.shift());!e[i]&&r&&(e[i]=new r),e=Object.prototype.hasOwnProperty.call(e,i)?e[i]:{}}return o()?{}:{obj:e,k:n(a.shift())}}function ir(e,t,r){var n=it(e,t,Object);n.obj[n.k]=r}function io(e,t){var r=it(e,t),n=r.obj,o=r.k;if(n)return n[o]}function ia(e,t,r){var n=io(e,r);return void 0!==n?n:io(t,r)}function ii(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var is={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function il(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return is[e]}):e}var iu="u">typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,ic=[" ",",","?","!",";"];function id(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ip(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?id(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):id(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var im=function(e){aJ(n,e);var t,r=(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,r=aQ(n);return e=t?Reflect.construct(r,arguments,aQ(this).constructor):r.apply(this,arguments),aX(this,e)});function n(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return(0,aG.A)(this,n),t=r.call(this),iu&&a8.call(aY(t)),t.data=e||{},t.options=o,void 0===t.options.keySeparator&&(t.options.keySeparator="."),void 0===t.options.ignoreJSONStructure&&(t.options.ignoreJSONStructure=!0),t}return(0,aZ.A)(n,[{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,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,a=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,i=[e,t];r&&"string"!=typeof r&&(i=i.concat(r)),r&&"string"==typeof r&&(i=i.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(i=e.split("."));var s=io(this.data,i);return s||!a||"string"!=typeof r?s:function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(t){if(t[r])return t[r];for(var o=r.split(n),a=t,i=0;i<o.length;++i){if(!a||"string"==typeof a[o[i]]&&i+1<o.length)return;if(void 0===a[o[i]]){for(var s=2,l=o.slice(i,i+s).join(n),u=a[l];void 0===u&&o.length>i+s;)s++,u=a[l=o.slice(i,i+s).join(n)];if(void 0===u)return;if(null===u)return null;if(r.endsWith(l)){if("string"==typeof u)return u;if(l&&"string"==typeof u[l])return u[l]}var c=o.slice(i+s).join(n);if(c)return e(u,c,n);return}a=a[o[i]]}return a}}(this.data&&this.data[e]&&this.data[e][t],r,o)}},{key:"addResource",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},a=this.options.keySeparator;void 0===a&&(a=".");var i=[e,t];r&&(i=i.concat(a?r.split(a):r)),e.indexOf(".")>-1&&(i=e.split("."),n=t,t=i[1]),this.addNamespaces(t),ir(this.data,i,n),o.silent||this.emit("added",e,t,r,n)}},{key:"addResources",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in r)("string"==typeof r[o]||"[object Array]"===Object.prototype.toString.apply(r[o]))&&this.addResource(e,t,o,r[o],{silent:!0});n.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),n=r,r=t,t=i[1]),this.addNamespaces(t);var s=io(this.data,i)||{};n?function e(t,r,n){for(var o in r)"__proto__"!==o&&"constructor"!==o&&(o in t?"string"==typeof t[o]||t[o]instanceof String||"string"==typeof r[o]||r[o]instanceof String?n&&(t[o]=r[o]):e(t[o],r[o],n):t[o]=r[o]);return t}(s,r,o):s=ip(ip({},s),r),ir(this.data,i,s),a.silent||this.emit("added",e,t,r)}},{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)?ip(ip({},{}),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}}]),n}(a8),ih={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,n,o){var a=this;return e.forEach(function(e){a.processors[e]&&(t=a.processors[e].process(t,r,n,o))}),t}};function ig(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function iy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ig(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ig(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var iv={},ib=function(e){aJ(n,e);var t,r=(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,r=aQ(n);return e=t?Reflect.construct(r,arguments,aQ(this).constructor):r.apply(this,arguments),aX(this,e)});function n(e){var t,o,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,aG.A)(this,n),a=r.call(this),iu&&a8.call(aY(a)),t=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],o=aY(a),t.forEach(function(t){e[t]&&(o[t]=e[t])}),a.options=i,void 0===a.options.keySeparator&&(a.options.keySeparator="."),a.logger=a9.create("translator"),a}return(0,aZ.A)(n,[{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 r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],a=r&&e.indexOf(r)>-1,i=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!function(e,t,r){t=t||"",r=r||"";var n=ic.filter(function(e){return 0>t.indexOf(e)&&0>r.indexOf(e)});if(0===n.length)return!0;var o=new RegExp("(".concat(n.map(function(e){return"?"===e?"\\?":e}).join("|"),")")),a=!o.test(e);if(!a){var i=e.indexOf(r);i>0&&!o.test(e.substring(0,i))&&(a=!0)}return a}(e,r,n);if(a&&!i){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:o};var l=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(l[0])>-1)&&(o=l.shift()),e=l.join(n)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,t,r){var o=this;if("object"!==(0,aK.A)(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var a=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,u=s.namespaces,c=u[u.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var p=t.nsSeparator||this.options.nsSeparator;return a?(m.res="".concat(c).concat(p).concat(l),m):"".concat(c).concat(p).concat(l)}return a?(m.res=l,m):l}var m=this.resolve(e,t),h=m&&m.res,g=m&&m.usedKey||l,y=m&&m.exactUsedKey||l,v=Object.prototype.toString.apply(h),b=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,E="string"!=typeof h&&"boolean"!=typeof h&&"number"!=typeof h;if(w&&h&&E&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(v)&&("string"!=typeof b||"[object Array]"!==v)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var x=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,h,iy(iy({},t),{},{ns:u})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return a?(m.res=x,m):x}if(i){var D="[object Array]"===v,_=D?[]:{},S=D?y:g;for(var C in h)if(Object.prototype.hasOwnProperty.call(h,C)){var k="".concat(S).concat(i).concat(C);_[C]=this.translate(k,iy(iy({},t),{joinArrays:!1,ns:u})),_[C]===k&&(_[C]=h[C])}h=_}}else if(w&&"string"==typeof b&&"[object Array]"===v)(h=h.join(b))&&(h=this.extendTranslation(h,e,t,r));else{var P=!1,O=!1,R=void 0!==t.count&&"string"!=typeof t.count,T=n.hasDefaultValue(t),N=R?this.pluralResolver.getSuffix(d,t.count,t):"",j=t["defaultValue".concat(N)]||t.defaultValue;!this.isValidLookup(h)&&T&&(P=!0,h=j),this.isValidLookup(h)||(O=!0,h=l);var A=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&O?void 0:h,$=T&&j!==h&&this.options.updateMissing;if(O||P||$){if(this.logger.log($?"updateKey":"missingKey",d,c,l,$?j:h),i){var I=this.resolve(l,iy(iy({},t),{},{keySeparator:!1}));I&&I.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 M=[],L=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&L&&L[0])for(var F=0;F<L.length;F++)M.push(L[F]);else"all"===this.options.saveMissingTo?M=this.languageUtils.toResolveHierarchy(t.lng||this.language):M.push(t.lng||this.language);var B=function(e,r,n){var a=T&&n!==h?n:A;o.options.missingKeyHandler?o.options.missingKeyHandler(e,c,r,a,$,t):o.backendConnector&&o.backendConnector.saveMissing&&o.backendConnector.saveMissing(e,c,r,a,$,t),o.emit("missingKey",e,c,r,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?M.forEach(function(e){o.pluralResolver.getSuffixes(e,t).forEach(function(r){B([e],l+r,t["defaultValue".concat(r)]||j)})}):B(M,l,j))}h=this.extendTranslation(h,e,t,m,r),O&&h===l&&this.options.appendNamespaceToMissingKey&&(h="".concat(c,":").concat(l)),(O||P)&&this.options.parseMissingKeyHandler&&(h="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(c,":").concat(l):l,P?h:void 0):this.options.parseMissingKeyHandler(h))}return a?(m.res=h,m):h}},{key:"extendTranslation",value:function(e,t,r,n,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,iy(iy({},this.options.interpolation.defaultVariables),r),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(iy(iy({},r),{interpolation:iy(iy({},this.options.interpolation),r.interpolation)}));var i,s="string"==typeof e&&(r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var l=e.match(this.interpolator.nestingRegexp);i=l&&l.length}var u=r.replace&&"string"!=typeof r.replace?r.replace:r;if(this.options.interpolation.defaultVariables&&(u=iy(iy({},this.options.interpolation.defaultVariables),u)),e=this.interpolator.interpolate(e,u,r.lng||this.language,r),s){var c=e.match(this.interpolator.nestingRegexp);i<(c&&c.length)&&(r.nest=!1)}!1!==r.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return o&&o[0]===n[0]&&!r.context?(a.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):a.translate.apply(a,n.concat([t]))},r)),r.interpolation&&this.interpolator.reset()}var d=r.postProcess||this.options.postProcess,f="string"==typeof d?[d]:d;return null!=e&&f&&f.length&&!1!==r.applyPostProcessor&&(e=ih.handle(f,e,t,this.options&&this.options.postProcessPassResolved?iy({i18nResolved:n},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,n,o,a,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),u=l.key;r=u;var c=l.namespaces;i.options.fallbackNS&&(c=c.concat(i.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&i.pluralResolver.shouldUseIntlApi(),p=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,m=s.lngs?s.lngs:i.languageUtils.toResolveHierarchy(s.lng||i.language,s.fallbackLng);c.forEach(function(e){i.isValidLookup(t)||(a=e,!iv["".concat(m[0],"-").concat(e)]&&i.utils&&i.utils.hasLoadedNamespace&&!i.utils.hasLoadedNamespace(a)&&(iv["".concat(m[0],"-").concat(e)]=!0,i.logger.warn('key "'.concat(r,'" for languages "').concat(m.join(", "),'" won\'t get resolved as namespace "').concat(a,'" 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!!!")),m.forEach(function(r){if(!i.isValidLookup(t)){o=r;var a,l=[u];if(i.i18nFormat&&i.i18nFormat.addLookupKeys)i.i18nFormat.addLookupKeys(l,u,r,e,s);else{d&&(c=i.pluralResolver.getSuffix(r,s.count,s));var c,m="".concat(i.options.pluralSeparator,"zero");if(d&&(l.push(u+c),f&&l.push(u+m)),p){var h="".concat(u).concat(i.options.contextSeparator).concat(s.context);l.push(h),d&&(l.push(h+c),f&&l.push(h+m))}}for(;a=l.pop();)i.isValidLookup(t)||(n=a,t=i.getResource(r,e,a,s))}}))})}}),{res:t,usedKey:r,exactUsedKey:n,usedLng:o,usedNS:a}}},{key:"isValidLookup",value:function(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&void 0!==e[r])return!0;return!1}}]),n}(a8);function iw(e){return e.charAt(0).toUpperCase()+e.slice(1)}var iE=function(){function e(t){(0,aG.A)(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=a9.create("languageUtils")}return(0,aZ.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"],r=e.split("-");return this.options.lowerCaseLng?r=r.map(function(e){return e.toLowerCase()}):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=iw(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=iw(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=iw(r[2].toLowerCase()))),r.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,r=this;return e?(e.forEach(function(e){if(!t){var n=r.formatLanguageCode(e);(!r.options.supportedLngs||r.isSupportedCode(n))&&(t=n)}}),!t&&this.options.supportedLngs&&e.forEach(function(e){if(!t){var n=r.getLanguagePartFromCode(e);if(r.isSupportedCode(n))return t=n;t=r.options.supportedLngs.find(function(e){if(0===e.indexOf(n))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 r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],a=function(e){e&&(r.isSupportedCode(e)?o.push(e):r.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):"string"==typeof e&&a(this.formatLanguageCode(e)),n.forEach(function(e){0>o.indexOf(e)&&a(r.formatLanguageCode(e))}),o}}]),e}(),ix=[{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}],iD={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)}},i_=["v1","v2","v3"],iS={zero:0,one:1,two:2,few:3,many:4,other:5},iC=function(){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,aG.A)(this,e),this.languageUtils=t,this.options=n,this.logger=a9.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=(r={},ix.forEach(function(e){e.lngs.forEach(function(t){r[t]={numbers:e.nr,plurals:iD[e.fc]}})}),r)}return(0,aZ.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]:{},r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,r).map(function(e){return"".concat(t).concat(e)})}},{key:"getSuffixes",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort(function(e,t){return iS[e]-iS[t]}).map(function(e){return"".concat(t.options.prepend).concat(e)}):n.numbers.map(function(n){return t.getSuffix(e,n,r)}):[]}},{key:"getSuffix",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(n.select(t)):this.getSuffixRetroCompatible(n,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var r=this,n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var a=function(){return r.options.prepend&&o.toString()?r.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?a():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}},{key:"shouldUseIntlApi",value:function(){return!i_.includes(this.options.compatibilityJSON)}}]),e}();function ik(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function iP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ik(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ik(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var iO=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,aG.A)(this,e),this.logger=a9.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return(0,aZ.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:il,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?ii(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?ii(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?ii(t.nestingPrefix):t.nestingPrefixEscaped||ii("$t("),this.nestingSuffix=t.nestingSuffix?ii(t.nestingSuffix):t.nestingSuffixEscaped||ii(")"),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 r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,n){var o,a,i,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(0>e.indexOf(s.formatSeparator)){var o=ia(t,l,e);return s.alwaysFormat?s.format(o,void 0,r,iP(iP(iP({},n),t),{},{interpolationkey:e})):o}var a=e.split(s.formatSeparator),i=a.shift().trim(),u=a.join(s.formatSeparator).trim();return s.format(ia(t,l,i),u,r,iP(iP(iP({},n),t),{},{interpolationkey:i}))};this.resetRegExp();var d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,f=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?u(s.escape(e)):u(e)}}].forEach(function(t){for(i=0;o=t.regex.exec(e);){var r=o[1].trim();if(void 0===(a=c(r)))if("function"==typeof d){var l=d(e,o,n);a="string"==typeof l?l:""}else if(n&&n.hasOwnProperty(r))a="";else if(f){a=o[0];continue}else s.logger.warn("missed to pass in variable ".concat(r," for interpolating ").concat(e)),a="";else"string"==typeof a||s.useRawValueToEscape||(a=ie(a));var u=t.safeValue(a);if(e=e.replace(o[0],u),f?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++i>=s.maxReplaces)break}}),e}},{key:"nest",value:function(e,t){var r,n,o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=iP({},a);function s(e,t){var r=this.nestingOptionsSeparator;if(0>e.indexOf(r))return e;var n=e.split(new RegExp("".concat(r,"[ ]*{"))),o="{".concat(n[1]);e=n[0];var a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),t&&(i=iP(iP({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(r).concat(o)}return delete i.defaultValue,e}for(i.applyPostProcessor=!1,delete i.defaultValue;r=this.nestingRegexp.exec(e);){var l=[],u=!1;if(-1!==r[0].indexOf(this.formatSeparator)&&!/{.*}/.test(r[1])){var c=r[1].split(this.formatSeparator).map(function(e){return e.trim()});r[1]=c.shift(),l=c,u=!0}if((n=t(s.call(this,r[1].trim(),i),i))&&r[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=ie(n)),n||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),n=""),u&&(n=l.reduce(function(e,t){return o.format(e,t,a.lng,iP(iP({},a),{},{interpolationkey:r[1].trim()}))},n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}();function iR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function iT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iR(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function iN(e){var t={};return function(r,n,o){var a=n+JSON.stringify(o),i=t[a];return i||(i=e(n,o),t[a]=i),i(r)}}var ij=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,aG.A)(this,e),this.logger=a9.create("formatter"),this.options=t,this.formats={number:iN(function(e,t){var r=new Intl.NumberFormat(e,t);return function(e){return r.format(e)}}),currency:iN(function(e,t){var r=new Intl.NumberFormat(e,iT(iT({},t),{},{style:"currency"}));return function(e){return r.format(e)}}),datetime:iN(function(e,t){var r=new Intl.DateTimeFormat(e,iT({},t));return function(e){return r.format(e)}}),relativetime:iN(function(e,t){var r=new Intl.RelativeTimeFormat(e,iT({},t));return function(e){return r.format(e,t.range||"day")}}),list:iN(function(e,t){var r=new Intl.ListFormat(e,iT({},t));return function(e){return r.format(e)}})},this.init(t)}return(0,aZ.A)(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},r=t.interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=iN(t)}},{key:"format",value:function(e,t,r,n){var o=this;return t.split(this.formatSeparator).reduce(function(e,t){var a=function(e){var t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){var n=e.split("(");t=n[0].toLowerCase().trim();var o=n[1].substring(0,n[1].length-1);"currency"===t&&0>o.indexOf(":")?r.currency||(r.currency=o.trim()):"relativetime"===t&&0>o.indexOf(":")?r.range||(r.range=o.trim()):o.split(";").forEach(function(e){if(e){var t,n=(t=e.split(":"),(0,a1.A)(t)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||(0,a2.A)(t)||(0,a4.A)()),o=n[0],a=n.slice(1).join(":").trim().replace(/^'+|'+$/g,"");r[o.trim()]||(r[o.trim()]=a),"false"===a&&(r[o.trim()]=!1),"true"===a&&(r[o.trim()]=!0),isNaN(a)||(r[o.trim()]=parseInt(a,10))}})}return{formatName:t,formatOptions:r}}(t),i=a.formatName,s=a.formatOptions;if(o.formats[i]){var l=e;try{var u=n&&n.formatParams&&n.formatParams[n.interpolationkey]||{},c=u.locale||u.lng||n.locale||n.lng||r;l=o.formats[i](e,c,iT(iT(iT({},s),n),u))}catch(e){o.logger.warn(e)}return l}return o.logger.warn("there was no format function for ".concat(i)),e},e)}}]),e}();function iA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iA(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iA(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var iI=function(e){aJ(n,e);var t,r=(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,r=aQ(n);return e=t?Reflect.construct(r,arguments,aQ(this).constructor):r.apply(this,arguments),aX(this,e)});function n(e,t,o){var a,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,aG.A)(this,n),a=r.call(this),iu&&a8.call(aY(a)),a.backend=e,a.store=t,a.services=o,a.languageUtils=o.languageUtils,a.options=i,a.logger=a9.create("backendConnector"),a.waitingReads=[],a.maxParallelReads=i.maxParallelReads||10,a.readingCalls=0,a.maxRetries=i.maxRetries>=0?i.maxRetries:5,a.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,a.state={},a.queue=[],a.backend&&a.backend.init&&a.backend.init(o,i.backend,i),a}return(0,aZ.A)(n,[{key:"queueLoad",value:function(e,t,r,n){var o=this,a={},i={},s={},l={};return e.forEach(function(e){var n=!0;t.forEach(function(t){var s="".concat(e,"|").concat(t);!r.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?void 0===i[s]&&(i[s]=!0):(o.state[s]=1,n=!1,void 0===i[s]&&(i[s]=!0),void 0===a[s]&&(a[s]=!0),void 0===l[t]&&(l[t]=!0)))}),n||(s[e]=!0)}),(Object.keys(a).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(a),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,r){var n=e.split("|"),o=n[0],a=n[1];t&&this.emit("failedLoading",o,a,t),r&&this.store.addResourceBundle(o,a,r),this.state[e]=t?-1:2;var i={};this.queue.forEach(function(r){var n,s,l,u;n=r.loaded,(l=(s=it(n,[o],Object)).obj)[u=s.k]=l[u]||[],l[u].push(a),void 0!==r.pending[e]&&(delete r.pending[e],r.pendingCount--),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(function(e){i[e]||(i[e]={});var t=r.loaded[e];t.length&&t.forEach(function(t){void 0===i[e][t]&&(i[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=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:r,tried:o,wait:a,callback:i}):(this.readingCalls++,this.backend[r](e,t,function(s,l){if(n.readingCalls--,n.waitingReads.length>0){var u=n.waitingReads.shift();n.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}s&&l&&o<n.maxRetries?setTimeout(function(){n.read.call(n,e,t,r,o+1,2*a,i)},a):i(s,l)})):i(null,{})}},{key:"prepareLoading",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=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."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var a=this.queueLoad(e,t,n,o);if(!a.toLoad.length)return a.pending.length||o(),null;a.toLoad.forEach(function(e){r.loadOne(e)})}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),o=n[0],a=n[1];this.read(o,a,"read",void 0,void 0,function(n,i){n&&t.logger.warn("".concat(r,"loading namespace ").concat(a," for language ").concat(o," failed"),n),!n&&i&&t.logger.log("".concat(r,"loaded namespace ").concat(a," for language ").concat(o),i),t.loaded(e,n,i)})}},{key:"saveMissing",value:function(e,t,r,n,o){var a=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(r,'" 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==r||""===r||(this.backend&&this.backend.create&&this.backend.create(e,t,r,n,null,i$(i$({},a),{},{isUpdate:o})),e&&e[0]&&this.store.addResource(e[0],t,r,n))}}]),n}(a8);function iM(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 iL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function iF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iL(Object(r),!0).forEach(function(t){(0,a0.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iL(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function iB(){}var iU=function(e){aJ(n,e);var t,r=(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,r=aQ(n);return e=t?Reflect.construct(r,arguments,aQ(this).constructor):r.apply(this,arguments),aX(this,e)});function n(){var e,t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if((0,aG.A)(this,n),t=r.call(this),iu&&a8.call(aY(t)),t.options=iM(o),t.services={},t.logger=a9,t.modules={external:[]},Object.getOwnPropertyNames(Object.getPrototypeOf(e=aY(t))).forEach(function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}),a&&!t.isInitialized&&!o.isClone){if(!t.options.initImmediate)return t.init(o,a),aX(t,aY(t));setTimeout(function(){t.init(o,a)},0)}return t}return(0,aZ.A)(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=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 n={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,aK.A)(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===(0,aK.A)(e[2])||"object"===(0,aK.A)(e[3])){var r=e[3]||e[2];Object.keys(r).forEach(function(e){t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}};function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=iF(iF(iF({},n),this.options),iM(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=iF(iF({},n.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?a9.init(o(this.modules.logger),this.options):a9.init(null,this.options),this.modules.formatter?a=this.modules.formatter:"u">typeof Intl&&(a=ij);var a,i=new iE(this.options);this.store=new im(this.options.resources,this.options);var s=this.services;s.logger=a9,s.resourceStore=this.store,s.languageUtils=i,s.pluralResolver=new iC(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),a&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(s.formatter=o(a),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new iO(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new iI(o(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))}),this.modules.languageDetector&&(s.languageDetector=o(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=o(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new ib(this.services,this.options),this.translator.on("*",function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))}),this.modules.external.forEach(function(t){t.init&&t.init(e)})}if(this.format=this.options.interpolation.format,r||(r=iB),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 r;return(r=e.store)[t].apply(r,arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments),e}});var u=a7(),c=function(){var t=function(t,n){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),u.resolve(n),r(t,n)};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?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iB,n=r,o="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return n();var a=[],i=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach(function(e){0>a.indexOf(e)&&a.push(e)})};o?i(o):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(a,this.options.ns,function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)})}else n(null)}},{key:"reloadResources",value:function(e,t,r){var n=a7();return e||(e=this.languages),t||(t=this.options.ns),r||(r=iB),this.services.backendConnector.reload(e,t,function(e){n.resolve(),r(e)}),n}},{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&&ih.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 r=this.languages[t];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}},{key:"changeLanguage",value:function(e,t){var r=this;this.isLanguageChangingTo=e;var n=a7();this.emit("languageChanging",e);var o=function(e){r.language=e,r.languages=r.services.languageUtils.toResolveHierarchy(e),r.resolvedLanguage=void 0,r.setResolvedLanguage(e)},a=function(e,a){a?(o(a),r.translator.changeLanguage(a),r.isLanguageChangingTo=void 0,r.emit("languageChanged",a),r.logger.log("languageChanged",a)):r.isLanguageChangingTo=void 0,n.resolve(function(){return r.t.apply(r,arguments)}),t&&t(e,function(){return r.t.apply(r,arguments)})},i=function(t){e||t||!r.services.languageDetector||(t=[]);var n="string"==typeof t?t:r.services.languageUtils.getBestMatchFromCodes(t);n&&(r.language||o(n),r.translator.language||r.translator.changeLanguage(n),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage(n)),r.loadResources(n,function(e){a(e,n)})};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()),n}},{key:"getFixedT",value:function(e,t,r){var n=this,o=function e(t,o){if("object"!==(0,aK.A)(o)){for(var a,i=arguments.length,s=Array(i>2?i-2:0),l=2;l<i;l++)s[l-2]=arguments[l];a=n.options.overloadTranslationOptionHandler([t,o].concat(s))}else a=iF({},o);a.lng=a.lng||e.lng,a.lngs=a.lngs||e.lngs,a.ns=a.ns||e.ns,a.keyPrefix=a.keyPrefix||r||e.keyPrefix;var u=n.options.keySeparator||".",c=a.keyPrefix?"".concat(a.keyPrefix).concat(u).concat(t):t;return n.t(c,a)};return"string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=r,o}},{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,r=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 n=this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,a=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var i=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};if(r.precheck){var s=r.precheck(this,i);if(void 0!==s)return s}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,e)&&(!o||i(a,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,n=a7();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){0>r.options.ns.indexOf(e)&&r.options.ns.push(e)}),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=a7();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],o=e.filter(function(e){return 0>n.indexOf(e)});return o.length?(this.options.preload=n.concat(o),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(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]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iB,o=iF(iF(iF({},this.options),t),{isClone:!0}),a=new n(o);return(void 0!==t.debug||void 0!==t.prefix)&&(a.logger=a.logger.clone(t)),["store","services","language"].forEach(function(t){a[t]=e[t]}),a.services=iF({},this.services),a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a.translator=new ib(a.services,a.options),a.translator.on("*",function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];a.emit.apply(a,[e].concat(r))}),a.init(o,r),a.translator.options=a.options,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(a8);(0,a0.A)(iU,"createInstance",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new iU(e,t)});var iV=iU.createInstance();iV.createInstance=iU.createInstance,iV.createInstance,iV.init,iV.loadResources,iV.reloadResources,iV.use,iV.changeLanguage,iV.getFixedT,iV.t,iV.exists,iV.setDefaultNamespace,iV.hasLoadedNamespace,iV.loadNamespaces,iV.loadLanguages;let iW=iV.default||iV;function iH(e,t,r,n){return iW.t(t,{ns:e,defaultValue:r,...n})}function iz(e,t,r){return az[e]?iH("core",e,t??az[e],r):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function iK(e,t){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=iG(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:r,...t});return e.startsWith("//")?n:n.replace(/^\/\//,"/")}function iG(e,t){return Object.keys(t).reduce((e,r)=>e.split("${"+r+"}").join(t[r]),e)}function iZ({to:e,templateParams:t}){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=iK(e,t).replace(window.location.origin,""),o=new URL(n,window.location.origin);if("http:"!=o.protocol&&"https:"!=o.protocol)throw console.error(`Received request to navigate to non-http URL: ${o.toString()}`),Error(iz("navigateNonHttp"));n.startsWith(r)?ac(n):window.location.assign(n)}iW.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let iY="openmrs:history";function iq(e){let t=JSON.parse(sessionStorage.getItem(iY)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(iY,JSON.stringify(t))}function iJ(){0===JSON.parse(sessionStorage.getItem(iY)??"[]").length&&document.referrer&&iq(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=iX();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(iY,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?iQ({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&iq(window.location.href)})}function iX(){return JSON.parse(sessionStorage.getItem(iY)??"[]")}function iQ({toUrl:e}){let t=iX(),r=t.lastIndexOf(e);if(-1!=r){let e=t.slice(0,r+1);iZ({to:t[r]}),sessionStorage.setItem(iY,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function i0(){sessionStorage.removeItem(iY)}let i1="${openmrsSpaBase}/login",i2={redirectAuthFailure:{enabled:{_type:no.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:no.String,_default:i1,_validators:[od.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:no.Array,_default:[401],_elements:{_type:no.Number,_validators:[od.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:no.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:no.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function i4(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i3="/ws/rest/v1",i6="/ws/fhir2/R4",i5=`${i3}/session`;function i9(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function i8(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 r=i9(e);t.headers||(t.headers={}),eh(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;let n=!1;try{let e=new URL(r,window.location.href),t=new URL(i9(i3),window.location.href),o=e.pathname.replace(/\/{2,}/g,"/"),a=t.pathname.replace(/\/{2,}/g,"/");n=e.origin===t.origin&&(o===a||o.startsWith(`${a}/`))}catch{}if(n){let e=!1;for(let[r,n]of Object.entries(t.headers))"disable-www-authenticate"===r.toLowerCase()&&(void 0===n?delete t.headers[r]:e=!0);e||(t.headers["Disable-WWW-Authenticate"]="true")}if(e.startsWith(i6)){let e=new URL(r,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),r=e.toString())}let o=Error();return window.fetch(r,t).then(async e=>{let{redirectAuthFailure:n,followRedirects:a}=await nY("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(a&&t&&(r===i9(i5)||204===e.status)&&iZ({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(r===i9(i5)&&403===e.status||n.enabled&&n.errors.includes(e.status))&&(i0(),iZ({to:n.url||e.headers.get("location")||i1}),!0!==t.rejectAuthFailure)?n.resolvePromise?Promise.resolve():new Promise(()=>{}):e.clone().text().then(t=>{let n=t;try{n=JSON.parse(t)}catch(e){}throw new i7(r,e,n,o)},()=>{throw new i7(r,e,null,o)})})}class i7 extends Error{constructor(e,t,r,n){super(),i4(this,"response",void 0),i4(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`,n.message=this.message,this.responseBody=r,this.response=t,this.stack=`Stacktrace for outgoing request:
|
|
13
13
|
${n.stack}
|
|
14
14
|
Stacktrace for incoming response:
|
|
15
|
-
${this.stack}`}}let se=B("session",{loaded:!1,session:null}),st=0,sr=null;function sn(){return sr||(se.getState().loaded&&st>=Date.now()-6e4?null:ss())}function so(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=sn();return n?new Promise(e=>{let t=()=>{let t=se.getState();t.loaded&&(o(),e(r(t.session)))},o=se.subscribe(t);n.then(t,t)}):Promise.resolve(r(se.getState().session))}function sa(){return sn(),se}function si(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 ss(e,t){st=Date.now(),a??(a=st);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=sy(i8(i5,{headers:r,rejectAuthFailure:!0})),o=()=>{sr===n&&(sr=null)};return n.then(o,o),sr=n,n}function sl(){se.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function su(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!K(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!K(n.privileges.find(t=>e===t.display))):(K(r)||console.error(`Could not understand privileges "${r}"`),!0))||!K(t.roles.find(e=>"System Developer"===e.display))}function sc(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(se.getState()),e||(t=se.subscribe(n))})}async function sd(){return(await so()).sessionLocation}async function sf(e,t){return sy(i8(i5,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function sp(e,t){return await i8(i5,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),ss()}async function sm(e,t,r){return r||(r=new AbortController),await i8(`${i3}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),ss()}async function sh(e,t=!1){let r=await i8(t?`${i5}?rememberMe=true`:i5,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await ss()).session:r.data}async function sg(){try{await i8(i5,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!sv(e))throw e}sl(),await ss().catch(()=>{})}function sy(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};se.setState(r,!0),t(r)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?r(sb(Error("The session endpoint did not respond with a session"))):r(sb(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(sv(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?se.setState({loaded:!0,session:e.responseBody},!0):sl(),t(se.getState());return}(o=e)instanceof i7&&502===o.response.status&&!se.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(sb(e,!0)):(k(`Failed to fetch new session information: ${e}`),r(sb(e)))})})}function sv(e){return e instanceof i7&&(401===e.response.status||403===e.response.status)}function sb(e,t=!1){return se.getState().loaded||se.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),se.getState()}function sw(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}se.subscribe(e=>{e.loaded&&e.session&&si(e.session)});let sE={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function sx(){nV("@openmrs/esm-api",i2),ss()}let sD="import-map-override:",s_="import-map-overrides-disabled",sS="import-map-overrides:change",sC=!1,sk=null,sP=null;async function sO(){return sP??(sP=sR().then(({map:e,complete:t})=>(t||(sP=null),e))),sP}async function sR(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let o=e[n];try{if(o.src){let e=await fetch(o.src);if(!e.ok)throw Error(`Request for ${o.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else o.textContent&&t.push(JSON.parse(o.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:sT(t),complete:r}}function sT(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function sN(){let e={};try{let t=sM();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(sD)){let r=n.slice(sD.length);if(!t.includes(r)){let t=localStorage.getItem(n);t&&(e[r]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function sj(){let e=await sO();return sC?sT([e,sk??sN()]):e}async function sA(){return sO()}async function s$(){return sC?sT([await sO(),sN()]):sO()}function sI(e){if(!sC)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(sD)){let t=localStorage.getItem(r);t&&(e[r.slice(sD.length)]=t)}}return{imports:e}}return sN()}function sM(){if(!sC)return[];try{let e=localStorage.getItem(s_);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function sL(e){return!!sC&&sM().includes(e)}function sF(e,t){if(!sC)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(sD+e,t),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function sB(e){if(!sC)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(sD+e);let t=sM().filter(t=>t!==e);t.length>0?localStorage.setItem(s_,JSON.stringify(t)):localStorage.removeItem(s_),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function sU(){if(!sC)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 r=localStorage.key(t);r?.startsWith(sD)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(s_),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function sV(e){if(!sC)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=sM().filter(t=>t!==e);t.length>0?localStorage.setItem(s_,JSON.stringify(t)):localStorage.removeItem(s_),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let sW=!1;function sH(){!sW&&(sW=!0,(sC="development"===window.spaEnv)&&(sk=sN()))}function sz(e){return e.replace(/[\/\-@]/g,"_")}async function sK(e,t="./start",n){var o;let a,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([sG(e,n?.importMap),new Promise((t,r)=>{a=setTimeout(()=>{var t;r(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)})]),a&&clearTimeout(a);let s=sz(e),l=window[s];if(!("object"==typeof(o=l)&&null!==o&&"init"in o&&"function"==typeof o.init&&"get"in o&&"function"==typeof o.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(r.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function sG(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 r=sz(e);if(!window[r]){let r=t??await sZ();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let o=e in sI().imports;try{return await function(e){var t;let r=(t=window)[sY]??(t[sY]=new Map),n=r.get(e);if(n)return n;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let o=document.createElement("script");o.src=e,o.type="text/javascript",o.async=!0;let a=new Promise((t,n)=>{let a=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);function i(){clearTimeout(a),o.removeEventListener("load",s),o.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),o.remove();let a=`Failed to load script from ${e}`;console.error(a,t),n(t.message??a)}o.addEventListener("load",s),o.addEventListener("error",l),document.head.appendChild(o)});return r.set(e,a),a}(n)}catch(e){return o&&E({kind:"error",title:iz("scriptLoadingFailed","Error: Script failed to load"),description:iz("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:n}),actionButtonLabel:iz("resetOverrides","Reset overrides"),onActionButtonClick(){sU(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function sZ(){return sj()}let sY=Symbol.for("__openmrs_script_loading");function sq(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,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function sJ(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&sq(t))}let sX="openmrs-routes:",sQ="openmrs-routes:change",s0=!1,s1=null,s2=null;async function s4(){return s2??(s2=s3().then(({map:e,complete:t})=>(t||(s2=null),e))),s2}async function s3(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let o=e[n];try{let e;if(o.src){let t=await fetch(o.src);if(!t.ok)throw Error(`Request for ${o.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else o.textContent&&(e=JSON.parse(o.textContent));e&&sJ(e)&&t.push(e)}catch(e){r=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return{map:s6(t),complete:r}}function s6(e){let t={routes:{}};for(let r of e)r&&"object"==typeof r&&!Array.isArray(r)&&(Object.assign(t.routes,r.routes),void 0===t.version&&void 0!==r.version&&(t.version=r.version));return t}async function s5(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.startsWith(sX)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(sX.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(sq(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(sq(n))return{moduleName:e,routes:n};throw Error(`${r} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===r.status?e.routes[r.value.moduleName]=r.value.routes:console.warn("[route-maps] Failed to load route override",r.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function s9(){let e=await s4();return s0?s6([e,s1??await s5()]):e}async function s8(){return s4()}async function s7(){return s0?s6([await s4(),await s5()]):s4()}function le(){if(!s0)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(sX)){let t=localStorage.getItem(r);t&&(e[r.slice(sX.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function lt(e,t){if(!s0)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(sX+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!sq(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(sX+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(sX+e,JSON.stringify(t.toString()));else{if(!sq(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(sX+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(sQ))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function lr(e){if(!s0)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(sX+e),window.dispatchEvent(new CustomEvent(sQ))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function ln(){if(!s0)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(sX)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(sQ))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let lo=null;function la(){return lo||(lo=(s0="development"===window.spaEnv)?s5().then(e=>{s1=e}):Promise.resolve())}let li=`${i3}/attachment`;function ls(e,t){return i8(`${li}/${e}`,{signal:t.signal})}function ll(e,t,r,n){return i8(lu(e,t,n),{signal:r.signal})}function lu(e,t,r){return r?`${li}?patient=${e}&encounter=${r}`:`${li}?patient=${e}&includeEncounterless=${t}`}async function lc(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),i8(`${li}`,{method:"POST",body:n})}function ld(e,t){return i8(`${li}/${e}`,{method:"DELETE",signal:t.signal})}async function lf(e,t){return e?(await i8(`${i6}/Patient/${e}`,t)).data:null}function lp(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function lm(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}function lh(e){return{uuid:e.uuid,display:e.display}}function lg(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return i8(`${i3}/location${n?"?"+n:""}`).then(e=>e.data.results.map(lh))}function ly(e){return{uuid:e.uuid,display:e.display,name:e.name}}let lv=`${i3}/visittype`;function lb(e=lv){return i8(e).then(e=>e.data.results.map(ly))}var lw=((et={}).NEWVISIT="startVisit",et.EDITVISIT="editVisit",et.LOADING="loadingVisit",et),lE=((er={}).NOTSTARTED="notStarted",er.ONGOING="ongoing",er);let lx="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))",lD=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function l_(){return W("visit",lD)}function lS(e,t){l_().setState({patientUuid:e,manuallySetVisitUuid:t})}function lC(e,t){return i8(`${i3}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function lk(e,t,r){return i8(`${i3}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function lP(e,t,r){return i8(`${i3}/visit?patient=${e}&v=${r??lx}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}l_().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class lO{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+lO.version}static addUnaryOp(e){return lO.max_unop_len=Math.max(e.length,lO.max_unop_len),lO.unary_ops[e]=1,lO}static addBinaryOp(e,t,r){return lO.max_binop_len=Math.max(e.length,lO.max_binop_len),lO.binary_ops[e]=t,r?lO.right_associative.add(e):lO.right_associative.delete(e),lO}static addIdentifierChar(e){return lO.additional_identifier_chars.add(e),lO}static addLiteral(e,t){return lO.literals[e]=t,lO}static removeUnaryOp(e){return delete lO.unary_ops[e],e.length===lO.max_unop_len&&(lO.max_unop_len=lO.getMaxKeyLen(lO.unary_ops)),lO}static removeAllUnaryOps(){return lO.unary_ops={},lO.max_unop_len=0,lO}static removeIdentifierChar(e){return lO.additional_identifier_chars.delete(e),lO}static removeBinaryOp(e){return delete lO.binary_ops[e],e.length===lO.max_binop_len&&(lO.max_binop_len=lO.getMaxKeyLen(lO.binary_ops)),lO.right_associative.delete(e),lO}static removeAllBinaryOps(){return lO.binary_ops={},lO.max_binop_len=0,lO}static removeLiteral(e){return delete lO.literals[e],lO}static removeAllLiterals(){return lO.literals={},lO}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 lO(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 lO.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!lO.binary_ops[String.fromCharCode(e)]||lO.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return lO.isIdentifierStart(e)||lO.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(lO.hooks[e]){let r={context:this,node:t};return lO.hooks.run(e,r),r.node}return t}searchHook(e){if(lO.hooks[e]){let t={context:this};return lO.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===lO.SPACE_CODE||e===lO.TAB_CODE||e===lO.LF_CODE||e===lO.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:lO.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===lO.SEMCOL_CODE||r===lO.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===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,lO.max_binop_len),t=e.length;for(;t>0;){if(lO.binary_ops.hasOwnProperty(e)&&(!lO.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!lO.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,o,a,i,s,l;if(!(a=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return a;for(o={value:t,prec:lO.binaryPrecedence(t),right_a:lO.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[a,o,i];t=this.gobbleBinaryOp();){if(0===(r=lO.binaryPrecedence(t))){this.index-=t.length;break}o={value:t,prec:r,right_a:lO.right_associative.has(t)},l=t;let s=e=>o.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,a=n.pop(),e={type:lO.BINARY_EXP,operator:t,left:a,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(o,e)}for(s=n.length-1,e=n[s];s>1;)e={type:lO.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,lO.isDecimalDigit(e)||e===lO.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===lO.SQUOTE_CODE||e===lO.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===lO.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,lO.max_unop_len)).length;r>0;){if(lO.unary_ops.hasOwnProperty(t)&&(!lO.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!lO.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:lO.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}lO.isIdentifierStart(e)?(n=this.gobbleIdentifier(),lO.literals.hasOwnProperty(n.name)?n={type:lO.LITERAL,value:lO.literals[n.name],raw:n.name}:n.name===lO.this_str&&(n={type:lO.THIS_EXP})):e===lO.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===lO.PERIOD_CODE||t===lO.OBRACK_CODE||t===lO.OPAREN_CODE||t===lO.QUMARK_CODE;){let r;if(t===lO.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==lO.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===lO.OBRACK_CODE?((e={type:lO.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==lO.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===lO.OPAREN_CODE?e={type:lO.CALL_EXP,arguments:this.gobbleArguments(lO.CPAREN_CODE),callee:e}:(t===lO.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:lO.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;lO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===lO.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);lO.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++));lO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);lO.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,lO.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===lO.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===lO.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:lO.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!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 n||this.throwError('Unclosed quote after "'+e+'"'),{type:lO.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(lO.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,lO.isIdentifierPart(e))this.index++;else break;return{type:lO.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){r=!0,this.index++,e===lO.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===lO.COMMA_CODE){if(this.index++,++n!==t.length){if(e===lO.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===lO.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==lO.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(lO.CPAREN_CODE);if(this.code===lO.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:lO.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:lO.ARRAY_EXP,elements:this.gobbleArguments(lO.CBRACK_CODE)}}}Object.assign(lO,{hooks:new class{add(e,t,r){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][r?"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)})}}(lO),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"}),lO.max_unop_len=lO.getMaxKeyLen(lO.unary_ops),lO.max_binop_len=lO.getMaxKeyLen(lO.binary_ops);let lR=e=>new lO(e).parse(),lT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(lO).filter(e=>!lT.includes(e)&&void 0===lR[e]).forEach(e=>{lR[e]=lO[e]}),lR.Jsep=lO,lR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let lN="ArrowFunctionExpression",lj={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)}},lA={...lj,Promise};function l$(e,t={}){return lU(e,t,lH)}async function lI(e,t={}){return lV(e,t,lH)}function lM(e,t={}){return lU(e,t,lz)}function lL(e,t={}){return lV(e,t,lz)}function lF(e,t={}){return lU(e,t,lK)}function lB(e,t={}){return lV(e,t,lK)}function lU(e,t={},r){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 n=lJ(t,lj),o=lG("string"==typeof e?lR(e):e,n);if(r(o))return o;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 lV(e,t={},r){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 n=lJ(t,lA);return Promise.resolve(lG("string"==typeof e?lR(e):e,n)).then(t=>{if(r(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 lW(e){return lR(e)}function lH(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function lz(e){return"boolean"==typeof e}function lK(e){return"number"==typeof e}function lG(e,t){switch(e.type){case"UnaryExpression":var r,n,o,a,i,s,l,u,c,d,f,p,m,h=e,g=t;let y=lG(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return lG(v.left,b)&&lG(v.right,b);case"||":return lG(v.left,b)||lG(v.right,b);case"??":return lG(v.left,b)??lG(v.right,b)}let w=lG(v.left,b),E=lG(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,lG(r.test,n)?lG(r.consequent,n):lG(r.alternate,n);case"CallExpression":return l0(lY(e,t));case"ArrowFunctionExpression":let x;return o=e,a=t,x=o.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,r,n)=>{let o=e[n];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 r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(o)&&t.push([r,o]),t},[]));return lG(o.body,a.addVariables(t))}).bind(null);case"MemberExpression":return l0(lq(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(l1(s));case"SequenceExpression":let D;return l=e,u=t,(D=l.expressions.map(l1(u)))[D.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(l1(S));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(l2(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return f=e,p=t,C=f.expressions?.map(l1(p))??[],(k=f.quasis?.map(l1(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(m=e).cooked,tail:m.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function lZ(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return lZ(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function lY(e,t){let r=lQ(e.callee,t);if(r===lX||e.optional&&null==r)return lX;let n=e.arguments?.map(l1(t));if(r){if("function"!=typeof r)throw`${l6(e.callee)} is not a function`}else throw`No function named ${l6(e.callee)} is defined in this context`;return r(...n)}function lq(e,t){let r=lQ(e.object,t);if(r===lX||e.optional&&null==r)return lX;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${l3(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=lZ(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${l3(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(lG(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);l2(n),function(e,t){if(l4.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let o=r[n];return"function"==typeof o?o.bind(r):o}function lJ(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}lR.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 r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:lN,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=lN,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),lR.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),lR.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 r(t){let r=this.index,n="",o=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};o(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),o());let a=this.char;("e"===a||"E"===a)&&(n+=this.expr.charAt(this.index++),("+"===(a=this.char)||"-"===a)&&(n+=this.expr.charAt(this.index++)),o(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){if(48===this.code){var o,a,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;o=this.code,a=u,95===o||a.some(([e,t])=>o>=e&&o<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,r.call(this,n);return}this.throwError("unexpected char within number")}n.node={type:e.LITERAL,value:parseInt(c,"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)&&r.call(this,n)})}}),lR.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,o=this.expr.slice(r,this.index),a="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)a+=this.char;else break}try{n=new RegExp(o,a)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),lR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),lR.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",o="",a=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:o,cooked:n},tail:a});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,a=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),o="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(o+=i,i=this.expr.charAt(++this.index),o+=i,i){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,o+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),lR.addBinaryOp("in",7),lR.addBinaryOp("??",1);let lX=Symbol("optional chain short-circuited");function lQ(e,t){switch(e.type){case"MemberExpression":return lq(e,t);case"CallExpression":return lY(e,t);default:return lG(e,t)}}function l0(e){return e===lX?void 0:e}function l1(e){return function(t){return null===t?null:lG(t,e)}}function l2(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let l4=new Set(["toString","valueOf","hasOwnProperty"]);function l3(e,t){try{return lZ(e,t)}catch{return"<computed>"}}function l6(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function l5(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:{...lA},isLocalExpression:!1,variables:new Set};return l9("string"==typeof e?lR(e):e,t),[...t.variables]}function l9(e,t){switch(e.type){case"UnaryExpression":return n=e,o=t,l9(n.argument,o);case"BinaryExpression":return a=e,i=t,[l9(a.left,i),l9(a.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[l9(s.consequent,l),l9(s.test,l),l9(s.alternate,l)].filter(Boolean);case"CallExpression":let r;return u=e,c=t,r=l9(u.callee,c),u.arguments?.map(l8(c)),r;case"ArrowFunctionExpression":var n,o,a,i,s,l,u,c,d,f,p,m,h,g,y,v,b=e,w=t;let E={...w};E.isLocalExpression=!0;let x=b.params?.map(l8(E))??[],D=l9(b.body,E)??[];if(D&&Array.isArray(D))for(let e of D)x.includes(e)||w.variables.add(e);return;case"MemberExpression":var _=e,S=t;if(l9(_.object,S),_.computed)return void l9(_.property,S);let C={...S};C.isLocalExpression=!0,l9(_.property,C);return;case"ArrayExpression":return d=e,f=t,void d.elements?.map(l8(f));case"SequenceExpression":return p=e,m=t,void p.expressions?.map(l8(m));case"NewExpression":return h=e,g=t,void h.arguments?.map(l8(g));case"Literal":case"TemplateElement":return;case"Identifier":var k=e,P=t;if(!(k.name in P.globals))if(P.isLocalExpression)return k.name;else P.variables.add(k.name);return;case"TemplateLiteral":return y=e,v=t,void(y.expressions?.map(l8(v)),y.quasis?.map(l8(v)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function l8(e){return function(t){return null===t?null:l9(t,e)}}let l7=W("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function ue(e,t,r){l7.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function ut(){let e=l7.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let r=t.replace("openmrs:feature-flag:","");e[r]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${r}`))})}function ur(e){return l7.getState().flags[e].enabled}function un(e,t){l7.subscribe(r=>{t(r.flags[e].enabled)})}function uo(e,t){l7.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}l7.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var ua=tB(function(e,t,r){tN(e,t,r)});let ui=B("extensionsInternal",{slots:{},extensions:{}}),us=B("extensionRenderings",{renderings:new Map}),ul=()=>W("extensionsInternal",{slots:{},extensions:{}}),uu=()=>W("extensionRenderings",{renderings:new Map});function uc(e){let t=ui.getState(),r=e(t);r!==t&&ui.setState(r)}let ud=null,uf=null;function up(){let e=us.getState();return ud&&e===uf||(ud=new Map(e.renderings),uf=e,function(e){for(let t of(uD.clear(),e.values()))uS(t,1);u_=!0}(ud)),ud}function um(e){uf={renderings:e},us.setState(uf,!0)}function uh(e){let t=up();t.has(e.renderingId)||(t.set(e.renderingId,e),uS(e,1),um(t))}function ug(e){let t=up(),r=t.get(e);r&&(t.delete(e),uS(r,-1),um(t))}let uy=()=>W("extensions",{slots:{}}),uv=0,ub=new Set;function uw(e){uv++;try{return e()}finally{if(0==--uv&&ub.size>0){let e=Array.from(ub);for(let t of(ub.clear(),e))uE(t)}}}function uE(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function ux(e){uv>0?ub.add(e):uE(e)}let uD=new Map,u_=!1;function uS(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=uD.get(r);if(!n){if(t<0)return;uD.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),u_=!0;return}n.count+=t,n.count<1&&(uD.delete(r),u_=!0)}function uC(){var e,t;if(up(),!u_)return;u_=!1;let r=Array.from(uD.values(),({record:e})=>e);r.sort(uk),e=nm.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===uk(e,t[r]))||nm.setState({mountedExtensions:r})}function uk(e,t){return uP(e.slotName,t.slotName)||uP(e.extensionId,t.extensionId)||uP(e.slotModuleName,t.slotModuleName)||uP(e.extensionModuleName,t.extensionModuleName)}function uP(e,t){return e===t?0:e<t?-1:1}uC(),us.subscribe(()=>ux(uC));let uO=ul(),uR=uy(),uT=ng(),uN=nb(),uj=new Set,uA=!1;function u$(e){if(null===e)uj=null;else if(null!==uj)for(let t of e)uj.add(t);ux(uI)}function uI(){if(!uA){uA=!0;try{for(let e=1;;e++){let t=uj;if(null!==t&&0===t.size)return;uj=new Set;try{!function(e,t,r,n,o,a=null){let i=uR.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,c]of Object.entries(e.slots)){let d=i[n];if(d&&a&&!a.has(n)){s[n]=d;continue}let{config:f}=nv(t,c.name),p=function(e,t,r,n,o,a){let i=function(e,t){let r=e.add||[],n=e.remove||[],o=e.order||[],{extensions:a}=uO.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=uK(o),u=uK(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let o=t.get(e);if(void 0!==o)return o;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,a[uF(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=nw(n,e,l),u=nE(r,e,l),c=u?ua({},i,u):i,d=uF(l),f=t.extensions[d];if(f){let e=c?.["Display conditions"]?.privileges??f.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!a?.user||!su(e,a.user))||f.featureFlag&&!o.includes(f.featureFlag))continue;s.push({id:l,name:d,moduleName:f.moduleName,config:c,featureFlag:f.featureFlag,meta:f.meta,displayConditionExpression:c?.["Display conditions"]?.expression||f.displayExpression})}}return s}(n,e,f,r,u,o.session);d&&d.moduleName===c.moduleName&&rx(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&uR.setState({slots:s})}(uO.getState(),uT.getState(),uN.getState(),l7.getState(),se.getState(),t)}catch(e){throw uj=null===t||null===uj?null:new Set([...t,...uj]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{uA=!1}}}function uM(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function uL(e,t){return{moduleName:t,name:e,attachedIds:[]}}function uF(e){let[t]=e.split("#");return t}function uB(e,t){let r=uF(t);return e.extensions[r]}function uU(e){return uB(uO.getState(),e)}uO.subscribe((e,t)=>{u$(e.extensions!==t.extensions?null:uM(e.slots,t.slots))}),uT.subscribe((e,t)=>{u$(uM(e.slots,t.slots))}),uN.subscribe((e,t)=>{u$(uM(e.configs,t.configs))}),l7.subscribe(()=>u$(null)),se.subscribe(()=>u$(null)),u$(null);let uV=e=>uc(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function uW(e,t){uc(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...uL(e),attachedIds:[t]}}}})}function uH(e,t){uc(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function uz(e){uc(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function uK(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function uG(e,t){return function(e,t,r=null,n){let o;return e.filter(e=>{let a=e.displayConditionExpression;if("string"!=typeof a||0===a.trim().length)return!0;o??(o=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!lM(a,o)}catch(t){return console.error(`Error while evaluating expression '${a}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(uZ(e),t,se.getState().session,e)}function uZ(e){return uR.getState().slots[e]?.candidateExtensions??[]}let uY=(e,t)=>uO.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=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 ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let o=uL(t,e);return{...r,slots:{...r.slots,[t]:{...o}}}}),uq=()=>{uj=null,uc(()=>({slots:{},extensions:{}})),uu().setState({renderings:new Map}),uR.setState({slots:{}})},uJ=B("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function uX({name:e,basePath:t,mode:r,componentContext:n,state:o}){uJ.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:o})}function uQ(e){uJ.getState().slotName===e&&uJ.setState(uJ.getInitialState(),!0)}let u0=B("modalRegistry",{modals:{}});function u1(e){u0.setState(t=>(t.modals[e.name]=e,t))}function u2(e){let t=u0.getState().modals[e];if(!t){let r=uU(e);r&&(t={name:e,load:r.load,moduleName:r.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.`),u1(t))}return t}let u4=B("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function u3(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=u4.getState(),n=t[e];if(n){let t=r[n.window];if(t)return t;throw Error(`No workspace window found with name: ${n.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function u6(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=u4.getState(),n=r[e];if(n){let r=t[n.group];if(r)return r;throw Error(`No workspace group found with name: ${n.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function u5(e){let{openedWindows:t}=u4.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function u9(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=u4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace group ${r.name} more than once`);n[r.name]={...r,moduleName:e}}u4.setState({registeredGroupsByName:n})}function u8(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=u4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace window ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}u4.setState({registeredWindowsByName:n})}function u7(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=u4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}u4.setState({registeredWorkspacesByName:n})}let ce=0,ct=null,cr={bootstrap:15e3,mount:15e3,unmount:15e3};function cn(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(cr).filter(t=>e[t]).map(n=>{var o,a;let i,s;return[n,(o=e[n],a=cr[n],i=Array.isArray(o)?o:[o],s=e=>i.reduce((t,o,a)=>t.then(()=>{let t=o(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${a} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let o,i=new Promise((e,t)=>{o=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${a}ms`)),a)});return Promise.race([s(e),i]).finally(()=>clearTimeout(o)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function co(e,t){var r,n;let o,a,i,s,l,u=await (ct??(ct=new Promise((e,t)=>{o6({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),o6))),ct),c={...t},d=(o=c,a=!1,{retarget:e=>o={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(o),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":a||(a=t);return;case"unmount":(t||a)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>cn(e,r)):cn(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function ca(){return ci}function ci(e,t){let r,n=co(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function cs(e,t,r,n,o=e=>e,a={}){let i=uF(n),s=uU(n),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:f}=s,p=ce++,m=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=m;let h=e=>{try{ug(m)}catch(t){console.error(e,t)}};try{uh({renderingId:m,extensionName:i,extensionModuleName:d,extensionId:n,slotName:t,slotModuleName:r})}catch(e){throw h(`Recomputing configuration after registering '${n}' failed also failed`),e}try{u=await f()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await co(o({...u,name:`${t}/${i}-${p}`}),{...a,_meta:c,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var cl=r(4923),cu=r.n(cl);let cc=(0,cl.createContext)({moduleName:"",featureName:""});function cd({to:e,templateParams:t,onBeforeNavigate:r,children:n,...o}){return(0,cl.useEffect)(()=>{o.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${o.href}'`),o.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),cu().createElement("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),iZ({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:iK(e,t),...o},n)}let cf=({state:e,children:t,...r})=>{let{extension:n}=(0,cl.useContext)(cc),o=(0,cl.useRef)(null),a=(0,cl.useRef)(Promise.resolve()),i=(0,cl.useRef)(!1),s=(0,cl.useRef)(!1),l=(0,cl.useRef)(e),u=(0,cl.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":a.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,cl.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(a.current=Promise.all([e.mountPromise,a.current]).then(()=>{if(o.current?.getStatus()==="MOUNTED"&&o.current.update)return o.current.update({...t})}).catch(e=>{let t=o.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,cl.useCallback)(t=>{t&&!o.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,cs(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,o.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,cl.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(o.current)}),[]),(0,cl.useEffect)(()=>{l.current=e,o.current&&c(o.current,e)},[e]),n?cu().createElement("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function cp(e){let t=(0,cl.useRef)(e);return R(t.current,e)||(t.current=e),t.current}function cm(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,o]of Object.entries(t)){let t=function(...t){e.setState(e=>o(e,...t))};r[n]=t}return r}let ch=e=>e;function cg(e,t=ch,r){let n=(0,cl.useCallback)(t=>e.subscribe(t),[e]),o=(0,cl.useCallback)(()=>t(e.getState()),[e,t]),a=(0,cl.useSyncExternalStore)(n,o,o),i=(0,cl.useMemo)(()=>r?cm(e,r):null,[e,r]);return(0,cl.useMemo)(()=>i?{...a,...i}:a,[a,i])}function cy(e,t){return cg(e,ch,t)}function cv(e){return function(t){let r=(0,cl.useCallback)(t=>e.subscribe(t),[]),n=(0,cl.useCallback)(()=>e.getState(),[]),o=(0,cl.useSyncExternalStore)(r,n,n),a=(0,cl.useMemo)(()=>t?cm(e,t):null,[t]);return(0,cl.useMemo)(()=>a?{...o,...a}:o,[o,a])}}let cb=[];Object.freeze(cb);let cw={candidateExtensions:cb};Object.freeze(cw);let cE=e=>{let t=(0,cl.useCallback)(t=>t.slots?.[e]??cw,[e]);return cg(uy(),t)},cx=e=>e.session;function cD(e,t){let{candidateExtensions:r}=cE(e),n=cg(se,cx),o=cp(t);return(0,cl.useMemo)(()=>uG(e,o),[e,o,n,r])}function c_(e,t){let{moduleName:r}=(0,cl.useContext)(cc);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,cl.useEffect)(()=>{uY(r,e)},[r,e]),{extensions:cD(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function cS(e){return e}function cC({name:e,extensionSlotName:t,select:r=cS,children:n,state:o,style:a,...i}){if(n&&o)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,cl.useRef)(null),{extensions:u,extensionSlotModuleName:c}=c_(s,o),d=(0,cl.useMemo)(()=>r(u),[r,u]),f=(0,cl.useMemo)(()=>{if("function"==typeof n&&!cu().isValidElement(n))return d.map(e=>n(e,o))},[n,d]);return cu().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...a,position:"relative"},...i},s&&d?.map((e,t)=>cu().createElement(cc.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},f?.[t]??("function"!=typeof n?n:null)??cu().createElement(cf,{state:o}))))}var ck=r(5338);function cP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function cO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cP(Object(r),!0).forEach(function(t){var n,o,a;n=e,o=t,a=r[t],o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cP(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function cR(e){return(cR="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 cT(e){return(cT="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 cN(e,t){var r;if("function"!=typeof(r=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 r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,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(cT(r)));return function(){var e=r(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(cT(e)));return e}}var cj=null;try{cj=require("react").createContext()}catch(e){}var cA={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 c$(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function cI(e,t){return new Promise(function(r,n){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 o,a=cB(e,t,function(){r(this)}),i=cN(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,o=e.domElement,a=t[r];if("function"!=typeof a)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=a(o);return i.render(n),i;case"hydrateRoot":return a(o,n);default:return a(n,o),null}}({elementToRender:a,domElement:i,reactDom:cF(e),renderType:"function"==typeof(o=e).renderType?o.renderType():o.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function cM(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():cF(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function cL(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=cB(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(n);else{var a=cN(e,t)();cF(e).render(n,a)}})}function cF(e){return e.ReactDOMClient||e.ReactDOM}function cB(e,t,r){var n=e.React.createElement(e.rootComponent,t),o=cj?e.React.createElement(cj.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),o=e.React.createElement(e.errorBoundaryClass,t,o)),o=e.React.createElement(e.SingleSpaRoot,cO(cO({},t),{},{mountFinished:r,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])}}),o)}var cU=r(202),cV=r(2551),cW=r.n(cV),cH=r(7900);let cz={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},cK=new Map;(0,cH.initCache)(cK);let cG={errorRetryCount:3,fetcher:i8,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof i7){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>cK};function cZ(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},cz,e),r={...cG,...t.swrConfig};return function(e){var n,o,a,i,s;return a=o=class extends(n=cu().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return cu().createElement("div",null,"An error has occurred. Please try reloading the page.");{let n=cu().createElement(cl.Suspense,{fallback:null},cu().createElement(cV.SWRConfig,{value:r},cu().createElement(cc.Provider,{value:this.state.config},t.disableTranslations?cu().createElement(e,this.props):cu().createElement(cU.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},cu().createElement(e,this.props)))));return t.strictMode&&cu().StrictMode?cu().createElement(cu().StrictMode,null,n):n}}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 a?Object.defineProperty(a,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[i]=s,o}}function cY(e,t){return function(e){if("object"!==cR(e))throw Error("single-spa-react requires a configuration object");var t,r=cO(cO({},cA),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!cj&&r.React.createContext&&(cj=r.React.createContext()),r.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}(r);var n={bootstrap:c$.bind(null,r),mount:cI.bind(null,r),unmount:cM.bind(null,r)};return r.parcelCanUpdate&&(n.update=cL.bind(null,r)),n}({React:cu(),ReactDOMClient:ck,rootComponent:cZ(t)(e)})}function cq(e,t){return()=>e().then(({default:e})=>cY(e,t))}function cJ(e,t){return()=>Promise.resolve(cY(e,t))}let cX=cq,cQ=A()(()=>({}));V("openmrs-app-context",cQ);let c0={};function c1(e,t=e=>e){let r=cQ.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function c2(e,t){cQ.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function c4(e){return null===e?null:Object.freeze(Object.assign({},e))}let c3=new Map;function c6(e,t){let r=(0,cl.useRef)(t??{}),n=(0,cl.useRef)(t=>c2(e,t)),o=(0,cl.useRef)(Symbol());return(0,cl.useEffect)(()=>{let r=t??{},n=o.current;return null===c1(e)?!function(e,t=c0){cQ.setState(r=>{if(e in r)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({},r,{[e]:t===c0?{}:t})})}(e,r):(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.`),c2(e,()=>r)),c3.set(e,n),()=>{c3.get(e)===n&&(cQ.setState(t=>(e in t&&delete t[e],t)),c3.delete(e))}},[e]),(0,cl.useEffect)(()=>{let n=t??{};R(r.current,n)||(c2(e,()=>n),r.current=n)},[t]),n.current}function c5({namespace:e,value:t}){return c6(e,t),null}let c9=({children:e,value:t,fallback:r})=>t?cu().createElement(cu().Fragment,null,e):r?cu().createElement(cu().Fragment,null,r):null;function c8(){let e=(0,cl.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,cl.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function c7(e,t=e=>e??{}){let[r,n]=(0,cl.useState)(()=>{if(de(e))return;let r=c1(e);if(null!==r)return t?t(r):r});return(0,cl.useEffect)(()=>{if(de(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,cl.useEffect)(()=>{var r;let o;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>R(e,r)?e:r)})(c4(o=c1(e))),cQ.subscribe(t=>{let n=e in t?t[e]:null;n!==o&&(o=n,r(c4(n)))})},[e,t]),r}function de(e){return"string"!=typeof e||0===e.trim().length}function dt(e){let t=cD(e);return(0,cl.useMemo)(()=>t.map(e=>e.id),[t])}function dr(e){return cE(e).candidateExtensions}function dn(e,t,r){let{data:n,error:o,mutate:a,isLoading:i,isValidating:s}=cW()(e?lu(e,t,r):null,i8);return(0,cl.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:o,mutate:a,isValidating:s}),[n,o,i,s,a])}function da(e){(0,cl.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let di={},ds=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
15
|
+
${this.stack}`}}let se=B("session",{loaded:!1,session:null}),st=0,sr=null;function sn(){return sr||(se.getState().loaded&&st>=Date.now()-6e4?null:ss())}function so(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=sn();return n?new Promise(e=>{let t=()=>{let t=se.getState();t.loaded&&(o(),e(r(t.session)))},o=se.subscribe(t);n.then(t,t)}):Promise.resolve(r(se.getState().session))}function sa(){return sn(),se}function si(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 ss(e,t){st=Date.now(),a??(a=st);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=sy(i8(i5,{headers:r,rejectAuthFailure:!0})),o=()=>{sr===n&&(sr=null)};return n.then(o,o),sr=n,n}function sl(){se.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function su(e,t){var r,n;if(void 0===t)return!e;if(!e)return!0;return r=e,n=t,("string"==typeof r?!K(n.privileges.find(e=>r===e.display)):Array.isArray(r)?r.every(e=>!K(n.privileges.find(t=>e===t.display))):(K(r)||console.error(`Could not understand privileges "${r}"`),!0))||!K(t.roles.find(e=>"System Developer"===e.display))}function sc(){let e,t;return new Promise(r=>{let n=n=>{n.loaded&&n.session.user&&(e=n.session.user,r(n.session.user),t&&t())};n(se.getState()),e||(t=se.subscribe(n))})}async function sd(){return(await so()).sessionLocation}async function sf(e,t){return sy(i8(i5,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function sp(e,t){return await i8(i5,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),ss()}async function sm(e,t,r){return r||(r=new AbortController),await i8(`${i3}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),ss()}async function sh(e,t=!1){let r=await i8(t?`${i5}?rememberMe=true`:i5,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await ss()).session:r.data}async function sg(){try{await i8(i5,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!sv(e))throw e}sl(),await ss().catch(()=>{})}function sy(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};se.setState(r,!0),t(r)}else!function(e){if(!e?.redirected||!e.url)return!1;try{return new URL(e.url,window.location.href).pathname.replace(/\/+$/,"").endsWith("/initialsetup")}catch{return!1}}(e)?r(sb(Error("The session endpoint did not respond with a session"))):r(sb(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(sv(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?se.setState({loaded:!0,session:e.responseBody},!0):sl(),t(se.getState());return}(o=e)instanceof i7&&502===o.response.status&&!se.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(sb(e,!0)):(k(`Failed to fetch new session information: ${e}`),r(sb(e)))})})}function sv(e){return e instanceof i7&&(401===e.response.status||403===e.response.status)}function sb(e,t=!1){return se.getState().loaded||se.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),se.getState()}function sw(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}se.subscribe(e=>{e.loaded&&e.session&&si(e.session)});let sE={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function sx(){nV("@openmrs/esm-api",i2),ss()}let sD="import-map-override:",s_="import-map-overrides-disabled",sS="import-map-overrides:change",sC=!1,sk=null,sP=null;async function sO(){return sP??(sP=sR().then(({map:e,complete:t})=>(t||(sP=null),e))),sP}async function sR(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let o=e[n];try{if(o.src){let e=await fetch(o.src);if(!e.ok)throw Error(`Request for ${o.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else o.textContent&&t.push(JSON.parse(o.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:sT(t),complete:r}}function sT(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function sN(){let e={};try{let t=sM();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(sD)){let r=n.slice(sD.length);if(!t.includes(r)){let t=localStorage.getItem(n);t&&(e[r]=t)}}}}catch(e){console.warn("[import-maps] Failed to read import-map overrides from localStorage",e)}return{imports:e}}async function sj(){let e=await sO();return sC?sT([e,sk??sN()]):e}async function sA(){return sO()}async function s$(){return sC?sT([await sO(),sN()]):sO()}function sI(e){if(!sC)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(sD)){let t=localStorage.getItem(r);t&&(e[r.slice(sD.length)]=t)}}return{imports:e}}return sN()}function sM(){if(!sC)return[];try{let e=localStorage.getItem(s_);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function sL(e){return!!sC&&sM().includes(e)}function sF(e,t){if(!sC)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(sD+e,t),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function sB(e){if(!sC)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(sD+e);let t=sM().filter(t=>t!==e);t.length>0?localStorage.setItem(s_,JSON.stringify(t)):localStorage.removeItem(s_),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function sU(){if(!sC)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 r=localStorage.key(t);r?.startsWith(sD)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(s_),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function sV(e){if(!sC)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=sM().filter(t=>t!==e);t.length>0?localStorage.setItem(s_,JSON.stringify(t)):localStorage.removeItem(s_),window.dispatchEvent(new CustomEvent(sS))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let sW=!1;function sH(){!sW&&(sW=!0,(sC="development"===window.spaEnv)&&(sk=sN()))}function sz(e){return e.replace(/[\/\-@]/g,"_")}async function sK(e,t="./start",n){var o;let a,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([sG(e,n?.importMap),new Promise((t,r)=>{a=setTimeout(()=>{var t;r(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)})]),a&&clearTimeout(a);let s=sz(e),l=window[s];if(!("object"==typeof(o=l)&&null!==o&&"init"in o&&"function"==typeof o.init&&"get"in o&&"function"==typeof o.get)){let e=`The global variable ${s} does not refer to a federated module`;throw console.error(e),Error(e)}l.init(r.S.default);let u=(await l.get(t))();if("object"!=typeof u||null===u){let t=`Container for ${e} did not return an ESM module as expected`;throw console.error(t),Error(t)}return u}async function sG(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 r=sz(e);if(!window[r]){let r=t??await sZ();if(!r.imports.hasOwnProperty(e)){let t=`Could not find the package ${e} defined in the current importmap`;throw console.error(t),Error(t)}let n=r.imports[e];n.startsWith("./")&&(n=window.spaBase+n.substring(1));let o=e in sI().imports;try{return await function(e){var t;let r=(t=window)[sY]??(t[sY]=new Map),n=r.get(e);if(n)return n;if(document.head.querySelector(`script[src="${e}"]`))return console.warn(`Script at ${e} already loaded. Not loading it again.`),Promise.resolve();let o=document.createElement("script");o.src=e,o.type="text/javascript",o.async=!0;let a=new Promise((t,n)=>{let a=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);function i(){clearTimeout(a),o.removeEventListener("load",s),o.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),o.remove();let a=`Failed to load script from ${e}`;console.error(a,t),n(t.message??a)}o.addEventListener("load",s),o.addEventListener("error",l),document.head.appendChild(o)});return r.set(e,a),a}(n)}catch(e){return o&&E({kind:"error",title:iz("scriptLoadingFailed","Error: Script failed to load"),description:iz("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:n}),actionButtonLabel:iz("resetOverrides","Reset overrides"),onActionButtonClick(){sU(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function sZ(){return sj()}let sY=Symbol.for("__openmrs_script_loading");function sq(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,"modals")&&(!e.modals||!Array.isArray(e.modals))||Object.hasOwn(e,"workspaces2")&&(!e.workspaces2||!Array.isArray(e.workspaces2))||Object.hasOwn(e,"workspaceWindows2")&&(!e.workspaceWindows2||!Array.isArray(e.workspaceWindows2))||Object.hasOwn(e,"workspaceGroups2")&&(!e.workspaceGroups2||!Array.isArray(e.workspaceGroups2)))}function sJ(e){return!!e&&"object"==typeof e&&"routes"in e&&!!e.routes&&"object"==typeof e.routes&&Object.entries(e.routes).every(([e,t])=>"string"==typeof e&&sq(t))}let sX="openmrs-routes:",sQ="openmrs-routes:change",s0=!1,s1=null,s2=null;async function s4(){return s2??(s2=s3().then(({map:e,complete:t})=>(t||(s2=null),e))),s2}async function s3(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let o=e[n];try{let e;if(o.src){let t=await fetch(o.src);if(!t.ok)throw Error(`Request for ${o.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else o.textContent&&(e=JSON.parse(o.textContent));e&&sJ(e)&&t.push(e)}catch(e){r=!1,console.warn(`[route-maps] Failed to parse routes from script tag at index ${n}`,e)}}return{map:s6(t),complete:r}}function s6(e){let t={routes:{}};for(let r of e)r&&"object"==typeof r&&!Array.isArray(r)&&(Object.assign(t.routes,r.routes),void 0===t.version&&void 0!==r.version&&(t.version=r.version));return t}async function s5(){let e={version:void 0,routes:{}};try{let t=[];for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.startsWith(sX)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(sX.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(sq(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(sq(n))return{moduleName:e,routes:n};throw Error(`${r} did not resolve to a valid OpenmrsAppRoutes object`)}throw Error(`Override for ${e} is neither a valid routes object nor a URL`)}))))"fulfilled"===r.status?e.routes[r.value.moduleName]=r.value.routes:console.warn("[route-maps] Failed to load route override",r.reason)}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}async function s9(){let e=await s4();return s0?s6([e,s1??await s5()]):e}async function s8(){return s4()}async function s7(){return s0?s6([await s4(),await s5()]):s4()}function le(){if(!s0)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(sX)){let t=localStorage.getItem(r);t&&(e[r.slice(sX.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function lt(e,t){if(!s0)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(sX+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!sq(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(sX+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(sX+e,JSON.stringify(t.toString()));else{if(!sq(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(sX+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(sQ))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function lr(e){if(!s0)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(sX+e),window.dispatchEvent(new CustomEvent(sQ))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function ln(){if(!s0)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{let e=[];for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);r?.startsWith(sX)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(sQ))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let lo=null;function la(){return lo||(lo=(s0="development"===window.spaEnv)?s5().then(e=>{s1=e}):Promise.resolve())}let li=`${i3}/attachment`;function ls(e,t){return i8(`${li}/${e}`,{signal:t.signal})}function ll(e,t,r,n){return i8(lu(e,t,n),{signal:r.signal})}function lu(e,t,r){return r?`${li}?patient=${e}&encounter=${r}`:`${li}?patient=${e}&includeEncounterless=${t}`}async function lc(e,t,r){let n=new FormData;return n.append("fileCaption",t.fileDescription),n.append("patient",e),r&&n.append("encounter",r),t.file?n.append("file",t.file,t.fileName):(n.append("file",new File([""],t.fileName),t.fileName),n.append("base64Content",t.base64Content)),i8(`${li}`,{method:"POST",body:n})}function ld(e,t){return i8(`${li}/${e}`,{method:"DELETE",signal:t.signal})}async function lf(e,t){return e?(await i8(`${i6}/Patient/${e}`,t)).data:null}function lp(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function lm(e,t){let r=e=>{t("detail"in e&&null!==e.detail?e.detail:void 0)};return window.addEventListener(`openmrs:${e}`,r),()=>{window.removeEventListener(`openmrs:${e}`,r)}}function lh(e){return{uuid:e.uuid,display:e.display}}function lg(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return i8(`${i3}/location${n?"?"+n:""}`).then(e=>e.data.results.map(lh))}function ly(e){return{uuid:e.uuid,display:e.display,name:e.name}}let lv=`${i3}/visittype`;function lb(e=lv){return i8(e).then(e=>e.data.results.map(ly))}var lw=((et={}).NEWVISIT="startVisit",et.EDITVISIT="editVisit",et.LOADING="loadingVisit",et),lE=((er={}).NOTSTARTED="notStarted",er.ONGOING="ongoing",er);let lx="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))",lD=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function l_(){return W("visit",lD)}function lS(e,t){l_().setState({patientUuid:e,manuallySetVisitUuid:t})}function lC(e,t){return i8(`${i3}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function lk(e,t,r){return i8(`${i3}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function lP(e,t,r){return i8(`${i3}/visit?patient=${e}&v=${r??lx}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}l_().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class lO{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+lO.version}static addUnaryOp(e){return lO.max_unop_len=Math.max(e.length,lO.max_unop_len),lO.unary_ops[e]=1,lO}static addBinaryOp(e,t,r){return lO.max_binop_len=Math.max(e.length,lO.max_binop_len),lO.binary_ops[e]=t,r?lO.right_associative.add(e):lO.right_associative.delete(e),lO}static addIdentifierChar(e){return lO.additional_identifier_chars.add(e),lO}static addLiteral(e,t){return lO.literals[e]=t,lO}static removeUnaryOp(e){return delete lO.unary_ops[e],e.length===lO.max_unop_len&&(lO.max_unop_len=lO.getMaxKeyLen(lO.unary_ops)),lO}static removeAllUnaryOps(){return lO.unary_ops={},lO.max_unop_len=0,lO}static removeIdentifierChar(e){return lO.additional_identifier_chars.delete(e),lO}static removeBinaryOp(e){return delete lO.binary_ops[e],e.length===lO.max_binop_len&&(lO.max_binop_len=lO.getMaxKeyLen(lO.binary_ops)),lO.right_associative.delete(e),lO}static removeAllBinaryOps(){return lO.binary_ops={},lO.max_binop_len=0,lO}static removeLiteral(e){return delete lO.literals[e],lO}static removeAllLiterals(){return lO.literals={},lO}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 lO(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 lO.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!lO.binary_ops[String.fromCharCode(e)]||lO.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return lO.isIdentifierStart(e)||lO.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(lO.hooks[e]){let r={context:this,node:t};return lO.hooks.run(e,r),r.node}return t}searchHook(e){if(lO.hooks[e]){let t={context:this};return lO.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===lO.SPACE_CODE||e===lO.TAB_CODE||e===lO.LF_CODE||e===lO.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:lO.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],r,n;for(;this.index<this.expr.length;)if((r=this.code)===lO.SEMCOL_CODE||r===lO.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())t.push(n);else if(this.index<this.expr.length){if(r===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,lO.max_binop_len),t=e.length;for(;t>0;){if(lO.binary_ops.hasOwnProperty(e)&&(!lO.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!lO.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,n,o,a,i,s,l;if(!(a=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return a;for(o={value:t,prec:lO.binaryPrecedence(t),right_a:lO.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[a,o,i];t=this.gobbleBinaryOp();){if(0===(r=lO.binaryPrecedence(t))){this.index-=t.length;break}o={value:t,prec:r,right_a:lO.right_associative.has(t)},l=t;let s=e=>o.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;n.length>2&&s(n[n.length-2]);)i=n.pop(),t=n.pop().value,a=n.pop(),e={type:lO.BINARY_EXP,operator:t,left:a,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(o,e)}for(s=n.length-1,e=n[s];s>1;)e={type:lO.BINARY_EXP,operator:n[s-1].value,left:n[s-2],right:e},s-=2;return e}gobbleToken(){let e,t,r,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"))return this.runHook("after-token",n);if(e=this.code,lO.isDecimalDigit(e)||e===lO.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===lO.SQUOTE_CODE||e===lO.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===lO.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,lO.max_unop_len)).length;r>0;){if(lO.unary_ops.hasOwnProperty(t)&&(!lO.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!lO.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:lO.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}lO.isIdentifierStart(e)?(n=this.gobbleIdentifier(),lO.literals.hasOwnProperty(n.name)?n={type:lO.LITERAL,value:lO.literals[n.name],raw:n.name}:n.name===lO.this_str&&(n={type:lO.THIS_EXP})):e===lO.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===lO.PERIOD_CODE||t===lO.OBRACK_CODE||t===lO.OPAREN_CODE||t===lO.QUMARK_CODE;){let r;if(t===lO.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==lO.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===lO.OBRACK_CODE?((e={type:lO.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==lO.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===lO.OPAREN_CODE?e={type:lO.CALL_EXP,arguments:this.gobbleArguments(lO.CPAREN_CODE),callee:e}:(t===lO.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:lO.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,r;for(;lO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===lO.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);lO.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++));lO.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);lO.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,lO.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===lO.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===lO.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:lO.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){n=!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 n||this.throwError('Unclosed quote after "'+e+'"'),{type:lO.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(lO.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,lO.isIdentifierPart(e))this.index++;else break;return{type:lO.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){r=!0,this.index++,e===lO.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===lO.COMMA_CODE){if(this.index++,++n!==t.length){if(e===lO.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===lO.CBRACK_CODE)for(let e=t.length;e<n;e++)t.push(null)}}else if(t.length!==n&&0!==n)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==lO.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(lO.CPAREN_CODE);if(this.code===lO.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:lO.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:lO.ARRAY_EXP,elements:this.gobbleArguments(lO.CBRACK_CODE)}}}Object.assign(lO,{hooks:new class{add(e,t,r){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][r?"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)})}}(lO),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"}),lO.max_unop_len=lO.getMaxKeyLen(lO.unary_ops),lO.max_binop_len=lO.getMaxKeyLen(lO.binary_ops);let lR=e=>new lO(e).parse(),lT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(lO).filter(e=>!lT.includes(e)&&void 0===lR[e]).forEach(e=>{lR[e]=lO[e]}),lR.Jsep=lO,lR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}});let lN="ArrowFunctionExpression",lj={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)}},lA={...lj,Promise};function l$(e,t={}){return lU(e,t,lH)}async function lI(e,t={}){return lV(e,t,lH)}function lM(e,t={}){return lU(e,t,lz)}function lL(e,t={}){return lV(e,t,lz)}function lF(e,t={}){return lU(e,t,lK)}function lB(e,t={}){return lV(e,t,lK)}function lU(e,t={},r){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 n=lJ(t,lj),o=lG("string"==typeof e?lR(e):e,n);if(r(o))return o;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 lV(e,t={},r){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 n=lJ(t,lA);return Promise.resolve(lG("string"==typeof e?lR(e):e,n)).then(t=>{if(r(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 lW(e){return lR(e)}function lH(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function lz(e){return"boolean"==typeof e}function lK(e){return"number"==typeof e}function lG(e,t){switch(e.type){case"UnaryExpression":var r,n,o,a,i,s,l,u,c,d,f,p,m,h=e,g=t;let y=lG(h.argument,g);switch(h.operator){case"+":return+y;case"-":return-y;case"~":return~y;case"!":return!y;default:throw`Expression evaluator does not support operator '${h.operator}''`}case"BinaryExpression":var v=e,b=t;switch(v.operator){case"&&":return lG(v.left,b)&&lG(v.right,b);case"||":return lG(v.left,b)||lG(v.right,b);case"??":return lG(v.left,b)??lG(v.right,b)}let w=lG(v.left,b),E=lG(v.right,b);switch(v.operator){case"+":return w+E;case"-":return w-E;case"*":return w*E;case"/":return w/E;case"%":return w%E;case"**":return w**E;case"==":return w==E;case"===":return w===E;case"!=":return w!=E;case"!==":return w!==E;case">":return w>E;case">=":return w>=E;case"<":return w<E;case"<=":return w<=E;case"in":return w in E;default:throw`Expression evaluator does not support operator '${v.operator}' operator`}case"ConditionalExpression":return r=e,n=t,lG(r.test,n)?lG(r.consequent,n):lG(r.alternate,n);case"CallExpression":return l0(lY(e,t));case"ArrowFunctionExpression":let x;return o=e,a=t,x=o.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<x.length)throw`Required argument(s) ${x.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(x.reduce((t,r,n)=>{let o=e[n];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 r of Object.keys(t))if(!e(t[r]))return!1;return!0}if(Array.isArray(t)){for(let r of t)if(!e(r))break}return!1}(o)&&t.push([r,o]),t},[]));return lG(o.body,a.addVariables(t))}).bind(null);case"MemberExpression":return l0(lq(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(l1(s));case"SequenceExpression":let D;return l=e,u=t,(D=l.expressions.map(l1(u)))[D.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(l1(S));switch(_.callee.name){case"Date":return new Date(...e);case"RegExp":return new RegExp(...e);default:throw`Cannot instantiate object of type ${_.callee.name}`}}if(_.callee)throw"new must be called with either Date or RegExp";throw'Could not handle "new" without a specified class';case"Literal":return e.value;case"Identifier":return c=e,d=t,(l2(c.name),d.variables&&Object.hasOwn(d.variables,c.name))?d.variables[c.name]:Object.hasOwn(d.globals,c.name)?d.globals[c.name]:void 0;case"TemplateLiteral":let C,k;return f=e,p=t,C=f.expressions?.map(l1(p))??[],(k=f.quasis?.map(l1(p))??[]).filter(e=>!e.tail).map(e=>e.value).join("")+C.join("")+k.filter(e=>e.tail).map(e=>e.value).join("");case"TemplateElement":return{value:(m=e).cooked,tail:m.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function lZ(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return lZ(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function lY(e,t){let r=lQ(e.callee,t);if(r===lX||e.optional&&null==r)return lX;let n=e.arguments?.map(l1(t));if(r){if("function"!=typeof r)throw`${l6(e.callee)} is not a function`}else throw`No function named ${l6(e.callee)} is defined in this context`;return r(...n)}function lq(e,t){let r=lQ(e.object,t);if(r===lX||e.optional&&null==r)return lX;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${l3(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=lZ(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${l3(e.property,t)}')`);default:throw`VisitMemberExpression does not support operator '${e.object.type}' type`}if("object"!=typeof r&&"function"!=typeof r&&"string"!=typeof r&&"number"!=typeof r)throw`VisitMemberExpression does not support member access on type ${typeof r}`;let n=e.computed?function(e){if(void 0===e)throw{type:"Illegal property access",message:"No property was supplied to the property access"};if("string"!=typeof e&&"number"!=typeof e)throw{type:"Illegal property access",message:`Cannot use a value of type ${null===e?"null":typeof e} as a property name`};return e}(lG(e.property,t)):function(e){if("Identifier"!==e.type)throw`VisitMemberExpression does not support a property of type '${e.type}'`;return e.name}(e.property);l2(n),function(e,t){if(l4.has(String(t)))return;let r=Object(e);for(;null!==r;){if(Object.hasOwn(r,t)){if(r===Object.prototype||r===Function.prototype)throw{type:"Illegal property access",message:`Cannot access the ${t} property of objects`};return}r=Object.getPrototypeOf(r)}}(r,n);let o=r[n];return"function"==typeof o?o.bind(r):o}function lJ(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}lR.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 r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;let e=this.gobbleBinaryOp();if("=>"===e){let r=this.gobbleBinaryExpression();r||this.throwError("Expected expression after "+e),t.node={type:lN,params:null,body:r};return}}this.index=r}}),e.hooks.add("after-expression",function(t){!function t(r){r&&(Object.values(r).forEach(e=>{e&&"object"==typeof e&&t(e)}),"=>"===r.operator&&(r.type=lN,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}(t.node)})}}),lR.plugins.register({name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",function(t){let r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}})}}),lR.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 r(t){let r=this.index,n="",o=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};o(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),o());let a=this.char;("e"===a||"E"===a)&&(n+=this.expr.charAt(this.index++),("+"===(a=this.char)||"-"===a)&&(n+=this.expr.charAt(this.index++)),o(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));let i=this.code;if(e.isIdentifierStart(i))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(i===e.PERIOD_CODE){n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:i,number:n},null,2)}`),this.index=r;return}t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",function(n){if(48===this.code){var o,a,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;o=this.code,a=u,95===o||a.some(([e,t])=>o>=e&&o<=t);)95===this.code?this.index++:c+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(l.charCodeAt(0))){this.index=s+1,r.call(this,n);return}this.throwError("unexpected char within number")}n.node={type:e.LITERAL,value:parseInt(c,"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)&&r.call(this,n)})}}),lR.plugins.register({name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){let r=++this.index,n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){let n,o=this.expr.slice(r,this.index),a="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)a+=this.char;else break}try{n=new RegExp(o,a)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:n,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}}),lR.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}}),lR.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",o="",a=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:o,cooked:n},tail:a});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,a=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),o="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(o+=i,i=this.expr.charAt(++this.index),o+=i,i){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+=" ";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=i}else n+=i,o+=i}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node})}}),lR.addBinaryOp("in",7),lR.addBinaryOp("??",1);let lX=Symbol("optional chain short-circuited");function lQ(e,t){switch(e.type){case"MemberExpression":return lq(e,t);case"CallExpression":return lY(e,t);default:return lG(e,t)}}function l0(e){return e===lX?void 0:e}function l1(e){return function(t){return null===t?null:lG(t,e)}}function l2(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let l4=new Set(["toString","valueOf","hasOwnProperty"]);function l3(e,t){try{return lZ(e,t)}catch{return"<computed>"}}function l6(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function l5(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:{...lA},boundNames:new Set,variables:new Set};return l9("string"==typeof e?lR(e):e,t),[...t.variables]}function l9(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void l9(r.argument,n);case"BinaryExpression":return o=e,a=t,void(l9(o.left,a),l9(o.right,a));case"ConditionalExpression":return i=e,s=t,void(l9(i.consequent,s),l9(i.test,s),l9(i.alternate,s));case"CallExpression":return l=e,u=t,void(l9(l.callee,u),l.arguments?.map(l8(u)));case"ArrowFunctionExpression":var r,n,o,a,i,s,l,u,c,d,f,p,m,h,g,y,v,b,w,E,x=e,D=t;let _=new Set(D.boundNames);for(let e of x.params??[])e?.type==="Identifier"&&_.add(e.name);l9(x.body,{...D,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(l9(c.object,d),c.computed&&l9(c.property,d));case"ArrayExpression":return f=e,p=t,void f.elements?.map(l8(p));case"SequenceExpression":return m=e,h=t,void m.expressions?.map(l8(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(l8(y));case"Literal":case"TemplateElement":return;case"Identifier":return v=e,b=t,void(v.name in b.globals||b.boundNames.has(v.name)||b.variables.add(v.name));case"TemplateLiteral":return w=e,E=t,void(w.expressions?.map(l8(E)),w.quasis?.map(l8(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function l8(e){return function(t){return null===t?null:l9(t,e)}}let l7=W("feature-flags",{flags:function(){let e={};for(let t of Object.keys(localStorage))if(t.startsWith("openmrs:feature-flag:")){let r=t.replace("openmrs:feature-flag:",""),n=JSON.parse(localStorage.getItem(`openmrs:feature-flag-meta:${r}`)||"{}");e[r]={enabled:"true"===localStorage.getItem(t),...n}}return e}()});function ue(e,t,r){l7.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function ut(){let e=l7.getState().flags;Object.keys(localStorage).filter(e=>e.startsWith("openmrs:feature-flag:")).forEach(t=>{let r=t.replace("openmrs:feature-flag:","");e[r]||(localStorage.removeItem(t),localStorage.removeItem(`openmrs:feature-flag-meta:${r}`))})}function ur(e){return l7.getState().flags[e].enabled}function un(e,t){l7.subscribe(r=>{t(r.flags[e].enabled)})}function uo(e,t){l7.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}l7.subscribe(e=>{for(let[t,r]of Object.entries(e.flags))localStorage.setItem(`openmrs:feature-flag:${t}`,r.enabled.toString()),localStorage.setItem(`openmrs:feature-flag-meta:${t}`,JSON.stringify({label:r.label,description:r.description}))});var ua=tB(function(e,t,r){tN(e,t,r)});let ui=B("extensionsInternal",{slots:{},extensions:{}}),us=B("extensionRenderings",{renderings:new Map}),ul=()=>W("extensionsInternal",{slots:{},extensions:{}}),uu=()=>W("extensionRenderings",{renderings:new Map});function uc(e){let t=ui.getState(),r=e(t);r!==t&&ui.setState(r)}let ud=null,uf=null;function up(){let e=us.getState();return ud&&e===uf||(ud=new Map(e.renderings),uf=e,function(e){for(let t of(uD.clear(),e.values()))uS(t,1);u_=!0}(ud)),ud}function um(e){uf={renderings:e},us.setState(uf,!0)}function uh(e){let t=up();t.has(e.renderingId)||(t.set(e.renderingId,e),uS(e,1),um(t))}function ug(e){let t=up(),r=t.get(e);r&&(t.delete(e),uS(r,-1),um(t))}let uy=()=>W("extensions",{slots:{}}),uv=0,ub=new Set;function uw(e){uv++;try{return e()}finally{if(0==--uv&&ub.size>0){let e=Array.from(ub);for(let t of(ub.clear(),e))uE(t)}}}function uE(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function ux(e){uv>0?ub.add(e):uE(e)}let uD=new Map,u_=!1;function uS(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=uD.get(r);if(!n){if(t<0)return;uD.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),u_=!0;return}n.count+=t,n.count<1&&(uD.delete(r),u_=!0)}function uC(){var e,t;if(up(),!u_)return;u_=!1;let r=Array.from(uD.values(),({record:e})=>e);r.sort(uk),e=nm.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===uk(e,t[r]))||nm.setState({mountedExtensions:r})}function uk(e,t){return uP(e.slotName,t.slotName)||uP(e.extensionId,t.extensionId)||uP(e.slotModuleName,t.slotModuleName)||uP(e.extensionModuleName,t.extensionModuleName)}function uP(e,t){return e===t?0:e<t?-1:1}uC(),us.subscribe(()=>ux(uC));let uO=ul(),uR=uy(),uT=ng(),uN=nb(),uj=new Set,uA=!1;function u$(e){if(null===e)uj=null;else if(null!==uj)for(let t of e)uj.add(t);ux(uI)}function uI(){if(!uA){uA=!0;try{for(let e=1;;e++){let t=uj;if(null!==t&&0===t.size)return;uj=new Set;try{!function(e,t,r,n,o,a=null){let i=uR.getState().slots,s={},l=!1,u=Object.entries(n.flags).filter(([,{enabled:e}])=>e).map(([e])=>e);for(let[n,c]of Object.entries(e.slots)){let d=i[n];if(d&&a&&!a.has(n)){s[n]=d;continue}let{config:f}=nv(t,c.name),p=function(e,t,r,n,o,a){let i=function(e,t){let r=e.add||[],n=e.remove||[],o=e.order||[],{extensions:a}=uO.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=uK(o),u=uK(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let o=t.get(e);if(void 0!==o)return o;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,a[uF(e)]?.order,u)]));return s.sort((e,t)=>c.get(e)-c.get(t))}(r,t.slots[e].attachedIds),s=[];for(let l of i){let{config:i}=nw(n,e,l),u=nE(r,e,l),c=u?ua({},i,u):i,d=uF(l),f=t.extensions[d];if(f){let e=c?.["Display conditions"]?.privileges??f.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!a?.user||!su(e,a.user))||f.featureFlag&&!o.includes(f.featureFlag))continue;s.push({id:l,name:d,moduleName:f.moduleName,config:c,featureFlag:f.featureFlag,meta:f.meta,displayConditionExpression:c?.["Display conditions"]?.expression||f.displayExpression})}}return s}(n,e,f,r,u,o.session);d&&d.moduleName===c.moduleName&&rx(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&uR.setState({slots:s})}(uO.getState(),uT.getState(),uN.getState(),l7.getState(),se.getState(),t)}catch(e){throw uj=null===t||null===uj?null:new Set([...t,...uj]),e}if(e>=20)return void console.error("The extension system stopped recomputing after 20 passes because something keeps invalidating slots in response to the extension store being written. Some slots are left stale until the next write.")}}finally{uA=!1}}}function uM(e,t){let r=new Set;for(let n of Object.keys(e))e[n]!==t[n]&&r.add(n);for(let n of Object.keys(t))n in e||r.add(n);return r}function uL(e,t){return{moduleName:t,name:e,attachedIds:[]}}function uF(e){let[t]=e.split("#");return t}function uB(e,t){let r=uF(t);return e.extensions[r]}function uU(e){return uB(uO.getState(),e)}uO.subscribe((e,t)=>{u$(e.extensions!==t.extensions?null:uM(e.slots,t.slots))}),uT.subscribe((e,t)=>{u$(uM(e.slots,t.slots))}),uN.subscribe((e,t)=>{u$(uM(e.configs,t.configs))}),l7.subscribe(()=>u$(null)),se.subscribe(()=>u$(null)),u$(null);let uV=e=>uc(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function uW(e,t){uc(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...uL(e),attachedIds:[t]}}}})}function uH(e,t){uc(r=>{let n=r.slots[e];return n&&n.attachedIds.includes(t)?{...r,slots:{...r.slots,[e]:{...n,attachedIds:n.attachedIds.filter(e=>e!==t)}}}:r})}function uz(e){uc(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function uK(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function uG(e,t){return function(e,t,r=null,n){let o;return e.filter(e=>{let a=e.displayConditionExpression;if("string"!=typeof a||0===a.trim().length)return!0;o??(o=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!lM(a,o)}catch(t){return console.error(`Error while evaluating expression '${a}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(uZ(e),t,se.getState().session,e)}function uZ(e){return uR.getState().slots[e]?.candidateExtensions??[]}let uY=(e,t)=>uO.setState(r=>{let n=r.slots[t]?.moduleName;if(n&&n!=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 ${n}.`),r;if(n&&n==e)return r;if(r.slots[t])return{...r,slots:{...r.slots,[t]:{...r.slots[t],moduleName:e}}};let o=uL(t,e);return{...r,slots:{...r.slots,[t]:{...o}}}}),uq=()=>{uj=null,uc(()=>({slots:{},extensions:{}})),uu().setState({renderings:new Map}),uR.setState({slots:{}})},uJ=B("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function uX({name:e,basePath:t,mode:r,componentContext:n,state:o}){uJ.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:o})}function uQ(e){uJ.getState().slotName===e&&uJ.setState(uJ.getInitialState(),!0)}let u0=B("modalRegistry",{modals:{}});function u1(e){u0.setState(t=>(t.modals[e.name]=e,t))}function u2(e){let t=u0.getState().modals[e];if(!t){let r=uU(e);r&&(t={name:e,load:r.load,moduleName:r.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.`),u1(t))}return t}let u4=B("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function u3(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=u4.getState(),n=t[e];if(n){let t=r[n.window];if(t)return t;throw Error(`No workspace window found with name: ${n.window} for workspace: ${e}`)}throw Error(`No workspace found with name: ${e}`)}function u6(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=u4.getState(),n=r[e];if(n){let r=t[n.group];if(r)return r;throw Error(`No workspace group found with name: ${n.group} for window: ${e}`)}throw Error(`No workspace window found with name: ${e}`)}function u5(e){let{openedWindows:t}=u4.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function u9(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=u4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace group ${r.name} more than once`);n[r.name]={...r,moduleName:e}}u4.setState({registeredGroupsByName:n})}function u8(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=u4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace window ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}u4.setState({registeredWindowsByName:n})}function u7(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=u4.getState(),n={...r};for(let r of t){if(n[r.name])throw Error(`Cannot register workspace ${r.name} more than once`);let t={...r,moduleName:e};n[r.name]=t}u4.setState({registeredWorkspacesByName:n})}let ce=0,ct=null,cr={bootstrap:15e3,mount:15e3,unmount:15e3};function cn(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(cr).filter(t=>e[t]).map(n=>{var o,a;let i,s;return[n,(o=e[n],a=cr[n],i=Array.isArray(o)?o:[o],s=e=>i.reduce((t,o,a)=>t.then(()=>{let t=o(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${a} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let o,i=new Promise((e,t)=>{o=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${a}ms`)),a)});return Promise.race([s(e),i]).finally(()=>clearTimeout(o)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function co(e,t){var r,n;let o,a,i,s,l,u=await (ct??(ct=new Promise((e,t)=>{o6({name:"openmrs-extension-host",bootstrap:()=>Promise.resolve(),mount:t=>(e(t.mountParcel),Promise.resolve()),unmount:()=>Promise.resolve()},{domElement:document.createElement("div")}).mountPromise.catch(t)}).catch(e=>(console.error("The host parcel used to mount extensions could not be mounted. Falling back to mounting extensions as root parcels, which leaks their DOM elements.",e),o6))),ct),c={...t},d=(o=c,a=!1,{retarget:e=>o={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(o),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":a||(a=t);return;case"unmount":(t||a)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>cn(e,r)):cn(e,r)),c),s=e=>t=>e.call(n,d.retarget(t)).catch(e=>{throw"SKIP_BECAUSE_BROKEN"===n.getStatus()&&d.release(),e}),l=n.update&&s(n.update),Object.defineProperty(n,"update",{configurable:!0,enumerable:!0,get:()=>l,set:e=>{l=e&&s(e)}})}function ca(){return ci}function ci(e,t){let r,n=co(e,t).then(e=>r=e);return{mount:()=>n.then(e=>e.mount()),unmount:()=>n.then(e=>e.unmount()),update:e=>n.then(t=>t.update?.(e)),getStatus:()=>r?.getStatus()??"LOADING_SOURCE_CODE",get loadPromise(){return n.then(e=>e.loadPromise)},get bootstrapPromise(){return n.then(e=>e.bootstrapPromise)},get mountPromise(){return n.then(e=>e.mountPromise)},get unmountPromise(){return n.then(e=>e.unmountPromise)}}}async function cs(e,t,r,n,o=e=>e,a={}){let i=uF(n),s=uU(n),l=null;if(e){let u;if(!s)throw Error(`Couldn't find extension '${i}' to attach to '${t}'`);let{meta:c,moduleName:d,load:f}=s,p=ce++,m=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=m;let h=e=>{try{ug(m)}catch(t){console.error(e,t)}};try{uh({renderingId:m,extensionName:i,extensionModuleName:d,extensionId:n,slotName:t,slotModuleName:r})}catch(e){throw h(`Recomputing configuration after registering '${n}' failed also failed`),e}try{u=await f()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await co(o({...u,name:`${t}/${i}-${p}`}),{...a,_meta:c,_extensionContext:{extensionId:n,extensionSlotName:t,extensionSlotModuleName:r,extensionModuleName:d,extensionMeta:c},domElement:e})}catch(e){throw h(`Recomputing configuration after '${n}' failed to mount also failed`),e}l.mountPromise.then(void 0,e=>{console.error(`Extension '${n}' in slot '${t}' failed to mount`,e),h(`Recomputing configuration after '${n}' failed to mount also failed`)}),l.unmountPromise.then(()=>h(`Recomputing configuration after unmounting '${n}' failed`),e=>{console.error(`Extension '${n}' in slot '${t}' failed to unmount`,e),h(`Recomputing configuration after '${n}' failed to unmount also failed`)})}else console.warn(`Tried to render ${n} into ${t} but no DOM element was available.`);return l}var cl=r(4923),cu=r.n(cl);let cc=(0,cl.createContext)({moduleName:"",featureName:""});function cd({to:e,templateParams:t,onBeforeNavigate:r,children:n,...o}){return(0,cl.useEffect)(()=>{o.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${o.href}'`),o.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),cu().createElement("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),iZ({to:e,templateParams:t})),0===n.button&&(n.ctrlKey||n.metaKey)&&r?.(n),0===n.button&&n.shiftKey&&r?.(n),1===n.button&&r?.(n)},href:iK(e,t),...o},n)}let cf=({state:e,children:t,...r})=>{let{extension:n}=(0,cl.useContext)(cc),o=(0,cl.useRef)(null),a=(0,cl.useRef)(Promise.resolve()),i=(0,cl.useRef)(!1),s=(0,cl.useRef)(!1),l=(0,cl.useRef)(e),u=(0,cl.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":a.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,cl.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(a.current=Promise.all([e.mountPromise,a.current]).then(()=>{if(o.current?.getStatus()==="MOUNTED"&&o.current.update)return o.current.update({...t})}).catch(e=>{let t=o.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,cl.useCallback)(t=>{t&&!o.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,cs(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,o.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,cl.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(o.current)}),[]),(0,cl.useEffect)(()=>{l.current=e,o.current&&c(o.current,e)},[e]),n?cu().createElement("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function cp(e){let t=(0,cl.useRef)(e);return R(t.current,e)||(t.current=e),t.current}function cm(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,o]of Object.entries(t)){let t=function(...t){e.setState(e=>o(e,...t))};r[n]=t}return r}let ch=e=>e;function cg(e,t=ch,r){let n=(0,cl.useCallback)(t=>e.subscribe(t),[e]),o=(0,cl.useCallback)(()=>t(e.getState()),[e,t]),a=(0,cl.useSyncExternalStore)(n,o,o),i=(0,cl.useMemo)(()=>r?cm(e,r):null,[e,r]);return(0,cl.useMemo)(()=>i?{...a,...i}:a,[a,i])}function cy(e,t){return cg(e,ch,t)}function cv(e){return function(t){let r=(0,cl.useCallback)(t=>e.subscribe(t),[]),n=(0,cl.useCallback)(()=>e.getState(),[]),o=(0,cl.useSyncExternalStore)(r,n,n),a=(0,cl.useMemo)(()=>t?cm(e,t):null,[t]);return(0,cl.useMemo)(()=>a?{...o,...a}:o,[o,a])}}let cb=[];Object.freeze(cb);let cw={candidateExtensions:cb};Object.freeze(cw);let cE=e=>{let t=(0,cl.useCallback)(t=>t.slots?.[e]??cw,[e]);return cg(uy(),t)},cx=e=>e.session;function cD(e,t){let{candidateExtensions:r}=cE(e),n=cg(se,cx),o=cp(t);return(0,cl.useMemo)(()=>uG(e,o),[e,o,n,r])}function c_(e,t){let{moduleName:r}=(0,cl.useContext)(cc);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,cl.useEffect)(()=>{uY(r,e)},[r,e]),{extensions:cD(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function cS(e){return e}function cC({name:e,extensionSlotName:t,select:r=cS,children:n,state:o,style:a,...i}){if(n&&o)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,cl.useRef)(null),{extensions:u,extensionSlotModuleName:c}=c_(s,o),d=(0,cl.useMemo)(()=>r(u),[r,u]),f=(0,cl.useMemo)(()=>{if("function"==typeof n&&!cu().isValidElement(n))return d.map(e=>n(e,o))},[n,d]);return cu().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...a,position:"relative"},...i},s&&d?.map((e,t)=>cu().createElement(cc.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},f?.[t]??("function"!=typeof n?n:null)??cu().createElement(cf,{state:o}))))}var ck=r(5338);function cP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function cO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cP(Object(r),!0).forEach(function(t){var n,o,a;n=e,o=t,a=r[t],o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cP(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function cR(e){return(cR="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 cT(e){return(cT="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 cN(e,t){var r;if("function"!=typeof(r=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 r="single-spa-application:".concat(t);return function(){var e=document.getElementById(r);return e||((e=document.createElement("div")).id=r,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(cT(r)));return function(){var e=r(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(cT(e)));return e}}var cj=null;try{cj=require("react").createContext()}catch(e){}var cA={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 c$(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function cI(e,t){return new Promise(function(r,n){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 o,a=cB(e,t,function(){r(this)}),i=cN(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,o=e.domElement,a=t[r];if("function"!=typeof a)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=a(o);return i.render(n),i;case"hydrateRoot":return a(o,n);default:return a(n,o),null}}({elementToRender:a,domElement:i,reactDom:cF(e),renderType:"function"==typeof(o=e).renderType?o.renderType():o.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function cM(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():cF(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function cL(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=cB(e,t,null),o=e.renderResults[t.name];if(o&&o.render)o.render(n);else{var a=cN(e,t)();cF(e).render(n,a)}})}function cF(e){return e.ReactDOMClient||e.ReactDOM}function cB(e,t,r){var n=e.React.createElement(e.rootComponent,t),o=cj?e.React.createElement(cj.Provider,{value:t},n):n;return(e.errorBoundary||t.errorBoundary||e.errorBoundaryClass||t.errorBoundaryClass)&&(e.errorBoundaryClass=e.errorBoundaryClass||t.errorBoundaryClass||function(e,t){function r(t){e.React.Component.apply(this,arguments),this.state={caughtError:null,caughtErrorInfo:null},r.displayName="SingleSpaReactErrorBoundary(".concat(t.name,")")}return r.prototype=Object.create(e.React.Component.prototype),r.prototype.render=function(){return this.state.caughtError?(e.errorBoundary||t.errorBoundary)(this.state.caughtError,this.state.caughtErrorInfo,this.props):this.props.children},r.prototype.componentDidCatch=function(e,t){this.setState({caughtError:e,caughtErrorInfo:t})},r}(e,t),o=e.React.createElement(e.errorBoundaryClass,t,o)),o=e.React.createElement(e.SingleSpaRoot,cO(cO({},t),{},{mountFinished:r,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])}}),o)}var cU=r(202),cV=r(2551),cW=r.n(cV),cH=r(7900);let cz={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},cK=new Map;(0,cH.initCache)(cK);let cG={errorRetryCount:3,fetcher:i8,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof i7){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>cK};function cZ(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},cz,e),r={...cG,...t.swrConfig};return function(e){var n,o,a,i,s;return a=o=class extends(n=cu().Component){componentDidCatch(e,r){r&&r.componentStack&&(e.extra=Object.assign(e.extra||{},{componentStack:r.componentStack})),t.throwErrorsToConsole&&setTimeout(()=>{throw e}),this.setState({caughtError:e,caughtErrorInfo:r})}render(){if(this.state.caughtError)return cu().createElement("div",null,"An error has occurred. Please try reloading the page.");{let n=cu().createElement(cl.Suspense,{fallback:null},cu().createElement(cV.SWRConfig,{value:r},cu().createElement(cc.Provider,{value:this.state.config},t.disableTranslations?cu().createElement(e,this.props):cu().createElement(cU.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},cu().createElement(e,this.props)))));return t.strictMode&&cu().StrictMode?cu().createElement(cu().StrictMode,null,n):n}}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 a?Object.defineProperty(a,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[i]=s,o}}function cY(e,t){return function(e){if("object"!==cR(e))throw Error("single-spa-react requires a configuration object");var t,r=cO(cO({},cA),e);if(!r.React)throw Error("single-spa-react must be passed opts.React");if(!r.ReactDOM&&!r.ReactDOMClient)throw Error("single-spa-react must be passed opts.ReactDOM or opts.ReactDOMClient");if(r.renderType||(null!=(t=r.ReactDOMClient)&&t.createRoot?r.renderType="createRoot":r.renderType="render"),!r.rootComponent&&!r.loadRootComponent)throw Error("single-spa-react must be passed opts.rootComponent or opts.loadRootComponent");if(r.errorBoundary&&"function"!=typeof r.errorBoundary)throw Error("The errorBoundary opt for single-spa-react must either be omitted or be a function that returns React elements");!cj&&r.React.createContext&&(cj=r.React.createContext()),r.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}(r);var n={bootstrap:c$.bind(null,r),mount:cI.bind(null,r),unmount:cM.bind(null,r)};return r.parcelCanUpdate&&(n.update=cL.bind(null,r)),n}({React:cu(),ReactDOMClient:ck,rootComponent:cZ(t)(e)})}function cq(e,t){return()=>e().then(({default:e})=>cY(e,t))}function cJ(e,t){return()=>Promise.resolve(cY(e,t))}let cX=cq,cQ=A()(()=>({}));V("openmrs-app-context",cQ);let c0={};function c1(e,t=e=>e){let r=cQ.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function c2(e,t){cQ.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function c4(e){return null===e?null:Object.freeze(Object.assign({},e))}let c3=new Map;function c6(e,t){let r=(0,cl.useRef)(t??{}),n=(0,cl.useRef)(t=>c2(e,t)),o=(0,cl.useRef)(Symbol());return(0,cl.useEffect)(()=>{let r=t??{},n=o.current;return null===c1(e)?!function(e,t=c0){cQ.setState(r=>{if(e in r)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({},r,{[e]:t===c0?{}:t})})}(e,r):(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.`),c2(e,()=>r)),c3.set(e,n),()=>{c3.get(e)===n&&(cQ.setState(t=>(e in t&&delete t[e],t)),c3.delete(e))}},[e]),(0,cl.useEffect)(()=>{let n=t??{};R(r.current,n)||(c2(e,()=>n),r.current=n)},[t]),n.current}function c5({namespace:e,value:t}){return c6(e,t),null}let c9=({children:e,value:t,fallback:r})=>t?cu().createElement(cu().Fragment,null,e):r?cu().createElement(cu().Fragment,null,r):null;function c8(){let e=(0,cl.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,cl.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function c7(e,t=e=>e??{}){let[r,n]=(0,cl.useState)(()=>{if(de(e))return;let r=c1(e);if(null!==r)return t?t(r):r});return(0,cl.useEffect)(()=>{if(de(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,cl.useEffect)(()=>{var r;let o;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>R(e,r)?e:r)})(c4(o=c1(e))),cQ.subscribe(t=>{let n=e in t?t[e]:null;n!==o&&(o=n,r(c4(n)))})},[e,t]),r}function de(e){return"string"!=typeof e||0===e.trim().length}function dt(e){let t=cD(e);return(0,cl.useMemo)(()=>t.map(e=>e.id),[t])}function dr(e){return cE(e).candidateExtensions}function dn(e,t,r){let{data:n,error:o,mutate:a,isLoading:i,isValidating:s}=cW()(e?lu(e,t,r):null,i8);return(0,cl.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:o,mutate:a,isValidating:s}),[n,o,i,s,a])}function da(e){(0,cl.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let di={},ds=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
|
|
16
16
|
Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function dl(e,t,r){let n=di[e];if(n)return n;let o=new Promise(e=>{let n=r(t.getState());if(n)return void e(n);let o=t.subscribe(t=>{let n=r(t);n&&(o(),e(n))})});return di[e]=o,o.then(()=>{di[e]===o&&delete di[e]}),o}function du(e){let{moduleName:t,extension:r}=(0,cl.useContext)(cc),n=e?.externalModuleName??t;if(!n&&!r)throw Error(ds);let o=function(e){let t=(0,cl.useMemo)(()=>nh(e),[e]),r=function(e){let[t,r]=(0,cl.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,cl.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&r(e.config)}),[e]),t}(t);if(!r)throw dl(e,t,e=>e.loaded?e.config:null);return r}(n),a=function(e){let t=(0,cl.useMemo)(nb,[]),r=function(e,t){let[r,n]=(0,cl.useState)(t?()=>{let r=nw(e.getState(),t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null);return(0,cl.useEffect)(()=>{if(t)return e.subscribe(e=>{let o=nw(e,t.extensionSlotName,t.extensionId);o.loaded&&o.config&&!rx(o.config,r)&&n(o.config)})},[e,t,r]),r}(t,e);if(!r&&e)throw dl(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let r=nw(t,e.extensionSlotName,e.extensionId);return r.loaded?r.config:null});return r||{}}(r);return(0,cl.useMemo)(()=>e?.externalModuleName&&n===e.externalModuleName?{...o}:{...o,...a},[n,e?.externalModuleName,o,a])}let dc=cD;function dd(e,t=300){let[r,n]=(0,cl.useState)(e);return(0,cl.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var df=r(6880),dp=r.n(df);let dm=`custom:${[["admissionDecisionConcept","ref"],["admissionEncounterType","ref"],["admissionForm","ref"],["atFacilityVisitType","ref"],["bedAssignmentEncounterType","ref"],["cancelADTRequestEncounterType","ref"],["checkInClerkEncounterRole","ref"],["checkInEncounterType","ref"],["clinicianEncounterRole","ref"],["conceptSourcesForDiagnosisSearch","ref"],["consultEncounterType","ref"],["consultFreeTextCommentsConcept","ref"],["denyAdmissionConcept","ref"],["diagnosisMetadata","ref"],["diagnosisSets","ref"],["dischargeForm","ref"],["dispositionDescriptor","ref"],["dispositions","ref"],["emrApiConceptSource","ref"],["exitFromInpatientEncounterType","ref"],["extraPatientIdentifierTypes","ref"],["fullPrivilegeLevel","ref"],["highPrivilegeLevel","ref"],["identifierTypesToSearch","ref"],["inpatientNoteEncounterType","ref"],["lastViewedPatientSizeLimit","ref"],["metadataSourceName","ref"],["motherChildRelationshipType","ref"],["narrowerThanConceptMapType","ref"],["nonDiagnosisConceptSets","ref"],["orderingProviderEncounterRole","ref"],["patientDiedConcept","ref"],["personImageDirectory","ref"],["primaryIdentifierType","ref"],["sameAsConceptMapType","ref"],["suppressedDiagnosisConcepts","ref"],["supportsAdmissionLocationTag","(uuid,display,name,links)"],["supportsLoginLocationTag","(uuid,display,name,links)"],["supportsTransferLocationTag","(uuid,display,name,links)"],["supportsVisitsLocationTag","(uuid,display,name,links)"],["telephoneAttributeType","ref"],["testPatientPersonAttributeType","ref"],["transferForm","ref"],["transferRequestEncounterType","ref"],["transferWithinHospitalEncounterType","ref"],["unknownCauseOfDeathConcept","ref"],["unknownLocation","ref"],["unknownPatientPersonAttributeType","ref"],["unknownProvider","ref"],["visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary","ref"],["visitExpireHours","ref"],["visitNoteEncounterType","ref"]].map(([e,t])=>`${e}:${t}`).join(",")}`;function dh(){let e=`${i3}/emrapi/configuration?v=${dm}`,t=dp()(e,i8);return(0,cl.useMemo)(()=>({emrConfiguration:t.data?.data,isLoadingEmrConfiguration:t.isLoading,mutateEmrConfiguration:t.mutate,errorFetchingEmrConfiguration:t.error}),[t])}function dg(){return(0,cl.useContext)(cc).extension}let dy=cv(ul());function dv(e){let t=cD(e);return(0,cl.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let db=cv(uy());function dw(e){let{flags:t}=cg(l7);return t[e]?.enabled??!1}function dE(){let[,e]=(0,cl.useState)(0);return(0,cl.useCallback)(()=>{e(e=>e+1)},[])}function dx(e,t,r={}){return d_(e,t,dD,r)}let dD={getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(i9(e.toString()),window.location.toString());return n.searchParams.set("limit",""+t),n.searchParams.set("startIndex",""+r),n.searchParams.set("totalCount","true"),n.toString()}},getNextUrl:e=>{let t=e?.links?.find(e=>"next"==e.rel)?.uri;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.totalCount??NaN,getCurrentPageSize:e=>e?.results?.length??NaN,getData:e=>e?.results};function d_(e,t,r,n={}){let{getPaginatedUrl:o,getTotalCount:a,getCurrentPageSize:i,getData:s}=r,{immutable:l,swrConfig:u}=n,c=n.fetcher??i8,[d,f]=(0,cl.useState)(1),p=(0,cl.useRef)(NaN),m=(0,cl.useRef)(NaN),h=(0,cl.useRef)(d),g=(0,cl.useRef)(!1),y=(0,cl.useRef)(!1),v=e?.toString()??"",[b,w]=(0,cl.useState)(v);v!==b&&(w(v),f(1),h.current=1,p.current=NaN,m.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,x=(0,cl.useMemo)(()=>o(e,t,E),[e,t,E]),{data:D,..._}=(l?dp():cW())(x,c,u);D?.data&&(p.current=a(D?.data),m.current=i(D?.data),g.current=!0);let S=Math.ceil(p.current/t),C=(0,cl.useCallback)(e=>{if(!Number.isInteger(e)||e<1)return void console.warn(`useServerPagination: ignoring goTo(${e}); page must be a positive integer.`);let r=Math.ceil(p.current/t);!g.current||Number.isNaN(r)||e<=r?(h.current=e,f(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,cl.useEffect)(()=>{if(!g.current)return;if(Number.isNaN(p.current)){y.current||(y.current=!0,console.warn(`useServerPagination: ${v} returned no total count, so out-of-range pages cannot be detected.`));return}let e=Math.max(1,Math.ceil(p.current/t));d>e&&(console.warn(`Invalid attempt to go to out of bounds page: ${d}; returning to page ${e}.`),h.current=e,f(e))},[d,t,v,D]);let k=(0,cl.useCallback)(()=>{C(h.current+1)},[C]),P=(0,cl.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(D?.data),totalPages:S,totalCount:p.current,currentPage:d,currentPageSize:m.current,paginated:S>1,showNextButton:d<S,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,..._}}function dS(e,t,r={}){return d_(e,t,dC(),r)}function dC(){return{getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(i9(e.toString()),window.location.toString());return n.searchParams.set("_count",""+t),n.searchParams.set("_getpagesoffset",""+r),n.toString()}},getNextUrl:e=>{let t=e?.link?.find(e=>"next"==e.relation)?.url;if(!t)return null;{let e=new URL(t);return e.host=window.location.host,e.protocol=window.location.protocol,e.toString()}},getTotalCount:e=>e?.total??NaN,getCurrentPageSize:e=>e?.entry?.length??NaN,getData:e=>e?.entry?.map(e=>e.resource)}}var dk=r(6310),dP=r.n(dk);function dO(e,t={}){return dR(e,dD,t)}function dR(e,t,r={}){let{swrInfiniteConfig:n,immutable:o}=r,{getNextUrl:a,getTotalCount:i,getData:s}=t,l=r.fetcher??i8,u=(0,cl.useCallback)((r,n)=>0==r?e?.toString()??null:t.getNextUrl(n.data),[e]),{data:c,size:d,setSize:f,...p}=dP()(u,l,{...n,...o?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),m=a(c?.[c.length-1].data),h=i(c?.[0]?.data);return{data:c?.flatMap(e=>s(e.data)),totalCount:h,hasMore:null!=m,loadMore:()=>{f((c?.length??0)+1)},nextUri:m,...p}}function dT(e,t={}){return dN(e,dD,t)}function dN(e,t,r={}){let n=dR(e,t,r),{hasMore:o,error:a,data:i,loadMore:s,isLoading:l,nextUri:u}=n;return((0,cl.useEffect)(()=>{o&&!a&&s()},[o,u]),r.partialData)?n:{...n,data:o||a?void 0:i,isLoading:l||o}}function dj(e,t={}){return dN(e,dC(),t)}function dA(e,t={}){return dR(e,dC(),t)}function d$(){let e="tablet";return document.body.classList.forEach(t=>{switch(t){case"omrs-breakpoint-lt-tablet":e="phone";break;case"omrs-breakpoint-gt-small-desktop":e="large-desktop";break;case"omrs-breakpoint-gt-tablet":e="small-desktop"}}),e}function dI(){let[e,t]=(0,cl.useState)(d$);return(0,cl.useEffect)(()=>{let e=()=>{t(d$())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let dM=e=>"small-desktop"===e||"large-desktop"===e;function dL(e){let t=(0,cl.useContext)(cc);(0,cl.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),uX(e),()=>{uQ(e.name)}),[t,e])}function dF(){return cg(uJ)}let dB=[];function dU(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString(),{data:o}=dT(`${i3}/location${n?"?"+n:""}`,{immutable:!0});return o??dB}function dV(e,t=!0){let r=(0,cl.useRef)(null);return(0,cl.useEffect)(()=>{let n=n=>{t&&r.current&&n.target&&n.target instanceof Node&&(r.current.contains(n.target)||e(n))};return window.addEventListener("mousedown",n),window.addEventListener("touchstart",n),()=>{window.removeEventListener("mousedown",n),window.removeEventListener("touchstart",n)}},[e,t]),r}function dW(e){let t=(0,cl.useRef)();return(0,cl.useEffect)(()=>{let r=new IntersectionObserver(t=>{for(let r of t)if(r.isIntersecting)return void e()},{threshold:1});return t.current&&r.observe(t.current),()=>{t.current&&r.unobserve(t.current)}},[t.current,e]),t}function dH(e,t={}){let{abortController:r,fetchInit:n,url:o,swrConfig:a}=t,i=c8(),s=(0,cl.useMemo)(()=>n?.signal??r?.signal??i.signal,[r?.signal,n?.signal,i.signal]),l=(0,cl.useCallback)(e=>i8(function(e,t){if(t)return"function"==typeof t?t(e):t;if("string"==typeof e)return e;throw Error(`When using useOpenmrsSWR with a key that is not a string, you must provide a url() function that converts the key to a valid url. The key for this hook is ${e}.`)}(e,o),{...n,signal:s}),[s,n,o]);return cW()(e,l,a)}function dz(e=[],t=10){let[r,n]=(0,cl.useState)(1),o=(0,cl.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);r>o&&n(o);let a=Math.min(Math.max(1,r),o),i=(0,cl.useMemo)(()=>{let r=(a-1)*t,n=(a+0)*t;return e.slice(r,n)},[e,a,t]),s=(0,cl.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):n(e)},[]),l=(0,cl.useCallback)(()=>{n(e=>e+1)},[]),u=(0,cl.useCallback)(()=>{n(e=>Math.max(1,e-1))},[]);return(0,cl.useMemo)(()=>({results:i,totalPages:o,currentPage:a,paginated:e.length>t,showNextButton:a<o,showPreviousButton:a>1,goTo:s,goToNext:l,goToPrevious:u}),[i,o,e.length,t,a,s,l,u])}function dK(e,t,r,n){return{pageSizes:(0,cl.useMemo)(()=>{let r=Math.ceil(t/e);return isNaN(r)&&(r=0),[...Array(r).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,cl.useMemo)(()=>e>t?t:e*r>t?e*(r-1)+n:e*r,[e,t,r,n])}}function dG(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function dZ(e){let[t,r]=(0,cl.useState)(e??dG()),{data:n,error:o,isValidating:a}=cW()(t?["patient",t]:null,()=>lf(t,{}));return(0,cl.useEffect)(()=>{let e=()=>{let e=dG();e!==t&&r(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,cl.useMemo)(()=>({isLoading:a&&!o&&!n,patient:n,patientUuid:t,error:o}),[a,o,n,t])}function dY(){let e=`${i3}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:r,isLoading:n}=cW()(e,i8);return(0,cl.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:n,error:r}),[t,r,n])}function dq(e){let{extensions:t,extensionSlotModuleName:r}=c_(e);return e?t.map(t=>({state:n})=>cu().createElement(cc.Provider,{value:{moduleName:r,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:r,extensionMeta:t.meta}}},cu().createElement(cf,{state:n}))):[]}function dJ(){let e=(0,cl.useRef)(),[t,r]=(0,cl.useState)(null),n=null;if(!t){if(i){let e=sa().getState();e.loaded&&(n=e.session)}else i=new Promise(t=>{let r=({loaded:r,session:o})=>{r&&(t(o),n=o,e.current&&(e.current(),e.current=void 0))};r(sa().getState()),n||(e.current=sa().subscribe(r))});if(n)r(n);else throw i}(0,cl.useEffect)(()=>(e.current||(e.current=sa().subscribe(({loaded:e,session:t})=>{e&&(n=t,r(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let o=t||n;if(!o)if(i)throw console.warn("useSession is in an unexpected state. Attempting to recover."),i;else throw Error("useSession is in an invalid state.");return o}let dX=({privilege:e,fallback:t,children:r})=>{let[n,o]=(0,cl.useState)(null);return((0,cl.useEffect)(()=>{let e=sa(),t=e.subscribe(({loaded:e,session:t})=>{o(e?t?.user??null:null)}),{loaded:r,session:n}=e.getState();return r&&o(n?.user??null),t},[]),n&&su(e,n))?cu().createElement(cu().Fragment,null,r):t?cu().createElement(cu().Fragment,null,t):null};var dQ=r(4353),d0=r.n(dQ),d1=r(7581);let d2=new Map;function d4(){for(let e of Array.from(d2.values()))e()}let d3={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function d6(e){let t=(0,cl.useId)();return(0,cl.useEffect)(()=>{if(e)return d2.set(t,e),()=>{d2.delete(t)}},[t,e]),{...cy(l_(),d3),mutateVisit:d4}}function d5(e,t=lx){let r=(0,cl.useRef)(void 0),{patientUuid:n,manuallySetVisitUuid:o,setVisitContext:a}=d6((0,cl.useCallback)(()=>r.current?.(),[])),i=e&&n==e?o:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:f}=cW()(e?`${i3}/visit${s}`:null,i8),{data:p,error:m,mutate:h,isValidating:g}=cW()(e&&i?`${i3}/visit${l}`:null,i8),y=(0,cl.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,cl.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,cl.useRef)(null);(0,cl.useEffect)(()=>{!f&&y&&n===e&&null===o&&a(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&a(null),b.current=v)},[v,o,y,f,g,n]);let w=(0,cl.useCallback)(()=>{d(),h()},[d,h]);(0,cl.useEffect)(()=>{r.current=w},[w]);let E=!!(!u||i&&!p),x=!!(i?m:c);return{error:c||m,mutate:w,isValidating:f||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!x}}dQ.extend(d1);let d9=[];function d8(){let{data:e}=dp()(lv,lb);return e??d9}let d7=new Map;async function fe(e,t){let r=t.indexOf("#"),n=r>=0,o=n?t.substring(0,r):e,a=n?t.substring(r+1):t,i=await sK(o);return i&&Object.hasOwn(i,a)&&"function"==typeof i[a]?fr(o,i).then(()=>i[a]()):(i?i&&Object.hasOwn(i,a)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${o} does not define a component called "${a}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${o} for ${t} defined in ${e}'s routes.json`),ft)}let ft={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function fr(e,t){if(e in d7)await d7[e];else{let r=t??await sK(e);await (d7[e]=new Promise((t,n)=>{if(Object.hasOwn(r,"startupApp")){let o=r.startupApp;if("function"==typeof o)return Promise.resolve(o()).then(()=>{nH(e),t(null)}).catch(n)}nH(e),t(null)}))}}function fn(e,t){let r=t.name;if(!r)return void console.error(`An extension definition in ${e} is missing an name and thus cannot be
|
|
17
17
|
registered. To fix this, ensure that you define the "name" field inside the
|
|
18
18
|
extension definition.`,t);t.slots&&t.slot&&console.warn(`The extension ${r} from ${e} declares both a 'slots' property and
|