@openmrs/esm-report-builder 0.1.1-pre.183 → 0.1.1-pre.187

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/5584.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (globalThis.webpackChunk_openmrs_esm_report_builder=globalThis.webpackChunk_openmrs_esm_report_builder||[]).push([["5584"],{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,a=function(e){var t=e.date,a=e.utc,o={};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=a?r.utc():r();Object.keys(t).forEach(function(e){var r;o["date"===(r=n.$utils().p(e))?"day":r]=t[e]});var s=o.day||(o.year||o.month>=0?1:i.date()),l=o.year||i.year(),u=o.month>=0?o.month:o.year||o.day?0:i.month(),c=o.hour||0,d=o.minute||0,m=o.second||0,p=o.millisecond||0;return a?new Date(Date.UTC(l,u,s,c,d,m,p)):new Date(l,u,s,c,d,m,p)}return t},o=n.parse;n.parse=function(e){e.date=a.bind(this)(e),o.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 a=Object.keys(t),o=this;return a.forEach(function(r){o=e.bind(o)(t[r]*n,r)}),o};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,a,o){var i=a.prototype;o.utc=function(e){var t={date:e,utc:!0,args:arguments};return new a(t)},i.utc=function(t){var r=o(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),e):r},i.local=function(){return o(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,a){var o=this.$utils().u;if(o(n))return this.$u?0:o(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 a=(""+n[0]).match(r)||["-",0,0],o=a[0],i=60*a[1]+ +a[2];return 0===i?0:"+"===o?i:-i}(n)))return this;var i=16>=Math.abs(n)?60*n:n;if(0===i)return this.utc(a);var s=this.clone();if(a)return s.$offset=i,s.$u=!1,s;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(i+l,e)).$offset=i,s.$x.$localOffset=l,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?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var m=i.diff;i.diff=function(e,t,r){if(e&&this.$u===e.$u)return m.call(this,e,t,r);var n=this.local(),a=o(e).local();return m.call(n,a,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,a=t.call(e,"constructor"),o=t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!a&&!o)return!1;for(n in e);return void 0===n||t.call(e,n)}e.exports=function e(){var t,r,a,o,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)a=l[r],l!==(o=t[r])&&(d&&o&&(n(o)||(i=Array.isArray(o)))?(i?(i=!1,s=a&&Array.isArray(a)?a:[]):s=a&&n(a)?a:{},l[r]=e(d,s,o)):void 0!==o&&(l[r]=o));return l}},6767(e,t,r){!function(t){"use strict";var n=r(6974);function a(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 o=e.exports={generate:a(function(e,t){return new n(e,t)})};t&&(t.fn.geopattern=a(function(e,r){return this.each(function(){var n=t(this).attr("data-title-sha");n&&(r=t.extend({hash:n},r));var a=o.generate(e,r);t(this).css("background-image",a.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,a=e.g,o=e.b,i=Math.max(n/=255,a/=255,o/=255),s=Math.min(n,a,o),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=(a-o)/u+6*(a<o);break;case a:t=(o-n)/u+2;break;case o:t=(n-a)/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,a,o=e.h,i=e.s,s=e.l;if(0===i)r=n=a=s;else{var l=s<.5?s*(1+i):s+i-s*i,u=2*s-l;r=t(u,l,o+1/3),n=t(u,l,o),a=t(u,l,o-1/3)}return{r:Math.round(255*r),g:Math.round(255*n),b:Math.round(255*a)}},rgb2rgbString:function(e){return"rgb("+[e.r,e.g,e.b].join(",")+")"}}},6974(e,t,r){"use strict";var n=r(2849),a=r(2467),o=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,a){return(parseFloat(e)-t)*(a-n)/(r-t)+n}function m(e){return e%2==0?"#ddd":"#222"}function p(e){return d(e,0,15,.02,.15)}var f=e.exports=function(e,t){return this.opts=n({},s,t),this.hash=t.hash||o(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,a){var o=g(n),i=p(a[0]),s=m(a[0]),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i,fill:s};e.polyline(o,l).transform({translate:[t+n,r],scale:[-1,1]}),e.polyline(o,l).transform({translate:[t+n,r+2*n],scale:[1,-1]}),l={stroke:u,"stroke-opacity":.02,"fill-opacity":i=p(a[1]),fill:s=m(a[1])},e.polyline(o,l).transform({translate:[t+n,r+2*n],scale:[-1,-1]}),e.polyline(o,l).transform({translate:[t+n,r],scale:[1,1]})}function v(e,t,r,n,a){var o=p(a),i=m(a),s=g(n),l={stroke:u,"stroke-opacity":.02,"fill-opacity":o,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]})}f.prototype.toSvg=function(){return this.svg.toString()},f.prototype.toString=function(){return this.toSvg()},f.prototype.toBase64=function(){var e=this.toSvg();return"u">typeof window&&"function"==typeof window.btoa?window.btoa(e):new Buffer(e).toString("base64")},f.prototype.toDataUri=function(){return"data:image/svg+xml;base64,"+this.toBase64()},f.prototype.toDataUrl=function(){return'url("'+this.toDataUri()+'")'},f.prototype.generateBackground=function(){var e,t,r,n;this.opts.color?r=a.hex2rgb(this.opts.color):(t=d(c(this.hash,14,3),0,4095,0,359),n=c(this.hash,17),(e=a.rgb2hsl(a.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=a.hsl2rgb(e)),this.color=a.rgb2hex(r),this.svg.rect(0,0,"100%","100%",{fill:a.rgb2rgbString(r)})},f.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)]()},f.prototype.geoHexagons=function(){var e,t,r,n,a,o,i,s,l,f=d(c(this.hash,0),0,15,8,60),h=f*Math.sqrt(3),g=2*f,y=(s=f/2,[0,l=Math.sin(60*Math.PI/180)*f,s,0,s+f,0,2*f,l,s+f,2*l,s,2*l,0,l].join(","));for(this.svg.setWidth(3*g+3*f),this.svg.setHeight(6*h),t=0,i=0;i<6;i++)for(o=0;o<6;o++)a=c(this.hash,t),e=o%2==0?i*h:i*h+h/2,r=p(a),n={fill:m(a),"fill-opacity":r,stroke:u,"stroke-opacity":.02},this.svg.polyline(y,n).transform({translate:[o*f*1.5-g/2,e-h/2]}),0===o&&this.svg.polyline(y,n).transform({translate:[6*f*1.5-g/2,e-h/2]}),0===i&&(e=o%2==0?6*h:6*h+h/2,this.svg.polyline(y,n).transform({translate:[o*f*1.5-g/2,e-h/2]})),0===o&&0===i&&this.svg.polyline(y,n).transform({translate:[6*f*1.5-g/2,5*h+h/2]}),t++},f.prototype.geoSineWaves=function(){var e,t,r,n,a,o,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(o=c(this.hash,t)),e=m(o),i=s/4*.7,a={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,a).transform({translate:[-s/4,u*t-1.5*l]}),this.svg.path(n,a).transform({translate:[-s/4,u*t-1.5*l+36*u]})},f.prototype.geoChevrons=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,30,80),l=d(c(this.hash,0),0,15,30,80),f=(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(o=0;o<6;o++)r=p(a=c(this.hash,t)),n={stroke:u,"stroke-opacity":.02,fill:m(a),"fill-opacity":r,"stroke-width":1},this.svg.group(n).transform({translate:[o*s,i*l*.66-l/2]}).polyline(f).end(),0===i&&this.svg.group(n).transform({translate:[o*s,6*l*.66-l/2]}).polyline(f).end(),t+=1},f.prototype.geoPlusSigns=function(){var e,t,r,n,a,o,i,s,l=d(c(this.hash,0),0,15,10,25),f=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(o=c(this.hash,r)),t=m(o),e=+(s%2!=0),a={fill:t,stroke:u,"stroke-opacity":.02,"fill-opacity":n},this.svg.group(a).transform({translate:[i*f-i*l+e*l-l,s*f-s*l-f/2]}).rect(g).end(),0===i&&this.svg.group(a).transform({translate:[4*f-i*l+e*l-l,s*f-s*l-f/2]}).rect(g).end(),0===s&&this.svg.group(a).transform({translate:[i*f-i*l+e*l-l,4*f-s*l-f/2]}).rect(g).end(),0===i&&0===s&&this.svg.group(a).transform({translate:[4*f-i*l+e*l-l,4*f-s*l-f/2]}).rect(g).end(),r++},f.prototype.geoXes=function(){var e,t,r,n,a,o,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(o=0;o<6;o++)r=p(a=c(this.hash,t)),e=o%2==0?i*u-.5*u:i*u-.5*u+u/4,n={fill:m(a),opacity:r},this.svg.group(n).transform({translate:[o*u/2-u/2,e-i*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===o&&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=o%2==0?6*u-u/2:6*u-u/2+u/4,this.svg.group(n).transform({translate:[o*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:[o*u/2-u/2,e-11*u/2],rotate:[45,u/2,u/2]}).rect(l).end(),0===o&&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++},f.prototype.geoOverlappingCircles=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,25,200)/2;for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),e=0,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:m(n),opacity:t},this.svg.circle(a*i,o*i,i,r),0===a&&this.svg.circle(6*i,o*i,i,r),0===o&&this.svg.circle(a*i,6*i,i,r),0===a&&0===o&&this.svg.circle(6*i,6*i,i,r),e++},f.prototype.geoOctogons=function(){var e,t,r,n,a,o,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(o=0;o<6;o++)n=p(a=c(this.hash,r)),t=m(a),this.svg.polyline(l,{fill:t,"fill-opacity":n,stroke:u,"stroke-opacity":.02}).transform({translate:[o*s,i*s]}),r+=1},f.prototype.geoSquares=function(){var e,t,r,n,a,o,i=d(c(this.hash,0),0,15,10,60);for(this.svg.setWidth(6*i),this.svg.setHeight(6*i),t=0,o=0;o<6;o++)for(a=0;a<6;a++)r=p(n=c(this.hash,t)),e=m(n),this.svg.rect(a*i,o*i,i,i,{fill:e,"fill-opacity":r,stroke:u,"stroke-opacity":.02}),t+=1},f.prototype.geoConcentricCircles=function(){var e,t,r,n,a,o,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,o=0;o<6;o++)for(a=0;a<6;a++)r=p(n=c(this.hash,t)),e=m(n),this.svg.circle(a*i+a*s+(i+s)/2,o*i+o*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=m(n),this.svg.circle(a*i+a*s+(i+s)/2,o*i+o*s+(i+s)/2,i/4,{fill:e,"fill-opacity":r}),t+=1},f.prototype.geoOverlappingRings=function(){var e,t,r,n,a,o,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,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":s+"px"},this.svg.circle(a*i,o*i,i-s/2,r),0===a&&this.svg.circle(6*i,o*i,i-s/2,r),0===o&&this.svg.circle(a*i,6*i,i-s/2,r),0===a&&0===o&&this.svg.circle(6*i,6*i,i-s/2,r),e+=1},f.prototype.geoTriangles=function(){var e,t,r,n,a,o,i,s,l=d(c(this.hash,0),0,15,15,80),f=l/2*Math.sqrt(3),h=[s=l/2,0,l,f,0,f,s,0].join(",");for(this.svg.setWidth(3*l),this.svg.setHeight(6*f),e=0,i=0;i<6;i++)for(o=0;o<6;o++)t=p(a=c(this.hash,e)),n={fill:m(a),"fill-opacity":t,stroke:u,"stroke-opacity":.02},r=i%2==0?180*(o%2==0):180*(o%2!=0),this.svg.polyline(h,n).transform({translate:[o*l*.5-l/2,f*i],rotate:[r,l/2,f/2]}),0===o&&this.svg.polyline(h,n).transform({translate:[6*l*.5-l/2,f*i],rotate:[r,l/2,f/2]}),e+=1},f.prototype.geoDiamonds=function(){var e,t,r,n,a,o,i,s=d(c(this.hash,0),0,15,10,50),l=d(c(this.hash,1),0,15,10,50),f=[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(o=0;o<6;o++)r=p(a=c(this.hash,t)),n={fill:m(a),"fill-opacity":r,stroke:u,"stroke-opacity":.02},e=i%2==0?0:s/2,this.svg.polyline(f,n).transform({translate:[o*s-s/2+e,l/2*i-l/2]}),0===o&&this.svg.polyline(f,n).transform({translate:[6*s-s/2+e,l/2*i-l/2]}),0===i&&this.svg.polyline(f,n).transform({translate:[o*s-s/2+e,l/2*6-l/2]}),0===o&&0===i&&this.svg.polyline(f,n).transform({translate:[6*s-s/2+e,l/2*6-l/2]}),t+=1},f.prototype.geoNestedSquares=function(){var e,t,r,n,a,o,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,o=0;o<6;o++)for(a=0;a<6;a++)t=p(n=c(this.hash,e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(a*s+a*i*2+i/2,o*s+o*i*2+i/2,s,s,r),t=p(n=c(this.hash,39-e)),r={fill:"none",stroke:m(n),opacity:t,"stroke-width":i+"px"},this.svg.rect(a*s+a*i*2+i/2+2*i,o*s+o*i*2+i/2+2*i,3*i,3*i,r),e+=1},f.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},f.prototype.geoPlaid=function(){var e,t,r,n,a,o,i=0,s=0;for(t=0;t<36;)i+=c(this.hash,t)+5,r=p(o=c(this.hash,t+1)),e=m(o),n=o+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(o=c(this.hash,t+1)),e=m(o),a=o+5,this.svg.rect(s,0,a,"100%",{opacity:r,fill:e}),s+=a,t+=2;this.svg.setWidth(s),this.svg.setHeight(i)},f.prototype.geoTessellation=function(){var e,t,r,n,a=d(c(this.hash,0),0,15,5,40),o=a*Math.sqrt(3),i=2*a,s=a/2*Math.sqrt(3),l=[0,0,s,a/2,0,a,0,0].join(","),f=3*a+2*s,h=2*o+2*a;for(this.svg.setWidth(f),this.svg.setHeight(h),e=0;e<20;e++)switch(t=p(n=c(this.hash,e)),r={stroke:u,"stroke-opacity":.02,fill:m(n),"fill-opacity":t,"stroke-width":1},e){case 0:this.svg.rect(-a/2,-a/2,a,a,r),this.svg.rect(f-a/2,-a/2,a,a,r),this.svg.rect(-a/2,h-a/2,a,a,r),this.svg.rect(f-a/2,h-a/2,a,a,r);break;case 1:this.svg.rect(i/2+s,o/2,a,a,r);break;case 2:this.svg.rect(-a/2,h/2-a/2,a,a,r),this.svg.rect(f-a/2,h/2-a/2,a,a,r);break;case 3:this.svg.rect(i/2+s,1.5*o+a,a,a,r);break;case 4:this.svg.polyline(l,r).transform({translate:[a/2,-a/2],rotate:[0,a/2,s/2]}),this.svg.polyline(l,r).transform({translate:[a/2,h- -a/2],rotate:[0,a/2,s/2],scale:[1,-1]});break;case 5:this.svg.polyline(l,r).transform({translate:[f-a/2,-a/2],rotate:[0,a/2,s/2],scale:[-1,1]}),this.svg.polyline(l,r).transform({translate:[f-a/2,h+a/2],rotate:[0,a/2,s/2],scale:[-1,-1]});break;case 6:this.svg.polyline(l,r).transform({translate:[f/2+a/2,o/2]});break;case 7:this.svg.polyline(l,r).transform({translate:[f-f/2-a/2,o/2],scale:[-1,1]});break;case 8:this.svg.polyline(l,r).transform({translate:[f/2+a/2,h-o/2],scale:[1,-1]});break;case 9:this.svg.polyline(l,r).transform({translate:[f-f/2-a/2,h-o/2],scale:[-1,-1]});break;case 10:this.svg.polyline(l,r).transform({translate:[a/2,h/2-a/2]});break;case 11:this.svg.polyline(l,r).transform({translate:[f-a/2,h/2-a/2],scale:[-1,1]});break;case 12:this.svg.rect(0,0,a,a,r).transform({translate:[a/2,a/2],rotate:[-30,0,0]});break;case 13:this.svg.rect(0,0,a,a,r).transform({scale:[-1,1],translate:[-f+a/2,a/2],rotate:[-30,0,0]});break;case 14:this.svg.rect(0,0,a,a,r).transform({translate:[a/2,h/2-a/2-a],rotate:[30,0,a]});break;case 15:this.svg.rect(0,0,a,a,r).transform({scale:[-1,1],translate:[-f+a/2,h/2-a/2-a],rotate:[30,0,a]});break;case 16:this.svg.rect(0,0,a,a,r).transform({scale:[1,-1],translate:[a/2,-h+h/2-a/2-a],rotate:[30,0,a]});break;case 17:this.svg.rect(0,0,a,a,r).transform({scale:[-1,-1],translate:[-f+a/2,-h+h/2-a/2-a],rotate:[30,0,a]});break;case 18:this.svg.rect(0,0,a,a,r).transform({scale:[1,-1],translate:[a/2,-h+a/2],rotate:[-30,0,0]});break;case 19:this.svg.rect(0,0,a,a,r).transform({scale:[-1,-1],translate:[-f+a/2,-h+a/2],rotate:[-30,0,0]})}}},6743(e){"use strict";function t(){var e=0x67452301,t=0xefcdab89,r=0x98badcfe,n=0x10325476,a=0xc3d2e1f0,o=new Uint32Array(80),i=0,s=24,l=0;function u(){for(var s,l,u=16;u<80;u++){var c=o[u-3]^o[u-8]^o[u-14]^o[u-16];o[u]=c<<1|c>>>31}var d=e,m=t,p=r,f=n,h=a;for(u=0;u<80;u++){u<20?(s=f^m&(p^f),l=0x5a827999):u<40?(s=m^p^f,l=0x6ed9eba1):u<60?(s=m&p|f&(m|p),l=0x8f1bbcdc):(s=m^p^f,l=0xca62c1d6);var g=(d<<5|d>>>27)+s+h+l+(0|o[u]);h=f,f=p,p=m<<30|m>>>2,m=d,d=g}for(u=0,e=e+d|0,t=t+m|0,r=r+p|0,n=n+f|0,a=a+h|0,i=0;u<16;u++)o[u]=0}function c(e){o[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 a=0;a<n;a++)c(e[a])},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 o=24;o>=0;o-=8)c(l>>o);return d(e)+d(t)+d(r)+d(n)+d(a)}}}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),a=r(6541);function o(){return this.width=100,this.height=100,this.svg=a("svg"),this.context=[],this.setAttributes(this.svg,{xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height}),this}e.exports=o,o.prototype.currentContext=function(){return this.context[this.context.length-1]||this.svg},o.prototype.end=function(){return this.context.pop(),this},o.prototype.currentNode=function(){var e=this.currentContext();return e.lastChild||e},o.prototype.transform=function(e){return this.currentNode().setAttribute("transform",Object.keys(e).map(function(t){return t+"("+e[t].join(",")+")"}).join(" ")),this},o.prototype.setAttributes=function(e,t){Object.keys(t).forEach(function(r){e.setAttribute(r,t[r])})},o.prototype.setWidth=function(e){this.svg.setAttribute("width",Math.floor(e))},o.prototype.setHeight=function(e){this.svg.setAttribute("height",Math.floor(e))},o.prototype.toString=function(){return this.svg.toString()},o.prototype.rect=function(e,t,r,o,i){var s=this;if(Array.isArray(e))return e.forEach(function(e){s.rect.apply(s,e.concat(i))}),this;var l=a("rect");return this.currentContext().appendChild(l),this.setAttributes(l,n({x:e,y:t,width:r,height:o},i)),this},o.prototype.circle=function(e,t,r,o){var i=a("circle");return this.currentContext().appendChild(i),this.setAttributes(i,n({cx:e,cy:t,r:r},o)),this},o.prototype.path=function(e,t){var r=a("path");return this.currentContext().appendChild(r),this.setAttributes(r,n({d:e},t)),this},o.prototype.polyline=function(e,t){var r=this;if(Array.isArray(e))return e.forEach(function(e){r.polyline(e,t)}),this;var o=a("polyline");return this.currentContext().appendChild(o),this.setAttributes(o,n({points:e},t)),this},o.prototype.group=function(e){var t=a("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:c="/",end:d=!0,sensitive:m=!1,trailing:p=!0}=t,f=new l("^"),h=[e],g=0;for(;h.length;){let e=h.shift();if(Array.isArray(e)){h.push(...e);continue}let l="object"==typeof e?e:function(e,t={}){let{encodePath:o=r}=t,l=[...e],u=[],c=0,d=0;function m(){let t="";if(n.test(l[c]))do t+=l[c++];while(a.test(l[c]));else if('"'===l[c]){let r=c;for(;c<l.length;){if('"'===l[++c]){c++,r=0;break}"\\"===l[c]&&c++,t+=l[c]}if(r)throw new s(`Unterminated quote at index ${r}`,e)}if(!t)throw new s(`Missing parameter name at index ${c}`,e);return t}for(;c<l.length;){let e=l[c++];"{}()[]+?!".includes(e)?u.push({type:e,index:c,value:e}):"\\"===e?u.push({type:"escape",index:c,value:l[c++]}):":"===e?u.push({type:"param",index:c,value:m()}):"*"===e?u.push({type:"wildcard",index:c,value:m()}):u.push({type:"char",index:c,value:e})}return u.push({type:"end",index:c,value:""}),new i(function t(r){let n=[];for(;;){let a=u[d++];if(a.type===r)break;if("char"===a.type||"escape"===a.type){let e=a.value,t=u[d];for(;"char"===t.type||"escape"===t.type;)e+=t.value,t=u[++d];n.push({type:"text",value:o(e)});continue}if("param"===a.type||"wildcard"===a.type){n.push({type:a.type,name:a.value});continue}if("{"===a.type){n.push({type:"group",tokens:t("}")});continue}throw new s(`Unexpected ${a.type} at index ${a.index}, expected ${r}`,e)}return n}("end"),e)}(e,t);!function e(t,r,n,a){for(;r<t.length;){let o=t[r++];if("group"===o.type){e(o.tokens,0,n.slice(),n=>e(t,r,n,a));continue}n.push(o)}a(n)}(l.tokens,0,[],e=>{if(g++>=256)throw new s("Too many path combinations",l.originalPath);let t=f;for(let r of function(e,t,r){let n=[],a="",i="",l=0,c=0,d=0;for(;d<e.length;){let m=e[d++];if("text"===m.type){n.push({source:o(m.value)}),a+=m.value,2===l&&(i+=m.value),m.value.includes(t)&&(c=0);continue}if("param"===m.type||"wildcard"===m.type){if(l&&!a)throw new s(`Missing text before "${m.name}" ${m.type}`,r);"param"===m.type?(n.push({source:c?`(${u(t,a)}+?)`:!function(r,n){for(;r<e.length;){let a=e[r++];if(a.type===n)return!0;if("text"===a.type&&a.value.includes(t))break}return!1}(d,"wildcard")?`(${u(t,"")}+?)`:`(${u(t,function(t){let r="";for(;t<e.length;){let n=e[t++];if("text"!==n.type)break;r+=n.value}return r}(d))}+?)`,key:m}),c|=l=1):(n.push({source:2&c?`(${u(a,"")}+?)`:1&c?`(${u(i,"")}+?)`:i?`(${u(i,"")}+?|${u(t,"")}+?)`:"([^]+?)",key:m}),i="",c|=l=2),a="";continue}throw TypeError(`Unknown token type: ${m.type}`)}return n}(e,c,l.originalPath))t=t.add(r.source,r.key);t.add("")})}let y=[],v=function e(t,r){t.key&&r.push(t.key);let n=Object.keys(t.children),a=n.map(n=>e(t.children[n],r)).join("|");return t.source+(n.length<2?a:`(?:${a})`)}(f,y);return p&&(v+="(?:"+o(c)+"$)?"),{regexp:new RegExp(v+=d?"$":"(?="+o(c)+"|$)",m?"":"i"),keys:y}};let r=e=>e,n=/^[$_\p{ID_Start}]$/u,a=/^[$\u200c\u200d\p{ID_Continue}]$/u;function o(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class i{constructor(e,t){this.tokens=e,this.originalPath=t}}class s extends TypeError{constructor(e,t){let r=e;t&&(r+=`: ${t}`),super(r+="; visit https://git.new/pathToRegexpError for info"),this.originalPath=t}}class l{constructor(e,t){this.source=e,this.key=t,this.children=Object.create(null)}add(e,t){var r;let n=e+":"+(t?t.name:"");return(r=this.children)[n]||(r[n]=new l(e,t))}}function u(e,t){return t.length>e.length?u(t,e):(e===t&&(t=""),t.length>1)?`(?:(?!${o(e)}|${o(t)})[^])`:e.length>1?`(?:(?!${o(e)})[^${o(t)}])`:`[^${o(e+t)}]`}},5338(e,t,r){"use strict";var n=r(6807);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},3904(e,t,r){"use strict";let n=Symbol("SemVer ANY");class a{static get ANY(){return n}constructor(e,t){if(t=o(t),e instanceof a)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 a))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=o(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=a;let o=r(8587),{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 a{constructor(e,t){if(t=i(t),e instanceof a)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new a(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=>!b(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&&w(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){e=e.replace(v,"");let t=((this.options.includePrerelease&&g)|(this.options.loose&&y))+":"+e,r=o.get(t);if(r)return r;let n=this.options.loose,a=n?c[m.HYPHENRANGELOOSE]:c[m.HYPHENRANGE];l("hyphen replace",e=e.replace(a,$(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[m.COMPARATORTRIM],p)),l("tilde trim",e=e.replace(c[m.TILDETRIM],f)),l("caret trim",e=e.replace(c[m.CARETTRIM],h));let i=e.split(" ").map(e=>D(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[m.COMPARATORLOOSE])))),l("range list",i);let u=new Map;for(let e of i.map(e=>new s(e,this.options))){if(b(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let d=[...u.values()];return o.set(t,d),d}intersects(e,t){if(!(e instanceof a))throw TypeError("a Range is required");return this.set.some(r=>E(r,t)&&e.set.some(e=>E(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(N(this.set[t],e,this.options))return!0;return!1}}e.exports=a;let o=new(r(8794)),i=r(8587),s=r(3904),l=r(7272),u=r(3908),{safeRe:c,src:d,t:m,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(9718),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:y}=r(6874),v=RegExp(d[m.BUILD],"g"),b=e=>"<0.0.0-0"===e.value,w=e=>""===e.value,E=(e,t)=>{let r=!0,n=e.slice(),a=n.pop();for(;r&&n.length;)r=n.every(e=>a.intersects(e,t)),a=n.pop();return r},D=(e,t)=>(l("comp",e=e.replace(c[m.BUILD],""),t),l("caret",e=C(e,t)),l("tildes",e=_(e,t)),l("xrange",e=P(e,t)),l("stars",e=T(e,t)),e),x=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(" "),S=(e,t)=>{let r=t.loose?c[m.TILDELOOSE]:c[m.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,a,o,i)=>{let s;return l("tilde",e,t,r,a,o,i),x(r)?s="":x(a)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:x(o)?s=`>=${r}.${a}.0${n} <${r}.${+a+1}.0-0`:i?(l("replaceTilde pr",i),s=`>=${r}.${a}.${o}-${i} <${r}.${+a+1}.0-0`):s=`>=${r}.${a}.${o} <${r}.${+a+1}.0-0`,l("tilde return",s),s})},C=(e,t)=>e.trim().split(/\s+/).map(e=>k(e,t)).join(" "),k=(e,t)=>{l("caret",e,t);let r=t.loose?c[m.CARETLOOSE]:c[m.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,a,o,i)=>{let s;return l("caret",e,t,r,a,o,i),x(r)?s="":x(a)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:x(o)?s="0"===r?`>=${r}.${a}.0${n} <${r}.${+a+1}.0-0`:`>=${r}.${a}.0${n} <${+r+1}.0.0-0`:i?(l("replaceCaret pr",i),s="0"===r?"0"===a?`>=${r}.${a}.${o}-${i} <${r}.${a}.${+o+1}-0`:`>=${r}.${a}.${o}-${i} <${r}.${+a+1}.0-0`:`>=${r}.${a}.${o}-${i} <${+r+1}.0.0-0`):(l("no pr"),s="0"===r?"0"===a?`>=${r}.${a}.${o} <${r}.${a}.${+o+1}-0`:`>=${r}.${a}.${o} <${r}.${+a+1}.0-0`:`>=${r}.${a}.${o} <${+r+1}.0.0-0`),l("caret return",s),s})},P=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>R(e,t)).join(" ")),R=(e,t)=>{e=e.trim();let r=t.loose?c[m.XRANGELOOSE]:c[m.XRANGE];return e.replace(r,(r,n,a,o,i,s)=>{let u,c,d;if(l("xRange",e,r,n,a,o,i,s),u=a,c=o,d=i,x(u)&&!x(c)||x(c)&&d&&!x(d))return e;let m=x(a),p=m||x(o),f=p||x(i);return"="===n&&f&&(n=""),s=t.includePrerelease?"-0":"",m?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(p&&(o=0),i=0,">"===n?(n=">=",p?(a=+a+1,o=0):o=+o+1,i=0):"<="===n&&(n="<",p?a=+a+1:o=+o+1),"<"===n&&(s="-0"),r=`${n+a}.${o}.${i}${s}`):p?r=`>=${a}.0.0${s} <${+a+1}.0.0-0`:f&&(r=`>=${a}.${o}.0${s} <${a}.${+o+1}.0-0`),l("xRange return",r),r})},T=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[m.STAR],"")),O=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?m.GTE0PRE:m.GTE0],"")),$=e=>(t,r,n,a,o,i,s,l,u,c,d,m)=>(r=x(n)?"":x(a)?`>=${n}.0.0${e?"-0":""}`:x(o)?`>=${n}.${a}.0${e?"-0":""}`:i?`>=${r}`:`>=${r}${e?"-0":""}`,l=x(u)?"":x(c)?`<${+u+1}.0.0-0`:x(d)?`<${u}.${+c+1}.0-0`:m?`<=${u}.${c}.${d}-${m}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),N=(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:a,MAX_SAFE_INTEGER:o}=r(6874),{safeRe:i,t:s}=r(9718),l=r(8587),{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>a)throw TypeError(`version is longer than ${a} 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>o||this.major<0)throw TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>o||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<o)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],a=e.prerelease[t];if(n("prerelease compare",t,r,a),void 0===r&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===r)return -1;else if(r===a)continue;else return u(r,a)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],a=e.build[t];if(n("build compare",t,r,a),void 0===r&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===r)return -1;else if(r===a)continue;else return u(r,a)}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]),((e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let t=0;t<r.length;t++)if(0!==u(e[t],r[t]))return!1;return!0})(this.prerelease,t)?isNaN(this.prerelease[t.split(".").length])&&(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),a=r(3999),o=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 a(e,r,u);case">":return o(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),a=t.test(r);return n&&a&&(e*=1,r*=1),e===r?0:n&&!a?-1:a&&!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}}},8587(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:a,MAX_LENGTH:o}=r(6874),i=r(7272),s=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},m=0,p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",o],[p,a]],h=(e,t,r)=>{let n=(e=>{for(let[t,r]of f)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),a=m++;i(e,a,t),d[e]=a,u[a]=t,c[a]=n,s[a]=new RegExp(t,r?"g":void 0),l[a]=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*$")},5523(e,t,r){"use strict";let n,a,o,i,s,l,u,c,d,m,p;r.r(t),r.d(t,{GenderUnknownIcon:()=>c1,evaluateAsNumber:()=>iP,getImportMapOverrideMap:()=>ox,StockManagementPictogram:()=>D3,ChemistryIcon:()=>cA,BabyIcon:()=>cC,DashboardExtension:()=>d4,openmrsComponentDecorator:()=>lj,tryRegisterExtension:()=>u1,pictogramIds:()=>Dk,ActivityIcon:()=>cw,compile:()=>i$,removeRouteMapOverride:()=>oQ,TableBatchActions:()=>cl,getAsyncLifecycle:()=>lL,subscribeOpenmrsEvent:()=>it,PasswordIcon:()=>dg,Assessment2Pictogram:()=>DO,CloseIcon:()=>cU,setupRouteMapOverrides:()=>o4,useFeatureFlag:()=>us,reset:()=>sF,ConceptDictionaryPictogram:()=>DM,LabOrderIcon:()=>dt,VisitMode:()=>il,useLocations:()=>uR,getLifecycle:()=>lA,formatDatetime:()=>w_,getVisitsForPatient:()=>iy,formatPartialDate:()=>ww,CustomOverflowMenu:()=>ch,LocationIcon:()=>dn,GroupIcon:()=>c2,createUseStore:()=>ls,VisitStatus:()=>iu,getSessionLocation:()=>a8,getCurrentImportMap:()=>oM,usePatient:()=>uj,useRenderableExtensions:()=>uL,getOpenedWindowIndexByWorkspace:()=>sY,setLeftNav:()=>sV,clearHistory:()=>aV,clearConfigErrors:()=>ac,formatTime:()=>wx,isDevEnabled:()=>os,CohortsPictogram:()=>DI,closeWorkspaceGroup2:()=>xE,getCurrentRouteMap:()=>oZ,ConfigurableLink:()=>le,sessionStore:()=>aJ,setSessionLocale:()=>oe,subscribeSnackbarShown:()=>S,getLoggedInUser:()=>a9,GenderMaleIcon:()=>cQ,getExtensionSlotConfigFromStore:()=>nS,evaluateAsNumberAsync:()=>iR,getImportMapDefaultMap:()=>oE,unregisterExtensionRendering:()=>so,implementerToolsConfigStore:()=>nL,Type:()=>nd,InPatientPictogram:()=>DH,cleanupObsoleteFeatureFlags:()=>i0,getAttachmentsUrl:()=>o5,showSnackbar:()=>xu,PatientBannerActionsMenu:()=>Dw,PatientSearchPictogram:()=>Dq,DocumentAttachmentIcon:()=>cK,Snackbar:()=>xa,CardiologyPictogram:()=>DN,ImageMedicalIcon:()=>c5,ActionableNotificationComponent:()=>EY,DiagnosisTags:()=>Ex,openChildWorkspaceInWindow:()=>xR,iconIds:()=>cb,PatientsPictogram:()=>DJ,interpolateUrl:()=>aN,setupHistory:()=>aL,subscribeToastShown:()=>_,detachAll:()=>sI,convertToLocaleCalendar:()=>wS,DocumentIcon:()=>cz,configInternalStore:()=>nb,ActionMenuButton2:()=>x8,setupDynamicOfflineDataHandler:()=>_D,makeUrl:()=>aZ,oneOf:()=>ay,selectPreferredName:()=>Dl,MobileCheckIcon:()=>dc,createErrorHandler:()=>P,parseDate:()=>wf,getAttachmentByUuid:()=>o3,LeftNavMenu:()=>ET,getExtensionRegistration:()=>sT,ShoppingCartAddItemIcon:()=>dQ,ReferralOrderIcon:()=>dD,ReportIcon:()=>d_,dispatchToastShown:()=>E,getImportMapNextPageMap:()=>oD,registerExtension:()=>sO,setupOfflineSync:()=>_E,DownloadIcon:()=>cG,useConnectivity:()=>_k,provide:()=>n0,ShoppingCartArrowDownIcon:()=>dO,featureFlagsStore:()=>iX,jsep:()=>ib,GeriatricsPictogram:()=>DU,SearchIcon:()=>dk,reportError:()=>k,slugify:()=>o$,isOmrsDateToday:()=>wd,getExtensionStore:()=>si,BloodBankPictogram:()=>D$,TriagePictogram:()=>D9,Workspace2:()=>xF,refetchCurrentUser:()=>a3,CheckmarkOutlineIcon:()=>cj,registerExtensionSlot:()=>sL,AllergiesIcon:()=>dY,ArrowDownIcon:()=>cD,useOpenmrsInfinite:()=>uy,getExtensionConfigFromExtensionSlotStore:()=>nP,OpenmrsDatePicker:()=>En,getExtensionConfigFromStore:()=>nk,getDynamicOfflineDataEntries:()=>_x,getLocaleDisplayName:()=>bB,messageOmrsServiceWorker:()=>_S,navigate:()=>aM,launchWorkspace2:()=>xD,getGroupByWindowName:()=>sZ,CustomOverflowMenuItem:()=>cg,isUrl:()=>ag,CaretDownIcon:()=>cR,ArrowLeftIcon:()=>cx,FacilityPictogram:()=>DV,ViewOffIcon:()=>dK,updateInternalExtensionStore:()=>i7,dispatchActionableNotificationShown:()=>b,resetRouteMapOverrides:()=>o0,formatDurationBetween:()=>wN,defaultVisitCustomRepresentation:()=>ic,getBreadcrumbsFor:()=>aC,useOpenmrsPagination:()=>uu,Pagination:()=>Dn,CheckmarkFilledIcon:()=>cM,clearCurrentUser:()=>a6,showModal:()=>EH,ChevronUpIcon:()=>cV,saveVisit:()=>ih,useAttachments:()=>l1,Pictogram:()=>xr,useExtensionSlot:()=>lp,ChevronDownIcon:()=>cL,OpenmrsDateRangePicker:()=>Ea,deleteAttachmentPermanently:()=>o8,getVisitTypes:()=>is,OverflowMenuHorizontalIcon:()=>df,EventScheduleIcon:()=>cq,getSessionStore:()=>a4,ProcedureOrderIcon:()=>dw,preloadImport:()=>oI,registerWorkspaceWindows2:()=>sJ,useOnVisible:()=>uO,setSessionLocation:()=>a7,userHasAccess:()=>a5,ChartAverageIcon:()=>cN,getFeatureFlag:()=>i1,UserAvatarIcon:()=>dU,renderExtension:()=>s5,useFhirInfinite:()=>uD,toVisitTypeObject:()=>io,useSession:()=>uF,EmergencyDepartmentPictogram:()=>DB,Notification:()=>EG,dispatchSnackbarShown:()=>w,formatDate:()=>wE,workspace2StoreActions:()=>x$,SwitcherIcon:()=>dR,esmStyleGuideSchema:()=>co,getImportMapDisabledOverrides:()=>o_,useAssignedExtensionIds:()=>lQ,CaretRightIcon:()=>cO,evaluateAsType:()=>iT,PageHeader:()=>Dt,TranslateIcon:()=>dL,setUserProperties:()=>ot,MovementIcon:()=>dp,renderInlineNotifications:()=>E4,subscribePrecacheStaticDependencies:()=>_C,PaymentsDeskPictogram:()=>DX,usePrimaryIdentifierCode:()=>uA,useLayoutType:()=>u_,getCurrentUser:()=>a1,closeWorkspaceInWindow:()=>xP,XrayPictogram:()=>D8,CaretUpIcon:()=>c$,renderActionableNotifications:()=>E3,OpenmrsAppContext:()=>lZ,setupModals:()=>EW,getDefaultsFromConfigSchema:()=>function e(t){let r={};for(let n of Object.keys(t))if(_h(t[n])&&t[n].hasOwnProperty("_default"))r[n]=t[n]._default;else{if(n.startsWith("_"))continue;_h(t[n])?r[n]=e(t[n]):r[n]=t[n]}return r},subscribeTo:()=>H,recordConfigDerivationError:()=>nj,useAbortController:()=>lq,Extension:()=>lt,getFhirServerPaginationHandlers:()=>up,useConnectedExtensions:()=>l9,registerApp:()=>u2,HospitalBedIcon:()=>c6,useExtensionInternalStore:()=>ua,configExtensionStore:()=>nE,getSynchronizationItems:()=>__,getExtensionSlotsConfigStore:()=>nx,registerExtensionRendering:()=>sa,RenderIfValueIsTruthy:()=>lY,registerFeatureFlag:()=>iQ,useFhirFetchAll:()=>uE,restBaseUrl:()=>az,CalendarHeatMapIcon:()=>ck,isImportMapOverrideDisabled:()=>oS,resetConfigSystem:()=>ad,getExtensionInternalStore:()=>i9,registerGlobalStore:()=>U,evaluateAsBoolean:()=>iC,PatientBannerPatientInfo:()=>Dv,addRouteMapOverride:()=>oX,getDefaultCalendar:()=>wv,SettingsIcon:()=>dP,DrugOrderIcon:()=>cZ,ProgramsIcon:()=>dE,useAssignedExtensions:()=>lm,CloseFilledIcon:()=>cW,canAccessStorage:()=>_f,registerDefaultCalendar:()=>wy,TreeViewAltIcon:()=>dB,OverflowMenuVerticalIcon:()=>dh,clearConfigDerivationError:()=>nA,getConfigStore:()=>nD,InformationSquareIcon:()=>c7,EmptyCard:()=>Ek,ChevronLeftIcon:()=>cF,RadiologyIcon:()=>dX,useCandidateExtensions:()=>l0,renderToasts:()=>xf,isDesktop:()=>uS,integrateBreakpoints:()=>u8,RegistrationPictogram:()=>D1,CardHeader:()=>cr,getExtensionRegistrationFrom:()=>sR,InformationIcon:()=>c9,SystemAdministrationPictogram:()=>D6,TrashCanIcon:()=>dF,useShallowStableValue:()=>lr,PatientDocumentsPictogram:()=>DY,useOpenmrsSWR:()=>u$,Assessment1Pictogram:()=>DT,finishRegisteringAllApps:()=>u3,importDynamic:()=>oN,useFhirPagination:()=>um,useVisitContextStore:()=>uG,ArrowUpIcon:()=>cS,showActionableNotification:()=>E6,useForceUpdate:()=>ul,useVisit:()=>uZ,PatientBannerPatientIdentifiers:()=>Df,TransferPictogram:()=>D5,usePagination:()=>uN,Breakpoint:()=>u6,PatientBannerToggleContactDetailsButton:()=>x7,CloseOutlineIcon:()=>cH,ObstetricsPictogram:()=>DZ,parseDateInput:()=>wk,ReportsPictogram:()=>D4,getConfig:()=>n4,attach:()=>s$,getLocale:()=>bV,isUrlWithTemplateParameters:()=>ah,useEmrConfiguration:()=>ur,useLeftNav:()=>uC,ToolsIcon:()=>dA,ErrorState:()=>EP,detach:()=>sN,setCurrentVisit:()=>ip,ConditionsIcon:()=>dJ,SaveIcon:()=>dC,useConfig:()=>l5,validator:()=>nm,CalendarIcon:()=>cP,getHistory:()=>aF,StickyNoteAddIcon:()=>d$,useWorkspace2Store:()=>xN,getPatientName:()=>Da,getVisitStore:()=>im,getCoreTranslation:()=>a$,registerModuleWithConfigSystem:()=>nq,updateOpenedWorkspaceInWindow:()=>xT,registerModuleLoad:()=>nJ,getBreadcrumbs:()=>ax,extractVariableNames:()=>iY,translateFrom:()=>aO,useStoreWithActions:()=>li,EditIcon:()=>cY,getCandidateExtensions:()=>sA,shallowEqual:()=>T,subscribeNotificationShown:()=>D,MaximizeIcon:()=>di,promptForClosingWorkspaces:()=>xC,WarningIcon:()=>dZ,fhirBaseUrl:()=>aK,matchLocale:()=>_p,usePatientPhoto:()=>Dx,registerBreadcrumb:()=>aE,EventsIcon:()=>cJ,createGlobalStore:()=>B,subscribeToFeatureFlag:()=>i4,useExtensionStore:()=>ui,createAttachment:()=>o9,useLeftNavStore:()=>uk,TableIcon:()=>dM,Icon:()=>d1,InformationFilledIcon:()=>c8,getCurrentPageMap:()=>ow,LaboratoryPictogram:()=>Dz,temporaryConfigStore:()=>nw,toDateObjectStrict:()=>wm,defineConfigSchema:()=>nY,filterBreadcrumbs:()=>aS,invalidateImplementerToolsConfig:()=>nI,PatientBannerContactDetails:()=>_o,getAssignedExtensions:()=>sj,promptForClosingWorkspacesInWindow:()=>xk,PatientPhoto:()=>DC,MaterialOrderIcon:()=>da,MicroscopeIcon:()=>du,visitTypesUrl:()=>ii,getOpenedWindowWidth:()=>xj,scheduleRecomputation:()=>sd,PharmacyPictogram:()=>DQ,AttachmentIcon:()=>dq,MoneyIcon:()=>dd,getAttachments:()=>o6,PageHeaderContent:()=>Dr,MedicationIcon:()=>ds,PrinterIcon:()=>db,PatientListsPictogram:()=>xe,useAppContext:()=>lJ,isOpenmrsRoutes:()=>oL,AppointmentsAltPictogram:()=>DR,GenericOrderTypeIcon:()=>c4,batchExtensionUpdates:()=>su,useExtensionSlotStore:()=>lc,ViewIcon:()=>dG,formattedName:()=>Ds,sessionEndpoint:()=>aG,duration:()=>wO,resetImportMapOverrides:()=>oP,TableOfContentsIcon:()=>dI,CaretLeftIcon:()=>cT,getTranslationOverrides:()=>n2,isVersionSatisfied:()=>_v,EmptyCardIllustration:()=>EC,PenIcon:()=>dv,verifyTotpCode:()=>or,validators:()=>av,setupImportMapOverrides:()=>oO,showToast:()=>xh,useDefineAppContext:()=>lG,getGlobalStore:()=>W,useOnClickOutside:()=>uT,getWindowByWorkspaceName:()=>sG,ArrowRightIcon:()=>c_,loadLifeCycles:()=>uX,registerBreadcrumbs:()=>aD,MotherIcon:()=>dm,fetchCurrentPatient:()=>o7,Toast:()=>xc,MessageQueueIcon:()=>dl,TwoFactorAuthenticationIcon:()=>dV,Pharmacy2Pictogram:()=>D0,goBackInHistory:()=>aB,GroupAccessIcon:()=>c3,getExtensionRenderingsStore:()=>i8,setImplementerToolsConfigRecomputer:()=>nN,getAsyncExtensionLifecycle:()=>lB,setupApiModule:()=>ou,renderLoadingSpinner:()=>_i,showNotification:()=>E2,getModalRegistration:()=>sz,ListCheckedIcon:()=>dr,ResponsiveWrapper:()=>xn,GynaecologyPictogram:()=>DW,ShoppingCartIcon:()=>dT,getRouteMapNextPageMap:()=>oq,MetadataExportPictogram:()=>DG,updateVisit:()=>ig,backendDependencies:()=>ol,MaybePictogram:()=>xt,createParcelMounter:()=>s3,openmrsFetch:()=>aY,useStore:()=>lo,isOpenmrsAppRoutes:()=>oA,ExportedWorkspace:()=>x4,DentistryPictogram:()=>DL,HomePictogram:()=>D7,ServiceQueuesPictogram:()=>D2,createExportedWorkspaceWindow:()=>xL,setFeatureFlag:()=>i2,toLanguageTag:()=>bF,DigitalTrustPictogram:()=>DF,NumericObservation:()=>E7,attachmentUrl:()=>o2,interpolateString:()=>aI,inRange:()=>af,useExtensionSlotMeta:()=>uo,AppointmentsPictogram:()=>DP,renderSnackbars:()=>xl,getRegisteredWorkspace2Names:()=>xM,logout:()=>on,toLocationObject:()=>ir,ChartLineIcon:()=>cI,UserHasAccess:()=>uB,evaluateAsBooleanAsync:()=>ik,createDashboard:()=>d2,getLocations:()=>ia,useExtensionContext:()=>un,getExtensionsConfigStore:()=>nC,getRouteMapDefaultMap:()=>oY,age:()=>Dc,isOmrsDateStrict:()=>wc,registerWorkspaceGroups2:()=>sq,usePaginationInfo:()=>uI,evaluateAsync:()=>iS,useOpenmrsFetchAll:()=>ub,removeImportMapOverride:()=>ok,useVisitTypes:()=>uq,ageAsDuration:()=>Du,getExtensionNameFromId:()=>sP,DataEntryPictogram:()=>DA,renderParcel:()=>s2,ResetIcon:()=>dS,RenewIcon:()=>dx,useWorkspace2Context:()=>xI,subscribeActionableNotificationShown:()=>x,ErrorCard:()=>ER,GenderFemaleIcon:()=>cX,enableImportMapOverride:()=>oR,retry:()=>_b,ComponentContext:()=>s7,ExtensionSlot:()=>lh,unsetLeftNav:()=>sU,addImportMapOverride:()=>oC,MaybeIcon:()=>d0,useCustomOverflowMenu:()=>cf,PedestrianFamilyIcon:()=>dy,CtScanPictogram:()=>Dj,dispatchNotificationShown:()=>v,leftNavStore:()=>sB,OpenmrsFetchError:()=>aq,UserFollowIcon:()=>dW,launchWorkspaceGroup2:()=>xw,ChevronRightIcon:()=>cB,UserXrayIcon:()=>dH,GenderOtherIcon:()=>c0,formatDuration:()=>wC,toOmrsIsoString:()=>wp,Labs2Pictogram:()=>DK,workspace2Store:()=>sK,setUserLanguage:()=>a2,useBodyScrollLock:()=>l4,SyringeIcon:()=>dN,LocationPicker:()=>EO,useDebounce:()=>l8,TimeIcon:()=>dj,getExtensionSlotConfig:()=>n_,AddIcon:()=>cE,getRouteMapOverrideMap:()=>oJ,processConfig:()=>n3,InventoryManagementIcon:()=>de,registerWorkspaces2:()=>sX,UserIcon:()=>dz,formatPatientName:()=>Di,fireOpenmrsEvent:()=>ie,registerModal:()=>sH,registerTranslationNamespace:()=>nX,displayName:()=>Do,createLocalStore:()=>V,evaluate:()=>i_,defineExtensionConfigSchema:()=>nQ,getSyncLifecycle:()=>lF,renderWorkspaceWindowsAndMenu:()=>_c,evaluateAsTypeAsync:()=>iO});let f="openmrs:notification-shown",h="openmrs:actionable-notification-shown",g="openmrs:toast-shown",y="openmrs:snack-bar-shown";function v(e){window.dispatchEvent(new CustomEvent(f,{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 D(e){let t=t=>e(t.detail);return window.addEventListener(f,t),()=>window.removeEventListener(f,t)}function x(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}=R(e);return"string"==typeof r&&r?r:t}function k(e){let t=R(e);setTimeout(()=>{throw t})}function P(){let e=Error();return t=>{let r=R(t);r.stack+=`
2
2
  Async stacktrace:
3
- ${e.stack}`,k(t)}}function R(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 T(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 O(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let a=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(n=r.getItem(e))?n:null;return o instanceof Promise?o.then(a):a(o)},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,a){return console.error("Unexpected error: ",a??e),E({description:C(a,"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 $=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>$(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>$(t)(e)}}},N=e=>{let t,r=new Set,n=(e,n)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=n?n:"object"!=typeof a||null===a)?a:Object.assign({},t,a),r.forEach(r=>r(t,e))}},a=()=>t,o={setState:n,getState:a,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,a,o);return o},I=e=>e?N(e):N;function M(){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 j={},A=Symbol.for("openmrs.esm-state.instanceCount"),L=globalThis,F=(L[A]??0)+1;function B(e,t,r="none"){let n=j[e];if(n)return n.active?M()||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 j[e]={value:n,active:!0},n}}function V(e){return I()(()=>e)}function U(e,t){let r=j[e];return r?(r.active?M()||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):(j[e]={value:t,active:!0},t)}function W(e,t,r="none"){let n=j[e];if(!n){let n=z(e,t??{},r);return j[e]={value:n,active:!1},n}return n.value}function H(...e){let[t,r,n]=e,a=void 0===n?r:n,o=void 0===n?e=>e:r,i=o(t.getState());return a(i),t.subscribe(e=>{let t=o(e);T(i,t)||(i=t,a(t))})}function z(e,t,r){return"sessionStorage"===r?I()(((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,a)=>{let o,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{o=s.getStorage()}catch(e){}if(!o)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},n,a);let d=$(s.serialize),m=()=>{let e,t=d({state:s.partialize({...n()}),version:s.version}).then(e=>o.setItem(s.name,e)).catch(t=>{e=t});if(e)throw e;return t},p=a.setState;a.setState=(e,t)=>{p(e,t),m()};let f=e((...e)=>{r(...e),m()},n,a),h=()=>{var e;if(!o)return;l=!1,u.forEach(e=>e(n()));let t=(null==(e=s.onRehydrateStorage)?void 0:e.call(s,n()))||void 0;return $(o.getItem.bind(o))(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:f),!0),m()}).then(()=>{null==t||t(i,void 0),l=!0,c.forEach(e=>e(i))}).catch(e=>{null==t||t(void 0,e)})};return a.persist={setOptions:e=>{s={...s,...e},e.getStorage&&(o=e.getStorage())},clearStorage:()=>{null==o||o.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||f};return(r,n,a)=>{let o,i={storage:O(()=>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,a);let d=()=>{let e=i.partialize({...n()});return c.setItem(i.name,{state:e,version:i.version})},m=a.setState;a.setState=(e,t)=>{m(e,t),d()};let p=e((...e)=>{r(...e),d()},n,a);a.getInitialState=()=>p;let f=()=>{var e,t;if(!c)return;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let a=(null==(t=i.onRehydrateStorage)?void 0:t.call(i,null!=(e=n())?e:p))||void 0;return $(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[a,s]=e;if(r(o=i.merge(s,null!=(t=n())?t:p),!0),a)return d()}).then(()=>{null==a||a(o,void 0),o=n(),s=!0,u.forEach(e=>e(o))}).catch(e=>{null==a||a(void 0,e)})};return a.persist={setOptions:e=>{i={...i,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>f(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},i.skipHydration||f(),o||p}})(()=>t,{name:e,storage:O(()=>sessionStorage)})):I()(()=>t)}L[A]=F,F>1&&!M()&&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=j)},1e3);let K=function(e){return void 0===e};var G,Z,Y,q,J,X,Q,ee,et,er,en,ea,eo="object"==typeof global&&global&&global.Object===Object&&global,ei="object"==typeof self&&self&&self.Object===Object&&self,es=eo||ei||Function("return this")(),el=es.Symbol,eu=Object.prototype,ec=eu.hasOwnProperty,ed=eu.toString,em=el?el.toStringTag:void 0;let ep=function(e){var t=ec.call(e,em),r=e[em];try{e[em]=void 0;var n=!0}catch(e){}var a=ed.call(e);return n&&(t?e[em]=r:delete e[em]),a};var ef=Object.prototype.toString,eh=el?el.toStringTag:void 0;let eg=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":eh&&eh in Object(e)?ep(e):ef.call(e)},ey=function(e,t){return function(r){return e(t(r))}};var ev=ey(Object.getPrototypeOf,Object);let eb=function(e){return null!=e&&"object"==typeof e};var ew=Object.prototype,eE=Function.prototype.toString,eD=ew.hasOwnProperty,ex=eE.call(Object);let e_=function(e){if(!eb(e)||"[object Object]"!=eg(e))return!1;var t=ev(e);if(null===t)return!0;var r=eD.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&eE.call(r)==ex},eS=function(e,t){return e===t||e!=e&&t!=t},eC=function(e,t){for(var r=e.length;r--;)if(eS(e[r][0],t))return r;return -1};var ek=Array.prototype.splice;function eP(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])}}eP.prototype.clear=function(){this.__data__=[],this.size=0},eP.prototype.delete=function(e){var t=this.__data__,r=eC(t,e);return!(r<0)&&(r==t.length-1?t.pop():ek.call(t,r,1),--this.size,!0)},eP.prototype.get=function(e){var t=this.__data__,r=eC(t,e);return r<0?void 0:t[r][1]},eP.prototype.has=function(e){return eC(this.__data__,e)>-1},eP.prototype.set=function(e,t){var r=this.__data__,n=eC(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};let eR=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eT=function(e){if(!eR(e))return!1;var t=eg(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var eO=es["__core-js_shared__"],e$=(G=/[^.]+$/.exec(eO&&eO.keys&&eO.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",eN=Function.prototype.toString;let eI=function(e){if(null!=e){try{return eN.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var eM=/^\[object .+?Constructor\]$/,ej=Object.prototype,eA=Function.prototype.toString,eL=ej.hasOwnProperty,eF=RegExp("^"+eA.call(eL).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eB=function(e){return!!eR(e)&&(!e$||!(e$ in e))&&(eT(e)?eF:eM).test(eI(e))},eV=function(e,t){var r=null==e?void 0:e[t];return eB(r)?r:void 0};var eU=eV(es,"Map"),eW=eV(Object,"create"),eH=Object.prototype.hasOwnProperty,ez=Object.prototype.hasOwnProperty;function eK(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])}}eK.prototype.clear=function(){this.__data__=eW?eW(null):{},this.size=0},eK.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},eK.prototype.get=function(e){var t=this.__data__;if(eW){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return eH.call(t,e)?t[e]:void 0},eK.prototype.has=function(e){var t=this.__data__;return eW?void 0!==t[e]:ez.call(t,e)},eK.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=eW&&void 0===t?"__lodash_hash_undefined__":t,this};let eG=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eZ=function(e,t){var r=e.__data__;return eG(t)?r["string"==typeof t?"string":"hash"]:r.map};function eY(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 eq(e){var t=this.__data__=new eP(e);this.size=t.size}eY.prototype.clear=function(){this.size=0,this.__data__={hash:new eK,map:new(eU||eP),string:new eK}},eY.prototype.delete=function(e){var t=eZ(this,e).delete(e);return this.size-=!!t,t},eY.prototype.get=function(e){return eZ(this,e).get(e)},eY.prototype.has=function(e){return eZ(this,e).has(e)},eY.prototype.set=function(e,t){var r=eZ(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},eq.prototype.clear=function(){this.__data__=new eP,this.size=0},eq.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},eq.prototype.get=function(e){return this.__data__.get(e)},eq.prototype.has=function(e){return this.__data__.has(e)},eq.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eP){var n=r.__data__;if(!eU||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new eY(n)}return r.set(e,t),this.size=r.size,this};var eJ=function(){try{var e=eV(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let eX=function(e,t,r){"__proto__"==t&&eJ?eJ(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},eQ=function(e,t,r){(void 0===r||eS(e[t],r))&&(void 0!==r||t in e)||eX(e,t,r)},e0=function(e,t,r){for(var n=-1,a=Object(e),o=r(e),i=o.length;i--;){var s=o[++n];if(!1===t(a[s],s,a))break}return e};var e1="object"==typeof exports&&exports&&!exports.nodeType&&exports,e4=e1&&"object"==typeof module&&module&&!module.nodeType&&module,e2=e4&&e4.exports===e1?es.Buffer:void 0,e3=e2?e2.allocUnsafe:void 0;let e6=function(e,t){if(t)return e.slice();var r=e.length,n=e3?e3(r):new e.constructor(r);return e.copy(n),n};var e5=es.Uint8Array;let e9=function(e){var t=new e.constructor(e.byteLength);return new e5(t).set(new e5(e)),t},e8=function(e,t){var r=t?e9(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},e7=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t};var te=Object.create,tt=function(){function e(){}return function(t){if(!eR(t))return{};if(te)return te(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),tr=Object.prototype;let tn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tr)},ta=function(e){return"function"!=typeof e.constructor||tn(e)?{}:tt(ev(e))},to=function(e){return eb(e)&&"[object Arguments]"==eg(e)};var ti=Object.prototype,ts=ti.hasOwnProperty,tl=ti.propertyIsEnumerable,tu=to(function(){return arguments}())?to:function(e){return eb(e)&&ts.call(e,"callee")&&!tl.call(e,"callee")},tc=Array.isArray;let td=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},tm=function(e){return null!=e&&td(e.length)&&!eT(e)};var tp="object"==typeof exports&&exports&&!exports.nodeType&&exports,tf=tp&&"object"==typeof module&&module&&!module.nodeType&&module,th=tf&&tf.exports===tp?es.Buffer:void 0;let tg=(th?th.isBuffer:void 0)||function(){return!1};var ty={};ty["[object Float32Array]"]=ty["[object Float64Array]"]=ty["[object Int8Array]"]=ty["[object Int16Array]"]=ty["[object Int32Array]"]=ty["[object Uint8Array]"]=ty["[object Uint8ClampedArray]"]=ty["[object Uint16Array]"]=ty["[object Uint32Array]"]=!0,ty["[object Arguments]"]=ty["[object Array]"]=ty["[object ArrayBuffer]"]=ty["[object Boolean]"]=ty["[object DataView]"]=ty["[object Date]"]=ty["[object Error]"]=ty["[object Function]"]=ty["[object Map]"]=ty["[object Number]"]=ty["[object Object]"]=ty["[object RegExp]"]=ty["[object Set]"]=ty["[object String]"]=ty["[object WeakMap]"]=!1;let tv=function(e){return function(t){return e(t)}};var tb="object"==typeof exports&&exports&&!exports.nodeType&&exports,tw=tb&&"object"==typeof module&&module&&!module.nodeType&&module,tE=tw&&tw.exports===tb&&eo.process,tD=function(){try{var e=tw&&tw.require&&tw.require("util").types;if(e)return e;return tE&&tE.binding&&tE.binding("util")}catch(e){}}(),tx=tD&&tD.isTypedArray,t_=tx?tv(tx):function(e){return eb(e)&&td(e.length)&&!!ty[eg(e)]};let tS=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tC=Object.prototype.hasOwnProperty;let tk=function(e,t,r){var n=e[t];tC.call(e,t)&&eS(n,r)&&(void 0!==r||t in e)||eX(e,t,r)},tP=function(e,t,r,n){var a=!r;r||(r={});for(var o=-1,i=t.length;++o<i;){var s=t[o],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),a?eX(r,s,l):tk(r,s,l)}return r},tR=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tT=/^(?:0|[1-9]\d*)$/;let tO=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&tT.test(e))&&e>-1&&e%1==0&&e<t};var t$=Object.prototype.hasOwnProperty;let tN=function(e,t){var r=tc(e),n=!r&&tu(e),a=!r&&!n&&tg(e),o=!r&&!n&&!a&&t_(e),i=r||n||a||o,s=i?tR(e.length,String):[],l=s.length;for(var u in e)(t||t$.call(e,u))&&!(i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||tO(u,l)))&&s.push(u);return s},tI=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t};var tM=Object.prototype.hasOwnProperty;let tj=function(e){if(!eR(e))return tI(e);var t=tn(e),r=[];for(var n in e)"constructor"==n&&(t||!tM.call(e,n))||r.push(n);return r},tA=function(e){return tm(e)?tN(e,!0):tj(e)},tL=function(e,t,r,n,a,o,i){var s=tS(e,r),l=tS(t,r),u=i.get(l);if(u)return void eQ(e,r,u);var c=o?o(s,l,r+"",e,t,i):void 0,d=void 0===c;if(d){var m=tc(l),p=!m&&tg(l),f=!m&&!p&&t_(l);(c=l,m||p||f)?tc(s)?c=s:eb(s)&&tm(s)?c=e7(s):p?(d=!1,c=e6(l,!0)):f?(d=!1,c=e8(l,!0)):c=[]:e_(l)||tu(l)?(c=s,tu(s))?c=tP(s,tA(s)):(!eR(s)||eT(s))&&(c=ta(l)):d=!1}d&&(i.set(l,c),a(c,l,n,o,i),i.delete(l)),eQ(e,r,c)},tF=function e(t,r,n,a,o){t!==r&&e0(r,function(i,s){if(o||(o=new eq),eR(i))tL(t,r,s,n,e,a,o);else{var l=a?a(tS(t,s),i,s+"",t,r,o):void 0;void 0===l&&(l=i),eQ(t,s,l)}},tA)},tB=function(e){return e},tV=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 tU=Math.max;let tW=function(e,t,r){return t=tU(void 0===t?e.length-1:t,0),function(){for(var n=arguments,a=-1,o=tU(n.length-t,0),i=Array(o);++a<o;)i[a]=n[t+a];a=-1;for(var s=Array(t+1);++a<t;)s[a]=n[a];return s[t]=r(i),tV(e,this,s)}};var tH=Date.now,tz=(Z=eJ?function(e,t){return eJ(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:tB,Y=0,q=0,function(){var e=tH(),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 tK=function(e,t,r){if(!eR(r))return!1;var n=typeof t;return("number"==n?!!(tm(r)&&tO(t,r.length)):"string"==n&&t in r)&&eS(r[t],e)},tG=function(e){var t;return tz(tW(t=function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&tK(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),t=Object(t);++n<a;){var s=r[n];s&&e(t,s,n,o)}return t},void 0,tB),t+"")};var tZ=tG(function(e,t,r,n){tF(e,t,r,n)});function tY(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new eY;++t<r;)this.add(e[t])}tY.prototype.add=tY.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tY.prototype.has=function(e){return this.__data__.has(e)};let tq=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},tJ=function(e,t,r,n,a,o){var i=1&r,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,m=!0,p=2&r?new tY:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var f=e[d],h=t[d];if(n)var g=i?n(h,f,d,t,e,o):n(f,h,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(p){if(!tq(t,function(e,t){if(!p.has(t)&&(f===e||a(f,e,r,n,o)))return p.push(t)})){m=!1;break}}else if(!(f===h||a(f,h,r,n,o))){m=!1;break}}return o.delete(e),o.delete(t),m},tX=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r},tQ=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r};var t0=el?el.prototype:void 0,t1=t0?t0.valueOf:void 0;let t4=function(e,t,r,n,a,o,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||!o(new e5(e),new e5(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return eS(+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=tX;case"[object Set]":var l=1&n;if(s||(s=tQ),e.size!=t.size&&!l)break;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var c=tJ(s(e),s(t),n,a,o,i);return i.delete(e),c;case"[object Symbol]":if(t1)return t1.call(e)==t1.call(t)}return!1},t2=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},t3=function(e,t,r){var n=t(e);return tc(e)?n:t2(n,r(e))},t6=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,o=[];++r<n;){var i=e[r];t(i,r,e)&&(o[a++]=i)}return o},t5=function(){return[]};var t9=Object.prototype.propertyIsEnumerable,t8=Object.getOwnPropertySymbols,t7=t8?function(e){return null==e?[]:t6(t8(e=Object(e)),function(t){return t9.call(e,t)})}:t5,re=ey(Object.keys,Object),rt=Object.prototype.hasOwnProperty;let rr=function(e){if(!tn(e))return re(e);var t=[];for(var r in Object(e))rt.call(e,r)&&"constructor"!=r&&t.push(r);return t},rn=function(e){return tm(e)?tN(e):rr(e)},ra=function(e){return t3(e,rn,t7)};var ro=Object.prototype.hasOwnProperty;let ri=function(e,t,r,n,a,o){var i=1&r,s=ra(e),l=s.length;if(l!=ra(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:ro.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=i;++u<l;){var h=e[c=s[u]],g=t[c];if(n)var y=i?n(g,h,c,t,e,o):n(h,g,c,e,t,o);if(!(void 0===y?h===g||a(h,g,r,n,o):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){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 o.delete(e),o.delete(t),p};var rs=eV(es,"DataView"),rl=eV(es,"Promise"),ru=eV(es,"Set"),rc=eV(es,"WeakMap"),rd="[object Map]",rm="[object Promise]",rp="[object Set]",rf="[object WeakMap]",rh="[object DataView]",rg=eI(rs),ry=eI(eU),rv=eI(rl),rb=eI(ru),rw=eI(rc),rE=eg;(rs&&rE(new rs(new ArrayBuffer(1)))!=rh||eU&&rE(new eU)!=rd||rl&&rE(rl.resolve())!=rm||ru&&rE(new ru)!=rp||rc&&rE(new rc)!=rf)&&(rE=function(e){var t=eg(e),r="[object Object]"==t?e.constructor:void 0,n=r?eI(r):"";if(n)switch(n){case rg:return rh;case ry:return rd;case rv:return rm;case rb:return rp;case rw:return rf}return t});let rD=rE;var rx="[object Arguments]",r_="[object Array]",rS="[object Object]",rC=Object.prototype.hasOwnProperty;let rk=function(e,t,r,n,a,o){var i=tc(e),s=tc(t),l=i?r_:rD(e),u=s?r_:rD(t);l=l==rx?rS:l,u=u==rx?rS:u;var c=l==rS,d=u==rS,m=l==u;if(m&&tg(e)){if(!tg(t))return!1;i=!0,c=!1}if(m&&!c)return o||(o=new eq),i||t_(e)?tJ(e,t,r,n,a,o):t4(e,t,l,r,n,a,o);if(!(1&r)){var p=c&&rC.call(e,"__wrapped__"),f=d&&rC.call(t,"__wrapped__");if(p||f){var h=p?e.value():e,g=f?t.value():t;return o||(o=new eq),a(h,g,r,n,o)}}return!!m&&(o||(o=new eq),ri(e,t,r,n,a,o))},rP=function(e,t){return function e(t,r,n,a,o){return t===r||(null!=t&&null!=r&&(eb(t)||eb(r))?rk(t,r,n,a,e,o):t!=t&&r!=r)}(e,t)},rR=function(e,t){for(var r=-1,n=null==e?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a},rT=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e};var rO=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)t2(t,t7(e)),e=ev(e);return t}:t5;let r$=function(e){return t3(e,tA,rO)};var rN=Object.prototype.hasOwnProperty;let rI=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&rN.call(e,"index")&&(r.index=e.index,r.input=e.input),r},rM=function(e,t){var r=t?e9(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)};var rj=/\w*$/;let rA=function(e){var t=new e.constructor(e.source,rj.exec(e));return t.lastIndex=e.lastIndex,t};var rL=el?el.prototype:void 0,rF=rL?rL.valueOf:void 0;let rB=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return e9(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return rM(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 e8(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 rA(e);case"[object Symbol]":return rF?Object(rF.call(e)):{}}};var rV=tD&&tD.isMap,rU=rV?tv(rV):function(e){return eb(e)&&"[object Map]"==rD(e)},rW=tD&&tD.isSet,rH=rW?tv(rW):function(e){return eb(e)&&"[object Set]"==rD(e)},rz="[object Arguments]",rK="[object Function]",rG="[object Object]",rZ={};rZ[rz]=rZ["[object Array]"]=rZ["[object ArrayBuffer]"]=rZ["[object DataView]"]=rZ["[object Boolean]"]=rZ["[object Date]"]=rZ["[object Float32Array]"]=rZ["[object Float64Array]"]=rZ["[object Int8Array]"]=rZ["[object Int16Array]"]=rZ["[object Int32Array]"]=rZ["[object Map]"]=rZ["[object Number]"]=rZ[rG]=rZ["[object RegExp]"]=rZ["[object Set]"]=rZ["[object String]"]=rZ["[object Symbol]"]=rZ["[object Uint8Array]"]=rZ["[object Uint8ClampedArray]"]=rZ["[object Uint16Array]"]=rZ["[object Uint32Array]"]=!0,rZ["[object Error]"]=rZ[rK]=rZ["[object WeakMap]"]=!1;let rY=function e(t,r,n,a,o,i){var s,l=1&r,u=2&r,c=4&r;if(n&&(s=o?n(t,a,o,i):n(t)),void 0!==s)return s;if(!eR(t))return t;var d=tc(t);if(d){if(s=rI(t),!l)return e7(t,s)}else{var m,p,f,h,g=rD(t),y=g==rK||"[object GeneratorFunction]"==g;if(tg(t))return e6(t,l);if(g==rG||g==rz||y&&!o){if(s=u||y?{}:ta(t),!l)return u?(p=(m=s)&&tP(t,tA(t),m),tP(t,rO(t),p)):(h=(f=s)&&tP(t,rn(t),f),tP(t,t7(t),h))}else{if(!rZ[g])return o?t:{};s=rB(t,g,l)}}i||(i=new eq);var v=i.get(t);if(v)return v;i.set(t,s),rH(t)?t.forEach(function(a){s.add(e(a,r,n,a,t,i))}):rU(t)&&t.forEach(function(a,o){s.set(o,e(a,r,n,o,t,i))});var b=c?u?r$:ra:u?tA:rn,w=d?void 0:b(t);return rT(w||t,function(a,o){w&&(a=t[o=a]),tk(s,o,e(a,r,n,o,t,i))}),s},rq=function(e){return"symbol"==typeof e||eb(e)&&"[object Symbol]"==eg(e)};var rJ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rX=/^\w*$/;let rQ=function(e,t){if(tc(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||rq(e))||rX.test(e)||!rJ.test(e)||null!=t&&e in Object(t)};function r0(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=r.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return r.cache=o.set(a,i)||o,i};return r.cache=new(r0.Cache||eY),r}r0.Cache=eY;var r1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r4=/\\(\\)?/g,r2=(X=(J=r0(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(r1,function(e,r,n,a){t.push(n?a.replace(r4,"$1"):r||e)}),t},function(e){return 500===X.size&&X.clear(),e})).cache,J),r3=1/0,r6=el?el.prototype:void 0,r5=r6?r6.toString:void 0;let r9=function e(t){if("string"==typeof t)return t;if(tc(t))return rR(t,e)+"";if(rq(t))return r5?r5.call(t):"";var r=t+"";return"0"==r&&1/t==-r3?"-0":r},r8=function(e,t){return tc(e)?e:rQ(e,t)?[e]:r2(null==e?"":r9(e))},r7=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var ne=1/0;let nt=function(e){if("string"==typeof e||rq(e))return e;var t=e+"";return"0"==t&&1/e==-ne?"-0":t},nr=function(e,t){t=r8(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[nt(t[r++])];return r&&r==n?e:void 0},nn=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(a);++n<a;)o[n]=e[n+t];return o};var na=Object.prototype.hasOwnProperty;let no=function(e,t){t=r8(t,e);var r,n=-1,a=t.length;if(!a)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<a;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!na.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<a&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=(r=t).length<2?e:nr(e,nn(r,0,-1));return null==s||delete s[nt(r7(t))]},ni=function(e){return e_(e)?void 0:e};var ns=el?el.isConcatSpreadable:void 0;let nl=function(e){return tc(e)||tu(e)||!!(ns&&e&&e[ns])},nu=function e(t,r,n,a,o){var i=-1,s=t.length;for(n||(n=nl),o||(o=[]);++i<s;){var l=t[i];r>0&&n(l)?r>1?e(l,r-1,n,a,o):t2(o,l):a||(o[o.length]=l)}return o};var nc=tz(tW(Q=function(e,t){var r={};if(null==e)return r;var n=!1;t=rR(t,function(t){return t=r8(t,e),n||(n=t.length>1),t}),tP(e,r$(e),r),n&&(r=rY(r,7,ni));for(var a=t.length;a--;)no(r,t[a]);return r},void 0,function(e){return(null==e?0:e.length)?nu(e,1):[]}),Q+""),nd=((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 nm(e,t){return r=>{if(!e(r))if("function"==typeof t)return t(r);else return t}}let np=nm(e=>Array.isArray(e),"must be an array"),nf=nm(e=>"boolean"==typeof e,"must be a boolean"),nh=nm(e=>"number"==typeof e,"must be a number"),ng=nm(e=>"string"==typeof e,"must be a string"),ny=nm(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),nv=nm(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"),nb=B("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{}}),nw=B("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});nw.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let nE=B("config-store-of-extension-state",{mountedExtensions:[]});function nD(e){return W(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function nx(){return W("config-extension-slots",{slots:{}})}function n_(e){return nS(nx().getState(),e)}function nS(e,t){return e.slots[t]??{loaded:!1,config:{}}}function nC(){return W("config-extensions",{configs:{}})}function nk(e,t,r){return e.configs[t]?.[r]??{loaded:!1,config:null}}function nP(e,t,r){return e.configure?.[r]??null}let nR=I()(()=>({config:{}})),nT=0,nO=!0,n$=!1;function nN(e){n=e}function nI(){nO=!0,nT>0&&nM()}function nM(){if(nO&&n&&!n$){n$=!0,nO=!1;try{n()}catch(e){nO=!0,nj(e),console.error("Failed to derive the implementer tools config",e)}finally{n$=!1}}}function nj(e){nR.setState({derivationError:e instanceof Error?e.message:String(e)})}function nA(){nR.getState().derivationError&&nR.setState({derivationError:void 0})}let nL=U("config-implementer-tools",{...nR,getState:()=>(0===nT&&nM(),nR.getState()),setState:(...e)=>(nO=!1,nR.setState(...e)),subscribe(e){nT++,nM();let t=nR.subscribe(e),r=!1;return()=>{!r&&(r=!0,nT--),t()}}});function nF(e,t){if(Array.isArray(t))return t}function nB(e,t){return tZ({},e,t,nF)}let nV=[],nU=new Set,nW=null,nH=new WeakMap;function nz(){n=()=>{var e,t;let r,n;return e=nb.getState(),t=nw.getState(),r=nL.getState(),n={config:function(e,t){let r=function(e){let t={};for(let[r,n]of Object.entries(e)){let e=n9.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"}:al(t)?Object.keys(t).reduce((r,n)=>(r[n]=e(t[n]),r),{}):{}}(rY(n,5));n9.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"]],a=new Set(Object.keys(r));for(let[e]of n)for(let t of Object.keys(e))a.add(t);let o={};for(let e of a){let t=r[e],a=n.map(([t])=>t[e]),i=n.map(([,e])=>e),s=n5.get(e);if(s&&s.annotatedSchema===t&&s.configSlices.length===a.length&&s.configSlices.every((e,t)=>e===a[t])&&s.sources.every((e,t)=>e===i[t])){o[e]=s.result;continue}let l=t??{};n.forEach(([,e],t)=>{let r=a[t];void 0!==r&&(l=nB(l,function e(t,r){return al(t)?Object.keys(t).reduce((n,a)=>(n[a]=e(t[a],r),n),{}):{_value:t,_source:r}}(r,e)))}),n5.set(e,{annotatedSchema:t,configSlices:a,sources:i,result:l}),o[e]=l}return o}(e,t)},void(rP(r.config,n.config)||nL.setState(n))},nK(),nV.push(nb.subscribe(nK),nw.subscribe(nK),nE.subscribe(nK))}function nK(){nA();try{!function(){let e=nb.getState(),t=nw.getState(),r=nE.getState();if(nW?.configState===e&&nW.tempConfigState===t)return nZ(e,r,t,nW.slotConfigs,!0);!function(e,t){for(let r of Object.keys(e.schemas)){let n,a=nD(r),o=e.schemas[r],i=!!e.moduleLoaded[r],s=nG.get(r);if(s&&s.schema===o&&s.moduleLoaded===i&&s.providedConfigs===e.providedConfigs&&s.temporaryConfig===t.config)n=s.state;else{let a=i?function(e,t,r){let n=t.schemas[e],a=ae(e,n8(t,r));ar(n,a,e);let o=ai(n,a);return an(n,o,e),delete o.extensionSlots,o}(r,e,t):function(e,t,r){let n=ai(ap,ae(e,n8(t,r)));return an(ap,n,e),delete n.extensionSlots,n}(r,e,t);n={translationOverridesLoaded:!0,loaded:i,config:a},nG.set(r,{schema:o,moduleLoaded:i,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:n})}let l=a.getState();l.loaded===n.loaded&&l.translationOverridesLoaded===n.translationOverridesLoaded&&rP(l.config,n.config)||a.setState(n)}}(e,t);let n=function(e,t){let r=at(n8(e,t)),n=Object.keys(r).reduce((e,t)=>(r[t]?.extensionSlots&&(e[t]=r[t]?.extensionSlots),e),{});var a=n;for(let[e,t]of Object.entries(a))for(let[r,n]of Object.entries(t))!function(e,t,r){let n=`${t}.extensionSlots.${r}`,a=`Extension slot config '${n}'`,o=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));o.length&&au(n,a+`' contains invalid keys '${o.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||au(n,a+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||au(n,a+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||au(n,a+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!al(e.configure)&&au(n,a+".configure' is invalid. Must be an object with extension IDs for keys")}(n,e,r);let o={},i={};for(let e of Object.values(n))for(let[t,r]of Object.entries(e))o[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]:at(t);o[e].configure!==r&&(o[e]={...o[e],configure:r})}return o}(e,t);(function(e){let t=nx(),r=t.getState().slots,n={},a=!1;for(let[t,o]of Object.entries(e)){let e=r[t];e?.loaded&&rP(e.config,o)?n[t]=e:(n[t]={loaded:!0,config:o},a=!0)}(a||Object.keys(r).length!==Object.keys(n).length)&&t.setState({slots:n})})(n),nZ(e,r,t,n,!1),nW={configState:e,tempConfigState:t,slotConfigs:n},nI()}()}catch(e){nj(e),console.error("Failed to recompute the configuration",e)}}nz();let nG=new Map;function nZ(e,t,r,n,a){let o=nC(),i=o.getState().configs,s={},l=!1,u=0;for(let o of t.mountedExtensions){let t,c=i[o.slotName]?.[o.extensionId],d=c&&nH.get(c);if(a&&c?.loaded&&d?.slotModuleName===o.slotModuleName&&d.extensionModuleName===o.extensionModuleName)t=c;else{let a=function(e,t,r,n,a,o,i){let s=function(e){let[t]=e.split("#");return t}(n),l=a.schemas[s],u=JSON.stringify([r,n,e,t]),c=n6.get(u);if(c&&c.extensionSchema===l&&c.extensionModuleSchema===a.schemas[t]&&c.providedConfigs===a.providedConfigs&&c.temporaryConfig===o.config)return c.config;let d=l?s:t,m=n8(a,o),p=i?.configure?.[n]??{},f=ae(e,m),h=f?.extensionSlots?.[r]?.configure?.[n]??{},g=at([ae(d,m),p,h]),y=l??a.schemas[t];ar(y,g,d);let v=ai(y,g);return an(y,v,d),delete v.extensionSlots,n6.set(u,{extensionSchema:l,extensionModuleSchema:a.schemas[t],providedConfigs:a.providedConfigs,temporaryConfig:o.config,config:v}),v}(o.slotModuleName,o.extensionModuleName,o.slotName,o.extensionId,e,r,n[o.slotName]);t=c?.loaded&&rP(c.config,a)?c:{config:a,loaded:!0}}nH.set(t,o),t!==c&&(l=!0),s[o.slotName]||(s[o.slotName]={}),s[o.slotName][o.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&&o.setState({configs:s})}function nY(e,t){n7(e,t);let r=nB(t,ap);nb.setState(t=>({...t,schemas:{...t.schemas,[e]:r},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nq(e){nb.setState(t=>({...t,schemas:{...t.schemas,[e]:ap}}))}function nJ(e){nb.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nX(e){nb.setState(t=>({...t,schemas:{...t.schemas,[e]:am}}))}function nQ(e,t){n7(e,t);let r=nB(t,ap);nb.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.`),nb.setState(t=>({...t,schemas:{...t.schemas,[e]:r}}))}function n0(e,t="provided"){nb.setState(r=>({...r,providedConfigs:[...r.providedConfigs,{source:t,config:e}]}))}function n1(e,t,r){return new Promise(n=>{let a,o=!1;function i(e){!o&&t(e)&&(o=!0,n(r(e)),a?.())}i(e.getState()),o||(a=e.subscribe(i))})}function n4(e){return n1(nD(e),e=>!!(e.loaded&&e.config),e=>nc(e.config,["Display conditions","Translation overrides"]))}function n2(e,t,r){let n=[e in nb.getState().schemas?n1(nD(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&r){let e=nk(nC().getState(),t,r),a=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};n.push(Promise.resolve(a))}return Promise.all(n)}function n3(e,t,r){ar(e,t,r);let n=ai(e,t);return an(e,n,r),n}let n6=new Map,n5=new Map,n9=new Map;function n8(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function n7(e,t,r=""){let n="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let a of Object.keys(t).filter(e=>!e.startsWith("_"))){let o=r+(r&&".")+a,i=t[a];if("Display conditions"===o&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${n}`),"Translation overrides"===o&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${n}`),!al(i)){console.error(`${e} has bad config schema definition for key '${o}'. ${n}`);continue}i.hasOwnProperty("_default")||n7(e,i,o);let s=i._elements;if(as(s)&&n7(e,s,o+"._elements"),i._validators)for(let t of i._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${o}' ${n}.
3
+ ${e.stack}`,k(t)}}function R(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 T(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 O(e,t){let r;try{r=e()}catch(e){return}return{getItem:e=>{var n;let a=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),o=null!=(n=r.getItem(e))?n:null;return o instanceof Promise?o.then(a):a(o)},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,a){return console.error("Unexpected error: ",a??e),E({description:C(a,"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 $=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>$(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>$(t)(e)}}},N=e=>{let t,r=new Set,n=(e,n)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=n?n:"object"!=typeof a||null===a)?a:Object.assign({},t,a),r.forEach(r=>r(t,e))}},a=()=>t,o={setState:n,getState:a,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,a,o);return o},I=e=>e?N(e):N;function M(){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 j={},A=Symbol.for("openmrs.esm-state.instanceCount"),L=globalThis,F=(L[A]??0)+1;function B(e,t,r="none"){let n=j[e];if(n)return n.active?M()||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 j[e]={value:n,active:!0},n}}function V(e){return I()(()=>e)}function U(e,t){let r=j[e];return r?(r.active?M()||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):(j[e]={value:t,active:!0},t)}function W(e,t,r="none"){let n=j[e];if(!n){let n=z(e,t??{},r);return j[e]={value:n,active:!1},n}return n.value}function H(...e){let[t,r,n]=e,a=void 0===n?r:n,o=void 0===n?e=>e:r,i=o(t.getState());return a(i),t.subscribe(e=>{let t=o(e);T(i,t)||(i=t,a(t))})}function z(e,t,r){return"sessionStorage"===r?I()(((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,a)=>{let o,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{o=s.getStorage()}catch(e){}if(!o)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...e)},n,a);let d=$(s.serialize),m=()=>{let e,t=d({state:s.partialize({...n()}),version:s.version}).then(e=>o.setItem(s.name,e)).catch(t=>{e=t});if(e)throw e;return t},p=a.setState;a.setState=(e,t)=>{p(e,t),m()};let f=e((...e)=>{r(...e),m()},n,a),h=()=>{var e;if(!o)return;l=!1,u.forEach(e=>e(n()));let t=(null==(e=s.onRehydrateStorage)?void 0:e.call(s,n()))||void 0;return $(o.getItem.bind(o))(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:f),!0),m()}).then(()=>{null==t||t(i,void 0),l=!0,c.forEach(e=>e(i))}).catch(e=>{null==t||t(void 0,e)})};return a.persist={setOptions:e=>{s={...s,...e},e.getStorage&&(o=e.getStorage())},clearStorage:()=>{null==o||o.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||f};return(r,n,a)=>{let o,i={storage:O(()=>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,a);let d=()=>{let e=i.partialize({...n()});return c.setItem(i.name,{state:e,version:i.version})},m=a.setState;a.setState=(e,t)=>{m(e,t),d()};let p=e((...e)=>{r(...e),d()},n,a);a.getInitialState=()=>p;let f=()=>{var e,t;if(!c)return;s=!1,l.forEach(e=>{var t;return e(null!=(t=n())?t:p)});let a=(null==(t=i.onRehydrateStorage)?void 0:t.call(i,null!=(e=n())?e:p))||void 0;return $(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[a,s]=e;if(r(o=i.merge(s,null!=(t=n())?t:p),!0),a)return d()}).then(()=>{null==a||a(o,void 0),o=n(),s=!0,u.forEach(e=>e(o))}).catch(e=>{null==a||a(void 0,e)})};return a.persist={setOptions:e=>{i={...i,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>f(),hasHydrated:()=>s,onHydrate:e=>(l.add(e),()=>{l.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},i.skipHydration||f(),o||p}})(()=>t,{name:e,storage:O(()=>sessionStorage)})):I()(()=>t)}L[A]=F,F>1&&!M()&&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=j)},1e3);let K=function(e){return void 0===e};var G,Z,Y,q,J,X,Q,ee,et,er,en,ea,eo="object"==typeof global&&global&&global.Object===Object&&global,ei="object"==typeof self&&self&&self.Object===Object&&self,es=eo||ei||Function("return this")(),el=es.Symbol,eu=Object.prototype,ec=eu.hasOwnProperty,ed=eu.toString,em=el?el.toStringTag:void 0;let ep=function(e){var t=ec.call(e,em),r=e[em];try{e[em]=void 0;var n=!0}catch(e){}var a=ed.call(e);return n&&(t?e[em]=r:delete e[em]),a};var ef=Object.prototype.toString,eh=el?el.toStringTag:void 0;let eg=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":eh&&eh in Object(e)?ep(e):ef.call(e)},ey=function(e,t){return function(r){return e(t(r))}};var ev=ey(Object.getPrototypeOf,Object);let eb=function(e){return null!=e&&"object"==typeof e};var ew=Object.prototype,eE=Function.prototype.toString,eD=ew.hasOwnProperty,ex=eE.call(Object);let e_=function(e){if(!eb(e)||"[object Object]"!=eg(e))return!1;var t=ev(e);if(null===t)return!0;var r=eD.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&eE.call(r)==ex},eS=function(e,t){return e===t||e!=e&&t!=t},eC=function(e,t){for(var r=e.length;r--;)if(eS(e[r][0],t))return r;return -1};var ek=Array.prototype.splice;function eP(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])}}eP.prototype.clear=function(){this.__data__=[],this.size=0},eP.prototype.delete=function(e){var t=this.__data__,r=eC(t,e);return!(r<0)&&(r==t.length-1?t.pop():ek.call(t,r,1),--this.size,!0)},eP.prototype.get=function(e){var t=this.__data__,r=eC(t,e);return r<0?void 0:t[r][1]},eP.prototype.has=function(e){return eC(this.__data__,e)>-1},eP.prototype.set=function(e,t){var r=this.__data__,n=eC(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};let eR=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eT=function(e){if(!eR(e))return!1;var t=eg(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var eO=es["__core-js_shared__"],e$=(G=/[^.]+$/.exec(eO&&eO.keys&&eO.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",eN=Function.prototype.toString;let eI=function(e){if(null!=e){try{return eN.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var eM=/^\[object .+?Constructor\]$/,ej=Object.prototype,eA=Function.prototype.toString,eL=ej.hasOwnProperty,eF=RegExp("^"+eA.call(eL).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eB=function(e){return!!eR(e)&&(!e$||!(e$ in e))&&(eT(e)?eF:eM).test(eI(e))},eV=function(e,t){var r=null==e?void 0:e[t];return eB(r)?r:void 0};var eU=eV(es,"Map"),eW=eV(Object,"create"),eH=Object.prototype.hasOwnProperty,ez=Object.prototype.hasOwnProperty;function eK(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])}}eK.prototype.clear=function(){this.__data__=eW?eW(null):{},this.size=0},eK.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},eK.prototype.get=function(e){var t=this.__data__;if(eW){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return eH.call(t,e)?t[e]:void 0},eK.prototype.has=function(e){var t=this.__data__;return eW?void 0!==t[e]:ez.call(t,e)},eK.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=eW&&void 0===t?"__lodash_hash_undefined__":t,this};let eG=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eZ=function(e,t){var r=e.__data__;return eG(t)?r["string"==typeof t?"string":"hash"]:r.map};function eY(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 eq(e){var t=this.__data__=new eP(e);this.size=t.size}eY.prototype.clear=function(){this.size=0,this.__data__={hash:new eK,map:new(eU||eP),string:new eK}},eY.prototype.delete=function(e){var t=eZ(this,e).delete(e);return this.size-=!!t,t},eY.prototype.get=function(e){return eZ(this,e).get(e)},eY.prototype.has=function(e){return eZ(this,e).has(e)},eY.prototype.set=function(e,t){var r=eZ(this,e),n=r.size;return r.set(e,t),this.size+=+(r.size!=n),this},eq.prototype.clear=function(){this.__data__=new eP,this.size=0},eq.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},eq.prototype.get=function(e){return this.__data__.get(e)},eq.prototype.has=function(e){return this.__data__.has(e)},eq.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eP){var n=r.__data__;if(!eU||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new eY(n)}return r.set(e,t),this.size=r.size,this};var eJ=function(){try{var e=eV(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let eX=function(e,t,r){"__proto__"==t&&eJ?eJ(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},eQ=function(e,t,r){(void 0===r||eS(e[t],r))&&(void 0!==r||t in e)||eX(e,t,r)},e0=function(e,t,r){for(var n=-1,a=Object(e),o=r(e),i=o.length;i--;){var s=o[++n];if(!1===t(a[s],s,a))break}return e};var e1="object"==typeof exports&&exports&&!exports.nodeType&&exports,e4=e1&&"object"==typeof module&&module&&!module.nodeType&&module,e2=e4&&e4.exports===e1?es.Buffer:void 0,e3=e2?e2.allocUnsafe:void 0;let e6=function(e,t){if(t)return e.slice();var r=e.length,n=e3?e3(r):new e.constructor(r);return e.copy(n),n};var e5=es.Uint8Array;let e9=function(e){var t=new e.constructor(e.byteLength);return new e5(t).set(new e5(e)),t},e8=function(e,t){var r=t?e9(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},e7=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t};var te=Object.create,tt=function(){function e(){}return function(t){if(!eR(t))return{};if(te)return te(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),tr=Object.prototype;let tn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tr)},ta=function(e){return"function"!=typeof e.constructor||tn(e)?{}:tt(ev(e))},to=function(e){return eb(e)&&"[object Arguments]"==eg(e)};var ti=Object.prototype,ts=ti.hasOwnProperty,tl=ti.propertyIsEnumerable,tu=to(function(){return arguments}())?to:function(e){return eb(e)&&ts.call(e,"callee")&&!tl.call(e,"callee")},tc=Array.isArray;let td=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},tm=function(e){return null!=e&&td(e.length)&&!eT(e)};var tp="object"==typeof exports&&exports&&!exports.nodeType&&exports,tf=tp&&"object"==typeof module&&module&&!module.nodeType&&module,th=tf&&tf.exports===tp?es.Buffer:void 0;let tg=(th?th.isBuffer:void 0)||function(){return!1};var ty={};ty["[object Float32Array]"]=ty["[object Float64Array]"]=ty["[object Int8Array]"]=ty["[object Int16Array]"]=ty["[object Int32Array]"]=ty["[object Uint8Array]"]=ty["[object Uint8ClampedArray]"]=ty["[object Uint16Array]"]=ty["[object Uint32Array]"]=!0,ty["[object Arguments]"]=ty["[object Array]"]=ty["[object ArrayBuffer]"]=ty["[object Boolean]"]=ty["[object DataView]"]=ty["[object Date]"]=ty["[object Error]"]=ty["[object Function]"]=ty["[object Map]"]=ty["[object Number]"]=ty["[object Object]"]=ty["[object RegExp]"]=ty["[object Set]"]=ty["[object String]"]=ty["[object WeakMap]"]=!1;let tv=function(e){return function(t){return e(t)}};var tb="object"==typeof exports&&exports&&!exports.nodeType&&exports,tw=tb&&"object"==typeof module&&module&&!module.nodeType&&module,tE=tw&&tw.exports===tb&&eo.process,tD=function(){try{var e=tw&&tw.require&&tw.require("util").types;if(e)return e;return tE&&tE.binding&&tE.binding("util")}catch(e){}}(),tx=tD&&tD.isTypedArray,t_=tx?tv(tx):function(e){return eb(e)&&td(e.length)&&!!ty[eg(e)]};let tS=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var tC=Object.prototype.hasOwnProperty;let tk=function(e,t,r){var n=e[t];tC.call(e,t)&&eS(n,r)&&(void 0!==r||t in e)||eX(e,t,r)},tP=function(e,t,r,n){var a=!r;r||(r={});for(var o=-1,i=t.length;++o<i;){var s=t[o],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),a?eX(r,s,l):tk(r,s,l)}return r},tR=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tT=/^(?:0|[1-9]\d*)$/;let tO=function(e,t){var r=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==r||"symbol"!=r&&tT.test(e))&&e>-1&&e%1==0&&e<t};var t$=Object.prototype.hasOwnProperty;let tN=function(e,t){var r=tc(e),n=!r&&tu(e),a=!r&&!n&&tg(e),o=!r&&!n&&!a&&t_(e),i=r||n||a||o,s=i?tR(e.length,String):[],l=s.length;for(var u in e)(t||t$.call(e,u))&&!(i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||tO(u,l)))&&s.push(u);return s},tI=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t};var tM=Object.prototype.hasOwnProperty;let tj=function(e){if(!eR(e))return tI(e);var t=tn(e),r=[];for(var n in e)"constructor"==n&&(t||!tM.call(e,n))||r.push(n);return r},tA=function(e){return tm(e)?tN(e,!0):tj(e)},tL=function(e,t,r,n,a,o,i){var s=tS(e,r),l=tS(t,r),u=i.get(l);if(u)return void eQ(e,r,u);var c=o?o(s,l,r+"",e,t,i):void 0,d=void 0===c;if(d){var m=tc(l),p=!m&&tg(l),f=!m&&!p&&t_(l);(c=l,m||p||f)?tc(s)?c=s:eb(s)&&tm(s)?c=e7(s):p?(d=!1,c=e6(l,!0)):f?(d=!1,c=e8(l,!0)):c=[]:e_(l)||tu(l)?(c=s,tu(s))?c=tP(s,tA(s)):(!eR(s)||eT(s))&&(c=ta(l)):d=!1}d&&(i.set(l,c),a(c,l,n,o,i),i.delete(l)),eQ(e,r,c)},tF=function e(t,r,n,a,o){t!==r&&e0(r,function(i,s){if(o||(o=new eq),eR(i))tL(t,r,s,n,e,a,o);else{var l=a?a(tS(t,s),i,s+"",t,r,o):void 0;void 0===l&&(l=i),eQ(t,s,l)}},tA)},tB=function(e){return e},tV=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 tU=Math.max;let tW=function(e,t,r){return t=tU(void 0===t?e.length-1:t,0),function(){for(var n=arguments,a=-1,o=tU(n.length-t,0),i=Array(o);++a<o;)i[a]=n[t+a];a=-1;for(var s=Array(t+1);++a<t;)s[a]=n[a];return s[t]=r(i),tV(e,this,s)}};var tH=Date.now,tz=(Z=eJ?function(e,t){return eJ(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:tB,Y=0,q=0,function(){var e=tH(),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 tK=function(e,t,r){if(!eR(r))return!1;var n=typeof t;return("number"==n?!!(tm(r)&&tO(t,r.length)):"string"==n&&t in r)&&eS(r[t],e)},tG=function(e){var t;return tz(tW(t=function(t,r){var n=-1,a=r.length,o=a>1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&tK(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),t=Object(t);++n<a;){var s=r[n];s&&e(t,s,n,o)}return t},void 0,tB),t+"")};var tZ=tG(function(e,t,r,n){tF(e,t,r,n)});function tY(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new eY;++t<r;)this.add(e[t])}tY.prototype.add=tY.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tY.prototype.has=function(e){return this.__data__.has(e)};let tq=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},tJ=function(e,t,r,n,a,o){var i=1&r,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,m=!0,p=2&r?new tY:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var f=e[d],h=t[d];if(n)var g=i?n(h,f,d,t,e,o):n(f,h,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(p){if(!tq(t,function(e,t){if(!p.has(t)&&(f===e||a(f,e,r,n,o)))return p.push(t)})){m=!1;break}}else if(!(f===h||a(f,h,r,n,o))){m=!1;break}}return o.delete(e),o.delete(t),m},tX=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r},tQ=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r};var t0=el?el.prototype:void 0,t1=t0?t0.valueOf:void 0;let t4=function(e,t,r,n,a,o,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||!o(new e5(e),new e5(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return eS(+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=tX;case"[object Set]":var l=1&n;if(s||(s=tQ),e.size!=t.size&&!l)break;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var c=tJ(s(e),s(t),n,a,o,i);return i.delete(e),c;case"[object Symbol]":if(t1)return t1.call(e)==t1.call(t)}return!1},t2=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},t3=function(e,t,r){var n=t(e);return tc(e)?n:t2(n,r(e))},t6=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,o=[];++r<n;){var i=e[r];t(i,r,e)&&(o[a++]=i)}return o},t5=function(){return[]};var t9=Object.prototype.propertyIsEnumerable,t8=Object.getOwnPropertySymbols,t7=t8?function(e){return null==e?[]:t6(t8(e=Object(e)),function(t){return t9.call(e,t)})}:t5,re=ey(Object.keys,Object),rt=Object.prototype.hasOwnProperty;let rr=function(e){if(!tn(e))return re(e);var t=[];for(var r in Object(e))rt.call(e,r)&&"constructor"!=r&&t.push(r);return t},rn=function(e){return tm(e)?tN(e):rr(e)},ra=function(e){return t3(e,rn,t7)};var ro=Object.prototype.hasOwnProperty;let ri=function(e,t,r,n,a,o){var i=1&r,s=ra(e),l=s.length;if(l!=ra(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:ro.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var p=!0;o.set(e,t),o.set(t,e);for(var f=i;++u<l;){var h=e[c=s[u]],g=t[c];if(n)var y=i?n(g,h,c,t,e,o):n(h,g,c,e,t,o);if(!(void 0===y?h===g||a(h,g,r,n,o):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){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 o.delete(e),o.delete(t),p};var rs=eV(es,"DataView"),rl=eV(es,"Promise"),ru=eV(es,"Set"),rc=eV(es,"WeakMap"),rd="[object Map]",rm="[object Promise]",rp="[object Set]",rf="[object WeakMap]",rh="[object DataView]",rg=eI(rs),ry=eI(eU),rv=eI(rl),rb=eI(ru),rw=eI(rc),rE=eg;(rs&&rE(new rs(new ArrayBuffer(1)))!=rh||eU&&rE(new eU)!=rd||rl&&rE(rl.resolve())!=rm||ru&&rE(new ru)!=rp||rc&&rE(new rc)!=rf)&&(rE=function(e){var t=eg(e),r="[object Object]"==t?e.constructor:void 0,n=r?eI(r):"";if(n)switch(n){case rg:return rh;case ry:return rd;case rv:return rm;case rb:return rp;case rw:return rf}return t});let rD=rE;var rx="[object Arguments]",r_="[object Array]",rS="[object Object]",rC=Object.prototype.hasOwnProperty;let rk=function(e,t,r,n,a,o){var i=tc(e),s=tc(t),l=i?r_:rD(e),u=s?r_:rD(t);l=l==rx?rS:l,u=u==rx?rS:u;var c=l==rS,d=u==rS,m=l==u;if(m&&tg(e)){if(!tg(t))return!1;i=!0,c=!1}if(m&&!c)return o||(o=new eq),i||t_(e)?tJ(e,t,r,n,a,o):t4(e,t,l,r,n,a,o);if(!(1&r)){var p=c&&rC.call(e,"__wrapped__"),f=d&&rC.call(t,"__wrapped__");if(p||f){var h=p?e.value():e,g=f?t.value():t;return o||(o=new eq),a(h,g,r,n,o)}}return!!m&&(o||(o=new eq),ri(e,t,r,n,a,o))},rP=function(e,t){return function e(t,r,n,a,o){return t===r||(null!=t&&null!=r&&(eb(t)||eb(r))?rk(t,r,n,a,e,o):t!=t&&r!=r)}(e,t)},rR=function(e,t){for(var r=-1,n=null==e?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a},rT=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e};var rO=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)t2(t,t7(e)),e=ev(e);return t}:t5;let r$=function(e){return t3(e,tA,rO)};var rN=Object.prototype.hasOwnProperty;let rI=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&rN.call(e,"index")&&(r.index=e.index,r.input=e.input),r},rM=function(e,t){var r=t?e9(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)};var rj=/\w*$/;let rA=function(e){var t=new e.constructor(e.source,rj.exec(e));return t.lastIndex=e.lastIndex,t};var rL=el?el.prototype:void 0,rF=rL?rL.valueOf:void 0;let rB=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return e9(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return rM(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 e8(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 rA(e);case"[object Symbol]":return rF?Object(rF.call(e)):{}}};var rV=tD&&tD.isMap,rU=rV?tv(rV):function(e){return eb(e)&&"[object Map]"==rD(e)},rW=tD&&tD.isSet,rH=rW?tv(rW):function(e){return eb(e)&&"[object Set]"==rD(e)},rz="[object Arguments]",rK="[object Function]",rG="[object Object]",rZ={};rZ[rz]=rZ["[object Array]"]=rZ["[object ArrayBuffer]"]=rZ["[object DataView]"]=rZ["[object Boolean]"]=rZ["[object Date]"]=rZ["[object Float32Array]"]=rZ["[object Float64Array]"]=rZ["[object Int8Array]"]=rZ["[object Int16Array]"]=rZ["[object Int32Array]"]=rZ["[object Map]"]=rZ["[object Number]"]=rZ[rG]=rZ["[object RegExp]"]=rZ["[object Set]"]=rZ["[object String]"]=rZ["[object Symbol]"]=rZ["[object Uint8Array]"]=rZ["[object Uint8ClampedArray]"]=rZ["[object Uint16Array]"]=rZ["[object Uint32Array]"]=!0,rZ["[object Error]"]=rZ[rK]=rZ["[object WeakMap]"]=!1;let rY=function e(t,r,n,a,o,i){var s,l=1&r,u=2&r,c=4&r;if(n&&(s=o?n(t,a,o,i):n(t)),void 0!==s)return s;if(!eR(t))return t;var d=tc(t);if(d){if(s=rI(t),!l)return e7(t,s)}else{var m,p,f,h,g=rD(t),y=g==rK||"[object GeneratorFunction]"==g;if(tg(t))return e6(t,l);if(g==rG||g==rz||y&&!o){if(s=u||y?{}:ta(t),!l)return u?(p=(m=s)&&tP(t,tA(t),m),tP(t,rO(t),p)):(h=(f=s)&&tP(t,rn(t),f),tP(t,t7(t),h))}else{if(!rZ[g])return o?t:{};s=rB(t,g,l)}}i||(i=new eq);var v=i.get(t);if(v)return v;i.set(t,s),rH(t)?t.forEach(function(a){s.add(e(a,r,n,a,t,i))}):rU(t)&&t.forEach(function(a,o){s.set(o,e(a,r,n,o,t,i))});var b=c?u?r$:ra:u?tA:rn,w=d?void 0:b(t);return rT(w||t,function(a,o){w&&(a=t[o=a]),tk(s,o,e(a,r,n,o,t,i))}),s},rq=function(e){return"symbol"==typeof e||eb(e)&&"[object Symbol]"==eg(e)};var rJ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rX=/^\w*$/;let rQ=function(e,t){if(tc(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||rq(e))||rX.test(e)||!rJ.test(e)||null!=t&&e in Object(t)};function r0(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=r.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return r.cache=o.set(a,i)||o,i};return r.cache=new(r0.Cache||eY),r}r0.Cache=eY;var r1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r4=/\\(\\)?/g,r2=(X=(J=r0(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(r1,function(e,r,n,a){t.push(n?a.replace(r4,"$1"):r||e)}),t},function(e){return 500===X.size&&X.clear(),e})).cache,J),r3=1/0,r6=el?el.prototype:void 0,r5=r6?r6.toString:void 0;let r9=function e(t){if("string"==typeof t)return t;if(tc(t))return rR(t,e)+"";if(rq(t))return r5?r5.call(t):"";var r=t+"";return"0"==r&&1/t==-r3?"-0":r},r8=function(e,t){return tc(e)?e:rQ(e,t)?[e]:r2(null==e?"":r9(e))},r7=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var ne=1/0;let nt=function(e){if("string"==typeof e||rq(e))return e;var t=e+"";return"0"==t&&1/e==-ne?"-0":t},nr=function(e,t){t=r8(t,e);for(var r=0,n=t.length;null!=e&&r<n;)e=e[nt(t[r++])];return r&&r==n?e:void 0},nn=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(a);++n<a;)o[n]=e[n+t];return o};var na=Object.prototype.hasOwnProperty;let no=function(e,t){t=r8(t,e);var r,n=-1,a=t.length;if(!a)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<a;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!na.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<a&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=(r=t).length<2?e:nr(e,nn(r,0,-1));return null==s||delete s[nt(r7(t))]},ni=function(e){return e_(e)?void 0:e};var ns=el?el.isConcatSpreadable:void 0;let nl=function(e){return tc(e)||tu(e)||!!(ns&&e&&e[ns])},nu=function e(t,r,n,a,o){var i=-1,s=t.length;for(n||(n=nl),o||(o=[]);++i<s;){var l=t[i];r>0&&n(l)?r>1?e(l,r-1,n,a,o):t2(o,l):a||(o[o.length]=l)}return o};var nc=tz(tW(Q=function(e,t){var r={};if(null==e)return r;var n=!1;t=rR(t,function(t){return t=r8(t,e),n||(n=t.length>1),t}),tP(e,r$(e),r),n&&(r=rY(r,7,ni));for(var a=t.length;a--;)no(r,t[a]);return r},void 0,function(e){return(null==e?0:e.length)?nu(e,1):[]}),Q+""),nd=((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 nm(e,t){return r=>{if(!e(r))if("function"==typeof t)return t(r);else return t}}let np=nm(e=>Array.isArray(e),"must be an array"),nf=nm(e=>"boolean"==typeof e,"must be a boolean"),nh=nm(e=>"number"==typeof e,"must be a number"),ng=nm(e=>"string"==typeof e,"must be a string"),ny=nm(e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,"must be an object (not an array or null)"),nv=nm(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"),nb=B("config-internal",{providedConfigs:[],schemas:{},moduleLoaded:{},moduleStarted:{}}),nw=B("temporary-config",{config:function(){try{return JSON.parse(localStorage.getItem("openmrs:temporaryConfig")||"{}")}catch(e){return{}}}()});nw.subscribe(e=>{var t=e.config;try{localStorage.setItem("openmrs:temporaryConfig",JSON.stringify(t))}catch(e){}});let nE=B("config-store-of-extension-state",{mountedExtensions:[]});function nD(e){return W(`config-module-${e}`,{config:null,loaded:!1,translationOverridesLoaded:!1})}function nx(){return W("config-extension-slots",{slots:{}})}function n_(e){return nS(nx().getState(),e)}function nS(e,t){return e.slots[t]??{loaded:!1,config:{}}}function nC(){return W("config-extensions",{configs:{}})}function nk(e,t,r){return e.configs[t]?.[r]??{loaded:!1,config:null}}function nP(e,t,r){return e.configure?.[r]??null}let nR=I()(()=>({config:{}})),nT=0,nO=!0,n$=!1;function nN(e){n=e}function nI(){nO=!0,nT>0&&nM()}function nM(){if(nO&&n&&!n$){n$=!0,nO=!1;try{n()}catch(e){nO=!0,nj(e),console.error("Failed to derive the implementer tools config",e)}finally{n$=!1}}}function nj(e){nR.setState({derivationError:e instanceof Error?e.message:String(e)})}function nA(){nR.getState().derivationError&&nR.setState({derivationError:void 0})}let nL=U("config-implementer-tools",{...nR,getState:()=>(0===nT&&nM(),nR.getState()),setState:(...e)=>(nO=!1,nR.setState(...e)),subscribe(e){nT++,nM();let t=nR.subscribe(e),r=!1;return()=>{!r&&(r=!0,nT--),t()}}});function nF(e,t){if(Array.isArray(t))return t}function nB(e,t){return tZ({},e,t,nF)}let nV=[],nU=new Set,nW=null,nH=new WeakMap;function nz(){n=()=>{var e,t;let r,n;return e=nb.getState(),t=nw.getState(),r=nL.getState(),n={config:function(e,t){let r=function(e){let t={};for(let[r,n]of Object.entries(e)){let e=n9.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"}:al(t)?Object.keys(t).reduce((r,n)=>(r[n]=e(t[n]),r),{}):{}}(rY(n,5));n9.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"]],a=new Set(Object.keys(r));for(let[e]of n)for(let t of Object.keys(e))a.add(t);let o={};for(let e of a){let t=r[e],a=n.map(([t])=>t[e]),i=n.map(([,e])=>e),s=n5.get(e);if(s&&s.annotatedSchema===t&&s.configSlices.length===a.length&&s.configSlices.every((e,t)=>e===a[t])&&s.sources.every((e,t)=>e===i[t])){o[e]=s.result;continue}let l=t??{};n.forEach(([,e],t)=>{let r=a[t];void 0!==r&&(l=nB(l,function e(t,r){return al(t)?Object.keys(t).reduce((n,a)=>(n[a]=e(t[a],r),n),{}):{_value:t,_source:r}}(r,e)))}),n5.set(e,{annotatedSchema:t,configSlices:a,sources:i,result:l}),o[e]=l}return o}(e,t)},void(rP(r.config,n.config)||nL.setState(n))},nK(),nV.push(nb.subscribe(nK),nw.subscribe(nK),nE.subscribe(nK))}function nK(){nA();try{!function(){let e=nb.getState(),t=nw.getState(),r=nE.getState();if(nW?.configState===e&&nW.tempConfigState===t)return nZ(e,r,t,nW.slotConfigs,!0);!function(e,t){for(let r of Object.keys(e.schemas)){let n,a=nD(r),o=e.schemas[r],i=!!e.moduleLoaded[r],s=nG.get(r);if(s&&s.schema===o&&s.moduleLoaded===i&&s.providedConfigs===e.providedConfigs&&s.temporaryConfig===t.config)n=s.state;else{let a=i?function(e,t,r){let n=t.schemas[e],a=ae(e,n8(t,r));ar(n,a,e);let o=ai(n,a);return an(n,o,e),delete o.extensionSlots,o}(r,e,t):function(e,t,r){let n=ai(ap,ae(e,n8(t,r)));return an(ap,n,e),delete n.extensionSlots,n}(r,e,t);n={translationOverridesLoaded:!0,loaded:i,config:a},nG.set(r,{schema:o,moduleLoaded:i,providedConfigs:e.providedConfigs,temporaryConfig:t.config,state:n})}let l=a.getState();l.loaded===n.loaded&&l.translationOverridesLoaded===n.translationOverridesLoaded&&rP(l.config,n.config)||a.setState(n)}}(e,t);let n=function(e,t){let r=at(n8(e,t)),n=Object.keys(r).reduce((e,t)=>(r[t]?.extensionSlots&&(e[t]=r[t]?.extensionSlots),e),{});var a=n;for(let[e,t]of Object.entries(a))for(let[r,n]of Object.entries(t))!function(e,t,r){let n=`${t}.extensionSlots.${r}`,a=`Extension slot config '${n}'`,o=Object.keys(e).filter(e=>!["add","remove","order","configure"].includes(e));o.length&&au(n,a+`' contains invalid keys '${o.join("', '")}'`),!e.add||Array.isArray(e.add)&&e.add.every(e=>"string"==typeof e)||au(n,a+".add' is invalid. Must be an array of strings (extension IDs)"),!e.remove||Array.isArray(e.remove)&&e.remove.every(e=>"string"==typeof e)||au(n,a+".remove' is invalid. Must be an array of strings (extension IDs)"),!e.order||Array.isArray(e.order)&&e.order.every(e=>"string"==typeof e)||au(n,a+".order' is invalid. Must be an array of strings (extension IDs)"),e.configure&&!al(e.configure)&&au(n,a+".configure' is invalid. Must be an object with extension IDs for keys")}(n,e,r);let o={},i={};for(let e of Object.values(n))for(let[t,r]of Object.entries(e))o[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]:at(t);o[e].configure!==r&&(o[e]={...o[e],configure:r})}return o}(e,t);(function(e){let t=nx(),r=t.getState().slots,n={},a=!1;for(let[t,o]of Object.entries(e)){let e=r[t];e?.loaded&&rP(e.config,o)?n[t]=e:(n[t]={loaded:!0,config:o},a=!0)}(a||Object.keys(r).length!==Object.keys(n).length)&&t.setState({slots:n})})(n),nZ(e,r,t,n,!1),nW={configState:e,tempConfigState:t,slotConfigs:n},nI()}()}catch(e){nj(e),console.error("Failed to recompute the configuration",e)}}nz();let nG=new Map;function nZ(e,t,r,n,a){let o=nC(),i=o.getState().configs,s={},l=!1,u=0;for(let o of t.mountedExtensions){let t,c=i[o.slotName]?.[o.extensionId],d=c&&nH.get(c);if(a&&c?.loaded&&d?.slotModuleName===o.slotModuleName&&d.extensionModuleName===o.extensionModuleName)t=c;else{let a=function(e,t,r,n,a,o,i){let s=function(e){let[t]=e.split("#");return t}(n),l=a.schemas[s],u=!!a.moduleStarted[t],c=JSON.stringify([r,n,e,t]),d=n6.get(c);if(d&&d.extensionSchema===l&&d.extensionModuleSchema===a.schemas[t]&&d.extensionModuleStarted===u&&d.providedConfigs===a.providedConfigs&&d.temporaryConfig===o.config)return d.config;let m=l?s:t,p=n8(a,o),f=i?.configure?.[n]??{},h=ae(e,p),g=h?.extensionSlots?.[r]?.configure?.[n]??{},y=at([ae(m,p),f,g]),v=l??a.schemas[t];(l||u)&&ar(v,y,m);let b=ai(v,y);return an(v,b,m),delete b.extensionSlots,n6.set(c,{extensionSchema:l,extensionModuleSchema:a.schemas[t],extensionModuleStarted:u,providedConfigs:a.providedConfigs,temporaryConfig:o.config,config:b}),b}(o.slotModuleName,o.extensionModuleName,o.slotName,o.extensionId,e,r,n[o.slotName]);t=c?.loaded&&rP(c.config,a)?c:{config:a,loaded:!0}}nH.set(t,o),t!==c&&(l=!0),s[o.slotName]||(s[o.slotName]={}),s[o.slotName][o.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&&o.setState({configs:s})}function nY(e,t){n7(e,t);let r=nB(t,ap);nb.setState(t=>({...t,schemas:{...t.schemas,[e]:r},moduleLoaded:{...t.moduleLoaded,[e]:!0}}))}function nq(e){nb.setState(t=>({...t,schemas:{...t.schemas,[e]:ap}}))}function nJ(e){nb.setState(t=>({...t,moduleLoaded:{...t.moduleLoaded,[e]:!0},moduleStarted:{...t.moduleStarted,[e]:!0}}))}function nX(e){nb.setState(t=>({...t,schemas:{...t.schemas,[e]:am}}))}function nQ(e,t){n7(e,t);let r=nB(t,ap);nb.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.`),nb.setState(t=>({...t,schemas:{...t.schemas,[e]:r}}))}function n0(e,t="provided"){nb.setState(r=>({...r,providedConfigs:[...r.providedConfigs,{source:t,config:e}]}))}function n1(e,t,r){return new Promise(n=>{let a,o=!1;function i(e){!o&&t(e)&&(o=!0,n(r(e)),a?.())}i(e.getState()),o||(a=e.subscribe(i))})}function n4(e){return n1(nD(e),e=>!!(e.loaded&&e.config),e=>nc(e.config,["Display conditions","Translation overrides"]))}function n2(e,t,r){let n=[e in nb.getState().schemas?n1(nD(e),e=>!!(e.translationOverridesLoaded&&e.config),e=>e.config["Translation overrides"]??{}):Promise.resolve({})];if(t&&r){let e=nk(nC().getState(),t,r),a=e.loaded&&e.config?e.config["Translation overrides"]??{}:{};n.push(Promise.resolve(a))}return Promise.all(n)}function n3(e,t,r){ar(e,t,r);let n=ai(e,t);return an(e,n,r),n}let n6=new Map,n5=new Map,n9=new Map;function n8(e,t){return[...e.providedConfigs.map(e=>e.config),t.config]}function n7(e,t,r=""){let n="Please verify that you are running the latest version and, if so, alert the maintainer.";for(let a of Object.keys(t).filter(e=>!e.startsWith("_"))){let o=r+(r&&".")+a,i=t[a];if("Display conditions"===o&&console.error(`${e} declares a configuration option called "Display conditions"; the "Display conditions" option is a reserved name. ${n}`),"Translation overrides"===o&&console.error(`${e} declares a configuration option called "Translation overrides"; the "Translation overrides" option is a reserved name. ${n}`),!al(i)){console.error(`${e} has bad config schema definition for key '${o}'. ${n}`);continue}i.hasOwnProperty("_default")||n7(e,i,o);let s=i._elements;if(as(s)&&n7(e,s,o+"._elements"),i._validators)for(let t of i._validators)"function"!=typeof t&&console.error(`${e} has invalid validator for key '${o}' ${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(nd).includes(l)&&console.error(`${e} has invalid type for key '${o}' ${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 ai=(e,t)=>{let r=structuredClone(t);if(!e)return r;for(let t of Object.keys(e)){let n=r[t],a=e[t];if(a&&(a.hasOwnProperty("_type")||a.hasOwnProperty("_default"))){r.hasOwnProperty(t)||(r[t]=a._default);let e=a._elements;if(n&&as(e)){if(a._type===nd.Array&&Array.isArray(n)){let a=n.map(t=>ai(e,t));r[t]=a}else if(a._type===nd.Object)for(let t of Object.keys(n))n[t]=ai(e,n[t])}}else if(al(a)){let e=n??{};al(e)&&(r[t]=ai(a,e))}}return r};function as(e){return!!e&&Object.keys(e).filter(e=>!["_default","_validators"].includes(e)).length>0}function al(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function au(e,t){let r=`${e}:::${t}`;nU.has(r)||(console.error(t),nU.add(r))}function ac(e){e?nU.forEach(t=>{t.startsWith(e)&&nU.delete(t)}):nU.clear()}function ad(){nV.forEach(e=>e()),nV.length=0,nG.clear(),n6.clear(),n9.clear(),n5.clear(),nW=null,nH=new WeakMap,nz()}let am={"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:nd.Object,_default:{},_validators:[nm(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(", ")}.`})]}},ap={"Display conditions":{privileges:{_description:"The privilege(s) the user must have to use this extension",_type:nd.Array,_default:[]},expression:{_description:"The expression that determines whether the extension is displayed",_type:nd.String,_default:void 0}},...am},af=(e,t)=>nm(r=>e<=r&&r<=t,`must be between ${e} and ${t}`),ah=e=>{let t=e.concat(["openmrsBase","openmrsSpaBase"]);return nm(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(", "))},ag=ah([]),ay=e=>nm(t=>e.includes(t),`Must be one of the following: '${e.join("', '")}'.`),av={inRange:af,isUrl:ag,isUrlWithTemplateParameters:ah,oneOf:ay};var ab=r(8067);let aw=B("breadcrumbs",[]);function aE(e){return aD([e])}function aD(e){let t=[...ax(),...e.map(e=>({matcher:e.matcher instanceof RegExp?e.matcher:"string"==typeof e.matcher?(0,ab.pathToRegexp)(e.matcher).regexp:(0,ab.pathToRegexp)(e.path).regexp,settings:e}))];aw.setState(t,!0)}function ax(){return aw.getState()}function a_(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=a_(e,r.join("/"));if(t)return t}}(e,t)}function aS(e,t){if(e.length>0){let r=a_(e,t);if(r){let t=[r],n=a_(e,r.settings.parent);for(;void 0!==n;)t.push(n),n=a_(e,n.settings.parent);return t.reverse()}}return[]}function aC(e){return aS(ax(),e)}var ak=r(366);let aP={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 aR=r(2635);let aT=aR.Ay.default||aR.Ay;function aO(e,t,r,n){return aT.t(t,{ns:e,defaultValue:r,...n})}function a$(e,t,r){return aP[e]?aO("core",e,t??aP[e],r):(console.error(`O3 Core Translations does not provide key '${e}'. The key itself is being rendered as text.`),e)}function aN(e,t){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=aI(e,{openmrsBase:window.openmrsBase,openmrsSpaBase:r,...t});return e.startsWith("//")?n:n.replace(/^\/\//,"/")}function aI(e,t){return Object.keys(t).reduce((e,r)=>e.split("${"+r+"}").join(t[r]),e)}function aM({to:e,templateParams:t}){let r=window.getOpenmrsSpaBase().replace(/\/$/,""),n=aN(e,t).replace(window.location.origin,""),a=new URL(n,window.location.origin);if("http:"!=a.protocol&&"https:"!=a.protocol)throw console.error(`Received request to navigate to non-http URL: ${a.toString()}`),Error(a$("navigateNonHttp"));n.startsWith(r)?(0,ak.navigateToUrl)(n):window.location.assign(n)}aT.on("initialized",function(){window.i18next.loadNamespaces(["core"])});let aj="openmrs:history";function aA(e){let t=JSON.parse(sessionStorage.getItem(aj)??"[]")||[];t.push(e),t.length>50&&(t=t.slice(-50)),sessionStorage.setItem(aj,JSON.stringify(t))}function aL(){0===JSON.parse(sessionStorage.getItem(aj)??"[]").length&&document.referrer&&aA(document.referrer),window.addEventListener("single-spa:routing-event",e=>{let t=aF();e.detail.originalEvent?.singleSpaTrigger=="replaceState"?(t[t.length-1]=window.location.href,sessionStorage.setItem(aj,JSON.stringify(t))):!e.detail.originalEvent?.singleSpa&&t.includes(window.location.href)?aB({toUrl:window.location.href}):t[t.length-1]!==window.location.href&&aA(window.location.href)})}function aF(){return JSON.parse(sessionStorage.getItem(aj)??"[]")}function aB({toUrl:e}){let t=aF(),r=t.lastIndexOf(e);if(-1!=r){let e=t.slice(0,r+1);aM({to:t[r]}),sessionStorage.setItem(aj,JSON.stringify(e))}else throw Error(`URL ${e} not found in history; cannot go back to it.`)}function aV(){sessionStorage.removeItem(aj)}let aU="${openmrsSpaBase}/login",aW={redirectAuthFailure:{enabled:{_type:nd.Boolean,_default:!0,_description:"Whether to redirect logged-out users to `redirectAuthFailure.url`"},url:{_type:nd.String,_default:aU,_validators:[av.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:nd.Array,_default:[401],_elements:{_type:nd.Number,_validators:[av.inRange(100,600)]},_description:"The HTTP error codes for which users will be redirected"},resolvePromise:{_type:nd.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:nd.Boolean,_default:!0,_description:"Whether openmrsFetch should support redirects returned from the backend"}};function aH(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let az="/ws/rest/v1",aK="/ws/fhir2/R4",aG=`${az}/session`;function aZ(e){return e&&e.startsWith("http")?e:("/"!==e[0]&&(e="/"+e),window.openmrsBase+e)}function aY(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=aZ(e);t.headers||(t.headers={}),e_(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(aZ(az),window.location.href),a=e.pathname.replace(/\/{2,}/g,"/"),o=t.pathname.replace(/\/{2,}/g,"/");n=e.origin===t.origin&&(a===o||a.startsWith(`${o}/`))}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(aK)){let e=new URL(r,window.location.toString());e.searchParams.has("_summary")||(e.searchParams.set("_summary","data"),r=e.toString())}let a=Error();return window.fetch(r,t).then(async e=>{let{redirectAuthFailure:n,followRedirects:o}=await n4("@openmrs/esm-api");if(e.ok){let t=e.headers.get("location");return(o&&t&&(r===aZ(aG)||204===e.status)&&aM({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===aZ(aG)&&403===e.status||n.enabled&&n.errors.includes(e.status))&&(aV(),aM({to:n.url||e.headers.get("location")||aU}),!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 aq(r,e,n,a)},()=>{throw new aq(r,e,null,a)})})}class aq extends Error{constructor(e,t,r,n){super(),aH(this,"response",void 0),aH(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 aJ=B("session",{loaded:!1,session:null}),aX=0,aQ=null;function a0(){return aQ||(aJ.getState().loaded&&aX>=Date.now()-6e4?null:a3())}function a1(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=a0();return n?new Promise(e=>{let t=()=>{let t=aJ.getState();t.loaded&&(a(),e(r(t.session)))},a=aJ.subscribe(t);n.then(t,t)}):Promise.resolve(r(aJ.getState().session))}function a4(){return a0(),aJ}function a2(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 a3(e,t){aX=Date.now(),a??(a=aX);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=oa(aY(aG,{headers:r,rejectAuthFailure:!0})),o=()=>{aQ===n&&(aQ=null)};return n.then(o,o),aQ=n,n}function a6(){aJ.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function a5(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 a9(){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(aJ.getState()),e||(t=aJ.subscribe(n))})}async function a8(){return(await a1()).sessionLocation}async function a7(e,t){return oa(aY(aG,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function oe(e,t){return await aY(aG,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),a3()}async function ot(e,t,r){return r||(r=new AbortController),await aY(`${az}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),a3()}async function or(e,t=!1){let r=await aY(t?`${aG}?rememberMe=true`:aG,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await a3()).session:r.data}async function on(){try{await aY(aG,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!oo(e))throw e}a6(),await a3().catch(()=>{})}function oa(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};aJ.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(oi(Error("The session endpoint did not respond with a session"))):r(oi(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(oo(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?aJ.setState({loaded:!0,session:e.responseBody},!0):a6(),t(aJ.getState());return}(o=e)instanceof aq&&502===o.response.status&&!aJ.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(oi(e,!0)):(k(`Failed to fetch new session information: ${e}`),r(oi(e)))})})}function oo(e){return e instanceof aq&&(401===e.response.status||403===e.response.status)}function oi(e,t=!1){return aJ.getState().loaded||aJ.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),aJ.getState()}function os(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}aJ.subscribe(e=>{e.loaded&&e.session&&a2(e.session)});let ol={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function ou(){nY("@openmrs/esm-api",aW),a3()}let oc="import-map-override:",od="import-map-overrides-disabled",om="import-map-overrides:change",op=!1,of=null,oh=null;async function og(){return oh??(oh=oy().then(({map:e,complete:t})=>(t||(oh=null),e))),oh}async function oy(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:ov(t),complete:r}}function ov(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function ob(){let e={};try{let t=o_();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(oc)){let r=n.slice(oc.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 ow(){let e=await og();return op?ov([e,of??ob()]):e}async function oE(){return og()}async function oD(){return op?ov([await og(),ob()]):og()}function ox(e){if(!op)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oc)){let t=localStorage.getItem(r);t&&(e[r.slice(oc.length)]=t)}}return{imports:e}}return ob()}function o_(){if(!op)return[];try{let e=localStorage.getItem(od);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oS(e){return!!op&&o_().includes(e)}function oC(e,t){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(oc+e,t),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function ok(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(oc+e);let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oP(){if(!op)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(oc)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oR(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oT=!1;function oO(){!oT&&(oT=!0,(op="development"===window.spaEnv)&&(of=ob()))}function o$(e){return e.replace(/[\/\-@]/g,"_")}async function oN(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([oI(e,n?.importMap),new Promise((t,r)=>{o=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)})]),o&&clearTimeout(o);let s=o$(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.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 oI(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=o$(e);if(!window[r]){let r=t??await oM();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 a=e in ox().imports;try{return await function(e){var t;let r=(t=window)[oj]??(t[oj]=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 a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,n)=>{let o=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(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&E({kind:"error",title:a$("scriptLoadingFailed","Error: Script failed to load"),description:a$("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:a$("resetOverrides","Reset overrides"),onActionButtonClick(){oP(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function oM(){return ow()}let oj=Symbol.for("__openmrs_script_loading");function oA(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 oL(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&&oA(t))}let oF="openmrs-routes:",oB="openmrs-routes:change",oV=!1,oU=null,oW=null;async function oH(){return oW??(oW=oz().then(({map:e,complete:t})=>(t||(oW=null),e))),oW}async function oz(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&oL(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:oK(t),complete:r}}function oK(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 oG(){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(oF)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(oF.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(oA(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(oA(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 oZ(){let e=await oH();return oV?oK([e,oU??await oG()]):e}async function oY(){return oH()}async function oq(){return oV?oK([await oH(),await oG()]):oH()}function oJ(){if(!oV)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oF)){let t=localStorage.getItem(r);t&&(e[r.slice(oF.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function oX(e,t){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(oF+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!oA(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(oF+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(oF+e,JSON.stringify(t.toString()));else{if(!oA(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(oF+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function oQ(e){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(oF+e),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function o0(){if(!oV)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(oF)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let o1=null;function o4(){return o1||(o1=(oV="development"===window.spaEnv)?oG().then(e=>{oU=e}):Promise.resolve())}let o2=`${az}/attachment`;function o3(e,t){return aY(`${o2}/${e}`,{signal:t.signal})}function o6(e,t,r,n){return aY(o5(e,t,n),{signal:r.signal})}function o5(e,t,r){return r?`${o2}?patient=${e}&encounter=${r}`:`${o2}?patient=${e}&includeEncounterless=${t}`}async function o9(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)),aY(`${o2}`,{method:"POST",body:n})}function o8(e,t){return aY(`${o2}/${e}`,{method:"DELETE",signal:t.signal})}async function o7(e,t){return e?(await aY(`${aK}/Patient/${e}`,t)).data:null}function ie(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function it(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 ir(e){return{uuid:e.uuid,display:e.display}}function ia(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return aY(`${az}/location${n?"?"+n:""}`).then(e=>e.data.results.map(ir))}function io(e){return{uuid:e.uuid,display:e.display,name:e.name}}let ii=`${az}/visittype`;function is(e=ii){return aY(e).then(e=>e.data.results.map(io))}var il=((et={}).NEWVISIT="startVisit",et.EDITVISIT="editVisit",et.LOADING="loadingVisit",et),iu=((er={}).NOTSTARTED="notStarted",er.ONGOING="ongoing",er);let ic="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))",id=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function im(){return W("visit",id)}function ip(e,t){im().setState({patientUuid:e,manuallySetVisitUuid:t})}function ih(e,t){return aY(`${az}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ig(e,t,r){return aY(`${az}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iy(e,t,r){return aY(`${az}/visit?patient=${e}&v=${r??ic}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}im().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iv{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iv.version}static addUnaryOp(e){return iv.max_unop_len=Math.max(e.length,iv.max_unop_len),iv.unary_ops[e]=1,iv}static addBinaryOp(e,t,r){return iv.max_binop_len=Math.max(e.length,iv.max_binop_len),iv.binary_ops[e]=t,r?iv.right_associative.add(e):iv.right_associative.delete(e),iv}static addIdentifierChar(e){return iv.additional_identifier_chars.add(e),iv}static addLiteral(e,t){return iv.literals[e]=t,iv}static removeUnaryOp(e){return delete iv.unary_ops[e],e.length===iv.max_unop_len&&(iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops)),iv}static removeAllUnaryOps(){return iv.unary_ops={},iv.max_unop_len=0,iv}static removeIdentifierChar(e){return iv.additional_identifier_chars.delete(e),iv}static removeBinaryOp(e){return delete iv.binary_ops[e],e.length===iv.max_binop_len&&(iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops)),iv.right_associative.delete(e),iv}static removeAllBinaryOps(){return iv.binary_ops={},iv.max_binop_len=0,iv}static removeLiteral(e){return delete iv.literals[e],iv}static removeAllLiterals(){return iv.literals={},iv}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 iv(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 iv.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iv.binary_ops[String.fromCharCode(e)]||iv.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iv.isIdentifierStart(e)||iv.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(iv.hooks[e]){let r={context:this,node:t};return iv.hooks.run(e,r),r.node}return t}searchHook(e){if(iv.hooks[e]){let t={context:this};return iv.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iv.SPACE_CODE||e===iv.TAB_CODE||e===iv.LF_CODE||e===iv.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:iv.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)===iv.SEMCOL_CODE||r===iv.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,iv.max_binop_len),t=e.length;for(;t>0;){if(iv.binary_ops.hasOwnProperty(e)&&(!iv.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iv.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,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iv.binaryPrecedence(t),right_a:iv.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=iv.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:iv.right_associative.has(t)},l=t;let s=e=>a.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,o=n.pop(),e={type:iv.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:iv.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,iv.isDecimalDigit(e)||e===iv.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iv.SQUOTE_CODE||e===iv.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===iv.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,iv.max_unop_len)).length;r>0;){if(iv.unary_ops.hasOwnProperty(t)&&(!iv.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iv.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:iv.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}iv.isIdentifierStart(e)?(n=this.gobbleIdentifier(),iv.literals.hasOwnProperty(n.name)?n={type:iv.LITERAL,value:iv.literals[n.name],raw:n.name}:n.name===iv.this_str&&(n={type:iv.THIS_EXP})):e===iv.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===iv.PERIOD_CODE||t===iv.OBRACK_CODE||t===iv.OPAREN_CODE||t===iv.QUMARK_CODE;){let r;if(t===iv.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iv.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iv.OBRACK_CODE?((e={type:iv.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iv.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iv.OPAREN_CODE?e={type:iv.CALL_EXP,arguments:this.gobbleArguments(iv.CPAREN_CODE),callee:e}:(t===iv.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:iv.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(;iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iv.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iv.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++));iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iv.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,iv.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===iv.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iv.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iv.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:iv.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iv.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iv.isIdentifierPart(e))this.index++;else break;return{type:iv.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 a=this.code;if(a===e){r=!0,this.index++,e===iv.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iv.COMMA_CODE){if(this.index++,++n!==t.length){if(e===iv.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iv.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!==iv.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iv.CPAREN_CODE);if(this.code===iv.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iv.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iv.ARRAY_EXP,elements:this.gobbleArguments(iv.CBRACK_CODE)}}}Object.assign(iv,{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)})}}(iv),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"}),iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops),iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops);let ib=e=>new iv(e).parse(),iw=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iv).filter(e=>!iw.includes(e)&&void 0===ib[e]).forEach(e=>{ib[e]=iv[e]}),ib.Jsep=iv,ib.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 a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},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 iE="ArrowFunctionExpression",iD={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)}},ix={...iD,Promise};function i_(e,t={}){return iT(e,t,iN)}async function iS(e,t={}){return iO(e,t,iN)}function iC(e,t={}){return iT(e,t,iI)}function ik(e,t={}){return iO(e,t,iI)}function iP(e,t={}){return iT(e,t,iM)}function iR(e,t={}){return iO(e,t,iM)}function iT(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=iB(t,iD),a=ij("string"==typeof e?ib(e):e,n);if(r(a))return a;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 iO(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=iB(t,ix);return Promise.resolve(ij("string"==typeof e?ib(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 i$(e){return ib(e)}function iN(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function iI(e){return"boolean"==typeof e}function iM(e){return"number"==typeof e}function ij(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=ij(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 ij(v.left,b)&&ij(v.right,b);case"||":return ij(v.left,b)||ij(v.right,b);case"??":return ij(v.left,b)??ij(v.right,b)}let w=ij(v.left,b),E=ij(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,ij(r.test,n)?ij(r.consequent,n):ij(r.alternate,n);case"CallExpression":return iW(iL(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=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}(a)&&t.push([r,a]),t},[]));return ij(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return iW(iF(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(iH(s));case"SequenceExpression":let x;return l=e,u=t,(x=l.expressions.map(iH(u)))[x.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(iH(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,(iz(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 m=e,p=t,C=m.expressions?.map(iH(p))??[],(k=m.quasis?.map(iH(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:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iA(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return iA(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function iL(e,t){let r=iU(e.callee,t);if(r===iV||e.optional&&null==r)return iV;let n=e.arguments?.map(iH(t));if(r){if("function"!=typeof r)throw`${iZ(e.callee)} is not a function`}else throw`No function named ${iZ(e.callee)} is defined in this context`;return r(...n)}function iF(e,t){let r=iU(e.object,t);if(r===iV||e.optional&&null==r)return iV;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${iG(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=iA(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${iG(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}(ij(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);iz(n),function(e,t){if(iK.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 a=r[n];return"function"==typeof a?a.bind(r):a}function iB(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}ib.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:iE,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=iE,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)})}}),ib.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"}})}}),ib.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="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),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 a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=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)})}}),ib.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,a=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{n=new RegExp(a,o)}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")}})}}),ib.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 a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},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 :")}})}}),ib.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=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,a+=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})}}),ib.addBinaryOp("in",7),ib.addBinaryOp("??",1);let iV=Symbol("optional chain short-circuited");function iU(e,t){switch(e.type){case"MemberExpression":return iF(e,t);case"CallExpression":return iL(e,t);default:return ij(e,t)}}function iW(e){return e===iV?void 0:e}function iH(e){return function(t){return null===t?null:ij(t,e)}}function iz(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let iK=new Set(["toString","valueOf","hasOwnProperty"]);function iG(e,t){try{return iA(e,t)}catch{return"<computed>"}}function iZ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function iY(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:{...ix},isLocalExpression:!1,variables:new Set};return iq("string"==typeof e?ib(e):e,t),[...t.variables]}function iq(e,t){switch(e.type){case"UnaryExpression":return n=e,a=t,iq(n.argument,a);case"BinaryExpression":return o=e,i=t,[iq(o.left,i),iq(o.right,i)].filter(Boolean);case"ConditionalExpression":return s=e,l=t,[iq(s.consequent,l),iq(s.test,l),iq(s.alternate,l)].filter(Boolean);case"CallExpression":let r;return u=e,c=t,r=iq(u.callee,c),u.arguments?.map(iJ(c)),r;case"ArrowFunctionExpression":var n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b=e,w=t;let E={...w};E.isLocalExpression=!0;let D=b.params?.map(iJ(E))??[],x=iq(b.body,E)??[];if(x&&Array.isArray(x))for(let e of x)D.includes(e)||w.variables.add(e);return;case"MemberExpression":var _=e,S=t;if(iq(_.object,S),_.computed)return void iq(_.property,S);let C={...S};C.isLocalExpression=!0,iq(_.property,C);return;case"ArrayExpression":return d=e,m=t,void d.elements?.map(iJ(m));case"SequenceExpression":return p=e,f=t,void p.expressions?.map(iJ(f));case"NewExpression":return h=e,g=t,void h.arguments?.map(iJ(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(iJ(v)),y.quasis?.map(iJ(v)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iJ(e){return function(t){return null===t?null:iq(t,e)}}let iX=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 iQ(e,t,r){iX.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function i0(){let e=iX.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 i1(e){return iX.getState().flags[e].enabled}function i4(e,t){iX.subscribe(r=>{t(r.flags[e].enabled)})}function i2(e,t){iX.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}iX.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 i3=tG(function(e,t,r){tF(e,t,r)});let i6=B("extensionsInternal",{slots:{},extensions:{}}),i5=B("extensionRenderings",{renderings:new Map}),i9=()=>W("extensionsInternal",{slots:{},extensions:{}}),i8=()=>W("extensionRenderings",{renderings:new Map});function i7(e){let t=i6.getState(),r=e(t);r!==t&&i6.setState(r)}let se=null,st=null;function sr(){let e=i5.getState();return se&&e===st||(se=new Map(e.renderings),st=e,function(e){for(let t of(sm.clear(),e.values()))sf(t,1);sp=!0}(se)),se}function sn(e){st={renderings:e},i5.setState(st,!0)}function sa(e){let t=sr();t.has(e.renderingId)||(t.set(e.renderingId,e),sf(e,1),sn(t))}function so(e){let t=sr(),r=t.get(e);r&&(t.delete(e),sf(r,-1),sn(t))}let si=()=>W("extensions",{slots:{}}),ss=0,sl=new Set;function su(e){ss++;try{return e()}finally{if(0==--ss&&sl.size>0){let e=Array.from(sl);for(let t of(sl.clear(),e))sc(t)}}}function sc(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sd(e){ss>0?sl.add(e):sc(e)}let sm=new Map,sp=!1;function sf(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=sm.get(r);if(!n){if(t<0)return;sm.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sp=!0;return}n.count+=t,n.count<1&&(sm.delete(r),sp=!0)}function sh(){var e,t;if(sr(),!sp)return;sp=!1;let r=Array.from(sm.values(),({record:e})=>e);r.sort(sg),e=nE.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===sg(e,t[r]))||nE.setState({mountedExtensions:r})}function sg(e,t){return sy(e.slotName,t.slotName)||sy(e.extensionId,t.extensionId)||sy(e.slotModuleName,t.slotModuleName)||sy(e.extensionModuleName,t.extensionModuleName)}function sy(e,t){return e===t?0:e<t?-1:1}sh(),i5.subscribe(()=>sd(sh));let sv=i9(),sb=si(),sw=nx(),sE=nC(),sD=new Set,sx=!1;function s_(e){if(null===e)sD=null;else if(null!==sD)for(let t of e)sD.add(t);sd(sS)}function sS(){if(!sx){sx=!0;try{for(let e=1;;e++){let t=sD;if(null!==t&&0===t.size)return;sD=new Set;try{!function(e,t,r,n,a,o=null){let i=sb.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&&o&&!o.has(n)){s[n]=d;continue}let{config:m}=nS(t,c.name),p=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=sv.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=sM(a),u=sM(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[sP(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}=nk(n,e,l),u=nP(r,e,l),c=u?i3({},i,u):i,d=sP(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!a5(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(n,e,m,r,u,a.session);d&&d.moduleName===c.moduleName&&rP(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sb.setState({slots:s})}(sv.getState(),sw.getState(),sE.getState(),iX.getState(),aJ.getState(),t)}catch(e){throw sD=null===t||null===sD?null:new Set([...t,...sD]),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{sx=!1}}}function sC(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 sk(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sP(e){let[t]=e.split("#");return t}function sR(e,t){let r=sP(t);return e.extensions[r]}function sT(e){return sR(sv.getState(),e)}sv.subscribe((e,t)=>{s_(e.extensions!==t.extensions?null:sC(e.slots,t.slots))}),sw.subscribe((e,t)=>{s_(sC(e.slots,t.slots))}),sE.subscribe((e,t)=>{s_(sC(e.configs,t.configs))}),iX.subscribe(()=>s_(null)),aJ.subscribe(()=>s_(null)),s_(null);let sO=e=>i7(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function s$(e,t){i7(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...sk(e),attachedIds:[t]}}}})}function sN(e,t){i7(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 sI(e){i7(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function sM(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function sj(e,t){return function(e,t,r=null,n){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!iC(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(sA(e),t,aJ.getState().session,e)}function sA(e){return sb.getState().slots[e]?.candidateExtensions??[]}let sL=(e,t)=>sv.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 a=sk(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),sF=()=>{sD=null,i7(()=>({slots:{},extensions:{}})),i8().setState({renderings:new Map}),sb.setState({slots:{}})},sB=B("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function sV({name:e,basePath:t,mode:r,componentContext:n,state:a}){sB.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function sU(e){sB.getState().slotName===e&&sB.setState(sB.getInitialState(),!0)}let sW=B("modalRegistry",{modals:{}});function sH(e){sW.setState(t=>(t.modals[e.name]=e,t))}function sz(e){let t=sW.getState().modals[e];if(!t){let r=sT(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.`),sH(t))}return t}let sK=B("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function sG(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=sK.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 sZ(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=sK.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 sY(e){let{openedWindows:t}=sK.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function sq(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=sK.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}}sK.setState({registeredGroupsByName:n})}function sJ(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=sK.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}sK.setState({registeredWindowsByName:n})}function sX(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=sK.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}sK.setState({registeredWorkspacesByName:n})}let sQ=0,s0=null,s1={bootstrap:15e3,mount:15e3,unmount:15e3};function s4(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(s1).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=s1[n],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function s2(e,t){var r,n;let a,o,i,s,l,u=await (s0??(s0=new Promise((e,t)=>{(0,ak.mountRootParcel)({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),ak.mountRootParcel))),s0),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>s4(e,r)):s4(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 s3(){return s6}function s6(e,t){let r,n=s2(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 s5(e,t,r,n,a=e=>e,o={}){let i=sP(n),s=sT(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:m}=s,p=sQ++,f=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{so(f)}catch(t){console.error(e,t)}};try{sa({renderingId:f,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 m()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await s2(a({...u,name:`${t}/${i}-${p}`}),{...o,_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 s9=r(4587),s8=r.n(s9);let s7=(0,s9.createContext)({moduleName:"",featureName:""});function le({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,s9.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),s8().createElement("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),aM({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:aN(e,t),...a},n)}let lt=({state:e,children:t,...r})=>{let{extension:n}=(0,s9.useContext)(s7),a=(0,s9.useRef)(null),o=(0,s9.useRef)(Promise.resolve()),i=(0,s9.useRef)(!1),s=(0,s9.useRef)(!1),l=(0,s9.useRef)(e),u=(0,s9.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,s9.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,s9.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,s5(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,s9.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,s9.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?s8().createElement("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function lr(e){let t=(0,s9.useRef)(e);return T(t.current,e)||(t.current=e),t.current}function ln(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let la=e=>e;function lo(e,t=la,r){let n=(0,s9.useCallback)(t=>e.subscribe(t),[e]),a=(0,s9.useCallback)(()=>t(e.getState()),[e,t]),o=(0,s9.useSyncExternalStore)(n,a,a),i=(0,s9.useMemo)(()=>r?ln(e,r):null,[e,r]);return(0,s9.useMemo)(()=>i?{...o,...i}:o,[o,i])}function li(e,t){return lo(e,la,t)}function ls(e){return function(t){let r=(0,s9.useCallback)(t=>e.subscribe(t),[]),n=(0,s9.useCallback)(()=>e.getState(),[]),a=(0,s9.useSyncExternalStore)(r,n,n),o=(0,s9.useMemo)(()=>t?ln(e,t):null,[t]);return(0,s9.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let ll=[];Object.freeze(ll);let lu={candidateExtensions:ll};Object.freeze(lu);let lc=e=>{let t=(0,s9.useCallback)(t=>t.slots?.[e]??lu,[e]);return lo(si(),t)},ld=e=>e.session;function lm(e,t){let{candidateExtensions:r}=lc(e),n=lo(aJ,ld),a=lr(t);return(0,s9.useMemo)(()=>sj(e,a),[e,a,n,r])}function lp(e,t){let{moduleName:r}=(0,s9.useContext)(s7);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,s9.useEffect)(()=>{sL(r,e)},[r,e]),{extensions:lm(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function lf(e){return e}function lh({name:e,extensionSlotName:t,select:r=lf,children:n,state:a,style:o,...i}){if(n&&a)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,s9.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lp(s,a),d=(0,s9.useMemo)(()=>r(u),[r,u]),m=(0,s9.useMemo)(()=>{if("function"==typeof n&&!s8().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return s8().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>s8().createElement(s7.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},m?.[t]??("function"!=typeof n?n:null)??s8().createElement(lt,{state:a}))))}var lg=r(5338);function ly(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 lv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ly(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ly(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lb(e){return(lb="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 lw(e){return(lw="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 lE(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(lw(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(lw(e)));return e}}var lD=null;try{lD=require("react").createContext()}catch(e){}var lx={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 l_(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lS(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 a,o=lR(e,t,function(){r(this)}),i=lE(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:lP(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function lC(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():lP(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function lk(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=lR(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=lE(e,t)();lP(e).render(n,o)}})}function lP(e){return e.ReactDOMClient||e.ReactDOM}function lR(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=lD?e.React.createElement(lD.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),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lv(lv({},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])}}),a)}var lT=r(587),lO=r(2272),l$=r(8444);let lN={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},lI=new Map;(0,l$.y)(lI);let lM={errorRetryCount:3,fetcher:aY,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof aq){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>lI};function lj(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},lN,e),r={...lM,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=s8().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 s8().createElement("div",null,"An error has occurred. Please try reloading the page.");{let n=s8().createElement(s9.Suspense,{fallback:null},s8().createElement(lO.S,{value:r},s8().createElement(s7.Provider,{value:this.state.config},t.disableTranslations?s8().createElement(e,this.props):s8().createElement(lT.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},s8().createElement(e,this.props)))));return t.strictMode&&s8().StrictMode?s8().createElement(s8().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 o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function lA(e,t){return function(e){if("object"!==lb(e))throw Error("single-spa-react requires a configuration object");var t,r=lv(lv({},lx),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");!lD&&r.React.createContext&&(lD=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:l_.bind(null,r),mount:lS.bind(null,r),unmount:lC.bind(null,r)};return r.parcelCanUpdate&&(n.update=lk.bind(null,r)),n}({React:s8(),ReactDOMClient:lg,rootComponent:lj(t)(e)})}function lL(e,t){return()=>e().then(({default:e})=>lA(e,t))}function lF(e,t){return()=>Promise.resolve(lA(e,t))}let lB=lL,lV=I()(()=>({}));U("openmrs-app-context",lV);let lU={};function lW(e,t=e=>e){let r=lV.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function lH(e,t){lV.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function lz(e){return null===e?null:Object.freeze(Object.assign({},e))}let lK=new Map;function lG(e,t){let r=(0,s9.useRef)(t??{}),n=(0,s9.useRef)(t=>lH(e,t)),a=(0,s9.useRef)(Symbol());return(0,s9.useEffect)(()=>{let r=t??{},n=a.current;return null===lW(e)?!function(e,t=lU){lV.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===lU?{}: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.`),lH(e,()=>r)),lK.set(e,n),()=>{lK.get(e)===n&&(lV.setState(t=>(e in t&&delete t[e],t)),lK.delete(e))}},[e]),(0,s9.useEffect)(()=>{let n=t??{};T(r.current,n)||(lH(e,()=>n),r.current=n)},[t]),n.current}function lZ({namespace:e,value:t}){return lG(e,t),null}let lY=({children:e,value:t,fallback:r})=>t?s8().createElement(s8().Fragment,null,e):r?s8().createElement(s8().Fragment,null,r):null;function lq(){let e=(0,s9.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,s9.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function lJ(e,t=e=>e??{}){let[r,n]=(0,s9.useState)(()=>{if(lX(e))return;let r=lW(e);if(null!==r)return t?t(r):r});return(0,s9.useEffect)(()=>{if(lX(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,s9.useEffect)(()=>{var r;let a;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>T(e,r)?e:r)})(lz(a=lW(e))),lV.subscribe(t=>{let n=e in t?t[e]:null;n!==a&&(a=n,r(lz(n)))})},[e,t]),r}function lX(e){return"string"!=typeof e||0===e.trim().length}function lQ(e){let t=lm(e);return(0,s9.useMemo)(()=>t.map(e=>e.id),[t])}function l0(e){return lc(e).candidateExtensions}function l1(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=(0,lO.u)(e?o5(e,t,r):null,aY);return(0,s9.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function l4(e){(0,s9.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let l2={},l3=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
15
+ ${this.stack}`}}let aJ=B("session",{loaded:!1,session:null}),aX=0,aQ=null;function a0(){return aQ||(aJ.getState().loaded&&aX>=Date.now()-6e4?null:a3())}function a1(e){let t=e?.includeAuthStatus??!0,r=e=>t?e:e.user,n=a0();return n?new Promise(e=>{let t=()=>{let t=aJ.getState();t.loaded&&(a(),e(r(t.session)))},a=aJ.subscribe(t);n.then(t,t)}):Promise.resolve(r(aJ.getState().session))}function a4(){return a0(),aJ}function a2(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 a3(e,t){aX=Date.now(),a??(a=aX);let r={};e&&t&&(r.Authorization=`Basic ${window.btoa(`${e}:${t}`)}`);let n=oa(aY(aG,{headers:r,rejectAuthFailure:!0})),o=()=>{aQ===n&&(aQ=null)};return n.then(o,o),aQ=n,n}function a6(){aJ.setState({loaded:!0,session:{authenticated:!1,sessionId:""}},!0)}function a5(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 a9(){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(aJ.getState()),e||(t=aJ.subscribe(n))})}async function a8(){return(await a1()).sessionLocation}async function a7(e,t){return oa(aY(aG,{method:"POST",body:{sessionLocation:e},headers:{"Content-Type":"application/json"},rejectAuthFailure:!0,signal:t?.signal}))}async function oe(e,t){return await aY(aG,{method:"POST",body:{locale:e},headers:{"Content-Type":"application/json"},signal:t?.signal}),a3()}async function ot(e,t,r){return r||(r=new AbortController),await aY(`${az}/user/${e}`,{method:"POST",body:{userProperties:t},headers:{"Content-Type":"application/json"},signal:r.signal}),a3()}async function or(e,t=!1){let r=await aY(t?`${aG}?rememberMe=true`:aG,{headers:{"X-Totp-Code":e}});return r.data?.authenticated?(await a3()).session:r.data}async function on(){try{await aY(aG,{method:"DELETE",rejectAuthFailure:!0})}catch(e){if(!oo(e))throw e}a6(),await a3().catch(()=>{})}function oa(e){return new Promise((t,r)=>{e.then(e=>{if("object"==typeof e?.data){let r={loaded:!0,session:e.data};aJ.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(oi(Error("The session endpoint did not respond with a session"))):r(oi(Error("The server is still starting up"),!0))}).catch(e=>{var n,o;if(oo(e)){"object"==typeof(n=e.responseBody)&&null!==n&&!1===n.authenticated?aJ.setState({loaded:!0,session:e.responseBody},!0):a6(),t(aJ.getState());return}(o=e)instanceof aq&&502===o.response.status&&!aJ.getState().loaded&&void 0!==a&&Date.now()-a<18e4?r(oi(e,!0)):(k(`Failed to fetch new session information: ${e}`),r(oi(e)))})})}function oo(e){return e instanceof aq&&(401===e.response.status||403===e.response.status)}function oi(e,t=!1){return aJ.getState().loaded||aJ.setState({loaded:!1,session:null,error:e instanceof Error?e:Error(String(e)),initializing:t},!0),aJ.getState()}function os(){return"development"===window.spaEnv||"true"===localStorage.getItem("openmrs:devtools")}aJ.subscribe(e=>{e.loaded&&e.session&&a2(e.session)});let ol={"webservices.rest":"2.24.0",fhir2:"1.0.0-SNAPSHOT"};function ou(){nY("@openmrs/esm-api",aW),a3()}let oc="import-map-override:",od="import-map-overrides-disabled",om="import-map-overrides:change",op=!1,of=null,oh=null;async function og(){return oh??(oh=oy().then(({map:e,complete:t})=>(t||(oh=null),e))),oh}async function oy(){let e=document.querySelectorAll('script[type="systemjs-importmap"]'),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{if(a.src){let e=await fetch(a.src);if(!e.ok)throw Error(`Request for ${a.src} returned ${e.status} ${e.statusText}`);t.push(await e.json())}else a.textContent&&t.push(JSON.parse(a.textContent))}catch(e){r=!1,console.warn(`[import-maps] Failed to parse import map from script tag at index ${n}`,e)}}return{map:ov(t),complete:r}}function ov(e){let t={imports:{}};for(let r of e)r?.imports&&Object.assign(t.imports,r.imports);return t}function ob(){let e={};try{let t=o_();for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);if(n?.startsWith(oc)){let r=n.slice(oc.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 ow(){let e=await og();return op?ov([e,of??ob()]):e}async function oE(){return og()}async function oD(){return op?ov([await og(),ob()]):og()}function ox(e){if(!op)return{imports:{}};if(e){let e={};for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oc)){let t=localStorage.getItem(r);t&&(e[r.slice(oc.length)]=t)}}return{imports:e}}return ob()}function o_(){if(!op)return[];try{let e=localStorage.getItem(od);if(e){let t=JSON.parse(e);if(Array.isArray(t))return t}}catch{}return[]}function oS(e){return!!op&&o_().includes(e)}function oC(e,t){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.setItem(oc+e,t),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to write import-map override to localStorage",e)}}function ok(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{localStorage.removeItem(oc+e);let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}function oP(){if(!op)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(oc)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to clear import-map overrides from localStorage",e)}}function oR(e){if(!op)return void console.warn("[Security] Import map overrides are disabled in production mode.");try{let t=o_().filter(t=>t!==e);t.length>0?localStorage.setItem(od,JSON.stringify(t)):localStorage.removeItem(od),window.dispatchEvent(new CustomEvent(om))}catch(e){console.warn("[import-maps] Failed to update import-map overrides in localStorage",e)}}let oT=!1;function oO(){!oT&&(oT=!0,(op="development"===window.spaEnv)&&(of=ob()))}function o$(e){return e.replace(/[\/\-@]/g,"_")}async function oN(e,t="./start",n){var a;let o,i=!n?.maxLoadingTime||n.maxLoadingTime<=0?6e5:n.maxLoadingTime;await Promise.race([oI(e,n?.importMap),new Promise((t,r)=>{o=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)})]),o&&clearTimeout(o);let s=o$(e),l=window[s];if(!("object"==typeof(a=l)&&null!==a&&"init"in a&&"function"==typeof a.init&&"get"in a&&"function"==typeof a.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 oI(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=o$(e);if(!window[r]){let r=t??await oM();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 a=e in ox().imports;try{return await function(e){var t;let r=(t=window)[oj]??(t[oj]=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 a=document.createElement("script");a.src=e,a.type="text/javascript",a.async=!0;let o=new Promise((t,n)=>{let o=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(o),a.removeEventListener("load",s),a.removeEventListener("error",l)}function s(){i(),t()}function l(t){i(),r.delete(e),a.remove();let o=`Failed to load script from ${e}`;console.error(o,t),n(t.message??o)}a.addEventListener("load",s),a.addEventListener("error",l),document.head.appendChild(a)});return r.set(e,o),o}(n)}catch(e){return a&&E({kind:"error",title:a$("scriptLoadingFailed","Error: Script failed to load"),description:a$("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:a$("resetOverrides","Reset overrides"),onActionButtonClick(){oP(),window.location.reload()}}),Promise.reject(e)}}return Promise.resolve()}async function oM(){return ow()}let oj=Symbol.for("__openmrs_script_loading");function oA(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 oL(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&&oA(t))}let oF="openmrs-routes:",oB="openmrs-routes:change",oV=!1,oU=null,oW=null;async function oH(){return oW??(oW=oz().then(({map:e,complete:t})=>(t||(oW=null),e))),oW}async function oz(){let e=document.querySelectorAll("script[type='openmrs-routes']"),t=[],r=!0;for(let n=0;n<e.length;n++){let a=e[n];try{let e;if(a.src){let t=await fetch(a.src);if(!t.ok)throw Error(`Request for ${a.src} returned ${t.status} ${t.statusText}`);e=await t.json()}else a.textContent&&(e=JSON.parse(a.textContent));e&&oL(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:oK(t),complete:r}}function oK(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 oG(){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(oF)){let e=localStorage.getItem(r);e&&t.push({moduleName:r.slice(oF.length),raw:e})}}for(let r of(await Promise.allSettled(t.map(async({moduleName:e,raw:t})=>{let r=JSON.parse(t);if(oA(r))return{moduleName:e,routes:r};if("string"==typeof r&&r.startsWith("http")){let t=await fetch(r),n=await t.json();if(oA(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 oZ(){let e=await oH();return oV?oK([e,oU??await oG()]):e}async function oY(){return oH()}async function oq(){return oV?oK([await oH(),await oG()]):oH()}function oJ(){if(!oV)return{};let e={};try{for(let t=0;t<localStorage.length;t++){let r=localStorage.key(t);if(r?.startsWith(oF)){let t=localStorage.getItem(r);t&&(e[r.slice(oF.length)]=t)}}}catch(e){console.warn("[route-maps] Failed to read route overrides from localStorage",e)}return e}function oX(e,t){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{if("string"==typeof t)if(t.startsWith("http"))localStorage.setItem(oF+e,JSON.stringify(t));else{let r=JSON.parse(t);if(!oA(r))return void console.error(`The supplied routes for ${e} is not a valid OpenmrsAppRoutes object`,t);localStorage.setItem(oF+e,JSON.stringify(r))}else if(t instanceof URL)localStorage.setItem(oF+e,JSON.stringify(t.toString()));else{if(!oA(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(oF+e,JSON.stringify(t))}window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to write route override to localStorage",e)}}function oQ(e){if(!oV)return void console.warn("[Security] Route overrides are disabled outside development mode.");try{localStorage.removeItem(oF+e),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to remove route override from localStorage",e)}}function o0(){if(!oV)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(oF)&&e.push(r)}e.forEach(e=>localStorage.removeItem(e)),window.dispatchEvent(new CustomEvent(oB))}catch(e){console.warn("[route-maps] Failed to clear route overrides from localStorage",e)}}let o1=null;function o4(){return o1||(o1=(oV="development"===window.spaEnv)?oG().then(e=>{oU=e}):Promise.resolve())}let o2=`${az}/attachment`;function o3(e,t){return aY(`${o2}/${e}`,{signal:t.signal})}function o6(e,t,r,n){return aY(o5(e,t,n),{signal:r.signal})}function o5(e,t,r){return r?`${o2}?patient=${e}&encounter=${r}`:`${o2}?patient=${e}&includeEncounterless=${t}`}async function o9(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)),aY(`${o2}`,{method:"POST",body:n})}function o8(e,t){return aY(`${o2}/${e}`,{method:"DELETE",signal:t.signal})}async function o7(e,t){return e?(await aY(`${aK}/Patient/${e}`,t)).data:null}function ie(e,t){let r=new CustomEvent(`openmrs:${e}`,{detail:t??void 0,cancelable:!0,bubbles:!0});return window.dispatchEvent(r)}function it(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 ir(e){return{uuid:e.uuid,display:e.display}}function ia(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString();return aY(`${az}/location${n?"?"+n:""}`).then(e=>e.data.results.map(ir))}function io(e){return{uuid:e.uuid,display:e.display,name:e.name}}let ii=`${az}/visittype`;function is(e=ii){return aY(e).then(e=>e.data.results.map(io))}var il=((et={}).NEWVISIT="startVisit",et.EDITVISIT="editVisit",et.LOADING="loadingVisit",et),iu=((er={}).NOTSTARTED="notStarted",er.ONGOING="ongoing",er);let ic="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))",id=function(){try{return JSON.parse(sessionStorage.getItem("openmrs:visitStoreState")||"null")}catch(e){return null}}()||{patientUuid:null,manuallySetVisitUuid:null};function im(){return W("visit",id)}function ip(e,t){im().setState({patientUuid:e,manuallySetVisitUuid:t})}function ih(e,t){return aY(`${az}/visit`,{signal:t.signal,method:"POST",headers:{"Content-type":"application/json"},body:e})}function ig(e,t,r){return aY(`${az}/visit/${e}`,{signal:r.signal,method:"POST",headers:{"Content-type":"application/json"},body:t})}function iy(e,t,r){return aY(`${az}/visit?patient=${e}&v=${r??ic}`,{signal:t.signal,method:"GET",headers:{"Content-type":"application/json"}})}im().subscribe(e=>{var t;t=e,sessionStorage.setItem("openmrs:visitStoreState",JSON.stringify(t))});class iv{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+iv.version}static addUnaryOp(e){return iv.max_unop_len=Math.max(e.length,iv.max_unop_len),iv.unary_ops[e]=1,iv}static addBinaryOp(e,t,r){return iv.max_binop_len=Math.max(e.length,iv.max_binop_len),iv.binary_ops[e]=t,r?iv.right_associative.add(e):iv.right_associative.delete(e),iv}static addIdentifierChar(e){return iv.additional_identifier_chars.add(e),iv}static addLiteral(e,t){return iv.literals[e]=t,iv}static removeUnaryOp(e){return delete iv.unary_ops[e],e.length===iv.max_unop_len&&(iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops)),iv}static removeAllUnaryOps(){return iv.unary_ops={},iv.max_unop_len=0,iv}static removeIdentifierChar(e){return iv.additional_identifier_chars.delete(e),iv}static removeBinaryOp(e){return delete iv.binary_ops[e],e.length===iv.max_binop_len&&(iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops)),iv.right_associative.delete(e),iv}static removeAllBinaryOps(){return iv.binary_ops={},iv.max_binop_len=0,iv}static removeLiteral(e){return delete iv.literals[e],iv}static removeAllLiterals(){return iv.literals={},iv}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 iv(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 iv.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!iv.binary_ops[String.fromCharCode(e)]||iv.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return iv.isIdentifierStart(e)||iv.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(iv.hooks[e]){let r={context:this,node:t};return iv.hooks.run(e,r),r.node}return t}searchHook(e){if(iv.hooks[e]){let t={context:this};return iv.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===iv.SPACE_CODE||e===iv.TAB_CODE||e===iv.LF_CODE||e===iv.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:iv.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)===iv.SEMCOL_CODE||r===iv.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,iv.max_binop_len),t=e.length;for(;t>0;){if(iv.binary_ops.hasOwnProperty(e)&&(!iv.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!iv.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,a,o,i,s,l;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:iv.binaryPrecedence(t),right_a:iv.right_associative.has(t)},(i=this.gobbleToken())||this.throwError("Expected expression after "+t),n=[o,a,i];t=this.gobbleBinaryOp();){if(0===(r=iv.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:r,right_a:iv.right_associative.has(t)},l=t;let s=e=>a.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,o=n.pop(),e={type:iv.BINARY_EXP,operator:t,left:o,right:i},n.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+l),n.push(a,e)}for(s=n.length-1,e=n[s];s>1;)e={type:iv.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,iv.isDecimalDigit(e)||e===iv.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===iv.SQUOTE_CODE||e===iv.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(e===iv.OBRACK_CODE)n=this.gobbleArray();else{for(r=(t=this.expr.substr(this.index,iv.max_unop_len)).length;r>0;){if(iv.unary_ops.hasOwnProperty(t)&&(!iv.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!iv.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:iv.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}iv.isIdentifierStart(e)?(n=this.gobbleIdentifier(),iv.literals.hasOwnProperty(n.name)?n={type:iv.LITERAL,value:iv.literals[n.name],raw:n.name}:n.name===iv.this_str&&(n={type:iv.THIS_EXP})):e===iv.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===iv.PERIOD_CODE||t===iv.OBRACK_CODE||t===iv.OPAREN_CODE||t===iv.QUMARK_CODE;){let r;if(t===iv.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==iv.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===iv.OBRACK_CODE?((e={type:iv.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),(t=this.code)!==iv.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===iv.OPAREN_CODE?e={type:iv.CALL_EXP,arguments:this.gobbleArguments(iv.CPAREN_CODE),callee:e}:(t===iv.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:iv.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(;iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===iv.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);iv.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++));iv.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);iv.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return r=this.code,iv.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(r===iv.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===iv.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:iv.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:iv.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(iv.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length;)if(e=this.code,iv.isIdentifierPart(e))this.index++;else break;return{type:iv.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 a=this.code;if(a===e){r=!0,this.index++,e===iv.CPAREN_CODE&&n&&n>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===iv.COMMA_CODE){if(this.index++,++n!==t.length){if(e===iv.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===iv.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!==iv.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(iv.CPAREN_CODE);if(this.code===iv.CPAREN_CODE)return(this.index++,1===e.length)?e[0]:!!e.length&&{type:iv.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:iv.ARRAY_EXP,elements:this.gobbleArguments(iv.CBRACK_CODE)}}}Object.assign(iv,{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)})}}(iv),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"}),iv.max_unop_len=iv.getMaxKeyLen(iv.unary_ops),iv.max_binop_len=iv.getMaxKeyLen(iv.binary_ops);let ib=e=>new iv(e).parse(),iw=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(iv).filter(e=>!iw.includes(e)&&void 0===ib[e]).forEach(e=>{ib[e]=iv[e]}),ib.Jsep=iv,ib.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 a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},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 iE="ArrowFunctionExpression",iD={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)}},ix={...iD,Promise};function i_(e,t={}){return iT(e,t,iN)}async function iS(e,t={}){return iO(e,t,iN)}function iC(e,t={}){return iT(e,t,iI)}function ik(e,t={}){return iO(e,t,iI)}function iP(e,t={}){return iT(e,t,iM)}function iR(e,t={}){return iO(e,t,iM)}function iT(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=iB(t,iD),a=ij("string"==typeof e?ib(e):e,n);if(r(a))return a;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 iO(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=iB(t,ix);return Promise.resolve(ij("string"==typeof e?ib(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 i$(e){return ib(e)}function iN(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||e instanceof Date}function iI(e){return"boolean"==typeof e}function iM(e){return"number"==typeof e}function ij(e,t){switch(e.type){case"UnaryExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h=e,g=t;let y=ij(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 ij(v.left,b)&&ij(v.right,b);case"||":return ij(v.left,b)||ij(v.right,b);case"??":return ij(v.left,b)??ij(v.right,b)}let w=ij(v.left,b),E=ij(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,ij(r.test,n)?ij(r.consequent,n):ij(r.alternate,n);case"CallExpression":return iW(iL(e,t));case"ArrowFunctionExpression":let D;return a=e,o=t,D=a.params?.map(e=>{if("Identifier"===e.type)return e.name;throw`Cannot handle parameter of type ${e.type}`})??[],(function(...e){if(e.length<D.length)throw`Required argument(s) ${D.slice(e.length,-1).join(", ")} were not provided`;let t=Object.fromEntries(D.reduce((t,r,n)=>{let a=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}(a)&&t.push([r,a]),t},[]));return ij(a.body,o.addVariables(t))}).bind(null);case"MemberExpression":return iW(iF(e,t));case"ArrayExpression":return i=e,s=t,i.elements?.map(iH(s));case"SequenceExpression":let x;return l=e,u=t,(x=l.expressions.map(iH(u)))[x.length-1];case"NewExpression":var _=e,S=t;if(_.callee&&"Identifier"===_.callee.type){let e=_.arguments?.map(iH(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,(iz(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 m=e,p=t,C=m.expressions?.map(iH(p))??[],(k=m.quasis?.map(iH(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:(f=e).cooked,tail:f.tail};default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iA(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return iA(e.property,t);default:throw`VisitExpressionName does not support expression of type '${e.type}'`}}function iL(e,t){let r=iU(e.callee,t);if(r===iV||e.optional&&null==r)return iV;let n=e.arguments?.map(iH(t));if(r){if("function"!=typeof r)throw`${iZ(e.callee)} is not a function`}else throw`No function named ${iZ(e.callee)} is defined in this context`;return r(...n)}function iF(e,t){let r=iU(e.object,t);if(r===iV||e.optional&&null==r)return iV;if(null===r)throw TypeError(`TypeError: cannot read properties of null (reading '${iG(e.property,t)}')`);if(void 0===r)switch(e.object.type){case"Identifier":{let r=iA(e.object,t);throw ReferenceError(`ReferenceError: ${r} is not defined`)}case"MemberExpression":throw TypeError(`TypeError: cannot read properties of undefined (reading '${iG(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}(ij(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);iz(n),function(e,t){if(iK.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 a=r[n];return"function"==typeof a?a.bind(r):a}function iB(e,t){let r={variables:{...e},globals:{...t},addVariables(e){return this.variables={...this.variables,...e},this}};return r.addVariables.bind(r),r}ib.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:iE,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=iE,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)})}}),ib.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"}})}}),ib.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="",a=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};a(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),a());let o=this.char;("e"===o||"E"===o)&&(n+=this.expr.charAt(this.index++),("+"===(o=this.char)||"-"===o)&&(n+=this.expr.charAt(this.index++)),a(),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 a,o,i;let s=this.index,l=this.expr.charAt(this.index+1),u=t.call(this,l);if(!u)return;let c="";for(;a=this.code,o=u,95===a||o.some(([e,t])=>a>=e&&a<=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)})}}),ib.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,a=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let e=this.code;if(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57)o+=this.char;else break}try{n=new RegExp(a,o)}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")}})}}),ib.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 a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:a},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 :")}})}}),ib.plugins.register({name:"jsepTemplateLiteral",init(e){function t(e,r=!0){if(96===this.code){let t={type:"TemplateLiteral",quasis:[],expressions:[]},n="",a="",o=!1,i=this.expr.length,s=()=>t.quasis.push({type:"TemplateElement",value:{raw:a,cooked:n},tail:o});for(;this.index<i;){let i=this.expr.charAt(++this.index);if("`"===i)return this.index+=1,o=!0,s(),e.node=t,r&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===i&&"{"===this.expr.charAt(this.index+1))this.index+=2,s(),a="",n="",t.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===i)switch(a+=i,i=this.expr.charAt(++this.index),a+=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,a+=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})}}),ib.addBinaryOp("in",7),ib.addBinaryOp("??",1);let iV=Symbol("optional chain short-circuited");function iU(e,t){switch(e.type){case"MemberExpression":return iF(e,t);case"CallExpression":return iL(e,t);default:return ij(e,t)}}function iW(e){return e===iV?void 0:e}function iH(e){return function(t){return null===t?null:ij(t,e)}}function iz(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:`Cannot access the ${e} property of objects`}}let iK=new Set(["toString","valueOf","hasOwnProperty"]);function iG(e,t){try{return iA(e,t)}catch{return"<computed>"}}function iZ(e){return e?"MemberExpression"===e.type?e.property?.name:e.name:null}function iY(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:{...ix},boundNames:new Set,variables:new Set};return iq("string"==typeof e?ib(e):e,t),[...t.variables]}function iq(e,t){switch(e.type){case"UnaryExpression":return r=e,n=t,void iq(r.argument,n);case"BinaryExpression":return a=e,o=t,void(iq(a.left,o),iq(a.right,o));case"ConditionalExpression":return i=e,s=t,void(iq(i.consequent,s),iq(i.test,s),iq(i.alternate,s));case"CallExpression":return l=e,u=t,void(iq(l.callee,u),l.arguments?.map(iJ(u)));case"ArrowFunctionExpression":var r,n,a,o,i,s,l,u,c,d,m,p,f,h,g,y,v,b,w,E,D=e,x=t;let _=new Set(x.boundNames);for(let e of D.params??[])e?.type==="Identifier"&&_.add(e.name);iq(D.body,{...x,boundNames:_});return;case"MemberExpression":return c=e,d=t,void(iq(c.object,d),c.computed&&iq(c.property,d));case"ArrayExpression":return m=e,p=t,void m.elements?.map(iJ(p));case"SequenceExpression":return f=e,h=t,void f.expressions?.map(iJ(h));case"NewExpression":return g=e,y=t,void g.arguments?.map(iJ(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(iJ(E)),w.quasis?.map(iJ(E)));default:throw`Expression evaluator does not support expression of type '${e.type}'`}}function iJ(e){return function(t){return null===t?null:iq(t,e)}}let iX=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 iQ(e,t,r){iX.setState(n=>({flags:{...n.flags,[e]:{enabled:n.flags[e]?.enabled??!1,label:t,description:r}}}))}function i0(){let e=iX.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 i1(e){return iX.getState().flags[e].enabled}function i4(e,t){iX.subscribe(r=>{t(r.flags[e].enabled)})}function i2(e,t){iX.setState(r=>({flags:{...r.flags,[e]:{...r.flags[e],enabled:t}}}))}iX.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 i3=tG(function(e,t,r){tF(e,t,r)});let i6=B("extensionsInternal",{slots:{},extensions:{}}),i5=B("extensionRenderings",{renderings:new Map}),i9=()=>W("extensionsInternal",{slots:{},extensions:{}}),i8=()=>W("extensionRenderings",{renderings:new Map});function i7(e){let t=i6.getState(),r=e(t);r!==t&&i6.setState(r)}let se=null,st=null;function sr(){let e=i5.getState();return se&&e===st||(se=new Map(e.renderings),st=e,function(e){for(let t of(sm.clear(),e.values()))sf(t,1);sp=!0}(se)),se}function sn(e){st={renderings:e},i5.setState(st,!0)}function sa(e){let t=sr();t.has(e.renderingId)||(t.set(e.renderingId,e),sf(e,1),sn(t))}function so(e){let t=sr(),r=t.get(e);r&&(t.delete(e),sf(r,-1),sn(t))}let si=()=>W("extensions",{slots:{}}),ss=0,sl=new Set;function su(e){ss++;try{return e()}finally{if(0==--ss&&sl.size>0){let e=Array.from(sl);for(let t of(sl.clear(),e))sc(t)}}}function sc(e){try{e()}catch(t){console.error(`The extension system's '${e.name}' recomputation failed`,t)}}function sd(e){ss>0?sl.add(e):sc(e)}let sm=new Map,sp=!1;function sf(e,t){let r=JSON.stringify([e.slotName,e.extensionId,e.slotModuleName,e.extensionModuleName]),n=sm.get(r);if(!n){if(t<0)return;sm.set(r,{count:1,record:{slotModuleName:e.slotModuleName,extensionModuleName:e.extensionModuleName,slotName:e.slotName,extensionId:e.extensionId}}),sp=!0;return}n.count+=t,n.count<1&&(sm.delete(r),sp=!0)}function sh(){var e,t;if(sr(),!sp)return;sp=!1;let r=Array.from(sm.values(),({record:e})=>e);r.sort(sg),e=nE.getState().mountedExtensions,t=r,e.length===t.length&&e.every((e,r)=>0===sg(e,t[r]))||nE.setState({mountedExtensions:r})}function sg(e,t){return sy(e.slotName,t.slotName)||sy(e.extensionId,t.extensionId)||sy(e.slotModuleName,t.slotModuleName)||sy(e.extensionModuleName,t.extensionModuleName)}function sy(e,t){return e===t?0:e<t?-1:1}sh(),i5.subscribe(()=>sd(sh));let sv=i9(),sb=si(),sw=nx(),sE=nC(),sD=new Set,sx=!1;function s_(e){if(null===e)sD=null;else if(null!==sD)for(let t of e)sD.add(t);sd(sS)}function sS(){if(!sx){sx=!0;try{for(let e=1;;e++){let t=sD;if(null!==t&&0===t.size)return;sD=new Set;try{!function(e,t,r,n,a,o=null){let i=sb.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&&o&&!o.has(n)){s[n]=d;continue}let{config:m}=nS(t,c.name),p=function(e,t,r,n,a,o){let i=function(e,t){let r=e.add||[],n=e.remove||[],a=e.order||[],{extensions:o}=sv.getState(),i=new Set(n),s=[...t,...r].filter(e=>!i.has(e)),l=sM(a),u=sM(t),c=new Map(s.map(e=>[e,function(e,t,r,n){let a=t.get(e);if(void 0!==a)return a;{if(void 0!==r)return 1e3+r;let t=n.get(e);return void 0!==t?2e3+t:3e3}}(e,l,o[sP(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}=nk(n,e,l),u=nP(r,e,l),c=u?i3({},i,u):i,d=sP(l),m=t.extensions[d];if(m){let e=c?.["Display conditions"]?.privileges??m.privileges??[];if(e&&("string"==typeof e||Array.isArray(e)&&e.length>0)&&(!o?.user||!a5(e,o.user))||m.featureFlag&&!a.includes(m.featureFlag))continue;s.push({id:l,name:d,moduleName:m.moduleName,config:c,featureFlag:m.featureFlag,meta:m.meta,displayConditionExpression:c?.["Display conditions"]?.expression||m.displayExpression})}}return s}(n,e,m,r,u,a.session);d&&d.moduleName===c.moduleName&&rP(d.candidateExtensions,p)?s[n]=d:(s[n]={moduleName:c.moduleName,candidateExtensions:p},l=!0)}(l||Object.keys(i).length!==Object.keys(s).length)&&sb.setState({slots:s})}(sv.getState(),sw.getState(),sE.getState(),iX.getState(),aJ.getState(),t)}catch(e){throw sD=null===t||null===sD?null:new Set([...t,...sD]),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{sx=!1}}}function sC(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 sk(e,t){return{moduleName:t,name:e,attachedIds:[]}}function sP(e){let[t]=e.split("#");return t}function sR(e,t){let r=sP(t);return e.extensions[r]}function sT(e){return sR(sv.getState(),e)}sv.subscribe((e,t)=>{s_(e.extensions!==t.extensions?null:sC(e.slots,t.slots))}),sw.subscribe((e,t)=>{s_(sC(e.slots,t.slots))}),sE.subscribe((e,t)=>{s_(sC(e.configs,t.configs))}),iX.subscribe(()=>s_(null)),aJ.subscribe(()=>s_(null)),s_(null);let sO=e=>i7(t=>({...t,extensions:{...t.extensions,[e.name]:{...e}}}));function s$(e,t){i7(r=>{let n=r.slots[e];return n?{...r,slots:{...r.slots,[e]:{...n,attachedIds:[...n.attachedIds,t]}}}:{...r,slots:{...r.slots,[e]:{...sk(e),attachedIds:[t]}}}})}function sN(e,t){i7(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 sI(e){i7(t=>{let r=t.slots[e];return r?{...t,slots:{...t.slots,[e]:{...r,attachedIds:[]}}}:t})}function sM(e){let t=new Map;return e.forEach((e,r)=>{t.has(e)||t.set(e,r)}),t}function sj(e,t){return function(e,t,r=null,n){let a;return e.filter(e=>{let o=e.displayConditionExpression;if("string"!=typeof o||0===o.trim().length)return!0;a??(a=t&&"object"==typeof t?{session:r,...t}:{session:r});try{return!!iC(o,a)}catch(t){return console.error(`Error while evaluating expression '${o}' for ${e.id}`+(n?` in ${n}`:""),t),!1}})}(sA(e),t,aJ.getState().session,e)}function sA(e){return sb.getState().slots[e]?.candidateExtensions??[]}let sL=(e,t)=>sv.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 a=sk(t,e);return{...r,slots:{...r.slots,[t]:{...a}}}}),sF=()=>{sD=null,i7(()=>({slots:{},extensions:{}})),i8().setState({renderings:new Map}),sb.setState({slots:{}})},sB=B("left-nav",{slotName:null,basePath:window.spaBase,mode:"normal"});function sV({name:e,basePath:t,mode:r,componentContext:n,state:a}){sB.setState({slotName:e,basePath:t,mode:r??"normal",componentContext:n,state:a})}function sU(e){sB.getState().slotName===e&&sB.setState(sB.getInitialState(),!0)}let sW=B("modalRegistry",{modals:{}});function sH(e){sW.setState(t=>(t.modals[e.name]=e,t))}function sz(e){let t=sW.getState().modals[e];if(!t){let r=sT(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.`),sH(t))}return t}let sK=B("workspace2",{registeredGroupsByName:{},registeredWindowsByName:{},registeredWorkspacesByName:{},openedGroup:null,openedWindows:[],isMostRecentlyOpenedWindowHidden:!1});function sG(e){let{registeredWorkspacesByName:t,registeredWindowsByName:r}=sK.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 sZ(e){let{registeredGroupsByName:t,registeredWindowsByName:r}=sK.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 sY(e){let{openedWindows:t}=sK.getState();return t.findIndex(t=>t.openedWorkspaces.find(t=>t.workspaceName===e))}function sq(e,t){if(0==t.length)return;let{registeredGroupsByName:r}=sK.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}}sK.setState({registeredGroupsByName:n})}function sJ(e,t){if(0==t.length)return;let{registeredWindowsByName:r}=sK.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}sK.setState({registeredWindowsByName:n})}function sX(e,t){if(0==t.length)return;let{registeredWorkspacesByName:r}=sK.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}sK.setState({registeredWorkspacesByName:n})}let sQ=0,s0=null,s1={bootstrap:15e3,mount:15e3,unmount:15e3};function s4(e,t){if(e.timeouts)return e;let r=e.name??"parcel",n=Object.fromEntries(Object.keys(s1).filter(t=>e[t]).map(n=>{var a,o;let i,s;return[n,(a=e[n],o=s1[n],i=Array.isArray(a)?a:[a],s=e=>i.reduce((t,a,o)=>t.then(()=>{let t=a(e);return"function"==typeof t?.then&&"function"==typeof t?.catch?t:Promise.reject(Error(`Lifecycle function ${n} at array index ${o} for parcel ${r} did not return a promise`))}),Promise.resolve(void 0)),e=>{let a,i=new Promise((e,t)=>{a=setTimeout(()=>t(Error(`Lifecycle function ${n} for parcel ${r} did not settle within ${o}ms`)),o)});return Promise.race([s(e),i]).finally(()=>clearTimeout(a)).then(e=>(t(n,!1),e),e=>{throw t(n,!0),e})})]}));return{...e,...n}}async function s2(e,t){var r,n;let a,o,i,s,l,u=await (s0??(s0=new Promise((e,t)=>{(0,ak.mountRootParcel)({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),ak.mountRootParcel))),s0),c={...t},d=(a=c,o=!1,{retarget:e=>a={...e},release:i=()=>(function(e){for(let t of Object.keys(e))delete e[t]})(a),onSettled(e,t){switch(e){case"bootstrap":t&&i();return;case"mount":o||(o=t);return;case"unmount":(t||o)&&i();return}}});return n=u((r=d.onSettled,"function"==typeof e?()=>e().then(e=>s4(e,r)):s4(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 s3(){return s6}function s6(e,t){let r,n=s2(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 s5(e,t,r,n,a=e=>e,o={}){let i=sP(n),s=sT(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:m}=s,p=sQ++,f=`${t}/${n}-${p}`;e.dataset.extensionRenderingId=f;let h=e=>{try{so(f)}catch(t){console.error(e,t)}};try{sa({renderingId:f,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 m()}catch(e){throw h(`Recomputing configuration after '${n}' failed to load also failed`),e}try{l=await s2(a({...u,name:`${t}/${i}-${p}`}),{...o,_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 s9=r(4587),s8=r.n(s9);let s7=(0,s9.createContext)({moduleName:"",featureName:""});function le({to:e,templateParams:t,onBeforeNavigate:r,children:n,...a}){return(0,s9.useEffect)(()=>{a.href&&console.warn(`ConfigurableLink does not support the href prop. Use the 'to' prop instead. The provided href value is '${a.href}'`),a.onClick&&console.warn(`ConfigurableLink does not support the onClick prop. Use the 'onBeforeNavigate' prop instead. The 'to' prop of the offending link is ${e}`)},[]),s8().createElement("a",{onClick:n=>{0===n.button&&!n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey&&(n.preventDefault(),r?.(n),aM({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:aN(e,t),...a},n)}let lt=({state:e,children:t,...r})=>{let{extension:n}=(0,s9.useContext)(s7),a=(0,s9.useRef)(null),o=(0,s9.useRef)(Promise.resolve()),i=(0,s9.useRef)(!1),s=(0,s9.useRef)(!1),l=(0,s9.useRef)(e),u=(0,s9.useCallback)(e=>{if(!e)return;let t=()=>{"MOUNTED"===e.getStatus()&&e.unmount()};switch(e.getStatus()){case"MOUNTED":e.unmount();break;case"UPDATING":o.current?.then(t,t);break;default:e.mountPromise.then(t,()=>{})}},[]),c=(0,s9.useCallback)((e,t)=>{e.update&&"UNMOUNTING"!==e.getStatus()&&(o.current=Promise.all([e.mountPromise,o.current]).then(()=>{if(a.current?.getStatus()==="MOUNTED"&&a.current.update)return a.current.update({...t})}).catch(e=>{let t=a.current?.getStatus();"UNMOUNTING"!==t&&"NOT_MOUNTED"!==t&&"UNLOADING"!==t&&console.error(`The extension '${n?.extensionId}' failed to update`,e)}))},[]),d=(0,s9.useCallback)(t=>{t&&!a.current&&!s.current&&n?.extensionSlotName&&n.extensionSlotModuleName&&(s.current=!0,s5(t,n.extensionSlotName,n.extensionSlotModuleName,n.extensionId,void 0,e).then(t=>{(s.current=!1,a.current=t,i.current)?u(t):t&&l.current!==e&&c(t,l.current)},()=>{s.current=!1}))},[]);return(0,s9.useEffect)(()=>(i.current=!1,()=>{i.current=!0,u(a.current)}),[]),(0,s9.useEffect)(()=>{l.current=e,a.current&&c(a.current,e)},[e]),n?s8().createElement("div",{ref:d,"data-extension-id":n?.extensionId,style:{position:"relative"},...r}):null};function lr(e){let t=(0,s9.useRef)(e);return T(t.current,e)||(t.current=e),t.current}function ln(e,t){"function"==typeof t&&(t=t(e));let r={};for(let[n,a]of Object.entries(t)){let t=function(...t){e.setState(e=>a(e,...t))};r[n]=t}return r}let la=e=>e;function lo(e,t=la,r){let n=(0,s9.useCallback)(t=>e.subscribe(t),[e]),a=(0,s9.useCallback)(()=>t(e.getState()),[e,t]),o=(0,s9.useSyncExternalStore)(n,a,a),i=(0,s9.useMemo)(()=>r?ln(e,r):null,[e,r]);return(0,s9.useMemo)(()=>i?{...o,...i}:o,[o,i])}function li(e,t){return lo(e,la,t)}function ls(e){return function(t){let r=(0,s9.useCallback)(t=>e.subscribe(t),[]),n=(0,s9.useCallback)(()=>e.getState(),[]),a=(0,s9.useSyncExternalStore)(r,n,n),o=(0,s9.useMemo)(()=>t?ln(e,t):null,[t]);return(0,s9.useMemo)(()=>o?{...a,...o}:a,[a,o])}}let ll=[];Object.freeze(ll);let lu={candidateExtensions:ll};Object.freeze(lu);let lc=e=>{let t=(0,s9.useCallback)(t=>t.slots?.[e]??lu,[e]);return lo(si(),t)},ld=e=>e.session;function lm(e,t){let{candidateExtensions:r}=lc(e),n=lo(aJ,ld),a=lr(t);return(0,s9.useMemo)(()=>sj(e,a),[e,a,n,r])}function lp(e,t){let{moduleName:r}=(0,s9.useContext)(s7);if(!r)throw Error("ComponentContext has not been provided. This should come from @openmrs/esm-react-utils.");return(0,s9.useEffect)(()=>{sL(r,e)},[r,e]),{extensions:lm(e,t),extensionSlotName:e,extensionSlotModuleName:r}}function lf(e){return e}function lh({name:e,extensionSlotName:t,select:r=lf,children:n,state:a,style:o,...i}){if(n&&a)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,s9.useRef)(null),{extensions:u,extensionSlotModuleName:c}=lp(s,a),d=(0,s9.useMemo)(()=>r(u),[r,u]),m=(0,s9.useMemo)(()=>{if("function"==typeof n&&!s8().isValidElement(n))return d.map(e=>n(e,a))},[n,d]);return s8().createElement("div",{ref:l,"data-extension-slot-name":s,"data-extension-slot-module-name":c,style:{...o,position:"relative"},...i},s&&d?.map((e,t)=>s8().createElement(s7.Provider,{key:e.id,value:{moduleName:c,featureName:"",extension:{extensionId:e.id,extensionSlotName:s,extensionSlotModuleName:c,extensionMeta:e.meta}}},m?.[t]??("function"!=typeof n?n:null)??s8().createElement(lt,{state:a}))))}var lg=r(5338);function ly(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 lv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ly(Object(r),!0).forEach(function(t){var n,a,o;n=e,a=t,o=r[t],a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ly(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lb(e){return(lb="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 lw(e){return(lw="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 lE(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(lw(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(lw(e)));return e}}var lD=null;try{lD=require("react").createContext()}catch(e){}var lx={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 l_(e,t){return e.rootComponent?Promise.resolve():e.loadRootComponent(t).then(function(t){e.rootComponent=t})}function lS(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 a,o=lR(e,t,function(){r(this)}),i=lE(e,t)(),s=function(e){var t=e.reactDom,r=e.renderType,n=e.elementToRender,a=e.domElement,o=t[r];if("function"!=typeof o)throw Error('renderType "'.concat(r,'" did not return a function.'));switch(r){case"createRoot":case"unstable_createRoot":case"createBlockingRoot":case"unstable_createBlockingRoot":var i=o(a);return i.render(n),i;case"hydrateRoot":return o(a,n);default:return o(n,a),null}}({elementToRender:o,domElement:i,reactDom:lP(e),renderType:"function"==typeof(a=e).renderType?a.renderType():a.renderType});e.domElements[t.name]=i,e.renderResults[t.name]=s})}function lC(e,t){return new Promise(function(r){e.unmountResolves[t.name]=r;var n=e.renderResults[t.name];n&&n.unmount?n.unmount():lP(e).unmountComponentAtNode(e.domElements[t.name]),delete e.domElements[t.name],delete e.renderResults[t.name]})}function lk(e,t){return new Promise(function(r){e.updateResolves[t.name]||(e.updateResolves[t.name]=[]),e.updateResolves[t.name].push(r);var n=lR(e,t,null),a=e.renderResults[t.name];if(a&&a.render)a.render(n);else{var o=lE(e,t)();lP(e).render(n,o)}})}function lP(e){return e.ReactDOMClient||e.ReactDOM}function lR(e,t,r){var n=e.React.createElement(e.rootComponent,t),a=lD?e.React.createElement(lD.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),a=e.React.createElement(e.errorBoundaryClass,t,a)),a=e.React.createElement(e.SingleSpaRoot,lv(lv({},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])}}),a)}var lT=r(587),lO=r(2272),l$=r(8444);let lN={strictMode:!0,throwErrorsToConsole:!0,disableTranslations:!1},lI=new Map;(0,l$.y)(lI);let lM={errorRetryCount:3,fetcher:aY,focusThrottleInterval:18e5,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,shouldRetryOnError:e=>{if(e instanceof aq){let t=e.response.status;return!!(t>=500)||401===t||403===t||429===t}return!0},provider:()=>lI};function lj(e){if("object"!=typeof e||"string"!=typeof e.featureName||"string"!=typeof e.moduleName)throw Error("Invalid options");let t=Object.assign({},lN,e),r={...lM,...t.swrConfig};return function(e){var n,a,o,i,s;return o=a=class extends(n=s8().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 s8().createElement("div",null,"An error has occurred. Please try reloading the page.");{let n=s8().createElement(s9.Suspense,{fallback:null},s8().createElement(lO.S,{value:r},s8().createElement(s7.Provider,{value:this.state.config},t.disableTranslations?s8().createElement(e,this.props):s8().createElement(lT.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},s8().createElement(e,this.props)))));return t.strictMode&&s8().StrictMode?s8().createElement(s8().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 o?Object.defineProperty(o,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[i]=s,a}}function lA(e,t){return function(e){if("object"!==lb(e))throw Error("single-spa-react requires a configuration object");var t,r=lv(lv({},lx),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");!lD&&r.React.createContext&&(lD=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:l_.bind(null,r),mount:lS.bind(null,r),unmount:lC.bind(null,r)};return r.parcelCanUpdate&&(n.update=lk.bind(null,r)),n}({React:s8(),ReactDOMClient:lg,rootComponent:lj(t)(e)})}function lL(e,t){return()=>e().then(({default:e})=>lA(e,t))}function lF(e,t){return()=>Promise.resolve(lA(e,t))}let lB=lL,lV=I()(()=>({}));U("openmrs-app-context",lV);let lU={};function lW(e,t=e=>e){let r=lV.getState();return e in r?Object.freeze(Object.assign({},t?t(r[e]):r[e])):null}function lH(e,t){lV.setState(r=>(e in r||(r[e]={}),r[e]=t(r[e]),Object.assign({},r)))}function lz(e){return null===e?null:Object.freeze(Object.assign({},e))}let lK=new Map;function lG(e,t){let r=(0,s9.useRef)(t??{}),n=(0,s9.useRef)(t=>lH(e,t)),a=(0,s9.useRef)(Symbol());return(0,s9.useEffect)(()=>{let r=t??{},n=a.current;return null===lW(e)?!function(e,t=lU){lV.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===lU?{}: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.`),lH(e,()=>r)),lK.set(e,n),()=>{lK.get(e)===n&&(lV.setState(t=>(e in t&&delete t[e],t)),lK.delete(e))}},[e]),(0,s9.useEffect)(()=>{let n=t??{};T(r.current,n)||(lH(e,()=>n),r.current=n)},[t]),n.current}function lZ({namespace:e,value:t}){return lG(e,t),null}let lY=({children:e,value:t,fallback:r})=>t?s8().createElement(s8().Fragment,null,e):r?s8().createElement(s8().Fragment,null,r):null;function lq(){let e=(0,s9.useRef)();return(!e.current||e.current.signal.aborted)&&(e.current=new AbortController),(0,s9.useEffect)(()=>{let t=e.current;return()=>t?.abort()},[]),e.current}function lJ(e,t=e=>e??{}){let[r,n]=(0,s9.useState)(()=>{if(lX(e))return;let r=lW(e);if(null!==r)return t?t(r):r});return(0,s9.useEffect)(()=>{if(lX(e))throw Error(`The namespace supplied to useAppContext must be a non-empty string, but was "${e}".`)},[e]),(0,s9.useEffect)(()=>{var r;let a;return(r=e=>{if(null==e)return void n(void 0);let r=t?t(e):e;n(e=>T(e,r)?e:r)})(lz(a=lW(e))),lV.subscribe(t=>{let n=e in t?t[e]:null;n!==a&&(a=n,r(lz(n)))})},[e,t]),r}function lX(e){return"string"!=typeof e||0===e.trim().length}function lQ(e){let t=lm(e);return(0,s9.useMemo)(()=>t.map(e=>e.id),[t])}function l0(e){return lc(e).candidateExtensions}function l1(e,t,r){let{data:n,error:a,mutate:o,isLoading:i,isValidating:s}=(0,lO.u)(e?o5(e,t,r):null,aY);return(0,s9.useMemo)(()=>({isLoading:i,data:n?.data.results??[],error:a,mutate:o,isValidating:s}),[n,a,i,s,o])}function l4(e){(0,s9.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e])}let l2={},l3=`No ComponentContext has been provided. This should come from "openmrsComponentDecorator".
16
16
  Usually this is already applied when using "getAsyncLifecycle" or "getSyncLifecycle".`;function l6(e,t,r){let n=l2[e];if(n)return n;let a=new Promise(e=>{let n=r(t.getState());if(n)return void e(n);let a=t.subscribe(t=>{let n=r(t);n&&(a(),e(n))})});return l2[e]=a,a.then(()=>{l2[e]===a&&delete l2[e]}),a}function l5(e){let{moduleName:t,extension:r}=(0,s9.useContext)(s7),n=e?.externalModuleName??t;if(!n&&!r)throw Error(l3);let a=function(e){let t=(0,s9.useMemo)(()=>nD(e),[e]),r=function(e){let[t,r]=(0,s9.useState)(()=>{let t=e.getState();return t.loaded&&t.config?t.config:null});return(0,s9.useEffect)(()=>e?.subscribe(e=>{e.loaded&&e.config&&r(e.config)}),[e]),t}(t);if(!r)throw l6(e,t,e=>e.loaded?e.config:null);return r}(n),o=function(e){let t=(0,s9.useMemo)(nC,[]),r=function(e,t){let[r,n]=(0,s9.useState)(t?()=>{let r=nk(e.getState(),t.extensionSlotName,t.extensionId);if(r.loaded&&r.config)return r.config}:null);return(0,s9.useEffect)(()=>{if(t)return e.subscribe(e=>{let a=nk(e,t.extensionSlotName,t.extensionId);a.loaded&&a.config&&!rP(a.config,r)&&n(a.config)})},[e,t,r]),r}(t,e);if(!r&&e)throw l6(`${e.extensionSlotName}-${e.extensionId}`,t,t=>{let r=nk(t,e.extensionSlotName,e.extensionId);return r.loaded?r.config:null});return r||{}}(r);return(0,s9.useMemo)(()=>e?.externalModuleName&&n===e.externalModuleName?{...a}:{...a,...o},[n,e?.externalModuleName,a,o])}let l9=lm;function l8(e,t=300){let[r,n]=(0,s9.useState)(e);return(0,s9.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}var l7=r(4993);let ue=(0,l7.Ht)(lO.u,e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,n.refreshInterval=0,e(t,r,n))),ut=`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 ur(){let e=ue(`${az}/emrapi/configuration?v=${ut}`,aY);return(0,s9.useMemo)(()=>({emrConfiguration:e.data?.data,isLoadingEmrConfiguration:e.isLoading,mutateEmrConfiguration:e.mutate,errorFetchingEmrConfiguration:e.error}),[e])}function un(){return(0,s9.useContext)(s7).extension}let ua=ls(i9());function uo(e){let t=lm(e);return(0,s9.useMemo)(()=>Object.fromEntries(t.map(e=>[e.name,e.meta])),[t])}let ui=ls(si());function us(e){let{flags:t}=lo(iX);return t[e]?.enabled??!1}function ul(){let[,e]=(0,s9.useState)(0);return(0,s9.useCallback)(()=>{e(e=>e+1)},[])}function uu(e,t,r={}){return ud(e,t,uc,r)}let uc={getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aZ(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 ud(e,t,r,n={}){let{getPaginatedUrl:a,getTotalCount:o,getCurrentPageSize:i,getData:s}=r,{immutable:l,swrConfig:u}=n,c=n.fetcher??aY,[d,m]=(0,s9.useState)(1),p=(0,s9.useRef)(NaN),f=(0,s9.useRef)(NaN),h=(0,s9.useRef)(d),g=(0,s9.useRef)(!1),y=(0,s9.useRef)(!1),v=e?.toString()??"",[b,w]=(0,s9.useState)(v);v!==b&&(w(v),m(1),h.current=1,p.current=NaN,f.current=NaN,g.current=!1,y.current=!1);let E=(d-1)*t,D=(0,s9.useMemo)(()=>a(e,t,E),[e,t,E]),{data:x,..._}=(l?ue:lO.u)(D,c,u);x?.data&&(p.current=o(x?.data),f.current=i(x?.data),g.current=!0);let S=Math.ceil(p.current/t),C=(0,s9.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,m(e)):console.warn("Invalid attempt to go to out of bounds page: "+e)},[t]);(0,s9.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,m(e))},[d,t,v,x]);let k=(0,s9.useCallback)(()=>{C(h.current+1)},[C]),P=(0,s9.useCallback)(()=>{C(h.current-1)},[C]);return{data:s(x?.data),totalPages:S,totalCount:p.current,currentPage:d,currentPageSize:f.current,paginated:S>1,showNextButton:d<S,showPreviousButton:d>1,goTo:C,goToNext:k,goToPrevious:P,..._}}function um(e,t,r={}){return ud(e,t,up(),r)}function up(){return{getPaginatedUrl:(e,t,r)=>{if(!e)return null;{let n=new URL(aZ(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 uf=r(9888);let uh=Promise.resolve(),ug=(0,l7.Ht)(lO.u,e=>(t,r,n)=>{let a,o=(0,s9.useRef)(!1),{cache:i,initialSize:s=1,revalidateAll:l=!1,persistSize:u=!1,revalidateFirstPage:c=!0,revalidateOnMount:d=!1,parallel:m=!1}=n,[,,,p]=l$.a.get(l$.o);try{(a=(0,l$.s)(t?t(0,null):null)[0])&&(a="$inf$"+a)}catch(e){}let[f,h,g]=(0,l$.c)(i,a),y=(0,s9.useCallback)(()=>(0,l$.i)(f()._l)?s:f()._l,[i,a,s]);(0,uf.useSyncExternalStore)((0,s9.useCallback)(e=>a?g(a,()=>{e()}):()=>{},[i,a]),y,y);let v=(0,s9.useCallback)(()=>{let e=f()._l;return(0,l$.i)(e)?s:e},[a,s]),b=(0,s9.useRef)(v());(0,l$.u)(()=>{if(!o.current){o.current=!0;return}a&&h({_l:u?b.current:v()})},[a,i]);let w=d&&!o.current,E=e(a,async e=>{let a=f()._i,o=f()._r,s=l$.a.get(i),u=s[8],d=()=>s[8]!==u;h({_r:l$.U});let g=[],y=v(),[b]=(0,l$.c)(i,e),E=b().data,D=[],x=null;for(let e=0;e<y;++e){let[s,u]=(0,l$.s)(t(e,m?null:x));if(!s)break;let[f,h]=(0,l$.c)(i,s),y=f().data,v=l||a||(0,l$.i)(y)||c&&!e&&!(0,l$.i)(E)||w||E&&!(0,l$.i)(E[e])&&!n.compare(E[e],y);if(r&&("function"==typeof o?o(y,u):v)){let t=async()=>{if(s in p){let e=p[s];delete p[s],y=await e}else y=await r(u);d()||h({data:y,_k:u}),g[e]=y};m?D.push(t):await t()}else g[e]=y;m||(x=y)}return m&&await Promise.all(D.map(e=>e())),d()||h({_i:l$.U}),g},n),D=(0,s9.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},n=!1!==r.revalidate;return a?(n&&((0,l$.i)(e)?h({_i:!0,_r:r.revalidate}):h({_i:!1,_r:r.revalidate})),arguments.length?E.mutate(e,{...r,revalidate:n}):E.mutate()):uh},[a,i]),x=(0,s9.useCallback)(e=>{let r;if(!a)return uh;let[,n]=(0,l$.c)(i,a);if((0,l$.e)(e)?r=e(v()):"number"==typeof e&&(r=e),"number"!=typeof r)return uh;n({_l:r}),b.current=r;let o=[],[s]=(0,l$.c)(i,a),l=null;for(let e=0;e<r;++e){let[r]=(0,l$.s)(t(e,l)),[n]=(0,l$.c)(i,r),a=r?n().data:l$.U;if((0,l$.i)(a))return D(s().data);o.push(a),l=a}return D(o)},[a,i,D,v]);return{size:v(),setSize:x,mutate:D,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}});function uy(e,t={}){return uv(e,uc,t)}function uv(e,t,r={}){let{swrInfiniteConfig:n,immutable:a}=r,{getNextUrl:o,getTotalCount:i,getData:s}=t,l=r.fetcher??aY,{data:u,size:c,setSize:d,...m}=ug((0,s9.useCallback)((r,n)=>0==r?e?.toString()??null:t.getNextUrl(n.data),[e]),l,{...n,...a?{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1}:{}}),p=o(u?.[u.length-1].data),f=i(u?.[0]?.data);return{data:u?.flatMap(e=>s(e.data)),totalCount:f,hasMore:null!=p,loadMore:()=>{d((u?.length??0)+1)},nextUri:p,...m}}function ub(e,t={}){return uw(e,uc,t)}function uw(e,t,r={}){let n=uv(e,t,r),{hasMore:a,error:o,data:i,loadMore:s,isLoading:l,nextUri:u}=n;return((0,s9.useEffect)(()=>{a&&!o&&s()},[a,u]),r.partialData)?n:{...n,data:a||o?void 0:i,isLoading:l||a}}function uE(e,t={}){return uw(e,up(),t)}function uD(e,t={}){return uv(e,up(),t)}function ux(){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 u_(){let[e,t]=(0,s9.useState)(ux);return(0,s9.useEffect)(()=>{let e=()=>{t(ux())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let uS=e=>"small-desktop"===e||"large-desktop"===e;function uC(e){let t=(0,s9.useContext)(s7);(0,s9.useEffect)(()=>(t&&t.moduleName&&(e.componentContext=t),sV(e),()=>{sU(e.name)}),[t,e])}function uk(){return lo(sB)}let uP=[];function uR(e=null,t=null){let r=new URLSearchParams;e&&r.set("tag",e),t&&r.set("q",t);let n=r.toString(),{data:a}=ub(`${az}/location${n?"?"+n:""}`,{immutable:!0});return a??uP}function uT(e,t=!0){let r=(0,s9.useRef)(null);return(0,s9.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 uO(e){let t=(0,s9.useRef)();return(0,s9.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 u$(e,t={}){let{abortController:r,fetchInit:n,url:a,swrConfig:o}=t,i=lq(),s=(0,s9.useMemo)(()=>n?.signal??r?.signal??i.signal,[r?.signal,n?.signal,i.signal]),l=(0,s9.useCallback)(e=>aY(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,a),{...n,signal:s}),[s,n,a]);return(0,lO.u)(e,l,o)}function uN(e=[],t=10){let[r,n]=(0,s9.useState)(1),a=(0,s9.useMemo)(()=>"number"==typeof t&&t>0?Math.max(1,Math.ceil(e.length/t)):1,[e.length,t]);r>a&&n(a);let o=Math.min(Math.max(1,r),a),i=(0,s9.useMemo)(()=>{let r=(o-1)*t,n=(o+0)*t;return e.slice(r,n)},[e,o,t]),s=(0,s9.useCallback)(e=>{!Number.isInteger(e)||e<1?console.warn(`usePagination: ignoring goTo(${e}); page must be a positive integer.`):n(e)},[]),l=(0,s9.useCallback)(()=>{n(e=>e+1)},[]),u=(0,s9.useCallback)(()=>{n(e=>Math.max(1,e-1))},[]);return(0,s9.useMemo)(()=>({results:i,totalPages:a,currentPage:o,paginated:e.length>t,showNextButton:o<a,showPreviousButton:o>1,goTo:s,goToNext:l,goToPrevious:u}),[i,a,e.length,t,o,s,l,u])}function uI(e,t,r,n){return{pageSizes:(0,s9.useMemo)(()=>{let r=Math.ceil(t/e);return isNaN(r)&&(r=0),[...Array(r).keys()].map(t=>(t+1)*e)},[e,t]),pageItemsCount:(0,s9.useMemo)(()=>e>t?t:e*r>t?e*(r-1)+n:e*r,[e,t,r,n])}}function uM(){let e=/\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);return e&&e[1]}function uj(e){let[t,r]=(0,s9.useState)(e??uM()),{data:n,error:a,isValidating:o}=(0,lO.u)(t?["patient",t]:null,()=>o7(t,{}));return(0,s9.useEffect)(()=>{let e=()=>{let e=uM();e!==t&&r(e)};return window.addEventListener("single-spa:routing-event",e),()=>window.removeEventListener("single-spa:routing-event",e)},[t]),(0,s9.useMemo)(()=>({isLoading:o&&!a&&!n,patient:n,patientUuid:t,error:a}),[o,a,n,t])}function uA(){let e=`${az}/metadatamapping/termmapping?v=custom:(metadataUuid)&code=emr.primaryIdentifierType`,{data:t,error:r,isLoading:n}=(0,lO.u)(e,aY);return(0,s9.useMemo)(()=>({primaryIdentifierCode:t?.data?.results[0]?.metadataUuid,isLoading:n,error:r}),[t,r,n])}function uL(e){let{extensions:t,extensionSlotModuleName:r}=lp(e);return e?t.map(t=>({state:n})=>s8().createElement(s7.Provider,{value:{moduleName:r,featureName:"",extension:{extensionId:t.id,extensionSlotName:e,extensionSlotModuleName:r,extensionMeta:t.meta}}},s8().createElement(lt,{state:n}))):[]}function uF(){let e=(0,s9.useRef)(),[t,r]=(0,s9.useState)(null),n=null;if(!t){if(o){let e=a4().getState();e.loaded&&(n=e.session)}else o=new Promise(t=>{let r=({loaded:r,session:a})=>{r&&(t(a),n=a,e.current&&(e.current(),e.current=void 0))};r(a4().getState()),n||(e.current=a4().subscribe(r))});if(n)r(n);else throw o}(0,s9.useEffect)(()=>(e.current||(e.current=a4().subscribe(({loaded:e,session:t})=>{e&&(n=t,r(t))})),()=>{e.current&&(e.current(),e.current=void 0)}),[]);let a=t||n;if(!a)if(o)throw console.warn("useSession is in an unexpected state. Attempting to recover."),o;else throw Error("useSession is in an invalid state.");return a}let uB=({privilege:e,fallback:t,children:r})=>{let[n,a]=(0,s9.useState)(null);return((0,s9.useEffect)(()=>{let e=a4(),t=e.subscribe(({loaded:e,session:t})=>{a(e?t?.user??null:null)}),{loaded:r,session:n}=e.getState();return r&&a(n?.user??null),t},[]),n&&a5(e,n))?s8().createElement(s8().Fragment,null,r):t?s8().createElement(s8().Fragment,null,t):null};var uV=r(4353),uU=r.n(uV),uW=r(7581);let uH=new Map;function uz(){for(let e of Array.from(uH.values()))e()}let uK={setVisitContext:(e,t)=>null==t?{manuallySetVisitUuid:null}:{manuallySetVisitUuid:t.uuid,patientUuid:t.patient?.uuid}};function uG(e){let t=(0,s9.useId)();return(0,s9.useEffect)(()=>{if(e)return uH.set(t,e),()=>{uH.delete(t)}},[t,e]),{...li(im(),uK),mutateVisit:uz}}function uZ(e,t=ic){let r=(0,s9.useRef)(void 0),{patientUuid:n,manuallySetVisitUuid:a,setVisitContext:o}=uG((0,s9.useCallback)(()=>r.current?.(),[])),i=e&&n==e?a:null,s=`?patient=${e}&v=${t}&includeInactive=false`,l=`/${i}?v=${t}`,{data:u,error:c,mutate:d,isValidating:m}=(0,lO.u)(e?`${az}/visit${s}`:null,aY),{data:p,error:f,mutate:h,isValidating:g}=(0,lO.u)(e&&i?`${az}/visit${l}`:null,aY),y=(0,s9.useMemo)(()=>u?.data.results.find(e=>null===e.stopDatetime)??null,[u]),v=(0,s9.useMemo)(()=>i&&p?p.data:null,[p,i]),b=(0,s9.useRef)(null);(0,s9.useEffect)(()=>{!m&&y&&n===e&&null===a&&o(y),g||(b.current&&v&&b.current.uuid===v.uuid&&!b.current.stopDatetime&&v.stopDatetime&&o(null),b.current=v)},[v,a,y,m,g,n]);let w=(0,s9.useCallback)(()=>{d(),h()},[d,h]);(0,s9.useEffect)(()=>{r.current=w},[w]);let E=!!(!u||i&&!p),D=!!(i?f:c);return{error:c||f,mutate:w,isValidating:m||g,activeVisit:y,currentVisit:v,currentVisitIsRetrospective:!!i,isLoading:E&&!D}}uV.extend(uW);let uY=[];function uq(){let{data:e}=ue(ii,is);return e??uY}let uJ=new Map;async function uX(e,t){let r=t.indexOf("#"),n=r>=0,a=n?t.substring(0,r):e,o=n?t.substring(r+1):t,i=await oN(a);return i&&Object.hasOwn(i,o)&&"function"==typeof i[o]?u0(a,i).then(()=>i[o]()):(i?i&&Object.hasOwn(i,o)?console.warn(`The export ${t}, defined in ${e}'s routes.json, is not a function`):console.warn(`${a} does not define a component called "${o}", referenced in ${e}'s routes.json. This cannot be loaded.`):console.warn(`Unknown app ${a} for ${t} defined in ${e}'s routes.json`),uQ)}let uQ={bootstrap:()=>Promise.resolve(),mount:()=>Promise.resolve(),unmount:()=>Promise.resolve()};async function u0(e,t){if(e in uJ)await uJ[e];else{let r=t??await oN(e);await (uJ[e]=new Promise((t,n)=>{if(Object.hasOwn(r,"startupApp")){let a=r.startupApp;if("function"==typeof a)return Promise.resolve(a()).then(()=>{nJ(e),t(null)}).catch(n)}nJ(e),t(null)}))}}function u1(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