@medplum/app 5.1.0 → 5.1.2

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.
@@ -0,0 +1,235 @@
1
+ function R3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function sm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _y={exports:{}},gd={};var sE;function _3(){if(sE)return gd;sE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,s){var c=null;if(s!==void 0&&(c=""+s),i.key!==void 0&&(c=""+i.key),"key"in i){s={};for(var u in i)u!=="key"&&(s[u]=i[u])}else s=i;return i=s.ref,{$$typeof:e,type:r,key:c,ref:i!==void 0?i:null,props:s}}return gd.Fragment=t,gd.jsx=n,gd.jsxs=n,gd}var lE;function D3(){return lE||(lE=1,_y.exports=_3()),_y.exports}var a=D3(),_o=function(){return _o=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},_o.apply(this,arguments)};function G_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Nl(e,t,n,r){function i(s){return s instanceof n?s:new n(function(c){c(s)})}return new(n||(n=Promise))(function(s,c){function u(m){try{h(r.next(m))}catch(g){c(g)}}function f(m){try{h(r.throw(m))}catch(g){c(g)}}function h(m){m.done?s(m.value):i(m.value).then(u,f)}h((r=r.apply(e,t||[])).next())})}function A3(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Dy={exports:{}},mt={};var cE;function k3(){if(cE)return mt;cE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=y&&M[y]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function T(M,F,ie){this.props=M,this.context=F,this.refs=C,this.updater=ie||S}T.prototype.isReactComponent={},T.prototype.setState=function(M,F){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,F,"setState")},T.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function R(){}R.prototype=T.prototype;function E(M,F,ie){this.props=M,this.context=F,this.refs=C,this.updater=ie||S}var _=E.prototype=new R;_.constructor=E,w(_,T.prototype),_.isPureReactComponent=!0;var P=Array.isArray;function O(){}var k={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function z(M,F,ie){var de=ie.ref;return{$$typeof:e,type:M,key:F,ref:de!==void 0?de:null,props:ie}}function U(M,F){return z(M.type,F,M.props)}function K(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function W(M){var F={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(ie){return F[ie]})}var ee=/\/+/g;function B(M,F){return typeof M=="object"&&M!==null&&M.key!=null?W(""+M.key):F.toString(36)}function G(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(O,O):(M.status="pending",M.then(function(F){M.status==="pending"&&(M.status="fulfilled",M.value=F)},function(F){M.status==="pending"&&(M.status="rejected",M.reason=F)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function L(M,F,ie,de,Se){var Ce=typeof M;(Ce==="undefined"||Ce==="boolean")&&(M=null);var je=!1;if(M===null)je=!0;else switch(Ce){case"bigint":case"string":case"number":je=!0;break;case"object":switch(M.$$typeof){case e:case t:je=!0;break;case m:return je=M._init,L(je(M._payload),F,ie,de,Se)}}if(je)return Se=Se(M),je=de===""?"."+B(M,0):de,P(Se)?(ie="",je!=null&&(ie=je.replace(ee,"$&/")+"/"),L(Se,F,ie,"",function(ht){return ht})):Se!=null&&(K(Se)&&(Se=U(Se,ie+(Se.key==null||M&&M.key===Se.key?"":(""+Se.key).replace(ee,"$&/")+"/")+je)),F.push(Se)),1;je=0;var Ke=de===""?".":de+":";if(P(M))for(var _e=0;_e<M.length;_e++)de=M[_e],Ce=Ke+B(de,_e),je+=L(de,F,ie,Ce,Se);else if(_e=x(M),typeof _e=="function")for(M=_e.call(M),_e=0;!(de=M.next()).done;)de=de.value,Ce=Ke+B(de,_e++),je+=L(de,F,ie,Ce,Se);else if(Ce==="object"){if(typeof M.then=="function")return L(G(M),F,ie,de,Se);throw F=String(M),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return je}function I(M,F,ie){if(M==null)return M;var de=[],Se=0;return L(M,de,"","",function(Ce){return F.call(ie,Ce,Se++)}),de}function $(M){if(M._status===-1){var F=M._result;F=F(),F.then(function(ie){(M._status===0||M._status===-1)&&(M._status=1,M._result=ie)},function(ie){(M._status===0||M._status===-1)&&(M._status=2,M._result=ie)}),M._status===-1&&(M._status=0,M._result=F)}if(M._status===1)return M._result.default;throw M._result}var V=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},X={map:I,forEach:function(M,F,ie){I(M,function(){F.apply(this,arguments)},ie)},count:function(M){var F=0;return I(M,function(){F++}),F},toArray:function(M){return I(M,function(F){return F})||[]},only:function(M){if(!K(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return mt.Activity=g,mt.Children=X,mt.Component=T,mt.Fragment=n,mt.Profiler=i,mt.PureComponent=E,mt.StrictMode=r,mt.Suspense=f,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,mt.__COMPILER_RUNTIME={__proto__:null,c:function(M){return k.H.useMemoCache(M)}},mt.cache=function(M){return function(){return M.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(M,F,ie){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var de=w({},M.props),Se=M.key;if(F!=null)for(Ce in F.key!==void 0&&(Se=""+F.key),F)!A.call(F,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&F.ref===void 0||(de[Ce]=F[Ce]);var Ce=arguments.length-2;if(Ce===1)de.children=ie;else if(1<Ce){for(var je=Array(Ce),Ke=0;Ke<Ce;Ke++)je[Ke]=arguments[Ke+2];de.children=je}return z(M.type,Se,de)},mt.createContext=function(M){return M={$$typeof:c,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:s,_context:M},M},mt.createElement=function(M,F,ie){var de,Se={},Ce=null;if(F!=null)for(de in F.key!==void 0&&(Ce=""+F.key),F)A.call(F,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(Se[de]=F[de]);var je=arguments.length-2;if(je===1)Se.children=ie;else if(1<je){for(var Ke=Array(je),_e=0;_e<je;_e++)Ke[_e]=arguments[_e+2];Se.children=Ke}if(M&&M.defaultProps)for(de in je=M.defaultProps,je)Se[de]===void 0&&(Se[de]=je[de]);return z(M,Ce,Se)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(M){return{$$typeof:u,render:M}},mt.isValidElement=K,mt.lazy=function(M){return{$$typeof:m,_payload:{_status:-1,_result:M},_init:$}},mt.memo=function(M,F){return{$$typeof:h,type:M,compare:F===void 0?null:F}},mt.startTransition=function(M){var F=k.T,ie={};k.T=ie;try{var de=M(),Se=k.S;Se!==null&&Se(ie,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(O,V)}catch(Ce){V(Ce)}finally{F!==null&&ie.types!==null&&(F.types=ie.types),k.T=F}},mt.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},mt.use=function(M){return k.H.use(M)},mt.useActionState=function(M,F,ie){return k.H.useActionState(M,F,ie)},mt.useCallback=function(M,F){return k.H.useCallback(M,F)},mt.useContext=function(M){return k.H.useContext(M)},mt.useDebugValue=function(){},mt.useDeferredValue=function(M,F){return k.H.useDeferredValue(M,F)},mt.useEffect=function(M,F){return k.H.useEffect(M,F)},mt.useEffectEvent=function(M){return k.H.useEffectEvent(M)},mt.useId=function(){return k.H.useId()},mt.useImperativeHandle=function(M,F,ie){return k.H.useImperativeHandle(M,F,ie)},mt.useInsertionEffect=function(M,F){return k.H.useInsertionEffect(M,F)},mt.useLayoutEffect=function(M,F){return k.H.useLayoutEffect(M,F)},mt.useMemo=function(M,F){return k.H.useMemo(M,F)},mt.useOptimistic=function(M,F){return k.H.useOptimistic(M,F)},mt.useReducer=function(M,F,ie){return k.H.useReducer(M,F,ie)},mt.useRef=function(M){return k.H.useRef(M)},mt.useState=function(M){return k.H.useState(M)},mt.useSyncExternalStore=function(M,F,ie){return k.H.useSyncExternalStore(M,F,ie)},mt.useTransition=function(){return k.H.useTransition()},mt.version="19.2.4",mt}var uE;function jb(){return uE||(uE=1,Dy.exports=k3()),Dy.exports}var v=jb();const Ln=sm(v),wb=R3({__proto__:null,default:Ln},[v]);var yp="right-scroll-bar-position",xp="width-before-scroll-bar",P3="with-scroll-bars-hidden",N3="--removed-body-scroll-bar-size";function Ay(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function O3(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var M3=typeof window<"u"?v.useLayoutEffect:v.useEffect,dE=new WeakMap;function L3(e,t){var n=O3(null,function(r){return e.forEach(function(i){return Ay(i,r)})});return M3(function(){var r=dE.get(n);if(r){var i=new Set(r),s=new Set(e),c=n.current;i.forEach(function(u){s.has(u)||Ay(u,null)}),s.forEach(function(u){i.has(u)||Ay(u,c)})}dE.set(n,e)},[e]),n}function I3(e){return e}function z3(e,t){t===void 0&&(t=I3);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var c=t(s,r);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(s){for(r=!0;n.length;){var c=n;n=[],c.forEach(s)}n={push:function(u){return s(u)},filter:function(){return n}}},assignMedium:function(s){r=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(s),c=n}var f=function(){var m=c;c=[],m.forEach(s)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(m){c.push(m),h()},filter:function(m){return c=c.filter(m),n}}}};return i}function $3(e){e===void 0&&(e={});var t=z3(null);return t.options=_o({async:!0,ssr:!1},e),t}var W_=function(e){var t=e.sideCar,n=G_(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,_o({},n))};W_.isSideCarExport=!0;function U3(e,t){return e.useMedium(t),W_}var Q_=$3(),ky=function(){},lm=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:ky,onWheelCapture:ky,onTouchMoveCapture:ky}),i=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,m=e.enabled,g=e.shards,y=e.sideCar,x=e.noRelative,S=e.noIsolation,w=e.inert,C=e.allowPinchZoom,T=e.as,R=T===void 0?"div":T,E=e.gapMode,_=G_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=y,O=L3([n,t]),k=_o(_o({},_),i);return v.createElement(v.Fragment,null,m&&v.createElement(P,{sideCar:Q_,removeScrollBar:h,shards:g,noRelative:x,noIsolation:S,inert:w,setCallbacks:s,allowPinchZoom:!!C,lockRef:n,gapMode:E}),c?v.cloneElement(v.Children.only(u),_o(_o({},k),{ref:O})):v.createElement(R,_o({},k,{className:f,ref:O}),u))});lm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};lm.classNames={fullWidth:xp,zeroRight:yp};var B3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function V3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=B3();return t&&e.setAttribute("nonce",t),e}function F3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function H3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var q3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=V3())&&(F3(t,n),H3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},G3=function(){var e=q3();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Y_=function(){var e=G3(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},W3={left:0,top:0,right:0,gap:0},Py=function(e){return parseInt(e||"",10)||0},Q3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Py(n),Py(r),Py(i)]},Y3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return W3;var t=Q3(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},K3=Y_(),Qc="data-scroll-locked",X3=function(e,t,n,r){var i=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
2
+ .`.concat(P3,` {
3
+ overflow: hidden `).concat(r,`;
4
+ padding-right: `).concat(u,"px ").concat(r,`;
5
+ }
6
+ body[`).concat(Qc,`] {
7
+ overflow: hidden `).concat(r,`;
8
+ overscroll-behavior: contain;
9
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
10
+ padding-left: `.concat(i,`px;
11
+ padding-top: `).concat(s,`px;
12
+ padding-right: `).concat(c,`px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: `).concat(u,"px ").concat(r,`;
16
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
17
+ }
18
+
19
+ .`).concat(yp,` {
20
+ right: `).concat(u,"px ").concat(r,`;
21
+ }
22
+
23
+ .`).concat(xp,` {
24
+ margin-right: `).concat(u,"px ").concat(r,`;
25
+ }
26
+
27
+ .`).concat(yp," .").concat(yp,` {
28
+ right: 0 `).concat(r,`;
29
+ }
30
+
31
+ .`).concat(xp," .").concat(xp,` {
32
+ margin-right: 0 `).concat(r,`;
33
+ }
34
+
35
+ body[`).concat(Qc,`] {
36
+ `).concat(N3,": ").concat(u,`px;
37
+ }
38
+ `)},fE=function(){var e=parseInt(document.body.getAttribute(Qc)||"0",10);return isFinite(e)?e:0},J3=function(){v.useEffect(function(){return document.body.setAttribute(Qc,(fE()+1).toString()),function(){var e=fE()-1;e<=0?document.body.removeAttribute(Qc):document.body.setAttribute(Qc,e.toString())}},[])},Z3=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;J3();var s=v.useMemo(function(){return Y3(i)},[i]);return v.createElement(K3,{styles:X3(s,!t,i,n?"":"!important")})},_x=!1;if(typeof window<"u")try{var Zh=Object.defineProperty({},"passive",{get:function(){return _x=!0,!0}});window.addEventListener("test",Zh,Zh),window.removeEventListener("test",Zh,Zh)}catch{_x=!1}var kc=_x?{passive:!1}:!1,eM=function(e){return e.tagName==="TEXTAREA"},K_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eM(e)&&n[t]==="visible")},tM=function(e){return K_(e,"overflowY")},nM=function(e){return K_(e,"overflowX")},hE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=X_(e,r);if(i){var s=J_(e,r),c=s[1],u=s[2];if(c>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},rM=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},iM=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},X_=function(e,t){return e==="v"?tM(t):nM(t)},J_=function(e,t){return e==="v"?rM(t):iM(t)},oM=function(e,t){return e==="h"&&t==="rtl"?-1:1},aM=function(e,t,n,r,i){var s=oM(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),h=!1,m=c>0,g=0,y=0;do{if(!u)break;var x=J_(e,u),S=x[0],w=x[1],C=x[2],T=w-C-s*S;(S||T)&&X_(e,u)&&(g+=T,y+=S);var R=u.parentNode;u=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(m&&Math.abs(g)<1||!m&&Math.abs(y)<1)&&(h=!0),h},ep=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pE=function(e){return[e.deltaX,e.deltaY]},mE=function(e){return e&&"current"in e?e.current:e},sM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lM=function(e){return`
39
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
40
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
+ `)},cM=0,Pc=[];function uM(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(cM++)[0],s=v.useState(Y_)[0],c=v.useRef(e);v.useEffect(function(){c.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=A3([e.lockRef.current],(e.shards||[]).map(mE),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=v.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!c.current.allowPinchZoom;var T=ep(w),R=n.current,E="deltaX"in w?w.deltaX:R[0]-T[0],_="deltaY"in w?w.deltaY:R[1]-T[1],P,O=w.target,k=Math.abs(E)>Math.abs(_)?"h":"v";if("touches"in w&&k==="h"&&O.type==="range")return!1;var A=window.getSelection(),z=A&&A.anchorNode,U=z?z===O||z.contains(O):!1;if(U)return!1;var K=hE(k,O);if(!K)return!0;if(K?P=k:(P=k==="v"?"h":"v",K=hE(k,O)),!K)return!1;if(!r.current&&"changedTouches"in w&&(E||_)&&(r.current=P),!P)return!0;var W=r.current||P;return aM(W,C,w,W==="h"?E:_)},[]),f=v.useCallback(function(w){var C=w;if(!(!Pc.length||Pc[Pc.length-1]!==s)){var T="deltaY"in C?pE(C):ep(C),R=t.current.filter(function(P){return P.name===C.type&&(P.target===C.target||C.target===P.shadowParent)&&sM(P.delta,T)})[0];if(R&&R.should){C.cancelable&&C.preventDefault();return}if(!R){var E=(c.current.shards||[]).map(mE).filter(Boolean).filter(function(P){return P.contains(C.target)}),_=E.length>0?u(C,E[0]):!c.current.noIsolation;_&&C.cancelable&&C.preventDefault()}}},[]),h=v.useCallback(function(w,C,T,R){var E={name:w,delta:C,target:T,should:R,shadowParent:dM(T)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(_){return _!==E})},1)},[]),m=v.useCallback(function(w){n.current=ep(w),r.current=void 0},[]),g=v.useCallback(function(w){h(w.type,pE(w),w.target,u(w,e.lockRef.current))},[]),y=v.useCallback(function(w){h(w.type,ep(w),w.target,u(w,e.lockRef.current))},[]);v.useEffect(function(){return Pc.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,kc),document.addEventListener("touchmove",f,kc),document.addEventListener("touchstart",m,kc),function(){Pc=Pc.filter(function(w){return w!==s}),document.removeEventListener("wheel",f,kc),document.removeEventListener("touchmove",f,kc),document.removeEventListener("touchstart",m,kc)}},[]);var x=e.removeScrollBar,S=e.inert;return v.createElement(v.Fragment,null,S?v.createElement(s,{styles:lM(i)}):null,x?v.createElement(Z3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fM=U3(Q_,uM);var Sl=v.forwardRef(function(e,t){return v.createElement(lm,_o({},e,{ref:t,sideCar:fM}))});Sl.classNames=lm.classNames;function hn(e){return Object.keys(e)}function Ny(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Cb(e,t){const n={...e},r=t;return Ny(e)&&Ny(t)&&Object.keys(t).forEach(i=>{Ny(r[i])&&i in e?n[i]=Cb(n[i],r[i]):n[i]=r[i]}),n}function hM(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function pM(e){return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:e.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function Od(e){const t=pM(e);return typeof t=="number"?t:typeof t=="string"?t.includes("calc")||t.includes("var")?t:t.includes("px")?Number(t.replace("px","")):t.includes("rem")?Number(t.replace("rem",""))*16:t.includes("em")?Number(t.replace("em",""))*16:Number(t):NaN}function gE(e){return e==="0rem"?"0rem":`calc(${e} * var(--mantine-scale))`}function Z_(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return`0${e}`;if(typeof r=="number"){const i=`${r/16}${e}`;return t?gE(i):i}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(s=>n(s)).join(",");if(r.includes(" "))return r.split(" ").map(s=>n(s)).join(" ");const i=r.replace("px","");if(!Number.isNaN(Number(i))){const s=`${Number(i)/16}${e}`;return t?gE(s):s}}return r}return n}const ce=Z_("rem",{shouldScale:!0}),kp=Z_("em");function Es(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function e2(e){if(typeof e=="number")return!0;if(typeof e=="string"){if(e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!=="")return!0;const t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(r=>t.test(r))}return!1}function cm(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==v.Fragment:!1}function Or(e){const t=v.createContext(null);return[({children:i,value:s})=>a.jsx(t.Provider,{value:s,children:i}),()=>{const i=v.useContext(t);if(i===null)throw new Error(e);return i}]}function Fo(e=null){const t=v.createContext(e);return[({children:i,value:s})=>a.jsx(t.Provider,{value:s,children:i}),()=>v.useContext(t)]}function vE(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function Pp(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function mM(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].disabled)return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].disabled)return r}return e}function gM(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].disabled)return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].disabled)return r}return e}function vM(e,t,n){return Pp(e,n)===Pp(t,n)}function Eb({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:i=!1,dir:s="rtl",orientation:c}){return u=>{n?.(u);const f=Array.from(Pp(u.currentTarget,e)?.querySelectorAll(t)||[]).filter(S=>vM(u.currentTarget,S,e)),h=f.findIndex(S=>u.currentTarget===S),m=gM(h,f,r),g=mM(h,f,r),y=s==="rtl"?g:m,x=s==="rtl"?m:g;switch(u.key){case"ArrowRight":{c==="horizontal"&&(u.stopPropagation(),u.preventDefault(),f[y].focus(),i&&f[y].click());break}case"ArrowLeft":{c==="horizontal"&&(u.stopPropagation(),u.preventDefault(),f[x].focus(),i&&f[x].click());break}case"ArrowUp":{c==="vertical"&&(u.stopPropagation(),u.preventDefault(),f[g].focus(),i&&f[g].click());break}case"ArrowDown":{c==="vertical"&&(u.stopPropagation(),u.preventDefault(),f[m].focus(),i&&f[m].click());break}case"Home":{u.stopPropagation(),u.preventDefault(),!f[0].disabled&&f[0].focus();break}case"End":{u.stopPropagation(),u.preventDefault();const S=f.length-1;!f[S].disabled&&f[S].focus();break}}}}const yM={app:100,modal:200,popover:300,overlay:400,max:9999};function Br(e){return yM[e]}const Np=()=>{};function xM(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||Np:n=>{n.key==="Escape"&&(e(n),t.onTrigger?.())}}function ot(e,t="size",n=!0){if(e!==void 0)return e2(e)?n?ce(e):e:`var(--${t}-${e})`}function Yn(e){return ot(e,"mantine-spacing")}function Ht(e){return e===void 0?"var(--mantine-radius-default)":ot(e,"mantine-radius")}function Kn(e){return ot(e,"mantine-font-size")}function t2(e){return ot(e,"mantine-line-height",!1)}function Tb(e){if(e)return ot(e,"mantine-shadow",!1)}function pr(e,t){return n=>{e?.(n),t?.(n)}}function Rb(e,t){return e in t?Od(t[e]):Od(e)}function Md(e,t){const n=e.map(r=>({value:r,px:Rb(r,t)}));return n.sort((r,i)=>r.px-i.px),n}function ro(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function bM(e,t,n){return n?Array.from(Pp(n,t)?.querySelectorAll(e)||[]).findIndex(r=>r===n):null}function Dd(e,t,n){return t===void 0&&n===void 0?e:t!==void 0&&n===void 0?Math.max(e,t):Math.min(t===void 0&&n!==void 0?e:Math.max(e,t),n)}function Op(e="mantine-"){return`${e}${Math.random().toString(36).slice(2,11)}`}function SM(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;const n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i<r;i+=1){const s=n[i];if(!(s in t)||e[s]!==t[s]&&!(Number.isNaN(e[s])&&Number.isNaN(t[s])))return!1}return!0}function yE(e){return typeof e!="string"?"":e.charAt(0).toUpperCase()+e.slice(1)}function ll(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...n)=>t.current?.(...n)),[])}function of(e,t){const{delay:n,flushOnUnmount:r,leading:i}=typeof t=="number"?{delay:t,flushOnUnmount:!1,leading:!1}:t,s=ll(e),c=v.useRef(0),u=v.useMemo(()=>{const f=Object.assign((...h)=>{window.clearTimeout(c.current);const m=f._isFirstCall;f._isFirstCall=!1;function g(){window.clearTimeout(c.current),c.current=0,f._isFirstCall=!0}if(i&&m){s(...h);const S=()=>{g()},w=()=>{c.current!==0&&(g(),s(...h))},C=()=>{g()};f.flush=w,f.cancel=C,c.current=window.setTimeout(S,n);return}if(i&&!m){const S=()=>{c.current!==0&&(g(),s(...h))},w=()=>{g()};f.flush=S,f.cancel=w;const C=()=>{g()};c.current=window.setTimeout(C,n);return}const y=()=>{c.current!==0&&(g(),s(...h))},x=()=>{g()};f.flush=y,f.cancel=x,c.current=window.setTimeout(y,n)},{flush:()=>{},cancel:()=>{},_isFirstCall:!0});return f},[s,n,i]);return v.useEffect(()=>()=>{r?u.flush():u.cancel()},[u,r]),u}const jM=["mousedown","touchstart"];function wM(e,t,n){const r=v.useRef(null),i=t||jM;return v.useEffect(()=>{const s=c=>{const{target:u}=c??{};if(Array.isArray(n)){const f=!document.body.contains(u)&&u?.tagName!=="HTML";n.every(m=>!!m&&!c.composedPath().includes(m))&&!f&&e(c)}else r.current&&!r.current.contains(u)&&e(c)};return i.forEach(c=>document.addEventListener(c,s)),()=>{i.forEach(c=>document.removeEventListener(c,s))}},[r,e,n]),r}function n2(e={timeout:2e3}){const[t,n]=v.useState(null),[r,i]=v.useState(!1),[s,c]=v.useState(null),u=m=>{window.clearTimeout(s),c(window.setTimeout(()=>i(!1),e.timeout)),i(m)};return{copy:m=>{"clipboard"in navigator?navigator.clipboard.writeText(m).then(()=>u(!0)).catch(g=>n(g)):n(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{i(!1),n(null),window.clearTimeout(s)},error:t,copied:r}}function CM(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function EM(e,t){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function r2(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,i]=v.useState(n?t:EM(e));return v.useEffect(()=>{try{const s=window.matchMedia(e);return i(s.matches),CM(s,c=>i(c.matches))}catch{return}},[e]),r||!1}function TM(e,t){return r2("(prefers-color-scheme: dark)",e==="dark",t)?"dark":"light"}const Ol=typeof document<"u"?v.useLayoutEffect:v.useEffect;function jl(e,t){const n=v.useRef(!1);v.useEffect(()=>()=>{n.current=!1},[]),v.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function i2({opened:e,shouldReturnFocus:t=!0}){const n=v.useRef(null),r=()=>{n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&n.current?.focus({preventScroll:!0})};return jl(()=>{let i=-1;const s=c=>{c.key==="Tab"&&window.clearTimeout(i)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(i=window.setTimeout(r,10)),()=>{window.clearTimeout(i),document.removeEventListener("keydown",s)}},[e,t]),r}const RM=/input|select|textarea|button|object/,o2="a, input, select, textarea, button, object, [tabindex]";function _M(e){return e.style.display==="none"}function DM(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(_M(n))return!1;n=n.parentNode}return!0}function a2(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function Dx(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(a2(e));return(RM.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&DM(e)}function s2(e){const t=a2(e);return(Number.isNaN(t)||t>=0)&&Dx(e)}function AM(e){return Array.from(e.querySelectorAll(o2)).filter(s2)}function kM(e,t){const n=AM(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],i=e.getRootNode();let s=r===i.activeElement||e===i.activeElement;const c=i.activeElement;if(c.tagName==="INPUT"&&c.getAttribute("type")==="radio"&&(s=n.filter(m=>m.getAttribute("type")==="radio"&&m.getAttribute("name")===c.getAttribute("name")).includes(r)),!s)return;t.preventDefault();const f=n[t.shiftKey?n.length-1:0];f&&f.focus()}function PM(e=!0){const t=v.useRef(null),n=i=>{let s=i.querySelector("[data-autofocus]");if(!s){const c=Array.from(i.querySelectorAll(o2));s=c.find(s2)||c.find(Dx)||null,!s&&Dx(i)&&(s=i)}s&&s.focus({preventScroll:!0})},r=v.useCallback(i=>{e&&i!==null&&t.current!==i&&(i?(setTimeout(()=>{i.getRootNode()&&n(i)}),t.current=i):t.current=null)},[e]);return v.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>n(t.current));const i=s=>{s.key==="Tab"&&t.current&&kM(t.current,s)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e]),r}const NM=e=>(e+1)%1e6;function OM(){const[,e]=v.useReducer(NM,0);return e}const MM=Ln.useId||(()=>{});function LM(){const e=MM();return e?`mantine-${e.replace(/:/g,"")}`:""}function vr(e){const t=LM(),[n,r]=v.useState(t);return Ol(()=>{r(Op())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function l2(e,t,n){v.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function Ld(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function IM(...e){const t=new Map;return n=>{if(e.forEach(r=>{const i=Ld(r,n);i&&t.set(r,i)}),t.size>0)return()=>{e.forEach(r=>{const i=t.get(r);i&&typeof i=="function"?i():Ld(r,null)}),t.clear()}}}function Vn(...e){return v.useCallback(IM(...e),e)}function or({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[i,s]=v.useState(t!==void 0?t:n),c=(u,...f)=>{s(u),r?.(u,...f)};return e!==void 0?[e,r,!0]:[i,c,!1]}function as(e,t){const n=t-e+1;return Array.from({length:n},(r,i)=>i+e)}const tp="dots";function zM({total:e,siblings:t=1,boundaries:n=1,page:r,initialPage:i=1,onChange:s}){const c=Math.max(Math.trunc(e),0),[u,f]=or({value:r,onChange:s,defaultValue:i,finalValue:i}),h=w=>{w<=0?f(1):w>c?f(c):f(w)},m=()=>h(u+1),g=()=>h(u-1),y=()=>h(1),x=()=>h(c);return{range:v.useMemo(()=>{if(t*2+3+n*2>=c)return as(1,c);const C=Math.max(u-t,n),T=Math.min(u+t,c-n),R=C>n+2,E=T<c-(n+1);if(!R&&E){const _=t*2+n+2;return[...as(1,_),tp,...as(c-(n-1),c)]}if(R&&!E){const _=n+1+2*t;return[...as(1,n),tp,...as(c-_,c)]}return[...as(1,n),tp,...as(C,T),tp,...as(c-n+1,c)]},[c,t,u]),active:u,setPage:h,next:m,previous:g,first:y,last:x}}function _b(e,t){return r2("(prefers-reduced-motion: reduce)",e,t)}function $M(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!SM(e[n],t[n]))return!1;return!0}function UM(e){const t=v.useRef([]),n=v.useRef(0);return $M(t.current,e)||(t.current=e,n.current+=1),[n.current]}function BM(e,t){v.useEffect(e,UM(t))}const VM={" ":"space",ArrowLeft:"arrowleft",ArrowRight:"arrowright",ArrowUp:"arrowup",ArrowDown:"arrowdown",Escape:"escape",Esc:"escape",esc:"escape",Enter:"enter",Tab:"tab",Backspace:"backspace",Delete:"delete",Insert:"insert",Home:"home",End:"end",PageUp:"pageup",PageDown:"pagedown","+":"plus","-":"minus","*":"asterisk","/":"slash"};function np(e){const t=e.replace("Key","").toLowerCase();return VM[e]||t}function FM(e){const t=e.toLowerCase().split("+").map(s=>s.trim()),n={alt:t.includes("alt"),ctrl:t.includes("ctrl"),meta:t.includes("meta"),mod:t.includes("mod"),shift:t.includes("shift"),plus:t.includes("[plus]")},r=["alt","ctrl","meta","shift","mod"],i=t.find(s=>!r.includes(s));return{...n,key:i==="[plus]"?"+":i}}function HM(e,t,n){const{alt:r,ctrl:i,meta:s,mod:c,shift:u,key:f}=e,{altKey:h,ctrlKey:m,metaKey:g,shiftKey:y,key:x,code:S}=t;if(r!==h)return!1;if(c){if(!m&&!g)return!1}else if(i!==m||s!==g)return!1;return u!==y?!1:!!(f&&(n?np(S)===np(f):np(x??S)===np(f)))}function qM(e,t){return n=>HM(FM(e),n,t)}function GM(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function WM(e,t=["INPUT","TEXTAREA","SELECT"],n=!1){v.useEffect(()=>{const r=i=>{e.forEach(([s,c,u={preventDefault:!0,usePhysicalKeys:!1}])=>{qM(s,u.usePhysicalKeys)(i)&&GM(i,t,n)&&(u.preventDefault&&i.preventDefault(),c(i))})};return document.documentElement.addEventListener("keydown",r),()=>document.documentElement.removeEventListener("keydown",r)},[e])}function Ts(e=!1,t={}){const[n,r]=v.useState(e),i=v.useCallback(()=>{r(u=>u||(t.onOpen?.(),!0))},[t.onOpen]),s=v.useCallback(()=>{r(u=>u&&(t.onClose?.(),!1))},[t.onClose]),c=v.useCallback(()=>{n?s():i()},[s,i,n]);return[n,{open:i,close:s,toggle:c}]}function QM(e,t,n={autoInvoke:!1}){const r=v.useRef(null),i=v.useCallback((...c)=>{r.current||(r.current=window.setTimeout(()=>{e(c),r.current=null},t))},[t]),s=v.useCallback(()=>{r.current&&(window.clearTimeout(r.current),r.current=null)},[]);return v.useEffect(()=>(n.autoInvoke&&i(),s),[s,i]),{start:i,clear:s}}function YM(e,t,n){const r=v.useRef(null),i=v.useRef(null);return v.useEffect(()=>{const s=typeof n=="function"?n():n;return(s||i.current)&&(r.current=new MutationObserver(e),r.current.observe(s||i.current,t)),()=>{r.current?.disconnect()}},[e,t]),i}function KM(){const[e,t]=v.useState(!1);return v.useEffect(()=>t(!0),[]),e}var XM={};function c2(){return typeof process<"u"&&XM?"production":"development"}function um(e){const t=Ln.version;return typeof Ln.version!="string"||t.startsWith("18.")?e?.ref:e?.props?.ref}function bp(e,t=document){const n=t.querySelector(e);if(n)return n;const r=t.querySelectorAll("*");for(let i=0;i<r.length;i+=1){const s=r[i];if(s.shadowRoot){const c=bp(e,s.shadowRoot);if(c)return c}}return null}function us(e,t=document){const n=[],r=t.querySelectorAll(e);n.push(...Array.from(r));const i=t.querySelectorAll("*");for(let s=0;s<i.length;s+=1){const c=i[s];if(c.shadowRoot){const u=us(e,c.shadowRoot);n.push(...u)}}return n}function ss(e){if(!e)return document;const t=e.getRootNode();return t instanceof ShadowRoot||t instanceof Document?t:document}function Ml(e){const t=v.Children.toArray(e);return t.length!==1||!cm(t[0])?null:t[0]}function u2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u2(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ft(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u2(e))&&(r&&(r+=" "),r+=t);return r}const JM={};function ZM(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,i])=>{t[r]?t[r]=Ft(t[r],i):t[r]=i})}),t}function af({theme:e,classNames:t,props:n,stylesCtx:r}){const s=(Array.isArray(t)?t:[t]).map(c=>typeof c=="function"?c(e,n,r):c||JM);return ZM(s)}function Id({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((s,c)=>typeof c=="function"?{...s,...c(e,n,r)}:{...s,...c},{})}const Db=v.createContext(null);function Ta(){const e=v.useContext(Db);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function e5(){return Ta().cssVariablesResolver}function t5(){return Ta().classNamesPrefix}function dm(){return Ta().getStyleNonce}function n5(){return Ta().withStaticClasses}function r5(){return Ta().headless}function i5(){return Ta().stylesTransform?.sx}function o5(){return Ta().stylesTransform?.styles}function fm(){return Ta().env||"default"}function a5(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function s5(e){let t=e.replace("#","");if(t.length===3){const c=t.split("");t=[c[0],c[0],c[1],c[1],c[2],c[2]].join("")}if(t.length===8){const c=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:c}}const n=parseInt(t,16),r=n>>16&255,i=n>>8&255,s=n&255;return{r,g:i,b:s,a:1}}function l5(e){const[t,n,r,i]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:i===void 0?1:i}}function c5(e){const t=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,n=e.match(t);if(!n)return{r:0,g:0,b:0,a:1};const r=parseInt(n[1],10),i=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100,c=n[5]?parseFloat(n[5]):void 0,u=(1-Math.abs(2*s-1))*i,f=r/60,h=u*(1-Math.abs(f%2-1)),m=s-u/2;let g,y,x;return f>=0&&f<1?(g=u,y=h,x=0):f>=1&&f<2?(g=h,y=u,x=0):f>=2&&f<3?(g=0,y=u,x=h):f>=3&&f<4?(g=0,y=h,x=u):f>=4&&f<5?(g=h,y=0,x=u):(g=u,y=0,x=h),{r:Math.round((g+m)*255),g:Math.round((y+m)*255),b:Math.round((x+m)*255),a:c||1}}function Ab(e){return a5(e)?s5(e):e.startsWith("rgb")?l5(e):e.startsWith("hsl")?c5(e):{r:0,g:0,b:0,a:1}}function rp(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:i,a:s}=Ab(e),c=1-t,u=f=>Math.round(f*c);return`rgba(${u(n)}, ${u(r)}, ${u(i)}, ${s})`}function zd(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function Oy(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function u5(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function d5(e){if(e.startsWith("oklch("))return(u5(e)||0)/100;const{r:t,g:n,b:r}=Ab(e),i=t/255,s=n/255,c=r/255,u=Oy(i),f=Oy(s),h=Oy(c);return .2126*u+.7152*f+.0722*h}function vd(e,t=.179){return e.startsWith("var(")?!1:d5(e)>t}function ei({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e==="bright")return{color:e,value:n==="dark"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:vd(n==="dark"?t.white:t.black,t.luminanceThreshold),variable:"--mantine-color-bright"};if(e==="dimmed")return{color:e,value:n==="dark"?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:vd(n==="dark"?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:"--mantine-color-dimmed"};if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:vd(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,i]=e.split("."),s=i?Number(i):void 0,c=r in t.colors;if(c){const u=s!==void 0?t.colors[r][s]:t.colors[r][zd(t,n||"light")];return{color:r,value:u,shade:s,isThemeColor:c,isLight:vd(u,t.luminanceThreshold),variable:i?`--mantine-color-${r}-${s}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:c,isLight:vd(e,t.luminanceThreshold),shade:s,variable:void 0}}function Kt(e,t){const n=ei({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function Ax(e,t){const n={from:e?.from||t.defaultGradient.from,to:e?.to||t.defaultGradient.to,deg:e?.deg??t.defaultGradient.deg??0},r=Kt(n.from,t),i=Kt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${i} 100%)`}function Ni(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const s=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${s}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:i}=Ab(e);return`rgba(${n}, ${r}, ${i}, ${t})`}const Nc=Ni,f5=({color:e,theme:t,variant:n,gradient:r,autoContrast:i})=>{const s=ei({color:e,theme:t}),c=typeof i=="boolean"?i:t.autoContrast;if(n==="none")return{background:"transparent",hover:"transparent",color:"inherit",border:"none"};if(n==="filled"){const u=c&&s.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return s.isThemeColor?s.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:u,border:`${ce(1)} solid transparent`}:{background:`var(--mantine-color-${s.color}-${s.shade})`,hover:`var(--mantine-color-${s.color}-${s.shade===9?8:s.shade+1})`,color:u,border:`${ce(1)} solid transparent`}:{background:e,hover:rp(e,.1),color:u,border:`${ce(1)} solid transparent`}}if(n==="light"){if(s.isThemeColor){if(s.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${ce(1)} solid transparent`};const u=t.colors[s.color][s.shade];return{background:Ni(u,.1),hover:Ni(u,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${ce(1)} solid transparent`}}return{background:Ni(e,.1),hover:Ni(e,.12),color:e,border:`${ce(1)} solid transparent`}}if(n==="outline")return s.isThemeColor?s.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${ce(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:Ni(t.colors[s.color][s.shade],.05),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${ce(1)} solid var(--mantine-color-${s.color}-${s.shade})`}:{background:"transparent",hover:Ni(e,.05),color:e,border:`${ce(1)} solid ${e}`};if(n==="subtle"){if(s.isThemeColor){if(s.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${ce(1)} solid transparent`};const u=t.colors[s.color][s.shade];return{background:"transparent",hover:Ni(u,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${ce(1)} solid transparent`}}return{background:"transparent",hover:Ni(e,.12),color:e,border:`${ce(1)} solid transparent`}}return n==="transparent"?s.isThemeColor?s.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${ce(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${ce(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${ce(1)} solid transparent`}:n==="white"?s.isThemeColor?s.shade===void 0?{background:"var(--mantine-color-white)",hover:rp(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${ce(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:rp(t.white,.01),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${ce(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:rp(t.white,.01),color:e,border:`${ce(1)} solid transparent`}:n==="gradient"?{background:Ax(r,t),hover:Ax(r,t),color:"var(--mantine-color-white)",border:"none"}:n==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${ce(1)} solid var(--mantine-color-default-border)`}:{}},h5={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},xE="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",kb={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:h5,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:f5,autoContrast:!1,luminanceThreshold:.3,fontFamily:xE,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:xE,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:ce(34),lineHeight:"1.3"},h2:{fontSize:ce(26),lineHeight:"1.35"},h3:{fontSize:ce(22),lineHeight:"1.4"},h4:{fontSize:ce(18),lineHeight:"1.45"},h5:{fontSize:ce(16),lineHeight:"1.5"},h6:{fontSize:ce(14),lineHeight:"1.5"}}},fontSizes:{xs:ce(12),sm:ce(14),md:ce(16),lg:ce(18),xl:ce(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:ce(2),sm:ce(4),md:ce(8),lg:ce(16),xl:ce(32)},spacing:{xs:ce(10),sm:ce(12),md:ce(16),lg:ce(20),xl:ce(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${ce(1)} ${ce(3)} rgba(0, 0, 0, 0.05), 0 ${ce(1)} ${ce(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${ce(1)} ${ce(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${ce(10)} ${ce(15)} ${ce(-5)}, rgba(0, 0, 0, 0.04) 0 ${ce(7)} ${ce(7)} ${ce(-5)}`,md:`0 ${ce(1)} ${ce(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${ce(20)} ${ce(25)} ${ce(-5)}, rgba(0, 0, 0, 0.04) 0 ${ce(10)} ${ce(10)} ${ce(-5)}`,lg:`0 ${ce(1)} ${ce(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${ce(28)} ${ce(23)} ${ce(-7)}, rgba(0, 0, 0, 0.04) 0 ${ce(12)} ${ce(12)} ${ce(-7)}`,xl:`0 ${ce(1)} ${ce(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${ce(36)} ${ce(28)} ${ce(-7)}, rgba(0, 0, 0, 0.04) 0 ${ce(17)} ${ce(17)} ${ce(-7)}`},other:{},components:{}};function bE(e){return e==="auto"||e==="dark"||e==="light"}function p5({key:e="mantine-color-scheme-value"}={}){let t;return{get:n=>{if(typeof window>"u")return n;try{const r=window.localStorage.getItem(e);return bE(r)?r:n}catch{return n}},set:n=>{try{window.localStorage.setItem(e,n)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:n=>{t=r=>{r.storageArea===window.localStorage&&r.key===e&&bE(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const m5="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",SE="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function My(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function jE(e){if(!(e.primaryColor in e.colors))throw new Error(m5);if(typeof e.primaryShade=="object"&&(!My(e.primaryShade.dark)||!My(e.primaryShade.light)))throw new Error(SE);if(typeof e.primaryShade=="number"&&!My(e.primaryShade))throw new Error(SE)}function g5(e,t){if(!t)return jE(e),e;const n=Cb(e,t);return t.fontFamily&&!t.headings?.fontFamily&&(n.headings.fontFamily=t.fontFamily),jE(n),n}const Pb=v.createContext(null),v5=()=>v.useContext(Pb)||kb;function Nn(){const e=v.useContext(Pb);if(!e)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return e}function d2({theme:e,children:t,inherit:n=!0}){const r=v5(),i=v.useMemo(()=>g5(n?r:kb,e),[e,r,n]);return a.jsx(Pb.Provider,{value:i,children:t})}d2.displayName="@mantine/core/MantineThemeProvider";function y5(){const e=Nn(),t=dm(),n=hn(e.breakpoints).reduce((r,i)=>{const s=e.breakpoints[i].includes("px"),c=Od(e.breakpoints[i]),u=s?`${c-.1}px`:kp(c-.1),f=s?`${c}px`:kp(c);return`${r}@media (max-width: ${u}) {.mantine-visible-from-${i} {display: none !important;}}@media (min-width: ${f}) {.mantine-hidden-from-${i} {display: none !important;}}`},"");return a.jsx("style",{"data-mantine-styles":"classes",nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function Ly(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function f2(e,t){const n=t?[t]:[":root",":host"],r=Ly(e.variables),i=r?`${n.join(", ")}{${r}}`:"",s=Ly(e.dark),c=Ly(e.light),u=m=>n.map(g=>g===":host"?`${g}([data-mantine-color-scheme="${m}"])`:`${g}[data-mantine-color-scheme="${m}"]`).join(", "),f=s?`${u("dark")}{${s}}`:"",h=c?`${u("light")}{${c}}`:"";return`${i}
42
+
43
+ ${f}
44
+
45
+ ${h}`}function Ra({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&ei({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function wE(e,t){return Ra({color:e.colors[e.primaryColor][zd(e,t)],theme:e,autoContrast:null})}function ip({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:i=!0}){if(!e.colors[t])return{};if(n==="light"){const u=zd(e,"light"),f={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${u})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${u===9?8:u+1})`,[`--mantine-color-${r}-light`]:Nc(e.colors[t][u],.1),[`--mantine-color-${r}-light-hover`]:Nc(e.colors[t][u],.12),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${u})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${u})`,[`--mantine-color-${r}-outline-hover`]:Nc(e.colors[t][u],.05)};return i?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...f}:f}const s=zd(e,"dark"),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${s})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${s===9?8:s+1})`,[`--mantine-color-${r}-light`]:Nc(e.colors[t][Math.max(0,s-2)],.15),[`--mantine-color-${r}-light-hover`]:Nc(e.colors[t][Math.max(0,s-2)],.2),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${Math.max(s-5,0)})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(s-4,0)})`,[`--mantine-color-${r}-outline-hover`]:Nc(e.colors[t][Math.max(s-4,0)],.05)};return i?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}function x5(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function Oc(e,t,n){hn(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const h2=e=>{const t=zd(e,"light"),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:ce(e.defaultRadius),r={variables:{"--mantine-z-index-app":"100","--mantine-z-index-modal":"200","--mantine-z-index-popover":"300","--mantine-z-index-overlay":"400","--mantine-z-index-max":"9999","--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":"light","--mantine-primary-color-contrast":wE(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)","--mantine-color-disabled":"var(--mantine-color-gray-2)","--mantine-color-disabled-color":"var(--mantine-color-gray-5)","--mantine-color-disabled-border":"var(--mantine-color-gray-3)"},dark:{"--mantine-color-scheme":"dark","--mantine-primary-color-contrast":wE(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)","--mantine-color-disabled":"var(--mantine-color-dark-6)","--mantine-color-disabled-color":"var(--mantine-color-dark-3)","--mantine-color-disabled-border":"var(--mantine-color-dark-4)"}};Oc(r.variables,e.breakpoints,"breakpoint"),Oc(r.variables,e.spacing,"spacing"),Oc(r.variables,e.fontSizes,"font-size"),Oc(r.variables,e.lineHeights,"line-height"),Oc(r.variables,e.shadows,"shadow"),Oc(r.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((s,c)=>{r.variables[`--mantine-primary-color-${c}`]=`var(--mantine-color-${e.primaryColor}-${c})`}),hn(e.colors).forEach(s=>{const c=e.colors[s];if(x5(c)){Object.assign(r.light,ip({theme:e,name:c.name,color:c.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,ip({theme:e,name:c.name,color:c.dark,colorScheme:"dark",withColorValues:!0}));return}c.forEach((u,f)=>{r.variables[`--mantine-color-${s}-${f}`]=u}),Object.assign(r.light,ip({theme:e,color:s,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,ip({theme:e,color:s,colorScheme:"dark",withColorValues:!1}))});const i=e.headings.sizes;return hn(i).forEach(s=>{r.variables[`--mantine-${s}-font-size`]=i[s].fontSize,r.variables[`--mantine-${s}-line-height`]=i[s].lineHeight,r.variables[`--mantine-${s}-font-weight`]=i[s].fontWeight||e.headings.fontWeight}),r};function b5({theme:e,generator:t}){const n=h2(e),r=t?.(e);return r?Cb(n,r):n}const Iy=h2(kb);function S5(e){const t={variables:{},light:{},dark:{}};return hn(e.variables).forEach(n=>{Iy.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),hn(e.light).forEach(n=>{Iy.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),hn(e.dark).forEach(n=>{Iy.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function j5(e){return f2({variables:{},dark:{"--mantine-color-scheme":"dark"},light:{"--mantine-color-scheme":"light"}},e)}function p2({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=Nn(),r=dm(),i=e5(),s=b5({theme:n,generator:i}),c=(e===void 0||e===":root"||e===":host")&&t,u=c?S5(s):s,f=f2(u,e);return f?a.jsx("style",{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${f}${c?"":j5(e)}`}}):null}p2.displayName="@mantine/CssVariables";function Mc(e,t){const n=typeof window<"u"&&"matchMedia"in window&&window.matchMedia("(prefers-color-scheme: dark)")?.matches,r=e!=="auto"?e:n?"dark":"light";t()?.setAttribute("data-mantine-color-scheme",r)}function w5({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const i=v.useRef(null),[s,c]=v.useState(()=>e.get(t)),u=r||s,f=v.useCallback(m=>{r||(Mc(m,n),c(m),e.set(m))},[e.set,u,r]),h=v.useCallback(()=>{c(t),Mc(t,n),e.clear()},[e.clear,t]);return v.useEffect(()=>(e.subscribe(f),e.unsubscribe),[e.subscribe,e.unsubscribe]),Ol(()=>{Mc(e.get(t),n)},[]),v.useEffect(()=>{if(r)return Mc(r,n),()=>{};r===void 0&&Mc(s,n),typeof window<"u"&&"matchMedia"in window&&(i.current=window.matchMedia("(prefers-color-scheme: dark)"));const m=g=>{s==="auto"&&Mc(g.matches?"dark":"light",n)};return i.current?.addEventListener("change",m),()=>i.current?.removeEventListener("change",m)},[s,r]),{colorScheme:u,setColorScheme:f,clearColorScheme:h}}function C5({respectReducedMotion:e,getRootElement:t}){Ol(()=>{e&&t()?.setAttribute("data-respect-reduced-motion","true")},[e])}function m2({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:i=!0,deduplicateCssVariables:s=!0,withCssVariables:c=!0,cssVariablesSelector:u,classNamesPrefix:f="mantine",colorSchemeManager:h=p5(),defaultColorScheme:m="light",getRootElement:g=()=>document.documentElement,cssVariablesResolver:y,forceColorScheme:x,stylesTransform:S,env:w}){const{colorScheme:C,setColorScheme:T,clearColorScheme:R}=w5({defaultColorScheme:m,forceColorScheme:x,manager:h,getRootElement:g});return C5({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:g}),a.jsx(Db.Provider,{value:{colorScheme:C,setColorScheme:T,clearColorScheme:R,getRootElement:g,classNamesPrefix:f,getStyleNonce:n,cssVariablesResolver:y,cssVariablesSelector:u??":root",withStaticClasses:r,stylesTransform:S,env:w},children:a.jsxs(d2,{theme:e,children:[c&&a.jsx(p2,{cssVariablesSelector:u,deduplicateCssVariables:s}),i&&a.jsx(y5,{}),t]})})}m2.displayName="@mantine/core/MantineProvider";function Ll({classNames:e,styles:t,props:n,stylesCtx:r}){const i=Nn();return{resolvedClassNames:af({theme:i,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:Id({theme:i,styles:t,props:n,stylesCtx:r||void 0})}}const E5={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function T5({theme:e,options:t,unstyled:n}){return Ft(t?.focusable&&!n&&(e.focusClassName||E5[e.focusRing]),t?.active&&!n&&e.activeClassName)}function R5({selector:e,stylesCtx:t,options:n,props:r,theme:i}){return af({theme:i,classNames:n?.classNames,props:n?.props||r,stylesCtx:t})[e]}function CE({selector:e,stylesCtx:t,theme:n,classNames:r,props:i}){return af({theme:n,classNames:r,props:i,stylesCtx:t})[e]}function _5({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function D5({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function A5({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(i=>`${t}-${i}-${n}`)}function k5({themeName:e,theme:t,selector:n,props:r,stylesCtx:i}){return e.map(s=>af({theme:t,classNames:t.components[s]?.classNames,props:r,stylesCtx:i})?.[n])}function P5({options:e,classes:t,selector:n,unstyled:r}){return e?.variant&&!r?t[`${n}--${e.variant}`]:void 0}function N5({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:i,classNames:s,classes:c,unstyled:u,className:f,rootSelector:h,props:m,stylesCtx:g,withStaticClasses:y,headless:x,transformedStyles:S}){return Ft(T5({theme:e,options:t,unstyled:u||x}),k5({theme:e,themeName:n,selector:r,props:m,stylesCtx:g}),P5({options:t,classes:c,selector:r,unstyled:u}),CE({selector:r,stylesCtx:g,theme:e,classNames:s,props:m}),CE({selector:r,stylesCtx:g,theme:e,classNames:S,props:m}),R5({selector:r,stylesCtx:g,options:t,props:m,theme:e}),_5({rootSelector:h,selector:r,className:f}),D5({selector:r,classes:c,unstyled:u||x}),y&&!x&&A5({themeName:n,classNamesPrefix:i,selector:r,withStaticClass:t?.withStaticClass}),t?.className)}function O5({theme:e,themeName:t,props:n,stylesCtx:r,selector:i}){return t.map(s=>Id({theme:e,styles:e.components[s]?.styles,props:n,stylesCtx:r})[i]).reduce((s,c)=>({...s,...c}),{})}function kx({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...kx({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function M5(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...Es(n[r])}}),t),{})}function L5({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:i,selector:s,themeName:c,headless:u}){return M5([u?{}:t?.(n,r,i),...c.map(f=>n.components?.[f]?.vars?.(n,r,i)),e?.(n,r,i)])?.[s]}function I5({theme:e,themeName:t,selector:n,options:r,props:i,stylesCtx:s,rootSelector:c,styles:u,style:f,vars:h,varsResolver:m,headless:g,withStylesTransform:y}){return{...!y&&O5({theme:e,themeName:t,props:i,stylesCtx:s,selector:n}),...!y&&Id({theme:e,styles:u,props:i,stylesCtx:s})[n],...!y&&Id({theme:e,styles:r?.styles,props:r?.props||i,stylesCtx:s})[n],...L5({theme:e,props:i,stylesCtx:s,vars:h,varsResolver:m,selector:n,themeName:t,headless:g}),...c===n?kx({style:f,theme:e}):null,...kx({style:r?.style,theme:e})}}function z5({props:e,stylesCtx:t,themeName:n}){const r=Nn(),i=o5()?.();return{getTransformedStyles:c=>i?[...c.map(f=>i(f,{props:e,theme:r,ctx:t})),...n.map(f=>i(r.components[f]?.styles,{props:e,theme:r,ctx:t}))].filter(Boolean):[],withStylesTransform:!!i}}function $e({name:e,classes:t,props:n,stylesCtx:r,className:i,style:s,rootSelector:c="root",unstyled:u,classNames:f,styles:h,vars:m,varsResolver:g,attributes:y}){const x=Nn(),S=t5(),w=n5(),C=r5(),T=(Array.isArray(e)?e:[e]).filter(_=>_),{withStylesTransform:R,getTransformedStyles:E}=z5({props:n,stylesCtx:r,themeName:T});return(_,P)=>({className:N5({theme:x,options:P,themeName:T,selector:_,classNamesPrefix:S,classNames:f,classes:t,unstyled:u,className:i,rootSelector:c,props:n,stylesCtx:r,withStaticClasses:w,headless:C,transformedStyles:E([P?.styles,h])}),style:I5({theme:x,themeName:T,selector:_,options:P,props:n,stylesCtx:r,rootSelector:c,styles:h,style:s,vars:m,varsResolver:g,headless:C,withStylesTransform:R}),...y?.[_]})}function Il(e,t){return typeof e=="boolean"?e:t.autoContrast}function EE(e){const t=document.createElement("style");return t.setAttribute("data-mantine-styles","inline"),t.innerHTML="*, *::before, *::after {transition: none !important;}",t.setAttribute("data-mantine-disable-transition","true"),e&&t.setAttribute("nonce",e),document.head.appendChild(t),()=>document.querySelectorAll("[data-mantine-disable-transition]").forEach(r=>r.remove())}function $5({keepTransitions:e}={}){const t=v.useRef(Np),n=v.useRef(-1),r=v.useContext(Db),i=dm(),s=v.useRef(i?.());if(!r)throw new Error("[@mantine/core] MantineProvider was not found in tree");const c=g=>{r.setColorScheme(g),t.current=e?()=>{}:EE(s.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},u=()=>{r.clearColorScheme(),t.current=e?()=>{}:EE(s.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},f=TM("light",{getInitialValueInEffect:!1}),h=r.colorScheme==="auto"?f:r.colorScheme,m=v.useCallback(()=>c(h==="light"?"dark":"light"),[c,h]);return v.useEffect(()=>()=>{t.current?.(),window.clearTimeout(n.current)},[]),{colorScheme:r.colorScheme,setColorScheme:c,clearColorScheme:u,toggleColorScheme:m}}function ae(e,t,n){const r=Nn(),i=r.components[e]?.defaultProps,s=typeof i=="function"?i(r):i;return{...t,...s,...Es(n)}}function zy(e){return hn(e).reduce((t,n)=>e[n]!==void 0?`${t}${hM(n)}:${e[n]};`:t,"").trim()}function U5({selector:e,styles:t,media:n,container:r}){const i=t?zy(t):"",s=Array.isArray(n)?n.map(u=>`@media${u.query}{${e}{${zy(u.styles)}}}`):[],c=Array.isArray(r)?r.map(u=>`@container ${u.query}{${e}{${zy(u.styles)}}}`):[];return`${i?`${e}{${i}}`:""}${s.join("")}${c.join("")}`.trim()}function zl(e){const t=dm();return a.jsx("style",{"data-mantine-styles":"inline",nonce:t?.(),dangerouslySetInnerHTML:{__html:U5(e)}})}function _a(e){const{m:t,mx:n,my:r,mt:i,mb:s,ml:c,mr:u,me:f,ms:h,p:m,px:g,py:y,pt:x,pb:S,pl:w,pr:C,pe:T,ps:R,bd:E,bdrs:_,bg:P,c:O,opacity:k,ff:A,fz:z,fw:U,lts:K,ta:W,lh:ee,fs:B,tt:G,td:L,w:I,miw:$,maw:V,h:X,mih:M,mah:F,bgsz:ie,bgp:de,bgr:Se,bga:Ce,pos:je,top:Ke,left:_e,bottom:ht,right:Ct,inset:Et,display:qe,flex:ct,hiddenFrom:Tt,visibleFrom:It,lightHidden:Te,darkHidden:Oe,sx:Le,...Ie}=e;return{styleProps:Es({m:t,mx:n,my:r,mt:i,mb:s,ml:c,mr:u,me:f,ms:h,p:m,px:g,py:y,pt:x,pb:S,pl:w,pr:C,pe:T,ps:R,bd:E,bg:P,c:O,opacity:k,ff:A,fz:z,fw:U,lts:K,ta:W,lh:ee,fs:B,tt:G,td:L,w:I,miw:$,maw:V,h:X,mih:M,mah:F,bgsz:ie,bgp:de,bgr:Se,bga:Ce,pos:je,top:Ke,left:_e,bottom:ht,right:Ct,inset:Et,display:qe,flex:ct,bdrs:_,hiddenFrom:Tt,visibleFrom:It,lightHidden:Te,darkHidden:Oe,sx:Le}),rest:Ie}}const B5={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bd:{type:"border",property:"border"},bdrs:{type:"radius",property:"borderRadius"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"size",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function Nb(e,t){const n=ei({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function V5(e,t){const n=ei({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:Nb(e,t)}function F5(e,t){if(typeof e=="number")return ce(e);if(typeof e=="string"){const[n,r,...i]=e.split(" ").filter(c=>c.trim()!=="");let s=`${ce(n)}`;return r&&(s+=` ${r}`),i.length>0&&(s+=` ${Nb(i.join(" "),t)}`),s.trim()}return e}const TE={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",monospace:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)",headings:"var(--mantine-font-family-headings)"};function H5(e){return typeof e=="string"&&e in TE?TE[e]:e}const q5=["h1","h2","h3","h4","h5","h6"];function G5(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&q5.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?ce(e):e}function W5(e){return e}const Q5=["h1","h2","h3","h4","h5","h6"];function Y5(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&Q5.includes(e)?`var(--mantine-${e}-line-height)`:e}function K5(e,t){return typeof e=="string"&&e in t.radius?`var(--mantine-radius-${e})`:typeof e=="number"||typeof e=="string"?ce(e):e}function X5(e){return typeof e=="number"?ce(e):e}function J5(e,t){if(typeof e=="number")return ce(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return ce(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const $y={color:Nb,textColor:V5,fontSize:G5,spacing:J5,radius:K5,identity:W5,size:X5,lineHeight:Y5,fontFamily:H5,border:F5};function RE(e){return e.replace("(min-width: ","").replace("em)","")}function Z5({media:e,...t}){const r=Object.keys(e).sort((i,s)=>Number(RE(i))-Number(RE(s))).map(i=>({query:i,styles:e[i]}));return{...t,media:r}}function e9(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function t9(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function n9(e){return typeof e=="object"&&e!==null?hn(e).filter(t=>t!=="base"):[]}function r9(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function g2({styleProps:e,data:t,theme:n}){return Z5(hn(e).reduce((r,i)=>{if(i==="hiddenFrom"||i==="visibleFrom"||i==="sx")return r;const s=t[i],c=Array.isArray(s.property)?s.property:[s.property],u=t9(e[i]);if(!e9(e[i]))return c.forEach(h=>{r.inlineStyles[h]=$y[s.type](u,n)}),r;r.hasResponsiveStyles=!0;const f=n9(e[i]);return c.forEach(h=>{u!=null&&(r.styles[h]=$y[s.type](u,n)),f.forEach(m=>{const g=`(min-width: ${n.breakpoints[m]})`;r.media[g]={...r.media[g],[h]:$y[s.type](r9(e[i],m),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function sf(){return`__m__-${v.useId().replace(/[:«»]/g,"")}`}function v2(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...v2(r,t)}),{}):typeof e=="function"?e(t):e??{}}function y2(e){return e.startsWith("data-")?e:`data-${e}`}function i9(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[y2(n)]=e[n]),t},{})}function x2(e){return e?typeof e=="string"?{[y2(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...x2(n)}),{}):i9(e):null}function Px(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...Px(r,t)}),{}):typeof e=="function"?e(t):e??{}}function o9({theme:e,style:t,vars:n,styleProps:r}){const i=Px(t,e),s=Px(n,e);return{...i,...s,...r}}const b2=v.forwardRef(({component:e,style:t,__vars:n,className:r,variant:i,mod:s,size:c,hiddenFrom:u,visibleFrom:f,lightHidden:h,darkHidden:m,renderRoot:g,__size:y,...x},S)=>{const w=Nn(),C=e||"div",{styleProps:T,rest:R}=_a(x),_=i5()?.()?.(T.sx),P=sf(),O=g2({styleProps:T,theme:w,data:B5}),k={ref:S,style:o9({theme:w,style:t,vars:n,styleProps:O.inlineStyles}),className:Ft(r,_,{[P]:O.hasResponsiveStyles,"mantine-light-hidden":h,"mantine-dark-hidden":m,[`mantine-hidden-from-${u}`]:u,[`mantine-visible-from-${f}`]:f}),"data-variant":i,"data-size":e2(c)?void 0:c||void 0,size:y,...x2(s),...R};return a.jsxs(a.Fragment,{children:[O.hasResponsiveStyles&&a.jsx(zl,{selector:`.${P}`,styles:O.styles,media:O.media}),typeof g=="function"?g(k):a.jsx(C,{...k})]})});b2.displayName="@mantine/core/Box";const le=b2;function S2(e){return e}function a9(e){const t=e;return n=>{const r=v.forwardRef((i,s)=>a.jsx(t,{...n,...i,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r}}function ve(e){const t=v.forwardRef(e);return t.extend=S2,t.withProps=n=>{const r=v.forwardRef((i,s)=>a.jsx(t,{...n,...i,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t}function sr(e){const t=v.forwardRef(e);return t.withProps=n=>{const r=v.forwardRef((i,s)=>a.jsx(t,{...n,...i,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t.extend=S2,t}const s9=v.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function Rs(){return v.useContext(s9)}var Uy={exports:{}},Tr={};var _E;function l9(){if(_E)return Tr;_E=1;var e=jb();function t(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)h+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(f,h,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:f,containerInfo:h,implementation:m}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Tr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Tr.createPortal=function(f,h){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return s(f,h,null,m)},Tr.flushSync=function(f){var h=c.T,m=r.p;try{if(c.T=null,r.p=2,f)return f()}finally{c.T=h,r.p=m,r.d.f()}},Tr.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(f,h))},Tr.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Tr.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var m=h.as,g=u(m,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,x=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;m==="style"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:x}):m==="script"&&r.d.X(f,{crossOrigin:g,integrity:y,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Tr.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var m=u(h.as,h.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(f)},Tr.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var m=h.as,g=u(m,h.crossOrigin);r.d.L(f,m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Tr.preloadModule=function(f,h){if(typeof f=="string")if(h){var m=u(h.as,h.crossOrigin);r.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(f)},Tr.requestFormReset=function(f){r.d.r(f)},Tr.unstable_batchedUpdates=function(f,h){return f(h)},Tr.useFormState=function(f,h,m){return c.H.useFormState(f,h,m)},Tr.useFormStatus=function(){return c.H.useHostTransitionStatus()},Tr.version="19.2.4",Tr}var DE;function j2(){if(DE)return Uy.exports;DE=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Uy.exports=l9(),Uy.exports}var Ob=j2();const Ed=sm(Ob);function hm(){return typeof window<"u"}function du(e){return w2(e)?(e.nodeName||"").toLowerCase():"#document"}function Jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ho(e){var t;return(t=(w2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function w2(e){return hm()?e instanceof Node||e instanceof Jr(e).Node:!1}function Dn(e){return hm()?e instanceof Element||e instanceof Jr(e).Element:!1}function pi(e){return hm()?e instanceof HTMLElement||e instanceof Jr(e).HTMLElement:!1}function Nx(e){return!hm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jr(e).ShadowRoot}const c9=new Set(["inline","contents"]);function lf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=zi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!c9.has(i)}const u9=new Set(["table","td","th"]);function d9(e){return u9.has(du(e))}const f9=[":popover-open",":modal"];function pm(e){return f9.some(t=>{try{return e.matches(t)}catch{return!1}})}const h9=["transform","translate","scale","rotate","perspective"],p9=["transform","translate","scale","rotate","perspective","filter"],m9=["paint","layout","strict","content"];function Mb(e){const t=mm(),n=Dn(e)?zi(e):e;return h9.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||p9.some(r=>(n.willChange||"").includes(r))||m9.some(r=>(n.contain||"").includes(r))}function g9(e){let t=Sa(e);for(;pi(t)&&!ya(t);){if(Mb(t))return t;if(pm(t))return null;t=Sa(t)}return null}function mm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const v9=new Set(["html","body","#document"]);function ya(e){return v9.has(du(e))}function zi(e){return Jr(e).getComputedStyle(e)}function gm(e){return Dn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sa(e){if(du(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Nx(e)&&e.host||Ho(e);return Nx(t)?t.host:t}function C2(e){const t=Sa(e);return ya(t)?e.ownerDocument?e.ownerDocument.body:e.body:pi(t)&&lf(t)?t:C2(t)}function xa(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=C2(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),c=Jr(i);if(s){const u=Ox(c);return t.concat(c,c.visualViewport||[],lf(i)?i:[],u&&n?xa(u):[])}return t.concat(i,xa(i,[],n))}function Ox(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const y9=["top","right","bottom","left"],lo=Math.min,Ar=Math.max,Mp=Math.round,op=Math.floor,Po=e=>({x:e,y:e}),x9={left:"right",right:"left",bottom:"top",top:"bottom"},b9={start:"end",end:"start"};function Mx(e,t,n){return Ar(e,lo(t,n))}function zo(e,t){return typeof e=="function"?e(t):e}function co(e){return e.split("-")[0]}function fu(e){return e.split("-")[1]}function Lb(e){return e==="x"?"y":"x"}function Ib(e){return e==="y"?"height":"width"}const S9=new Set(["top","bottom"]);function io(e){return S9.has(co(e))?"y":"x"}function zb(e){return Lb(io(e))}function j9(e,t,n){n===void 0&&(n=!1);const r=fu(e),i=zb(e),s=Ib(i);let c=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Lp(c)),[c,Lp(c)]}function w9(e){const t=Lp(e);return[Lx(e),t,Lx(t)]}function Lx(e){return e.replace(/start|end/g,t=>b9[t])}const AE=["left","right"],kE=["right","left"],C9=["top","bottom"],E9=["bottom","top"];function T9(e,t,n){switch(e){case"top":case"bottom":return n?t?kE:AE:t?AE:kE;case"left":case"right":return t?C9:E9;default:return[]}}function R9(e,t,n,r){const i=fu(e);let s=T9(co(e),n==="start",r);return i&&(s=s.map(c=>c+"-"+i),t&&(s=s.concat(s.map(Lx)))),s}function Lp(e){return e.replace(/left|right|bottom|top/g,t=>x9[t])}function _9(e){return{top:0,right:0,bottom:0,left:0,...e}}function $b(e){return typeof e!="number"?_9(e):{top:e,right:e,bottom:e,left:e}}function Zc(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function D9(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function A9(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function k9(){return/apple/i.test(navigator.vendor)}function P9(){return D9().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function N9(){return A9().includes("jsdom/")}const PE="data-floating-ui-focusable",O9="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function NE(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function $d(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Nx(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Fc(e){return"composedPath"in e?e.composedPath()[0]:e.target}function By(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function M9(e){return e.matches("html,body")}function fl(e){return e?.ownerDocument||document}function L9(e){return pi(e)&&e.matches(O9)}function I9(e){if(!e||N9())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function z9(e){return e?e.hasAttribute(PE)?e:e.querySelector("["+PE+"]")||e:null}function Sp(e,t,n){return n===void 0&&(n=!0),e.filter(i=>{var s;return i.parentId===t&&(!n||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,...Sp(e,i.id,n)])}function $9(e){return"nativeEvent"in e}function Ix(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var U9=typeof document<"u",B9=function(){},No=U9?v.useLayoutEffect:B9;const V9={...wb};function ap(e){const t=v.useRef(e);return No(()=>{t.current=e}),t}const F9=V9.useInsertionEffect,H9=F9||(e=>e());function Do(e){const t=v.useRef(()=>{});return H9(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function OE(e,t,n){let{reference:r,floating:i}=e;const s=io(t),c=zb(t),u=Ib(c),f=co(t),h=s==="y",m=r.x+r.width/2-i.width/2,g=r.y+r.height/2-i.height/2,y=r[u]/2-i[u]/2;let x;switch(f){case"top":x={x:m,y:r.y-i.height};break;case"bottom":x={x:m,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:g};break;case"left":x={x:r.x-i.width,y:g};break;default:x={x:r.x,y:r.y}}switch(fu(t)){case"start":x[c]-=y*(n&&h?-1:1);break;case"end":x[c]+=y*(n&&h?-1:1);break}return x}async function q9(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:c,elements:u,strategy:f}=e,{boundary:h="clippingAncestors",rootBoundary:m="viewport",elementContext:g="floating",altBoundary:y=!1,padding:x=0}=zo(t,e),S=$b(x),C=u[y?g==="floating"?"reference":"floating":g],T=Zc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:h,rootBoundary:m,strategy:f})),R=g==="floating"?{x:r,y:i,width:c.floating.width,height:c.floating.height}:c.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),_=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},P=Zc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:E,strategy:f}):R);return{top:(T.top-P.top+S.top)/_.y,bottom:(P.bottom-T.bottom+S.bottom)/_.y,left:(T.left-P.left+S.left)/_.x,right:(P.right-T.right+S.right)/_.x}}const G9=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:c}=n,u=s.filter(Boolean),f=await(c.isRTL==null?void 0:c.isRTL(t));let h=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:m,y:g}=OE(h,r,f),y=r,x={},S=0;for(let C=0;C<u.length;C++){var w;const{name:T,fn:R}=u[C],{x:E,y:_,data:P,reset:O}=await R({x:m,y:g,initialPlacement:r,placement:y,strategy:i,middlewareData:x,rects:h,platform:{...c,detectOverflow:(w=c.detectOverflow)!=null?w:q9},elements:{reference:e,floating:t}});m=E??m,g=_??g,x={...x,[T]:{...x[T],...P}},O&&S<=50&&(S++,typeof O=="object"&&(O.placement&&(y=O.placement),O.rects&&(h=O.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:m,y:g}=OE(h,y,f)),C=-1)}return{x:m,y:g,placement:y,strategy:i,middlewareData:x}},W9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:c,elements:u,middlewareData:f}=t,{element:h,padding:m=0}=zo(e,t)||{};if(h==null)return{};const g=$b(m),y={x:n,y:r},x=zb(i),S=Ib(x),w=await c.getDimensions(h),C=x==="y",T=C?"top":"left",R=C?"bottom":"right",E=C?"clientHeight":"clientWidth",_=s.reference[S]+s.reference[x]-y[x]-s.floating[S],P=y[x]-s.reference[x],O=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let k=O?O[E]:0;(!k||!await(c.isElement==null?void 0:c.isElement(O)))&&(k=u.floating[E]||s.floating[S]);const A=_/2-P/2,z=k/2-w[S]/2-1,U=lo(g[T],z),K=lo(g[R],z),W=U,ee=k-w[S]-K,B=k/2-w[S]/2+A,G=Mx(W,B,ee),L=!f.arrow&&fu(i)!=null&&B!==G&&s.reference[S]/2-(B<W?U:K)-w[S]/2<0,I=L?B<W?B-W:B-ee:0;return{[x]:y[x]+I,data:{[x]:G,centerOffset:B-G-I,...L&&{alignmentOffset:I}},reset:L}}}),Q9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:c,initialPlacement:u,platform:f,elements:h}=t,{mainAxis:m=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...C}=zo(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=co(i),R=io(u),E=co(u)===u,_=await(f.isRTL==null?void 0:f.isRTL(h.floating)),P=y||(E||!w?[Lp(u)]:w9(u)),O=S!=="none";!y&&O&&P.push(...R9(u,w,S,_));const k=[u,...P],A=await f.detectOverflow(t,C),z=[];let U=((r=s.flip)==null?void 0:r.overflows)||[];if(m&&z.push(A[T]),g){const B=j9(i,c,_);z.push(A[B[0]],A[B[1]])}if(U=[...U,{placement:i,overflows:z}],!z.every(B=>B<=0)){var K,W;const B=(((K=s.flip)==null?void 0:K.index)||0)+1,G=k[B];if(G&&(!(g==="alignment"?R!==io(G):!1)||U.every($=>io($.placement)===R?$.overflows[0]>0:!0)))return{data:{index:B,overflows:U},reset:{placement:G}};let L=(W=U.filter(I=>I.overflows[0]<=0).sort((I,$)=>I.overflows[1]-$.overflows[1])[0])==null?void 0:W.placement;if(!L)switch(x){case"bestFit":{var ee;const I=(ee=U.filter($=>{if(O){const V=io($.placement);return V===R||V==="y"}return!0}).map($=>[$.placement,$.overflows.filter(V=>V>0).reduce((V,X)=>V+X,0)]).sort(($,V)=>$[1]-V[1])[0])==null?void 0:ee[0];I&&(L=I);break}case"initialPlacement":L=u;break}if(i!==L)return{reset:{placement:L}}}return{}}}};function ME(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function LE(e){return y9.some(t=>e[t]>=0)}const Y9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=zo(e,t);switch(i){case"referenceHidden":{const c=await r.detectOverflow(t,{...s,elementContext:"reference"}),u=ME(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:LE(u)}}}case"escaped":{const c=await r.detectOverflow(t,{...s,altBoundary:!0}),u=ME(c,n.floating);return{data:{escapedOffsets:u,escaped:LE(u)}}}default:return{}}}}};function E2(e){const t=lo(...e.map(s=>s.left)),n=lo(...e.map(s=>s.top)),r=Ar(...e.map(s=>s.right)),i=Ar(...e.map(s=>s.bottom));return{x:t,y:n,width:r-t,height:i-n}}function K9(e){const t=e.slice().sort((i,s)=>i.y-s.y),n=[];let r=null;for(let i=0;i<t.length;i++){const s=t[i];!r||s.y-r.y>r.height/2?n.push([s]):n[n.length-1].push(s),r=s}return n.map(i=>Zc(E2(i)))}const X9=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:i,platform:s,strategy:c}=t,{padding:u=2,x:f,y:h}=zo(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),g=K9(m),y=Zc(E2(m)),x=$b(u);function S(){if(g.length===2&&g[0].left>g[1].right&&f!=null&&h!=null)return g.find(C=>f>C.left-x.left&&f<C.right+x.right&&h>C.top-x.top&&h<C.bottom+x.bottom)||y;if(g.length>=2){if(io(n)==="y"){const U=g[0],K=g[g.length-1],W=co(n)==="top",ee=U.top,B=K.bottom,G=W?U.left:K.left,L=W?U.right:K.right,I=L-G,$=B-ee;return{top:ee,bottom:B,left:G,right:L,width:I,height:$,x:G,y:ee}}const C=co(n)==="left",T=Ar(...g.map(U=>U.right)),R=lo(...g.map(U=>U.left)),E=g.filter(U=>C?U.left===R:U.right===T),_=E[0].top,P=E[E.length-1].bottom,O=R,k=T,A=k-O,z=P-_;return{top:_,bottom:P,left:O,right:k,width:A,height:z,x:O,y:_}}return y}const w=await s.getElementRects({reference:{getBoundingClientRect:S},floating:r.floating,strategy:c});return i.reference.x!==w.reference.x||i.reference.y!==w.reference.y||i.reference.width!==w.reference.width||i.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},T2=new Set(["left","top"]);async function J9(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),c=co(n),u=fu(n),f=io(n)==="y",h=T2.has(c)?-1:1,m=s&&f?-1:1,g=zo(t,e);let{mainAxis:y,crossAxis:x,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(x=u==="end"?S*-1:S),f?{x:x*m,y:y*h}:{x:y*h,y:x*m}}const Z9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:c,middlewareData:u}=t,f=await J9(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:i+f.x,y:s+f.y,data:{...f,placement:c}}}}},eL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:f={fn:T=>{let{x:R,y:E}=T;return{x:R,y:E}}},...h}=zo(e,t),m={x:n,y:r},g=await s.detectOverflow(t,h),y=io(co(i)),x=Lb(y);let S=m[x],w=m[y];if(c){const T=x==="y"?"top":"left",R=x==="y"?"bottom":"right",E=S+g[T],_=S-g[R];S=Mx(E,S,_)}if(u){const T=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+g[T],_=w-g[R];w=Mx(E,w,_)}const C=f.fn({...t,[x]:S,[y]:w});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[x]:c,[y]:u}}}}}},tL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:c}=t,{offset:u=0,mainAxis:f=!0,crossAxis:h=!0}=zo(e,t),m={x:n,y:r},g=io(i),y=Lb(g);let x=m[y],S=m[g];const w=zo(u,t),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(f){const E=y==="y"?"height":"width",_=s.reference[y]-s.floating[E]+C.mainAxis,P=s.reference[y]+s.reference[E]-C.mainAxis;x<_?x=_:x>P&&(x=P)}if(h){var T,R;const E=y==="y"?"width":"height",_=T2.has(co(i)),P=s.reference[g]-s.floating[E]+(_&&((T=c.offset)==null?void 0:T[g])||0)+(_?0:C.crossAxis),O=s.reference[g]+s.reference[E]+(_?0:((R=c.offset)==null?void 0:R[g])||0)-(_?C.crossAxis:0);S<P?S=P:S>O&&(S=O)}return{[y]:x,[g]:S}}}},nL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:c,elements:u}=t,{apply:f=()=>{},...h}=zo(e,t),m=await c.detectOverflow(t,h),g=co(i),y=fu(i),x=io(i)==="y",{width:S,height:w}=s.floating;let C,T;g==="top"||g==="bottom"?(C=g,T=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(T=g,C=y==="end"?"top":"bottom");const R=w-m.top-m.bottom,E=S-m.left-m.right,_=lo(w-m[C],R),P=lo(S-m[T],E),O=!t.middlewareData.shift;let k=_,A=P;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=R),O&&!y){const U=Ar(m.left,0),K=Ar(m.right,0),W=Ar(m.top,0),ee=Ar(m.bottom,0);x?A=S-2*(U!==0||K!==0?U+K:Ar(m.left,m.right)):k=w-2*(W!==0||ee!==0?W+ee:Ar(m.top,m.bottom))}await f({...t,availableWidth:A,availableHeight:k});const z=await c.getDimensions(u.floating);return S!==z.width||w!==z.height?{reset:{rects:!0}}:{}}}};function R2(e){const t=zi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=pi(e),s=i?e.offsetWidth:n,c=i?e.offsetHeight:r,u=Mp(n)!==s||Mp(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function Ub(e){return Dn(e)?e:e.contextElement}function Yc(e){const t=Ub(e);if(!pi(t))return Po(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=R2(t);let c=(s?Mp(n.width):n.width)/r,u=(s?Mp(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const rL=Po(0);function _2(e){const t=Jr(e);return!mm()||!t.visualViewport?rL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Jr(e)?!1:t}function wl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Ub(e);let c=Po(1);t&&(r?Dn(r)&&(c=Yc(r)):c=Yc(e));const u=iL(s,n,r)?_2(s):Po(0);let f=(i.left+u.x)/c.x,h=(i.top+u.y)/c.y,m=i.width/c.x,g=i.height/c.y;if(s){const y=Jr(s),x=r&&Dn(r)?Jr(r):r;let S=y,w=Ox(S);for(;w&&r&&x!==S;){const C=Yc(w),T=w.getBoundingClientRect(),R=zi(w),E=T.left+(w.clientLeft+parseFloat(R.paddingLeft))*C.x,_=T.top+(w.clientTop+parseFloat(R.paddingTop))*C.y;f*=C.x,h*=C.y,m*=C.x,g*=C.y,f+=E,h+=_,S=Jr(w),w=Ox(S)}}return Zc({width:m,height:g,x:f,y:h})}function vm(e,t){const n=gm(e).scrollLeft;return t?t.left+n:wl(Ho(e)).left+n}function D2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-vm(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function oL(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",c=Ho(r),u=t?pm(t.floating):!1;if(r===c||u&&s)return n;let f={scrollLeft:0,scrollTop:0},h=Po(1);const m=Po(0),g=pi(r);if((g||!g&&!s)&&((du(r)!=="body"||lf(c))&&(f=gm(r)),pi(r))){const x=wl(r);h=Yc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const y=c&&!g&&!s?D2(c,f):Po(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+m.x+y.x,y:n.y*h.y-f.scrollTop*h.y+m.y+y.y}}function aL(e){return Array.from(e.getClientRects())}function sL(e){const t=Ho(e),n=gm(e),r=e.ownerDocument.body,i=Ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+vm(e);const u=-n.scrollTop;return zi(r).direction==="rtl"&&(c+=Ar(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:c,y:u}}const IE=25;function lL(e,t){const n=Jr(e),r=Ho(e),i=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(i){s=i.width,c=i.height;const m=mm();(!m||m&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}const h=vm(r);if(h<=0){const m=r.ownerDocument,g=m.body,y=getComputedStyle(g),x=m.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,S=Math.abs(r.clientWidth-g.clientWidth-x);S<=IE&&(s-=S)}else h<=IE&&(s+=h);return{width:s,height:c,x:u,y:f}}const cL=new Set(["absolute","fixed"]);function uL(e,t){const n=wl(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=pi(e)?Yc(e):Po(1),c=e.clientWidth*s.x,u=e.clientHeight*s.y,f=i*s.x,h=r*s.y;return{width:c,height:u,x:f,y:h}}function zE(e,t,n){let r;if(t==="viewport")r=lL(e,n);else if(t==="document")r=sL(Ho(e));else if(Dn(t))r=uL(t,n);else{const i=_2(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Zc(r)}function A2(e,t){const n=Sa(e);return n===t||!Dn(n)||ya(n)?!1:zi(n).position==="fixed"||A2(n,t)}function dL(e,t){const n=t.get(e);if(n)return n;let r=xa(e,[],!1).filter(u=>Dn(u)&&du(u)!=="body"),i=null;const s=zi(e).position==="fixed";let c=s?Sa(e):e;for(;Dn(c)&&!ya(c);){const u=zi(c),f=Mb(c);!f&&u.position==="fixed"&&(i=null),(s?!f&&!i:!f&&u.position==="static"&&!!i&&cL.has(i.position)||lf(c)&&!f&&A2(e,c))?r=r.filter(m=>m!==c):i=u,c=Sa(c)}return t.set(e,r),r}function fL(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const c=[...n==="clippingAncestors"?pm(t)?[]:dL(t,this._c):[].concat(n),r],u=c[0],f=c.reduce((h,m)=>{const g=zE(t,m,i);return h.top=Ar(g.top,h.top),h.right=lo(g.right,h.right),h.bottom=lo(g.bottom,h.bottom),h.left=Ar(g.left,h.left),h},zE(t,u,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function hL(e){const{width:t,height:n}=R2(e);return{width:t,height:n}}function pL(e,t,n){const r=pi(t),i=Ho(t),s=n==="fixed",c=wl(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const f=Po(0);function h(){f.x=vm(i)}if(r||!r&&!s)if((du(t)!=="body"||lf(i))&&(u=gm(t)),r){const x=wl(t,!0,s,t);f.x=x.x+t.clientLeft,f.y=x.y+t.clientTop}else i&&h();s&&!r&&i&&h();const m=i&&!r&&!s?D2(i,u):Po(0),g=c.left+u.scrollLeft-f.x-m.x,y=c.top+u.scrollTop-f.y-m.y;return{x:g,y,width:c.width,height:c.height}}function Vy(e){return zi(e).position==="static"}function $E(e,t){if(!pi(e)||zi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ho(e)===n&&(n=n.ownerDocument.body),n}function k2(e,t){const n=Jr(e);if(pm(e))return n;if(!pi(e)){let i=Sa(e);for(;i&&!ya(i);){if(Dn(i)&&!Vy(i))return i;i=Sa(i)}return n}let r=$E(e,t);for(;r&&d9(r)&&Vy(r);)r=$E(r,t);return r&&ya(r)&&Vy(r)&&!Mb(r)?n:r||g9(e)||n}const mL=async function(e){const t=this.getOffsetParent||k2,n=this.getDimensions,r=await n(e.floating);return{reference:pL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gL(e){return zi(e).direction==="rtl"}const vL={convertOffsetParentRelativeRectToViewportRelativeRect:oL,getDocumentElement:Ho,getClippingRect:fL,getOffsetParent:k2,getElementRects:mL,getClientRects:aL,getDimensions:hL,getScale:Yc,isElement:Dn,isRTL:gL};function P2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yL(e,t){let n=null,r;const i=Ho(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),s();const h=e.getBoundingClientRect(),{left:m,top:g,width:y,height:x}=h;if(u||t(),!y||!x)return;const S=op(g),w=op(i.clientWidth-(m+y)),C=op(i.clientHeight-(g+x)),T=op(m),E={rootMargin:-S+"px "+-w+"px "+-C+"px "+-T+"px",threshold:Ar(0,lo(1,f))||1};let _=!0;function P(O){const k=O[0].intersectionRatio;if(k!==f){if(!_)return c();k?c(!1,k):r=setTimeout(()=>{c(!1,1e-7)},1e3)}k===1&&!P2(h,e.getBoundingClientRect())&&c(),_=!1}try{n=new IntersectionObserver(P,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(P,E)}n.observe(e)}return c(!0),s}function zx(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,h=Ub(e),m=i||s?[...h?xa(h):[],...xa(t)]:[];m.forEach(T=>{i&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const g=h&&u?yL(h,n):null;let y=-1,x=null;c&&(x=new ResizeObserver(T=>{let[R]=T;R&&R.target===h&&x&&(x.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var E;(E=x)==null||E.observe(t)})),n()}),h&&!f&&x.observe(h),x.observe(t));let S,w=f?wl(e):null;f&&C();function C(){const T=wl(e);w&&!P2(w,T)&&n(),w=T,S=requestAnimationFrame(C)}return n(),()=>{var T;m.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),g?.(),(T=x)==null||T.disconnect(),x=null,f&&cancelAnimationFrame(S)}}const xL=Z9,bL=eL,SL=Q9,jL=nL,wL=Y9,UE=W9,CL=X9,EL=tL,TL=(e,t,n)=>{const r=new Map,i={platform:vL,...n},s={...i.platform,_c:r};return G9(e,t,{...i,platform:s})};var RL=typeof document<"u",_L=function(){},jp=RL?v.useLayoutEffect:_L;function Ip(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ip(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Ip(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function N2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function BE(e,t){const n=N2(e);return Math.round(t*n)/n}function Fy(e){const t=v.useRef(e);return jp(()=>{t.current=e}),t}function DL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:c}={},transform:u=!0,whileElementsMounted:f,open:h}=e,[m,g]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,x]=v.useState(r);Ip(y,r)||x(r);const[S,w]=v.useState(null),[C,T]=v.useState(null),R=v.useCallback($=>{$!==O.current&&(O.current=$,w($))},[]),E=v.useCallback($=>{$!==k.current&&(k.current=$,T($))},[]),_=s||S,P=c||C,O=v.useRef(null),k=v.useRef(null),A=v.useRef(m),z=f!=null,U=Fy(f),K=Fy(i),W=Fy(h),ee=v.useCallback(()=>{if(!O.current||!k.current)return;const $={placement:t,strategy:n,middleware:y};K.current&&($.platform=K.current),TL(O.current,k.current,$).then(V=>{const X={...V,isPositioned:W.current!==!1};B.current&&!Ip(A.current,X)&&(A.current=X,Ob.flushSync(()=>{g(X)}))})},[y,t,n,K,W]);jp(()=>{h===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,g($=>({...$,isPositioned:!1})))},[h]);const B=v.useRef(!1);jp(()=>(B.current=!0,()=>{B.current=!1}),[]),jp(()=>{if(_&&(O.current=_),P&&(k.current=P),_&&P){if(U.current)return U.current(_,P,ee);ee()}},[_,P,ee,U,z]);const G=v.useMemo(()=>({reference:O,floating:k,setReference:R,setFloating:E}),[R,E]),L=v.useMemo(()=>({reference:_,floating:P}),[_,P]),I=v.useMemo(()=>{const $={position:n,left:0,top:0};if(!L.floating)return $;const V=BE(L.floating,m.x),X=BE(L.floating,m.y);return u?{...$,transform:"translate("+V+"px, "+X+"px)",...N2(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:X}},[n,u,L.floating,m.x,m.y]);return v.useMemo(()=>({...m,update:ee,refs:G,elements:L,floatingStyles:I}),[m,ee,G,L,I])}const AL=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?UE({element:r.current,padding:i}).fn(n):{}:r?UE({element:r,padding:i}).fn(n):{}}}},O2=(e,t)=>({...xL(e),options:[e,t]}),Bb=(e,t)=>({...bL(e),options:[e,t]}),VE=(e,t)=>({...EL(e),options:[e,t]}),zp=(e,t)=>({...SL(e),options:[e,t]}),kL=(e,t)=>({...jL(e),options:[e,t]}),PL=(e,t)=>({...wL(e),options:[e,t]}),Ad=(e,t)=>({...CL(e),options:[e,t]}),M2=(e,t)=>({...AL(e),options:[e,t]});function L2(e){const t=v.useRef(void 0),n=v.useCallback(r=>{const i=e.map(s=>{if(s!=null){if(typeof s=="function"){const c=s,u=c(r);return typeof u=="function"?u:()=>{c(null)}}return s.current=r,()=>{s.current=null}}});return()=>{i.forEach(s=>s?.())}},e);return v.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const NL="data-floating-ui-focusable",FE="active",HE="selected",OL={...wb};let qE=!1,ML=0;const GE=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ML++;function LL(){const[e,t]=v.useState(()=>qE?GE():void 0);return No(()=>{e==null&&t(GE())},[]),v.useEffect(()=>{qE=!0},[]),e}const IL=OL.useId,I2=IL||LL;function zL(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const $L=v.createContext(null),UL=v.createContext(null),Vb=()=>{var e;return((e=v.useContext($L))==null?void 0:e.id)||null},Fb=()=>v.useContext(UL);function Hb(e){return"data-floating-ui-"+e}function ki(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const WE=Hb("safe-polygon");function wp(e,t,n){if(n&&!Ix(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function Hy(e){return typeof e=="function"?e():e}function BL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:i,events:s,elements:c}=e,{enabled:u=!0,delay:f=0,handleClose:h=null,mouseOnly:m=!1,restMs:g=0,move:y=!0}=t,x=Fb(),S=Vb(),w=ap(h),C=ap(f),T=ap(n),R=ap(g),E=v.useRef(),_=v.useRef(-1),P=v.useRef(),O=v.useRef(-1),k=v.useRef(!0),A=v.useRef(!1),z=v.useRef(()=>{}),U=v.useRef(!1),K=Do(()=>{var I;const $=(I=i.current.openEvent)==null?void 0:I.type;return $?.includes("mouse")&&$!=="mousedown"});v.useEffect(()=>{if(!u)return;function I($){let{open:V}=$;V||(ki(_),ki(O),k.current=!0,U.current=!1)}return s.on("openchange",I),()=>{s.off("openchange",I)}},[u,s]),v.useEffect(()=>{if(!u||!w.current||!n)return;function I(V){K()&&r(!1,V,"hover")}const $=fl(c.floating).documentElement;return $.addEventListener("mouseleave",I),()=>{$.removeEventListener("mouseleave",I)}},[c.floating,n,r,u,w,K]);const W=v.useCallback(function(I,$,V){$===void 0&&($=!0),V===void 0&&(V="hover");const X=wp(C.current,"close",E.current);X&&!P.current?(ki(_),_.current=window.setTimeout(()=>r(!1,I,V),X)):$&&(ki(_),r(!1,I,V))},[C,r]),ee=Do(()=>{z.current(),P.current=void 0}),B=Do(()=>{if(A.current){const I=fl(c.floating).body;I.style.pointerEvents="",I.removeAttribute(WE),A.current=!1}}),G=Do(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);v.useEffect(()=>{if(!u)return;function I(F){if(ki(_),k.current=!1,m&&!Ix(E.current)||Hy(R.current)>0&&!wp(C.current,"open"))return;const ie=wp(C.current,"open",E.current);ie?_.current=window.setTimeout(()=>{T.current||r(!0,F,"hover")},ie):n||r(!0,F,"hover")}function $(F){if(G()){B();return}z.current();const ie=fl(c.floating);if(ki(O),U.current=!1,w.current&&i.current.floatingContext){n||ki(_),P.current=w.current({...i.current.floatingContext,tree:x,x:F.clientX,y:F.clientY,onClose(){B(),ee(),G()||W(F,!0,"safe-polygon")}});const Se=P.current;ie.addEventListener("mousemove",Se),z.current=()=>{ie.removeEventListener("mousemove",Se)};return}(E.current!=="touch"||!$d(c.floating,F.relatedTarget))&&W(F)}function V(F){G()||i.current.floatingContext&&(w.current==null||w.current({...i.current.floatingContext,tree:x,x:F.clientX,y:F.clientY,onClose(){B(),ee(),G()||W(F)}})(F))}function X(){ki(_)}function M(F){G()||W(F,!1)}if(Dn(c.domReference)){const F=c.domReference,ie=c.floating;return n&&F.addEventListener("mouseleave",V),y&&F.addEventListener("mousemove",I,{once:!0}),F.addEventListener("mouseenter",I),F.addEventListener("mouseleave",$),ie&&(ie.addEventListener("mouseleave",V),ie.addEventListener("mouseenter",X),ie.addEventListener("mouseleave",M)),()=>{n&&F.removeEventListener("mouseleave",V),y&&F.removeEventListener("mousemove",I),F.removeEventListener("mouseenter",I),F.removeEventListener("mouseleave",$),ie&&(ie.removeEventListener("mouseleave",V),ie.removeEventListener("mouseenter",X),ie.removeEventListener("mouseleave",M))}}},[c,u,e,m,y,W,ee,B,r,n,T,x,C,w,i,G,R]),No(()=>{var I;if(u&&n&&(I=w.current)!=null&&(I=I.__options)!=null&&I.blockPointerEvents&&K()){A.current=!0;const V=c.floating;if(Dn(c.domReference)&&V){var $;const X=fl(c.floating).body;X.setAttribute(WE,"");const M=c.domReference,F=x==null||($=x.nodesRef.current.find(ie=>ie.id===S))==null||($=$.context)==null?void 0:$.elements.floating;return F&&(F.style.pointerEvents=""),X.style.pointerEvents="none",M.style.pointerEvents="auto",V.style.pointerEvents="auto",()=>{X.style.pointerEvents="",M.style.pointerEvents="",V.style.pointerEvents=""}}}},[u,n,S,c,x,w,K]),No(()=>{n||(E.current=void 0,U.current=!1,ee(),B())},[n,ee,B]),v.useEffect(()=>()=>{ee(),ki(_),ki(O),B()},[u,c.domReference,ee,B]);const L=v.useMemo(()=>{function I($){E.current=$.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove($){const{nativeEvent:V}=$;function X(){!k.current&&!T.current&&r(!0,V,"hover")}m&&!Ix(E.current)||n||Hy(R.current)===0||U.current&&$.movementX**2+$.movementY**2<2||(ki(O),E.current==="touch"?X():(U.current=!0,O.current=window.setTimeout(X,Hy(R.current))))}}},[m,r,n,T,R]);return v.useMemo(()=>u?{reference:L}:{},[u,L])}const $x=()=>{},z2=v.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:$x,setState:$x,isInstantPhase:!1}),VL=()=>v.useContext(z2);function FL(e){const{children:t,delay:n,timeoutMs:r=0}=e,[i,s]=v.useReducer((f,h)=>({...f,...h}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=v.useRef(null),u=v.useCallback(f=>{s({currentId:f})},[]);return No(()=>{i.currentId?c.current===null?c.current=i.currentId:i.isInstantPhase||s({isInstantPhase:!0}):(i.isInstantPhase&&s({isInstantPhase:!1}),c.current=null)},[i.currentId,i.isInstantPhase]),a.jsx(z2.Provider,{value:v.useMemo(()=>({...i,setState:s,setCurrentId:u}),[i,u]),children:t})}function HL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,floatingId:i}=e,{id:s,enabled:c=!0}=t,u=s??i,f=VL(),{currentId:h,setCurrentId:m,initialDelay:g,setState:y,timeoutMs:x}=f;return No(()=>{c&&h&&(y({delay:{open:1,close:wp(g,"close")}}),h!==u&&r(!1))},[c,u,r,y,h,g]),No(()=>{function S(){r(!1),y({delay:g,currentId:null})}if(c&&h&&!n&&h===u){if(x){const w=window.setTimeout(S,x);return()=>{clearTimeout(w)}}S()}},[c,n,y,h,u,r,g,x]),No(()=>{c&&(m===$x||!n||m(u))},[c,n,m,u]),f}const qL={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},GL={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},QE=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function WL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:i,dataRef:s}=e,{enabled:c=!0,escapeKey:u=!0,outsidePress:f=!0,outsidePressEvent:h="pointerdown",referencePress:m=!1,referencePressEvent:g="pointerdown",ancestorScroll:y=!1,bubbles:x,capture:S}=t,w=Fb(),C=Do(typeof f=="function"?f:()=>!1),T=typeof f=="function"?C:f,R=v.useRef(!1),{escapeKey:E,outsidePress:_}=QE(x),{escapeKey:P,outsidePress:O}=QE(S),k=v.useRef(!1),A=Do(B=>{var G;if(!n||!c||!u||B.key!=="Escape"||k.current)return;const L=(G=s.current.floatingContext)==null?void 0:G.nodeId,I=w?Sp(w.nodesRef.current,L):[];if(!E&&(B.stopPropagation(),I.length>0)){let $=!0;if(I.forEach(V=>{var X;if((X=V.context)!=null&&X.open&&!V.context.dataRef.current.__escapeKeyBubbles){$=!1;return}}),!$)return}r(!1,$9(B)?B.nativeEvent:B,"escape-key")}),z=Do(B=>{var G;const L=()=>{var I;A(B),(I=Fc(B))==null||I.removeEventListener("keydown",L)};(G=Fc(B))==null||G.addEventListener("keydown",L)}),U=Do(B=>{var G;const L=s.current.insideReactTree;s.current.insideReactTree=!1;const I=R.current;if(R.current=!1,h==="click"&&I||L||typeof T=="function"&&!T(B))return;const $=Fc(B),V="["+Hb("inert")+"]",X=fl(i.floating).querySelectorAll(V);let M=Dn($)?$:null;for(;M&&!ya(M);){const Se=Sa(M);if(ya(Se)||!Dn(Se))break;M=Se}if(X.length&&Dn($)&&!M9($)&&!$d($,i.floating)&&Array.from(X).every(Se=>!$d(M,Se)))return;if(pi($)&&ee){const Se=ya($),Ce=zi($),je=/auto|scroll/,Ke=Se||je.test(Ce.overflowX),_e=Se||je.test(Ce.overflowY),ht=Ke&&$.clientWidth>0&&$.scrollWidth>$.clientWidth,Ct=_e&&$.clientHeight>0&&$.scrollHeight>$.clientHeight,Et=Ce.direction==="rtl",qe=Ct&&(Et?B.offsetX<=$.offsetWidth-$.clientWidth:B.offsetX>$.clientWidth),ct=ht&&B.offsetY>$.clientHeight;if(qe||ct)return}const F=(G=s.current.floatingContext)==null?void 0:G.nodeId,ie=w&&Sp(w.nodesRef.current,F).some(Se=>{var Ce;return By(B,(Ce=Se.context)==null?void 0:Ce.elements.floating)});if(By(B,i.floating)||By(B,i.domReference)||ie)return;const de=w?Sp(w.nodesRef.current,F):[];if(de.length>0){let Se=!0;if(de.forEach(Ce=>{var je;if((je=Ce.context)!=null&&je.open&&!Ce.context.dataRef.current.__outsidePressBubbles){Se=!1;return}}),!Se)return}r(!1,B,"outside-press")}),K=Do(B=>{var G;const L=()=>{var I;U(B),(I=Fc(B))==null||I.removeEventListener(h,L)};(G=Fc(B))==null||G.addEventListener(h,L)});v.useEffect(()=>{if(!n||!c)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=_;let B=-1;function G(X){r(!1,X,"ancestor-scroll")}function L(){window.clearTimeout(B),k.current=!0}function I(){B=window.setTimeout(()=>{k.current=!1},mm()?5:0)}const $=fl(i.floating);u&&($.addEventListener("keydown",P?z:A,P),$.addEventListener("compositionstart",L),$.addEventListener("compositionend",I)),T&&$.addEventListener(h,O?K:U,O);let V=[];return y&&(Dn(i.domReference)&&(V=xa(i.domReference)),Dn(i.floating)&&(V=V.concat(xa(i.floating))),!Dn(i.reference)&&i.reference&&i.reference.contextElement&&(V=V.concat(xa(i.reference.contextElement)))),V=V.filter(X=>{var M;return X!==((M=$.defaultView)==null?void 0:M.visualViewport)}),V.forEach(X=>{X.addEventListener("scroll",G,{passive:!0})}),()=>{u&&($.removeEventListener("keydown",P?z:A,P),$.removeEventListener("compositionstart",L),$.removeEventListener("compositionend",I)),T&&$.removeEventListener(h,O?K:U,O),V.forEach(X=>{X.removeEventListener("scroll",G)}),window.clearTimeout(B)}},[s,i,u,T,h,n,r,y,c,E,_,A,P,z,U,O,K]),v.useEffect(()=>{s.current.insideReactTree=!1},[s,T,h]);const W=v.useMemo(()=>({onKeyDown:A,...m&&{[qL[g]]:B=>{r(!1,B.nativeEvent,"reference-press")},...g!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[A,r,m,g]),ee=v.useMemo(()=>({onKeyDown:A,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[GL[h]]:()=>{s.current.insideReactTree=!0}}),[A,h,s]);return v.useMemo(()=>c?{reference:W,floating:ee}:{},[c,W,ee])}function QL(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=I2(),s=v.useRef({}),[c]=v.useState(()=>zL()),u=Vb()!=null,[f,h]=v.useState(r.reference),m=Do((x,S,w)=>{s.current.openEvent=x?S:void 0,c.emit("openchange",{open:x,event:S,reason:w,nested:u}),n?.(x,S,w)}),g=v.useMemo(()=>({setPositionReference:h}),[]),y=v.useMemo(()=>({reference:f||r.reference||null,floating:r.floating||null,domReference:r.reference}),[f,r.reference,r.floating]);return v.useMemo(()=>({dataRef:s,open:t,onOpenChange:m,elements:y,events:c,floatingId:i,refs:g}),[t,m,y,c,i,g])}function qb(e){e===void 0&&(e={});const{nodeId:t}=e,n=QL({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[s,c]=v.useState(null),[u,f]=v.useState(null),m=i?.domReference||s,g=v.useRef(null),y=Fb();No(()=>{m&&(g.current=m)},[m]);const x=DL({...e,elements:{...i,...u&&{reference:u}}}),S=v.useCallback(E=>{const _=Dn(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;f(_),x.refs.setReference(_)},[x.refs]),w=v.useCallback(E=>{(Dn(E)||E===null)&&(g.current=E,c(E)),(Dn(x.refs.reference.current)||x.refs.reference.current===null||E!==null&&!Dn(E))&&x.refs.setReference(E)},[x.refs]),C=v.useMemo(()=>({...x.refs,setReference:w,setPositionReference:S,domReference:g}),[x.refs,w,S]),T=v.useMemo(()=>({...x.elements,domReference:m}),[x.elements,m]),R=v.useMemo(()=>({...x,...r,refs:C,elements:T,nodeId:t}),[x,C,T,t,r]);return No(()=>{r.dataRef.current.floatingContext=R;const E=y?.nodesRef.current.find(_=>_.id===t);E&&(E.context=R)}),v.useMemo(()=>({...x,context:R,refs:C,elements:T}),[x,C,T,R])}function qy(){return P9()&&k9()}function YL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:i,dataRef:s,elements:c}=e,{enabled:u=!0,visibleOnly:f=!0}=t,h=v.useRef(!1),m=v.useRef(-1),g=v.useRef(!0);v.useEffect(()=>{if(!u)return;const x=Jr(c.domReference);function S(){!n&&pi(c.domReference)&&c.domReference===NE(fl(c.domReference))&&(h.current=!0)}function w(){g.current=!0}function C(){g.current=!1}return x.addEventListener("blur",S),qy()&&(x.addEventListener("keydown",w,!0),x.addEventListener("pointerdown",C,!0)),()=>{x.removeEventListener("blur",S),qy()&&(x.removeEventListener("keydown",w,!0),x.removeEventListener("pointerdown",C,!0))}},[c.domReference,n,u]),v.useEffect(()=>{if(!u)return;function x(S){let{reason:w}=S;(w==="reference-press"||w==="escape-key")&&(h.current=!0)}return i.on("openchange",x),()=>{i.off("openchange",x)}},[i,u]),v.useEffect(()=>()=>{ki(m)},[]);const y=v.useMemo(()=>({onMouseLeave(){h.current=!1},onFocus(x){if(h.current)return;const S=Fc(x.nativeEvent);if(f&&Dn(S)){if(qy()&&!x.relatedTarget){if(!g.current&&!L9(S))return}else if(!I9(S))return}r(!0,x.nativeEvent,"focus")},onBlur(x){h.current=!1;const S=x.relatedTarget,w=x.nativeEvent,C=Dn(S)&&S.hasAttribute(Hb("focus-guard"))&&S.getAttribute("data-type")==="outside";m.current=window.setTimeout(()=>{var T;const R=NE(c.domReference?c.domReference.ownerDocument:document);!S&&R===c.domReference||$d((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,R)||$d(c.domReference,R)||C||r(!1,w,"focus")})}}),[s,c.domReference,r,f]);return v.useMemo(()=>u?{reference:y}:{},[u,y])}function Gy(e,t,n){const r=new Map,i=n==="item";let s=e;if(i&&e){const{[FE]:c,[HE]:u,...f}=e;s=f}return{...n==="floating"&&{tabIndex:-1,[NL]:""},...s,...t.map(c=>{const u=c?c[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(f=>{let[h,m]=f;if(!(i&&[FE,HE].includes(h)))if(h.indexOf("on")===0){if(r.has(h)||r.set(h,[]),typeof m=="function"){var g;(g=r.get(h))==null||g.push(m),c[h]=function(){for(var y,x=arguments.length,S=new Array(x),w=0;w<x;w++)S[w]=arguments[w];return(y=r.get(h))==null?void 0:y.map(C=>C(...S)).find(C=>C!==void 0)}}}else c[h]=m}),c),{})}}function KL(e){e===void 0&&(e=[]);const t=e.map(u=>u?.reference),n=e.map(u=>u?.floating),r=e.map(u=>u?.item),i=v.useCallback(u=>Gy(u,e,"reference"),t),s=v.useCallback(u=>Gy(u,e,"floating"),n),c=v.useCallback(u=>Gy(u,e,"item"),r);return v.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:c}),[i,s,c])}const XL=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function JL(e,t){var n,r;t===void 0&&(t={});const{open:i,elements:s,floatingId:c}=e,{enabled:u=!0,role:f="dialog"}=t,h=I2(),m=((n=s.domReference)==null?void 0:n.id)||h,g=v.useMemo(()=>{var R;return((R=z9(s.floating))==null?void 0:R.id)||c},[s.floating,c]),y=(r=XL.get(f))!=null?r:f,S=Vb()!=null,w=v.useMemo(()=>y==="tooltip"||f==="label"?{["aria-"+(f==="label"?"labelledby":"describedby")]:i?g:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":y==="alertdialog"?"dialog":y,"aria-controls":i?g:void 0,...y==="listbox"&&{role:"combobox"},...y==="menu"&&{id:m},...y==="menu"&&S&&{role:"menuitem"},...f==="select"&&{"aria-autocomplete":"none"},...f==="combobox"&&{"aria-autocomplete":"list"}},[y,g,S,i,m,f]),C=v.useMemo(()=>{const R={id:g,...y&&{role:y}};return y==="tooltip"||f==="label"?R:{...R,...y==="menu"&&{"aria-labelledby":m}}},[y,g,m,f]),T=v.useCallback(R=>{let{active:E,selected:_}=R;const P={role:"option",...E&&{id:g+"-fui-option"}};switch(f){case"select":case"combobox":return{...P,"aria-selected":_}}return{}},[g,f]);return v.useMemo(()=>u?{reference:w,floating:C,item:T}:{},[u,w,C,T])}var Gb={root:"m_d57069b5",content:"m_b1336c6",viewport:"m_c0783ff9",viewportInner:"m_f8f631dd",scrollbar:"m_c44ba933",thumb:"m_d8b5e363",corner:"m_21657268"};const[ZL,Vi]=Or("ScrollArea.Root component was not found in tree");function eu(e,t){const n=ll(t);Ol(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}const eI=v.forwardRef((e,t)=>{const{style:n,...r}=e,i=Vi(),[s,c]=v.useState(0),[u,f]=v.useState(0),h=!!(s&&u);return eu(i.scrollbarX,()=>{const m=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(m),f(m)}),eu(i.scrollbarY,()=>{const m=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(m),c(m)}),h?a.jsx("div",{...r,ref:t,style:{...n,width:s,height:u}}):null}),tI=v.forwardRef((e,t)=>{const n=Vi(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(eI,{...e,ref:t}):null}),nI={scrollHideDelay:1e3,type:"hover"},$2=v.forwardRef((e,t)=>{const{type:n,scrollHideDelay:r,scrollbars:i,getStyles:s,...c}=ae("ScrollAreaRoot",nI,e),[u,f]=v.useState(null),[h,m]=v.useState(null),[g,y]=v.useState(null),[x,S]=v.useState(null),[w,C]=v.useState(null),[T,R]=v.useState(0),[E,_]=v.useState(0),[P,O]=v.useState(!1),[k,A]=v.useState(!1),z=Vn(t,U=>f(U));return a.jsx(ZL,{value:{type:n,scrollHideDelay:r,scrollArea:u,viewport:h,onViewportChange:m,content:g,onContentChange:y,scrollbarX:x,onScrollbarXChange:S,scrollbarXEnabled:P,onScrollbarXEnabledChange:O,scrollbarY:w,onScrollbarYChange:C,scrollbarYEnabled:k,onScrollbarYEnabledChange:A,onCornerWidthChange:R,onCornerHeightChange:_,getStyles:s},children:a.jsx(le,{...c,ref:z,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${T}px`,"--sa-corner-height":i!=="xy"?"0px":`${E}px`}})})});$2.displayName="@mantine/core/ScrollAreaRoot";function U2(e,t){const n=e/t;return Number.isNaN(n)?0:n}function ym(e){const t=U2(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function B2(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function rI(e,[t,n]){return Math.min(n,Math.max(t,e))}function YE(e,t,n="ltr"){const r=ym(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,c=t.content-t.viewport,u=s-r,f=n==="ltr"?[0,c]:[c*-1,0],h=rI(e,f);return B2([0,c],[0,u])(h)}function iI(e,t,n,r="ltr"){const i=ym(n),s=i/2,c=t||s,u=i-c,f=n.scrollbar.paddingStart+c,h=n.scrollbar.size-n.scrollbar.paddingEnd-u,m=n.content-n.viewport,g=r==="ltr"?[0,m]:[m*-1,0];return B2([f,h],g)(e)}function V2(e,t){return e>0&&e<t}function gs(e){return e?parseInt(e,10):0}function xl(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}const[oI,F2]=Or("ScrollAreaScrollbar was not found in tree"),H2=v.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:u,onDragScroll:f,onWheelScroll:h,onResize:m,...g}=e,y=Vi(),[x,S]=v.useState(null),w=Vn(t,A=>S(A)),C=v.useRef(null),T=v.useRef(""),{viewport:R}=y,E=n.content-n.viewport,_=ll(h),P=ll(u),O=of(m,10),k=A=>{if(C.current){const z=A.clientX-C.current.left,U=A.clientY-C.current.top;f({x:z,y:U})}};return v.useEffect(()=>{const A=z=>{const U=z.target;x?.contains(U)&&_(z,E)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[R,x,E,_]),v.useEffect(P,[n,P]),eu(x,O),eu(y.content,O),a.jsx(oI,{value:{scrollbar:x,hasThumb:r,onThumbChange:ll(i),onThumbPointerUp:ll(s),onThumbPositionChange:P,onThumbPointerDown:ll(c)},children:a.jsx("div",{...g,ref:w,"data-mantine-scrollbar":!0,style:{position:"absolute",...g.style},onPointerDown:xl(e.onPointerDown,A=>{A.preventDefault(),A.button===0&&(A.target.setPointerCapture(A.pointerId),C.current=x.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",k(A))}),onPointerMove:xl(e.onPointerMove,k),onPointerUp:xl(e.onPointerUp,A=>{const z=A.target;z.hasPointerCapture(A.pointerId)&&(A.preventDefault(),z.releasePointerCapture(A.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=T.current,C.current=null}})})}),q2=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:i,...s}=e,c=Vi(),[u,f]=v.useState(),h=v.useRef(null),m=Vn(t,h,c.onScrollbarXChange);return v.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),a.jsx(H2,{"data-orientation":"horizontal",...s,ref:m,sizes:n,style:{...i,"--sa-thumb-width":`${ym(n)}px`},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,y)=>{if(c.viewport){const x=c.viewport.scrollLeft+g.deltaX;e.onWheelScroll(x),V2(x,y)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&u&&r({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:gs(u.paddingLeft),paddingEnd:gs(u.paddingRight)}})}})});q2.displayName="@mantine/core/ScrollAreaScrollbarX";const G2=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:i,...s}=e,c=Vi(),[u,f]=v.useState(),h=v.useRef(null),m=Vn(t,h,c.onScrollbarYChange);return v.useEffect(()=>{h.current&&f(window.getComputedStyle(h.current))},[]),a.jsx(H2,{...s,"data-orientation":"vertical",ref:m,sizes:n,style:{"--sa-thumb-height":`${ym(n)}px`,...i},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,y)=>{if(c.viewport){const x=c.viewport.scrollTop+g.deltaY;e.onWheelScroll(x),V2(x,y)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&u&&r({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:gs(u.paddingTop),paddingEnd:gs(u.paddingBottom)}})}})});G2.displayName="@mantine/core/ScrollAreaScrollbarY";const xm=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:i}=Rs(),s=Vi(),c=v.useRef(null),u=v.useRef(0),[f,h]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=U2(f.viewport,f.content),g={...r,sizes:f,onSizesChange:h,hasThumb:m>0&&m<1,onThumbChange:x=>{c.current=x},onThumbPointerUp:()=>{u.current=0},onThumbPointerDown:x=>{u.current=x}},y=(x,S)=>iI(x,u.current,f,S);return n==="horizontal"?a.jsx(q2,{...g,ref:t,onThumbPositionChange:()=>{if(s.viewport&&c.current){const x=s.viewport.scrollLeft,S=YE(x,f,i);c.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollLeft=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollLeft=y(x,i))}}):n==="vertical"?a.jsx(G2,{...g,ref:t,onThumbPositionChange:()=>{if(s.viewport&&c.current){const x=s.viewport.scrollTop,S=YE(x,f);f.scrollbar.size===0?c.current.style.setProperty("--thumb-opacity","0"):c.current.style.setProperty("--thumb-opacity","1"),c.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:x=>{s.viewport&&(s.viewport.scrollTop=x)},onDragScroll:x=>{s.viewport&&(s.viewport.scrollTop=y(x))}}):null});xm.displayName="@mantine/core/ScrollAreaScrollbarVisible";const Wb=v.forwardRef((e,t)=>{const n=Vi(),{forceMount:r,...i}=e,[s,c]=v.useState(!1),u=e.orientation==="horizontal",f=of(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;c(u?h:m)}},10);return eu(n.viewport,f),eu(n.content,f),r||s?a.jsx(xm,{"data-state":s?"visible":"hidden",...i,ref:t}):null});Wb.displayName="@mantine/core/ScrollAreaScrollbarAuto";const W2=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Vi(),[s,c]=v.useState(!1);return v.useEffect(()=>{const{scrollArea:u}=i;let f=0;if(u){const h=()=>{window.clearTimeout(f),c(!0)},m=()=>{f=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return u.addEventListener("pointerenter",h),u.addEventListener("pointerleave",m),()=>{window.clearTimeout(f),u.removeEventListener("pointerenter",h),u.removeEventListener("pointerleave",m)}}},[i.scrollArea,i.scrollHideDelay]),n||s?a.jsx(Wb,{"data-state":s?"visible":"hidden",...r,ref:t}):null});W2.displayName="@mantine/core/ScrollAreaScrollbarHover";const aI=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Vi(),s=e.orientation==="horizontal",[c,u]=v.useState("hidden"),f=of(()=>u("idle"),100);return v.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>u("hidden"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,i.scrollHideDelay]),v.useEffect(()=>{const{viewport:h}=i,m=s?"scrollLeft":"scrollTop";if(h){let g=h[m];const y=()=>{const x=h[m];g!==x&&(u("scrolling"),f()),g=x};return h.addEventListener("scroll",y),()=>h.removeEventListener("scroll",y)}},[i.viewport,s,f]),n||c!=="hidden"?a.jsx(xm,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:xl(e.onPointerEnter,()=>u("interacting")),onPointerLeave:xl(e.onPointerLeave,()=>u("idle"))}):null}),Ux=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Vi(),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,u=e.orientation==="horizontal";return v.useEffect(()=>(u?s(!0):c(!0),()=>{u?s(!1):c(!1)}),[u,s,c]),i.type==="hover"?a.jsx(W2,{...r,ref:t,forceMount:n}):i.type==="scroll"?a.jsx(aI,{...r,ref:t,forceMount:n}):i.type==="auto"?a.jsx(Wb,{...r,ref:t,forceMount:n}):i.type==="always"?a.jsx(xm,{...r,ref:t}):null});Ux.displayName="@mantine/core/ScrollAreaScrollbar";function sI(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){const s={left:e.scrollLeft,top:e.scrollTop},c=n.left!==s.left,u=n.top!==s.top;(c||u)&&t(),n=s,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)}const Q2=v.forwardRef((e,t)=>{const{style:n,...r}=e,i=Vi(),s=F2(),{onThumbPositionChange:c}=s,u=Vn(t,m=>s.onThumbChange(m)),f=v.useRef(void 0),h=of(()=>{f.current&&(f.current(),f.current=void 0)},100);return v.useEffect(()=>{const{viewport:m}=i;if(m){const g=()=>{if(h(),!f.current){const y=sI(m,c);f.current=y,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,h,c]),a.jsx("div",{"data-state":s.hasThumb?"visible":"hidden",...r,ref:u,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:xl(e.onPointerDownCapture,m=>{const y=m.target.getBoundingClientRect(),x=m.clientX-y.left,S=m.clientY-y.top;s.onThumbPointerDown({x,y:S})}),onPointerUp:xl(e.onPointerUp,s.onThumbPointerUp)})});Q2.displayName="@mantine/core/ScrollAreaThumb";const Bx=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=F2();return n||i.hasThumb?a.jsx(Q2,{ref:t,...r}):null});Bx.displayName="@mantine/core/ScrollAreaThumb";const Y2=v.forwardRef(({children:e,style:t,onWheel:n,...r},i)=>{const s=Vi(),c=Vn(i,s.onViewportChange),u=f=>{if(n?.(f),s.scrollbarXEnabled&&s.viewport&&f.shiftKey){const{scrollTop:h,scrollHeight:m,clientHeight:g,scrollWidth:y,clientWidth:x}=s.viewport,S=h<1,w=h>=m-g-1;y>x&&(S||w)&&f.stopPropagation()}};return a.jsx(le,{...r,ref:c,onWheel:u,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...t},children:a.jsx("div",{...s.getStyles("content"),ref:s.onContentChange,children:e})})});Y2.displayName="@mantine/core/ScrollAreaViewport";const K2={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},lI=(e,{scrollbarSize:t,overscrollBehavior:n,scrollbars:r})=>{let i=n;return n&&r&&(r==="x"?i=`${n} auto`:r==="y"&&(i=`auto ${n}`)),{root:{"--scrollarea-scrollbar-size":ce(t),"--scrollarea-over-scroll-behavior":i}}},ti=ve((e,t)=>{const n=ae("ScrollArea",K2,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,scrollbarSize:f,vars:h,type:m,scrollHideDelay:g,viewportProps:y,viewportRef:x,onScrollPositionChange:S,children:w,offsetScrollbars:C,scrollbars:T,onBottomReached:R,onTopReached:E,overscrollBehavior:_,attributes:P,...O}=n,[k,A]=v.useState(!1),[z,U]=v.useState(!1),[K,W]=v.useState(!1),ee=$e({name:"ScrollArea",props:n,classes:Gb,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:P,vars:h,varsResolver:lI}),B=v.useRef(null),G=L2([x,B]);return v.useEffect(()=>{if(!B.current||C!=="present")return;const L=B.current,I=new ResizeObserver(()=>{const{scrollHeight:$,clientHeight:V,scrollWidth:X,clientWidth:M}=L;U($>V),W(X>M)});return I.observe(L),()=>I.disconnect()},[B,C]),a.jsxs($2,{getStyles:ee,type:m==="never"?"always":m,scrollHideDelay:g,ref:t,scrollbars:T,...ee("root"),...O,children:[a.jsx(Y2,{...y,...ee("viewport",{style:y?.style}),ref:G,"data-offset-scrollbars":C===!0?"xy":C||void 0,"data-scrollbars":T||void 0,"data-horizontal-hidden":C==="present"&&!K?"true":void 0,"data-vertical-hidden":C==="present"&&!z?"true":void 0,onScroll:L=>{y?.onScroll?.(L),S?.({x:L.currentTarget.scrollLeft,y:L.currentTarget.scrollTop});const{scrollTop:I,scrollHeight:$,clientHeight:V}=L.currentTarget;I-($-V)>=-.8&&R?.(),I===0&&E?.()},children:w}),(T==="xy"||T==="x")&&a.jsx(Ux,{...ee("scrollbar"),orientation:"horizontal","data-hidden":m==="never"||C==="present"&&!K?!0:void 0,forceMount:!0,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),children:a.jsx(Bx,{...ee("thumb")})}),(T==="xy"||T==="y")&&a.jsx(Ux,{...ee("scrollbar"),orientation:"vertical","data-hidden":m==="never"||C==="present"&&!z?!0:void 0,forceMount:!0,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),children:a.jsx(Bx,{...ee("thumb")})}),a.jsx(tI,{...ee("corner"),"data-hovered":k||void 0,"data-hidden":m==="never"||void 0})]})});ti.displayName="@mantine/core/ScrollArea";const bm=ve((e,t)=>{const{children:n,classNames:r,styles:i,scrollbarSize:s,scrollHideDelay:c,type:u,dir:f,offsetScrollbars:h,overscrollBehavior:m,viewportRef:g,onScrollPositionChange:y,unstyled:x,variant:S,viewportProps:w,scrollbars:C,style:T,vars:R,onBottomReached:E,onTopReached:_,onOverflowChange:P,...O}=ae("ScrollAreaAutosize",K2,e),k=v.useRef(null),A=L2([g,k]),[z,U]=v.useState(!1),K=v.useRef(!1);return v.useEffect(()=>{if(!P)return;const W=k.current;if(!W)return;const ee=()=>{const G=W.scrollHeight>W.clientHeight;G!==z&&(K.current?P?.(G):(K.current=!0,G&&P?.(!0)),U(G))};ee();const B=new ResizeObserver(ee);return B.observe(W),()=>B.disconnect()},[P,z]),a.jsx(le,{...O,ref:t,style:[{display:"flex",overflow:"hidden"},T],children:a.jsx(le,{style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden",...C==="y"&&{minWidth:0},...C==="x"&&{minHeight:0},...C==="xy"&&{minWidth:0,minHeight:0},...C===!1&&{minWidth:0,minHeight:0}},children:a.jsx(ti,{classNames:r,styles:i,scrollHideDelay:c,scrollbarSize:s,type:u,dir:f,offsetScrollbars:h,overscrollBehavior:m,viewportRef:A,onScrollPositionChange:y,unstyled:x,variant:S,viewportProps:w,vars:R,scrollbars:C,onBottomReached:E,onTopReached:_,"data-autosize":"true",children:n})})})});ti.classes=Gb;bm.displayName="@mantine/core/ScrollAreaAutosize";bm.classes=Gb;ti.Autosize=bm;var X2={root:"m_87cf2631"};const cI={__staticSelector:"UnstyledButton"},An=sr((e,t)=>{const n=ae("UnstyledButton",cI,e),{className:r,component:i="button",__staticSelector:s,unstyled:c,classNames:u,styles:f,style:h,attributes:m,...g}=n,y=$e({name:s,props:n,classes:X2,className:r,style:h,classNames:u,styles:f,unstyled:c,attributes:m});return a.jsx(le,{...y("root",{focusable:!0}),component:i,ref:t,type:i==="button"?"button":void 0,...g})});An.classes=X2;An.displayName="@mantine/core/UnstyledButton";var J2={root:"m_515a97f8"};const Qb=ve((e,t)=>{const n=ae("VisuallyHidden",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,attributes:h,...m}=n,g=$e({name:"VisuallyHidden",classes:J2,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:h});return a.jsx(le,{component:"span",ref:t,...g("root"),...m})});Qb.classes=J2;Qb.displayName="@mantine/core/VisuallyHidden";var Z2={root:"m_1b7284a3"};const uI=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:Ht(t),"--paper-shadow":Tb(n)}}),gr=sr((e,t)=>{const n=ae("Paper",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,withBorder:f,vars:h,radius:m,shadow:g,variant:y,mod:x,attributes:S,...w}=n,C=$e({name:"Paper",props:n,classes:Z2,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:h,varsResolver:uI});return a.jsx(le,{ref:t,mod:[{"data-with-border":f},x],...C("root"),variant:y,...w})});gr.classes=Z2;gr.displayName="@mantine/core/Paper";function KE(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function XE(e,t,n,r,i){return e==="center"||r==="center"?{left:t}:e==="end"?{[i==="ltr"?"right":"left"]:n}:e==="start"?{[i==="ltr"?"left":"right"]:n}:{}}const dI={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function fI({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,arrowX:s,arrowY:c,dir:u}){const[f,h="center"]=e.split("-"),m={width:t,height:t,transform:"rotate(45deg)",position:"absolute",[dI[f]]:r},g=-t/2;return f==="left"?{...m,...KE(h,c,n,i),right:g,borderLeftColor:"transparent",borderBottomColor:"transparent",clipPath:"polygon(100% 0, 0 0, 100% 100%)"}:f==="right"?{...m,...KE(h,c,n,i),left:g,borderRightColor:"transparent",borderTopColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 100%)"}:f==="top"?{...m,...XE(h,s,n,i,u),bottom:g,borderTopColor:"transparent",borderLeftColor:"transparent",clipPath:"polygon(0 100%, 100% 100%, 100% 0)"}:f==="bottom"?{...m,...XE(h,s,n,i,u),top:g,borderBottomColor:"transparent",borderRightColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 0)"}:{}}const $p=v.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,visible:s,arrowX:c,arrowY:u,style:f,...h},m)=>{const{dir:g}=Rs();return s?a.jsx("div",{...h,ref:m,style:{...f,...fI({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:i,dir:g,arrowX:c,arrowY:u})}}):null});$p.displayName="@mantine/core/FloatingArrow";function eD(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),i=n==="right"?"left":"right";return r===void 0?i:`${i}-${r}`}return t}var tD={root:"m_9814e45f"};const hI={zIndex:Br("modal")},pI=(e,{gradient:t,color:n,backgroundOpacity:r,blur:i,radius:s,zIndex:c})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&Ni(n||"#000",r??.6)||void 0,"--overlay-filter":i?`blur(${ce(i)})`:void 0,"--overlay-radius":s===void 0?void 0:Ht(s),"--overlay-z-index":c?.toString()}}),tu=sr((e,t)=>{const n=ae("Overlay",hI,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,fixed:h,center:m,children:g,radius:y,zIndex:x,gradient:S,blur:w,color:C,backgroundOpacity:T,mod:R,attributes:E,..._}=n,P=$e({name:"Overlay",props:n,classes:tD,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:E,vars:f,varsResolver:pI});return a.jsx(le,{ref:t,...P("root"),mod:[{center:m,fixed:h},R],..._,children:g})});tu.classes=tD;tu.displayName="@mantine/core/Overlay";function Wy(e){const t=document.createElement("div");return t.setAttribute("data-portal","true"),typeof e.className=="string"&&t.classList.add(...e.className.split(" ").filter(Boolean)),typeof e.style=="object"&&Object.assign(t.style,e.style),typeof e.id=="string"&&t.setAttribute("id",e.id),t}function mI({target:e,reuseTargetNode:t,...n}){if(e)return typeof e=="string"?document.querySelector(e)||Wy(n):e;if(t){const r=document.querySelector("[data-mantine-shared-portal-node]");if(r)return r;const i=Wy(n);return i.setAttribute("data-mantine-shared-portal-node","true"),document.body.appendChild(i),i}return Wy(n)}const gI={reuseTargetNode:!0},nD=ve((e,t)=>{const{children:n,target:r,reuseTargetNode:i,...s}=ae("Portal",gI,e),[c,u]=v.useState(!1),f=v.useRef(null);return Ol(()=>(u(!0),f.current=mI({target:r,reuseTargetNode:i,...s}),Ld(t,f.current),!r&&!i&&f.current&&document.body.appendChild(f.current),()=>{!r&&!i&&f.current&&document.body.removeChild(f.current)}),[r]),!c||!f.current?null:Ob.createPortal(a.jsx(a.Fragment,{children:n}),f.current)});nD.displayName="@mantine/core/Portal";const ja=ve(({withinPortal:e=!0,children:t,...n},r)=>fm()==="test"||!e?a.jsx(a.Fragment,{children:t}):a.jsx(nD,{ref:r,...n,children:t}));ja.displayName="@mantine/core/OptionalPortal";const yd=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${e==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),sp={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30px)"},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-30px)"},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(30px)"},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-30px)"},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(-20px) skew(-10deg, -5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(20px) skew(-10deg, -5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(-5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...yd("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...yd("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...yd("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...yd("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...yd("top"),common:{transformOrigin:"top right"}}},JE={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function vI({transition:e,state:t,duration:n,timingFunction:r}){const i={WebkitBackfaceVisibility:"hidden",transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in sp?{transitionProperty:sp[e].transitionProperty,...i,...sp[e].common,...sp[e][JE[t]]}:{}:{transitionProperty:e.transitionProperty,...i,...e.common,...e[JE[t]]}}function yI({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:i,onExit:s,onEntered:c,onExited:u,enterDelay:f,exitDelay:h}){const m=Nn(),g=_b(),y=m.respectReducedMotion?g:!1,[x,S]=v.useState(y?0:e),[w,C]=v.useState(r?"entered":"exited"),T=v.useRef(-1),R=v.useRef(-1),E=v.useRef(-1);function _(){window.clearTimeout(T.current),window.clearTimeout(R.current),cancelAnimationFrame(E.current)}const P=k=>{_();const A=k?i:s,z=k?c:u,U=y?0:k?e:t;S(U),U===0?(typeof A=="function"&&A(),typeof z=="function"&&z(),C(k?"entered":"exited")):E.current=requestAnimationFrame(()=>{Ed.flushSync(()=>{C(k?"pre-entering":"pre-exiting")}),E.current=requestAnimationFrame(()=>{typeof A=="function"&&A(),C(k?"entering":"exiting"),T.current=window.setTimeout(()=>{typeof z=="function"&&z(),C(k?"entered":"exited")},U)})})},O=k=>{if(_(),typeof(k?f:h)!="number"){P(k);return}R.current=window.setTimeout(()=>{P(k)},k?f:h)};return jl(()=>{O(r)},[r]),v.useEffect(()=>()=>{_()},[]),{transitionDuration:x,transitionStatus:w,transitionTimingFunction:n||"ease"}}function uo({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:i,children:s,timingFunction:c="ease",onExit:u,onEntered:f,onEnter:h,onExited:m,enterDelay:g,exitDelay:y}){const x=fm(),{transitionDuration:S,transitionStatus:w,transitionTimingFunction:C}=yI({mounted:i,exitDuration:r,duration:n,timingFunction:c,onExit:u,onEntered:f,onEnter:h,onExited:m,enterDelay:g,exitDelay:y});return S===0||x==="test"?i?a.jsx(a.Fragment,{children:s({})}):e?s({display:"none"}):null:w==="exited"?e?s({display:"none"}):null:a.jsx(a.Fragment,{children:s(vI({transition:t,duration:S,state:w,timingFunction:C}))})}uo.displayName="@mantine/core/Transition";const[xI,rD]=Or("Popover component was not found in the tree");var iD={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};function Sm({children:e,active:t=!0,refProp:n="ref",innerRef:r}){const i=PM(t),s=Vn(i,r),c=Ml(e);return c?v.cloneElement(c,{[n]:s}):e}function oD(e){return a.jsx(Qb,{tabIndex:-1,"data-autofocus":!0,...e})}Sm.displayName="@mantine/core/FocusTrap";oD.displayName="@mantine/core/FocusTrapInitialFocus";Sm.InitialFocus=oD;const Yb=ve((e,t)=>{const n=ae("PopoverDropdown",null,e),{className:r,style:i,vars:s,children:c,onKeyDownCapture:u,variant:f,classNames:h,styles:m,...g}=n,y=rD(),x=i2({opened:y.opened,shouldReturnFocus:y.returnFocus}),S=y.withRoles?{"aria-labelledby":y.getTargetId(),id:y.getDropdownId(),role:"dialog",tabIndex:-1}:{},w=Vn(t,y.floating);return y.disabled?null:a.jsx(ja,{...y.portalProps,withinPortal:y.withinPortal,children:a.jsx(uo,{mounted:y.opened,...y.transitionProps,transition:y.transitionProps?.transition||"fade",duration:y.transitionProps?.duration??150,keepMounted:y.keepMounted,exitDuration:typeof y.transitionProps?.exitDuration=="number"?y.transitionProps.exitDuration:y.transitionProps?.duration,children:C=>a.jsx(Sm,{active:y.trapFocus&&y.opened,innerRef:w,children:a.jsxs(le,{...S,...g,variant:f,onKeyDownCapture:xM(()=>{y.onClose?.(),y.onDismiss?.()},{active:y.closeOnEscape,onTrigger:x,onKeyDown:u}),"data-position":y.placement,"data-fixed":y.floatingStrategy==="fixed"||void 0,...y.getStyles("dropdown",{className:r,props:n,classNames:h,styles:m,style:[{...C,zIndex:y.zIndex,top:y.y??0,left:y.x??0,width:y.width==="target"?void 0:ce(y.width),...y.referenceHidden?{display:"none"}:null},y.resolvedStyles.dropdown,m?.dropdown,i]}),children:[c,a.jsx($p,{ref:y.arrowRef,arrowX:y.arrowX,arrowY:y.arrowY,visible:y.withArrow,position:y.placement,arrowSize:y.arrowSize,arrowRadius:y.arrowRadius,arrowOffset:y.arrowOffset,arrowPosition:y.arrowPosition,...y.getStyles("arrow",{props:n,classNames:h,styles:m})})]})})})})});Yb.classes=iD;Yb.displayName="@mantine/core/PopoverDropdown";const bI={refProp:"ref",popupType:"dialog"},aD=ve((e,t)=>{const{children:n,refProp:r,popupType:i,...s}=ae("PopoverTarget",bI,e),c=Ml(n);if(!c)throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=s,f=rD(),h=Vn(f.reference,um(c),t),m=f.withRoles?{"aria-haspopup":i,"aria-expanded":f.opened,"aria-controls":f.opened?f.getDropdownId():void 0,id:f.getTargetId()}:{},g=c.props;return v.cloneElement(c,{...u,...m,...f.targetProps,className:Ft(f.targetProps.className,u.className,g.className),[r]:h,...f.controlled?null:{onClick:()=>{f.onToggle(),g.onClick?.()}}})});aD.displayName="@mantine/core/PopoverTarget";function SI(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function jI(e,t,n){const r=SI(e.middlewares),i=[O2(e.offset),PL()];return e.dropdownVisible&&n!=="test"&&e.preventPositionChangeWhenVisible&&(r.flip=!1),r.flip&&i.push(typeof r.flip=="boolean"?zp():zp(r.flip)),r.shift&&i.push(Bb(typeof r.shift=="boolean"?{limiter:VE(),padding:5}:{limiter:VE(),padding:5,...r.shift})),r.inline&&i.push(typeof r.inline=="boolean"?Ad():Ad(r.inline)),i.push(M2({element:e.arrowRef,padding:e.arrowOffset})),(r.size||e.width==="target")&&i.push(kL({...typeof r.size=="boolean"?{}:r.size,apply({rects:s,availableWidth:c,availableHeight:u,...f}){const m=t().refs.floating.current?.style??{};r.size&&(typeof r.size=="object"&&r.size.apply?r.size.apply({rects:s,availableWidth:c,availableHeight:u,...f}):Object.assign(m,{maxWidth:`${c}px`,maxHeight:`${u}px`})),e.width==="target"&&Object.assign(m,{width:`${s.reference.width}px`})}})),i}function wI(e){const t=fm(),[n,r]=or({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),i=v.useRef(n),s=()=>{n&&!e.disabled&&r(!1)},c=()=>{e.disabled||r(!n)},u=qb({strategy:e.strategy,placement:e.preventPositionChangeWhenVisible?e.positionRef.current:e.position,middleware:jI(e,()=>u,t),whileElementsMounted:e.keepMounted?void 0:zx});return v.useEffect(()=>{if(!(!u.refs.reference.current||!u.refs.floating.current)&&n)return zx(u.refs.reference.current,u.refs.floating.current,u.update)},[n,u.update]),jl(()=>{e.onPositionChange?.(u.placement),e.positionRef.current=u.placement},[u.placement,e.preventPositionChangeWhenVisible]),jl(()=>{n!==i.current&&(n?e.onOpen?.():e.onClose?.()),i.current=n},[n,e.onClose,e.onOpen]),Ol(()=>{let f=-1;return n&&(f=window.setTimeout(()=>e.setDropdownVisible(!0),4)),()=>{window.clearTimeout(f)}},[n,e.position]),{floating:u,controlled:typeof e.opened=="boolean",opened:n,onClose:s,onToggle:c}}const CI={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,clickOutsideEvents:["mousedown","touchstart"],zIndex:Br("popover"),__staticSelector:"Popover",width:"max-content"},EI=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:Ht(t),"--popover-shadow":Tb(n)}});function ni(e){const t=ae("Popover",CI,e),{children:n,position:r,offset:i,onPositionChange:s,positionDependencies:c,opened:u,transitionProps:f,onExitTransitionEnd:h,onEnterTransitionEnd:m,width:g,middlewares:y,withArrow:x,arrowSize:S,arrowOffset:w,arrowRadius:C,arrowPosition:T,unstyled:R,classNames:E,styles:_,closeOnClickOutside:P,withinPortal:O,portalProps:k,closeOnEscape:A,clickOutsideEvents:z,trapFocus:U,onClose:K,onDismiss:W,onOpen:ee,onChange:B,zIndex:G,radius:L,shadow:I,id:$,defaultOpened:V,__staticSelector:X,withRoles:M,disabled:F,returnFocus:ie,variant:de,keepMounted:Se,vars:Ce,floatingStrategy:je,withOverlay:Ke,overlayProps:_e,hideDetached:ht,attributes:Ct,preventPositionChangeWhenVisible:Et,...qe}=t,ct=$e({name:X,props:t,classes:iD,classNames:E,styles:_,unstyled:R,attributes:Ct,rootSelector:"dropdown",vars:Ce,varsResolver:EI}),{resolvedStyles:Tt}=Ll({classNames:E,styles:_,props:t}),[It,Te]=v.useState(u??V??!1),Oe=v.useRef(r),Le=v.useRef(null),[Ie,at]=v.useState(null),[Ze,dt]=v.useState(null),{dir:ft}=Rs(),Ee=fm(),he=vr($),ke=wI({middlewares:y,width:g,position:eD(ft,r),offset:typeof i=="number"?i+(x?S/2:0):i,arrowRef:Le,arrowOffset:w,onPositionChange:s,positionDependencies:c,opened:u,defaultOpened:V,onChange:B,onOpen:ee,onClose:K,onDismiss:W,strategy:je,dropdownVisible:It,setDropdownVisible:Te,positionRef:Oe,disabled:F,preventPositionChangeWhenVisible:Et,keepMounted:Se});wM(()=>{P&&(ke.onClose(),W?.())},z,[Ie,Ze]);const Dt=v.useCallback(vn=>{at(vn),ke.floating.refs.setReference(vn)},[ke.floating.refs.setReference]),Rt=v.useCallback(vn=>{dt(vn),ke.floating.refs.setFloating(vn)},[ke.floating.refs.setFloating]),At=v.useCallback(()=>{f?.onExited?.(),h?.(),Te(!1),Et||(Oe.current=r)},[f?.onExited,h,Et,r]),ln=v.useCallback(()=>{f?.onEntered?.(),m?.()},[f?.onEntered,m]);return a.jsxs(xI,{value:{returnFocus:ie,disabled:F,controlled:ke.controlled,reference:Dt,floating:Rt,x:ke.floating.x,y:ke.floating.y,arrowX:ke.floating?.middlewareData?.arrow?.x,arrowY:ke.floating?.middlewareData?.arrow?.y,opened:ke.opened,arrowRef:Le,transitionProps:{...f,onExited:At,onEntered:ln},width:g,withArrow:x,arrowSize:S,arrowOffset:w,arrowRadius:C,arrowPosition:T,placement:ke.floating.placement,trapFocus:U,withinPortal:O,portalProps:k,zIndex:G,radius:L,shadow:I,closeOnEscape:A,onDismiss:W,onClose:ke.onClose,onToggle:ke.onToggle,getTargetId:()=>`${he}-target`,getDropdownId:()=>`${he}-dropdown`,withRoles:M,targetProps:qe,__staticSelector:X,classNames:E,styles:_,unstyled:R,variant:de,keepMounted:Se,getStyles:ct,resolvedStyles:Tt,floatingStrategy:je,referenceHidden:ht&&Ee!=="test"?ke.floating.middlewareData.hide?.referenceHidden:!1},children:[n,Ke&&a.jsx(uo,{transition:"fade",mounted:ke.opened,duration:f?.duration||250,exitDuration:f?.exitDuration||250,children:vn=>a.jsx(ja,{withinPortal:O,children:a.jsx(tu,{..._e,...ct("overlay",{className:_e?.className,style:[vn,_e?.style]})})})})]})}ni.Target=aD;ni.Dropdown=Yb;ni.displayName="@mantine/core/Popover";ni.extend=e=>e;var oo={root:"m_5ae2e3c",barsLoader:"m_7a2bd4cd",bar:"m_870bb79","bars-loader-animation":"m_5d2b3b9d",dotsLoader:"m_4e3f22d7",dot:"m_870c4af","loader-dots-animation":"m_aac34a1",ovalLoader:"m_b34414df","oval-loader-animation":"m_f8e89c4b"};const sD=v.forwardRef(({className:e,...t},n)=>a.jsxs(le,{component:"span",className:Ft(oo.barsLoader,e),...t,ref:n,children:[a.jsx("span",{className:oo.bar}),a.jsx("span",{className:oo.bar}),a.jsx("span",{className:oo.bar})]}));sD.displayName="@mantine/core/Bars";const lD=v.forwardRef(({className:e,...t},n)=>a.jsxs(le,{component:"span",className:Ft(oo.dotsLoader,e),...t,ref:n,children:[a.jsx("span",{className:oo.dot}),a.jsx("span",{className:oo.dot}),a.jsx("span",{className:oo.dot})]}));lD.displayName="@mantine/core/Dots";const cD=v.forwardRef(({className:e,...t},n)=>a.jsx(le,{component:"span",className:Ft(oo.ovalLoader,e),...t,ref:n}));cD.displayName="@mantine/core/Oval";const uD={bars:sD,oval:cD,dots:lD},TI={loaders:uD,type:"oval"},RI=(e,{size:t,color:n})=>({root:{"--loader-size":ot(t,"loader-size"),"--loader-color":n?Kt(n,e):void 0}}),Pr=ve((e,t)=>{const n=ae("Loader",TI,e),{size:r,color:i,type:s,vars:c,className:u,style:f,classNames:h,styles:m,unstyled:g,loaders:y,variant:x,children:S,attributes:w,...C}=n,T=$e({name:"Loader",props:n,classes:oo,className:u,style:f,classNames:h,styles:m,unstyled:g,attributes:w,vars:c,varsResolver:RI});return S?a.jsx(le,{...T("root"),ref:t,...C,children:S}):a.jsx(le,{...T("root"),ref:t,component:y[s],variant:x,size:r,...C})});Pr.defaultLoaders=uD;Pr.classes=oo;Pr.displayName="@mantine/core/Loader";var hu={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21",groupSection:"m_437b6484"};const ZE={orientation:"horizontal"},_I=(e,{borderWidth:t})=>({group:{"--ai-border-width":ce(t)}}),Kb=ve((e,t)=>{const n=ae("ActionIconGroup",ZE,e),{className:r,style:i,classNames:s,styles:c,unstyled:u,orientation:f,vars:h,borderWidth:m,variant:g,mod:y,attributes:x,...S}=ae("ActionIconGroup",ZE,e),w=$e({name:"ActionIconGroup",props:n,classes:hu,className:r,style:i,classNames:s,styles:c,unstyled:u,attributes:x,vars:h,varsResolver:_I,rootSelector:"group"});return a.jsx(le,{...w("group"),ref:t,variant:g,mod:[{"data-orientation":f},y],role:"group",...S})});Kb.classes=hu;Kb.displayName="@mantine/core/ActionIconGroup";const DI=(e,{radius:t,color:n,gradient:r,variant:i,autoContrast:s,size:c})=>{const u=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||"filled",autoContrast:s});return{groupSection:{"--section-height":ot(c,"section-height"),"--section-padding-x":ot(c,"section-padding-x"),"--section-fz":Kn(c),"--section-radius":t===void 0?void 0:Ht(t),"--section-bg":n||i?u.background:void 0,"--section-color":u.color,"--section-bd":n||i?u.border:void 0}}},Xb=ve((e,t)=>{const n=ae("ActionIconGroupSection",null,e),{className:r,style:i,classNames:s,styles:c,unstyled:u,vars:f,variant:h,gradient:m,radius:g,autoContrast:y,attributes:x,...S}=n,w=$e({name:"ActionIconGroupSection",props:n,classes:hu,className:r,style:i,classNames:s,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:DI,rootSelector:"groupSection"});return a.jsx(le,{...w("groupSection"),ref:t,variant:h,...S})});Xb.classes=hu;Xb.displayName="@mantine/core/ActionIconGroupSection";const AI=(e,{size:t,radius:n,variant:r,gradient:i,color:s,autoContrast:c})=>{const u=e.variantColorResolver({color:s||e.primaryColor,theme:e,gradient:i,variant:r||"filled",autoContrast:c});return{root:{"--ai-size":ot(t,"ai-size"),"--ai-radius":n===void 0?void 0:Ht(n),"--ai-bg":s||r?u.background:void 0,"--ai-hover":s||r?u.hover:void 0,"--ai-hover-color":s||r?u.hoverColor:void 0,"--ai-color":u.color,"--ai-bd":s||r?u.border:void 0}}},Pn=sr((e,t)=>{const n=ae("ActionIcon",null,e),{className:r,unstyled:i,variant:s,classNames:c,styles:u,style:f,loading:h,loaderProps:m,size:g,color:y,radius:x,__staticSelector:S,gradient:w,vars:C,children:T,disabled:R,"data-disabled":E,autoContrast:_,mod:P,attributes:O,...k}=n,A=$e({name:["ActionIcon",S],props:n,className:r,style:f,classes:hu,classNames:c,styles:u,unstyled:i,attributes:O,vars:C,varsResolver:AI});return a.jsxs(An,{...A("root",{active:!R&&!h&&!E}),...k,unstyled:i,variant:s,size:g,disabled:R||h,ref:t,mod:[{loading:h,disabled:R||E},P],children:[typeof h=="boolean"&&a.jsx(uo,{mounted:h,transition:"slide-down",duration:150,children:z=>a.jsx(le,{component:"span",...A("loader",{style:z}),"aria-hidden":!0,children:a.jsx(Pr,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...m})})}),a.jsx(le,{component:"span",mod:{loading:h},...A("icon"),children:T})]})});Pn.classes=hu;Pn.displayName="@mantine/core/ActionIcon";Pn.Group=Kb;Pn.GroupSection=Xb;const dD=v.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>a.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n,children:a.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}));dD.displayName="@mantine/core/CloseIcon";var fD={root:"m_86a44da5","root--subtle":"m_220c80f2"};const kI={variant:"subtle"},PI=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":ot(t,"cb-size"),"--cb-radius":n===void 0?void 0:Ht(n),"--cb-icon-size":ce(r)}}),_s=sr((e,t)=>{const n=ae("CloseButton",kI,e),{iconSize:r,children:i,vars:s,radius:c,className:u,classNames:f,style:h,styles:m,unstyled:g,"data-disabled":y,disabled:x,variant:S,icon:w,mod:C,attributes:T,__staticSelector:R,...E}=n,_=$e({name:R||"CloseButton",props:n,className:u,style:h,classes:fD,classNames:f,styles:m,unstyled:g,attributes:T,vars:s,varsResolver:PI});return a.jsxs(An,{ref:t,...E,unstyled:g,variant:S,disabled:x,mod:[{disabled:x||y},C],..._("root",{variant:S,active:!x&&!y}),children:[w||a.jsx(dD,{}),i]})});_s.classes=fD;_s.displayName="@mantine/core/CloseButton";function NI(e){return v.Children.toArray(e).filter(Boolean)}var hD={root:"m_4081bf90"};const OI={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},MI=(e,{grow:t,preventGrowOverflow:n,gap:r,align:i,justify:s,wrap:c},{childWidth:u})=>({root:{"--group-child-width":t&&n?u:void 0,"--group-gap":Yn(r),"--group-align":i,"--group-justify":s,"--group-wrap":c}}),xe=ve((e,t)=>{const n=ae("Group",OI,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,children:f,gap:h,align:m,justify:g,wrap:y,grow:x,preventGrowOverflow:S,vars:w,variant:C,__size:T,mod:R,attributes:E,..._}=n,P=NI(f),O=P.length,k=Yn(h??"md"),z={childWidth:`calc(${100/O}% - (${k} - ${k} / ${O}))`},U=$e({name:"Group",props:n,stylesCtx:z,className:i,style:s,classes:hD,classNames:r,styles:c,unstyled:u,attributes:E,vars:w,varsResolver:MI});return a.jsx(le,{...U("root"),ref:t,variant:C,mod:[{grow:x},R],size:T,..._,children:P})});xe.classes=hD;xe.displayName="@mantine/core/Group";const[LI,Da]=Or("ModalBase component was not found in tree");function II({opened:e,transitionDuration:t}){const[n,r]=v.useState(e),i=v.useRef(-1),c=_b()?0:t;return v.useEffect(()=>(e?(r(!0),window.clearTimeout(i.current)):c===0?r(!1):i.current=window.setTimeout(()=>r(!1),c),()=>window.clearTimeout(i.current)),[e,c]),n}function zI({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:s,returnFocus:c}){const u=vr(e),[f,h]=v.useState(!1),[m,g]=v.useState(!1),y=typeof t?.duration=="number"?t?.duration:200,x=II({opened:n,transitionDuration:y});return l2("keydown",S=>{S.key==="Escape"&&i&&!S.isComposing&&n&&S.target?.getAttribute("data-mantine-stop-propagation")!=="true"&&s()},{capture:!0}),i2({opened:n,shouldReturnFocus:r&&c}),{_id:u,titleMounted:f,bodyMounted:m,shouldLockScroll:x,setTitleMounted:h,setBodyMounted:g}}const pD=v.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:i,onExitTransitionEnd:s,onEnterTransitionEnd:c,trapFocus:u,closeOnEscape:f,returnFocus:h,closeOnClickOutside:m,withinPortal:g,portalProps:y,lockScroll:x,children:S,zIndex:w,shadow:C,padding:T,__vars:R,unstyled:E,removeScrollProps:_,...P},O)=>{const{_id:k,titleMounted:A,bodyMounted:z,shouldLockScroll:U,setTitleMounted:K,setBodyMounted:W}=zI({id:r,transitionProps:i,opened:t,trapFocus:u,closeOnEscape:f,onClose:n,returnFocus:h}),{key:ee,...B}=_||{};return a.jsx(ja,{...y,withinPortal:g,children:a.jsx(LI,{value:{opened:t,onClose:n,closeOnClickOutside:m,onExitTransitionEnd:s,onEnterTransitionEnd:c,transitionProps:{...i,keepMounted:e},getTitleId:()=>`${k}-title`,getBodyId:()=>`${k}-body`,titleMounted:A,bodyMounted:z,setTitleMounted:K,setBodyMounted:W,trapFocus:u,closeOnEscape:f,zIndex:w,unstyled:E},children:a.jsx(Sl,{enabled:U&&x,...B,children:a.jsx(le,{ref:O,...P,__vars:{...R,"--mb-z-index":(w||Br("modal")).toString(),"--mb-shadow":Tb(C),"--mb-padding":Yn(T)},children:S})},ee)})})});pD.displayName="@mantine/core/ModalBase";var nu={title:"m_615af6c9",header:"m_b5489c3c",inner:"m_60c222c7",content:"m_fd1ab0aa",close:"m_606cb269",body:"m_5df29311"};function $I(){const e=Da();return v.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}const mD=v.forwardRef(({className:e,...t},n)=>{const r=$I(),i=Da();return a.jsx(le,{ref:n,...t,id:r,className:Ft({[nu.body]:!i.unstyled},e)})});mD.displayName="@mantine/core/ModalBaseBody";const gD=v.forwardRef(({className:e,onClick:t,...n},r)=>{const i=Da();return a.jsx(_s,{ref:r,...n,onClick:s=>{i.onClose(),t?.(s)},className:Ft({[nu.close]:!i.unstyled},e),unstyled:i.unstyled})});gD.displayName="@mantine/core/ModalBaseCloseButton";const vD=v.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:i,...s},c)=>{const u=Da();return a.jsx(uo,{mounted:u.opened,transition:"pop",...u.transitionProps,onExited:()=>{u.onExitTransitionEnd?.(),u.transitionProps?.onExited?.()},onEntered:()=>{u.onEnterTransitionEnd?.(),u.transitionProps?.onEntered?.()},...e,children:f=>a.jsx("div",{...n,className:Ft({[nu.inner]:!u.unstyled},n.className),children:a.jsx(Sm,{active:u.opened&&u.trapFocus,innerRef:c,children:a.jsx(gr,{...s,component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":u.bodyMounted?u.getBodyId():void 0,"aria-labelledby":u.titleMounted?u.getTitleId():void 0,style:[i,f],className:Ft({[nu.content]:!u.unstyled},t),unstyled:u.unstyled,children:s.children})})})})});vD.displayName="@mantine/core/ModalBaseContent";const yD=v.forwardRef(({className:e,...t},n)=>{const r=Da();return a.jsx(le,{component:"header",ref:n,className:Ft({[nu.header]:!r.unstyled},e),...t})});yD.displayName="@mantine/core/ModalBaseHeader";const UI={duration:200,timingFunction:"ease",transition:"fade"};function BI(e){const t=Da();return{...UI,...t.transitionProps,...e}}const xD=v.forwardRef(({onClick:e,transitionProps:t,style:n,visible:r,...i},s)=>{const c=Da(),u=BI(t);return a.jsx(uo,{mounted:r!==void 0?r:c.opened,...u,transition:"fade",children:f=>a.jsx(tu,{ref:s,fixed:!0,style:[n,f],zIndex:c.zIndex,unstyled:c.unstyled,onClick:h=>{e?.(h),c.closeOnClickOutside&&c.onClose()},...i})})});xD.displayName="@mantine/core/ModalBaseOverlay";function VI(){const e=Da();return v.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const bD=v.forwardRef(({className:e,...t},n)=>{const r=VI(),i=Da();return a.jsx(le,{component:"h2",ref:n,className:Ft({[nu.title]:!i.unstyled},e),...t,id:r})});bD.displayName="@mantine/core/ModalBaseTitle";function FI({children:e}){return a.jsx(a.Fragment,{children:e})}const[HI,qI]=Fo({size:"sm"});var Fi={wrapper:"m_6c018570",input:"m_8fb7ebe7",section:"m_82577fc2",placeholder:"m_88bacfd0",root:"m_46b77525",label:"m_8fdc1311",required:"m_78a94662",error:"m_8f816625",description:"m_fe47ce59"};const SD=ve((e,t)=>{const n=ae("InputClearButton",null,e),{size:r,variant:i,vars:s,classNames:c,styles:u,...f}=n,h=qI(),{resolvedClassNames:m,resolvedStyles:g}=Ll({classNames:c,styles:u,props:n});return a.jsx(_s,{variant:i||"transparent",ref:t,size:r||h?.size||"sm",classNames:m,styles:g,__staticSelector:"InputClearButton",style:{pointerEvents:"all",background:"var(--input-bg)",...f.style},...f})});SD.displayName="@mantine/core/InputClearButton";const GI={xs:7,sm:8,md:10,lg:12,xl:15};function WI({__clearable:e,__clearSection:t,rightSection:n,__defaultRightSection:r,size:i="sm"}){const s=e&&t;return s&&(n||r)?a.jsxs("div",{"data-combined-clear-section":!0,style:{display:"flex",gap:2,alignItems:"center",paddingInlineEnd:GI[i]},children:[s,n||r]}):n===null?null:n||s||r}const[QI,pu]=Fo({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0}),YI=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Kn(t)} - ${ce(2)})`}}),jm=ve((e,t)=>{const n=ae("InputDescription",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,size:h,__staticSelector:m,__inheritStyles:g=!0,attributes:y,variant:x,...S}=ae("InputDescription",null,n),w=pu(),C=$e({name:["InputWrapper",m],props:n,classes:Fi,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:y,rootSelector:"description",vars:f,varsResolver:YI}),T=g&&w?.getStyles||C;return a.jsx(le,{component:"p",ref:t,variant:x,size:h,...T("description",w?.getStyles?{className:i,style:s}:void 0),...S})});jm.classes=Fi;jm.displayName="@mantine/core/InputDescription";const KI=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Kn(t)} - ${ce(2)})`}}),wm=ve((e,t)=>{const n=ae("InputError",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,size:h,attributes:m,__staticSelector:g,__inheritStyles:y=!0,variant:x,...S}=n,w=$e({name:["InputWrapper",g],props:n,classes:Fi,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:m,rootSelector:"error",vars:f,varsResolver:KI}),C=pu(),T=y&&C?.getStyles||w;return a.jsx(le,{component:"p",ref:t,variant:x,size:h,...T("error",C?.getStyles?{className:i,style:s}:void 0),...S})});wm.classes=Fi;wm.displayName="@mantine/core/InputError";const eT={labelElement:"label"},XI=(e,{size:t})=>({label:{"--input-label-size":Kn(t),"--input-asterisk-color":void 0}}),cf=ve((e,t)=>{const n=ae("InputLabel",eT,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,labelElement:h,size:m,required:g,htmlFor:y,onMouseDown:x,children:S,__staticSelector:w,variant:C,mod:T,attributes:R,...E}=ae("InputLabel",eT,n),_=$e({name:["InputWrapper",w],props:n,classes:Fi,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:R,rootSelector:"label",vars:f,varsResolver:XI}),P=pu(),O=P?.getStyles||_;return a.jsxs(le,{...O("label",P?.getStyles?{className:i,style:s}:void 0),component:h,variant:C,size:m,ref:t,htmlFor:h==="label"?y:void 0,mod:[{required:g},T],onMouseDown:k=>{x?.(k),!k.defaultPrevented&&k.detail>1&&k.preventDefault()},...E,children:[S,g&&a.jsx("span",{...O("required"),"aria-hidden":!0,children:" *"})]})});cf.classes=Fi;cf.displayName="@mantine/core/InputLabel";const Jb=ve((e,t)=>{const n=ae("InputPlaceholder",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,__staticSelector:h,variant:m,error:g,mod:y,attributes:x,...S}=n,w=$e({name:["InputPlaceholder",h],props:n,classes:Fi,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:x,rootSelector:"placeholder"});return a.jsx(le,{...w("placeholder"),mod:[{error:!!g},y],component:"span",variant:m,ref:t,...S})});Jb.classes=Fi;Jb.displayName="@mantine/core/InputPlaceholder";function JI(e,{hasDescription:t,hasError:n}){const r=e.findIndex(f=>f==="input"),i=e.slice(0,r),s=e.slice(r+1),c=t&&i.includes("description")||n&&i.includes("error");return{offsetBottom:t&&s.includes("description")||n&&s.includes("error"),offsetTop:c}}const ZI={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},e6=(e,{size:t})=>({label:{"--input-label-size":Kn(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Kn(t)} - ${ce(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Kn(t)} - ${ce(2)})`}}),uf=ve((e,t)=>{const n=ae("InputWrapper",ZI,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,size:h,variant:m,__staticSelector:g,inputContainer:y,inputWrapperOrder:x,label:S,error:w,description:C,labelProps:T,descriptionProps:R,errorProps:E,labelElement:_,children:P,withAsterisk:O,id:k,required:A,__stylesApiProps:z,mod:U,attributes:K,...W}=n,ee=$e({name:["InputWrapper",g],props:z||n,classes:Fi,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:K,vars:f,varsResolver:e6}),B={size:h,variant:m,__staticSelector:g},G=vr(k),L=typeof O=="boolean"?O:A,I=E?.id||`${G}-error`,$=R?.id||`${G}-description`,V=G,X=!!w&&typeof w!="boolean",M=!!C,F=`${X?I:""} ${M?$:""}`,ie=F.trim().length>0?F.trim():void 0,de=T?.id||`${G}-label`,Se=S&&a.jsx(cf,{labelElement:_,id:de,htmlFor:V,required:L,...B,...T,children:S},"label"),Ce=M&&a.jsx(jm,{...R,...B,size:R?.size||B.size,id:R?.id||$,children:C},"description"),je=a.jsx(v.Fragment,{children:y(P)},"input"),Ke=X&&v.createElement(wm,{...E,...B,size:E?.size||B.size,key:"error",id:E?.id||I},w),_e=x.map(ht=>{switch(ht){case"label":return Se;case"input":return je;case"description":return Ce;case"error":return Ke;default:return null}});return a.jsx(QI,{value:{getStyles:ee,describedBy:ie,inputId:V,labelId:de,...JI(x,{hasDescription:M,hasError:X})},children:a.jsx(le,{ref:t,variant:m,size:h,mod:[{error:!!w},U],...ee("root"),...W,children:_e})})});uf.classes=Fi;uf.displayName="@mantine/core/InputWrapper";const t6={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0,size:"sm"},n6=(e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-margin-bottom":n.offsetBottom?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-height":ot(t.size,"input-height"),"--input-fz":Kn(t.size),"--input-radius":t.radius===void 0?void 0:Ht(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?ce(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?ce(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?ot(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),mn=sr((e,t)=>{const n=ae("Input",t6,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,required:f,__staticSelector:h,__stylesApiProps:m,size:g,wrapperProps:y,error:x,disabled:S,leftSection:w,leftSectionProps:C,leftSectionWidth:T,rightSection:R,rightSectionProps:E,rightSectionWidth:_,rightSectionPointerEvents:P,leftSectionPointerEvents:O,variant:k,vars:A,pointer:z,multiline:U,radius:K,id:W,withAria:ee,withErrorStyles:B,mod:G,inputSize:L,attributes:I,__clearSection:$,__clearable:V,__defaultRightSection:X,...M}=n,{styleProps:F,rest:ie}=_a(M),de=pu(),Se={offsetBottom:de?.offsetBottom,offsetTop:de?.offsetTop},Ce=$e({name:["Input",h],props:m||n,classes:Fi,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:I,stylesCtx:Se,rootSelector:"wrapper",vars:A,varsResolver:n6}),je=ee?{required:f,disabled:S,"aria-invalid":!!x,"aria-describedby":de?.describedBy,id:de?.inputId||W}:{},Ke=WI({__clearable:V,__clearSection:$,rightSection:R,__defaultRightSection:X,size:g});return a.jsx(HI,{value:{size:g||"sm"},children:a.jsxs(le,{...Ce("wrapper"),...F,...y,mod:[{error:!!x&&B,pointer:z,disabled:S,multiline:U,"data-with-right-section":!!Ke,"data-with-left-section":!!w},G],variant:k,size:g,children:[w&&a.jsx("div",{...C,"data-position":"left",...Ce("section",{className:C?.className,style:C?.style}),children:w}),a.jsx(le,{component:"input",...ie,...je,ref:t,required:f,mod:{disabled:S,error:!!x&&B},variant:k,__size:L,...Ce("input")}),Ke&&a.jsx("div",{...E,"data-position":"right",...Ce("section",{className:E?.className,style:E?.style}),children:Ke})]})})});mn.classes=Fi;mn.Wrapper=uf;mn.Label=cf;mn.Error=wm;mn.Description=jm;mn.Placeholder=Jb;mn.ClearButton=SD;mn.displayName="@mantine/core/Input";function r6(e,t,n){const r=ae(e,t,n),{label:i,description:s,error:c,required:u,classNames:f,styles:h,className:m,unstyled:g,__staticSelector:y,__stylesApiProps:x,errorProps:S,labelProps:w,descriptionProps:C,wrapperProps:T,id:R,size:E,style:_,inputContainer:P,inputWrapperOrder:O,withAsterisk:k,variant:A,vars:z,mod:U,attributes:K,...W}=r,{styleProps:ee,rest:B}=_a(W),G={label:i,description:s,error:c,required:u,classNames:f,className:m,__staticSelector:y,__stylesApiProps:x||r,errorProps:S,labelProps:w,descriptionProps:C,unstyled:g,styles:h,size:E,style:_,inputContainer:P,inputWrapperOrder:O,withAsterisk:k,variant:A,id:R,mod:U,attributes:K,...T};return{...B,classNames:f,styles:h,unstyled:g,wrapperProps:{...G,...ee},inputProps:{required:u,classNames:f,styles:h,unstyled:g,size:E,__staticSelector:y,__stylesApiProps:x||r,error:c,variant:A,id:R,attributes:K}}}const i6={__staticSelector:"InputBase",withAria:!0,size:"sm"},Vr=sr((e,t)=>{const{inputProps:n,wrapperProps:r,...i}=r6("InputBase",i6,e);return a.jsx(mn.Wrapper,{...r,children:a.jsx(mn,{...n,...i,ref:t})})});Vr.classes={...mn.classes,...mn.Wrapper.classes};Vr.displayName="@mantine/core/InputBase";const o6={gap:{type:"spacing",property:"gap"},rowGap:{type:"spacing",property:"rowGap"},columnGap:{type:"spacing",property:"columnGap"},align:{type:"identity",property:"alignItems"},justify:{type:"identity",property:"justifyContent"},wrap:{type:"identity",property:"flexWrap"},direction:{type:"identity",property:"flexDirection"}};var jD={root:"m_8bffd616"};const ar=sr((e,t)=>{const n=ae("Flex",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,gap:h,rowGap:m,columnGap:g,align:y,justify:x,wrap:S,direction:w,attributes:C,...T}=n,R=$e({name:"Flex",classes:jD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f}),E=Nn(),_=sf(),P=g2({styleProps:{gap:h,rowGap:m,columnGap:g,align:y,justify:x,wrap:S,direction:w},theme:E,data:o6});return a.jsxs(a.Fragment,{children:[P.hasResponsiveStyles&&a.jsx(zl,{selector:`.${_}`,styles:P.styles,media:P.media}),a.jsx(le,{ref:t,...R("root",{className:_,style:Es(P.inlineStyles)}),...T})]})});ar.classes=jD;ar.displayName="@mantine/core/Flex";var wD={root:"m_96b553a6"};function a6(e,t){if(!t||!e)return!1;let n=t.parentNode;for(;n!=null;){if(n===e)return!0;n=n.parentNode}return!1}function s6({target:e,parent:t,ref:n,displayAfterTransitionEnd:r}){const i=v.useRef(-1),[s,c]=v.useState(!1),[u,f]=v.useState(typeof r=="boolean"?r:!1),h=()=>{if(!e||!t||!n.current)return;const x=e.getBoundingClientRect(),S=t.getBoundingClientRect(),w=window.getComputedStyle(e),C=window.getComputedStyle(t),T=gs(w.borderTopWidth)+gs(C.borderTopWidth),R=gs(w.borderLeftWidth)+gs(C.borderLeftWidth),E={top:x.top-S.top-T,left:x.left-S.left-R,width:x.width,height:x.height};n.current.style.transform=`translateY(${E.top}px) translateX(${E.left}px)`,n.current.style.width=`${E.width}px`,n.current.style.height=`${E.height}px`},m=()=>{window.clearTimeout(i.current),n.current&&(n.current.style.transitionDuration="0ms"),h(),i.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration="")},30)},g=v.useRef(null),y=v.useRef(null);return v.useEffect(()=>{if(h(),e)return g.current=new ResizeObserver(m),g.current.observe(e),t&&(y.current=new ResizeObserver(m),y.current.observe(t)),()=>{g.current?.disconnect(),y.current?.disconnect()}},[t,e]),v.useEffect(()=>{if(t){const x=S=>{a6(S.target,t)&&(m(),f(!1))};return t.addEventListener("transitionend",x),()=>{t.removeEventListener("transitionend",x)}}},[t]),QM(()=>{c2()!=="test"&&c(!0)},20,{autoInvoke:!0}),YM(x=>{x.forEach(S=>{S.type==="attributes"&&S.attributeName==="dir"&&m()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:s,hidden:u}}const l6=(e,{transitionDuration:t})=>({root:{"--transition-duration":typeof t=="number"?`${t}ms`:t}}),Zb=ve((e,t)=>{const n=ae("FloatingIndicator",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,target:h,parent:m,transitionDuration:g,mod:y,displayAfterTransitionEnd:x,attributes:S,...w}=n,C=$e({name:"FloatingIndicator",classes:wD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:l6}),T=v.useRef(null),{initialized:R,hidden:E}=s6({target:h,parent:m,ref:T,displayAfterTransitionEnd:x}),_=Vn(t,T);return!h||!m?null:a.jsx(le,{ref:_,mod:[{initialized:R,hidden:E},y],...C("root"),...w})});Zb.displayName="@mantine/core/FloatingIndicator";Zb.classes=wD;function CD({open:e,close:t,openDelay:n,closeDelay:r}){const i=v.useRef(-1),s=v.useRef(-1),c=()=>{window.clearTimeout(i.current),window.clearTimeout(s.current)},u=()=>{c(),n===0||n===void 0?e():i.current=window.setTimeout(e,n)},f=()=>{c(),r===0||r===void 0?t():s.current=window.setTimeout(t,r)};return v.useEffect(()=>c,[]),{openDropdown:u,closeDropdown:f}}function ED({style:e,size:t=16,...n}){return a.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...e,width:ce(t),height:ce(t),display:"block"},...n,children:a.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}ED.displayName="@mantine/core/AccordionChevron";var TD={root:"m_66836ed3",wrapper:"m_a5d60502",body:"m_667c2793",title:"m_6a03f287",label:"m_698f4f23",icon:"m_667f2a6a",message:"m_7fa78076",closeButton:"m_87f54839"};const c6=(e,{radius:t,color:n,variant:r,autoContrast:i})=>{const s=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light",autoContrast:i});return{root:{"--alert-radius":t===void 0?void 0:Ht(t),"--alert-bg":n||r?s.background:void 0,"--alert-color":s.color,"--alert-bd":n||r?s.border:void 0}}},qo=ve((e,t)=>{const n=ae("Alert",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,radius:h,color:m,title:g,children:y,id:x,icon:S,withCloseButton:w,onClose:C,closeButtonLabel:T,variant:R,autoContrast:E,role:_,attributes:P,...O}=n,k=$e({name:"Alert",classes:TD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:P,vars:f,varsResolver:c6}),A=vr(x),z=g&&`${A}-title`||void 0,U=`${A}-body`;return a.jsx(le,{id:A,...k("root",{variant:R}),variant:R,ref:t,role:_||"alert",...O,"aria-describedby":y?U:void 0,"aria-labelledby":g?z:void 0,children:a.jsxs("div",{...k("wrapper"),children:[S&&a.jsx("div",{...k("icon"),children:S}),a.jsxs("div",{...k("body"),children:[g&&a.jsx("div",{...k("title"),"data-with-close-button":w||void 0,children:a.jsx("span",{id:z,...k("label"),children:g})}),y&&a.jsx("div",{id:U,...k("message"),"data-variant":R,children:y})]}),w&&a.jsx(_s,{...k("closeButton"),onClick:C,variant:"transparent",size:16,iconSize:16,"aria-label":T,unstyled:u})]})})});qo.classes=TD;qo.displayName="@mantine/core/Alert";var RD={root:"m_b6d8b162"};function u6(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const d6={inherit:!1},f6=(e,{variant:t,lineClamp:n,gradient:r,size:i,color:s})=>({root:{"--text-fz":Kn(i),"--text-lh":t2(i),"--text-gradient":t==="gradient"?Ax(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":s?Kt(s,e):void 0}}),ge=sr((e,t)=>{const n=ae("Text",d6,e),{lineClamp:r,truncate:i,inline:s,inherit:c,gradient:u,span:f,__staticSelector:h,vars:m,className:g,style:y,classNames:x,styles:S,unstyled:w,variant:C,mod:T,size:R,attributes:E,..._}=n,P=$e({name:["Text",h],props:n,classes:RD,className:g,style:y,classNames:x,styles:S,unstyled:w,attributes:E,vars:m,varsResolver:f6});return a.jsx(le,{...P("root",{focusable:!0}),ref:t,component:f?"span":"p",variant:C,mod:[{"data-truncate":u6(i),"data-line-clamp":typeof r=="number","data-inline":s,"data-inherit":c},T],size:R,..._})});ge.classes=RD;ge.displayName="@mantine/core/Text";var _D={root:"m_849cf0da"};const h6={underline:"hover"},wt=sr((e,t)=>{const{underline:n,className:r,unstyled:i,mod:s,...c}=ae("Anchor",h6,e);return a.jsx(ge,{component:"a",ref:t,className:Ft({[_D.root]:!i},r),...c,mod:[{underline:n},s],__staticSelector:"Anchor",unstyled:i})});wt.classes=_D;wt.displayName="@mantine/core/Anchor";const[p6,mu]=Or("AppShell was not found in tree");var Ds={root:"m_89ab340",navbar:"m_45252eee",aside:"m_9cdde9a",header:"m_3b16f56b",main:"m_8983817",footer:"m_3840c879",section:"m_6dcfc7c7"};const e0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=ae("AppShellAside",null,e),y=mu();return y.disabled?null:a.jsx(le,{component:"aside",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("aside",{className:Ft({[Sl.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:i}),...g,__vars:{"--app-shell-aside-z-index":`calc(${h??y.zIndex} + 1)`}})});e0.classes=Ds;e0.displayName="@mantine/core/AppShellAside";const t0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=ae("AppShellFooter",null,e),y=mu();return y.disabled?null:a.jsx(le,{component:"footer",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("footer",{className:Ft({[Sl.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:i}),...g,__vars:{"--app-shell-footer-z-index":(h??y.zIndex)?.toString()}})});t0.classes=Ds;t0.displayName="@mantine/core/AppShellFooter";const n0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=ae("AppShellHeader",null,e),y=mu();return y.disabled?null:a.jsx(le,{component:"header",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("header",{className:Ft({[Sl.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:i}),...g,__vars:{"--app-shell-header-z-index":(h??y.zIndex)?.toString()}})});n0.classes=Ds;n0.displayName="@mantine/core/AppShellHeader";const r0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,...u}=ae("AppShellMain",null,e),f=mu();return a.jsx(le,{component:"main",ref:t,...f.getStyles("main",{className:r,style:i,classNames:n,styles:s}),...u})});r0.classes=Ds;r0.displayName="@mantine/core/AppShellMain";function df(e){return typeof e=="object"?e.base:e}function ff(e){const t=typeof e=="object"&&e!==null&&typeof e.base<"u"&&Object.keys(e).length===1;return typeof e=="number"||typeof e=="string"||t}function hf(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function m6({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:i,mode:s}){const c=r?.width,u="translateX(var(--app-shell-aside-width))",f="translateX(calc(var(--app-shell-aside-width) * -1))";if(r?.breakpoint&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},s==="fixed"?(n[r?.breakpoint]["--app-shell-aside-width"]="100%",n[r?.breakpoint]["--app-shell-aside-offset"]="0px"):(n[r?.breakpoint]["--app-shell-aside-width"]="0px",n[r?.breakpoint]["--app-shell-aside-offset"]="0px")),ff(c)){const h=ce(df(c));e["--app-shell-aside-width"]=h,e["--app-shell-aside-offset"]=h}if(hf(c)&&(typeof c.base<"u"&&(e["--app-shell-aside-width"]=ce(c.base),e["--app-shell-aside-offset"]=ce(c.base)),hn(c).forEach(h=>{h!=="base"&&(t[h]=t[h]||{},t[h]["--app-shell-aside-width"]=ce(c[h]),t[h]["--app-shell-aside-offset"]=ce(c[h]))})),r?.breakpoint&&s==="static"&&(t[r.breakpoint]=t[r.breakpoint]||{},t[r.breakpoint]["--app-shell-aside-position"]="sticky",t[r.breakpoint]["--app-shell-aside-grid-row"]="2",t[r.breakpoint]["--app-shell-aside-grid-column"]="3",t[r.breakpoint]["--app-shell-main-column-end"]="3"),r?.collapsed?.desktop){const h=r.breakpoint;t[h]=t[h]||{},t[h]["--app-shell-aside-transform"]=u,t[h]["--app-shell-aside-transform-rtl"]=f,s==="fixed"?t[h]["--app-shell-aside-offset"]="0px !important":(t[h]["--app-shell-aside-width"]="0px",t[h]["--app-shell-aside-display"]="none",t[h]["--app-shell-main-column-end"]="-1"),t[h]["--app-shell-aside-scroll-locked-visibility"]="hidden"}if(r?.collapsed?.mobile){const h=Rb(r.breakpoint,i.breakpoints)-.1;n[h]=n[h]||{},s==="fixed"?(n[h]["--app-shell-aside-width"]="100%",n[h]["--app-shell-aside-offset"]="0px"):n[h]["--app-shell-aside-width"]="0px",n[h]["--app-shell-aside-transform"]=u,n[h]["--app-shell-aside-transform-rtl"]=f,n[h]["--app-shell-aside-scroll-locked-visibility"]="hidden"}}function g6({baseStyles:e,minMediaStyles:t,footer:n,mode:r}){const i=n?.height,s="translateY(var(--app-shell-footer-height))",c=r==="static"?!0:n?.offset??!0;if(r==="static"&&n&&(e["--app-shell-footer-position"]="sticky",e["--app-shell-footer-grid-column"]="1 / -1",e["--app-shell-footer-grid-row"]="3"),ff(i)){const u=ce(df(i));e["--app-shell-footer-height"]=u,c&&(e["--app-shell-footer-offset"]=u)}hf(i)&&(typeof i.base<"u"&&(e["--app-shell-footer-height"]=ce(i.base),c&&(e["--app-shell-footer-offset"]=ce(i.base))),hn(i).forEach(u=>{u!=="base"&&(t[u]=t[u]||{},t[u]["--app-shell-footer-height"]=ce(i[u]),c&&(t[u]["--app-shell-footer-offset"]=ce(i[u])))})),n?.collapsed&&(e["--app-shell-footer-transform"]=s,r==="fixed"&&(e["--app-shell-footer-offset"]="0px !important"))}function v6({baseStyles:e,minMediaStyles:t,header:n,mode:r}){const i=n?.height,s="translateY(calc(var(--app-shell-header-height) * -1))",c=r==="static"?!0:n?.offset??!0;if(r==="static"&&n&&(e["--app-shell-header-position"]="sticky",e["--app-shell-header-grid-column"]="1 / -1",e["--app-shell-header-grid-row"]="1"),ff(i)){const u=ce(df(i));e["--app-shell-header-height"]=u,c&&(e["--app-shell-header-offset"]=u)}hf(i)&&(typeof i.base<"u"&&(e["--app-shell-header-height"]=ce(i.base),c&&(e["--app-shell-header-offset"]=ce(i.base))),hn(i).forEach(u=>{u!=="base"&&(t[u]=t[u]||{},t[u]["--app-shell-header-height"]=ce(i[u]),c&&(t[u]["--app-shell-header-offset"]=ce(i[u])))})),n?.collapsed&&(e["--app-shell-header-transform"]=s,r==="fixed"&&(e["--app-shell-header-offset"]="0px !important"))}function y6({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:i,mode:s}){const c=r?.width,u="translateX(calc(var(--app-shell-navbar-width) * -1))",f="translateX(var(--app-shell-navbar-width))";if(r?.breakpoint&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},n[r?.breakpoint]["--app-shell-navbar-offset"]="0px",n[r?.breakpoint]["--app-shell-navbar-width"]="100%",s==="static"&&(n[r?.breakpoint]["--app-shell-navbar-grid-width"]="0px")),ff(c)){const h=ce(df(c));e["--app-shell-navbar-width"]=h,e["--app-shell-navbar-offset"]=h,s==="static"&&(e["--app-shell-navbar-grid-width"]=h)}if(hf(c)&&(typeof c.base<"u"&&(e["--app-shell-navbar-width"]=ce(c.base),e["--app-shell-navbar-offset"]=ce(c.base),s==="static"&&(e["--app-shell-navbar-grid-width"]=ce(c.base))),hn(c).forEach(h=>{h!=="base"&&(t[h]=t[h]||{},t[h]["--app-shell-navbar-width"]=ce(c[h]),t[h]["--app-shell-navbar-offset"]=ce(c[h]),s==="static"&&(t[h]["--app-shell-navbar-grid-width"]=ce(c[h])))})),r?.breakpoint&&s==="static"&&(t[r.breakpoint]=t[r.breakpoint]||{},t[r.breakpoint]["--app-shell-navbar-position"]="sticky",t[r.breakpoint]["--app-shell-navbar-grid-row"]="2",t[r.breakpoint]["--app-shell-navbar-grid-column"]="1",t[r.breakpoint]["--app-shell-main-column-start"]="2"),r?.collapsed?.desktop){const h=r.breakpoint;t[h]=t[h]||{},t[h]["--app-shell-navbar-transform"]=u,t[h]["--app-shell-navbar-transform-rtl"]=f,s==="fixed"?t[h]["--app-shell-navbar-offset"]="0px !important":(t[h]["--app-shell-navbar-width"]="0px",t[h]["--app-shell-navbar-display"]="none",t[h]["--app-shell-main-column-start"]="1")}if(r?.collapsed?.mobile){const h=Rb(r.breakpoint,i.breakpoints)-.1;n[h]=n[h]||{},n[h]["--app-shell-navbar-width"]="100%",n[h]["--app-shell-navbar-offset"]="0px",s==="static"&&(n[h]["--app-shell-navbar-grid-width"]="0px"),n[h]["--app-shell-navbar-transform"]=u,n[h]["--app-shell-navbar-transform-rtl"]=f}}function Qy(e){return Number(e)===0?"0px":Yn(e)}function x6({padding:e,baseStyles:t,minMediaStyles:n}){ff(e)&&(t["--app-shell-padding"]=Qy(df(e))),hf(e)&&(e.base&&(t["--app-shell-padding"]=Qy(e.base)),hn(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=Qy(e[r]))}))}function b6({navbar:e,header:t,footer:n,aside:r,padding:i,theme:s,mode:c}){const u={},f={},h={};c==="static"&&(h["--app-shell-main-grid-column"]="1 / -1",h["--app-shell-main-grid-row"]="2"),y6({baseStyles:h,minMediaStyles:u,maxMediaStyles:f,navbar:e,theme:s,mode:c}),m6({baseStyles:h,minMediaStyles:u,maxMediaStyles:f,aside:r,theme:s,mode:c}),v6({baseStyles:h,minMediaStyles:u,header:t,mode:c}),g6({baseStyles:h,minMediaStyles:u,footer:n,mode:c}),x6({baseStyles:h,minMediaStyles:u,padding:i});const m=Md(hn(u),s.breakpoints).map(x=>({query:`(min-width: ${kp(x.px)})`,styles:u[x.value]})),g=Md(hn(f),s.breakpoints).map(x=>({query:`(max-width: ${kp(x.px)})`,styles:f[x.value]})),y=[...m,...g];return{baseStyles:h,media:y}}function S6({navbar:e,header:t,aside:n,footer:r,padding:i,mode:s,selector:c}){const u=Nn(),f=Ta(),{media:h,baseStyles:m}=b6({navbar:e,header:t,footer:r,aside:n,padding:i,theme:u,mode:s});return a.jsx(zl,{media:h,styles:m,selector:c||f.cssVariablesSelector})}const i0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=ae("AppShellNavbar",null,e),y=mu();return y.disabled?null:a.jsx(le,{component:"nav",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("navbar",{className:r,classNames:n,styles:s,style:i}),...g,__vars:{"--app-shell-navbar-z-index":`calc(${h??y.zIndex} + 1)`}})});i0.classes=Ds;i0.displayName="@mantine/core/AppShellNavbar";const o0=sr((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,grow:u,mod:f,...h}=ae("AppShellSection",null,e),m=mu();return a.jsx(le,{ref:t,mod:[{grow:u},f],...m.getStyles("section",{className:r,style:i,classNames:n,styles:s}),...h})});o0.classes=Ds;o0.displayName="@mantine/core/AppShellSection";function j6({transitionDuration:e,disabled:t}){const[n,r]=v.useState(!0),i=v.useRef(-1),s=v.useRef(-1);return l2("resize",()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>v.startTransition(()=>{r(!1)}),200)}),Ol(()=>{r(!0),clearTimeout(s.current),s.current=window.setTimeout(()=>v.startTransition(()=>{r(!1)}),e||0)},[t,e]),n}const w6={withBorder:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:Br("app"),mode:"fixed"},C6=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),kr=ve((e,t)=>{const n=ae("AppShell",w6,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,navbar:h,withBorder:m,padding:g,transitionDuration:y,transitionTimingFunction:x,header:S,zIndex:w,layout:C,disabled:T,aside:R,footer:E,offsetScrollbars:_=!0,mode:P,mod:O,attributes:k,id:A,...z}=n,U=$e({name:"AppShell",classes:Ds,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:k,vars:f,varsResolver:C6}),K=j6({disabled:T,transitionDuration:y}),W=vr(A);return a.jsxs(p6,{value:{getStyles:U,withBorder:m,zIndex:w,disabled:T,offsetScrollbars:_,mode:P},children:[a.jsx(S6,{navbar:h,header:S,aside:R,footer:E,padding:g,mode:P,selector:P==="static"?`#${W}`:void 0}),a.jsx(le,{ref:t,...U("root"),mod:[{resizing:K,layout:C,disabled:T,mode:P},O],id:W,...z})]})});kr.classes=Ds;kr.displayName="@mantine/core/AppShell";kr.Navbar=i0;kr.Header=n0;kr.Main=r0;kr.Aside=e0;kr.Footer=t0;kr.Section=o0;function DD(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(t=>DD(t))}:e}function AD(e){return e?e.map(t=>DD(t)):[]}function kD(e){return e.reduce((t,n)=>"group"in n?{...t,...kD(n.items)}:(t[n.value]=n,t),{})}var $r={dropdown:"m_88b62a41",search:"m_985517d8",options:"m_b2821a6e",option:"m_92253aa5",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2",optionsDropdownCheckPlaceholder:"m_a530ee0a"};const E6={error:null},T6=(e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":ot(t,"combobox-chevron-size"),"--combobox-chevron-color":n?Kt(n,e):void 0}}),Cm=ve((e,t)=>{const n=ae("ComboboxChevron",E6,e),{size:r,error:i,style:s,className:c,classNames:u,styles:f,unstyled:h,vars:m,mod:g,...y}=n,x=$e({name:"ComboboxChevron",classes:$r,props:n,style:s,className:c,classNames:u,styles:f,unstyled:h,vars:m,varsResolver:T6,rootSelector:"chevron"});return a.jsx(le,{component:"svg",...y,...x("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:i},g],ref:t,children:a.jsx("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})});Cm.classes=$r;Cm.displayName="@mantine/core/ComboboxChevron";const[R6,Hi]=Or("Combobox component was not found in tree"),PD=v.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...i},s)=>a.jsx(mn.ClearButton,{ref:s,tabIndex:-1,"aria-hidden":!0,...i,onMouseDown:c=>{c.preventDefault(),t?.(c)},onClick:c=>{r(),n?.(c)}}));PD.displayName="@mantine/core/ComboboxClearButton";const a0=ve((e,t)=>{const{classNames:n,styles:r,className:i,style:s,hidden:c,...u}=ae("ComboboxDropdown",null,e),f=Hi();return a.jsx(ni.Dropdown,{...u,ref:t,role:"presentation","data-hidden":c||void 0,...f.getStyles("dropdown",{className:i,style:s,classNames:n,styles:r})})});a0.classes=$r;a0.displayName="@mantine/core/ComboboxDropdown";const _6={refProp:"ref"},ND=ve((e,t)=>{const{children:n,refProp:r}=ae("ComboboxDropdownTarget",_6,e);if(Hi(),!cm(n))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return a.jsx(ni.Target,{ref:t,refProp:r,children:n})});ND.displayName="@mantine/core/ComboboxDropdownTarget";const s0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,...u}=ae("ComboboxEmpty",null,e),f=Hi();return a.jsx(le,{ref:t,...f.getStyles("empty",{className:r,classNames:n,styles:s,style:i}),...u})});s0.classes=$r;s0.displayName="@mantine/core/ComboboxEmpty";function l0({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:i,autoComplete:s}){const c=Hi(),[u,f]=v.useState(null),h=g=>{if(e?.(g),!c.readOnly&&t){if(g.nativeEvent.isComposing)return;if(g.nativeEvent.code==="ArrowDown"&&(g.preventDefault(),c.store.dropdownOpened?f(c.store.selectNextOption()):(c.store.openDropdown("keyboard"),f(c.store.selectActiveOption()),c.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="ArrowUp"&&(g.preventDefault(),c.store.dropdownOpened?f(c.store.selectPreviousOption()):(c.store.openDropdown("keyboard"),f(c.store.selectActiveOption()),c.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="Enter"||g.nativeEvent.code==="NumpadEnter"){if(g.nativeEvent.keyCode===229)return;const y=c.store.getSelectedOptionIndex();c.store.dropdownOpened&&y!==-1?(g.preventDefault(),c.store.clickSelectedOption()):i==="button"&&(g.preventDefault(),c.store.openDropdown("keyboard"))}g.key==="Escape"&&c.store.closeDropdown("keyboard"),g.nativeEvent.code==="Space"&&i==="button"&&(g.preventDefault(),c.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r?!!(c.store.listId&&c.store.dropdownOpened):void 0,"aria-controls":c.store.dropdownOpened&&c.store.listId?c.store.listId:void 0,"aria-activedescendant":c.store.dropdownOpened&&u||void 0,autoComplete:s,"data-expanded":c.store.dropdownOpened||void 0,"data-mantine-stop-propagation":c.store.dropdownOpened||void 0}:{},onKeyDown:h}}const D6={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},OD=ve((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:s,withExpandedAttribute:c,targetType:u,autoComplete:f,...h}=ae("ComboboxEventsTarget",D6,e),m=Ml(n);if(!m)throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const g=Hi(),y=l0({targetType:u,withAriaAttributes:s,withKeyboardNavigation:i,withExpandedAttribute:c,onKeyDown:m.props.onKeyDown,autoComplete:f});return v.cloneElement(m,{...y,...h,[r]:Vn(t,g.store.targetRef,um(m))})});OD.displayName="@mantine/core/ComboboxEventsTarget";const c0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,...u}=ae("ComboboxFooter",null,e),f=Hi();return a.jsx(le,{ref:t,...f.getStyles("footer",{className:r,classNames:n,style:i,styles:s}),...u,onMouseDown:h=>{h.preventDefault()}})});c0.classes=$r;c0.displayName="@mantine/core/ComboboxFooter";const u0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,children:u,label:f,id:h,...m}=ae("ComboboxGroup",null,e),g=Hi(),y=vr(h);return a.jsxs(le,{ref:t,role:"group","aria-labelledby":f?y:void 0,...g.getStyles("group",{className:r,classNames:n,style:i,styles:s}),...m,children:[f&&a.jsx("div",{id:y,...g.getStyles("groupLabel",{classNames:n,styles:s}),children:f}),u]})});u0.classes=$r;u0.displayName="@mantine/core/ComboboxGroup";const d0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,...u}=ae("ComboboxHeader",null,e),f=Hi();return a.jsx(le,{ref:t,...f.getStyles("header",{className:r,classNames:n,style:i,styles:s}),...u,onMouseDown:h=>{h.preventDefault()}})});d0.classes=$r;d0.displayName="@mantine/core/ComboboxHeader";function MD({value:e,valuesDivider:t=",",...n}){return a.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(t):e||"",...n})}MD.displayName="@mantine/core/ComboboxHiddenInput";const f0=ve((e,t)=>{const n=ae("ComboboxOption",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,onClick:f,id:h,active:m,onMouseDown:g,onMouseOver:y,disabled:x,selected:S,mod:w,...C}=n,T=Hi(),R=v.useId(),E=h||R;return a.jsx(le,{...T.getStyles("option",{className:i,classNames:r,styles:c,style:s}),...C,ref:t,id:E,mod:["combobox-option",{"combobox-active":m,"combobox-disabled":x,"combobox-selected":S},w],role:"option",onClick:_=>{x?_.preventDefault():(T.onOptionSubmit?.(n.value,n),f?.(_))},onMouseDown:_=>{_.preventDefault(),g?.(_)},onMouseOver:_=>{T.resetSelectionOnOptionHover&&T.store.resetSelectedOption(),y?.(_)}})});f0.classes=$r;f0.displayName="@mantine/core/ComboboxOption";const h0=ve((e,t)=>{const n=ae("ComboboxOptions",null,e),{classNames:r,className:i,style:s,styles:c,id:u,onMouseDown:f,labelledBy:h,...m}=n,g=Hi(),y=vr(u);return v.useEffect(()=>{g.store.setListId(y)},[y]),a.jsx(le,{ref:t,...g.getStyles("options",{className:i,style:s,classNames:r,styles:c}),...m,id:y,role:"listbox","aria-labelledby":h,onMouseDown:x=>{x.preventDefault(),f?.(x)}})});h0.classes=$r;h0.displayName="@mantine/core/ComboboxOptions";const A6={withAriaAttributes:!0,withKeyboardNavigation:!0},p0=ve((e,t)=>{const n=ae("ComboboxSearch",A6,e),{classNames:r,styles:i,unstyled:s,vars:c,withAriaAttributes:u,onKeyDown:f,withKeyboardNavigation:h,size:m,...g}=n,y=Hi(),x=y.getStyles("search"),S=l0({targetType:"input",withAriaAttributes:u,withKeyboardNavigation:h,withExpandedAttribute:!1,onKeyDown:f,autoComplete:"off"});return a.jsx(mn,{ref:Vn(t,y.store.searchRef),classNames:[{input:x.className},r],styles:[{input:x.style},i],size:m||y.size,...S,...g,__staticSelector:"Combobox"})});p0.classes=$r;p0.displayName="@mantine/core/ComboboxSearch";const k6={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},LD=ve((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:s,withExpandedAttribute:c,targetType:u,autoComplete:f,...h}=ae("ComboboxTarget",k6,e),m=Ml(n);if(!m)throw new Error("Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const g=Hi(),y=l0({targetType:u,withAriaAttributes:s,withKeyboardNavigation:i,withExpandedAttribute:c,onKeyDown:m.props.onKeyDown,autoComplete:f}),x=v.cloneElement(m,{...y,...h});return a.jsx(ni.Target,{ref:Vn(t,g.store.targetRef),children:x})});LD.displayName="@mantine/core/ComboboxTarget";function P6(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function N6(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function O6(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function $l({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:i,loop:s=!0,scrollBehavior:c="instant"}={}){const[u,f]=or({value:t,defaultValue:e,finalValue:!1,onChange:n}),h=v.useRef(null),m=v.useRef(-1),g=v.useRef(null),y=v.useRef(null),x=v.useRef(-1),S=v.useRef(-1),w=v.useRef(-1),C=v.useCallback((L="unknown")=>{u||(f(!0),i?.(L))},[f,i,u]),T=v.useCallback((L="unknown")=>{u&&(f(!1),r?.(L))},[f,r,u]),R=v.useCallback((L="unknown")=>{u?T(L):C(L)},[T,C,u]),E=v.useCallback(()=>{const L=ss(y.current),I=bp(`#${h.current} [data-combobox-selected]`,L);I?.removeAttribute("data-combobox-selected"),I?.removeAttribute("aria-selected")},[]),_=v.useCallback(L=>{const I=ss(y.current),$=bp(`#${h.current}`,I),V=$?us("[data-combobox-option]",$):null;if(!V)return null;const X=L>=V.length?0:L<0?V.length-1:L;return m.current=X,V?.[X]&&!V[X].hasAttribute("data-combobox-disabled")?(E(),V[X].setAttribute("data-combobox-selected","true"),V[X].setAttribute("aria-selected","true"),V[X].scrollIntoView({block:"nearest",behavior:c}),V[X].id):null},[c,E]),P=v.useCallback(()=>{const L=ss(y.current),I=bp(`#${h.current} [data-combobox-active]`,L);if(I){const V=us(`#${h.current} [data-combobox-option]`,L).findIndex(X=>X===I);return _(V)}return _(0)},[_]),O=v.useCallback(()=>{const L=ss(y.current),I=us(`#${h.current} [data-combobox-option]`,L);return _(N6(m.current,I,s))},[_,s]),k=v.useCallback(()=>{const L=ss(y.current),I=us(`#${h.current} [data-combobox-option]`,L);return _(P6(m.current,I,s))},[_,s]),A=v.useCallback(()=>{const L=ss(y.current),I=us(`#${h.current} [data-combobox-option]`,L);return _(O6(I))},[_]),z=v.useCallback((L="selected",I)=>{w.current=window.setTimeout(()=>{const $=ss(y.current),V=us(`#${h.current} [data-combobox-option]`,$),X=V.findIndex(M=>M.hasAttribute(`data-combobox-${L}`));m.current=X,I?.scrollIntoView&&V[X]?.scrollIntoView({block:"nearest",behavior:c})},0)},[]),U=v.useCallback(()=>{m.current=-1,E()},[E]),K=v.useCallback(()=>{const L=ss(y.current);us(`#${h.current} [data-combobox-option]`,L)?.[m.current]?.click()},[]),W=v.useCallback(L=>{h.current=L},[]),ee=v.useCallback(()=>{x.current=window.setTimeout(()=>g.current?.focus(),0)},[]),B=v.useCallback(()=>{S.current=window.setTimeout(()=>y.current?.focus(),0)},[]),G=v.useCallback(()=>m.current,[]);return v.useEffect(()=>()=>{window.clearTimeout(x.current),window.clearTimeout(S.current),window.clearTimeout(w.current)},[]),{dropdownOpened:u,openDropdown:C,closeDropdown:T,toggleDropdown:R,selectedOptionIndex:m.current,getSelectedOptionIndex:G,selectOption:_,selectFirstOption:A,selectActiveOption:P,selectNextOption:O,selectPreviousOption:k,resetSelectedOption:U,updateSelectedOptionIndex:z,listId:h.current,setListId:W,clickSelectedOption:K,searchRef:g,focusSearchInput:ee,targetRef:y,focusTarget:B}}const M6={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0},size:"sm"},L6=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Kn(t),"--combobox-option-padding":ot(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:ce(n),"--combobox-option-fz":Kn(t),"--combobox-option-padding":ot(t,"combobox-option-padding")}});function Ye(e){const t=ae("Combobox",M6,e),{classNames:n,styles:r,unstyled:i,children:s,store:c,vars:u,onOptionSubmit:f,onClose:h,size:m,dropdownPadding:g,resetSelectionOnOptionHover:y,__staticSelector:x,readOnly:S,attributes:w,...C}=t,T=$l(),R=c||T,E=$e({name:x||"Combobox",classes:$r,props:t,classNames:n,styles:r,unstyled:i,attributes:w,vars:u,varsResolver:L6}),_=()=>{h?.(),R.closeDropdown()};return a.jsx(R6,{value:{getStyles:E,store:R,onOptionSubmit:f,size:m,resetSelectionOnOptionHover:y,readOnly:S},children:a.jsx(ni,{opened:R.dropdownOpened,preventPositionChangeWhenVisible:!1,...C,onChange:P=>!P&&_(),withRoles:!1,unstyled:i,children:s})})}const I6=e=>e;Ye.extend=I6;Ye.classes=$r;Ye.displayName="@mantine/core/Combobox";Ye.Target=LD;Ye.Dropdown=a0;Ye.Options=h0;Ye.Option=f0;Ye.Search=p0;Ye.Empty=s0;Ye.Chevron=Cm;Ye.Footer=c0;Ye.Header=d0;Ye.EventsTarget=OD;Ye.DropdownTarget=ND;Ye.Group=u0;Ye.ClearButton=PD;Ye.HiddenInput=MD;var ID={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const zD=ID,Em=v.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:u,description:f,id:h,disabled:m,error:g,size:y,labelPosition:x="left",bodyElement:S="div",labelElement:w="label",variant:C,style:T,vars:R,mod:E,attributes:_,...P},O)=>{const k=$e({name:e,props:t,className:n,style:T,classes:ID,classNames:r,styles:i,unstyled:s,attributes:_});return a.jsx(le,{...k("root"),ref:O,__vars:{"--label-fz":Kn(y),"--label-lh":ot(y,"label-lh")},mod:[{"label-position":x},E],variant:C,size:y,...P,children:a.jsxs(le,{component:S,htmlFor:S==="label"?h:void 0,...k("body"),children:[c,a.jsxs("div",{...k("labelWrapper"),"data-disabled":m||void 0,children:[u&&a.jsx(le,{component:w,htmlFor:w==="label"?h:void 0,...k("label"),"data-disabled":m||void 0,children:u}),f&&a.jsx(mn.Description,{size:y,__inheritStyles:!1,...k("description"),children:f}),g&&typeof g!="boolean"&&a.jsx(mn.Error,{size:y,__inheritStyles:!1,...k("error"),children:g})]})]})})});Em.displayName="@mantine/core/InlineInput";var $D={root:"m_bf2d988c",inner:"m_26062bec",input:"m_26063560",icon:"m_bf295423","input--outline":"m_215c4542"};const UD=v.createContext(null),z6=UD.Provider,BD=()=>v.useContext(UD),[$6,U6]=Fo();var VD={card:"m_26775b0a"};const B6={withBorder:!0},V6=(e,{radius:t})=>({card:{"--card-radius":Ht(t)}}),m0=ve((e,t)=>{const n=ae("CheckboxCard",B6,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,checked:h,mod:m,withBorder:g,value:y,onClick:x,defaultChecked:S,onChange:w,attributes:C,...T}=n,R=$e({name:"CheckboxCard",classes:VD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:V6,rootSelector:"card"}),E=BD(),_=typeof h=="boolean"?h:E?E.value.includes(y||""):void 0,[P,O]=or({value:_,defaultValue:S,finalValue:!1,onChange:w});return a.jsx($6,{value:{checked:P},children:a.jsx(An,{ref:t,mod:[{"with-border":g,checked:P},m],...R("card"),...T,role:"checkbox","aria-checked":P,onClick:k=>{x?.(k),E?.onChange(y||""),O(!P)}})})});m0.displayName="@mantine/core/CheckboxCard";m0.classes=VD;function g0({children:e,role:t}){const n=pu();return n?a.jsx("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):a.jsx(a.Fragment,{children:e})}const v0=ve((e,t)=>{const{value:n,defaultValue:r,onChange:i,size:s,wrapperProps:c,children:u,readOnly:f,disabled:h,...m}=ae("CheckboxGroup",null,e),[g,y]=or({value:n,defaultValue:r,finalValue:[],onChange:i}),x=S=>{const w=typeof S=="string"?S:S.currentTarget.value;!f&&y(g.includes(w)?g.filter(C=>C!==w):[...g,w])};return a.jsx(z6,{value:{value:g,onChange:x,size:s,disabled:h},children:a.jsx(mn.Wrapper,{size:s,ref:t,...c,...m,labelElement:"div",__staticSelector:"CheckboxGroup",children:a.jsx(g0,{role:"group",children:u})})})});v0.classes=mn.Wrapper.classes;v0.displayName="@mantine/core/CheckboxGroup";function pf({size:e,style:t,...n}){const r=e!==void 0?{width:ce(e),height:ce(e),...t}:t;return a.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n,children:a.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function FD({indeterminate:e,...t}){return e?a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...t,children:a.jsx("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})}):a.jsx(pf,{...t})}var HD={indicator:"m_5e5256ee",icon:"m_1b1c543a","indicator--outline":"m_76e20374"};const F6={icon:FD,variant:"filled"},H6=(e,{radius:t,color:n,size:r,iconColor:i,variant:s,autoContrast:c})=>{const u=ei({color:n||e.primaryColor,theme:e}),f=u.isThemeColor&&u.shade===void 0?`var(--mantine-color-${u.color}-outline)`:u.color;return{indicator:{"--checkbox-size":ot(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:Ht(t),"--checkbox-color":s==="outline"?f:Kt(n,e),"--checkbox-icon-color":i?Kt(i,e):Il(c,e)?Ra({color:n,theme:e,autoContrast:c}):void 0}}},y0=ve((e,t)=>{const n=ae("CheckboxIndicator",F6,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,icon:h,indeterminate:m,radius:g,color:y,iconColor:x,autoContrast:S,checked:w,mod:C,variant:T,disabled:R,attributes:E,..._}=n,P=$e({name:"CheckboxIndicator",classes:HD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:E,vars:f,varsResolver:H6,rootSelector:"indicator"}),O=U6(),k=typeof w=="boolean"||typeof m=="boolean"?w||m:O?.checked||!1;return a.jsx(le,{ref:t,...P("indicator",{variant:T}),variant:T,mod:[{checked:k,disabled:R},C],..._,children:a.jsx(h,{indeterminate:m,...P("icon")})})});y0.displayName="@mantine/core/CheckboxIndicator";y0.classes=HD;const q6={labelPosition:"right",icon:FD,variant:"filled"},G6=(e,{radius:t,color:n,size:r,iconColor:i,variant:s,autoContrast:c})=>{const u=ei({color:n||e.primaryColor,theme:e}),f=u.isThemeColor&&u.shade===void 0?`var(--mantine-color-${u.color}-outline)`:u.color;return{root:{"--checkbox-size":ot(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:Ht(t),"--checkbox-color":s==="outline"?f:Kt(n,e),"--checkbox-icon-color":i?Kt(i,e):Il(c,e)?Ra({color:n,theme:e,autoContrast:c}):void 0}}},fn=ve((e,t)=>{const n=ae("Checkbox",q6,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,color:h,label:m,id:g,size:y,radius:x,wrapperProps:S,checked:w,labelPosition:C,description:T,error:R,disabled:E,variant:_,indeterminate:P,icon:O,rootRef:k,iconColor:A,onChange:z,autoContrast:U,mod:K,attributes:W,...ee}=n,B=BD(),G=y||B?.size,L=$e({name:"Checkbox",props:n,classes:$D,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:W,vars:f,varsResolver:G6}),{styleProps:I,rest:$}=_a(ee),V=vr(g),X={checked:B?.value.includes($.value)??w,onChange:ie=>{B?.onChange(ie),z?.(ie)},disabled:B?.disabled??E},M=v.useRef(null),F=t||M;return v.useEffect(()=>{F&&"current"in F&&F.current&&(F.current.indeterminate=P||!1,P?F.current.setAttribute("data-indeterminate","true"):F.current.removeAttribute("data-indeterminate"))},[P,F]),a.jsx(Em,{...L("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:V,size:G,labelPosition:C,label:m,description:T,error:R,disabled:X.disabled,classNames:r,styles:c,unstyled:u,"data-checked":X.checked||w||void 0,variant:_,ref:k,mod:K,inert:$.inert,...I,...S,children:a.jsxs(le,{...L("inner"),mod:{"data-label-position":C},children:[a.jsx(le,{component:"input",id:V,ref:F,mod:{error:!!R},...L("input",{focusable:!0,variant:_}),...$,...X,inert:$.inert,type:"checkbox"}),a.jsx(O,{indeterminate:P,...L("icon")})]})})});fn.classes={...$D,...zD};fn.displayName="@mantine/core/Checkbox";fn.Group=v0;fn.Indicator=y0;fn.Card=m0;function ru(e){return"group"in e}function qD({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),i=[];for(let s=0;s<e.length;s+=1){const c=e[s];if(i.length===n)return i;ru(c)&&i.push({group:c.group,items:qD({options:c.items,search:t,limit:n-i.length})}),ru(c)||c.label.toLowerCase().includes(r)&&i.push(c)}return i}function W6(e){if(e.length===0)return!0;for(const t of e)if(!("group"in t)||t.items.length>0)return!1;return!0}function GD(e,t=new Set){if(Array.isArray(e))for(const n of e)if(ru(n))GD(n.items,t);else{if(typeof n.value>"u")throw new Error("[@mantine/core] Each option must have value property");if(typeof n.value!="string")throw new Error(`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof n.value}`);if(t.has(n.value))throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function Q6(e,t){return Array.isArray(e)?e.includes(t):e===t}function WD({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:s,renderOption:c}){if(!ru(e)){const f=Q6(r,e.value),h=t&&(f?a.jsx(pf,{className:$r.optionsDropdownCheckIcon}):n?a.jsx("div",{className:$r.optionsDropdownCheckPlaceholder}):null),m=a.jsxs(a.Fragment,{children:[i==="left"&&h,a.jsx("span",{children:e.label}),i==="right"&&h]});return a.jsx(Ye.Option,{value:e.value,disabled:e.disabled,className:Ft({[$r.optionsDropdownOption]:!s}),"data-reverse":i==="right"||void 0,"data-checked":f||void 0,"aria-selected":f,active:f,children:typeof c=="function"?c({option:e,checked:f}):m})}const u=e.items.map(f=>a.jsx(WD,{data:f,value:r,unstyled:s,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:c},f.value));return a.jsx(Ye.Group,{label:e.group,children:u})}function Y6({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:s,maxDropdownHeight:c,withScrollArea:u=!0,filterOptions:f=!0,withCheckIcon:h=!1,withAlignedLabels:m=!1,value:g,checkIconPosition:y,nothingFoundMessage:x,unstyled:S,labelId:w,renderOption:C,scrollAreaProps:T,"aria-label":R}){GD(e);const _=typeof i=="string"?(r||qD)({options:e,search:f?i:"",limit:s??1/0}):e,P=W6(_),O=_.map(k=>a.jsx(WD,{data:k,withCheckIcon:h,withAlignedLabels:m,value:g,checkIconPosition:y,unstyled:S,renderOption:C},ru(k)?k.group:k.value));return a.jsx(Ye.Dropdown,{hidden:t||n&&P,"data-composed":!0,children:a.jsxs(Ye.Options,{labelledBy:w,"aria-label":R,children:[u?a.jsx(ti.Autosize,{mah:c??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...T,children:O}):O,P&&x&&a.jsx(Ye.Empty,{children:x})]})})}var Tm={group:"m_11def92b",root:"m_f85678b6",image:"m_11f8ac07",placeholder:"m_104cd71f"};const QD=v.createContext(null),K6=QD.Provider;function X6(){return{withinGroup:!!v.useContext(QD)}}const J6=(e,{spacing:t})=>({group:{"--ag-spacing":Yn(t)}}),x0=ve((e,t)=>{const n=ae("AvatarGroup",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,spacing:h,attributes:m,...g}=n,y=$e({name:"AvatarGroup",classes:Tm,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:m,vars:f,varsResolver:J6,rootSelector:"group"});return a.jsx(K6,{value:!0,children:a.jsx(le,{ref:t,...y("group"),...g})})});x0.classes=Tm;x0.displayName="@mantine/core/AvatarGroup";function Z6(e){return a.jsx("svg",{...e,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function e7(e){let t=0;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return t}const t7=["blue","cyan","grape","green","indigo","lime","orange","pink","red","teal","violet"];function n7(e,t=t7){const n=e7(e),r=Math.abs(n)%t.length;return t[r]}function r7(e,t=2){const n=e.split(" ");return n.length===1?e.slice(0,t).toUpperCase():n.map(r=>r[0]).slice(0,t).join("").toUpperCase()}const i7=(e,{size:t,radius:n,variant:r,gradient:i,color:s,autoContrast:c,name:u,allowedInitialsColors:f})=>{const h=s==="initials"&&typeof u=="string"?n7(u,f):s,m=e.variantColorResolver({color:h||"gray",theme:e,gradient:i,variant:r||"light",autoContrast:c});return{root:{"--avatar-size":ot(t,"avatar-size"),"--avatar-radius":n===void 0?void 0:Ht(n),"--avatar-bg":h||r?m.background:void 0,"--avatar-color":h||r?m.color:void 0,"--avatar-bd":h||r?m.border:void 0}}},iu=sr((e,t)=>{const n=ae("Avatar",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,src:h,alt:m,radius:g,color:y,gradient:x,imageProps:S,children:w,autoContrast:C,mod:T,name:R,allowedInitialsColors:E,attributes:_,...P}=n,O=X6(),[k,A]=v.useState(!h),z=$e({name:"Avatar",props:n,classes:Tm,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:_,vars:f,varsResolver:i7});return v.useEffect(()=>A(!h),[h]),a.jsx(le,{...z("root"),mod:[{"within-group":O.withinGroup},T],ref:t,...P,children:k||!h?a.jsx("span",{...z("placeholder"),title:m,children:w||typeof R=="string"&&r7(R)||a.jsx(Z6,{})}):a.jsx("img",{...S,...z("image"),src:h,alt:m,onError:U=>{A(!0),S?.onError?.(U)}})})});iu.classes=Tm;iu.displayName="@mantine/core/Avatar";iu.Group=x0;var YD={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const o7=(e,{radius:t,color:n,gradient:r,variant:i,size:s,autoContrast:c,circle:u})=>{const f=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||"filled",autoContrast:c});return{root:{"--badge-height":ot(s,"badge-height"),"--badge-padding-x":ot(s,"badge-padding-x"),"--badge-fz":ot(s,"badge-fz"),"--badge-radius":u||t===void 0?void 0:Ht(t),"--badge-bg":n||i?f.background:void 0,"--badge-color":n||i?f.color:void 0,"--badge-bd":n||i?f.border:void 0,"--badge-dot-color":i==="dot"?Kt(n,e):void 0}}},b0=sr((e,t)=>{const n=ae("Badge",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,radius:h,color:m,gradient:g,leftSection:y,rightSection:x,children:S,variant:w,fullWidth:C,autoContrast:T,circle:R,mod:E,attributes:_,...P}=n,O=$e({name:"Badge",props:n,classes:YD,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:_,vars:f,varsResolver:o7});return a.jsxs(le,{variant:w,mod:[{block:C,circle:R,"with-right-section":!!x,"with-left-section":!!y},E],...O("root",{variant:w}),ref:t,...P,children:[y&&a.jsx("span",{...O("section"),"data-position":"left",children:y}),a.jsx("span",{...O("label"),children:S}),x&&a.jsx("span",{...O("section"),"data-position":"right",children:x})]})});b0.classes=YD;b0.displayName="@mantine/core/Badge";var KD={root:"m_ddec01c0",icon:"m_dde7bd57",cite:"m_dde51a35"};const a7={iconSize:48},s7=(e,{color:t,iconSize:n,radius:r})=>{const i=ei({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),s=ei({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":Ni(s.value,.07),"--bq-bg-dark":Ni(i.value,.06),"--bq-bd":Kt(t,e),"--bq-icon-size":ce(n),"--bq-radius":Ht(r)}}},S0=ve((e,t)=>{const n=ae("Blockquote",a7,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,children:h,icon:m,iconSize:g,cite:y,attributes:x,...S}=n,w=$e({name:"Blockquote",classes:KD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:s7});return a.jsxs(le,{component:"blockquote",ref:t,...w("root"),...S,children:[m&&a.jsx("span",{...w("icon"),children:m}),h,y&&a.jsx("cite",{...w("cite"),children:y})]})});S0.classes=KD;S0.displayName="@mantine/core/Blockquote";var gu={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const tT={orientation:"horizontal"},l7=(e,{borderWidth:t})=>({group:{"--button-border-width":ce(t)}}),j0=ve((e,t)=>{const n=ae("ButtonGroup",tT,e),{className:r,style:i,classNames:s,styles:c,unstyled:u,orientation:f,vars:h,borderWidth:m,variant:g,mod:y,attributes:x,...S}=ae("ButtonGroup",tT,e),w=$e({name:"ButtonGroup",props:n,classes:gu,className:r,style:i,classNames:s,styles:c,unstyled:u,attributes:x,vars:h,varsResolver:l7,rootSelector:"group"});return a.jsx(le,{...w("group"),ref:t,variant:g,mod:[{"data-orientation":f},y],role:"group",...S})});j0.classes=gu;j0.displayName="@mantine/core/ButtonGroup";const c7=(e,{radius:t,color:n,gradient:r,variant:i,autoContrast:s,size:c})=>{const u=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||"filled",autoContrast:s});return{groupSection:{"--section-height":ot(c,"section-height"),"--section-padding-x":ot(c,"section-padding-x"),"--section-fz":c?.includes("compact")?Kn(c.replace("compact-","")):Kn(c),"--section-radius":t===void 0?void 0:Ht(t),"--section-bg":n||i?u.background:void 0,"--section-color":u.color,"--section-bd":n||i?u.border:void 0}}},w0=ve((e,t)=>{const n=ae("ButtonGroupSection",null,e),{className:r,style:i,classNames:s,styles:c,unstyled:u,vars:f,variant:h,gradient:m,radius:g,autoContrast:y,attributes:x,...S}=n,w=$e({name:"ButtonGroupSection",props:n,classes:gu,className:r,style:i,classNames:s,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:c7,rootSelector:"groupSection"});return a.jsx(le,{...w("groupSection"),ref:t,variant:h,...S})});w0.classes=gu;w0.displayName="@mantine/core/ButtonGroupSection";const u7={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${ce(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},d7=(e,{radius:t,color:n,gradient:r,variant:i,size:s,justify:c,autoContrast:u})=>{const f=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||"filled",autoContrast:u});return{root:{"--button-justify":c,"--button-height":ot(s,"button-height"),"--button-padding-x":ot(s,"button-padding-x"),"--button-fz":s?.includes("compact")?Kn(s.replace("compact-","")):Kn(s),"--button-radius":t===void 0?void 0:Ht(t),"--button-bg":n||i?f.background:void 0,"--button-hover":n||i?f.hover:void 0,"--button-color":f.color,"--button-bd":n||i?f.border:void 0,"--button-hover-color":n||i?f.hoverColor:void 0}}},Me=sr((e,t)=>{const n=ae("Button",null,e),{style:r,vars:i,className:s,color:c,disabled:u,children:f,leftSection:h,rightSection:m,fullWidth:g,variant:y,radius:x,loading:S,loaderProps:w,gradient:C,classNames:T,styles:R,unstyled:E,"data-disabled":_,autoContrast:P,mod:O,attributes:k,...A}=n,z=$e({name:"Button",props:n,classes:gu,className:s,style:r,classNames:T,styles:R,unstyled:E,attributes:k,vars:i,varsResolver:d7}),U=!!h,K=!!m;return a.jsxs(An,{ref:t,...z("root",{active:!u&&!S&&!_}),unstyled:E,variant:y,disabled:u||S,mod:[{disabled:u||_,loading:S,block:g,"with-left-section":U,"with-right-section":K},O],...A,children:[typeof S=="boolean"&&a.jsx(uo,{mounted:S,transition:u7,duration:150,children:W=>a.jsx(le,{component:"span",...z("loader",{style:W}),"aria-hidden":!0,children:a.jsx(Pr,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...w})})}),a.jsxs("span",{...z("inner"),children:[h&&a.jsx(le,{component:"span",...z("section"),mod:{position:"left"},children:h}),a.jsx(le,{component:"span",mod:{loading:S},...z("label"),children:f}),m&&a.jsx(le,{component:"span",...z("section"),mod:{position:"right"},children:m})]})]})});Me.classes=gu;Me.displayName="@mantine/core/Button";Me.Group=j0;Me.GroupSection=w0;var XD={root:"m_4451eb3a"};const Ao=sr((e,t)=>{const n=ae("Center",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,inline:h,mod:m,attributes:g,...y}=n,x=$e({name:"Center",props:n,classes:XD,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:g,vars:f});return a.jsx(le,{ref:t,mod:[{inline:h},m],...x("root"),...y})});Ao.classes=XD;Ao.displayName="@mantine/core/Center";var JD={root:"m_f59ffda3",label:"m_be049a53","label--outline":"m_3904c1af","label--filled":"m_fa109255","label--light":"m_f7e165c3",iconWrapper:"m_9ac86df9",checkIcon:"m_d6d72580",input:"m_bde07329"};const[f7,h7]=Fo();function ZD(e){const{value:t,defaultValue:n,onChange:r,multiple:i,children:s}=ae("ChipGroup",null,e),[c,u]=or({value:t,defaultValue:n,finalValue:i?[]:null,onChange:r}),f=m=>Array.isArray(c)?c.includes(m):m===c,h=m=>{const g=m.currentTarget.value;Array.isArray(c)?u(c.includes(g)?c.filter(y=>y!==g):[...c,g]):u(g)};return a.jsx(f7,{value:{isChipSelected:f,onChange:h,multiple:i},children:s})}ZD.displayName="@mantine/core/ChipGroup";const p7={type:"checkbox"},m7=(e,{size:t,radius:n,variant:r,color:i,autoContrast:s})=>{const c=e.variantColorResolver({color:i||e.primaryColor,theme:e,variant:r||"filled",autoContrast:s});return{root:{"--chip-fz":Kn(t),"--chip-size":ot(t,"chip-size"),"--chip-radius":n===void 0?void 0:Ht(n),"--chip-checked-padding":ot(t,"chip-checked-padding"),"--chip-padding":ot(t,"chip-padding"),"--chip-icon-size":ot(t,"chip-icon-size"),"--chip-bg":i||r?c.background:void 0,"--chip-hover":i||r?c.hover:void 0,"--chip-color":i||r?c.color:void 0,"--chip-bd":i||r?c.border:void 0,"--chip-spacing":ot(t,"chip-spacing")}}},Ud=ve((e,t)=>{const n=ae("Chip",p7,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,id:h,checked:m,defaultChecked:g,onChange:y,value:x,wrapperProps:S,type:w,disabled:C,children:T,size:R,variant:E,icon:_,rootRef:P,autoContrast:O,mod:k,attributes:A,...z}=n,U=$e({name:"Chip",classes:JD,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:A,vars:f,varsResolver:m7}),K=h7(),W=vr(h),{styleProps:ee,rest:B}=_a(z),[G,L]=or({value:m,defaultValue:g,finalValue:!1,onChange:y}),I=K?{checked:K.isChipSelected(x),onChange:V=>{K.onChange(V),y?.(V.currentTarget.checked)},type:K.multiple?"checkbox":"radio"}:{},$=I.checked||G;return a.jsxs(le,{size:R,variant:E,ref:P,mod:k,...U("root"),...ee,...S,children:[a.jsx("input",{type:w,...U("input"),checked:$,onChange:V=>L(V.currentTarget.checked),id:W,disabled:C,ref:t,value:x,...I,...B}),a.jsxs("label",{htmlFor:W,"data-checked":$||void 0,"data-disabled":C||void 0,...U("label",{variant:E||"filled"}),children:[$&&_!==null&&_!==!1&&a.jsx("span",{...U("iconWrapper"),children:_===void 0?a.jsx(pf,{...U("checkIcon")}):_}),a.jsx("span",{children:T})]})]})});Ud.classes=JD;Ud.displayName="@mantine/core/Chip";Ud.Group=ZD;var eA={root:"m_b183c0a2"};const g7=(e,{color:t})=>({root:{"--code-bg":t?Kt(t,e):void 0}}),mf=ve((e,t)=>{const n=ae("Code",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,color:h,block:m,variant:g,mod:y,attributes:x,...S}=n,w=$e({name:"Code",props:n,classes:eA,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:g7});return a.jsx(le,{component:m?"pre":"code",variant:g,ref:t,mod:[{block:m},y],...w("root"),...S,dir:"ltr"})});mf.classes=eA;mf.displayName="@mantine/core/Code";var tA={root:"m_7485cace"};const v7=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:ot(t,"container-size")}}),gf=ve((e,t)=>{const n=ae("Container",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,fluid:h,mod:m,attributes:g,strategy:y,...x}=n,S=$e({name:"Container",classes:tA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:g,vars:f,varsResolver:v7});return a.jsx(le,{ref:t,mod:[{fluid:h,strategy:y||"block"},m],...S("root"),...x})});gf.classes=tA;gf.displayName="@mantine/core/Container";const y7={timeout:1e3};function C0(e){const{children:t,timeout:n,value:r,...i}=ae("CopyButton",y7,e),s=n2({timeout:n}),c=()=>s.copy(r);return a.jsx(a.Fragment,{children:t({copy:c,copied:s.copied,...i})})}C0.displayName="@mantine/core/CopyButton";var nA={root:"m_3eebeb36",label:"m_9e365f20"};const x7={orientation:"horizontal"},b7=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?Kt(t,e):void 0,"--divider-border-style":n,"--divider-size":ot(r,"divider-size")}}),dn=ve((e,t)=>{const n=ae("Divider",x7,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,color:h,orientation:m,label:g,labelPosition:y,mod:x,attributes:S,...w}=n,C=$e({name:"Divider",classes:nA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:b7});return a.jsx(le,{ref:t,mod:[{orientation:m,"with-label":!!g},x],...C("root"),...w,role:"separator",children:g&&a.jsx(le,{component:"span",mod:{position:y},...C("label"),children:g})})});dn.classes=nA;dn.displayName="@mantine/core/Divider";const[nT,rA]=Or("Grid component was not found in tree");var E0={container:"m_8478a6da",root:"m_410352e9",inner:"m_dee7bd2f",col:"m_96bdd299"};const Vx=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,rT=(e,t,n)=>n||e==="auto"?"100%":e==="content"?"unset":Vx(e,t),iT=(e,t)=>{if(e)return e==="auto"||t?"1":"auto"},oT=(e,t)=>e===0?"0":e?`${100/(t/e)}%`:void 0;function S7({span:e,order:t,offset:n,selector:r}){const i=Nn(),s=rA(),c=s.breakpoints||i.breakpoints,f=ro(e)===void 0?12:ro(e),h=Es({"--col-order":ro(t)?.toString(),"--col-flex-grow":iT(f,s.grow),"--col-flex-basis":Vx(f,s.columns),"--col-width":f==="content"?"auto":void 0,"--col-max-width":rT(f,s.columns,s.grow),"--col-offset":oT(ro(n),s.columns)}),m=hn(c).reduce((x,S)=>(x[S]||(x[S]={}),typeof t=="object"&&t[S]!==void 0&&(x[S]["--col-order"]=t[S]?.toString()),typeof e=="object"&&e[S]!==void 0&&(x[S]["--col-flex-grow"]=iT(e[S],s.grow),x[S]["--col-flex-basis"]=Vx(e[S],s.columns),x[S]["--col-width"]=e[S]==="content"?"auto":void 0,x[S]["--col-max-width"]=rT(e[S],s.columns,s.grow)),typeof n=="object"&&n[S]!==void 0&&(x[S]["--col-offset"]=oT(n[S],s.columns)),x),{}),y=Md(hn(m),c).filter(x=>hn(m[x.value]).length>0).map(x=>({query:s.type==="container"?`mantine-grid (min-width: ${c[x.value]})`:`(min-width: ${c[x.value]})`,styles:m[x.value]}));return a.jsx(zl,{styles:h,media:s.type==="container"?void 0:y,container:s.type==="container"?y:void 0,selector:r})}const j7={span:12},T0=ve((e,t)=>{const n=ae("GridCol",j7,e),{classNames:r,className:i,style:s,styles:c,vars:u,span:f,order:h,offset:m,...g}=n,y=rA(),x=sf();return a.jsxs(a.Fragment,{children:[a.jsx(S7,{selector:`.${x}`,span:f,order:h,offset:m}),a.jsx(le,{ref:t,...y.getStyles("col",{className:Ft(i,x),style:s,classNames:r,styles:c}),...g})]})});T0.classes=E0;T0.displayName="@mantine/core/GridCol";function aT({gutter:e,selector:t,breakpoints:n,type:r}){const i=Nn(),s=n||i.breakpoints,c=Es({"--grid-gutter":Yn(ro(e))}),u=hn(s).reduce((m,g)=>(m[g]||(m[g]={}),typeof e=="object"&&e[g]!==void 0&&(m[g]["--grid-gutter"]=Yn(e[g])),m),{}),h=Md(hn(u),s).filter(m=>hn(u[m.value]).length>0).map(m=>({query:r==="container"?`mantine-grid (min-width: ${s[m.value]})`:`(min-width: ${s[m.value]})`,styles:u[m.value]}));return a.jsx(zl,{styles:c,media:r==="container"?void 0:h,container:r==="container"?h:void 0,selector:t})}const w7={gutter:"md",grow:!1,columns:12},C7=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),Nt=ve((e,t)=>{const n=ae("Grid",w7,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,grow:h,gutter:m,columns:g,align:y,justify:x,children:S,breakpoints:w,type:C,attributes:T,...R}=n,E=$e({name:"Grid",classes:E0,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:T,vars:f,varsResolver:C7}),_=sf();return C==="container"&&w?a.jsxs(nT,{value:{getStyles:E,grow:h,columns:g,breakpoints:w,type:C},children:[a.jsx(aT,{selector:`.${_}`,...n}),a.jsx("div",{...E("container"),children:a.jsx(le,{ref:t,...E("root",{className:_}),...R,children:a.jsx("div",{...E("inner"),children:S})})})]}):a.jsxs(nT,{value:{getStyles:E,grow:h,columns:g,breakpoints:w,type:C},children:[a.jsx(aT,{selector:`.${_}`,...n}),a.jsx(le,{ref:t,...E("root",{className:_}),...R,children:a.jsx("div",{...E("inner"),children:S})})]})});Nt.classes=E0;Nt.displayName="@mantine/core/Grid";Nt.Col=T0;function sT({color:e,theme:t,defaultShade:n}){const r=ei({color:e,theme:t});return r.isThemeColor?r.shade===void 0?`var(--mantine-color-${r.color}-${n})`:`var(${r.variable})`:e}var iA={root:"m_bcb3f3c2"};const E7={color:"yellow"},T7=(e,{color:t})=>({root:{"--mark-bg-dark":sT({color:t,theme:e,defaultShade:5}),"--mark-bg-light":sT({color:t,theme:e,defaultShade:2})}}),R0=ve((e,t)=>{const n=ae("Mark",E7,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,color:h,variant:m,attributes:g,...y}=n,x=$e({name:"Mark",props:n,className:i,style:s,classes:iA,classNames:r,styles:c,unstyled:u,attributes:g,vars:f,varsResolver:T7});return a.jsx(le,{component:"mark",ref:t,variant:m,...x("root"),...y})});R0.classes=iA;R0.displayName="@mantine/core/Mark";function lT(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")}function R7(e,t){if(t==null)return[{chunk:e,highlighted:!1}];const n=Array.isArray(t)?t.map(lT):lT(t);if(!(Array.isArray(n)?n.filter(u=>u.trim().length>0).length>0:n.trim()!==""))return[{chunk:e,highlighted:!1}];const i=typeof n=="string"?n.trim():n.filter(u=>u.trim().length!==0).map(u=>u.trim()).sort((u,f)=>f.length-u.length).join("|"),s=new RegExp(`(${i})`,"gi");return e.split(s).map(u=>({chunk:u,highlighted:s.test(u)})).filter(({chunk:u})=>u)}const _0=sr((e,t)=>{const{unstyled:n,children:r,highlight:i,highlightStyles:s,color:c,...u}=ae("Highlight",null,e),f=R7(r,i);return a.jsx(ge,{unstyled:n,ref:t,...u,__staticSelector:"Highlight",children:f.map(({chunk:h,highlighted:m},g)=>m?a.jsx(R0,{unstyled:n,color:c,style:s,"data-highlight":h,children:h},g):a.jsx("span",{children:h},g))})});_0.classes=ge.classes;_0.displayName="@mantine/core/Highlight";var oA={root:"m_9e117634"};const _7=(e,{radius:t,fit:n})=>({root:{"--image-radius":t===void 0?void 0:Ht(t),"--image-object-fit":n}}),D0=sr((e,t)=>{const n=ae("Image",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,onError:h,src:m,radius:g,fit:y,fallbackSrc:x,mod:S,attributes:w,...C}=n,[T,R]=v.useState(!m);v.useEffect(()=>R(!m),[m]);const E=$e({name:"Image",classes:oA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:w,vars:f,varsResolver:_7});return T&&x?a.jsx(le,{component:"img",ref:t,src:x,...E("root"),onError:h,mod:["fallback",S],...C}):a.jsx(le,{component:"img",ref:t,...E("root"),src:m,onError:_=>{h?.(_),R(!0)},mod:S,...C})});D0.classes=oA;D0.displayName="@mantine/core/Image";function Up(){return Up=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Up.apply(null,arguments)}function A0(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var D7=v.useLayoutEffect,A7=function(t){var n=Ln.useRef(t);return D7(function(){n.current=t}),n},cT=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},k7=function(t,n){var r=Ln.useRef();return Ln.useCallback(function(i){t.current=i,r.current&&cT(r.current,null),r.current=n,n&&cT(n,i)},[n])},uT={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},P7=function(t){Object.keys(uT).forEach(function(n){t.style.setProperty(n,uT[n],"important")})},dT=P7,Ir=null,fT=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function N7(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Ir||(Ir=document.createElement("textarea"),Ir.setAttribute("tabindex","-1"),Ir.setAttribute("aria-hidden","true"),dT(Ir)),Ir.parentNode===null&&document.body.appendChild(Ir);var i=e.paddingSize,s=e.borderSize,c=e.sizingStyle,u=c.boxSizing;Object.keys(c).forEach(function(y){var x=y;Ir.style[x]=c[x]}),dT(Ir),Ir.value=t;var f=fT(Ir,e);Ir.value=t,f=fT(Ir,e),Ir.value="x";var h=Ir.scrollHeight-i,m=h*n;u==="border-box"&&(m=m+i+s),f=Math.max(m,f);var g=h*r;return u==="border-box"&&(g=g+i+s),f=Math.min(g,f),[f,h]}var hT=function(){},O7=function(t,n){return t.reduce(function(r,i){return r[i]=n[i],r},{})},M7=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],L7=!!document.documentElement.currentStyle,I7=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=O7(M7,n),i=r.boxSizing;if(i==="")return null;L7&&i==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var s=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),c=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:s,borderSize:c}},z7=I7;function k0(e,t,n){var r=A7(n);v.useLayoutEffect(function(){var i=function(c){return r.current(c)};if(e)return e.addEventListener(t,i),function(){return e.removeEventListener(t,i)}},[])}var $7=function(t,n){k0(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},U7=function(t){k0(window,"resize",t)},B7=function(t){k0(document.fonts,"loadingdone",t)},V7=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],F7=function(t,n){var r=t.cacheMeasurements,i=t.maxRows,s=t.minRows,c=t.onChange,u=c===void 0?hT:c,f=t.onHeightChange,h=f===void 0?hT:f,m=A0(t,V7),g=m.value!==void 0,y=v.useRef(null),x=k7(y,n),S=v.useRef(0),w=v.useRef(),C=function(){var E=y.current,_=r&&w.current?w.current:z7(E);if(_){w.current=_;var P=N7(_,E.value||E.placeholder||"x",s,i),O=P[0],k=P[1];S.current!==O&&(S.current=O,E.style.setProperty("height",O+"px","important"),h(O,{rowHeight:k}))}},T=function(E){g||C(),u(E)};return v.useLayoutEffect(C),$7(y,function(){if(!g){var R=y.current.value;requestAnimationFrame(function(){var E=y.current;E&&R!==E.value&&C()})}}),U7(C),B7(C),v.createElement("textarea",Up({},m,{onChange:T,ref:x}))},H7=v.forwardRef(F7);const q7={size:"sm"},Ul=ve((e,t)=>{const{autosize:n,maxRows:r,minRows:i,__staticSelector:s,resize:c,...u}=ae("Textarea",q7,e),f=n&&c2()!=="test",h=f?{maxRows:r,minRows:i}:{};return a.jsx(Vr,{component:f?H7:"textarea",ref:t,...u,__staticSelector:s||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":c},...h})});Ul.classes=Vr.classes;Ul.displayName="@mantine/core/Textarea";function pT(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}const G7={serialize:JSON.stringify,deserialize:JSON.parse,size:"sm"},vu=ve((e,t)=>{const{value:n,defaultValue:r,onChange:i,formatOnBlur:s,validationError:c,serialize:u,deserialize:f,onFocus:h,onBlur:m,readOnly:g,error:y,...x}=ae("JsonInput",G7,e),[S,w]=or({value:n,defaultValue:r,finalValue:"",onChange:i}),[C,T]=v.useState(pT(S,f)),R=_=>{h?.(_),T(!0)},E=_=>{typeof m=="function"&&m(_);const P=pT(_.currentTarget.value,f);s&&!g&&P&&_.currentTarget.value.trim()!==""&&w(u(f(_.currentTarget.value),null,2)),T(P)};return a.jsx(Ul,{value:S,onChange:_=>w(_.currentTarget.value),onFocus:R,onBlur:E,ref:t,readOnly:g,...x,autoComplete:"off",__staticSelector:"JsonInput",error:C?y:c||!0,"data-monospace":!0})});vu.classes=Vr.classes;vu.displayName="@mantine/core/JsonInput";var aA={root:"m_dc6f14e2"};const W7=(e,{size:t})=>({root:{"--kbd-fz":ot(t,"kbd-fz")}}),Gc=ve((e,t)=>{const n=ae("Kbd",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,attributes:h,...m}=n,g=$e({name:"Kbd",classes:aA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:h,vars:f,varsResolver:W7});return a.jsx(le,{component:"kbd",ref:t,...g("root"),...m})});Gc.classes=aA;Gc.displayName="@mantine/core/Kbd";const[Q7,Y7]=Or("List component was not found in tree");var P0={root:"m_abbac491",item:"m_abb6bec2",itemWrapper:"m_75cd9f71",itemIcon:"m_60f83e5b"};const N0=ve((e,t)=>{const n=ae("ListItem",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,icon:f,children:h,mod:m,...g}=n,y=Y7(),x=f||y.icon,S={classNames:r,styles:c};return a.jsx(le,{...y.getStyles("item",{...S,className:i,style:s}),component:"li",mod:[{"with-icon":!!x,centered:y.center},m],ref:t,...g,children:a.jsxs("div",{...y.getStyles("itemWrapper",S),children:[x&&a.jsx("span",{...y.getStyles("itemIcon",S),children:x}),a.jsx("span",{...y.getStyles("itemLabel",S),children:h})]})})});N0.classes=P0;N0.displayName="@mantine/core/ListItem";const K7={type:"unordered"},X7=(e,{size:t,spacing:n})=>({root:{"--list-fz":Kn(t),"--list-lh":t2(t),"--list-spacing":Yn(n)}}),zr=ve((e,t)=>{const n=ae("List",K7,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,children:h,type:m,withPadding:g,icon:y,spacing:x,center:S,listStyleType:w,mod:C,attributes:T,...R}=n,E=$e({name:"List",classes:P0,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:T,vars:f,varsResolver:X7});return a.jsx(Q7,{value:{center:S,icon:y,getStyles:E},children:a.jsx(le,{...E("root",{style:{listStyleType:w}}),component:m==="unordered"?"ul":"ol",mod:[{"with-padding":g,type:y?"none":w},C],ref:t,...R,children:h})})});zr.classes=P0;zr.displayName="@mantine/core/List";zr.Item=N0;var sA={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const mT={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:Br("overlay")},J7=(e,{zIndex:t})=>({root:{"--lo-z-index":t?.toString()}}),Rm=ve((e,t)=>{const n=ae("LoadingOverlay",mT,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,transitionProps:h,loaderProps:m,overlayProps:g,visible:y,zIndex:x,attributes:S,...w}=n,C=Nn(),T=$e({name:"LoadingOverlay",classes:sA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:J7}),R={...mT.overlayProps,...g};return a.jsx(uo,{transition:"fade",...h,mounted:!!y,children:E=>a.jsxs(le,{...T("root",{style:E}),ref:t,...w,children:[a.jsx(Pr,{...T("loader"),unstyled:u,...m}),a.jsx(tu,{...R,...T("overlay"),darkHidden:!0,unstyled:u,color:g?.color||C.white}),a.jsx(tu,{...R,...T("overlay"),lightHidden:!0,unstyled:u,color:g?.color||C.colors.dark[5]})]})})});Rm.classes=sA;Rm.displayName="@mantine/core/LoadingOverlay";const[Z7,As]=Or("Menu component was not found in the tree");var ks={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504",chevron:"m_b85b0bed"};const O0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,...u}=ae("MenuDivider",null,e),f=As();return a.jsx(le,{ref:t,...f.getStyles("divider",{className:r,style:i,styles:s,classNames:n}),...u})});O0.classes=ks;O0.displayName="@mantine/core/MenuDivider";const M0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,onMouseEnter:u,onMouseLeave:f,onKeyDown:h,children:m,...g}=ae("MenuDropdown",null,e),y=v.useRef(null),x=As(),S=pr(h,T=>{(T.key==="ArrowUp"||T.key==="ArrowDown")&&(T.preventDefault(),y.current?.querySelectorAll("[data-menu-item]:not(:disabled)")[0]?.focus())}),w=pr(u,()=>(x.trigger==="hover"||x.trigger==="click-hover")&&x.openDropdown()),C=pr(f,()=>(x.trigger==="hover"||x.trigger==="click-hover")&&x.closeDropdown());return a.jsxs(ni.Dropdown,{...g,onMouseEnter:w,onMouseLeave:C,role:"menu","aria-orientation":"vertical",ref:Vn(t,y),...x.getStyles("dropdown",{className:r,style:i,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:S,children:[x.withInitialFocusPlaceholder&&a.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),m]})});M0.classes=ks;M0.displayName="@mantine/core/MenuDropdown";const[ez,_m]=Fo(),L0=sr((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,color:u,closeMenuOnClick:f,leftSection:h,rightSection:m,children:g,disabled:y,"data-disabled":x,...S}=ae("MenuItem",null,e),w=As(),C=_m(),T=Nn(),{dir:R}=Rs(),E=v.useRef(null),_=S,P=pr(_.onClick,()=>{x||(typeof f=="boolean"?f&&w.closeDropdownImmediately():w.closeOnItemClick&&w.closeDropdownImmediately())}),O=u?T.variantColorResolver({color:u,theme:T,variant:"light"}):void 0,k=u?ei({color:u,theme:T}):null,A=pr(_.onKeyDown,z=>{z.key==="ArrowLeft"&&C&&(C.close(),C.focusParentItem())});return a.jsxs(An,{onMouseDown:z=>z.preventDefault(),...S,unstyled:w.unstyled,tabIndex:w.menuItemTabIndex,...w.getStyles("item",{className:r,style:i,styles:s,classNames:n}),ref:Vn(E,t),role:"menuitem",disabled:y,"data-menu-item":!0,"data-disabled":y||x||void 0,"data-mantine-stop-propagation":!0,onClick:P,onKeyDown:Eb({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:w.loop,dir:R,orientation:"vertical",onKeyDown:A}),__vars:{"--menu-item-color":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[h&&a.jsx("div",{...w.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"left",children:h}),g&&a.jsx("div",{...w.getStyles("itemLabel",{styles:s,classNames:n}),children:g}),m&&a.jsx("div",{...w.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"right",children:m})]})});L0.classes=ks;L0.displayName="@mantine/core/MenuItem";const I0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,...u}=ae("MenuLabel",null,e),f=As();return a.jsx(le,{ref:t,...f.getStyles("label",{className:r,style:i,styles:s,classNames:n}),...u})});I0.classes=ks;I0.displayName="@mantine/core/MenuLabel";const z0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,onMouseEnter:u,onMouseLeave:f,onKeyDown:h,children:m,...g}=ae("MenuSubDropdown",null,e),y=v.useRef(null),x=As(),S=_m(),w=pr(u,S?.open),C=pr(f,S?.close);return a.jsx(ni.Dropdown,{...g,onMouseEnter:w,onMouseLeave:C,role:"menu","aria-orientation":"vertical",ref:Vn(t,y),...x.getStyles("dropdown",{className:r,style:i,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,children:m})});z0.classes=ks;z0.displayName="@mantine/core/MenuSubDropdown";const $0=sr((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,color:u,leftSection:f,rightSection:h,children:m,disabled:g,"data-disabled":y,closeMenuOnClick:x,...S}=ae("MenuSubItem",null,e),w=As(),C=_m(),T=Nn(),{dir:R}=Rs(),E=v.useRef(null),_=S,P=u?T.variantColorResolver({color:u,theme:T,variant:"light"}):void 0,O=u?ei({color:u,theme:T}):null,k=pr(_.onKeyDown,K=>{K.key==="ArrowRight"&&(C?.open(),C?.focusFirstItem()),K.key==="ArrowLeft"&&C?.parentContext&&(C.parentContext.close(),C.parentContext.focusParentItem())}),A=pr(_.onClick,()=>{!y&&x&&w.closeDropdownImmediately()}),z=pr(_.onMouseEnter,C?.open),U=pr(_.onMouseLeave,C?.close);return a.jsxs(An,{onMouseDown:K=>K.preventDefault(),...S,unstyled:w.unstyled,tabIndex:w.menuItemTabIndex,...w.getStyles("item",{className:r,style:i,styles:s,classNames:n}),ref:Vn(E,t),role:"menuitem",disabled:g,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":g||y||void 0,"data-mantine-stop-propagation":!0,onMouseEnter:z,onMouseLeave:U,onClick:A,onKeyDown:Eb({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:w.loop,dir:R,orientation:"vertical",onKeyDown:k}),__vars:{"--menu-item-color":O?.isThemeColor&&O?.shade===void 0?`var(--mantine-color-${O.color}-6)`:P?.color,"--menu-item-hover":P?.hover},children:[f&&a.jsx("div",{...w.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"left",children:f}),m&&a.jsx("div",{...w.getStyles("itemLabel",{styles:s,classNames:n}),children:m}),a.jsx("div",{...w.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"right",children:h||a.jsx(ED,{...w.getStyles("chevron"),size:14})})]})});$0.classes=ks;$0.displayName="@mantine/core/MenuSubItem";function lA({children:e,refProp:t}){if(!cm(e))throw new Error("Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return As(),a.jsx(ni.Target,{refProp:t,popupType:"menu",children:e})}lA.displayName="@mantine/core/MenuSubTarget";const tz={offset:0,position:"right-start",transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function yu(e){const{children:t,closeDelay:n,openDelay:r,...i}=ae("MenuSub",tz,e),s=vr(),[c,{open:u,close:f}]=Ts(!1),h=_m(),{openDropdown:m,closeDropdown:g}=CD({open:u,close:f,closeDelay:n,openDelay:r}),y=()=>window.setTimeout(()=>{document.getElementById(`${s}-dropdown`)?.querySelectorAll("[data-menu-item]:not([data-disabled])")[0]?.focus()},16),x=()=>window.setTimeout(()=>{document.getElementById(`${s}-target`)?.focus()},16);return a.jsx(ez,{value:{opened:c,close:g,open:m,focusFirstItem:y,focusParentItem:x,parentContext:h},children:a.jsx(ni,{opened:c,withinPortal:!1,withArrow:!1,id:s,...i,children:t})})}yu.extend=e=>e;yu.displayName="@mantine/core/MenuSub";yu.Target=lA;yu.Dropdown=z0;yu.Item=$0;const nz={refProp:"ref"},cA=v.forwardRef((e,t)=>{const{children:n,refProp:r,...i}=ae("MenuTarget",nz,e),s=Ml(n);if(!s)throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const c=As(),u=s.props,f=pr(u.onClick,()=>{c.trigger==="click"?c.toggleDropdown():c.trigger==="click-hover"&&(c.setOpenedViaClick(!0),c.opened||c.openDropdown())}),h=pr(u.onMouseEnter,()=>(c.trigger==="hover"||c.trigger==="click-hover")&&c.openDropdown()),m=pr(u.onMouseLeave,()=>{(c.trigger==="hover"||c.trigger==="click-hover"&&!c.openedViaClick)&&c.closeDropdown()});return a.jsx(ni.Target,{refProp:r,popupType:"menu",ref:t,...i,children:v.cloneElement(s,{onClick:f,onMouseEnter:h,onMouseLeave:m,"data-expanded":c.opened?!0:void 0})})});cA.displayName="@mantine/core/MenuTarget";const rz={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function be(e){const t=ae("Menu",rz,e),{children:n,onOpen:r,onClose:i,opened:s,defaultOpened:c,trapFocus:u,onChange:f,closeOnItemClick:h,loop:m,closeOnEscape:g,trigger:y,openDelay:x,closeDelay:S,classNames:w,styles:C,unstyled:T,variant:R,vars:E,menuItemTabIndex:_,keepMounted:P,withInitialFocusPlaceholder:O,attributes:k,...A}=t,z=$e({name:"Menu",classes:ks,props:t,classNames:w,styles:C,unstyled:T,attributes:k}),[U,K]=or({value:s,defaultValue:c,finalValue:!1,onChange:f}),[W,ee]=v.useState(!1),B=()=>{K(!1),ee(!1),U&&i?.()},G=()=>{K(!0),!U&&r?.()},L=()=>{U?B():G()},{openDropdown:I,closeDropdown:$}=CD({open:G,close:B,closeDelay:S,openDelay:x}),V=F=>bM("[data-menu-item]","[data-menu-dropdown]",F),{resolvedClassNames:X,resolvedStyles:M}=Ll({classNames:w,styles:C,props:t});return a.jsx(Z7,{value:{getStyles:z,opened:U,toggleDropdown:L,getItemIndex:V,openedViaClick:W,setOpenedViaClick:ee,closeOnItemClick:h,closeDropdown:y==="click"?B:$,openDropdown:y==="click"?G:I,closeDropdownImmediately:B,loop:m,trigger:y,unstyled:T,menuItemTabIndex:_,withInitialFocusPlaceholder:O},children:a.jsx(ni,{returnFocus:!0,...A,opened:U,onChange:L,defaultOpened:c,trapFocus:P?!1:u,closeOnEscape:g,__staticSelector:"Menu",classNames:X,styles:M,unstyled:T,variant:R,keepMounted:P,children:n})})}be.extend=e=>e;be.withProps=a9(be);be.classes=ks;be.displayName="@mantine/core/Menu";be.Item=L0;be.Label=I0;be.Dropdown=M0;be.Target=cA;be.Divider=O0;be.Sub=yu;var Aa={root:"m_9df02822",content:"m_54c44539",inner:"m_1f958f16",header:"m_d0e2b9cd"};const[iz,xu]=Or("Modal component was not found in tree"),Dm=ve((e,t)=>{const n=ae("ModalBody",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,...f}=n,h=xu();return a.jsx(mD,{ref:t,...h.getStyles("body",{classNames:r,style:s,styles:c,className:i}),...f})});Dm.classes=Aa;Dm.displayName="@mantine/core/ModalBody";const Am=ve((e,t)=>{const n=ae("ModalCloseButton",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,...f}=n,h=xu();return a.jsx(gD,{ref:t,...h.getStyles("close",{classNames:r,style:s,styles:c,className:i}),...f})});Am.classes=Aa;Am.displayName="@mantine/core/ModalCloseButton";const km=ve((e,t)=>{const n=ae("ModalContent",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,children:f,__hidden:h,...m}=n,g=xu(),y=g.scrollAreaComponent||FI;return a.jsx(vD,{...g.getStyles("content",{className:i,style:s,styles:c,classNames:r}),innerProps:g.getStyles("inner",{className:i,style:s,styles:c,classNames:r}),"data-full-screen":g.fullScreen||void 0,"data-modal-content":!0,"data-hidden":h||void 0,ref:t,...m,children:a.jsx(y,{style:{maxHeight:g.fullScreen?"100dvh":`calc(100dvh - (${ce(g.yOffset)} * 2))`},children:f})})});km.classes=Aa;km.displayName="@mantine/core/ModalContent";const Pm=ve((e,t)=>{const n=ae("ModalHeader",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,...f}=n,h=xu();return a.jsx(yD,{ref:t,...h.getStyles("header",{classNames:r,style:s,styles:c,className:i}),...f})});Pm.classes=Aa;Pm.displayName="@mantine/core/ModalHeader";const Nm=ve((e,t)=>{const n=ae("ModalOverlay",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,...f}=n,h=xu();return a.jsx(xD,{ref:t,...h.getStyles("overlay",{classNames:r,style:s,styles:c,className:i}),...f})});Nm.classes=Aa;Nm.displayName="@mantine/core/ModalOverlay";const oz={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Br("modal"),transitionProps:{duration:200,transition:"fade-down"},yOffset:"5dvh"},az=(e,{radius:t,size:n,yOffset:r,xOffset:i})=>({root:{"--modal-radius":t===void 0?void 0:Ht(t),"--modal-size":ot(n,"modal-size"),"--modal-y-offset":ce(r),"--modal-x-offset":ce(i)}}),Om=ve((e,t)=>{const n=ae("ModalRoot",oz,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,yOffset:h,scrollAreaComponent:m,radius:g,fullScreen:y,centered:x,xOffset:S,__staticSelector:w,attributes:C,...T}=n,R=$e({name:w,classes:Aa,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:az});return a.jsx(iz,{value:{yOffset:h,scrollAreaComponent:m,getStyles:R,fullScreen:y},children:a.jsx(pD,{ref:t,...R("root"),"data-full-screen":y||void 0,"data-centered":x||void 0,"data-offset-scrollbars":m===ti.Autosize||void 0,unstyled:u,...T})})});Om.classes=Aa;Om.displayName="@mantine/core/ModalRoot";const[sz,lz]=Fo();function uA({children:e}){const[t,n]=v.useState([]),[r,i]=v.useState(Br("modal"));return a.jsx(sz,{value:{stack:t,addModal:(s,c)=>{n(u=>[...new Set([...u,s])]),i(u=>typeof c=="number"&&typeof u=="number"?Math.max(u,c):u)},removeModal:s=>n(c=>c.filter(u=>u!==s)),getZIndex:s=>`calc(${r} + ${t.indexOf(s)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}uA.displayName="@mantine/core/ModalStack";const Mm=ve((e,t)=>{const n=ae("ModalTitle",null,e),{classNames:r,className:i,style:s,styles:c,vars:u,...f}=n,h=xu();return a.jsx(bD,{ref:t,...h.getStyles("title",{classNames:r,style:s,styles:c,className:i}),...f})});Mm.classes=Aa;Mm.displayName="@mantine/core/ModalTitle";const cz={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Br("modal"),transitionProps:{duration:200,transition:"fade-down"},withOverlay:!0,withCloseButton:!0},Mn=ve((e,t)=>{const{title:n,withOverlay:r,overlayProps:i,withCloseButton:s,closeButtonProps:c,children:u,radius:f,opened:h,stackId:m,zIndex:g,...y}=ae("Modal",cz,e),x=lz(),S=!!n||s,w=x&&m?{closeOnEscape:x.currentId===m,trapFocus:x.currentId===m,zIndex:x.getZIndex(m)}:{},C=r===!1?!1:m&&x?x.currentId===m:h;return v.useEffect(()=>{x&&m&&(h?x.addModal(m,g||Br("modal")):x.removeModal(m))},[h,m,g]),a.jsxs(Om,{ref:t,radius:f,opened:h,zIndex:x&&m?x.getZIndex(m):g,...y,...w,children:[r&&a.jsx(Nm,{visible:C,transitionProps:x&&m?{duration:0}:void 0,...i}),a.jsxs(km,{radius:f,__hidden:x&&m&&h?m!==x.currentId:!1,children:[S&&a.jsxs(Pm,{children:[n&&a.jsx(Mm,{children:n}),s&&a.jsx(Am,{...c})]}),a.jsx(Dm,{children:u})]})]})});Mn.classes=Aa;Mn.displayName="@mantine/core/Modal";Mn.Root=Om;Mn.Overlay=Nm;Mn.Content=km;Mn.Body=Dm;Mn.Header=Pm;Mn.Title=Mm;Mn.CloseButton=Am;Mn.Stack=uA;const[uz,U0]=Fo();var Lm={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const[dz,fz]=Fo(),hz=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?ot(t):ot(n,"pg-gap")}}),B0=ve((e,t)=>{const n=ae("PillGroup",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,size:h,disabled:m,attributes:g,...y}=n,S=U0()?.size||h||void 0,w=$e({name:"PillGroup",classes:Lm,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:g,vars:f,varsResolver:hz,stylesCtx:{size:S},rootSelector:"group"});return a.jsx(dz,{value:{size:S,disabled:m},children:a.jsx(le,{ref:t,size:S,...w("group"),...y})})});B0.classes=Lm;B0.displayName="@mantine/core/PillGroup";const pz={variant:"default"},mz=(e,{radius:t},{size:n})=>({root:{"--pill-fz":ot(n,"pill-fz"),"--pill-height":ot(n,"pill-height"),"--pill-radius":t===void 0?void 0:Ht(t)}}),wa=ve((e,t)=>{const n=ae("Pill",pz,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,variant:h,children:m,withRemoveButton:g,onRemove:y,removeButtonProps:x,radius:S,size:w,disabled:C,mod:T,attributes:R,...E}=n,_=fz(),P=U0(),O=w||_?.size||void 0,k=P?.variant==="filled"?"contrast":h||"default",A=$e({name:"Pill",classes:Lm,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:R,vars:f,varsResolver:mz,stylesCtx:{size:O}});return a.jsxs(le,{component:"span",ref:t,variant:k,size:O,...A("root",{variant:k}),mod:[{"with-remove":g&&!C,disabled:C||_?.disabled},T],...E,children:[a.jsx("span",{...A("label"),children:m}),g&&a.jsx(_s,{variant:"transparent",radius:S,tabIndex:-1,"aria-hidden":!0,unstyled:u,...x,...A("remove",{className:x?.className,style:x?.style}),onMouseDown:z=>{z.preventDefault(),z.stopPropagation(),x?.onMouseDown?.(z)},onClick:z=>{z.stopPropagation(),y?.(),x?.onClick?.(z)}})]})});wa.classes=Lm;wa.displayName="@mantine/core/Pill";wa.Group=B0;var dA={field:"m_45c4369d"};const gz={type:"visible"},V0=ve((e,t)=>{const n=ae("PillsInputField",gz,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,type:h,disabled:m,id:g,pointer:y,mod:x,attributes:S,...w}=n,C=U0(),T=pu(),R=$e({name:"PillsInputField",classes:dA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:S,rootSelector:"field"}),E=m||C?.disabled;return a.jsx(le,{component:"input",ref:Vn(t,C?.fieldRef),"data-type":h,disabled:E,mod:[{disabled:E,pointer:y},x],...R("field"),...w,id:T?.inputId||g,"aria-invalid":C?.hasError,"aria-describedby":T?.describedBy,type:"text",onMouseDown:_=>!y&&_.stopPropagation()})});V0.classes=dA;V0.displayName="@mantine/core/PillsInputField";const vz={size:"sm"},xs=ve((e,t)=>{const n=ae("PillsInput",vz,e),{children:r,onMouseDown:i,onClick:s,size:c,disabled:u,__staticSelector:f,error:h,variant:m,...g}=n,y=v.useRef(null);return a.jsx(uz,{value:{fieldRef:y,size:c,disabled:u,hasError:!!h,variant:m},children:a.jsx(Vr,{size:c,error:h,variant:m,component:"div",ref:t,"data-no-overflow":!0,onMouseDown:x=>{x.preventDefault(),i?.(x),y.current?.focus()},onClick:x=>{x.preventDefault(),x.currentTarget.closest("fieldset")?.disabled||(y.current?.focus(),s?.(x))},...g,multiline:!0,disabled:u,__staticSelector:f||"PillsInput",withAria:!1,children:r})})});xs.displayName="@mantine/core/PillsInput";xs.Field=V0;function yz({data:e,value:t}){const n=t.map(i=>i.trim().toLowerCase());return e.reduce((i,s)=>(ru(s)?i.push({group:s.group,items:s.items.filter(c=>n.indexOf(c.value.toLowerCase().trim())===-1)}):n.indexOf(s.value.toLowerCase().trim())===-1&&i.push(s),i),[])}const gT={xs:41,sm:50,md:60,lg:72,xl:89},xz={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:",",clearSearchOnChange:!0,openOnFocus:!0,size:"sm"},Im=ve((e,t)=>{const n=ae("MultiSelect",xz,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,size:h,value:m,defaultValue:g,onChange:y,onKeyDown:x,variant:S,data:w,dropdownOpened:C,defaultDropdownOpened:T,onDropdownOpen:R,onDropdownClose:E,selectFirstOptionOnChange:_,selectFirstOptionOnDropdownOpen:P,onOptionSubmit:O,comboboxProps:k,filter:A,limit:z,withScrollArea:U,maxDropdownHeight:K,searchValue:W,defaultSearchValue:ee,onSearchChange:B,readOnly:G,disabled:L,onFocus:I,onBlur:$,radius:V,rightSection:X,rightSectionWidth:M,rightSectionPointerEvents:F,rightSectionProps:ie,leftSection:de,leftSectionWidth:Se,leftSectionPointerEvents:Ce,leftSectionProps:je,inputContainer:Ke,inputWrapperOrder:_e,withAsterisk:ht,labelProps:Ct,descriptionProps:Et,errorProps:qe,wrapperProps:ct,description:Tt,label:It,error:Te,maxValues:Oe,searchable:Le,nothingFoundMessage:Ie,withCheckIcon:at,withAlignedLabels:Ze,checkIconPosition:dt,hidePickedOptions:ft,withErrorStyles:Ee,name:he,form:ke,id:Dt,clearable:Rt,clearButtonProps:At,hiddenInputProps:ln,placeholder:vn,hiddenInputValuesDivider:lr,required:Hn,mod:wn,renderOption:zn,onRemove:xi,onClear:go,scrollAreaProps:Qo,chevronColor:Yi,attributes:Hr,clearSearchOnChange:Yo,openOnFocus:ii,...Ko}=n,bi=vr(Dt),zs=AD(w),Mr=kD(zs),Ki=v.useRef({}),Cn=$l({opened:C,defaultOpened:T,onDropdownOpen:()=>{R?.(),P&&Cn.selectFirstOption()},onDropdownClose:()=>{E?.(),Cn.resetSelectedOption()}}),{styleProps:Wl,rest:{type:_u,autoComplete:Ql,...H}}=_a(Ko),[Y,oe]=or({value:m,defaultValue:g,finalValue:[],onChange:y}),[we,De]=or({value:W,defaultValue:ee,finalValue:"",onChange:B}),Ge=nt=>{De(nt),Cn.resetSelectedOption()},Pe=$e({name:"MultiSelect",classes:{},props:n,classNames:r,styles:c,unstyled:u,attributes:Hr}),{resolvedClassNames:Ve,resolvedStyles:He}=Ll({props:n,styles:c,classNames:r}),tt=nt=>{x?.(nt),nt.key===" "&&!Le&&(nt.preventDefault(),Cn.toggleDropdown()),nt.key==="Backspace"&&we.length===0&&Y.length>0&&(xi?.(Y[Y.length-1]),oe(Y.slice(0,Y.length-1)))},rt=Y.map((nt,yn)=>{const Ot=Mr[nt]||Ki.current[nt];return a.jsx(wa,{withRemoveButton:!G&&!Mr[nt]?.disabled,onRemove:()=>{oe(Y.filter(qn=>nt!==qn)),xi?.(nt)},unstyled:u,disabled:L,...Pe("pill"),children:Ot?.label||nt},`${nt}-${yn}`)});v.useEffect(()=>{_&&Cn.selectFirstOption()},[_,we]),v.useEffect(()=>{Y.forEach(nt=>{nt in Mr&&(Ki.current[nt]=Mr[nt])})},[Mr,Y]);const et=a.jsx(Ye.ClearButton,{...At,onClear:()=>{go?.(),oe([]),Ge("")}}),Bt=yz({data:zs,value:Y}),bt=Rt&&Y.length>0&&!L&&!G,Xt=bt?{paddingInlineEnd:gT[h]??gT.sm}:void 0;return a.jsxs(a.Fragment,{children:[a.jsxs(Ye,{store:Cn,classNames:Ve,styles:He,unstyled:u,size:h,readOnly:G,__staticSelector:"MultiSelect",attributes:Hr,onOptionSubmit:nt=>{O?.(nt),Yo&&Ge(""),Cn.updateSelectedOptionIndex("selected"),Y.includes(Mr[nt].value)?(oe(Y.filter(yn=>yn!==Mr[nt].value)),xi?.(Mr[nt].value)):Y.length<Oe&&oe([...Y,Mr[nt].value])},...k,children:[a.jsx(Ye.DropdownTarget,{children:a.jsx(xs,{...Wl,__staticSelector:"MultiSelect",classNames:Ve,styles:He,unstyled:u,size:h,className:i,style:s,variant:S,disabled:L,radius:V,__defaultRightSection:a.jsx(Ye.Chevron,{size:h,error:Te,unstyled:u,color:Yi}),__clearSection:et,__clearable:bt,rightSection:X,rightSectionPointerEvents:F||"none",rightSectionWidth:M,rightSectionProps:ie,leftSection:de,leftSectionWidth:Se,leftSectionPointerEvents:Ce,leftSectionProps:je,inputContainer:Ke,inputWrapperOrder:_e,withAsterisk:ht,labelProps:Ct,descriptionProps:Et,errorProps:qe,wrapperProps:ct,description:Tt,label:It,error:Te,withErrorStyles:Ee,__stylesApiProps:{...n,rightSectionPointerEvents:F||"none",multiline:!0},pointer:!Le,onClick:()=>Le?Cn.openDropdown():Cn.toggleDropdown(),"data-expanded":Cn.dropdownOpened||void 0,id:bi,required:Hn,mod:wn,attributes:Hr,children:a.jsxs(wa.Group,{attributes:Hr,disabled:L,unstyled:u,...Pe("pillsList",{style:Xt}),children:[rt,a.jsx(Ye.EventsTarget,{autoComplete:Ql,children:a.jsx(xs.Field,{...H,ref:t,id:bi,placeholder:vn,type:!Le&&!vn?"hidden":"visible",...Pe("inputField"),unstyled:u,onFocus:nt=>{I?.(nt),ii&&Le&&Cn.openDropdown()},onBlur:nt=>{$?.(nt),Cn.closeDropdown(),Ge("")},onKeyDown:tt,value:we,onChange:nt=>{Ge(nt.currentTarget.value),Le&&Cn.openDropdown(),_&&Cn.selectFirstOption()},disabled:L,readOnly:G||!Le,pointer:!Le})})]})})}),a.jsx(Y6,{data:ft?Bt:zs,hidden:G||L,filter:A,search:we,limit:z,hiddenWhenEmpty:!Ie,withScrollArea:U,maxDropdownHeight:K,filterOptions:Le,value:Y,checkIconPosition:dt,withCheckIcon:at,withAlignedLabels:Ze,nothingFoundMessage:Ie,unstyled:u,labelId:It?`${bi}-label`:void 0,"aria-label":It?void 0:Ko["aria-label"],renderOption:zn,scrollAreaProps:Qo})]}),a.jsx(Ye.HiddenInput,{name:he,valuesDivider:lr,value:Y,form:ke,disabled:L,...ln})]})});Im.classes={...Vr.classes,...Ye.classes};Im.displayName="@mantine/core/MultiSelect";function bz(e){return"group"in e}function F0({data:e}){if(bz(e)){const i=e.items.map(s=>a.jsx(F0,{data:s},s.value));return a.jsx("optgroup",{label:e.group,children:i})}const{value:t,label:n,...r}=e;return a.jsx("option",{value:e.value,...r,children:e.label},e.value)}F0.displayName="@mantine/core/NativeSelectOption";const Sz={rightSectionPointerEvents:"none"},pn=ve((e,t)=>{const{data:n,children:r,size:i,error:s,rightSection:c,unstyled:u,...f}=ae("NativeSelect",Sz,e),h=AD(n).map((m,g)=>a.jsx(F0,{data:m},g));return a.jsx(Vr,{component:"select",ref:t,...f,__staticSelector:"NativeSelect",size:i,pointer:!0,error:s,unstyled:u,rightSection:c||a.jsx(Cm,{size:i,error:s,unstyled:u}),children:r||h})});pn.classes=Vr.classes;pn.displayName="@mantine/core/NativeSelect";var fA={root:"m_a513464",icon:"m_a4ceffb",loader:"m_b0920b15",body:"m_a49ed24",title:"m_3feedf16",description:"m_3d733a3a",closeButton:"m_919a4d88"};const jz={withCloseButton:!0},wz=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:Ht(t),"--notification-color":n?Kt(n,e):void 0}}),H0=ve((e,t)=>{const n=ae("Notification",jz,e),{className:r,color:i,radius:s,loading:c,withCloseButton:u,withBorder:f,title:h,icon:m,children:g,onClose:y,closeButtonProps:x,classNames:S,style:w,styles:C,unstyled:T,vars:R,mod:E,loaderProps:_,role:P,attributes:O,...k}=n,A=$e({name:"Notification",classes:fA,props:n,className:r,style:w,classNames:S,styles:C,unstyled:T,attributes:O,vars:R,varsResolver:wz});return a.jsxs(le,{...A("root"),mod:[{"data-with-icon":!!m||c,"data-with-border":f},E],ref:t,role:P||"alert",...k,children:[m&&!c&&a.jsx("div",{...A("icon"),children:m}),c&&a.jsx(Pr,{size:28,color:i,..._,...A("loader")}),a.jsxs("div",{...A("body"),children:[h&&a.jsx("div",{...A("title"),children:h}),a.jsx(le,{...A("description"),mod:{"data-with-title":!!h},children:g})]}),u&&a.jsx(_s,{iconSize:16,color:"gray",...x,unstyled:T,onClick:y,...A("closeButton")})]})});H0.classes=fA;H0.displayName="@mantine/core/Notification";function hA(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var Bd;(function(e){e.event="event",e.props="prop"})(Bd||(Bd={}));function hs(){}function Cz(e){var t,n=void 0;return function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return t&&r.length===t.length&&r.every(function(s,c){return s===t[c]})||(t=r,n=e.apply(void 0,r)),n}}function Vd(e){return!!(e||"").match(/\d/)}function Kc(e){return e==null}function Ez(e){return typeof e=="number"&&isNaN(e)}function pA(e){return Kc(e)||Ez(e)||typeof e=="number"&&!isFinite(e)}function mA(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Tz(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Rz(e,t,n){var r=Tz(n),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(r,"$1"+t)}function _z(e){var t=v.useRef(e);t.current=e;var n=v.useRef(function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return t.current.apply(t,r)});return n.current}function q0(e,t){t===void 0&&(t=!0);var n=e[0]==="-",r=n&&t;e=e.replace("-","");var i=e.split("."),s=i[0],c=i[1]||"";return{beforeDecimal:s,afterDecimal:c,hasNegation:n,addNegation:r}}function Dz(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",i=n[1]||"";return(t?"-":"")+r+(i?"."+i:"")}function gA(e,t,n){for(var r="",i=n?"0":"",s=0;s<=t-1;s++)r+=e[s]||i;return r}function vT(e,t){return Array(t+1).join(e)}function vA(e){var t=e+"",n=t[0]==="-"?"-":"";n&&(t=t.substring(1));var r=t.split(/[eE]/g),i=r[0],s=r[1];if(s=Number(s),!s)return n+i;i=i.replace(".","");var c=1+s,u=i.length;return c<0?i="0."+vT("0",Math.abs(c))+i:c>=u?i=i+vT("0",c-u):i=(i.substring(0,c)||"0")+"."+i.substring(c),n+i}function yT(e,t,n){if(["","-"].indexOf(e)!==-1)return e;var r=(e.indexOf(".")!==-1||n)&&t,i=q0(e),s=i.beforeDecimal,c=i.afterDecimal,u=i.hasNegation,f=parseFloat("0."+(c||"0")),h=c.length<=t?"0."+c:f.toFixed(t),m=h.split("."),g=s;s&&Number(m[0])&&(g=s.split("").reverse().reduce(function(w,C,T){return w.length>T?(Number(w[0])+Number(C)).toString()+w.substring(1,w.length):C+w},m[0]));var y=gA(m[1]||"",t,n),x=u?"-":"",S=r?".":"";return""+x+g+S+y}function cl(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var yA=Cz(function(e,t){for(var n=0,r=0,i=e.length,s=t.length;e[n]===t[n]&&n<i;)n++;for(;e[i-1-r]===t[s-1-r]&&s-r>n&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:s-r}}}),Az=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function kz(e,t,n){return Math.min(Math.max(e,t),n)}function Yy(e){return Math.max(e.selectionStart,e.selectionEnd)}function Pz(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Nz(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function Oz(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function Mz(e,t,n,r,i,s,c){c===void 0&&(c=Oz);var u=i.findIndex(function(_){return _}),f=e.slice(0,u);!t&&!n.startsWith(f)&&(t=f,n=f+n,r=r+f.length);for(var h=n.length,m=e.length,g={},y=new Array(h),x=0;x<h;x++){y[x]=-1;for(var S=0,w=m;S<w;S++){var C=c({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:x,formattedValueIndex:S});if(C&&g[S]!==!0){y[x]=S,g[S]=!0;break}}}for(var T=r;T<h&&(y[T]===-1||!s(n[T]));)T++;var R=T===h||y[T]===-1?m:y[T];for(T=r-1;T>0&&y[T]===-1;)T--;var E=T===-1||y[T]===-1?0:y[T]+1;return E>R?R:r-E<R-r?E:R}function xT(e,t,n,r){var i=e.length;if(t=kz(t,0,i),r==="left"){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function Lz(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!(Vd(e[n])||Vd(e[n-1]));return t}function xA(e,t,n,r,i,s){s===void 0&&(s=hs);var c=_z(function(S,w){var C,T;return pA(S)?(T="",C=""):typeof S=="number"||w?(T=typeof S=="number"?vA(S):S,C=r(T)):(T=i(S,void 0),C=r(T)),{formattedValue:C,numAsString:T}}),u=v.useState(function(){return c(Kc(e)?t:e,n)}),f=u[0],h=u[1],m=function(S,w){S.formattedValue!==f.formattedValue&&h({formattedValue:S.formattedValue,numAsString:S.value}),s(S,w)},g=e,y=n;Kc(e)&&(g=f.numAsString,y=!0);var x=c(g,y);return v.useMemo(function(){h(x)},[x.formattedValue]),[f,m]}function Iz(e){return e.replace(/[^0-9]/g,"")}function zz(e){return e}function $z(e){var t=e.type;t===void 0&&(t="text");var n=e.displayType;n===void 0&&(n="input");var r=e.customInput,i=e.renderText,s=e.getInputRef,c=e.format;c===void 0&&(c=zz);var u=e.removeFormatting;u===void 0&&(u=Iz);var f=e.defaultValue,h=e.valueIsNumericString,m=e.onValueChange,g=e.isAllowed,y=e.onChange;y===void 0&&(y=hs);var x=e.onKeyDown;x===void 0&&(x=hs);var S=e.onMouseUp;S===void 0&&(S=hs);var w=e.onFocus;w===void 0&&(w=hs);var C=e.onBlur;C===void 0&&(C=hs);var T=e.value,R=e.getCaretBoundary;R===void 0&&(R=Lz);var E=e.isValidInputCharacter;E===void 0&&(E=Vd);var _=e.isCharacterSame,P=hA(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),O=xA(T,f,!!h,c,u,m),k=O[0],A=k.formattedValue,z=k.numAsString,U=O[1],K=v.useRef(),W=v.useRef({formattedValue:A,numAsString:z}),ee=function(Te,Oe){W.current={formattedValue:Te.formattedValue,numAsString:Te.value},U(Te,Oe)},B=v.useState(!1),G=B[0],L=B[1],I=v.useRef(null),$=v.useRef({setCaretTimeout:null,focusTimeout:null});v.useEffect(function(){return L(!0),function(){clearTimeout($.current.setCaretTimeout),clearTimeout($.current.focusTimeout)}},[]);var V=c,X=function(Te,Oe){var Le=parseFloat(Oe);return{formattedValue:Te,value:Oe,floatValue:isNaN(Le)?void 0:Le}},M=function(Te,Oe,Le){Te.selectionStart===0&&Te.selectionEnd===Te.value.length||(cl(Te,Oe),$.current.setCaretTimeout=setTimeout(function(){Te.value===Le&&Te.selectionStart!==Oe&&cl(Te,Oe)},0))},F=function(Te,Oe,Le){return xT(Te,Oe,R(Te),Le)},ie=function(Te,Oe,Le){var Ie=R(Oe),at=Mz(Oe,A,Te,Le,Ie,E,_);return at=xT(Oe,at,Ie),at},de=function(Te){var Oe=Te.formattedValue;Oe===void 0&&(Oe="");var Le=Te.input,Ie=Te.source,at=Te.event,Ze=Te.numAsString,dt;if(Le){var ft=Te.inputValue||Le.value,Ee=Yy(Le);Le.value=Oe,dt=ie(ft,Oe,Ee),dt!==void 0&&M(Le,dt,Oe)}Oe!==A&&ee(X(Oe,Ze),{event:at,source:Ie})};v.useEffect(function(){var Te=W.current,Oe=Te.formattedValue,Le=Te.numAsString;(A!==Oe||z!==Le)&&ee(X(A,z),{event:void 0,source:Bd.props})},[A,z]);var Se=I.current?Yy(I.current):void 0,Ce=typeof window<"u"?v.useLayoutEffect:v.useEffect;Ce(function(){var Te=I.current;if(A!==W.current.formattedValue&&Te){var Oe=ie(W.current.formattedValue,A,Se);Te.value=A,M(Te,Oe,A)}},[A]);var je=function(Te,Oe,Le){var Ie=Oe.target,at=K.current?Az(K.current,Ie.selectionEnd):yA(A,Te),Ze=Object.assign(Object.assign({},at),{lastValue:A}),dt=u(Te,Ze),ft=V(dt);if(dt=u(ft,void 0),g&&!g(X(ft,dt))){var Ee=Oe.target,he=Yy(Ee),ke=ie(Te,A,he);return Ee.value=A,M(Ee,ke,A),!1}return de({formattedValue:ft,numAsString:dt,inputValue:Te,event:Oe,source:Le,input:Oe.target}),!0},Ke=function(Te,Oe){Oe===void 0&&(Oe=0);var Le=Te.selectionStart,Ie=Te.selectionEnd;K.current={selectionStart:Le,selectionEnd:Ie+Oe}},_e=function(Te){var Oe=Te.target,Le=Oe.value,Ie=je(Le,Te,Bd.event);Ie&&y(Te),K.current=void 0},ht=function(Te){var Oe=Te.target,Le=Te.key,Ie=Oe.selectionStart,at=Oe.selectionEnd,Ze=Oe.value;Ze===void 0&&(Ze="");var dt;Le==="ArrowLeft"||Le==="Backspace"?dt=Math.max(Ie-1,0):Le==="ArrowRight"?dt=Math.min(Ie+1,Ze.length):Le==="Delete"&&(dt=Ie);var ft=0;Le==="Delete"&&Ie===at&&(ft=1);var Ee=Le==="ArrowLeft"||Le==="ArrowRight";if(dt===void 0||Ie!==at&&!Ee){x(Te),Ke(Oe,ft);return}var he=dt;if(Ee){var ke=Le==="ArrowLeft"?"left":"right";he=F(Ze,dt,ke),he!==dt&&Te.preventDefault()}else Le==="Delete"&&!E(Ze[dt])?he=F(Ze,dt,"right"):Le==="Backspace"&&!E(Ze[dt])&&(he=F(Ze,dt,"left"));he!==dt&&M(Oe,he,Ze),x(Te),Ke(Oe,ft)},Ct=function(Te){var Oe=Te.target,Le=function(){var Ie=Oe.selectionStart,at=Oe.selectionEnd,Ze=Oe.value;if(Ze===void 0&&(Ze=""),Ie===at){var dt=F(Ze,Ie);dt!==Ie&&M(Oe,dt,Ze)}};Le(),requestAnimationFrame(function(){Le()}),S(Te),Ke(Oe)},Et=function(Te){Te.persist&&Te.persist();var Oe=Te.target,Le=Te.currentTarget;I.current=Oe,$.current.focusTimeout=setTimeout(function(){var Ie=Oe.selectionStart,at=Oe.selectionEnd,Ze=Oe.value;Ze===void 0&&(Ze="");var dt=F(Ze,Ie);dt!==Ie&&!(Ie===0&&at===Ze.length)&&M(Oe,dt,Ze),w(Object.assign(Object.assign({},Te),{currentTarget:Le}))},0)},qe=function(Te){I.current=null,clearTimeout($.current.focusTimeout),clearTimeout($.current.setCaretTimeout),C(Te)},ct=G&&Pz()?"numeric":void 0,Tt=Object.assign({inputMode:ct},P,{type:t,value:A,onChange:_e,onKeyDown:ht,onMouseUp:Ct,onFocus:Et,onBlur:qe});if(n==="text")return i?Ln.createElement(Ln.Fragment,null,i(A,P)||null):Ln.createElement("span",Object.assign({},P,{ref:s}),A);if(r){var It=r;return Ln.createElement(It,Object.assign({},Tt,{ref:s}))}return Ln.createElement("input",Object.assign({},Tt,{ref:s}))}function bT(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var c=t.allowNegative,u=t.thousandsGroupStyle;if(u===void 0&&(u="thousand"),e===""||e==="-")return e;var f=zm(t),h=f.thousandSeparator,m=f.decimalSeparator,g=n!==0&&e.indexOf(".")!==-1||n&&r,y=q0(e,c),x=y.beforeDecimal,S=y.afterDecimal,w=y.addNegation;return n!==void 0&&(S=gA(S,n,!!r)),h&&(x=Rz(x,h,u)),i&&(x=i+x),s&&(S=S+s),w&&(x="-"+x),e=x+(g&&m||"")+S,e}function zm(e){var t=e.decimalSeparator;t===void 0&&(t=".");var n=e.thousandSeparator,r=e.allowedDecimalSeparators;return n===!0&&(n=","),r||(r=[t,"."]),{decimalSeparator:t,thousandSeparator:n,allowedDecimalSeparators:r}}function Uz(e,t){e===void 0&&(e="");var n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),i=n.test(e),s=r.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function Bz(e,t){return new RegExp("(^-)|[0-9]|"+mA(e),"g")}function Vz(e,t,n){return e===""?!0:!t?.match(/\d/)&&!n?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function Fz(e,t,n){var r;t===void 0&&(t=Nz(e));var i=n.allowNegative,s=n.prefix;s===void 0&&(s="");var c=n.suffix;c===void 0&&(c="");var u=n.decimalScale,f=t.from,h=t.to,m=h.start,g=h.end,y=zm(n),x=y.allowedDecimalSeparators,S=y.decimalSeparator,w=e[g]===S;if(Vd(e)&&(e===s||e===c)&&t.lastValue==="")return e;if(g-m===1&&x.indexOf(e[m])!==-1){var C=u===0?"":S;e=e.substring(0,m)+C+e.substring(m+1,e.length)}var T=function(I,$,V){var X=!1,M=!1;s.startsWith("-")?X=!1:I.startsWith("--")?(X=!1,M=!0):c.startsWith("-")&&I.length===c.length?X=!1:I[0]==="-"&&(X=!0);var F=X?1:0;return M&&(F=2),F&&(I=I.substring(F),$-=F,V-=F),{value:I,start:$,end:V,hasNegation:X}},R=T(e,m,g),E=R.hasNegation;r=R,e=r.value,m=r.start,g=r.end;var _=T(t.lastValue,f.start,f.end),P=_.start,O=_.end,k=_.value,A=e.substring(m,g);e.length&&k.length&&(P>k.length-c.length||O<s.length)&&!(A&&c.startsWith(A))&&(e=k);var z=0;e.startsWith(s)?z+=s.length:m<s.length&&(z=m),e=e.substring(z),g-=z;var U=e.length,K=e.length-c.length;e.endsWith(c)?U=K:(g>K||g>e.length-c.length)&&(U=g),e=e.substring(0,U),e=Uz(E?"-"+e:e,i),e=(e.match(Bz(S))||[]).join("");var W=e.indexOf(S);e=e.replace(new RegExp(mA(S),"g"),function(I,$){return $===W?".":""});var ee=q0(e,i),B=ee.beforeDecimal,G=ee.afterDecimal,L=ee.addNegation;return h.end-h.start<f.end-f.start&&B===""&&w&&!parseFloat(G)&&(e=L?"-":""),e}function Hz(e,t){var n=t.prefix;n===void 0&&(n="");var r=t.suffix;r===void 0&&(r="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,n.length+(s?1:0));var c=e.length;return i.fill(!1,c-r.length+1,c+1),i}function qz(e){var t=zm(e),n=t.thousandSeparator,r=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),n===r)throw new Error(`
46
+ Decimal separator can't be same as thousand separator.
47
+ thousandSeparator: `+n+` (thousandSeparator = {true} is same as thousandSeparator = ",")
48
+ decimalSeparator: `+r+` (default value for decimalSeparator is .)
49
+ `);return i.startsWith("-")&&s&&(console.error(`
50
+ Prefix can't start with '-' when allowNegative is true.
51
+ prefix: `+i+`
52
+ allowNegative: `+s+`
53
+ `),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function Gz(e){e=qz(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=hs);var s=e.onBlur;s===void 0&&(s=hs);var c=e.thousandSeparator,u=e.decimalScale,f=e.fixedDecimalScale,h=e.prefix;h===void 0&&(h="");var m=e.defaultValue,g=e.value,y=e.valueIsNumericString,x=e.onValueChange,S=hA(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=zm(e),C=w.decimalSeparator,T=w.allowedDecimalSeparators,R=function(L){return bT(L,e)},E=function(L,I){return Fz(L,I,e)},_=Kc(g)?m:g,P=y??Vz(_,h,t);Kc(g)?Kc(m)||(P=P||typeof m=="number"):P=P||typeof g=="number";var O=function(L){return pA(L)?L:(typeof L=="number"&&(L=vA(L)),P&&typeof u=="number"?yT(L,u,!!f):L)},k=xA(O(g),O(m),!!P,R,E,x),A=k[0],z=A.numAsString,U=A.formattedValue,K=k[1],W=function(L){var I=L.target,$=L.key,V=I.selectionStart,X=I.selectionEnd,M=I.value;if(M===void 0&&(M=""),($==="Backspace"||$==="Delete")&&X<h.length){L.preventDefault();return}if(V!==X){i(L);return}$==="Backspace"&&M[0]==="-"&&V===h.length+1&&n&&cl(I,1),u&&f&&($==="Backspace"&&M[V-1]===C?(cl(I,V-1),L.preventDefault()):$==="Delete"&&M[V]===C&&L.preventDefault()),T?.includes($)&&M[V]===C&&cl(I,V+1);var F=c===!0?",":c;$==="Backspace"&&M[V-1]===F&&cl(I,V-1),$==="Delete"&&M[V]===F&&cl(I,V+1),i(L)},ee=function(L){var I=z;if(I.match(/\d/g)||(I=""),r||(I=Dz(I)),f&&u&&(I=yT(I,u,f)),I!==z){var $=bT(I,e);K({formattedValue:$,value:I,floatValue:parseFloat(I)},{event:L,source:Bd.event})}s(L)},B=function(L){return L===C?!0:Vd(L)},G=function(L){var I=L.currentValue,$=L.lastValue,V=L.formattedValue,X=L.currentValueIndex,M=L.formattedValueIndex,F=I[X],ie=V[M],de=yA($,I),Se=de.to,Ce=function(je){return E(je).indexOf(".")+h.length};return g===0&&f&&u&&I[Se.start]===C&&Ce(I)<X&&Ce(V)>M?!1:X>=Se.start&&X<Se.end&&T&&T.includes(F)&&ie===C?!0:F===ie};return Object.assign(Object.assign({},S),{value:U,valueIsNumericString:!1,isValidInputCharacter:B,isCharacterSame:G,onValueChange:K,format:R,removeFormatting:E,getCaretBoundary:function(L){return Hz(L,e)},onKeyDown:W,onBlur:ee})}function Wz(e){var t=Gz(e);return Ln.createElement($z,Object.assign({},t))}var Fx={root:"m_e2f5cd4e",controls:"m_95e17d22",control:"m_80b4b171"};function ST({direction:e,style:t,...n}){return a.jsx("svg",{style:{width:"var(--ni-chevron-size)",height:"var(--ni-chevron-size)",transform:e==="up"?"rotate(180deg)":void 0,...t},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:a.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}const Qz=/^(0\.0*|-0(\.0*)?)$/,Yz=/^-?0\d+(\.\d+)?\.?$/,Kz=/\.\d*0$/,bA=/^-?\d+\.$/;function Hx(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function Ky(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||Hx(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function Xz(e){return e.toString().replace(".","").length}function Jz(e,t){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&Xz(t)<14&&t!==""}function jT(e,t,n){if(e===void 0)return!0;const r=t===void 0||e>=t,i=n===void 0||e<=n;return r&&i}const Zz={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0,allowedDecimalSeparators:[".",","]},e$=(e,{size:t})=>({controls:{"--ni-chevron-size":ot(t,"ni-chevron-size")}});function t$(e,t,n){const r=e.toString(),i=bA.test(r),s=r.replace(/^0+(?=\d)/,""),c=parseFloat(s);if(Number.isNaN(c))return s;if(c>Number.MAX_SAFE_INTEGER)return t!==void 0?t:s;const u=Dd(c,n,t);return i?`${u.toString().replace(/^0+(?=\d)/,"")}.`:u}const hr=ve((e,t)=>{const n=ae("NumberInput",Zz,e),{className:r,classNames:i,styles:s,unstyled:c,vars:u,onChange:f,onValueChange:h,value:m,defaultValue:g,max:y,min:x,step:S,hideControls:w,rightSection:C,isAllowed:T,clampBehavior:R,onBlur:E,allowDecimal:_,decimalScale:P,onKeyDown:O,onKeyDownCapture:k,handlersRef:A,startValue:z,disabled:U,rightSectionPointerEvents:K,allowNegative:W,readOnly:ee,size:B,rightSectionWidth:G,stepHoldInterval:L,stepHoldDelay:I,allowLeadingZeros:$,withKeyboardEvents:V,trimLeadingZeroesOnBlur:X,allowedDecimalSeparators:M,attributes:F,...ie}=n,de=$e({name:"NumberInput",classes:Fx,props:n,classNames:i,styles:s,unstyled:c,attributes:F,vars:u,varsResolver:e$}),{resolvedClassNames:Se,resolvedStyles:Ce}=Ll({classNames:i,styles:s,props:n}),[je,Ke]=or({value:m,defaultValue:g,finalValue:"",onChange:f}),_e=I!==void 0&&L!==void 0,ht=v.useRef(null),Ct=v.useRef(null),Et=v.useRef(0),qe=(he,ke)=>{ke.source==="event"&&Ke(Jz(he.floatValue,he.value)&&!Qz.test(he.value)&&!($&&Yz.test(he.value))&&!Kz.test(he.value)&&!bA.test(he.value)?he.floatValue:he.value),h?.(he,ke)},ct=he=>{const ke=String(he).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return ke?Math.max(0,(ke[1]?ke[1].length:0)-(ke[2]?+ke[2]:0)):0},Tt=he=>{ht.current&&typeof he<"u"&&ht.current.setSelectionRange(he,he)},It=v.useRef(Np);It.current=()=>{if(!Ky(je))return;let he;const ke=ct(je),Dt=ct(S),Rt=Math.max(ke,Dt),At=10**Rt;if(!Hx(je)&&(typeof je!="number"||Number.isNaN(je)))he=Dd(z,x,y);else if(y!==void 0){const vn=(Math.round(Number(je)*At)+Math.round(S*At))/At;he=vn<=y?vn:y}else he=(Math.round(Number(je)*At)+Math.round(S*At))/At;const ln=he.toFixed(Rt);Ke(parseFloat(ln)),h?.({floatValue:parseFloat(ln),formattedValue:ln,value:ln},{source:"increment"}),setTimeout(()=>Tt(ht.current?.value.length),0)};const Te=v.useRef(Np);Te.current=()=>{if(!Ky(je))return;let he;const ke=x!==void 0?x:W?Number.MIN_SAFE_INTEGER:0,Dt=ct(je),Rt=ct(S),At=Math.max(Dt,Rt),ln=10**At;if(!Hx(je)&&typeof je!="number"||Number.isNaN(je))he=Dd(z,ke,y);else{const lr=(Math.round(Number(je)*ln)-Math.round(S*ln))/ln;he=ke!==void 0&&lr<ke?ke:lr}const vn=he.toFixed(At);Ke(parseFloat(vn)),h?.({floatValue:parseFloat(vn),formattedValue:vn,value:vn},{source:"decrement"}),setTimeout(()=>Tt(ht.current?.value.length),0)};const Oe=he=>{O?.(he),!(ee||!V)&&(he.key==="ArrowUp"&&(he.preventDefault(),It.current?.()),he.key==="ArrowDown"&&(he.preventDefault(),Te.current?.()))},Le=he=>{if(k?.(he),he.key==="Backspace"){const ke=ht.current;ke&&ke.selectionStart===0&&ke.selectionStart===ke.selectionEnd&&(he.preventDefault(),window.setTimeout(()=>Tt(0),0))}},Ie=he=>{let ke=je;R==="blur"&&typeof ke=="number"&&(ke=Dd(ke,x,y)),X&&typeof ke=="string"&&ct(ke)<15&&(ke=t$(ke,y,x)),je!==ke&&Ke(ke),E?.(he)};Ld(A,{increment:It.current,decrement:Te.current});const at=he=>{he?It.current?.():Te.current?.(),Et.current+=1},Ze=he=>{if(at(he),_e){const ke=typeof L=="number"?L:L(Et.current);Ct.current=window.setTimeout(()=>Ze(he),ke)}},dt=(he,ke)=>{he.preventDefault(),ht.current?.focus(),at(ke),_e&&(Ct.current=window.setTimeout(()=>Ze(ke),I))},ft=()=>{Ct.current&&window.clearTimeout(Ct.current),Ct.current=null,Et.current=0},Ee=a.jsxs("div",{...de("controls"),children:[a.jsx(An,{...de("control"),tabIndex:-1,"aria-hidden":!0,disabled:U||typeof je=="number"&&y!==void 0&&je>=y,mod:{direction:"up"},onMouseDown:he=>he.preventDefault(),onPointerDown:he=>{dt(he,!0)},onPointerUp:ft,onPointerLeave:ft,children:a.jsx(ST,{direction:"up"})}),a.jsx(An,{...de("control"),tabIndex:-1,"aria-hidden":!0,disabled:U||typeof je=="number"&&x!==void 0&&je<=x,mod:{direction:"down"},onMouseDown:he=>he.preventDefault(),onPointerDown:he=>{dt(he,!1)},onPointerUp:ft,onPointerLeave:ft,children:a.jsx(ST,{direction:"down"})})]});return a.jsx(Vr,{component:Wz,allowNegative:W,className:Ft(Fx.root,r),size:B,inputMode:"decimal",...ie,readOnly:ee,disabled:U,value:je,getInputRef:Vn(t,ht),onValueChange:qe,rightSection:w||ee||!Ky(je)?C:C||Ee,classNames:Se,styles:Ce,unstyled:c,__staticSelector:"NumberInput",decimalScale:_?P:0,onKeyDown:Oe,onKeyDownCapture:Le,rightSectionPointerEvents:K??(U?"none":void 0),rightSectionWidth:G??`var(--ni-right-section-width-${B||"sm"})`,allowLeadingZeros:$,allowedDecimalSeparators:M,onBlur:Ie,attributes:F,isAllowed:he=>R==="strict"?T?T(he)&&jT(he.floatValue,x,y):jT(he.floatValue,x,y):T?T(he):!0})});hr.classes={...Vr.classes,...Fx};hr.displayName="@mantine/core/NumberInput";var vf={root:"m_4addd315",control:"m_326d024a",dots:"m_4ad7767d"};const[n$,$m]=Or("Pagination.Root component was not found in tree"),r$={withPadding:!0},yf=ve((e,t)=>{const n=ae("PaginationControl",r$,e),{classNames:r,className:i,style:s,styles:c,vars:u,active:f,disabled:h,withPadding:m,mod:g,...y}=n,x=$m(),S=h||x.disabled;return a.jsx(An,{ref:t,disabled:S,mod:[{active:f,disabled:S,"with-padding":m},g],...x.getStyles("control",{className:i,style:s,classNames:r,styles:c,active:!S}),...y})});yf.classes=vf;yf.displayName="@mantine/core/PaginationControl";function xf({style:e,children:t,path:n,...r}){return a.jsx("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)",...e},...r,children:a.jsx("path",{d:n,fill:"currentColor"})})}const i$=e=>a.jsx(xf,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),o$=e=>a.jsx(xf,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),a$=e=>a.jsx(xf,{...e,path:"M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z"}),s$=e=>a.jsx(xf,{...e,path:"M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z"}),l$=e=>a.jsx(xf,{...e,path:"M2 8c0-.733.6-1.333 1.333-1.333.734 0 1.334.6 1.334 1.333s-.6 1.333-1.334 1.333C2.6 9.333 2 8.733 2 8zm9.333 0c0-.733.6-1.333 1.334-1.333C13.4 6.667 14 7.267 14 8s-.6 1.333-1.333 1.333c-.734 0-1.334-.6-1.334-1.333zM6.667 8c0-.733.6-1.333 1.333-1.333s1.333.6 1.333 1.333S8.733 9.333 8 9.333 6.667 8.733 6.667 8z"}),c$={icon:l$},Um=ve((e,t)=>{const n=ae("PaginationDots",c$,e),{classNames:r,className:i,style:s,styles:c,vars:u,icon:f,...h}=n,m=$m();return a.jsx(le,{ref:t,...m.getStyles("dots",{className:i,style:s,styles:c,classNames:r}),...h,children:a.jsx(f,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});Um.classes=vf;Um.displayName="@mantine/core/PaginationDots";function Bm({icon:e,name:t,action:n,type:r}){const i={icon:e},s=v.forwardRef((c,u)=>{const{icon:f,...h}=ae(t,i,c),m=$m(),g=r==="next"?m.active===m.total:m.active===1;return a.jsx(yf,{disabled:m.disabled||g,ref:u,onClick:m[n],withPadding:!1,...h,children:a.jsx(f,{className:"mantine-rotate-rtl",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});return s.displayName=`@mantine/core/${t}`,s}const SA=Bm({icon:i$,name:"PaginationNext",action:"onNext",type:"next"}),jA=Bm({icon:o$,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),wA=Bm({icon:a$,name:"PaginationFirst",action:"onFirst",type:"previous"}),CA=Bm({icon:s$,name:"PaginationLast",action:"onLast",type:"next"});function G0({dotsIcon:e}){const t=$m(),n=t.range.map((r,i)=>r==="dots"?a.jsx(Um,{icon:e},i):a.jsx(yf,{active:r===t.active,"aria-current":r===t.active?"page":void 0,onClick:()=>t.onChange(r),disabled:t.disabled,...t.getItemProps?.(r),children:t.getItemProps?.(r)?.children??r},i));return a.jsx(a.Fragment,{children:n})}G0.displayName="@mantine/core/PaginationItems";const u$={siblings:1,boundaries:1},d$=(e,{size:t,radius:n,color:r,autoContrast:i})=>({root:{"--pagination-control-radius":n===void 0?void 0:Ht(n),"--pagination-control-size":ot(t,"pagination-control-size"),"--pagination-control-fz":Kn(t),"--pagination-active-bg":r?Kt(r,e):void 0,"--pagination-active-color":Il(i,e)?Ra({color:r,theme:e,autoContrast:i}):void 0}}),Vm=ve((e,t)=>{const n=ae("PaginationRoot",u$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,total:h,value:m,defaultValue:g,onChange:y,disabled:x,siblings:S,boundaries:w,color:C,radius:T,onNextPage:R,onPreviousPage:E,onFirstPage:_,onLastPage:P,getItemProps:O,autoContrast:k,attributes:A,...z}=n,U=$e({name:"Pagination",classes:vf,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:A,vars:f,varsResolver:d$}),{range:K,setPage:W,next:ee,previous:B,active:G,first:L,last:I}=zM({page:m,initialPage:g,onChange:y,total:h,siblings:S,boundaries:w}),$=pr(R,ee),V=pr(E,B),X=pr(_,L),M=pr(P,I);return a.jsx(n$,{value:{total:h,range:K,active:G,disabled:x,getItemProps:O,onChange:W,onNext:$,onPrevious:V,onFirst:X,onLast:M,getStyles:U},children:a.jsx(le,{ref:t,...U("root"),...z})})});Vm.classes=vf;Vm.displayName="@mantine/core/PaginationRoot";const f$={withControls:!0,withPages:!0,siblings:1,boundaries:1,gap:8},qi=ve((e,t)=>{const n=ae("Pagination",f$,e),{withEdges:r,withControls:i,getControlProps:s,nextIcon:c,previousIcon:u,lastIcon:f,firstIcon:h,dotsIcon:m,total:g,gap:y,hideWithOnePage:x,withPages:S,...w}=n;return g<=0||x&&g===1?null:a.jsx(Vm,{ref:t,total:g,...w,children:a.jsxs(xe,{gap:y,children:[r&&a.jsx(wA,{icon:h,...s?.("first")}),i&&a.jsx(jA,{icon:u,...s?.("previous")}),S&&a.jsx(G0,{dotsIcon:m}),i&&a.jsx(SA,{icon:c,...s?.("next")}),r&&a.jsx(CA,{icon:f,...s?.("last")})]})})});qi.classes=vf;qi.displayName="@mantine/core/Pagination";qi.Root=Vm;qi.Control=yf;qi.Dots=Um;qi.First=wA;qi.Last=CA;qi.Next=SA;qi.Previous=jA;qi.Items=G0;var qx={root:"m_f61ca620",input:"m_ccf8da4c",innerInput:"m_f2d85dd2",visibilityToggle:"m_b1072d44"};const h$=({reveal:e})=>a.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"var(--psi-icon-size)",height:"var(--psi-icon-size)"},children:a.jsx("path",{d:e?"M13.3536 2.35355C13.5488 2.15829 13.5488 1.84171 13.3536 1.64645C13.1583 1.45118 12.8417 1.45118 12.6464 1.64645L10.6828 3.61012C9.70652 3.21671 8.63759 3 7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C0.902945 9.08812 2.02314 10.1861 3.36061 10.9323L1.64645 12.6464C1.45118 12.8417 1.45118 13.1583 1.64645 13.3536C1.84171 13.5488 2.15829 13.5488 2.35355 13.3536L4.31723 11.3899C5.29348 11.7833 6.36241 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C14.0971 5.9119 12.9769 4.81391 11.6394 4.06771L13.3536 2.35355ZM9.90428 4.38861C9.15332 4.1361 8.34759 4 7.5 4C4.80285 4 2.52952 5.37816 1.09622 7.50001C1.87284 8.6497 2.89609 9.58106 4.09974 10.1931L9.90428 4.38861ZM5.09572 10.6114L10.9003 4.80685C12.1039 5.41894 13.1272 6.35031 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11C6.65241 11 5.84668 10.8639 5.09572 10.6114Z":"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),p$={visibilityToggleIcon:h$},m$=(e,{size:t})=>({root:{"--psi-icon-size":ot(t,"psi-icon-size"),"--psi-button-size":ot(t,"psi-button-size")}}),ao=ve((e,t)=>{const n=ae("PasswordInput",p$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,required:h,error:m,leftSection:g,disabled:y,id:x,variant:S,inputContainer:w,description:C,label:T,size:R,errorProps:E,descriptionProps:_,labelProps:P,withAsterisk:O,inputWrapperOrder:k,wrapperProps:A,radius:z,rightSection:U,rightSectionWidth:K,rightSectionPointerEvents:W,leftSectionWidth:ee,visible:B,defaultVisible:G,onVisibilityChange:L,visibilityToggleIcon:I,visibilityToggleButtonProps:$,rightSectionProps:V,leftSectionProps:X,leftSectionPointerEvents:M,withErrorStyles:F,mod:ie,attributes:de,...Se}=n,Ce=vr(x),[je,Ke]=or({value:B,defaultValue:G,finalValue:!1,onChange:L}),_e=()=>Ke(!je),ht=$e({name:"PasswordInput",classes:qx,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:de,vars:f,varsResolver:m$}),{resolvedClassNames:Ct,resolvedStyles:Et}=Ll({classNames:r,styles:c,props:n}),{styleProps:qe,rest:ct}=_a(Se),Tt=E?.id||`${Ce}-error`,It=_?.id||`${Ce}-description`,Le=`${!!m&&typeof m!="boolean"?Tt:""} ${!!C?It:""}`,Ie=Le.trim().length>0?Le.trim():void 0,at=a.jsx(Pn,{...ht("visibilityToggle"),disabled:y,radius:z,"aria-hidden":!$,"aria-pressed":je,tabIndex:-1,...$,variant:$?.variant??"subtle",color:"gray",unstyled:u,onTouchEnd:Ze=>{Ze.preventDefault(),$?.onTouchEnd?.(Ze),_e()},onMouseDown:Ze=>{Ze.preventDefault(),$?.onMouseDown?.(Ze),_e()},onKeyDown:Ze=>{$?.onKeyDown?.(Ze),Ze.key===" "&&(Ze.preventDefault(),_e())},children:a.jsx(I,{reveal:je})});return a.jsx(mn.Wrapper,{required:h,id:Ce,label:T,error:m,description:C,size:R,classNames:Ct,styles:Et,__staticSelector:"PasswordInput",unstyled:u,withAsterisk:O,inputWrapperOrder:k,inputContainer:w,variant:S,labelProps:{...P,htmlFor:Ce},descriptionProps:{..._,id:It},errorProps:{...E,id:Tt},mod:ie,attributes:de,...ht("root"),...qe,...A,children:a.jsx(mn,{component:"div",error:m,leftSection:g,size:R,classNames:{...Ct,input:Ft(qx.input,Ct.input)},styles:Et,radius:z,disabled:y,__staticSelector:"PasswordInput",rightSectionWidth:K,rightSection:U??at,variant:S,unstyled:u,leftSectionWidth:ee,rightSectionPointerEvents:W||"all",rightSectionProps:V,leftSectionProps:X,leftSectionPointerEvents:M,withAria:!1,withErrorStyles:F,attributes:de,children:a.jsx("input",{required:h,"data-invalid":!!m||void 0,"data-with-left-section":!!g||void 0,...ht("innerInput"),disabled:y,id:Ce,ref:t,...ct,"aria-describedby":Ie,autoComplete:ct.autoComplete||"off",type:je?"text":"password"})})})});ao.classes={...Vr.classes,...qx};ao.displayName="@mantine/core/PasswordInput";var EA={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const[g$,TA]=Fo(),[v$,y$]=Fo();var RA={card:"m_9dc8ae12"};const x$={withBorder:!0},b$=(e,{radius:t})=>({card:{"--card-radius":Ht(t)}}),W0=ve((e,t)=>{const n=ae("RadioCard",x$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,checked:h,mod:m,withBorder:g,value:y,onClick:x,name:S,onKeyDown:w,attributes:C,...T}=n,R=$e({name:"RadioCard",classes:RA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:b$,rootSelector:"card"}),{dir:E}=Rs(),_=TA(),P=typeof h=="boolean"?h:_?.value===y||!1,O=S||_?.name,k=A=>{if(w?.(A),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(A.nativeEvent.code)){A.preventDefault();const z=Array.from(document.querySelectorAll(`[role="radio"][name="${O||"__mantine"}"]`)),U=z.findIndex(ee=>ee===A.target),K=U+1>=z.length?0:U+1,W=U-1<0?z.length-1:U-1;A.nativeEvent.code==="ArrowDown"&&(z[K].focus(),z[K].click()),A.nativeEvent.code==="ArrowUp"&&(z[W].focus(),z[W].click()),A.nativeEvent.code==="ArrowLeft"&&(z[E==="ltr"?W:K].focus(),z[E==="ltr"?W:K].click()),A.nativeEvent.code==="ArrowRight"&&(z[E==="ltr"?K:W].focus(),z[E==="ltr"?K:W].click())}};return a.jsx(v$,{value:{checked:P},children:a.jsx(An,{ref:t,mod:[{"with-border":g,checked:P},m],...R("card"),...T,role:"radio","aria-checked":P,name:O,onClick:A=>{x?.(A),_?.onChange(y||"")},onKeyDown:k})})});W0.displayName="@mantine/core/RadioCard";W0.classes=RA;const Q0=ve((e,t)=>{const{value:n,defaultValue:r,onChange:i,size:s,wrapperProps:c,children:u,name:f,readOnly:h,disabled:m,...g}=ae("RadioGroup",null,e),y=vr(f),[x,S]=or({value:n,defaultValue:r,finalValue:"",onChange:i}),w=C=>!h&&S(typeof C=="string"?C:C.currentTarget.value);return a.jsx(g$,{value:{value:x,onChange:w,size:s,name:y,disabled:m},children:a.jsx(mn.Wrapper,{size:s,ref:t,...c,...g,labelElement:"div",__staticSelector:"RadioGroup",children:a.jsx(g0,{role:"radiogroup",children:u})})})});Q0.classes=mn.Wrapper.classes;Q0.displayName="@mantine/core/RadioGroup";function _A({size:e,style:t,...n}){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:ce(e),height:ce(e),...t},"aria-hidden":!0,...n,children:a.jsx("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"})})}var DA={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const S$={icon:_A},j$=(e,{radius:t,color:n,size:r,iconColor:i,variant:s,autoContrast:c})=>{const u=ei({color:n||e.primaryColor,theme:e}),f=u.isThemeColor&&u.shade===void 0?`var(--mantine-color-${u.color}-outline)`:u.color;return{indicator:{"--radio-size":ot(r,"radio-size"),"--radio-radius":t===void 0?void 0:Ht(t),"--radio-color":s==="outline"?f:Kt(n,e),"--radio-icon-size":ot(r,"radio-icon-size"),"--radio-icon-color":i?Kt(i,e):Il(c,e)?Ra({color:n,theme:e,autoContrast:c}):void 0}}},Y0=ve((e,t)=>{const n=ae("RadioIndicator",S$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,icon:h,radius:m,color:g,iconColor:y,autoContrast:x,checked:S,mod:w,variant:C,disabled:T,attributes:R,...E}=n,_=$e({name:"RadioIndicator",classes:DA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:R,vars:f,varsResolver:j$,rootSelector:"indicator"}),P=y$(),O=typeof S=="boolean"?S:P?.checked||!1;return a.jsx(le,{ref:t,..._("indicator",{variant:C}),variant:C,mod:[{checked:O,disabled:T},w],...E,children:a.jsx(h,{..._("icon")})})});Y0.displayName="@mantine/core/RadioIndicator";Y0.classes=DA;const w$={labelPosition:"right"},C$=(e,{size:t,radius:n,color:r,iconColor:i,variant:s,autoContrast:c})=>{const u=ei({color:r||e.primaryColor,theme:e}),f=u.isThemeColor&&u.shade===void 0?`var(--mantine-color-${u.color}-outline)`:u.color;return{root:{"--radio-size":ot(t,"radio-size"),"--radio-radius":n===void 0?void 0:Ht(n),"--radio-color":s==="outline"?f:Kt(r,e),"--radio-icon-color":i?Kt(i,e):Il(c,e)?Ra({color:r,theme:e,autoContrast:c}):void 0,"--radio-icon-size":ot(t,"radio-icon-size")}}},Rr=ve((e,t)=>{const n=ae("Radio",w$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,id:h,size:m,label:g,labelPosition:y,description:x,error:S,radius:w,color:C,variant:T,disabled:R,wrapperProps:E,icon:_=_A,rootRef:P,iconColor:O,onChange:k,mod:A,attributes:z,checked:U,...K}=n,W=$e({name:"Radio",classes:EA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:z,vars:f,varsResolver:C$}),ee=TA(),B=ee?.size??m,G=n.size?m:B,{styleProps:L,rest:I}=_a(K),$=vr(h),V=ee?ee.value===I.value:void 0,X={checked:V??U,name:ee?.name??I.name,onChange:M=>{ee?.onChange(M),k?.(M)},disabled:ee?.disabled??R};return a.jsx(Em,{...W("root"),__staticSelector:"Radio",__stylesApiProps:n,id:$,size:G,labelPosition:y,label:g,description:x,error:S,disabled:X.disabled,classNames:r,styles:c,unstyled:u,"data-checked":(V??U)||void 0,variant:T,ref:P,mod:A,...L,...E,children:a.jsxs(le,{...W("inner"),mod:{"label-position":y},children:[a.jsx(le,{...W("radio",{focusable:!0,variant:T}),...I,...X,component:"input",mod:{error:!!S},ref:t,id:$,type:"radio"}),a.jsx(_,{...W("icon"),"aria-hidden":!0})]})})});Rr.classes=EA;Rr.displayName="@mantine/core/Radio";Rr.Group=Q0;Rr.Card=W0;Rr.Indicator=Y0;const E$={duration:100,transition:"fade"};function wT(e,t){return{...E$,...t,...e}}var Fm={tooltip:"m_1b3c8819",arrow:"m_f898399f"};function T$({offset:e,position:t,defaultOpened:n}){const[r,i]=v.useState(n),s=v.useRef(null),{x:c,y:u,elements:f,refs:h,update:m,placement:g}=qb({placement:t,middleware:[Bb({crossAxis:!0,padding:5,rootBoundary:"document"})]}),y=g.includes("right")?e:t.includes("left")?e*-1:0,x=g.includes("bottom")?e:t.includes("top")?e*-1:0,S=v.useCallback(({clientX:w,clientY:C})=>{h.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:w,y:C,left:w+y,top:C+x,right:w,bottom:C}}})},[f.reference]);return v.useEffect(()=>{if(h.floating.current){const w=s.current;w.addEventListener("mousemove",S);const C=xa(h.floating.current);return C.forEach(T=>{T.addEventListener("scroll",m)}),()=>{w.removeEventListener("mousemove",S),C.forEach(T=>{T.removeEventListener("scroll",m)})}}},[f.reference,h.floating.current,m,S,r]),{handleMouseMove:S,x:c,y:u,opened:r,setOpened:i,boundaryRef:s,floating:h.setFloating}}const R$={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:Br("popover")},_$=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Ht(t),"--tooltip-bg":n?Kt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),K0=ve((e,t)=>{const n=ae("TooltipFloating",R$,e),{children:r,refProp:i,withinPortal:s,style:c,className:u,classNames:f,styles:h,unstyled:m,radius:g,color:y,label:x,offset:S,position:w,multiline:C,zIndex:T,disabled:R,defaultOpened:E,variant:_,vars:P,portalProps:O,attributes:k,...A}=n,z=Nn(),U=$e({name:"TooltipFloating",props:n,classes:Fm,className:u,style:c,classNames:f,styles:h,unstyled:m,attributes:k,rootSelector:"tooltip",vars:P,varsResolver:_$}),{handleMouseMove:K,x:W,y:ee,opened:B,boundaryRef:G,floating:L,setOpened:I}=T$({offset:S,position:w,defaultOpened:E}),$=Ml(r);if(!$)throw new Error("[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const V=Vn(G,um($),t),X=$.props,M=ie=>{X.onMouseEnter?.(ie),K(ie),I(!0)},F=ie=>{X.onMouseLeave?.(ie),I(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(ja,{...O,withinPortal:s,children:a.jsx(le,{...A,...U("tooltip",{style:{...v2(c,z),zIndex:T,display:!R&&B?"block":"none",top:(ee&&Math.round(ee))??"",left:(W&&Math.round(W))??""}}),variant:_,ref:L,mod:{multiline:C},children:x})}),v.cloneElement($,{...X,[i]:V,onMouseEnter:M,onMouseLeave:F})]})});K0.classes=Fm;K0.displayName="@mantine/core/TooltipFloating";const AA=v.createContext(!1),D$=AA.Provider,A$=()=>v.useContext(AA),k$={openDelay:0,closeDelay:0};function X0(e){const{openDelay:t,closeDelay:n,children:r}=ae("TooltipGroup",k$,e);return a.jsx(D$,{value:!0,children:a.jsx(FL,{delay:{open:t,close:n},children:r})})}X0.displayName="@mantine/core/TooltipGroup";X0.extend=e=>e;function P$(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function N$(e){const t=P$(e.middlewares),n=[O2(e.offset)];return t.shift&&n.push(Bb(typeof t.shift=="boolean"?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip=="boolean"?zp():zp(t.flip)),n.push(M2({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline=="boolean"?Ad():Ad(t.inline)):e.inline&&n.push(Ad()),n}function O$(e){const[t,n]=v.useState(e.defaultOpened),i=typeof e.opened=="boolean"?e.opened:t,s=A$(),c=vr(),u=v.useCallback(P=>{n(P),P&&T(c)},[c]),{x:f,y:h,context:m,refs:g,placement:y,middlewareData:{arrow:{x,y:S}={}}}=qb({strategy:e.strategy,placement:e.position,open:i,onOpenChange:u,middleware:N$(e),whileElementsMounted:zx}),{delay:w,currentId:C,setCurrentId:T}=HL(m,{id:c}),{getReferenceProps:R,getFloatingProps:E}=KL([BL(m,{enabled:e.events?.hover,delay:s?w:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch}),YL(m,{enabled:e.events?.focus,visibleOnly:!0}),JL(m,{role:"tooltip"}),WL(m,{enabled:typeof e.opened>"u"})]);jl(()=>{e.onPositionChange?.(y)},[y]);const _=i&&C&&C!==c;return{x:f,y:h,arrowX:x,arrowY:S,reference:g.setReference,floating:g.setFloating,getFloatingProps:E,getReferenceProps:R,isGroupPhase:_,opened:i,placement:y}}const CT={position:"top",refProp:"ref",withinPortal:!0,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:Br("popover"),positionDependencies:[],middlewares:{flip:!0,shift:!0,inline:!1}},M$=(e,{radius:t,color:n,variant:r,autoContrast:i})=>{const s=e.variantColorResolver({theme:e,color:n||e.primaryColor,autoContrast:i,variant:r||"filled"});return{tooltip:{"--tooltip-radius":t===void 0?void 0:Ht(t),"--tooltip-bg":n?s.background:void 0,"--tooltip-color":n?s.color:void 0}}},Zr=ve((e,t)=>{const n=ae("Tooltip",CT,e),{children:r,position:i,refProp:s,label:c,openDelay:u,closeDelay:f,onPositionChange:h,opened:m,defaultOpened:g,withinPortal:y,radius:x,color:S,classNames:w,styles:C,unstyled:T,style:R,className:E,withArrow:_,arrowSize:P,arrowOffset:O,arrowRadius:k,arrowPosition:A,offset:z,transitionProps:U,multiline:K,events:W,zIndex:ee,disabled:B,positionDependencies:G,onClick:L,onMouseEnter:I,onMouseLeave:$,inline:V,variant:X,keepMounted:M,vars:F,portalProps:ie,mod:de,floatingStrategy:Se,middlewares:Ce,autoContrast:je,attributes:Ke,target:_e,...ht}=ae("Tooltip",CT,n),{dir:Ct}=Rs(),Et=v.useRef(null),qe=O$({position:eD(Ct,i),closeDelay:f,openDelay:u,onPositionChange:h,opened:m,defaultOpened:g,events:W,arrowRef:Et,arrowOffset:O,offset:typeof z=="number"?z+(_?P/2:0):z,positionDependencies:[...G,_e??r],inline:V,strategy:Se,middlewares:Ce});v.useEffect(()=>{const Le=_e instanceof HTMLElement?_e:typeof _e=="string"?document.querySelector(_e):_e?.current||null;Le&&qe.reference(Le)},[_e,qe]);const ct=$e({name:"Tooltip",props:n,classes:Fm,className:E,style:R,classNames:w,styles:C,unstyled:T,attributes:Ke,rootSelector:"tooltip",vars:F,varsResolver:M$}),Tt=Ml(r);if(!_e&&!Tt)return null;if(_e){const Le=wT(U,{duration:100,transition:"fade"});return a.jsx(a.Fragment,{children:a.jsx(ja,{...ie,withinPortal:y,children:a.jsx(uo,{...Le,keepMounted:M,mounted:!B&&!!qe.opened,duration:qe.isGroupPhase?10:Le.duration,children:Ie=>a.jsxs(le,{...ht,"data-fixed":Se==="fixed"||void 0,variant:X,mod:[{multiline:K},de],...qe.getFloatingProps({ref:qe.floating,className:ct("tooltip").className,style:{...ct("tooltip").style,...Ie,zIndex:ee,top:qe.y??0,left:qe.x??0}}),children:[c,a.jsx($p,{ref:Et,arrowX:qe.arrowX,arrowY:qe.arrowY,visible:_,position:qe.placement,arrowSize:P,arrowOffset:O,arrowRadius:k,arrowPosition:A,...ct("arrow")})]})})})})}const It=Tt.props,Te=Vn(qe.reference,um(Tt),t),Oe=wT(U,{duration:100,transition:"fade"});return a.jsxs(a.Fragment,{children:[a.jsx(ja,{...ie,withinPortal:y,children:a.jsx(uo,{...Oe,keepMounted:M,mounted:!B&&!!qe.opened,duration:qe.isGroupPhase?10:Oe.duration,children:Le=>a.jsxs(le,{...ht,"data-fixed":Se==="fixed"||void 0,variant:X,mod:[{multiline:K},de],...qe.getFloatingProps({ref:qe.floating,className:ct("tooltip").className,style:{...ct("tooltip").style,...Le,zIndex:ee,top:qe.y??0,left:qe.x??0}}),children:[c,a.jsx($p,{ref:Et,arrowX:qe.arrowX,arrowY:qe.arrowY,visible:_,position:qe.placement,arrowSize:P,arrowOffset:O,arrowRadius:k,arrowPosition:A,...ct("arrow")})]})})}),v.cloneElement(Tt,qe.getReferenceProps({onClick:L,onMouseEnter:I,onMouseLeave:$,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,...It,className:Ft(E,It.className),[s]:Te}))]})});Zr.classes=Fm;Zr.displayName="@mantine/core/Tooltip";Zr.Floating=K0;Zr.Group=X0;function L$({size:e,thickness:t,sum:n,value:r,root:i,offset:s}){const c=(e*.9-t*2)/2,u=Math.PI*c*2/100,f=i||r===void 0?`${(100-n)*u}, ${n*u}`:`${r*u}, ${(100-r)*u}`;return{strokeWidth:Number.isNaN(t)?12:t,cx:e/2||0,cy:e/2||0,r:c||0,transform:i?`scale(1, -1) translate(0, -${e})`:void 0,strokeDasharray:f,strokeDashoffset:i?0:s||0}}function kA({size:e,value:t,offset:n,sum:r,thickness:i,root:s,color:c,lineRoundCaps:u,tooltip:f,getStyles:h,display:m,...g}){const y=Nn();return a.jsx(Zr.Floating,{disabled:!f,label:f,children:a.jsx(le,{component:"circle",...g,...h("curve"),__vars:{"--curve-color":c?Kt(c,y):void 0},fill:"none",strokeLinecap:u?"round":"butt",...L$({sum:r,size:e,thickness:i,value:t,offset:n,root:s})})})}kA.displayName="@mantine/core/Curve";function I$({size:e,thickness:t,sections:n,renderRoundedLineCaps:r,rootColor:i}){const s=n.reduce((m,g)=>m+g.value,0),c=Math.PI*((e*.9-t*2)/2)*2;let u=c;const f=[],h=[];for(let m=0;m<n.length;m+=1)f.push({sum:s,offset:u,data:n[m],root:!1}),u-=n[m].value/100*c;if(f.push({sum:s,offset:u,data:{color:i},root:!0}),h.push({...f[f.length-1],lineRoundCaps:!1}),f.length>2){h.push({...f[0],lineRoundCaps:r}),h.push({...f[f.length-2],lineRoundCaps:r});for(let m=1;m<=f.length-3;m+=1)h.push({...f[m],lineRoundCaps:!1})}else h.push({...f[0],lineRoundCaps:r});return h}var PA={root:"m_b32e4812",svg:"m_d43b5134",curve:"m_b1ca1fbf",label:"m_b23f9dc4"};function z$(e,t){return Math.min(e||12,(t||120)/4)}const $$={size:120,thickness:12},U$=(e,{size:t,thickness:n,transitionDuration:r})=>({root:{"--rp-size":ce(t),"--rp-label-offset":ce(n*2),"--rp-transition-duration":r?`${r}ms`:void 0}}),Hm=ve((e,t)=>{const n=ae("RingProgress",$$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,label:h,sections:m,size:g,thickness:y,roundCaps:x,rootColor:S,transitionDuration:w,attributes:C,...T}=n,R=$e({name:"RingProgress",classes:PA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:U$}),E=z$(y,g),_=I$({size:g,thickness:E,sections:m,renderRoundedLineCaps:x,rootColor:S}).map(({data:P,sum:O,root:k,lineRoundCaps:A,offset:z},U)=>v.createElement(kA,{...P,key:U,size:g,thickness:E,sum:O,offset:z,color:P?.color,root:k,lineRoundCaps:A,getStyles:R}));return a.jsxs(le,{...R("root"),size:g,ref:t,...T,children:[a.jsx("svg",{...R("svg"),children:_}),h&&a.jsx("div",{...R("label"),children:h})]})});Hm.classes=PA;Hm.displayName="@mantine/core/RingProgress";var NA={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const B$={withItemsBorders:!0},V$=(e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:s})=>({root:{"--sc-radius":t===void 0?void 0:Ht(t),"--sc-color":n?Kt(n,e):void 0,"--sc-shadow":n?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":s,"--sc-padding":ot(i,"sc-padding"),"--sc-font-size":Kn(i)}}),Cl=ve((e,t)=>{const n=ae("SegmentedControl",B$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,data:h,value:m,defaultValue:g,onChange:y,size:x,name:S,disabled:w,readOnly:C,fullWidth:T,orientation:R,radius:E,color:_,transitionDuration:P,transitionTimingFunction:O,variant:k,autoContrast:A,withItemsBorders:z,mod:U,attributes:K,...W}=n,ee=$e({name:"SegmentedControl",props:n,classes:NA,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:K,vars:f,varsResolver:V$}),B=Nn(),G=h.map(_e=>typeof _e=="string"?{label:_e,value:_e}:_e),L=KM(),[I,$]=v.useState(Op()),[V,X]=v.useState(null),[M,F]=v.useState({}),ie=(_e,ht)=>{M[ht]=_e,F(M)},[de,Se]=or({value:m,defaultValue:g,finalValue:Array.isArray(h)?G.find(_e=>!_e.disabled)?.value??h[0]?.value??null:null,onChange:y}),Ce=vr(S),je=G.map(_e=>v.createElement(le,{...ee("control"),mod:{active:de===_e.value,orientation:R},key:_e.value},v.createElement("input",{...ee("input"),disabled:w||_e.disabled,type:"radio",name:Ce,value:_e.value,id:`${Ce}-${_e.value}`,checked:de===_e.value,onChange:()=>!C&&Se(_e.value),"data-focus-ring":B.focusRing,key:`${_e.value}-input`}),v.createElement(le,{component:"label",...ee("label"),mod:{active:de===_e.value&&!(w||_e.disabled),disabled:w||_e.disabled,"read-only":C},htmlFor:`${Ce}-${_e.value}`,ref:ht=>ie(ht,_e.value),__vars:{"--sc-label-color":_!==void 0?Ra({color:_,theme:B,autoContrast:A}):void 0},key:`${_e.value}-label`},a.jsx("span",{...ee("innerLabel"),children:_e.label})))),Ke=Vn(t,_e=>X(_e));return BM(()=>{$(Op())},[h.length]),h.length===0?null:a.jsxs(le,{...ee("root"),variant:k,size:x,ref:Ke,mod:[{"full-width":T,orientation:R,initialized:L,"with-items-borders":z},U],...W,role:"radiogroup","data-disabled":w,children:[typeof de=="string"&&a.jsx(Zb,{target:M[de],parent:V,component:"span",transitionDuration:"var(--sc-transition-duration)",...ee("indicator")},I),je]})});Cl.classes=NA;Cl.displayName="@mantine/core/SegmentedControl";var OA={container:"m_925c2d2c",root:"m_2415a157"};function F$({spacing:e,verticalSpacing:t,cols:n,selector:r}){const i=Nn(),s=t===void 0?e:t,c=Es({"--sg-spacing-x":Yn(ro(e)),"--sg-spacing-y":Yn(ro(s)),"--sg-cols":ro(n)?.toString()}),u=hn(i.breakpoints).reduce((m,g)=>(m[g]||(m[g]={}),typeof e=="object"&&e[g]!==void 0&&(m[g]["--sg-spacing-x"]=Yn(e[g])),typeof s=="object"&&s[g]!==void 0&&(m[g]["--sg-spacing-y"]=Yn(s[g])),typeof n=="object"&&n[g]!==void 0&&(m[g]["--sg-cols"]=n[g]),m),{}),h=Md(hn(u),i.breakpoints).filter(m=>hn(u[m.value]).length>0).map(m=>({query:`(min-width: ${i.breakpoints[m.value]})`,styles:u[m.value]}));return a.jsx(zl,{styles:c,media:h,selector:r})}function Xy(e){return typeof e=="object"&&e!==null?hn(e):[]}function H$(e){return e.sort((t,n)=>Od(t)-Od(n))}function q$({spacing:e,verticalSpacing:t,cols:n}){const r=Array.from(new Set([...Xy(e),...Xy(t),...Xy(n)]));return H$(r)}function G$({spacing:e,verticalSpacing:t,cols:n,selector:r}){const i=t===void 0?e:t,s=Es({"--sg-spacing-x":Yn(ro(e)),"--sg-spacing-y":Yn(ro(i)),"--sg-cols":ro(n)?.toString()}),c=q$({spacing:e,verticalSpacing:t,cols:n}),u=c.reduce((h,m)=>(h[m]||(h[m]={}),typeof e=="object"&&e[m]!==void 0&&(h[m]["--sg-spacing-x"]=Yn(e[m])),typeof i=="object"&&i[m]!==void 0&&(h[m]["--sg-spacing-y"]=Yn(i[m])),typeof n=="object"&&n[m]!==void 0&&(h[m]["--sg-cols"]=n[m]),h),{}),f=c.map(h=>({query:`simple-grid (min-width: ${h})`,styles:u[h]}));return a.jsx(zl,{styles:s,container:f,selector:r})}const W$={cols:1,spacing:"md",type:"media"},qm=ve((e,t)=>{const n=ae("SimpleGrid",W$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,cols:h,verticalSpacing:m,spacing:g,type:y,attributes:x,...S}=n,w=$e({name:"SimpleGrid",classes:OA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f}),C=sf();return y==="container"?a.jsxs(a.Fragment,{children:[a.jsx(G$,{...n,selector:`.${C}`}),a.jsx("div",{...w("container"),children:a.jsx(le,{ref:t,...w("root",{className:C}),...S})})]}):a.jsxs(a.Fragment,{children:[a.jsx(F$,{...n,selector:`.${C}`}),a.jsx(le,{ref:t,...w("root",{className:C}),...S})]})});qm.classes=OA;qm.displayName="@mantine/core/SimpleGrid";const MA=ve((e,t)=>{const{w:n,h:r,miw:i,mih:s,...c}=ae("Space",null,e);return a.jsx(le,{ref:t,...c,w:n,miw:i??n,h:r,mih:s??r})});MA.displayName="@mantine/core/Space";var LA={root:"m_6d731127"};const Q$={gap:"md",align:"stretch",justify:"flex-start"},Y$=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":Yn(t),"--stack-align":n,"--stack-justify":r}}),Ne=ve((e,t)=>{const n=ae("Stack",Q$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,align:h,justify:m,gap:g,variant:y,attributes:x,...S}=n,w=$e({name:"Stack",props:n,classes:LA,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:Y$});return a.jsx(le,{ref:t,...w("root"),variant:y,...S})});Ne.classes=LA;Ne.displayName="@mantine/core/Stack";const[K$,X$]=Or("Stepper component was not found in tree");var J0={root:"m_cbb4ea7e",steps:"m_aaf89d0b",separator:"m_2a371ac9",content:"m_78da155d",step:"m_cbb57068","step--horizontal":"m_f56b1e2c","step--vertical":"m_833edb7e",verticalSeparator:"m_6496b3f3",stepWrapper:"m_818e70b",stepIcon:"m_1959ad01",stepCompletedIcon:"m_a79331dc",stepBody:"m_1956aa2a",stepLabel:"m_12051f6c",stepDescription:"m_164eea74"};const Bp=()=>null;Bp.displayName="@mantine/core/StepperCompleted";const lp=(e,t)=>typeof e=="function"?a.jsx(e,{step:t||0}):e,J$={withIcon:!0,allowStepClick:!0,iconPosition:"left"},Z0=ve((e,t)=>{const{classNames:n,className:r,style:i,styles:s,vars:c,step:u,state:f,color:h,icon:m,completedIcon:g,progressIcon:y,label:x,description:S,withIcon:w,iconSize:C,loading:T,allowStepClick:R,allowStepSelect:E,iconPosition:_,orientation:P,mod:O,...k}=ae("StepperStep",J$,e),A=X$(),z=Nn(),U={classNames:n,styles:s},K=f==="stepCompleted"?null:f==="stepProgress"?y:m,W={"data-progress":f==="stepProgress"||void 0,"data-completed":f==="stepCompleted"||void 0};return a.jsxs(An,{...A.getStyles("step",{className:r,style:i,variant:A.orientation,...U}),mod:[{"icon-position":_||A.iconPosition,"allow-click":R},O],ref:t,...W,...k,__vars:{"--step-color":h?Kt(h,z):void 0},tabIndex:R?0:-1,children:[w&&a.jsxs("span",{...A.getStyles("stepWrapper",U),children:[a.jsxs("span",{...A.getStyles("stepIcon",U),...W,children:[a.jsx(uo,{mounted:f==="stepCompleted",transition:"pop",duration:200,children:ee=>a.jsx("span",{...A.getStyles("stepCompletedIcon",{style:ee,...U}),children:T?a.jsx(Pr,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...A.getStyles("stepLoader",U)}):lp(g,u)||a.jsx(pf,{size:"60%"})})}),f!=="stepCompleted"?T?a.jsx(Pr,{...A.getStyles("stepLoader",U),size:"calc(var(--stepper-icon-size) / 2)",color:h}):lp(K||m,u):null]}),P==="vertical"&&a.jsx("span",{...A.getStyles("verticalSeparator",U),"data-active":f==="stepCompleted"||void 0})]}),(x||S)&&a.jsxs("span",{...A.getStyles("stepBody",U),"data-orientation":A.orientation,"data-icon-position":_||A.iconPosition,children:[x&&a.jsx("span",{...A.getStyles("stepLabel",U),children:lp(x,u)}),S&&a.jsx("span",{...A.getStyles("stepDescription",U),children:lp(S,u)})]})]})});Z0.classes=J0;Z0.displayName="@mantine/core/StepperStep";const Z$={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},e8=(e,{color:t,iconSize:n,size:r,contentPadding:i,radius:s,autoContrast:c})=>({root:{"--stepper-color":t?Kt(t,e):void 0,"--stepper-icon-color":Il(c,e)?Ra({color:t,theme:e,autoContrast:c}):void 0,"--stepper-icon-size":n===void 0?ot(r,"stepper-icon-size"):ce(n),"--stepper-content-padding":Yn(i),"--stepper-radius":s===void 0?void 0:Ht(s),"--stepper-fz":Kn(r),"--stepper-spacing":Yn(r)}}),ou=ve((e,t)=>{const n=ae("Stepper",Z$,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,children:h,onStepClick:m,active:g,icon:y,completedIcon:x,progressIcon:S,color:w,iconSize:C,contentPadding:T,orientation:R,iconPosition:E,size:_,radius:P,allowNextStepsSelect:O,wrap:k,autoContrast:A,attributes:z,...U}=n,K=$e({name:"Stepper",classes:J0,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:z,vars:f,varsResolver:e8}),W=v.Children.toArray(h),ee=W.filter(V=>V.type!==Bp),B=W.find(V=>V.type===Bp),G=ee.reduce((V,X,M)=>{const F=g===M?"stepProgress":g>M?"stepCompleted":"stepInactive",de=typeof m!="function"?!1:typeof X.props.allowStepSelect=="boolean"?X.props.allowStepSelect:F==="stepCompleted"||O;return V.push(v.cloneElement(X,{icon:X.props.icon||y||M+1,key:M,step:M,state:F,onClick:()=>de&&m?.(M),allowStepClick:de,completedIcon:X.props.completedIcon||x,progressIcon:X.props.progressIcon||S,color:X.props.color||w,iconSize:C,iconPosition:X.props.iconPosition||E,orientation:R})),R==="horizontal"&&M!==ee.length-1&&V.push(v.createElement("div",{...K("separator"),"data-active":M<g||void 0,"data-orientation":R,key:`separator-${M}`})),V},[]),L=ee[g]?.props?.children,I=B?.props?.children,$=g>ee.length-1?I:L;return a.jsx(K$,{value:{getStyles:K,orientation:R,iconPosition:E},children:a.jsxs(le,{...K("root"),ref:t,size:_,...U,children:[a.jsx(le,{...K("steps"),mod:{orientation:R,"icon-position":E,wrap:k&&R!=="vertical"},children:G}),$&&a.jsx("div",{...K("content"),children:$})]})})});ou.classes=J0;ou.displayName="@mantine/core/Stepper";ou.Completed=Bp;ou.Step=Z0;var IA={root:"m_5f93f3bb",input:"m_926b4011",track:"m_9307d992",thumb:"m_93039a1d",trackLabel:"m_8277e082"};const zA=v.createContext(null),t8=zA.Provider,n8=()=>v.useContext(zA),eS=ve((e,t)=>{const{value:n,defaultValue:r,onChange:i,size:s,wrapperProps:c,children:u,readOnly:f,disabled:h,...m}=ae("SwitchGroup",null,e),[g,y]=or({value:n,defaultValue:r,finalValue:[],onChange:i}),x=S=>{const w=S.currentTarget.value;!f&&y(g.includes(w)?g.filter(C=>C!==w):[...g,w])};return a.jsx(t8,{value:{value:g,onChange:x,size:s,disabled:h},children:a.jsx(mn.Wrapper,{size:s,ref:t,...c,...m,labelElement:"div",__staticSelector:"SwitchGroup",children:a.jsx(g0,{role:"group",children:u})})})});eS.classes=mn.Wrapper.classes;eS.displayName="@mantine/core/SwitchGroup";const r8={labelPosition:"right",withThumbIndicator:!0},i8=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:Ht(t),"--switch-height":ot(r,"switch-height"),"--switch-width":ot(r,"switch-width"),"--switch-thumb-size":ot(r,"switch-thumb-size"),"--switch-label-font-size":ot(r,"switch-label-font-size"),"--switch-track-label-padding":ot(r,"switch-track-label-padding"),"--switch-color":n?Kt(n,e):void 0}}),bf=ve((e,t)=>{const n=ae("Switch",r8,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,color:h,label:m,offLabel:g,onLabel:y,id:x,size:S,radius:w,wrapperProps:C,thumbIcon:T,checked:R,defaultChecked:E,onChange:_,labelPosition:P,description:O,error:k,disabled:A,variant:z,rootRef:U,mod:K,withThumbIndicator:W,attributes:ee,...B}=n,G=n8(),L=S||G?.size,I=$e({name:"Switch",props:n,classes:IA,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:ee,vars:f,varsResolver:i8}),{styleProps:$,rest:V}=_a(B),X=vr(x),M={checked:G?.value.includes(V.value)??R,onChange:de=>{G?.onChange(de),_?.(de)},disabled:G?.disabled??A},[F,ie]=or({value:M.checked??R,defaultValue:E,finalValue:!1});return a.jsxs(Em,{...I("root"),__staticSelector:"Switch",__stylesApiProps:n,id:X,size:L,labelPosition:P,label:m,description:O,error:k,disabled:M.disabled,bodyElement:"label",labelElement:"span",classNames:r,styles:c,unstyled:u,"data-checked":M.checked,variant:z,ref:U,mod:K,inert:V.inert,...$,...C,children:[a.jsx("input",{...V,...M,checked:F,"data-checked":M.checked,onChange:de=>{M.onChange?.(de),ie(de.currentTarget.checked)},id:X,ref:t,type:"checkbox",role:"switch",inert:V.inert,...I("input")}),a.jsxs(le,{"aria-hidden":"true",component:"span",mod:{error:k,"label-position":P,"without-labels":!y&&!g},...I("track"),children:[a.jsx(le,{component:"span",mod:{"reduce-motion":!0,"with-thumb-indicator":W&&!T},...I("thumb"),children:T}),a.jsx("span",{...I("trackLabel"),children:F?y:g})]})]})});bf.classes={...IA,...zD};bf.displayName="@mantine/core/Switch";bf.Group=eS;const[o8,a8]=Or("Table component was not found in the tree");var Sf={table:"m_b23fa0ef",th:"m_4e7aa4f3",tr:"m_4e7aa4fd",td:"m_4e7aa4ef",tbody:"m_b2404537",thead:"m_b242d975",caption:"m_9e5a3ac7",scrollContainer:"m_a100c15",scrollContainerInner:"m_62259741"};function s8(e,t){if(!t)return;const n={};return t.columnBorder&&e.withColumnBorders&&(n["data-with-column-border"]=!0),t.rowBorder&&e.withRowBorders&&(n["data-with-row-border"]=!0),t.striped&&e.striped&&(n["data-striped"]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n["data-hover"]=!0),t.captionSide&&e.captionSide&&(n["data-side"]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n["data-sticky"]=!0),n}function Bl(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=ve((i,s)=>{const c=ae(n,{},i),{classNames:u,className:f,style:h,styles:m,...g}=c,y=a8();return a.jsx(le,{component:e,ref:s,...s8(y,t),...y.getStyles(e,{className:f,classNames:u,style:h,styles:m,props:c}),...g})});return r.displayName=`@mantine/core/${n}`,r.classes=Sf,r}const Gx=Bl("th",{columnBorder:!0}),$A=Bl("td",{columnBorder:!0}),Cp=Bl("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),UA=Bl("thead",{stickyHeader:!0}),BA=Bl("tbody"),VA=Bl("tfoot"),FA=Bl("caption",{captionSide:!0});function tS({data:e}){return a.jsxs(a.Fragment,{children:[e.caption&&a.jsx(FA,{children:e.caption}),e.head&&a.jsx(UA,{children:a.jsx(Cp,{children:e.head.map((t,n)=>a.jsx(Gx,{children:t},n))})}),e.body&&a.jsx(BA,{children:e.body.map((t,n)=>a.jsx(Cp,{children:t.map((r,i)=>a.jsx($A,{children:r},i))},n))}),e.foot&&a.jsx(VA,{children:a.jsx(Cp,{children:e.foot.map((t,n)=>a.jsx(Gx,{children:t},n))})})]})}tS.displayName="@mantine/core/TableDataRenderer";const l8={type:"scrollarea"},c8=(e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":ce(t),"--table-max-height":ce(n),"--table-overflow":r==="native"?"auto":void 0}}),nS=ve((e,t)=>{const n=ae("TableScrollContainer",l8,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,children:h,minWidth:m,maxHeight:g,type:y,scrollAreaProps:x,attributes:S,...w}=n,C=$e({name:"TableScrollContainer",classes:Sf,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:c8,rootSelector:"scrollContainer"});return a.jsx(le,{component:y==="scrollarea"?ti:"div",...y==="scrollarea"?g?{offsetScrollbars:"xy",...x}:{offsetScrollbars:"x",...x}:{},ref:t,...C("scrollContainer"),...w,children:a.jsx("div",{...C("scrollContainerInner"),children:h})})});nS.classes=Sf;nS.displayName="@mantine/core/TableScrollContainer";const u8={withRowBorders:!0,verticalSpacing:7},d8=(e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:s,stripedColor:c,highlightOnHoverColor:u,striped:f,highlightOnHover:h,stickyHeaderOffset:m,stickyHeader:g})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":Yn(r),"--table-vertical-spacing":Yn(i),"--table-border-color":s?Kt(s,e):void 0,"--table-striped-color":f&&c?Kt(c,e):void 0,"--table-highlight-on-hover-color":h&&u?Kt(u,e):void 0,"--table-sticky-header-offset":g?ce(m):void 0}}),Z=ve((e,t)=>{const n=ae("Table",u8,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,horizontalSpacing:h,verticalSpacing:m,captionSide:g,stripedColor:y,highlightOnHoverColor:x,striped:S,highlightOnHover:w,withColumnBorders:C,withRowBorders:T,withTableBorder:R,borderColor:E,layout:_,variant:P,data:O,children:k,stickyHeader:A,stickyHeaderOffset:z,mod:U,tabularNums:K,attributes:W,...ee}=n,B=$e({name:"Table",props:n,className:i,style:s,classes:Sf,classNames:r,styles:c,unstyled:u,attributes:W,rootSelector:"table",vars:f,varsResolver:d8});return a.jsx(o8,{value:{getStyles:B,stickyHeader:A,striped:S===!0?"odd":S||void 0,highlightOnHover:w,withColumnBorders:C,withRowBorders:T,captionSide:g||"bottom"},children:a.jsx(le,{component:"table",variant:P,ref:t,mod:[{"data-with-table-border":R,"data-tabular-nums":K},U],...B("table"),...ee,children:k||!!O&&a.jsx(tS,{data:O})})})});Z.classes=Sf;Z.displayName="@mantine/core/Table";Z.Td=$A;Z.Th=Gx;Z.Tr=Cp;Z.Thead=UA;Z.Tbody=BA;Z.Tfoot=VA;Z.Caption=FA;Z.ScrollContainer=nS;Z.DataRenderer=tS;const[f8,rS]=Or("Tabs component was not found in the tree");var jf={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",tab:"m_4ec4dce6",panel:"m_b0c91715",tabSection:"m_fc420b1f",tabLabel:"m_42bbd1ae","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const iS=ve((e,t)=>{const n=ae("TabsList",null,e),{children:r,className:i,grow:s,justify:c,classNames:u,styles:f,style:h,mod:m,...g}=n,y=rS();return a.jsx(le,{...g,...y.getStyles("list",{className:i,style:h,classNames:u,styles:f,props:n,variant:y.variant}),ref:t,role:"tablist",variant:y.variant,mod:[{grow:s,orientation:y.orientation,placement:y.orientation==="vertical"&&y.placement,inverted:y.inverted},m],"aria-orientation":y.orientation,__vars:{"--tabs-justify":c},children:r})});iS.classes=jf;iS.displayName="@mantine/core/TabsList";const oS=ve((e,t)=>{const n=ae("TabsPanel",null,e),{children:r,className:i,value:s,classNames:c,styles:u,style:f,mod:h,keepMounted:m,...g}=n,y=rS(),x=y.value===s,S=y.keepMounted||m||x?r:null;return a.jsx(le,{...y.getStyles("panel",{className:i,classNames:c,styles:u,style:[f,x?void 0:{display:"none"}],props:n}),ref:t,mod:[{orientation:y.orientation},h],role:"tabpanel",id:y.getPanelId(s),"aria-labelledby":y.getTabId(s),...g,children:S})});oS.classes=jf;oS.displayName="@mantine/core/TabsPanel";const aS=ve((e,t)=>{const n=ae("TabsTab",null,e),{className:r,children:i,rightSection:s,leftSection:c,value:u,onClick:f,onKeyDown:h,disabled:m,color:g,style:y,classNames:x,styles:S,vars:w,mod:C,tabIndex:T,...R}=n,E=Nn(),{dir:_}=Rs(),P=rS(),O=u===P.value,k=z=>{P.onChange(P.allowTabDeactivation&&u===P.value?null:u),f?.(z)},A={classNames:x,styles:S,props:n};return a.jsxs(An,{...P.getStyles("tab",{className:r,style:y,variant:P.variant,...A}),disabled:m,unstyled:P.unstyled,variant:P.variant,mod:[{active:O,disabled:m,orientation:P.orientation,inverted:P.inverted,placement:P.orientation==="vertical"&&P.placement},C],ref:t,role:"tab",id:P.getTabId(u),"aria-selected":O,tabIndex:T!==void 0?T:O||P.value===null?0:-1,"aria-controls":P.getPanelId(u),onClick:k,__vars:{"--tabs-color":g?Kt(g,E):void 0},onKeyDown:Eb({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:P.activateTabWithKeyboard,loop:P.loop,orientation:P.orientation||"horizontal",dir:_,onKeyDown:h}),...R,children:[c&&a.jsx("span",{...P.getStyles("tabSection",A),"data-position":"left",children:c}),i&&a.jsx("span",{...P.getStyles("tabLabel",A),children:i}),s&&a.jsx("span",{...P.getStyles("tabSection",A),"data-position":"right",children:s})]})});aS.classes=jf;aS.displayName="@mantine/core/TabsTab";const ET="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",h8={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,variant:"default",placement:"left"},p8=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":Ht(t),"--tabs-color":Kt(n,e),"--tabs-text-color":Il(r,e)?Ra({color:n,theme:e,autoContrast:r}):void 0}}),bn=ve((e,t)=>{const n=ae("Tabs",h8,e),{defaultValue:r,value:i,onChange:s,orientation:c,children:u,loop:f,id:h,activateTabWithKeyboard:m,allowTabDeactivation:g,variant:y,color:x,radius:S,inverted:w,placement:C,keepMounted:T,classNames:R,styles:E,unstyled:_,className:P,style:O,vars:k,autoContrast:A,mod:z,attributes:U,...K}=n,W=vr(h),[ee,B]=or({value:i,defaultValue:r,finalValue:null,onChange:s}),G=$e({name:"Tabs",props:n,classes:jf,className:P,style:O,classNames:R,styles:E,unstyled:_,attributes:U,vars:k,varsResolver:p8});return a.jsx(f8,{value:{placement:C,value:ee,orientation:c,id:W,loop:f,activateTabWithKeyboard:m,getTabId:vE(`${W}-tab`,ET),getPanelId:vE(`${W}-panel`,ET),onChange:B,allowTabDeactivation:g,variant:y,color:x,radius:S,inverted:w,keepMounted:T,unstyled:_,getStyles:G},children:a.jsx(le,{ref:t,id:W,variant:y,mod:[{orientation:c,inverted:c==="horizontal"&&w,placement:c==="vertical"&&C},z],...G("root"),...K,children:u})})});bn.classes=jf;bn.displayName="@mantine/core/Tabs";bn.Tab=aS;bn.Panel=oS;bn.List=iS;const Fe=ve((e,t)=>{const n=ae("TextInput",null,e);return a.jsx(Vr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});Fe.classes=Vr.classes;Fe.displayName="@mantine/core/TextInput";var HA={root:"m_7341320d"};const m8=(e,{size:t,radius:n,variant:r,gradient:i,color:s,autoContrast:c})=>{const u=e.variantColorResolver({color:s||e.primaryColor,theme:e,gradient:i,variant:r||"filled",autoContrast:c});return{root:{"--ti-size":ot(t,"ti-size"),"--ti-radius":n===void 0?void 0:Ht(n),"--ti-bg":s||r?u.background:void 0,"--ti-color":s||r?u.color:void 0,"--ti-bd":s||r?u.border:void 0}}},sS=ve((e,t)=>{const n=ae("ThemeIcon",null,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,autoContrast:h,attributes:m,...g}=n,y=$e({name:"ThemeIcon",classes:HA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:m,vars:f,varsResolver:m8});return a.jsx(le,{ref:t,...y("root"),...g})});sS.classes=HA;sS.displayName="@mantine/core/ThemeIcon";const g8=["h1","h2","h3","h4","h5","h6"],v8=["xs","sm","md","lg","xl"];function y8(e,t){const n=t!==void 0?t:`h${e}`;return g8.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:v8.includes(n)?{fontSize:`var(--mantine-font-size-${n})`,fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}:{fontSize:ce(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var qA={root:"m_8a5d1357"};const x8={order:1},b8=(e,{order:t,size:n,lineClamp:r,textWrap:i})=>{const s=y8(t||1,n);return{root:{"--title-fw":s.fontWeight,"--title-lh":s.lineHeight,"--title-fz":s.fontSize,"--title-line-clamp":typeof r=="number"?r.toString():void 0,"--title-text-wrap":i}}},ze=ve((e,t)=>{const n=ae("Title",x8,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,order:f,vars:h,size:m,variant:g,lineClamp:y,textWrap:x,mod:S,attributes:w,...C}=n,T=$e({name:"Title",props:n,classes:qA,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:w,vars:h,varsResolver:b8});return[1,2,3,4,5,6].includes(f)?a.jsx(le,{...T("root"),component:`h${f}`,variant:g,ref:t,mod:[{order:f,"data-line-clamp":typeof y=="number"},S],size:m,...C}):null});ze.classes=qA;ze.displayName="@mantine/core/Title";function GA(e){let t=e,n=!1;const r=new Set;return{getState(){return t},updateState(i){t=typeof i=="function"?i(t):i},setState(i){this.updateState(i),r.forEach(s=>s(t))},initialize(i){n||(t=i,n=!0)},subscribe(i){return r.add(i),()=>r.delete(i)}}}function WA(e){return v.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}function S8(e,t,n){const r=[],i=[],s={};for(const c of e){const u=c.position||t;s[u]=s[u]||0,s[u]+=1,s[u]<=n?i.push(c):r.push(c)}return{notifications:i,queue:r}}const j8=()=>GA({notifications:[],queue:[],defaultPosition:"bottom-right",limit:5}),Vl=j8(),w8=(e=Vl)=>WA(e);function bu(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]),i=S8(r,n.defaultPosition,n.limit);e.setState({notifications:i.notifications,queue:i.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function Ae(e,t=Vl){const n=e.id||Op();return bu(t,r=>e.id&&r.some(i=>i.id===e.id)?r:[...r,{...e,id:n}]),n}function QA(e,t=Vl){return bu(t,n=>n.filter(r=>r.id===e?(r.onClose?.(r),!1):!0)),e}function hl(e,t=Vl){return bu(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function C8(e=Vl){bu(e,()=>[])}function E8(e=Vl){bu(e,t=>t.slice(0,e.getState().limit))}const Li={show:Ae,hide:QA,update:hl,clean:C8,cleanQueue:E8,updateState:bu};function Wx(e,t){return Wx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Wx(e,t)}function YA(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Wx(e,t)}var Jy={exports:{}},Zy,TT;function T8(){if(TT)return Zy;TT=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Zy=e,Zy}var ex,RT;function R8(){if(RT)return ex;RT=1;var e=T8();function t(){}function n(){}return n.resetWarningCache=t,ex=function(){function r(c,u,f,h,m,g){if(g!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},ex}var _T;function _8(){return _T||(_T=1,Jy.exports=R8()()),Jy.exports}var D8=_8();const un=sm(D8),DT={disabled:!1},Vp=Ln.createContext(null);var A8=function(t){return t.scrollTop},Td="unmounted",al="exited",sl="entering",Hc="entered",Qx="exiting",ka=(function(e){YA(t,e);function t(r,i){var s;s=e.call(this,r,i)||this;var c=i,u=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?u?(f=al,s.appearStatus=sl):f=Hc:r.unmountOnExit||r.mountOnEnter?f=Td:f=al,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(i,s){var c=i.in;return c&&s.status===Td?{status:al}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var s=null;if(i!==this.props){var c=this.state.status;this.props.in?c!==sl&&c!==Hc&&(s=sl):(c===sl||c===Hc)&&(s=Qx)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,s,c,u;return s=c=u=i,i!=null&&typeof i!="number"&&(s=i.exit,c=i.enter,u=i.appear!==void 0?i.appear:c),{exit:s,enter:c,appear:u}},n.updateStatus=function(i,s){if(i===void 0&&(i=!1),s!==null)if(this.cancelNextCallback(),s===sl){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:Ed.findDOMNode(this);c&&A8(c)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===al&&this.setState({status:Td})},n.performEnter=function(i){var s=this,c=this.props.enter,u=this.context?this.context.isMounting:i,f=this.props.nodeRef?[u]:[Ed.findDOMNode(this),u],h=f[0],m=f[1],g=this.getTimeouts(),y=u?g.appear:g.enter;if(!i&&!c||DT.disabled){this.safeSetState({status:Hc},function(){s.props.onEntered(h)});return}this.props.onEnter(h,m),this.safeSetState({status:sl},function(){s.props.onEntering(h,m),s.onTransitionEnd(y,function(){s.safeSetState({status:Hc},function(){s.props.onEntered(h,m)})})})},n.performExit=function(){var i=this,s=this.props.exit,c=this.getTimeouts(),u=this.props.nodeRef?void 0:Ed.findDOMNode(this);if(!s||DT.disabled){this.safeSetState({status:al},function(){i.props.onExited(u)});return}this.props.onExit(u),this.safeSetState({status:Qx},function(){i.props.onExiting(u),i.onTransitionEnd(c.exit,function(){i.safeSetState({status:al},function(){i.props.onExited(u)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,s){s=this.setNextCallback(s),this.setState(i,s)},n.setNextCallback=function(i){var s=this,c=!0;return this.nextCallback=function(u){c&&(c=!1,s.nextCallback=null,i(u))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(i,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:Ed.findDOMNode(this),u=i==null&&!this.props.addEndListener;if(!c||u){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=f[0],m=f[1];this.props.addEndListener(h,m)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===Td)return null;var s=this.props,c=s.children;s.in,s.mountOnEnter,s.unmountOnExit,s.appear,s.enter,s.exit,s.timeout,s.addEndListener,s.onEnter,s.onEntering,s.onEntered,s.onExit,s.onExiting,s.onExited,s.nodeRef;var u=A0(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Ln.createElement(Vp.Provider,{value:null},typeof c=="function"?c(i,u):Ln.cloneElement(Ln.Children.only(c),u))},t})(Ln.Component);ka.contextType=Vp;ka.propTypes={};function Lc(){}ka.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Lc,onEntering:Lc,onEntered:Lc,onExit:Lc,onExiting:Lc,onExited:Lc};ka.UNMOUNTED=Td;ka.EXITED=al;ka.ENTERING=sl;ka.ENTERED=Hc;ka.EXITING=Qx;function k8(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lS(e,t){var n=function(s){return t&&v.isValidElement(s)?t(s):s},r=Object.create(null);return e&&v.Children.map(e,function(i){return i}).forEach(function(i){r[i.key]=n(i)}),r}function P8(e,t){e=e||{},t=t||{};function n(m){return m in t?t[m]:e[m]}var r=Object.create(null),i=[];for(var s in e)s in t?i.length&&(r[s]=i,i=[]):i.push(s);var c,u={};for(var f in t){if(r[f])for(c=0;c<r[f].length;c++){var h=r[f][c];u[r[f][c]]=n(h)}u[f]=n(f)}for(c=0;c<i.length;c++)u[i[c]]=n(i[c]);return u}function pl(e,t,n){return n[t]!=null?n[t]:e.props[t]}function N8(e,t){return lS(e.children,function(n){return v.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:pl(n,"appear",e),enter:pl(n,"enter",e),exit:pl(n,"exit",e)})})}function O8(e,t,n){var r=lS(e.children),i=P8(t,r);return Object.keys(i).forEach(function(s){var c=i[s];if(v.isValidElement(c)){var u=s in t,f=s in r,h=t[s],m=v.isValidElement(h)&&!h.props.in;f&&(!u||m)?i[s]=v.cloneElement(c,{onExited:n.bind(null,c),in:!0,exit:pl(c,"exit",e),enter:pl(c,"enter",e)}):!f&&u&&!m?i[s]=v.cloneElement(c,{in:!1}):f&&u&&v.isValidElement(h)&&(i[s]=v.cloneElement(c,{onExited:n.bind(null,c),in:h.props.in,exit:pl(c,"exit",e),enter:pl(c,"enter",e)}))}}),i}var M8=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},L8={component:"div",childFactory:function(t){return t}},ds=(function(e){YA(t,e);function t(r,i){var s;s=e.call(this,r,i)||this;var c=s.handleExited.bind(k8(s));return s.state={contextValue:{isMounting:!0},handleExited:c,firstRender:!0},s}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(i,s){var c=s.children,u=s.handleExited,f=s.firstRender;return{children:f?N8(i,u):O8(i,c,u),firstRender:!1}},n.handleExited=function(i,s){var c=lS(this.props.children);i.key in c||(i.props.onExited&&i.props.onExited(s),this.mounted&&this.setState(function(u){var f=Up({},u.children);return delete f[i.key],{children:f}}))},n.render=function(){var i=this.props,s=i.component,c=i.childFactory,u=A0(i,["component","childFactory"]),f=this.state.contextValue,h=M8(this.state.children).map(c);return delete u.appear,delete u.enter,delete u.exit,s===null?Ln.createElement(Vp.Provider,{value:f},h):Ln.createElement(Vp.Provider,{value:f},Ln.createElement(s,u,h))},t})(Ln.Component);ds.propTypes={};ds.defaultProps=L8;const KA=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"];function I8(e,t){return e.reduce((n,r)=>(n[r.position||t].push(r),n),KA.reduce((n,r)=>(n[r]=[],n),{}))}const AT={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},z8={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function $8({state:e,maxHeight:t,position:n,transitionDuration:r}){const[i,s]=n.split("-"),c=s==="center"?`${i}-center`:s,u={opacity:0,maxHeight:t,transform:AT[c],transitionDuration:`${r}ms, ${r}ms, ${r}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},f={opacity:1,transform:z8[c]},h={opacity:0,maxHeight:0,transform:AT[c]};return{...u,...{entering:f,entered:f,exiting:h,exited:h}[e]}}function U8(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const XA=v.forwardRef(({data:e,onHide:t,autoClose:n,...r},i)=>{const{autoClose:s,message:c,...u}=e,f=U8(n,e.autoClose),h=v.useRef(-1),m=()=>window.clearTimeout(h.current),g=()=>{t(e.id),m()},y=()=>{typeof f=="number"&&(h.current=window.setTimeout(g,f))};return v.useEffect(()=>{e.onOpen?.(e)},[]),v.useEffect(()=>(y(),m),[f]),a.jsx(H0,{...r,...u,onClose:g,ref:i,onMouseEnter:m,onMouseLeave:y,children:c})});XA.displayName="@mantine/notifications/NotificationContainer";var JA={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const B8=ka,V8={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:Br("overlay"),store:Vl,withinPortal:!0},F8=(e,{zIndex:t,containerWidth:n})=>({root:{"--notifications-z-index":t?.toString(),"--notifications-container-width":ce(n)}}),Pa=ve((e,t)=>{const n=ae("Notifications",V8,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,position:h,autoClose:m,transitionDuration:g,containerWidth:y,notificationMaxHeight:x,limit:S,zIndex:w,store:C,portalProps:T,withinPortal:R,...E}=n,_=Nn(),P=w8(C),O=OM(),k=_b(),A=v.useRef({}),z=v.useRef(0),K=(_.respectReducedMotion?k:!1)?1:g,W=$e({name:"Notifications",classes:JA,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,vars:f,varsResolver:F8});v.useEffect(()=>{C?.updateState(G=>({...G,limit:S||5,defaultPosition:h}))},[S,h]),jl(()=>{P.notifications.length>z.current&&setTimeout(()=>O(),0),z.current=P.notifications.length},[P.notifications]);const ee=I8(P.notifications,h),B=KA.reduce((G,L)=>(G[L]=ee[L].map(({style:I,...$})=>a.jsx(B8,{timeout:K,onEnter:()=>A.current[$.id].offsetHeight,nodeRef:{current:A.current[$.id]},children:V=>a.jsx(XA,{ref:X=>{X&&(A.current[$.id]=X)},data:$,onHide:X=>QA(X,C),autoClose:m,...W("notification",{style:{...$8({state:V,position:L,transitionDuration:K,maxHeight:x}),...I}})})},$.id)),G),{});return a.jsxs(ja,{withinPortal:R,...T,children:[a.jsx(le,{...W("root"),"data-position":"top-center",ref:t,...E,children:a.jsx(ds,{children:B["top-center"]})}),a.jsx(le,{...W("root"),"data-position":"top-left",...E,children:a.jsx(ds,{children:B["top-left"]})}),a.jsx(le,{...W("root",{className:Sl.classNames.fullWidth}),"data-position":"top-right",...E,children:a.jsx(ds,{children:B["top-right"]})}),a.jsx(le,{...W("root",{className:Sl.classNames.fullWidth}),"data-position":"bottom-right",...E,children:a.jsx(ds,{children:B["bottom-right"]})}),a.jsx(le,{...W("root"),"data-position":"bottom-left",...E,children:a.jsx(ds,{children:B["bottom-left"]})}),a.jsx(le,{...W("root"),"data-position":"bottom-center",...E,children:a.jsx(ds,{children:B["bottom-center"]})})]})});Pa.classes=JA;Pa.displayName="@mantine/notifications/Notifications";Pa.show=Li.show;Pa.hide=Li.hide;Pa.update=Li.update;Pa.clean=Li.clean;Pa.cleanQueue=Li.cleanQueue;Pa.updateState=Li.updateState;class cS{max;cache;constructor(t=10){this.max=t,this.cache=new Map}clear(){this.cache.clear()}get(t){const n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){this.cache.has(t)?this.cache.delete(t):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(t,n)}delete(t){this.cache.delete(t)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}}class H8{operator;child;constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class wf{operator;left;right;constructor(t,n,r){this.operator=t,this.left=n,this.right=r}toString(){return`(${this.left.toString()} ${this.operator} ${this.right.toString()})`}}class q8{prefixParselets={};infixParselets={};registerInfix(t,n){return this.infixParselets[t]=n,this}registerPrefix(t,n){return this.prefixParselets[t]=n,this}prefix(t,n,r){return this.registerPrefix(t,{parse(i,s){const c=i.consumeAndParse(n);return r(s,c)}})}infixLeft(t,n,r){return this.registerInfix(t,{parse(i,s,c){const u=i.consumeAndParse(n);return r(s,c,u)},precedence:n})}construct(t){return new G8(t,this.prefixParselets,this.infixParselets)}}class G8{tokens;prefixParselets;infixParselets;constructor(t,n,r){this.tokens=t,this.prefixParselets=n,this.infixParselets=r}hasMore(){return this.tokens.length>0}match(t){return this.peek()?.id!==t?!1:(this.consume(),!0)}consumeAndParse(t=1/0){const n=this.consume(),r=this.prefixParselets[n.id];if(!r)throw new Error(`Parse error at "${n.value}" (line ${n.line}, column ${n.column}). No matching prefix parselet.`);let i=r.parse(this,n);for(;t>this.getPrecedence();){const s=this.consume();i=this.getInfixParselet(s).parse(this,i,s)}return i}getPrecedence(){const t=this.peek();if(!t)return 1/0;const n=this.getInfixParselet(t);return n?n.precedence:1/0}consume(t,n){if(!this.tokens.length)throw new Error("Cant consume unknown more tokens.");if(t&&this.peek()?.id!==t){const r=this.peek();throw new Error(`Expected ${t} but got "${r.id}" (${r.value}) at line ${r.line} column ${r.column}.`)}if(n&&this.peek()?.value!==n){const r=this.peek();throw new Error(`Expected "${n}" but got "${r.value}" at line ${r.line} column ${r.column}.`)}return this.tokens.shift()}peek(){return this.tokens.length>0?this.tokens[0]:void 0}removeComments(){this.tokens=this.tokens.filter(t=>t.id!=="Comment")}getInfixParselet(t){return this.infixParselets[t.id==="Symbol"?t.value:t.id]}}const Gi="http://hl7.org",ZA="ok",W8="created",Q8="gone",Y8="not-modified",K8="not-found",X8="unauthorized",J8="forbidden",Z8="accepted",eU={resourceType:"OperationOutcome",id:ZA,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},tU={resourceType:"OperationOutcome",id:K8,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},Fd={resourceType:"OperationOutcome",id:X8,issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},nU={...Fd,issue:[...Fd.issue,{severity:"error",code:"expired",details:{text:"Token expired"}}]},kT={...Fd,issue:[...Fd.issue,{severity:"error",code:"invalid",details:{text:"Token not issued for this audience"}}]},Cf={resourceType:"OperationOutcome",id:J8,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function Oo(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},...t?{expression:[t]}:void 0}]}}function Sn(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function rU(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"exception",details:{text:"Internal server error"},diagnostics:e.toString()}]}}function iU(e){return!e||typeof e!="object"?!1:e instanceof Error||typeof DOMException<"u"&&e instanceof DOMException?!0:Object.prototype.toString.call(e)==="[object Error]"}function Ef(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function ek(e){return e.id===ZA||e.id===W8||e.id===Y8||e.id===Z8}function oU(e){return e.id===Q8}class ut extends Error{outcome;constructor(t,n){super(tk(t),n),this.name="OperationOutcomeError",this.outcome=t}}function rn(e){return e instanceof ut?e.outcome:Ef(e)?e:Oo(We(e))}function We(e){return e?typeof e=="string"?e:iU(e)?e.message:Ef(e)?tk(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function tk(e){const t=e.issue?.map(nk)??[];return t.length>0?t.join("; "):"Unknown error"}function nk(e){let t;return e.details?.text?e.diagnostics?t=`${e.details.text} (${e.diagnostics})`:t=e.details.text:e.diagnostics?t=e.diagnostics:t="Unknown error",e.expression?.length&&(t+=` (${e.expression.join(", ")})`),t}function aU(e,t){const n=t.max&&t.max===Number.MAX_SAFE_INTEGER?Number.POSITIVE_INFINITY:t.max;return{path:e,description:"",type:t.type??[],min:t.min??0,max:n??1,isArray:!!n&&n>1,constraints:[]}}function sU(e){const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]={name:n,type:n,path:n,elements:Object.fromEntries(Object.entries(r.elements).map(([i,s])=>[i,aU(i,s)])),constraints:[],innerTypes:[]};return t}const lU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},cU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},uU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},type:{type:[{code:"code"}]},text:{type:[{code:"string"}]},line:{max:9007199254740991,type:[{code:"string"}]},city:{type:[{code:"string"}]},district:{type:[{code:"string"}]},state:{type:[{code:"string"}]},postalCode:{type:[{code:"string"}]},country:{type:[{code:"string"}]},period:{type:[{code:"Period"}]}}},dU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},fU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},"author[x]":{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Organization"]},{code:"string"}]},time:{type:[{code:"dateTime"}]},text:{min:1,type:[{code:"markdown"}]}}},hU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},contentType:{type:[{code:"code"}]},language:{type:[{code:"code"}]},data:{type:[{code:"base64Binary"}]},url:{type:[{code:"url"}]},size:{type:[{code:"unsignedInt"}]},hash:{type:[{code:"base64Binary"}]},title:{type:[{code:"string"}]},creation:{type:[{code:"dateTime"}]}}},pU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},mU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},system:{type:[{code:"uri"}]},version:{type:[{code:"string"}]},code:{type:[{code:"code"}]},display:{type:[{code:"string"}]},userSelected:{type:[{code:"boolean"}]}}},gU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},vU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},system:{type:[{code:"code"}]},value:{type:[{code:"string"}]},use:{type:[{code:"code"}]},rank:{type:[{code:"positiveInt"}]},period:{type:[{code:"Period"}]}}},yU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},name:{min:1,type:[{code:"string"}]},contact:{max:9007199254740991,type:[{code:"ContactDetail"}]}}},xU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},bU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},"subject[x]":{type:[{code:"CodeableConcept"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Group"]}]},mustSupport:{max:9007199254740991,type:[{code:"string"}]},codeFilter:{max:9007199254740991,type:[{code:"DataRequirementCodeFilter"}]},dateFilter:{max:9007199254740991,type:[{code:"DataRequirementDateFilter"}]},limit:{type:[{code:"positiveInt"}]},sort:{max:9007199254740991,type:[{code:"DataRequirementSort"}]}}},SU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{type:[{code:"string"}]},searchParam:{type:[{code:"string"}]},valueSet:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]},code:{max:9007199254740991,type:[{code:"Coding"}]}}},jU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{type:[{code:"string"}]},searchParam:{type:[{code:"string"}]},"value[x]":{type:[{code:"dateTime"},{code:"Period"},{code:"Duration"}]}}},wU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},direction:{min:1,type:[{code:"code"}]}}},CU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},EU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},sequence:{type:[{code:"integer"}]},text:{type:[{code:"string"}]},additionalInstruction:{max:9007199254740991,type:[{code:"CodeableConcept"}]},patientInstruction:{type:[{code:"string"}]},timing:{type:[{code:"Timing"}]},"asNeeded[x]":{type:[{code:"boolean"},{code:"CodeableConcept"}]},site:{type:[{code:"CodeableConcept"}]},route:{type:[{code:"CodeableConcept"}]},method:{type:[{code:"CodeableConcept"}]},doseAndRate:{max:9007199254740991,type:[{code:"DosageDoseAndRate"}]},maxDosePerPeriod:{type:[{code:"Ratio"}]},maxDosePerAdministration:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},maxDosePerLifetime:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},TU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{type:[{code:"CodeableConcept"}]},"dose[x]":{type:[{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},"rate[x]":{type:[{code:"Ratio"},{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},RU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},_U={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},representation:{max:9007199254740991,type:[{code:"code"}]},sliceName:{type:[{code:"string"}]},sliceIsConstraining:{type:[{code:"boolean"}]},label:{type:[{code:"string"}]},code:{max:9007199254740991,type:[{code:"Coding"}]},slicing:{type:[{code:"ElementDefinitionSlicing"}]},short:{type:[{code:"string"}]},definition:{type:[{code:"markdown"}]},comment:{type:[{code:"markdown"}]},requirements:{type:[{code:"markdown"}]},alias:{max:9007199254740991,type:[{code:"string"}]},min:{type:[{code:"unsignedInt"}]},max:{type:[{code:"string"}]},base:{type:[{code:"ElementDefinitionBase"}]},contentReference:{type:[{code:"uri"}]},type:{max:9007199254740991,type:[{code:"ElementDefinitionType"}]},"defaultValue[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},meaningWhenMissing:{type:[{code:"markdown"}]},orderMeaning:{type:[{code:"string"}]},"fixed[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},"pattern[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},example:{max:9007199254740991,type:[{code:"ElementDefinitionExample"}]},"minValue[x]":{type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},"maxValue[x]":{type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},maxLength:{type:[{code:"integer"}]},condition:{max:9007199254740991,type:[{code:"id"}]},constraint:{max:9007199254740991,type:[{code:"ElementDefinitionConstraint"}]},mustSupport:{type:[{code:"boolean"}]},isModifier:{type:[{code:"boolean"}]},isModifierReason:{type:[{code:"string"}]},isSummary:{type:[{code:"boolean"}]},binding:{type:[{code:"ElementDefinitionBinding"}]},mapping:{max:9007199254740991,type:[{code:"ElementDefinitionMapping"}]}}},DU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},path:{min:1,type:[{code:"string"}]}}},AU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},discriminator:{max:9007199254740991,type:[{code:"ElementDefinitionSlicingDiscriminator"}]},description:{type:[{code:"string"}]},ordered:{type:[{code:"boolean"}]},rules:{min:1,type:[{code:"code"}]}}},kU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},min:{min:1,type:[{code:"unsignedInt"}]},max:{min:1,type:[{code:"string"}]}}},PU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},code:{min:1,type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},targetProfile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},aggregation:{max:9007199254740991,type:[{code:"code"}]},versioning:{type:[{code:"code"}]}}},NU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},label:{min:1,type:[{code:"string"}]},"value[x]":{min:1,type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},OU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},key:{min:1,type:[{code:"id"}]},requirements:{type:[{code:"string"}]},severity:{min:1,type:[{code:"code"}]},human:{min:1,type:[{code:"string"}]},expression:{type:[{code:"string"}]},xpath:{type:[{code:"string"}]},source:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},MU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},strength:{min:1,type:[{code:"code"}]},description:{type:[{code:"string"}]},valueSet:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]}}},LU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},identity:{min:1,type:[{code:"id"}]},language:{type:[{code:"code"}]},map:{min:1,type:[{code:"string"}]},comment:{type:[{code:"string"}]}}},IU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},description:{type:[{code:"string"}]},name:{type:[{code:"id"}]},language:{min:1,type:[{code:"code"}]},expression:{type:[{code:"string"}]},reference:{type:[{code:"uri"}]}}},zU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},url:{min:1,type:[{code:"uri"}]},"value[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},$U={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},text:{type:[{code:"string"}]},family:{type:[{code:"string"}]},given:{max:9007199254740991,type:[{code:"string"}]},prefix:{max:9007199254740991,type:[{code:"string"}]},suffix:{max:9007199254740991,type:[{code:"string"}]},period:{type:[{code:"Period"}]}}},UU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},type:{type:[{code:"CodeableConcept"}]},system:{type:[{code:"uri"}]},value:{type:[{code:"string"}]},period:{type:[{code:"Period"}]},assigner:{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},BU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},country:{min:1,type:[{code:"CodeableConcept"}]},jurisdiction:{type:[{code:"CodeableConcept"}]},status:{min:1,type:[{code:"CodeableConcept"}]},dateRange:{min:1,type:[{code:"Period"}]},restoreDate:{type:[{code:"dateTime"}]}}},VU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},versionId:{type:[{code:"id"}]},lastUpdated:{type:[{code:"instant"}]},source:{type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{max:9007199254740991,type:[{code:"Coding"}]},tag:{max:9007199254740991,type:[{code:"Coding"}]},project:{type:[{code:"uri"}]},author:{type:[{code:"Reference"}]},onBehalfOf:{type:[{code:"Reference"}]},account:{type:[{code:"Reference"}]},accounts:{max:9007199254740991,type:[{code:"Reference"}]},compartment:{max:9007199254740991,type:[{code:"Reference"}]}}},FU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},HU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},qU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"code"}]},use:{min:1,type:[{code:"code"}]},min:{type:[{code:"integer"}]},max:{type:[{code:"string"}]},documentation:{type:[{code:"string"}]},type:{min:1,type:[{code:"code"}]},profile:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},GU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},WU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},"age[x]":{type:[{code:"Range"},{code:"CodeableConcept"}]},gender:{type:[{code:"CodeableConcept"}]},race:{type:[{code:"CodeableConcept"}]},physiologicalCondition:{type:[{code:"CodeableConcept"}]}}},QU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},height:{type:[{code:"Quantity"}]},width:{type:[{code:"Quantity"}]},depth:{type:[{code:"Quantity"}]},weight:{type:[{code:"Quantity"}]},nominalVolume:{type:[{code:"Quantity"}]},externalDiameter:{type:[{code:"Quantity"}]},shape:{type:[{code:"string"}]},color:{max:9007199254740991,type:[{code:"string"}]},imprint:{max:9007199254740991,type:[{code:"string"}]},image:{max:9007199254740991,type:[{code:"Attachment"}]},scoring:{type:[{code:"CodeableConcept"}]}}},YU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},identifier:{type:[{code:"Identifier"}]},type:{min:1,type:[{code:"CodeableConcept"}]},period:{min:1,type:[{code:"Quantity"}]},specialPrecautionsForStorage:{max:9007199254740991,type:[{code:"CodeableConcept"}]}}},KU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},XU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},low:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},JU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},ZU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},reference:{type:[{code:"string"}]},type:{type:[{code:"uri"}]},identifier:{type:[{code:"Identifier"}]},display:{type:[{code:"string"}]}}},eB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},label:{type:[{code:"string"}]},display:{type:[{code:"string"}]},citation:{type:[{code:"markdown"}]},url:{type:[{code:"url"}]},document:{type:[{code:"Attachment"}]},resource:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}}},tB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},origin:{min:1,type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},period:{min:1,type:[{code:"decimal"}]},factor:{type:[{code:"decimal"}]},lowerLimit:{type:[{code:"decimal"}]},upperLimit:{type:[{code:"decimal"}]},dimensions:{min:1,type:[{code:"positiveInt"}]},data:{type:[{code:"string"}]}}},nB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,max:9007199254740991,type:[{code:"Coding"}]},when:{min:1,type:[{code:"instant"}]},who:{min:1,type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/PractitionerRole","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/Device","http://hl7.org/fhir/StructureDefinition/Organization"]}]},onBehalfOf:{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/PractitionerRole","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/Device","http://hl7.org/fhir/StructureDefinition/Organization"]}]},targetFormat:{type:[{code:"code"}]},sigFormat:{type:[{code:"code"}]},data:{type:[{code:"base64Binary"}]}}},rB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},"amount[x]":{type:[{code:"Quantity"},{code:"Range"},{code:"string"}]},amountType:{type:[{code:"CodeableConcept"}]},amountText:{type:[{code:"string"}]},referenceRange:{type:[{code:"SubstanceAmountReferenceRange"}]}}},iB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},lowLimit:{type:[{code:"Quantity"}]},highLimit:{type:[{code:"Quantity"}]}}},oB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},event:{max:9007199254740991,type:[{code:"dateTime"}]},repeat:{type:[{code:"TimingRepeat"}]},code:{type:[{code:"CodeableConcept"}]}}},aB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},"bounds[x]":{type:[{code:"Duration"},{code:"Range"},{code:"Period"}]},count:{type:[{code:"positiveInt"}]},countMax:{type:[{code:"positiveInt"}]},duration:{type:[{code:"decimal"}]},durationMax:{type:[{code:"decimal"}]},durationUnit:{type:[{code:"code"}]},frequency:{type:[{code:"positiveInt"}]},frequencyMax:{type:[{code:"positiveInt"}]},period:{type:[{code:"decimal"}]},periodMax:{type:[{code:"decimal"}]},periodUnit:{type:[{code:"code"}]},dayOfWeek:{max:9007199254740991,type:[{code:"code"}]},timeOfDay:{max:9007199254740991,type:[{code:"time"}]},when:{max:9007199254740991,type:[{code:"code"}]},offset:{type:[{code:"unsignedInt"}]}}},sB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},name:{type:[{code:"string"}]},"timing[x]":{type:[{code:"Timing"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Schedule"]},{code:"date"},{code:"dateTime"}]},data:{max:9007199254740991,type:[{code:"DataRequirement"}]},condition:{type:[{code:"Expression"}]}}},lB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},code:{min:1,type:[{code:"Coding"}]},"value[x]":{min:1,type:[{code:"CodeableConcept"},{code:"Quantity"},{code:"Range"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/PlanDefinition","http://hl7.org/fhir/StructureDefinition/ResearchStudy","http://hl7.org/fhir/StructureDefinition/InsurancePlan","http://hl7.org/fhir/StructureDefinition/HealthcareService","http://hl7.org/fhir/StructureDefinition/Group","http://hl7.org/fhir/StructureDefinition/Location","http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},cB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},uB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{max:0,type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},dB={elements:{authorizeUrl:{min:1,type:[{code:"string"}]},tokenUrl:{min:1,type:[{code:"string"}]},tokenAuthMethod:{type:[{code:"code"}]},userInfoUrl:{min:1,type:[{code:"string"}]},clientId:{min:1,type:[{code:"string"}]},clientSecret:{min:1,type:[{code:"string"}]},usePkce:{type:[{code:"boolean"}]},useSubject:{type:[{code:"boolean"}]}}},fB={Element:lU,BackboneElement:cU,Address:uU,Age:dU,Annotation:fU,Attachment:hU,CodeableConcept:pU,Coding:mU,ContactDetail:gU,ContactPoint:vU,Contributor:yU,Count:xU,DataRequirement:bU,DataRequirementCodeFilter:SU,DataRequirementDateFilter:jU,DataRequirementSort:wU,Distance:CU,Dosage:EU,DosageDoseAndRate:TU,Duration:RU,ElementDefinition:_U,ElementDefinitionSlicingDiscriminator:DU,ElementDefinitionSlicing:AU,ElementDefinitionBase:kU,ElementDefinitionType:PU,ElementDefinitionExample:NU,ElementDefinitionConstraint:OU,ElementDefinitionBinding:MU,ElementDefinitionMapping:LU,Expression:IU,Extension:zU,HumanName:$U,Identifier:UU,MarketingStatus:BU,Meta:VU,Money:FU,Narrative:HU,ParameterDefinition:qU,Period:GU,Population:WU,ProdCharacteristic:QU,ProductShelfLife:YU,Quantity:KU,Range:XU,Ratio:JU,Reference:ZU,RelatedArtifact:eB,SampledData:tB,Signature:nB,SubstanceAmount:rB,SubstanceAmountReferenceRange:iB,Timing:oB,TimingRepeat:aB,TriggerDefinition:sB,UsageContext:lB,MoneyQuantity:cB,SimpleQuantity:uB,IdentityProvider:dB};function hB(e){return new mB(e).parse()}const Fp=sU(fB),uS=Object.create(null),PT=Object.create(null),pB={"http://hl7.org/fhir/StructureDefinition/MoneyQuantity":"MoneyQuantity","http://hl7.org/fhir/StructureDefinition/SimpleQuantity":"SimpleQuantity","http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition":"ViewDefinition"};function rk(e){let t;return t=PT[e],t||(t=PT[e]=Object.create(null)),t}function NT(e){const n=(Array.isArray(e)?e:e.entry?.map(r=>r.resource)??[]).filter(r=>r?.resourceType==="StructureDefinition");nV(n);for(const r of n)ik(r)}function ik(e){if(!e?.name)throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const t=hB(e),n=pB[e.url];let r,i;n?(r=Fp,i=n):e.url===`http://hl7.org/fhir/StructureDefinition/${e.type}`||e.url===`https://medplum.com/fhir/StructureDefinition/${e.type}`||e.type?.startsWith("http://")||e.type?.startsWith("https://")?(r=Fp,i=e.type):(r=rk(e.url),i=e.type),r[i]=t;for(const s of t.innerTypes)s.parentType=t,r[s.name]=s;uS[e.url]=t}function ok(e){return!!Fp[e]}function Gm(e,t){if(t){const n=rk(t)[e];if(n)return n}return Fp[e]}function ak(e,t){const n=Gm(e,t);if(!n)throw new ut(Oo("Unknown data type: "+e));return n}function dS(e){return!!uS[e]}function Su(e){return uS[e]}class mB{root;elements;elementIndex;index;resourceSchema;slicingContext;innerTypes;backboneContext;constructor(t){if(!t.snapshot?.element||t.snapshot.element.length===0)throw new Error(`No snapshot defined for StructureDefinition '${t.name}'`);this.root=t.snapshot.element[0],this.elements=t.snapshot.element.slice(1),this.elementIndex=Object.create(null),this.index=0,this.resourceSchema={name:t.name,path:this.root.path,title:t.title,type:t.type,url:t.url,version:t.version,kind:t.kind,description:yB(t),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){let t=this.next();for(;t;){if(t.sliceName)this.parseSliceStart(t);else if(t.id?.includes(":")){if(this.slicingContext?.current){const n=tx(t,this.slicingContext.path);this.slicingContext.current.elements[n]=this.parseElementDefinition(t)}}else{const n=this.parseElementDefinition(t);this.checkFieldEnter(t,n);let r=this.backboneContext;for(;r;){if(t.path?.startsWith(r.path+".")){r.type.elements[tx(t,r.path)]=n;break}r=r.parent}if(!r){const i=tx(t,this.root.path);t.isSummary&&this.resourceSchema.summaryProperties?.add(i.replace("[x]","")),n.min>0&&this.resourceSchema.mandatoryProperties?.add(i.replace("[x]","")),this.resourceSchema.elements[i]=n}this.checkFieldExit(t)}t=this.next()}return this.checkFieldExit(),this.innerTypes.length>0&&(this.resourceSchema.innerTypes=this.innerTypes),this.resourceSchema}checkFieldEnter(t,n){this.isInnerType(t)&&this.enterInnerType(t),this.slicingContext&&!Ic(this.slicingContext.path,t?.path)&&(this.slicingContext=void 0),t.slicing&&!this.slicingContext&&this.enterSlice(t,n)}enterInnerType(t){for(;this.backboneContext&&!Ic(this.backboneContext?.path,t.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;const n=BT(t);this.backboneContext={type:{name:n,type:n,path:t.path,title:t.label,description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path,parent:Ic(this.backboneContext?.path,t.path)?this.backboneContext:this.backboneContext?.parent}}enterSlice(t,n){vB(t)&&!this.peek()?.sliceName||(n.slicing={discriminator:(t.slicing?.discriminator??[]).map(r=>{if(r.type!=="value"&&r.type!=="pattern"&&r.type!=="type")throw new Error(`Unsupported slicing discriminator type: ${r.type}`);return{path:r.path,type:r.type}}),slices:[],ordered:t.slicing?.ordered??!1,rule:t.slicing?.rules},this.slicingContext={field:n.slicing,path:t.path??""})}checkFieldExit(t=void 0){if(this.backboneContext&&!Ic(this.backboneContext.path,t?.path))if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!Ic(this.backboneContext.path,t?.path));else this.innerTypes.push(this.backboneContext.type),this.backboneContext=void 0}next(){const t=this.peek();if(t)return this.index++,t}peek(){const t=this.elements[this.index];if(t){if(this.elementIndex[t.path??""]=t,t.contentReference){const n=t.contentReference.slice(t.contentReference.indexOf("#")+1),r=this.elementIndex[n];return r?{...r,id:t.id,path:t.path,min:t.min??r.min,max:t.max??r.max,base:{path:r.base?.path??n,min:t.base?.min??r.base?.min??r.min,max:t.base?.max??r.base?.max??r.max},contentReference:t.contentReference,definition:t.definition}:void 0}return t}}isInnerType(t){const n=this.peek();return!!(Ic(t?.path,n?.path)&&t.type?.some(r=>["BackboneElement","Element"].includes(r.code)))}parseSliceStart(t){if(!this.slicingContext)throw new Error(`Invalid slice start before discriminator: ${t.sliceName} (${t.id})`);this.slicingContext.current={...this.parseElementDefinition(t),name:t.sliceName??"",definition:t.definition,elements:{}},this.slicingContext.field.slices.push(this.slicingContext.current)}parseElementDefinitionType(t){return(t.type??[]).map(n=>{let r;return(n.code==="BackboneElement"||n.code==="Element")&&(r=BT(t)),r||(r=po(n,"http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl),r||(r=n.code??""),{code:r,targetProfile:n.targetProfile,profile:n.profile}})}parseElementDefinition(t){const n=OT(t.max),r=t.base?.max?OT(t.base.max):n,i={type:"ElementDefinition",value:t};return{description:t.definition||"",path:t.path||t.base?.path||"",min:t.min??0,max:n,isArray:r>1,constraints:(t.constraint??[]).map(s=>({key:s.key??"",severity:s.severity??"error",expression:s.expression??"",description:s.human??""})),type:this.parseElementDefinitionType(t),fixed:MT(Hd(i,"fixed[x]")),pattern:MT(Hd(i,"pattern[x]")),binding:t.binding}}}function OT(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function tx(e,t=""){return gB(e.path,t)}function gB(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function Ic(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function MT(e){return Array.isArray(e)&&e.length>0?e[0]:kn(e)?void 0:e}function vB(e){const t=e.slicing?.discriminator;return!!(e.type?.some(n=>n.code==="Extension")&&t?.length===1&&t[0].type==="value"&&t[0].path==="url")}function yB(e){let t=e.description;return t?.startsWith(`Base StructureDefinition for ${e.name} Type: `)&&(t=t.substring(`Base StructureDefinition for ${e.name} Type: `.length)),t}function xB(e,t,n){if(e===void 0)return[void 0];if(t==="$this")return[e];const r=n?.withPath?sk:Hd,[i,...s]=t.split(".");let c=[r(e,i,n)];for(const u of s){const f=[];for(const h of c)if(Array.isArray(h))for(const m of h)f.push(r(m,u,n));else(n?.withPath&&h?.value!==void 0||!n?.withPath&&h!==void 0)&&f.push(r(h,u,n));c=f}return c}function sk(e,t,n){const r=e.path;return bB(Hd(e,t,n),r,t)}function bB(e,t,n){const r=t?t+".":"";return e===void 0?{type:"undefined",value:void 0,path:`${r}${n}`}:Array.isArray(e)?e.map((i,s)=>({...i,path:`${r}${n}[${s}]`})):{...e,path:`${r}${n}`}}const lk={date:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/,dateTime:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/};function SB(e,t,n,r){if(Array.isArray(e))return!1;let i;t.path==="$this"?i=n:i=(r??n.elements)[t.path];const s=n.type;switch(t.type){case"value":case"pattern":if(!e||!i)return!1;if(i.pattern)return pS(e,i.pattern);if(i.fixed)return $i(e,i.fixed);if(i.binding?.strength==="required"&&i.binding.valueSet)return!0;break;case"type":return!e||!s?.length?!1:s.some(c=>c.code===e.type)}return!1}function Je(e){return[{type:re.boolean,value:e}]}function mi(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:re.integer,value:e}:typeof e=="number"?{type:re.decimal,value:e}:typeof e=="boolean"?{type:re.boolean,value:e}:typeof e=="string"?{type:re.string,value:e}:Ii(e)?{type:re.Quantity,value:e}:Oa(e)?{type:e.resourceType,value:e}:Sk(e)?{type:re.CodeableConcept,value:e}:bk(e)?{type:re.Coding,value:e}:{type:re.BackboneElement,value:e}}function ko(e){return e.length===0?!1:!!e[0].value}function Ca(e,t){if(e.length!==0){if(e.length===1&&(!t||e[0].type===t))return e[0];throw new Error(`Expected singleton of type ${t}, but found ${JSON.stringify(e)}`)}}function Hd(e,t,n){if(!e.value)return;const r=Ps(e.type,t,n?.profileUrl);return r?ck(e,t,r):Tf(e,t)}function ck(e,t,n){const r=e.value,i=n.type;if(!i||i.length===0)return;let s,c="undefined",u;const f=n.path.lastIndexOf("."),h=n.path.substring(f+1);let m=h,g=!1;h.endsWith("[x]")&&(m=h.substring(0,h.length-3),g=!0);for(const y of i){let x=m;if(g&&(x+=Xn(y.code)),s=r[x],u=r["_"+x],s!==void 0||u!==void 0){c=y.code;break}}if(u)if(Array.isArray(s)){s=s.slice();for(let y=0;y<Math.max(s.length,u.length);y++)s[y]=nx(s[y],u[y])}else if(!s&&Array.isArray(u)){s=u.slice();for(let y=0;y<u.length;y++)s[y]=nx(void 0,u[y])}else s=nx(s,u);if(!kn(s))return(c==="Element"||c==="BackboneElement")&&(c=n.type[0].code),Array.isArray(s)?s.map(y=>LT(y,c)):LT(s,c)}function LT(e,t){return t==="Resource"&&Oa(e)&&(t=e.resourceType),{type:t,value:e}}function Tf(e,t){const n=e.value;if(!n||typeof n!="object")return;let r;if(t in n){const i=n[t];Array.isArray(i)?r=i.map(mi):r=mi(i)}else{const i=t.endsWith("[x]")?t.substring(0,t.length-3):t;for(const s of Object.values(re)){const c=i+Xn(s);if(c in n){const u=n[c];Array.isArray(u)?r=u.map(f=>({type:s,value:f})):r={type:s,value:u};break}}}if(Array.isArray(r)){if(r.length===0||kn(r[0]))return}else if(kn(r))return;return r}function uk(e){const t=[];for(const n of e){let r=!1;for(const i of t)if(ko(Wm(n,i))){r=!0;break}r||t.push(n)}return t}function jB(e){return Je(!ko(e))}function wB(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Je(!1):Je(e.every((n,r)=>ko(Wm(n,t[r]))))}function CB(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Je(!0):Je(e.some((n,r)=>!ko(Wm(n,t[r]))))}function Wm(e,t){const n=e.value?.valueOf(),r=t.value?.valueOf();return typeof n=="number"&&typeof r=="number"?Je(Math.abs(n-r)<1e-8):Ii(n)&&Ii(r)?Je(gk(n,r)):Je(typeof n=="object"&&typeof r=="object"?fS(e,t):n===r)}function dk(e,t){return e.length===0&&t.length===0?Je(!0):e.length!==t.length?Je(!1):(e.sort(IT),t.sort(IT),Je(e.every((n,r)=>ko(EB(n,t[r])))))}function EB(e,t){const{type:n,value:r}=e,{type:i,value:s}=t,c=r?.valueOf(),u=s?.valueOf();return typeof c=="number"&&typeof u=="number"?Je(Math.abs(c-u)<.01):Ii(c)&&Ii(u)?Je(gk(c,u)):Je(n==="Coding"&&i==="Coding"?typeof c!="object"||typeof u!="object"?!1:c.code===u.code&&c.system===u.system:typeof c=="object"&&typeof u=="object"?fS({...c,id:void 0},{...u,id:void 0}):typeof c=="string"&&typeof u=="string"?c.toLowerCase()===u.toLowerCase():c===u)}function IT(e,t){const n=e.value?.valueOf(),r=t.value?.valueOf();return typeof n=="number"&&typeof r=="number"?n-r:typeof n=="string"&&typeof r=="string"?n.localeCompare(r):0}function fk(e,t){const{value:n}=e;if(n==null)return!1;let r=t;switch(r.startsWith("System.")&&(r=r.substring(7)),r.startsWith("FHIR.")&&(r=r.substring(5)),r){case"Boolean":return typeof n=="boolean";case"Decimal":case"Integer":return typeof n=="number";case"Date":return hk(n);case"DateTime":return qd(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return pk(n);case"Quantity":return Ii(n);default:return e.type===r||typeof n=="object"&&n?.resourceType===r}}function hk(e){return typeof e=="string"&&!!lk.date.exec(e)}function qd(e){return typeof e=="string"&&!!lk.dateTime.exec(e)}function pk(e){return!!(e&&typeof e=="object"&&("start"in e&&qd(e.start)||"end"in e&&qd(e.end)))}function mk(e){if(e){if(hk(e)||qd(e))return{start:cp(e,"0000-01-01T00:00:00.000"),end:cp(e,"xxxx-12-31T23:59:59.999")};if(pk(e))return{start:e.start?cp(e.start,"0000-01-01T00:00:00.000"):void 0,end:e.end?cp(e.end,"xxxx-12-31T23:59:59.999"):void 0}}}function cp(e,t){let n="Z";const r=Math.max(e.indexOf("+",10),e.indexOf("-",10));r>-1?(n=e.substring(r),e=e.substring(0,r)):e.endsWith("Z")&&(e=e.substring(0,e.length-1));const i=e+t.substring(e.length)+n;return new Date(i).toISOString()}function Ii(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function gk(e,t){return Math.abs(e.value-t.value)<.01&&(e.unit===t.unit||e.code===t.code||e.unit===t.code||e.code===t.unit)}function fS(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const s=e[i],c=t[i];if(zT(s)&&zT(c)){if(!fS(s,c))return!1}else if(s!==c)return!1}return!0}function zT(e){return e!==null&&typeof e=="object"}function nx(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return TB(e??{},t)}return e}function TB(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function vk(e,t){return Oa(e,t)&&"id"in e&&typeof e.id=="string"}function nn(e){const t=$t(e)??"undefined/undefined",n=Ea(e);return n===t?{reference:t}:{reference:t,display:n}}function $t(e){if(Ma(e))return e.reference;if(vk(e))return`${e.resourceType}/${e.id}`}function bs(e){if(e)return Ma(e)?e.reference.split("/")[1]:e.id}function RB(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function Ea(e){if(RB(e)){const t=_B(e);if(t)return t}if(e.resourceType==="Device"){const t=DB(e);if(t)return t}if(e.resourceType==="MedicationRequest"&&e.medicationCodeableConcept)return Ss(e.medicationCodeableConcept);if(e.resourceType==="Subscription"&&e.criteria)return e.criteria;if(e.resourceType==="User"&&e.email)return e.email;if("name"in e&&e.name&&typeof e.name=="string")return e.name;if("code"in e&&e.code){let t=e.code;if(Array.isArray(t)&&(t=t[0]),Sk(t))return Ss(t);if($B(t))return t.text}return $t(e)??""}function _B(e){const t=e.name;if(t&&t.length>0)return Na(t[0])}function DB(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function AB(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const n of t){const r=$T(n);if(r)return r}else return $T(t)}function $T(e){if(e.url&&e.contentType?.startsWith("image/"))return e.url}function yk(e,t){const n=new Date(e);n.setUTCHours(0,0,0,0);const r=t?new Date(t):new Date;r.setUTCHours(0,0,0,0);const i=n.getUTCFullYear(),s=n.getUTCMonth(),c=n.getUTCDate(),u=r.getUTCFullYear(),f=r.getUTCMonth(),h=r.getUTCDate();let m=u-i;(f<s||f===s&&h<c)&&m--;let g=u*12+f-(i*12+s);h<c&&g--;const y=Math.floor((r.getTime()-n.getTime())/(1e3*60*60*24));return{years:m,months:g,days:y}}function kB(e,t){const{years:n,months:r,days:i}=yk(e,t);return n>=2?n.toString().padStart(3,"0")+"Y":r>=1?r.toString().padStart(3,"0")+"M":i.toString().padStart(3,"0")+"D"}function po(e,...t){let n=e;for(let r=0;r<t.length&&n;r++)n=n?.extension?.find(i=>i.url===t[r]);return n}function fo(e,t){const n=hS(e);return JSON.stringify(n,null,t?2:void 0)??""}function hS(e){if(!(e==null||e===""))return typeof e=="object"?Array.isArray(e)?PB(e):NB(e):e}function PB(e){const t=e.length;if(t===0)return;let n,r=0;for(let i=0;i<t;i++){const s=e[i],c=hS(s);c!==s&&!n&&(n=Array.from(e)),c===void 0?n&&(n[i]=null):(n&&(n[i]=c),r++)}if(r!==0)return n??e}function NB(e){let t,n=0;for(const r in e){const i=e[r],s=hS(i);s!==i&&!t&&(t={...e}),s===void 0?t&&delete t[r]:(t&&(t[r]=s),n++)}if(n!==0)return t??e}function kn(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!In(e):!1}function In(e){if(e==null)return!1;const t=typeof e;return t==="string"&&e!==""||t==="object"&&("length"in e&&e.length>0||Object.keys(e).length>0)}function OB(e){if(!e)return;let t=e.length-1;for(;t>=0&&kn(e[t]);)t--;return t>=0?e.slice(0,t+1):void 0}function $i(e,t,n){return e===t||kn(e)&&kn(t)?!0:kn(e)||kn(t)?!1:Array.isArray(e)&&Array.isArray(t)?MB(e,t):Array.isArray(e)||Array.isArray(t)?!1:mr(e)&&mr(t)?LB(e,t,n):(mr(e)||mr(t),!1)}function MB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!$i(e[n],t[n]))return!1;return!0}function LB(e,t,n){const r=new Set;for(const i of Object.keys(e))r.add(i);for(const i of Object.keys(t))r.add(i);n==="meta"&&(r.delete("versionId"),r.delete("lastUpdated"),r.delete("author"));for(const i of r){const s=e[i],c=t[i];if(!$i(s,c,i))return!1}return!0}function pS(e,t){return kn(e)?!0:kn(t)?!1:Array.isArray(e)&&Array.isArray(t)?IB(e,t):Array.isArray(e)||Array.isArray(t)?!1:mr(e)&&mr(t)?zB(e,t):mr(e)||mr(t)?!1:e===t}function IB(e,t){return t.every(n=>e.some(r=>pS(r,n)))}function zB(e,t){return Object.entries(t).every(([n,r])=>n in e&&pS(e[n],r))}function gi(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function mS(e){return/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i.test(e)}function mr(e){return e!==null&&typeof e=="object"}function xk(e){return typeof e=="string"}function bk(e){return mr(e)&&"code"in e&&typeof e.code=="string"}function Sk(e){return mr(e)&&"coding"in e&&Array.isArray(e.coding)&&e.coding.every(bk)}function $B(e){return mr(e)&&"text"in e&&typeof e.text=="string"}const jk=[];for(let e=0;e<256;e++)jk.push(e.toString(16).padStart(2,"0"));function UB(e){const t=wk(e),n=new Uint8Array(t),r=new Array(n.length);for(let i=0;i<n.length;i++)r[i]=jk[n[i]];return r.join("")}function BB(e){const t=wk(e),n=new Uint8Array(t),r=new Array(n.length);for(let i=0;i<n.length;i++)r[i]=String.fromCodePoint(n[i]);return window.btoa(r.join(""))}function wk(e){return ArrayBuffer.isView(e)?e.buffer:e}function Xn(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function gS(e){return e.length>0&&e.startsWith(e[0].toUpperCase())}function ml(e,t){const n=e+".";if(t.startsWith(n))return t.slice(n.length)}function VB(e,t){return e.coding?.find(n=>n.system===t)?.code}function FB(e){if(e!==void 0)return Array.isArray(e)?e:[e]}const UT=(e,t)=>new Promise((n,r)=>{t?.signal?.throwIfAborted();const i=setTimeout(n,e);t?.signal?.addEventListener("abort",()=>{clearTimeout(i),r(t.signal?.reason)},{once:!0})});function Yx(e,t,n){const r=[];for(let i=0;i<n-1;i++){const s=e.indexOf(t);if(s<0)break;r.push(e.slice(0,s)),e=e.slice(s+t.length)}return r.push(e),r}function HB(e){let t,n=!1;return function(){return n||(t=e(),n=!0),t}}function ul(e,t){return e?(e.push(t),e):[t]}function au(e){return e.sort((t,n)=>t.localeCompare(n))}function vS(e){return e.endsWith("/")?e:e+"/"}function qB(e){return e.startsWith("/")?e.slice(1):e}function Pi(e,t){return new URL(qB(t),vS(e.toString())).toString()}function GB(e,t){return Pi(e,t).toString().replace("http://","ws://").replace("https://","wss://")}function WB(e){return typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)&&(e=Object.fromEntries(Object.entries(e).filter(t=>t[1]!==void 0))),new URLSearchParams(e).toString()}function Ck(e,t){return e?.meta?.profile?.includes(t)||(e.meta=e.meta??{},e.meta.profile=e.meta.profile??[],e.meta.profile.push(t)),e}function QB(e,t){if(e?.meta?.profile?.includes(t)){const n=e.meta.profile.indexOf(t);e.meta.profile.splice(n,1)}return e}const Cr=Object.freeze([]);function El(e){if(!e)return"";switch(e.type){case"Address":return Ek(e.value);case"CodeableConcept":return Ss(e.value);case"Coding":return Rf(e.value);case"ContactPoint":return e.value.value;case"HumanName":return Na(e.value);case"Quantity":return gl(e.value);case"Reference":return YB(e.value);default:return e.value?.toString()??""}}function YB(e){return e?e.display??e.reference??fo(e):""}function Ek(e,t){if(!e)return"";const n=[];if(e.line&&n.push(...e.line),e.city||e.state||e.postalCode){const r=[];e.city&&r.push(e.city),e.state&&r.push(e.state),e.postalCode&&r.push(e.postalCode),n.push(r.join(", "))}return e.use&&t?.use,n.join(", ").trim()}function Na(e,t){if(!e)return"";const n=[];if(e.prefix&&t?.prefix!==!1&&n.push(...e.prefix),e.given&&n.push(...e.given),e.family&&n.push(e.family),e.suffix&&t?.suffix!==!1&&n.push(...e.suffix),e.use&&(t?.all||t?.use)&&n.push("["+e.use+"]"),n.length===0){const r=Wd(e.text);if(r)return r}return n.join(" ").trim()}function Qm(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Tk(e,t,n){if(!e)return"";const[r=0,i=0,s=0]=e.split(":").map(Number),c=new Date(Date.UTC(1970,0,1,r,i,s));return Qm(c)?new Intl.DateTimeFormat(t,{hour:"numeric",minute:"2-digit",second:s===0?void 0:"numeric",...n,timeZone:"UTC"}).format(c):""}function Nr(e,t,n){if(!e)return"";const r=new Date(e);return Qm(r)?r.toLocaleString(t,n):""}function KB(e,t,n){return!e||!e.start&&!e.end?"":Nr(e.start,t,n)+" - "+Nr(e.end,t,n)}const XB={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},JB={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},ZB={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function Rk(e){if(!e)return"";const t=[];return eV(t,e.repeat),e.event&&t.push(e.event.map(n=>Nr(n)).join(", ")),Xn(t.join(" ").trim())}function eV(e,t){if(!t?.periodUnit)return;const n=t.frequency??1,r=t.period??1,i=t.periodUnit;n===1&&r===1?e.push(XB[i]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+JB[i]):e.push("per "+r+" "+ZB[i])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(Xn).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(s=>Tk(s)).join(", "))}function Gd(e,t,n=!1){if(n&&t===void 0)throw new Error("Precision must be specified for exclusive ranges");const r=e?.low&&{...e.low,comparator:void 0},i=e?.high&&{...e.high,comparator:void 0};return r?.value===void 0&&i?.value===void 0?"":r?.value!==void 0&&i?.value===void 0?`>= ${gl(r)}`:r?.value===void 0&&i?.value!==void 0?`<= ${gl(i)}`:(r?.unit===i?.unit&&delete r?.unit,`${gl(r)} - ${gl(i)}`)}function gl(e,t){if(!e)return"";const n=[];return e.comparator&&(n.push(e.comparator),n.push(" ")),e.value!==void 0&&n.push(e.value),e.unit&&(e.unit!=="%"&&n.at(-1)!==" "&&n.push(" "),n.push(e.unit)),n.join("").trim()}function tV(e){return e?.value===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function Ss(e){if(!e)return"";const t=Wd(e.text);return t||(e.coding?e.coding.map(n=>Rf(n)).join(", "):"")}function Rf(e,t){const n=Wd(e?.display);return n?`${n}`:Wd(e?.code)??""}function _k(e){if(!e)return"";const t=[];if(e.valueQuantity)t.push(gl(e.valueQuantity));else if(e.valueCodeableConcept)t.push(Ss(e.valueCodeableConcept));else{const n=Wd(e.valueString);n&&t.push(n)}return"component"in e&&t.push(e.component.map(n=>_k(n)).join(" / ")),t.join(" / ").trim()}function Wd(e){return typeof e=="string"?e:void 0}const re={Address:"Address",Age:"Age",Annotation:"Annotation",Attachment:"Attachment",BackboneElement:"BackboneElement",CodeableConcept:"CodeableConcept",Coding:"Coding",ContactDetail:"ContactDetail",ContactPoint:"ContactPoint",Contributor:"Contributor",Count:"Count",DataRequirement:"DataRequirement",Distance:"Distance",Dosage:"Dosage",Duration:"Duration",Element:"Element",ElementDefinition:"ElementDefinition",Expression:"Expression",Extension:"Extension",HumanName:"HumanName",Identifier:"Identifier",MarketingStatus:"MarketingStatus",Meta:"Meta",Money:"Money",MoneyQuantity:"MoneyQuantity",Narrative:"Narrative",ParameterDefinition:"ParameterDefinition",Period:"Period",Population:"Population",ProdCharacteristic:"ProdCharacteristic",ProductShelfLife:"ProductShelfLife",Quantity:"Quantity",Range:"Range",Ratio:"Ratio",Reference:"Reference",RelatedArtifact:"RelatedArtifact",SampledData:"SampledData",Signature:"Signature",SimpleQuantity:"SimpleQuantity",SubstanceAmount:"SubstanceAmount",SystemString:"http://hl7.org/fhirpath/System.String",Timing:"Timing",TriggerDefinition:"TriggerDefinition",UsageContext:"UsageContext",base64Binary:"base64Binary",boolean:"boolean",canonical:"canonical",code:"code",date:"date",dateTime:"dateTime",decimal:"decimal",id:"id",instant:"instant",integer:"integer",markdown:"markdown",oid:"oid",positiveInt:"positiveInt",string:"string",time:"time",unsignedInt:"unsignedInt",uri:"uri",url:"url",uuid:"uuid",xhtml:"xhtml"};function nV(e){const t=Array.isArray(e)?e:e.entry?.map(n=>n.resource)??[];for(const n of t)n?.resourceType==="StructureDefinition"&&n.kind==="resource"&&Dk(n.type)}function Dk(e){let t=$o.types[e];return t||(t={searchParamsDetails:{}},$o.types[e]=t),!t.searchParams&&e!=="Binary"&&(t.searchParams={_id:{base:[e],code:"_id",type:"token",expression:e+".id"},_lastUpdated:{base:[e],code:"_lastUpdated",type:"date",expression:e+".meta.lastUpdated"},_compartment:{base:[e],code:"_compartment",type:"reference",expression:e+".meta.compartment"},_profile:{base:[e],code:"_profile",type:"uri",expression:e+".meta.profile"},_security:{base:[e],code:"_security",type:"token",expression:e+".meta.security"},_source:{base:[e],code:"_source",type:"uri",expression:e+".meta.source"},_tag:{base:[e],code:"_tag",type:"token",expression:e+".meta.tag"}}),t}function rV(e){for(const t of e.base??Cr){const n=Dk(t);n.searchParams||(n.searchParams={}),n.searchParams[e.code]=e}}function BT(e){const t=e.type?.[0]?.code;return t==="BackboneElement"||t==="Element"?iV((e.base?.path??e.path)?.split(".")):t}function iV(e){return e.length===1?e[0]:e.map(Xn).join("")}function yS(e){return $o.types[e]?.searchParams}function oV(e,t){return $o.types[e]?.searchParams?.[t]}function Tl(e){const t=e.replaceAll("[x]","").split(".").pop();return Ak(t)}function Ak(e){let t;return e.length<100?t=e.match(/[A-Z]+(?![a-z])|[A-Z]?[a-z]+|\d+/g)??[]:t=e.split(/(?=[A-Z])/),t.map(sV).join(" ").replace("_"," ").replaceAll(/\s+/g," ")}const aV=new Set(["CDS","ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function sV(e){const t=e.toUpperCase();return e===t?e:aV.has(t)?t:t.charAt(0)+e.slice(1)}function Ps(e,t,n){const r=Gm(e,n);if(r)return lV(r.elements,t)}function lV(e,t){const n=e[t]??e[t+"[x]"];if(n)return n;for(let r=0;r<t.length;r++){const i=t[r];if(i>="A"&&i<="Z"){const s=t.slice(0,r)+"[x]",c=e[s];if(c)return c}}}function Oa(e,t){return!(!e||typeof e!="object"||!("resourceType"in e)||t&&e.resourceType!==t)}function Ma(e,t){return!!(e&&typeof e=="object"&&"reference"in e&&typeof e.reference=="string")}const $o={types:{}};function Ep(e){if(e.startsWith("T"))return e+"T00:00:00.000Z".substring(e.length);if(e.length<=10)return e;try{return new Date(e).toISOString()}catch{return e}}const pa=()=>[],Xr={empty:(e,t)=>Je(t.every(n=>kn(n.value))),hasValue:(e,t)=>Je(t.length!==0),exists:(e,t,n)=>Je(n?t.some(r=>ko(n.eval(e,[r]))):t.length>0&&t.every(r=>!kn(r.value))),all:(e,t,n)=>Je(t.every(r=>ko(n.eval(e,[r])))),allTrue:(e,t)=>{for(const n of t)if(!n.value)return Je(!1);return Je(!0)},anyTrue:(e,t)=>{for(const n of t)if(n.value)return Je(!0);return Je(!1)},allFalse:(e,t)=>{for(const n of t)if(n.value)return Je(!1);return Je(!0)},anyFalse:(e,t)=>{for(const n of t)if(!n.value)return Je(!0);return Je(!1)},subsetOf:(e,t,n)=>{if(t.length===0)return Je(!0);const r=n.eval(e,rl(e));return r.length===0?Je(!1):Je(t.every(i=>r.some(s=>s.value===i.value)))},supersetOf:(e,t,n)=>{const r=n.eval(e,rl(e));return r.length===0?Je(!0):t.length===0?Je(!1):Je(r.every(i=>t.some(s=>s.value===i.value)))},count:(e,t)=>[{type:re.integer,value:t.length}],distinct:(e,t)=>{const n=[];for(const r of t)n.some(i=>i.value===r.value)||n.push(r);return n},isDistinct:(e,t)=>Je(t.length===Xr.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>ko(n.eval(e,[r]))),select:(e,t,n)=>t.flatMap(r=>n.eval({parent:e,variables:{$this:r}},[r])),repeat:pa,ofType:(e,t,n)=>t.filter(r=>r.type===n.name),single:(e,t)=>{if(t.length>1)throw new Error("Expected input length one for single()");return t.length===0?[]:t.slice(0,1)},first:(e,t)=>t.length===0?[]:t.slice(0,1),last:(e,t)=>t.length===0?[]:t.slice(-1,t.length),tail:(e,t)=>t.length===0?[]:t.slice(1,t.length),skip:(e,t,n)=>{const r=n.eval(e,t)[0]?.value;if(typeof r!="number")throw new TypeError("Expected a number for skip(num)");return r>=t.length?[]:r<=0?t:t.slice(r,t.length)},take:(e,t,n)=>{const r=n.eval(e,t)[0]?.value;if(typeof r!="number")throw new TypeError("Expected a number for take(num)");return r>=t.length?t:r<=0?[]:t.slice(0,r)},intersect:(e,t,n)=>{if(!n)return t;const r=n.eval(e,rl(e)),i=[];for(const s of t)!i.some(c=>c.value===s.value)&&r.some(c=>c.value===s.value)&&i.push(s);return i},exclude:(e,t,n)=>{if(!n)return t;const r=n.eval(e,rl(e)),i=[];for(const s of t)r.some(c=>c.value===s.value)||i.push(s);return i},union:(e,t,n)=>{if(!n)return t;const r=n.eval(e,rl(e));return uk([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,rl(e));return[...t,...r]},htmlChecks:(e,t,n)=>[mi(!0)],iif:(e,t,n,r,i)=>{const s=n.eval(e,t);if(s.length>1||s.length===1&&typeof s[0].value!="boolean")throw new Error("Expected criterion to evaluate to a Boolean");return ko(s)?r.eval(e,t):i?i.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);if(typeof n=="boolean")return[{type:re.boolean,value:n}];if(typeof n=="number"&&(n===0||n===1))return Je(!!n);if(typeof n=="string"){const r=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(r))return Je(!0);if(["false","f","no","n","0","0.0"].includes(r))return Je(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:Je(Xr.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);return typeof n=="number"?[{type:re.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:re.integer,value:Number.parseInt(n,10)}]:typeof n=="boolean"?[{type:re.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:Je(Xr.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:re.date,value:Ep(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:Je(Xr.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:re.dateTime,value:Ep(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:Je(Xr.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);return typeof n=="number"?[{type:re.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:re.decimal,value:Number.parseFloat(n)}]:typeof n=="boolean"?[{type:re.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:Je(Xr.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);return Ii(n)?[{type:re.Quantity,value:n}]:typeof n=="number"?[{type:re.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:re.Quantity,value:{value:Number.parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:re.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:Je(Xr.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);return n==null?[]:Ii(n)?[{type:re.string,value:`${n.value} '${n.unit}'`}]:[{type:re.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:Je(Xr.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=To(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:re.time,value:Ep("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:Je(Xr.toTime(e,t).length===1),indexOf:(e,t,n)=>Ai((r,i)=>r.indexOf(i),e,t,n),substring:(e,t,n,r)=>Ai((i,s,c)=>{const u=s,f=c?u+c:i.length;return u<0||u>=i.length?void 0:i.substring(u,f)},e,t,n,r),startsWith:(e,t,n)=>Ai((r,i)=>r.startsWith(i),e,t,n),endsWith:(e,t,n)=>Ai((r,i)=>r.endsWith(i),e,t,n),contains:(e,t,n)=>Ai((r,i)=>r.includes(i),e,t,n),upper:(e,t)=>Ai(n=>n.toUpperCase(),e,t),lower:(e,t)=>Ai(n=>n.toLowerCase(),e,t),replace:(e,t,n,r)=>Ai((i,s,c)=>i.replaceAll(s,c),e,t,n,r),matches:(e,t,n)=>Ai((r,i)=>!!new RegExp(i).exec(r),e,t,n),replaceMatches:(e,t,n,r)=>Ai((i,s,c)=>i.replaceAll(new RegExp(s,"g"),c.replaceAll(/\$\{(\w+)\}/g,"$<$1>")),e,t,n,r),length:(e,t)=>Ai(n=>n.length,e,t),toChars:(e,t)=>Ai(n=>n?n.split(""):void 0,e,t),encode:pa,decode:pa,escape:pa,unescape:pa,trim:pa,split:pa,join:(e,t,n)=>{const r=n?.eval(e,rl(e))[0]?.value??"";if(typeof r!="string")throw new TypeError("Separator must be a string.");return[{type:re.string,value:t.map(i=>i.value?.toString()??"").join(r)}]},abs:(e,t)=>wo(Math.abs,e,t),ceiling:(e,t)=>wo(Math.ceil,e,t),exp:(e,t)=>wo(Math.exp,e,t),floor:(e,t)=>wo(Math.floor,e,t),ln:(e,t)=>wo(Math.log,e,t),log:(e,t,n)=>wo((r,i)=>Math.log(r)/Math.log(i),e,t,n),power:(e,t,n)=>wo(Math.pow,e,t,n),round:(e,t,...n)=>wo((r,i=0)=>{if(typeof i!="number"||i<0)throw new Error("Invalid precision provided to round()");const s=Math.pow(10,i);return Math.round(r*s)/s},e,t,...n),sqrt:(e,t)=>wo(Math.sqrt,e,t),truncate:(e,t)=>wo(n=>Math.trunc(n),e,t),children:pa,descendants:pa,trace:(e,t,n)=>t,now:()=>[{type:re.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:re.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:re.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,i)=>{const s=Xr.toDateTime(e,n.eval(e,t));if(s.length===0)throw new Error("Invalid start date");const c=Xr.toDateTime(e,r.eval(e,t));if(c.length===0)throw new Error("Invalid end date");const u=i.eval(e,t)[0]?.value;if(u!=="years"&&u!=="months"&&u!=="days")throw new Error("Invalid units");const f=yk(s[0].value,c[0].value);return[{type:re.Quantity,value:{value:f[u],unit:u}}]},is:(e,t,n)=>{let r="";return n instanceof Qd?r=n.name:n instanceof Ym&&(r=n.left.name+"."+n.right.name),r?t.map(i=>({type:re.boolean,value:fk(i,r)})):[]},not:(e,t)=>Xr.toBoolean(e,t).map(n=>({type:re.boolean,value:!n.value})),resolve:(e,t)=>t.map(n=>{const r=n.value;let i;if(typeof r=="string")i=r;else if(typeof r=="object"){const s=r;if(s.resource)return mi(s.resource);s.reference?i=s.reference:s.type&&s.identifier&&(i=`${s.type}?identifier=${s.identifier.system}|${s.identifier.value}`)}if(i?.includes("?")){const[s]=i.split("?");return{type:s,value:{resourceType:s}}}if(i?.includes("/")){const[s,c]=i.split("/");return{type:s,value:{resourceType:s,id:c}}}return{type:re.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:re.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:re.BackboneElement,value:{namespace:"System",name:"Integer"}}:Oa(n)?{type:re.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:re.BackboneElement,value:null}),conformsTo:(e,t,n)=>{const r=n.eval(e,t)[0].value;if(!r.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const i=r.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map(s=>({type:re.boolean,value:s.value?.resourceType===i}))},getResourceKey:(e,t)=>{const n=t[0].value;return n?.id?[{type:re.id,value:n.id}]:[]},getReferenceKey:(e,t,n)=>{const r=t[0].value;if(!r?.reference)return[];let i="";return n instanceof Qd&&(i=n.name),i&&!r.reference.startsWith(i+"/")?[]:[{type:re.id,value:bs(r)}]},extension:(e,t,n)=>{const r=n.eval(e,t)[0].value,i=t?.[0]?.value;if(i){const s=po(i,r);if(s)return[{type:re.Extension,value:s}]}return[]}};function Ai(e,t,n,...r){if(n.length===0)return[];const[{value:i}]=To(n,1);if(typeof i!="string")throw new TypeError("String function cannot be called with non-string");const s=r.map(u=>u?.eval(t,n)[0]?.value),c=e(i,...s);return c===void 0?[]:Array.isArray(c)?c.map(mi):[mi(c)]}function wo(e,t,n,...r){if(n.length===0)return[];const[{value:i}]=To(n,1),s=Ii(i),c=s?i.value:i;if(typeof c!="number")throw new TypeError("Math function cannot be called with non-number");const u=e(c,...r.map(m=>m.eval(t,n)[0]?.value)),f=s?re.Quantity:n[0].type,h=s?{...i,value:u}:u;return[{type:f,value:h}]}function To(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const n of e)if(n==null)throw new Error("Expected non-null argument");return e}function rl(e){let t=e;for(;t.parent?.variables.$this;)t=t.parent;return[t.variables.$this]}class xS{original;child;constructor(t,n){this.original=t,this.child=n}eval(t,n){try{if(n.length>0){const r=[];for(const i of n)r.push(this.child.eval({parent:t,variables:{$this:i}},[i]));return r.flat()}else return this.child.eval(t,[])}catch(r){throw new Error(`FhirPathError on "${this.original}": ${r}`,{cause:r})}}toString(){return this.child.toString()}}class zc{value;constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class Qd{name;constructor(t){this.name=t}eval(t,n){if(this.name==="$this")return n;const r=this.getVariable(t);if(r)return[r];if(this.name.startsWith("%"))throw new Error(`Undefined variable ${this.name}`);return n.flatMap(i=>this.evalValue(i)).filter(i=>i?.value!==void 0)}getVariable(t){const n=t.variables[this.name];if(n!==void 0)return n;if(t.parent)return this.getVariable(t.parent)}evalValue(t){const n=t.value;if(!(!n||typeof n!="object"))return Oa(n,this.name)?t:sk(t,this.name)}toString(){return this.name}}class cV{eval(){return[]}toString(){return"{}"}}class uV extends H8{impl;constructor(t,n,r){super(t,n),this.impl=r}eval(t,n){return this.impl(this.child.eval(t,n))}toString(){return this.operator+this.child.toString()}}class Hp extends wf{constructor(t,n){super("as",t,n)}eval(t,n){return Xr.ofType(t,this.left.eval(t,n),this.right)}}class ri extends wf{}class to extends ri{impl;constructor(t,n,r,i){super(t,n,r),this.impl=i}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const i=this.right.eval(t,n);if(i.length!==1)return[];const s=r[0].value,c=i[0].value,u=Ii(s)?s.value:s,f=Ii(c)?c.value:c,h=this.impl(u,f);return typeof h=="boolean"?Je(h):Ii(s)?[{type:re.Quantity,value:{...s,value:h}}]:[mi(h)]}}class dV extends wf{constructor(t,n){super("&",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n),s=[...r,...i];return s.length>0&&s.every(c=>typeof c.value=="string")?[{type:re.string,value:s.map(c=>c.value).join("")}]:s}}class fV extends ri{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n);return Je(r.some(s=>s.value===i[0].value))}}class hV extends ri{constructor(t,n){super("in",t,n)}eval(t,n){const r=Ca(this.left.eval(t,n)),i=this.right.eval(t,n);return r?Je(i.some(s=>Wm(r,s)[0].value)):[]}}class Ym extends wf{constructor(t,n){super(".",t,n)}eval(t,n){return this.right.eval(t,this.left.eval(t,n))}toString(){return`${this.left.toString()}.${this.right.toString()}`}}class bS extends wf{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n);return uk([...r,...i])}}class pV extends ri{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n);return wB(r,i)}}class mV extends ri{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n);return CB(r,i)}}class gV extends ri{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n);return dk(r,i)}}class vV extends ri{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),i=this.right.eval(t,n);return jB(dk(r,i))}}class SS extends ri{constructor(t,n){super("is",t,n)}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const i=this.right.name;return Je(fk(r[0],i))}}class yV extends ri{constructor(t,n){super("and",t,n)}eval(t,n){const r=Ca(this.left.eval(t,n),"boolean"),i=Ca(this.right.eval(t,n),"boolean");return r?.value===!0&&i?.value===!0?Je(!0):r?.value===!1||i?.value===!1?Je(!1):[]}}class xV extends ri{constructor(t,n){super("or",t,n)}eval(t,n){const r=Ca(this.left.eval(t,n),"boolean"),i=Ca(this.right.eval(t,n),"boolean");return r?.value===!1&&i?.value===!1?Je(!1):r?.value||i?.value?Je(!0):[]}}class bV extends ri{constructor(t,n){super("xor",t,n)}eval(t,n){const r=Ca(this.left.eval(t,n),"boolean"),i=Ca(this.right.eval(t,n),"boolean");return!r||!i?[]:Je(r.value!==i.value)}}class SV extends ri{constructor(t,n){super("implies",t,n)}eval(t,n){const r=Ca(this.left.eval(t,n),"boolean"),i=Ca(this.right.eval(t,n),"boolean");return i?.value===!0||r?.value===!1?Je(!0):!r||!i?[]:Je(!1)}}class jS{name;args;constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=Xr[this.name];if(!r)throw new Error("Unrecognized function: "+this.name);return r(t,n,...this.args)}toString(){return`${this.name}(${this.args.map(t=>t.toString()).join(", ")})`}}class wS{left;expr;constructor(t,n){this.left=t,this.expr=n}eval(t,n){const r=this.expr.eval(t,n);if(r.length!==1)return[];const i=r[0].value;if(typeof i!="number")throw new Error("Invalid indexer expression: should return integer}");const s=this.left.eval(t,n);return i in s?[s[i]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const jV=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"],wV={"'":"'",'"':'"',"`":"`",r:"\r",n:`
54
+ `,t:" ",f:"\f","\\":"\\"};class CV{str;keywords;operators;dateTimeLiterals;symbolRegex;result=[];pos={index:0,line:1,column:0};markStack=[];constructor(t,n,r,i){this.str=t,this.keywords=n,this.operators=r,this.dateTimeLiterals=!!i?.dateTimeLiterals,this.symbolRegex=i?.symbolRegex??/[$\w%]/}tokenize(){for(;this.pos.index<this.str.length;){const t=this.consumeToken();t&&this.result.push(t)}return this.result}prevToken(){return this.result.slice(-1)[0]}peekToken(){this.mark();const t=this.consumeToken();return this.reset(),t}consumeToken(){this.consumeWhitespace();const t=this.curr();if(!t)return;this.mark();const n=this.peek();return t==="/"&&n==="*"?this.consumeMultiLineComment():t==="/"&&n==="/"?this.consumeSingleLineComment():t==="'"||t==='"'||t==="`"?this.consumeString(t):t==="@"?this.consumeDateTime():/\d/.exec(t)?this.consumeNumber():/\w/.exec(t)?this.consumeSymbol():(t==="$"||t==="%")&&/\w/.exec(n)?this.consumeSymbol():(t==="$"||t==="%")&&(n==="'"||n==='"'||n==="`")?this.consumeQuotedSymbol(n):this.consumeOperator()}consumeWhitespace(){this.consumeWhile(()=>/\s/.exec(this.curr()))}consumeMultiLineComment(){const t=this.pos.index;return this.consumeWhile(()=>this.curr()!=="*"||this.peek()!=="/"),this.advance(),this.advance(),this.buildToken("Comment",this.str.substring(t,this.pos.index))}consumeSingleLineComment(){return this.buildToken("Comment",this.consumeWhile(()=>this.curr()!==`
55
+ `))}consumeString(t){this.advance();let n="",r;for(;r=this.consumeChar(t);)n+=r;const i=this.buildToken(t==="`"?"Symbol":"String",n);return this.advance(),i}consumeChar(t){const n=this.curr();if(n==="\\"){this.advance();const r=this.curr(),i=wV[r];if(i!==void 0)return this.advance(),i;if(r==="u"){this.advance();const s=/^[0-9a-fA-F]{4}$/.exec(this.str.substring(this.pos.index,this.pos.index+4))?.[0];return s?(this.advance(),this.advance(),this.advance(),this.advance(),String.fromCodePoint(Number.parseInt(s,16))):"u"}return this.consumeChar(t)}return n===t||!n?"":(this.advance(),n)}consumeQuotedSymbol(t){this.mark();const n=this.pos.index;this.advance(),this.consumeString(t);const r=this.str.substring(n,this.pos.index);return this.buildToken("Symbol",r)}consumeDateTime(){this.advance();const t=this.pos.index;this.consumeWhile(()=>/[\d-]/.exec(this.curr()));let n=!1,r=!1;if(this.curr()==="T"&&(n=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="Z"?(r=!0,this.advance()):(this.curr()==="+"||this.curr()==="-")&&(r=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())))),this.pos.index===t)throw new Error("Invalid DateTime literal");let i=this.str.substring(t,this.pos.index);return i.endsWith("T")?i=i.substring(0,i.length-1):!i.startsWith("T")&&n&&!r&&(i+="Z"),this.buildToken("DateTime",i)}consumeNumber(){const t=this.pos.index;let n="Number";return this.consumeWhile(()=>/\d/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="-"&&this.dateTimeLiterals?(this.pos.index=t-1,this.consumeDateTime()):(this.curr()===" "&&EV(this.peekToken())&&(n="Quantity",this.consumeToken()),this.buildToken(n,this.str.substring(t,this.pos.index)))}consumeSymbol(){const t=this.consumeWhile(()=>this.symbolRegex.exec(this.curr()));return this.prevToken()?.value!=="."&&this.keywords.includes(t)?this.buildToken(t,t):this.buildToken("Symbol",t)}consumeOperator(){const t=this.curr(),n=this.peek(),r=t+n;return this.operators.includes(r)?(this.advance(),this.advance(),this.buildToken(r,r)):(this.advance(),this.buildToken(t,t))}consumeWhile(t){const n=this.pos.index;for(;this.pos.index<this.str.length&&t();)this.advance();return this.str.substring(n,this.pos.index)}curr(){return this.str[this.pos.index]}peek(){return this.str[this.pos.index+1]??""}mark(){this.markStack.push({...this.pos})}reset(){const t=this.markStack.pop();if(!t)throw new Error("No mark to reset to");this.pos.index=t.index,this.pos.line=t.line,this.pos.column=t.column}advance(){this.pos.index++,this.curr()===`
56
+ `?(this.pos.line++,this.pos.column=0):this.pos.column++}buildToken(t,n){const r=this.markStack.pop();if(!r)throw new Error("No mark for token");return{id:t,value:n,...r}}}function EV(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&jV.includes(e.value)))}const TV=["true","false"],RV=["!=","!~","<=",">=","{}","->"];function _V(e){return new CV(e,TV,RV).tokenize()}const en={FunctionCall:0,Dot:1,Indexer:2,UnaryAdd:3,UnarySubtract:3,Multiply:4,Divide:4,Modulo:4,Add:5,Subtract:5,Ampersand:5,Is:6,As:6,Union:7,GreaterThan:8,GreaterThanOrEquals:8,LessThan:8,LessThanOrEquals:8,Equals:9,Equivalent:9,NotEquals:9,NotEquivalent:9,In:10,Contains:10,And:11,Xor:12,Or:12,Implies:13},DV={parse(e){const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+e.peek()?.value+"`");return t}},AV={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new wS(t,n)},precedence:en.Indexer},kV={parse(e,t){if(!(t instanceof Qd))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new jS(t.name,n)},precedence:en.FunctionCall};function PV(e){const t=e.split(" "),n=Number.parseFloat(t[0]);let r=t[1];return r?.startsWith("'")&&r.endsWith("'")?r=r.substring(1,r.length-1):r="{"+r+"}",{value:n,unit:r}}function NV(){return new q8().registerPrefix("String",{parse:(e,t)=>new zc({type:re.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new zc({type:re.dateTime,value:Ep(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new zc({type:re.Quantity,value:PV(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new zc({type:t.value.includes(".")?re.decimal:re.integer,value:Number.parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new zc({type:re.boolean,value:!0})}).registerPrefix("false",{parse:()=>new zc({type:re.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new Qd(t.value)}).registerPrefix("{}",{parse:()=>new cV}).registerPrefix("(",DV).registerInfix("[",AV).registerInfix("(",kV).prefix("+",en.UnaryAdd,(e,t)=>new uV("+",t,n=>n)).prefix("-",en.UnarySubtract,(e,t)=>new to("-",t,t,(n,r)=>-r)).infixLeft(".",en.Dot,(e,t,n)=>new Ym(e,n)).infixLeft("/",en.Divide,(e,t,n)=>new to("/",e,n,(r,i)=>r/i)).infixLeft("*",en.Multiply,(e,t,n)=>new to("*",e,n,(r,i)=>r*i)).infixLeft("+",en.Add,(e,t,n)=>new to("+",e,n,(r,i)=>r+i)).infixLeft("-",en.Subtract,(e,t,n)=>new to("-",e,n,(r,i)=>r-i)).infixLeft("|",en.Union,(e,t,n)=>new bS(e,n)).infixLeft("=",en.Equals,(e,t,n)=>new pV(e,n)).infixLeft("!=",en.NotEquals,(e,t,n)=>new mV(e,n)).infixLeft("~",en.Equivalent,(e,t,n)=>new gV(e,n)).infixLeft("!~",en.NotEquivalent,(e,t,n)=>new vV(e,n)).infixLeft("<",en.LessThan,(e,t,n)=>new to("<",e,n,(r,i)=>r<i)).infixLeft("<=",en.LessThanOrEquals,(e,t,n)=>new to("<=",e,n,(r,i)=>r<=i)).infixLeft(">",en.GreaterThan,(e,t,n)=>new to(">",e,n,(r,i)=>r>i)).infixLeft(">=",en.GreaterThanOrEquals,(e,t,n)=>new to(">=",e,n,(r,i)=>r>=i)).infixLeft("&",en.Ampersand,(e,t,n)=>new dV(e,n)).infixLeft("and",en.And,(e,t,n)=>new yV(e,n)).infixLeft("as",en.As,(e,t,n)=>new Hp(e,n)).infixLeft("contains",en.Contains,(e,t,n)=>new fV(e,n)).infixLeft("div",en.Divide,(e,t,n)=>new to("div",e,n,(r,i)=>Math.trunc(r/i))).infixLeft("in",en.In,(e,t,n)=>new hV(e,n)).infixLeft("is",en.Is,(e,t,n)=>new SS(e,n)).infixLeft("mod",en.Modulo,(e,t,n)=>new to("mod",e,n,(r,i)=>r%i)).infixLeft("or",en.Or,(e,t,n)=>new xV(e,n)).infixLeft("xor",en.Xor,(e,t,n)=>new bV(e,n)).infixLeft("implies",en.Implies,(e,t,n)=>new SV(e,n))}const OV=NV();function CS(e){return new xS(e,OV.construct(_V(e)).consumeAndParse())}function MV(e,t){const n=Array.isArray(t)?t:[t];for(let r=0;r<n.length;r++){const i=n[r];typeof i=="object"&&"type"in i&&"value"in i||(n[r]=mi(n[r]))}return js(e,n).map(r=>r.value)}function js(e,t,n={},r=void 0){let i;if(typeof e=="string"){const s=r?.get(e);i=s??CS(e),r&&!s&&r.set(e,i)}else i=e;return i.eval({variables:n},t).map(s=>{const c={type:s.type,value:s.value?.valueOf()};return"path"in s&&(c.path=s.path),c})}function LV(e){const t=[];for(const n of e){const r=mk(n.value);r&&t.push(r)}return t}function IV(e){const t=new Set;for(const n of e){const r=El(n);r&&t.add(r)}return Array.from(t)}function zV(e){const t=new Set;for(const n of e){const{value:r}=n;r&&(xk(r)?t.add(r):Ma(r)?t.add(r.reference):vk(r)?t.add($t(r)):typeof r.identifier=="object"&&t.add(`identifier:${r.identifier.system}|${r.identifier.value}`))}return Array.from(t)}function $V(e,t={}){const n=[];for(const r of e)UV(t,n,r);return n}function UV(e,t,n){const{type:r,value:i}=n;switch(r){case re.Identifier:BV(t,e,i);break;case re.CodeableConcept:VV(t,e,i);break;case re.Coding:kk(t,e,i);break;case re.ContactPoint:FV(t,e,i);break;default:Rl(t,e,void 0,i?.toString())}}function BV(e,t,n){n?.type?.text&&Rl(e,t,t.textSearchSystem,n.type.text),Rl(e,t,n?.system,n?.value)}function VV(e,t,n){n?.text&&Rl(e,t,t.textSearchSystem,n.text);for(const r of n?.coding??Cr)kk(e,t,r)}function kk(e,t,n){n&&(n.display&&Rl(e,t,t.textSearchSystem,n.display),Rl(e,t,n.system,n.code))}function FV(e,t,n){n&&Rl(e,t,n.system,n.value?.toLocaleLowerCase())}function Rl(e,t,n,r){(n||r)&&!e.some(i=>i.system===n&&i.value===r)&&e.push({system:n,value:r&&t.caseInsensitive?r.toLocaleLowerCase():r})}const Km=20,fe={EQUALS:"eq",NOT_EQUALS:"ne",GREATER_THAN:"gt",LESS_THAN:"lt",GREATER_THAN_OR_EQUALS:"ge",LESS_THAN_OR_EQUALS:"le",STARTS_AFTER:"sa",ENDS_BEFORE:"eb",APPROXIMATELY:"ap",CONTAINS:"contains",STARTS_WITH:"sw",EXACT:"exact",TEXT:"text",NOT:"not",ABOVE:"above",BELOW:"below",IN:"in",NOT_IN:"not-in",OF_TYPE:"of-type",MISSING:"missing",PRESENT:"present",IDENTIFIER:"identifier",ITERATE:"iterate"},Pk={contains:fe.CONTAINS,exact:fe.EXACT,above:fe.ABOVE,below:fe.BELOW,text:fe.TEXT,not:fe.NOT,in:fe.IN,"not-in":fe.NOT_IN,"of-type":fe.OF_TYPE,missing:fe.MISSING,identifier:fe.IDENTIFIER,iterate:fe.ITERATE},ES={eq:fe.EQUALS,ne:fe.NOT_EQUALS,lt:fe.LESS_THAN,le:fe.LESS_THAN_OR_EQUALS,gt:fe.GREATER_THAN,ge:fe.GREATER_THAN_OR_EQUALS,sa:fe.STARTS_AFTER,eb:fe.ENDS_BEFORE,ap:fe.APPROXIMATELY,sw:fe.STARTS_WITH};function Nk(e,t){if(!e)throw new Error("Invalid search URL");let n="",r;if(typeof e=="string")if(e.includes("?")){const[c,u]=e.split("?");n=c,r=new URLSearchParams(u)}else n=e;else typeof e=="object"&&(n=e.pathname,r=e.searchParams);let i;n.includes("/")?i=n.split("/").filter(Boolean).pop():i=n;const s=[];return r&&s.push(...r.entries()),HV(i,s)}function HV(e,t){const n={resourceType:e};for(const[r,i]of t)qV(n,r,i);return n}function qV(e,t,n){let r,i;const s=t.indexOf(":");if(s>=0?(r=t.substring(0,s),i=t.substring(s+1)):(r=t,i=""),r!=="_"){if(r==="_has"||t.includes(".")){e.filters=ul(e.filters,{code:t,operator:fe.EQUALS,value:n});return}switch(r){case"_sort":GV(e,n);break;case"_cursor":e.cursor=n;break;case"_count":e.count=Number.parseInt(n,10);break;case"_offset":e.offset=Number.parseInt(n,10);break;case"_total":e.total=n;break;case"_summary":n==="count"?(e.total="accurate",e.count=0):(n==="true"||n==="data"||n==="text")&&(e.summary=n);break;case"_include":{const c=VT(n);i==="iterate"&&(c.modifier=fe.ITERATE),e.include=ul(e.include,c);break}case"_revinclude":{const c=VT(n);i==="iterate"&&(c.modifier=fe.ITERATE),e.revInclude=ul(e.revInclude,c);break}case"_fields":case"_elements":e.fields=n.split(",");break;case"_type":e.types=n.split(",");break;case"_format":e.format=n;break;case"_pretty":e.pretty=n==="true";break;default:{const c=$o.types[e.resourceType]?.searchParams?.[r];c?e.filters=ul(e.filters,QV(c,i,n)):e.filters=ul(e.filters,YV(r,i,n))}}}}function GV(e,t){for(const n of t.split(",")){let r,i=!1;n.startsWith("-")?(r=n.substring(1),i=!0):r=n,e.sortRules||(e.sortRules=[]),e.sortRules.push({code:r,descending:i})}}const WV=[fe.MISSING,fe.PRESENT];function QV(e,t,n){if(WV.includes(t))return{code:e.code,operator:t,value:n};switch(e.type){case"number":case"date":case"quantity":{const{operator:r,value:i}=KV(n,t||fe.EQUALS);if(!FT(e,i))throw new ut(Oo(`Invalid format for ${e.type} search parameter: ${i}`));return{code:e.code,operator:r,value:i}}case"reference":case"string":case"token":case"uri":if(!FT(e,n))throw new ut(Oo(`Invalid format for ${e.type} search parameter: ${n}`));return{code:e.code,operator:XV(t),value:n};default:throw new Error("Unrecognized search parameter type: "+e.type)}}function YV(e,t,n){let r=fe.EQUALS;if(t)r=t;else if(n.length>=2){const i=n.substring(0,2);i in ES&&(n.length===2||n.at(2)?.match(/\d/))&&(r=i,n=n.substring(i.length))}return{code:e,operator:r,value:n}}function KV(e,t){const n=e.substring(0,2),r=ES[n];return r?{operator:r,value:e.substring(2)}:{operator:t,value:e}}function XV(e){return Pk[e]??fe.EQUALS}function VT(e){const t=e.split(":");if(t.includes("*"))throw new ut(Oo("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new ut(Oo(`Invalid include value '${e}': must be of the form ResourceType:search-parameter`));if(t.length===2)return{resourceType:t[0],searchParam:t[1]};if(t.length===3)return{resourceType:t[0],searchParam:t[1],targetType:t[2]};throw new ut(Oo(`Invalid include value '${e}'`))}function FT(e,t){return e.type==="date"?qd(t):!0}function vs(e){const t=[];e.fields&&t.push("_fields="+e.fields.join(","));for(const n of e.filters??Cr)t.push(JV(n));e.sortRules&&e.sortRules.length>0&&t.push(ZV(e.sortRules)),e.cursor!==void 0&&t.push("_cursor="+encodeURIComponent(e.cursor)),e.offset!==void 0&&e.offset!==0&&t.push("_offset="+e.offset),e.count!==void 0&&t.push("_count="+e.count),e.total!==void 0&&t.push("_total="+e.total),e.types&&e.types.length>0&&t.push("_type="+e.types.join(","));for(const n of e.include??Cr)t.push(HT("_include",n));for(const n of e.revInclude??Cr)t.push(HT("_revinclude",n));return t.length===0?"":(au(t),"?"+t.join("&"))}function JV(e){const t=e.operator in Pk?":"+e.operator:"",n=e.operator!==fe.EQUALS&&e.operator in ES?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function ZV(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function HT(e,t){return e+(t.modifier?":"+t.modifier:"")+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function Xm(e){const t=[];let n="",r=!1;for(const i of e)r?(n+=i,r=!1):i==="\\"?r=!0:i===","?(t.push(n),n=""):n+=i;return t.push(n),t}function eF(e,t){if(t.resourceType!==e.resourceType)return!1;for(const n of t.filters??Cr)if(!nF(e,t,n))return!1;return!0}const tF=new cS(1e3);function nF(e,t,n){const r=$o.types[t.resourceType]?.searchParams?.[n.code];if(!r)return!1;const i=js(r.expression,[mi(e)],void 0,tF);if(n.operator===fe.MISSING||n.operator===fe.PRESENT)return rF(i,n);switch(r.type){case"reference":return iF(i,n);case"string":case"uri":return sF(i,n);case"token":return oF(i,n);case"date":return cF(i,n);default:return!1}}function rF(e,t){const n=e.length>0;return(t.operator===fe.MISSING&&t.value==="false"||t.operator===fe.PRESENT&&t.value==="true")===n}function iF(e,t){const n=Jm(t.operator);if(t.value===""&&e.length===0)return t.operator===fe.EQUALS;const r=zV(e);for(const i of Xm(t.value)){let s=r.includes(i);if(!s&&t.code==="_compartment"&&(s=r.some(c=>c?.endsWith("/"+i))),s)return!n}return n}function oF(e,t){const n=$V(e),r=Xm(t.value),i=Jm(t.operator);for(const s of n)for(const c of r)if(aF(s,c))return!i;return i}function aF(e,t){if(t.includes("|")){const[n,r]=t.split("|").map(i=>i.toLowerCase());return!n&&!r?!1:n?e.system?.toLowerCase()===n&&(!r||e.value?.toLowerCase()===r):!e.system&&e.value?.toLowerCase()===r}return e.value?.toLowerCase()===t.toLowerCase()}function sF(e,t){const n=IV(e),r=Xm(t.value),i=Jm(t.operator);for(const s of n)for(const c of r)if(lF(s,c))return!i;return i}function lF(e,t){return e.toLowerCase().includes(t.toLowerCase())}function cF(e,t){const n=LV(e),r=Xm(t.value),i=Jm(t.operator);for(const s of n)for(const c of r)if(uF(s,t.operator,c))return!i;return i}function uF(e,t,n){if(!e)return!1;const r=mk(n);if(!r)return!1;const i=e.start??"0000",s=e.end??"9999",c=r.start,u=r.end;switch(t){case fe.APPROXIMATELY:case fe.EQUALS:case fe.NOT_EQUALS:return i<u&&s>c;case fe.LESS_THAN:return i<c;case fe.GREATER_THAN:return s>u;case fe.LESS_THAN_OR_EQUALS:return i<=u;case fe.GREATER_THAN_OR_EQUALS:return s>=c;case fe.STARTS_AFTER:return i>u;case fe.ENDS_BEFORE:return s<c;default:return!1}}function Jm(e){return e===fe.NOT_EQUALS||e===fe.NOT}const dF={resourceType:"*"},fF=["DomainConfiguration","JsonWebKey","Login"],hF=["UserSecurityRequest","Project","ProjectMembership","User"],vl={READ:"read",VREAD:"vread",UPDATE:"update",HISTORY:"history",SEARCH:"search"},pF=[vl.READ,vl.VREAD,vl.HISTORY,vl.SEARCH];function mF(e,t){return fF.includes(t)?!1:gF(e,vl.UPDATE,t)}function gF(e,t,n){return!!e.resource?.some(r=>Mk(r,n,t))}function Ok(e,t,n){return n?n.resource?.find(r=>vF(e,t,r)):dF}function vF(e,t,n){const r=e.resourceType;return Mk(n,r,t)?r==="Binary"?!0:!(n.compartment&&!e.meta?.compartment?.some(i=>i.reference===n.compartment?.reference)||n.criteria&&!eF(e,Nk(n.criteria))):!1}function Mk(e,t,n){return e.resourceType!==t&&(e.resourceType!=="*"||hF.includes(t))?!1:e.interaction?e.interaction.includes(n):!e.readonly||pF.includes(n)}function Ro(){return typeof window<"u"}function Lk(){return typeof Buffer<"u"?Buffer:void 0}const rr={assign(e){Ro()&&globalThis.location.assign(e)},reload(){Ro()&&globalThis.location.reload()},getSearch(){return Ro()?globalThis.location.search:""},getPathname(){return Ro()?globalThis.location.pathname:""},getLocation(){return Ro()?globalThis.location.toString():""},getOrigin(){return Ro()?globalThis.location.protocol+"//"+globalThis.location.host+"/":""}};function yF(e){if(Ro()){const n=window.atob(e),r=Uint8Array.from(n,i=>i.codePointAt(0));return new window.TextDecoder().decode(r)}const t=Lk();if(t)return t.from(e,"base64").toString("utf-8");throw new Error("Unable to decode base64")}function qT(e){if(Ro()){const n=new window.TextEncoder().encode(e),r=String.fromCodePoint.apply(null,n);return window.btoa(r)}const t=Lk();if(t)return t.from(e,"utf8").toString("base64");throw new Error("Unable to encode base64")}function xF(e){e=e.padEnd(e.length+(4-e.length%4)%4,"=");const t=e.replaceAll("-","+").replaceAll("_","/");return yF(t)}function GT(){const e=new Uint32Array(28);return crypto.getRandomValues(e),UB(e.buffer)}async function bF(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function Ik(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}function zk(e){const t={};e=gi(e);for(const i of e.entry??Cr){const s=i.resource;if(!s)continue;s.meta!==void 0&&(delete s.meta.author,delete s.meta.compartment,delete s.meta.lastUpdated,delete s.meta.project,delete s.meta.versionId,Object.keys(s.meta).length===0&&delete s.meta);const c=s?.id;c&&(t[c]=Ik(),i.fullUrl="urn:uuid:"+t[c],delete i.resource?.id)}const n=e.entry,r=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:n?.map(i=>({fullUrl:i.fullUrl,request:{method:"POST",url:i.resource?.resourceType},resource:i.resource}))},(i,s)=>SF(i,s,t),2);return jF(JSON.parse(r))}function SF(e,t,n){if(e==="reference"&&typeof t=="string"){let r;if(t.includes("/")?r=t.split("/")[1]:t.startsWith("urn:uuid:")?r=t.slice(9):t.startsWith("#")&&(r=t.slice(1)),r){const i=n[r];if(i)return"urn:uuid:"+i}}return t}function jF(e){const t=CF(e),{sorted:n,cycles:r}=wF(t),i={},s=[];for(const u of e.entry??Cr)u.fullUrl?i[u.fullUrl]=u:s.push(u);const c=n.map(u=>i[u]);for(const u of r)for(const f of u){const h=i[f],m={...h,request:{...h.request,method:"PUT"}};c.push(m)}return c.push(...s),{...e,entry:c}}const $c={NotVisited:"NotVisited",Visiting:"Visiting",Visited:"Visited"};function wF(e){const t=[],n={},r=[];for(const s of Object.keys(e))n[s]=$c.NotVisited;function i(s,c){if(n[s]===$c.Visited)return!0;if(n[s]===$c.Visiting){const f=c.lastIndexOf(s);return f!==-1&&r.push(c.slice(f)),!0}n[s]=$c.Visiting,c.push(s);let u=!1;for(const f of e[s])i(f,c)||(u=!0);return n[s]=$c.Visited,c.pop(),t.unshift(s),!u}for(const s in e)n[s]===$c.NotVisited&&i(s,[]);return{sorted:t,cycles:r}}function $k(e,t){for(const n in e)if(e[n]&&typeof e[n]=="object"){const r=e[n];if(Ma(r)){const i=r.reference;i.startsWith("urn:uuid:")&&t(i)}else $k(r,t)}}function CF(e){const t={};for(const n of e.entry??Cr)n.fullUrl&&(t[n.fullUrl]=[]);for(const n of e.entry??Cr){const r=n.fullUrl;n.resource&&$k(n.resource,i=>{t[i]&&t[i].push(r)})}return t}const tn={CSS:"text/css",DICOM:"application/dicom",FAVICON:"image/vnd.microsoft.icon",FHIR_JSON:"application/fhir+json",FORM_URL_ENCODED:"application/x-www-form-urlencoded",HL7_V2:"x-application/hl7-v2+er7",HTML:"text/html",JAVASCRIPT:"text/javascript",JSON:"application/json",JSON_PATCH:"application/json-patch+json",JWT:"application/jwt",MULTIPART_FORM_DATA:"multipart/form-data",PNG:"image/png",SCIM_JSON:"application/scim+json",SVG:"image/svg+xml",TEXT:"text/plain",TYPESCRIPT:"text/typescript",PING:"x-application/ping",XML:"text/xml",CDA_XML:"application/cda+xml",OCTET_STREAM:"application/octet-stream"};let EF=class{listeners;constructor(){this.listeners={}}addEventListener(t,n){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n)}removeEventListener(t,n){const r=this.listeners[t];if(r){for(let i=0;i<r.length;i++)if(r[i]===n){r.splice(i,1);return}}}dispatchEvent(t){const n=this.listeners[t.type];for(const r of n??Cr)r.call(this,t);return!t.defaultPrevented}removeAllListeners(){this.listeners={}}listenerCount(t){return this.listeners[t]?.length??0}};class Zm{emitter=new EF;dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,n){this.emitter.addEventListener(t,n)}removeEventListener(t,n){this.emitter.removeEventListener(t,n)}removeAllListeners(){this.emitter.removeAllListeners()}listenerCount(t){return this.emitter.listenerCount(t)}}const Kx={"Patient-open":"Patient-open","Patient-close":"Patient-close","ImagingStudy-open":"ImagingStudy-open","ImagingStudy-close":"ImagingStudy-close","Encounter-open":"Encounter-open","Encounter-close":"Encounter-close","DiagnosticReport-open":"DiagnosticReport-open","DiagnosticReport-close":"DiagnosticReport-close","DiagnosticReport-select":"DiagnosticReport-select","DiagnosticReport-update":"DiagnosticReport-update",syncerror:"syncerror"},TF=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],TS=["DiagnosticReport-update"];function RF(e){return TS.includes(e)}function _F(e){if(TS.includes(e))throw new ut(Sn(`'context.version' is required for '${e}'.`))}const DF={"Patient-open":{patient:{resourceType:"Patient"},encounter:{resourceType:"Encounter",optional:!0}},"Patient-close":{patient:{resourceType:"Patient"},encounter:{resourceType:"Encounter",optional:!0}},"ImagingStudy-open":{study:{resourceType:"ImagingStudy"},encounter:{resourceType:"Encounter",optional:!0},patient:{resourceType:"Patient",optional:!0}},"ImagingStudy-close":{study:{resourceType:"ImagingStudy"},encounter:{resourceType:"Encounter",optional:!0},patient:{resourceType:"Patient",optional:!0}},"Encounter-open":{encounter:{resourceType:"Encounter"},patient:{resourceType:"Patient"}},"Encounter-close":{encounter:{resourceType:"Encounter"},patient:{resourceType:"Patient"}},"DiagnosticReport-open":{report:{resourceType:"DiagnosticReport"},encounter:{resourceType:"Encounter",optional:!0},study:{resourceType:"ImagingStudy",optional:!0,manyAllowed:!0},patient:{resourceType:"Patient"}},"DiagnosticReport-close":{report:{resourceType:"DiagnosticReport"},encounter:{resourceType:"Encounter",optional:!0},study:{resourceType:"ImagingStudy",optional:!0,manyAllowed:!0},patient:{resourceType:"Patient"}},"DiagnosticReport-select":{report:{resourceType:"DiagnosticReport",reference:!0},patient:{resourceType:"Patient",optional:!0,reference:!0},select:{resourceType:"*",reference:!0,manyAllowed:!0}},"DiagnosticReport-update":{report:{resourceType:"DiagnosticReport",reference:!0},patient:{resourceType:"Patient",optional:!0,reference:!0},updates:{resourceType:"Bundle"}},syncerror:{operationoutcome:{resourceType:"OperationOutcome"}}};function AF(e){return TF.includes(e)}function Uk(e){return!!e.endpoint}function WT(e){if(!RS(e))throw new ut(Sn("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:n,topic:r,events:i}=e,s={"hub.channel.type":t,"hub.mode":n,"hub.topic":r,"hub.events":i.join(",")};return Uk(e)&&(s.endpoint=e.endpoint),new URLSearchParams(s).toString()}function RS(e){if(typeof e!="object")return!1;const{channelType:t,mode:n,topic:r,events:i}=e;if(!(t&&n&&r&&i)||typeof r!="string"||typeof i!="object"||!Array.isArray(i)||i.length<1||t!=="websocket"||n!=="subscribe"&&n!=="unsubscribe")return!1;for(const s of i)if(!Kx[s])return!1;return!(Uk(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function kF(e,t,n,r){if(typeof t!="object")throw new ut(Sn(`context[${n}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));if(!(t.id&&typeof t.id=="string"))throw new ut(Sn(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new ut(Sn(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const i=r.resourceType;if(i!=="*"){if(!AF(t.resourceType))throw new ut(Sn(`context[${n}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));if(i&&t.resourceType!==i)throw new ut(Sn(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${i}.`))}}function PF(e,t,n,r,i){if(i.set(t.key,(i.get(t.key)??0)+1),r.reference){if(!Ma(t.reference))throw new ut(Sn(`context[${n}] is invalid. Expected key '${t.key}' to be a reference.`))}else kF(e,t.resource,n,r)}function NF(e,t){const n=new Map,r=DF[e];for(let i=0;i<t.length;i++){const s=t[i].key;if(!r[s])throw new ut(Sn(`Key '${s}' not found for event '${e}'. Make sure to add only valid keys.`));PF(e,t[i],i,r[s],n)}for(const[i,s]of Object.entries(r)){if(!(s.optional||n.has(i)))throw new ut(Sn(`Missing required key '${i}' on context for '${e}' event.`));if(!s.manyAllowed&&(n.get(i)??0)>1)throw new ut(Sn(`${n.get(i)} context entries with key '${i}' found for the '${e}' event when schema only allows for 1.`))}}function QT(e,t,n,r){if(!(e&&typeof e=="string"))throw new ut(Sn("Must provide a topic."));if(!Kx[t])throw new ut(Sn(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Kx).join(", ")}`));if(typeof n!="object")throw new ut(Sn("context must be a context object or array of context objects."));if(TS.includes(t)&&!r)throw new ut(Sn(`The '${t}' event must contain a 'context.versionId'.`));const i=Array.isArray(n)?n:[n];return NF(t,i),{timestamp:new Date().toISOString(),id:Ik(),event:{"hub.topic":e,"hub.event":t,context:i,...r?{"context.versionId":r}:{}}}}class OF extends Zm{subRequest;websocket;constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new ut(Sn("Subscription request should contain an endpoint."));if(!RS(t))throw new ut(Sn("Subscription request failed validation."));const n=new WebSocket(t.endpoint);n.addEventListener("open",()=>{this.dispatchEvent({type:"connect"}),n.addEventListener("message",r=>{const i=JSON.parse(r.data);if(i["hub.topic"])return;const s=i;s.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:s}),n.send(JSON.stringify({id:i?.id,timestamp:new Date().toISOString()})))}),n.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=n}disconnect(){this.websocket.close()}}function MF(e){return JSON.parse(xF(e))}function LF(e){return e.split(".").length===3}function _S(e){const[t,n,r]=e.split(".");return MF(n)}function IF(e){try{return typeof _S(e).login_id=="string"}catch{return!1}}function zF(e){try{const n=_S(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}class $F{medplum;constructor(t){this.medplum=t}async get(t){return this.medplum.get(`keyvalue/v1/${t}`)}async set(t,n){await this.medplum.put(`keyvalue/v1/${t}`,n,tn.TEXT)}async delete(t){await this.medplum.delete(`keyvalue/v1/${t}`)}}class no{[Symbol.toStringTag]="ReadablePromise";suspender;status="pending";response;error;constructor(t){this.suspender=t.then(n=>(this.status="success",this.response=n,n),n=>{throw this.status="error",this.error=n,n})}isPending(){return this.status==="pending"}isOk(){return this.status==="success"}read(){switch(this.status){case"pending":throw this.suspender;case"error":throw this.error;default:return this.response}}then(t,n){return this.suspender.then(t,n)}catch(t){return this.suspender.catch(t)}finally(t){return this.suspender.finally(t)}}class UF{storage;prefix="";constructor(t,n=""){this.storage=t??globalThis.localStorage??new BF,this.prefix=n}makeKey(t){return this.prefix+t}clear(){this.storage===globalThis.localStorage&&this.prefix?Object.keys(this.storage).filter(t=>t.startsWith(this.prefix)).forEach(t=>{this.storage.removeItem(t)}):this.storage.clear()}getString(t){return this.storage.getItem(this.makeKey(t))??void 0}setString(t,n){n?this.storage.setItem(this.makeKey(t),n):this.storage.removeItem(this.makeKey(t))}getObject(t){const n=this.getString(t);return n?JSON.parse(n):void 0}setObject(t,n){this.setString(t,n?fo(n):void 0)}}class BF{data;constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(t){return this.data.get(t)??null}setItem(t,n){n?this.data.set(t,n):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}const Xc={Event:typeof globalThis.Event<"u"?globalThis.Event:void 0,ErrorEvent:void 0,CloseEvent:void 0};let YT=!1;function VF(){if(typeof globalThis.Event>"u")throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");Xc.Event=globalThis.Event,Xc.ErrorEvent=class extends Event{message;error;constructor(t,n){super("error",n),this.message=t.message,this.error=t}},Xc.CloseEvent=class extends Event{code;reason;wasClean=!0;constructor(t=1e3,n="",r){super("close",r),this.code=t,this.reason=n}}}function FF(e,t){if(!e)throw new Error(t)}function up(e){return new e.constructor(e.type,e)}const il={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0};let KT=!1;class fs extends Zm{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType;_closeCalled=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(t,n,r={}){YT||(VF(),YT=!0),super(),this._url=t,this._protocols=n,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._options.binaryType?this._binaryType=this._options.binaryType:this._binaryType="blob",this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return fs.CONNECTING}get OPEN(){return fs.OPEN}get CLOSING(){return fs.CLOSING}get CLOSED(){return fs.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((n,r)=>(typeof r=="string"?n+=r.length:r instanceof Blob?n+=r.size:n+=r.byteLength,n),0)+(this._ws?.bufferedAmount??0)}get extensions(){return this._ws?.extensions??""}get protocol(){return this._ws?.protocol??""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?fs.CLOSED:fs.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(t=1e3,n){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,n)}reconnect(t,n){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,n),this._connect())}send(t){if(this._ws?.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{const{maxEnqueuedMessages:n=il.maxEnqueuedMessages}=this._options;this._messageQueue.length<n&&(this._debug("enqueue",t),this._messageQueue.push(t))}}_debug(...t){this._options.debug&&this._debugLogger("RWS>",...t)}_getNextDelay(){const{reconnectionDelayGrowFactor:t=il.reconnectionDelayGrowFactor,minReconnectionDelay:n=il.minReconnectionDelay,maxReconnectionDelay:r=il.maxReconnectionDelay}=this._options;let i=0;return this._retryCount>0&&(i=n*Math.pow(t,this._retryCount-1),i>r&&(i=r)),this._debug("next delay",i),i}_wait(){return new Promise(t=>{setTimeout(t,this._getNextDelay())})}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:t=il.maxRetries,connectionTimeout:n=il.connectionTimeout}=this._options;if(this._retryCount>=t){this._debug("max retries reached",this._retryCount,">=",t);return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>"u"&&!KT&&(console.error("‼️ No WebSocket implementation available. You should define options.WebSocket."),KT=!0);const r=this._options.WebSocket||WebSocket;this._debug("connect",{url:this._url,protocols:this._protocols}),this._ws=this._protocols?new r(this._url,this._protocols):new r(this._url),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),n)}).catch(r=>{this._connectLock=!1,this._handleError(new Xc.ErrorEvent(Error(r.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new Xc.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(t=1e3,n){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,n),this._handleClose(new Xc.CloseEvent(t,n,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_handleOpen=t=>{this._debug("open event");const{minUptime:n=il.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),n),FF(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(r=>this._ws?.send(r)),this._messageQueue=[],this.onopen&&this.onopen(t),this.dispatchEvent(up(t))};_handleMessage=t=>{this._debug("message event"),this.onmessage&&this.onmessage(t),this.dispatchEvent(up(t))};_handleError=t=>{this._debug("error event",t.message),this._disconnect(void 0,t.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(t),this._debug("exec error listeners"),this.dispatchEvent(up(t)),this._connect()};_handleClose=t=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(t),this.dispatchEvent(up(t))};_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}}const HF=5e3,qF=300*1e3,GF=6e4,WF=[WebSocket.CLOSING,WebSocket.CLOSED];class Xx extends Zm{criteria;constructor(...t){super(),this.criteria=new Set(t)}getCriteria(){return this.criteria}_addCriteria(t){this.criteria.add(t)}_removeCriteria(t){this.criteria.delete(t)}}class QF{criteria;emitter;refCount;subscriptionProps;subscriptionId;token;tokenExpiry;connecting=!1;constructor(t,n){this.criteria=t,this.emitter=new Xx(t),this.refCount=1,this.subscriptionProps=n?{...n}:void 0}clearAttachedSubscription(){this.subscriptionId=void 0,this.token=void 0,this.tokenExpiry=void 0}}class YF{medplum;ws;masterSubEmitter;criteriaEntries;criteriaEntriesBySubscriptionId;wsClosed;pingTimer=void 0;tokenRefreshTimer=void 0;pingIntervalMs;waitingForPong=!1;currentProfile;constructor(t,n,r){if(!(t instanceof Vk))throw new ut(Sn("First arg of constructor should be a `MedplumClient`"));let i;try{i=new URL(n).toString()}catch{throw new ut(Sn("Not a valid URL"))}const s=r?.ReconnectingWebSocket?new r.ReconnectingWebSocket(i,void 0,{debug:r?.debug,debugLogger:r?.debugLogger}):new fs(i,void 0,{debug:r?.debug,debugLogger:r?.debugLogger});this.medplum=t,this.ws=s,this.masterSubEmitter=new Xx,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.pingIntervalMs=r?.pingIntervalMs??HF,this.currentProfile=t.getProfile(),this.setupListeners()}setupListeners(){const t=this.ws;t.addEventListener("message",n=>{try{const r=JSON.parse(n.data);if(r.type==="pong"){this.waitingForPong=!1;return}const i=r,s=i?.entry?.[0]?.resource;if(s.type==="heartbeat"){this.masterSubEmitter?.dispatchEvent({type:"heartbeat",payload:i});return}if(s.type==="handshake"){const u=bs(s.subscription),f={type:"connect",payload:{subscriptionId:u}};this.masterSubEmitter?.dispatchEvent(f);const h=this.criteriaEntriesBySubscriptionId.get(u);if(!h){console.warn("Received handshake for criteria the SubscriptionManager is not listening for yet");return}h.connecting=!1,h.emitter.dispatchEvent({...f});return}this.masterSubEmitter?.dispatchEvent({type:"message",payload:i});const c=this.criteriaEntriesBySubscriptionId.get(bs(s.subscription));if(!c){console.warn("Received notification for criteria the SubscriptionManager is not listening for");return}c.emitter.dispatchEvent({type:"message",payload:i})}catch(r){console.error(r);const i={type:"error",payload:r};this.masterSubEmitter?.dispatchEvent(i);for(const s of this.getAllCriteriaEmitters())s.dispatchEvent({...i})}}),t.addEventListener("error",()=>{const n={type:"error",payload:new ut(rU(new Error("WebSocket error")))};this.masterSubEmitter?.dispatchEvent(n);for(const r of this.getAllCriteriaEmitters())r.dispatchEvent({...n})}),t.addEventListener("close",()=>{const n={type:"close"};this.masterSubEmitter?.dispatchEvent(n);for(const r of this.getAllCriteriaEmitters())r.dispatchEvent({...n});this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=void 0,this.waitingForPong=!1),this.tokenRefreshTimer&&(clearInterval(this.tokenRefreshTimer),this.tokenRefreshTimer=void 0),this.wsClosed&&(this.criteriaEntries.clear(),this.criteriaEntriesBySubscriptionId.clear(),this.masterSubEmitter?.removeAllListeners())}),t.addEventListener("open",()=>{const n={type:"open"};this.masterSubEmitter?.dispatchEvent(n);for(const r of this.getAllCriteriaEmitters())r.dispatchEvent({...n});this.refreshAllSubscriptions().catch(console.error),this.pingTimer||(this.pingTimer=setInterval(()=>{if(this.waitingForPong){this.waitingForPong=!1,t.reconnect();return}t.send(JSON.stringify({type:"ping"})),this.waitingForPong=!0},this.pingIntervalMs)),this.tokenRefreshTimer??=setInterval(()=>{this.checkTokenExpirations()},GF)}),this.medplum.addEventListener("change",()=>{const n=this.medplum.getProfile();this.currentProfile&&n===void 0?this.ws.close():n&&this.currentProfile?.id!==n.id&&this.ws.reconnect(),this.currentProfile=n})}emitError(t,n){const r={type:"error",payload:n};this.masterSubEmitter?.dispatchEvent(r),t.emitter.dispatchEvent({...r})}maybeEmitDisconnect(t){const{subscriptionId:n}=t;if(n){const r={type:"disconnect",payload:{subscriptionId:n}};this.masterSubEmitter?.dispatchEvent(r),t.emitter.dispatchEvent({...r})}else console.warn("Called disconnect for `CriteriaEntry` before `subscriptionId` was present.")}async getTokenForCriteria(t){let n=t?.subscriptionId;n||(n=(await this.medplum.createResource({...t.subscriptionProps,resourceType:"Subscription",status:"active",reason:`WebSocket subscription for ${$t(this.medplum.getProfile())}`,channel:{type:"websocket"},criteria:t.criteria})).id);const{parameter:r}=await this.medplum.get(`fhir/R4/Subscription/${n}/$get-ws-binding-token`),i=r?.find(u=>u.name==="token")?.valueString,s=r?.find(u=>u.name==="websocket-url")?.valueUrl,c=r?.find(u=>u.name==="expiration")?.valueDateTime;if(!i)throw new ut(Sn("Failed to get token"));if(!s)throw new ut(Sn("Failed to get URL from $get-ws-binding-token"));if(!c)throw new ut(Sn("Failed to get expiration from $get-ws-binding-token"));return[n,i,c]}maybeGetCriteriaEntry(t,n){const r=this.criteriaEntries.get(t);if(r){if(!n)return r.bareCriteria;for(const i of r.criteriaWithProps)if($i(n,i.subscriptionProps))return i}}getAllCriteriaEmitters(){const t=[];for(const n of this.criteriaEntries.values()){n.bareCriteria&&t.push(n.bareCriteria.emitter);for(const r of n.criteriaWithProps)t.push(r.emitter)}return t}addCriteriaEntry(t){const{criteria:n,subscriptionProps:r}=t;let i;this.criteriaEntries.has(n)?i=this.criteriaEntries.get(n):(i={criteriaWithProps:[]},this.criteriaEntries.set(n,i)),r?i.criteriaWithProps.push(t):i.bareCriteria=t}removeCriteriaEntry(t){const{criteria:n,subscriptionProps:r,subscriptionId:i,token:s}=t;if(!this.criteriaEntries.has(n))return;const c=this.criteriaEntries.get(n);r?c.criteriaWithProps=c.criteriaWithProps.filter(u=>{const f=u.subscriptionProps;return!$i(r,f)}):c.bareCriteria=void 0,!c.bareCriteria&&c.criteriaWithProps.length===0&&(this.criteriaEntries.delete(n),this.masterSubEmitter?._removeCriteria(n)),i&&this.criteriaEntriesBySubscriptionId.delete(i),s&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"unbind-from-token",payload:{token:s}}))}async subscribeToCriteria(t){this.wsClosed&&await this.reconnectIfNeeded(),!this.isReconnecting(t)&&(t.connecting=!0,await this.rebindCriteriaEntry(t))}async refreshAllSubscriptions(){this.criteriaEntriesBySubscriptionId.clear();for(const t of this.criteriaEntries.values())for(const n of[...t.bareCriteria?[t.bareCriteria]:[],...t.criteriaWithProps])n.clearAttachedSubscription(),await this.subscribeToCriteria(n)}isReconnecting(t){return!!(this.ws.readyState!==WebSocket.OPEN||t.connecting)}async rebindCriteriaEntry(t){try{const[n,r,i]=await this.getTokenForCriteria(t);t.token=r,t.tokenExpiry=new Date(i).getTime(),t.subscriptionId=n,this.criteriaEntriesBySubscriptionId.set(n,t),this.ws.send(JSON.stringify({type:"bind-with-token",payload:{token:r}}))}catch(n){console.error(We(n)),this.emitError(t,n)}}checkTokenExpirations(){const t=Date.now();for(const n of this.criteriaEntries.values())for(const r of[...n.bareCriteria?[n.bareCriteria]:[],...n.criteriaWithProps])r.tokenExpiry&&r.tokenExpiry-t<=qF&&!this.isReconnecting(r)&&this.rebindCriteriaEntry(r).catch(i=>{this.masterSubEmitter?.dispatchEvent({type:"error",payload:i})})}addCriteria(t,n){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(t);const r=this.maybeGetCriteriaEntry(t,n);if(r)return r.refCount+=1,r.emitter;const i=new QF(t,n);return this.addCriteriaEntry(i),this.subscribeToCriteria(i).catch(console.error),i.emitter}removeCriteria(t,n){const r=this.maybeGetCriteriaEntry(t,n);if(!r){console.warn("Criteria not known to `SubscriptionManager`. Possibly called remove too many times.");return}r.refCount-=1,!(r.refCount>0)&&(this.maybeEmitDisconnect(r),this.removeCriteriaEntry(r))}getWebSocket(){return this.ws}closeWebSocket(){this.wsClosed||(this.wsClosed=!0,this.ws.close())}reconnectWebSocket(){this.ws.reconnect(),this.wsClosed=!1}getCriteriaCount(){return this.getAllCriteriaEmitters().length}getMasterEmitter(){return this.masterSubEmitter||(this.masterSubEmitter=new Xx(...Array.from(this.criteriaEntries.keys()))),this.masterSubEmitter}async reconnectIfNeeded(){WF.includes(this.getWebSocket().readyState)&&await new Promise(t=>{const n=()=>{this.getWebSocket().removeEventListener("open",n),t()};this.getWebSocket().addEventListener("open",n),this.reconnectWebSocket()})}}const Bk="5.1.2-a3e2a8a",KF=tn.FHIR_JSON+", */*; q=0.1",XF="https://api.medplum.com/",JF=1e3,ZF=6e4,eH=0,tH=3e5,nH="Binary/",XT={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]},Uc={ClientCredentials:"client_credentials",AuthorizationCode:"authorization_code",RefreshToken:"refresh_token",JwtBearer:"urn:ietf:params:oauth:grant-type:jwt-bearer",TokenExchange:"urn:ietf:params:oauth:grant-type:token-exchange"},rH={AccessToken:"urn:ietf:params:oauth:token-type:access_token"},iH={JwtBearer:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"};class Vk extends Zm{options;fetch;createPdfImpl;storage;requestCache;cacheTime;baseUrl;fhirBaseUrl;authorizeUrl;tokenUrl;logoutUrl;fhircastHubUrl;cdsServicesUrl;defaultHeaders;onUnauthenticated;autoBatchTime;autoBatchQueue;maxRetryTime;refreshGracePeriod;subscriptionManager;medplumServer;clientId;clientSecret;credentialsInHeader;autoBatchTimerId;accessToken;accessTokenExpires;refreshToken;refreshPromise;profilePromise;sessionDetails;currentRateLimits;basicAuth;initPromise;initComplete=!0;keyValueClient;logLevel;constructor(t){if(super(),t?.baseUrl&&!t.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");this.options=t??{},this.fetch=t?.fetch??oH(),this.storage=t?.storage??new UF(void 0,t?.storagePrefix),this.createPdfImpl=t?.createPdf,this.baseUrl=vS(t?.baseUrl??XF),this.fhirBaseUrl=Pi(this.baseUrl,t?.fhirUrlPath??"fhir/R4"),this.authorizeUrl=Pi(this.baseUrl,t?.authorizeUrl??"oauth2/authorize"),this.tokenUrl=Pi(this.baseUrl,t?.tokenUrl??"oauth2/token"),this.logoutUrl=Pi(this.baseUrl,t?.logoutUrl??"oauth2/logout"),this.fhircastHubUrl=Pi(this.baseUrl,t?.fhircastHubUrl??"fhircast/STU3"),this.cdsServicesUrl=Pi(this.baseUrl,t?.cdsServicesUrl??"cds-services"),this.clientId=t?.clientId??"",this.clientSecret=t?.clientSecret??"",this.credentialsInHeader=t?.authCredentialsMethod==="header",this.defaultHeaders=t?.defaultHeaders??{},this.onUnauthenticated=t?.onUnauthenticated,this.refreshGracePeriod=t?.refreshGracePeriod??tH,this.logLevel=this.initializeLogLevel(t),this.maxRetryTime=t?.maxRetryTime??2e3,this.cacheTime=t?.cacheTime??(Ro()?ZF:eH),this.cacheTime>0?this.requestCache=new cS(t?.resourceCacheSize??JF):this.requestCache=void 0,t?.autoBatchTime?(this.autoBatchTime=t.autoBatchTime,this.autoBatchQueue=[]):(this.autoBatchTime=0,this.autoBatchQueue=void 0),t?.accessToken&&this.setAccessToken(t.accessToken),this.storage.getInitPromise===void 0?(t?.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initPromise=Promise.resolve(),this.dispatchEvent({type:"storageInitialized"})):(this.initComplete=!1,this.initPromise=this.storage.getInitPromise(),this.initPromise.then(()=>{t?.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initComplete=!0,this.dispatchEvent({type:"storageInitialized"})}).catch(n=>{console.error(n),this.initComplete=!0,this.dispatchEvent({type:"storageInitFailed",payload:{error:n}})})),this.setupStorageListener()}get isInitialized(){return this.initComplete}getInitPromise(){return this.initPromise}initializeLogLevel(t){return t?.logLevel?t.logLevel:t?.verbose!==void 0&&t.verbose?"verbose":"none"}async attemptResumeActiveLogin(){const t=this.getActiveLogin();t&&(this.setAccessToken(t.accessToken,t.refreshToken),await this.refreshProfile())}getBaseUrl(){return this.baseUrl}getAuthorizeUrl(){return this.authorizeUrl}getTokenUrl(){return this.tokenUrl}getLogoutUrl(){return this.logoutUrl}getFhircastHubUrl(){return this.fhircastHubUrl}getCdsServicesUrl(){return this.cdsServicesUrl}getDefaultHeaders(){return this.defaultHeaders}clear(){this.storage.clear(),Ro()&&sessionStorage.clear(),this.clearActiveLogin()}clearActiveLogin(){this.storage.setString("activeLogin",void 0),this.requestCache?.clear(),this.accessToken=void 0,this.refreshToken=void 0,this.refreshPromise=void 0,this.accessTokenExpires=void 0,this.sessionDetails=void 0,this.medplumServer=void 0,this.dispatchEvent({type:"change"})}invalidateUrl(t){t=t.toString(),this.requestCache?.delete(t)}invalidateAll(){this.requestCache?.clear()}invalidateSearches(t){const n=Pi(this.fhirBaseUrl,t);for(const r of this.requestCache?.keys()??Cr)(r.endsWith(n)||r.includes(n+"?"))&&this.requestCache?.delete(r)}get(t,n={}){t=t.toString();const r=this.getCacheEntry(t,n);if(r)return r.value;let i;t.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue&&!n.disableAutoBatch?i=new Promise((c,u)=>{this.autoBatchQueue.push({method:"GET",url:t.replace(this.fhirBaseUrl,""),options:n,resolve:c,reject:u}),this.autoBatchTimerId||(this.autoBatchTimerId=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime))}):i=this.request("GET",t,n);const s=new no(i);return this.setCacheEntry(t,s,n),s}post(t,n,r,i={}){return t=t.toString(),this.setRequestBody(i,n),r&&this.setRequestContentType(i,r),this.invalidateUrl(t),this.request("POST",t,i)}put(t,n,r,i={}){return t=t.toString(),this.setRequestBody(i,n),r&&this.setRequestContentType(i,r),this.invalidateUrl(t),this.request("PUT",t,i)}patch(t,n,r={}){return t=t.toString(),this.setRequestBody(r,n),this.setRequestContentType(r,tn.JSON_PATCH),this.invalidateUrl(t),this.request("PATCH",t,r)}delete(t,n){return t=t.toString(),this.invalidateUrl(t),this.request("DELETE",t,n)}async startNewUser(t,n){const{codeChallengeMethod:r,codeChallenge:i}=await this.startPkce();return this.post("auth/newuser",{...t,clientId:t.clientId??this.clientId,codeChallengeMethod:r,codeChallenge:i},void 0,n)}async startNewProject(t,n){return this.post("auth/newproject",t,void 0,n)}async startNewPatient(t,n){return this.post("auth/newpatient",t,void 0,n)}async startLogin(t,n){return this.post("auth/login",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,n)}async startGoogleLogin(t,n){return this.post("auth/google",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,n)}async ensureCodeChallenge(t){return t.codeChallenge?t:{...t,...await this.startPkce()}}async signOut(){await this.post(this.logoutUrl,{}),this.clear()}async signInWithRedirect(t){const r=new URLSearchParams(rr.getSearch()).get("code");if(!r){await this.requestAuthorization(t);return}return this.processCode(r)}signOutWithRedirect(){rr.assign(this.logoutUrl)}async signInWithExternalAuth(t,n,r,i,s=!0){let c=i;s&&(c=await this.ensureCodeChallenge(i)),rr.assign(this.getExternalAuthRedirectUri(t,n,r,c,s))}async exchangeExternalAccessToken(t,n,r){if(n=n??this.clientId,!n)throw new Error("MedplumClient is missing clientId");const i={grant_type:Uc.TokenExchange,subject_token_type:rH.AccessToken,client_id:n,subject_token:t};return r&&(i.membership_id=r),this.fetchTokens(i)}getExternalAuthRedirectUri(t,n,r,i,s=!0){const c=new URL(t);if(c.searchParams.set("response_type","code"),c.searchParams.set("client_id",n),c.searchParams.set("redirect_uri",r),c.searchParams.set("scope",i.scope??"openid profile email"),c.searchParams.set("state",JSON.stringify(i)),s){const{codeChallenge:u,codeChallengeMethod:f}=i;if(!f)throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");if(!u)throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");c.searchParams.set("code_challenge_method",f),c.searchParams.set("code_challenge",u)}return c.toString()}fhirUrl(...t){return new URL(Pi(this.fhirBaseUrl,t.join("/")))}fhirSearchUrl(t,n){const r=this.fhirUrl(t);return n&&(r.search=WB(n)),r}search(t,n,r){const i=this.fhirSearchUrl(t,n),s="search-"+i.toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const u=this.getBundle(i,r);return this.setCacheEntry(s,u,r),u}searchOne(t,n,r){const i=this.fhirSearchUrl(t,n);i.searchParams.set("_count","1"),i.searchParams.sort();const s="searchOne-"+i.toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const u=new no(this.search(t,i.searchParams,r).then(f=>f.entry?.[0]?.resource));return this.setCacheEntry(s,u,r),u}searchResources(t,n,r){const s="searchResources-"+this.fhirSearchUrl(t,n).toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const u=new no(this.search(t,n,r).then(ZT));return this.setCacheEntry(s,u,r),u}async*searchResourcePages(t,n,r){let i=this.fhirSearchUrl(t,n);for(;i;){const s=new URL(i).searchParams;s.has("_count")||s.set("_count","1000");const c=await this.search(t,s,r),u=c.link?.find(f=>f.relation==="next");if(!c.entry?.length&&!u)break;yield ZT(c),i=u?.url?new URL(u.url):void 0}}valueSetExpand(t,n){const r=this.fhirUrl("ValueSet","$expand");return r.search=new URLSearchParams(t).toString(),this.get(r.toString(),n)}getCached(t,n){const r=this.requestCache?.get(this.fhirUrl(t,n).toString())?.value;return r?.isOk()?r.read():void 0}getCachedReference(t){const n=t.reference;if(!n)return;if(n==="system")return XT;const[r,i]=n.split("/");if(!(!r||!i))return this.getCached(r,i)}readResource(t,n,r){if(!n)throw new Error('The "id" parameter cannot be null, undefined, or an empty string.');return this.get(this.fhirUrl(t,n),r)}readReference(t,n){const r=t.reference;if(!r)return new no(Promise.reject(new Error("Missing reference")));if(r==="system")return new no(Promise.resolve(XT));const[i,s]=r.split("/");return!i||!s?new no(Promise.reject(new Error("Invalid reference"))):this.readResource(i,s,n)}readCanonical(t,n,r){return Array.isArray(t)?this.searchOne("",{_type:t.join(","),url:n},r):this.searchOne(t,"url="+n,r)}requestSchema(t,n){if(ok(t))return Promise.resolve();const r=t+"-requestSchema",i=this.getCacheEntry(r,void 0);if(i)return i.value;const s=new no((async()=>{const c=`{
57
+ StructureDefinitionList(_filter: "name eq ${t}") {
58
+ resourceType,
59
+ name,
60
+ kind,
61
+ description,
62
+ type,
63
+ url,
64
+ snapshot {
65
+ element {
66
+ id,
67
+ path,
68
+ definition,
69
+ min,
70
+ max,
71
+ base {
72
+ path,
73
+ min,
74
+ max
75
+ },
76
+ contentReference,
77
+ type {
78
+ code,
79
+ profile,
80
+ targetProfile
81
+ },
82
+ binding {
83
+ strength,
84
+ valueSet
85
+ }
86
+ }
87
+ }
88
+ }
89
+ SearchParameterList(base: "${t}", _count: 100) {
90
+ base,
91
+ code,
92
+ type,
93
+ expression,
94
+ target
95
+ }
96
+ }`.replaceAll(/\s+/g," "),u=await this.graphql(c);NT(u.data.StructureDefinitionList);for(const f of u.data.SearchParameterList)rV(f)})());return this.setCacheEntry(r,s,n),s}requestProfileSchema(t,n){if(!n?.expandProfile&&dS(t))return Promise.resolve();const r=t+"-requestSchema"+(n?.expandProfile?"-nested":""),i=this.getCacheEntry(r,void 0);if(i)return i.value;const s=new no((async()=>{if(n?.expandProfile){const c=this.fhirUrl("StructureDefinition","$expand-profile");c.search=new URLSearchParams({url:t}).toString();const u=await this.post(c.toString(),{});NT(u)}else{const c=await this.searchOne("StructureDefinition",{url:t,_sort:"-_lastUpdated"});if(!c){console.warn(`No StructureDefinition found for ${t}!`);return}ik(c)}})());return this.setCacheEntry(r,s,n),s}readHistory(t,n,r,i){const s=this.fhirUrl(t,n,"_history");return r?.count&&s.searchParams.set("_count",r.count.toString()),r?.offset&&s.searchParams.set("_offset",r.offset.toString()),this.get(s.toString(),i)}readVersion(t,n,r,i){return this.get(this.fhirUrl(t,n,"_history",r),i)}readPatientEverything(t,n){return this.getBundle(this.fhirUrl("Patient",t,"$everything"),n)}readPatientSummary(t,n){return this.getBundle(this.fhirUrl("Patient",t,"$summary"),n)}createResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(t.resourceType),this.post(this.fhirUrl(t.resourceType),t,void 0,n)}async createResourceIfNoneExist(t,n,r={}){const i=this.fhirUrl(t.resourceType);this.setRequestHeader(r,"If-None-Exist",n);const s=await this.post(i,t,void 0,r);return this.cacheResource(s,r),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),s}async upsertResource(t,n,r){const i=this.fhirSearchUrl(t.resourceType,n);let s=await this.put(i,t,void 0,r);return s||(s=t),this.cacheResource(s,r),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),s}async createAttachment(t,n,r,i,s){let c=eR(t,n,r,i);if(c.contentType===tn.XML){const h=c.data;let m;h instanceof Blob?m=await new Promise((g,y)=>{const x=new FileReader;x.onload=()=>{if(!x.result){y(new Error("Failed to load file"));return}g(x.result)},x.readAsText(h,"utf-8")}):ArrayBuffer.isView(h)?m=new TextDecoder().decode(h):m=h,m.includes("<ClinicalDocument")&&m.includes("urn:hl7-org:v3")&&(c={...c,contentType:tn.CDA_XML})}const u=s??(typeof n=="object"?n:{}),f=await this.createBinary(c,u);return{contentType:c.contentType,url:f.url,title:c.filename}}createBinary(t,n,r,i,s){const c=eR(t,n,r,i),u=s??(typeof n=="object"?n:{}),{data:f,contentType:h,filename:m,securityContext:g,onProgress:y}=c,x=this.fhirUrl("Binary");return m&&x.searchParams.set("_filename",m),g?.reference&&this.setRequestHeader(u,"X-Security-Context",g.reference),y?this.uploadwithProgress(x,f,h,y,u):this.post(x,f,h,u)}uploadwithProgress(t,n,r,i,s){return new Promise((c,u)=>{const f=new XMLHttpRequest,h=()=>f.abort();s?.signal?.addEventListener("abort",h);const m=g=>{s?.signal?.removeEventListener("abort",h),g instanceof Error?u(g):c(g)};if(f.responseType="json",f.onabort=()=>m(new DOMException("Request aborted","AbortError")),f.onerror=()=>m(new Error("Request error")),i&&(f.upload.onprogress=g=>i(g),f.upload.onload=g=>i(g)),f.onload=()=>{f.status>=200&&f.status<300?m(f.response):m(new ut(rn(f.response||f.statusText)))},f.open("POST",t),f.withCredentials=!0,f.setRequestHeader("Authorization","Bearer "+this.accessToken),f.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),f.setRequestHeader("Content-Type",r),this.options.extendedMode!==!1&&f.setRequestHeader("X-Medplum","extended"),s?.headers){const g=s.headers;for(const[y,x]of Object.entries(g))f.setRequestHeader(y,x)}f.send(n)})}async createPdf(t,n,r,i){if(!this.createPdfImpl)throw new Error("PDF creation not enabled");const s=lH(t,n,r,i),c=typeof n=="object"?n:{},{docDefinition:u,tableLayouts:f,fonts:h,...m}=s,g=await this.createPdfImpl(u,f,h),y={...m,data:g,contentType:"application/pdf"};return this.createBinary(y,c)}createComment(t,n,r){const i=this.getProfile();let s,c;return t.resourceType==="Encounter"&&(s=nn(t),c=t.subject),t.resourceType==="ServiceRequest"&&(s=t.encounter,c=t.subject),t.resourceType==="Patient"&&(c=nn(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[nn(t)],encounter:s,subject:c,sender:i?nn(i):void 0,sent:new Date().toISOString(),payload:[{contentString:n}]},r)}async updateResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");if(!t.id)throw new Error("Missing id");let r=await this.put(this.fhirUrl(t.resourceType,t.id),t,void 0,n);return r||(r=t),this.cacheResource(r,n),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),r}async patchResource(t,n,r,i){const s=await this.patch(this.fhirUrl(t,n),r,i);return this.cacheResource(s,i),this.invalidateUrl(this.fhirUrl(t,n,"_history")),this.invalidateSearches(t),s}deleteResource(t,n,r){return this.deleteCacheEntry(this.fhirUrl(t,n).toString()),this.invalidateSearches(t),this.delete(this.fhirUrl(t,n),r)}validateResource(t,n){return this.post(this.fhirUrl(t.resourceType,"$validate"),t,void 0,n)}executeBot(t,n,r,i){let s;if(typeof t=="string"){const c=t;s=this.fhirUrl("Bot",c,"$execute")}else{const c=t;s=this.fhirUrl("Bot","$execute"),s.searchParams.set("identifier",c.system+"|"+c.value)}return this.post(s,n,r,i)}executeBatch(t,n){return this.post(this.fhirBaseUrl,t,void 0,n)}sendEmail(t,n){return this.post("email/v1/send",t,tn.JSON,n)}graphql(t,n,r,i){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},tn.JSON,i)}readResourceGraph(t,n,r,i){return this.get(`${this.fhirUrl(t,n)}/$graph?graph=${r}`,i)}pushToAgent(t,n,r,i,s,c){const{waitTimeout:u,returnAck:f,...h}=c??{};return this.post(this.fhirUrl("Agent",bs(t),"$push"),{destination:typeof n=="string"?n:$t(n),body:r,contentType:i,waitForResponse:s,...u!==void 0?{waitTimeout:u}:void 0,...f!==void 0?{returnAck:f}:void 0},tn.FHIR_JSON,h)}getCdsServices(t){return this.get(this.cdsServicesUrl,t)}callCdsService(t,n,r){return this.post(Pi(this.cdsServicesUrl,t),n,tn.JSON,r)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){(!this.sessionDetails?.profile||$t(this.sessionDetails.profile)!==t.profile?.reference)&&this.clearActiveLogin(),this.setAccessToken(t.accessToken,t.refreshToken),this.storage.setObject("activeLogin",t),this.addLogin(t),this.refreshPromise=void 0,await this.refreshProfile()}getAccessToken(){return this.accessToken}isAuthenticated(t){return this.accessTokenExpires!==void 0&&Date.now()<this.accessTokenExpires-(t??this.refreshGracePeriod)}setAccessToken(t,n){this.accessToken=t,this.refreshToken=n,this.accessTokenExpires=zF(t),this.medplumServer=IF(t)}getLogins(){return this.storage.getObject("logins")??[]}addLogin(t){const n=this.getLogins().filter(r=>r.profile?.reference!==t.profile?.reference);n.push(t),this.storage.setObject("logins",n)}async refreshProfile(){if(this.medplumServer)return this.profilePromise=new Promise((t,n)=>{this.get("auth/me",{cache:"no-cache"}).then(r=>{this.profilePromise=void 0;const i=this.sessionDetails?.profile?.id!==r.profile.id;this.sessionDetails=r,i&&this.dispatchEvent({type:"change"}),t(r.profile),this.dispatchEvent({type:"profileRefreshed"})}).catch(n)}),this.dispatchEvent({type:"profileRefreshing"}),this.profilePromise}isLoading(){return!this.isInitialized||!!this.profilePromise&&!this.sessionDetails?.profile}isSuperAdmin(){return!!this.sessionDetails?.project.superAdmin}isProjectAdmin(){return!!this.sessionDetails?.membership.admin}getProject(){return this.sessionDetails?.project}getProjectMembership(){return this.sessionDetails?.membership}getProfile(){return this.sessionDetails?.profile}async getProfileAsync(){return this.profilePromise?this.profilePromise:this.sessionDetails?this.sessionDetails.profile:this.refreshProfile()}getUserConfiguration(){return this.sessionDetails?.config}getAccessPolicy(){return this.sessionDetails?.accessPolicy}async download(t,n={}){this.refreshPromise&&await this.refreshPromise;const r=t.toString();r.startsWith(nH)&&(t=this.fhirUrl(r));let i=n.headers;return i||(i={},n.headers=i),i.Accept||(i.Accept="*/*"),this.addFetchOptionsDefaults(n),(await this.fetchWithRetry(t.toString(),n)).blob()}async createMedia(t,n){const{additionalFields:r,...i}=t,s=await this.createResource({resourceType:"Media",status:"preparation",content:{contentType:t.contentType},...r});i.securityContext||(i.securityContext=nn(s));const c=await this.createAttachment(i,n);return this.updateResource({...s,status:"completed",content:c})}async uploadMedia(t,n,r,i,s){return this.createMedia({data:t,contentType:n,filename:r,additionalFields:i},s)}async createDocumentReference(t,n){const{additionalFields:r,...i}=t,s=await this.createResource({resourceType:"DocumentReference",status:"current",content:[{attachment:{contentType:t.contentType}}],...r});i.securityContext||(i.securityContext=nn(s));const c=await this.createAttachment(i,n);return this.updateResource({...s,content:[{attachment:c}]})}async bulkExport(t="",n,r,i){const s=t&&`${t}/`,c=this.fhirUrl(`${s}$export`);return n&&c.searchParams.set("_type",n),r&&c.searchParams.set("_since",r),this.startAsyncRequest(c.toString(),i)}async startAsyncRequest(t,n={}){this.addFetchOptionsDefaults(n);const r=n.headers;return r.Prefer="respond-async",this.request("POST",t,n)}get keyValue(){return this.keyValueClient||(this.keyValueClient=new $F(this)),this.keyValueClient}getBundle(t,n){return new no((async()=>{const r=await this.get(t,n);for(const i of r.entry??Cr)this.cacheResource(i.resource,n);return r})())}isCacheEnabled(t){return!!this.requestCache&&!this.getRequestHeader(t,"x-medplum-on-behalf-of")}getCacheEntry(t,n){if(!this.isCacheEnabled(n)||n?.cache==="no-cache"||n?.cache==="reload")return;const r=this.requestCache.get(t);if(!(!r||r.requestTime+this.cacheTime<Date.now()))return r}setCacheEntry(t,n,r){this.isCacheEnabled(r)&&(this.requestCache.set(t,{requestTime:Date.now(),value:n}),r?.signal&&r.signal.addEventListener("abort",()=>{this.requestCache.delete(t)}))}cacheResource(t,n){t?.id&&!t.meta?.tag?.some(r=>r.code==="SUBSETTED")&&this.setCacheEntry(this.fhirUrl(t.resourceType,t.id).toString(),new no(Promise.resolve(t)),n)}deleteCacheEntry(t){this.requestCache&&this.requestCache.delete(t)}async request(t,n,r={},i={}){await this.refreshIfExpired(),r.method=t,this.addFetchOptionsDefaults(r);const s=await this.fetchWithRetry(n,r);if(s.status===401)return this.handleUnauthenticated(t,n,r);if(s.status===204||s.status===304)return;const u=s.headers.get("content-type")?.includes("json");if(s.status===404&&!u)throw new ut(tU);const f=await this.parseBody(s,u);if(s.status===200&&r.followRedirectOnOk||s.status===201&&r.followRedirectOnCreated){const h=await JT(s,f);if(h)return this.request("GET",h,{...r,body:void 0})}if(s.status===202&&r.pollStatusOnAccepted){const m=await JT(s,f)??i.statusUrl;if(m)return this.pollStatus(m,r,i)}if(s.status>=400)throw new ut(rn(f));return f}async parseBody(t,n){let r;if(t.headers.get("content-length")!=="0"){if(n)try{r=await t.json()}catch(i){throw console.error("Error parsing response",t.status,i),i}else r=await t.text();return r}}async fetchWithRetry(t,n){t.startsWith("http")||(t=Pi(this.baseUrl,t));const r=n?.maxRetries??2;for(let i=0;i<=r;i++)try{this.logLevel!=="none"&&this.logRequest(t,n);const s=await this.fetch(t,n);if(this.logLevel!=="none"&&this.logResponse(s),this.setCurrentRateLimit(s),i>=r||!cH(s))return s;const c=this.getRetryDelay(i),u=n.maxRetryTime??this.maxRetryTime;if(c>u)return s;await UT(c,{signal:n.signal})}catch(s){if(s.message==="Failed to fetch"&&i===0&&this.dispatchEvent({type:"offline"}),s.name==="AbortError"||i===r)throw s}throw new Error("Unreachable")}logRequest(t,n){if(console.log(`> ${n.method} ${t}`),this.logLevel==="verbose"&&n.headers){const r=n.headers;for(const i of au(Object.keys(r)))console.log(`> ${i}: ${r[i]}`)}}logResponse(t){console.log(`< ${t.status} ${t.statusText}`),this.logLevel==="verbose"&&t.headers&&t.headers.forEach((n,r)=>console.log(`< ${r}: ${n}`))}setCurrentRateLimit(t){if(!t?.headers||typeof t.headers.get!="function")return;const n=t.headers.get("ratelimit");n&&(this.currentRateLimits=n)}rateLimitStatus(){if(!this.currentRateLimits)return[];const t=this.currentRateLimits;return t.split(",").map(n=>{const r=n.split(";").map(h=>h.trim());if(r.length!==3)throw new Error("Could not parse RateLimit header: "+t);const i=r[0].substring(1,r[0].length-1),s=r.find(h=>h.startsWith("r="))?.substring(2),c=s?Number.parseInt(s,10):Number.NaN,u=r.find(h=>h.startsWith("t="))?.substring(2),f=u?Number.parseInt(u,10):Number.NaN;if(!i||Number.isNaN(c)||Number.isNaN(f))throw new Error("Could not parse RateLimit header: "+t);return{name:i,remainingUnits:c,secondsUntilReset:f,resetsAfter:Math.ceil((Date.now()+1e3*f)/1e3)}})}getRetryDelay(t){const n=this.rateLimitStatus();let r=500*Math.pow(1.5,t);for(const i of n)i.remainingUnits||(r=Math.max(r,i.secondsUntilReset*1e3));return r}async pollStatus(t,n,r){const i={...n,method:"GET",body:void 0,redirect:"follow"};if(r.pollCount===void 0)n.headers&&typeof n.headers=="object"&&"Prefer"in n.headers&&(i.headers={...n.headers},delete i.headers.Prefer),r.statusUrl=t,r.pollCount=1;else{const s=n.pollStatusPeriod??1e3;await UT(s,{signal:n.signal}),r.pollCount++}return this.request("GET",t,i,r)}async executeAutoBatch(){if(this.autoBatchQueue===void 0)return;const t=[...this.autoBatchQueue];if(this.autoBatchQueue.length=0,this.autoBatchTimerId=void 0,t.length===1){const i=t[0];try{i.resolve(await this.request(i.method,Pi(this.fhirBaseUrl,i.url),i.options))}catch(s){i.reject(new ut(rn(s)))}return}const n={resourceType:"Bundle",type:"batch",entry:t.map(i=>({request:{method:i.method,url:i.url},resource:i.options.body?JSON.parse(i.options.body):void 0}))},r=await this.post(this.fhirBaseUrl,n);for(let i=0;i<t.length;i++){const s=t[i],c=r.entry?.[i];c?.response?.outcome&&!ek(c.response.outcome)?s.reject(new ut(c.response.outcome)):s.resolve(c?.resource)}}addFetchOptionsDefaults(t){Object.entries(this.defaultHeaders).forEach(([n,r])=>{this.setRequestHeader(t,n,r)}),this.setRequestHeader(t,"Accept",KF,!0),this.options.extendedMode!==!1&&this.setRequestHeader(t,"X-Medplum","extended"),t.body&&this.setRequestHeader(t,"Content-Type",tn.FHIR_JSON,!0),this.accessToken?this.setRequestHeader(t,"Authorization","Bearer "+this.accessToken):this.basicAuth&&this.setRequestHeader(t,"Authorization","Basic "+this.basicAuth),t.cache||(t.cache="no-cache"),t.credentials||(t.credentials="include")}setRequestContentType(t,n){this.setRequestHeader(t,"Content-Type",n)}getRequestHeader(t,n){const r=t?.headers;if(r)if(Array.isArray(r)){const i=r.find(([s])=>s.toLowerCase()===n.toLowerCase());return i?i[1]:void 0}else{if(r instanceof Headers)return r.get(n)??void 0;if(mr(r))return r[n]??void 0}else return}setRequestHeader(t,n,r,i=!1){const s=t.headers;s?Array.isArray(s)?(!i||!s.some(([c])=>c.toLowerCase()===n.toLowerCase()))&&s.push([n,r]):s instanceof Headers?(!i||!s.has(n))&&s.set(n,r):mr(s)&&(!i||!s[n])&&(s[n]=r):t.headers={[n]:r}}setRequestBody(t,n){typeof n=="string"||typeof Blob<"u"&&(n instanceof Blob||n?.constructor.name==="Blob")||typeof File<"u"&&(n instanceof File||n?.constructor.name==="File")||typeof Uint8Array<"u"&&(n instanceof Uint8Array||n?.constructor.name==="Uint8Array")?t.body=n:n&&(t.body=JSON.stringify(n))}async handleUnauthenticated(t,n,r){if(this.refresh())return this.request(t,n,r);throw this.clear(),this.onUnauthenticated?.(),new ut(Fd)}async startPkce(){const t=GT();sessionStorage.setItem("pkceState",t);const n=GT().slice(0,128);sessionStorage.setItem("codeVerifier",n);try{const r=await bF(n);return{codeChallengeMethod:"S256",codeChallenge:BB(r).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}}catch(r){return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method",r),{codeChallengeMethod:"plain",codeChallenge:n}}}async requestAuthorization(t){const n=await this.ensureCodeChallenge(t??{}),r=new URL(this.authorizeUrl);r.searchParams.set("response_type","code"),r.searchParams.set("state",sessionStorage.getItem("pkceState")),r.searchParams.set("client_id",n.clientId??this.clientId),r.searchParams.set("redirect_uri",n.redirectUri??rr.getOrigin()),r.searchParams.set("code_challenge_method",n.codeChallengeMethod),r.searchParams.set("code_challenge",n.codeChallenge),r.searchParams.set("scope",n.scope??"openid profile"),rr.assign(r.toString())}processCode(t,n){const r={grant_type:Uc.AuthorizationCode,code:t,client_id:n?.clientId??this.clientId??"",redirect_uri:n?.redirectUri??rr.getOrigin()};if(typeof sessionStorage<"u"){const i=sessionStorage.getItem("codeVerifier");i&&(r.code_verifier=i)}return this.fetchTokens(r)}refreshIfExpired(t){return!this.refreshPromise&&this.accessTokenExpires!==void 0&&!this.isAuthenticated(t)&&this.refresh(),this.refreshPromise??Promise.resolve()}refresh(){if(this.refreshPromise)return this.refreshPromise;if(this.refreshToken)return this.refreshPromise=this.fetchTokens({grant_type:Uc.RefreshToken,client_id:this.clientId??"",refresh_token:this.refreshToken}),this.refreshPromise;if(this.clientId&&this.clientSecret)return this.refreshPromise=this.startClientLogin(this.clientId,this.clientSecret),this.refreshPromise}async startClientLogin(t,n){return this.clientId=t,this.clientSecret=n,this.fetchTokens({grant_type:Uc.ClientCredentials,client_id:t,client_secret:n})}async startJwtBearerLogin(t,n,r){return this.clientId=t,this.fetchTokens({grant_type:Uc.JwtBearer,client_id:t,assertion:n,scope:r})}async startJwtAssertionLogin(t){return this.fetchTokens({grant_type:Uc.ClientCredentials,client_assertion_type:iH.JwtBearer,client_assertion:t})}setBasicAuth(t,n){this.clientId=t,this.clientSecret=n,this.basicAuth=qT(t+":"+n)}setLogLevel(t){this.logLevel=t,this.options.verbose=t==="verbose"}getLogLevel(){return this.logLevel}setVerbose(t){this.logLevel=t?"verbose":"none",this.options.verbose=t}async fhircastSubscribe(t,n){if(!(typeof t=="string"&&t!==""))throw new ut(Sn("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new ut(Sn("Invalid events provided. Events must be an array of event names containing at least one event."));const r={channelType:"websocket",mode:"subscribe",topic:t,events:n},s=(await this.post(this.fhircastHubUrl,WT(r),tn.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!s)throw new Error("Invalid response!");return r.endpoint=s,r}async fhircastUnsubscribe(t){if(!RS(t))throw new ut(Sn("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new ut(Sn("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post(this.fhircastHubUrl,WT(t),tn.FORM_URL_ENCODED)}fhircastConnect(t){return new OF(t)}async fhircastPublish(t,n,r,i){return RF(n)?this.post(this.fhircastHubUrl,QT(t,n,r,i),tn.JSON):(_F(n),this.post(this.fhircastHubUrl,QT(t,n,r),tn.JSON))}async fhircastGetContext(t){return this.get(`${this.fhircastHubUrl}/${t}`,{cache:"no-cache"})}async invite(t,n){return this.post("admin/projects/"+t+"/invite",n)}async handleTokenError(t){try{const n=await t.json();throw Ef(n)?new ut(n):n.error_description?new ut(Oo(n.error_description)):new Error(JSON.stringify(n))}catch(n){throw n instanceof ut?(n.message=`Failed to fetch tokens: ${n.message}`,n):new ut(Oo("Failed to fetch tokens"),{cause:n})}}async fetchTokens(t){const n=new URLSearchParams(t),r={...this.defaultHeaders,"Content-Type":tn.FORM_URL_ENCODED};this.basicAuth&&(r.Authorization=`Basic ${this.basicAuth}`),this.credentialsInHeader&&(n.delete("client_id"),n.delete("client_secret"),!this.basicAuth&&t.client_id&&t.client_secret&&(r.Authorization=`Basic ${qT(t.client_id+":"+t.client_secret)}`));const i={method:"POST",headers:r,body:n.toString(),credentials:"include"};let s;try{s=await this.fetchWithRetry(this.tokenUrl,i)}catch(u){throw this.refreshPromise=void 0,u}s.ok||(this.clearActiveLogin(),this.onUnauthenticated?.(),await this.handleTokenError(s));const c=await s.json();return await this.verifyTokens(c),this.getProfile()}async verifyTokens(t){const n=t.access_token;if(LF(n)){const r=_S(n);if(Date.now()>=r.exp*1e3)throw this.clearActiveLogin(),new ut(nU);if(r.cid){if(r.cid!==this.clientId)throw this.clearActiveLogin(),new ut(kT)}else if(this.clientId&&r.client_id!==this.clientId)throw this.clearActiveLogin(),new ut(kT)}return this.setActiveLogin({accessToken:n,refreshToken:t.refresh_token,project:t.project,profile:t.profile})}checkSessionDetailsMatchLogin(t){return this.sessionDetails&&t?t.profile?.reference?.endsWith(this.sessionDetails.profile.id)??!1:!0}setupStorageListener(){try{window.addEventListener("storage",t=>{if(t.key===null)rr.reload();else if(t.key===this.storage.makeKey("activeLogin")){const n=t.oldValue?JSON.parse(t.oldValue):void 0,r=t.newValue?JSON.parse(t.newValue):void 0;n?.profile.reference!==r?.profile.reference||!this.checkSessionDetailsMatchLogin(r)?rr.reload():r?this.setAccessToken(r.accessToken,r.refreshToken):this.clear()}})}catch{}}getSubscriptionManager(){return this.subscriptionManager||(this.subscriptionManager=new YF(this,GB(this.baseUrl,"/ws/subscriptions-r4"))),this.subscriptionManager}subscribeToCriteria(t,n){return this.getSubscriptionManager().addCriteria(t,n)}unsubscribeFromCriteria(t,n){this.subscriptionManager&&(this.subscriptionManager.removeCriteria(t,n),this.subscriptionManager.getCriteriaCount()===0&&this.subscriptionManager.closeWebSocket())}getMasterSubscriptionEmitter(){return this.getSubscriptionManager().getMasterEmitter()}}function oH(){if(!globalThis.fetch)throw new Error("Fetch not available in this environment");return globalThis.fetch.bind(globalThis)}async function JT(e,t){const n=e.headers.get("content-location");if(n)return n;const r=e.headers.get("location");if(r)return r;if(Ef(t)&&t.issue?.[0]?.diagnostics)return t.issue[0].diagnostics}function ZT(e){const t=e.entry?.map(n=>n.resource)??[];return Object.assign(t,{bundle:e})}function aH(e){return mr(e)&&"data"in e&&"contentType"in e}function eR(e,t,n,r){return aH(e)?e:{data:e,filename:t,contentType:n,onProgress:r}}function sH(e){return mr(e)&&"docDefinition"in e}function lH(e,t,n,r){return sH(e)?e:{docDefinition:e,filename:t,tableLayouts:n,fonts:r}}function cH(e){return e.status===429||e.status>=500}function su({parentContext:e,path:t,elements:n,profileUrl:r,debugMode:i,accessPolicyResource:s}){if(t===e?.path)return;i??=e?.debugMode??!1,s??=e?.accessPolicyResource;let c=uH(t,n,e,!!i);const u=Yx(t,".",2)[1];c=dH(c,s,u),c=fH(c,s,u);const f=Object.create(null);for(const[m,g]of Object.entries(c))f[t+"."+m]=g;let h;if(e&&!e.isDefaultContext)h=e.getExtendedProps;else{const m=Object.create(null);h=g=>{const y=Yx(g,".",2)[1];if(y){if(!m[y]){const x=qp(y,s?.hiddenFields);m[y]={hidden:x,readonly:x||qp(y,s?.readonlyFields)}}return m[y]}}}return{path:t,elements:c,elementsByPath:f,profileUrl:r??e?.profileUrl,debugMode:i,getExtendedProps:h,accessPolicyResource:s}}function uH(e,t,n,r){const i=Object.create(null);if(n)for(const[c,u]of Object.entries(n.elementsByPath)){const f=ml(e,c);f!==void 0&&(i[f]=u)}let s=!1;if(t)for(const[c,u]of Object.entries(t))c in i||(i[c]=u,s=!0);return r&&console.assert(s,"Unnecessary ElementsContext; not using any newly provided elements"),i}function dH(e,t,n){if(!t?.hiddenFields?.length)return e;const r=n?n+".":"";return Object.fromEntries(Object.entries(e).filter(([i])=>!qp(r+i,t.hiddenFields)))}function fH(e,t,n){if(!t?.readonlyFields?.length)return e;const r=Object.create(null),i=n?n+".":"";for(const[s,c]of Object.entries(e))qp(i+s,t.readonlyFields)?r[s]={...c,readonly:!0}:r[s]=c;return r}function qp(e,t){if(!t?.length)return!1;const n=e.split(".");for(let r=1;r<=n.length;r++){const i=n.slice(0,r).join(".");if(t.includes(i))return!0}return!1}function Fk(e){return e.type!==void 0&&e.type.length>0}function hH(e,t,n,r){const i=xB(e,t.path,{profileUrl:r});if(i){const s=n.typeSchema?.elements??n.elements;return i.some(c=>SB(c,t,n,s))??!1}return console.assert(!1,"getNestedProperty[%s] in isDiscriminatorComponentMatch missed",t.path),!1}function Hk(e,t,n,r){if(e)for(const i of t){const s={value:e,type:i.typeSchema?.type??i.type?.[0].code};if(n.every(c=>hH(s,c,i,i.typeSchema?.url??r)))return i.name}}class pH{rootSchema;visitor;elementsContextStack;sliceAllowList;constructor(t,n,r){if(t.type===void 0)throw new Error("schema must include a type");this.rootSchema=t;const i=su({parentContext:void 0,path:this.rootSchema.type,elements:r??this.rootSchema.elements,profileUrl:this.rootSchema.name===this.rootSchema.type?void 0:this.rootSchema.url});if(i===void 0)throw new Error("Could not create root elements context");this.elementsContextStack=[i],this.visitor=n}get elementsContext(){return this.elementsContextStack.at(-1)}crawlElement(t,n,r){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema);const i=Object.fromEntries(Object.entries(this.elementsContext.elements).filter(([s])=>s.startsWith(n)));this.crawlElementsImpl(i,r),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlSlice(t,n,r){const i=this.prepareSlices(r.slices,r);if(!In(i.slices))throw new Error(`cannot crawl slice ${n.name} since it has no type information`);this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema),this.sliceAllowList=[n],this.crawlSliceImpl(i.slices[0],n.path,i),this.sliceAllowList=void 0,this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlResource(){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema),this.crawlElementsImpl(this.rootSchema.elements,this.rootSchema.type),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlElementsImpl(t,n){const r=mH(t);for(const i of r)this.crawlElementNode(i,n)}crawlElementNode(t,n){const r=n+"."+t.key;this.visitor.onEnterElement&&this.visitor.onEnterElement(r,t.element,this.elementsContext);for(const i of t.children)this.crawlElementNode(i,n);In(t.element?.slicing?.slices)&&this.crawlSlicingImpl(t.element.slicing,r),this.visitor.onExitElement&&this.visitor.onExitElement(r,t.element,this.elementsContext)}prepareSlices(t,n){const r=[];for(const s of t){if(!Fk(s))continue;const c=s.type.find(u=>In(u.profile))?.profile?.[0];if(In(c)){const u=Su(c);u&&(s.typeSchema=u)}r.push(s)}return{...n,slices:r}}crawlSlicingImpl(t,n){const r=this.prepareSlices(t.slices,t);for(const i of r.slices)(this.sliceAllowList===void 0||this.sliceAllowList.includes(i))&&this.crawlSliceImpl(i,n,r)}crawlSliceImpl(t,n,r){const i=t.typeSchema;i&&this.visitor.onEnterSchema&&this.visitor.onEnterSchema(i),this.visitor.onEnterSlice&&this.visitor.onEnterSlice(n,t,r);let s;const c=i?.elements??t.elements;In(c)&&(s=su({path:n,parentContext:this.elementsContext,elements:c})),s&&this.elementsContextStack.push(s),this.crawlElementsImpl(c,n),s&&this.elementsContextStack.pop(),this.visitor.onExitSlice&&this.visitor.onExitSlice(n,t,r),i&&this.visitor.onExitSchema&&this.visitor.onExitSchema(i)}}function mH(e){const t=[];function n(s,c){return c.startsWith(s+".")}function r(s,c){for(const u of s.children)if(n(u.key,c.key)){r(u,c);return}s.children.push(c)}const i=Object.entries(e);i.sort((s,c)=>s[0].localeCompare(c[0]));for(const[s,c]of i){const u={key:s,element:c,children:[]};let f=!1;for(const h of t)if(n(h.key,s)){r(h,u),f=!0;break}f||t.push(u)}return t}const rx="__sliceName";function gH(e,t){const n=new vH(e,e.resourceType,"resource");return new pH(t,n).crawlResource(),n.getDefaultValue()}function tR(e,t,n){for(const[r,i]of Object.entries(t)){if(n===void 0||n===r){Gp(e,r,i,t);continue}const s=ml(n,r);s!==void 0&&Gp(e,s,i,t)}return e}class vH{rootValue;schemaStack;valueStack;constructor(t,n,r){this.schemaStack=[],this.valueStack=[],this.rootValue=gi(t),this.valueStack.splice(0,this.valueStack.length,{type:r,path:n,values:[this.rootValue]})}get schema(){return this.schemaStack.at(-1)}get value(){return this.valueStack.at(-1)}onEnterSchema(t){this.schemaStack.push(t)}onExitSchema(){this.schemaStack.pop()}onEnterElement(t,n,r){const i=this.value.values,s=this.value.path,c=ml(s,t);if(c===void 0)throw new Error(`Expected ${t} to be prefixed by ${s}`);const u=[];for(const f of i){if(f===void 0)continue;const h=ml(r.path,s),m=Array.isArray(f)?f:[f];for(const g of m){yH(g,c,n,r.elements,h),Gp(g,c,n,r.elements);const y=Zx(g,c,r.elements,h);y!==void 0&&u.push(y)}}this.valueStack.push({type:"element",path:t,values:u})}onExitElement(t,n,r){if(!this.valueStack.pop())throw new Error("Expected value context to exist when exiting element");const s=ml(this.value.path,t);if(s===void 0)throw new Error(`Expected ${t} to be prefixed by ${this.value.path}`);const c=ml(r.path,this.value.path);for(const u of this.value.values){const f=Zx(u,s,r.elements,c);if(Array.isArray(f))for(let h=f.length-1;h>=0;h--){const m=f[h];In(m)||f.splice(h,1)}kn(f)&&Jx(u,void 0,s,n)}}onEnterSlice(t,n,r){const i=this.value.values,s=[];for(const c of i)if(c!==void 0){const u=Array.isArray(c)?c:[c],f=this.getMatchingSliceValues(u,n,r);s.push(f)}this.valueStack.push({type:"slice",path:t,values:s})}getMatchingSliceValues(t,n,r){const i=[];for(const s of t)(s[rx]??Hk(s,[n],r.discriminator,this.schema.url))===n.name&&i.push(s);for(let s=i.length;s<n.min;s++)if(gS(n.type[0].code)){const c=Object.create(null);i.push(c),t.push(c)}return i}onExitSlice(){const t=this.valueStack.pop();if(!t)throw new Error("Expected value context to exist in onExitSlice");for(const n of t.values)for(let r=n.length-1;r>=0;r--){const i=n[r];rx in i&&delete i[rx]}}getDefaultValue(){return this.rootValue}}function yH(e,t,n,r,i){const s=Zx(e,t,r,i);n.min>0&&s===void 0&&gS(n.type[0].code)&&(n.isArray?Jx(e,[Object.create(null)],t,n):Jx(e,Object.create(null),t,n))}function Jx(e,t,n,r){if(n.includes("."))throw new Error("key cannot be nested");let i=n;if(n.includes("[x]")){const s=r.type[0].code;i=n.replace("[x]",Xn(s))}t===void 0?delete e[i]:e[i]=t}function Zx(e,t,n,r){const i=t.split(".");let s=e,c;for(let u=0;u<i.length;u++){let f=i[u];if(f.includes("[x]")){const h=(r?r+".":"")+i.slice(0,u+1).join("."),g=n[h].type[0].code;f=f.replace("[x]",Xn(g))}if(u===i.length-1){Array.isArray(s)?c=s.map(h=>h[f]):c=s[f];continue}if(Array.isArray(s))s=s.map(h=>h[f]);else if(mr(s)){if(s[f]===void 0)return;s=s[f]}else return}return c}function Gp(e,t,n,r){if(!(n.fixed||n.pattern))return e;if(Array.isArray(e))return e.map(u=>Gp(u,t,n,r));e==null&&(e=Object.create(null));const i=e,s=t.split(".");let c=i;for(let u=0;u<s.length;u++){let f=s[u];if(f.includes("[x]")){const m=r[s.slice(0,u+1).join(".")].type[0].code;f=f.replace("[x]",Xn(m))}if(u===s.length-1){const h=Array.isArray(c)?c:[c];for(const m of h)n.fixed?m[f]??=n.fixed.value:n.pattern&&(m[f]=qk(m[f],n.pattern.value))}else{if(!(f in c)){const h=s.slice(0,u+1).join(".");c[f]=r[h].isArray?[Object.create(null)]:Object.create(null)}c=c[f]}}return i}function qk(e,t){if(Array.isArray(t)&&(Array.isArray(e)||e===void 0))return(e?.length??0)>0?e:gi(t);if(mr(t)&&(mr(e)&&!Array.isArray(e)||e===void 0)){const n=gi(e)??Object.create(null);for(const r of Object.keys(t))n[r]=qk(n[r],t[r]);return n}return e}function xH(e){return e.match(/^\((.+)\)\.identifier$/)?.[1]}function bH(e,t){return new xS(e,new Ym(t,new Qd("identifier")))}const _r={BOOLEAN:"BOOLEAN",NUMBER:"NUMBER",QUANTITY:"QUANTITY",TEXT:"TEXT",REFERENCE:"REFERENCE",CANONICAL:"CANONICAL",DATE:"DATE",DATETIME:"DATETIME"};function eg(e,t){let n=$o.types[e]?.searchParamsDetails?.[t.code];return n||(n=jH(e,t)),n}function SH(e,t,n){let r=$o.types[e];r||(r={},$o.types[e]=r),r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function jH(e,t){const n=t.code,r=t.expression,i=TH(e,r),s={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const f of i){const h=Tp(f),m=HB(()=>h.join("."));h.length===1&&h[0]instanceof ri?s.propertyTypes.add("boolean"):t.code.endsWith(":identifier")?s.propertyTypes.add("Identifier"):m().endsWith("extension.value.code")||m().endsWith("extension.value.coding.code")?(s.array=!0,s.propertyTypes.clear(),s.propertyTypes.add("code")):Gk(s,h,e,1),m().endsWith("extension.valueDateTime")&&(s.array=!1,s.propertyTypes.clear(),s.propertyTypes.add("dateTime"))}let c;if(t.code.endsWith(":identifier")){const f=xH(r);if(f===void 0)throw new Error(`Unexpected expression for derived identifier search parameter: ${r}`);const h=nR(e,f);c=bH(r,h)}else c=nR(e,r);const u={type:EH(t,s.propertyTypes),elementDefinitions:s.elementDefinitions.map(f=>({...f,type:f.type?.filter(h=>s.propertyTypes.has(h.code))})).filter(f=>f.type&&f.type.length>0),parsedExpression:c,array:s.array};return SH(e,n,u),u}function Gk(e,t,n,r){const i=t[r];if(i instanceof Hp){e.propertyTypes.add(i.right.toString());return}if(i instanceof jS){wH(e,i);return}const s=i.toString(),c=Ps(n,s);if(!c)throw new Error(`Element definition not found for ${n} ${s}`);let u=!1,f=r+1;f<t.length&&t[f]instanceof wS&&(u=!0,f++);const h=t[f];if(c.isArray&&!u&&(e.array=!0),f===t.length-1&&h instanceof Hp){e.elementDefinitions.push(c),e.propertyTypes.add(h.right.toString());return}if(f>=t.length){e.elementDefinitions.push(c);for(const m of c.type??Cr)e.propertyTypes.add(m.code);return}for(const m of c.type??Cr){let g=m.code;CH(g)&&(g=c.type[0].code),Gk(e,t,g,f)}}function wH(e,t){if(t.name==="as"){e.propertyTypes.add(t.args[0].toString());return}if(t.name==="ofType"){e.propertyTypes.add(t.args[0].toString());return}if(t.name==="resolve"){e.propertyTypes.add("string");return}if(t.name==="where"&&t.args[0]instanceof SS){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function CH(e){return e==="Element"||e==="BackboneElement"}function EH(e,t){switch(e.type){case"date":return t.size===1&&t.has(re.date)?_r.DATE:_r.DATETIME;case"number":return _r.NUMBER;case"quantity":return _r.QUANTITY;case"reference":return t.has(re.canonical)?_r.CANONICAL:_r.REFERENCE;case"token":return t.size===1&&t.has(re.boolean)?_r.BOOLEAN:_r.TEXT;default:return _r.TEXT}}function TH(e,t){const n=[],r=CS(t);return Wp(e,r.child,n),n}function nR(e,t){const n=[],r=CS(t);if(Wp(e,r.child,n),n.length===0)return r;let i=n[0];for(let s=1;s<n.length;s++)i=new bS(i,n[s]);return new xS("<original-not-available>",i)}function Wp(e,t,n){t instanceof bS?(Wp(e,t.left,n),Wp(e,t.right,n)):t.toString().includes(e+".")&&n.push(t)}function Tp(e){if(e instanceof Hp||e instanceof wS)return[Tp(e.left),e].flat();if(e instanceof ri)return[e];if(e instanceof Ym)return[Tp(e.left),Tp(e.right)].flat();if(e instanceof jS){if(e.name==="where"&&!(e.args[0]instanceof SS))return[];if(e.name==="last")return[]}return[e]}const RH="https://meta.medplum.com/releases",ix=new Map;function _H(e){const t=e;if(!t.tag_name)throw new Error("Manifest missing tag_name");const n=t.assets;if(!n?.length)throw new Error("Manifest missing assets list");for(const r of n){if(!r.browser_download_url)throw new Error("Asset missing browser download URL");if(!r.name)throw new Error("Asset missing name")}}async function DH(e,t,n){let r=ix.get("latest");if(!r){const i="latest",s=new URL(`${RH}/${i}.json`);s.searchParams.set("a",e),s.searchParams.set("c",Bk);const c=await fetch(s.toString());if(c.status!==200){let f;try{f=(await c.json()).message}catch(h){console.error(`Failed to parse message from body: ${We(h)}`)}throw new Error(`Received status code ${c.status} while fetching manifest for version 'latest'. Message: ${f}`)}const u=await c.json();_H(u),r=u,ix.set("latest",r),ix.set(r.tag_name.slice(1),r)}return r}async function AH(e){const t=await DH(e);if(!t.tag_name.startsWith("v"))throw new Error(`Invalid release name found. Release tag '${t.tag_name}' did not start with 'v'`);return t.tag_name.slice(1)}const Wk=v.createContext(void 0);function tg(){return v.useContext(Wk)}function Re(){return tg().medplum}function ju(){return tg().navigate}function _f(){return tg().profile}const rR=["change","storageInitialized","storageInitFailed","profileRefreshing","profileRefreshed"];function kH(e){const t=e.medplum,n=e.navigate??PH,[r,i]=v.useState({profile:t.getProfile(),loading:t.isLoading()});v.useEffect(()=>{function c(){i(u=>({...u,profile:t.getProfile(),loading:t.isLoading()}))}for(const u of rR)t.addEventListener(u,c);return()=>{for(const u of rR)t.removeEventListener(u,c)}},[t]);const s=v.useMemo(()=>({...r,medplum:t,navigate:n}),[r,t,n]);return a.jsx(Wk.Provider,{value:s,children:e.children})}function PH(e){window.location.assign(e)}const iR=new Map,Qk=e=>v.useMemo(()=>{if(!e)return;const t=e.split("?")[0];if(!t)return e;let n;try{n=new URLSearchParams(new URL(e).search)}catch{return e}if(!n.has("Key-Pair-Id")||!n.has("Signature"))return e;const r=n.get("Expires");if(!r||r.length>13)return e;const i=iR.get(t);if(i){const c=new URLSearchParams(new URL(i).search).get("Expires");if(c&&Number.parseInt(c,10)*1e3-5e3>Date.now())return i}return iR.set(t,e),e},[e]),NH=3e3;function OH(e,t,n){const r=Re(),[i,s]=v.useState(),[c,u]=v.useState(n?.subscriptionProps),f=v.useRef(!1),h=v.useRef(void 0),m=v.useRef(void 0),g=v.useRef(void 0),y=v.useRef(t);y.current=t;const x=v.useRef(n?.onWebSocketOpen);x.current=n?.onWebSocketOpen;const S=v.useRef(n?.onWebSocketClose);S.current=n?.onWebSocketClose;const w=v.useRef(n?.onSubscriptionConnect);w.current=n?.onSubscriptionConnect;const C=v.useRef(n?.onSubscriptionDisconnect);C.current=n?.onSubscriptionDisconnect;const T=v.useRef(n?.onError);T.current=n?.onError,v.useEffect(()=>{$i(n?.subscriptionProps,c)||u(n?.subscriptionProps)},[c,n]),v.useEffect(()=>{h.current&&(clearTimeout(h.current),h.current=void 0);let A=!1;return(m.current!==e||!$i(g.current,c))&&(A=!0),A&&m.current&&r.unsubscribeFromCriteria(m.current,g.current),m.current=e,g.current=c,A&&e?s(r.subscribeToCriteria(e,c)):e||s(void 0),()=>{h.current=setTimeout(()=>{s(void 0),e&&r.unsubscribeFromCriteria(e,c)},NH)}},[r,e,c]);const R=v.useCallback(A=>{y.current?.(A.payload)},[]),E=v.useCallback(()=>{x.current?.()},[]),_=v.useCallback(()=>{S.current?.()},[]),P=v.useCallback(A=>{w.current?.(A.payload.subscriptionId)},[]),O=v.useCallback(A=>{C.current?.(A.payload.subscriptionId)},[]),k=v.useCallback(A=>{T.current?.(A.payload)},[]);v.useEffect(()=>i?(f.current||(i.addEventListener("message",R),i.addEventListener("open",E),i.addEventListener("close",_),i.addEventListener("connect",P),i.addEventListener("disconnect",O),i.addEventListener("error",k),f.current=!0),()=>{f.current=!1,i.removeEventListener("message",R),i.removeEventListener("open",E),i.removeEventListener("close",_),i.removeEventListener("connect",P),i.removeEventListener("disconnect",O),i.removeEventListener("error",k)}):()=>{},[i,R,E,_,P,O,k])}function MH(e){const t=Re(),{resourceType:n,countCriteria:r,subscriptionCriteria:i}=e,[s,c]=v.useState(0),u=v.useCallback(f=>{t.search(n,r,{cache:f}).then(h=>c(h.total)).catch(console.error)},[t,n,r]);return v.useEffect(()=>{u("default")},[u]),OH(i,()=>{u("reload")}),s}function Wt(e,t){const n=Re(),[r,i]=v.useState(()=>oR(n,e)),s=v.useCallback(c=>{$i(c,r)||i(c)},[r]);return v.useEffect(()=>{let c=!0;const u=oR(n,e);return!u&&Ma(e)?n.readReference(e).then(f=>{c&&s(f)}).catch(f=>{c&&(s(void 0),t&&t(rn(f)))}):s(u),(()=>c=!1)},[n,e,s,t]),r}function oR(e,t){if(t){if(Oa(t))return t;if(Ma(t))return e.getCachedReference(t)}}const gt={group:"group",display:"display",boolean:"boolean",decimal:"decimal",integer:"integer",date:"date",dateTime:"dateTime",time:"time",string:"string",text:"text",url:"url",choice:"choice",openChoice:"open-choice",attachment:"attachment",reference:"reference",quantity:"quantity"},DS=`${Gi}/fhir/StructureDefinition/questionnaire-itemControl`,LH=`${Gi}/fhir/StructureDefinition/questionnaire-referenceFilter`,eb=`${Gi}/fhir/StructureDefinition/questionnaire-referenceResource`,IH=`${Gi}/fhir/StructureDefinition/questionnaire-validationError`,zH=`${Gi}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression`,$H=`${Gi}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression`,UH=`${Gi}/fhir/StructureDefinition/questionnaire-signatureRequired`,Rp=`${Gi}/fhir/StructureDefinition/questionnaireresponse-signature`,BH=`${Gi}/fhir/StructureDefinition/questionnaire-hidden`;function VH(e){return e.type==="choice"||e.type==="open-choice"}function FH(e,t){if(po(e,BH)?.valueBoolean===!0)return!1;const r=HH(e,t);return r!==void 0?r:qH(e,t)}function HH(e,t){const n=po(e,zH);if(t&&n){const r=n.valueExpression?.expression;if(r){const i=mi(t),s=js(r,[i],{"%resource":i});return ko(s)}}}function qH(e,t){if(!e.enableWhen)return!0;const n=e.enableBehavior??"any";for(const r of e.enableWhen){const i=Xk(t?.item,r.question);if(r.operator==="exists"&&!r.answerBoolean&&!i?.length){if(n==="any")return!0;continue}const{anyMatch:s,allMatch:c}=XH(r,i,n);if(n==="any"&&s)return!0;if(n==="all"&&!c)return!1}return n!=="any"}function Yk(e,t,n=t.item){for(const r of e){const i=n?.find(s=>s.linkId===r.linkId);i&&(GH(t,r,i),r.item&&i.item&&Yk(r.item,t,i.item))}}function GH(e,t,n){try{const r=YH(t,e);if(!r)return;const i=QH(t,r);if(!i)return;n.answer=[i]}catch(r){n.extension=[{url:IH,valueString:`Expression evaluation failed: ${We(r)}`}]}}const WH={[gt.boolean]:[re.boolean],[gt.date]:[re.date],[gt.dateTime]:[re.dateTime],[gt.time]:[re.time],[gt.url]:[re.string,re.uri,re.url],[gt.attachment]:[re.Attachment],[gt.reference]:[re.Reference],[gt.quantity]:[re.Quantity],[gt.decimal]:[re.decimal,re.integer],[gt.integer]:[re.decimal,re.integer]};function QH(e,t){if(!e.type)return;if(e.type===gt.choice||e.type===gt.openChoice)return{[`value${Xn(t.type)}`]:t.value};if(e.type===gt.string||e.type===gt.text)return typeof t.value=="string"?{valueString:t.value}:void 0;if(WH[e.type]?.includes(t.type))return{[`value${Xn(e.type)}`]:t.value}}function YH(e,t){if(!t)return;const n=po(e,$H);if(n){const r=n.valueExpression?.expression;if(r){const i=mi(t),s=js(r,[i],{"%resource":i});return s.length!==0?s[0]:void 0}}}function Kk(e,t,n){const r=[];for(const i of e){const s=n.answerOption?.find(c=>El(Uo(c))===i);if(s){const c=Uo(s);c&&r.push({[t]:c.value})}}return r}function Xk(e,t){for(const n of e??Cr){if(n.linkId===t)return n.answer;if(n.item){const r=Xk(n.item,t);if(r)return r}}}function KH(e,t,n){if(n==="exists")return!!e===t.value;if(e){const r=n==="="||n==="!="?n?.replace("=","~"):n,[{value:i}]=js(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return i}else return!1}function XH(e,t,n){const r=t||[],i=eq(e);let s=!1,c=!0;for(const u of r){const f=tq(u),{operator:h}=e;if(KH(f,i,h)?s=!0:c=!1,n==="any"&&s)break}return{anyMatch:s,allMatch:c}}function Jk(e){const t=po(e,eb);if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return t.valueCodeableConcept?.coding?.map(n=>n.code)}}function ox(e,t){const n=gi(e);let r=po(n,eb);return!t||t.length===0?(r&&(n.extension=n.extension?.filter(i=>i!==r)),n):(r||(n.extension??=[],r={url:eb},n.extension.push(r)),t.length===1?(r.valueCode=t[0],delete r.valueCodeableConcept):(r.valueCodeableConcept={coding:t.map(i=>({code:i}))},delete r.valueCode),n)}function JH(e,t,n){const r=po(e,LH);if(!r?.valueString)return;let i=r.valueString;t?.reference&&(i=i.replaceAll("$subj",t.reference)),n?.reference&&(i=i.replaceAll("$encounter",n.reference));const s={},c=i.split("&");for(const u of c){const[f,h]=Yx(u,"=",2);s[f]=h}return s}function aR(e,t){return{resourceType:"QuestionnaireResponse",questionnaire:e.url??$t(e),item:AS(e.item,t?.item),status:"in-progress"}}function AS(e,t){let n;for(const r of e??Cr){if(r.type===gt.display)continue;const i=t?.filter(s=>s.linkId===r.linkId);if(i?.length)for(const s of i)s.id=s.id??eP(),s.text=s.text??r.text,s.item=AS(r.item,s.item),s.answer=tP(r,s),n=ul(n,s);else n=ul(n,Zk(r))}return n}function Zk(e){return{id:eP(),linkId:e.linkId,text:e.text,item:AS(e.item,void 0),answer:tP(e)}}let ZH=1;function eP(){return"id-"+ZH++}function tP(e,t){if(!(e.type===gt.display||e.type===gt.group)){if(t?.answer&&t.answer.length>0)return t.answer;if(e.initial&&e.initial.length>0)return e.initial.map(n=>({...n}));if(e.answerOption)return e.answerOption.filter(n=>n.initialSelected).map(n=>({...n,initialSelected:void 0}))}}function kS(e){return Tf({value:e},"value")}function Uo(e){return Tf({value:e},"value")}function eq(e){return Tf({value:e},"answer")}function tq(e){return Tf({value:e},"value")}function nq(e){const t=Wt(e.questionnaire),n=Wt(e.defaultValue),[,r]=v.useReducer(S=>S+1,0),i=v.useRef({activePage:0});if(!i.current.questionnaire&&t&&(i.current.questionnaire=t,i.current.pages=e.disablePagination?void 0:rq(t)),t&&e.defaultValue&&n&&!i.current.questionnaireResponse&&(i.current.questionnaireResponse=aR(t,n),x()),t&&!e.defaultValue&&!i.current.questionnaireResponse&&(i.current.questionnaireResponse=aR(t),x()),!i.current.questionnaire||!i.current.questionnaireResponse)return{loading:!0};function s(S,w){let C=i.current.questionnaireResponse;for(const T of S)C=C?.item?.find(R=>T.id?R.id===T.id:R.linkId===T.linkId);return w&&(C=C?.item?.find(T=>T.linkId===w.linkId)),C}function c(){i.current.activePage=(i.current.activePage??0)+1,r()}function u(){i.current.activePage=(i.current.activePage??0)-1,r()}function f(S,w){const C=s(S);C&&(C.item??=[],C.item.push(Zk(w)),x())}function h(S,w){const C=s(S,w);C&&(C.answer??=[],C.answer.push({}),x())}function m(S,w,C){const T=s(S,w);T&&(T.answer=C,x())}function g(S){const w=i.current.questionnaireResponse;w&&(S?(w.extension=w.extension??[],w.extension=w.extension.filter(C=>C.url!==Rp),w.extension.push({url:Rp,valueSignature:S})):w.extension=w.extension?.filter(C=>C.url!==Rp),x())}function y(){const S=i.current.questionnaire;if(S?.item){const w=i.current.questionnaireResponse;Yk(S.item,w)}}function x(){const S=i.current.questionnaireResponse;S&&(y(),r(),e.onChange?.(S))}return{loading:!1,pagination:!!i.current.pages,questionnaire:i.current.questionnaire,questionnaireResponse:i.current.questionnaireResponse,subject:e.subject,encounter:e.encounter,activePage:i.current.activePage,pages:i.current.pages,items:iq(i.current.questionnaire,i.current.pages,i.current.activePage),responseItems:oq(i.current.questionnaireResponse,i.current.pages,i.current.activePage),onNextPage:c,onPrevPage:u,onAddGroup:f,onAddAnswer:h,onChangeAnswer:m,onChangeSignature:g}}function rq(e){if(!(!e?.item||po(e?.item?.[0],DS)?.valueCodeableConcept?.coding?.[0]?.code!=="page"))return e.item.map((n,r)=>({linkId:n.linkId,title:n.text??`Page ${r+1}`,group:n}))}function iq(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function oq(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function aq(e,t,n={leading:!1}){const[r,i]=v.useState(e),s=v.useRef(!1),c=v.useRef(void 0),u=v.useRef(!1),f=v.useCallback(()=>window.clearTimeout(c.current),[]);return v.useEffect(()=>{s.current&&(!u.current&&n.leading?(u.current=!0,i(e)):(f(),c.current=setTimeout(()=>{u.current=!1,i(e)},t)))},[e,n.leading,t,f]),v.useEffect(()=>(s.current=!0,f),[f]),[r,f]}const sq=250;function lq(e,t,n){return nP("searchOne",e,t)}function lu(e,t,n){return nP("searchResources",e,t)}function nP(e,t,n,r){const i=Re(),[s,c]=v.useState(!0),[u,f]=v.useState(),[h,m]=v.useState(),g=i.fhirSearchUrl(t,n).toString(),y=v.useMemo(()=>({resourceType:t,query:n}),[g]),x=sq,[S]=aq(y,x,{leading:!0});return v.useEffect(()=>{let w=!0;return i[e](S.resourceType,S.query).then(C=>{w&&(c(!1),f(C),m(eU))}).catch(C=>{w&&(c(!1),f(void 0),m(rn(C)))}),()=>{w=!1}},[i,e,S]),[u,s,h]}function cq(e){const t=e.value;return t?a.jsx(a.Fragment,{children:Ek(t)}):null}const rP=["meta","implicitRules","contained","extension","modifierExtension"],iP=["language","text"],gn=v.createContext({path:"",profileUrl:void 0,elements:Object.create(null),elementsByPath:Object.create(null),getExtendedProps:()=>({readonly:!1,hidden:!1}),accessPolicyResource:void 0,debugMode:!1,isDefaultContext:!0});gn.displayName="ElementsContext";const PS=["extension","modifierExtension"],uq=["id",...rP].filter(e=>!PS.includes(e));function dq(e){return Object.entries(e).filter(([n,r])=>!In(r.type)||r.max===0||r.path.toLowerCase().endsWith("extension.url")&&r.fixed||PS.includes(n)&&!In(r.slicing?.slices)||uq.includes(n)?!1:!(iP.includes(n)&&r.path.split(".").length===2||n.includes(".")))}function sR(e,t){return e.line&&e.line.length>t?e.line[t]:""}function lR(e,t,n){const r=e.line||[];for(;r.length<=t;)r.push("");return r[t]=n,{...e,line:OB(r)}}function fq(e){const[t,n]=v.useState(e.defaultValue||{}),r=v.useRef(t);r.current=t;const{getExtendedProps:i}=v.useContext(gn),[s,c,u,f,h,m,g]=v.useMemo(()=>["use","type","line1","line2","city","state","postalCode"].map(_=>i(e.path+"."+_)),[i,e.path]);function y(_){n(_),e.onChange&&e.onChange(_)}function x(_){y({...r.current,use:_})}function S(_){y({...r.current,type:_})}function w(_){y(lR(r.current||{},0,_))}function C(_){y(lR(r.current||{},1,_))}function T(_){y({...r.current,city:_})}function R(_){y({...r.current,state:_})}function E(_){y({...r.current,postalCode:_})}return a.jsxs(xe,{gap:"xs",wrap:"nowrap",grow:!0,children:[a.jsx(pn,{disabled:e.disabled||s?.readonly,"data-testid":"address-use",defaultValue:t.use,onChange:_=>x(_.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(pn,{disabled:e.disabled||c?.readonly,"data-testid":"address-type",defaultValue:t.type,onChange:_=>S(_.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(Fe,{disabled:e.disabled||u?.readonly,placeholder:"Line 1",defaultValue:sR(t,0),onChange:_=>w(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||f?.readonly,placeholder:"Line 2",defaultValue:sR(t,1),onChange:_=>C(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||h?.readonly,placeholder:"City",defaultValue:t.city,onChange:_=>T(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||m?.readonly,placeholder:"State",defaultValue:t.state,onChange:_=>R(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||g?.readonly,placeholder:"Postal Code",defaultValue:t.postalCode,onChange:_=>E(_.currentTarget.value)})]})}function hq(e){const t=_f(),[n,r]=v.useState(e.defaultValue||{});function i(s){const c=s?{text:s,authorReference:t&&nn(t),time:new Date().toISOString()}:{};r(c),e.onChange&&e.onChange(c)}return a.jsx(Fe,{disabled:e.disabled,name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:s=>i(s.currentTarget.value)})}var pq={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};const Ue=(e,t,n,r)=>{const i=v.forwardRef(({color:s="currentColor",size:c=24,stroke:u=2,title:f,className:h,children:m,...g},y)=>v.createElement("svg",{ref:y,...pq[e],width:c,height:c,className:["tabler-icon",`tabler-icon-${t}`,h].join(" "),...e==="filled"?{fill:s}:{strokeWidth:u,stroke:s},...g},[f&&v.createElement("title",{key:"svg-title"},f),...r.map(([x,S])=>v.createElement(x,S)),...Array.isArray(m)?m:[m]]));return i.displayName=`${n}`,i};const mq=[["path",{d:"M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]],gq=Ue("outline","adjustments-horizontal","AdjustmentsHorizontal",mq);const vq=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]],Ns=Ue("outline","alert-circle","AlertCircle",vq);const yq=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 13l-6 6",key:"svg-1"}],["path",{d:"M6 13l6 6",key:"svg-2"}]],xq=Ue("outline","arrow-down","ArrowDown",yq);const bq=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 11l-6 -6",key:"svg-1"}],["path",{d:"M6 11l6 -6",key:"svg-2"}]],Sq=Ue("outline","arrow-up","ArrowUp",bq);const jq=[["path",{d:"M5 19h14m1.986 -1.977a2 2 0 0 0 -.146 -.773l-7.1 -12.25a2 2 0 0 0 -3.5 0l-.815 1.405m-1.488 2.568l-4.797 8.277a2 2 0 0 0 1.75 2.75",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]],wq=Ue("outline","bleach-off","BleachOff",jq);const Cq=[["path",{d:"M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75",key:"svg-0"}]],Eq=Ue("outline","bleach","Bleach",Cq);const Tq=[["path",{d:"M18 7v14l-6 -4l-6 4v-14a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4",key:"svg-0"}]],Rq=Ue("outline","bookmark","Bookmark",Tq);const _q=[["path",{d:"M7 5a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]],Dq=Ue("outline","box-multiple","BoxMultiple",_q);const Aq=[["path",{d:"M7 4h-4v16h4",key:"svg-0"}],["path",{d:"M17 4h4v16h-4",key:"svg-1"}],["path",{d:"M8 16h.01",key:"svg-2"}],["path",{d:"M12 16h.01",key:"svg-3"}],["path",{d:"M16 16h.01",key:"svg-4"}]],kq=Ue("outline","brackets-contain","BracketsContain",Aq);const Pq=[["path",{d:"M9 7a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-0"}],["path",{d:"M14 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M4 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-2"}]],Nq=Ue("outline","brand-asana","BrandAsana",Pq);const Oq=[["path",{d:"M3 9a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -9",key:"svg-0"}],["path",{d:"M8 7v-2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v2",key:"svg-1"}],["path",{d:"M12 12l0 .01",key:"svg-2"}],["path",{d:"M3 13a20 20 0 0 0 18 0",key:"svg-3"}]],Mq=Ue("outline","briefcase","Briefcase",Oq);const Lq=[["path",{d:"M5.029 5.036c-.655 .58 -1.029 1.25 -1.029 1.964c0 2.033 3.033 3.712 6.96 3.967m3.788 -.21c3.064 -.559 5.252 -2.029 5.252 -3.757c0 -2.21 -3.582 -4 -8 -4c-1.605 0 -3.1 .236 -4.352 .643",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.1 -.3 .252 -.812 .457 -1.535m.862 -3.146c.262 -.975 .735 -2.76 1.418 -5.354a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],Iq=Ue("outline","bucket-off","BucketOff",Lq);const zq=[["path",{d:"M4 7a8 4 0 1 0 16 0a8 4 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}]],$q=Ue("outline","bucket","Bucket",zq);const Uq=[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]],Bq=Ue("outline","building","Building",Uq);const Vq=[["path",{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12",key:"svg-0"}],["path",{d:"M16 3v4",key:"svg-1"}],["path",{d:"M8 3v4",key:"svg-2"}],["path",{d:"M4 11h16",key:"svg-3"}],["path",{d:"M11 15h1",key:"svg-4"}],["path",{d:"M12 15v3",key:"svg-5"}]],ls=Ue("outline","calendar","Calendar",Vq);const Fq=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],Go=Ue("outline","check","Check",Fq);const Hq=[["path",{d:"M9 11l3 3l8 -8",key:"svg-0"}],["path",{d:"M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9",key:"svg-1"}]],qq=Ue("outline","checkbox","Checkbox",Hq);const Gq=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],NS=Ue("outline","chevron-down","ChevronDown",Gq);const Wq=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]],Qq=Ue("outline","circle-check","CircleCheck",Wq);const Yq=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l6 0",key:"svg-1"}]],Qp=Ue("outline","circle-minus","CircleMinus",Yq);const Kq=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M9 12h6",key:"svg-1"}],["path",{d:"M12 9v6",key:"svg-2"}]],Yd=Ue("outline","circle-plus","CirclePlus",Kq);const Xq=[["path",{d:"M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1",key:"svg-0"}],["path",{d:"M9 15l3 -3l3 3",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}]],OS=Ue("outline","cloud-upload","CloudUpload",Xq);const Jq=[["path",{d:"M4 6l5.5 0",key:"svg-0"}],["path",{d:"M4 10l5.5 0",key:"svg-1"}],["path",{d:"M4 14l5.5 0",key:"svg-2"}],["path",{d:"M4 18l5.5 0",key:"svg-3"}],["path",{d:"M14.5 6l5.5 0",key:"svg-4"}],["path",{d:"M14.5 10l5.5 0",key:"svg-5"}],["path",{d:"M14.5 14l5.5 0",key:"svg-6"}],["path",{d:"M14.5 18l5.5 0",key:"svg-7"}]],Zq=Ue("outline","columns","Columns",Jq);const eG=[["path",{d:"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]],MS=Ue("outline","copy","Copy",eG);const tG=[["path",{d:"M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2",key:"svg-0"}],["path",{d:"M12 3v3m0 12v3",key:"svg-1"}]],nG=Ue("outline","currency-dollar","CurrencyDollar",tG);const rG=[["path",{d:"M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 6v6a8 3 0 0 0 16 0v-6",key:"svg-1"}],["path",{d:"M4 12v6a8 3 0 0 0 16 0v-6",key:"svg-2"}]],iG=Ue("outline","database","Database",rG);const oG=[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]],aG=Ue("outline","device-floppy","DeviceFloppy",oG);const sG=[["path",{d:"M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],lG=Ue("outline","dots","Dots",sG);const cG=[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]],oP=Ue("outline","edit","Edit",cG);const uG=[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]],wu=Ue("outline","equal-not","EqualNot",uG);const dG=[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]],_l=Ue("outline","equal","Equal",dG);const fG=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],hG=Ue("outline","eye-off","EyeOff",fG);const pG=[["path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6",key:"svg-1"}]],mG=Ue("outline","eye","Eye",pG);const gG=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M12 17l.01 0",key:"svg-2"}],["path",{d:"M12 11l0 3",key:"svg-3"}]],cR=Ue("outline","file-alert","FileAlert",gG);const vG=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]],yG=Ue("outline","file-plus","FilePlus",vG);const xG=[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}]],bG=Ue("outline","filter","Filter",xG);const SG=[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]],jG=Ue("outline","folder","Folder",SG);const wG=[["path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3",key:"svg-0"}],["path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3",key:"svg-1"}],["path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7",key:"svg-2"}],["path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1",key:"svg-3"}],["path",{d:"M17 12h.01",key:"svg-4"}],["path",{d:"M13 12h.01",key:"svg-5"}]],CG=Ue("outline","forms","Forms",wG);const EG=[["path",{d:"M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10",key:"svg-0"}],["path",{d:"M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 8l2 0",key:"svg-2"}],["path",{d:"M15 12l2 0",key:"svg-3"}],["path",{d:"M7 16l10 0",key:"svg-4"}]],TG=Ue("outline","id","Id",EG);const RG=[["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-0"}],["path",{d:"M9 4l0 16",key:"svg-1"}]],_G=Ue("outline","layout-sidebar","LayoutSidebar",RG);const DG=[["path",{d:"M13 5h8",key:"svg-0"}],["path",{d:"M13 9h5",key:"svg-1"}],["path",{d:"M13 15h8",key:"svg-2"}],["path",{d:"M13 19h5",key:"svg-3"}],["path",{d:"M3 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-4"}],["path",{d:"M3 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-5"}]],uR=Ue("outline","list-details","ListDetails",DG);const AG=[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M8 12a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1l0 -3",key:"svg-4"}],["path",{d:"M10 11v-2a2 2 0 1 1 4 0v2",key:"svg-5"}]],kG=Ue("outline","lock-access","LockAccess",AG);const PG=[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]],NG=Ue("outline","lock","Lock",PG);const OG=[["path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M9 12h12l-3 -3",key:"svg-1"}],["path",{d:"M18 15l3 -3",key:"svg-2"}]],MG=Ue("outline","logout","Logout",OG);const LG=[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]],aP=Ue("outline","math-greater","MathGreater",LG);const IG=[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]],sP=Ue("outline","math-lower","MathLower",IG);const zG=[["path",{d:"M8 9h8",key:"svg-0"}],["path",{d:"M8 13h6",key:"svg-1"}],["path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12",key:"svg-2"}]],$G=Ue("outline","message","Message",zG);const UG=[["path",{d:"M5 21h14",key:"svg-0"}],["path",{d:"M6 18h2",key:"svg-1"}],["path",{d:"M7 18v3",key:"svg-2"}],["path",{d:"M9 11l3 3l6 -6l-3 -3l-6 6",key:"svg-3"}],["path",{d:"M10.5 12.5l-1.5 1.5",key:"svg-4"}],["path",{d:"M17 3l3 3",key:"svg-5"}],["path",{d:"M12 21a6 6 0 0 0 3.715 -10.712",key:"svg-6"}]],BG=Ue("outline","microscope","Microscope",UG);const VG=[["path",{d:"M5 12l14 0",key:"svg-0"}]],FG=Ue("outline","minus","Minus",VG);const HG=[["path",{d:"M7 16.5l-5 -3l5 -3l5 3v5.5l-5 3l0 -5.5",key:"svg-0"}],["path",{d:"M2 13.5v5.5l5 3",key:"svg-1"}],["path",{d:"M7 16.545l5 -3.03",key:"svg-2"}],["path",{d:"M17 16.5l-5 -3l5 -3l5 3v5.5l-5 3l0 -5.5",key:"svg-3"}],["path",{d:"M12 19l5 3",key:"svg-4"}],["path",{d:"M17 16.5l5 -3",key:"svg-5"}],["path",{d:"M12 13.5v-5.5l-5 -3l5 -3l5 3v5.5",key:"svg-6"}],["path",{d:"M7 5.03v5.455",key:"svg-7"}],["path",{d:"M12 8l5 -3",key:"svg-8"}]],qG=Ue("outline","packages","Packages",HG);const GG=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],WG=Ue("outline","pencil","Pencil",GG);const QG=[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]],YG=Ue("outline","pin","Pin",QG);const KG=[["path",{d:"M3 3l18 18",key:"svg-0"}],["path",{d:"M15 4.5l-3.249 3.249m-2.57 1.433l-2.181 .818l-1.5 1.5l7 7l1.5 -1.5l.82 -2.186m1.43 -2.563l3.25 -3.251",key:"svg-1"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-2"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-3"}]],XG=Ue("outline","pinned-off","PinnedOff",KG);const JG=[["path",{d:"M7 4v16l13 -8l-13 -8",key:"svg-0"}]],ZG=Ue("outline","player-play","PlayerPlay",JG);const eW=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],tW=Ue("outline","plus","Plus",eW);const nW=[["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16l-3 -2l-2 2l-2 -2l-2 2l-2 -2l-3 2m4 -14h6m-6 4h6m-2 4h2",key:"svg-0"}]],rW=Ue("outline","receipt","Receipt",nW);const iW=[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]],lP=Ue("outline","refresh","Refresh",iW);const oW=[["path",{d:"M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3",key:"svg-0"}],["path",{d:"M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3",key:"svg-1"}]],aW=Ue("outline","repeat","Repeat",oW);const sW=[["path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",key:"svg-0"}],["path",{d:"M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2",key:"svg-1"}],["path",{d:"M10 14l4 0",key:"svg-2"}],["path",{d:"M12 12l0 4",key:"svg-3"}]],lW=Ue("outline","report-medical","ReportMedical",sW);const cW=[["path",{d:"M3 15a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -4",key:"svg-0"}],["path",{d:"M17 17l0 .01",key:"svg-1"}],["path",{d:"M13 17l0 .01",key:"svg-2"}],["path",{d:"M15 13l0 -2",key:"svg-3"}],["path",{d:"M11.75 8.75a4 4 0 0 1 6.5 0",key:"svg-4"}],["path",{d:"M8.5 6.5a8 8 0 0 1 13 0",key:"svg-5"}]],uW=Ue("outline","router","Router",cW);const dW=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]],ng=Ue("outline","search","Search",dW);const fW=[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]],tb=Ue("outline","settings","Settings",fW);const hW=[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],LS=Ue("outline","sort-ascending","SortAscending",hW);const pW=[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],IS=Ue("outline","sort-descending","SortDescending",pW);const mW=[["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14",key:"svg-0"}]],gW=Ue("outline","square","Square",mW);const vW=[["path",{d:"M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873l-6.158 -3.245",key:"svg-0"}]],yW=Ue("outline","star","Star",vW);const xW=[["path",{d:"M16 3l4 4l-4 4",key:"svg-0"}],["path",{d:"M10 7l10 0",key:"svg-1"}],["path",{d:"M8 13l-4 4l4 4",key:"svg-2"}],["path",{d:"M4 17l9 0",key:"svg-3"}]],bW=Ue("outline","switch-horizontal","SwitchHorizontal",xW);const SW=[["path",{d:"M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}],["path",{d:"M16 19h6",key:"svg-3"}],["path",{d:"M19 16l3 3l-3 3",key:"svg-4"}]],jW=Ue("outline","table-export","TableExport",SW);const wW=[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M12 16v-7",key:"svg-4"}],["path",{d:"M9 9h6",key:"svg-5"}]],CW=Ue("outline","text-recognition","TextRecognition",wW);const EW=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],rg=Ue("outline","trash","Trash",EW);const TW=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],dR=Ue("outline","upload","Upload",TW);const RW=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4",key:"svg-3"}]],_W=Ue("outline","user-plus","UserPlus",RW);const DW=[["path",{d:"M4.876 13.61a4 4 0 1 0 6.124 3.39h6",key:"svg-0"}],["path",{d:"M15.066 20.502a4 4 0 1 0 1.934 -7.502c-.706 0 -1.424 .179 -2 .5l-3 -5.5",key:"svg-1"}],["path",{d:"M16 8a4 4 0 1 0 -8 0c0 1.506 .77 2.818 2 3.5l-3 5.5",key:"svg-2"}]],AW=Ue("outline","webhook","Webhook",DW);const kW=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],ws=Ue("outline","x","X",kW);const PW=[["path",{d:"M7 3.34a10 10 0 1 1 -4.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 4.995 -8.336z",key:"svg-0"}]],NW=Ue("filled","circle-filled","CircleFilled",PW);class zS extends v.Component{state;constructor(t){super(t),this.state={lastLocation:rr.getLocation()}}static getDerivedStateFromError(t){return{error:t,lastLocation:rr.getLocation()}}componentDidUpdate(t,n){rr.getLocation()!==this.state.lastLocation&&this.setState({lastLocation:rr.getLocation(),error:void 0})}shouldComponentUpdate(t,n){return!!(this.props.children!==t.children||n.error&&!this.state.error||this.state.lastLocation!==rr.getLocation())}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.error?a.jsx(qo,{icon:a.jsx(Ns,{size:16}),title:"Something went wrong",color:"red",children:We(this.state.error)}):this.props.children}}function Ui(){return a.jsx(Ao,{style:{width:"100%",height:"100vh"},children:a.jsx(Pr,{})})}const OW="_main_6f7o5_1",MW={main:OW};function jn(e){e.preventDefault(),e.stopPropagation()}function $S(e){return e.button===1||e.ctrlKey||e.metaKey}function cP(e){if(fR(e))return!0;if(e instanceof HTMLTableCellElement){const t=e.children;if(t.length===1&&fR(t[0]))return!0}return!1}function fR(e){return e instanceof HTMLInputElement&&e.type==="checkbox"}async function kd(e,t){return new Promise((n,r)=>{const i=new MessageChannel;i.port1.onmessage=({data:s})=>{i.port1.close(),s.error?r(s.error):n(s.result)},e.contentWindow?.postMessage(t,new URL(e.src).origin,[i.port2])})}function uP(e,t){const n=new Blob([e],{type:tn.JSON}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r;const s=t??new Date().toISOString().replaceAll(/\D/g,"");i.download=`${s}.json`,document.body.appendChild(i),i.click(),URL.revokeObjectURL(r)}function jt(e){const t=ju(),{to:n,suffix:r,label:i,onClick:s,children:c,...u}=e;let f=LW(n);return r&&(f+="/"+r),a.jsx(wt,{href:f,"aria-label":i,onAuxClick:h=>{h.stopPropagation()},onClick:h=>{h.stopPropagation(),s?(h.preventDefault(),s(h)):n&&($S(h)||(h.preventDefault(),t(f)))},...u,children:c})}function LW(e){if(e){if(typeof e=="string")return IW(e);if(Oa(e))return zW(e);if(Ma(e))return $W(e)}return"#"}function IW(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function zW(e){return`/${e.resourceType}/${e.id}`}function $W(e){return`/${e.reference}`}function UW(e){const t=e.split(" ").filter(Boolean);return t.length>1?t[0][0]+t.at(-1)?.at(0):t.length===1?t[0][0]:""}function mo(e){const t=Wt(e.value),n=t?Ea(t):e.alt??"",r=UW(n),i=(t&&AB(t))??e.src,s=Qk(i??void 0),c=e.radius??"xl",u={...e,value:void 0,link:void 0};return e.link?a.jsx(jt,{to:t,children:a.jsx(iu,{src:s,alt:n,radius:c,...u,children:r})}):a.jsx(iu,{src:s,alt:n,radius:c,...u,children:r})}const BW="_logoButton_799cf_1",VW="_user_799cf_11",FW="_userName_799cf_25",ax={logoButton:BW,user:VW,userName:FW};function US(e){const t=e.value;return t?a.jsx(a.Fragment,{children:Na(t,e.options)}):null}function dP(){return"Medplum"}function fP(e){const t=tg(),{medplum:n,profile:r,navigate:i}=t,s=n.getLogins(),{colorScheme:c,setColorScheme:u}=$5(),[f]=v.useState(localStorage.appShellLayoutVersion??"v1"),h=e.showLayoutVersionToggle??!0;function m(g){localStorage.appShellLayoutVersion=g,rr.reload()}return a.jsxs(a.Fragment,{children:[a.jsxs(Ne,{align:"center",p:"xl",children:[a.jsx(mo,{size:"xl",radius:100,value:t.profile}),a.jsx(US,{value:t.profile?.name?.[0]}),a.jsx(ge,{c:"dimmed",size:"xs",children:n.getActiveLogin()?.project.display})]}),s.length>1&&a.jsx(be.Divider,{}),s.map(g=>g.profile.reference!==$t(t.profile)&&a.jsx(be.Item,{onClick:()=>{n.setActiveLogin(g).then(()=>rr.reload()).catch(console.log)},children:a.jsxs(xe,{children:[a.jsx(iu,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(ge,{size:"sm",fw:500,children:g.profile.display}),a.jsx(ge,{c:"dimmed",size:"xs",children:g.project.display})]})]})},g.profile.reference)),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(bW,{size:14,stroke:1.5}),onClick:()=>i("/signin"),children:"Switch to another project"}),a.jsx(be.Divider,{}),a.jsxs(xe,{justify:"center",children:[a.jsx(Cl,{size:"xs",value:c,onChange:g=>u(g),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]}),h&&a.jsx(Cl,{size:"xs",value:f,onChange:g=>m(g),data:[{label:"v1",value:"v1"},{label:"v2",value:"v2"}]})]}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(tb,{size:14,stroke:1.5}),onClick:()=>i(`/${$t(r)}`),children:"Account settings"}),a.jsx(be.Item,{leftSection:a.jsx(MG,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),i("/signin")},children:"Sign out"}),a.jsxs(ge,{size:"xs",c:"dimmed",my:"sm",ta:"center",children:[dP()," ",e.version]})]})}const hR={selectedItems:"selected-items",options:"options"};function BS(e){const t=$l({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{name:n,label:r,description:i,error:s,defaultValue:c,toOption:u,loadOptions:f,itemComponent:h,pillComponent:m,emptyComponent:g,onChange:y,onCreate:x,creatable:S,clearable:w,required:C,placeholder:T,leftSection:R,maxValues:E,optionsDropdownMaxHeight:_=320,minInputLength:P=0,...O}=e,k=O.disabled,A=HW(c),[z,U]=v.useState(""),[K,W]=v.useState(),[ee,B]=v.useState(),[G,L]=v.useState(),[I,$]=v.useState(A.map(u)),[V,X]=v.useState([]),M=h??qW,F=m??GW,ie=g??WW,de=v.useRef(z);de.current=z;const Se=v.useRef(void 0),Ce=v.useRef(void 0),je=v.useRef(K);je.current=K;const Ke=v.useRef(ee);Ke.current=ee;const _e=v.useRef(G);_e.current=G;const ht=v.useRef(V);ht.current=V;const Ct=v.useCallback(()=>{if(W(void 0),de.current===Ce.current&&f===Se.current||(de.current?.length??0)<P)return;Ce.current=de.current,Se.current=f;const Ie=new AbortController;B(Ie),f(de.current??"",Ie.signal).then(at=>{Ie.signal.aborted||(X(at.map(u)),_e.current?(at.length>0&&y(at.slice(0,1)),L(!1)):at.length>0&&t.openDropdown())}).catch(at=>{Ie.signal.aborted||at.message.includes("aborted")||Ae({color:"red",message:We(at)})}).finally(()=>{Ie.signal.aborted||B(void 0)})},[t,f,y,u,P]),Et=v.useCallback(Ie=>{(V&&V.length>0||S)&&t.openDropdown(),t.updateSelectedOptionIndex(),U(Ie.currentTarget.value),Ke.current&&(Ke.current.abort(),B(void 0)),je.current!==void 0&&window.clearTimeout(je.current);const at=window.setTimeout(()=>Ct(),100);W(at)},[t,V,S,Ct]),qe=v.useCallback(Ie=>{const at=I.some(ft=>ft.value===Ie),Ze=at?I.filter(ft=>ft.value!==Ie):[...I];let dt=V?.find(ft=>ft.value===Ie);if(!dt&&S!==!1&&x){const ft=x(Ie);dt=u(ft)}if(dt){if(E===0){y([dt.resource]),I.length>0&&$([]);return}at||Ze.push(dt)}if(E!==void 0)for(;Ze.length>E;)Ze.shift();y(Ze.map(ft=>ft.resource)),$(Ze)},[S,V,I,E,y,x,u]),ct=v.useMemo(()=>{if(!k)return Ie=>{k||(E===1&&(U(""),X([]),t.closeDropdown()),Ce.current=void 0,Ie==="$create"?(U(""),qe(z)):qe(Ie))}},[qe,t,k,E,z]),Tt=v.useCallback(Ie=>{const at=I.filter(Ze=>Ze.value!==Ie.value);y(at.map(Ze=>Ze.resource)),$(at)},[I,y]),It=v.useCallback(Ie=>{Ie.key==="Enter"?(K||ee)&&L(!0):Ie.key==="Backspace"&&z.length===0&&(jn(Ie),Tt(I[I.length-1]))},[ee,Tt,z.length,I,K]);v.useEffect(()=>()=>{Ke.current&&Ke.current.abort()},[]);const Te=!k&&w&&I.length>0&&a.jsx(Ye.ClearButton,{title:"Clear all",size:"sm",onClear:()=>{U(""),$([]),y([]),t.closeDropdown()}}),Oe=S&&z.trim().length>0,Le=V.length>0||Oe;return a.jsxs(Ye,{store:t,onOptionSubmit:ct,withinPortal:!0,shadow:"xl",...O,children:[a.jsx(Ye.DropdownTarget,{children:a.jsx(xs,{label:r,description:i,error:s,className:e.className,leftSection:R,rightSection:ee?a.jsx(Pr,{size:16}):Te,required:C,disabled:k,children:a.jsxs(wa.Group,{"data-testid":hR.selectedItems,children:[I.map(Ie=>a.jsx(F,{item:Ie,disabled:k,onRemove:()=>Tt(Ie)},Ie.value)),!k&&(E===void 0||E===0||I.length<E)&&a.jsx(Ye.EventsTarget,{children:a.jsx(xs.Field,{role:"searchbox",name:n,value:z,placeholder:T,onFocus:Et,onBlur:()=>{t.closeDropdown(),U("")},onKeyDown:It,onChange:Et})})]})})}),a.jsx(Ye.Dropdown,{hidden:!Le,"data-testid":hR.options,children:a.jsx(Ye.Options,{children:a.jsxs(bm,{type:"scroll",mah:_,children:[V.map(Ie=>{const at=I.some(Ze=>Ze.value===Ie.value);return a.jsx(Ye.Option,{value:Ie.value,active:at,children:a.jsx(M,{...Ie,active:at})},Ie.value)}),Oe&&a.jsxs(Ye.Option,{value:"$create",children:["+ Create ",z]}),!S&&z.trim().length>0&&V.length===0&&a.jsx(ie,{search:z})]})})})]})}function HW(e){return e?Array.isArray(e)?e:[e]:[]}function qW(e){return a.jsxs(xe,{gap:"xs",children:[e.active&&a.jsx(Go,{size:12}),a.jsx("span",{children:e.label})]})}function GW({item:e,disabled:t,onRemove:n}){return a.jsx(wa,{withRemoveButton:!t,onRemove:n,children:e.label})}function WW(){return a.jsx(Ye.Empty,{children:"Nothing found"})}const QW="_searchInput_dick8_1",YW={searchInput:QW};function KW(e){return{value:e.id,label:Ea(e),resource:e}}function XW(e){const t=ju(),n=Re(),r=v.useCallback(async(s,c)=>{const u=ZW(s),f={signal:c},h=await n.graphql(u,void 0,void 0,f);return eQ(h,s)},[n]),i=v.useCallback(s=>{s.length>0&&t(`/${$t(s[0])}`)},[t]);return a.jsx(BS,{size:"sm",radius:"md",className:YW.searchInput,leftSection:a.jsx(ng,{size:16}),placeholder:"Search",itemComponent:JW,toOption:KW,onChange:i,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const JW=v.forwardRef(({resource:e,active:t,...n},r)=>{let i;return e.resourceType==="Patient"?i=e.birthDate:e.resourceType==="ServiceRequest"&&(i=e.subject?.display),a.jsx("div",{ref:r,...n,children:a.jsxs(xe,{wrap:"nowrap",children:[a.jsx(mo,{value:e}),a.jsxs("div",{children:[a.jsx(ge,{children:Ea(e)}),a.jsx(ge,{size:"xs",c:"dimmed",children:i})]})]})})});function ZW(e){const t=JSON.stringify(e);return mS(e)?`{
97
+ Patients1: PatientList(_id: ${t}, _count: 1) {
98
+ resourceType
99
+ id
100
+ identifier {
101
+ system
102
+ value
103
+ }
104
+ name {
105
+ given
106
+ family
107
+ }
108
+ birthDate
109
+ }
110
+ ServiceRequestList(_id: ${t}, _count: 1) {
111
+ resourceType
112
+ id
113
+ identifier {
114
+ system
115
+ value
116
+ }
117
+ subject {
118
+ display
119
+ }
120
+ }
121
+ }`.replaceAll(/\s+/g," "):`{
122
+ Patients1: PatientList(name: ${t}, _count: 5) {
123
+ resourceType
124
+ id
125
+ identifier {
126
+ system
127
+ value
128
+ }
129
+ name {
130
+ given
131
+ family
132
+ }
133
+ birthDate
134
+ }
135
+ Patients2: PatientList(identifier: ${t}, _count: 5) {
136
+ resourceType
137
+ id
138
+ identifier {
139
+ system
140
+ value
141
+ }
142
+ name {
143
+ given
144
+ family
145
+ }
146
+ birthDate
147
+ }
148
+ ServiceRequestList(identifier: ${t}, _count: 5) {
149
+ resourceType
150
+ id
151
+ identifier {
152
+ system
153
+ value
154
+ }
155
+ subject {
156
+ display
157
+ }
158
+ }
159
+ }`.replaceAll(/\s+/g," ")}function eQ(e,t){const n=[];return e.data.Patients1&&n.push(...e.data.Patients1),e.data.Patients2&&n.push(...e.data.Patients2),e.data.ServiceRequestList&&n.push(...e.data.ServiceRequestList),nQ(tQ(n),t).slice(0,5)}function tQ(e){const t=new Set,n=[];for(const r of e)t.has(r.id)||(t.add(r.id),n.push(r));return n}function nQ(e,t){return e.sort((n,r)=>pR(r,t)-pR(n,t))}function pR(e,t){let n=0;if(e.identifier)for(const r of e.identifier)n=Math.max(n,mR(r.value,t));if(e.resourceType==="Patient"&&e.name)for(const r of e.name)n=Math.max(n,mR(Na(r),t));return n}function mR(e,t){if(!e)return 0;const n=e.toLowerCase().indexOf(t.toLowerCase());return n<0?0:100-n}function rQ(e){const t=_f(),[n,r]=v.useState(!1);return a.jsx(kr.Header,{p:8,style:{zIndex:101},children:a.jsxs(xe,{justify:"space-between",children:[a.jsxs(xe,{gap:"xs",children:[a.jsx(An,{className:ax.logoButton,"aria-expanded":e.navbarOpen,"aria-controls":"navbar",onClick:()=>e.navbarToggle(),children:e.logo}),!e.headerSearchDisabled&&a.jsx(XW,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(xe,{gap:"lg",pr:"sm",children:[e.notifications,a.jsxs(be,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"fade-down"},opened:n,onClose:()=>r(!1),children:[a.jsx(be.Target,{children:a.jsx(An,{className:ax.user,"aria-label":"User menu","data-active":n||void 0,onClick:()=>r(i=>!i),children:a.jsxs(xe,{gap:7,children:[a.jsx(mo,{value:t,radius:"xl",size:24}),a.jsx(ge,{size:"sm",className:ax.userName,children:Na(t?.name?.[0])}),a.jsx(NS,{size:12,stroke:1.5})]})})}),a.jsx(be.Dropdown,{children:a.jsx(fP,{version:e.version})})]})]})]})})}const iQ=()=>GA({opened:!1,empty:!1,selected:-1,listId:"",query:"",registeredActions:new Set}),oQ=e=>WA(e);function cu(e,t){const n=t.getState();t.setState({...n,...e(t.getState())})}function hP(e){cu(()=>({opened:!0,selected:-1}),e)}function pP(e){cu(()=>({opened:!1}),e)}function mP(e){cu(t=>({opened:!t.opened,selected:t.opened?t.selected:-1}),e)}function gP(e,t){t.updateState(n=>({...n,selected:e}))}function aQ(e,t){t.updateState(n=>({...n,listId:e}))}function Yp(e,t=document){const n=t.querySelector(e);if(n)return n;const r=t instanceof ShadowRoot?t.host.children:t.children;for(let i=0;i<r.length;i+=1){const s=r[i];if(s.shadowRoot){const u=Yp(e,s.shadowRoot);if(u)return u}const c=Yp(e,s);if(c)return c}return null}function ig(e,t){const n=t.getState(),r=n.listId?Yp(`#${n.listId}`):null,i=r?.querySelector("[data-selected]"),s=r?.querySelectorAll("[data-action]")??[],c=e===-1?s.length-1:e===s.length?0:e,u=Dd(c,0,s.length-1);return i?.removeAttribute("data-selected"),s[u]?.scrollIntoView({block:"nearest"}),s[u]?.setAttribute("data-selected","true"),gP(u,t),u}function sQ(e){return ig(e.getState().selected+1,e)}function lQ(e){return ig(e.getState().selected-1,e)}function cQ(e){const t=e.getState();Yp(`#${t.listId} [data-selected]`)?.click()}function uQ(e,t){const n=t.getState();return n.registeredActions.add(e),()=>{n.registeredActions.delete(e)}}function dQ(e,t){cu(()=>({query:e}),t),Promise.resolve().then(()=>{ig(0,t),cu(n=>({empty:n.query.trim().length>0&&n.registeredActions.size===0||!1}),t)})}function fQ({clearQuery:e},t){t.updateState(n=>({...n,selected:-1,query:e?"":n.query,empty:e?!1:n.empty}))}const Mo={open:hP,close:pP,toggle:mP,updateState:cu,setSelectedAction:gP,setListId:aQ,selectAction:ig,selectNextAction:sQ,selectPreviousAction:lQ,triggerSelectedAction:cQ,registerAction:uQ,setQuery:dQ,clearSpotlightState:fQ};function hQ(){const e=iQ();return[e,{open:()=>hP(e),close:()=>pP(e),toggle:()=>mP(e)}]}const[vP,Df]=hQ(),{open:Nae,close:Oae,toggle:Mae}=Df;function yP(e){const t=e;return t.group!==void 0&&Array.isArray(t.actions)}function pQ(e){return Array.isArray(e)?e.map(t=>t.trim()).join(",").toLowerCase().trim():typeof e=="string"?e.toLowerCase().trim():""}function mQ(e){return e.reduce((t,n)=>"actions"in n?[...t,...n.actions.map(r=>({...r,group:n.group}))]:[...t,n],[])}function gQ(e){const t={},n=[];return e.forEach(r=>{r.group?(t[r.group]||(t[r.group]={pushed:!1,data:{group:r.group,actions:[]}}),t[r.group].data.actions.push(r),t[r.group].pushed||(t[r.group].pushed=!0,n.push(t[r.group].data))):n.push(r)}),n}const vQ=(e,t)=>{const n=e.trim().toLowerCase(),r=[[],[]];return mQ(t).forEach(s=>{s.label?.toLowerCase().includes(n)?r[0].push(s):(s.description?.toLowerCase().includes(n)||pQ(s.keywords).includes(n))&&r[1].push(s)}),gQ(r.flat())};function xP(e,t){if(!Array.isArray(e))return[];let n=0;return e.reduce((r,i)=>{if(n>=t)return r;if(yP(i)){const s=xP(i.actions,t-n);r.push({group:i.group,actions:s}),n+=s.length}else r.push(i),n+=1;return r},[])}var Bo={root:"m_d2b315db",content:"m_3cd250e0",body:"m_d2abce9b",search:"m_f366a061",actionsList:"m_6e463822",action:"m_d49bb8ef",actionBody:"m_3d475731",actionSection:"m_832642f6",actionLabel:"m_6c2a1345",actionDescription:"m_a6d9d78d",empty:"m_82f78f74",footer:"m_ddcaf054",actionsGroup:"m_5a3e5f7b"};const[yQ,Cu]=Or("Spotlight component was not found in tree"),xQ={dimmedSections:!0,highlightQuery:!1},Kd=ve((e,t)=>{const n=ae("SpotlightAction",xQ,e),{className:r,style:i,classNames:s,styles:c,id:u,description:f,label:h,leftSection:m,rightSection:g,children:y,dimmedSections:x,highlightQuery:S,highlightColor:w,closeSpotlightOnTrigger:C,onClick:T,onMouseDown:R,keywords:E,vars:_,...P}=n,O=Cu(),k={classNames:s,styles:c},A=S&&typeof h=="string"?a.jsx(_0,{component:"span",highlight:O.query,color:w,...O.getStyles("actionLabel",k),children:h}):a.jsx("span",{...O.getStyles("actionLabel",k),children:h});return a.jsx(An,{ref:t,"data-action":!0,...O.getStyles("action",{className:r,style:i,...k}),...P,onMouseDown:z=>{z.preventDefault(),R?.(z)},onClick:z=>{T?.(z),(C??O.closeOnActionTrigger)&&Mo.close(O.store)},tabIndex:-1,children:y||a.jsxs(a.Fragment,{children:[m&&a.jsx(le,{component:"span",mod:{position:"left",dimmed:x},...O.getStyles("actionSection",k),children:m}),a.jsxs("span",{...O.getStyles("actionBody",k),children:[A,a.jsx("span",{...O.getStyles("actionDescription",k),children:f})]}),g&&a.jsx(le,{component:"span",mod:{position:"right",dimmed:x},...O.getStyles("actionSection",k),children:g})]})})});Kd.classes=Bo;Kd.displayName="@mantine/spotlight/SpotlightAction";const og=ve((e,t)=>{const{className:n,style:r,styles:i,classNames:s,label:c,children:u,...f}=ae("SpotlightActionsGroup",null,e),h=Cu();return a.jsx(le,{...h.getStyles("actionsGroup",{className:n,style:r,classNames:s,styles:i}),ref:t,...f,__vars:{"--spotlight-label":`'${c?.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`},children:u})});og.classes=Bo;og.displayName="@mantine/core/SpotlightActionsGroup";const ag=ve((e,t)=>{const{className:n,style:r,id:i,children:s,vars:c,classNames:u,styles:f,...h}=ae("SpotlightActionsList",null,e),m=Cu(),g=`mantine-${v.useId().replace(/:/g,"")}`,y=i||g;return v.useEffect(()=>(Mo.setListId(y,m.store),()=>Mo.setListId("",m.store)),[]),a.jsx(ti.Autosize,{...m.getStyles("actionsList",{className:n,style:r,classNames:u,styles:f}),ref:t,type:"scroll",scrollbarSize:"var(--spotlight-actions-list-padding)",offsetScrollbars:"y",id:y,...h,children:s})});ag.classes=Bo;ag.displayName="@mantine/spotlight/SpotlightActionsList";const sg=ve((e,t)=>{const{className:n,style:r,classNames:i,styles:s,...c}=ae("SpotlightEmpty",null,e),u=Cu();return a.jsx(le,{ref:t,...u.getStyles("empty",{classNames:i,styles:s,className:n,style:r}),...c})});sg.classes=Bo;sg.displayName="@mantine/spotlight/SpotlightEmpty";const VS=ve((e,t)=>{const{className:n,style:r,classNames:i,styles:s,...c}=ae("SpotlightFooter",null,e),u=Cu();return a.jsx(le,{ref:t,...u.getStyles("footer",{className:n,classNames:i,style:r,styles:s}),...c})});VS.classes=Bo;VS.displayName="@mantine/spotlight/SpotlightFooter";function bQ(e,t){if(!e)return[];const n=()=>Mo.open(t);return Array.isArray(e)?e.map(r=>[r,n]):[[e,n]]}const SQ={size:600,yOffset:80,zIndex:Br("max"),overlayProps:{backgroundOpacity:.35,blur:7},transitionProps:{duration:200,transition:"pop"},store:vP,clearQueryOnClose:!0,closeOnActionTrigger:!0,shortcut:"mod + K",maxHeight:400},lg=ve((e,t)=>{const n=ae("SpotlightRoot",SQ,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,store:h,children:m,query:g,onQueryChange:y,transitionProps:x,clearQueryOnClose:S,shortcut:w,tagsToIgnore:C,triggerOnContentEditable:T,disabled:R,onSpotlightOpen:E,onSpotlightClose:_,forceOpened:P,closeOnActionTrigger:O,maxHeight:k,scrollable:A,attributes:z,...U}=n,K=Nn(),{opened:W,query:ee}=oQ(h),B=typeof g=="string"?g:ee,G=I=>{y?.(I),Mo.setQuery(I,h)},L=$e({name:"Spotlight",classes:Bo,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:z});return WM(bQ(w,h),C,T),jl(()=>{W?E?.():_?.()},[W]),R?null:a.jsx(yQ,{value:{getStyles:L,query:B,setQuery:G,store:h,closeOnActionTrigger:O},children:a.jsx(Mn,{ref:t,...U,withCloseButton:!1,opened:W||!!P,padding:0,onClose:()=>Mo.close(h),className:i,style:s,classNames:af({theme:K,classNames:[Bo,r],props:n,stylesCtx:void 0}),styles:Id({theme:K,styles:c,props:n,stylesCtx:void 0}),transitionProps:{...x,onExited:()=>{S&&G(""),Mo.clearSpotlightState({clearQuery:S},h),x?.onExited?.()}},__vars:{"--spotlight-max-height":A?ce(k):void 0},__staticSelector:"Spotlight","data-scrollable":A||void 0,children:m})})});lg.classes=Bo;lg.displayName="@mantine/spotlight/SpotlightRoot";const jQ={size:"lg"},cg=ve((e,t)=>{const{classNames:n,styles:r,onKeyDown:i,onChange:s,vars:c,value:u,...f}=ae("SpotlightSearch",jQ,e),h=Cu(),m=h.getStyles("search"),[g,y]=v.useState(!1),x=S=>{i?.(S),!g&&(S.nativeEvent.code==="ArrowDown"&&(S.preventDefault(),Mo.selectNextAction(h.store)),S.nativeEvent.code==="ArrowUp"&&(S.preventDefault(),Mo.selectPreviousAction(h.store)),(S.nativeEvent.code==="Enter"||S.nativeEvent.code==="NumpadEnter")&&(S.preventDefault(),Mo.triggerSelectedAction(h.store)))};return a.jsx(mn,{ref:t,classNames:[{input:m.className},n],styles:[{input:m.style},r],...f,value:u??h.query,onChange:S=>{h.setQuery(S.currentTarget.value),s?.(S)},onKeyDown:x,onCompositionStart:()=>y(!0),onCompositionEnd:()=>y(!1)})});cg.classes=Bo;cg.displayName="@mantine/spotlight/SpotlightSearch";const wQ={size:600,yOffset:80,limit:1/0,zIndex:Br("max"),overlayProps:{backgroundOpacity:.35,blur:7},transitionProps:{duration:200,transition:"pop"},store:vP,filter:vQ,clearQueryOnClose:!0,closeOnActionTrigger:!0,shortcut:"mod + K"},vi=ve((e,t)=>{const n=ae("Spotlight",wQ,e),{searchProps:r,filter:i,query:s,onQueryChange:c,actions:u,nothingFound:f,highlightQuery:h,limit:m,scrollAreaProps:g,...y}=n,[x,S]=or({value:s,defaultValue:"",finalValue:"",onChange:c}),w=xP(i(x,u),m).map(C=>{if(yP(C)){const T=C.actions.map(({id:R,...E})=>a.jsx(Kd,{highlightQuery:h,...E},R));return a.jsx(og,{label:C.group,children:T},C.group)}return a.jsx(Kd,{highlightQuery:h,...C},C.id)});return a.jsxs(lg,{...y,query:x,onQueryChange:S,ref:t,children:[a.jsx(cg,{...r}),a.jsxs(ag,{...g,children:[w,w.length===0&&f&&a.jsx(sg,{children:f})]})]})});vi.classes=Bo;vi.displayName="@mantine/spotlight/Spotlight";vi.Search=cg;vi.ActionsList=ag;vi.Action=Kd;vi.Empty=sg;vi.ActionsGroup=og;vi.Footer=VS;vi.Root=lg;vi.open=Df.open;vi.close=Df.close;vi.toggle=Df.toggle;const FS=v.createContext({submitting:!1});FS.displayName="FormContext";function CQ(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?EQ(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&TQ(t,n);return t}function EQ(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function TQ(e,t){e[t.name]=t.value}function pt(e){const[t,n]=v.useState(!1);return a.jsx(FS.Provider,{value:{submitting:t},children:a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:r=>{r.preventDefault();const i=CQ(r.target);if(e.onSubmit){n(!0);const s=e.onSubmit(i);s?.then?s.catch(console.error).finally(()=>{n(!1)}):n(!1)}},children:e.children})})}function yr(e){const{children:t,...n}=e,{submitting:r}=v.useContext(FS);return a.jsx(Me,{type:"submit",loading:r,...n,children:t})}function RQ(e){const t=Re(),n=t.getUserConfiguration();function r(i){const{menuname:s,bookmarkname:c}=i,u=`${e.pathname}?${e.searchParams.toString()}`,f=gi(n);f.menu?.find(({title:m})=>m===s)?.link?.push({name:c,target:u}),t.updateResource(f).then(m=>{n.menu=m.menu,t.dispatchEvent({type:"change"}),Ae({color:"green",message:"Success"}),e.onOk()}).catch(m=>{Ae({color:"red",message:We(m)})})}return a.jsx(Mn,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:a.jsx(pt,{onSubmit:r,children:a.jsxs(Ne,{children:[a.jsx(_Q,{config:n}),a.jsx(Fe,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",defaultValue:e.pathname.split("/")[1]||"",withAsterisk:!0}),a.jsx(xe,{justify:"flex-end",children:a.jsx(yr,{mt:"sm",children:"OK"})})]})})})}function _Q(e){function t(r){return r?.menu?.map(i=>i.title)}const n=t(e.config);return a.jsx(pn,{name:"menuname",defaultValue:n[0],label:"Select Menu Option",data:n,withAsterisk:!0})}function bP(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function DQ(e){return typeof e.display=="string"?e.display:bP(e)}function AQ(e){return{value:bP(e),label:DQ(e),resource:e}}function kQ(e){return{code:e,display:e}}function Af(e){const t=Re(),{binding:n,creatable:r,clearable:i,expandParams:s,withHelpText:c,...u}=e,f=v.useCallback(async(h,m)=>{if(!n)return[];const y=(await t.valueSetExpand({...s,url:n,filter:h,count:10},{signal:m})).expansion?.contains??[],x=[];for(const S of y)S.code&&!x.some(w=>w.code===S.code)&&x.push(S);return x},[t,s,n]);return a.jsx(BS,{...u,creatable:r??!0,clearable:i??!0,toOption:AQ,loadOptions:f,onCreate:kQ,itemComponent:c?PQ:void 0})}const PQ=v.forwardRef(({label:e,resource:t,active:n,...r},i)=>a.jsx("div",{ref:i,...r,children:a.jsxs(xe,{wrap:"nowrap",gap:"xs",children:[n&&a.jsx(Go,{size:12}),a.jsxs("div",{children:[a.jsx(ge,{children:e}),a.jsx(ge,{size:"xs",c:"dimmed",children:`${t.system}#${t.code}`})]})]})}));function SP(e){const{defaultValue:t,onChange:n,withHelpText:r,...i}=e,[s,c]=v.useState(t);function u(f){const h=f[0],m=OQ(h);c(m),n&&n(m)}return a.jsx(Af,{defaultValue:NQ(s),onChange:u,withHelpText:r??!0,...i})}function NQ(e){return e?{code:e}:void 0}function OQ(e){return e?.code}function HS(e){const[t,n]=v.useState(e.defaultValue),r=e.onChange,i=v.useCallback(s=>{n(s),r&&r(s)},[r]);return a.jsx(SP,{disabled:e.disabled,"data-autofocus":e.autoFocus,"data-testid":e.testId,defaultValue:t,onChange:i,name:e.name,placeholder:e.placeholder,binding:"https://medplum.com/fhir/ValueSet/resource-types",creatable:!1,maxValues:e.maxValues??1,clearable:!1,withHelpText:!1})}const MQ="_navbar_ts9vb_1",LQ="_logoButton_ts9vb_6",IQ="_menuTitle_ts9vb_25",zQ="_link_ts9vb_51",$Q="_dismissButton_ts9vb_91",UQ="_linkLabel_ts9vb_109",BQ="_iconWrapper_ts9vb_120",VQ="_alertDot_ts9vb_127",FQ="_linkCount_ts9vb_138",HQ="_addBookmarkLink_ts9vb_191",qQ="_toggleButton_ts9vb_201",GQ="_divider_ts9vb_226",fr={navbar:MQ,logoButton:LQ,menuTitle:IQ,link:zQ,dismissButton:$Q,linkLabel:UQ,iconWrapper:BQ,alertDot:VQ,linkCount:FQ,addBookmarkLink:HQ,toggleButton:qQ,divider:GQ},WQ="_actionSection_1l8yv_8",QQ="_action_1l8yv_8",YQ="_actionDescription_1l8yv_27",KQ="_actionsGroup_1l8yv_32",XQ="_actionsList_1l8yv_55",JQ="_content_1l8yv_60",cs={actionSection:WQ,action:QQ,actionDescription:YQ,actionsGroup:KQ,actionsList:XQ,content:JQ},ZQ=200;function gR(){return a.jsxs(Ne,{gap:"xs",py:"lg",children:[a.jsxs(ge,{size:"sm",c:"dimmed",children:["Press ",a.jsx(Gc,{children:"⌘"})," + ",a.jsx(Gc,{children:"K"})," to open Search next time."]}),a.jsxs(ge,{size:"sm",c:"dimmed",children:["(",a.jsx(Gc,{children:"Ctrl"})," + ",a.jsx(Gc,{children:"K"})," on Windows)"]})]})}function eY({patientsOnly:e}){const t=Re(),n=ju(),[r,i]=v.useState(a.jsx(gR,{})),[s,c]=v.useState([]),u=of(h=>{const m=tY(h);e?t.graphql(m).then(g=>{const x=vR(g).filter(S=>S.resourceType==="Patient");c(rY(x,n))}).catch(console.error).finally(()=>i("No results found")):Promise.all([t.graphql(m),t.valueSetExpand({url:"https://medplum.com/fhir/ValueSet/resource-types",filter:h,count:5})]).then(([g,y])=>{const x=vR(g),S=y.expansion?.contains??[];c(iY(x,S,n))}).catch(console.error).finally(()=>i("No results found"))},ZQ),f=h=>{if(!h){u.cancel(),i(a.jsx(gR,{})),c([]);return}i("Searching..."),u(h)};return a.jsx(vi,{actions:s,nothingFound:r,radius:"md",highlightQuery:!0,searchProps:{leftSection:a.jsx(ng,{size:"1.2rem",stroke:2,color:"var(--mantine-color-gray-5)"}),placeholder:"Start typing to search…",type:"search",autoComplete:"off",autoCorrect:"off",spellCheck:!1,name:e?"provider-spotlight-search":"spotlight-search",inputProps:{"data-1p-ignore":"true","data-lpignore":"true"},leftSectionProps:{style:{marginLeft:"calc(var(--mantine-spacing-md) - 12px)"}}},classNames:{body:cs.body,content:cs.content,search:cs.search,actionsList:cs.actionsList,action:cs.action,actionSection:cs.actionSection,actionDescription:cs.actionDescription,actionsGroup:cs.actionsGroup},onQueryChange:f})}function tY(e){const t=JSON.stringify(e);return mS(e)?`{
160
+ Patients1: PatientList(_id: ${t}, _count: 1) {
161
+ resourceType
162
+ id
163
+ identifier { system value }
164
+ name { given family }
165
+ birthDate
166
+ photo { url contentType }
167
+ }
168
+ ServiceRequestList(_id: ${t}, _count: 1) {
169
+ resourceType
170
+ id
171
+ identifier { system value }
172
+ subject { display }
173
+ }
174
+ }`.replaceAll(/\s+/g," "):`{
175
+ Patients1: PatientList(name: ${t}, _count: 5) {
176
+ resourceType
177
+ id
178
+ identifier { system value }
179
+ name { given family }
180
+ birthDate
181
+ photo { url contentType }
182
+ }
183
+ Patients2: PatientList(identifier: ${t}, _count: 5) {
184
+ resourceType
185
+ id
186
+ identifier { system value }
187
+ name { given family }
188
+ birthDate
189
+ photo { url contentType }
190
+ }
191
+ ServiceRequestList(identifier: ${t}, _count: 5) {
192
+ resourceType
193
+ id
194
+ identifier { system value }
195
+ subject { display }
196
+ }
197
+ }`.replaceAll(/\s+/g," ")}function vR(e){const t=[];return e.data.Patients1&&t.push(...e.data.Patients1),e.data.Patients2&&t.push(...e.data.Patients2),e.data.ServiceRequestList&&t.push(...e.data.ServiceRequestList),nY(t)}function nY(e){const t=new Set,n=[];for(const r of e)r.id&&!t.has(r.id)&&(t.add(r.id),n.push(r));return n}function rY(e,t){const n=e.filter(r=>!!r.id).map(r=>({id:r.id,label:r.name?Na(r.name[0]):r.id,description:r.birthDate,leftSection:a.jsx(mo,{value:r,radius:"xl",size:24}),onClick:()=>t(`/Patient/${r.id}`)}));return n.length>0?[{group:"Patients",actions:n}]:[]}function iY(e,t,n){const r=[],i=t.map(u=>({id:`resource-type-${u.code}`,label:u.display??u.code??"",description:"Resource Type",onClick:()=>n(`/${u.code}`)}));i.length>0&&r.push({group:"Resource Types",actions:i});const s=[],c=[];for(const u of e)u.resourceType==="Patient"&&u.id?s.push({id:u.id,label:u.name?Na(u.name[0]):u.id,description:u.birthDate,leftSection:a.jsx(mo,{value:u,radius:"xl",size:24}),onClick:()=>n(`/Patient/${u.id}`)}):u.resourceType==="ServiceRequest"&&u.id&&c.push({id:u.id,label:u.id,description:u.subject?.display,onClick:()=>n(`/ServiceRequest/${u.id}`)});return s.length>0&&r.push({group:"Patients",actions:s}),c.length>0&&r.push({group:"Service Requests",actions:c}),r}function yR(e){const t=ju(),n=_f(),r=aY(e.pathname,e.searchParams,e.menus),[i,s]=v.useState(!1),[c,u]=v.useState(!1);function f(g,y){g.stopPropagation(),g.preventDefault(),t(y),window.innerWidth<768&&e.closeNavbar()}function h(g){g&&t(`/${g}`)}const m=e.opened??!0;return a.jsxs(a.Fragment,{children:[a.jsxs(kr.Navbar,{id:"navbar",className:fr.navbar,children:[e.logo&&a.jsx(kr.Section,{px:"xs",pt:"xs",pb:"4px",children:a.jsx(An,{className:fr.logoButton,onClick:e.navbarToggle,"aria-expanded":m,"aria-controls":"navbar","aria-label":"Medplum Logo",children:e.logo})}),a.jsx(ti,{px:"xs",pb:"xs",pt:"sm",h:"100%",children:a.jsxs(kr.Section,{grow:!0,children:[e.spotlightEnabled&&a.jsx(le,{mb:2,children:a.jsx(Zr,{label:"Search",position:"right",transitionProps:{duration:0},disabled:m,children:a.jsxs(An,{className:fr.link,onClick:()=>Df.open(),"aria-label":"Search",children:[a.jsx(ng,{size:"1.2rem"}),a.jsx("span",{className:fr.linkLabel,"data-opened":m||void 0,children:"Search"})]})})}),e.spotlightEnabled&&a.jsx(eY,{patientsOnly:e.patientsOnly}),!e.resourceTypeSearchDisabled&&a.jsx(kr.Section,{mb:"sm",children:a.jsx(HS,{name:"resourceType",placeholder:"Resource Type",maxValues:0,onChange:g=>h(g)},window.location.pathname)}),e.menus?.map((g,y)=>a.jsxs(v.Fragment,{children:[g.title&&a.jsx(ge,{className:fr.menuTitle,"data-opened":m||void 0,children:g.title}),a.jsx(Ne,{gap:"2",children:g.links?.map(x=>x.notificationCount?a.jsx(oY,{to:x.href,active:x.href===r?.href,onClick:S=>f(S,x.href),icon:x.icon,label:x.label??"",opened:m,alert:x.alert,notificationCount:x.notificationCount,onDismiss:x.onDismiss},x.href):a.jsx(jP,{to:x.href,active:x.href===r?.href,onClick:S=>f(S,x.href),icon:x.icon,label:x.label??"",opened:m,alert:x.alert,count:x.count,onDismiss:x.onDismiss},x.href))})]},`menu-${g.title??y}`)),e.displayAddBookmark&&a.jsx(Zr,{label:"Add Bookmark",position:"right",transitionProps:{duration:0},disabled:m,children:a.jsxs(An,{className:`${fr.link} ${fr.addBookmarkLink}`,onClick:()=>u(!0),children:[a.jsx(Yd,{}),a.jsx("span",{className:fr.linkLabel,"data-opened":m||void 0,children:"Add Bookmark"})]})})]})}),e.userMenuEnabled&&a.jsxs(kr.Section,{px:"xs",py:"xs",children:[a.jsx(Zr,{label:m?"Close Sidebar":"Open Sidebar",position:"right",transitionProps:{duration:0},children:a.jsx(An,{className:fr.toggleButton,"aria-label":m?"Close Sidebar":"Open Sidebar",onClick:e.navbarToggle,"aria-expanded":m,"aria-controls":"navbar",children:a.jsx(_G,{})})}),a.jsx(dn,{my:"xs",mx:6,className:fr.divider}),a.jsxs(be,{width:260,shadow:"xl",position:"top-start",transitionProps:{transition:"fade-up"},opened:i,onClose:()=>s(!1),children:[a.jsx(be.Target,{children:a.jsxs(An,{className:fr.link,pl:"7","aria-label":"User menu","data-active":i||void 0,onClick:()=>s(g=>!g),bd:"1px 0 0 0 solid var(--mantine-color-gray-200)",children:[a.jsx(mo,{value:n,radius:"xl",size:24}),a.jsx("span",{className:fr.linkLabel,"data-opened":m||void 0,children:Na(n?.name?.[0])})]})}),a.jsx(be.Dropdown,{children:a.jsx(fP,{version:e.version,showLayoutVersionToggle:e.showLayoutVersionToggle})})]})]})]}),e.pathname&&e.searchParams&&a.jsx(RQ,{pathname:e.pathname,searchParams:e.searchParams,visible:c,onOk:()=>u(!1),onCancel:()=>u(!1)})]})}function jP(e){const{to:t,icon:n,label:r,onClick:i,active:s,count:c,alert:u,opened:f,onDismiss:h}=e,m=c!==void 0&&c>0,g=n??a.jsx(Rq,{}),y=m&&u&&!f;function x(S){S.preventDefault(),S.stopPropagation(),h?.()}return a.jsx(Zr,{label:r,position:"right",transitionProps:{duration:0},disabled:f,children:a.jsxs(jt,{to:t,onClick:i,className:fr.link,"data-active":s||void 0,children:[a.jsxs("span",{className:fr.iconWrapper,children:[g,y&&a.jsx("span",{className:fr.alertDot})]}),a.jsx("span",{className:fr.linkLabel,"data-opened":f||void 0,children:r}),m&&a.jsx("span",{className:fr.linkCount,"data-opened":f||void 0,"data-alert":u||void 0,children:c.toLocaleString()}),h&&f&&a.jsx(Zr,{label:"Dismiss",openDelay:500,children:a.jsx(An,{"aria-label":"Dismiss",className:fr.dismissButton,onClick:x,children:a.jsx(ws,{size:14})})})]})})}function oY(e){const t=MH(e.notificationCount);return a.jsx(jP,{to:e.to,active:e.active,onClick:e.onClick,icon:e.icon,label:e.label,opened:e.opened,alert:e.alert,count:t,onDismiss:e.onDismiss})}function aY(e,t,n){if(!e||!t||!n)return;let r,i=0;for(const s of n)if(s.links)for(const c of s.links){const u=sY(e,t,c.href);u>i&&(i=u,r=c)}return r}function sY(e,t,n){const r=new URL(n,"https://example.com");if(e!==r.pathname)return 0;const i=["_count","_offset"];for(const[c,u]of r.searchParams.entries())if(!i.includes(c)&&t.get(c)!==u)return 0;let s=1;for(const[c,u]of t.entries())i.includes(c)||r.searchParams.get(c)===u&&s++;return s}const xR=250,lY=59;function cY(e){const[t,n]=v.useState(localStorage.navbarOpen==="true"),[r]=v.useState(e.layoutVersion??localStorage.appShellLayoutVersion??"v1"),i=Re(),s=_f();function c(x){localStorage.navbarOpen=x.toString(),n(x)}function u(){c(!1)}function f(){c(!t)}if(i.isLoading())return a.jsx(Ui,{});let h,m,g,y;return r==="v2"?(h={height:0},m={width:t?xR:lY,breakpoint:0,collapsed:{desktop:!s,mobile:!s}},g=void 0,y=s?a.jsx(yR,{logo:e.logo,pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,navbarToggle:f,closeNavbar:u,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:!0,opened:t,spotlightEnabled:!0,patientsOnly:e.spotlightPatientsOnly,userMenuEnabled:!0,version:e.version,showLayoutVersionToggle:e.showLayoutVersionToggle}):void 0):(h={height:60},m={width:xR,breakpoint:"sm",collapsed:{desktop:!s||!t,mobile:!s||!t}},g=s&&a.jsx(rQ,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarOpen:t,navbarToggle:f,notifications:e.notifications}),y=s&&t?a.jsx(yR,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,navbarToggle:f,closeNavbar:u,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled,patientsOnly:e.spotlightPatientsOnly}):void 0),a.jsxs(kr,{header:h,navbar:m,padding:0,children:[g,y,a.jsx(kr.Main,{className:MW.main,children:a.jsx(zS,{children:a.jsx(v.Suspense,{fallback:a.jsx(Ui,{}),children:e.children})})})]})}const uY="https://ccda.medplum.com",dY="https://ccda-validator.medplum.com/";function fY(e){const{url:t}=e,[n,r]=v.useState(!1),i=v.useRef(null),[s,c]=v.useState(),[u,f]=v.useState(!1);v.useEffect(()=>{t&&n&&i.current&&(kd(i.current,{command:"loadCcdaXml",value:t}).catch(console.error),r(!1))},[t,n]);const h=async()=>{if(t)try{f(!0);const x=await(await fetch(t)).text(),S=new FormData;S.append("ccdaFile",new Blob([x],{type:"text/xml"}),"ccda.xml");const w=`${dY}referenceccdaservice/?validationObjective=C-CDA_IG_Plus_Vocab&referenceFileName=No%20scenario%20File&curesUpdate=true&severityLevel=WARNING`,C=await fetch(w,{method:"POST",body:S,credentials:"omit",redirect:"manual"});if(!C.ok)throw new Error(`Validation failed: ${C.status} ${C.statusText}`);const T=await C.json();c(T)}catch(y){c(void 0),console.error("CCDA validation error:",y)}finally{f(!1)}},m=()=>{if(!s)return;const y=JSON.stringify(s,null,2);uP(y,"ccda-validation-results")},g=()=>s?s.resultsMetaData.resultMetaData.filter(y=>y?.type.includes("Error")).reduce((y,x)=>y+(x.count||0),0):0;return t?a.jsxs("div",{"data-testid":"ccda-iframe",style:{maxWidth:e.maxWidth},children:[a.jsx("div",{style:{minHeight:400},children:a.jsx("iframe",{title:"C-CDA Viewer",width:"100%",height:"400",ref:i,src:uY,allowFullScreen:!0,frameBorder:0,seamless:!0,onLoad:()=>r(!0)})}),a.jsxs("div",{style:{marginTop:"10px",marginBottom:"10px",display:"flex",alignItems:"center"},children:[a.jsx(Me,{type:"button",onClick:h,disabled:u,children:u?"Validating...":"Validate"}),s&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{marginLeft:"15px"},children:[a.jsx("strong",{children:"Validation Results:"})," ",g()," errors found"]}),a.jsx(Me,{type:"button",onClick:m,color:"green",style:{marginLeft:"auto"},children:"Download Full Results"})]})]})]}):null}function kf(e){const{contentType:t,url:n,title:r}=e.value??{},i=Qk(n);return i?a.jsxs("div",{"data-testid":"attachment-display",children:[t?.startsWith("image/")&&a.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:i,alt:r}),t?.startsWith("video/")&&a.jsx("video",{"data-testid":"attachment-video",style:{maxWidth:e.maxWidth},controls:!0,children:a.jsx("source",{type:t,src:i})}),(t?.startsWith("text/")||t==="application/json"||t==="application/pdf")&&a.jsx("div",{"data-testid":"attachment-iframe",style:{maxWidth:e.maxWidth,minHeight:400},children:a.jsx("iframe",{title:"Attachment",width:"100%",height:"400",src:i+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),t===tn.CDA_XML&&a.jsx(fY,{url:i}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx(wt,{href:n,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:hY(r),children:r||"Download"})})]}):null}function hY(e){return e?.includes(".")?e:void 0}const pY="_root_1bd5a_1",mY="_compact_1bd5a_19",bR={root:pY,compact:mY};function Pf(e){const{children:t,compact:n}=e;return a.jsx("dl",{className:Ft(bR.root,{[bR.compact]:n}),children:t})}function Ur(e){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:e.term}),a.jsx("dd",{children:e.children})]})}function gY(e){const t=e.values?.map((r,i)=>a.jsx("div",{children:a.jsx(kf,{value:r,maxWidth:e.maxWidth})},"attatchment-"+i));let n;if(e.includeDescriptionListEntry){if(e.property===void 0)throw new Error("props.property is required when includeDescriptionListEntry is true");if(!In(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const r=e.path.split(".").pop();n=a.jsx(Ur,{term:Tl(r),children:t})}else n=a.jsx(a.Fragment,{children:t});return n}function qS(e){const t=Re(),n=v.useRef(null);function r(c){jn(c),n.current?.click()}function i(c){jn(c);const u=c.target.files;u&&Array.from(u).forEach(s)}function s(c){!c||!c.name||(e.onUploadStart&&e.onUploadStart(),t.createAttachment({data:c,contentType:c.type||"application/octet-stream",filename:c.name,securityContext:e.securityContext,onProgress:e.onUploadProgress}).then(f=>e.onUpload(f)).catch(f=>{e.onUploadError&&e.onUploadError(rn(f))}))}return a.jsxs(a.Fragment,{children:[a.jsx("input",{disabled:e.disabled,type:"file","data-testid":"upload-file-input",style:{display:"none"},ref:n,onChange:c=>i(c)}),e.children({onClick:r,disabled:e.disabled})]})}function vY(e){const[t,n]=v.useState(e.defaultValue??[]),r=v.useRef(t);r.current=t;function i(s){n(s),e.onChange&&e.onChange(s)}return a.jsxs("table",{style:{width:"100%"},children:[a.jsxs("colgroup",{children:[a.jsx("col",{width:"97%"}),a.jsx("col",{width:"3%"})]}),a.jsxs("tbody",{children:[t.map((s,c)=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(kf,{value:s,maxWidth:200})}),a.jsx("td",{children:a.jsx(Pn,{disabled:e.disabled,title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:u=>{jn(u);const f=t.slice();f.splice(c,1),i(f)},children:a.jsx(Qp,{})})})]},`${c}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(qS,{disabled:e.disabled,onUpload:s=>{i([...r.current,s])},children:s=>a.jsx(Pn,{...s,title:"Add",variant:"subtle",size:"sm",color:s.disabled?"gray":"green",children:a.jsx(OS,{})})})})]})]})]})}function wP(e){const[t,n]=v.useState(e.defaultValue);function r(i){n(i),e.onChange&&e.onChange(i)}return t?a.jsxs(a.Fragment,{children:[a.jsx(kf,{value:t,maxWidth:200}),a.jsx(Me,{disabled:e.disabled,onClick:i=>{jn(i),r(void 0)},children:"Remove"})]}):a.jsx(qS,{disabled:e.disabled,securityContext:e.securityContext,onUpload:r,children:i=>a.jsx(Me,{...i,children:"Upload..."})})}function Wi(e){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180 180",style:{width:e.size,height:e.size},children:[a.jsx("title",{children:"Medplum Logo"}),a.jsx("path",{fill:e.fill??"#9c36b5",d:"M84 56c-3-15-15-24-23-28l5-10c8 2 14 8 20 14 0-12 1-16 5-21 8-9 13-9 41-9 0 7 1 18-3 24-7 9-16 7-41 8 5 8 7 14 8 22 36-24 74-7 74 39 0 42-40 83-80 83s-80-41-80-83c0-46 38-63 74-39Zm-3 43H65c-4 0-7 3-7 7v4c0 4 3 7 7 7h16v16c0 4 3 7 7 7h4c4 0 7-3 7-7v-16h16c4 0 7-3 7-7v-4c0-4-3-7-7-7H99V83c0-4-3-7-7-7h-4c-4 0-7 3-7 7z"})]})}function Kp(e){const[t,n]=v.useState();return a.jsxs(pt,{onSubmit:r=>{n(void 0),e.onSubmit(r)?.catch(i=>n(We(i)))},children:[a.jsxs(Ao,{style:{flexDirection:"column"},children:[a.jsx(Wi,{size:32}),a.jsx(ze,{order:3,py:"lg",children:e.title}),!e.qrCodeUrl&&e.description&&a.jsx(ge,{c:"dimmed",mb:"lg",mt:"-lg",children:e.description})]}),t&&a.jsx(qo,{icon:a.jsx(Ns,{size:16}),title:"Error",color:"red",mb:"lg",children:t}),e.qrCodeUrl&&a.jsx(Ao,{children:a.jsxs(Ne,{mb:"xl",children:[e.description&&a.jsx(ge,{c:"dimmed",mb:"md",mt:"-lg",ta:"center",children:e.description}),a.jsx(D0,{src:e.qrCodeUrl,alt:"Multi Factor Auth QR Code",w:"60%",mx:"auto",radius:"md",p:"xs",bg:"var(--mantine-color-white)",style:{border:"1px solid light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-4))"}})]})}),a.jsx(Ne,{gap:"sm",children:a.jsx(Fe,{name:"token",label:"MFA code",autoComplete:"one-time-code",required:!0,autoFocus:!0})}),a.jsx(Ne,{gap:"xs",pt:"md",children:a.jsx(yr,{fullWidth:!0,children:e.buttonText})})]})}const yY="_root_1vii2_1",xY={root:yY};function Fl(e){const{children:t,...n}=e;return a.jsx(gf,{className:xY.root,...n,children:t})}const bY="_paper_1igaj_1",SY="_fill_1igaj_20",SR={paper:bY,fill:SY};function Os(e){const{width:t,fill:n,className:r,children:i,...s}=e,c=t?{maxWidth:t}:void 0;return a.jsx(gr,{className:Ft(SR.paper,n&&SR.fill,r),style:c,shadow:"sm",radius:"sm",withBorder:!0,...s,children:i})}function lt(e){const{children:t,...n}=e;return a.jsx(Fl,{children:a.jsx(Os,{...n,children:t})})}function xr(e){const{outcome:t,issues:n,...r}=e,i=t?.issue||n;return!i||i.length===0?null:a.jsx(qo,{icon:a.jsx(Ns,{size:16}),color:"red",...r,children:i.map(s=>a.jsx("div",{"data-testid":"text-field-error",children:nk(s)},s.details?.text))})}function Ut(e,t){return e?.issue?.filter(n=>CP(n.expression?.[0],t))?.map(n=>n.details?.text)?.join(`
198
+ `)}function Ms(e,t){return e?.issue?.filter(n=>CP(n.expression?.[0],t))}const dp=/\[\d+\]/;function CP(e,t){const n=typeof e=="string"&&dp.test(e),r=typeof t=="string"&&dp.test(t);if(n!==r&&(e=e?.replace(dp,""),t=t?.replace(dp,"")),e===t)return!0;if(!e||!t)return!1;const i=e.indexOf(".");if(i>=0&&e.substring(i+1)===t)return!0;const s=t.indexOf(".");return s>=0&&t.substring(s+1)===e}function EP(e){const t=Re(),[n,r]=v.useState(),i=Ms(n,void 0);return a.jsxs(pt,{onSubmit:async s=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:s.projectName}))}catch(c){r(rn(c))}},children:[a.jsxs(ar,{direction:"column",align:"center",justify:"center",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{order:3,py:"lg",children:"Create a new project"})]}),a.jsx(xr,{issues:i,mb:"lg"}),a.jsx(Ne,{gap:"sm",children:a.jsx(Fe,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:Ut(n,"projectName")})}),a.jsxs(Ne,{gap:"xs",mt:"md",children:[a.jsx(yr,{fullWidth:!0,children:"Create Project"}),a.jsxs(ge,{c:"dimmed",size:"xs",pt:"lg",ta:"center",children:['By clicking "Create Project" you agree to the Medplum'," ",a.jsx(wt,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(wt,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]})]})}function TP(e,t){const n=document.getElementsByTagName("head")[0],r=document.createElement("script");r.async=!0,r.src=e,r.onload=t??null,n.appendChild(r)}function RP(e){const{googleClientId:t,handleGoogleCredential:n}=e,r=v.useRef(null),[i,s]=v.useState(typeof google<"u"),c=v.useRef(!1),u=v.useRef(!1);return v.useEffect(()=>{if(typeof google>"u"){TP("https://accounts.google.com/gsi/client",()=>s(!0));return}c.current||(google.accounts.id.initialize({client_id:t,callback:n}),c.current=!0),r.current&&!u.current&&(google.accounts.id.renderButton(r.current,{type:"standard",logo_alignment:"center",width:r.current.clientWidth}),u.current=!0)},[t,i,n]),t?a.jsx(le,{ref:r,w:"100%",h:40,display:"flex",style:{justifyContent:"center"}}):null}function _P(e){if(e)return e;const t=rr.getOrigin();if(t&&[].includes(t))return"__GOOGLE_CLIENT_ID__"}function DP(e){typeof grecaptcha>"u"&&TP("https://www.google.com/recaptcha/api.js?render="+e)}function AP(e){return new Promise((t,n)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(r){n(r)}})})}function jY(e){const t=_P(e.googleClientId),n=e.recaptchaSiteKey,r=Re(),[i,s]=v.useState(),c=Ms(i,void 0);return v.useEffect(()=>{n&&DP(n)},[n]),a.jsxs(pt,{onSubmit:async u=>{s(void 0);try{let f="";n&&(f=await AP(n)),e.handleAuthResponse(await r.startNewUser({projectId:e.projectId,clientId:e.clientId,firstName:u.firstName,lastName:u.lastName,email:u.email,password:u.password,remember:u.remember==="true",recaptchaSiteKey:n,recaptchaToken:f}))}catch(f){s(rn(f))}},children:[a.jsx(ar,{direction:"column",align:"center",justify:"center",children:e.children}),a.jsx(xr,{issues:c,mb:"lg"}),t&&a.jsxs(a.Fragment,{children:[a.jsx(le,{style:{minHeight:40},children:a.jsx(RP,{googleClientId:t,handleGoogleCredential:async u=>{try{e.handleAuthResponse(await r.startGoogleLogin({googleClientId:u.clientId,googleCredential:u.credential,projectId:e.projectId,createUser:!0}))}catch(f){s(rn(f))}}})}),a.jsx(dn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(Ne,{gap:"sm",children:[a.jsx(Fe,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:Ut(i,"firstName")}),a.jsx(Fe,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:Ut(i,"lastName")}),a.jsx(Fe,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:Ut(i,"email")}),a.jsx(ao,{name:"password",label:"Password",autoComplete:"off",required:!0,error:Ut(i,"password")})]}),a.jsxs(Ne,{gap:"xs",children:[a.jsx(fn,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1},pt:"md",pb:"xs"}),a.jsx(yr,{fullWidth:!0,children:"Register Account"}),a.jsxs(ge,{c:"dimmed",size:"xs",pt:"lg",ta:"center",children:['By clicking "Register Account" you agree to the Medplum'," ",a.jsx(wt,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(wt,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),a.jsxs(ge,{c:"dimmed",size:"xs",ta:"center",children:["This site is protected by reCAPTCHA and the Google"," ",a.jsx(wt,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx(wt,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]})]})}function wY(e){const{type:t,projectId:n,clientId:r,googleClientId:i,recaptchaSiteKey:s,onSuccess:c}=e,u=Re(),[f,h]=v.useState(),[m,g]=v.useState();v.useEffect(()=>{t==="patient"&&f&&u.startNewPatient({login:f,projectId:n}).then(S=>u.processCode(S.code)).then(()=>c()).catch(S=>g(rn(S)))},[u,t,n,f,c]);function y(S){S.code?u.processCode(S.code).then(()=>c()).catch(w=>g(rn(w))):S.login&&h(S.login)}const x=Ms(m,void 0);return a.jsxs(lt,{width:400,px:"xl",py:"xl",bdrs:"md",children:[a.jsx(xr,{issues:x,mb:"lg"}),!f&&a.jsx(jY,{projectId:n,clientId:r,googleClientId:i,recaptchaSiteKey:s,handleAuthResponse:y,children:e.children}),f&&t==="project"&&a.jsx(EP,{login:f,handleAuthResponse:y})]})}function CY(e){const[t,n]=v.useState();return t?a.jsx(TY,{email:t,resetEmail:()=>n(void 0),...e}):a.jsx(EY,{setEmail:n,...e})}function EY(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:i,disableEmailAuth:s,...c}=e,u=Re(),f=!e.disableGoogleAuth&&_P(e.googleClientId),[h,m]=v.useState(),g=Ms(h,void 0),y=v.useCallback(async w=>{if(!w.authorizeUrl)return!1;const C=JSON.stringify({...await u.ensureCodeChallenge(c),domain:w.domain}),T=new URL(w.authorizeUrl);return T.searchParams.set("state",C),rr.assign(T.toString()),!0},[u,c]),x=v.useCallback(async w=>{const C=await u.post("auth/method",{email:w.email});await y(C)||t(w.email)},[u,y,t]),S=v.useCallback(async w=>{try{const C=await u.startGoogleLogin({...c,googleCredential:w.credential});await y(C)||r(C)}catch(C){m(rn(C))}},[u,c,y,r]);return a.jsxs(pt,{onSubmit:x,children:[a.jsx(ar,{direction:"column",align:"center",justify:"center",children:i}),a.jsx(xr,{issues:g,mb:"lg"}),f&&a.jsxs(a.Fragment,{children:[a.jsx(le,{style:{minHeight:40},children:a.jsx(RP,{googleClientId:f,handleGoogleCredential:S})}),!s&&a.jsx(dn,{label:"or",labelPosition:"center",my:"lg"})]}),!s&&a.jsx(Fe,{name:"email",type:"email",label:"Email",mb:"md",placeholder:"name@domain.com",required:!0,autoFocus:!0,error:Ut(h,"email"),"data-testid":"auth.email"}),a.jsxs(Ne,{gap:"xs",children:[!s&&a.jsx(yr,{fullWidth:!0,children:"Continue"}),n&&a.jsxs(ge,{size:"sm",mt:"lg",c:"dimmed",style:{textAlign:"center"},"data-dashlane-ignore":"true","data-lp-ignore":"true","data-no-autofill":"true","data-form-type":"navigation",children:["Don’t have an account? ",a.jsx(wt,{onClick:n,children:"Register"})]})]})]})}function TY(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...i}=e,s=Re(),[c,u]=v.useState(),f=Ms(c,void 0),h=v.useCallback(m=>{s.startLogin({...i,password:m.password,remember:m.remember==="on"}).then(n).catch(g=>u(rn(g)))},[s,i,n]);return a.jsxs(pt,{onSubmit:h,children:[a.jsx(ar,{direction:"column",align:"center",justify:"center",children:r}),a.jsx(xr,{issues:f,mb:"lg"}),a.jsxs(Ne,{gap:"sm",children:[a.jsx(Fe,{label:"Email",value:e.email,disabled:!0,rightSectionWidth:36,rightSection:a.jsx(Pn,{variant:"subtle",color:"gray",onClick:e.resetEmail,"aria-label":"Change email",children:a.jsx(WG,{size:"1rem",stroke:1.5})})}),a.jsx(ao,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:Ut(c,"password"),"data-testid":"auth.password"})]}),a.jsxs(Ne,{gap:"xs",children:[a.jsx(fn,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1},pt:"md",pb:"xs"}),a.jsx(yr,{children:"Sign In"}),t&&a.jsx(ge,{size:"sm",mt:"lg",c:"dimmed",style:{textAlign:"center"},"data-dashlane-ignore":"true","data-lp-ignore":"true","data-no-autofill":"true","data-form-type":"navigation",children:a.jsx(wt,{onClick:t,children:"Reset Password"})})]})]})}const RY="_option_18k89_1",_Y="_iconBox_18k89_9",kP={option:RY,iconBox:_Y};function DY(e){const t=Re(),n=$l(),[r,i]=v.useState(""),[s,c]=v.useState();function u(g){return!!g?.toLowerCase()?.includes(r.toLowerCase())}function f(g){return u(g.profile?.display)||u(g.project?.display)||u(PP(g))}function h(g){t.post("auth/profile",{login:e.login,profile:g}).then(e.handleAuthResponse).catch(y=>c(rn(y)))}const m=e.memberships.filter(f).slice(0,10).map(g=>a.jsx(Ye.Option,{value:g.id,className:kP.option,children:a.jsx(AY,{...g})},g.id));return a.jsxs(Ne,{gap:"0",children:[a.jsxs(ar,{justify:"center",align:"center",direction:"column",wrap:"nowrap",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{order:3,py:"lg",children:"Choose a Project"})]}),a.jsx(xr,{outcome:s,mb:"lg"}),a.jsxs(Ye,{store:n,onOptionSubmit:h,children:[a.jsx(Ye.EventsTarget,{children:a.jsx(Fe,{placeholder:"Search",value:r,mb:"md",autoFocus:!0,leftSection:a.jsx(ng,{size:16}),onChange:g=>{i(g.currentTarget.value),n.updateSelectedOptionIndex()}})}),a.jsx("div",{children:a.jsx(Ye.Options,{style:{marginLeft:"-10px",marginRight:"-10px",marginBottom:"-10px"},children:m.length>0?m:a.jsx(Ye.Empty,{children:"Nothing found..."})})})]}),a.jsx(ge,{size:"sm",ta:"center",mt:"md",children:a.jsx(wt,{component:"button",type:"button",onClick:()=>{window.location.href=`/signin?project=new&login=${e.login}`},children:"Create a new project"})})]})}function PP(e){return e.identifier?.find(t=>t.system==="https://medplum.com/identifier/label")?.value}function AY(e){const t=PP(e);return a.jsxs(xe,{gap:"xs",align:"center",children:[a.jsx(le,{className:kP.iconBox,children:a.jsx(Mq,{size:16,stroke:2})}),a.jsxs("div",{children:[a.jsxs(ge,{size:"sm",fw:500,children:[e.project?.display," ",t?` - ${t}`:""]}),a.jsx(ge,{size:"xs",c:"dimmed",children:e.profile?.display})]})]})}const kY=/^patient\/Condition\.(?:\*|c?r?u?d?s?)$/,PY="?category=http://terminology.hl7.org/CodeSystem/condition-category|encounter-diagnosis",NY="?category=http://terminology.hl7.org/CodeSystem/condition-category|problem-list-item",OY="?category=http://hl7.org/fhir/us/core/CodeSystem/condition-category|health-concern",MY=/^patient\/Observation\.(?:\*|c?r?u?d?s?)$/,LY="?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-observation-category|clinical-test",IY="?category=http://terminology.hl7.org/CodeSystem/observation-category|laboratory",zY="?category=http://terminology.hl7.org/CodeSystem/observation-category|social-history",$Y="?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-category|sdoh",UY="?category=http://terminology.hl7.org/CodeSystem/observation-category|survey",BY="?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs";function VY(e){const t=Re();return a.jsx(pt,{onSubmit:n=>{t.post("auth/scope",{login:e.login,scope:Object.keys(n).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:a.jsxs(Ne,{children:[a.jsxs(ar,{direction:"column",align:"center",justify:"center",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{order:3,py:"lg",children:"Choose scope"})]}),a.jsx(Ne,{children:(e.scope??"openid").split(" ").map(n=>{let r;return kY.test(n)?r=[n+PY,n+NY,n+OY]:MY.test(n)&&(r=[n+LY,n+IY,n+zY,n+$Y,n+UY,n+BY]),a.jsxs(a.Fragment,{children:[a.jsx(fn,{id:n,name:n,label:n,defaultChecked:!0},n),r?.map(i=>a.jsx(fn,{id:i,name:i,label:i},i))]},n+"_group")})}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(yr,{fullWidth:!0,children:"Set Scope"})})]})})}function NP(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:i,onRegister:s,onCode:c,...u}=e,f=Re(),[h,m]=v.useState(),g=v.useRef(!1),[y,x]=v.useState(!1),[S,w]=v.useState(),[C,T]=v.useState(!1),[R,E]=v.useState(),_=v.useCallback(k=>{c?c(k):f.processCode(k).then(()=>{r&&r()}).catch(A=>Ae({color:"red",message:We(A)}))},[f,c,r]),P=v.useCallback(k=>{x(!!k.mfaEnrollRequired),w(k.enrollQrCode),T(!!k.mfaRequired),k.login&&m(k.login),k.memberships&&E(k.memberships),k.code&&(n?E(void 0):_(k.code))},[n,_]),O=v.useCallback(k=>{_(k.code)},[_]);return v.useEffect(()=>{t&&!g.current&&!h&&(g.current=!0,f.get("auth/login/"+t).then(P).catch(k=>Ae({color:"red",message:We(k)})))},[f,t,g,h,P]),a.jsx(lt,{width:400,px:"xl",py:"xl",bdrs:"md",children:h?y&&S?a.jsx(Kp,{title:"Enroll in MFA",description:"Scan this QR code with your authenticator app.",buttonText:"Enroll",qrCodeUrl:S,onSubmit:async k=>{const A=await f.post("auth/mfa/login-enroll",{login:h,token:k.token});P(A)}}):C?a.jsx(Kp,{title:"Enter MFA code",description:"Enter the code from your authenticator app.",buttonText:"Submit Code",onSubmit:async k=>{const A=await f.post("auth/mfa/verify",{login:h,token:k.token});P(A)}}):e.projectId==="new"?a.jsx(EP,{login:h,handleAuthResponse:P}):R?a.jsx(DY,{login:h,memberships:R,handleAuthResponse:P}):e.chooseScopes?a.jsx(VY,{login:h,scope:e.scope,handleAuthResponse:O}):a.jsx("div",{children:"Success"}):a.jsx(CY,{onForgotPassword:i,onRegister:s,handleAuthResponse:P,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...u,children:e.children})})}function Lo(e){return a.jsx(a.Fragment,{children:Ss(e.value)})}function FY(e){return a.jsx(a.Fragment,{children:Rf(e.value)})}function OP(e){const t=e.value;if(!t)return null;const n=[];return t.value&&n.push(t.value),(t.use||t.system)&&(n.push(" ["),t.use&&n.push(t.use),t.use&&t.system&&n.push(" "),t.system&&n.push(t.system),n.push("]")),a.jsx(a.Fragment,{children:n.join("").trim()})}function HY(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[t.name,t.name&&": ",t.telecom?.map(n=>a.jsx(OP,{value:n},`telecom-${t.name}-${n.value}`))]}):null}function ug(e,t,n){const r=Hd(e,t,{profileUrl:n});return r?Array.isArray(r)?[r.map(i=>i.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function qY(e,t,n){const r=ck(e,t,n);return r?Array.isArray(r)?[r.map(i=>i.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function GY(e){const{elementDefinitionType:t}=e,n=Re(),r=v.useContext(gn),[i,s]=v.useState(ak("Extension")),c=v.useMemo(()=>{if(In(t?.profile))return t.profile[0]},[t]),[u,f]=v.useState(c!==void 0);if(v.useEffect(()=>{c&&(f(!0),n.requestProfileSchema(c).then(()=>{const g=Su(c);f(!1),g&&s(g)}).catch(g=>{f(!1),console.warn(g)}))},[n,c]),c&&(u||!dS(c)))return a.jsx("div",{children:"Loading..."});if(i.elements["value[x]"]?.max!==0){const[g,y]=ug({type:"Extension",value:e.value},"value[x]",c??r.profileUrl);return a.jsx(ho,{propertyType:y,value:g})}return a.jsx(Xp,{path:e.path,value:{type:i.type,value:e.value},compact:e.compact,ignoreMissingValues:e.ignoreMissingValues,link:e.link,profileUrl:c})}function WY(e){return a.jsxs("div",{children:[e.value?.system,": ",e.value?.value]})}function QY(e){return a.jsx(a.Fragment,{children:tV(e.value)})}function Xd(e){return a.jsx(a.Fragment,{children:gl(e.value)})}function GS(e){return a.jsx(a.Fragment,{children:Gd(e.value)})}function YY(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(Xd,{value:t.numerator})," / ",a.jsx(Xd,{value:t.denominator})]}):null}function Jd(e){if(!e.value)return null;const t=e.value.display||e.value.reference||fo(e.value);return e.link!==!1&&e.value.reference?a.jsx(jt,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}function MP(e,t,n,r){if(!In(n?.slices))return[e];const i=new Array(t.length+1);for(let s=0;s<i.length;s++)i[s]=[];for(const s of e){const c=Hk(s,t,n.discriminator,r);let u=c?t.findIndex(f=>f.name===c):-1;u===-1&&(u=t.length),i[u].push(s)}return i}async function LP({medplum:e,property:t}){return new Promise((n,r)=>{if(!t.slicing){n([]);return}const i=[],s=[],c=[];for(const u of t.slicing.slices){if(!Fk(u)){console.debug("Unsupported slice definition",u);continue}let f;In(u.elements)||(f=u.type[0]?.profile?.[0]),i.push(u),s.push(f),f&&c.push(e.requestProfileSchema(f))}Promise.all(c).then(()=>{for(let u=0;u<i.length;u++){const f=i[u],h=s[u];if(h){const m=Su(h);f.typeSchema=m}}n(i)}).catch(r)})}function dg(e,t,n){return t!==void 0?a.jsx(e,{value:t,children:n}):n}function KY(e){const{slice:t,property:n}=e,r=t.typeSchema?.elements??t.elements,i=v.useContext(gn),s=v.useMemo(()=>{if(In(r))return su({parentContext:i,elements:r,path:e.path,profileUrl:t.typeSchema?.url})},[i,e.path,t.typeSchema?.url,r]);return dg(gn.Provider,s,a.jsx(a.Fragment,{children:e.value.map((c,u)=>a.jsx("div",{children:a.jsx(ho,{property:n,path:e.path,arrayElement:!0,elementDefinitionType:t.type[0],propertyType:t.type[0].code,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${u}-${e.value.length}`))}))}const jR=50;function XY(e){const{property:t,propertyType:n}=e,r=Re(),i=v.useMemo(()=>Array.isArray(e.values)?e.values:[],[e.values]),[s,c]=v.useState(!0),[u,f]=v.useState([]),[h,m]=v.useState(()=>[i]),[g,y]=v.useState(0),x=v.useContext(gn);if(v.useEffect(()=>{LP({medplum:r,property:t}).then(C=>{y(i.length),f(C);const T=i.slice(0,jR),R=MP(T,C,t.slicing,x.profileUrl);m(R),c(!1)}).catch(C=>{console.error(C),c(!1)})},[r,t,x.profileUrl,m,i]),s)return a.jsx("div",{children:"Loading..."});let S;if(t.type[0]?.code!=="Extension"){const C=h[u.length],T=C.map((R,E)=>a.jsx("div",{children:a.jsx(ho,{path:e.path,arrayElement:!0,property:t,propertyType:n,value:R,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${E}-${C.length}`));if(e.includeDescriptionListEntry){if(!In(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const R=e.path.split(".").pop();S=a.jsx(Ur,{term:Tl(R),children:T})}else S=a.jsx(a.Fragment,{children:T})}return a.jsxs(a.Fragment,{children:[u.map((C,T)=>{if(!e.path)throw new Error(`Displaying a resource property with slices of type ${e.propertyType} requires path`);let R=a.jsx(KY,{path:e.path,slice:C,property:t,value:h[T],ignoreMissingValues:e.ignoreMissingValues,link:e.link},C.name);return e.includeDescriptionListEntry&&(R=a.jsx(Ur,{term:Tl(C.name),children:R},C.name)),R}),S,g>jR&&a.jsx(xe,{justify:"right",children:a.jsxs(ge,{children:["... ",g," total values"]})})]})}function ho(e){const{property:t,propertyType:n,value:r}=e;if(t?.path?.endsWith(".id"))return a.jsxs(ar,{gap:3,align:"center",children:[r,!kn(r)&&a.jsx(C0,{value:r,timeout:2e3,children:({copied:s,copy:c})=>a.jsx(Zr,{label:s?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(Pn,{variant:"subtle",color:s?"teal":"gray",onClick:c,children:s?a.jsx(Go,{size:"1rem"}):a.jsx(MS,{size:"1rem"})})})})]});if(t&&(t.isArray||t.max>1)&&!e.arrayElement)return n===re.Attachment?a.jsx(gY,{values:r,maxWidth:e.maxWidth,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,property:t,path:e.path}):a.jsx(XY,{path:e.path,property:t,propertyType:n,values:r,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case re.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case re.SystemString:case re.string:return e.property?.path?.toLowerCase().includes("secret")?a.jsx(JY,{value:r}):a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case re.code:case re.date:case re.decimal:case re.id:case re.integer:case re.positiveInt:case re.unsignedInt:case re.uri:case re.url:case re.xhtml:return a.jsx(a.Fragment,{children:r});case re.canonical:return a.jsx(Jd,{value:{reference:r},link:e.link});case re.dateTime:case re.instant:return a.jsx(a.Fragment,{children:Nr(r)});case re.time:return a.jsx(a.Fragment,{children:Tk(r)});case re.markdown:return a.jsx("pre",{children:r});case re.Address:return a.jsx(cq,{value:r});case re.Annotation:return a.jsx(a.Fragment,{children:r?.text});case re.Attachment:return a.jsx(kf,{value:r,maxWidth:e.maxWidth});case re.CodeableConcept:return a.jsx(Lo,{value:r});case re.Coding:return a.jsx(FY,{value:r});case re.ContactDetail:return a.jsx(HY,{value:r});case re.ContactPoint:return a.jsx(OP,{value:r});case re.HumanName:return a.jsx(US,{value:r});case re.Identifier:return a.jsx(WY,{value:r});case re.Money:return a.jsx(QY,{value:r});case re.Period:return a.jsx(a.Fragment,{children:KB(r)});case re.Quantity:case re.Duration:return a.jsx(Xd,{value:r});case re.Range:return a.jsx(GS,{value:r});case re.Ratio:return a.jsx(YY,{value:r});case re.Reference:return a.jsx(Jd,{value:r,link:e.link});case re.Timing:return a.jsx(a.Fragment,{children:Rk(r)});case re.Dosage:case re.UsageContext:if(!e.path)throw new Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(Xp,{path:e.path,value:{type:n,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues});case re.Extension:if(!e.path)throw new Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(GY,{path:e.path,value:r,compact:!0,ignoreMissingValues:e.ignoreMissingValues,elementDefinitionType:e.elementDefinitionType});default:if(!t)throw new Error(`Displaying property of type ${e.propertyType} requires element schema`);if(!e.path)throw new Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(Xp,{path:e.path,value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function JY(e){const[t,n]=v.useState(!1),r=e.value??"",i=!kn(r),s="•".repeat(8);return a.jsxs(ar,{gap:3,align:"center",children:[t?a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r}):a.jsx("div",{style:{whiteSpace:"pre-wrap"},"aria-hidden":"true",children:i?s:""}),i&&a.jsxs(a.Fragment,{children:[a.jsx(C0,{value:e.value,timeout:2e3,children:({copied:c,copy:u})=>a.jsx(Zr,{label:c?"Copied":"Copy secret",withArrow:!0,position:"right",children:a.jsx(Pn,{variant:"subtle",color:c?"teal":"gray",onClick:u,"aria-label":c?"Copied":"Copy secret",children:c?a.jsx(Go,{size:"1rem"}):a.jsx(MS,{size:"1rem"})})})}),a.jsx(Zr,{label:t?"Hide secret":"Show secret",withArrow:!0,position:"right",children:a.jsx(Pn,{variant:"subtle",color:"gray",onClick:()=>n(!t),"aria-label":t?"Hide secret":"Show secret",children:t?a.jsx(hG,{size:"1rem"}):a.jsx(mG,{size:"1rem"})})})]})]})}const IP=["extension","modifierExtension"],ZY=rP.filter(e=>!IP.includes(e));function Xp(e){const t=e.value,{value:n,type:r}=t,i=v.useContext(gn),s=e.profileUrl??i?.profileUrl,c=v.useMemo(()=>Gm(r,s),[s,r]),u=v.useMemo(()=>{if(c)return su({parentContext:i,elements:c.elements,path:e.path,profileUrl:c.url,accessPolicyResource:e.accessPolicyResource})},[c,i,e.path,e.accessPolicyResource]);if(kn(n))return null;if(!c)return a.jsxs("div",{children:[r," not implemented"]});if(typeof n=="object"&&"name"in n&&Object.keys(n).length===1&&typeof n.name=="string")return a.jsx("div",{children:n.name});const f=u??i;return dg(gn.Provider,u,a.jsx(Pf,{compact:e.compact,children:Object.entries(f.elements).map(([h,m])=>{if(IP.includes(h)&&kn(m.slicing?.slices))return null;if(ZY.includes(h))return null;if(iP.includes(h)&&m.path.split(".").length===2||h.includes("."))return null;const[g,y]=ug(t,h,f.profileUrl);if((e.ignoreMissingValues||m.max===0)&&kn(g)||e.path.endsWith(".extension")&&(h==="url"||h==="id"))return null;const x=m.max>1||m.isArray,S=a.jsx(ho,{property:m,propertyType:y,path:e.path+"."+h,value:g,ignoreMissingValues:e.ignoreMissingValues,includeArrayDescriptionListEntry:x,link:e.link},h);return x?S:a.jsx(Ur,{term:Tl(h),children:S},h)})}))}const eK="_dimmed_11me5_1",tK="_preserveBreaks_11me5_5",nb={dimmed:eK,preserveBreaks:tK},zP="Read Only";function $P(e,t){return e?a.jsx(Zr.Floating,{label:e,children:t}):t}function UP(e){const{debugMode:t}=v.useContext(gn);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,$P(e?.readonly?zP:void 0,a.jsxs(xe,{wrap:"nowrap","data-testid":e.testId,children:[a.jsx("div",{children:e.children}),a.jsx("div",{children:a.jsx(mn.Wrapper,{id:e.htmlFor,label:n,classNames:{label:e?.readonly?nb.dimmed:void 0},description:e.description,withAsterisk:e.withAsterisk,children:null})})]}))}function Vt(e){const{debugMode:t}=v.useContext(gn);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,$P(e?.readonly?zP:void 0,a.jsx(mn.Wrapper,{id:e.htmlFor,label:n,classNames:{label:Ft({[nb.dimmed]:e?.readonly},nb.preserveBreaks)},description:e.description,withAsterisk:e.withAsterisk,error:Ut(e.outcome,e.errorExpression??e.htmlFor),"data-testid":e.testId,children:e.children}))}function nK(e,t,n,r,i){const s=r.type;if(s.length>1)for(const c of s){const u=t.replace("[x]",Xn(c.code));u in e&&delete e[u]}return kn(i)?e[n]=void 0:e[n]=i,e}function rK(e){return!!e&&!kn(e.url)&&!kn(e.name)}function iK(e){const{defaultValue:t,onChange:n,withHelpText:r,outcome:i,path:s,valuePath:c,...u}=e,[f,h]=v.useState(t);function m(g){const y=aK(g);h(y),n&&n(y)}return a.jsx(Af,{defaultValue:f&&oK(f),onChange:m,withHelpText:r??!0,...u})}function oK(e){return e.coding?.map(t=>({system:t.system,code:t.code,display:t.display}))}function aK(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function sK(e){const{defaultValue:t,onChange:n,withHelpText:r,response:i,...s}=e,[c,u]=v.useState(i?.answer?.[0]?.valueCoding??t);function f(h){const m=h[0],g=m&&cK(m);u(g),n&&n(g)}return a.jsx(Af,{defaultValue:c?lK(c):void 0,maxValues:1,onChange:f,withHelpText:r??!0,...s})}function lK(e){return{system:e.system,code:e.code,display:e.display}}function cK(e){return{system:e.system,code:e.code,display:e.display}}function BP(e){const{path:t,outcome:n}=e,{elementsByPath:r,getExtendedProps:i}=v.useContext(gn),[s,c]=v.useState(e.defaultValue),u=v.useRef(s);u.current=s;const[f,h,m]=v.useMemo(()=>["system","use","value"].map(E=>r[t+"."+E]),[r,t]),[g,y,x]=v.useMemo(()=>["system","use","value"].map(E=>i(t+"."+E)),[i,t]);function S(E){E&&Object.keys(E).length===0&&(E=void 0),c(E),e.onChange&&e.onChange(E)}function w(E){const _={...u.current,system:E};E||delete _.system,S(_)}function C(E){const _={...u.current,use:E};E||delete _.use,S(_)}function T(E){const _={...u.current,value:E};E||delete _.value,S(_)}const R=e.valuePath??t;return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(pn,{disabled:e.disabled||g?.readonly,"data-testid":"system",defaultValue:s?.system,required:(f?.min??0)>0,onChange:E=>w(E.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:Ut(n,R+".system")}),a.jsx(pn,{disabled:e.disabled||y?.readonly,"data-testid":"use",defaultValue:s?.use,required:(h?.min??0)>0,onChange:E=>C(E.currentTarget.value),data:["","home","work","temp","old","mobile"],error:Ut(n,R+".use")}),a.jsx(Fe,{disabled:e.disabled||x?.readonly,placeholder:"Value",defaultValue:s?.value,required:(m?.min??0)>0,onChange:E=>T(E.currentTarget.value),error:Ut(n,R+".value")})]})}function uK(e){const[t,n]=v.useState(e.defaultValue),r=v.useRef(t);r.current=t;const{getExtendedProps:i}=v.useContext(gn),[s,c]=v.useMemo(()=>["name","telecom"].map(m=>i(e.path+"."+m)),[i,e.path]);function u(m){n(m),e.onChange&&e.onChange(m)}function f(m){const g={...r.current,name:m};m||delete g.name,u(g)}function h(m){const g={...r.current,telecom:m&&[m]};m||delete g.telecom,u(g)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Fe,{disabled:e.disabled||s?.readonly,"data-testid":e.name+"-name",name:e.name+"-name",placeholder:"Name",style:{width:180},defaultValue:t?.name,onChange:m=>f(m.currentTarget.value)}),a.jsx(BP,{disabled:e.disabled||c?.readonly,name:e.name+"-telecom",path:e.path+".telecom",defaultValue:t?.telecom?.[0],onChange:h,outcome:e.outcome})]})}function dK(e){if(!e)return"";const t=new Date(e);return Qm(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function WS(e){if(!e)return"";const t=new Date(e);return Qm(t)?t.toISOString():""}function Io(e){return a.jsx(Fe,{id:e.name,name:e.name,label:e.label,"data-autofocus":e.autoFocus,"data-testid":e["data-testid"]??e.name,placeholder:e.placeholder,required:e.required,disabled:e.disabled,type:fK(),step:1,defaultValue:dK(e.defaultValue),autoFocus:e.autoFocus,error:Ut(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(WS(n))}}})}function fK(){return"datetime-local"}function hK(e){const{propertyType:t}=e,n=Re(),r=v.useMemo(()=>{if(In(t.profile))return t.profile[0]},[t]),[i,s]=v.useState(r!==void 0);return v.useEffect(()=>{r&&(s(!0),n.requestProfileSchema(r).then(()=>s(!1)).catch(c=>{s(!1),console.warn(c)}))},[n,r]),r&&(i||!dS(r))?a.jsx("div",{children:"Loading..."}):a.jsx(XS,{profileUrl:r,path:e.path,typeName:"Extension",defaultValue:e.defaultValue,onChange:e.onChange})}function pK(e){const{outcome:t,path:n}=e,[r,i]=v.useState(e.defaultValue),{getExtendedProps:s}=v.useContext(gn),[c,u,f,h,m]=v.useMemo(()=>["use","prefix","given","family","suffix"].map(R=>s(e.path+"."+R)),[s,e.path]);function g(R){i(R),e.onChange&&e.onChange(R)}function y(R){g({...r,use:R||void 0})}function x(R){g({...r,prefix:R?R.split(" "):void 0})}function S(R){g({...r,given:R?R.split(" "):void 0})}function w(R){g({...r,family:R||void 0})}function C(R){g({...r,suffix:R?R.split(" "):void 0})}const T=e.valuePath??n;return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(pn,{disabled:e.disabled||c?.readonly,defaultValue:r?.use,name:e.name+"-use","data-testid":"use",onChange:R=>y(R.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:Ut(t,T+".use")}),a.jsx(Fe,{disabled:e.disabled||u?.readonly,placeholder:"Prefix",name:e.name+"-prefix",defaultValue:r?.prefix?.join(" "),onChange:R=>x(R.currentTarget.value),error:Ut(t,T+".prefix")}),a.jsx(Fe,{disabled:e.disabled||f?.readonly,placeholder:"Given",name:e.name+"-given",defaultValue:r?.given?.join(" "),onChange:R=>S(R.currentTarget.value),error:Ut(t,T+".given")}),a.jsx(Fe,{disabled:e.disabled||h?.readonly,name:e.name+"-family",placeholder:"Family",defaultValue:r?.family,onChange:R=>w(R.currentTarget.value),error:Ut(t,T+".family")}),a.jsx(Fe,{disabled:e.disabled||m?.readonly,placeholder:"Suffix",name:e.name+"-suffix",defaultValue:r?.suffix?.join(" "),onChange:R=>C(R.currentTarget.value),error:Ut(t,T+".suffix")})]})}function mK(e){const[t,n]=v.useState(e.defaultValue),{elementsByPath:r,getExtendedProps:i}=v.useContext(gn),[s,c]=v.useMemo(()=>["system","value"].map(g=>r[e.path+"."+g]),[r,e.path]),[u,f]=v.useMemo(()=>["system","value"].map(g=>i(e.path+"."+g)),[i,e.path]);function h(g){n(g),e.onChange&&e.onChange(g)}const m=e.valuePath??e.path;return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(Fe,{disabled:e.disabled||u?.readonly,placeholder:"System",required:(s?.min??0)>0,defaultValue:t?.system,onChange:g=>h({...t,system:g.currentTarget.value}),error:Ut(e.outcome,m+".system")}),a.jsx(Fe,{disabled:e.disabled||f?.readonly,placeholder:"Value",required:(c?.min??0)>0,defaultValue:t?.value,onChange:g=>h({...t,value:g.currentTarget.value}),error:Ut(e.outcome,m+".value")})]})}const gK=["USD","EUR","CAD","GBP","AUD"];function vK(e){const{onChange:t}=e,[n,r]=v.useState(e.defaultValue),{getExtendedProps:i}=v.useContext(gn),[s,c]=v.useMemo(()=>["currency","value"].map(g=>i(e.path+"."+g)),[i,e.path]),u=v.useCallback(g=>{r(g),t&&t(g)},[t]),f=v.useCallback(g=>{u({...n,currency:g.currentTarget.value})},[n,u]),h=v.useCallback(g=>{u({...n,value:g.currentTarget.valueAsNumber})},[n,u]),m=a.jsx(pn,{disabled:e.disabled||s?.readonly,defaultValue:n?.currency,data:gK,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:f});return a.jsx(Fe,{disabled:e.disabled||c?.readonly,type:"number",name:e.name,label:e.label,placeholder:e.placeholder??"Value",defaultValue:n?.value?.toString()??"USD",leftSection:a.jsx(nG,{size:14}),rightSection:m,rightSectionWidth:92,onChange:h})}function yK(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(gn),[i,s]=v.useMemo(()=>["start","end"].map(u=>r(e.path+"."+u)),[r,e.path]);function c(u){n(u),e.onChange&&e.onChange(u)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Io,{disabled:e.disabled||i?.readonly,name:e.name+".start",placeholder:"Start",defaultValue:t?.start,onChange:u=>c({...t,start:u})}),a.jsx(Io,{disabled:e.disabled||s?.readonly,name:e.name+".end",placeholder:"End",defaultValue:t?.end,onChange:u=>c({...t,end:u})})]})}function Dl(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(gn),[i,s,c]=v.useMemo(()=>["comparator","value","unit"].map(f=>r(e.path+"."+f)),[r,e.path]);function u(f){n(f),e.onChange&&e.onChange(f)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(pn,{disabled:e.disabled||i?.readonly,style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t?.comparator,data:["","<","<=",">=",">"],onChange:f=>u({...t,comparator:f.currentTarget.value})}),a.jsx(Fe,{disabled:e.disabled||s?.readonly,id:e.name,name:e.name,required:e.required,"data-autofocus":e.autoFocus,"data-testid":e.name+"-value",type:"number",placeholder:"Value",defaultValue:t?.value,autoFocus:e.autoFocus,step:"any",onWheel:f=>{e.disableWheel&&f.currentTarget.blur()},onChange:f=>{u({...t,value:xK(f.currentTarget.value)})}}),a.jsx(Fe,{disabled:e.disabled||c?.readonly,placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t?.unit,onChange:f=>u({...t,unit:f.currentTarget.value})})]})}function xK(e){if(e)return Number.parseFloat(e)}function QS(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(gn),[i,s]=v.useMemo(()=>["low","high"].map(u=>r(e.path+"."+u)),[r,e.path]);function c(u){n(u),e.onChange&&e.onChange(u)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Dl,{path:e.path+".low",disabled:e.disabled||i?.readonly,name:e.name+"-low",defaultValue:t?.low,onChange:u=>c({...t,low:u})}),a.jsx(Dl,{path:e.path+".high",disabled:e.disabled||s?.readonly,name:e.name+"-high",defaultValue:t?.high,onChange:u=>c({...t,high:u})})]})}function bK(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(gn),[i,s]=v.useMemo(()=>["numerator","denominator"].map(u=>r(e.path+"."+u)),[r,e.path]);function c(u){n(u),e.onChange&&e.onChange(u)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Dl,{path:e.path+".numerator",disabled:e.disabled||i?.readonly,name:e.name+"-numerator",defaultValue:t?.numerator,onChange:u=>c({...t,numerator:u})}),a.jsx(Dl,{path:e.path+".denominator",disabled:e.disabled||s?.readonly,name:e.name+"-denominator",defaultValue:t?.denominator,onChange:u=>c({...t,denominator:u})})]})}const SK={Device:"device-name",Observation:"code",Subscription:"criteria",User:"email:contains"},jK=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","CareTeam","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","Group","HealthcareService","ImplementationGuide","InsurancePlan","Library","Location","Measure","MedicinalProduct","MessageDefinition","NamingSystem","OperationDefinition","Organization","Patient","Person","PlanDefinition","Practitioner","Project","Questionnaire","RelatedPerson","ResearchDefinition","ResearchElementDefinition","ResearchStudy","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function wK(e){return{value:$t(e)??"",label:Ea(e),resource:e}}function Eu(e){const t=Re(),{resourceType:n,searchCriteria:r}=e,[i,s]=v.useState(),c=Wt(e.defaultValue,s),u=e.itemComponent??CK,f=e.onChange,h=v.useCallback(async(g,y)=>{const x=EK(n),S=new URLSearchParams({[x]:g??"",_count:"10",...r});return await t.searchResources(n,S,{signal:y})},[t,n,r]),m=v.useCallback(g=>{f&&f(g[0])},[f]);return In(e.defaultValue)&&!i&&!c?null:a.jsx(BS,{disabled:e.disabled,name:e.name,label:e.label,error:e.error,required:e.required,itemComponent:u,defaultValue:c,placeholder:e.placeholder,maxValues:1,toOption:wK,loadOptions:h,onChange:m,clearable:!0})}const CK=v.forwardRef(({label:e,resource:t,active:n,...r},i)=>a.jsx("div",{ref:i,...r,children:a.jsxs(xe,{wrap:"nowrap",children:[a.jsx(mo,{value:t}),a.jsxs("div",{children:[a.jsx(ge,{children:e}),a.jsx(ge,{size:"xs",c:"dimmed",children:t.birthDate||t.id})]})]})}));function EK(e){return SK[e]??(jK.includes(e)?"name":"_id")}function ba(e){const{onChange:t}=e,n=Re(),[r,i]=v.useState(e.defaultValue),[s,c]=v.useState(()=>TK(e.targetTypes)),[u,f]=v.useState(()=>RK(e.defaultValue,s)),h=v.useRef(new cS),m=v.useMemo(()=>u?.type==="profile"?{...e.searchCriteria,_profile:u.value}:e.searchCriteria,[e.searchCriteria,u]);v.useEffect(()=>{let x=!1;const S=s?.map(w=>{if(!DK(w))return Promise.resolve(w);x=!0;const C=w.value,T=h.current.get(C);if(T)return T;const R=_K(n,w.value).then(_=>{const P={...w};return _?In(_.type)?(P.resourceType=_.type,P.name=_.name,P.title=_.title):(console.error(`StructureDefinition.type missing for ${w.value}`),P.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${w.value}`),P.error="StructureDefinition not found"),P}).catch(_=>(console.error(_),{...w,error:_})),E=new no(R);return h.current.set(C,E),E});!S||!x||Promise.all(S).then(w=>{if(c(w),!u)return;const C=w.findIndex(T=>T.value===u.value||T.resourceType===u.resourceType);if(C===-1){console.debug(`defaultValue had unexpected resourceType: ${u.resourceType}`);return}f(w[C])}).catch(console.error)},[n,u,s]);const g=v.useCallback(x=>{const S=x?nn(x):void 0;i(S),t&&t(S)},[t]),y=v.useMemo(()=>s?s.map(x=>({value:x.value,label:x.type==="profile"?x.title??x.name??x.resourceType??x.value:x.value})):[],[s]);return a.jsxs(a.Fragment,{children:[e.name&&a.jsx("input",{type:"hidden",name:e.name,value:r?.reference??""}),a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[s&&s.length>1&&a.jsx(pn,{name:e.name+"-resourceType",disabled:e.disabled,"data-autofocus":e.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:u?.resourceType,autoFocus:e.autoFocus,onChange:x=>{const S=x.currentTarget.value,w=s.find(C=>C.value===S);f(w)},data:y}),!s&&a.jsx(HS,{disabled:e.disabled,autoFocus:e.autoFocus,testId:"reference-input-resource-type-input",defaultValue:u?.resourceType,onChange:x=>{f(x?{type:"resourceType",value:x,resourceType:x}:void 0)},name:e.name+"-resourceType",placeholder:"Resource Type"}),a.jsx(Eu,{resourceType:u?.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:m,onChange:g,disabled:e.disabled})]})]})}function TK(e){if(!e||e.length===0||e.length===1&&e[0]==="Resource")return;const t=[];for(const n of e)n.includes("/")?t.push({type:"profile",value:n}):t.push({type:"resourceType",value:n,resourceType:n});return t}function RK(e,t){const n=e?.reference?.split("/")[0];if(n){const r=t?.find(i=>i.resourceType===n);return r||{type:"resourceType",value:n,resourceType:n}}if(t&&t.length>0)return t[0]}async function _K(e,t){const n=Su(t);if(n)return{type:n.type,name:n.name,title:n.title};const r=`{
199
+ StructureDefinitionList(url: "${t}", _sort: "_lastUpdated", _count: 1) {
200
+ type,
201
+ name,
202
+ title,
203
+ }
204
+ }`.replaceAll(/\s+/g," ");return(await e.graphql(r)).data.StructureDefinitionList[0]}function DK(e){return e.type==="profile"&&!e?.error&&kn(e.resourceType)}function AK(e,t,n){return t===void 0?e:n===void 0?t:`${t}[${n}]`}const kK="_indented_ldk1d_1",VP={indented:kK};function fg({propertyDisplayName:e,onClick:t,testId:n}){const r=e?`Add ${e}`:"Add";return e?a.jsx(Me,{title:r,size:"sm",color:"green.6",variant:"subtle","data-testid":n,leftSection:a.jsx(Yd,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(Pn,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(Yd,{size:"1.25rem"})})}function YS({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(Pn,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,variant:"subtle",onClick:t,children:a.jsx(Qp,{size:"1.25rem"})})}function PK(e){const{slice:t,property:n}=e,[r,i]=v.useState(e.defaultValue),s=t.typeSchema?.elements??t.elements,c=v.useContext(gn),u=v.useMemo(()=>{if(In(s))return su({parentContext:c,elements:s,path:e.path,profileUrl:t.typeSchema?.url})},[c,e.path,t.typeSchema?.url,s]);function f(x){i(x),e.onChange&&e.onChange(x)}const h=t.min>0,m=kn(t.elements),g=Ak(t.name),y=e.property.readonly&&r.length===0;return dg(gn.Provider,u,a.jsx(Vt,{title:g,description:t.definition,withAsterisk:h,fhirPath:`${n.path}:${t.name}`,testId:e.testId,readonly:e.property.readonly,children:y?a.jsx(ge,{c:"dimmed",children:"(empty)"}):a.jsxs(Ne,{className:m?VP.indented:void 0,children:[r.map((x,S)=>a.jsxs(xe,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},"data-testid":e.testId&&`${e.testId}-elements-${S}`,children:a.jsx(KS,{elementDefinitionType:t.type[0],name:t.name,defaultValue:x,onChange:w=>{const C=[...r];C[S]=w,f(C)},outcome:e.outcome,min:t.min,max:t.max,binding:t.binding,path:e.path,valuePath:void 0,readOnly:e.property.readonly})}),!e.property.readonly&&r.length>t.min&&a.jsx(YS,{propertyDisplayName:g,testId:e.testId&&`${e.testId}-remove-${S}`,onClick:w=>{jn(w);const C=[...r];C.splice(S,1),f(C)}})]},`${S}-${r.length}`)),!e.property.readonly&&r.length<t.max&&a.jsx(xe,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(fg,{propertyDisplayName:g,onClick:x=>{jn(x);const S=[...r,void 0];f(S)},testId:e.testId&&`${e.testId}-add`})})]})}))}function NK(e){const{property:t}=e,n=Re(),[r,i]=v.useState(!0),[s,c]=v.useState([]),[u]=v.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[f,h]=v.useState(()=>[u]),m=v.useContext(gn),g=t.type[0]?.code;v.useEffect(()=>{LP({medplum:n,property:t}).then(R=>{c(R);const E=MP(u,R,t.slicing,m.profileUrl);OK(E,R),h(E),i(!1)}).catch(R=>{console.error(R),i(!1)})},[n,t,u,m.profileUrl,h]);function y(R,E){const _=[...f];if(_[E]=R,h(_),e.onChange){const P=_.flat().filter(O=>O!==void 0);e.onChange(P)}}if(r)return a.jsx("div",{children:"Loading..."});const x=s.length,S=f[x],w=!(e.hideNonSliceValues??(g==="Extension"&&s.length>0)),C=Tl(t.path),T=e.property.readonly&&s.length===0&&u.length===0;return a.jsxs(Ne,{className:e.indent?VP.indented:void 0,children:[T&&a.jsx(ge,{c:"dimmed",children:"(empty)"}),s.map((R,E)=>a.jsx(PK,{slice:R,path:e.path,valuePath:e.valuePath,property:t,defaultValue:f[E],onChange:_=>{y(_,E)},testId:`slice-${R.name}`},R.name)),w&&S.map((R,E)=>a.jsxs(xe,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Nf,{arrayElement:!0,property:e.property,name:e.name+"."+E,path:e.path,valuePath:AK(e.path,e.valuePath,E),defaultValue:R,onChange:_=>{const P=[...S];P[E]=_,y(P,x)},defaultPropertyType:void 0,outcome:e.outcome})}),!e.property.readonly&&a.jsx(YS,{propertyDisplayName:C,testId:`nonsliced-remove-${E}`,onClick:_=>{jn(_);const P=[...S];P.splice(E,1),y(P,x)}})]},`${E}-${S.length}`)),!e.property.readonly&&w&&f.flat().length<t.max&&a.jsx(xe,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(fg,{propertyDisplayName:C,onClick:R=>{jn(R);const E=[...S];E.push(void 0),y(E,x)},testId:"nonsliced-add"})})]})}function OK(e,t){for(let n=0;n<t.length;n++){const r=t[n],i=e[n];for(;i.length<r.min;)i.push(void 0)}}function MK(e){const[t,n]=v.useState(!1),r=n2(),i=v.useRef(null),s={...e.styles};return t||(s.input||(s.input={}),s.input.WebkitTextSecurity="disc"),a.jsxs(ar,{gap:"xs",children:[a.jsx(Ul,{...e,styles:{...s,root:{...s.root??{},flexGrow:1}},ref:i,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(Pn,{title:"Copy secret",onClick:()=>{r.copy(i.current?.value),Ae({color:"green",message:"Copied"})},children:a.jsx(MS,{})})]})}const LK=["sun","mon","tue","wed","thu","fri","sat"];function IK(e){const[t,n]=v.useState(e.defaultValue),[r,i]=v.useState(!e.disabled&&(e.defaultModalOpen??!1));return a.jsxs(a.Fragment,{children:[a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx("span",{"data-testid":"timinginput-display",children:Rk(t)||"No repeat"}),a.jsx(Me,{disabled:e.disabled,onClick:()=>i(!0),children:"Edit"})]}),!e.disabled&&a.jsx(zK,{path:e.path,visible:r,defaultValue:t,onOk:s=>{e.onChange&&e.onChange(s),n(s),i(!1)},onCancel:()=>i(!1)})]})}const wR={repeat:{period:1,periodUnit:"d"}};function zK(e){const[t,n]=v.useState(e.defaultValue||wR),[r,i]=v.useState(()=>(e.defaultValue?.repeat?.timeOfDay??[]).map((E,_)=>({id:_,value:E}))),s=v.useRef(r.length),{getExtendedProps:c}=v.useContext(gn),[u,f,h,m,g,y]=v.useMemo(()=>["event","repeat","repeat.period","repeat.periodUnit","repeat.dayOfWeek","repeat.timeOfDay"].map(E=>c(e.path+"."+E)),[c,e.path]);function x(E){n(_=>({..._,event:[E]}))}function S(E){n(_=>({..._,repeat:E}))}function w(E){n(_=>({..._,repeat:{..._.repeat,period:E}}))}function C(E){n(_=>({..._,repeat:{..._.repeat,periodUnit:E}}))}function T(E){n(_=>({..._,repeat:{..._.repeat,dayOfWeek:E}}))}function R(E){i(_=>{const P=E(_),O=P.map(k=>k.value);return n(k=>({...k,repeat:{...k.repeat,timeOfDay:O}})),P})}return a.jsx(Mn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(Ne,{gap:"md",children:[a.jsx(Vt,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(Io,{disabled:u?.readonly,name:"timing-dialog-start",onChange:E=>x(E)})}),a.jsx(bf,{disabled:f?.readonly,label:"Repeat",checked:!!t.repeat,onChange:E=>S(E.currentTarget.checked?wR.repeat:void 0)}),t.repeat&&a.jsxs(a.Fragment,{children:[a.jsx(Vt,{title:"Repeat every",htmlFor:"timing-dialog-period",children:a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Fe,{disabled:h?.readonly,type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:E=>w(Number.parseInt(E.currentTarget.value,10)||1)}),a.jsx(pn,{disabled:m?.readonly,id:"timing-dialog-periodUnit",name:"timing-dialog-periodUnit",defaultValue:t.repeat.periodUnit,onChange:E=>C(E.currentTarget.value),data:[{label:"minute",value:"min"},{label:"hour",value:"h"},{label:"day",value:"d"},{label:"week",value:"wk"},{label:"month",value:"mo"},{label:"year",value:"a"}]})]})}),t.repeat.periodUnit==="wk"&&a.jsx(Vt,{title:"Repeat on",children:a.jsx(Ud.Group,{multiple:!0,onChange:T,value:t.repeat?.dayOfWeek,children:a.jsx(xe,{justify:"space-between",mt:"xs",gap:"xs",children:LK.map(E=>a.jsx(Ud,{value:E,size:"xs",radius:"xl",disabled:g?.readonly,checked:(t.repeat?.dayOfWeek??[]).includes(E),children:E.charAt(0).toUpperCase()},E))})})}),a.jsx(Vt,{title:"At times",children:a.jsxs(Ne,{mt:"xs",children:[r.map((E,_)=>a.jsxs(xe,{children:[a.jsx(Fe,{disabled:y?.readonly,type:"time",id:`timing-dialog-repeat-timeOfDay[${_}]`,name:`timing-dialog-repeat-timeOfDay[${_}]`,"data-testid":`timing-repeat-timeOfDay-input-${_}`,defaultValue:E.value.slice(0,5),onChange:P=>{const O=`${P.currentTarget.value}:00`;R(k=>k.with(_,{...E,value:O}))},style:{flexGrow:1}}),a.jsx(YS,{testId:`timing-repeat-timeOfDay-remove-${_}`,onClick:()=>R(P=>P.toSpliced(_,1))})]},E.id)),a.jsx(le,{children:a.jsx(fg,{propertyDisplayName:"Time of Day",onClick:()=>R(E=>{const _=s.current++;return E.concat({id:_,value:"00:00:00"})})})})]})})]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Me,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function Nf(e){const{property:t,name:n,onChange:r,defaultValue:i}=e,s=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,c=t.type;if((t.isArray||t.max>1)&&!e.arrayElement){if(s===re.Attachment)return a.jsx(vY,{name:n,defaultValue:i,onChange:r,disabled:t.readonly});const u=c[0]?.code!==re.Extension;return a.jsx(NK,{property:t,name:n,path:e.path,valuePath:e.valuePath,defaultValue:i,indent:u,onChange:r,outcome:e.outcome})}else return c.length>1?a.jsx($K,{elementDefinitionTypes:c,...e}):a.jsx(KS,{name:n,defaultValue:i,onChange:u=>{if(e.onChange){const f=e.name.replace("[x]",Xn(c[0].code));e.onChange(u,f)}},outcome:e.outcome,elementDefinitionType:c[0],min:t.min,max:t.min,binding:t.binding,path:e.path,valuePath:e.valuePath,readOnly:t.readonly})}function $K(e){const t=e.elementDefinitionTypes;let n;e.defaultPropertyType&&(n=t.find(s=>s.code===e.defaultPropertyType)),n||(n=t[0]);const[r,i]=v.useState(n);return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(pn,{disabled:e.property.readonly,style:{width:"200px"},defaultValue:r.code,"data-testid":e.name&&e.name+"-selector",onChange:s=>{i(t.find(c=>c.code===s.currentTarget.value))},data:t.map(s=>({value:s.code,label:s.code}))}),a.jsx(KS,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:s=>{e.onChange&&e.onChange(s,e.name.replace("[x]",Xn(r.code)))},min:e.property.min,max:e.property.max,binding:e.property.binding,path:e.property.path,valuePath:e.valuePath,readOnly:e.property.readonly})]})}function KS(e){const{name:t,onChange:n,outcome:r,binding:i,path:s,valuePath:c,readOnly:u}=e,f=e.min!==void 0&&e.min>0,h=e.elementDefinitionType.code,m=v.useContext(gn),g=v.useMemo(()=>{if(!gS(h)||!kn(e.defaultValue))return e.defaultValue;const S=Object.create(null);if(m.path===e.path)tR(S,m.elements);else{const w=ml(m.path,e.path);if(w===void 0)return e.defaultValue;tR(S,m.elements,w)}return In(S)?S:e.defaultValue},[h,m.path,m.elements,e.path,e.defaultValue]);if(!h)return a.jsx("div",{children:"Property type not specified "});function y(){return{name:t,defaultValue:g,onChange:n,outcome:r,path:s,valuePath:c,disabled:u}}function x(){const S=Ut(e.outcome,c??s);return{id:t,name:t,"data-testid":t,defaultValue:g,required:f,error:S,disabled:u}}switch(h){case re.SystemString:case re.canonical:case re.string:case re.uri:case re.url:return e.path==="Project.secret.value[x]"?a.jsx(MK,{...x(),onChange:S=>{e.onChange&&e.onChange(S.currentTarget.value)}}):a.jsx(Fe,{...x(),onChange:S=>{n&&n(S.currentTarget.value)}});case re.date:return a.jsx(Fe,{...x(),type:"date",onChange:S=>{n&&n(S.currentTarget.value)}});case re.time:return a.jsx(Fe,{...x(),type:"time",step:1,onChange:S=>{n&&n(S.currentTarget.value)}});case re.dateTime:case re.instant:return a.jsx(Io,{...x(),onChange:n,outcome:r});case re.decimal:case re.integer:case re.positiveInt:case re.unsignedInt:return a.jsx(Fe,{...x(),type:"number",step:h===re.decimal?"any":"1",onChange:S=>{if(n){const w=S.currentTarget.valueAsNumber;n(Number.isNaN(w)?void 0:w)}}});case re.code:return a.jsx(SP,{...x(),error:void 0,onChange:n,binding:i?.valueSet,creatable:!0,maxValues:1});case re.boolean:return a.jsx(fn,{...x(),defaultChecked:!!g,onChange:S=>{n&&n(S.currentTarget.checked)}});case re.base64Binary:case re.markdown:case re.xhtml:return a.jsx(Ul,{...x(),spellCheck:h!==re.base64Binary,onChange:S=>{n&&n(S.currentTarget.value)}});case re.Address:return a.jsx(fq,{...y()});case re.Annotation:return a.jsx(hq,{...y()});case re.Attachment:return a.jsx(wP,{...y()});case re.CodeableConcept:return a.jsx(iK,{binding:i?.valueSet,...y()});case re.Coding:return a.jsx(sK,{binding:i?.valueSet,...y()});case re.ContactDetail:return a.jsx(uK,{...y()});case re.ContactPoint:return a.jsx(BP,{...y()});case re.Extension:return a.jsx(hK,{...y(),propertyType:e.elementDefinitionType});case re.HumanName:return a.jsx(pK,{...y()});case re.Identifier:return a.jsx(mK,{...y()});case re.Money:return a.jsx(vK,{...y()});case re.Period:return a.jsx(yK,{...y()});case re.Duration:case re.Quantity:return a.jsx(Dl,{...y()});case re.Range:return a.jsx(QS,{...y()});case re.Ratio:return a.jsx(bK,{...y()});case re.Reference:return a.jsx(ba,{...y(),targetTypes:BK(e.elementDefinitionType)});case re.Timing:return a.jsx(IK,{...y()});case re.Dosage:case re.UsageContext:default:return a.jsx(XS,{...y(),typeName:h})}}const UK=[`${Gi}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function BK(e){return e?.targetProfile?.map(t=>{const n=UK.find(r=>t.startsWith(r));return n?t.slice(n.length):t})}function VK(e){const[t,n]=v.useState(e.defaultValue??{}),r=v.useContext(gn),i=v.useMemo(()=>dq(r.elements),[r.elements]);function s(u){n(u),e.onChange&&e.onChange(u)}const c={type:e.type,value:t};return a.jsx(Ne,{style:{flexGrow:1},"data-testid":e.testId,children:i.map(([u,f])=>{const[h,m]=qY(c,u,f),g=f.min!==void 0&&f.min>0,y=e.valuePath?e.valuePath+"."+u:void 0,x=a.jsx(Nf,{property:f,name:u,path:e.path+"."+u,valuePath:y,defaultValue:h,defaultPropertyType:m,onChange:(S,w)=>{s(nK({...t},u,w??u,f,S))},outcome:e.outcome},u);return e.type==="Extension"||PS.includes(u)?x:f.type.length===1&&f.type[0].code==="boolean"?a.jsx(UP,{title:Tl(u),description:f.description,htmlFor:u,fhirPath:f.path,withAsterisk:g,readonly:f.readonly,children:x},u):a.jsx(Vt,{title:Tl(u),description:f.description,withAsterisk:g,htmlFor:u,outcome:e.outcome,fhirPath:f.path,errorExpression:y,readonly:f.readonly,children:x},u)})})}const FK="_nested_1ya4k_1",HK={nested:FK};function XS(e){const[t]=v.useState(()=>e.defaultValue??{}),n=v.useContext(gn),r=e.profileUrl??n?.profileUrl,i=v.useMemo(()=>Gm(e.typeName,r),[e.typeName,r]),s=i?.type??e.typeName,c=v.useMemo(()=>{if(i)return su({parentContext:n,elements:i.elements,path:e.path,profileUrl:i.url,accessPolicyResource:e.accessPolicyResource})},[i,n,e.path,e.accessPolicyResource]);if(!i)return a.jsxs("div",{children:[s," not implemented"]});const u=n.path!=="";return dg(gn.Provider,c,a.jsx(le,{className:Ft({[HK.nested]:u}),children:a.jsx(VK,{path:e.path,valuePath:e.valuePath,type:s,defaultValue:t,onChange:e.onChange,outcome:e.outcome})}))}var Jp=class{x;y;pressure;time;constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}},qK=class FP{constructor(t,n,r,i,s,c){this.startPoint=t,this.control2=n,this.control1=r,this.endPoint=i,this.startWidth=s,this.endWidth=c}static fromPoints(t,n){const r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new FP(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(t,n,r){const i=t.x-n.x,s=t.y-n.y,c=n.x-r.x,u=n.y-r.y,f={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+r.x)/2,y:(n.y+r.y)/2},m=Math.sqrt(i*i+s*s),g=Math.sqrt(c*c+u*u),y=f.x-h.x,x=f.y-h.y,S=m+g==0?0:g/(m+g),w={x:h.x+y*S,y:h.y+x*S},C=n.x-w.x,T=n.y-w.y;return{c1:new Jp(f.x+C,f.y+T),c2:new Jp(h.x+C,h.y+T)}}length(){let n=0,r,i;for(let s=0;s<=10;s+=1){const c=s/10,u=this.point(c,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),f=this.point(c,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(s>0){const h=u-r,m=f-i;n+=Math.sqrt(h*h+m*m)}r=u,i=f}return n}point(t,n,r,i,s){return n*(1-t)*(1-t)*(1-t)+3*r*(1-t)*(1-t)*t+3*i*(1-t)*t*t+s*t*t*t}},GK=class{_et;constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};function WK(e,t=250){let n=0,r=null,i,s,c;const u=()=>{n=Date.now(),r=null,i=e.apply(s,c),r||(s=null,c=[])};return function(...h){const m=Date.now(),g=t-(m-n);return s=this,c=h,g<=0||g>t?(r&&(clearTimeout(r),r=null),n=m,i=e.apply(s,c),r||(s=null,c=[])):r||(r=window.setTimeout(u,g)),i}}var QK=class rb extends GK{constructor(t,n={}){super(),this.canvas=t,this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=n.throttle??16,this.minDistance=n.minDistance??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||"black",this.backgroundColor=n.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=n.compositeOperation||"source-over",this.canvasContextOptions=n.canvasContextOptions??{},this._strokeMoveUpdate=this.throttle?WK(rb.prototype._strokeUpdate,this.throttle):rb.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handlePointerCancel=this._handlePointerCancel.bind(this),this._handleTouchCancel=this._handleTouchCancel.bind(this),this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}dotSize;minWidth;maxWidth;penColor;minDistance;velocityFilterWeight;compositeOperation;backgroundColor;throttle;canvasContextOptions;_ctx;_drawingStroke=!1;_isEmpty=!0;_dataUrl;_dataUrlOptions;_lastPoints=[];_data=[];_lastVelocity=0;_lastWidth=0;_strokeMoveUpdate;_strokePointerId;clear(){const{_ctx:t,canvas:n}=this;t.fillStyle=this.backgroundColor,t.clearRect(0,0,n.width,n.height),t.fillRect(0,0,n.width,n.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){const t=this._data,n=this._dataUrl,r=this._dataUrlOptions;this.clear(),n&&this.fromDataURL(n,r),this.fromData(t,{clear:!1})}fromDataURL(t,n={}){return new Promise((r,i)=>{const s=new Image,c=n.ratio||window.devicePixelRatio||1,u=n.width||this.canvas.width/c,f=n.height||this.canvas.height/c,h=n.xOffset||0,m=n.yOffset||0;this._reset(this._getPointGroupOptions()),s.onload=()=>{this._ctx.drawImage(s,h,m,u,f),r()},s.onerror=g=>{i(g)},s.crossOrigin="anonymous",s.src=t,this._isEmpty=!1,this._dataUrl=t,this._dataUrlOptions={...n}})}toDataURL(t="image/png",n){return t==="image/svg+xml"?(typeof n!="object"&&(n=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(n))}`):(typeof n!="number"&&(n=void 0),this.canvas.toDataURL(t,n))}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none",this.canvas.style.webkitUserSelect="none";const t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.style.webkitUserSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){const t=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:t}=this._getListenerFunctions();t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp),t("pointercancel",this._handlePointerCancel),t("mousemove",this._handleMouseMove),t("mouseup",this._handleMouseUp),t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd),t("touchcancel",this._handleTouchCancel)}isEmpty(){return this._isEmpty}fromData(t,{clear:n=!0}={}){n&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}toData(){return this._data}_isLeftButtonPressed(t,n){return n?t.buttons===1:(t.buttons&1)===1}_pointerEventToSignatureEvent(t){return{event:t,type:t.type,x:t.clientX,y:t.clientY,pressure:"pressure"in t?t.pressure:0}}_touchEventToSignatureEvent(t){const n=t.changedTouches[0];return{event:t,type:t.type,x:n.clientX,y:n.clientY,pressure:n.force}}_handleMouseDown(t){!this._isLeftButtonPressed(t,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(t))}_handleMouseMove(t){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}_handleMouseUp(t){this._isLeftButtonPressed(t)||this._strokeEnd(this._pointerEventToSignatureEvent(t))}_handleTouchStart(t){t.targetTouches.length!==1||this._drawingStroke||(t.cancelable&&t.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(t)))}_handleTouchMove(t){if(t.targetTouches.length===1){if(t.cancelable&&t.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(t))}}_handleTouchEnd(t){t.targetTouches.length===0&&(t.cancelable&&t.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(t)))}_handlePointerCancel(t){this._allowPointerId(t)&&(t.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(t),!1))}_handleTouchCancel(t){t.cancelable&&t.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(t),!1)}_getPointerId(t){return t.persistentDeviceId||t.pointerId}_allowPointerId(t,n=!1){return typeof this._strokePointerId>"u"?n:this._getPointerId(t)===this._strokePointerId}_handlePointerDown(t){this._drawingStroke||!this._isLeftButtonPressed(t)||!this._allowPointerId(t,!0)||(this._strokePointerId=this._getPointerId(t),t.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(t)))}_handlePointerMove(t){if(this._allowPointerId(t)){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}t.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}}_handlePointerUp(t){this._isLeftButtonPressed(t)||!this._allowPointerId(t)||(t.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(t)))}_getPointGroupOptions(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}_strokeBegin(t){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0})))return;const{addEventListener:r}=this._getListenerFunctions();switch(t.event.type){case"mousedown":r("mousemove",this._handleMouseMove,{passive:!1}),r("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":r("touchmove",this._handleTouchMove,{passive:!1}),r("touchend",this._handleTouchEnd,{passive:!1}),r("touchcancel",this._handleTouchCancel,{passive:!1});break;case"pointerdown":r("pointermove",this._handlePointerMove,{passive:!1}),r("pointerup",this._handlePointerUp,{passive:!1}),r("pointercancel",this._handlePointerCancel,{passive:!1});break}this._drawingStroke=!0;const i=this._getPointGroupOptions(),s={...i,points:[]};this._data.push(s),this._reset(i),this._strokeUpdate(t)}_strokeUpdate(t){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(t);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));const n=this._createPoint(t.x,t.y,t.pressure),r=this._data[this._data.length-1],i=r.points,s=i.length>0&&i[i.length-1],c=s?n.distanceTo(s)<=this.minDistance:!1,u=this._getPointGroupOptions(r);if(!s||!(s&&c)){const f=this._addPoint(n,u);s?f&&this._drawCurve(f,u):this._drawDot(n,u),i.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}_strokeEnd(t,n=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(n&&this._strokeUpdate(t),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}_createPoint(t,n,r){const i=this.canvas.getBoundingClientRect();return new Jp(t-i.left,n-i.top,r,new Date().getTime())}_addPoint(t,n){const{_lastPoints:r}=this;if(r.push(t),r.length>2){r.length===3&&r.unshift(r[0]);const i=this._calculateCurveWidths(r[1],r[2],n),s=qK.fromPoints(r,i);return r.shift(),s}return null}_calculateCurveWidths(t,n,r){const i=r.velocityFilterWeight*n.velocityFrom(t)+(1-r.velocityFilterWeight)*this._lastVelocity,s=this._strokeWidth(i,r),c={end:s,start:this._lastWidth};return this._lastVelocity=i,this._lastWidth=s,c}_strokeWidth(t,n){return Math.max(n.maxWidth/(t+1),n.minWidth)}_drawCurveSegment(t,n,r){const i=this._ctx;i.moveTo(t,n),i.arc(t,n,r,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,n){const r=this._ctx,i=t.endWidth-t.startWidth,s=Math.ceil(t.length())*2;r.beginPath(),r.fillStyle=n.penColor;for(let c=0;c<s;c+=1){const u=c/s,f=u*u,h=f*u,m=1-u,g=m*m,y=g*m;let x=y*t.startPoint.x;x+=3*g*u*t.control1.x,x+=3*m*f*t.control2.x,x+=h*t.endPoint.x;let S=y*t.startPoint.y;S+=3*g*u*t.control1.y,S+=3*m*f*t.control2.y,S+=h*t.endPoint.y;const w=Math.min(t.startWidth+h*i,n.maxWidth);this._drawCurveSegment(x,S,w)}r.closePath(),r.fill()}_drawDot(t,n){const r=this._ctx,i=n.dotSize>0?n.dotSize:(n.minWidth+n.maxWidth)/2;r.beginPath(),this._drawCurveSegment(t.x,t.y,i),r.closePath(),r.fillStyle=n.penColor,r.fill()}_fromData(t,n,r){for(const i of t){const{points:s}=i,c=this._getPointGroupOptions(i);if(s.length>1)for(let u=0;u<s.length;u+=1){const f=s[u],h=new Jp(f.x,f.y,f.pressure,f.time);u===0&&this._reset(c);const m=this._addPoint(h,c);m&&n(m,c)}else this._reset(c),r(s[0],c)}}toSVG({includeBackgroundColor:t=!1,includeDataUrl:n=!1}={}){const r=this._data,i=Math.max(window.devicePixelRatio||1,1),s=0,c=0,u=this.canvas.width/i,f=this.canvas.height/i,h=document.createElementNS("http://www.w3.org/2000/svg","svg");if(h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),h.setAttribute("viewBox",`${s} ${c} ${u} ${f}`),h.setAttribute("width",u.toString()),h.setAttribute("height",f.toString()),t&&this.backgroundColor){const m=document.createElement("rect");m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("fill",this.backgroundColor),h.appendChild(m)}if(n&&this._dataUrl){const m=this._dataUrlOptions?.ratio||window.devicePixelRatio||1,g=this._dataUrlOptions?.width||this.canvas.width/m,y=this._dataUrlOptions?.height||this.canvas.height/m,x=this._dataUrlOptions?.xOffset||0,S=this._dataUrlOptions?.yOffset||0,w=document.createElement("image");w.setAttribute("x",x.toString()),w.setAttribute("y",S.toString()),w.setAttribute("width",g.toString()),w.setAttribute("height",y.toString()),w.setAttribute("preserveAspectRatio","none"),w.setAttribute("href",this._dataUrl),h.appendChild(w)}return this._fromData(r,(m,{penColor:g})=>{const y=document.createElement("path");if(!isNaN(m.control1.x)&&!isNaN(m.control1.y)&&!isNaN(m.control2.x)&&!isNaN(m.control2.y)){const x=`M ${m.startPoint.x.toFixed(3)},${m.startPoint.y.toFixed(3)} C ${m.control1.x.toFixed(3)},${m.control1.y.toFixed(3)} ${m.control2.x.toFixed(3)},${m.control2.y.toFixed(3)} ${m.endPoint.x.toFixed(3)},${m.endPoint.y.toFixed(3)}`;y.setAttribute("d",x),y.setAttribute("stroke-width",(m.endWidth*2.25).toFixed(3)),y.setAttribute("stroke",g),y.setAttribute("fill","none"),y.setAttribute("stroke-linecap","round"),h.appendChild(y)}},(m,{penColor:g,dotSize:y,minWidth:x,maxWidth:S})=>{const w=document.createElement("circle"),C=y>0?y:(x+S)/2;w.setAttribute("r",C.toString()),w.setAttribute("cx",m.x.toString()),w.setAttribute("cy",m.y.toString()),w.setAttribute("fill",g),h.appendChild(w)}),h.outerHTML}};function YK(e){const t=Re(),{width:n=500,height:r=200,defaultValue:i,who:s,onChange:c,...u}=e,f=v.useRef(null),h=v.useRef(null),m=v.useRef(c);m.current=c,v.useEffect(()=>{function y(){m.current?.({type:[{system:Gi+"/fhir/signature-type",code:"ProofOfOrigin",display:"Proof of Origin"}],when:new Date().toISOString(),who:s??nn(t.getProfile()),data:h.current?.toDataURL().split(",")[1]})}if(f.current){const x=new QK(f.current);i?.data&&x.fromDataURL(i.data).catch(console.error),x.addEventListener("endStroke",y),h.current=x}return()=>{h.current&&h.current.removeEventListener("beginStroke",y)}},[t,i,s]);const g=()=>{h.current&&h.current.clear(),m.current?.(void 0)};return a.jsxs(gr,{withBorder:!0,p:0,w:n,h:r,pos:"relative",...u,children:[a.jsx("canvas",{ref:f,width:n,height:r,"aria-label":"Signature input area"}),a.jsx(Me,{onClick:g,"aria-label":"Clear signature",pos:"absolute",top:0,right:0,size:"xs",leftSection:a.jsx(rg,{size:16}),variant:"subtle",color:"gray",children:"Clear"})]})}function HP(e){const t=[...e.context,e.responseItem];return a.jsxs("div",{children:[e.item.text&&a.jsx(ze,{order:3,mb:"md",children:e.item.text}),a.jsx(ib,{formState:e.formState,context:t,items:e.item.item??[],responseItems:e.responseItem.item??[]})]},e.item.linkId)}const bl=30,Zp=50;function em(e){const t=e.formState,n=e.item,r=e.responseItem;function i(x){if(t&&e.context)if(n.repeats&&e.index!==void 0&&n.type!==gt.choice&&n.type!==gt.openChoice){const C=[...r.answer||[]];x.length===0?C.splice(e.index,1):C[e.index]=x[0],t.onChangeAnswer(e.context,e.item,C)}else t.onChangeAnswer(e.context,e.item,x)}const s=n.type;if(!s)return null;const c=n.linkId;if(!c)return null;const f=n.repeats&&e.index!==void 0&&n.type!==gt.choice&&n.type!==gt.openChoice?`${c}-${e.index}`:c;let h;n.initial&&n.initial.length>0?h=n.initial[0]:n.answerOption&&n.answerOption.length>0&&(h=n.answerOption.find(x=>x.initialSelected));const m=ZS(r,e.index)??kS(h),g=po(r,`${Gi}/fhir/StructureDefinition/questionnaire-validationError`);let y=null;switch(s){case gt.display:y=a.jsx("p",{children:e.item.text},e.item.linkId);break;case gt.boolean:y=a.jsx(UP,{title:e.item.text,htmlFor:f,children:a.jsx(fn,{id:f,name:c,required:e.required??n.required,defaultChecked:m?.value,onChange:x=>i([{valueBoolean:x.currentTarget.checked}])})},e.item.linkId);break;case gt.decimal:y=a.jsx(Fe,{type:"number",step:"any",id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>i(x.currentTarget.value===""?[]:[{valueDecimal:x.currentTarget.valueAsNumber}])});break;case gt.integer:y=a.jsx(Fe,{type:"number",step:1,id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>i(x.currentTarget.value===""?[]:[{valueInteger:x.currentTarget.valueAsNumber}])});break;case gt.date:y=a.jsx(Fe,{type:"date",id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>i([{valueDate:x.currentTarget.value}])});break;case gt.dateTime:y=a.jsx(Io,{name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>i([{valueDateTime:x}])});break;case gt.time:y=a.jsx(Fe,{type:"time",id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>i([{valueTime:x.currentTarget.value}])});break;case gt.string:case gt.url:y=a.jsx(Fe,{id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>{const S=x.currentTarget.value;i(S===""?[]:[{valueString:S}])}});break;case gt.text:y=a.jsx(Ul,{id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>{const S=x.currentTarget.value;i(S===""?[]:[{valueString:S}])}});break;case gt.attachment:y=a.jsx(xe,{py:4,children:a.jsx(wP,{path:"",name:f,defaultValue:m?.value,onChange:x=>i([{valueAttachment:x}])})});break;case gt.reference:y=a.jsx(ba,{name:f,required:e.required??n.required,targetTypes:Jk(n),searchCriteria:JH(n,t?.subject,t?.encounter),defaultValue:m?.value,onChange:x=>i([{valueReference:x}])});break;case gt.quantity:y=a.jsx(Dl,{path:"",name:f,required:e.required??n.required,defaultValue:m?.value,onChange:x=>i([{valueQuantity:x}]),disableWheel:!0});break;case gt.choice:case gt.openChoice:nX(n)?y=a.jsx(ZK,{name:f,item:n,required:e.required??n.required,initial:h,response:r,onChangeAnswer:x=>i(x)}):tX(n)||n.answerValueSet&&!rX(n)?y=a.jsx(KK,{name:f,item:n,required:e.required??n.required,initial:h,response:r,onChangeAnswer:x=>i(x)}):y=a.jsx(JK,{name:f,item:n,required:e.required??n.required,initial:h,response:r,onChangeAnswer:x=>i(x)});break;default:return null}return a.jsxs(a.Fragment,{children:[y,g?.valueString&&a.jsx(ge,{c:"red",size:"lg",mt:4,children:g.valueString})]})}function KK(e){const{name:t,item:n,required:r,initial:i,onChangeAnswer:s,response:c}=e;if(!n.answerOption?.length&&!n.answerValueSet)return a.jsx(JS,{});const u=kS(i),f=ZS(c)??u,h=WP(c),m=n.repeats||iX(n);if(n.answerValueSet)return a.jsx(Af,{name:t,placeholder:"Select items",binding:n.answerValueSet,maxValues:m?void 0:1,required:r,onChange:g=>{m?g.length===0?s([{}]):s(g.map(y=>({valueCoding:y}))):s([{valueCoding:g[0]}])},defaultValue:f?.value});if(m){const{propertyName:g,data:y}=oX(n);return a.jsx(Im,{data:y,placeholder:"Select items",searchable:!0,defaultValue:h||[El(u)],required:r,onChange:x=>{if(x.length===0)s([{}]);else{const S=Kk(x,g,n);s(S)}}})}else{const g=[""];if(n.answerOption)for(const y of n.answerOption){const x=Uo(y);g.push(El(x))}return a.jsx(pn,{id:t,name:t,required:r,onChange:y=>{const x=y.currentTarget.selectedIndex;if(x===0){s([{}]);return}const S=n.answerOption[x-1],w=Uo(S),C="value"+Xn(w.type);s([{[C]:w.value}])},defaultValue:Rf(f?.value)||f?.value,data:g})}}function XK(e,t){return e?t.valueSetExpand({url:e,count:bl+1}).then(n=>n.expansion?.contains??[]):Promise.resolve([])}function qP(e){const t=Re(),[n,r]=v.useState([]),[i,s]=v.useState(!1);return v.useEffect(()=>{async function c(){if(e){s(!0);try{const u=await XK(e,t);r(u)}catch(u){console.error("Error loading value set:",u)}finally{s(!1)}}}c().catch(console.error)},[e,t]),[n,i]}function GP(e,t){return e.map((n,r)=>{const i=`${t}-valueset-${r}`,s={type:"Coding",value:{system:n.system,code:n.code,display:n.display}};return[i,s]})}function JK(e){const{name:t,item:n,required:r,initial:i,onChangeAnswer:s,response:c}=e,u=Ps("QuestionnaireItemAnswerOption","value[x]"),f=kS(i),[h,m]=qP(n.answerValueSet),g=[];let y;if(n.answerValueSet)g.push(...GP(h,t));else if(n.answerOption){const C=n.answerOption.slice(0,Zp).map((T,R)=>{const E=`${t}-option-${R}`,_=Uo(T);return _?.value?(f&&fo(_)===fo(f)&&(y=E),[E,_]):null}).filter(T=>T!==null);g.push(...C)}const x=ZS(c),S=eX(g,x);if(m)return a.jsx(ge,{children:"Loading options..."});if(g.length===0)return a.jsx(JS,{});const w=g.slice(0,bl);return a.jsxs(a.Fragment,{children:[a.jsx(Rr.Group,{name:t,value:S??y,required:r,onChange:C=>{const T=g.find(R=>R[0]===C);if(T){const R=T[1],E="value"+Xn(R.type);s([{[E]:R.value}])}},children:w.map(([C,T])=>a.jsx(Rr,{id:C,value:C,py:4,required:r,label:a.jsx(ho,{property:u,propertyType:T.type,value:T.value})},C))}),(n.answerValueSet&&g.length>bl||n.answerOption&&g.length>Zp)&&a.jsxs(ge,{size:"sm",c:"dimmed",mt:"xs",children:["Showing first ",bl," options"]})]})}function ZK(e){const{name:t,item:n,onChangeAnswer:r,response:i}=e,s=Ps("QuestionnaireItemAnswerOption","value[x]"),[c,u]=qP(n.answerValueSet),f=n.answerValueSet?(i?.answer?.map(S=>S.valueCoding)||[]).filter(S=>S!==void 0):WP(i),[h,m]=v.useState(f),g=[];if(n.answerValueSet)g.push(...GP(c,t));else if(n.answerOption){const S=n.answerOption.slice(0,Zp).map((w,C)=>{const T=`${t}-option-${C}`,R=Uo(w);return R?.value?[T,R]:null}).filter(w=>w!==null);g.push(...S)}if(u)return a.jsx(ge,{children:"Loading options..."});if(g.length===0)return a.jsx(JS,{});const y=g.slice(0,bl),x=(S,w)=>{if(n.answerValueSet){const C=h;let T;w?T=[...C,S.value]:T=C.filter(R=>!$i(R,S.value)),m(T),T.length===0?r([{}]):r(T.map(R=>({valueCoding:R})))}else{const C=h,T=El(S);let R;if(w?R=[...C,T]:R=C.filter(E=>E!==T),m(R),R.length===0)r([{}]);else{const E=Kk(R,"value"+Xn(S.type),n);r(E)}}};return a.jsxs(xe,{style:{flexDirection:"column",alignItems:"flex-start"},children:[y.map(([S,w])=>{const C=El(w),T=n.answerValueSet?h.some(R=>$i(R,w.value)):h.includes(C);return a.jsx(fn,{id:S,label:a.jsx(ho,{property:s,propertyType:w.type,value:w.value}),checked:T,onChange:R=>x(w,R.currentTarget.checked)},S)}),(n.answerValueSet&&g.length>bl||n.answerOption&&g.length>Zp)&&a.jsxs(ge,{size:"sm",c:"dimmed",children:["Showing first ",bl," options"]})]})}function JS(){return a.jsx(Fe,{disabled:!0,placeholder:"No Answers Defined"})}function ZS(e,t=0){return Uo(e?.answer?.[t]??{})}function WP(e){const t=e?.answer;return t?t.map(r=>Uo(r)).map(r=>Rf(r?.value)||r?.value).filter(Boolean):[]}function eX(e,t){return e.find(n=>$i(n[1].value,t?.value))?.[0]}function hg(e,t){return!!e.extension?.some(n=>n.url===DS&&n.valueCodeableConcept?.coding?.[0]?.code===t)}function tX(e){return hg(e,"drop-down")}function nX(e){return hg(e,"check-box")}function rX(e){return hg(e,"radio-button")}function iX(e){return hg(e,"multi-select")}function oX(e){if(e.answerOption?.length===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=Uo(t),r="value"+Xn(n.type),i=(e.answerOption??[]).map(s=>{const c=Uo(s),u=El(c);return{value:u,label:u}});return{propertyName:r,data:i}}function aX(e){return a.jsxs(a.Fragment,{children:[e.responseItems.map(t=>a.jsx(HP,{formState:e.formState,context:e.context,item:e.item,responseItem:t},`group-${t.id}`)),a.jsx(wt,{onClick:()=>e.formState.onAddGroup(e.context,e.item),children:`Add Group: ${e.item.text}`})]})}function sX(e){const{formState:t,context:n,item:r,responseItem:i}=e,s=r.type!==gt.choice&&r.type!==gt.openChoice,c=i.answer&&i.answer.length>0?i.answer:[{}];return a.jsxs(Vt,{title:e.item.text,withAsterisk:e.item.required,children:[a.jsx(Ne,{gap:"xs",children:c?.map((u,f)=>a.jsx(em,{formState:t,context:n,item:r,responseItem:i,index:f},`${r.linkId}-${f}`))}),s&&a.jsx(wt,{onClick:()=>t.onAddAnswer(n,r),children:"Add Item"})]},e.item.linkId)}function ib(e){const{formState:t,context:n,items:r,responseItems:i}=e;return a.jsx(Ne,{children:r.map((s,c)=>{if(!FH(s,t.questionnaireResponse))return null;if(s.type===gt.display)return a.jsx("p",{children:s.text},`display-${s.id}-${c}`);const u=i.filter(f=>f.linkId===s.linkId);return s.type===gt.group&&s.repeats?a.jsx(aX,{formState:t,context:n,item:s,responseItems:u},`repeating-group-${s.id}-${c}`):s.type===gt.group?a.jsx(HP,{formState:t,context:n,item:s,responseItem:u[0]},`group-${s.id}-${c}`):s.type===gt.boolean?a.jsx(em,{formState:t,context:n,item:s,responseItem:u[0],index:0},`boolean-item-${s.id}-${c}`):s.repeats?a.jsx(sX,{formState:t,context:n,item:s,responseItem:u[0]},`repeating-item-${s.id}-${c}`):a.jsx(Vt,{htmlFor:s.linkId,title:s.text,withAsterisk:s.required,children:a.jsx(em,{formState:t,context:n,item:s,responseItem:u[0],index:0})},`repeating-item-${s.id}-${c}`)})})}function lX(e){const{formState:t,submitButtonText:n,excludeButtons:r,children:i}=e,s=t.pages,c=t.activePage,u=c>0,f=c<s.length-1,h=c===s.length-1;return a.jsxs(a.Fragment,{children:[a.jsx(ou,{active:c,allowNextStepsSelect:!1,p:6,children:s.map((m,g)=>a.jsx(ou.Step,{label:m.title,children:g===c&&i},m.linkId))}),!r&&a.jsxs(xe,{justify:"flex-end",mt:"xl",gap:"xs",children:[u&&a.jsx(Me,{onClick:t.onPrevPage,children:"Back"}),f&&a.jsx(Me,{onClick:m=>{m.currentTarget.closest("form").reportValidity()&&t.onNextPage()},children:"Next"}),h&&a.jsx(yr,{children:n??"Submit"})]})]})}function QP(e){const t=Re(),[n,r]=v.useState(!1),i=v.useRef(e);i.current=e;const s=v.useCallback(g=>{r(!1),i.current.onChange?.(g)},[]),c=nq({questionnaire:e.questionnaire,defaultValue:e.questionnaireResponse,subject:e.subject,encounter:e.encounter,source:e.source,disablePagination:e.disablePagination,onChange:s}),u=v.useRef(c);u.current=c;const f=v.useMemo(()=>c.loading?!1:!!po(c.questionnaire,UH),[c]),h=v.useMemo(()=>c.loading?!1:!!c.questionnaireResponse.extension?.find(g=>g.url===Rp),[c]),m=v.useCallback(()=>{const g=u.current;if(g.loading)return;const y=i.current.onSubmit;if(!y)return;if(f&&!h){r(!0);return}const x=g.questionnaire,S=g.questionnaireResponse,w=i.current.subject;let C=i.current.source;if(!C){const T=t.getProfile();T&&(C=nn(T))}y({...S,questionnaire:x.url??$t(x),subject:w,source:C,authored:new Date().toISOString(),status:"completed"})},[t,f,h]);return c.loading?null:a.jsxs(pt,{testid:"questionnaire-form",onSubmit:m,children:[c.questionnaire.title&&a.jsx(ze,{children:c.questionnaire.title}),c.pagination?a.jsx(lX,{formState:c,submitButtonText:e.submitButtonText,excludeButtons:e.excludeButtons,children:a.jsx(ib,{formState:c,context:[],items:c.items,responseItems:c.responseItems})}):a.jsxs(a.Fragment,{children:[a.jsx(ib,{formState:c,context:[],items:c.items,responseItems:c.responseItems}),f&&a.jsxs(Ne,{mt:"md",gap:0,children:[a.jsx(ge,{size:"sm",fw:500,children:"Signature"}),a.jsx(YK,{onChange:c.onChangeSignature}),!h&&n&&a.jsx(ge,{c:"red",size:"sm",children:"Signature is required."})]}),!e.excludeButtons&&a.jsx(xe,{justify:"flex-end",mt:"xl",gap:"xs",children:a.jsx(yr,{children:e.submitButtonText??"Submit"})})]})]})}const cX={draft:"blue",active:"blue","on-hold":"yellow",revoked:"red",completed:"green","entered-in-error":"red",unknown:"gray",retired:"gray",registered:"blue",preliminary:"blue",final:"green",amended:"yellow",corrected:"yellow",cancelled:"red",requested:"blue",received:"blue",accepted:"blue",rejected:"red",ready:"blue","in-progress":"blue",failed:"red",proposed:"blue",pending:"blue",booked:"blue",arrived:"blue",fulfilled:"green",noshow:"red","checked-in":"blue",waitlist:"gray",routine:"gray",urgent:"red",asap:"red",stat:"red","not-done":"red",connected:"green",disconnected:"red",finished:"green",planned:"gray"};function pg(e){const{status:t,...n}=e;return a.jsx(b0,{color:e.color||cX[t],...n,children:t.replaceAll("-"," ")})}const uX="_noteCite_10swh_5",dX="_noteRoot_10swh_10",CR={noteCite:uX,noteRoot:dX};function YP({value:e}){return e?a.jsx(Ne,{justify:"flex-start",gap:"xs",children:e.map(t=>t.text&&a.jsx(S0,{classNames:{cite:CR.noteCite,root:CR.noteRoot},cite:t.authorReference?.display||t.authorString,icon:null,children:t.text},`note-${t.text}`))}):null}function Hl(e){const{value:t,link:n,...r}=e,[i,s]=v.useState(),c=Wt(t,s);let u;if(i&&!ek(i))u=`[${We(i)}]`;else if(c)u=Ea(c);else return null;return n?a.jsx(jt,{to:t,...r,children:u}):a.jsx(ge,{component:"span",...r,children:u})}function Pd(e){return a.jsxs(xe,{gap:"xs",children:[a.jsx(mo,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(Hl,{value:e.value,link:e.link})]})}const fX="_table_pe9td_1",hX="_criticalRow_pe9td_12",KP={table:fX,criticalRow:hX};e1.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1,hideSubject:!1};function e1(e){const t=Re(),n=Wt(e.value),[r,i]=v.useState();if(v.useEffect(()=>{n?.specimen&&Promise.allSettled(n.specimen.map(c=>t.readReference(c))).then(c=>c.filter(u=>u.status==="fulfilled").map(u=>u.value)).then(i).catch(console.error)},[t,n]),!n)return null;const s=r?.flatMap(c=>c.note||[])||[];if(n.presentedForm&&n.presentedForm.length>0){const c=n.presentedForm[0];c.contentType?.startsWith("text/plain")&&c.data&&s.push({text:window.atob(c.data)})}return a.jsxs(Ne,{children:[a.jsx(ze,{children:"Diagnostic Report"}),a.jsx(pX,{value:n,hideSubject:e.hideSubject}),r&&!e.hideSpecimenInfo&&mX(r),n.result&&a.jsx(gX,{hideObservationNotes:e.hideObservationNotes,value:n.result}),s.length>0&&a.jsx(YP,{value:s})]})}function pX({value:e,hideSubject:t=!1}){return a.jsxs(xe,{mt:"md",gap:30,children:[e.subject&&!t&&a.jsxs("div",{children:[a.jsx(ge,{size:"xs",tt:"uppercase",c:"dimmed",children:"Subject"}),a.jsx(Pd,{value:e.subject,link:!0})]}),e.resultsInterpreter?.map(n=>a.jsxs("div",{children:[a.jsx(ge,{size:"xs",tt:"uppercase",c:"dimmed",children:"Interpreter"}),a.jsx(Pd,{value:n,link:!0})]},n.reference)),e.performer?.map(n=>a.jsxs("div",{children:[a.jsx(ge,{size:"xs",tt:"uppercase",c:"dimmed",children:"Performer"}),a.jsx(Pd,{value:n,link:!0})]},n.reference)),e.issued&&a.jsxs("div",{children:[a.jsx(ge,{size:"xs",tt:"uppercase",c:"dimmed",children:"Issued"}),a.jsx(ge,{children:Nr(e.issued)})]}),e.status&&a.jsxs("div",{children:[a.jsx(ge,{size:"xs",tt:"uppercase",c:"dimmed",children:"Status"}),a.jsx(pg,{status:e.status})]})]})}function mX(e){return a.jsxs(Ne,{gap:"xs",children:[a.jsx(ze,{order:2,size:"h6",children:"Specimens"}),a.jsx(zr,{type:"ordered",children:e?.map(t=>a.jsx(zr.Item,{ml:"sm",children:a.jsxs(xe,{gap:20,children:[a.jsxs(xe,{gap:5,children:[a.jsx(ge,{fw:500,children:"Collected:"})," ",Nr(t.collection?.collectedDateTime)]}),a.jsxs(xe,{gap:5,children:[a.jsx(ge,{fw:500,children:"Received:"})," ",Nr(t.receivedTime)]})]})},`specimen-${t.id}`))})]})}function gX(e){return a.jsxs("table",{className:KP.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Test"}),a.jsx("th",{children:"Value"}),a.jsx("th",{children:"Reference Range"}),a.jsx("th",{children:"Interpretation"}),a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Performer"}),a.jsx("th",{children:"Status"})]})}),a.jsx("tbody",{children:a.jsx(XP,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function XP(e){return a.jsx(a.Fragment,{children:e.value?.map(t=>a.jsx(vX,{value:t,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${Ma(t)?t.reference:t.id}`))})}function vX(e){const t=Wt(e.value);if(!t||e.ancestorIds?.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=bX(t);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:Ft({[KP.criticalRow]:r}),children:[a.jsx("td",{rowSpan:n?2:1,children:a.jsx(jt,{to:t,children:a.jsx(Lo,{value:t.code})})}),a.jsx("td",{children:a.jsx(yX,{value:t})}),a.jsx("td",{children:a.jsx(xX,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx(Lo,{value:t.interpretation[0]})}),a.jsx("td",{children:t.category&&t.category.length>0&&a.jsx(a.Fragment,{children:t.category.map(i=>a.jsx("div",{children:a.jsx(Lo,{value:i})},`category-${Ss(i)}`))})}),a.jsx("td",{children:t.performer?.map(i=>a.jsx(Jd,{value:i},i.reference))}),a.jsx("td",{children:t.status&&a.jsx(pg,{status:t.status})})]}),t.hasMember&&a.jsx(XP,{value:t.hasMember,ancestorIds:e.ancestorIds?[...e.ancestorIds,t.id]:[t.id],hideObservationNotes:e.hideObservationNotes}),n&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,children:a.jsx(YP,{value:t.note})})})]})}function yX(e){const t=e.value;return a.jsx(a.Fragment,{children:_k(t)})}function xX(e){const t=e.value&&e.value.length>0&&e.value[0];return t?t.text?a.jsx(a.Fragment,{children:t.text}):a.jsx(GS,{value:t}):null}function bX(e){const t=e.interpretation?.[0]?.coding?.[0]?.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}var sx={},ol={},ER;function JP(){if(ER)return ol;ER=1,Object.defineProperty(ol,"__esModule",{value:!0}),ol.Pointer=void 0,ol.unescapeToken=e,ol.escapeToken=t;function e(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}function t(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}var n=(function(){function r(i){i===void 0&&(i=[""]),this.tokens=i}return r.fromJSON=function(i){var s=i.split("/").map(e);if(s[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(i));return new r(s)},r.prototype.toString=function(){return this.tokens.map(t).join("/")},r.prototype.evaluate=function(i){for(var s=null,c="",u=i,f=1,h=this.tokens.length;f<h;f++)s=u,c=this.tokens[f],!(c=="__proto__"||c=="constructor"||c=="prototype")&&(u=(s||{})[c]);return{parent:s,key:c,value:u}},r.prototype.get=function(i){return this.evaluate(i).value},r.prototype.set=function(i,s){var c=this.evaluate(i);c.parent&&(c.parent[c.key]=s)},r.prototype.push=function(i){this.tokens.push(i)},r.prototype.add=function(i){var s=this.tokens.concat(String(i));return new r(s)},r.prototype.parent=function(){var i=this.tokens.length>1?this.tokens.slice(0,-1):[""];return new r(i)},r})();return ol.Pointer=n,ol}var dr={},lx={},TR;function ZP(){return TR||(TR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(i){return i===void 0?"undefined":i===null?"null":Array.isArray(i)?"array":typeof i}function n(i){return i!=null&&typeof i=="object"}function r(i){if(!n(i))return i;if(i.constructor==Array){for(var s=i.length,c=new Array(s),u=0;u<s;u++)c[u]=r(i[u]);return c}if(i.constructor==Date){var f=new Date(+i);return f}var h={};for(var m in i)e.hasOwnProperty.call(i,m)&&(h[m]=r(i[m]));return h}})(lx)),lx}var ma={},RR;function eN(){if(RR)return ma;RR=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.isDestructive=t,ma.subtract=n,ma.intersection=r,ma.diffArrays=f,ma.diffObjects=h,ma.diffAny=m;var e=ZP();function t(g){var y=g.op;return y==="remove"||y==="replace"||y==="copy"||y==="move"}function n(g,y){var x=[];for(var S in g)e.hasOwnProperty.call(g,S)&&g[S]!==void 0&&!(e.hasOwnProperty.call(y,S)&&y[S]!==void 0)&&x.push(S);return x}function r(g){for(var y=g.length,x={},S=0;S<y;S++){var w=g[S];for(var C in w)e.hasOwnProperty.call(w,C)&&w[C]!==void 0&&(x[C]=(x[C]||0)+1)}for(var C in x)x[C]<y&&delete x[C];return Object.keys(x)}function i(g,y){var x=[];for(var S in g)e.hasOwnProperty.call(g,S)&&g[S]!==void 0&&e.hasOwnProperty.call(y,S)&&y[S]!==void 0&&x.push(S);return x}function s(g){return g.op==="add"}function c(g){return g.op==="remove"}function u(g,y){return{operations:g.operations.concat(y),cost:g.cost+1}}function f(g,y,x,S){S===void 0&&(S=m);var w=Math.max(g.length,y.length),C=new Map([[0,{operations:[],cost:0}]]);function T(O,k){var A=O*w+k,z=C.get(A);if(z===void 0){if(O>0&&k>0&&!S(g[O-1],y[k-1],x.add(String(O-1))).length)z=T(O-1,k-1);else{var U=[];if(O>0){var K=T(O-1,k),W={op:"remove",index:O-1};U.push(u(K,W))}if(k>0){var ee=T(O,k-1),B={op:"add",index:O-1,value:y[k-1]};U.push(u(ee,B))}if(O>0&&k>0){var G=T(O-1,k-1),L={op:"replace",index:O-1,original:g[O-1],value:y[k-1]};U.push(u(G,L))}var I=U.sort(function($,V){return $.cost-V.cost})[0];z=I}C.set(A,z)}return z}var R=isNaN(g.length)||g.length<=0?0:g.length,E=isNaN(y.length)||y.length<=0?0:y.length,_=T(R,E).operations,P=_.reduce(function(O,k){var A=O[0],z=O[1];if(s(k)){var U=k.index+1+z,K=U<R+z?String(U):"-",W={op:k.op,path:x.add(K).toString(),value:k.value};return[A.concat(W),z+1]}else if(c(k)){var W={op:k.op,path:x.add(String(k.index+z)).toString()};return[A.concat(W),z-1]}else{var ee=x.add(String(k.index+z)),B=S(k.original,k.value,ee);return[A.concat.apply(A,B),z]}},[[],0])[0];return P}function h(g,y,x,S){S===void 0&&(S=m);var w=[];return n(g,y).forEach(function(C){w.push({op:"remove",path:x.add(C).toString()})}),n(y,g).forEach(function(C){w.push({op:"add",path:x.add(C).toString(),value:y[C]})}),i(g,y).forEach(function(C){w.push.apply(w,S(g[C],y[C],x.add(C)))}),w}function m(g,y,x,S){if(S===void 0&&(S=m),g===y)return[];var w=(0,e.objectType)(g),C=(0,e.objectType)(y);return w=="array"&&C=="array"?f(g,y,x,S):w=="object"&&C=="object"?h(g,y,x,S):[{op:"replace",path:x.toString(),value:y}]}return ma}var _R;function SX(){if(_R)return dr;_R=1;var e=dr&&dr.__extends||(function(){var C=function(T,R){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,_){E.__proto__=_}||function(E,_){for(var P in _)Object.prototype.hasOwnProperty.call(_,P)&&(E[P]=_[P])},C(T,R)};return function(T,R){if(typeof R!="function"&&R!==null)throw new TypeError("Class extends value "+String(R)+" is not a constructor or null");C(T,R);function E(){this.constructor=T}T.prototype=R===null?Object.create(R):(E.prototype=R.prototype,new E)}})();Object.defineProperty(dr,"__esModule",{value:!0}),dr.InvalidOperationError=dr.TestError=dr.MissingError=void 0,dr.add=f,dr.remove=h,dr.replace=m,dr.move=g,dr.copy=y,dr.test=x,dr.apply=w;var t=JP(),n=ZP(),r=eN(),i=(function(C){e(T,C);function T(R){var E=C.call(this,"Value required at path: ".concat(R))||this;return E.path=R,E.name="MissingError",E}return T})(Error);dr.MissingError=i;var s=(function(C){e(T,C);function T(R,E){var _=C.call(this,"Test failed: ".concat(R," != ").concat(E))||this;return _.actual=R,_.expected=E,_.name="TestError",_}return T})(Error);dr.TestError=s;function c(C,T,R){if(Array.isArray(C))if(T=="-")C.push(R);else{var E=parseInt(T,10);C.splice(E,0,R)}else C[T]=R}function u(C,T){if(Array.isArray(C)){var R=parseInt(T,10);C.splice(R,1)}else delete C[T]}function f(C,T,R){var E=t.Pointer.fromJSON(T.path);if(R?.implicitArrayCreation&&E.tokens[E.tokens.length-1]==="-"){var _=E.parent().evaluate(C);_.value===void 0&&(0,n.objectType)(_.parent)==="object"&&(_.parent[_.key]=[])}var P=E.evaluate(C);return P.parent===void 0?new i(T.path):R?.implicitArrayCreation&&P.key==="-"&&!Array.isArray(P.parent)?new i(T.path):(c(P.parent,P.key,(0,n.clone)(T.value)),null)}function h(C,T,R){var E=t.Pointer.fromJSON(T.path).evaluate(C);return E.value===void 0?new i(T.path):(u(E.parent,E.key),null)}function m(C,T,R){var E=t.Pointer.fromJSON(T.path).evaluate(C);if(E.parent===null)return new i(T.path);if(Array.isArray(E.parent)){if(parseInt(E.key,10)>=E.parent.length)return new i(T.path)}else if(E.value===void 0)return new i(T.path);return E.parent[E.key]=(0,n.clone)(T.value),null}function g(C,T,R){var E=t.Pointer.fromJSON(T.from).evaluate(C);if(E.value===void 0)return new i(T.from);var _=t.Pointer.fromJSON(T.path).evaluate(C);return _.parent===void 0?new i(T.path):(u(E.parent,E.key),c(_.parent,_.key,E.value),null)}function y(C,T,R){var E=t.Pointer.fromJSON(T.from).evaluate(C);if(E.value===void 0)return new i(T.from);var _=t.Pointer.fromJSON(T.path).evaluate(C);return _.parent===void 0?new i(T.path):(c(_.parent,_.key,(0,n.clone)(E.value)),null)}function x(C,T,R){var E=t.Pointer.fromJSON(T.path).evaluate(C);return(0,r.diffAny)(E.value,T.value,new t.Pointer).length?new s(E.value,T.value):null}var S=(function(C){e(T,C);function T(R){var E=C.call(this,"Invalid operation: ".concat(R.op))||this;return E.operation=R,E.name="InvalidOperationError",E}return T})(Error);dr.InvalidOperationError=S;function w(C,T,R){switch(T.op){case"add":return f(C,T,R);case"remove":return h(C,T);case"replace":return m(C,T);case"move":return g(C,T);case"copy":return y(C,T);case"test":return x(C,T)}return new S(T)}return dr}var DR;function jX(){return DR||(DR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=c,e.createTests=f;var t=JP();Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=SX(),r=eN();function i(h,m,g){return m.map(function(y){return(0,n.apply)(h,y,g)})}function s(h){function m(g,y,x){var S=h(g,y,x);return Array.isArray(S)?S:(0,r.diffAny)(g,y,x,m)}return m}function c(h,m,g){var y=new t.Pointer;return(g?s(g):r.diffAny)(h,m,y)}function u(h,m){var g=t.Pointer.fromJSON(m).evaluate(h);if(g!==void 0)return{op:"test",path:m,value:g.value}}function f(h,m){var g=new Array;return m.filter(r.isDestructive).forEach(function(y){var x=u(h,y.path);if(x&&g.push(x),"from"in y){var S=u(h,y.from);S&&g.push(S)}}),g}})(sx)),sx}var tN=jX();const wX="_removed_el5zk_1",CX="_added_el5zk_6",AR={removed:wX,added:CX};function EX(e){const{name:t,path:n,property:r,originalValue:i,revisedValue:s}=e,c=!!r?.type?.find(m=>m.code==="Attachment"),[u,f]=v.useState(c),h=()=>f(m=>!m);return a.jsx(a.Fragment,{children:c&&!u||!c?a.jsx(a.Fragment,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:t}),a.jsx(Z.Td,{className:AR.removed,children:i&&a.jsx(ho,{path:n,property:r,propertyType:i.type,value:i.value,ignoreMissingValues:!0})}),a.jsx(Z.Td,{className:AR.added,children:s&&a.jsx(ho,{path:n,property:r,propertyType:s.type,value:s.value,ignoreMissingValues:!0})})]})}):a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:t}),a.jsx(Z.Td,{colSpan:2,style:{textAlign:"right"},children:a.jsx(Me,{onClick:h,variant:"light",children:"Expand"})})]})})}const TX="_root_15xvr_1",RX={root:TX};function _X(e){const t=Re(),{original:n,revised:r}=e,[i,s]=v.useState(!1);v.useEffect(()=>{t.requestSchema(e.original.resourceType).then(()=>s(!0)).catch(console.log)},[t,e.original.resourceType]);const c=v.useMemo(()=>{if(!i)return null;const u=[mi(n)],f=[mi(r)],h=[],m=DX(tN.createPatch(n,r));for(const g of m){const y=g.path,x=AX(y),S=kX(n.resourceType,x),w=g.op==="add"?void 0:js(x,u),C=g.op==="remove"?void 0:js(x,f);h.push({key:`op-${g.op}-${g.path}`,name:`${Xn(g.op)} ${x}`,path:S?.path??n.resourceType+"."+x,property:S,originalValue:kR(S,w),revisedValue:kR(S,C)})}return h},[i,n,r]);return c?a.jsxs(Z,{className:RX.root,children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{}),a.jsx(Z.Th,{children:"Before"}),a.jsx(Z.Th,{children:"After"})]})}),a.jsx(Z.Tbody,{children:c.map(u=>{const{key:f,...h}=u;return a.jsx(EX,{...h},f)})})]}):null}function DX(e){const t=[];for(const n of e){const{op:r,path:i}=n;if(i.startsWith("/meta/author")||i.startsWith("/meta/compartment")||i.startsWith("/meta/lastUpdated")||i.startsWith("/meta/versionId"))continue;const s=e.filter(u=>u.op===r&&u.path===i).length,c={op:r,path:i};s>1&&(r==="add"||r==="remove")&&/\/[0-9-]+$/.test(i)&&(c.op="replace",c.path=i.replace(/\/[^/]+$/,"")),t.some(u=>u.op===c.op&&u.path===c.path)||t.push(c)}return t}function AX(e){const t=e.split("/").filter(Boolean);let n="";for(let r=0;r<t.length;r++){const i=t[r];i==="-"?n+=".last()":/^\d+$/.test(i)?n+=`[${i}]`:(r>0&&(n+="."),n+=i)}return n.endsWith(".url")&&(n=n.replace(/\.url$/,"")),n}function kX(e,t){try{return eg(e,{resourceType:"SearchParameter",base:[e],code:e+"."+t,expression:e+"."+t})?.elementDefinitions?.[0]}catch(n){console.warn("Failed to get element definition",{resourceType:e,fhirPath:t,err:n});return}}function kR(e,t){return t&&{type:Array.isArray(t)?t[0].type:t.type,value:PX(t,!!e?.isArray)}}function PX(e,t){const n=FB(e).flatMap(r=>r.value);return t?n:n[0]}function t1(e){const{profileUrl:t}=e,n=Re(),r=n.getAccessPolicy(),i=Wt(e.value),[s,c]=v.useState(!1);v.useEffect(()=>{if(i)if(t)n.requestProfileSchema(t,{expandProfile:!0}).then(()=>{Su(t)?c(!0):console.error(`Schema not found for ${t}`)}).catch(f=>{console.error("Error in requestProfileSchema",f)});else{const f=i.resourceType;n.requestSchema(f).then(()=>{c(!0)}).catch(console.error)}},[n,t,i]);const u=v.useMemo(()=>i&&Ok(i,vl.READ,r),[r,i]);return!s||!i?null:a.jsx(Xp,{path:i.resourceType,value:{type:i.resourceType,value:e.forceUseInput?e.value:i},profileUrl:t,ignoreMissingValues:e.ignoreMissingValues,accessPolicyResource:u})}const NX="_item_5q6yx_1",OX="_itemPadding_5q6yx_5",PR={item:NX,itemPadding:OX};function MX(e){return a.jsx(Fl,{children:e.children})}function Al(e){const{resource:t,profile:n,padding:r,popupMenuItems:i,...s}=e,c=n??t.meta?.author,u=e.dateTime??t.meta?.lastUpdated;return a.jsxs(Os,{"data-testid":"timeline-item",fill:!0,...s,children:[a.jsxs(xe,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(mo,{value:c,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(ge,{size:"sm",children:a.jsx(Hl,{c:"inherit",fw:500,value:c,link:!0})}),a.jsxs(ge,{size:"xs",children:[a.jsx(jt,{c:"dimmed",to:e.resource,children:Nr(u)}),a.jsx(ge,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx(jt,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),i&&a.jsxs(be,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(be.Target,{children:a.jsx(Pn,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${$t(e.resource)}`,children:a.jsx(lG,{})})}),i]})]}),a.jsx(zS,{children:a.jsx("div",{className:Ft(PR.item,{[PR.itemPadding]:r}),children:e.children})})]})}function nN(e,t){e.sort((n,r)=>{const i=NR(n,t),s=NR(r,t);return i>s?1:i<s?-1:OR(n,t)-OR(r,t)})}function NR(e,t){if(!rN(e,t)){const n=e.priority;if(typeof n=="string")return{stat:4,asap:3,urgent:2}[n]??0}return 0}function OR(e,t){if(!rN(e,t)){if(e.resourceType==="Communication"&&e.sent)return new Date(e.sent).getTime();if((e.resourceType==="DiagnosticReport"||e.resourceType==="Media"||e.resourceType==="Observation")&&e.issued)return new Date(e.issued).getTime();if(e.resourceType==="DocumentReference"&&e.date)return new Date(e.date).getTime()}const n=e.meta?.lastUpdated;return n?new Date(n).getTime():0}function rN(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const LX="_pinnedComment_u08s5_1",IX={pinnedComment:LX};function mg(e){const t=Re(),n=t.getProfile(),r=v.useRef(null),i=Wt(e.value),[s,c]=v.useState(),[u,f]=v.useState([]),[h,m]=v.useState(10),g=e.loadTimelineResources,y=v.useRef(u);y.current=u;const x=v.useCallback(k=>{nN(k,i),k.reverse(),f(k)},[i]),S=v.useCallback(k=>{const A=[];for(const z of k){if(z.status!=="fulfilled")continue;const U=z.value;if(U.type==="history"&&c(U),U.entry)for(const K of U.entry)A.push(K.resource)}x(A)},[x]),w=v.useCallback(k=>x([...y.current,k]),[x]),C=v.useCallback(()=>{let k,A;"resourceType"in e.value?(k=e.value.resourceType,A=e.value.id):[k,A]=e.value.reference?.split("/"),g(t,k,A).then(S).catch(console.error)},[t,e.value,g,S]);v.useEffect(()=>C(),[C]);function T(k){!i||!e.createCommunication||t.createResource(e.createCommunication(i,n,k)).then(A=>w(A)).catch(console.error)}function R(k){!i||!e.createMedia||t.createResource(e.createMedia(i,n,k)).then(A=>w(A)).then(()=>hl({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(Go,{size:16}),autoClose:2e3})).catch(A=>hl({id:"upload-notification",color:"red",title:"Upload error",message:We(A),icon:a.jsx(cR,{size:16}),autoClose:2e3}))}function E(){Ae({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function _(k){hl({id:"upload-notification",loading:!0,title:"Uploading...",message:HX(k),autoClose:!1,withCloseButton:!1})}function P(k){hl({id:"upload-notification",color:"red",title:"Upload error",message:We(k),icon:a.jsx(cR,{size:16}),autoClose:2e3})}if(!i)return a.jsx(Ao,{style:{width:"100%",height:"100%"},children:a.jsx(Pr,{})});const O=u.filter(k=>k).slice(0,h);return a.jsxs(MX,{children:[e.createCommunication&&a.jsx(Os,{children:a.jsx(pt,{testid:"timeline-form",onSubmit:k=>{T(k.text);const A=r.current;A&&(A.value="",A.focus())},children:a.jsxs(xe,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(mo,{value:n}),a.jsx(Fe,{name:"text",ref:r,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(Pn,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx($G,{size:16})}),a.jsx(qS,{securityContext:nn(i),onUpload:R,onUploadStart:E,onUploadProgress:_,onUploadError:P,children:k=>a.jsx(Pn,{...k,radius:"xl",color:"blue",variant:"filled",children:a.jsx(OS,{size:16})})})]})})}),O.map(k=>{const A=`${k.resourceType}/${k.id}/${k.meta?.versionId}`,z=e.getMenu?e.getMenu({primaryResource:i,currentResource:k,reloadTimeline:C}):void 0;if(k.resourceType===i.resourceType&&k.id===i.id)return a.jsx(zX,{history:s,resource:k,popupMenuItems:z},A);switch(k.resourceType){case"AuditEvent":return a.jsx(VX,{resource:k,popupMenuItems:z},A);case"Communication":return a.jsx(UX,{resource:k,popupMenuItems:z},A);case"DiagnosticReport":return a.jsx(FX,{resource:k,popupMenuItems:z},A);case"Media":return a.jsx(BX,{resource:k,popupMenuItems:z},A);default:return a.jsx(Al,{resource:k,padding:!0,children:a.jsx(t1,{value:k,ignoreMissingValues:!0})},A)}}),h<u.length&&a.jsx(xe,{justify:"center",pb:"lg",children:a.jsx(Me,{onClick:()=>m(h+10),children:"Show More"})})]})}function zX(e){const{history:t,resource:n,...r}=e,i=$X(t,n);return i?a.jsx(Al,{resource:n,padding:!0,...r,children:a.jsx(_X,{original:i,revised:e.resource})}):a.jsxs(Al,{resource:n,padding:!0,...r,children:[a.jsx("h3",{children:"Created"}),a.jsx(t1,{value:n,ignoreMissingValues:!0,forceUseInput:!0})]})}function $X(e,t){const n=e.entry??[],r=n.findIndex(i=>i.resource?.meta?.versionId===t.meta?.versionId);if(!(r>=n.length-1))return n[r+1].resource}function UX(e){const n=!e.resource.priority||e.resource.priority==="routine"?void 0:IX.pinnedComment;return a.jsx(Al,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:e.popupMenuItems,children:a.jsx("p",{children:e.resource.payload?.[0]?.contentString})})}function BX(e){const t=e.resource.content?.contentType,n=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return a.jsx(Al,{resource:e.resource,padding:!!n,popupMenuItems:e.popupMenuItems,children:a.jsx(kf,{value:e.resource.content})})}function VX(e){return a.jsx(Al,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:a.jsx(ti,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function FX(e){return a.jsx(Al,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:a.jsx(e1,{value:e.resource})})}function HX(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${cx(e.loaded)} / ${cx(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${cx(e.loaded)}`}function cx(e){if(e===0)return"0.00 B";const t=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,t)).toFixed(2)+" "+" KMGTP".charAt(t)+"B"}function qX(e){const{resource:t,...n}=e;return a.jsx(mg,{value:t,loadTimelineResources:async(r,i,s)=>{const c=`${i}/${s}`;return Promise.allSettled([r.readHistory(i,s),r.search("Task",{_filter:`based-on eq ${c} or focus eq ${c} or subject eq ${c}`,_count:100})])},...n})}function GX(e){const{encounter:t,...n}=e;return a.jsx(mg,{value:t,loadTimelineResources:async(r,i,s)=>Promise.allSettled([r.readHistory("Encounter",s),r.search("Communication","encounter=Encounter/"+s),r.search("Media","encounter=Encounter/"+s)]),createCommunication:(r,i,s)=>({resourceType:"Communication",status:"completed",encounter:nn(r),subject:r.subject,sender:nn(i),sent:new Date().toISOString(),payload:[{contentString:s}]}),createMedia:(r,i,s)=>({resourceType:"Media",status:"completed",encounter:nn(r),subject:r.subject,operator:nn(i),issued:new Date().toISOString(),content:s}),...n})}function WX(e){let t;try{t=MV(e.path,e.resource)}catch(n){return console.warn("FhirPathDisplay:",n),null}if(t.length>1)throw new Error(`Component "path" for "FhirPathDisplay" must resolve to a single element. Received ${t.length} elements [${JSON.stringify(t,null,2)}]`);return a.jsx(ho,{value:t[0]||"",propertyType:e.propertyType})}function QX(e){return a.jsxs(Mn,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[a.jsxs(le,{display:"flex",style:{justifyContent:"space-between"},children:[e.exportCsv&&a.jsx(MR,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&a.jsx(MR,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),a.jsx(ge,{style:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function MR(e){return a.jsx(Me,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const YX={string:[fe.EQUALS,fe.NOT,fe.CONTAINS,fe.EXACT],fulltext:[fe.EQUALS,fe.NOT,fe.CONTAINS,fe.EXACT],token:[fe.EQUALS,fe.NOT,fe.TEXT],reference:[fe.EQUALS,fe.NOT],numeric:[fe.EQUALS,fe.NOT_EQUALS,fe.GREATER_THAN,fe.LESS_THAN,fe.GREATER_THAN_OR_EQUALS,fe.LESS_THAN_OR_EQUALS],quantity:[fe.EQUALS,fe.NOT_EQUALS,fe.GREATER_THAN,fe.LESS_THAN,fe.GREATER_THAN_OR_EQUALS,fe.LESS_THAN_OR_EQUALS],date:[fe.EQUALS,fe.NOT_EQUALS,fe.GREATER_THAN,fe.LESS_THAN,fe.GREATER_THAN_OR_EQUALS,fe.LESS_THAN_OR_EQUALS,fe.STARTS_AFTER,fe.ENDS_BEFORE,fe.APPROXIMATELY],datetime:[fe.EQUALS,fe.NOT_EQUALS,fe.GREATER_THAN,fe.LESS_THAN,fe.GREATER_THAN_OR_EQUALS,fe.LESS_THAN_OR_EQUALS,fe.STARTS_AFTER,fe.ENDS_BEFORE,fe.APPROXIMATELY],uri:[fe.EQUALS,fe.NOT,fe.ABOVE,fe.BELOW]},KX={eq:"equals",ne:"not equals",gt:"greater than",lt:"less than",ge:"greater than or equals",le:"less than or equals",sa:"starts after",eb:"ends before",ap:"approximately",sw:"starts with",contains:"contains",exact:"exact",text:"text",not:"not",above:"above",below:"below",in:"in","not-in":"not in","of-type":"of type",missing:"missing",present:"present",identifier:"identifier",iterate:"iterate"};function n1(e,t){return{...e,filters:t,offset:0,name:void 0}}function iN(e,t){return n1(e,(e.filters??[]).filter(n=>n.code!==t))}function gg(e,t,n,r,i){const s=[];return e.filters&&s.push(...e.filters),s.push({code:t,operator:n,value:r??""}),n1(e,s)}function XX(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function JX(e,t){return r1(e,t,-1)}function ZX(e,t){return r1(e,t,0)}function eJ(e,t){return r1(e,t,1)}function r1(e,t,n){const r=new Date;r.setDate(r.getDate()+n),r.setHours(0,0,0,0);const i=new Date(r.getTime());return i.setDate(i.getDate()+1),i.setTime(i.getTime()-1),vg(e,t,r,i)}function tJ(e,t){const n=new Date,r=new Date(n.getTime()+1440*60*1e3);return vg(e,t,n,r)}function nJ(e,t){return i1(e,t,-1)}function rJ(e,t){return i1(e,t,0)}function iJ(e,t){return i1(e,t,1)}function i1(e,t,n){const r=new Date;r.setMonth(r.getMonth()+n),r.setDate(1),r.setHours(0,0,0,0);const i=new Date(r.getTime());return i.setMonth(i.getMonth()+1),i.setDate(1),i.setHours(0,0,0,0),i.setTime(i.getTime()-1),vg(e,t,r,i)}function oJ(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),vg(e,t,n,new Date)}function vg(e,t,n,r){return e=iN(e,t),e=LR(e,t,fe.GREATER_THAN_OR_EQUALS,n),e=LR(e,t,fe.LESS_THAN_OR_EQUALS,r),e}function LR(e,t,n,r){return gg(e,t,n,r.toISOString())}function IR(e,t,n=!0){return gg(e,t,fe.MISSING,n.toString())}function aJ(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function sJ(e,t){const n=e.count??Km,r=(t-1)*n;return aJ(e,r)}function lJ(e,t,n){return t===cJ(e)&&n!==void 0&&n===uJ(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function cJ(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function uJ(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function dJ(e){return YX[e.type]}function oN(e){return KX[e]??""}function kl(e){let t=e;return t.includes(".")&&(t=t.split(".").pop()),t==="versionId"?"Version ID":(t=t.replace("[x]",""),t=t.replaceAll(/([A-Z])/g," $1"),t=t.replaceAll(/[-_]/g," "),t=t.replaceAll(/\s+/g," "),t=t.trim(),t.toLowerCase()==="id"?"ID":t.split(/\s/).map(Xn).join(" "))}function fJ(e,t){const n=t.name;return n==="id"?a.jsx(jt,{to:`/${e.resourceType}/${e.id}`,children:e.id}):n==="meta.versionId"?e.meta?.versionId:n==="_lastUpdated"?Nr(e.meta?.lastUpdated):`${e.resourceType}.${t.name}`===t.elementDefinition?.path?hJ(e,t.elementDefinition):t.searchParams?.length===1&&t.name===t.searchParams[0].code?pJ(e,t.searchParams[0]):null}function hJ(e,t){const n=t.path?.split(".")?.pop()?.replaceAll("[x]","")??"",[r,i]=ug({type:e.resourceType,value:e},n);return r?a.jsx(ho,{path:t.path,property:t,propertyType:i,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function pJ(e,t){const n=js(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,i)=>a.jsx(ho,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${i}-${n.length}`))})}function mJ(e){const t=v.useRef(!1),[n,r]=v.useState({search:JSON.parse(fo(e.search))}),[i,s]=v.useState(!1);v.useEffect(()=>{r({search:e.search})},[e.search]);const c=v.useMemo(()=>{if(!e.visible)return[];const f=e.search.resourceType,h=ak(f),m=yS(f);return au(gJ(h,m)).map(g=>({value:g,label:kl(g)}))},[e.visible,e.search.resourceType]);function u(f){r({search:{...n.search,fields:f}})}return a.jsx(Mn,{title:"Fields",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>{e.onCancel()},size:"auto",withOverlay:!0,closeOnClickOutside:!1,overlayProps:{onMouseDownCapture:()=>{t.current=i},onClick:()=>{t.current||e.onCancel(),t.current=!1},children:a.jsx("div",{"data-testid":"overlay-child"})},children:a.jsxs(Ne,{children:[a.jsx(Im,{style:{width:550},placeholder:"Select fields to display",data:c,value:n.search.fields??[],onChange:u,onDropdownOpen:()=>s(!0),onDropdownClose:()=>s(!1),maxDropdownHeight:"250px",clearButtonProps:{"aria-label":"Clear selection"},clearable:!0,searchable:!0}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Me,{onClick:()=>e.onOk(n.search),children:"OK"})})]})})}function gJ(e,t){const n=[],r=new Set,i=new Set;for(const s of Object.keys(e.elements))n.push(s),r.add(s.toLowerCase()),i.add(kl(s));if(t)for(const s of Object.keys(t)){const c=kl(s);!r.has(s)&&!i.has(c)&&(n.push(s),r.add(s),i.add(c))}return n}function aN(e){const t=eg(e.resourceType,e.searchParam),n=e.name??"filter-value";switch(t.type){case _r.REFERENCE:return a.jsx(ba,{name:n,defaultValue:e.defaultValue?{reference:e.defaultValue}:void 0,targetTypes:e.searchParam.target,autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(r.reference):e.onChange("")}});case _r.BOOLEAN:return a.jsx(fn,{name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultChecked:e.defaultValue==="true",autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.checked.toString())});case _r.DATE:return a.jsx(Fe,{type:"date",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case _r.DATETIME:return a.jsx(Io,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case _r.NUMBER:return a.jsx(Fe,{type:"number",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case _r.QUANTITY:return a.jsx(Dl,{name:n,path:"",defaultValue:vJ(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(Fe,{name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value),placeholder:"Search value"})}}function vJ(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:Number.parseFloat(t),system:n,unit:r}}}function yJ(e){const[t,n]=v.useState(gi(e.search)),r=v.useRef(t);r.current=t,v.useEffect(()=>{n(gi(e.search))},[e.search]);function i(f){n(gg(r.current,f.code,f.operator,f.value))}const s=e.search.resourceType,c=yS(s)??{},u=t.filters||[];return a.jsx(Mn,{title:"Filters",closeButtonProps:{"aria-label":"Close"},size:900,opened:e.visible,onClose:e.onCancel,children:a.jsxs(pt,{onSubmit:()=>e.onOk(r.current),children:[a.jsxs("div",{children:[a.jsxs("table",{children:[a.jsxs("colgroup",{children:[a.jsx("col",{style:{width:200}}),a.jsx("col",{style:{width:200}}),a.jsx("col",{style:{width:380}}),a.jsx("col",{style:{width:40}})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Field"}),a.jsx("th",{children:"Operation"}),a.jsx("th",{children:"Value"}),a.jsx("th",{})]})}),a.jsx("tbody",{children:u.map((f,h)=>a.jsx(xJ,{id:`filter-${h}-row`,resourceType:s,searchParams:c,value:f,onChange:m=>{const g=[...u];g[h]=m,n(n1(r.current,g))},onDelete:()=>n(XX(r.current,h))},`filter-${h}-row`))})]}),a.jsx(fg,{propertyDisplayName:"Filter",onClick:()=>i({})})]}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(yr,{children:"OK"})})]})})}function xJ(e){const t=e.value,n=v.useRef(t);n.current=t;function r(f){n.current.code=f,n.current.operator=fe.EQUALS,n.current.value="",e.onChange(n.current)}function i(f){n.current.operator=f,n.current.value="",e.onChange(n.current)}function s(f){n.current.value=f,e.onChange(n.current)}const c=e.searchParams[t.code],u=c&&dJ(c);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(pn,{"data-testid":`${e.id}-filter-field`,defaultValue:e.value.code,onChange:f=>r(f.currentTarget.value),data:["",...Object.keys(e.searchParams).map(f=>({value:f,label:kl(f)}))]})}),a.jsx("td",{children:u&&a.jsx(pn,{"data-testid":`${e.id}-filter-operation`,defaultValue:t.operator,onChange:f=>i(f.currentTarget.value),data:["",...u.map(f=>({value:f,label:oN(f)}))]},`${e.id}-filter-value-${e.value.code}`)}),a.jsx("td",{children:c&&t.operator&&a.jsx(aN,{name:`${e.id}-filter-value`,resourceType:e.resourceType,searchParam:c,defaultValue:t.value,onChange:s},`${e.id}-filter-value-${e.value.code}-${e.value.operator}`)}),a.jsx("td",{children:e.onDelete&&a.jsx(Pn,{variant:"outline",color:"red",radius:"xl","aria-label":"Delete filter",onClick:e.onDelete,children:a.jsx(ws,{style:{width:"70%",height:"70%"},stroke:1.5})})})]})}function bJ(e){const[t,n]=v.useState(e.defaultValue??"");if(!e.searchParam||!e.filter)return null;function r(){e.onOk({...e.filter,value:t})}return a.jsx(Mn,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:a.jsx(pt,{onSubmit:r,children:a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:10,children:a.jsx(aN,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})}),a.jsx(Nt.Col,{span:2,children:a.jsx(Me,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function SJ(e){const{resourceType:t,filter:n}=e,r=$o.types[t].searchParams?.[n.code];if(r){if(r.type==="reference"&&(n.operator===fe.EQUALS||n.operator===fe.NOT_EQUALS))return a.jsx(Hl,{value:{reference:n.value}});const i=eg(t,r);if(n.code==="_lastUpdated"||i.type===_r.DATETIME)return a.jsx(a.Fragment,{children:Nr(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function jJ(e){if(!e.searchParams)return null;function t(s,c){i(lJ(e.search,s.code,c))}function n(s){i(iN(e.search,s.code))}function r(s,c){e.onPrompt(s,{code:s.code,operator:c,value:""})}function i(s){e.onChange(s)}return e.searchParams.length===1?a.jsx(wJ,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:i,onClear:n}):a.jsx(be.Dropdown,{children:e.searchParams.map(s=>a.jsx(be.Item,{children:kl(s.code)},s.code))})}function wJ(e){switch(e.searchParam.type){case"date":return a.jsx(CJ,{...e});case"number":case"quantity":return a.jsx(EJ,{...e});case"reference":return a.jsx(TJ,{...e});case"string":return a.jsx(RJ,{...e});case"token":return a.jsx(_J,{...e});case"uri":return a.jsx(DJ,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function CJ(e){const{searchParam:t}=e,n=t.code;return a.jsxs(be.Dropdown,{children:[a.jsx(be.Item,{leftSection:a.jsx(LS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(be.Item,{leftSection:a.jsx(IS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(be.Item,{leftSection:a.jsx(wu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT_EQUALS),children:"Does not equal..."}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(sP,{size:14}),onClick:()=>e.onPrompt(t,fe.ENDS_BEFORE),children:"Before..."}),a.jsx(be.Item,{leftSection:a.jsx(aP,{size:14}),onClick:()=>e.onPrompt(t,fe.STARTS_AFTER),children:"After..."}),a.jsx(be.Item,{leftSection:a.jsx(kq,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Between..."}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(eJ(e.search,n)),children:"Tomorrow"}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(ZX(e.search,n)),children:"Today"}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(JX(e.search,n)),children:"Yesterday"}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(tJ(e.search,n)),children:"Next 24 Hours"}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(iJ(e.search,n)),children:"Next Month"}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(rJ(e.search,n)),children:"This Month"}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(nJ(e.search,n)),children:"Last Month"}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(ls,{size:14}),onClick:()=>e.onChange(oJ(e.search,n)),children:"Year to date"}),a.jsx(Tu,{...e})]})}function EJ(e){const{searchParam:t}=e;return a.jsxs(be.Dropdown,{children:[a.jsx(be.Item,{leftSection:a.jsx(LS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(be.Item,{leftSection:a.jsx(IS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(be.Item,{leftSection:a.jsx(wu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT_EQUALS),children:"Does not equal..."}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(aP,{size:14}),onClick:()=>e.onPrompt(t,fe.GREATER_THAN),children:"Greater than..."}),a.jsx(be.Item,{leftSection:a.jsx(tb,{size:14}),onClick:()=>e.onPrompt(t,fe.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(be.Item,{leftSection:a.jsx(sP,{size:14}),onClick:()=>e.onPrompt(t,fe.LESS_THAN),children:"Less than..."}),a.jsx(be.Item,{leftSection:a.jsx(tb,{size:14}),onClick:()=>e.onPrompt(t,fe.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx(Tu,{...e})]})}function TJ(e){const{searchParam:t}=e;return a.jsxs(be.Dropdown,{children:[a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(be.Item,{leftSection:a.jsx(wu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(Tu,{...e})]})}function RJ(e){const{searchParam:t}=e;return a.jsxs(be.Dropdown,{children:[a.jsx(be.Item,{leftSection:a.jsx(LS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(be.Item,{leftSection:a.jsx(IS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(be.Item,{leftSection:a.jsx(wu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx($q,{size:14}),onClick:()=>e.onPrompt(t,fe.CONTAINS),children:"Contains..."}),a.jsx(be.Item,{leftSection:a.jsx(Iq,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Does not contain..."}),a.jsx(Tu,{...e})]})}function _J(e){const{searchParam:t}=e;return a.jsxs(be.Dropdown,{children:[a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(be.Item,{leftSection:a.jsx(wu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.TEXT),children:"Text contains..."}),a.jsx(Tu,{...e})]})}function DJ(e){const{searchParam:t}=e;return a.jsxs(be.Dropdown,{children:[a.jsx(be.Item,{leftSection:a.jsx(_l,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(be.Item,{leftSection:a.jsx(wu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(Tu,{...e})]})}function Tu(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(Eq,{size:14}),onClick:()=>e.onChange(IR(e.search,n)),children:"Missing"}),a.jsx(be.Item,{leftSection:a.jsx(wq,{size:14}),onClick:()=>e.onChange(IR(e.search,n,!1)),children:"Not missing"}),a.jsx(be.Divider,{}),a.jsx(be.Item,{leftSection:a.jsx(ws,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}function sN(e){switch(e){case"next":return{"aria-label":"Next page"};case"previous":return{"aria-label":"Previous page"};case"first":return{"aria-label":"First page"};case"last":return{"aria-label":"Last page"};default:return{}}}const AJ="_root_vlout_1",kJ="_table_vlout_8",PJ="_tr_vlout_12",NJ="_control_vlout_22",OJ="_icon_vlout_31",xd={root:AJ,table:kJ,tr:PJ,control:NJ,icon:OJ};function MJ(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(LJ(t,r));return n}function LJ(e,t){if(t==="_lastUpdated")return{name:"_lastUpdated",searchParams:[{resourceType:"SearchParameter",base:["Resource"],code:"_lastUpdated",name:"_lastUpdated",type:"date",expression:"Resource.meta.lastUpdated"}]};if(t==="meta.versionId")return{name:"meta.versionId",searchParams:[{resourceType:"SearchParameter",base:["Resource"],code:"_versionId",name:"_versionId",type:"token",expression:"Resource.meta.versionId"}]};const n=Ps(e,t),r=oV(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const i=yS(e);let s;if(i){const c=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);s=Object.values(i).filter(u=>!!u.expression&&c.test(u?.expression)),s.length===0&&(s=void 0)}return{name:t,elementDefinition:n,searchParams:s}}if(r){const i=eg(e,r);return{name:t,elementDefinition:i.elementDefinitions?.[0],searchParams:[r]}}return{name:t}}class IJ extends Event{definition;constructor(t){super("change"),this.definition=t}}class zJ extends Event{response;constructor(t){super("load"),this.response=t}}class tm extends Event{resource;browserEvent;constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function ql(e){const t=Re(),[n,r]=v.useState(),{search:i,onLoad:s}=e,[c,u]=v.useState(i);$i(i,c)||u(i);const[f,h]=v.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),m=v.useRef(f);m.current=f;const g=c.total??"accurate",y=v.useCallback(B=>{r(void 0),t.requestSchema(c.resourceType).then(()=>t.search(c.resourceType,vs({...c,total:g,fields:void 0}),B)).then(G=>{h({...m.current,searchResponse:G}),s&&s(new zJ(G))}).catch(G=>{h({...m.current,searchResponse:void 0}),r(rn(G))})},[t,c,g,s]),x=v.useCallback(()=>{h({...m.current,searchResponse:void 0}),y({cache:"reload"})},[y]);v.useEffect(()=>{y()},[y]);function S(B,G){B.stopPropagation();const I=B.target.checked,$={...m.current.selected};I?$[G]=!0:delete $[G],h({...m.current,selected:$})}function w(B){B.stopPropagation();const L=B.target.checked,I={},$=m.current.searchResponse;L&&$?.entry&&$.entry.forEach(V=>{V.resource?.id&&(I[V.resource.id]=!0)}),h({...m.current,selected:I})}function C(){const B=m.current;if(!B.searchResponse?.entry||B.searchResponse.entry.length===0)return!1;for(const G of B.searchResponse.entry)if(G.resource?.id&&!B.selected[G.resource.id])return!1;return!0}function T(B){e.onChange&&e.onChange(new IJ(B))}function R(B,G){if(cP(B.target)||B.button===2)return;jn(B);const L=$S(B);!L&&e.onClick&&e.onClick(new tm(G,B)),L&&e.onAuxClick&&e.onAuxClick(new tm(G,B))}function E(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(n)return a.jsx(xr,{outcome:n});if(!ok(c.resourceType))return a.jsx(Ao,{style:{width:"100%",height:"100%"},children:a.jsx(Pr,{})});const _=e.checkboxesEnabled,P=MJ(c),O=c.resourceType,k=f.searchResponse,z=k?.entry?.map(B=>B.resource),U="subtle",K="gray",W=16,ee=window.innerWidth<768;return a.jsxs("div",{className:xd.root,"data-testid":"search-control",children:[!e.hideToolbar&&a.jsxs(xe,{justify:"space-between",mb:"xl",children:[a.jsxs(xe,{gap:2,children:[a.jsx(Me,{size:"compact-md",variant:U,color:K,leftSection:a.jsx(Zq,{size:W}),onClick:()=>h({...m.current,fieldEditorVisible:!0,dialogOpenTime:Date.now()}),children:"Fields"}),a.jsx(Me,{size:"compact-md",variant:U,color:K,leftSection:a.jsx(bG,{size:W}),onClick:()=>h({...m.current,filterEditorVisible:!0,dialogOpenTime:Date.now()}),children:"Filters"}),e.onNew&&a.jsx(Me,{size:"compact-md",variant:U,color:K,leftSection:a.jsx(yG,{size:W}),onClick:e.onNew,children:"New..."}),!ee&&E()&&a.jsx(Me,{size:"compact-md",variant:U,color:K,leftSection:a.jsx(jW,{size:W}),onClick:e.onExport?e.onExport:()=>h({...m.current,exportDialogVisible:!0,dialogOpenTime:Date.now()}),children:"Export..."}),!ee&&e.onDelete&&a.jsx(Me,{size:"compact-md",variant:U,color:K,leftSection:a.jsx(rg,{size:W}),onClick:()=>e.onDelete(Object.keys(f.selected)),children:"Delete..."}),!ee&&e.onBulk&&a.jsx(Me,{size:"compact-md",variant:U,color:K,leftSection:a.jsx(Dq,{size:W}),onClick:()=>e.onBulk(Object.keys(f.selected)),children:"Bulk..."})]}),a.jsxs(xe,{gap:2,children:[k&&a.jsxs(ge,{size:"xs",c:"dimmed","data-testid":"count-display",children:[lN(c,k).toLocaleString(),"-",VJ(c,k).toLocaleString(),k.total!==void 0&&` of ${c.total==="estimate"?"~":""}${k.total?.toLocaleString()}`]}),a.jsx(Pn,{variant:U,color:K,title:"Refresh",onClick:x,children:a.jsx(lP,{size:W})})]})]}),a.jsxs(Z,{className:xd.table,children:[a.jsxs(Z.Thead,{children:[a.jsxs(Z.Tr,{children:[_&&a.jsx(Z.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:B=>w(B)})}),P.map(B=>a.jsx(Z.Th,{children:a.jsxs(be,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(be.Target,{children:a.jsx(An,{className:xd.control,p:2,children:a.jsxs(xe,{justify:"space-between",wrap:"nowrap",children:[a.jsx(ge,{fw:500,children:kl(B.name)}),a.jsx(Ao,{className:xd.icon,children:a.jsx(gq,{size:14,stroke:1.5})})]})})}),a.jsx(jJ,{search:c,searchParams:B.searchParams,onPrompt:(G,L)=>{h({...m.current,filterDialogVisible:!0,filterDialogSearchParam:G,filterDialogFilter:L,dialogOpenTime:Date.now()})},onChange:G=>{T(G)}})]})},B.name))]}),!e.hideFilters&&a.jsxs(Z.Tr,{children:[_&&a.jsx(Z.Th,{}),P.map(B=>a.jsx(Z.Th,{children:B.searchParams&&a.jsx($J,{resourceType:O,searchParams:B.searchParams,filters:c.filters})},B.name))]})]}),a.jsx(Z.Tbody,{children:z?.map(B=>B&&a.jsxs(Z.Tr,{className:xd.tr,"data-testid":"search-control-row",onClick:G=>R(G,B),onAuxClick:G=>R(G,B),children:[_&&a.jsx(Z.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${B.id}`,checked:!!f.selected[B.id],onChange:G=>S(G,B.id)})}),P.map(G=>a.jsx(Z.Td,{children:fJ(B,G)},G.name))]},B.id))})]}),!z?.length&&a.jsx(Fl,{children:a.jsx(Ao,{style:{height:150},children:a.jsx(ge,{size:"xl",c:"dimmed",children:"No results"})})}),k&&a.jsx(Ao,{m:"md",p:"md",children:a.jsx(qi,{value:UJ(c),total:BJ(c,k),onChange:B=>T(sJ(c,B)),getControlProps:sN})}),a.jsx(mJ,{search:c,visible:m.current.fieldEditorVisible,onOk:B=>{T(B),h({...m.current,fieldEditorVisible:!1})},onCancel:()=>{h({...m.current,fieldEditorVisible:!1})}},`search-field-editor-${f.dialogOpenTime}`),a.jsx(yJ,{search:c,visible:m.current.filterEditorVisible,onOk:B=>{T(B),h({...m.current,filterEditorVisible:!1})},onCancel:()=>{h({...m.current,filterEditorVisible:!1})}},`search-filter-editor-${f.dialogOpenTime}`),a.jsx(QX,{visible:m.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{h({...m.current,exportDialogVisible:!1})}},`search-export-dialog-${f.dialogOpenTime}`),a.jsx(bJ,{visible:m.current.filterDialogVisible,title:f.filterDialogSearchParam?.code?kl(f.filterDialogSearchParam.code):"",resourceType:O,searchParam:f.filterDialogSearchParam,filter:f.filterDialogFilter,defaultValue:"",onOk:B=>{T(gg(c,B.code,B.operator,B.value)),h({...m.current,filterDialogVisible:!1})},onCancel:()=>{h({...m.current,filterDialogVisible:!1})}},`search-filter-dialog-${f.dialogOpenTime}`)]})}function $J(e){const t=(e.filters??[]).filter(n=>e.searchParams.find(r=>r.code===n.code));return t.length===0?a.jsx("span",{children:"no filters"}):a.jsx(a.Fragment,{children:t.map(n=>a.jsxs("div",{children:[oN(n.operator)," ",a.jsx(SJ,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function UJ(e){return Math.floor((e.offset??0)/(e.count??Km))+1}function BJ(e,t){const n=e.count??Km,r=cN(e,t);return Math.ceil(r/n)}function lN(e,t){return Math.min(cN(e,t),(e.offset??0)+1)}function VJ(e,t){return Math.max(lN(e,t)+(t.entry?.length??0)-1,0)}function cN(e,t){let n=t.total;return n===void 0&&(n=(e.offset??0)+(t.entry?.length??0)+(t.link?.some(r=>r.relation==="next")?1:0)),n}function FJ(e){const t=Re(),[n,r]=v.useState(!1),[i,s]=v.useState(),{query:c,fields:u}=e,[f,h]=v.useState(),[m,g]=v.useState({}),y=v.useRef(f);y.current=f;const x=v.useRef({});x.current=m,v.useEffect(()=>{s(void 0),t.graphql(c).then(h).catch(E=>s(rn(E)))},[t,c]);function S(E,_){E.stopPropagation();const O=E.target.checked,k={...x.current};O?k[_]=!0:delete k[_],g(k)}function w(E){E.stopPropagation();const P=E.target.checked,O={},k=y.current?.data.ResourceList;P&&k&&k.forEach(A=>{A.id&&(O[A.id]=!0)}),g(O)}function C(){const E=y.current?.data.ResourceList;if(!E||E.length===0)return!1;for(const _ of E)if(_.id&&!x.current[_.id])return!1;return!0}function T(E,_){cP(E.target)||(jn(E),E.button!==1&&e.onClick&&e.onClick(new tm(_,E)),E.button===1&&e.onAuxClick&&e.onAuxClick(new tm(_,E)))}if(v.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return a.jsx(Pr,{});const R=e.checkboxesEnabled;return a.jsxs("div",{onContextMenu:E=>jn(E),"data-testid":"search-control",children:[a.jsxs(Z,{children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[R&&a.jsx(Z.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:E=>w(E)})}),u.map(E=>a.jsx(Z.Th,{children:E.name},E.name))]})}),a.jsx(Z.Tbody,{children:f?.data.ResourceList.map(E=>E&&a.jsxs(Z.Tr,{"data-testid":"search-control-row",onClick:_=>T(_,E),onAuxClick:_=>T(_,E),children:[R&&a.jsx(Z.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${E.id}`,checked:!!m[E.id],onChange:_=>S(_,E.id)})}),u.map(_=>a.jsx(Z.Td,{children:a.jsx(WX,{propertyType:_.propertyType,path:_.fhirPath,resource:E})},_.name))]},E.id))})]}),f?.data.ResourceList.length===0&&a.jsx("div",{"data-testid":"empty-search",children:"No results"}),i&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(i,void 0,2)})}),e.onBulk&&a.jsx(Me,{onClick:()=>e.onBulk(Object.keys(x.current)),children:"Bulk..."})]})}const HJ=v.memo(FJ),qJ="_root_1fbwr_1",GJ="_entry_1fbwr_8",WJ="_key_1fbwr_13",QJ="_value_1fbwr_20",yg={root:qJ,entry:GJ,key:WJ,value:QJ};function vt(e){return a.jsx(ti,{children:a.jsx("div",{className:yg.root,children:e.children})})}vt.Entry=function(t){return a.jsx("div",{className:yg.entry,children:t.children})};vt.Key=function(t){return a.jsx("div",{className:yg.key,children:t.children})};vt.Value=function(t){return a.jsx("div",{className:yg.value,children:t.children})};const YJ="_list_y4z6g_1",KJ="_link_y4z6g_6",zR={list:YJ,link:KJ};function Of(e){const{baseUrl:t,tabs:n,children:r,...i}=e,s=XJ(n),c=ju(),[u,f]=v.useState(()=>{const m=rr.getPathname().split("/").pop();return m&&s.some(g=>g.value===m)?m:s[0].value});function h(m){m=m||s[0].value,f(m),c(`${t}/${m}`)}return a.jsxs(bn,{value:u.toLowerCase(),onChange:h,...i,children:[a.jsx(bn.List,{className:zR.list,children:s.map(m=>a.jsx(bn.Tab,{value:m.value,children:a.jsx(wt,{className:zR.link,href:`${t}/${m.value}`,onClick:JJ,children:m.label})},m.value))}),r]})}function XJ(e){return e.map(t=>xk(t)?{label:t,value:t.toLowerCase()}:t)}function JJ(e){$S(e)||e.preventDefault()}function ZJ(e){const{group:t}=e;return a.jsx(gr,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(xe,{children:[t.measureScore&&a.jsx(nZ,{group:t}),!t.measureScore&&a.jsx(tZ,{group:t})]})})}function eZ(e){const{measure:t}=e;return a.jsxs(a.Fragment,{children:[a.jsx(ge,{fz:"md",fw:500,mb:8,children:t.title}),a.jsx(ge,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function tZ(e){const{group:t}=e,n=t.population,r=n?.find(f=>Ss(f.code)==="numerator"),i=n?.find(f=>Ss(f.code)==="denominator"),s=r?.count,c=i?.count;if(c===0)return a.jsxs(le,{children:[a.jsx(ze,{order:3,children:"Not Applicable"}),a.jsx(ge,{children:`Denominator: ${c}`})]});if(s===void 0||c===void 0)return a.jsxs(le,{children:[a.jsx(ze,{order:3,children:"Insufficient Data"}),a.jsx(ge,{children:`Numerator: ${s}`}),a.jsx(ge,{children:`Denominator: ${c}`})]});const u=s/c*100;return a.jsx(Hm,{size:120,thickness:12,roundCaps:!0,sections:[{value:u,color:uN(u)}],label:a.jsx(ar,{justify:"center",children:a.jsxs(ge,{fw:700,fz:18,children:[s," / ",c]})})})}function nZ(e){const{group:t}=e,n=t.measureScore?.unit??t.measureScore?.code;return a.jsx(a.Fragment,{children:n==="%"?a.jsx(Hm,{size:120,thickness:12,roundCaps:!0,sections:[{value:rZ(t),color:uN(t?.measureScore?.value??0)}],label:a.jsx(ar,{justify:"center",children:a.jsx(ge,{fw:700,fz:18,children:a.jsx(Xd,{value:t.measureScore})})})}):a.jsx(ar,{h:120,align:"center",children:a.jsx(ze,{order:3,children:a.jsx(Xd,{value:t.measureScore})})})})}function rZ(e){const t=e.measureScore?.value,n=e.measureScore?.unit;return t?t<=1&&n==="%"?t*100:t:0}function uN(e){return e<=33?"red":e<=67?"yellow":"green"}function iZ(e){const t=Wt(e.measureReport),[n]=lq("Measure",{url:t?.measure});return t?a.jsxs(le,{children:[n&&a.jsx(eZ,{measure:n}),a.jsx(qm,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:t.group?.map((r,i)=>a.jsx(ZJ,{group:r},r.id??i))})]}):null}const ux="patient-export",dx="Patient Export",oZ={everything:{operation:"$everything",extension:"json",contentType:tn.FHIR_JSON},summary:{operation:"$summary",extension:"json",contentType:tn.FHIR_JSON},ccda:{operation:"$ccda-export",extension:"xml",contentType:tn.CDA_XML},ccdaReferral:{operation:"$ccda-export",type:"referral",extension:"xml",contentType:tn.CDA_XML}};function aZ(e){const t=Re(),{patient:n}=e,r=v.useCallback(async i=>{const s=bs(n),c=i.format,{operation:u,type:f,contentType:h,extension:m}=oZ[c],g=t.fhirUrl("Patient",s,u),y={};f&&(y.type=f),i.author&&(y.author={reference:i.author}),i.authoredOn&&(y.authoredOn=WS(i.authoredOn)),i.startDate&&(y.start=i.startDate),i.endDate&&(y.end=i.endDate),Li.show({id:ux,title:dx,loading:!0,message:"Exporting...",autoClose:!1,withCloseButton:!1});try{const x=await t.post(g,y,void 0,{cache:"no-cache",headers:{Accept:h}}),S=`Patient-export-${s}-${new Date().toISOString().replaceAll(":","-")}.${m}`;sZ(x,S,h),Li.update({id:ux,title:dx,color:"green",message:"Done",icon:a.jsx(Go,{size:"1rem"}),loading:!1,autoClose:!0,withCloseButton:!0})}catch(x){Li.update({id:ux,title:dx,color:"red",message:We(x),icon:a.jsx(ws,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})}},[t,n]);return a.jsx(pt,{onSubmit:r,children:a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Export Format",description:"Required",withAsterisk:!0,children:a.jsx(Cl,{name:"format",data:[{label:"FHIR Everything",value:"everything"},{label:"Patient Summary",value:"summary"},{label:"C-CDA",value:"ccda"},{label:"C-CDA Referral",value:"ccdaReferral"}],fullWidth:!0})}),a.jsx(Vt,{title:"Author",description:"Optional author for composition. Default value is current user.",children:a.jsx(ba,{name:"author",placeholder:"Author",targetTypes:["Organization","Practitioner","PractitionerRole"]})}),a.jsx(Vt,{title:"Authored On",description:"Optional date for composition authored on. Default value is current date.",children:a.jsx(Io,{name:"authoredOn",placeholder:"Authored on"})}),a.jsx(Vt,{title:"Start Date",description:"The start date of care. If no start date is provided, all records prior to the end date are in scope.",children:a.jsx(Io,{name:"startDate",placeholder:"Start date"})}),a.jsx(Vt,{title:"End Date",description:"The end date of care. If no end date is provided, all records subsequent to the start date are in scope.",children:a.jsx(Io,{name:"endDate",placeholder:"End date"})}),a.jsx(xe,{justify:"right",children:a.jsx(yr,{children:"Request Export"})})]})})}function sZ(e,t,n){const r=typeof e=="string"?e:JSON.stringify(e,null,2),i=new Blob([r],{type:n}),s=window.URL.createObjectURL(i),c=document.createElement("a");document.body.appendChild(c),c.style.display="none",c.href=s,c.download=t,c.click(),window.URL.revokeObjectURL(s)}function lZ(e){if(e.gender==="male")return"blue";if(e.gender==="female")return"pink"}function dN(e){const t=Wt(e.patient);return t?a.jsxs(vt,{children:[a.jsx(mo,{value:t,size:"lg",color:lZ(t)}),a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Name"}),a.jsx(vt.Value,{children:a.jsx(jt,{to:t,fw:500,children:t.name?a.jsx(US,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"DoB"}),a.jsx(vt.Value,{children:t.birthDate})]}),a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Age"}),a.jsx(vt.Value,{children:kB(t.birthDate)})]})]}),t.gender&&a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Gender"}),a.jsx(vt.Value,{children:t.gender})]}),t.address&&a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"State"}),a.jsx(vt.Value,{children:t.address[0]?.state})]}),t.identifier?.map(n=>a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:n?.system}),a.jsx(vt.Value,{children:n?.value})]},`${n?.system}-${n?.value}`))]}):null}function cZ(e){const{patient:t,...n}=e,r=v.useCallback((i,s,c)=>{const u=`${s}/${c}`,f=100;return Promise.allSettled([i.readHistory("Patient",c),i.search("Communication",{subject:u,_count:f}),i.search("Device",{patient:u,_count:f}),i.search("DeviceRequest",{patient:u,_count:f}),i.search("DiagnosticReport",{subject:u,_count:f}),i.search("Media",{subject:u,_count:f}),i.search("ServiceRequest",{subject:u,_count:f}),i.search("Task",{subject:u,_count:f})])},[]);return a.jsx(mg,{value:t,loadTimelineResources:r,createCommunication:(i,s,c)=>({resourceType:"Communication",status:"completed",subject:nn(i),sender:nn(s),sent:new Date().toISOString(),payload:[{contentString:c}]}),createMedia:(i,s,c)=>({resourceType:"Media",status:"completed",subject:nn(i),operator:nn(s),issued:new Date().toISOString(),content:c}),...n})}const uZ="_section_pqpwm_1",dZ="_hovering_pqpwm_7",ob={section:uZ,hovering:dZ};function fZ(e){const t=Re(),n=Wt(e.value),[r,i]=v.useState(!1),[s,c]=v.useState(),[u,f]=v.useState(),[h,m]=v.useState();function g(){f(void 0)}function y(){c(void 0)}const x=v.useRef(h);if(x.current=h,v.useEffect(()=>{t.requestSchema("PlanDefinition").then(()=>i(!0)).catch(console.log)},[t]),v.useEffect(()=>(m(vZ(n??{resourceType:"PlanDefinition",status:"active"})),document.addEventListener("mouseover",g),document.addEventListener("click",y),()=>{document.removeEventListener("mouseover",g),document.removeEventListener("click",y)}),[n]),!r||!h)return null;function S(w,C){m({...x.current,[w]:C})}return a.jsx("div",{children:a.jsxs(pt,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(h),children:[a.jsx(Fe,{label:"Plan Title",py:"md",defaultValue:h.title,onChange:w=>S("title",w.currentTarget.value)}),a.jsx(hZ,{actions:h.action||[],selectedKey:s,setSelectedKey:c,hoverKey:u,setHoverKey:f,onChange:w=>S("action",w)}),a.jsx(yr,{children:"Save"})]})})}function hZ(e){const t=v.useRef(e.actions);t.current=e.actions;function n(s){e.onChange(t.current.map(c=>c.id===s.id?s:c))}function r(s){e.onChange([...t.current,s]),e.setSelectedKey(s.id)}function i(s){e.onChange(t.current.filter(c=>c!==s))}return a.jsxs(Ne,{gap:"md",className:ob.section,children:[e.actions.map(s=>a.jsx(pZ,{action:s,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>i(s)},s.id)),a.jsx("div",{children:a.jsx(Me,{variant:"outline",onClick:s=>{jn(s),r({id:fN()})},children:"Add action"})})]})}function pZ(e){const{action:t}=e;function n(i){i.stopPropagation(),e.setSelectedKey(e.action.id)}function r(i){jn(i),e.setHoverKey(e.action.id)}return a.jsx("div",{onClick:n,onMouseOver:r,onFocus:r,children:a.jsx(mZ,{action:t,onChange:e.onChange,selectedKey:e.selectedKey,hoverKey:e.hoverKey,onRemove:e.onRemove})})}function mZ(e){const{action:t}=e,[n,r]=v.useState(),i=Re(),[s,c]=v.useState(!1),[u,f]=v.useState(),h=e.selectedKey===e.action.id,m=e.hoverKey===e.action.id;function g(x,S){e.onChange({...t,[x]:S})}const y=Ft(ob.section,{[ob.hovering]:m&&!h});return v.useEffect(()=>{(async()=>{if(!t.definitionCanonical)return;c(!0);const S=await i.readCanonical(["Questionnaire","ActivityDefinition"],t.definitionCanonical);r(gZ(S)),f(S),c(!1)})().catch(console.error)},[t.definitionCanonical,i]),s?a.jsx(Pr,{}):a.jsxs(gr,{"data-testid":t.id,className:y,p:0,radius:"sm",withBorder:!0,children:[a.jsxs(ar,{w:"100%",p:"xs",bg:"gray.0",gap:"md",align:"center",justify:"space-between",children:[a.jsx(Fe,{w:"100%",name:`actionTitle-${t.id}`,defaultValue:t.title,placeholder:"Title",onChange:x=>g("title",x.currentTarget.value)}),a.jsx(_s,{"data-testid":"close-button",onClick:e.onRemove})]}),h&&a.jsxs(Ne,{gap:"xl",p:"md",children:[a.jsx(le,{children:a.jsx(Fe,{label:"Task Description",placeholder:"Enter task description",name:`actionDescription-${t.id}`,defaultValue:t.description,onChange:x=>g("description",x.currentTarget.value)})}),a.jsx(le,{children:a.jsx(pn,{label:"Type of Action",value:n,onChange:x=>{const S=x.currentTarget.value==="standard"?void 0:x.currentTarget.value;r(S),e.onChange({...e.action,definitionCanonical:S==="standard"?void 0:e.action.definitionCanonical})},data:[{value:"standard",label:"Standard task"},{value:"questionnaire",label:"Task with Questionnaire"},{value:"activitydefinition",label:"Task with Activity Definition"}]})}),n==="questionnaire"&&a.jsxs(Ne,{gap:0,children:[a.jsxs(xe,{gap:0,mb:"xs",children:[a.jsx(ge,{fw:600,children:"Select questionnaire"}),a.jsx(ge,{c:"red",children:"*"})]}),a.jsxs(ge,{size:"sm",c:"dimmed",mb:"sm",children:["Questionnaire to be shown in the task in Encounter view. You can create new one from"," ",a.jsx(wt,{href:"/Questionnaire",target:"_blank",c:"blue",children:"questionnaires list"})]}),a.jsx($R,{resource:u,resourceType:"Questionnaire",action:t,onChange:e.onChange,placeholder:"Search for questionnaire"})]}),n==="activitydefinition"&&a.jsxs(Ne,{gap:0,children:[a.jsxs(xe,{gap:0,mb:"xs",children:[a.jsx(ge,{fw:600,children:"Select activity definition"}),a.jsx(ge,{c:"red",children:"*"})]}),a.jsxs(ge,{size:"sm",c:"dimmed",mb:"sm",children:["ActivityDefinition.kind resource to be shown in the task in Encounter view. You can create new one from"," ",a.jsx(wt,{href:"/ActivityDefinition",target:"_blank",c:"blue",children:"activity definitions list"})]}),a.jsx($R,{resource:u,resourceType:"ActivityDefinition",action:t,onChange:e.onChange,placeholder:"Search for activity definition"})]})]})]})}function $R(e){const{id:t}=e.action,{resource:n}=e;return a.jsx(Eu,{name:t,placeholder:e.placeholder,resourceType:e.resourceType,defaultValue:n,onChange:r=>{r?e.onChange({...e.action,definitionCanonical:"url"in r?r.url:void 0,definitionUri:"url"in r?void 0:$t(r)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function gZ(e){return e===void 0?"standard":e.resourceType.toLowerCase()}let fx=1;function fN(e){if(e){if(e.startsWith("id-")){const t=Number.parseInt(e.substring(3),10);Number.isNaN(t)||(fx=Math.max(fx,t+1))}return e}return"id-"+fx++}function vZ(e){return{...e,action:hN(e.action)}}function hN(e){if(e)return e.map(t=>({...t,id:fN(t.id),action:hN(t.action)}))}const yZ="_section_my8o4_1",xZ="_hovering_my8o4_10",bZ="_editing_my8o4_14",SZ="_questionBody_my8o4_20",jZ="_topActions_my8o4_24",wZ="_bottomActions_my8o4_33",CZ="_movementActions_my8o4_44",EZ="_movementIcons_my8o4_56",TZ="_columnAlignment_my8o4_60",RZ="_linkIdInput_my8o4_65",_Z="_typeSelect_my8o4_70",DZ="_preserveBreaks_my8o4_74",fi={section:yZ,hovering:xZ,editing:bZ,questionBody:SZ,topActions:jZ,bottomActions:wZ,movementActions:CZ,movementIcons:EZ,columnAlignment:TZ,linkIdInput:RZ,typeSelect:_Z,preserveBreaks:DZ};function AZ(e){const t=Re(),n=Wt(e.questionnaire),[r,i]=v.useState(!1),[s,c]=v.useState(),[u,f]=v.useState(),[h,m]=v.useState();function g(){m(void 0)}function y(){f(void 0)}v.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>i(!0)).catch(console.log)},[t]),v.useEffect(()=>(c(OZ(n??{resourceType:"Questionnaire",status:"active"})),document.addEventListener("mouseover",g),document.addEventListener("click",y),()=>{document.removeEventListener("mouseover",g),document.removeEventListener("click",y)}),[n]);const x=(S,w)=>{c(S),e.autoSave&&!w&&e.onSubmit&&e.onSubmit(S)};return!r||!s?null:a.jsx("div",{children:a.jsxs(pt,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(s),children:[a.jsx(pN,{item:s,selectedKey:u,setSelectedKey:f,hoverKey:h,setHoverKey:m,onChange:x}),a.jsx(yr,{children:"Save"})]})})}function pN(e){const t=e.item,n=e.item,r=Oa(e.item),i=r||n.type===gt.group,s=n.linkId??"[untitled]",c=e.selectedKey===e.item.id,u=e.hoverKey===e.item.id,f=v.useRef(e.item);f.current=e.item;function h(E){jn(E),e.setSelectedKey(e.item.id)}function m(E){jn(E),e.setHoverKey(e.item.id)}function g(E){const _=f.current;e.onChange({..._,item:_.item?.map(P=>P.id===E.id?E:P)})}function y(E,_){e.onChange({...e.item,item:[...e.item.item??[],E]},_)}function x(E){e.onChange({...e.item,item:e.item.item?.filter(_=>_!==E)})}function S(E,_){e.onChange({...f.current,[E]:_})}function w(E){e.onChange({...e.item,...E})}function C(E){e.onChange({...e.item,item:e.item.item?.map(_=>_===E?{..._,repeats:!_.repeats}:_)})}function T(E,_){const P=IZ(e.item.item,E,_);e.onChange({...e.item,item:P})}const R=Ft(fi.section,{[fi.editing]:c,[fi.hovering]:u&&!c});return a.jsxs("div",{"data-testid":n.linkId,className:R,onClick:h,onMouseOver:m,onFocus:m,children:[a.jsx("div",{className:fi.questionBody,children:c?a.jsxs(a.Fragment,{children:[r&&a.jsx(Fe,{size:"xl",defaultValue:t.title,onBlur:E=>S("title",E.currentTarget.value)}),!r&&a.jsx(Ul,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:E=>S("text",E.currentTarget.value)}),n.type==="reference"&&a.jsx(NZ,{item:n,onChange:w}),VH(n)&&a.jsx(kZ,{item:n,onChange:E=>w(E)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx(ze,{children:t.title}),n.text&&a.jsx("div",{className:fi.preserveBreaks,children:n.text}),!i&&a.jsx(em,{item:n,index:0,required:!1,responseItem:{linkId:n.linkId}})]})}),n.item?.map((E,_)=>a.jsx("div",{children:a.jsx(pN,{item:E,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:_===0,isLast:_===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:g,onRemove:()=>x(E),onRepeatable:C,onMoveUp:()=>T(_,-1),onMoveDown:()=>T(_,1)})},E.id)),!i&&a.jsx("div",{className:fi.topActions,children:c?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{size:"xs",className:fi.linkIdInput,defaultValue:n.linkId,onBlur:E=>S("linkId",E.currentTarget.value)}),!i&&a.jsx(pn,{size:"xs",className:fi.typeSelect,defaultValue:n.type,onChange:E=>S("type",E.currentTarget.value),data:[{value:"display",label:"Display"},{value:"boolean",label:"Boolean"},{value:"decimal",label:"Decimal"},{value:"integer",label:"Integer"},{value:"date",label:"Date"},{value:"dateTime",label:"Date/Time"},{value:"time",label:"Time"},{value:"string",label:"String"},{value:"text",label:"Text"},{value:"url",label:"URL"},{value:"choice",label:"Choice"},{value:"open-choice",label:"Open Choice"},{value:"attachment",label:"Attachment"},{value:"reference",label:"Reference"},{value:"quantity",label:"Quantity"}]})]}):a.jsx("div",{children:s})}),!r&&a.jsx(le,{className:fi.movementActions,children:a.jsxs(le,{className:fi.columnAlignment,children:[!e.isFirst&&a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(Sq,{"data-testid":"up-button",size:15,className:fi.movementIcons})}),!e.isLast&&a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(xq,{"data-testid":"down-button",size:15,className:fi.movementIcons})})]})}),a.jsxs("div",{className:fi.bottomActions,children:[i&&a.jsxs(a.Fragment,{children:[a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),y({id:Pl(),linkId:lb("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),y({id:Pl(),linkId:lb("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),y(LZ(),!0)},children:"Add Page"}),c&&!r&&a.jsxs(a.Fragment,{children:[a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx(wt,{href:"#",onClick:E=>{E.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function kZ(e){const t=Ps("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(Fe,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(PZ,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(le,{display:"flex",children:[a.jsx(wt,{href:"#",onClick:r=>{jn(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:Pl()}]})},children:"Add choice"}),a.jsx(MA,{w:"lg"}),a.jsx(wt,{href:"#",onClick:r=>{jn(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function PZ(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=ug({type:"QuestionnaireItemAnswerOption",value:t},"value");return a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"80%"},children:[a.jsx("div",{children:a.jsx(Nf,{name:"value[x]",path:"Questionnaire.answerOption.value[x]",property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(i,s)=>{const c=[...e.options],u=c.findIndex(f=>f.id===t.id);c[u]={id:t.id,[s]:i},e.onChange({...e.item,answerOption:c})},outcome:void 0},t.id)}),a.jsx("div",{children:a.jsx(wt,{href:"#",onClick:i=>{jn(i),e.onChange({...e.item,answerOption:e.options.filter(s=>s.id!==t.id)})},children:"Remove"})})]},t.id)})})}function NZ(e){const t=Jk(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(xe,{children:[a.jsx(HS,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:i=>{e.onChange(ox(e.item,t.map(s=>s===n?i:s)))}}),a.jsx(wt,{href:"#",onClick:i=>{jn(i),e.onChange(ox(e.item,t.filter(s=>s!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx(wt,{href:"#",onClick:n=>{jn(n),e.onChange(ox(e.item,[...t,""]))},children:"Add Resource Type"})]})}let ab=1,sb=1;function lb(e){return e+ab++}function Pl(){return"id-"+sb++}function OZ(e){return{...e,id:e.id||Pl(),item:mN(e.item)}}function mN(e){if(e)return e.forEach(t=>{t.id?.match(/^id-\d+$/)&&(sb=Math.max(sb,Number.parseInt(t.id.substring(3),10)+1)),t.linkId?.match(/^q\d+$/)&&(ab=Math.max(ab,Number.parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||Pl(),item:mN(t.item),answerOption:MZ(t.answerOption)}))}function MZ(e){if(e)return e.map(t=>({...t,id:t.id||Pl()}))}function LZ(){return{id:Pl(),linkId:lb("s"),type:"group",text:"New Page",extension:[{url:DS,valueCodeableConcept:{coding:[{system:"http://hl7.org/fhir/questionnaire-item-control",code:"page"}]}}]}}function IZ(e,t,n){const r=e??[],i=t+n;if(i<0||i>=r.length)return r;const s=[...r];return[s[t],s[i]]=[s[i],s[t]],s}const zZ="_section_4m5it_1",$Z={section:zZ},UZ=["gender","age","gestationalAge","context","appliesTo","category"],BZ={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function VZ(e){e=Object.assign(BZ,e);const t=e.definition,[n,r]=v.useState([]),[i,s]=v.useState(1),[c,u]=v.useState(1);return v.useEffect(()=>{const S=qZ(t,u);r(GZ(S.qualifiedInterval||[],s))},[t]),a.jsxs(pt,{testid:"reference-range-editor",onSubmit:f,children:[a.jsx(Ne,{children:n.map(S=>a.jsx(FZ,{unit:QZ(t.quantitativeDetails?.unit),onChange:g,onAdd:y,onRemove:x,onRemoveGroup:m,intervalGroup:S},`group-${S.id}`))}),a.jsx(Pn,{title:"Add Group",variant:"subtle",size:"sm",onClick:S=>{jn(S),h({id:`group-id-${i}`,filters:{},intervals:[]}),s(w=>w+1)},children:a.jsx(Yd,{})}),a.jsx(xe,{justify:"flex-end",children:a.jsx(yr,{children:"Save"})})]});function f(){const S=n.flatMap(w=>w.intervals).filter(w=>!YZ(w));e.onSubmit({...t,qualifiedInterval:S})}function h(S){r(w=>[...w,S])}function m(S){r(w=>w.filter(C=>C.id!==S.id))}function g(S,w){r(C=>{C=[...C];const T=C.find(E=>E.id===S),R=T?.intervals.findIndex(E=>E.id===w.id);return R!==void 0&&T?.intervals[R]&&(T.intervals[R]=w),C})}function y(S,w){w.id===void 0&&(w.id=`id-${c}`,u(C=>C+1)),r(C=>{C=[...C];const T=C.findIndex(R=>R.id===S);if(T!==-1){const R={...C[T]};w={...w,...R.filters},R.intervals=[...R.intervals,w],C[T]=R}return C})}function x(S,w){r(C=>{C=[...C];const T=C.find(R=>R.id===S);return T&&(T.intervals=T.intervals.filter(R=>R.id!==w.id)),C})}}function FZ(e){const{intervalGroup:t,unit:n}=e;return a.jsx(Fl,{"data-testid":t.id,className:$Z.section,children:a.jsxs(Ne,{gap:"lg",children:[a.jsx(xe,{justify:"flex-end",children:a.jsx(Pn,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{jn(r),e.onRemoveGroup(t)},children:a.jsx(Qp,{})},`remove-group-button-${t.id}`)}),a.jsx(HZ,{intervalGroup:t,onChange:e.onChange}),a.jsx(dn,{}),t.intervals.map(r=>a.jsxs(Ne,{gap:"xs",children:[a.jsxs(xe,{children:[a.jsx(Fe,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:i=>{jn(i),e.onChange(t.id,{...r,condition:i.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(Pn,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:i=>{jn(i),e.onRemove(t.id,r)},children:a.jsx(Qp,{})},`remove-interval-${r.id}`)]}),a.jsx(QS,{path:"",onChange:i=>{e.onChange(t.id,{...r,range:i})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(Pn,{title:"Add Interval",variant:"subtle",size:"sm",onClick:r=>{jn(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:a.jsx(Yd,{})})]})})}function HZ(e){const{intervalGroup:t,onChange:n}=e;t.filters.age||(t.filters.age={});for(const r of["low","high"])t.filters.age[r]?.unit||(t.filters.age[r]={...t.filters.age[r],unit:"years",system:"http://unitsofmeasure.org"});return a.jsxs(Ne,{style:{maxWidth:"50%"},children:[a.jsx(xe,{children:a.jsx(pn,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:r=>{for(const i of t.intervals){let s=r.currentTarget.value;s===""&&(s=void 0),n(t.id,{...i,gender:s})}}})}),a.jsxs(xe,{gap:"xs",children:[a.jsx(ge,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),a.jsx("div",{id:`div-age-${t.id}`,children:a.jsx(QS,{path:"",name:`age-${t.id}`,defaultValue:t.filters.age,onChange:r=>{for(const i of t.intervals)n(t.id,{...i,age:r})}},`age-${t.id}`)})]}),a.jsx(pn,{data:["","pre-puberty","follicular","midcycle","luteal","postmenopausal"],label:"Endocrine:",defaultValue:t.filters.context?.text||"",onChange:r=>{for(const i of t.intervals){let s=r.currentTarget.value;s===""?(s=void 0,n(t.id,{...i,context:void 0})):n(t.id,{...i,context:{text:s,coding:[{code:s,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),a.jsx(pn,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:r=>{for(const i of t.intervals){const s=r.currentTarget.value;s===""?n(t.id,{...i,category:void 0}):n(t.id,{...i,category:s})}}})]})}function qZ(e,t){const n=e.qualifiedInterval||[];let r=Math.max(...n.map(i=>{const s=Number.parseInt(i.id?.substring(3)||"",10);return Number.isNaN(s)?Number.NEGATIVE_INFINITY:s}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(i=>({...i,id:i.id||`id-${r++}`}))},t(r),e}function GZ(e,t){let n=1;const r={};for(const i of e){const s=WZ(i);s in r||(r[s]={id:`group-id-${n++}`,filters:Object.fromEntries(UZ.map(c=>[c,i[c]])),intervals:[]}),r[s].intervals.push(i)}return t(n),Object.values(r)}function WZ(e){return[`gender=${e.gender}`,`age=${Gd(e.age)}`,`gestationalAge=${Gd(e.gestationalAge)}`,`context=${e.context?.text}`,`appliesTo=${e.appliesTo?.map(n=>n.text).join("+")}`,`category=${e.category}`].join(":")}function QZ(e){return e&&(VB(e,"http://unitsofmeasure.org")||e.text)}function YZ(e){return e.range?.low?.value===void 0&&e.range?.high?.value===void 0}function KZ(e){const t=Re(),n=Wt(e.value),[r,i]=v.useState(!1),[s,c]=v.useState();if(v.useEffect(()=>{n&&!r&&(t.executeBatch(u(n)).then(c).catch(console.log),i(!0))},[t,n,r]),!n||!s)return null;return a.jsx(Nt,{children:n.action?.map((h,m)=>{const g=h.resource&&f(h.resource),y=g?.input?.[0]?.valueReference,x=g?.output?.[0]?.valueReference;return a.jsxs(v.Fragment,{children:[a.jsx(Nt.Col,{span:1,p:"md",children:g?.status==="completed"?a.jsx(qq,{}):a.jsx(gW,{color:"gray"})}),a.jsxs(Nt.Col,{span:9,p:"xs",children:[a.jsx(ge,{fw:500,children:h.title}),h.description&&a.jsx("div",{children:h.description}),a.jsxs("div",{children:["Last edited by ",a.jsx(Hl,{value:g?.meta?.author})," on ",Nr(g?.meta?.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx(pg,{status:g?.status||"unknown"})]})]}),a.jsxs(Nt.Col,{span:2,p:"md",children:[y&&!x&&a.jsx(Me,{onClick:()=>e.onStart(g,y),children:"Start"}),y&&x&&a.jsx(Me,{onClick:()=>e.onEdit(g,y,x),children:"Edit"})]})]},`action-${m}`)})});function u(h){const m=[];if(h.action)for(const g of h.action)g.resource?.reference&&m.push({request:{method:"GET",url:g.resource.reference}});return{resourceType:"Bundle",type:"batch",entry:m}}function f(h){for(const m of s?.entry??[])if(m.resource&&h.reference===$t(m.resource))return m.resource}}function gN(e,t){const n=XZ(e,t);return JZ(n,e,t)}function XZ(e,t){const n=e.length,r=t.length,i=n+r+1,s=1+2*i,c=Math.trunc(s/2),u=new Array(s);u[c+1]={i:0,j:-1,prev:void 0,snake:!0};for(let f=0;f<i;f++){for(let h=-f;h<=f;h+=2){const m=c+h,g=m+1,y=m-1,x=u[g],S=u[y];let w,C=0;h===-f||h!==f&&S.i<x.i?(C=x.i,w=x):(C=S.i+1,w=S),u[y]=void 0;let T=C-h,R={i:C,j:T,prev:ZZ(w),snake:!1};for(;C<n&&T<r&&e[C]===t[T];)C++,T++;if(C>R.i&&(R={i:C,j:T,prev:R,snake:!0}),u[m]=R,C>=n&&T>=r)return u[m]}u[c+f-1]=void 0}}function JZ(e,t,n){const r=[];let i=e;for(i.snake&&(i=i.prev);i?.prev&&i.prev.j>=0;){const s=i.i,c=i.j;i=i.prev;const u=i.i,f=i.j,h={position:u,lines:t.slice(u,s)},m={position:f,lines:n.slice(f,c)};let g;h.lines.length===0&&m.lines.length>0?g="insert":h.lines.length>0&&m.lines.length===0?g="delete":g="change",r.push({original:h,revised:m,type:g}),i.snake&&(i=i.prev)}return r}function ZZ(e){return e&&!e.snake&&e.prev?e.prev:e}function eee(e){const t=(e.entry??[]).filter(r=>!!r.resource).map(r=>({meta:r.resource?.meta,lines:fo(r.resource,!0).match(/[^\r\n]+/g)})).sort((r,i)=>r.meta.lastUpdated.localeCompare(i.meta.lastUpdated));if(!t.length)return[];const n=t[0].lines.map(r=>({id:t[0].meta.versionId,meta:t[0].meta,value:r,span:1}));return tee(n,t),nee(n),n}function tee(e,t){for(let n=1;n<t.length;n++){const r=gN(t[n-1].lines,t[n].lines);for(const i of r){const s=i.original.position,c=i.original.lines,u=i.revised.lines;if((i.type==="delete"||i.type==="change")&&e.splice(s,c.length),i.type==="insert"||i.type==="change")for(let f=0;f<i.revised.lines.length;f++)e.splice(s+f,0,{id:t[n].meta.versionId,meta:t[n].meta,value:u[f],span:1})}}}function nee(e){let t=0;for(;t<e.length;){let n=t;for(;n<e.length&&e[n].id===e[t].id;)e[n].span=-1,n++;e[t].span=n-t,t=n}}const ree="_container_1tyf3_1",iee="_root_1tyf3_5",oee="_startRow_1tyf3_20",aee="_normalRow_1tyf3_25",see="_author_1tyf3_30",lee="_dateTime_1tyf3_34",cee="_lineNumber_1tyf3_40",uee="_line_1tyf3_40",dee="_pre_1tyf3_55",ga={container:ree,root:iee,startRow:oee,normalRow:aee,author:see,dateTime:lee,lineNumber:cee,line:uee,pre:dee};function fee(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function hee(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return Bc(n,"year");const r=Math.floor(t/2592e3);if(r>0)return Bc(r,"month");const i=Math.floor(t/86400);if(i>0)return Bc(i,"day");const s=Math.floor(t/3600);if(s>0)return Bc(s,"hour");const c=Math.floor(t/60);return c>0?Bc(c,"minute"):Bc(t,"second")}function Bc(e,t){return`${e} ${e===1?t:t+"s"} ago`}function pee(e){const t=Re(),[n,r]=v.useState(e.history);if(v.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(r).catch(console.log)},[t,e.history,e.resourceType,e.id]),!n)return a.jsx("div",{children:"Loading..."});const i=n.entry?.[0]?.resource;if(!i)return null;const s=eee(n);return a.jsx("div",{className:ga.container,children:a.jsx("table",{className:ga.root,children:a.jsx("tbody",{children:s.map((c,u)=>a.jsxs("tr",{className:c.span>0?ga.startRow:ga.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:ga.author,rowSpan:c.span,children:a.jsx(Hl,{value:c.meta.author,link:!0,fz:"xs"})}),a.jsx("td",{className:ga.dateTime,rowSpan:c.span,children:a.jsx(jt,{to:fee(i,c.meta.versionId),fz:"xs",children:hee(c.meta.lastUpdated)})})]}),a.jsx("td",{className:ga.lineNumber,children:u+1}),a.jsx("td",{className:ga.line,children:a.jsx("pre",{className:ga.pre,children:c.value})})]},"row-"+u))})})})}const mee="_removed_el5zk_1",gee="_added_el5zk_6",UR={removed:mee,added:gee};function vee(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=fo(t,!0).match(/[^\r\n]+/g),i=fo(n,!0).match(/[^\r\n]+/g),s=gN(r,i);return a.jsx("pre",{style:{color:"gray"},children:s.map((c,u)=>a.jsx(yee,{delta:c},"delta"+u))})}function yee(e){return a.jsxs(a.Fragment,{children:["...",a.jsx("br",{}),e.delta.original.lines.length>0&&a.jsx("div",{className:UR.removed,children:e.delta.original.lines.join(`
205
+ `)}),e.delta.revised.lines.length>0&&a.jsx("div",{className:UR.added,children:e.delta.revised.lines.join(`
206
+ `)}),"...",a.jsx("br",{})]})}const xee="_splitButton_1i0gi_1",bee="_menuControl_1i0gi_6",BR={splitButton:xee,menuControl:bee};function nm(e){const{outcome:t}=e,n=Re(),r=Wt(e.defaultValue),i=r?.resourceType,[s,c]=v.useState(!1),[u,f]=v.useState(),h=n.getAccessPolicy(),m=Nn();v.useEffect(()=>{if(r)if(e.profileUrl){const x=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{const S=Su(x);if(S){c(!0);const w=gH(r,S);f(w)}else console.error(`Schema not found for ${x}`)}).catch(S=>{console.error("Error in requestProfileSchema",S)})}else n.requestSchema(i).then(()=>{f(r),c(!0)}).catch(console.log)},[n,r,i,e.profileUrl]);const g=v.useMemo(()=>r&&Ok(r,vl.READ,h),[h,r]),y=v.useMemo(()=>n.isSuperAdmin()||!h||!In(u?.resourceType)?!0:mF(h,u?.resourceType),[n,h,u?.resourceType]);return!s||!u?a.jsx("div",{children:"Loading..."}):y?a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:x=>{x.preventDefault(),e.onSubmit&&e.onSubmit(u)},children:[a.jsxs(Ne,{mb:"xl",children:[a.jsx(Vt,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(Fe,{name:"resourceType",defaultValue:u.resourceType,disabled:!0})}),a.jsx(Vt,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(Fe,{name:"id",defaultValue:u.id,disabled:!0})})]}),a.jsx(XS,{path:u.resourceType,valuePath:u.resourceType,typeName:i,defaultValue:u,outcome:t,onChange:f,profileUrl:e.profileUrl,accessPolicyResource:g}),a.jsxs(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",gap:0,children:[a.jsx(Me,{type:"submit",className:Ft((e.onPatch||e.onDelete)&&BR.splitButton),children:r?.id?"Update":"Create"}),(e.onPatch||e.onDelete)&&a.jsxs(be,{transitionProps:{transition:"pop"},position:"bottom-end",withinPortal:!0,children:[a.jsx(be.Target,{children:a.jsx(Pn,{variant:"filled",color:m.primaryColor,size:36,className:BR.menuControl,"aria-label":"More actions",children:a.jsx(NS,{size:14,stroke:1.5})})}),a.jsxs(be.Dropdown,{children:[e.onPatch&&a.jsx(be.Item,{leftSection:a.jsx(oP,{size:14,stroke:1.5}),onClick:()=>{e.onPatch(u)},children:"Patch"}),e.onDelete&&a.jsx(be.Item,{color:"red",leftSection:a.jsx(rg,{size:14,stroke:1.5,color:"red"}),onClick:()=>{e.onDelete(u)},children:"Delete"})]})]})]})]}):a.jsxs(qo,{color:"red",title:"Permission denied",icon:a.jsx(Ns,{}),children:["Your access level prevents you from editing and creating ",u.resourceType," resources."]})}function See(e){const t=Re(),[n,r]=v.useState(e.history);return v.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(r).catch(console.log)},[t,e.history,e.resourceType,e.id]),n?a.jsxs(Z,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{children:"Author"}),a.jsx(Z.Th,{children:"Date"}),a.jsx(Z.Th,{children:"Version"})]})}),a.jsx(Z.Tbody,{children:n.entry?.map((i,s)=>a.jsx(jee,{entry:i},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function jee(e){const{response:t,resource:n}=e.entry;return n?a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:a.jsx(Pd,{value:n.meta?.author,link:!0})}),a.jsx(Z.Td,{children:Nr(n.meta?.lastUpdated)}),a.jsx(Z.Td,{children:a.jsx(jt,{to:wee(n),children:n.meta?.versionId})})]}):a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:3,children:We(t?.outcome)})})}function wee(e){return`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`}function Cee(e){const{serviceRequest:t,...n}=e;return a.jsx(mg,{value:t,loadTimelineResources:async(r,i,s)=>{const c=`${i}/${s}`,u=100;return Promise.allSettled([r.readHistory("ServiceRequest",s),r.search("Communication",{"based-on":c,_count:u}),r.search("DiagnosticReport",{"based-on":c,_count:u}),r.search("Media",{"based-on":c,_count:u}),r.search("DocumentReference",{related:c,_count:u}),r.search("Task",{_filter:`based-on eq ${c} or focus eq ${c} or subject eq ${c}`,_count:u})])},createCommunication:(r,i,s)=>({resourceType:"Communication",status:"completed",basedOn:[nn(r)],subject:r.subject,sender:nn(i),sent:new Date().toISOString(),payload:[{contentString:s}]}),createMedia:(r,i,s)=>({resourceType:"Media",status:"completed",basedOn:[nn(r)],subject:r.subject,operator:nn(i),issued:new Date().toISOString(),content:s}),...n})}function Eee(e){const t=Re(),{client:n,patient:r,encounter:i,children:s,...c}=e,u=Wt(r),f=Wt(i);function h(){let m=r,g=i;if(n.launchIdentifierSystems?.length){const y=n.launchIdentifierSystems.find(S=>S.resourceType==="Patient");if(m&&u&&y?.system){const S=u.identifier?.find(w=>w.system===y.system);S&&(m={...r,identifier:S})}const x=n.launchIdentifierSystems.find(S=>S.resourceType==="Encounter");if(g&&f&&x?.system){const S=f.identifier?.find(w=>w.system===x.system);S&&(g={...i,identifier:S})}}t.createResource({resourceType:"SmartAppLaunch",patient:m,encounter:g}).then(y=>{const x=new URL(n.launchUri);x.searchParams.set("iss",vS(t.fhirUrl().toString())),x.searchParams.set("launch",y.id),rr.assign(x.toString())}).catch(y=>Ae({color:"red",message:We(y),autoClose:!1}))}return a.jsx(wt,{onClick:()=>h(),...c,children:s})}var hx={exports:{}},bd={},px={exports:{}},mx={};var VR;function Tee(){return VR||(VR=1,(function(e){function t(L,I){var $=L.length;L.push(I);e:for(;0<$;){var V=$-1>>>1,X=L[V];if(0<i(X,I))L[V]=I,L[$]=X,$=V;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var I=L[0],$=L.pop();if($!==I){L[0]=$;e:for(var V=0,X=L.length,M=X>>>1;V<M;){var F=2*(V+1)-1,ie=L[F],de=F+1,Se=L[de];if(0>i(ie,$))de<X&&0>i(Se,ie)?(L[V]=Se,L[de]=$,V=de):(L[V]=ie,L[F]=$,V=F);else if(de<X&&0>i(Se,$))L[V]=Se,L[de]=$,V=de;else break e}}return I}function i(L,I){var $=L.sortIndex-I.sortIndex;return $!==0?$:L.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],h=[],m=1,g=null,y=3,x=!1,S=!1,w=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function _(L){for(var I=n(h);I!==null;){if(I.callback===null)r(h);else if(I.startTime<=L)r(h),I.sortIndex=I.expirationTime,t(f,I);else break;I=n(h)}}function P(L){if(w=!1,_(L),!S)if(n(f)!==null)S=!0,O||(O=!0,W());else{var I=n(h);I!==null&&G(P,I.startTime-L)}}var O=!1,k=-1,A=5,z=-1;function U(){return C?!0:!(e.unstable_now()-z<A)}function K(){if(C=!1,O){var L=e.unstable_now();z=L;var I=!0;try{e:{S=!1,w&&(w=!1,R(k),k=-1),x=!0;var $=y;try{t:{for(_(L),g=n(f);g!==null&&!(g.expirationTime>L&&U());){var V=g.callback;if(typeof V=="function"){g.callback=null,y=g.priorityLevel;var X=V(g.expirationTime<=L);if(L=e.unstable_now(),typeof X=="function"){g.callback=X,_(L),I=!0;break t}g===n(f)&&r(f),_(L)}else r(f);g=n(f)}if(g!==null)I=!0;else{var M=n(h);M!==null&&G(P,M.startTime-L),I=!1}}break e}finally{g=null,y=$,x=!1}I=void 0}}finally{I?W():O=!1}}}var W;if(typeof E=="function")W=function(){E(K)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,B=ee.port2;ee.port1.onmessage=K,W=function(){B.postMessage(null)}}else W=function(){T(K,0)};function G(L,I){k=T(function(){L(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(L){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var $=y;y=I;try{return L()}finally{y=$}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(L,I){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var $=y;y=L;try{return I()}finally{y=$}},e.unstable_scheduleCallback=function(L,I,$){var V=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?V+$:V):$=V,L){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=$+X,L={id:m++,callback:I,priorityLevel:L,startTime:$,expirationTime:X,sortIndex:-1},$>V?(L.sortIndex=$,t(h,L),n(f)===null&&L===n(h)&&(w?(R(k),k=-1):w=!0,G(P,$-V))):(L.sortIndex=X,t(f,L),S||x||(S=!0,O||(O=!0,W()))),L},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(L){var I=y;return function(){var $=y;y=I;try{return L.apply(this,arguments)}finally{y=$}}}})(mx)),mx}var FR;function Ree(){return FR||(FR=1,px.exports=Tee()),px.exports}var HR;function _ee(){if(HR)return bd;HR=1;var e=Ree(),t=jb(),n=j2();function r(o){var l="https://react.dev/errors/"+o;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var l=o,d=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(d=l.return),o=l.return;while(o)}return l.tag===3?d:null}function c(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function u(o){if(o.tag===31){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function f(o){if(s(o)!==o)throw Error(r(188))}function h(o){var l=o.alternate;if(!l){if(l=s(o),l===null)throw Error(r(188));return l!==o?null:o}for(var d=o,p=l;;){var b=d.return;if(b===null)break;var j=b.alternate;if(j===null){if(p=b.return,p!==null){d=p;continue}break}if(b.child===j.child){for(j=b.child;j;){if(j===d)return f(b),o;if(j===p)return f(b),l;j=j.sibling}throw Error(r(188))}if(d.return!==p.return)d=b,p=j;else{for(var D=!1,N=b.child;N;){if(N===d){D=!0,d=b,p=j;break}if(N===p){D=!0,p=b,d=j;break}N=N.sibling}if(!D){for(N=j.child;N;){if(N===d){D=!0,d=j,p=b;break}if(N===p){D=!0,p=j,d=b;break}N=N.sibling}if(!D)throw Error(r(189))}}if(d.alternate!==p)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?o:l}function m(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=m(o),l!==null)return l;o=o.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),E=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function W(o){return o===null||typeof o!="object"?null:(o=K&&o[K]||o["@@iterator"],typeof o=="function"?o:null)}var ee=Symbol.for("react.client.reference");function B(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===ee?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case P:return"Suspense";case O:return"SuspenseList";case z:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case S:return"Portal";case E:return o.displayName||"Context";case R:return(o._context.displayName||"Context")+".Consumer";case _:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case k:return l=o.displayName||null,l!==null?l:B(o.type)||"Memo";case A:l=o._payload,o=o._init;try{return B(o(l))}catch{}}return null}var G=Array.isArray,L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},V=[],X=-1;function M(o){return{current:o}}function F(o){0>X||(o.current=V[X],V[X]=null,X--)}function ie(o,l){X++,V[X]=o.current,o.current=l}var de=M(null),Se=M(null),Ce=M(null),je=M(null);function Ke(o,l){switch(ie(Ce,l),ie(Se,o),ie(de,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?AC(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=AC(l),o=kC(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}F(de),ie(de,o)}function _e(){F(de),F(Se),F(Ce)}function ht(o){o.memoizedState!==null&&ie(je,o);var l=de.current,d=kC(l,o.type);l!==d&&(ie(Se,o),ie(de,d))}function Ct(o){Se.current===o&&(F(de),F(Se)),je.current===o&&(F(je),fd._currentValue=$)}var Et,qe;function ct(o){if(Et===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);Et=l&&l[1]||"",qe=-1<d.stack.indexOf(`
207
+ at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
208
+ `+Et+o+qe}var Tt=!1;function It(o,l){if(!o||Tt)return"";Tt=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(l){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(ue){var se=ue}Reflect.construct(o,[],ye)}else{try{ye.call()}catch(ue){se=ue}o.call(ye.prototype)}}else{try{throw Error()}catch(ue){se=ue}(ye=o())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(ue){if(ue&&se&&typeof ue.stack=="string")return[ue.stack,se.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=p.DetermineComponentFrameRoot(),D=j[0],N=j[1];if(D&&N){var q=D.split(`
209
+ `),ne=N.split(`
210
+ `);for(b=p=0;p<q.length&&!q[p].includes("DetermineComponentFrameRoot");)p++;for(;b<ne.length&&!ne[b].includes("DetermineComponentFrameRoot");)b++;if(p===q.length||b===ne.length)for(p=q.length-1,b=ne.length-1;1<=p&&0<=b&&q[p]!==ne[b];)b--;for(;1<=p&&0<=b;p--,b--)if(q[p]!==ne[b]){if(p!==1||b!==1)do if(p--,b--,0>b||q[p]!==ne[b]){var pe=`
211
+ `+q[p].replace(" at new "," at ");return o.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",o.displayName)),pe}while(1<=p&&0<=b);break}}}finally{Tt=!1,Error.prepareStackTrace=d}return(d=o?o.displayName||o.name:"")?ct(d):""}function Te(o,l){switch(o.tag){case 26:case 27:case 5:return ct(o.type);case 16:return ct("Lazy");case 13:return o.child!==l&&l!==null?ct("Suspense Fallback"):ct("Suspense");case 19:return ct("SuspenseList");case 0:case 15:return It(o.type,!1);case 11:return It(o.type.render,!1);case 1:return It(o.type,!0);case 31:return ct("Activity");default:return""}}function Oe(o){try{var l="",d=null;do l+=Te(o,d),d=o,o=o.return;while(o);return l}catch(p){return`
212
+ Error generating stack: `+p.message+`
213
+ `+p.stack}}var Le=Object.prototype.hasOwnProperty,Ie=e.unstable_scheduleCallback,at=e.unstable_cancelCallback,Ze=e.unstable_shouldYield,dt=e.unstable_requestPaint,ft=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,he=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,Dt=e.unstable_NormalPriority,Rt=e.unstable_LowPriority,At=e.unstable_IdlePriority,ln=e.log,vn=e.unstable_setDisableYieldValue,lr=null,Hn=null;function wn(o){if(typeof ln=="function"&&vn(o),Hn&&typeof Hn.setStrictMode=="function")try{Hn.setStrictMode(lr,o)}catch{}}var zn=Math.clz32?Math.clz32:Qo,xi=Math.log,go=Math.LN2;function Qo(o){return o>>>=0,o===0?32:31-(xi(o)/go|0)|0}var Yi=256,Hr=262144,Yo=4194304;function ii(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ko(o,l,d){var p=o.pendingLanes;if(p===0)return 0;var b=0,j=o.suspendedLanes,D=o.pingedLanes;o=o.warmLanes;var N=p&134217727;return N!==0?(p=N&~j,p!==0?b=ii(p):(D&=N,D!==0?b=ii(D):d||(d=N&~o,d!==0&&(b=ii(d))))):(N=p&~j,N!==0?b=ii(N):D!==0?b=ii(D):d||(d=p&~o,d!==0&&(b=ii(d)))),b===0?0:l!==0&&l!==b&&(l&j)===0&&(j=b&-b,d=l&-l,j>=d||j===32&&(d&4194048)!==0)?l:b}function bi(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function zs(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mr(){var o=Yo;return Yo<<=1,(Yo&62914560)===0&&(Yo=4194304),o}function Ki(o){for(var l=[],d=0;31>d;d++)l.push(o);return l}function Cn(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Wl(o,l,d,p,b,j){var D=o.pendingLanes;o.pendingLanes=d,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=d,o.entangledLanes&=d,o.errorRecoveryDisabledLanes&=d,o.shellSuspendCounter=0;var N=o.entanglements,q=o.expirationTimes,ne=o.hiddenUpdates;for(d=D&~d;0<d;){var pe=31-zn(d),ye=1<<pe;N[pe]=0,q[pe]=-1;var se=ne[pe];if(se!==null)for(ne[pe]=null,pe=0;pe<se.length;pe++){var ue=se[pe];ue!==null&&(ue.lane&=-536870913)}d&=~ye}p!==0&&_u(o,p,0),j!==0&&b===0&&o.tag!==0&&(o.suspendedLanes|=j&~(D&~l))}function _u(o,l,d){o.pendingLanes|=l,o.suspendedLanes&=~l;var p=31-zn(l);o.entangledLanes|=l,o.entanglements[p]=o.entanglements[p]|1073741824|d&261930}function Ql(o,l){var d=o.entangledLanes|=l;for(o=o.entanglements;d;){var p=31-zn(d),b=1<<p;b&l|o[p]&l&&(o[p]|=l),d&=~b}}function H(o,l){var d=l&-l;return d=(d&42)!==0?1:Y(d),(d&(o.suspendedLanes|l))!==0?0:d}function Y(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function oe(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function we(){var o=I.p;return o!==0?o:(o=window.event,o===void 0?32:eE(o.type))}function De(o,l){var d=I.p;try{return I.p=o,l()}finally{I.p=d}}var Ge=Math.random().toString(36).slice(2),Pe="__reactFiber$"+Ge,Ve="__reactProps$"+Ge,He="__reactContainer$"+Ge,tt="__reactEvents$"+Ge,rt="__reactListeners$"+Ge,et="__reactHandles$"+Ge,Bt="__reactResources$"+Ge,bt="__reactMarker$"+Ge;function Xt(o){delete o[Pe],delete o[Ve],delete o[tt],delete o[rt],delete o[et]}function nt(o){var l=o[Pe];if(l)return l;for(var d=o.parentNode;d;){if(l=d[He]||d[Pe]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(o=zC(o);o!==null;){if(d=o[Pe])return d;o=zC(o)}return l}o=d,d=o.parentNode}return null}function yn(o){if(o=o[Pe]||o[He]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function Ot(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(r(33))}function qn(o){var l=o[Bt];return l||(l=o[Bt]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function xn(o){o[bt]=!0}var La=new Set,Xi={};function cr(o,l){vo(o,l),vo(o+"Capture",l)}function vo(o,l){for(Xi[o]=l,o=0;o<l.length;o++)La.add(l[o])}var $s=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),yo={},Us={};function Yl(o){return Le.call(Us,o)?!0:Le.call(yo,o)?!1:$s.test(o)?Us[o]=!0:(yo[o]=!0,!1)}function _t(o,l,d){if(Yl(l))if(d===null)o.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var p=l.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+d)}}function Gn(o,l,d){if(d===null)o.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+d)}}function Er(o,l,d,p){if(p===null)o.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(d);return}o.setAttributeNS(l,d,""+p)}}function Jn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function En(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Kl(o,l,d){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var b=p.get,j=p.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return b.call(this)},set:function(D){d=""+D,j.call(this,D)}}),Object.defineProperty(o,l,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(D){d=""+D},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function Xl(o){if(!o._valueTracker){var l=En(o)?"checked":"value";o._valueTracker=Kl(o,l,""+o[l])}}function Vf(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var d=l.getValue(),p="";return o&&(p=En(o)?o.checked?"true":"false":o.value),o=p,o!==d?(l.setValue(o),!0):!1}function Ff(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var SO=/[\n"\\]/g;function Si(o){return o.replace(SO,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function jg(o,l,d,p,b,j,D,N){o.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?o.type=D:o.removeAttribute("type"),l!=null?D==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+Jn(l)):o.value!==""+Jn(l)&&(o.value=""+Jn(l)):D!=="submit"&&D!=="reset"||o.removeAttribute("value"),l!=null?wg(o,D,Jn(l)):d!=null?wg(o,D,Jn(d)):p!=null&&o.removeAttribute("value"),b==null&&j!=null&&(o.defaultChecked=!!j),b!=null&&(o.checked=b&&typeof b!="function"&&typeof b!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?o.name=""+Jn(N):o.removeAttribute("name")}function C1(o,l,d,p,b,j,D,N){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(o.type=j),l!=null||d!=null){if(!(j!=="submit"&&j!=="reset"||l!=null)){Xl(o);return}d=d!=null?""+Jn(d):"",l=l!=null?""+Jn(l):d,N||l===o.value||(o.value=l),o.defaultValue=l}p=p??b,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=N?o.checked:!!p,o.defaultChecked=!!p,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(o.name=D),Xl(o)}function wg(o,l,d){l==="number"&&Ff(o.ownerDocument)===o||o.defaultValue===""+d||(o.defaultValue=""+d)}function Jl(o,l,d,p){if(o=o.options,l){l={};for(var b=0;b<d.length;b++)l["$"+d[b]]=!0;for(d=0;d<o.length;d++)b=l.hasOwnProperty("$"+o[d].value),o[d].selected!==b&&(o[d].selected=b),b&&p&&(o[d].defaultSelected=!0)}else{for(d=""+Jn(d),l=null,b=0;b<o.length;b++){if(o[b].value===d){o[b].selected=!0,p&&(o[b].defaultSelected=!0);return}l!==null||o[b].disabled||(l=o[b])}l!==null&&(l.selected=!0)}}function E1(o,l,d){if(l!=null&&(l=""+Jn(l),l!==o.value&&(o.value=l),d==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=d!=null?""+Jn(d):""}function T1(o,l,d,p){if(l==null){if(p!=null){if(d!=null)throw Error(r(92));if(G(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),l=d}d=Jn(l),o.defaultValue=d,p=o.textContent,p===d&&p!==""&&p!==null&&(o.value=p),Xl(o)}function Zl(o,l){if(l){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=l;return}}o.textContent=l}var jO=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function R1(o,l,d){var p=l.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":p?o.setProperty(l,d):typeof d!="number"||d===0||jO.has(l)?l==="float"?o.cssFloat=d:o[l]=(""+d).trim():o[l]=d+"px"}function _1(o,l,d){if(l!=null&&typeof l!="object")throw Error(r(62));if(o=o.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||l!=null&&l.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var b in l)p=l[b],l.hasOwnProperty(b)&&d[b]!==p&&R1(o,b,p)}else for(var j in l)l.hasOwnProperty(j)&&R1(o,j,l[j])}function Cg(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wO=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),CO=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hf(o){return CO.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Xo(){}var Eg=null;function Tg(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var ec=null,tc=null;function D1(o){var l=yn(o);if(l&&(o=l.stateNode)){var d=o[Ve]||null;e:switch(o=l.stateNode,l.type){case"input":if(jg(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),l=d.name,d.type==="radio"&&l!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Si(""+l)+'"][type="radio"]'),l=0;l<d.length;l++){var p=d[l];if(p!==o&&p.form===o.form){var b=p[Ve]||null;if(!b)throw Error(r(90));jg(p,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(l=0;l<d.length;l++)p=d[l],p.form===o.form&&Vf(p)}break e;case"textarea":E1(o,d.value,d.defaultValue);break e;case"select":l=d.value,l!=null&&Jl(o,!!d.multiple,l,!1)}}}var Rg=!1;function A1(o,l,d){if(Rg)return o(l,d);Rg=!0;try{var p=o(l);return p}finally{if(Rg=!1,(ec!==null||tc!==null)&&(kh(),ec&&(l=ec,o=tc,tc=ec=null,D1(l),o)))for(l=0;l<o.length;l++)D1(o[l])}}function Du(o,l){var d=o.stateNode;if(d===null)return null;var p=d[Ve]||null;if(p===null)return null;d=p[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(r(231,l,typeof d));return d}var Jo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_g=!1;if(Jo)try{var Au={};Object.defineProperty(Au,"passive",{get:function(){_g=!0}}),window.addEventListener("test",Au,Au),window.removeEventListener("test",Au,Au)}catch{_g=!1}var Ia=null,Dg=null,qf=null;function k1(){if(qf)return qf;var o,l=Dg,d=l.length,p,b="value"in Ia?Ia.value:Ia.textContent,j=b.length;for(o=0;o<d&&l[o]===b[o];o++);var D=d-o;for(p=1;p<=D&&l[d-p]===b[j-p];p++);return qf=b.slice(o,1<p?1-p:void 0)}function Gf(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function Wf(){return!0}function P1(){return!1}function qr(o){function l(d,p,b,j,D){this._reactName=d,this._targetInst=b,this.type=p,this.nativeEvent=j,this.target=D,this.currentTarget=null;for(var N in o)o.hasOwnProperty(N)&&(d=o[N],this[N]=d?d(j):j[N]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Wf:P1,this.isPropagationStopped=P1,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Wf)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Wf)},persist:function(){},isPersistent:Wf}),l}var Bs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qf=qr(Bs),ku=g({},Bs,{view:0,detail:0}),EO=qr(ku),Ag,kg,Pu,Yf=g({},ku,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ng,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Pu&&(Pu&&o.type==="mousemove"?(Ag=o.screenX-Pu.screenX,kg=o.screenY-Pu.screenY):kg=Ag=0,Pu=o),Ag)},movementY:function(o){return"movementY"in o?o.movementY:kg}}),N1=qr(Yf),TO=g({},Yf,{dataTransfer:0}),RO=qr(TO),_O=g({},ku,{relatedTarget:0}),Pg=qr(_O),DO=g({},Bs,{animationName:0,elapsedTime:0,pseudoElement:0}),AO=qr(DO),kO=g({},Bs,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),PO=qr(kO),NO=g({},Bs,{data:0}),O1=qr(NO),OO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},MO={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},LO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IO(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=LO[o])?!!l[o]:!1}function Ng(){return IO}var zO=g({},ku,{key:function(o){if(o.key){var l=OO[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=Gf(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?MO[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ng,charCode:function(o){return o.type==="keypress"?Gf(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Gf(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),$O=qr(zO),UO=g({},Yf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),M1=qr(UO),BO=g({},ku,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ng}),VO=qr(BO),FO=g({},Bs,{propertyName:0,elapsedTime:0,pseudoElement:0}),HO=qr(FO),qO=g({},Yf,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),GO=qr(qO),WO=g({},Bs,{newState:0,oldState:0}),QO=qr(WO),YO=[9,13,27,32],Og=Jo&&"CompositionEvent"in window,Nu=null;Jo&&"documentMode"in document&&(Nu=document.documentMode);var KO=Jo&&"TextEvent"in window&&!Nu,L1=Jo&&(!Og||Nu&&8<Nu&&11>=Nu),I1=" ",z1=!1;function $1(o,l){switch(o){case"keyup":return YO.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function U1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var nc=!1;function XO(o,l){switch(o){case"compositionend":return U1(l);case"keypress":return l.which!==32?null:(z1=!0,I1);case"textInput":return o=l.data,o===I1&&z1?null:o;default:return null}}function JO(o,l){if(nc)return o==="compositionend"||!Og&&$1(o,l)?(o=k1(),qf=Dg=Ia=null,nc=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return L1&&l.locale!=="ko"?null:l.data;default:return null}}var ZO={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function B1(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!ZO[o.type]:l==="textarea"}function V1(o,l,d,p){ec?tc?tc.push(p):tc=[p]:ec=p,l=zh(l,"onChange"),0<l.length&&(d=new Qf("onChange","change",null,d,p),o.push({event:d,listeners:l}))}var Ou=null,Mu=null;function e4(o){CC(o,0)}function Kf(o){var l=Ot(o);if(Vf(l))return o}function F1(o,l){if(o==="change")return l}var H1=!1;if(Jo){var Mg;if(Jo){var Lg="oninput"in document;if(!Lg){var q1=document.createElement("div");q1.setAttribute("oninput","return;"),Lg=typeof q1.oninput=="function"}Mg=Lg}else Mg=!1;H1=Mg&&(!document.documentMode||9<document.documentMode)}function G1(){Ou&&(Ou.detachEvent("onpropertychange",W1),Mu=Ou=null)}function W1(o){if(o.propertyName==="value"&&Kf(Mu)){var l=[];V1(l,Mu,o,Tg(o)),A1(e4,l)}}function t4(o,l,d){o==="focusin"?(G1(),Ou=l,Mu=d,Ou.attachEvent("onpropertychange",W1)):o==="focusout"&&G1()}function n4(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Kf(Mu)}function r4(o,l){if(o==="click")return Kf(l)}function i4(o,l){if(o==="input"||o==="change")return Kf(l)}function o4(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var oi=typeof Object.is=="function"?Object.is:o4;function Lu(o,l){if(oi(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var d=Object.keys(o),p=Object.keys(l);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var b=d[p];if(!Le.call(l,b)||!oi(o[b],l[b]))return!1}return!0}function Q1(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Y1(o,l){var d=Q1(o);o=0;for(var p;d;){if(d.nodeType===3){if(p=o+d.textContent.length,o<=l&&p>=l)return{node:d,offset:l-o};o=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Q1(d)}}function K1(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?K1(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function X1(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=Ff(o.document);l instanceof o.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)o=l.contentWindow;else break;l=Ff(o.document)}return l}function Ig(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var a4=Jo&&"documentMode"in document&&11>=document.documentMode,rc=null,zg=null,Iu=null,$g=!1;function J1(o,l,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;$g||rc==null||rc!==Ff(p)||(p=rc,"selectionStart"in p&&Ig(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Iu&&Lu(Iu,p)||(Iu=p,p=zh(zg,"onSelect"),0<p.length&&(l=new Qf("onSelect","select",null,l,d),o.push({event:l,listeners:p}),l.target=rc)))}function Vs(o,l){var d={};return d[o.toLowerCase()]=l.toLowerCase(),d["Webkit"+o]="webkit"+l,d["Moz"+o]="moz"+l,d}var ic={animationend:Vs("Animation","AnimationEnd"),animationiteration:Vs("Animation","AnimationIteration"),animationstart:Vs("Animation","AnimationStart"),transitionrun:Vs("Transition","TransitionRun"),transitionstart:Vs("Transition","TransitionStart"),transitioncancel:Vs("Transition","TransitionCancel"),transitionend:Vs("Transition","TransitionEnd")},Ug={},Z1={};Jo&&(Z1=document.createElement("div").style,"AnimationEvent"in window||(delete ic.animationend.animation,delete ic.animationiteration.animation,delete ic.animationstart.animation),"TransitionEvent"in window||delete ic.transitionend.transition);function Fs(o){if(Ug[o])return Ug[o];if(!ic[o])return o;var l=ic[o],d;for(d in l)if(l.hasOwnProperty(d)&&d in Z1)return Ug[o]=l[d];return o}var ej=Fs("animationend"),tj=Fs("animationiteration"),nj=Fs("animationstart"),s4=Fs("transitionrun"),l4=Fs("transitionstart"),c4=Fs("transitioncancel"),rj=Fs("transitionend"),ij=new Map,Bg="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Bg.push("scrollEnd");function Ji(o,l){ij.set(o,l),cr(l,[o])}var Xf=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},ji=[],oc=0,Vg=0;function Jf(){for(var o=oc,l=Vg=oc=0;l<o;){var d=ji[l];ji[l++]=null;var p=ji[l];ji[l++]=null;var b=ji[l];ji[l++]=null;var j=ji[l];if(ji[l++]=null,p!==null&&b!==null){var D=p.pending;D===null?b.next=b:(b.next=D.next,D.next=b),p.pending=b}j!==0&&oj(d,b,j)}}function Zf(o,l,d,p){ji[oc++]=o,ji[oc++]=l,ji[oc++]=d,ji[oc++]=p,Vg|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function Fg(o,l,d,p){return Zf(o,l,d,p),eh(o)}function Hs(o,l){return Zf(o,null,null,l),eh(o)}function oj(o,l,d){o.lanes|=d;var p=o.alternate;p!==null&&(p.lanes|=d);for(var b=!1,j=o.return;j!==null;)j.childLanes|=d,p=j.alternate,p!==null&&(p.childLanes|=d),j.tag===22&&(o=j.stateNode,o===null||o._visibility&1||(b=!0)),o=j,j=j.return;return o.tag===3?(j=o.stateNode,b&&l!==null&&(b=31-zn(d),o=j.hiddenUpdates,p=o[b],p===null?o[b]=[l]:p.push(l),l.lane=d|536870912),j):null}function eh(o){if(50<od)throw od=0,Jv=null,Error(r(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var ac={};function u4(o,l,d,p){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ai(o,l,d,p){return new u4(o,l,d,p)}function Hg(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Zo(o,l){var d=o.alternate;return d===null?(d=ai(o.tag,l,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=l,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&65011712,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,l=o.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d.refCleanup=o.refCleanup,d}function aj(o,l){o.flags&=65011714;var d=o.alternate;return d===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=d.childLanes,o.lanes=d.lanes,o.child=d.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=d.memoizedProps,o.memoizedState=d.memoizedState,o.updateQueue=d.updateQueue,o.type=d.type,l=d.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function th(o,l,d,p,b,j){var D=0;if(p=o,typeof o=="function")Hg(o)&&(D=1);else if(typeof o=="string")D=m3(o,d,de.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case z:return o=ai(31,d,l,b),o.elementType=z,o.lanes=j,o;case w:return qs(d.children,b,j,l);case C:D=8,b|=24;break;case T:return o=ai(12,d,l,b|2),o.elementType=T,o.lanes=j,o;case P:return o=ai(13,d,l,b),o.elementType=P,o.lanes=j,o;case O:return o=ai(19,d,l,b),o.elementType=O,o.lanes=j,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case E:D=10;break e;case R:D=9;break e;case _:D=11;break e;case k:D=14;break e;case A:D=16,p=null;break e}D=29,d=Error(r(130,o===null?"null":typeof o,"")),p=null}return l=ai(D,d,l,b),l.elementType=o,l.type=p,l.lanes=j,l}function qs(o,l,d,p){return o=ai(7,o,p,l),o.lanes=d,o}function qg(o,l,d){return o=ai(6,o,null,l),o.lanes=d,o}function sj(o){var l=ai(18,null,null,0);return l.stateNode=o,l}function Gg(o,l,d){return l=ai(4,o.children!==null?o.children:[],o.key,l),l.lanes=d,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var lj=new WeakMap;function wi(o,l){if(typeof o=="object"&&o!==null){var d=lj.get(o);return d!==void 0?d:(l={value:o,source:l,stack:Oe(l)},lj.set(o,l),l)}return{value:o,source:l,stack:Oe(l)}}var sc=[],lc=0,nh=null,zu=0,Ci=[],Ei=0,za=null,xo=1,bo="";function ea(o,l){sc[lc++]=zu,sc[lc++]=nh,nh=o,zu=l}function cj(o,l,d){Ci[Ei++]=xo,Ci[Ei++]=bo,Ci[Ei++]=za,za=o;var p=xo;o=bo;var b=32-zn(p)-1;p&=~(1<<b),d+=1;var j=32-zn(l)+b;if(30<j){var D=b-b%5;j=(p&(1<<D)-1).toString(32),p>>=D,b-=D,xo=1<<32-zn(l)+b|d<<b|p,bo=j+o}else xo=1<<j|d<<b|p,bo=o}function Wg(o){o.return!==null&&(ea(o,1),cj(o,1,0))}function Qg(o){for(;o===nh;)nh=sc[--lc],sc[lc]=null,zu=sc[--lc],sc[lc]=null;for(;o===za;)za=Ci[--Ei],Ci[Ei]=null,bo=Ci[--Ei],Ci[Ei]=null,xo=Ci[--Ei],Ci[Ei]=null}function uj(o,l){Ci[Ei++]=xo,Ci[Ei++]=bo,Ci[Ei++]=za,xo=l.id,bo=l.overflow,za=o}var br=null,Tn=null,zt=!1,$a=null,Ti=!1,Yg=Error(r(519));function Ua(o){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $u(wi(l,o)),Yg}function dj(o){var l=o.stateNode,d=o.type,p=o.memoizedProps;switch(l[Pe]=o,l[Ve]=p,d){case"dialog":Pt("cancel",l),Pt("close",l);break;case"iframe":case"object":case"embed":Pt("load",l);break;case"video":case"audio":for(d=0;d<sd.length;d++)Pt(sd[d],l);break;case"source":Pt("error",l);break;case"img":case"image":case"link":Pt("error",l),Pt("load",l);break;case"details":Pt("toggle",l);break;case"input":Pt("invalid",l),C1(l,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":Pt("invalid",l);break;case"textarea":Pt("invalid",l),T1(l,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||l.textContent===""+d||p.suppressHydrationWarning===!0||_C(l.textContent,d)?(p.popover!=null&&(Pt("beforetoggle",l),Pt("toggle",l)),p.onScroll!=null&&Pt("scroll",l),p.onScrollEnd!=null&&Pt("scrollend",l),p.onClick!=null&&(l.onclick=Xo),l=!0):l=!1,l||Ua(o,!0)}function fj(o){for(br=o.return;br;)switch(br.tag){case 5:case 31:case 13:Ti=!1;return;case 27:case 3:Ti=!0;return;default:br=br.return}}function cc(o){if(o!==br)return!1;if(!zt)return fj(o),zt=!0,!1;var l=o.tag,d;if((d=l!==3&&l!==27)&&((d=l===5)&&(d=o.type,d=!(d!=="form"&&d!=="button")||hy(o.type,o.memoizedProps)),d=!d),d&&Tn&&Ua(o),fj(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Tn=IC(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Tn=IC(o)}else l===27?(l=Tn,es(o.type)?(o=yy,yy=null,Tn=o):Tn=l):Tn=br?_i(o.stateNode.nextSibling):null;return!0}function Gs(){Tn=br=null,zt=!1}function Kg(){var o=$a;return o!==null&&(Yr===null?Yr=o:Yr.push.apply(Yr,o),$a=null),o}function $u(o){$a===null?$a=[o]:$a.push(o)}var Xg=M(null),Ws=null,ta=null;function Ba(o,l,d){ie(Xg,l._currentValue),l._currentValue=d}function na(o){o._currentValue=Xg.current,F(Xg)}function Jg(o,l,d){for(;o!==null;){var p=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,p!==null&&(p.childLanes|=l)):p!==null&&(p.childLanes&l)!==l&&(p.childLanes|=l),o===d)break;o=o.return}}function Zg(o,l,d,p){var b=o.child;for(b!==null&&(b.return=o);b!==null;){var j=b.dependencies;if(j!==null){var D=b.child;j=j.firstContext;e:for(;j!==null;){var N=j;j=b;for(var q=0;q<l.length;q++)if(N.context===l[q]){j.lanes|=d,N=j.alternate,N!==null&&(N.lanes|=d),Jg(j.return,d,o),p||(D=null);break e}j=N.next}}else if(b.tag===18){if(D=b.return,D===null)throw Error(r(341));D.lanes|=d,j=D.alternate,j!==null&&(j.lanes|=d),Jg(D,d,o),D=null}else D=b.child;if(D!==null)D.return=b;else for(D=b;D!==null;){if(D===o){D=null;break}if(b=D.sibling,b!==null){b.return=D.return,D=b;break}D=D.return}b=D}}function uc(o,l,d,p){o=null;for(var b=l,j=!1;b!==null;){if(!j){if((b.flags&524288)!==0)j=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var D=b.alternate;if(D===null)throw Error(r(387));if(D=D.memoizedProps,D!==null){var N=b.type;oi(b.pendingProps.value,D.value)||(o!==null?o.push(N):o=[N])}}else if(b===je.current){if(D=b.alternate,D===null)throw Error(r(387));D.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(o!==null?o.push(fd):o=[fd])}b=b.return}o!==null&&Zg(l,o,d,p),l.flags|=262144}function rh(o){for(o=o.firstContext;o!==null;){if(!oi(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Qs(o){Ws=o,ta=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Sr(o){return hj(Ws,o)}function ih(o,l){return Ws===null&&Qs(o),hj(o,l)}function hj(o,l){var d=l._currentValue;if(l={context:l,memoizedValue:d,next:null},ta===null){if(o===null)throw Error(r(308));ta=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else ta=ta.next=l;return d}var d4=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(d,p){o.push(p)}};this.abort=function(){l.aborted=!0,o.forEach(function(d){return d()})}},f4=e.unstable_scheduleCallback,h4=e.unstable_NormalPriority,Zn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ev(){return{controller:new d4,data:new Map,refCount:0}}function Uu(o){o.refCount--,o.refCount===0&&f4(h4,function(){o.controller.abort()})}var Bu=null,tv=0,dc=0,fc=null;function p4(o,l){if(Bu===null){var d=Bu=[];tv=0,dc=iy(),fc={status:"pending",value:void 0,then:function(p){d.push(p)}}}return tv++,l.then(pj,pj),l}function pj(){if(--tv===0&&Bu!==null){fc!==null&&(fc.status="fulfilled");var o=Bu;Bu=null,dc=0,fc=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function m4(o,l){var d=[],p={status:"pending",value:null,reason:null,then:function(b){d.push(b)}};return o.then(function(){p.status="fulfilled",p.value=l;for(var b=0;b<d.length;b++)(0,d[b])(l)},function(b){for(p.status="rejected",p.reason=b,b=0;b<d.length;b++)(0,d[b])(void 0)}),p}var mj=L.S;L.S=function(o,l){Jw=ft(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&p4(o,l),mj!==null&&mj(o,l)};var Ys=M(null);function nv(){var o=Ys.current;return o!==null?o:cn.pooledCache}function oh(o,l){l===null?ie(Ys,Ys.current):ie(Ys,l.pool)}function gj(){var o=nv();return o===null?null:{parent:Zn._currentValue,pool:o}}var hc=Error(r(460)),rv=Error(r(474)),ah=Error(r(542)),sh={then:function(){}};function vj(o){return o=o.status,o==="fulfilled"||o==="rejected"}function yj(o,l,d){switch(d=o[d],d===void 0?o.push(l):d!==l&&(l.then(Xo,Xo),l=d),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,bj(o),o;default:if(typeof l.status=="string")l.then(Xo,Xo);else{if(o=cn,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=l,o.status="pending",o.then(function(p){if(l.status==="pending"){var b=l;b.status="fulfilled",b.value=p}},function(p){if(l.status==="pending"){var b=l;b.status="rejected",b.reason=p}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,bj(o),o}throw Xs=l,hc}}function Ks(o){try{var l=o._init;return l(o._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Xs=d,hc):d}}var Xs=null;function xj(){if(Xs===null)throw Error(r(459));var o=Xs;return Xs=null,o}function bj(o){if(o===hc||o===ah)throw Error(r(483))}var pc=null,Vu=0;function lh(o){var l=Vu;return Vu+=1,pc===null&&(pc=[]),yj(pc,o,l)}function Fu(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function ch(o,l){throw l.$$typeof===y?Error(r(525)):(o=Object.prototype.toString.call(l),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function Sj(o){function l(J,Q){if(o){var te=J.deletions;te===null?(J.deletions=[Q],J.flags|=16):te.push(Q)}}function d(J,Q){if(!o)return null;for(;Q!==null;)l(J,Q),Q=Q.sibling;return null}function p(J){for(var Q=new Map;J!==null;)J.key!==null?Q.set(J.key,J):Q.set(J.index,J),J=J.sibling;return Q}function b(J,Q){return J=Zo(J,Q),J.index=0,J.sibling=null,J}function j(J,Q,te){return J.index=te,o?(te=J.alternate,te!==null?(te=te.index,te<Q?(J.flags|=67108866,Q):te):(J.flags|=67108866,Q)):(J.flags|=1048576,Q)}function D(J){return o&&J.alternate===null&&(J.flags|=67108866),J}function N(J,Q,te,me){return Q===null||Q.tag!==6?(Q=qg(te,J.mode,me),Q.return=J,Q):(Q=b(Q,te),Q.return=J,Q)}function q(J,Q,te,me){var it=te.type;return it===w?pe(J,Q,te.props.children,me,te.key):Q!==null&&(Q.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===A&&Ks(it)===Q.type)?(Q=b(Q,te.props),Fu(Q,te),Q.return=J,Q):(Q=th(te.type,te.key,te.props,null,J.mode,me),Fu(Q,te),Q.return=J,Q)}function ne(J,Q,te,me){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==te.containerInfo||Q.stateNode.implementation!==te.implementation?(Q=Gg(te,J.mode,me),Q.return=J,Q):(Q=b(Q,te.children||[]),Q.return=J,Q)}function pe(J,Q,te,me,it){return Q===null||Q.tag!==7?(Q=qs(te,J.mode,me,it),Q.return=J,Q):(Q=b(Q,te),Q.return=J,Q)}function ye(J,Q,te){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=qg(""+Q,J.mode,te),Q.return=J,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return te=th(Q.type,Q.key,Q.props,null,J.mode,te),Fu(te,Q),te.return=J,te;case S:return Q=Gg(Q,J.mode,te),Q.return=J,Q;case A:return Q=Ks(Q),ye(J,Q,te)}if(G(Q)||W(Q))return Q=qs(Q,J.mode,te,null),Q.return=J,Q;if(typeof Q.then=="function")return ye(J,lh(Q),te);if(Q.$$typeof===E)return ye(J,ih(J,Q),te);ch(J,Q)}return null}function se(J,Q,te,me){var it=Q!==null?Q.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return it!==null?null:N(J,Q,""+te,me);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case x:return te.key===it?q(J,Q,te,me):null;case S:return te.key===it?ne(J,Q,te,me):null;case A:return te=Ks(te),se(J,Q,te,me)}if(G(te)||W(te))return it!==null?null:pe(J,Q,te,me,null);if(typeof te.then=="function")return se(J,Q,lh(te),me);if(te.$$typeof===E)return se(J,Q,ih(J,te),me);ch(J,te)}return null}function ue(J,Q,te,me,it){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return J=J.get(te)||null,N(Q,J,""+me,it);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case x:return J=J.get(me.key===null?te:me.key)||null,q(Q,J,me,it);case S:return J=J.get(me.key===null?te:me.key)||null,ne(Q,J,me,it);case A:return me=Ks(me),ue(J,Q,te,me,it)}if(G(me)||W(me))return J=J.get(te)||null,pe(Q,J,me,it,null);if(typeof me.then=="function")return ue(J,Q,te,lh(me),it);if(me.$$typeof===E)return ue(J,Q,te,ih(Q,me),it);ch(Q,me)}return null}function Qe(J,Q,te,me){for(var it=null,qt=null,Xe=Q,St=Q=0,Lt=null;Xe!==null&&St<te.length;St++){Xe.index>St?(Lt=Xe,Xe=null):Lt=Xe.sibling;var Gt=se(J,Xe,te[St],me);if(Gt===null){Xe===null&&(Xe=Lt);break}o&&Xe&&Gt.alternate===null&&l(J,Xe),Q=j(Gt,Q,St),qt===null?it=Gt:qt.sibling=Gt,qt=Gt,Xe=Lt}if(St===te.length)return d(J,Xe),zt&&ea(J,St),it;if(Xe===null){for(;St<te.length;St++)Xe=ye(J,te[St],me),Xe!==null&&(Q=j(Xe,Q,St),qt===null?it=Xe:qt.sibling=Xe,qt=Xe);return zt&&ea(J,St),it}for(Xe=p(Xe);St<te.length;St++)Lt=ue(Xe,J,St,te[St],me),Lt!==null&&(o&&Lt.alternate!==null&&Xe.delete(Lt.key===null?St:Lt.key),Q=j(Lt,Q,St),qt===null?it=Lt:qt.sibling=Lt,qt=Lt);return o&&Xe.forEach(function(os){return l(J,os)}),zt&&ea(J,St),it}function st(J,Q,te,me){if(te==null)throw Error(r(151));for(var it=null,qt=null,Xe=Q,St=Q=0,Lt=null,Gt=te.next();Xe!==null&&!Gt.done;St++,Gt=te.next()){Xe.index>St?(Lt=Xe,Xe=null):Lt=Xe.sibling;var os=se(J,Xe,Gt.value,me);if(os===null){Xe===null&&(Xe=Lt);break}o&&Xe&&os.alternate===null&&l(J,Xe),Q=j(os,Q,St),qt===null?it=os:qt.sibling=os,qt=os,Xe=Lt}if(Gt.done)return d(J,Xe),zt&&ea(J,St),it;if(Xe===null){for(;!Gt.done;St++,Gt=te.next())Gt=ye(J,Gt.value,me),Gt!==null&&(Q=j(Gt,Q,St),qt===null?it=Gt:qt.sibling=Gt,qt=Gt);return zt&&ea(J,St),it}for(Xe=p(Xe);!Gt.done;St++,Gt=te.next())Gt=ue(Xe,J,St,Gt.value,me),Gt!==null&&(o&&Gt.alternate!==null&&Xe.delete(Gt.key===null?St:Gt.key),Q=j(Gt,Q,St),qt===null?it=Gt:qt.sibling=Gt,qt=Gt);return o&&Xe.forEach(function(T3){return l(J,T3)}),zt&&ea(J,St),it}function sn(J,Q,te,me){if(typeof te=="object"&&te!==null&&te.type===w&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case x:e:{for(var it=te.key;Q!==null;){if(Q.key===it){if(it=te.type,it===w){if(Q.tag===7){d(J,Q.sibling),me=b(Q,te.props.children),me.return=J,J=me;break e}}else if(Q.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===A&&Ks(it)===Q.type){d(J,Q.sibling),me=b(Q,te.props),Fu(me,te),me.return=J,J=me;break e}d(J,Q);break}else l(J,Q);Q=Q.sibling}te.type===w?(me=qs(te.props.children,J.mode,me,te.key),me.return=J,J=me):(me=th(te.type,te.key,te.props,null,J.mode,me),Fu(me,te),me.return=J,J=me)}return D(J);case S:e:{for(it=te.key;Q!==null;){if(Q.key===it)if(Q.tag===4&&Q.stateNode.containerInfo===te.containerInfo&&Q.stateNode.implementation===te.implementation){d(J,Q.sibling),me=b(Q,te.children||[]),me.return=J,J=me;break e}else{d(J,Q);break}else l(J,Q);Q=Q.sibling}me=Gg(te,J.mode,me),me.return=J,J=me}return D(J);case A:return te=Ks(te),sn(J,Q,te,me)}if(G(te))return Qe(J,Q,te,me);if(W(te)){if(it=W(te),typeof it!="function")throw Error(r(150));return te=it.call(te),st(J,Q,te,me)}if(typeof te.then=="function")return sn(J,Q,lh(te),me);if(te.$$typeof===E)return sn(J,Q,ih(J,te),me);ch(J,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Q!==null&&Q.tag===6?(d(J,Q.sibling),me=b(Q,te),me.return=J,J=me):(d(J,Q),me=qg(te,J.mode,me),me.return=J,J=me),D(J)):d(J,Q)}return function(J,Q,te,me){try{Vu=0;var it=sn(J,Q,te,me);return pc=null,it}catch(Xe){if(Xe===hc||Xe===ah)throw Xe;var qt=ai(29,Xe,null,J.mode);return qt.lanes=me,qt.return=J,qt}}}var Js=Sj(!0),jj=Sj(!1),Va=!1;function iv(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ov(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Fa(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ha(o,l,d){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(Qt&2)!==0){var b=p.pending;return b===null?l.next=l:(l.next=b.next,b.next=l),p.pending=l,l=eh(o),oj(o,null,d),l}return Zf(o,p,l,d),eh(o)}function Hu(o,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194048)!==0)){var p=l.lanes;p&=o.pendingLanes,d|=p,l.lanes=d,Ql(o,d)}}function av(o,l){var d=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var b=null,j=null;if(d=d.firstBaseUpdate,d!==null){do{var D={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};j===null?b=j=D:j=j.next=D,d=d.next}while(d!==null);j===null?b=j=l:j=j.next=l}else b=j=l;d={baseState:p.baseState,firstBaseUpdate:b,lastBaseUpdate:j,shared:p.shared,callbacks:p.callbacks},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=l:o.next=l,d.lastBaseUpdate=l}var sv=!1;function qu(){if(sv){var o=fc;if(o!==null)throw o}}function Gu(o,l,d,p){sv=!1;var b=o.updateQueue;Va=!1;var j=b.firstBaseUpdate,D=b.lastBaseUpdate,N=b.shared.pending;if(N!==null){b.shared.pending=null;var q=N,ne=q.next;q.next=null,D===null?j=ne:D.next=ne,D=q;var pe=o.alternate;pe!==null&&(pe=pe.updateQueue,N=pe.lastBaseUpdate,N!==D&&(N===null?pe.firstBaseUpdate=ne:N.next=ne,pe.lastBaseUpdate=q))}if(j!==null){var ye=b.baseState;D=0,pe=ne=q=null,N=j;do{var se=N.lane&-536870913,ue=se!==N.lane;if(ue?(Mt&se)===se:(p&se)===se){se!==0&&se===dc&&(sv=!0),pe!==null&&(pe=pe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Qe=o,st=N;se=l;var sn=d;switch(st.tag){case 1:if(Qe=st.payload,typeof Qe=="function"){ye=Qe.call(sn,ye,se);break e}ye=Qe;break e;case 3:Qe.flags=Qe.flags&-65537|128;case 0:if(Qe=st.payload,se=typeof Qe=="function"?Qe.call(sn,ye,se):Qe,se==null)break e;ye=g({},ye,se);break e;case 2:Va=!0}}se=N.callback,se!==null&&(o.flags|=64,ue&&(o.flags|=8192),ue=b.callbacks,ue===null?b.callbacks=[se]:ue.push(se))}else ue={lane:se,tag:N.tag,payload:N.payload,callback:N.callback,next:null},pe===null?(ne=pe=ue,q=ye):pe=pe.next=ue,D|=se;if(N=N.next,N===null){if(N=b.shared.pending,N===null)break;ue=N,N=ue.next,ue.next=null,b.lastBaseUpdate=ue,b.shared.pending=null}}while(!0);pe===null&&(q=ye),b.baseState=q,b.firstBaseUpdate=ne,b.lastBaseUpdate=pe,j===null&&(b.shared.lanes=0),Ya|=D,o.lanes=D,o.memoizedState=ye}}function wj(o,l){if(typeof o!="function")throw Error(r(191,o));o.call(l)}function Cj(o,l){var d=o.callbacks;if(d!==null)for(o.callbacks=null,o=0;o<d.length;o++)wj(d[o],l)}var mc=M(null),uh=M(0);function Ej(o,l){o=da,ie(uh,o),ie(mc,l),da=o|l.baseLanes}function lv(){ie(uh,da),ie(mc,mc.current)}function cv(){da=uh.current,F(mc),F(uh)}var si=M(null),Ri=null;function qa(o){var l=o.alternate;ie(Wn,Wn.current&1),ie(si,o),Ri===null&&(l===null||mc.current!==null||l.memoizedState!==null)&&(Ri=o)}function uv(o){ie(Wn,Wn.current),ie(si,o),Ri===null&&(Ri=o)}function Tj(o){o.tag===22?(ie(Wn,Wn.current),ie(si,o),Ri===null&&(Ri=o)):Ga()}function Ga(){ie(Wn,Wn.current),ie(si,si.current)}function li(o){F(si),Ri===o&&(Ri=null),F(Wn)}var Wn=M(0);function dh(o){for(var l=o;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||gy(d)||vy(d)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ra=0,xt=null,on=null,er=null,fh=!1,gc=!1,Zs=!1,hh=0,Wu=0,vc=null,g4=0;function $n(){throw Error(r(321))}function dv(o,l){if(l===null)return!1;for(var d=0;d<l.length&&d<o.length;d++)if(!oi(o[d],l[d]))return!1;return!0}function fv(o,l,d,p,b,j){return ra=j,xt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,L.H=o===null||o.memoizedState===null?cw:Rv,Zs=!1,j=d(p,b),Zs=!1,gc&&(j=_j(l,d,p,b)),Rj(o),j}function Rj(o){L.H=Ku;var l=on!==null&&on.next!==null;if(ra=0,er=on=xt=null,fh=!1,Wu=0,vc=null,l)throw Error(r(300));o===null||tr||(o=o.dependencies,o!==null&&rh(o)&&(tr=!0))}function _j(o,l,d,p){xt=o;var b=0;do{if(gc&&(vc=null),Wu=0,gc=!1,25<=b)throw Error(r(301));if(b+=1,er=on=null,o.updateQueue!=null){var j=o.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}L.H=uw,j=l(d,p)}while(gc);return j}function v4(){var o=L.H,l=o.useState()[0];return l=typeof l.then=="function"?Qu(l):l,o=o.useState()[0],(on!==null?on.memoizedState:null)!==o&&(xt.flags|=1024),l}function hv(){var o=hh!==0;return hh=0,o}function pv(o,l,d){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~d}function mv(o){if(fh){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}fh=!1}ra=0,er=on=xt=null,gc=!1,Wu=hh=0,vc=null}function Lr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return er===null?xt.memoizedState=er=o:er=er.next=o,er}function Qn(){if(on===null){var o=xt.alternate;o=o!==null?o.memoizedState:null}else o=on.next;var l=er===null?xt.memoizedState:er.next;if(l!==null)er=l,on=o;else{if(o===null)throw xt.alternate===null?Error(r(467)):Error(r(310));on=o,o={memoizedState:on.memoizedState,baseState:on.baseState,baseQueue:on.baseQueue,queue:on.queue,next:null},er===null?xt.memoizedState=er=o:er=er.next=o}return er}function ph(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qu(o){var l=Wu;return Wu+=1,vc===null&&(vc=[]),o=yj(vc,o,l),l=xt,(er===null?l.memoizedState:er.next)===null&&(l=l.alternate,L.H=l===null||l.memoizedState===null?cw:Rv),o}function mh(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Qu(o);if(o.$$typeof===E)return Sr(o)}throw Error(r(438,String(o)))}function gv(o){var l=null,d=xt.updateQueue;if(d!==null&&(l=d.memoCache),l==null){var p=xt.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(l={data:p.data.map(function(b){return b.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),d===null&&(d=ph(),xt.updateQueue=d),d.memoCache=l,d=l.data[l.index],d===void 0)for(d=l.data[l.index]=Array(o),p=0;p<o;p++)d[p]=U;return l.index++,d}function ia(o,l){return typeof l=="function"?l(o):l}function gh(o){var l=Qn();return vv(l,on,o)}function vv(o,l,d){var p=o.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var b=o.baseQueue,j=p.pending;if(j!==null){if(b!==null){var D=b.next;b.next=j.next,j.next=D}l.baseQueue=b=j,p.pending=null}if(j=o.baseState,b===null)o.memoizedState=j;else{l=b.next;var N=D=null,q=null,ne=l,pe=!1;do{var ye=ne.lane&-536870913;if(ye!==ne.lane?(Mt&ye)===ye:(ra&ye)===ye){var se=ne.revertLane;if(se===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ye===dc&&(pe=!0);else if((ra&se)===se){ne=ne.next,se===dc&&(pe=!0);continue}else ye={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},q===null?(N=q=ye,D=j):q=q.next=ye,xt.lanes|=se,Ya|=se;ye=ne.action,Zs&&d(j,ye),j=ne.hasEagerState?ne.eagerState:d(j,ye)}else se={lane:ye,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},q===null?(N=q=se,D=j):q=q.next=se,xt.lanes|=ye,Ya|=ye;ne=ne.next}while(ne!==null&&ne!==l);if(q===null?D=j:q.next=N,!oi(j,o.memoizedState)&&(tr=!0,pe&&(d=fc,d!==null)))throw d;o.memoizedState=j,o.baseState=D,o.baseQueue=q,p.lastRenderedState=j}return b===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function yv(o){var l=Qn(),d=l.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var p=d.dispatch,b=d.pending,j=l.memoizedState;if(b!==null){d.pending=null;var D=b=b.next;do j=o(j,D.action),D=D.next;while(D!==b);oi(j,l.memoizedState)||(tr=!0),l.memoizedState=j,l.baseQueue===null&&(l.baseState=j),d.lastRenderedState=j}return[j,p]}function Dj(o,l,d){var p=xt,b=Qn(),j=zt;if(j){if(d===void 0)throw Error(r(407));d=d()}else d=l();var D=!oi((on||b).memoizedState,d);if(D&&(b.memoizedState=d,tr=!0),b=b.queue,Sv(Pj.bind(null,p,b,o),[o]),b.getSnapshot!==l||D||er!==null&&er.memoizedState.tag&1){if(p.flags|=2048,yc(9,{destroy:void 0},kj.bind(null,p,b,d,l),null),cn===null)throw Error(r(349));j||(ra&127)!==0||Aj(p,l,d)}return d}function Aj(o,l,d){o.flags|=16384,o={getSnapshot:l,value:d},l=xt.updateQueue,l===null?(l=ph(),xt.updateQueue=l,l.stores=[o]):(d=l.stores,d===null?l.stores=[o]:d.push(o))}function kj(o,l,d,p){l.value=d,l.getSnapshot=p,Nj(l)&&Oj(o)}function Pj(o,l,d){return d(function(){Nj(l)&&Oj(o)})}function Nj(o){var l=o.getSnapshot;o=o.value;try{var d=l();return!oi(o,d)}catch{return!0}}function Oj(o){var l=Hs(o,2);l!==null&&Kr(l,o,2)}function xv(o){var l=Lr();if(typeof o=="function"){var d=o;if(o=d(),Zs){wn(!0);try{d()}finally{wn(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:o},l}function Mj(o,l,d,p){return o.baseState=d,vv(o,on,typeof p=="function"?p:ia)}function y4(o,l,d,p,b){if(xh(o))throw Error(r(485));if(o=l.action,o!==null){var j={payload:b,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){j.listeners.push(D)}};L.T!==null?d(!0):j.isTransition=!1,p(j),d=l.pending,d===null?(j.next=l.pending=j,Lj(l,j)):(j.next=d.next,l.pending=d.next=j)}}function Lj(o,l){var d=l.action,p=l.payload,b=o.state;if(l.isTransition){var j=L.T,D={};L.T=D;try{var N=d(b,p),q=L.S;q!==null&&q(D,N),Ij(o,l,N)}catch(ne){bv(o,l,ne)}finally{j!==null&&D.types!==null&&(j.types=D.types),L.T=j}}else try{j=d(b,p),Ij(o,l,j)}catch(ne){bv(o,l,ne)}}function Ij(o,l,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){zj(o,l,p)},function(p){return bv(o,l,p)}):zj(o,l,d)}function zj(o,l,d){l.status="fulfilled",l.value=d,$j(l),o.state=d,l=o.pending,l!==null&&(d=l.next,d===l?o.pending=null:(d=d.next,l.next=d,Lj(o,d)))}function bv(o,l,d){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do l.status="rejected",l.reason=d,$j(l),l=l.next;while(l!==p)}o.action=null}function $j(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function Uj(o,l){return l}function Bj(o,l){if(zt){var d=cn.formState;if(d!==null){e:{var p=xt;if(zt){if(Tn){t:{for(var b=Tn,j=Ti;b.nodeType!==8;){if(!j){b=null;break t}if(b=_i(b.nextSibling),b===null){b=null;break t}}j=b.data,b=j==="F!"||j==="F"?b:null}if(b){Tn=_i(b.nextSibling),p=b.data==="F!";break e}}Ua(p)}p=!1}p&&(l=d[0])}}return d=Lr(),d.memoizedState=d.baseState=l,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Uj,lastRenderedState:l},d.queue=p,d=aw.bind(null,xt,p),p.dispatch=d,p=xv(!1),j=Tv.bind(null,xt,!1,p.queue),p=Lr(),b={state:l,dispatch:null,action:o,pending:null},p.queue=b,d=y4.bind(null,xt,b,j,d),b.dispatch=d,p.memoizedState=o,[l,d,!1]}function Vj(o){var l=Qn();return Fj(l,on,o)}function Fj(o,l,d){if(l=vv(o,l,Uj)[0],o=gh(ia)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var p=Qu(l)}catch(D){throw D===hc?ah:D}else p=l;l=Qn();var b=l.queue,j=b.dispatch;return d!==l.memoizedState&&(xt.flags|=2048,yc(9,{destroy:void 0},x4.bind(null,b,d),null)),[p,j,o]}function x4(o,l){o.action=l}function Hj(o){var l=Qn(),d=on;if(d!==null)return Fj(l,d,o);Qn(),l=l.memoizedState,d=Qn();var p=d.queue.dispatch;return d.memoizedState=o,[l,p,!1]}function yc(o,l,d,p){return o={tag:o,create:d,deps:p,inst:l,next:null},l=xt.updateQueue,l===null&&(l=ph(),xt.updateQueue=l),d=l.lastEffect,d===null?l.lastEffect=o.next=o:(p=d.next,d.next=o,o.next=p,l.lastEffect=o),o}function qj(){return Qn().memoizedState}function vh(o,l,d,p){var b=Lr();xt.flags|=o,b.memoizedState=yc(1|l,{destroy:void 0},d,p===void 0?null:p)}function yh(o,l,d,p){var b=Qn();p=p===void 0?null:p;var j=b.memoizedState.inst;on!==null&&p!==null&&dv(p,on.memoizedState.deps)?b.memoizedState=yc(l,j,d,p):(xt.flags|=o,b.memoizedState=yc(1|l,j,d,p))}function Gj(o,l){vh(8390656,8,o,l)}function Sv(o,l){yh(2048,8,o,l)}function b4(o){xt.flags|=4;var l=xt.updateQueue;if(l===null)l=ph(),xt.updateQueue=l,l.events=[o];else{var d=l.events;d===null?l.events=[o]:d.push(o)}}function Wj(o){var l=Qn().memoizedState;return b4({ref:l,nextImpl:o}),function(){if((Qt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function Qj(o,l){return yh(4,2,o,l)}function Yj(o,l){return yh(4,4,o,l)}function Kj(o,l){if(typeof l=="function"){o=o();var d=l(o);return function(){typeof d=="function"?d():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Xj(o,l,d){d=d!=null?d.concat([o]):null,yh(4,4,Kj.bind(null,l,o),d)}function jv(){}function Jj(o,l){var d=Qn();l=l===void 0?null:l;var p=d.memoizedState;return l!==null&&dv(l,p[1])?p[0]:(d.memoizedState=[o,l],o)}function Zj(o,l){var d=Qn();l=l===void 0?null:l;var p=d.memoizedState;if(l!==null&&dv(l,p[1]))return p[0];if(p=o(),Zs){wn(!0);try{o()}finally{wn(!1)}}return d.memoizedState=[p,l],p}function wv(o,l,d){return d===void 0||(ra&1073741824)!==0&&(Mt&261930)===0?o.memoizedState=l:(o.memoizedState=d,o=eC(),xt.lanes|=o,Ya|=o,d)}function ew(o,l,d,p){return oi(d,l)?d:mc.current!==null?(o=wv(o,d,p),oi(o,l)||(tr=!0),o):(ra&42)===0||(ra&1073741824)!==0&&(Mt&261930)===0?(tr=!0,o.memoizedState=d):(o=eC(),xt.lanes|=o,Ya|=o,l)}function tw(o,l,d,p,b){var j=I.p;I.p=j!==0&&8>j?j:8;var D=L.T,N={};L.T=N,Tv(o,!1,l,d);try{var q=b(),ne=L.S;if(ne!==null&&ne(N,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var pe=m4(q,p);Yu(o,l,pe,di(o))}else Yu(o,l,p,di(o))}catch(ye){Yu(o,l,{then:function(){},status:"rejected",reason:ye},di())}finally{I.p=j,D!==null&&N.types!==null&&(D.types=N.types),L.T=D}}function S4(){}function Cv(o,l,d,p){if(o.tag!==5)throw Error(r(476));var b=nw(o).queue;tw(o,b,l,$,d===null?S4:function(){return rw(o),d(p)})}function nw(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:$},next:null};var d={};return l.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:d},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function rw(o){var l=nw(o);l.next===null&&(l=o.alternate.memoizedState),Yu(o,l.next.queue,{},di())}function Ev(){return Sr(fd)}function iw(){return Qn().memoizedState}function ow(){return Qn().memoizedState}function j4(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var d=di();o=Fa(d);var p=Ha(l,o,d);p!==null&&(Kr(p,l,d),Hu(p,l,d)),l={cache:ev()},o.payload=l;return}l=l.return}}function w4(o,l,d){var p=di();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},xh(o)?sw(l,d):(d=Fg(o,l,d,p),d!==null&&(Kr(d,o,p),lw(d,l,p)))}function aw(o,l,d){var p=di();Yu(o,l,d,p)}function Yu(o,l,d,p){var b={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(xh(o))sw(l,b);else{var j=o.alternate;if(o.lanes===0&&(j===null||j.lanes===0)&&(j=l.lastRenderedReducer,j!==null))try{var D=l.lastRenderedState,N=j(D,d);if(b.hasEagerState=!0,b.eagerState=N,oi(N,D))return Zf(o,l,b,0),cn===null&&Jf(),!1}catch{}if(d=Fg(o,l,b,p),d!==null)return Kr(d,o,p),lw(d,l,p),!0}return!1}function Tv(o,l,d,p){if(p={lane:2,revertLane:iy(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},xh(o)){if(l)throw Error(r(479))}else l=Fg(o,d,p,2),l!==null&&Kr(l,o,2)}function xh(o){var l=o.alternate;return o===xt||l!==null&&l===xt}function sw(o,l){gc=fh=!0;var d=o.pending;d===null?l.next=l:(l.next=d.next,d.next=l),o.pending=l}function lw(o,l,d){if((d&4194048)!==0){var p=l.lanes;p&=o.pendingLanes,d|=p,l.lanes=d,Ql(o,d)}}var Ku={readContext:Sr,use:mh,useCallback:$n,useContext:$n,useEffect:$n,useImperativeHandle:$n,useLayoutEffect:$n,useInsertionEffect:$n,useMemo:$n,useReducer:$n,useRef:$n,useState:$n,useDebugValue:$n,useDeferredValue:$n,useTransition:$n,useSyncExternalStore:$n,useId:$n,useHostTransitionStatus:$n,useFormState:$n,useActionState:$n,useOptimistic:$n,useMemoCache:$n,useCacheRefresh:$n};Ku.useEffectEvent=$n;var cw={readContext:Sr,use:mh,useCallback:function(o,l){return Lr().memoizedState=[o,l===void 0?null:l],o},useContext:Sr,useEffect:Gj,useImperativeHandle:function(o,l,d){d=d!=null?d.concat([o]):null,vh(4194308,4,Kj.bind(null,l,o),d)},useLayoutEffect:function(o,l){return vh(4194308,4,o,l)},useInsertionEffect:function(o,l){vh(4,2,o,l)},useMemo:function(o,l){var d=Lr();l=l===void 0?null:l;var p=o();if(Zs){wn(!0);try{o()}finally{wn(!1)}}return d.memoizedState=[p,l],p},useReducer:function(o,l,d){var p=Lr();if(d!==void 0){var b=d(l);if(Zs){wn(!0);try{d(l)}finally{wn(!1)}}}else b=l;return p.memoizedState=p.baseState=b,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:b},p.queue=o,o=o.dispatch=w4.bind(null,xt,o),[p.memoizedState,o]},useRef:function(o){var l=Lr();return o={current:o},l.memoizedState=o},useState:function(o){o=xv(o);var l=o.queue,d=aw.bind(null,xt,l);return l.dispatch=d,[o.memoizedState,d]},useDebugValue:jv,useDeferredValue:function(o,l){var d=Lr();return wv(d,o,l)},useTransition:function(){var o=xv(!1);return o=tw.bind(null,xt,o.queue,!0,!1),Lr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,d){var p=xt,b=Lr();if(zt){if(d===void 0)throw Error(r(407));d=d()}else{if(d=l(),cn===null)throw Error(r(349));(Mt&127)!==0||Aj(p,l,d)}b.memoizedState=d;var j={value:d,getSnapshot:l};return b.queue=j,Gj(Pj.bind(null,p,j,o),[o]),p.flags|=2048,yc(9,{destroy:void 0},kj.bind(null,p,j,d,l),null),d},useId:function(){var o=Lr(),l=cn.identifierPrefix;if(zt){var d=bo,p=xo;d=(p&~(1<<32-zn(p)-1)).toString(32)+d,l="_"+l+"R_"+d,d=hh++,0<d&&(l+="H"+d.toString(32)),l+="_"}else d=g4++,l="_"+l+"r_"+d.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:Ev,useFormState:Bj,useActionState:Bj,useOptimistic:function(o){var l=Lr();l.memoizedState=l.baseState=o;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=d,l=Tv.bind(null,xt,!0,d),d.dispatch=l,[o,l]},useMemoCache:gv,useCacheRefresh:function(){return Lr().memoizedState=j4.bind(null,xt)},useEffectEvent:function(o){var l=Lr(),d={impl:o};return l.memoizedState=d,function(){if((Qt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},Rv={readContext:Sr,use:mh,useCallback:Jj,useContext:Sr,useEffect:Sv,useImperativeHandle:Xj,useInsertionEffect:Qj,useLayoutEffect:Yj,useMemo:Zj,useReducer:gh,useRef:qj,useState:function(){return gh(ia)},useDebugValue:jv,useDeferredValue:function(o,l){var d=Qn();return ew(d,on.memoizedState,o,l)},useTransition:function(){var o=gh(ia)[0],l=Qn().memoizedState;return[typeof o=="boolean"?o:Qu(o),l]},useSyncExternalStore:Dj,useId:iw,useHostTransitionStatus:Ev,useFormState:Vj,useActionState:Vj,useOptimistic:function(o,l){var d=Qn();return Mj(d,on,o,l)},useMemoCache:gv,useCacheRefresh:ow};Rv.useEffectEvent=Wj;var uw={readContext:Sr,use:mh,useCallback:Jj,useContext:Sr,useEffect:Sv,useImperativeHandle:Xj,useInsertionEffect:Qj,useLayoutEffect:Yj,useMemo:Zj,useReducer:yv,useRef:qj,useState:function(){return yv(ia)},useDebugValue:jv,useDeferredValue:function(o,l){var d=Qn();return on===null?wv(d,o,l):ew(d,on.memoizedState,o,l)},useTransition:function(){var o=yv(ia)[0],l=Qn().memoizedState;return[typeof o=="boolean"?o:Qu(o),l]},useSyncExternalStore:Dj,useId:iw,useHostTransitionStatus:Ev,useFormState:Hj,useActionState:Hj,useOptimistic:function(o,l){var d=Qn();return on!==null?Mj(d,on,o,l):(d.baseState=o,[o,d.queue.dispatch])},useMemoCache:gv,useCacheRefresh:ow};uw.useEffectEvent=Wj;function _v(o,l,d,p){l=o.memoizedState,d=d(p,l),d=d==null?l:g({},l,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Dv={enqueueSetState:function(o,l,d){o=o._reactInternals;var p=di(),b=Fa(p);b.payload=l,d!=null&&(b.callback=d),l=Ha(o,b,p),l!==null&&(Kr(l,o,p),Hu(l,o,p))},enqueueReplaceState:function(o,l,d){o=o._reactInternals;var p=di(),b=Fa(p);b.tag=1,b.payload=l,d!=null&&(b.callback=d),l=Ha(o,b,p),l!==null&&(Kr(l,o,p),Hu(l,o,p))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var d=di(),p=Fa(d);p.tag=2,l!=null&&(p.callback=l),l=Ha(o,p,d),l!==null&&(Kr(l,o,d),Hu(l,o,d))}};function dw(o,l,d,p,b,j,D){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,j,D):l.prototype&&l.prototype.isPureReactComponent?!Lu(d,p)||!Lu(b,j):!0}function fw(o,l,d,p){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,p),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,p),l.state!==o&&Dv.enqueueReplaceState(l,l.state,null)}function el(o,l){var d=l;if("ref"in l){d={};for(var p in l)p!=="ref"&&(d[p]=l[p])}if(o=o.defaultProps){d===l&&(d=g({},d));for(var b in o)d[b]===void 0&&(d[b]=o[b])}return d}function hw(o){Xf(o)}function pw(o){console.error(o)}function mw(o){Xf(o)}function bh(o,l){try{var d=o.onUncaughtError;d(l.value,{componentStack:l.stack})}catch(p){setTimeout(function(){throw p})}}function gw(o,l,d){try{var p=o.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Av(o,l,d){return d=Fa(d),d.tag=3,d.payload={element:null},d.callback=function(){bh(o,l)},d}function vw(o){return o=Fa(o),o.tag=3,o}function yw(o,l,d,p){var b=d.type.getDerivedStateFromError;if(typeof b=="function"){var j=p.value;o.payload=function(){return b(j)},o.callback=function(){gw(l,d,p)}}var D=d.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(o.callback=function(){gw(l,d,p),typeof b!="function"&&(Ka===null?Ka=new Set([this]):Ka.add(this));var N=p.stack;this.componentDidCatch(p.value,{componentStack:N!==null?N:""})})}function C4(o,l,d,p,b){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(l=d.alternate,l!==null&&uc(l,d,b,!0),d=si.current,d!==null){switch(d.tag){case 31:case 13:return Ri===null?Ph():d.alternate===null&&Un===0&&(Un=3),d.flags&=-257,d.flags|=65536,d.lanes=b,p===sh?d.flags|=16384:(l=d.updateQueue,l===null?d.updateQueue=new Set([p]):l.add(p),ty(o,p,b)),!1;case 22:return d.flags|=65536,p===sh?d.flags|=16384:(l=d.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=l):(d=l.retryQueue,d===null?l.retryQueue=new Set([p]):d.add(p)),ty(o,p,b)),!1}throw Error(r(435,d.tag))}return ty(o,p,b),Ph(),!1}if(zt)return l=si.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,p!==Yg&&(o=Error(r(422),{cause:p}),$u(wi(o,d)))):(p!==Yg&&(l=Error(r(423),{cause:p}),$u(wi(l,d))),o=o.current.alternate,o.flags|=65536,b&=-b,o.lanes|=b,p=wi(p,d),b=Av(o.stateNode,p,b),av(o,b),Un!==4&&(Un=2)),!1;var j=Error(r(520),{cause:p});if(j=wi(j,d),id===null?id=[j]:id.push(j),Un!==4&&(Un=2),l===null)return!0;p=wi(p,d),d=l;do{switch(d.tag){case 3:return d.flags|=65536,o=b&-b,d.lanes|=o,o=Av(d.stateNode,p,o),av(d,o),!1;case 1:if(l=d.type,j=d.stateNode,(d.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(Ka===null||!Ka.has(j))))return d.flags|=65536,b&=-b,d.lanes|=b,b=vw(b),yw(b,o,d,p),av(d,b),!1}d=d.return}while(d!==null);return!1}var kv=Error(r(461)),tr=!1;function jr(o,l,d,p){l.child=o===null?jj(l,null,d,p):Js(l,o.child,d,p)}function xw(o,l,d,p,b){d=d.render;var j=l.ref;if("ref"in p){var D={};for(var N in p)N!=="ref"&&(D[N]=p[N])}else D=p;return Qs(l),p=fv(o,l,d,D,j,b),N=hv(),o!==null&&!tr?(pv(o,l,b),oa(o,l,b)):(zt&&N&&Wg(l),l.flags|=1,jr(o,l,p,b),l.child)}function bw(o,l,d,p,b){if(o===null){var j=d.type;return typeof j=="function"&&!Hg(j)&&j.defaultProps===void 0&&d.compare===null?(l.tag=15,l.type=j,Sw(o,l,j,p,b)):(o=th(d.type,null,p,l,l.mode,b),o.ref=l.ref,o.return=l,l.child=o)}if(j=o.child,!$v(o,b)){var D=j.memoizedProps;if(d=d.compare,d=d!==null?d:Lu,d(D,p)&&o.ref===l.ref)return oa(o,l,b)}return l.flags|=1,o=Zo(j,p),o.ref=l.ref,o.return=l,l.child=o}function Sw(o,l,d,p,b){if(o!==null){var j=o.memoizedProps;if(Lu(j,p)&&o.ref===l.ref)if(tr=!1,l.pendingProps=p=j,$v(o,b))(o.flags&131072)!==0&&(tr=!0);else return l.lanes=o.lanes,oa(o,l,b)}return Pv(o,l,d,p,b)}function jw(o,l,d,p){var b=p.children,j=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((l.flags&128)!==0){if(j=j!==null?j.baseLanes|d:d,o!==null){for(p=l.child=o.child,b=0;p!==null;)b=b|p.lanes|p.childLanes,p=p.sibling;p=b&~j}else p=0,l.child=null;return ww(o,l,j,d,p)}if((d&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&oh(l,j!==null?j.cachePool:null),j!==null?Ej(l,j):lv(),Tj(l);else return p=l.lanes=536870912,ww(o,l,j!==null?j.baseLanes|d:d,d,p)}else j!==null?(oh(l,j.cachePool),Ej(l,j),Ga(),l.memoizedState=null):(o!==null&&oh(l,null),lv(),Ga());return jr(o,l,b,d),l.child}function Xu(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function ww(o,l,d,p,b){var j=nv();return j=j===null?null:{parent:Zn._currentValue,pool:j},l.memoizedState={baseLanes:d,cachePool:j},o!==null&&oh(l,null),lv(),Tj(l),o!==null&&uc(o,l,p,!0),l.childLanes=b,null}function Sh(o,l){return l=wh({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function Cw(o,l,d){return Js(l,o.child,null,d),o=Sh(l,l.pendingProps),o.flags|=2,li(l),l.memoizedState=null,o}function E4(o,l,d){var p=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(zt){if(p.mode==="hidden")return o=Sh(l,p),l.lanes=536870912,Xu(null,o);if(uv(l),(o=Tn)?(o=LC(o,Ti),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:za!==null?{id:xo,overflow:bo}:null,retryLane:536870912,hydrationErrors:null},d=sj(o),d.return=l,l.child=d,br=l,Tn=null)):o=null,o===null)throw Ua(l);return l.lanes=536870912,null}return Sh(l,p)}var j=o.memoizedState;if(j!==null){var D=j.dehydrated;if(uv(l),b)if(l.flags&256)l.flags&=-257,l=Cw(o,l,d);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(r(558));else if(tr||uc(o,l,d,!1),b=(d&o.childLanes)!==0,tr||b){if(p=cn,p!==null&&(D=H(p,d),D!==0&&D!==j.retryLane))throw j.retryLane=D,Hs(o,D),Kr(p,o,D),kv;Ph(),l=Cw(o,l,d)}else o=j.treeContext,Tn=_i(D.nextSibling),br=l,zt=!0,$a=null,Ti=!1,o!==null&&uj(l,o),l=Sh(l,p),l.flags|=4096;return l}return o=Zo(o.child,{mode:p.mode,children:p.children}),o.ref=l.ref,l.child=o,o.return=l,o}function jh(o,l){var d=l.ref;if(d===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(o===null||o.ref!==d)&&(l.flags|=4194816)}}function Pv(o,l,d,p,b){return Qs(l),d=fv(o,l,d,p,void 0,b),p=hv(),o!==null&&!tr?(pv(o,l,b),oa(o,l,b)):(zt&&p&&Wg(l),l.flags|=1,jr(o,l,d,b),l.child)}function Ew(o,l,d,p,b,j){return Qs(l),l.updateQueue=null,d=_j(l,p,d,b),Rj(o),p=hv(),o!==null&&!tr?(pv(o,l,j),oa(o,l,j)):(zt&&p&&Wg(l),l.flags|=1,jr(o,l,d,j),l.child)}function Tw(o,l,d,p,b){if(Qs(l),l.stateNode===null){var j=ac,D=d.contextType;typeof D=="object"&&D!==null&&(j=Sr(D)),j=new d(p,j),l.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=Dv,l.stateNode=j,j._reactInternals=l,j=l.stateNode,j.props=p,j.state=l.memoizedState,j.refs={},iv(l),D=d.contextType,j.context=typeof D=="object"&&D!==null?Sr(D):ac,j.state=l.memoizedState,D=d.getDerivedStateFromProps,typeof D=="function"&&(_v(l,d,D,p),j.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(D=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),D!==j.state&&Dv.enqueueReplaceState(j,j.state,null),Gu(l,p,j,b),qu(),j.state=l.memoizedState),typeof j.componentDidMount=="function"&&(l.flags|=4194308),p=!0}else if(o===null){j=l.stateNode;var N=l.memoizedProps,q=el(d,N);j.props=q;var ne=j.context,pe=d.contextType;D=ac,typeof pe=="object"&&pe!==null&&(D=Sr(pe));var ye=d.getDerivedStateFromProps;pe=typeof ye=="function"||typeof j.getSnapshotBeforeUpdate=="function",N=l.pendingProps!==N,pe||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(N||ne!==D)&&fw(l,j,p,D),Va=!1;var se=l.memoizedState;j.state=se,Gu(l,p,j,b),qu(),ne=l.memoizedState,N||se!==ne||Va?(typeof ye=="function"&&(_v(l,d,ye,p),ne=l.memoizedState),(q=Va||dw(l,d,q,p,se,ne,D))?(pe||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(l.flags|=4194308)):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=p,l.memoizedState=ne),j.props=p,j.state=ne,j.context=D,p=q):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),p=!1)}else{j=l.stateNode,ov(o,l),D=l.memoizedProps,pe=el(d,D),j.props=pe,ye=l.pendingProps,se=j.context,ne=d.contextType,q=ac,typeof ne=="object"&&ne!==null&&(q=Sr(ne)),N=d.getDerivedStateFromProps,(ne=typeof N=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(D!==ye||se!==q)&&fw(l,j,p,q),Va=!1,se=l.memoizedState,j.state=se,Gu(l,p,j,b),qu();var ue=l.memoizedState;D!==ye||se!==ue||Va||o!==null&&o.dependencies!==null&&rh(o.dependencies)?(typeof N=="function"&&(_v(l,d,N,p),ue=l.memoizedState),(pe=Va||dw(l,d,pe,p,se,ue,q)||o!==null&&o.dependencies!==null&&rh(o.dependencies))?(ne||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(p,ue,q),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(p,ue,q)),typeof j.componentDidUpdate=="function"&&(l.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof j.componentDidUpdate!="function"||D===o.memoizedProps&&se===o.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||D===o.memoizedProps&&se===o.memoizedState||(l.flags|=1024),l.memoizedProps=p,l.memoizedState=ue),j.props=p,j.state=ue,j.context=q,p=pe):(typeof j.componentDidUpdate!="function"||D===o.memoizedProps&&se===o.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||D===o.memoizedProps&&se===o.memoizedState||(l.flags|=1024),p=!1)}return j=p,jh(o,l),p=(l.flags&128)!==0,j||p?(j=l.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:j.render(),l.flags|=1,o!==null&&p?(l.child=Js(l,o.child,null,b),l.child=Js(l,null,d,b)):jr(o,l,d,b),l.memoizedState=j.state,o=l.child):o=oa(o,l,b),o}function Rw(o,l,d,p){return Gs(),l.flags|=256,jr(o,l,d,p),l.child}var Nv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ov(o){return{baseLanes:o,cachePool:gj()}}function Mv(o,l,d){return o=o!==null?o.childLanes&~d:0,l&&(o|=ui),o}function _w(o,l,d){var p=l.pendingProps,b=!1,j=(l.flags&128)!==0,D;if((D=j)||(D=o!==null&&o.memoizedState===null?!1:(Wn.current&2)!==0),D&&(b=!0,l.flags&=-129),D=(l.flags&32)!==0,l.flags&=-33,o===null){if(zt){if(b?qa(l):Ga(),(o=Tn)?(o=LC(o,Ti),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:za!==null?{id:xo,overflow:bo}:null,retryLane:536870912,hydrationErrors:null},d=sj(o),d.return=l,l.child=d,br=l,Tn=null)):o=null,o===null)throw Ua(l);return vy(o)?l.lanes=32:l.lanes=536870912,null}var N=p.children;return p=p.fallback,b?(Ga(),b=l.mode,N=wh({mode:"hidden",children:N},b),p=qs(p,b,d,null),N.return=l,p.return=l,N.sibling=p,l.child=N,p=l.child,p.memoizedState=Ov(d),p.childLanes=Mv(o,D,d),l.memoizedState=Nv,Xu(null,p)):(qa(l),Lv(l,N))}var q=o.memoizedState;if(q!==null&&(N=q.dehydrated,N!==null)){if(j)l.flags&256?(qa(l),l.flags&=-257,l=Iv(o,l,d)):l.memoizedState!==null?(Ga(),l.child=o.child,l.flags|=128,l=null):(Ga(),N=p.fallback,b=l.mode,p=wh({mode:"visible",children:p.children},b),N=qs(N,b,d,null),N.flags|=2,p.return=l,N.return=l,p.sibling=N,l.child=p,Js(l,o.child,null,d),p=l.child,p.memoizedState=Ov(d),p.childLanes=Mv(o,D,d),l.memoizedState=Nv,l=Xu(null,p));else if(qa(l),vy(N)){if(D=N.nextSibling&&N.nextSibling.dataset,D)var ne=D.dgst;D=ne,p=Error(r(419)),p.stack="",p.digest=D,$u({value:p,source:null,stack:null}),l=Iv(o,l,d)}else if(tr||uc(o,l,d,!1),D=(d&o.childLanes)!==0,tr||D){if(D=cn,D!==null&&(p=H(D,d),p!==0&&p!==q.retryLane))throw q.retryLane=p,Hs(o,p),Kr(D,o,p),kv;gy(N)||Ph(),l=Iv(o,l,d)}else gy(N)?(l.flags|=192,l.child=o.child,l=null):(o=q.treeContext,Tn=_i(N.nextSibling),br=l,zt=!0,$a=null,Ti=!1,o!==null&&uj(l,o),l=Lv(l,p.children),l.flags|=4096);return l}return b?(Ga(),N=p.fallback,b=l.mode,q=o.child,ne=q.sibling,p=Zo(q,{mode:"hidden",children:p.children}),p.subtreeFlags=q.subtreeFlags&65011712,ne!==null?N=Zo(ne,N):(N=qs(N,b,d,null),N.flags|=2),N.return=l,p.return=l,p.sibling=N,l.child=p,Xu(null,p),p=l.child,N=o.child.memoizedState,N===null?N=Ov(d):(b=N.cachePool,b!==null?(q=Zn._currentValue,b=b.parent!==q?{parent:q,pool:q}:b):b=gj(),N={baseLanes:N.baseLanes|d,cachePool:b}),p.memoizedState=N,p.childLanes=Mv(o,D,d),l.memoizedState=Nv,Xu(o.child,p)):(qa(l),d=o.child,o=d.sibling,d=Zo(d,{mode:"visible",children:p.children}),d.return=l,d.sibling=null,o!==null&&(D=l.deletions,D===null?(l.deletions=[o],l.flags|=16):D.push(o)),l.child=d,l.memoizedState=null,d)}function Lv(o,l){return l=wh({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function wh(o,l){return o=ai(22,o,null,l),o.lanes=0,o}function Iv(o,l,d){return Js(l,o.child,null,d),o=Lv(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function Dw(o,l,d){o.lanes|=l;var p=o.alternate;p!==null&&(p.lanes|=l),Jg(o.return,l,d)}function zv(o,l,d,p,b,j){var D=o.memoizedState;D===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:b,treeForkCount:j}:(D.isBackwards=l,D.rendering=null,D.renderingStartTime=0,D.last=p,D.tail=d,D.tailMode=b,D.treeForkCount=j)}function Aw(o,l,d){var p=l.pendingProps,b=p.revealOrder,j=p.tail;p=p.children;var D=Wn.current,N=(D&2)!==0;if(N?(D=D&1|2,l.flags|=128):D&=1,ie(Wn,D),jr(o,l,p,d),p=zt?zu:0,!N&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Dw(o,d,l);else if(o.tag===19)Dw(o,d,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(b){case"forwards":for(d=l.child,b=null;d!==null;)o=d.alternate,o!==null&&dh(o)===null&&(b=d),d=d.sibling;d=b,d===null?(b=l.child,l.child=null):(b=d.sibling,d.sibling=null),zv(l,!1,b,d,j,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,b=l.child,l.child=null;b!==null;){if(o=b.alternate,o!==null&&dh(o)===null){l.child=b;break}o=b.sibling,b.sibling=d,d=b,b=o}zv(l,!0,d,null,j,p);break;case"together":zv(l,!1,null,null,void 0,p);break;default:l.memoizedState=null}return l.child}function oa(o,l,d){if(o!==null&&(l.dependencies=o.dependencies),Ya|=l.lanes,(d&l.childLanes)===0)if(o!==null){if(uc(o,l,d,!1),(d&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(r(153));if(l.child!==null){for(o=l.child,d=Zo(o,o.pendingProps),l.child=d,d.return=l;o.sibling!==null;)o=o.sibling,d=d.sibling=Zo(o,o.pendingProps),d.return=l;d.sibling=null}return l.child}function $v(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&rh(o)))}function T4(o,l,d){switch(l.tag){case 3:Ke(l,l.stateNode.containerInfo),Ba(l,Zn,o.memoizedState.cache),Gs();break;case 27:case 5:ht(l);break;case 4:Ke(l,l.stateNode.containerInfo);break;case 10:Ba(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,uv(l),null;break;case 13:var p=l.memoizedState;if(p!==null)return p.dehydrated!==null?(qa(l),l.flags|=128,null):(d&l.child.childLanes)!==0?_w(o,l,d):(qa(l),o=oa(o,l,d),o!==null?o.sibling:null);qa(l);break;case 19:var b=(o.flags&128)!==0;if(p=(d&l.childLanes)!==0,p||(uc(o,l,d,!1),p=(d&l.childLanes)!==0),b){if(p)return Aw(o,l,d);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),ie(Wn,Wn.current),p)break;return null;case 22:return l.lanes=0,jw(o,l,d,l.pendingProps);case 24:Ba(l,Zn,o.memoizedState.cache)}return oa(o,l,d)}function kw(o,l,d){if(o!==null)if(o.memoizedProps!==l.pendingProps)tr=!0;else{if(!$v(o,d)&&(l.flags&128)===0)return tr=!1,T4(o,l,d);tr=(o.flags&131072)!==0}else tr=!1,zt&&(l.flags&1048576)!==0&&cj(l,zu,l.index);switch(l.lanes=0,l.tag){case 16:e:{var p=l.pendingProps;if(o=Ks(l.elementType),l.type=o,typeof o=="function")Hg(o)?(p=el(o,p),l.tag=1,l=Tw(null,l,o,p,d)):(l.tag=0,l=Pv(null,l,o,p,d));else{if(o!=null){var b=o.$$typeof;if(b===_){l.tag=11,l=xw(null,l,o,p,d);break e}else if(b===k){l.tag=14,l=bw(null,l,o,p,d);break e}}throw l=B(o)||o,Error(r(306,l,""))}}return l;case 0:return Pv(o,l,l.type,l.pendingProps,d);case 1:return p=l.type,b=el(p,l.pendingProps),Tw(o,l,p,b,d);case 3:e:{if(Ke(l,l.stateNode.containerInfo),o===null)throw Error(r(387));p=l.pendingProps;var j=l.memoizedState;b=j.element,ov(o,l),Gu(l,p,null,d);var D=l.memoizedState;if(p=D.cache,Ba(l,Zn,p),p!==j.cache&&Zg(l,[Zn],d,!0),qu(),p=D.element,j.isDehydrated)if(j={element:p,isDehydrated:!1,cache:D.cache},l.updateQueue.baseState=j,l.memoizedState=j,l.flags&256){l=Rw(o,l,p,d);break e}else if(p!==b){b=wi(Error(r(424)),l),$u(b),l=Rw(o,l,p,d);break e}else for(o=l.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,Tn=_i(o.firstChild),br=l,zt=!0,$a=null,Ti=!0,d=jj(l,null,p,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Gs(),p===b){l=oa(o,l,d);break e}jr(o,l,p,d)}l=l.child}return l;case 26:return jh(o,l),o===null?(d=VC(l.type,null,l.pendingProps,null))?l.memoizedState=d:zt||(d=l.type,o=l.pendingProps,p=$h(Ce.current).createElement(d),p[Pe]=l,p[Ve]=o,wr(p,d,o),xn(p),l.stateNode=p):l.memoizedState=VC(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return ht(l),o===null&&zt&&(p=l.stateNode=$C(l.type,l.pendingProps,Ce.current),br=l,Ti=!0,b=Tn,es(l.type)?(yy=b,Tn=_i(p.firstChild)):Tn=b),jr(o,l,l.pendingProps.children,d),jh(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&zt&&((b=p=Tn)&&(p=n3(p,l.type,l.pendingProps,Ti),p!==null?(l.stateNode=p,br=l,Tn=_i(p.firstChild),Ti=!1,b=!0):b=!1),b||Ua(l)),ht(l),b=l.type,j=l.pendingProps,D=o!==null?o.memoizedProps:null,p=j.children,hy(b,j)?p=null:D!==null&&hy(b,D)&&(l.flags|=32),l.memoizedState!==null&&(b=fv(o,l,v4,null,null,d),fd._currentValue=b),jh(o,l),jr(o,l,p,d),l.child;case 6:return o===null&&zt&&((o=d=Tn)&&(d=r3(d,l.pendingProps,Ti),d!==null?(l.stateNode=d,br=l,Tn=null,o=!0):o=!1),o||Ua(l)),null;case 13:return _w(o,l,d);case 4:return Ke(l,l.stateNode.containerInfo),p=l.pendingProps,o===null?l.child=Js(l,null,p,d):jr(o,l,p,d),l.child;case 11:return xw(o,l,l.type,l.pendingProps,d);case 7:return jr(o,l,l.pendingProps,d),l.child;case 8:return jr(o,l,l.pendingProps.children,d),l.child;case 12:return jr(o,l,l.pendingProps.children,d),l.child;case 10:return p=l.pendingProps,Ba(l,l.type,p.value),jr(o,l,p.children,d),l.child;case 9:return b=l.type._context,p=l.pendingProps.children,Qs(l),b=Sr(b),p=p(b),l.flags|=1,jr(o,l,p,d),l.child;case 14:return bw(o,l,l.type,l.pendingProps,d);case 15:return Sw(o,l,l.type,l.pendingProps,d);case 19:return Aw(o,l,d);case 31:return E4(o,l,d);case 22:return jw(o,l,d,l.pendingProps);case 24:return Qs(l),p=Sr(Zn),o===null?(b=nv(),b===null&&(b=cn,j=ev(),b.pooledCache=j,j.refCount++,j!==null&&(b.pooledCacheLanes|=d),b=j),l.memoizedState={parent:p,cache:b},iv(l),Ba(l,Zn,b)):((o.lanes&d)!==0&&(ov(o,l),Gu(l,null,null,d),qu()),b=o.memoizedState,j=l.memoizedState,b.parent!==p?(b={parent:p,cache:p},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),Ba(l,Zn,p)):(p=j.cache,Ba(l,Zn,p),p!==b.cache&&Zg(l,[Zn],d,!0))),jr(o,l,l.pendingProps.children,d),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function aa(o){o.flags|=4}function Uv(o,l,d,p,b){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(b&335544128)===b)if(o.stateNode.complete)o.flags|=8192;else if(iC())o.flags|=8192;else throw Xs=sh,rv}else o.flags&=-16777217}function Pw(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!WC(l))if(iC())o.flags|=8192;else throw Xs=sh,rv}function Ch(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Mr():536870912,o.lanes|=l,jc|=l)}function Ju(o,l){if(!zt)switch(o.tailMode){case"hidden":l=o.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Rn(o){var l=o.alternate!==null&&o.alternate.child===o.child,d=0,p=0;if(l)for(var b=o.child;b!==null;)d|=b.lanes|b.childLanes,p|=b.subtreeFlags&65011712,p|=b.flags&65011712,b.return=o,b=b.sibling;else for(b=o.child;b!==null;)d|=b.lanes|b.childLanes,p|=b.subtreeFlags,p|=b.flags,b.return=o,b=b.sibling;return o.subtreeFlags|=p,o.childLanes=d,l}function R4(o,l,d){var p=l.pendingProps;switch(Qg(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rn(l),null;case 1:return Rn(l),null;case 3:return d=l.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),na(Zn),_e(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(cc(l)?aa(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Kg())),Rn(l),null;case 26:var b=l.type,j=l.memoizedState;return o===null?(aa(l),j!==null?(Rn(l),Pw(l,j)):(Rn(l),Uv(l,b,null,p,d))):j?j!==o.memoizedState?(aa(l),Rn(l),Pw(l,j)):(Rn(l),l.flags&=-16777217):(o=o.memoizedProps,o!==p&&aa(l),Rn(l),Uv(l,b,o,p,d)),null;case 27:if(Ct(l),d=Ce.current,b=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==p&&aa(l);else{if(!p){if(l.stateNode===null)throw Error(r(166));return Rn(l),null}o=de.current,cc(l)?dj(l):(o=$C(b,p,d),l.stateNode=o,aa(l))}return Rn(l),null;case 5:if(Ct(l),b=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==p&&aa(l);else{if(!p){if(l.stateNode===null)throw Error(r(166));return Rn(l),null}if(j=de.current,cc(l))dj(l);else{var D=$h(Ce.current);switch(j){case 1:j=D.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:j=D.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":j=D.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":j=D.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":j=D.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof p.is=="string"?D.createElement("select",{is:p.is}):D.createElement("select"),p.multiple?j.multiple=!0:p.size&&(j.size=p.size);break;default:j=typeof p.is=="string"?D.createElement(b,{is:p.is}):D.createElement(b)}}j[Pe]=l,j[Ve]=p;e:for(D=l.child;D!==null;){if(D.tag===5||D.tag===6)j.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===l)break e;for(;D.sibling===null;){if(D.return===null||D.return===l)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}l.stateNode=j;e:switch(wr(j,b,p),b){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&aa(l)}}return Rn(l),Uv(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,d),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==p&&aa(l);else{if(typeof p!="string"&&l.stateNode===null)throw Error(r(166));if(o=Ce.current,cc(l)){if(o=l.stateNode,d=l.memoizedProps,p=null,b=br,b!==null)switch(b.tag){case 27:case 5:p=b.memoizedProps}o[Pe]=l,o=!!(o.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||_C(o.nodeValue,d)),o||Ua(l,!0)}else o=$h(o).createTextNode(p),o[Pe]=l,l.stateNode=o}return Rn(l),null;case 31:if(d=l.memoizedState,o===null||o.memoizedState!==null){if(p=cc(l),d!==null){if(o===null){if(!p)throw Error(r(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Pe]=l}else Gs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Rn(l),o=!1}else d=Kg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=d),o=!0;if(!o)return l.flags&256?(li(l),l):(li(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Rn(l),null;case 13:if(p=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(b=cc(l),p!==null&&p.dehydrated!==null){if(o===null){if(!b)throw Error(r(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[Pe]=l}else Gs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Rn(l),b=!1}else b=Kg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=b),b=!0;if(!b)return l.flags&256?(li(l),l):(li(l),null)}return li(l),(l.flags&128)!==0?(l.lanes=d,l):(d=p!==null,o=o!==null&&o.memoizedState!==null,d&&(p=l.child,b=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(b=p.alternate.memoizedState.cachePool.pool),j=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(j=p.memoizedState.cachePool.pool),j!==b&&(p.flags|=2048)),d!==o&&d&&(l.child.flags|=8192),Ch(l,l.updateQueue),Rn(l),null);case 4:return _e(),o===null&&ly(l.stateNode.containerInfo),Rn(l),null;case 10:return na(l.type),Rn(l),null;case 19:if(F(Wn),p=l.memoizedState,p===null)return Rn(l),null;if(b=(l.flags&128)!==0,j=p.rendering,j===null)if(b)Ju(p,!1);else{if(Un!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(j=dh(o),j!==null){for(l.flags|=128,Ju(p,!1),o=j.updateQueue,l.updateQueue=o,Ch(l,o),l.subtreeFlags=0,o=d,d=l.child;d!==null;)aj(d,o),d=d.sibling;return ie(Wn,Wn.current&1|2),zt&&ea(l,p.treeForkCount),l.child}o=o.sibling}p.tail!==null&&ft()>Dh&&(l.flags|=128,b=!0,Ju(p,!1),l.lanes=4194304)}else{if(!b)if(o=dh(j),o!==null){if(l.flags|=128,b=!0,o=o.updateQueue,l.updateQueue=o,Ch(l,o),Ju(p,!0),p.tail===null&&p.tailMode==="hidden"&&!j.alternate&&!zt)return Rn(l),null}else 2*ft()-p.renderingStartTime>Dh&&d!==536870912&&(l.flags|=128,b=!0,Ju(p,!1),l.lanes=4194304);p.isBackwards?(j.sibling=l.child,l.child=j):(o=p.last,o!==null?o.sibling=j:l.child=j,p.last=j)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=ft(),o.sibling=null,d=Wn.current,ie(Wn,b?d&1|2:d&1),zt&&ea(l,p.treeForkCount),o):(Rn(l),null);case 22:case 23:return li(l),cv(),p=l.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(l.flags|=8192):p&&(l.flags|=8192),p?(d&536870912)!==0&&(l.flags&128)===0&&(Rn(l),l.subtreeFlags&6&&(l.flags|=8192)):Rn(l),d=l.updateQueue,d!==null&&Ch(l,d.retryQueue),d=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048),o!==null&&F(Ys),null;case 24:return d=null,o!==null&&(d=o.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),na(Zn),Rn(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function _4(o,l){switch(Qg(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return na(Zn),_e(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return Ct(l),null;case 31:if(l.memoizedState!==null){if(li(l),l.alternate===null)throw Error(r(340));Gs()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(li(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Gs()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return F(Wn),null;case 4:return _e(),null;case 10:return na(l.type),null;case 22:case 23:return li(l),cv(),o!==null&&F(Ys),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return na(Zn),null;case 25:return null;default:return null}}function Nw(o,l){switch(Qg(l),l.tag){case 3:na(Zn),_e();break;case 26:case 27:case 5:Ct(l);break;case 4:_e();break;case 31:l.memoizedState!==null&&li(l);break;case 13:li(l);break;case 19:F(Wn);break;case 10:na(l.type);break;case 22:case 23:li(l),cv(),o!==null&&F(Ys);break;case 24:na(Zn)}}function Zu(o,l){try{var d=l.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var b=p.next;d=b;do{if((d.tag&o)===o){p=void 0;var j=d.create,D=d.inst;p=j(),D.destroy=p}d=d.next}while(d!==b)}}catch(N){Zt(l,l.return,N)}}function Wa(o,l,d){try{var p=l.updateQueue,b=p!==null?p.lastEffect:null;if(b!==null){var j=b.next;p=j;do{if((p.tag&o)===o){var D=p.inst,N=D.destroy;if(N!==void 0){D.destroy=void 0,b=l;var q=d,ne=N;try{ne()}catch(pe){Zt(b,q,pe)}}}p=p.next}while(p!==j)}}catch(pe){Zt(l,l.return,pe)}}function Ow(o){var l=o.updateQueue;if(l!==null){var d=o.stateNode;try{Cj(l,d)}catch(p){Zt(o,o.return,p)}}}function Mw(o,l,d){d.props=el(o.type,o.memoizedProps),d.state=o.memoizedState;try{d.componentWillUnmount()}catch(p){Zt(o,l,p)}}function ed(o,l){try{var d=o.ref;if(d!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof d=="function"?o.refCleanup=d(p):d.current=p}}catch(b){Zt(o,l,b)}}function So(o,l){var d=o.ref,p=o.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(b){Zt(o,l,b)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(b){Zt(o,l,b)}else d.current=null}function Lw(o){var l=o.type,d=o.memoizedProps,p=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":d.autoFocus&&p.focus();break e;case"img":d.src?p.src=d.src:d.srcSet&&(p.srcset=d.srcSet)}}catch(b){Zt(o,o.return,b)}}function Bv(o,l,d){try{var p=o.stateNode;K4(p,o.type,d,l),p[Ve]=l}catch(b){Zt(o,o.return,b)}}function Iw(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&es(o.type)||o.tag===4}function Vv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Iw(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&es(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Fv(o,l,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,l?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(o,l):(l=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,l.appendChild(o),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=Xo));else if(p!==4&&(p===27&&es(o.type)&&(d=o.stateNode,l=null),o=o.child,o!==null))for(Fv(o,l,d),o=o.sibling;o!==null;)Fv(o,l,d),o=o.sibling}function Eh(o,l,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,l?d.insertBefore(o,l):d.appendChild(o);else if(p!==4&&(p===27&&es(o.type)&&(d=o.stateNode),o=o.child,o!==null))for(Eh(o,l,d),o=o.sibling;o!==null;)Eh(o,l,d),o=o.sibling}function zw(o){var l=o.stateNode,d=o.memoizedProps;try{for(var p=o.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);wr(l,p,d),l[Pe]=o,l[Ve]=d}catch(j){Zt(o,o.return,j)}}var sa=!1,nr=!1,Hv=!1,$w=typeof WeakSet=="function"?WeakSet:Set,ur=null;function D4(o,l){if(o=o.containerInfo,dy=Gh,o=X1(o),Ig(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var b=p.anchorOffset,j=p.focusNode;p=p.focusOffset;try{d.nodeType,j.nodeType}catch{d=null;break e}var D=0,N=-1,q=-1,ne=0,pe=0,ye=o,se=null;t:for(;;){for(var ue;ye!==d||b!==0&&ye.nodeType!==3||(N=D+b),ye!==j||p!==0&&ye.nodeType!==3||(q=D+p),ye.nodeType===3&&(D+=ye.nodeValue.length),(ue=ye.firstChild)!==null;)se=ye,ye=ue;for(;;){if(ye===o)break t;if(se===d&&++ne===b&&(N=D),se===j&&++pe===p&&(q=D),(ue=ye.nextSibling)!==null)break;ye=se,se=ye.parentNode}ye=ue}d=N===-1||q===-1?null:{start:N,end:q}}else d=null}d=d||{start:0,end:0}}else d=null;for(fy={focusedElem:o,selectionRange:d},Gh=!1,ur=l;ur!==null;)if(l=ur,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,ur=o;else for(;ur!==null;){switch(l=ur,j=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(d=0;d<o.length;d++)b=o[d],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&j!==null){o=void 0,d=l,b=j.memoizedProps,j=j.memoizedState,p=d.stateNode;try{var Qe=el(d.type,b);o=p.getSnapshotBeforeUpdate(Qe,j),p.__reactInternalSnapshotBeforeUpdate=o}catch(st){Zt(d,d.return,st)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,d=o.nodeType,d===9)my(o);else if(d===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":my(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=l.sibling,o!==null){o.return=l.return,ur=o;break}ur=l.return}}function Uw(o,l,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:ca(o,d),p&4&&Zu(5,d);break;case 1:if(ca(o,d),p&4)if(o=d.stateNode,l===null)try{o.componentDidMount()}catch(D){Zt(d,d.return,D)}else{var b=el(d.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(b,l,o.__reactInternalSnapshotBeforeUpdate)}catch(D){Zt(d,d.return,D)}}p&64&&Ow(d),p&512&&ed(d,d.return);break;case 3:if(ca(o,d),p&64&&(o=d.updateQueue,o!==null)){if(l=null,d.child!==null)switch(d.child.tag){case 27:case 5:l=d.child.stateNode;break;case 1:l=d.child.stateNode}try{Cj(o,l)}catch(D){Zt(d,d.return,D)}}break;case 27:l===null&&p&4&&zw(d);case 26:case 5:ca(o,d),l===null&&p&4&&Lw(d),p&512&&ed(d,d.return);break;case 12:ca(o,d);break;case 31:ca(o,d),p&4&&Fw(o,d);break;case 13:ca(o,d),p&4&&Hw(o,d),p&64&&(o=d.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(d=z4.bind(null,d),i3(o,d))));break;case 22:if(p=d.memoizedState!==null||sa,!p){l=l!==null&&l.memoizedState!==null||nr,b=sa;var j=nr;sa=p,(nr=l)&&!j?ua(o,d,(d.subtreeFlags&8772)!==0):ca(o,d),sa=b,nr=j}break;case 30:break;default:ca(o,d)}}function Bw(o){var l=o.alternate;l!==null&&(o.alternate=null,Bw(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Xt(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var On=null,Gr=!1;function la(o,l,d){for(d=d.child;d!==null;)Vw(o,l,d),d=d.sibling}function Vw(o,l,d){if(Hn&&typeof Hn.onCommitFiberUnmount=="function")try{Hn.onCommitFiberUnmount(lr,d)}catch{}switch(d.tag){case 26:nr||So(d,l),la(o,l,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:nr||So(d,l);var p=On,b=Gr;es(d.type)&&(On=d.stateNode,Gr=!1),la(o,l,d),cd(d.stateNode),On=p,Gr=b;break;case 5:nr||So(d,l);case 6:if(p=On,b=Gr,On=null,la(o,l,d),On=p,Gr=b,On!==null)if(Gr)try{(On.nodeType===9?On.body:On.nodeName==="HTML"?On.ownerDocument.body:On).removeChild(d.stateNode)}catch(j){Zt(d,l,j)}else try{On.removeChild(d.stateNode)}catch(j){Zt(d,l,j)}break;case 18:On!==null&&(Gr?(o=On,OC(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,d.stateNode),Ac(o)):OC(On,d.stateNode));break;case 4:p=On,b=Gr,On=d.stateNode.containerInfo,Gr=!0,la(o,l,d),On=p,Gr=b;break;case 0:case 11:case 14:case 15:Wa(2,d,l),nr||Wa(4,d,l),la(o,l,d);break;case 1:nr||(So(d,l),p=d.stateNode,typeof p.componentWillUnmount=="function"&&Mw(d,l,p)),la(o,l,d);break;case 21:la(o,l,d);break;case 22:nr=(p=nr)||d.memoizedState!==null,la(o,l,d),nr=p;break;default:la(o,l,d)}}function Fw(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Ac(o)}catch(d){Zt(l,l.return,d)}}}function Hw(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Ac(o)}catch(d){Zt(l,l.return,d)}}function A4(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new $w),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new $w),l;default:throw Error(r(435,o.tag))}}function Th(o,l){var d=A4(o);l.forEach(function(p){if(!d.has(p)){d.add(p);var b=$4.bind(null,o,p);p.then(b,b)}})}function Wr(o,l){var d=l.deletions;if(d!==null)for(var p=0;p<d.length;p++){var b=d[p],j=o,D=l,N=D;e:for(;N!==null;){switch(N.tag){case 27:if(es(N.type)){On=N.stateNode,Gr=!1;break e}break;case 5:On=N.stateNode,Gr=!1;break e;case 3:case 4:On=N.stateNode.containerInfo,Gr=!0;break e}N=N.return}if(On===null)throw Error(r(160));Vw(j,D,b),On=null,Gr=!1,j=b.alternate,j!==null&&(j.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)qw(l,o),l=l.sibling}var Zi=null;function qw(o,l){var d=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Wr(l,o),Qr(o),p&4&&(Wa(3,o,o.return),Zu(3,o),Wa(5,o,o.return));break;case 1:Wr(l,o),Qr(o),p&512&&(nr||d===null||So(d,d.return)),p&64&&sa&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(d=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var b=Zi;if(Wr(l,o),Qr(o),p&512&&(nr||d===null||So(d,d.return)),p&4){var j=d!==null?d.memoizedState:null;if(p=o.memoizedState,d===null)if(p===null)if(o.stateNode===null){e:{p=o.type,d=o.memoizedProps,b=b.ownerDocument||b;t:switch(p){case"title":j=b.getElementsByTagName("title")[0],(!j||j[bt]||j[Pe]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=b.createElement(p),b.head.insertBefore(j,b.querySelector("head > title"))),wr(j,p,d),j[Pe]=o,xn(j),p=j;break e;case"link":var D=qC("link","href",b).get(p+(d.href||""));if(D){for(var N=0;N<D.length;N++)if(j=D[N],j.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&j.getAttribute("rel")===(d.rel==null?null:d.rel)&&j.getAttribute("title")===(d.title==null?null:d.title)&&j.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){D.splice(N,1);break t}}j=b.createElement(p),wr(j,p,d),b.head.appendChild(j);break;case"meta":if(D=qC("meta","content",b).get(p+(d.content||""))){for(N=0;N<D.length;N++)if(j=D[N],j.getAttribute("content")===(d.content==null?null:""+d.content)&&j.getAttribute("name")===(d.name==null?null:d.name)&&j.getAttribute("property")===(d.property==null?null:d.property)&&j.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&j.getAttribute("charset")===(d.charSet==null?null:d.charSet)){D.splice(N,1);break t}}j=b.createElement(p),wr(j,p,d),b.head.appendChild(j);break;default:throw Error(r(468,p))}j[Pe]=o,xn(j),p=j}o.stateNode=p}else GC(b,o.type,o.stateNode);else o.stateNode=HC(b,p,o.memoizedProps);else j!==p?(j===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):j.count--,p===null?GC(b,o.type,o.stateNode):HC(b,p,o.memoizedProps)):p===null&&o.stateNode!==null&&Bv(o,o.memoizedProps,d.memoizedProps)}break;case 27:Wr(l,o),Qr(o),p&512&&(nr||d===null||So(d,d.return)),d!==null&&p&4&&Bv(o,o.memoizedProps,d.memoizedProps);break;case 5:if(Wr(l,o),Qr(o),p&512&&(nr||d===null||So(d,d.return)),o.flags&32){b=o.stateNode;try{Zl(b,"")}catch(Qe){Zt(o,o.return,Qe)}}p&4&&o.stateNode!=null&&(b=o.memoizedProps,Bv(o,b,d!==null?d.memoizedProps:b)),p&1024&&(Hv=!0);break;case 6:if(Wr(l,o),Qr(o),p&4){if(o.stateNode===null)throw Error(r(162));p=o.memoizedProps,d=o.stateNode;try{d.nodeValue=p}catch(Qe){Zt(o,o.return,Qe)}}break;case 3:if(Vh=null,b=Zi,Zi=Uh(l.containerInfo),Wr(l,o),Zi=b,Qr(o),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Ac(l.containerInfo)}catch(Qe){Zt(o,o.return,Qe)}Hv&&(Hv=!1,Gw(o));break;case 4:p=Zi,Zi=Uh(o.stateNode.containerInfo),Wr(l,o),Qr(o),Zi=p;break;case 12:Wr(l,o),Qr(o);break;case 31:Wr(l,o),Qr(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Th(o,p)));break;case 13:Wr(l,o),Qr(o),o.child.flags&8192&&o.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(_h=ft()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Th(o,p)));break;case 22:b=o.memoizedState!==null;var q=d!==null&&d.memoizedState!==null,ne=sa,pe=nr;if(sa=ne||b,nr=pe||q,Wr(l,o),nr=pe,sa=ne,Qr(o),p&8192)e:for(l=o.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(d===null||q||sa||nr||tl(o)),d=null,l=o;;){if(l.tag===5||l.tag===26){if(d===null){q=d=l;try{if(j=q.stateNode,b)D=j.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{N=q.stateNode;var ye=q.memoizedProps.style,se=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;N.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Qe){Zt(q,q.return,Qe)}}}else if(l.tag===6){if(d===null){q=l;try{q.stateNode.nodeValue=b?"":q.memoizedProps}catch(Qe){Zt(q,q.return,Qe)}}}else if(l.tag===18){if(d===null){q=l;try{var ue=q.stateNode;b?MC(ue,!0):MC(q.stateNode,!1)}catch(Qe){Zt(q,q.return,Qe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;d===l&&(d=null),l=l.return}d===l&&(d=null),l.sibling.return=l.return,l=l.sibling}p&4&&(p=o.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,Th(o,d))));break;case 19:Wr(l,o),Qr(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Th(o,p)));break;case 30:break;case 21:break;default:Wr(l,o),Qr(o)}}function Qr(o){var l=o.flags;if(l&2){try{for(var d,p=o.return;p!==null;){if(Iw(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var b=d.stateNode,j=Vv(o);Eh(o,j,b);break;case 5:var D=d.stateNode;d.flags&32&&(Zl(D,""),d.flags&=-33);var N=Vv(o);Eh(o,N,D);break;case 3:case 4:var q=d.stateNode.containerInfo,ne=Vv(o);Fv(o,ne,q);break;default:throw Error(r(161))}}catch(pe){Zt(o,o.return,pe)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function Gw(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;Gw(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function ca(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)Uw(o,l.alternate,l),l=l.sibling}function tl(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:Wa(4,l,l.return),tl(l);break;case 1:So(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&Mw(l,l.return,d),tl(l);break;case 27:cd(l.stateNode);case 26:case 5:So(l,l.return),tl(l);break;case 22:l.memoizedState===null&&tl(l);break;case 30:tl(l);break;default:tl(l)}o=o.sibling}}function ua(o,l,d){for(d=d&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var p=l.alternate,b=o,j=l,D=j.flags;switch(j.tag){case 0:case 11:case 15:ua(b,j,d),Zu(4,j);break;case 1:if(ua(b,j,d),p=j,b=p.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ne){Zt(p,p.return,ne)}if(p=j,b=p.updateQueue,b!==null){var N=p.stateNode;try{var q=b.shared.hiddenCallbacks;if(q!==null)for(b.shared.hiddenCallbacks=null,b=0;b<q.length;b++)wj(q[b],N)}catch(ne){Zt(p,p.return,ne)}}d&&D&64&&Ow(j),ed(j,j.return);break;case 27:zw(j);case 26:case 5:ua(b,j,d),d&&p===null&&D&4&&Lw(j),ed(j,j.return);break;case 12:ua(b,j,d);break;case 31:ua(b,j,d),d&&D&4&&Fw(b,j);break;case 13:ua(b,j,d),d&&D&4&&Hw(b,j);break;case 22:j.memoizedState===null&&ua(b,j,d),ed(j,j.return);break;case 30:break;default:ua(b,j,d)}l=l.sibling}}function qv(o,l){var d=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==d&&(o!=null&&o.refCount++,d!=null&&Uu(d))}function Gv(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Uu(o))}function eo(o,l,d,p){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Ww(o,l,d,p),l=l.sibling}function Ww(o,l,d,p){var b=l.flags;switch(l.tag){case 0:case 11:case 15:eo(o,l,d,p),b&2048&&Zu(9,l);break;case 1:eo(o,l,d,p);break;case 3:eo(o,l,d,p),b&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Uu(o)));break;case 12:if(b&2048){eo(o,l,d,p),o=l.stateNode;try{var j=l.memoizedProps,D=j.id,N=j.onPostCommit;typeof N=="function"&&N(D,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(q){Zt(l,l.return,q)}}else eo(o,l,d,p);break;case 31:eo(o,l,d,p);break;case 13:eo(o,l,d,p);break;case 23:break;case 22:j=l.stateNode,D=l.alternate,l.memoizedState!==null?j._visibility&2?eo(o,l,d,p):td(o,l):j._visibility&2?eo(o,l,d,p):(j._visibility|=2,xc(o,l,d,p,(l.subtreeFlags&10256)!==0||!1)),b&2048&&qv(D,l);break;case 24:eo(o,l,d,p),b&2048&&Gv(l.alternate,l);break;default:eo(o,l,d,p)}}function xc(o,l,d,p,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var j=o,D=l,N=d,q=p,ne=D.flags;switch(D.tag){case 0:case 11:case 15:xc(j,D,N,q,b),Zu(8,D);break;case 23:break;case 22:var pe=D.stateNode;D.memoizedState!==null?pe._visibility&2?xc(j,D,N,q,b):td(j,D):(pe._visibility|=2,xc(j,D,N,q,b)),b&&ne&2048&&qv(D.alternate,D);break;case 24:xc(j,D,N,q,b),b&&ne&2048&&Gv(D.alternate,D);break;default:xc(j,D,N,q,b)}l=l.sibling}}function td(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var d=o,p=l,b=p.flags;switch(p.tag){case 22:td(d,p),b&2048&&qv(p.alternate,p);break;case 24:td(d,p),b&2048&&Gv(p.alternate,p);break;default:td(d,p)}l=l.sibling}}var nd=8192;function bc(o,l,d){if(o.subtreeFlags&nd)for(o=o.child;o!==null;)Qw(o,l,d),o=o.sibling}function Qw(o,l,d){switch(o.tag){case 26:bc(o,l,d),o.flags&nd&&o.memoizedState!==null&&g3(d,Zi,o.memoizedState,o.memoizedProps);break;case 5:bc(o,l,d);break;case 3:case 4:var p=Zi;Zi=Uh(o.stateNode.containerInfo),bc(o,l,d),Zi=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=nd,nd=16777216,bc(o,l,d),nd=p):bc(o,l,d));break;default:bc(o,l,d)}}function Yw(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function rd(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var p=l[d];ur=p,Xw(p,o)}Yw(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Kw(o),o=o.sibling}function Kw(o){switch(o.tag){case 0:case 11:case 15:rd(o),o.flags&2048&&Wa(9,o,o.return);break;case 3:rd(o);break;case 12:rd(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,Rh(o)):rd(o);break;default:rd(o)}}function Rh(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var p=l[d];ur=p,Xw(p,o)}Yw(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:Wa(8,l,l.return),Rh(l);break;case 22:d=l.stateNode,d._visibility&2&&(d._visibility&=-3,Rh(l));break;default:Rh(l)}o=o.sibling}}function Xw(o,l){for(;ur!==null;){var d=ur;switch(d.tag){case 0:case 11:case 15:Wa(8,d,l);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var p=d.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Uu(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,ur=p;else e:for(d=o;ur!==null;){p=ur;var b=p.sibling,j=p.return;if(Bw(p),p===d){ur=null;break e}if(b!==null){b.return=j,ur=b;break e}ur=j}}}var k4={getCacheForType:function(o){var l=Sr(Zn),d=l.data.get(o);return d===void 0&&(d=o(),l.data.set(o,d)),d},cacheSignal:function(){return Sr(Zn).controller.signal}},P4=typeof WeakMap=="function"?WeakMap:Map,Qt=0,cn=null,kt=null,Mt=0,Jt=0,ci=null,Qa=!1,Sc=!1,Wv=!1,da=0,Un=0,Ya=0,nl=0,Qv=0,ui=0,jc=0,id=null,Yr=null,Yv=!1,_h=0,Jw=0,Dh=1/0,Ah=null,Ka=null,ir=0,Xa=null,wc=null,fa=0,Kv=0,Xv=null,Zw=null,od=0,Jv=null;function di(){return(Qt&2)!==0&&Mt!==0?Mt&-Mt:L.T!==null?iy():we()}function eC(){if(ui===0)if((Mt&536870912)===0||zt){var o=Hr;Hr<<=1,(Hr&3932160)===0&&(Hr=262144),ui=o}else ui=536870912;return o=si.current,o!==null&&(o.flags|=32),ui}function Kr(o,l,d){(o===cn&&(Jt===2||Jt===9)||o.cancelPendingCommit!==null)&&(Cc(o,0),Ja(o,Mt,ui,!1)),Cn(o,d),((Qt&2)===0||o!==cn)&&(o===cn&&((Qt&2)===0&&(nl|=d),Un===4&&Ja(o,Mt,ui,!1)),jo(o))}function tC(o,l,d){if((Qt&6)!==0)throw Error(r(327));var p=!d&&(l&127)===0&&(l&o.expiredLanes)===0||bi(o,l),b=p?M4(o,l):ey(o,l,!0),j=p;do{if(b===0){Sc&&!p&&Ja(o,l,0,!1);break}else{if(d=o.current.alternate,j&&!N4(d)){b=ey(o,l,!1),j=!1;continue}if(b===2){if(j=l,o.errorRecoveryDisabledLanes&j)var D=0;else D=o.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){l=D;e:{var N=o;b=id;var q=N.current.memoizedState.isDehydrated;if(q&&(Cc(N,D).flags|=256),D=ey(N,D,!1),D!==2){if(Wv&&!q){N.errorRecoveryDisabledLanes|=j,nl|=j,b=4;break e}j=Yr,Yr=b,j!==null&&(Yr===null?Yr=j:Yr.push.apply(Yr,j))}b=D}if(j=!1,b!==2)continue}}if(b===1){Cc(o,0),Ja(o,l,0,!0);break}e:{switch(p=o,j=b,j){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:Ja(p,l,ui,!Qa);break e;case 2:Yr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(b=_h+300-ft(),10<b)){if(Ja(p,l,ui,!Qa),Ko(p,0,!0)!==0)break e;fa=l,p.timeoutHandle=PC(nC.bind(null,p,d,Yr,Ah,Yv,l,ui,nl,jc,Qa,j,"Throttled",-0,0),b);break e}nC(p,d,Yr,Ah,Yv,l,ui,nl,jc,Qa,j,null,-0,0)}}break}while(!0);jo(o)}function nC(o,l,d,p,b,j,D,N,q,ne,pe,ye,se,ue){if(o.timeoutHandle=-1,ye=l.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xo},Qw(l,j,ye);var Qe=(j&62914560)===j?_h-ft():(j&4194048)===j?Jw-ft():0;if(Qe=v3(ye,Qe),Qe!==null){fa=j,o.cancelPendingCommit=Qe(uC.bind(null,o,l,j,d,p,b,D,N,q,pe,ye,null,se,ue)),Ja(o,j,D,!ne);return}}uC(o,l,j,d,p,b,D,N,q)}function N4(o){for(var l=o;;){var d=l.tag;if((d===0||d===11||d===15)&&l.flags&16384&&(d=l.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var b=d[p],j=b.getSnapshot;b=b.value;try{if(!oi(j(),b))return!1}catch{return!1}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ja(o,l,d,p){l&=~Qv,l&=~nl,o.suspendedLanes|=l,o.pingedLanes&=~l,p&&(o.warmLanes|=l),p=o.expirationTimes;for(var b=l;0<b;){var j=31-zn(b),D=1<<j;p[j]=-1,b&=~D}d!==0&&_u(o,d,l)}function kh(){return(Qt&6)===0?(ad(0),!1):!0}function Zv(){if(kt!==null){if(Jt===0)var o=kt.return;else o=kt,ta=Ws=null,mv(o),pc=null,Vu=0,o=kt;for(;o!==null;)Nw(o.alternate,o),o=o.return;kt=null}}function Cc(o,l){var d=o.timeoutHandle;d!==-1&&(o.timeoutHandle=-1,Z4(d)),d=o.cancelPendingCommit,d!==null&&(o.cancelPendingCommit=null,d()),fa=0,Zv(),cn=o,kt=d=Zo(o.current,null),Mt=l,Jt=0,ci=null,Qa=!1,Sc=bi(o,l),Wv=!1,jc=ui=Qv=nl=Ya=Un=0,Yr=id=null,Yv=!1,(l&8)!==0&&(l|=l&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=l;0<p;){var b=31-zn(p),j=1<<b;l|=o[b],p&=~j}return da=l,Jf(),d}function rC(o,l){xt=null,L.H=Ku,l===hc||l===ah?(l=xj(),Jt=3):l===rv?(l=xj(),Jt=4):Jt=l===kv?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,ci=l,kt===null&&(Un=1,bh(o,wi(l,o.current)))}function iC(){var o=si.current;return o===null?!0:(Mt&4194048)===Mt?Ri===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?o===Ri:!1}function oC(){var o=L.H;return L.H=Ku,o===null?Ku:o}function aC(){var o=L.A;return L.A=k4,o}function Ph(){Un=4,Qa||(Mt&4194048)!==Mt&&si.current!==null||(Sc=!0),(Ya&134217727)===0&&(nl&134217727)===0||cn===null||Ja(cn,Mt,ui,!1)}function ey(o,l,d){var p=Qt;Qt|=2;var b=oC(),j=aC();(cn!==o||Mt!==l)&&(Ah=null,Cc(o,l)),l=!1;var D=Un;e:do try{if(Jt!==0&&kt!==null){var N=kt,q=ci;switch(Jt){case 8:Zv(),D=6;break e;case 3:case 2:case 9:case 6:si.current===null&&(l=!0);var ne=Jt;if(Jt=0,ci=null,Ec(o,N,q,ne),d&&Sc){D=0;break e}break;default:ne=Jt,Jt=0,ci=null,Ec(o,N,q,ne)}}O4(),D=Un;break}catch(pe){rC(o,pe)}while(!0);return l&&o.shellSuspendCounter++,ta=Ws=null,Qt=p,L.H=b,L.A=j,kt===null&&(cn=null,Mt=0,Jf()),D}function O4(){for(;kt!==null;)sC(kt)}function M4(o,l){var d=Qt;Qt|=2;var p=oC(),b=aC();cn!==o||Mt!==l?(Ah=null,Dh=ft()+500,Cc(o,l)):Sc=bi(o,l);e:do try{if(Jt!==0&&kt!==null){l=kt;var j=ci;t:switch(Jt){case 1:Jt=0,ci=null,Ec(o,l,j,1);break;case 2:case 9:if(vj(j)){Jt=0,ci=null,lC(l);break}l=function(){Jt!==2&&Jt!==9||cn!==o||(Jt=7),jo(o)},j.then(l,l);break e;case 3:Jt=7;break e;case 4:Jt=5;break e;case 7:vj(j)?(Jt=0,ci=null,lC(l)):(Jt=0,ci=null,Ec(o,l,j,7));break;case 5:var D=null;switch(kt.tag){case 26:D=kt.memoizedState;case 5:case 27:var N=kt;if(D?WC(D):N.stateNode.complete){Jt=0,ci=null;var q=N.sibling;if(q!==null)kt=q;else{var ne=N.return;ne!==null?(kt=ne,Nh(ne)):kt=null}break t}}Jt=0,ci=null,Ec(o,l,j,5);break;case 6:Jt=0,ci=null,Ec(o,l,j,6);break;case 8:Zv(),Un=6;break e;default:throw Error(r(462))}}L4();break}catch(pe){rC(o,pe)}while(!0);return ta=Ws=null,L.H=p,L.A=b,Qt=d,kt!==null?0:(cn=null,Mt=0,Jf(),Un)}function L4(){for(;kt!==null&&!Ze();)sC(kt)}function sC(o){var l=kw(o.alternate,o,da);o.memoizedProps=o.pendingProps,l===null?Nh(o):kt=l}function lC(o){var l=o,d=l.alternate;switch(l.tag){case 15:case 0:l=Ew(d,l,l.pendingProps,l.type,void 0,Mt);break;case 11:l=Ew(d,l,l.pendingProps,l.type.render,l.ref,Mt);break;case 5:mv(l);default:Nw(d,l),l=kt=aj(l,da),l=kw(d,l,da)}o.memoizedProps=o.pendingProps,l===null?Nh(o):kt=l}function Ec(o,l,d,p){ta=Ws=null,mv(l),pc=null,Vu=0;var b=l.return;try{if(C4(o,b,l,d,Mt)){Un=1,bh(o,wi(d,o.current)),kt=null;return}}catch(j){if(b!==null)throw kt=b,j;Un=1,bh(o,wi(d,o.current)),kt=null;return}l.flags&32768?(zt||p===1?o=!0:Sc||(Mt&536870912)!==0?o=!1:(Qa=o=!0,(p===2||p===9||p===3||p===6)&&(p=si.current,p!==null&&p.tag===13&&(p.flags|=16384))),cC(l,o)):Nh(l)}function Nh(o){var l=o;do{if((l.flags&32768)!==0){cC(l,Qa);return}o=l.return;var d=R4(l.alternate,l,da);if(d!==null){kt=d;return}if(l=l.sibling,l!==null){kt=l;return}kt=l=o}while(l!==null);Un===0&&(Un=5)}function cC(o,l){do{var d=_4(o.alternate,o);if(d!==null){d.flags&=32767,kt=d;return}if(d=o.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!l&&(o=o.sibling,o!==null)){kt=o;return}kt=o=d}while(o!==null);Un=6,kt=null}function uC(o,l,d,p,b,j,D,N,q){o.cancelPendingCommit=null;do Oh();while(ir!==0);if((Qt&6)!==0)throw Error(r(327));if(l!==null){if(l===o.current)throw Error(r(177));if(j=l.lanes|l.childLanes,j|=Vg,Wl(o,d,j,D,N,q),o===cn&&(kt=cn=null,Mt=0),wc=l,Xa=o,fa=d,Kv=j,Xv=b,Zw=p,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,U4(Dt,function(){return mC(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||p){p=L.T,L.T=null,b=I.p,I.p=2,D=Qt,Qt|=4;try{D4(o,l,d)}finally{Qt=D,I.p=b,L.T=p}}ir=1,dC(),fC(),hC()}}function dC(){if(ir===1){ir=0;var o=Xa,l=wc,d=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||d){d=L.T,L.T=null;var p=I.p;I.p=2;var b=Qt;Qt|=4;try{qw(l,o);var j=fy,D=X1(o.containerInfo),N=j.focusedElem,q=j.selectionRange;if(D!==N&&N&&N.ownerDocument&&K1(N.ownerDocument.documentElement,N)){if(q!==null&&Ig(N)){var ne=q.start,pe=q.end;if(pe===void 0&&(pe=ne),"selectionStart"in N)N.selectionStart=ne,N.selectionEnd=Math.min(pe,N.value.length);else{var ye=N.ownerDocument||document,se=ye&&ye.defaultView||window;if(se.getSelection){var ue=se.getSelection(),Qe=N.textContent.length,st=Math.min(q.start,Qe),sn=q.end===void 0?st:Math.min(q.end,Qe);!ue.extend&&st>sn&&(D=sn,sn=st,st=D);var J=Y1(N,st),Q=Y1(N,sn);if(J&&Q&&(ue.rangeCount!==1||ue.anchorNode!==J.node||ue.anchorOffset!==J.offset||ue.focusNode!==Q.node||ue.focusOffset!==Q.offset)){var te=ye.createRange();te.setStart(J.node,J.offset),ue.removeAllRanges(),st>sn?(ue.addRange(te),ue.extend(Q.node,Q.offset)):(te.setEnd(Q.node,Q.offset),ue.addRange(te))}}}}for(ye=[],ue=N;ue=ue.parentNode;)ue.nodeType===1&&ye.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ye.length;N++){var me=ye[N];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}Gh=!!dy,fy=dy=null}finally{Qt=b,I.p=p,L.T=d}}o.current=l,ir=2}}function fC(){if(ir===2){ir=0;var o=Xa,l=wc,d=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||d){d=L.T,L.T=null;var p=I.p;I.p=2;var b=Qt;Qt|=4;try{Uw(o,l.alternate,l)}finally{Qt=b,I.p=p,L.T=d}}ir=3}}function hC(){if(ir===4||ir===3){ir=0,dt();var o=Xa,l=wc,d=fa,p=Zw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?ir=5:(ir=0,wc=Xa=null,pC(o,o.pendingLanes));var b=o.pendingLanes;if(b===0&&(Ka=null),oe(d),l=l.stateNode,Hn&&typeof Hn.onCommitFiberRoot=="function")try{Hn.onCommitFiberRoot(lr,l,void 0,(l.current.flags&128)===128)}catch{}if(p!==null){l=L.T,b=I.p,I.p=2,L.T=null;try{for(var j=o.onRecoverableError,D=0;D<p.length;D++){var N=p[D];j(N.value,{componentStack:N.stack})}}finally{L.T=l,I.p=b}}(fa&3)!==0&&Oh(),jo(o),b=o.pendingLanes,(d&261930)!==0&&(b&42)!==0?o===Jv?od++:(od=0,Jv=o):od=0,ad(0)}}function pC(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Uu(l)))}function Oh(){return dC(),fC(),hC(),mC()}function mC(){if(ir!==5)return!1;var o=Xa,l=Kv;Kv=0;var d=oe(fa),p=L.T,b=I.p;try{I.p=32>d?32:d,L.T=null,d=Xv,Xv=null;var j=Xa,D=fa;if(ir=0,wc=Xa=null,fa=0,(Qt&6)!==0)throw Error(r(331));var N=Qt;if(Qt|=4,Kw(j.current),Ww(j,j.current,D,d),Qt=N,ad(0,!1),Hn&&typeof Hn.onPostCommitFiberRoot=="function")try{Hn.onPostCommitFiberRoot(lr,j)}catch{}return!0}finally{I.p=b,L.T=p,pC(o,l)}}function gC(o,l,d){l=wi(d,l),l=Av(o.stateNode,l,2),o=Ha(o,l,2),o!==null&&(Cn(o,2),jo(o))}function Zt(o,l,d){if(o.tag===3)gC(o,o,d);else for(;l!==null;){if(l.tag===3){gC(l,o,d);break}else if(l.tag===1){var p=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Ka===null||!Ka.has(p))){o=wi(d,o),d=vw(2),p=Ha(l,d,2),p!==null&&(yw(d,p,l,o),Cn(p,2),jo(p));break}}l=l.return}}function ty(o,l,d){var p=o.pingCache;if(p===null){p=o.pingCache=new P4;var b=new Set;p.set(l,b)}else b=p.get(l),b===void 0&&(b=new Set,p.set(l,b));b.has(d)||(Wv=!0,b.add(d),o=I4.bind(null,o,l,d),l.then(o,o))}function I4(o,l,d){var p=o.pingCache;p!==null&&p.delete(l),o.pingedLanes|=o.suspendedLanes&d,o.warmLanes&=~d,cn===o&&(Mt&d)===d&&(Un===4||Un===3&&(Mt&62914560)===Mt&&300>ft()-_h?(Qt&2)===0&&Cc(o,0):Qv|=d,jc===Mt&&(jc=0)),jo(o)}function vC(o,l){l===0&&(l=Mr()),o=Hs(o,l),o!==null&&(Cn(o,l),jo(o))}function z4(o){var l=o.memoizedState,d=0;l!==null&&(d=l.retryLane),vC(o,d)}function $4(o,l){var d=0;switch(o.tag){case 31:case 13:var p=o.stateNode,b=o.memoizedState;b!==null&&(d=b.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(l),vC(o,d)}function U4(o,l){return Ie(o,l)}var Mh=null,Tc=null,ny=!1,Lh=!1,ry=!1,Za=0;function jo(o){o!==Tc&&o.next===null&&(Tc===null?Mh=Tc=o:Tc=Tc.next=o),Lh=!0,ny||(ny=!0,V4())}function ad(o,l){if(!ry&&Lh){ry=!0;do for(var d=!1,p=Mh;p!==null;){if(o!==0){var b=p.pendingLanes;if(b===0)var j=0;else{var D=p.suspendedLanes,N=p.pingedLanes;j=(1<<31-zn(42|o)+1)-1,j&=b&~(D&~N),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(d=!0,SC(p,j))}else j=Mt,j=Ko(p,p===cn?j:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(j&3)===0||bi(p,j)||(d=!0,SC(p,j));p=p.next}while(d);ry=!1}}function B4(){yC()}function yC(){Lh=ny=!1;var o=0;Za!==0&&J4()&&(o=Za);for(var l=ft(),d=null,p=Mh;p!==null;){var b=p.next,j=xC(p,l);j===0?(p.next=null,d===null?Mh=b:d.next=b,b===null&&(Tc=d)):(d=p,(o!==0||(j&3)!==0)&&(Lh=!0)),p=b}ir!==0&&ir!==5||ad(o),Za!==0&&(Za=0)}function xC(o,l){for(var d=o.suspendedLanes,p=o.pingedLanes,b=o.expirationTimes,j=o.pendingLanes&-62914561;0<j;){var D=31-zn(j),N=1<<D,q=b[D];q===-1?((N&d)===0||(N&p)!==0)&&(b[D]=zs(N,l)):q<=l&&(o.expiredLanes|=N),j&=~N}if(l=cn,d=Mt,d=Ko(o,o===l?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,d===0||o===l&&(Jt===2||Jt===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&at(p),o.callbackNode=null,o.callbackPriority=0;if((d&3)===0||bi(o,d)){if(l=d&-d,l===o.callbackPriority)return l;switch(p!==null&&at(p),oe(d)){case 2:case 8:d=ke;break;case 32:d=Dt;break;case 268435456:d=At;break;default:d=Dt}return p=bC.bind(null,o),d=Ie(d,p),o.callbackPriority=l,o.callbackNode=d,l}return p!==null&&p!==null&&at(p),o.callbackPriority=2,o.callbackNode=null,2}function bC(o,l){if(ir!==0&&ir!==5)return o.callbackNode=null,o.callbackPriority=0,null;var d=o.callbackNode;if(Oh()&&o.callbackNode!==d)return null;var p=Mt;return p=Ko(o,o===cn?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(tC(o,p,l),xC(o,ft()),o.callbackNode!=null&&o.callbackNode===d?bC.bind(null,o):null)}function SC(o,l){if(Oh())return null;tC(o,l,!0)}function V4(){e3(function(){(Qt&6)!==0?Ie(he,B4):yC()})}function iy(){if(Za===0){var o=dc;o===0&&(o=Yi,Yi<<=1,(Yi&261888)===0&&(Yi=256)),Za=o}return Za}function jC(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Hf(""+o)}function wC(o,l){var d=l.ownerDocument.createElement("input");return d.name=l.name,d.value=l.value,o.id&&d.setAttribute("form",o.id),l.parentNode.insertBefore(d,l),o=new FormData(o),d.parentNode.removeChild(d),o}function F4(o,l,d,p,b){if(l==="submit"&&d&&d.stateNode===b){var j=jC((b[Ve]||null).action),D=p.submitter;D&&(l=(l=D[Ve]||null)?jC(l.formAction):D.getAttribute("formAction"),l!==null&&(j=l,D=null));var N=new Qf("action","action",null,p,b);o.push({event:N,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Za!==0){var q=D?wC(b,D):new FormData(b);Cv(d,{pending:!0,data:q,method:b.method,action:j},null,q)}}else typeof j=="function"&&(N.preventDefault(),q=D?wC(b,D):new FormData(b),Cv(d,{pending:!0,data:q,method:b.method,action:j},j,q))},currentTarget:b}]})}}for(var oy=0;oy<Bg.length;oy++){var ay=Bg[oy],H4=ay.toLowerCase(),q4=ay[0].toUpperCase()+ay.slice(1);Ji(H4,"on"+q4)}Ji(ej,"onAnimationEnd"),Ji(tj,"onAnimationIteration"),Ji(nj,"onAnimationStart"),Ji("dblclick","onDoubleClick"),Ji("focusin","onFocus"),Ji("focusout","onBlur"),Ji(s4,"onTransitionRun"),Ji(l4,"onTransitionStart"),Ji(c4,"onTransitionCancel"),Ji(rj,"onTransitionEnd"),vo("onMouseEnter",["mouseout","mouseover"]),vo("onMouseLeave",["mouseout","mouseover"]),vo("onPointerEnter",["pointerout","pointerover"]),vo("onPointerLeave",["pointerout","pointerover"]),cr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cr("onBeforeInput",["compositionend","keypress","textInput","paste"]),cr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),G4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sd));function CC(o,l){l=(l&4)!==0;for(var d=0;d<o.length;d++){var p=o[d],b=p.event;p=p.listeners;e:{var j=void 0;if(l)for(var D=p.length-1;0<=D;D--){var N=p[D],q=N.instance,ne=N.currentTarget;if(N=N.listener,q!==j&&b.isPropagationStopped())break e;j=N,b.currentTarget=ne;try{j(b)}catch(pe){Xf(pe)}b.currentTarget=null,j=q}else for(D=0;D<p.length;D++){if(N=p[D],q=N.instance,ne=N.currentTarget,N=N.listener,q!==j&&b.isPropagationStopped())break e;j=N,b.currentTarget=ne;try{j(b)}catch(pe){Xf(pe)}b.currentTarget=null,j=q}}}}function Pt(o,l){var d=l[tt];d===void 0&&(d=l[tt]=new Set);var p=o+"__bubble";d.has(p)||(EC(l,o,2,!1),d.add(p))}function sy(o,l,d){var p=0;l&&(p|=4),EC(d,o,p,l)}var Ih="_reactListening"+Math.random().toString(36).slice(2);function ly(o){if(!o[Ih]){o[Ih]=!0,La.forEach(function(d){d!=="selectionchange"&&(G4.has(d)||sy(d,!1,o),sy(d,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[Ih]||(l[Ih]=!0,sy("selectionchange",!1,l))}}function EC(o,l,d,p){switch(eE(l)){case 2:var b=b3;break;case 8:b=S3;break;default:b=wy}d=b.bind(null,l,d,o),b=void 0,!_g||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),p?b!==void 0?o.addEventListener(l,d,{capture:!0,passive:b}):o.addEventListener(l,d,!0):b!==void 0?o.addEventListener(l,d,{passive:b}):o.addEventListener(l,d,!1)}function cy(o,l,d,p,b){var j=p;if((l&1)===0&&(l&2)===0&&p!==null)e:for(;;){if(p===null)return;var D=p.tag;if(D===3||D===4){var N=p.stateNode.containerInfo;if(N===b)break;if(D===4)for(D=p.return;D!==null;){var q=D.tag;if((q===3||q===4)&&D.stateNode.containerInfo===b)return;D=D.return}for(;N!==null;){if(D=nt(N),D===null)return;if(q=D.tag,q===5||q===6||q===26||q===27){p=j=D;continue e}N=N.parentNode}}p=p.return}A1(function(){var ne=j,pe=Tg(d),ye=[];e:{var se=ij.get(o);if(se!==void 0){var ue=Qf,Qe=o;switch(o){case"keypress":if(Gf(d)===0)break e;case"keydown":case"keyup":ue=$O;break;case"focusin":Qe="focus",ue=Pg;break;case"focusout":Qe="blur",ue=Pg;break;case"beforeblur":case"afterblur":ue=Pg;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=N1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=RO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=VO;break;case ej:case tj:case nj:ue=AO;break;case rj:ue=HO;break;case"scroll":case"scrollend":ue=EO;break;case"wheel":ue=GO;break;case"copy":case"cut":case"paste":ue=PO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=M1;break;case"toggle":case"beforetoggle":ue=QO}var st=(l&4)!==0,sn=!st&&(o==="scroll"||o==="scrollend"),J=st?se!==null?se+"Capture":null:se;st=[];for(var Q=ne,te;Q!==null;){var me=Q;if(te=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||te===null||J===null||(me=Du(Q,J),me!=null&&st.push(ld(Q,me,te))),sn)break;Q=Q.return}0<st.length&&(se=new ue(se,Qe,null,d,pe),ye.push({event:se,listeners:st}))}}if((l&7)===0){e:{if(se=o==="mouseover"||o==="pointerover",ue=o==="mouseout"||o==="pointerout",se&&d!==Eg&&(Qe=d.relatedTarget||d.fromElement)&&(nt(Qe)||Qe[He]))break e;if((ue||se)&&(se=pe.window===pe?pe:(se=pe.ownerDocument)?se.defaultView||se.parentWindow:window,ue?(Qe=d.relatedTarget||d.toElement,ue=ne,Qe=Qe?nt(Qe):null,Qe!==null&&(sn=s(Qe),st=Qe.tag,Qe!==sn||st!==5&&st!==27&&st!==6)&&(Qe=null)):(ue=null,Qe=ne),ue!==Qe)){if(st=N1,me="onMouseLeave",J="onMouseEnter",Q="mouse",(o==="pointerout"||o==="pointerover")&&(st=M1,me="onPointerLeave",J="onPointerEnter",Q="pointer"),sn=ue==null?se:Ot(ue),te=Qe==null?se:Ot(Qe),se=new st(me,Q+"leave",ue,d,pe),se.target=sn,se.relatedTarget=te,me=null,nt(pe)===ne&&(st=new st(J,Q+"enter",Qe,d,pe),st.target=te,st.relatedTarget=sn,me=st),sn=me,ue&&Qe)t:{for(st=W4,J=ue,Q=Qe,te=0,me=J;me;me=st(me))te++;me=0;for(var it=Q;it;it=st(it))me++;for(;0<te-me;)J=st(J),te--;for(;0<me-te;)Q=st(Q),me--;for(;te--;){if(J===Q||Q!==null&&J===Q.alternate){st=J;break t}J=st(J),Q=st(Q)}st=null}else st=null;ue!==null&&TC(ye,se,ue,st,!1),Qe!==null&&sn!==null&&TC(ye,sn,Qe,st,!0)}}e:{if(se=ne?Ot(ne):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var qt=F1;else if(B1(se))if(H1)qt=i4;else{qt=n4;var Xe=t4}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&Cg(ne.elementType)&&(qt=F1):qt=r4;if(qt&&(qt=qt(o,ne))){V1(ye,qt,d,pe);break e}Xe&&Xe(o,se,ne),o==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&wg(se,"number",se.value)}switch(Xe=ne?Ot(ne):window,o){case"focusin":(B1(Xe)||Xe.contentEditable==="true")&&(rc=Xe,zg=ne,Iu=null);break;case"focusout":Iu=zg=rc=null;break;case"mousedown":$g=!0;break;case"contextmenu":case"mouseup":case"dragend":$g=!1,J1(ye,d,pe);break;case"selectionchange":if(a4)break;case"keydown":case"keyup":J1(ye,d,pe)}var St;if(Og)e:{switch(o){case"compositionstart":var Lt="onCompositionStart";break e;case"compositionend":Lt="onCompositionEnd";break e;case"compositionupdate":Lt="onCompositionUpdate";break e}Lt=void 0}else nc?$1(o,d)&&(Lt="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(Lt="onCompositionStart");Lt&&(L1&&d.locale!=="ko"&&(nc||Lt!=="onCompositionStart"?Lt==="onCompositionEnd"&&nc&&(St=k1()):(Ia=pe,Dg="value"in Ia?Ia.value:Ia.textContent,nc=!0)),Xe=zh(ne,Lt),0<Xe.length&&(Lt=new O1(Lt,o,null,d,pe),ye.push({event:Lt,listeners:Xe}),St?Lt.data=St:(St=U1(d),St!==null&&(Lt.data=St)))),(St=KO?XO(o,d):JO(o,d))&&(Lt=zh(ne,"onBeforeInput"),0<Lt.length&&(Xe=new O1("onBeforeInput","beforeinput",null,d,pe),ye.push({event:Xe,listeners:Lt}),Xe.data=St)),F4(ye,o,ne,d,pe)}CC(ye,l)})}function ld(o,l,d){return{instance:o,listener:l,currentTarget:d}}function zh(o,l){for(var d=l+"Capture",p=[];o!==null;){var b=o,j=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||j===null||(b=Du(o,d),b!=null&&p.unshift(ld(o,b,j)),b=Du(o,l),b!=null&&p.push(ld(o,b,j))),o.tag===3)return p;o=o.return}return[]}function W4(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function TC(o,l,d,p,b){for(var j=l._reactName,D=[];d!==null&&d!==p;){var N=d,q=N.alternate,ne=N.stateNode;if(N=N.tag,q!==null&&q===p)break;N!==5&&N!==26&&N!==27||ne===null||(q=ne,b?(ne=Du(d,j),ne!=null&&D.unshift(ld(d,ne,q))):b||(ne=Du(d,j),ne!=null&&D.push(ld(d,ne,q)))),d=d.return}D.length!==0&&o.push({event:l,listeners:D})}var Q4=/\r\n?/g,Y4=/\u0000|\uFFFD/g;function RC(o){return(typeof o=="string"?o:""+o).replace(Q4,`
214
+ `).replace(Y4,"")}function _C(o,l){return l=RC(l),RC(o)===l}function an(o,l,d,p,b,j){switch(d){case"children":typeof p=="string"?l==="body"||l==="textarea"&&p===""||Zl(o,p):(typeof p=="number"||typeof p=="bigint")&&l!=="body"&&Zl(o,""+p);break;case"className":Gn(o,"class",p);break;case"tabIndex":Gn(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(o,d,p);break;case"style":_1(o,p,j);break;case"data":if(l!=="object"){Gn(o,"data",p);break}case"src":case"href":if(p===""&&(l!=="a"||d!=="href")){o.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=Hf(""+p),o.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof j=="function"&&(d==="formAction"?(l!=="input"&&an(o,l,"name",b.name,b,null),an(o,l,"formEncType",b.formEncType,b,null),an(o,l,"formMethod",b.formMethod,b,null),an(o,l,"formTarget",b.formTarget,b,null)):(an(o,l,"encType",b.encType,b,null),an(o,l,"method",b.method,b,null),an(o,l,"target",b.target,b,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=Hf(""+p),o.setAttribute(d,p);break;case"onClick":p!=null&&(o.onclick=Xo);break;case"onScroll":p!=null&&Pt("scroll",o);break;case"onScrollEnd":p!=null&&Pt("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(b.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}d=Hf(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""+p):o.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""):o.removeAttribute(d);break;case"capture":case"download":p===!0?o.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,p):o.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(d,p):o.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(d):o.setAttribute(d,p);break;case"popover":Pt("beforetoggle",o),Pt("toggle",o),_t(o,"popover",p);break;case"xlinkActuate":Er(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Er(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Er(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Er(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Er(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Er(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Er(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Er(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Er(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":_t(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=wO.get(d)||d,_t(o,d,p))}}function uy(o,l,d,p,b,j){switch(d){case"style":_1(o,p,j);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(b.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"children":typeof p=="string"?Zl(o,p):(typeof p=="number"||typeof p=="bigint")&&Zl(o,""+p);break;case"onScroll":p!=null&&Pt("scroll",o);break;case"onScrollEnd":p!=null&&Pt("scrollend",o);break;case"onClick":p!=null&&(o.onclick=Xo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xi.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(b=d.endsWith("Capture"),l=d.slice(2,b?d.length-7:void 0),j=o[Ve]||null,j=j!=null?j[d]:null,typeof j=="function"&&o.removeEventListener(l,j,b),typeof p=="function")){typeof j!="function"&&j!==null&&(d in o?o[d]=null:o.hasAttribute(d)&&o.removeAttribute(d)),o.addEventListener(l,p,b);break e}d in o?o[d]=p:p===!0?o.setAttribute(d,""):_t(o,d,p)}}}function wr(o,l,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pt("error",o),Pt("load",o);var p=!1,b=!1,j;for(j in d)if(d.hasOwnProperty(j)){var D=d[j];if(D!=null)switch(j){case"src":p=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:an(o,l,j,D,d,null)}}b&&an(o,l,"srcSet",d.srcSet,d,null),p&&an(o,l,"src",d.src,d,null);return;case"input":Pt("invalid",o);var N=j=D=b=null,q=null,ne=null;for(p in d)if(d.hasOwnProperty(p)){var pe=d[p];if(pe!=null)switch(p){case"name":b=pe;break;case"type":D=pe;break;case"checked":q=pe;break;case"defaultChecked":ne=pe;break;case"value":j=pe;break;case"defaultValue":N=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,l));break;default:an(o,l,p,pe,d,null)}}C1(o,j,N,q,ne,D,b,!1);return;case"select":Pt("invalid",o),p=D=j=null;for(b in d)if(d.hasOwnProperty(b)&&(N=d[b],N!=null))switch(b){case"value":j=N;break;case"defaultValue":D=N;break;case"multiple":p=N;default:an(o,l,b,N,d,null)}l=j,d=D,o.multiple=!!p,l!=null?Jl(o,!!p,l,!1):d!=null&&Jl(o,!!p,d,!0);return;case"textarea":Pt("invalid",o),j=b=p=null;for(D in d)if(d.hasOwnProperty(D)&&(N=d[D],N!=null))switch(D){case"value":p=N;break;case"defaultValue":b=N;break;case"children":j=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:an(o,l,D,N,d,null)}T1(o,p,b,j);return;case"option":for(q in d)d.hasOwnProperty(q)&&(p=d[q],p!=null)&&(q==="selected"?o.selected=p&&typeof p!="function"&&typeof p!="symbol":an(o,l,q,p,d,null));return;case"dialog":Pt("beforetoggle",o),Pt("toggle",o),Pt("cancel",o),Pt("close",o);break;case"iframe":case"object":Pt("load",o);break;case"video":case"audio":for(p=0;p<sd.length;p++)Pt(sd[p],o);break;case"image":Pt("error",o),Pt("load",o);break;case"details":Pt("toggle",o);break;case"embed":case"source":case"link":Pt("error",o),Pt("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in d)if(d.hasOwnProperty(ne)&&(p=d[ne],p!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:an(o,l,ne,p,d,null)}return;default:if(Cg(l)){for(pe in d)d.hasOwnProperty(pe)&&(p=d[pe],p!==void 0&&uy(o,l,pe,p,d,void 0));return}}for(N in d)d.hasOwnProperty(N)&&(p=d[N],p!=null&&an(o,l,N,p,d,null))}function K4(o,l,d,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,j=null,D=null,N=null,q=null,ne=null,pe=null;for(ue in d){var ye=d[ue];if(d.hasOwnProperty(ue)&&ye!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":q=ye;default:p.hasOwnProperty(ue)||an(o,l,ue,null,p,ye)}}for(var se in p){var ue=p[se];if(ye=d[se],p.hasOwnProperty(se)&&(ue!=null||ye!=null))switch(se){case"type":j=ue;break;case"name":b=ue;break;case"checked":ne=ue;break;case"defaultChecked":pe=ue;break;case"value":D=ue;break;case"defaultValue":N=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,l));break;default:ue!==ye&&an(o,l,se,ue,p,ye)}}jg(o,D,N,q,ne,pe,j,b);return;case"select":ue=D=N=se=null;for(j in d)if(q=d[j],d.hasOwnProperty(j)&&q!=null)switch(j){case"value":break;case"multiple":ue=q;default:p.hasOwnProperty(j)||an(o,l,j,null,p,q)}for(b in p)if(j=p[b],q=d[b],p.hasOwnProperty(b)&&(j!=null||q!=null))switch(b){case"value":se=j;break;case"defaultValue":N=j;break;case"multiple":D=j;default:j!==q&&an(o,l,b,j,p,q)}l=N,d=D,p=ue,se!=null?Jl(o,!!d,se,!1):!!p!=!!d&&(l!=null?Jl(o,!!d,l,!0):Jl(o,!!d,d?[]:"",!1));return;case"textarea":ue=se=null;for(N in d)if(b=d[N],d.hasOwnProperty(N)&&b!=null&&!p.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:an(o,l,N,null,p,b)}for(D in p)if(b=p[D],j=d[D],p.hasOwnProperty(D)&&(b!=null||j!=null))switch(D){case"value":se=b;break;case"defaultValue":ue=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==j&&an(o,l,D,b,p,j)}E1(o,se,ue);return;case"option":for(var Qe in d)se=d[Qe],d.hasOwnProperty(Qe)&&se!=null&&!p.hasOwnProperty(Qe)&&(Qe==="selected"?o.selected=!1:an(o,l,Qe,null,p,se));for(q in p)se=p[q],ue=d[q],p.hasOwnProperty(q)&&se!==ue&&(se!=null||ue!=null)&&(q==="selected"?o.selected=se&&typeof se!="function"&&typeof se!="symbol":an(o,l,q,se,p,ue));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var st in d)se=d[st],d.hasOwnProperty(st)&&se!=null&&!p.hasOwnProperty(st)&&an(o,l,st,null,p,se);for(ne in p)if(se=p[ne],ue=d[ne],p.hasOwnProperty(ne)&&se!==ue&&(se!=null||ue!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,l));break;default:an(o,l,ne,se,p,ue)}return;default:if(Cg(l)){for(var sn in d)se=d[sn],d.hasOwnProperty(sn)&&se!==void 0&&!p.hasOwnProperty(sn)&&uy(o,l,sn,void 0,p,se);for(pe in p)se=p[pe],ue=d[pe],!p.hasOwnProperty(pe)||se===ue||se===void 0&&ue===void 0||uy(o,l,pe,se,p,ue);return}}for(var J in d)se=d[J],d.hasOwnProperty(J)&&se!=null&&!p.hasOwnProperty(J)&&an(o,l,J,null,p,se);for(ye in p)se=p[ye],ue=d[ye],!p.hasOwnProperty(ye)||se===ue||se==null&&ue==null||an(o,l,ye,se,p,ue)}function DC(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function X4(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var b=d[p],j=b.transferSize,D=b.initiatorType,N=b.duration;if(j&&N&&DC(D)){for(D=0,N=b.responseEnd,p+=1;p<d.length;p++){var q=d[p],ne=q.startTime;if(ne>N)break;var pe=q.transferSize,ye=q.initiatorType;pe&&DC(ye)&&(q=q.responseEnd,D+=pe*(q<N?1:(N-ne)/(q-ne)))}if(--p,l+=8*(j+D)/(b.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var dy=null,fy=null;function $h(o){return o.nodeType===9?o:o.ownerDocument}function AC(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function kC(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function hy(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var py=null;function J4(){var o=window.event;return o&&o.type==="popstate"?o===py?!1:(py=o,!0):(py=null,!1)}var PC=typeof setTimeout=="function"?setTimeout:void 0,Z4=typeof clearTimeout=="function"?clearTimeout:void 0,NC=typeof Promise=="function"?Promise:void 0,e3=typeof queueMicrotask=="function"?queueMicrotask:typeof NC<"u"?function(o){return NC.resolve(null).then(o).catch(t3)}:PC;function t3(o){setTimeout(function(){throw o})}function es(o){return o==="head"}function OC(o,l){var d=l,p=0;do{var b=d.nextSibling;if(o.removeChild(d),b&&b.nodeType===8)if(d=b.data,d==="/$"||d==="/&"){if(p===0){o.removeChild(b),Ac(l);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")cd(o.ownerDocument.documentElement);else if(d==="head"){d=o.ownerDocument.head,cd(d);for(var j=d.firstChild;j;){var D=j.nextSibling,N=j.nodeName;j[bt]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&j.rel.toLowerCase()==="stylesheet"||d.removeChild(j),j=D}}else d==="body"&&cd(o.ownerDocument.body);d=b}while(d);Ac(l)}function MC(o,l){var d=o;o=0;do{var p=d.nextSibling;if(d.nodeType===1?l?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(l?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),p&&p.nodeType===8)if(d=p.data,d==="/$"){if(o===0)break;o--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||o++;d=p}while(d)}function my(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var d=l;switch(l=l.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":my(d),Xt(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}o.removeChild(d)}}function n3(o,l,d,p){for(;o.nodeType===1;){var b=d;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[bt])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(j=o.getAttribute("rel"),j==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(j!==b.rel||o.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||o.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||o.getAttribute("title")!==(b.title==null?null:b.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(j=o.getAttribute("src"),(j!==(b.src==null?null:b.src)||o.getAttribute("type")!==(b.type==null?null:b.type)||o.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&j&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var j=b.name==null?null:""+b.name;if(b.type==="hidden"&&o.getAttribute("name")===j)return o}else return o;if(o=_i(o.nextSibling),o===null)break}return null}function r3(o,l,d){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!d||(o=_i(o.nextSibling),o===null))return null;return o}function LC(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=_i(o.nextSibling),o===null))return null;return o}function gy(o){return o.data==="$?"||o.data==="$~"}function vy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function i3(o,l){var d=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||d.readyState!=="loading")l();else{var p=function(){l(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function _i(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var yy=null;function IC(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"||d==="/&"){if(l===0)return _i(o.nextSibling);l--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||l++}o=o.nextSibling}return null}function zC(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(l===0)return o;l--}else d!=="/$"&&d!=="/&"||l++}o=o.previousSibling}return null}function $C(o,l,d){switch(l=$h(d),o){case"html":if(o=l.documentElement,!o)throw Error(r(452));return o;case"head":if(o=l.head,!o)throw Error(r(453));return o;case"body":if(o=l.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function cd(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);Xt(o)}var Di=new Map,UC=new Set;function Uh(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ha=I.d;I.d={f:o3,r:a3,D:s3,C:l3,L:c3,m:u3,X:f3,S:d3,M:h3};function o3(){var o=ha.f(),l=kh();return o||l}function a3(o){var l=yn(o);l!==null&&l.tag===5&&l.type==="form"?rw(l):ha.r(o)}var Rc=typeof document>"u"?null:document;function BC(o,l,d){var p=Rc;if(p&&typeof l=="string"&&l){var b=Si(l);b='link[rel="'+o+'"][href="'+b+'"]',typeof d=="string"&&(b+='[crossorigin="'+d+'"]'),UC.has(b)||(UC.add(b),o={rel:o,crossOrigin:d,href:l},p.querySelector(b)===null&&(l=p.createElement("link"),wr(l,"link",o),xn(l),p.head.appendChild(l)))}}function s3(o){ha.D(o),BC("dns-prefetch",o,null)}function l3(o,l){ha.C(o,l),BC("preconnect",o,l)}function c3(o,l,d){ha.L(o,l,d);var p=Rc;if(p&&o&&l){var b='link[rel="preload"][as="'+Si(l)+'"]';l==="image"&&d&&d.imageSrcSet?(b+='[imagesrcset="'+Si(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(b+='[imagesizes="'+Si(d.imageSizes)+'"]')):b+='[href="'+Si(o)+'"]';var j=b;switch(l){case"style":j=_c(o);break;case"script":j=Dc(o)}Di.has(j)||(o=g({rel:"preload",href:l==="image"&&d&&d.imageSrcSet?void 0:o,as:l},d),Di.set(j,o),p.querySelector(b)!==null||l==="style"&&p.querySelector(ud(j))||l==="script"&&p.querySelector(dd(j))||(l=p.createElement("link"),wr(l,"link",o),xn(l),p.head.appendChild(l)))}}function u3(o,l){ha.m(o,l);var d=Rc;if(d&&o){var p=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+Si(p)+'"][href="'+Si(o)+'"]',j=b;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Dc(o)}if(!Di.has(j)&&(o=g({rel:"modulepreload",href:o},l),Di.set(j,o),d.querySelector(b)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(dd(j)))return}p=d.createElement("link"),wr(p,"link",o),xn(p),d.head.appendChild(p)}}}function d3(o,l,d){ha.S(o,l,d);var p=Rc;if(p&&o){var b=qn(p).hoistableStyles,j=_c(o);l=l||"default";var D=b.get(j);if(!D){var N={loading:0,preload:null};if(D=p.querySelector(ud(j)))N.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":l},d),(d=Di.get(j))&&xy(o,d);var q=D=p.createElement("link");xn(q),wr(q,"link",o),q._p=new Promise(function(ne,pe){q.onload=ne,q.onerror=pe}),q.addEventListener("load",function(){N.loading|=1}),q.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Bh(D,l,p)}D={type:"stylesheet",instance:D,count:1,state:N},b.set(j,D)}}}function f3(o,l){ha.X(o,l);var d=Rc;if(d&&o){var p=qn(d).hoistableScripts,b=Dc(o),j=p.get(b);j||(j=d.querySelector(dd(b)),j||(o=g({src:o,async:!0},l),(l=Di.get(b))&&by(o,l),j=d.createElement("script"),xn(j),wr(j,"link",o),d.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},p.set(b,j))}}function h3(o,l){ha.M(o,l);var d=Rc;if(d&&o){var p=qn(d).hoistableScripts,b=Dc(o),j=p.get(b);j||(j=d.querySelector(dd(b)),j||(o=g({src:o,async:!0,type:"module"},l),(l=Di.get(b))&&by(o,l),j=d.createElement("script"),xn(j),wr(j,"link",o),d.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},p.set(b,j))}}function VC(o,l,d,p){var b=(b=Ce.current)?Uh(b):null;if(!b)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(l=_c(d.href),d=qn(b).hoistableStyles,p=d.get(l),p||(p={type:"style",instance:null,count:0,state:null},d.set(l,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){o=_c(d.href);var j=qn(b).hoistableStyles,D=j.get(o);if(D||(b=b.ownerDocument||b,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(o,D),(j=b.querySelector(ud(o)))&&!j._p&&(D.instance=j,D.state.loading=5),Di.has(o)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Di.set(o,d),j||p3(b,o,d,D.state))),l&&p===null)throw Error(r(528,""));return D}if(l&&p!==null)throw Error(r(529,""));return null;case"script":return l=d.async,d=d.src,typeof d=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Dc(d),d=qn(b).hoistableScripts,p=d.get(l),p||(p={type:"script",instance:null,count:0,state:null},d.set(l,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function _c(o){return'href="'+Si(o)+'"'}function ud(o){return'link[rel="stylesheet"]['+o+"]"}function FC(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function p3(o,l,d,p){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?p.loading=1:(l=o.createElement("link"),p.preload=l,l.addEventListener("load",function(){return p.loading|=1}),l.addEventListener("error",function(){return p.loading|=2}),wr(l,"link",d),xn(l),o.head.appendChild(l))}function Dc(o){return'[src="'+Si(o)+'"]'}function dd(o){return"script[async]"+o}function HC(o,l,d){if(l.count++,l.instance===null)switch(l.type){case"style":var p=o.querySelector('style[data-href~="'+Si(d.href)+'"]');if(p)return l.instance=p,xn(p),p;var b=g({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),xn(p),wr(p,"style",b),Bh(p,d.precedence,o),l.instance=p;case"stylesheet":b=_c(d.href);var j=o.querySelector(ud(b));if(j)return l.state.loading|=4,l.instance=j,xn(j),j;p=FC(d),(b=Di.get(b))&&xy(p,b),j=(o.ownerDocument||o).createElement("link"),xn(j);var D=j;return D._p=new Promise(function(N,q){D.onload=N,D.onerror=q}),wr(j,"link",p),l.state.loading|=4,Bh(j,d.precedence,o),l.instance=j;case"script":return j=Dc(d.src),(b=o.querySelector(dd(j)))?(l.instance=b,xn(b),b):(p=d,(b=Di.get(j))&&(p=g({},d),by(p,b)),o=o.ownerDocument||o,b=o.createElement("script"),xn(b),wr(b,"link",p),o.head.appendChild(b),l.instance=b);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(p=l.instance,l.state.loading|=4,Bh(p,d.precedence,o));return l.instance}function Bh(o,l,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=p.length?p[p.length-1]:null,j=b,D=0;D<p.length;D++){var N=p[D];if(N.dataset.precedence===l)j=N;else if(j!==b)break}j?j.parentNode.insertBefore(o,j.nextSibling):(l=d.nodeType===9?d.head:d,l.insertBefore(o,l.firstChild))}function xy(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function by(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Vh=null;function qC(o,l,d){if(Vh===null){var p=new Map,b=Vh=new Map;b.set(d,p)}else b=Vh,p=b.get(d),p||(p=new Map,b.set(d,p));if(p.has(o))return p;for(p.set(o,null),d=d.getElementsByTagName(o),b=0;b<d.length;b++){var j=d[b];if(!(j[bt]||j[Pe]||o==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var D=j.getAttribute(l)||"";D=o+D;var N=p.get(D);N?N.push(j):p.set(D,[j])}}return p}function GC(o,l,d){o=o.ownerDocument||o,o.head.insertBefore(d,l==="title"?o.querySelector("head > title"):null)}function m3(o,l,d){if(d===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(o=l.disabled,typeof l.precedence=="string"&&o==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function WC(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function g3(o,l,d,p){if(d.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var b=_c(p.href),j=l.querySelector(ud(b));if(j){l=j._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Fh.bind(o),l.then(o,o)),d.state.loading|=4,d.instance=j,xn(j);return}j=l.ownerDocument||l,p=FC(p),(b=Di.get(b))&&xy(p,b),j=j.createElement("link"),xn(j);var D=j;D._p=new Promise(function(N,q){D.onload=N,D.onerror=q}),wr(j,"link",p),d.instance=j}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(o.count++,d=Fh.bind(o),l.addEventListener("load",d),l.addEventListener("error",d))}}var Sy=0;function v3(o,l){return o.stylesheets&&o.count===0&&qh(o,o.stylesheets),0<o.count||0<o.imgCount?function(d){var p=setTimeout(function(){if(o.stylesheets&&qh(o,o.stylesheets),o.unsuspend){var j=o.unsuspend;o.unsuspend=null,j()}},6e4+l);0<o.imgBytes&&Sy===0&&(Sy=62500*X4());var b=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&qh(o,o.stylesheets),o.unsuspend)){var j=o.unsuspend;o.unsuspend=null,j()}},(o.imgBytes>Sy?50:800)+l);return o.unsuspend=d,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(b)}}:null}function Fh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Hh=null;function qh(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Hh=new Map,l.forEach(y3,o),Hh=null,Fh.call(o))}function y3(o,l){if(!(l.state.loading&4)){var d=Hh.get(o);if(d)var p=d.get(null);else{d=new Map,Hh.set(o,d);for(var b=o.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<b.length;j++){var D=b[j];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(d.set(D.dataset.precedence,D),p=D)}p&&d.set(null,p)}b=l.instance,D=b.getAttribute("data-precedence"),j=d.get(D)||p,j===p&&d.set(null,b),d.set(D,b),this.count++,p=Fh.bind(this),b.addEventListener("load",p),b.addEventListener("error",p),j?j.parentNode.insertBefore(b,j.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(b,o.firstChild)),l.state.loading|=4}}var fd={$$typeof:E,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function x3(o,l,d,p,b,j,D,N,q){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ki(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ki(0),this.hiddenUpdates=Ki(null),this.identifierPrefix=p,this.onUncaughtError=b,this.onCaughtError=j,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function QC(o,l,d,p,b,j,D,N,q,ne,pe,ye){return o=new x3(o,l,d,D,q,ne,pe,ye,N),l=1,j===!0&&(l|=24),j=ai(3,null,null,l),o.current=j,j.stateNode=o,l=ev(),l.refCount++,o.pooledCache=l,l.refCount++,j.memoizedState={element:p,isDehydrated:d,cache:l},iv(j),o}function YC(o){return o?(o=ac,o):ac}function KC(o,l,d,p,b,j){b=YC(b),p.context===null?p.context=b:p.pendingContext=b,p=Fa(l),p.payload={element:d},j=j===void 0?null:j,j!==null&&(p.callback=j),d=Ha(o,p,l),d!==null&&(Kr(d,o,l),Hu(d,o,l))}function XC(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<l?d:l}}function jy(o,l){XC(o,l),(o=o.alternate)&&XC(o,l)}function JC(o){if(o.tag===13||o.tag===31){var l=Hs(o,67108864);l!==null&&Kr(l,o,67108864),jy(o,67108864)}}function ZC(o){if(o.tag===13||o.tag===31){var l=di();l=Y(l);var d=Hs(o,l);d!==null&&Kr(d,o,l),jy(o,l)}}var Gh=!0;function b3(o,l,d,p){var b=L.T;L.T=null;var j=I.p;try{I.p=2,wy(o,l,d,p)}finally{I.p=j,L.T=b}}function S3(o,l,d,p){var b=L.T;L.T=null;var j=I.p;try{I.p=8,wy(o,l,d,p)}finally{I.p=j,L.T=b}}function wy(o,l,d,p){if(Gh){var b=Cy(p);if(b===null)cy(o,l,p,Wh,d),tE(o,p);else if(w3(b,o,l,d,p))p.stopPropagation();else if(tE(o,p),l&4&&-1<j3.indexOf(o)){for(;b!==null;){var j=yn(b);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var D=ii(j.pendingLanes);if(D!==0){var N=j;for(N.pendingLanes|=2,N.entangledLanes|=2;D;){var q=1<<31-zn(D);N.entanglements[1]|=q,D&=~q}jo(j),(Qt&6)===0&&(Dh=ft()+500,ad(0))}}break;case 31:case 13:N=Hs(j,2),N!==null&&Kr(N,j,2),kh(),jy(j,2)}if(j=Cy(p),j===null&&cy(o,l,p,Wh,d),j===b)break;b=j}b!==null&&p.stopPropagation()}else cy(o,l,p,null,d)}}function Cy(o){return o=Tg(o),Ey(o)}var Wh=null;function Ey(o){if(Wh=null,o=nt(o),o!==null){var l=s(o);if(l===null)o=null;else{var d=l.tag;if(d===13){if(o=c(l),o!==null)return o;o=null}else if(d===31){if(o=u(l),o!==null)return o;o=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return Wh=o,null}function eE(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ee()){case he:return 2;case ke:return 8;case Dt:case Rt:return 32;case At:return 268435456;default:return 32}default:return 32}}var Ty=!1,ts=null,ns=null,rs=null,hd=new Map,pd=new Map,is=[],j3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function tE(o,l){switch(o){case"focusin":case"focusout":ts=null;break;case"dragenter":case"dragleave":ns=null;break;case"mouseover":case"mouseout":rs=null;break;case"pointerover":case"pointerout":hd.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":pd.delete(l.pointerId)}}function md(o,l,d,p,b,j){return o===null||o.nativeEvent!==j?(o={blockedOn:l,domEventName:d,eventSystemFlags:p,nativeEvent:j,targetContainers:[b]},l!==null&&(l=yn(l),l!==null&&JC(l)),o):(o.eventSystemFlags|=p,l=o.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),o)}function w3(o,l,d,p,b){switch(l){case"focusin":return ts=md(ts,o,l,d,p,b),!0;case"dragenter":return ns=md(ns,o,l,d,p,b),!0;case"mouseover":return rs=md(rs,o,l,d,p,b),!0;case"pointerover":var j=b.pointerId;return hd.set(j,md(hd.get(j)||null,o,l,d,p,b)),!0;case"gotpointercapture":return j=b.pointerId,pd.set(j,md(pd.get(j)||null,o,l,d,p,b)),!0}return!1}function nE(o){var l=nt(o.target);if(l!==null){var d=s(l);if(d!==null){if(l=d.tag,l===13){if(l=c(d),l!==null){o.blockedOn=l,De(o.priority,function(){ZC(d)});return}}else if(l===31){if(l=u(d),l!==null){o.blockedOn=l,De(o.priority,function(){ZC(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Qh(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var d=Cy(o.nativeEvent);if(d===null){d=o.nativeEvent;var p=new d.constructor(d.type,d);Eg=p,d.target.dispatchEvent(p),Eg=null}else return l=yn(d),l!==null&&JC(l),o.blockedOn=d,!1;l.shift()}return!0}function rE(o,l,d){Qh(o)&&d.delete(l)}function C3(){Ty=!1,ts!==null&&Qh(ts)&&(ts=null),ns!==null&&Qh(ns)&&(ns=null),rs!==null&&Qh(rs)&&(rs=null),hd.forEach(rE),pd.forEach(rE)}function Yh(o,l){o.blockedOn===l&&(o.blockedOn=null,Ty||(Ty=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,C3)))}var Kh=null;function iE(o){Kh!==o&&(Kh=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Kh===o&&(Kh=null);for(var l=0;l<o.length;l+=3){var d=o[l],p=o[l+1],b=o[l+2];if(typeof p!="function"){if(Ey(p||d)===null)continue;break}var j=yn(d);j!==null&&(o.splice(l,3),l-=3,Cv(j,{pending:!0,data:b,method:d.method,action:p},p,b))}}))}function Ac(o){function l(q){return Yh(q,o)}ts!==null&&Yh(ts,o),ns!==null&&Yh(ns,o),rs!==null&&Yh(rs,o),hd.forEach(l),pd.forEach(l);for(var d=0;d<is.length;d++){var p=is[d];p.blockedOn===o&&(p.blockedOn=null)}for(;0<is.length&&(d=is[0],d.blockedOn===null);)nE(d),d.blockedOn===null&&is.shift();if(d=(o.ownerDocument||o).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var b=d[p],j=d[p+1],D=b[Ve]||null;if(typeof j=="function")D||iE(d);else if(D){var N=null;if(j&&j.hasAttribute("formAction")){if(b=j,D=j[Ve]||null)N=D.formAction;else if(Ey(b)!==null)continue}else N=D.action;typeof N=="function"?d[p+1]=N:(d.splice(p,3),p-=3),iE(d)}}}function oE(){function o(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(D){return b=D})},focusReset:"manual",scroll:"manual"})}function l(){b!==null&&(b(),b=null),p||setTimeout(d,20)}function d(){if(!p&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,b=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function Ry(o){this._internalRoot=o}Xh.prototype.render=Ry.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(r(409));var d=l.current,p=di();KC(d,p,o,l,null,null)},Xh.prototype.unmount=Ry.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;KC(o.current,2,null,o,null,null),kh(),l[He]=null}};function Xh(o){this._internalRoot=o}Xh.prototype.unstable_scheduleHydration=function(o){if(o){var l=we();o={blockedOn:null,target:o,priority:l};for(var d=0;d<is.length&&l!==0&&l<is[d].priority;d++);is.splice(d,0,o),d===0&&nE(o)}};var aE=t.version;if(aE!=="19.2.4")throw Error(r(527,aE,"19.2.4"));I.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=h(l),o=o!==null?m(o):null,o=o===null?null:o.stateNode,o};var E3={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{lr=Jh.inject(E3),Hn=Jh}catch{}}return bd.createRoot=function(o,l){if(!i(o))throw Error(r(299));var d=!1,p="",b=hw,j=pw,D=mw;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(b=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(D=l.onRecoverableError)),l=QC(o,1,!1,null,null,d,p,null,b,j,D,oE),o[He]=l.current,ly(o),new Ry(l)},bd.hydrateRoot=function(o,l,d){if(!i(o))throw Error(r(299));var p=!1,b="",j=hw,D=pw,N=mw,q=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onUncaughtError!==void 0&&(j=d.onUncaughtError),d.onCaughtError!==void 0&&(D=d.onCaughtError),d.onRecoverableError!==void 0&&(N=d.onRecoverableError),d.formState!==void 0&&(q=d.formState)),l=QC(o,1,!0,l,d??null,p,b,q,j,D,N,oE),l.context=YC(null),d=l.current,p=di(),p=Y(p),b=Fa(p),b.callback=null,Ha(d,b,p),d=p,l.current.lanes=d,Cn(l,d),jo(l),o[He]=l.current,ly(o),new Xh(l)},bd.version="19.2.4",bd}var qR;function Dee(){if(qR)return hx.exports;qR=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),hx.exports=_ee(),hx.exports}var Aee=Dee();var vN=e=>{throw TypeError(e)},kee=(e,t,n)=>t.has(e)||vN("Cannot "+n),gx=(e,t,n)=>(kee(e,t,"read from private field"),n?n.call(e):t.get(e)),Pee=(e,t,n)=>t.has(e)?vN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),GR="popstate";function WR(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Nee(e={}){function t(r,i){let s=i.state?.masked,{pathname:c,search:u,hash:f}=s||r.location;return Zd("",{pathname:c,search:u,hash:f},i.state&&i.state.usr||null,i.state&&i.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:Vo(i)}return Mee(t,n,null,e)}function yt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Bn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Oee(){return Math.random().toString(36).substring(2,10)}function QR(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Zd(e,t,n=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Wo(t):t,state:n,key:t&&t.key||r||Oee(),unstable_mask:i}}function Vo({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Wo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Mee(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,c=i.history,u="POP",f=null,h=m();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function m(){return(c.state||{idx:null}).idx}function g(){u="POP";let C=m(),T=C==null?null:C-h;h=C,f&&f({action:u,location:w.location,delta:T})}function y(C,T){u="PUSH";let R=WR(C)?C:Zd(w.location,C,T);h=m()+1;let E=QR(R,h),_=w.createHref(R.unstable_mask||R);try{c.pushState(E,"",_)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;i.location.assign(_)}s&&f&&f({action:u,location:w.location,delta:1})}function x(C,T){u="REPLACE";let R=WR(C)?C:Zd(w.location,C,T);h=m();let E=QR(R,h),_=w.createHref(R.unstable_mask||R);c.replaceState(E,"",_),s&&f&&f({action:u,location:w.location,delta:0})}function S(C){return yN(C)}let w={get action(){return u},get location(){return e(i,c)},listen(C){if(f)throw new Error("A history only accepts one active listener");return i.addEventListener(GR,g),f=C,()=>{i.removeEventListener(GR,g),f=null}},createHref(C){return t(i,C)},createURL:S,encodeLocation(C){let T=S(C);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:y,replace:x,go(C){return c.go(C)}};return w}function yN(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),yt(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Vo(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Rd,YR=class{constructor(e){if(Pee(this,Rd,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(gx(this,Rd).has(e))return gx(this,Rd).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){gx(this,Rd).set(e,t)}};Rd=new WeakMap;var Lee=new Set(["lazy","caseSensitive","path","id","index","children"]);function Iee(e){return Lee.has(e)}var zee=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function $ee(e){return zee.has(e)}function Uee(e){return e.index===!0}function ef(e,t,n=[],r={},i=!1){return e.map((s,c)=>{let u=[...n,String(c)],f=typeof s.id=="string"?s.id:u.join("-");if(yt(s.index!==!0||!s.children,"Cannot specify children on an index route"),yt(i||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),Uee(s)){let h={...s,id:f};return r[f]=KR(h,t(h)),h}else{let h={...s,id:f,children:void 0};return r[f]=KR(h,t(h)),s.children&&(h.children=ef(s.children,t,u,r,i)),h}})}function KR(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function ps(e,t,n="/"){return _d(e,t,n,!1)}function _d(e,t,n,r){let i=typeof t=="string"?Wo(t):t,s=Bi(i.pathname||"/",n);if(s==null)return null;let c=xN(e);Vee(c);let u=null;for(let f=0;u==null&&f<c.length;++f){let h=Zee(s);u=Xee(c[f],h,r)}return u}function Bee(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function xN(e,t=[],n=[],r="",i=!1){let s=(c,u,f=i,h)=>{let m={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&f)return;yt(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let g=so([r,m.relativePath]),y=n.concat(m);c.children&&c.children.length>0&&(yt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),xN(c.children,t,y,g,f)),!(c.path==null&&!c.index)&&t.push({path:g,score:Yee(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{if(c.path===""||!c.path?.includes("?"))s(c,u);else for(let f of bN(c.path))s(c,u,!0,f)}),t}function bN(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let c=bN(r.join("/")),u=[];return u.push(...c.map(f=>f===""?s:[s,f].join("/"))),i&&u.push(...c),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function Vee(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Kee(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Fee=/^:[\w-]+$/,Hee=3,qee=2,Gee=1,Wee=10,Qee=-2,XR=e=>e==="*";function Yee(e,t){let n=e.split("/"),r=n.length;return n.some(XR)&&(r+=Qee),t&&(r+=qee),n.filter(i=>!XR(i)).reduce((i,s)=>i+(Fee.test(s)?Hee:s===""?Gee:Wee),r)}function Kee(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function Xee(e,t,n=!1){let{routesMeta:r}=e,i={},s="/",c=[];for(let u=0;u<r.length;++u){let f=r[u],h=u===r.length-1,m=s==="/"?t:t.slice(s.length)||"/",g=rm({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},m),y=f.route;if(!g&&h&&n&&!r[r.length-1].route.index&&(g=rm({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!g)return null;Object.assign(i,g.params),c.push({params:i,pathname:so([s,g.pathname]),pathnameBase:nte(so([s,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(s=so([s,g.pathnameBase]))}return c}function rm(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Jee(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let s=i[0],c=s.replace(/(.)\/+$/,"$1"),u=i.slice(1);return{params:r.reduce((h,{paramName:m,isOptional:g},y)=>{if(m==="*"){let S=u[y]||"";c=s.slice(0,s.length-S.length).replace(/(.)\/+$/,"$1")}const x=u[y];return g&&!x?h[m]=void 0:h[m]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:s,pathnameBase:c,pattern:e}}function Jee(e,t=!1,n=!0){Bn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,f,h,m)=>{if(r.push({paramName:u,isOptional:f!=null}),f){let g=m.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function Zee(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Bn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Bi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function ete({basename:e,pathname:t}){return t==="/"?e:so([e,t])}var SN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,o1=e=>SN.test(e);function tte(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Wo(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=JR(n.substring(1),"/"):s=JR(n,t)):s=t,{pathname:s,search:rte(r),hash:ite(i)}}function JR(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function vx(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function jN(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function xg(e){let t=jN(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Mf(e,t,n,r=!1){let i;typeof e=="string"?i=Wo(e):(i={...e},yt(!i.pathname||!i.pathname.includes("?"),vx("?","pathname","search",i)),yt(!i.pathname||!i.pathname.includes("#"),vx("#","pathname","hash",i)),yt(!i.search||!i.search.includes("#"),vx("#","search","hash",i)));let s=e===""||i.pathname==="",c=s?"/":i.pathname,u;if(c==null)u=n;else{let g=t.length-1;if(!r&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),g-=1;i.pathname=y.join("/")}u=g>=0?t[g]:"/"}let f=tte(i,u),h=c&&c!=="/"&&c.endsWith("/"),m=(s||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||m)&&(f.pathname+="/"),f}var so=e=>e.join("/").replace(/\/\/+/g,"/"),nte=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),rte=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ite=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Lf=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function tf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function If(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var wN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function CN(e,t){let n=e;if(typeof n!="string"||!SN.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(wN)try{let s=new URL(window.location.href),c=n.startsWith("//")?new URL(s.protocol+n):new URL(n),u=Bi(c.pathname,t);c.origin===s.origin&&u!=null?n=u+c.search+c.hash:i=!0}catch{Bn(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var ys=Symbol("Uninstrumented");function ote(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(i=>i({id:t.id,index:t.index,path:t.path,instrument(s){let c=Object.keys(n);for(let u of c)s[u]&&n[u].push(s[u])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let i=Wc(n.lazy,t.lazy,()=>{});i&&(r.lazy=i)}if(typeof t.lazy=="object"){let i=t.lazy;["middleware","loader","action"].forEach(s=>{let c=i[s],u=n[`lazy.${s}`];if(typeof c=="function"&&u.length>0){let f=Wc(u,c,()=>{});f&&(r.lazy=Object.assign(r.lazy||{},{[s]:f}))}})}return["loader","action"].forEach(i=>{let s=t[i];if(typeof s=="function"&&n[i].length>0){let c=s[ys]??s,u=Wc(n[i],c,(...f)=>ZR(f[0]));u&&(i==="loader"&&c.hydrate===!0&&(u.hydrate=!0),u[ys]=c,r[i]=u)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(i=>{let s=i[ys]??i,c=Wc(n.middleware,s,(...u)=>ZR(u[0]));return c?(c[ys]=s,c):i})),r}function ate(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(i){let s=Object.keys(i);for(let c of s)i[c]&&n[c].push(i[c])}})),n.navigate.length>0){let r=e.navigate[ys]??e.navigate,i=Wc(n.navigate,r,(...s)=>{let[c,u]=s;return{to:typeof c=="number"||typeof c=="string"?c:c?Vo(c):".",...e_(e,u??{})}});i&&(i[ys]=r,e.navigate=i)}if(n.fetch.length>0){let r=e.fetch[ys]??e.fetch,i=Wc(n.fetch,r,(...s)=>{let[c,,u,f]=s;return{href:u??".",fetcherKey:c,...e_(e,f??{})}});i&&(i[ys]=r,e.fetch=i)}return e}function Wc(e,t,n){return e.length===0?null:async(...r)=>{let i=await EN(e,n(...r),()=>t(...r),e.length-1);if(i.type==="error")throw i.value;return i.value}}async function EN(e,t,n,r){let i=e[r],s;if(i){let c,u=async()=>(c?console.error("You cannot call instrumented handlers more than once"):c=EN(e,t,n,r-1),s=await c,yt(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await i(u,t)}catch(f){console.error("An instrumentation function threw an error:",f)}c||await u(),await c}else try{s={type:"success",value:await n()}}catch(c){s={type:"error",value:c}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function ZR(e){let{request:t,context:n,params:r,unstable_pattern:i}=e;return{request:ste(t),params:{...r},unstable_pattern:i,context:lte(n)}}function e_(e,t){return{currentUrl:Vo(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function ste(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function lte(e){if(ute(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var cte=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ute(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===cte}var TN=["POST","PUT","PATCH","DELETE"],dte=new Set(TN),fte=["GET",...TN],hte=new Set(fte),RN=new Set([301,302,303,307,308]),pte=new Set([307,308]),yx={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},mte={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Sd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},gte=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),_N="remix-router-transitions",DN=Symbol("ResetLoaderData");function vte(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";yt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||gte,s=i;if(e.unstable_instrumentations){let H=e.unstable_instrumentations;s=Y=>({...i(Y),...ote(H.map(oe=>oe.route).filter(Boolean),Y)})}let c={},u=ef(e.routes,s,void 0,c),f,h=e.basename||"/";h.startsWith("/")||(h=`/${h}`);let m=e.dataStrategy||jte,g={...e.future},y=null,x=new Set,S=null,w=null,C=null,T=e.hydrationData!=null,R=ps(u,e.history.location,h),E=!1,_=null,P,O;if(R==null&&!e.patchRoutesOnNavigation){let H=Oi(404,{pathname:e.history.location.pathname}),{matches:Y,route:oe}=fp(u);P=!0,O=!P,R=Y,_={[oe.id]:H}}else if(R&&!e.hydrationData&&Ki(R,u,e.history.location.pathname).active&&(R=null),R)if(R.some(H=>H.route.lazy))P=!1,O=!P;else if(!R.some(H=>a1(H.route)))P=!0,O=!P;else{let H=e.hydrationData?e.hydrationData.loaderData:null,Y=e.hydrationData?e.hydrationData.errors:null,oe=R;if(Y){let we=R.findIndex(De=>Y[De.route.id]!==void 0);oe=oe.slice(0,we+1)}O=!1,P=oe.every(we=>{let De=AN(we.route,H,Y);return O=O||De.renderFallback,!De.shouldLoad})}else{P=!1,O=!P,R=[];let H=Ki(null,u,e.history.location.pathname);H.active&&H.matches&&(E=!0,R=H.matches)}let k,A={historyAction:e.history.action,location:e.history.location,matches:R,initialized:P,renderFallback:O,navigation:yx,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||_,fetchers:new Map,blockers:new Map},z="POP",U=null,K=!1,W,ee=!1,B=new Map,G=null,L=!1,I=!1,$=new Set,V=new Map,X=0,M=-1,F=new Map,ie=new Set,de=new Map,Se=new Map,Ce=new Set,je=new Map,Ke,_e=null;function ht(){if(y=e.history.listen(({action:H,location:Y,delta:oe})=>{if(Ke){Ke(),Ke=void 0;return}Bn(je.size===0||oe!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let we=Yo({currentLocation:A.location,nextLocation:Y,historyAction:H});if(we&&oe!=null){let De=new Promise(Ge=>{Ke=Ge});e.history.go(oe*-1),Hr(we,{state:"blocked",location:Y,proceed(){Hr(we,{state:"proceeding",proceed:void 0,reset:void 0,location:Y}),De.then(()=>e.history.go(oe))},reset(){let Ge=new Map(A.blockers);Ge.set(we,Sd),qe({blockers:Ge})}}),U?.resolve(),U=null;return}return Te(H,Y)}),n){Ute(t,B);let H=()=>Bte(t,B);t.addEventListener("pagehide",H),G=()=>t.removeEventListener("pagehide",H)}return A.initialized||Te("POP",A.location,{initialHydration:!0}),k}function Ct(){y&&y(),G&&G(),x.clear(),W&&W.abort(),A.fetchers.forEach((H,Y)=>lr(Y)),A.blockers.forEach((H,Y)=>Yi(Y))}function Et(H){return x.add(H),()=>x.delete(H)}function qe(H,Y={}){H.matches&&(H.matches=H.matches.map(De=>{let Ge=c[De.route.id],Pe=De.route;return Pe.element!==Ge.element||Pe.errorElement!==Ge.errorElement||Pe.hydrateFallbackElement!==Ge.hydrateFallbackElement?{...De,route:Ge}:De})),A={...A,...H};let oe=[],we=[];A.fetchers.forEach((De,Ge)=>{De.state==="idle"&&(Ce.has(Ge)?oe.push(Ge):we.push(Ge))}),Ce.forEach(De=>{!A.fetchers.has(De)&&!V.has(De)&&oe.push(De)}),[...x].forEach(De=>De(A,{deletedFetchers:oe,newErrors:H.errors??null,viewTransitionOpts:Y.viewTransitionOpts,flushSync:Y.flushSync===!0})),oe.forEach(De=>lr(De)),we.forEach(De=>A.fetchers.delete(De))}function ct(H,Y,{flushSync:oe}={}){let we=A.actionData!=null&&A.navigation.formMethod!=null&&Dr(A.navigation.formMethod)&&A.navigation.state==="loading"&&H.state?._isRedirect!==!0,De;Y.actionData?Object.keys(Y.actionData).length>0?De=Y.actionData:De=null:we?De=A.actionData:De=null;let Ge=Y.loaderData?u_(A.loaderData,Y.loaderData,Y.matches||[],Y.errors):A.loaderData,Pe=A.blockers;Pe.size>0&&(Pe=new Map(Pe),Pe.forEach((rt,et)=>Pe.set(et,Sd)));let Ve=L?!1:Mr(H,Y.matches||A.matches),He=K===!0||A.navigation.formMethod!=null&&Dr(A.navigation.formMethod)&&H.state?._isRedirect!==!0;f&&(u=f,f=void 0),L||z==="POP"||(z==="PUSH"?e.history.push(H,H.state):z==="REPLACE"&&e.history.replace(H,H.state));let tt;if(z==="POP"){let rt=B.get(A.location.pathname);rt&&rt.has(H.pathname)?tt={currentLocation:A.location,nextLocation:H}:B.has(H.pathname)&&(tt={currentLocation:H,nextLocation:A.location})}else if(ee){let rt=B.get(A.location.pathname);rt?rt.add(H.pathname):(rt=new Set([H.pathname]),B.set(A.location.pathname,rt)),tt={currentLocation:A.location,nextLocation:H}}qe({...Y,actionData:De,loaderData:Ge,historyAction:z,location:H,initialized:!0,renderFallback:!1,navigation:yx,revalidation:"idle",restoreScrollPosition:Ve,preventScrollReset:He,blockers:Pe},{viewTransitionOpts:tt,flushSync:oe===!0}),z="POP",K=!1,ee=!1,L=!1,I=!1,U?.resolve(),U=null,_e?.resolve(),_e=null}async function Tt(H,Y){if(U?.resolve(),U=null,typeof H=="number"){U||(U=p_());let Xt=U.promise;return e.history.go(H),Xt}let oe=cb(A.location,A.matches,h,H,Y?.fromRouteId,Y?.relative),{path:we,submission:De,error:Ge}=t_(!1,oe,Y),Pe;Y?.unstable_mask&&(Pe={pathname:"",search:"",hash:"",...typeof Y.unstable_mask=="string"?Wo(Y.unstable_mask):{...A.location.unstable_mask,...Y.unstable_mask}});let Ve=A.location,He=Zd(Ve,we,Y&&Y.state,void 0,Pe);He={...He,...e.history.encodeLocation(He)};let tt=Y&&Y.replace!=null?Y.replace:void 0,rt="PUSH";tt===!0?rt="REPLACE":tt===!1||De!=null&&Dr(De.formMethod)&&De.formAction===A.location.pathname+A.location.search&&(rt="REPLACE");let et=Y&&"preventScrollReset"in Y?Y.preventScrollReset===!0:void 0,Bt=(Y&&Y.flushSync)===!0,bt=Yo({currentLocation:Ve,nextLocation:He,historyAction:rt});if(bt){Hr(bt,{state:"blocked",location:He,proceed(){Hr(bt,{state:"proceeding",proceed:void 0,reset:void 0,location:He}),Tt(H,Y)},reset(){let Xt=new Map(A.blockers);Xt.set(bt,Sd),qe({blockers:Xt})}});return}await Te(rt,He,{submission:De,pendingError:Ge,preventScrollReset:et,replace:Y&&Y.replace,enableViewTransition:Y&&Y.viewTransition,flushSync:Bt,callSiteDefaultShouldRevalidate:Y&&Y.unstable_defaultShouldRevalidate})}function It(){_e||(_e=p_()),Dt(),qe({revalidation:"loading"});let H=_e.promise;return A.navigation.state==="submitting"?H:A.navigation.state==="idle"?(Te(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),H):(Te(z||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:ee===!0}),H)}async function Te(H,Y,oe){W&&W.abort(),W=null,z=H,L=(oe&&oe.startUninterruptedRevalidation)===!0,zs(A.location,A.matches),K=(oe&&oe.preventScrollReset)===!0,ee=(oe&&oe.enableViewTransition)===!0;let we=f||u,De=oe&&oe.overrideNavigation,Ge=oe?.initialHydration&&A.matches&&A.matches.length>0&&!E?A.matches:ps(we,Y,h),Pe=(oe&&oe.flushSync)===!0;if(Ge&&A.initialized&&!I&&Ate(A.location,Y)&&!(oe&&oe.submission&&Dr(oe.submission.formMethod))){ct(Y,{matches:Ge},{flushSync:Pe});return}let Ve=Ki(Ge,we,Y.pathname);if(Ve.active&&Ve.matches&&(Ge=Ve.matches),!Ge){let{error:nt,notFoundMatches:yn,route:Ot}=ii(Y.pathname);ct(Y,{matches:yn,loaderData:{},errors:{[Ot.id]:nt}},{flushSync:Pe});return}W=new AbortController;let He=qc(e.history,Y,W.signal,oe&&oe.submission),tt=e.getContext?await e.getContext():new YR,rt;if(oe&&oe.pendingError)rt=[ms(Ge).route.id,{type:"error",error:oe.pendingError}];else if(oe&&oe.submission&&Dr(oe.submission.formMethod)){let nt=await Oe(He,Y,oe.submission,Ge,tt,Ve.active,oe&&oe.initialHydration===!0,{replace:oe.replace,flushSync:Pe});if(nt.shortCircuited)return;if(nt.pendingActionResult){let[yn,Ot]=nt.pendingActionResult;if(hi(Ot)&&tf(Ot.error)&&Ot.error.status===404){W=null,ct(Y,{matches:nt.matches,loaderData:{},errors:{[yn]:Ot.error}});return}}Ge=nt.matches||Ge,rt=nt.pendingActionResult,De=xx(Y,oe.submission),Pe=!1,Ve.active=!1,He=qc(e.history,He.url,He.signal)}let{shortCircuited:et,matches:Bt,loaderData:bt,errors:Xt}=await Le(He,Y,Ge,tt,Ve.active,De,oe&&oe.submission,oe&&oe.fetcherSubmission,oe&&oe.replace,oe&&oe.initialHydration===!0,Pe,rt,oe&&oe.callSiteDefaultShouldRevalidate);et||(W=null,ct(Y,{matches:Bt||Ge,...d_(rt),loaderData:bt,errors:Xt}))}async function Oe(H,Y,oe,we,De,Ge,Pe,Ve={}){Dt();let He=zte(Y,oe);if(qe({navigation:He},{flushSync:Ve.flushSync===!0}),Ge){let et=await Cn(we,Y.pathname,H.signal);if(et.type==="aborted")return{shortCircuited:!0};if(et.type==="error"){if(et.partialMatches.length===0){let{matches:bt,route:Xt}=fp(u);return{matches:bt,pendingActionResult:[Xt.id,{type:"error",error:et.error}]}}let Bt=ms(et.partialMatches).route.id;return{matches:et.partialMatches,pendingActionResult:[Bt,{type:"error",error:et.error}]}}else if(et.matches)we=et.matches;else{let{notFoundMatches:Bt,error:bt,route:Xt}=ii(Y.pathname);return{matches:Bt,pendingActionResult:[Xt.id,{type:"error",error:bt}]}}}let tt,rt=_p(we,Y);if(!rt.route.action&&!rt.route.lazy)tt={type:"error",error:Oi(405,{method:H.method,pathname:Y.pathname,routeId:rt.route.id})};else{let et=Jc(s,c,H,we,rt,Pe?[]:r,De),Bt=await he(H,et,De,null);if(tt=Bt[rt.route.id],!tt){for(let bt of we)if(Bt[bt.route.id]){tt=Bt[bt.route.id];break}}if(H.signal.aborted)return{shortCircuited:!0}}if(yl(tt)){let et;return Ve&&Ve.replace!=null?et=Ve.replace:et=s_(tt.response.headers.get("Location"),new URL(H.url),h,e.history)===A.location.pathname+A.location.search,await Ee(H,tt,!0,{submission:oe,replace:et}),{shortCircuited:!0}}if(hi(tt)){let et=ms(we,rt.route.id);return(Ve&&Ve.replace)!==!0&&(z="PUSH"),{matches:we,pendingActionResult:[et.route.id,tt,rt.route.id]}}return{matches:we,pendingActionResult:[rt.route.id,tt]}}async function Le(H,Y,oe,we,De,Ge,Pe,Ve,He,tt,rt,et,Bt){let bt=Ge||xx(Y,Pe),Xt=Pe||Ve||h_(bt),nt=!L&&!tt;if(De){if(nt){let Gn=Ie(et);qe({navigation:bt,...Gn!==void 0?{actionData:Gn}:{}},{flushSync:rt})}let _t=await Cn(oe,Y.pathname,H.signal);if(_t.type==="aborted")return{shortCircuited:!0};if(_t.type==="error"){if(_t.partialMatches.length===0){let{matches:Er,route:Jn}=fp(u);return{matches:Er,loaderData:{},errors:{[Jn.id]:_t.error}}}let Gn=ms(_t.partialMatches).route.id;return{matches:_t.partialMatches,loaderData:{},errors:{[Gn]:_t.error}}}else if(_t.matches)oe=_t.matches;else{let{error:Gn,notFoundMatches:Er,route:Jn}=ii(Y.pathname);return{matches:Er,loaderData:{},errors:{[Jn.id]:Gn}}}}let yn=f||u,{dsMatches:Ot,revalidatingFetchers:qn}=n_(H,we,s,c,e.history,A,oe,Xt,Y,tt?[]:r,tt===!0,I,$,Ce,de,ie,yn,h,e.patchRoutesOnNavigation!=null,et,Bt);if(M=++X,!e.dataStrategy&&!Ot.some(_t=>_t.shouldLoad)&&!Ot.some(_t=>_t.route.middleware&&_t.route.middleware.length>0)&&qn.length===0){let _t=xi();return ct(Y,{matches:oe,loaderData:{},errors:et&&hi(et[1])?{[et[0]]:et[1].error}:null,...d_(et),..._t?{fetchers:new Map(A.fetchers)}:{}},{flushSync:rt}),{shortCircuited:!0}}if(nt){let _t={};if(!De){_t.navigation=bt;let Gn=Ie(et);Gn!==void 0&&(_t.actionData=Gn)}qn.length>0&&(_t.fetchers=at(qn)),qe(_t,{flushSync:rt})}qn.forEach(_t=>{wn(_t.key),_t.controller&&V.set(_t.key,_t.controller)});let xn=()=>qn.forEach(_t=>wn(_t.key));W&&W.signal.addEventListener("abort",xn);let{loaderResults:La,fetcherResults:Xi}=await ke(Ot,qn,H,we);if(H.signal.aborted)return{shortCircuited:!0};W&&W.signal.removeEventListener("abort",xn),qn.forEach(_t=>V.delete(_t.key));let cr=hp(La);if(cr)return await Ee(H,cr.result,!0,{replace:He}),{shortCircuited:!0};if(cr=hp(Xi),cr)return ie.add(cr.key),await Ee(H,cr.result,!0,{replace:He}),{shortCircuited:!0};let{loaderData:vo,errors:$s}=c_(A,oe,La,et,qn,Xi);tt&&A.errors&&($s={...A.errors,...$s});let yo=xi(),Us=go(M),Yl=yo||Us||qn.length>0;return{matches:oe,loaderData:vo,errors:$s,...Yl?{fetchers:new Map(A.fetchers)}:{}}}function Ie(H){if(H&&!hi(H[1]))return{[H[0]]:H[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function at(H){return H.forEach(Y=>{let oe=A.fetchers.get(Y.key),we=jd(void 0,oe?oe.data:void 0);A.fetchers.set(Y.key,we)}),new Map(A.fetchers)}async function Ze(H,Y,oe,we){wn(H);let De=(we&&we.flushSync)===!0,Ge=f||u,Pe=cb(A.location,A.matches,h,oe,Y,we?.relative),Ve=ps(Ge,Pe,h),He=Ki(Ve,Ge,Pe);if(He.active&&He.matches&&(Ve=He.matches),!Ve){At(H,Y,Oi(404,{pathname:Pe}),{flushSync:De});return}let{path:tt,submission:rt,error:et}=t_(!0,Pe,we);if(et){At(H,Y,et,{flushSync:De});return}let Bt=e.getContext?await e.getContext():new YR,bt=(we&&we.preventScrollReset)===!0;if(rt&&Dr(rt.formMethod)){await dt(H,Y,tt,Ve,Bt,He.active,De,bt,rt,we&&we.unstable_defaultShouldRevalidate);return}de.set(H,{routeId:Y,path:tt}),await ft(H,Y,tt,Ve,Bt,He.active,De,bt,rt)}async function dt(H,Y,oe,we,De,Ge,Pe,Ve,He,tt){Dt(),de.delete(H);let rt=A.fetchers.get(H);Rt(H,$te(He,rt),{flushSync:Pe});let et=new AbortController,Bt=qc(e.history,oe,et.signal,He);if(Ge){let En=await Cn(we,new URL(Bt.url).pathname,Bt.signal,H);if(En.type==="aborted")return;if(En.type==="error"){At(H,Y,En.error,{flushSync:Pe});return}else if(En.matches)we=En.matches;else{At(H,Y,Oi(404,{pathname:oe}),{flushSync:Pe});return}}let bt=_p(we,oe);if(!bt.route.action&&!bt.route.lazy){let En=Oi(405,{method:He.formMethod,pathname:oe,routeId:Y});At(H,Y,En,{flushSync:Pe});return}V.set(H,et);let Xt=X,nt=Jc(s,c,Bt,we,bt,r,De),yn=await he(Bt,nt,De,H),Ot=yn[bt.route.id];if(!Ot){for(let En of nt)if(yn[En.route.id]){Ot=yn[En.route.id];break}}if(Bt.signal.aborted){V.get(H)===et&&V.delete(H);return}if(Ce.has(H)){if(yl(Ot)||hi(Ot)){Rt(H,va(void 0));return}}else{if(yl(Ot))if(V.delete(H),M>Xt){Rt(H,va(void 0));return}else return ie.add(H),Rt(H,jd(He)),Ee(Bt,Ot,!1,{fetcherSubmission:He,preventScrollReset:Ve});if(hi(Ot)){At(H,Y,Ot.error);return}}let qn=A.navigation.location||A.location,xn=qc(e.history,qn,et.signal),La=f||u,Xi=A.navigation.state!=="idle"?ps(La,A.navigation.location,h):A.matches;yt(Xi,"Didn't find any matches after fetcher action");let cr=++X;F.set(H,cr);let vo=jd(He,Ot.data);A.fetchers.set(H,vo);let{dsMatches:$s,revalidatingFetchers:yo}=n_(xn,De,s,c,e.history,A,Xi,He,qn,r,!1,I,$,Ce,de,ie,La,h,e.patchRoutesOnNavigation!=null,[bt.route.id,Ot],tt);yo.filter(En=>En.key!==H).forEach(En=>{let Kl=En.key,Xl=A.fetchers.get(Kl),Vf=jd(void 0,Xl?Xl.data:void 0);A.fetchers.set(Kl,Vf),wn(Kl),En.controller&&V.set(Kl,En.controller)}),qe({fetchers:new Map(A.fetchers)});let Us=()=>yo.forEach(En=>wn(En.key));et.signal.addEventListener("abort",Us);let{loaderResults:Yl,fetcherResults:_t}=await ke($s,yo,xn,De);if(et.signal.aborted)return;if(et.signal.removeEventListener("abort",Us),F.delete(H),V.delete(H),yo.forEach(En=>V.delete(En.key)),A.fetchers.has(H)){let En=va(Ot.data);A.fetchers.set(H,En)}let Gn=hp(Yl);if(Gn)return Ee(xn,Gn.result,!1,{preventScrollReset:Ve});if(Gn=hp(_t),Gn)return ie.add(Gn.key),Ee(xn,Gn.result,!1,{preventScrollReset:Ve});let{loaderData:Er,errors:Jn}=c_(A,Xi,Yl,void 0,yo,_t);go(cr),A.navigation.state==="loading"&&cr>M?(yt(z,"Expected pending action"),W&&W.abort(),ct(A.navigation.location,{matches:Xi,loaderData:Er,errors:Jn,fetchers:new Map(A.fetchers)})):(qe({errors:Jn,loaderData:u_(A.loaderData,Er,Xi,Jn),fetchers:new Map(A.fetchers)}),I=!1)}async function ft(H,Y,oe,we,De,Ge,Pe,Ve,He){let tt=A.fetchers.get(H);Rt(H,jd(He,tt?tt.data:void 0),{flushSync:Pe});let rt=new AbortController,et=qc(e.history,oe,rt.signal);if(Ge){let Ot=await Cn(we,new URL(et.url).pathname,et.signal,H);if(Ot.type==="aborted")return;if(Ot.type==="error"){At(H,Y,Ot.error,{flushSync:Pe});return}else if(Ot.matches)we=Ot.matches;else{At(H,Y,Oi(404,{pathname:oe}),{flushSync:Pe});return}}let Bt=_p(we,oe);V.set(H,rt);let bt=X,Xt=Jc(s,c,et,we,Bt,r,De),yn=(await he(et,Xt,De,H))[Bt.route.id];if(V.get(H)===rt&&V.delete(H),!et.signal.aborted){if(Ce.has(H)){Rt(H,va(void 0));return}if(yl(yn))if(M>bt){Rt(H,va(void 0));return}else{ie.add(H),await Ee(et,yn,!1,{preventScrollReset:Ve});return}if(hi(yn)){At(H,Y,yn.error);return}Rt(H,va(yn.data))}}async function Ee(H,Y,oe,{submission:we,fetcherSubmission:De,preventScrollReset:Ge,replace:Pe}={}){oe||(U?.resolve(),U=null),Y.response.headers.has("X-Remix-Revalidate")&&(I=!0);let Ve=Y.response.headers.get("Location");yt(Ve,"Expected a Location header on the redirect Response"),Ve=s_(Ve,new URL(H.url),h,e.history);let He=Zd(A.location,Ve,{_isRedirect:!0});if(n){let Xt=!1;if(Y.response.headers.has("X-Remix-Reload-Document"))Xt=!0;else if(o1(Ve)){const nt=yN(Ve,!0);Xt=nt.origin!==t.location.origin||Bi(nt.pathname,h)==null}if(Xt){Pe?t.location.replace(Ve):t.location.assign(Ve);return}}W=null;let tt=Pe===!0||Y.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:rt,formAction:et,formEncType:Bt}=A.navigation;!we&&!De&&rt&&et&&Bt&&(we=h_(A.navigation));let bt=we||De;if(pte.has(Y.response.status)&&bt&&Dr(bt.formMethod))await Te(tt,He,{submission:{...bt,formAction:Ve},preventScrollReset:Ge||K,enableViewTransition:oe?ee:void 0});else{let Xt=xx(He,we);await Te(tt,He,{overrideNavigation:Xt,fetcherSubmission:De,preventScrollReset:Ge||K,enableViewTransition:oe?ee:void 0})}}async function he(H,Y,oe,we){let De,Ge={};try{De=await Cte(m,H,Y,we,oe,!1)}catch(Pe){return Y.filter(Ve=>Ve.shouldLoad).forEach(Ve=>{Ge[Ve.route.id]={type:"error",error:Pe}}),Ge}if(H.signal.aborted)return Ge;if(!Dr(H.method))for(let Pe of Y){if(De[Pe.route.id]?.type==="error")break;!De.hasOwnProperty(Pe.route.id)&&!A.loaderData.hasOwnProperty(Pe.route.id)&&(!A.errors||!A.errors.hasOwnProperty(Pe.route.id))&&Pe.shouldCallHandler()&&(De[Pe.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Pe.route.id}`)})}for(let[Pe,Ve]of Object.entries(De))if(Ote(Ve)){let He=Ve.result;Ge[Pe]={type:"redirect",response:_te(He,H,Pe,Y,h)}}else Ge[Pe]=await Rte(Ve);return Ge}async function ke(H,Y,oe,we){let De=he(oe,H,we,null),Ge=Promise.all(Y.map(async He=>{if(He.matches&&He.match&&He.request&&He.controller){let rt=(await he(He.request,He.matches,we,He.key))[He.match.route.id];return{[He.key]:rt}}else return Promise.resolve({[He.key]:{type:"error",error:Oi(404,{pathname:He.path})}})})),Pe=await De,Ve=(await Ge).reduce((He,tt)=>Object.assign(He,tt),{});return{loaderResults:Pe,fetcherResults:Ve}}function Dt(){I=!0,de.forEach((H,Y)=>{V.has(Y)&&$.add(Y),wn(Y)})}function Rt(H,Y,oe={}){A.fetchers.set(H,Y),qe({fetchers:new Map(A.fetchers)},{flushSync:(oe&&oe.flushSync)===!0})}function At(H,Y,oe,we={}){let De=ms(A.matches,Y);lr(H),qe({errors:{[De.route.id]:oe},fetchers:new Map(A.fetchers)},{flushSync:(we&&we.flushSync)===!0})}function ln(H){return Se.set(H,(Se.get(H)||0)+1),Ce.has(H)&&Ce.delete(H),A.fetchers.get(H)||mte}function vn(H,Y){wn(H,Y?.reason),Rt(H,va(null))}function lr(H){let Y=A.fetchers.get(H);V.has(H)&&!(Y&&Y.state==="loading"&&F.has(H))&&wn(H),de.delete(H),F.delete(H),ie.delete(H),Ce.delete(H),$.delete(H),A.fetchers.delete(H)}function Hn(H){let Y=(Se.get(H)||0)-1;Y<=0?(Se.delete(H),Ce.add(H)):Se.set(H,Y),qe({fetchers:new Map(A.fetchers)})}function wn(H,Y){let oe=V.get(H);oe&&(oe.abort(Y),V.delete(H))}function zn(H){for(let Y of H){let oe=ln(Y),we=va(oe.data);A.fetchers.set(Y,we)}}function xi(){let H=[],Y=!1;for(let oe of ie){let we=A.fetchers.get(oe);yt(we,`Expected fetcher: ${oe}`),we.state==="loading"&&(ie.delete(oe),H.push(oe),Y=!0)}return zn(H),Y}function go(H){let Y=[];for(let[oe,we]of F)if(we<H){let De=A.fetchers.get(oe);yt(De,`Expected fetcher: ${oe}`),De.state==="loading"&&(wn(oe),F.delete(oe),Y.push(oe))}return zn(Y),Y.length>0}function Qo(H,Y){let oe=A.blockers.get(H)||Sd;return je.get(H)!==Y&&je.set(H,Y),oe}function Yi(H){A.blockers.delete(H),je.delete(H)}function Hr(H,Y){let oe=A.blockers.get(H)||Sd;yt(oe.state==="unblocked"&&Y.state==="blocked"||oe.state==="blocked"&&Y.state==="blocked"||oe.state==="blocked"&&Y.state==="proceeding"||oe.state==="blocked"&&Y.state==="unblocked"||oe.state==="proceeding"&&Y.state==="unblocked",`Invalid blocker state transition: ${oe.state} -> ${Y.state}`);let we=new Map(A.blockers);we.set(H,Y),qe({blockers:we})}function Yo({currentLocation:H,nextLocation:Y,historyAction:oe}){if(je.size===0)return;je.size>1&&Bn(!1,"A router only supports one blocker at a time");let we=Array.from(je.entries()),[De,Ge]=we[we.length-1],Pe=A.blockers.get(De);if(!(Pe&&Pe.state==="proceeding")&&Ge({currentLocation:H,nextLocation:Y,historyAction:oe}))return De}function ii(H){let Y=Oi(404,{pathname:H}),oe=f||u,{matches:we,route:De}=fp(oe);return{notFoundMatches:we,route:De,error:Y}}function Ko(H,Y,oe){if(S=H,C=Y,w=oe||null,!T&&A.navigation===yx){T=!0;let we=Mr(A.location,A.matches);we!=null&&qe({restoreScrollPosition:we})}return()=>{S=null,C=null,w=null}}function bi(H,Y){return w&&w(H,Y.map(we=>Bee(we,A.loaderData)))||H.key}function zs(H,Y){if(S&&C){let oe=bi(H,Y);S[oe]=C()}}function Mr(H,Y){if(S){let oe=bi(H,Y),we=S[oe];if(typeof we=="number")return we}return null}function Ki(H,Y,oe){if(e.patchRoutesOnNavigation)if(H){if(Object.keys(H[0].params).length>0)return{active:!0,matches:_d(Y,oe,h,!0)}}else return{active:!0,matches:_d(Y,oe,h,!0)||[]};return{active:!1,matches:null}}async function Cn(H,Y,oe,we){if(!e.patchRoutesOnNavigation)return{type:"success",matches:H};let De=H;for(;;){let Ge=f==null,Pe=f||u,Ve=c;try{await e.patchRoutesOnNavigation({signal:oe,path:Y,matches:De,fetcherKey:we,patch:(rt,et)=>{oe.aborted||r_(rt,et,Pe,Ve,s,!1)}})}catch(rt){return{type:"error",error:rt,partialMatches:De}}finally{Ge&&!oe.aborted&&(u=[...u])}if(oe.aborted)return{type:"aborted"};let He=ps(Pe,Y,h),tt=null;if(He){if(Object.keys(He[0].params).length===0)return{type:"success",matches:He};if(tt=_d(Pe,Y,h,!0),!(tt&&De.length<tt.length&&Wl(De,tt.slice(0,De.length))))return{type:"success",matches:He}}if(tt||(tt=_d(Pe,Y,h,!0)),!tt||Wl(De,tt))return{type:"success",matches:null};De=tt}}function Wl(H,Y){return H.length===Y.length&&H.every((oe,we)=>oe.route.id===Y[we].route.id)}function _u(H){c={},f=ef(H,s,void 0,c)}function Ql(H,Y,oe=!1){let we=f==null;r_(H,Y,f||u,c,s,oe),we&&(u=[...u],qe({}))}return k={get basename(){return h},get future(){return g},get state(){return A},get routes(){return u},get window(){return t},initialize:ht,subscribe:Et,enableScrollRestoration:Ko,navigate:Tt,fetch:Ze,revalidate:It,createHref:H=>e.history.createHref(H),encodeLocation:H=>e.history.encodeLocation(H),getFetcher:ln,resetFetcher:vn,deleteFetcher:Hn,dispose:Ct,getBlocker:Qo,deleteBlocker:Yi,patchRoutes:Ql,_internalFetchControllers:V,_internalSetRoutes:_u,_internalSetStateDoNotUseOrYouWillBreakYourApp(H){qe(H)}},e.unstable_instrumentations&&(k=ate(k,e.unstable_instrumentations.map(H=>H.router).filter(Boolean))),k}function yte(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function cb(e,t,n,r,i,s){let c,u;if(i){c=[];for(let h of t)if(c.push(h),h.route.id===i){u=h;break}}else c=t,u=t[t.length-1];let f=Mf(r||".",xg(c),Bi(e.pathname,n)||e.pathname,s==="path");if(r==null&&(f.search=e.search,f.hash=e.hash),(r==null||r===""||r===".")&&u){let h=l1(f.search);if(u.route.index&&!h)f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&h){let m=new URLSearchParams(f.search),g=m.getAll("index");m.delete("index"),g.filter(x=>x).forEach(x=>m.append("index",x));let y=m.toString();f.search=y?`?${y}`:""}}return n!=="/"&&(f.pathname=ete({basename:n,pathname:f.pathname})),Vo(f)}function t_(e,t,n){if(!n||!yte(n))return{path:t};if(n.formMethod&&!Ite(n.formMethod))return{path:t,error:Oi(405,{method:n.formMethod})};let r=()=>({path:t,error:Oi(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),c=LN(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Dr(s))return r();let g=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((y,[x,S])=>`${y}${x}=${S}
215
+ `,""):String(n.body);return{path:t,submission:{formMethod:s,formAction:c,formEncType:n.formEncType,formData:void 0,json:void 0,text:g}}}else if(n.formEncType==="application/json"){if(!Dr(s))return r();try{let g=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:s,formAction:c,formEncType:n.formEncType,formData:void 0,json:g,text:void 0}}}catch{return r()}}}yt(typeof FormData=="function","FormData is not available in this environment");let u,f;if(n.formData)u=db(n.formData),f=n.formData;else if(n.body instanceof FormData)u=db(n.body),f=n.body;else if(n.body instanceof URLSearchParams)u=n.body,f=l_(u);else if(n.body==null)u=new URLSearchParams,f=new FormData;else try{u=new URLSearchParams(n.body),f=l_(u)}catch{return r()}let h={formMethod:s,formAction:c,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(Dr(h.formMethod))return{path:t,submission:h};let m=Wo(t);return e&&m.search&&l1(m.search)&&u.append("index",""),m.search=`?${u}`,{path:Vo(m),submission:h}}function n_(e,t,n,r,i,s,c,u,f,h,m,g,y,x,S,w,C,T,R,E,_){let P=E?hi(E[1])?E[1].error:E[1].data:void 0,O=i.createURL(s.location),k=i.createURL(f),A;if(m&&s.errors){let G=Object.keys(s.errors)[0];A=c.findIndex(L=>L.route.id===G)}else if(E&&hi(E[1])){let G=E[0];A=c.findIndex(L=>L.route.id===G)-1}let z=E?E[1].statusCode:void 0,U=z&&z>=400,K={currentUrl:O,currentParams:s.matches[0]?.params||{},nextUrl:k,nextParams:c[0].params,...u,actionResult:P,actionStatus:z},W=If(c),ee=c.map((G,L)=>{let{route:I}=G,$=null;if(A!=null&&L>A)$=!1;else if(I.lazy)$=!0;else if(!a1(I))$=!1;else if(m){let{shouldLoad:F}=AN(I,s.loaderData,s.errors);$=F}else xte(s.loaderData,s.matches[L],G)&&($=!0);if($!==null)return ub(n,r,e,W,G,h,t,$);let V=!1;typeof _=="boolean"?V=_:U?V=!1:(g||O.pathname+O.search===k.pathname+k.search||O.search!==k.search||bte(s.matches[L],G))&&(V=!0);let X={...K,defaultShouldRevalidate:V},M=Nd(G,X);return ub(n,r,e,W,G,h,t,M,X,_)}),B=[];return S.forEach((G,L)=>{if(m||!c.some(de=>de.route.id===G.routeId)||x.has(L))return;let I=s.fetchers.get(L),$=I&&I.state!=="idle"&&I.data===void 0,V=ps(C,G.path,T);if(!V){if(R&&$)return;B.push({key:L,routeId:G.routeId,path:G.path,matches:null,match:null,request:null,controller:null});return}if(w.has(L))return;let X=_p(V,G.path),M=new AbortController,F=qc(i,G.path,M.signal),ie=null;if(y.has(L))y.delete(L),ie=Jc(n,r,F,V,X,h,t);else if($)g&&(ie=Jc(n,r,F,V,X,h,t));else{let de;typeof _=="boolean"?de=_:U?de=!1:de=g;let Se={...K,defaultShouldRevalidate:de};Nd(X,Se)&&(ie=Jc(n,r,F,V,X,h,t,Se))}ie&&B.push({key:L,routeId:G.routeId,path:G.path,matches:ie,match:X,request:F,controller:M})}),{dsMatches:ee,revalidatingFetchers:B}}function a1(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function AN(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!a1(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let s=!r&&!i;return{shouldLoad:s,renderFallback:s}}function xte(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function bte(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Nd(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function r_(e,t,n,r,i,s){let c;if(e){let h=r[e];yt(h,`No route found to patch children into: routeId = ${e}`),h.children||(h.children=[]),c=h.children}else c=n;let u=[],f=[];if(t.forEach(h=>{let m=c.find(g=>kN(h,g));m?f.push({existingRoute:m,newRoute:h}):u.push(h)}),u.length>0){let h=ef(u,i,[e||"_","patch",String(c?.length||"0")],r);c.push(...h)}if(s&&f.length>0)for(let h=0;h<f.length;h++){let{existingRoute:m,newRoute:g}=f[h],y=m,[x]=ef([g],i,[],{},!0);Object.assign(y,{element:x.element?x.element:y.element,errorElement:x.errorElement?x.errorElement:y.errorElement,hydrateFallbackElement:x.hydrateFallbackElement?x.hydrateFallbackElement:y.hydrateFallbackElement})}}function kN(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((n,r)=>t.children?.some(i=>kN(n,i)))??!1:!1}var i_=new WeakMap,PN=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(yt(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let s=i.lazy[e];if(!s)return;let c=i_.get(i);c||(c={},i_.set(i,c));let u=c[e];if(u)return u;let f=(async()=>{let h=Iee(e),g=i[e]!==void 0&&e!=="hasErrorBoundary";if(h)Bn(!h,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),c[e]=Promise.resolve();else if(g)Bn(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let y=await s();y!=null&&(Object.assign(i,{[e]:y}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[e]=void 0,Object.values(i.lazy).every(y=>y===void 0)&&(i.lazy=void 0))})();return c[e]=f,f},o_=new WeakMap;function Ste(e,t,n,r,i){let s=n[e.id];if(yt(s,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let m=o_.get(s);if(m)return{lazyRoutePromise:m,lazyHandlerPromise:m};let g=(async()=>{yt(typeof e.lazy=="function","No lazy route function found");let y=await e.lazy(),x={};for(let S in y){let w=y[S];if(w===void 0)continue;let C=$ee(S),R=s[S]!==void 0&&S!=="hasErrorBoundary";C?Bn(!C,"Route property "+S+" is not a supported property to be returned from a lazy route function. This property will be ignored."):R?Bn(!R,`Route "${s.id}" has a static property "${S}" defined but its lazy function is also returning a value for this property. The lazy route property "${S}" will be ignored.`):x[S]=w}Object.assign(s,x),Object.assign(s,{...r(s),lazy:void 0})})();return o_.set(s,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let c=Object.keys(e.lazy),u=[],f;for(let m of c){if(i&&i.includes(m))continue;let g=PN({key:m,route:e,manifest:n,mapRouteProperties:r});g&&(u.push(g),m===t&&(f=g))}let h=u.length>0?Promise.all(u).then(()=>{}):void 0;return h?.catch(()=>{}),f?.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:f}}async function a_(e){let t=e.matches.filter(i=>i.shouldLoad),n={};return(await Promise.all(t.map(i=>i.resolve()))).forEach((i,s)=>{n[t[s].route.id]=i}),n}async function jte(e){return e.matches.some(t=>t.route.middleware)?NN(e,()=>a_(e)):a_(e)}function NN(e,t){return wte(e,t,r=>{if(Lte(r))throw r;return r},Pte,n);function n(r,i,s){if(s)return Promise.resolve(Object.assign(s.value,{[i]:{type:"error",result:r}}));{let{matches:c}=e,u=Math.min(Math.max(c.findIndex(h=>h.route.id===i),0),Math.max(c.findIndex(h=>h.shouldCallHandler()),0)),f=ms(c,c[u].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function wte(e,t,n,r,i){let{matches:s,request:c,params:u,context:f,unstable_pattern:h}=e,m=s.flatMap(y=>y.route.middleware?y.route.middleware.map(x=>[y.route.id,x]):[]);return await ON({request:c,params:u,context:f,unstable_pattern:h},m,t,n,r,i)}async function ON(e,t,n,r,i,s,c=0){let{request:u}=e;if(u.signal.aborted)throw u.signal.reason??new Error(`Request aborted: ${u.method} ${u.url}`);let f=t[c];if(!f)return await n();let[h,m]=f,g,y=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await ON(e,t,n,r,i,s,c+1)},g.value}catch(x){return g={value:await s(x,h,g)},g.value}};try{let x=await m(e,y),S=x!=null?r(x):void 0;return i(S)?S:g?S??g.value:(g={value:await y()},g.value)}catch(x){return await s(x,h,g)}}function MN(e,t,n,r,i){let s=PN({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),c=Ste(r.route,Dr(n.method)?"action":"loader",t,e,i);return{middleware:s,route:c.lazyRoutePromise,handler:c.lazyHandlerPromise}}function ub(e,t,n,r,i,s,c,u,f=null,h){let m=!1,g=MN(e,t,n,i,s);return{...i,_lazyPromises:g,shouldLoad:u,shouldRevalidateArgs:f,shouldCallHandler(y){return m=!0,f?typeof h=="boolean"?Nd(i,{...f,defaultShouldRevalidate:h}):typeof y=="boolean"?Nd(i,{...f,defaultShouldRevalidate:y}):Nd(i,f):u},resolve(y){let{lazy:x,loader:S,middleware:w}=i.route,C=m||u||y&&!Dr(n.method)&&(x||S),T=w&&w.length>0&&!S&&!x;return C&&(Dr(n.method)||!T)?Ete({request:n,unstable_pattern:r,match:i,lazyHandlerPromise:g?.handler,lazyRoutePromise:g?.route,handlerOverride:y,scopedContext:c}):Promise.resolve({type:"data",result:void 0})}}}function Jc(e,t,n,r,i,s,c,u=null){return r.map(f=>f.route.id!==i.route.id?{...f,shouldLoad:!1,shouldRevalidateArgs:u,shouldCallHandler:()=>!1,_lazyPromises:MN(e,t,n,f,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:ub(e,t,n,If(r),f,s,c,!0,u))}async function Cte(e,t,n,r,i,s){n.some(h=>h._lazyPromises?.middleware)&&await Promise.all(n.map(h=>h._lazyPromises?.middleware));let c={request:t,unstable_pattern:If(n),params:n[0].params,context:i,matches:n},f=await e({...c,fetcherKey:r,runClientMiddleware:h=>{let m=c;return NN(m,()=>h({...m,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(h=>[h._lazyPromises?.handler,h._lazyPromises?.route]))}catch{}return f}async function Ete({request:e,unstable_pattern:t,match:n,lazyHandlerPromise:r,lazyRoutePromise:i,handlerOverride:s,scopedContext:c}){let u,f,h=Dr(e.method),m=h?"action":"loader",g=y=>{let x,S=new Promise((T,R)=>x=R);f=()=>x(),e.signal.addEventListener("abort",f);let w=T=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${n.route.id}]`)):y({request:e,unstable_pattern:t,params:n.params,context:c},...T!==void 0?[T]:[]),C=(async()=>{try{return{type:"data",result:await(s?s(R=>w(R)):w())}}catch(T){return{type:"error",result:T}}})();return Promise.race([C,S])};try{let y=h?n.route.action:n.route.loader;if(r||i)if(y){let x,[S]=await Promise.all([g(y).catch(w=>{x=w}),r,i]);if(x!==void 0)throw x;u=S}else{await r;let x=h?n.route.action:n.route.loader;if(x)[u]=await Promise.all([g(x),i]);else if(m==="action"){let S=new URL(e.url),w=S.pathname+S.search;throw Oi(405,{method:e.method,pathname:w,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(y)u=await g(y);else{let x=new URL(e.url),S=x.pathname+x.search;throw Oi(404,{pathname:S})}}catch(y){return{type:"error",result:y}}finally{f&&e.signal.removeEventListener("abort",f)}return u}async function Tte(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function Rte(e){let{result:t,type:n}=e;if(s1(t)){let r;try{r=await Tte(t)}catch(i){return{type:"error",error:i}}return n==="error"?{type:"error",error:new Lf(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?f_(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:kte(t),statusCode:tf(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:tf(t)?t.status:void 0}:f_(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function _te(e,t,n,r,i){let s=e.headers.get("Location");if(yt(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!o1(s)){let c=r.slice(0,r.findIndex(u=>u.route.id===n)+1);s=cb(new URL(t.url),c,i,s),e.headers.set("Location",s)}return e}function s_(e,t,n,r){let i=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(o1(e)){let s=e,c=s.startsWith("//")?new URL(t.protocol+s):new URL(s);if(i.includes(c.protocol))throw new Error("Invalid redirect location");let u=Bi(c.pathname,n)!=null;if(c.origin===t.origin&&u)return c.pathname+c.search+c.hash}try{let s=r.createURL(e);if(i.includes(s.protocol))throw new Error("Invalid redirect location")}catch{}return e}function qc(e,t,n,r){let i=e.createURL(LN(t)).toString(),s={signal:n};if(r&&Dr(r.formMethod)){let{formMethod:c,formEncType:u}=r;s.method=c.toUpperCase(),u==="application/json"?(s.headers=new Headers({"Content-Type":u}),s.body=JSON.stringify(r.json)):u==="text/plain"?s.body=r.text:u==="application/x-www-form-urlencoded"&&r.formData?s.body=db(r.formData):s.body=r.formData}return new Request(i,s)}function db(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function l_(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Dte(e,t,n,r=!1,i=!1){let s={},c=null,u,f=!1,h={},m=n&&hi(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let y=g.route.id,x=t[y];if(yt(!yl(x),"Cannot handle redirect results in processLoaderData"),hi(x)){let S=x.error;if(m!==void 0&&(S=m,m=void 0),c=c||{},i)c[y]=S;else{let w=ms(e,y);c[w.route.id]==null&&(c[w.route.id]=S)}r||(s[y]=DN),f||(f=!0,u=tf(x.error)?x.error.status:500),x.headers&&(h[y]=x.headers)}else s[y]=x.data,x.statusCode&&x.statusCode!==200&&!f&&(u=x.statusCode),x.headers&&(h[y]=x.headers)}),m!==void 0&&n&&(c={[n[0]]:m},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:c,statusCode:u||200,loaderHeaders:h}}function c_(e,t,n,r,i,s){let{loaderData:c,errors:u}=Dte(t,n,r);return i.filter(f=>!f.matches||f.matches.some(h=>h.shouldLoad)).forEach(f=>{let{key:h,match:m,controller:g}=f;if(g&&g.signal.aborted)return;let y=s[h];if(yt(y,"Did not find corresponding fetcher result"),hi(y)){let x=ms(e.matches,m?.route.id);u&&u[x.route.id]||(u={...u,[x.route.id]:y.error}),e.fetchers.delete(h)}else if(yl(y))yt(!1,"Unhandled fetcher revalidation redirect");else{let x=va(y.data);e.fetchers.set(h,x)}}),{loaderData:c,errors:u}}function u_(e,t,n,r){let i=Object.entries(t).filter(([,s])=>s!==DN).reduce((s,[c,u])=>(s[c]=u,s),{});for(let s of n){let c=s.route.id;if(!t.hasOwnProperty(c)&&e.hasOwnProperty(c)&&s.route.loader&&(i[c]=e[c]),r&&r.hasOwnProperty(c))break}return i}function d_(e){return e?hi(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ms(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function fp(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Oi(e,{pathname:t,routeId:n,method:r,type:i,message:s}={}){let c="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(c="Bad Request",r&&t&&n?u=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i==="invalid-body"&&(u="Unable to encode submission body")):e===403?(c="Forbidden",u=`Route "${n}" does not match URL "${t}"`):e===404?(c="Not Found",u=`No route matches URL "${t}"`):e===405&&(c="Method Not Allowed",r&&t&&n?u=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(u=`Invalid request method "${r.toUpperCase()}"`)),new Lf(e||500,c,new Error(u),!0)}function hp(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,i]=t[n];if(yl(i))return{key:r,result:i}}}function LN(e){let t=typeof e=="string"?Wo(e):e;return Vo({...t,hash:""})}function Ate(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function kte(e){return new Lf(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function Pte(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&Nte(n))}function Nte(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Ote(e){return s1(e.result)&&RN.has(e.result.status)}function hi(e){return e.type==="error"}function yl(e){return(e&&e.type)==="redirect"}function f_(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function s1(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Mte(e){return RN.has(e)}function Lte(e){return s1(e)&&Mte(e.status)&&e.headers.has("Location")}function Ite(e){return hte.has(e.toUpperCase())}function Dr(e){return dte.has(e.toUpperCase())}function l1(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function _p(e,t){let n=typeof t=="string"?Wo(t).search:t.search;if(e[e.length-1].route.index&&l1(n||""))return e[e.length-1];let r=jN(e);return r[r.length-1]}function h_(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:s,json:c}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(c!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:c,text:void 0}}}function xx(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function zte(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function jd(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function $te(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function va(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Ute(e,t){try{let n=e.sessionStorage.getItem(_N);if(n){let r=JSON.parse(n);for(let[i,s]of Object.entries(r||{}))s&&Array.isArray(s)&&t.set(i,new Set(s||[]))}}catch{}}function Bte(e,t){if(t.size>0){let n={};for(let[r,i]of t)n[r]=[...i];try{e.sessionStorage.setItem(_N,JSON.stringify(n))}catch(r){Bn(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function p_(){let e,t,n=new Promise((r,i)=>{e=async s=>{r(s);try{await n}catch{}},t=async s=>{i(s);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Gl=v.createContext(null);Gl.displayName="DataRouter";var zf=v.createContext(null);zf.displayName="DataRouterState";var IN=v.createContext(!1);function Vte(){return v.useContext(IN)}var c1=v.createContext({isTransitioning:!1});c1.displayName="ViewTransition";var zN=v.createContext(new Map);zN.displayName="Fetchers";var Fte=v.createContext(null);Fte.displayName="Await";var yi=v.createContext(null);yi.displayName="Navigation";var $f=v.createContext(null);$f.displayName="Location";var Qi=v.createContext({outlet:null,matches:[],isDataRoute:!1});Qi.displayName="Route";var u1=v.createContext(null);u1.displayName="RouteError";var $N="REACT_ROUTER_ERROR",Hte="REDIRECT",qte="ROUTE_ERROR_RESPONSE";function Gte(e){if(e.startsWith(`${$N}:${Hte}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Wte(e){if(e.startsWith(`${$N}:${qte}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Lf(t.status,t.statusText,t.data)}catch{}}function Qte(e,{relative:t}={}){yt(Ru(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=v.useContext(yi),{hash:i,pathname:s,search:c}=Uf(e,{relative:t}),u=s;return n!=="/"&&(u=s==="/"?n:so([n,s])),r.createHref({pathname:u,search:c,hash:i})}function Ru(){return v.useContext($f)!=null}function Fr(){return yt(Ru(),"useLocation() may be used only in the context of a <Router> component."),v.useContext($f).location}var UN="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function BN(e){v.useContext(yi).static||v.useLayoutEffect(e)}function Fn(){let{isDataRoute:e}=v.useContext(Qi);return e?cne():Yte()}function Yte(){yt(Ru(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Gl),{basename:t,navigator:n}=v.useContext(yi),{matches:r}=v.useContext(Qi),{pathname:i}=Fr(),s=JSON.stringify(xg(r)),c=v.useRef(!1);return BN(()=>{c.current=!0}),v.useCallback((f,h={})=>{if(Bn(c.current,UN),!c.current)return;if(typeof f=="number"){n.go(f);return}let m=Mf(f,JSON.parse(s),i,h.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:so([t,m.pathname])),(h.replace?n.replace:n.push)(m,h.state,h)},[t,n,s,i,e])}var Kte=v.createContext(null);function Xte(e){let t=v.useContext(Qi).outlet;return v.useMemo(()=>t&&v.createElement(Kte.Provider,{value:e},t),[t,e])}function Yt(){let{matches:e}=v.useContext(Qi),t=e[e.length-1];return t?t.params:{}}function Uf(e,{relative:t}={}){let{matches:n}=v.useContext(Qi),{pathname:r}=Fr(),i=JSON.stringify(xg(n));return v.useMemo(()=>Mf(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function Jte(e,t){return VN(e,t)}function VN(e,t,n){yt(Ru(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=v.useContext(yi),{matches:i}=v.useContext(Qi),s=i[i.length-1],c=s?s.params:{},u=s?s.pathname:"/",f=s?s.pathnameBase:"/",h=s&&s.route;{let C=h&&h.path||"";HN(u,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
216
+
217
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let m=Fr(),g;if(t){let C=typeof t=="string"?Wo(t):t;yt(f==="/"||C.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${C.pathname}" was given in the \`location\` prop.`),g=C}else g=m;let y=g.pathname||"/",x=y;if(f!=="/"){let C=f.replace(/^\//,"").split("/");x="/"+y.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=ps(e,{pathname:x});Bn(h||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Bn(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=rne(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:so([f,r.encodeLocation?r.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:so([f,r.encodeLocation?r.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,n);return t&&w?v.createElement($f.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},w):w}function Zte(){let e=lne(),t=tf(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:s},"ErrorBoundary")," or"," ",v.createElement("code",{style:s},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:i},n):null,c)}var ene=v.createElement(Zte,null),FN=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Wte(e.digest);n&&(e=n)}let t=e!==void 0?v.createElement(Qi.Provider,{value:this.props.routeContext},v.createElement(u1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(tne,{error:e},t):t}};FN.contextType=IN;var bx=new WeakMap;function tne({children:e,error:t}){let{basename:n}=v.useContext(yi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Gte(t.digest);if(r){let i=bx.get(t);if(i)throw i;let s=CN(r.location,n);if(wN&&!bx.get(t))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw bx.set(t,c),c}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function nne({routeContext:e,match:t,children:n}){let r=v.useContext(Gl);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Qi.Provider,{value:e},n)}function rne(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,s=r?.errors;if(s!=null){let m=i.findIndex(g=>g.route.id&&s?.[g.route.id]!==void 0);yt(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,m+1))}let c=!1,u=-1;if(n&&r){c=r.renderFallback;for(let m=0;m<i.length;m++){let g=i[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=m),g.route.id){let{loaderData:y,errors:x}=r,S=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||S){n.isStatic&&(c=!0),u>=0?i=i.slice(0,u+1):i=[i[0]];break}}}}let f=n?.onError,h=r&&f?(m,g)=>{f(m,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:If(r.matches),errorInfo:g})}:void 0;return i.reduceRight((m,g,y)=>{let x,S=!1,w=null,C=null;r&&(x=s&&g.route.id?s[g.route.id]:void 0,w=g.route.errorElement||ene,c&&(u<0&&y===0?(HN("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):u===y&&(S=!0,C=g.route.hydrateFallbackElement||null)));let T=t.concat(i.slice(0,y+1)),R=()=>{let E;return x?E=w:S?E=C:g.route.Component?E=v.createElement(g.route.Component,null):g.route.element?E=g.route.element:E=m,v.createElement(nne,{match:g,routeContext:{outlet:m,matches:T,isDataRoute:r!=null},children:E})};return r&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?v.createElement(FN,{location:r.location,revalidation:r.revalidation,component:w,error:x,children:R(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:h}):R()},null)}function d1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ine(e){let t=v.useContext(Gl);return yt(t,d1(e)),t}function one(e){let t=v.useContext(zf);return yt(t,d1(e)),t}function ane(e){let t=v.useContext(Qi);return yt(t,d1(e)),t}function f1(e){let t=ane(e),n=t.matches[t.matches.length-1];return yt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function sne(){return f1("useRouteId")}function lne(){let e=v.useContext(u1),t=one("useRouteError"),n=f1("useRouteError");return e!==void 0?e:t.errors?.[n]}function cne(){let{router:e}=ine("useNavigate"),t=f1("useNavigate"),n=v.useRef(!1);return BN(()=>{n.current=!0}),v.useCallback(async(i,s={})=>{Bn(n.current,UN),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...s}))},[e,t])}var m_={};function HN(e,t,n){!t&&!m_[e]&&(m_[e]=!0,Bn(!1,n))}var g_={};function v_(e,t){!e&&!g_[t]&&(g_[t]=!0,console.warn(t))}var une="useOptimistic",y_=wb[une],dne=()=>{};function fne(e){return y_?y_(e):[e,dne]}function hne(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Bn(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Bn(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Bn(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var pne=["HydrateFallback","hydrateFallbackElement"],mne=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function gne({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=Vte()||r;let[s,c]=v.useState(e.state),[u,f]=fne(s),[h,m]=v.useState(),[g,y]=v.useState({isTransitioning:!1}),[x,S]=v.useState(),[w,C]=v.useState(),[T,R]=v.useState(),E=v.useRef(new Map),_=v.useCallback((A,{deletedFetchers:z,newErrors:U,flushSync:K,viewTransitionOpts:W})=>{U&&n&&Object.values(U).forEach(B=>n(B,{location:A.location,params:A.matches[0]?.params??{},unstable_pattern:If(A.matches)})),A.fetchers.forEach((B,G)=>{B.data!==void 0&&E.current.set(G,B.data)}),z.forEach(B=>E.current.delete(B)),v_(K===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let ee=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(v_(W==null||ee,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!W||!ee){t&&K?t(()=>c(A)):r===!1?c(A):v.startTransition(()=>{r===!0&&f(B=>x_(B,A)),c(A)});return}if(t&&K){t(()=>{w&&(x?.resolve(),w.skipTransition()),y({isTransitioning:!0,flushSync:!0,currentLocation:W.currentLocation,nextLocation:W.nextLocation})});let B=e.window.document.startViewTransition(()=>{t(()=>c(A))});B.finished.finally(()=>{t(()=>{S(void 0),C(void 0),m(void 0),y({isTransitioning:!1})})}),t(()=>C(B));return}w?(x?.resolve(),w.skipTransition(),R({state:A,currentLocation:W.currentLocation,nextLocation:W.nextLocation})):(m(A),y({isTransitioning:!0,flushSync:!1,currentLocation:W.currentLocation,nextLocation:W.nextLocation}))},[e.window,t,w,x,r,f,n]);v.useLayoutEffect(()=>e.subscribe(_),[e,_]),v.useEffect(()=>{g.isTransitioning&&!g.flushSync&&S(new mne)},[g]),v.useEffect(()=>{if(x&&h&&e.window){let A=h,z=x.promise,U=e.window.document.startViewTransition(async()=>{r===!1?c(A):v.startTransition(()=>{r===!0&&f(K=>x_(K,A)),c(A)}),await z});U.finished.finally(()=>{S(void 0),C(void 0),m(void 0),y({isTransitioning:!1})}),C(U)}},[h,x,e.window,r,f]),v.useEffect(()=>{x&&h&&u.location.key===h.location.key&&x.resolve()},[x,w,u.location,h]),v.useEffect(()=>{!g.isTransitioning&&T&&(m(T.state),y({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}),R(void 0))},[g.isTransitioning,T]);let P=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:A=>e.navigate(A),push:(A,z,U)=>e.navigate(A,{state:z,preventScrollReset:U?.preventScrollReset}),replace:(A,z,U)=>e.navigate(A,{replace:!0,state:z,preventScrollReset:U?.preventScrollReset})}),[e]),O=e.basename||"/",k=v.useMemo(()=>({router:e,navigator:P,static:!1,basename:O,onError:n}),[e,P,O,n]);return v.createElement(v.Fragment,null,v.createElement(Gl.Provider,{value:k},v.createElement(zf.Provider,{value:u},v.createElement(zN.Provider,{value:E.current},v.createElement(c1.Provider,{value:g},v.createElement(bne,{basename:O,location:u.location,navigationType:u.historyAction,navigator:P,unstable_useTransitions:r},v.createElement(vne,{routes:e.routes,future:e.future,state:u,isStatic:!1,onError:n})))))),null)}function x_(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var vne=v.memo(yne);function yne({routes:e,future:t,state:n,isStatic:r,onError:i}){return VN(e,void 0,{state:n,isStatic:r,onError:i})}function xne({to:e,replace:t,state:n,relative:r}){yt(Ru(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=v.useContext(yi);Bn(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=v.useContext(Qi),{pathname:c}=Fr(),u=Fn(),f=Mf(e,xg(s),c,r==="path"),h=JSON.stringify(f);return v.useEffect(()=>{u(JSON.parse(h),{replace:t,state:n,relative:r})},[u,h,r,t,n]),null}function h1(e){return Xte(e.context)}function Be(e){yt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function bne({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:c}){yt(!Ru(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),f=v.useMemo(()=>({basename:u,navigator:i,static:s,unstable_useTransitions:c,future:{}}),[u,i,s,c]);typeof n=="string"&&(n=Wo(n));let{pathname:h="/",search:m="",hash:g="",state:y=null,key:x="default",unstable_mask:S}=n,w=v.useMemo(()=>{let C=Bi(h,u);return C==null?null:{location:{pathname:C,search:m,hash:g,state:y,key:x,unstable_mask:S},navigationType:r}},[u,h,m,g,y,x,r,S]);return Bn(w!=null,`<Router basename="${u}"> is not able to match the URL "${h}${m}${g}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:v.createElement(yi.Provider,{value:f},v.createElement($f.Provider,{children:t,value:w}))}function Sne({children:e,location:t}){return Jte(fb(e),t)}function fb(e,t=[]){let n=[];return v.Children.forEach(e,(r,i)=>{if(!v.isValidElement(r))return;let s=[...t,i];if(r.type===v.Fragment){n.push.apply(n,fb(r.props.children,s));return}yt(r.type===Be,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),yt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let c={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(c.children=fb(r.props.children,s)),n.push(c)}),n}var Dp="get",Ap="application/x-www-form-urlencoded";function bg(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jne(e){return bg(e)&&e.tagName.toLowerCase()==="button"}function wne(e){return bg(e)&&e.tagName.toLowerCase()==="form"}function Cne(e){return bg(e)&&e.tagName.toLowerCase()==="input"}function Ene(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tne(e,t){return e.button===0&&(!t||t==="_self")&&!Ene(e)}function hb(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function Rne(e,t){let n=hb(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}var pp=null;function _ne(){if(pp===null)try{new FormData(document.createElement("form"),0),pp=!1}catch{pp=!0}return pp}var Dne=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Sx(e){return e!=null&&!Dne.has(e)?(Bn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ap}"`),null):e}function Ane(e,t){let n,r,i,s,c;if(wne(e)){let u=e.getAttribute("action");r=u?Bi(u,t):null,n=e.getAttribute("method")||Dp,i=Sx(e.getAttribute("enctype"))||Ap,s=new FormData(e)}else if(jne(e)||Cne(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||u.getAttribute("action");if(r=f?Bi(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Dp,i=Sx(e.getAttribute("formenctype"))||Sx(u.getAttribute("enctype"))||Ap,s=new FormData(u,e),!_ne()){let{name:h,type:m,value:g}=e;if(m==="image"){let y=h?`${h}.`:"";s.append(`${y}x`,"0"),s.append(`${y}y`,"0")}else h&&s.append(h,g)}}else{if(bg(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Dp,r=null,i=Ap,c=e}return s&&i==="text/plain"&&(c=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function p1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function kne(e,t,n,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&Bi(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function Pne(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Nne(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function One(e,t,n){let r=await Promise.all(e.map(async i=>{let s=t.routes[i.route.id];if(s){let c=await Pne(s,n);return c.links?c.links():[]}return[]}));return zne(r.flat(1).filter(Nne).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function b_(e,t,n,r,i,s){let c=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,u=(f,h)=>n[h].pathname!==f.pathname||n[h].route.path?.endsWith("*")&&n[h].params["*"]!==f.params["*"];return s==="assets"?t.filter((f,h)=>c(f,h)||u(f,h)):s==="data"?t.filter((f,h)=>{let m=r.routes[f.route.id];if(!m||!m.hasLoader)return!1;if(c(f,h)||u(f,h))return!0;if(f.route.shouldRevalidate){let g=f.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function Mne(e,t,{includeHydrateFallback:n}={}){return Lne(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function Lne(e){return[...new Set(e)]}function Ine(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function zne(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let s=JSON.stringify(Ine(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function qN(){let e=v.useContext(Gl);return p1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function $ne(){let e=v.useContext(zf);return p1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var m1=v.createContext(void 0);m1.displayName="FrameworkContext";function GN(){let e=v.useContext(m1);return p1(e,"You must render this element inside a <HydratedRouter> element"),e}function Une(e,t){let n=v.useContext(m1),[r,i]=v.useState(!1),[s,c]=v.useState(!1),{onFocus:u,onBlur:f,onMouseEnter:h,onMouseLeave:m,onTouchStart:g}=t,y=v.useRef(null);v.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let w=T=>{T.forEach(R=>{c(R.isIntersecting)})},C=new IntersectionObserver(w,{threshold:.5});return y.current&&C.observe(y.current),()=>{C.disconnect()}}},[e]),v.useEffect(()=>{if(r){let w=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(w)}}},[r]);let x=()=>{i(!0)},S=()=>{i(!1),c(!1)};return n?e!=="intent"?[s,y,{}]:[s,y,{onFocus:wd(u,x),onBlur:wd(f,S),onMouseEnter:wd(h,x),onMouseLeave:wd(m,S),onTouchStart:wd(g,x)}]:[!1,y,{}]}function wd(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Bne({page:e,...t}){let{router:n}=qN(),r=v.useMemo(()=>ps(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?v.createElement(Fne,{page:e,matches:r,...t}):null}function Vne(e){let{manifest:t,routeModules:n}=GN(),[r,i]=v.useState([]);return v.useEffect(()=>{let s=!1;return One(e,t,n).then(c=>{s||i(c)}),()=>{s=!0}},[e,t,n]),r}function Fne({page:e,matches:t,...n}){let r=Fr(),{future:i,manifest:s,routeModules:c}=GN(),{basename:u}=qN(),{loaderData:f,matches:h}=$ne(),m=v.useMemo(()=>b_(e,t,h,s,r,"data"),[e,t,h,s,r]),g=v.useMemo(()=>b_(e,t,h,s,r,"assets"),[e,t,h,s,r]),y=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,C=!1;if(t.forEach(R=>{let E=s.routes[R.route.id];!E||!E.hasLoader||(!m.some(_=>_.route.id===R.route.id)&&R.route.id in f&&c[R.route.id]?.shouldRevalidate||E.hasClientLoader?C=!0:w.add(R.route.id))}),w.size===0)return[];let T=kne(e,u,i.unstable_trailingSlashAwareDataRequests,"data");return C&&w.size>0&&T.searchParams.set("_routes",t.filter(R=>w.has(R.route.id)).map(R=>R.route.id).join(",")),[T.pathname+T.search]},[u,i.unstable_trailingSlashAwareDataRequests,f,r,s,m,t,e,c]),x=v.useMemo(()=>Mne(g,s),[g,s]),S=Vne(g);return v.createElement(v.Fragment,null,y.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),x.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),S.map(({key:w,link:C})=>v.createElement("link",{key:w,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function Hne(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var qne=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{qne&&(window.__reactRouterVersion="7.13.1")}catch{}function Gne(e,t){return vte({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:Nee({window:t?.window}),hydrationData:Wne(),routes:e,mapRouteProperties:hne,hydrationRouteProperties:pne,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function Wne(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Qne(e.errors)}),e}function Qne(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,i]of t)if(i&&i.__type==="RouteErrorResponse")n[r]=new Lf(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let s=window[i.__subType];if(typeof s=="function")try{let c=new s(i.message);c.stack="",n[r]=c}catch{}}if(n[r]==null){let s=new Error(i.message);s.stack="",n[r]=s}}else n[r]=i;return n}var WN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,QN=v.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:c,unstable_mask:u,state:f,target:h,to:m,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:x,...S},w){let{basename:C,navigator:T,unstable_useTransitions:R}=v.useContext(yi),E=typeof m=="string"&&WN.test(m),_=CN(m,C);m=_.to;let P=Qte(m,{relative:i}),O=Fr(),k=null;if(u){let G=Mf(u,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);C!=="/"&&(G.pathname=G.pathname==="/"?C:so([C,G.pathname])),k=T.createHref(G)}let[A,z,U]=Une(r,S),K=Jne(m,{replace:c,unstable_mask:u,state:f,target:h,preventScrollReset:g,relative:i,viewTransition:y,unstable_defaultShouldRevalidate:x,unstable_useTransitions:R});function W(G){t&&t(G),G.defaultPrevented||K(G)}let ee=!(_.isExternal||s),B=v.createElement("a",{...S,...U,href:(ee?k:void 0)||_.absoluteURL||P,onClick:ee?W:t,ref:Hne(w,z),target:h,"data-discover":!E&&n==="render"?"true":void 0});return A&&!E?v.createElement(v.Fragment,null,B,v.createElement(Bne,{page:P})):B});QN.displayName="Link";var Yne=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:c,viewTransition:u,children:f,...h},m){let g=Uf(c,{relative:h.relative}),y=Fr(),x=v.useContext(zf),{navigator:S,basename:w}=v.useContext(yi),C=x!=null&&rre(g)&&u===!0,T=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,R=y.pathname,E=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(R=R.toLowerCase(),E=E?E.toLowerCase():null,T=T.toLowerCase()),E&&w&&(E=Bi(E,w)||E);const _=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let P=R===T||!i&&R.startsWith(T)&&R.charAt(_)==="/",O=E!=null&&(E===T||!i&&E.startsWith(T)&&E.charAt(T.length)==="/"),k={isActive:P,isPending:O,isTransitioning:C},A=P?t:void 0,z;typeof r=="function"?z=r(k):z=[r,P?"active":null,O?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let U=typeof s=="function"?s(k):s;return v.createElement(QN,{...h,"aria-current":A,className:z,ref:m,style:U,to:c,viewTransition:u},typeof f=="function"?f(k):f)});Yne.displayName="NavLink";var Kne=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:s,method:c=Dp,action:u,onSubmit:f,relative:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},S)=>{let{unstable_useTransitions:w}=v.useContext(yi),C=tre(),T=nre(u,{relative:h}),R=c.toLowerCase()==="get"?"get":"post",E=typeof u=="string"&&WN.test(u),_=P=>{if(f&&f(P),P.defaultPrevented)return;P.preventDefault();let O=P.nativeEvent.submitter,k=O?.getAttribute("formmethod")||c,A=()=>C(O||P.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:i,state:s,relative:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y});w&&n!==!1?v.startTransition(()=>A()):A()};return v.createElement("form",{ref:S,method:R,action:T,onSubmit:r?f:_,...x,"data-discover":!E&&e==="render"?"true":void 0})});Kne.displayName="Form";function Xne(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YN(e){let t=v.useContext(Gl);return yt(t,Xne(e)),t}function Jne(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:h}={}){let m=Fn(),g=Fr(),y=Uf(e,{relative:c});return v.useCallback(x=>{if(Tne(x,t)){x.preventDefault();let S=n!==void 0?n:Vo(g)===Vo(y),w=()=>m(e,{replace:S,unstable_mask:r,state:i,preventScrollReset:s,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:f});h?v.startTransition(()=>w()):w()}},[g,m,y,n,r,i,t,e,s,c,u,f,h])}function Sg(e){Bn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(hb(e)),n=v.useRef(!1),r=Fr(),i=v.useMemo(()=>Rne(r.search,n.current?null:t.current),[r.search]),s=Fn(),c=v.useCallback((u,f)=>{const h=hb(typeof u=="function"?u(new URLSearchParams(i)):u);n.current=!0,s("?"+h,f)},[s,i]);return[i,c]}var Zne=0,ere=()=>`__${String(++Zne)}__`;function tre(){let{router:e}=YN("useSubmit"),{basename:t}=v.useContext(yi),n=sne(),r=e.fetch,i=e.navigate;return v.useCallback(async(s,c={})=>{let{action:u,method:f,encType:h,formData:m,body:g}=Ane(s,t);if(c.navigate===!1){let y=c.fetcherKey||ere();await r(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:m,body:g,formMethod:c.method||f,formEncType:c.encType||h,flushSync:c.flushSync})}else await i(c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:m,body:g,formMethod:c.method||f,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[r,i,t,n])}function nre(e,{relative:t}={}){let{basename:n}=v.useContext(yi),r=v.useContext(Qi);yt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Uf(e||".",{relative:t})},c=Fr();if(e==null){s.search=c.search;let u=new URLSearchParams(s.search),f=u.getAll("index");if(f.some(m=>m==="")){u.delete("index"),f.filter(g=>g).forEach(g=>u.append("index",g));let m=u.toString();s.search=m?`?${m}`:""}}return(!e||e===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:so([n,s.pathname])),Vo(s)}function rre(e,{relative:t}={}){let n=v.useContext(c1);yt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=YN("useViewTransitionState"),i=Uf(e,{relative:t});if(!n.isTransitioning)return!1;let s=Bi(n.currentLocation.pathname,r)||n.currentLocation.pathname,c=Bi(n.nextLocation.pathname,r)||n.nextLocation.pathname;return rm(i.pathname,c)!=null||rm(i.pathname,s)!=null}function g1(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function ire(e){if(e.resourceType==="Specimen")return e;if(e.resourceType==="Observation")return e.specimen;if(e.resourceType==="DiagnosticReport"||e.resourceType==="ServiceRequest")return e.specimen?.[0]}function Ls(e){return bs(e.getActiveLogin()?.project)}function KN(e){const t=Re(),n=Ls(t),r=Fn(),i=[{code:"project",operator:fe.EQUALS,value:"Project/"+n},{code:"profile-type",operator:fe.EQUALS,value:e.resourceType??"Patient,Practitioner,RelatedPerson"}],[s,c]=v.useState({resourceType:"ProjectMembership",filters:i,fields:e.fields,count:100});return a.jsx(ql,{search:s,onClick:u=>r(`/ProjectMembership/${u.resource.id}`),onChange:u=>c(u.definition),hideFilters:!0,hideToolbar:!0})}function ore(){return a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:"ProjectMemberships for Bots"}),a.jsx(KN,{resourceType:"Bot",fields:["user","profile","accessPolicy","userConfiguration","active","admin"]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(jt,{to:"/admin/bots/new",children:"Create new bot"})})]})}function are(){return a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:"ProjectMemberships for ClientApplications"}),a.jsx(KN,{resourceType:"ClientApplication",fields:["user","profile","accessPolicy","userConfiguration","active","admin"]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(jt,{to:"/admin/clients/new",children:"Create new client"})})]})}function v1(e){return a.jsx(Eu,{resourceType:"AccessPolicy",name:e.name,defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{Oa(t)?e.onChange(nn(t)):e.onChange(void 0)}})}function sre(){const e=Re(),t=Ls(e),[n,r]=v.useState(""),[i,s]=v.useState(""),[c,u]=v.useState(),[f,h]=v.useState(),[m,g]=v.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:"Create new Bot"}),a.jsxs(pt,{onSubmit:()=>{const y={name:n,description:i,accessPolicy:c};e.post("admin/projects/"+t+"/bot",y).then(x=>{e.invalidateSearches("Bot"),e.invalidateSearches("ProjectMembership"),g(x),Ae({color:"green",message:"Bot created"})}).catch(x=>{Ae({color:"red",message:We(x),autoClose:!1}),h(rn(x))})},children:[!m&&a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Name",htmlFor:"name",outcome:f,children:a.jsx(Fe,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:y=>r(y.currentTarget.value),error:Ut(f,"name")})}),a.jsx(Vt,{title:"Description",htmlFor:"description",outcome:f,children:a.jsx(Fe,{id:"description",name:"description",onChange:y=>s(y.currentTarget.value),error:Ut(f,"description")})}),a.jsx(Vt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(v1,{name:"accessPolicy",onChange:u})}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Me,{type:"submit",children:"Create Bot"})})]}),m&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(ge,{children:"Bot created"}),a.jsxs(zr,{children:[a.jsx(zr.Item,{children:a.jsx(jt,{to:m,children:"Go to new bot"})}),a.jsx(zr.Item,{children:a.jsx(jt,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function lre(){const e=Re(),t=Ls(e),[n,r]=v.useState(""),[i,s]=v.useState(""),[c,u]=v.useState(""),[f,h]=v.useState(),[m,g]=v.useState(),[y,x]=v.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:"Create new Client"}),a.jsxs(pt,{onSubmit:()=>{const S={name:n,description:i,redirectUri:c,accessPolicy:f};e.post("admin/projects/"+t+"/client",S).then(w=>{e.invalidateSearches("ClientApplication"),e.invalidateSearches("ProjectMembership"),x(w),Ae({color:"green",message:"Client created"})}).catch(w=>{Ae({color:"red",message:We(w),autoClose:!1}),g(rn(w))})},children:[!y&&a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Name",htmlFor:"name",outcome:m,children:a.jsx(Fe,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:S=>r(S.currentTarget.value),error:Ut(m,"name")})}),a.jsx(Vt,{title:"Description",htmlFor:"description",outcome:m,children:a.jsx(Fe,{id:"description",name:"description",onChange:S=>s(S.currentTarget.value),error:Ut(m,"description")})}),a.jsx(Vt,{title:"Redirect URI",htmlFor:"redirectUri",outcome:m,children:a.jsx(Fe,{id:"redirectUri",name:"redirectUri",onChange:S=>u(S.currentTarget.value),error:Ut(m,"redirectUri")})}),a.jsx(Vt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:m,children:a.jsx(v1,{name:"accessPolicy",onChange:h})}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Me,{type:"submit",children:"Create Client"})})]}),y&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(ge,{children:"Client created"}),a.jsxs(zr,{children:[a.jsx(zr.Item,{children:a.jsx(jt,{to:y,children:"Go to new client"})}),a.jsx(zr.Item,{children:a.jsx(jt,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}const cre=1e-10;function pb(e,t){let n=0,r=Math.exp(-t);for(let i=0;i<=e;i++)i>0&&(r*=t/i),n+=r;return n}function ure(e,t,n=cre){let r=0,i=Math.max(t+1,1);for(;pb(t,i)>e;)i*=2;for(;i-r>n;){const s=(r+i)/2;pb(t,s)>e?r=s:i=s}return i}function dre(e,t,n,r){const i=e*300,s=9*t*i/(e*10*1e3/7),c=Math.ceil(s),u=c/i,f=Math.max(r??0,u),h=r?f*i:c,m=h,g=pb(h-1,m),y=Math.log(1-n)/Math.log(g);return{rowsSampled:i,cutoffFrequencyExact:s,cutoffFrequency:c,minimumSelectivity:u,targetSelectivity:f,targetLambda:m,targetPoissonCdf:g,targetM:y,results:[{name:"Floor",result:S_(Math.floor(y),n,h,i)},{name:"Ceiling",result:S_(Math.ceil(y),n,h,i)}]}}function S_(e,t,n,r){const i=Math.pow(1-t,1/e),s=ure(i,n-1),c=s/r;return{m:e,poissonCdf:i,lambda:s,f:c}}function XN(e,t="auto",n=6){return Number.isFinite(e)?t==="scientific"?e.toExponential(n):t==="fixed"?e.toFixed(n):Math.abs(e)<1e-4&&e!==0?e.toExponential(n):Math.abs(e-Math.round(e))<1e-10?Math.round(e).toString():e.toPrecision(8):String(e)}function Mi({label:e,value:t,format:n="auto",decimals:r=6}){return a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:8,children:a.jsx(ge,{size:"sm",children:e})}),a.jsx(Nt.Col,{span:4,children:a.jsx(ge,{size:"sm",ff:"monospace",ta:"right",children:XN(t,n,r)})})]})}function fre({title:e,m:t,poissonCdf:n,lambda:r,f:i}){return a.jsxs(gr,{withBorder:!0,p:"md",children:[a.jsx(ze,{order:4,mb:"sm",children:e}),a.jsxs(Ne,{gap:"xs",children:[a.jsx(Mi,{label:"M (padding multiplier)",value:t}),a.jsx(Mi,{label:"Poisson CDF",value:n}),a.jsx(Mi,{label:"Lambda",value:r}),a.jsx(Mi,{label:"F (selectivity)",value:i,format:"scientific"})]})]})}function hre(){const[e,t]=v.useState(1e3),[n,r]=v.useState(3),[i,s]=v.useState(.999999),[c,u]=v.useState(""),f=v.useMemo(()=>{const h=typeof e=="number"?e:void 0,m=typeof n=="number"?n:void 0,g=typeof i=="number"?i:void 0,y=typeof c=="number"?c:void 0;if(!(h===void 0||m===void 0||g===void 0))return dre(h,m,g,y)},[e,n,i,c]);return a.jsxs(Ne,{gap:"lg",children:[a.jsxs(gr,{withBorder:!0,p:"md",children:[a.jsx(ze,{order:4,mb:"md",children:"Inputs"}),a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:{base:12,sm:6,md:3},children:a.jsx(hr,{label:"Statistics Target",value:e,onChange:t,min:100,max:1e4,step:100})}),a.jsx(Nt.Col,{span:{base:12,sm:6,md:3},children:a.jsx(hr,{label:"Elements Per Row",value:n,onChange:r,min:1,max:1e3,step:1})}),a.jsx(Nt.Col,{span:{base:12,sm:6,md:3},children:a.jsx(hr,{label:"Confidence",value:i,onChange:s,min:0,max:1,step:1e-6,decimalScale:10})}),a.jsx(Nt.Col,{span:{base:12,sm:6,md:3},children:a.jsx(hr,{label:"Target Selectivity (optional)",description:"Overrides minimum selectivity",value:c,onChange:u,min:0,max:1,step:1e-5,decimalScale:10,placeholder:f?XN(f.minimumSelectivity,"scientific"):""})})]})]}),f&&a.jsxs(a.Fragment,{children:[a.jsxs(gr,{withBorder:!0,p:"md",children:[a.jsx(ze,{order:4,mb:"sm",children:"Intermediate Values"}),a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:{base:12,md:6},children:a.jsxs(Ne,{gap:"xs",children:[a.jsx(Mi,{label:"Rows Sampled",value:f.rowsSampled}),a.jsx(Mi,{label:"Cutoff Frequency (exact)",value:f.cutoffFrequencyExact}),a.jsx(Mi,{label:"Cutoff Frequency",value:f.cutoffFrequency}),a.jsx(Mi,{label:"Min Selectivity",value:f.minimumSelectivity,format:"scientific"})]})}),a.jsx(Nt.Col,{span:{base:12,md:6},children:a.jsxs(Ne,{gap:"xs",children:[a.jsx(Mi,{label:"Target Selectivity",value:f.targetSelectivity,format:"scientific"}),a.jsx(Mi,{label:"Target Lambda",value:f.targetLambda}),a.jsx(Mi,{label:"Target Poisson CDF",value:f.targetPoissonCdf}),a.jsx(Mi,{label:"Target m",value:f.targetM})]})})]})]}),a.jsx(Nt,{children:f.results.map(({name:h,result:m})=>a.jsx(Nt.Col,{span:{base:12,md:6},children:a.jsx(fre,{title:`${h} Option`,m:m.m,poissonCdf:m.poissonCdf,lambda:m.lambda,f:m.f})},h))})]})]})}const pre=8;function JN({inputProps:e,data:t,onChange:n}){const r=$l({onDropdownClose:()=>r.resetSelectedOption()}),[i,s]=v.useState(null),[c,u]=v.useState(""),f=v.useMemo(()=>t.filter(m=>m.toLowerCase().includes(c.toLowerCase().trim())),[t,c]),h=v.useMemo(()=>{const m=new Array(Math.min(f.length,pre));for(let g=0;g<m.length;g++){const y=f[g];m[g]=a.jsx(Ye.Option,{value:y,children:y},y)}return m},[f]);return a.jsxs(Ye,{store:r,withinPortal:!1,onOptionSubmit:m=>{n&&n(m),s(m),u(m),r.closeDropdown()},children:[a.jsx(Ye.Target,{children:a.jsx(Vr,{rightSection:a.jsx(Ye.Chevron,{}),value:c,onChange:m=>{r.openDropdown(),r.updateSelectedOptionIndex(),u(m.currentTarget.value)},onClick:()=>r.openDropdown(),onFocus:()=>r.openDropdown(),onBlur:()=>{r.closeDropdown(),u(i||"")},rightSectionPointerEvents:"none",...e})}),a.jsx(Ye.Dropdown,{children:a.jsx(Ye.Options,{children:h.length>0?h:a.jsx(Ye.Empty,{children:"Nothing found"})})})]})}function mre(e){let t=[];for(const n of e)t.push(n),t.push(n+"_History"),t.push(n+"_References");return t.push("Address"),t.push("ContactPoint"),t.push("HumanName"),t.push("Coding"),t.push("Coding_Property"),t.push("DatabaseMigration"),t=au(t),t}function ZN(e){return typeof e=="string"?e.length>50?e.substring(0,50)+"...":e:typeof e=="boolean"?e.toString().toLocaleUpperCase():e}const eO=({medplum:e,onChange:t,onError:n})=>{v.useEffect(()=>{async function r(){return(await e.valueSetExpand({url:"https://medplum.com/fhir/ValueSet/resource-types",count:200})).expansion?.contains?.map(s=>s.code).filter(s=>s!==void 0)??[]}r().then(i=>{t(mre(i))}).catch(i=>{n?n(i):console.error(i)})},[e,t,n])};function gre(){const e=Re(),[t,{open:n,close:r}]=Ts(!1),[i,s]=v.useState(""),[c,u]=v.useState(),[f,h]=v.useState(void 0),[m,g]=v.useState(0),[y,x]=v.useState(!1),[S,w]=v.useState([]),[C,T]=v.useState([]),[R,E]=v.useState(!1),[_,P]=v.useState(void 0),[O,k]=v.useState([]),[A,z]=v.useState(0),[U,K]=v.useState(!1),[W,ee]=v.useState(!1);eO({medplum:e,onChange:k}),v.useEffect(()=>{x(!0),e.get("fhir/R4/$db-column-statistics?tableName="+encodeURIComponent(f??""),{cache:"no-cache"}).then(I=>{const $=I.parameter?.find(M=>M.name==="defaultStatisticsTarget")?.valueInteger??0;g($);const X=I.parameter?.find(M=>M.name==="table")?.part?.filter(M=>M.name==="column");w(X??[])}).finally(()=>{x(!1)}).catch(I=>{Ae({color:"red",message:I.message})})},[e,f,A]);function B(){if(f){if(C.length===0){Ae({color:"red",message:"No columns selected",autoClose:!0});return}Ae({title:"Submit",message:JSON.stringify({resetToDefault:R,newStatisticsTarget:_,selectedRowNames:C}),autoClose:!0}),e.post("fhir/R4/$db-configure-column-statistics",{tableName:f,columnNames:C,resetToDefault:R,newStatisticsTarget:R?void 0:_}).then(I=>{Ae({color:"green",message:"Done"}),z($=>$+1)}).catch(I=>Ae({color:"red",message:We(I),autoClose:!1}))}}const G={onClick:I=>{s("Details"),u(a.jsx("pre",{children:I})),n()}};let L=0;return a.jsxs(pt,{onSubmit:B,children:[a.jsxs(Ne,{gap:"sm",children:[a.jsxs(xe,{children:[a.jsx(JN,{data:O,inputProps:{placeholder:"Table name",inputSize:"50"},onChange:I=>{h(I),T([])}}),a.jsx(Me,{loading:y,onClick:()=>z(I=>I+1),children:"Refresh"})]}),a.jsxs(xe,{children:[a.jsx(ge,{span:!0,fw:700,children:"Statistics Target:"}),a.jsx(hr,{value:R?"":_,disabled:R,required:!R,size:"sm",w:"100",min:0,step:100,max:1e4,onChange:I=>{typeof I=="number"&&P(I)}}),a.jsx(ge,{span:!0,fw:700,c:"dimmed",children:"– or –"}),a.jsx(fn,{checked:R,onChange:I=>E(I.currentTarget.checked),label:"Reset to default ("+m+")",size:"sm"}),a.jsx(yr,{size:"sm",children:"Update"})]}),a.jsx(xe,{children:a.jsx(fn,{checked:W,onChange:I=>ee(I.currentTarget.checked),label:"Hide columns with default statistics target",size:"sm"})}),a.jsx(xe,{children:a.jsx(fn,{checked:U,onChange:I=>K(I.currentTarget.checked),label:"Show all column stats",size:"sm"})}),a.jsx(Z.ScrollContainer,{minWidth:500,children:a.jsxs(Z,{striped:!0,highlightOnHover:!0,children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{children:a.jsx(fn,{size:"sm",checked:S.length>0&&C.length===S.length,indeterminate:C.length>0&&C.length<S.length,onChange:()=>{C.length===S.length?T([]):T(S.map(I=>I.part?.find($=>$.name==="name")?.valueString??""))}})}),a.jsx(Z.Th,{children:"Column"}),a.jsx(Z.Th,{children:"Statistics Target"}),a.jsx(Z.Th,{children:"null_frac"}),a.jsx(Z.Th,{children:"avg_width"}),a.jsx(Z.Th,{children:"n_distinct"}),a.jsx(Z.Th,{children:"correlation"}),U&&a.jsxs(a.Fragment,{children:[a.jsx(Z.Th,{children:"most_common_vals"}),a.jsx(Z.Th,{children:"most_common_freqs"}),a.jsx(Z.Th,{children:"histogram_bounds"}),a.jsx(Z.Th,{children:"most_common_elems"}),a.jsx(Z.Th,{children:"most_common_elem_freqs"}),a.jsx(Z.Th,{children:"elem_count_histogram"})]})]})}),a.jsxs(Z.Tbody,{children:[S?.map(I=>{const $=I.part??[],V=$.find(M=>M.name==="name")?.valueString,X=$.find(M=>M.name==="statisticsTarget")?.valueInteger;if(X===-1&&(L++,W))return null;if(!V)throw new Error("Column missing name",{cause:I});return a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:a.jsx(fn,{size:"sm",checked:C.includes(V),onChange:M=>{T(M.currentTarget.checked?[...C,V]:C.filter(F=>F!==V))}})}),a.jsx(Z.Td,{children:V}),a.jsx(Z.Td,{children:X===-1?a.jsxs(ge,{span:!0,c:"dimmed",fs:"italic",children:["default (",m,")"]}):X}),a.jsx(Co,{value:$.find(M=>M.name==="nullFraction")?.valueDecimal,...G}),a.jsx(Co,{value:$.find(M=>M.name==="avgWidth")?.valueInteger,...G}),a.jsx(Co,{value:$.find(M=>M.name==="nDistinct")?.valueDecimal,...G}),a.jsx(Co,{value:$.find(M=>M.name==="correlation")?.valueDecimal,...G}),U&&a.jsxs(a.Fragment,{children:[a.jsx(Co,{value:$.find(M=>M.name==="mostCommonValues")?.valueString,...G}),a.jsx(Co,{value:$.find(M=>M.name==="mostCommonFreqs")?.valueString,...G}),a.jsx(Co,{value:$.find(M=>M.name==="histogramBounds")?.valueString,...G}),a.jsx(Co,{value:$.find(M=>M.name==="mostCommonElems")?.valueString,...G}),a.jsx(Co,{value:$.find(M=>M.name==="mostCommonElemFreqs")?.valueString,...G}),a.jsx(Co,{value:$.find(M=>M.name==="elemCountHistogram")?.valueString,...G})]})]},V)}),W&&a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:U?13:7,children:a.jsxs(ge,{c:"dimmed",fs:"italic",children:[L," hidden columns with default statistics target"]})})})]})]})})]}),a.jsx(Mn,{opened:t,onClose:r,title:i,centered:!0,size:"auto",children:c})]})}function Co({value:e,onClick:t}){return a.jsx(Z.Td,{style:{cursor:"pointer"},onClick:()=>t?.(e),children:vre(e)})}function vre(e){return typeof e=="string"&&e.length>30?e.substring(0,30)+"...":e}function y1(e,t,n,r){const i=Date.now().toString();Ae({id:i,loading:!0,title:t,message:"Running...",autoClose:!1,withCloseButton:!1});const s={method:"POST",pollStatusOnAccepted:!0};return r&&(s.body=JSON.stringify(r)),e.startAsyncRequest(n,s).then(c=>{let u="Done";return c.resourceType==="AsyncJob"?u=a.jsx(jt,{to:c,children:"View AsyncJob"}):c.resourceType==="OperationOutcome"&&c.issue?.[0]?.details?.text&&(u=a.jsx(ge,{children:c.issue[0].details.text})),Li.update({id:i,color:"green",title:t,message:u,icon:a.jsx(Go,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0}),c}).catch(c=>{throw Li.update({id:i,color:"red",title:t,message:We(c),icon:a.jsx(ws,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0}),c})}function Vc(e,t,n,r){y1(e,t,n,r).catch(()=>{})}const yre=8;function xre({pillInputProps:e,inputProps:t,data:n,onChange:r}){const i=$l({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[s,c]=v.useState(""),[u,f]=v.useState([]),h=S=>{const w=u.includes(S)?u.filter(C=>C!==S):[...u,S];f(w),r&&r(w)},m=S=>f(w=>w.filter(C=>C!==S)),g=v.useMemo(()=>u.map(S=>a.jsx(wa,{withRemoveButton:!0,onRemove:()=>m(S),children:S},S)),[u]),y=v.useMemo(()=>{const S=s.trim().toLowerCase();return n.filter(w=>w.toLowerCase().includes(S))},[n,s]),x=v.useMemo(()=>{const S=new Array(Math.min(y.length,yre));for(let w=0;w<S.length;w++){const C=y[w];S[w]=a.jsx(Ye.Option,{value:C,active:u.includes(C),children:a.jsxs(xe,{gap:"sm",children:[u.includes(C)?a.jsx(pf,{size:12}):null,a.jsx("span",{children:C})]})},C)}return S},[y,u]);return a.jsxs(Ye,{store:i,onOptionSubmit:h,withinPortal:!1,children:[a.jsx(Ye.DropdownTarget,{children:a.jsx(xs,{onClick:()=>i.openDropdown(),...e,children:a.jsxs(wa.Group,{children:[g,a.jsx(Ye.EventsTarget,{children:a.jsx(xs.Field,{onFocus:()=>i.openDropdown(),onBlur:()=>{i.closeDropdown(),c("")},value:s,onChange:S=>{i.updateSelectedOptionIndex(),c(S.currentTarget.value)},onKeyDown:S=>{S.key==="Backspace"&&s.length===0&&u.length>0&&(S.preventDefault(),m(u[u.length-1]))},...t})})]})})}),a.jsx(Ye.Dropdown,{children:a.jsx(Ye.Options,{children:x.length>0?x:a.jsx(Ye.Empty,{children:"Nothing found..."})})})]})}function bre({defaultGinPendingListLimit:e,availableTables:t,onResponse:n}){const r=Re(),[i,s]=v.useState(!1),[c,u]=v.useState([]),[f,h]=v.useState("unspecified"),[m,g]=v.useState("unspecified"),[y,x]=v.useState(void 0),S=()=>{const w={tableName:c};f==="reset"?w.fastUpdateAction="reset":f==="on"?(w.fastUpdateAction="set",w.fastUpdateValue=!0):f==="off"&&(w.fastUpdateAction="set",w.fastUpdateValue=!1),m==="reset"?w.ginPendingListLimitAction="reset":m==="set"&&(w.ginPendingListLimitAction="set",w.ginPendingListLimitValue=y),s(!0),y1(r,"Configure GIN Indexes","fhir/R4/$db-configure-indexes",w).then(C=>{n(C)}).catch(()=>{}).finally(()=>{s(!1)})};return a.jsx(pt,{onSubmit:S,children:a.jsxs(Ne,{gap:"sm",maw:"800",children:[a.jsx(uf,{label:"Table(s)",children:a.jsx(xre,{data:t,onChange:w=>u(w),inputProps:{name:"tables",placeholder:"e.g. Observation"}})}),a.jsx(Rr.Group,{name:"fastUpdate",label:"fastupdate",value:f,onChange:w=>h(w),children:a.jsxs(xe,{h:"36",children:[a.jsx(Rr,{size:"sm",value:"unspecified",label:"unspecified"}),a.jsx(Rr,{size:"sm",value:"reset",label:"reset to default (on)"}),a.jsx(Rr,{size:"sm",value:"off",label:"off"}),a.jsx(Rr,{size:"sm",value:"on",label:"on"})]})}),a.jsx(Rr.Group,{name:"ginPendingListLimit",label:"gin_pending_list_limit",value:m,onChange:w=>{g(w),w!=="set"&&x(void 0)},children:a.jsxs(xe,{h:"36",children:[a.jsx(Rr,{size:"sm",value:"unspecified",label:"unspecified"}),a.jsx(Rr,{size:"sm",value:"reset",label:`reset to default (${e}kB)`}),a.jsxs(xe,{children:[a.jsx(Rr,{size:"sm",value:"set",label:"Set to (kB)"}),a.jsx(hr,{title:"gin_pending_list_limit_value",name:"gin_pending_list_limit_value",value:(m==="set"?y:"")||"",disabled:m!=="set",required:m==="set",size:"sm",w:"100",min:64,max:2147483647,onChange:w=>{x(typeof w=="number"?w:void 0)}})]})]})}),a.jsx(xe,{justify:"center",children:a.jsx(yr,{size:"sm",loading:i,children:"Update"})})]})})}function Sre(){const e=Re(),[t,{open:n,close:r}]=Ts(!1),[i,s]=v.useState(""),[c,u]=v.useState(),[f,h]=v.useState(void 0),[m,g]=v.useState(0),[y,x]=v.useState(!1),[S,w]=v.useState(void 0),[C,T]=v.useState([]),[R,E]=v.useState(0);eO({medplum:e,onChange:T}),v.useEffect(()=>{x(!0),e.get("fhir/R4/$db-indexes?tableName="+encodeURIComponent(f??""),{cache:"no-cache"}).then(k=>{const A=k.parameter?.find(U=>U.name==="defaultGinPendingListLimit")?.valueInteger??0;g(A);const z=k.parameter?.filter(U=>U.name==="index");w(z??[])}).finally(()=>{x(!1)}).catch(k=>{Ae({color:"red",message:k.message})})},[e,f,R]);const _=k=>{s("Configure results"),u(a.jsx("pre",{children:JSON.stringify(k,null,2)})),n(),E(A=>(A+1)%100)},P={onClick:k=>{s("Details"),u(a.jsx("pre",{children:k})),n()}};let O;return y?O="Loading...":f?S?.length===0&&(O="No GIN indexes on this table"):O="Select a table",a.jsxs(a.Fragment,{children:[a.jsxs(Ne,{gap:"sm",children:[a.jsx("h2",{children:"Configure GIN indexes"}),a.jsx(xe,{children:a.jsx(bre,{defaultGinPendingListLimit:m,availableTables:C,onResponse:_})}),a.jsx("h2",{children:"GIN index stats"}),a.jsxs(xe,{children:[a.jsx(JN,{data:C,inputProps:{placeholder:"Table name",inputSize:"50"},onChange:k=>{h(k)}}),a.jsx(Me,{loading:y,onClick:()=>E(k=>(k+1)%100),disabled:!f,children:"Refresh"})]}),a.jsx(Z.ScrollContainer,{minWidth:500,children:a.jsxs(Z,{striped:!0,highlightOnHover:!0,children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{children:"Schema"}),a.jsx(Z.Th,{children:"Table"}),a.jsx(Z.Th,{children:"Index"}),a.jsx(Z.Th,{children:"fastupdate"}),a.jsx(Z.Th,{children:"gin_pending_list_limit"}),a.jsx(Z.Th,{children:"options"})]})}),a.jsxs(Z.Tbody,{children:[O&&a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:16,children:O})}),!O&&S?.map(k=>{const A=k.part??[],z=A.find(U=>U.name==="indexName")?.valueString;if(!z)throw new Error("Index missing name",{cause:k});return a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:A.find(U=>U.name==="schemaName")?.valueString}),a.jsx(Z.Td,{children:A.find(U=>U.name==="tableName")?.valueString}),a.jsx(Z.Td,{children:z}),a.jsx(jx,{value:A.find(U=>U.name==="fastUpdate")?.valueBoolean,defaultValue:a.jsxs(ge,{span:!0,c:"dimmed",fs:"italic",children:["default (",ZN(!0),")"]}),...P}),a.jsx(jx,{value:A.find(U=>U.name==="ginPendingListLimit")?.valueInteger,defaultValue:a.jsxs(ge,{span:!0,c:"dimmed",fs:"italic",children:["default (",m,")"]}),...P}),a.jsx(jx,{value:A.find(U=>U.name==="indexOptions")?.valueString,defaultValue:a.jsx(ge,{span:!0,c:"dimmed",fs:"italic",children:"NULL"}),...P})]},z)})]})]})})]}),a.jsx(Mn,{opened:t,onClose:r,title:i,centered:!0,size:"auto",children:c})]})}function jx({value:e,onClick:t,defaultValue:n}){return a.jsx(Z.Td,{style:{cursor:"pointer"},onClick:()=>t?.(e),children:e===void 0?n:ZN(e)})}const jre=[{label:"GIN Indexes",value:"gin-indexes"},{label:"Column Statistics",value:"column-statistics"},{label:"Array Column Padding",value:"array-padding"}];function j_(){const e=Re();return!e.isLoading()&&!e.isSuperAdmin()?a.jsx(xr,{outcome:Cf}):a.jsx(Fl,{maw:"100%",children:a.jsxs(Os,{children:[a.jsx(ze,{order:1,children:"Database Tools"}),a.jsxs(Of,{baseUrl:"/admin/super/db",tabs:jre,children:[a.jsx(bn.Panel,{value:"gin-indexes",pt:"md",children:a.jsx(Sre,{})}),a.jsx(bn.Panel,{value:"column-statistics",pt:"md",children:a.jsx(gre,{})}),a.jsx(bn.Panel,{value:"array-padding",pt:"md",children:a.jsx(hre,{})})]})]})})}function wre(){const e=Re(),[t,n]=v.useState(e.getProject()),[r,i]=v.useState(),[s,c]=v.useState(),[u,f]=v.useState(!1),[h,m]=v.useState(void 0),g=v.useCallback(y=>{const x={resourceType:y.resourceType,firstName:y.firstName,lastName:y.lastName,email:y.email,sendEmail:y.sendEmail==="on",accessPolicy:r,admin:y.isAdmin==="on",scope:y.isProjectScoped==="on"?"project":"server",mfaRequired:y.mfaRequired==="on"};return e.invite(t?.id,x).then(S=>{e.invalidateSearches("Patient"),e.invalidateSearches("Practitioner"),e.invalidateSearches("ProjectMembership"),Ef(S)?c(S):m(S),f(x.sendEmail??!1),Ae({color:"green",message:"Invite success"})}).catch(S=>{Ae({color:"red",message:We(S),autoClose:!1}),c(rn(S))})},[e,t,r]);return a.jsxs(pt,{onSubmit:g,children:[!h&&!s&&a.jsxs(Ne,{children:[a.jsx(ze,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(Vt,{title:"Project",htmlFor:"project",outcome:s,children:a.jsx(Eu,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(pn,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:Ut(s,"resourceType")}),a.jsx(Fe,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:Ut(s,"firstName")}),a.jsx(Fe,{name:"lastName",label:"Last Name",required:!0,error:Ut(s,"lastName")}),a.jsx(Fe,{name:"email",type:"email",label:"Email",required:!0,error:Ut(s,"email")}),a.jsx(Vt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:s,children:a.jsx(v1,{name:"accessPolicy",onChange:i})}),a.jsx(fn,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(fn,{name:"isAdmin",label:"Admin"}),a.jsx(fn,{name:"isProjectScoped",label:"Project scoped"}),a.jsx(fn,{name:"mfaRequired",label:"MFA required"}),a.jsx(xe,{justify:"flex-end",children:a.jsx(yr,{children:"Invite"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:[a.jsx("p",{children:"User created, email couldn't be sent"}),a.jsx("p",{children:"Could not send email. Make sure you have AWS SES set up."}),a.jsxs("p",{children:["Click ",a.jsx(jt,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]}),h&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(ge,{children:"User created"}),u&&a.jsx(ge,{children:"Email sent"}),a.jsxs(zr,{children:[a.jsx(zr.Item,{children:a.jsx(jt,{to:h,children:"Go to new membership"})}),a.jsx(zr.Item,{children:a.jsx(jt,{to:h.profile,children:"Go to new profile"})}),a.jsx(zr.Item,{children:a.jsx(jt,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function Cre(){const e=Re();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(xr,{outcome:Cf});function t(n){e.post("admin/projects/setpassword",n).then(()=>Ae({color:"green",message:"Done"})).catch(r=>Ae({color:"red",message:We(r),autoClose:!1}))}return a.jsxs(lt,{width:600,children:[a.jsx(ze,{order:1,children:"Project Admin"}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Force Set Password"}),a.jsx(ge,{children:"Sets the password for the specified user in this project."}),a.jsx(ge,{children:"This action can only be performed by project administrators. Passwords can only be set for users scoped in this project."}),a.jsx(pt,{onSubmit:t,children:a.jsxs(Ne,{children:[a.jsx(Fe,{name:"email",label:"Email",required:!0}),a.jsx(ao,{name:"password",label:"Password",required:!0}),a.jsx(Me,{type:"submit",children:"Force Set Password"})]})})]})}function w_(){const e=Re(),t=Ls(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:"Details"}),a.jsxs(Pf,{children:[a.jsx(Ur,{term:"ID",children:n.project.id}),a.jsx(Ur,{term:"Name",children:n.project.name})]})]})}const Ere=["Details","Users","Clients","Bots","Secrets","Sites"];function Tre(){const e=Re(),t=Ls(e),n=v.useMemo(()=>e.get("admin/projects/"+t).read(),[e,t]);return a.jsxs(a.Fragment,{children:[a.jsxs(gr,{children:[a.jsx(vt,{children:a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Project"}),a.jsx(vt.Value,{children:n.project.name})]})}),a.jsx(ti,{children:a.jsx(Of,{baseUrl:"/admin",tabs:Ere})})]}),a.jsx(Fl,{maw:"100%",children:a.jsx(Os,{children:a.jsx(h1,{})})})]})}function Rre(){const e=Re(),t=Ls(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=v.useState(!1),[s,c]=v.useState();return v.useEffect(()=>{e.requestSchema("Project").then(()=>i(!0)).catch(console.log)},[e]),v.useEffect(()=>{n&&c(gi(n.project.secret||[]))},[e,n]),!r||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:u=>{u.preventDefault(),e.post(`admin/projects/${t}/secrets`,s).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>Ae({color:"green",message:"Saved"})).catch(console.log)},children:[a.jsx(ze,{children:"Project Secrets"}),a.jsx("p",{children:"Use project secrets to store sensitive information such as API keys or other access credentials."}),a.jsx(Nf,{property:Ps("Project","secret"),name:"secret",path:"Project.secret",defaultValue:s,onChange:c,outcome:void 0}),a.jsx(Me,{type:"submit",children:"Save"})]})}function _re(){const e=Re(),t=Ls(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=v.useState(!1),[s,c]=v.useState();return v.useEffect(()=>{e.requestSchema("Project").then(()=>i(!0)).catch(console.log)},[e]),v.useEffect(()=>{n&&c(gi(n.project.site||[]))},[e,n]),!r||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:u=>{u.preventDefault(),e.post(`admin/projects/${t}/sites`,s).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>Ae({color:"green",message:"Saved"})).catch(f=>{const h=rn(f);Ae({color:"red",message:`Error ${h.issue?.[0].details?.text} ${h.issue?.[0].expression?.[0]}`,autoClose:!1})})},children:[a.jsx(ze,{children:"Project Sites"}),a.jsx("p",{children:"Use project sites configure your project on a separate domain."}),a.jsx(Nf,{property:Ps("Project","site"),name:"site",path:"Project.site",defaultValue:s,onChange:c,outcome:void 0}),a.jsx(Me,{type:"submit",children:"Save"})]})}const Dre=[{label:"Post-deploy Migrations",value:"migrations"},{label:"System AsyncJob",value:"asyncjob"}];function C_(){const e=Re();return!e.isLoading()&&!e.isSuperAdmin()?a.jsx(xr,{outcome:Cf}):a.jsx(Fl,{miw:"1600",maw:"2000",children:a.jsxs(Os,{children:[a.jsx(ze,{order:1,children:"AsyncJob Dashboard"}),a.jsxs(Of,{baseUrl:"/admin/super/asyncjob",tabs:Dre,keepMounted:!1,children:[a.jsx(bn.Panel,{value:"asyncjob",pt:"md",children:a.jsx(kre,{})}),a.jsx(bn.Panel,{value:"migrations",pt:"md",children:a.jsx(Nre,{})})]})]})})}const Are={resourceType:"AsyncJob",fields:["id","_lastUpdated","request","status","type"],filters:[{code:"_project",operator:fe.MISSING,value:"true"}],sortRules:[{code:"_lastUpdated",descending:!0}]};function kre(){const e=Fn(),[t]=v.useState(Are);return a.jsxs(Ne,{children:[a.jsx(jt,{to:`/${t.resourceType}/${vs(t)}`,children:"Show in search page"}),a.jsx(ql,{checkboxesEnabled:!1,search:t,onClick:n=>e(E_(n.resource))?.catch(console.error),onAuxClick:n=>window.open(E_(n.resource),"_blank")})]})}const Pre={resourceType:"AsyncJob",fields:["id","_lastUpdated","request","status","type"],filters:[{code:"_project",operator:fe.MISSING,value:"true"},{code:"type",operator:fe.EQUALS,value:"data-migration"}],count:1e3,sortRules:[{code:"_lastUpdated",descending:!0}]};function Nre(){const e=Re(),[t,n]=v.useState(),[r,i]=v.useState(),[s,c]=v.useState([]),[u,f]=v.useState(0),[h,m]=v.useState([]);v.useEffect(()=>{const w="info";m(C=>C.includes(w)?C:[...C,w]),e.get("admin/super/migrations",{cache:"no-cache"}).then(C=>{C.postDeployMigrations.sort((T,R)=>R-T),n(C)}).catch(C=>{Ae({color:"red",message:We(C),autoClose:!1})}).finally(()=>m(C=>C.filter(T=>T!==w)))},[e,u]),v.useEffect(()=>{const w="jobs";m(C=>C.includes(w)?C:[...C,w]),e.requestSchema("AsyncJob").then(()=>e.search("AsyncJob",vs({...Pre,total:"accurate",fields:void 0}),{cache:"no-cache"}).then(C=>{i(C.entry?.map(T=>T.resource))})).catch(C=>{i(void 0),Ae({color:"red",message:We(C),autoClose:!1})}).finally(()=>m(C=>C.filter(T=>T!==w)))},[e,u]);function g(){f(w=>w+1)}function y(w){y1(e,"Run pending post-deploy migration","admin/super/migrate",{dataVersion:w}).finally(()=>{g()}).catch(()=>{}),g()}const x=h.length>0;function S(w,{isLoading:C}){return a.jsxs("div",{style:{position:"relative"},children:[a.jsx(Rm,{visible:C}),a.jsxs(Z,{children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{children:"Version"}),a.jsx(Z.Th,{children:"Action"}),a.jsx(Z.Th,{children:"Status"}),a.jsx(Z.Th,{children:"AsyncJob"}),a.jsx(Z.Th,{children:"Last Updated"}),a.jsx(Z.Th,{children:"Request Time"}),a.jsx(Z.Th,{children:"Duration"}),a.jsx(Z.Th,{children:"Attempts"})]})}),a.jsx(Z.Tbody,{children:w()})]})]})}return a.jsxs(a.Fragment,{children:[a.jsx(Me,{size:"xs",mb:"xs",variant:"subtle",leftSection:a.jsx(lP,{size:14}),onClick:g,loading:x,children:"Refresh"}),S(()=>{if(!x){if(!t)return a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:6,children:"Failed to load migration info"})});if(!r)return a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:6,children:"Failed to load async jobs"})})}return!t||!r?null:t.postDeployMigrations?.map(w=>{const{status:C,asyncJob:T,asyncJobs:R}=Ore(w,r??[],t?.pendingPostDeployMigration),E=s.includes(w),_=w===t?.pendingPostDeployMigration&&(!T||T?.status==="error"),P=[a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:w}),a.jsx(Z.Td,{children:_&&a.jsx(Me,{color:"green",size:"xs",onClick:()=>y(w),children:"Start"})}),a.jsx(Z.Td,{children:C}),a.jsx(Z.Td,{children:T&&a.jsx(jt,{to:`/AsyncJob/${T?.id}`,children:T?.id})}),a.jsx(Z.Td,{children:T?.meta?.lastUpdated}),a.jsx(Z.Td,{children:T?.requestTime}),a.jsx(Z.Td,{children:T_(T)}),a.jsx(Z.Td,{display:"flex",children:a.jsxs(xe,{gap:"xs",children:[R.length?R.length:"",E&&R.length>1&&a.jsx(Me,{leftSection:a.jsx(FG,{size:14}),variant:"subtle",color:"blue",size:"xs",radius:"xs",onClick:()=>c(O=>O.includes(w)?O.filter(k=>k!==w):O),children:"Hide all"}),!E&&R.length>1&&a.jsx(Me,{leftSection:a.jsx(tW,{size:14}),variant:"subtle",color:"blue",size:"xs",radius:"xs",onClick:()=>c(O=>O.includes(w)?O:[...O,w]),children:"Show all"})]})})]},w)];return E&&P.push(...R.filter(O=>O.id!==T?.id).map(O=>a.jsxs(Z.Tr,{bg:"gray.1",children:[a.jsx(Z.Td,{children:w}),a.jsx(Z.Td,{}),a.jsx(Z.Td,{children:O.status}),a.jsx(Z.Td,{children:a.jsx(jt,{to:`/AsyncJob/${O.id}`,children:O.id})}),a.jsx(Z.Td,{children:O.meta?.lastUpdated}),a.jsx(Z.Td,{children:O.requestTime}),a.jsx(Z.Td,{children:T_(O)}),a.jsx(Z.Td,{})]},O.id))),P})},{isLoading:x})]})}function Ore(e,t,n){const r=t.filter(c=>c.dataVersion===e),i=r.find(c=>c.status==="completed")??r[0];let s;return n===0?s=i?.status??"completed":e>n?s=i?.status??"pending":e===n?s=i?.status??"next":s=i?.status??"completed",{status:s,asyncJob:i,asyncJobs:r}}function E_(e){return`/${e.resourceType}/${e.id}`}function T_(e){const t=e?.requestTime,n=e?.transactionTime??e?.meta?.lastUpdated;if(!t||!n)return"";const r=new Date(t),s=new Date(n).getTime()-r.getTime();if(s<1e3)return`${s.toFixed(0)}ms`;const c=s/1e3;return c<60?`${c.toFixed(2)}s`:c<3600?`${(c/60).toFixed(2)}m`:`${(c/3600).toFixed(2)}h`}function Mre(){const e=Re(),[t,n]=v.useState(),[r,i]=v.useState(!1),[s,{open:c,close:u}]=Ts(!1),[f,h]=v.useState(new Set),[m,g]=v.useState(new Set),[y,x]=v.useState(new Map),[S,w]=v.useState(new Map);function C(){i(!0),e.get("fhir/R4/$get-ws-sub-stats").then(E=>{const _=E.parameter?.find(P=>P.name==="stats")?.valueString;if(_){const P=JSON.parse(_);n(P.projects)}c()}).catch(E=>Ae({color:"red",message:We(E),autoClose:!1})).finally(()=>i(!1))}function T(E){h(_=>{const P=new Set(_);return P.has(E)?P.delete(E):P.add(E),P})}function R(E,_){const P=`${E}:${_}`;y.has(E)||(w(O=>new Map(O).set(E,!0)),e.get(`fhir/R4/$get-ws-sub-project-stats?projectId=${encodeURIComponent(E)}`).then(O=>{const k=O.parameter?.find(A=>A.name==="stats")?.valueString;if(k){const A=JSON.parse(k);x(z=>new Map(z).set(E,A.resourceTypes))}}).catch(O=>Ae({color:"red",message:We(O),autoClose:!1})).finally(()=>w(O=>{const k=new Map(O);return k.delete(E),k}))),g(O=>{const k=new Set(O);return k.has(P)?k.delete(P):k.add(P),k})}return a.jsxs(a.Fragment,{children:[a.jsx(Me,{onClick:C,loading:r,children:"Get WS Sub Stats"}),a.jsxs(Mn,{opened:s,onClose:u,title:"WebSocket Subscription Stats",size:"xl",centered:!0,children:[!t?.length&&a.jsx(ge,{children:"No active WebSocket subscriptions found."}),t&&t.length>0&&a.jsxs(Z,{striped:!0,highlightOnHover:!0,withTableBorder:!0,withColumnBorders:!0,tabularNums:!0,children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{children:"Project / Resource Type / Criteria"}),a.jsx(Z.Th,{children:"Count"})]})}),a.jsx(Z.Tbody,{children:t.map(E=>a.jsxs(v.Fragment,{children:[a.jsxs(Z.Tr,{onClick:()=>T(E.projectId),style:{cursor:"pointer"},children:[a.jsx(Z.Td,{children:a.jsxs(xe,{gap:"xs",children:[a.jsx(ge,{size:"xs",children:f.has(E.projectId)?"▼":"▶"}),a.jsx(Jd,{value:{reference:`Project/${E.projectId}`,display:E.projectName}})]})}),a.jsx(Z.Td,{children:E.subscriptionCount})]}),f.has(E.projectId)&&E.resourceTypes.map(_=>{const P=`${E.projectId}:${_.resourceType}`,k=y.get(E.projectId)?.find(z=>z.resourceType===_.resourceType),A=S.get(E.projectId)===!0;return a.jsxs(v.Fragment,{children:[a.jsxs(Z.Tr,{onClick:()=>R(E.projectId,_.resourceType),style:{cursor:"pointer"},children:[a.jsx(Z.Td,{children:a.jsxs(xe,{gap:"xs",pl:"md",children:[a.jsx(ge,{size:"xs",children:m.has(P)?"▼":"▶"}),a.jsx(ge,{children:_.resourceType})]})}),a.jsx(Z.Td,{children:_.count})]}),m.has(P)&&a.jsxs(a.Fragment,{children:[A&&!k&&a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:2,children:a.jsx(ge,{pl:"xl",size:"sm",c:"dimmed",children:"Loading..."})})}),k?.criteria.map(z=>a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:a.jsx(ge,{pl:"xl",size:"sm",c:"dimmed",children:z.criteria})}),a.jsx(Z.Td,{children:z.count})]},`${P}:${z.criteria}`))]})]},P)})]},E.projectId))})]})]})]})}function Lre(){const e=Re(),[t,{open:n,close:r}]=Ts(!1),[i,s]=v.useState(""),[c,u]=v.useState(),[f,h]=v.useState();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(xr,{outcome:Cf});function m(){Vc(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function g(){Vc(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function y(){Vc(e,"Rebuilding Value Sets","admin/super/valuesets")}function x(k){Vc(e,"Reindexing Resources","admin/super/reindex",k)}function S(){Vc(e,"Reload Cron Resources","admin/super/reloadcron")}function w(){r();const k=bs(f);e.post("fhir/R4/$clear-all-ws-subs",k?{resourceType:"Parameters",parameter:[{name:"projectId",valueString:k}]}:void 0).then(()=>Ae({color:"green",message:"Done"})).catch(A=>Ae({color:"red",message:We(A),autoClose:!1})),h(void 0)}function C(k){e.post("admin/super/removebotidjobsfromqueue",k).then(()=>Ae({color:"green",message:"Done"})).catch(A=>Ae({color:"red",message:We(A),autoClose:!1}))}function T(k){e.post("admin/super/purge",{...k,before:WS(k.before)}).then(()=>Ae({color:"green",message:"Done"})).catch(A=>Ae({color:"red",message:We(A),autoClose:!1}))}function R(k){e.post("admin/super/setpassword",k).then(()=>Ae({color:"green",message:"Done"})).catch(A=>Ae({color:"red",message:We(A),autoClose:!1}))}function E(k){e.post("fhir/R4/$db-stats",k.tableNames?{resourceType:"Parameters",parameter:[{name:"tableNames",valueString:k.tableNames}]}:void 0).then(A=>{s("Database Stats"),u(a.jsx("pre",{children:A.parameter?.find(z=>z.name==="tableString")?.valueString})),n()}).catch(A=>Ae({color:"red",message:We(A),autoClose:!1}))}function _(){e.post("fhir/R4/$db-invalid-indexes").then(k=>{s("Database Invalid Indexes"),u(a.jsx("pre",{children:k.parameter?.filter(A=>A.name==="invalidIndex").map(A=>A.valueString).join(`
218
+ `)})),n()}).catch(k=>Ae({color:"red",message:We(k),autoClose:!1}))}function P(){e.post("fhir/R4/$db-schema-diff").then(k=>{s("Schema Diff"),u(a.jsx("pre",{children:k.parameter?.find(A=>A.name==="migrationString")?.valueString})),n()}).catch(k=>Ae({color:"red",message:We(k),autoClose:!1}))}function O(){Vc(e,"Reconcile Schema Diff","admin/super/reconcile-db-schema-drift")}return a.jsxs(lt,{width:600,children:[a.jsx(ze,{order:1,children:"Super Admin"}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Structure Definitions"}),a.jsx("p",{children:"StructureDefinition resources contain the metadata about resource types. They are provided with the FHIR specification. Medplum also includes some custom StructureDefinition resources for internal data types. Press this button to update the database StructureDefinitions from the FHIR specification."}),a.jsx(pt,{children:a.jsx(Me,{onClick:m,children:"Rebuild StructureDefinitions"})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Search Parameters"}),a.jsx("p",{children:"SearchParameter resources contain the metadata about filters and sorting. They are provided with the FHIR specification. Medplum also includes some custom SearchParameter resources for internal data types. Press this button to update the database SearchParameters from the FHIR specification."}),a.jsx(pt,{children:a.jsx(Me,{onClick:g,children:"Rebuild SearchParameters"})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Value Sets"}),a.jsx("p",{children:"ValueSet resources enum values for a wide variety of use cases. Press this button to update the database ValueSets from the FHIR specification."}),a.jsx(pt,{children:a.jsx(Me,{onClick:y,children:"Rebuild ValueSets"})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Reindex Resources"}),a.jsx("p",{children:"When Medplum changes how resources are indexed, the system may require a reindex for old resources to be indexed properly."}),a.jsx(zre,{onSubmit:x}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Purge Resources"}),a.jsx("p",{children:"As system generated resources accumulate, the system may require a purge to remove old resources."}),a.jsx(pt,{onSubmit:T,children:a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(pn,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(Vt,{title:"Purge Before",htmlFor:"before",children:a.jsx(Io,{name:"before",placeholder:"Before Date"})}),a.jsx(Me,{type:"submit",children:"Purge"})]})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Remove Bot ID Jobs from Queue"}),a.jsx("p",{children:"Remove all queued jobs for a Bot ID"}),a.jsx(pt,{onSubmit:C,children:a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Bot ID",children:a.jsx(Fe,{name:"botId",placeholder:"Bot Id"})}),a.jsx(Me,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Force Set Password"}),a.jsx("p",{children:'Note that this applies to all projects for the user. Therefore, this should only be used in extreme circumstances. Always prefer to use the "Forgot Password" flow first.'}),a.jsx(pt,{onSubmit:R,children:a.jsxs(Ne,{children:[a.jsx(Fe,{name:"email",label:"Email",required:!0}),a.jsx(ao,{name:"password",label:"Password",required:!0}),a.jsx(Fe,{name:"projectId",label:"Project ID"}),a.jsx(Me,{type:"submit",children:"Force Set Password"})]})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Database Stats"}),a.jsx("p",{children:"Query current table statistics from the database."}),a.jsx(pt,{onSubmit:E,children:a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Table Names (comma-delimited)",htmlFor:"tableNames",children:a.jsx(Fe,{id:"tableNames",name:"tableNames",placeholder:"Observation,Observation_History"})}),a.jsx(Me,{type:"submit",children:"Get Database Stats"})]})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Database Invalid Indexes"}),a.jsx("p",{children:"Query invalid indexes from the database."}),a.jsx(pt,{onSubmit:_,children:a.jsx(Ne,{children:a.jsx(Me,{type:"submit",children:"Get Database Invalid Indexes"})})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Database Schema Drift"}),a.jsx("p",{children:"Show the schema migration needed to match the expected database schema."}),a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:6,children:a.jsx(pt,{onSubmit:P,children:a.jsx(Ne,{children:a.jsx(Me,{type:"submit",children:"Get Schema Drift"})})})}),a.jsx(Nt.Col,{span:6,children:a.jsx(pt,{onSubmit:O,children:a.jsx(Ne,{children:a.jsx(Me,{type:"submit",children:"Reconcile Schema Drift"})})})})]}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Reload Cron Resources"}),a.jsx("p",{children:"Obliterates the cron queue and rebuilds all the cron job schedulers for cron resources (eg. cron bots)."}),a.jsx(pt,{onSubmit:S,children:a.jsx(Ne,{children:a.jsx(Me,{type:"submit",children:"Reload Cron Resources"})})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Database Explain Search"}),a.jsx("p",{children:"Runs an EXPLAIN query on the database to show the query plan for a search."}),a.jsx($re,{setModalTitle:s,setModalContent:u,openModal:n}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"WebSocket Subscription Stats"}),a.jsx("p",{children:"View active WebSocket subscription statistics by project, resource type, and criteria."}),a.jsx(Mre,{}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Clear All WebSocket Subscriptions"}),a.jsx("p",{children:"Removes all active WebSocket subscription records from Redis. This is useful for cleaning up stale subscriptions during maintenance or after a deployment issue. Connected clients will need to re-bind."}),a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Project (optional)",htmlFor:"clearWsSubsProject",children:a.jsx(ba,{name:"clearWsSubsProject",placeholder:"All projects",targetTypes:["Project"],onChange:h})}),a.jsx("div",{children:a.jsx(Me,{onClick:()=>{s("Clear All WebSocket Subscriptions"),u(a.jsxs(Ne,{children:[a.jsxs(ge,{children:["Are you sure you want to completely clear"," ",a.jsx("strong",{children:f?`WebSocket subscriptions for "${f.display??f.reference}"`:"ALL WebSocket subscriptions"}),"? Connected clients will need to re-bind their subscriptions."]}),a.jsx(xe,{align:"center",children:a.jsx(Me,{color:"red",onClick:w,children:"Clear"})})]})),n()},children:"Clear All WebSocket Subscriptions"})})]}),a.jsx(Mn,{opened:t,onClose:r,title:i,centered:!0,size:"auto",children:c})]})}function Ire(){const[e,t]=v.useState("outdated");return a.jsxs(a.Fragment,{children:[a.jsx(pn,{id:"reindexType",name:"reindexType",value:e,onChange:n=>t(n.target.value),data:[{label:"Outdated resources",value:"outdated"},{label:"All resources",value:"all"},{label:"Less than or equal to a specific version",value:"specific"}]}),e==="specific"&&a.jsx(hr,{required:!0,name:"maxResourceVersion",placeholder:"Max Resource Version",min:0})]})}function zre({onSubmit:e}){const[t,n]=v.useState(!1);function r(i){const s={};for(const[c,u]of Object.entries(i))u!==""&&(s[c]=u);e(s)}return a.jsx(pt,{onSubmit:r,children:a.jsxs(Ne,{children:[a.jsx(Vt,{title:"Resource Type",htmlFor:"resourceType",children:a.jsx(Fe,{id:"resourceType",name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(Vt,{title:"Search Filter",htmlFor:"filter",children:a.jsx(Fe,{id:"filter",name:"filter",placeholder:"e.g. name=Sam&birthdate=lt2000-01-01"})}),a.jsx(Vt,{title:"Max Resource Version",htmlFor:"maxResourceVersion",children:a.jsx(Ire,{})}),a.jsx(Me,{variant:"subtle",size:"xs",onClick:()=>n(!t),children:t?"Hide Advanced Options":"Show Advanced Options"}),t&&a.jsx(Ne,{gap:"sm",children:a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"batchSize",label:"Resources per batch",description:a.jsx("span",{children:"default: 500"}),placeholder:"500",min:20,max:1e3})}),a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"searchStatementTimeout",label:"Search query timeout (ms)",description:a.jsx("span",{children:"default: 3,600,000 (1 hour)"}),placeholder:"3600000",min:1e3})}),a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"upsertStatementTimeout",label:"Upsert query timeout (ms)",description:a.jsx("span",{children:"default: server `database.queryTimeout`"}),placeholder:"database.queryTimeout",min:1e3})}),a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"delayBetweenBatches",label:"Delay between batches (ms)",description:a.jsx("span",{children:"default: 0"}),placeholder:"0",min:0,max:6e4})}),a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"progressLogThreshold",label:"Log progress every N resources",description:a.jsx("span",{children:"default: 50,000"}),placeholder:"50000",min:1})}),a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"endTimestampBufferMinutes",label:"End timestamp buffer (minutes)",description:a.jsx("span",{children:"default: 5"}),placeholder:"5",min:1})}),a.jsx(Nt.Col,{span:6,children:a.jsx(hr,{name:"maxIterationAttempts",label:"Max iteration attempts",description:a.jsx("span",{children:"default: 3"}),placeholder:"3",min:1,max:20})})]})}),a.jsx(Me,{type:"submit",children:"Reindex"})]})})}function $re({setModalTitle:e,setModalContent:t,openModal:n}){const r=Re(),[i,s]=v.useState(),[c,u]=v.useState(),[f,h]=v.useState(),[m,g]=v.useState(),y=v.useMemo(()=>{if(i?.reference)return{"_has:ProjectMembership:profile:project":i.reference}},[i]);v.useEffect(()=>{if(g(void 0),!c?.reference&&!i?.reference){h(void 0);return}r.searchResources("ProjectMembership",{profile:c?.reference,project:i?.reference,_count:20}).then(w=>{h(w),w.length===1&&g(nn(w[0]))}).catch(w=>{console.error(w),Ae({color:"red",message:We(w),autoClose:!1})})},[r,c,i]);const x=v.useMemo(()=>{const w={};return c?.reference&&(w.profile=c?.reference),i?.reference&&(w.project=i?.reference),w},[c,i]);function S(w){if(!w.query){Ae({color:"red",message:"Query is required",autoClose:!1});return}const C=w.onBehalfOfProjectMembership;delete w.onBehalfOfProjectMembership;const T={query:w.query,analyze:w.analyze==="on",count:w.count==="on",format:"text"},R={};C&&(R["x-medplum-on-behalf-of"]=C),r.post("fhir/R4/$explain",T,void 0,{headers:R}).then(E=>{e("Database Explain");const _=E.parameter?.find(U=>U.name==="explain")?.valueString,P=E.parameter?.find(U=>U.name==="query")?.valueString,O=E.parameter?.find(U=>U.name==="parameters")?.valueString,k=E.parameter?.find(U=>U.name==="countEstimate")?.valueInteger?.toLocaleString(),A=E.parameter?.find(U=>U.name==="countAccurate")?.valueInteger?.toLocaleString(),z=[P,O,`
219
+ `,_].join(`
220
+ `);t(a.jsxs(Ne,{children:[a.jsxs("div",{children:[a.jsx(ge,{fw:700,children:"Query"}),a.jsx(mf,{block:!0,maw:"100%",style:{whiteSpace:"pre-wrap"},children:z})]}),(k||A)&&a.jsxs("div",{children:[a.jsx(ge,{fw:700,children:"Counts"}),k&&a.jsxs(ge,{children:["Estimate: ",k]}),A&&a.jsxs(ge,{children:["Accurate: ",A]})]})]})),n()}).catch(E=>{Ae({color:"red",message:We(E),autoClose:!1})})}return!r.isLoading()&&!r.isSuperAdmin()?a.jsx(xr,{outcome:Cf}):a.jsx(pt,{onSubmit:S,children:a.jsxs(Ne,{children:[a.jsx(Fe,{name:"query",label:"Search",required:!0,placeholder:"Observation?code=85354-9&_sort=-date&_count=5"}),a.jsxs(xe,{children:[a.jsx(fn,{name:"analyze",label:"Analyze"}),a.jsx(fn,{name:"count",label:"Total count"})]}),a.jsx(uf,{label:"On Behalf Of",children:a.jsxs(Ne,{gap:"sm",children:[a.jsx(ba,{required:!0,placeholder:"Project",targetTypes:["Project"],name:"onBehalfOfProject",onChange:s}),a.jsx(ba,{required:!0,placeholder:"Practitioner or Patient",name:"onBehalfOfProfile",targetTypes:["Practitioner","Patient"],onChange:u,searchCriteria:y}),f?.length!==1&&a.jsx(ba,{required:!0,placeholder:"ProjectMembership",name:"onBehalfOfProjectMembership",targetTypes:["ProjectMembership"],onChange:g,searchCriteria:x}),f?.length===1&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"hidden",name:"onBehalfOfProjectMembership",value:$t(f[0])}),a.jsx(Jd,{value:nn(f[0])})]}),!m&&a.jsx(ge,{fs:"italic",children:"On Behalf Of not set. Running as super admin"})]})}),a.jsx(Me,{type:"submit",children:"Explain Search"})]})})}const Ure=[{label:"All",value:"Patient,Practitioner,RelatedPerson"},{label:"Practitioner",value:"Practitioner"},{label:"Patient",value:"Patient"},{label:"RelatedPerson",value:"RelatedPerson"}];function Bre(e){const t=Re(),n=Ls(t),r=Fn(),[i,s]=v.useState("Patient,Practitioner,RelatedPerson"),[c,u]=v.useState({resourceType:"ProjectMembership",filters:[{code:"project",operator:fe.EQUALS,value:"Project/"+n},{code:"profile-type",operator:fe.EQUALS,value:i}],fields:e.fields,count:100});function f(h){s(h),u({...c,filters:[{code:"project",operator:fe.EQUALS,value:"Project/"+n},{code:"profile-type",operator:fe.EQUALS,value:h}]})}return a.jsxs(a.Fragment,{children:[a.jsxs(xe,{justify:"space-between",align:"center",mb:"md",wrap:"nowrap",children:[a.jsxs(xe,{gap:"md",wrap:"nowrap",children:[a.jsx(Cl,{value:i,onChange:f,data:Ure}),e.toolbarLeft]}),e.toolbarRight]}),a.jsx(ql,{search:c,onClick:h=>r(`/ProjectMembership/${h.resource.id}`),onChange:h=>u(h.definition),hideFilters:!0,hideToolbar:!0})]})}function Vre(){return a.jsxs(a.Fragment,{children:[a.jsx(ze,{children:"ProjectMemberships by User and Profile Type"}),a.jsx(Bre,{fields:["user","profile","profile-type","accessPolicy","userConfiguration","active","admin"],toolbarLeft:a.jsx(Me,{component:jt,to:"/admin/invite",variant:"outline",color:"blue",leftSection:a.jsx(_W,{size:14}),children:"Invite New User"}),toolbarRight:a.jsx(wt,{href:"https://www.medplum.com/docs/user-management",target:"_blank",rel:"noopener noreferrer",size:"sm",children:"Learn more about roles and user management"})})]})}const Fre=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function uu(e,t,n){const r=Hre(e),{webkitRelativePath:i}=e,s=typeof t=="string"?t:typeof i=="string"&&i.length>0?i:`./${e.name}`;return typeof r.path!="string"&&R_(r,"path",s),R_(r,"relativePath",s),r}function Hre(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),i=Fre.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}function R_(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const qre=[".DS_Store","Thumbs.db"];function Gre(e){return Nl(this,void 0,void 0,function*(){return im(e)&&Wre(e.dataTransfer)?Xre(e.dataTransfer,e.type):Qre(e)?Yre(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?Kre(e):[]})}function Wre(e){return im(e)}function Qre(e){return im(e)&&im(e.target)}function im(e){return typeof e=="object"&&e!==null}function Yre(e){return mb(e.target.files).map(t=>uu(t))}function Kre(e){return Nl(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>uu(n))})}function Xre(e,t){return Nl(this,void 0,void 0,function*(){if(e.items){const n=mb(e.items).filter(i=>i.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(Jre));return __(tO(r))}return __(mb(e.files).map(n=>uu(n)))})}function __(e){return e.filter(t=>qre.indexOf(t.name)===-1)}function mb(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function Jre(e){if(typeof e.webkitGetAsEntry!="function")return D_(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?nO(t):D_(e,t)}function tO(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?tO(n):[n]],[])}function D_(e,t){return Nl(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const s=yield e.getAsFileSystemHandle();if(s===null)throw new Error(`${e} is not a File`);if(s!==void 0){const c=yield s.getFile();return c.handle=s,uu(c)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return uu(r,(n=t?.fullPath)!==null&&n!==void 0?n:void 0)})}function Zre(e){return Nl(this,void 0,void 0,function*(){return e.isDirectory?nO(e):eie(e)})}function nO(e){const t=e.createReader();return new Promise((n,r)=>{const i=[];function s(){t.readEntries(c=>Nl(this,void 0,void 0,function*(){if(c.length){const u=Promise.all(c.map(Zre));i.push(u),s()}else try{const u=yield Promise.all(i);n(u)}catch(u){r(u)}}),c=>{r(c)})}s()})}function eie(e){return Nl(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const i=uu(r,e.fullPath);t(i)},r=>{n(r)})})})}var mp={},A_;function tie(){return A_||(A_=1,mp.__esModule=!0,mp.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",i=(e.type||"").toLowerCase(),s=i.replace(/\/.*$/,"");return n.some(function(c){var u=c.trim().toLowerCase();return u.charAt(0)==="."?r.toLowerCase().endsWith(u):u.endsWith("/*")?s===u.replace(/\/.*$/,""):i===u})}return!0}),mp}var nie=tie();const wx=sm(nie);function k_(e){return oie(e)||iie(e)||iO(e)||rie()}function rie(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
221
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iie(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function oie(e){if(Array.isArray(e))return gb(e)}function P_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function N_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?P_(Object(n),!0).forEach(function(r){rO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nf(e,t){return lie(e)||sie(e,t)||iO(e,t)||aie()}function aie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
222
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iO(e,t){if(e){if(typeof e=="string")return gb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gb(e,t)}}function gb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,s=!1,c,u;try{for(n=n.call(e);!(i=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));i=!0);}catch(f){s=!0,u=f}finally{try{!i&&n.return!=null&&n.return()}finally{if(s)throw u}}return r}}function lie(e){if(Array.isArray(e))return e}var cie=typeof wx=="function"?wx:wx.default,uie="file-invalid-type",die="file-too-large",fie="file-too-small",hie="too-many-files",pie=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:uie,message:"File type must be ".concat(r)}},O_=function(t){return{code:die,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},M_=function(t){return{code:fie,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},mie={code:hie,message:"Too many files"};function gie(e){return e.type===""&&typeof e.getAsFile=="function"}function oO(e,t){var n=e.type==="application/x-moz-file"||cie(e,t)||gie(e);return[n,n?null:pie(t)]}function aO(e,t,n){if(dl(e.size))if(dl(t)&&dl(n)){if(e.size>n)return[!1,O_(n)];if(e.size<t)return[!1,M_(t)]}else{if(dl(t)&&e.size<t)return[!1,M_(t)];if(dl(n)&&e.size>n)return[!1,O_(n)]}return[!0,null]}function dl(e){return e!=null}function vie(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var h=oO(f,n),m=nf(h,1),g=m[0],y=aO(f,r,i),x=nf(y,1),S=x[0],w=u?u(f):null;return g&&S&&!w})}function om(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Cd(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function L_(e){e.preventDefault()}function yie(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function xie(e){return e.indexOf("Edge/")!==-1}function bie(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return yie(e)||xie(e)}function Eo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),c=1;c<i;c++)s[c-1]=arguments[c];return t.some(function(u){return!om(r)&&u&&u.apply(void 0,[r].concat(s)),om(r)})}}function Sie(){return"showOpenFilePicker"in window}function jie(e){if(dl(e)){var t=Object.entries(e).filter(function(n){var r=nf(n,2),i=r[0],s=r[1],c=!0;return sO(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),c=!1),(!Array.isArray(s)||!s.every(lO))&&(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),c=!1),c}).reduce(function(n,r){var i=nf(r,2),s=i[0],c=i[1];return N_(N_({},n),{},rO({},s,c))},{});return[{description:"Files",accept:t}]}return e}function wie(e){if(dl(e))return Object.entries(e).reduce(function(t,n){var r=nf(n,2),i=r[0],s=r[1];return[].concat(k_(t),[i],k_(s))},[]).filter(function(t){return sO(t)||lO(t)}).join(",")}function Cie(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Eie(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function sO(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function lO(e){return/^.*\.[\w]+$/.test(e)}var Tie=["children"],Rie=["open"],_ie=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Die=["refKey","onChange","onClick"];function I_(e){return Pie(e)||kie(e)||cO(e)||Aie()}function Aie(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
223
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kie(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Pie(e){if(Array.isArray(e))return vb(e)}function Cx(e,t){return Mie(e)||Oie(e,t)||cO(e,t)||Nie()}function Nie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
224
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cO(e,t){if(e){if(typeof e=="string")return vb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vb(e,t)}}function vb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Oie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,s=!1,c,u;try{for(n=n.call(e);!(i=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));i=!0);}catch(f){s=!0,u=f}finally{try{!i&&n.return!=null&&n.return()}finally{if(s)throw u}}return r}}function Mie(e){if(Array.isArray(e))return e}function z_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?z_(Object(n),!0).forEach(function(r){yb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function am(e,t){if(e==null)return{};var n=Lie(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lie(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s<r.length;s++)i=r[s],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var x1=v.forwardRef(function(e,t){var n=e.children,r=am(e,Tie),i=dO(r),s=i.open,c=am(i,Rie);return v.useImperativeHandle(t,function(){return{open:s}},[s]),Ln.createElement(v.Fragment,null,n(_n(_n({},c),{},{open:s})))});x1.displayName="Dropzone";var uO={disabled:!1,getFilesFromEvent:Gre,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};x1.defaultProps=uO;x1.propTypes={children:un.func,accept:un.objectOf(un.arrayOf(un.string)),multiple:un.bool,preventDropOnDocument:un.bool,noClick:un.bool,noKeyboard:un.bool,noDrag:un.bool,noDragEventsBubbling:un.bool,minSize:un.number,maxSize:un.number,maxFiles:un.number,disabled:un.bool,getFilesFromEvent:un.func,onFileDialogCancel:un.func,onFileDialogOpen:un.func,useFsAccessApi:un.bool,autoFocus:un.bool,onDragEnter:un.func,onDragLeave:un.func,onDragOver:un.func,onDrop:un.func,onDropAccepted:un.func,onDropRejected:un.func,onError:un.func,validator:un.func};var xb={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function dO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=_n(_n({},uO),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,h=t.onDragEnter,m=t.onDragLeave,g=t.onDragOver,y=t.onDrop,x=t.onDropAccepted,S=t.onDropRejected,w=t.onFileDialogCancel,C=t.onFileDialogOpen,T=t.useFsAccessApi,R=t.autoFocus,E=t.preventDropOnDocument,_=t.noClick,P=t.noKeyboard,O=t.noDrag,k=t.noDragEventsBubbling,A=t.onError,z=t.validator,U=v.useMemo(function(){return wie(n)},[n]),K=v.useMemo(function(){return jie(n)},[n]),W=v.useMemo(function(){return typeof C=="function"?C:$_},[C]),ee=v.useMemo(function(){return typeof w=="function"?w:$_},[w]),B=v.useRef(null),G=v.useRef(null),L=v.useReducer(Iie,xb),I=Cx(L,2),$=I[0],V=I[1],X=$.isFocused,M=$.isFileDialogActive,F=v.useRef(typeof window<"u"&&window.isSecureContext&&T&&Sie()),ie=function(){!F.current&&M&&setTimeout(function(){if(G.current){var he=G.current.files;he.length||(V({type:"closeDialog"}),ee())}},300)};v.useEffect(function(){return window.addEventListener("focus",ie,!1),function(){window.removeEventListener("focus",ie,!1)}},[G,M,ee,F]);var de=v.useRef([]),Se=v.useRef([]),Ce=function(he){B.current&&B.current.contains(he.target)||(he.preventDefault(),de.current=[])};v.useEffect(function(){return E&&(document.addEventListener("dragover",L_,!1),document.addEventListener("drop",Ce,!1)),function(){E&&(document.removeEventListener("dragover",L_),document.removeEventListener("drop",Ce))}},[B,E]),v.useEffect(function(){var Ee=function(At){Se.current=[].concat(I_(Se.current),[At.target]),Cd(At)&&V({isDragGlobal:!0,type:"setDragGlobal"})},he=function(At){Se.current=Se.current.filter(function(ln){return ln!==At.target&&ln!==null}),!(Se.current.length>0)&&V({isDragGlobal:!1,type:"setDragGlobal"})},ke=function(){Se.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})},Dt=function(){Se.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",Ee,!1),document.addEventListener("dragleave",he,!1),document.addEventListener("dragend",ke,!1),document.addEventListener("drop",Dt,!1),function(){document.removeEventListener("dragenter",Ee),document.removeEventListener("dragleave",he),document.removeEventListener("dragend",ke),document.removeEventListener("drop",Dt)}},[B]),v.useEffect(function(){return!r&&R&&B.current&&B.current.focus(),function(){}},[B,R,r]);var je=v.useCallback(function(Ee){A?A(Ee):console.error(Ee)},[A]),Ke=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),at(Ee),de.current=[].concat(I_(de.current),[Ee.target]),Cd(Ee)&&Promise.resolve(i(Ee)).then(function(he){if(!(om(Ee)&&!k)){var ke=he.length,Dt=ke>0&&vie({files:he,accept:U,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:z}),Rt=ke>0&&!Dt;V({isDragAccept:Dt,isDragReject:Rt,isDragActive:!0,type:"setDraggedFiles"}),h&&h(Ee)}}).catch(function(he){return je(he)})},[i,h,je,k,U,c,s,u,f,z]),_e=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),at(Ee);var he=Cd(Ee);if(he&&Ee.dataTransfer)try{Ee.dataTransfer.dropEffect="copy"}catch{}return he&&g&&g(Ee),!1},[g,k]),ht=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),at(Ee);var he=de.current.filter(function(Dt){return B.current&&B.current.contains(Dt)}),ke=he.indexOf(Ee.target);ke!==-1&&he.splice(ke,1),de.current=he,!(he.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Cd(Ee)&&m&&m(Ee))},[B,m,k]),Ct=v.useCallback(function(Ee,he){var ke=[],Dt=[];Ee.forEach(function(Rt){var At=oO(Rt,U),ln=Cx(At,2),vn=ln[0],lr=ln[1],Hn=aO(Rt,c,s),wn=Cx(Hn,2),zn=wn[0],xi=wn[1],go=z?z(Rt):null;if(vn&&zn&&!go)ke.push(Rt);else{var Qo=[lr,xi];go&&(Qo=Qo.concat(go)),Dt.push({file:Rt,errors:Qo.filter(function(Yi){return Yi})})}}),(!u&&ke.length>1||u&&f>=1&&ke.length>f)&&(ke.forEach(function(Rt){Dt.push({file:Rt,errors:[mie]})}),ke.splice(0)),V({acceptedFiles:ke,fileRejections:Dt,type:"setFiles"}),y&&y(ke,Dt,he),Dt.length>0&&S&&S(Dt,he),ke.length>0&&x&&x(ke,he)},[V,u,U,c,s,f,y,x,S,z]),Et=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),at(Ee),de.current=[],Cd(Ee)&&Promise.resolve(i(Ee)).then(function(he){om(Ee)&&!k||Ct(he,Ee)}).catch(function(he){return je(he)}),V({type:"reset"})},[i,Ct,je,k]),qe=v.useCallback(function(){if(F.current){V({type:"openDialog"}),W();var Ee={multiple:u,types:K};window.showOpenFilePicker(Ee).then(function(he){return i(he)}).then(function(he){Ct(he,null),V({type:"closeDialog"})}).catch(function(he){Cie(he)?(ee(he),V({type:"closeDialog"})):Eie(he)?(F.current=!1,G.current?(G.current.value=null,G.current.click()):je(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):je(he)});return}G.current&&(V({type:"openDialog"}),W(),G.current.value=null,G.current.click())},[V,W,ee,T,Ct,je,K,u]),ct=v.useCallback(function(Ee){!B.current||!B.current.isEqualNode(Ee.target)||(Ee.key===" "||Ee.key==="Enter"||Ee.keyCode===32||Ee.keyCode===13)&&(Ee.preventDefault(),qe())},[B,qe]),Tt=v.useCallback(function(){V({type:"focus"})},[]),It=v.useCallback(function(){V({type:"blur"})},[]),Te=v.useCallback(function(){_||(bie()?setTimeout(qe,0):qe())},[_,qe]),Oe=function(he){return r?null:he},Le=function(he){return P?null:Oe(he)},Ie=function(he){return O?null:Oe(he)},at=function(he){k&&he.stopPropagation()},Ze=v.useMemo(function(){return function(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},he=Ee.refKey,ke=he===void 0?"ref":he,Dt=Ee.role,Rt=Ee.onKeyDown,At=Ee.onFocus,ln=Ee.onBlur,vn=Ee.onClick,lr=Ee.onDragEnter,Hn=Ee.onDragOver,wn=Ee.onDragLeave,zn=Ee.onDrop,xi=am(Ee,_ie);return _n(_n(yb({onKeyDown:Le(Eo(Rt,ct)),onFocus:Le(Eo(At,Tt)),onBlur:Le(Eo(ln,It)),onClick:Oe(Eo(vn,Te)),onDragEnter:Ie(Eo(lr,Ke)),onDragOver:Ie(Eo(Hn,_e)),onDragLeave:Ie(Eo(wn,ht)),onDrop:Ie(Eo(zn,Et)),role:typeof Dt=="string"&&Dt!==""?Dt:"presentation"},ke,B),!r&&!P?{tabIndex:0}:{}),xi)}},[B,ct,Tt,It,Te,Ke,_e,ht,Et,P,O,r]),dt=v.useCallback(function(Ee){Ee.stopPropagation()},[]),ft=v.useMemo(function(){return function(){var Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},he=Ee.refKey,ke=he===void 0?"ref":he,Dt=Ee.onChange,Rt=Ee.onClick,At=am(Ee,Die),ln=yb({accept:U,multiple:u,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Oe(Eo(Dt,Et)),onClick:Oe(Eo(Rt,dt)),tabIndex:-1},ke,G);return _n(_n({},ln),At)}},[G,n,u,Et,r]);return _n(_n({},$),{},{isFocused:X&&!r,getRootProps:Ze,getInputProps:ft,rootRef:B,inputRef:G,open:Oe(qe)})}function Iie(e,t){switch(t.type){case"focus":return _n(_n({},e),{},{isFocused:!0});case"blur":return _n(_n({},e),{},{isFocused:!1});case"openDialog":return _n(_n({},xb),{},{isFileDialogActive:!0});case"closeDialog":return _n(_n({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return _n(_n({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return _n(_n({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return _n(_n({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return _n({},xb);default:return e}}function $_(){}const[zie,$ie]=Or("Dropzone component was not found in tree");var rf={root:"m_d46a4834",inner:"m_b85f7144",fullScreen:"m_96f6e9ad",dropzone:"m_7946116d"};function b1(e){const t=n=>{const{children:r,...i}=ae(`Dropzone${yE(e)}`,{},n),s=$ie(),c=cm(r)?r:a.jsx("span",{children:r});return s[e]?v.cloneElement(c,i):null};return t.displayName=`@mantine/dropzone/${yE(e)}`,t}const Uie=b1("accept"),Bie=b1("reject"),Vie=b1("idle"),Fie={multiple:!0,maxSize:1/0,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},Hie=(e,{radius:t,variant:n,acceptColor:r,rejectColor:i})=>{const s=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),c=e.variantColorResolver({color:i||"red",theme:e,variant:n});return{root:{"--dropzone-radius":Ht(t),"--dropzone-accept-color":s.color,"--dropzone-accept-bg":s.background,"--dropzone-reject-color":c.color,"--dropzone-reject-bg":c.background}}},Is=ve((e,t)=>{const n=ae("Dropzone",Fie,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,radius:h,disabled:m,loading:g,multiple:y,maxSize:x,accept:S,children:w,onDropAny:C,onDrop:T,onReject:R,openRef:E,name:_,maxFiles:P,autoFocus:O,activateOnClick:k,activateOnDrag:A,dragEventsBubbling:z,activateOnKeyboard:U,onDragEnter:K,onDragLeave:W,onDragOver:ee,onFileDialogCancel:B,onFileDialogOpen:G,preventDropOnDocument:L,useFsAccessApi:I,getFilesFromEvent:$,validator:V,rejectColor:X,acceptColor:M,enablePointerEvents:F,loaderProps:ie,inputProps:de,mod:Se,attributes:Ce,...je}=n,Ke=$e({name:"Dropzone",classes:rf,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:Ce,vars:f,varsResolver:Hie}),{getRootProps:_e,getInputProps:ht,isDragAccept:Ct,isDragReject:Et,isDragActive:qe,open:ct}=dO({onDrop:C,onDropAccepted:T,onDropRejected:R,disabled:m||g,accept:Array.isArray(S)?S.reduce((Oe,Le)=>({...Oe,[Le]:[]}),{}):S,multiple:y,maxSize:x,maxFiles:P,autoFocus:O,noClick:!k,noDrag:!A,noDragEventsBubbling:!z,noKeyboard:!U,onDragEnter:K,onDragLeave:W,onDragOver:ee,onFileDialogCancel:B,onFileDialogOpen:G,preventDropOnDocument:L,useFsAccessApi:I,validator:V,...$?{getFilesFromEvent:$}:null});Ld(E,ct);const Tt=qe&&Ct,It=qe&&Et,Te=!Tt&&!It;return a.jsx(zie,{value:{accept:Tt,reject:It,idle:Te},children:a.jsxs(le,{..._e(),...Ke("root",{focusable:!0}),...je,mod:[{accept:Tt,reject:It,idle:Te,disabled:m,loading:g,"activate-on-click":k},Se],children:[a.jsx(Rm,{visible:g,overlayProps:{radius:h},unstyled:u,loaderProps:ie}),a.jsx("input",{...ht(de),name:_}),a.jsx("div",{...Ke("inner"),ref:t,"data-enable-pointer-events":F||void 0,children:w})]})})});Is.classes=rf;Is.displayName="@mantine/dropzone/Dropzone";Is.Accept=Uie;Is.Idle=Vie;Is.Reject=Bie;const qie={maxSize:1/0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:Br("max"),withinPortal:!0},S1=ve((e,t)=>{const n=ae("DropzoneFullScreen",qie,e),{classNames:r,className:i,style:s,styles:c,unstyled:u,vars:f,active:h,onDrop:m,onReject:g,zIndex:y,withinPortal:x,portalProps:S,attributes:w,...C}=n,T=$e({name:"DropzoneFullScreen",classes:rf,props:n,className:i,style:s,classNames:r,styles:c,unstyled:u,attributes:w,rootSelector:"fullScreen"}),{resolvedClassNames:R,resolvedStyles:E}=Ll({classNames:r,styles:c,props:n}),[_,P]=v.useState(0),[O,{open:k,close:A}]=Ts(!1),z=K=>{K.dataTransfer?.types.includes("Files")&&(P(W=>W+1),k())},U=()=>{P(K=>K-1)};return v.useEffect(()=>{_===0&&A()},[_]),v.useEffect(()=>{if(h)return document.addEventListener("dragenter",z,!1),document.addEventListener("dragleave",U,!1),()=>{document.removeEventListener("dragenter",z,!1),document.removeEventListener("dragleave",U,!1)}},[h]),a.jsx(ja,{...S,withinPortal:x,children:a.jsx(le,{ref:t,...T("fullScreen",{style:{opacity:O?1:0,pointerEvents:O?"all":"none",zIndex:y}}),children:a.jsx(Is,{activateOnClick:!1,...C,classNames:R,styles:E,unstyled:u,className:rf.dropzone,onDrop:K=>{m?.(K),A(),P(0)},onReject:K=>{g?.(K),A(),P(0)}})})})});S1.classes=rf;S1.displayName="@mantine/dropzone/DropzoneFullScreen";Is.FullScreen=S1;const gp=Is,Gie='{"resourceType": "Bundle"}';function Ex({id:e,title:t,message:n,color:r,icon:i,withCloseButton:s=!1,method:c="show",loading:u}){Li[c]({id:e,loading:u,title:t,message:n,color:r,icon:i,withCloseButton:s,autoClose:!1})}function Wie(){const e=Nn(),t=Re(),[n,r]=v.useState({}),i=v.useCallback(async(u,f)=>{const h="batch-upload";Ex({id:h,title:"Batch Upload in Progress",message:"Your batch data is being uploaded. This may take a moment...",method:"show",loading:!0});try{r({});let m=JSON.parse(u);m.type!=="batch"&&m.type!=="transaction"&&(m=zk(m));const g=await t.executeBatch(m);r(y=>({...y,[f]:g})),Ex({id:h,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(Go,{size:"1rem"}),withCloseButton:!0})}catch(m){Ex({id:h,title:"Batch Upload Failed",color:"red",message:We(m),method:"update",icon:a.jsx(ws,{size:"1rem"}),withCloseButton:!0})}},[t]),s=v.useCallback(async u=>{for(const f of u){const h=new FileReader;h.onload=m=>i(m.target?.result,f.name),h.readAsText(f)}},[i]),c=v.useCallback(async u=>{await i(u.input,"JSON Data")},[i]);return a.jsxs(lt,{children:[a.jsx(ze,{children:"Batch Create"}),a.jsxs(ge,{children:["Use this page to create, read, or update multiple resources. For more details, see"," ",a.jsx(wt,{href:"https://www.hl7.org/fhir/http.html#transaction",children:"FHIR Batch and Transaction"}),"."]}),Object.keys(n).length===0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Input"}),a.jsxs(bn,{defaultValue:"upload",children:[a.jsxs(bn.List,{children:[a.jsx(bn.Tab,{value:"upload",children:"File Upload"}),a.jsx(bn.Tab,{value:"json",children:"JSON"})]}),a.jsx(bn.Panel,{value:"upload",pt:"xs",children:a.jsx(gp,{onDrop:s,accept:["application/json"],children:a.jsxs(xe,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(gp.Accept,{children:a.jsx(dR,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(gp.Reject,{children:a.jsx(ws,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(gp.Idle,{children:a.jsx(dR,{size:50,stroke:1.5})}),a.jsxs("div",{children:[a.jsx(ge,{size:"xl",inline:!0,children:"Drag files here or click to select files"}),a.jsx(ge,{size:"sm",color:"dimmed",inline:!0,mt:7,children:"Attach as many files as you like"})]})]})})}),a.jsx(bn.Panel,{value:"json",pt:"xs",children:a.jsxs(pt,{onSubmit:c,children:[a.jsx(vu,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:Gie,deserialize:JSON.parse}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Me,{type:"submit",children:"Submit"})})]})})]})]}),Object.keys(n).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Output"}),a.jsxs(bn,{defaultValue:Object.keys(n)[0],children:[a.jsx(bn.List,{children:Object.keys(n).map(u=>a.jsx(bn.Tab,{value:u,children:u},u))}),Object.keys(n).map(u=>a.jsx(bn.Panel,{value:u,children:a.jsx("pre",{style:{border:"1px solid #888"},children:JSON.stringify(n[u],void 0,2)})},u))]}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Me,{onClick:()=>r({}),children:"Start over"})})]})]})}function Qie(){const{resourceType:e}=Yt(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(i=>!!i),[r]=lu("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(lt,{children:[a.jsxs(ze,{children:["No apps for ",e]}),a.jsx(jt,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(lt,{children:a.jsx("div",{children:r.map(i=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(jt,{to:`/forms/${i.id}?subject=`+n.map(s=>`${e}/${s}`).join(","),children:i.name})}),a.jsx("p",{children:i.description})]},i.id))})}):a.jsx(Ui,{})}function Yie(){const e=Re(),[t,n]=v.useState(),[r,i]=v.useState(!1);return a.jsx(lt,{width:450,children:a.jsxs(pt,{onSubmit:s=>{n(void 0),e.post("auth/changepassword",s).then(()=>i(!0)).catch(c=>n(rn(c)))},children:[a.jsxs(ar,{direction:"column",align:"center",justify:"center",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{children:"Change password"})]}),!r&&a.jsxs(Ne,{gap:"xl",mt:"xl",children:[a.jsx(ao,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:Ut(t,"oldPassword")}),a.jsx(ao,{name:"newPassword",label:"New password",required:!0,error:Ut(t,"newPassword")}),a.jsx(ao,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Ut(t,"confirmPassword")}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Me,{type:"submit",children:"Change password"})})]}),r&&a.jsx("div",{"data-testid":"success",children:"Password changed successfully"})]})})}const Kie=["Form","JSON","Profiles"];function Xie(){const{resourceType:e}=Yt();return a.jsxs(a.Fragment,{children:[a.jsxs(gr,{children:[a.jsxs(ge,{p:"md",fw:500,children:["New ",e]}),a.jsx(ti,{children:a.jsx(Of,{baseUrl:`/${e}/new`,tabs:Kie})})]}),a.jsx(h1,{})]})}function Jie(){return a.jsx(lt,{children:a.jsxs(Ne,{children:[a.jsx(ze,{order:1,children:"Unexpected Error"}),a.jsx(ge,{children:"We're sorry, something went wrong."}),a.jsxs(ge,{children:["Please contact ",a.jsx(wt,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}function fO(e){const t=Wt(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx(jt,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(c,u){c&&u&&n.push({key:c,value:u})}function i(c){c&&r(c.system,c.value)}function s(c,u){Array.isArray(u)?u.forEach(f=>s(c,f)):typeof u=="string"?r(c,u):u&&(Array.isArray(u.coding)?r(c,u.coding.map(f=>f.display||f.code).join(", ")):r(c,u.text))}if("name"in t){const c=Ea(t);c!==$t(t)&&r("Name",c)}return"category"in t&&s("Category",t.category),t.resourceType!=="Bot"&&"code"in t&&s("Code",t.code),"identifier"in t&&(Array.isArray(t.identifier)?t.identifier.forEach(i):i(t.identifier)),n.length===1&&n.push({key:"ID",value:t.id}),a.jsx(vt,{children:n.map((c,u)=>a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:c.key}),a.jsx(vt.Value,{children:c.value})]},`${c.key}-${u}`))})}function Zie(){const{id:e}=Yt(),t=Fr(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,i=Re(),[s,c]=v.useState(!0),[u,f]=v.useState(),[h,m]=v.useState(),[g,y]=v.useState(),[x,S]=v.useState(),[w,C]=v.useState();if(v.useEffect(()=>{const E={resourceType:"Bundle",type:"batch",entry:[{request:{method:"GET",url:`Questionnaire/${e}`}}]};if(r){const _=r.split(",").filter(P=>!!P);_.length===1&&E.entry.push({request:{method:"GET",url:_[0]}}),m(_)}i.executeBatch(E).then(_=>{_.entry?.[0]?.response?.status!=="200"?S(_.entry?.[0]?.response?.outcome):(f(_.entry[0]?.resource),y(_.entry[1]?.resource)),c(!1)}).catch(_=>{S(_),c(!1)})},[i,e,r]),x)return a.jsx(lt,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(x,void 0,2)})});if(w)return a.jsxs(lt,{children:[a.jsx(ze,{children:u?.title}),a.jsx("p",{children:"Your response has been recorded."}),a.jsxs("ul",{children:[w.length===1&&a.jsx("li",{children:a.jsx(jt,{to:w[0],children:"Review your answers"})}),w.length>1&&a.jsxs("li",{children:["Review your answers:",a.jsx("ul",{children:w.map(E=>a.jsx("li",{children:a.jsx(jt,{to:E,children:$t(E)})},E.id))})]}),g&&a.jsx("li",{children:a.jsxs(jt,{to:g,children:["Back to ",Ea(g)]})}),a.jsx("li",{children:a.jsx(jt,{to:"/",children:"Go back home"})})]})]});if(s||!u)return a.jsx(Ui,{});const T=g&&g1(g);return a.jsxs(a.Fragment,{children:[a.jsxs(gr,{shadow:"xs",radius:0,children:[T&&a.jsx(dN,{patient:T}),g&&g.resourceType!=="Patient"&&a.jsx(fO,{resource:g}),a.jsx(le,{px:"xl",py:"md",children:a.jsxs(ge,{children:[Ea(u),h&&h.length>1&&a.jsxs(a.Fragment,{children:[" (for ",h.length," resources)"]})]})})]}),a.jsx(lt,{children:a.jsx(QP,{questionnaire:u,subject:g&&nn(g),onSubmit:R})})]});async function R(E){const _=[];if(!h||h.length===0)_.push(await i.createResource(E));else for(const P of h)_.push(await i.createResource({...E,subject:{reference:P}}));C(_)}}const eoe="_paper_unw9o_1",toe={paper:eoe},noe={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function hO(e,t){const n=e.resourceType||roe(t),r=e.fields??ioe(n),i=e.filters??(e.resourceType?void 0:ooe(n)),s=e.sortRules??aoe(n),c=e.offset??0,u=e.count??Km;return{...e,resourceType:n,fields:r,filters:i,sortRules:s,offset:c,count:u}}function roe(e){return localStorage.getItem("defaultResourceType")??e?.option?.find(t=>t.id==="defaultResourceType")?.valueString??"Patient"}function ioe(e){const t=j1(e);if(t?.fields)return t.fields;const n=["id","_lastUpdated"];switch(e){case"Patient":n.push("name","birthDate","gender");break;case"AsyncJob":n.push("status","dataVersion");break;case"AccessPolicy":case"Bot":case"ClientApplication":case"Practitioner":case"Project":case"Organization":case"Questionnaire":case"UserConfiguration":n.push("name");break;case"CodeSystem":case"ValueSet":n.push("name","title","status");break;case"Condition":n.push("subject","code","clinicalStatus");break;case"Device":n.push("manufacturer","deviceName","patient");break;case"DeviceDefinition":n.push("manufacturer[x]","deviceName");break;case"DeviceRequest":n.push("code[x]","subject");break;case"DiagnosticReport":case"Observation":n.push("subject","code","status");break;case"Encounter":n.push("subject");break;case"ServiceRequest":n.push("subject","code","status","orderDetail");break;case"Subscription":n.push("criteria");break;case"User":n.push("email");break}return n}function ooe(e){return j1(e)?.filters}function aoe(e){const t=j1(e);return t?.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function j1(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function soe(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function loe(e,t){const n={...e,count:1e3,offset:0},r=hO(n,t.getUserConfiguration()),i=await t.search(r.resourceType,vs({...r,total:"accurate",fields:void 0}));return zk(i)}function U_(){const e=Re(),t=Fn(),n=Fr(),[r,i]=v.useState();return v.useEffect(()=>{const s=Nk(n.pathname+n.search),c=hO(s,e.getUserConfiguration());n.pathname===`/${c.resourceType}`&&n.search===vs(c)?(soe(c),i(c)):t(`/${c.resourceType}${vs(c)}`)?.catch(console.error)},[e,t,n]),!r?.resourceType||!r.fields||r.fields.length===0?a.jsx(Ui,{}):a.jsx(gr,{shadow:"xs",m:"md",p:"xs",className:toe.paper,children:a.jsx(ql,{checkboxesEnabled:!0,search:r,onClick:s=>t(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onAuxClick:s=>window.open(`/${s.resource.resourceType}/${s.resource.id}`,"_blank"),onChange:s=>{t(`/${r.resourceType}${vs(s.definition)}`)?.catch(console.error)},onNew:()=>{t(noe[r.resourceType]??`/${r.resourceType}/new`)?.catch(console.error)},onExportCsv:()=>{const s=e.fhirUrl(r.resourceType,"$csv")+vs(r);e.download(s).then(c=>{window.open(window.URL.createObjectURL(c),"_blank")}).catch(c=>Ae({color:"red",message:We(c),autoClose:!1}))},onExportTransactionBundle:async()=>{loe(r,e).then(s=>uP(JSON.stringify(s,void 0,2))).catch(s=>Ae({color:"red",message:We(s),autoClose:!1}))},onDelete:s=>{window.confirm("Are you sure you want to delete these resources?")&&(e.invalidateSearches(r.resourceType),e.executeBatch({resourceType:"Bundle",type:"batch",entry:s.map(c=>({request:{method:"DELETE",url:`${r.resourceType}/${c}`}}))}).then(()=>i({...r})).catch(c=>Ae({color:"red",message:We(c),autoClose:!1})))},onBulk:s=>{t(`/bulk/${r.resourceType}?ids=${s.join(",")}`)?.catch(console.error)}})})}function coe(){const[e]=lu("ObservationDefinition","_count=100");return e?a.jsxs(Z,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Code"}),a.jsx("th",{children:"Method"}),a.jsx("th",{children:"Unit"}),a.jsx("th",{children:"Precision"}),a.jsx("th",{children:"Ranges"})]})}),a.jsx("tbody",{children:e.map(t=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Lo,{value:t.category?.[0]})}),a.jsx("td",{children:a.jsx(Lo,{value:t.code})}),a.jsx("td",{children:a.jsx(Lo,{value:t.method})}),a.jsx("td",{children:t.quantitativeDetails?.unit?.text}),a.jsx("td",{children:t.quantitativeDetails?.decimalPrecision}),a.jsx("td",{children:a.jsx(bb,{ranges:t.qualifiedInterval})})]},t.id))})]}):a.jsx(Ui,{})}function bb(e){const{ranges:t}=e;if(!t)return null;const n=B_(t.map(i=>i.gender));if(n.length>1)return au(n),a.jsx(a.Fragment,{children:n.map(i=>a.jsxs(v.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:Xn(i)})}),a.jsx(bb,{ranges:e.ranges?.filter(s=>s.gender===i)})]},i))});const r=B_(t.map(i=>i.age&&Gd(i.age)));return r.length>1?(au(r),a.jsx(a.Fragment,{children:r.map(i=>a.jsxs(v.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:Xn(i)})}),a.jsx(bb,{ranges:e.ranges?.filter(s=>Gd(s.age)===i)})]},i))})):a.jsx(a.Fragment,{children:t.map(i=>a.jsx("table",{children:a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{children:i.condition}),a.jsx("td",{children:a.jsx(GS,{value:i.range})})]})})},`range-${i.condition}`))})}function B_(e){return[...new Set(e.filter(t=>!!t))]}function uoe(){const[e]=lu("ActivityDefinition","_count=100"),[t]=lu("ObservationDefinition","_count=100");return!e||!t?a.jsx(Ui,{}):a.jsxs(Z,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Assay"}),e.map(n=>a.jsx("th",{children:n.name},n.id))]})}),a.jsx("tbody",{children:t.map(n=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Lo,{value:n.category?.[0]})}),a.jsx("td",{children:a.jsx(Lo,{value:n.code})}),e.map(r=>a.jsx("td",{children:r.observationResultRequirement?.find(i=>i.reference?.includes(n.id))?"✅":""},r.id))]},n.id))})]})}function doe(){const e=Re(),[t,n]=v.useState(),[r,i]=v.useState(void 0),[s,c]=v.useState(!1),u=v.useCallback(()=>{e.get("auth/mfa/status",{cache:"no-cache"}).then(m=>{n(m.enrollQrCode),i(m.enrolled)}).catch(m=>Ae({color:"red",message:We(m),autoClose:!1}))},[e]);v.useEffect(()=>{u()},[u]);const f=v.useCallback(m=>{e.post("auth/mfa/enroll",m).then(()=>{i(!0),Ae({color:"green",message:"Success"})}).catch(g=>Ae({color:"red",message:We(g),autoClose:!1}))},[e]),h=v.useCallback(async m=>e.post("auth/mfa/disable",{token:m.token}),[e]);return r===void 0?null:r?a.jsxs(lt,{children:[a.jsx(Mn,{title:"Disable MFA",opened:s,onClose:()=>c(!1),children:a.jsx(Kp,{title:"Disable MFA",buttonText:"Submit code",onSubmit:async m=>{await h(m),c(!1),i(!1),Ae({id:"mfa-disabled",color:"green",title:"Success",message:"MFA disabled",icon:a.jsx(Qq,{})}),u()}})}),a.jsxs(xe,{children:[a.jsx(ze,{children:"MFA is enabled"}),a.jsx(Me,{onClick:()=>c(!0),children:"Disable MFA"})]})]}):a.jsx(lt,{width:400,children:a.jsx(Kp,{title:"Multi Factor Auth Setup",buttonText:"Enroll",qrCodeUrl:t,onSubmit:f})})}const foe={},Sb={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__",awsTextractEnabled:foe?.MEDPLUM_AWS_TEXTRACT_ENABLED};function Bf(){return Sb}function w1(){return pO("registerEnabled")}function hoe(){return pO("awsTextractEnabled")}function pO(e){try{return Sb[e]!==!1&&Sb[e]!=="false"}catch{return!0}}function poe(){const e=Fn(),[t]=Sg(),n=Re(),r=t.get("scope")||"openid",[i,s]=v.useState(),[c,u]=v.useState(!0),f=t.get("client_id"),h=t.get("login");if(v.useEffect(()=>{if(!f||f==="medplum-cli")return;async function g(){try{const y=await n.get(`/auth/clientinfo/${f}`);s(y)}catch(y){Ae({id:"clientinfofail",title:"Failed to retrieve client information.",color:"red",message:We(y),withCloseButton:!0})}finally{u(!1)}}g().catch(console.error)},[n,f]),!f)return null;function m(g){const y=new URL(t.get("redirect_uri"));for(const x of["scope","state","nonce"])t.has(x)&&y.searchParams.set(x,t.get(x));y.searchParams.set("code",g),rr.assign(y.toString())}return a.jsx(NP,{onCode:m,onForgotPassword:()=>e("/resetpassword")?.catch(console.error),onRegister:()=>e("/register")?.catch(console.error),googleClientId:Bf().googleClientId,clientId:f||void 0,redirectUri:t.get("redirect_uri")||void 0,scope:r,nonce:t.get("nonce")||void 0,launch:t.get("launch")||void 0,codeChallenge:t.get("code_challenge")||void 0,codeChallengeMethod:t.get("code_challenge_method")||void 0,chooseScopes:r!=="openid",login:h||void 0,children:!c&&a.jsxs(a.Fragment,{children:[i?.logo?.url?a.jsx("img",{src:i?.logo?.url,alt:"Welcome Logo",height:60,style:{width:"auto"}}):a.jsx(Wi,{size:32}),a.jsx(ze,{children:i?.welcomeString??"Sign in to Medplum"})]})})}function moe(){const e=Re(),t=Fn(),n=Bf();return v.useEffect(()=>{e.getProfile()&&t("/signin?project=new")?.catch(console.error)},[e,t]),w1()?a.jsxs(wY,{type:"project",projectId:"new",onSuccess:()=>{window.location.href="/"},googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx(Wi,{size:32}),a.jsx(ze,{order:3,py:"lg",children:"Register a new account"})]}):a.jsx(lt,{width:450,children:a.jsx(qo,{icon:a.jsx(Ns,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function goe(){const e=Fn(),[t]=Sg(),n=Re(),[r,i]=v.useState(),[s,c]=v.useState(!1),u=Bf().recaptchaSiteKey,f=t.get("project")||void 0;return v.useEffect(()=>{DP(u)},[u]),a.jsx(lt,{width:400,px:"xl",py:"xl",bdrs:"md",children:a.jsxs(pt,{onSubmit:async h=>{i(void 0);try{let m="";u&&(m=await AP(u)),await n.post("auth/resetpassword",{...h,projectId:f,recaptchaToken:m}),c(!0)}catch(m){i(rn(m))}},children:[a.jsxs(ar,{direction:"column",align:"center",justify:"center",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{order:3,py:"lg",children:"Reset your password"})]}),a.jsx(xr,{issues:Ms(r,void 0),mb:"lg"}),!s&&a.jsxs(a.Fragment,{children:[a.jsx(Ne,{gap:"sm",mb:"md",children:a.jsx(Fe,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0,error:Ut(r,"email")})}),a.jsxs(Ne,{gap:"xs",children:[a.jsx(yr,{fullWidth:!0,children:"Reset Password"}),a.jsx(ge,{size:"sm",mt:"lg",c:"dimmed",style:{textAlign:"center"},"data-dashlane-ignore":"true","data-lp-ignore":"true","data-no-autofill":"true","data-form-type":"navigation",children:a.jsx(wt,{onClick:()=>e("/signin")?.catch(console.error),children:"Back to Sign In"})}),w1()&&a.jsxs(ge,{size:"sm",mt:"none",c:"dimmed",style:{textAlign:"center"},"data-dashlane-ignore":"true","data-lp-ignore":"true","data-no-autofill":"true","data-form-type":"navigation",children:["Don't have an account?"," ",a.jsx(wt,{onClick:()=>e("/register")?.catch(console.error),children:"Sign Up"})]})]})]}),s&&a.jsx(ge,{c:"dimmed",size:"sm",ta:"center",mt:"md",children:"If the account exists on our system, a password reset email will be sent."})]})})}function voe(e){const t=Re(),[n,r]=v.useState(),[i,s]=v.useState();return i?a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Request group created successfully."}),a.jsxs("ul",{children:[a.jsxs("li",{children:["Go to the"," ",a.jsx(jt,{to:i,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx(jt,{to:e.planDefinition,children:"Plan Definition"})]})]})]}):a.jsx(pt,{onSubmit:()=>{t.post(t.fhirUrl("PlanDefinition",e.planDefinition.id,"$apply"),{resourceType:"Parameters",parameter:[{name:"subject",valueString:n?.reference}]}).then(s).catch(console.log)},children:a.jsxs(Ne,{children:[a.jsxs(ze,{children:['Start "',e.planDefinition.title,'"']}),a.jsxs(ge,{children:["Use the ",a.jsx("strong",{children:"Apply"})," operation to create a group of tasks for a workflow."]}),a.jsx(ge,{children:"The following tasks will be created:"}),a.jsx("ul",{children:e.planDefinition.action?.map((c,u)=>a.jsxs("li",{children:[c.definitionCanonical?.startsWith("Questionnaire/")&&"Questionnaire request: ",c.title&&a.jsx(a.Fragment,{children:c.title}),c.code&&a.jsx(Lo,{value:c.code[0]})]},`action-${u}`))}),a.jsx(Vt,{title:"Subject",children:a.jsx(ba,{name:"subject",targetTypes:["Patient","Practitioner"],defaultValue:n,onChange:r})}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Me,{type:"submit",children:"Go"})})]})})}function yoe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?a.jsx(lt,{children:a.jsx(voe,{planDefinition:n})}):null}function xoe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t}),[r,i]=lu("Questionnaire","subject-type="+e),[s,c]=lu("ClientApplication",{_count:1e3});if(!n||i||c)return a.jsx(Ui,{});const u=s?.filter(m=>boe(e)&&!!m.launchUri);if((!r||r.length===0)&&(!u||u.length===0))return a.jsxs(lt,{children:[a.jsx(ze,{children:"Apps"}),a.jsxs("p",{children:["No apps found. Contact your administrator or ",a.jsx("a",{href:"mailto:support@medplum.com",children:"Medplum Support"})," to add automation here."]})]});let f,h;return n.resourceType==="Patient"?f=nn(n):n.resourceType==="Encounter"&&(f=n.subject,h=nn(n)),a.jsxs(lt,{children:[r?.map(m=>a.jsxs("div",{children:[a.jsx(ze,{order:3,children:a.jsx(jt,{to:`/forms/${m.id}?subject=${$t(n)}`,children:m.title||m.name})}),a.jsx(ge,{children:m.description})]},m.id)),u?.map(m=>a.jsxs("div",{children:[a.jsx(ze,{order:3,children:a.jsx(Eee,{client:m,patient:f,encounter:h,children:m.name})}),a.jsx(ge,{children:m.description})]},m.id))]})}function boe(e){return e==="Patient"||e==="Encounter"}function Soe(){const{resourceType:e,id:t}=Yt(),n=Fn(),[r,i]=v.useState({resourceType:"AuditEvent",filters:[{code:"entity",operator:fe.EQUALS,value:`${e}/${t}`}],fields:["id","outcome","outcomeDesc","_lastUpdated"],sortRules:[{code:"-_lastUpdated"}],count:20});return a.jsx(lt,{children:a.jsx(ql,{search:r,onClick:s=>n(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onChange:s=>i(s.definition),hideFilters:!0})})}function joe(){const e=Re(),{resourceType:t,id:n}=Yt(),r=e.readHistory(t,n).read();return a.jsx(gf,{maw:1200,children:a.jsx(Os,{children:a.jsx(pee,{history:r})})})}const woe="_hl7Input_k5xm3_1",Coe={hl7Input:woe};function Eoe(e){return a.jsx("iframe",{title:"Bot Runner",frameBorder:"0",src:"https://codeeditor.medplum.com/bot-runner.html",className:e.className,ref:e.iframeRef,"data-testid":e.testId,style:{width:"100%",height:"100%",minHeight:e.minHeight}})}function Toe(e){const t=e.defaultValue,n=new URL(`https://codeeditor.medplum.com/${e.language}-editor.html`);return e.module&&n.searchParams.set("module",e.module),a.jsx("iframe",{title:"Code Editor",frameBorder:"0",src:n.toString(),style:{width:"100%",height:"100%",minHeight:e.minHeight},ref:e.iframeRef,"data-testid":e.testId,onLoad:r=>{kd(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const Roe=`{
225
+ "resourceType": "Patient",
226
+ "name": [
227
+ {
228
+ "given": [
229
+ "Alice"
230
+ ],
231
+ "family": "Smith"
232
+ }
233
+ ]
234
+ }`,_oe="MSH|^~\\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT|MSG00001|P|2.1\rPID|||PATID1234^5^M11||JONES^WILLIAM^A^III||19610615|M-||C|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434||S||PATID12345001^2^M10|123456789|987654^NC\rNK1|1|JONES^BARBARA^K|SPO|||||20011105\rPV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||-||1|A0-";function Doe(){const e=Re(),{id:t}=Yt(),[n,r]=v.useState(),[i,s]=v.useState(),[c,u]=v.useState(),[f,h]=v.useState(Roe),[m,g]=v.useState(_oe),[y,x]=v.useState(tn.FHIR_JSON),S=v.useRef(null),w=v.useRef(null),[C,T]=v.useState(!1);v.useEffect(()=>{e.readResource("Bot",t).then(async A=>{r(A),s(A.runtimeVersion==="vmcontext"?"commonjs":"esnext"),u(await Aoe(e,A))}).catch(A=>Ae({color:"red",message:We(A),autoClose:!1}))},[e,t]);const R=v.useCallback(async()=>kd(S.current,{command:"getValue"}),[]),E=v.useCallback(async()=>kd(S.current,{command:"getOutput"}),[]),_=v.useCallback(async()=>y===tn.FHIR_JSON?JSON.parse(f):m,[y,f,m]),P=v.useCallback(async A=>{A.preventDefault(),A.stopPropagation(),T(!0);try{const z=await R(),U=await E(),K=await e.createAttachment({data:z,filename:"index.ts",contentType:tn.TYPESCRIPT}),W=await e.createAttachment({data:U,filename:i==="commonjs"?"index.cjs":"index.mjs",contentType:tn.JAVASCRIPT}),ee=[{op:"add",path:"/sourceCode",value:K},{op:"add",path:"/executableCode",value:W}];await e.patchResource("Bot",t,ee),Ae({color:"green",message:"Saved"})}catch(z){Ae({color:"red",message:We(z),autoClose:!1})}finally{T(!1)}},[e,t,i,R,E]),O=v.useCallback(async A=>{A.preventDefault(),A.stopPropagation(),T(!0);try{await e.post(e.fhirUrl("Bot",t,"$deploy")),Ae({color:"green",message:"Deployed"})}catch(z){Ae({color:"red",message:We(z),autoClose:!1})}finally{T(!1)}},[e,t]),k=v.useCallback(async A=>{A.preventDefault(),A.stopPropagation(),T(!0);try{const z=await _(),U=await e.post(e.fhirUrl("Bot",t,"$execute"),z,y);await kd(w.current,{command:"setValue",value:U}),Ae({color:"green",message:"Success"})}catch(z){Ae({color:"red",message:We(z),autoClose:!1})}finally{T(!1)}},[e,t,_,y]);return!n||c===void 0?null:a.jsxs(Nt,{m:0,gutter:0,style:{overflow:"hidden"},children:[a.jsx(Nt.Col,{span:8,children:a.jsxs(gr,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(Toe,{iframeRef:S,language:"typescript",module:i,testId:"code-frame",defaultValue:c,minHeight:"528px"}),a.jsxs(xe,{justify:"flex-end",gap:"xs",children:[a.jsx(Me,{type:"button",onClick:P,loading:C,leftSection:a.jsx(aG,{size:"1rem"}),children:"Save"}),a.jsx(Me,{type:"button",onClick:O,loading:C,leftSection:a.jsx(OS,{size:"1rem"}),children:"Deploy"}),a.jsx(Me,{type:"button",onClick:k,loading:C,leftSection:a.jsx(ZG,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(Nt.Col,{span:4,children:[a.jsxs(gr,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(pn,{data:[{label:"FHIR",value:tn.FHIR_JSON},{label:"HL7",value:tn.HL7_V2}],onChange:A=>x(A.currentTarget.value)}),y===tn.FHIR_JSON?a.jsx(vu,{value:f,onChange:A=>h(A),autosize:!0,minRows:15}):a.jsx("textarea",{className:Coe.hl7Input,value:m,onChange:A=>g(A.currentTarget.value),rows:15})]}),a.jsx(gr,{m:2,p:"xs",shadow:"md",children:a.jsx(Eoe,{iframeRef:w,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function Aoe(e,t){if(t.sourceCode?.url){const n=t.sourceCode.url?.split("/")?.find(mS);return(await e.download(e.fhirUrl("Binary",n))).text()}return t.code??""}function Cs(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function koe(){const e=Re(),{resourceType:t,id:n}=Yt(),r={reference:t+"/"+n},i=v.useCallback(s=>{e.updateResource(Cs(s)).then(()=>{Ae({color:"green",message:"Success"})}).catch(c=>{Ae({color:"red",message:We(c),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(lt,{children:a.jsx(fZ,{value:r,onSubmit:i})});case"Questionnaire":return a.jsx(lt,{children:a.jsx(AZ,{questionnaire:r,onSubmit:i})});default:return null}}function Poe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t}),r=Fn();return n?a.jsx(lt,{children:a.jsx(KZ,{value:n,onStart:(i,s)=>r(`/forms/${bs(s)}`)?.catch(console.error),onEdit:(i,s,c)=>r(`/${c.reference}}`)?.catch(console.error)})}):null}function Noe(){const e=Re(),{resourceType:t,id:n}=Yt(),r=Fn();return a.jsxs(lt,{children:[a.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),a.jsx(Me,{color:"red",onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)?.catch(console.error)).catch(i=>Ae({color:"red",message:We(i),autoClose:!1}))},children:"Delete"})]})}const Ooe="_selectProfileBtn_tbaz6_1",Moe="_chevron_tbaz6_13",V_={selectProfileBtn:Ooe,chevron:Moe};function Loe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t}),[r,i]=v.useState(),s=$l({onDropdownClose:()=>s.resetSelectedOption()}),c=v.useMemo(()=>{if(In(n?.meta?.profile))return[a.jsx(Ye.Option,{value:"",children:"None"},""),...n.meta.profile.map(f=>a.jsx(Ye.Option,{value:f,children:f},f))]},[n?.meta?.profile]);if(v.useEffect(()=>{n?.meta?.profile?.length===1&&i(n.meta.profile[0])},[n?.meta?.profile]),!n)return null;let u;return In(c)&&(u=a.jsx(xe,{justify:"flex-end",children:a.jsxs(Ne,{align:"flex-end",gap:"xs",children:[a.jsxs(Ye,{store:s,width:250,position:"bottom-end",withinPortal:!1,onOptionSubmit:f=>{i(f),s.closeDropdown()},children:[a.jsx(Ye.Target,{children:a.jsx(An,{onClick:()=>s.toggleDropdown(),children:a.jsxs(mf,{fw:"bold",fs:"sm",className:V_.selectProfileBtn,children:[a.jsx("span",{children:"Pick profile"}),a.jsx(NS,{stroke:1.5,className:V_.chevron})]})})}),a.jsx(Ye.Dropdown,{w:"max-content",children:a.jsx(Ye.Options,{children:c})})]}),a.jsx(le,{children:r?a.jsxs(a.Fragment,{children:[a.jsx(ge,{span:!0,size:"sm",c:"dimmed",children:"Displaying profile: "}),a.jsx(ge,{span:!0,size:"sm",children:r||"Nothing selected"})]}):a.jsx(ge,{span:!0,size:"sm",c:"dimmed",children:"No profile displayed"})})]})})),a.jsx(lt,{children:a.jsxs(Ne,{gap:"xl",children:[u,a.jsx(t1,{value:n,profileUrl:r})]})})}function Ioe(){const e=Re(),{resourceType:t,id:n}=Yt(),[r,i]=v.useState(),[s,c]=v.useState(),u=Fn(),[f,h]=v.useState();v.useEffect(()=>{e.readResource(t,n).then(x=>{i(gi(x)),c(gi(x))}).catch(x=>{h(rn(x)),Ae({color:"red",message:We(x),autoClose:!1})})},[e,t,n]);const m=v.useCallback(x=>{h(void 0),e.updateResource(Cs(x)).then(()=>{u(`/${t}/${n}/details`)?.catch(console.error),Ae({id:"succes",color:"green",message:"Success"})}).catch(S=>{h(rn(S)),Ae({color:"red",message:We(S),autoClose:!1})})},[e,t,n,u]),g=v.useCallback(x=>{h(void 0);const S=tN.createPatch(r,Cs(x));e.patchResource(t,n,S).then(()=>{u(`/${t}/${n}/details`)?.catch(console.error),Ae({id:"succes",color:"green",message:"Success"})}).catch(w=>{h(rn(w)),Ae({color:"red",message:We(w),autoClose:!1})})},[e,t,n,r,u]),y=v.useCallback(()=>u(`/${t}/${n}/delete`)?.catch(console.error),[u,t,n]);return s?a.jsx(lt,{children:a.jsx(nm,{defaultValue:s,onSubmit:m,onPatch:g,onDelete:y,outcome:f})}):null}function zoe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?a.jsx(lt,{maw:700,children:n.resourceType==="Patient"?a.jsx(aZ,{patient:n}):a.jsx(qo,{icon:a.jsx(Ns,{size:16}),title:"Unsupported export type",color:"red",children:"This page is only supported for Patient resources"})}):null}function mO({resource:e,currentProfile:t,onChange:n}){const r=e.resourceType,i=Re(),[s,c]=v.useState();return v.useEffect(()=>{i.searchResources("StructureDefinition",{type:r,derivation:"constraint",_count:50}).then(u=>{c(u.filter(rK))}).catch(console.error)},[i,n,r]),a.jsx(bn,{value:t?.url,onChange:u=>{const f=s?.find(h=>h.url===u);f&&n(f)},children:a.jsx(bn.List,{children:s?.map(u=>{const f=e.meta?.profile?.includes(u.url),h=f?"This profile is present in this resource's meta.profile property.":"This profile is not included in this resource's meta.profile property.";return a.jsx(bn.Tab,{value:u.url,title:h,rightSection:f&&a.jsx(sS,{variant:"outline",color:"green",size:"xs",style:{borderStyle:"none"},children:a.jsx(NW,{size:"90%"})}),children:u.title||u.name},u.url)})})})}function gO(e,t){const n=Re(),r=Fn();return{defaultValue:{resourceType:e},handleSubmit:c=>{t&&t(void 0),n.createResource(c).then(u=>r("/"+u.resourceType+"/"+u.id)).catch(u=>{t&&t(rn(u)),Ae({color:"red",message:We(u),autoClose:!1,styles:{description:{whiteSpace:"pre-line"}}})})}}}function Tx(){const{resourceType:e}=Yt(),t=Fr(),[n,r]=v.useState(),{defaultValue:i,handleSubmit:s}=gO(e,r),[c,u]=v.useState(),f=t.pathname.toLowerCase().endsWith("profiles"),h=v.useCallback(m=>{const g=Cs(m);c&&Ck(g,c.url),s(g)},[c,s]);return f?a.jsx(lt,{children:a.jsxs(Ne,{children:[a.jsx(mO,{resource:i,currentProfile:c,onChange:u}),c?a.jsx(nm,{defaultValue:i,onSubmit:h,outcome:n,profileUrl:c.url},c.url):a.jsx(ge,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})}):a.jsx(lt,{children:a.jsx(nm,{defaultValue:i,onSubmit:s,outcome:n})})}function F_(){const e=Re(),{resourceType:t,id:n}=Yt(),r=e.readHistory(t,n).read();return a.jsx(lt,{children:a.jsx(See,{history:r})})}function $oe(){const{resourceType:e}=Yt(),[t,n]=v.useState(),{defaultValue:r,handleSubmit:i}=gO(e,n),s=v.useCallback(c=>{i(JSON.parse(c["new-resource"]))},[i]);return a.jsxs(lt,{children:[t&&a.jsx(xr,{outcome:t}),a.jsxs(pt,{onSubmit:s,children:[a.jsx(vu,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:fo(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Me,{type:"submit",children:"OK"})})]})]})}function Uoe(){const e=Re(),{resourceType:t,id:n}=Yt(),r=Wt({reference:t+"/"+n}),i=Fn(),[s,c]=v.useState(),u=v.useCallback(f=>{e.updateResource(Cs(JSON.parse(f.resource))).then(()=>{c(void 0),i(`/${t}/${n}/details`)?.catch(console.error),Ae({color:"green",message:"Success"})}).catch(h=>{Ae({color:"red",message:We(h),autoClose:!1})})},[e,t,n,i]);return r?a.jsxs(lt,{children:[s&&a.jsx(xr,{outcome:s}),a.jsxs(pt,{onSubmit:u,children:[a.jsx(vu,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:fo(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Me,{type:"submit",children:"OK"})})]})]}):null}function Boe(e){const{resourceType:t,id:n}=e;return a.jsxs(lt,{children:[a.jsxs(qo,{icon:a.jsx(Ns,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx(wt,{href:`/forms/${n}`,children:`/forms/${n}`})]}),a.jsx(QP,{questionnaire:{reference:t+"/"+n},onSubmit:()=>alert("You submitted the preview")})]})}const Voe="_propertyTable_1xts4_1",Foe="_propertiesTitle_1xts4_17",vO={propertyTable:Voe,propertiesTitle:Foe};function Hoe(e){return e.valueCode||e.valueString||(e.valueBoolean===void 0?void 0:String(e.valueBoolean))||(e.valueInteger===void 0?void 0:String(e.valueInteger))||(e.valueDecimal===void 0?void 0:String(e.valueDecimal))||e.valueDate||e.valueDateTime||"N/A"}function qoe(e){const{properties:t}=e,n=t.map(r=>{let i="",s="",c="";return r.part?.forEach(u=>{u.name==="code"?i=u.valueCode||"":u.name==="description"?s=u.valueString||"":u.name==="value"&&(c=Hoe(u))}),{code:i,description:s,value:c}});return a.jsxs(Z,{className:vO.propertyTable,children:[a.jsx(Z.Thead,{children:a.jsxs(Z.Tr,{children:[a.jsx(Z.Th,{children:"Code"}),a.jsx(Z.Th,{children:"Description"}),a.jsx(Z.Th,{children:"Value"})]})}),a.jsx(Z.Tbody,{children:n.map((r,i)=>a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:r.code}),a.jsx(Z.Td,{children:r.description}),a.jsx(Z.Td,{children:r.value})]},`property-${i}`))})]})}function Goe(e){const{valueSet:t}=e,n=Re(),r=t.url,[i,s]=v.useState(),[c,u]=v.useState(),[f,h]=v.useState(!1),[m,g]=v.useState(),y=v.useCallback(async w=>{if(s(w),u(void 0),g(void 0),!w?.code||!w?.system){h(!1);return}h(!0);try{const C=new URLSearchParams({system:w.system,code:w.code}),T=n.fhirUrl("CodeSystem","$lookup")+"?"+C.toString(),R=await n.get(T);u(R)}catch(C){g(C instanceof Error?C:new Error(String(C)))}finally{h(!1)}},[n]),x=v.useMemo(()=>c?.parameter?.filter(w=>w.name==="property"&&w.part)??[],[c]),S=x.length>0;return a.jsx(lt,{children:a.jsxs(Ne,{gap:"xl",children:[a.jsx(Af,{binding:r,placeholder:"Select a value from the ValueSet",onChange:w=>y(w[0]),defaultValue:i,maxValues:1}),i?a.jsxs(Ne,{gap:"md",children:[a.jsxs(Pf,{children:[a.jsx(Ur,{term:"Code",children:i.code}),i.system&&a.jsx(Ur,{term:"System",children:i.system}),i.display&&a.jsx(Ur,{term:"Display",children:i.display})]}),f&&a.jsxs(xe,{gap:"xs",children:[a.jsx(Pr,{size:"sm"}),a.jsx(ge,{size:"sm",c:"dimmed",children:"Loading properties..."})]}),!f&&m&&a.jsxs(qo,{icon:a.jsx(Ns,{size:16}),title:"Lookup Failed",color:"red",children:["Failed to retrieve code information: ",We(m)]}),!f&&!m&&S&&a.jsx(zS,{children:a.jsxs(Ne,{gap:"xs",mt:"lg",children:[a.jsx(ge,{fw:500,size:"sm",c:"dimmed",className:vO.propertiesTitle,children:"Properties"}),a.jsx(qoe,{properties:x})]})})]}):null]})})}function Woe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?n.resourceType==="Questionnaire"?a.jsx(Boe,{resourceType:e,id:t}):n.resourceType==="ValueSet"?a.jsx(Goe,{valueSet:n}):null:null}function Qoe(){const e=Re(),{resourceType:t,id:n}=Yt(),[r,i]=v.useState(),[s,c]=v.useState();return v.useEffect(()=>{e.readResource(t,n).then(u=>i(gi(u))).catch(u=>{Ae({color:"red",message:We(u)})})},[e,t,n]),r?a.jsxs(lt,{children:[a.jsxs(ze,{order:2,children:["Available ",t," profiles"]}),a.jsx(Ne,{children:a.jsxs(a.Fragment,{children:[a.jsx(mO,{resource:r,currentProfile:s,onChange:c}),s?a.jsx(Yoe,{profile:s,resource:r,onResourceUpdated:u=>i(u)},s.url):a.jsx(ge,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const Yoe=({profile:e,resource:t,onResourceUpdated:n})=>{const r=Re(),[i,s]=v.useState(),[c,u]=v.useState(()=>t.meta?.profile?.includes(e.url)),f=v.useCallback(h=>{s(void 0);const m=Cs(h);c?Ck(m,e.url):QB(m,e.url),r.updateResource(m).then(g=>{n(g),Ae({color:"green",message:"Success"})}).catch(g=>{s(rn(g)),Ae({color:"red",message:We(g),autoClose:!1})})},[r,e.url,n,c]);return a.jsxs(Ne,{children:[a.jsx(bf,{size:"md",checked:c,label:`Conform resource to ${e.title}`,onChange:h=>u(h.currentTarget.checked),"data-testid":"profile-toggle"}),c?a.jsx(nm,{profileUrl:e.url,defaultValue:t,onSubmit:f,outcome:i}):a.jsx("form",{noValidate:!0,onSubmit:h=>{h.preventDefault(),f(t)},children:a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Me,{type:"submit",children:"OK"})})})]})},yO={"Create Only":"create","Update Only":"update","Delete Only":"delete","All Interactions":void 0},Koe=Object.keys(yO);function Xoe(){const e=Re(),{id:t}=Yt(),n=Wt({reference:`Questionnaire/${t}`}),[r,i]=v.useState(),[s,c]=v.useState("create"),[u,f]=v.useState(0),h=e.searchResources("Subscription","status=active&_count=100").read().filter(g=>Joe(g,n));function m(){r&&n&&e.createResource({resourceType:"Subscription",status:"active",reason:`Connect bot ${r.name} to questionnaire responses`,criteria:`QuestionnaireResponse?questionnaire=${n.url?`${n.url},${$t(n)}`:$t(n)}`,channel:{type:"rest-hook",endpoint:$t(r)},...s?{extension:[{url:"https://medplum.com/fhir/StructureDefinition/subscription-supported-interaction",valueCode:s}]}:void 0}).then(()=>{i(void 0),f(Date.now()),e.invalidateSearches("Subscription"),Ae({color:"green",message:"Success"})}).catch(g=>Ae({color:"red",message:We(g),autoClose:!1}))}return a.jsxs(lt,{children:[a.jsx(ze,{children:"Bots"}),a.jsxs(Ne,{children:[h.length===0&&a.jsx("p",{children:"No bots found."}),h.map(g=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Hl,{value:{reference:g.channel?.endpoint},link:!0})}),a.jsxs("p",{children:["Criteria: ",g.criteria]})]},g.id))]}),a.jsx(dn,{}),a.jsxs(Ne,{mt:10,children:[a.jsx(cf,{size:"lg",htmlFor:"bot",children:"Connect to bot"}),a.jsxs(xe,{children:[a.jsx(Eu,{name:"bot",resourceType:"Bot",onChange:g=>i(g)}),a.jsx(Me,{onClick:m,children:"Connect"})]}),a.jsx(xe,{children:a.jsx(pn,{name:"subscription-trigger-event",defaultValue:"Create Only",label:"Subscription Trigger Event",data:Koe,onChange:g=>c(yO[g.target.value])})})]}),a.jsx("div",{style:{display:"none"},children:u})]})}function Joe(e,t){if(!t)return!1;const n=e.criteria||"",r=e.channel?.endpoint||"";return n.startsWith("QuestionnaireResponse?")&&r.startsWith("Bot/")&&(n.includes($t(t))||(t.url?n.includes(t.url):!1))}function Zoe(){const{id:e}=Yt(),t=Fn(),r=Re().readReference({reference:`Questionnaire/${e}`}).read(),[i,s]=v.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:fe.EQUALS,value:r.url?`${r.url},Questionnaire/${e}`:`Questionnaire/${e}`}],fields:["id","_lastUpdated"]});return a.jsx(lt,{children:a.jsx(ql,{search:i,onClick:c=>t(`/${c.resource.resourceType}/${c.resource.id}`)?.catch(console.error),onChange:c=>s(c.definition),hideFilters:!0,hideToolbar:!0})})}function eae(){const e=Re(),{resourceType:t,id:n}=Yt(),r=Wt({reference:t+"/"+n}),i=v.useCallback(s=>{e.updateResource(Cs(s)).then(()=>{Ae({color:"green",message:"Success"})}).catch(c=>{Ae({color:"red",message:We(c),autoClose:!1})})},[e]);return r?a.jsx(lt,{children:a.jsx(VZ,{onSubmit:i,definition:r})}):null}function tae(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?a.jsx(lt,{children:e==="MeasureReport"?a.jsx(iZ,{measureReport:n}):a.jsx(e1,{value:n})}):null}const nae="_container_1ue98_1",rae="_entry_1ue98_14",iae="_active_1ue98_21",Rx={container:nae,entry:rae,active:iae};function oae(e){const t=Re(),n=Wt(e.value),[r,i]=v.useState();return v.useEffect(()=>{if(!n)return;const s=g1(n);if(!s)return;const c="reference"in s?s.reference:$t(s);t.search("ServiceRequest","subject="+c).then(u=>{const h=(u.entry??[]).map(m=>m.resource);nN(h),h.reverse(),i(h)}).catch(u=>Ae({color:"red",message:We(u),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:Rx.container,children:r.map(s=>a.jsxs("div",{className:Ft(Rx.entry,{[Rx.active]:s.id===n?.id}),children:[a.jsx("p",{children:a.jsx(jt,{to:s,children:aae(s)})}),s.category?.[0]?.text&&a.jsx("p",{children:s.category[0]?.text}),s.code?.coding?.[0]?.code&&a.jsx("p",{children:s.code.coding[0]?.code}),a.jsx("p",{children:sae(s)})]},s.id))}):null}function aae(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function sae(e){return e.authoredOn?e.authoredOn.substring(0,10):e.meta?.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const lae="_container_1l2dh_1",cae={container:lae};function uae(e){const t=Wt(e.valueSet);if(!t)return null;const n=[""],r=t.compose?.include?.[0]?.concept?.map(i=>i.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),a.jsx("div",{className:cae.container,children:a.jsx(pn,{defaultValue:e.defaultValue,onChange:i=>e.onChange(i.currentTarget.value),data:n})})}function dae(e){const t=Wt(e.specimen);return t?a.jsxs(vt,{children:[a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Type"}),a.jsx(vt.Value,{children:"Specimen"})]}),a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Collected"}),a.jsx(vt.Value,{children:Nr(t.collection?.collectedDateTime)})]}),a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Specimen Age"}),a.jsx(vt.Value,{children:fae(t)})]}),t.collection?.collectedDateTime&&t.receivedTime?a.jsxs(vt.Entry,{children:[a.jsx(vt.Key,{children:"Specimen Stability"}),a.jsx(vt.Value,{children:hae(t)})]}):a.jsx(a.Fragment,{})]}):null}function fae(e){const t=e.collection?.collectedDateTime;if(!t)return;const n=new Date(t);return xO(bO(n,new Date))}function hae(e){if(!e.collection?.collectedDateTime||!e.receivedTime)return;const t=new Date(e.collection.collectedDateTime),n=new Date(e.receivedTime);return xO(bO(t,n))}function xO(e){return e.toString().padStart(3,"0")+"D"}function bO(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function pae(e){const t=["Timeline"];return e==="Bot"&&t.push("Editor","Subscriptions"),e==="PlanDefinition"&&t.push("Apply","Builder"),e==="Questionnaire"&&t.push("Preview","Builder","Bots","Responses"),e==="ValueSet"&&t.push("Preview"),(e==="DiagnosticReport"||e==="MeasureReport")&&t.push("Report"),e==="RequestGroup"&&t.push("Checklist"),e==="ObservationDefinition"&&t.push("Ranges"),e==="Agent"&&t.push("Tools"),t.push("Details","Edit","Event","History","Blame","JSON","Apps","Profiles"),e==="Patient"&&t.push("Export"),t}function mae(){const e=Re(),{resourceType:t,id:n}=Yt(),r={reference:t+"/"+n},[i,s]=v.useState(),c=Wt(r,s),u=pae(t);async function f(){const w=(await e.readHistory(t,n)).entry?.find(C=>!!C.resource)?.resource;w?h(w):Ae({color:"red",message:"No history to restore",autoClose:!1})}function h(S){e.updateResource(Cs(S)).then(()=>{s(void 0),Ae({color:"green",message:"Success"})}).catch(w=>{Ae({color:"red",message:We(w),autoClose:!1})})}if(i)return oU(i)?a.jsxs(lt,{children:[a.jsx(ze,{children:"Deleted"}),a.jsx("p",{children:"The resource was deleted."}),a.jsx(Me,{color:"red",onClick:f,children:"Restore"})]}):a.jsx(xr,{outcome:i});function m(S){const w=c,C=w.orderDetail||[];C.length===0&&C.push({}),C[0].text!==S&&(C[0].text=S,h({...w,orderDetail:C}))}const g=c&&g1(c),y=c&&ire(c),x=e.getUserConfiguration()?.option?.find(S=>S.id==="statusValueSet")?.valueString;return a.jsxs(a.Fragment,{children:[c?.resourceType==="ServiceRequest"&&x&&a.jsx(uae,{valueSet:{reference:x},defaultValue:c.orderDetail?.[0]?.text,onChange:m},$t(c)+"-"+c.orderDetail?.[0]?.text),c&&a.jsx(oae,{value:c}),c&&a.jsxs(gr,{children:[g&&a.jsx(dN,{patient:g}),y&&a.jsx(dae,{specimen:y}),t!=="Patient"&&a.jsx(fO,{resource:r}),a.jsx(ti,{children:a.jsx(Of,{baseUrl:`/${t}/${n}`,tabs:u})})]}),a.jsx(h1,{})]})}function vp(){const e=Fn(),{resourceType:t,id:n,versionId:r,tab:i}=Yt(),s=Re(),[c,u]=v.useState(!0),[f,h]=v.useState(),[m,g]=v.useState();if(v.useEffect(()=>{g(void 0),u(!0),s.readHistory(t,n).then(E=>h(E)).then(()=>u(!1)).catch(E=>{g(E),u(!1)})},[s,t,n]),c)return a.jsx(Ui,{});const y=f?.entry??[],x=y.findIndex(E=>E.resource?.meta?.versionId===r);if(x===-1)return a.jsxs(lt,{children:[a.jsx(ze,{children:"Version not found"}),a.jsx(jt,{to:`/${t}/${n}`,children:"Return to resource"})]});const S=y[x].resource,w=x<y.length-1?y[x+1].resource:void 0,C="diff",T=i||C,R=y.length-x;return a.jsx(gf,{maw:1200,children:a.jsx(Os,{children:a.jsxs(Ne,{gap:"lg",children:[m&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)}),a.jsxs(qm,{cols:2,mb:"lg",children:[a.jsx(qi,{total:y.length,value:R,getControlProps:sN,onChange:E=>e(`/${t}/${n}/_history/${y[y.length-E]?.resource?.meta?.versionId}/${T}`)?.catch(console.error)}),a.jsx(xe,{justify:"right",children:a.jsx(Cl,{data:[{value:"diff",label:"Diff"},{value:"raw",label:"Raw"}],value:T,onChange:E=>e(`/${t}/${n}/_history/${r}/${E||C}`)?.catch(console.error)})})]}),a.jsx(le,{mb:"lg",children:a.jsxs(Pf,{compact:!0,children:[a.jsx(Ur,{term:"Version ID",children:S.meta?.versionId}),a.jsx(Ur,{term:"Author",children:a.jsx(Pd,{value:S.meta?.author,link:!0},S.meta?.author?.reference)}),a.jsx(Ur,{term:"Date/Time",children:Nr(S.meta?.lastUpdated)})]})}),T==="diff"&&a.jsx(vee,{original:w??{resourceType:t,id:n},revised:S}),T==="raw"&&a.jsx("pre",{style:{fontSize:"9pt"},children:JSON.stringify(S,void 0,2)})]})})})}function gae(){const{resourceType:e,id:t}=Yt(),n=Fn(),[r,i]=v.useState({resourceType:"Subscription",filters:[{code:"url",operator:fe.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(lt,{children:a.jsx(ql,{search:r,onClick:s=>n(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onChange:s=>i(s.definition),hideFilters:!0})})}function vae(e){const t=Re(),{resource:n,opened:r,onClose:i}=e,[s,c]=v.useState(!1),[u,f]=v.useState(),[h,m]=v.useState(!1),g=v.useCallback(async()=>{if(n?.id)try{await t.post(t.fhirUrl(n.resourceType,n.id,"$resend"),{subscription:s&&u?$t(u):void 0,verbose:h}),Ae({color:"green",message:"Done"}),i()}catch(y){Ae({color:"red",message:We(y),autoClose:!1})}},[t,n,i,s,u,h]);return a.jsx(Mn,{opened:r,onClose:i,title:"Resend Subscriptions",children:a.jsx(pt,{onSubmit:g,children:a.jsxs(Ne,{children:[a.jsx(fn,{label:"Choose subscription (all subscriptions by default)",onChange:y=>c(y.currentTarget.checked)}),s&&a.jsx(Eu,{name:"subscription",resourceType:"Subscription",placeholder:"Subscription",onChange:f}),a.jsx(fn,{label:"Verbose mode",onChange:y=>m(y.currentTarget.checked)}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Me,{type:"submit",children:"Resend"})})]})})})}function H_(){const e=Re(),t=ju(),{resourceType:n,id:r}=Yt(),i={reference:n+"/"+r},[s,c]=v.useState(),u=Ts(!1);function f(R,E){return e.updateResource({...R,priority:E})}function h(R,E){f(R,"stat").then(E).catch(console.error)}function m(R,E){f(R,"routine").then(E).catch(console.error)}function g(R){t(`/${R.resourceType}/${R.id}`)}function y(R){t(`/${R.resourceType}/${R.id}/edit`)}function x(R){t(`/${R.resourceType}/${R.id}/delete`)}function S(R){c(R),u[1].open()}function w(R){t(`/${R.resourceType}/${R.id}/_history/${R.meta?.versionId}`)}function C(R,E){const _="aws-textract";Ae({id:_,title:"AWS Textract in Progress",message:"Extracting text... This may take a moment...",loading:!0,autoClose:!1}),e.post(e.fhirUrl(R.resourceType,R.id,"$aws-textract"),{}).then(()=>{E(),hl({id:_,title:"AWS Textract Successful",message:"Text successfully extracted.",color:"green",icon:a.jsx(Go,{size:"1rem"}),loading:!1,withCloseButton:!0})}).catch(P=>hl({id:_,title:"AWS Textract Error",color:"red",message:We(P),icon:a.jsx(ws,{size:"1rem"}),loading:!1,withCloseButton:!0}))}function T(R){const{primaryResource:E,currentResource:_,reloadTimeline:P}=R,O=_.resourceType===E.resourceType&&_.id===E.id,k=_.resourceType==="Communication"&&_.priority!=="stat",A=_.resourceType==="Communication"&&_.priority==="stat",z=O,U=!O,K=!O,W=!O,ee=e.getProjectMembership()?.admin,B=ee,G=hoe()&&(_.resourceType==="DocumentReference"||_.resourceType==="Media");return a.jsxs(be.Dropdown,{children:[a.jsx(be.Label,{children:"Resource"}),k&&a.jsx(be.Item,{leftSection:a.jsx(YG,{size:14}),onClick:()=>h(_,P),"aria-label":`Pin ${$t(_)}`,children:"Pin"}),A&&a.jsx(be.Item,{leftSection:a.jsx(XG,{size:14}),onClick:()=>m(_,P),"aria-label":`Unpin ${$t(_)}`,children:"Unpin"}),U&&a.jsx(be.Item,{leftSection:a.jsx(uR,{size:14}),onClick:()=>g(_),"aria-label":`Details ${$t(_)}`,children:"Details"}),z&&a.jsx(be.Item,{leftSection:a.jsx(uR,{size:14}),onClick:()=>w(_),"aria-label":`Details ${$t(_)}`,children:"Details"}),K&&a.jsx(be.Item,{leftSection:a.jsx(oP,{size:14}),onClick:()=>y(_),"aria-label":`Edit ${$t(_)}`,children:"Edit"}),ee&&a.jsxs(a.Fragment,{children:[a.jsx(be.Divider,{}),a.jsx(be.Label,{children:"Admin"}),B&&a.jsx(be.Item,{leftSection:a.jsx(aW,{size:14}),onClick:()=>S(_),"aria-label":`Resend Subscriptions ${$t(_)}`,children:"Resend Subscriptions"})]}),G&&a.jsxs(a.Fragment,{children:[a.jsx(be.Divider,{}),a.jsx(be.Label,{children:"AWS AI"}),a.jsx(be.Item,{leftSection:a.jsx(CW,{size:14}),onClick:()=>C(_,P),"aria-label":`AWS Textract ${$t(_)}`,children:"AWS Textract"})]}),W&&a.jsxs(a.Fragment,{children:[a.jsx(be.Divider,{}),a.jsx(be.Label,{children:"Danger zone"}),a.jsx(be.Item,{color:"red",leftSection:a.jsx(rg,{size:14}),onClick:()=>x(_),"aria-label":`Delete ${$t(_)}`,children:"Delete"})]})]})}return a.jsxs(a.Fragment,{children:[n==="Encounter"&&a.jsx(GX,{encounter:i,getMenu:T}),n==="Patient"&&a.jsx(cZ,{patient:i,getMenu:T}),n==="ServiceRequest"&&a.jsx(Cee,{serviceRequest:i,getMenu:T}),n!=="Encounter"&&n!=="Patient"&&n!=="ServiceRequest"&&a.jsx(qX,{resource:i,getMenu:T}),a.jsx(vae,{resource:s,opened:u[0],onClose:u[1].close},`resend-subscriptions-${s?.id}`)]})}function yae(e){const{opened:t,close:n,version:r,loadingStatus:i,handleStatus:s,handleUpgrade:c}=e,[u,f]=v.useState(),[h,m]=v.useState(!1);return v.useEffect(()=>{t&&(u||AH("app-tools-page").then(f).catch(console.error),s())},[t,u,s]),u&&r&&!i?r==="unknown"?a.jsx("p",{children:"Unable to determine the current version of the agent. Check the network connectivity of the agent."}):r.startsWith(u)?a.jsxs("p",{children:["This agent is already on the latest version (",u,")."]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["Are you sure you want to upgrade this agent from version ",r," to version ",u,"?"]}),a.jsxs(xe,{children:[a.jsx(Me,{onClick:()=>{c(h),n()},"aria-label":"Confirm upgrade",children:"Confirm Upgrade"}),a.jsx(fn,{label:"Force",onChange:g=>m(g.currentTarget.checked)})]})]}):a.jsx(Ui,{})}function xae(){const e=Re(),{id:t}=Yt(),n=v.useMemo(()=>({reference:"Agent/"+t}),[t]),[r,i]=v.useState(!1),[s,c]=v.useState(!1),[u,f]=v.useState(!1),[h,m]=v.useState(!1),[g,y]=v.useState(),[x,S]=v.useState(),[w,C]=v.useState(),[T,R]=v.useState(),[E,_]=v.useState(!1),[P,O]=v.useState(!1),[k,A]=v.useState(),[z,{open:U,close:K}]=Ts(!1);v.useEffect(()=>{if(r||s||u||E){O(!0);return}O(!1)},[r,s,u,E]);const W=v.useCallback(()=>{i(!0),e.get(e.fhirUrl("Agent",t,"$status"),{cache:"reload"}).then(V=>{y(V.parameter?.find(X=>X.name==="status")?.valueCode),S(V.parameter?.find(X=>X.name==="version")?.valueString),C(V.parameter?.find(X=>X.name==="lastUpdated")?.valueInstant)}).catch(V=>$(We(V))).finally(()=>i(!1))},[e,t]),ee=v.useCallback(V=>{const X=V.host,M=V.pingCount||1;X&&(_(!0),e.pushToAgent(n,X,`PING ${M}`,tn.PING,!0).then(F=>R(F)).catch(F=>$(We(F))).finally(()=>_(!1)))},[e,n]),B=v.useCallback(()=>{c(!0),e.get(e.fhirUrl("Agent",t,"$reload-config"),{cache:"reload"}).then(V=>{I("Agent config reloaded successfully.")}).catch(V=>$(We(V))).finally(()=>c(!1))},[e,t]),G=v.useCallback(V=>{f(!0);const X=e.fhirUrl("Agent",t,"$upgrade");X.searchParams.set("force",String(V)),e.get(X,{cache:"reload"}).then(M=>{I("Agent upgraded successfully.")}).catch(M=>$(We(M))).finally(()=>f(!1))},[e,t]),L=v.useCallback(V=>{m(!0);const X=V.logLimit||20;e.get(e.fhirUrl("Agent",t,`$fetch-logs${X!==void 0?`?limit=${X}`:""}`),{cache:"reload"}).then(M=>{const F=M?.parameter?.find(ie=>ie.name==="logs");F&&A(F?.valueString)}).catch(M=>$(We(M))).finally(()=>m(!1))},[e,t]);function I(V){Ae({color:"green",title:"Success",icon:a.jsx(Go,{size:"1rem"}),message:V})}function $(V){Ae({color:"red",title:"Error",message:V,autoClose:!1})}return a.jsxs(lt,{children:[a.jsx(Mn,{opened:z,onClose:K,title:"Upgrade Agent",centered:!0,children:a.jsx(yae,{opened:z,close:K,version:x,loadingStatus:r,handleStatus:W,handleUpgrade:G})}),a.jsx(ze,{order:1,children:"Agent Tools"}),a.jsxs("div",{style:{marginBottom:10},children:["Agent: ",a.jsx(Hl,{value:n,link:!0})]}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Agent Status"}),a.jsx("p",{children:"Retrieve the status of the agent. This tests whether the agent is connected to the Medplum server, and the last time it was able to communicate."}),a.jsx(Me,{onClick:W,loading:r,disabled:P&&!r,children:"Get Status"}),!r&&g&&a.jsx(Z,{children:a.jsxs(Z.Tbody,{children:[a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:"Status"}),a.jsx(Z.Td,{children:a.jsx(pg,{status:g})})]}),a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:"Version"}),a.jsx(Z.Td,{children:x})]}),a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:"Last Updated"}),a.jsx(Z.Td,{children:Nr(w,void 0,{timeZoneName:"longOffset"})})]})]})}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Reload Config"}),a.jsx("p",{children:"Reload the configuration of this agent, syncing it with the current version of the Agent resource on the Medplum server."}),a.jsx(Me,{onClick:B,loading:s,disabled:P&&!s,"aria-label":"Reload config",children:"Reload Config"}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Upgrade Agent"}),a.jsx("p",{children:"Upgrade the version of this agent, to either the latest (default) or a specified version."}),a.jsx(Me,{onClick:U,loading:u,disabled:P&&!u,"aria-label":"Upgrade agent",children:"Upgrade"}),a.jsx(dn,{my:"lg"}),a.jsxs(pt,{onSubmit:L,children:[a.jsx(ze,{order:2,children:"Fetch Logs"}),a.jsx("p",{children:"Fetch logs from the agent."}),k?.length?a.jsx(mf,{block:!0,mb:15,children:k}):null,a.jsxs(xe,{children:[a.jsx(hr,{w:100,id:"logLimit",name:"logLimit",placeholder:"20",label:"Log Limit"}),a.jsx(Me,{mt:22,loading:h,disabled:P&&!h,"aria-label":"Fetch logs",type:"submit",children:"Fetch Logs"})]})]}),a.jsx(dn,{my:"lg"}),a.jsx(ze,{order:2,children:"Ping from Agent"}),a.jsx("p",{children:"Send a ping command from the agent to a valid IP address or hostname. Use this tool to troubleshoot local network connectivity."}),a.jsx(pt,{onSubmit:ee,children:a.jsxs(xe,{children:[a.jsx(Fe,{id:"host",name:"host",placeholder:"ex. 127.0.0.1",label:"IP Address / Hostname",rightSection:a.jsx(Pn,{size:24,radius:"xl",variant:"filled",type:"submit","aria-label":"Ping",loading:E,disabled:P&&!E,children:a.jsx(uW,{style:{width:"1rem",height:"1rem"},stroke:1.5})})}),a.jsx(hr,{id:"pingCount",name:"pingCount",placeholder:"1",label:"Ping Count"})]})}),!E&&T&&a.jsxs(a.Fragment,{children:[a.jsx(ze,{order:5,mt:"sm",mb:0,children:"Last Ping"}),a.jsx("pre",{children:T})]})]})}function bae(){const e=Fn(),t=Re(),[n,r]=v.useState();v.useEffect(()=>{t.get("auth/me",{cache:"no-cache"}).then(r).catch(s=>Ae({color:"red",message:We(s),autoClose:!1}))},[t]);function i(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>Ae({color:"green",message:"Login revoked"})).catch(c=>Ae({color:"red",message:We(c),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(lt,{children:[a.jsx(ze,{children:"Security"}),a.jsxs(Pf,{children:[a.jsx(Ur,{term:"ID",children:a.jsx(wt,{href:`/${$t(n.profile)}`,children:n.profile.id})}),a.jsx(Ur,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(Ur,{term:"Name",children:Na(n.profile.name?.[0])})]})]}),a.jsxs(lt,{children:[a.jsx(ze,{children:"Sessions"}),a.jsxs(Z,{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"OS"}),a.jsx("th",{children:"Browser"}),a.jsx("th",{children:"IP Address"}),a.jsx("th",{children:"Auth Method"}),a.jsx("th",{children:"Last Updated"}),a.jsx("th",{})]})}),a.jsx("tbody",{children:n.security.sessions.map(s=>a.jsxs("tr",{children:[a.jsx("td",{children:s.os}),a.jsx("td",{children:s.browser}),a.jsx("td",{children:s.remoteAddress}),a.jsx("td",{children:s.authMethod}),a.jsx("td",{children:Nr(s.lastUpdated)}),a.jsx("td",{children:a.jsx(wt,{href:"#",onClick:()=>i(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(lt,{children:[a.jsx(ze,{children:"Password"}),a.jsx(Me,{onClick:()=>e("/changepassword")?.catch(console.error),children:"Change password"})]}),a.jsxs(lt,{children:[a.jsx(ze,{children:"Multi Factor Auth"}),a.jsxs("p",{children:["Enrolled: ",n.security.mfaEnrolled.toString()]}),!n.security.mfaEnrolled&&a.jsx(Me,{onClick:()=>e("/mfa")?.catch(console.error),children:"Enroll"})]})]}):null}function Sae(){const{id:e,secret:t}=Yt(),n=Re(),[r,i]=v.useState(),[s,c]=v.useState(!1),u=Ms(r,void 0);return a.jsxs(lt,{width:450,children:[a.jsx(xr,{issues:u}),a.jsxs(pt,{onSubmit:f=>{if(f.password!==f.confirmPassword){i(Oo("Passwords do not match","confirmPassword"));return}i(void 0);const h={id:e,secret:t,password:f.password};n.post("auth/setpassword",h).then(()=>c(!0)).catch(m=>i(rn(m)))},children:[a.jsxs(ar,{direction:"column",align:"center",justify:"center",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{children:"Set password"})]}),!s&&a.jsxs(Ne,{children:[a.jsx(ao,{name:"password",label:"New password",required:!0,error:Ut(r,"password")}),a.jsx(ao,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Ut(r,"confirmPassword")}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Me,{type:"submit",children:"Set password"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:["Password set. You can now ",a.jsx(jt,{to:"/signin",children:"sign in"}),"."]})]})]})}function jae(){const e=_f(),t=Fn(),[n]=Sg(),r=Bf(),i=v.useCallback(()=>{const s=n.get("next");t(s?.startsWith("/")?s:"/")?.catch(console.error)},[n,t]);return v.useEffect(()=>{e&&n.has("next")&&i()},[e,n,i]),a.jsxs(NP,{onSuccess:()=>i(),onForgotPassword:()=>t("/resetpassword")?.catch(console.error),onRegister:w1()?()=>t("/register")?.catch(console.error):void 0,googleClientId:r.googleClientId,login:n.get("login")||void 0,projectId:n.get("project")||void 0,children:[a.jsx(Wi,{size:32}),n.get("project")!=="new"&&a.jsxs(ze,{order:3,py:"lg",ta:"center",children:["Sign in to ",dP()]}),n.get("project")==="new"&&a.jsx(ze,{order:3,py:"lg",ta:"center",children:"Sign in again to create a new project"})]})}function wae(){const e=Fn(),t=Fr(),[n,r]=v.useState(),[i,s]=v.useState(),[c,u]=v.useState();return v.useEffect(()=>{const f=Object.fromEntries(new URLSearchParams(t.search).entries());r(f.resourceType),s(f.query),u(JSON.parse(f.fields))},[t]),!n||!i||!c?null:a.jsx(HJ,{resourceType:n,checkboxesEnabled:!0,query:i,fields:c,onClick:f=>e(`/${n}/${f.resource.id}`)?.catch(console.error),onAuxClick:f=>window.open(`/${n}/${f.resource.id}`,"_blank"),onBulk:f=>{e(`/bulk/${n}?ids=${f.join(",")}`)?.catch(console.error)}})}function Cae(){const{id:e,secret:t}=Yt(),n=Re(),[r,i]=v.useState(),[s,c]=v.useState(!1),u=Ms(r,void 0);return a.jsxs(lt,{width:450,children:[a.jsx(xr,{issues:u}),a.jsxs(pt,{onSubmit:()=>{i(void 0);const f={id:e,secret:t};n.post("auth/verifyemail",f).then(()=>c(!0)).catch(h=>i(rn(h)))},children:[a.jsxs(ar,{direction:"column",align:"center",justify:"center",children:[a.jsx(Wi,{size:32}),a.jsx(ze,{children:"Email address verification required"})]}),!s&&a.jsxs(Ne,{children:[a.jsx("p",{children:"In order to sign in, click the button below to verify your ability to receive email at the address this link was sent to."}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Me,{type:"submit",children:"Verify email"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:["Email verified. You can now ",a.jsx(jt,{to:"/signin",children:"sign in"}),"."]})]})]})}function Eae(){return a.jsx(Sne,{children:a.jsxs(Be,{errorElement:a.jsx(Jie,{}),children:[a.jsx(Be,{path:"/signin",element:a.jsx(jae,{})}),a.jsx(Be,{path:"/oauth",element:a.jsx(poe,{})}),a.jsx(Be,{path:"/resetpassword",element:a.jsx(goe,{})}),a.jsx(Be,{path:"/setpassword/:id/:secret",element:a.jsx(Sae,{})}),a.jsx(Be,{path:"/verifyemail/:id/:secret",element:a.jsx(Cae,{})}),a.jsx(Be,{path:"/register",element:a.jsx(moe,{})}),a.jsx(Be,{path:"/changepassword",element:a.jsx(Yie,{})}),a.jsx(Be,{path:"/security",element:a.jsx(bae,{})}),a.jsx(Be,{path:"/mfa",element:a.jsx(doe,{})}),a.jsx(Be,{path:"/batch",element:a.jsx(Wie,{})}),a.jsx(Be,{path:"/bulk/:resourceType",element:a.jsx(Qie,{})}),a.jsx(Be,{path:"/smart",element:a.jsx(wae,{})}),a.jsx(Be,{path:"/forms/:id",element:a.jsx(Zie,{})}),a.jsx(Be,{path:"/admin/super",element:a.jsx(Lre,{})}),a.jsx(Be,{path:"/admin/super/asyncjob/:tab",element:a.jsx(C_,{})}),a.jsx(Be,{path:"/admin/super/asyncjob",element:a.jsx(C_,{})}),a.jsx(Be,{path:"/admin/super/db/:tab",element:a.jsx(j_,{})}),a.jsx(Be,{path:"/admin/super/db",element:a.jsx(j_,{})}),a.jsx(Be,{path:"/admin/config",element:a.jsx(Cre,{})}),a.jsxs(Be,{path:"/admin",element:a.jsx(Tre,{}),children:[a.jsx(Be,{path:"bots/new",element:a.jsx(sre,{})}),a.jsx(Be,{path:"bots",element:a.jsx(ore,{})}),a.jsx(Be,{path:"clients/new",element:a.jsx(lre,{})}),a.jsx(Be,{path:"clients",element:a.jsx(are,{})}),a.jsx(Be,{path:"details",element:a.jsx(w_,{})}),a.jsx(Be,{path:"invite",element:a.jsx(wre,{})}),a.jsx(Be,{path:"patients",element:a.jsx(xne,{to:"/admin/users",replace:!0})}),a.jsx(Be,{path:"users",element:a.jsx(Vre,{})}),a.jsx(Be,{path:"project",element:a.jsx(w_,{})}),a.jsx(Be,{path:"secrets",element:a.jsx(Rre,{})}),a.jsx(Be,{path:"sites",element:a.jsx(_re,{})})]}),a.jsx(Be,{path:"/lab/assays",element:a.jsx(coe,{})}),a.jsx(Be,{path:"/lab/panels",element:a.jsx(uoe,{})}),a.jsxs(Be,{path:"/:resourceType/new",element:a.jsx(Xie,{}),children:[a.jsx(Be,{index:!0,element:a.jsx(Tx,{})}),a.jsx(Be,{path:"form",element:a.jsx(Tx,{})}),a.jsx(Be,{path:"json",element:a.jsx($oe,{})}),a.jsx(Be,{path:"profiles",element:a.jsx(Tx,{})})]}),a.jsxs(Be,{path:"/:resourceType/:id",element:a.jsx(mae,{}),children:[a.jsx(Be,{index:!0,element:a.jsx(H_,{})}),a.jsx(Be,{path:"apply",element:a.jsx(yoe,{})}),a.jsx(Be,{path:"apps",element:a.jsx(xoe,{})}),a.jsx(Be,{path:"event",element:a.jsx(Soe,{})}),a.jsx(Be,{path:"blame",element:a.jsx(joe,{})}),a.jsx(Be,{path:"bots",element:a.jsx(Xoe,{})}),a.jsx(Be,{path:"builder",element:a.jsx(koe,{})}),a.jsx(Be,{path:"checklist",element:a.jsx(Poe,{})}),a.jsx(Be,{path:"delete",element:a.jsx(Noe,{})}),a.jsx(Be,{path:"details",element:a.jsx(Loe,{})}),a.jsx(Be,{path:"edit",element:a.jsx(Ioe,{})}),a.jsx(Be,{path:"editor",element:a.jsx(Doe,{})}),a.jsxs(Be,{path:"history",children:[a.jsx(Be,{index:!0,element:a.jsx(F_,{})}),a.jsx(Be,{path:":versionId/:tab",element:a.jsx(vp,{})}),a.jsx(Be,{path:":versionId",element:a.jsx(vp,{})})]}),a.jsxs(Be,{path:"_history",children:[a.jsx(Be,{index:!0,element:a.jsx(F_,{})}),a.jsx(Be,{path:":versionId/:tab",element:a.jsx(vp,{})}),a.jsx(Be,{path:":versionId",element:a.jsx(vp,{})})]}),a.jsx(Be,{path:"json",element:a.jsx(Uoe,{})}),a.jsx(Be,{path:"preview",element:a.jsx(Woe,{})}),a.jsx(Be,{path:"responses",element:a.jsx(Zoe,{})}),a.jsx(Be,{path:"report",element:a.jsx(tae,{})}),a.jsx(Be,{path:"ranges",element:a.jsx(eae,{})}),a.jsx(Be,{path:"subscriptions",element:a.jsx(gae,{})}),a.jsx(Be,{path:"timeline",element:a.jsx(H_,{})}),a.jsx(Be,{path:"tools",element:a.jsx(xae,{})}),a.jsx(Be,{path:"profiles",element:a.jsx(Qoe,{})}),a.jsx(Be,{path:"export",element:a.jsx(zoe,{})})]}),a.jsx(Be,{path:"/:resourceType",element:a.jsx(U_,{})}),a.jsx(Be,{path:"/",element:a.jsx(U_,{})})]})})}function Tae(){const e=Re(),t=e.getUserConfiguration(),n=Fr(),[r]=Sg();return e.isLoading()?a.jsx(Ui,{}):a.jsx(cY,{logo:a.jsx(Wi,{size:24}),pathname:n.pathname,searchParams:r,version:Bk,menus:Rae(t),displayAddBookmark:!!t?.id,children:a.jsx(v.Suspense,{fallback:a.jsx(Ui,{}),children:a.jsx(Eae,{})})})}function Rae(e){const t=e?.menu?.map(n=>({title:n.title,links:n.link?.map(r=>({label:r.name,href:r.target,icon:_ae(r.target)}))||[]}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(NG,{})}]}),t}const q_={Patient:yW,Practitioner:TG,Organization:Bq,ServiceRequest:rW,DiagnosticReport:lW,Questionnaire:CG,Project:jG,admin:Nq,AccessPolicy:kG,Subscription:AW,batch:qG,Observation:BG};function _ae(e){if(e.includes("admin/super/db"))return a.jsx(iG,{});try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in q_){const n=q_[t];return a.jsx(n,{})}}catch{}}async function Dae(){const e=Bf(),t=new Vk({baseUrl:e.baseUrl,clientId:e.clientId,storagePrefix:"@medplum:",cacheTime:6e4,autoBatchTime:100,onUnauthenticated:()=>{window.location.pathname!=="/signin"&&window.location.pathname!=="/oauth"&&(window.location.href="/signin?next="+encodeURIComponent(window.location.pathname+window.location.search))}}),n={headings:{sizes:{h1:{fontSize:"1.125rem",fontWeight:"500",lineHeight:"2.0"}}},fontSizes:{xs:"0.6875rem",sm:"0.875rem",md:"0.875rem",lg:"1.0rem",xl:"1.125rem"}},r=Gne([{path:"*",element:a.jsx(Tae,{})}]),i=c=>r.navigate(c);Aee.createRoot(document.getElementById("root")).render(a.jsx(v.StrictMode,{children:a.jsx(kH,{medplum:t,navigate:i,children:a.jsxs(m2,{theme:n,children:[a.jsx(Pa,{position:"bottom-right"}),a.jsx(gne,{router:r})]})})}))}Dae().catch(console.error);
235
+ //# sourceMappingURL=index-9rhutH6g.js.map