@medplum/app 5.0.15 → 5.1.1

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 T3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)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(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function om(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ry={exports:{}},md={};var sE;function R3(){if(sE)return md;sE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var c=null;if(s!==void 0&&(c=""+s),o.key!==void 0&&(c=""+o.key),"key"in o){s={};for(var u in o)u!=="key"&&(s[u]=o[u])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:c,ref:o!==void 0?o:null,props:s}}return md.Fragment=t,md.jsx=n,md.jsxs=n,md}var lE;function _3(){return lE||(lE=1,Ry.exports=R3()),Ry.exports}var a=_3(),ko=function(){return ko=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ko.apply(this,arguments)};function q_(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Ml(e,t,n,r){function o(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):o(m.value).then(u,f)}h((r=r.apply(e,t||[])).next())})}function D3(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;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 _y={exports:{}},gt={};var cE;function A3(){if(cE)return gt;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"),o=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(O){return O===null||typeof O!="object"?null:(O=y&&O[y]||O["@@iterator"],typeof O=="function"?O:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function T(O,F,se){this.props=O,this.context=F,this.refs=C,this.updater=se||S}T.prototype.isReactComponent={},T.prototype.setState=function(O,F){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,F,"setState")},T.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function R(){}R.prototype=T.prototype;function E(O,F,se){this.props=O,this.context=F,this.refs=C,this.updater=se||S}var _=E.prototype=new R;_.constructor=E,w(_,T.prototype),_.isPureReactComponent=!0;var k=Array.isArray;function L(){}var D={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function $(O,F,se){var de=se.ref;return{$$typeof:e,type:O,key:F,ref:de!==void 0?de:null,props:se}}function U(O,F){return $(O.type,F,O.props)}function W(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function Y(O){var F={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(se){return F[se]})}var ee=/\/+/g;function B(O,F){return typeof O=="object"&&O!==null&&O.key!=null?Y(""+O.key):F.toString(36)}function G(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(L,L):(O.status="pending",O.then(function(F){O.status==="pending"&&(O.status="fulfilled",O.value=F)},function(F){O.status==="pending"&&(O.status="rejected",O.reason=F)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function M(O,F,se,de,xe){var Ce=typeof O;(Ce==="undefined"||Ce==="boolean")&&(O=null);var we=!1;if(O===null)we=!0;else switch(Ce){case"bigint":case"string":case"number":we=!0;break;case"object":switch(O.$$typeof){case e:case t:we=!0;break;case m:return we=O._init,M(we(O._payload),F,se,de,xe)}}if(we)return xe=xe(O),we=de===""?"."+B(O,0):de,k(xe)?(se="",we!=null&&(se=we.replace(ee,"$&/")+"/"),M(xe,F,se,"",function(ht){return ht})):xe!=null&&(W(xe)&&(xe=U(xe,se+(xe.key==null||O&&O.key===xe.key?"":(""+xe.key).replace(ee,"$&/")+"/")+we)),F.push(xe)),1;we=0;var Ye=de===""?".":de+":";if(k(O))for(var De=0;De<O.length;De++)de=O[De],Ce=Ye+B(de,De),we+=M(de,F,se,Ce,xe);else if(De=x(O),typeof De=="function")for(O=De.call(O),De=0;!(de=O.next()).done;)de=de.value,Ce=Ye+B(de,De++),we+=M(de,F,se,Ce,xe);else if(Ce==="object"){if(typeof O.then=="function")return M(G(O),F,se,de,xe);throw F=String(O),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return we}function I(O,F,se){if(O==null)return O;var de=[],xe=0;return M(O,de,"","",function(Ce){return F.call(se,Ce,xe++)}),de}function z(O){if(O._status===-1){var F=O._result;F=F(),F.then(function(se){(O._status===0||O._status===-1)&&(O._status=1,O._result=se)},function(se){(O._status===0||O._status===-1)&&(O._status=2,O._result=se)}),O._status===-1&&(O._status=0,O._result=F)}if(O._status===1)return O._result.default;throw O._result}var V=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=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(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},K={map:I,forEach:function(O,F,se){I(O,function(){F.apply(this,arguments)},se)},count:function(O){var F=0;return I(O,function(){F++}),F},toArray:function(O){return I(O,function(F){return F})||[]},only:function(O){if(!W(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return gt.Activity=g,gt.Children=K,gt.Component=T,gt.Fragment=n,gt.Profiler=o,gt.PureComponent=E,gt.StrictMode=r,gt.Suspense=f,gt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,gt.__COMPILER_RUNTIME={__proto__:null,c:function(O){return D.H.useMemoCache(O)}},gt.cache=function(O){return function(){return O.apply(null,arguments)}},gt.cacheSignal=function(){return null},gt.cloneElement=function(O,F,se){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var de=w({},O.props),xe=O.key;if(F!=null)for(Ce in F.key!==void 0&&(xe=""+F.key),F)!P.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=se;else if(1<Ce){for(var we=Array(Ce),Ye=0;Ye<Ce;Ye++)we[Ye]=arguments[Ye+2];de.children=we}return $(O.type,xe,de)},gt.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:s,_context:O},O},gt.createElement=function(O,F,se){var de,xe={},Ce=null;if(F!=null)for(de in F.key!==void 0&&(Ce=""+F.key),F)P.call(F,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(xe[de]=F[de]);var we=arguments.length-2;if(we===1)xe.children=se;else if(1<we){for(var Ye=Array(we),De=0;De<we;De++)Ye[De]=arguments[De+2];xe.children=Ye}if(O&&O.defaultProps)for(de in we=O.defaultProps,we)xe[de]===void 0&&(xe[de]=we[de]);return $(O,Ce,xe)},gt.createRef=function(){return{current:null}},gt.forwardRef=function(O){return{$$typeof:u,render:O}},gt.isValidElement=W,gt.lazy=function(O){return{$$typeof:m,_payload:{_status:-1,_result:O},_init:z}},gt.memo=function(O,F){return{$$typeof:h,type:O,compare:F===void 0?null:F}},gt.startTransition=function(O){var F=D.T,se={};D.T=se;try{var de=O(),xe=D.S;xe!==null&&xe(se,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(L,V)}catch(Ce){V(Ce)}finally{F!==null&&se.types!==null&&(F.types=se.types),D.T=F}},gt.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},gt.use=function(O){return D.H.use(O)},gt.useActionState=function(O,F,se){return D.H.useActionState(O,F,se)},gt.useCallback=function(O,F){return D.H.useCallback(O,F)},gt.useContext=function(O){return D.H.useContext(O)},gt.useDebugValue=function(){},gt.useDeferredValue=function(O,F){return D.H.useDeferredValue(O,F)},gt.useEffect=function(O,F){return D.H.useEffect(O,F)},gt.useEffectEvent=function(O){return D.H.useEffectEvent(O)},gt.useId=function(){return D.H.useId()},gt.useImperativeHandle=function(O,F,se){return D.H.useImperativeHandle(O,F,se)},gt.useInsertionEffect=function(O,F){return D.H.useInsertionEffect(O,F)},gt.useLayoutEffect=function(O,F){return D.H.useLayoutEffect(O,F)},gt.useMemo=function(O,F){return D.H.useMemo(O,F)},gt.useOptimistic=function(O,F){return D.H.useOptimistic(O,F)},gt.useReducer=function(O,F,se){return D.H.useReducer(O,F,se)},gt.useRef=function(O){return D.H.useRef(O)},gt.useState=function(O){return D.H.useState(O)},gt.useSyncExternalStore=function(O,F,se){return D.H.useSyncExternalStore(O,F,se)},gt.useTransition=function(){return D.H.useTransition()},gt.version="19.2.4",gt}var uE;function jb(){return uE||(uE=1,_y.exports=A3()),_y.exports}var v=jb();const In=om(v),wb=T3({__proto__:null,default:In},[v]);var gp="right-scroll-bar-position",vp="width-before-scroll-bar",k3="with-scroll-bars-hidden",P3="--removed-body-scroll-bar-size";function Dy(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function N3(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var O3=typeof window<"u"?v.useLayoutEffect:v.useEffect,dE=new WeakMap;function M3(e,t){var n=N3(null,function(r){return e.forEach(function(o){return Dy(o,r)})});return O3(function(){var r=dE.get(n);if(r){var o=new Set(r),s=new Set(e),c=n.current;o.forEach(function(u){s.has(u)||Dy(u,null)}),s.forEach(function(u){o.has(u)||Dy(u,c)})}dE.set(n,e)},[e]),n}function L3(e){return e}function I3(e,t){t===void 0&&(t=L3);var n=[],r=!1,o={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 o}function z3(e){e===void 0&&(e={});var t=I3(null);return t.options=ko({async:!0,ssr:!1},e),t}var G_=function(e){var t=e.sideCar,n=q_(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,ko({},n))};G_.isSideCarExport=!0;function $3(e,t){return e.useMedium(t),G_}var W_=z3(),Ay=function(){},am=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:Ay,onWheelCapture:Ay,onTouchMoveCapture:Ay}),o=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,_=q_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=y,L=M3([n,t]),D=ko(ko({},_),o);return v.createElement(v.Fragment,null,m&&v.createElement(k,{sideCar:W_,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),ko(ko({},D),{ref:L})):v.createElement(R,ko({},D,{className:f,ref:L}),u))});am.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};am.classNames={fullWidth:vp,zeroRight:gp};var U3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function B3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=U3();return t&&e.setAttribute("nonce",t),e}function V3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function F3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var H3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=B3())&&(V3(t,n),F3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},q3=function(){var e=H3();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Q_=function(){var e=q3(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},G3={left:0,top:0,right:0,gap:0},ky=function(e){return parseInt(e||"",10)||0},W3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ky(n),ky(r),ky(o)]},Q3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return G3;var t=W3(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])}},Y3=Q_(),qc="data-scroll-locked",K3=function(e,t,n,r){var o=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
2
+ .`.concat(k3,` {
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(o,`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(gp,` {
20
+ right: `).concat(u,"px ").concat(r,`;
21
+ }
22
+
23
+ .`).concat(vp,` {
24
+ margin-right: `).concat(u,"px ").concat(r,`;
25
+ }
26
+
27
+ .`).concat(gp," .").concat(gp,` {
28
+ right: 0 `).concat(r,`;
29
+ }
30
+
31
+ .`).concat(vp," .").concat(vp,` {
32
+ margin-right: 0 `).concat(r,`;
33
+ }
34
+
35
+ body[`).concat(qc,`] {
36
+ `).concat(P3,": ").concat(u,`px;
37
+ }
38
+ `)},fE=function(){var e=parseInt(document.body.getAttribute(qc)||"0",10);return isFinite(e)?e:0},X3=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())}},[])},J3=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;X3();var s=v.useMemo(function(){return Q3(o)},[o]);return v.createElement(Y3,{styles:K3(s,!t,o,n?"":"!important")})},Rx=!1;if(typeof window<"u")try{var Xh=Object.defineProperty({},"passive",{get:function(){return Rx=!0,!0}});window.addEventListener("test",Xh,Xh),window.removeEventListener("test",Xh,Xh)}catch{Rx=!1}var _c=Rx?{passive:!1}:!1,Z3=function(e){return e.tagName==="TEXTAREA"},Y_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Z3(e)&&n[t]==="visible")},eM=function(e){return Y_(e,"overflowY")},tM=function(e){return Y_(e,"overflowX")},hE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=K_(e,r);if(o){var s=X_(e,r),c=s[1],u=s[2];if(c>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},nM=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},rM=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},K_=function(e,t){return e==="v"?eM(t):tM(t)},X_=function(e,t){return e==="v"?nM(t):rM(t)},iM=function(e,t){return e==="h"&&t==="rtl"?-1:1},oM=function(e,t,n,r,o){var s=iM(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=X_(e,u),S=x[0],w=x[1],C=x[2],T=w-C-s*S;(S||T)&&K_(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},Jh=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},aM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sM=function(e){return`
39
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
40
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
+ `)},lM=0,Dc=[];function cM(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(lM++)[0],s=v.useState(Q_)[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(o));var w=D3([e.lockRef.current],(e.shards||[]).map(mE),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[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=Jh(w),R=n.current,E="deltaX"in w?w.deltaX:R[0]-T[0],_="deltaY"in w?w.deltaY:R[1]-T[1],k,L=w.target,D=Math.abs(E)>Math.abs(_)?"h":"v";if("touches"in w&&D==="h"&&L.type==="range")return!1;var P=window.getSelection(),$=P&&P.anchorNode,U=$?$===L||$.contains(L):!1;if(U)return!1;var W=hE(D,L);if(!W)return!0;if(W?k=D:(k=D==="v"?"h":"v",W=hE(D,L)),!W)return!1;if(!r.current&&"changedTouches"in w&&(E||_)&&(r.current=k),!k)return!0;var Y=r.current||k;return oM(Y,C,w,Y==="h"?E:_)},[]),f=v.useCallback(function(w){var C=w;if(!(!Dc.length||Dc[Dc.length-1]!==s)){var T="deltaY"in C?pE(C):Jh(C),R=t.current.filter(function(k){return k.name===C.type&&(k.target===C.target||C.target===k.shadowParent)&&aM(k.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(k){return k.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:uM(T)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(_){return _!==E})},1)},[]),m=v.useCallback(function(w){n.current=Jh(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,Jh(w),w.target,u(w,e.lockRef.current))},[]);v.useEffect(function(){return Dc.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,_c),document.addEventListener("touchmove",f,_c),document.addEventListener("touchstart",m,_c),function(){Dc=Dc.filter(function(w){return w!==s}),document.removeEventListener("wheel",f,_c),document.removeEventListener("touchmove",f,_c),document.removeEventListener("touchstart",m,_c)}},[]);var x=e.removeScrollBar,S=e.inert;return v.createElement(v.Fragment,null,S?v.createElement(s,{styles:sM(o)}):null,x?v.createElement(J3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dM=$3(W_,cM);var wl=v.forwardRef(function(e,t){return v.createElement(am,ko({},e,{ref:t,sideCar:dM}))});wl.classNames=am.classNames;function pn(e){return Object.keys(e)}function Py(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Cb(e,t){const n={...e},r=t;return Py(e)&&Py(t)&&Object.keys(t).forEach(o=>{Py(r[o])&&o in e?n[o]=Cb(n[o],r[o]):n[o]=r[o]}),n}function fM(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function hM(e){return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:e.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function Nd(e){const t=hM(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 J_(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return`0${e}`;if(typeof r=="number"){const o=`${r/16}${e}`;return t?gE(o):o}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 o=r.replace("px","");if(!Number.isNaN(Number(o))){const s=`${Number(o)/16}${e}`;return t?gE(s):s}}return r}return n}const ce=J_("rem",{shouldScale:!0}),Dp=J_("em");function _s(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function Z_(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 sm(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:o,value:s})=>a.jsx(t.Provider,{value:s,children:o}),()=>{const o=v.useContext(t);if(o===null)throw new Error(e);return o}]}function Wo(e=null){const t=v.createContext(e);return[({children:o,value:s})=>a.jsx(t.Provider,{value:s,children:o}),()=>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 Ap(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function pM(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 mM(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 gM(e,t,n){return Ap(e,n)===Ap(t,n)}function Eb({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:o=!1,dir:s="rtl",orientation:c}){return u=>{n?.(u);const f=Array.from(Ap(u.currentTarget,e)?.querySelectorAll(t)||[]).filter(S=>gM(u.currentTarget,S,e)),h=f.findIndex(S=>u.currentTarget===S),m=mM(h,f,r),g=pM(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(),o&&f[y].click());break}case"ArrowLeft":{c==="horizontal"&&(u.stopPropagation(),u.preventDefault(),f[x].focus(),o&&f[x].click());break}case"ArrowUp":{c==="vertical"&&(u.stopPropagation(),u.preventDefault(),f[g].focus(),o&&f[g].click());break}case"ArrowDown":{c==="vertical"&&(u.stopPropagation(),u.preventDefault(),f[m].focus(),o&&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 vM={app:100,modal:200,popover:300,overlay:400,max:9999};function Br(e){return vM[e]}const kp=()=>{};function yM(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||kp:n=>{n.key==="Escape"&&(e(n),t.onTrigger?.())}}function rt(e,t="size",n=!0){if(e!==void 0)return Z_(e)?n?ce(e):e:`var(--${t}-${e})`}function Qn(e){return rt(e,"mantine-spacing")}function Ht(e){return e===void 0?"var(--mantine-radius-default)":rt(e,"mantine-radius")}function Yn(e){return rt(e,"mantine-font-size")}function e2(e){return rt(e,"mantine-line-height",!1)}function Tb(e){if(e)return rt(e,"mantine-shadow",!1)}function dr(e,t){return n=>{e?.(n),t?.(n)}}function Rb(e,t){return e in t?Nd(t[e]):Nd(e)}function Od(e,t){const n=e.map(r=>({value:r,px:Rb(r,t)}));return n.sort((r,o)=>r.px-o.px),n}function so(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function xM(e,t,n){return n?Array.from(Ap(n,t)?.querySelectorAll(e)||[]).findIndex(r=>r===n):null}function _d(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 Pp(e="mantine-"){return`${e}${Math.random().toString(36).slice(2,11)}`}function bM(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 o=0;o<r;o+=1){const s=n[o];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 ul(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...n)=>t.current?.(...n)),[])}function rf(e,t){const{delay:n,flushOnUnmount:r,leading:o}=typeof t=="number"?{delay:t,flushOnUnmount:!1,leading:!1}:t,s=ul(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(o&&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(o&&!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,o]);return v.useEffect(()=>()=>{r?u.flush():u.cancel()},[u,r]),u}const SM=["mousedown","touchstart"];function jM(e,t,n){const r=v.useRef(null),o=t||SM;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 o.forEach(c=>document.addEventListener(c,s)),()=>{o.forEach(c=>document.removeEventListener(c,s))}},[r,e,n]),r}function t2(e={timeout:2e3}){const[t,n]=v.useState(null),[r,o]=v.useState(!1),[s,c]=v.useState(null),u=m=>{window.clearTimeout(s),c(window.setTimeout(()=>o(!1),e.timeout)),o(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:()=>{o(!1),n(null),window.clearTimeout(s)},error:t,copied:r}}function wM(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function CM(e,t){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function n2(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=v.useState(n?t:CM(e));return v.useEffect(()=>{try{const s=window.matchMedia(e);return o(s.matches),wM(s,c=>o(c.matches))}catch{return}},[e]),r||!1}function EM(e,t){return n2("(prefers-color-scheme: dark)",e==="dark",t)?"dark":"light"}const Ll=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Cl(e,t){const n=v.useRef(!1);v.useEffect(()=>()=>{n.current=!1},[]),v.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function r2({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 Cl(()=>{let o=-1;const s=c=>{c.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const TM=/input|select|textarea|button|object/,i2="a, input, select, textarea, button, object, [tabindex]";function RM(e){return e.style.display==="none"}function _M(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(RM(n))return!1;n=n.parentNode}return!0}function o2(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function _x(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(o2(e));return(TM.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&_M(e)}function a2(e){const t=o2(e);return(Number.isNaN(t)||t>=0)&&_x(e)}function DM(e){return Array.from(e.querySelectorAll(i2)).filter(a2)}function AM(e,t){const n=DM(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();let s=r===o.activeElement||e===o.activeElement;const c=o.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 kM(e=!0){const t=v.useRef(null),n=o=>{let s=o.querySelector("[data-autofocus]");if(!s){const c=Array.from(o.querySelectorAll(i2));s=c.find(a2)||c.find(_x)||null,!s&&_x(o)&&(s=o)}s&&s.focus({preventScroll:!0})},r=v.useCallback(o=>{e&&o!==null&&t.current!==o&&(o?(setTimeout(()=>{o.getRootNode()&&n(o)}),t.current=o):t.current=null)},[e]);return v.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>n(t.current));const o=s=>{s.key==="Tab"&&t.current&&AM(t.current,s)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e]),r}const PM=e=>(e+1)%1e6;function NM(){const[,e]=v.useReducer(PM,0);return e}const OM=In.useId||(()=>{});function MM(){const e=OM();return e?`mantine-${e.replace(/:/g,"")}`:""}function pr(e){const t=MM(),[n,r]=v.useState(t);return Ll(()=>{r(Pp())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function s2(e,t,n){v.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function Md(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function LM(...e){const t=new Map;return n=>{if(e.forEach(r=>{const o=Md(r,n);o&&t.set(r,o)}),t.size>0)return()=>{e.forEach(r=>{const o=t.get(r);o&&typeof o=="function"?o():Md(r,null)}),t.clear()}}}function Fn(...e){return v.useCallback(LM(...e),e)}function ir({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=v.useState(t!==void 0?t:n),c=(u,...f)=>{s(u),r?.(u,...f)};return e!==void 0?[e,r,!0]:[o,c,!1]}function cs(e,t){const n=t-e+1;return Array.from({length:n},(r,o)=>o+e)}const Zh="dots";function IM({total:e,siblings:t=1,boundaries:n=1,page:r,initialPage:o=1,onChange:s}){const c=Math.max(Math.trunc(e),0),[u,f]=ir({value:r,onChange:s,defaultValue:o,finalValue:o}),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 cs(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[...cs(1,_),Zh,...cs(c-(n-1),c)]}if(R&&!E){const _=n+1+2*t;return[...cs(1,n),Zh,...cs(c-_,c)]}return[...cs(1,n),Zh,...cs(C,T),Zh,...cs(c-n+1,c)]},[c,t,u]),active:u,setPage:h,next:m,previous:g,first:y,last:x}}function _b(e,t){return n2("(prefers-reduced-motion: reduce)",e,t)}function zM(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(!bM(e[n],t[n]))return!1;return!0}function $M(e){const t=v.useRef([]),n=v.useRef(0);return zM(t.current,e)||(t.current=e,n.current+=1),[n.current]}function UM(e,t){v.useEffect(e,$M(t))}const BM={" ":"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 ep(e){const t=e.replace("Key","").toLowerCase();return BM[e]||t}function VM(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"],o=t.find(s=>!r.includes(s));return{...n,key:o==="[plus]"?"+":o}}function FM(e,t,n){const{alt:r,ctrl:o,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(o!==m||s!==g)return!1;return u!==y?!1:!!(f&&(n?ep(S)===ep(f):ep(x??S)===ep(f)))}function HM(e,t){return n=>FM(VM(e),n,t)}function qM(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function GM(e,t=["INPUT","TEXTAREA","SELECT"],n=!1){v.useEffect(()=>{const r=o=>{e.forEach(([s,c,u={preventDefault:!0,usePhysicalKeys:!1}])=>{HM(s,u.usePhysicalKeys)(o)&&qM(o,t,n)&&(u.preventDefault&&o.preventDefault(),c(o))})};return document.documentElement.addEventListener("keydown",r),()=>document.documentElement.removeEventListener("keydown",r)},[e])}function Ds(e=!1,t={}){const[n,r]=v.useState(e),o=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():o()},[s,o,n]);return[n,{open:o,close:s,toggle:c}]}function WM(e,t,n={autoInvoke:!1}){const r=v.useRef(null),o=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&&o(),s),[s,o]),{start:o,clear:s}}function QM(e,t,n){const r=v.useRef(null),o=v.useRef(null);return v.useEffect(()=>{const s=typeof n=="function"?n():n;return(s||o.current)&&(r.current=new MutationObserver(e),r.current.observe(s||o.current,t)),()=>{r.current?.disconnect()}},[e,t]),o}function YM(){const[e,t]=v.useState(!1);return v.useEffect(()=>t(!0),[]),e}var KM={};function l2(){return typeof process<"u"&&KM?"production":"development"}function lm(e){const t=In.version;return typeof In.version!="string"||t.startsWith("18.")?e?.ref:e?.props?.ref}function yp(e,t=document){const n=t.querySelector(e);if(n)return n;const r=t.querySelectorAll("*");for(let o=0;o<r.length;o+=1){const s=r[o];if(s.shadowRoot){const c=yp(e,s.shadowRoot);if(c)return c}}return null}function hs(e,t=document){const n=[],r=t.querySelectorAll(e);n.push(...Array.from(r));const o=t.querySelectorAll("*");for(let s=0;s<o.length;s+=1){const c=o[s];if(c.shadowRoot){const u=hs(e,c.shadowRoot);n.push(...u)}}return n}function us(e){if(!e)return document;const t=e.getRootNode();return t instanceof ShadowRoot||t instanceof Document?t:document}function Il(e){const t=v.Children.toArray(e);return t.length!==1||!sm(t[0])?null:t[0]}function c2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=c2(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="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=c2(e))&&(r&&(r+=" "),r+=t);return r}const XM={};function JM(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=Ft(t[r],o):t[r]=o})}),t}function of({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||XM);return JM(s)}function Ld({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 _a(){const e=v.useContext(Db);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function ZM(){return _a().cssVariablesResolver}function e5(){return _a().classNamesPrefix}function cm(){return _a().getStyleNonce}function t5(){return _a().withStaticClasses}function n5(){return _a().headless}function r5(){return _a().stylesTransform?.sx}function i5(){return _a().stylesTransform?.styles}function um(){return _a().env||"default"}function o5(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function a5(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,o=n>>8&255,s=n&255;return{r,g:o,b:s,a:1}}function s5(e){const[t,n,r,o]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:o===void 0?1:o}}function l5(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),o=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))*o,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 o5(e)?a5(e):e.startsWith("rgb")?s5(e):e.startsWith("hsl")?l5(e):{r:0,g:0,b:0,a:1}}function tp(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:o,a:s}=Ab(e),c=1-t,u=f=>Math.round(f*c);return`rgba(${u(n)}, ${u(r)}, ${u(o)}, ${s})`}function Id(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function Ny(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function c5(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function u5(e){if(e.startsWith("oklch("))return(c5(e)||0)/100;const{r:t,g:n,b:r}=Ab(e),o=t/255,s=n/255,c=r/255,u=Ny(o),f=Ny(s),h=Ny(c);return .2126*u+.7152*f+.0722*h}function gd(e,t=.179){return e.startsWith("var(")?!1:u5(e)>t}function Jr({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:gd(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:gd(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:gd(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,o]=e.split("."),s=o?Number(o):void 0,c=r in t.colors;if(c){const u=s!==void 0?t.colors[r][s]:t.colors[r][Id(t,n||"light")];return{color:r,value:u,shade:s,isThemeColor:c,isLight:gd(u,t.luminanceThreshold),variable:o?`--mantine-color-${r}-${s}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:c,isLight:gd(e,t.luminanceThreshold),shade:s,variable:void 0}}function Xt(e,t){const n=Jr({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function Dx(e,t){const n={from:e?.from||t.defaultGradient.from,to:e?.to||t.defaultGradient.to,deg:e?.deg??t.defaultGradient.deg??0},r=Xt(n.from,t),o=Xt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function Oi(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:o}=Ab(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const Ac=Oi,d5=({color:e,theme:t,variant:n,gradient:r,autoContrast:o})=>{const s=Jr({color:e,theme:t}),c=typeof o=="boolean"?o: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:tp(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:Oi(u,.1),hover:Oi(u,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${ce(1)} solid transparent`}}return{background:Oi(e,.1),hover:Oi(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:Oi(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:Oi(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:Oi(u,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${ce(1)} solid transparent`}}return{background:"transparent",hover:Oi(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:tp(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${ce(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:tp(t.white,.01),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${ce(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:tp(t.white,.01),color:e,border:`${ce(1)} solid transparent`}:n==="gradient"?{background:Dx(r,t),hover:Dx(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)`}:{}},f5={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:f5,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:d5,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 h5({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 p5="[@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 Oy(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function jE(e){if(!(e.primaryColor in e.colors))throw new Error(p5);if(typeof e.primaryShade=="object"&&(!Oy(e.primaryShade.dark)||!Oy(e.primaryShade.light)))throw new Error(SE);if(typeof e.primaryShade=="number"&&!Oy(e.primaryShade))throw new Error(SE)}function m5(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),g5=()=>v.useContext(Pb)||kb;function kn(){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 u2({theme:e,children:t,inherit:n=!0}){const r=g5(),o=v.useMemo(()=>m5(n?r:kb,e),[e,r,n]);return a.jsx(Pb.Provider,{value:o,children:t})}u2.displayName="@mantine/core/MantineThemeProvider";function v5(){const e=kn(),t=cm(),n=pn(e.breakpoints).reduce((r,o)=>{const s=e.breakpoints[o].includes("px"),c=Nd(e.breakpoints[o]),u=s?`${c-.1}px`:Dp(c-.1),f=s?`${c}px`:Dp(c);return`${r}@media (max-width: ${u}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${f}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return a.jsx("style",{"data-mantine-styles":"classes",nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function My(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function d2(e,t){const n=t?[t]:[":root",":host"],r=My(e.variables),o=r?`${n.join(", ")}{${r}}`:"",s=My(e.dark),c=My(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`${o}
42
+
43
+ ${f}
44
+
45
+ ${h}`}function Da({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&Jr({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function wE(e,t){return Da({color:e.colors[e.primaryColor][Id(e,t)],theme:e,autoContrast:null})}function np({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:o=!0}){if(!e.colors[t])return{};if(n==="light"){const u=Id(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`]:Ac(e.colors[t][u],.1),[`--mantine-color-${r}-light-hover`]:Ac(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`]:Ac(e.colors[t][u],.05)};return o?{[`--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=Id(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`]:Ac(e.colors[t][Math.max(0,s-2)],.15),[`--mantine-color-${r}-light-hover`]:Ac(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`]:Ac(e.colors[t][Math.max(s-4,0)],.05)};return o?{[`--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 y5(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function kc(e,t,n){pn(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const f2=e=>{const t=Id(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)"}};kc(r.variables,e.breakpoints,"breakpoint"),kc(r.variables,e.spacing,"spacing"),kc(r.variables,e.fontSizes,"font-size"),kc(r.variables,e.lineHeights,"line-height"),kc(r.variables,e.shadows,"shadow"),kc(r.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((s,c)=>{r.variables[`--mantine-primary-color-${c}`]=`var(--mantine-color-${e.primaryColor}-${c})`}),pn(e.colors).forEach(s=>{const c=e.colors[s];if(y5(c)){Object.assign(r.light,np({theme:e,name:c.name,color:c.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,np({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,np({theme:e,color:s,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,np({theme:e,color:s,colorScheme:"dark",withColorValues:!1}))});const o=e.headings.sizes;return pn(o).forEach(s=>{r.variables[`--mantine-${s}-font-size`]=o[s].fontSize,r.variables[`--mantine-${s}-line-height`]=o[s].lineHeight,r.variables[`--mantine-${s}-font-weight`]=o[s].fontWeight||e.headings.fontWeight}),r};function x5({theme:e,generator:t}){const n=f2(e),r=t?.(e);return r?Cb(n,r):n}const Ly=f2(kb);function b5(e){const t={variables:{},light:{},dark:{}};return pn(e.variables).forEach(n=>{Ly.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),pn(e.light).forEach(n=>{Ly.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),pn(e.dark).forEach(n=>{Ly.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function S5(e){return d2({variables:{},dark:{"--mantine-color-scheme":"dark"},light:{"--mantine-color-scheme":"light"}},e)}function h2({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=kn(),r=cm(),o=ZM(),s=x5({theme:n,generator:o}),c=(e===void 0||e===":root"||e===":host")&&t,u=c?b5(s):s,f=d2(u,e);return f?a.jsx("style",{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${f}${c?"":S5(e)}`}}):null}h2.displayName="@mantine/CssVariables";function Pc(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 j5({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const o=v.useRef(null),[s,c]=v.useState(()=>e.get(t)),u=r||s,f=v.useCallback(m=>{r||(Pc(m,n),c(m),e.set(m))},[e.set,u,r]),h=v.useCallback(()=>{c(t),Pc(t,n),e.clear()},[e.clear,t]);return v.useEffect(()=>(e.subscribe(f),e.unsubscribe),[e.subscribe,e.unsubscribe]),Ll(()=>{Pc(e.get(t),n)},[]),v.useEffect(()=>{if(r)return Pc(r,n),()=>{};r===void 0&&Pc(s,n),typeof window<"u"&&"matchMedia"in window&&(o.current=window.matchMedia("(prefers-color-scheme: dark)"));const m=g=>{s==="auto"&&Pc(g.matches?"dark":"light",n)};return o.current?.addEventListener("change",m),()=>o.current?.removeEventListener("change",m)},[s,r]),{colorScheme:u,setColorScheme:f,clearColorScheme:h}}function w5({respectReducedMotion:e,getRootElement:t}){Ll(()=>{e&&t()?.setAttribute("data-respect-reduced-motion","true")},[e])}function p2({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:o=!0,deduplicateCssVariables:s=!0,withCssVariables:c=!0,cssVariablesSelector:u,classNamesPrefix:f="mantine",colorSchemeManager:h=h5(),defaultColorScheme:m="light",getRootElement:g=()=>document.documentElement,cssVariablesResolver:y,forceColorScheme:x,stylesTransform:S,env:w}){const{colorScheme:C,setColorScheme:T,clearColorScheme:R}=j5({defaultColorScheme:m,forceColorScheme:x,manager:h,getRootElement:g});return w5({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(u2,{theme:e,children:[c&&a.jsx(h2,{cssVariablesSelector:u,deduplicateCssVariables:s}),o&&a.jsx(v5,{}),t]})})}p2.displayName="@mantine/core/MantineProvider";function zl({classNames:e,styles:t,props:n,stylesCtx:r}){const o=kn();return{resolvedClassNames:of({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:Ld({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const C5={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function E5({theme:e,options:t,unstyled:n}){return Ft(t?.focusable&&!n&&(e.focusClassName||C5[e.focusRing]),t?.active&&!n&&e.activeClassName)}function T5({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return of({theme:o,classNames:n?.classNames,props:n?.props||r,stylesCtx:t})[e]}function CE({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return of({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function R5({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function _5({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function D5({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(o=>`${t}-${o}-${n}`)}function A5({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(s=>of({theme:t,classNames:t.components[s]?.classNames,props:r,stylesCtx:o})?.[n])}function k5({options:e,classes:t,selector:n,unstyled:r}){return e?.variant&&!r?t[`${n}--${e.variant}`]:void 0}function P5({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:o,classNames:s,classes:c,unstyled:u,className:f,rootSelector:h,props:m,stylesCtx:g,withStaticClasses:y,headless:x,transformedStyles:S}){return Ft(E5({theme:e,options:t,unstyled:u||x}),A5({theme:e,themeName:n,selector:r,props:m,stylesCtx:g}),k5({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}),T5({selector:r,stylesCtx:g,options:t,props:m,theme:e}),R5({rootSelector:h,selector:r,className:f}),_5({selector:r,classes:c,unstyled:u||x}),y&&!x&&D5({themeName:n,classNamesPrefix:o,selector:r,withStaticClass:t?.withStaticClass}),t?.className)}function N5({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(s=>Ld({theme:e,styles:e.components[s]?.styles,props:n,stylesCtx:r})[o]).reduce((s,c)=>({...s,...c}),{})}function Ax({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...Ax({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function O5(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],..._s(n[r])}}),t),{})}function M5({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:s,themeName:c,headless:u}){return O5([u?{}:t?.(n,r,o),...c.map(f=>n.components?.[f]?.vars?.(n,r,o)),e?.(n,r,o)])?.[s]}function L5({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:s,rootSelector:c,styles:u,style:f,vars:h,varsResolver:m,headless:g,withStylesTransform:y}){return{...!y&&N5({theme:e,themeName:t,props:o,stylesCtx:s,selector:n}),...!y&&Ld({theme:e,styles:u,props:o,stylesCtx:s})[n],...!y&&Ld({theme:e,styles:r?.styles,props:r?.props||o,stylesCtx:s})[n],...M5({theme:e,props:o,stylesCtx:s,vars:h,varsResolver:m,selector:n,themeName:t,headless:g}),...c===n?Ax({style:f,theme:e}):null,...Ax({style:r?.style,theme:e})}}function I5({props:e,stylesCtx:t,themeName:n}){const r=kn(),o=i5()?.();return{getTransformedStyles:c=>o?[...c.map(f=>o(f,{props:e,theme:r,ctx:t})),...n.map(f=>o(r.components[f]?.styles,{props:e,theme:r,ctx:t}))].filter(Boolean):[],withStylesTransform:!!o}}function Ue({name:e,classes:t,props:n,stylesCtx:r,className:o,style:s,rootSelector:c="root",unstyled:u,classNames:f,styles:h,vars:m,varsResolver:g,attributes:y}){const x=kn(),S=e5(),w=t5(),C=n5(),T=(Array.isArray(e)?e:[e]).filter(_=>_),{withStylesTransform:R,getTransformedStyles:E}=I5({props:n,stylesCtx:r,themeName:T});return(_,k)=>({className:P5({theme:x,options:k,themeName:T,selector:_,classNamesPrefix:S,classNames:f,classes:t,unstyled:u,className:o,rootSelector:c,props:n,stylesCtx:r,withStaticClasses:w,headless:C,transformedStyles:E([k?.styles,h])}),style:L5({theme:x,themeName:T,selector:_,options:k,props:n,stylesCtx:r,rootSelector:c,styles:h,style:s,vars:m,varsResolver:g,headless:C,withStylesTransform:R}),...y?.[_]})}function $l(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 z5({keepTransitions:e}={}){const t=v.useRef(kp),n=v.useRef(-1),r=v.useContext(Db),o=cm(),s=v.useRef(o?.());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=EM("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 oe(e,t,n){const r=kn(),o=r.components[e]?.defaultProps,s=typeof o=="function"?o(r):o;return{...t,...s,..._s(n)}}function Iy(e){return pn(e).reduce((t,n)=>e[n]!==void 0?`${t}${fM(n)}:${e[n]};`:t,"").trim()}function $5({selector:e,styles:t,media:n,container:r}){const o=t?Iy(t):"",s=Array.isArray(n)?n.map(u=>`@media${u.query}{${e}{${Iy(u.styles)}}}`):[],c=Array.isArray(r)?r.map(u=>`@container ${u.query}{${e}{${Iy(u.styles)}}}`):[];return`${o?`${e}{${o}}`:""}${s.join("")}${c.join("")}`.trim()}function Ul(e){const t=cm();return a.jsx("style",{"data-mantine-styles":"inline",nonce:t?.(),dangerouslySetInnerHTML:{__html:$5(e)}})}function Aa(e){const{m:t,mx:n,my:r,mt:o,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:k,c:L,opacity:D,ff:P,fz:$,fw:U,lts:W,ta:Y,lh:ee,fs:B,tt:G,td:M,w:I,miw:z,maw:V,h:K,mih:O,mah:F,bgsz:se,bgp:de,bgr:xe,bga:Ce,pos:we,top:Ye,left:De,bottom:ht,right:Rt,inset:at,display:Ze,flex:mt,hiddenFrom:Dt,visibleFrom:jt,lightHidden:Ae,darkHidden:Ne,sx:Me,...Ie}=e;return{styleProps:_s({m:t,mx:n,my:r,mt:o,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:k,c:L,opacity:D,ff:P,fz:$,fw:U,lts:W,ta:Y,lh:ee,fs:B,tt:G,td:M,w:I,miw:z,maw:V,h:K,mih:O,mah:F,bgsz:se,bgp:de,bgr:xe,bga:Ce,pos:we,top:Ye,left:De,bottom:ht,right:Rt,inset:at,display:Ze,flex:mt,bdrs:_,hiddenFrom:Dt,visibleFrom:jt,lightHidden:Ae,darkHidden:Ne,sx:Me}),rest:Ie}}const U5={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=Jr({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 B5(e,t){const n=Jr({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:Nb(e,t)}function V5(e,t){if(typeof e=="number")return ce(e);if(typeof e=="string"){const[n,r,...o]=e.split(" ").filter(c=>c.trim()!=="");let s=`${ce(n)}`;return r&&(s+=` ${r}`),o.length>0&&(s+=` ${Nb(o.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 F5(e){return typeof e=="string"&&e in TE?TE[e]:e}const H5=["h1","h2","h3","h4","h5","h6"];function q5(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&H5.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?ce(e):e}function G5(e){return e}const W5=["h1","h2","h3","h4","h5","h6"];function Q5(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&W5.includes(e)?`var(--mantine-${e}-line-height)`:e}function Y5(e,t){return typeof e=="string"&&e in t.radius?`var(--mantine-radius-${e})`:typeof e=="number"||typeof e=="string"?ce(e):e}function K5(e){return typeof e=="number"?ce(e):e}function X5(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 zy={color:Nb,textColor:B5,fontSize:q5,spacing:X5,radius:Y5,identity:G5,size:K5,lineHeight:Q5,fontFamily:F5,border:V5};function RE(e){return e.replace("(min-width: ","").replace("em)","")}function J5({media:e,...t}){const r=Object.keys(e).sort((o,s)=>Number(RE(o))-Number(RE(s))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function Z5(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function e9(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function t9(e){return typeof e=="object"&&e!==null?pn(e).filter(t=>t!=="base"):[]}function n9(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function m2({styleProps:e,data:t,theme:n}){return J5(pn(e).reduce((r,o)=>{if(o==="hiddenFrom"||o==="visibleFrom"||o==="sx")return r;const s=t[o],c=Array.isArray(s.property)?s.property:[s.property],u=e9(e[o]);if(!Z5(e[o]))return c.forEach(h=>{r.inlineStyles[h]=zy[s.type](u,n)}),r;r.hasResponsiveStyles=!0;const f=t9(e[o]);return c.forEach(h=>{u!=null&&(r.styles[h]=zy[s.type](u,n)),f.forEach(m=>{const g=`(min-width: ${n.breakpoints[m]})`;r.media[g]={...r.media[g],[h]:zy[s.type](n9(e[o],m),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function af(){return`__m__-${v.useId().replace(/[:«»]/g,"")}`}function g2(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...g2(r,t)}),{}):typeof e=="function"?e(t):e??{}}function v2(e){return e.startsWith("data-")?e:`data-${e}`}function r9(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[v2(n)]=e[n]),t},{})}function y2(e){return e?typeof e=="string"?{[v2(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...y2(n)}),{}):r9(e):null}function kx(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...kx(r,t)}),{}):typeof e=="function"?e(t):e??{}}function i9({theme:e,style:t,vars:n,styleProps:r}){const o=kx(t,e),s=kx(n,e);return{...o,...s,...r}}const x2=v.forwardRef(({component:e,style:t,__vars:n,className:r,variant:o,mod:s,size:c,hiddenFrom:u,visibleFrom:f,lightHidden:h,darkHidden:m,renderRoot:g,__size:y,...x},S)=>{const w=kn(),C=e||"div",{styleProps:T,rest:R}=Aa(x),_=r5()?.()?.(T.sx),k=af(),L=m2({styleProps:T,theme:w,data:U5}),D={ref:S,style:i9({theme:w,style:t,vars:n,styleProps:L.inlineStyles}),className:Ft(r,_,{[k]:L.hasResponsiveStyles,"mantine-light-hidden":h,"mantine-dark-hidden":m,[`mantine-hidden-from-${u}`]:u,[`mantine-visible-from-${f}`]:f}),"data-variant":o,"data-size":Z_(c)?void 0:c||void 0,size:y,...y2(s),...R};return a.jsxs(a.Fragment,{children:[L.hasResponsiveStyles&&a.jsx(Ul,{selector:`.${k}`,styles:L.styles,media:L.media}),typeof g=="function"?g(D):a.jsx(C,{...D})]})});x2.displayName="@mantine/core/Box";const le=x2;function b2(e){return e}function o9(e){const t=e;return n=>{const r=v.forwardRef((o,s)=>a.jsx(t,{...n,...o,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r}}function ve(e){const t=v.forwardRef(e);return t.extend=b2,t.withProps=n=>{const r=v.forwardRef((o,s)=>a.jsx(t,{...n,...o,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t}function ar(e){const t=v.forwardRef(e);return t.withProps=n=>{const r=v.forwardRef((o,s)=>a.jsx(t,{...n,...o,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t.extend=b2,t}const a9=v.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function As(){return v.useContext(a9)}var $y={exports:{}},Tr={};var _E;function s9(){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},o=Symbol.for("react.portal");function s(f,h,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,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 S2(){if(DE)return $y.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(),$y.exports=s9(),$y.exports}var Ob=S2();const Cd=om(Ob);function dm(){return typeof window<"u"}function lu(e){return j2(e)?(e.nodeName||"").toLowerCase():"#document"}function Kr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qo(e){var t;return(t=(j2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function j2(e){return dm()?e instanceof Node||e instanceof Kr(e).Node:!1}function Rn(e){return dm()?e instanceof Element||e instanceof Kr(e).Element:!1}function pi(e){return dm()?e instanceof HTMLElement||e instanceof Kr(e).HTMLElement:!1}function Px(e){return!dm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Kr(e).ShadowRoot}const l9=new Set(["inline","contents"]);function sf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$i(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!l9.has(o)}const c9=new Set(["table","td","th"]);function u9(e){return c9.has(lu(e))}const d9=[":popover-open",":modal"];function fm(e){return d9.some(t=>{try{return e.matches(t)}catch{return!1}})}const f9=["transform","translate","scale","rotate","perspective"],h9=["transform","translate","scale","rotate","perspective","filter"],p9=["paint","layout","strict","content"];function Mb(e){const t=hm(),n=Rn(e)?$i(e):e;return f9.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)||h9.some(r=>(n.willChange||"").includes(r))||p9.some(r=>(n.contain||"").includes(r))}function m9(e){let t=wa(e);for(;pi(t)&&!ba(t);){if(Mb(t))return t;if(fm(t))return null;t=wa(t)}return null}function hm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const g9=new Set(["html","body","#document"]);function ba(e){return g9.has(lu(e))}function $i(e){return Kr(e).getComputedStyle(e)}function pm(e){return Rn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wa(e){if(lu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Px(e)&&e.host||Qo(e);return Px(t)?t.host:t}function w2(e){const t=wa(e);return ba(t)?e.ownerDocument?e.ownerDocument.body:e.body:pi(t)&&sf(t)?t:w2(t)}function Sa(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=w2(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Kr(o);if(s){const u=Nx(c);return t.concat(c,c.visualViewport||[],sf(o)?o:[],u&&n?Sa(u):[])}return t.concat(o,Sa(o,[],n))}function Nx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const v9=["top","right","bottom","left"],fo=Math.min,Ar=Math.max,Np=Math.round,rp=Math.floor,Mo=e=>({x:e,y:e}),y9={left:"right",right:"left",bottom:"top",top:"bottom"},x9={start:"end",end:"start"};function Ox(e,t,n){return Ar(e,fo(t,n))}function Vo(e,t){return typeof e=="function"?e(t):e}function ho(e){return e.split("-")[0]}function cu(e){return e.split("-")[1]}function Lb(e){return e==="x"?"y":"x"}function Ib(e){return e==="y"?"height":"width"}const b9=new Set(["top","bottom"]);function lo(e){return b9.has(ho(e))?"y":"x"}function zb(e){return Lb(lo(e))}function S9(e,t,n){n===void 0&&(n=!1);const r=cu(e),o=zb(e),s=Ib(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=Op(c)),[c,Op(c)]}function j9(e){const t=Op(e);return[Mx(e),t,Mx(t)]}function Mx(e){return e.replace(/start|end/g,t=>x9[t])}const AE=["left","right"],kE=["right","left"],w9=["top","bottom"],C9=["bottom","top"];function E9(e,t,n){switch(e){case"top":case"bottom":return n?t?kE:AE:t?AE:kE;case"left":case"right":return t?w9:C9;default:return[]}}function T9(e,t,n,r){const o=cu(e);let s=E9(ho(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Mx)))),s}function Op(e){return e.replace(/left|right|bottom|top/g,t=>y9[t])}function R9(e){return{top:0,right:0,bottom:0,left:0,...e}}function $b(e){return typeof e!="number"?R9(e):{top:e,right:e,bottom:e,left:e}}function Kc(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function _9(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function D9(){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 A9(){return/apple/i.test(navigator.vendor)}function k9(){return _9().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function P9(){return D9().includes("jsdom/")}const PE="data-floating-ui-focusable",N9="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 zd(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Px(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Uc(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Uy(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 O9(e){return e.matches("html,body")}function pl(e){return e?.ownerDocument||document}function M9(e){return pi(e)&&e.matches(N9)}function L9(e){if(!e||P9())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function I9(e){return e?e.hasAttribute(PE)?e:e.querySelector("["+PE+"]")||e:null}function xp(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...xp(e,o.id,n)])}function z9(e){return"nativeEvent"in e}function Lx(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var $9=typeof document<"u",U9=function(){},Lo=$9?v.useLayoutEffect:U9;const B9={...wb};function ip(e){const t=v.useRef(e);return Lo(()=>{t.current=e}),t}const V9=B9.useInsertionEffect,F9=V9||(e=>e());function Po(e){const t=v.useRef(()=>{});return F9(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function OE(e,t,n){let{reference:r,floating:o}=e;const s=lo(t),c=zb(t),u=Ib(c),f=ho(t),h=s==="y",m=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,y=r[u]/2-o[u]/2;let x;switch(f){case"top":x={x:m,y:r.y-o.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-o.width,y:g};break;default:x={x:r.x,y:r.y}}switch(cu(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 H9(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:u,strategy:f}=e,{boundary:h="clippingAncestors",rootBoundary:m="viewport",elementContext:g="floating",altBoundary:y=!1,padding:x=0}=Vo(t,e),S=$b(x),C=u[y?g==="floating"?"reference":"floating":g],T=Kc(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:o,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},k=Kc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:E,strategy:f}):R);return{top:(T.top-k.top+S.top)/_.y,bottom:(k.bottom-T.bottom+S.bottom)/_.y,left:(T.left-k.left+S.left)/_.x,right:(k.right-T.right+S.right)/_.x}}const q9=async(e,t,n)=>{const{placement:r="bottom",strategy:o="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:o}),{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:k,reset:L}=await R({x:m,y:g,initialPlacement:r,placement:y,strategy:o,middlewareData:x,rects:h,platform:{...c,detectOverflow:(w=c.detectOverflow)!=null?w:H9},elements:{reference:e,floating:t}});m=E??m,g=_??g,x={...x,[T]:{...x[T],...k}},L&&S<=50&&(S++,typeof L=="object"&&(L.placement&&(y=L.placement),L.rects&&(h=L.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:m,y:g}=OE(h,y,f)),C=-1)}return{x:m,y:g,placement:y,strategy:o,middlewareData:x}},G9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:c,elements:u,middlewareData:f}=t,{element:h,padding:m=0}=Vo(e,t)||{};if(h==null)return{};const g=$b(m),y={x:n,y:r},x=zb(o),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],k=y[x]-s.reference[x],L=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let D=L?L[E]:0;(!D||!await(c.isElement==null?void 0:c.isElement(L)))&&(D=u.floating[E]||s.floating[S]);const P=_/2-k/2,$=D/2-w[S]/2-1,U=fo(g[T],$),W=fo(g[R],$),Y=U,ee=D-w[S]-W,B=D/2-w[S]/2+P,G=Ox(Y,B,ee),M=!f.arrow&&cu(o)!=null&&B!==G&&s.reference[S]/2-(B<Y?U:W)-w[S]/2<0,I=M?B<Y?B-Y:B-ee:0;return{[x]:y[x]+I,data:{[x]:G,centerOffset:B-G-I,...M&&{alignmentOffset:I}},reset:M}}}),W9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,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}=Vo(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const T=ho(o),R=lo(u),E=ho(u)===u,_=await(f.isRTL==null?void 0:f.isRTL(h.floating)),k=y||(E||!w?[Op(u)]:j9(u)),L=S!=="none";!y&&L&&k.push(...T9(u,w,S,_));const D=[u,...k],P=await f.detectOverflow(t,C),$=[];let U=((r=s.flip)==null?void 0:r.overflows)||[];if(m&&$.push(P[T]),g){const B=S9(o,c,_);$.push(P[B[0]],P[B[1]])}if(U=[...U,{placement:o,overflows:$}],!$.every(B=>B<=0)){var W,Y;const B=(((W=s.flip)==null?void 0:W.index)||0)+1,G=D[B];if(G&&(!(g==="alignment"?R!==lo(G):!1)||U.every(z=>lo(z.placement)===R?z.overflows[0]>0:!0)))return{data:{index:B,overflows:U},reset:{placement:G}};let M=(Y=U.filter(I=>I.overflows[0]<=0).sort((I,z)=>I.overflows[1]-z.overflows[1])[0])==null?void 0:Y.placement;if(!M)switch(x){case"bestFit":{var ee;const I=(ee=U.filter(z=>{if(L){const V=lo(z.placement);return V===R||V==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(V=>V>0).reduce((V,K)=>V+K,0)]).sort((z,V)=>z[1]-V[1])[0])==null?void 0:ee[0];I&&(M=I);break}case"initialPlacement":M=u;break}if(o!==M)return{reset:{placement:M}}}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 v9.some(t=>e[t]>=0)}const Q9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Vo(e,t);switch(o){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 C2(e){const t=fo(...e.map(s=>s.left)),n=fo(...e.map(s=>s.top)),r=Ar(...e.map(s=>s.right)),o=Ar(...e.map(s=>s.bottom));return{x:t,y:n,width:r-t,height:o-n}}function Y9(e){const t=e.slice().sort((o,s)=>o.y-s.y),n=[];let r=null;for(let o=0;o<t.length;o++){const s=t[o];!r||s.y-r.y>r.height/2?n.push([s]):n[n.length-1].push(s),r=s}return n.map(o=>Kc(C2(o)))}const K9=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:c}=t,{padding:u=2,x:f,y:h}=Vo(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),g=Y9(m),y=Kc(C2(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(lo(n)==="y"){const U=g[0],W=g[g.length-1],Y=ho(n)==="top",ee=U.top,B=W.bottom,G=Y?U.left:W.left,M=Y?U.right:W.right,I=M-G,z=B-ee;return{top:ee,bottom:B,left:G,right:M,width:I,height:z,x:G,y:ee}}const C=ho(n)==="left",T=Ar(...g.map(U=>U.right)),R=fo(...g.map(U=>U.left)),E=g.filter(U=>C?U.left===R:U.right===T),_=E[0].top,k=E[E.length-1].bottom,L=R,D=T,P=D-L,$=k-_;return{top:_,bottom:k,left:L,right:D,width:P,height:$,x:L,y:_}}return y}const w=await s.getElementRects({reference:{getBoundingClientRect:S},floating:r.floating,strategy:c});return o.reference.x!==w.reference.x||o.reference.y!==w.reference.y||o.reference.width!==w.reference.width||o.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},E2=new Set(["left","top"]);async function X9(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=ho(n),u=cu(n),f=lo(n)==="y",h=E2.has(c)?-1:1,m=s&&f?-1:1,g=Vo(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 J9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:u}=t,f=await X9(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+f.x,y:s+f.y,data:{...f,placement:c}}}}},Z9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,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}=Vo(e,t),m={x:n,y:r},g=await s.detectOverflow(t,h),y=lo(ho(o)),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=Ox(E,S,_)}if(u){const T=y==="y"?"top":"left",R=y==="y"?"bottom":"right",E=w+g[T],_=w-g[R];w=Ox(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}}}}}},eL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:c}=t,{offset:u=0,mainAxis:f=!0,crossAxis:h=!0}=Vo(e,t),m={x:n,y:r},g=lo(o),y=Lb(g);let x=m[y],S=m[g];const w=Vo(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,k=s.reference[y]+s.reference[E]-C.mainAxis;x<_?x=_:x>k&&(x=k)}if(h){var T,R;const E=y==="y"?"width":"height",_=E2.has(ho(o)),k=s.reference[g]-s.floating[E]+(_&&((T=c.offset)==null?void 0:T[g])||0)+(_?0:C.crossAxis),L=s.reference[g]+s.reference[E]+(_?0:((R=c.offset)==null?void 0:R[g])||0)-(_?C.crossAxis:0);S<k?S=k:S>L&&(S=L)}return{[y]:x,[g]:S}}}},tL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:u}=t,{apply:f=()=>{},...h}=Vo(e,t),m=await c.detectOverflow(t,h),g=ho(o),y=cu(o),x=lo(o)==="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,_=fo(w-m[C],R),k=fo(S-m[T],E),L=!t.middlewareData.shift;let D=_,P=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=R),L&&!y){const U=Ar(m.left,0),W=Ar(m.right,0),Y=Ar(m.top,0),ee=Ar(m.bottom,0);x?P=S-2*(U!==0||W!==0?U+W:Ar(m.left,m.right)):D=w-2*(Y!==0||ee!==0?Y+ee:Ar(m.top,m.bottom))}await f({...t,availableWidth:P,availableHeight:D});const $=await c.getDimensions(u.floating);return S!==$.width||w!==$.height?{reset:{rects:!0}}:{}}}};function T2(e){const t=$i(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=pi(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,u=Np(n)!==s||Np(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}function Ub(e){return Rn(e)?e:e.contextElement}function Gc(e){const t=Ub(e);if(!pi(t))return Mo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=T2(t);let c=(s?Np(n.width):n.width)/r,u=(s?Np(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const nL=Mo(0);function R2(e){const t=Kr(e);return!hm()||!t.visualViewport?nL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Kr(e)?!1:t}function El(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ub(e);let c=Mo(1);t&&(r?Rn(r)&&(c=Gc(r)):c=Gc(e));const u=rL(s,n,r)?R2(s):Mo(0);let f=(o.left+u.x)/c.x,h=(o.top+u.y)/c.y,m=o.width/c.x,g=o.height/c.y;if(s){const y=Kr(s),x=r&&Rn(r)?Kr(r):r;let S=y,w=Nx(S);for(;w&&r&&x!==S;){const C=Gc(w),T=w.getBoundingClientRect(),R=$i(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=Kr(w),w=Nx(S)}}return Kc({width:m,height:g,x:f,y:h})}function mm(e,t){const n=pm(e).scrollLeft;return t?t.left+n:El(Qo(e)).left+n}function _2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-mm(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function iL(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=Qo(r),u=t?fm(t.floating):!1;if(r===c||u&&s)return n;let f={scrollLeft:0,scrollTop:0},h=Mo(1);const m=Mo(0),g=pi(r);if((g||!g&&!s)&&((lu(r)!=="body"||sf(c))&&(f=pm(r)),pi(r))){const x=El(r);h=Gc(r),m.x=x.x+r.clientLeft,m.y=x.y+r.clientTop}const y=c&&!g&&!s?_2(c,f):Mo(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 oL(e){return Array.from(e.getClientRects())}function aL(e){const t=Qo(e),n=pm(e),r=e.ownerDocument.body,o=Ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+mm(e);const u=-n.scrollTop;return $i(r).direction==="rtl"&&(c+=Ar(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const IE=25;function sL(e,t){const n=Kr(e),r=Qo(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(o){s=o.width,c=o.height;const m=hm();(!m||m&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}const h=mm(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 lL=new Set(["absolute","fixed"]);function cL(e,t){const n=El(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=pi(e)?Gc(e):Mo(1),c=e.clientWidth*s.x,u=e.clientHeight*s.y,f=o*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=sL(e,n);else if(t==="document")r=aL(Qo(e));else if(Rn(t))r=cL(t,n);else{const o=R2(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Kc(r)}function D2(e,t){const n=wa(e);return n===t||!Rn(n)||ba(n)?!1:$i(n).position==="fixed"||D2(n,t)}function uL(e,t){const n=t.get(e);if(n)return n;let r=Sa(e,[],!1).filter(u=>Rn(u)&&lu(u)!=="body"),o=null;const s=$i(e).position==="fixed";let c=s?wa(e):e;for(;Rn(c)&&!ba(c);){const u=$i(c),f=Mb(c);!f&&u.position==="fixed"&&(o=null),(s?!f&&!o:!f&&u.position==="static"&&!!o&&lL.has(o.position)||sf(c)&&!f&&D2(e,c))?r=r.filter(m=>m!==c):o=u,c=wa(c)}return t.set(e,r),r}function dL(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?fm(t)?[]:uL(t,this._c):[].concat(n),r],u=c[0],f=c.reduce((h,m)=>{const g=zE(t,m,o);return h.top=Ar(g.top,h.top),h.right=fo(g.right,h.right),h.bottom=fo(g.bottom,h.bottom),h.left=Ar(g.left,h.left),h},zE(t,u,o));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function fL(e){const{width:t,height:n}=T2(e);return{width:t,height:n}}function hL(e,t,n){const r=pi(t),o=Qo(t),s=n==="fixed",c=El(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const f=Mo(0);function h(){f.x=mm(o)}if(r||!r&&!s)if((lu(t)!=="body"||sf(o))&&(u=pm(t)),r){const x=El(t,!0,s,t);f.x=x.x+t.clientLeft,f.y=x.y+t.clientTop}else o&&h();s&&!r&&o&&h();const m=o&&!r&&!s?_2(o,u):Mo(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 By(e){return $i(e).position==="static"}function $E(e,t){if(!pi(e)||$i(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qo(e)===n&&(n=n.ownerDocument.body),n}function A2(e,t){const n=Kr(e);if(fm(e))return n;if(!pi(e)){let o=wa(e);for(;o&&!ba(o);){if(Rn(o)&&!By(o))return o;o=wa(o)}return n}let r=$E(e,t);for(;r&&u9(r)&&By(r);)r=$E(r,t);return r&&ba(r)&&By(r)&&!Mb(r)?n:r||m9(e)||n}const pL=async function(e){const t=this.getOffsetParent||A2,n=this.getDimensions,r=await n(e.floating);return{reference:hL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mL(e){return $i(e).direction==="rtl"}const gL={convertOffsetParentRelativeRectToViewportRelativeRect:iL,getDocumentElement:Qo,getClippingRect:dL,getOffsetParent:A2,getElementRects:pL,getClientRects:oL,getDimensions:fL,getScale:Gc,isElement:Rn,isRTL:mL};function k2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vL(e,t){let n=null,r;const o=Qo(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=rp(g),w=rp(o.clientWidth-(m+y)),C=rp(o.clientHeight-(g+x)),T=rp(m),E={rootMargin:-S+"px "+-w+"px "+-C+"px "+-T+"px",threshold:Ar(0,fo(1,f))||1};let _=!0;function k(L){const D=L[0].intersectionRatio;if(D!==f){if(!_)return c();D?c(!1,D):r=setTimeout(()=>{c(!1,1e-7)},1e3)}D===1&&!k2(h,e.getBoundingClientRect())&&c(),_=!1}try{n=new IntersectionObserver(k,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,E)}n.observe(e)}return c(!0),s}function Ix(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,h=Ub(e),m=o||s?[...h?Sa(h):[],...Sa(t)]:[];m.forEach(T=>{o&&T.addEventListener("scroll",n,{passive:!0}),s&&T.addEventListener("resize",n)});const g=h&&u?vL(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?El(e):null;f&&C();function C(){const T=El(e);w&&!k2(w,T)&&n(),w=T,S=requestAnimationFrame(C)}return n(),()=>{var T;m.forEach(R=>{o&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),g?.(),(T=x)==null||T.disconnect(),x=null,f&&cancelAnimationFrame(S)}}const yL=J9,xL=Z9,bL=W9,SL=tL,jL=Q9,UE=G9,wL=K9,CL=eL,EL=(e,t,n)=>{const r=new Map,o={platform:gL,...n},s={...o.platform,_c:r};return q9(e,t,{...o,platform:s})};var TL=typeof document<"u",RL=function(){},bp=TL?v.useLayoutEffect:RL;function Mp(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,o;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(!Mp(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Mp(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function P2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function BE(e,t){const n=P2(e);return Math.round(t*n)/n}function Vy(e){const t=v.useRef(e);return bp(()=>{t.current=e}),t}function _L(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,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);Mp(y,r)||x(r);const[S,w]=v.useState(null),[C,T]=v.useState(null),R=v.useCallback(z=>{z!==L.current&&(L.current=z,w(z))},[]),E=v.useCallback(z=>{z!==D.current&&(D.current=z,T(z))},[]),_=s||S,k=c||C,L=v.useRef(null),D=v.useRef(null),P=v.useRef(m),$=f!=null,U=Vy(f),W=Vy(o),Y=Vy(h),ee=v.useCallback(()=>{if(!L.current||!D.current)return;const z={placement:t,strategy:n,middleware:y};W.current&&(z.platform=W.current),EL(L.current,D.current,z).then(V=>{const K={...V,isPositioned:Y.current!==!1};B.current&&!Mp(P.current,K)&&(P.current=K,Ob.flushSync(()=>{g(K)}))})},[y,t,n,W,Y]);bp(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[h]);const B=v.useRef(!1);bp(()=>(B.current=!0,()=>{B.current=!1}),[]),bp(()=>{if(_&&(L.current=_),k&&(D.current=k),_&&k){if(U.current)return U.current(_,k,ee);ee()}},[_,k,ee,U,$]);const G=v.useMemo(()=>({reference:L,floating:D,setReference:R,setFloating:E}),[R,E]),M=v.useMemo(()=>({reference:_,floating:k}),[_,k]),I=v.useMemo(()=>{const z={position:n,left:0,top:0};if(!M.floating)return z;const V=BE(M.floating,m.x),K=BE(M.floating,m.y);return u?{...z,transform:"translate("+V+"px, "+K+"px)",...P2(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:K}},[n,u,M.floating,m.x,m.y]);return v.useMemo(()=>({...m,update:ee,refs:G,elements:M,floatingStyles:I}),[m,ee,G,M,I])}const DL=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?UE({element:r.current,padding:o}).fn(n):{}:r?UE({element:r,padding:o}).fn(n):{}}}},N2=(e,t)=>({...yL(e),options:[e,t]}),Bb=(e,t)=>({...xL(e),options:[e,t]}),VE=(e,t)=>({...CL(e),options:[e,t]}),Lp=(e,t)=>({...bL(e),options:[e,t]}),AL=(e,t)=>({...SL(e),options:[e,t]}),kL=(e,t)=>({...jL(e),options:[e,t]}),Dd=(e,t)=>({...wL(e),options:[e,t]}),O2=(e,t)=>({...DL(e),options:[e,t]});function M2(e){const t=v.useRef(void 0),n=v.useCallback(r=>{const o=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()=>{o.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 PL="data-floating-ui-focusable",FE="active",HE="selected",NL={...wb};let qE=!1,OL=0;const GE=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+OL++;function ML(){const[e,t]=v.useState(()=>qE?GE():void 0);return Lo(()=>{e==null&&t(GE())},[]),v.useEffect(()=>{qE=!0},[]),e}const LL=NL.useId,L2=LL||ML;function IL(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(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 zL=v.createContext(null),$L=v.createContext(null),Vb=()=>{var e;return((e=v.useContext(zL))==null?void 0:e.id)||null},Fb=()=>v.useContext($L);function Hb(e){return"data-floating-ui-"+e}function Pi(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const WE=Hb("safe-polygon");function Sp(e,t,n){if(n&&!Lx(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 Fy(e){return typeof e=="function"?e():e}function UL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,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=ip(h),C=ip(f),T=ip(n),R=ip(g),E=v.useRef(),_=v.useRef(-1),k=v.useRef(),L=v.useRef(-1),D=v.useRef(!0),P=v.useRef(!1),$=v.useRef(()=>{}),U=v.useRef(!1),W=Po(()=>{var I;const z=(I=o.current.openEvent)==null?void 0:I.type;return z?.includes("mouse")&&z!=="mousedown"});v.useEffect(()=>{if(!u)return;function I(z){let{open:V}=z;V||(Pi(_),Pi(L),D.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){W()&&r(!1,V,"hover")}const z=pl(c.floating).documentElement;return z.addEventListener("mouseleave",I),()=>{z.removeEventListener("mouseleave",I)}},[c.floating,n,r,u,w,W]);const Y=v.useCallback(function(I,z,V){z===void 0&&(z=!0),V===void 0&&(V="hover");const K=Sp(C.current,"close",E.current);K&&!k.current?(Pi(_),_.current=window.setTimeout(()=>r(!1,I,V),K)):z&&(Pi(_),r(!1,I,V))},[C,r]),ee=Po(()=>{$.current(),k.current=void 0}),B=Po(()=>{if(P.current){const I=pl(c.floating).body;I.style.pointerEvents="",I.removeAttribute(WE),P.current=!1}}),G=Po(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);v.useEffect(()=>{if(!u)return;function I(F){if(Pi(_),D.current=!1,m&&!Lx(E.current)||Fy(R.current)>0&&!Sp(C.current,"open"))return;const se=Sp(C.current,"open",E.current);se?_.current=window.setTimeout(()=>{T.current||r(!0,F,"hover")},se):n||r(!0,F,"hover")}function z(F){if(G()){B();return}$.current();const se=pl(c.floating);if(Pi(L),U.current=!1,w.current&&o.current.floatingContext){n||Pi(_),k.current=w.current({...o.current.floatingContext,tree:x,x:F.clientX,y:F.clientY,onClose(){B(),ee(),G()||Y(F,!0,"safe-polygon")}});const xe=k.current;se.addEventListener("mousemove",xe),$.current=()=>{se.removeEventListener("mousemove",xe)};return}(E.current!=="touch"||!zd(c.floating,F.relatedTarget))&&Y(F)}function V(F){G()||o.current.floatingContext&&(w.current==null||w.current({...o.current.floatingContext,tree:x,x:F.clientX,y:F.clientY,onClose(){B(),ee(),G()||Y(F)}})(F))}function K(){Pi(_)}function O(F){G()||Y(F,!1)}if(Rn(c.domReference)){const F=c.domReference,se=c.floating;return n&&F.addEventListener("mouseleave",V),y&&F.addEventListener("mousemove",I,{once:!0}),F.addEventListener("mouseenter",I),F.addEventListener("mouseleave",z),se&&(se.addEventListener("mouseleave",V),se.addEventListener("mouseenter",K),se.addEventListener("mouseleave",O)),()=>{n&&F.removeEventListener("mouseleave",V),y&&F.removeEventListener("mousemove",I),F.removeEventListener("mouseenter",I),F.removeEventListener("mouseleave",z),se&&(se.removeEventListener("mouseleave",V),se.removeEventListener("mouseenter",K),se.removeEventListener("mouseleave",O))}}},[c,u,e,m,y,Y,ee,B,r,n,T,x,C,w,o,G,R]),Lo(()=>{var I;if(u&&n&&(I=w.current)!=null&&(I=I.__options)!=null&&I.blockPointerEvents&&W()){P.current=!0;const V=c.floating;if(Rn(c.domReference)&&V){var z;const K=pl(c.floating).body;K.setAttribute(WE,"");const O=c.domReference,F=x==null||(z=x.nodesRef.current.find(se=>se.id===S))==null||(z=z.context)==null?void 0:z.elements.floating;return F&&(F.style.pointerEvents=""),K.style.pointerEvents="none",O.style.pointerEvents="auto",V.style.pointerEvents="auto",()=>{K.style.pointerEvents="",O.style.pointerEvents="",V.style.pointerEvents=""}}}},[u,n,S,c,x,w,W]),Lo(()=>{n||(E.current=void 0,U.current=!1,ee(),B())},[n,ee,B]),v.useEffect(()=>()=>{ee(),Pi(_),Pi(L),B()},[u,c.domReference,ee,B]);const M=v.useMemo(()=>{function I(z){E.current=z.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(z){const{nativeEvent:V}=z;function K(){!D.current&&!T.current&&r(!0,V,"hover")}m&&!Lx(E.current)||n||Fy(R.current)===0||U.current&&z.movementX**2+z.movementY**2<2||(Pi(L),E.current==="touch"?K():(U.current=!0,L.current=window.setTimeout(K,Fy(R.current))))}}},[m,r,n,T,R]);return v.useMemo(()=>u?{reference:M}:{},[u,M])}const zx=()=>{},I2=v.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:zx,setState:zx,isInstantPhase:!1}),BL=()=>v.useContext(I2);function VL(e){const{children:t,delay:n,timeoutMs:r=0}=e,[o,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 Lo(()=>{o.currentId?c.current===null?c.current=o.currentId:o.isInstantPhase||s({isInstantPhase:!0}):(o.isInstantPhase&&s({isInstantPhase:!1}),c.current=null)},[o.currentId,o.isInstantPhase]),a.jsx(I2.Provider,{value:v.useMemo(()=>({...o,setState:s,setCurrentId:u}),[o,u]),children:t})}function FL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,floatingId:o}=e,{id:s,enabled:c=!0}=t,u=s??o,f=BL(),{currentId:h,setCurrentId:m,initialDelay:g,setState:y,timeoutMs:x}=f;return Lo(()=>{c&&h&&(y({delay:{open:1,close:Sp(g,"close")}}),h!==u&&r(!1))},[c,u,r,y,h,g]),Lo(()=>{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]),Lo(()=>{c&&(m===zx||!n||m(u))},[c,n,m,u]),f}const HL={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},qL={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 GL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,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=Po(typeof f=="function"?f:()=>!1),T=typeof f=="function"?C:f,R=v.useRef(!1),{escapeKey:E,outsidePress:_}=QE(x),{escapeKey:k,outsidePress:L}=QE(S),D=v.useRef(!1),P=Po(B=>{var G;if(!n||!c||!u||B.key!=="Escape"||D.current)return;const M=(G=s.current.floatingContext)==null?void 0:G.nodeId,I=w?xp(w.nodesRef.current,M):[];if(!E&&(B.stopPropagation(),I.length>0)){let z=!0;if(I.forEach(V=>{var K;if((K=V.context)!=null&&K.open&&!V.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}r(!1,z9(B)?B.nativeEvent:B,"escape-key")}),$=Po(B=>{var G;const M=()=>{var I;P(B),(I=Uc(B))==null||I.removeEventListener("keydown",M)};(G=Uc(B))==null||G.addEventListener("keydown",M)}),U=Po(B=>{var G;const M=s.current.insideReactTree;s.current.insideReactTree=!1;const I=R.current;if(R.current=!1,h==="click"&&I||M||typeof T=="function"&&!T(B))return;const z=Uc(B),V="["+Hb("inert")+"]",K=pl(o.floating).querySelectorAll(V);let O=Rn(z)?z:null;for(;O&&!ba(O);){const xe=wa(O);if(ba(xe)||!Rn(xe))break;O=xe}if(K.length&&Rn(z)&&!O9(z)&&!zd(z,o.floating)&&Array.from(K).every(xe=>!zd(O,xe)))return;if(pi(z)&&ee){const xe=ba(z),Ce=$i(z),we=/auto|scroll/,Ye=xe||we.test(Ce.overflowX),De=xe||we.test(Ce.overflowY),ht=Ye&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,Rt=De&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,at=Ce.direction==="rtl",Ze=Rt&&(at?B.offsetX<=z.offsetWidth-z.clientWidth:B.offsetX>z.clientWidth),mt=ht&&B.offsetY>z.clientHeight;if(Ze||mt)return}const F=(G=s.current.floatingContext)==null?void 0:G.nodeId,se=w&&xp(w.nodesRef.current,F).some(xe=>{var Ce;return Uy(B,(Ce=xe.context)==null?void 0:Ce.elements.floating)});if(Uy(B,o.floating)||Uy(B,o.domReference)||se)return;const de=w?xp(w.nodesRef.current,F):[];if(de.length>0){let xe=!0;if(de.forEach(Ce=>{var we;if((we=Ce.context)!=null&&we.open&&!Ce.context.dataRef.current.__outsidePressBubbles){xe=!1;return}}),!xe)return}r(!1,B,"outside-press")}),W=Po(B=>{var G;const M=()=>{var I;U(B),(I=Uc(B))==null||I.removeEventListener(h,M)};(G=Uc(B))==null||G.addEventListener(h,M)});v.useEffect(()=>{if(!n||!c)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=_;let B=-1;function G(K){r(!1,K,"ancestor-scroll")}function M(){window.clearTimeout(B),D.current=!0}function I(){B=window.setTimeout(()=>{D.current=!1},hm()?5:0)}const z=pl(o.floating);u&&(z.addEventListener("keydown",k?$:P,k),z.addEventListener("compositionstart",M),z.addEventListener("compositionend",I)),T&&z.addEventListener(h,L?W:U,L);let V=[];return y&&(Rn(o.domReference)&&(V=Sa(o.domReference)),Rn(o.floating)&&(V=V.concat(Sa(o.floating))),!Rn(o.reference)&&o.reference&&o.reference.contextElement&&(V=V.concat(Sa(o.reference.contextElement)))),V=V.filter(K=>{var O;return K!==((O=z.defaultView)==null?void 0:O.visualViewport)}),V.forEach(K=>{K.addEventListener("scroll",G,{passive:!0})}),()=>{u&&(z.removeEventListener("keydown",k?$:P,k),z.removeEventListener("compositionstart",M),z.removeEventListener("compositionend",I)),T&&z.removeEventListener(h,L?W:U,L),V.forEach(K=>{K.removeEventListener("scroll",G)}),window.clearTimeout(B)}},[s,o,u,T,h,n,r,y,c,E,_,P,k,$,U,L,W]),v.useEffect(()=>{s.current.insideReactTree=!1},[s,T,h]);const Y=v.useMemo(()=>({onKeyDown:P,...m&&{[HL[g]]:B=>{r(!1,B.nativeEvent,"reference-press")},...g!=="click"&&{onClick(B){r(!1,B.nativeEvent,"reference-press")}}}}),[P,r,m,g]),ee=v.useMemo(()=>({onKeyDown:P,onMouseDown(){R.current=!0},onMouseUp(){R.current=!0},[qL[h]]:()=>{s.current.insideReactTree=!0}}),[P,h,s]);return v.useMemo(()=>c?{reference:Y,floating:ee}:{},[c,Y,ee])}function WL(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=L2(),s=v.useRef({}),[c]=v.useState(()=>IL()),u=Vb()!=null,[f,h]=v.useState(r.reference),m=Po((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:o,refs:g}),[t,m,y,c,o,g])}function qb(e){e===void 0&&(e={});const{nodeId:t}=e,n=WL({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=v.useState(null),[u,f]=v.useState(null),m=o?.domReference||s,g=v.useRef(null),y=Fb();Lo(()=>{m&&(g.current=m)},[m]);const x=_L({...e,elements:{...o,...u&&{reference:u}}}),S=v.useCallback(E=>{const _=Rn(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;f(_),x.refs.setReference(_)},[x.refs]),w=v.useCallback(E=>{(Rn(E)||E===null)&&(g.current=E,c(E)),(Rn(x.refs.reference.current)||x.refs.reference.current===null||E!==null&&!Rn(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 Lo(()=>{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 Hy(){return k9()&&A9()}function QL(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,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=Kr(c.domReference);function S(){!n&&pi(c.domReference)&&c.domReference===NE(pl(c.domReference))&&(h.current=!0)}function w(){g.current=!0}function C(){g.current=!1}return x.addEventListener("blur",S),Hy()&&(x.addEventListener("keydown",w,!0),x.addEventListener("pointerdown",C,!0)),()=>{x.removeEventListener("blur",S),Hy()&&(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 o.on("openchange",x),()=>{o.off("openchange",x)}},[o,u]),v.useEffect(()=>()=>{Pi(m)},[]);const y=v.useMemo(()=>({onMouseLeave(){h.current=!1},onFocus(x){if(h.current)return;const S=Uc(x.nativeEvent);if(f&&Rn(S)){if(Hy()&&!x.relatedTarget){if(!g.current&&!M9(S))return}else if(!L9(S))return}r(!0,x.nativeEvent,"focus")},onBlur(x){h.current=!1;const S=x.relatedTarget,w=x.nativeEvent,C=Rn(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||zd((T=s.current.floatingContext)==null?void 0:T.refs.floating.current,R)||zd(c.domReference,R)||C||r(!1,w,"focus")})}}),[s,c.domReference,r,f]);return v.useMemo(()=>u?{reference:y}:{},[u,y])}function qy(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[FE]:c,[HE]:u,...f}=e;s=f}return{...n==="floating"&&{tabIndex:-1,[PL]:""},...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(!(o&&[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 YL(e){e===void 0&&(e=[]);const t=e.map(u=>u?.reference),n=e.map(u=>u?.floating),r=e.map(u=>u?.item),o=v.useCallback(u=>qy(u,e,"reference"),t),s=v.useCallback(u=>qy(u,e,"floating"),n),c=v.useCallback(u=>qy(u,e,"item"),r);return v.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}const KL=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function XL(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:c}=e,{enabled:u=!0,role:f="dialog"}=t,h=L2(),m=((n=s.domReference)==null?void 0:n.id)||h,g=v.useMemo(()=>{var R;return((R=I9(s.floating))==null?void 0:R.id)||c},[s.floating,c]),y=(r=KL.get(f))!=null?r:f,S=Vb()!=null,w=v.useMemo(()=>y==="tooltip"||f==="label"?{["aria-"+(f==="label"?"labelledby":"describedby")]:o?g:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":y==="alertdialog"?"dialog":y,"aria-controls":o?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,o,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 k={role:"option",...E&&{id:g+"-fui-option"}};switch(f){case"select":case"combobox":return{...k,"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[JL,Fi]=Or("ScrollArea.Root component was not found in tree");function Xc(e,t){const n=ul(t);Ll(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const ZL=v.forwardRef((e,t)=>{const{style:n,...r}=e,o=Fi(),[s,c]=v.useState(0),[u,f]=v.useState(0),h=!!(s&&u);return Xc(o.scrollbarX,()=>{const m=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(m),f(m)}),Xc(o.scrollbarY,()=>{const m=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(m),c(m)}),h?a.jsx("div",{...r,ref:t,style:{...n,width:s,height:u}}):null}),eI=v.forwardRef((e,t)=>{const n=Fi(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(ZL,{...e,ref:t}):null}),tI={scrollHideDelay:1e3,type:"hover"},z2=v.forwardRef((e,t)=>{const{type:n,scrollHideDelay:r,scrollbars:o,getStyles:s,...c}=oe("ScrollAreaRoot",tI,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),[k,L]=v.useState(!1),[D,P]=v.useState(!1),$=Fn(t,U=>f(U));return a.jsx(JL,{value:{type:n,scrollHideDelay:r,scrollArea:u,viewport:h,onViewportChange:m,content:g,onContentChange:y,scrollbarX:x,onScrollbarXChange:S,scrollbarXEnabled:k,onScrollbarXEnabledChange:L,scrollbarY:w,onScrollbarYChange:C,scrollbarYEnabled:D,onScrollbarYEnabledChange:P,onCornerWidthChange:R,onCornerHeightChange:_,getStyles:s},children:a.jsx(le,{...c,ref:$,__vars:{"--sa-corner-width":o!=="xy"?"0px":`${T}px`,"--sa-corner-height":o!=="xy"?"0px":`${E}px`}})})});z2.displayName="@mantine/core/ScrollAreaRoot";function $2(e,t){const n=e/t;return Number.isNaN(n)?0:n}function gm(e){const t=$2(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function U2(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 nI(e,[t,n]){return Math.min(n,Math.max(t,e))}function YE(e,t,n="ltr"){const r=gm(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,c=t.content-t.viewport,u=s-r,f=n==="ltr"?[0,c]:[c*-1,0],h=nI(e,f);return U2([0,c],[0,u])(h)}function rI(e,t,n,r="ltr"){const o=gm(n),s=o/2,c=t||s,u=o-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 U2([f,h],g)(e)}function B2(e,t){return e>0&&e<t}function xs(e){return e?parseInt(e,10):0}function Sl(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}const[iI,V2]=Or("ScrollAreaScrollbar was not found in tree"),F2=v.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:u,onDragScroll:f,onWheelScroll:h,onResize:m,...g}=e,y=Fi(),[x,S]=v.useState(null),w=Fn(t,P=>S(P)),C=v.useRef(null),T=v.useRef(""),{viewport:R}=y,E=n.content-n.viewport,_=ul(h),k=ul(u),L=rf(m,10),D=P=>{if(C.current){const $=P.clientX-C.current.left,U=P.clientY-C.current.top;f({x:$,y:U})}};return v.useEffect(()=>{const P=$=>{const U=$.target;x?.contains(U)&&_($,E)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[R,x,E,_]),v.useEffect(k,[n,k]),Xc(x,L),Xc(y.content,L),a.jsx(iI,{value:{scrollbar:x,hasThumb:r,onThumbChange:ul(o),onThumbPointerUp:ul(s),onThumbPositionChange:k,onThumbPointerDown:ul(c)},children:a.jsx("div",{...g,ref:w,"data-mantine-scrollbar":!0,style:{position:"absolute",...g.style},onPointerDown:Sl(e.onPointerDown,P=>{P.preventDefault(),P.button===0&&(P.target.setPointerCapture(P.pointerId),C.current=x.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",D(P))}),onPointerMove:Sl(e.onPointerMove,D),onPointerUp:Sl(e.onPointerUp,P=>{const $=P.target;$.hasPointerCapture(P.pointerId)&&(P.preventDefault(),$.releasePointerCapture(P.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=T.current,C.current=null}})})}),H2=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...s}=e,c=Fi(),[u,f]=v.useState(),h=v.useRef(null),m=Fn(t,h,c.onScrollbarXChange);return v.useEffect(()=>{h.current&&f(getComputedStyle(h.current))},[h]),a.jsx(F2,{"data-orientation":"horizontal",...s,ref:m,sizes:n,style:{...o,"--sa-thumb-width":`${gm(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),B2(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:xs(u.paddingLeft),paddingEnd:xs(u.paddingRight)}})}})});H2.displayName="@mantine/core/ScrollAreaScrollbarX";const q2=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...s}=e,c=Fi(),[u,f]=v.useState(),h=v.useRef(null),m=Fn(t,h,c.onScrollbarYChange);return v.useEffect(()=>{h.current&&f(window.getComputedStyle(h.current))},[]),a.jsx(F2,{...s,"data-orientation":"vertical",ref:m,sizes:n,style:{"--sa-thumb-height":`${gm(n)}px`,...o},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),B2(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:xs(u.paddingTop),paddingEnd:xs(u.paddingBottom)}})}})});q2.displayName="@mantine/core/ScrollAreaScrollbarY";const vm=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=As(),s=Fi(),c=v.useRef(null),u=v.useRef(0),[f,h]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=$2(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)=>rI(x,u.current,f,S);return n==="horizontal"?a.jsx(H2,{...g,ref:t,onThumbPositionChange:()=>{if(s.viewport&&c.current){const x=s.viewport.scrollLeft,S=YE(x,f,o);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,o))}}):n==="vertical"?a.jsx(q2,{...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});vm.displayName="@mantine/core/ScrollAreaScrollbarVisible";const Wb=v.forwardRef((e,t)=>{const n=Fi(),{forceMount:r,...o}=e,[s,c]=v.useState(!1),u=e.orientation==="horizontal",f=rf(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;c(u?h:m)}},10);return Xc(n.viewport,f),Xc(n.content,f),r||s?a.jsx(vm,{"data-state":s?"visible":"hidden",...o,ref:t}):null});Wb.displayName="@mantine/core/ScrollAreaScrollbarAuto";const G2=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Fi(),[s,c]=v.useState(!1);return v.useEffect(()=>{const{scrollArea:u}=o;let f=0;if(u){const h=()=>{window.clearTimeout(f),c(!0)},m=()=>{f=window.setTimeout(()=>c(!1),o.scrollHideDelay)};return u.addEventListener("pointerenter",h),u.addEventListener("pointerleave",m),()=>{window.clearTimeout(f),u.removeEventListener("pointerenter",h),u.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),n||s?a.jsx(Wb,{"data-state":s?"visible":"hidden",...r,ref:t}):null});G2.displayName="@mantine/core/ScrollAreaScrollbarHover";const oI=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Fi(),s=e.orientation==="horizontal",[c,u]=v.useState("hidden"),f=rf(()=>u("idle"),100);return v.useEffect(()=>{if(c==="idle"){const h=window.setTimeout(()=>u("hidden"),o.scrollHideDelay);return()=>window.clearTimeout(h)}},[c,o.scrollHideDelay]),v.useEffect(()=>{const{viewport:h}=o,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)}},[o.viewport,s,f]),n||c!=="hidden"?a.jsx(vm,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Sl(e.onPointerEnter,()=>u("interacting")),onPointerLeave:Sl(e.onPointerLeave,()=>u("idle"))}):null}),$x=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Fi(),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=o,u=e.orientation==="horizontal";return v.useEffect(()=>(u?s(!0):c(!0),()=>{u?s(!1):c(!1)}),[u,s,c]),o.type==="hover"?a.jsx(G2,{...r,ref:t,forceMount:n}):o.type==="scroll"?a.jsx(oI,{...r,ref:t,forceMount:n}):o.type==="auto"?a.jsx(Wb,{...r,ref:t,forceMount:n}):o.type==="always"?a.jsx(vm,{...r,ref:t}):null});$x.displayName="@mantine/core/ScrollAreaScrollbar";function aI(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){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(o)})(),()=>window.cancelAnimationFrame(r)}const W2=v.forwardRef((e,t)=>{const{style:n,...r}=e,o=Fi(),s=V2(),{onThumbPositionChange:c}=s,u=Fn(t,m=>s.onThumbChange(m)),f=v.useRef(void 0),h=rf(()=>{f.current&&(f.current(),f.current=void 0)},100);return v.useEffect(()=>{const{viewport:m}=o;if(m){const g=()=>{if(h(),!f.current){const y=aI(m,c);f.current=y,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[o.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:Sl(e.onPointerDownCapture,m=>{const y=m.target.getBoundingClientRect(),x=m.clientX-y.left,S=m.clientY-y.top;s.onThumbPointerDown({x,y:S})}),onPointerUp:Sl(e.onPointerUp,s.onThumbPointerUp)})});W2.displayName="@mantine/core/ScrollAreaThumb";const Ux=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=V2();return n||o.hasThumb?a.jsx(W2,{ref:t,...r}):null});Ux.displayName="@mantine/core/ScrollAreaThumb";const Q2=v.forwardRef(({children:e,style:t,onWheel:n,...r},o)=>{const s=Fi(),c=Fn(o,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})})});Q2.displayName="@mantine/core/ScrollAreaViewport";const Y2={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},sI=(e,{scrollbarSize:t,overscrollBehavior:n,scrollbars:r})=>{let o=n;return n&&r&&(r==="x"?o=`${n} auto`:r==="y"&&(o=`auto ${n}`)),{root:{"--scrollarea-scrollbar-size":ce(t),"--scrollarea-over-scroll-behavior":o}}},Zr=ve((e,t)=>{const n=oe("ScrollArea",Y2,e),{classNames:r,className:o,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:k,...L}=n,[D,P]=v.useState(!1),[$,U]=v.useState(!1),[W,Y]=v.useState(!1),ee=Ue({name:"ScrollArea",props:n,classes:Gb,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:k,vars:h,varsResolver:sI}),B=v.useRef(null),G=M2([x,B]);return v.useEffect(()=>{if(!B.current||C!=="present")return;const M=B.current,I=new ResizeObserver(()=>{const{scrollHeight:z,clientHeight:V,scrollWidth:K,clientWidth:O}=M;U(z>V),Y(K>O)});return I.observe(M),()=>I.disconnect()},[B,C]),a.jsxs(z2,{getStyles:ee,type:m==="never"?"always":m,scrollHideDelay:g,ref:t,scrollbars:T,...ee("root"),...L,children:[a.jsx(Q2,{...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"&&!W?"true":void 0,"data-vertical-hidden":C==="present"&&!$?"true":void 0,onScroll:M=>{y?.onScroll?.(M),S?.({x:M.currentTarget.scrollLeft,y:M.currentTarget.scrollTop});const{scrollTop:I,scrollHeight:z,clientHeight:V}=M.currentTarget;I-(z-V)>=-.8&&R?.(),I===0&&E?.()},children:w}),(T==="xy"||T==="x")&&a.jsx($x,{...ee("scrollbar"),orientation:"horizontal","data-hidden":m==="never"||C==="present"&&!W?!0:void 0,forceMount:!0,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:a.jsx(Ux,{...ee("thumb")})}),(T==="xy"||T==="y")&&a.jsx($x,{...ee("scrollbar"),orientation:"vertical","data-hidden":m==="never"||C==="present"&&!$?!0:void 0,forceMount:!0,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:a.jsx(Ux,{...ee("thumb")})}),a.jsx(eI,{...ee("corner"),"data-hovered":D||void 0,"data-hidden":m==="never"||void 0})]})});Zr.displayName="@mantine/core/ScrollArea";const ym=ve((e,t)=>{const{children:n,classNames:r,styles:o,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:k,...L}=oe("ScrollAreaAutosize",Y2,e),D=v.useRef(null),P=M2([g,D]),[$,U]=v.useState(!1),W=v.useRef(!1);return v.useEffect(()=>{if(!k)return;const Y=D.current;if(!Y)return;const ee=()=>{const G=Y.scrollHeight>Y.clientHeight;G!==$&&(W.current?k?.(G):(W.current=!0,G&&k?.(!0)),U(G))};ee();const B=new ResizeObserver(ee);return B.observe(Y),()=>B.disconnect()},[k,$]),a.jsx(le,{...L,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(Zr,{classNames:r,styles:o,scrollHideDelay:c,scrollbarSize:s,type:u,dir:f,offsetScrollbars:h,overscrollBehavior:m,viewportRef:P,onScrollPositionChange:y,unstyled:x,variant:S,viewportProps:w,vars:R,scrollbars:C,onBottomReached:E,onTopReached:_,"data-autosize":"true",children:n})})})});Zr.classes=Gb;ym.displayName="@mantine/core/ScrollAreaAutosize";ym.classes=Gb;Zr.Autosize=ym;var K2={root:"m_87cf2631"};const lI={__staticSelector:"UnstyledButton"},_n=ar((e,t)=>{const n=oe("UnstyledButton",lI,e),{className:r,component:o="button",__staticSelector:s,unstyled:c,classNames:u,styles:f,style:h,attributes:m,...g}=n,y=Ue({name:s,props:n,classes:K2,className:r,style:h,classNames:u,styles:f,unstyled:c,attributes:m});return a.jsx(le,{...y("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...g})});_n.classes=K2;_n.displayName="@mantine/core/UnstyledButton";var X2={root:"m_515a97f8"};const Qb=ve((e,t)=>{const n=oe("VisuallyHidden",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,attributes:h,...m}=n,g=Ue({name:"VisuallyHidden",classes:X2,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:h});return a.jsx(le,{component:"span",ref:t,...g("root"),...m})});Qb.classes=X2;Qb.displayName="@mantine/core/VisuallyHidden";var J2={root:"m_1b7284a3"};const cI=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:Ht(t),"--paper-shadow":Tb(n)}}),hr=ar((e,t)=>{const n=oe("Paper",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,withBorder:f,vars:h,radius:m,shadow:g,variant:y,mod:x,attributes:S,...w}=n,C=Ue({name:"Paper",props:n,classes:J2,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:h,varsResolver:cI});return a.jsx(le,{ref:t,mod:[{"data-with-border":f},x],...C("root"),variant:y,...w})});hr.classes=J2;hr.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,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const uI={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function dI({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:c,dir:u}){const[f,h="center"]=e.split("-"),m={width:t,height:t,transform:"rotate(45deg)",position:"absolute",[uI[f]]:r},g=-t/2;return f==="left"?{...m,...KE(h,c,n,o),right:g,borderLeftColor:"transparent",borderBottomColor:"transparent",clipPath:"polygon(100% 0, 0 0, 100% 100%)"}:f==="right"?{...m,...KE(h,c,n,o),left:g,borderRightColor:"transparent",borderTopColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 100%)"}:f==="top"?{...m,...XE(h,s,n,o,u),bottom:g,borderTopColor:"transparent",borderLeftColor:"transparent",clipPath:"polygon(0 100%, 100% 100%, 100% 0)"}:f==="bottom"?{...m,...XE(h,s,n,o,u),top:g,borderBottomColor:"transparent",borderRightColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 0)"}:{}}const Ip=v.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,visible:s,arrowX:c,arrowY:u,style:f,...h},m)=>{const{dir:g}=As();return s?a.jsx("div",{...h,ref:m,style:{...f,...dI({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:g,arrowX:c,arrowY:u})}}):null});Ip.displayName="@mantine/core/FloatingArrow";function Z2(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var eD={root:"m_9814e45f"};const fI={zIndex:Br("modal")},hI=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:s,zIndex:c})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&Oi(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${ce(o)})`:void 0,"--overlay-radius":s===void 0?void 0:Ht(s),"--overlay-z-index":c?.toString()}}),Jc=ar((e,t)=>{const n=oe("Overlay",fI,e),{classNames:r,className:o,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,k=Ue({name:"Overlay",props:n,classes:eD,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:E,vars:f,varsResolver:hI});return a.jsx(le,{ref:t,...k("root"),mod:[{center:m,fixed:h},R],..._,children:g})});Jc.classes=eD;Jc.displayName="@mantine/core/Overlay";function Gy(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 pI({target:e,reuseTargetNode:t,...n}){if(e)return typeof e=="string"?document.querySelector(e)||Gy(n):e;if(t){const r=document.querySelector("[data-mantine-shared-portal-node]");if(r)return r;const o=Gy(n);return o.setAttribute("data-mantine-shared-portal-node","true"),document.body.appendChild(o),o}return Gy(n)}const mI={reuseTargetNode:!0},tD=ve((e,t)=>{const{children:n,target:r,reuseTargetNode:o,...s}=oe("Portal",mI,e),[c,u]=v.useState(!1),f=v.useRef(null);return Ll(()=>(u(!0),f.current=pI({target:r,reuseTargetNode:o,...s}),Md(t,f.current),!r&&!o&&f.current&&document.body.appendChild(f.current),()=>{!r&&!o&&f.current&&document.body.removeChild(f.current)}),[r]),!c||!f.current?null:Ob.createPortal(a.jsx(a.Fragment,{children:n}),f.current)});tD.displayName="@mantine/core/Portal";const Ca=ve(({withinPortal:e=!0,children:t,...n},r)=>um()==="test"||!e?a.jsx(a.Fragment,{children:t}):a.jsx(tD,{ref:r,...n,children:t}));Ca.displayName="@mantine/core/OptionalPortal";const vd=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${e==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),op={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:{...vd("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...vd("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...vd("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...vd("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...vd("top"),common:{transformOrigin:"top right"}}},JE={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function gI({transition:e,state:t,duration:n,timingFunction:r}){const o={WebkitBackfaceVisibility:"hidden",transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in op?{transitionProperty:op[e].transitionProperty,...o,...op[e].common,...op[e][JE[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[JE[t]]}}function vI({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:c,onExited:u,enterDelay:f,exitDelay:h}){const m=kn(),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 k=D=>{_();const P=D?o:s,$=D?c:u,U=y?0:D?e:t;S(U),U===0?(typeof P=="function"&&P(),typeof $=="function"&&$(),C(D?"entered":"exited")):E.current=requestAnimationFrame(()=>{Cd.flushSync(()=>{C(D?"pre-entering":"pre-exiting")}),E.current=requestAnimationFrame(()=>{typeof P=="function"&&P(),C(D?"entering":"exiting"),T.current=window.setTimeout(()=>{typeof $=="function"&&$(),C(D?"entered":"exited")},U)})})},L=D=>{if(_(),typeof(D?f:h)!="number"){k(D);return}R.current=window.setTimeout(()=>{k(D)},D?f:h)};return Cl(()=>{L(r)},[r]),v.useEffect(()=>()=>{_()},[]),{transitionDuration:x,transitionStatus:w,transitionTimingFunction:n||"ease"}}function po({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:c="ease",onExit:u,onEntered:f,onEnter:h,onExited:m,enterDelay:g,exitDelay:y}){const x=um(),{transitionDuration:S,transitionStatus:w,transitionTimingFunction:C}=vI({mounted:o,exitDuration:r,duration:n,timingFunction:c,onExit:u,onEntered:f,onEnter:h,onExited:m,enterDelay:g,exitDelay:y});return S===0||x==="test"?o?a.jsx(a.Fragment,{children:s({})}):e?s({display:"none"}):null:w==="exited"?e?s({display:"none"}):null:a.jsx(a.Fragment,{children:s(gI({transition:t,duration:S,state:w,timingFunction:C}))})}po.displayName="@mantine/core/Transition";const[yI,nD]=Or("Popover component was not found in the tree");var rD={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};function xm({children:e,active:t=!0,refProp:n="ref",innerRef:r}){const o=kM(t),s=Fn(o,r),c=Il(e);return c?v.cloneElement(c,{[n]:s}):e}function iD(e){return a.jsx(Qb,{tabIndex:-1,"data-autofocus":!0,...e})}xm.displayName="@mantine/core/FocusTrap";iD.displayName="@mantine/core/FocusTrapInitialFocus";xm.InitialFocus=iD;const Yb=ve((e,t)=>{const n=oe("PopoverDropdown",null,e),{className:r,style:o,vars:s,children:c,onKeyDownCapture:u,variant:f,classNames:h,styles:m,...g}=n,y=nD(),x=r2({opened:y.opened,shouldReturnFocus:y.returnFocus}),S=y.withRoles?{"aria-labelledby":y.getTargetId(),id:y.getDropdownId(),role:"dialog",tabIndex:-1}:{},w=Fn(t,y.floating);return y.disabled?null:a.jsx(Ca,{...y.portalProps,withinPortal:y.withinPortal,children:a.jsx(po,{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(xm,{active:y.trapFocus&&y.opened,innerRef:w,children:a.jsxs(le,{...S,...g,variant:f,onKeyDownCapture:yM(()=>{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,o]}),children:[c,a.jsx(Ip,{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=rD;Yb.displayName="@mantine/core/PopoverDropdown";const xI={refProp:"ref",popupType:"dialog"},oD=ve((e,t)=>{const{children:n,refProp:r,popupType:o,...s}=oe("PopoverTarget",xI,e),c=Il(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=nD(),h=Fn(f.reference,lm(c),t),m=f.withRoles?{"aria-haspopup":o,"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?.()}}})});oD.displayName="@mantine/core/PopoverTarget";function bI(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 SI(e,t,n){const r=bI(e.middlewares),o=[N2(e.offset),kL()];return e.dropdownVisible&&n!=="test"&&e.preventPositionChangeWhenVisible&&(r.flip=!1),r.flip&&o.push(typeof r.flip=="boolean"?Lp():Lp(r.flip)),r.shift&&o.push(Bb(typeof r.shift=="boolean"?{limiter:VE(),padding:5}:{limiter:VE(),padding:5,...r.shift})),r.inline&&o.push(typeof r.inline=="boolean"?Dd():Dd(r.inline)),o.push(O2({element:e.arrowRef,padding:e.arrowOffset})),(r.size||e.width==="target")&&o.push(AL({...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`})}})),o}function jI(e){const t=um(),[n,r]=ir({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),o=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:SI(e,()=>u,t),whileElementsMounted:e.keepMounted?void 0:Ix});return v.useEffect(()=>{if(!(!u.refs.reference.current||!u.refs.floating.current)&&n)return Ix(u.refs.reference.current,u.refs.floating.current,u.update)},[n,u.update]),Cl(()=>{e.onPositionChange?.(u.placement),e.positionRef.current=u.placement},[u.placement,e.preventPositionChangeWhenVisible]),Cl(()=>{n!==o.current&&(n?e.onOpen?.():e.onClose?.()),o.current=n},[n,e.onClose,e.onOpen]),Ll(()=>{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 wI={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"},CI=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:Ht(t),"--popover-shadow":Tb(n)}});function ei(e){const t=oe("Popover",wI,e),{children:n,position:r,offset:o,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:k,withinPortal:L,portalProps:D,closeOnEscape:P,clickOutsideEvents:$,trapFocus:U,onClose:W,onDismiss:Y,onOpen:ee,onChange:B,zIndex:G,radius:M,shadow:I,id:z,defaultOpened:V,__staticSelector:K,withRoles:O,disabled:F,returnFocus:se,variant:de,keepMounted:xe,vars:Ce,floatingStrategy:we,withOverlay:Ye,overlayProps:De,hideDetached:ht,attributes:Rt,preventPositionChangeWhenVisible:at,...Ze}=t,mt=Ue({name:K,props:t,classes:rD,classNames:E,styles:_,unstyled:R,attributes:Rt,rootSelector:"dropdown",vars:Ce,varsResolver:CI}),{resolvedStyles:Dt}=zl({classNames:E,styles:_,props:t}),[jt,Ae]=v.useState(u??V??!1),Ne=v.useRef(r),Me=v.useRef(null),[Ie,it]=v.useState(null),[et,ft]=v.useState(null),{dir:lt}=As(),Ee=um(),he=pr(z),ke=jI({middlewares:y,width:g,position:Z2(lt,r),offset:typeof o=="number"?o+(x?S/2:0):o,arrowRef:Me,arrowOffset:w,onPositionChange:s,positionDependencies:c,opened:u,defaultOpened:V,onChange:B,onOpen:ee,onClose:W,onDismiss:Y,strategy:we,dropdownVisible:jt,setDropdownVisible:Ae,positionRef:Ne,disabled:F,preventPositionChangeWhenVisible:at,keepMounted:xe});jM(()=>{k&&(ke.onClose(),Y?.())},$,[Ie,et]);const vt=v.useCallback(an=>{it(an),ke.floating.refs.setReference(an)},[ke.floating.refs.setReference]),_t=v.useCallback(an=>{ft(an),ke.floating.refs.setFloating(an)},[ke.floating.refs.setFloating]),Kt=v.useCallback(()=>{f?.onExited?.(),h?.(),Ae(!1),at||(Ne.current=r)},[f?.onExited,h,at,r]),yn=v.useCallback(()=>{f?.onEntered?.(),m?.()},[f?.onEntered,m]);return a.jsxs(yI,{value:{returnFocus:se,disabled:F,controlled:ke.controlled,reference:vt,floating:_t,x:ke.floating.x,y:ke.floating.y,arrowX:ke.floating?.middlewareData?.arrow?.x,arrowY:ke.floating?.middlewareData?.arrow?.y,opened:ke.opened,arrowRef:Me,transitionProps:{...f,onExited:Kt,onEntered:yn},width:g,withArrow:x,arrowSize:S,arrowOffset:w,arrowRadius:C,arrowPosition:T,placement:ke.floating.placement,trapFocus:U,withinPortal:L,portalProps:D,zIndex:G,radius:M,shadow:I,closeOnEscape:P,onDismiss:Y,onClose:ke.onClose,onToggle:ke.onToggle,getTargetId:()=>`${he}-target`,getDropdownId:()=>`${he}-dropdown`,withRoles:O,targetProps:Ze,__staticSelector:K,classNames:E,styles:_,unstyled:R,variant:de,keepMounted:xe,getStyles:mt,resolvedStyles:Dt,floatingStrategy:we,referenceHidden:ht&&Ee!=="test"?ke.floating.middlewareData.hide?.referenceHidden:!1},children:[n,Ye&&a.jsx(po,{transition:"fade",mounted:ke.opened,duration:f?.duration||250,exitDuration:f?.exitDuration||250,children:an=>a.jsx(Ca,{withinPortal:L,children:a.jsx(Jc,{...De,...mt("overlay",{className:De?.className,style:[an,De?.style]})})})})]})}ei.Target=oD;ei.Dropdown=Yb;ei.displayName="@mantine/core/Popover";ei.extend=e=>e;var co={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 aD=v.forwardRef(({className:e,...t},n)=>a.jsxs(le,{component:"span",className:Ft(co.barsLoader,e),...t,ref:n,children:[a.jsx("span",{className:co.bar}),a.jsx("span",{className:co.bar}),a.jsx("span",{className:co.bar})]}));aD.displayName="@mantine/core/Bars";const sD=v.forwardRef(({className:e,...t},n)=>a.jsxs(le,{component:"span",className:Ft(co.dotsLoader,e),...t,ref:n,children:[a.jsx("span",{className:co.dot}),a.jsx("span",{className:co.dot}),a.jsx("span",{className:co.dot})]}));sD.displayName="@mantine/core/Dots";const lD=v.forwardRef(({className:e,...t},n)=>a.jsx(le,{component:"span",className:Ft(co.ovalLoader,e),...t,ref:n}));lD.displayName="@mantine/core/Oval";const cD={bars:aD,oval:lD,dots:sD},EI={loaders:cD,type:"oval"},TI=(e,{size:t,color:n})=>({root:{"--loader-size":rt(t,"loader-size"),"--loader-color":n?Xt(n,e):void 0}}),Pr=ve((e,t)=>{const n=oe("Loader",EI,e),{size:r,color:o,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=Ue({name:"Loader",props:n,classes:co,className:u,style:f,classNames:h,styles:m,unstyled:g,attributes:w,vars:c,varsResolver:TI});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=cD;Pr.classes=co;Pr.displayName="@mantine/core/Loader";var uu={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21",groupSection:"m_437b6484"};const ZE={orientation:"horizontal"},RI=(e,{borderWidth:t})=>({group:{"--ai-border-width":ce(t)}}),Kb=ve((e,t)=>{const n=oe("ActionIconGroup",ZE,e),{className:r,style:o,classNames:s,styles:c,unstyled:u,orientation:f,vars:h,borderWidth:m,variant:g,mod:y,attributes:x,...S}=oe("ActionIconGroup",ZE,e),w=Ue({name:"ActionIconGroup",props:n,classes:uu,className:r,style:o,classNames:s,styles:c,unstyled:u,attributes:x,vars:h,varsResolver:RI,rootSelector:"group"});return a.jsx(le,{...w("group"),ref:t,variant:g,mod:[{"data-orientation":f},y],role:"group",...S})});Kb.classes=uu;Kb.displayName="@mantine/core/ActionIconGroup";const _I=(e,{radius:t,color:n,gradient:r,variant:o,autoContrast:s,size:c})=>{const u=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{groupSection:{"--section-height":rt(c,"section-height"),"--section-padding-x":rt(c,"section-padding-x"),"--section-fz":Yn(c),"--section-radius":t===void 0?void 0:Ht(t),"--section-bg":n||o?u.background:void 0,"--section-color":u.color,"--section-bd":n||o?u.border:void 0}}},Xb=ve((e,t)=>{const n=oe("ActionIconGroupSection",null,e),{className:r,style:o,classNames:s,styles:c,unstyled:u,vars:f,variant:h,gradient:m,radius:g,autoContrast:y,attributes:x,...S}=n,w=Ue({name:"ActionIconGroupSection",props:n,classes:uu,className:r,style:o,classNames:s,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:_I,rootSelector:"groupSection"});return a.jsx(le,{...w("groupSection"),ref:t,variant:h,...S})});Xb.classes=uu;Xb.displayName="@mantine/core/ActionIconGroupSection";const DI=(e,{size:t,radius:n,variant:r,gradient:o,color:s,autoContrast:c})=>{const u=e.variantColorResolver({color:s||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:c});return{root:{"--ai-size":rt(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}}},An=ar((e,t)=>{const n=oe("ActionIcon",null,e),{className:r,unstyled:o,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:k,attributes:L,...D}=n,P=Ue({name:["ActionIcon",S],props:n,className:r,style:f,classes:uu,classNames:c,styles:u,unstyled:o,attributes:L,vars:C,varsResolver:DI});return a.jsxs(_n,{...P("root",{active:!R&&!h&&!E}),...D,unstyled:o,variant:s,size:g,disabled:R||h,ref:t,mod:[{loading:h,disabled:R||E},k],children:[typeof h=="boolean"&&a.jsx(po,{mounted:h,transition:"slide-down",duration:150,children:$=>a.jsx(le,{component:"span",...P("loader",{style:$}),"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},...P("icon"),children:T})]})});An.classes=uu;An.displayName="@mantine/core/ActionIcon";An.Group=Kb;An.GroupSection=Xb;const uD=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"})}));uD.displayName="@mantine/core/CloseIcon";var dD={root:"m_86a44da5","root--subtle":"m_220c80f2"};const AI={variant:"subtle"},kI=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":rt(t,"cb-size"),"--cb-radius":n===void 0?void 0:Ht(n),"--cb-icon-size":ce(r)}}),ks=ar((e,t)=>{const n=oe("CloseButton",AI,e),{iconSize:r,children:o,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,_=Ue({name:R||"CloseButton",props:n,className:u,style:h,classes:dD,classNames:f,styles:m,unstyled:g,attributes:T,vars:s,varsResolver:kI});return a.jsxs(_n,{ref:t,...E,unstyled:g,variant:S,disabled:x,mod:[{disabled:x||y},C],..._("root",{variant:S,active:!x&&!y}),children:[w||a.jsx(uD,{}),o]})});ks.classes=dD;ks.displayName="@mantine/core/CloseButton";function PI(e){return v.Children.toArray(e).filter(Boolean)}var fD={root:"m_4081bf90"};const NI={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},OI=(e,{grow:t,preventGrowOverflow:n,gap:r,align:o,justify:s,wrap:c},{childWidth:u})=>({root:{"--group-child-width":t&&n?u:void 0,"--group-gap":Qn(r),"--group-align":o,"--group-justify":s,"--group-wrap":c}}),be=ve((e,t)=>{const n=oe("Group",NI,e),{classNames:r,className:o,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,k=PI(f),L=k.length,D=Qn(h??"md"),$={childWidth:`calc(${100/L}% - (${D} - ${D} / ${L}))`},U=Ue({name:"Group",props:n,stylesCtx:$,className:o,style:s,classes:fD,classNames:r,styles:c,unstyled:u,attributes:E,vars:w,varsResolver:OI});return a.jsx(le,{...U("root"),ref:t,variant:C,mod:[{grow:x},R],size:T,..._,children:k})});be.classes=fD;be.displayName="@mantine/core/Group";const[MI,ka]=Or("ModalBase component was not found in tree");function LI({opened:e,transitionDuration:t}){const[n,r]=v.useState(e),o=v.useRef(-1),c=_b()?0:t;return v.useEffect(()=>(e?(r(!0),window.clearTimeout(o.current)):c===0?r(!1):o.current=window.setTimeout(()=>r(!1),c),()=>window.clearTimeout(o.current)),[e,c]),n}function II({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:s,returnFocus:c}){const u=pr(e),[f,h]=v.useState(!1),[m,g]=v.useState(!1),y=typeof t?.duration=="number"?t?.duration:200,x=LI({opened:n,transitionDuration:y});return s2("keydown",S=>{S.key==="Escape"&&o&&!S.isComposing&&n&&S.target?.getAttribute("data-mantine-stop-propagation")!=="true"&&s()},{capture:!0}),r2({opened:n,shouldReturnFocus:r&&c}),{_id:u,titleMounted:f,bodyMounted:m,shouldLockScroll:x,setTitleMounted:h,setBodyMounted:g}}const hD=v.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:o,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:_,...k},L)=>{const{_id:D,titleMounted:P,bodyMounted:$,shouldLockScroll:U,setTitleMounted:W,setBodyMounted:Y}=II({id:r,transitionProps:o,opened:t,trapFocus:u,closeOnEscape:f,onClose:n,returnFocus:h}),{key:ee,...B}=_||{};return a.jsx(Ca,{...y,withinPortal:g,children:a.jsx(MI,{value:{opened:t,onClose:n,closeOnClickOutside:m,onExitTransitionEnd:s,onEnterTransitionEnd:c,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${D}-title`,getBodyId:()=>`${D}-body`,titleMounted:P,bodyMounted:$,setTitleMounted:W,setBodyMounted:Y,trapFocus:u,closeOnEscape:f,zIndex:w,unstyled:E},children:a.jsx(wl,{enabled:U&&x,...B,children:a.jsx(le,{ref:L,...k,__vars:{...R,"--mb-z-index":(w||Br("modal")).toString(),"--mb-shadow":Tb(C),"--mb-padding":Qn(T)},children:S})},ee)})})});hD.displayName="@mantine/core/ModalBase";var Zc={title:"m_615af6c9",header:"m_b5489c3c",inner:"m_60c222c7",content:"m_fd1ab0aa",close:"m_606cb269",body:"m_5df29311"};function zI(){const e=ka();return v.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}const pD=v.forwardRef(({className:e,...t},n)=>{const r=zI(),o=ka();return a.jsx(le,{ref:n,...t,id:r,className:Ft({[Zc.body]:!o.unstyled},e)})});pD.displayName="@mantine/core/ModalBaseBody";const mD=v.forwardRef(({className:e,onClick:t,...n},r)=>{const o=ka();return a.jsx(ks,{ref:r,...n,onClick:s=>{o.onClose(),t?.(s)},className:Ft({[Zc.close]:!o.unstyled},e),unstyled:o.unstyled})});mD.displayName="@mantine/core/ModalBaseCloseButton";const gD=v.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...s},c)=>{const u=ka();return a.jsx(po,{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({[Zc.inner]:!u.unstyled},n.className),children:a.jsx(xm,{active:u.opened&&u.trapFocus,innerRef:c,children:a.jsx(hr,{...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:[o,f],className:Ft({[Zc.content]:!u.unstyled},t),unstyled:u.unstyled,children:s.children})})})})});gD.displayName="@mantine/core/ModalBaseContent";const vD=v.forwardRef(({className:e,...t},n)=>{const r=ka();return a.jsx(le,{component:"header",ref:n,className:Ft({[Zc.header]:!r.unstyled},e),...t})});vD.displayName="@mantine/core/ModalBaseHeader";const $I={duration:200,timingFunction:"ease",transition:"fade"};function UI(e){const t=ka();return{...$I,...t.transitionProps,...e}}const yD=v.forwardRef(({onClick:e,transitionProps:t,style:n,visible:r,...o},s)=>{const c=ka(),u=UI(t);return a.jsx(po,{mounted:r!==void 0?r:c.opened,...u,transition:"fade",children:f=>a.jsx(Jc,{ref:s,fixed:!0,style:[n,f],zIndex:c.zIndex,unstyled:c.unstyled,onClick:h=>{e?.(h),c.closeOnClickOutside&&c.onClose()},...o})})});yD.displayName="@mantine/core/ModalBaseOverlay";function BI(){const e=ka();return v.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const xD=v.forwardRef(({className:e,...t},n)=>{const r=BI(),o=ka();return a.jsx(le,{component:"h2",ref:n,className:Ft({[Zc.title]:!o.unstyled},e),...t,id:r})});xD.displayName="@mantine/core/ModalBaseTitle";function VI({children:e}){return a.jsx(a.Fragment,{children:e})}const[FI,HI]=Wo({size:"sm"});var Hi={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 bD=ve((e,t)=>{const n=oe("InputClearButton",null,e),{size:r,variant:o,vars:s,classNames:c,styles:u,...f}=n,h=HI(),{resolvedClassNames:m,resolvedStyles:g}=zl({classNames:c,styles:u,props:n});return a.jsx(ks,{variant:o||"transparent",ref:t,size:r||h?.size||"sm",classNames:m,styles:g,__staticSelector:"InputClearButton",style:{pointerEvents:"all",background:"var(--input-bg)",...f.style},...f})});bD.displayName="@mantine/core/InputClearButton";const qI={xs:7,sm:8,md:10,lg:12,xl:15};function GI({__clearable:e,__clearSection:t,rightSection:n,__defaultRightSection:r,size:o="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:qI[o]},children:[s,n||r]}):n===null?null:n||s||r}const[WI,du]=Wo({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0}),QI=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Yn(t)} - ${ce(2)})`}}),bm=ve((e,t)=>{const n=oe("InputDescription",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,size:h,__staticSelector:m,__inheritStyles:g=!0,attributes:y,variant:x,...S}=oe("InputDescription",null,n),w=du(),C=Ue({name:["InputWrapper",m],props:n,classes:Hi,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:y,rootSelector:"description",vars:f,varsResolver:QI}),T=g&&w?.getStyles||C;return a.jsx(le,{component:"p",ref:t,variant:x,size:h,...T("description",w?.getStyles?{className:o,style:s}:void 0),...S})});bm.classes=Hi;bm.displayName="@mantine/core/InputDescription";const YI=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Yn(t)} - ${ce(2)})`}}),Sm=ve((e,t)=>{const n=oe("InputError",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,size:h,attributes:m,__staticSelector:g,__inheritStyles:y=!0,variant:x,...S}=n,w=Ue({name:["InputWrapper",g],props:n,classes:Hi,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:m,rootSelector:"error",vars:f,varsResolver:YI}),C=du(),T=y&&C?.getStyles||w;return a.jsx(le,{component:"p",ref:t,variant:x,size:h,...T("error",C?.getStyles?{className:o,style:s}:void 0),...S})});Sm.classes=Hi;Sm.displayName="@mantine/core/InputError";const eT={labelElement:"label"},KI=(e,{size:t})=>({label:{"--input-label-size":Yn(t),"--input-asterisk-color":void 0}}),lf=ve((e,t)=>{const n=oe("InputLabel",eT,e),{classNames:r,className:o,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}=oe("InputLabel",eT,n),_=Ue({name:["InputWrapper",w],props:n,classes:Hi,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:R,rootSelector:"label",vars:f,varsResolver:KI}),k=du(),L=k?.getStyles||_;return a.jsxs(le,{...L("label",k?.getStyles?{className:o,style:s}:void 0),component:h,variant:C,size:m,ref:t,htmlFor:h==="label"?y:void 0,mod:[{required:g},T],onMouseDown:D=>{x?.(D),!D.defaultPrevented&&D.detail>1&&D.preventDefault()},...E,children:[S,g&&a.jsx("span",{...L("required"),"aria-hidden":!0,children:" *"})]})});lf.classes=Hi;lf.displayName="@mantine/core/InputLabel";const Jb=ve((e,t)=>{const n=oe("InputPlaceholder",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,__staticSelector:h,variant:m,error:g,mod:y,attributes:x,...S}=n,w=Ue({name:["InputPlaceholder",h],props:n,classes:Hi,className:o,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=Hi;Jb.displayName="@mantine/core/InputPlaceholder";function XI(e,{hasDescription:t,hasError:n}){const r=e.findIndex(f=>f==="input"),o=e.slice(0,r),s=e.slice(r+1),c=t&&o.includes("description")||n&&o.includes("error");return{offsetBottom:t&&s.includes("description")||n&&s.includes("error"),offsetTop:c}}const JI={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},ZI=(e,{size:t})=>({label:{"--input-label-size":Yn(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Yn(t)} - ${ce(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Yn(t)} - ${ce(2)})`}}),cf=ve((e,t)=>{const n=oe("InputWrapper",JI,e),{classNames:r,className:o,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:k,withAsterisk:L,id:D,required:P,__stylesApiProps:$,mod:U,attributes:W,...Y}=n,ee=Ue({name:["InputWrapper",g],props:$||n,classes:Hi,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:W,vars:f,varsResolver:ZI}),B={size:h,variant:m,__staticSelector:g},G=pr(D),M=typeof L=="boolean"?L:P,I=E?.id||`${G}-error`,z=R?.id||`${G}-description`,V=G,K=!!w&&typeof w!="boolean",O=!!C,F=`${K?I:""} ${O?z:""}`,se=F.trim().length>0?F.trim():void 0,de=T?.id||`${G}-label`,xe=S&&a.jsx(lf,{labelElement:_,id:de,htmlFor:V,required:M,...B,...T,children:S},"label"),Ce=O&&a.jsx(bm,{...R,...B,size:R?.size||B.size,id:R?.id||z,children:C},"description"),we=a.jsx(v.Fragment,{children:y(k)},"input"),Ye=K&&v.createElement(Sm,{...E,...B,size:E?.size||B.size,key:"error",id:E?.id||I},w),De=x.map(ht=>{switch(ht){case"label":return xe;case"input":return we;case"description":return Ce;case"error":return Ye;default:return null}});return a.jsx(WI,{value:{getStyles:ee,describedBy:se,inputId:V,labelId:de,...XI(x,{hasDescription:O,hasError:K})},children:a.jsx(le,{ref:t,variant:m,size:h,mod:[{error:!!w},U],...ee("root"),...Y,children:De})})});cf.classes=Hi;cf.displayName="@mantine/core/InputWrapper";const e6={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0,size:"sm"},t6=(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":rt(t.size,"input-height"),"--input-fz":Yn(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?rt(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),gn=ar((e,t)=>{const n=oe("Input",e6,e),{classNames:r,className:o,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:k,leftSectionPointerEvents:L,variant:D,vars:P,pointer:$,multiline:U,radius:W,id:Y,withAria:ee,withErrorStyles:B,mod:G,inputSize:M,attributes:I,__clearSection:z,__clearable:V,__defaultRightSection:K,...O}=n,{styleProps:F,rest:se}=Aa(O),de=du(),xe={offsetBottom:de?.offsetBottom,offsetTop:de?.offsetTop},Ce=Ue({name:["Input",h],props:m||n,classes:Hi,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:I,stylesCtx:xe,rootSelector:"wrapper",vars:P,varsResolver:t6}),we=ee?{required:f,disabled:S,"aria-invalid":!!x,"aria-describedby":de?.describedBy,id:de?.inputId||Y}:{},Ye=GI({__clearable:V,__clearSection:z,rightSection:R,__defaultRightSection:K,size:g});return a.jsx(FI,{value:{size:g||"sm"},children:a.jsxs(le,{...Ce("wrapper"),...F,...y,mod:[{error:!!x&&B,pointer:$,disabled:S,multiline:U,"data-with-right-section":!!Ye,"data-with-left-section":!!w},G],variant:D,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",...se,...we,ref:t,required:f,mod:{disabled:S,error:!!x&&B},variant:D,__size:M,...Ce("input")}),Ye&&a.jsx("div",{...E,"data-position":"right",...Ce("section",{className:E?.className,style:E?.style}),children:Ye})]})})});gn.classes=Hi;gn.Wrapper=cf;gn.Label=lf;gn.Error=Sm;gn.Description=bm;gn.Placeholder=Jb;gn.ClearButton=bD;gn.displayName="@mantine/core/Input";function n6(e,t,n){const r=oe(e,t,n),{label:o,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:k,inputWrapperOrder:L,withAsterisk:D,variant:P,vars:$,mod:U,attributes:W,...Y}=r,{styleProps:ee,rest:B}=Aa(Y),G={label:o,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:k,inputWrapperOrder:L,withAsterisk:D,variant:P,id:R,mod:U,attributes:W,...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:P,id:R,attributes:W}}}const r6={__staticSelector:"InputBase",withAria:!0,size:"sm"},Vr=ar((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=n6("InputBase",r6,e);return a.jsx(gn.Wrapper,{...r,children:a.jsx(gn,{...n,...o,ref:t})})});Vr.classes={...gn.classes,...gn.Wrapper.classes};Vr.displayName="@mantine/core/InputBase";const i6={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 SD={root:"m_8bffd616"};const or=ar((e,t)=>{const n=oe("Flex",null,e),{classNames:r,className:o,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=Ue({name:"Flex",classes:SD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f}),E=kn(),_=af(),k=m2({styleProps:{gap:h,rowGap:m,columnGap:g,align:y,justify:x,wrap:S,direction:w},theme:E,data:i6});return a.jsxs(a.Fragment,{children:[k.hasResponsiveStyles&&a.jsx(Ul,{selector:`.${_}`,styles:k.styles,media:k.media}),a.jsx(le,{ref:t,...R("root",{className:_,style:_s(k.inlineStyles)}),...T})]})});or.classes=SD;or.displayName="@mantine/core/Flex";var jD={root:"m_96b553a6"};function o6(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 a6({target:e,parent:t,ref:n,displayAfterTransitionEnd:r}){const o=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=xs(w.borderTopWidth)+xs(C.borderTopWidth),R=xs(w.borderLeftWidth)+xs(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(o.current),n.current&&(n.current.style.transitionDuration="0ms"),h(),o.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=>{o6(S.target,t)&&(m(),f(!1))};return t.addEventListener("transitionend",x),()=>{t.removeEventListener("transitionend",x)}}},[t]),WM(()=>{l2()!=="test"&&c(!0)},20,{autoInvoke:!0}),QM(x=>{x.forEach(S=>{S.type==="attributes"&&S.attributeName==="dir"&&m()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:s,hidden:u}}const s6=(e,{transitionDuration:t})=>({root:{"--transition-duration":typeof t=="number"?`${t}ms`:t}}),Zb=ve((e,t)=>{const n=oe("FloatingIndicator",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,target:h,parent:m,transitionDuration:g,mod:y,displayAfterTransitionEnd:x,attributes:S,...w}=n,C=Ue({name:"FloatingIndicator",classes:jD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:s6}),T=v.useRef(null),{initialized:R,hidden:E}=a6({target:h,parent:m,ref:T,displayAfterTransitionEnd:x}),_=Fn(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=jD;function wD({open:e,close:t,openDelay:n,closeDelay:r}){const o=v.useRef(-1),s=v.useRef(-1),c=()=>{window.clearTimeout(o.current),window.clearTimeout(s.current)},u=()=>{c(),n===0||n===void 0?e():o.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 CD({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"})})}CD.displayName="@mantine/core/AccordionChevron";var ED={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 l6=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const s=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light",autoContrast:o});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}}},Yo=ve((e,t)=>{const n=oe("Alert",null,e),{classNames:r,className:o,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:k,...L}=n,D=Ue({name:"Alert",classes:ED,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:k,vars:f,varsResolver:l6}),P=pr(x),$=g&&`${P}-title`||void 0,U=`${P}-body`;return a.jsx(le,{id:P,...D("root",{variant:R}),variant:R,ref:t,role:_||"alert",...L,"aria-describedby":y?U:void 0,"aria-labelledby":g?$:void 0,children:a.jsxs("div",{...D("wrapper"),children:[S&&a.jsx("div",{...D("icon"),children:S}),a.jsxs("div",{...D("body"),children:[g&&a.jsx("div",{...D("title"),"data-with-close-button":w||void 0,children:a.jsx("span",{id:$,...D("label"),children:g})}),y&&a.jsx("div",{id:U,...D("message"),"data-variant":R,children:y})]}),w&&a.jsx(ks,{...D("closeButton"),onClick:C,variant:"transparent",size:16,iconSize:16,"aria-label":T,unstyled:u})]})})});Yo.classes=ED;Yo.displayName="@mantine/core/Alert";var TD={root:"m_b6d8b162"};function c6(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const u6={inherit:!1},d6=(e,{variant:t,lineClamp:n,gradient:r,size:o,color:s})=>({root:{"--text-fz":Yn(o),"--text-lh":e2(o),"--text-gradient":t==="gradient"?Dx(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":s?Xt(s,e):void 0}}),ge=ar((e,t)=>{const n=oe("Text",u6,e),{lineClamp:r,truncate:o,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,k=Ue({name:["Text",h],props:n,classes:TD,className:g,style:y,classNames:x,styles:S,unstyled:w,attributes:E,vars:m,varsResolver:d6});return a.jsx(le,{...k("root",{focusable:!0}),ref:t,component:f?"span":"p",variant:C,mod:[{"data-truncate":c6(o),"data-line-clamp":typeof r=="number","data-inline":s,"data-inherit":c},T],size:R,..._})});ge.classes=TD;ge.displayName="@mantine/core/Text";var RD={root:"m_849cf0da"};const f6={underline:"hover"},Tt=ar((e,t)=>{const{underline:n,className:r,unstyled:o,mod:s,...c}=oe("Anchor",f6,e);return a.jsx(ge,{component:"a",ref:t,className:Ft({[RD.root]:!o},r),...c,mod:[{underline:n},s],__staticSelector:"Anchor",unstyled:o})});Tt.classes=RD;Tt.displayName="@mantine/core/Anchor";const[h6,fu]=Or("AppShell was not found in tree");var Ps={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:o,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=oe("AppShellAside",null,e),y=fu();return y.disabled?null:a.jsx(le,{component:"aside",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("aside",{className:Ft({[wl.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-aside-z-index":`calc(${h??y.zIndex} + 1)`}})});e0.classes=Ps;e0.displayName="@mantine/core/AppShellAside";const t0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=oe("AppShellFooter",null,e),y=fu();return y.disabled?null:a.jsx(le,{component:"footer",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("footer",{className:Ft({[wl.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-footer-z-index":(h??y.zIndex)?.toString()}})});t0.classes=Ps;t0.displayName="@mantine/core/AppShellFooter";const n0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=oe("AppShellHeader",null,e),y=fu();return y.disabled?null:a.jsx(le,{component:"header",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("header",{className:Ft({[wl.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-header-z-index":(h??y.zIndex)?.toString()}})});n0.classes=Ps;n0.displayName="@mantine/core/AppShellHeader";const r0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...u}=oe("AppShellMain",null,e),f=fu();return a.jsx(le,{component:"main",ref:t,...f.getStyles("main",{className:r,style:o,classNames:n,styles:s}),...u})});r0.classes=Ps;r0.displayName="@mantine/core/AppShellMain";function uf(e){return typeof e=="object"?e.base:e}function df(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 ff(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function p6({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:o,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")),df(c)){const h=ce(uf(c));e["--app-shell-aside-width"]=h,e["--app-shell-aside-offset"]=h}if(ff(c)&&(typeof c.base<"u"&&(e["--app-shell-aside-width"]=ce(c.base),e["--app-shell-aside-offset"]=ce(c.base)),pn(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,o.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 m6({baseStyles:e,minMediaStyles:t,footer:n,mode:r}){const o=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"),df(o)){const u=ce(uf(o));e["--app-shell-footer-height"]=u,c&&(e["--app-shell-footer-offset"]=u)}ff(o)&&(typeof o.base<"u"&&(e["--app-shell-footer-height"]=ce(o.base),c&&(e["--app-shell-footer-offset"]=ce(o.base))),pn(o).forEach(u=>{u!=="base"&&(t[u]=t[u]||{},t[u]["--app-shell-footer-height"]=ce(o[u]),c&&(t[u]["--app-shell-footer-offset"]=ce(o[u])))})),n?.collapsed&&(e["--app-shell-footer-transform"]=s,r==="fixed"&&(e["--app-shell-footer-offset"]="0px !important"))}function g6({baseStyles:e,minMediaStyles:t,header:n,mode:r}){const o=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"),df(o)){const u=ce(uf(o));e["--app-shell-header-height"]=u,c&&(e["--app-shell-header-offset"]=u)}ff(o)&&(typeof o.base<"u"&&(e["--app-shell-header-height"]=ce(o.base),c&&(e["--app-shell-header-offset"]=ce(o.base))),pn(o).forEach(u=>{u!=="base"&&(t[u]=t[u]||{},t[u]["--app-shell-header-height"]=ce(o[u]),c&&(t[u]["--app-shell-header-offset"]=ce(o[u])))})),n?.collapsed&&(e["--app-shell-header-transform"]=s,r==="fixed"&&(e["--app-shell-header-offset"]="0px !important"))}function v6({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:o,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")),df(c)){const h=ce(uf(c));e["--app-shell-navbar-width"]=h,e["--app-shell-navbar-offset"]=h,s==="static"&&(e["--app-shell-navbar-grid-width"]=h)}if(ff(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))),pn(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,o.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 Wy(e){return Number(e)===0?"0px":Qn(e)}function y6({padding:e,baseStyles:t,minMediaStyles:n}){df(e)&&(t["--app-shell-padding"]=Wy(uf(e))),ff(e)&&(e.base&&(t["--app-shell-padding"]=Wy(e.base)),pn(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=Wy(e[r]))}))}function x6({navbar:e,header:t,footer:n,aside:r,padding:o,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"),v6({baseStyles:h,minMediaStyles:u,maxMediaStyles:f,navbar:e,theme:s,mode:c}),p6({baseStyles:h,minMediaStyles:u,maxMediaStyles:f,aside:r,theme:s,mode:c}),g6({baseStyles:h,minMediaStyles:u,header:t,mode:c}),m6({baseStyles:h,minMediaStyles:u,footer:n,mode:c}),y6({baseStyles:h,minMediaStyles:u,padding:o});const m=Od(pn(u),s.breakpoints).map(x=>({query:`(min-width: ${Dp(x.px)})`,styles:u[x.value]})),g=Od(pn(f),s.breakpoints).map(x=>({query:`(max-width: ${Dp(x.px)})`,styles:f[x.value]})),y=[...m,...g];return{baseStyles:h,media:y}}function b6({navbar:e,header:t,aside:n,footer:r,padding:o,mode:s,selector:c}){const u=kn(),f=_a(),{media:h,baseStyles:m}=x6({navbar:e,header:t,footer:r,aside:n,padding:o,theme:u,mode:s});return a.jsx(Ul,{media:h,styles:m,selector:c||f.cssVariablesSelector})}const i0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:u,withBorder:f,zIndex:h,mod:m,...g}=oe("AppShellNavbar",null,e),y=fu();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:o}),...g,__vars:{"--app-shell-navbar-z-index":`calc(${h??y.zIndex} + 1)`}})});i0.classes=Ps;i0.displayName="@mantine/core/AppShellNavbar";const o0=ar((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,grow:u,mod:f,...h}=oe("AppShellSection",null,e),m=fu();return a.jsx(le,{ref:t,mod:[{grow:u},f],...m.getStyles("section",{className:r,style:o,classNames:n,styles:s}),...h})});o0.classes=Ps;o0.displayName="@mantine/core/AppShellSection";function S6({transitionDuration:e,disabled:t}){const[n,r]=v.useState(!0),o=v.useRef(-1),s=v.useRef(-1);return s2("resize",()=>{r(!0),clearTimeout(o.current),o.current=window.setTimeout(()=>v.startTransition(()=>{r(!1)}),200)}),Ll(()=>{r(!0),clearTimeout(s.current),s.current=window.setTimeout(()=>v.startTransition(()=>{r(!1)}),e||0)},[t,e]),n}const j6={withBorder:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:Br("app"),mode:"fixed"},w6=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),kr=ve((e,t)=>{const n=oe("AppShell",j6,e),{classNames:r,className:o,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:k,mod:L,attributes:D,id:P,...$}=n,U=Ue({name:"AppShell",classes:Ps,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:D,vars:f,varsResolver:w6}),W=S6({disabled:T,transitionDuration:y}),Y=pr(P);return a.jsxs(h6,{value:{getStyles:U,withBorder:m,zIndex:w,disabled:T,offsetScrollbars:_,mode:k},children:[a.jsx(b6,{navbar:h,header:S,aside:R,footer:E,padding:g,mode:k,selector:k==="static"?`#${Y}`:void 0}),a.jsx(le,{ref:t,...U("root"),mod:[{resizing:W,layout:C,disabled:T,mode:k},L],id:Y,...$})]})});kr.classes=Ps;kr.displayName="@mantine/core/AppShell";kr.Navbar=i0;kr.Header=n0;kr.Main=r0;kr.Aside=e0;kr.Footer=t0;kr.Section=o0;function _D(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=>_D(t))}:e}function DD(e){return e?e.map(t=>_D(t)):[]}function AD(e){return e.reduce((t,n)=>"group"in n?{...t,...AD(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 C6={error:null},E6=(e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":rt(t,"combobox-chevron-size"),"--combobox-chevron-color":n?Xt(n,e):void 0}}),jm=ve((e,t)=>{const n=oe("ComboboxChevron",C6,e),{size:r,error:o,style:s,className:c,classNames:u,styles:f,unstyled:h,vars:m,mod:g,...y}=n,x=Ue({name:"ComboboxChevron",classes:$r,props:n,style:s,className:c,classNames:u,styles:f,unstyled:h,vars:m,varsResolver:E6,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:o},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"})})});jm.classes=$r;jm.displayName="@mantine/core/ComboboxChevron";const[T6,qi]=Or("Combobox component was not found in tree"),kD=v.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},s)=>a.jsx(gn.ClearButton,{ref:s,tabIndex:-1,"aria-hidden":!0,...o,onMouseDown:c=>{c.preventDefault(),t?.(c)},onClick:c=>{r(),n?.(c)}}));kD.displayName="@mantine/core/ComboboxClearButton";const a0=ve((e,t)=>{const{classNames:n,styles:r,className:o,style:s,hidden:c,...u}=oe("ComboboxDropdown",null,e),f=qi();return a.jsx(ei.Dropdown,{...u,ref:t,role:"presentation","data-hidden":c||void 0,...f.getStyles("dropdown",{className:o,style:s,classNames:n,styles:r})})});a0.classes=$r;a0.displayName="@mantine/core/ComboboxDropdown";const R6={refProp:"ref"},PD=ve((e,t)=>{const{children:n,refProp:r}=oe("ComboboxDropdownTarget",R6,e);if(qi(),!sm(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(ei.Target,{ref:t,refProp:r,children:n})});PD.displayName="@mantine/core/ComboboxDropdownTarget";const s0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...u}=oe("ComboboxEmpty",null,e),f=qi();return a.jsx(le,{ref:t,...f.getStyles("empty",{className:r,classNames:n,styles:s,style:o}),...u})});s0.classes=$r;s0.displayName="@mantine/core/ComboboxEmpty";function l0({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o,autoComplete:s}){const c=qi(),[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()):o==="button"&&(g.preventDefault(),c.store.openDropdown("keyboard"))}g.key==="Escape"&&c.store.closeDropdown("keyboard"),g.nativeEvent.code==="Space"&&o==="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 _6={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},ND=ve((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:s,withExpandedAttribute:c,targetType:u,autoComplete:f,...h}=oe("ComboboxEventsTarget",_6,e),m=Il(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=qi(),y=l0({targetType:u,withAriaAttributes:s,withKeyboardNavigation:o,withExpandedAttribute:c,onKeyDown:m.props.onKeyDown,autoComplete:f});return v.cloneElement(m,{...y,...h,[r]:Fn(t,g.store.targetRef,lm(m))})});ND.displayName="@mantine/core/ComboboxEventsTarget";const c0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...u}=oe("ComboboxFooter",null,e),f=qi();return a.jsx(le,{ref:t,...f.getStyles("footer",{className:r,classNames:n,style:o,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:o,styles:s,vars:c,children:u,label:f,id:h,...m}=oe("ComboboxGroup",null,e),g=qi(),y=pr(h);return a.jsxs(le,{ref:t,role:"group","aria-labelledby":f?y:void 0,...g.getStyles("group",{className:r,classNames:n,style:o,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:o,styles:s,vars:c,...u}=oe("ComboboxHeader",null,e),f=qi();return a.jsx(le,{ref:t,...f.getStyles("header",{className:r,classNames:n,style:o,styles:s}),...u,onMouseDown:h=>{h.preventDefault()}})});d0.classes=$r;d0.displayName="@mantine/core/ComboboxHeader";function OD({value:e,valuesDivider:t=",",...n}){return a.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(t):e||"",...n})}OD.displayName="@mantine/core/ComboboxHiddenInput";const f0=ve((e,t)=>{const n=oe("ComboboxOption",null,e),{classNames:r,className:o,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=qi(),R=v.useId(),E=h||R;return a.jsx(le,{...T.getStyles("option",{className:o,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=oe("ComboboxOptions",null,e),{classNames:r,className:o,style:s,styles:c,id:u,onMouseDown:f,labelledBy:h,...m}=n,g=qi(),y=pr(u);return v.useEffect(()=>{g.store.setListId(y)},[y]),a.jsx(le,{ref:t,...g.getStyles("options",{className:o,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 D6={withAriaAttributes:!0,withKeyboardNavigation:!0},p0=ve((e,t)=>{const n=oe("ComboboxSearch",D6,e),{classNames:r,styles:o,unstyled:s,vars:c,withAriaAttributes:u,onKeyDown:f,withKeyboardNavigation:h,size:m,...g}=n,y=qi(),x=y.getStyles("search"),S=l0({targetType:"input",withAriaAttributes:u,withKeyboardNavigation:h,withExpandedAttribute:!1,onKeyDown:f,autoComplete:"off"});return a.jsx(gn,{ref:Fn(t,y.store.searchRef),classNames:[{input:x.className},r],styles:[{input:x.style},o],size:m||y.size,...S,...g,__staticSelector:"Combobox"})});p0.classes=$r;p0.displayName="@mantine/core/ComboboxSearch";const A6={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},MD=ve((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:s,withExpandedAttribute:c,targetType:u,autoComplete:f,...h}=oe("ComboboxTarget",A6,e),m=Il(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=qi(),y=l0({targetType:u,withAriaAttributes:s,withKeyboardNavigation:o,withExpandedAttribute:c,onKeyDown:m.props.onKeyDown,autoComplete:f}),x=v.cloneElement(m,{...y,...h});return a.jsx(ei.Target,{ref:Fn(t,g.store.targetRef),children:x})});MD.displayName="@mantine/core/ComboboxTarget";function k6(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 P6(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 N6(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function Bl({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:s=!0,scrollBehavior:c="instant"}={}){const[u,f]=ir({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((M="unknown")=>{u||(f(!0),o?.(M))},[f,o,u]),T=v.useCallback((M="unknown")=>{u&&(f(!1),r?.(M))},[f,r,u]),R=v.useCallback((M="unknown")=>{u?T(M):C(M)},[T,C,u]),E=v.useCallback(()=>{const M=us(y.current),I=yp(`#${h.current} [data-combobox-selected]`,M);I?.removeAttribute("data-combobox-selected"),I?.removeAttribute("aria-selected")},[]),_=v.useCallback(M=>{const I=us(y.current),z=yp(`#${h.current}`,I),V=z?hs("[data-combobox-option]",z):null;if(!V)return null;const K=M>=V.length?0:M<0?V.length-1:M;return m.current=K,V?.[K]&&!V[K].hasAttribute("data-combobox-disabled")?(E(),V[K].setAttribute("data-combobox-selected","true"),V[K].setAttribute("aria-selected","true"),V[K].scrollIntoView({block:"nearest",behavior:c}),V[K].id):null},[c,E]),k=v.useCallback(()=>{const M=us(y.current),I=yp(`#${h.current} [data-combobox-active]`,M);if(I){const V=hs(`#${h.current} [data-combobox-option]`,M).findIndex(K=>K===I);return _(V)}return _(0)},[_]),L=v.useCallback(()=>{const M=us(y.current),I=hs(`#${h.current} [data-combobox-option]`,M);return _(P6(m.current,I,s))},[_,s]),D=v.useCallback(()=>{const M=us(y.current),I=hs(`#${h.current} [data-combobox-option]`,M);return _(k6(m.current,I,s))},[_,s]),P=v.useCallback(()=>{const M=us(y.current),I=hs(`#${h.current} [data-combobox-option]`,M);return _(N6(I))},[_]),$=v.useCallback((M="selected",I)=>{w.current=window.setTimeout(()=>{const z=us(y.current),V=hs(`#${h.current} [data-combobox-option]`,z),K=V.findIndex(O=>O.hasAttribute(`data-combobox-${M}`));m.current=K,I?.scrollIntoView&&V[K]?.scrollIntoView({block:"nearest",behavior:c})},0)},[]),U=v.useCallback(()=>{m.current=-1,E()},[E]),W=v.useCallback(()=>{const M=us(y.current);hs(`#${h.current} [data-combobox-option]`,M)?.[m.current]?.click()},[]),Y=v.useCallback(M=>{h.current=M},[]),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:P,selectActiveOption:k,selectNextOption:L,selectPreviousOption:D,resetSelectedOption:U,updateSelectedOptionIndex:$,listId:h.current,setListId:Y,clickSelectedOption:W,searchRef:g,focusSearchInput:ee,targetRef:y,focusTarget:B}}const O6={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0},size:"sm"},M6=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Yn(t),"--combobox-option-padding":rt(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:ce(n),"--combobox-option-fz":Yn(t),"--combobox-option-padding":rt(t,"combobox-option-padding")}});function Qe(e){const t=oe("Combobox",O6,e),{classNames:n,styles:r,unstyled:o,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=Bl(),R=c||T,E=Ue({name:x||"Combobox",classes:$r,props:t,classNames:n,styles:r,unstyled:o,attributes:w,vars:u,varsResolver:M6}),_=()=>{h?.(),R.closeDropdown()};return a.jsx(T6,{value:{getStyles:E,store:R,onOptionSubmit:f,size:m,resetSelectionOnOptionHover:y,readOnly:S},children:a.jsx(ei,{opened:R.dropdownOpened,preventPositionChangeWhenVisible:!1,...C,onChange:k=>!k&&_(),withRoles:!1,unstyled:o,children:s})})}const L6=e=>e;Qe.extend=L6;Qe.classes=$r;Qe.displayName="@mantine/core/Combobox";Qe.Target=MD;Qe.Dropdown=a0;Qe.Options=h0;Qe.Option=f0;Qe.Search=p0;Qe.Empty=s0;Qe.Chevron=jm;Qe.Footer=c0;Qe.Header=d0;Qe.EventsTarget=ND;Qe.DropdownTarget=PD;Qe.Group=u0;Qe.ClearButton=kD;Qe.HiddenInput=OD;var LD={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const ID=LD,wm=v.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:o,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:_,...k},L)=>{const D=Ue({name:e,props:t,className:n,style:T,classes:LD,classNames:r,styles:o,unstyled:s,attributes:_});return a.jsx(le,{...D("root"),ref:L,__vars:{"--label-fz":Yn(y),"--label-lh":rt(y,"label-lh")},mod:[{"label-position":x},E],variant:C,size:y,...k,children:a.jsxs(le,{component:S,htmlFor:S==="label"?h:void 0,...D("body"),children:[c,a.jsxs("div",{...D("labelWrapper"),"data-disabled":m||void 0,children:[u&&a.jsx(le,{component:w,htmlFor:w==="label"?h:void 0,...D("label"),"data-disabled":m||void 0,children:u}),f&&a.jsx(gn.Description,{size:y,__inheritStyles:!1,...D("description"),children:f}),g&&typeof g!="boolean"&&a.jsx(gn.Error,{size:y,__inheritStyles:!1,...D("error"),children:g})]})]})})});wm.displayName="@mantine/core/InlineInput";var zD={root:"m_bf2d988c",inner:"m_26062bec",input:"m_26063560",icon:"m_bf295423","input--outline":"m_215c4542"};const $D=v.createContext(null),I6=$D.Provider,UD=()=>v.useContext($D),[z6,$6]=Wo();var BD={card:"m_26775b0a"};const U6={withBorder:!0},B6=(e,{radius:t})=>({card:{"--card-radius":Ht(t)}}),m0=ve((e,t)=>{const n=oe("CheckboxCard",U6,e),{classNames:r,className:o,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=Ue({name:"CheckboxCard",classes:BD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:B6,rootSelector:"card"}),E=UD(),_=typeof h=="boolean"?h:E?E.value.includes(y||""):void 0,[k,L]=ir({value:_,defaultValue:S,finalValue:!1,onChange:w});return a.jsx(z6,{value:{checked:k},children:a.jsx(_n,{ref:t,mod:[{"with-border":g,checked:k},m],...R("card"),...T,role:"checkbox","aria-checked":k,onClick:D=>{x?.(D),E?.onChange(y||""),L(!k)}})})});m0.displayName="@mantine/core/CheckboxCard";m0.classes=BD;function g0({children:e,role:t}){const n=du();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:o,size:s,wrapperProps:c,children:u,readOnly:f,disabled:h,...m}=oe("CheckboxGroup",null,e),[g,y]=ir({value:n,defaultValue:r,finalValue:[],onChange:o}),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(I6,{value:{value:g,onChange:x,size:s,disabled:h},children:a.jsx(gn.Wrapper,{size:s,ref:t,...c,...m,labelElement:"div",__staticSelector:"CheckboxGroup",children:a.jsx(g0,{role:"group",children:u})})})});v0.classes=gn.Wrapper.classes;v0.displayName="@mantine/core/CheckboxGroup";function hf({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 VD({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(hf,{...t})}var FD={indicator:"m_5e5256ee",icon:"m_1b1c543a","indicator--outline":"m_76e20374"};const V6={icon:VD,variant:"filled"},F6=(e,{radius:t,color:n,size:r,iconColor:o,variant:s,autoContrast:c})=>{const u=Jr({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":rt(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:Ht(t),"--checkbox-color":s==="outline"?f:Xt(n,e),"--checkbox-icon-color":o?Xt(o,e):$l(c,e)?Da({color:n,theme:e,autoContrast:c}):void 0}}},y0=ve((e,t)=>{const n=oe("CheckboxIndicator",V6,e),{classNames:r,className:o,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,k=Ue({name:"CheckboxIndicator",classes:FD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:E,vars:f,varsResolver:F6,rootSelector:"indicator"}),L=$6(),D=typeof w=="boolean"||typeof m=="boolean"?w||m:L?.checked||!1;return a.jsx(le,{ref:t,...k("indicator",{variant:T}),variant:T,mod:[{checked:D,disabled:R},C],..._,children:a.jsx(h,{indeterminate:m,...k("icon")})})});y0.displayName="@mantine/core/CheckboxIndicator";y0.classes=FD;const H6={labelPosition:"right",icon:VD,variant:"filled"},q6=(e,{radius:t,color:n,size:r,iconColor:o,variant:s,autoContrast:c})=>{const u=Jr({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":rt(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:Ht(t),"--checkbox-color":s==="outline"?f:Xt(n,e),"--checkbox-icon-color":o?Xt(o,e):$l(c,e)?Da({color:n,theme:e,autoContrast:c}):void 0}}},hn=ve((e,t)=>{const n=oe("Checkbox",H6,e),{classNames:r,className:o,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:k,icon:L,rootRef:D,iconColor:P,onChange:$,autoContrast:U,mod:W,attributes:Y,...ee}=n,B=UD(),G=y||B?.size,M=Ue({name:"Checkbox",props:n,classes:zD,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:Y,vars:f,varsResolver:q6}),{styleProps:I,rest:z}=Aa(ee),V=pr(g),K={checked:B?.value.includes(z.value)??w,onChange:se=>{B?.onChange(se),$?.(se)},disabled:B?.disabled??E},O=v.useRef(null),F=t||O;return v.useEffect(()=>{F&&"current"in F&&F.current&&(F.current.indeterminate=k||!1,k?F.current.setAttribute("data-indeterminate","true"):F.current.removeAttribute("data-indeterminate"))},[k,F]),a.jsx(wm,{...M("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:V,size:G,labelPosition:C,label:m,description:T,error:R,disabled:K.disabled,classNames:r,styles:c,unstyled:u,"data-checked":K.checked||w||void 0,variant:_,ref:D,mod:W,inert:z.inert,...I,...S,children:a.jsxs(le,{...M("inner"),mod:{"data-label-position":C},children:[a.jsx(le,{component:"input",id:V,ref:F,mod:{error:!!R},...M("input",{focusable:!0,variant:_}),...z,...K,inert:z.inert,type:"checkbox"}),a.jsx(L,{indeterminate:k,...M("icon")})]})})});hn.classes={...zD,...ID};hn.displayName="@mantine/core/Checkbox";hn.Group=v0;hn.Indicator=y0;hn.Card=m0;function eu(e){return"group"in e}function HD({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),o=[];for(let s=0;s<e.length;s+=1){const c=e[s];if(o.length===n)return o;eu(c)&&o.push({group:c.group,items:HD({options:c.items,search:t,limit:n-o.length})}),eu(c)||c.label.toLowerCase().includes(r)&&o.push(c)}return o}function G6(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 qD(e,t=new Set){if(Array.isArray(e))for(const n of e)if(eu(n))qD(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 W6(e,t){return Array.isArray(e)?e.includes(t):e===t}function GD({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:o,unstyled:s,renderOption:c}){if(!eu(e)){const f=W6(r,e.value),h=t&&(f?a.jsx(hf,{className:$r.optionsDropdownCheckIcon}):n?a.jsx("div",{className:$r.optionsDropdownCheckPlaceholder}):null),m=a.jsxs(a.Fragment,{children:[o==="left"&&h,a.jsx("span",{children:e.label}),o==="right"&&h]});return a.jsx(Qe.Option,{value:e.value,disabled:e.disabled,className:Ft({[$r.optionsDropdownOption]:!s}),"data-reverse":o==="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(GD,{data:f,value:r,unstyled:s,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:o,renderOption:c},f.value));return a.jsx(Qe.Group,{label:e.group,children:u})}function Q6({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:o,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}){qD(e);const _=typeof o=="string"?(r||HD)({options:e,search:f?o:"",limit:s??1/0}):e,k=G6(_),L=_.map(D=>a.jsx(GD,{data:D,withCheckIcon:h,withAlignedLabels:m,value:g,checkIconPosition:y,unstyled:S,renderOption:C},eu(D)?D.group:D.value));return a.jsx(Qe.Dropdown,{hidden:t||n&&k,"data-composed":!0,children:a.jsxs(Qe.Options,{labelledBy:w,"aria-label":R,children:[u?a.jsx(Zr.Autosize,{mah:c??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...T,children:L}):L,k&&x&&a.jsx(Qe.Empty,{children:x})]})})}var Cm={group:"m_11def92b",root:"m_f85678b6",image:"m_11f8ac07",placeholder:"m_104cd71f"};const WD=v.createContext(null),Y6=WD.Provider;function K6(){return{withinGroup:!!v.useContext(WD)}}const X6=(e,{spacing:t})=>({group:{"--ag-spacing":Qn(t)}}),x0=ve((e,t)=>{const n=oe("AvatarGroup",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,spacing:h,attributes:m,...g}=n,y=Ue({name:"AvatarGroup",classes:Cm,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:m,vars:f,varsResolver:X6,rootSelector:"group"});return a.jsx(Y6,{value:!0,children:a.jsx(le,{ref:t,...y("group"),...g})})});x0.classes=Cm;x0.displayName="@mantine/core/AvatarGroup";function J6(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 Z6(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 e7=["blue","cyan","grape","green","indigo","lime","orange","pink","red","teal","violet"];function t7(e,t=e7){const n=Z6(e),r=Math.abs(n)%t.length;return t[r]}function n7(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 r7=(e,{size:t,radius:n,variant:r,gradient:o,color:s,autoContrast:c,name:u,allowedInitialsColors:f})=>{const h=s==="initials"&&typeof u=="string"?t7(u,f):s,m=e.variantColorResolver({color:h||"gray",theme:e,gradient:o,variant:r||"light",autoContrast:c});return{root:{"--avatar-size":rt(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}}},tu=ar((e,t)=>{const n=oe("Avatar",null,e),{classNames:r,className:o,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:_,...k}=n,L=K6(),[D,P]=v.useState(!h),$=Ue({name:"Avatar",props:n,classes:Cm,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:_,vars:f,varsResolver:r7});return v.useEffect(()=>P(!h),[h]),a.jsx(le,{...$("root"),mod:[{"within-group":L.withinGroup},T],ref:t,...k,children:D||!h?a.jsx("span",{...$("placeholder"),title:m,children:w||typeof R=="string"&&n7(R)||a.jsx(J6,{})}):a.jsx("img",{...S,...$("image"),src:h,alt:m,onError:U=>{P(!0),S?.onError?.(U)}})})});tu.classes=Cm;tu.displayName="@mantine/core/Avatar";tu.Group=x0;var QD={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const i7=(e,{radius:t,color:n,gradient:r,variant:o,size:s,autoContrast:c,circle:u})=>{const f=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:c});return{root:{"--badge-height":rt(s,"badge-height"),"--badge-padding-x":rt(s,"badge-padding-x"),"--badge-fz":rt(s,"badge-fz"),"--badge-radius":u||t===void 0?void 0:Ht(t),"--badge-bg":n||o?f.background:void 0,"--badge-color":n||o?f.color:void 0,"--badge-bd":n||o?f.border:void 0,"--badge-dot-color":o==="dot"?Xt(n,e):void 0}}},b0=ar((e,t)=>{const n=oe("Badge",null,e),{classNames:r,className:o,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:_,...k}=n,L=Ue({name:"Badge",props:n,classes:QD,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:_,vars:f,varsResolver:i7});return a.jsxs(le,{variant:w,mod:[{block:C,circle:R,"with-right-section":!!x,"with-left-section":!!y},E],...L("root",{variant:w}),ref:t,...k,children:[y&&a.jsx("span",{...L("section"),"data-position":"left",children:y}),a.jsx("span",{...L("label"),children:S}),x&&a.jsx("span",{...L("section"),"data-position":"right",children:x})]})});b0.classes=QD;b0.displayName="@mantine/core/Badge";var YD={root:"m_ddec01c0",icon:"m_dde7bd57",cite:"m_dde51a35"};const o7={iconSize:48},a7=(e,{color:t,iconSize:n,radius:r})=>{const o=Jr({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),s=Jr({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":Oi(s.value,.07),"--bq-bg-dark":Oi(o.value,.06),"--bq-bd":Xt(t,e),"--bq-icon-size":ce(n),"--bq-radius":Ht(r)}}},S0=ve((e,t)=>{const n=oe("Blockquote",o7,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,children:h,icon:m,iconSize:g,cite:y,attributes:x,...S}=n,w=Ue({name:"Blockquote",classes:YD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:a7});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=YD;S0.displayName="@mantine/core/Blockquote";var hu={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"},s7=(e,{borderWidth:t})=>({group:{"--button-border-width":ce(t)}}),j0=ve((e,t)=>{const n=oe("ButtonGroup",tT,e),{className:r,style:o,classNames:s,styles:c,unstyled:u,orientation:f,vars:h,borderWidth:m,variant:g,mod:y,attributes:x,...S}=oe("ButtonGroup",tT,e),w=Ue({name:"ButtonGroup",props:n,classes:hu,className:r,style:o,classNames:s,styles:c,unstyled:u,attributes:x,vars:h,varsResolver:s7,rootSelector:"group"});return a.jsx(le,{...w("group"),ref:t,variant:g,mod:[{"data-orientation":f},y],role:"group",...S})});j0.classes=hu;j0.displayName="@mantine/core/ButtonGroup";const l7=(e,{radius:t,color:n,gradient:r,variant:o,autoContrast:s,size:c})=>{const u=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{groupSection:{"--section-height":rt(c,"section-height"),"--section-padding-x":rt(c,"section-padding-x"),"--section-fz":c?.includes("compact")?Yn(c.replace("compact-","")):Yn(c),"--section-radius":t===void 0?void 0:Ht(t),"--section-bg":n||o?u.background:void 0,"--section-color":u.color,"--section-bd":n||o?u.border:void 0}}},w0=ve((e,t)=>{const n=oe("ButtonGroupSection",null,e),{className:r,style:o,classNames:s,styles:c,unstyled:u,vars:f,variant:h,gradient:m,radius:g,autoContrast:y,attributes:x,...S}=n,w=Ue({name:"ButtonGroupSection",props:n,classes:hu,className:r,style:o,classNames:s,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:l7,rootSelector:"groupSection"});return a.jsx(le,{...w("groupSection"),ref:t,variant:h,...S})});w0.classes=hu;w0.displayName="@mantine/core/ButtonGroupSection";const c7={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${ce(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},u7=(e,{radius:t,color:n,gradient:r,variant:o,size:s,justify:c,autoContrast:u})=>{const f=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:u});return{root:{"--button-justify":c,"--button-height":rt(s,"button-height"),"--button-padding-x":rt(s,"button-padding-x"),"--button-fz":s?.includes("compact")?Yn(s.replace("compact-","")):Yn(s),"--button-radius":t===void 0?void 0:Ht(t),"--button-bg":n||o?f.background:void 0,"--button-hover":n||o?f.hover:void 0,"--button-color":f.color,"--button-bd":n||o?f.border:void 0,"--button-hover-color":n||o?f.hoverColor:void 0}}},Oe=ar((e,t)=>{const n=oe("Button",null,e),{style:r,vars:o,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:k,mod:L,attributes:D,...P}=n,$=Ue({name:"Button",props:n,classes:hu,className:s,style:r,classNames:T,styles:R,unstyled:E,attributes:D,vars:o,varsResolver:u7}),U=!!h,W=!!m;return a.jsxs(_n,{ref:t,...$("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":W},L],...P,children:[typeof S=="boolean"&&a.jsx(po,{mounted:S,transition:c7,duration:150,children:Y=>a.jsx(le,{component:"span",...$("loader",{style:Y}),"aria-hidden":!0,children:a.jsx(Pr,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...w})})}),a.jsxs("span",{...$("inner"),children:[h&&a.jsx(le,{component:"span",...$("section"),mod:{position:"left"},children:h}),a.jsx(le,{component:"span",mod:{loading:S},...$("label"),children:f}),m&&a.jsx(le,{component:"span",...$("section"),mod:{position:"right"},children:m})]})]})});Oe.classes=hu;Oe.displayName="@mantine/core/Button";Oe.Group=j0;Oe.GroupSection=w0;var KD={root:"m_4451eb3a"};const No=ar((e,t)=>{const n=oe("Center",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,inline:h,mod:m,attributes:g,...y}=n,x=Ue({name:"Center",props:n,classes:KD,className:o,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})});No.classes=KD;No.displayName="@mantine/core/Center";var XD={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[d7,f7]=Wo();function JD(e){const{value:t,defaultValue:n,onChange:r,multiple:o,children:s}=oe("ChipGroup",null,e),[c,u]=ir({value:t,defaultValue:n,finalValue:o?[]: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(d7,{value:{isChipSelected:f,onChange:h,multiple:o},children:s})}JD.displayName="@mantine/core/ChipGroup";const h7={type:"checkbox"},p7=(e,{size:t,radius:n,variant:r,color:o,autoContrast:s})=>{const c=e.variantColorResolver({color:o||e.primaryColor,theme:e,variant:r||"filled",autoContrast:s});return{root:{"--chip-fz":Yn(t),"--chip-size":rt(t,"chip-size"),"--chip-radius":n===void 0?void 0:Ht(n),"--chip-checked-padding":rt(t,"chip-checked-padding"),"--chip-padding":rt(t,"chip-padding"),"--chip-icon-size":rt(t,"chip-icon-size"),"--chip-bg":o||r?c.background:void 0,"--chip-hover":o||r?c.hover:void 0,"--chip-color":o||r?c.color:void 0,"--chip-bd":o||r?c.border:void 0,"--chip-spacing":rt(t,"chip-spacing")}}},$d=ve((e,t)=>{const n=oe("Chip",h7,e),{classNames:r,className:o,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:k,autoContrast:L,mod:D,attributes:P,...$}=n,U=Ue({name:"Chip",classes:XD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:P,vars:f,varsResolver:p7}),W=f7(),Y=pr(h),{styleProps:ee,rest:B}=Aa($),[G,M]=ir({value:m,defaultValue:g,finalValue:!1,onChange:y}),I=W?{checked:W.isChipSelected(x),onChange:V=>{W.onChange(V),y?.(V.currentTarget.checked)},type:W.multiple?"checkbox":"radio"}:{},z=I.checked||G;return a.jsxs(le,{size:R,variant:E,ref:k,mod:D,...U("root"),...ee,...S,children:[a.jsx("input",{type:w,...U("input"),checked:z,onChange:V=>M(V.currentTarget.checked),id:Y,disabled:C,ref:t,value:x,...I,...B}),a.jsxs("label",{htmlFor:Y,"data-checked":z||void 0,"data-disabled":C||void 0,...U("label",{variant:E||"filled"}),children:[z&&_!==null&&_!==!1&&a.jsx("span",{...U("iconWrapper"),children:_===void 0?a.jsx(hf,{...U("checkIcon")}):_}),a.jsx("span",{children:T})]})]})});$d.classes=XD;$d.displayName="@mantine/core/Chip";$d.Group=JD;var ZD={root:"m_b183c0a2"};const m7=(e,{color:t})=>({root:{"--code-bg":t?Xt(t,e):void 0}}),pf=ve((e,t)=>{const n=oe("Code",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,color:h,block:m,variant:g,mod:y,attributes:x,...S}=n,w=Ue({name:"Code",props:n,classes:ZD,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:m7});return a.jsx(le,{component:m?"pre":"code",variant:g,ref:t,mod:[{block:m},y],...w("root"),...S,dir:"ltr"})});pf.classes=ZD;pf.displayName="@mantine/core/Code";var eA={root:"m_7485cace"};const g7=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:rt(t,"container-size")}}),mf=ve((e,t)=>{const n=oe("Container",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,fluid:h,mod:m,attributes:g,strategy:y,...x}=n,S=Ue({name:"Container",classes:eA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:g,vars:f,varsResolver:g7});return a.jsx(le,{ref:t,mod:[{fluid:h,strategy:y||"block"},m],...S("root"),...x})});mf.classes=eA;mf.displayName="@mantine/core/Container";const v7={timeout:1e3};function C0(e){const{children:t,timeout:n,value:r,...o}=oe("CopyButton",v7,e),s=t2({timeout:n}),c=()=>s.copy(r);return a.jsx(a.Fragment,{children:t({copy:c,copied:s.copied,...o})})}C0.displayName="@mantine/core/CopyButton";var tA={root:"m_3eebeb36",label:"m_9e365f20"};const y7={orientation:"horizontal"},x7=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?Xt(t,e):void 0,"--divider-border-style":n,"--divider-size":rt(r,"divider-size")}}),fn=ve((e,t)=>{const n=oe("Divider",y7,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,color:h,orientation:m,label:g,labelPosition:y,mod:x,attributes:S,...w}=n,C=Ue({name:"Divider",classes:tA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:x7});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})})});fn.classes=tA;fn.displayName="@mantine/core/Divider";const[nT,nA]=Or("Grid component was not found in tree");var E0={container:"m_8478a6da",root:"m_410352e9",inner:"m_dee7bd2f",col:"m_96bdd299"};const Bx=(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":Bx(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 b7({span:e,order:t,offset:n,selector:r}){const o=kn(),s=nA(),c=s.breakpoints||o.breakpoints,f=so(e)===void 0?12:so(e),h=_s({"--col-order":so(t)?.toString(),"--col-flex-grow":iT(f,s.grow),"--col-flex-basis":Bx(f,s.columns),"--col-width":f==="content"?"auto":void 0,"--col-max-width":rT(f,s.columns,s.grow),"--col-offset":oT(so(n),s.columns)}),m=pn(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"]=Bx(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=Od(pn(m),c).filter(x=>pn(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(Ul,{styles:h,media:s.type==="container"?void 0:y,container:s.type==="container"?y:void 0,selector:r})}const S7={span:12},T0=ve((e,t)=>{const n=oe("GridCol",S7,e),{classNames:r,className:o,style:s,styles:c,vars:u,span:f,order:h,offset:m,...g}=n,y=nA(),x=af();return a.jsxs(a.Fragment,{children:[a.jsx(b7,{selector:`.${x}`,span:f,order:h,offset:m}),a.jsx(le,{ref:t,...y.getStyles("col",{className:Ft(o,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 o=kn(),s=n||o.breakpoints,c=_s({"--grid-gutter":Qn(so(e))}),u=pn(s).reduce((m,g)=>(m[g]||(m[g]={}),typeof e=="object"&&e[g]!==void 0&&(m[g]["--grid-gutter"]=Qn(e[g])),m),{}),h=Od(pn(u),s).filter(m=>pn(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(Ul,{styles:c,media:r==="container"?void 0:h,container:r==="container"?h:void 0,selector:t})}const j7={gutter:"md",grow:!1,columns:12},w7=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),Nt=ve((e,t)=>{const n=oe("Grid",j7,e),{classNames:r,className:o,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=Ue({name:"Grid",classes:E0,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:T,vars:f,varsResolver:w7}),_=af();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=Jr({color:e,theme:t});return r.isThemeColor?r.shade===void 0?`var(--mantine-color-${r.color}-${n})`:`var(${r.variable})`:e}var rA={root:"m_bcb3f3c2"};const C7={color:"yellow"},E7=(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=oe("Mark",C7,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,color:h,variant:m,attributes:g,...y}=n,x=Ue({name:"Mark",props:n,className:o,style:s,classes:rA,classNames:r,styles:c,unstyled:u,attributes:g,vars:f,varsResolver:E7});return a.jsx(le,{component:"mark",ref:t,variant:m,...x("root"),...y})});R0.classes=rA;R0.displayName="@mantine/core/Mark";function lT(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")}function T7(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 o=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(`(${o})`,"gi");return e.split(s).map(u=>({chunk:u,highlighted:s.test(u)})).filter(({chunk:u})=>u)}const _0=ar((e,t)=>{const{unstyled:n,children:r,highlight:o,highlightStyles:s,color:c,...u}=oe("Highlight",null,e),f=T7(r,o);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 iA={root:"m_9e117634"};const R7=(e,{radius:t,fit:n})=>({root:{"--image-radius":t===void 0?void 0:Ht(t),"--image-object-fit":n}}),D0=ar((e,t)=>{const n=oe("Image",null,e),{classNames:r,className:o,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=Ue({name:"Image",classes:iA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:w,vars:f,varsResolver:R7});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=iA;D0.displayName="@mantine/core/Image";function zp(){return zp=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},zp.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 _7=v.useLayoutEffect,D7=function(t){var n=In.useRef(t);return _7(function(){n.current=t}),n},cT=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},A7=function(t,n){var r=In.useRef();return In.useCallback(function(o){t.current=o,r.current&&cT(r.current,null),r.current=n,n&&cT(n,o)},[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"},k7=function(t){Object.keys(uT).forEach(function(n){t.style.setProperty(n,uT[n],"important")})},dT=k7,Lr=null,fT=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function P7(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Lr||(Lr=document.createElement("textarea"),Lr.setAttribute("tabindex","-1"),Lr.setAttribute("aria-hidden","true"),dT(Lr)),Lr.parentNode===null&&document.body.appendChild(Lr);var o=e.paddingSize,s=e.borderSize,c=e.sizingStyle,u=c.boxSizing;Object.keys(c).forEach(function(y){var x=y;Lr.style[x]=c[x]}),dT(Lr),Lr.value=t;var f=fT(Lr,e);Lr.value=t,f=fT(Lr,e),Lr.value="x";var h=Lr.scrollHeight-o,m=h*n;u==="border-box"&&(m=m+o+s),f=Math.max(m,f);var g=h*r;return u==="border-box"&&(g=g+o+s),f=Math.min(g,f),[f,h]}var hT=function(){},N7=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},O7=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],M7=!!document.documentElement.currentStyle,L7=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=N7(O7,n),o=r.boxSizing;if(o==="")return null;M7&&o==="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}},I7=L7;function k0(e,t,n){var r=D7(n);v.useLayoutEffect(function(){var o=function(c){return r.current(c)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var z7=function(t,n){k0(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},$7=function(t){k0(window,"resize",t)},U7=function(t){k0(document.fonts,"loadingdone",t)},B7=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],V7=function(t,n){var r=t.cacheMeasurements,o=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,B7),g=m.value!==void 0,y=v.useRef(null),x=A7(y,n),S=v.useRef(0),w=v.useRef(),C=function(){var E=y.current,_=r&&w.current?w.current:I7(E);if(_){w.current=_;var k=P7(_,E.value||E.placeholder||"x",s,o),L=k[0],D=k[1];S.current!==L&&(S.current=L,E.style.setProperty("height",L+"px","important"),h(L,{rowHeight:D}))}},T=function(E){g||C(),u(E)};return v.useLayoutEffect(C),z7(y,function(){if(!g){var R=y.current.value;requestAnimationFrame(function(){var E=y.current;E&&R!==E.value&&C()})}}),$7(C),U7(C),v.createElement("textarea",zp({},m,{onChange:T,ref:x}))},F7=v.forwardRef(V7);const H7={size:"sm"},Vl=ve((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:s,resize:c,...u}=oe("Textarea",H7,e),f=n&&l2()!=="test",h=f?{maxRows:r,minRows:o}:{};return a.jsx(Vr,{component:f?F7:"textarea",ref:t,...u,__staticSelector:s||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":c},...h})});Vl.classes=Vr.classes;Vl.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 q7={serialize:JSON.stringify,deserialize:JSON.parse,size:"sm"},pu=ve((e,t)=>{const{value:n,defaultValue:r,onChange:o,formatOnBlur:s,validationError:c,serialize:u,deserialize:f,onFocus:h,onBlur:m,readOnly:g,error:y,...x}=oe("JsonInput",q7,e),[S,w]=ir({value:n,defaultValue:r,finalValue:"",onChange:o}),[C,T]=v.useState(pT(S,f)),R=_=>{h?.(_),T(!0)},E=_=>{typeof m=="function"&&m(_);const k=pT(_.currentTarget.value,f);s&&!g&&k&&_.currentTarget.value.trim()!==""&&w(u(f(_.currentTarget.value),null,2)),T(k)};return a.jsx(Vl,{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})});pu.classes=Vr.classes;pu.displayName="@mantine/core/JsonInput";var oA={root:"m_dc6f14e2"};const G7=(e,{size:t})=>({root:{"--kbd-fz":rt(t,"kbd-fz")}}),Fc=ve((e,t)=>{const n=oe("Kbd",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,attributes:h,...m}=n,g=Ue({name:"Kbd",classes:oA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:h,vars:f,varsResolver:G7});return a.jsx(le,{component:"kbd",ref:t,...g("root"),...m})});Fc.classes=oA;Fc.displayName="@mantine/core/Kbd";const[W7,Q7]=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=oe("ListItem",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,icon:f,children:h,mod:m,...g}=n,y=Q7(),x=f||y.icon,S={classNames:r,styles:c};return a.jsx(le,{...y.getStyles("item",{...S,className:o,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 Y7={type:"unordered"},K7=(e,{size:t,spacing:n})=>({root:{"--list-fz":Yn(t),"--list-lh":e2(t),"--list-spacing":Qn(n)}}),zr=ve((e,t)=>{const n=oe("List",Y7,e),{classNames:r,className:o,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=Ue({name:"List",classes:P0,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:T,vars:f,varsResolver:K7});return a.jsx(W7,{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 aA={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const mT={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:Br("overlay")},X7=(e,{zIndex:t})=>({root:{"--lo-z-index":t?.toString()}}),Em=ve((e,t)=>{const n=oe("LoadingOverlay",mT,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,transitionProps:h,loaderProps:m,overlayProps:g,visible:y,zIndex:x,attributes:S,...w}=n,C=kn(),T=Ue({name:"LoadingOverlay",classes:aA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:X7}),R={...mT.overlayProps,...g};return a.jsx(po,{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(Jc,{...R,...T("overlay"),darkHidden:!0,unstyled:u,color:g?.color||C.white}),a.jsx(Jc,{...R,...T("overlay"),lightHidden:!0,unstyled:u,color:g?.color||C.colors.dark[5]})]})})});Em.classes=aA;Em.displayName="@mantine/core/LoadingOverlay";const[J7,Ns]=Or("Menu component was not found in the tree");var Os={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:o,styles:s,vars:c,...u}=oe("MenuDivider",null,e),f=Ns();return a.jsx(le,{ref:t,...f.getStyles("divider",{className:r,style:o,styles:s,classNames:n}),...u})});O0.classes=Os;O0.displayName="@mantine/core/MenuDivider";const M0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,onMouseEnter:u,onMouseLeave:f,onKeyDown:h,children:m,...g}=oe("MenuDropdown",null,e),y=v.useRef(null),x=Ns(),S=dr(h,T=>{(T.key==="ArrowUp"||T.key==="ArrowDown")&&(T.preventDefault(),y.current?.querySelectorAll("[data-menu-item]:not(:disabled)")[0]?.focus())}),w=dr(u,()=>(x.trigger==="hover"||x.trigger==="click-hover")&&x.openDropdown()),C=dr(f,()=>(x.trigger==="hover"||x.trigger==="click-hover")&&x.closeDropdown());return a.jsxs(ei.Dropdown,{...g,onMouseEnter:w,onMouseLeave:C,role:"menu","aria-orientation":"vertical",ref:Fn(t,y),...x.getStyles("dropdown",{className:r,style:o,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=Os;M0.displayName="@mantine/core/MenuDropdown";const[Z7,Tm]=Wo(),L0=ar((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,color:u,closeMenuOnClick:f,leftSection:h,rightSection:m,children:g,disabled:y,"data-disabled":x,...S}=oe("MenuItem",null,e),w=Ns(),C=Tm(),T=kn(),{dir:R}=As(),E=v.useRef(null),_=S,k=dr(_.onClick,()=>{x||(typeof f=="boolean"?f&&w.closeDropdownImmediately():w.closeOnItemClick&&w.closeDropdownImmediately())}),L=u?T.variantColorResolver({color:u,theme:T,variant:"light"}):void 0,D=u?Jr({color:u,theme:T}):null,P=dr(_.onKeyDown,$=>{$.key==="ArrowLeft"&&C&&(C.close(),C.focusParentItem())});return a.jsxs(_n,{onMouseDown:$=>$.preventDefault(),...S,unstyled:w.unstyled,tabIndex:w.menuItemTabIndex,...w.getStyles("item",{className:r,style:o,styles:s,classNames:n}),ref:Fn(E,t),role:"menuitem",disabled:y,"data-menu-item":!0,"data-disabled":y||x||void 0,"data-mantine-stop-propagation":!0,onClick:k,onKeyDown:Eb({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:w.loop,dir:R,orientation:"vertical",onKeyDown:P}),__vars:{"--menu-item-color":D?.isThemeColor&&D?.shade===void 0?`var(--mantine-color-${D.color}-6)`:L?.color,"--menu-item-hover":L?.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=Os;L0.displayName="@mantine/core/MenuItem";const I0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...u}=oe("MenuLabel",null,e),f=Ns();return a.jsx(le,{ref:t,...f.getStyles("label",{className:r,style:o,styles:s,classNames:n}),...u})});I0.classes=Os;I0.displayName="@mantine/core/MenuLabel";const z0=ve((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,onMouseEnter:u,onMouseLeave:f,onKeyDown:h,children:m,...g}=oe("MenuSubDropdown",null,e),y=v.useRef(null),x=Ns(),S=Tm(),w=dr(u,S?.open),C=dr(f,S?.close);return a.jsx(ei.Dropdown,{...g,onMouseEnter:w,onMouseLeave:C,role:"menu","aria-orientation":"vertical",ref:Fn(t,y),...x.getStyles("dropdown",{className:r,style:o,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,children:m})});z0.classes=Os;z0.displayName="@mantine/core/MenuSubDropdown";const $0=ar((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,color:u,leftSection:f,rightSection:h,children:m,disabled:g,"data-disabled":y,closeMenuOnClick:x,...S}=oe("MenuSubItem",null,e),w=Ns(),C=Tm(),T=kn(),{dir:R}=As(),E=v.useRef(null),_=S,k=u?T.variantColorResolver({color:u,theme:T,variant:"light"}):void 0,L=u?Jr({color:u,theme:T}):null,D=dr(_.onKeyDown,W=>{W.key==="ArrowRight"&&(C?.open(),C?.focusFirstItem()),W.key==="ArrowLeft"&&C?.parentContext&&(C.parentContext.close(),C.parentContext.focusParentItem())}),P=dr(_.onClick,()=>{!y&&x&&w.closeDropdownImmediately()}),$=dr(_.onMouseEnter,C?.open),U=dr(_.onMouseLeave,C?.close);return a.jsxs(_n,{onMouseDown:W=>W.preventDefault(),...S,unstyled:w.unstyled,tabIndex:w.menuItemTabIndex,...w.getStyles("item",{className:r,style:o,styles:s,classNames:n}),ref:Fn(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:$,onMouseLeave:U,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:D}),__vars:{"--menu-item-color":L?.isThemeColor&&L?.shade===void 0?`var(--mantine-color-${L.color}-6)`:k?.color,"--menu-item-hover":k?.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(CD,{...w.getStyles("chevron"),size:14})})]})});$0.classes=Os;$0.displayName="@mantine/core/MenuSubItem";function sA({children:e,refProp:t}){if(!sm(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 Ns(),a.jsx(ei.Target,{refProp:t,popupType:"menu",children:e})}sA.displayName="@mantine/core/MenuSubTarget";const ez={offset:0,position:"right-start",transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function mu(e){const{children:t,closeDelay:n,openDelay:r,...o}=oe("MenuSub",ez,e),s=pr(),[c,{open:u,close:f}]=Ds(!1),h=Tm(),{openDropdown:m,closeDropdown:g}=wD({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(Z7,{value:{opened:c,close:g,open:m,focusFirstItem:y,focusParentItem:x,parentContext:h},children:a.jsx(ei,{opened:c,withinPortal:!1,withArrow:!1,id:s,...o,children:t})})}mu.extend=e=>e;mu.displayName="@mantine/core/MenuSub";mu.Target=sA;mu.Dropdown=z0;mu.Item=$0;const tz={refProp:"ref"},lA=v.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=oe("MenuTarget",tz,e),s=Il(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=Ns(),u=s.props,f=dr(u.onClick,()=>{c.trigger==="click"?c.toggleDropdown():c.trigger==="click-hover"&&(c.setOpenedViaClick(!0),c.opened||c.openDropdown())}),h=dr(u.onMouseEnter,()=>(c.trigger==="hover"||c.trigger==="click-hover")&&c.openDropdown()),m=dr(u.onMouseLeave,()=>{(c.trigger==="hover"||c.trigger==="click-hover"&&!c.openedViaClick)&&c.closeDropdown()});return a.jsx(ei.Target,{refProp:r,popupType:"menu",ref:t,...o,children:v.cloneElement(s,{onClick:f,onMouseEnter:h,onMouseLeave:m,"data-expanded":c.opened?!0:void 0})})});lA.displayName="@mantine/core/MenuTarget";const nz={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function Se(e){const t=oe("Menu",nz,e),{children:n,onOpen:r,onClose:o,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:k,withInitialFocusPlaceholder:L,attributes:D,...P}=t,$=Ue({name:"Menu",classes:Os,props:t,classNames:w,styles:C,unstyled:T,attributes:D}),[U,W]=ir({value:s,defaultValue:c,finalValue:!1,onChange:f}),[Y,ee]=v.useState(!1),B=()=>{W(!1),ee(!1),U&&o?.()},G=()=>{W(!0),!U&&r?.()},M=()=>{U?B():G()},{openDropdown:I,closeDropdown:z}=wD({open:G,close:B,closeDelay:S,openDelay:x}),V=F=>xM("[data-menu-item]","[data-menu-dropdown]",F),{resolvedClassNames:K,resolvedStyles:O}=zl({classNames:w,styles:C,props:t});return a.jsx(J7,{value:{getStyles:$,opened:U,toggleDropdown:M,getItemIndex:V,openedViaClick:Y,setOpenedViaClick:ee,closeOnItemClick:h,closeDropdown:y==="click"?B:z,openDropdown:y==="click"?G:I,closeDropdownImmediately:B,loop:m,trigger:y,unstyled:T,menuItemTabIndex:_,withInitialFocusPlaceholder:L},children:a.jsx(ei,{returnFocus:!0,...P,opened:U,onChange:M,defaultOpened:c,trapFocus:k?!1:u,closeOnEscape:g,__staticSelector:"Menu",classNames:K,styles:O,unstyled:T,variant:R,keepMounted:k,children:n})})}Se.extend=e=>e;Se.withProps=o9(Se);Se.classes=Os;Se.displayName="@mantine/core/Menu";Se.Item=L0;Se.Label=I0;Se.Dropdown=M0;Se.Target=lA;Se.Divider=O0;Se.Sub=mu;var Pa={root:"m_9df02822",content:"m_54c44539",inner:"m_1f958f16",header:"m_d0e2b9cd"};const[rz,gu]=Or("Modal component was not found in tree"),Rm=ve((e,t)=>{const n=oe("ModalBody",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,...f}=n,h=gu();return a.jsx(pD,{ref:t,...h.getStyles("body",{classNames:r,style:s,styles:c,className:o}),...f})});Rm.classes=Pa;Rm.displayName="@mantine/core/ModalBody";const _m=ve((e,t)=>{const n=oe("ModalCloseButton",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,...f}=n,h=gu();return a.jsx(mD,{ref:t,...h.getStyles("close",{classNames:r,style:s,styles:c,className:o}),...f})});_m.classes=Pa;_m.displayName="@mantine/core/ModalCloseButton";const Dm=ve((e,t)=>{const n=oe("ModalContent",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,children:f,__hidden:h,...m}=n,g=gu(),y=g.scrollAreaComponent||VI;return a.jsx(gD,{...g.getStyles("content",{className:o,style:s,styles:c,classNames:r}),innerProps:g.getStyles("inner",{className:o,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})})});Dm.classes=Pa;Dm.displayName="@mantine/core/ModalContent";const Am=ve((e,t)=>{const n=oe("ModalHeader",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,...f}=n,h=gu();return a.jsx(vD,{ref:t,...h.getStyles("header",{classNames:r,style:s,styles:c,className:o}),...f})});Am.classes=Pa;Am.displayName="@mantine/core/ModalHeader";const km=ve((e,t)=>{const n=oe("ModalOverlay",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,...f}=n,h=gu();return a.jsx(yD,{ref:t,...h.getStyles("overlay",{classNames:r,style:s,styles:c,className:o}),...f})});km.classes=Pa;km.displayName="@mantine/core/ModalOverlay";const iz={__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"},oz=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:Ht(t),"--modal-size":rt(n,"modal-size"),"--modal-y-offset":ce(r),"--modal-x-offset":ce(o)}}),Pm=ve((e,t)=>{const n=oe("ModalRoot",iz,e),{classNames:r,className:o,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=Ue({name:w,classes:Pa,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:oz});return a.jsx(rz,{value:{yOffset:h,scrollAreaComponent:m,getStyles:R,fullScreen:y},children:a.jsx(hD,{ref:t,...R("root"),"data-full-screen":y||void 0,"data-centered":x||void 0,"data-offset-scrollbars":m===Zr.Autosize||void 0,unstyled:u,...T})})});Pm.classes=Pa;Pm.displayName="@mantine/core/ModalRoot";const[az,sz]=Wo();function cA({children:e}){const[t,n]=v.useState([]),[r,o]=v.useState(Br("modal"));return a.jsx(az,{value:{stack:t,addModal:(s,c)=>{n(u=>[...new Set([...u,s])]),o(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})}cA.displayName="@mantine/core/ModalStack";const Nm=ve((e,t)=>{const n=oe("ModalTitle",null,e),{classNames:r,className:o,style:s,styles:c,vars:u,...f}=n,h=gu();return a.jsx(xD,{ref:t,...h.getStyles("title",{classNames:r,style:s,styles:c,className:o}),...f})});Nm.classes=Pa;Nm.displayName="@mantine/core/ModalTitle";const lz={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:o,withCloseButton:s,closeButtonProps:c,children:u,radius:f,opened:h,stackId:m,zIndex:g,...y}=oe("Modal",lz,e),x=sz(),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(Pm,{ref:t,radius:f,opened:h,zIndex:x&&m?x.getZIndex(m):g,...y,...w,children:[r&&a.jsx(km,{visible:C,transitionProps:x&&m?{duration:0}:void 0,...o}),a.jsxs(Dm,{radius:f,__hidden:x&&m&&h?m!==x.currentId:!1,children:[S&&a.jsxs(Am,{children:[n&&a.jsx(Nm,{children:n}),s&&a.jsx(_m,{...c})]}),a.jsx(Rm,{children:u})]})]})});Mn.classes=Pa;Mn.displayName="@mantine/core/Modal";Mn.Root=Pm;Mn.Overlay=km;Mn.Content=Dm;Mn.Body=Rm;Mn.Header=Am;Mn.Title=Nm;Mn.CloseButton=_m;Mn.Stack=cA;const[cz,U0]=Wo();var Om={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const[uz,dz]=Wo(),fz=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?rt(t):rt(n,"pg-gap")}}),B0=ve((e,t)=>{const n=oe("PillGroup",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,size:h,disabled:m,attributes:g,...y}=n,S=U0()?.size||h||void 0,w=Ue({name:"PillGroup",classes:Om,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:g,vars:f,varsResolver:fz,stylesCtx:{size:S},rootSelector:"group"});return a.jsx(uz,{value:{size:S,disabled:m},children:a.jsx(le,{ref:t,size:S,...w("group"),...y})})});B0.classes=Om;B0.displayName="@mantine/core/PillGroup";const hz={variant:"default"},pz=(e,{radius:t},{size:n})=>({root:{"--pill-fz":rt(n,"pill-fz"),"--pill-height":rt(n,"pill-height"),"--pill-radius":t===void 0?void 0:Ht(t)}}),Ea=ve((e,t)=>{const n=oe("Pill",hz,e),{classNames:r,className:o,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,_=dz(),k=U0(),L=w||_?.size||void 0,D=k?.variant==="filled"?"contrast":h||"default",P=Ue({name:"Pill",classes:Om,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:R,vars:f,varsResolver:pz,stylesCtx:{size:L}});return a.jsxs(le,{component:"span",ref:t,variant:D,size:L,...P("root",{variant:D}),mod:[{"with-remove":g&&!C,disabled:C||_?.disabled},T],...E,children:[a.jsx("span",{...P("label"),children:m}),g&&a.jsx(ks,{variant:"transparent",radius:S,tabIndex:-1,"aria-hidden":!0,unstyled:u,...x,...P("remove",{className:x?.className,style:x?.style}),onMouseDown:$=>{$.preventDefault(),$.stopPropagation(),x?.onMouseDown?.($)},onClick:$=>{$.stopPropagation(),y?.(),x?.onClick?.($)}})]})});Ea.classes=Om;Ea.displayName="@mantine/core/Pill";Ea.Group=B0;var uA={field:"m_45c4369d"};const mz={type:"visible"},V0=ve((e,t)=>{const n=oe("PillsInputField",mz,e),{classNames:r,className:o,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=du(),R=Ue({name:"PillsInputField",classes:uA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:S,rootSelector:"field"}),E=m||C?.disabled;return a.jsx(le,{component:"input",ref:Fn(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=uA;V0.displayName="@mantine/core/PillsInputField";const gz={size:"sm"},js=ve((e,t)=>{const n=oe("PillsInput",gz,e),{children:r,onMouseDown:o,onClick:s,size:c,disabled:u,__staticSelector:f,error:h,variant:m,...g}=n,y=v.useRef(null);return a.jsx(cz,{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(),o?.(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})})});js.displayName="@mantine/core/PillsInput";js.Field=V0;function vz({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,s)=>(eu(s)?o.push({group:s.group,items:s.items.filter(c=>n.indexOf(c.value.toLowerCase().trim())===-1)}):n.indexOf(s.value.toLowerCase().trim())===-1&&o.push(s),o),[])}const gT={xs:41,sm:50,md:60,lg:72,xl:89},yz={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:",",clearSearchOnChange:!0,openOnFocus:!0,size:"sm"},Mm=ve((e,t)=>{const n=oe("MultiSelect",yz,e),{classNames:r,className:o,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:k,onOptionSubmit:L,comboboxProps:D,filter:P,limit:$,withScrollArea:U,maxDropdownHeight:W,searchValue:Y,defaultSearchValue:ee,onSearchChange:B,readOnly:G,disabled:M,onFocus:I,onBlur:z,radius:V,rightSection:K,rightSectionWidth:O,rightSectionPointerEvents:F,rightSectionProps:se,leftSection:de,leftSectionWidth:xe,leftSectionPointerEvents:Ce,leftSectionProps:we,inputContainer:Ye,inputWrapperOrder:De,withAsterisk:ht,labelProps:Rt,descriptionProps:at,errorProps:Ze,wrapperProps:mt,description:Dt,label:jt,error:Ae,maxValues:Ne,searchable:Me,nothingFoundMessage:Ie,withCheckIcon:it,withAlignedLabels:et,checkIconPosition:ft,hidePickedOptions:lt,withErrorStyles:Ee,name:he,form:ke,id:vt,clearable:_t,clearButtonProps:Kt,hiddenInputProps:yn,placeholder:an,hiddenInputValuesDivider:Cr,required:Jt,mod:sr,renderOption:$n,onRemove:xi,onClear:Xo,scrollAreaProps:xo,chevronColor:ri,attributes:bi,clearSearchOnChange:bo,openOnFocus:Ki,...So}=n,Xi=pr(vt),$a=DD(w),vr=AD($a),Ji=v.useRef({}),Ln=Bl({opened:C,defaultOpened:T,onDropdownOpen:()=>{R?.(),k&&Ln.selectFirstOption()},onDropdownClose:()=>{E?.(),Ln.resetSelectedOption()}}),{styleProps:Eu,rest:{type:Tu,autoComplete:H,...X}}=Aa(So),[te,je]=ir({value:m,defaultValue:g,finalValue:[],onChange:y}),[Re,Ke]=ir({value:Y,defaultValue:ee,finalValue:"",onChange:B}),ze=st=>{Ke(st),Ln.resetSelectedOption()},Le=Ue({name:"MultiSelect",classes:{},props:n,classNames:r,styles:c,unstyled:u,attributes:bi}),{resolvedClassNames:Ve,resolvedStyles:We}=zl({props:n,styles:c,classNames:r}),ot=st=>{x?.(st),st.key===" "&&!Me&&(st.preventDefault(),Ln.toggleDropdown()),st.key==="Backspace"&&Re.length===0&&te.length>0&&(xi?.(te[te.length-1]),je(te.slice(0,te.length-1)))},tt=te.map((st,Et)=>{const Xn=vr[st]||Ji.current[st];return a.jsx(Ea,{withRemoveButton:!G&&!vr[st]?.disabled,onRemove:()=>{je(te.filter(Er=>st!==Er)),xi?.(st)},unstyled:u,disabled:M,...Le("pill"),children:Xn?.label||st},`${st}-${Et}`)});v.useEffect(()=>{_&&Ln.selectFirstOption()},[_,Re]),v.useEffect(()=>{te.forEach(st=>{st in vr&&(Ji.current[st]=vr[st])})},[vr,te]);const Ot=a.jsx(Qe.ClearButton,{...Kt,onClear:()=>{Xo?.(),je([]),ze("")}}),At=vz({data:$a,value:te}),xn=_t&&te.length>0&&!M&&!G,Pn=xn?{paddingInlineEnd:gT[h]??gT.sm}:void 0;return a.jsxs(a.Fragment,{children:[a.jsxs(Qe,{store:Ln,classNames:Ve,styles:We,unstyled:u,size:h,readOnly:G,__staticSelector:"MultiSelect",attributes:bi,onOptionSubmit:st=>{L?.(st),bo&&ze(""),Ln.updateSelectedOptionIndex("selected"),te.includes(vr[st].value)?(je(te.filter(Et=>Et!==vr[st].value)),xi?.(vr[st].value)):te.length<Ne&&je([...te,vr[st].value])},...D,children:[a.jsx(Qe.DropdownTarget,{children:a.jsx(js,{...Eu,__staticSelector:"MultiSelect",classNames:Ve,styles:We,unstyled:u,size:h,className:o,style:s,variant:S,disabled:M,radius:V,__defaultRightSection:a.jsx(Qe.Chevron,{size:h,error:Ae,unstyled:u,color:ri}),__clearSection:Ot,__clearable:xn,rightSection:K,rightSectionPointerEvents:F||"none",rightSectionWidth:O,rightSectionProps:se,leftSection:de,leftSectionWidth:xe,leftSectionPointerEvents:Ce,leftSectionProps:we,inputContainer:Ye,inputWrapperOrder:De,withAsterisk:ht,labelProps:Rt,descriptionProps:at,errorProps:Ze,wrapperProps:mt,description:Dt,label:jt,error:Ae,withErrorStyles:Ee,__stylesApiProps:{...n,rightSectionPointerEvents:F||"none",multiline:!0},pointer:!Me,onClick:()=>Me?Ln.openDropdown():Ln.toggleDropdown(),"data-expanded":Ln.dropdownOpened||void 0,id:Xi,required:Jt,mod:sr,attributes:bi,children:a.jsxs(Ea.Group,{attributes:bi,disabled:M,unstyled:u,...Le("pillsList",{style:Pn}),children:[tt,a.jsx(Qe.EventsTarget,{autoComplete:H,children:a.jsx(js.Field,{...X,ref:t,id:Xi,placeholder:an,type:!Me&&!an?"hidden":"visible",...Le("inputField"),unstyled:u,onFocus:st=>{I?.(st),Ki&&Me&&Ln.openDropdown()},onBlur:st=>{z?.(st),Ln.closeDropdown(),ze("")},onKeyDown:ot,value:Re,onChange:st=>{ze(st.currentTarget.value),Me&&Ln.openDropdown(),_&&Ln.selectFirstOption()},disabled:M,readOnly:G||!Me,pointer:!Me})})]})})}),a.jsx(Q6,{data:lt?At:$a,hidden:G||M,filter:P,search:Re,limit:$,hiddenWhenEmpty:!Ie,withScrollArea:U,maxDropdownHeight:W,filterOptions:Me,value:te,checkIconPosition:ft,withCheckIcon:it,withAlignedLabels:et,nothingFoundMessage:Ie,unstyled:u,labelId:jt?`${Xi}-label`:void 0,"aria-label":jt?void 0:So["aria-label"],renderOption:$n,scrollAreaProps:xo})]}),a.jsx(Qe.HiddenInput,{name:he,valuesDivider:Cr,value:te,form:ke,disabled:M,...yn})]})});Mm.classes={...Vr.classes,...Qe.classes};Mm.displayName="@mantine/core/MultiSelect";function xz(e){return"group"in e}function F0({data:e}){if(xz(e)){const o=e.items.map(s=>a.jsx(F0,{data:s},s.value));return a.jsx("optgroup",{label:e.group,children:o})}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 bz={rightSectionPointerEvents:"none"},mn=ve((e,t)=>{const{data:n,children:r,size:o,error:s,rightSection:c,unstyled:u,...f}=oe("NativeSelect",bz,e),h=DD(n).map((m,g)=>a.jsx(F0,{data:m},g));return a.jsx(Vr,{component:"select",ref:t,...f,__staticSelector:"NativeSelect",size:o,pointer:!0,error:s,unstyled:u,rightSection:c||a.jsx(jm,{size:o,error:s,unstyled:u}),children:r||h})});mn.classes=Vr.classes;mn.displayName="@mantine/core/NativeSelect";var dA={root:"m_a513464",icon:"m_a4ceffb",loader:"m_b0920b15",body:"m_a49ed24",title:"m_3feedf16",description:"m_3d733a3a",closeButton:"m_919a4d88"};const Sz={withCloseButton:!0},jz=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:Ht(t),"--notification-color":n?Xt(n,e):void 0}}),H0=ve((e,t)=>{const n=oe("Notification",Sz,e),{className:r,color:o,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:k,attributes:L,...D}=n,P=Ue({name:"Notification",classes:dA,props:n,className:r,style:w,classNames:S,styles:C,unstyled:T,attributes:L,vars:R,varsResolver:jz});return a.jsxs(le,{...P("root"),mod:[{"data-with-icon":!!m||c,"data-with-border":f},E],ref:t,role:k||"alert",...D,children:[m&&!c&&a.jsx("div",{...P("icon"),children:m}),c&&a.jsx(Pr,{size:28,color:o,..._,...P("loader")}),a.jsxs("div",{...P("body"),children:[h&&a.jsx("div",{...P("title"),children:h}),a.jsx(le,{...P("description"),mod:{"data-with-title":!!h},children:g})]}),u&&a.jsx(ks,{iconSize:16,color:"gray",...x,unstyled:T,onClick:y,...P("closeButton")})]})});H0.classes=dA;H0.displayName="@mantine/core/Notification";function fA(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}var Ud;(function(e){e.event="event",e.props="prop"})(Ud||(Ud={}));function gs(){}function wz(e){var t,n=void 0;return function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];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 Bd(e){return!!(e||"").match(/\d/)}function Wc(e){return e==null}function Cz(e){return typeof e=="number"&&isNaN(e)}function hA(e){return Wc(e)||Cz(e)||typeof e=="number"&&!isFinite(e)}function pA(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Ez(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 Tz(e,t,n){var r=Ez(n),o=e.search(/[1-9]/);return o=o===-1?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}function Rz(e){var t=v.useRef(e);t.current=e;var n=v.useRef(function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];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 o=e.split("."),s=o[0],c=o[1]||"";return{beforeDecimal:s,afterDecimal:c,hasNegation:n,addNegation:r}}function _z(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",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}function mA(e,t,n){for(var r="",o=n?"0":"",s=0;s<=t-1;s++)r+=e[s]||o;return r}function vT(e,t){return Array(t+1).join(e)}function gA(e){var t=e+"",n=t[0]==="-"?"-":"";n&&(t=t.substring(1));var r=t.split(/[eE]/g),o=r[0],s=r[1];if(s=Number(s),!s)return n+o;o=o.replace(".","");var c=1+s,u=o.length;return c<0?o="0."+vT("0",Math.abs(c))+o:c>=u?o=o+vT("0",c-u):o=(o.substring(0,c)||"0")+"."+o.substring(c),n+o}function yT(e,t,n){if(["","-"].indexOf(e)!==-1)return e;var r=(e.indexOf(".")!==-1||n)&&t,o=q0(e),s=o.beforeDecimal,c=o.afterDecimal,u=o.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=mA(m[1]||"",t,n),x=u?"-":"",S=r?".":"";return""+x+g+S+y}function dl(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 vA=wz(function(e,t){for(var n=0,r=0,o=e.length,s=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[s-1-r]&&s-r>n&&o-r>n;)r++;return{from:{start:n,end:o-r},to:{start:n,end:s-r}}}),Dz=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function Az(e,t,n){return Math.min(Math.max(e,t),n)}function Qy(e){return Math.max(e.selectionStart,e.selectionEnd)}function kz(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Pz(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function Nz(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,o=e.formattedValueIndex;return t[r]===n[o]}function Oz(e,t,n,r,o,s,c){c===void 0&&(c=Nz);var u=o.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 o=e.length;if(t=Az(t,0,o),r==="left"){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=o&&!n[t];)t++;t>o&&(t=n.lastIndexOf(!0))}return t===-1&&(t=o),t}function Mz(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!(Bd(e[n])||Bd(e[n-1]));return t}function yA(e,t,n,r,o,s){s===void 0&&(s=gs);var c=Rz(function(S,w){var C,T;return hA(S)?(T="",C=""):typeof S=="number"||w?(T=typeof S=="number"?gA(S):S,C=r(T)):(T=o(S,void 0),C=r(T)),{formattedValue:C,numAsString:T}}),u=v.useState(function(){return c(Wc(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;Wc(e)&&(g=f.numAsString,y=!0);var x=c(g,y);return v.useMemo(function(){h(x)},[x.formattedValue]),[f,m]}function Lz(e){return e.replace(/[^0-9]/g,"")}function Iz(e){return e}function zz(e){var t=e.type;t===void 0&&(t="text");var n=e.displayType;n===void 0&&(n="input");var r=e.customInput,o=e.renderText,s=e.getInputRef,c=e.format;c===void 0&&(c=Iz);var u=e.removeFormatting;u===void 0&&(u=Lz);var f=e.defaultValue,h=e.valueIsNumericString,m=e.onValueChange,g=e.isAllowed,y=e.onChange;y===void 0&&(y=gs);var x=e.onKeyDown;x===void 0&&(x=gs);var S=e.onMouseUp;S===void 0&&(S=gs);var w=e.onFocus;w===void 0&&(w=gs);var C=e.onBlur;C===void 0&&(C=gs);var T=e.value,R=e.getCaretBoundary;R===void 0&&(R=Mz);var E=e.isValidInputCharacter;E===void 0&&(E=Bd);var _=e.isCharacterSame,k=fA(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),L=yA(T,f,!!h,c,u,m),D=L[0],P=D.formattedValue,$=D.numAsString,U=L[1],W=v.useRef(),Y=v.useRef({formattedValue:P,numAsString:$}),ee=function(Ae,Ne){Y.current={formattedValue:Ae.formattedValue,numAsString:Ae.value},U(Ae,Ne)},B=v.useState(!1),G=B[0],M=B[1],I=v.useRef(null),z=v.useRef({setCaretTimeout:null,focusTimeout:null});v.useEffect(function(){return M(!0),function(){clearTimeout(z.current.setCaretTimeout),clearTimeout(z.current.focusTimeout)}},[]);var V=c,K=function(Ae,Ne){var Me=parseFloat(Ne);return{formattedValue:Ae,value:Ne,floatValue:isNaN(Me)?void 0:Me}},O=function(Ae,Ne,Me){Ae.selectionStart===0&&Ae.selectionEnd===Ae.value.length||(dl(Ae,Ne),z.current.setCaretTimeout=setTimeout(function(){Ae.value===Me&&Ae.selectionStart!==Ne&&dl(Ae,Ne)},0))},F=function(Ae,Ne,Me){return xT(Ae,Ne,R(Ae),Me)},se=function(Ae,Ne,Me){var Ie=R(Ne),it=Oz(Ne,P,Ae,Me,Ie,E,_);return it=xT(Ne,it,Ie),it},de=function(Ae){var Ne=Ae.formattedValue;Ne===void 0&&(Ne="");var Me=Ae.input,Ie=Ae.source,it=Ae.event,et=Ae.numAsString,ft;if(Me){var lt=Ae.inputValue||Me.value,Ee=Qy(Me);Me.value=Ne,ft=se(lt,Ne,Ee),ft!==void 0&&O(Me,ft,Ne)}Ne!==P&&ee(K(Ne,et),{event:it,source:Ie})};v.useEffect(function(){var Ae=Y.current,Ne=Ae.formattedValue,Me=Ae.numAsString;(P!==Ne||$!==Me)&&ee(K(P,$),{event:void 0,source:Ud.props})},[P,$]);var xe=I.current?Qy(I.current):void 0,Ce=typeof window<"u"?v.useLayoutEffect:v.useEffect;Ce(function(){var Ae=I.current;if(P!==Y.current.formattedValue&&Ae){var Ne=se(Y.current.formattedValue,P,xe);Ae.value=P,O(Ae,Ne,P)}},[P]);var we=function(Ae,Ne,Me){var Ie=Ne.target,it=W.current?Dz(W.current,Ie.selectionEnd):vA(P,Ae),et=Object.assign(Object.assign({},it),{lastValue:P}),ft=u(Ae,et),lt=V(ft);if(ft=u(lt,void 0),g&&!g(K(lt,ft))){var Ee=Ne.target,he=Qy(Ee),ke=se(Ae,P,he);return Ee.value=P,O(Ee,ke,P),!1}return de({formattedValue:lt,numAsString:ft,inputValue:Ae,event:Ne,source:Me,input:Ne.target}),!0},Ye=function(Ae,Ne){Ne===void 0&&(Ne=0);var Me=Ae.selectionStart,Ie=Ae.selectionEnd;W.current={selectionStart:Me,selectionEnd:Ie+Ne}},De=function(Ae){var Ne=Ae.target,Me=Ne.value,Ie=we(Me,Ae,Ud.event);Ie&&y(Ae),W.current=void 0},ht=function(Ae){var Ne=Ae.target,Me=Ae.key,Ie=Ne.selectionStart,it=Ne.selectionEnd,et=Ne.value;et===void 0&&(et="");var ft;Me==="ArrowLeft"||Me==="Backspace"?ft=Math.max(Ie-1,0):Me==="ArrowRight"?ft=Math.min(Ie+1,et.length):Me==="Delete"&&(ft=Ie);var lt=0;Me==="Delete"&&Ie===it&&(lt=1);var Ee=Me==="ArrowLeft"||Me==="ArrowRight";if(ft===void 0||Ie!==it&&!Ee){x(Ae),Ye(Ne,lt);return}var he=ft;if(Ee){var ke=Me==="ArrowLeft"?"left":"right";he=F(et,ft,ke),he!==ft&&Ae.preventDefault()}else Me==="Delete"&&!E(et[ft])?he=F(et,ft,"right"):Me==="Backspace"&&!E(et[ft])&&(he=F(et,ft,"left"));he!==ft&&O(Ne,he,et),x(Ae),Ye(Ne,lt)},Rt=function(Ae){var Ne=Ae.target,Me=function(){var Ie=Ne.selectionStart,it=Ne.selectionEnd,et=Ne.value;if(et===void 0&&(et=""),Ie===it){var ft=F(et,Ie);ft!==Ie&&O(Ne,ft,et)}};Me(),requestAnimationFrame(function(){Me()}),S(Ae),Ye(Ne)},at=function(Ae){Ae.persist&&Ae.persist();var Ne=Ae.target,Me=Ae.currentTarget;I.current=Ne,z.current.focusTimeout=setTimeout(function(){var Ie=Ne.selectionStart,it=Ne.selectionEnd,et=Ne.value;et===void 0&&(et="");var ft=F(et,Ie);ft!==Ie&&!(Ie===0&&it===et.length)&&O(Ne,ft,et),w(Object.assign(Object.assign({},Ae),{currentTarget:Me}))},0)},Ze=function(Ae){I.current=null,clearTimeout(z.current.focusTimeout),clearTimeout(z.current.setCaretTimeout),C(Ae)},mt=G&&kz()?"numeric":void 0,Dt=Object.assign({inputMode:mt},k,{type:t,value:P,onChange:De,onKeyDown:ht,onMouseUp:Rt,onFocus:at,onBlur:Ze});if(n==="text")return o?In.createElement(In.Fragment,null,o(P,k)||null):In.createElement("span",Object.assign({},k,{ref:s}),P);if(r){var jt=r;return In.createElement(jt,Object.assign({},Dt,{ref:s}))}return In.createElement("input",Object.assign({},Dt,{ref:s}))}function bT(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix;o===void 0&&(o="");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=Lm(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=mA(S,n,!!r)),h&&(x=Tz(x,h,u)),o&&(x=o+x),s&&(S=S+s),w&&(x="-"+x),e=x+(g&&m||"")+S,e}function Lm(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 $z(e,t){e===void 0&&(e="");var n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),s=r.test(e);return e=e.replace(/-/g,""),o&&!s&&t&&(e="-"+e),e}function Uz(e,t){return new RegExp("(^-)|[0-9]|"+pA(e),"g")}function Bz(e,t,n){return e===""?!0:!t?.match(/\d/)&&!n?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function Vz(e,t,n){var r;t===void 0&&(t=Pz(e));var o=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=Lm(n),x=y.allowedDecimalSeparators,S=y.decimalSeparator,w=e[g]===S;if(Bd(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,z,V){var K=!1,O=!1;s.startsWith("-")?K=!1:I.startsWith("--")?(K=!1,O=!0):c.startsWith("-")&&I.length===c.length?K=!1:I[0]==="-"&&(K=!0);var F=K?1:0;return O&&(F=2),F&&(I=I.substring(F),z-=F,V-=F),{value:I,start:z,end:V,hasNegation:K}},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),k=_.start,L=_.end,D=_.value,P=e.substring(m,g);e.length&&D.length&&(k>D.length-c.length||L<s.length)&&!(P&&c.startsWith(P))&&(e=D);var $=0;e.startsWith(s)?$+=s.length:m<s.length&&($=m),e=e.substring($),g-=$;var U=e.length,W=e.length-c.length;e.endsWith(c)?U=W:(g>W||g>e.length-c.length)&&(U=g),e=e.substring(0,U),e=$z(E?"-"+e:e,o),e=(e.match(Uz(S))||[]).join("");var Y=e.indexOf(S);e=e.replace(new RegExp(pA(S),"g"),function(I,z){return z===Y?".":""});var ee=q0(e,o),B=ee.beforeDecimal,G=ee.afterDecimal,M=ee.addNegation;return h.end-h.start<f.end-f.start&&B===""&&w&&!parseFloat(G)&&(e=M?"-":""),e}function Fz(e,t){var n=t.prefix;n===void 0&&(n="");var r=t.suffix;r===void 0&&(r="");var o=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";o.fill(!1,0,n.length+(s?1:0));var c=e.length;return o.fill(!1,c-r.length+1,c+1),o}function Hz(e){var t=Lm(e),n=t.thousandSeparator,r=t.decimalSeparator,o=e.prefix;o===void 0&&(o="");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 o.startsWith("-")&&s&&(console.error(`
50
+ Prefix can't start with '-' when allowNegative is true.
51
+ prefix: `+o+`
52
+ allowNegative: `+s+`
53
+ `),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function qz(e){e=Hz(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,o=e.onKeyDown;o===void 0&&(o=gs);var s=e.onBlur;s===void 0&&(s=gs);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=fA(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),w=Lm(e),C=w.decimalSeparator,T=w.allowedDecimalSeparators,R=function(M){return bT(M,e)},E=function(M,I){return Vz(M,I,e)},_=Wc(g)?m:g,k=y??Bz(_,h,t);Wc(g)?Wc(m)||(k=k||typeof m=="number"):k=k||typeof g=="number";var L=function(M){return hA(M)?M:(typeof M=="number"&&(M=gA(M)),k&&typeof u=="number"?yT(M,u,!!f):M)},D=yA(L(g),L(m),!!k,R,E,x),P=D[0],$=P.numAsString,U=P.formattedValue,W=D[1],Y=function(M){var I=M.target,z=M.key,V=I.selectionStart,K=I.selectionEnd,O=I.value;if(O===void 0&&(O=""),(z==="Backspace"||z==="Delete")&&K<h.length){M.preventDefault();return}if(V!==K){o(M);return}z==="Backspace"&&O[0]==="-"&&V===h.length+1&&n&&dl(I,1),u&&f&&(z==="Backspace"&&O[V-1]===C?(dl(I,V-1),M.preventDefault()):z==="Delete"&&O[V]===C&&M.preventDefault()),T?.includes(z)&&O[V]===C&&dl(I,V+1);var F=c===!0?",":c;z==="Backspace"&&O[V-1]===F&&dl(I,V-1),z==="Delete"&&O[V]===F&&dl(I,V+1),o(M)},ee=function(M){var I=$;if(I.match(/\d/g)||(I=""),r||(I=_z(I)),f&&u&&(I=yT(I,u,f)),I!==$){var z=bT(I,e);W({formattedValue:z,value:I,floatValue:parseFloat(I)},{event:M,source:Ud.event})}s(M)},B=function(M){return M===C?!0:Bd(M)},G=function(M){var I=M.currentValue,z=M.lastValue,V=M.formattedValue,K=M.currentValueIndex,O=M.formattedValueIndex,F=I[K],se=V[O],de=vA(z,I),xe=de.to,Ce=function(we){return E(we).indexOf(".")+h.length};return g===0&&f&&u&&I[xe.start]===C&&Ce(I)<K&&Ce(V)>O?!1:K>=xe.start&&K<xe.end&&T&&T.includes(F)&&se===C?!0:F===se};return Object.assign(Object.assign({},S),{value:U,valueIsNumericString:!1,isValidInputCharacter:B,isCharacterSame:G,onValueChange:W,format:R,removeFormatting:E,getCaretBoundary:function(M){return Fz(M,e)},onKeyDown:Y,onBlur:ee})}function Gz(e){var t=qz(e);return In.createElement(zz,Object.assign({},t))}var Vx={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 Wz=/^(0\.0*|-0(\.0*)?)$/,Qz=/^-?0\d+(\.\d+)?\.?$/,Yz=/\.\d*0$/,xA=/^-?\d+\.$/;function Fx(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function Yy(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||Fx(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function Kz(e){return e.toString().replace(".","").length}function Xz(e,t){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&Kz(t)<14&&t!==""}function jT(e,t,n){if(e===void 0)return!0;const r=t===void 0||e>=t,o=n===void 0||e<=n;return r&&o}const Jz={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0,allowedDecimalSeparators:[".",","]},Zz=(e,{size:t})=>({controls:{"--ni-chevron-size":rt(t,"ni-chevron-size")}});function e$(e,t,n){const r=e.toString(),o=xA.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=_d(c,n,t);return o?`${u.toString().replace(/^0+(?=\d)/,"")}.`:u}const ur=ve((e,t)=>{const n=oe("NumberInput",Jz,e),{className:r,classNames:o,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:k,onKeyDown:L,onKeyDownCapture:D,handlersRef:P,startValue:$,disabled:U,rightSectionPointerEvents:W,allowNegative:Y,readOnly:ee,size:B,rightSectionWidth:G,stepHoldInterval:M,stepHoldDelay:I,allowLeadingZeros:z,withKeyboardEvents:V,trimLeadingZeroesOnBlur:K,allowedDecimalSeparators:O,attributes:F,...se}=n,de=Ue({name:"NumberInput",classes:Vx,props:n,classNames:o,styles:s,unstyled:c,attributes:F,vars:u,varsResolver:Zz}),{resolvedClassNames:xe,resolvedStyles:Ce}=zl({classNames:o,styles:s,props:n}),[we,Ye]=ir({value:m,defaultValue:g,finalValue:"",onChange:f}),De=I!==void 0&&M!==void 0,ht=v.useRef(null),Rt=v.useRef(null),at=v.useRef(0),Ze=(he,ke)=>{ke.source==="event"&&Ye(Xz(he.floatValue,he.value)&&!Wz.test(he.value)&&!(z&&Qz.test(he.value))&&!Yz.test(he.value)&&!xA.test(he.value)?he.floatValue:he.value),h?.(he,ke)},mt=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},Dt=he=>{ht.current&&typeof he<"u"&&ht.current.setSelectionRange(he,he)},jt=v.useRef(kp);jt.current=()=>{if(!Yy(we))return;let he;const ke=mt(we),vt=mt(S),_t=Math.max(ke,vt),Kt=10**_t;if(!Fx(we)&&(typeof we!="number"||Number.isNaN(we)))he=_d($,x,y);else if(y!==void 0){const an=(Math.round(Number(we)*Kt)+Math.round(S*Kt))/Kt;he=an<=y?an:y}else he=(Math.round(Number(we)*Kt)+Math.round(S*Kt))/Kt;const yn=he.toFixed(_t);Ye(parseFloat(yn)),h?.({floatValue:parseFloat(yn),formattedValue:yn,value:yn},{source:"increment"}),setTimeout(()=>Dt(ht.current?.value.length),0)};const Ae=v.useRef(kp);Ae.current=()=>{if(!Yy(we))return;let he;const ke=x!==void 0?x:Y?Number.MIN_SAFE_INTEGER:0,vt=mt(we),_t=mt(S),Kt=Math.max(vt,_t),yn=10**Kt;if(!Fx(we)&&typeof we!="number"||Number.isNaN(we))he=_d($,ke,y);else{const Cr=(Math.round(Number(we)*yn)-Math.round(S*yn))/yn;he=ke!==void 0&&Cr<ke?ke:Cr}const an=he.toFixed(Kt);Ye(parseFloat(an)),h?.({floatValue:parseFloat(an),formattedValue:an,value:an},{source:"decrement"}),setTimeout(()=>Dt(ht.current?.value.length),0)};const Ne=he=>{L?.(he),!(ee||!V)&&(he.key==="ArrowUp"&&(he.preventDefault(),jt.current?.()),he.key==="ArrowDown"&&(he.preventDefault(),Ae.current?.()))},Me=he=>{if(D?.(he),he.key==="Backspace"){const ke=ht.current;ke&&ke.selectionStart===0&&ke.selectionStart===ke.selectionEnd&&(he.preventDefault(),window.setTimeout(()=>Dt(0),0))}},Ie=he=>{let ke=we;R==="blur"&&typeof ke=="number"&&(ke=_d(ke,x,y)),K&&typeof ke=="string"&&mt(ke)<15&&(ke=e$(ke,y,x)),we!==ke&&Ye(ke),E?.(he)};Md(P,{increment:jt.current,decrement:Ae.current});const it=he=>{he?jt.current?.():Ae.current?.(),at.current+=1},et=he=>{if(it(he),De){const ke=typeof M=="number"?M:M(at.current);Rt.current=window.setTimeout(()=>et(he),ke)}},ft=(he,ke)=>{he.preventDefault(),ht.current?.focus(),it(ke),De&&(Rt.current=window.setTimeout(()=>et(ke),I))},lt=()=>{Rt.current&&window.clearTimeout(Rt.current),Rt.current=null,at.current=0},Ee=a.jsxs("div",{...de("controls"),children:[a.jsx(_n,{...de("control"),tabIndex:-1,"aria-hidden":!0,disabled:U||typeof we=="number"&&y!==void 0&&we>=y,mod:{direction:"up"},onMouseDown:he=>he.preventDefault(),onPointerDown:he=>{ft(he,!0)},onPointerUp:lt,onPointerLeave:lt,children:a.jsx(ST,{direction:"up"})}),a.jsx(_n,{...de("control"),tabIndex:-1,"aria-hidden":!0,disabled:U||typeof we=="number"&&x!==void 0&&we<=x,mod:{direction:"down"},onMouseDown:he=>he.preventDefault(),onPointerDown:he=>{ft(he,!1)},onPointerUp:lt,onPointerLeave:lt,children:a.jsx(ST,{direction:"down"})})]});return a.jsx(Vr,{component:Gz,allowNegative:Y,className:Ft(Vx.root,r),size:B,inputMode:"decimal",...se,readOnly:ee,disabled:U,value:we,getInputRef:Fn(t,ht),onValueChange:Ze,rightSection:w||ee||!Yy(we)?C:C||Ee,classNames:xe,styles:Ce,unstyled:c,__staticSelector:"NumberInput",decimalScale:_?k:0,onKeyDown:Ne,onKeyDownCapture:Me,rightSectionPointerEvents:W??(U?"none":void 0),rightSectionWidth:G??`var(--ni-right-section-width-${B||"sm"})`,allowLeadingZeros:z,allowedDecimalSeparators:O,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})});ur.classes={...Vr.classes,...Vx};ur.displayName="@mantine/core/NumberInput";var gf={root:"m_4addd315",control:"m_326d024a",dots:"m_4ad7767d"};const[t$,Im]=Or("Pagination.Root component was not found in tree"),n$={withPadding:!0},vf=ve((e,t)=>{const n=oe("PaginationControl",n$,e),{classNames:r,className:o,style:s,styles:c,vars:u,active:f,disabled:h,withPadding:m,mod:g,...y}=n,x=Im(),S=h||x.disabled;return a.jsx(_n,{ref:t,disabled:S,mod:[{active:f,disabled:S,"with-padding":m},g],...x.getStyles("control",{className:o,style:s,classNames:r,styles:c,active:!S}),...y})});vf.classes=gf;vf.displayName="@mantine/core/PaginationControl";function yf({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 r$=e=>a.jsx(yf,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),i$=e=>a.jsx(yf,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),o$=e=>a.jsx(yf,{...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"}),a$=e=>a.jsx(yf,{...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"}),s$=e=>a.jsx(yf,{...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"}),l$={icon:s$},zm=ve((e,t)=>{const n=oe("PaginationDots",l$,e),{classNames:r,className:o,style:s,styles:c,vars:u,icon:f,...h}=n,m=Im();return a.jsx(le,{ref:t,...m.getStyles("dots",{className:o,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)"}})})});zm.classes=gf;zm.displayName="@mantine/core/PaginationDots";function $m({icon:e,name:t,action:n,type:r}){const o={icon:e},s=v.forwardRef((c,u)=>{const{icon:f,...h}=oe(t,o,c),m=Im(),g=r==="next"?m.active===m.total:m.active===1;return a.jsx(vf,{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 bA=$m({icon:r$,name:"PaginationNext",action:"onNext",type:"next"}),SA=$m({icon:i$,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),jA=$m({icon:o$,name:"PaginationFirst",action:"onFirst",type:"previous"}),wA=$m({icon:a$,name:"PaginationLast",action:"onLast",type:"next"});function G0({dotsIcon:e}){const t=Im(),n=t.range.map((r,o)=>r==="dots"?a.jsx(zm,{icon:e},o):a.jsx(vf,{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},o));return a.jsx(a.Fragment,{children:n})}G0.displayName="@mantine/core/PaginationItems";const c$={siblings:1,boundaries:1},u$=(e,{size:t,radius:n,color:r,autoContrast:o})=>({root:{"--pagination-control-radius":n===void 0?void 0:Ht(n),"--pagination-control-size":rt(t,"pagination-control-size"),"--pagination-control-fz":Yn(t),"--pagination-active-bg":r?Xt(r,e):void 0,"--pagination-active-color":$l(o,e)?Da({color:r,theme:e,autoContrast:o}):void 0}}),Um=ve((e,t)=>{const n=oe("PaginationRoot",c$,e),{classNames:r,className:o,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:k,getItemProps:L,autoContrast:D,attributes:P,...$}=n,U=Ue({name:"Pagination",classes:gf,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:P,vars:f,varsResolver:u$}),{range:W,setPage:Y,next:ee,previous:B,active:G,first:M,last:I}=IM({page:m,initialPage:g,onChange:y,total:h,siblings:S,boundaries:w}),z=dr(R,ee),V=dr(E,B),K=dr(_,M),O=dr(k,I);return a.jsx(t$,{value:{total:h,range:W,active:G,disabled:x,getItemProps:L,onChange:Y,onNext:z,onPrevious:V,onFirst:K,onLast:O,getStyles:U},children:a.jsx(le,{ref:t,...U("root"),...$})})});Um.classes=gf;Um.displayName="@mantine/core/PaginationRoot";const d$={withControls:!0,withPages:!0,siblings:1,boundaries:1,gap:8},Gi=ve((e,t)=>{const n=oe("Pagination",d$,e),{withEdges:r,withControls:o,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(Um,{ref:t,total:g,...w,children:a.jsxs(be,{gap:y,children:[r&&a.jsx(jA,{icon:h,...s?.("first")}),o&&a.jsx(SA,{icon:u,...s?.("previous")}),S&&a.jsx(G0,{dotsIcon:m}),o&&a.jsx(bA,{icon:c,...s?.("next")}),r&&a.jsx(wA,{icon:f,...s?.("last")})]})})});Gi.classes=gf;Gi.displayName="@mantine/core/Pagination";Gi.Root=Um;Gi.Control=vf;Gi.Dots=zm;Gi.First=jA;Gi.Last=wA;Gi.Next=bA;Gi.Previous=SA;Gi.Items=G0;var Hx={root:"m_f61ca620",input:"m_ccf8da4c",innerInput:"m_f2d85dd2",visibilityToggle:"m_b1072d44"};const f$=({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"})}),h$={visibilityToggleIcon:f$},p$=(e,{size:t})=>({root:{"--psi-icon-size":rt(t,"psi-icon-size"),"--psi-button-size":rt(t,"psi-button-size")}}),uo=ve((e,t)=>{const n=oe("PasswordInput",h$,e),{classNames:r,className:o,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:k,withAsterisk:L,inputWrapperOrder:D,wrapperProps:P,radius:$,rightSection:U,rightSectionWidth:W,rightSectionPointerEvents:Y,leftSectionWidth:ee,visible:B,defaultVisible:G,onVisibilityChange:M,visibilityToggleIcon:I,visibilityToggleButtonProps:z,rightSectionProps:V,leftSectionProps:K,leftSectionPointerEvents:O,withErrorStyles:F,mod:se,attributes:de,...xe}=n,Ce=pr(x),[we,Ye]=ir({value:B,defaultValue:G,finalValue:!1,onChange:M}),De=()=>Ye(!we),ht=Ue({name:"PasswordInput",classes:Hx,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:de,vars:f,varsResolver:p$}),{resolvedClassNames:Rt,resolvedStyles:at}=zl({classNames:r,styles:c,props:n}),{styleProps:Ze,rest:mt}=Aa(xe),Dt=E?.id||`${Ce}-error`,jt=_?.id||`${Ce}-description`,Me=`${!!m&&typeof m!="boolean"?Dt:""} ${!!C?jt:""}`,Ie=Me.trim().length>0?Me.trim():void 0,it=a.jsx(An,{...ht("visibilityToggle"),disabled:y,radius:$,"aria-hidden":!z,"aria-pressed":we,tabIndex:-1,...z,variant:z?.variant??"subtle",color:"gray",unstyled:u,onTouchEnd:et=>{et.preventDefault(),z?.onTouchEnd?.(et),De()},onMouseDown:et=>{et.preventDefault(),z?.onMouseDown?.(et),De()},onKeyDown:et=>{z?.onKeyDown?.(et),et.key===" "&&(et.preventDefault(),De())},children:a.jsx(I,{reveal:we})});return a.jsx(gn.Wrapper,{required:h,id:Ce,label:T,error:m,description:C,size:R,classNames:Rt,styles:at,__staticSelector:"PasswordInput",unstyled:u,withAsterisk:L,inputWrapperOrder:D,inputContainer:w,variant:S,labelProps:{...k,htmlFor:Ce},descriptionProps:{..._,id:jt},errorProps:{...E,id:Dt},mod:se,attributes:de,...ht("root"),...Ze,...P,children:a.jsx(gn,{component:"div",error:m,leftSection:g,size:R,classNames:{...Rt,input:Ft(Hx.input,Rt.input)},styles:at,radius:$,disabled:y,__staticSelector:"PasswordInput",rightSectionWidth:W,rightSection:U??it,variant:S,unstyled:u,leftSectionWidth:ee,rightSectionPointerEvents:Y||"all",rightSectionProps:V,leftSectionProps:K,leftSectionPointerEvents:O,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,...mt,"aria-describedby":Ie,autoComplete:mt.autoComplete||"off",type:we?"text":"password"})})})});uo.classes={...Vr.classes,...Hx};uo.displayName="@mantine/core/PasswordInput";var CA={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const[m$,EA]=Wo(),[g$,v$]=Wo();var TA={card:"m_9dc8ae12"};const y$={withBorder:!0},x$=(e,{radius:t})=>({card:{"--card-radius":Ht(t)}}),W0=ve((e,t)=>{const n=oe("RadioCard",y$,e),{classNames:r,className:o,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=Ue({name:"RadioCard",classes:TA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:x$,rootSelector:"card"}),{dir:E}=As(),_=EA(),k=typeof h=="boolean"?h:_?.value===y||!1,L=S||_?.name,D=P=>{if(w?.(P),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(P.nativeEvent.code)){P.preventDefault();const $=Array.from(document.querySelectorAll(`[role="radio"][name="${L||"__mantine"}"]`)),U=$.findIndex(ee=>ee===P.target),W=U+1>=$.length?0:U+1,Y=U-1<0?$.length-1:U-1;P.nativeEvent.code==="ArrowDown"&&($[W].focus(),$[W].click()),P.nativeEvent.code==="ArrowUp"&&($[Y].focus(),$[Y].click()),P.nativeEvent.code==="ArrowLeft"&&($[E==="ltr"?Y:W].focus(),$[E==="ltr"?Y:W].click()),P.nativeEvent.code==="ArrowRight"&&($[E==="ltr"?W:Y].focus(),$[E==="ltr"?W:Y].click())}};return a.jsx(g$,{value:{checked:k},children:a.jsx(_n,{ref:t,mod:[{"with-border":g,checked:k},m],...R("card"),...T,role:"radio","aria-checked":k,name:L,onClick:P=>{x?.(P),_?.onChange(y||"")},onKeyDown:D})})});W0.displayName="@mantine/core/RadioCard";W0.classes=TA;const Q0=ve((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:s,wrapperProps:c,children:u,name:f,readOnly:h,disabled:m,...g}=oe("RadioGroup",null,e),y=pr(f),[x,S]=ir({value:n,defaultValue:r,finalValue:"",onChange:o}),w=C=>!h&&S(typeof C=="string"?C:C.currentTarget.value);return a.jsx(m$,{value:{value:x,onChange:w,size:s,name:y,disabled:m},children:a.jsx(gn.Wrapper,{size:s,ref:t,...c,...g,labelElement:"div",__staticSelector:"RadioGroup",children:a.jsx(g0,{role:"radiogroup",children:u})})})});Q0.classes=gn.Wrapper.classes;Q0.displayName="@mantine/core/RadioGroup";function RA({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 _A={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const b$={icon:RA},S$=(e,{radius:t,color:n,size:r,iconColor:o,variant:s,autoContrast:c})=>{const u=Jr({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":rt(r,"radio-size"),"--radio-radius":t===void 0?void 0:Ht(t),"--radio-color":s==="outline"?f:Xt(n,e),"--radio-icon-size":rt(r,"radio-icon-size"),"--radio-icon-color":o?Xt(o,e):$l(c,e)?Da({color:n,theme:e,autoContrast:c}):void 0}}},Y0=ve((e,t)=>{const n=oe("RadioIndicator",b$,e),{classNames:r,className:o,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,_=Ue({name:"RadioIndicator",classes:_A,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:R,vars:f,varsResolver:S$,rootSelector:"indicator"}),k=v$(),L=typeof S=="boolean"?S:k?.checked||!1;return a.jsx(le,{ref:t,..._("indicator",{variant:C}),variant:C,mod:[{checked:L,disabled:T},w],...E,children:a.jsx(h,{..._("icon")})})});Y0.displayName="@mantine/core/RadioIndicator";Y0.classes=_A;const j$={labelPosition:"right"},w$=(e,{size:t,radius:n,color:r,iconColor:o,variant:s,autoContrast:c})=>{const u=Jr({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":rt(t,"radio-size"),"--radio-radius":n===void 0?void 0:Ht(n),"--radio-color":s==="outline"?f:Xt(r,e),"--radio-icon-color":o?Xt(o,e):$l(c,e)?Da({color:r,theme:e,autoContrast:c}):void 0,"--radio-icon-size":rt(t,"radio-icon-size")}}},Rr=ve((e,t)=>{const n=oe("Radio",j$,e),{classNames:r,className:o,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:_=RA,rootRef:k,iconColor:L,onChange:D,mod:P,attributes:$,checked:U,...W}=n,Y=Ue({name:"Radio",classes:CA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:$,vars:f,varsResolver:w$}),ee=EA(),B=ee?.size??m,G=n.size?m:B,{styleProps:M,rest:I}=Aa(W),z=pr(h),V=ee?ee.value===I.value:void 0,K={checked:V??U,name:ee?.name??I.name,onChange:O=>{ee?.onChange(O),D?.(O)},disabled:ee?.disabled??R};return a.jsx(wm,{...Y("root"),__staticSelector:"Radio",__stylesApiProps:n,id:z,size:G,labelPosition:y,label:g,description:x,error:S,disabled:K.disabled,classNames:r,styles:c,unstyled:u,"data-checked":(V??U)||void 0,variant:T,ref:k,mod:P,...M,...E,children:a.jsxs(le,{...Y("inner"),mod:{"label-position":y},children:[a.jsx(le,{...Y("radio",{focusable:!0,variant:T}),...I,...K,component:"input",mod:{error:!!S},ref:t,id:z,type:"radio"}),a.jsx(_,{...Y("icon"),"aria-hidden":!0})]})})});Rr.classes=CA;Rr.displayName="@mantine/core/Radio";Rr.Group=Q0;Rr.Card=W0;Rr.Indicator=Y0;const C$={duration:100,transition:"fade"};function wT(e,t){return{...C$,...t,...e}}var Bm={tooltip:"m_1b3c8819",arrow:"m_f898399f"};function E$({offset:e,position:t,defaultOpened:n}){const[r,o]=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=Sa(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:o,boundaryRef:s,floating:h.setFloating}}const T$={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:Br("popover")},R$=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Ht(t),"--tooltip-bg":n?Xt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),K0=ve((e,t)=>{const n=oe("TooltipFloating",T$,e),{children:r,refProp:o,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:k,portalProps:L,attributes:D,...P}=n,$=kn(),U=Ue({name:"TooltipFloating",props:n,classes:Bm,className:u,style:c,classNames:f,styles:h,unstyled:m,attributes:D,rootSelector:"tooltip",vars:k,varsResolver:R$}),{handleMouseMove:W,x:Y,y:ee,opened:B,boundaryRef:G,floating:M,setOpened:I}=E$({offset:S,position:w,defaultOpened:E}),z=Il(r);if(!z)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=Fn(G,lm(z),t),K=z.props,O=se=>{K.onMouseEnter?.(se),W(se),I(!0)},F=se=>{K.onMouseLeave?.(se),I(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(Ca,{...L,withinPortal:s,children:a.jsx(le,{...P,...U("tooltip",{style:{...g2(c,$),zIndex:T,display:!R&&B?"block":"none",top:(ee&&Math.round(ee))??"",left:(Y&&Math.round(Y))??""}}),variant:_,ref:M,mod:{multiline:C},children:x})}),v.cloneElement(z,{...K,[o]:V,onMouseEnter:O,onMouseLeave:F})]})});K0.classes=Bm;K0.displayName="@mantine/core/TooltipFloating";const DA=v.createContext(!1),_$=DA.Provider,D$=()=>v.useContext(DA),A$={openDelay:0,closeDelay:0};function X0(e){const{openDelay:t,closeDelay:n,children:r}=oe("TooltipGroup",A$,e);return a.jsx(_$,{value:!0,children:a.jsx(VL,{delay:{open:t,close:n},children:r})})}X0.displayName="@mantine/core/TooltipGroup";X0.extend=e=>e;function k$(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 P$(e){const t=k$(e.middlewares),n=[N2(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"?Lp():Lp(t.flip)),n.push(O2({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline=="boolean"?Dd():Dd(t.inline)):e.inline&&n.push(Dd()),n}function N$(e){const[t,n]=v.useState(e.defaultOpened),o=typeof e.opened=="boolean"?e.opened:t,s=D$(),c=pr(),u=v.useCallback(k=>{n(k),k&&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:o,onOpenChange:u,middleware:P$(e),whileElementsMounted:Ix}),{delay:w,currentId:C,setCurrentId:T}=FL(m,{id:c}),{getReferenceProps:R,getFloatingProps:E}=YL([UL(m,{enabled:e.events?.hover,delay:s?w:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch}),QL(m,{enabled:e.events?.focus,visibleOnly:!0}),XL(m,{role:"tooltip"}),GL(m,{enabled:typeof e.opened>"u"})]);Cl(()=>{e.onPositionChange?.(y)},[y]);const _=o&&C&&C!==c;return{x:f,y:h,arrowX:x,arrowY:S,reference:g.setReference,floating:g.setFloating,getFloatingProps:E,getReferenceProps:R,isGroupPhase:_,opened:o,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}},O$=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const s=e.variantColorResolver({theme:e,color:n||e.primaryColor,autoContrast:o,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}}},Xr=ve((e,t)=>{const n=oe("Tooltip",CT,e),{children:r,position:o,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:k,arrowOffset:L,arrowRadius:D,arrowPosition:P,offset:$,transitionProps:U,multiline:W,events:Y,zIndex:ee,disabled:B,positionDependencies:G,onClick:M,onMouseEnter:I,onMouseLeave:z,inline:V,variant:K,keepMounted:O,vars:F,portalProps:se,mod:de,floatingStrategy:xe,middlewares:Ce,autoContrast:we,attributes:Ye,target:De,...ht}=oe("Tooltip",CT,n),{dir:Rt}=As(),at=v.useRef(null),Ze=N$({position:Z2(Rt,o),closeDelay:f,openDelay:u,onPositionChange:h,opened:m,defaultOpened:g,events:Y,arrowRef:at,arrowOffset:L,offset:typeof $=="number"?$+(_?k/2:0):$,positionDependencies:[...G,De??r],inline:V,strategy:xe,middlewares:Ce});v.useEffect(()=>{const Me=De instanceof HTMLElement?De:typeof De=="string"?document.querySelector(De):De?.current||null;Me&&Ze.reference(Me)},[De,Ze]);const mt=Ue({name:"Tooltip",props:n,classes:Bm,className:E,style:R,classNames:w,styles:C,unstyled:T,attributes:Ye,rootSelector:"tooltip",vars:F,varsResolver:O$}),Dt=Il(r);if(!De&&!Dt)return null;if(De){const Me=wT(U,{duration:100,transition:"fade"});return a.jsx(a.Fragment,{children:a.jsx(Ca,{...se,withinPortal:y,children:a.jsx(po,{...Me,keepMounted:O,mounted:!B&&!!Ze.opened,duration:Ze.isGroupPhase?10:Me.duration,children:Ie=>a.jsxs(le,{...ht,"data-fixed":xe==="fixed"||void 0,variant:K,mod:[{multiline:W},de],...Ze.getFloatingProps({ref:Ze.floating,className:mt("tooltip").className,style:{...mt("tooltip").style,...Ie,zIndex:ee,top:Ze.y??0,left:Ze.x??0}}),children:[c,a.jsx(Ip,{ref:at,arrowX:Ze.arrowX,arrowY:Ze.arrowY,visible:_,position:Ze.placement,arrowSize:k,arrowOffset:L,arrowRadius:D,arrowPosition:P,...mt("arrow")})]})})})})}const jt=Dt.props,Ae=Fn(Ze.reference,lm(Dt),t),Ne=wT(U,{duration:100,transition:"fade"});return a.jsxs(a.Fragment,{children:[a.jsx(Ca,{...se,withinPortal:y,children:a.jsx(po,{...Ne,keepMounted:O,mounted:!B&&!!Ze.opened,duration:Ze.isGroupPhase?10:Ne.duration,children:Me=>a.jsxs(le,{...ht,"data-fixed":xe==="fixed"||void 0,variant:K,mod:[{multiline:W},de],...Ze.getFloatingProps({ref:Ze.floating,className:mt("tooltip").className,style:{...mt("tooltip").style,...Me,zIndex:ee,top:Ze.y??0,left:Ze.x??0}}),children:[c,a.jsx(Ip,{ref:at,arrowX:Ze.arrowX,arrowY:Ze.arrowY,visible:_,position:Ze.placement,arrowSize:k,arrowOffset:L,arrowRadius:D,arrowPosition:P,...mt("arrow")})]})})}),v.cloneElement(Dt,Ze.getReferenceProps({onClick:M,onMouseEnter:I,onMouseLeave:z,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,...jt,className:Ft(E,jt.className),[s]:Ae}))]})});Xr.classes=Bm;Xr.displayName="@mantine/core/Tooltip";Xr.Floating=K0;Xr.Group=X0;function M$({size:e,thickness:t,sum:n,value:r,root:o,offset:s}){const c=(e*.9-t*2)/2,u=Math.PI*c*2/100,f=o||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:o?`scale(1, -1) translate(0, -${e})`:void 0,strokeDasharray:f,strokeDashoffset:o?0:s||0}}function AA({size:e,value:t,offset:n,sum:r,thickness:o,root:s,color:c,lineRoundCaps:u,tooltip:f,getStyles:h,display:m,...g}){const y=kn();return a.jsx(Xr.Floating,{disabled:!f,label:f,children:a.jsx(le,{component:"circle",...g,...h("curve"),__vars:{"--curve-color":c?Xt(c,y):void 0},fill:"none",strokeLinecap:u?"round":"butt",...M$({sum:r,size:e,thickness:o,value:t,offset:n,root:s})})})}AA.displayName="@mantine/core/Curve";function L$({size:e,thickness:t,sections:n,renderRoundedLineCaps:r,rootColor:o}){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:o},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 kA={root:"m_b32e4812",svg:"m_d43b5134",curve:"m_b1ca1fbf",label:"m_b23f9dc4"};function I$(e,t){return Math.min(e||12,(t||120)/4)}const z$={size:120,thickness:12},$$=(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}}),Vm=ve((e,t)=>{const n=oe("RingProgress",z$,e),{classNames:r,className:o,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=Ue({name:"RingProgress",classes:kA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:C,vars:f,varsResolver:$$}),E=I$(y,g),_=L$({size:g,thickness:E,sections:m,renderRoundedLineCaps:x,rootColor:S}).map(({data:k,sum:L,root:D,lineRoundCaps:P,offset:$},U)=>v.createElement(AA,{...k,key:U,size:g,thickness:E,sum:L,offset:$,color:k?.color,root:D,lineRoundCaps:P,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})]})});Vm.classes=kA;Vm.displayName="@mantine/core/RingProgress";var PA={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const U$={withItemsBorders:!0},B$=(e,{radius:t,color:n,transitionDuration:r,size:o,transitionTimingFunction:s})=>({root:{"--sc-radius":t===void 0?void 0:Ht(t),"--sc-color":n?Xt(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":rt(o,"sc-padding"),"--sc-font-size":Yn(o)}}),Tl=ve((e,t)=>{const n=oe("SegmentedControl",U$,e),{classNames:r,className:o,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:k,transitionTimingFunction:L,variant:D,autoContrast:P,withItemsBorders:$,mod:U,attributes:W,...Y}=n,ee=Ue({name:"SegmentedControl",props:n,classes:PA,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:W,vars:f,varsResolver:B$}),B=kn(),G=h.map(De=>typeof De=="string"?{label:De,value:De}:De),M=YM(),[I,z]=v.useState(Pp()),[V,K]=v.useState(null),[O,F]=v.useState({}),se=(De,ht)=>{O[ht]=De,F(O)},[de,xe]=ir({value:m,defaultValue:g,finalValue:Array.isArray(h)?G.find(De=>!De.disabled)?.value??h[0]?.value??null:null,onChange:y}),Ce=pr(S),we=G.map(De=>v.createElement(le,{...ee("control"),mod:{active:de===De.value,orientation:R},key:De.value},v.createElement("input",{...ee("input"),disabled:w||De.disabled,type:"radio",name:Ce,value:De.value,id:`${Ce}-${De.value}`,checked:de===De.value,onChange:()=>!C&&xe(De.value),"data-focus-ring":B.focusRing,key:`${De.value}-input`}),v.createElement(le,{component:"label",...ee("label"),mod:{active:de===De.value&&!(w||De.disabled),disabled:w||De.disabled,"read-only":C},htmlFor:`${Ce}-${De.value}`,ref:ht=>se(ht,De.value),__vars:{"--sc-label-color":_!==void 0?Da({color:_,theme:B,autoContrast:P}):void 0},key:`${De.value}-label`},a.jsx("span",{...ee("innerLabel"),children:De.label})))),Ye=Fn(t,De=>K(De));return UM(()=>{z(Pp())},[h.length]),h.length===0?null:a.jsxs(le,{...ee("root"),variant:D,size:x,ref:Ye,mod:[{"full-width":T,orientation:R,initialized:M,"with-items-borders":$},U],...Y,role:"radiogroup","data-disabled":w,children:[typeof de=="string"&&a.jsx(Zb,{target:O[de],parent:V,component:"span",transitionDuration:"var(--sc-transition-duration)",...ee("indicator")},I),we]})});Tl.classes=PA;Tl.displayName="@mantine/core/SegmentedControl";var NA={container:"m_925c2d2c",root:"m_2415a157"};function V$({spacing:e,verticalSpacing:t,cols:n,selector:r}){const o=kn(),s=t===void 0?e:t,c=_s({"--sg-spacing-x":Qn(so(e)),"--sg-spacing-y":Qn(so(s)),"--sg-cols":so(n)?.toString()}),u=pn(o.breakpoints).reduce((m,g)=>(m[g]||(m[g]={}),typeof e=="object"&&e[g]!==void 0&&(m[g]["--sg-spacing-x"]=Qn(e[g])),typeof s=="object"&&s[g]!==void 0&&(m[g]["--sg-spacing-y"]=Qn(s[g])),typeof n=="object"&&n[g]!==void 0&&(m[g]["--sg-cols"]=n[g]),m),{}),h=Od(pn(u),o.breakpoints).filter(m=>pn(u[m.value]).length>0).map(m=>({query:`(min-width: ${o.breakpoints[m.value]})`,styles:u[m.value]}));return a.jsx(Ul,{styles:c,media:h,selector:r})}function Ky(e){return typeof e=="object"&&e!==null?pn(e):[]}function F$(e){return e.sort((t,n)=>Nd(t)-Nd(n))}function H$({spacing:e,verticalSpacing:t,cols:n}){const r=Array.from(new Set([...Ky(e),...Ky(t),...Ky(n)]));return F$(r)}function q$({spacing:e,verticalSpacing:t,cols:n,selector:r}){const o=t===void 0?e:t,s=_s({"--sg-spacing-x":Qn(so(e)),"--sg-spacing-y":Qn(so(o)),"--sg-cols":so(n)?.toString()}),c=H$({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"]=Qn(e[m])),typeof o=="object"&&o[m]!==void 0&&(h[m]["--sg-spacing-y"]=Qn(o[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(Ul,{styles:s,container:f,selector:r})}const G$={cols:1,spacing:"md",type:"media"},Fm=ve((e,t)=>{const n=oe("SimpleGrid",G$,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,cols:h,verticalSpacing:m,spacing:g,type:y,attributes:x,...S}=n,w=Ue({name:"SimpleGrid",classes:NA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f}),C=af();return y==="container"?a.jsxs(a.Fragment,{children:[a.jsx(q$,{...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(V$,{...n,selector:`.${C}`}),a.jsx(le,{ref:t,...w("root",{className:C}),...S})]})});Fm.classes=NA;Fm.displayName="@mantine/core/SimpleGrid";const OA=ve((e,t)=>{const{w:n,h:r,miw:o,mih:s,...c}=oe("Space",null,e);return a.jsx(le,{ref:t,...c,w:n,miw:o??n,h:r,mih:s??r})});OA.displayName="@mantine/core/Space";var MA={root:"m_6d731127"};const W$={gap:"md",align:"stretch",justify:"flex-start"},Q$=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":Qn(t),"--stack-align":n,"--stack-justify":r}}),Pe=ve((e,t)=>{const n=oe("Stack",W$,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,align:h,justify:m,gap:g,variant:y,attributes:x,...S}=n,w=Ue({name:"Stack",props:n,classes:MA,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:x,vars:f,varsResolver:Q$});return a.jsx(le,{ref:t,...w("root"),variant:y,...S})});Pe.classes=MA;Pe.displayName="@mantine/core/Stack";const[Y$,K$]=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 $p=()=>null;$p.displayName="@mantine/core/StepperCompleted";const ap=(e,t)=>typeof e=="function"?a.jsx(e,{step:t||0}):e,X$={withIcon:!0,allowStepClick:!0,iconPosition:"left"},Z0=ve((e,t)=>{const{classNames:n,className:r,style:o,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:k,mod:L,...D}=oe("StepperStep",X$,e),P=K$(),$=kn(),U={classNames:n,styles:s},W=f==="stepCompleted"?null:f==="stepProgress"?y:m,Y={"data-progress":f==="stepProgress"||void 0,"data-completed":f==="stepCompleted"||void 0};return a.jsxs(_n,{...P.getStyles("step",{className:r,style:o,variant:P.orientation,...U}),mod:[{"icon-position":_||P.iconPosition,"allow-click":R},L],ref:t,...Y,...D,__vars:{"--step-color":h?Xt(h,$):void 0},tabIndex:R?0:-1,children:[w&&a.jsxs("span",{...P.getStyles("stepWrapper",U),children:[a.jsxs("span",{...P.getStyles("stepIcon",U),...Y,children:[a.jsx(po,{mounted:f==="stepCompleted",transition:"pop",duration:200,children:ee=>a.jsx("span",{...P.getStyles("stepCompletedIcon",{style:ee,...U}),children:T?a.jsx(Pr,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...P.getStyles("stepLoader",U)}):ap(g,u)||a.jsx(hf,{size:"60%"})})}),f!=="stepCompleted"?T?a.jsx(Pr,{...P.getStyles("stepLoader",U),size:"calc(var(--stepper-icon-size) / 2)",color:h}):ap(W||m,u):null]}),k==="vertical"&&a.jsx("span",{...P.getStyles("verticalSeparator",U),"data-active":f==="stepCompleted"||void 0})]}),(x||S)&&a.jsxs("span",{...P.getStyles("stepBody",U),"data-orientation":P.orientation,"data-icon-position":_||P.iconPosition,children:[x&&a.jsx("span",{...P.getStyles("stepLabel",U),children:ap(x,u)}),S&&a.jsx("span",{...P.getStyles("stepDescription",U),children:ap(S,u)})]})]})});Z0.classes=J0;Z0.displayName="@mantine/core/StepperStep";const J$={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},Z$=(e,{color:t,iconSize:n,size:r,contentPadding:o,radius:s,autoContrast:c})=>({root:{"--stepper-color":t?Xt(t,e):void 0,"--stepper-icon-color":$l(c,e)?Da({color:t,theme:e,autoContrast:c}):void 0,"--stepper-icon-size":n===void 0?rt(r,"stepper-icon-size"):ce(n),"--stepper-content-padding":Qn(o),"--stepper-radius":s===void 0?void 0:Ht(s),"--stepper-fz":Yn(r),"--stepper-spacing":Qn(r)}}),nu=ve((e,t)=>{const n=oe("Stepper",J$,e),{classNames:r,className:o,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:k,allowNextStepsSelect:L,wrap:D,autoContrast:P,attributes:$,...U}=n,W=Ue({name:"Stepper",classes:J0,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:$,vars:f,varsResolver:Z$}),Y=v.Children.toArray(h),ee=Y.filter(V=>V.type!==$p),B=Y.find(V=>V.type===$p),G=ee.reduce((V,K,O)=>{const F=g===O?"stepProgress":g>O?"stepCompleted":"stepInactive",de=typeof m!="function"?!1:typeof K.props.allowStepSelect=="boolean"?K.props.allowStepSelect:F==="stepCompleted"||L;return V.push(v.cloneElement(K,{icon:K.props.icon||y||O+1,key:O,step:O,state:F,onClick:()=>de&&m?.(O),allowStepClick:de,completedIcon:K.props.completedIcon||x,progressIcon:K.props.progressIcon||S,color:K.props.color||w,iconSize:C,iconPosition:K.props.iconPosition||E,orientation:R})),R==="horizontal"&&O!==ee.length-1&&V.push(v.createElement("div",{...W("separator"),"data-active":O<g||void 0,"data-orientation":R,key:`separator-${O}`})),V},[]),M=ee[g]?.props?.children,I=B?.props?.children,z=g>ee.length-1?I:M;return a.jsx(Y$,{value:{getStyles:W,orientation:R,iconPosition:E},children:a.jsxs(le,{...W("root"),ref:t,size:_,...U,children:[a.jsx(le,{...W("steps"),mod:{orientation:R,"icon-position":E,wrap:D&&R!=="vertical"},children:G}),z&&a.jsx("div",{...W("content"),children:z})]})})});nu.classes=J0;nu.displayName="@mantine/core/Stepper";nu.Completed=$p;nu.Step=Z0;var LA={root:"m_5f93f3bb",input:"m_926b4011",track:"m_9307d992",thumb:"m_93039a1d",trackLabel:"m_8277e082"};const IA=v.createContext(null),e8=IA.Provider,t8=()=>v.useContext(IA),eS=ve((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:s,wrapperProps:c,children:u,readOnly:f,disabled:h,...m}=oe("SwitchGroup",null,e),[g,y]=ir({value:n,defaultValue:r,finalValue:[],onChange:o}),x=S=>{const w=S.currentTarget.value;!f&&y(g.includes(w)?g.filter(C=>C!==w):[...g,w])};return a.jsx(e8,{value:{value:g,onChange:x,size:s,disabled:h},children:a.jsx(gn.Wrapper,{size:s,ref:t,...c,...m,labelElement:"div",__staticSelector:"SwitchGroup",children:a.jsx(g0,{role:"group",children:u})})})});eS.classes=gn.Wrapper.classes;eS.displayName="@mantine/core/SwitchGroup";const n8={labelPosition:"right",withThumbIndicator:!0},r8=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:Ht(t),"--switch-height":rt(r,"switch-height"),"--switch-width":rt(r,"switch-width"),"--switch-thumb-size":rt(r,"switch-thumb-size"),"--switch-label-font-size":rt(r,"switch-label-font-size"),"--switch-track-label-padding":rt(r,"switch-track-label-padding"),"--switch-color":n?Xt(n,e):void 0}}),xf=ve((e,t)=>{const n=oe("Switch",n8,e),{classNames:r,className:o,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:k,description:L,error:D,disabled:P,variant:$,rootRef:U,mod:W,withThumbIndicator:Y,attributes:ee,...B}=n,G=t8(),M=S||G?.size,I=Ue({name:"Switch",props:n,classes:LA,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:ee,vars:f,varsResolver:r8}),{styleProps:z,rest:V}=Aa(B),K=pr(x),O={checked:G?.value.includes(V.value)??R,onChange:de=>{G?.onChange(de),_?.(de)},disabled:G?.disabled??P},[F,se]=ir({value:O.checked??R,defaultValue:E,finalValue:!1});return a.jsxs(wm,{...I("root"),__staticSelector:"Switch",__stylesApiProps:n,id:K,size:M,labelPosition:k,label:m,description:L,error:D,disabled:O.disabled,bodyElement:"label",labelElement:"span",classNames:r,styles:c,unstyled:u,"data-checked":O.checked,variant:$,ref:U,mod:W,inert:V.inert,...z,...C,children:[a.jsx("input",{...V,...O,checked:F,"data-checked":O.checked,onChange:de=>{O.onChange?.(de),se(de.currentTarget.checked)},id:K,ref:t,type:"checkbox",role:"switch",inert:V.inert,...I("input")}),a.jsxs(le,{"aria-hidden":"true",component:"span",mod:{error:D,"label-position":k,"without-labels":!y&&!g},...I("track"),children:[a.jsx(le,{component:"span",mod:{"reduce-motion":!0,"with-thumb-indicator":Y&&!T},...I("thumb"),children:T}),a.jsx("span",{...I("trackLabel"),children:F?y:g})]})]})});xf.classes={...LA,...ID};xf.displayName="@mantine/core/Switch";xf.Group=eS;const[i8,o8]=Or("Table component was not found in the tree");var bf={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 a8(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 Fl(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=ve((o,s)=>{const c=oe(n,{},o),{classNames:u,className:f,style:h,styles:m,...g}=c,y=o8();return a.jsx(le,{component:e,ref:s,...a8(y,t),...y.getStyles(e,{className:f,classNames:u,style:h,styles:m,props:c}),...g})});return r.displayName=`@mantine/core/${n}`,r.classes=bf,r}const qx=Fl("th",{columnBorder:!0}),zA=Fl("td",{columnBorder:!0}),jp=Fl("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),$A=Fl("thead",{stickyHeader:!0}),UA=Fl("tbody"),BA=Fl("tfoot"),VA=Fl("caption",{captionSide:!0});function tS({data:e}){return a.jsxs(a.Fragment,{children:[e.caption&&a.jsx(VA,{children:e.caption}),e.head&&a.jsx($A,{children:a.jsx(jp,{children:e.head.map((t,n)=>a.jsx(qx,{children:t},n))})}),e.body&&a.jsx(UA,{children:e.body.map((t,n)=>a.jsx(jp,{children:t.map((r,o)=>a.jsx(zA,{children:r},o))},n))}),e.foot&&a.jsx(BA,{children:a.jsx(jp,{children:e.foot.map((t,n)=>a.jsx(qx,{children:t},n))})})]})}tS.displayName="@mantine/core/TableDataRenderer";const s8={type:"scrollarea"},l8=(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=oe("TableScrollContainer",s8,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,children:h,minWidth:m,maxHeight:g,type:y,scrollAreaProps:x,attributes:S,...w}=n,C=Ue({name:"TableScrollContainer",classes:bf,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:S,vars:f,varsResolver:l8,rootSelector:"scrollContainer"});return a.jsx(le,{component:y==="scrollarea"?Zr:"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=bf;nS.displayName="@mantine/core/TableScrollContainer";const c8={withRowBorders:!0,verticalSpacing:7},u8=(e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:o,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":Qn(r),"--table-vertical-spacing":Qn(o),"--table-border-color":s?Xt(s,e):void 0,"--table-striped-color":f&&c?Xt(c,e):void 0,"--table-highlight-on-hover-color":h&&u?Xt(u,e):void 0,"--table-sticky-header-offset":g?ce(m):void 0}}),Z=ve((e,t)=>{const n=oe("Table",c8,e),{classNames:r,className:o,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:k,data:L,children:D,stickyHeader:P,stickyHeaderOffset:$,mod:U,tabularNums:W,attributes:Y,...ee}=n,B=Ue({name:"Table",props:n,className:o,style:s,classes:bf,classNames:r,styles:c,unstyled:u,attributes:Y,rootSelector:"table",vars:f,varsResolver:u8});return a.jsx(i8,{value:{getStyles:B,stickyHeader:P,striped:S===!0?"odd":S||void 0,highlightOnHover:w,withColumnBorders:C,withRowBorders:T,captionSide:g||"bottom"},children:a.jsx(le,{component:"table",variant:k,ref:t,mod:[{"data-with-table-border":R,"data-tabular-nums":W},U],...B("table"),...ee,children:D||!!L&&a.jsx(tS,{data:L})})})});Z.classes=bf;Z.displayName="@mantine/core/Table";Z.Td=zA;Z.Th=qx;Z.Tr=jp;Z.Thead=$A;Z.Tbody=UA;Z.Tfoot=BA;Z.Caption=VA;Z.ScrollContainer=nS;Z.DataRenderer=tS;const[d8,rS]=Or("Tabs component was not found in the tree");var Sf={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=oe("TabsList",null,e),{children:r,className:o,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:o,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=Sf;iS.displayName="@mantine/core/TabsList";const oS=ve((e,t)=>{const n=oe("TabsPanel",null,e),{children:r,className:o,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:o,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=Sf;oS.displayName="@mantine/core/TabsPanel";const aS=ve((e,t)=>{const n=oe("TabsTab",null,e),{className:r,children:o,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=kn(),{dir:_}=As(),k=rS(),L=u===k.value,D=$=>{k.onChange(k.allowTabDeactivation&&u===k.value?null:u),f?.($)},P={classNames:x,styles:S,props:n};return a.jsxs(_n,{...k.getStyles("tab",{className:r,style:y,variant:k.variant,...P}),disabled:m,unstyled:k.unstyled,variant:k.variant,mod:[{active:L,disabled:m,orientation:k.orientation,inverted:k.inverted,placement:k.orientation==="vertical"&&k.placement},C],ref:t,role:"tab",id:k.getTabId(u),"aria-selected":L,tabIndex:T!==void 0?T:L||k.value===null?0:-1,"aria-controls":k.getPanelId(u),onClick:D,__vars:{"--tabs-color":g?Xt(g,E):void 0},onKeyDown:Eb({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:k.activateTabWithKeyboard,loop:k.loop,orientation:k.orientation||"horizontal",dir:_,onKeyDown:h}),...R,children:[c&&a.jsx("span",{...k.getStyles("tabSection",P),"data-position":"left",children:c}),o&&a.jsx("span",{...k.getStyles("tabLabel",P),children:o}),s&&a.jsx("span",{...k.getStyles("tabSection",P),"data-position":"right",children:s})]})});aS.classes=Sf;aS.displayName="@mantine/core/TabsTab";const ET="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",f8={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,variant:"default",placement:"left"},h8=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":Ht(t),"--tabs-color":Xt(n,e),"--tabs-text-color":$l(r,e)?Da({color:n,theme:e,autoContrast:r}):void 0}}),bn=ve((e,t)=>{const n=oe("Tabs",f8,e),{defaultValue:r,value:o,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:k,style:L,vars:D,autoContrast:P,mod:$,attributes:U,...W}=n,Y=pr(h),[ee,B]=ir({value:o,defaultValue:r,finalValue:null,onChange:s}),G=Ue({name:"Tabs",props:n,classes:Sf,className:k,style:L,classNames:R,styles:E,unstyled:_,attributes:U,vars:D,varsResolver:h8});return a.jsx(d8,{value:{placement:C,value:ee,orientation:c,id:Y,loop:f,activateTabWithKeyboard:m,getTabId:vE(`${Y}-tab`,ET),getPanelId:vE(`${Y}-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:Y,variant:y,mod:[{orientation:c,inverted:c==="horizontal"&&w,placement:c==="vertical"&&C},$],...G("root"),...W,children:u})})});bn.classes=Sf;bn.displayName="@mantine/core/Tabs";bn.Tab=aS;bn.Panel=oS;bn.List=iS;const He=ve((e,t)=>{const n=oe("TextInput",null,e);return a.jsx(Vr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});He.classes=Vr.classes;He.displayName="@mantine/core/TextInput";var FA={root:"m_7341320d"};const p8=(e,{size:t,radius:n,variant:r,gradient:o,color:s,autoContrast:c})=>{const u=e.variantColorResolver({color:s||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:c});return{root:{"--ti-size":rt(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=oe("ThemeIcon",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:u,vars:f,autoContrast:h,attributes:m,...g}=n,y=Ue({name:"ThemeIcon",classes:FA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:m,vars:f,varsResolver:p8});return a.jsx(le,{ref:t,...y("root"),...g})});sS.classes=FA;sS.displayName="@mantine/core/ThemeIcon";const m8=["h1","h2","h3","h4","h5","h6"],g8=["xs","sm","md","lg","xl"];function v8(e,t){const n=t!==void 0?t:`h${e}`;return m8.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:g8.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 HA={root:"m_8a5d1357"};const y8={order:1},x8=(e,{order:t,size:n,lineClamp:r,textWrap:o})=>{const s=v8(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":o}}},$e=ve((e,t)=>{const n=oe("Title",y8,e),{classNames:r,className:o,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=Ue({name:"Title",props:n,classes:HA,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:w,vars:h,varsResolver:x8});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});$e.classes=HA;$e.displayName="@mantine/core/Title";function qA(e){let t=e,n=!1;const r=new Set;return{getState(){return t},updateState(o){t=typeof o=="function"?o(t):o},setState(o){this.updateState(o),r.forEach(s=>s(t))},initialize(o){n||(t=o,n=!0)},subscribe(o){return r.add(o),()=>r.delete(o)}}}function GA(e){return v.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}function b8(e,t,n){const r=[],o=[],s={};for(const c of e){const u=c.position||t;s[u]=s[u]||0,s[u]+=1,s[u]<=n?o.push(c):r.push(c)}return{notifications:o,queue:r}}const S8=()=>qA({notifications:[],queue:[],defaultPosition:"bottom-right",limit:5}),Hl=S8(),j8=(e=Hl)=>GA(e);function vu(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]),o=b8(r,n.defaultPosition,n.limit);e.setState({notifications:o.notifications,queue:o.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function _e(e,t=Hl){const n=e.id||Pp();return vu(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function WA(e,t=Hl){return vu(t,n=>n.filter(r=>r.id===e?(r.onClose?.(r),!1):!0)),e}function ml(e,t=Hl){return vu(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function w8(e=Hl){vu(e,()=>[])}function C8(e=Hl){vu(e,t=>t.slice(0,e.getState().limit))}const Ii={show:_e,hide:WA,update:ml,clean:w8,cleanQueue:C8,updateState:vu};function Gx(e,t){return Gx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Gx(e,t)}function QA(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Gx(e,t)}var Xy={exports:{}},Jy,TT;function E8(){if(TT)return Jy;TT=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Jy=e,Jy}var Zy,RT;function T8(){if(RT)return Zy;RT=1;var e=E8();function t(){}function n(){}return n.resetWarningCache=t,Zy=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 o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},Zy}var _T;function R8(){return _T||(_T=1,Xy.exports=T8()()),Xy.exports}var _8=R8();const dn=om(_8),DT={disabled:!1},Up=In.createContext(null);var D8=function(t){return t.scrollTop},Ed="unmounted",ll="exited",cl="entering",Bc="entered",Wx="exiting",Na=(function(e){QA(t,e);function t(r,o){var s;s=e.call(this,r,o)||this;var c=o,u=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?u?(f=ll,s.appearStatus=cl):f=Bc:r.unmountOnExit||r.mountOnEnter?f=Ed:f=ll,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(o,s){var c=o.in;return c&&s.status===Ed?{status:ll}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var s=null;if(o!==this.props){var c=this.state.status;this.props.in?c!==cl&&c!==Bc&&(s=cl):(c===cl||c===Bc)&&(s=Wx)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,s,c,u;return s=c=u=o,o!=null&&typeof o!="number"&&(s=o.exit,c=o.enter,u=o.appear!==void 0?o.appear:c),{exit:s,enter:c,appear:u}},n.updateStatus=function(o,s){if(o===void 0&&(o=!1),s!==null)if(this.cancelNextCallback(),s===cl){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:Cd.findDOMNode(this);c&&D8(c)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===ll&&this.setState({status:Ed})},n.performEnter=function(o){var s=this,c=this.props.enter,u=this.context?this.context.isMounting:o,f=this.props.nodeRef?[u]:[Cd.findDOMNode(this),u],h=f[0],m=f[1],g=this.getTimeouts(),y=u?g.appear:g.enter;if(!o&&!c||DT.disabled){this.safeSetState({status:Bc},function(){s.props.onEntered(h)});return}this.props.onEnter(h,m),this.safeSetState({status:cl},function(){s.props.onEntering(h,m),s.onTransitionEnd(y,function(){s.safeSetState({status:Bc},function(){s.props.onEntered(h,m)})})})},n.performExit=function(){var o=this,s=this.props.exit,c=this.getTimeouts(),u=this.props.nodeRef?void 0:Cd.findDOMNode(this);if(!s||DT.disabled){this.safeSetState({status:ll},function(){o.props.onExited(u)});return}this.props.onExit(u),this.safeSetState({status:Wx},function(){o.props.onExiting(u),o.onTransitionEnd(c.exit,function(){o.safeSetState({status:ll},function(){o.props.onExited(u)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,s){s=this.setNextCallback(s),this.setState(o,s)},n.setNextCallback=function(o){var s=this,c=!0;return this.nextCallback=function(u){c&&(c=!1,s.nextCallback=null,o(u))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(o,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:Cd.findDOMNode(this),u=o==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)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Ed)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 In.createElement(Up.Provider,{value:null},typeof c=="function"?c(o,u):In.cloneElement(In.Children.only(c),u))},t})(In.Component);Na.contextType=Up;Na.propTypes={};function Nc(){}Na.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Nc,onEntering:Nc,onEntered:Nc,onExit:Nc,onExiting:Nc,onExited:Nc};Na.UNMOUNTED=Ed;Na.EXITED=ll;Na.ENTERING=cl;Na.ENTERED=Bc;Na.EXITING=Wx;function A8(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(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function k8(e,t){e=e||{},t=t||{};function n(m){return m in t?t[m]:e[m]}var r=Object.create(null),o=[];for(var s in e)s in t?o.length&&(r[s]=o,o=[]):o.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<o.length;c++)u[o[c]]=n(o[c]);return u}function gl(e,t,n){return n[t]!=null?n[t]:e.props[t]}function P8(e,t){return lS(e.children,function(n){return v.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:gl(n,"appear",e),enter:gl(n,"enter",e),exit:gl(n,"exit",e)})})}function N8(e,t,n){var r=lS(e.children),o=k8(t,r);return Object.keys(o).forEach(function(s){var c=o[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)?o[s]=v.cloneElement(c,{onExited:n.bind(null,c),in:!0,exit:gl(c,"exit",e),enter:gl(c,"enter",e)}):!f&&u&&!m?o[s]=v.cloneElement(c,{in:!1}):f&&u&&v.isValidElement(h)&&(o[s]=v.cloneElement(c,{onExited:n.bind(null,c),in:h.props.in,exit:gl(c,"exit",e),enter:gl(c,"enter",e)}))}}),o}var O8=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},M8={component:"div",childFactory:function(t){return t}},ps=(function(e){QA(t,e);function t(r,o){var s;s=e.call(this,r,o)||this;var c=s.handleExited.bind(A8(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(o,s){var c=s.children,u=s.handleExited,f=s.firstRender;return{children:f?P8(o,u):N8(o,c,u),firstRender:!1}},n.handleExited=function(o,s){var c=lS(this.props.children);o.key in c||(o.props.onExited&&o.props.onExited(s),this.mounted&&this.setState(function(u){var f=zp({},u.children);return delete f[o.key],{children:f}}))},n.render=function(){var o=this.props,s=o.component,c=o.childFactory,u=A0(o,["component","childFactory"]),f=this.state.contextValue,h=O8(this.state.children).map(c);return delete u.appear,delete u.enter,delete u.exit,s===null?In.createElement(Up.Provider,{value:f},h):In.createElement(Up.Provider,{value:f},In.createElement(s,u,h))},t})(In.Component);ps.propTypes={};ps.defaultProps=M8;const YA=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"];function L8(e,t){return e.reduce((n,r)=>(n[r.position||t].push(r),n),YA.reduce((n,r)=>(n[r]=[],n),{}))}const AT={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},I8={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function z8({state:e,maxHeight:t,position:n,transitionDuration:r}){const[o,s]=n.split("-"),c=s==="center"?`${o}-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:I8[c]},h={opacity:0,maxHeight:0,transform:AT[c]};return{...u,...{entering:f,entered:f,exiting:h,exited:h}[e]}}function $8(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const KA=v.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:s,message:c,...u}=e,f=$8(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:o,onMouseEnter:m,onMouseLeave:y,children:c})});KA.displayName="@mantine/notifications/NotificationContainer";var XA={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const U8=Na,B8={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:Br("overlay"),store:Hl,withinPortal:!0},V8=(e,{zIndex:t,containerWidth:n})=>({root:{"--notifications-z-index":t?.toString(),"--notifications-container-width":ce(n)}}),Oa=ve((e,t)=>{const n=oe("Notifications",B8,e),{classNames:r,className:o,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,_=kn(),k=j8(C),L=NM(),D=_b(),P=v.useRef({}),$=v.useRef(0),W=(_.respectReducedMotion?D:!1)?1:g,Y=Ue({name:"Notifications",classes:XA,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,vars:f,varsResolver:V8});v.useEffect(()=>{C?.updateState(G=>({...G,limit:S||5,defaultPosition:h}))},[S,h]),Cl(()=>{k.notifications.length>$.current&&setTimeout(()=>L(),0),$.current=k.notifications.length},[k.notifications]);const ee=L8(k.notifications,h),B=YA.reduce((G,M)=>(G[M]=ee[M].map(({style:I,...z})=>a.jsx(U8,{timeout:W,onEnter:()=>P.current[z.id].offsetHeight,nodeRef:{current:P.current[z.id]},children:V=>a.jsx(KA,{ref:K=>{K&&(P.current[z.id]=K)},data:z,onHide:K=>WA(K,C),autoClose:m,...Y("notification",{style:{...z8({state:V,position:M,transitionDuration:W,maxHeight:x}),...I}})})},z.id)),G),{});return a.jsxs(Ca,{withinPortal:R,...T,children:[a.jsx(le,{...Y("root"),"data-position":"top-center",ref:t,...E,children:a.jsx(ps,{children:B["top-center"]})}),a.jsx(le,{...Y("root"),"data-position":"top-left",...E,children:a.jsx(ps,{children:B["top-left"]})}),a.jsx(le,{...Y("root",{className:wl.classNames.fullWidth}),"data-position":"top-right",...E,children:a.jsx(ps,{children:B["top-right"]})}),a.jsx(le,{...Y("root",{className:wl.classNames.fullWidth}),"data-position":"bottom-right",...E,children:a.jsx(ps,{children:B["bottom-right"]})}),a.jsx(le,{...Y("root"),"data-position":"bottom-left",...E,children:a.jsx(ps,{children:B["bottom-left"]})}),a.jsx(le,{...Y("root"),"data-position":"bottom-center",...E,children:a.jsx(ps,{children:B["bottom-center"]})})]})});Oa.classes=XA;Oa.displayName="@mantine/notifications/Notifications";Oa.show=Ii.show;Oa.hide=Ii.hide;Oa.update=Ii.update;Oa.clean=Ii.clean;Oa.cleanQueue=Ii.cleanQueue;Oa.updateState=Ii.updateState;class F8{operator;child;constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class jf{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 H8{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(o,s){const c=o.consumeAndParse(n);return r(s,c)}})}infixLeft(t,n,r){return this.registerInfix(t,{parse(o,s,c){const u=o.consumeAndParse(n);return r(s,c,u)},precedence:n})}construct(t){return new q8(t,this.prefixParselets,this.infixParselets)}}class q8{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 o=r.parse(this,n);for(;t>this.getPrecedence();){const s=this.consume();o=this.getInfixParselet(s).parse(this,o,s)}return o}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]}}class JA{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}}const Wi="http://hl7.org",ZA="ok",G8="created",W8="gone",Q8="not-modified",Y8="not-found",K8="unauthorized",X8="forbidden",J8="accepted",Z8={resourceType:"OperationOutcome",id:ZA,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},eU={resourceType:"OperationOutcome",id:Y8,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},Vd={resourceType:"OperationOutcome",id:K8,issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},tU={...Vd,issue:[...Vd.issue,{severity:"error",code:"expired",details:{text:"Token expired"}}]},kT={...Vd,issue:[...Vd.issue,{severity:"error",code:"invalid",details:{text:"Token not issued for this audience"}}]},wf={resourceType:"OperationOutcome",id:X8,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function Io(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 nU(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"exception",details:{text:"Internal server error"},diagnostics:e.toString()}]}}function rU(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 Cf(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function ek(e){return e.id===ZA||e.id===G8||e.id===Q8||e.id===J8}function iU(e){return e.id===W8}class dt extends Error{outcome;constructor(t,n){super(tk(t),n),this.name="OperationOutcomeError",this.outcome=t}}function on(e){return e instanceof dt?e.outcome:Cf(e)?e:Io(qe(e))}function qe(e){return e?typeof e=="string"?e:rU(e)?e.message:Cf(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 oU(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 aU(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(([o,s])=>[o,oU(o,s)])),constraints:[],innerTypes:[]};return t}const sU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},lU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},cU={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"}]}}},uU={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"}]}}},dU={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"}]}}},fU={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"}]}}},hU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},pU={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"}]}}},mU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},gU={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"}]}}},vU={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"}]}}},yU={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"}]},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"}]}}},bU={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"}]}}},SU={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"}]}}},jU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},direction:{min:1,type:[{code:"code"}]}}},wU={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"}]}}},CU={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"]}]}}},EU={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"]}]}}},TU={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"}]}}},RU={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"}]}}},_U={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},path:{min:1,type:[{code:"string"}]}}},DU={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"}]}}},AU={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"}]}}},kU={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"}]}}},PU={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"}]}}},NU={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"]}]}}},OU={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"]}]}}},MU={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"}]}}},LU={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"}]}}},IU={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"}]}}},zU={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"}]}}},$U={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"]}]}}},UU={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"}]}}},BU={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"}]}}},VU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},FU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},HU={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"]}]}}},qU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},GU={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"}]}}},WU={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"}]}}},QU={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"}]}}},YU={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"}]}}},KU={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"]}]}}},XU={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},JU={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"}]}}},ZU={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"]}]}}},eB={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"}]}}},tB={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"}]}}},nB={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"}]}}},rB={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},lowLimit:{type:[{code:"Quantity"}]},highLimit:{type:[{code:"Quantity"}]}}},iB={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"}]}}},oB={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"}]}}},aB={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"}]}}},sB={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"]}]}}},lB={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"}]}}},cB={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"}]}}},uB={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"}]}}},dB={Element:sU,BackboneElement:lU,Address:cU,Age:uU,Annotation:dU,Attachment:fU,CodeableConcept:hU,Coding:pU,ContactDetail:mU,ContactPoint:gU,Contributor:vU,Count:yU,DataRequirement:xU,DataRequirementCodeFilter:bU,DataRequirementDateFilter:SU,DataRequirementSort:jU,Distance:wU,Dosage:CU,DosageDoseAndRate:EU,Duration:TU,ElementDefinition:RU,ElementDefinitionSlicingDiscriminator:_U,ElementDefinitionSlicing:DU,ElementDefinitionBase:AU,ElementDefinitionType:kU,ElementDefinitionExample:PU,ElementDefinitionConstraint:NU,ElementDefinitionBinding:OU,ElementDefinitionMapping:MU,Expression:LU,Extension:IU,HumanName:zU,Identifier:$U,MarketingStatus:UU,Meta:BU,Money:VU,Narrative:FU,ParameterDefinition:HU,Period:qU,Population:GU,ProdCharacteristic:WU,ProductShelfLife:QU,Quantity:YU,Range:KU,Ratio:XU,Reference:JU,RelatedArtifact:ZU,SampledData:eB,Signature:tB,SubstanceAmount:nB,SubstanceAmountReferenceRange:rB,Timing:iB,TimingRepeat:oB,TriggerDefinition:aB,UsageContext:sB,MoneyQuantity:lB,SimpleQuantity:cB,IdentityProvider:uB};function fB(e){return new pB(e).parse()}const Bp=aU(dB),cS=Object.create(null),PT=Object.create(null),hB={"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");tV(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=fB(e),n=hB[e.url];let r,o;n?(r=Bp,o=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=Bp,o=e.type):(r=rk(e.url),o=e.type),r[o]=t;for(const s of t.innerTypes)s.parentType=t,r[s.name]=s;cS[e.url]=t}function ok(e){return!!Bp[e]}function Hm(e,t){if(t){const n=rk(t)[e];if(n)return n}return Bp[e]}function ak(e,t){const n=Hm(e,t);if(!n)throw new dt(Io("Unknown data type: "+e));return n}function uS(e){return!!cS[e]}function yu(e){return cS[e]}class pB{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:vB(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=ex(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[ex(t,r.path)]=n;break}r=r.parent}if(!r){const o=ex(t,this.root.path);t.isSummary&&this.resourceSchema.summaryProperties?.add(o.replace("[x]","")),n.min>0&&this.resourceSchema.mandatoryProperties?.add(o.replace("[x]","")),this.resourceSchema.elements[o]=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&&!Oc(this.slicingContext.path,t?.path)&&(this.slicingContext=void 0),t.slicing&&!this.slicingContext&&this.enterSlice(t,n)}enterInnerType(t){for(;this.backboneContext&&!Oc(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:Oc(this.backboneContext?.path,t.path)?this.backboneContext:this.backboneContext?.parent}}enterSlice(t,n){gB(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&&!Oc(this.backboneContext.path,t?.path))if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!Oc(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!!(Oc(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=vo(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,o={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(Fd(o,"fixed[x]")),pattern:MT(Fd(o,"pattern[x]")),binding:t.binding}}}function OT(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function ex(e,t=""){return mB(e.path,t)}function mB(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function Oc(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function MT(e){return Array.isArray(e)&&e.length>0?e[0]:Dn(e)?void 0:e}function gB(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 vB(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 yB(e,t,n){if(e===void 0)return[void 0];if(t==="$this")return[e];const r=n?.withPath?sk:Fd,[o,...s]=t.split(".");let c=[r(e,o,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 xB(Fd(e,t,n),r,t)}function xB(e,t,n){const r=t?t+".":"";return e===void 0?{type:"undefined",value:void 0,path:`${r}${n}`}:Array.isArray(e)?e.map((o,s)=>({...o,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 bB(e,t,n,r){if(Array.isArray(e))return!1;let o;t.path==="$this"?o=n:o=(r??n.elements)[t.path];const s=n.type;switch(t.type){case"value":case"pattern":if(!e||!o)return!1;if(o.pattern)return hS(e,o.pattern);if(o.fixed)return Ui(e,o.fixed);if(o.binding?.strength==="required"&&o.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:ie.boolean,value:e}]}function mi(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:ie.integer,value:e}:typeof e=="number"?{type:ie.decimal,value:e}:typeof e=="boolean"?{type:ie.boolean,value:e}:typeof e=="string"?{type:ie.string,value:e}:zi(e)?{type:ie.Quantity,value:e}:La(e)?{type:e.resourceType,value:e}:Sk(e)?{type:ie.CodeableConcept,value:e}:bk(e)?{type:ie.Coding,value:e}:{type:ie.BackboneElement,value:e}}function Oo(e){return e.length===0?!1:!!e[0].value}function Ta(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 Fd(e,t,n){if(!e.value)return;const r=Ms(e.type,t,n?.profileUrl);return r?ck(e,t,r):Ef(e,t)}function ck(e,t,n){const r=e.value,o=n.type;if(!o||o.length===0)return;let s,c="undefined",u;const f=n.path.lastIndexOf("."),h=n.path.substring(f+1);for(const m of o){const g=h.replace("[x]",Kn(m.code));if(s=r[g],u=r["_"+g],s!==void 0||u!==void 0){c=m.code;break}}if(u)if(Array.isArray(s)){s=s.slice();for(let m=0;m<Math.max(s.length,u.length);m++)s[m]=tx(s[m],u[m])}else if(!s&&Array.isArray(u)){s=u.slice();for(let m=0;m<u.length;m++)s[m]=tx(void 0,u[m])}else s=tx(s,u);if(!Dn(s))return(c==="Element"||c==="BackboneElement")&&(c=n.type[0].code),Array.isArray(s)?s.map(m=>LT(m,c)):LT(s,c)}function LT(e,t){return t==="Resource"&&La(e)&&(t=e.resourceType),{type:t,value:e}}function Ef(e,t){const n=e.value;if(!n||typeof n!="object")return;let r;if(t in n){const o=n[t];Array.isArray(o)?r=o.map(mi):r=mi(o)}else{const o=t.endsWith("[x]")?t.substring(0,t.length-3):t;for(const s of Object.values(ie)){const c=o+Kn(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||Dn(r[0]))return}else if(Dn(r))return;return r}function uk(e){const t=[];for(const n of e){let r=!1;for(const o of t)if(Oo(qm(n,o))){r=!0;break}r||t.push(n)}return t}function SB(e){return Je(!Oo(e))}function jB(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Je(!1):Je(e.every((n,r)=>Oo(qm(n,t[r]))))}function wB(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Je(!0):Je(e.some((n,r)=>!Oo(qm(n,t[r]))))}function qm(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):zi(n)&&zi(r)?Je(gk(n,r)):Je(typeof n=="object"&&typeof r=="object"?dS(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)=>Oo(CB(n,t[r])))))}function CB(e,t){const{type:n,value:r}=e,{type:o,value:s}=t,c=r?.valueOf(),u=s?.valueOf();return typeof c=="number"&&typeof u=="number"?Je(Math.abs(c-u)<.01):zi(c)&&zi(u)?Je(gk(c,u)):Je(n==="Coding"&&o==="Coding"?typeof c!="object"||typeof u!="object"?!1:c.code===u.code&&c.system===u.system:typeof c=="object"&&typeof u=="object"?dS({...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 Hd(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return pk(n);case"Quantity":return zi(n);default:return e.type===r||typeof n=="object"&&n?.resourceType===r}}function hk(e){return typeof e=="string"&&!!lk.date.exec(e)}function Hd(e){return typeof e=="string"&&!!lk.dateTime.exec(e)}function pk(e){return!!(e&&typeof e=="object"&&("start"in e&&Hd(e.start)||"end"in e&&Hd(e.end)))}function mk(e){if(e){if(hk(e)||Hd(e))return{start:sp(e,"0000-01-01T00:00:00.000"),end:sp(e,"xxxx-12-31T23:59:59.999")};if(pk(e))return{start:e.start?sp(e.start,"0000-01-01T00:00:00.000"):void 0,end:e.end?sp(e.end,"xxxx-12-31T23:59:59.999"):void 0}}}function sp(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 o=e+t.substring(e.length)+n;return new Date(o).toISOString()}function zi(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 dS(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o],c=t[o];if(zT(s)&&zT(c)){if(!dS(s,c))return!1}else if(s!==c)return!1}return!0}function zT(e){return e!==null&&typeof e=="object"}function tx(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return EB(e??{},t)}return e}function EB(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function vk(e,t){return La(e,t)&&"id"in e&&typeof e.id=="string"}function rn(e){const t=Ut(e)??"undefined/undefined",n=Ra(e);return n===t?{reference:t}:{reference:t,display:n}}function Ut(e){if(Ia(e))return e.reference;if(vk(e))return`${e.resourceType}/${e.id}`}function ws(e){if(e)return Ia(e)?e.reference.split("/")[1]:e.id}function TB(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function Ra(e){if(TB(e)){const t=RB(e);if(t)return t}if(e.resourceType==="Device"){const t=_B(e);if(t)return t}if(e.resourceType==="MedicationRequest"&&e.medicationCodeableConcept)return Cs(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 Cs(t);if(zB(t))return t.text}return Ut(e)??""}function RB(e){const t=e.name;if(t&&t.length>0)return Ma(t[0])}function _B(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function DB(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 o=n.getUTCFullYear(),s=n.getUTCMonth(),c=n.getUTCDate(),u=r.getUTCFullYear(),f=r.getUTCMonth(),h=r.getUTCDate();let m=u-o;(f<s||f===s&&h<c)&&m--;let g=u*12+f-(o*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 AB(e,t){const{years:n,months:r,days:o}=yk(e,t);return n>=2?n.toString().padStart(3,"0")+"Y":r>=1?r.toString().padStart(3,"0")+"M":o.toString().padStart(3,"0")+"D"}function vo(e,...t){let n=e;for(let r=0;r<t.length&&n;r++)n=n?.extension?.find(o=>o.url===t[r]);return n}function mo(e,t){const n=fS(e);return JSON.stringify(n,null,t?2:void 0)??""}function fS(e){if(!(e==null||e===""))return typeof e=="object"?Array.isArray(e)?kB(e):PB(e):e}function kB(e){const t=e.length;if(t===0)return;let n,r=0;for(let o=0;o<t;o++){const s=e[o],c=fS(s);c!==s&&!n&&(n=Array.from(e)),c===void 0?n&&(n[o]=null):(n&&(n[o]=c),r++)}if(r!==0)return n??e}function PB(e){let t,n=0;for(const r in e){const o=e[r],s=fS(o);s!==o&&!t&&(t={...e}),s===void 0?t&&delete t[r]:(t&&(t[r]=s),n++)}if(n!==0)return t??e}function Dn(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!zn(e):!1}function zn(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 NB(e){if(!e)return;let t=e.length-1;for(;t>=0&&Dn(e[t]);)t--;return t>=0?e.slice(0,t+1):void 0}function Ui(e,t,n){return e===t||Dn(e)&&Dn(t)?!0:Dn(e)||Dn(t)?!1:Array.isArray(e)&&Array.isArray(t)?OB(e,t):Array.isArray(e)||Array.isArray(t)?!1:fr(e)&&fr(t)?MB(e,t,n):(fr(e)||fr(t),!1)}function OB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Ui(e[n],t[n]))return!1;return!0}function MB(e,t,n){const r=new Set;for(const o of Object.keys(e))r.add(o);for(const o of Object.keys(t))r.add(o);n==="meta"&&(r.delete("versionId"),r.delete("lastUpdated"),r.delete("author"));for(const o of r){const s=e[o],c=t[o];if(!Ui(s,c,o))return!1}return!0}function hS(e,t){return Dn(e)?!0:Dn(t)?!1:Array.isArray(e)&&Array.isArray(t)?LB(e,t):Array.isArray(e)||Array.isArray(t)?!1:fr(e)&&fr(t)?IB(e,t):fr(e)||fr(t)?!1:e===t}function LB(e,t){return t.every(n=>e.some(r=>hS(r,n)))}function IB(e,t){return Object.entries(t).every(([n,r])=>n in e&&hS(e[n],r))}function gi(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function pS(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 fr(e){return e!==null&&typeof e=="object"}function xk(e){return typeof e=="string"}function bk(e){return fr(e)&&"code"in e&&typeof e.code=="string"}function Sk(e){return fr(e)&&"coding"in e&&Array.isArray(e.coding)&&e.coding.every(bk)}function zB(e){return fr(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 $B(e){const t=wk(e),n=new Uint8Array(t),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=jk[n[o]];return r.join("")}function UB(e){const t=wk(e),n=new Uint8Array(t),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=String.fromCodePoint(n[o]);return window.btoa(r.join(""))}function wk(e){return ArrayBuffer.isView(e)?e.buffer:e}function Kn(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function mS(e){return e.length>0&&e.startsWith(e[0].toUpperCase())}function vl(e,t){const n=e+".";if(t.startsWith(n))return t.slice(n.length)}function BB(e,t){return e.coding?.find(n=>n.system===t)?.code}function VB(e){if(e!==void 0)return Array.isArray(e)?e:[e]}const UT=(e,t)=>new Promise((n,r)=>{t?.signal?.throwIfAborted();const o=setTimeout(n,e);t?.signal?.addEventListener("abort",()=>{clearTimeout(o),r(t.signal?.reason)},{once:!0})});function Qx(e,t,n){const r=[];for(let o=0;o<n-1;o++){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 FB(e){let t,n=!1;return function(){return n||(t=e(),n=!0),t}}function fl(e,t){return e?(e.push(t),e):[t]}function ru(e){return e.sort((t,n)=>t.localeCompare(n))}function gS(e){return e.endsWith("/")?e:e+"/"}function HB(e){return e.startsWith("/")?e.slice(1):e}function Ni(e,t){return new URL(HB(t),gS(e.toString())).toString()}function qB(e,t){return Ni(e,t).toString().replace("http://","ws://").replace("https://","wss://")}function GB(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 WB(e,t){if(e?.meta?.profile?.includes(t)){const n=e.meta.profile.indexOf(t);e.meta.profile.splice(n,1)}return e}const wr=Object.freeze([]);function Rl(e){if(!e)return"";switch(e.type){case"Address":return Ek(e.value);case"CodeableConcept":return Cs(e.value);case"Coding":return Tf(e.value);case"ContactPoint":return e.value.value;case"HumanName":return Ma(e.value);case"Quantity":return yl(e.value);case"Reference":return QB(e.value);default:return e.value?.toString()??""}}function QB(e){return e?e.display??e.reference??mo(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 Ma(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=Gd(e.text);if(r)return r}return n.join(" ").trim()}function Gm(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Tk(e,t,n){if(!e)return"";const[r=0,o=0,s=0]=e.split(":").map(Number),c=new Date(Date.UTC(1970,0,1,r,o,s));return Gm(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 Gm(r)?r.toLocaleString(t,n):""}function YB(e,t,n){return!e||!e.start&&!e.end?"":Nr(e.start,t,n)+" - "+Nr(e.end,t,n)}const KB={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},XB={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},JB={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function Rk(e){if(!e)return"";const t=[];return ZB(t,e.repeat),e.event&&t.push(e.event.map(n=>Nr(n)).join(", ")),Kn(t.join(" ").trim())}function ZB(e,t){if(!t?.periodUnit)return;const n=t.frequency??1,r=t.period??1,o=t.periodUnit;n===1&&r===1?e.push(KB[o]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+XB[o]):e.push("per "+r+" "+JB[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(Kn).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(s=>Tk(s)).join(", "))}function qd(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},o=e?.high&&{...e.high,comparator:void 0};return r?.value===void 0&&o?.value===void 0?"":r?.value!==void 0&&o?.value===void 0?`>= ${yl(r)}`:r?.value===void 0&&o?.value!==void 0?`<= ${yl(o)}`:(r?.unit===o?.unit&&delete r?.unit,`${yl(r)} - ${yl(o)}`)}function yl(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 eV(e){return e?.value===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function Cs(e){if(!e)return"";const t=Gd(e.text);return t||(e.coding?e.coding.map(n=>Tf(n)).join(", "):"")}function Tf(e,t){const n=Gd(e?.display);return n?`${n}`:Gd(e?.code)??""}function _k(e){if(!e)return"";const t=[];if(e.valueQuantity)t.push(yl(e.valueQuantity));else if(e.valueCodeableConcept)t.push(Cs(e.valueCodeableConcept));else{const n=Gd(e.valueString);n&&t.push(n)}return"component"in e&&t.push(e.component.map(n=>_k(n)).join(" / ")),t.join(" / ").trim()}function Gd(e){return typeof e=="string"?e:void 0}const ie={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 tV(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=Fo.types[e];return t||(t={searchParamsDetails:{}},Fo.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 nV(e){for(const t of e.base??wr){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"?rV((e.base?.path??e.path)?.split(".")):t}function rV(e){return e.length===1?e[0]:e.map(Kn).join("")}function vS(e){return Fo.types[e]?.searchParams}function iV(e,t){return Fo.types[e]?.searchParams?.[t]}function _l(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(aV).join(" ").replace("_"," ").replaceAll(/\s+/g," ")}const oV=new Set(["CDS","ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function aV(e){const t=e.toUpperCase();return e===t?e:oV.has(t)?t:t.charAt(0)+e.slice(1)}function Ms(e,t,n){const r=Hm(e,n);if(r)return sV(r.elements,t)}function sV(e,t){const n=e[t]??e[t+"[x]"];if(n)return n;for(let r=0;r<t.length;r++){const o=t[r];if(o>="A"&&o<="Z"){const s=t.slice(0,r)+"[x]",c=e[s];if(c)return c}}}function La(e,t){return!(!e||typeof e!="object"||!("resourceType"in e)||t&&e.resourceType!==t)}function Ia(e,t){return!!(e&&typeof e=="object"&&"reference"in e&&typeof e.reference=="string")}const Fo={types:{}};function wp(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 ga=()=>[],Yr={empty:(e,t)=>Je(t.every(n=>Dn(n.value))),hasValue:(e,t)=>Je(t.length!==0),exists:(e,t,n)=>Je(n?t.some(r=>Oo(n.eval(e,[r]))):t.length>0&&t.every(r=>!Dn(r.value))),all:(e,t,n)=>Je(t.every(r=>Oo(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,al(e));return r.length===0?Je(!1):Je(t.every(o=>r.some(s=>s.value===o.value)))},supersetOf:(e,t,n)=>{const r=n.eval(e,al(e));return r.length===0?Je(!0):t.length===0?Je(!1):Je(r.every(o=>t.some(s=>s.value===o.value)))},count:(e,t)=>[{type:ie.integer,value:t.length}],distinct:(e,t)=>{const n=[];for(const r of t)n.some(o=>o.value===r.value)||n.push(r);return n},isDistinct:(e,t)=>Je(t.length===Yr.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>Oo(n.eval(e,[r]))),select:(e,t,n)=>t.flatMap(r=>n.eval({parent:e,variables:{$this:r}},[r])),repeat:ga,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,al(e)),o=[];for(const s of t)!o.some(c=>c.value===s.value)&&r.some(c=>c.value===s.value)&&o.push(s);return o},exclude:(e,t,n)=>{if(!n)return t;const r=n.eval(e,al(e)),o=[];for(const s of t)r.some(c=>c.value===s.value)||o.push(s);return o},union:(e,t,n)=>{if(!n)return t;const r=n.eval(e,al(e));return uk([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,al(e));return[...t,...r]},htmlChecks:(e,t,n)=>[mi(!0)],iif:(e,t,n,r,o)=>{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 Oo(s)?r.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);if(typeof n=="boolean")return[{type:ie.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(Yr.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);return typeof n=="number"?[{type:ie.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:ie.integer,value:Number.parseInt(n,10)}]:typeof n=="boolean"?[{type:ie.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:Je(Yr.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:ie.date,value:wp(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:Je(Yr.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:ie.dateTime,value:wp(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:Je(Yr.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);return typeof n=="number"?[{type:ie.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:ie.decimal,value:Number.parseFloat(n)}]:typeof n=="boolean"?[{type:ie.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:Je(Yr.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);return zi(n)?[{type:ie.Quantity,value:n}]:typeof n=="number"?[{type:ie.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:ie.Quantity,value:{value:Number.parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:ie.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:Je(Yr.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);return n==null?[]:zi(n)?[{type:ie.string,value:`${n.value} '${n.unit}'`}]:[{type:ie.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:Je(Yr.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Do(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:ie.time,value:wp("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:Je(Yr.toTime(e,t).length===1),indexOf:(e,t,n)=>ki((r,o)=>r.indexOf(o),e,t,n),substring:(e,t,n,r)=>ki((o,s,c)=>{const u=s,f=c?u+c:o.length;return u<0||u>=o.length?void 0:o.substring(u,f)},e,t,n,r),startsWith:(e,t,n)=>ki((r,o)=>r.startsWith(o),e,t,n),endsWith:(e,t,n)=>ki((r,o)=>r.endsWith(o),e,t,n),contains:(e,t,n)=>ki((r,o)=>r.includes(o),e,t,n),upper:(e,t)=>ki(n=>n.toUpperCase(),e,t),lower:(e,t)=>ki(n=>n.toLowerCase(),e,t),replace:(e,t,n,r)=>ki((o,s,c)=>o.replaceAll(s,c),e,t,n,r),matches:(e,t,n)=>ki((r,o)=>!!new RegExp(o).exec(r),e,t,n),replaceMatches:(e,t,n,r)=>ki((o,s,c)=>o.replaceAll(new RegExp(s,"g"),c.replaceAll(/\$\{(\w+)\}/g,"$<$1>")),e,t,n,r),length:(e,t)=>ki(n=>n.length,e,t),toChars:(e,t)=>ki(n=>n?n.split(""):void 0,e,t),encode:ga,decode:ga,escape:ga,unescape:ga,trim:ga,split:ga,join:(e,t,n)=>{const r=n?.eval(e,al(e))[0]?.value??"";if(typeof r!="string")throw new TypeError("Separator must be a string.");return[{type:ie.string,value:t.map(o=>o.value?.toString()??"").join(r)}]},abs:(e,t)=>To(Math.abs,e,t),ceiling:(e,t)=>To(Math.ceil,e,t),exp:(e,t)=>To(Math.exp,e,t),floor:(e,t)=>To(Math.floor,e,t),ln:(e,t)=>To(Math.log,e,t),log:(e,t,n)=>To((r,o)=>Math.log(r)/Math.log(o),e,t,n),power:(e,t,n)=>To(Math.pow,e,t,n),round:(e,t,...n)=>To((r,o=0)=>{if(typeof o!="number"||o<0)throw new Error("Invalid precision provided to round()");const s=Math.pow(10,o);return Math.round(r*s)/s},e,t,...n),sqrt:(e,t)=>To(Math.sqrt,e,t),truncate:(e,t)=>To(n=>Math.trunc(n),e,t),children:ga,descendants:ga,trace:(e,t,n)=>t,now:()=>[{type:ie.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:ie.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:ie.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,o)=>{const s=Yr.toDateTime(e,n.eval(e,t));if(s.length===0)throw new Error("Invalid start date");const c=Yr.toDateTime(e,r.eval(e,t));if(c.length===0)throw new Error("Invalid end date");const u=o.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:ie.Quantity,value:{value:f[u],unit:u}}]},is:(e,t,n)=>{let r="";return n instanceof Wd?r=n.name:n instanceof Wm&&(r=n.left.name+"."+n.right.name),r?t.map(o=>({type:ie.boolean,value:fk(o,r)})):[]},not:(e,t)=>Yr.toBoolean(e,t).map(n=>({type:ie.boolean,value:!n.value})),resolve:(e,t)=>t.map(n=>{const r=n.value;let o;if(typeof r=="string")o=r;else if(typeof r=="object"){const s=r;if(s.resource)return mi(s.resource);s.reference?o=s.reference:s.type&&s.identifier&&(o=`${s.type}?identifier=${s.identifier.system}|${s.identifier.value}`)}if(o?.includes("?")){const[s]=o.split("?");return{type:s,value:{resourceType:s}}}if(o?.includes("/")){const[s,c]=o.split("/");return{type:s,value:{resourceType:s,id:c}}}return{type:ie.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:ie.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:ie.BackboneElement,value:{namespace:"System",name:"Integer"}}:La(n)?{type:ie.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:ie.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 o=r.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map(s=>({type:ie.boolean,value:s.value?.resourceType===o}))},getResourceKey:(e,t)=>{const n=t[0].value;return n?.id?[{type:ie.id,value:n.id}]:[]},getReferenceKey:(e,t,n)=>{const r=t[0].value;if(!r?.reference)return[];let o="";return n instanceof Wd&&(o=n.name),o&&!r.reference.startsWith(o+"/")?[]:[{type:ie.id,value:ws(r)}]},extension:(e,t,n)=>{const r=n.eval(e,t)[0].value,o=t?.[0]?.value;if(o){const s=vo(o,r);if(s)return[{type:ie.Extension,value:s}]}return[]}};function ki(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Do(n,1);if(typeof o!="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(o,...s);return c===void 0?[]:Array.isArray(c)?c.map(mi):[mi(c)]}function To(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Do(n,1),s=zi(o),c=s?o.value:o;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?ie.Quantity:n[0].type,h=s?{...o,value:u}:u;return[{type:f,value:h}]}function Do(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 al(e){let t=e;for(;t.parent?.variables.$this;)t=t.parent;return[t.variables.$this]}class yS{original;child;constructor(t,n){this.original=t,this.child=n}eval(t,n){try{if(n.length>0){const r=[];for(const o of n)r.push(this.child.eval({parent:t,variables:{$this:o}},[o]));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 Mc{value;constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class Wd{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(o=>this.evalValue(o)).filter(o=>o?.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 La(n,this.name)?t:sk(t,this.name)}toString(){return this.name}}class lV{eval(){return[]}toString(){return"{}"}}class cV extends F8{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 Vp extends jf{constructor(t,n){super("as",t,n)}eval(t,n){return Yr.ofType(t,this.left.eval(t,n),this.right)}}class ti extends jf{}class oo extends ti{impl;constructor(t,n,r,o){super(t,n,r),this.impl=o}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const o=this.right.eval(t,n);if(o.length!==1)return[];const s=r[0].value,c=o[0].value,u=zi(s)?s.value:s,f=zi(c)?c.value:c,h=this.impl(u,f);return typeof h=="boolean"?Je(h):zi(s)?[{type:ie.Quantity,value:{...s,value:h}}]:[mi(h)]}}class uV extends jf{constructor(t,n){super("&",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n),s=[...r,...o];return s.length>0&&s.every(c=>typeof c.value=="string")?[{type:ie.string,value:s.map(c=>c.value).join("")}]:s}}class dV extends ti{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return Je(r.some(s=>s.value===o[0].value))}}class fV extends ti{constructor(t,n){super("in",t,n)}eval(t,n){const r=Ta(this.left.eval(t,n)),o=this.right.eval(t,n);return r?Je(o.some(s=>qm(r,s)[0].value)):[]}}class Wm extends jf{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 xS extends jf{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return uk([...r,...o])}}class hV extends ti{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return jB(r,o)}}class pV extends ti{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return wB(r,o)}}class mV extends ti{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return dk(r,o)}}class gV extends ti{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return SB(dk(r,o))}}class bS extends ti{constructor(t,n){super("is",t,n)}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const o=this.right.name;return Je(fk(r[0],o))}}class vV extends ti{constructor(t,n){super("and",t,n)}eval(t,n){const r=Ta(this.left.eval(t,n),"boolean"),o=Ta(this.right.eval(t,n),"boolean");return r?.value===!0&&o?.value===!0?Je(!0):r?.value===!1||o?.value===!1?Je(!1):[]}}class yV extends ti{constructor(t,n){super("or",t,n)}eval(t,n){const r=Ta(this.left.eval(t,n),"boolean"),o=Ta(this.right.eval(t,n),"boolean");return r?.value===!1&&o?.value===!1?Je(!1):r?.value||o?.value?Je(!0):[]}}class xV extends ti{constructor(t,n){super("xor",t,n)}eval(t,n){const r=Ta(this.left.eval(t,n),"boolean"),o=Ta(this.right.eval(t,n),"boolean");return!r||!o?[]:Je(r.value!==o.value)}}class bV extends ti{constructor(t,n){super("implies",t,n)}eval(t,n){const r=Ta(this.left.eval(t,n),"boolean"),o=Ta(this.right.eval(t,n),"boolean");return o?.value===!0||r?.value===!1?Je(!0):!r||!o?[]:Je(!1)}}class SS{name;args;constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=Yr[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 jS{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 o=r[0].value;if(typeof o!="number")throw new Error("Invalid indexer expression: should return integer}");const s=this.left.eval(t,n);return o in s?[s[o]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const SV=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"],jV={"'":"'",'"':'"',"`":"`",r:"\r",n:`
54
+ `,t:" ",f:"\f","\\":"\\"};class wV{str;keywords;operators;dateTimeLiterals;symbolRegex;result=[];pos={index:0,line:1,column:0};markStack=[];constructor(t,n,r,o){this.str=t,this.keywords=n,this.operators=r,this.dateTimeLiterals=!!o?.dateTimeLiterals,this.symbolRegex=o?.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 o=this.buildToken(t==="`"?"Symbol":"String",n);return this.advance(),o}consumeChar(t){const n=this.curr();if(n==="\\"){this.advance();const r=this.curr(),o=jV[r];if(o!==void 0)return this.advance(),o;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 o=this.str.substring(t,this.pos.index);return o.endsWith("T")?o=o.substring(0,o.length-1):!o.startsWith("T")&&n&&!r&&(o+="Z"),this.buildToken("DateTime",o)}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()===" "&&CV(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 CV(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&SV.includes(e.value)))}const EV=["true","false"],TV=["!=","!~","<=",">=","{}","->"];function RV(e){return new wV(e,EV,TV).tokenize()}const tn={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},_V={parse(e){const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+e.peek()?.value+"`");return t}},DV={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new jS(t,n)},precedence:tn.Indexer},AV={parse(e,t){if(!(t instanceof Wd))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new SS(t.name,n)},precedence:tn.FunctionCall};function kV(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 PV(){return new H8().registerPrefix("String",{parse:(e,t)=>new Mc({type:ie.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new Mc({type:ie.dateTime,value:wp(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new Mc({type:ie.Quantity,value:kV(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new Mc({type:t.value.includes(".")?ie.decimal:ie.integer,value:Number.parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new Mc({type:ie.boolean,value:!0})}).registerPrefix("false",{parse:()=>new Mc({type:ie.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new Wd(t.value)}).registerPrefix("{}",{parse:()=>new lV}).registerPrefix("(",_V).registerInfix("[",DV).registerInfix("(",AV).prefix("+",tn.UnaryAdd,(e,t)=>new cV("+",t,n=>n)).prefix("-",tn.UnarySubtract,(e,t)=>new oo("-",t,t,(n,r)=>-r)).infixLeft(".",tn.Dot,(e,t,n)=>new Wm(e,n)).infixLeft("/",tn.Divide,(e,t,n)=>new oo("/",e,n,(r,o)=>r/o)).infixLeft("*",tn.Multiply,(e,t,n)=>new oo("*",e,n,(r,o)=>r*o)).infixLeft("+",tn.Add,(e,t,n)=>new oo("+",e,n,(r,o)=>r+o)).infixLeft("-",tn.Subtract,(e,t,n)=>new oo("-",e,n,(r,o)=>r-o)).infixLeft("|",tn.Union,(e,t,n)=>new xS(e,n)).infixLeft("=",tn.Equals,(e,t,n)=>new hV(e,n)).infixLeft("!=",tn.NotEquals,(e,t,n)=>new pV(e,n)).infixLeft("~",tn.Equivalent,(e,t,n)=>new mV(e,n)).infixLeft("!~",tn.NotEquivalent,(e,t,n)=>new gV(e,n)).infixLeft("<",tn.LessThan,(e,t,n)=>new oo("<",e,n,(r,o)=>r<o)).infixLeft("<=",tn.LessThanOrEquals,(e,t,n)=>new oo("<=",e,n,(r,o)=>r<=o)).infixLeft(">",tn.GreaterThan,(e,t,n)=>new oo(">",e,n,(r,o)=>r>o)).infixLeft(">=",tn.GreaterThanOrEquals,(e,t,n)=>new oo(">=",e,n,(r,o)=>r>=o)).infixLeft("&",tn.Ampersand,(e,t,n)=>new uV(e,n)).infixLeft("and",tn.And,(e,t,n)=>new vV(e,n)).infixLeft("as",tn.As,(e,t,n)=>new Vp(e,n)).infixLeft("contains",tn.Contains,(e,t,n)=>new dV(e,n)).infixLeft("div",tn.Divide,(e,t,n)=>new oo("div",e,n,(r,o)=>Math.trunc(r/o))).infixLeft("in",tn.In,(e,t,n)=>new fV(e,n)).infixLeft("is",tn.Is,(e,t,n)=>new bS(e,n)).infixLeft("mod",tn.Modulo,(e,t,n)=>new oo("mod",e,n,(r,o)=>r%o)).infixLeft("or",tn.Or,(e,t,n)=>new yV(e,n)).infixLeft("xor",tn.Xor,(e,t,n)=>new xV(e,n)).infixLeft("implies",tn.Implies,(e,t,n)=>new bV(e,n))}const NV=PV();function wS(e){return new yS(e,NV.construct(RV(e)).consumeAndParse())}function OV(e,t){const n=Array.isArray(t)?t:[t];for(let r=0;r<n.length;r++){const o=n[r];typeof o=="object"&&"type"in o&&"value"in o||(n[r]=mi(n[r]))}return Es(e,n).map(r=>r.value)}function Es(e,t,n={},r=void 0){let o;if(typeof e=="string"){const s=r?.get(e);o=s??wS(e),r&&!s&&r.set(e,o)}else o=e;return o.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 MV(e){const t=[];for(const n of e){const r=mk(n.value);r&&t.push(r)}return t}function LV(e){const t=new Set;for(const n of e){const r=Rl(n);r&&t.add(r)}return Array.from(t)}function IV(e){const t=new Set;for(const n of e){const{value:r}=n;r&&(xk(r)?t.add(r):Ia(r)?t.add(r.reference):vk(r)?t.add(Ut(r)):typeof r.identifier=="object"&&t.add(`identifier:${r.identifier.system}|${r.identifier.value}`))}return Array.from(t)}function zV(e,t={}){const n=[];for(const r of e)$V(t,n,r);return n}function $V(e,t,n){const{type:r,value:o}=n;switch(r){case ie.Identifier:UV(t,e,o);break;case ie.CodeableConcept:BV(t,e,o);break;case ie.Coding:kk(t,e,o);break;case ie.ContactPoint:VV(t,e,o);break;default:Dl(t,e,void 0,o?.toString())}}function UV(e,t,n){n?.type?.text&&Dl(e,t,t.textSearchSystem,n.type.text),Dl(e,t,n?.system,n?.value)}function BV(e,t,n){n?.text&&Dl(e,t,t.textSearchSystem,n.text);for(const r of n?.coding??wr)kk(e,t,r)}function kk(e,t,n){n&&(n.display&&Dl(e,t,t.textSearchSystem,n.display),Dl(e,t,n.system,n.code))}function VV(e,t,n){n&&Dl(e,t,n.system,n.value?.toLocaleLowerCase())}function Dl(e,t,n,r){(n||r)&&!e.some(o=>o.system===n&&o.value===r)&&e.push({system:n,value:r&&t.caseInsensitive?r.toLocaleLowerCase():r})}const Qm=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},CS={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 o;n.includes("/")?o=n.split("/").filter(Boolean).pop():o=n;const s=[];return r&&s.push(...r.entries()),FV(o,s)}function FV(e,t){const n={resourceType:e};for(const[r,o]of t)HV(n,r,o);return n}function HV(e,t,n){let r,o;const s=t.indexOf(":");if(s>=0?(r=t.substring(0,s),o=t.substring(s+1)):(r=t,o=""),r!=="_"){if(r==="_has"||t.includes(".")){e.filters=fl(e.filters,{code:t,operator:fe.EQUALS,value:n});return}switch(r){case"_sort":qV(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);o==="iterate"&&(c.modifier=fe.ITERATE),e.include=fl(e.include,c);break}case"_revinclude":{const c=VT(n);o==="iterate"&&(c.modifier=fe.ITERATE),e.revInclude=fl(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=Fo.types[e.resourceType]?.searchParams?.[r];c?e.filters=fl(e.filters,WV(c,o,n)):e.filters=fl(e.filters,QV(r,o,n))}}}}function qV(e,t){for(const n of t.split(",")){let r,o=!1;n.startsWith("-")?(r=n.substring(1),o=!0):r=n,e.sortRules||(e.sortRules=[]),e.sortRules.push({code:r,descending:o})}}const GV=[fe.MISSING,fe.PRESENT];function WV(e,t,n){if(GV.includes(t))return{code:e.code,operator:t,value:n};switch(e.type){case"number":case"date":case"quantity":{const{operator:r,value:o}=YV(n,t||fe.EQUALS);if(!FT(e,o))throw new dt(Io(`Invalid format for ${e.type} search parameter: ${o}`));return{code:e.code,operator:r,value:o}}case"reference":case"string":case"token":case"uri":if(!FT(e,n))throw new dt(Io(`Invalid format for ${e.type} search parameter: ${n}`));return{code:e.code,operator:KV(t),value:n};default:throw new Error("Unrecognized search parameter type: "+e.type)}}function QV(e,t,n){let r=fe.EQUALS;if(t)r=t;else if(n.length>=2){const o=n.substring(0,2);o in CS&&(n.length===2||n.at(2)?.match(/\d/))&&(r=o,n=n.substring(o.length))}return{code:e,operator:r,value:n}}function YV(e,t){const n=e.substring(0,2),r=CS[n];return r?{operator:r,value:e.substring(2)}:{operator:t,value:e}}function KV(e){return Pk[e]??fe.EQUALS}function VT(e){const t=e.split(":");if(t.includes("*"))throw new dt(Io("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new dt(Io(`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 dt(Io(`Invalid include value '${e}'`))}function FT(e,t){return e.type==="date"?Hd(t):!0}function bs(e){const t=[];e.fields&&t.push("_fields="+e.fields.join(","));for(const n of e.filters??wr)t.push(XV(n));e.sortRules&&e.sortRules.length>0&&t.push(JV(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??wr)t.push(HT("_include",n));for(const n of e.revInclude??wr)t.push(HT("_revinclude",n));return t.length===0?"":(ru(t),"?"+t.join("&"))}function XV(e){const t=e.operator in Pk?":"+e.operator:"",n=e.operator!==fe.EQUALS&&e.operator in CS?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function JV(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 Ym(e){const t=[];let n="",r=!1;for(const o of e)r?(n+=o,r=!1):o==="\\"?r=!0:o===","?(t.push(n),n=""):n+=o;return t.push(n),t}function ZV(e,t){if(t.resourceType!==e.resourceType)return!1;for(const n of t.filters??wr)if(!eF(e,t,n))return!1;return!0}function eF(e,t,n){const r=Fo.types[t.resourceType]?.searchParams?.[n.code];if(!r)return!1;const o=Es(r.expression,[mi(e)]);if(n.operator===fe.MISSING||n.operator===fe.PRESENT)return tF(o,n);switch(r.type){case"reference":return nF(o,n);case"string":case"uri":return oF(o,n);case"token":return rF(o,n);case"date":return sF(o,n);default:return!1}}function tF(e,t){const n=e.length>0;return(t.operator===fe.MISSING&&t.value==="false"||t.operator===fe.PRESENT&&t.value==="true")===n}function nF(e,t){const n=Km(t.operator);if(t.value===""&&e.length===0)return t.operator===fe.EQUALS;const r=IV(e);for(const o of Ym(t.value)){let s=r.includes(o);if(!s&&t.code==="_compartment"&&(s=r.some(c=>c?.endsWith("/"+o))),s)return!n}return n}function rF(e,t){const n=zV(e),r=Ym(t.value),o=Km(t.operator);for(const s of n)for(const c of r)if(iF(s,c))return!o;return o}function iF(e,t){if(t.includes("|")){const[n,r]=t.split("|").map(o=>o.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 oF(e,t){const n=LV(e),r=Ym(t.value),o=Km(t.operator);for(const s of n)for(const c of r)if(aF(s,c))return!o;return o}function aF(e,t){return e.toLowerCase().includes(t.toLowerCase())}function sF(e,t){const n=MV(e),r=Ym(t.value),o=Km(t.operator);for(const s of n)for(const c of r)if(lF(s,t.operator,c))return!o;return o}function lF(e,t,n){if(!e)return!1;const r=mk(n);if(!r)return!1;const o=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 o<u&&s>c;case fe.LESS_THAN:return o<c;case fe.GREATER_THAN:return s>u;case fe.LESS_THAN_OR_EQUALS:return o<=u;case fe.GREATER_THAN_OR_EQUALS:return s>=c;case fe.STARTS_AFTER:return o>u;case fe.ENDS_BEFORE:return s<c;default:return!1}}function Km(e){return e===fe.NOT_EQUALS||e===fe.NOT}const cF={resourceType:"*"},uF=["DomainConfiguration","JsonWebKey","Login"],dF=["UserSecurityRequest","Project","ProjectMembership","User"],xl={READ:"read",VREAD:"vread",UPDATE:"update",HISTORY:"history",SEARCH:"search"},fF=[xl.READ,xl.VREAD,xl.HISTORY,xl.SEARCH];function hF(e,t){return uF.includes(t)?!1:pF(e,xl.UPDATE,t)}function pF(e,t,n){return!!e.resource?.some(r=>Mk(r,n,t))}function Ok(e,t,n){return n?n.resource?.find(r=>mF(e,t,r)):cF}function mF(e,t,n){const r=e.resourceType;return Mk(n,r,t)?r==="Binary"?!0:!(n.compartment&&!e.meta?.compartment?.some(o=>o.reference===n.compartment?.reference)||n.criteria&&!ZV(e,Nk(n.criteria))):!1}function Mk(e,t,n){return e.resourceType!==t&&(e.resourceType!=="*"||dF.includes(t))?!1:e.interaction?e.interaction.includes(n):!e.readonly||fF.includes(n)}function Ao(){return typeof window<"u"}function Lk(){return typeof Buffer<"u"?Buffer:void 0}const nr={assign(e){Ao()&&globalThis.location.assign(e)},reload(){Ao()&&globalThis.location.reload()},getSearch(){return Ao()?globalThis.location.search:""},getPathname(){return Ao()?globalThis.location.pathname:""},getLocation(){return Ao()?globalThis.location.toString():""},getOrigin(){return Ao()?globalThis.location.protocol+"//"+globalThis.location.host+"/":""}};function gF(e){if(Ao()){const n=window.atob(e),r=Uint8Array.from(n,o=>o.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(Ao()){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 vF(e){e=e.padEnd(e.length+(4-e.length%4)%4,"=");const t=e.replaceAll("-","+").replaceAll("_","/");return gF(t)}function GT(){const e=new Uint32Array(28);return crypto.getRandomValues(e),$B(e.buffer)}async function yF(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 o of e.entry??wr){const s=o.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(),o.fullUrl="urn:uuid:"+t[c],delete o.resource?.id)}const n=e.entry,r=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:n?.map(o=>({fullUrl:o.fullUrl,request:{method:"POST",url:o.resource?.resourceType},resource:o.resource}))},(o,s)=>xF(o,s,t),2);return bF(JSON.parse(r))}function xF(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 o=n[r];if(o)return"urn:uuid:"+o}}return t}function bF(e){const t=jF(e),{sorted:n,cycles:r}=SF(t),o={},s=[];for(const u of e.entry??wr)u.fullUrl?o[u.fullUrl]=u:s.push(u);const c=n.map(u=>o[u]);for(const u of r)for(const f of u){const h=o[f],m={...h,request:{...h.request,method:"PUT"}};c.push(m)}return c.push(...s),{...e,entry:c}}const Lc={NotVisited:"NotVisited",Visiting:"Visiting",Visited:"Visited"};function SF(e){const t=[],n={},r=[];for(const s of Object.keys(e))n[s]=Lc.NotVisited;function o(s,c){if(n[s]===Lc.Visited)return!0;if(n[s]===Lc.Visiting){const f=c.lastIndexOf(s);return f!==-1&&r.push(c.slice(f)),!0}n[s]=Lc.Visiting,c.push(s);let u=!1;for(const f of e[s])o(f,c)||(u=!0);return n[s]=Lc.Visited,c.pop(),t.unshift(s),!u}for(const s in e)n[s]===Lc.NotVisited&&o(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(Ia(r)){const o=r.reference;o.startsWith("urn:uuid:")&&t(o)}else $k(r,t)}}function jF(e){const t={};for(const n of e.entry??wr)n.fullUrl&&(t[n.fullUrl]=[]);for(const n of e.entry??wr){const r=n.fullUrl;n.resource&&$k(n.resource,o=>{t[o]&&t[o].push(r)})}return t}const nn={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 wF=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 o=0;o<r.length;o++)if(r[o]===n){r.splice(o,1);return}}}dispatchEvent(t){const n=this.listeners[t.type];for(const r of n??wr)r.call(this,t);return!t.defaultPrevented}removeAllListeners(){this.listeners={}}listenerCount(t){return this.listeners[t]?.length??0}};class Xm{emitter=new wF;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 Yx={"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"},CF=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],ES=["DiagnosticReport-update"];function EF(e){return ES.includes(e)}function TF(e){if(ES.includes(e))throw new dt(Sn(`'context.version' is required for '${e}'.`))}const RF={"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 _F(e){return CF.includes(e)}function Uk(e){return!!e.endpoint}function WT(e){if(!TS(e))throw new dt(Sn("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:n,topic:r,events:o}=e,s={"hub.channel.type":t,"hub.mode":n,"hub.topic":r,"hub.events":o.join(",")};return Uk(e)&&(s.endpoint=e.endpoint),new URLSearchParams(s).toString()}function TS(e){if(typeof e!="object")return!1;const{channelType:t,mode:n,topic:r,events:o}=e;if(!(t&&n&&r&&o)||typeof r!="string"||typeof o!="object"||!Array.isArray(o)||o.length<1||t!=="websocket"||n!=="subscribe"&&n!=="unsubscribe")return!1;for(const s of o)if(!Yx[s])return!1;return!(Uk(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function DF(e,t,n,r){if(typeof t!="object")throw new dt(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 dt(Sn(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new dt(Sn(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const o=r.resourceType;if(o!=="*"){if(!_F(t.resourceType))throw new dt(Sn(`context[${n}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));if(o&&t.resourceType!==o)throw new dt(Sn(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${o}.`))}}function AF(e,t,n,r,o){if(o.set(t.key,(o.get(t.key)??0)+1),r.reference){if(!Ia(t.reference))throw new dt(Sn(`context[${n}] is invalid. Expected key '${t.key}' to be a reference.`))}else DF(e,t.resource,n,r)}function kF(e,t){const n=new Map,r=RF[e];for(let o=0;o<t.length;o++){const s=t[o].key;if(!r[s])throw new dt(Sn(`Key '${s}' not found for event '${e}'. Make sure to add only valid keys.`));AF(e,t[o],o,r[s],n)}for(const[o,s]of Object.entries(r)){if(!(s.optional||n.has(o)))throw new dt(Sn(`Missing required key '${o}' on context for '${e}' event.`));if(!s.manyAllowed&&(n.get(o)??0)>1)throw new dt(Sn(`${n.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function QT(e,t,n,r){if(!(e&&typeof e=="string"))throw new dt(Sn("Must provide a topic."));if(!Yx[t])throw new dt(Sn(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Yx).join(", ")}`));if(typeof n!="object")throw new dt(Sn("context must be a context object or array of context objects."));if(ES.includes(t)&&!r)throw new dt(Sn(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(n)?n:[n];return kF(t,o),{timestamp:new Date().toISOString(),id:Ik(),event:{"hub.topic":e,"hub.event":t,context:o,...r?{"context.versionId":r}:{}}}}class PF extends Xm{subRequest;websocket;constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new dt(Sn("Subscription request should contain an endpoint."));if(!TS(t))throw new dt(Sn("Subscription request failed validation."));const n=new WebSocket(t.endpoint);n.addEventListener("open",()=>{this.dispatchEvent({type:"connect"}),n.addEventListener("message",r=>{const o=JSON.parse(r.data);if(o["hub.topic"])return;const s=o;s.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:s}),n.send(JSON.stringify({id:o?.id,timestamp:new Date().toISOString()})))}),n.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=n}disconnect(){this.websocket.close()}}function NF(e){return JSON.parse(vF(e))}function OF(e){return e.split(".").length===3}function RS(e){const[t,n,r]=e.split(".");return NF(n)}function MF(e){try{return typeof RS(e).login_id=="string"}catch{return!1}}function LF(e){try{const n=RS(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}class IF{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,nn.TEXT)}async delete(t){await this.medplum.delete(`keyvalue/v1/${t}`)}}class ao{[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 zF{storage;prefix="";constructor(t,n=""){this.storage=t??globalThis.localStorage??new $F,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?mo(n):void 0)}}class $F{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 Qc={Event:typeof globalThis.Event<"u"?globalThis.Event:void 0,ErrorEvent:void 0,CloseEvent:void 0};let YT=!1;function UF(){if(typeof globalThis.Event>"u")throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");Qc.Event=globalThis.Event,Qc.ErrorEvent=class extends Event{message;error;constructor(t,n){super("error",n),this.message=t.message,this.error=t}},Qc.CloseEvent=class extends Event{code;reason;wasClean=!0;constructor(t=1e3,n="",r){super("close",r),this.code=t,this.reason=n}}}function BF(e,t){if(!e)throw new Error(t)}function lp(e){return new e.constructor(e.type,e)}const sl={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0};let KT=!1;class ms extends Xm{_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||(UF(),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 ms.CONNECTING}get OPEN(){return ms.OPEN}get CLOSING(){return ms.CLOSING}get CLOSED(){return ms.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?ms.CLOSED:ms.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=sl.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=sl.reconnectionDelayGrowFactor,minReconnectionDelay:n=sl.minReconnectionDelay,maxReconnectionDelay:r=sl.maxReconnectionDelay}=this._options;let o=0;return this._retryCount>0&&(o=n*Math.pow(t,this._retryCount-1),o>r&&(o=r)),this._debug("next delay",o),o}_wait(){return new Promise(t=>{setTimeout(t,this._getNextDelay())})}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:t=sl.maxRetries,connectionTimeout:n=sl.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 Qc.ErrorEvent(Error(r.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new Qc.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(t=1e3,n){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,n),this._handleClose(new Qc.CloseEvent(t,n,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_handleOpen=t=>{this._debug("open event");const{minUptime:n=sl.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),n),BF(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(lp(t))};_handleMessage=t=>{this._debug("message event"),this.onmessage&&this.onmessage(t),this.dispatchEvent(lp(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(lp(t)),this._connect()};_handleClose=t=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(t),this.dispatchEvent(lp(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 VF=5e3,FF=300*1e3,HF=6e4,qF=[WebSocket.CLOSING,WebSocket.CLOSED];class Kx extends Xm{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 GF{criteria;emitter;refCount;subscriptionProps;subscriptionId;token;tokenExpiry;connecting=!1;constructor(t,n){this.criteria=t,this.emitter=new Kx(t),this.refCount=1,this.subscriptionProps=n?{...n}:void 0}clearAttachedSubscription(){this.subscriptionId=void 0,this.token=void 0,this.tokenExpiry=void 0}}class WF{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 dt(Sn("First arg of constructor should be a `MedplumClient`"));let o;try{o=new URL(n).toString()}catch{throw new dt(Sn("Not a valid URL"))}const s=r?.ReconnectingWebSocket?new r.ReconnectingWebSocket(o,void 0,{debug:r?.debug,debugLogger:r?.debugLogger}):new ms(o,void 0,{debug:r?.debug,debugLogger:r?.debugLogger});this.medplum=t,this.ws=s,this.masterSubEmitter=new Kx,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.pingIntervalMs=r?.pingIntervalMs??VF,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 o=r,s=o?.entry?.[0]?.resource;if(s.type==="heartbeat"){this.masterSubEmitter?.dispatchEvent({type:"heartbeat",payload:o});return}if(s.type==="handshake"){const u=ws(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:o});const c=this.criteriaEntriesBySubscriptionId.get(ws(s.subscription));if(!c){console.warn("Received notification for criteria the SubscriptionManager is not listening for");return}c.emitter.dispatchEvent({type:"message",payload:o})}catch(r){console.error(r);const o={type:"error",payload:r};this.masterSubEmitter?.dispatchEvent(o);for(const s of this.getAllCriteriaEmitters())s.dispatchEvent({...o})}}),t.addEventListener("error",()=>{const n={type:"error",payload:new dt(nU(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()},HF)}),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 ${Ut(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`),o=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(!o)throw new dt(Sn("Failed to get token"));if(!s)throw new dt(Sn("Failed to get URL from $get-ws-binding-token"));if(!c)throw new dt(Sn("Failed to get expiration from $get-ws-binding-token"));return[n,o,c]}maybeGetCriteriaEntry(t,n){const r=this.criteriaEntries.get(t);if(r){if(!n)return r.bareCriteria;for(const o of r.criteriaWithProps)if(Ui(n,o.subscriptionProps))return o}}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 o;this.criteriaEntries.has(n)?o=this.criteriaEntries.get(n):(o={criteriaWithProps:[]},this.criteriaEntries.set(n,o)),r?o.criteriaWithProps.push(t):o.bareCriteria=t}removeCriteriaEntry(t){const{criteria:n,subscriptionProps:r,subscriptionId:o,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!Ui(r,f)}):c.bareCriteria=void 0,!c.bareCriteria&&c.criteriaWithProps.length===0&&(this.criteriaEntries.delete(n),this.masterSubEmitter?._removeCriteria(n)),o&&this.criteriaEntriesBySubscriptionId.delete(o),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,o]=await this.getTokenForCriteria(t);t.token=r,t.tokenExpiry=new Date(o).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(qe(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<=FF&&!this.isReconnecting(r)&&this.rebindCriteriaEntry(r).catch(o=>{this.masterSubEmitter?.dispatchEvent({type:"error",payload:o})})}addCriteria(t,n){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(t);const r=this.maybeGetCriteriaEntry(t,n);if(r)return r.refCount+=1,r.emitter;const o=new GF(t,n);return this.addCriteriaEntry(o),this.subscribeToCriteria(o).catch(console.error),o.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 Kx(...Array.from(this.criteriaEntries.keys()))),this.masterSubEmitter}async reconnectIfNeeded(){qF.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.1-6870d38",QF=nn.FHIR_JSON+", */*; q=0.1",YF="https://api.medplum.com/",KF=1e3,XF=6e4,JF=0,ZF=3e5,eH="Binary/",XT={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]},Ic={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"},tH={AccessToken:"urn:ietf:params:oauth:token-type:access_token"},nH={JwtBearer:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"};class Vk extends Xm{options;fetch;createPdfImpl;storage;requestCache;cacheTime;baseUrl;fhirBaseUrl;authorizeUrl;tokenUrl;logoutUrl;fhircastHubUrl;cdsServicesUrl;defaultHeaders;onUnauthenticated;autoBatchTime;autoBatchQueue;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??rH(),this.storage=t?.storage??new zF(void 0,t?.storagePrefix),this.createPdfImpl=t?.createPdf,this.baseUrl=gS(t?.baseUrl??YF),this.fhirBaseUrl=Ni(this.baseUrl,t?.fhirUrlPath??"fhir/R4"),this.authorizeUrl=Ni(this.baseUrl,t?.authorizeUrl??"oauth2/authorize"),this.tokenUrl=Ni(this.baseUrl,t?.tokenUrl??"oauth2/token"),this.logoutUrl=Ni(this.baseUrl,t?.logoutUrl??"oauth2/logout"),this.fhircastHubUrl=Ni(this.baseUrl,t?.fhircastHubUrl??"fhircast/STU3"),this.cdsServicesUrl=Ni(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??ZF,this.logLevel=this.initializeLogLevel(t),this.cacheTime=t?.cacheTime??(Ao()?XF:JF),this.cacheTime>0?this.requestCache=new JA(t?.resourceCacheSize??KF):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(),Ao()&&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=Ni(this.fhirBaseUrl,t);for(const r of this.requestCache?.keys()??wr)(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 o;t.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue&&!n.disableAutoBatch?o=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))}):o=this.request("GET",t,n);const s=new ao(o);return this.setCacheEntry(t,s,n),s}post(t,n,r,o={}){return t=t.toString(),this.setRequestBody(o,n),r&&this.setRequestContentType(o,r),this.invalidateUrl(t),this.request("POST",t,o)}put(t,n,r,o={}){return t=t.toString(),this.setRequestBody(o,n),r&&this.setRequestContentType(o,r),this.invalidateUrl(t),this.request("PUT",t,o)}patch(t,n,r={}){return t=t.toString(),this.setRequestBody(r,n),this.setRequestContentType(r,nn.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:o}=await this.startPkce();return this.post("auth/newuser",{...t,clientId:t.clientId??this.clientId,codeChallengeMethod:r,codeChallenge:o},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(nr.getSearch()).get("code");if(!r){await this.requestAuthorization(t);return}return this.processCode(r)}signOutWithRedirect(){nr.assign(this.logoutUrl)}async signInWithExternalAuth(t,n,r,o,s=!0){let c=o;s&&(c=await this.ensureCodeChallenge(o)),nr.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 o={grant_type:Ic.TokenExchange,subject_token_type:tH.AccessToken,client_id:n,subject_token:t};return r&&(o.membership_id=r),this.fetchTokens(o)}getExternalAuthRedirectUri(t,n,r,o,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",o.scope??"openid profile email"),c.searchParams.set("state",JSON.stringify(o)),s){const{codeChallenge:u,codeChallengeMethod:f}=o;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(Ni(this.fhirBaseUrl,t.join("/")))}fhirSearchUrl(t,n){const r=this.fhirUrl(t);return n&&(r.search=GB(n)),r}search(t,n,r){const o=this.fhirSearchUrl(t,n),s="search-"+o.toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const u=this.getBundle(o,r);return this.setCacheEntry(s,u,r),u}searchOne(t,n,r){const o=this.fhirSearchUrl(t,n);o.searchParams.set("_count","1"),o.searchParams.sort();const s="searchOne-"+o.toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const u=new ao(this.search(t,o.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 ao(this.search(t,n,r).then(ZT));return this.setCacheEntry(s,u,r),u}async*searchResourcePages(t,n,r){let o=this.fhirSearchUrl(t,n);for(;o;){const s=new URL(o).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),o=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,o]=n.split("/");if(!(!r||!o))return this.getCached(r,o)}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 ao(Promise.reject(new Error("Missing reference")));if(r==="system")return new ao(Promise.resolve(XT));const[o,s]=r.split("/");return!o||!s?new ao(Promise.reject(new Error("Invalid reference"))):this.readResource(o,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",o=this.getCacheEntry(r,void 0);if(o)return o.value;const s=new ao((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)nV(f)})());return this.setCacheEntry(r,s,n),s}requestProfileSchema(t,n){if(!n?.expandProfile&&uS(t))return Promise.resolve();const r=t+"-requestSchema"+(n?.expandProfile?"-nested":""),o=this.getCacheEntry(r,void 0);if(o)return o.value;const s=new ao((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,o){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(),o)}readVersion(t,n,r,o){return this.get(this.fhirUrl(t,n,"_history",r),o)}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 o=this.fhirUrl(t.resourceType);this.setRequestHeader(r,"If-None-Exist",n);const s=await this.post(o,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 o=this.fhirSearchUrl(t.resourceType,n);let s=await this.put(o,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,o,s){let c=eR(t,n,r,o);if(c.contentType===nn.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:nn.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,o,s){const c=eR(t,n,r,o),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,o,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")),o&&(f.upload.onprogress=g=>o(g),f.upload.onload=g=>o(g)),f.onload=()=>{f.status>=200&&f.status<300?m(f.response):m(new dt(on(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,o){if(!this.createPdfImpl)throw new Error("PDF creation not enabled");const s=aH(t,n,r,o),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 o=this.getProfile();let s,c;return t.resourceType==="Encounter"&&(s=rn(t),c=t.subject),t.resourceType==="ServiceRequest"&&(s=t.encounter,c=t.subject),t.resourceType==="Patient"&&(c=rn(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[rn(t)],encounter:s,subject:c,sender:o?rn(o):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,o){const s=await this.patch(this.fhirUrl(t,n),r,o);return this.cacheResource(s,o),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,o){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,o)}executeBatch(t,n){return this.post(this.fhirBaseUrl,t,void 0,n)}sendEmail(t,n){return this.post("email/v1/send",t,nn.JSON,n)}graphql(t,n,r,o){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},nn.JSON,o)}readResourceGraph(t,n,r,o){return this.get(`${this.fhirUrl(t,n)}/$graph?graph=${r}`,o)}pushToAgent(t,n,r,o,s,c){const{waitTimeout:u,returnAck:f,...h}=c??{};return this.post(this.fhirUrl("Agent",ws(t),"$push"),{destination:typeof n=="string"?n:Ut(n),body:r,contentType:o,waitForResponse:s,...u!==void 0?{waitTimeout:u}:void 0,...f!==void 0?{returnAck:f}:void 0},nn.FHIR_JSON,h)}getCdsServices(t){return this.get(this.cdsServicesUrl,t)}callCdsService(t,n,r){return this.post(Ni(this.cdsServicesUrl,t),n,nn.JSON,r)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){(!this.sessionDetails?.profile||Ut(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=LF(t),this.medplumServer=MF(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 o=this.sessionDetails?.profile?.id!==r.profile.id;this.sessionDetails=r,o&&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(eH)&&(t=this.fhirUrl(r));let o=n.headers;return o||(o={},n.headers=o),o.Accept||(o.Accept="*/*"),this.addFetchOptionsDefaults(n),(await this.fetchWithRetry(t.toString(),n)).blob()}async createMedia(t,n){const{additionalFields:r,...o}=t,s=await this.createResource({resourceType:"Media",status:"preparation",content:{contentType:t.contentType},...r});o.securityContext||(o.securityContext=rn(s));const c=await this.createAttachment(o,n);return this.updateResource({...s,status:"completed",content:c})}async uploadMedia(t,n,r,o,s){return this.createMedia({data:t,contentType:n,filename:r,additionalFields:o},s)}async createDocumentReference(t,n){const{additionalFields:r,...o}=t,s=await this.createResource({resourceType:"DocumentReference",status:"current",content:[{attachment:{contentType:t.contentType}}],...r});o.securityContext||(o.securityContext=rn(s));const c=await this.createAttachment(o,n);return this.updateResource({...s,content:[{attachment:c}]})}async bulkExport(t="",n,r,o){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(),o)}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 IF(this)),this.keyValueClient}getBundle(t,n){return new ao((async()=>{const r=await this.get(t,n);for(const o of r.entry??wr)this.cacheResource(o.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 ao(Promise.resolve(t)),n)}deleteCacheEntry(t){this.requestCache&&this.requestCache.delete(t)}async request(t,n,r={},o={}){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 dt(eU);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)??o.statusUrl;if(m)return this.pollStatus(m,r,o)}if(s.status>=400)throw new dt(on(f));return f}async parseBody(t,n){let r;if(t.headers.get("content-length")!=="0"){if(n)try{r=await t.json()}catch(o){throw console.error("Error parsing response",t.status,o),o}else r=await t.text();return r}}async fetchWithRetry(t,n){t.startsWith("http")||(t=Ni(this.baseUrl,t));const r=n?.maxRetries??2;for(let o=0;o<=r;o++)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),o>=r||!sH(s))return s;const c=this.getRetryDelay(o),u=n.maxRetryTime??2e3;if(c>u)return s;await UT(c,{signal:n.signal})}catch(s){if(s.message==="Failed to fetch"&&o===0&&this.dispatchEvent({type:"offline"}),s.name==="AbortError"||o===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 o of ru(Object.keys(r)))console.log(`> ${o}: ${r[o]}`)}}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 o=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(!o||Number.isNaN(c)||Number.isNaN(f))throw new Error("Could not parse RateLimit header: "+t);return{name:o,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 o of n)o.remainingUnits||(r=Math.max(r,o.secondsUntilReset*1e3));return r}async pollStatus(t,n,r){const o={...n,method:"GET",body:void 0,redirect:"follow"};if(r.pollCount===void 0)n.headers&&typeof n.headers=="object"&&"Prefer"in n.headers&&(o.headers={...n.headers},delete o.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,o,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 o=t[0];try{o.resolve(await this.request(o.method,Ni(this.fhirBaseUrl,o.url),o.options))}catch(s){o.reject(new dt(on(s)))}return}const n={resourceType:"Bundle",type:"batch",entry:t.map(o=>({request:{method:o.method,url:o.url},resource:o.options.body?JSON.parse(o.options.body):void 0}))},r=await this.post(this.fhirBaseUrl,n);for(let o=0;o<t.length;o++){const s=t[o],c=r.entry?.[o];c?.response?.outcome&&!ek(c.response.outcome)?s.reject(new dt(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",QF,!0),this.options.extendedMode!==!1&&this.setRequestHeader(t,"X-Medplum","extended"),t.body&&this.setRequestHeader(t,"Content-Type",nn.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 o=r.find(([s])=>s.toLowerCase()===n.toLowerCase());return o?o[1]:void 0}else{if(r instanceof Headers)return r.get(n)??void 0;if(fr(r))return r[n]??void 0}else return}setRequestHeader(t,n,r,o=!1){const s=t.headers;s?Array.isArray(s)?(!o||!s.some(([c])=>c.toLowerCase()===n.toLowerCase()))&&s.push([n,r]):s instanceof Headers?(!o||!s.has(n))&&s.set(n,r):fr(s)&&(!o||!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 dt(Vd)}async startPkce(){const t=GT();sessionStorage.setItem("pkceState",t);const n=GT().slice(0,128);sessionStorage.setItem("codeVerifier",n);try{const r=await yF(n);return{codeChallengeMethod:"S256",codeChallenge:UB(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??nr.getOrigin()),r.searchParams.set("code_challenge_method",n.codeChallengeMethod),r.searchParams.set("code_challenge",n.codeChallenge),r.searchParams.set("scope",n.scope??"openid profile"),nr.assign(r.toString())}processCode(t,n){const r={grant_type:Ic.AuthorizationCode,code:t,client_id:n?.clientId??this.clientId??"",redirect_uri:n?.redirectUri??nr.getOrigin()};if(typeof sessionStorage<"u"){const o=sessionStorage.getItem("codeVerifier");o&&(r.code_verifier=o)}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:Ic.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:Ic.ClientCredentials,client_id:t,client_secret:n})}async startJwtBearerLogin(t,n,r){return this.clientId=t,this.fetchTokens({grant_type:Ic.JwtBearer,client_id:t,assertion:n,scope:r})}async startJwtAssertionLogin(t){return this.fetchTokens({grant_type:Ic.ClientCredentials,client_assertion_type:nH.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 dt(Sn("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new dt(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),nn.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!s)throw new Error("Invalid response!");return r.endpoint=s,r}async fhircastUnsubscribe(t){if(!TS(t))throw new dt(Sn("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new dt(Sn("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post(this.fhircastHubUrl,WT(t),nn.FORM_URL_ENCODED)}fhircastConnect(t){return new PF(t)}async fhircastPublish(t,n,r,o){return EF(n)?this.post(this.fhircastHubUrl,QT(t,n,r,o),nn.JSON):(TF(n),this.post(this.fhircastHubUrl,QT(t,n,r),nn.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 Cf(n)?new dt(n):n.error_description?new dt(Io(n.error_description)):new Error(JSON.stringify(n))}catch(n){throw n instanceof dt?(n.message=`Failed to fetch tokens: ${n.message}`,n):new dt(Io("Failed to fetch tokens"),{cause:n})}}async fetchTokens(t){const n=new URLSearchParams(t),r={...this.defaultHeaders,"Content-Type":nn.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 o={method:"POST",headers:r,body:n.toString(),credentials:"include"};let s;try{s=await this.fetchWithRetry(this.tokenUrl,o)}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(OF(n)){const r=RS(n);if(Date.now()>=r.exp*1e3)throw this.clearActiveLogin(),new dt(tU);if(r.cid){if(r.cid!==this.clientId)throw this.clearActiveLogin(),new dt(kT)}else if(this.clientId&&r.client_id!==this.clientId)throw this.clearActiveLogin(),new dt(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)nr.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)?nr.reload():r?this.setAccessToken(r.accessToken,r.refreshToken):this.clear()}})}catch{}}getSubscriptionManager(){return this.subscriptionManager||(this.subscriptionManager=new WF(this,qB(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 rH(){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(Cf(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 iH(e){return fr(e)&&"data"in e&&"contentType"in e}function eR(e,t,n,r){return iH(e)?e:{data:e,filename:t,contentType:n,onProgress:r}}function oH(e){return fr(e)&&"docDefinition"in e}function aH(e,t,n,r){return oH(e)?e:{docDefinition:e,filename:t,tableLayouts:n,fonts:r}}function sH(e){return e.status===429||e.status>=500}function iu({parentContext:e,path:t,elements:n,profileUrl:r,debugMode:o,accessPolicyResource:s}){if(t===e?.path)return;o??=e?.debugMode??!1,s??=e?.accessPolicyResource;let c=lH(t,n,e,!!o);const u=Qx(t,".",2)[1];c=cH(c,s,u),c=uH(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=Qx(g,".",2)[1];if(y){if(!m[y]){const x=Fp(y,s?.hiddenFields);m[y]={hidden:x,readonly:x||Fp(y,s?.readonlyFields)}}return m[y]}}}return{path:t,elements:c,elementsByPath:f,profileUrl:r??e?.profileUrl,debugMode:o,getExtendedProps:h,accessPolicyResource:s}}function lH(e,t,n,r){const o=Object.create(null);if(n)for(const[c,u]of Object.entries(n.elementsByPath)){const f=vl(e,c);f!==void 0&&(o[f]=u)}let s=!1;if(t)for(const[c,u]of Object.entries(t))c in o||(o[c]=u,s=!0);return r&&console.assert(s,"Unnecessary ElementsContext; not using any newly provided elements"),o}function cH(e,t,n){if(!t?.hiddenFields?.length)return e;const r=n?n+".":"";return Object.fromEntries(Object.entries(e).filter(([o])=>!Fp(r+o,t.hiddenFields)))}function uH(e,t,n){if(!t?.readonlyFields?.length)return e;const r=Object.create(null),o=n?n+".":"";for(const[s,c]of Object.entries(e))Fp(o+s,t.readonlyFields)?r[s]={...c,readonly:!0}:r[s]=c;return r}function Fp(e,t){if(!t?.length)return!1;const n=e.split(".");for(let r=1;r<=n.length;r++){const o=n.slice(0,r).join(".");if(t.includes(o))return!0}return!1}function Fk(e){return e.type!==void 0&&e.type.length>0}function dH(e,t,n,r){const o=yB(e,t.path,{profileUrl:r});if(o){const s=n.typeSchema?.elements??n.elements;return o.some(c=>bB(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 o of t){const s={value:e,type:o.typeSchema?.type??o.type?.[0].code};if(n.every(c=>dH(s,c,o,o.typeSchema?.url??r)))return o.name}}class fH{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 o=iu({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(o===void 0)throw new Error("Could not create root elements context");this.elementsContextStack=[o],this.visitor=n}get elementsContext(){return this.elementsContextStack.at(-1)}crawlElement(t,n,r){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema);const o=Object.fromEntries(Object.entries(this.elementsContext.elements).filter(([s])=>s.startsWith(n)));this.crawlElementsImpl(o,r),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlSlice(t,n,r){const o=this.prepareSlices(r.slices,r);if(!zn(o.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(o.slices[0],n.path,o),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=hH(t);for(const o of r)this.crawlElementNode(o,n)}crawlElementNode(t,n){const r=n+"."+t.key;this.visitor.onEnterElement&&this.visitor.onEnterElement(r,t.element,this.elementsContext);for(const o of t.children)this.crawlElementNode(o,n);zn(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=>zn(u.profile))?.profile?.[0];if(zn(c)){const u=yu(c);u&&(s.typeSchema=u)}r.push(s)}return{...n,slices:r}}crawlSlicingImpl(t,n){const r=this.prepareSlices(t.slices,t);for(const o of r.slices)(this.sliceAllowList===void 0||this.sliceAllowList.includes(o))&&this.crawlSliceImpl(o,n,r)}crawlSliceImpl(t,n,r){const o=t.typeSchema;o&&this.visitor.onEnterSchema&&this.visitor.onEnterSchema(o),this.visitor.onEnterSlice&&this.visitor.onEnterSlice(n,t,r);let s;const c=o?.elements??t.elements;zn(c)&&(s=iu({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),o&&this.visitor.onExitSchema&&this.visitor.onExitSchema(o)}}function hH(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 o=Object.entries(e);o.sort((s,c)=>s[0].localeCompare(c[0]));for(const[s,c]of o){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 nx="__sliceName";function pH(e,t){const n=new mH(e,e.resourceType,"resource");return new fH(t,n).crawlResource(),n.getDefaultValue()}function tR(e,t,n){for(const[r,o]of Object.entries(t)){if(n===void 0||n===r){Hp(e,r,o,t);continue}const s=vl(n,r);s!==void 0&&Hp(e,s,o,t)}return e}class mH{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 o=this.value.values,s=this.value.path,c=vl(s,t);if(c===void 0)throw new Error(`Expected ${t} to be prefixed by ${s}`);const u=[];for(const f of o){if(f===void 0)continue;const h=vl(r.path,s),m=Array.isArray(f)?f:[f];for(const g of m){gH(g,c,n,r.elements,h),Hp(g,c,n,r.elements);const y=Jx(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=vl(this.value.path,t);if(s===void 0)throw new Error(`Expected ${t} to be prefixed by ${this.value.path}`);const c=vl(r.path,this.value.path);for(const u of this.value.values){const f=Jx(u,s,r.elements,c);if(Array.isArray(f))for(let h=f.length-1;h>=0;h--){const m=f[h];zn(m)||f.splice(h,1)}Dn(f)&&Xx(u,void 0,s,n)}}onEnterSlice(t,n,r){const o=this.value.values,s=[];for(const c of o)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 o=[];for(const s of t)(s[nx]??Hk(s,[n],r.discriminator,this.schema.url))===n.name&&o.push(s);for(let s=o.length;s<n.min;s++)if(mS(n.type[0].code)){const c=Object.create(null);o.push(c),t.push(c)}return o}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 o=n[r];nx in o&&delete o[nx]}}getDefaultValue(){return this.rootValue}}function gH(e,t,n,r,o){const s=Jx(e,t,r,o);n.min>0&&s===void 0&&mS(n.type[0].code)&&(n.isArray?Xx(e,[Object.create(null)],t,n):Xx(e,Object.create(null),t,n))}function Xx(e,t,n,r){if(n.includes("."))throw new Error("key cannot be nested");let o=n;if(n.includes("[x]")){const s=r.type[0].code;o=n.replace("[x]",Kn(s))}t===void 0?delete e[o]:e[o]=t}function Jx(e,t,n,r){const o=t.split(".");let s=e,c;for(let u=0;u<o.length;u++){let f=o[u];if(f.includes("[x]")){const h=(r?r+".":"")+o.slice(0,u+1).join("."),g=n[h].type[0].code;f=f.replace("[x]",Kn(g))}if(u===o.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(fr(s)){if(s[f]===void 0)return;s=s[f]}else return}return c}function Hp(e,t,n,r){if(!(n.fixed||n.pattern))return e;if(Array.isArray(e))return e.map(u=>Hp(u,t,n,r));e==null&&(e=Object.create(null));const o=e,s=t.split(".");let c=o;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]",Kn(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 o}function qk(e,t){if(Array.isArray(t)&&(Array.isArray(e)||e===void 0))return(e?.length??0)>0?e:gi(t);if(fr(t)&&(fr(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 vH(e){return e.match(/^\((.+)\)\.identifier$/)?.[1]}function yH(e,t){return new yS(e,new Wm(t,new Wd("identifier")))}const _r={BOOLEAN:"BOOLEAN",NUMBER:"NUMBER",QUANTITY:"QUANTITY",TEXT:"TEXT",REFERENCE:"REFERENCE",CANONICAL:"CANONICAL",DATE:"DATE",DATETIME:"DATETIME"};function Jm(e,t){let n=Fo.types[e]?.searchParamsDetails?.[t.code];return n||(n=bH(e,t)),n}function xH(e,t,n){let r=Fo.types[e];r||(r={},Fo.types[e]=r),r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function bH(e,t){const n=t.code,r=t.expression,o=CH(e,r),s={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const f of o){const h=Cp(f),m=FB(()=>h.join("."));h.length===1&&h[0]instanceof ti?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=vH(r);if(f===void 0)throw new Error(`Unexpected expression for derived identifier search parameter: ${r}`);const h=nR(e,f);c=yH(r,h)}else c=nR(e,r);const u={type:wH(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 xH(e,n,u),u}function Gk(e,t,n,r){const o=t[r];if(o instanceof Vp){e.propertyTypes.add(o.right.toString());return}if(o instanceof SS){SH(e,o);return}const s=o.toString(),c=Ms(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 jS&&(u=!0,f++);const h=t[f];if(c.isArray&&!u&&(e.array=!0),f===t.length-1&&h instanceof Vp){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??wr)e.propertyTypes.add(m.code);return}for(const m of c.type??wr){let g=m.code;jH(g)&&(g=c.type[0].code),Gk(e,t,g,f)}}function SH(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 bS){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function jH(e){return e==="Element"||e==="BackboneElement"}function wH(e,t){switch(e.type){case"date":return t.size===1&&t.has(ie.date)?_r.DATE:_r.DATETIME;case"number":return _r.NUMBER;case"quantity":return _r.QUANTITY;case"reference":return t.has(ie.canonical)?_r.CANONICAL:_r.REFERENCE;case"token":return t.size===1&&t.has(ie.boolean)?_r.BOOLEAN:_r.TEXT;default:return _r.TEXT}}function CH(e,t){const n=[],r=wS(t);return qp(e,r.child,n),n}function nR(e,t){const n=[],r=wS(t);if(qp(e,r.child,n),n.length===0)return r;let o=n[0];for(let s=1;s<n.length;s++)o=new xS(o,n[s]);return new yS("<original-not-available>",o)}function qp(e,t,n){t instanceof xS?(qp(e,t.left,n),qp(e,t.right,n)):t.toString().includes(e+".")&&n.push(t)}function Cp(e){if(e instanceof Vp||e instanceof jS)return[Cp(e.left),e].flat();if(e instanceof ti)return[e];if(e instanceof Wm)return[Cp(e.left),Cp(e.right)].flat();if(e instanceof SS){if(e.name==="where"&&!(e.args[0]instanceof bS))return[];if(e.name==="last")return[]}return[e]}const EH="https://meta.medplum.com/releases",rx=new Map;function TH(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 RH(e,t,n){let r=rx.get("latest");if(!r){const o="latest",s=new URL(`${EH}/${o}.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: ${qe(h)}`)}throw new Error(`Received status code ${c.status} while fetching manifest for version 'latest'. Message: ${f}`)}const u=await c.json();TH(u),r=u,rx.set("latest",r),rx.set(r.tag_name.slice(1),r)}return r}async function _H(e){const t=await RH(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 Zm(){return v.useContext(Wk)}function Te(){return Zm().medplum}function xu(){return Zm().navigate}function Rf(){return Zm().profile}const rR=["change","storageInitialized","storageInitFailed","profileRefreshing","profileRefreshed"];function DH(e){const t=e.medplum,n=e.navigate??AH,[r,o]=v.useState({profile:t.getProfile(),loading:t.isLoading()});v.useEffect(()=>{function c(){o(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 AH(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 o=iR.get(t);if(o){const c=new URLSearchParams(new URL(o).search).get("Expires");if(c&&Number.parseInt(c,10)*1e3-5e3>Date.now())return o}return iR.set(t,e),e},[e]),kH=3e3;function PH(e,t,n){const r=Te(),[o,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(()=>{Ui(n?.subscriptionProps,c)||u(n?.subscriptionProps)},[c,n]),v.useEffect(()=>{h.current&&(clearTimeout(h.current),h.current=void 0);let P=!1;return(m.current!==e||!Ui(g.current,c))&&(P=!0),P&&m.current&&r.unsubscribeFromCriteria(m.current,g.current),m.current=e,g.current=c,P&&e?s(r.subscribeToCriteria(e,c)):e||s(void 0),()=>{h.current=setTimeout(()=>{s(void 0),e&&r.unsubscribeFromCriteria(e,c)},kH)}},[r,e,c]);const R=v.useCallback(P=>{y.current?.(P.payload)},[]),E=v.useCallback(()=>{x.current?.()},[]),_=v.useCallback(()=>{S.current?.()},[]),k=v.useCallback(P=>{w.current?.(P.payload.subscriptionId)},[]),L=v.useCallback(P=>{C.current?.(P.payload.subscriptionId)},[]),D=v.useCallback(P=>{T.current?.(P.payload)},[]);v.useEffect(()=>o?(f.current||(o.addEventListener("message",R),o.addEventListener("open",E),o.addEventListener("close",_),o.addEventListener("connect",k),o.addEventListener("disconnect",L),o.addEventListener("error",D),f.current=!0),()=>{f.current=!1,o.removeEventListener("message",R),o.removeEventListener("open",E),o.removeEventListener("close",_),o.removeEventListener("connect",k),o.removeEventListener("disconnect",L),o.removeEventListener("error",D)}):()=>{},[o,R,E,_,k,L,D])}function NH(e){const t=Te(),{resourceType:n,countCriteria:r,subscriptionCriteria:o}=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]),PH(o,()=>{u("reload")}),s}function Wt(e,t){const n=Te(),[r,o]=v.useState(()=>oR(n,e)),s=v.useCallback(c=>{Ui(c,r)||o(c)},[r]);return v.useEffect(()=>{let c=!0;const u=oR(n,e);return!u&&Ia(e)?n.readReference(e).then(f=>{c&&s(f)}).catch(f=>{c&&(s(void 0),t&&t(on(f)))}):s(u),(()=>c=!1)},[n,e,s,t]),r}function oR(e,t){if(t){if(La(t))return t;if(Ia(t))return e.getCachedReference(t)}}const yt={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"},_S=`${Wi}/fhir/StructureDefinition/questionnaire-itemControl`,OH=`${Wi}/fhir/StructureDefinition/questionnaire-referenceFilter`,Zx=`${Wi}/fhir/StructureDefinition/questionnaire-referenceResource`,MH=`${Wi}/fhir/StructureDefinition/questionnaire-validationError`,LH=`${Wi}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression`,IH=`${Wi}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression`,zH=`${Wi}/fhir/StructureDefinition/questionnaire-signatureRequired`,Ep=`${Wi}/fhir/StructureDefinition/questionnaireresponse-signature`,$H=`${Wi}/fhir/StructureDefinition/questionnaire-hidden`;function UH(e){return e.type==="choice"||e.type==="open-choice"}function BH(e,t){if(vo(e,$H)?.valueBoolean===!0)return!1;const r=VH(e,t);return r!==void 0?r:FH(e,t)}function VH(e,t){const n=vo(e,LH);if(t&&n){const r=n.valueExpression?.expression;if(r){const o=mi(t),s=Es(r,[o],{"%resource":o});return Oo(s)}}}function FH(e,t){if(!e.enableWhen)return!0;const n=e.enableBehavior??"any";for(const r of e.enableWhen){const o=Xk(t?.item,r.question);if(r.operator==="exists"&&!r.answerBoolean&&!o?.length){if(n==="any")return!0;continue}const{anyMatch:s,allMatch:c}=YH(r,o,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 o=n?.find(s=>s.linkId===r.linkId);o&&(HH(t,r,o),r.item&&o.item&&Yk(r.item,t,o.item))}}function HH(e,t,n){try{const r=WH(t,e);if(!r)return;const o=GH(t,r);if(!o)return;n.answer=[o]}catch(r){n.extension=[{url:MH,valueString:`Expression evaluation failed: ${qe(r)}`}]}}const qH={[yt.boolean]:[ie.boolean],[yt.date]:[ie.date],[yt.dateTime]:[ie.dateTime],[yt.time]:[ie.time],[yt.url]:[ie.string,ie.uri,ie.url],[yt.attachment]:[ie.Attachment],[yt.reference]:[ie.Reference],[yt.quantity]:[ie.Quantity],[yt.decimal]:[ie.decimal,ie.integer],[yt.integer]:[ie.decimal,ie.integer]};function GH(e,t){if(!e.type)return;if(e.type===yt.choice||e.type===yt.openChoice)return{[`value${Kn(t.type)}`]:t.value};if(e.type===yt.string||e.type===yt.text)return typeof t.value=="string"?{valueString:t.value}:void 0;if(qH[e.type]?.includes(t.type))return{[`value${Kn(e.type)}`]:t.value}}function WH(e,t){if(!t)return;const n=vo(e,IH);if(n){const r=n.valueExpression?.expression;if(r){const o=mi(t),s=Es(r,[o],{"%resource":o});return s.length!==0?s[0]:void 0}}}function Kk(e,t,n){const r=[];for(const o of e){const s=n.answerOption?.find(c=>Rl(Ho(c))===o);if(s){const c=Ho(s);c&&r.push({[t]:c.value})}}return r}function Xk(e,t){for(const n of e??wr){if(n.linkId===t)return n.answer;if(n.item){const r=Xk(n.item,t);if(r)return r}}}function QH(e,t,n){if(n==="exists")return!!e===t.value;if(e){const r=n==="="||n==="!="?n?.replace("=","~"):n,[{value:o}]=Es(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return o}else return!1}function YH(e,t,n){const r=t||[],o=JH(e);let s=!1,c=!0;for(const u of r){const f=ZH(u),{operator:h}=e;if(QH(f,o,h)?s=!0:c=!1,n==="any"&&s)break}return{anyMatch:s,allMatch:c}}function Jk(e){const t=vo(e,Zx);if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return t.valueCodeableConcept?.coding?.map(n=>n.code)}}function ix(e,t){const n=gi(e);let r=vo(n,Zx);return!t||t.length===0?(r&&(n.extension=n.extension?.filter(o=>o!==r)),n):(r||(n.extension??=[],r={url:Zx},n.extension.push(r)),t.length===1?(r.valueCode=t[0],delete r.valueCodeableConcept):(r.valueCodeableConcept={coding:t.map(o=>({code:o}))},delete r.valueCode),n)}function KH(e,t,n){const r=vo(e,OH);if(!r?.valueString)return;let o=r.valueString;t?.reference&&(o=o.replaceAll("$subj",t.reference)),n?.reference&&(o=o.replaceAll("$encounter",n.reference));const s={},c=o.split("&");for(const u of c){const[f,h]=Qx(u,"=",2);s[f]=h}return s}function aR(e,t){return{resourceType:"QuestionnaireResponse",questionnaire:e.url??Ut(e),item:DS(e.item,t?.item),status:"in-progress"}}function DS(e,t){let n;for(const r of e??wr){if(r.type===yt.display)continue;const o=t?.filter(s=>s.linkId===r.linkId);if(o?.length)for(const s of o)s.id=s.id??eP(),s.text=s.text??r.text,s.item=DS(r.item,s.item),s.answer=tP(r,s),n=fl(n,s);else n=fl(n,Zk(r))}return n}function Zk(e){return{id:eP(),linkId:e.linkId,text:e.text,item:DS(e.item,void 0),answer:tP(e)}}let XH=1;function eP(){return"id-"+XH++}function tP(e,t){if(!(e.type===yt.display||e.type===yt.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 AS(e){return Ef({value:e},"value")}function Ho(e){return Ef({value:e},"value")}function JH(e){return Ef({value:e},"answer")}function ZH(e){return Ef({value:e},"value")}function eq(e){const t=Wt(e.questionnaire),n=Wt(e.defaultValue),[,r]=v.useReducer(S=>S+1,0),o=v.useRef({activePage:0});if(!o.current.questionnaire&&t&&(o.current.questionnaire=t,o.current.pages=e.disablePagination?void 0:tq(t)),t&&e.defaultValue&&n&&!o.current.questionnaireResponse&&(o.current.questionnaireResponse=aR(t,n),x()),t&&!e.defaultValue&&!o.current.questionnaireResponse&&(o.current.questionnaireResponse=aR(t),x()),!o.current.questionnaire||!o.current.questionnaireResponse)return{loading:!0};function s(S,w){let C=o.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(){o.current.activePage=(o.current.activePage??0)+1,r()}function u(){o.current.activePage=(o.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=o.current.questionnaireResponse;w&&(S?(w.extension=w.extension??[],w.extension=w.extension.filter(C=>C.url!==Ep),w.extension.push({url:Ep,valueSignature:S})):w.extension=w.extension?.filter(C=>C.url!==Ep),x())}function y(){const S=o.current.questionnaire;if(S?.item){const w=o.current.questionnaireResponse;Yk(S.item,w)}}function x(){const S=o.current.questionnaireResponse;S&&(y(),r(),e.onChange?.(S))}return{loading:!1,pagination:!!o.current.pages,questionnaire:o.current.questionnaire,questionnaireResponse:o.current.questionnaireResponse,subject:e.subject,encounter:e.encounter,activePage:o.current.activePage,pages:o.current.pages,items:nq(o.current.questionnaire,o.current.pages,o.current.activePage),responseItems:rq(o.current.questionnaireResponse,o.current.pages,o.current.activePage),onNextPage:c,onPrevPage:u,onAddGroup:f,onAddAnswer:h,onChangeAnswer:m,onChangeSignature:g}}function tq(e){if(!(!e?.item||vo(e?.item?.[0],_S)?.valueCodeableConcept?.coding?.[0]?.code!=="page"))return e.item.map((n,r)=>({linkId:n.linkId,title:n.text??`Page ${r+1}`,group:n}))}function nq(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function rq(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function iq(e,t,n={leading:!1}){const[r,o]=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,o(e)):(f(),c.current=setTimeout(()=>{u.current=!1,o(e)},t)))},[e,n.leading,t,f]),v.useEffect(()=>(s.current=!0,f),[f]),[r,f]}const oq=250;function aq(e,t,n){return nP("searchOne",e,t)}function ou(e,t,n){return nP("searchResources",e,t)}function nP(e,t,n,r){const o=Te(),[s,c]=v.useState(!0),[u,f]=v.useState(),[h,m]=v.useState(),g=o.fhirSearchUrl(t,n).toString(),y=v.useMemo(()=>({resourceType:t,query:n}),[g]),x=oq,[S]=iq(y,x,{leading:!0});return v.useEffect(()=>{let w=!0;return o[e](S.resourceType,S.query).then(C=>{w&&(c(!1),f(C),m(Z8))}).catch(C=>{w&&(c(!1),f(void 0),m(on(C)))}),()=>{w=!1}},[o,e,S]),[u,s,h]}function sq(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"],vn=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});vn.displayName="ElementsContext";const kS=["extension","modifierExtension"],lq=["id",...rP].filter(e=>!kS.includes(e));function cq(e){return Object.entries(e).filter(([n,r])=>!zn(r.type)||r.max===0||r.path.toLowerCase().endsWith("extension.url")&&r.fixed||kS.includes(n)&&!zn(r.slicing?.slices)||lq.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:NB(r)}}function uq(e){const[t,n]=v.useState(e.defaultValue||{}),r=v.useRef(t);r.current=t;const{getExtendedProps:o}=v.useContext(vn),[s,c,u,f,h,m,g]=v.useMemo(()=>["use","type","line1","line2","city","state","postalCode"].map(_=>o(e.path+"."+_)),[o,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(be,{gap:"xs",wrap:"nowrap",grow:!0,children:[a.jsx(mn,{disabled:e.disabled||s?.readonly,"data-testid":"address-use",defaultValue:t.use,onChange:_=>x(_.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(mn,{disabled:e.disabled||c?.readonly,"data-testid":"address-type",defaultValue:t.type,onChange:_=>S(_.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(He,{disabled:e.disabled||u?.readonly,placeholder:"Line 1",defaultValue:sR(t,0),onChange:_=>w(_.currentTarget.value)}),a.jsx(He,{disabled:e.disabled||f?.readonly,placeholder:"Line 2",defaultValue:sR(t,1),onChange:_=>C(_.currentTarget.value)}),a.jsx(He,{disabled:e.disabled||h?.readonly,placeholder:"City",defaultValue:t.city,onChange:_=>T(_.currentTarget.value)}),a.jsx(He,{disabled:e.disabled||m?.readonly,placeholder:"State",defaultValue:t.state,onChange:_=>R(_.currentTarget.value)}),a.jsx(He,{disabled:e.disabled||g?.readonly,placeholder:"Postal Code",defaultValue:t.postalCode,onChange:_=>E(_.currentTarget.value)})]})}function dq(e){const t=Rf(),[n,r]=v.useState(e.defaultValue||{});function o(s){const c=s?{text:s,authorReference:t&&rn(t),time:new Date().toISOString()}:{};r(c),e.onChange&&e.onChange(c)}return a.jsx(He,{disabled:e.disabled,name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:s=>o(s.currentTarget.value)})}var fq={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 Be=(e,t,n,r)=>{const o=v.forwardRef(({color:s="currentColor",size:c=24,stroke:u=2,title:f,className:h,children:m,...g},y)=>v.createElement("svg",{ref:y,...fq[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 o.displayName=`${n}`,o};const hq=[["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"}]],pq=Be("outline","adjustments-horizontal","AdjustmentsHorizontal",hq);const mq=[["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"}]],Ls=Be("outline","alert-circle","AlertCircle",mq);const gq=[["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"}]],vq=Be("outline","arrow-down","ArrowDown",gq);const yq=[["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"}]],xq=Be("outline","arrow-up","ArrowUp",yq);const bq=[["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"}]],Sq=Be("outline","bleach-off","BleachOff",bq);const jq=[["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"}]],wq=Be("outline","bleach","Bleach",jq);const Cq=[["path",{d:"M18 7v14l-6 -4l-6 4v-14a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4",key:"svg-0"}]],Eq=Be("outline","bookmark","Bookmark",Cq);const Tq=[["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"}]],Rq=Be("outline","box-multiple","BoxMultiple",Tq);const _q=[["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"}]],Dq=Be("outline","brackets-contain","BracketsContain",_q);const Aq=[["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"}]],kq=Be("outline","brand-asana","BrandAsana",Aq);const Pq=[["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"}]],Nq=Be("outline","briefcase","Briefcase",Pq);const Oq=[["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"}]],Mq=Be("outline","bucket-off","BucketOff",Oq);const Lq=[["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"}]],Iq=Be("outline","bucket","Bucket",Lq);const zq=[["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"}]],$q=Be("outline","building","Building",zq);const Uq=[["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"}]],ds=Be("outline","calendar","Calendar",Uq);const Bq=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],Ko=Be("outline","check","Check",Bq);const Vq=[["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"}]],Fq=Be("outline","checkbox","Checkbox",Vq);const Hq=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],PS=Be("outline","chevron-down","ChevronDown",Hq);const qq=[["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"}]],Gq=Be("outline","circle-check","CircleCheck",qq);const Wq=[["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"}]],Gp=Be("outline","circle-minus","CircleMinus",Wq);const Qq=[["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"}]],Qd=Be("outline","circle-plus","CirclePlus",Qq);const Yq=[["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"}]],NS=Be("outline","cloud-upload","CloudUpload",Yq);const Kq=[["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"}]],Xq=Be("outline","columns","Columns",Kq);const Jq=[["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"}]],OS=Be("outline","copy","Copy",Jq);const Zq=[["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"}]],eG=Be("outline","currency-dollar","CurrencyDollar",Zq);const tG=[["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"}]],nG=Be("outline","database","Database",tG);const rG=[["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"}]],iG=Be("outline","device-floppy","DeviceFloppy",rG);const oG=[["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"}]],aG=Be("outline","dots","Dots",oG);const sG=[["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=Be("outline","edit","Edit",sG);const lG=[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]],bu=Be("outline","equal-not","EqualNot",lG);const cG=[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]],Al=Be("outline","equal","Equal",cG);const uG=[["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"}]],dG=Be("outline","eye-off","EyeOff",uG);const fG=[["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"}]],hG=Be("outline","eye","Eye",fG);const pG=[["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=Be("outline","file-alert","FileAlert",pG);const mG=[["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"}]],gG=Be("outline","file-plus","FilePlus",mG);const vG=[["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"}]],yG=Be("outline","filter","Filter",vG);const xG=[["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"}]],bG=Be("outline","folder","Folder",xG);const SG=[["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"}]],jG=Be("outline","forms","Forms",SG);const wG=[["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"}]],CG=Be("outline","id","Id",wG);const EG=[["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"}]],TG=Be("outline","layout-sidebar","LayoutSidebar",EG);const RG=[["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=Be("outline","list-details","ListDetails",RG);const _G=[["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"}]],DG=Be("outline","lock-access","LockAccess",_G);const AG=[["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"}]],kG=Be("outline","lock","Lock",AG);const PG=[["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"}]],NG=Be("outline","logout","Logout",PG);const OG=[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]],aP=Be("outline","math-greater","MathGreater",OG);const MG=[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]],sP=Be("outline","math-lower","MathLower",MG);const LG=[["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"}]],IG=Be("outline","message","Message",LG);const zG=[["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"}]],$G=Be("outline","microscope","Microscope",zG);const UG=[["path",{d:"M5 12l14 0",key:"svg-0"}]],BG=Be("outline","minus","Minus",UG);const VG=[["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"}]],FG=Be("outline","packages","Packages",VG);const HG=[["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"}]],qG=Be("outline","pencil","Pencil",HG);const GG=[["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"}]],WG=Be("outline","pin","Pin",GG);const QG=[["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"}]],YG=Be("outline","pinned-off","PinnedOff",QG);const KG=[["path",{d:"M7 4v16l13 -8l-13 -8",key:"svg-0"}]],XG=Be("outline","player-play","PlayerPlay",KG);const JG=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],ZG=Be("outline","plus","Plus",JG);const eW=[["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"}]],tW=Be("outline","receipt","Receipt",eW);const nW=[["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=Be("outline","refresh","Refresh",nW);const rW=[["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"}]],iW=Be("outline","repeat","Repeat",rW);const oW=[["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"}]],aW=Be("outline","report-medical","ReportMedical",oW);const sW=[["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"}]],lW=Be("outline","router","Router",sW);const cW=[["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"}]],eg=Be("outline","search","Search",cW);const uW=[["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"}]],eb=Be("outline","settings","Settings",uW);const dW=[["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"}]],MS=Be("outline","sort-ascending","SortAscending",dW);const fW=[["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"}]],LS=Be("outline","sort-descending","SortDescending",fW);const hW=[["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"}]],pW=Be("outline","square","Square",hW);const mW=[["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"}]],gW=Be("outline","star","Star",mW);const vW=[["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"}]],yW=Be("outline","switch-horizontal","SwitchHorizontal",vW);const xW=[["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"}]],bW=Be("outline","table-export","TableExport",xW);const SW=[["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"}]],jW=Be("outline","text-recognition","TextRecognition",SW);const wW=[["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"}]],tg=Be("outline","trash","Trash",wW);const CW=[["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=Be("outline","upload","Upload",CW);const EW=[["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"}]],TW=Be("outline","user-plus","UserPlus",EW);const RW=[["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"}]],_W=Be("outline","webhook","Webhook",RW);const DW=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],Ts=Be("outline","x","X",DW);const AW=[["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"}]],kW=Be("filled","circle-filled","CircleFilled",AW);class IS extends v.Component{state;constructor(t){super(t),this.state={lastLocation:nr.getLocation()}}static getDerivedStateFromError(t){return{error:t,lastLocation:nr.getLocation()}}componentDidUpdate(t,n){nr.getLocation()!==this.state.lastLocation&&this.setState({lastLocation:nr.getLocation(),error:void 0})}shouldComponentUpdate(t,n){return!!(this.props.children!==t.children||n.error&&!this.state.error||this.state.lastLocation!==nr.getLocation())}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.error?a.jsx(Yo,{icon:a.jsx(Ls,{size:16}),title:"Something went wrong",color:"red",children:qe(this.state.error)}):this.props.children}}function Bi(){return a.jsx(No,{style:{width:"100%",height:"100vh"},children:a.jsx(Pr,{})})}const PW="_main_6f7o5_1",NW={main:PW};function jn(e){e.preventDefault(),e.stopPropagation()}function zS(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 Ad(e,t){return new Promise((n,r)=>{const o=new MessageChannel;o.port1.onmessage=({data:s})=>{o.port1.close(),s.error?r(s.error):n(s.result)},e.contentWindow?.postMessage(t,new URL(e.src).origin,[o.port2])})}function uP(e,t){const n=new Blob([e],{type:nn.JSON}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r;const s=t??new Date().toISOString().replaceAll(/\D/g,"");o.download=`${s}.json`,document.body.appendChild(o),o.click(),URL.revokeObjectURL(r)}function Ct(e){const t=xu(),{to:n,suffix:r,label:o,onClick:s,children:c,...u}=e;let f=OW(n);return r&&(f+="/"+r),a.jsx(Tt,{href:f,"aria-label":o,onAuxClick:h=>{h.stopPropagation()},onClick:h=>{h.stopPropagation(),s?(h.preventDefault(),s(h)):n&&(zS(h)||(h.preventDefault(),t(f)))},...u,children:c})}function OW(e){if(e){if(typeof e=="string")return MW(e);if(La(e))return LW(e);if(Ia(e))return IW(e)}return"#"}function MW(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function LW(e){return`/${e.resourceType}/${e.id}`}function IW(e){return`/${e.reference}`}function zW(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 yo(e){const t=Wt(e.value),n=t?Ra(t):e.alt??"",r=zW(n),o=(t&&DB(t))??e.src,s=Qk(o??void 0),c=e.radius??"xl",u={...e,value:void 0,link:void 0};return e.link?a.jsx(Ct,{to:t,children:a.jsx(tu,{src:s,alt:n,radius:c,...u,children:r})}):a.jsx(tu,{src:s,alt:n,radius:c,...u,children:r})}const $W="_logoButton_799cf_1",UW="_user_799cf_11",BW="_userName_799cf_25",ox={logoButton:$W,user:UW,userName:BW};function $S(e){const t=e.value;return t?a.jsx(a.Fragment,{children:Ma(t,e.options)}):null}function dP(){return"Medplum"}function fP(e){const t=Zm(),{medplum:n,profile:r,navigate:o}=t,s=n.getLogins(),{colorScheme:c,setColorScheme:u}=z5(),[f]=v.useState(localStorage.appShellLayoutVersion??"v1"),h=e.showLayoutVersionToggle??!0;function m(g){localStorage.appShellLayoutVersion=g,nr.reload()}return a.jsxs(a.Fragment,{children:[a.jsxs(Pe,{align:"center",p:"xl",children:[a.jsx(yo,{size:"xl",radius:100,value:t.profile}),a.jsx($S,{value:t.profile?.name?.[0]}),a.jsx(ge,{c:"dimmed",size:"xs",children:n.getActiveLogin()?.project.display})]}),s.length>1&&a.jsx(Se.Divider,{}),s.map(g=>g.profile.reference!==Ut(t.profile)&&a.jsx(Se.Item,{onClick:()=>{n.setActiveLogin(g).then(()=>nr.reload()).catch(console.log)},children:a.jsxs(be,{children:[a.jsx(tu,{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(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(yW,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Switch to another project"}),a.jsx(Se.Divider,{}),a.jsxs(be,{justify:"center",children:[a.jsx(Tl,{size:"xs",value:c,onChange:g=>u(g),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]}),h&&a.jsx(Tl,{size:"xs",value:f,onChange:g=>m(g),data:[{label:"v1",value:"v1"},{label:"v2",value:"v2"}]})]}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(eb,{size:14,stroke:1.5}),onClick:()=>o(`/${Ut(r)}`),children:"Account settings"}),a.jsx(Se.Item,{leftSection:a.jsx(NG,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),o("/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 US(e){const t=Bl({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{name:n,label:r,description:o,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:k=0,...L}=e,D=L.disabled,P=VW(c),[$,U]=v.useState(""),[W,Y]=v.useState(),[ee,B]=v.useState(),[G,M]=v.useState(),[I,z]=v.useState(P.map(u)),[V,K]=v.useState([]),O=h??FW,F=m??HW,se=g??qW,de=v.useRef($);de.current=$;const xe=v.useRef(void 0),Ce=v.useRef(void 0),we=v.useRef(W);we.current=W;const Ye=v.useRef(ee);Ye.current=ee;const De=v.useRef(G);De.current=G;const ht=v.useRef(V);ht.current=V;const Rt=v.useCallback(()=>{if(Y(void 0),de.current===Ce.current&&f===xe.current||(de.current?.length??0)<k)return;Ce.current=de.current,xe.current=f;const Ie=new AbortController;B(Ie),f(de.current??"",Ie.signal).then(it=>{Ie.signal.aborted||(K(it.map(u)),De.current?(it.length>0&&y(it.slice(0,1)),M(!1)):it.length>0&&t.openDropdown())}).catch(it=>{Ie.signal.aborted||it.message.includes("aborted")||_e({color:"red",message:qe(it)})}).finally(()=>{Ie.signal.aborted||B(void 0)})},[t,f,y,u,k]),at=v.useCallback(Ie=>{(V&&V.length>0||S)&&t.openDropdown(),t.updateSelectedOptionIndex(),U(Ie.currentTarget.value),Ye.current&&(Ye.current.abort(),B(void 0)),we.current!==void 0&&window.clearTimeout(we.current);const it=window.setTimeout(()=>Rt(),100);Y(it)},[t,V,S,Rt]),Ze=v.useCallback(Ie=>{const it=I.some(lt=>lt.value===Ie),et=it?I.filter(lt=>lt.value!==Ie):[...I];let ft=V?.find(lt=>lt.value===Ie);if(!ft&&S!==!1&&x){const lt=x(Ie);ft=u(lt)}if(ft){if(E===0){y([ft.resource]),I.length>0&&z([]);return}it||et.push(ft)}if(E!==void 0)for(;et.length>E;)et.shift();y(et.map(lt=>lt.resource)),z(et)},[S,V,I,E,y,x,u]),mt=v.useMemo(()=>{if(!D)return Ie=>{D||(E===1&&(U(""),K([]),t.closeDropdown()),Ce.current=void 0,Ie==="$create"?(U(""),Ze($)):Ze(Ie))}},[Ze,t,D,E,$]),Dt=v.useCallback(Ie=>{const it=I.filter(et=>et.value!==Ie.value);y(it.map(et=>et.resource)),z(it)},[I,y]),jt=v.useCallback(Ie=>{Ie.key==="Enter"?(W||ee)&&M(!0):Ie.key==="Backspace"&&$.length===0&&(jn(Ie),Dt(I[I.length-1]))},[ee,Dt,$.length,I,W]);v.useEffect(()=>()=>{Ye.current&&Ye.current.abort()},[]);const Ae=!D&&w&&I.length>0&&a.jsx(Qe.ClearButton,{title:"Clear all",size:"sm",onClear:()=>{U(""),z([]),y([]),t.closeDropdown()}}),Ne=S&&$.trim().length>0,Me=V.length>0||Ne;return a.jsxs(Qe,{store:t,onOptionSubmit:mt,withinPortal:!0,shadow:"xl",...L,children:[a.jsx(Qe.DropdownTarget,{children:a.jsx(js,{label:r,description:o,error:s,className:e.className,leftSection:R,rightSection:ee?a.jsx(Pr,{size:16}):Ae,required:C,disabled:D,children:a.jsxs(Ea.Group,{"data-testid":hR.selectedItems,children:[I.map(Ie=>a.jsx(F,{item:Ie,disabled:D,onRemove:()=>Dt(Ie)},Ie.value)),!D&&(E===void 0||E===0||I.length<E)&&a.jsx(Qe.EventsTarget,{children:a.jsx(js.Field,{role:"searchbox",name:n,value:$,placeholder:T,onFocus:at,onBlur:()=>{t.closeDropdown(),U("")},onKeyDown:jt,onChange:at})})]})})}),a.jsx(Qe.Dropdown,{hidden:!Me,"data-testid":hR.options,children:a.jsx(Qe.Options,{children:a.jsxs(ym,{type:"scroll",mah:_,children:[V.map(Ie=>{const it=I.some(et=>et.value===Ie.value);return a.jsx(Qe.Option,{value:Ie.value,active:it,children:a.jsx(O,{...Ie,active:it})},Ie.value)}),Ne&&a.jsxs(Qe.Option,{value:"$create",children:["+ Create ",$]}),!S&&$.trim().length>0&&V.length===0&&a.jsx(se,{search:$})]})})})]})}function VW(e){return e?Array.isArray(e)?e:[e]:[]}function FW(e){return a.jsxs(be,{gap:"xs",children:[e.active&&a.jsx(Ko,{size:12}),a.jsx("span",{children:e.label})]})}function HW({item:e,disabled:t,onRemove:n}){return a.jsx(Ea,{withRemoveButton:!t,onRemove:n,children:e.label})}function qW(){return a.jsx(Qe.Empty,{children:"Nothing found"})}const GW="_searchInput_dick8_1",WW={searchInput:GW};function QW(e){return{value:e.id,label:Ra(e),resource:e}}function YW(e){const t=xu(),n=Te(),r=v.useCallback(async(s,c)=>{const u=XW(s),f={signal:c},h=await n.graphql(u,void 0,void 0,f);return JW(h,s)},[n]),o=v.useCallback(s=>{s.length>0&&t(`/${Ut(s[0])}`)},[t]);return a.jsx(US,{size:"sm",radius:"md",className:WW.searchInput,leftSection:a.jsx(eg,{size:16}),placeholder:"Search",itemComponent:KW,toOption:QW,onChange:o,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const KW=v.forwardRef(({resource:e,active:t,...n},r)=>{let o;return e.resourceType==="Patient"?o=e.birthDate:e.resourceType==="ServiceRequest"&&(o=e.subject?.display),a.jsx("div",{ref:r,...n,children:a.jsxs(be,{wrap:"nowrap",children:[a.jsx(yo,{value:e}),a.jsxs("div",{children:[a.jsx(ge,{children:Ra(e)}),a.jsx(ge,{size:"xs",c:"dimmed",children:o})]})]})})});function XW(e){const t=JSON.stringify(e);return pS(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 JW(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),eQ(ZW(n),t).slice(0,5)}function ZW(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 eQ(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(Ma(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 tQ(e){const t=Rf(),[n,r]=v.useState(!1);return a.jsx(kr.Header,{p:8,style:{zIndex:101},children:a.jsxs(be,{justify:"space-between",children:[a.jsxs(be,{gap:"xs",children:[a.jsx(_n,{className:ox.logoButton,"aria-expanded":e.navbarOpen,"aria-controls":"navbar",onClick:()=>e.navbarToggle(),children:e.logo}),!e.headerSearchDisabled&&a.jsx(YW,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(be,{gap:"lg",pr:"sm",children:[e.notifications,a.jsxs(Se,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"fade-down"},opened:n,onClose:()=>r(!1),children:[a.jsx(Se.Target,{children:a.jsx(_n,{className:ox.user,"aria-label":"User menu","data-active":n||void 0,onClick:()=>r(o=>!o),children:a.jsxs(be,{gap:7,children:[a.jsx(yo,{value:t,radius:"xl",size:24}),a.jsx(ge,{size:"sm",className:ox.userName,children:Ma(t?.name?.[0])}),a.jsx(PS,{size:12,stroke:1.5})]})})}),a.jsx(Se.Dropdown,{children:a.jsx(fP,{version:e.version})})]})]})]})})}const nQ=()=>qA({opened:!1,empty:!1,selected:-1,listId:"",query:"",registeredActions:new Set}),rQ=e=>GA(e);function au(e,t){const n=t.getState();t.setState({...n,...e(t.getState())})}function hP(e){au(()=>({opened:!0,selected:-1}),e)}function pP(e){au(()=>({opened:!1}),e)}function mP(e){au(t=>({opened:!t.opened,selected:t.opened?t.selected:-1}),e)}function gP(e,t){t.updateState(n=>({...n,selected:e}))}function iQ(e,t){t.updateState(n=>({...n,listId:e}))}function Wp(e,t=document){const n=t.querySelector(e);if(n)return n;const r=t instanceof ShadowRoot?t.host.children:t.children;for(let o=0;o<r.length;o+=1){const s=r[o];if(s.shadowRoot){const u=Wp(e,s.shadowRoot);if(u)return u}const c=Wp(e,s);if(c)return c}return null}function ng(e,t){const n=t.getState(),r=n.listId?Wp(`#${n.listId}`):null,o=r?.querySelector("[data-selected]"),s=r?.querySelectorAll("[data-action]")??[],c=e===-1?s.length-1:e===s.length?0:e,u=_d(c,0,s.length-1);return o?.removeAttribute("data-selected"),s[u]?.scrollIntoView({block:"nearest"}),s[u]?.setAttribute("data-selected","true"),gP(u,t),u}function oQ(e){return ng(e.getState().selected+1,e)}function aQ(e){return ng(e.getState().selected-1,e)}function sQ(e){const t=e.getState();Wp(`#${t.listId} [data-selected]`)?.click()}function lQ(e,t){const n=t.getState();return n.registeredActions.add(e),()=>{n.registeredActions.delete(e)}}function cQ(e,t){au(()=>({query:e}),t),Promise.resolve().then(()=>{ng(0,t),au(n=>({empty:n.query.trim().length>0&&n.registeredActions.size===0||!1}),t)})}function uQ({clearQuery:e},t){t.updateState(n=>({...n,selected:-1,query:e?"":n.query,empty:e?!1:n.empty}))}const zo={open:hP,close:pP,toggle:mP,updateState:au,setSelectedAction:gP,setListId:iQ,selectAction:ng,selectNextAction:oQ,selectPreviousAction:aQ,triggerSelectedAction:sQ,registerAction:lQ,setQuery:cQ,clearSpotlightState:uQ};function dQ(){const e=nQ();return[e,{open:()=>hP(e),close:()=>pP(e),toggle:()=>mP(e)}]}const[vP,_f]=dQ(),{open:kae,close:Pae,toggle:Nae}=_f;function yP(e){const t=e;return t.group!==void 0&&Array.isArray(t.actions)}function fQ(e){return Array.isArray(e)?e.map(t=>t.trim()).join(",").toLowerCase().trim():typeof e=="string"?e.toLowerCase().trim():""}function hQ(e){return e.reduce((t,n)=>"actions"in n?[...t,...n.actions.map(r=>({...r,group:n.group}))]:[...t,n],[])}function pQ(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 mQ=(e,t)=>{const n=e.trim().toLowerCase(),r=[[],[]];return hQ(t).forEach(s=>{s.label?.toLowerCase().includes(n)?r[0].push(s):(s.description?.toLowerCase().includes(n)||fQ(s.keywords).includes(n))&&r[1].push(s)}),pQ(r.flat())};function xP(e,t){if(!Array.isArray(e))return[];let n=0;return e.reduce((r,o)=>{if(n>=t)return r;if(yP(o)){const s=xP(o.actions,t-n);r.push({group:o.group,actions:s}),n+=s.length}else r.push(o),n+=1;return r},[])}var qo={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[gQ,Su]=Or("Spotlight component was not found in tree"),vQ={dimmedSections:!0,highlightQuery:!1},Yd=ve((e,t)=>{const n=oe("SpotlightAction",vQ,e),{className:r,style:o,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:_,...k}=n,L=Su(),D={classNames:s,styles:c},P=S&&typeof h=="string"?a.jsx(_0,{component:"span",highlight:L.query,color:w,...L.getStyles("actionLabel",D),children:h}):a.jsx("span",{...L.getStyles("actionLabel",D),children:h});return a.jsx(_n,{ref:t,"data-action":!0,...L.getStyles("action",{className:r,style:o,...D}),...k,onMouseDown:$=>{$.preventDefault(),R?.($)},onClick:$=>{T?.($),(C??L.closeOnActionTrigger)&&zo.close(L.store)},tabIndex:-1,children:y||a.jsxs(a.Fragment,{children:[m&&a.jsx(le,{component:"span",mod:{position:"left",dimmed:x},...L.getStyles("actionSection",D),children:m}),a.jsxs("span",{...L.getStyles("actionBody",D),children:[P,a.jsx("span",{...L.getStyles("actionDescription",D),children:f})]}),g&&a.jsx(le,{component:"span",mod:{position:"right",dimmed:x},...L.getStyles("actionSection",D),children:g})]})})});Yd.classes=qo;Yd.displayName="@mantine/spotlight/SpotlightAction";const rg=ve((e,t)=>{const{className:n,style:r,styles:o,classNames:s,label:c,children:u,...f}=oe("SpotlightActionsGroup",null,e),h=Su();return a.jsx(le,{...h.getStyles("actionsGroup",{className:n,style:r,classNames:s,styles:o}),ref:t,...f,__vars:{"--spotlight-label":`'${c?.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`},children:u})});rg.classes=qo;rg.displayName="@mantine/core/SpotlightActionsGroup";const ig=ve((e,t)=>{const{className:n,style:r,id:o,children:s,vars:c,classNames:u,styles:f,...h}=oe("SpotlightActionsList",null,e),m=Su(),g=`mantine-${v.useId().replace(/:/g,"")}`,y=o||g;return v.useEffect(()=>(zo.setListId(y,m.store),()=>zo.setListId("",m.store)),[]),a.jsx(Zr.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})});ig.classes=qo;ig.displayName="@mantine/spotlight/SpotlightActionsList";const og=ve((e,t)=>{const{className:n,style:r,classNames:o,styles:s,...c}=oe("SpotlightEmpty",null,e),u=Su();return a.jsx(le,{ref:t,...u.getStyles("empty",{classNames:o,styles:s,className:n,style:r}),...c})});og.classes=qo;og.displayName="@mantine/spotlight/SpotlightEmpty";const BS=ve((e,t)=>{const{className:n,style:r,classNames:o,styles:s,...c}=oe("SpotlightFooter",null,e),u=Su();return a.jsx(le,{ref:t,...u.getStyles("footer",{className:n,classNames:o,style:r,styles:s}),...c})});BS.classes=qo;BS.displayName="@mantine/spotlight/SpotlightFooter";function yQ(e,t){if(!e)return[];const n=()=>zo.open(t);return Array.isArray(e)?e.map(r=>[r,n]):[[e,n]]}const xQ={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},ag=ve((e,t)=>{const n=oe("SpotlightRoot",xQ,e),{classNames:r,className:o,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:k,closeOnActionTrigger:L,maxHeight:D,scrollable:P,attributes:$,...U}=n,W=kn(),{opened:Y,query:ee}=rQ(h),B=typeof g=="string"?g:ee,G=I=>{y?.(I),zo.setQuery(I,h)},M=Ue({name:"Spotlight",classes:qo,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:$});return GM(yQ(w,h),C,T),Cl(()=>{Y?E?.():_?.()},[Y]),R?null:a.jsx(gQ,{value:{getStyles:M,query:B,setQuery:G,store:h,closeOnActionTrigger:L},children:a.jsx(Mn,{ref:t,...U,withCloseButton:!1,opened:Y||!!k,padding:0,onClose:()=>zo.close(h),className:o,style:s,classNames:of({theme:W,classNames:[qo,r],props:n,stylesCtx:void 0}),styles:Ld({theme:W,styles:c,props:n,stylesCtx:void 0}),transitionProps:{...x,onExited:()=>{S&&G(""),zo.clearSpotlightState({clearQuery:S},h),x?.onExited?.()}},__vars:{"--spotlight-max-height":P?ce(D):void 0},__staticSelector:"Spotlight","data-scrollable":P||void 0,children:m})})});ag.classes=qo;ag.displayName="@mantine/spotlight/SpotlightRoot";const bQ={size:"lg"},sg=ve((e,t)=>{const{classNames:n,styles:r,onKeyDown:o,onChange:s,vars:c,value:u,...f}=oe("SpotlightSearch",bQ,e),h=Su(),m=h.getStyles("search"),[g,y]=v.useState(!1),x=S=>{o?.(S),!g&&(S.nativeEvent.code==="ArrowDown"&&(S.preventDefault(),zo.selectNextAction(h.store)),S.nativeEvent.code==="ArrowUp"&&(S.preventDefault(),zo.selectPreviousAction(h.store)),(S.nativeEvent.code==="Enter"||S.nativeEvent.code==="NumpadEnter")&&(S.preventDefault(),zo.triggerSelectedAction(h.store)))};return a.jsx(gn,{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)})});sg.classes=qo;sg.displayName="@mantine/spotlight/SpotlightSearch";const SQ={size:600,yOffset:80,limit:1/0,zIndex:Br("max"),overlayProps:{backgroundOpacity:.35,blur:7},transitionProps:{duration:200,transition:"pop"},store:vP,filter:mQ,clearQueryOnClose:!0,closeOnActionTrigger:!0,shortcut:"mod + K"},vi=ve((e,t)=>{const n=oe("Spotlight",SQ,e),{searchProps:r,filter:o,query:s,onQueryChange:c,actions:u,nothingFound:f,highlightQuery:h,limit:m,scrollAreaProps:g,...y}=n,[x,S]=ir({value:s,defaultValue:"",finalValue:"",onChange:c}),w=xP(o(x,u),m).map(C=>{if(yP(C)){const T=C.actions.map(({id:R,...E})=>a.jsx(Yd,{highlightQuery:h,...E},R));return a.jsx(rg,{label:C.group,children:T},C.group)}return a.jsx(Yd,{highlightQuery:h,...C},C.id)});return a.jsxs(ag,{...y,query:x,onQueryChange:S,ref:t,children:[a.jsx(sg,{...r}),a.jsxs(ig,{...g,children:[w,w.length===0&&f&&a.jsx(og,{children:f})]})]})});vi.classes=qo;vi.displayName="@mantine/spotlight/Spotlight";vi.Search=sg;vi.ActionsList=ig;vi.Action=Yd;vi.Empty=og;vi.ActionsGroup=rg;vi.Footer=BS;vi.Root=ag;vi.open=_f.open;vi.close=_f.close;vi.toggle=_f.toggle;const VS=v.createContext({submitting:!1});VS.displayName="FormContext";function jQ(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?wQ(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&CQ(t,n);return t}function wQ(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function CQ(e,t){e[t.name]=t.value}function pt(e){const[t,n]=v.useState(!1);return a.jsx(VS.Provider,{value:{submitting:t},children:a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:r=>{r.preventDefault();const o=jQ(r.target);if(e.onSubmit){n(!0);const s=e.onSubmit(o);s?.then?s.catch(console.error).finally(()=>{n(!1)}):n(!1)}},children:e.children})})}function mr(e){const{children:t,...n}=e,{submitting:r}=v.useContext(VS);return a.jsx(Oe,{type:"submit",loading:r,...n,children:t})}function EQ(e){const t=Te(),n=t.getUserConfiguration();function r(o){const{menuname:s,bookmarkname:c}=o,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"}),_e({color:"green",message:"Success"}),e.onOk()}).catch(m=>{_e({color:"red",message:qe(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(Pe,{children:[a.jsx(TQ,{config:n}),a.jsx(He,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",defaultValue:e.pathname.split("/")[1]||"",withAsterisk:!0}),a.jsx(be,{justify:"flex-end",children:a.jsx(mr,{mt:"sm",children:"OK"})})]})})})}function TQ(e){function t(r){return r?.menu?.map(o=>o.title)}const n=t(e.config);return a.jsx(mn,{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 RQ(e){return typeof e.display=="string"?e.display:bP(e)}function _Q(e){return{value:bP(e),label:RQ(e),resource:e}}function DQ(e){return{code:e,display:e}}function Df(e){const t=Te(),{binding:n,creatable:r,clearable:o,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(US,{...u,creatable:r??!0,clearable:o??!0,toOption:_Q,loadOptions:f,onCreate:DQ,itemComponent:c?AQ:void 0})}const AQ=v.forwardRef(({label:e,resource:t,active:n,...r},o)=>a.jsx("div",{ref:o,...r,children:a.jsxs(be,{wrap:"nowrap",gap:"xs",children:[n&&a.jsx(Ko,{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,...o}=e,[s,c]=v.useState(t);function u(f){const h=f[0],m=PQ(h);c(m),n&&n(m)}return a.jsx(Df,{defaultValue:kQ(s),onChange:u,withHelpText:r??!0,...o})}function kQ(e){return e?{code:e}:void 0}function PQ(e){return e?.code}function FS(e){const[t,n]=v.useState(e.defaultValue),r=e.onChange,o=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:o,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 NQ="_navbar_ts9vb_1",OQ="_logoButton_ts9vb_6",MQ="_menuTitle_ts9vb_25",LQ="_link_ts9vb_51",IQ="_dismissButton_ts9vb_91",zQ="_linkLabel_ts9vb_109",$Q="_iconWrapper_ts9vb_120",UQ="_alertDot_ts9vb_127",BQ="_linkCount_ts9vb_138",VQ="_addBookmarkLink_ts9vb_191",FQ="_toggleButton_ts9vb_201",HQ="_divider_ts9vb_226",cr={navbar:NQ,logoButton:OQ,menuTitle:MQ,link:LQ,dismissButton:IQ,linkLabel:zQ,iconWrapper:$Q,alertDot:UQ,linkCount:BQ,addBookmarkLink:VQ,toggleButton:FQ,divider:HQ},qQ="_actionSection_1l8yv_8",GQ="_action_1l8yv_8",WQ="_actionDescription_1l8yv_27",QQ="_actionsGroup_1l8yv_32",YQ="_actionsList_1l8yv_55",KQ="_content_1l8yv_60",fs={actionSection:qQ,action:GQ,actionDescription:WQ,actionsGroup:QQ,actionsList:YQ,content:KQ},XQ=200;function gR(){return a.jsxs(Pe,{gap:"xs",py:"lg",children:[a.jsxs(ge,{size:"sm",c:"dimmed",children:["Press ",a.jsx(Fc,{children:"⌘"})," + ",a.jsx(Fc,{children:"K"})," to open Search next time."]}),a.jsxs(ge,{size:"sm",c:"dimmed",children:["(",a.jsx(Fc,{children:"Ctrl"})," + ",a.jsx(Fc,{children:"K"})," on Windows)"]})]})}function JQ({patientsOnly:e}){const t=Te(),n=xu(),[r,o]=v.useState(a.jsx(gR,{})),[s,c]=v.useState([]),u=rf(h=>{const m=ZQ(h);e?t.graphql(m).then(g=>{const x=vR(g).filter(S=>S.resourceType==="Patient");c(tY(x,n))}).catch(console.error).finally(()=>o("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(nY(x,S,n))}).catch(console.error).finally(()=>o("No results found"))},XQ),f=h=>{if(!h){u.cancel(),o(a.jsx(gR,{})),c([]);return}o("Searching..."),u(h)};return a.jsx(vi,{actions:s,nothingFound:r,radius:"md",highlightQuery:!0,searchProps:{leftSection:a.jsx(eg,{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:fs.body,content:fs.content,search:fs.search,actionsList:fs.actionsList,action:fs.action,actionSection:fs.actionSection,actionDescription:fs.actionDescription,actionsGroup:fs.actionsGroup},onQueryChange:f})}function ZQ(e){const t=JSON.stringify(e);return pS(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),eY(t)}function eY(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 tY(e,t){const n=e.filter(r=>!!r.id).map(r=>({id:r.id,label:r.name?Ma(r.name[0]):r.id,description:r.birthDate,leftSection:a.jsx(yo,{value:r,radius:"xl",size:24}),onClick:()=>t(`/Patient/${r.id}`)}));return n.length>0?[{group:"Patients",actions:n}]:[]}function nY(e,t,n){const r=[],o=t.map(u=>({id:`resource-type-${u.code}`,label:u.display??u.code??"",description:"Resource Type",onClick:()=>n(`/${u.code}`)}));o.length>0&&r.push({group:"Resource Types",actions:o});const s=[],c=[];for(const u of e)u.resourceType==="Patient"&&u.id?s.push({id:u.id,label:u.name?Ma(u.name[0]):u.id,description:u.birthDate,leftSection:a.jsx(yo,{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=xu(),n=Rf(),r=iY(e.pathname,e.searchParams,e.menus),[o,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:cr.navbar,children:[e.logo&&a.jsx(kr.Section,{px:"xs",pt:"xs",pb:"4px",children:a.jsx(_n,{className:cr.logoButton,onClick:e.navbarToggle,"aria-expanded":m,"aria-controls":"navbar","aria-label":"Medplum Logo",children:e.logo})}),a.jsx(Zr,{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(Xr,{label:"Search",position:"right",transitionProps:{duration:0},disabled:m,children:a.jsxs(_n,{className:cr.link,onClick:()=>_f.open(),"aria-label":"Search",children:[a.jsx(eg,{size:"1.2rem"}),a.jsx("span",{className:cr.linkLabel,"data-opened":m||void 0,children:"Search"})]})})}),e.spotlightEnabled&&a.jsx(JQ,{patientsOnly:e.patientsOnly}),!e.resourceTypeSearchDisabled&&a.jsx(kr.Section,{mb:"sm",children:a.jsx(FS,{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:cr.menuTitle,"data-opened":m||void 0,children:g.title}),a.jsx(Pe,{gap:"2",children:g.links?.map(x=>x.notificationCount?a.jsx(rY,{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(Xr,{label:"Add Bookmark",position:"right",transitionProps:{duration:0},disabled:m,children:a.jsxs(_n,{className:`${cr.link} ${cr.addBookmarkLink}`,onClick:()=>u(!0),children:[a.jsx(Qd,{}),a.jsx("span",{className:cr.linkLabel,"data-opened":m||void 0,children:"Add Bookmark"})]})})]})}),e.userMenuEnabled&&a.jsxs(kr.Section,{px:"xs",py:"xs",children:[a.jsx(Xr,{label:m?"Close Sidebar":"Open Sidebar",position:"right",transitionProps:{duration:0},children:a.jsx(_n,{className:cr.toggleButton,"aria-label":m?"Close Sidebar":"Open Sidebar",onClick:e.navbarToggle,"aria-expanded":m,"aria-controls":"navbar",children:a.jsx(TG,{})})}),a.jsx(fn,{my:"xs",mx:6,className:cr.divider}),a.jsxs(Se,{width:260,shadow:"xl",position:"top-start",transitionProps:{transition:"fade-up"},opened:o,onClose:()=>s(!1),children:[a.jsx(Se.Target,{children:a.jsxs(_n,{className:cr.link,pl:"7","aria-label":"User menu","data-active":o||void 0,onClick:()=>s(g=>!g),bd:"1px 0 0 0 solid var(--mantine-color-gray-200)",children:[a.jsx(yo,{value:n,radius:"xl",size:24}),a.jsx("span",{className:cr.linkLabel,"data-opened":m||void 0,children:Ma(n?.name?.[0])})]})}),a.jsx(Se.Dropdown,{children:a.jsx(fP,{version:e.version,showLayoutVersionToggle:e.showLayoutVersionToggle})})]})]})]}),e.pathname&&e.searchParams&&a.jsx(EQ,{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:o,active:s,count:c,alert:u,opened:f,onDismiss:h}=e,m=c!==void 0&&c>0,g=n??a.jsx(Eq,{}),y=m&&u&&!f;function x(S){S.preventDefault(),S.stopPropagation(),h?.()}return a.jsx(Xr,{label:r,position:"right",transitionProps:{duration:0},disabled:f,children:a.jsxs(Ct,{to:t,onClick:o,className:cr.link,"data-active":s||void 0,children:[a.jsxs("span",{className:cr.iconWrapper,children:[g,y&&a.jsx("span",{className:cr.alertDot})]}),a.jsx("span",{className:cr.linkLabel,"data-opened":f||void 0,children:r}),m&&a.jsx("span",{className:cr.linkCount,"data-opened":f||void 0,"data-alert":u||void 0,children:c.toLocaleString()}),h&&f&&a.jsx(Xr,{label:"Dismiss",openDelay:500,children:a.jsx(_n,{"aria-label":"Dismiss",className:cr.dismissButton,onClick:x,children:a.jsx(Ts,{size:14})})})]})})}function rY(e){const t=NH(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 iY(e,t,n){if(!e||!t||!n)return;let r,o=0;for(const s of n)if(s.links)for(const c of s.links){const u=oY(e,t,c.href);u>o&&(o=u,r=c)}return r}function oY(e,t,n){const r=new URL(n,"https://example.com");if(e!==r.pathname)return 0;const o=["_count","_offset"];for(const[c,u]of r.searchParams.entries())if(!o.includes(c)&&t.get(c)!==u)return 0;let s=1;for(const[c,u]of t.entries())o.includes(c)||r.searchParams.get(c)===u&&s++;return s}const xR=250,aY=59;function sY(e){const[t,n]=v.useState(localStorage.navbarOpen==="true"),[r]=v.useState(e.layoutVersion??localStorage.appShellLayoutVersion??"v1"),o=Te(),s=Rf();function c(x){localStorage.navbarOpen=x.toString(),n(x)}function u(){c(!1)}function f(){c(!t)}if(o.isLoading())return a.jsx(Bi,{});let h,m,g,y;return r==="v2"?(h={height:0},m={width:t?xR:aY,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(tQ,{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:NW.main,children:a.jsx(IS,{children:a.jsx(v.Suspense,{fallback:a.jsx(Bi,{}),children:e.children})})})]})}const lY="https://ccda.medplum.com",cY="https://ccda-validator.medplum.com/";function uY(e){const{url:t}=e,[n,r]=v.useState(!1),o=v.useRef(null),[s,c]=v.useState(),[u,f]=v.useState(!1);v.useEffect(()=>{t&&n&&o.current&&(Ad(o.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=`${cY}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:o,src:lY,allowFullScreen:!0,frameBorder:0,seamless:!0,onLoad:()=>r(!0)})}),a.jsxs("div",{style:{marginTop:"10px",marginBottom:"10px",display:"flex",alignItems:"center"},children:[a.jsx(Oe,{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(Oe,{type:"button",onClick:m,color:"green",style:{marginLeft:"auto"},children:"Download Full Results"})]})]})]}):null}function Af(e){const{contentType:t,url:n,title:r}=e.value??{},o=Qk(n);return o?a.jsxs("div",{"data-testid":"attachment-display",children:[t?.startsWith("image/")&&a.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:o,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:o})}),(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:o+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),t===nn.CDA_XML&&a.jsx(uY,{url:o}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx(Tt,{href:n,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:dY(r),children:r||"Download"})})]}):null}function dY(e){return e?.includes(".")?e:void 0}const fY="_root_1bd5a_1",hY="_compact_1bd5a_19",bR={root:fY,compact:hY};function kf(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 pY(e){const t=e.values?.map((r,o)=>a.jsx("div",{children:a.jsx(Af,{value:r,maxWidth:e.maxWidth})},"attatchment-"+o));let n;if(e.includeDescriptionListEntry){if(e.property===void 0)throw new Error("props.property is required when includeDescriptionListEntry is true");if(!zn(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const r=e.path.split(".").pop();n=a.jsx(Ur,{term:_l(r),children:t})}else n=a.jsx(a.Fragment,{children:t});return n}function HS(e){const t=Te(),n=v.useRef(null);function r(c){jn(c),n.current?.click()}function o(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(on(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=>o(c)}),e.children({onClick:r,disabled:e.disabled})]})}function mY(e){const[t,n]=v.useState(e.defaultValue??[]),r=v.useRef(t);r.current=t;function o(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(Af,{value:s,maxWidth:200})}),a.jsx("td",{children:a.jsx(An,{disabled:e.disabled,title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:u=>{jn(u);const f=t.slice();f.splice(c,1),o(f)},children:a.jsx(Gp,{})})})]},`${c}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(HS,{disabled:e.disabled,onUpload:s=>{o([...r.current,s])},children:s=>a.jsx(An,{...s,title:"Add",variant:"subtle",size:"sm",color:s.disabled?"gray":"green",children:a.jsx(NS,{})})})})]})]})]})}function wP(e){const[t,n]=v.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return t?a.jsxs(a.Fragment,{children:[a.jsx(Af,{value:t,maxWidth:200}),a.jsx(Oe,{disabled:e.disabled,onClick:o=>{jn(o),r(void 0)},children:"Remove"})]}):a.jsx(HS,{disabled:e.disabled,securityContext:e.securityContext,onUpload:r,children:o=>a.jsx(Oe,{...o,children:"Upload..."})})}function Qi(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 Qp(e){const[t,n]=v.useState();return a.jsxs(pt,{onSubmit:r=>{n(void 0),e.onSubmit(r)?.catch(o=>n(qe(o)))},children:[a.jsxs(No,{style:{flexDirection:"column"},children:[a.jsx(Qi,{size:32}),a.jsx($e,{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(Yo,{icon:a.jsx(Ls,{size:16}),title:"Error",color:"red",mb:"lg",children:t}),e.qrCodeUrl&&a.jsx(No,{children:a.jsxs(Pe,{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(Pe,{gap:"sm",children:a.jsx(He,{name:"token",label:"MFA code",autoComplete:"one-time-code",required:!0,autoFocus:!0})}),a.jsx(Pe,{gap:"xs",pt:"md",children:a.jsx(mr,{fullWidth:!0,children:e.buttonText})})]})}const gY="_root_1vii2_1",vY={root:gY};function ql(e){const{children:t,...n}=e;return a.jsx(mf,{className:vY.root,...n,children:t})}const yY="_paper_1igaj_1",xY="_fill_1igaj_20",SR={paper:yY,fill:xY};function Is(e){const{width:t,fill:n,className:r,children:o,...s}=e,c=t?{maxWidth:t}:void 0;return a.jsx(hr,{className:Ft(SR.paper,n&&SR.fill,r),style:c,shadow:"sm",radius:"sm",withBorder:!0,...s,children:o})}function ut(e){const{children:t,...n}=e;return a.jsx(ql,{children:a.jsx(Is,{...n,children:t})})}function gr(e){const{outcome:t,issues:n,...r}=e,o=t?.issue||n;return!o||o.length===0?null:a.jsx(Yo,{icon:a.jsx(Ls,{size:16}),color:"red",...r,children:o.map(s=>a.jsx("div",{"data-testid":"text-field-error",children:nk(s)},s.details?.text))})}function Bt(e,t){return e?.issue?.filter(n=>CP(n.expression?.[0],t))?.map(n=>n.details?.text)?.join(`
198
+ `)}function zs(e,t){return e?.issue?.filter(n=>CP(n.expression?.[0],t))}const cp=/\[\d+\]/;function CP(e,t){const n=typeof e=="string"&&cp.test(e),r=typeof t=="string"&&cp.test(t);if(n!==r&&(e=e?.replace(cp,""),t=t?.replace(cp,"")),e===t)return!0;if(!e||!t)return!1;const o=e.indexOf(".");if(o>=0&&e.substring(o+1)===t)return!0;const s=t.indexOf(".");return s>=0&&t.substring(s+1)===e}function EP(e){const t=Te(),[n,r]=v.useState(),o=zs(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(on(c))}},children:[a.jsxs(or,{direction:"column",align:"center",justify:"center",children:[a.jsx(Qi,{size:32}),a.jsx($e,{order:3,py:"lg",children:"Create a new project"})]}),a.jsx(gr,{issues:o,mb:"lg"}),a.jsx(Pe,{gap:"sm",children:a.jsx(He,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:Bt(n,"projectName")})}),a.jsxs(Pe,{gap:"xs",mt:"md",children:[a.jsx(mr,{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(Tt,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Tt,{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),[o,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,o,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=nr.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 bY(e){const t=_P(e.googleClientId),n=e.recaptchaSiteKey,r=Te(),[o,s]=v.useState(),c=zs(o,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(on(f))}},children:[a.jsx(or,{direction:"column",align:"center",justify:"center",children:e.children}),a.jsx(gr,{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(on(f))}}})}),a.jsx(fn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(Pe,{gap:"sm",children:[a.jsx(He,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:Bt(o,"firstName")}),a.jsx(He,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:Bt(o,"lastName")}),a.jsx(He,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:Bt(o,"email")}),a.jsx(uo,{name:"password",label:"Password",autoComplete:"off",required:!0,error:Bt(o,"password")})]}),a.jsxs(Pe,{gap:"xs",children:[a.jsx(hn,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1},pt:"md",pb:"xs"}),a.jsx(mr,{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(Tt,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Tt,{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(Tt,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Tt,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]})]})}function SY(e){const{type:t,projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:s,onSuccess:c}=e,u=Te(),[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(on(S)))},[u,t,n,f,c]);function y(S){S.code?u.processCode(S.code).then(()=>c()).catch(w=>g(on(w))):S.login&&h(S.login)}const x=zs(m,void 0);return a.jsxs(ut,{width:400,px:"xl",py:"xl",bdrs:"md",children:[a.jsx(gr,{issues:x,mb:"lg"}),!f&&a.jsx(bY,{projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:s,handleAuthResponse:y,children:e.children}),f&&t==="project"&&a.jsx(EP,{login:f,handleAuthResponse:y})]})}function jY(e){const[t,n]=v.useState();return t?a.jsx(CY,{email:t,resetEmail:()=>n(void 0),...e}):a.jsx(wY,{setEmail:n,...e})}function wY(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:o,disableEmailAuth:s,...c}=e,u=Te(),f=!e.disableGoogleAuth&&_P(e.googleClientId),[h,m]=v.useState(),g=zs(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),nr.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(on(C))}},[u,c,y,r]);return a.jsxs(pt,{onSubmit:x,children:[a.jsx(or,{direction:"column",align:"center",justify:"center",children:o}),a.jsx(gr,{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(fn,{label:"or",labelPosition:"center",my:"lg"})]}),!s&&a.jsx(He,{name:"email",type:"email",label:"Email",mb:"md",placeholder:"name@domain.com",required:!0,autoFocus:!0,error:Bt(h,"email"),"data-testid":"auth.email"}),a.jsxs(Pe,{gap:"xs",children:[!s&&a.jsx(mr,{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(Tt,{onClick:n,children:"Register"})]})]})]})}function CY(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...o}=e,s=Te(),[c,u]=v.useState(),f=zs(c,void 0),h=v.useCallback(m=>{s.startLogin({...o,password:m.password,remember:m.remember==="on"}).then(n).catch(g=>u(on(g)))},[s,o,n]);return a.jsxs(pt,{onSubmit:h,children:[a.jsx(or,{direction:"column",align:"center",justify:"center",children:r}),a.jsx(gr,{issues:f,mb:"lg"}),a.jsxs(Pe,{gap:"sm",children:[a.jsx(He,{label:"Email",value:e.email,disabled:!0,rightSectionWidth:36,rightSection:a.jsx(An,{variant:"subtle",color:"gray",onClick:e.resetEmail,"aria-label":"Change email",children:a.jsx(qG,{size:"1rem",stroke:1.5})})}),a.jsx(uo,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:Bt(c,"password"),"data-testid":"auth.password"})]}),a.jsxs(Pe,{gap:"xs",children:[a.jsx(hn,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1},pt:"md",pb:"xs"}),a.jsx(mr,{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(Tt,{onClick:t,children:"Reset Password"})})]})]})}const EY="_option_18k89_1",TY="_iconBox_18k89_9",kP={option:EY,iconBox:TY};function RY(e){const t=Te(),n=Bl(),[r,o]=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(on(y)))}const m=e.memberships.filter(f).slice(0,10).map(g=>a.jsx(Qe.Option,{value:g.id,className:kP.option,children:a.jsx(_Y,{...g})},g.id));return a.jsxs(Pe,{gap:"0",children:[a.jsxs(or,{justify:"center",align:"center",direction:"column",wrap:"nowrap",children:[a.jsx(Qi,{size:32}),a.jsx($e,{order:3,py:"lg",children:"Choose a Project"})]}),a.jsx(gr,{outcome:s,mb:"lg"}),a.jsxs(Qe,{store:n,onOptionSubmit:h,children:[a.jsx(Qe.EventsTarget,{children:a.jsx(He,{placeholder:"Search",value:r,mb:"md",autoFocus:!0,leftSection:a.jsx(eg,{size:16}),onChange:g=>{o(g.currentTarget.value),n.updateSelectedOptionIndex()}})}),a.jsx("div",{children:a.jsx(Qe.Options,{style:{marginLeft:"-10px",marginRight:"-10px",marginBottom:"-10px"},children:m.length>0?m:a.jsx(Qe.Empty,{children:"Nothing found..."})})})]}),a.jsx(ge,{size:"sm",ta:"center",mt:"md",children:a.jsx(Tt,{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 _Y(e){const t=PP(e);return a.jsxs(be,{gap:"xs",align:"center",children:[a.jsx(le,{className:kP.iconBox,children:a.jsx(Nq,{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 DY=/^patient\/Condition\.(?:\*|c?r?u?d?s?)$/,AY="?category=http://terminology.hl7.org/CodeSystem/condition-category|encounter-diagnosis",kY="?category=http://terminology.hl7.org/CodeSystem/condition-category|problem-list-item",PY="?category=http://hl7.org/fhir/us/core/CodeSystem/condition-category|health-concern",NY=/^patient\/Observation\.(?:\*|c?r?u?d?s?)$/,OY="?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-observation-category|clinical-test",MY="?category=http://terminology.hl7.org/CodeSystem/observation-category|laboratory",LY="?category=http://terminology.hl7.org/CodeSystem/observation-category|social-history",IY="?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-category|sdoh",zY="?category=http://terminology.hl7.org/CodeSystem/observation-category|survey",$Y="?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs";function UY(e){const t=Te();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(Pe,{children:[a.jsxs(or,{direction:"column",align:"center",justify:"center",children:[a.jsx(Qi,{size:32}),a.jsx($e,{order:3,py:"lg",children:"Choose scope"})]}),a.jsx(Pe,{children:(e.scope??"openid").split(" ").map(n=>{let r;return DY.test(n)?r=[n+AY,n+kY,n+PY]:NY.test(n)&&(r=[n+OY,n+MY,n+LY,n+IY,n+zY,n+$Y]),a.jsxs(a.Fragment,{children:[a.jsx(hn,{id:n,name:n,label:n,defaultChecked:!0},n),r?.map(o=>a.jsx(hn,{id:o,name:o,label:o},o))]},n+"_group")})}),a.jsx(be,{justify:"flex-end",mt:"xl",children:a.jsx(mr,{fullWidth:!0,children:"Set Scope"})})]})})}function NP(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:o,onRegister:s,onCode:c,...u}=e,f=Te(),[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(D=>{c?c(D):f.processCode(D).then(()=>{r&&r()}).catch(P=>_e({color:"red",message:qe(P)}))},[f,c,r]),k=v.useCallback(D=>{x(!!D.mfaEnrollRequired),w(D.enrollQrCode),T(!!D.mfaRequired),D.login&&m(D.login),D.memberships&&E(D.memberships),D.code&&(n?E(void 0):_(D.code))},[n,_]),L=v.useCallback(D=>{_(D.code)},[_]);return v.useEffect(()=>{t&&!g.current&&!h&&(g.current=!0,f.get("auth/login/"+t).then(k).catch(D=>_e({color:"red",message:qe(D)})))},[f,t,g,h,k]),a.jsx(ut,{width:400,px:"xl",py:"xl",bdrs:"md",children:h?y&&S?a.jsx(Qp,{title:"Enroll in MFA",description:"Scan this QR code with your authenticator app.",buttonText:"Enroll",qrCodeUrl:S,onSubmit:async D=>{const P=await f.post("auth/mfa/login-enroll",{login:h,token:D.token});k(P)}}):C?a.jsx(Qp,{title:"Enter MFA code",description:"Enter the code from your authenticator app.",buttonText:"Submit Code",onSubmit:async D=>{const P=await f.post("auth/mfa/verify",{login:h,token:D.token});k(P)}}):e.projectId==="new"?a.jsx(EP,{login:h,handleAuthResponse:k}):R?a.jsx(RY,{login:h,memberships:R,handleAuthResponse:k}):e.chooseScopes?a.jsx(UY,{login:h,scope:e.scope,handleAuthResponse:L}):a.jsx("div",{children:"Success"}):a.jsx(jY,{onForgotPassword:o,onRegister:s,handleAuthResponse:k,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...u,children:e.children})})}function $o(e){return a.jsx(a.Fragment,{children:Cs(e.value)})}function BY(e){return a.jsx(a.Fragment,{children:Tf(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 VY(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 lg(e,t,n){const r=Fd(e,t,{profileUrl:n});return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function FY(e,t,n){const r=ck(e,t,n);return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function HY(e){const{elementDefinitionType:t}=e,n=Te(),r=v.useContext(vn),[o,s]=v.useState(ak("Extension")),c=v.useMemo(()=>{if(zn(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=yu(c);f(!1),g&&s(g)}).catch(g=>{f(!1),console.warn(g)}))},[n,c]),c&&(u||!uS(c)))return a.jsx("div",{children:"Loading..."});if(o.elements["value[x]"]?.max!==0){const[g,y]=lg({type:"Extension",value:e.value},"value[x]",c??r.profileUrl);return a.jsx(go,{propertyType:y,value:g})}return a.jsx(Yp,{path:e.path,value:{type:o.type,value:e.value},compact:e.compact,ignoreMissingValues:e.ignoreMissingValues,link:e.link,profileUrl:c})}function qY(e){return a.jsxs("div",{children:[e.value?.system,": ",e.value?.value]})}function GY(e){return a.jsx(a.Fragment,{children:eV(e.value)})}function Kd(e){return a.jsx(a.Fragment,{children:yl(e.value)})}function qS(e){return a.jsx(a.Fragment,{children:qd(e.value)})}function WY(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(Kd,{value:t.numerator})," / ",a.jsx(Kd,{value:t.denominator})]}):null}function Xd(e){if(!e.value)return null;const t=e.value.display||e.value.reference||mo(e.value);return e.link!==!1&&e.value.reference?a.jsx(Ct,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}function MP(e,t,n,r){if(!zn(n?.slices))return[e];const o=new Array(t.length+1);for(let s=0;s<o.length;s++)o[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),o[u].push(s)}return o}async function LP({medplum:e,property:t}){return new Promise((n,r)=>{if(!t.slicing){n([]);return}const o=[],s=[],c=[];for(const u of t.slicing.slices){if(!Fk(u)){console.debug("Unsupported slice definition",u);continue}let f;zn(u.elements)||(f=u.type[0]?.profile?.[0]),o.push(u),s.push(f),f&&c.push(e.requestProfileSchema(f))}Promise.all(c).then(()=>{for(let u=0;u<o.length;u++){const f=o[u],h=s[u];if(h){const m=yu(h);f.typeSchema=m}}n(o)}).catch(r)})}function cg(e,t,n){return t!==void 0?a.jsx(e,{value:t,children:n}):n}function QY(e){const{slice:t,property:n}=e,r=t.typeSchema?.elements??t.elements,o=v.useContext(vn),s=v.useMemo(()=>{if(zn(r))return iu({parentContext:o,elements:r,path:e.path,profileUrl:t.typeSchema?.url})},[o,e.path,t.typeSchema?.url,r]);return cg(vn.Provider,s,a.jsx(a.Fragment,{children:e.value.map((c,u)=>a.jsx("div",{children:a.jsx(go,{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 YY(e){const{property:t,propertyType:n}=e,r=Te(),o=v.useMemo(()=>Array.isArray(e.values)?e.values:[],[e.values]),[s,c]=v.useState(!0),[u,f]=v.useState([]),[h,m]=v.useState(()=>[o]),[g,y]=v.useState(0),x=v.useContext(vn);if(v.useEffect(()=>{LP({medplum:r,property:t}).then(C=>{y(o.length),f(C);const T=o.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,o]),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(go,{path:e.path,arrayElement:!0,property:t,propertyType:n,value:R,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${E}-${C.length}`));if(e.includeDescriptionListEntry){if(!zn(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const R=e.path.split(".").pop();S=a.jsx(Ur,{term:_l(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(QY,{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:_l(C.name),children:R},C.name)),R}),S,g>jR&&a.jsx(be,{justify:"right",children:a.jsxs(ge,{children:["... ",g," total values"]})})]})}function go(e){const{property:t,propertyType:n,value:r}=e;if(t?.path?.endsWith(".id"))return a.jsxs(or,{gap:3,align:"center",children:[r,!Dn(r)&&a.jsx(C0,{value:r,timeout:2e3,children:({copied:s,copy:c})=>a.jsx(Xr,{label:s?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(An,{variant:"subtle",color:s?"teal":"gray",onClick:c,children:s?a.jsx(Ko,{size:"1rem"}):a.jsx(OS,{size:"1rem"})})})})]});if(t&&(t.isArray||t.max>1)&&!e.arrayElement)return n===ie.Attachment?a.jsx(pY,{values:r,maxWidth:e.maxWidth,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,property:t,path:e.path}):a.jsx(YY,{path:e.path,property:t,propertyType:n,values:r,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case ie.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case ie.SystemString:case ie.string:return e.property?.path?.toLowerCase().includes("secret")?a.jsx(KY,{value:r}):a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case ie.code:case ie.date:case ie.decimal:case ie.id:case ie.integer:case ie.positiveInt:case ie.unsignedInt:case ie.uri:case ie.url:case ie.xhtml:return a.jsx(a.Fragment,{children:r});case ie.canonical:return a.jsx(Xd,{value:{reference:r},link:e.link});case ie.dateTime:case ie.instant:return a.jsx(a.Fragment,{children:Nr(r)});case ie.time:return a.jsx(a.Fragment,{children:Tk(r)});case ie.markdown:return a.jsx("pre",{children:r});case ie.Address:return a.jsx(sq,{value:r});case ie.Annotation:return a.jsx(a.Fragment,{children:r?.text});case ie.Attachment:return a.jsx(Af,{value:r,maxWidth:e.maxWidth});case ie.CodeableConcept:return a.jsx($o,{value:r});case ie.Coding:return a.jsx(BY,{value:r});case ie.ContactDetail:return a.jsx(VY,{value:r});case ie.ContactPoint:return a.jsx(OP,{value:r});case ie.HumanName:return a.jsx($S,{value:r});case ie.Identifier:return a.jsx(qY,{value:r});case ie.Money:return a.jsx(GY,{value:r});case ie.Period:return a.jsx(a.Fragment,{children:YB(r)});case ie.Quantity:case ie.Duration:return a.jsx(Kd,{value:r});case ie.Range:return a.jsx(qS,{value:r});case ie.Ratio:return a.jsx(WY,{value:r});case ie.Reference:return a.jsx(Xd,{value:r,link:e.link});case ie.Timing:return a.jsx(a.Fragment,{children:Rk(r)});case ie.Dosage:case ie.UsageContext:if(!e.path)throw new Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(Yp,{path:e.path,value:{type:n,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues});case ie.Extension:if(!e.path)throw new Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(HY,{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(Yp,{path:e.path,value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function KY(e){const[t,n]=v.useState(!1),r=e.value??"",o=!Dn(r),s="•".repeat(8);return a.jsxs(or,{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:o?s:""}),o&&a.jsxs(a.Fragment,{children:[a.jsx(C0,{value:e.value,timeout:2e3,children:({copied:c,copy:u})=>a.jsx(Xr,{label:c?"Copied":"Copy secret",withArrow:!0,position:"right",children:a.jsx(An,{variant:"subtle",color:c?"teal":"gray",onClick:u,"aria-label":c?"Copied":"Copy secret",children:c?a.jsx(Ko,{size:"1rem"}):a.jsx(OS,{size:"1rem"})})})}),a.jsx(Xr,{label:t?"Hide secret":"Show secret",withArrow:!0,position:"right",children:a.jsx(An,{variant:"subtle",color:"gray",onClick:()=>n(!t),"aria-label":t?"Hide secret":"Show secret",children:t?a.jsx(dG,{size:"1rem"}):a.jsx(hG,{size:"1rem"})})})]})]})}const IP=["extension","modifierExtension"],XY=rP.filter(e=>!IP.includes(e));function Yp(e){const t=e.value,{value:n,type:r}=t,o=v.useContext(vn),s=e.profileUrl??o?.profileUrl,c=v.useMemo(()=>Hm(r,s),[s,r]),u=v.useMemo(()=>{if(c)return iu({parentContext:o,elements:c.elements,path:e.path,profileUrl:c.url,accessPolicyResource:e.accessPolicyResource})},[c,o,e.path,e.accessPolicyResource]);if(Dn(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??o;return cg(vn.Provider,u,a.jsx(kf,{compact:e.compact,children:Object.entries(f.elements).map(([h,m])=>{if(IP.includes(h)&&Dn(m.slicing?.slices))return null;if(XY.includes(h))return null;if(iP.includes(h)&&m.path.split(".").length===2||h.includes("."))return null;const[g,y]=lg(t,h,f.profileUrl);if((e.ignoreMissingValues||m.max===0)&&Dn(g)||e.path.endsWith(".extension")&&(h==="url"||h==="id"))return null;const x=m.max>1||m.isArray,S=a.jsx(go,{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:_l(h),children:S},h)})}))}const JY="_dimmed_11me5_1",ZY="_preserveBreaks_11me5_5",tb={dimmed:JY,preserveBreaks:ZY},zP="Read Only";function $P(e,t){return e?a.jsx(Xr.Floating,{label:e,children:t}):t}function UP(e){const{debugMode:t}=v.useContext(vn);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,$P(e?.readonly?zP:void 0,a.jsxs(be,{wrap:"nowrap","data-testid":e.testId,children:[a.jsx("div",{children:e.children}),a.jsx("div",{children:a.jsx(gn.Wrapper,{id:e.htmlFor,label:n,classNames:{label:e?.readonly?tb.dimmed:void 0},description:e.description,withAsterisk:e.withAsterisk,children:null})})]}))}function Vt(e){const{debugMode:t}=v.useContext(vn);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,$P(e?.readonly?zP:void 0,a.jsx(gn.Wrapper,{id:e.htmlFor,label:n,classNames:{label:Ft({[tb.dimmed]:e?.readonly},tb.preserveBreaks)},description:e.description,withAsterisk:e.withAsterisk,error:Bt(e.outcome,e.errorExpression??e.htmlFor),"data-testid":e.testId,children:e.children}))}function eK(e,t,n,r,o){const s=r.type;if(s.length>1)for(const c of s){const u=t.replace("[x]",Kn(c.code));u in e&&delete e[u]}return Dn(o)?e[n]=void 0:e[n]=o,e}function tK(e){return!!e&&!Dn(e.url)&&!Dn(e.name)}function nK(e){const{defaultValue:t,onChange:n,withHelpText:r,outcome:o,path:s,valuePath:c,...u}=e,[f,h]=v.useState(t);function m(g){const y=iK(g);h(y),n&&n(y)}return a.jsx(Df,{defaultValue:f&&rK(f),onChange:m,withHelpText:r??!0,...u})}function rK(e){return e.coding?.map(t=>({system:t.system,code:t.code,display:t.display}))}function iK(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function oK(e){const{defaultValue:t,onChange:n,withHelpText:r,response:o,...s}=e,[c,u]=v.useState(o?.answer?.[0]?.valueCoding??t);function f(h){const m=h[0],g=m&&sK(m);u(g),n&&n(g)}return a.jsx(Df,{defaultValue:c?aK(c):void 0,maxValues:1,onChange:f,withHelpText:r??!0,...s})}function aK(e){return{system:e.system,code:e.code,display:e.display}}function sK(e){return{system:e.system,code:e.code,display:e.display}}function BP(e){const{path:t,outcome:n}=e,{elementsByPath:r,getExtendedProps:o}=v.useContext(vn),[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=>o(t+"."+E)),[o,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(be,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(mn,{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:Bt(n,R+".system")}),a.jsx(mn,{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:Bt(n,R+".use")}),a.jsx(He,{disabled:e.disabled||x?.readonly,placeholder:"Value",defaultValue:s?.value,required:(m?.min??0)>0,onChange:E=>T(E.currentTarget.value),error:Bt(n,R+".value")})]})}function lK(e){const[t,n]=v.useState(e.defaultValue),r=v.useRef(t);r.current=t;const{getExtendedProps:o}=v.useContext(vn),[s,c]=v.useMemo(()=>["name","telecom"].map(m=>o(e.path+"."+m)),[o,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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(He,{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 cK(e){if(!e)return"";const t=new Date(e);return Gm(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function GS(e){if(!e)return"";const t=new Date(e);return Gm(t)?t.toISOString():""}function Uo(e){return a.jsx(He,{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:uK(),step:1,defaultValue:cK(e.defaultValue),autoFocus:e.autoFocus,error:Bt(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(GS(n))}}})}function uK(){return"datetime-local"}function dK(e){const{propertyType:t}=e,n=Te(),r=v.useMemo(()=>{if(zn(t.profile))return t.profile[0]},[t]),[o,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&&(o||!uS(r))?a.jsx("div",{children:"Loading..."}):a.jsx(KS,{profileUrl:r,path:e.path,typeName:"Extension",defaultValue:e.defaultValue,onChange:e.onChange})}function fK(e){const{outcome:t,path:n}=e,[r,o]=v.useState(e.defaultValue),{getExtendedProps:s}=v.useContext(vn),[c,u,f,h,m]=v.useMemo(()=>["use","prefix","given","family","suffix"].map(R=>s(e.path+"."+R)),[s,e.path]);function g(R){o(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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(mn,{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:Bt(t,T+".use")}),a.jsx(He,{disabled:e.disabled||u?.readonly,placeholder:"Prefix",name:e.name+"-prefix",defaultValue:r?.prefix?.join(" "),onChange:R=>x(R.currentTarget.value),error:Bt(t,T+".prefix")}),a.jsx(He,{disabled:e.disabled||f?.readonly,placeholder:"Given",name:e.name+"-given",defaultValue:r?.given?.join(" "),onChange:R=>S(R.currentTarget.value),error:Bt(t,T+".given")}),a.jsx(He,{disabled:e.disabled||h?.readonly,name:e.name+"-family",placeholder:"Family",defaultValue:r?.family,onChange:R=>w(R.currentTarget.value),error:Bt(t,T+".family")}),a.jsx(He,{disabled:e.disabled||m?.readonly,placeholder:"Suffix",name:e.name+"-suffix",defaultValue:r?.suffix?.join(" "),onChange:R=>C(R.currentTarget.value),error:Bt(t,T+".suffix")})]})}function hK(e){const[t,n]=v.useState(e.defaultValue),{elementsByPath:r,getExtendedProps:o}=v.useContext(vn),[s,c]=v.useMemo(()=>["system","value"].map(g=>r[e.path+"."+g]),[r,e.path]),[u,f]=v.useMemo(()=>["system","value"].map(g=>o(e.path+"."+g)),[o,e.path]);function h(g){n(g),e.onChange&&e.onChange(g)}const m=e.valuePath??e.path;return a.jsxs(be,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(He,{disabled:e.disabled||u?.readonly,placeholder:"System",required:(s?.min??0)>0,defaultValue:t?.system,onChange:g=>h({...t,system:g.currentTarget.value}),error:Bt(e.outcome,m+".system")}),a.jsx(He,{disabled:e.disabled||f?.readonly,placeholder:"Value",required:(c?.min??0)>0,defaultValue:t?.value,onChange:g=>h({...t,value:g.currentTarget.value}),error:Bt(e.outcome,m+".value")})]})}const pK=["USD","EUR","CAD","GBP","AUD"];function mK(e){const{onChange:t}=e,[n,r]=v.useState(e.defaultValue),{getExtendedProps:o}=v.useContext(vn),[s,c]=v.useMemo(()=>["currency","value"].map(g=>o(e.path+"."+g)),[o,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(mn,{disabled:e.disabled||s?.readonly,defaultValue:n?.currency,data:pK,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:f});return a.jsx(He,{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(eG,{size:14}),rightSection:m,rightSectionWidth:92,onChange:h})}function gK(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(vn),[o,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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Uo,{disabled:e.disabled||o?.readonly,name:e.name+".start",placeholder:"Start",defaultValue:t?.start,onChange:u=>c({...t,start:u})}),a.jsx(Uo,{disabled:e.disabled||s?.readonly,name:e.name+".end",placeholder:"End",defaultValue:t?.end,onChange:u=>c({...t,end:u})})]})}function kl(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(vn),[o,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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(mn,{disabled:e.disabled||o?.readonly,style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t?.comparator,data:["","<","<=",">=",">"],onChange:f=>u({...t,comparator:f.currentTarget.value})}),a.jsx(He,{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:vK(f.currentTarget.value)})}}),a.jsx(He,{disabled:e.disabled||c?.readonly,placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t?.unit,onChange:f=>u({...t,unit:f.currentTarget.value})})]})}function vK(e){if(e)return Number.parseFloat(e)}function WS(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(vn),[o,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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(kl,{path:e.path+".low",disabled:e.disabled||o?.readonly,name:e.name+"-low",defaultValue:t?.low,onChange:u=>c({...t,low:u})}),a.jsx(kl,{path:e.path+".high",disabled:e.disabled||s?.readonly,name:e.name+"-high",defaultValue:t?.high,onChange:u=>c({...t,high:u})})]})}function yK(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(vn),[o,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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(kl,{path:e.path+".numerator",disabled:e.disabled||o?.readonly,name:e.name+"-numerator",defaultValue:t?.numerator,onChange:u=>c({...t,numerator:u})}),a.jsx(kl,{path:e.path+".denominator",disabled:e.disabled||s?.readonly,name:e.name+"-denominator",defaultValue:t?.denominator,onChange:u=>c({...t,denominator:u})})]})}const xK={Device:"device-name",Observation:"code",Subscription:"criteria",User:"email:contains"},bK=["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 SK(e){return{value:Ut(e)??"",label:Ra(e),resource:e}}function ju(e){const t=Te(),{resourceType:n,searchCriteria:r}=e,[o,s]=v.useState(),c=Wt(e.defaultValue,s),u=e.itemComponent??jK,f=e.onChange,h=v.useCallback(async(g,y)=>{const x=wK(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 zn(e.defaultValue)&&!o&&!c?null:a.jsx(US,{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:SK,loadOptions:h,onChange:m,clearable:!0})}const jK=v.forwardRef(({label:e,resource:t,active:n,...r},o)=>a.jsx("div",{ref:o,...r,children:a.jsxs(be,{wrap:"nowrap",children:[a.jsx(yo,{value:t}),a.jsxs("div",{children:[a.jsx(ge,{children:e}),a.jsx(ge,{size:"xs",c:"dimmed",children:t.birthDate||t.id})]})]})}));function wK(e){return xK[e]??(bK.includes(e)?"name":"_id")}function ja(e){const{onChange:t}=e,n=Te(),[r,o]=v.useState(e.defaultValue),[s,c]=v.useState(()=>CK(e.targetTypes)),[u,f]=v.useState(()=>EK(e.defaultValue,s)),h=v.useRef(new JA),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(!RK(w))return Promise.resolve(w);x=!0;const C=w.value,T=h.current.get(C);if(T)return T;const R=TK(n,w.value).then(_=>{const k={...w};return _?zn(_.type)?(k.resourceType=_.type,k.name=_.name,k.title=_.title):(console.error(`StructureDefinition.type missing for ${w.value}`),k.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${w.value}`),k.error="StructureDefinition not found"),k}).catch(_=>(console.error(_),{...w,error:_})),E=new ao(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?rn(x):void 0;o(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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[s&&s.length>1&&a.jsx(mn,{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(FS,{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(ju,{resourceType:u?.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:m,onChange:g,disabled:e.disabled})]})]})}function CK(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 EK(e,t){const n=e?.reference?.split("/")[0];if(n){const r=t?.find(o=>o.resourceType===n);return r||{type:"resourceType",value:n,resourceType:n}}if(t&&t.length>0)return t[0]}async function TK(e,t){const n=yu(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 RK(e){return e.type==="profile"&&!e?.error&&Dn(e.resourceType)}function _K(e,t,n){return t===void 0?e:n===void 0?t:`${t}[${n}]`}const DK="_indented_ldk1d_1",VP={indented:DK};function ug({propertyDisplayName:e,onClick:t,testId:n}){const r=e?`Add ${e}`:"Add";return e?a.jsx(Oe,{title:r,size:"sm",color:"green.6",variant:"subtle","data-testid":n,leftSection:a.jsx(Qd,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(An,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(Qd,{size:"1.25rem"})})}function QS({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(An,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,variant:"subtle",onClick:t,children:a.jsx(Gp,{size:"1.25rem"})})}function AK(e){const{slice:t,property:n}=e,[r,o]=v.useState(e.defaultValue),s=t.typeSchema?.elements??t.elements,c=v.useContext(vn),u=v.useMemo(()=>{if(zn(s))return iu({parentContext:c,elements:s,path:e.path,profileUrl:t.typeSchema?.url})},[c,e.path,t.typeSchema?.url,s]);function f(x){o(x),e.onChange&&e.onChange(x)}const h=t.min>0,m=Dn(t.elements),g=Ak(t.name),y=e.property.readonly&&r.length===0;return cg(vn.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(Pe,{className:m?VP.indented:void 0,children:[r.map((x,S)=>a.jsxs(be,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},"data-testid":e.testId&&`${e.testId}-elements-${S}`,children:a.jsx(YS,{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(QS,{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(be,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(ug,{propertyDisplayName:g,onClick:x=>{jn(x);const S=[...r,void 0];f(S)},testId:e.testId&&`${e.testId}-add`})})]})}))}function kK(e){const{property:t}=e,n=Te(),[r,o]=v.useState(!0),[s,c]=v.useState([]),[u]=v.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[f,h]=v.useState(()=>[u]),m=v.useContext(vn),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);PK(E,R),h(E),o(!1)}).catch(R=>{console.error(R),o(!1)})},[n,t,u,m.profileUrl,h]);function y(R,E){const _=[...f];if(_[E]=R,h(_),e.onChange){const k=_.flat().filter(L=>L!==void 0);e.onChange(k)}}if(r)return a.jsx("div",{children:"Loading..."});const x=s.length,S=f[x],w=!(e.hideNonSliceValues??(g==="Extension"&&s.length>0)),C=_l(t.path),T=e.property.readonly&&s.length===0&&u.length===0;return a.jsxs(Pe,{className:e.indent?VP.indented:void 0,children:[T&&a.jsx(ge,{c:"dimmed",children:"(empty)"}),s.map((R,E)=>a.jsx(AK,{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(be,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Pf,{arrayElement:!0,property:e.property,name:e.name+"."+E,path:e.path,valuePath:_K(e.path,e.valuePath,E),defaultValue:R,onChange:_=>{const k=[...S];k[E]=_,y(k,x)},defaultPropertyType:void 0,outcome:e.outcome})}),!e.property.readonly&&a.jsx(QS,{propertyDisplayName:C,testId:`nonsliced-remove-${E}`,onClick:_=>{jn(_);const k=[...S];k.splice(E,1),y(k,x)}})]},`${E}-${S.length}`)),!e.property.readonly&&w&&f.flat().length<t.max&&a.jsx(be,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(ug,{propertyDisplayName:C,onClick:R=>{jn(R);const E=[...S];E.push(void 0),y(E,x)},testId:"nonsliced-add"})})]})}function PK(e,t){for(let n=0;n<t.length;n++){const r=t[n],o=e[n];for(;o.length<r.min;)o.push(void 0)}}function NK(e){const[t,n]=v.useState(!1),r=t2(),o=v.useRef(null),s={...e.styles};return t||(s.input||(s.input={}),s.input.WebkitTextSecurity="disc"),a.jsxs(or,{gap:"xs",children:[a.jsx(Vl,{...e,styles:{...s,root:{...s.root??{},flexGrow:1}},ref:o,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(An,{title:"Copy secret",onClick:()=>{r.copy(o.current?.value),_e({color:"green",message:"Copied"})},children:a.jsx(OS,{})})]})}const OK=["sun","mon","tue","wed","thu","fri","sat"];function MK(e){const[t,n]=v.useState(e.defaultValue),[r,o]=v.useState(!e.disabled&&(e.defaultModalOpen??!1));return a.jsxs(a.Fragment,{children:[a.jsxs(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx("span",{"data-testid":"timinginput-display",children:Rk(t)||"No repeat"}),a.jsx(Oe,{disabled:e.disabled,onClick:()=>o(!0),children:"Edit"})]}),!e.disabled&&a.jsx(LK,{path:e.path,visible:r,defaultValue:t,onOk:s=>{e.onChange&&e.onChange(s),n(s),o(!1)},onCancel:()=>o(!1)})]})}const wR={repeat:{period:1,periodUnit:"d"}};function LK(e){const[t,n]=v.useState(e.defaultValue||wR),[r,o]=v.useState(()=>(e.defaultValue?.repeat?.timeOfDay??[]).map((E,_)=>({id:_,value:E}))),s=v.useRef(r.length),{getExtendedProps:c}=v.useContext(vn),[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){o(_=>{const k=E(_),L=k.map(D=>D.value);return n(D=>({...D,repeat:{...D.repeat,timeOfDay:L}})),k})}return a.jsx(Mn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(Pe,{gap:"md",children:[a.jsx(Vt,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(Uo,{disabled:u?.readonly,name:"timing-dialog-start",onChange:E=>x(E)})}),a.jsx(xf,{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(be,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(He,{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(mn,{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($d.Group,{multiple:!0,onChange:T,value:t.repeat?.dayOfWeek,children:a.jsx(be,{justify:"space-between",mt:"xs",gap:"xs",children:OK.map(E=>a.jsx($d,{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(Pe,{mt:"xs",children:[r.map((E,_)=>a.jsxs(be,{children:[a.jsx(He,{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:k=>{const L=`${k.currentTarget.value}:00`;R(D=>D.with(_,{...E,value:L}))},style:{flexGrow:1}}),a.jsx(QS,{testId:`timing-repeat-timeOfDay-remove-${_}`,onClick:()=>R(k=>k.toSpliced(_,1))})]},E.id)),a.jsx(le,{children:a.jsx(ug,{propertyDisplayName:"Time of Day",onClick:()=>R(E=>{const _=s.current++;return E.concat({id:_,value:"00:00:00"})})})})]})})]}),a.jsx(be,{justify:"flex-end",children:a.jsx(Oe,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function Pf(e){const{property:t,name:n,onChange:r,defaultValue:o}=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===ie.Attachment)return a.jsx(mY,{name:n,defaultValue:o,onChange:r,disabled:t.readonly});const u=c[0]?.code!==ie.Extension;return a.jsx(kK,{property:t,name:n,path:e.path,valuePath:e.valuePath,defaultValue:o,indent:u,onChange:r,outcome:e.outcome})}else return c.length>1?a.jsx(IK,{elementDefinitionTypes:c,...e}):a.jsx(YS,{name:n,defaultValue:o,onChange:u=>{if(e.onChange){const f=e.name.replace("[x]",Kn(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 IK(e){const t=e.elementDefinitionTypes;let n;e.defaultPropertyType&&(n=t.find(s=>s.code===e.defaultPropertyType)),n||(n=t[0]);const[r,o]=v.useState(n);return a.jsxs(be,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(mn,{disabled:e.property.readonly,style:{width:"200px"},defaultValue:r.code,"data-testid":e.name&&e.name+"-selector",onChange:s=>{o(t.find(c=>c.code===s.currentTarget.value))},data:t.map(s=>({value:s.code,label:s.code}))}),a.jsx(YS,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:s=>{e.onChange&&e.onChange(s,e.name.replace("[x]",Kn(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 YS(e){const{name:t,onChange:n,outcome:r,binding:o,path:s,valuePath:c,readOnly:u}=e,f=e.min!==void 0&&e.min>0,h=e.elementDefinitionType.code,m=v.useContext(vn),g=v.useMemo(()=>{if(!mS(h)||!Dn(e.defaultValue))return e.defaultValue;const S=Object.create(null);if(m.path===e.path)tR(S,m.elements);else{const w=vl(m.path,e.path);if(w===void 0)return e.defaultValue;tR(S,m.elements,w)}return zn(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=Bt(e.outcome,c??s);return{id:t,name:t,"data-testid":t,defaultValue:g,required:f,error:S,disabled:u}}switch(h){case ie.SystemString:case ie.canonical:case ie.string:case ie.uri:case ie.url:return e.path==="Project.secret.value[x]"?a.jsx(NK,{...x(),onChange:S=>{e.onChange&&e.onChange(S.currentTarget.value)}}):a.jsx(He,{...x(),onChange:S=>{n&&n(S.currentTarget.value)}});case ie.date:return a.jsx(He,{...x(),type:"date",onChange:S=>{n&&n(S.currentTarget.value)}});case ie.time:return a.jsx(He,{...x(),type:"time",step:1,onChange:S=>{n&&n(S.currentTarget.value)}});case ie.dateTime:case ie.instant:return a.jsx(Uo,{...x(),onChange:n,outcome:r});case ie.decimal:case ie.integer:case ie.positiveInt:case ie.unsignedInt:return a.jsx(He,{...x(),type:"number",step:h===ie.decimal?"any":"1",onChange:S=>{if(n){const w=S.currentTarget.valueAsNumber;n(Number.isNaN(w)?void 0:w)}}});case ie.code:return a.jsx(SP,{...x(),error:void 0,onChange:n,binding:o?.valueSet,creatable:!0,maxValues:1});case ie.boolean:return a.jsx(hn,{...x(),defaultChecked:!!g,onChange:S=>{n&&n(S.currentTarget.checked)}});case ie.base64Binary:case ie.markdown:case ie.xhtml:return a.jsx(Vl,{...x(),spellCheck:h!==ie.base64Binary,onChange:S=>{n&&n(S.currentTarget.value)}});case ie.Address:return a.jsx(uq,{...y()});case ie.Annotation:return a.jsx(dq,{...y()});case ie.Attachment:return a.jsx(wP,{...y()});case ie.CodeableConcept:return a.jsx(nK,{binding:o?.valueSet,...y()});case ie.Coding:return a.jsx(oK,{binding:o?.valueSet,...y()});case ie.ContactDetail:return a.jsx(lK,{...y()});case ie.ContactPoint:return a.jsx(BP,{...y()});case ie.Extension:return a.jsx(dK,{...y(),propertyType:e.elementDefinitionType});case ie.HumanName:return a.jsx(fK,{...y()});case ie.Identifier:return a.jsx(hK,{...y()});case ie.Money:return a.jsx(mK,{...y()});case ie.Period:return a.jsx(gK,{...y()});case ie.Duration:case ie.Quantity:return a.jsx(kl,{...y()});case ie.Range:return a.jsx(WS,{...y()});case ie.Ratio:return a.jsx(yK,{...y()});case ie.Reference:return a.jsx(ja,{...y(),targetTypes:$K(e.elementDefinitionType)});case ie.Timing:return a.jsx(MK,{...y()});case ie.Dosage:case ie.UsageContext:default:return a.jsx(KS,{...y(),typeName:h})}}const zK=[`${Wi}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function $K(e){return e?.targetProfile?.map(t=>{const n=zK.find(r=>t.startsWith(r));return n?t.slice(n.length):t})}function UK(e){const[t,n]=v.useState(e.defaultValue??{}),r=v.useContext(vn),o=v.useMemo(()=>cq(r.elements),[r.elements]);function s(u){n(u),e.onChange&&e.onChange(u)}const c={type:e.type,value:t};return a.jsx(Pe,{style:{flexGrow:1},"data-testid":e.testId,children:o.map(([u,f])=>{const[h,m]=FY(c,u,f),g=f.min!==void 0&&f.min>0,y=e.valuePath?e.valuePath+"."+u:void 0,x=a.jsx(Pf,{property:f,name:u,path:e.path+"."+u,valuePath:y,defaultValue:h,defaultPropertyType:m,onChange:(S,w)=>{s(eK({...t},u,w??u,f,S))},outcome:e.outcome},u);return e.type==="Extension"||kS.includes(u)?x:f.type.length===1&&f.type[0].code==="boolean"?a.jsx(UP,{title:_l(u),description:f.description,htmlFor:u,fhirPath:f.path,withAsterisk:g,readonly:f.readonly,children:x},u):a.jsx(Vt,{title:_l(u),description:f.description,withAsterisk:g,htmlFor:u,outcome:e.outcome,fhirPath:f.path,errorExpression:y,readonly:f.readonly,children:x},u)})})}const BK="_nested_1ya4k_1",VK={nested:BK};function KS(e){const[t]=v.useState(()=>e.defaultValue??{}),n=v.useContext(vn),r=e.profileUrl??n?.profileUrl,o=v.useMemo(()=>Hm(e.typeName,r),[e.typeName,r]),s=o?.type??e.typeName,c=v.useMemo(()=>{if(o)return iu({parentContext:n,elements:o.elements,path:e.path,profileUrl:o.url,accessPolicyResource:e.accessPolicyResource})},[o,n,e.path,e.accessPolicyResource]);if(!o)return a.jsxs("div",{children:[s," not implemented"]});const u=n.path!=="";return cg(vn.Provider,c,a.jsx(le,{className:Ft({[VK.nested]:u}),children:a.jsx(UK,{path:e.path,valuePath:e.valuePath,type:s,defaultValue:t,onChange:e.onChange,outcome:e.outcome})}))}var Kp=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}},FK=class FP{constructor(t,n,r,o,s,c){this.startPoint=t,this.control2=n,this.control1=r,this.endPoint=o,this.startWidth=s,this.endWidth=c}static fromPoints(t,n){const r=this.calculateControlPoints(t[0],t[1],t[2]).c2,o=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new FP(t[1],r,o,t[2],n.start,n.end)}static calculateControlPoints(t,n,r){const o=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(o*o+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 Kp(f.x+C,f.y+T),c2:new Kp(h.x+C,h.y+T)}}length(){let n=0,r,o;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-o;n+=Math.sqrt(h*h+m*m)}r=u,o=f}return n}point(t,n,r,o,s){return n*(1-t)*(1-t)*(1-t)+3*r*(1-t)*(1-t)*t+3*o*(1-t)*t*t+s*t*t*t}},HK=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 qK(e,t=250){let n=0,r=null,o,s,c;const u=()=>{n=Date.now(),r=null,o=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,o=e.apply(s,c),r||(s=null,c=[])):r||(r=window.setTimeout(u,g)),o}}var GK=class nb extends HK{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?qK(nb.prototype._strokeUpdate,this.throttle):nb.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,o)=>{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=>{o(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 o=this._getPointGroupOptions(),s={...o,points:[]};this._data.push(s),this._reset(o),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],o=r.points,s=o.length>0&&o[o.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),o.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 o=this.canvas.getBoundingClientRect();return new Kp(t-o.left,n-o.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 o=this._calculateCurveWidths(r[1],r[2],n),s=FK.fromPoints(r,o);return r.shift(),s}return null}_calculateCurveWidths(t,n,r){const o=r.velocityFilterWeight*n.velocityFrom(t)+(1-r.velocityFilterWeight)*this._lastVelocity,s=this._strokeWidth(o,r),c={end:s,start:this._lastWidth};return this._lastVelocity=o,this._lastWidth=s,c}_strokeWidth(t,n){return Math.max(n.maxWidth/(t+1),n.minWidth)}_drawCurveSegment(t,n,r){const o=this._ctx;o.moveTo(t,n),o.arc(t,n,r,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,n){const r=this._ctx,o=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*o,n.maxWidth);this._drawCurveSegment(x,S,w)}r.closePath(),r.fill()}_drawDot(t,n){const r=this._ctx,o=n.dotSize>0?n.dotSize:(n.minWidth+n.maxWidth)/2;r.beginPath(),this._drawCurveSegment(t.x,t.y,o),r.closePath(),r.fillStyle=n.penColor,r.fill()}_fromData(t,n,r){for(const o of t){const{points:s}=o,c=this._getPointGroupOptions(o);if(s.length>1)for(let u=0;u<s.length;u+=1){const f=s[u],h=new Kp(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,o=Math.max(window.devicePixelRatio||1,1),s=0,c=0,u=this.canvas.width/o,f=this.canvas.height/o,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 WK(e){const t=Te(),{width:n=500,height:r=200,defaultValue:o,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:Wi+"/fhir/signature-type",code:"ProofOfOrigin",display:"Proof of Origin"}],when:new Date().toISOString(),who:s??rn(t.getProfile()),data:h.current?.toDataURL().split(",")[1]})}if(f.current){const x=new GK(f.current);o?.data&&x.fromDataURL(o.data).catch(console.error),x.addEventListener("endStroke",y),h.current=x}return()=>{h.current&&h.current.removeEventListener("beginStroke",y)}},[t,o,s]);const g=()=>{h.current&&h.current.clear(),m.current?.(void 0)};return a.jsxs(hr,{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(Oe,{onClick:g,"aria-label":"Clear signature",pos:"absolute",top:0,right:0,size:"xs",leftSection:a.jsx(tg,{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($e,{order:3,mb:"md",children:e.item.text}),a.jsx(rb,{formState:e.formState,context:t,items:e.item.item??[],responseItems:e.responseItem.item??[]})]},e.item.linkId)}const jl=30,Xp=50;function Jp(e){const t=e.formState,n=e.item,r=e.responseItem;function o(x){if(t&&e.context)if(n.repeats&&e.index!==void 0&&n.type!==yt.choice&&n.type!==yt.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!==yt.choice&&n.type!==yt.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=JS(r,e.index)??AS(h),g=vo(r,`${Wi}/fhir/StructureDefinition/questionnaire-validationError`);let y=null;switch(s){case yt.display:y=a.jsx("p",{children:e.item.text},e.item.linkId);break;case yt.boolean:y=a.jsx(UP,{title:e.item.text,htmlFor:f,children:a.jsx(hn,{id:f,name:c,required:e.required??n.required,defaultChecked:m?.value,onChange:x=>o([{valueBoolean:x.currentTarget.checked}])})},e.item.linkId);break;case yt.decimal:y=a.jsx(He,{type:"number",step:"any",id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>o(x.currentTarget.value===""?[]:[{valueDecimal:x.currentTarget.valueAsNumber}])});break;case yt.integer:y=a.jsx(He,{type:"number",step:1,id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>o(x.currentTarget.value===""?[]:[{valueInteger:x.currentTarget.valueAsNumber}])});break;case yt.date:y=a.jsx(He,{type:"date",id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>o([{valueDate:x.currentTarget.value}])});break;case yt.dateTime:y=a.jsx(Uo,{name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>o([{valueDateTime:x}])});break;case yt.time:y=a.jsx(He,{type:"time",id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>o([{valueTime:x.currentTarget.value}])});break;case yt.string:case yt.url:y=a.jsx(He,{id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>{const S=x.currentTarget.value;o(S===""?[]:[{valueString:S}])}});break;case yt.text:y=a.jsx(Vl,{id:f,name:c,required:e.required??n.required,defaultValue:m?.value,onChange:x=>{const S=x.currentTarget.value;o(S===""?[]:[{valueString:S}])}});break;case yt.attachment:y=a.jsx(be,{py:4,children:a.jsx(wP,{path:"",name:f,defaultValue:m?.value,onChange:x=>o([{valueAttachment:x}])})});break;case yt.reference:y=a.jsx(ja,{name:f,required:e.required??n.required,targetTypes:Jk(n),searchCriteria:KH(n,t?.subject,t?.encounter),defaultValue:m?.value,onChange:x=>o([{valueReference:x}])});break;case yt.quantity:y=a.jsx(kl,{path:"",name:f,required:e.required??n.required,defaultValue:m?.value,onChange:x=>o([{valueQuantity:x}]),disableWheel:!0});break;case yt.choice:case yt.openChoice:eX(n)?y=a.jsx(XK,{name:f,item:n,required:e.required??n.required,initial:h,response:r,onChangeAnswer:x=>o(x)}):ZK(n)||n.answerValueSet&&!tX(n)?y=a.jsx(QK,{name:f,item:n,required:e.required??n.required,initial:h,response:r,onChangeAnswer:x=>o(x)}):y=a.jsx(KK,{name:f,item:n,required:e.required??n.required,initial:h,response:r,onChangeAnswer:x=>o(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 QK(e){const{name:t,item:n,required:r,initial:o,onChangeAnswer:s,response:c}=e;if(!n.answerOption?.length&&!n.answerValueSet)return a.jsx(XS,{});const u=AS(o),f=JS(c)??u,h=WP(c),m=n.repeats||nX(n);if(n.answerValueSet)return a.jsx(Df,{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}=rX(n);return a.jsx(Mm,{data:y,placeholder:"Select items",searchable:!0,defaultValue:h||[Rl(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=Ho(y);g.push(Rl(x))}return a.jsx(mn,{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=Ho(S),C="value"+Kn(w.type);s([{[C]:w.value}])},defaultValue:Tf(f?.value)||f?.value,data:g})}}function YK(e,t){return e?t.valueSetExpand({url:e,count:jl+1}).then(n=>n.expansion?.contains??[]):Promise.resolve([])}function qP(e){const t=Te(),[n,r]=v.useState([]),[o,s]=v.useState(!1);return v.useEffect(()=>{async function c(){if(e){s(!0);try{const u=await YK(e,t);r(u)}catch(u){console.error("Error loading value set:",u)}finally{s(!1)}}}c().catch(console.error)},[e,t]),[n,o]}function GP(e,t){return e.map((n,r)=>{const o=`${t}-valueset-${r}`,s={type:"Coding",value:{system:n.system,code:n.code,display:n.display}};return[o,s]})}function KK(e){const{name:t,item:n,required:r,initial:o,onChangeAnswer:s,response:c}=e,u=Ms("QuestionnaireItemAnswerOption","value[x]"),f=AS(o),[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,Xp).map((T,R)=>{const E=`${t}-option-${R}`,_=Ho(T);return _?.value?(f&&mo(_)===mo(f)&&(y=E),[E,_]):null}).filter(T=>T!==null);g.push(...C)}const x=JS(c),S=JK(g,x);if(m)return a.jsx(ge,{children:"Loading options..."});if(g.length===0)return a.jsx(XS,{});const w=g.slice(0,jl);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"+Kn(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(go,{property:u,propertyType:T.type,value:T.value})},C))}),(n.answerValueSet&&g.length>jl||n.answerOption&&g.length>Xp)&&a.jsxs(ge,{size:"sm",c:"dimmed",mt:"xs",children:["Showing first ",jl," options"]})]})}function XK(e){const{name:t,item:n,onChangeAnswer:r,response:o}=e,s=Ms("QuestionnaireItemAnswerOption","value[x]"),[c,u]=qP(n.answerValueSet),f=n.answerValueSet?(o?.answer?.map(S=>S.valueCoding)||[]).filter(S=>S!==void 0):WP(o),[h,m]=v.useState(f),g=[];if(n.answerValueSet)g.push(...GP(c,t));else if(n.answerOption){const S=n.answerOption.slice(0,Xp).map((w,C)=>{const T=`${t}-option-${C}`,R=Ho(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(XS,{});const y=g.slice(0,jl),x=(S,w)=>{if(n.answerValueSet){const C=h;let T;w?T=[...C,S.value]:T=C.filter(R=>!Ui(R,S.value)),m(T),T.length===0?r([{}]):r(T.map(R=>({valueCoding:R})))}else{const C=h,T=Rl(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"+Kn(S.type),n);r(E)}}};return a.jsxs(be,{style:{flexDirection:"column",alignItems:"flex-start"},children:[y.map(([S,w])=>{const C=Rl(w),T=n.answerValueSet?h.some(R=>Ui(R,w.value)):h.includes(C);return a.jsx(hn,{id:S,label:a.jsx(go,{property:s,propertyType:w.type,value:w.value}),checked:T,onChange:R=>x(w,R.currentTarget.checked)},S)}),(n.answerValueSet&&g.length>jl||n.answerOption&&g.length>Xp)&&a.jsxs(ge,{size:"sm",c:"dimmed",children:["Showing first ",jl," options"]})]})}function XS(){return a.jsx(He,{disabled:!0,placeholder:"No Answers Defined"})}function JS(e,t=0){return Ho(e?.answer?.[t]??{})}function WP(e){const t=e?.answer;return t?t.map(r=>Ho(r)).map(r=>Tf(r?.value)||r?.value).filter(Boolean):[]}function JK(e,t){return e.find(n=>Ui(n[1].value,t?.value))?.[0]}function dg(e,t){return!!e.extension?.some(n=>n.url===_S&&n.valueCodeableConcept?.coding?.[0]?.code===t)}function ZK(e){return dg(e,"drop-down")}function eX(e){return dg(e,"check-box")}function tX(e){return dg(e,"radio-button")}function nX(e){return dg(e,"multi-select")}function rX(e){if(e.answerOption?.length===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=Ho(t),r="value"+Kn(n.type),o=(e.answerOption??[]).map(s=>{const c=Ho(s),u=Rl(c);return{value:u,label:u}});return{propertyName:r,data:o}}function iX(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(Tt,{onClick:()=>e.formState.onAddGroup(e.context,e.item),children:`Add Group: ${e.item.text}`})]})}function oX(e){const{formState:t,context:n,item:r,responseItem:o}=e,s=r.type!==yt.choice&&r.type!==yt.openChoice,c=o.answer&&o.answer.length>0?o.answer:[{}];return a.jsxs(Vt,{title:e.item.text,withAsterisk:e.item.required,children:[a.jsx(Pe,{gap:"xs",children:c?.map((u,f)=>a.jsx(Jp,{formState:t,context:n,item:r,responseItem:o,index:f},`${r.linkId}-${f}`))}),s&&a.jsx(Tt,{onClick:()=>t.onAddAnswer(n,r),children:"Add Item"})]},e.item.linkId)}function rb(e){const{formState:t,context:n,items:r,responseItems:o}=e;return a.jsx(Pe,{children:r.map((s,c)=>{if(!BH(s,t.questionnaireResponse))return null;if(s.type===yt.display)return a.jsx("p",{children:s.text},`display-${s.id}-${c}`);const u=o.filter(f=>f.linkId===s.linkId);return s.type===yt.group&&s.repeats?a.jsx(iX,{formState:t,context:n,item:s,responseItems:u},`repeating-group-${s.id}-${c}`):s.type===yt.group?a.jsx(HP,{formState:t,context:n,item:s,responseItem:u[0]},`group-${s.id}-${c}`):s.type===yt.boolean?a.jsx(Jp,{formState:t,context:n,item:s,responseItem:u[0],index:0},`boolean-item-${s.id}-${c}`):s.repeats?a.jsx(oX,{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(Jp,{formState:t,context:n,item:s,responseItem:u[0],index:0})},`repeating-item-${s.id}-${c}`)})})}function aX(e){const{formState:t,submitButtonText:n,excludeButtons:r,children:o}=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(nu,{active:c,allowNextStepsSelect:!1,p:6,children:s.map((m,g)=>a.jsx(nu.Step,{label:m.title,children:g===c&&o},m.linkId))}),!r&&a.jsxs(be,{justify:"flex-end",mt:"xl",gap:"xs",children:[u&&a.jsx(Oe,{onClick:t.onPrevPage,children:"Back"}),f&&a.jsx(Oe,{onClick:m=>{m.currentTarget.closest("form").reportValidity()&&t.onNextPage()},children:"Next"}),h&&a.jsx(mr,{children:n??"Submit"})]})]})}function QP(e){const t=Te(),[n,r]=v.useState(!1),o=v.useRef(e);o.current=e;const s=v.useCallback(g=>{r(!1),o.current.onChange?.(g)},[]),c=eq({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:!!vo(c.questionnaire,zH),[c]),h=v.useMemo(()=>c.loading?!1:!!c.questionnaireResponse.extension?.find(g=>g.url===Ep),[c]),m=v.useCallback(()=>{const g=u.current;if(g.loading)return;const y=o.current.onSubmit;if(!y)return;if(f&&!h){r(!0);return}const x=g.questionnaire,S=g.questionnaireResponse,w=o.current.subject;let C=o.current.source;if(!C){const T=t.getProfile();T&&(C=rn(T))}y({...S,questionnaire:x.url??Ut(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($e,{children:c.questionnaire.title}),c.pagination?a.jsx(aX,{formState:c,submitButtonText:e.submitButtonText,excludeButtons:e.excludeButtons,children:a.jsx(rb,{formState:c,context:[],items:c.items,responseItems:c.responseItems})}):a.jsxs(a.Fragment,{children:[a.jsx(rb,{formState:c,context:[],items:c.items,responseItems:c.responseItems}),f&&a.jsxs(Pe,{mt:"md",gap:0,children:[a.jsx(ge,{size:"sm",fw:500,children:"Signature"}),a.jsx(WK,{onChange:c.onChangeSignature}),!h&&n&&a.jsx(ge,{c:"red",size:"sm",children:"Signature is required."})]}),!e.excludeButtons&&a.jsx(be,{justify:"flex-end",mt:"xl",gap:"xs",children:a.jsx(mr,{children:e.submitButtonText??"Submit"})})]})]})}const sX={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 fg(e){const{status:t,...n}=e;return a.jsx(b0,{color:e.color||sX[t],...n,children:t.replaceAll("-"," ")})}const lX="_noteCite_10swh_5",cX="_noteRoot_10swh_10",CR={noteCite:lX,noteRoot:cX};function YP({value:e}){return e?a.jsx(Pe,{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 Gl(e){const{value:t,link:n,...r}=e,[o,s]=v.useState(),c=Wt(t,s);let u;if(o&&!ek(o))u=`[${qe(o)}]`;else if(c)u=Ra(c);else return null;return n?a.jsx(Ct,{to:t,...r,children:u}):a.jsx(ge,{component:"span",...r,children:u})}function kd(e){return a.jsxs(be,{gap:"xs",children:[a.jsx(yo,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(Gl,{value:e.value,link:e.link})]})}const uX="_table_pe9td_1",dX="_criticalRow_pe9td_12",KP={table:uX,criticalRow:dX};ZS.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1,hideSubject:!1};function ZS(e){const t=Te(),n=Wt(e.value),[r,o]=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(o).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(Pe,{children:[a.jsx($e,{children:"Diagnostic Report"}),a.jsx(fX,{value:n,hideSubject:e.hideSubject}),r&&!e.hideSpecimenInfo&&hX(r),n.result&&a.jsx(pX,{hideObservationNotes:e.hideObservationNotes,value:n.result}),s.length>0&&a.jsx(YP,{value:s})]})}function fX({value:e,hideSubject:t=!1}){return a.jsxs(be,{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(kd,{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(kd,{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(kd,{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(fg,{status:e.status})]})]})}function hX(e){return a.jsxs(Pe,{gap:"xs",children:[a.jsx($e,{order:2,size:"h6",children:"Specimens"}),a.jsx(zr,{type:"ordered",children:e?.map(t=>a.jsx(zr.Item,{ml:"sm",children:a.jsxs(be,{gap:20,children:[a.jsxs(be,{gap:5,children:[a.jsx(ge,{fw:500,children:"Collected:"})," ",Nr(t.collection?.collectedDateTime)]}),a.jsxs(be,{gap:5,children:[a.jsx(ge,{fw:500,children:"Received:"})," ",Nr(t.receivedTime)]})]})},`specimen-${t.id}`))})]})}function pX(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(mX,{value:t,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${Ia(t)?t.reference:t.id}`))})}function mX(e){const t=Wt(e.value);if(!t||e.ancestorIds?.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=yX(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(Ct,{to:t,children:a.jsx($o,{value:t.code})})}),a.jsx("td",{children:a.jsx(gX,{value:t})}),a.jsx("td",{children:a.jsx(vX,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx($o,{value:t.interpretation[0]})}),a.jsx("td",{children:t.category&&t.category.length>0&&a.jsx(a.Fragment,{children:t.category.map(o=>a.jsx("div",{children:a.jsx($o,{value:o})},`category-${Cs(o)}`))})}),a.jsx("td",{children:t.performer?.map(o=>a.jsx(Xd,{value:o},o.reference))}),a.jsx("td",{children:t.status&&a.jsx(fg,{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 gX(e){const t=e.value;return a.jsx(a.Fragment,{children:_k(t)})}function vX(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(qS,{value:t}):null}function yX(e){const t=e.interpretation?.[0]?.coding?.[0]?.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}var ax={},va={},ER;function JP(){if(ER)return va;ER=1,Object.defineProperty(va,"__esModule",{value:!0}),va.Pointer=va.escapeToken=va.unescapeToken=void 0;function e(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}va.unescapeToken=e;function t(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}va.escapeToken=t;var n=(function(){function r(o){o===void 0&&(o=[""]),this.tokens=o}return r.fromJSON=function(o){var s=o.split("/").map(e);if(s[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(o));return new r(s)},r.prototype.toString=function(){return this.tokens.map(t).join("/")},r.prototype.evaluate=function(o){for(var s=null,c="",u=o,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(o){return this.evaluate(o).value},r.prototype.set=function(o,s){var c=this.evaluate(o);c.parent&&(c.parent[c.key]=s)},r.prototype.push=function(o){this.tokens.push(o)},r.prototype.add=function(o){var s=this.tokens.concat(String(o));return new r(s)},r})();return va.Pointer=n,va}var En={},sx={},TR;function ZP(){return TR||(TR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.clone=e.objectType=e.hasOwnProperty=void 0,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(o){return o===void 0?"undefined":o===null?"null":Array.isArray(o)?"array":typeof o}e.objectType=t;function n(o){return o!=null&&typeof o=="object"}function r(o){if(!n(o))return o;if(o.constructor==Array){for(var s=o.length,c=new Array(s),u=0;u<s;u++)c[u]=r(o[u]);return c}if(o.constructor==Date){var f=new Date(+o);return f}var h={};for(var m in o)e.hasOwnProperty.call(o,m)&&(h[m]=r(o[m]));return h}e.clone=r})(sx)),sx}var Ir={},RR;function eN(){if(RR)return Ir;RR=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.diffAny=Ir.diffObjects=Ir.diffArrays=Ir.intersection=Ir.subtract=Ir.isDestructive=void 0;var e=ZP();function t(m){var g=m.op;return g==="remove"||g==="replace"||g==="copy"||g==="move"}Ir.isDestructive=t;function n(m,g){var y={};for(var x in m)e.hasOwnProperty.call(m,x)&&m[x]!==void 0&&(y[x]=1);for(var S in g)e.hasOwnProperty.call(g,S)&&g[S]!==void 0&&delete y[S];return Object.keys(y)}Ir.subtract=n;function r(m){for(var g=m.length,y={},x=0;x<g;x++){var S=m[x];for(var w in S)e.hasOwnProperty.call(S,w)&&S[w]!==void 0&&(y[w]=(y[w]||0)+1)}for(var w in y)y[w]<g&&delete y[w];return Object.keys(y)}Ir.intersection=r;function o(m){return m.op==="add"}function s(m){return m.op==="remove"}function c(m,g){return{operations:m.operations.concat(g),cost:m.cost+1}}function u(m,g,y,x){x===void 0&&(x=h);var S={"0,0":{operations:[],cost:0}};function w(_,k){var L="".concat(_,",").concat(k),D=S[L];if(D===void 0){if(_>0&&k>0&&!x(m[_-1],g[k-1],y.add(String(_-1))).length)D=w(_-1,k-1);else{var P=[];if(_>0){var $=w(_-1,k),U={op:"remove",index:_-1};P.push(c($,U))}if(k>0){var W=w(_,k-1),Y={op:"add",index:_-1,value:g[k-1]};P.push(c(W,Y))}if(_>0&&k>0){var ee=w(_-1,k-1),B={op:"replace",index:_-1,original:m[_-1],value:g[k-1]};P.push(c(ee,B))}var G=P.sort(function(M,I){return M.cost-I.cost})[0];D=G}S[L]=D}return D}var C=isNaN(m.length)||m.length<=0?0:m.length,T=isNaN(g.length)||g.length<=0?0:g.length,R=w(C,T).operations,E=R.reduce(function(_,k){var L=_[0],D=_[1];if(o(k)){var P=k.index+1+D,$=P<C+D?String(P):"-",U={op:k.op,path:y.add($).toString(),value:k.value};return[L.concat(U),D+1]}else if(s(k)){var U={op:k.op,path:y.add(String(k.index+D)).toString()};return[L.concat(U),D-1]}else{var W=y.add(String(k.index+D)),Y=x(k.original,k.value,W);return[L.concat.apply(L,Y),D]}},[[],0])[0];return E}Ir.diffArrays=u;function f(m,g,y,x){x===void 0&&(x=h);var S=[];return n(m,g).forEach(function(w){S.push({op:"remove",path:y.add(w).toString()})}),n(g,m).forEach(function(w){S.push({op:"add",path:y.add(w).toString(),value:g[w]})}),r([m,g]).forEach(function(w){S.push.apply(S,x(m[w],g[w],y.add(w)))}),S}Ir.diffObjects=f;function h(m,g,y,x){if(x===void 0&&(x=h),m===g)return[];var S=(0,e.objectType)(m),w=(0,e.objectType)(g);return S=="array"&&w=="array"?u(m,g,y,x):S=="object"&&w=="object"?f(m,g,y,x):[{op:"replace",path:y.toString(),value:g}]}return Ir.diffAny=h,Ir}var _R;function xX(){if(_R)return En;_R=1;var e=En&&En.__extends||(function(){var C=function(T,R){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,_){E.__proto__=_}||function(E,_){for(var k in _)Object.prototype.hasOwnProperty.call(_,k)&&(E[k]=_[k])},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(En,"__esModule",{value:!0}),En.apply=En.InvalidOperationError=En.test=En.copy=En.move=En.replace=En.remove=En.add=En.TestError=En.MissingError=void 0;var t=JP(),n=ZP(),r=eN(),o=(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);En.MissingError=o;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);En.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){var R=t.Pointer.fromJSON(T.path).evaluate(C);return R.parent===void 0?new o(T.path):(c(R.parent,R.key,(0,n.clone)(T.value)),null)}En.add=f;function h(C,T){var R=t.Pointer.fromJSON(T.path).evaluate(C);return R.value===void 0?new o(T.path):(u(R.parent,R.key),null)}En.remove=h;function m(C,T){var R=t.Pointer.fromJSON(T.path).evaluate(C);if(R.parent===null)return new o(T.path);if(Array.isArray(R.parent)){if(parseInt(R.key,10)>=R.parent.length)return new o(T.path)}else if(R.value===void 0)return new o(T.path);return R.parent[R.key]=(0,n.clone)(T.value),null}En.replace=m;function g(C,T){var R=t.Pointer.fromJSON(T.from).evaluate(C);if(R.value===void 0)return new o(T.from);var E=t.Pointer.fromJSON(T.path).evaluate(C);return E.parent===void 0?new o(T.path):(u(R.parent,R.key),c(E.parent,E.key,R.value),null)}En.move=g;function y(C,T){var R=t.Pointer.fromJSON(T.from).evaluate(C);if(R.value===void 0)return new o(T.from);var E=t.Pointer.fromJSON(T.path).evaluate(C);return E.parent===void 0?new o(T.path):(c(E.parent,E.key,(0,n.clone)(R.value)),null)}En.copy=y;function x(C,T){var R=t.Pointer.fromJSON(T.path).evaluate(C);return(0,r.diffAny)(R.value,T.value,new t.Pointer).length?new s(R.value,T.value):null}En.test=x;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);En.InvalidOperationError=S;function w(C,T){switch(T.op){case"add":return f(C,T);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 En.apply=w,En}var DR;function bX(){return DR||(DR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=JP();Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=xX(),r=eN();function o(h,m){return m.map(function(g){return(0,n.apply)(h,g)})}e.applyPatch=o;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)}e.createPatch=c;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}e.createTests=f})(ax)),ax}var tN=bX();const SX="_removed_el5zk_1",jX="_added_el5zk_6",AR={removed:SX,added:jX};function wX(e){const{name:t,path:n,property:r,originalValue:o,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:o&&a.jsx(go,{path:n,property:r,propertyType:o.type,value:o.value,ignoreMissingValues:!0})}),a.jsx(Z.Td,{className:AR.added,children:s&&a.jsx(go,{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(Oe,{onClick:h,variant:"light",children:"Expand"})})]})})}const CX="_root_15xvr_1",EX={root:CX};function TX(e){const t=Te(),{original:n,revised:r}=e,[o,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(!o)return null;const u=[mi(n)],f=[mi(r)],h=[],m=RX(tN.createPatch(n,r));for(const g of m){const y=g.path,x=_X(y),S=DX(n.resourceType,x),w=g.op==="add"?void 0:Es(x,u),C=g.op==="remove"?void 0:Es(x,f);h.push({key:`op-${g.op}-${g.path}`,name:`${Kn(g.op)} ${x}`,path:S?.path??n.resourceType+"."+x,property:S,originalValue:kR(S,w),revisedValue:kR(S,C)})}return h},[o,n,r]);return c?a.jsxs(Z,{className:EX.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(wX,{...h},f)})})]}):null}function RX(e){const t=[];for(const n of e){const{op:r,path:o}=n;if(o.startsWith("/meta/author")||o.startsWith("/meta/compartment")||o.startsWith("/meta/lastUpdated")||o.startsWith("/meta/versionId"))continue;const s=e.filter(u=>u.op===r&&u.path===o).length,c={op:r,path:o};s>1&&(r==="add"||r==="remove")&&/\/[0-9-]+$/.test(o)&&(c.op="replace",c.path=o.replace(/\/[^/]+$/,"")),t.some(u=>u.op===c.op&&u.path===c.path)||t.push(c)}return t}function _X(e){const t=e.split("/").filter(Boolean);let n="";for(let r=0;r<t.length;r++){const o=t[r];o==="-"?n+=".last()":/^\d+$/.test(o)?n+=`[${o}]`:(r>0&&(n+="."),n+=o)}return n.endsWith(".url")&&(n=n.replace(/\.url$/,"")),n}function DX(e,t){try{return Jm(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:AX(t,!!e?.isArray)}}function AX(e,t){const n=VB(e).flatMap(r=>r.value);return t?n:n[0]}function e1(e){const{profileUrl:t}=e,n=Te(),r=n.getAccessPolicy(),o=Wt(e.value),[s,c]=v.useState(!1);v.useEffect(()=>{if(o)if(t)n.requestProfileSchema(t,{expandProfile:!0}).then(()=>{yu(t)?c(!0):console.error(`Schema not found for ${t}`)}).catch(f=>{console.error("Error in requestProfileSchema",f)});else{const f=o.resourceType;n.requestSchema(f).then(()=>{c(!0)}).catch(console.error)}},[n,t,o]);const u=v.useMemo(()=>o&&Ok(o,xl.READ,r),[r,o]);return!s||!o?null:a.jsx(Yp,{path:o.resourceType,value:{type:o.resourceType,value:e.forceUseInput?e.value:o},profileUrl:t,ignoreMissingValues:e.ignoreMissingValues,accessPolicyResource:u})}const kX="_item_5q6yx_1",PX="_itemPadding_5q6yx_5",PR={item:kX,itemPadding:PX};function NX(e){return a.jsx(ql,{children:e.children})}function Pl(e){const{resource:t,profile:n,padding:r,popupMenuItems:o,...s}=e,c=n??t.meta?.author,u=e.dateTime??t.meta?.lastUpdated;return a.jsxs(Is,{"data-testid":"timeline-item",fill:!0,...s,children:[a.jsxs(be,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(yo,{value:c,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(ge,{size:"sm",children:a.jsx(Gl,{c:"inherit",fw:500,value:c,link:!0})}),a.jsxs(ge,{size:"xs",children:[a.jsx(Ct,{c:"dimmed",to:e.resource,children:Nr(u)}),a.jsx(ge,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx(Ct,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&a.jsxs(Se,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(Se.Target,{children:a.jsx(An,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${Ut(e.resource)}`,children:a.jsx(aG,{})})}),o]})]}),a.jsx(IS,{children:a.jsx("div",{className:Ft(PR.item,{[PR.itemPadding]:r}),children:e.children})})]})}function nN(e,t){e.sort((n,r)=>{const o=NR(n,t),s=NR(r,t);return o>s?1:o<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 OX="_pinnedComment_u08s5_1",MX={pinnedComment:OX};function hg(e){const t=Te(),n=t.getProfile(),r=v.useRef(null),o=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(D=>{nN(D,o),D.reverse(),f(D)},[o]),S=v.useCallback(D=>{const P=[];for(const $ of D){if($.status!=="fulfilled")continue;const U=$.value;if(U.type==="history"&&c(U),U.entry)for(const W of U.entry)P.push(W.resource)}x(P)},[x]),w=v.useCallback(D=>x([...y.current,D]),[x]),C=v.useCallback(()=>{let D,P;"resourceType"in e.value?(D=e.value.resourceType,P=e.value.id):[D,P]=e.value.reference?.split("/"),g(t,D,P).then(S).catch(console.error)},[t,e.value,g,S]);v.useEffect(()=>C(),[C]);function T(D){!o||!e.createCommunication||t.createResource(e.createCommunication(o,n,D)).then(P=>w(P)).catch(console.error)}function R(D){!o||!e.createMedia||t.createResource(e.createMedia(o,n,D)).then(P=>w(P)).then(()=>ml({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(Ko,{size:16}),autoClose:2e3})).catch(P=>ml({id:"upload-notification",color:"red",title:"Upload error",message:qe(P),icon:a.jsx(cR,{size:16}),autoClose:2e3}))}function E(){_e({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function _(D){ml({id:"upload-notification",loading:!0,title:"Uploading...",message:VX(D),autoClose:!1,withCloseButton:!1})}function k(D){ml({id:"upload-notification",color:"red",title:"Upload error",message:qe(D),icon:a.jsx(cR,{size:16}),autoClose:2e3})}if(!o)return a.jsx(No,{style:{width:"100%",height:"100%"},children:a.jsx(Pr,{})});const L=u.filter(D=>D).slice(0,h);return a.jsxs(NX,{children:[e.createCommunication&&a.jsx(Is,{children:a.jsx(pt,{testid:"timeline-form",onSubmit:D=>{T(D.text);const P=r.current;P&&(P.value="",P.focus())},children:a.jsxs(be,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(yo,{value:n}),a.jsx(He,{name:"text",ref:r,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(An,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx(IG,{size:16})}),a.jsx(HS,{securityContext:rn(o),onUpload:R,onUploadStart:E,onUploadProgress:_,onUploadError:k,children:D=>a.jsx(An,{...D,radius:"xl",color:"blue",variant:"filled",children:a.jsx(NS,{size:16})})})]})})}),L.map(D=>{const P=`${D.resourceType}/${D.id}/${D.meta?.versionId}`,$=e.getMenu?e.getMenu({primaryResource:o,currentResource:D,reloadTimeline:C}):void 0;if(D.resourceType===o.resourceType&&D.id===o.id)return a.jsx(LX,{history:s,resource:D,popupMenuItems:$},P);switch(D.resourceType){case"AuditEvent":return a.jsx(UX,{resource:D,popupMenuItems:$},P);case"Communication":return a.jsx(zX,{resource:D,popupMenuItems:$},P);case"DiagnosticReport":return a.jsx(BX,{resource:D,popupMenuItems:$},P);case"Media":return a.jsx($X,{resource:D,popupMenuItems:$},P);default:return a.jsx(Pl,{resource:D,padding:!0,children:a.jsx(e1,{value:D,ignoreMissingValues:!0})},P)}}),h<u.length&&a.jsx(be,{justify:"center",pb:"lg",children:a.jsx(Oe,{onClick:()=>m(h+10),children:"Show More"})})]})}function LX(e){const{history:t,resource:n,...r}=e,o=IX(t,n);return o?a.jsx(Pl,{resource:n,padding:!0,...r,children:a.jsx(TX,{original:o,revised:e.resource})}):a.jsxs(Pl,{resource:n,padding:!0,...r,children:[a.jsx("h3",{children:"Created"}),a.jsx(e1,{value:n,ignoreMissingValues:!0,forceUseInput:!0})]})}function IX(e,t){const n=e.entry??[],r=n.findIndex(o=>o.resource?.meta?.versionId===t.meta?.versionId);if(!(r>=n.length-1))return n[r+1].resource}function zX(e){const n=!e.resource.priority||e.resource.priority==="routine"?void 0:MX.pinnedComment;return a.jsx(Pl,{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 $X(e){const t=e.resource.content?.contentType,n=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return a.jsx(Pl,{resource:e.resource,padding:!!n,popupMenuItems:e.popupMenuItems,children:a.jsx(Af,{value:e.resource.content})})}function UX(e){return a.jsx(Pl,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:a.jsx(Zr,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function BX(e){return a.jsx(Pl,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:a.jsx(ZS,{value:e.resource})})}function VX(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${lx(e.loaded)} / ${lx(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${lx(e.loaded)}`}function lx(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 FX(e){const{resource:t,...n}=e;return a.jsx(hg,{value:t,loadTimelineResources:async(r,o,s)=>{const c=`${o}/${s}`;return Promise.allSettled([r.readHistory(o,s),r.search("Task",{_filter:`based-on eq ${c} or focus eq ${c} or subject eq ${c}`,_count:100})])},...n})}function HX(e){const{encounter:t,...n}=e;return a.jsx(hg,{value:t,loadTimelineResources:async(r,o,s)=>Promise.allSettled([r.readHistory("Encounter",s),r.search("Communication","encounter=Encounter/"+s),r.search("Media","encounter=Encounter/"+s)]),createCommunication:(r,o,s)=>({resourceType:"Communication",status:"completed",encounter:rn(r),subject:r.subject,sender:rn(o),sent:new Date().toISOString(),payload:[{contentString:s}]}),createMedia:(r,o,s)=>({resourceType:"Media",status:"completed",encounter:rn(r),subject:r.subject,operator:rn(o),issued:new Date().toISOString(),content:s}),...n})}function qX(e){let t;try{t=OV(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(go,{value:t[0]||"",propertyType:e.propertyType})}function GX(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(Oe,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const WX={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]},QX={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 t1(e,t){return{...e,filters:t,offset:0,name:void 0}}function iN(e,t){return t1(e,(e.filters??[]).filter(n=>n.code!==t))}function pg(e,t,n,r,o){const s=[];return e.filters&&s.push(...e.filters),s.push({code:t,operator:n,value:r??""}),t1(e,s)}function YX(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function KX(e,t){return n1(e,t,-1)}function XX(e,t){return n1(e,t,0)}function JX(e,t){return n1(e,t,1)}function n1(e,t,n){const r=new Date;r.setDate(r.getDate()+n),r.setHours(0,0,0,0);const o=new Date(r.getTime());return o.setDate(o.getDate()+1),o.setTime(o.getTime()-1),mg(e,t,r,o)}function ZX(e,t){const n=new Date,r=new Date(n.getTime()+1440*60*1e3);return mg(e,t,n,r)}function eJ(e,t){return r1(e,t,-1)}function tJ(e,t){return r1(e,t,0)}function nJ(e,t){return r1(e,t,1)}function r1(e,t,n){const r=new Date;r.setMonth(r.getMonth()+n),r.setDate(1),r.setHours(0,0,0,0);const o=new Date(r.getTime());return o.setMonth(o.getMonth()+1),o.setDate(1),o.setHours(0,0,0,0),o.setTime(o.getTime()-1),mg(e,t,r,o)}function rJ(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),mg(e,t,n,new Date)}function mg(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 pg(e,t,n,r.toISOString())}function IR(e,t,n=!0){return pg(e,t,fe.MISSING,n.toString())}function iJ(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function oJ(e,t){const n=e.count??Qm,r=(t-1)*n;return iJ(e,r)}function aJ(e,t,n){return t===sJ(e)&&n!==void 0&&n===lJ(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function sJ(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function lJ(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function cJ(e){return WX[e.type]}function oN(e){return QX[e]??""}function Nl(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(Kn).join(" "))}function uJ(e,t){const n=t.name;return n==="id"?a.jsx(Ct,{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?dJ(e,t.elementDefinition):t.searchParams?.length===1&&t.name===t.searchParams[0].code?fJ(e,t.searchParams[0]):null}function dJ(e,t){const n=t.path?.split(".")?.pop()?.replaceAll("[x]","")??"",[r,o]=lg({type:e.resourceType,value:e},n);return r?a.jsx(go,{path:t.path,property:t,propertyType:o,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function fJ(e,t){const n=Es(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,o)=>a.jsx(go,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${n.length}`))})}function hJ(e){const t=v.useRef(!1),[n,r]=v.useState({search:JSON.parse(mo(e.search))}),[o,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=vS(f);return ru(pJ(h,m)).map(g=>({value:g,label:Nl(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=o},onClick:()=>{t.current||e.onCancel(),t.current=!1},children:a.jsx("div",{"data-testid":"overlay-child"})},children:a.jsxs(Pe,{children:[a.jsx(Mm,{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(be,{justify:"flex-end",children:a.jsx(Oe,{onClick:()=>e.onOk(n.search),children:"OK"})})]})})}function pJ(e,t){const n=[],r=new Set,o=new Set;for(const s of Object.keys(e.elements))n.push(s),r.add(s.toLowerCase()),o.add(Nl(s));if(t)for(const s of Object.keys(t)){const c=Nl(s);!r.has(s)&&!o.has(c)&&(n.push(s),r.add(s),o.add(c))}return n}function aN(e){const t=Jm(e.resourceType,e.searchParam),n=e.name??"filter-value";switch(t.type){case _r.REFERENCE:return a.jsx(ja,{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(hn,{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(He,{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(Uo,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case _r.NUMBER:return a.jsx(He,{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(kl,{name:n,path:"",defaultValue:mJ(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(He,{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 mJ(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:Number.parseFloat(t),system:n,unit:r}}}function gJ(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 o(f){n(pg(r.current,f.code,f.operator,f.value))}const s=e.search.resourceType,c=vS(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(vJ,{id:`filter-${h}-row`,resourceType:s,searchParams:c,value:f,onChange:m=>{const g=[...u];g[h]=m,n(t1(r.current,g))},onDelete:()=>n(YX(r.current,h))},`filter-${h}-row`))})]}),a.jsx(ug,{propertyDisplayName:"Filter",onClick:()=>o({})})]}),a.jsx(be,{justify:"flex-end",mt:"xl",children:a.jsx(mr,{children:"OK"})})]})})}function vJ(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 o(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&&cJ(c);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(mn,{"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:Nl(f)}))]})}),a.jsx("td",{children:u&&a.jsx(mn,{"data-testid":`${e.id}-filter-operation`,defaultValue:t.operator,onChange:f=>o(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(An,{variant:"outline",color:"red",radius:"xl","aria-label":"Delete filter",onClick:e.onDelete,children:a.jsx(Ts,{style:{width:"70%",height:"70%"},stroke:1.5})})})]})}function yJ(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(Oe,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function xJ(e){const{resourceType:t,filter:n}=e,r=Fo.types[t].searchParams?.[n.code];if(r){if(r.type==="reference"&&(n.operator===fe.EQUALS||n.operator===fe.NOT_EQUALS))return a.jsx(Gl,{value:{reference:n.value}});const o=Jm(t,r);if(n.code==="_lastUpdated"||o.type===_r.DATETIME)return a.jsx(a.Fragment,{children:Nr(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function bJ(e){if(!e.searchParams)return null;function t(s,c){o(aJ(e.search,s.code,c))}function n(s){o(iN(e.search,s.code))}function r(s,c){e.onPrompt(s,{code:s.code,operator:c,value:""})}function o(s){e.onChange(s)}return e.searchParams.length===1?a.jsx(SJ,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:o,onClear:n}):a.jsx(Se.Dropdown,{children:e.searchParams.map(s=>a.jsx(Se.Item,{children:Nl(s.code)},s.code))})}function SJ(e){switch(e.searchParam.type){case"date":return a.jsx(jJ,{...e});case"number":case"quantity":return a.jsx(wJ,{...e});case"reference":return a.jsx(CJ,{...e});case"string":return a.jsx(EJ,{...e});case"token":return a.jsx(TJ,{...e});case"uri":return a.jsx(RJ,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function jJ(e){const{searchParam:t}=e,n=t.code;return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Item,{leftSection:a.jsx(MS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(Se.Item,{leftSection:a.jsx(LS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(Se.Item,{leftSection:a.jsx(bu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT_EQUALS),children:"Does not equal..."}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(sP,{size:14}),onClick:()=>e.onPrompt(t,fe.ENDS_BEFORE),children:"Before..."}),a.jsx(Se.Item,{leftSection:a.jsx(aP,{size:14}),onClick:()=>e.onPrompt(t,fe.STARTS_AFTER),children:"After..."}),a.jsx(Se.Item,{leftSection:a.jsx(Dq,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Between..."}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(JX(e.search,n)),children:"Tomorrow"}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(XX(e.search,n)),children:"Today"}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(KX(e.search,n)),children:"Yesterday"}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(ZX(e.search,n)),children:"Next 24 Hours"}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(nJ(e.search,n)),children:"Next Month"}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(tJ(e.search,n)),children:"This Month"}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(eJ(e.search,n)),children:"Last Month"}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(ds,{size:14}),onClick:()=>e.onChange(rJ(e.search,n)),children:"Year to date"}),a.jsx(wu,{...e})]})}function wJ(e){const{searchParam:t}=e;return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Item,{leftSection:a.jsx(MS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(Se.Item,{leftSection:a.jsx(LS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(Se.Item,{leftSection:a.jsx(bu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT_EQUALS),children:"Does not equal..."}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(aP,{size:14}),onClick:()=>e.onPrompt(t,fe.GREATER_THAN),children:"Greater than..."}),a.jsx(Se.Item,{leftSection:a.jsx(eb,{size:14}),onClick:()=>e.onPrompt(t,fe.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(Se.Item,{leftSection:a.jsx(sP,{size:14}),onClick:()=>e.onPrompt(t,fe.LESS_THAN),children:"Less than..."}),a.jsx(Se.Item,{leftSection:a.jsx(eb,{size:14}),onClick:()=>e.onPrompt(t,fe.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx(wu,{...e})]})}function CJ(e){const{searchParam:t}=e;return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(Se.Item,{leftSection:a.jsx(bu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(wu,{...e})]})}function EJ(e){const{searchParam:t}=e;return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Item,{leftSection:a.jsx(MS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(Se.Item,{leftSection:a.jsx(LS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(Se.Item,{leftSection:a.jsx(bu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(Iq,{size:14}),onClick:()=>e.onPrompt(t,fe.CONTAINS),children:"Contains..."}),a.jsx(Se.Item,{leftSection:a.jsx(Mq,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Does not contain..."}),a.jsx(wu,{...e})]})}function TJ(e){const{searchParam:t}=e;return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(Se.Item,{leftSection:a.jsx(bu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.TEXT),children:"Text contains..."}),a.jsx(wu,{...e})]})}function RJ(e){const{searchParam:t}=e;return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Item,{leftSection:a.jsx(Al,{size:14}),onClick:()=>e.onPrompt(t,fe.EQUALS),children:"Equals..."}),a.jsx(Se.Item,{leftSection:a.jsx(bu,{size:14}),onClick:()=>e.onPrompt(t,fe.NOT),children:"Does not equal..."}),a.jsx(wu,{...e})]})}function wu(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(wq,{size:14}),onClick:()=>e.onChange(IR(e.search,n)),children:"Missing"}),a.jsx(Se.Item,{leftSection:a.jsx(Sq,{size:14}),onClick:()=>e.onChange(IR(e.search,n,!1)),children:"Not missing"}),a.jsx(Se.Divider,{}),a.jsx(Se.Item,{leftSection:a.jsx(Ts,{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 _J="_root_vlout_1",DJ="_table_vlout_8",AJ="_tr_vlout_12",kJ="_control_vlout_22",PJ="_icon_vlout_31",yd={root:_J,table:DJ,tr:AJ,control:kJ,icon:PJ};function NJ(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(OJ(t,r));return n}function OJ(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=Ms(e,t),r=iV(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const o=vS(e);let s;if(o){const c=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);s=Object.values(o).filter(u=>!!u.expression&&c.test(u?.expression)),s.length===0&&(s=void 0)}return{name:t,elementDefinition:n,searchParams:s}}if(r){const o=Jm(e,r);return{name:t,elementDefinition:o.elementDefinitions?.[0],searchParams:[r]}}return{name:t}}class MJ extends Event{definition;constructor(t){super("change"),this.definition=t}}class LJ extends Event{response;constructor(t){super("load"),this.response=t}}class Zp extends Event{resource;browserEvent;constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function Wl(e){const t=Te(),[n,r]=v.useState(),{search:o,onLoad:s}=e,[c,u]=v.useState(o);Ui(o,c)||u(o);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,bs({...c,total:g,fields:void 0}),B)).then(G=>{h({...m.current,searchResponse:G}),s&&s(new LJ(G))}).catch(G=>{h({...m.current,searchResponse:void 0}),r(on(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,z={...m.current.selected};I?z[G]=!0:delete z[G],h({...m.current,selected:z})}function w(B){B.stopPropagation();const M=B.target.checked,I={},z=m.current.searchResponse;M&&z?.entry&&z.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 MJ(B))}function R(B,G){if(cP(B.target)||B.button===2)return;jn(B);const M=zS(B);!M&&e.onClick&&e.onClick(new Zp(G,B)),M&&e.onAuxClick&&e.onAuxClick(new Zp(G,B))}function E(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(n)return a.jsx(gr,{outcome:n});if(!ok(c.resourceType))return a.jsx(No,{style:{width:"100%",height:"100%"},children:a.jsx(Pr,{})});const _=e.checkboxesEnabled,k=NJ(c),L=c.resourceType,D=f.searchResponse,$=D?.entry?.map(B=>B.resource),U="subtle",W="gray",Y=16,ee=window.innerWidth<768;return a.jsxs("div",{className:yd.root,"data-testid":"search-control",children:[!e.hideToolbar&&a.jsxs(be,{justify:"space-between",mb:"xl",children:[a.jsxs(be,{gap:2,children:[a.jsx(Oe,{size:"compact-md",variant:U,color:W,leftSection:a.jsx(Xq,{size:Y}),onClick:()=>h({...m.current,fieldEditorVisible:!0,dialogOpenTime:Date.now()}),children:"Fields"}),a.jsx(Oe,{size:"compact-md",variant:U,color:W,leftSection:a.jsx(yG,{size:Y}),onClick:()=>h({...m.current,filterEditorVisible:!0,dialogOpenTime:Date.now()}),children:"Filters"}),e.onNew&&a.jsx(Oe,{size:"compact-md",variant:U,color:W,leftSection:a.jsx(gG,{size:Y}),onClick:e.onNew,children:"New..."}),!ee&&E()&&a.jsx(Oe,{size:"compact-md",variant:U,color:W,leftSection:a.jsx(bW,{size:Y}),onClick:e.onExport?e.onExport:()=>h({...m.current,exportDialogVisible:!0,dialogOpenTime:Date.now()}),children:"Export..."}),!ee&&e.onDelete&&a.jsx(Oe,{size:"compact-md",variant:U,color:W,leftSection:a.jsx(tg,{size:Y}),onClick:()=>e.onDelete(Object.keys(f.selected)),children:"Delete..."}),!ee&&e.onBulk&&a.jsx(Oe,{size:"compact-md",variant:U,color:W,leftSection:a.jsx(Rq,{size:Y}),onClick:()=>e.onBulk(Object.keys(f.selected)),children:"Bulk..."})]}),a.jsxs(be,{gap:2,children:[D&&a.jsxs(ge,{size:"xs",c:"dimmed","data-testid":"count-display",children:[lN(c,D).toLocaleString(),"-",UJ(c,D).toLocaleString(),D.total!==void 0&&` of ${c.total==="estimate"?"~":""}${D.total?.toLocaleString()}`]}),a.jsx(An,{variant:U,color:W,title:"Refresh",onClick:x,children:a.jsx(lP,{size:Y})})]})]}),a.jsxs(Z,{className:yd.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)})}),k.map(B=>a.jsx(Z.Th,{children:a.jsxs(Se,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(Se.Target,{children:a.jsx(_n,{className:yd.control,p:2,children:a.jsxs(be,{justify:"space-between",wrap:"nowrap",children:[a.jsx(ge,{fw:500,children:Nl(B.name)}),a.jsx(No,{className:yd.icon,children:a.jsx(pq,{size:14,stroke:1.5})})]})})}),a.jsx(bJ,{search:c,searchParams:B.searchParams,onPrompt:(G,M)=>{h({...m.current,filterDialogVisible:!0,filterDialogSearchParam:G,filterDialogFilter:M,dialogOpenTime:Date.now()})},onChange:G=>{T(G)}})]})},B.name))]}),!e.hideFilters&&a.jsxs(Z.Tr,{children:[_&&a.jsx(Z.Th,{}),k.map(B=>a.jsx(Z.Th,{children:B.searchParams&&a.jsx(IJ,{resourceType:L,searchParams:B.searchParams,filters:c.filters})},B.name))]})]}),a.jsx(Z.Tbody,{children:$?.map(B=>B&&a.jsxs(Z.Tr,{className:yd.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)})}),k.map(G=>a.jsx(Z.Td,{children:uJ(B,G)},G.name))]},B.id))})]}),!$?.length&&a.jsx(ql,{children:a.jsx(No,{style:{height:150},children:a.jsx(ge,{size:"xl",c:"dimmed",children:"No results"})})}),D&&a.jsx(No,{m:"md",p:"md",children:a.jsx(Gi,{value:zJ(c),total:$J(c,D),onChange:B=>T(oJ(c,B)),getControlProps:sN})}),a.jsx(hJ,{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(gJ,{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(GX,{visible:m.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{h({...m.current,exportDialogVisible:!1})}},`search-export-dialog-${f.dialogOpenTime}`),a.jsx(yJ,{visible:m.current.filterDialogVisible,title:f.filterDialogSearchParam?.code?Nl(f.filterDialogSearchParam.code):"",resourceType:L,searchParam:f.filterDialogSearchParam,filter:f.filterDialogFilter,defaultValue:"",onOk:B=>{T(pg(c,B.code,B.operator,B.value)),h({...m.current,filterDialogVisible:!1})},onCancel:()=>{h({...m.current,filterDialogVisible:!1})}},`search-filter-dialog-${f.dialogOpenTime}`)]})}function IJ(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(xJ,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function zJ(e){return Math.floor((e.offset??0)/(e.count??Qm))+1}function $J(e,t){const n=e.count??Qm,r=cN(e,t);return Math.ceil(r/n)}function lN(e,t){return Math.min(cN(e,t),(e.offset??0)+1)}function UJ(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 BJ(e){const t=Te(),[n,r]=v.useState(!1),[o,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(on(E)))},[t,c]);function S(E,_){E.stopPropagation();const L=E.target.checked,D={...x.current};L?D[_]=!0:delete D[_],g(D)}function w(E){E.stopPropagation();const k=E.target.checked,L={},D=y.current?.data.ResourceList;k&&D&&D.forEach(P=>{P.id&&(L[P.id]=!0)}),g(L)}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 Zp(_,E)),E.button===1&&e.onAuxClick&&e.onAuxClick(new Zp(_,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(qX,{propertyType:_.propertyType,path:_.fhirPath,resource:E})},_.name))]},E.id))})]}),f?.data.ResourceList.length===0&&a.jsx("div",{"data-testid":"empty-search",children:"No results"}),o&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),e.onBulk&&a.jsx(Oe,{onClick:()=>e.onBulk(Object.keys(x.current)),children:"Bulk..."})]})}const VJ=v.memo(BJ),FJ="_root_1fbwr_1",HJ="_entry_1fbwr_8",qJ="_key_1fbwr_13",GJ="_value_1fbwr_20",gg={root:FJ,entry:HJ,key:qJ,value:GJ};function xt(e){return a.jsx(Zr,{children:a.jsx("div",{className:gg.root,children:e.children})})}xt.Entry=function(t){return a.jsx("div",{className:gg.entry,children:t.children})};xt.Key=function(t){return a.jsx("div",{className:gg.key,children:t.children})};xt.Value=function(t){return a.jsx("div",{className:gg.value,children:t.children})};const WJ="_list_y4z6g_1",QJ="_link_y4z6g_6",zR={list:WJ,link:QJ};function Nf(e){const{baseUrl:t,tabs:n,children:r,...o}=e,s=YJ(n),c=xu(),[u,f]=v.useState(()=>{const m=nr.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,...o,children:[a.jsx(bn.List,{className:zR.list,children:s.map(m=>a.jsx(bn.Tab,{value:m.value,children:a.jsx(Tt,{className:zR.link,href:`${t}/${m.value}`,onClick:KJ,children:m.label})},m.value))}),r]})}function YJ(e){return e.map(t=>xk(t)?{label:t,value:t.toLowerCase()}:t)}function KJ(e){zS(e)||e.preventDefault()}function XJ(e){const{group:t}=e;return a.jsx(hr,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(be,{children:[t.measureScore&&a.jsx(eZ,{group:t}),!t.measureScore&&a.jsx(ZJ,{group:t})]})})}function JJ(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 ZJ(e){const{group:t}=e,n=t.population,r=n?.find(f=>Cs(f.code)==="numerator"),o=n?.find(f=>Cs(f.code)==="denominator"),s=r?.count,c=o?.count;if(c===0)return a.jsxs(le,{children:[a.jsx($e,{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($e,{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(Vm,{size:120,thickness:12,roundCaps:!0,sections:[{value:u,color:uN(u)}],label:a.jsx(or,{justify:"center",children:a.jsxs(ge,{fw:700,fz:18,children:[s," / ",c]})})})}function eZ(e){const{group:t}=e,n=t.measureScore?.unit??t.measureScore?.code;return a.jsx(a.Fragment,{children:n==="%"?a.jsx(Vm,{size:120,thickness:12,roundCaps:!0,sections:[{value:tZ(t),color:uN(t?.measureScore?.value??0)}],label:a.jsx(or,{justify:"center",children:a.jsx(ge,{fw:700,fz:18,children:a.jsx(Kd,{value:t.measureScore})})})}):a.jsx(or,{h:120,align:"center",children:a.jsx($e,{order:3,children:a.jsx(Kd,{value:t.measureScore})})})})}function tZ(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 nZ(e){const t=Wt(e.measureReport),[n]=aq("Measure",{url:t?.measure});return t?a.jsxs(le,{children:[n&&a.jsx(JJ,{measure:n}),a.jsx(Fm,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:t.group?.map((r,o)=>a.jsx(XJ,{group:r},r.id??o))})]}):null}const cx="patient-export",ux="Patient Export",rZ={everything:{operation:"$everything",extension:"json",contentType:nn.FHIR_JSON},summary:{operation:"$summary",extension:"json",contentType:nn.FHIR_JSON},ccda:{operation:"$ccda-export",extension:"xml",contentType:nn.CDA_XML},ccdaReferral:{operation:"$ccda-export",type:"referral",extension:"xml",contentType:nn.CDA_XML}};function iZ(e){const t=Te(),{patient:n}=e,r=v.useCallback(async o=>{const s=ws(n),c=o.format,{operation:u,type:f,contentType:h,extension:m}=rZ[c],g=t.fhirUrl("Patient",s,u),y={};f&&(y.type=f),o.author&&(y.author={reference:o.author}),o.authoredOn&&(y.authoredOn=GS(o.authoredOn)),o.startDate&&(y.start=o.startDate),o.endDate&&(y.end=o.endDate),Ii.show({id:cx,title:ux,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}`;oZ(x,S,h),Ii.update({id:cx,title:ux,color:"green",message:"Done",icon:a.jsx(Ko,{size:"1rem"}),loading:!1,autoClose:!0,withCloseButton:!0})}catch(x){Ii.update({id:cx,title:ux,color:"red",message:qe(x),icon:a.jsx(Ts,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})}},[t,n]);return a.jsx(pt,{onSubmit:r,children:a.jsxs(Pe,{children:[a.jsx(Vt,{title:"Export Format",description:"Required",withAsterisk:!0,children:a.jsx(Tl,{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(ja,{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(Uo,{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(Uo,{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(Uo,{name:"endDate",placeholder:"End date"})}),a.jsx(be,{justify:"right",children:a.jsx(mr,{children:"Request Export"})})]})})}function oZ(e,t,n){const r=typeof e=="string"?e:JSON.stringify(e,null,2),o=new Blob([r],{type:n}),s=window.URL.createObjectURL(o),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 aZ(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(xt,{children:[a.jsx(yo,{value:t,size:"lg",color:aZ(t)}),a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Name"}),a.jsx(xt.Value,{children:a.jsx(Ct,{to:t,fw:500,children:t.name?a.jsx($S,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"DoB"}),a.jsx(xt.Value,{children:t.birthDate})]}),a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Age"}),a.jsx(xt.Value,{children:AB(t.birthDate)})]})]}),t.gender&&a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Gender"}),a.jsx(xt.Value,{children:t.gender})]}),t.address&&a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"State"}),a.jsx(xt.Value,{children:t.address[0]?.state})]}),t.identifier?.map(n=>a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:n?.system}),a.jsx(xt.Value,{children:n?.value})]},`${n?.system}-${n?.value}`))]}):null}function sZ(e){const{patient:t,...n}=e,r=v.useCallback((o,s,c)=>{const u=`${s}/${c}`,f=100;return Promise.allSettled([o.readHistory("Patient",c),o.search("Communication",{subject:u,_count:f}),o.search("Device",{patient:u,_count:f}),o.search("DeviceRequest",{patient:u,_count:f}),o.search("DiagnosticReport",{subject:u,_count:f}),o.search("Media",{subject:u,_count:f}),o.search("ServiceRequest",{subject:u,_count:f}),o.search("Task",{subject:u,_count:f})])},[]);return a.jsx(hg,{value:t,loadTimelineResources:r,createCommunication:(o,s,c)=>({resourceType:"Communication",status:"completed",subject:rn(o),sender:rn(s),sent:new Date().toISOString(),payload:[{contentString:c}]}),createMedia:(o,s,c)=>({resourceType:"Media",status:"completed",subject:rn(o),operator:rn(s),issued:new Date().toISOString(),content:c}),...n})}const lZ="_section_pqpwm_1",cZ="_hovering_pqpwm_7",ib={section:lZ,hovering:cZ};function uZ(e){const t=Te(),n=Wt(e.value),[r,o]=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(()=>o(!0)).catch(console.log)},[t]),v.useEffect(()=>(m(mZ(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(He,{label:"Plan Title",py:"md",defaultValue:h.title,onChange:w=>S("title",w.currentTarget.value)}),a.jsx(dZ,{actions:h.action||[],selectedKey:s,setSelectedKey:c,hoverKey:u,setHoverKey:f,onChange:w=>S("action",w)}),a.jsx(mr,{children:"Save"})]})})}function dZ(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 o(s){e.onChange(t.current.filter(c=>c!==s))}return a.jsxs(Pe,{gap:"md",className:ib.section,children:[e.actions.map(s=>a.jsx(fZ,{action:s,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>o(s)},s.id)),a.jsx("div",{children:a.jsx(Oe,{variant:"outline",onClick:s=>{jn(s),r({id:fN()})},children:"Add action"})})]})}function fZ(e){const{action:t}=e;function n(o){o.stopPropagation(),e.setSelectedKey(e.action.id)}function r(o){jn(o),e.setHoverKey(e.action.id)}return a.jsx("div",{onClick:n,onMouseOver:r,onFocus:r,children:a.jsx(hZ,{action:t,onChange:e.onChange,selectedKey:e.selectedKey,hoverKey:e.hoverKey,onRemove:e.onRemove})})}function hZ(e){const{action:t}=e,[n,r]=v.useState(),o=Te(),[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(ib.section,{[ib.hovering]:m&&!h});return v.useEffect(()=>{(async()=>{if(!t.definitionCanonical)return;c(!0);const S=await o.readCanonical(["Questionnaire","ActivityDefinition"],t.definitionCanonical);r(pZ(S)),f(S),c(!1)})().catch(console.error)},[t.definitionCanonical,o]),s?a.jsx(Pr,{}):a.jsxs(hr,{"data-testid":t.id,className:y,p:0,radius:"sm",withBorder:!0,children:[a.jsxs(or,{w:"100%",p:"xs",bg:"gray.0",gap:"md",align:"center",justify:"space-between",children:[a.jsx(He,{w:"100%",name:`actionTitle-${t.id}`,defaultValue:t.title,placeholder:"Title",onChange:x=>g("title",x.currentTarget.value)}),a.jsx(ks,{"data-testid":"close-button",onClick:e.onRemove})]}),h&&a.jsxs(Pe,{gap:"xl",p:"md",children:[a.jsx(le,{children:a.jsx(He,{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(mn,{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(Pe,{gap:0,children:[a.jsxs(be,{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(Tt,{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(Pe,{gap:0,children:[a.jsxs(be,{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(Tt,{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(ju,{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:Ut(r)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function pZ(e){return e===void 0?"standard":e.resourceType.toLowerCase()}let dx=1;function fN(e){if(e){if(e.startsWith("id-")){const t=Number.parseInt(e.substring(3),10);Number.isNaN(t)||(dx=Math.max(dx,t+1))}return e}return"id-"+dx++}function mZ(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 gZ="_section_my8o4_1",vZ="_hovering_my8o4_10",yZ="_editing_my8o4_14",xZ="_questionBody_my8o4_20",bZ="_topActions_my8o4_24",SZ="_bottomActions_my8o4_33",jZ="_movementActions_my8o4_44",wZ="_movementIcons_my8o4_56",CZ="_columnAlignment_my8o4_60",EZ="_linkIdInput_my8o4_65",TZ="_typeSelect_my8o4_70",RZ="_preserveBreaks_my8o4_74",fi={section:gZ,hovering:vZ,editing:yZ,questionBody:xZ,topActions:bZ,bottomActions:SZ,movementActions:jZ,movementIcons:wZ,columnAlignment:CZ,linkIdInput:EZ,typeSelect:TZ,preserveBreaks:RZ};function _Z(e){const t=Te(),n=Wt(e.questionnaire),[r,o]=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(()=>o(!0)).catch(console.log)},[t]),v.useEffect(()=>(c(PZ(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(mr,{children:"Save"})]})})}function pN(e){const t=e.item,n=e.item,r=La(e.item),o=r||n.type===yt.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(k=>k.id===E.id?E:k)})}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 k=MZ(e.item.item,E,_);e.onChange({...e.item,item:k})}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(He,{size:"xl",defaultValue:t.title,onBlur:E=>S("title",E.currentTarget.value)}),!r&&a.jsx(Vl,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:E=>S("text",E.currentTarget.value)}),n.type==="reference"&&a.jsx(kZ,{item:n,onChange:w}),UH(n)&&a.jsx(DZ,{item:n,onChange:E=>w(E)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx($e,{children:t.title}),n.text&&a.jsx("div",{className:fi.preserveBreaks,children:n.text}),!o&&a.jsx(Jp,{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)),!o&&a.jsx("div",{className:fi.topActions,children:c?a.jsxs(a.Fragment,{children:[a.jsx(He,{size:"xs",className:fi.linkIdInput,defaultValue:n.linkId,onBlur:E=>S("linkId",E.currentTarget.value)}),!o&&a.jsx(mn,{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(Tt,{href:"#",onClick:E=>{E.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(xq,{"data-testid":"up-button",size:15,className:fi.movementIcons})}),!e.isLast&&a.jsx(Tt,{href:"#",onClick:E=>{E.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(vq,{"data-testid":"down-button",size:15,className:fi.movementIcons})})]})}),a.jsxs("div",{className:fi.bottomActions,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx(Tt,{href:"#",onClick:E=>{E.preventDefault(),y({id:Ol(),linkId:sb("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx(Tt,{href:"#",onClick:E=>{E.preventDefault(),y({id:Ol(),linkId:sb("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx(Tt,{href:"#",onClick:E=>{E.preventDefault(),y(OZ(),!0)},children:"Add Page"}),c&&!r&&a.jsxs(a.Fragment,{children:[a.jsx(Tt,{href:"#",onClick:E=>{E.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx(Tt,{href:"#",onClick:E=>{E.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function DZ(e){const t=Ms("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(He,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(AZ,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(le,{display:"flex",children:[a.jsx(Tt,{href:"#",onClick:r=>{jn(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:Ol()}]})},children:"Add choice"}),a.jsx(OA,{w:"lg"}),a.jsx(Tt,{href:"#",onClick:r=>{jn(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function AZ(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=lg({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(Pf,{name:"value[x]",path:"Questionnaire.answerOption.value[x]",property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(o,s)=>{const c=[...e.options],u=c.findIndex(f=>f.id===t.id);c[u]={id:t.id,[s]:o},e.onChange({...e.item,answerOption:c})},outcome:void 0},t.id)}),a.jsx("div",{children:a.jsx(Tt,{href:"#",onClick:o=>{jn(o),e.onChange({...e.item,answerOption:e.options.filter(s=>s.id!==t.id)})},children:"Remove"})})]},t.id)})})}function kZ(e){const t=Jk(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(be,{children:[a.jsx(FS,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:o=>{e.onChange(ix(e.item,t.map(s=>s===n?o:s)))}}),a.jsx(Tt,{href:"#",onClick:o=>{jn(o),e.onChange(ix(e.item,t.filter(s=>s!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx(Tt,{href:"#",onClick:n=>{jn(n),e.onChange(ix(e.item,[...t,""]))},children:"Add Resource Type"})]})}let ob=1,ab=1;function sb(e){return e+ob++}function Ol(){return"id-"+ab++}function PZ(e){return{...e,id:e.id||Ol(),item:mN(e.item)}}function mN(e){if(e)return e.forEach(t=>{t.id?.match(/^id-\d+$/)&&(ab=Math.max(ab,Number.parseInt(t.id.substring(3),10)+1)),t.linkId?.match(/^q\d+$/)&&(ob=Math.max(ob,Number.parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||Ol(),item:mN(t.item),answerOption:NZ(t.answerOption)}))}function NZ(e){if(e)return e.map(t=>({...t,id:t.id||Ol()}))}function OZ(){return{id:Ol(),linkId:sb("s"),type:"group",text:"New Page",extension:[{url:_S,valueCodeableConcept:{coding:[{system:"http://hl7.org/fhir/questionnaire-item-control",code:"page"}]}}]}}function MZ(e,t,n){const r=e??[],o=t+n;if(o<0||o>=r.length)return r;const s=[...r];return[s[t],s[o]]=[s[o],s[t]],s}const LZ="_section_4m5it_1",IZ={section:LZ},zZ=["gender","age","gestationalAge","context","appliesTo","category"],$Z={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function UZ(e){e=Object.assign($Z,e);const t=e.definition,[n,r]=v.useState([]),[o,s]=v.useState(1),[c,u]=v.useState(1);return v.useEffect(()=>{const S=FZ(t,u);r(HZ(S.qualifiedInterval||[],s))},[t]),a.jsxs(pt,{testid:"reference-range-editor",onSubmit:f,children:[a.jsx(Pe,{children:n.map(S=>a.jsx(BZ,{unit:GZ(t.quantitativeDetails?.unit),onChange:g,onAdd:y,onRemove:x,onRemoveGroup:m,intervalGroup:S},`group-${S.id}`))}),a.jsx(An,{title:"Add Group",variant:"subtle",size:"sm",onClick:S=>{jn(S),h({id:`group-id-${o}`,filters:{},intervals:[]}),s(w=>w+1)},children:a.jsx(Qd,{})}),a.jsx(be,{justify:"flex-end",children:a.jsx(mr,{children:"Save"})})]});function f(){const S=n.flatMap(w=>w.intervals).filter(w=>!WZ(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 BZ(e){const{intervalGroup:t,unit:n}=e;return a.jsx(ql,{"data-testid":t.id,className:IZ.section,children:a.jsxs(Pe,{gap:"lg",children:[a.jsx(be,{justify:"flex-end",children:a.jsx(An,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{jn(r),e.onRemoveGroup(t)},children:a.jsx(Gp,{})},`remove-group-button-${t.id}`)}),a.jsx(VZ,{intervalGroup:t,onChange:e.onChange}),a.jsx(fn,{}),t.intervals.map(r=>a.jsxs(Pe,{gap:"xs",children:[a.jsxs(be,{children:[a.jsx(He,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:o=>{jn(o),e.onChange(t.id,{...r,condition:o.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(An,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:o=>{jn(o),e.onRemove(t.id,r)},children:a.jsx(Gp,{})},`remove-interval-${r.id}`)]}),a.jsx(WS,{path:"",onChange:o=>{e.onChange(t.id,{...r,range:o})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(An,{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(Qd,{})})]})})}function VZ(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(Pe,{style:{maxWidth:"50%"},children:[a.jsx(be,{children:a.jsx(mn,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:r=>{for(const o of t.intervals){let s=r.currentTarget.value;s===""&&(s=void 0),n(t.id,{...o,gender:s})}}})}),a.jsxs(be,{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(WS,{path:"",name:`age-${t.id}`,defaultValue:t.filters.age,onChange:r=>{for(const o of t.intervals)n(t.id,{...o,age:r})}},`age-${t.id}`)})]}),a.jsx(mn,{data:["","pre-puberty","follicular","midcycle","luteal","postmenopausal"],label:"Endocrine:",defaultValue:t.filters.context?.text||"",onChange:r=>{for(const o of t.intervals){let s=r.currentTarget.value;s===""?(s=void 0,n(t.id,{...o,context:void 0})):n(t.id,{...o,context:{text:s,coding:[{code:s,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),a.jsx(mn,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:r=>{for(const o of t.intervals){const s=r.currentTarget.value;s===""?n(t.id,{...o,category:void 0}):n(t.id,{...o,category:s})}}})]})}function FZ(e,t){const n=e.qualifiedInterval||[];let r=Math.max(...n.map(o=>{const s=Number.parseInt(o.id?.substring(3)||"",10);return Number.isNaN(s)?Number.NEGATIVE_INFINITY:s}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(o=>({...o,id:o.id||`id-${r++}`}))},t(r),e}function HZ(e,t){let n=1;const r={};for(const o of e){const s=qZ(o);s in r||(r[s]={id:`group-id-${n++}`,filters:Object.fromEntries(zZ.map(c=>[c,o[c]])),intervals:[]}),r[s].intervals.push(o)}return t(n),Object.values(r)}function qZ(e){return[`gender=${e.gender}`,`age=${qd(e.age)}`,`gestationalAge=${qd(e.gestationalAge)}`,`context=${e.context?.text}`,`appliesTo=${e.appliesTo?.map(n=>n.text).join("+")}`,`category=${e.category}`].join(":")}function GZ(e){return e&&(BB(e,"http://unitsofmeasure.org")||e.text)}function WZ(e){return e.range?.low?.value===void 0&&e.range?.high?.value===void 0}function QZ(e){const t=Te(),n=Wt(e.value),[r,o]=v.useState(!1),[s,c]=v.useState();if(v.useEffect(()=>{n&&!r&&(t.executeBatch(u(n)).then(c).catch(console.log),o(!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(Fq,{}):a.jsx(pW,{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(Gl,{value:g?.meta?.author})," on ",Nr(g?.meta?.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx(fg,{status:g?.status||"unknown"})]})]}),a.jsxs(Nt.Col,{span:2,p:"md",children:[y&&!x&&a.jsx(Oe,{onClick:()=>e.onStart(g,y),children:"Start"}),y&&x&&a.jsx(Oe,{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===Ut(m.resource))return m.resource}}function gN(e,t){const n=YZ(e,t);return KZ(n,e,t)}function YZ(e,t){const n=e.length,r=t.length,o=n+r+1,s=1+2*o,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<o;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:XZ(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 KZ(e,t,n){const r=[];let o=e;for(o.snake&&(o=o.prev);o?.prev&&o.prev.j>=0;){const s=o.i,c=o.j;o=o.prev;const u=o.i,f=o.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}),o.snake&&(o=o.prev)}return r}function XZ(e){return e&&!e.snake&&e.prev?e.prev:e}function JZ(e){const t=(e.entry??[]).filter(r=>!!r.resource).map(r=>({meta:r.resource?.meta,lines:mo(r.resource,!0).match(/[^\r\n]+/g)})).sort((r,o)=>r.meta.lastUpdated.localeCompare(o.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 ZZ(n,t),eee(n),n}function ZZ(e,t){for(let n=1;n<t.length;n++){const r=gN(t[n-1].lines,t[n].lines);for(const o of r){const s=o.original.position,c=o.original.lines,u=o.revised.lines;if((o.type==="delete"||o.type==="change")&&e.splice(s,c.length),o.type==="insert"||o.type==="change")for(let f=0;f<o.revised.lines.length;f++)e.splice(s+f,0,{id:t[n].meta.versionId,meta:t[n].meta,value:u[f],span:1})}}}function eee(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 tee="_container_1tyf3_1",nee="_root_1tyf3_5",ree="_startRow_1tyf3_20",iee="_normalRow_1tyf3_25",oee="_author_1tyf3_30",aee="_dateTime_1tyf3_34",see="_lineNumber_1tyf3_40",lee="_line_1tyf3_40",cee="_pre_1tyf3_55",ya={container:tee,root:nee,startRow:ree,normalRow:iee,author:oee,dateTime:aee,lineNumber:see,line:lee,pre:cee};function uee(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function dee(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return zc(n,"year");const r=Math.floor(t/2592e3);if(r>0)return zc(r,"month");const o=Math.floor(t/86400);if(o>0)return zc(o,"day");const s=Math.floor(t/3600);if(s>0)return zc(s,"hour");const c=Math.floor(t/60);return c>0?zc(c,"minute"):zc(t,"second")}function zc(e,t){return`${e} ${e===1?t:t+"s"} ago`}function fee(e){const t=Te(),[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 o=n.entry?.[0]?.resource;if(!o)return null;const s=JZ(n);return a.jsx("div",{className:ya.container,children:a.jsx("table",{className:ya.root,children:a.jsx("tbody",{children:s.map((c,u)=>a.jsxs("tr",{className:c.span>0?ya.startRow:ya.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:ya.author,rowSpan:c.span,children:a.jsx(Gl,{value:c.meta.author,link:!0,fz:"xs"})}),a.jsx("td",{className:ya.dateTime,rowSpan:c.span,children:a.jsx(Ct,{to:uee(o,c.meta.versionId),fz:"xs",children:dee(c.meta.lastUpdated)})})]}),a.jsx("td",{className:ya.lineNumber,children:u+1}),a.jsx("td",{className:ya.line,children:a.jsx("pre",{className:ya.pre,children:c.value})})]},"row-"+u))})})})}const hee="_removed_el5zk_1",pee="_added_el5zk_6",UR={removed:hee,added:pee};function mee(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=mo(t,!0).match(/[^\r\n]+/g),o=mo(n,!0).match(/[^\r\n]+/g),s=gN(r,o);return a.jsx("pre",{style:{color:"gray"},children:s.map((c,u)=>a.jsx(gee,{delta:c},"delta"+u))})}function gee(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 vee="_splitButton_1i0gi_1",yee="_menuControl_1i0gi_6",BR={splitButton:vee,menuControl:yee};function em(e){const{outcome:t}=e,n=Te(),r=Wt(e.defaultValue),o=r?.resourceType,[s,c]=v.useState(!1),[u,f]=v.useState(),h=n.getAccessPolicy(),m=kn();v.useEffect(()=>{if(r)if(e.profileUrl){const x=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{const S=yu(x);if(S){c(!0);const w=pH(r,S);f(w)}else console.error(`Schema not found for ${x}`)}).catch(S=>{console.error("Error in requestProfileSchema",S)})}else n.requestSchema(o).then(()=>{f(r),c(!0)}).catch(console.log)},[n,r,o,e.profileUrl]);const g=v.useMemo(()=>r&&Ok(r,xl.READ,h),[h,r]),y=v.useMemo(()=>n.isSuperAdmin()||!h||!zn(u?.resourceType)?!0:hF(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(Pe,{mb:"xl",children:[a.jsx(Vt,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(He,{name:"resourceType",defaultValue:u.resourceType,disabled:!0})}),a.jsx(Vt,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(He,{name:"id",defaultValue:u.id,disabled:!0})})]}),a.jsx(KS,{path:u.resourceType,valuePath:u.resourceType,typeName:o,defaultValue:u,outcome:t,onChange:f,profileUrl:e.profileUrl,accessPolicyResource:g}),a.jsxs(be,{justify:"flex-end",mt:"xl",wrap:"nowrap",gap:0,children:[a.jsx(Oe,{type:"submit",className:Ft((e.onPatch||e.onDelete)&&BR.splitButton),children:r?.id?"Update":"Create"}),(e.onPatch||e.onDelete)&&a.jsxs(Se,{transitionProps:{transition:"pop"},position:"bottom-end",withinPortal:!0,children:[a.jsx(Se.Target,{children:a.jsx(An,{variant:"filled",color:m.primaryColor,size:36,className:BR.menuControl,"aria-label":"More actions",children:a.jsx(PS,{size:14,stroke:1.5})})}),a.jsxs(Se.Dropdown,{children:[e.onPatch&&a.jsx(Se.Item,{leftSection:a.jsx(oP,{size:14,stroke:1.5}),onClick:()=>{e.onPatch(u)},children:"Patch"}),e.onDelete&&a.jsx(Se.Item,{color:"red",leftSection:a.jsx(tg,{size:14,stroke:1.5,color:"red"}),onClick:()=>{e.onDelete(u)},children:"Delete"})]})]})]})]}):a.jsxs(Yo,{color:"red",title:"Permission denied",icon:a.jsx(Ls,{}),children:["Your access level prevents you from editing and creating ",u.resourceType," resources."]})}function xee(e){const t=Te(),[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((o,s)=>a.jsx(bee,{entry:o},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function bee(e){const{response:t,resource:n}=e.entry;return n?a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:a.jsx(kd,{value:n.meta?.author,link:!0})}),a.jsx(Z.Td,{children:Nr(n.meta?.lastUpdated)}),a.jsx(Z.Td,{children:a.jsx(Ct,{to:See(n),children:n.meta?.versionId})})]}):a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:3,children:qe(t?.outcome)})})}function See(e){return`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`}function jee(e){const{serviceRequest:t,...n}=e;return a.jsx(hg,{value:t,loadTimelineResources:async(r,o,s)=>{const c=`${o}/${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,o,s)=>({resourceType:"Communication",status:"completed",basedOn:[rn(r)],subject:r.subject,sender:rn(o),sent:new Date().toISOString(),payload:[{contentString:s}]}),createMedia:(r,o,s)=>({resourceType:"Media",status:"completed",basedOn:[rn(r)],subject:r.subject,operator:rn(o),issued:new Date().toISOString(),content:s}),...n})}function wee(e){const t=Te(),{client:n,patient:r,encounter:o,children:s,...c}=e,u=Wt(r),f=Wt(o);function h(){let m=r,g=o;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={...o,identifier:S})}}t.createResource({resourceType:"SmartAppLaunch",patient:m,encounter:g}).then(y=>{const x=new URL(n.launchUri);x.searchParams.set("iss",gS(t.fhirUrl().toString())),x.searchParams.set("launch",y.id),nr.assign(x.toString())}).catch(y=>_e({color:"red",message:qe(y),autoClose:!1}))}return a.jsx(Tt,{onClick:()=>h(),...c,children:s})}var fx={exports:{}},xd={},hx={exports:{}},px={};var VR;function Cee(){return VR||(VR=1,(function(e){function t(M,I){var z=M.length;M.push(I);e:for(;0<z;){var V=z-1>>>1,K=M[V];if(0<o(K,I))M[V]=I,M[z]=K,z=V;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var I=M[0],z=M.pop();if(z!==I){M[0]=z;e:for(var V=0,K=M.length,O=K>>>1;V<O;){var F=2*(V+1)-1,se=M[F],de=F+1,xe=M[de];if(0>o(se,z))de<K&&0>o(xe,se)?(M[V]=xe,M[de]=z,V=de):(M[V]=se,M[F]=z,V=F);else if(de<K&&0>o(xe,z))M[V]=xe,M[de]=z,V=de;else break e}}return I}function o(M,I){var z=M.sortIndex-I.sortIndex;return z!==0?z:M.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 _(M){for(var I=n(h);I!==null;){if(I.callback===null)r(h);else if(I.startTime<=M)r(h),I.sortIndex=I.expirationTime,t(f,I);else break;I=n(h)}}function k(M){if(w=!1,_(M),!S)if(n(f)!==null)S=!0,L||(L=!0,Y());else{var I=n(h);I!==null&&G(k,I.startTime-M)}}var L=!1,D=-1,P=5,$=-1;function U(){return C?!0:!(e.unstable_now()-$<P)}function W(){if(C=!1,L){var M=e.unstable_now();$=M;var I=!0;try{e:{S=!1,w&&(w=!1,R(D),D=-1),x=!0;var z=y;try{t:{for(_(M),g=n(f);g!==null&&!(g.expirationTime>M&&U());){var V=g.callback;if(typeof V=="function"){g.callback=null,y=g.priorityLevel;var K=V(g.expirationTime<=M);if(M=e.unstable_now(),typeof K=="function"){g.callback=K,_(M),I=!0;break t}g===n(f)&&r(f),_(M)}else r(f);g=n(f)}if(g!==null)I=!0;else{var O=n(h);O!==null&&G(k,O.startTime-M),I=!1}}break e}finally{g=null,y=z,x=!1}I=void 0}}finally{I?Y():L=!1}}}var Y;if(typeof E=="function")Y=function(){E(W)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,B=ee.port2;ee.port1.onmessage=W,Y=function(){B.postMessage(null)}}else Y=function(){T(W,0)};function G(M,I){D=T(function(){M(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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(M){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var z=y;y=I;try{return M()}finally{y=z}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(M,I){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var z=y;y=M;try{return I()}finally{y=z}},e.unstable_scheduleCallback=function(M,I,z){var V=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?V+z:V):z=V,M){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=z+K,M={id:m++,callback:I,priorityLevel:M,startTime:z,expirationTime:K,sortIndex:-1},z>V?(M.sortIndex=z,t(h,M),n(f)===null&&M===n(h)&&(w?(R(D),D=-1):w=!0,G(k,z-V))):(M.sortIndex=K,t(f,M),S||x||(S=!0,L||(L=!0,Y()))),M},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(M){var I=y;return function(){var z=y;y=I;try{return M.apply(this,arguments)}finally{y=z}}}})(px)),px}var FR;function Eee(){return FR||(FR=1,hx.exports=Cee()),hx.exports}var HR;function Tee(){if(HR)return xd;HR=1;var e=Eee(),t=jb(),n=S2();function r(i){var l="https://react.dev/errors/"+i;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 #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function s(i){var l=i,d=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(d=l.return),i=l.return;while(i)}return l.tag===3?d:null}function c(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function u(i){if(i.tag===31){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function f(i){if(s(i)!==i)throw Error(r(188))}function h(i){var l=i.alternate;if(!l){if(l=s(i),l===null)throw Error(r(188));return l!==i?null:i}for(var d=i,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),i;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 A=!1,N=b.child;N;){if(N===d){A=!0,d=b,p=j;break}if(N===p){A=!0,p=b,d=j;break}N=N.sibling}if(!A){for(N=j.child;N;){if(N===d){A=!0,d=j,p=b;break}if(N===p){A=!0,p=j,d=b;break}N=N.sibling}if(!A)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?i:l}function m(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i;for(i=i.child;i!==null;){if(l=m(i),l!==null)return l;i=i.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"),k=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function Y(i){return i===null||typeof i!="object"?null:(i=W&&i[W]||i["@@iterator"],typeof i=="function"?i:null)}var ee=Symbol.for("react.client.reference");function B(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===ee?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case w:return"Fragment";case T:return"Profiler";case C:return"StrictMode";case k:return"Suspense";case L:return"SuspenseList";case $:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case E:return i.displayName||"Context";case R:return(i._context.displayName||"Context")+".Consumer";case _:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case D:return l=i.displayName||null,l!==null?l:B(i.type)||"Memo";case P:l=i._payload,i=i._init;try{return B(i(l))}catch{}}return null}var G=Array.isArray,M=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,z={pending:!1,data:null,method:null,action:null},V=[],K=-1;function O(i){return{current:i}}function F(i){0>K||(i.current=V[K],V[K]=null,K--)}function se(i,l){K++,V[K]=i.current,i.current=l}var de=O(null),xe=O(null),Ce=O(null),we=O(null);function Ye(i,l){switch(se(Ce,l),se(xe,i),se(de,null),l.nodeType){case 9:case 11:i=(i=l.documentElement)&&(i=i.namespaceURI)?AC(i):0;break;default:if(i=l.tagName,l=l.namespaceURI)l=AC(l),i=kC(l,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}F(de),se(de,i)}function De(){F(de),F(xe),F(Ce)}function ht(i){i.memoizedState!==null&&se(we,i);var l=de.current,d=kC(l,i.type);l!==d&&(se(xe,i),se(de,d))}function Rt(i){xe.current===i&&(F(de),F(xe)),we.current===i&&(F(we),dd._currentValue=z)}var at,Ze;function mt(i){if(at===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);at=l&&l[1]||"",Ze=-1<d.stack.indexOf(`
207
+ at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
208
+ `+at+i+Ze}var Dt=!1;function jt(i,l){if(!i||Dt)return"";Dt=!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 ae=ue}Reflect.construct(i,[],ye)}else{try{ye.call()}catch(ue){ae=ue}i.call(ye.prototype)}}else{try{throw Error()}catch(ue){ae=ue}(ye=i())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(ue){if(ue&&ae&&typeof ue.stack=="string")return[ue.stack,ae.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(),A=j[0],N=j[1];if(A&&N){var q=A.split(`
209
+ `),re=N.split(`
210
+ `);for(b=p=0;p<q.length&&!q[p].includes("DetermineComponentFrameRoot");)p++;for(;b<re.length&&!re[b].includes("DetermineComponentFrameRoot");)b++;if(p===q.length||b===re.length)for(p=q.length-1,b=re.length-1;1<=p&&0<=b&&q[p]!==re[b];)b--;for(;1<=p&&0<=b;p--,b--)if(q[p]!==re[b]){if(p!==1||b!==1)do if(p--,b--,0>b||q[p]!==re[b]){var pe=`
211
+ `+q[p].replace(" at new "," at ");return i.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",i.displayName)),pe}while(1<=p&&0<=b);break}}}finally{Dt=!1,Error.prepareStackTrace=d}return(d=i?i.displayName||i.name:"")?mt(d):""}function Ae(i,l){switch(i.tag){case 26:case 27:case 5:return mt(i.type);case 16:return mt("Lazy");case 13:return i.child!==l&&l!==null?mt("Suspense Fallback"):mt("Suspense");case 19:return mt("SuspenseList");case 0:case 15:return jt(i.type,!1);case 11:return jt(i.type.render,!1);case 1:return jt(i.type,!0);case 31:return mt("Activity");default:return""}}function Ne(i){try{var l="",d=null;do l+=Ae(i,d),d=i,i=i.return;while(i);return l}catch(p){return`
212
+ Error generating stack: `+p.message+`
213
+ `+p.stack}}var Me=Object.prototype.hasOwnProperty,Ie=e.unstable_scheduleCallback,it=e.unstable_cancelCallback,et=e.unstable_shouldYield,ft=e.unstable_requestPaint,lt=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,he=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,vt=e.unstable_NormalPriority,_t=e.unstable_LowPriority,Kt=e.unstable_IdlePriority,yn=e.log,an=e.unstable_setDisableYieldValue,Cr=null,Jt=null;function sr(i){if(typeof yn=="function"&&an(i),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Cr,i)}catch{}}var $n=Math.clz32?Math.clz32:xo,xi=Math.log,Xo=Math.LN2;function xo(i){return i>>>=0,i===0?32:31-(xi(i)/Xo|0)|0}var ri=256,bi=262144,bo=4194304;function Ki(i){var l=i&42;if(l!==0)return l;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function So(i,l,d){var p=i.pendingLanes;if(p===0)return 0;var b=0,j=i.suspendedLanes,A=i.pingedLanes;i=i.warmLanes;var N=p&134217727;return N!==0?(p=N&~j,p!==0?b=Ki(p):(A&=N,A!==0?b=Ki(A):d||(d=N&~i,d!==0&&(b=Ki(d))))):(N=p&~j,N!==0?b=Ki(N):A!==0?b=Ki(A):d||(d=p&~i,d!==0&&(b=Ki(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 Xi(i,l){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&l)===0}function $a(i,l){switch(i){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 vr(){var i=bo;return bo<<=1,(bo&62914560)===0&&(bo=4194304),i}function Ji(i){for(var l=[],d=0;31>d;d++)l.push(i);return l}function Ln(i,l){i.pendingLanes|=l,l!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Eu(i,l,d,p,b,j){var A=i.pendingLanes;i.pendingLanes=d,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=d,i.entangledLanes&=d,i.errorRecoveryDisabledLanes&=d,i.shellSuspendCounter=0;var N=i.entanglements,q=i.expirationTimes,re=i.hiddenUpdates;for(d=A&~d;0<d;){var pe=31-$n(d),ye=1<<pe;N[pe]=0,q[pe]=-1;var ae=re[pe];if(ae!==null)for(re[pe]=null,pe=0;pe<ae.length;pe++){var ue=ae[pe];ue!==null&&(ue.lane&=-536870913)}d&=~ye}p!==0&&Tu(i,p,0),j!==0&&b===0&&i.tag!==0&&(i.suspendedLanes|=j&~(A&~l))}function Tu(i,l,d){i.pendingLanes|=l,i.suspendedLanes&=~l;var p=31-$n(l);i.entangledLanes|=l,i.entanglements[p]=i.entanglements[p]|1073741824|d&261930}function H(i,l){var d=i.entangledLanes|=l;for(i=i.entanglements;d;){var p=31-$n(d),b=1<<p;b&l|i[p]&l&&(i[p]|=l),d&=~b}}function X(i,l){var d=l&-l;return d=(d&42)!==0?1:te(d),(d&(i.suspendedLanes|l))!==0?0:d}function te(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function je(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Re(){var i=I.p;return i!==0?i:(i=window.event,i===void 0?32:eE(i.type))}function Ke(i,l){var d=I.p;try{return I.p=i,l()}finally{I.p=d}}var ze=Math.random().toString(36).slice(2),Le="__reactFiber$"+ze,Ve="__reactProps$"+ze,We="__reactContainer$"+ze,ot="__reactEvents$"+ze,tt="__reactListeners$"+ze,Ot="__reactHandles$"+ze,At="__reactResources$"+ze,xn="__reactMarker$"+ze;function Pn(i){delete i[Le],delete i[Ve],delete i[ot],delete i[tt],delete i[Ot]}function st(i){var l=i[Le];if(l)return l;for(var d=i.parentNode;d;){if(l=d[We]||d[Le]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(i=zC(i);i!==null;){if(d=i[Le])return d;i=zC(i)}return l}i=d,d=i.parentNode}return null}function Et(i){if(i=i[Le]||i[We]){var l=i.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return i}return null}function Xn(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i.stateNode;throw Error(r(33))}function Er(i){var l=i[At];return l||(l=i[At]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Nn(i){i[xn]=!0}var Zi=new Set,ii={};function eo(i,l){Si(i,l),Si(i+"Capture",l)}function Si(i,l){for(ii[i]=l,i=0;i<l.length;i++)Zi.add(l[i])}var Jo=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]*$"),Bs={},Vs={};function It(i){return Me.call(Vs,i)?!0:Me.call(Bs,i)?!1:Jo.test(i)?Vs[i]=!0:(Bs[i]=!0,!1)}function qn(i,l,d){if(It(l))if(d===null)i.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":i.removeAttribute(l);return;case"boolean":var p=l.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){i.removeAttribute(l);return}}i.setAttribute(l,""+d)}}function to(i,l,d){if(d===null)i.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttribute(l,""+d)}}function yr(i,l,d,p){if(p===null)i.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(d);return}i.setAttributeNS(l,d,""+p)}}function zt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Fs(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Uf(i,l,d){var p=Object.getOwnPropertyDescriptor(i.constructor.prototype,l);if(!i.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var b=p.get,j=p.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return b.call(this)},set:function(A){d=""+A,j.call(this,A)}}),Object.defineProperty(i,l,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(A){d=""+A},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Ru(i){if(!i._valueTracker){var l=Fs(i)?"checked":"value";i._valueTracker=Uf(i,l,""+i[l])}}function w1(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var d=l.getValue(),p="";return i&&(p=Fs(i)?i.checked?"true":"false":i.value),i=p,i!==d?(l.setValue(i),!0):!1}function Bf(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var bO=/[\n"\\]/g;function ji(i){return i.replace(bO,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Sg(i,l,d,p,b,j,A,N){i.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?i.type=A:i.removeAttribute("type"),l!=null?A==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+zt(l)):i.value!==""+zt(l)&&(i.value=""+zt(l)):A!=="submit"&&A!=="reset"||i.removeAttribute("value"),l!=null?jg(i,A,zt(l)):d!=null?jg(i,A,zt(d)):p!=null&&i.removeAttribute("value"),b==null&&j!=null&&(i.defaultChecked=!!j),b!=null&&(i.checked=b&&typeof b!="function"&&typeof b!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.name=""+zt(N):i.removeAttribute("name")}function C1(i,l,d,p,b,j,A,N){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(i.type=j),l!=null||d!=null){if(!(j!=="submit"&&j!=="reset"||l!=null)){Ru(i);return}d=d!=null?""+zt(d):"",l=l!=null?""+zt(l):d,N||l===i.value||(i.value=l),i.defaultValue=l}p=p??b,p=typeof p!="function"&&typeof p!="symbol"&&!!p,i.checked=N?i.checked:!!p,i.defaultChecked=!!p,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.name=A),Ru(i)}function jg(i,l,d){l==="number"&&Bf(i.ownerDocument)===i||i.defaultValue===""+d||(i.defaultValue=""+d)}function Yl(i,l,d,p){if(i=i.options,l){l={};for(var b=0;b<d.length;b++)l["$"+d[b]]=!0;for(d=0;d<i.length;d++)b=l.hasOwnProperty("$"+i[d].value),i[d].selected!==b&&(i[d].selected=b),b&&p&&(i[d].defaultSelected=!0)}else{for(d=""+zt(d),l=null,b=0;b<i.length;b++){if(i[b].value===d){i[b].selected=!0,p&&(i[b].defaultSelected=!0);return}l!==null||i[b].disabled||(l=i[b])}l!==null&&(l.selected=!0)}}function E1(i,l,d){if(l!=null&&(l=""+zt(l),l!==i.value&&(i.value=l),d==null)){i.defaultValue!==l&&(i.defaultValue=l);return}i.defaultValue=d!=null?""+zt(d):""}function T1(i,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=zt(l),i.defaultValue=d,p=i.textContent,p===d&&p!==""&&p!==null&&(i.value=p),Ru(i)}function Kl(i,l){if(l){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=l;return}}i.textContent=l}var SO=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(i,l,d){var p=l.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="":p?i.setProperty(l,d):typeof d!="number"||d===0||SO.has(l)?l==="float"?i.cssFloat=d:i[l]=(""+d).trim():i[l]=d+"px"}function _1(i,l,d){if(l!=null&&typeof l!="object")throw Error(r(62));if(i=i.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||l!=null&&l.hasOwnProperty(p)||(p.indexOf("--")===0?i.setProperty(p,""):p==="float"?i.cssFloat="":i[p]="");for(var b in l)p=l[b],l.hasOwnProperty(b)&&d[b]!==p&&R1(i,b,p)}else for(var j in l)l.hasOwnProperty(j)&&R1(i,j,l[j])}function wg(i){if(i.indexOf("-")===-1)return!1;switch(i){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 jO=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"]]),wO=/^[\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 Vf(i){return wO.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Zo(){}var Cg=null;function Eg(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Xl=null,Jl=null;function D1(i){var l=Et(i);if(l&&(i=l.stateNode)){var d=i[Ve]||null;e:switch(i=l.stateNode,l.type){case"input":if(Sg(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),l=d.name,d.type==="radio"&&l!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+ji(""+l)+'"][type="radio"]'),l=0;l<d.length;l++){var p=d[l];if(p!==i&&p.form===i.form){var b=p[Ve]||null;if(!b)throw Error(r(90));Sg(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===i.form&&w1(p)}break e;case"textarea":E1(i,d.value,d.defaultValue);break e;case"select":l=d.value,l!=null&&Yl(i,!!d.multiple,l,!1)}}}var Tg=!1;function A1(i,l,d){if(Tg)return i(l,d);Tg=!0;try{var p=i(l);return p}finally{if(Tg=!1,(Xl!==null||Jl!==null)&&(Dh(),Xl&&(l=Xl,i=Jl,Jl=Xl=null,D1(l),i)))for(l=0;l<i.length;l++)D1(i[l])}}function _u(i,l){var d=i.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)||(i=i.type,p=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!p;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(r(231,l,typeof d));return d}var ea=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rg=!1;if(ea)try{var Du={};Object.defineProperty(Du,"passive",{get:function(){Rg=!0}}),window.addEventListener("test",Du,Du),window.removeEventListener("test",Du,Du)}catch{Rg=!1}var Ua=null,_g=null,Ff=null;function k1(){if(Ff)return Ff;var i,l=_g,d=l.length,p,b="value"in Ua?Ua.value:Ua.textContent,j=b.length;for(i=0;i<d&&l[i]===b[i];i++);var A=d-i;for(p=1;p<=A&&l[d-p]===b[j-p];p++);return Ff=b.slice(i,1<p?1-p:void 0)}function Hf(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function qf(){return!0}function P1(){return!1}function Fr(i){function l(d,p,b,j,A){this._reactName=d,this._targetInst=b,this.type=p,this.nativeEvent=j,this.target=A,this.currentTarget=null;for(var N in i)i.hasOwnProperty(N)&&(d=i[N],this[N]=d?d(j):j[N]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?qf: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=qf)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=qf)},persist:function(){},isPersistent:qf}),l}var Hs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gf=Fr(Hs),Au=g({},Hs,{view:0,detail:0}),CO=Fr(Au),Dg,Ag,ku,Wf=g({},Au,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pg,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==ku&&(ku&&i.type==="mousemove"?(Dg=i.screenX-ku.screenX,Ag=i.screenY-ku.screenY):Ag=Dg=0,ku=i),Dg)},movementY:function(i){return"movementY"in i?i.movementY:Ag}}),N1=Fr(Wf),EO=g({},Wf,{dataTransfer:0}),TO=Fr(EO),RO=g({},Au,{relatedTarget:0}),kg=Fr(RO),_O=g({},Hs,{animationName:0,elapsedTime:0,pseudoElement:0}),DO=Fr(_O),AO=g({},Hs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),kO=Fr(AO),PO=g({},Hs,{data:0}),O1=Fr(PO),NO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},OO={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"},MO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LO(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=MO[i])?!!l[i]:!1}function Pg(){return LO}var IO=g({},Au,{key:function(i){if(i.key){var l=NO[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=Hf(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?OO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pg,charCode:function(i){return i.type==="keypress"?Hf(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Hf(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),zO=Fr(IO),$O=g({},Wf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),M1=Fr($O),UO=g({},Au,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pg}),BO=Fr(UO),VO=g({},Hs,{propertyName:0,elapsedTime:0,pseudoElement:0}),FO=Fr(VO),HO=g({},Wf,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),qO=Fr(HO),GO=g({},Hs,{newState:0,oldState:0}),WO=Fr(GO),QO=[9,13,27,32],Ng=ea&&"CompositionEvent"in window,Pu=null;ea&&"documentMode"in document&&(Pu=document.documentMode);var YO=ea&&"TextEvent"in window&&!Pu,L1=ea&&(!Ng||Pu&&8<Pu&&11>=Pu),I1=" ",z1=!1;function $1(i,l){switch(i){case"keyup":return QO.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function U1(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Zl=!1;function KO(i,l){switch(i){case"compositionend":return U1(l);case"keypress":return l.which!==32?null:(z1=!0,I1);case"textInput":return i=l.data,i===I1&&z1?null:i;default:return null}}function XO(i,l){if(Zl)return i==="compositionend"||!Ng&&$1(i,l)?(i=k1(),Ff=_g=Ua=null,Zl=!1,i):null;switch(i){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 JO={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(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!JO[i.type]:l==="textarea"}function V1(i,l,d,p){Xl?Jl?Jl.push(p):Jl=[p]:Xl=p,l=Lh(l,"onChange"),0<l.length&&(d=new Gf("onChange","change",null,d,p),i.push({event:d,listeners:l}))}var Nu=null,Ou=null;function ZO(i){CC(i,0)}function Qf(i){var l=Xn(i);if(w1(l))return i}function F1(i,l){if(i==="change")return l}var H1=!1;if(ea){var Og;if(ea){var Mg="oninput"in document;if(!Mg){var q1=document.createElement("div");q1.setAttribute("oninput","return;"),Mg=typeof q1.oninput=="function"}Og=Mg}else Og=!1;H1=Og&&(!document.documentMode||9<document.documentMode)}function G1(){Nu&&(Nu.detachEvent("onpropertychange",W1),Ou=Nu=null)}function W1(i){if(i.propertyName==="value"&&Qf(Ou)){var l=[];V1(l,Ou,i,Eg(i)),A1(ZO,l)}}function e4(i,l,d){i==="focusin"?(G1(),Nu=l,Ou=d,Nu.attachEvent("onpropertychange",W1)):i==="focusout"&&G1()}function t4(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Qf(Ou)}function n4(i,l){if(i==="click")return Qf(l)}function r4(i,l){if(i==="input"||i==="change")return Qf(l)}function i4(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var oi=typeof Object.is=="function"?Object.is:i4;function Mu(i,l){if(oi(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var d=Object.keys(i),p=Object.keys(l);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var b=d[p];if(!Me.call(l,b)||!oi(i[b],l[b]))return!1}return!0}function Q1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Y1(i,l){var d=Q1(i);i=0;for(var p;d;){if(d.nodeType===3){if(p=i+d.textContent.length,i<=l&&p>=l)return{node:d,offset:l-i};i=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Q1(d)}}function K1(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?K1(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function X1(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var l=Bf(i.document);l instanceof i.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)i=l.contentWindow;else break;l=Bf(i.document)}return l}function Lg(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}var o4=ea&&"documentMode"in document&&11>=document.documentMode,ec=null,Ig=null,Lu=null,zg=!1;function J1(i,l,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;zg||ec==null||ec!==Bf(p)||(p=ec,"selectionStart"in p&&Lg(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}),Lu&&Mu(Lu,p)||(Lu=p,p=Lh(Ig,"onSelect"),0<p.length&&(l=new Gf("onSelect","select",null,l,d),i.push({event:l,listeners:p}),l.target=ec)))}function qs(i,l){var d={};return d[i.toLowerCase()]=l.toLowerCase(),d["Webkit"+i]="webkit"+l,d["Moz"+i]="moz"+l,d}var tc={animationend:qs("Animation","AnimationEnd"),animationiteration:qs("Animation","AnimationIteration"),animationstart:qs("Animation","AnimationStart"),transitionrun:qs("Transition","TransitionRun"),transitionstart:qs("Transition","TransitionStart"),transitioncancel:qs("Transition","TransitionCancel"),transitionend:qs("Transition","TransitionEnd")},$g={},Z1={};ea&&(Z1=document.createElement("div").style,"AnimationEvent"in window||(delete tc.animationend.animation,delete tc.animationiteration.animation,delete tc.animationstart.animation),"TransitionEvent"in window||delete tc.transitionend.transition);function Gs(i){if($g[i])return $g[i];if(!tc[i])return i;var l=tc[i],d;for(d in l)if(l.hasOwnProperty(d)&&d in Z1)return $g[i]=l[d];return i}var ej=Gs("animationend"),tj=Gs("animationiteration"),nj=Gs("animationstart"),a4=Gs("transitionrun"),s4=Gs("transitionstart"),l4=Gs("transitioncancel"),rj=Gs("transitionend"),ij=new Map,Ug="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(" ");Ug.push("scrollEnd");function no(i,l){ij.set(i,l),eo(l,[i])}var Yf=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},wi=[],nc=0,Bg=0;function Kf(){for(var i=nc,l=Bg=nc=0;l<i;){var d=wi[l];wi[l++]=null;var p=wi[l];wi[l++]=null;var b=wi[l];wi[l++]=null;var j=wi[l];if(wi[l++]=null,p!==null&&b!==null){var A=p.pending;A===null?b.next=b:(b.next=A.next,A.next=b),p.pending=b}j!==0&&oj(d,b,j)}}function Xf(i,l,d,p){wi[nc++]=i,wi[nc++]=l,wi[nc++]=d,wi[nc++]=p,Bg|=p,i.lanes|=p,i=i.alternate,i!==null&&(i.lanes|=p)}function Vg(i,l,d,p){return Xf(i,l,d,p),Jf(i)}function Ws(i,l){return Xf(i,null,null,l),Jf(i)}function oj(i,l,d){i.lanes|=d;var p=i.alternate;p!==null&&(p.lanes|=d);for(var b=!1,j=i.return;j!==null;)j.childLanes|=d,p=j.alternate,p!==null&&(p.childLanes|=d),j.tag===22&&(i=j.stateNode,i===null||i._visibility&1||(b=!0)),i=j,j=j.return;return i.tag===3?(j=i.stateNode,b&&l!==null&&(b=31-$n(d),i=j.hiddenUpdates,p=i[b],p===null?i[b]=[l]:p.push(l),l.lane=d|536870912),j):null}function Jf(i){if(50<id)throw id=0,Xv=null,Error(r(185));for(var l=i.return;l!==null;)i=l,l=i.return;return i.tag===3?i.stateNode:null}var rc={};function c4(i,l,d,p){this.tag=i,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(i,l,d,p){return new c4(i,l,d,p)}function Fg(i){return i=i.prototype,!(!i||!i.isReactComponent)}function ta(i,l){var d=i.alternate;return d===null?(d=ai(i.tag,l,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=l,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&65011712,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,l=i.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d.refCleanup=i.refCleanup,d}function aj(i,l){i.flags&=65011714;var d=i.alternate;return d===null?(i.childLanes=0,i.lanes=l,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,l=d.dependencies,i.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),i}function Zf(i,l,d,p,b,j){var A=0;if(p=i,typeof i=="function")Fg(i)&&(A=1);else if(typeof i=="string")A=p3(i,d,de.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case $:return i=ai(31,d,l,b),i.elementType=$,i.lanes=j,i;case w:return Qs(d.children,b,j,l);case C:A=8,b|=24;break;case T:return i=ai(12,d,l,b|2),i.elementType=T,i.lanes=j,i;case k:return i=ai(13,d,l,b),i.elementType=k,i.lanes=j,i;case L:return i=ai(19,d,l,b),i.elementType=L,i.lanes=j,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:A=10;break e;case R:A=9;break e;case _:A=11;break e;case D:A=14;break e;case P:A=16,p=null;break e}A=29,d=Error(r(130,i===null?"null":typeof i,"")),p=null}return l=ai(A,d,l,b),l.elementType=i,l.type=p,l.lanes=j,l}function Qs(i,l,d,p){return i=ai(7,i,p,l),i.lanes=d,i}function Hg(i,l,d){return i=ai(6,i,null,l),i.lanes=d,i}function sj(i){var l=ai(18,null,null,0);return l.stateNode=i,l}function qg(i,l,d){return l=ai(4,i.children!==null?i.children:[],i.key,l),l.lanes=d,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}var lj=new WeakMap;function Ci(i,l){if(typeof i=="object"&&i!==null){var d=lj.get(i);return d!==void 0?d:(l={value:i,source:l,stack:Ne(l)},lj.set(i,l),l)}return{value:i,source:l,stack:Ne(l)}}var ic=[],oc=0,eh=null,Iu=0,Ei=[],Ti=0,Ba=null,jo=1,wo="";function na(i,l){ic[oc++]=Iu,ic[oc++]=eh,eh=i,Iu=l}function cj(i,l,d){Ei[Ti++]=jo,Ei[Ti++]=wo,Ei[Ti++]=Ba,Ba=i;var p=jo;i=wo;var b=32-$n(p)-1;p&=~(1<<b),d+=1;var j=32-$n(l)+b;if(30<j){var A=b-b%5;j=(p&(1<<A)-1).toString(32),p>>=A,b-=A,jo=1<<32-$n(l)+b|d<<b|p,wo=j+i}else jo=1<<j|d<<b|p,wo=i}function Gg(i){i.return!==null&&(na(i,1),cj(i,1,0))}function Wg(i){for(;i===eh;)eh=ic[--oc],ic[oc]=null,Iu=ic[--oc],ic[oc]=null;for(;i===Ba;)Ba=Ei[--Ti],Ei[Ti]=null,wo=Ei[--Ti],Ei[Ti]=null,jo=Ei[--Ti],Ei[Ti]=null}function uj(i,l){Ei[Ti++]=jo,Ei[Ti++]=wo,Ei[Ti++]=Ba,jo=l.id,wo=l.overflow,Ba=i}var xr=null,wn=null,$t=!1,Va=null,Ri=!1,Qg=Error(r(519));function Fa(i){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zu(Ci(l,i)),Qg}function dj(i){var l=i.stateNode,d=i.type,p=i.memoizedProps;switch(l[Le]=i,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<ad.length;d++)Pt(ad[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=Zo),l=!0):l=!1,l||Fa(i,!0)}function fj(i){for(xr=i.return;xr;)switch(xr.tag){case 5:case 31:case 13:Ri=!1;return;case 27:case 3:Ri=!0;return;default:xr=xr.return}}function ac(i){if(i!==xr)return!1;if(!$t)return fj(i),$t=!0,!1;var l=i.tag,d;if((d=l!==3&&l!==27)&&((d=l===5)&&(d=i.type,d=!(d!=="form"&&d!=="button")||fy(i.type,i.memoizedProps)),d=!d),d&&wn&&Fa(i),fj(i),l===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));wn=IC(i)}else if(l===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));wn=IC(i)}else l===27?(l=wn,rs(i.type)?(i=vy,vy=null,wn=i):wn=l):wn=xr?Di(i.stateNode.nextSibling):null;return!0}function Ys(){wn=xr=null,$t=!1}function Yg(){var i=Va;return i!==null&&(Wr===null?Wr=i:Wr.push.apply(Wr,i),Va=null),i}function zu(i){Va===null?Va=[i]:Va.push(i)}var Kg=O(null),Ks=null,ra=null;function Ha(i,l,d){se(Kg,l._currentValue),l._currentValue=d}function ia(i){i._currentValue=Kg.current,F(Kg)}function Xg(i,l,d){for(;i!==null;){var p=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,p!==null&&(p.childLanes|=l)):p!==null&&(p.childLanes&l)!==l&&(p.childLanes|=l),i===d)break;i=i.return}}function Jg(i,l,d,p){var b=i.child;for(b!==null&&(b.return=i);b!==null;){var j=b.dependencies;if(j!==null){var A=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),Xg(j.return,d,i),p||(A=null);break e}j=N.next}}else if(b.tag===18){if(A=b.return,A===null)throw Error(r(341));A.lanes|=d,j=A.alternate,j!==null&&(j.lanes|=d),Xg(A,d,i),A=null}else A=b.child;if(A!==null)A.return=b;else for(A=b;A!==null;){if(A===i){A=null;break}if(b=A.sibling,b!==null){b.return=A.return,A=b;break}A=A.return}b=A}}function sc(i,l,d,p){i=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 A=b.alternate;if(A===null)throw Error(r(387));if(A=A.memoizedProps,A!==null){var N=b.type;oi(b.pendingProps.value,A.value)||(i!==null?i.push(N):i=[N])}}else if(b===we.current){if(A=b.alternate,A===null)throw Error(r(387));A.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(i!==null?i.push(dd):i=[dd])}b=b.return}i!==null&&Jg(l,i,d,p),l.flags|=262144}function th(i){for(i=i.firstContext;i!==null;){if(!oi(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Xs(i){Ks=i,ra=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function br(i){return hj(Ks,i)}function nh(i,l){return Ks===null&&Xs(i),hj(i,l)}function hj(i,l){var d=l._currentValue;if(l={context:l,memoizedValue:d,next:null},ra===null){if(i===null)throw Error(r(308));ra=l,i.dependencies={lanes:0,firstContext:l},i.flags|=524288}else ra=ra.next=l;return d}var u4=typeof AbortController<"u"?AbortController:function(){var i=[],l=this.signal={aborted:!1,addEventListener:function(d,p){i.push(p)}};this.abort=function(){l.aborted=!0,i.forEach(function(d){return d()})}},d4=e.unstable_scheduleCallback,f4=e.unstable_NormalPriority,Jn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zg(){return{controller:new u4,data:new Map,refCount:0}}function $u(i){i.refCount--,i.refCount===0&&d4(f4,function(){i.controller.abort()})}var Uu=null,ev=0,lc=0,cc=null;function h4(i,l){if(Uu===null){var d=Uu=[];ev=0,lc=ry(),cc={status:"pending",value:void 0,then:function(p){d.push(p)}}}return ev++,l.then(pj,pj),l}function pj(){if(--ev===0&&Uu!==null){cc!==null&&(cc.status="fulfilled");var i=Uu;Uu=null,lc=0,cc=null;for(var l=0;l<i.length;l++)(0,i[l])()}}function p4(i,l){var d=[],p={status:"pending",value:null,reason:null,then:function(b){d.push(b)}};return i.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=M.S;M.S=function(i,l){Jw=lt(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&h4(i,l),mj!==null&&mj(i,l)};var Js=O(null);function tv(){var i=Js.current;return i!==null?i:un.pooledCache}function rh(i,l){l===null?se(Js,Js.current):se(Js,l.pool)}function gj(){var i=tv();return i===null?null:{parent:Jn._currentValue,pool:i}}var uc=Error(r(460)),nv=Error(r(474)),ih=Error(r(542)),oh={then:function(){}};function vj(i){return i=i.status,i==="fulfilled"||i==="rejected"}function yj(i,l,d){switch(d=i[d],d===void 0?i.push(l):d!==l&&(l.then(Zo,Zo),l=d),l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,bj(i),i;default:if(typeof l.status=="string")l.then(Zo,Zo);else{if(i=un,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=l,i.status="pending",i.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 i=l.reason,bj(i),i}throw el=l,uc}}function Zs(i){try{var l=i._init;return l(i._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(el=d,uc):d}}var el=null;function xj(){if(el===null)throw Error(r(459));var i=el;return el=null,i}function bj(i){if(i===uc||i===ih)throw Error(r(483))}var dc=null,Bu=0;function ah(i){var l=Bu;return Bu+=1,dc===null&&(dc=[]),yj(dc,i,l)}function Vu(i,l){l=l.props.ref,i.ref=l!==void 0?l:null}function sh(i,l){throw l.$$typeof===y?Error(r(525)):(i=Object.prototype.toString.call(l),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i)))}function Sj(i){function l(J,Q){if(i){var ne=J.deletions;ne===null?(J.deletions=[Q],J.flags|=16):ne.push(Q)}}function d(J,Q){if(!i)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=ta(J,Q),J.index=0,J.sibling=null,J}function j(J,Q,ne){return J.index=ne,i?(ne=J.alternate,ne!==null?(ne=ne.index,ne<Q?(J.flags|=67108866,Q):ne):(J.flags|=67108866,Q)):(J.flags|=1048576,Q)}function A(J){return i&&J.alternate===null&&(J.flags|=67108866),J}function N(J,Q,ne,me){return Q===null||Q.tag!==6?(Q=Hg(ne,J.mode,me),Q.return=J,Q):(Q=b(Q,ne),Q.return=J,Q)}function q(J,Q,ne,me){var nt=ne.type;return nt===w?pe(J,Q,ne.props.children,me,ne.key):Q!==null&&(Q.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===P&&Zs(nt)===Q.type)?(Q=b(Q,ne.props),Vu(Q,ne),Q.return=J,Q):(Q=Zf(ne.type,ne.key,ne.props,null,J.mode,me),Vu(Q,ne),Q.return=J,Q)}function re(J,Q,ne,me){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ne.containerInfo||Q.stateNode.implementation!==ne.implementation?(Q=qg(ne,J.mode,me),Q.return=J,Q):(Q=b(Q,ne.children||[]),Q.return=J,Q)}function pe(J,Q,ne,me,nt){return Q===null||Q.tag!==7?(Q=Qs(ne,J.mode,me,nt),Q.return=J,Q):(Q=b(Q,ne),Q.return=J,Q)}function ye(J,Q,ne){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Hg(""+Q,J.mode,ne),Q.return=J,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return ne=Zf(Q.type,Q.key,Q.props,null,J.mode,ne),Vu(ne,Q),ne.return=J,ne;case S:return Q=qg(Q,J.mode,ne),Q.return=J,Q;case P:return Q=Zs(Q),ye(J,Q,ne)}if(G(Q)||Y(Q))return Q=Qs(Q,J.mode,ne,null),Q.return=J,Q;if(typeof Q.then=="function")return ye(J,ah(Q),ne);if(Q.$$typeof===E)return ye(J,nh(J,Q),ne);sh(J,Q)}return null}function ae(J,Q,ne,me){var nt=Q!==null?Q.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return nt!==null?null:N(J,Q,""+ne,me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return ne.key===nt?q(J,Q,ne,me):null;case S:return ne.key===nt?re(J,Q,ne,me):null;case P:return ne=Zs(ne),ae(J,Q,ne,me)}if(G(ne)||Y(ne))return nt!==null?null:pe(J,Q,ne,me,null);if(typeof ne.then=="function")return ae(J,Q,ah(ne),me);if(ne.$$typeof===E)return ae(J,Q,nh(J,ne),me);sh(J,ne)}return null}function ue(J,Q,ne,me,nt){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return J=J.get(ne)||null,N(Q,J,""+me,nt);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case x:return J=J.get(me.key===null?ne:me.key)||null,q(Q,J,me,nt);case S:return J=J.get(me.key===null?ne:me.key)||null,re(Q,J,me,nt);case P:return me=Zs(me),ue(J,Q,ne,me,nt)}if(G(me)||Y(me))return J=J.get(ne)||null,pe(Q,J,me,nt,null);if(typeof me.then=="function")return ue(J,Q,ne,ah(me),nt);if(me.$$typeof===E)return ue(J,Q,ne,nh(Q,me),nt);sh(Q,me)}return null}function Ge(J,Q,ne,me){for(var nt=null,qt=null,Xe=Q,wt=Q=0,Lt=null;Xe!==null&&wt<ne.length;wt++){Xe.index>wt?(Lt=Xe,Xe=null):Lt=Xe.sibling;var Gt=ae(J,Xe,ne[wt],me);if(Gt===null){Xe===null&&(Xe=Lt);break}i&&Xe&&Gt.alternate===null&&l(J,Xe),Q=j(Gt,Q,wt),qt===null?nt=Gt:qt.sibling=Gt,qt=Gt,Xe=Lt}if(wt===ne.length)return d(J,Xe),$t&&na(J,wt),nt;if(Xe===null){for(;wt<ne.length;wt++)Xe=ye(J,ne[wt],me),Xe!==null&&(Q=j(Xe,Q,wt),qt===null?nt=Xe:qt.sibling=Xe,qt=Xe);return $t&&na(J,wt),nt}for(Xe=p(Xe);wt<ne.length;wt++)Lt=ue(Xe,J,wt,ne[wt],me),Lt!==null&&(i&&Lt.alternate!==null&&Xe.delete(Lt.key===null?wt:Lt.key),Q=j(Lt,Q,wt),qt===null?nt=Lt:qt.sibling=Lt,qt=Lt);return i&&Xe.forEach(function(ls){return l(J,ls)}),$t&&na(J,wt),nt}function ct(J,Q,ne,me){if(ne==null)throw Error(r(151));for(var nt=null,qt=null,Xe=Q,wt=Q=0,Lt=null,Gt=ne.next();Xe!==null&&!Gt.done;wt++,Gt=ne.next()){Xe.index>wt?(Lt=Xe,Xe=null):Lt=Xe.sibling;var ls=ae(J,Xe,Gt.value,me);if(ls===null){Xe===null&&(Xe=Lt);break}i&&Xe&&ls.alternate===null&&l(J,Xe),Q=j(ls,Q,wt),qt===null?nt=ls:qt.sibling=ls,qt=ls,Xe=Lt}if(Gt.done)return d(J,Xe),$t&&na(J,wt),nt;if(Xe===null){for(;!Gt.done;wt++,Gt=ne.next())Gt=ye(J,Gt.value,me),Gt!==null&&(Q=j(Gt,Q,wt),qt===null?nt=Gt:qt.sibling=Gt,qt=Gt);return $t&&na(J,wt),nt}for(Xe=p(Xe);!Gt.done;wt++,Gt=ne.next())Gt=ue(Xe,J,wt,Gt.value,me),Gt!==null&&(i&&Gt.alternate!==null&&Xe.delete(Gt.key===null?wt:Gt.key),Q=j(Gt,Q,wt),qt===null?nt=Gt:qt.sibling=Gt,qt=Gt);return i&&Xe.forEach(function(E3){return l(J,E3)}),$t&&na(J,wt),nt}function cn(J,Q,ne,me){if(typeof ne=="object"&&ne!==null&&ne.type===w&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:e:{for(var nt=ne.key;Q!==null;){if(Q.key===nt){if(nt=ne.type,nt===w){if(Q.tag===7){d(J,Q.sibling),me=b(Q,ne.props.children),me.return=J,J=me;break e}}else if(Q.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===P&&Zs(nt)===Q.type){d(J,Q.sibling),me=b(Q,ne.props),Vu(me,ne),me.return=J,J=me;break e}d(J,Q);break}else l(J,Q);Q=Q.sibling}ne.type===w?(me=Qs(ne.props.children,J.mode,me,ne.key),me.return=J,J=me):(me=Zf(ne.type,ne.key,ne.props,null,J.mode,me),Vu(me,ne),me.return=J,J=me)}return A(J);case S:e:{for(nt=ne.key;Q!==null;){if(Q.key===nt)if(Q.tag===4&&Q.stateNode.containerInfo===ne.containerInfo&&Q.stateNode.implementation===ne.implementation){d(J,Q.sibling),me=b(Q,ne.children||[]),me.return=J,J=me;break e}else{d(J,Q);break}else l(J,Q);Q=Q.sibling}me=qg(ne,J.mode,me),me.return=J,J=me}return A(J);case P:return ne=Zs(ne),cn(J,Q,ne,me)}if(G(ne))return Ge(J,Q,ne,me);if(Y(ne)){if(nt=Y(ne),typeof nt!="function")throw Error(r(150));return ne=nt.call(ne),ct(J,Q,ne,me)}if(typeof ne.then=="function")return cn(J,Q,ah(ne),me);if(ne.$$typeof===E)return cn(J,Q,nh(J,ne),me);sh(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Q!==null&&Q.tag===6?(d(J,Q.sibling),me=b(Q,ne),me.return=J,J=me):(d(J,Q),me=Hg(ne,J.mode,me),me.return=J,J=me),A(J)):d(J,Q)}return function(J,Q,ne,me){try{Bu=0;var nt=cn(J,Q,ne,me);return dc=null,nt}catch(Xe){if(Xe===uc||Xe===ih)throw Xe;var qt=ai(29,Xe,null,J.mode);return qt.lanes=me,qt.return=J,qt}}}var tl=Sj(!0),jj=Sj(!1),qa=!1;function rv(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iv(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ga(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Wa(i,l,d){var p=i.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=Jf(i),oj(i,null,d),l}return Xf(i,p,l,d),Jf(i)}function Fu(i,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194048)!==0)){var p=l.lanes;p&=i.pendingLanes,d|=p,l.lanes=d,H(i,d)}}function ov(i,l){var d=i.updateQueue,p=i.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var b=null,j=null;if(d=d.firstBaseUpdate,d!==null){do{var A={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};j===null?b=j=A:j=j.next=A,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},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=l:i.next=l,d.lastBaseUpdate=l}var av=!1;function Hu(){if(av){var i=cc;if(i!==null)throw i}}function qu(i,l,d,p){av=!1;var b=i.updateQueue;qa=!1;var j=b.firstBaseUpdate,A=b.lastBaseUpdate,N=b.shared.pending;if(N!==null){b.shared.pending=null;var q=N,re=q.next;q.next=null,A===null?j=re:A.next=re,A=q;var pe=i.alternate;pe!==null&&(pe=pe.updateQueue,N=pe.lastBaseUpdate,N!==A&&(N===null?pe.firstBaseUpdate=re:N.next=re,pe.lastBaseUpdate=q))}if(j!==null){var ye=b.baseState;A=0,pe=re=q=null,N=j;do{var ae=N.lane&-536870913,ue=ae!==N.lane;if(ue?(Mt&ae)===ae:(p&ae)===ae){ae!==0&&ae===lc&&(av=!0),pe!==null&&(pe=pe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ge=i,ct=N;ae=l;var cn=d;switch(ct.tag){case 1:if(Ge=ct.payload,typeof Ge=="function"){ye=Ge.call(cn,ye,ae);break e}ye=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=ct.payload,ae=typeof Ge=="function"?Ge.call(cn,ye,ae):Ge,ae==null)break e;ye=g({},ye,ae);break e;case 2:qa=!0}}ae=N.callback,ae!==null&&(i.flags|=64,ue&&(i.flags|=8192),ue=b.callbacks,ue===null?b.callbacks=[ae]:ue.push(ae))}else ue={lane:ae,tag:N.tag,payload:N.payload,callback:N.callback,next:null},pe===null?(re=pe=ue,q=ye):pe=pe.next=ue,A|=ae;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=re,b.lastBaseUpdate=pe,j===null&&(b.shared.lanes=0),Ja|=A,i.lanes=A,i.memoizedState=ye}}function wj(i,l){if(typeof i!="function")throw Error(r(191,i));i.call(l)}function Cj(i,l){var d=i.callbacks;if(d!==null)for(i.callbacks=null,i=0;i<d.length;i++)wj(d[i],l)}var fc=O(null),lh=O(0);function Ej(i,l){i=ha,se(lh,i),se(fc,l),ha=i|l.baseLanes}function sv(){se(lh,ha),se(fc,fc.current)}function lv(){ha=lh.current,F(fc),F(lh)}var si=O(null),_i=null;function Qa(i){var l=i.alternate;se(Gn,Gn.current&1),se(si,i),_i===null&&(l===null||fc.current!==null||l.memoizedState!==null)&&(_i=i)}function cv(i){se(Gn,Gn.current),se(si,i),_i===null&&(_i=i)}function Tj(i){i.tag===22?(se(Gn,Gn.current),se(si,i),_i===null&&(_i=i)):Ya()}function Ya(){se(Gn,Gn.current),se(si,si.current)}function li(i){F(si),_i===i&&(_i=null),F(Gn)}var Gn=O(0);function ch(i){for(var l=i;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||my(d)||gy(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===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var oa=0,St=null,sn=null,Zn=null,uh=!1,hc=!1,nl=!1,dh=0,Gu=0,pc=null,m4=0;function Un(){throw Error(r(321))}function uv(i,l){if(l===null)return!1;for(var d=0;d<l.length&&d<i.length;d++)if(!oi(i[d],l[d]))return!1;return!0}function dv(i,l,d,p,b,j){return oa=j,St=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,M.H=i===null||i.memoizedState===null?cw:Tv,nl=!1,j=d(p,b),nl=!1,hc&&(j=_j(l,d,p,b)),Rj(i),j}function Rj(i){M.H=Yu;var l=sn!==null&&sn.next!==null;if(oa=0,Zn=sn=St=null,uh=!1,Gu=0,pc=null,l)throw Error(r(300));i===null||er||(i=i.dependencies,i!==null&&th(i)&&(er=!0))}function _j(i,l,d,p){St=i;var b=0;do{if(hc&&(pc=null),Gu=0,hc=!1,25<=b)throw Error(r(301));if(b+=1,Zn=sn=null,i.updateQueue!=null){var j=i.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}M.H=uw,j=l(d,p)}while(hc);return j}function g4(){var i=M.H,l=i.useState()[0];return l=typeof l.then=="function"?Wu(l):l,i=i.useState()[0],(sn!==null?sn.memoizedState:null)!==i&&(St.flags|=1024),l}function fv(){var i=dh!==0;return dh=0,i}function hv(i,l,d){l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~d}function pv(i){if(uh){for(i=i.memoizedState;i!==null;){var l=i.queue;l!==null&&(l.pending=null),i=i.next}uh=!1}oa=0,Zn=sn=St=null,hc=!1,Gu=dh=0,pc=null}function Mr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zn===null?St.memoizedState=Zn=i:Zn=Zn.next=i,Zn}function Wn(){if(sn===null){var i=St.alternate;i=i!==null?i.memoizedState:null}else i=sn.next;var l=Zn===null?St.memoizedState:Zn.next;if(l!==null)Zn=l,sn=i;else{if(i===null)throw St.alternate===null?Error(r(467)):Error(r(310));sn=i,i={memoizedState:sn.memoizedState,baseState:sn.baseState,baseQueue:sn.baseQueue,queue:sn.queue,next:null},Zn===null?St.memoizedState=Zn=i:Zn=Zn.next=i}return Zn}function fh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wu(i){var l=Gu;return Gu+=1,pc===null&&(pc=[]),i=yj(pc,i,l),l=St,(Zn===null?l.memoizedState:Zn.next)===null&&(l=l.alternate,M.H=l===null||l.memoizedState===null?cw:Tv),i}function hh(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Wu(i);if(i.$$typeof===E)return br(i)}throw Error(r(438,String(i)))}function mv(i){var l=null,d=St.updateQueue;if(d!==null&&(l=d.memoCache),l==null){var p=St.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=fh(),St.updateQueue=d),d.memoCache=l,d=l.data[l.index],d===void 0)for(d=l.data[l.index]=Array(i),p=0;p<i;p++)d[p]=U;return l.index++,d}function aa(i,l){return typeof l=="function"?l(i):l}function ph(i){var l=Wn();return gv(l,sn,i)}function gv(i,l,d){var p=i.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var b=i.baseQueue,j=p.pending;if(j!==null){if(b!==null){var A=b.next;b.next=j.next,j.next=A}l.baseQueue=b=j,p.pending=null}if(j=i.baseState,b===null)i.memoizedState=j;else{l=b.next;var N=A=null,q=null,re=l,pe=!1;do{var ye=re.lane&-536870913;if(ye!==re.lane?(Mt&ye)===ye:(oa&ye)===ye){var ae=re.revertLane;if(ae===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ye===lc&&(pe=!0);else if((oa&ae)===ae){re=re.next,ae===lc&&(pe=!0);continue}else ye={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(N=q=ye,A=j):q=q.next=ye,St.lanes|=ae,Ja|=ae;ye=re.action,nl&&d(j,ye),j=re.hasEagerState?re.eagerState:d(j,ye)}else ae={lane:ye,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(N=q=ae,A=j):q=q.next=ae,St.lanes|=ye,Ja|=ye;re=re.next}while(re!==null&&re!==l);if(q===null?A=j:q.next=N,!oi(j,i.memoizedState)&&(er=!0,pe&&(d=cc,d!==null)))throw d;i.memoizedState=j,i.baseState=A,i.baseQueue=q,p.lastRenderedState=j}return b===null&&(p.lanes=0),[i.memoizedState,p.dispatch]}function vv(i){var l=Wn(),d=l.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=i;var p=d.dispatch,b=d.pending,j=l.memoizedState;if(b!==null){d.pending=null;var A=b=b.next;do j=i(j,A.action),A=A.next;while(A!==b);oi(j,l.memoizedState)||(er=!0),l.memoizedState=j,l.baseQueue===null&&(l.baseState=j),d.lastRenderedState=j}return[j,p]}function Dj(i,l,d){var p=St,b=Wn(),j=$t;if(j){if(d===void 0)throw Error(r(407));d=d()}else d=l();var A=!oi((sn||b).memoizedState,d);if(A&&(b.memoizedState=d,er=!0),b=b.queue,bv(Pj.bind(null,p,b,i),[i]),b.getSnapshot!==l||A||Zn!==null&&Zn.memoizedState.tag&1){if(p.flags|=2048,mc(9,{destroy:void 0},kj.bind(null,p,b,d,l),null),un===null)throw Error(r(349));j||(oa&127)!==0||Aj(p,l,d)}return d}function Aj(i,l,d){i.flags|=16384,i={getSnapshot:l,value:d},l=St.updateQueue,l===null?(l=fh(),St.updateQueue=l,l.stores=[i]):(d=l.stores,d===null?l.stores=[i]:d.push(i))}function kj(i,l,d,p){l.value=d,l.getSnapshot=p,Nj(l)&&Oj(i)}function Pj(i,l,d){return d(function(){Nj(l)&&Oj(i)})}function Nj(i){var l=i.getSnapshot;i=i.value;try{var d=l();return!oi(i,d)}catch{return!0}}function Oj(i){var l=Ws(i,2);l!==null&&Qr(l,i,2)}function yv(i){var l=Mr();if(typeof i=="function"){var d=i;if(i=d(),nl){sr(!0);try{d()}finally{sr(!1)}}}return l.memoizedState=l.baseState=i,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:i},l}function Mj(i,l,d,p){return i.baseState=d,gv(i,sn,typeof p=="function"?p:aa)}function v4(i,l,d,p,b){if(vh(i))throw Error(r(485));if(i=l.action,i!==null){var j={payload:b,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){j.listeners.push(A)}};M.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(i,l){var d=l.action,p=l.payload,b=i.state;if(l.isTransition){var j=M.T,A={};M.T=A;try{var N=d(b,p),q=M.S;q!==null&&q(A,N),Ij(i,l,N)}catch(re){xv(i,l,re)}finally{j!==null&&A.types!==null&&(j.types=A.types),M.T=j}}else try{j=d(b,p),Ij(i,l,j)}catch(re){xv(i,l,re)}}function Ij(i,l,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){zj(i,l,p)},function(p){return xv(i,l,p)}):zj(i,l,d)}function zj(i,l,d){l.status="fulfilled",l.value=d,$j(l),i.state=d,l=i.pending,l!==null&&(d=l.next,d===l?i.pending=null:(d=d.next,l.next=d,Lj(i,d)))}function xv(i,l,d){var p=i.pending;if(i.pending=null,p!==null){p=p.next;do l.status="rejected",l.reason=d,$j(l),l=l.next;while(l!==p)}i.action=null}function $j(i){i=i.listeners;for(var l=0;l<i.length;l++)(0,i[l])()}function Uj(i,l){return l}function Bj(i,l){if($t){var d=un.formState;if(d!==null){e:{var p=St;if($t){if(wn){t:{for(var b=wn,j=Ri;b.nodeType!==8;){if(!j){b=null;break t}if(b=Di(b.nextSibling),b===null){b=null;break t}}j=b.data,b=j==="F!"||j==="F"?b:null}if(b){wn=Di(b.nextSibling),p=b.data==="F!";break e}}Fa(p)}p=!1}p&&(l=d[0])}}return d=Mr(),d.memoizedState=d.baseState=l,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Uj,lastRenderedState:l},d.queue=p,d=aw.bind(null,St,p),p.dispatch=d,p=yv(!1),j=Ev.bind(null,St,!1,p.queue),p=Mr(),b={state:l,dispatch:null,action:i,pending:null},p.queue=b,d=v4.bind(null,St,b,j,d),b.dispatch=d,p.memoizedState=i,[l,d,!1]}function Vj(i){var l=Wn();return Fj(l,sn,i)}function Fj(i,l,d){if(l=gv(i,l,Uj)[0],i=ph(aa)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var p=Wu(l)}catch(A){throw A===uc?ih:A}else p=l;l=Wn();var b=l.queue,j=b.dispatch;return d!==l.memoizedState&&(St.flags|=2048,mc(9,{destroy:void 0},y4.bind(null,b,d),null)),[p,j,i]}function y4(i,l){i.action=l}function Hj(i){var l=Wn(),d=sn;if(d!==null)return Fj(l,d,i);Wn(),l=l.memoizedState,d=Wn();var p=d.queue.dispatch;return d.memoizedState=i,[l,p,!1]}function mc(i,l,d,p){return i={tag:i,create:d,deps:p,inst:l,next:null},l=St.updateQueue,l===null&&(l=fh(),St.updateQueue=l),d=l.lastEffect,d===null?l.lastEffect=i.next=i:(p=d.next,d.next=i,i.next=p,l.lastEffect=i),i}function qj(){return Wn().memoizedState}function mh(i,l,d,p){var b=Mr();St.flags|=i,b.memoizedState=mc(1|l,{destroy:void 0},d,p===void 0?null:p)}function gh(i,l,d,p){var b=Wn();p=p===void 0?null:p;var j=b.memoizedState.inst;sn!==null&&p!==null&&uv(p,sn.memoizedState.deps)?b.memoizedState=mc(l,j,d,p):(St.flags|=i,b.memoizedState=mc(1|l,j,d,p))}function Gj(i,l){mh(8390656,8,i,l)}function bv(i,l){gh(2048,8,i,l)}function x4(i){St.flags|=4;var l=St.updateQueue;if(l===null)l=fh(),St.updateQueue=l,l.events=[i];else{var d=l.events;d===null?l.events=[i]:d.push(i)}}function Wj(i){var l=Wn().memoizedState;return x4({ref:l,nextImpl:i}),function(){if((Qt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function Qj(i,l){return gh(4,2,i,l)}function Yj(i,l){return gh(4,4,i,l)}function Kj(i,l){if(typeof l=="function"){i=i();var d=l(i);return function(){typeof d=="function"?d():l(null)}}if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function Xj(i,l,d){d=d!=null?d.concat([i]):null,gh(4,4,Kj.bind(null,l,i),d)}function Sv(){}function Jj(i,l){var d=Wn();l=l===void 0?null:l;var p=d.memoizedState;return l!==null&&uv(l,p[1])?p[0]:(d.memoizedState=[i,l],i)}function Zj(i,l){var d=Wn();l=l===void 0?null:l;var p=d.memoizedState;if(l!==null&&uv(l,p[1]))return p[0];if(p=i(),nl){sr(!0);try{i()}finally{sr(!1)}}return d.memoizedState=[p,l],p}function jv(i,l,d){return d===void 0||(oa&1073741824)!==0&&(Mt&261930)===0?i.memoizedState=l:(i.memoizedState=d,i=eC(),St.lanes|=i,Ja|=i,d)}function ew(i,l,d,p){return oi(d,l)?d:fc.current!==null?(i=jv(i,d,p),oi(i,l)||(er=!0),i):(oa&42)===0||(oa&1073741824)!==0&&(Mt&261930)===0?(er=!0,i.memoizedState=d):(i=eC(),St.lanes|=i,Ja|=i,l)}function tw(i,l,d,p,b){var j=I.p;I.p=j!==0&&8>j?j:8;var A=M.T,N={};M.T=N,Ev(i,!1,l,d);try{var q=b(),re=M.S;if(re!==null&&re(N,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var pe=p4(q,p);Qu(i,l,pe,di(i))}else Qu(i,l,p,di(i))}catch(ye){Qu(i,l,{then:function(){},status:"rejected",reason:ye},di())}finally{I.p=j,A!==null&&N.types!==null&&(A.types=N.types),M.T=A}}function b4(){}function wv(i,l,d,p){if(i.tag!==5)throw Error(r(476));var b=nw(i).queue;tw(i,b,l,z,d===null?b4:function(){return rw(i),d(p)})}function nw(i){var l=i.memoizedState;if(l!==null)return l;l={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:z},next:null};var d={};return l.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:aa,lastRenderedState:d},next:null},i.memoizedState=l,i=i.alternate,i!==null&&(i.memoizedState=l),l}function rw(i){var l=nw(i);l.next===null&&(l=i.alternate.memoizedState),Qu(i,l.next.queue,{},di())}function Cv(){return br(dd)}function iw(){return Wn().memoizedState}function ow(){return Wn().memoizedState}function S4(i){for(var l=i.return;l!==null;){switch(l.tag){case 24:case 3:var d=di();i=Ga(d);var p=Wa(l,i,d);p!==null&&(Qr(p,l,d),Fu(p,l,d)),l={cache:Zg()},i.payload=l;return}l=l.return}}function j4(i,l,d){var p=di();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},vh(i)?sw(l,d):(d=Vg(i,l,d,p),d!==null&&(Qr(d,i,p),lw(d,l,p)))}function aw(i,l,d){var p=di();Qu(i,l,d,p)}function Qu(i,l,d,p){var b={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(vh(i))sw(l,b);else{var j=i.alternate;if(i.lanes===0&&(j===null||j.lanes===0)&&(j=l.lastRenderedReducer,j!==null))try{var A=l.lastRenderedState,N=j(A,d);if(b.hasEagerState=!0,b.eagerState=N,oi(N,A))return Xf(i,l,b,0),un===null&&Kf(),!1}catch{}if(d=Vg(i,l,b,p),d!==null)return Qr(d,i,p),lw(d,l,p),!0}return!1}function Ev(i,l,d,p){if(p={lane:2,revertLane:ry(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},vh(i)){if(l)throw Error(r(479))}else l=Vg(i,d,p,2),l!==null&&Qr(l,i,2)}function vh(i){var l=i.alternate;return i===St||l!==null&&l===St}function sw(i,l){hc=uh=!0;var d=i.pending;d===null?l.next=l:(l.next=d.next,d.next=l),i.pending=l}function lw(i,l,d){if((d&4194048)!==0){var p=l.lanes;p&=i.pendingLanes,d|=p,l.lanes=d,H(i,d)}}var Yu={readContext:br,use:hh,useCallback:Un,useContext:Un,useEffect:Un,useImperativeHandle:Un,useLayoutEffect:Un,useInsertionEffect:Un,useMemo:Un,useReducer:Un,useRef:Un,useState:Un,useDebugValue:Un,useDeferredValue:Un,useTransition:Un,useSyncExternalStore:Un,useId:Un,useHostTransitionStatus:Un,useFormState:Un,useActionState:Un,useOptimistic:Un,useMemoCache:Un,useCacheRefresh:Un};Yu.useEffectEvent=Un;var cw={readContext:br,use:hh,useCallback:function(i,l){return Mr().memoizedState=[i,l===void 0?null:l],i},useContext:br,useEffect:Gj,useImperativeHandle:function(i,l,d){d=d!=null?d.concat([i]):null,mh(4194308,4,Kj.bind(null,l,i),d)},useLayoutEffect:function(i,l){return mh(4194308,4,i,l)},useInsertionEffect:function(i,l){mh(4,2,i,l)},useMemo:function(i,l){var d=Mr();l=l===void 0?null:l;var p=i();if(nl){sr(!0);try{i()}finally{sr(!1)}}return d.memoizedState=[p,l],p},useReducer:function(i,l,d){var p=Mr();if(d!==void 0){var b=d(l);if(nl){sr(!0);try{d(l)}finally{sr(!1)}}}else b=l;return p.memoizedState=p.baseState=b,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:b},p.queue=i,i=i.dispatch=j4.bind(null,St,i),[p.memoizedState,i]},useRef:function(i){var l=Mr();return i={current:i},l.memoizedState=i},useState:function(i){i=yv(i);var l=i.queue,d=aw.bind(null,St,l);return l.dispatch=d,[i.memoizedState,d]},useDebugValue:Sv,useDeferredValue:function(i,l){var d=Mr();return jv(d,i,l)},useTransition:function(){var i=yv(!1);return i=tw.bind(null,St,i.queue,!0,!1),Mr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,l,d){var p=St,b=Mr();if($t){if(d===void 0)throw Error(r(407));d=d()}else{if(d=l(),un===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,i),[i]),p.flags|=2048,mc(9,{destroy:void 0},kj.bind(null,p,j,d,l),null),d},useId:function(){var i=Mr(),l=un.identifierPrefix;if($t){var d=wo,p=jo;d=(p&~(1<<32-$n(p)-1)).toString(32)+d,l="_"+l+"R_"+d,d=dh++,0<d&&(l+="H"+d.toString(32)),l+="_"}else d=m4++,l="_"+l+"r_"+d.toString(32)+"_";return i.memoizedState=l},useHostTransitionStatus:Cv,useFormState:Bj,useActionState:Bj,useOptimistic:function(i){var l=Mr();l.memoizedState=l.baseState=i;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=d,l=Ev.bind(null,St,!0,d),d.dispatch=l,[i,l]},useMemoCache:mv,useCacheRefresh:function(){return Mr().memoizedState=S4.bind(null,St)},useEffectEvent:function(i){var l=Mr(),d={impl:i};return l.memoizedState=d,function(){if((Qt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},Tv={readContext:br,use:hh,useCallback:Jj,useContext:br,useEffect:bv,useImperativeHandle:Xj,useInsertionEffect:Qj,useLayoutEffect:Yj,useMemo:Zj,useReducer:ph,useRef:qj,useState:function(){return ph(aa)},useDebugValue:Sv,useDeferredValue:function(i,l){var d=Wn();return ew(d,sn.memoizedState,i,l)},useTransition:function(){var i=ph(aa)[0],l=Wn().memoizedState;return[typeof i=="boolean"?i:Wu(i),l]},useSyncExternalStore:Dj,useId:iw,useHostTransitionStatus:Cv,useFormState:Vj,useActionState:Vj,useOptimistic:function(i,l){var d=Wn();return Mj(d,sn,i,l)},useMemoCache:mv,useCacheRefresh:ow};Tv.useEffectEvent=Wj;var uw={readContext:br,use:hh,useCallback:Jj,useContext:br,useEffect:bv,useImperativeHandle:Xj,useInsertionEffect:Qj,useLayoutEffect:Yj,useMemo:Zj,useReducer:vv,useRef:qj,useState:function(){return vv(aa)},useDebugValue:Sv,useDeferredValue:function(i,l){var d=Wn();return sn===null?jv(d,i,l):ew(d,sn.memoizedState,i,l)},useTransition:function(){var i=vv(aa)[0],l=Wn().memoizedState;return[typeof i=="boolean"?i:Wu(i),l]},useSyncExternalStore:Dj,useId:iw,useHostTransitionStatus:Cv,useFormState:Hj,useActionState:Hj,useOptimistic:function(i,l){var d=Wn();return sn!==null?Mj(d,sn,i,l):(d.baseState=i,[i,d.queue.dispatch])},useMemoCache:mv,useCacheRefresh:ow};uw.useEffectEvent=Wj;function Rv(i,l,d,p){l=i.memoizedState,d=d(p,l),d=d==null?l:g({},l,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var _v={enqueueSetState:function(i,l,d){i=i._reactInternals;var p=di(),b=Ga(p);b.payload=l,d!=null&&(b.callback=d),l=Wa(i,b,p),l!==null&&(Qr(l,i,p),Fu(l,i,p))},enqueueReplaceState:function(i,l,d){i=i._reactInternals;var p=di(),b=Ga(p);b.tag=1,b.payload=l,d!=null&&(b.callback=d),l=Wa(i,b,p),l!==null&&(Qr(l,i,p),Fu(l,i,p))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var d=di(),p=Ga(d);p.tag=2,l!=null&&(p.callback=l),l=Wa(i,p,d),l!==null&&(Qr(l,i,d),Fu(l,i,d))}};function dw(i,l,d,p,b,j,A){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(p,j,A):l.prototype&&l.prototype.isPureReactComponent?!Mu(d,p)||!Mu(b,j):!0}function fw(i,l,d,p){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,p),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,p),l.state!==i&&_v.enqueueReplaceState(l,l.state,null)}function rl(i,l){var d=l;if("ref"in l){d={};for(var p in l)p!=="ref"&&(d[p]=l[p])}if(i=i.defaultProps){d===l&&(d=g({},d));for(var b in i)d[b]===void 0&&(d[b]=i[b])}return d}function hw(i){Yf(i)}function pw(i){console.error(i)}function mw(i){Yf(i)}function yh(i,l){try{var d=i.onUncaughtError;d(l.value,{componentStack:l.stack})}catch(p){setTimeout(function(){throw p})}}function gw(i,l,d){try{var p=i.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Dv(i,l,d){return d=Ga(d),d.tag=3,d.payload={element:null},d.callback=function(){yh(i,l)},d}function vw(i){return i=Ga(i),i.tag=3,i}function yw(i,l,d,p){var b=d.type.getDerivedStateFromError;if(typeof b=="function"){var j=p.value;i.payload=function(){return b(j)},i.callback=function(){gw(l,d,p)}}var A=d.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(i.callback=function(){gw(l,d,p),typeof b!="function"&&(Za===null?Za=new Set([this]):Za.add(this));var N=p.stack;this.componentDidCatch(p.value,{componentStack:N!==null?N:""})})}function w4(i,l,d,p,b){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(l=d.alternate,l!==null&&sc(l,d,b,!0),d=si.current,d!==null){switch(d.tag){case 31:case 13:return _i===null?Ah():d.alternate===null&&Bn===0&&(Bn=3),d.flags&=-257,d.flags|=65536,d.lanes=b,p===oh?d.flags|=16384:(l=d.updateQueue,l===null?d.updateQueue=new Set([p]):l.add(p),ey(i,p,b)),!1;case 22:return d.flags|=65536,p===oh?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)),ey(i,p,b)),!1}throw Error(r(435,d.tag))}return ey(i,p,b),Ah(),!1}if($t)return l=si.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=b,p!==Qg&&(i=Error(r(422),{cause:p}),zu(Ci(i,d)))):(p!==Qg&&(l=Error(r(423),{cause:p}),zu(Ci(l,d))),i=i.current.alternate,i.flags|=65536,b&=-b,i.lanes|=b,p=Ci(p,d),b=Dv(i.stateNode,p,b),ov(i,b),Bn!==4&&(Bn=2)),!1;var j=Error(r(520),{cause:p});if(j=Ci(j,d),rd===null?rd=[j]:rd.push(j),Bn!==4&&(Bn=2),l===null)return!0;p=Ci(p,d),d=l;do{switch(d.tag){case 3:return d.flags|=65536,i=b&-b,d.lanes|=i,i=Dv(d.stateNode,p,i),ov(d,i),!1;case 1:if(l=d.type,j=d.stateNode,(d.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(Za===null||!Za.has(j))))return d.flags|=65536,b&=-b,d.lanes|=b,b=vw(b),yw(b,i,d,p),ov(d,b),!1}d=d.return}while(d!==null);return!1}var Av=Error(r(461)),er=!1;function Sr(i,l,d,p){l.child=i===null?jj(l,null,d,p):tl(l,i.child,d,p)}function xw(i,l,d,p,b){d=d.render;var j=l.ref;if("ref"in p){var A={};for(var N in p)N!=="ref"&&(A[N]=p[N])}else A=p;return Xs(l),p=dv(i,l,d,A,j,b),N=fv(),i!==null&&!er?(hv(i,l,b),sa(i,l,b)):($t&&N&&Gg(l),l.flags|=1,Sr(i,l,p,b),l.child)}function bw(i,l,d,p,b){if(i===null){var j=d.type;return typeof j=="function"&&!Fg(j)&&j.defaultProps===void 0&&d.compare===null?(l.tag=15,l.type=j,Sw(i,l,j,p,b)):(i=Zf(d.type,null,p,l,l.mode,b),i.ref=l.ref,i.return=l,l.child=i)}if(j=i.child,!zv(i,b)){var A=j.memoizedProps;if(d=d.compare,d=d!==null?d:Mu,d(A,p)&&i.ref===l.ref)return sa(i,l,b)}return l.flags|=1,i=ta(j,p),i.ref=l.ref,i.return=l,l.child=i}function Sw(i,l,d,p,b){if(i!==null){var j=i.memoizedProps;if(Mu(j,p)&&i.ref===l.ref)if(er=!1,l.pendingProps=p=j,zv(i,b))(i.flags&131072)!==0&&(er=!0);else return l.lanes=i.lanes,sa(i,l,b)}return kv(i,l,d,p,b)}function jw(i,l,d,p){var b=p.children,j=i!==null?i.memoizedState:null;if(i===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,i!==null){for(p=l.child=i.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(i,l,j,d,p)}if((d&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},i!==null&&rh(l,j!==null?j.cachePool:null),j!==null?Ej(l,j):sv(),Tj(l);else return p=l.lanes=536870912,ww(i,l,j!==null?j.baseLanes|d:d,d,p)}else j!==null?(rh(l,j.cachePool),Ej(l,j),Ya(),l.memoizedState=null):(i!==null&&rh(l,null),sv(),Ya());return Sr(i,l,b,d),l.child}function Ku(i,l){return i!==null&&i.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function ww(i,l,d,p,b){var j=tv();return j=j===null?null:{parent:Jn._currentValue,pool:j},l.memoizedState={baseLanes:d,cachePool:j},i!==null&&rh(l,null),sv(),Tj(l),i!==null&&sc(i,l,p,!0),l.childLanes=b,null}function xh(i,l){return l=Sh({mode:l.mode,children:l.children},i.mode),l.ref=i.ref,i.child=l,l.return=i,l}function Cw(i,l,d){return tl(l,i.child,null,d),i=xh(l,l.pendingProps),i.flags|=2,li(l),l.memoizedState=null,i}function C4(i,l,d){var p=l.pendingProps,b=(l.flags&128)!==0;if(l.flags&=-129,i===null){if($t){if(p.mode==="hidden")return i=xh(l,p),l.lanes=536870912,Ku(null,i);if(cv(l),(i=wn)?(i=LC(i,Ri),i=i!==null&&i.data==="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:Ba!==null?{id:jo,overflow:wo}:null,retryLane:536870912,hydrationErrors:null},d=sj(i),d.return=l,l.child=d,xr=l,wn=null)):i=null,i===null)throw Fa(l);return l.lanes=536870912,null}return xh(l,p)}var j=i.memoizedState;if(j!==null){var A=j.dehydrated;if(cv(l),b)if(l.flags&256)l.flags&=-257,l=Cw(i,l,d);else if(l.memoizedState!==null)l.child=i.child,l.flags|=128,l=null;else throw Error(r(558));else if(er||sc(i,l,d,!1),b=(d&i.childLanes)!==0,er||b){if(p=un,p!==null&&(A=X(p,d),A!==0&&A!==j.retryLane))throw j.retryLane=A,Ws(i,A),Qr(p,i,A),Av;Ah(),l=Cw(i,l,d)}else i=j.treeContext,wn=Di(A.nextSibling),xr=l,$t=!0,Va=null,Ri=!1,i!==null&&uj(l,i),l=xh(l,p),l.flags|=4096;return l}return i=ta(i.child,{mode:p.mode,children:p.children}),i.ref=l.ref,l.child=i,i.return=l,i}function bh(i,l){var d=l.ref;if(d===null)i!==null&&i.ref!==null&&(l.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(i===null||i.ref!==d)&&(l.flags|=4194816)}}function kv(i,l,d,p,b){return Xs(l),d=dv(i,l,d,p,void 0,b),p=fv(),i!==null&&!er?(hv(i,l,b),sa(i,l,b)):($t&&p&&Gg(l),l.flags|=1,Sr(i,l,d,b),l.child)}function Ew(i,l,d,p,b,j){return Xs(l),l.updateQueue=null,d=_j(l,p,d,b),Rj(i),p=fv(),i!==null&&!er?(hv(i,l,j),sa(i,l,j)):($t&&p&&Gg(l),l.flags|=1,Sr(i,l,d,j),l.child)}function Tw(i,l,d,p,b){if(Xs(l),l.stateNode===null){var j=rc,A=d.contextType;typeof A=="object"&&A!==null&&(j=br(A)),j=new d(p,j),l.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=_v,l.stateNode=j,j._reactInternals=l,j=l.stateNode,j.props=p,j.state=l.memoizedState,j.refs={},rv(l),A=d.contextType,j.context=typeof A=="object"&&A!==null?br(A):rc,j.state=l.memoizedState,A=d.getDerivedStateFromProps,typeof A=="function"&&(Rv(l,d,A,p),j.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(A=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),A!==j.state&&_v.enqueueReplaceState(j,j.state,null),qu(l,p,j,b),Hu(),j.state=l.memoizedState),typeof j.componentDidMount=="function"&&(l.flags|=4194308),p=!0}else if(i===null){j=l.stateNode;var N=l.memoizedProps,q=rl(d,N);j.props=q;var re=j.context,pe=d.contextType;A=rc,typeof pe=="object"&&pe!==null&&(A=br(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||re!==A)&&fw(l,j,p,A),qa=!1;var ae=l.memoizedState;j.state=ae,qu(l,p,j,b),Hu(),re=l.memoizedState,N||ae!==re||qa?(typeof ye=="function"&&(Rv(l,d,ye,p),re=l.memoizedState),(q=qa||dw(l,d,q,p,ae,re,A))?(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=re),j.props=p,j.state=re,j.context=A,p=q):(typeof j.componentDidMount=="function"&&(l.flags|=4194308),p=!1)}else{j=l.stateNode,iv(i,l),A=l.memoizedProps,pe=rl(d,A),j.props=pe,ye=l.pendingProps,ae=j.context,re=d.contextType,q=rc,typeof re=="object"&&re!==null&&(q=br(re)),N=d.getDerivedStateFromProps,(re=typeof N=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(A!==ye||ae!==q)&&fw(l,j,p,q),qa=!1,ae=l.memoizedState,j.state=ae,qu(l,p,j,b),Hu();var ue=l.memoizedState;A!==ye||ae!==ue||qa||i!==null&&i.dependencies!==null&&th(i.dependencies)?(typeof N=="function"&&(Rv(l,d,N,p),ue=l.memoizedState),(pe=qa||dw(l,d,pe,p,ae,ue,q)||i!==null&&i.dependencies!==null&&th(i.dependencies))?(re||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"||A===i.memoizedProps&&ae===i.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||A===i.memoizedProps&&ae===i.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"||A===i.memoizedProps&&ae===i.memoizedState||(l.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||A===i.memoizedProps&&ae===i.memoizedState||(l.flags|=1024),p=!1)}return j=p,bh(i,l),p=(l.flags&128)!==0,j||p?(j=l.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:j.render(),l.flags|=1,i!==null&&p?(l.child=tl(l,i.child,null,b),l.child=tl(l,null,d,b)):Sr(i,l,d,b),l.memoizedState=j.state,i=l.child):i=sa(i,l,b),i}function Rw(i,l,d,p){return Ys(),l.flags|=256,Sr(i,l,d,p),l.child}var Pv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nv(i){return{baseLanes:i,cachePool:gj()}}function Ov(i,l,d){return i=i!==null?i.childLanes&~d:0,l&&(i|=ui),i}function _w(i,l,d){var p=l.pendingProps,b=!1,j=(l.flags&128)!==0,A;if((A=j)||(A=i!==null&&i.memoizedState===null?!1:(Gn.current&2)!==0),A&&(b=!0,l.flags&=-129),A=(l.flags&32)!==0,l.flags&=-33,i===null){if($t){if(b?Qa(l):Ya(),(i=wn)?(i=LC(i,Ri),i=i!==null&&i.data!=="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:Ba!==null?{id:jo,overflow:wo}:null,retryLane:536870912,hydrationErrors:null},d=sj(i),d.return=l,l.child=d,xr=l,wn=null)):i=null,i===null)throw Fa(l);return gy(i)?l.lanes=32:l.lanes=536870912,null}var N=p.children;return p=p.fallback,b?(Ya(),b=l.mode,N=Sh({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=Nv(d),p.childLanes=Ov(i,A,d),l.memoizedState=Pv,Ku(null,p)):(Qa(l),Mv(l,N))}var q=i.memoizedState;if(q!==null&&(N=q.dehydrated,N!==null)){if(j)l.flags&256?(Qa(l),l.flags&=-257,l=Lv(i,l,d)):l.memoizedState!==null?(Ya(),l.child=i.child,l.flags|=128,l=null):(Ya(),N=p.fallback,b=l.mode,p=Sh({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,tl(l,i.child,null,d),p=l.child,p.memoizedState=Nv(d),p.childLanes=Ov(i,A,d),l.memoizedState=Pv,l=Ku(null,p));else if(Qa(l),gy(N)){if(A=N.nextSibling&&N.nextSibling.dataset,A)var re=A.dgst;A=re,p=Error(r(419)),p.stack="",p.digest=A,zu({value:p,source:null,stack:null}),l=Lv(i,l,d)}else if(er||sc(i,l,d,!1),A=(d&i.childLanes)!==0,er||A){if(A=un,A!==null&&(p=X(A,d),p!==0&&p!==q.retryLane))throw q.retryLane=p,Ws(i,p),Qr(A,i,p),Av;my(N)||Ah(),l=Lv(i,l,d)}else my(N)?(l.flags|=192,l.child=i.child,l=null):(i=q.treeContext,wn=Di(N.nextSibling),xr=l,$t=!0,Va=null,Ri=!1,i!==null&&uj(l,i),l=Mv(l,p.children),l.flags|=4096);return l}return b?(Ya(),N=p.fallback,b=l.mode,q=i.child,re=q.sibling,p=ta(q,{mode:"hidden",children:p.children}),p.subtreeFlags=q.subtreeFlags&65011712,re!==null?N=ta(re,N):(N=Qs(N,b,d,null),N.flags|=2),N.return=l,p.return=l,p.sibling=N,l.child=p,Ku(null,p),p=l.child,N=i.child.memoizedState,N===null?N=Nv(d):(b=N.cachePool,b!==null?(q=Jn._currentValue,b=b.parent!==q?{parent:q,pool:q}:b):b=gj(),N={baseLanes:N.baseLanes|d,cachePool:b}),p.memoizedState=N,p.childLanes=Ov(i,A,d),l.memoizedState=Pv,Ku(i.child,p)):(Qa(l),d=i.child,i=d.sibling,d=ta(d,{mode:"visible",children:p.children}),d.return=l,d.sibling=null,i!==null&&(A=l.deletions,A===null?(l.deletions=[i],l.flags|=16):A.push(i)),l.child=d,l.memoizedState=null,d)}function Mv(i,l){return l=Sh({mode:"visible",children:l},i.mode),l.return=i,i.child=l}function Sh(i,l){return i=ai(22,i,null,l),i.lanes=0,i}function Lv(i,l,d){return tl(l,i.child,null,d),i=Mv(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function Dw(i,l,d){i.lanes|=l;var p=i.alternate;p!==null&&(p.lanes|=l),Xg(i.return,l,d)}function Iv(i,l,d,p,b,j){var A=i.memoizedState;A===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:b,treeForkCount:j}:(A.isBackwards=l,A.rendering=null,A.renderingStartTime=0,A.last=p,A.tail=d,A.tailMode=b,A.treeForkCount=j)}function Aw(i,l,d){var p=l.pendingProps,b=p.revealOrder,j=p.tail;p=p.children;var A=Gn.current,N=(A&2)!==0;if(N?(A=A&1|2,l.flags|=128):A&=1,se(Gn,A),Sr(i,l,p,d),p=$t?Iu:0,!N&&i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Dw(i,d,l);else if(i.tag===19)Dw(i,d,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(b){case"forwards":for(d=l.child,b=null;d!==null;)i=d.alternate,i!==null&&ch(i)===null&&(b=d),d=d.sibling;d=b,d===null?(b=l.child,l.child=null):(b=d.sibling,d.sibling=null),Iv(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(i=b.alternate,i!==null&&ch(i)===null){l.child=b;break}i=b.sibling,b.sibling=d,d=b,b=i}Iv(l,!0,d,null,j,p);break;case"together":Iv(l,!1,null,null,void 0,p);break;default:l.memoizedState=null}return l.child}function sa(i,l,d){if(i!==null&&(l.dependencies=i.dependencies),Ja|=l.lanes,(d&l.childLanes)===0)if(i!==null){if(sc(i,l,d,!1),(d&l.childLanes)===0)return null}else return null;if(i!==null&&l.child!==i.child)throw Error(r(153));if(l.child!==null){for(i=l.child,d=ta(i,i.pendingProps),l.child=d,d.return=l;i.sibling!==null;)i=i.sibling,d=d.sibling=ta(i,i.pendingProps),d.return=l;d.sibling=null}return l.child}function zv(i,l){return(i.lanes&l)!==0?!0:(i=i.dependencies,!!(i!==null&&th(i)))}function E4(i,l,d){switch(l.tag){case 3:Ye(l,l.stateNode.containerInfo),Ha(l,Jn,i.memoizedState.cache),Ys();break;case 27:case 5:ht(l);break;case 4:Ye(l,l.stateNode.containerInfo);break;case 10:Ha(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,cv(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(i,l,d):(Qa(l),i=sa(i,l,d),i!==null?i.sibling:null);Qa(l);break;case 19:var b=(i.flags&128)!==0;if(p=(d&l.childLanes)!==0,p||(sc(i,l,d,!1),p=(d&l.childLanes)!==0),b){if(p)return Aw(i,l,d);l.flags|=128}if(b=l.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),se(Gn,Gn.current),p)break;return null;case 22:return l.lanes=0,jw(i,l,d,l.pendingProps);case 24:Ha(l,Jn,i.memoizedState.cache)}return sa(i,l,d)}function kw(i,l,d){if(i!==null)if(i.memoizedProps!==l.pendingProps)er=!0;else{if(!zv(i,d)&&(l.flags&128)===0)return er=!1,E4(i,l,d);er=(i.flags&131072)!==0}else er=!1,$t&&(l.flags&1048576)!==0&&cj(l,Iu,l.index);switch(l.lanes=0,l.tag){case 16:e:{var p=l.pendingProps;if(i=Zs(l.elementType),l.type=i,typeof i=="function")Fg(i)?(p=rl(i,p),l.tag=1,l=Tw(null,l,i,p,d)):(l.tag=0,l=kv(null,l,i,p,d));else{if(i!=null){var b=i.$$typeof;if(b===_){l.tag=11,l=xw(null,l,i,p,d);break e}else if(b===D){l.tag=14,l=bw(null,l,i,p,d);break e}}throw l=B(i)||i,Error(r(306,l,""))}}return l;case 0:return kv(i,l,l.type,l.pendingProps,d);case 1:return p=l.type,b=rl(p,l.pendingProps),Tw(i,l,p,b,d);case 3:e:{if(Ye(l,l.stateNode.containerInfo),i===null)throw Error(r(387));p=l.pendingProps;var j=l.memoizedState;b=j.element,iv(i,l),qu(l,p,null,d);var A=l.memoizedState;if(p=A.cache,Ha(l,Jn,p),p!==j.cache&&Jg(l,[Jn],d,!0),Hu(),p=A.element,j.isDehydrated)if(j={element:p,isDehydrated:!1,cache:A.cache},l.updateQueue.baseState=j,l.memoizedState=j,l.flags&256){l=Rw(i,l,p,d);break e}else if(p!==b){b=Ci(Error(r(424)),l),zu(b),l=Rw(i,l,p,d);break e}else for(i=l.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,wn=Di(i.firstChild),xr=l,$t=!0,Va=null,Ri=!0,d=jj(l,null,p,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Ys(),p===b){l=sa(i,l,d);break e}Sr(i,l,p,d)}l=l.child}return l;case 26:return bh(i,l),i===null?(d=VC(l.type,null,l.pendingProps,null))?l.memoizedState=d:$t||(d=l.type,i=l.pendingProps,p=Ih(Ce.current).createElement(d),p[Le]=l,p[Ve]=i,jr(p,d,i),Nn(p),l.stateNode=p):l.memoizedState=VC(l.type,i.memoizedProps,l.pendingProps,i.memoizedState),null;case 27:return ht(l),i===null&&$t&&(p=l.stateNode=$C(l.type,l.pendingProps,Ce.current),xr=l,Ri=!0,b=wn,rs(l.type)?(vy=b,wn=Di(p.firstChild)):wn=b),Sr(i,l,l.pendingProps.children,d),bh(i,l),i===null&&(l.flags|=4194304),l.child;case 5:return i===null&&$t&&((b=p=wn)&&(p=t3(p,l.type,l.pendingProps,Ri),p!==null?(l.stateNode=p,xr=l,wn=Di(p.firstChild),Ri=!1,b=!0):b=!1),b||Fa(l)),ht(l),b=l.type,j=l.pendingProps,A=i!==null?i.memoizedProps:null,p=j.children,fy(b,j)?p=null:A!==null&&fy(b,A)&&(l.flags|=32),l.memoizedState!==null&&(b=dv(i,l,g4,null,null,d),dd._currentValue=b),bh(i,l),Sr(i,l,p,d),l.child;case 6:return i===null&&$t&&((i=d=wn)&&(d=n3(d,l.pendingProps,Ri),d!==null?(l.stateNode=d,xr=l,wn=null,i=!0):i=!1),i||Fa(l)),null;case 13:return _w(i,l,d);case 4:return Ye(l,l.stateNode.containerInfo),p=l.pendingProps,i===null?l.child=tl(l,null,p,d):Sr(i,l,p,d),l.child;case 11:return xw(i,l,l.type,l.pendingProps,d);case 7:return Sr(i,l,l.pendingProps,d),l.child;case 8:return Sr(i,l,l.pendingProps.children,d),l.child;case 12:return Sr(i,l,l.pendingProps.children,d),l.child;case 10:return p=l.pendingProps,Ha(l,l.type,p.value),Sr(i,l,p.children,d),l.child;case 9:return b=l.type._context,p=l.pendingProps.children,Xs(l),b=br(b),p=p(b),l.flags|=1,Sr(i,l,p,d),l.child;case 14:return bw(i,l,l.type,l.pendingProps,d);case 15:return Sw(i,l,l.type,l.pendingProps,d);case 19:return Aw(i,l,d);case 31:return C4(i,l,d);case 22:return jw(i,l,d,l.pendingProps);case 24:return Xs(l),p=br(Jn),i===null?(b=tv(),b===null&&(b=un,j=Zg(),b.pooledCache=j,j.refCount++,j!==null&&(b.pooledCacheLanes|=d),b=j),l.memoizedState={parent:p,cache:b},rv(l),Ha(l,Jn,b)):((i.lanes&d)!==0&&(iv(i,l),qu(l,null,null,d),Hu()),b=i.memoizedState,j=l.memoizedState,b.parent!==p?(b={parent:p,cache:p},l.memoizedState=b,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=b),Ha(l,Jn,p)):(p=j.cache,Ha(l,Jn,p),p!==b.cache&&Jg(l,[Jn],d,!0))),Sr(i,l,l.pendingProps.children,d),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function la(i){i.flags|=4}function $v(i,l,d,p,b){if((l=(i.mode&32)!==0)&&(l=!1),l){if(i.flags|=16777216,(b&335544128)===b)if(i.stateNode.complete)i.flags|=8192;else if(iC())i.flags|=8192;else throw el=oh,nv}else i.flags&=-16777217}function Pw(i,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!WC(l))if(iC())i.flags|=8192;else throw el=oh,nv}function jh(i,l){l!==null&&(i.flags|=4),i.flags&16384&&(l=i.tag!==22?vr():536870912,i.lanes|=l,xc|=l)}function Xu(i,l){if(!$t)switch(i.tailMode){case"hidden":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:p.sibling=null}}function Cn(i){var l=i.alternate!==null&&i.alternate.child===i.child,d=0,p=0;if(l)for(var b=i.child;b!==null;)d|=b.lanes|b.childLanes,p|=b.subtreeFlags&65011712,p|=b.flags&65011712,b.return=i,b=b.sibling;else for(b=i.child;b!==null;)d|=b.lanes|b.childLanes,p|=b.subtreeFlags,p|=b.flags,b.return=i,b=b.sibling;return i.subtreeFlags|=p,i.childLanes=d,l}function T4(i,l,d){var p=l.pendingProps;switch(Wg(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Cn(l),null;case 1:return Cn(l),null;case 3:return d=l.stateNode,p=null,i!==null&&(p=i.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),ia(Jn),De(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(ac(l)?la(l):i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Yg())),Cn(l),null;case 26:var b=l.type,j=l.memoizedState;return i===null?(la(l),j!==null?(Cn(l),Pw(l,j)):(Cn(l),$v(l,b,null,p,d))):j?j!==i.memoizedState?(la(l),Cn(l),Pw(l,j)):(Cn(l),l.flags&=-16777217):(i=i.memoizedProps,i!==p&&la(l),Cn(l),$v(l,b,i,p,d)),null;case 27:if(Rt(l),d=Ce.current,b=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==p&&la(l);else{if(!p){if(l.stateNode===null)throw Error(r(166));return Cn(l),null}i=de.current,ac(l)?dj(l):(i=$C(b,p,d),l.stateNode=i,la(l))}return Cn(l),null;case 5:if(Rt(l),b=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==p&&la(l);else{if(!p){if(l.stateNode===null)throw Error(r(166));return Cn(l),null}if(j=de.current,ac(l))dj(l);else{var A=Ih(Ce.current);switch(j){case 1:j=A.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:j=A.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":j=A.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":j=A.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":j=A.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof p.is=="string"?A.createElement("select",{is:p.is}):A.createElement("select"),p.multiple?j.multiple=!0:p.size&&(j.size=p.size);break;default:j=typeof p.is=="string"?A.createElement(b,{is:p.is}):A.createElement(b)}}j[Le]=l,j[Ve]=p;e:for(A=l.child;A!==null;){if(A.tag===5||A.tag===6)j.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===l)break e;for(;A.sibling===null;){if(A.return===null||A.return===l)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}l.stateNode=j;e:switch(jr(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&&la(l)}}return Cn(l),$v(l,l.type,i===null?null:i.memoizedProps,l.pendingProps,d),null;case 6:if(i&&l.stateNode!=null)i.memoizedProps!==p&&la(l);else{if(typeof p!="string"&&l.stateNode===null)throw Error(r(166));if(i=Ce.current,ac(l)){if(i=l.stateNode,d=l.memoizedProps,p=null,b=xr,b!==null)switch(b.tag){case 27:case 5:p=b.memoizedProps}i[Le]=l,i=!!(i.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||_C(i.nodeValue,d)),i||Fa(l,!0)}else i=Ih(i).createTextNode(p),i[Le]=l,l.stateNode=i}return Cn(l),null;case 31:if(d=l.memoizedState,i===null||i.memoizedState!==null){if(p=ac(l),d!==null){if(i===null){if(!p)throw Error(r(318));if(i=l.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Le]=l}else Ys(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Cn(l),i=!1}else d=Yg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),i=!0;if(!i)return l.flags&256?(li(l),l):(li(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Cn(l),null;case 13:if(p=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(b=ac(l),p!==null&&p.dehydrated!==null){if(i===null){if(!b)throw Error(r(318));if(b=l.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[Le]=l}else Ys(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Cn(l),b=!1}else b=Yg(),i!==null&&i.memoizedState!==null&&(i.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,i=i!==null&&i.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!==i&&d&&(l.child.flags|=8192),jh(l,l.updateQueue),Cn(l),null);case 4:return De(),i===null&&sy(l.stateNode.containerInfo),Cn(l),null;case 10:return ia(l.type),Cn(l),null;case 19:if(F(Gn),p=l.memoizedState,p===null)return Cn(l),null;if(b=(l.flags&128)!==0,j=p.rendering,j===null)if(b)Xu(p,!1);else{if(Bn!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(j=ch(i),j!==null){for(l.flags|=128,Xu(p,!1),i=j.updateQueue,l.updateQueue=i,jh(l,i),l.subtreeFlags=0,i=d,d=l.child;d!==null;)aj(d,i),d=d.sibling;return se(Gn,Gn.current&1|2),$t&&na(l,p.treeForkCount),l.child}i=i.sibling}p.tail!==null&&lt()>Rh&&(l.flags|=128,b=!0,Xu(p,!1),l.lanes=4194304)}else{if(!b)if(i=ch(j),i!==null){if(l.flags|=128,b=!0,i=i.updateQueue,l.updateQueue=i,jh(l,i),Xu(p,!0),p.tail===null&&p.tailMode==="hidden"&&!j.alternate&&!$t)return Cn(l),null}else 2*lt()-p.renderingStartTime>Rh&&d!==536870912&&(l.flags|=128,b=!0,Xu(p,!1),l.lanes=4194304);p.isBackwards?(j.sibling=l.child,l.child=j):(i=p.last,i!==null?i.sibling=j:l.child=j,p.last=j)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=lt(),i.sibling=null,d=Gn.current,se(Gn,b?d&1|2:d&1),$t&&na(l,p.treeForkCount),i):(Cn(l),null);case 22:case 23:return li(l),lv(),p=l.memoizedState!==null,i!==null?i.memoizedState!==null!==p&&(l.flags|=8192):p&&(l.flags|=8192),p?(d&536870912)!==0&&(l.flags&128)===0&&(Cn(l),l.subtreeFlags&6&&(l.flags|=8192)):Cn(l),d=l.updateQueue,d!==null&&jh(l,d.retryQueue),d=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048),i!==null&&F(Js),null;case 24:return d=null,i!==null&&(d=i.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),ia(Jn),Cn(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function R4(i,l){switch(Wg(l),l.tag){case 1:return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return ia(Jn),De(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 26:case 27:case 5:return Rt(l),null;case 31:if(l.memoizedState!==null){if(li(l),l.alternate===null)throw Error(r(340));Ys()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 13:if(li(l),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Ys()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return F(Gn),null;case 4:return De(),null;case 10:return ia(l.type),null;case 22:case 23:return li(l),lv(),i!==null&&F(Js),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 24:return ia(Jn),null;case 25:return null;default:return null}}function Nw(i,l){switch(Wg(l),l.tag){case 3:ia(Jn),De();break;case 26:case 27:case 5:Rt(l);break;case 4:De();break;case 31:l.memoizedState!==null&&li(l);break;case 13:li(l);break;case 19:F(Gn);break;case 10:ia(l.type);break;case 22:case 23:li(l),lv(),i!==null&&F(Js);break;case 24:ia(Jn)}}function Ju(i,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&i)===i){p=void 0;var j=d.create,A=d.inst;p=j(),A.destroy=p}d=d.next}while(d!==b)}}catch(N){en(l,l.return,N)}}function Ka(i,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&i)===i){var A=p.inst,N=A.destroy;if(N!==void 0){A.destroy=void 0,b=l;var q=d,re=N;try{re()}catch(pe){en(b,q,pe)}}}p=p.next}while(p!==j)}}catch(pe){en(l,l.return,pe)}}function Ow(i){var l=i.updateQueue;if(l!==null){var d=i.stateNode;try{Cj(l,d)}catch(p){en(i,i.return,p)}}}function Mw(i,l,d){d.props=rl(i.type,i.memoizedProps),d.state=i.memoizedState;try{d.componentWillUnmount()}catch(p){en(i,l,p)}}function Zu(i,l){try{var d=i.ref;if(d!==null){switch(i.tag){case 26:case 27:case 5:var p=i.stateNode;break;case 30:p=i.stateNode;break;default:p=i.stateNode}typeof d=="function"?i.refCleanup=d(p):d.current=p}}catch(b){en(i,l,b)}}function Co(i,l){var d=i.ref,p=i.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(b){en(i,l,b)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(b){en(i,l,b)}else d.current=null}function Lw(i){var l=i.type,d=i.memoizedProps,p=i.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){en(i,i.return,b)}}function Uv(i,l,d){try{var p=i.stateNode;Y4(p,i.type,d,l),p[Ve]=l}catch(b){en(i,i.return,b)}}function Iw(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&rs(i.type)||i.tag===4}function Bv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Iw(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&rs(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Vv(i,l,d){var p=i.tag;if(p===5||p===6)i=i.stateNode,l?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(i,l):(l=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,l.appendChild(i),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=Zo));else if(p!==4&&(p===27&&rs(i.type)&&(d=i.stateNode,l=null),i=i.child,i!==null))for(Vv(i,l,d),i=i.sibling;i!==null;)Vv(i,l,d),i=i.sibling}function wh(i,l,d){var p=i.tag;if(p===5||p===6)i=i.stateNode,l?d.insertBefore(i,l):d.appendChild(i);else if(p!==4&&(p===27&&rs(i.type)&&(d=i.stateNode),i=i.child,i!==null))for(wh(i,l,d),i=i.sibling;i!==null;)wh(i,l,d),i=i.sibling}function zw(i){var l=i.stateNode,d=i.memoizedProps;try{for(var p=i.type,b=l.attributes;b.length;)l.removeAttributeNode(b[0]);jr(l,p,d),l[Le]=i,l[Ve]=d}catch(j){en(i,i.return,j)}}var ca=!1,tr=!1,Fv=!1,$w=typeof WeakSet=="function"?WeakSet:Set,lr=null;function _4(i,l){if(i=i.containerInfo,uy=Hh,i=X1(i),Lg(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.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 A=0,N=-1,q=-1,re=0,pe=0,ye=i,ae=null;t:for(;;){for(var ue;ye!==d||b!==0&&ye.nodeType!==3||(N=A+b),ye!==j||p!==0&&ye.nodeType!==3||(q=A+p),ye.nodeType===3&&(A+=ye.nodeValue.length),(ue=ye.firstChild)!==null;)ae=ye,ye=ue;for(;;){if(ye===i)break t;if(ae===d&&++re===b&&(N=A),ae===j&&++pe===p&&(q=A),(ue=ye.nextSibling)!==null)break;ye=ae,ae=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(dy={focusedElem:i,selectionRange:d},Hh=!1,lr=l;lr!==null;)if(l=lr,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,lr=i;else for(;lr!==null;){switch(l=lr,j=l.alternate,i=l.flags,l.tag){case 0:if((i&4)!==0&&(i=l.updateQueue,i=i!==null?i.events:null,i!==null))for(d=0;d<i.length;d++)b=i[d],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&j!==null){i=void 0,d=l,b=j.memoizedProps,j=j.memoizedState,p=d.stateNode;try{var Ge=rl(d.type,b);i=p.getSnapshotBeforeUpdate(Ge,j),p.__reactInternalSnapshotBeforeUpdate=i}catch(ct){en(d,d.return,ct)}}break;case 3:if((i&1024)!==0){if(i=l.stateNode.containerInfo,d=i.nodeType,d===9)py(i);else if(d===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":py(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=l.sibling,i!==null){i.return=l.return,lr=i;break}lr=l.return}}function Uw(i,l,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:da(i,d),p&4&&Ju(5,d);break;case 1:if(da(i,d),p&4)if(i=d.stateNode,l===null)try{i.componentDidMount()}catch(A){en(d,d.return,A)}else{var b=rl(d.type,l.memoizedProps);l=l.memoizedState;try{i.componentDidUpdate(b,l,i.__reactInternalSnapshotBeforeUpdate)}catch(A){en(d,d.return,A)}}p&64&&Ow(d),p&512&&Zu(d,d.return);break;case 3:if(da(i,d),p&64&&(i=d.updateQueue,i!==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(i,l)}catch(A){en(d,d.return,A)}}break;case 27:l===null&&p&4&&zw(d);case 26:case 5:da(i,d),l===null&&p&4&&Lw(d),p&512&&Zu(d,d.return);break;case 12:da(i,d);break;case 31:da(i,d),p&4&&Fw(i,d);break;case 13:da(i,d),p&4&&Hw(i,d),p&64&&(i=d.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(d=I4.bind(null,d),r3(i,d))));break;case 22:if(p=d.memoizedState!==null||ca,!p){l=l!==null&&l.memoizedState!==null||tr,b=ca;var j=tr;ca=p,(tr=l)&&!j?fa(i,d,(d.subtreeFlags&8772)!==0):da(i,d),ca=b,tr=j}break;case 30:break;default:da(i,d)}}function Bw(i){var l=i.alternate;l!==null&&(i.alternate=null,Bw(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&Pn(l)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var On=null,Hr=!1;function ua(i,l,d){for(d=d.child;d!==null;)Vw(i,l,d),d=d.sibling}function Vw(i,l,d){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(Cr,d)}catch{}switch(d.tag){case 26:tr||Co(d,l),ua(i,l,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:tr||Co(d,l);var p=On,b=Hr;rs(d.type)&&(On=d.stateNode,Hr=!1),ua(i,l,d),ld(d.stateNode),On=p,Hr=b;break;case 5:tr||Co(d,l);case 6:if(p=On,b=Hr,On=null,ua(i,l,d),On=p,Hr=b,On!==null)if(Hr)try{(On.nodeType===9?On.body:On.nodeName==="HTML"?On.ownerDocument.body:On).removeChild(d.stateNode)}catch(j){en(d,l,j)}else try{On.removeChild(d.stateNode)}catch(j){en(d,l,j)}break;case 18:On!==null&&(Hr?(i=On,OC(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,d.stateNode),Rc(i)):OC(On,d.stateNode));break;case 4:p=On,b=Hr,On=d.stateNode.containerInfo,Hr=!0,ua(i,l,d),On=p,Hr=b;break;case 0:case 11:case 14:case 15:Ka(2,d,l),tr||Ka(4,d,l),ua(i,l,d);break;case 1:tr||(Co(d,l),p=d.stateNode,typeof p.componentWillUnmount=="function"&&Mw(d,l,p)),ua(i,l,d);break;case 21:ua(i,l,d);break;case 22:tr=(p=tr)||d.memoizedState!==null,ua(i,l,d),tr=p;break;default:ua(i,l,d)}}function Fw(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Rc(i)}catch(d){en(l,l.return,d)}}}function Hw(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Rc(i)}catch(d){en(l,l.return,d)}}function D4(i){switch(i.tag){case 31:case 13:case 19:var l=i.stateNode;return l===null&&(l=i.stateNode=new $w),l;case 22:return i=i.stateNode,l=i._retryCache,l===null&&(l=i._retryCache=new $w),l;default:throw Error(r(435,i.tag))}}function Ch(i,l){var d=D4(i);l.forEach(function(p){if(!d.has(p)){d.add(p);var b=z4.bind(null,i,p);p.then(b,b)}})}function qr(i,l){var d=l.deletions;if(d!==null)for(var p=0;p<d.length;p++){var b=d[p],j=i,A=l,N=A;e:for(;N!==null;){switch(N.tag){case 27:if(rs(N.type)){On=N.stateNode,Hr=!1;break e}break;case 5:On=N.stateNode,Hr=!1;break e;case 3:case 4:On=N.stateNode.containerInfo,Hr=!0;break e}N=N.return}if(On===null)throw Error(r(160));Vw(j,A,b),On=null,Hr=!1,j=b.alternate,j!==null&&(j.return=null),b.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)qw(l,i),l=l.sibling}var ro=null;function qw(i,l){var d=i.alternate,p=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:qr(l,i),Gr(i),p&4&&(Ka(3,i,i.return),Ju(3,i),Ka(5,i,i.return));break;case 1:qr(l,i),Gr(i),p&512&&(tr||d===null||Co(d,d.return)),p&64&&ca&&(i=i.updateQueue,i!==null&&(p=i.callbacks,p!==null&&(d=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var b=ro;if(qr(l,i),Gr(i),p&512&&(tr||d===null||Co(d,d.return)),p&4){var j=d!==null?d.memoizedState:null;if(p=i.memoizedState,d===null)if(p===null)if(i.stateNode===null){e:{p=i.type,d=i.memoizedProps,b=b.ownerDocument||b;t:switch(p){case"title":j=b.getElementsByTagName("title")[0],(!j||j[xn]||j[Le]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=b.createElement(p),b.head.insertBefore(j,b.querySelector("head > title"))),jr(j,p,d),j[Le]=i,Nn(j),p=j;break e;case"link":var A=qC("link","href",b).get(p+(d.href||""));if(A){for(var N=0;N<A.length;N++)if(j=A[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)){A.splice(N,1);break t}}j=b.createElement(p),jr(j,p,d),b.head.appendChild(j);break;case"meta":if(A=qC("meta","content",b).get(p+(d.content||""))){for(N=0;N<A.length;N++)if(j=A[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)){A.splice(N,1);break t}}j=b.createElement(p),jr(j,p,d),b.head.appendChild(j);break;default:throw Error(r(468,p))}j[Le]=i,Nn(j),p=j}i.stateNode=p}else GC(b,i.type,i.stateNode);else i.stateNode=HC(b,p,i.memoizedProps);else j!==p?(j===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):j.count--,p===null?GC(b,i.type,i.stateNode):HC(b,p,i.memoizedProps)):p===null&&i.stateNode!==null&&Uv(i,i.memoizedProps,d.memoizedProps)}break;case 27:qr(l,i),Gr(i),p&512&&(tr||d===null||Co(d,d.return)),d!==null&&p&4&&Uv(i,i.memoizedProps,d.memoizedProps);break;case 5:if(qr(l,i),Gr(i),p&512&&(tr||d===null||Co(d,d.return)),i.flags&32){b=i.stateNode;try{Kl(b,"")}catch(Ge){en(i,i.return,Ge)}}p&4&&i.stateNode!=null&&(b=i.memoizedProps,Uv(i,b,d!==null?d.memoizedProps:b)),p&1024&&(Fv=!0);break;case 6:if(qr(l,i),Gr(i),p&4){if(i.stateNode===null)throw Error(r(162));p=i.memoizedProps,d=i.stateNode;try{d.nodeValue=p}catch(Ge){en(i,i.return,Ge)}}break;case 3:if(Uh=null,b=ro,ro=zh(l.containerInfo),qr(l,i),ro=b,Gr(i),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Rc(l.containerInfo)}catch(Ge){en(i,i.return,Ge)}Fv&&(Fv=!1,Gw(i));break;case 4:p=ro,ro=zh(i.stateNode.containerInfo),qr(l,i),Gr(i),ro=p;break;case 12:qr(l,i),Gr(i);break;case 31:qr(l,i),Gr(i),p&4&&(p=i.updateQueue,p!==null&&(i.updateQueue=null,Ch(i,p)));break;case 13:qr(l,i),Gr(i),i.child.flags&8192&&i.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Th=lt()),p&4&&(p=i.updateQueue,p!==null&&(i.updateQueue=null,Ch(i,p)));break;case 22:b=i.memoizedState!==null;var q=d!==null&&d.memoizedState!==null,re=ca,pe=tr;if(ca=re||b,tr=pe||q,qr(l,i),tr=pe,ca=re,Gr(i),p&8192)e:for(l=i.stateNode,l._visibility=b?l._visibility&-2:l._visibility|1,b&&(d===null||q||ca||tr||il(i)),d=null,l=i;;){if(l.tag===5||l.tag===26){if(d===null){q=d=l;try{if(j=q.stateNode,b)A=j.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{N=q.stateNode;var ye=q.memoizedProps.style,ae=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;N.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Ge){en(q,q.return,Ge)}}}else if(l.tag===6){if(d===null){q=l;try{q.stateNode.nodeValue=b?"":q.memoizedProps}catch(Ge){en(q,q.return,Ge)}}}else if(l.tag===18){if(d===null){q=l;try{var ue=q.stateNode;b?MC(ue,!0):MC(q.stateNode,!1)}catch(Ge){en(q,q.return,Ge)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===i)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break e;for(;l.sibling===null;){if(l.return===null||l.return===i)break e;d===l&&(d=null),l=l.return}d===l&&(d=null),l.sibling.return=l.return,l=l.sibling}p&4&&(p=i.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,Ch(i,d))));break;case 19:qr(l,i),Gr(i),p&4&&(p=i.updateQueue,p!==null&&(i.updateQueue=null,Ch(i,p)));break;case 30:break;case 21:break;default:qr(l,i),Gr(i)}}function Gr(i){var l=i.flags;if(l&2){try{for(var d,p=i.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=Bv(i);wh(i,j,b);break;case 5:var A=d.stateNode;d.flags&32&&(Kl(A,""),d.flags&=-33);var N=Bv(i);wh(i,N,A);break;case 3:case 4:var q=d.stateNode.containerInfo,re=Bv(i);Vv(i,re,q);break;default:throw Error(r(161))}}catch(pe){en(i,i.return,pe)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function Gw(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var l=i;Gw(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),i=i.sibling}}function da(i,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)Uw(i,l.alternate,l),l=l.sibling}function il(i){for(i=i.child;i!==null;){var l=i;switch(l.tag){case 0:case 11:case 14:case 15:Ka(4,l,l.return),il(l);break;case 1:Co(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&Mw(l,l.return,d),il(l);break;case 27:ld(l.stateNode);case 26:case 5:Co(l,l.return),il(l);break;case 22:l.memoizedState===null&&il(l);break;case 30:il(l);break;default:il(l)}i=i.sibling}}function fa(i,l,d){for(d=d&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var p=l.alternate,b=i,j=l,A=j.flags;switch(j.tag){case 0:case 11:case 15:fa(b,j,d),Ju(4,j);break;case 1:if(fa(b,j,d),p=j,b=p.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(re){en(p,p.return,re)}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(re){en(p,p.return,re)}}d&&A&64&&Ow(j),Zu(j,j.return);break;case 27:zw(j);case 26:case 5:fa(b,j,d),d&&p===null&&A&4&&Lw(j),Zu(j,j.return);break;case 12:fa(b,j,d);break;case 31:fa(b,j,d),d&&A&4&&Fw(b,j);break;case 13:fa(b,j,d),d&&A&4&&Hw(b,j);break;case 22:j.memoizedState===null&&fa(b,j,d),Zu(j,j.return);break;case 30:break;default:fa(b,j,d)}l=l.sibling}}function Hv(i,l){var d=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),i=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(i=l.memoizedState.cachePool.pool),i!==d&&(i!=null&&i.refCount++,d!=null&&$u(d))}function qv(i,l){i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&$u(i))}function io(i,l,d,p){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Ww(i,l,d,p),l=l.sibling}function Ww(i,l,d,p){var b=l.flags;switch(l.tag){case 0:case 11:case 15:io(i,l,d,p),b&2048&&Ju(9,l);break;case 1:io(i,l,d,p);break;case 3:io(i,l,d,p),b&2048&&(i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&$u(i)));break;case 12:if(b&2048){io(i,l,d,p),i=l.stateNode;try{var j=l.memoizedProps,A=j.id,N=j.onPostCommit;typeof N=="function"&&N(A,l.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(q){en(l,l.return,q)}}else io(i,l,d,p);break;case 31:io(i,l,d,p);break;case 13:io(i,l,d,p);break;case 23:break;case 22:j=l.stateNode,A=l.alternate,l.memoizedState!==null?j._visibility&2?io(i,l,d,p):ed(i,l):j._visibility&2?io(i,l,d,p):(j._visibility|=2,gc(i,l,d,p,(l.subtreeFlags&10256)!==0||!1)),b&2048&&Hv(A,l);break;case 24:io(i,l,d,p),b&2048&&qv(l.alternate,l);break;default:io(i,l,d,p)}}function gc(i,l,d,p,b){for(b=b&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var j=i,A=l,N=d,q=p,re=A.flags;switch(A.tag){case 0:case 11:case 15:gc(j,A,N,q,b),Ju(8,A);break;case 23:break;case 22:var pe=A.stateNode;A.memoizedState!==null?pe._visibility&2?gc(j,A,N,q,b):ed(j,A):(pe._visibility|=2,gc(j,A,N,q,b)),b&&re&2048&&Hv(A.alternate,A);break;case 24:gc(j,A,N,q,b),b&&re&2048&&qv(A.alternate,A);break;default:gc(j,A,N,q,b)}l=l.sibling}}function ed(i,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var d=i,p=l,b=p.flags;switch(p.tag){case 22:ed(d,p),b&2048&&Hv(p.alternate,p);break;case 24:ed(d,p),b&2048&&qv(p.alternate,p);break;default:ed(d,p)}l=l.sibling}}var td=8192;function vc(i,l,d){if(i.subtreeFlags&td)for(i=i.child;i!==null;)Qw(i,l,d),i=i.sibling}function Qw(i,l,d){switch(i.tag){case 26:vc(i,l,d),i.flags&td&&i.memoizedState!==null&&m3(d,ro,i.memoizedState,i.memoizedProps);break;case 5:vc(i,l,d);break;case 3:case 4:var p=ro;ro=zh(i.stateNode.containerInfo),vc(i,l,d),ro=p;break;case 22:i.memoizedState===null&&(p=i.alternate,p!==null&&p.memoizedState!==null?(p=td,td=16777216,vc(i,l,d),td=p):vc(i,l,d));break;default:vc(i,l,d)}}function Yw(i){var l=i.alternate;if(l!==null&&(i=l.child,i!==null)){l.child=null;do l=i.sibling,i.sibling=null,i=l;while(i!==null)}}function nd(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var p=l[d];lr=p,Xw(p,i)}Yw(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Kw(i),i=i.sibling}function Kw(i){switch(i.tag){case 0:case 11:case 15:nd(i),i.flags&2048&&Ka(9,i,i.return);break;case 3:nd(i);break;case 12:nd(i);break;case 22:var l=i.stateNode;i.memoizedState!==null&&l._visibility&2&&(i.return===null||i.return.tag!==13)?(l._visibility&=-3,Eh(i)):nd(i);break;default:nd(i)}}function Eh(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var p=l[d];lr=p,Xw(p,i)}Yw(i)}for(i=i.child;i!==null;){switch(l=i,l.tag){case 0:case 11:case 15:Ka(8,l,l.return),Eh(l);break;case 22:d=l.stateNode,d._visibility&2&&(d._visibility&=-3,Eh(l));break;default:Eh(l)}i=i.sibling}}function Xw(i,l){for(;lr!==null;){var d=lr;switch(d.tag){case 0:case 11:case 15:Ka(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:$u(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,lr=p;else e:for(d=i;lr!==null;){p=lr;var b=p.sibling,j=p.return;if(Bw(p),p===d){lr=null;break e}if(b!==null){b.return=j,lr=b;break e}lr=j}}}var A4={getCacheForType:function(i){var l=br(Jn),d=l.data.get(i);return d===void 0&&(d=i(),l.data.set(i,d)),d},cacheSignal:function(){return br(Jn).controller.signal}},k4=typeof WeakMap=="function"?WeakMap:Map,Qt=0,un=null,kt=null,Mt=0,Zt=0,ci=null,Xa=!1,yc=!1,Gv=!1,ha=0,Bn=0,Ja=0,ol=0,Wv=0,ui=0,xc=0,rd=null,Wr=null,Qv=!1,Th=0,Jw=0,Rh=1/0,_h=null,Za=null,rr=0,es=null,bc=null,pa=0,Yv=0,Kv=null,Zw=null,id=0,Xv=null;function di(){return(Qt&2)!==0&&Mt!==0?Mt&-Mt:M.T!==null?ry():Re()}function eC(){if(ui===0)if((Mt&536870912)===0||$t){var i=bi;bi<<=1,(bi&3932160)===0&&(bi=262144),ui=i}else ui=536870912;return i=si.current,i!==null&&(i.flags|=32),ui}function Qr(i,l,d){(i===un&&(Zt===2||Zt===9)||i.cancelPendingCommit!==null)&&(Sc(i,0),ts(i,Mt,ui,!1)),Ln(i,d),((Qt&2)===0||i!==un)&&(i===un&&((Qt&2)===0&&(ol|=d),Bn===4&&ts(i,Mt,ui,!1)),Eo(i))}function tC(i,l,d){if((Qt&6)!==0)throw Error(r(327));var p=!d&&(l&127)===0&&(l&i.expiredLanes)===0||Xi(i,l),b=p?O4(i,l):Zv(i,l,!0),j=p;do{if(b===0){yc&&!p&&ts(i,l,0,!1);break}else{if(d=i.current.alternate,j&&!P4(d)){b=Zv(i,l,!1),j=!1;continue}if(b===2){if(j=l,i.errorRecoveryDisabledLanes&j)var A=0;else A=i.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){l=A;e:{var N=i;b=rd;var q=N.current.memoizedState.isDehydrated;if(q&&(Sc(N,A).flags|=256),A=Zv(N,A,!1),A!==2){if(Gv&&!q){N.errorRecoveryDisabledLanes|=j,ol|=j,b=4;break e}j=Wr,Wr=b,j!==null&&(Wr===null?Wr=j:Wr.push.apply(Wr,j))}b=A}if(j=!1,b!==2)continue}}if(b===1){Sc(i,0),ts(i,l,0,!0);break}e:{switch(p=i,j=b,j){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:ts(p,l,ui,!Xa);break e;case 2:Wr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(b=Th+300-lt(),10<b)){if(ts(p,l,ui,!Xa),So(p,0,!0)!==0)break e;pa=l,p.timeoutHandle=PC(nC.bind(null,p,d,Wr,_h,Qv,l,ui,ol,xc,Xa,j,"Throttled",-0,0),b);break e}nC(p,d,Wr,_h,Qv,l,ui,ol,xc,Xa,j,null,-0,0)}}break}while(!0);Eo(i)}function nC(i,l,d,p,b,j,A,N,q,re,pe,ye,ae,ue){if(i.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:Zo},Qw(l,j,ye);var Ge=(j&62914560)===j?Th-lt():(j&4194048)===j?Jw-lt():0;if(Ge=g3(ye,Ge),Ge!==null){pa=j,i.cancelPendingCommit=Ge(uC.bind(null,i,l,j,d,p,b,A,N,q,pe,ye,null,ae,ue)),ts(i,j,A,!re);return}}uC(i,l,j,d,p,b,A,N,q)}function P4(i){for(var l=i;;){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===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function ts(i,l,d,p){l&=~Wv,l&=~ol,i.suspendedLanes|=l,i.pingedLanes&=~l,p&&(i.warmLanes|=l),p=i.expirationTimes;for(var b=l;0<b;){var j=31-$n(b),A=1<<j;p[j]=-1,b&=~A}d!==0&&Tu(i,d,l)}function Dh(){return(Qt&6)===0?(od(0),!1):!0}function Jv(){if(kt!==null){if(Zt===0)var i=kt.return;else i=kt,ra=Ks=null,pv(i),dc=null,Bu=0,i=kt;for(;i!==null;)Nw(i.alternate,i),i=i.return;kt=null}}function Sc(i,l){var d=i.timeoutHandle;d!==-1&&(i.timeoutHandle=-1,J4(d)),d=i.cancelPendingCommit,d!==null&&(i.cancelPendingCommit=null,d()),pa=0,Jv(),un=i,kt=d=ta(i.current,null),Mt=l,Zt=0,ci=null,Xa=!1,yc=Xi(i,l),Gv=!1,xc=ui=Wv=ol=Ja=Bn=0,Wr=rd=null,Qv=!1,(l&8)!==0&&(l|=l&32);var p=i.entangledLanes;if(p!==0)for(i=i.entanglements,p&=l;0<p;){var b=31-$n(p),j=1<<b;l|=i[b],p&=~j}return ha=l,Kf(),d}function rC(i,l){St=null,M.H=Yu,l===uc||l===ih?(l=xj(),Zt=3):l===nv?(l=xj(),Zt=4):Zt=l===Av?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,ci=l,kt===null&&(Bn=1,yh(i,Ci(l,i.current)))}function iC(){var i=si.current;return i===null?!0:(Mt&4194048)===Mt?_i===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?i===_i:!1}function oC(){var i=M.H;return M.H=Yu,i===null?Yu:i}function aC(){var i=M.A;return M.A=A4,i}function Ah(){Bn=4,Xa||(Mt&4194048)!==Mt&&si.current!==null||(yc=!0),(Ja&134217727)===0&&(ol&134217727)===0||un===null||ts(un,Mt,ui,!1)}function Zv(i,l,d){var p=Qt;Qt|=2;var b=oC(),j=aC();(un!==i||Mt!==l)&&(_h=null,Sc(i,l)),l=!1;var A=Bn;e:do try{if(Zt!==0&&kt!==null){var N=kt,q=ci;switch(Zt){case 8:Jv(),A=6;break e;case 3:case 2:case 9:case 6:si.current===null&&(l=!0);var re=Zt;if(Zt=0,ci=null,jc(i,N,q,re),d&&yc){A=0;break e}break;default:re=Zt,Zt=0,ci=null,jc(i,N,q,re)}}N4(),A=Bn;break}catch(pe){rC(i,pe)}while(!0);return l&&i.shellSuspendCounter++,ra=Ks=null,Qt=p,M.H=b,M.A=j,kt===null&&(un=null,Mt=0,Kf()),A}function N4(){for(;kt!==null;)sC(kt)}function O4(i,l){var d=Qt;Qt|=2;var p=oC(),b=aC();un!==i||Mt!==l?(_h=null,Rh=lt()+500,Sc(i,l)):yc=Xi(i,l);e:do try{if(Zt!==0&&kt!==null){l=kt;var j=ci;t:switch(Zt){case 1:Zt=0,ci=null,jc(i,l,j,1);break;case 2:case 9:if(vj(j)){Zt=0,ci=null,lC(l);break}l=function(){Zt!==2&&Zt!==9||un!==i||(Zt=7),Eo(i)},j.then(l,l);break e;case 3:Zt=7;break e;case 4:Zt=5;break e;case 7:vj(j)?(Zt=0,ci=null,lC(l)):(Zt=0,ci=null,jc(i,l,j,7));break;case 5:var A=null;switch(kt.tag){case 26:A=kt.memoizedState;case 5:case 27:var N=kt;if(A?WC(A):N.stateNode.complete){Zt=0,ci=null;var q=N.sibling;if(q!==null)kt=q;else{var re=N.return;re!==null?(kt=re,kh(re)):kt=null}break t}}Zt=0,ci=null,jc(i,l,j,5);break;case 6:Zt=0,ci=null,jc(i,l,j,6);break;case 8:Jv(),Bn=6;break e;default:throw Error(r(462))}}M4();break}catch(pe){rC(i,pe)}while(!0);return ra=Ks=null,M.H=p,M.A=b,Qt=d,kt!==null?0:(un=null,Mt=0,Kf(),Bn)}function M4(){for(;kt!==null&&!et();)sC(kt)}function sC(i){var l=kw(i.alternate,i,ha);i.memoizedProps=i.pendingProps,l===null?kh(i):kt=l}function lC(i){var l=i,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:pv(l);default:Nw(d,l),l=kt=aj(l,ha),l=kw(d,l,ha)}i.memoizedProps=i.pendingProps,l===null?kh(i):kt=l}function jc(i,l,d,p){ra=Ks=null,pv(l),dc=null,Bu=0;var b=l.return;try{if(w4(i,b,l,d,Mt)){Bn=1,yh(i,Ci(d,i.current)),kt=null;return}}catch(j){if(b!==null)throw kt=b,j;Bn=1,yh(i,Ci(d,i.current)),kt=null;return}l.flags&32768?($t||p===1?i=!0:yc||(Mt&536870912)!==0?i=!1:(Xa=i=!0,(p===2||p===9||p===3||p===6)&&(p=si.current,p!==null&&p.tag===13&&(p.flags|=16384))),cC(l,i)):kh(l)}function kh(i){var l=i;do{if((l.flags&32768)!==0){cC(l,Xa);return}i=l.return;var d=T4(l.alternate,l,ha);if(d!==null){kt=d;return}if(l=l.sibling,l!==null){kt=l;return}kt=l=i}while(l!==null);Bn===0&&(Bn=5)}function cC(i,l){do{var d=R4(i.alternate,i);if(d!==null){d.flags&=32767,kt=d;return}if(d=i.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!l&&(i=i.sibling,i!==null)){kt=i;return}kt=i=d}while(i!==null);Bn=6,kt=null}function uC(i,l,d,p,b,j,A,N,q){i.cancelPendingCommit=null;do Ph();while(rr!==0);if((Qt&6)!==0)throw Error(r(327));if(l!==null){if(l===i.current)throw Error(r(177));if(j=l.lanes|l.childLanes,j|=Bg,Eu(i,d,j,A,N,q),i===un&&(kt=un=null,Mt=0),bc=l,es=i,pa=d,Yv=j,Kv=b,Zw=p,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,$4(vt,function(){return mC(),null})):(i.callbackNode=null,i.callbackPriority=0),p=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||p){p=M.T,M.T=null,b=I.p,I.p=2,A=Qt,Qt|=4;try{_4(i,l,d)}finally{Qt=A,I.p=b,M.T=p}}rr=1,dC(),fC(),hC()}}function dC(){if(rr===1){rr=0;var i=es,l=bc,d=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||d){d=M.T,M.T=null;var p=I.p;I.p=2;var b=Qt;Qt|=4;try{qw(l,i);var j=dy,A=X1(i.containerInfo),N=j.focusedElem,q=j.selectionRange;if(A!==N&&N&&N.ownerDocument&&K1(N.ownerDocument.documentElement,N)){if(q!==null&&Lg(N)){var re=q.start,pe=q.end;if(pe===void 0&&(pe=re),"selectionStart"in N)N.selectionStart=re,N.selectionEnd=Math.min(pe,N.value.length);else{var ye=N.ownerDocument||document,ae=ye&&ye.defaultView||window;if(ae.getSelection){var ue=ae.getSelection(),Ge=N.textContent.length,ct=Math.min(q.start,Ge),cn=q.end===void 0?ct:Math.min(q.end,Ge);!ue.extend&&ct>cn&&(A=cn,cn=ct,ct=A);var J=Y1(N,ct),Q=Y1(N,cn);if(J&&Q&&(ue.rangeCount!==1||ue.anchorNode!==J.node||ue.anchorOffset!==J.offset||ue.focusNode!==Q.node||ue.focusOffset!==Q.offset)){var ne=ye.createRange();ne.setStart(J.node,J.offset),ue.removeAllRanges(),ct>cn?(ue.addRange(ne),ue.extend(Q.node,Q.offset)):(ne.setEnd(Q.node,Q.offset),ue.addRange(ne))}}}}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}}Hh=!!uy,dy=uy=null}finally{Qt=b,I.p=p,M.T=d}}i.current=l,rr=2}}function fC(){if(rr===2){rr=0;var i=es,l=bc,d=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||d){d=M.T,M.T=null;var p=I.p;I.p=2;var b=Qt;Qt|=4;try{Uw(i,l.alternate,l)}finally{Qt=b,I.p=p,M.T=d}}rr=3}}function hC(){if(rr===4||rr===3){rr=0,ft();var i=es,l=bc,d=pa,p=Zw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?rr=5:(rr=0,bc=es=null,pC(i,i.pendingLanes));var b=i.pendingLanes;if(b===0&&(Za=null),je(d),l=l.stateNode,Jt&&typeof Jt.onCommitFiberRoot=="function")try{Jt.onCommitFiberRoot(Cr,l,void 0,(l.current.flags&128)===128)}catch{}if(p!==null){l=M.T,b=I.p,I.p=2,M.T=null;try{for(var j=i.onRecoverableError,A=0;A<p.length;A++){var N=p[A];j(N.value,{componentStack:N.stack})}}finally{M.T=l,I.p=b}}(pa&3)!==0&&Ph(),Eo(i),b=i.pendingLanes,(d&261930)!==0&&(b&42)!==0?i===Xv?id++:(id=0,Xv=i):id=0,od(0)}}function pC(i,l){(i.pooledCacheLanes&=l)===0&&(l=i.pooledCache,l!=null&&(i.pooledCache=null,$u(l)))}function Ph(){return dC(),fC(),hC(),mC()}function mC(){if(rr!==5)return!1;var i=es,l=Yv;Yv=0;var d=je(pa),p=M.T,b=I.p;try{I.p=32>d?32:d,M.T=null,d=Kv,Kv=null;var j=es,A=pa;if(rr=0,bc=es=null,pa=0,(Qt&6)!==0)throw Error(r(331));var N=Qt;if(Qt|=4,Kw(j.current),Ww(j,j.current,A,d),Qt=N,od(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Cr,j)}catch{}return!0}finally{I.p=b,M.T=p,pC(i,l)}}function gC(i,l,d){l=Ci(d,l),l=Dv(i.stateNode,l,2),i=Wa(i,l,2),i!==null&&(Ln(i,2),Eo(i))}function en(i,l,d){if(i.tag===3)gC(i,i,d);else for(;l!==null;){if(l.tag===3){gC(l,i,d);break}else if(l.tag===1){var p=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Za===null||!Za.has(p))){i=Ci(d,i),d=vw(2),p=Wa(l,d,2),p!==null&&(yw(d,p,l,i),Ln(p,2),Eo(p));break}}l=l.return}}function ey(i,l,d){var p=i.pingCache;if(p===null){p=i.pingCache=new k4;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)||(Gv=!0,b.add(d),i=L4.bind(null,i,l,d),l.then(i,i))}function L4(i,l,d){var p=i.pingCache;p!==null&&p.delete(l),i.pingedLanes|=i.suspendedLanes&d,i.warmLanes&=~d,un===i&&(Mt&d)===d&&(Bn===4||Bn===3&&(Mt&62914560)===Mt&&300>lt()-Th?(Qt&2)===0&&Sc(i,0):Wv|=d,xc===Mt&&(xc=0)),Eo(i)}function vC(i,l){l===0&&(l=vr()),i=Ws(i,l),i!==null&&(Ln(i,l),Eo(i))}function I4(i){var l=i.memoizedState,d=0;l!==null&&(d=l.retryLane),vC(i,d)}function z4(i,l){var d=0;switch(i.tag){case 31:case 13:var p=i.stateNode,b=i.memoizedState;b!==null&&(d=b.retryLane);break;case 19:p=i.stateNode;break;case 22:p=i.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(l),vC(i,d)}function $4(i,l){return Ie(i,l)}var Nh=null,wc=null,ty=!1,Oh=!1,ny=!1,ns=0;function Eo(i){i!==wc&&i.next===null&&(wc===null?Nh=wc=i:wc=wc.next=i),Oh=!0,ty||(ty=!0,B4())}function od(i,l){if(!ny&&Oh){ny=!0;do for(var d=!1,p=Nh;p!==null;){if(i!==0){var b=p.pendingLanes;if(b===0)var j=0;else{var A=p.suspendedLanes,N=p.pingedLanes;j=(1<<31-$n(42|i)+1)-1,j&=b&~(A&~N),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(d=!0,SC(p,j))}else j=Mt,j=So(p,p===un?j:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(j&3)===0||Xi(p,j)||(d=!0,SC(p,j));p=p.next}while(d);ny=!1}}function U4(){yC()}function yC(){Oh=ty=!1;var i=0;ns!==0&&X4()&&(i=ns);for(var l=lt(),d=null,p=Nh;p!==null;){var b=p.next,j=xC(p,l);j===0?(p.next=null,d===null?Nh=b:d.next=b,b===null&&(wc=d)):(d=p,(i!==0||(j&3)!==0)&&(Oh=!0)),p=b}rr!==0&&rr!==5||od(i),ns!==0&&(ns=0)}function xC(i,l){for(var d=i.suspendedLanes,p=i.pingedLanes,b=i.expirationTimes,j=i.pendingLanes&-62914561;0<j;){var A=31-$n(j),N=1<<A,q=b[A];q===-1?((N&d)===0||(N&p)!==0)&&(b[A]=$a(N,l)):q<=l&&(i.expiredLanes|=N),j&=~N}if(l=un,d=Mt,d=So(i,i===l?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),p=i.callbackNode,d===0||i===l&&(Zt===2||Zt===9)||i.cancelPendingCommit!==null)return p!==null&&p!==null&&it(p),i.callbackNode=null,i.callbackPriority=0;if((d&3)===0||Xi(i,d)){if(l=d&-d,l===i.callbackPriority)return l;switch(p!==null&&it(p),je(d)){case 2:case 8:d=ke;break;case 32:d=vt;break;case 268435456:d=Kt;break;default:d=vt}return p=bC.bind(null,i),d=Ie(d,p),i.callbackPriority=l,i.callbackNode=d,l}return p!==null&&p!==null&&it(p),i.callbackPriority=2,i.callbackNode=null,2}function bC(i,l){if(rr!==0&&rr!==5)return i.callbackNode=null,i.callbackPriority=0,null;var d=i.callbackNode;if(Ph()&&i.callbackNode!==d)return null;var p=Mt;return p=So(i,i===un?p:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),p===0?null:(tC(i,p,l),xC(i,lt()),i.callbackNode!=null&&i.callbackNode===d?bC.bind(null,i):null)}function SC(i,l){if(Ph())return null;tC(i,l,!0)}function B4(){Z4(function(){(Qt&6)!==0?Ie(he,U4):yC()})}function ry(){if(ns===0){var i=lc;i===0&&(i=ri,ri<<=1,(ri&261888)===0&&(ri=256)),ns=i}return ns}function jC(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Vf(""+i)}function wC(i,l){var d=l.ownerDocument.createElement("input");return d.name=l.name,d.value=l.value,i.id&&d.setAttribute("form",i.id),l.parentNode.insertBefore(d,l),i=new FormData(i),d.parentNode.removeChild(d),i}function V4(i,l,d,p,b){if(l==="submit"&&d&&d.stateNode===b){var j=jC((b[Ve]||null).action),A=p.submitter;A&&(l=(l=A[Ve]||null)?jC(l.formAction):A.getAttribute("formAction"),l!==null&&(j=l,A=null));var N=new Gf("action","action",null,p,b);i.push({event:N,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(ns!==0){var q=A?wC(b,A):new FormData(b);wv(d,{pending:!0,data:q,method:b.method,action:j},null,q)}}else typeof j=="function"&&(N.preventDefault(),q=A?wC(b,A):new FormData(b),wv(d,{pending:!0,data:q,method:b.method,action:j},j,q))},currentTarget:b}]})}}for(var iy=0;iy<Ug.length;iy++){var oy=Ug[iy],F4=oy.toLowerCase(),H4=oy[0].toUpperCase()+oy.slice(1);no(F4,"on"+H4)}no(ej,"onAnimationEnd"),no(tj,"onAnimationIteration"),no(nj,"onAnimationStart"),no("dblclick","onDoubleClick"),no("focusin","onFocus"),no("focusout","onBlur"),no(a4,"onTransitionRun"),no(s4,"onTransitionStart"),no(l4,"onTransitionCancel"),no(rj,"onTransitionEnd"),Si("onMouseEnter",["mouseout","mouseover"]),Si("onMouseLeave",["mouseout","mouseover"]),Si("onPointerEnter",["pointerout","pointerover"]),Si("onPointerLeave",["pointerout","pointerover"]),eo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),eo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),eo("onBeforeInput",["compositionend","keypress","textInput","paste"]),eo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),eo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),eo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ad="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(" "),q4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ad));function CC(i,l){l=(l&4)!==0;for(var d=0;d<i.length;d++){var p=i[d],b=p.event;p=p.listeners;e:{var j=void 0;if(l)for(var A=p.length-1;0<=A;A--){var N=p[A],q=N.instance,re=N.currentTarget;if(N=N.listener,q!==j&&b.isPropagationStopped())break e;j=N,b.currentTarget=re;try{j(b)}catch(pe){Yf(pe)}b.currentTarget=null,j=q}else for(A=0;A<p.length;A++){if(N=p[A],q=N.instance,re=N.currentTarget,N=N.listener,q!==j&&b.isPropagationStopped())break e;j=N,b.currentTarget=re;try{j(b)}catch(pe){Yf(pe)}b.currentTarget=null,j=q}}}}function Pt(i,l){var d=l[ot];d===void 0&&(d=l[ot]=new Set);var p=i+"__bubble";d.has(p)||(EC(l,i,2,!1),d.add(p))}function ay(i,l,d){var p=0;l&&(p|=4),EC(d,i,p,l)}var Mh="_reactListening"+Math.random().toString(36).slice(2);function sy(i){if(!i[Mh]){i[Mh]=!0,Zi.forEach(function(d){d!=="selectionchange"&&(q4.has(d)||ay(d,!1,i),ay(d,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[Mh]||(l[Mh]=!0,ay("selectionchange",!1,l))}}function EC(i,l,d,p){switch(eE(l)){case 2:var b=x3;break;case 8:b=b3;break;default:b=jy}d=b.bind(null,l,d,i),b=void 0,!Rg||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(b=!0),p?b!==void 0?i.addEventListener(l,d,{capture:!0,passive:b}):i.addEventListener(l,d,!0):b!==void 0?i.addEventListener(l,d,{passive:b}):i.addEventListener(l,d,!1)}function ly(i,l,d,p,b){var j=p;if((l&1)===0&&(l&2)===0&&p!==null)e:for(;;){if(p===null)return;var A=p.tag;if(A===3||A===4){var N=p.stateNode.containerInfo;if(N===b)break;if(A===4)for(A=p.return;A!==null;){var q=A.tag;if((q===3||q===4)&&A.stateNode.containerInfo===b)return;A=A.return}for(;N!==null;){if(A=st(N),A===null)return;if(q=A.tag,q===5||q===6||q===26||q===27){p=j=A;continue e}N=N.parentNode}}p=p.return}A1(function(){var re=j,pe=Eg(d),ye=[];e:{var ae=ij.get(i);if(ae!==void 0){var ue=Gf,Ge=i;switch(i){case"keypress":if(Hf(d)===0)break e;case"keydown":case"keyup":ue=zO;break;case"focusin":Ge="focus",ue=kg;break;case"focusout":Ge="blur",ue=kg;break;case"beforeblur":case"afterblur":ue=kg;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=TO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=BO;break;case ej:case tj:case nj:ue=DO;break;case rj:ue=FO;break;case"scroll":case"scrollend":ue=CO;break;case"wheel":ue=qO;break;case"copy":case"cut":case"paste":ue=kO;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=WO}var ct=(l&4)!==0,cn=!ct&&(i==="scroll"||i==="scrollend"),J=ct?ae!==null?ae+"Capture":null:ae;ct=[];for(var Q=re,ne;Q!==null;){var me=Q;if(ne=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ne===null||J===null||(me=_u(Q,J),me!=null&&ct.push(sd(Q,me,ne))),cn)break;Q=Q.return}0<ct.length&&(ae=new ue(ae,Ge,null,d,pe),ye.push({event:ae,listeners:ct}))}}if((l&7)===0){e:{if(ae=i==="mouseover"||i==="pointerover",ue=i==="mouseout"||i==="pointerout",ae&&d!==Cg&&(Ge=d.relatedTarget||d.fromElement)&&(st(Ge)||Ge[We]))break e;if((ue||ae)&&(ae=pe.window===pe?pe:(ae=pe.ownerDocument)?ae.defaultView||ae.parentWindow:window,ue?(Ge=d.relatedTarget||d.toElement,ue=re,Ge=Ge?st(Ge):null,Ge!==null&&(cn=s(Ge),ct=Ge.tag,Ge!==cn||ct!==5&&ct!==27&&ct!==6)&&(Ge=null)):(ue=null,Ge=re),ue!==Ge)){if(ct=N1,me="onMouseLeave",J="onMouseEnter",Q="mouse",(i==="pointerout"||i==="pointerover")&&(ct=M1,me="onPointerLeave",J="onPointerEnter",Q="pointer"),cn=ue==null?ae:Xn(ue),ne=Ge==null?ae:Xn(Ge),ae=new ct(me,Q+"leave",ue,d,pe),ae.target=cn,ae.relatedTarget=ne,me=null,st(pe)===re&&(ct=new ct(J,Q+"enter",Ge,d,pe),ct.target=ne,ct.relatedTarget=cn,me=ct),cn=me,ue&&Ge)t:{for(ct=G4,J=ue,Q=Ge,ne=0,me=J;me;me=ct(me))ne++;me=0;for(var nt=Q;nt;nt=ct(nt))me++;for(;0<ne-me;)J=ct(J),ne--;for(;0<me-ne;)Q=ct(Q),me--;for(;ne--;){if(J===Q||Q!==null&&J===Q.alternate){ct=J;break t}J=ct(J),Q=ct(Q)}ct=null}else ct=null;ue!==null&&TC(ye,ae,ue,ct,!1),Ge!==null&&cn!==null&&TC(ye,cn,Ge,ct,!0)}}e:{if(ae=re?Xn(re):window,ue=ae.nodeName&&ae.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ae.type==="file")var qt=F1;else if(B1(ae))if(H1)qt=r4;else{qt=t4;var Xe=e4}else ue=ae.nodeName,!ue||ue.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?re&&wg(re.elementType)&&(qt=F1):qt=n4;if(qt&&(qt=qt(i,re))){V1(ye,qt,d,pe);break e}Xe&&Xe(i,ae,re),i==="focusout"&&re&&ae.type==="number"&&re.memoizedProps.value!=null&&jg(ae,"number",ae.value)}switch(Xe=re?Xn(re):window,i){case"focusin":(B1(Xe)||Xe.contentEditable==="true")&&(ec=Xe,Ig=re,Lu=null);break;case"focusout":Lu=Ig=ec=null;break;case"mousedown":zg=!0;break;case"contextmenu":case"mouseup":case"dragend":zg=!1,J1(ye,d,pe);break;case"selectionchange":if(o4)break;case"keydown":case"keyup":J1(ye,d,pe)}var wt;if(Ng)e:{switch(i){case"compositionstart":var Lt="onCompositionStart";break e;case"compositionend":Lt="onCompositionEnd";break e;case"compositionupdate":Lt="onCompositionUpdate";break e}Lt=void 0}else Zl?$1(i,d)&&(Lt="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(Lt="onCompositionStart");Lt&&(L1&&d.locale!=="ko"&&(Zl||Lt!=="onCompositionStart"?Lt==="onCompositionEnd"&&Zl&&(wt=k1()):(Ua=pe,_g="value"in Ua?Ua.value:Ua.textContent,Zl=!0)),Xe=Lh(re,Lt),0<Xe.length&&(Lt=new O1(Lt,i,null,d,pe),ye.push({event:Lt,listeners:Xe}),wt?Lt.data=wt:(wt=U1(d),wt!==null&&(Lt.data=wt)))),(wt=YO?KO(i,d):XO(i,d))&&(Lt=Lh(re,"onBeforeInput"),0<Lt.length&&(Xe=new O1("onBeforeInput","beforeinput",null,d,pe),ye.push({event:Xe,listeners:Lt}),Xe.data=wt)),V4(ye,i,re,d,pe)}CC(ye,l)})}function sd(i,l,d){return{instance:i,listener:l,currentTarget:d}}function Lh(i,l){for(var d=l+"Capture",p=[];i!==null;){var b=i,j=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||j===null||(b=_u(i,d),b!=null&&p.unshift(sd(i,b,j)),b=_u(i,l),b!=null&&p.push(sd(i,b,j))),i.tag===3)return p;i=i.return}return[]}function G4(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function TC(i,l,d,p,b){for(var j=l._reactName,A=[];d!==null&&d!==p;){var N=d,q=N.alternate,re=N.stateNode;if(N=N.tag,q!==null&&q===p)break;N!==5&&N!==26&&N!==27||re===null||(q=re,b?(re=_u(d,j),re!=null&&A.unshift(sd(d,re,q))):b||(re=_u(d,j),re!=null&&A.push(sd(d,re,q)))),d=d.return}A.length!==0&&i.push({event:l,listeners:A})}var W4=/\r\n?/g,Q4=/\u0000|\uFFFD/g;function RC(i){return(typeof i=="string"?i:""+i).replace(W4,`
214
+ `).replace(Q4,"")}function _C(i,l){return l=RC(l),RC(i)===l}function ln(i,l,d,p,b,j){switch(d){case"children":typeof p=="string"?l==="body"||l==="textarea"&&p===""||Kl(i,p):(typeof p=="number"||typeof p=="bigint")&&l!=="body"&&Kl(i,""+p);break;case"className":to(i,"class",p);break;case"tabIndex":to(i,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":to(i,d,p);break;case"style":_1(i,p,j);break;case"data":if(l!=="object"){to(i,"data",p);break}case"src":case"href":if(p===""&&(l!=="a"||d!=="href")){i.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){i.removeAttribute(d);break}p=Vf(""+p),i.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){i.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"&&ln(i,l,"name",b.name,b,null),ln(i,l,"formEncType",b.formEncType,b,null),ln(i,l,"formMethod",b.formMethod,b,null),ln(i,l,"formTarget",b.formTarget,b,null)):(ln(i,l,"encType",b.encType,b,null),ln(i,l,"method",b.method,b,null),ln(i,l,"target",b.target,b,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){i.removeAttribute(d);break}p=Vf(""+p),i.setAttribute(d,p);break;case"onClick":p!=null&&(i.onclick=Zo);break;case"onScroll":p!=null&&Pt("scroll",i);break;case"onScrollEnd":p!=null&&Pt("scrollend",i);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));i.innerHTML=d}}break;case"multiple":i.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":i.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"){i.removeAttribute("xlink:href");break}d=Vf(""+p),i.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"?i.setAttribute(d,""+p):i.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"?i.setAttribute(d,""):i.removeAttribute(d);break;case"capture":case"download":p===!0?i.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?i.setAttribute(d,p):i.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?i.setAttribute(d,p):i.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?i.removeAttribute(d):i.setAttribute(d,p);break;case"popover":Pt("beforetoggle",i),Pt("toggle",i),qn(i,"popover",p);break;case"xlinkActuate":yr(i,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":yr(i,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":yr(i,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":yr(i,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":yr(i,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":yr(i,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":yr(i,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":yr(i,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":yr(i,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":qn(i,"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=jO.get(d)||d,qn(i,d,p))}}function cy(i,l,d,p,b,j){switch(d){case"style":_1(i,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));i.innerHTML=d}}break;case"children":typeof p=="string"?Kl(i,p):(typeof p=="number"||typeof p=="bigint")&&Kl(i,""+p);break;case"onScroll":p!=null&&Pt("scroll",i);break;case"onScrollEnd":p!=null&&Pt("scrollend",i);break;case"onClick":p!=null&&(i.onclick=Zo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ii.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=i[Ve]||null,j=j!=null?j[d]:null,typeof j=="function"&&i.removeEventListener(l,j,b),typeof p=="function")){typeof j!="function"&&j!==null&&(d in i?i[d]=null:i.hasAttribute(d)&&i.removeAttribute(d)),i.addEventListener(l,p,b);break e}d in i?i[d]=p:p===!0?i.setAttribute(d,""):qn(i,d,p)}}}function jr(i,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",i),Pt("load",i);var p=!1,b=!1,j;for(j in d)if(d.hasOwnProperty(j)){var A=d[j];if(A!=null)switch(j){case"src":p=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:ln(i,l,j,A,d,null)}}b&&ln(i,l,"srcSet",d.srcSet,d,null),p&&ln(i,l,"src",d.src,d,null);return;case"input":Pt("invalid",i);var N=j=A=b=null,q=null,re=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":A=pe;break;case"checked":q=pe;break;case"defaultChecked":re=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:ln(i,l,p,pe,d,null)}}C1(i,j,N,q,re,A,b,!1);return;case"select":Pt("invalid",i),p=A=j=null;for(b in d)if(d.hasOwnProperty(b)&&(N=d[b],N!=null))switch(b){case"value":j=N;break;case"defaultValue":A=N;break;case"multiple":p=N;default:ln(i,l,b,N,d,null)}l=j,d=A,i.multiple=!!p,l!=null?Yl(i,!!p,l,!1):d!=null&&Yl(i,!!p,d,!0);return;case"textarea":Pt("invalid",i),j=b=p=null;for(A in d)if(d.hasOwnProperty(A)&&(N=d[A],N!=null))switch(A){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:ln(i,l,A,N,d,null)}T1(i,p,b,j);return;case"option":for(q in d)d.hasOwnProperty(q)&&(p=d[q],p!=null)&&(q==="selected"?i.selected=p&&typeof p!="function"&&typeof p!="symbol":ln(i,l,q,p,d,null));return;case"dialog":Pt("beforetoggle",i),Pt("toggle",i),Pt("cancel",i),Pt("close",i);break;case"iframe":case"object":Pt("load",i);break;case"video":case"audio":for(p=0;p<ad.length;p++)Pt(ad[p],i);break;case"image":Pt("error",i),Pt("load",i);break;case"details":Pt("toggle",i);break;case"embed":case"source":case"link":Pt("error",i),Pt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in d)if(d.hasOwnProperty(re)&&(p=d[re],p!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:ln(i,l,re,p,d,null)}return;default:if(wg(l)){for(pe in d)d.hasOwnProperty(pe)&&(p=d[pe],p!==void 0&&cy(i,l,pe,p,d,void 0));return}}for(N in d)d.hasOwnProperty(N)&&(p=d[N],p!=null&&ln(i,l,N,p,d,null))}function Y4(i,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,A=null,N=null,q=null,re=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)||ln(i,l,ue,null,p,ye)}}for(var ae in p){var ue=p[ae];if(ye=d[ae],p.hasOwnProperty(ae)&&(ue!=null||ye!=null))switch(ae){case"type":j=ue;break;case"name":b=ue;break;case"checked":re=ue;break;case"defaultChecked":pe=ue;break;case"value":A=ue;break;case"defaultValue":N=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,l));break;default:ue!==ye&&ln(i,l,ae,ue,p,ye)}}Sg(i,A,N,q,re,pe,j,b);return;case"select":ue=A=N=ae=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)||ln(i,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":ae=j;break;case"defaultValue":N=j;break;case"multiple":A=j;default:j!==q&&ln(i,l,b,j,p,q)}l=N,d=A,p=ue,ae!=null?Yl(i,!!d,ae,!1):!!p!=!!d&&(l!=null?Yl(i,!!d,l,!0):Yl(i,!!d,d?[]:"",!1));return;case"textarea":ue=ae=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:ln(i,l,N,null,p,b)}for(A in p)if(b=p[A],j=d[A],p.hasOwnProperty(A)&&(b!=null||j!=null))switch(A){case"value":ae=b;break;case"defaultValue":ue=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==j&&ln(i,l,A,b,p,j)}E1(i,ae,ue);return;case"option":for(var Ge in d)ae=d[Ge],d.hasOwnProperty(Ge)&&ae!=null&&!p.hasOwnProperty(Ge)&&(Ge==="selected"?i.selected=!1:ln(i,l,Ge,null,p,ae));for(q in p)ae=p[q],ue=d[q],p.hasOwnProperty(q)&&ae!==ue&&(ae!=null||ue!=null)&&(q==="selected"?i.selected=ae&&typeof ae!="function"&&typeof ae!="symbol":ln(i,l,q,ae,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 ct in d)ae=d[ct],d.hasOwnProperty(ct)&&ae!=null&&!p.hasOwnProperty(ct)&&ln(i,l,ct,null,p,ae);for(re in p)if(ae=p[re],ue=d[re],p.hasOwnProperty(re)&&ae!==ue&&(ae!=null||ue!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,l));break;default:ln(i,l,re,ae,p,ue)}return;default:if(wg(l)){for(var cn in d)ae=d[cn],d.hasOwnProperty(cn)&&ae!==void 0&&!p.hasOwnProperty(cn)&&cy(i,l,cn,void 0,p,ae);for(pe in p)ae=p[pe],ue=d[pe],!p.hasOwnProperty(pe)||ae===ue||ae===void 0&&ue===void 0||cy(i,l,pe,ae,p,ue);return}}for(var J in d)ae=d[J],d.hasOwnProperty(J)&&ae!=null&&!p.hasOwnProperty(J)&&ln(i,l,J,null,p,ae);for(ye in p)ae=p[ye],ue=d[ye],!p.hasOwnProperty(ye)||ae===ue||ae==null&&ue==null||ln(i,l,ye,ae,p,ue)}function DC(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function K4(){if(typeof performance.getEntriesByType=="function"){for(var i=0,l=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var b=d[p],j=b.transferSize,A=b.initiatorType,N=b.duration;if(j&&N&&DC(A)){for(A=0,N=b.responseEnd,p+=1;p<d.length;p++){var q=d[p],re=q.startTime;if(re>N)break;var pe=q.transferSize,ye=q.initiatorType;pe&&DC(ye)&&(q=q.responseEnd,A+=pe*(q<N?1:(N-re)/(q-re)))}if(--p,l+=8*(j+A)/(b.duration/1e3),i++,10<i)break}}if(0<i)return l/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var uy=null,dy=null;function Ih(i){return i.nodeType===9?i:i.ownerDocument}function AC(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function kC(i,l){if(i===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&l==="foreignObject"?0:i}function fy(i,l){return i==="textarea"||i==="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 hy=null;function X4(){var i=window.event;return i&&i.type==="popstate"?i===hy?!1:(hy=i,!0):(hy=null,!1)}var PC=typeof setTimeout=="function"?setTimeout:void 0,J4=typeof clearTimeout=="function"?clearTimeout:void 0,NC=typeof Promise=="function"?Promise:void 0,Z4=typeof queueMicrotask=="function"?queueMicrotask:typeof NC<"u"?function(i){return NC.resolve(null).then(i).catch(e3)}:PC;function e3(i){setTimeout(function(){throw i})}function rs(i){return i==="head"}function OC(i,l){var d=l,p=0;do{var b=d.nextSibling;if(i.removeChild(d),b&&b.nodeType===8)if(d=b.data,d==="/$"||d==="/&"){if(p===0){i.removeChild(b),Rc(l);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")ld(i.ownerDocument.documentElement);else if(d==="head"){d=i.ownerDocument.head,ld(d);for(var j=d.firstChild;j;){var A=j.nextSibling,N=j.nodeName;j[xn]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&j.rel.toLowerCase()==="stylesheet"||d.removeChild(j),j=A}}else d==="body"&&ld(i.ownerDocument.body);d=b}while(d);Rc(l)}function MC(i,l){var d=i;i=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(i===0)break;i--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||i++;d=p}while(d)}function py(i){var l=i.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":py(d),Pn(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}i.removeChild(d)}}function t3(i,l,d,p){for(;i.nodeType===1;){var b=d;if(i.nodeName.toLowerCase()!==l.toLowerCase()){if(!p&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(p){if(!i[xn])switch(l){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(j=i.getAttribute("rel"),j==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(j!==b.rel||i.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||i.getAttribute("title")!==(b.title==null?null:b.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(j=i.getAttribute("src"),(j!==(b.src==null?null:b.src)||i.getAttribute("type")!==(b.type==null?null:b.type)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&j&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(l==="input"&&i.type==="hidden"){var j=b.name==null?null:""+b.name;if(b.type==="hidden"&&i.getAttribute("name")===j)return i}else return i;if(i=Di(i.nextSibling),i===null)break}return null}function n3(i,l,d){if(l==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!d||(i=Di(i.nextSibling),i===null))return null;return i}function LC(i,l){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Di(i.nextSibling),i===null))return null;return i}function my(i){return i.data==="$?"||i.data==="$~"}function gy(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function r3(i,l){var d=i.ownerDocument;if(i.data==="$~")i._reactRetry=l;else if(i.data!=="$?"||d.readyState!=="loading")l();else{var p=function(){l(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),i._reactRetry=p}}function Di(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return i}var vy=null;function IC(i){i=i.nextSibling;for(var l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"||d==="/&"){if(l===0)return Di(i.nextSibling);l--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||l++}i=i.nextSibling}return null}function zC(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(l===0)return i;l--}else d!=="/$"&&d!=="/&"||l++}i=i.previousSibling}return null}function $C(i,l,d){switch(l=Ih(d),i){case"html":if(i=l.documentElement,!i)throw Error(r(452));return i;case"head":if(i=l.head,!i)throw Error(r(453));return i;case"body":if(i=l.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function ld(i){for(var l=i.attributes;l.length;)i.removeAttributeNode(l[0]);Pn(i)}var Ai=new Map,UC=new Set;function zh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var ma=I.d;I.d={f:i3,r:o3,D:a3,C:s3,L:l3,m:c3,X:d3,S:u3,M:f3};function i3(){var i=ma.f(),l=Dh();return i||l}function o3(i){var l=Et(i);l!==null&&l.tag===5&&l.type==="form"?rw(l):ma.r(i)}var Cc=typeof document>"u"?null:document;function BC(i,l,d){var p=Cc;if(p&&typeof l=="string"&&l){var b=ji(l);b='link[rel="'+i+'"][href="'+b+'"]',typeof d=="string"&&(b+='[crossorigin="'+d+'"]'),UC.has(b)||(UC.add(b),i={rel:i,crossOrigin:d,href:l},p.querySelector(b)===null&&(l=p.createElement("link"),jr(l,"link",i),Nn(l),p.head.appendChild(l)))}}function a3(i){ma.D(i),BC("dns-prefetch",i,null)}function s3(i,l){ma.C(i,l),BC("preconnect",i,l)}function l3(i,l,d){ma.L(i,l,d);var p=Cc;if(p&&i&&l){var b='link[rel="preload"][as="'+ji(l)+'"]';l==="image"&&d&&d.imageSrcSet?(b+='[imagesrcset="'+ji(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(b+='[imagesizes="'+ji(d.imageSizes)+'"]')):b+='[href="'+ji(i)+'"]';var j=b;switch(l){case"style":j=Ec(i);break;case"script":j=Tc(i)}Ai.has(j)||(i=g({rel:"preload",href:l==="image"&&d&&d.imageSrcSet?void 0:i,as:l},d),Ai.set(j,i),p.querySelector(b)!==null||l==="style"&&p.querySelector(cd(j))||l==="script"&&p.querySelector(ud(j))||(l=p.createElement("link"),jr(l,"link",i),Nn(l),p.head.appendChild(l)))}}function c3(i,l){ma.m(i,l);var d=Cc;if(d&&i){var p=l&&typeof l.as=="string"?l.as:"script",b='link[rel="modulepreload"][as="'+ji(p)+'"][href="'+ji(i)+'"]',j=b;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Tc(i)}if(!Ai.has(j)&&(i=g({rel:"modulepreload",href:i},l),Ai.set(j,i),d.querySelector(b)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(ud(j)))return}p=d.createElement("link"),jr(p,"link",i),Nn(p),d.head.appendChild(p)}}}function u3(i,l,d){ma.S(i,l,d);var p=Cc;if(p&&i){var b=Er(p).hoistableStyles,j=Ec(i);l=l||"default";var A=b.get(j);if(!A){var N={loading:0,preload:null};if(A=p.querySelector(cd(j)))N.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":l},d),(d=Ai.get(j))&&yy(i,d);var q=A=p.createElement("link");Nn(q),jr(q,"link",i),q._p=new Promise(function(re,pe){q.onload=re,q.onerror=pe}),q.addEventListener("load",function(){N.loading|=1}),q.addEventListener("error",function(){N.loading|=2}),N.loading|=4,$h(A,l,p)}A={type:"stylesheet",instance:A,count:1,state:N},b.set(j,A)}}}function d3(i,l){ma.X(i,l);var d=Cc;if(d&&i){var p=Er(d).hoistableScripts,b=Tc(i),j=p.get(b);j||(j=d.querySelector(ud(b)),j||(i=g({src:i,async:!0},l),(l=Ai.get(b))&&xy(i,l),j=d.createElement("script"),Nn(j),jr(j,"link",i),d.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},p.set(b,j))}}function f3(i,l){ma.M(i,l);var d=Cc;if(d&&i){var p=Er(d).hoistableScripts,b=Tc(i),j=p.get(b);j||(j=d.querySelector(ud(b)),j||(i=g({src:i,async:!0,type:"module"},l),(l=Ai.get(b))&&xy(i,l),j=d.createElement("script"),Nn(j),jr(j,"link",i),d.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},p.set(b,j))}}function VC(i,l,d,p){var b=(b=Ce.current)?zh(b):null;if(!b)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(l=Ec(d.href),d=Er(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"){i=Ec(d.href);var j=Er(b).hoistableStyles,A=j.get(i);if(A||(b=b.ownerDocument||b,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(i,A),(j=b.querySelector(cd(i)))&&!j._p&&(A.instance=j,A.state.loading=5),Ai.has(i)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Ai.set(i,d),j||h3(b,i,d,A.state))),l&&p===null)throw Error(r(528,""));return A}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=Tc(d),d=Er(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,i))}}function Ec(i){return'href="'+ji(i)+'"'}function cd(i){return'link[rel="stylesheet"]['+i+"]"}function FC(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function h3(i,l,d,p){i.querySelector('link[rel="preload"][as="style"]['+l+"]")?p.loading=1:(l=i.createElement("link"),p.preload=l,l.addEventListener("load",function(){return p.loading|=1}),l.addEventListener("error",function(){return p.loading|=2}),jr(l,"link",d),Nn(l),i.head.appendChild(l))}function Tc(i){return'[src="'+ji(i)+'"]'}function ud(i){return"script[async]"+i}function HC(i,l,d){if(l.count++,l.instance===null)switch(l.type){case"style":var p=i.querySelector('style[data-href~="'+ji(d.href)+'"]');if(p)return l.instance=p,Nn(p),p;var b=g({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(i.ownerDocument||i).createElement("style"),Nn(p),jr(p,"style",b),$h(p,d.precedence,i),l.instance=p;case"stylesheet":b=Ec(d.href);var j=i.querySelector(cd(b));if(j)return l.state.loading|=4,l.instance=j,Nn(j),j;p=FC(d),(b=Ai.get(b))&&yy(p,b),j=(i.ownerDocument||i).createElement("link"),Nn(j);var A=j;return A._p=new Promise(function(N,q){A.onload=N,A.onerror=q}),jr(j,"link",p),l.state.loading|=4,$h(j,d.precedence,i),l.instance=j;case"script":return j=Tc(d.src),(b=i.querySelector(ud(j)))?(l.instance=b,Nn(b),b):(p=d,(b=Ai.get(j))&&(p=g({},d),xy(p,b)),i=i.ownerDocument||i,b=i.createElement("script"),Nn(b),jr(b,"link",p),i.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,$h(p,d.precedence,i));return l.instance}function $h(i,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,A=0;A<p.length;A++){var N=p[A];if(N.dataset.precedence===l)j=N;else if(j!==b)break}j?j.parentNode.insertBefore(i,j.nextSibling):(l=d.nodeType===9?d.head:d,l.insertBefore(i,l.firstChild))}function yy(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.title==null&&(i.title=l.title)}function xy(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.integrity==null&&(i.integrity=l.integrity)}var Uh=null;function qC(i,l,d){if(Uh===null){var p=new Map,b=Uh=new Map;b.set(d,p)}else b=Uh,p=b.get(d),p||(p=new Map,b.set(d,p));if(p.has(i))return p;for(p.set(i,null),d=d.getElementsByTagName(i),b=0;b<d.length;b++){var j=d[b];if(!(j[xn]||j[Le]||i==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var A=j.getAttribute(l)||"";A=i+A;var N=p.get(A);N?N.push(j):p.set(A,[j])}}return p}function GC(i,l,d){i=i.ownerDocument||i,i.head.insertBefore(d,l==="title"?i.querySelector("head > title"):null)}function p3(i,l,d){if(d===1||l.itemProp!=null)return!1;switch(i){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"?(i=l.disabled,typeof l.precedence=="string"&&i==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(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function m3(i,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=Ec(p.href),j=l.querySelector(cd(b));if(j){l=j._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(i.count++,i=Bh.bind(i),l.then(i,i)),d.state.loading|=4,d.instance=j,Nn(j);return}j=l.ownerDocument||l,p=FC(p),(b=Ai.get(b))&&yy(p,b),j=j.createElement("link"),Nn(j);var A=j;A._p=new Promise(function(N,q){A.onload=N,A.onerror=q}),jr(j,"link",p),d.instance=j}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(i.count++,d=Bh.bind(i),l.addEventListener("load",d),l.addEventListener("error",d))}}var by=0;function g3(i,l){return i.stylesheets&&i.count===0&&Fh(i,i.stylesheets),0<i.count||0<i.imgCount?function(d){var p=setTimeout(function(){if(i.stylesheets&&Fh(i,i.stylesheets),i.unsuspend){var j=i.unsuspend;i.unsuspend=null,j()}},6e4+l);0<i.imgBytes&&by===0&&(by=62500*K4());var b=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Fh(i,i.stylesheets),i.unsuspend)){var j=i.unsuspend;i.unsuspend=null,j()}},(i.imgBytes>by?50:800)+l);return i.unsuspend=d,function(){i.unsuspend=null,clearTimeout(p),clearTimeout(b)}}:null}function Bh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Vh=null;function Fh(i,l){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Vh=new Map,l.forEach(v3,i),Vh=null,Bh.call(i))}function v3(i,l){if(!(l.state.loading&4)){var d=Vh.get(i);if(d)var p=d.get(null);else{d=new Map,Vh.set(i,d);for(var b=i.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<b.length;j++){var A=b[j];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(d.set(A.dataset.precedence,A),p=A)}p&&d.set(null,p)}b=l.instance,A=b.getAttribute("data-precedence"),j=d.get(A)||p,j===p&&d.set(null,b),d.set(A,b),this.count++,p=Bh.bind(this),b.addEventListener("load",p),b.addEventListener("error",p),j?j.parentNode.insertBefore(b,j.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(b,i.firstChild)),l.state.loading|=4}}var dd={$$typeof:E,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function y3(i,l,d,p,b,j,A,N,q){this.tag=1,this.containerInfo=i,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=Ji(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ji(0),this.hiddenUpdates=Ji(null),this.identifierPrefix=p,this.onUncaughtError=b,this.onCaughtError=j,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function QC(i,l,d,p,b,j,A,N,q,re,pe,ye){return i=new y3(i,l,d,A,q,re,pe,ye,N),l=1,j===!0&&(l|=24),j=ai(3,null,null,l),i.current=j,j.stateNode=i,l=Zg(),l.refCount++,i.pooledCache=l,l.refCount++,j.memoizedState={element:p,isDehydrated:d,cache:l},rv(j),i}function YC(i){return i?(i=rc,i):rc}function KC(i,l,d,p,b,j){b=YC(b),p.context===null?p.context=b:p.pendingContext=b,p=Ga(l),p.payload={element:d},j=j===void 0?null:j,j!==null&&(p.callback=j),d=Wa(i,p,l),d!==null&&(Qr(d,i,l),Fu(d,i,l))}function XC(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<l?d:l}}function Sy(i,l){XC(i,l),(i=i.alternate)&&XC(i,l)}function JC(i){if(i.tag===13||i.tag===31){var l=Ws(i,67108864);l!==null&&Qr(l,i,67108864),Sy(i,67108864)}}function ZC(i){if(i.tag===13||i.tag===31){var l=di();l=te(l);var d=Ws(i,l);d!==null&&Qr(d,i,l),Sy(i,l)}}var Hh=!0;function x3(i,l,d,p){var b=M.T;M.T=null;var j=I.p;try{I.p=2,jy(i,l,d,p)}finally{I.p=j,M.T=b}}function b3(i,l,d,p){var b=M.T;M.T=null;var j=I.p;try{I.p=8,jy(i,l,d,p)}finally{I.p=j,M.T=b}}function jy(i,l,d,p){if(Hh){var b=wy(p);if(b===null)ly(i,l,p,qh,d),tE(i,p);else if(j3(b,i,l,d,p))p.stopPropagation();else if(tE(i,p),l&4&&-1<S3.indexOf(i)){for(;b!==null;){var j=Et(b);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var A=Ki(j.pendingLanes);if(A!==0){var N=j;for(N.pendingLanes|=2,N.entangledLanes|=2;A;){var q=1<<31-$n(A);N.entanglements[1]|=q,A&=~q}Eo(j),(Qt&6)===0&&(Rh=lt()+500,od(0))}}break;case 31:case 13:N=Ws(j,2),N!==null&&Qr(N,j,2),Dh(),Sy(j,2)}if(j=wy(p),j===null&&ly(i,l,p,qh,d),j===b)break;b=j}b!==null&&p.stopPropagation()}else ly(i,l,p,null,d)}}function wy(i){return i=Eg(i),Cy(i)}var qh=null;function Cy(i){if(qh=null,i=st(i),i!==null){var l=s(i);if(l===null)i=null;else{var d=l.tag;if(d===13){if(i=c(l),i!==null)return i;i=null}else if(d===31){if(i=u(l),i!==null)return i;i=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null)}}return qh=i,null}function eE(i){switch(i){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 vt:case _t:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var Ey=!1,is=null,os=null,as=null,fd=new Map,hd=new Map,ss=[],S3="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(i,l){switch(i){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":os=null;break;case"mouseover":case"mouseout":as=null;break;case"pointerover":case"pointerout":fd.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":hd.delete(l.pointerId)}}function pd(i,l,d,p,b,j){return i===null||i.nativeEvent!==j?(i={blockedOn:l,domEventName:d,eventSystemFlags:p,nativeEvent:j,targetContainers:[b]},l!==null&&(l=Et(l),l!==null&&JC(l)),i):(i.eventSystemFlags|=p,l=i.targetContainers,b!==null&&l.indexOf(b)===-1&&l.push(b),i)}function j3(i,l,d,p,b){switch(l){case"focusin":return is=pd(is,i,l,d,p,b),!0;case"dragenter":return os=pd(os,i,l,d,p,b),!0;case"mouseover":return as=pd(as,i,l,d,p,b),!0;case"pointerover":var j=b.pointerId;return fd.set(j,pd(fd.get(j)||null,i,l,d,p,b)),!0;case"gotpointercapture":return j=b.pointerId,hd.set(j,pd(hd.get(j)||null,i,l,d,p,b)),!0}return!1}function nE(i){var l=st(i.target);if(l!==null){var d=s(l);if(d!==null){if(l=d.tag,l===13){if(l=c(d),l!==null){i.blockedOn=l,Ke(i.priority,function(){ZC(d)});return}}else if(l===31){if(l=u(d),l!==null){i.blockedOn=l,Ke(i.priority,function(){ZC(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Gh(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var d=wy(i.nativeEvent);if(d===null){d=i.nativeEvent;var p=new d.constructor(d.type,d);Cg=p,d.target.dispatchEvent(p),Cg=null}else return l=Et(d),l!==null&&JC(l),i.blockedOn=d,!1;l.shift()}return!0}function rE(i,l,d){Gh(i)&&d.delete(l)}function w3(){Ey=!1,is!==null&&Gh(is)&&(is=null),os!==null&&Gh(os)&&(os=null),as!==null&&Gh(as)&&(as=null),fd.forEach(rE),hd.forEach(rE)}function Wh(i,l){i.blockedOn===l&&(i.blockedOn=null,Ey||(Ey=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,w3)))}var Qh=null;function iE(i){Qh!==i&&(Qh=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Qh===i&&(Qh=null);for(var l=0;l<i.length;l+=3){var d=i[l],p=i[l+1],b=i[l+2];if(typeof p!="function"){if(Cy(p||d)===null)continue;break}var j=Et(d);j!==null&&(i.splice(l,3),l-=3,wv(j,{pending:!0,data:b,method:d.method,action:p},p,b))}}))}function Rc(i){function l(q){return Wh(q,i)}is!==null&&Wh(is,i),os!==null&&Wh(os,i),as!==null&&Wh(as,i),fd.forEach(l),hd.forEach(l);for(var d=0;d<ss.length;d++){var p=ss[d];p.blockedOn===i&&(p.blockedOn=null)}for(;0<ss.length&&(d=ss[0],d.blockedOn===null);)nE(d),d.blockedOn===null&&ss.shift();if(d=(i.ownerDocument||i).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var b=d[p],j=d[p+1],A=b[Ve]||null;if(typeof j=="function")A||iE(d);else if(A){var N=null;if(j&&j.hasAttribute("formAction")){if(b=j,A=j[Ve]||null)N=A.formAction;else if(Cy(b)!==null)continue}else N=A.action;typeof N=="function"?d[p+1]=N:(d.splice(p,3),p-=3),iE(d)}}}function oE(){function i(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(A){return b=A})},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",i),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),b!==null&&(b(),b=null)}}}function Ty(i){this._internalRoot=i}Yh.prototype.render=Ty.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(r(409));var d=l.current,p=di();KC(d,p,i,l,null,null)},Yh.prototype.unmount=Ty.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;KC(i.current,2,null,i,null,null),Dh(),l[We]=null}};function Yh(i){this._internalRoot=i}Yh.prototype.unstable_scheduleHydration=function(i){if(i){var l=Re();i={blockedOn:null,target:i,priority:l};for(var d=0;d<ss.length&&l!==0&&l<ss[d].priority;d++);ss.splice(d,0,i),d===0&&nE(i)}};var aE=t.version;if(aE!=="19.2.4")throw Error(r(527,aE,"19.2.4"));I.findDOMNode=function(i){var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=h(l),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var C3={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kh.isDisabled&&Kh.supportsFiber)try{Cr=Kh.inject(C3),Jt=Kh}catch{}}return xd.createRoot=function(i,l){if(!o(i))throw Error(r(299));var d=!1,p="",b=hw,j=pw,A=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&&(A=l.onRecoverableError)),l=QC(i,1,!1,null,null,d,p,null,b,j,A,oE),i[We]=l.current,sy(i),new Ty(l)},xd.hydrateRoot=function(i,l,d){if(!o(i))throw Error(r(299));var p=!1,b="",j=hw,A=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&&(A=d.onCaughtError),d.onRecoverableError!==void 0&&(N=d.onRecoverableError),d.formState!==void 0&&(q=d.formState)),l=QC(i,1,!0,l,d??null,p,b,q,j,A,N,oE),l.context=YC(null),d=l.current,p=di(),p=te(p),b=Ga(p),b.callback=null,Wa(d,b,p),d=p,l.current.lanes=d,Ln(l,d),Eo(l),i[We]=l.current,sy(i),new Yh(l)},xd.version="19.2.4",xd}var qR;function Ree(){if(qR)return fx.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(),fx.exports=Tee(),fx.exports}var _ee=Ree();var vN=e=>{throw TypeError(e)},Dee=(e,t,n)=>t.has(e)||vN("Cannot "+n),mx=(e,t,n)=>(Dee(e,t,"read from private field"),n?n.call(e):t.get(e)),Aee=(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 kee(e={}){function t(r,o){let{pathname:s,search:c,hash:u}=r.location;return Jd("",{pathname:s,search:c,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Go(o)}return Nee(t,n,null,e)}function bt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Vn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Pee(){return Math.random().toString(36).substring(2,10)}function WR(e,t){return{usr:e.state,key:e.key,idx:t}}function Jd(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?za(t):t,state:n,key:t&&t.key||r||Pee()}}function Go({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 za(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 Nee(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:s=!1}=r,c=o.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=Jd(w.location,C,T);h=m()+1;let E=WR(R,h),_=w.createHref(R);try{c.pushState(E,"",_)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;o.location.assign(_)}s&&f&&f({action:u,location:w.location,delta:1})}function x(C,T){u="REPLACE";let R=Jd(w.location,C,T);h=m();let E=WR(R,h),_=w.createHref(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(o,c)},listen(C){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(GR,g),f=C,()=>{o.removeEventListener(GR,g),f=null}},createHref(C){return t(o,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),bt(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Go(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Td,QR=class{constructor(e){if(Aee(this,Td,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(mx(this,Td).has(e))return mx(this,Td).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){mx(this,Td).set(e,t)}};Td=new WeakMap;var Oee=new Set(["lazy","caseSensitive","path","id","index","children"]);function Mee(e){return Oee.has(e)}var Lee=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Iee(e){return Lee.has(e)}function zee(e){return e.index===!0}function Zd(e,t,n=[],r={},o=!1){return e.map((s,c)=>{let u=[...n,String(c)],f=typeof s.id=="string"?s.id:u.join("-");if(bt(s.index!==!0||!s.children,"Cannot specify children on an index route"),bt(o||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),zee(s)){let h={...s,id:f};return r[f]=YR(h,t(h)),h}else{let h={...s,id:f,children:void 0};return r[f]=YR(h,t(h)),s.children&&(h.children=Zd(s.children,t,u,r,o)),h}})}function YR(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function vs(e,t,n="/"){return Rd(e,t,n,!1)}function Rd(e,t,n,r){let o=typeof t=="string"?za(t):t,s=Vi(o.pathname||"/",n);if(s==null)return null;let c=xN(e);Uee(c);let u=null;for(let f=0;u==null&&f<c.length;++f){let h=Xee(s);u=Yee(c[f],h,r)}return u}function $ee(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function xN(e,t=[],n=[],r="",o=!1){let s=(c,u,f=o,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;bt(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=Bo([r,m.relativePath]),y=n.concat(m);c.children&&c.children.length>0&&(bt(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:Wee(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,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let c=bN(r.join("/")),u=[];return u.push(...c.map(f=>f===""?s:[s,f].join("/"))),o&&u.push(...c),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function Uee(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Qee(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Bee=/^:[\w-]+$/,Vee=3,Fee=2,Hee=1,qee=10,Gee=-2,KR=e=>e==="*";function Wee(e,t){let n=e.split("/"),r=n.length;return n.some(KR)&&(r+=Gee),t&&(r+=Fee),n.filter(o=>!KR(o)).reduce((o,s)=>o+(Bee.test(s)?Vee:s===""?Hee:qee),r)}function Qee(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function Yee(e,t,n=!1){let{routesMeta:r}=e,o={},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=tm({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},m),y=f.route;if(!g&&h&&n&&!r[r.length-1].route.index&&(g=tm({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!g)return null;Object.assign(o,g.params),c.push({params:o,pathname:Bo([s,g.pathname]),pathnameBase:ete(Bo([s,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(s=Bo([s,g.pathnameBase]))}return c}function tm(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Kee(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let s=o[0],c=s.replace(/(.)\/+$/,"$1"),u=o.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 Kee(e,t=!1,n=!0){Vn(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=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,f)=>(r.push({paramName:u,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function Xee(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Vn(!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 Vi(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 Jee({basename:e,pathname:t}){return t==="/"?e:Bo([e,t])}var SN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,i1=e=>SN.test(e);function Zee(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?za(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=XR(n.substring(1),"/"):s=XR(n,t)):s=t,{pathname:s,search:tte(r),hash:nte(o)}}function XR(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function gx(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 vg(e){let t=jN(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function yg(e,t,n,r=!1){let o;typeof e=="string"?o=za(e):(o={...e},bt(!o.pathname||!o.pathname.includes("?"),gx("?","pathname","search",o)),bt(!o.pathname||!o.pathname.includes("#"),gx("#","pathname","hash",o)),bt(!o.search||!o.search.includes("#"),gx("#","search","hash",o)));let s=e===""||o.pathname==="",c=s?"/":o.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;o.pathname=y.join("/")}u=g>=0?t[g]:"/"}let f=Zee(o,u),h=c&&c!=="/"&&c.endsWith("/"),m=(s||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||m)&&(f.pathname+="/"),f}var Bo=e=>e.join("/").replace(/\/\/+/g,"/"),ete=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),tte=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,nte=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Of=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 ef(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Mf(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,o=!1;if(wN)try{let s=new URL(window.location.href),c=n.startsWith("//")?new URL(s.protocol+n):new URL(n),u=Vi(c.pathname,t);c.origin===s.origin&&u!=null?n=u+c.search+c.hash:o=!0}catch{Vn(!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:o,to:n}}var Ss=Symbol("Uninstrumented");function rte(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({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 o=Hc(n.lazy,t.lazy,()=>{});o&&(r.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(s=>{let c=o[s],u=n[`lazy.${s}`];if(typeof c=="function"&&u.length>0){let f=Hc(u,c,()=>{});f&&(r.lazy=Object.assign(r.lazy||{},{[s]:f}))}})}return["loader","action"].forEach(o=>{let s=t[o];if(typeof s=="function"&&n[o].length>0){let c=s[Ss]??s,u=Hc(n[o],c,(...f)=>JR(f[0]));u&&(o==="loader"&&c.hydrate===!0&&(u.hydrate=!0),u[Ss]=c,r[o]=u)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(o=>{let s=o[Ss]??o,c=Hc(n.middleware,s,(...u)=>JR(u[0]));return c?(c[Ss]=s,c):o})),r}function ite(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(o){let s=Object.keys(o);for(let c of s)o[c]&&n[c].push(o[c])}})),n.navigate.length>0){let r=e.navigate[Ss]??e.navigate,o=Hc(n.navigate,r,(...s)=>{let[c,u]=s;return{to:typeof c=="number"||typeof c=="string"?c:c?Go(c):".",...ZR(e,u??{})}});o&&(o[Ss]=r,e.navigate=o)}if(n.fetch.length>0){let r=e.fetch[Ss]??e.fetch,o=Hc(n.fetch,r,(...s)=>{let[c,,u,f]=s;return{href:u??".",fetcherKey:c,...ZR(e,f??{})}});o&&(o[Ss]=r,e.fetch=o)}return e}function Hc(e,t,n){return e.length===0?null:async(...r)=>{let o=await EN(e,n(...r),()=>t(...r),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function EN(e,t,n,r){let o=e[r],s;if(o){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,bt(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await o(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 JR(e){let{request:t,context:n,params:r,unstable_pattern:o}=e;return{request:ote(t),params:{...r},unstable_pattern:o,context:ate(n)}}function ZR(e,t){return{currentUrl:Go(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 ote(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function ate(e){if(lte(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var ste=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function lte(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")===ste}var TN=["POST","PUT","PATCH","DELETE"],cte=new Set(TN),ute=["GET",...TN],dte=new Set(ute),RN=new Set([301,302,303,307,308]),fte=new Set([307,308]),vx={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},hte={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},bd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},pte=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),_N="remix-router-transitions",DN=Symbol("ResetLoaderData");function mte(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";bt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],o=e.mapRouteProperties||pte,s=o;if(e.unstable_instrumentations){let H=e.unstable_instrumentations;s=X=>({...o(X),...rte(H.map(te=>te.route).filter(Boolean),X)})}let c={},u=Zd(e.routes,s,void 0,c),f,h=e.basename||"/";h.startsWith("/")||(h=`/${h}`);let m=e.dataStrategy||bte,g={...e.future},y=null,x=new Set,S=null,w=null,C=null,T=e.hydrationData!=null,R=vs(u,e.history.location,h),E=!1,_=null,k;if(R==null&&!e.patchRoutesOnNavigation){let H=Mi(404,{pathname:e.history.location.pathname}),{matches:X,route:te}=up(u);k=!0,R=X,_={[te.id]:H}}else if(R&&!e.hydrationData&&vr(R,u,e.history.location.pathname).active&&(R=null),R)if(R.some(H=>H.route.lazy))k=!1;else if(!R.some(H=>o1(H.route)))k=!0;else{let H=e.hydrationData?e.hydrationData.loaderData:null,X=e.hydrationData?e.hydrationData.errors:null;if(X){let te=R.findIndex(je=>X[je.route.id]!==void 0);k=R.slice(0,te+1).every(je=>!cb(je.route,H,X))}else k=R.every(te=>!cb(te.route,H,X))}else{k=!1,R=[];let H=vr(null,u,e.history.location.pathname);H.active&&H.matches&&(E=!0,R=H.matches)}let L,D={historyAction:e.history.action,location:e.history.location,matches:R,initialized:k,navigation:vx,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},P="POP",$=null,U=!1,W,Y=!1,ee=new Map,B=null,G=!1,M=!1,I=new Set,z=new Map,V=0,K=-1,O=new Map,F=new Set,se=new Map,de=new Map,xe=new Set,Ce=new Map,we,Ye=null;function De(){if(y=e.history.listen(({action:H,location:X,delta:te})=>{if(we){we(),we=void 0;return}Vn(Ce.size===0||te!=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 je=bi({currentLocation:D.location,nextLocation:X,historyAction:H});if(je&&te!=null){let Re=new Promise(Ke=>{we=Ke});e.history.go(te*-1),ri(je,{state:"blocked",location:X,proceed(){ri(je,{state:"proceeding",proceed:void 0,reset:void 0,location:X}),Re.then(()=>e.history.go(te))},reset(){let Ke=new Map(D.blockers);Ke.set(je,bd),at({blockers:Ke})}}),$?.resolve(),$=null;return}return jt(H,X)}),n){zte(t,ee);let H=()=>$te(t,ee);t.addEventListener("pagehide",H),B=()=>t.removeEventListener("pagehide",H)}return D.initialized||jt("POP",D.location,{initialHydration:!0}),L}function ht(){y&&y(),B&&B(),x.clear(),W&&W.abort(),D.fetchers.forEach((H,X)=>an(X)),D.blockers.forEach((H,X)=>xo(X))}function Rt(H){return x.add(H),()=>x.delete(H)}function at(H,X={}){H.matches&&(H.matches=H.matches.map(Re=>{let Ke=c[Re.route.id],ze=Re.route;return ze.element!==Ke.element||ze.errorElement!==Ke.errorElement||ze.hydrateFallbackElement!==Ke.hydrateFallbackElement?{...Re,route:Ke}:Re})),D={...D,...H};let te=[],je=[];D.fetchers.forEach((Re,Ke)=>{Re.state==="idle"&&(xe.has(Ke)?te.push(Ke):je.push(Ke))}),xe.forEach(Re=>{!D.fetchers.has(Re)&&!z.has(Re)&&te.push(Re)}),[...x].forEach(Re=>Re(D,{deletedFetchers:te,newErrors:H.errors??null,viewTransitionOpts:X.viewTransitionOpts,flushSync:X.flushSync===!0})),te.forEach(Re=>an(Re)),je.forEach(Re=>D.fetchers.delete(Re))}function Ze(H,X,{flushSync:te}={}){let je=D.actionData!=null&&D.navigation.formMethod!=null&&Dr(D.navigation.formMethod)&&D.navigation.state==="loading"&&H.state?._isRedirect!==!0,Re;X.actionData?Object.keys(X.actionData).length>0?Re=X.actionData:Re=null:je?Re=D.actionData:Re=null;let Ke=X.loaderData?c_(D.loaderData,X.loaderData,X.matches||[],X.errors):D.loaderData,ze=D.blockers;ze.size>0&&(ze=new Map(ze),ze.forEach((ot,tt)=>ze.set(tt,bd)));let Le=G?!1:$a(H,X.matches||D.matches),Ve=U===!0||D.navigation.formMethod!=null&&Dr(D.navigation.formMethod)&&H.state?._isRedirect!==!0;f&&(u=f,f=void 0),G||P==="POP"||(P==="PUSH"?e.history.push(H,H.state):P==="REPLACE"&&e.history.replace(H,H.state));let We;if(P==="POP"){let ot=ee.get(D.location.pathname);ot&&ot.has(H.pathname)?We={currentLocation:D.location,nextLocation:H}:ee.has(H.pathname)&&(We={currentLocation:H,nextLocation:D.location})}else if(Y){let ot=ee.get(D.location.pathname);ot?ot.add(H.pathname):(ot=new Set([H.pathname]),ee.set(D.location.pathname,ot)),We={currentLocation:D.location,nextLocation:H}}at({...X,actionData:Re,loaderData:Ke,historyAction:P,location:H,initialized:!0,navigation:vx,revalidation:"idle",restoreScrollPosition:Le,preventScrollReset:Ve,blockers:ze},{viewTransitionOpts:We,flushSync:te===!0}),P="POP",U=!1,Y=!1,G=!1,M=!1,$?.resolve(),$=null,Ye?.resolve(),Ye=null}async function mt(H,X){if($?.resolve(),$=null,typeof H=="number"){$||($=h_());let At=$.promise;return e.history.go(H),At}let te=lb(D.location,D.matches,h,H,X?.fromRouteId,X?.relative),{path:je,submission:Re,error:Ke}=e_(!1,te,X),ze=D.location,Le=Jd(D.location,je,X&&X.state);Le={...Le,...e.history.encodeLocation(Le)};let Ve=X&&X.replace!=null?X.replace:void 0,We="PUSH";Ve===!0?We="REPLACE":Ve===!1||Re!=null&&Dr(Re.formMethod)&&Re.formAction===D.location.pathname+D.location.search&&(We="REPLACE");let ot=X&&"preventScrollReset"in X?X.preventScrollReset===!0:void 0,tt=(X&&X.flushSync)===!0,Ot=bi({currentLocation:ze,nextLocation:Le,historyAction:We});if(Ot){ri(Ot,{state:"blocked",location:Le,proceed(){ri(Ot,{state:"proceeding",proceed:void 0,reset:void 0,location:Le}),mt(H,X)},reset(){let At=new Map(D.blockers);At.set(Ot,bd),at({blockers:At})}});return}await jt(We,Le,{submission:Re,pendingError:Ke,preventScrollReset:ot,replace:X&&X.replace,enableViewTransition:X&&X.viewTransition,flushSync:tt,callSiteDefaultShouldRevalidate:X&&X.unstable_defaultShouldRevalidate})}function Dt(){Ye||(Ye=h_()),ke(),at({revalidation:"loading"});let H=Ye.promise;return D.navigation.state==="submitting"?H:D.navigation.state==="idle"?(jt(D.historyAction,D.location,{startUninterruptedRevalidation:!0}),H):(jt(P||D.historyAction,D.navigation.location,{overrideNavigation:D.navigation,enableViewTransition:Y===!0}),H)}async function jt(H,X,te){W&&W.abort(),W=null,P=H,G=(te&&te.startUninterruptedRevalidation)===!0,Xi(D.location,D.matches),U=(te&&te.preventScrollReset)===!0,Y=(te&&te.enableViewTransition)===!0;let je=f||u,Re=te&&te.overrideNavigation,Ke=te?.initialHydration&&D.matches&&D.matches.length>0&&!E?D.matches:vs(je,X,h),ze=(te&&te.flushSync)===!0;if(Ke&&D.initialized&&!M&&_te(D.location,X)&&!(te&&te.submission&&Dr(te.submission.formMethod))){Ze(X,{matches:Ke},{flushSync:ze});return}let Le=vr(Ke,je,X.pathname);if(Le.active&&Le.matches&&(Ke=Le.matches),!Ke){let{error:Pn,notFoundMatches:st,route:Et}=bo(X.pathname);Ze(X,{matches:st,loaderData:{},errors:{[Et.id]:Pn}},{flushSync:ze});return}W=new AbortController;let Ve=Vc(e.history,X,W.signal,te&&te.submission),We=e.getContext?await e.getContext():new QR,ot;if(te&&te.pendingError)ot=[ys(Ke).route.id,{type:"error",error:te.pendingError}];else if(te&&te.submission&&Dr(te.submission.formMethod)){let Pn=await Ae(Ve,X,te.submission,Ke,We,Le.active,te&&te.initialHydration===!0,{replace:te.replace,flushSync:ze});if(Pn.shortCircuited)return;if(Pn.pendingActionResult){let[st,Et]=Pn.pendingActionResult;if(hi(Et)&&ef(Et.error)&&Et.error.status===404){W=null,Ze(X,{matches:Pn.matches,loaderData:{},errors:{[st]:Et.error}});return}}Ke=Pn.matches||Ke,ot=Pn.pendingActionResult,Re=yx(X,te.submission),ze=!1,Le.active=!1,Ve=Vc(e.history,Ve.url,Ve.signal)}let{shortCircuited:tt,matches:Ot,loaderData:At,errors:xn}=await Ne(Ve,X,Ke,We,Le.active,Re,te&&te.submission,te&&te.fetcherSubmission,te&&te.replace,te&&te.initialHydration===!0,ze,ot,te&&te.callSiteDefaultShouldRevalidate);tt||(W=null,Ze(X,{matches:Ot||Ke,...u_(ot),loaderData:At,errors:xn}))}async function Ae(H,X,te,je,Re,Ke,ze,Le={}){ke();let Ve=Lte(X,te);if(at({navigation:Ve},{flushSync:Le.flushSync===!0}),Ke){let tt=await Ji(je,X.pathname,H.signal);if(tt.type==="aborted")return{shortCircuited:!0};if(tt.type==="error"){if(tt.partialMatches.length===0){let{matches:At,route:xn}=up(u);return{matches:At,pendingActionResult:[xn.id,{type:"error",error:tt.error}]}}let Ot=ys(tt.partialMatches).route.id;return{matches:tt.partialMatches,pendingActionResult:[Ot,{type:"error",error:tt.error}]}}else if(tt.matches)je=tt.matches;else{let{notFoundMatches:Ot,error:At,route:xn}=bo(X.pathname);return{matches:Ot,pendingActionResult:[xn.id,{type:"error",error:At}]}}}let We,ot=Tp(je,X);if(!ot.route.action&&!ot.route.lazy)We={type:"error",error:Mi(405,{method:H.method,pathname:X.pathname,routeId:ot.route.id})};else{let tt=Yc(s,c,H,je,ot,ze?[]:r,Re),Ot=await Ee(H,tt,Re,null);if(We=Ot[ot.route.id],!We){for(let At of je)if(Ot[At.route.id]){We=Ot[At.route.id];break}}if(H.signal.aborted)return{shortCircuited:!0}}if(bl(We)){let tt;return Le&&Le.replace!=null?tt=Le.replace:tt=a_(We.response.headers.get("Location"),new URL(H.url),h,e.history)===D.location.pathname+D.location.search,await lt(H,We,!0,{submission:te,replace:tt}),{shortCircuited:!0}}if(hi(We)){let tt=ys(je,ot.route.id);return(Le&&Le.replace)!==!0&&(P="PUSH"),{matches:je,pendingActionResult:[tt.route.id,We,ot.route.id]}}return{matches:je,pendingActionResult:[ot.route.id,We]}}async function Ne(H,X,te,je,Re,Ke,ze,Le,Ve,We,ot,tt,Ot){let At=Ke||yx(X,ze),xn=ze||Le||f_(At),Pn=!G&&!We;if(Re){if(Pn){let qn=Me(tt);at({navigation:At,...qn!==void 0?{actionData:qn}:{}},{flushSync:ot})}let It=await Ji(te,X.pathname,H.signal);if(It.type==="aborted")return{shortCircuited:!0};if(It.type==="error"){if(It.partialMatches.length===0){let{matches:to,route:yr}=up(u);return{matches:to,loaderData:{},errors:{[yr.id]:It.error}}}let qn=ys(It.partialMatches).route.id;return{matches:It.partialMatches,loaderData:{},errors:{[qn]:It.error}}}else if(It.matches)te=It.matches;else{let{error:qn,notFoundMatches:to,route:yr}=bo(X.pathname);return{matches:to,loaderData:{},errors:{[yr.id]:qn}}}}let st=f||u,{dsMatches:Et,revalidatingFetchers:Xn}=t_(H,je,s,c,e.history,D,te,xn,X,We?[]:r,We===!0,M,I,xe,se,F,st,h,e.patchRoutesOnNavigation!=null,tt,Ot);if(K=++V,!e.dataStrategy&&!Et.some(It=>It.shouldLoad)&&!Et.some(It=>It.route.middleware&&It.route.middleware.length>0)&&Xn.length===0){let It=$n();return Ze(X,{matches:te,loaderData:{},errors:tt&&hi(tt[1])?{[tt[0]]:tt[1].error}:null,...u_(tt),...It?{fetchers:new Map(D.fetchers)}:{}},{flushSync:ot}),{shortCircuited:!0}}if(Pn){let It={};if(!Re){It.navigation=At;let qn=Me(tt);qn!==void 0&&(It.actionData=qn)}Xn.length>0&&(It.fetchers=Ie(Xn)),at(It,{flushSync:ot})}Xn.forEach(It=>{Jt(It.key),It.controller&&z.set(It.key,It.controller)});let Er=()=>Xn.forEach(It=>Jt(It.key));W&&W.signal.addEventListener("abort",Er);let{loaderResults:Nn,fetcherResults:Zi}=await he(Et,Xn,H,je);if(H.signal.aborted)return{shortCircuited:!0};W&&W.signal.removeEventListener("abort",Er),Xn.forEach(It=>z.delete(It.key));let ii=dp(Nn);if(ii)return await lt(H,ii.result,!0,{replace:Ve}),{shortCircuited:!0};if(ii=dp(Zi),ii)return F.add(ii.key),await lt(H,ii.result,!0,{replace:Ve}),{shortCircuited:!0};let{loaderData:eo,errors:Si}=l_(D,te,Nn,tt,Xn,Zi);We&&D.errors&&(Si={...D.errors,...Si});let Jo=$n(),Bs=xi(K),Vs=Jo||Bs||Xn.length>0;return{matches:te,loaderData:eo,errors:Si,...Vs?{fetchers:new Map(D.fetchers)}:{}}}function Me(H){if(H&&!hi(H[1]))return{[H[0]]:H[1].data};if(D.actionData)return Object.keys(D.actionData).length===0?null:D.actionData}function Ie(H){return H.forEach(X=>{let te=D.fetchers.get(X.key),je=Sd(void 0,te?te.data:void 0);D.fetchers.set(X.key,je)}),new Map(D.fetchers)}async function it(H,X,te,je){Jt(H);let Re=(je&&je.flushSync)===!0,Ke=f||u,ze=lb(D.location,D.matches,h,te,X,je?.relative),Le=vs(Ke,ze,h),Ve=vr(Le,Ke,ze);if(Ve.active&&Ve.matches&&(Le=Ve.matches),!Le){_t(H,X,Mi(404,{pathname:ze}),{flushSync:Re});return}let{path:We,submission:ot,error:tt}=e_(!0,ze,je);if(tt){_t(H,X,tt,{flushSync:Re});return}let Ot=e.getContext?await e.getContext():new QR,At=(je&&je.preventScrollReset)===!0;if(ot&&Dr(ot.formMethod)){await et(H,X,We,Le,Ot,Ve.active,Re,At,ot,je&&je.unstable_defaultShouldRevalidate);return}se.set(H,{routeId:X,path:We}),await ft(H,X,We,Le,Ot,Ve.active,Re,At,ot)}async function et(H,X,te,je,Re,Ke,ze,Le,Ve,We){ke(),se.delete(H);let ot=D.fetchers.get(H);vt(H,Ite(Ve,ot),{flushSync:ze});let tt=new AbortController,Ot=Vc(e.history,te,tt.signal,Ve);if(Ke){let zt=await Ji(je,new URL(Ot.url).pathname,Ot.signal,H);if(zt.type==="aborted")return;if(zt.type==="error"){_t(H,X,zt.error,{flushSync:ze});return}else if(zt.matches)je=zt.matches;else{_t(H,X,Mi(404,{pathname:te}),{flushSync:ze});return}}let At=Tp(je,te);if(!At.route.action&&!At.route.lazy){let zt=Mi(405,{method:Ve.formMethod,pathname:te,routeId:X});_t(H,X,zt,{flushSync:ze});return}z.set(H,tt);let xn=V,Pn=Yc(s,c,Ot,je,At,r,Re),st=await Ee(Ot,Pn,Re,H),Et=st[At.route.id];if(!Et){for(let zt of Pn)if(st[zt.route.id]){Et=st[zt.route.id];break}}if(Ot.signal.aborted){z.get(H)===tt&&z.delete(H);return}if(xe.has(H)){if(bl(Et)||hi(Et)){vt(H,xa(void 0));return}}else{if(bl(Et))if(z.delete(H),K>xn){vt(H,xa(void 0));return}else return F.add(H),vt(H,Sd(Ve)),lt(Ot,Et,!1,{fetcherSubmission:Ve,preventScrollReset:Le});if(hi(Et)){_t(H,X,Et.error);return}}let Xn=D.navigation.location||D.location,Er=Vc(e.history,Xn,tt.signal),Nn=f||u,Zi=D.navigation.state!=="idle"?vs(Nn,D.navigation.location,h):D.matches;bt(Zi,"Didn't find any matches after fetcher action");let ii=++V;O.set(H,ii);let eo=Sd(Ve,Et.data);D.fetchers.set(H,eo);let{dsMatches:Si,revalidatingFetchers:Jo}=t_(Er,Re,s,c,e.history,D,Zi,Ve,Xn,r,!1,M,I,xe,se,F,Nn,h,e.patchRoutesOnNavigation!=null,[At.route.id,Et],We);Jo.filter(zt=>zt.key!==H).forEach(zt=>{let Fs=zt.key,Uf=D.fetchers.get(Fs),Ru=Sd(void 0,Uf?Uf.data:void 0);D.fetchers.set(Fs,Ru),Jt(Fs),zt.controller&&z.set(Fs,zt.controller)}),at({fetchers:new Map(D.fetchers)});let Bs=()=>Jo.forEach(zt=>Jt(zt.key));tt.signal.addEventListener("abort",Bs);let{loaderResults:Vs,fetcherResults:It}=await he(Si,Jo,Er,Re);if(tt.signal.aborted)return;if(tt.signal.removeEventListener("abort",Bs),O.delete(H),z.delete(H),Jo.forEach(zt=>z.delete(zt.key)),D.fetchers.has(H)){let zt=xa(Et.data);D.fetchers.set(H,zt)}let qn=dp(Vs);if(qn)return lt(Er,qn.result,!1,{preventScrollReset:Le});if(qn=dp(It),qn)return F.add(qn.key),lt(Er,qn.result,!1,{preventScrollReset:Le});let{loaderData:to,errors:yr}=l_(D,Zi,Vs,void 0,Jo,It);xi(ii),D.navigation.state==="loading"&&ii>K?(bt(P,"Expected pending action"),W&&W.abort(),Ze(D.navigation.location,{matches:Zi,loaderData:to,errors:yr,fetchers:new Map(D.fetchers)})):(at({errors:yr,loaderData:c_(D.loaderData,to,Zi,yr),fetchers:new Map(D.fetchers)}),M=!1)}async function ft(H,X,te,je,Re,Ke,ze,Le,Ve){let We=D.fetchers.get(H);vt(H,Sd(Ve,We?We.data:void 0),{flushSync:ze});let ot=new AbortController,tt=Vc(e.history,te,ot.signal);if(Ke){let Et=await Ji(je,new URL(tt.url).pathname,tt.signal,H);if(Et.type==="aborted")return;if(Et.type==="error"){_t(H,X,Et.error,{flushSync:ze});return}else if(Et.matches)je=Et.matches;else{_t(H,X,Mi(404,{pathname:te}),{flushSync:ze});return}}let Ot=Tp(je,te);z.set(H,ot);let At=V,xn=Yc(s,c,tt,je,Ot,r,Re),st=(await Ee(tt,xn,Re,H))[Ot.route.id];if(z.get(H)===ot&&z.delete(H),!tt.signal.aborted){if(xe.has(H)){vt(H,xa(void 0));return}if(bl(st))if(K>At){vt(H,xa(void 0));return}else{F.add(H),await lt(tt,st,!1,{preventScrollReset:Le});return}if(hi(st)){_t(H,X,st.error);return}vt(H,xa(st.data))}}async function lt(H,X,te,{submission:je,fetcherSubmission:Re,preventScrollReset:Ke,replace:ze}={}){te||($?.resolve(),$=null),X.response.headers.has("X-Remix-Revalidate")&&(M=!0);let Le=X.response.headers.get("Location");bt(Le,"Expected a Location header on the redirect Response"),Le=a_(Le,new URL(H.url),h,e.history);let Ve=Jd(D.location,Le,{_isRedirect:!0});if(n){let xn=!1;if(X.response.headers.has("X-Remix-Reload-Document"))xn=!0;else if(i1(Le)){const Pn=yN(Le,!0);xn=Pn.origin!==t.location.origin||Vi(Pn.pathname,h)==null}if(xn){ze?t.location.replace(Le):t.location.assign(Le);return}}W=null;let We=ze===!0||X.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:ot,formAction:tt,formEncType:Ot}=D.navigation;!je&&!Re&&ot&&tt&&Ot&&(je=f_(D.navigation));let At=je||Re;if(fte.has(X.response.status)&&At&&Dr(At.formMethod))await jt(We,Ve,{submission:{...At,formAction:Le},preventScrollReset:Ke||U,enableViewTransition:te?Y:void 0});else{let xn=yx(Ve,je);await jt(We,Ve,{overrideNavigation:xn,fetcherSubmission:Re,preventScrollReset:Ke||U,enableViewTransition:te?Y:void 0})}}async function Ee(H,X,te,je){let Re,Ke={};try{Re=await jte(m,H,X,je,te,!1)}catch(ze){return X.filter(Le=>Le.shouldLoad).forEach(Le=>{Ke[Le.route.id]={type:"error",error:ze}}),Ke}if(H.signal.aborted)return Ke;if(!Dr(H.method))for(let ze of X){if(Re[ze.route.id]?.type==="error")break;!Re.hasOwnProperty(ze.route.id)&&!D.loaderData.hasOwnProperty(ze.route.id)&&(!D.errors||!D.errors.hasOwnProperty(ze.route.id))&&ze.shouldCallHandler()&&(Re[ze.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${ze.route.id}`)})}for(let[ze,Le]of Object.entries(Re))if(Pte(Le)){let Ve=Le.result;Ke[ze]={type:"redirect",response:Tte(Ve,H,ze,X,h)}}else Ke[ze]=await Ete(Le);return Ke}async function he(H,X,te,je){let Re=Ee(te,H,je,null),Ke=Promise.all(X.map(async Ve=>{if(Ve.matches&&Ve.match&&Ve.request&&Ve.controller){let ot=(await Ee(Ve.request,Ve.matches,je,Ve.key))[Ve.match.route.id];return{[Ve.key]:ot}}else return Promise.resolve({[Ve.key]:{type:"error",error:Mi(404,{pathname:Ve.path})}})})),ze=await Re,Le=(await Ke).reduce((Ve,We)=>Object.assign(Ve,We),{});return{loaderResults:ze,fetcherResults:Le}}function ke(){M=!0,se.forEach((H,X)=>{z.has(X)&&I.add(X),Jt(X)})}function vt(H,X,te={}){D.fetchers.set(H,X),at({fetchers:new Map(D.fetchers)},{flushSync:(te&&te.flushSync)===!0})}function _t(H,X,te,je={}){let Re=ys(D.matches,X);an(H),at({errors:{[Re.route.id]:te},fetchers:new Map(D.fetchers)},{flushSync:(je&&je.flushSync)===!0})}function Kt(H){return de.set(H,(de.get(H)||0)+1),xe.has(H)&&xe.delete(H),D.fetchers.get(H)||hte}function yn(H,X){Jt(H,X?.reason),vt(H,xa(null))}function an(H){let X=D.fetchers.get(H);z.has(H)&&!(X&&X.state==="loading"&&O.has(H))&&Jt(H),se.delete(H),O.delete(H),F.delete(H),xe.delete(H),I.delete(H),D.fetchers.delete(H)}function Cr(H){let X=(de.get(H)||0)-1;X<=0?(de.delete(H),xe.add(H)):de.set(H,X),at({fetchers:new Map(D.fetchers)})}function Jt(H,X){let te=z.get(H);te&&(te.abort(X),z.delete(H))}function sr(H){for(let X of H){let te=Kt(X),je=xa(te.data);D.fetchers.set(X,je)}}function $n(){let H=[],X=!1;for(let te of F){let je=D.fetchers.get(te);bt(je,`Expected fetcher: ${te}`),je.state==="loading"&&(F.delete(te),H.push(te),X=!0)}return sr(H),X}function xi(H){let X=[];for(let[te,je]of O)if(je<H){let Re=D.fetchers.get(te);bt(Re,`Expected fetcher: ${te}`),Re.state==="loading"&&(Jt(te),O.delete(te),X.push(te))}return sr(X),X.length>0}function Xo(H,X){let te=D.blockers.get(H)||bd;return Ce.get(H)!==X&&Ce.set(H,X),te}function xo(H){D.blockers.delete(H),Ce.delete(H)}function ri(H,X){let te=D.blockers.get(H)||bd;bt(te.state==="unblocked"&&X.state==="blocked"||te.state==="blocked"&&X.state==="blocked"||te.state==="blocked"&&X.state==="proceeding"||te.state==="blocked"&&X.state==="unblocked"||te.state==="proceeding"&&X.state==="unblocked",`Invalid blocker state transition: ${te.state} -> ${X.state}`);let je=new Map(D.blockers);je.set(H,X),at({blockers:je})}function bi({currentLocation:H,nextLocation:X,historyAction:te}){if(Ce.size===0)return;Ce.size>1&&Vn(!1,"A router only supports one blocker at a time");let je=Array.from(Ce.entries()),[Re,Ke]=je[je.length-1],ze=D.blockers.get(Re);if(!(ze&&ze.state==="proceeding")&&Ke({currentLocation:H,nextLocation:X,historyAction:te}))return Re}function bo(H){let X=Mi(404,{pathname:H}),te=f||u,{matches:je,route:Re}=up(te);return{notFoundMatches:je,route:Re,error:X}}function Ki(H,X,te){if(S=H,C=X,w=te||null,!T&&D.navigation===vx){T=!0;let je=$a(D.location,D.matches);je!=null&&at({restoreScrollPosition:je})}return()=>{S=null,C=null,w=null}}function So(H,X){return w&&w(H,X.map(je=>$ee(je,D.loaderData)))||H.key}function Xi(H,X){if(S&&C){let te=So(H,X);S[te]=C()}}function $a(H,X){if(S){let te=So(H,X),je=S[te];if(typeof je=="number")return je}return null}function vr(H,X,te){if(e.patchRoutesOnNavigation)if(H){if(Object.keys(H[0].params).length>0)return{active:!0,matches:Rd(X,te,h,!0)}}else return{active:!0,matches:Rd(X,te,h,!0)||[]};return{active:!1,matches:null}}async function Ji(H,X,te,je){if(!e.patchRoutesOnNavigation)return{type:"success",matches:H};let Re=H;for(;;){let Ke=f==null,ze=f||u,Le=c;try{await e.patchRoutesOnNavigation({signal:te,path:X,matches:Re,fetcherKey:je,patch:(ot,tt)=>{te.aborted||n_(ot,tt,ze,Le,s,!1)}})}catch(ot){return{type:"error",error:ot,partialMatches:Re}}finally{Ke&&!te.aborted&&(u=[...u])}if(te.aborted)return{type:"aborted"};let Ve=vs(ze,X,h),We=null;if(Ve){if(Object.keys(Ve[0].params).length===0)return{type:"success",matches:Ve};if(We=Rd(ze,X,h,!0),!(We&&Re.length<We.length&&Ln(Re,We.slice(0,Re.length))))return{type:"success",matches:Ve}}if(We||(We=Rd(ze,X,h,!0)),!We||Ln(Re,We))return{type:"success",matches:null};Re=We}}function Ln(H,X){return H.length===X.length&&H.every((te,je)=>te.route.id===X[je].route.id)}function Eu(H){c={},f=Zd(H,s,void 0,c)}function Tu(H,X,te=!1){let je=f==null;n_(H,X,f||u,c,s,te),je&&(u=[...u],at({}))}return L={get basename(){return h},get future(){return g},get state(){return D},get routes(){return u},get window(){return t},initialize:De,subscribe:Rt,enableScrollRestoration:Ki,navigate:mt,fetch:it,revalidate:Dt,createHref:H=>e.history.createHref(H),encodeLocation:H=>e.history.encodeLocation(H),getFetcher:Kt,resetFetcher:yn,deleteFetcher:Cr,dispose:ht,getBlocker:Xo,deleteBlocker:xo,patchRoutes:Tu,_internalFetchControllers:z,_internalSetRoutes:Eu,_internalSetStateDoNotUseOrYouWillBreakYourApp(H){at(H)}},e.unstable_instrumentations&&(L=ite(L,e.unstable_instrumentations.map(H=>H.router).filter(Boolean))),L}function gte(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function lb(e,t,n,r,o,s){let c,u;if(o){c=[];for(let h of t)if(c.push(h),h.route.id===o){u=h;break}}else c=t,u=t[t.length-1];let f=yg(r||".",vg(c),Vi(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=s1(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=Jee({basename:n,pathname:f.pathname})),Go(f)}function e_(e,t,n){if(!n||!gte(n))return{path:t};if(n.formMethod&&!Mte(n.formMethod))return{path:t,error:Mi(405,{method:n.formMethod})};let r=()=>({path:t,error:Mi(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),c=MN(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()}}}bt(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=s_(u);else if(n.body==null)u=new URLSearchParams,f=new FormData;else try{u=new URLSearchParams(n.body),f=s_(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=za(t);return e&&m.search&&s1(m.search)&&u.append("index",""),m.search=`?${u}`,{path:Go(m),submission:h}}function t_(e,t,n,r,o,s,c,u,f,h,m,g,y,x,S,w,C,T,R,E,_){let k=E?hi(E[1])?E[1].error:E[1].data:void 0,L=o.createURL(s.location),D=o.createURL(f),P;if(m&&s.errors){let G=Object.keys(s.errors)[0];P=c.findIndex(M=>M.route.id===G)}else if(E&&hi(E[1])){let G=E[0];P=c.findIndex(M=>M.route.id===G)-1}let $=E?E[1].statusCode:void 0,U=$&&$>=400,W={currentUrl:L,currentParams:s.matches[0]?.params||{},nextUrl:D,nextParams:c[0].params,...u,actionResult:k,actionStatus:$},Y=Mf(c),ee=c.map((G,M)=>{let{route:I}=G,z=null;if(P!=null&&M>P?z=!1:I.lazy?z=!0:o1(I)?m?z=cb(I,s.loaderData,s.errors):vte(s.loaderData,s.matches[M],G)&&(z=!0):z=!1,z!==null)return ub(n,r,e,Y,G,h,t,z);let V=!1;typeof _=="boolean"?V=_:U?V=!1:(g||L.pathname+L.search===D.pathname+D.search||L.search!==D.search||yte(s.matches[M],G))&&(V=!0);let K={...W,defaultShouldRevalidate:V},O=Pd(G,K);return ub(n,r,e,Y,G,h,t,O,K,_)}),B=[];return S.forEach((G,M)=>{if(m||!c.some(de=>de.route.id===G.routeId)||x.has(M))return;let I=s.fetchers.get(M),z=I&&I.state!=="idle"&&I.data===void 0,V=vs(C,G.path,T);if(!V){if(R&&z)return;B.push({key:M,routeId:G.routeId,path:G.path,matches:null,match:null,request:null,controller:null});return}if(w.has(M))return;let K=Tp(V,G.path),O=new AbortController,F=Vc(o,G.path,O.signal),se=null;if(y.has(M))y.delete(M),se=Yc(n,r,F,V,K,h,t);else if(z)g&&(se=Yc(n,r,F,V,K,h,t));else{let de;typeof _=="boolean"?de=_:U?de=!1:de=g;let xe={...W,defaultShouldRevalidate:de};Pd(K,xe)&&(se=Yc(n,r,F,V,K,h,t,xe))}se&&B.push({key:M,routeId:G.routeId,path:G.path,matches:se,match:K,request:F,controller:O})}),{dsMatches:ee,revalidatingFetchers:B}}function o1(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function cb(e,t,n){if(e.lazy)return!0;if(!o1(e))return!1;let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;return!r&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!o}function vte(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function yte(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Pd(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function n_(e,t,n,r,o,s){let c;if(e){let h=r[e];bt(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=>AN(h,g));m?f.push({existingRoute:m,newRoute:h}):u.push(h)}),u.length>0){let h=Zd(u,o,[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]=Zd([g],o,[],{},!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 AN(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(o=>AN(n,o))):!1}var r_=new WeakMap,kN=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(bt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let s=o.lazy[e];if(!s)return;let c=r_.get(o);c||(c={},r_.set(o,c));let u=c[e];if(u)return u;let f=(async()=>{let h=Mee(e),g=o[e]!==void 0&&e!=="hasErrorBoundary";if(h)Vn(!h,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),c[e]=Promise.resolve();else if(g)Vn(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let y=await s();y!=null&&(Object.assign(o,{[e]:y}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(y=>y===void 0)&&(o.lazy=void 0))})();return c[e]=f,f},i_=new WeakMap;function xte(e,t,n,r,o){let s=n[e.id];if(bt(s,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let m=i_.get(s);if(m)return{lazyRoutePromise:m,lazyHandlerPromise:m};let g=(async()=>{bt(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=Iee(S),R=s[S]!==void 0&&S!=="hasErrorBoundary";C?Vn(!C,"Route property "+S+" is not a supported property to be returned from a lazy route function. This property will be ignored."):R?Vn(!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 i_.set(s,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let c=Object.keys(e.lazy),u=[],f;for(let m of c){if(o&&o.includes(m))continue;let g=kN({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 o_(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,s)=>{n[t[s].route.id]=o}),n}async function bte(e){return e.matches.some(t=>t.route.middleware)?PN(e,()=>o_(e)):o_(e)}function PN(e,t){return Ste(e,t,r=>{if(Ote(r))throw r;return r},Ate,n);function n(r,o,s){if(s)return Promise.resolve(Object.assign(s.value,{[o]:{type:"error",result:r}}));{let{matches:c}=e,u=Math.min(Math.max(c.findIndex(h=>h.route.id===o),0),Math.max(c.findIndex(h=>h.shouldCallHandler()),0)),f=ys(c,c[u].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function Ste(e,t,n,r,o){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 NN({request:c,params:u,context:f,unstable_pattern:h},m,t,n,r,o)}async function NN(e,t,n,r,o,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 NN(e,t,n,r,o,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 o(S)?S:g?S??g.value:(g={value:await y()},g.value)}catch(x){return await s(x,h,g)}}function ON(e,t,n,r,o){let s=kN({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),c=xte(r.route,Dr(n.method)?"action":"loader",t,e,o);return{middleware:s,route:c.lazyRoutePromise,handler:c.lazyHandlerPromise}}function ub(e,t,n,r,o,s,c,u,f=null,h){let m=!1,g=ON(e,t,n,o,s);return{...o,_lazyPromises:g,shouldLoad:u,shouldRevalidateArgs:f,shouldCallHandler(y){return m=!0,f?typeof h=="boolean"?Pd(o,{...f,defaultShouldRevalidate:h}):typeof y=="boolean"?Pd(o,{...f,defaultShouldRevalidate:y}):Pd(o,f):u},resolve(y){let{lazy:x,loader:S,middleware:w}=o.route,C=m||u||y&&!Dr(n.method)&&(x||S),T=w&&w.length>0&&!S&&!x;return C&&(Dr(n.method)||!T)?wte({request:n,unstable_pattern:r,match:o,lazyHandlerPromise:g?.handler,lazyRoutePromise:g?.route,handlerOverride:y,scopedContext:c}):Promise.resolve({type:"data",result:void 0})}}}function Yc(e,t,n,r,o,s,c,u=null){return r.map(f=>f.route.id!==o.route.id?{...f,shouldLoad:!1,shouldRevalidateArgs:u,shouldCallHandler:()=>!1,_lazyPromises:ON(e,t,n,f,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:ub(e,t,n,Mf(r),f,s,c,!0,u))}async function jte(e,t,n,r,o,s){n.some(h=>h._lazyPromises?.middleware)&&await Promise.all(n.map(h=>h._lazyPromises?.middleware));let c={request:t,unstable_pattern:Mf(n),params:n[0].params,context:o,matches:n},f=await e({...c,fetcherKey:r,runClientMiddleware:h=>{let m=c;return PN(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 wte({request:e,unstable_pattern:t,match:n,lazyHandlerPromise:r,lazyRoutePromise:o,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||o)if(y){let x,[S]=await Promise.all([g(y).catch(w=>{x=w}),r,o]);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),o]);else if(m==="action"){let S=new URL(e.url),w=S.pathname+S.search;throw Mi(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 Mi(404,{pathname:S})}}catch(y){return{type:"error",result:y}}finally{f&&e.signal.removeEventListener("abort",f)}return u}async function Cte(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 Ete(e){let{result:t,type:n}=e;if(a1(t)){let r;try{r=await Cte(t)}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new Of(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?d_(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:Dte(t),statusCode:ef(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:ef(t)?t.status:void 0}:d_(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 Tte(e,t,n,r,o){let s=e.headers.get("Location");if(bt(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!i1(s)){let c=r.slice(0,r.findIndex(u=>u.route.id===n)+1);s=lb(new URL(t.url),c,o,s),e.headers.set("Location",s)}return e}function a_(e,t,n,r){let o=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(i1(e)){let s=e,c=s.startsWith("//")?new URL(t.protocol+s):new URL(s);if(o.includes(c.protocol))throw new Error("Invalid redirect location");let u=Vi(c.pathname,n)!=null;if(c.origin===t.origin&&u)return c.pathname+c.search+c.hash}try{let s=r.createURL(e);if(o.includes(s.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Vc(e,t,n,r){let o=e.createURL(MN(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(o,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 s_(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function Rte(e,t,n,r=!1,o=!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(bt(!bl(x),"Cannot handle redirect results in processLoaderData"),hi(x)){let S=x.error;if(m!==void 0&&(S=m,m=void 0),c=c||{},o)c[y]=S;else{let w=ys(e,y);c[w.route.id]==null&&(c[w.route.id]=S)}r||(s[y]=DN),f||(f=!0,u=ef(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 l_(e,t,n,r,o,s){let{loaderData:c,errors:u}=Rte(t,n,r);return o.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(bt(y,"Did not find corresponding fetcher result"),hi(y)){let x=ys(e.matches,m?.route.id);u&&u[x.route.id]||(u={...u,[x.route.id]:y.error}),e.fetchers.delete(h)}else if(bl(y))bt(!1,"Unhandled fetcher revalidation redirect");else{let x=xa(y.data);e.fetchers.set(h,x)}}),{loaderData:c,errors:u}}function c_(e,t,n,r){let o=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&&(o[c]=e[c]),r&&r.hasOwnProperty(c))break}return o}function u_(e){return e?hi(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ys(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 up(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 Mi(e,{pathname:t,routeId:n,method:r,type:o,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.`:o==="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 Of(e||500,c,new Error(u),!0)}function dp(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(bl(o))return{key:r,result:o}}}function MN(e){let t=typeof e=="string"?za(e):e;return Go({...t,hash:""})}function _te(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Dte(e){return new Of(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function Ate(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&kte(n))}function kte(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Pte(e){return a1(e.result)&&RN.has(e.result.status)}function hi(e){return e.type==="error"}function bl(e){return(e&&e.type)==="redirect"}function d_(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function a1(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Nte(e){return RN.has(e)}function Ote(e){return a1(e)&&Nte(e.status)&&e.headers.has("Location")}function Mte(e){return dte.has(e.toUpperCase())}function Dr(e){return cte.has(e.toUpperCase())}function s1(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Tp(e,t){let n=typeof t=="string"?za(t).search:t.search;if(e[e.length-1].route.index&&s1(n||""))return e[e.length-1];let r=jN(e);return r[r.length-1]}function f_(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:s,json:c}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};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 yx(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 Lte(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 Sd(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 Ite(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 xa(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 zte(e,t){try{let n=e.sessionStorage.getItem(_N);if(n){let r=JSON.parse(n);for(let[o,s]of Object.entries(r||{}))s&&Array.isArray(s)&&t.set(o,new Set(s||[]))}}catch{}}function $te(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(_N,JSON.stringify(n))}catch(r){Vn(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function h_(){let e,t,n=new Promise((r,o)=>{e=async s=>{r(s);try{await n}catch{}},t=async s=>{o(s);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Ql=v.createContext(null);Ql.displayName="DataRouter";var Lf=v.createContext(null);Lf.displayName="DataRouterState";var LN=v.createContext(!1);function Ute(){return v.useContext(LN)}var l1=v.createContext({isTransitioning:!1});l1.displayName="ViewTransition";var IN=v.createContext(new Map);IN.displayName="Fetchers";var Bte=v.createContext(null);Bte.displayName="Await";var yi=v.createContext(null);yi.displayName="Navigation";var If=v.createContext(null);If.displayName="Location";var Yi=v.createContext({outlet:null,matches:[],isDataRoute:!1});Yi.displayName="Route";var c1=v.createContext(null);c1.displayName="RouteError";var zN="REACT_ROUTER_ERROR",Vte="REDIRECT",Fte="ROUTE_ERROR_RESPONSE";function Hte(e){if(e.startsWith(`${zN}:${Vte}:{`))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 qte(e){if(e.startsWith(`${zN}:${Fte}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Of(t.status,t.statusText,t.data)}catch{}}function Gte(e,{relative:t}={}){bt(Cu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=v.useContext(yi),{hash:o,pathname:s,search:c}=zf(e,{relative:t}),u=s;return n!=="/"&&(u=s==="/"?n:Bo([n,s])),r.createHref({pathname:u,search:c,hash:o})}function Cu(){return v.useContext(If)!=null}function ni(){return bt(Cu(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(If).location}var $N="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function UN(e){v.useContext(yi).static||v.useLayoutEffect(e)}function Hn(){let{isDataRoute:e}=v.useContext(Yi);return e?sne():Wte()}function Wte(){bt(Cu(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Ql),{basename:t,navigator:n}=v.useContext(yi),{matches:r}=v.useContext(Yi),{pathname:o}=ni(),s=JSON.stringify(vg(r)),c=v.useRef(!1);return UN(()=>{c.current=!0}),v.useCallback((f,h={})=>{if(Vn(c.current,$N),!c.current)return;if(typeof f=="number"){n.go(f);return}let m=yg(f,JSON.parse(s),o,h.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Bo([t,m.pathname])),(h.replace?n.replace:n.push)(m,h.state,h)},[t,n,s,o,e])}var Qte=v.createContext(null);function Yte(e){let t=v.useContext(Yi).outlet;return v.useMemo(()=>t&&v.createElement(Qte.Provider,{value:e},t),[t,e])}function Yt(){let{matches:e}=v.useContext(Yi),t=e[e.length-1];return t?t.params:{}}function zf(e,{relative:t}={}){let{matches:n}=v.useContext(Yi),{pathname:r}=ni(),o=JSON.stringify(vg(n));return v.useMemo(()=>yg(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function Kte(e,t){return BN(e,t)}function BN(e,t,n,r,o){bt(Cu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(yi),{matches:c}=v.useContext(Yi),u=c[c.length-1],f=u?u.params:{},h=u?u.pathname:"/",m=u?u.pathnameBase:"/",g=u&&u.route;{let R=g&&g.path||"";FN(h,!g||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${R}">) 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="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let y=ni(),x;if(t){let R=typeof t=="string"?za(t):t;bt(m==="/"||R.pathname?.startsWith(m),`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 "${m}" but pathname "${R.pathname}" was given in the \`location\` prop.`),x=R}else x=y;let S=x.pathname||"/",w=S;if(m!=="/"){let R=m.replace(/^\//,"").split("/");w="/"+S.replace(/^\//,"").split("/").slice(R.length).join("/")}let C=vs(e,{pathname:w});Vn(g||C!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Vn(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.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 T=tne(C&&C.map(R=>Object.assign({},R,{params:Object.assign({},f,R.params),pathname:Bo([m,s.encodeLocation?s.encodeLocation(R.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?m:Bo([m,s.encodeLocation?s.encodeLocation(R.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),c,n,r,o);return t&&T?v.createElement(If.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...x},navigationType:"POP"}},T):T}function Xte(){let e=ane(),t=ef(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)",o={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:o},n):null,c)}var Jte=v.createElement(Xte,null),VN=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=qte(e.digest);n&&(e=n)}let t=e!==void 0?v.createElement(Yi.Provider,{value:this.props.routeContext},v.createElement(c1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(Zte,{error:e},t):t}};VN.contextType=LN;var xx=new WeakMap;function Zte({children:e,error:t}){let{basename:n}=v.useContext(yi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Hte(t.digest);if(r){let o=xx.get(t);if(o)throw o;let s=CN(r.location,n);if(wN&&!xx.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 xx.set(t,c),c}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function ene({routeContext:e,match:t,children:n}){let r=v.useContext(Ql);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Yi.Provider,{value:e},n)}function tne(e,t=[],n=null,r=null,o=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,c=n?.errors;if(c!=null){let m=s.findIndex(g=>g.route.id&&c?.[g.route.id]!==void 0);bt(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let u=!1,f=-1;if(n)for(let m=0;m<s.length;m++){let g=s[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=m),g.route.id){let{loaderData:y,errors:x}=n,S=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||S){u=!0,f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}let h=n&&r?(m,g)=>{r(m,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Mf(n.matches),errorInfo:g})}:void 0;return s.reduceRight((m,g,y)=>{let x,S=!1,w=null,C=null;n&&(x=c&&g.route.id?c[g.route.id]:void 0,w=g.route.errorElement||Jte,u&&(f<0&&y===0?(FN("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,C=null):f===y&&(S=!0,C=g.route.hydrateFallbackElement||null)));let T=t.concat(s.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(ene,{match:g,routeContext:{outlet:m,matches:T,isDataRoute:n!=null},children:E})};return n&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?v.createElement(VN,{location:n.location,revalidation:n.revalidation,component:w,error:x,children:R(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:h}):R()},null)}function u1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nne(e){let t=v.useContext(Ql);return bt(t,u1(e)),t}function rne(e){let t=v.useContext(Lf);return bt(t,u1(e)),t}function ine(e){let t=v.useContext(Yi);return bt(t,u1(e)),t}function d1(e){let t=ine(e),n=t.matches[t.matches.length-1];return bt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function one(){return d1("useRouteId")}function ane(){let e=v.useContext(c1),t=rne("useRouteError"),n=d1("useRouteError");return e!==void 0?e:t.errors?.[n]}function sne(){let{router:e}=nne("useNavigate"),t=d1("useNavigate"),n=v.useRef(!1);return UN(()=>{n.current=!0}),v.useCallback(async(o,s={})=>{Vn(n.current,$N),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...s}))},[e,t])}var p_={};function FN(e,t,n){!t&&!p_[e]&&(p_[e]=!0,Vn(!1,n))}var m_={};function g_(e,t){!e&&!m_[t]&&(m_[t]=!0,console.warn(t))}var lne="useOptimistic",v_=wb[lne],cne=()=>{};function une(e){return v_?v_(e):[e,cne]}function dne(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Vn(!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&&Vn(!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&&Vn(!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 fne=["HydrateFallback","hydrateFallbackElement"],hne=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 pne({router:e,flushSync:t,onError:n,unstable_useTransitions:r}){r=Ute()||r;let[s,c]=v.useState(e.state),[u,f]=une(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((P,{deletedFetchers:$,newErrors:U,flushSync:W,viewTransitionOpts:Y})=>{U&&n&&Object.values(U).forEach(B=>n(B,{location:P.location,params:P.matches[0]?.params??{},unstable_pattern:Mf(P.matches)})),P.fetchers.forEach((B,G)=>{B.data!==void 0&&E.current.set(G,B.data)}),$.forEach(B=>E.current.delete(B)),g_(W===!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(g_(Y==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."),!Y||!ee){t&&W?t(()=>c(P)):r===!1?c(P):v.startTransition(()=>{r===!0&&f(B=>y_(B,P)),c(P)});return}if(t&&W){t(()=>{w&&(x?.resolve(),w.skipTransition()),y({isTransitioning:!0,flushSync:!0,currentLocation:Y.currentLocation,nextLocation:Y.nextLocation})});let B=e.window.document.startViewTransition(()=>{t(()=>c(P))});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:P,currentLocation:Y.currentLocation,nextLocation:Y.nextLocation})):(m(P),y({isTransitioning:!0,flushSync:!1,currentLocation:Y.currentLocation,nextLocation:Y.nextLocation}))},[e.window,t,w,x,r,f,n]);v.useLayoutEffect(()=>e.subscribe(_),[e,_]),v.useEffect(()=>{g.isTransitioning&&!g.flushSync&&S(new hne)},[g]),v.useEffect(()=>{if(x&&h&&e.window){let P=h,$=x.promise,U=e.window.document.startViewTransition(async()=>{r===!1?c(P):v.startTransition(()=>{r===!0&&f(W=>y_(W,P)),c(P)}),await $});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 k=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:P=>e.navigate(P),push:(P,$,U)=>e.navigate(P,{state:$,preventScrollReset:U?.preventScrollReset}),replace:(P,$,U)=>e.navigate(P,{replace:!0,state:$,preventScrollReset:U?.preventScrollReset})}),[e]),L=e.basename||"/",D=v.useMemo(()=>({router:e,navigator:k,static:!1,basename:L,onError:n}),[e,k,L,n]);return v.createElement(v.Fragment,null,v.createElement(Ql.Provider,{value:D},v.createElement(Lf.Provider,{value:u},v.createElement(IN.Provider,{value:E.current},v.createElement(l1.Provider,{value:g},v.createElement(yne,{basename:L,location:u.location,navigationType:u.historyAction,navigator:k,unstable_useTransitions:r},v.createElement(mne,{routes:e.routes,future:e.future,state:u,onError:n})))))),null)}function y_(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 mne=v.memo(gne);function gne({routes:e,future:t,state:n,onError:r}){return BN(e,void 0,n,r,t)}function vne({to:e,replace:t,state:n,relative:r}){bt(Cu(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=v.useContext(yi);Vn(!o,"<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(Yi),{pathname:c}=ni(),u=Hn(),f=yg(e,vg(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 f1(e){return Yte(e.context)}function Fe(e){bt(!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 yne({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:s=!1,unstable_useTransitions:c}){bt(!Cu(),"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:o,static:s,unstable_useTransitions:c,future:{}}),[u,o,s,c]);typeof n=="string"&&(n=za(n));let{pathname:h="/",search:m="",hash:g="",state:y=null,key:x="default"}=n,S=v.useMemo(()=>{let w=Vi(h,u);return w==null?null:{location:{pathname:w,search:m,hash:g,state:y,key:x},navigationType:r}},[u,h,m,g,y,x,r]);return Vn(S!=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.`),S==null?null:v.createElement(yi.Provider,{value:f},v.createElement(If.Provider,{children:t,value:S}))}function xne({children:e,location:t}){return Kte(fb(e),t)}function fb(e,t=[]){let n=[];return v.Children.forEach(e,(r,o)=>{if(!v.isValidElement(r))return;let s=[...t,o];if(r.type===v.Fragment){n.push.apply(n,fb(r.props.children,s));return}bt(r.type===Fe,`[${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>`),bt(!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 Rp="get",_p="application/x-www-form-urlencoded";function xg(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bne(e){return xg(e)&&e.tagName.toLowerCase()==="button"}function Sne(e){return xg(e)&&e.tagName.toLowerCase()==="form"}function jne(e){return xg(e)&&e.tagName.toLowerCase()==="input"}function wne(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Cne(e,t){return e.button===0&&(!t||t==="_self")&&!wne(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(o=>[n,o]):[[n,r]])},[]))}function Ene(e,t){let n=hb(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(s=>{n.append(o,s)})}),n}var fp=null;function Tne(){if(fp===null)try{new FormData(document.createElement("form"),0),fp=!1}catch{fp=!0}return fp}var Rne=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function bx(e){return e!=null&&!Rne.has(e)?(Vn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_p}"`),null):e}function _ne(e,t){let n,r,o,s,c;if(Sne(e)){let u=e.getAttribute("action");r=u?Vi(u,t):null,n=e.getAttribute("method")||Rp,o=bx(e.getAttribute("enctype"))||_p,s=new FormData(e)}else if(bne(e)||jne(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?Vi(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Rp,o=bx(e.getAttribute("formenctype"))||bx(u.getAttribute("enctype"))||_p,s=new FormData(u,e),!Tne()){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(xg(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Rp,r=null,o=_p,c=e}return s&&o==="text/plain"&&(c=s,s=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:s,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function h1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Dne(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Vi(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function Ane(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 kne(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 Pne(e,t,n){let r=await Promise.all(e.map(async o=>{let s=t.routes[o.route.id];if(s){let c=await Ane(s,n);return c.links?c.links():[]}return[]}));return Lne(r.flat(1).filter(kne).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function x_(e,t,n,r,o,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(o.pathname+o.search+o.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 Nne(e,t,{includeHydrateFallback:n}={}){return One(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}function One(e){return[...new Set(e)]}function Mne(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Lne(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let s=JSON.stringify(Mne(o));return n.has(s)||(n.add(s),r.push({key:s,link:o})),r},[])}function HN(){let e=v.useContext(Ql);return h1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ine(){let e=v.useContext(Lf);return h1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var p1=v.createContext(void 0);p1.displayName="FrameworkContext";function qN(){let e=v.useContext(p1);return h1(e,"You must render this element inside a <HydratedRouter> element"),e}function zne(e,t){let n=v.useContext(p1),[r,o]=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=()=>{o(!0)},S=()=>{o(!1),c(!1)};return n?e!=="intent"?[s,y,{}]:[s,y,{onFocus:jd(u,x),onBlur:jd(f,S),onMouseEnter:jd(h,x),onMouseLeave:jd(m,S),onTouchStart:jd(g,x)}]:[!1,y,{}]}function jd(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $ne({page:e,...t}){let{router:n}=HN(),r=v.useMemo(()=>vs(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?v.createElement(Bne,{page:e,matches:r,...t}):null}function Une(e){let{manifest:t,routeModules:n}=qN(),[r,o]=v.useState([]);return v.useEffect(()=>{let s=!1;return Pne(e,t,n).then(c=>{s||o(c)}),()=>{s=!0}},[e,t,n]),r}function Bne({page:e,matches:t,...n}){let r=ni(),{future:o,manifest:s,routeModules:c}=qN(),{basename:u}=HN(),{loaderData:f,matches:h}=Ine(),m=v.useMemo(()=>x_(e,t,h,s,r,"data"),[e,t,h,s,r]),g=v.useMemo(()=>x_(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=Dne(e,u,o.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,o.unstable_trailingSlashAwareDataRequests,f,r,s,m,t,e,c]),x=v.useMemo(()=>Nne(g,s),[g,s]),S=Une(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 Vne(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Fne=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Fne&&(window.__reactRouterVersion="7.13.0")}catch{}function Hne(e,t){return mte({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:kee({window:t?.window}),hydrationData:qne(),routes:e,mapRouteProperties:dne,hydrationRouteProperties:fne,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function qne(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:Gne(e.errors)}),e}function Gne(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Of(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let s=window[o.__subType];if(typeof s=="function")try{let c=new s(o.message);c.stack="",n[r]=c}catch{}}if(n[r]==null){let s=new Error(o.message);s.stack="",n[r]=s}}else n[r]=o;return n}var GN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,WN=v.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:s,replace:c,state:u,target:f,to:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},S){let{basename:w,unstable_useTransitions:C}=v.useContext(yi),T=typeof h=="string"&&GN.test(h),R=CN(h,w);h=R.to;let E=Gte(h,{relative:o}),[_,k,L]=zne(r,x),D=Kne(h,{replace:c,state:u,target:f,preventScrollReset:m,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:C});function P(U){t&&t(U),U.defaultPrevented||D(U)}let $=v.createElement("a",{...x,...L,href:R.absoluteURL||E,onClick:R.isExternal||s?t:P,ref:Vne(S,k),target:f,"data-discover":!T&&n==="render"?"true":void 0});return _&&!T?v.createElement(v.Fragment,null,$,v.createElement($ne,{page:E})):$});WN.displayName="Link";var Wne=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:s,to:c,viewTransition:u,children:f,...h},m){let g=zf(c,{relative:h.relative}),y=ni(),x=v.useContext(Lf),{navigator:S,basename:w}=v.useContext(yi),C=x!=null&&tre(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=Vi(E,w)||E);const _=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let k=R===T||!o&&R.startsWith(T)&&R.charAt(_)==="/",L=E!=null&&(E===T||!o&&E.startsWith(T)&&E.charAt(T.length)==="/"),D={isActive:k,isPending:L,isTransitioning:C},P=k?t:void 0,$;typeof r=="function"?$=r(D):$=[r,k?"active":null,L?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let U=typeof s=="function"?s(D):s;return v.createElement(WN,{...h,"aria-current":P,className:$,ref:m,style:U,to:c,viewTransition:u},typeof f=="function"?f(D):f)});Wne.displayName="NavLink";var Qne=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:s,method:c=Rp,action:u,onSubmit:f,relative:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},S)=>{let{unstable_useTransitions:w}=v.useContext(yi),C=Zne(),T=ere(u,{relative:h}),R=c.toLowerCase()==="get"?"get":"post",E=typeof u=="string"&&GN.test(u),_=k=>{if(f&&f(k),k.defaultPrevented)return;k.preventDefault();let L=k.nativeEvent.submitter,D=L?.getAttribute("formmethod")||c,P=()=>C(L||k.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:o,state:s,relative:h,preventScrollReset:m,viewTransition:g,unstable_defaultShouldRevalidate:y});w&&n!==!1?v.startTransition(()=>P()):P()};return v.createElement("form",{ref:S,method:R,action:T,onSubmit:r?f:_,...x,"data-discover":!E&&e==="render"?"true":void 0})});Qne.displayName="Form";function Yne(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function QN(e){let t=v.useContext(Ql);return bt(t,Yne(e)),t}function Kne(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:s,viewTransition:c,unstable_defaultShouldRevalidate:u,unstable_useTransitions:f}={}){let h=Hn(),m=ni(),g=zf(e,{relative:s});return v.useCallback(y=>{if(Cne(y,t)){y.preventDefault();let x=n!==void 0?n:Go(m)===Go(g),S=()=>h(e,{replace:x,state:r,preventScrollReset:o,relative:s,viewTransition:c,unstable_defaultShouldRevalidate:u});f?v.startTransition(()=>S()):S()}},[m,h,g,n,r,t,e,o,s,c,u,f])}function bg(e){Vn(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=ni(),o=v.useMemo(()=>Ene(r.search,n.current?null:t.current),[r.search]),s=Hn(),c=v.useCallback((u,f)=>{const h=hb(typeof u=="function"?u(new URLSearchParams(o)):u);n.current=!0,s("?"+h,f)},[s,o]);return[o,c]}var Xne=0,Jne=()=>`__${String(++Xne)}__`;function Zne(){let{router:e}=QN("useSubmit"),{basename:t}=v.useContext(yi),n=one(),r=e.fetch,o=e.navigate;return v.useCallback(async(s,c={})=>{let{action:u,method:f,encType:h,formData:m,body:g}=_ne(s,t);if(c.navigate===!1){let y=c.fetcherKey||Jne();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 o(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,o,t,n])}function ere(e,{relative:t}={}){let{basename:n}=v.useContext(yi),r=v.useContext(Yi);bt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),s={...zf(e||".",{relative:t})},c=ni();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===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Bo([n,s.pathname])),Go(s)}function tre(e,{relative:t}={}){let n=v.useContext(l1);bt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=QN("useViewTransitionState"),o=zf(e,{relative:t});if(!n.isTransitioning)return!1;let s=Vi(n.currentLocation.pathname,r)||n.currentLocation.pathname,c=Vi(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tm(o.pathname,c)!=null||tm(o.pathname,s)!=null}function m1(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function nre(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 $s(e){return ws(e.getActiveLogin()?.project)}function YN(e){const t=Te(),n=$s(t),r=Hn(),o=[{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:o,fields:e.fields,count:100});return a.jsx(Wl,{search:s,onClick:u=>r(`/ProjectMembership/${u.resource.id}`),onChange:u=>c(u.definition),hideFilters:!0,hideToolbar:!0})}function rre(){return a.jsxs(a.Fragment,{children:[a.jsx($e,{children:"ProjectMemberships for Bots"}),a.jsx(YN,{resourceType:"Bot",fields:["user","profile","accessPolicy","userConfiguration","active","admin"]}),a.jsx(be,{justify:"flex-end",children:a.jsx(Ct,{to:"/admin/bots/new",children:"Create new bot"})})]})}function ire(){return a.jsxs(a.Fragment,{children:[a.jsx($e,{children:"ProjectMemberships for ClientApplications"}),a.jsx(YN,{resourceType:"ClientApplication",fields:["user","profile","accessPolicy","userConfiguration","active","admin"]}),a.jsx(be,{justify:"flex-end",children:a.jsx(Ct,{to:"/admin/clients/new",children:"Create new client"})})]})}function g1(e){return a.jsx(ju,{resourceType:"AccessPolicy",name:e.name,defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{La(t)?e.onChange(rn(t)):e.onChange(void 0)}})}function ore(){const e=Te(),t=$s(e),[n,r]=v.useState(""),[o,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($e,{children:"Create new Bot"}),a.jsxs(pt,{onSubmit:()=>{const y={name:n,description:o,accessPolicy:c};e.post("admin/projects/"+t+"/bot",y).then(x=>{e.invalidateSearches("Bot"),e.invalidateSearches("ProjectMembership"),g(x),_e({color:"green",message:"Bot created"})}).catch(x=>{_e({color:"red",message:qe(x),autoClose:!1}),h(on(x))})},children:[!m&&a.jsxs(Pe,{children:[a.jsx(Vt,{title:"Name",htmlFor:"name",outcome:f,children:a.jsx(He,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:y=>r(y.currentTarget.value),error:Bt(f,"name")})}),a.jsx(Vt,{title:"Description",htmlFor:"description",outcome:f,children:a.jsx(He,{id:"description",name:"description",onChange:y=>s(y.currentTarget.value),error:Bt(f,"description")})}),a.jsx(Vt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(g1,{name:"accessPolicy",onChange:u})}),a.jsx(be,{justify:"flex-end",children:a.jsx(Oe,{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(Ct,{to:m,children:"Go to new bot"})}),a.jsx(zr.Item,{children:a.jsx(Ct,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function are(){const e=Te(),t=$s(e),[n,r]=v.useState(""),[o,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($e,{children:"Create new Client"}),a.jsxs(pt,{onSubmit:()=>{const S={name:n,description:o,redirectUri:c,accessPolicy:f};e.post("admin/projects/"+t+"/client",S).then(w=>{e.invalidateSearches("ClientApplication"),e.invalidateSearches("ProjectMembership"),x(w),_e({color:"green",message:"Client created"})}).catch(w=>{_e({color:"red",message:qe(w),autoClose:!1}),g(on(w))})},children:[!y&&a.jsxs(Pe,{children:[a.jsx(Vt,{title:"Name",htmlFor:"name",outcome:m,children:a.jsx(He,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:S=>r(S.currentTarget.value),error:Bt(m,"name")})}),a.jsx(Vt,{title:"Description",htmlFor:"description",outcome:m,children:a.jsx(He,{id:"description",name:"description",onChange:S=>s(S.currentTarget.value),error:Bt(m,"description")})}),a.jsx(Vt,{title:"Redirect URI",htmlFor:"redirectUri",outcome:m,children:a.jsx(He,{id:"redirectUri",name:"redirectUri",onChange:S=>u(S.currentTarget.value),error:Bt(m,"redirectUri")})}),a.jsx(Vt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:m,children:a.jsx(g1,{name:"accessPolicy",onChange:h})}),a.jsx(be,{justify:"flex-end",children:a.jsx(Oe,{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(Ct,{to:y,children:"Go to new client"})}),a.jsx(zr.Item,{children:a.jsx(Ct,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}const sre=1e-10;function pb(e,t){let n=0,r=Math.exp(-t);for(let o=0;o<=e;o++)o>0&&(r*=t/o),n+=r;return n}function lre(e,t,n=sre){let r=0,o=Math.max(t+1,1);for(;pb(t,o)>e;)o*=2;for(;o-r>n;){const s=(r+o)/2;pb(t,s)>e?r=s:o=s}return o}function cre(e,t,n,r){const o=e*300,s=9*t*o/(e*10*1e3/7),c=Math.ceil(s),u=c/o,f=Math.max(r??0,u),h=r?f*o:c,m=h,g=pb(h-1,m),y=Math.log(1-n)/Math.log(g);return{rowsSampled:o,cutoffFrequencyExact:s,cutoffFrequency:c,minimumSelectivity:u,targetSelectivity:f,targetLambda:m,targetPoissonCdf:g,targetM:y,results:[{name:"Floor",result:b_(Math.floor(y),n,h,o)},{name:"Ceiling",result:b_(Math.ceil(y),n,h,o)}]}}function b_(e,t,n,r){const o=Math.pow(1-t,1/e),s=lre(o,n-1),c=s/r;return{m:e,poissonCdf:o,lambda:s,f:c}}function KN(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 Li({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:KN(t,n,r)})})]})}function ure({title:e,m:t,poissonCdf:n,lambda:r,f:o}){return a.jsxs(hr,{withBorder:!0,p:"md",children:[a.jsx($e,{order:4,mb:"sm",children:e}),a.jsxs(Pe,{gap:"xs",children:[a.jsx(Li,{label:"M (padding multiplier)",value:t}),a.jsx(Li,{label:"Poisson CDF",value:n}),a.jsx(Li,{label:"Lambda",value:r}),a.jsx(Li,{label:"F (selectivity)",value:o,format:"scientific"})]})]})}function dre(){const[e,t]=v.useState(1e3),[n,r]=v.useState(3),[o,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 o=="number"?o:void 0,y=typeof c=="number"?c:void 0;if(!(h===void 0||m===void 0||g===void 0))return cre(h,m,g,y)},[e,n,o,c]);return a.jsxs(Pe,{gap:"lg",children:[a.jsxs(hr,{withBorder:!0,p:"md",children:[a.jsx($e,{order:4,mb:"md",children:"Inputs"}),a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:{base:12,sm:6,md:3},children:a.jsx(ur,{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(ur,{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(ur,{label:"Confidence",value:o,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(ur,{label:"Target Selectivity (optional)",description:"Overrides minimum selectivity",value:c,onChange:u,min:0,max:1,step:1e-5,decimalScale:10,placeholder:f?KN(f.minimumSelectivity,"scientific"):""})})]})]}),f&&a.jsxs(a.Fragment,{children:[a.jsxs(hr,{withBorder:!0,p:"md",children:[a.jsx($e,{order:4,mb:"sm",children:"Intermediate Values"}),a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:{base:12,md:6},children:a.jsxs(Pe,{gap:"xs",children:[a.jsx(Li,{label:"Rows Sampled",value:f.rowsSampled}),a.jsx(Li,{label:"Cutoff Frequency (exact)",value:f.cutoffFrequencyExact}),a.jsx(Li,{label:"Cutoff Frequency",value:f.cutoffFrequency}),a.jsx(Li,{label:"Min Selectivity",value:f.minimumSelectivity,format:"scientific"})]})}),a.jsx(Nt.Col,{span:{base:12,md:6},children:a.jsxs(Pe,{gap:"xs",children:[a.jsx(Li,{label:"Target Selectivity",value:f.targetSelectivity,format:"scientific"}),a.jsx(Li,{label:"Target Lambda",value:f.targetLambda}),a.jsx(Li,{label:"Target Poisson CDF",value:f.targetPoissonCdf}),a.jsx(Li,{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(ure,{title:`${h} Option`,m:m.m,poissonCdf:m.poissonCdf,lambda:m.lambda,f:m.f})},h))})]})]})}const fre=8;function XN({inputProps:e,data:t,onChange:n}){const r=Bl({onDropdownClose:()=>r.resetSelectedOption()}),[o,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,fre));for(let g=0;g<m.length;g++){const y=f[g];m[g]=a.jsx(Qe.Option,{value:y,children:y},y)}return m},[f]);return a.jsxs(Qe,{store:r,withinPortal:!1,onOptionSubmit:m=>{n&&n(m),s(m),u(m),r.closeDropdown()},children:[a.jsx(Qe.Target,{children:a.jsx(Vr,{rightSection:a.jsx(Qe.Chevron,{}),value:c,onChange:m=>{r.openDropdown(),r.updateSelectedOptionIndex(),u(m.currentTarget.value)},onClick:()=>r.openDropdown(),onFocus:()=>r.openDropdown(),onBlur:()=>{r.closeDropdown(),u(o||"")},rightSectionPointerEvents:"none",...e})}),a.jsx(Qe.Dropdown,{children:a.jsx(Qe.Options,{children:h.length>0?h:a.jsx(Qe.Empty,{children:"Nothing found"})})})]})}function hre(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=ru(t),t}function JN(e){return typeof e=="string"?e.length>50?e.substring(0,50)+"...":e:typeof e=="boolean"?e.toString().toLocaleUpperCase():e}const ZN=({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(o=>{t(hre(o))}).catch(o=>{n?n(o):console.error(o)})},[e,t,n])};function pre(){const e=Te(),[t,{open:n,close:r}]=Ds(!1),[o,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),[_,k]=v.useState(void 0),[L,D]=v.useState([]),[P,$]=v.useState(0),[U,W]=v.useState(!1),[Y,ee]=v.useState(!1);ZN({medplum:e,onChange:D}),v.useEffect(()=>{x(!0),e.get("fhir/R4/$db-column-statistics?tableName="+encodeURIComponent(f??""),{cache:"no-cache"}).then(I=>{const z=I.parameter?.find(O=>O.name==="defaultStatisticsTarget")?.valueInteger??0;g(z);const K=I.parameter?.find(O=>O.name==="table")?.part?.filter(O=>O.name==="column");w(K??[])}).finally(()=>{x(!1)}).catch(I=>{_e({color:"red",message:I.message})})},[e,f,P]);function B(){if(f){if(C.length===0){_e({color:"red",message:"No columns selected",autoClose:!0});return}_e({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=>{_e({color:"green",message:"Done"}),$(z=>z+1)}).catch(I=>_e({color:"red",message:qe(I),autoClose:!1}))}}const G={onClick:I=>{s("Details"),u(a.jsx("pre",{children:I})),n()}};let M=0;return a.jsxs(pt,{onSubmit:B,children:[a.jsxs(Pe,{gap:"sm",children:[a.jsxs(be,{children:[a.jsx(XN,{data:L,inputProps:{placeholder:"Table name",inputSize:"50"},onChange:I=>{h(I),T([])}}),a.jsx(Oe,{loading:y,onClick:()=>$(I=>I+1),children:"Refresh"})]}),a.jsxs(be,{children:[a.jsx(ge,{span:!0,fw:700,children:"Statistics Target:"}),a.jsx(ur,{value:R?"":_,disabled:R,required:!R,size:"sm",w:"100",min:0,step:100,max:1e4,onChange:I=>{typeof I=="number"&&k(I)}}),a.jsx(ge,{span:!0,fw:700,c:"dimmed",children:"– or –"}),a.jsx(hn,{checked:R,onChange:I=>E(I.currentTarget.checked),label:"Reset to default ("+m+")",size:"sm"}),a.jsx(mr,{size:"sm",children:"Update"})]}),a.jsx(be,{children:a.jsx(hn,{checked:Y,onChange:I=>ee(I.currentTarget.checked),label:"Hide columns with default statistics target",size:"sm"})}),a.jsx(be,{children:a.jsx(hn,{checked:U,onChange:I=>W(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(hn,{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(z=>z.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 z=I.part??[],V=z.find(O=>O.name==="name")?.valueString,K=z.find(O=>O.name==="statisticsTarget")?.valueInteger;if(K===-1&&(M++,Y))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(hn,{size:"sm",checked:C.includes(V),onChange:O=>{T(O.currentTarget.checked?[...C,V]:C.filter(F=>F!==V))}})}),a.jsx(Z.Td,{children:V}),a.jsx(Z.Td,{children:K===-1?a.jsxs(ge,{span:!0,c:"dimmed",fs:"italic",children:["default (",m,")"]}):K}),a.jsx(Ro,{value:z.find(O=>O.name==="nullFraction")?.valueDecimal,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="avgWidth")?.valueInteger,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="nDistinct")?.valueDecimal,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="correlation")?.valueDecimal,...G}),U&&a.jsxs(a.Fragment,{children:[a.jsx(Ro,{value:z.find(O=>O.name==="mostCommonValues")?.valueString,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="mostCommonFreqs")?.valueString,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="histogramBounds")?.valueString,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="mostCommonElems")?.valueString,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="mostCommonElemFreqs")?.valueString,...G}),a.jsx(Ro,{value:z.find(O=>O.name==="elemCountHistogram")?.valueString,...G})]})]},V)}),Y&&a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:U?13:7,children:a.jsxs(ge,{c:"dimmed",fs:"italic",children:[M," hidden columns with default statistics target"]})})})]})]})})]}),a.jsx(Mn,{opened:t,onClose:r,title:o,centered:!0,size:"auto",children:c})]})}function Ro({value:e,onClick:t}){return a.jsx(Z.Td,{style:{cursor:"pointer"},onClick:()=>t?.(e),children:mre(e)})}function mre(e){return typeof e=="string"&&e.length>30?e.substring(0,30)+"...":e}function v1(e,t,n,r){const o=Date.now().toString();_e({id:o,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(Ct,{to:c,children:"View AsyncJob"}):c.resourceType==="OperationOutcome"&&c.issue?.[0]?.details?.text&&(u=a.jsx(ge,{children:c.issue[0].details.text})),Ii.update({id:o,color:"green",title:t,message:u,icon:a.jsx(Ko,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0}),c}).catch(c=>{throw Ii.update({id:o,color:"red",title:t,message:qe(c),icon:a.jsx(Ts,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0}),c})}function $c(e,t,n,r){v1(e,t,n,r).catch(()=>{})}const gre=8;function vre({pillInputProps:e,inputProps:t,data:n,onChange:r}){const o=Bl({onDropdownClose:()=>o.resetSelectedOption(),onDropdownOpen:()=>o.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(Ea,{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,gre));for(let w=0;w<S.length;w++){const C=y[w];S[w]=a.jsx(Qe.Option,{value:C,active:u.includes(C),children:a.jsxs(be,{gap:"sm",children:[u.includes(C)?a.jsx(hf,{size:12}):null,a.jsx("span",{children:C})]})},C)}return S},[y,u]);return a.jsxs(Qe,{store:o,onOptionSubmit:h,withinPortal:!1,children:[a.jsx(Qe.DropdownTarget,{children:a.jsx(js,{onClick:()=>o.openDropdown(),...e,children:a.jsxs(Ea.Group,{children:[g,a.jsx(Qe.EventsTarget,{children:a.jsx(js.Field,{onFocus:()=>o.openDropdown(),onBlur:()=>{o.closeDropdown(),c("")},value:s,onChange:S=>{o.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(Qe.Dropdown,{children:a.jsx(Qe.Options,{children:x.length>0?x:a.jsx(Qe.Empty,{children:"Nothing found..."})})})]})}function yre({defaultGinPendingListLimit:e,availableTables:t,onResponse:n}){const r=Te(),[o,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),v1(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(Pe,{gap:"sm",maw:"800",children:[a.jsx(cf,{label:"Table(s)",children:a.jsx(vre,{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(be,{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(be,{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(be,{children:[a.jsx(Rr,{size:"sm",value:"set",label:"Set to (kB)"}),a.jsx(ur,{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(be,{justify:"center",children:a.jsx(mr,{size:"sm",loading:o,children:"Update"})})]})})}function xre(){const e=Te(),[t,{open:n,close:r}]=Ds(!1),[o,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);ZN({medplum:e,onChange:T}),v.useEffect(()=>{x(!0),e.get("fhir/R4/$db-indexes?tableName="+encodeURIComponent(f??""),{cache:"no-cache"}).then(D=>{const P=D.parameter?.find(U=>U.name==="defaultGinPendingListLimit")?.valueInteger??0;g(P);const $=D.parameter?.filter(U=>U.name==="index");w($??[])}).finally(()=>{x(!1)}).catch(D=>{_e({color:"red",message:D.message})})},[e,f,R]);const _=D=>{s("Configure results"),u(a.jsx("pre",{children:JSON.stringify(D,null,2)})),n(),E(P=>(P+1)%100)},k={onClick:D=>{s("Details"),u(a.jsx("pre",{children:D})),n()}};let L;return y?L="Loading...":f?S?.length===0&&(L="No GIN indexes on this table"):L="Select a table",a.jsxs(a.Fragment,{children:[a.jsxs(Pe,{gap:"sm",children:[a.jsx("h2",{children:"Configure GIN indexes"}),a.jsx(be,{children:a.jsx(yre,{defaultGinPendingListLimit:m,availableTables:C,onResponse:_})}),a.jsx("h2",{children:"GIN index stats"}),a.jsxs(be,{children:[a.jsx(XN,{data:C,inputProps:{placeholder:"Table name",inputSize:"50"},onChange:D=>{h(D)}}),a.jsx(Oe,{loading:y,onClick:()=>E(D=>(D+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:[L&&a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:16,children:L})}),!L&&S?.map(D=>{const P=D.part??[],$=P.find(U=>U.name==="indexName")?.valueString;if(!$)throw new Error("Index missing name",{cause:D});return a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:P.find(U=>U.name==="schemaName")?.valueString}),a.jsx(Z.Td,{children:P.find(U=>U.name==="tableName")?.valueString}),a.jsx(Z.Td,{children:$}),a.jsx(Sx,{value:P.find(U=>U.name==="fastUpdate")?.valueBoolean,defaultValue:a.jsxs(ge,{span:!0,c:"dimmed",fs:"italic",children:["default (",JN(!0),")"]}),...k}),a.jsx(Sx,{value:P.find(U=>U.name==="ginPendingListLimit")?.valueInteger,defaultValue:a.jsxs(ge,{span:!0,c:"dimmed",fs:"italic",children:["default (",m,")"]}),...k}),a.jsx(Sx,{value:P.find(U=>U.name==="indexOptions")?.valueString,defaultValue:a.jsx(ge,{span:!0,c:"dimmed",fs:"italic",children:"NULL"}),...k})]},$)})]})]})})]}),a.jsx(Mn,{opened:t,onClose:r,title:o,centered:!0,size:"auto",children:c})]})}function Sx({value:e,onClick:t,defaultValue:n}){return a.jsx(Z.Td,{style:{cursor:"pointer"},onClick:()=>t?.(e),children:e===void 0?n:JN(e)})}const bre=[{label:"GIN Indexes",value:"gin-indexes"},{label:"Column Statistics",value:"column-statistics"},{label:"Array Column Padding",value:"array-padding"}];function S_(){const e=Te();return!e.isLoading()&&!e.isSuperAdmin()?a.jsx(gr,{outcome:wf}):a.jsx(ql,{maw:"100%",children:a.jsxs(Is,{children:[a.jsx($e,{order:1,children:"Database Tools"}),a.jsxs(Nf,{baseUrl:"/admin/super/db",tabs:bre,children:[a.jsx(bn.Panel,{value:"gin-indexes",pt:"md",children:a.jsx(xre,{})}),a.jsx(bn.Panel,{value:"column-statistics",pt:"md",children:a.jsx(pre,{})}),a.jsx(bn.Panel,{value:"array-padding",pt:"md",children:a.jsx(dre,{})})]})]})})}function Sre(){const e=Te(),[t,n]=v.useState(e.getProject()),[r,o]=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"),Cf(S)?c(S):m(S),f(x.sendEmail??!1),_e({color:"green",message:"Invite success"})}).catch(S=>{_e({color:"red",message:qe(S),autoClose:!1}),c(on(S))})},[e,t,r]);return a.jsxs(pt,{onSubmit:g,children:[!h&&!s&&a.jsxs(Pe,{children:[a.jsx($e,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(Vt,{title:"Project",htmlFor:"project",outcome:s,children:a.jsx(ju,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(mn,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:Bt(s,"resourceType")}),a.jsx(He,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:Bt(s,"firstName")}),a.jsx(He,{name:"lastName",label:"Last Name",required:!0,error:Bt(s,"lastName")}),a.jsx(He,{name:"email",type:"email",label:"Email",required:!0,error:Bt(s,"email")}),a.jsx(Vt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:s,children:a.jsx(g1,{name:"accessPolicy",onChange:o})}),a.jsx(hn,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(hn,{name:"isAdmin",label:"Admin"}),a.jsx(hn,{name:"isProjectScoped",label:"Project scoped"}),a.jsx(hn,{name:"mfaRequired",label:"MFA required"}),a.jsx(be,{justify:"flex-end",children:a.jsx(mr,{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(Ct,{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(Ct,{to:h,children:"Go to new membership"})}),a.jsx(zr.Item,{children:a.jsx(Ct,{to:h.profile,children:"Go to new profile"})}),a.jsx(zr.Item,{children:a.jsx(Ct,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function jre(){const e=Te();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(gr,{outcome:wf});function t(n){e.post("admin/projects/setpassword",n).then(()=>_e({color:"green",message:"Done"})).catch(r=>_e({color:"red",message:qe(r),autoClose:!1}))}return a.jsxs(ut,{width:600,children:[a.jsx($e,{order:1,children:"Project Admin"}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Pe,{children:[a.jsx(He,{name:"email",label:"Email",required:!0}),a.jsx(uo,{name:"password",label:"Password",required:!0}),a.jsx(Oe,{type:"submit",children:"Force Set Password"})]})})]})}function j_(){const e=Te(),t=$s(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx($e,{children:"Details"}),a.jsxs(kf,{children:[a.jsx(Ur,{term:"ID",children:n.project.id}),a.jsx(Ur,{term:"Name",children:n.project.name})]})]})}const wre=["Details","Users","Clients","Bots","Secrets","Sites"];function Cre(){const e=Te(),t=$s(e),n=v.useMemo(()=>e.get("admin/projects/"+t).read(),[e,t]);return a.jsxs(a.Fragment,{children:[a.jsxs(hr,{children:[a.jsx(xt,{children:a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Project"}),a.jsx(xt.Value,{children:n.project.name})]})}),a.jsx(Zr,{children:a.jsx(Nf,{baseUrl:"/admin",tabs:wre})})]}),a.jsx(ql,{maw:"100%",children:a.jsx(Is,{children:a.jsx(f1,{})})})]})}function Ere(){const e=Te(),t=$s(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=v.useState(!1),[s,c]=v.useState();return v.useEffect(()=>{e.requestSchema("Project").then(()=>o(!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(()=>_e({color:"green",message:"Saved"})).catch(console.log)},children:[a.jsx($e,{children:"Project Secrets"}),a.jsx("p",{children:"Use project secrets to store sensitive information such as API keys or other access credentials."}),a.jsx(Pf,{property:Ms("Project","secret"),name:"secret",path:"Project.secret",defaultValue:s,onChange:c,outcome:void 0}),a.jsx(Oe,{type:"submit",children:"Save"})]})}function Tre(){const e=Te(),t=$s(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=v.useState(!1),[s,c]=v.useState();return v.useEffect(()=>{e.requestSchema("Project").then(()=>o(!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(()=>_e({color:"green",message:"Saved"})).catch(f=>{const h=on(f);_e({color:"red",message:`Error ${h.issue?.[0].details?.text} ${h.issue?.[0].expression?.[0]}`,autoClose:!1})})},children:[a.jsx($e,{children:"Project Sites"}),a.jsx("p",{children:"Use project sites configure your project on a separate domain."}),a.jsx(Pf,{property:Ms("Project","site"),name:"site",path:"Project.site",defaultValue:s,onChange:c,outcome:void 0}),a.jsx(Oe,{type:"submit",children:"Save"})]})}const Rre=[{label:"Post-deploy Migrations",value:"migrations"},{label:"System AsyncJob",value:"asyncjob"}];function w_(){const e=Te();return!e.isLoading()&&!e.isSuperAdmin()?a.jsx(gr,{outcome:wf}):a.jsx(ql,{miw:"1600",maw:"2000",children:a.jsxs(Is,{children:[a.jsx($e,{order:1,children:"AsyncJob Dashboard"}),a.jsxs(Nf,{baseUrl:"/admin/super/asyncjob",tabs:Rre,keepMounted:!1,children:[a.jsx(bn.Panel,{value:"asyncjob",pt:"md",children:a.jsx(Dre,{})}),a.jsx(bn.Panel,{value:"migrations",pt:"md",children:a.jsx(kre,{})})]})]})})}const _re={resourceType:"AsyncJob",fields:["id","_lastUpdated","request","status","type"],filters:[{code:"_project",operator:fe.MISSING,value:"true"}],sortRules:[{code:"_lastUpdated",descending:!0}]};function Dre(){const e=Hn(),[t]=v.useState(_re);return a.jsxs(Pe,{children:[a.jsx(Ct,{to:`/${t.resourceType}/${bs(t)}`,children:"Show in search page"}),a.jsx(Wl,{checkboxesEnabled:!1,search:t,onClick:n=>e(C_(n.resource))?.catch(console.error),onAuxClick:n=>window.open(C_(n.resource),"_blank")})]})}const Are={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 kre(){const e=Te(),[t,n]=v.useState(),[r,o]=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=>{_e({color:"red",message:qe(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",bs({...Are,total:"accurate",fields:void 0}),{cache:"no-cache"}).then(C=>{o(C.entry?.map(T=>T.resource))})).catch(C=>{o(void 0),_e({color:"red",message:qe(C),autoClose:!1})}).finally(()=>m(C=>C.filter(T=>T!==w)))},[e,u]);function g(){f(w=>w+1)}function y(w){v1(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(Em,{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(Oe,{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}=Pre(w,r??[],t?.pendingPostDeployMigration),E=s.includes(w),_=w===t?.pendingPostDeployMigration&&(!T||T?.status==="error"),k=[a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:w}),a.jsx(Z.Td,{children:_&&a.jsx(Oe,{color:"green",size:"xs",onClick:()=>y(w),children:"Start"})}),a.jsx(Z.Td,{children:C}),a.jsx(Z.Td,{children:T&&a.jsx(Ct,{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:E_(T)}),a.jsx(Z.Td,{display:"flex",children:a.jsxs(be,{gap:"xs",children:[R.length?R.length:"",E&&R.length>1&&a.jsx(Oe,{leftSection:a.jsx(BG,{size:14}),variant:"subtle",color:"blue",size:"xs",radius:"xs",onClick:()=>c(L=>L.includes(w)?L.filter(D=>D!==w):L),children:"Hide all"}),!E&&R.length>1&&a.jsx(Oe,{leftSection:a.jsx(ZG,{size:14}),variant:"subtle",color:"blue",size:"xs",radius:"xs",onClick:()=>c(L=>L.includes(w)?L:[...L,w]),children:"Show all"})]})})]},w)];return E&&k.push(...R.filter(L=>L.id!==T?.id).map(L=>a.jsxs(Z.Tr,{bg:"gray.1",children:[a.jsx(Z.Td,{children:w}),a.jsx(Z.Td,{}),a.jsx(Z.Td,{children:L.status}),a.jsx(Z.Td,{children:a.jsx(Ct,{to:`/AsyncJob/${L.id}`,children:L.id})}),a.jsx(Z.Td,{children:L.meta?.lastUpdated}),a.jsx(Z.Td,{children:L.requestTime}),a.jsx(Z.Td,{children:E_(L)}),a.jsx(Z.Td,{})]},L.id))),k})},{isLoading:x})]})}function Pre(e,t,n){const r=t.filter(c=>c.dataVersion===e),o=r.find(c=>c.status==="completed")??r[0];let s;return n===0?s=o?.status??"completed":e>n?s=o?.status??"pending":e===n?s=o?.status??"next":s=o?.status??"completed",{status:s,asyncJob:o,asyncJobs:r}}function C_(e){return`/${e.resourceType}/${e.id}`}function E_(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 Nre(){const e=Te(),[t,n]=v.useState(),[r,o]=v.useState(!1),[s,{open:c,close:u}]=Ds(!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(){o(!0),e.get("fhir/R4/$get-ws-sub-stats").then(E=>{const _=E.parameter?.find(k=>k.name==="stats")?.valueString;if(_){const k=JSON.parse(_);n(k.projects)}c()}).catch(E=>_e({color:"red",message:qe(E),autoClose:!1})).finally(()=>o(!1))}function T(E){h(_=>{const k=new Set(_);return k.has(E)?k.delete(E):k.add(E),k})}function R(E,_){const k=`${E}:${_}`;y.has(E)||(w(L=>new Map(L).set(E,!0)),e.get(`fhir/R4/$get-ws-sub-project-stats?projectId=${encodeURIComponent(E)}`).then(L=>{const D=L.parameter?.find(P=>P.name==="stats")?.valueString;if(D){const P=JSON.parse(D);x($=>new Map($).set(E,P.resourceTypes))}}).catch(L=>_e({color:"red",message:qe(L),autoClose:!1})).finally(()=>w(L=>{const D=new Map(L);return D.delete(E),D}))),g(L=>{const D=new Set(L);return D.has(k)?D.delete(k):D.add(k),D})}return a.jsxs(a.Fragment,{children:[a.jsx(Oe,{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(be,{gap:"xs",children:[a.jsx(ge,{size:"xs",children:f.has(E.projectId)?"▼":"▶"}),a.jsx(Xd,{value:{reference:`Project/${E.projectId}`,display:E.projectName}})]})}),a.jsx(Z.Td,{children:E.subscriptionCount})]}),f.has(E.projectId)&&E.resourceTypes.map(_=>{const k=`${E.projectId}:${_.resourceType}`,D=y.get(E.projectId)?.find($=>$.resourceType===_.resourceType),P=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(be,{gap:"xs",pl:"md",children:[a.jsx(ge,{size:"xs",children:m.has(k)?"▼":"▶"}),a.jsx(ge,{children:_.resourceType})]})}),a.jsx(Z.Td,{children:_.count})]}),m.has(k)&&a.jsxs(a.Fragment,{children:[P&&!D&&a.jsx(Z.Tr,{children:a.jsx(Z.Td,{colSpan:2,children:a.jsx(ge,{pl:"xl",size:"sm",c:"dimmed",children:"Loading..."})})}),D?.criteria.map($=>a.jsxs(Z.Tr,{children:[a.jsx(Z.Td,{children:a.jsx(ge,{pl:"xl",size:"sm",c:"dimmed",children:$.criteria})}),a.jsx(Z.Td,{children:$.count})]},`${k}:${$.criteria}`))]})]},k)})]},E.projectId))})]})]})]})}function Ore(){const e=Te(),[t,{open:n,close:r}]=Ds(!1),[o,s]=v.useState(""),[c,u]=v.useState(),[f,h]=v.useState();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(gr,{outcome:wf});function m(){$c(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function g(){$c(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function y(){$c(e,"Rebuilding Value Sets","admin/super/valuesets")}function x(D){$c(e,"Reindexing Resources","admin/super/reindex",D)}function S(){$c(e,"Reload Cron Resources","admin/super/reloadcron")}function w(){r();const D=ws(f);e.post("fhir/R4/$clear-all-ws-subs",D?{resourceType:"Parameters",parameter:[{name:"projectId",valueString:D}]}:void 0).then(()=>_e({color:"green",message:"Done"})).catch(P=>_e({color:"red",message:qe(P),autoClose:!1})),h(void 0)}function C(D){e.post("admin/super/removebotidjobsfromqueue",D).then(()=>_e({color:"green",message:"Done"})).catch(P=>_e({color:"red",message:qe(P),autoClose:!1}))}function T(D){e.post("admin/super/purge",{...D,before:GS(D.before)}).then(()=>_e({color:"green",message:"Done"})).catch(P=>_e({color:"red",message:qe(P),autoClose:!1}))}function R(D){e.post("admin/super/setpassword",D).then(()=>_e({color:"green",message:"Done"})).catch(P=>_e({color:"red",message:qe(P),autoClose:!1}))}function E(D){e.post("fhir/R4/$db-stats",D.tableNames?{resourceType:"Parameters",parameter:[{name:"tableNames",valueString:D.tableNames}]}:void 0).then(P=>{s("Database Stats"),u(a.jsx("pre",{children:P.parameter?.find($=>$.name==="tableString")?.valueString})),n()}).catch(P=>_e({color:"red",message:qe(P),autoClose:!1}))}function _(){e.post("fhir/R4/$db-invalid-indexes").then(D=>{s("Database Invalid Indexes"),u(a.jsx("pre",{children:D.parameter?.filter(P=>P.name==="invalidIndex").map(P=>P.valueString).join(`
218
+ `)})),n()}).catch(D=>_e({color:"red",message:qe(D),autoClose:!1}))}function k(){e.post("fhir/R4/$db-schema-diff").then(D=>{s("Schema Diff"),u(a.jsx("pre",{children:D.parameter?.find(P=>P.name==="migrationString")?.valueString})),n()}).catch(D=>_e({color:"red",message:qe(D),autoClose:!1}))}function L(){$c(e,"Reconcile Schema Diff","admin/super/reconcile-db-schema-drift")}return a.jsxs(ut,{width:600,children:[a.jsx($e,{order:1,children:"Super Admin"}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Oe,{onClick:m,children:"Rebuild StructureDefinitions"})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Oe,{onClick:g,children:"Rebuild SearchParameters"})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Oe,{onClick:y,children:"Rebuild ValueSets"})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Lre,{onSubmit:x}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Pe,{children:[a.jsx(Vt,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(mn,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(Vt,{title:"Purge Before",htmlFor:"before",children:a.jsx(Uo,{name:"before",placeholder:"Before Date"})}),a.jsx(Oe,{type:"submit",children:"Purge"})]})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Pe,{children:[a.jsx(Vt,{title:"Bot ID",children:a.jsx(He,{name:"botId",placeholder:"Bot Id"})}),a.jsx(Oe,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Pe,{children:[a.jsx(He,{name:"email",label:"Email",required:!0}),a.jsx(uo,{name:"password",label:"Password",required:!0}),a.jsx(He,{name:"projectId",label:"Project ID"}),a.jsx(Oe,{type:"submit",children:"Force Set Password"})]})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{order:2,children:"Database Stats"}),a.jsx("p",{children:"Query current table statistics from the database."}),a.jsx(pt,{onSubmit:E,children:a.jsxs(Pe,{children:[a.jsx(Vt,{title:"Table Names (comma-delimited)",htmlFor:"tableNames",children:a.jsx(He,{id:"tableNames",name:"tableNames",placeholder:"Observation,Observation_History"})}),a.jsx(Oe,{type:"submit",children:"Get Database Stats"})]})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{order:2,children:"Database Invalid Indexes"}),a.jsx("p",{children:"Query invalid indexes from the database."}),a.jsx(pt,{onSubmit:_,children:a.jsx(Pe,{children:a.jsx(Oe,{type:"submit",children:"Get Database Invalid Indexes"})})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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:k,children:a.jsx(Pe,{children:a.jsx(Oe,{type:"submit",children:"Get Schema Drift"})})})}),a.jsx(Nt.Col,{span:6,children:a.jsx(pt,{onSubmit:L,children:a.jsx(Pe,{children:a.jsx(Oe,{type:"submit",children:"Reconcile Schema Drift"})})})})]}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Pe,{children:a.jsx(Oe,{type:"submit",children:"Reload Cron Resources"})})}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Ire,{setModalTitle:s,setModalContent:u,openModal:n}),a.jsx(fn,{my:"lg"}),a.jsx($e,{order:2,children:"WebSocket Subscription Stats"}),a.jsx("p",{children:"View active WebSocket subscription statistics by project, resource type, and criteria."}),a.jsx(Nre,{}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Pe,{children:[a.jsx(Vt,{title:"Project (optional)",htmlFor:"clearWsSubsProject",children:a.jsx(ja,{name:"clearWsSubsProject",placeholder:"All projects",targetTypes:["Project"],onChange:h})}),a.jsx("div",{children:a.jsx(Oe,{onClick:()=>{s("Clear All WebSocket Subscriptions"),u(a.jsxs(Pe,{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(be,{align:"center",children:a.jsx(Oe,{color:"red",onClick:w,children:"Clear"})})]})),n()},children:"Clear All WebSocket Subscriptions"})})]}),a.jsx(Mn,{opened:t,onClose:r,title:o,centered:!0,size:"auto",children:c})]})}function Mre(){const[e,t]=v.useState("outdated");return a.jsxs(a.Fragment,{children:[a.jsx(mn,{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(ur,{required:!0,name:"maxResourceVersion",placeholder:"Max Resource Version",min:0})]})}function Lre({onSubmit:e}){const[t,n]=v.useState(!1);function r(o){const s={};for(const[c,u]of Object.entries(o))u!==""&&(s[c]=u);e(s)}return a.jsx(pt,{onSubmit:r,children:a.jsxs(Pe,{children:[a.jsx(Vt,{title:"Resource Type",htmlFor:"resourceType",children:a.jsx(He,{id:"resourceType",name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(Vt,{title:"Search Filter",htmlFor:"filter",children:a.jsx(He,{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(Mre,{})}),a.jsx(Oe,{variant:"subtle",size:"xs",onClick:()=>n(!t),children:t?"Hide Advanced Options":"Show Advanced Options"}),t&&a.jsx(Pe,{gap:"sm",children:a.jsxs(Nt,{children:[a.jsx(Nt.Col,{span:6,children:a.jsx(ur,{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(ur,{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(ur,{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(ur,{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(ur,{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(ur,{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(ur,{name:"maxIterationAttempts",label:"Max iteration attempts",description:a.jsx("span",{children:"default: 3"}),placeholder:"3",min:1,max:20})})]})}),a.jsx(Oe,{type:"submit",children:"Reindex"})]})})}function Ire({setModalTitle:e,setModalContent:t,openModal:n}){const r=Te(),[o,s]=v.useState(),[c,u]=v.useState(),[f,h]=v.useState(),[m,g]=v.useState(),y=v.useMemo(()=>{if(o?.reference)return{"_has:ProjectMembership:profile:project":o.reference}},[o]);v.useEffect(()=>{if(g(void 0),!c?.reference&&!o?.reference){h(void 0);return}r.searchResources("ProjectMembership",{profile:c?.reference,project:o?.reference,_count:20}).then(w=>{h(w),w.length===1&&g(rn(w[0]))}).catch(w=>{console.error(w),_e({color:"red",message:qe(w),autoClose:!1})})},[r,c,o]);const x=v.useMemo(()=>{const w={};return c?.reference&&(w.profile=c?.reference),o?.reference&&(w.project=o?.reference),w},[c,o]);function S(w){if(!w.query){_e({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,k=E.parameter?.find(U=>U.name==="query")?.valueString,L=E.parameter?.find(U=>U.name==="parameters")?.valueString,D=E.parameter?.find(U=>U.name==="countEstimate")?.valueInteger?.toLocaleString(),P=E.parameter?.find(U=>U.name==="countAccurate")?.valueInteger?.toLocaleString(),$=[k,L,`
219
+ `,_].join(`
220
+ `);t(a.jsxs(Pe,{children:[a.jsxs("div",{children:[a.jsx(ge,{fw:700,children:"Query"}),a.jsx(pf,{block:!0,maw:"100%",style:{whiteSpace:"pre-wrap"},children:$})]}),(D||P)&&a.jsxs("div",{children:[a.jsx(ge,{fw:700,children:"Counts"}),D&&a.jsxs(ge,{children:["Estimate: ",D]}),P&&a.jsxs(ge,{children:["Accurate: ",P]})]})]})),n()}).catch(E=>{_e({color:"red",message:qe(E),autoClose:!1})})}return!r.isLoading()&&!r.isSuperAdmin()?a.jsx(gr,{outcome:wf}):a.jsx(pt,{onSubmit:S,children:a.jsxs(Pe,{children:[a.jsx(He,{name:"query",label:"Search",required:!0,placeholder:"Observation?code=85354-9&_sort=-date&_count=5"}),a.jsxs(be,{children:[a.jsx(hn,{name:"analyze",label:"Analyze"}),a.jsx(hn,{name:"count",label:"Total count"})]}),a.jsx(cf,{label:"On Behalf Of",children:a.jsxs(Pe,{gap:"sm",children:[a.jsx(ja,{required:!0,placeholder:"Project",targetTypes:["Project"],name:"onBehalfOfProject",onChange:s}),a.jsx(ja,{required:!0,placeholder:"Practitioner or Patient",name:"onBehalfOfProfile",targetTypes:["Practitioner","Patient"],onChange:u,searchCriteria:y}),f?.length!==1&&a.jsx(ja,{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:Ut(f[0])}),a.jsx(Xd,{value:rn(f[0])})]}),!m&&a.jsx(ge,{fs:"italic",children:"On Behalf Of not set. Running as super admin"})]})}),a.jsx(Oe,{type:"submit",children:"Explain Search"})]})})}const zre=[{label:"All",value:"Patient,Practitioner,RelatedPerson"},{label:"Practitioner",value:"Practitioner"},{label:"Patient",value:"Patient"},{label:"RelatedPerson",value:"RelatedPerson"}];function $re(e){const t=Te(),n=$s(t),r=Hn(),[o,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:o}],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(be,{justify:"space-between",align:"center",mb:"md",wrap:"nowrap",children:[a.jsxs(be,{gap:"md",wrap:"nowrap",children:[a.jsx(Tl,{value:o,onChange:f,data:zre}),e.toolbarLeft]}),e.toolbarRight]}),a.jsx(Wl,{search:c,onClick:h=>r(`/ProjectMembership/${h.resource.id}`),onChange:h=>u(h.definition),hideFilters:!0,hideToolbar:!0})]})}function Ure(){return a.jsxs(a.Fragment,{children:[a.jsx($e,{children:"ProjectMemberships by User and Profile Type"}),a.jsx($re,{fields:["user","profile","profile-type","accessPolicy","userConfiguration","active","admin"],toolbarLeft:a.jsx(Oe,{component:Ct,to:"/admin/invite",variant:"outline",color:"blue",leftSection:a.jsx(TW,{size:14}),children:"Invite New User"}),toolbarRight:a.jsx(Tt,{href:"https://www.medplum.com/docs/user-management",target:"_blank",rel:"noopener noreferrer",size:"sm",children:"Learn more about roles and user management"})})]})}const Bre=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 su(e,t,n){const r=Vre(e),{webkitRelativePath:o}=e,s=typeof t=="string"?t:typeof o=="string"&&o.length>0?o:`./${e.name}`;return typeof r.path!="string"&&T_(r,"path",s),T_(r,"relativePath",s),r}function Vre(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),o=Bre.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}function T_(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const Fre=[".DS_Store","Thumbs.db"];function Hre(e){return Ml(this,void 0,void 0,function*(){return nm(e)&&qre(e.dataTransfer)?Yre(e.dataTransfer,e.type):Gre(e)?Wre(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?Qre(e):[]})}function qre(e){return nm(e)}function Gre(e){return nm(e)&&nm(e.target)}function nm(e){return typeof e=="object"&&e!==null}function Wre(e){return mb(e.target.files).map(t=>su(t))}function Qre(e){return Ml(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>su(n))})}function Yre(e,t){return Ml(this,void 0,void 0,function*(){if(e.items){const n=mb(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(Kre));return R_(eO(r))}return R_(mb(e.files).map(n=>su(n)))})}function R_(e){return e.filter(t=>Fre.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 Kre(e){if(typeof e.webkitGetAsEntry!="function")return __(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?tO(t):__(e,t)}function eO(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?eO(n):[n]],[])}function __(e,t){return Ml(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,su(c)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return su(r,(n=t?.fullPath)!==null&&n!==void 0?n:void 0)})}function Xre(e){return Ml(this,void 0,void 0,function*(){return e.isDirectory?tO(e):Jre(e)})}function tO(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function s(){t.readEntries(c=>Ml(this,void 0,void 0,function*(){if(c.length){const u=Promise.all(c.map(Xre));o.push(u),s()}else try{const u=yield Promise.all(o);n(u)}catch(u){r(u)}}),c=>{r(c)})}s()})}function Jre(e){return Ml(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const o=su(r,e.fullPath);t(o)},r=>{n(r)})})})}var hp={},D_;function Zre(){return D_||(D_=1,hp.__esModule=!0,hp.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||"",o=(e.type||"").toLowerCase(),s=o.replace(/\/.*$/,"");return n.some(function(c){var u=c.trim().toLowerCase();return u.charAt(0)==="."?r.toLowerCase().endsWith(u):u.endsWith("/*")?s===u.replace(/\/.*$/,""):o===u})}return!0}),hp}var eie=Zre();const jx=om(eie);function A_(e){return rie(e)||nie(e)||rO(e)||tie()}function tie(){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 nie(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rie(e){if(Array.isArray(e))return gb(e)}function k_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function P_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k_(Object(n),!0).forEach(function(r){nO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tf(e,t){return aie(e)||oie(e,t)||rO(e,t)||iie()}function iie(){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 rO(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 oie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,s=!1,c,u;try{for(n=n.call(e);!(o=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));o=!0);}catch(f){s=!0,u=f}finally{try{!o&&n.return!=null&&n.return()}finally{if(s)throw u}}return r}}function aie(e){if(Array.isArray(e))return e}var sie=typeof jx=="function"?jx:jx.default,lie="file-invalid-type",cie="file-too-large",uie="file-too-small",die="too-many-files",fie=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:lie,message:"File type must be ".concat(r)}},N_=function(t){return{code:cie,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},O_=function(t){return{code:uie,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},hie={code:die,message:"Too many files"};function pie(e){return e.type===""&&typeof e.getAsFile=="function"}function iO(e,t){var n=e.type==="application/x-moz-file"||sie(e,t)||pie(e);return[n,n?null:fie(t)]}function oO(e,t,n){if(hl(e.size))if(hl(t)&&hl(n)){if(e.size>n)return[!1,N_(n)];if(e.size<t)return[!1,O_(t)]}else{if(hl(t)&&e.size<t)return[!1,O_(t)];if(hl(n)&&e.size>n)return[!1,N_(n)]}return[!0,null]}function hl(e){return e!=null}function mie(e){var t=e.files,n=e.accept,r=e.minSize,o=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=iO(f,n),m=tf(h,1),g=m[0],y=oO(f,r,o),x=tf(y,1),S=x[0],w=u?u(f):null;return g&&S&&!w})}function rm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function wd(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 M_(e){e.preventDefault()}function gie(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function vie(e){return e.indexOf("Edge/")!==-1}function yie(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return gie(e)||vie(e)}function _o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,s=new Array(o>1?o-1:0),c=1;c<o;c++)s[c-1]=arguments[c];return t.some(function(u){return!rm(r)&&u&&u.apply(void 0,[r].concat(s)),rm(r)})}}function xie(){return"showOpenFilePicker"in window}function bie(e){if(hl(e)){var t=Object.entries(e).filter(function(n){var r=tf(n,2),o=r[0],s=r[1],c=!0;return aO(o)||(console.warn('Skipped "'.concat(o,'" 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(sO))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),c=!1),c}).reduce(function(n,r){var o=tf(r,2),s=o[0],c=o[1];return P_(P_({},n),{},nO({},s,c))},{});return[{description:"Files",accept:t}]}return e}function Sie(e){if(hl(e))return Object.entries(e).reduce(function(t,n){var r=tf(n,2),o=r[0],s=r[1];return[].concat(A_(t),[o],A_(s))},[]).filter(function(t){return aO(t)||sO(t)}).join(",")}function jie(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function wie(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function aO(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function sO(e){return/^.*\.[\w]+$/.test(e)}var Cie=["children"],Eie=["open"],Tie=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Rie=["refKey","onChange","onClick"];function L_(e){return Aie(e)||Die(e)||lO(e)||_ie()}function _ie(){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 Die(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Aie(e){if(Array.isArray(e))return vb(e)}function wx(e,t){return Nie(e)||Pie(e,t)||lO(e,t)||kie()}function kie(){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 lO(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 Pie(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,s=!1,c,u;try{for(n=n.call(e);!(o=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));o=!0);}catch(f){s=!0,u=f}finally{try{!o&&n.return!=null&&n.return()}finally{if(s)throw u}}return r}}function Nie(e){if(Array.isArray(e))return e}function I_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Tn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?I_(Object(n),!0).forEach(function(r){yb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I_(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 im(e,t){if(e==null)return{};var n=Oie(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Oie(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var y1=v.forwardRef(function(e,t){var n=e.children,r=im(e,Cie),o=uO(r),s=o.open,c=im(o,Eie);return v.useImperativeHandle(t,function(){return{open:s}},[s]),In.createElement(v.Fragment,null,n(Tn(Tn({},c),{},{open:s})))});y1.displayName="Dropzone";var cO={disabled:!1,getFilesFromEvent:Hre,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};y1.defaultProps=cO;y1.propTypes={children:dn.func,accept:dn.objectOf(dn.arrayOf(dn.string)),multiple:dn.bool,preventDropOnDocument:dn.bool,noClick:dn.bool,noKeyboard:dn.bool,noDrag:dn.bool,noDragEventsBubbling:dn.bool,minSize:dn.number,maxSize:dn.number,maxFiles:dn.number,disabled:dn.bool,getFilesFromEvent:dn.func,onFileDialogCancel:dn.func,onFileDialogOpen:dn.func,useFsAccessApi:dn.bool,autoFocus:dn.bool,onDragEnter:dn.func,onDragLeave:dn.func,onDragOver:dn.func,onDrop:dn.func,onDropAccepted:dn.func,onDropRejected:dn.func,onError:dn.func,validator:dn.func};var xb={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function uO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Tn(Tn({},cO),e),n=t.accept,r=t.disabled,o=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,k=t.noKeyboard,L=t.noDrag,D=t.noDragEventsBubbling,P=t.onError,$=t.validator,U=v.useMemo(function(){return Sie(n)},[n]),W=v.useMemo(function(){return bie(n)},[n]),Y=v.useMemo(function(){return typeof C=="function"?C:z_},[C]),ee=v.useMemo(function(){return typeof w=="function"?w:z_},[w]),B=v.useRef(null),G=v.useRef(null),M=v.useReducer(Mie,xb),I=wx(M,2),z=I[0],V=I[1],K=z.isFocused,O=z.isFileDialogActive,F=v.useRef(typeof window<"u"&&window.isSecureContext&&T&&xie()),se=function(){!F.current&&O&&setTimeout(function(){if(G.current){var he=G.current.files;he.length||(V({type:"closeDialog"}),ee())}},300)};v.useEffect(function(){return window.addEventListener("focus",se,!1),function(){window.removeEventListener("focus",se,!1)}},[G,O,ee,F]);var de=v.useRef([]),xe=v.useRef([]),Ce=function(he){B.current&&B.current.contains(he.target)||(he.preventDefault(),de.current=[])};v.useEffect(function(){return E&&(document.addEventListener("dragover",M_,!1),document.addEventListener("drop",Ce,!1)),function(){E&&(document.removeEventListener("dragover",M_),document.removeEventListener("drop",Ce))}},[B,E]),v.useEffect(function(){var Ee=function(Kt){xe.current=[].concat(L_(xe.current),[Kt.target]),wd(Kt)&&V({isDragGlobal:!0,type:"setDragGlobal"})},he=function(Kt){xe.current=xe.current.filter(function(yn){return yn!==Kt.target&&yn!==null}),!(xe.current.length>0)&&V({isDragGlobal:!1,type:"setDragGlobal"})},ke=function(){xe.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})},vt=function(){xe.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",vt,!1),function(){document.removeEventListener("dragenter",Ee),document.removeEventListener("dragleave",he),document.removeEventListener("dragend",ke),document.removeEventListener("drop",vt)}},[B]),v.useEffect(function(){return!r&&R&&B.current&&B.current.focus(),function(){}},[B,R,r]);var we=v.useCallback(function(Ee){P?P(Ee):console.error(Ee)},[P]),Ye=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),it(Ee),de.current=[].concat(L_(de.current),[Ee.target]),wd(Ee)&&Promise.resolve(o(Ee)).then(function(he){if(!(rm(Ee)&&!D)){var ke=he.length,vt=ke>0&&mie({files:he,accept:U,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:$}),_t=ke>0&&!vt;V({isDragAccept:vt,isDragReject:_t,isDragActive:!0,type:"setDraggedFiles"}),h&&h(Ee)}}).catch(function(he){return we(he)})},[o,h,we,D,U,c,s,u,f,$]),De=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),it(Ee);var he=wd(Ee);if(he&&Ee.dataTransfer)try{Ee.dataTransfer.dropEffect="copy"}catch{}return he&&g&&g(Ee),!1},[g,D]),ht=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),it(Ee);var he=de.current.filter(function(vt){return B.current&&B.current.contains(vt)}),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}),wd(Ee)&&m&&m(Ee))},[B,m,D]),Rt=v.useCallback(function(Ee,he){var ke=[],vt=[];Ee.forEach(function(_t){var Kt=iO(_t,U),yn=wx(Kt,2),an=yn[0],Cr=yn[1],Jt=oO(_t,c,s),sr=wx(Jt,2),$n=sr[0],xi=sr[1],Xo=$?$(_t):null;if(an&&$n&&!Xo)ke.push(_t);else{var xo=[Cr,xi];Xo&&(xo=xo.concat(Xo)),vt.push({file:_t,errors:xo.filter(function(ri){return ri})})}}),(!u&&ke.length>1||u&&f>=1&&ke.length>f)&&(ke.forEach(function(_t){vt.push({file:_t,errors:[hie]})}),ke.splice(0)),V({acceptedFiles:ke,fileRejections:vt,type:"setFiles"}),y&&y(ke,vt,he),vt.length>0&&S&&S(vt,he),ke.length>0&&x&&x(ke,he)},[V,u,U,c,s,f,y,x,S,$]),at=v.useCallback(function(Ee){Ee.preventDefault(),Ee.persist(),it(Ee),de.current=[],wd(Ee)&&Promise.resolve(o(Ee)).then(function(he){rm(Ee)&&!D||Rt(he,Ee)}).catch(function(he){return we(he)}),V({type:"reset"})},[o,Rt,we,D]),Ze=v.useCallback(function(){if(F.current){V({type:"openDialog"}),Y();var Ee={multiple:u,types:W};window.showOpenFilePicker(Ee).then(function(he){return o(he)}).then(function(he){Rt(he,null),V({type:"closeDialog"})}).catch(function(he){jie(he)?(ee(he),V({type:"closeDialog"})):wie(he)?(F.current=!1,G.current?(G.current.value=null,G.current.click()):we(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."))):we(he)});return}G.current&&(V({type:"openDialog"}),Y(),G.current.value=null,G.current.click())},[V,Y,ee,T,Rt,we,W,u]),mt=v.useCallback(function(Ee){!B.current||!B.current.isEqualNode(Ee.target)||(Ee.key===" "||Ee.key==="Enter"||Ee.keyCode===32||Ee.keyCode===13)&&(Ee.preventDefault(),Ze())},[B,Ze]),Dt=v.useCallback(function(){V({type:"focus"})},[]),jt=v.useCallback(function(){V({type:"blur"})},[]),Ae=v.useCallback(function(){_||(yie()?setTimeout(Ze,0):Ze())},[_,Ze]),Ne=function(he){return r?null:he},Me=function(he){return k?null:Ne(he)},Ie=function(he){return L?null:Ne(he)},it=function(he){D&&he.stopPropagation()},et=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,vt=Ee.role,_t=Ee.onKeyDown,Kt=Ee.onFocus,yn=Ee.onBlur,an=Ee.onClick,Cr=Ee.onDragEnter,Jt=Ee.onDragOver,sr=Ee.onDragLeave,$n=Ee.onDrop,xi=im(Ee,Tie);return Tn(Tn(yb({onKeyDown:Me(_o(_t,mt)),onFocus:Me(_o(Kt,Dt)),onBlur:Me(_o(yn,jt)),onClick:Ne(_o(an,Ae)),onDragEnter:Ie(_o(Cr,Ye)),onDragOver:Ie(_o(Jt,De)),onDragLeave:Ie(_o(sr,ht)),onDrop:Ie(_o($n,at)),role:typeof vt=="string"&&vt!==""?vt:"presentation"},ke,B),!r&&!k?{tabIndex:0}:{}),xi)}},[B,mt,Dt,jt,Ae,Ye,De,ht,at,k,L,r]),ft=v.useCallback(function(Ee){Ee.stopPropagation()},[]),lt=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,vt=Ee.onChange,_t=Ee.onClick,Kt=im(Ee,Rie),yn=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:Ne(_o(vt,at)),onClick:Ne(_o(_t,ft)),tabIndex:-1},ke,G);return Tn(Tn({},yn),Kt)}},[G,n,u,at,r]);return Tn(Tn({},z),{},{isFocused:K&&!r,getRootProps:et,getInputProps:lt,rootRef:B,inputRef:G,open:Ne(Ze)})}function Mie(e,t){switch(t.type){case"focus":return Tn(Tn({},e),{},{isFocused:!0});case"blur":return Tn(Tn({},e),{},{isFocused:!1});case"openDialog":return Tn(Tn({},xb),{},{isFileDialogActive:!0});case"closeDialog":return Tn(Tn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Tn(Tn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Tn(Tn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return Tn(Tn({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return Tn({},xb);default:return e}}function z_(){}const[Lie,Iie]=Or("Dropzone component was not found in tree");var nf={root:"m_d46a4834",inner:"m_b85f7144",fullScreen:"m_96f6e9ad",dropzone:"m_7946116d"};function x1(e){const t=n=>{const{children:r,...o}=oe(`Dropzone${yE(e)}`,{},n),s=Iie(),c=sm(r)?r:a.jsx("span",{children:r});return s[e]?v.cloneElement(c,o):null};return t.displayName=`@mantine/dropzone/${yE(e)}`,t}const zie=x1("accept"),$ie=x1("reject"),Uie=x1("idle"),Bie={multiple:!0,maxSize:1/0,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},Vie=(e,{radius:t,variant:n,acceptColor:r,rejectColor:o})=>{const s=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),c=e.variantColorResolver({color:o||"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}}},Us=ve((e,t)=>{const n=oe("Dropzone",Bie,e),{classNames:r,className:o,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:k,autoFocus:L,activateOnClick:D,activateOnDrag:P,dragEventsBubbling:$,activateOnKeyboard:U,onDragEnter:W,onDragLeave:Y,onDragOver:ee,onFileDialogCancel:B,onFileDialogOpen:G,preventDropOnDocument:M,useFsAccessApi:I,getFilesFromEvent:z,validator:V,rejectColor:K,acceptColor:O,enablePointerEvents:F,loaderProps:se,inputProps:de,mod:xe,attributes:Ce,...we}=n,Ye=Ue({name:"Dropzone",classes:nf,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:Ce,vars:f,varsResolver:Vie}),{getRootProps:De,getInputProps:ht,isDragAccept:Rt,isDragReject:at,isDragActive:Ze,open:mt}=uO({onDrop:C,onDropAccepted:T,onDropRejected:R,disabled:m||g,accept:Array.isArray(S)?S.reduce((Ne,Me)=>({...Ne,[Me]:[]}),{}):S,multiple:y,maxSize:x,maxFiles:k,autoFocus:L,noClick:!D,noDrag:!P,noDragEventsBubbling:!$,noKeyboard:!U,onDragEnter:W,onDragLeave:Y,onDragOver:ee,onFileDialogCancel:B,onFileDialogOpen:G,preventDropOnDocument:M,useFsAccessApi:I,validator:V,...z?{getFilesFromEvent:z}:null});Md(E,mt);const Dt=Ze&&Rt,jt=Ze&&at,Ae=!Dt&&!jt;return a.jsx(Lie,{value:{accept:Dt,reject:jt,idle:Ae},children:a.jsxs(le,{...De(),...Ye("root",{focusable:!0}),...we,mod:[{accept:Dt,reject:jt,idle:Ae,disabled:m,loading:g,"activate-on-click":D},xe],children:[a.jsx(Em,{visible:g,overlayProps:{radius:h},unstyled:u,loaderProps:se}),a.jsx("input",{...ht(de),name:_}),a.jsx("div",{...Ye("inner"),ref:t,"data-enable-pointer-events":F||void 0,children:w})]})})});Us.classes=nf;Us.displayName="@mantine/dropzone/Dropzone";Us.Accept=zie;Us.Idle=Uie;Us.Reject=$ie;const Fie={maxSize:1/0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:Br("max"),withinPortal:!0},b1=ve((e,t)=>{const n=oe("DropzoneFullScreen",Fie,e),{classNames:r,className:o,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=Ue({name:"DropzoneFullScreen",classes:nf,props:n,className:o,style:s,classNames:r,styles:c,unstyled:u,attributes:w,rootSelector:"fullScreen"}),{resolvedClassNames:R,resolvedStyles:E}=zl({classNames:r,styles:c,props:n}),[_,k]=v.useState(0),[L,{open:D,close:P}]=Ds(!1),$=W=>{W.dataTransfer?.types.includes("Files")&&(k(Y=>Y+1),D())},U=()=>{k(W=>W-1)};return v.useEffect(()=>{_===0&&P()},[_]),v.useEffect(()=>{if(h)return document.addEventListener("dragenter",$,!1),document.addEventListener("dragleave",U,!1),()=>{document.removeEventListener("dragenter",$,!1),document.removeEventListener("dragleave",U,!1)}},[h]),a.jsx(Ca,{...S,withinPortal:x,children:a.jsx(le,{ref:t,...T("fullScreen",{style:{opacity:L?1:0,pointerEvents:L?"all":"none",zIndex:y}}),children:a.jsx(Us,{activateOnClick:!1,...C,classNames:R,styles:E,unstyled:u,className:nf.dropzone,onDrop:W=>{m?.(W),P(),k(0)},onReject:W=>{g?.(W),P(),k(0)}})})})});b1.classes=nf;b1.displayName="@mantine/dropzone/DropzoneFullScreen";Us.FullScreen=b1;const pp=Us,Hie='{"resourceType": "Bundle"}';function Cx({id:e,title:t,message:n,color:r,icon:o,withCloseButton:s=!1,method:c="show",loading:u}){Ii[c]({id:e,loading:u,title:t,message:n,color:r,icon:o,withCloseButton:s,autoClose:!1})}function qie(){const e=kn(),t=Te(),[n,r]=v.useState({}),o=v.useCallback(async(u,f)=>{const h="batch-upload";Cx({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})),Cx({id:h,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(Ko,{size:"1rem"}),withCloseButton:!0})}catch(m){Cx({id:h,title:"Batch Upload Failed",color:"red",message:qe(m),method:"update",icon:a.jsx(Ts,{size:"1rem"}),withCloseButton:!0})}},[t]),s=v.useCallback(async u=>{for(const f of u){const h=new FileReader;h.onload=m=>o(m.target?.result,f.name),h.readAsText(f)}},[o]),c=v.useCallback(async u=>{await o(u.input,"JSON Data")},[o]);return a.jsxs(ut,{children:[a.jsx($e,{children:"Batch Create"}),a.jsxs(ge,{children:["Use this page to create, read, or update multiple resources. For more details, see"," ",a.jsx(Tt,{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(pp,{onDrop:s,accept:["application/json"],children:a.jsxs(be,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(pp.Accept,{children:a.jsx(dR,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(pp.Reject,{children:a.jsx(Ts,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(pp.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(pu,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:Hie,deserialize:JSON.parse}),a.jsx(be,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Oe,{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(be,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Oe,{onClick:()=>r({}),children:"Start over"})})]})]})}function Gie(){const{resourceType:e}=Yt(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(o=>!!o),[r]=ou("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(ut,{children:[a.jsxs($e,{children:["No apps for ",e]}),a.jsx(Ct,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(ut,{children:a.jsx("div",{children:r.map(o=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Ct,{to:`/forms/${o.id}?subject=`+n.map(s=>`${e}/${s}`).join(","),children:o.name})}),a.jsx("p",{children:o.description})]},o.id))})}):a.jsx(Bi,{})}function Wie(){const e=Te(),[t,n]=v.useState(),[r,o]=v.useState(!1);return a.jsx(ut,{width:450,children:a.jsxs(pt,{onSubmit:s=>{n(void 0),e.post("auth/changepassword",s).then(()=>o(!0)).catch(c=>n(on(c)))},children:[a.jsxs(or,{direction:"column",align:"center",justify:"center",children:[a.jsx(Qi,{size:32}),a.jsx($e,{children:"Change password"})]}),!r&&a.jsxs(Pe,{gap:"xl",mt:"xl",children:[a.jsx(uo,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:Bt(t,"oldPassword")}),a.jsx(uo,{name:"newPassword",label:"New password",required:!0,error:Bt(t,"newPassword")}),a.jsx(uo,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Bt(t,"confirmPassword")}),a.jsx(be,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Oe,{type:"submit",children:"Change password"})})]}),r&&a.jsx("div",{"data-testid":"success",children:"Password changed successfully"})]})})}const Qie=["Form","JSON","Profiles"];function Yie(){const{resourceType:e}=Yt();return a.jsxs(a.Fragment,{children:[a.jsxs(hr,{children:[a.jsxs(ge,{p:"md",fw:500,children:["New ",e]}),a.jsx(Zr,{children:a.jsx(Nf,{baseUrl:`/${e}/new`,tabs:Qie})})]}),a.jsx(f1,{})]})}function Kie(){return a.jsx(ut,{children:a.jsxs(Pe,{children:[a.jsx($e,{order:1,children:"Unexpected Error"}),a.jsx(ge,{children:"We're sorry, something went wrong."}),a.jsxs(ge,{children:["Please contact ",a.jsx(Tt,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}function dO(e){const t=Wt(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx(Ct,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(c,u){c&&u&&n.push({key:c,value:u})}function o(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=Ra(t);c!==Ut(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(o):o(t.identifier)),n.length===1&&n.push({key:"ID",value:t.id}),a.jsx(xt,{children:n.map((c,u)=>a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:c.key}),a.jsx(xt.Value,{children:c.value})]},`${c.key}-${u}`))})}function Xie(){const{id:e}=Yt(),t=ni(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,o=Te(),[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(k=>!!k);_.length===1&&E.entry.push({request:{method:"GET",url:_[0]}}),m(_)}o.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)})},[o,e,r]),x)return a.jsx(ut,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(x,void 0,2)})});if(w)return a.jsxs(ut,{children:[a.jsx($e,{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(Ct,{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(Ct,{to:E,children:Ut(E)})},E.id))})]}),g&&a.jsx("li",{children:a.jsxs(Ct,{to:g,children:["Back to ",Ra(g)]})}),a.jsx("li",{children:a.jsx(Ct,{to:"/",children:"Go back home"})})]})]});if(s||!u)return a.jsx(Bi,{});const T=g&&m1(g);return a.jsxs(a.Fragment,{children:[a.jsxs(hr,{shadow:"xs",radius:0,children:[T&&a.jsx(dN,{patient:T}),g&&g.resourceType!=="Patient"&&a.jsx(dO,{resource:g}),a.jsx(le,{px:"xl",py:"md",children:a.jsxs(ge,{children:[Ra(u),h&&h.length>1&&a.jsxs(a.Fragment,{children:[" (for ",h.length," resources)"]})]})})]}),a.jsx(ut,{children:a.jsx(QP,{questionnaire:u,subject:g&&rn(g),onSubmit:R})})]});async function R(E){const _=[];if(!h||h.length===0)_.push(await o.createResource(E));else for(const k of h)_.push(await o.createResource({...E,subject:{reference:k}}));C(_)}}const Jie="_paper_unw9o_1",Zie={paper:Jie},eoe={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function fO(e,t){const n=e.resourceType||toe(t),r=e.fields??noe(n),o=e.filters??(e.resourceType?void 0:roe(n)),s=e.sortRules??ioe(n),c=e.offset??0,u=e.count??Qm;return{...e,resourceType:n,fields:r,filters:o,sortRules:s,offset:c,count:u}}function toe(e){return localStorage.getItem("defaultResourceType")??e?.option?.find(t=>t.id==="defaultResourceType")?.valueString??"Patient"}function noe(e){const t=S1(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 roe(e){return S1(e)?.filters}function ioe(e){const t=S1(e);return t?.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function S1(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function ooe(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function aoe(e,t){const n={...e,count:1e3,offset:0},r=fO(n,t.getUserConfiguration()),o=await t.search(r.resourceType,bs({...r,total:"accurate",fields:void 0}));return zk(o)}function $_(){const e=Te(),t=Hn(),n=ni(),[r,o]=v.useState();return v.useEffect(()=>{const s=Nk(n.pathname+n.search),c=fO(s,e.getUserConfiguration());n.pathname===`/${c.resourceType}`&&n.search===bs(c)?(ooe(c),o(c)):t(`/${c.resourceType}${bs(c)}`)?.catch(console.error)},[e,t,n]),!r?.resourceType||!r.fields||r.fields.length===0?a.jsx(Bi,{}):a.jsx(hr,{shadow:"xs",m:"md",p:"xs",className:Zie.paper,children:a.jsx(Wl,{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}${bs(s.definition)}`)?.catch(console.error)},onNew:()=>{t(eoe[r.resourceType]??`/${r.resourceType}/new`)?.catch(console.error)},onExportCsv:()=>{const s=e.fhirUrl(r.resourceType,"$csv")+bs(r);e.download(s).then(c=>{window.open(window.URL.createObjectURL(c),"_blank")}).catch(c=>_e({color:"red",message:qe(c),autoClose:!1}))},onExportTransactionBundle:async()=>{aoe(r,e).then(s=>uP(JSON.stringify(s,void 0,2))).catch(s=>_e({color:"red",message:qe(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(()=>o({...r})).catch(c=>_e({color:"red",message:qe(c),autoClose:!1})))},onBulk:s=>{t(`/bulk/${r.resourceType}?ids=${s.join(",")}`)?.catch(console.error)}})})}function soe(){const[e]=ou("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($o,{value:t.category?.[0]})}),a.jsx("td",{children:a.jsx($o,{value:t.code})}),a.jsx("td",{children:a.jsx($o,{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(Bi,{})}function bb(e){const{ranges:t}=e;if(!t)return null;const n=U_(t.map(o=>o.gender));if(n.length>1)return ru(n),a.jsx(a.Fragment,{children:n.map(o=>a.jsxs(v.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:Kn(o)})}),a.jsx(bb,{ranges:e.ranges?.filter(s=>s.gender===o)})]},o))});const r=U_(t.map(o=>o.age&&qd(o.age)));return r.length>1?(ru(r),a.jsx(a.Fragment,{children:r.map(o=>a.jsxs(v.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:Kn(o)})}),a.jsx(bb,{ranges:e.ranges?.filter(s=>qd(s.age)===o)})]},o))})):a.jsx(a.Fragment,{children:t.map(o=>a.jsx("table",{children:a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{children:o.condition}),a.jsx("td",{children:a.jsx(qS,{value:o.range})})]})})},`range-${o.condition}`))})}function U_(e){return[...new Set(e.filter(t=>!!t))]}function loe(){const[e]=ou("ActivityDefinition","_count=100"),[t]=ou("ObservationDefinition","_count=100");return!e||!t?a.jsx(Bi,{}):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($o,{value:n.category?.[0]})}),a.jsx("td",{children:a.jsx($o,{value:n.code})}),e.map(r=>a.jsx("td",{children:r.observationResultRequirement?.find(o=>o.reference?.includes(n.id))?"✅":""},r.id))]},n.id))})]})}function coe(){const e=Te(),[t,n]=v.useState(),[r,o]=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),o(m.enrolled)}).catch(m=>_e({color:"red",message:qe(m),autoClose:!1}))},[e]);v.useEffect(()=>{u()},[u]);const f=v.useCallback(m=>{e.post("auth/mfa/enroll",m).then(()=>{o(!0),_e({color:"green",message:"Success"})}).catch(g=>_e({color:"red",message:qe(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(ut,{children:[a.jsx(Mn,{title:"Disable MFA",opened:s,onClose:()=>c(!1),children:a.jsx(Qp,{title:"Disable MFA",buttonText:"Submit code",onSubmit:async m=>{await h(m),c(!1),o(!1),_e({id:"mfa-disabled",color:"green",title:"Success",message:"MFA disabled",icon:a.jsx(Gq,{})}),u()}})}),a.jsxs(be,{children:[a.jsx($e,{children:"MFA is enabled"}),a.jsx(Oe,{onClick:()=>c(!0),children:"Disable MFA"})]})]}):a.jsx(ut,{width:400,children:a.jsx(Qp,{title:"Multi Factor Auth Setup",buttonText:"Enroll",qrCodeUrl:t,onSubmit:f})})}const uoe={},Sb={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__",awsTextractEnabled:uoe?.MEDPLUM_AWS_TEXTRACT_ENABLED};function $f(){return Sb}function j1(){return hO("registerEnabled")}function doe(){return hO("awsTextractEnabled")}function hO(e){try{return Sb[e]!==!1&&Sb[e]!=="false"}catch{return!0}}function foe(){const e=Hn(),[t]=bg(),n=Te(),r=t.get("scope")||"openid",[o,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){_e({id:"clientinfofail",title:"Failed to retrieve client information.",color:"red",message:qe(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),nr.assign(y.toString())}return a.jsx(NP,{onCode:m,onForgotPassword:()=>e("/resetpassword")?.catch(console.error),onRegister:()=>e("/register")?.catch(console.error),googleClientId:$f().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:[o?.logo?.url?a.jsx("img",{src:o?.logo?.url,alt:"Welcome Logo",height:60,style:{width:"auto"}}):a.jsx(Qi,{size:32}),a.jsx($e,{children:o?.welcomeString??"Sign in to Medplum"})]})})}function hoe(){const e=Te(),t=Hn(),n=$f();return v.useEffect(()=>{e.getProfile()&&t("/signin?project=new")?.catch(console.error)},[e,t]),j1()?a.jsxs(SY,{type:"project",projectId:"new",onSuccess:()=>{window.location.href="/"},googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx(Qi,{size:32}),a.jsx($e,{order:3,py:"lg",children:"Register a new account"})]}):a.jsx(ut,{width:450,children:a.jsx(Yo,{icon:a.jsx(Ls,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function poe(){const e=Hn(),[t]=bg(),n=Te(),[r,o]=v.useState(),[s,c]=v.useState(!1),u=$f().recaptchaSiteKey,f=t.get("project")||void 0;return v.useEffect(()=>{DP(u)},[u]),a.jsx(ut,{width:400,px:"xl",py:"xl",bdrs:"md",children:a.jsxs(pt,{onSubmit:async h=>{o(void 0);try{let m="";u&&(m=await AP(u)),await n.post("auth/resetpassword",{...h,projectId:f,recaptchaToken:m}),c(!0)}catch(m){o(on(m))}},children:[a.jsxs(or,{direction:"column",align:"center",justify:"center",children:[a.jsx(Qi,{size:32}),a.jsx($e,{order:3,py:"lg",children:"Reset your password"})]}),a.jsx(gr,{issues:zs(r,void 0),mb:"lg"}),!s&&a.jsxs(a.Fragment,{children:[a.jsx(Pe,{gap:"sm",mb:"md",children:a.jsx(He,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0,error:Bt(r,"email")})}),a.jsxs(Pe,{gap:"xs",children:[a.jsx(mr,{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(Tt,{onClick:()=>e("/signin")?.catch(console.error),children:"Back to Sign In"})}),j1()&&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(Tt,{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 moe(e){const t=Te(),[n,r]=v.useState(),[o,s]=v.useState();return o?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(Ct,{to:o,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx(Ct,{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(Pe,{children:[a.jsxs($e,{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($o,{value:c.code[0]})]},`action-${u}`))}),a.jsx(Vt,{title:"Subject",children:a.jsx(ja,{name:"subject",targetTypes:["Patient","Practitioner"],defaultValue:n,onChange:r})}),a.jsx(be,{justify:"flex-end",mt:"xl",children:a.jsx(Oe,{type:"submit",children:"Go"})})]})})}function goe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?a.jsx(ut,{children:a.jsx(moe,{planDefinition:n})}):null}function voe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t}),[r,o]=ou("Questionnaire","subject-type="+e),[s,c]=ou("ClientApplication",{_count:1e3});if(!n||o||c)return a.jsx(Bi,{});const u=s?.filter(m=>yoe(e)&&!!m.launchUri);if((!r||r.length===0)&&(!u||u.length===0))return a.jsxs(ut,{children:[a.jsx($e,{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=rn(n):n.resourceType==="Encounter"&&(f=n.subject,h=rn(n)),a.jsxs(ut,{children:[r?.map(m=>a.jsxs("div",{children:[a.jsx($e,{order:3,children:a.jsx(Ct,{to:`/forms/${m.id}?subject=${Ut(n)}`,children:m.title||m.name})}),a.jsx(ge,{children:m.description})]},m.id)),u?.map(m=>a.jsxs("div",{children:[a.jsx($e,{order:3,children:a.jsx(wee,{client:m,patient:f,encounter:h,children:m.name})}),a.jsx(ge,{children:m.description})]},m.id))]})}function yoe(e){return e==="Patient"||e==="Encounter"}function xoe(){const{resourceType:e,id:t}=Yt(),n=Hn(),[r,o]=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(ut,{children:a.jsx(Wl,{search:r,onClick:s=>n(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onChange:s=>o(s.definition),hideFilters:!0})})}function boe(){const e=Te(),{resourceType:t,id:n}=Yt(),r=e.readHistory(t,n).read();return a.jsx(mf,{maw:1200,children:a.jsx(Is,{children:a.jsx(fee,{history:r})})})}const Soe="_hl7Input_k5xm3_1",joe={hl7Input:Soe};function woe(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 Coe(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=>{Ad(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const Eoe=`{
225
+ "resourceType": "Patient",
226
+ "name": [
227
+ {
228
+ "given": [
229
+ "Alice"
230
+ ],
231
+ "family": "Smith"
232
+ }
233
+ ]
234
+ }`,Toe="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 Roe(){const e=Te(),{id:t}=Yt(),[n,r]=v.useState(),[o,s]=v.useState(),[c,u]=v.useState(),[f,h]=v.useState(Eoe),[m,g]=v.useState(Toe),[y,x]=v.useState(nn.FHIR_JSON),S=v.useRef(null),w=v.useRef(null),[C,T]=v.useState(!1);v.useEffect(()=>{e.readResource("Bot",t).then(async P=>{r(P),s(P.runtimeVersion==="vmcontext"?"commonjs":"esnext"),u(await _oe(e,P))}).catch(P=>_e({color:"red",message:qe(P),autoClose:!1}))},[e,t]);const R=v.useCallback(async()=>Ad(S.current,{command:"getValue"}),[]),E=v.useCallback(async()=>Ad(S.current,{command:"getOutput"}),[]),_=v.useCallback(async()=>y===nn.FHIR_JSON?JSON.parse(f):m,[y,f,m]),k=v.useCallback(async P=>{P.preventDefault(),P.stopPropagation(),T(!0);try{const $=await R(),U=await E(),W=await e.createAttachment({data:$,filename:"index.ts",contentType:nn.TYPESCRIPT}),Y=await e.createAttachment({data:U,filename:o==="commonjs"?"index.cjs":"index.mjs",contentType:nn.JAVASCRIPT}),ee=[{op:"add",path:"/sourceCode",value:W},{op:"add",path:"/executableCode",value:Y}];await e.patchResource("Bot",t,ee),_e({color:"green",message:"Saved"})}catch($){_e({color:"red",message:qe($),autoClose:!1})}finally{T(!1)}},[e,t,o,R,E]),L=v.useCallback(async P=>{P.preventDefault(),P.stopPropagation(),T(!0);try{await e.post(e.fhirUrl("Bot",t,"$deploy")),_e({color:"green",message:"Deployed"})}catch($){_e({color:"red",message:qe($),autoClose:!1})}finally{T(!1)}},[e,t]),D=v.useCallback(async P=>{P.preventDefault(),P.stopPropagation(),T(!0);try{const $=await _(),U=await e.post(e.fhirUrl("Bot",t,"$execute"),$,y);await Ad(w.current,{command:"setValue",value:U}),_e({color:"green",message:"Success"})}catch($){_e({color:"red",message:qe($),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(hr,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(Coe,{iframeRef:S,language:"typescript",module:o,testId:"code-frame",defaultValue:c,minHeight:"528px"}),a.jsxs(be,{justify:"flex-end",gap:"xs",children:[a.jsx(Oe,{type:"button",onClick:k,loading:C,leftSection:a.jsx(iG,{size:"1rem"}),children:"Save"}),a.jsx(Oe,{type:"button",onClick:L,loading:C,leftSection:a.jsx(NS,{size:"1rem"}),children:"Deploy"}),a.jsx(Oe,{type:"button",onClick:D,loading:C,leftSection:a.jsx(XG,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(Nt.Col,{span:4,children:[a.jsxs(hr,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(mn,{data:[{label:"FHIR",value:nn.FHIR_JSON},{label:"HL7",value:nn.HL7_V2}],onChange:P=>x(P.currentTarget.value)}),y===nn.FHIR_JSON?a.jsx(pu,{value:f,onChange:P=>h(P),autosize:!0,minRows:15}):a.jsx("textarea",{className:joe.hl7Input,value:m,onChange:P=>g(P.currentTarget.value),rows:15})]}),a.jsx(hr,{m:2,p:"xs",shadow:"md",children:a.jsx(woe,{iframeRef:w,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function _oe(e,t){if(t.sourceCode?.url){const n=t.sourceCode.url?.split("/")?.find(pS);return(await e.download(e.fhirUrl("Binary",n))).text()}return t.code??""}function Rs(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function Doe(){const e=Te(),{resourceType:t,id:n}=Yt(),r={reference:t+"/"+n},o=v.useCallback(s=>{e.updateResource(Rs(s)).then(()=>{_e({color:"green",message:"Success"})}).catch(c=>{_e({color:"red",message:qe(c),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(ut,{children:a.jsx(uZ,{value:r,onSubmit:o})});case"Questionnaire":return a.jsx(ut,{children:a.jsx(_Z,{questionnaire:r,onSubmit:o})});default:return null}}function Aoe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t}),r=Hn();return n?a.jsx(ut,{children:a.jsx(QZ,{value:n,onStart:(o,s)=>r(`/forms/${ws(s)}`)?.catch(console.error),onEdit:(o,s,c)=>r(`/${c.reference}}`)?.catch(console.error)})}):null}function koe(){const e=Te(),{resourceType:t,id:n}=Yt(),r=Hn();return a.jsxs(ut,{children:[a.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),a.jsx(Oe,{color:"red",onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)?.catch(console.error)).catch(o=>_e({color:"red",message:qe(o),autoClose:!1}))},children:"Delete"})]})}const Poe="_selectProfileBtn_tbaz6_1",Noe="_chevron_tbaz6_13",B_={selectProfileBtn:Poe,chevron:Noe};function Ooe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t}),[r,o]=v.useState(),s=Bl({onDropdownClose:()=>s.resetSelectedOption()}),c=v.useMemo(()=>{if(zn(n?.meta?.profile))return[a.jsx(Qe.Option,{value:"",children:"None"},""),...n.meta.profile.map(f=>a.jsx(Qe.Option,{value:f,children:f},f))]},[n?.meta?.profile]);if(v.useEffect(()=>{n?.meta?.profile?.length===1&&o(n.meta.profile[0])},[n?.meta?.profile]),!n)return null;let u;return zn(c)&&(u=a.jsx(be,{justify:"flex-end",children:a.jsxs(Pe,{align:"flex-end",gap:"xs",children:[a.jsxs(Qe,{store:s,width:250,position:"bottom-end",withinPortal:!1,onOptionSubmit:f=>{o(f),s.closeDropdown()},children:[a.jsx(Qe.Target,{children:a.jsx(_n,{onClick:()=>s.toggleDropdown(),children:a.jsxs(pf,{fw:"bold",fs:"sm",className:B_.selectProfileBtn,children:[a.jsx("span",{children:"Pick profile"}),a.jsx(PS,{stroke:1.5,className:B_.chevron})]})})}),a.jsx(Qe.Dropdown,{w:"max-content",children:a.jsx(Qe.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(ut,{children:a.jsxs(Pe,{gap:"xl",children:[u,a.jsx(e1,{value:n,profileUrl:r})]})})}function Moe(){const e=Te(),{resourceType:t,id:n}=Yt(),[r,o]=v.useState(),[s,c]=v.useState(),u=Hn(),[f,h]=v.useState();v.useEffect(()=>{e.readResource(t,n).then(x=>{o(gi(x)),c(gi(x))}).catch(x=>{h(on(x)),_e({color:"red",message:qe(x),autoClose:!1})})},[e,t,n]);const m=v.useCallback(x=>{h(void 0),e.updateResource(Rs(x)).then(()=>{u(`/${t}/${n}/details`)?.catch(console.error),_e({id:"succes",color:"green",message:"Success"})}).catch(S=>{h(on(S)),_e({color:"red",message:qe(S),autoClose:!1})})},[e,t,n,u]),g=v.useCallback(x=>{h(void 0);const S=tN.createPatch(r,Rs(x));e.patchResource(t,n,S).then(()=>{u(`/${t}/${n}/details`)?.catch(console.error),_e({id:"succes",color:"green",message:"Success"})}).catch(w=>{h(on(w)),_e({color:"red",message:qe(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(ut,{children:a.jsx(em,{defaultValue:s,onSubmit:m,onPatch:g,onDelete:y,outcome:f})}):null}function Loe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?a.jsx(ut,{maw:700,children:n.resourceType==="Patient"?a.jsx(iZ,{patient:n}):a.jsx(Yo,{icon:a.jsx(Ls,{size:16}),title:"Unsupported export type",color:"red",children:"This page is only supported for Patient resources"})}):null}function pO({resource:e,currentProfile:t,onChange:n}){const r=e.resourceType,o=Te(),[s,c]=v.useState();return v.useEffect(()=>{o.searchResources("StructureDefinition",{type:r,derivation:"constraint",_count:50}).then(u=>{c(u.filter(tK))}).catch(console.error)},[o,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(kW,{size:"90%"})}),children:u.title||u.name},u.url)})})})}function mO(e,t){const n=Te(),r=Hn();return{defaultValue:{resourceType:e},handleSubmit:c=>{t&&t(void 0),n.createResource(c).then(u=>r("/"+u.resourceType+"/"+u.id)).catch(u=>{t&&t(on(u)),_e({color:"red",message:qe(u),autoClose:!1,styles:{description:{whiteSpace:"pre-line"}}})})}}}function Ex(){const{resourceType:e}=Yt(),t=ni(),[n,r]=v.useState(),{defaultValue:o,handleSubmit:s}=mO(e,r),[c,u]=v.useState(),f=t.pathname.toLowerCase().endsWith("profiles"),h=v.useCallback(m=>{const g=Rs(m);c&&Ck(g,c.url),s(g)},[c,s]);return f?a.jsx(ut,{children:a.jsxs(Pe,{children:[a.jsx(pO,{resource:o,currentProfile:c,onChange:u}),c?a.jsx(em,{defaultValue:o,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(ut,{children:a.jsx(em,{defaultValue:o,onSubmit:s,outcome:n})})}function V_(){const e=Te(),{resourceType:t,id:n}=Yt(),r=e.readHistory(t,n).read();return a.jsx(ut,{children:a.jsx(xee,{history:r})})}function Ioe(){const{resourceType:e}=Yt(),[t,n]=v.useState(),{defaultValue:r,handleSubmit:o}=mO(e,n),s=v.useCallback(c=>{o(JSON.parse(c["new-resource"]))},[o]);return a.jsxs(ut,{children:[t&&a.jsx(gr,{outcome:t}),a.jsxs(pt,{onSubmit:s,children:[a.jsx(pu,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:mo(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(be,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Oe,{type:"submit",children:"OK"})})]})]})}function zoe(){const e=Te(),{resourceType:t,id:n}=Yt(),r=Wt({reference:t+"/"+n}),o=Hn(),[s,c]=v.useState(),u=v.useCallback(f=>{e.updateResource(Rs(JSON.parse(f.resource))).then(()=>{c(void 0),o(`/${t}/${n}/details`)?.catch(console.error),_e({color:"green",message:"Success"})}).catch(h=>{_e({color:"red",message:qe(h),autoClose:!1})})},[e,t,n,o]);return r?a.jsxs(ut,{children:[s&&a.jsx(gr,{outcome:s}),a.jsxs(pt,{onSubmit:u,children:[a.jsx(pu,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:mo(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(be,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Oe,{type:"submit",children:"OK"})})]})]}):null}function $oe(e){const{resourceType:t,id:n}=e;return a.jsxs(ut,{children:[a.jsxs(Yo,{icon:a.jsx(Ls,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx(Tt,{href:`/forms/${n}`,children:`/forms/${n}`})]}),a.jsx(QP,{questionnaire:{reference:t+"/"+n},onSubmit:()=>alert("You submitted the preview")})]})}const Uoe="_propertyTable_1xts4_1",Boe="_propertiesTitle_1xts4_17",gO={propertyTable:Uoe,propertiesTitle:Boe};function Voe(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 Foe(e){const{properties:t}=e,n=t.map(r=>{let o="",s="",c="";return r.part?.forEach(u=>{u.name==="code"?o=u.valueCode||"":u.name==="description"?s=u.valueString||"":u.name==="value"&&(c=Voe(u))}),{code:o,description:s,value:c}});return a.jsxs(Z,{className:gO.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,o)=>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-${o}`))})]})}function Hoe(e){const{valueSet:t}=e,n=Te(),r=t.url,[o,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(ut,{children:a.jsxs(Pe,{gap:"xl",children:[a.jsx(Df,{binding:r,placeholder:"Select a value from the ValueSet",onChange:w=>y(w[0]),defaultValue:o,maxValues:1}),o?a.jsxs(Pe,{gap:"md",children:[a.jsxs(kf,{children:[a.jsx(Ur,{term:"Code",children:o.code}),o.system&&a.jsx(Ur,{term:"System",children:o.system}),o.display&&a.jsx(Ur,{term:"Display",children:o.display})]}),f&&a.jsxs(be,{gap:"xs",children:[a.jsx(Pr,{size:"sm"}),a.jsx(ge,{size:"sm",c:"dimmed",children:"Loading properties..."})]}),!f&&m&&a.jsxs(Yo,{icon:a.jsx(Ls,{size:16}),title:"Lookup Failed",color:"red",children:["Failed to retrieve code information: ",qe(m)]}),!f&&!m&&S&&a.jsx(IS,{children:a.jsxs(Pe,{gap:"xs",mt:"lg",children:[a.jsx(ge,{fw:500,size:"sm",c:"dimmed",className:gO.propertiesTitle,children:"Properties"}),a.jsx(Foe,{properties:x})]})})]}):null]})})}function qoe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?n.resourceType==="Questionnaire"?a.jsx($oe,{resourceType:e,id:t}):n.resourceType==="ValueSet"?a.jsx(Hoe,{valueSet:n}):null:null}function Goe(){const e=Te(),{resourceType:t,id:n}=Yt(),[r,o]=v.useState(),[s,c]=v.useState();return v.useEffect(()=>{e.readResource(t,n).then(u=>o(gi(u))).catch(u=>{_e({color:"red",message:qe(u)})})},[e,t,n]),r?a.jsxs(ut,{children:[a.jsxs($e,{order:2,children:["Available ",t," profiles"]}),a.jsx(Pe,{children:a.jsxs(a.Fragment,{children:[a.jsx(pO,{resource:r,currentProfile:s,onChange:c}),s?a.jsx(Woe,{profile:s,resource:r,onResourceUpdated:u=>o(u)},s.url):a.jsx(ge,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const Woe=({profile:e,resource:t,onResourceUpdated:n})=>{const r=Te(),[o,s]=v.useState(),[c,u]=v.useState(()=>t.meta?.profile?.includes(e.url)),f=v.useCallback(h=>{s(void 0);const m=Rs(h);c?Ck(m,e.url):WB(m,e.url),r.updateResource(m).then(g=>{n(g),_e({color:"green",message:"Success"})}).catch(g=>{s(on(g)),_e({color:"red",message:qe(g),autoClose:!1})})},[r,e.url,n,c]);return a.jsxs(Pe,{children:[a.jsx(xf,{size:"md",checked:c,label:`Conform resource to ${e.title}`,onChange:h=>u(h.currentTarget.checked),"data-testid":"profile-toggle"}),c?a.jsx(em,{profileUrl:e.url,defaultValue:t,onSubmit:f,outcome:o}):a.jsx("form",{noValidate:!0,onSubmit:h=>{h.preventDefault(),f(t)},children:a.jsx(be,{justify:"flex-end",mt:"xl",children:a.jsx(Oe,{type:"submit",children:"OK"})})})]})},vO={"Create Only":"create","Update Only":"update","Delete Only":"delete","All Interactions":void 0},Qoe=Object.keys(vO);function Yoe(){const e=Te(),{id:t}=Yt(),n=Wt({reference:`Questionnaire/${t}`}),[r,o]=v.useState(),[s,c]=v.useState("create"),[u,f]=v.useState(0),h=e.searchResources("Subscription","status=active&_count=100").read().filter(g=>Koe(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},${Ut(n)}`:Ut(n)}`,channel:{type:"rest-hook",endpoint:Ut(r)},...s?{extension:[{url:"https://medplum.com/fhir/StructureDefinition/subscription-supported-interaction",valueCode:s}]}:void 0}).then(()=>{o(void 0),f(Date.now()),e.invalidateSearches("Subscription"),_e({color:"green",message:"Success"})}).catch(g=>_e({color:"red",message:qe(g),autoClose:!1}))}return a.jsxs(ut,{children:[a.jsx($e,{children:"Bots"}),a.jsxs(Pe,{children:[h.length===0&&a.jsx("p",{children:"No bots found."}),h.map(g=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Gl,{value:{reference:g.channel?.endpoint},link:!0})}),a.jsxs("p",{children:["Criteria: ",g.criteria]})]},g.id))]}),a.jsx(fn,{}),a.jsxs(Pe,{mt:10,children:[a.jsx(lf,{size:"lg",htmlFor:"bot",children:"Connect to bot"}),a.jsxs(be,{children:[a.jsx(ju,{name:"bot",resourceType:"Bot",onChange:g=>o(g)}),a.jsx(Oe,{onClick:m,children:"Connect"})]}),a.jsx(be,{children:a.jsx(mn,{name:"subscription-trigger-event",defaultValue:"Create Only",label:"Subscription Trigger Event",data:Qoe,onChange:g=>c(vO[g.target.value])})})]}),a.jsx("div",{style:{display:"none"},children:u})]})}function Koe(e,t){if(!t)return!1;const n=e.criteria||"",r=e.channel?.endpoint||"";return n.startsWith("QuestionnaireResponse?")&&r.startsWith("Bot/")&&(n.includes(Ut(t))||(t.url?n.includes(t.url):!1))}function Xoe(){const{id:e}=Yt(),t=Hn(),r=Te().readReference({reference:`Questionnaire/${e}`}).read(),[o,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(ut,{children:a.jsx(Wl,{search:o,onClick:c=>t(`/${c.resource.resourceType}/${c.resource.id}`)?.catch(console.error),onChange:c=>s(c.definition),hideFilters:!0,hideToolbar:!0})})}function Joe(){const e=Te(),{resourceType:t,id:n}=Yt(),r=Wt({reference:t+"/"+n}),o=v.useCallback(s=>{e.updateResource(Rs(s)).then(()=>{_e({color:"green",message:"Success"})}).catch(c=>{_e({color:"red",message:qe(c),autoClose:!1})})},[e]);return r?a.jsx(ut,{children:a.jsx(UZ,{onSubmit:o,definition:r})}):null}function Zoe(){const{resourceType:e,id:t}=Yt(),n=Wt({reference:e+"/"+t});return n?a.jsx(ut,{children:e==="MeasureReport"?a.jsx(nZ,{measureReport:n}):a.jsx(ZS,{value:n})}):null}const eae="_container_1ue98_1",tae="_entry_1ue98_14",nae="_active_1ue98_21",Tx={container:eae,entry:tae,active:nae};function rae(e){const t=Te(),n=Wt(e.value),[r,o]=v.useState();return v.useEffect(()=>{if(!n)return;const s=m1(n);if(!s)return;const c="reference"in s?s.reference:Ut(s);t.search("ServiceRequest","subject="+c).then(u=>{const h=(u.entry??[]).map(m=>m.resource);nN(h),h.reverse(),o(h)}).catch(u=>_e({color:"red",message:qe(u),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:Tx.container,children:r.map(s=>a.jsxs("div",{className:Ft(Tx.entry,{[Tx.active]:s.id===n?.id}),children:[a.jsx("p",{children:a.jsx(Ct,{to:s,children:iae(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:oae(s)})]},s.id))}):null}function iae(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function oae(e){return e.authoredOn?e.authoredOn.substring(0,10):e.meta?.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const aae="_container_1l2dh_1",sae={container:aae};function lae(e){const t=Wt(e.valueSet);if(!t)return null;const n=[""],r=t.compose?.include?.[0]?.concept?.map(o=>o.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),a.jsx("div",{className:sae.container,children:a.jsx(mn,{defaultValue:e.defaultValue,onChange:o=>e.onChange(o.currentTarget.value),data:n})})}function cae(e){const t=Wt(e.specimen);return t?a.jsxs(xt,{children:[a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Type"}),a.jsx(xt.Value,{children:"Specimen"})]}),a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Collected"}),a.jsx(xt.Value,{children:Nr(t.collection?.collectedDateTime)})]}),a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Specimen Age"}),a.jsx(xt.Value,{children:uae(t)})]}),t.collection?.collectedDateTime&&t.receivedTime?a.jsxs(xt.Entry,{children:[a.jsx(xt.Key,{children:"Specimen Stability"}),a.jsx(xt.Value,{children:dae(t)})]}):a.jsx(a.Fragment,{})]}):null}function uae(e){const t=e.collection?.collectedDateTime;if(!t)return;const n=new Date(t);return yO(xO(n,new Date))}function dae(e){if(!e.collection?.collectedDateTime||!e.receivedTime)return;const t=new Date(e.collection.collectedDateTime),n=new Date(e.receivedTime);return yO(xO(t,n))}function yO(e){return e.toString().padStart(3,"0")+"D"}function xO(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function fae(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 hae(){const e=Te(),{resourceType:t,id:n}=Yt(),r={reference:t+"/"+n},[o,s]=v.useState(),c=Wt(r,s),u=fae(t);async function f(){const w=(await e.readHistory(t,n)).entry?.find(C=>!!C.resource)?.resource;w?h(w):_e({color:"red",message:"No history to restore",autoClose:!1})}function h(S){e.updateResource(Rs(S)).then(()=>{s(void 0),_e({color:"green",message:"Success"})}).catch(w=>{_e({color:"red",message:qe(w),autoClose:!1})})}if(o)return iU(o)?a.jsxs(ut,{children:[a.jsx($e,{children:"Deleted"}),a.jsx("p",{children:"The resource was deleted."}),a.jsx(Oe,{color:"red",onClick:f,children:"Restore"})]}):a.jsx(gr,{outcome:o});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&&m1(c),y=c&&nre(c),x=e.getUserConfiguration()?.option?.find(S=>S.id==="statusValueSet")?.valueString;return a.jsxs(a.Fragment,{children:[c?.resourceType==="ServiceRequest"&&x&&a.jsx(lae,{valueSet:{reference:x},defaultValue:c.orderDetail?.[0]?.text,onChange:m},Ut(c)+"-"+c.orderDetail?.[0]?.text),c&&a.jsx(rae,{value:c}),c&&a.jsxs(hr,{children:[g&&a.jsx(dN,{patient:g}),y&&a.jsx(cae,{specimen:y}),t!=="Patient"&&a.jsx(dO,{resource:r}),a.jsx(Zr,{children:a.jsx(Nf,{baseUrl:`/${t}/${n}`,tabs:u})})]}),a.jsx(f1,{})]})}function mp(){const e=Hn(),{resourceType:t,id:n,versionId:r,tab:o}=Yt(),s=Te(),[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(Bi,{});const y=f?.entry??[],x=y.findIndex(E=>E.resource?.meta?.versionId===r);if(x===-1)return a.jsxs(ut,{children:[a.jsx($e,{children:"Version not found"}),a.jsx(Ct,{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=o||C,R=y.length-x;return a.jsx(mf,{maw:1200,children:a.jsx(Is,{children:a.jsxs(Pe,{gap:"lg",children:[m&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)}),a.jsxs(Fm,{cols:2,mb:"lg",children:[a.jsx(Gi,{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(be,{justify:"right",children:a.jsx(Tl,{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(kf,{compact:!0,children:[a.jsx(Ur,{term:"Version ID",children:S.meta?.versionId}),a.jsx(Ur,{term:"Author",children:a.jsx(kd,{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(mee,{original:w??{resourceType:t,id:n},revised:S}),T==="raw"&&a.jsx("pre",{style:{fontSize:"9pt"},children:JSON.stringify(S,void 0,2)})]})})})}function pae(){const{resourceType:e,id:t}=Yt(),n=Hn(),[r,o]=v.useState({resourceType:"Subscription",filters:[{code:"url",operator:fe.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(ut,{children:a.jsx(Wl,{search:r,onClick:s=>n(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onChange:s=>o(s.definition),hideFilters:!0})})}function mae(e){const t=Te(),{resource:n,opened:r,onClose:o}=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?Ut(u):void 0,verbose:h}),_e({color:"green",message:"Done"}),o()}catch(y){_e({color:"red",message:qe(y),autoClose:!1})}},[t,n,o,s,u,h]);return a.jsx(Mn,{opened:r,onClose:o,title:"Resend Subscriptions",children:a.jsx(pt,{onSubmit:g,children:a.jsxs(Pe,{children:[a.jsx(hn,{label:"Choose subscription (all subscriptions by default)",onChange:y=>c(y.currentTarget.checked)}),s&&a.jsx(ju,{name:"subscription",resourceType:"Subscription",placeholder:"Subscription",onChange:f}),a.jsx(hn,{label:"Verbose mode",onChange:y=>m(y.currentTarget.checked)}),a.jsx(be,{justify:"flex-end",children:a.jsx(Oe,{type:"submit",children:"Resend"})})]})})})}function F_(){const e=Te(),t=xu(),{resourceType:n,id:r}=Yt(),o={reference:n+"/"+r},[s,c]=v.useState(),u=Ds(!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";_e({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(),ml({id:_,title:"AWS Textract Successful",message:"Text successfully extracted.",color:"green",icon:a.jsx(Ko,{size:"1rem"}),loading:!1,withCloseButton:!0})}).catch(k=>ml({id:_,title:"AWS Textract Error",color:"red",message:qe(k),icon:a.jsx(Ts,{size:"1rem"}),loading:!1,withCloseButton:!0}))}function T(R){const{primaryResource:E,currentResource:_,reloadTimeline:k}=R,L=_.resourceType===E.resourceType&&_.id===E.id,D=_.resourceType==="Communication"&&_.priority!=="stat",P=_.resourceType==="Communication"&&_.priority==="stat",$=L,U=!L,W=!L,Y=!L,ee=e.getProjectMembership()?.admin,B=ee,G=doe()&&(_.resourceType==="DocumentReference"||_.resourceType==="Media");return a.jsxs(Se.Dropdown,{children:[a.jsx(Se.Label,{children:"Resource"}),D&&a.jsx(Se.Item,{leftSection:a.jsx(WG,{size:14}),onClick:()=>h(_,k),"aria-label":`Pin ${Ut(_)}`,children:"Pin"}),P&&a.jsx(Se.Item,{leftSection:a.jsx(YG,{size:14}),onClick:()=>m(_,k),"aria-label":`Unpin ${Ut(_)}`,children:"Unpin"}),U&&a.jsx(Se.Item,{leftSection:a.jsx(uR,{size:14}),onClick:()=>g(_),"aria-label":`Details ${Ut(_)}`,children:"Details"}),$&&a.jsx(Se.Item,{leftSection:a.jsx(uR,{size:14}),onClick:()=>w(_),"aria-label":`Details ${Ut(_)}`,children:"Details"}),W&&a.jsx(Se.Item,{leftSection:a.jsx(oP,{size:14}),onClick:()=>y(_),"aria-label":`Edit ${Ut(_)}`,children:"Edit"}),ee&&a.jsxs(a.Fragment,{children:[a.jsx(Se.Divider,{}),a.jsx(Se.Label,{children:"Admin"}),B&&a.jsx(Se.Item,{leftSection:a.jsx(iW,{size:14}),onClick:()=>S(_),"aria-label":`Resend Subscriptions ${Ut(_)}`,children:"Resend Subscriptions"})]}),G&&a.jsxs(a.Fragment,{children:[a.jsx(Se.Divider,{}),a.jsx(Se.Label,{children:"AWS AI"}),a.jsx(Se.Item,{leftSection:a.jsx(jW,{size:14}),onClick:()=>C(_,k),"aria-label":`AWS Textract ${Ut(_)}`,children:"AWS Textract"})]}),Y&&a.jsxs(a.Fragment,{children:[a.jsx(Se.Divider,{}),a.jsx(Se.Label,{children:"Danger zone"}),a.jsx(Se.Item,{color:"red",leftSection:a.jsx(tg,{size:14}),onClick:()=>x(_),"aria-label":`Delete ${Ut(_)}`,children:"Delete"})]})]})}return a.jsxs(a.Fragment,{children:[n==="Encounter"&&a.jsx(HX,{encounter:o,getMenu:T}),n==="Patient"&&a.jsx(sZ,{patient:o,getMenu:T}),n==="ServiceRequest"&&a.jsx(jee,{serviceRequest:o,getMenu:T}),n!=="Encounter"&&n!=="Patient"&&n!=="ServiceRequest"&&a.jsx(FX,{resource:o,getMenu:T}),a.jsx(mae,{resource:s,opened:u[0],onClose:u[1].close},`resend-subscriptions-${s?.id}`)]})}function gae(e){const{opened:t,close:n,version:r,loadingStatus:o,handleStatus:s,handleUpgrade:c}=e,[u,f]=v.useState(),[h,m]=v.useState(!1);return v.useEffect(()=>{t&&(u||_H("app-tools-page").then(f).catch(console.error),s())},[t,u,s]),u&&r&&!o?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(be,{children:[a.jsx(Oe,{onClick:()=>{c(h),n()},"aria-label":"Confirm upgrade",children:"Confirm Upgrade"}),a.jsx(hn,{label:"Force",onChange:g=>m(g.currentTarget.checked)})]})]}):a.jsx(Bi,{})}function vae(){const e=Te(),{id:t}=Yt(),n=v.useMemo(()=>({reference:"Agent/"+t}),[t]),[r,o]=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),[k,L]=v.useState(!1),[D,P]=v.useState(),[$,{open:U,close:W}]=Ds(!1);v.useEffect(()=>{if(r||s||u||E){L(!0);return}L(!1)},[r,s,u,E]);const Y=v.useCallback(()=>{o(!0),e.get(e.fhirUrl("Agent",t,"$status"),{cache:"reload"}).then(V=>{y(V.parameter?.find(K=>K.name==="status")?.valueCode),S(V.parameter?.find(K=>K.name==="version")?.valueString),C(V.parameter?.find(K=>K.name==="lastUpdated")?.valueInstant)}).catch(V=>z(qe(V))).finally(()=>o(!1))},[e,t]),ee=v.useCallback(V=>{const K=V.host,O=V.pingCount||1;K&&(_(!0),e.pushToAgent(n,K,`PING ${O}`,nn.PING,!0).then(F=>R(F)).catch(F=>z(qe(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=>z(qe(V))).finally(()=>c(!1))},[e,t]),G=v.useCallback(V=>{f(!0);const K=e.fhirUrl("Agent",t,"$upgrade");K.searchParams.set("force",String(V)),e.get(K,{cache:"reload"}).then(O=>{I("Agent upgraded successfully.")}).catch(O=>z(qe(O))).finally(()=>f(!1))},[e,t]),M=v.useCallback(V=>{m(!0);const K=V.logLimit||20;e.get(e.fhirUrl("Agent",t,`$fetch-logs${K!==void 0?`?limit=${K}`:""}`),{cache:"reload"}).then(O=>{const F=O?.parameter?.find(se=>se.name==="logs");F&&P(F?.valueString)}).catch(O=>z(qe(O))).finally(()=>m(!1))},[e,t]);function I(V){_e({color:"green",title:"Success",icon:a.jsx(Ko,{size:"1rem"}),message:V})}function z(V){_e({color:"red",title:"Error",message:V,autoClose:!1})}return a.jsxs(ut,{children:[a.jsx(Mn,{opened:$,onClose:W,title:"Upgrade Agent",centered:!0,children:a.jsx(gae,{opened:$,close:W,version:x,loadingStatus:r,handleStatus:Y,handleUpgrade:G})}),a.jsx($e,{order:1,children:"Agent Tools"}),a.jsxs("div",{style:{marginBottom:10},children:["Agent: ",a.jsx(Gl,{value:n,link:!0})]}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Oe,{onClick:Y,loading:r,disabled:k&&!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(fg,{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(fn,{my:"lg"}),a.jsx($e,{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(Oe,{onClick:B,loading:s,disabled:k&&!s,"aria-label":"Reload config",children:"Reload Config"}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(Oe,{onClick:U,loading:u,disabled:k&&!u,"aria-label":"Upgrade agent",children:"Upgrade"}),a.jsx(fn,{my:"lg"}),a.jsxs(pt,{onSubmit:M,children:[a.jsx($e,{order:2,children:"Fetch Logs"}),a.jsx("p",{children:"Fetch logs from the agent."}),D?.length?a.jsx(pf,{block:!0,mb:15,children:D}):null,a.jsxs(be,{children:[a.jsx(ur,{w:100,id:"logLimit",name:"logLimit",placeholder:"20",label:"Log Limit"}),a.jsx(Oe,{mt:22,loading:h,disabled:k&&!h,"aria-label":"Fetch logs",type:"submit",children:"Fetch Logs"})]})]}),a.jsx(fn,{my:"lg"}),a.jsx($e,{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(be,{children:[a.jsx(He,{id:"host",name:"host",placeholder:"ex. 127.0.0.1",label:"IP Address / Hostname",rightSection:a.jsx(An,{size:24,radius:"xl",variant:"filled",type:"submit","aria-label":"Ping",loading:E,disabled:k&&!E,children:a.jsx(lW,{style:{width:"1rem",height:"1rem"},stroke:1.5})})}),a.jsx(ur,{id:"pingCount",name:"pingCount",placeholder:"1",label:"Ping Count"})]})}),!E&&T&&a.jsxs(a.Fragment,{children:[a.jsx($e,{order:5,mt:"sm",mb:0,children:"Last Ping"}),a.jsx("pre",{children:T})]})]})}function yae(){const e=Hn(),t=Te(),[n,r]=v.useState();v.useEffect(()=>{t.get("auth/me",{cache:"no-cache"}).then(r).catch(s=>_e({color:"red",message:qe(s),autoClose:!1}))},[t]);function o(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>_e({color:"green",message:"Login revoked"})).catch(c=>_e({color:"red",message:qe(c),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(ut,{children:[a.jsx($e,{children:"Security"}),a.jsxs(kf,{children:[a.jsx(Ur,{term:"ID",children:a.jsx(Tt,{href:`/${Ut(n.profile)}`,children:n.profile.id})}),a.jsx(Ur,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(Ur,{term:"Name",children:Ma(n.profile.name?.[0])})]})]}),a.jsxs(ut,{children:[a.jsx($e,{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(Tt,{href:"#",onClick:()=>o(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(ut,{children:[a.jsx($e,{children:"Password"}),a.jsx(Oe,{onClick:()=>e("/changepassword")?.catch(console.error),children:"Change password"})]}),a.jsxs(ut,{children:[a.jsx($e,{children:"Multi Factor Auth"}),a.jsxs("p",{children:["Enrolled: ",n.security.mfaEnrolled.toString()]}),!n.security.mfaEnrolled&&a.jsx(Oe,{onClick:()=>e("/mfa")?.catch(console.error),children:"Enroll"})]})]}):null}function xae(){const{id:e,secret:t}=Yt(),n=Te(),[r,o]=v.useState(),[s,c]=v.useState(!1),u=zs(r,void 0);return a.jsxs(ut,{width:450,children:[a.jsx(gr,{issues:u}),a.jsxs(pt,{onSubmit:f=>{if(f.password!==f.confirmPassword){o(Io("Passwords do not match","confirmPassword"));return}o(void 0);const h={id:e,secret:t,password:f.password};n.post("auth/setpassword",h).then(()=>c(!0)).catch(m=>o(on(m)))},children:[a.jsxs(or,{direction:"column",align:"center",justify:"center",children:[a.jsx(Qi,{size:32}),a.jsx($e,{children:"Set password"})]}),!s&&a.jsxs(Pe,{children:[a.jsx(uo,{name:"password",label:"New password",required:!0,error:Bt(r,"password")}),a.jsx(uo,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Bt(r,"confirmPassword")}),a.jsx(be,{justify:"flex-end",mt:"xl",children:a.jsx(Oe,{type:"submit",children:"Set password"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:["Password set. You can now ",a.jsx(Ct,{to:"/signin",children:"sign in"}),"."]})]})]})}function bae(){const e=Rf(),t=Hn(),[n]=bg(),r=$f(),o=v.useCallback(()=>{const s=n.get("next");t(s?.startsWith("/")?s:"/")?.catch(console.error)},[n,t]);return v.useEffect(()=>{e&&n.has("next")&&o()},[e,n,o]),a.jsxs(NP,{onSuccess:()=>o(),onForgotPassword:()=>t("/resetpassword")?.catch(console.error),onRegister:j1()?()=>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(Qi,{size:32}),n.get("project")!=="new"&&a.jsxs($e,{order:3,py:"lg",ta:"center",children:["Sign in to ",dP()]}),n.get("project")==="new"&&a.jsx($e,{order:3,py:"lg",ta:"center",children:"Sign in again to create a new project"})]})}function Sae(){const e=Hn(),t=ni(),[n,r]=v.useState(),[o,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||!o||!c?null:a.jsx(VJ,{resourceType:n,checkboxesEnabled:!0,query:o,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 jae(){const{id:e,secret:t}=Yt(),n=Te(),[r,o]=v.useState(),[s,c]=v.useState(!1),u=zs(r,void 0);return a.jsxs(ut,{width:450,children:[a.jsx(gr,{issues:u}),a.jsxs(pt,{onSubmit:()=>{o(void 0);const f={id:e,secret:t};n.post("auth/verifyemail",f).then(()=>c(!0)).catch(h=>o(on(h)))},children:[a.jsxs(or,{direction:"column",align:"center",justify:"center",children:[a.jsx(Qi,{size:32}),a.jsx($e,{children:"Email address verification required"})]}),!s&&a.jsxs(Pe,{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(be,{justify:"flex-end",mt:"xl",children:a.jsx(Oe,{type:"submit",children:"Verify email"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:["Email verified. You can now ",a.jsx(Ct,{to:"/signin",children:"sign in"}),"."]})]})]})}function wae(){return a.jsx(xne,{children:a.jsxs(Fe,{errorElement:a.jsx(Kie,{}),children:[a.jsx(Fe,{path:"/signin",element:a.jsx(bae,{})}),a.jsx(Fe,{path:"/oauth",element:a.jsx(foe,{})}),a.jsx(Fe,{path:"/resetpassword",element:a.jsx(poe,{})}),a.jsx(Fe,{path:"/setpassword/:id/:secret",element:a.jsx(xae,{})}),a.jsx(Fe,{path:"/verifyemail/:id/:secret",element:a.jsx(jae,{})}),a.jsx(Fe,{path:"/register",element:a.jsx(hoe,{})}),a.jsx(Fe,{path:"/changepassword",element:a.jsx(Wie,{})}),a.jsx(Fe,{path:"/security",element:a.jsx(yae,{})}),a.jsx(Fe,{path:"/mfa",element:a.jsx(coe,{})}),a.jsx(Fe,{path:"/batch",element:a.jsx(qie,{})}),a.jsx(Fe,{path:"/bulk/:resourceType",element:a.jsx(Gie,{})}),a.jsx(Fe,{path:"/smart",element:a.jsx(Sae,{})}),a.jsx(Fe,{path:"/forms/:id",element:a.jsx(Xie,{})}),a.jsx(Fe,{path:"/admin/super",element:a.jsx(Ore,{})}),a.jsx(Fe,{path:"/admin/super/asyncjob/:tab",element:a.jsx(w_,{})}),a.jsx(Fe,{path:"/admin/super/asyncjob",element:a.jsx(w_,{})}),a.jsx(Fe,{path:"/admin/super/db/:tab",element:a.jsx(S_,{})}),a.jsx(Fe,{path:"/admin/super/db",element:a.jsx(S_,{})}),a.jsx(Fe,{path:"/admin/config",element:a.jsx(jre,{})}),a.jsxs(Fe,{path:"/admin",element:a.jsx(Cre,{}),children:[a.jsx(Fe,{path:"bots/new",element:a.jsx(ore,{})}),a.jsx(Fe,{path:"bots",element:a.jsx(rre,{})}),a.jsx(Fe,{path:"clients/new",element:a.jsx(are,{})}),a.jsx(Fe,{path:"clients",element:a.jsx(ire,{})}),a.jsx(Fe,{path:"details",element:a.jsx(j_,{})}),a.jsx(Fe,{path:"invite",element:a.jsx(Sre,{})}),a.jsx(Fe,{path:"patients",element:a.jsx(vne,{to:"/admin/users",replace:!0})}),a.jsx(Fe,{path:"users",element:a.jsx(Ure,{})}),a.jsx(Fe,{path:"project",element:a.jsx(j_,{})}),a.jsx(Fe,{path:"secrets",element:a.jsx(Ere,{})}),a.jsx(Fe,{path:"sites",element:a.jsx(Tre,{})})]}),a.jsx(Fe,{path:"/lab/assays",element:a.jsx(soe,{})}),a.jsx(Fe,{path:"/lab/panels",element:a.jsx(loe,{})}),a.jsxs(Fe,{path:"/:resourceType/new",element:a.jsx(Yie,{}),children:[a.jsx(Fe,{index:!0,element:a.jsx(Ex,{})}),a.jsx(Fe,{path:"form",element:a.jsx(Ex,{})}),a.jsx(Fe,{path:"json",element:a.jsx(Ioe,{})}),a.jsx(Fe,{path:"profiles",element:a.jsx(Ex,{})})]}),a.jsxs(Fe,{path:"/:resourceType/:id",element:a.jsx(hae,{}),children:[a.jsx(Fe,{index:!0,element:a.jsx(F_,{})}),a.jsx(Fe,{path:"apply",element:a.jsx(goe,{})}),a.jsx(Fe,{path:"apps",element:a.jsx(voe,{})}),a.jsx(Fe,{path:"event",element:a.jsx(xoe,{})}),a.jsx(Fe,{path:"blame",element:a.jsx(boe,{})}),a.jsx(Fe,{path:"bots",element:a.jsx(Yoe,{})}),a.jsx(Fe,{path:"builder",element:a.jsx(Doe,{})}),a.jsx(Fe,{path:"checklist",element:a.jsx(Aoe,{})}),a.jsx(Fe,{path:"delete",element:a.jsx(koe,{})}),a.jsx(Fe,{path:"details",element:a.jsx(Ooe,{})}),a.jsx(Fe,{path:"edit",element:a.jsx(Moe,{})}),a.jsx(Fe,{path:"editor",element:a.jsx(Roe,{})}),a.jsxs(Fe,{path:"history",children:[a.jsx(Fe,{index:!0,element:a.jsx(V_,{})}),a.jsx(Fe,{path:":versionId/:tab",element:a.jsx(mp,{})}),a.jsx(Fe,{path:":versionId",element:a.jsx(mp,{})})]}),a.jsxs(Fe,{path:"_history",children:[a.jsx(Fe,{index:!0,element:a.jsx(V_,{})}),a.jsx(Fe,{path:":versionId/:tab",element:a.jsx(mp,{})}),a.jsx(Fe,{path:":versionId",element:a.jsx(mp,{})})]}),a.jsx(Fe,{path:"json",element:a.jsx(zoe,{})}),a.jsx(Fe,{path:"preview",element:a.jsx(qoe,{})}),a.jsx(Fe,{path:"responses",element:a.jsx(Xoe,{})}),a.jsx(Fe,{path:"report",element:a.jsx(Zoe,{})}),a.jsx(Fe,{path:"ranges",element:a.jsx(Joe,{})}),a.jsx(Fe,{path:"subscriptions",element:a.jsx(pae,{})}),a.jsx(Fe,{path:"timeline",element:a.jsx(F_,{})}),a.jsx(Fe,{path:"tools",element:a.jsx(vae,{})}),a.jsx(Fe,{path:"profiles",element:a.jsx(Goe,{})}),a.jsx(Fe,{path:"export",element:a.jsx(Loe,{})})]}),a.jsx(Fe,{path:"/:resourceType",element:a.jsx($_,{})}),a.jsx(Fe,{path:"/",element:a.jsx($_,{})})]})})}function Cae(){const e=Te(),t=e.getUserConfiguration(),n=ni(),[r]=bg();return e.isLoading()?a.jsx(Bi,{}):a.jsx(sY,{logo:a.jsx(Qi,{size:24}),pathname:n.pathname,searchParams:r,version:Bk,menus:Eae(t),displayAddBookmark:!!t?.id,children:a.jsx(v.Suspense,{fallback:a.jsx(Bi,{}),children:a.jsx(wae,{})})})}function Eae(e){const t=e?.menu?.map(n=>({title:n.title,links:n.link?.map(r=>({label:r.name,href:r.target,icon:Tae(r.target)}))||[]}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(kG,{})}]}),t}const H_={Patient:gW,Practitioner:CG,Organization:$q,ServiceRequest:tW,DiagnosticReport:aW,Questionnaire:jG,Project:bG,admin:kq,AccessPolicy:DG,Subscription:_W,batch:FG,Observation:$G};function Tae(e){if(e.includes("admin/super/db"))return a.jsx(nG,{});try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in H_){const n=H_[t];return a.jsx(n,{})}}catch{}}async function Rae(){const e=$f(),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=Hne([{path:"*",element:a.jsx(Cae,{})}]),o=c=>r.navigate(c);_ee.createRoot(document.getElementById("root")).render(a.jsx(v.StrictMode,{children:a.jsx(DH,{medplum:t,navigate:o,children:a.jsxs(p2,{theme:n,children:[a.jsx(Oa,{position:"bottom-right"}),a.jsx(pne,{router:r})]})})}))}Rae().catch(console.error);
235
+ //# sourceMappingURL=index-Q3Gj2Joa.js.map