@medplum/app 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-98UYWXeL.css +1 -0
- package/dist/assets/index-DP_HRmCX.js +235 -0
- package/dist/assets/index-DP_HRmCX.js.map +1 -0
- package/dist/index.html +4 -4
- package/package.json +18 -18
- package/dist/assets/index-IKP2NgNs.css +0 -1
- package/dist/assets/index-quQolau-.js +0 -235
- package/dist/assets/index-quQolau-.js.map +0 -1
- /package/dist/assets/{favicon-D3fOOtTL.ico → favicon-Pd8461Mt.ico} +0 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
function nS(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 i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{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 i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var x0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rS={exports:{}},Ld={},oS={exports:{}},ze={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var nc=Symbol.for("react.element"),Bk=Symbol.for("react.portal"),Uk=Symbol.for("react.fragment"),Vk=Symbol.for("react.strict_mode"),Wk=Symbol.for("react.profiler"),Hk=Symbol.for("react.provider"),qk=Symbol.for("react.context"),Gk=Symbol.for("react.forward_ref"),Qk=Symbol.for("react.suspense"),Kk=Symbol.for("react.memo"),Yk=Symbol.for("react.lazy"),w0=Symbol.iterator;function Xk(e){return e===null||typeof e!="object"?null:(e=w0&&e[w0]||e["@@iterator"],typeof e=="function"?e:null)}var iS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sS=Object.assign,aS={};function ja(e,t,n){this.props=e,this.context=t,this.refs=aS,this.updater=n||iS}ja.prototype.isReactComponent={};ja.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ja.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lS(){}lS.prototype=ja.prototype;function Km(e,t,n){this.props=e,this.context=t,this.refs=aS,this.updater=n||iS}var Ym=Km.prototype=new lS;Ym.constructor=Km;sS(Ym,ja.prototype);Ym.isPureReactComponent=!0;var S0=Array.isArray,cS=Object.prototype.hasOwnProperty,Xm={current:null},uS={key:!0,ref:!0,__self:!0,__source:!0};function dS(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)cS.call(t,r)&&!uS.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:nc,type:e,key:i,ref:s,props:o,_owner:Xm.current}}function Jk(e,t){return{$$typeof:nc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Jm(e){return typeof e=="object"&&e!==null&&e.$$typeof===nc}function Zk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var b0=/\/+/g;function hh(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zk(""+e.key):t.toString(36)}function wu(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case nc:case Bk:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+hh(s,0):r,S0(o)?(n="",e!=null&&(n=e.replace(b0,"$&/")+"/"),wu(o,t,n,"",function(u){return u})):o!=null&&(Jm(o)&&(o=Jk(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(b0,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",S0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+hh(i,l);s+=wu(i,t,n,c,o)}else if(c=Xk(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+hh(i,l++),s+=wu(i,t,n,c,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function Vc(e,t,n){if(e==null)return e;var r=[],o=0;return wu(e,r,"","",function(i){return t.call(n,i,o++)}),r}function e2(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Sn={current:null},Su={transition:null},t2={ReactCurrentDispatcher:Sn,ReactCurrentBatchConfig:Su,ReactCurrentOwner:Xm};ze.Children={map:Vc,forEach:function(e,t,n){Vc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Vc(e,function(){t++}),t},toArray:function(e){return Vc(e,function(t){return t})||[]},only:function(e){if(!Jm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ze.Component=ja;ze.Fragment=Uk;ze.Profiler=Wk;ze.PureComponent=Km;ze.StrictMode=Vk;ze.Suspense=Qk;ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=t2;ze.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=sS({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Xm.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)cS.call(t,c)&&!uS.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:nc,type:e.type,key:o,ref:i,props:r,_owner:s}};ze.createContext=function(e){return e={$$typeof:qk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Hk,_context:e},e.Consumer=e};ze.createElement=dS;ze.createFactory=function(e){var t=dS.bind(null,e);return t.type=e,t};ze.createRef=function(){return{current:null}};ze.forwardRef=function(e){return{$$typeof:Gk,render:e}};ze.isValidElement=Jm;ze.lazy=function(e){return{$$typeof:Yk,_payload:{_status:-1,_result:e},_init:e2}};ze.memo=function(e,t){return{$$typeof:Kk,type:e,compare:t===void 0?null:t}};ze.startTransition=function(e){var t=Su.transition;Su.transition={};try{e()}finally{Su.transition=t}};ze.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};ze.useCallback=function(e,t){return Sn.current.useCallback(e,t)};ze.useContext=function(e){return Sn.current.useContext(e)};ze.useDebugValue=function(){};ze.useDeferredValue=function(e){return Sn.current.useDeferredValue(e)};ze.useEffect=function(e,t){return Sn.current.useEffect(e,t)};ze.useId=function(){return Sn.current.useId()};ze.useImperativeHandle=function(e,t,n){return Sn.current.useImperativeHandle(e,t,n)};ze.useInsertionEffect=function(e,t){return Sn.current.useInsertionEffect(e,t)};ze.useLayoutEffect=function(e,t){return Sn.current.useLayoutEffect(e,t)};ze.useMemo=function(e,t){return Sn.current.useMemo(e,t)};ze.useReducer=function(e,t,n){return Sn.current.useReducer(e,t,n)};ze.useRef=function(e){return Sn.current.useRef(e)};ze.useState=function(e){return Sn.current.useState(e)};ze.useSyncExternalStore=function(e,t,n){return Sn.current.useSyncExternalStore(e,t,n)};ze.useTransition=function(){return Sn.current.useTransition()};ze.version="18.2.0";oS.exports=ze;var p=oS.exports;const C=Qm(p),Zm=nS({__proto__:null,default:C},[p]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var n2=p,r2=Symbol.for("react.element"),o2=Symbol.for("react.fragment"),i2=Object.prototype.hasOwnProperty,s2=n2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a2={key:!0,ref:!0,__self:!0,__source:!0};function fS(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)i2.call(t,r)&&!a2.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:r2,type:e,key:i,ref:s,props:o,_owner:s2.current}}Ld.Fragment=o2;Ld.jsx=fS;Ld.jsxs=fS;rS.exports=Ld;var a=rS.exports,Gr=function(){return Gr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Gr.apply(this,arguments)};function hS(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 l2(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var bu="right-scroll-bar-position",Cu="width-before-scroll-bar",c2="with-scroll-bars-hidden",u2="--removed-body-scroll-bar-size";function ph(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function d2(e,t){var n=p.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 C0=new WeakMap;function f2(e,t){var n=d2(t||null,function(r){return e.forEach(function(o){return ph(o,r)})});return p.useLayoutEffect(function(){var r=C0.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(l){i.has(l)||ph(l,null)}),i.forEach(function(l){o.has(l)||ph(l,s)})}C0.set(n,e)},[e]),n}function h2(e){return e}function p2(e,t){t===void 0&&(t=h2);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(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var c=function(){var d=s;s=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){s.push(d),u()},filter:function(d){return s=s.filter(d),n}}}};return o}function m2(e){e===void 0&&(e={});var t=p2(null);return t.options=Gr({async:!0,ssr:!1},e),t}var pS=function(e){var t=e.sideCar,n=hS(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 p.createElement(r,Gr({},n))};pS.isSideCarExport=!0;function g2(e,t){return e.useMedium(t),pS}var mS=m2(),mh=function(){},Fd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:mh,onWheelCapture:mh,onTouchMoveCapture:mh}),o=r[0],i=r[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,m=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,x=b===void 0?"div":b,y=e.gapMode,w=hS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,j=f2([n,t]),E=Gr(Gr({},w),o);return p.createElement(p.Fragment,null,d&&p.createElement(S,{sideCar:mS,removeScrollBar:u,shards:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:y}),s?p.cloneElement(p.Children.only(l),Gr(Gr({},E),{ref:j})):p.createElement(x,Gr({},E,{className:c,ref:j}),l))});Fd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fd.classNames={fullWidth:Cu,zeroRight:bu};var v2=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function y2(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=v2();return t&&e.setAttribute("nonce",t),e}function x2(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function w2(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var S2=function(){var e=0,t=null;return{add:function(n){e==0&&(t=y2())&&(x2(t,n),w2(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},b2=function(){var e=S2();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},gS=function(){var e=b2(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},C2={left:0,top:0,right:0,gap:0},gh=function(e){return parseInt(e||"",10)||0},E2=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[gh(n),gh(r),gh(o)]},j2=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return C2;var t=E2(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])}},P2=gS(),T2=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
18
|
+
.`.concat(c2,` {
|
|
19
|
+
overflow: hidden `).concat(r,`;
|
|
20
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
21
|
+
}
|
|
22
|
+
body {
|
|
23
|
+
overflow: hidden `).concat(r,`;
|
|
24
|
+
overscroll-behavior: contain;
|
|
25
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
26
|
+
padding-left: `.concat(o,`px;
|
|
27
|
+
padding-top: `).concat(i,`px;
|
|
28
|
+
padding-right: `).concat(s,`px;
|
|
29
|
+
margin-left:0;
|
|
30
|
+
margin-top:0;
|
|
31
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
32
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.`).concat(bu,` {
|
|
36
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.`).concat(Cu,` {
|
|
40
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.`).concat(bu," .").concat(bu,` {
|
|
44
|
+
right: 0 `).concat(r,`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.`).concat(Cu," .").concat(Cu,` {
|
|
48
|
+
margin-right: 0 `).concat(r,`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
body {
|
|
52
|
+
`).concat(u2,": ").concat(l,`px;
|
|
53
|
+
}
|
|
54
|
+
`)},k2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=p.useMemo(function(){return j2(o)},[o]);return p.createElement(P2,{styles:T2(i,!t,o,n?"":"!important")})},mp=!1;if(typeof window<"u")try{var Wc=Object.defineProperty({},"passive",{get:function(){return mp=!0,!0}});window.addEventListener("test",Wc,Wc),window.removeEventListener("test",Wc,Wc)}catch{mp=!1}var Ps=mp?{passive:!1}:!1,R2=function(e){return e.tagName==="TEXTAREA"},vS=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!R2(e)&&n[t]==="visible")},I2=function(e){return vS(e,"overflowY")},D2=function(e){return vS(e,"overflowX")},E0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=yS(e,r);if(o){var i=xS(e,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},A2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},yS=function(e,t){return e==="v"?I2(t):D2(t)},xS=function(e,t){return e==="v"?_2(t):A2(t)},N2=function(e,t){return e==="h"&&t==="rtl"?-1:1},O2=function(e,t,n,r,o){var i=N2(e,window.getComputedStyle(t).direction),s=i*r,l=n.target,c=t.contains(l),u=!1,d=s>0,f=0,h=0;do{var m=xS(e,l),g=m[0],v=m[1],b=m[2],x=v-b-i*g;(g||x)&&yS(e,l)&&(f+=x,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(o&&Math.abs(f)<1||!o&&s>f)||!d&&(o&&Math.abs(h)<1||!o&&-s>h))&&(u=!0),u},Hc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},j0=function(e){return[e.deltaX,e.deltaY]},P0=function(e){return e&&"current"in e?e.current:e},M2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$2=function(e){return`
|
|
55
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
56
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
57
|
+
`)},L2=0,Ts=[];function F2(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(L2++)[0],i=p.useState(gS)[0],s=p.useRef(e);p.useEffect(function(){s.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=l2([e.lockRef.current],(e.shards||[]).map(P0),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(v,b){if("touches"in v&&v.touches.length===2)return!s.current.allowPinchZoom;var x=Hc(v),y=n.current,w="deltaX"in v?v.deltaX:y[0]-x[0],S="deltaY"in v?v.deltaY:y[1]-x[1],j,E=v.target,P=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in v&&P==="h"&&E.type==="range")return!1;var T=E0(P,E);if(!T)return!0;if(T?j=P:(j=P==="v"?"h":"v",T=E0(P,E)),!T)return!1;if(!r.current&&"changedTouches"in v&&(w||S)&&(r.current=j),!j)return!0;var k=r.current||j;return O2(k,b,v,k==="h"?w:S,!0)},[]),c=p.useCallback(function(v){var b=v;if(!(!Ts.length||Ts[Ts.length-1]!==i)){var x="deltaY"in b?j0(b):Hc(b),y=t.current.filter(function(j){return j.name===b.type&&(j.target===b.target||b.target===j.shadowParent)&&M2(j.delta,x)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var w=(s.current.shards||[]).map(P0).filter(Boolean).filter(function(j){return j.contains(b.target)}),S=w.length>0?l(b,w[0]):!s.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),u=p.useCallback(function(v,b,x,y){var w={name:v,delta:b,target:x,should:y,shadowParent:z2(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=p.useCallback(function(v){n.current=Hc(v),r.current=void 0},[]),f=p.useCallback(function(v){u(v.type,j0(v),v.target,l(v,e.lockRef.current))},[]),h=p.useCallback(function(v){u(v.type,Hc(v),v.target,l(v,e.lockRef.current))},[]);p.useEffect(function(){return Ts.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Ps),document.addEventListener("touchmove",c,Ps),document.addEventListener("touchstart",d,Ps),function(){Ts=Ts.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,Ps),document.removeEventListener("touchmove",c,Ps),document.removeEventListener("touchstart",d,Ps)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(i,{styles:$2(o)}):null,m?p.createElement(k2,{gapMode:e.gapMode}):null)}function z2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const B2=g2(mS,F2);var zd=p.forwardRef(function(e,t){return p.createElement(Fd,Gr({},e,{ref:t,sideCar:B2}))});zd.classNames=Fd.classNames;function ct(e){return Object.keys(e)}function vh(e){return e&&typeof e=="object"&&!Array.isArray(e)}function eg(e,t){const n={...e},r=t;return vh(e)&&vh(t)&&Object.keys(t).forEach(o=>{vh(r[o])&&o in e?n[o]=eg(n[o],r[o]):n[o]=r[o]}),n}function U2(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function V2(e){var t;return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:(t=e.match(/^calc\((.*?)\)$/))==null?void 0:t[1].split("*")[0].trim()}function gp(e){const t=V2(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 yh(e){return`calc(${e} * var(--mantine-scale))`}function wS(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?yh(o):o}if(typeof r=="string"){if(r.startsWith("calc(")||r.startsWith("var(")||r.startsWith("clamp("))return r;if(r.includes(" "))return r.split(" ").map(i=>n(i)).join(" ");if(r.includes(e))return t?yh(r):r;const o=r.replace("px","");if(!Number.isNaN(Number(o))){const i=`${Number(o)/16}${e}`;return t?yh(i):i}}return r}return n}const z=wS("rem",{shouldScale:!0}),Bu=wS("em");function os(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function SS(e){return typeof e=="number"?!0:typeof e=="string"?e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!==""?!0:/[0-9]/.test(e.trim().replace("-","")[0]):!1}function To(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==C.Fragment:!1}function bn(e){const t=p.createContext(null);return[({children:o,value:i})=>C.createElement(t.Provider,{value:i},o),()=>{const o=p.useContext(t);if(o===null)throw new Error(e);return o}]}function rc(e=null){const t=p.createContext(e);return[({children:o,value:i})=>C.createElement(t.Provider,{value:i},o),()=>p.useContext(t)]}function T0(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function Uu(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function W2(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 H2(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 q2(e,t,n){return Uu(e,n)===Uu(t,n)}function bS({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:o=!1,dir:i="rtl",orientation:s}){return l=>{var g;n==null||n(l);const c=Array.from(((g=Uu(l.currentTarget,e))==null?void 0:g.querySelectorAll(t))||[]).filter(v=>q2(l.currentTarget,v,e)),u=c.findIndex(v=>l.currentTarget===v),d=H2(u,c,r),f=W2(u,c,r),h=i==="rtl"?f:d,m=i==="rtl"?d:f;switch(l.key){case"ArrowRight":{s==="horizontal"&&(l.stopPropagation(),l.preventDefault(),c[h].focus(),o&&c[h].click());break}case"ArrowLeft":{s==="horizontal"&&(l.stopPropagation(),l.preventDefault(),c[m].focus(),o&&c[m].click());break}case"ArrowUp":{s==="vertical"&&(l.stopPropagation(),l.preventDefault(),c[f].focus(),o&&c[f].click());break}case"ArrowDown":{s==="vertical"&&(l.stopPropagation(),l.preventDefault(),c[d].focus(),o&&c[d].click());break}case"Home":{l.stopPropagation(),l.preventDefault(),!c[0].disabled&&c[0].focus();break}case"End":{l.stopPropagation(),l.preventDefault();const v=c.length-1;!c[v].disabled&&c[v].focus();break}}}}const G2={app:100,modal:200,popover:300,overlay:400,max:9999};function Nr(e){return G2[e]}const Q2=()=>{};function K2(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||Q2:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function Ee(e,t="size",n=!0){if(e!==void 0)return SS(e)?n?z(e):e:`var(--${t}-${e})`}function en(e){return Ee(e,"mantine-spacing")}function ft(e){return e===void 0?"var(--mantine-radius-default)":Ee(e,"mantine-radius")}function qt(e){return Ee(e,"mantine-font-size")}function CS(e){return Ee(e,"mantine-line-height",!1)}function tg(e){if(e)return Ee(e,"mantine-shadow",!1)}function Un(e,t){return n=>{e==null||e(n),t==null||t(n)}}function ng(e,t){return e in t.breakpoints?gp(t.breakpoints[e]):gp(e)}function Pl(e,t){const n=e.map(r=>({value:r,px:ng(r,t)}));return n.sort((r,o)=>r.px-o.px),n}function Yo(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function Y2(e,t,n){var r;return n?Array.from(((r=Uu(n,t))==null?void 0:r.querySelectorAll(e))||[]).findIndex(o=>o===n):null}function X2(){const[e,t]=p.useState(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}function rg(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function k0(e){return typeof e!="string"?"":e.charAt(0).toUpperCase()+e.slice(1)}function Ni(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Bd(e,t){const n=Ni(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}const R0=["mousedown","touchstart"];function J2(e,t,n){const r=p.useRef();return p.useEffect(()=>{const o=i=>{const{target:s}=i??{};if(Array.isArray(n)){const l=(s==null?void 0:s.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(s)&&s.tagName!=="HTML";n.every(u=>!!u&&!i.composedPath().includes(u))&&!l&&e()}else r.current&&!r.current.contains(s)&&e()};return(t||R0).forEach(i=>document.addEventListener(i,o)),()=>{(t||R0).forEach(i=>document.removeEventListener(i,o))}},[r,e,n]),r}function ES({timeout:e=2e3}={}){const[t,n]=p.useState(null),[r,o]=p.useState(!1),[i,s]=p.useState(null),l=d=>{window.clearTimeout(i),s(window.setTimeout(()=>o(!1),e)),o(d)};return{copy:d=>{"clipboard"in navigator?navigator.clipboard.writeText(d).then(()=>l(!0)).catch(f=>n(f)):n(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{o(!1),n(null),window.clearTimeout(i)},error:t,copied:r}}function Z2(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function eR(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function jS(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=p.useState(n?t:eR(e)),i=p.useRef();return p.useEffect(()=>{if("matchMedia"in window)return i.current=window.matchMedia(e),o(i.current.matches),Z2(i.current,s=>o(s.matches))},[e]),r}function tR(e,t){return jS("(prefers-color-scheme: dark)",e==="dark",t)?"dark":"light"}const Pa=typeof document<"u"?p.useLayoutEffect:p.useEffect;function go(e,t){const n=p.useRef(!1);p.useEffect(()=>()=>{n.current=!1},[]),p.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function PS({opened:e,shouldReturnFocus:t=!0}){const n=p.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return go(()=>{let o=-1;const i=s=>{s.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",i),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",i)}},[e,t]),r}function nR(e,t="body > :not(script)"){const n=rg(),r=Array.from(document.querySelectorAll(t)).map(o=>{var c;if((c=o==null?void 0:o.shadowRoot)!=null&&c.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),s=o.getAttribute("data-hidden"),l=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!s&&!l&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:s||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}const rR=/input|select|textarea|button|object/,TS="a, input, select, textarea, button, object, [tabindex]";function oR(e){return e.style.display==="none"}function iR(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(oR(n))return!1;n=n.parentNode}return!0}function kS(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function vp(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(kS(e));return(rR.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&iR(e)}function RS(e){const t=kS(e);return(Number.isNaN(t)||t>=0)&&vp(e)}function sR(e){return Array.from(e.querySelectorAll(TS)).filter(RS)}function aR(e,t){const n=sR(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();let i=r===o.activeElement||e===o.activeElement;const s=o.activeElement;if(s.tagName==="INPUT"&&s.getAttribute("type")==="radio"&&(i=n.filter(d=>d.getAttribute("type")==="radio"&&d.getAttribute("name")===s.getAttribute("name")).includes(r)),!i)return;t.preventDefault();const c=n[t.shiftKey?n.length-1:0];c&&c.focus()}function lR(e=!0){const t=p.useRef(),n=p.useRef(null),r=i=>{let s=i.querySelector("[data-autofocus]");if(!s){const l=Array.from(i.querySelectorAll(TS));s=l.find(RS)||l.find(vp)||null,!s&&vp(i)&&(s=i)}s&&s.focus({preventScroll:!0})},o=p.useCallback(i=>{if(e){if(i===null){n.current&&(n.current(),n.current=null);return}n.current=nR(i),t.current!==i&&(i?(setTimeout(()=>{i.getRootNode()&&r(i)}),t.current=i):t.current=null)}},[e]);return p.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const i=s=>{s.key==="Tab"&&t.current&&aR(t.current,s)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i),n.current&&n.current()}},[e]),o}const cR=e=>(e+1)%1e6;function uR(){const[,e]=p.useReducer(cR,0);return e}const dR=C.useId||(()=>{});function fR(){const e=dR();return e?`mantine-${e.replace(/:/g,"")}`:""}function Cn(e){const t=fR(),[n,r]=p.useState(t);return Pa(()=>{r(rg())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function IS(e,t,n){p.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function og(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function hR(...e){return t=>{e.forEach(n=>og(n,t))}}function Yt(...e){return p.useCallback(hR(...e),e)}function un({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,i]=p.useState(t!==void 0?t:n),s=(l,...c)=>{i(l),r==null||r(l,...c)};return e!==void 0?[e,r,!0]:[o,s,!1]}function zo(e,t){const n=t-e+1;return Array.from({length:n},(r,o)=>o+e)}const qc="dots";function pR({total:e,siblings:t=1,boundaries:n=1,page:r,initialPage:o=1,onChange:i}){const s=Math.max(Math.trunc(e),0),[l,c]=un({value:r,onChange:i,defaultValue:o,finalValue:o}),u=v=>{v<=0?c(1):v>s?c(s):c(v)},d=()=>u(l+1),f=()=>u(l-1),h=()=>u(1),m=()=>u(s);return{range:p.useMemo(()=>{if(t*2+3+n*2>=s)return zo(1,s);const b=Math.max(l-t,n),x=Math.min(l+t,s-n),y=b>n+2,w=x<s-(n+1);if(!y&&w){const S=t*2+n+2;return[...zo(1,S),qc,...zo(s-(n-1),s)]}if(y&&!w){const S=n+1+2*t;return[...zo(1,n),qc,...zo(s-S,s)]}return[...zo(1,n),qc,...zo(b,x),qc,...zo(s-n+1,s)]},[s,t,l]),active:l,setPage:u,next:d,previous:f,first:h,last:m}}function ig(e,t){return jS("(prefers-reduced-motion: reduce)",e,t)}const mR={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function gR(){const e=p.useRef(0),t=p.useRef(),[n,r]=p.useState(mR),o=p.useMemo(()=>typeof window<"u"?new ResizeObserver(i=>{const s=i[0];s&&(cancelAnimationFrame(e.current),e.current=requestAnimationFrame(()=>{t.current&&r(s.contentRect)}))}):null,[]);return p.useEffect(()=>(t.current&&(o==null||o.observe(t.current)),()=>{o==null||o.disconnect(),e.current&&cancelAnimationFrame(e.current)}),[t.current]),[t,n]}function vR(e=!1,t){const{onOpen:n,onClose:r}=t||{},[o,i]=p.useState(e),s=p.useCallback(()=>{i(u=>u||(n==null||n(),!0))},[n]),l=p.useCallback(()=>{i(u=>u&&(r==null||r(),!1))},[r]),c=p.useCallback(()=>{o?l():s()},[l,s,o]);return[o,{open:s,close:l,toggle:c}]}function yR(e,t,n={autoInvoke:!1}){const r=p.useRef(null),o=p.useCallback((...s)=>{r.current||(r.current=window.setTimeout(()=>{e(s),r.current=null},t))},[t]),i=p.useCallback(()=>{r.current&&(window.clearTimeout(r.current),r.current=null)},[]);return p.useEffect(()=>(n.autoInvoke&&o(),i),[i,o]),{start:o,clear:i}}var xR={};function DS(){return typeof process<"u"&&xR?"production":"development"}function _S(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=_S(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ze(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=_S(e))&&(r&&(r+=" "),r+=t);return r}const wR={};function SR(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=Ze(t[r],o):t[r]=o})}),t}function Ud({theme:e,classNames:t,props:n,stylesCtx:r}){const i=(Array.isArray(t)?t:[t]).map(s=>typeof s=="function"?s(e,n,r):s||wR);return SR(i)}function Vu({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((i,s)=>typeof s=="function"?{...i,...s(e,n,r)}:{...i,...s},{})}const sg=p.createContext(null);function Vd(){const e=p.useContext(sg);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function bR(){return Vd().cssVariablesResolver}function CR(){return Vd().classNamesPrefix}function ag(){return Vd().getStyleNonce}function ER(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function jR(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}if(t.length===8){const s=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:s}}const n=parseInt(t,16),r=n>>16&255,o=n>>8&255,i=n&255;return{r,g:o,b:i,a:1}}function PR(e){const[t,n,r,o]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:o||1}}function TR(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,i=parseInt(n[3],10)/100,s=n[5]?parseFloat(n[5]):void 0,l=(1-Math.abs(2*i-1))*o,c=r/60,u=l*(1-Math.abs(c%2-1)),d=i-l/2;let f,h,m;return c>=0&&c<1?(f=l,h=u,m=0):c>=1&&c<2?(f=u,h=l,m=0):c>=2&&c<3?(f=0,h=l,m=u):c>=3&&c<4?(f=0,h=u,m=l):c>=4&&c<5?(f=u,h=0,m=l):(f=l,h=0,m=u),{r:Math.round((f+d)*255),g:Math.round((h+d)*255),b:Math.round((m+d)*255),a:s||1}}function lg(e){return ER(e)?jR(e):e.startsWith("rgb")?PR(e):e.startsWith("hsl")?TR(e):{r:0,g:0,b:0,a:1}}function Gc(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:o,a:i}=lg(e),s=1-t,l=c=>Math.round(c*s);return`rgba(${l(n)}, ${l(r)}, ${l(o)}, ${i})`}function Wu(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function xh(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function kR(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function RR(e){if(e.startsWith("oklch("))return(kR(e)||0)/100;const{r:t,g:n,b:r}=lg(e),o=t/255,i=n/255,s=r/255,l=xh(o),c=xh(i),u=xh(s);return .2126*l+.7152*c+.0722*u}function Va(e,t=.179){return e.startsWith("var(")?!1:RR(e)>t}function to({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:Va(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:Va(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:Va(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,o]=e.split("."),i=o?Number(o):void 0,s=r in t.colors;if(s){const l=i!==void 0?t.colors[r][i]:t.colors[r][Wu(t,n||"light")];return{color:r,value:l,shade:i,isThemeColor:s,isLight:Va(l,t.luminanceThreshold),variable:o?`--mantine-color-${r}-${i}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:s,isLight:Va(e,t.luminanceThreshold),shade:i,variable:void 0}}function yt(e,t){const n=to({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function yp(e,t){const n={from:(e==null?void 0:e.from)||t.defaultGradient.from,to:(e==null?void 0:e.to)||t.defaultGradient.to,deg:(e==null?void 0:e.deg)||t.defaultGradient.deg||0},r=yt(n.from,t),o=yt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function Zt(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const i=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${i}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:o}=lg(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const IR=({color:e,theme:t,variant:n,gradient:r,autoContrast:o})=>{const i=to({color:e,theme:t}),s=typeof o=="boolean"?o:t.autoContrast;if(n==="filled"){const l=s&&i.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return i.isThemeColor?i.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:l,border:`${z(1)} solid transparent`}:{background:`var(--mantine-color-${i.color}-${i.shade})`,hover:`var(--mantine-color-${i.color}-${i.shade===9?8:i.shade+1})`,color:l,border:`${z(1)} solid transparent`}:{background:e,hover:Gc(e,.1),color:l,border:`${z(1)} solid transparent`}}if(n==="light"){if(i.isThemeColor){if(i.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:`${z(1)} solid transparent`};const l=t.colors[i.color][i.shade];return{background:Zt(l,.1),hover:Zt(l,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${z(1)} solid transparent`}}return{background:Zt(e,.1),hover:Zt(e,.12),color:e,border:`${z(1)} solid transparent`}}if(n==="outline")return i.isThemeColor?i.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${z(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:Zt(t.colors[i.color][i.shade],.05),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${z(1)} solid var(--mantine-color-${i.color}-${i.shade})`}:{background:"transparent",hover:Zt(e,.05),color:e,border:`${z(1)} solid ${e}`};if(n==="subtle"){if(i.isThemeColor){if(i.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${z(1)} solid transparent`};const l=t.colors[i.color][i.shade];return{background:"transparent",hover:Zt(l,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${z(1)} solid transparent`}}return{background:"transparent",hover:Zt(e,.12),color:e,border:`${z(1)} solid transparent`}}return n==="transparent"?i.isThemeColor?i.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${z(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${z(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${z(1)} solid transparent`}:n==="white"?i.isThemeColor?i.shade===void 0?{background:"var(--mantine-color-white)",hover:Gc(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${z(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Gc(t.white,.01),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${z(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Gc(t.white,.01),color:e,border:`${z(1)} solid transparent`}:n==="gradient"?{background:yp(r,t),hover:yp(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:`${z(1)} solid var(--mantine-color-default-border)`}:{}},DR={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"]},I0="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",cg={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:DR,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:IR,autoContrast:!1,luminanceThreshold:.3,fontFamily:I0,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:I0,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:z(34),lineHeight:"1.3"},h2:{fontSize:z(26),lineHeight:"1.35"},h3:{fontSize:z(22),lineHeight:"1.4"},h4:{fontSize:z(18),lineHeight:"1.45"},h5:{fontSize:z(16),lineHeight:"1.5"},h6:{fontSize:z(14),lineHeight:"1.5"}}},fontSizes:{xs:z(12),sm:z(14),md:z(16),lg:z(18),xl:z(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:z(2),sm:z(4),md:z(8),lg:z(16),xl:z(32)},spacing:{xs:z(10),sm:z(12),md:z(16),lg:z(20),xl:z(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${z(1)} ${z(3)} rgba(0, 0, 0, 0.05), 0 ${z(1)} ${z(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${z(1)} ${z(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${z(10)} ${z(15)} ${z(-5)}, rgba(0, 0, 0, 0.04) 0 ${z(7)} ${z(7)} ${z(-5)}`,md:`0 ${z(1)} ${z(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${z(20)} ${z(25)} ${z(-5)}, rgba(0, 0, 0, 0.04) 0 ${z(10)} ${z(10)} ${z(-5)}`,lg:`0 ${z(1)} ${z(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${z(28)} ${z(23)} ${z(-7)}, rgba(0, 0, 0, 0.04) 0 ${z(12)} ${z(12)} ${z(-7)}`,xl:`0 ${z(1)} ${z(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${z(36)} ${z(28)} ${z(-7)}, rgba(0, 0, 0, 0.04) 0 ${z(17)} ${z(17)} ${z(-7)}`},other:{},components:{}};function D0(e){return e==="auto"||e==="dark"||e==="light"}function _R({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 D0(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&&D0(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const AR="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",_0="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function wh(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function A0(e){if(!(e.primaryColor in e.colors))throw new Error(AR);if(typeof e.primaryShade=="object"&&(!wh(e.primaryShade.dark)||!wh(e.primaryShade.light)))throw new Error(_0);if(typeof e.primaryShade=="number"&&!wh(e.primaryShade))throw new Error(_0)}function NR(e,t){var r;if(!t)return A0(e),e;const n=eg(e,t);return t.fontFamily&&!((r=t.headings)!=null&&r.fontFamily)&&(n.headings.fontFamily=t.fontFamily),A0(n),n}const ug=p.createContext(null),OR=()=>p.useContext(ug)||cg;function Pt(){const e=p.useContext(ug);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 AS({theme:e,children:t,inherit:n=!0}){const r=OR(),o=p.useMemo(()=>NR(n?r:cg,e),[e,r,n]);return C.createElement(ug.Provider,{value:o},t)}AS.displayName="@mantine/core/MantineThemeProvider";function MR(){const e=Pt(),t=ag(),n=ct(e.breakpoints).reduce((r,o)=>{const i=e.breakpoints[o].includes("px"),s=gp(e.breakpoints[o]),l=i?`${s-.1}px`:Bu(s-.1),c=i?`${s}px`:Bu(s);return`${r}@media (max-width: ${l}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${c}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return C.createElement("style",{"data-mantine-styles":"classes",nonce:t==null?void 0:t(),dangerouslySetInnerHTML:{__html:n}})}function Sh(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function bh(e,t){return(Array.isArray(e)?e:[e]).reduce((r,o)=>`${o}{${r}}`,t)}function $R(e,t){const n=Sh(e.variables),r=n?bh(t,n):"",o=Sh(e.dark),i=o?bh(`${t}[data-mantine-color-scheme="dark"]`,o):"",s=Sh(e.light),l=s?bh(`${t}[data-mantine-color-scheme="light"]`,s):"";return`${r}${i}${l}`}function is({color:e,theme:t,autoContrast:n=!0}){return(typeof n=="boolean"?n:t.autoContrast)&&to({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function N0(e,t){return is({color:e.colors[e.primaryColor][Wu(e,t)],theme:e,autoContrast:null})}function ks(e,t,n){ct(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const NS=e=>{const t=Wu(e,"dark"),n=Wu(e,"light"),r=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:z(e.defaultRadius),o={variables:{"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-color-scheme":"light dark","--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":r,"--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-primary-color-contrast":N0(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}-${n})`,"--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)"},dark:{"--mantine-primary-color-contrast":N0(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)"}};ks(o.variables,e.breakpoints,"breakpoint"),ks(o.variables,e.spacing,"spacing"),ks(o.variables,e.fontSizes,"font-size"),ks(o.variables,e.lineHeights,"line-height"),ks(o.variables,e.shadows,"shadow"),ks(o.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((s,l)=>{o.variables[`--mantine-primary-color-${l}`]=`var(--mantine-color-${e.primaryColor}-${l})`}),ct(e.colors).forEach(s=>{e.colors[s].forEach((u,d)=>{o.variables[`--mantine-color-${s}-${d}`]=u});const l=`var(--mantine-color-${s}-${n===9?8:n+1})`,c=`var(--mantine-color-${s}-${t===9?8:t+1})`;o.light["--mantine-color-dimmed"]="var(--mantine-color-gray-6)",o.light[`--mantine-color-${s}-text`]=`var(--mantine-color-${s}-filled)`,o.light[`--mantine-color-${s}-filled`]=`var(--mantine-color-${s}-${n})`,o.light[`--mantine-color-${s}-filled-hover`]=l,o.light[`--mantine-color-${s}-light`]=Zt(e.colors[s][n],.1),o.light[`--mantine-color-${s}-light-hover`]=Zt(e.colors[s][n],.12),o.light[`--mantine-color-${s}-light-color`]=`var(--mantine-color-${s}-${n})`,o.light[`--mantine-color-${s}-outline`]=`var(--mantine-color-${s}-${n})`,o.light[`--mantine-color-${s}-outline-hover`]=Zt(e.colors[s][n],.05),o.dark["--mantine-color-dimmed"]="var(--mantine-color-dark-2)",o.dark[`--mantine-color-${s}-text`]=`var(--mantine-color-${s}-4)`,o.dark[`--mantine-color-${s}-filled`]=`var(--mantine-color-${s}-${t})`,o.dark[`--mantine-color-${s}-filled-hover`]=c,o.dark[`--mantine-color-${s}-light`]=Zt(e.colors[s][Math.max(0,t-2)],.15),o.dark[`--mantine-color-${s}-light-hover`]=Zt(e.colors[s][Math.max(0,t-2)],.2),o.dark[`--mantine-color-${s}-light-color`]=`var(--mantine-color-${s}-${Math.max(t-5,0)})`,o.dark[`--mantine-color-${s}-outline`]=`var(--mantine-color-${s}-${Math.max(t-4,0)})`,o.dark[`--mantine-color-${s}-outline-hover`]=Zt(e.colors[s][Math.max(t-4,0)],.05)});const i=e.headings.sizes;return ct(i).forEach(s=>{o.variables[`--mantine-${s}-font-size`]=i[s].fontSize,o.variables[`--mantine-${s}-line-height`]=i[s].lineHeight,o.variables[`--mantine-${s}-font-weight`]=i[s].fontWeight||e.headings.fontWeight}),o};function LR({theme:e,generator:t}){const n=NS(e),r=t==null?void 0:t(e);return r?eg(n,r):n}const Ch=NS(cg);function FR(e){const t={variables:{},light:{},dark:{}};return ct(e.variables).forEach(n=>{Ch.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),ct(e.light).forEach(n=>{Ch.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),ct(e.dark).forEach(n=>{Ch.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function zR(e){return`
|
|
58
|
+
${e}[data-mantine-color-scheme="dark"] { --mantine-color-scheme: dark; }
|
|
59
|
+
${e}[data-mantine-color-scheme="light"] { --mantine-color-scheme: light; }
|
|
60
|
+
`}function OS({cssVariablesSelector:e}){const t=Pt(),n=ag(),r=bR(),o=LR({theme:t,generator:r}),i=e===":root",s=i?FR(o):o,l=$R(s,e);return l?C.createElement("style",{"data-mantine-styles":!0,nonce:n==null?void 0:n(),dangerouslySetInnerHTML:{__html:`${l}${i?"":zR(e)}`}}):null}OS.displayName="@mantine/CssVariables";function BR(){const e=console.error;console.error=(...t)=>{t.length>1&&typeof t[0]=="string"&&t[0].toLowerCase().includes("extra attributes from the server")&&typeof t[1]=="string"&&t[1].toLowerCase().includes("data-mantine-color-scheme")||e(...t)}}function Rs(e,t){var r;const n=e!=="auto"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";(r=t())==null||r.setAttribute("data-mantine-color-scheme",n)}function UR({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const o=p.useRef(),[i,s]=p.useState(()=>e.get(t)),l=r||i,c=p.useCallback(d=>{r||(Rs(d,n),s(d),e.set(d))},[e.set,l,r]),u=p.useCallback(()=>{s(t),Rs(t,n),e.clear()},[e.clear,t]);return p.useEffect(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),Pa(()=>{Rs(e.get(t),n)},[]),p.useEffect(()=>{var f;if(r)return Rs(r,n),()=>{};r===void 0&&Rs(i,n),o.current=window.matchMedia("(prefers-color-scheme: dark)");const d=h=>{i==="auto"&&Rs(h.matches?"dark":"light",n)};return(f=o.current)==null||f.addEventListener("change",d),()=>{var h;return(h=o.current)==null?void 0:h.removeEventListener("change",d)}},[i,r]),{colorScheme:l,setColorScheme:c,clearColorScheme:u}}function VR({respectReducedMotion:e,getRootElement:t}){Pa(()=>{var n;e&&((n=t())==null||n.setAttribute("data-respect-reduced-motion","true"))},[e])}BR();function MS({theme:e,children:t,getStyleNonce:n,withCssVariables:r=!0,cssVariablesSelector:o=":root",classNamesPrefix:i="mantine",colorSchemeManager:s=_R(),defaultColorScheme:l="light",getRootElement:c=()=>document.documentElement,cssVariablesResolver:u,forceColorScheme:d}){const{colorScheme:f,setColorScheme:h,clearColorScheme:m}=UR({defaultColorScheme:l,forceColorScheme:d,manager:s,getRootElement:c});return VR({respectReducedMotion:(e==null?void 0:e.respectReducedMotion)||!1,getRootElement:c}),C.createElement(sg.Provider,{value:{colorSchemeManager:s,colorScheme:f,setColorScheme:h,clearColorScheme:m,getRootElement:c,classNamesPrefix:i,getStyleNonce:n,cssVariablesResolver:u,cssVariablesSelector:o}},C.createElement(AS,{theme:e},r&&C.createElement(OS,{cssVariablesSelector:o}),C.createElement(MR,null),t))}MS.displayName="@mantine/core/MantineProvider";function Wd({classNames:e,styles:t,props:n,stylesCtx:r}){const o=Pt();return{resolvedClassNames:Ud({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:Vu({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const WR={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function HR({theme:e,options:t,unstyled:n}){return Ze((t==null?void 0:t.focusable)&&!n&&(e.focusClassName||WR[e.focusRing]),(t==null?void 0:t.active)&&!n&&e.activeClassName)}function qR({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return Ud({theme:o,classNames:n==null?void 0:n.classNames,props:(n==null?void 0:n.props)||r,stylesCtx:t})[e]}function GR({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return Ud({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function QR({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function KR({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function YR({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(o=>`${t}-${o}-${n}`)}function XR({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(i=>{var s,l;return(l=Ud({theme:t,classNames:(s=t.components[i])==null?void 0:s.classNames,props:r,stylesCtx:o}))==null?void 0:l[n]})}function JR({options:e,classes:t,selector:n,unstyled:r}){return e!=null&&e.variant&&!r?t[`${n}--${e.variant}`]:void 0}function ZR({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:o,classNames:i,classes:s,unstyled:l,className:c,rootSelector:u,props:d,stylesCtx:f}){return Ze(HR({theme:e,options:t,unstyled:l}),XR({theme:e,themeName:n,selector:r,props:d,stylesCtx:f}),JR({options:t,classes:s,selector:r,unstyled:l}),GR({selector:r,stylesCtx:f,theme:e,classNames:i,props:d}),qR({selector:r,stylesCtx:f,options:t,props:d,theme:e}),QR({rootSelector:u,selector:r,className:c}),KR({selector:r,classes:s,unstyled:l}),YR({themeName:n,classNamesPrefix:o,selector:r,withStaticClass:t==null?void 0:t.withStaticClass}),t==null?void 0:t.className)}function eI({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(i=>{var s;return Vu({theme:e,styles:(s=e.components[i])==null?void 0:s.styles,props:n,stylesCtx:r})[o]}).reduce((i,s)=>({...i,...s}),{})}function xp({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...xp({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function tI(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...os(n[r])}}),t),{})}function nI({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:i,themeName:s}){var l;return(l=tI([t==null?void 0:t(n,r,o),...s.map(c=>{var u,d,f;return(f=(d=(u=n.components)==null?void 0:u[c])==null?void 0:d.vars)==null?void 0:f.call(d,n,r,o)}),e==null?void 0:e(n,r,o)]))==null?void 0:l[i]}function rI({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:i,rootSelector:s,styles:l,style:c,vars:u,varsResolver:d}){return{...eI({theme:e,themeName:t,props:o,stylesCtx:i,selector:n}),...Vu({theme:e,styles:l,props:o,stylesCtx:i})[n],...Vu({theme:e,styles:r==null?void 0:r.styles,props:(r==null?void 0:r.props)||o,stylesCtx:i})[n],...nI({theme:e,props:o,stylesCtx:i,vars:u,varsResolver:d,selector:n,themeName:t}),...s===n?xp({style:c,theme:e}):null,...xp({style:r==null?void 0:r.style,theme:e})}}function fe({name:e,classes:t,props:n,stylesCtx:r,className:o,style:i,rootSelector:s="root",unstyled:l,classNames:c,styles:u,vars:d,varsResolver:f}){const h=Pt(),m=CR(),g=(Array.isArray(e)?e:[e]).filter(v=>v);return(v,b)=>({className:ZR({theme:h,options:b,themeName:g,selector:v,classNamesPrefix:m,classNames:c,classes:t,unstyled:l,className:o,rootSelector:s,props:n,stylesCtx:r}),style:rI({theme:h,themeName:g,selector:v,options:b,props:n,stylesCtx:r,rootSelector:s,styles:u,style:i,vars:d,varsResolver:f})})}function oc(e,t){return typeof e=="boolean"?e:t.autoContrast}function O0(){const e=document.createElement("style");return e.innerHTML="*, *::before, *::after {transition: none !important;}",e.setAttribute("data-mantine-disable-transition","true"),document.head.appendChild(e),()=>document.querySelectorAll("[data-mantine-disable-transition]").forEach(n=>n.remove())}function oI({keepTransitions:e}={}){const t=p.useRef(),n=p.useRef(),r=p.useContext(sg);if(!r)throw new Error("[@mantine/core] MantineProvider was not found in tree");const o=u=>{r.setColorScheme(u),t.current=e?()=>{}:O0(),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var d;(d=t.current)==null||d.call(t)},10)},i=()=>{r.clearColorScheme(),t.current=e?()=>{}:O0(),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var u;(u=t.current)==null||u.call(t)},10)},s=tR("light",{getInitialValueInEffect:!1}),l=r.colorScheme==="auto"?s:r.colorScheme,c=p.useCallback(()=>o(l==="light"?"dark":"light"),[o,l]);return p.useEffect(()=>()=>{var u;(u=t.current)==null||u.call(t),window.clearTimeout(n.current)},[]),{colorScheme:r.colorScheme,setColorScheme:o,clearColorScheme:i,toggleColorScheme:c}}function U(e,t,n){var s;const r=Pt(),o=(s=r.components[e])==null?void 0:s.defaultProps,i=typeof o=="function"?o(r):o;return{...t,...i,...os(n)}}function M0(e){return ct(e).reduce((t,n)=>e[n]!==void 0?`${t}${U2(n)}:${e[n]};`:t,"").trim()}function iI({selector:e,styles:t,media:n}){const r=t?M0(t):"",o=Array.isArray(n)?n.map(i=>`@media${i.query}{${e}{${M0(i.styles)}}}`):[];return`${r?`${e}{${r}}`:""}${o.join("")}`.trim()}function Ta({selector:e,styles:t,media:n}){const r=ag();return C.createElement("style",{"data-mantine-styles":"inline",nonce:r==null?void 0:r(),dangerouslySetInnerHTML:{__html:iI({selector:e,styles:t,media:n})}})}function ko(e){const{m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:l,p:c,px:u,py:d,pt:f,pb:h,pl:m,pr:g,bg:v,c:b,opacity:x,ff:y,fz:w,fw:S,lts:j,ta:E,lh:P,fs:T,tt:k,td:I,w:O,miw:R,maw:M,h:N,mih:B,mah:D,bgsz:$,bgp:_,bgr:F,bga:H,pos:G,top:oe,left:be,bottom:je,right:Ae,inset:ke,display:Ie,flex:Qe,hiddenFrom:qe,visibleFrom:ht,lightHidden:X,darkHidden:Pe,...Ne}=e;return{styleProps:os({m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:l,p:c,px:u,py:d,pt:f,pb:h,pl:m,pr:g,bg:v,c:b,opacity:x,ff:y,fz:w,fw:S,lts:j,ta:E,lh:P,fs:T,tt:k,td:I,w:O,miw:R,maw:M,h:N,mih:B,mah:D,bgsz:$,bgp:_,bgr:F,bga:H,pos:G,top:oe,left:be,bottom:je,right:Ae,inset:ke,display:Ie,flex:Qe,hiddenFrom:qe,visibleFrom:ht,lightHidden:X,darkHidden:Pe}),rest:Ne}}const sI={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"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},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"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},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:"identity",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 $S(e,t){const n=to({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 aI(e,t){const n=to({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:$S(e,t)}const $0={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)"};function lI(e){return typeof e=="string"&&e in $0?$0[e]:e}function cI(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="number"||typeof e=="string"?z(e):e}function uI(e){return e}function dI(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:e}function fI(e){return typeof e=="number"?z(e):e}function hI(e,t){if(typeof e=="number")return z(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return z(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const Eh={color:$S,textColor:aI,fontSize:cI,spacing:hI,identity:uI,size:fI,lineHeight:dI,fontFamily:lI};function L0(e){return e.replace("(min-width: ","").replace("em)","")}function pI({media:e,...t}){const r=Object.keys(e).sort((o,i)=>Number(L0(o))-Number(L0(i))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function mI(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function gI(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function vI(e){return typeof e=="object"&&e!==null?ct(e).filter(t=>t!=="base"):[]}function yI(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function LS({styleProps:e,data:t,theme:n}){return pI(ct(e).reduce((r,o)=>{if(o==="hiddenFrom"||o==="visibleFrom")return r;const i=t[o],s=Array.isArray(i.property)?i.property:[i.property],l=gI(e[o]);if(!mI(e[o]))return s.forEach(u=>{r.inlineStyles[u]=Eh[i.type](l,n)}),r;r.hasResponsiveStyles=!0;const c=vI(e[o]);return s.forEach(u=>{l&&(r.styles[u]=Eh[i.type](l,n)),c.forEach(d=>{const f=`(min-width: ${n.breakpoints[d]})`;r.media[f]={...r.media[f],[u]:Eh[i.type](yI(e[o],d),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function ic(){return`__m__-${p.useId().replace(/:/g,"")}`}function FS(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...FS(r,t)}),{}):typeof e=="function"?e(t):e??{}}function zS(e){return e.startsWith("data-")?e:`data-${e}`}function xI(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[zS(n)]=e[n]),t},{})}function BS(e){return e?typeof e=="string"?{[zS(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...BS(n)}),{}):xI(e):null}function wp(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...wp(r,t)}),{}):typeof e=="function"?e(t):e??{}}function wI({theme:e,style:t,vars:n,styleProps:r}){const o=wp(t,e),i=wp(n,e);return{...o,...i,...r}}const US=p.forwardRef(({component:e,style:t,__vars:n,className:r,variant:o,mod:i,size:s,hiddenFrom:l,visibleFrom:c,lightHidden:u,darkHidden:d,renderRoot:f,...h},m)=>{const g=Pt(),v=e||"div",{styleProps:b,rest:x}=ko(h),y=ic(),w=LS({styleProps:b,theme:g,data:sI}),S={ref:m,style:wI({theme:g,style:t,vars:n,styleProps:w.inlineStyles}),className:Ze(r,{[y]:w.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":d,[`mantine-hidden-from-${l}`]:l,[`mantine-visible-from-${c}`]:c}),"data-variant":o,"data-size":SS(s)?void 0:s||void 0,...BS(i),...x};return C.createElement(C.Fragment,null,w.hasResponsiveStyles&&C.createElement(Ta,{selector:`.${y}`,styles:w.styles,media:w.media}),typeof f=="function"?f(S):C.createElement(v,{...S}))});US.displayName="@mantine/core/Box";const q=US;function VS(e){return e}function Q(e){const t=p.forwardRef(e);return t.extend=VS,t}function fn(e){const t=p.forwardRef(e);return t.extend=VS,t}const SI=p.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function ss(){return p.useContext(SI)}var WS={exports:{}},Kn={},HS={exports:{}},qS={};/**
|
|
61
|
+
* @license React
|
|
62
|
+
* scheduler.production.min.js
|
|
63
|
+
*
|
|
64
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
65
|
+
*
|
|
66
|
+
* This source code is licensed under the MIT license found in the
|
|
67
|
+
* LICENSE file in the root directory of this source tree.
|
|
68
|
+
*/(function(e){function t(_,F){var H=_.length;_.push(F);e:for(;0<H;){var G=H-1>>>1,oe=_[G];if(0<o(oe,F))_[G]=F,_[H]=oe,H=G;else break e}}function n(_){return _.length===0?null:_[0]}function r(_){if(_.length===0)return null;var F=_[0],H=_.pop();if(H!==F){_[0]=H;e:for(var G=0,oe=_.length,be=oe>>>1;G<be;){var je=2*(G+1)-1,Ae=_[je],ke=je+1,Ie=_[ke];if(0>o(Ae,H))ke<oe&&0>o(Ie,Ae)?(_[G]=Ie,_[ke]=H,G=ke):(_[G]=Ae,_[je]=H,G=je);else if(ke<oe&&0>o(Ie,H))_[G]=Ie,_[ke]=H,G=ke;else break e}}return F}function o(_,F){var H=_.sortIndex-F.sortIndex;return H!==0?H:_.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,m=!1,g=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(_){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=_)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function S(_){if(v=!1,w(_),!g)if(n(c)!==null)g=!0,D(j);else{var F=n(u);F!==null&&$(S,F.startTime-_)}}function j(_,F){g=!1,v&&(v=!1,x(T),T=-1),m=!0;var H=h;try{for(w(F),f=n(c);f!==null&&(!(f.expirationTime>F)||_&&!O());){var G=f.callback;if(typeof G=="function"){f.callback=null,h=f.priorityLevel;var oe=G(f.expirationTime<=F);F=e.unstable_now(),typeof oe=="function"?f.callback=oe:f===n(c)&&r(c),w(F)}else r(c);f=n(c)}if(f!==null)var be=!0;else{var je=n(u);je!==null&&$(S,je.startTime-F),be=!1}return be}finally{f=null,h=H,m=!1}}var E=!1,P=null,T=-1,k=5,I=-1;function O(){return!(e.unstable_now()-I<k)}function R(){if(P!==null){var _=e.unstable_now();I=_;var F=!0;try{F=P(!0,_)}finally{F?M():(E=!1,P=null)}}else E=!1}var M;if(typeof y=="function")M=function(){y(R)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,B=N.port2;N.port1.onmessage=R,M=function(){B.postMessage(null)}}else M=function(){b(R,0)};function D(_){P=_,E||(E=!0,M())}function $(_,F){T=b(function(){_(e.unstable_now())},F)}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(_){_.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,D(j))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(_){switch(h){case 1:case 2:case 3:var F=3;break;default:F=h}var H=h;h=F;try{return _()}finally{h=H}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,F){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var H=h;h=_;try{return F()}finally{h=H}},e.unstable_scheduleCallback=function(_,F,H){var G=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?G+H:G):H=G,_){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=H+oe,_={id:d++,callback:F,priorityLevel:_,startTime:H,expirationTime:oe,sortIndex:-1},H>G?(_.sortIndex=H,t(u,_),n(c)===null&&_===n(u)&&(v?(x(T),T=-1):v=!0,$(S,H-G))):(_.sortIndex=oe,t(c,_),g||m||(g=!0,D(j))),_},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(_){var F=h;return function(){var H=h;h=F;try{return _.apply(this,arguments)}finally{h=H}}}})(qS);HS.exports=qS;var bI=HS.exports;/**
|
|
69
|
+
* @license React
|
|
70
|
+
* react-dom.production.min.js
|
|
71
|
+
*
|
|
72
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the MIT license found in the
|
|
75
|
+
* LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/var GS=p,Gn=bI;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var QS=new Set,Tl={};function as(e,t){aa(e,t),aa(e+"Capture",t)}function aa(e,t){for(Tl[e]=t,e=0;e<t.length;e++)QS.add(t[e])}var vo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sp=Object.prototype.hasOwnProperty,CI=/^[: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]*$/,F0={},z0={};function EI(e){return Sp.call(z0,e)?!0:Sp.call(F0,e)?!1:CI.test(e)?z0[e]=!0:(F0[e]=!0,!1)}function jI(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function PI(e,t,n,r){if(t===null||typeof t>"u"||jI(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function En(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var rn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){rn[e]=new En(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];rn[t]=new En(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){rn[e]=new En(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){rn[e]=new En(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){rn[e]=new En(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){rn[e]=new En(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){rn[e]=new En(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){rn[e]=new En(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){rn[e]=new En(e,5,!1,e.toLowerCase(),null,!1,!1)});var dg=/[\-:]([a-z])/g;function fg(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(dg,fg);rn[t]=new En(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(dg,fg);rn[t]=new En(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(dg,fg);rn[t]=new En(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){rn[e]=new En(e,1,!1,e.toLowerCase(),null,!1,!1)});rn.xlinkHref=new En("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){rn[e]=new En(e,1,!1,e.toLowerCase(),null,!0,!0)});function hg(e,t,n,r){var o=rn.hasOwnProperty(t)?rn[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(PI(t,n,o,r)&&(n=null),r||o===null?EI(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ro=GS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Qc=Symbol.for("react.element"),Ms=Symbol.for("react.portal"),$s=Symbol.for("react.fragment"),pg=Symbol.for("react.strict_mode"),bp=Symbol.for("react.profiler"),KS=Symbol.for("react.provider"),YS=Symbol.for("react.context"),mg=Symbol.for("react.forward_ref"),Cp=Symbol.for("react.suspense"),Ep=Symbol.for("react.suspense_list"),gg=Symbol.for("react.memo"),Vo=Symbol.for("react.lazy"),XS=Symbol.for("react.offscreen"),B0=Symbol.iterator;function Wa(e){return e===null||typeof e!="object"?null:(e=B0&&e[B0]||e["@@iterator"],typeof e=="function"?e:null)}var jt=Object.assign,jh;function ll(e){if(jh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);jh=t&&t[1]||""}return`
|
|
77
|
+
`+jh+e}var Ph=!1;function Th(e,t){if(!e||Ph)return"";Ph=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.stack.split(`
|
|
78
|
+
`),i=r.stack.split(`
|
|
79
|
+
`),s=o.length-1,l=i.length-1;1<=s&&0<=l&&o[s]!==i[l];)l--;for(;1<=s&&0<=l;s--,l--)if(o[s]!==i[l]){if(s!==1||l!==1)do if(s--,l--,0>l||o[s]!==i[l]){var c=`
|
|
80
|
+
`+o[s].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=s&&0<=l);break}}}finally{Ph=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ll(e):""}function TI(e){switch(e.tag){case 5:return ll(e.type);case 16:return ll("Lazy");case 13:return ll("Suspense");case 19:return ll("SuspenseList");case 0:case 2:case 15:return e=Th(e.type,!1),e;case 11:return e=Th(e.type.render,!1),e;case 1:return e=Th(e.type,!0),e;default:return""}}function jp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $s:return"Fragment";case Ms:return"Portal";case bp:return"Profiler";case pg:return"StrictMode";case Cp:return"Suspense";case Ep:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case YS:return(e.displayName||"Context")+".Consumer";case KS:return(e._context.displayName||"Context")+".Provider";case mg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case gg:return t=e.displayName||null,t!==null?t:jp(e.type)||"Memo";case Vo:t=e._payload,e=e._init;try{return jp(e(t))}catch{}}return null}function kI(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return jp(t);case 8:return t===pg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function di(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function JS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function RI(e){var t=JS(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Kc(e){e._valueTracker||(e._valueTracker=RI(e))}function ZS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=JS(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hu(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Pp(e,t){var n=t.checked;return jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function U0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=di(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function eb(e,t){t=t.checked,t!=null&&hg(e,"checked",t,!1)}function Tp(e,t){eb(e,t);var n=di(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?kp(e,t.type,n):t.hasOwnProperty("defaultValue")&&kp(e,t.type,di(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function V0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function kp(e,t,n){(t!=="number"||Hu(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var cl=Array.isArray;function Js(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+di(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Rp(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(K(91));return jt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function W0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(K(92));if(cl(n)){if(1<n.length)throw Error(K(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:di(n)}}function tb(e,t){var n=di(t.value),r=di(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function H0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function nb(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ip(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?nb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Yc,rb=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Yc=Yc||document.createElement("div"),Yc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Yc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function kl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ml={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},II=["Webkit","ms","Moz","O"];Object.keys(ml).forEach(function(e){II.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ml[t]=ml[e]})});function ob(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ml.hasOwnProperty(e)&&ml[e]?(""+t).trim():t+"px"}function ib(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=ob(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var DI=jt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Dp(e,t){if(t){if(DI[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function _p(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Ap=null;function vg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Np=null,Zs=null,ea=null;function q0(e){if(e=lc(e)){if(typeof Np!="function")throw Error(K(280));var t=e.stateNode;t&&(t=Kd(t),Np(e.stateNode,e.type,t))}}function sb(e){Zs?ea?ea.push(e):ea=[e]:Zs=e}function ab(){if(Zs){var e=Zs,t=ea;if(ea=Zs=null,q0(e),t)for(e=0;e<t.length;e++)q0(t[e])}}function lb(e,t){return e(t)}function cb(){}var kh=!1;function ub(e,t,n){if(kh)return e(t,n);kh=!0;try{return lb(e,t,n)}finally{kh=!1,(Zs!==null||ea!==null)&&(cb(),ab())}}function Rl(e,t){var n=e.stateNode;if(n===null)return null;var r=Kd(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(K(231,t,typeof n));return n}var Op=!1;if(vo)try{var Ha={};Object.defineProperty(Ha,"passive",{get:function(){Op=!0}}),window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{Op=!1}function _I(e,t,n,r,o,i,s,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var gl=!1,qu=null,Gu=!1,Mp=null,AI={onError:function(e){gl=!0,qu=e}};function NI(e,t,n,r,o,i,s,l,c){gl=!1,qu=null,_I.apply(AI,arguments)}function OI(e,t,n,r,o,i,s,l,c){if(NI.apply(this,arguments),gl){if(gl){var u=qu;gl=!1,qu=null}else throw Error(K(198));Gu||(Gu=!0,Mp=u)}}function ls(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function db(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function G0(e){if(ls(e)!==e)throw Error(K(188))}function MI(e){var t=e.alternate;if(!t){if(t=ls(e),t===null)throw Error(K(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return G0(o),e;if(i===r)return G0(o),t;i=i.sibling}throw Error(K(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(K(189))}}if(n.alternate!==r)throw Error(K(190))}if(n.tag!==3)throw Error(K(188));return n.stateNode.current===n?e:t}function fb(e){return e=MI(e),e!==null?hb(e):null}function hb(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=hb(e);if(t!==null)return t;e=e.sibling}return null}var pb=Gn.unstable_scheduleCallback,Q0=Gn.unstable_cancelCallback,$I=Gn.unstable_shouldYield,LI=Gn.unstable_requestPaint,Mt=Gn.unstable_now,FI=Gn.unstable_getCurrentPriorityLevel,yg=Gn.unstable_ImmediatePriority,mb=Gn.unstable_UserBlockingPriority,Qu=Gn.unstable_NormalPriority,zI=Gn.unstable_LowPriority,gb=Gn.unstable_IdlePriority,Hd=null,Yr=null;function BI(e){if(Yr&&typeof Yr.onCommitFiberRoot=="function")try{Yr.onCommitFiberRoot(Hd,e,void 0,(e.current.flags&128)===128)}catch{}}var Tr=Math.clz32?Math.clz32:WI,UI=Math.log,VI=Math.LN2;function WI(e){return e>>>=0,e===0?32:31-(UI(e)/VI|0)|0}var Xc=64,Jc=4194304;function ul(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ku(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=ul(l):(i&=s,i!==0&&(r=ul(i)))}else s=n&~o,s!==0?r=ul(s):i!==0&&(r=ul(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Tr(t),o=1<<n,r|=e[n],t&=~o;return r}function HI(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qI(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Tr(i),l=1<<s,c=o[s];c===-1?(!(l&n)||l&r)&&(o[s]=HI(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function $p(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function vb(){var e=Xc;return Xc<<=1,!(Xc&4194240)&&(Xc=64),e}function Rh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function sc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tr(t),e[t]=n}function GI(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Tr(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function xg(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tr(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Je=0;function yb(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var xb,wg,wb,Sb,bb,Lp=!1,Zc=[],ti=null,ni=null,ri=null,Il=new Map,Dl=new Map,Qo=[],QI="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 submit".split(" ");function K0(e,t){switch(e){case"focusin":case"focusout":ti=null;break;case"dragenter":case"dragleave":ni=null;break;case"mouseover":case"mouseout":ri=null;break;case"pointerover":case"pointerout":Il.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dl.delete(t.pointerId)}}function qa(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=lc(t),t!==null&&wg(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function KI(e,t,n,r,o){switch(t){case"focusin":return ti=qa(ti,e,t,n,r,o),!0;case"dragenter":return ni=qa(ni,e,t,n,r,o),!0;case"mouseover":return ri=qa(ri,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Il.set(i,qa(Il.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Dl.set(i,qa(Dl.get(i)||null,e,t,n,r,o)),!0}return!1}function Cb(e){var t=Mi(e.target);if(t!==null){var n=ls(t);if(n!==null){if(t=n.tag,t===13){if(t=db(n),t!==null){e.blockedOn=t,bb(e.priority,function(){wb(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Eu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Fp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ap=r,n.target.dispatchEvent(r),Ap=null}else return t=lc(n),t!==null&&wg(t),e.blockedOn=n,!1;t.shift()}return!0}function Y0(e,t,n){Eu(e)&&n.delete(t)}function YI(){Lp=!1,ti!==null&&Eu(ti)&&(ti=null),ni!==null&&Eu(ni)&&(ni=null),ri!==null&&Eu(ri)&&(ri=null),Il.forEach(Y0),Dl.forEach(Y0)}function Ga(e,t){e.blockedOn===t&&(e.blockedOn=null,Lp||(Lp=!0,Gn.unstable_scheduleCallback(Gn.unstable_NormalPriority,YI)))}function _l(e){function t(o){return Ga(o,e)}if(0<Zc.length){Ga(Zc[0],e);for(var n=1;n<Zc.length;n++){var r=Zc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ti!==null&&Ga(ti,e),ni!==null&&Ga(ni,e),ri!==null&&Ga(ri,e),Il.forEach(t),Dl.forEach(t),n=0;n<Qo.length;n++)r=Qo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qo.length&&(n=Qo[0],n.blockedOn===null);)Cb(n),n.blockedOn===null&&Qo.shift()}var ta=Ro.ReactCurrentBatchConfig,Yu=!0;function XI(e,t,n,r){var o=Je,i=ta.transition;ta.transition=null;try{Je=1,Sg(e,t,n,r)}finally{Je=o,ta.transition=i}}function JI(e,t,n,r){var o=Je,i=ta.transition;ta.transition=null;try{Je=4,Sg(e,t,n,r)}finally{Je=o,ta.transition=i}}function Sg(e,t,n,r){if(Yu){var o=Fp(e,t,n,r);if(o===null)Fh(e,t,r,Xu,n),K0(e,r);else if(KI(o,e,t,n,r))r.stopPropagation();else if(K0(e,r),t&4&&-1<QI.indexOf(e)){for(;o!==null;){var i=lc(o);if(i!==null&&xb(i),i=Fp(e,t,n,r),i===null&&Fh(e,t,r,Xu,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Fh(e,t,r,null,n)}}var Xu=null;function Fp(e,t,n,r){if(Xu=null,e=vg(r),e=Mi(e),e!==null)if(t=ls(e),t===null)e=null;else if(n=t.tag,n===13){if(e=db(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Xu=e,null}function Eb(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(FI()){case yg:return 1;case mb:return 4;case Qu:case zI:return 16;case gb:return 536870912;default:return 16}default:return 16}}var Xo=null,bg=null,ju=null;function jb(){if(ju)return ju;var e,t=bg,n=t.length,r,o="value"in Xo?Xo.value:Xo.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return ju=o.slice(e,1<r?1-r:void 0)}function Pu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function eu(){return!0}function X0(){return!1}function Yn(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?eu:X0,this.isPropagationStopped=X0,this}return jt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),t}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cg=Yn(ka),ac=jt({},ka,{view:0,detail:0}),ZI=Yn(ac),Ih,Dh,Qa,qd=jt({},ac,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Eg,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Qa&&(Qa&&e.type==="mousemove"?(Ih=e.screenX-Qa.screenX,Dh=e.screenY-Qa.screenY):Dh=Ih=0,Qa=e),Ih)},movementY:function(e){return"movementY"in e?e.movementY:Dh}}),J0=Yn(qd),eD=jt({},qd,{dataTransfer:0}),tD=Yn(eD),nD=jt({},ac,{relatedTarget:0}),_h=Yn(nD),rD=jt({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),oD=Yn(rD),iD=jt({},ka,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sD=Yn(iD),aD=jt({},ka,{data:0}),Z0=Yn(aD),lD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cD={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"},uD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dD(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=uD[e])?!!t[e]:!1}function Eg(){return dD}var fD=jt({},ac,{key:function(e){if(e.key){var t=lD[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Pu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cD[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Eg,charCode:function(e){return e.type==="keypress"?Pu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Pu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),hD=Yn(fD),pD=jt({},qd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ex=Yn(pD),mD=jt({},ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eg}),gD=Yn(mD),vD=jt({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),yD=Yn(vD),xD=jt({},qd,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),wD=Yn(xD),SD=[9,13,27,32],jg=vo&&"CompositionEvent"in window,vl=null;vo&&"documentMode"in document&&(vl=document.documentMode);var bD=vo&&"TextEvent"in window&&!vl,Pb=vo&&(!jg||vl&&8<vl&&11>=vl),tx=" ",nx=!1;function Tb(e,t){switch(e){case"keyup":return SD.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ls=!1;function CD(e,t){switch(e){case"compositionend":return kb(t);case"keypress":return t.which!==32?null:(nx=!0,tx);case"textInput":return e=t.data,e===tx&&nx?null:e;default:return null}}function ED(e,t){if(Ls)return e==="compositionend"||!jg&&Tb(e,t)?(e=jb(),ju=bg=Xo=null,Ls=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Pb&&t.locale!=="ko"?null:t.data;default:return null}}var jD={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 rx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jD[e.type]:t==="textarea"}function Rb(e,t,n,r){sb(r),t=Ju(t,"onChange"),0<t.length&&(n=new Cg("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var yl=null,Al=null;function PD(e){zb(e,0)}function Gd(e){var t=Bs(e);if(ZS(t))return e}function TD(e,t){if(e==="change")return t}var Ib=!1;if(vo){var Ah;if(vo){var Nh="oninput"in document;if(!Nh){var ox=document.createElement("div");ox.setAttribute("oninput","return;"),Nh=typeof ox.oninput=="function"}Ah=Nh}else Ah=!1;Ib=Ah&&(!document.documentMode||9<document.documentMode)}function ix(){yl&&(yl.detachEvent("onpropertychange",Db),Al=yl=null)}function Db(e){if(e.propertyName==="value"&&Gd(Al)){var t=[];Rb(t,Al,e,vg(e)),ub(PD,t)}}function kD(e,t,n){e==="focusin"?(ix(),yl=t,Al=n,yl.attachEvent("onpropertychange",Db)):e==="focusout"&&ix()}function RD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gd(Al)}function ID(e,t){if(e==="click")return Gd(t)}function DD(e,t){if(e==="input"||e==="change")return Gd(t)}function _D(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ir=typeof Object.is=="function"?Object.is:_D;function Nl(e,t){if(Ir(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!Sp.call(t,o)||!Ir(e[o],t[o]))return!1}return!0}function sx(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ax(e,t){var n=sx(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=sx(n)}}function _b(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_b(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ab(){for(var e=window,t=Hu();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Hu(e.document)}return t}function Pg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function AD(e){var t=Ab(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_b(n.ownerDocument.documentElement,n)){if(r!==null&&Pg(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=ax(n,i);var s=ax(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ND=vo&&"documentMode"in document&&11>=document.documentMode,Fs=null,zp=null,xl=null,Bp=!1;function lx(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bp||Fs==null||Fs!==Hu(r)||(r=Fs,"selectionStart"in r&&Pg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),xl&&Nl(xl,r)||(xl=r,r=Ju(zp,"onSelect"),0<r.length&&(t=new Cg("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Fs)))}function tu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var zs={animationend:tu("Animation","AnimationEnd"),animationiteration:tu("Animation","AnimationIteration"),animationstart:tu("Animation","AnimationStart"),transitionend:tu("Transition","TransitionEnd")},Oh={},Nb={};vo&&(Nb=document.createElement("div").style,"AnimationEvent"in window||(delete zs.animationend.animation,delete zs.animationiteration.animation,delete zs.animationstart.animation),"TransitionEvent"in window||delete zs.transitionend.transition);function Qd(e){if(Oh[e])return Oh[e];if(!zs[e])return e;var t=zs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nb)return Oh[e]=t[n];return e}var Ob=Qd("animationend"),Mb=Qd("animationiteration"),$b=Qd("animationstart"),Lb=Qd("transitionend"),Fb=new Map,cx="abort auxClick 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(" ");function vi(e,t){Fb.set(e,t),as(t,[e])}for(var Mh=0;Mh<cx.length;Mh++){var $h=cx[Mh],OD=$h.toLowerCase(),MD=$h[0].toUpperCase()+$h.slice(1);vi(OD,"on"+MD)}vi(Ob,"onAnimationEnd");vi(Mb,"onAnimationIteration");vi($b,"onAnimationStart");vi("dblclick","onDoubleClick");vi("focusin","onFocus");vi("focusout","onBlur");vi(Lb,"onTransitionEnd");aa("onMouseEnter",["mouseout","mouseover"]);aa("onMouseLeave",["mouseout","mouseover"]);aa("onPointerEnter",["pointerout","pointerover"]);aa("onPointerLeave",["pointerout","pointerover"]);as("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));as("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));as("onBeforeInput",["compositionend","keypress","textInput","paste"]);as("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));as("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));as("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dl="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(" "),$D=new Set("cancel close invalid load scroll toggle".split(" ").concat(dl));function ux(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,OI(r,t,void 0,e),e.currentTarget=null}function zb(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var l=r[s],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&o.isPropagationStopped())break e;ux(o,l,u),i=c}else for(s=0;s<r.length;s++){if(l=r[s],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&o.isPropagationStopped())break e;ux(o,l,u),i=c}}}if(Gu)throw e=Mp,Gu=!1,Mp=null,e}function pt(e,t){var n=t[qp];n===void 0&&(n=t[qp]=new Set);var r=e+"__bubble";n.has(r)||(Bb(t,e,2,!1),n.add(r))}function Lh(e,t,n){var r=0;t&&(r|=4),Bb(n,e,r,t)}var nu="_reactListening"+Math.random().toString(36).slice(2);function Ol(e){if(!e[nu]){e[nu]=!0,QS.forEach(function(n){n!=="selectionchange"&&($D.has(n)||Lh(n,!1,e),Lh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[nu]||(t[nu]=!0,Lh("selectionchange",!1,t))}}function Bb(e,t,n,r){switch(Eb(t)){case 1:var o=XI;break;case 4:o=JI;break;default:o=Sg}n=o.bind(null,t,n,e),o=void 0,!Op||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Fh(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var c=s.tag;if((c===3||c===4)&&(c=s.stateNode.containerInfo,c===o||c.nodeType===8&&c.parentNode===o))return;s=s.return}for(;l!==null;){if(s=Mi(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}ub(function(){var u=i,d=vg(n),f=[];e:{var h=Fb.get(e);if(h!==void 0){var m=Cg,g=e;switch(e){case"keypress":if(Pu(n)===0)break e;case"keydown":case"keyup":m=hD;break;case"focusin":g="focus",m=_h;break;case"focusout":g="blur",m=_h;break;case"beforeblur":case"afterblur":m=_h;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=J0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=tD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=gD;break;case Ob:case Mb:case $b:m=oD;break;case Lb:m=yD;break;case"scroll":m=ZI;break;case"wheel":m=wD;break;case"copy":case"cut":case"paste":m=sD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=ex}var v=(t&4)!==0,b=!v&&e==="scroll",x=v?h!==null?h+"Capture":null:h;v=[];for(var y=u,w;y!==null;){w=y;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,x!==null&&(S=Rl(y,x),S!=null&&v.push(Ml(y,S,w)))),b)break;y=y.return}0<v.length&&(h=new m(h,g,null,n,d),f.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==Ap&&(g=n.relatedTarget||n.fromElement)&&(Mi(g)||g[yo]))break e;if((m||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=u,g=g?Mi(g):null,g!==null&&(b=ls(g),g!==b||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(v=J0,S="onMouseLeave",x="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(v=ex,S="onPointerLeave",x="onPointerEnter",y="pointer"),b=m==null?h:Bs(m),w=g==null?h:Bs(g),h=new v(S,y+"leave",m,n,d),h.target=b,h.relatedTarget=w,S=null,Mi(d)===u&&(v=new v(x,y+"enter",g,n,d),v.target=w,v.relatedTarget=b,S=v),b=S,m&&g)t:{for(v=m,x=g,y=0,w=v;w;w=Is(w))y++;for(w=0,S=x;S;S=Is(S))w++;for(;0<y-w;)v=Is(v),y--;for(;0<w-y;)x=Is(x),w--;for(;y--;){if(v===x||x!==null&&v===x.alternate)break t;v=Is(v),x=Is(x)}v=null}else v=null;m!==null&&dx(f,h,m,v,!1),g!==null&&b!==null&&dx(f,b,g,v,!0)}}e:{if(h=u?Bs(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var j=TD;else if(rx(h))if(Ib)j=DD;else{j=RD;var E=kD}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=ID);if(j&&(j=j(e,u))){Rb(f,j,n,d);break e}E&&E(e,h,u),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&kp(h,"number",h.value)}switch(E=u?Bs(u):window,e){case"focusin":(rx(E)||E.contentEditable==="true")&&(Fs=E,zp=u,xl=null);break;case"focusout":xl=zp=Fs=null;break;case"mousedown":Bp=!0;break;case"contextmenu":case"mouseup":case"dragend":Bp=!1,lx(f,n,d);break;case"selectionchange":if(ND)break;case"keydown":case"keyup":lx(f,n,d)}var P;if(jg)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ls?Tb(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(Pb&&n.locale!=="ko"&&(Ls||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ls&&(P=jb()):(Xo=d,bg="value"in Xo?Xo.value:Xo.textContent,Ls=!0)),E=Ju(u,T),0<E.length&&(T=new Z0(T,e,null,n,d),f.push({event:T,listeners:E}),P?T.data=P:(P=kb(n),P!==null&&(T.data=P)))),(P=bD?CD(e,n):ED(e,n))&&(u=Ju(u,"onBeforeInput"),0<u.length&&(d=new Z0("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=P))}zb(f,t)})}function Ml(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ju(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Rl(e,n),i!=null&&r.unshift(Ml(e,i,o)),i=Rl(e,t),i!=null&&r.push(Ml(e,i,o))),e=e.return}return r}function Is(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function dx(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,o?(c=Rl(n,i),c!=null&&s.unshift(Ml(n,c,l))):o||(c=Rl(n,i),c!=null&&s.push(Ml(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var LD=/\r\n?/g,FD=/\u0000|\uFFFD/g;function fx(e){return(typeof e=="string"?e:""+e).replace(LD,`
|
|
81
|
+
`).replace(FD,"")}function ru(e,t,n){if(t=fx(t),fx(e)!==t&&n)throw Error(K(425))}function Zu(){}var Up=null,Vp=null;function Wp(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Hp=typeof setTimeout=="function"?setTimeout:void 0,zD=typeof clearTimeout=="function"?clearTimeout:void 0,hx=typeof Promise=="function"?Promise:void 0,BD=typeof queueMicrotask=="function"?queueMicrotask:typeof hx<"u"?function(e){return hx.resolve(null).then(e).catch(UD)}:Hp;function UD(e){setTimeout(function(){throw e})}function zh(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),_l(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);_l(t)}function oi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function px(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Ra=Math.random().toString(36).slice(2),Qr="__reactFiber$"+Ra,$l="__reactProps$"+Ra,yo="__reactContainer$"+Ra,qp="__reactEvents$"+Ra,VD="__reactListeners$"+Ra,WD="__reactHandles$"+Ra;function Mi(e){var t=e[Qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yo]||n[Qr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=px(e);e!==null;){if(n=e[Qr])return n;e=px(e)}return t}e=n,n=e.parentNode}return null}function lc(e){return e=e[Qr]||e[yo],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Bs(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(K(33))}function Kd(e){return e[$l]||null}var Gp=[],Us=-1;function yi(e){return{current:e}}function vt(e){0>Us||(e.current=Gp[Us],Gp[Us]=null,Us--)}function at(e,t){Us++,Gp[Us]=e.current,e.current=t}var fi={},dn=yi(fi),_n=yi(!1),Hi=fi;function la(e,t){var n=e.type.contextTypes;if(!n)return fi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function An(e){return e=e.childContextTypes,e!=null}function ed(){vt(_n),vt(dn)}function mx(e,t,n){if(dn.current!==fi)throw Error(K(168));at(dn,t),at(_n,n)}function Ub(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(K(108,kI(e)||"Unknown",o));return jt({},n,r)}function td(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fi,Hi=dn.current,at(dn,e),at(_n,_n.current),!0}function gx(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=Ub(e,t,Hi),r.__reactInternalMemoizedMergedChildContext=e,vt(_n),vt(dn),at(dn,e)):vt(_n),at(_n,n)}var co=null,Yd=!1,Bh=!1;function Vb(e){co===null?co=[e]:co.push(e)}function HD(e){Yd=!0,Vb(e)}function xi(){if(!Bh&&co!==null){Bh=!0;var e=0,t=Je;try{var n=co;for(Je=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}co=null,Yd=!1}catch(o){throw co!==null&&(co=co.slice(e+1)),pb(yg,xi),o}finally{Je=t,Bh=!1}}return null}var Vs=[],Ws=0,nd=null,rd=0,tr=[],nr=0,qi=null,uo=1,fo="";function Ii(e,t){Vs[Ws++]=rd,Vs[Ws++]=nd,nd=e,rd=t}function Wb(e,t,n){tr[nr++]=uo,tr[nr++]=fo,tr[nr++]=qi,qi=e;var r=uo;e=fo;var o=32-Tr(r)-1;r&=~(1<<o),n+=1;var i=32-Tr(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,uo=1<<32-Tr(t)+o|n<<o|r,fo=i+e}else uo=1<<i|n<<o|r,fo=e}function Tg(e){e.return!==null&&(Ii(e,1),Wb(e,1,0))}function kg(e){for(;e===nd;)nd=Vs[--Ws],Vs[Ws]=null,rd=Vs[--Ws],Vs[Ws]=null;for(;e===qi;)qi=tr[--nr],tr[nr]=null,fo=tr[--nr],tr[nr]=null,uo=tr[--nr],tr[nr]=null}var Hn=null,Vn=null,St=!1,Er=null;function Hb(e,t){var n=rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function vx(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Hn=e,Vn=oi(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Hn=e,Vn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=qi!==null?{id:uo,overflow:fo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Hn=e,Vn=null,!0):!1;default:return!1}}function Qp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Kp(e){if(St){var t=Vn;if(t){var n=t;if(!vx(e,t)){if(Qp(e))throw Error(K(418));t=oi(n.nextSibling);var r=Hn;t&&vx(e,t)?Hb(r,n):(e.flags=e.flags&-4097|2,St=!1,Hn=e)}}else{if(Qp(e))throw Error(K(418));e.flags=e.flags&-4097|2,St=!1,Hn=e}}}function yx(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Hn=e}function ou(e){if(e!==Hn)return!1;if(!St)return yx(e),St=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Wp(e.type,e.memoizedProps)),t&&(t=Vn)){if(Qp(e))throw qb(),Error(K(418));for(;t;)Hb(e,t),t=oi(t.nextSibling)}if(yx(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Vn=oi(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Vn=null}}else Vn=Hn?oi(e.stateNode.nextSibling):null;return!0}function qb(){for(var e=Vn;e;)e=oi(e.nextSibling)}function ca(){Vn=Hn=null,St=!1}function Rg(e){Er===null?Er=[e]:Er.push(e)}var qD=Ro.ReactCurrentBatchConfig;function Sr(e,t){if(e&&e.defaultProps){t=jt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}var od=yi(null),id=null,Hs=null,Ig=null;function Dg(){Ig=Hs=id=null}function _g(e){var t=od.current;vt(od),e._currentValue=t}function Yp(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function na(e,t){id=e,Ig=Hs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Dn=!0),e.firstContext=null)}function sr(e){var t=e._currentValue;if(Ig!==e)if(e={context:e,memoizedValue:t,next:null},Hs===null){if(id===null)throw Error(K(308));Hs=e,id.dependencies={lanes:0,firstContext:e}}else Hs=Hs.next=e;return t}var $i=null;function Ag(e){$i===null?$i=[e]:$i.push(e)}function Gb(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Ag(t)):(n.next=o.next,o.next=n),t.interleaved=n,xo(e,r)}function xo(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Wo=!1;function Ng(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qb(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ho(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ii(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,He&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,xo(e,n)}return o=r.interleaved,o===null?(t.next=t,Ag(r)):(t.next=o.next,o.next=t),r.interleaved=t,xo(e,n)}function Tu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xg(e,n)}}function xx(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function sd(e,t,n,r){var o=e.updateQueue;Wo=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var c=l,u=c.next;c.next=null,s===null?i=u:s.next=u,s=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=o.baseState;s=0,d=u=c=null,l=i;do{var h=l.lane,m=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,v=l;switch(h=t,m=n,v.tag){case 1:if(g=v.payload,typeof g=="function"){f=g.call(m,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=v.payload,h=typeof g=="function"?g.call(m,f,h):g,h==null)break e;f=jt({},f,h);break e;case 2:Wo=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[l]:h.push(l))}else m={eventTime:m,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=m,c=f):d=d.next=m,s|=h;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;h=l,l=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(d===null&&(c=f),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Qi|=s,e.lanes=s,e.memoizedState=f}}function wx(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(K(191,o));o.call(r)}}}var Kb=new GS.Component().refs;function Xp(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:jt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xd={isMounted:function(e){return(e=e._reactInternals)?ls(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=wn(),o=ai(e),i=ho(r,o);i.payload=t,n!=null&&(i.callback=n),t=ii(e,i,o),t!==null&&(kr(t,e,o,r),Tu(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=wn(),o=ai(e),i=ho(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ii(e,i,o),t!==null&&(kr(t,e,o,r),Tu(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=wn(),r=ai(e),o=ho(n,r);o.tag=2,t!=null&&(o.callback=t),t=ii(e,o,r),t!==null&&(kr(t,e,r,n),Tu(t,e,r))}};function Sx(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!Nl(n,r)||!Nl(o,i):!0}function Yb(e,t,n){var r=!1,o=fi,i=t.contextType;return typeof i=="object"&&i!==null?i=sr(i):(o=An(t)?Hi:dn.current,r=t.contextTypes,i=(r=r!=null)?la(e,o):fi),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Xd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function bx(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Xd.enqueueReplaceState(t,t.state,null)}function Jp(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=Kb,Ng(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=sr(i):(i=An(t)?Hi:dn.current,o.context=la(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Xp(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Xd.enqueueReplaceState(o,o.state,null),sd(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Ka(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(K(309));var r=n.stateNode}if(!r)throw Error(K(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var l=o.refs;l===Kb&&(l=o.refs={}),s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(K(284));if(!n._owner)throw Error(K(290,e))}return e}function iu(e,t){throw e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Cx(e){var t=e._init;return t(e._payload)}function Xb(e){function t(x,y){if(e){var w=x.deletions;w===null?(x.deletions=[y],x.flags|=16):w.push(y)}}function n(x,y){if(!e)return null;for(;y!==null;)t(x,y),y=y.sibling;return null}function r(x,y){for(x=new Map;y!==null;)y.key!==null?x.set(y.key,y):x.set(y.index,y),y=y.sibling;return x}function o(x,y){return x=li(x,y),x.index=0,x.sibling=null,x}function i(x,y,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<y?(x.flags|=2,y):w):(x.flags|=2,y)):(x.flags|=1048576,y)}function s(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,y,w,S){return y===null||y.tag!==6?(y=Qh(w,x.mode,S),y.return=x,y):(y=o(y,w),y.return=x,y)}function c(x,y,w,S){var j=w.type;return j===$s?d(x,y,w.props.children,S,w.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Vo&&Cx(j)===y.type)?(S=o(y,w.props),S.ref=Ka(x,y,w),S.return=x,S):(S=Au(w.type,w.key,w.props,null,x.mode,S),S.ref=Ka(x,y,w),S.return=x,S)}function u(x,y,w,S){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=Kh(w,x.mode,S),y.return=x,y):(y=o(y,w.children||[]),y.return=x,y)}function d(x,y,w,S,j){return y===null||y.tag!==7?(y=Vi(w,x.mode,S,j),y.return=x,y):(y=o(y,w),y.return=x,y)}function f(x,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Qh(""+y,x.mode,w),y.return=x,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Qc:return w=Au(y.type,y.key,y.props,null,x.mode,w),w.ref=Ka(x,null,y),w.return=x,w;case Ms:return y=Kh(y,x.mode,w),y.return=x,y;case Vo:var S=y._init;return f(x,S(y._payload),w)}if(cl(y)||Wa(y))return y=Vi(y,x.mode,w,null),y.return=x,y;iu(x,y)}return null}function h(x,y,w,S){var j=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return j!==null?null:l(x,y,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Qc:return w.key===j?c(x,y,w,S):null;case Ms:return w.key===j?u(x,y,w,S):null;case Vo:return j=w._init,h(x,y,j(w._payload),S)}if(cl(w)||Wa(w))return j!==null?null:d(x,y,w,S,null);iu(x,w)}return null}function m(x,y,w,S,j){if(typeof S=="string"&&S!==""||typeof S=="number")return x=x.get(w)||null,l(y,x,""+S,j);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Qc:return x=x.get(S.key===null?w:S.key)||null,c(y,x,S,j);case Ms:return x=x.get(S.key===null?w:S.key)||null,u(y,x,S,j);case Vo:var E=S._init;return m(x,y,w,E(S._payload),j)}if(cl(S)||Wa(S))return x=x.get(w)||null,d(y,x,S,j,null);iu(y,S)}return null}function g(x,y,w,S){for(var j=null,E=null,P=y,T=y=0,k=null;P!==null&&T<w.length;T++){P.index>T?(k=P,P=null):k=P.sibling;var I=h(x,P,w[T],S);if(I===null){P===null&&(P=k);break}e&&P&&I.alternate===null&&t(x,P),y=i(I,y,T),E===null?j=I:E.sibling=I,E=I,P=k}if(T===w.length)return n(x,P),St&&Ii(x,T),j;if(P===null){for(;T<w.length;T++)P=f(x,w[T],S),P!==null&&(y=i(P,y,T),E===null?j=P:E.sibling=P,E=P);return St&&Ii(x,T),j}for(P=r(x,P);T<w.length;T++)k=m(P,x,T,w[T],S),k!==null&&(e&&k.alternate!==null&&P.delete(k.key===null?T:k.key),y=i(k,y,T),E===null?j=k:E.sibling=k,E=k);return e&&P.forEach(function(O){return t(x,O)}),St&&Ii(x,T),j}function v(x,y,w,S){var j=Wa(w);if(typeof j!="function")throw Error(K(150));if(w=j.call(w),w==null)throw Error(K(151));for(var E=j=null,P=y,T=y=0,k=null,I=w.next();P!==null&&!I.done;T++,I=w.next()){P.index>T?(k=P,P=null):k=P.sibling;var O=h(x,P,I.value,S);if(O===null){P===null&&(P=k);break}e&&P&&O.alternate===null&&t(x,P),y=i(O,y,T),E===null?j=O:E.sibling=O,E=O,P=k}if(I.done)return n(x,P),St&&Ii(x,T),j;if(P===null){for(;!I.done;T++,I=w.next())I=f(x,I.value,S),I!==null&&(y=i(I,y,T),E===null?j=I:E.sibling=I,E=I);return St&&Ii(x,T),j}for(P=r(x,P);!I.done;T++,I=w.next())I=m(P,x,T,I.value,S),I!==null&&(e&&I.alternate!==null&&P.delete(I.key===null?T:I.key),y=i(I,y,T),E===null?j=I:E.sibling=I,E=I);return e&&P.forEach(function(R){return t(x,R)}),St&&Ii(x,T),j}function b(x,y,w,S){if(typeof w=="object"&&w!==null&&w.type===$s&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Qc:e:{for(var j=w.key,E=y;E!==null;){if(E.key===j){if(j=w.type,j===$s){if(E.tag===7){n(x,E.sibling),y=o(E,w.props.children),y.return=x,x=y;break e}}else if(E.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Vo&&Cx(j)===E.type){n(x,E.sibling),y=o(E,w.props),y.ref=Ka(x,E,w),y.return=x,x=y;break e}n(x,E);break}else t(x,E);E=E.sibling}w.type===$s?(y=Vi(w.props.children,x.mode,S,w.key),y.return=x,x=y):(S=Au(w.type,w.key,w.props,null,x.mode,S),S.ref=Ka(x,y,w),S.return=x,x=S)}return s(x);case Ms:e:{for(E=w.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(x,y.sibling),y=o(y,w.children||[]),y.return=x,x=y;break e}else{n(x,y);break}else t(x,y);y=y.sibling}y=Kh(w,x.mode,S),y.return=x,x=y}return s(x);case Vo:return E=w._init,b(x,y,E(w._payload),S)}if(cl(w))return g(x,y,w,S);if(Wa(w))return v(x,y,w,S);iu(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(x,y.sibling),y=o(y,w),y.return=x,x=y):(n(x,y),y=Qh(w,x.mode,S),y.return=x,x=y),s(x)):n(x,y)}return b}var ua=Xb(!0),Jb=Xb(!1),cc={},Xr=yi(cc),Ll=yi(cc),Fl=yi(cc);function Li(e){if(e===cc)throw Error(K(174));return e}function Og(e,t){switch(at(Fl,t),at(Ll,e),at(Xr,cc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ip(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ip(t,e)}vt(Xr),at(Xr,t)}function da(){vt(Xr),vt(Ll),vt(Fl)}function Zb(e){Li(Fl.current);var t=Li(Xr.current),n=Ip(t,e.type);t!==n&&(at(Ll,e),at(Xr,n))}function Mg(e){Ll.current===e&&(vt(Xr),vt(Ll))}var Ct=yi(0);function ad(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uh=[];function $g(){for(var e=0;e<Uh.length;e++)Uh[e]._workInProgressVersionPrimary=null;Uh.length=0}var ku=Ro.ReactCurrentDispatcher,Vh=Ro.ReactCurrentBatchConfig,Gi=0,Et=null,Bt=null,Ht=null,ld=!1,wl=!1,zl=0,GD=0;function on(){throw Error(K(321))}function Lg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ir(e[n],t[n]))return!1;return!0}function Fg(e,t,n,r,o,i){if(Gi=i,Et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ku.current=e===null||e.memoizedState===null?XD:JD,e=n(r,o),wl){i=0;do{if(wl=!1,zl=0,25<=i)throw Error(K(301));i+=1,Ht=Bt=null,t.updateQueue=null,ku.current=ZD,e=n(r,o)}while(wl)}if(ku.current=cd,t=Bt!==null&&Bt.next!==null,Gi=0,Ht=Bt=Et=null,ld=!1,t)throw Error(K(300));return e}function zg(){var e=zl!==0;return zl=0,e}function Hr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Et.memoizedState=Ht=e:Ht=Ht.next=e,Ht}function ar(){if(Bt===null){var e=Et.alternate;e=e!==null?e.memoizedState:null}else e=Bt.next;var t=Ht===null?Et.memoizedState:Ht.next;if(t!==null)Ht=t,Bt=e;else{if(e===null)throw Error(K(310));Bt=e,e={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Ht===null?Et.memoizedState=Ht=e:Ht=Ht.next=e}return Ht}function Bl(e,t){return typeof t=="function"?t(e):t}function Wh(e){var t=ar(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=Bt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var l=s=null,c=null,u=i;do{var d=u.lane;if((Gi&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,s=r):c=c.next=f,Et.lanes|=d,Qi|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,Ir(r,t.memoizedState)||(Dn=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Et.lanes|=i,Qi|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Hh(e){var t=ar(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Ir(i,t.memoizedState)||(Dn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function eC(){}function tC(e,t){var n=Et,r=ar(),o=t(),i=!Ir(r.memoizedState,o);if(i&&(r.memoizedState=o,Dn=!0),r=r.queue,Bg(oC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ht!==null&&Ht.memoizedState.tag&1){if(n.flags|=2048,Ul(9,rC.bind(null,n,r,o,t),void 0,null),Gt===null)throw Error(K(349));Gi&30||nC(n,t,o)}return o}function nC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Et.updateQueue,t===null?(t={lastEffect:null,stores:null},Et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function rC(e,t,n,r){t.value=n,t.getSnapshot=r,iC(t)&&sC(e)}function oC(e,t,n){return n(function(){iC(t)&&sC(e)})}function iC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ir(e,n)}catch{return!0}}function sC(e){var t=xo(e,1);t!==null&&kr(t,e,1,-1)}function Ex(e){var t=Hr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Bl,lastRenderedState:e},t.queue=e,e=e.dispatch=YD.bind(null,Et,e),[t.memoizedState,e]}function Ul(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Et.updateQueue,t===null?(t={lastEffect:null,stores:null},Et.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function aC(){return ar().memoizedState}function Ru(e,t,n,r){var o=Hr();Et.flags|=e,o.memoizedState=Ul(1|t,n,void 0,r===void 0?null:r)}function Jd(e,t,n,r){var o=ar();r=r===void 0?null:r;var i=void 0;if(Bt!==null){var s=Bt.memoizedState;if(i=s.destroy,r!==null&&Lg(r,s.deps)){o.memoizedState=Ul(t,n,i,r);return}}Et.flags|=e,o.memoizedState=Ul(1|t,n,i,r)}function jx(e,t){return Ru(8390656,8,e,t)}function Bg(e,t){return Jd(2048,8,e,t)}function lC(e,t){return Jd(4,2,e,t)}function cC(e,t){return Jd(4,4,e,t)}function uC(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dC(e,t,n){return n=n!=null?n.concat([e]):null,Jd(4,4,uC.bind(null,t,e),n)}function Ug(){}function fC(e,t){var n=ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lg(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hC(e,t){var n=ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lg(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function pC(e,t,n){return Gi&21?(Ir(n,t)||(n=vb(),Et.lanes|=n,Qi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Dn=!0),e.memoizedState=n)}function QD(e,t){var n=Je;Je=n!==0&&4>n?n:4,e(!0);var r=Vh.transition;Vh.transition={};try{e(!1),t()}finally{Je=n,Vh.transition=r}}function mC(){return ar().memoizedState}function KD(e,t,n){var r=ai(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gC(e))vC(t,n);else if(n=Gb(e,t,n,r),n!==null){var o=wn();kr(n,e,r,o),yC(n,t,r)}}function YD(e,t,n){var r=ai(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gC(e))vC(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,Ir(l,s)){var c=t.interleaved;c===null?(o.next=o,Ag(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=Gb(e,t,o,r),n!==null&&(o=wn(),kr(n,e,r,o),yC(n,t,r))}}function gC(e){var t=e.alternate;return e===Et||t!==null&&t===Et}function vC(e,t){wl=ld=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function yC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xg(e,n)}}var cd={readContext:sr,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useInsertionEffect:on,useLayoutEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useMutableSource:on,useSyncExternalStore:on,useId:on,unstable_isNewReconciler:!1},XD={readContext:sr,useCallback:function(e,t){return Hr().memoizedState=[e,t===void 0?null:t],e},useContext:sr,useEffect:jx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ru(4194308,4,uC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ru(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ru(4,2,e,t)},useMemo:function(e,t){var n=Hr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Hr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=KD.bind(null,Et,e),[r.memoizedState,e]},useRef:function(e){var t=Hr();return e={current:e},t.memoizedState=e},useState:Ex,useDebugValue:Ug,useDeferredValue:function(e){return Hr().memoizedState=e},useTransition:function(){var e=Ex(!1),t=e[0];return e=QD.bind(null,e[1]),Hr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Et,o=Hr();if(St){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),Gt===null)throw Error(K(349));Gi&30||nC(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,jx(oC.bind(null,r,i,e),[e]),r.flags|=2048,Ul(9,rC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Hr(),t=Gt.identifierPrefix;if(St){var n=fo,r=uo;n=(r&~(1<<32-Tr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=zl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=GD++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},JD={readContext:sr,useCallback:fC,useContext:sr,useEffect:Bg,useImperativeHandle:dC,useInsertionEffect:lC,useLayoutEffect:cC,useMemo:hC,useReducer:Wh,useRef:aC,useState:function(){return Wh(Bl)},useDebugValue:Ug,useDeferredValue:function(e){var t=ar();return pC(t,Bt.memoizedState,e)},useTransition:function(){var e=Wh(Bl)[0],t=ar().memoizedState;return[e,t]},useMutableSource:eC,useSyncExternalStore:tC,useId:mC,unstable_isNewReconciler:!1},ZD={readContext:sr,useCallback:fC,useContext:sr,useEffect:Bg,useImperativeHandle:dC,useInsertionEffect:lC,useLayoutEffect:cC,useMemo:hC,useReducer:Hh,useRef:aC,useState:function(){return Hh(Bl)},useDebugValue:Ug,useDeferredValue:function(e){var t=ar();return Bt===null?t.memoizedState=e:pC(t,Bt.memoizedState,e)},useTransition:function(){var e=Hh(Bl)[0],t=ar().memoizedState;return[e,t]},useMutableSource:eC,useSyncExternalStore:tC,useId:mC,unstable_isNewReconciler:!1};function fa(e,t){try{var n="",r=t;do n+=TI(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
82
|
+
Error generating stack: `+i.message+`
|
|
83
|
+
`+i.stack}return{value:e,source:t,stack:o,digest:null}}function qh(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Zp(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var e_=typeof WeakMap=="function"?WeakMap:Map;function xC(e,t,n){n=ho(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){dd||(dd=!0,cm=r),Zp(e,t)},n}function wC(e,t,n){n=ho(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Zp(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Zp(e,t),typeof r!="function"&&(si===null?si=new Set([this]):si.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Px(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new e_;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=p_.bind(null,e,t,n),t.then(e,e))}function Tx(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function kx(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ho(-1,1),t.tag=2,ii(n,t,1))),n.lanes|=1),e)}var t_=Ro.ReactCurrentOwner,Dn=!1;function gn(e,t,n,r){t.child=e===null?Jb(t,null,n,r):ua(t,e.child,n,r)}function Rx(e,t,n,r,o){n=n.render;var i=t.ref;return na(t,o),r=Fg(e,t,n,r,i,o),n=zg(),e!==null&&!Dn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,wo(e,t,o)):(St&&n&&Tg(t),t.flags|=1,gn(e,t,r,o),t.child)}function Ix(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!Yg(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,SC(e,t,i,r,o)):(e=Au(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Nl,n(s,r)&&e.ref===t.ref)return wo(e,t,o)}return t.flags|=1,e=li(i,r),e.ref=t.ref,e.return=t,t.child=e}function SC(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Nl(i,r)&&e.ref===t.ref)if(Dn=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Dn=!0);else return t.lanes=e.lanes,wo(e,t,o)}return em(e,t,n,r,o)}function bC(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},at(Gs,Bn),Bn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,at(Gs,Bn),Bn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,at(Gs,Bn),Bn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,at(Gs,Bn),Bn|=r;return gn(e,t,o,n),t.child}function CC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function em(e,t,n,r,o){var i=An(n)?Hi:dn.current;return i=la(t,i),na(t,o),n=Fg(e,t,n,r,i,o),r=zg(),e!==null&&!Dn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,wo(e,t,o)):(St&&r&&Tg(t),t.flags|=1,gn(e,t,n,o),t.child)}function Dx(e,t,n,r,o){if(An(n)){var i=!0;td(t)}else i=!1;if(na(t,o),t.stateNode===null)Iu(e,t),Yb(t,n,r),Jp(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var c=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=sr(u):(u=An(n)?Hi:dn.current,u=la(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||c!==u)&&bx(t,s,r,u),Wo=!1;var h=t.memoizedState;s.state=h,sd(t,r,s,o),c=t.memoizedState,l!==r||h!==c||_n.current||Wo?(typeof d=="function"&&(Xp(t,n,d,r),c=t.memoizedState),(l=Wo||Sx(t,n,l,r,h,c,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),s.props=r,s.state=c,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Qb(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Sr(t.type,l),s.props=u,f=t.pendingProps,h=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=sr(c):(c=An(n)?Hi:dn.current,c=la(t,c));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||h!==c)&&bx(t,s,r,c),Wo=!1,h=t.memoizedState,s.state=h,sd(t,r,s,o);var g=t.memoizedState;l!==f||h!==g||_n.current||Wo?(typeof m=="function"&&(Xp(t,n,m,r),g=t.memoizedState),(u=Wo||Sx(t,n,u,r,h,g,c)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,g,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,g,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),s.props=r,s.state=g,s.context=c,r=u):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return tm(e,t,n,r,i,o)}function tm(e,t,n,r,o,i){CC(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&gx(t,n,!1),wo(e,t,i);r=t.stateNode,t_.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=ua(t,e.child,null,i),t.child=ua(t,null,l,i)):gn(e,t,l,i),t.memoizedState=r.state,o&&gx(t,n,!0),t.child}function EC(e){var t=e.stateNode;t.pendingContext?mx(e,t.pendingContext,t.pendingContext!==t.context):t.context&&mx(e,t.context,!1),Og(e,t.containerInfo)}function _x(e,t,n,r,o){return ca(),Rg(o),t.flags|=256,gn(e,t,n,r),t.child}var nm={dehydrated:null,treeContext:null,retryLane:0};function rm(e){return{baseLanes:e,cachePool:null,transitions:null}}function jC(e,t,n){var r=t.pendingProps,o=Ct.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),at(Ct,o&1),e===null)return Kp(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=tf(s,r,0,null),e=Vi(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=rm(n),t.memoizedState=nm,e):Vg(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return n_(e,t,s,r,l,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,l=o.sibling;var c={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=li(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=li(l,i):(i=Vi(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?rm(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=nm,r}return i=e.child,e=i.sibling,r=li(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Vg(e,t){return t=tf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function su(e,t,n,r){return r!==null&&Rg(r),ua(t,e.child,null,n),e=Vg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function n_(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=qh(Error(K(422))),su(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=tf({mode:"visible",children:r.children},o,0,null),i=Vi(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&ua(t,e.child,null,s),t.child.memoizedState=rm(s),t.memoizedState=nm,i);if(!(t.mode&1))return su(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(K(419)),r=qh(i,r,void 0),su(e,t,s,r)}if(l=(s&e.childLanes)!==0,Dn||l){if(r=Gt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,xo(e,o),kr(r,e,o,-1))}return Kg(),r=qh(Error(K(421))),su(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=m_.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Vn=oi(o.nextSibling),Hn=t,St=!0,Er=null,e!==null&&(tr[nr++]=uo,tr[nr++]=fo,tr[nr++]=qi,uo=e.id,fo=e.overflow,qi=t),t=Vg(t,r.children),t.flags|=4096,t)}function Ax(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yp(e.return,t,n)}function Gh(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function PC(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(gn(e,t,r.children,n),r=Ct.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ax(e,n,t);else if(e.tag===19)Ax(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(at(Ct,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ad(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Gh(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ad(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Gh(t,!0,n,null,i);break;case"together":Gh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Iu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function wo(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Qi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function r_(e,t,n){switch(t.tag){case 3:EC(t),ca();break;case 5:Zb(t);break;case 1:An(t.type)&&td(t);break;case 4:Og(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;at(od,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(at(Ct,Ct.current&1),t.flags|=128,null):n&t.child.childLanes?jC(e,t,n):(at(Ct,Ct.current&1),e=wo(e,t,n),e!==null?e.sibling:null);at(Ct,Ct.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return PC(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),at(Ct,Ct.current),r)break;return null;case 22:case 23:return t.lanes=0,bC(e,t,n)}return wo(e,t,n)}var TC,om,kC,RC;TC=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};om=function(){};kC=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Li(Xr.current);var i=null;switch(n){case"input":o=Pp(e,o),r=Pp(e,r),i=[];break;case"select":o=jt({},o,{value:void 0}),r=jt({},r,{value:void 0}),i=[];break;case"textarea":o=Rp(e,o),r=Rp(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Zu)}Dp(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Tl.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Tl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&pt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};RC=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ya(e,t){if(!St)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function sn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function o_(e,t,n){var r=t.pendingProps;switch(kg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(t),null;case 1:return An(t.type)&&ed(),sn(t),null;case 3:return r=t.stateNode,da(),vt(_n),vt(dn),$g(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ou(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Er!==null&&(fm(Er),Er=null))),om(e,t),sn(t),null;case 5:Mg(t);var o=Li(Fl.current);if(n=t.type,e!==null&&t.stateNode!=null)kC(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return sn(t),null}if(e=Li(Xr.current),ou(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Qr]=t,r[$l]=i,e=(t.mode&1)!==0,n){case"dialog":pt("cancel",r),pt("close",r);break;case"iframe":case"object":case"embed":pt("load",r);break;case"video":case"audio":for(o=0;o<dl.length;o++)pt(dl[o],r);break;case"source":pt("error",r);break;case"img":case"image":case"link":pt("error",r),pt("load",r);break;case"details":pt("toggle",r);break;case"input":U0(r,i),pt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},pt("invalid",r);break;case"textarea":W0(r,i),pt("invalid",r)}Dp(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),o=["children",""+l]):Tl.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&pt("scroll",r)}switch(n){case"input":Kc(r),V0(r,i,!0);break;case"textarea":Kc(r),H0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Zu)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=nb(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Qr]=t,e[$l]=r,TC(e,t,!1,!1),t.stateNode=e;e:{switch(s=_p(n,r),n){case"dialog":pt("cancel",e),pt("close",e),o=r;break;case"iframe":case"object":case"embed":pt("load",e),o=r;break;case"video":case"audio":for(o=0;o<dl.length;o++)pt(dl[o],e);o=r;break;case"source":pt("error",e),o=r;break;case"img":case"image":case"link":pt("error",e),pt("load",e),o=r;break;case"details":pt("toggle",e),o=r;break;case"input":U0(e,r),o=Pp(e,r),pt("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=jt({},r,{value:void 0}),pt("invalid",e);break;case"textarea":W0(e,r),o=Rp(e,r),pt("invalid",e);break;default:o=r}Dp(n,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?ib(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&rb(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&kl(e,c):typeof c=="number"&&kl(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Tl.hasOwnProperty(i)?c!=null&&i==="onScroll"&&pt("scroll",e):c!=null&&hg(e,i,c,s))}switch(n){case"input":Kc(e),V0(e,r,!1);break;case"textarea":Kc(e),H0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+di(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Js(e,!!r.multiple,i,!1):r.defaultValue!=null&&Js(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Zu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return sn(t),null;case 6:if(e&&t.stateNode!=null)RC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(n=Li(Fl.current),Li(Xr.current),ou(t)){if(r=t.stateNode,n=t.memoizedProps,r[Qr]=t,(i=r.nodeValue!==n)&&(e=Hn,e!==null))switch(e.tag){case 3:ru(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ru(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Qr]=t,t.stateNode=r}return sn(t),null;case 13:if(vt(Ct),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(St&&Vn!==null&&t.mode&1&&!(t.flags&128))qb(),ca(),t.flags|=98560,i=!1;else if(i=ou(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(K(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(K(317));i[Qr]=t}else ca(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sn(t),i=!1}else Er!==null&&(fm(Er),Er=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ct.current&1?Ut===0&&(Ut=3):Kg())),t.updateQueue!==null&&(t.flags|=4),sn(t),null);case 4:return da(),om(e,t),e===null&&Ol(t.stateNode.containerInfo),sn(t),null;case 10:return _g(t.type._context),sn(t),null;case 17:return An(t.type)&&ed(),sn(t),null;case 19:if(vt(Ct),i=t.memoizedState,i===null)return sn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Ya(i,!1);else{if(Ut!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=ad(e),s!==null){for(t.flags|=128,Ya(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return at(Ct,Ct.current&1|2),t.child}e=e.sibling}i.tail!==null&&Mt()>ha&&(t.flags|=128,r=!0,Ya(i,!1),t.lanes=4194304)}else{if(!r)if(e=ad(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ya(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!St)return sn(t),null}else 2*Mt()-i.renderingStartTime>ha&&n!==1073741824&&(t.flags|=128,r=!0,Ya(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Mt(),t.sibling=null,n=Ct.current,at(Ct,r?n&1|2:n&1),t):(sn(t),null);case 22:case 23:return Qg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Bn&1073741824&&(sn(t),t.subtreeFlags&6&&(t.flags|=8192)):sn(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function i_(e,t){switch(kg(t),t.tag){case 1:return An(t.type)&&ed(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(),vt(_n),vt(dn),$g(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Mg(t),null;case 13:if(vt(Ct),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vt(Ct),null;case 4:return da(),null;case 10:return _g(t.type._context),null;case 22:case 23:return Qg(),null;case 24:return null;default:return null}}var au=!1,an=!1,s_=typeof WeakSet=="function"?WeakSet:Set,se=null;function qs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Rt(e,t,r)}else n.current=null}function im(e,t,n){try{n()}catch(r){Rt(e,t,r)}}var Nx=!1;function a_(e,t){if(Up=Yu,e=Ab(),Pg(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var m;f!==n||o!==0&&f.nodeType!==3||(l=s+o),f!==i||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===n&&++u===o&&(l=s),h===i&&++d===r&&(c=s),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Vp={focusedElem:e,selectionRange:n},Yu=!1,se=t;se!==null;)if(t=se,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,se=e;else for(;se!==null;){t=se;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var v=g.memoizedProps,b=g.memoizedState,x=t.stateNode,y=x.getSnapshotBeforeUpdate(t.elementType===t.type?v:Sr(t.type,v),b);x.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(S){Rt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,se=e;break}se=t.return}return g=Nx,Nx=!1,g}function Sl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&im(t,n,i)}o=o.next}while(o!==r)}}function Zd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function sm(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function IC(e){var t=e.alternate;t!==null&&(e.alternate=null,IC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qr],delete t[$l],delete t[qp],delete t[VD],delete t[WD])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function DC(e){return e.tag===5||e.tag===3||e.tag===4}function Ox(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||DC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function am(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zu));else if(r!==4&&(e=e.child,e!==null))for(am(e,t,n),e=e.sibling;e!==null;)am(e,t,n),e=e.sibling}function lm(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(lm(e,t,n),e=e.sibling;e!==null;)lm(e,t,n),e=e.sibling}var Jt=null,br=!1;function Bo(e,t,n){for(n=n.child;n!==null;)_C(e,t,n),n=n.sibling}function _C(e,t,n){if(Yr&&typeof Yr.onCommitFiberUnmount=="function")try{Yr.onCommitFiberUnmount(Hd,n)}catch{}switch(n.tag){case 5:an||qs(n,t);case 6:var r=Jt,o=br;Jt=null,Bo(e,t,n),Jt=r,br=o,Jt!==null&&(br?(e=Jt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Jt.removeChild(n.stateNode));break;case 18:Jt!==null&&(br?(e=Jt,n=n.stateNode,e.nodeType===8?zh(e.parentNode,n):e.nodeType===1&&zh(e,n),_l(e)):zh(Jt,n.stateNode));break;case 4:r=Jt,o=br,Jt=n.stateNode.containerInfo,br=!0,Bo(e,t,n),Jt=r,br=o;break;case 0:case 11:case 14:case 15:if(!an&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&im(n,t,s),o=o.next}while(o!==r)}Bo(e,t,n);break;case 1:if(!an&&(qs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Rt(n,t,l)}Bo(e,t,n);break;case 21:Bo(e,t,n);break;case 22:n.mode&1?(an=(r=an)||n.memoizedState!==null,Bo(e,t,n),an=r):Bo(e,t,n);break;default:Bo(e,t,n)}}function Mx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new s_),t.forEach(function(r){var o=g_.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function yr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 5:Jt=l.stateNode,br=!1;break e;case 3:Jt=l.stateNode.containerInfo,br=!0;break e;case 4:Jt=l.stateNode.containerInfo,br=!0;break e}l=l.return}if(Jt===null)throw Error(K(160));_C(i,s,o),Jt=null,br=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){Rt(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)AC(t,e),t=t.sibling}function AC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yr(t,e),Ur(e),r&4){try{Sl(3,e,e.return),Zd(3,e)}catch(v){Rt(e,e.return,v)}try{Sl(5,e,e.return)}catch(v){Rt(e,e.return,v)}}break;case 1:yr(t,e),Ur(e),r&512&&n!==null&&qs(n,n.return);break;case 5:if(yr(t,e),Ur(e),r&512&&n!==null&&qs(n,n.return),e.flags&32){var o=e.stateNode;try{kl(o,"")}catch(v){Rt(e,e.return,v)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&eb(o,i),_p(l,s);var u=_p(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?ib(o,f):d==="dangerouslySetInnerHTML"?rb(o,f):d==="children"?kl(o,f):hg(o,d,f,u)}switch(l){case"input":Tp(o,i);break;case"textarea":tb(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Js(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?Js(o,!!i.multiple,i.defaultValue,!0):Js(o,!!i.multiple,i.multiple?[]:"",!1))}o[$l]=i}catch(v){Rt(e,e.return,v)}}break;case 6:if(yr(t,e),Ur(e),r&4){if(e.stateNode===null)throw Error(K(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){Rt(e,e.return,v)}}break;case 3:if(yr(t,e),Ur(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{_l(t.containerInfo)}catch(v){Rt(e,e.return,v)}break;case 4:yr(t,e),Ur(e);break;case 13:yr(t,e),Ur(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(qg=Mt())),r&4&&Mx(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(an=(u=an)||d,yr(t,e),an=u):yr(t,e),Ur(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(se=e,d=e.child;d!==null;){for(f=se=d;se!==null;){switch(h=se,m=h.child,h.tag){case 0:case 11:case 14:case 15:Sl(4,h,h.return);break;case 1:qs(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(v){Rt(r,n,v)}}break;case 5:qs(h,h.return);break;case 22:if(h.memoizedState!==null){Lx(f);continue}}m!==null?(m.return=h,se=m):Lx(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{o=f.stateNode,u?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,s=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=ob("display",s))}catch(v){Rt(e,e.return,v)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(v){Rt(e,e.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:yr(t,e),Ur(e),r&4&&Mx(e);break;case 21:break;default:yr(t,e),Ur(e)}}function Ur(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(DC(n)){var r=n;break e}n=n.return}throw Error(K(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(kl(o,""),r.flags&=-33);var i=Ox(e);lm(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,l=Ox(e);am(e,l,s);break;default:throw Error(K(161))}}catch(c){Rt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function l_(e,t,n){se=e,NC(e)}function NC(e,t,n){for(var r=(e.mode&1)!==0;se!==null;){var o=se,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||au;if(!s){var l=o.alternate,c=l!==null&&l.memoizedState!==null||an;l=au;var u=an;if(au=s,(an=c)&&!u)for(se=o;se!==null;)s=se,c=s.child,s.tag===22&&s.memoizedState!==null?Fx(o):c!==null?(c.return=s,se=c):Fx(o);for(;i!==null;)se=i,NC(i),i=i.sibling;se=o,au=l,an=u}$x(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,se=i):$x(e)}}function $x(e){for(;se!==null;){var t=se;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:an||Zd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!an)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Sr(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&wx(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}wx(t,s,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&_l(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(K(163))}an||t.flags&512&&sm(t)}catch(h){Rt(t,t.return,h)}}if(t===e){se=null;break}if(n=t.sibling,n!==null){n.return=t.return,se=n;break}se=t.return}}function Lx(e){for(;se!==null;){var t=se;if(t===e){se=null;break}var n=t.sibling;if(n!==null){n.return=t.return,se=n;break}se=t.return}}function Fx(e){for(;se!==null;){var t=se;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Zd(4,t)}catch(c){Rt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(c){Rt(t,o,c)}}var i=t.return;try{sm(t)}catch(c){Rt(t,i,c)}break;case 5:var s=t.return;try{sm(t)}catch(c){Rt(t,s,c)}}}catch(c){Rt(t,t.return,c)}if(t===e){se=null;break}var l=t.sibling;if(l!==null){l.return=t.return,se=l;break}se=t.return}}var c_=Math.ceil,ud=Ro.ReactCurrentDispatcher,Wg=Ro.ReactCurrentOwner,or=Ro.ReactCurrentBatchConfig,He=0,Gt=null,Ft=null,nn=0,Bn=0,Gs=yi(0),Ut=0,Vl=null,Qi=0,ef=0,Hg=0,bl=null,In=null,qg=0,ha=1/0,lo=null,dd=!1,cm=null,si=null,lu=!1,Jo=null,fd=0,Cl=0,um=null,Du=-1,_u=0;function wn(){return He&6?Mt():Du!==-1?Du:Du=Mt()}function ai(e){return e.mode&1?He&2&&nn!==0?nn&-nn:qD.transition!==null?(_u===0&&(_u=vb()),_u):(e=Je,e!==0||(e=window.event,e=e===void 0?16:Eb(e.type)),e):1}function kr(e,t,n,r){if(50<Cl)throw Cl=0,um=null,Error(K(185));sc(e,n,r),(!(He&2)||e!==Gt)&&(e===Gt&&(!(He&2)&&(ef|=n),Ut===4&&Ko(e,nn)),Nn(e,r),n===1&&He===0&&!(t.mode&1)&&(ha=Mt()+500,Yd&&xi()))}function Nn(e,t){var n=e.callbackNode;qI(e,t);var r=Ku(e,e===Gt?nn:0);if(r===0)n!==null&&Q0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Q0(n),t===1)e.tag===0?HD(zx.bind(null,e)):Vb(zx.bind(null,e)),BD(function(){!(He&6)&&xi()}),n=null;else{switch(yb(r)){case 1:n=yg;break;case 4:n=mb;break;case 16:n=Qu;break;case 536870912:n=gb;break;default:n=Qu}n=UC(n,OC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function OC(e,t){if(Du=-1,_u=0,He&6)throw Error(K(327));var n=e.callbackNode;if(ra()&&e.callbackNode!==n)return null;var r=Ku(e,e===Gt?nn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=hd(e,r);else{t=r;var o=He;He|=2;var i=$C();(Gt!==e||nn!==t)&&(lo=null,ha=Mt()+500,Ui(e,t));do try{f_();break}catch(l){MC(e,l)}while(!0);Dg(),ud.current=i,He=o,Ft!==null?t=0:(Gt=null,nn=0,t=Ut)}if(t!==0){if(t===2&&(o=$p(e),o!==0&&(r=o,t=dm(e,o))),t===1)throw n=Vl,Ui(e,0),Ko(e,r),Nn(e,Mt()),n;if(t===6)Ko(e,r);else{if(o=e.current.alternate,!(r&30)&&!u_(o)&&(t=hd(e,r),t===2&&(i=$p(e),i!==0&&(r=i,t=dm(e,i))),t===1))throw n=Vl,Ui(e,0),Ko(e,r),Nn(e,Mt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(K(345));case 2:Di(e,In,lo);break;case 3:if(Ko(e,r),(r&130023424)===r&&(t=qg+500-Mt(),10<t)){if(Ku(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){wn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Hp(Di.bind(null,e,In,lo),t);break}Di(e,In,lo);break;case 4:if(Ko(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Tr(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=Mt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*c_(r/1960))-r,10<r){e.timeoutHandle=Hp(Di.bind(null,e,In,lo),r);break}Di(e,In,lo);break;case 5:Di(e,In,lo);break;default:throw Error(K(329))}}}return Nn(e,Mt()),e.callbackNode===n?OC.bind(null,e):null}function dm(e,t){var n=bl;return e.current.memoizedState.isDehydrated&&(Ui(e,t).flags|=256),e=hd(e,t),e!==2&&(t=In,In=n,t!==null&&fm(t)),e}function fm(e){In===null?In=e:In.push.apply(In,e)}function u_(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Ir(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ko(e,t){for(t&=~Hg,t&=~ef,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tr(t),r=1<<n;e[n]=-1,t&=~r}}function zx(e){if(He&6)throw Error(K(327));ra();var t=Ku(e,0);if(!(t&1))return Nn(e,Mt()),null;var n=hd(e,t);if(e.tag!==0&&n===2){var r=$p(e);r!==0&&(t=r,n=dm(e,r))}if(n===1)throw n=Vl,Ui(e,0),Ko(e,t),Nn(e,Mt()),n;if(n===6)throw Error(K(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Di(e,In,lo),Nn(e,Mt()),null}function Gg(e,t){var n=He;He|=1;try{return e(t)}finally{He=n,He===0&&(ha=Mt()+500,Yd&&xi())}}function Ki(e){Jo!==null&&Jo.tag===0&&!(He&6)&&ra();var t=He;He|=1;var n=or.transition,r=Je;try{if(or.transition=null,Je=1,e)return e()}finally{Je=r,or.transition=n,He=t,!(He&6)&&xi()}}function Qg(){Bn=Gs.current,vt(Gs)}function Ui(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,zD(n)),Ft!==null)for(n=Ft.return;n!==null;){var r=n;switch(kg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ed();break;case 3:da(),vt(_n),vt(dn),$g();break;case 5:Mg(r);break;case 4:da();break;case 13:vt(Ct);break;case 19:vt(Ct);break;case 10:_g(r.type._context);break;case 22:case 23:Qg()}n=n.return}if(Gt=e,Ft=e=li(e.current,null),nn=Bn=t,Ut=0,Vl=null,Hg=ef=Qi=0,In=bl=null,$i!==null){for(t=0;t<$i.length;t++)if(n=$i[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}$i=null}return e}function MC(e,t){do{var n=Ft;try{if(Dg(),ku.current=cd,ld){for(var r=Et.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}ld=!1}if(Gi=0,Ht=Bt=Et=null,wl=!1,zl=0,Wg.current=null,n===null||n.return===null){Ut=1,Vl=t,Ft=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=nn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Tx(s);if(m!==null){m.flags&=-257,kx(m,s,l,i,t),m.mode&1&&Px(i,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var v=new Set;v.add(c),t.updateQueue=v}else g.add(c);break e}else{if(!(t&1)){Px(i,u,t),Kg();break e}c=Error(K(426))}}else if(St&&l.mode&1){var b=Tx(s);if(b!==null){!(b.flags&65536)&&(b.flags|=256),kx(b,s,l,i,t),Rg(fa(c,l));break e}}i=c=fa(c,l),Ut!==4&&(Ut=2),bl===null?bl=[i]:bl.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=xC(i,c,t);xx(i,x);break e;case 1:l=c;var y=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(si===null||!si.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=wC(i,l,t);xx(i,S);break e}}i=i.return}while(i!==null)}FC(n)}catch(j){t=j,Ft===n&&n!==null&&(Ft=n=n.return);continue}break}while(!0)}function $C(){var e=ud.current;return ud.current=cd,e===null?cd:e}function Kg(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Gt===null||!(Qi&268435455)&&!(ef&268435455)||Ko(Gt,nn)}function hd(e,t){var n=He;He|=2;var r=$C();(Gt!==e||nn!==t)&&(lo=null,Ui(e,t));do try{d_();break}catch(o){MC(e,o)}while(!0);if(Dg(),He=n,ud.current=r,Ft!==null)throw Error(K(261));return Gt=null,nn=0,Ut}function d_(){for(;Ft!==null;)LC(Ft)}function f_(){for(;Ft!==null&&!$I();)LC(Ft)}function LC(e){var t=BC(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,t===null?FC(e):Ft=t,Wg.current=null}function FC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=i_(n,t),n!==null){n.flags&=32767,Ft=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ut=6,Ft=null;return}}else if(n=o_(n,t,Bn),n!==null){Ft=n;return}if(t=t.sibling,t!==null){Ft=t;return}Ft=t=e}while(t!==null);Ut===0&&(Ut=5)}function Di(e,t,n){var r=Je,o=or.transition;try{or.transition=null,Je=1,h_(e,t,n,r)}finally{or.transition=o,Je=r}return null}function h_(e,t,n,r){do ra();while(Jo!==null);if(He&6)throw Error(K(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(K(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(GI(e,i),e===Gt&&(Ft=Gt=null,nn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||lu||(lu=!0,UC(Qu,function(){return ra(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=or.transition,or.transition=null;var s=Je;Je=1;var l=He;He|=4,Wg.current=null,a_(e,n),AC(n,e),AD(Vp),Yu=!!Up,Vp=Up=null,e.current=n,l_(n),LI(),He=l,Je=s,or.transition=i}else e.current=n;if(lu&&(lu=!1,Jo=e,fd=o),i=e.pendingLanes,i===0&&(si=null),BI(n.stateNode),Nn(e,Mt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(dd)throw dd=!1,e=cm,cm=null,e;return fd&1&&e.tag!==0&&ra(),i=e.pendingLanes,i&1?e===um?Cl++:(Cl=0,um=e):Cl=0,xi(),null}function ra(){if(Jo!==null){var e=yb(fd),t=or.transition,n=Je;try{if(or.transition=null,Je=16>e?16:e,Jo===null)var r=!1;else{if(e=Jo,Jo=null,fd=0,He&6)throw Error(K(331));var o=He;for(He|=4,se=e.current;se!==null;){var i=se,s=i.child;if(se.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(se=u;se!==null;){var d=se;switch(d.tag){case 0:case 11:case 15:Sl(8,d,i)}var f=d.child;if(f!==null)f.return=d,se=f;else for(;se!==null;){d=se;var h=d.sibling,m=d.return;if(IC(d),d===u){se=null;break}if(h!==null){h.return=m,se=h;break}se=m}}}var g=i.alternate;if(g!==null){var v=g.child;if(v!==null){g.child=null;do{var b=v.sibling;v.sibling=null,v=b}while(v!==null)}}se=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,se=s;else e:for(;se!==null;){if(i=se,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Sl(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,se=x;break e}se=i.return}}var y=e.current;for(se=y;se!==null;){s=se;var w=s.child;if(s.subtreeFlags&2064&&w!==null)w.return=s,se=w;else e:for(s=y;se!==null;){if(l=se,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Zd(9,l)}}catch(j){Rt(l,l.return,j)}if(l===s){se=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,se=S;break e}se=l.return}}if(He=o,xi(),Yr&&typeof Yr.onPostCommitFiberRoot=="function")try{Yr.onPostCommitFiberRoot(Hd,e)}catch{}r=!0}return r}finally{Je=n,or.transition=t}}return!1}function Bx(e,t,n){t=fa(n,t),t=xC(e,t,1),e=ii(e,t,1),t=wn(),e!==null&&(sc(e,1,t),Nn(e,t))}function Rt(e,t,n){if(e.tag===3)Bx(e,e,n);else for(;t!==null;){if(t.tag===3){Bx(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(si===null||!si.has(r))){e=fa(n,e),e=wC(t,e,1),t=ii(t,e,1),e=wn(),t!==null&&(sc(t,1,e),Nn(t,e));break}}t=t.return}}function p_(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=wn(),e.pingedLanes|=e.suspendedLanes&n,Gt===e&&(nn&n)===n&&(Ut===4||Ut===3&&(nn&130023424)===nn&&500>Mt()-qg?Ui(e,0):Hg|=n),Nn(e,t)}function zC(e,t){t===0&&(e.mode&1?(t=Jc,Jc<<=1,!(Jc&130023424)&&(Jc=4194304)):t=1);var n=wn();e=xo(e,t),e!==null&&(sc(e,t,n),Nn(e,n))}function m_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zC(e,n)}function g_(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),zC(e,n)}var BC;BC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_n.current)Dn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Dn=!1,r_(e,t,n);Dn=!!(e.flags&131072)}else Dn=!1,St&&t.flags&1048576&&Wb(t,rd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Iu(e,t),e=t.pendingProps;var o=la(t,dn.current);na(t,n),o=Fg(null,t,r,e,o,n);var i=zg();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,An(r)?(i=!0,td(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ng(t),o.updater=Xd,t.stateNode=o,o._reactInternals=t,Jp(t,r,e,n),t=tm(null,t,r,!0,i,n)):(t.tag=0,St&&i&&Tg(t),gn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Iu(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=y_(r),e=Sr(r,e),o){case 0:t=em(null,t,r,e,n);break e;case 1:t=Dx(null,t,r,e,n);break e;case 11:t=Rx(null,t,r,e,n);break e;case 14:t=Ix(null,t,r,Sr(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Sr(r,o),em(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Sr(r,o),Dx(e,t,r,o,n);case 3:e:{if(EC(t),e===null)throw Error(K(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Qb(e,t),sd(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=fa(Error(K(423)),t),t=_x(e,t,r,n,o);break e}else if(r!==o){o=fa(Error(K(424)),t),t=_x(e,t,r,n,o);break e}else for(Vn=oi(t.stateNode.containerInfo.firstChild),Hn=t,St=!0,Er=null,n=Jb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ca(),r===o){t=wo(e,t,n);break e}gn(e,t,r,n)}t=t.child}return t;case 5:return Zb(t),e===null&&Kp(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Wp(r,o)?s=null:i!==null&&Wp(r,i)&&(t.flags|=32),CC(e,t),gn(e,t,s,n),t.child;case 6:return e===null&&Kp(t),null;case 13:return jC(e,t,n);case 4:return Og(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ua(t,null,r,n):gn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Sr(r,o),Rx(e,t,r,o,n);case 7:return gn(e,t,t.pendingProps,n),t.child;case 8:return gn(e,t,t.pendingProps.children,n),t.child;case 12:return gn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,at(od,r._currentValue),r._currentValue=s,i!==null)if(Ir(i.value,s)){if(i.children===o.children&&!_n.current){t=wo(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ho(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Yp(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(K(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Yp(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}gn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,na(t,n),o=sr(o),r=r(o),t.flags|=1,gn(e,t,r,n),t.child;case 14:return r=t.type,o=Sr(r,t.pendingProps),o=Sr(r.type,o),Ix(e,t,r,o,n);case 15:return SC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Sr(r,o),Iu(e,t),t.tag=1,An(r)?(e=!0,td(t)):e=!1,na(t,n),Yb(t,r,o),Jp(t,r,o,n),tm(null,t,r,!0,e,n);case 19:return PC(e,t,n);case 22:return bC(e,t,n)}throw Error(K(156,t.tag))};function UC(e,t){return pb(e,t)}function v_(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(e,t,n,r){return new v_(e,t,n,r)}function Yg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function y_(e){if(typeof e=="function")return Yg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mg)return 11;if(e===gg)return 14}return 2}function li(e,t){var n=e.alternate;return n===null?(n=rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Au(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Yg(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case $s:return Vi(n.children,o,i,t);case pg:s=8,o|=8;break;case bp:return e=rr(12,n,t,o|2),e.elementType=bp,e.lanes=i,e;case Cp:return e=rr(13,n,t,o),e.elementType=Cp,e.lanes=i,e;case Ep:return e=rr(19,n,t,o),e.elementType=Ep,e.lanes=i,e;case XS:return tf(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case KS:s=10;break e;case YS:s=9;break e;case mg:s=11;break e;case gg:s=14;break e;case Vo:s=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=rr(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Vi(e,t,n,r){return e=rr(7,e,r,t),e.lanes=n,e}function tf(e,t,n,r){return e=rr(22,e,r,t),e.elementType=XS,e.lanes=n,e.stateNode={isHidden:!1},e}function Qh(e,t,n){return e=rr(6,e,null,t),e.lanes=n,e}function Kh(e,t,n){return t=rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function x_(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rh(0),this.expirationTimes=Rh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rh(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Xg(e,t,n,r,o,i,s,l,c){return e=new x_(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=rr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ng(i),e}function w_(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ms,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function VC(e){if(!e)return fi;e=e._reactInternals;e:{if(ls(e)!==e||e.tag!==1)throw Error(K(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(An(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(K(171))}if(e.tag===1){var n=e.type;if(An(n))return Ub(e,n,t)}return t}function WC(e,t,n,r,o,i,s,l,c){return e=Xg(n,r,!0,e,o,i,s,l,c),e.context=VC(null),n=e.current,r=wn(),o=ai(n),i=ho(r,o),i.callback=t??null,ii(n,i,o),e.current.lanes=o,sc(e,o,r),Nn(e,r),e}function nf(e,t,n,r){var o=t.current,i=wn(),s=ai(o);return n=VC(n),t.context===null?t.context=n:t.pendingContext=n,t=ho(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ii(o,t,s),e!==null&&(kr(e,o,s,i),Tu(e,o,s)),s}function pd(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Ux(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Jg(e,t){Ux(e,t),(e=e.alternate)&&Ux(e,t)}function S_(){return null}var HC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Zg(e){this._internalRoot=e}rf.prototype.render=Zg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));nf(e,t,null,null)};rf.prototype.unmount=Zg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ki(function(){nf(null,e,null,null)}),t[yo]=null}};function rf(e){this._internalRoot=e}rf.prototype.unstable_scheduleHydration=function(e){if(e){var t=Sb();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qo.length&&t!==0&&t<Qo[n].priority;n++);Qo.splice(n,0,e),n===0&&Cb(e)}};function ev(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function of(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Vx(){}function b_(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=pd(s);i.call(u)}}var s=WC(t,r,e,0,null,!1,!1,"",Vx);return e._reactRootContainer=s,e[yo]=s.current,Ol(e.nodeType===8?e.parentNode:e),Ki(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var u=pd(c);l.call(u)}}var c=Xg(e,0,!1,null,null,!1,!1,"",Vx);return e._reactRootContainer=c,e[yo]=c.current,Ol(e.nodeType===8?e.parentNode:e),Ki(function(){nf(t,c,n,r)}),c}function sf(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var l=o;o=function(){var c=pd(s);l.call(c)}}nf(t,s,e,o)}else s=b_(n,t,e,o,r);return pd(s)}xb=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ul(t.pendingLanes);n!==0&&(xg(t,n|1),Nn(t,Mt()),!(He&6)&&(ha=Mt()+500,xi()))}break;case 13:Ki(function(){var r=xo(e,1);if(r!==null){var o=wn();kr(r,e,1,o)}}),Jg(e,1)}};wg=function(e){if(e.tag===13){var t=xo(e,134217728);if(t!==null){var n=wn();kr(t,e,134217728,n)}Jg(e,134217728)}};wb=function(e){if(e.tag===13){var t=ai(e),n=xo(e,t);if(n!==null){var r=wn();kr(n,e,t,r)}Jg(e,t)}};Sb=function(){return Je};bb=function(e,t){var n=Je;try{return Je=e,t()}finally{Je=n}};Np=function(e,t,n){switch(t){case"input":if(Tp(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Kd(r);if(!o)throw Error(K(90));ZS(r),Tp(r,o)}}}break;case"textarea":tb(e,n);break;case"select":t=n.value,t!=null&&Js(e,!!n.multiple,t,!1)}};lb=Gg;cb=Ki;var C_={usingClientEntryPoint:!1,Events:[lc,Bs,Kd,sb,ab,Gg]},Xa={findFiberByHostInstance:Mi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},E_={bundleType:Xa.bundleType,version:Xa.version,rendererPackageName:Xa.rendererPackageName,rendererConfig:Xa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ro.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=fb(e),e===null?null:e.stateNode},findFiberByHostInstance:Xa.findFiberByHostInstance||S_,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cu.isDisabled&&cu.supportsFiber)try{Hd=cu.inject(E_),Yr=cu}catch{}}Kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=C_;Kn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ev(t))throw Error(K(200));return w_(e,t,null,n)};Kn.createRoot=function(e,t){if(!ev(e))throw Error(K(299));var n=!1,r="",o=HC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Xg(e,1,!1,null,null,n,!1,r,o),e[yo]=t.current,Ol(e.nodeType===8?e.parentNode:e),new Zg(t)};Kn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=fb(t),e=e===null?null:e.stateNode,e};Kn.flushSync=function(e){return Ki(e)};Kn.hydrate=function(e,t,n){if(!of(t))throw Error(K(200));return sf(null,e,t,!0,n)};Kn.hydrateRoot=function(e,t,n){if(!ev(e))throw Error(K(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=HC;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=WC(t,null,e,1,n??null,o,!1,i,s),e[yo]=t.current,Ol(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new rf(t)};Kn.render=function(e,t,n){if(!of(t))throw Error(K(200));return sf(null,e,t,!1,n)};Kn.unmountComponentAtNode=function(e){if(!of(e))throw Error(K(40));return e._reactRootContainer?(Ki(function(){sf(null,null,e,!1,function(){e._reactRootContainer=null,e[yo]=null})}),!0):!1};Kn.unstable_batchedUpdates=Gg;Kn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!of(n))throw Error(K(200));if(e==null||e._reactInternals===void 0)throw Error(K(38));return sf(e,t,n,!1,r)};Kn.version="18.2.0-next-9e3b772b8-20220608";function qC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qC)}catch(e){console.error(e)}}qC(),WS.exports=Kn;var uc=WS.exports;const fl=Qm(uc),j_=nS({__proto__:null,default:fl},[uc]),[P_,fr]=bn("ScrollArea.Root component was not found in tree");function pa(e,t){const n=Ni(t);Pa(()=>{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 T_=C.forwardRef((e,t)=>{const{style:n,...r}=e,o=fr(),[i,s]=C.useState(0),[l,c]=C.useState(0),u=!!(i&&l);return pa(o.scrollbarX,()=>{var f;const d=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(d),c(d)}),pa(o.scrollbarY,()=>{var f;const d=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(d),s(d)}),u?C.createElement("div",{...r,ref:t,style:{...n,width:i,height:l}}):null}),k_=C.forwardRef((e,t)=>{const n=fr(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?C.createElement(T_,{...e,ref:t}):null}),R_={scrollHideDelay:1e3,type:"hover"},GC=p.forwardRef((e,t)=>{const n=U("ScrollAreaRoot",R_,e),{type:r,scrollHideDelay:o,scrollbars:i,...s}=n,[l,c]=p.useState(null),[u,d]=p.useState(null),[f,h]=p.useState(null),[m,g]=p.useState(null),[v,b]=p.useState(null),[x,y]=p.useState(0),[w,S]=p.useState(0),[j,E]=p.useState(!1),[P,T]=p.useState(!1),k=Yt(t,I=>c(I));return C.createElement(P_,{value:{type:r,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:S}},C.createElement(q,{...s,ref:k,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${x}px`,"--sa-corner-height":i!=="xy"?"0px":`${w}px`}}))});GC.displayName="@mantine/core/ScrollAreaRoot";function QC(e,t){const n=e/t;return Number.isNaN(n)?0:n}function af(e){const t=QC(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function KC(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 I_(e,[t,n]){return Math.min(n,Math.max(t,e))}function Wx(e,t,n="ltr"){const r=af(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,s]:[s*-1,0],u=I_(e,c);return KC([0,s],[0,l])(u)}function D_(e,t,n,r="ltr"){const o=af(n),i=o/2,s=t||i,l=o-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return KC([c,u],f)(e)}function YC(e,t){return e>0&&e<t}function md(e){return e?parseInt(e,10):0}function Wi(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e==null||e(r),(n===!1||!r.defaultPrevented)&&(t==null||t(r))}}const[__,XC]=bn("ScrollAreaScrollbar was not found in tree"),JC=p.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=e,h=fr(),[m,g]=C.useState(null),v=Yt(t,T=>g(T)),b=C.useRef(null),x=C.useRef(""),{viewport:y}=h,w=n.content-n.viewport,S=Ni(u),j=Ni(l),E=Bd(d,10),P=T=>{if(b.current){const k=T.clientX-b.current.left,I=T.clientY-b.current.top;c({x:k,y:I})}};return p.useEffect(()=>{const T=k=>{const I=k.target;(m==null?void 0:m.contains(I))&&S(k,w)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[y,m,w,S]),p.useEffect(j,[n,j]),pa(m,E),pa(h.content,E),C.createElement(__,{value:{scrollbar:m,hasThumb:r,onThumbChange:Ni(o),onThumbPointerUp:Ni(i),onThumbPositionChange:j,onThumbPointerDown:Ni(s)}},C.createElement("div",{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:Wi(e.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),b.current=m.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",P(T))}),onPointerMove:Wi(e.onPointerMove,P),onPointerUp:Wi(e.onPointerUp,T=>{const k=T.target;k.hasPointerCapture(T.pointerId)&&k.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=x.current,b.current=null})}))}),A_=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=fr(),[l,c]=p.useState(),u=p.useRef(null),d=Yt(t,u,s.onScrollbarXChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),C.createElement(JC,{"data-orientation":"horizontal",...i,ref:d,sizes:n,style:{...o,"--sa-thumb-width":`${af(n)}px`},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(s.viewport){const m=s.viewport.scrollLeft+f.deltaX;e.onWheelScroll(m),YC(m,h)&&f.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:md(l.paddingLeft),paddingEnd:md(l.paddingRight)}})}})}),N_=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=fr(),[l,c]=C.useState(),u=p.useRef(null),d=Yt(t,u,s.onScrollbarYChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),C.createElement(JC,{...i,"data-orientation":"vertical",ref:d,sizes:n,style:{"--sa-thumb-height":`${af(n)}px`,...o},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(s.viewport){const m=s.viewport.scrollTop+f.deltaY;e.onWheelScroll(m),YC(m,h)&&f.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:md(l.paddingTop),paddingEnd:md(l.paddingBottom)}})}})}),tv=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=ss(),i=fr(),s=p.useRef(null),l=p.useRef(0),[c,u]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=QC(c.viewport,c.content),f={...r,sizes:c,onSizesChange:u,hasThumb:d>0&&d<1,onThumbChange:m=>{s.current=m},onThumbPointerUp:()=>{l.current=0},onThumbPointerDown:m=>{l.current=m}},h=(m,g)=>D_(m,l.current,c,g);return n==="horizontal"?C.createElement(A_,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,g=Wx(m,c,o);s.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollLeft=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollLeft=h(m,o))}}):n==="vertical"?C.createElement(N_,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,g=Wx(m,c);s.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollTop=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollTop=h(m))}}):null}),ZC=p.forwardRef((e,t)=>{const n=fr(),{forceMount:r,...o}=e,[i,s]=p.useState(!1),l=e.orientation==="horizontal",c=Bd(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?u:d)}},10);return pa(n.viewport,c),pa(n.content,c),r||i?C.createElement(tv,{"data-state":i?"visible":"hidden",...o,ref:t}):null}),O_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=fr(),[i,s]=p.useState(!1);return p.useEffect(()=>{const{scrollArea:l}=o;let c=0;if(l){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),n||i?C.createElement(ZC,{"data-state":i?"visible":"hidden",...r,ref:t}):null}),M_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=fr(),i=e.orientation==="horizontal",[s,l]=p.useState("hidden"),c=Bd(()=>l("idle"),100);return p.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>l("hidden"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,o.scrollHideDelay]),p.useEffect(()=>{const{viewport:u}=o,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(l("scrolling"),c()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c]),n||s!=="hidden"?C.createElement(tv,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Wi(e.onPointerEnter,()=>l("interacting")),onPointerLeave:Wi(e.onPointerLeave,()=>l("idle"))}):null}),Hx=C.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=fr(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,l=e.orientation==="horizontal";return C.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),o.type==="hover"?C.createElement(O_,{...r,ref:t,forceMount:n}):o.type==="scroll"?C.createElement(M_,{...r,ref:t,forceMount:n}):o.type==="auto"?C.createElement(ZC,{...r,ref:t,forceMount:n}):o.type==="always"?C.createElement(tv,{...r,ref:t}):null});function $_(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,l=n.top!==i.top;(s||l)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)}const L_=p.forwardRef((e,t)=>{const{style:n,...r}=e,o=fr(),i=XC(),{onThumbPositionChange:s}=i,l=Yt(t,d=>i.onThumbChange(d)),c=p.useRef(),u=Bd(()=>{c.current&&(c.current(),c.current=void 0)},100);return p.useEffect(()=>{const{viewport:d}=o;if(d){const f=()=>{if(u(),!c.current){const h=$_(d,s);c.current=h,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,s]),C.createElement("div",{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:Wi(e.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,g=d.clientY-h.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:Wi(e.onPointerUp,i.onThumbPointerUp)})}),qx=C.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=XC();return n||o.hasThumb?C.createElement(L_,{ref:t,...r}):null}),eE=p.forwardRef(({children:e,style:t,...n},r)=>{const o=fr(),i=Yt(r,o.onViewportChange);return C.createElement(q,{...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t}},C.createElement("div",{style:{minWidth:"100%",display:"table"},ref:o.onContentChange},e))});eE.displayName="@mantine/core/ScrollAreaViewport";var nv={root:"m-d57069b5",viewport:"m-c0783ff9",viewportInner:"m-f8f631dd",scrollbar:"m-c44ba933",thumb:"m-d8b5e363",corner:"m-21657268"};const tE={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},F_=(e,{scrollbarSize:t})=>({root:{"--scrollarea-scrollbar-size":z(t)}}),hr=Q((e,t)=>{const n=U("ScrollArea",tE,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,scrollbarSize:c,vars:u,type:d,scrollHideDelay:f,viewportProps:h,viewportRef:m,onScrollPositionChange:g,children:v,offsetScrollbars:b,scrollbars:x,...y}=n,[w,S]=p.useState(!1),j=fe({name:"ScrollArea",props:n,classes:nv,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:F_});return C.createElement(GC,{type:d==="never"?"always":d,scrollHideDelay:f,ref:t,scrollbars:x,...j("root"),...y},C.createElement(eE,{...h,...j("viewport",{style:h==null?void 0:h.style}),ref:m,"data-offset-scrollbars":b===!0?"xy":b||void 0,"data-scrollbars":x||void 0,onScroll:typeof g=="function"?({currentTarget:E})=>g({x:E.scrollLeft,y:E.scrollTop}):void 0},v),(x==="xy"||x==="x")&&C.createElement(Hx,{...j("scrollbar"),orientation:"horizontal","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)},C.createElement(qx,{...j("thumb")})),(x==="xy"||x==="y")&&C.createElement(Hx,{...j("scrollbar"),orientation:"vertical","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)},C.createElement(qx,{...j("thumb")})),C.createElement(k_,{...j("corner"),"data-hovered":w||void 0,"data-hidden":d==="never"||void 0}))});hr.displayName="@mantine/core/ScrollArea";const rv=Q((e,t)=>{const{children:n,classNames:r,styles:o,scrollbarSize:i,scrollHideDelay:s,type:l,dir:c,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:h,variant:m,viewportProps:g,scrollbars:v,style:b,vars:x,...y}=U("ScrollAreaAutosize",tE,e);return C.createElement(q,{...y,ref:t,style:[{display:"flex",overflow:"auto"},b]},C.createElement(q,{style:{display:"flex",flexDirection:"column",flex:1}},C.createElement(hr,{classNames:r,styles:o,scrollHideDelay:s,scrollbarSize:i,type:l,dir:c,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:h,variant:m,viewportProps:g,vars:x,scrollbars:v},n)))});hr.classes=nv;rv.displayName="@mantine/core/ScrollAreaAutosize";rv.classes=nv;hr.Autosize=rv;var nE={root:"m-87cf2631"};const z_={__staticSelector:"UnstyledButton"},lr=fn((e,t)=>{const n=U("UnstyledButton",z_,e),{className:r,component:o="button",__staticSelector:i,unstyled:s,classNames:l,styles:c,style:u,...d}=n,f=fe({name:i,props:n,classes:nE,className:r,style:u,classNames:l,styles:c,unstyled:s});return C.createElement(q,{...f("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...d})});lr.classes=nE;lr.displayName="@mantine/core/UnstyledButton";var rE={root:"m-1b7284a3"};const B_={},U_=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:ft(t),"--paper-shadow":tg(n)}}),On=fn((e,t)=>{const n=U("Paper",B_,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,withBorder:c,vars:u,radius:d,shadow:f,variant:h,mod:m,...g}=n,v=fe({name:"Paper",props:n,classes:rE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:U_});return C.createElement(q,{ref:t,mod:[{"data-with-border":c},m],...v("root"),variant:h,...g})});On.classes=rE;On.displayName="@mantine/core/Paper";const Dr=Math.min,ln=Math.max,gd=Math.round,uu=Math.floor,hi=e=>({x:e,y:e}),V_={left:"right",right:"left",bottom:"top",top:"bottom"},W_={start:"end",end:"start"};function hm(e,t,n){return ln(e,Dr(t,n))}function So(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function Ia(e){return e.split("-")[1]}function ov(e){return e==="x"?"y":"x"}function iv(e){return e==="y"?"height":"width"}function cs(e){return["top","bottom"].includes(_r(e))?"y":"x"}function sv(e){return ov(cs(e))}function H_(e,t,n){n===void 0&&(n=!1);const r=Ia(e),o=sv(e),i=iv(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=vd(s)),[s,vd(s)]}function q_(e){const t=vd(e);return[pm(e),t,pm(t)]}function pm(e){return e.replace(/start|end/g,t=>W_[t])}function G_(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function Q_(e,t,n,r){const o=Ia(e);let i=G_(_r(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(pm)))),i}function vd(e){return e.replace(/left|right|bottom|top/g,t=>V_[t])}function K_(e){return{top:0,right:0,bottom:0,left:0,...e}}function av(e){return typeof e!="number"?K_(e):{top:e,right:e,bottom:e,left:e}}function ma(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Gx(e,t,n){let{reference:r,floating:o}=e;const i=cs(t),s=sv(t),l=iv(s),c=_r(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Ia(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const Y_=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Gx(u,r,c),h=r,m={},g=0;for(let v=0;v<l.length;v++){const{name:b,fn:x}=l[v],{x:y,y:w,data:S,reset:j}=await x({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=y??d,f=w??f,m={...m,[b]:{...m[b],...S}},j&&g<=50&&(g++,typeof j=="object"&&(j.placement&&(h=j.placement),j.rects&&(u=j.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:f}=Gx(u,h,c)),v=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function lv(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=So(t,e),g=av(m),b=l[h?f==="floating"?"reference":"floating":f],x=ma(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{...s.floating,x:r,y:o}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},j=ma(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:w,strategy:c}):y);return{top:(x.top-j.top+g.top)/S.y,bottom:(j.bottom-x.bottom+g.bottom)/S.y,left:(x.left-j.left+g.left)/S.x,right:(j.right-x.right+g.right)/S.x}}const X_=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=So(e,t)||{};if(u==null)return{};const f=av(d),h={x:n,y:r},m=sv(o),g=iv(m),v=await s.getDimensions(u),b=m==="y",x=b?"top":"left",y=b?"bottom":"right",w=b?"clientHeight":"clientWidth",S=i.reference[g]+i.reference[m]-h[m]-i.floating[g],j=h[m]-i.reference[m],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let P=E?E[w]:0;(!P||!await(s.isElement==null?void 0:s.isElement(E)))&&(P=l.floating[w]||i.floating[g]);const T=S/2-j/2,k=P/2-v[g]/2-1,I=Dr(f[x],k),O=Dr(f[y],k),R=I,M=P-v[g]-O,N=P/2-v[g]/2+T,B=hm(R,N,M),D=!c.arrow&&Ia(o)!=null&&N!==B&&i.reference[g]/2-(N<R?I:O)-v[g]/2<0,$=D?N<R?N-R:N-M:0;return{[m]:h[m]+$,data:{[m]:B,centerOffset:N-B-$,...D&&{alignmentOffset:$}},reset:D}}}),J_=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...b}=So(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=_r(o),y=_r(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(y||!v?[vd(l)]:q_(l));!h&&g!=="none"&&S.push(...Q_(l,v,g,w));const j=[l,...S],E=await lv(t,b),P=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&P.push(E[x]),f){const R=H_(o,s,w);P.push(E[R[0]],E[R[1]])}if(T=[...T,{placement:o,overflows:P}],!P.every(R=>R<=0)){var k,I;const R=(((k=i.flip)==null?void 0:k.index)||0)+1,M=j[R];if(M)return{data:{index:R,overflows:T},reset:{placement:M}};let N=(I=T.filter(B=>B.overflows[0]<=0).sort((B,D)=>B.overflows[1]-D.overflows[1])[0])==null?void 0:I.placement;if(!N)switch(m){case"bestFit":{var O;const B=(O=T.map(D=>[D.placement,D.overflows.filter($=>$>0).reduce(($,_)=>$+_,0)]).sort((D,$)=>D[1]-$[1])[0])==null?void 0:O[0];B&&(N=B);break}case"initialPlacement":N=l;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function oE(e){const t=Dr(...e.map(i=>i.left)),n=Dr(...e.map(i=>i.top)),r=ln(...e.map(i=>i.right)),o=ln(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:o-n}}function Z_(e){const t=e.slice().sort((o,i)=>o.y-i.y),n=[];let r=null;for(let o=0;o<t.length;o++){const i=t[o];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(o=>ma(oE(o)))}const e4=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:s}=t,{padding:l=2,x:c,y:u}=So(e,t),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),f=Z_(d),h=ma(oE(d)),m=av(l);function g(){if(f.length===2&&f[0].left>f[1].right&&c!=null&&u!=null)return f.find(b=>c>b.left-m.left&&c<b.right+m.right&&u>b.top-m.top&&u<b.bottom+m.bottom)||h;if(f.length>=2){if(cs(n)==="y"){const I=f[0],O=f[f.length-1],R=_r(n)==="top",M=I.top,N=O.bottom,B=R?I.left:O.left,D=R?I.right:O.right,$=D-B,_=N-M;return{top:M,bottom:N,left:B,right:D,width:$,height:_,x:B,y:M}}const b=_r(n)==="left",x=ln(...f.map(I=>I.right)),y=Dr(...f.map(I=>I.left)),w=f.filter(I=>b?I.left===y:I.right===x),S=w[0].top,j=w[w.length-1].bottom,E=y,P=x,T=P-E,k=j-S;return{top:S,bottom:j,left:E,right:P,width:T,height:k,x:E,y:S}}return h}const v=await i.getElementRects({reference:{getBoundingClientRect:g},floating:r.floating,strategy:s});return o.reference.x!==v.reference.x||o.reference.y!==v.reference.y||o.reference.width!==v.reference.width||o.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}};async function t4(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=_r(n),l=Ia(n),c=cs(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=So(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const iE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=t,c=await t4(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},n4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:b=>{let{x,y}=b;return{x,y}}},...c}=So(e,t),u={x:n,y:r},d=await lv(t,c),f=cs(_r(o)),h=ov(f);let m=u[h],g=u[f];if(i){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",y=m+d[b],w=m-d[x];m=hm(y,m,w)}if(s){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",y=g+d[b],w=g-d[x];g=hm(y,g,w)}const v=l.fn({...t,[h]:m,[f]:g});return{...v,data:{x:v.x-n,y:v.y-r}}}}},r4=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=So(e,t),d={x:n,y:r},f=cs(o),h=ov(f);let m=d[h],g=d[f];const v=So(l,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const w=h==="y"?"height":"width",S=i.reference[h]-i.floating[w]+b.mainAxis,j=i.reference[h]+i.reference[w]-b.mainAxis;m<S?m=S:m>j&&(m=j)}if(u){var x,y;const w=h==="y"?"width":"height",S=["top","left"].includes(_r(o)),j=i.reference[f]-i.floating[w]+(S&&((x=s.offset)==null?void 0:x[f])||0)+(S?0:b.crossAxis),E=i.reference[f]+i.reference[w]+(S?0:((y=s.offset)==null?void 0:y[f])||0)-(S?b.crossAxis:0);g<j?g=j:g>E&&(g=E)}return{[h]:m,[f]:g}}}},o4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...l}=So(e,t),c=await lv(t,l),u=_r(n),d=Ia(n),f=cs(n)==="y",{width:h,height:m}=r.floating;let g,v;u==="top"||u==="bottom"?(g=u,v=d===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(v=u,g=d==="end"?"top":"bottom");const b=m-c[g],x=h-c[v],y=!t.middlewareData.shift;let w=b,S=x;if(f){const E=h-c.left-c.right;S=d||y?Dr(x,E):E}else{const E=m-c.top-c.bottom;w=d||y?Dr(b,E):E}if(y&&!d){const E=ln(c.left,0),P=ln(c.right,0),T=ln(c.top,0),k=ln(c.bottom,0);f?S=h-2*(E!==0||P!==0?E+P:ln(c.left,c.right)):w=m-2*(T!==0||k!==0?T+k:ln(c.top,c.bottom))}await s({...t,availableWidth:S,availableHeight:w});const j=await o.getDimensions(i.floating);return h!==j.width||m!==j.height?{reset:{rects:!0}}:{}}}};function pi(e){return sE(e)?(e.nodeName||"").toLowerCase():"#document"}function qn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Io(e){var t;return(t=(sE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function sE(e){return e instanceof Node||e instanceof qn(e).Node}function bo(e){return e instanceof Element||e instanceof qn(e).Element}function no(e){return e instanceof HTMLElement||e instanceof qn(e).HTMLElement}function Qx(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof qn(e).ShadowRoot}function dc(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=cr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function i4(e){return["table","td","th"].includes(pi(e))}function cv(e){const t=uv(),n=cr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function s4(e){let t=ga(e);for(;no(t)&&!lf(t);){if(cv(t))return t;t=ga(t)}return null}function uv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function lf(e){return["html","body","#document"].includes(pi(e))}function cr(e){return qn(e).getComputedStyle(e)}function cf(e){return bo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ga(e){if(pi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qx(e)&&e.host||Io(e);return Qx(t)?t.host:t}function aE(e){const t=ga(e);return lf(t)?e.ownerDocument?e.ownerDocument.body:e.body:no(t)&&dc(t)?t:aE(t)}function po(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=aE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=qn(o);return i?t.concat(s,s.visualViewport||[],dc(o)?o:[],s.frameElement&&n?po(s.frameElement):[]):t.concat(o,po(o,[],n))}function lE(e){const t=cr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=no(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=gd(n)!==i||gd(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function dv(e){return bo(e)?e:e.contextElement}function oa(e){const t=dv(e);if(!no(t))return hi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=lE(t);let s=(i?gd(n.width):n.width)/r,l=(i?gd(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const a4=hi(0);function cE(e){const t=qn(e);return!uv()||!t.visualViewport?a4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function l4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qn(e)?!1:t}function Yi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=dv(e);let s=hi(1);t&&(r?bo(r)&&(s=oa(r)):s=oa(e));const l=l4(i,n,r)?cE(i):hi(0);let c=(o.left+l.x)/s.x,u=(o.top+l.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const h=qn(i),m=r&&bo(r)?qn(r):r;let g=h,v=g.frameElement;for(;v&&r&&m!==g;){const b=oa(v),x=v.getBoundingClientRect(),y=cr(v),w=x.left+(v.clientLeft+parseFloat(y.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(y.paddingTop))*b.y;c*=b.x,u*=b.y,d*=b.x,f*=b.y,c+=w,u+=S,g=qn(v),v=g.frameElement}}return ma({width:d,height:f,x:c,y:u})}const c4=[":popover-open",":modal"];function uE(e){return c4.some(t=>{try{return e.matches(t)}catch{return!1}})}function u4(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Io(r),l=t?uE(t.floating):!1;if(r===s||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=hi(1);const d=hi(0),f=no(r);if((f||!f&&!i)&&((pi(r)!=="body"||dc(s))&&(c=cf(r)),no(r))){const h=Yi(r);u=oa(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function d4(e){return Array.from(e.getClientRects())}function dE(e){return Yi(Io(e)).left+cf(e).scrollLeft}function f4(e){const t=Io(e),n=cf(e),r=e.ownerDocument.body,o=ln(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ln(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+dE(e);const l=-n.scrollTop;return cr(r).direction==="rtl"&&(s+=ln(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function h4(e,t){const n=qn(e),r=Io(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,c=0;if(o){i=o.width,s=o.height;const u=uv();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:l,y:c}}function p4(e,t){const n=Yi(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=no(e)?oa(e):hi(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:l,x:c,y:u}}function Kx(e,t,n){let r;if(t==="viewport")r=h4(e,n);else if(t==="document")r=f4(Io(e));else if(bo(t))r=p4(t,n);else{const o=cE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ma(r)}function fE(e,t){const n=ga(e);return n===t||!bo(n)||lf(n)?!1:cr(n).position==="fixed"||fE(n,t)}function m4(e,t){const n=t.get(e);if(n)return n;let r=po(e,[],!1).filter(l=>bo(l)&&pi(l)!=="body"),o=null;const i=cr(e).position==="fixed";let s=i?ga(e):e;for(;bo(s)&&!lf(s);){const l=cr(s),c=cv(s);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||dc(s)&&!c&&fE(e,s))?r=r.filter(d=>d!==s):o=l,s=ga(s)}return t.set(e,r),r}function g4(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?m4(t,this._c):[].concat(n),r],l=s[0],c=s.reduce((u,d)=>{const f=Kx(t,d,o);return u.top=ln(f.top,u.top),u.right=Dr(f.right,u.right),u.bottom=Dr(f.bottom,u.bottom),u.left=ln(f.left,u.left),u},Kx(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function v4(e){const{width:t,height:n}=lE(e);return{width:t,height:n}}function y4(e,t,n){const r=no(t),o=Io(t),i=n==="fixed",s=Yi(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=hi(0);if(r||!r&&!i)if((pi(t)!=="body"||dc(o))&&(l=cf(t)),r){const f=Yi(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&(c.x=dE(o));const u=s.left+l.scrollLeft-c.x,d=s.top+l.scrollTop-c.y;return{x:u,y:d,width:s.width,height:s.height}}function Yx(e,t){return!no(e)||cr(e).position==="fixed"?null:t?t(e):e.offsetParent}function hE(e,t){const n=qn(e);if(!no(e)||uE(e))return n;let r=Yx(e,t);for(;r&&i4(r)&&cr(r).position==="static";)r=Yx(r,t);return r&&(pi(r)==="html"||pi(r)==="body"&&cr(r).position==="static"&&!cv(r))?n:r||s4(e)||n}const x4=async function(e){const t=this.getOffsetParent||hE,n=this.getDimensions;return{reference:y4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}};function w4(e){return cr(e).direction==="rtl"}const S4={convertOffsetParentRelativeRectToViewportRelativeRect:u4,getDocumentElement:Io,getClippingRect:g4,getOffsetParent:hE,getElementRects:x4,getClientRects:d4,getDimensions:v4,getScale:oa,isElement:bo,isRTL:w4};function b4(e,t){let n=null,r;const o=Io(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const m=uu(d),g=uu(o.clientWidth-(u+f)),v=uu(o.clientHeight-(d+h)),b=uu(u),y={rootMargin:-m+"px "+-g+"px "+-v+"px "+-b+"px",threshold:ln(0,Dr(1,c))||1};let w=!0;function S(j){const E=j[0].intersectionRatio;if(E!==c){if(!w)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},100)}w=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return s(!0),i}function C4(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=dv(e),d=o||i?[...u?po(u):[],...po(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&l?b4(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let g,v=c?Yi(e):null;c&&b();function b(){const x=Yi(e);v&&(x.x!==v.x||x.y!==v.y||x.width!==v.width||x.height!==v.height)&&n(),v=x,g=requestAnimationFrame(b)}return n(),()=>{var x;d.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f==null||f(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const fv=n4,pE=J_,E4=o4,Xx=X_,mE=e4,j4=r4,P4=(e,t,n)=>{const r=new Map,o={platform:S4,...n},i={...o.platform,_c:r};return Y_(e,t,{...o,platform:i})},gE=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?Xx({element:r.current,padding:o}).fn(n):{}:r?Xx({element:r,padding:o}).fn(n):{}}}};var Nu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function yd(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(!yd(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 i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!yd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function vE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jx(e,t){const n=vE(e);return Math.round(t*n)/n}function Zx(e){const t=p.useRef(e);return Nu(()=>{t.current=e}),t}function T4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(r);yd(h,r)||m(r);const[g,v]=p.useState(null),[b,x]=p.useState(null),y=p.useCallback($=>{$!==E.current&&(E.current=$,v($))},[]),w=p.useCallback($=>{$!==P.current&&(P.current=$,x($))},[]),S=i||g,j=s||b,E=p.useRef(null),P=p.useRef(null),T=p.useRef(d),k=c!=null,I=Zx(c),O=Zx(o),R=p.useCallback(()=>{if(!E.current||!P.current)return;const $={placement:t,strategy:n,middleware:h};O.current&&($.platform=O.current),P4(E.current,P.current,$).then(_=>{const F={..._,isPositioned:!0};M.current&&!yd(T.current,F)&&(T.current=F,uc.flushSync(()=>{f(F)}))})},[h,t,n,O]);Nu(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const M=p.useRef(!1);Nu(()=>(M.current=!0,()=>{M.current=!1}),[]),Nu(()=>{if(S&&(E.current=S),j&&(P.current=j),S&&j){if(I.current)return I.current(S,j,R);R()}},[S,j,R,I,k]);const N=p.useMemo(()=>({reference:E,floating:P,setReference:y,setFloating:w}),[y,w]),B=p.useMemo(()=>({reference:S,floating:j}),[S,j]),D=p.useMemo(()=>{const $={position:n,left:0,top:0};if(!B.floating)return $;const _=Jx(B.floating,d.x),F=Jx(B.floating,d.y);return l?{...$,transform:"translate("+_+"px, "+F+"px)",...vE(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:F}},[n,l,B.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:R,refs:N,elements:B,floatingStyles:D}),[d,R,N,B,D])}var mo=typeof document<"u"?p.useLayoutEffect:p.useEffect;let Yh=!1,k4=0;const e1=()=>"floating-ui-"+k4++;function R4(){const[e,t]=p.useState(()=>Yh?e1():void 0);return mo(()=>{e==null&&t(e1())},[]),p.useEffect(()=>{Yh||(Yh=!0)},[]),e}const I4=Zm.useId,yE=I4||R4;function D4(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const _4=p.createContext(null),A4=p.createContext(null),xE=()=>{var e;return((e=p.useContext(_4))==null?void 0:e.id)||null},hv=()=>p.useContext(A4);function Zo(e){return(e==null?void 0:e.ownerDocument)||document}function N4(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function O4(){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 uf(e){return Zo(e).defaultView||window}function Kr(e){return e?e instanceof Element||e instanceof uf(e).Element:!1}function wE(e){return e?e instanceof HTMLElement||e instanceof uf(e).HTMLElement:!1}function M4(e){if(typeof ShadowRoot>"u")return!1;const t=uf(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function $4(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(N4())||t.test(O4()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function L4(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!=="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function SE(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function F4(e){return"nativeEvent"in e}function mm(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&M4(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function bE(e){return"data-floating-ui-"+e}function t1(e){const t=p.useRef(e);return mo(()=>{t.current=e}),t}const n1=bE("safe-polygon");function Ou(e,t,n){return n&&!SE(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}function z4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:s,floating:l},refs:c}=e,{enabled:u=!0,delay:d=0,handleClose:f=null,mouseOnly:h=!1,restMs:m=0,move:g=!0}=t,v=hv(),b=xE(),x=t1(f),y=t1(d),w=p.useRef(),S=p.useRef(),j=p.useRef(),E=p.useRef(),P=p.useRef(!0),T=p.useRef(!1),k=p.useRef(()=>{}),I=p.useCallback(()=>{var N;const B=(N=o.current.openEvent)==null?void 0:N.type;return(B==null?void 0:B.includes("mouse"))&&B!=="mousedown"},[o]);p.useEffect(()=>{if(!u)return;function N(){clearTimeout(S.current),clearTimeout(E.current),P.current=!0}return i.on("dismiss",N),()=>{i.off("dismiss",N)}},[u,i]),p.useEffect(()=>{if(!u||!x.current||!n)return;function N(D){I()&&r(!1,D)}const B=Zo(l).documentElement;return B.addEventListener("mouseleave",N),()=>{B.removeEventListener("mouseleave",N)}},[l,n,r,u,x,o,I]);const O=p.useCallback(function(N,B){B===void 0&&(B=!0);const D=Ou(y.current,"close",w.current);D&&!j.current?(clearTimeout(S.current),S.current=setTimeout(()=>r(!1,N),D)):B&&(clearTimeout(S.current),r(!1,N))},[y,r]),R=p.useCallback(()=>{k.current(),j.current=void 0},[]),M=p.useCallback(()=>{if(T.current){const N=Zo(c.floating.current).body;N.style.pointerEvents="",N.removeAttribute(n1),T.current=!1}},[c]);return p.useEffect(()=>{if(!u)return;function N(){return o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1}function B(_){if(clearTimeout(S.current),P.current=!1,h&&!SE(w.current)||m>0&&Ou(y.current,"open")===0)return;const F=Ou(y.current,"open",w.current);F?S.current=setTimeout(()=>{r(!0,_)},F):r(!0,_)}function D(_){if(N())return;k.current();const F=Zo(l);if(clearTimeout(E.current),x.current){n||clearTimeout(S.current),j.current=x.current({...e,tree:v,x:_.clientX,y:_.clientY,onClose(){M(),R(),O(_)}});const G=j.current;F.addEventListener("mousemove",G),k.current=()=>{F.removeEventListener("mousemove",G)};return}(w.current==="touch"?!mm(l,_.relatedTarget):!0)&&O(_)}function $(_){N()||x.current==null||x.current({...e,tree:v,x:_.clientX,y:_.clientY,onClose(){M(),R(),O(_)}})(_)}if(Kr(s)){const _=s;return n&&_.addEventListener("mouseleave",$),l==null||l.addEventListener("mouseleave",$),g&&_.addEventListener("mousemove",B,{once:!0}),_.addEventListener("mouseenter",B),_.addEventListener("mouseleave",D),()=>{n&&_.removeEventListener("mouseleave",$),l==null||l.removeEventListener("mouseleave",$),g&&_.removeEventListener("mousemove",B),_.removeEventListener("mouseenter",B),_.removeEventListener("mouseleave",D)}}},[s,l,u,e,h,m,g,O,R,M,r,n,v,y,x,o]),mo(()=>{var N;if(u&&n&&(N=x.current)!=null&&N.__options.blockPointerEvents&&I()){const $=Zo(l).body;if($.setAttribute(n1,""),$.style.pointerEvents="none",T.current=!0,Kr(s)&&l){var B,D;const _=s,F=v==null||(B=v.nodesRef.current.find(H=>H.id===b))==null||(D=B.context)==null?void 0:D.elements.floating;return F&&(F.style.pointerEvents=""),_.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{_.style.pointerEvents="",l.style.pointerEvents=""}}}},[u,n,b,l,s,v,x,o,I]),mo(()=>{n||(w.current=void 0,R(),M())},[n,R,M]),p.useEffect(()=>()=>{R(),clearTimeout(S.current),clearTimeout(E.current),M()},[u,R,M]),p.useMemo(()=>{if(!u)return{};function N(B){w.current=B.pointerType}return{reference:{onPointerDown:N,onPointerEnter:N,onMouseMove(B){n||m===0||(clearTimeout(E.current),E.current=setTimeout(()=>{P.current||r(!0,B.nativeEvent)},m))}},floating:{onMouseEnter(){clearTimeout(S.current)},onMouseLeave(B){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),O(B.nativeEvent,!1)}}}},[i,u,m,n,r,O])}const CE=p.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),EE=()=>p.useContext(CE),B4=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=p.useReducer((c,u)=>({...c,...u}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=p.useRef(null),l=p.useCallback(c=>{i({currentId:c})},[]);return mo(()=>{o.currentId?s.current===null?s.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),s.current=null)},[o.currentId]),p.createElement(CE.Provider,{value:p.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,i,l])},t)},U4=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:i,setCurrentId:s,initialDelay:l,setState:c,timeoutMs:u}=EE();mo(()=>{i&&(c({delay:{open:1,close:Ou(l,"close")}}),i!==o&&r(!1))},[o,r,c,i,l]),mo(()=>{function d(){r(!1),c({delay:l,currentId:null})}if(!n&&i===o)if(u){const f=window.setTimeout(d,u);return()=>{clearTimeout(f)}}else d()},[n,c,i,o,r,l,u]),mo(()=>{n&&s(o)},[n,s,o])};function V4(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function Xh(e,t){let n=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)}),r=n;for(;r.length;)r=e.filter(o=>{var i;return(i=r)==null?void 0:i.some(s=>{var l;return o.parentId===s.id&&((l=o.context)==null?void 0:l.open)})}),n=n.concat(r);return n}function W4(e){return"composedPath"in e?e.composedPath()[0]:e.target}const H4=Zm.useInsertionEffect,q4=H4||(e=>e());function Mu(e){const t=p.useRef(()=>{});return q4(()=>{t.current=e}),p.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 $u(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)}const G4={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Q4={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},K4=e=>{var t,n;return{escapeKeyBubbles:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePressBubbles:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function Y4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,nodeId:i,elements:{reference:s,domReference:l,floating:c},dataRef:u}=e,{enabled:d=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:m="pointerdown",referencePress:g=!1,referencePressEvent:v="pointerdown",ancestorScroll:b=!1,bubbles:x}=t,y=hv(),w=xE()!=null,S=Mu(typeof h=="function"?h:()=>!1),j=typeof h=="function"?S:h,E=p.useRef(!1),{escapeKeyBubbles:P,outsidePressBubbles:T}=K4(x),k=Mu(O=>{if(!n||!d||!f||O.key!=="Escape")return;const R=y?Xh(y.nodesRef.current,i):[];if(!P&&(O.stopPropagation(),R.length>0)){let M=!0;if(R.forEach(N=>{var B;if((B=N.context)!=null&&B.open&&!N.context.dataRef.current.__escapeKeyBubbles){M=!1;return}}),!M)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1,F4(O)?O.nativeEvent:O)}),I=Mu(O=>{const R=E.current;if(E.current=!1,R||typeof j=="function"&&!j(O))return;const M=W4(O);if(wE(M)&&c){const D=M.clientWidth>0&&M.scrollWidth>M.clientWidth,$=M.clientHeight>0&&M.scrollHeight>M.clientHeight;let _=$&&O.offsetX>M.clientWidth;if($&&uf(c).getComputedStyle(M).direction==="rtl"&&(_=O.offsetX<=M.offsetWidth-M.clientWidth),_||D&&O.offsetY>M.clientHeight)return}const N=y&&Xh(y.nodesRef.current,i).some(D=>{var $;return $u(O,($=D.context)==null?void 0:$.elements.floating)});if($u(O,c)||$u(O,l)||N)return;const B=y?Xh(y.nodesRef.current,i):[];if(B.length>0){let D=!0;if(B.forEach($=>{var _;if((_=$.context)!=null&&_.open&&!$.context.dataRef.current.__outsidePressBubbles){D=!1;return}}),!D)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:w?{preventScroll:!0}:$4(O)||L4(O)}}),r(!1,O)});return p.useEffect(()=>{if(!n||!d)return;u.current.__escapeKeyBubbles=P,u.current.__outsidePressBubbles=T;function O(N){r(!1,N)}const R=Zo(c);f&&R.addEventListener("keydown",k),j&&R.addEventListener(m,I);let M=[];return b&&(Kr(l)&&(M=po(l)),Kr(c)&&(M=M.concat(po(c))),!Kr(s)&&s&&s.contextElement&&(M=M.concat(po(s.contextElement)))),M=M.filter(N=>{var B;return N!==((B=R.defaultView)==null?void 0:B.visualViewport)}),M.forEach(N=>{N.addEventListener("scroll",O,{passive:!0})}),()=>{f&&R.removeEventListener("keydown",k),j&&R.removeEventListener(m,I),M.forEach(N=>{N.removeEventListener("scroll",O)})}},[u,c,l,s,f,j,m,n,r,b,d,P,T,k,I]),p.useEffect(()=>{E.current=!1},[j,m]),p.useMemo(()=>d?{reference:{onKeyDown:k,[G4[v]]:O=>{g&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1,O.nativeEvent))}},floating:{onKeyDown:k,[Q4[m]]:()=>{E.current=!0}}}:{},[d,o,g,m,v,r,k])}function pv(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,s]=p.useState(null),l=((t=e.elements)==null?void 0:t.reference)||i,c=T4(e),u=hv(),d=Mu((S,j)=>{S&&(h.current.openEvent=j),r==null||r(S,j)}),f=p.useRef(null),h=p.useRef({}),m=p.useState(()=>D4())[0],g=yE(),v=p.useCallback(S=>{const j=Kr(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;c.refs.setReference(j)},[c.refs]),b=p.useCallback(S=>{(Kr(S)||S===null)&&(f.current=S,s(S)),(Kr(c.refs.reference.current)||c.refs.reference.current===null||S!==null&&!Kr(S))&&c.refs.setReference(S)},[c.refs]),x=p.useMemo(()=>({...c.refs,setReference:b,setPositionReference:v,domReference:f}),[c.refs,b,v]),y=p.useMemo(()=>({...c.elements,domReference:l}),[c.elements,l]),w=p.useMemo(()=>({...c,refs:x,elements:y,dataRef:h,nodeId:o,floatingId:g,events:m,open:n,onOpenChange:d}),[c,o,g,m,n,d,x,y]);return mo(()=>{const S=u==null?void 0:u.nodesRef.current.find(j=>j.id===o);S&&(S.context=w)}),p.useMemo(()=>({...c,context:w,refs:x,elements:y}),[c,x,y,w])}function X4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:s,elements:{floating:l,domReference:c}}=e,{enabled:u=!0,keyboardOnly:d=!0}=t,f=p.useRef(""),h=p.useRef(!1),m=p.useRef();return p.useEffect(()=>{if(!u)return;const v=Zo(l).defaultView||window;function b(){!n&&wE(c)&&c===V4(Zo(c))&&(h.current=!0)}return v.addEventListener("blur",b),()=>{v.removeEventListener("blur",b)}},[l,c,n,u]),p.useEffect(()=>{if(!u)return;function g(v){(v.type==="referencePress"||v.type==="escapeKey")&&(h.current=!0)}return i.on("dismiss",g),()=>{i.off("dismiss",g)}},[i,u]),p.useEffect(()=>()=>{clearTimeout(m.current)},[]),p.useMemo(()=>u?{reference:{onPointerDown(g){let{pointerType:v}=g;f.current=v,h.current=!!(v&&d)},onMouseLeave(){h.current=!1},onFocus(g){var v;h.current||g.type==="focus"&&((v=o.current.openEvent)==null?void 0:v.type)==="mousedown"&&$u(o.current.openEvent,c)||r(!0,g.nativeEvent)},onBlur(g){h.current=!1;const v=g.relatedTarget,b=Kr(v)&&v.hasAttribute(bE("focus-guard"))&&v.getAttribute("data-type")==="outside";m.current=setTimeout(()=>{mm(s.floating.current,v)||mm(c,v)||b||r(!1,g.nativeEvent)})}}}:{},[u,d,c,s,o,r])}function Jh(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[n]:null).concat(e).reduce((o,i)=>(i&&Object.entries(i).forEach(s=>{let[l,c]=s;if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var u;(u=r.get(l))==null||u.push(c),o[l]=function(){for(var d,f=arguments.length,h=new Array(f),m=0;m<f;m++)h[m]=arguments[m];return(d=r.get(l))==null?void 0:d.map(g=>g(...h)).find(g=>g!==void 0)}}}else o[l]=c}),o),{})}}function J4(e){e===void 0&&(e=[]);const t=e,n=p.useCallback(i=>Jh(i,e,"reference"),t),r=p.useCallback(i=>Jh(i,e,"floating"),t),o=p.useCallback(i=>Jh(i,e,"item"),e.map(i=>i==null?void 0:i.item));return p.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o}),[n,r,o])}function Z4(e,t){t===void 0&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,s=yE();return p.useMemo(()=>{const l={id:r,role:i};return o?i==="tooltip"?{reference:{"aria-describedby":n?r:void 0},floating:l}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":i==="alertdialog"?"dialog":i,"aria-controls":n?r:void 0,...i==="listbox"&&{role:"combobox"},...i==="menu"&&{id:s}},floating:{...l,...i==="menu"&&{"aria-labelledby":s}}}:{}},[o,i,n,r,s])}function jE(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}function r1(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function o1(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 eA={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function tA({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:i,arrowY:s,dir:l}){const[c,u="center"]=e.split("-"),d={width:z(t),height:z(t),transform:"rotate(45deg)",position:"absolute",[eA[c]]:z(r)},f=z(-t/2);return c==="left"?{...d,...r1(u,s,n,o),right:f,borderLeftColor:"transparent",borderBottomColor:"transparent"}:c==="right"?{...d,...r1(u,s,n,o),left:f,borderRightColor:"transparent",borderTopColor:"transparent"}:c==="top"?{...d,...o1(u,i,n,o,l),bottom:f,borderTopColor:"transparent",borderLeftColor:"transparent"}:c==="bottom"?{...d,...o1(u,i,n,o,l),top:f,borderBottomColor:"transparent",borderRightColor:"transparent"}:{}}const mv=p.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,visible:i,arrowX:s,arrowY:l,style:c,...u},d)=>{const{dir:f}=ss();return i?C.createElement("div",{...u,ref:d,style:{...c,...tA({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:f,arrowX:s,arrowY:l})}}):null});mv.displayName="@mantine/core/FloatingArrow";const[nA,PE]=bn("Popover component was not found in the tree");function gv({children:e,active:t=!0,refProp:n="ref"}){const r=lR(t),o=Yt(r,e==null?void 0:e.ref);return To(e)?p.cloneElement(e,{[n]:o}):e}gv.displayName="@mantine/core/FocusTrap";function rA(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}const oA={},TE=p.forwardRef((e,t)=>{const{children:n,target:r,...o}=U("Portal",oA,e),[i,s]=p.useState(!1),l=p.useRef(null);return Pa(()=>(s(!0),l.current=r?typeof r=="string"?document.querySelector(r):r:rA(o),og(t,l.current),!r&&l.current&&document.body.appendChild(l.current),()=>{!r&&l.current&&document.body.removeChild(l.current)}),[r]),!i||!l.current?null:uc.createPortal(C.createElement(C.Fragment,null,n),l.current)});TE.displayName="@mantine/core/Portal";function us({withinPortal:e=!0,children:t,...n}){return e?C.createElement(TE,{...n},t):C.createElement(C.Fragment,null,t)}us.displayName="@mantine/core/OptionalPortal";const Ja=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${z(e==="bottom"?10:-10)})`},transitionProperty:"transform, opacity"}),du={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},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(${z(-20)}) 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(${z(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${z(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${z(20)}) 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:{...Ja("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...Ja("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...Ja("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...Ja("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...Ja("top"),common:{transformOrigin:"top right"}}},i1={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function iA({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in du?{transitionProperty:du[e].transitionProperty,...o,...du[e].common,...du[e][i1[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[i1[t]]}}function sA({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:i,onEntered:s,onExited:l}){const c=Pt(),u=ig(),d=c.respectReducedMotion?u:!1,[f,h]=p.useState(d?0:e),[m,g]=p.useState(r?"entered":"exited"),v=p.useRef(-1),b=x=>{const y=x?o:i,w=x?s:l;g(x?"pre-entering":"pre-exiting"),window.clearTimeout(v.current);const S=d?0:x?e:t;if(h(S),S===0)typeof y=="function"&&y(),typeof w=="function"&&w(),g(x?"entered":"exited");else{const j=window.setTimeout(()=>{typeof y=="function"&&y(),g(x?"entering":"exiting")},10);v.current=window.setTimeout(()=>{window.clearTimeout(j),typeof w=="function"&&w(),g(x?"entered":"exited")},S)}};return go(()=>{b(r)},[r]),p.useEffect(()=>()=>window.clearTimeout(v.current),[]),{transitionDuration:f,transitionStatus:m,transitionTimingFunction:n||"ease"}}function ds({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:o,children:i,timingFunction:s="ease",onExit:l,onEntered:c,onEnter:u,onExited:d}){const{transitionDuration:f,transitionStatus:h,transitionTimingFunction:m}=sA({mounted:o,exitDuration:r,duration:n,timingFunction:s,onExit:l,onEntered:c,onEnter:u,onExited:d});return f===0?o?C.createElement(C.Fragment,null,i({})):e?i({display:"none"}):null:h==="exited"?e?i({display:"none"}):null:C.createElement(C.Fragment,null,i(iA({transition:t,duration:f,state:h,timingFunction:m})))}ds.displayName="@mantine/core/Transition";var kE={dropdown:"m-38a85659",arrow:"m-a31dc6c1"};const aA={},vv=Q((e,t)=>{var b,x,y,w;const n=U("PopoverDropdown",aA,e),{className:r,style:o,vars:i,children:s,onKeyDownCapture:l,variant:c,classNames:u,styles:d,...f}=n,h=PE(),m=PS({opened:h.opened,shouldReturnFocus:h.returnFocus}),g=h.withRoles?{"aria-labelledby":h.getTargetId(),id:h.getDropdownId(),role:"dialog",tabIndex:-1}:{},v=Yt(t,h.floating);return h.disabled?null:C.createElement(us,{...h.portalProps,withinPortal:h.withinPortal},C.createElement(ds,{mounted:h.opened,...h.transitionProps,transition:((b=h.transitionProps)==null?void 0:b.transition)||"fade",duration:((x=h.transitionProps)==null?void 0:x.duration)??150,keepMounted:h.keepMounted,exitDuration:typeof((y=h.transitionProps)==null?void 0:y.exitDuration)=="number"?h.transitionProps.exitDuration:(w=h.transitionProps)==null?void 0:w.duration},S=>C.createElement(gv,{active:h.trapFocus},C.createElement(q,{...g,...f,variant:c,ref:v,onKeyDownCapture:K2(h.onClose,{active:h.closeOnEscape,onTrigger:m,onKeyDown:l}),"data-position":h.placement,...h.getStyles("dropdown",{className:r,props:n,classNames:u,styles:d,style:[{...S,zIndex:h.zIndex,top:h.y??0,left:h.x??0,width:h.width==="target"?void 0:z(h.width)},o]})},s,C.createElement(mv,{ref:h.arrowRef,arrowX:h.arrowX,arrowY:h.arrowY,visible:h.withArrow,position:h.placement,arrowSize:h.arrowSize,arrowRadius:h.arrowRadius,arrowOffset:h.arrowOffset,arrowPosition:h.arrowPosition,...h.getStyles("arrow",{props:n,classNames:u,styles:d})})))))});vv.classes=kE;vv.displayName="@mantine/core/PopoverDropdown";const lA={refProp:"ref",popupType:"dialog"},RE=Q((e,t)=>{const{children:n,refProp:r,popupType:o,...i}=U("PopoverTarget",lA,e);if(!To(n))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 s=i,l=PE(),c=Yt(l.reference,n.ref,t),u=l.withRoles?{"aria-haspopup":o,"aria-expanded":l.opened,"aria-controls":l.getDropdownId(),id:l.getTargetId()}:{};return p.cloneElement(n,{...s,...u,...l.targetProps,className:Ze(l.targetProps.className,s.className,n.props.className),[r]:c,...l.controlled?null:{onClick:l.onToggle}})});RE.displayName="@mantine/core/PopoverTarget";function IE({opened:e,floating:t,position:n,positionDependencies:r}){const[o,i]=p.useState(0);p.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return C4(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),go(()=>{t.update()},r),go(()=>{i(s=>s+1)},[e])}function cA(e,t){var r,o,i,s;const n=[iE(e.offset)];return(r=e.middlewares)!=null&&r.shift&&n.push(fv({limiter:j4()})),(o=e.middlewares)!=null&&o.flip&&n.push(pE()),(i=e.middlewares)!=null&&i.inline&&n.push(mE()),n.push(gE({element:e.arrowRef,padding:e.arrowOffset})),((s=e.middlewares)!=null&&s.size||e.width==="target")&&n.push(E4({apply({rects:l,availableWidth:c,availableHeight:u}){var h,m;const f=((h=t().refs.floating.current)==null?void 0:h.style)??{};(m=e.middlewares)!=null&&m.size&&Object.assign(f,{maxWidth:`${c}px`,maxHeight:`${u}px`}),e.width==="target"&&Object.assign(f,{width:`${l.reference.width}px`})}})),n}function uA(e){const[t,n]=un({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var s;t&&((s=e.onClose)==null||s.call(e),n(!1))},o=()=>{var s,l;t?((s=e.onClose)==null||s.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},i=pv({placement:e.position,middleware:cA(e,()=>i)});return IE({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies||[],floating:i}),go(()=>{var s;(s=e.onPositionChange)==null||s.call(e,i.placement)},[i.placement]),go(()=>{var s,l;e.opened?(l=e.onOpen)==null||l.call(e):(s=e.onClose)==null||s.call(e)},[e.opened]),{floating:i,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const dA={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,clickOutsideEvents:["mousedown","touchstart"],zIndex:Nr("popover"),__staticSelector:"Popover",width:"max-content"},fA=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:ft(t),"--popover-shadow":tg(n)}});function Or(e){var _t,Pn,Lr,Xt,so,te;const t=U("Popover",dA,e),{children:n,position:r,offset:o,onPositionChange:i,positionDependencies:s,opened:l,transitionProps:c,width:u,middlewares:d,withArrow:f,arrowSize:h,arrowOffset:m,arrowRadius:g,arrowPosition:v,unstyled:b,classNames:x,styles:y,closeOnClickOutside:w,withinPortal:S,portalProps:j,closeOnEscape:E,clickOutsideEvents:P,trapFocus:T,onClose:k,onOpen:I,onChange:O,zIndex:R,radius:M,shadow:N,id:B,defaultOpened:D,__staticSelector:$,withRoles:_,disabled:F,returnFocus:H,variant:G,keepMounted:oe,vars:be,...je}=t,Ae=fe({name:$,props:t,classes:kE,classNames:x,styles:y,unstyled:b,rootSelector:"dropdown",vars:be,varsResolver:fA}),ke=p.useRef(null),[Ie,Qe]=p.useState(null),[qe,ht]=p.useState(null),{dir:X}=ss(),Pe=Cn(B),Ne=uA({middlewares:d,width:u,position:jE(X,r),offset:typeof o=="number"?o+(f?h/2:0):o,arrowRef:ke,arrowOffset:m,onPositionChange:i,positionDependencies:s,opened:l,defaultOpened:D,onChange:O,onOpen:I,onClose:k});J2(()=>w&&Ne.onClose(),P,[Ie,qe]);const nt=p.useCallback(Ce=>{Qe(Ce),Ne.floating.refs.setReference(Ce)},[Ne.floating.refs.setReference]),Ge=p.useCallback(Ce=>{ht(Ce),Ne.floating.refs.setFloating(Ce)},[Ne.floating.refs.setFloating]);return C.createElement(nA,{value:{returnFocus:H,disabled:F,controlled:Ne.controlled,reference:nt,floating:Ge,x:Ne.floating.x,y:Ne.floating.y,arrowX:(Lr=(Pn=(_t=Ne.floating)==null?void 0:_t.middlewareData)==null?void 0:Pn.arrow)==null?void 0:Lr.x,arrowY:(te=(so=(Xt=Ne.floating)==null?void 0:Xt.middlewareData)==null?void 0:so.arrow)==null?void 0:te.y,opened:Ne.opened,arrowRef:ke,transitionProps:c,width:u,withArrow:f,arrowSize:h,arrowOffset:m,arrowRadius:g,arrowPosition:v,placement:Ne.floating.placement,trapFocus:T,withinPortal:S,portalProps:j,zIndex:R,radius:M,shadow:N,closeOnEscape:E,onClose:Ne.onClose,onToggle:Ne.onToggle,getTargetId:()=>`${Pe}-target`,getDropdownId:()=>`${Pe}-dropdown`,withRoles:_,targetProps:je,__staticSelector:$,classNames:x,styles:y,unstyled:b,variant:G,keepMounted:oe,getStyles:Ae}},n)}Or.Target=RE;Or.Dropdown=vv;Or.displayName="@mantine/core/Popover";Or.extend=e=>e;var jr={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 hA=p.forwardRef(({className:e,...t},n)=>C.createElement(q,{component:"span",className:Ze(jr.barsLoader,e),...t,ref:n},C.createElement("span",{className:jr.bar}),C.createElement("span",{className:jr.bar}),C.createElement("span",{className:jr.bar}))),pA=p.forwardRef(({className:e,...t},n)=>C.createElement(q,{component:"span",className:Ze(jr.dotsLoader,e),...t,ref:n},C.createElement("span",{className:jr.dot}),C.createElement("span",{className:jr.dot}),C.createElement("span",{className:jr.dot}))),mA=p.forwardRef(({className:e,...t},n)=>C.createElement(q,{component:"span",className:Ze(jr.ovalLoader,e),...t,ref:n})),DE={bars:hA,oval:mA,dots:pA},gA={loaders:DE,type:"oval"},vA=(e,{size:t,color:n})=>({root:{"--loader-size":Ee(t,"loader-size"),"--loader-color":n?yt(n,e):void 0}}),$n=Q((e,t)=>{const n=U("Loader",gA,e),{size:r,color:o,type:i,vars:s,className:l,style:c,classNames:u,styles:d,unstyled:f,loaders:h,variant:m,children:g,...v}=n,b=fe({name:"Loader",props:n,classes:jr,className:l,style:c,classNames:u,styles:d,unstyled:f,vars:s,varsResolver:vA});return g?C.createElement(q,{...b("root"),ref:t,...v},g):C.createElement(q,{...b("root"),ref:t,component:h[i],variant:m,size:r,...v})});$n.defaultLoaders=DE;$n.classes=jr;$n.displayName="@mantine/core/Loader";var df={root:"m-8d3f4000",loader:"m-302b9fb1",icon:"m-8d3afb97",group:"m-1a0f1b21"};const s1={orientation:"horizontal"},yA=(e,{borderWidth:t})=>({group:{"--ai-border-width":z(t)}}),yv=Q((e,t)=>{const n=U("ActionIconGroup",s1,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,mod:h,...m}=U("ActionIconGroup",s1,e),g=fe({name:"ActionIconGroup",props:n,classes:df,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:yA,rootSelector:"group"});return C.createElement(q,{...g("group"),ref:t,variant:f,mod:[{"data-orientation":c},h],role:"group",...m})});yv.classes=df;yv.displayName="@mantine/core/ActionIconGroup";const xA={},wA=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:s});return{root:{"--ai-size":Ee(t,"ai-size"),"--ai-radius":n===void 0?void 0:ft(n),"--ai-bg":i||r?l.background:void 0,"--ai-hover":i||r?l.hover:void 0,"--ai-hover-color":i||r?l.hoverColor:void 0,"--ai-color":l.color,"--ai-bd":i||r?l.border:void 0}}},Qt=fn((e,t)=>{const n=U("ActionIcon",xA,e),{className:r,unstyled:o,variant:i,classNames:s,styles:l,style:c,loading:u,loaderProps:d,size:f,color:h,radius:m,__staticSelector:g,gradient:v,vars:b,children:x,disabled:y,"data-disabled":w,autoContrast:S,mod:j,...E}=n,P=fe({name:["ActionIcon",g],props:n,className:r,style:c,classes:df,classNames:s,styles:l,unstyled:o,vars:b,varsResolver:wA});return C.createElement(lr,{...P("root",{active:!y&&!u&&!w}),...E,unstyled:o,variant:i,size:f,disabled:y||u,ref:t,mod:[{loading:u,disabled:y||w},j]},C.createElement(q,{component:"span",...P("loader"),"aria-hidden":!0},C.createElement($n,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...d})),C.createElement(q,{component:"span",mod:{loading:u},...P("icon")},x))});Qt.classes=df;Qt.displayName="@mantine/core/ActionIcon";Qt.Group=yv;const _E=p.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>C.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n},C.createElement("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"})));_E.displayName="@mantine/core/CloseIcon";var AE={root:"m-86a44da5","root--subtle":"m-220c80f2"};const SA={variant:"subtle"},bA=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":Ee(t,"cb-size"),"--cb-radius":n===void 0?void 0:ft(n),"--cb-icon-size":z(r)}}),fs=fn((e,t)=>{const n=U("CloseButton",SA,e),{iconSize:r,children:o,vars:i,radius:s,className:l,classNames:c,style:u,styles:d,unstyled:f,"data-disabled":h,disabled:m,variant:g,icon:v,mod:b,...x}=n,y=fe({name:"CloseButton",props:n,className:l,style:u,classes:AE,classNames:c,styles:d,unstyled:f,vars:i,varsResolver:bA});return C.createElement(lr,{ref:t,...x,unstyled:f,variant:g,disabled:m,mod:[{disabled:m||h},b],...y("root",{variant:g,active:!0})},v||C.createElement(_E,null),o)});fs.classes=AE;fs.displayName="@mantine/core/CloseButton";function CA(e){return p.Children.toArray(e).filter(Boolean)}var NE={root:"m-4081bf90"};const EA={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},jA=(e,{grow:t,preventGrowOverflow:n,gap:r,align:o,justify:i,wrap:s},{childWidth:l})=>({root:{"--group-child-width":t&&n?l:void 0,"--group-gap":en(r),"--group-align":o,"--group-justify":i,"--group-wrap":s}}),Y=Q((e,t)=>{const n=U("Group",EA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,children:c,gap:u,align:d,justify:f,wrap:h,grow:m,preventGrowOverflow:g,vars:v,variant:b,__size:x,mod:y,...w}=n,S=CA(c),j=S.length,E=en(u??"md"),T={childWidth:`calc(${100/j}% - (${E} - ${E} / ${j}))`},k=fe({name:"Group",props:n,stylesCtx:T,className:o,style:i,classes:NE,classNames:r,styles:s,unstyled:l,vars:v,varsResolver:jA});return C.createElement(q,{...k("root"),ref:t,variant:b,mod:[{grow:m},y],size:x,...w},S)});Y.classes=NE;Y.displayName="@mantine/core/Group";var OE={root:"m-9814e45f"};const PA={zIndex:Nr("modal")},TA=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:i,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&Zt(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${z(o)})`:void 0,"--overlay-radius":i===void 0?void 0:ft(i),"--overlay-z-index":s==null?void 0:s.toString()}}),Wl=fn((e,t)=>{const n=U("Overlay",PA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,fixed:u,center:d,children:f,radius:h,zIndex:m,gradient:g,blur:v,color:b,backgroundOpacity:x,mod:y,...w}=n,S=fe({name:"Overlay",props:n,classes:OE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:TA});return C.createElement(q,{ref:t,...S("root"),mod:[{center:d,fixed:u},y],...w},f)});Wl.classes=OE;Wl.displayName="@mantine/core/Overlay";const[kA,Do]=bn("ModalBase component was not found in tree");function RA({opened:e,transitionDuration:t}){const[n,r]=p.useState(e),o=p.useRef(),s=ig()?0:t;return p.useEffect(()=>(e?(r(!0),window.clearTimeout(o.current)):s===0?r(!1):o.current=window.setTimeout(()=>r(!1),s),()=>window.clearTimeout(o.current)),[e,s]),n}function IA({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:i,returnFocus:s}){const l=Cn(e),[c,u]=p.useState(!1),[d,f]=p.useState(!1),h=typeof(t==null?void 0:t.duration)=="number"?t==null?void 0:t.duration:200,m=RA({opened:n,transitionDuration:h});return IS("keydown",g=>{!r&&g.key==="Escape"&&o&&i()}),PS({opened:n,shouldReturnFocus:r&&s}),{_id:l,titleMounted:c,bodyMounted:d,shouldLockScroll:m,setTitleMounted:u,setBodyMounted:f}}const DA=p.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:o,trapFocus:i,closeOnEscape:s,returnFocus:l,closeOnClickOutside:c,withinPortal:u,portalProps:d,lockScroll:f,children:h,zIndex:m,shadow:g,padding:v,__vars:b,unstyled:x,removeScrollProps:y,...w},S)=>{const{_id:j,titleMounted:E,bodyMounted:P,shouldLockScroll:T,setTitleMounted:k,setBodyMounted:I}=IA({id:r,transitionProps:o,opened:t,trapFocus:i,closeOnEscape:s,onClose:n,returnFocus:l});return C.createElement(us,{...d,withinPortal:u},C.createElement(kA,{value:{opened:t,onClose:n,closeOnClickOutside:c,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${j}-title`,getBodyId:()=>`${j}-body`,titleMounted:E,bodyMounted:P,setTitleMounted:k,setBodyMounted:I,trapFocus:i,closeOnEscape:s,zIndex:m,unstyled:x}},C.createElement(zd,{enabled:T&&f,...y},C.createElement(q,{ref:S,...w,__vars:{...b,"--mb-z-index":(m||Nr("modal")).toString(),"--mb-shadow":tg(g),"--mb-padding":en(v)}},h))))});function _A(){const e=Do();return p.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var va={title:"m-615af6c9",header:"m-b5489c3c",inner:"m-60c222c7",content:"m-fd1ab0aa",close:"m-606cb269",body:"m-5df29311"};const ME=p.forwardRef(({className:e,...t},n)=>{const r=_A(),o=Do();return C.createElement(q,{ref:n,...t,id:r,className:Ze({[va.body]:!o.unstyled},e)})});ME.displayName="@mantine/core/ModalBaseBody";const $E=p.forwardRef(({className:e,onClick:t,...n},r)=>{const o=Do();return C.createElement(fs,{ref:r,...n,onClick:i=>{o.onClose(),t==null||t(i)},className:Ze({[va.close]:!o.unstyled},e),unstyled:o.unstyled})});$E.displayName="@mantine/core/ModalBaseCloseButton";const AA=p.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...i},s)=>{const l=Do(),c=u=>{var f;((f=u.target)==null?void 0:f.getAttribute("data-mantine-stop-propagation"))!=="true"&&u.key==="Escape"&&l.closeOnEscape&&l.onClose(),r==null||r(u)};return C.createElement(ds,{mounted:l.opened,transition:"pop",...l.transitionProps,...e},u=>C.createElement("div",{...n,className:Ze({[va.inner]:!l.unstyled},n.className)},C.createElement(gv,{active:l.opened&&l.trapFocus},C.createElement(On,{...i,component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":l.bodyMounted?l.getBodyId():void 0,"aria-labelledby":l.titleMounted?l.getTitleId():void 0,onKeyDown:c,ref:s,style:[o,u],className:Ze({[va.content]:!l.unstyled},t),unstyled:l.unstyled},i.children))))}),LE=p.forwardRef(({className:e,...t},n)=>{const r=Do();return C.createElement(q,{component:"header",ref:n,className:Ze({[va.header]:!r.unstyled},e),...t})});LE.displayName="@mantine/core/ModalBaseHeader";const NA={duration:200,timingFunction:"ease",transition:"fade"};function OA(e){const t=Do();return{...NA,...t.transitionProps,...e}}const FE=p.forwardRef(({onClick:e,transitionProps:t,style:n,...r},o)=>{const i=Do(),s=OA(t);return C.createElement(ds,{mounted:i.opened,...s,transition:"fade"},l=>C.createElement(Wl,{ref:o,fixed:!0,style:[n,l],zIndex:i.zIndex,unstyled:i.unstyled,onClick:c=>{e==null||e(c),i.closeOnClickOutside&&i.onClose()},...r}))});FE.displayName="@mantine/core/ModalBaseOverlay";function MA(){const e=Do();return p.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const zE=p.forwardRef(({className:e,...t},n)=>{const r=MA(),o=Do();return C.createElement(q,{component:"h2",ref:n,className:Ze({[va.title]:!o.unstyled},e),...t,id:r})});zE.displayName="@mantine/core/ModalBaseTitle";function $A({children:e}){return C.createElement(C.Fragment,null,e)}const[LA,Da]=rc({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var pr={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 a1={},FA=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${qt(t)} - ${z(2)})`}}),ff=Q((e,t)=>{const n=U("InputDescription",a1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,__staticSelector:d,__inheritStyles:f=!0,variant:h,...m}=U("InputDescription",a1,n),g=Da(),v=fe({name:["InputWrapper",d],props:n,classes:pr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"description",vars:c,varsResolver:FA}),b=f&&(g==null?void 0:g.getStyles)||v;return C.createElement(q,{component:"p",ref:t,variant:h,size:u,...b("description"),...m})});ff.classes=pr;ff.displayName="@mantine/core/InputDescription";const zA={},BA=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${qt(t)} - ${z(2)})`}}),hf=Q((e,t)=>{const n=U("InputError",zA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,__staticSelector:d,__inheritStyles:f=!0,variant:h,...m}=n,g=fe({name:["InputWrapper",d],props:n,classes:pr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"error",vars:c,varsResolver:BA}),v=Da(),b=f&&(v==null?void 0:v.getStyles)||g;return C.createElement(q,{component:"p",ref:t,variant:h,size:u,...b("error"),...m})});hf.classes=pr;hf.displayName="@mantine/core/InputError";const l1={labelElement:"label"},UA=(e,{size:t})=>({label:{"--input-label-size":qt(t),"--input-asterisk-color":void 0}}),pf=Q((e,t)=>{const n=U("InputLabel",l1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,labelElement:u,size:d,required:f,htmlFor:h,onMouseDown:m,children:g,__staticSelector:v,variant:b,mod:x,...y}=U("InputLabel",l1,n),w=fe({name:["InputWrapper",v],props:n,classes:pr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"label",vars:c,varsResolver:UA}),S=Da(),j=(S==null?void 0:S.getStyles)||w;return C.createElement(q,{...j("label"),component:u,variant:b,size:d,ref:t,htmlFor:u==="label"?h:void 0,mod:[{required:f},x],onMouseDown:E=>{m==null||m(E),!E.defaultPrevented&&E.detail>1&&E.preventDefault()},...y},g,f&&C.createElement("span",{...j("required"),"aria-hidden":!0}," *"))});pf.classes=pr;pf.displayName="@mantine/core/InputLabel";const c1={},xv=Q((e,t)=>{const n=U("InputPlaceholder",c1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,__staticSelector:u,variant:d,error:f,mod:h,...m}=U("InputPlaceholder",c1,n),g=fe({name:["InputPlaceholder",u],props:n,classes:pr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"placeholder"});return C.createElement(q,{...g("placeholder"),mod:[{error:!!f},h],component:"span",variant:d,ref:t,...m})});xv.classes=pr;xv.displayName="@mantine/core/InputPlaceholder";function VA(e,{hasDescription:t,hasError:n}){const r=e.findIndex(c=>c==="input"),o=e[r-1],i=e[r+1];return{offsetBottom:t&&i==="description"||n&&i==="error",offsetTop:t&&o==="description"||n&&o==="error"}}const WA={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},HA=(e,{size:t})=>({label:{"--input-label-size":qt(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${qt(t)} - ${z(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${qt(t)} - ${z(2)})`}}),wv=Q((e,t)=>{const n=U("InputWrapper",WA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,variant:d,__staticSelector:f,inputContainer:h,inputWrapperOrder:m,label:g,error:v,description:b,labelProps:x,descriptionProps:y,errorProps:w,labelElement:S,children:j,withAsterisk:E,id:P,required:T,__stylesApiProps:k,mod:I,...O}=n,R=fe({name:["InputWrapper",f],props:k||n,classes:pr,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:HA}),M={size:u,variant:d,__staticSelector:f},N=Cn(P),B=typeof E=="boolean"?E:T,D=(w==null?void 0:w.id)||`${N}-error`,$=(y==null?void 0:y.id)||`${N}-description`,_=N,F=!!v&&typeof v!="boolean",H=!!b,G=`${F?D:""} ${H?$:""}`,oe=G.trim().length>0?G.trim():void 0,be=(x==null?void 0:x.id)||`${N}-label`,je=g&&C.createElement(pf,{key:"label",labelElement:S,id:be,htmlFor:_,required:B,...M,...x},g),Ae=H&&C.createElement(ff,{key:"description",...y,...M,size:(y==null?void 0:y.size)||M.size,id:(y==null?void 0:y.id)||$},b),ke=C.createElement(C.Fragment,{key:"input"},h(j)),Ie=F&&C.createElement(hf,{...w,...M,size:(w==null?void 0:w.size)||M.size,key:"error",id:(w==null?void 0:w.id)||D},v),Qe=m.map(qe=>{switch(qe){case"label":return je;case"input":return ke;case"description":return Ae;case"error":return Ie;default:return null}});return C.createElement(LA,{value:{getStyles:R,describedBy:oe,inputId:_,labelId:be,...VA(m,{hasDescription:H,hasError:F})}},C.createElement(q,{ref:t,variant:d,size:u,mod:[{error:!!v},I],...R("root"),...O},Qe))});wv.classes=pr;wv.displayName="@mantine/core/InputWrapper";const qA={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0},GA=(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":Ee(t.size,"input-height"),"--input-fz":qt(t.size),"--input-radius":t.radius===void 0?void 0:ft(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?z(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?z(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?Ee(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),dt=fn((e,t)=>{const n=U("Input",qA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,required:c,__staticSelector:u,__stylesApiProps:d,size:f,wrapperProps:h,error:m,disabled:g,leftSection:v,leftSectionProps:b,leftSectionWidth:x,rightSection:y,rightSectionProps:w,rightSectionWidth:S,rightSectionPointerEvents:j,leftSectionPointerEvents:E,variant:P,vars:T,pointer:k,multiline:I,radius:O,id:R,withAria:M,withErrorStyles:N,mod:B,...D}=n,{styleProps:$,rest:_}=ko(D),F=Da(),H={offsetBottom:F==null?void 0:F.offsetBottom,offsetTop:F==null?void 0:F.offsetTop},G=fe({name:["Input",u],props:d||n,classes:pr,className:o,style:i,classNames:r,styles:s,unstyled:l,stylesCtx:H,rootSelector:"wrapper",vars:T,varsResolver:GA}),oe=M?{required:c,disabled:g,"aria-invalid":!!m,"aria-describedby":F==null?void 0:F.describedBy,id:(F==null?void 0:F.inputId)||R}:{};return C.createElement(q,{...G("wrapper"),...$,...h,mod:[{error:!!m&&N,pointer:k,disabled:g,multiline:I,"data-with-right-section":!!y,"data-with-left-section":!!v},B],variant:P,size:f},v&&C.createElement("div",{...b,"data-position":"left",...G("section",{className:b==null?void 0:b.className,style:b==null?void 0:b.style})},v),C.createElement(q,{component:"input",..._,...oe,ref:t,required:c,mod:{disabled:g,error:!!m&&N},variant:P,...G("input")}),y&&C.createElement("div",{...w,"data-position":"right",...G("section",{className:w==null?void 0:w.className,style:w==null?void 0:w.style})},y))});dt.classes=pr;dt.Wrapper=wv;dt.Label=pf;dt.Error=hf;dt.Description=ff;dt.Placeholder=xv;dt.displayName="@mantine/core/Input";function QA(e,t,n){const r=U(e,t,n),{label:o,description:i,error:s,required:l,classNames:c,styles:u,className:d,unstyled:f,__staticSelector:h,__stylesApiProps:m,errorProps:g,labelProps:v,descriptionProps:b,wrapperProps:x,id:y,size:w,style:S,inputContainer:j,inputWrapperOrder:E,withAsterisk:P,variant:T,vars:k,mod:I,...O}=r,{styleProps:R,rest:M}=ko(O),N={label:o,description:i,error:s,required:l,classNames:c,className:d,__staticSelector:h,__stylesApiProps:m||r,errorProps:g,labelProps:v,descriptionProps:b,unstyled:f,styles:u,size:w,style:S,inputContainer:j,inputWrapperOrder:E,withAsterisk:P,variant:T,id:y,mod:I,...x};return{...M,classNames:c,styles:u,unstyled:f,wrapperProps:{...N,...R},inputProps:{required:l,classNames:c,styles:u,unstyled:f,size:w,__staticSelector:h,__stylesApiProps:m||r,error:s,variant:T,id:y}}}const KA={__staticSelector:"InputBase",withAria:!0},mr=fn((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=QA("InputBase",KA,e);return C.createElement(dt.Wrapper,{...r},C.createElement(dt,{...n,...o,ref:t}))});mr.classes={...dt.classes,...dt.Wrapper.classes};mr.displayName="@mantine/core/InputBase";const YA={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 BE={root:"m-8bffd616"};const XA={},Xi=fn((e,t)=>{const n=U("Flex",XA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,gap:u,rowGap:d,columnGap:f,align:h,justify:m,wrap:g,direction:v,...b}=n,x=fe({name:"Flex",classes:BE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),y=Pt(),w=ic(),S=LS({styleProps:{gap:u,rowGap:d,columnGap:f,align:h,justify:m,wrap:g,direction:v},theme:y,data:YA});return C.createElement(C.Fragment,null,S.hasResponsiveStyles&&C.createElement(Ta,{selector:`.${w}`,styles:S.styles,media:S.media}),C.createElement(q,{ref:t,...x("root",{className:w,style:os(S.inlineStyles)}),...b}))});Xi.classes=BE;Xi.displayName="@mantine/core/Flex";var UE={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 JA={},ZA=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const i=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light",autoContrast:o});return{root:{"--alert-radius":t===void 0?void 0:ft(t),"--alert-bg":n||r?i.background:void 0,"--alert-color":i.color,"--alert-bd":n||r?i.border:void 0}}},hs=Q((e,t)=>{const n=U("Alert",JA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,radius:u,color:d,title:f,children:h,id:m,icon:g,withCloseButton:v,onClose:b,closeButtonLabel:x,variant:y,autoContrast:w,...S}=n,j=fe({name:"Alert",classes:UE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:ZA}),E=Cn(m),P=f&&`${E}-title`||void 0,T=`${E}-body`;return C.createElement(q,{id:E,...j("root",{variant:y}),variant:y,ref:t,...S,role:"alert","aria-describedby":T,"aria-labelledby":P},C.createElement("div",{...j("wrapper")},g&&C.createElement("div",{...j("icon")},g),C.createElement("div",{...j("body")},f&&C.createElement("div",{...j("title"),"data-with-close-button":v||void 0},C.createElement("span",{id:P,...j("label")},f)),h&&C.createElement("div",{id:T,...j("message"),"data-variant":y},h)),v&&C.createElement(fs,{...j("closeButton"),onClick:b,variant:"transparent",size:16,iconSize:16,"aria-label":x,unstyled:l})))});hs.classes=UE;hs.displayName="@mantine/core/Alert";var VE={root:"m-b6d8b162"};function e3(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const t3={inherit:!1},n3=(e,{variant:t,lineClamp:n,gradient:r,size:o,color:i})=>({root:{"--text-fz":qt(o),"--text-lh":CS(o),"--text-gradient":t==="gradient"?yp(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":i?yt(i,e):void 0}}),ae=fn((e,t)=>{const n=U("Text",t3,e),{lineClamp:r,truncate:o,inline:i,inherit:s,gradient:l,span:c,__staticSelector:u,vars:d,className:f,style:h,classNames:m,styles:g,unstyled:v,variant:b,mod:x,size:y,...w}=n,S=fe({name:["Text",u],props:n,classes:VE,className:f,style:h,classNames:m,styles:g,unstyled:v,vars:d,varsResolver:n3});return C.createElement(q,{...S("root",{focusable:!0}),ref:t,component:c?"span":"p",variant:b,mod:[{"data-truncate":e3(o),"data-line-clamp":typeof r=="number","data-inline":i,"data-inherit":s},x],size:y,...w})});ae.classes=VE;ae.displayName="@mantine/core/Text";var WE={root:"m-849cf0da"};const r3={underline:"hover"},Ve=fn((e,t)=>{const{underline:n,className:r,unstyled:o,mod:i,...s}=U("Anchor",r3,e);return C.createElement(ae,{component:"a",ref:t,className:Ze({[WE.root]:!o},r),...s,mod:[{underline:n},i],__staticSelector:"Anchor",unstyled:o})});Ve.classes=WE;Ve.displayName="@mantine/core/Anchor";const[o3,_a]=bn("AppShell was not found in tree");var wi={root:"m-89ab340",navbar:"m-45252eee",aside:"m-9cdde9a",header:"m-3b16f56b",main:"m-8983817",footer:"m-3840c879",section:"m-6dcfc7c7"};const i3={},Sv=Q((e,t)=>{const n=U("AppShellAside",i3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=_a();return m.disabled?null:C.createElement(q,{component:"aside",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("aside",{className:o,classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-aside-z-index":`calc(${d??m.zIndex} + 1)`}})});Sv.classes=wi;Sv.displayName="@mantine/core/AppShellAside";const s3={},bv=Q((e,t)=>{var g;const n=U("AppShellFooter",s3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=_a();return m.disabled?null:C.createElement(q,{component:"footer",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("footer",{className:Ze({[zd.classNames.zeroRight]:m.offsetScrollbars},o),classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-footer-z-index":(g=d??m.zIndex)==null?void 0:g.toString()}})});bv.classes=wi;bv.displayName="@mantine/core/AppShellFooter";const a3={},Cv=Q((e,t)=>{var g;const n=U("AppShellHeader",a3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=_a();return m.disabled?null:C.createElement(q,{component:"header",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("header",{className:Ze({[zd.classNames.zeroRight]:m.offsetScrollbars},o),classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-header-z-index":(g=d??m.zIndex)==null?void 0:g.toString()}})});Cv.classes=wi;Cv.displayName="@mantine/core/AppShellHeader";const l3={},Ev=Q((e,t)=>{const n=U("AppShellMain",l3,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=_a();return C.createElement(q,{component:"main",ref:t,...u.getStyles("main",{className:o,style:i,classNames:r,styles:s}),...c})});Ev.classes=wi;Ev.displayName="@mantine/core/AppShellMain";function fc(e){return typeof e=="object"?e.base:e}function hc(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 pc(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function c3({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:o}){var c,u,d;const i=r==null?void 0:r.width,s="translateX(var(--app-shell-aside-width))",l="translateX(calc(var(--app-shell-aside-width) * -1))";if(r!=null&&r.breakpoint&&!((c=r==null?void 0:r.collapsed)!=null&&c.mobile)&&(n[r==null?void 0:r.breakpoint]=n[r==null?void 0:r.breakpoint]||{},n[r==null?void 0:r.breakpoint]["--app-shell-aside-width"]="100%",n[r==null?void 0:r.breakpoint]["--app-shell-aside-offset"]="0px"),hc(i)){const f=z(fc(i));e["--app-shell-aside-width"]=f,e["--app-shell-aside-offset"]=f}if(pc(i)&&(typeof i.base<"u"&&(e["--app-shell-aside-width"]=z(i.base),e["--app-shell-aside-offset"]=z(i.base)),ct(i).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-aside-width"]=z(i[f]),t[f]["--app-shell-aside-offset"]=z(i[f]))})),(u=r==null?void 0:r.collapsed)!=null&&u.desktop){const f=r.breakpoint;t[f]=t[f]||{},t[f]["--app-shell-aside-transform"]=s,t[f]["--app-shell-aside-transform-rtl"]=l,t[f]["--app-shell-aside-offset"]="0px !important"}if((d=r==null?void 0:r.collapsed)!=null&&d.mobile){const f=ng(r.breakpoint,o)-.1;n[f]=n[f]||{},n[f]["--app-shell-aside-width"]="100%",n[f]["--app-shell-aside-offset"]="0px",n[f]["--app-shell-aside-transform"]=s,n[f]["--app-shell-aside-transform-rtl"]=l}}function u3({baseStyles:e,minMediaStyles:t,footer:n}){const r=n==null?void 0:n.height,o="translateY(var(--app-shell-footer-height))",i=(n==null?void 0:n.offset)??!0;if(hc(r)){const s=z(fc(r));e["--app-shell-footer-height"]=s,i&&(e["--app-shell-footer-offset"]=s)}pc(r)&&(typeof r.base<"u"&&(e["--app-shell-footer-height"]=z(r.base),i&&(e["--app-shell-footer-offset"]=z(r.base))),ct(r).forEach(s=>{s!=="base"&&(t[s]=t[s]||{},t[s]["--app-shell-footer-height"]=z(r[s]),i&&(t[s]["--app-shell-footer-offset"]=z(r[s])))})),n!=null&&n.collapsed&&(e["--app-shell-footer-transform"]=o,e["--app-shell-footer-offset"]="0px !important")}function d3({baseStyles:e,minMediaStyles:t,header:n}){const r=n==null?void 0:n.height,o="translateY(calc(var(--app-shell-header-height) * -1))",i=(n==null?void 0:n.offset)??!0;if(hc(r)){const s=z(fc(r));e["--app-shell-header-height"]=s,i&&(e["--app-shell-header-offset"]=s)}pc(r)&&(typeof r.base<"u"&&(e["--app-shell-header-height"]=z(r.base),i&&(e["--app-shell-header-offset"]=z(r.base))),ct(r).forEach(s=>{s!=="base"&&(t[s]=t[s]||{},t[s]["--app-shell-header-height"]=z(r[s]),i&&(t[s]["--app-shell-header-offset"]=z(r[s])))})),n!=null&&n.collapsed&&(e["--app-shell-header-transform"]=o,e["--app-shell-header-offset"]="0px !important")}function f3({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:o}){var c,u,d;const i=r==null?void 0:r.width,s="translateX(calc(var(--app-shell-navbar-width) * -1))",l="translateX(var(--app-shell-navbar-width))";if(r!=null&&r.breakpoint&&!((c=r==null?void 0:r.collapsed)!=null&&c.mobile)&&(n[r==null?void 0:r.breakpoint]=n[r==null?void 0:r.breakpoint]||{},n[r==null?void 0:r.breakpoint]["--app-shell-navbar-width"]="100%",n[r==null?void 0:r.breakpoint]["--app-shell-navbar-offset"]="0px"),hc(i)){const f=z(fc(i));e["--app-shell-navbar-width"]=f,e["--app-shell-navbar-offset"]=f}if(pc(i)&&(typeof i.base<"u"&&(e["--app-shell-navbar-width"]=z(i.base),e["--app-shell-navbar-offset"]=z(i.base)),ct(i).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-navbar-width"]=z(i[f]),t[f]["--app-shell-navbar-offset"]=z(i[f]))})),(u=r==null?void 0:r.collapsed)!=null&&u.desktop){const f=r.breakpoint;t[f]=t[f]||{},t[f]["--app-shell-navbar-transform"]=s,t[f]["--app-shell-navbar-transform-rtl"]=l,t[f]["--app-shell-navbar-offset"]="0px !important"}if((d=r==null?void 0:r.collapsed)!=null&&d.mobile){const f=ng(r.breakpoint,o)-.1;n[f]=n[f]||{},n[f]["--app-shell-navbar-width"]="100%",n[f]["--app-shell-navbar-offset"]="0px",n[f]["--app-shell-navbar-transform"]=s,n[f]["--app-shell-navbar-transform-rtl"]=l}}function Zh(e){return Number(e)===0?"0px":en(e)}function h3({padding:e,baseStyles:t,minMediaStyles:n}){hc(e)&&(t["--app-shell-padding"]=Zh(fc(e))),pc(e)&&(e.base&&(t["--app-shell-padding"]=Zh(e.base)),ct(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=Zh(e[r]))}))}function p3({navbar:e,header:t,footer:n,aside:r,padding:o,theme:i}){const s={},l={},c={};f3({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,navbar:e,theme:i}),c3({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,aside:r,theme:i}),d3({baseStyles:c,minMediaStyles:s,header:t}),u3({baseStyles:c,minMediaStyles:s,footer:n}),h3({baseStyles:c,minMediaStyles:s,padding:o});const u=Pl(ct(s),i).map(h=>({query:`(min-width: ${Bu(h.px)})`,styles:s[h.value]})),d=Pl(ct(l),i).map(h=>({query:`(max-width: ${Bu(h.px)})`,styles:l[h.value]})),f=[...u,...d];return{baseStyles:c,media:f}}function m3({navbar:e,header:t,aside:n,footer:r,padding:o}){const i=Pt(),s=Vd(),{media:l,baseStyles:c}=p3({navbar:e,header:t,footer:r,aside:n,padding:o,theme:i});return C.createElement(Ta,{media:l,styles:c,selector:s.cssVariablesSelector})}const g3={},jv=Q((e,t)=>{const n=U("AppShellNavbar",g3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=_a();return m.disabled?null:C.createElement(q,{component:"nav",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("navbar",{className:o,classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-navbar-z-index":`calc(${d??m.zIndex} + 1)`}})});jv.classes=wi;jv.displayName="@mantine/core/AppShellNavbar";const v3={},Pv=fn((e,t)=>{const n=U("AppShellSection",v3,e),{classNames:r,className:o,style:i,styles:s,vars:l,grow:c,mod:u,...d}=n,f=_a();return C.createElement(q,{ref:t,mod:[{grow:c},u],...f.getStyles("section",{className:o,style:i,classNames:r,styles:s}),...d})});Pv.classes=wi;Pv.displayName="@mantine/core/AppShellSection";function y3({transitionDuration:e,disabled:t}){const[n,r]=p.useState(!1),o=p.useRef(),i=p.useRef();return IS("resize",()=>{r(!0),clearTimeout(o.current),o.current=window.setTimeout(()=>r(!1),200)}),Pa(()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>r(!1),e||0)},[t,e]),n}const x3={withBorder:!0,offsetScrollbars:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:Nr("app")},w3=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),Mn=Q((e,t)=>{const n=U("AppShell",x3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,navbar:u,withBorder:d,padding:f,transitionDuration:h,transitionTimingFunction:m,header:g,zIndex:v,layout:b,disabled:x,aside:y,footer:w,offsetScrollbars:S,mod:j,...E}=n,P=fe({name:"AppShell",classes:wi,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:w3}),T=y3({disabled:x,transitionDuration:h});return C.createElement(o3,{value:{getStyles:P,withBorder:d,zIndex:v,disabled:x,offsetScrollbars:S}},C.createElement(m3,{navbar:u,header:g,aside:y,footer:w,padding:f}),C.createElement(q,{ref:t,...P("root"),mod:[{resizing:T,layout:b,disabled:x},j],...E}))});Mn.classes=wi;Mn.displayName="@mantine/core/AppShell";Mn.Navbar=jv;Mn.Header=Cv;Mn.Main=Ev;Mn.Aside=Sv;Mn.Footer=bv;Mn.Section=Pv;function HE(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=>HE(t))}:e}function qE(e){return e?e.map(t=>HE(t)):[]}function GE(e){return e.reduce((t,n)=>"group"in n?{...t,...GE(n.items)}:(t[n.value]=n,t),{})}var Ln={dropdown:"m-88b62a41",options:"m-b2821a6e",option:"m-92253aa5",search:"m-985517d8",empty:"m-2530cd1d",header:"m-858f94bd",footer:"m-82b967cb",group:"m-254f3e4f",groupLabel:"m-2bb2e9e5",chevron:"m-2943220b",optionsDropdownOption:"m-390b5f4",optionsDropdownCheckIcon:"m-8ee53fc2"};const S3={error:null},b3=(e,{size:t})=>({chevron:{"--combobox-chevron-size":Ee(t,"combobox-chevron-size")}}),mf=Q((e,t)=>{const n=U("ComboboxChevron",S3,e),{size:r,error:o,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,mod:f,...h}=n,m=fe({name:"ComboboxChevron",classes:Ln,props:n,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,varsResolver:b3,rootSelector:"chevron"});return C.createElement(q,{component:"svg",...h,...m("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:o},f],ref:t},C.createElement("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"}))});mf.classes=Ln;mf.displayName="@mantine/core/ComboboxChevron";const[C3,gr]=bn("Combobox component was not found in tree"),QE=p.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},i)=>C.createElement(fs,{ref:i,size:e||"sm",variant:"transparent",tabIndex:-1,"aria-hidden":!0,...o,onMouseDown:s=>{s.preventDefault(),t==null||t(s)},onClick:s=>{r(),n==null||n(s)}}));QE.displayName="@mantine/core/ComboboxClearButton";const E3={},Tv=Q((e,t)=>{const{classNames:n,styles:r,className:o,style:i,hidden:s,...l}=U("ComboboxDropdown",E3,e),c=gr();return C.createElement(Or.Dropdown,{...l,ref:t,role:"presentation","data-hidden":s||void 0,...c.getStyles("dropdown",{className:o,style:i,classNames:n,styles:r})})});Tv.classes=Ln;Tv.displayName="@mantine/core/ComboboxDropdown";const j3={refProp:"ref"},KE=Q((e,t)=>{const{children:n,refProp:r}=U("ComboboxDropdownTarget",j3,e);if(gr(),!To(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 C.createElement(Or.Target,{ref:t,refProp:r},n)});KE.displayName="@mantine/core/ComboboxDropdownTarget";const P3={},kv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("ComboboxEmpty",P3,e),c=gr();return C.createElement(q,{ref:t,...c.getStyles("empty",{className:r,classNames:n,styles:i,style:o}),...l})});kv.classes=Ln;kv.displayName="@mantine/core/ComboboxEmpty";function Rv({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o}){const i=gr(),[s,l]=p.useState(null),c=d=>{if(e==null||e(d),!i.readOnly&&t){if(d.nativeEvent.code==="ArrowDown"&&(d.preventDefault(),i.store.dropdownOpened?l(i.store.selectNextOption()):(i.store.openDropdown("keyboard"),l(i.store.selectActiveOption()))),d.nativeEvent.code==="ArrowUp"&&(d.preventDefault(),i.store.dropdownOpened?l(i.store.selectPreviousOption()):(i.store.openDropdown("keyboard"),l(i.store.selectActiveOption()))),d.nativeEvent.code==="Enter"||d.nativeEvent.code==="NumpadEnter"){const f=i.store.getSelectedOptionIndex();i.store.dropdownOpened&&f!==-1?(d.preventDefault(),i.store.clickSelectedOption()):o==="button"&&(d.preventDefault(),i.store.openDropdown("keyboard"))}d.nativeEvent.code==="Escape"&&i.store.closeDropdown("keyboard"),d.nativeEvent.code==="Space"&&o==="button"&&(d.preventDefault(),i.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r&&!!(i.store.listId&&i.store.dropdownOpened)||void 0,"aria-controls":i.store.listId,"aria-activedescendant":i.store.dropdownOpened&&s||void 0,autoComplete:"off","data-expanded":i.store.dropdownOpened?!0:void 0}:{},onKeyDown:c}}const T3={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1},YE=Q((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,...c}=U("ComboboxEventsTarget",T3,e);if(!To(n))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 u=gr(),d=Rv({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown});return p.cloneElement(n,{...d,...c,[r]:Yt(t,u.store.targetRef,n==null?void 0:n.ref)})});YE.displayName="@mantine/core/ComboboxEventsTarget";const k3={},Iv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("ComboboxFooter",k3,e),c=gr();return C.createElement(q,{ref:t,...c.getStyles("footer",{className:r,classNames:n,style:o,styles:i}),...l})});Iv.classes=Ln;Iv.displayName="@mantine/core/ComboboxFooter";const R3={},Dv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,children:l,label:c,...u}=U("ComboboxGroup",R3,e),d=gr();return C.createElement(q,{ref:t,...d.getStyles("group",{className:r,classNames:n,style:o,styles:i}),...u},c&&C.createElement("div",{...d.getStyles("groupLabel",{classNames:n,styles:i})},c),l)});Dv.classes=Ln;Dv.displayName="@mantine/core/ComboboxGroup";const I3={},_v=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("ComboboxHeader",I3,e),c=gr();return C.createElement(q,{ref:t,...c.getStyles("header",{className:r,classNames:n,style:o,styles:i}),...l})});_v.classes=Ln;_v.displayName="@mantine/core/ComboboxHeader";const D3={},Av=Q((e,t)=>{const n=U("ComboboxOption",D3,e),{classNames:r,className:o,style:i,styles:s,vars:l,onClick:c,id:u,active:d,onMouseDown:f,onMouseOver:h,disabled:m,selected:g,mod:v,...b}=n,x=gr(),y=p.useId(),w=u||y;return C.createElement(q,{...x.getStyles("option",{className:o,classNames:r,styles:s,style:i}),...b,ref:t,id:w,mod:["combobox-option",{"combobox-active":d,"combobox-disabled":m,"combobox-selected":g},v],role:"option",onClick:S=>{var j;m?S.preventDefault():((j=x.onOptionSubmit)==null||j.call(x,n.value,n),c==null||c(S))},onMouseDown:S=>{S.preventDefault(),f==null||f(S)},onMouseOver:S=>{x.resetSelectionOnOptionHover&&x.store.resetSelectedOption(),h==null||h(S)}})});Av.classes=Ln;Av.displayName="@mantine/core/ComboboxOption";const _3={},Nv=Q((e,t)=>{const n=U("ComboboxOptions",_3,e),{classNames:r,className:o,style:i,styles:s,id:l,onMouseDown:c,labelledBy:u,...d}=n,f=gr(),h=Cn(l);return p.useEffect(()=>{f.store.setListId(h)},[h]),C.createElement(q,{ref:t,...f.getStyles("options",{className:o,style:i,classNames:r,styles:s}),...d,id:h,role:"listbox","aria-labelledby":u,onMouseDown:m=>{m.preventDefault(),c==null||c(m)}})});Nv.classes=Ln;Nv.displayName="@mantine/core/ComboboxOptions";const A3={withAriaAttributes:!0,withKeyboardNavigation:!0},Ov=Q((e,t)=>{const n=U("ComboboxSearch",A3,e),{classNames:r,styles:o,unstyled:i,vars:s,withAriaAttributes:l,onKeyDown:c,withKeyboardNavigation:u,size:d,...f}=n,h=gr(),m=h.getStyles("search"),g=Rv({targetType:"input",withAriaAttributes:l,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:c});return C.createElement(dt,{ref:Yt(t,h.store.searchRef),classNames:[{input:m.className},r],styles:[{input:m.style},o],size:d||h.size,...g,...f,__staticSelector:"Combobox"})});Ov.classes=Ln;Ov.displayName="@mantine/core/ComboboxSearch";const N3={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1},XE=Q((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,...c}=U("ComboboxTarget",N3,e);if(!To(n))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 u=gr(),d=Rv({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown}),f=p.cloneElement(n,{...d,...c});return C.createElement(Or.Target,{ref:Yt(t,u.store.targetRef)},f)});XE.displayName="@mantine/core/ComboboxTarget";function O3(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 M3(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 $3(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function gf({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:i=!0,scrollBehavior:s="instant"}={}){const[l,c]=un({value:t,defaultValue:e,finalValue:!1,onChange:n}),u=p.useRef(null),d=p.useRef(-1),f=p.useRef(null),h=p.useRef(null),m=p.useRef(-1),g=p.useRef(-1),v=p.useRef(-1),b=p.useCallback((D="unknown")=>{l||(c(!0),o==null||o(D))},[c,o,l]),x=p.useCallback((D="unknown")=>{l&&(c(!1),r==null||r(D))},[c,r,l]),y=p.useCallback((D="unknown")=>{l?x(D):b(D)},[x,b,l]),w=p.useCallback(()=>{const D=document.querySelector(`#${u.current} [data-combobox-selected]`);D==null||D.removeAttribute("data-combobox-selected"),D==null||D.removeAttribute("aria-selected")},[]),S=p.useCallback(D=>{const $=document.getElementById(u.current),_=$==null?void 0:$.querySelectorAll("[data-combobox-option]");if(!_)return null;const F=D>=_.length?0:D<0?_.length-1:D;return d.current=F,_!=null&&_[F]&&!_[F].hasAttribute("data-combobox-disabled")?(w(),_[F].setAttribute("data-combobox-selected","true"),_[F].setAttribute("aria-selected","true"),_[F].scrollIntoView({block:"nearest",behavior:s}),_[F].id):null},[s,w]),j=p.useCallback(()=>{const D=document.querySelector(`#${u.current} [data-combobox-active]`);if(D){const $=document.querySelectorAll(`#${u.current} [data-combobox-option]`),_=Array.from($).findIndex(F=>F===D);return S(_)}return S(0)},[S]),E=p.useCallback(()=>S(M3(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[S,i]),P=p.useCallback(()=>S(O3(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[S,i]),T=p.useCallback(()=>S($3(document.querySelectorAll(`#${u.current} [data-combobox-option]`))),[S]),k=p.useCallback((D="selected",$)=>{v.current=window.setTimeout(()=>{var H;const _=document.querySelectorAll(`#${u.current} [data-combobox-option]`),F=Array.from(_).findIndex(G=>G.hasAttribute(`data-combobox-${D}`));d.current=F,$!=null&&$.scrollIntoView&&((H=_[F])==null||H.scrollIntoView({block:"nearest",behavior:s}))},0)},[]),I=p.useCallback(()=>{d.current=-1,w()},[w]),O=p.useCallback(()=>{const D=document.querySelectorAll(`#${u.current} [data-combobox-option]`),$=D==null?void 0:D[d.current];$==null||$.click()},[]),R=p.useCallback(D=>{u.current=D},[]),M=p.useCallback(()=>{m.current=window.setTimeout(()=>f.current.focus(),0)},[]),N=p.useCallback(()=>{g.current=window.setTimeout(()=>h.current.focus(),0)},[]),B=p.useCallback(()=>d.current,[]);return p.useEffect(()=>()=>{window.clearTimeout(m.current),window.clearTimeout(g.current),window.clearTimeout(v.current)},[]),{dropdownOpened:l,openDropdown:b,closeDropdown:x,toggleDropdown:y,selectedOptionIndex:d.current,getSelectedOptionIndex:B,selectOption:S,selectFirstOption:T,selectActiveOption:j,selectNextOption:E,selectPreviousOption:P,resetSelectedOption:I,updateSelectedOptionIndex:k,listId:u.current,setListId:R,clickSelectedOption:O,searchRef:f,focusSearchInput:M,targetRef:h,focusTarget:N}}const L3={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},F3=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":qt(t),"--combobox-option-padding":Ee(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:z(n),"--combobox-option-fz":qt(t),"--combobox-option-padding":Ee(t,"combobox-option-padding")}});function _e(e){const t=U("Combobox",L3,e),{classNames:n,styles:r,unstyled:o,children:i,store:s,vars:l,onOptionSubmit:c,onClose:u,size:d,dropdownPadding:f,resetSelectionOnOptionHover:h,__staticSelector:m,readOnly:g,...v}=t,b=gf(),x=s||b,y=fe({name:m||"Combobox",classes:Ln,props:t,classNames:n,styles:r,unstyled:o,vars:l,varsResolver:F3}),w=()=>{u==null||u(),x.closeDropdown()};return C.createElement(C3,{value:{getStyles:y,store:x,onOptionSubmit:c,size:d,resetSelectionOnOptionHover:h,readOnly:g}},C.createElement(Or,{opened:x.dropdownOpened,...v,onClose:w,withRoles:!1,unstyled:o},i))}const z3=e=>e;_e.extend=z3;_e.classes=Ln;_e.displayName="@mantine/core/Combobox";_e.Target=XE;_e.Dropdown=Tv;_e.Options=Nv;_e.Option=Av;_e.Search=Ov;_e.Empty=kv;_e.Chevron=mf;_e.Footer=Iv;_e.Header=_v;_e.EventsTarget=YE;_e.DropdownTarget=KE;_e.Group=Dv;_e.ClearButton=QE;var JE={root:"m-5f75b09e",body:"m-5f6e695e",labelWrapper:"m-d3ea56bb",label:"m-8ee546b8",description:"m-328f68c0",error:"m-8e8a99cc"};const ZE=JE,vf=p.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:o,unstyled:i,children:s,label:l,description:c,id:u,disabled:d,error:f,size:h,labelPosition:m="left",variant:g,style:v,vars:b,mod:x,...y},w)=>{const S=fe({name:e,props:t,className:n,style:v,classes:JE,classNames:r,styles:o,unstyled:i});return C.createElement(q,{...S("root"),ref:w,__vars:{"--label-fz":qt(h),"--label-lh":Ee(h,"label-lh")},mod:[{"label-position":m},x],variant:g,size:h,...y},C.createElement("div",{...S("body")},s,C.createElement("div",{...S("labelWrapper"),"data-disabled":d||void 0},l&&C.createElement("label",{...S("label"),"data-disabled":d||void 0,htmlFor:u},l),c&&C.createElement(dt.Description,{size:h,__inheritStyles:!1,...S("description")},c),f&&f!=="boolean"&&C.createElement(dt.Error,{size:h,__inheritStyles:!1,...S("error")},f))))});vf.displayName="@mantine/core/InlineInput";const ej=p.createContext(null),B3=ej.Provider,U3=()=>p.useContext(ej);function Mv({children:e,role:t}){const n=Da();return n?C.createElement("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy},e):C.createElement(C.Fragment,null,e)}const V3={},$v=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,readOnly:c,...u}=U("CheckboxGroup",V3,e),[d,f]=un({value:n,defaultValue:r,finalValue:[],onChange:o}),h=m=>{const g=m.currentTarget.value;!c&&f(d.includes(g)?d.filter(v=>v!==g):[...d,g])};return C.createElement(B3,{value:{value:d,onChange:h,size:i}},C.createElement(dt.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"CheckboxGroup"},C.createElement(Mv,{role:"group"},l)))});$v.classes=dt.Wrapper.classes;$v.displayName="@mantine/core/CheckboxGroup";function yf({size:e,style:t,...n}){const r=e!==void 0?{width:z(e),height:z(e),...t}:t;return C.createElement("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n},C.createElement("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 W3({indeterminate:e,...t}){return e?C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...t},C.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):C.createElement(yf,{...t})}var tj={root:"m-bf2d988c",inner:"m-26062bec",input:"m-26063560",icon:"m-bf295423","input--outline":"m-215c4542"};const H3={labelPosition:"right",icon:W3},q3=(e,{radius:t,color:n,size:r,iconColor:o,variant:i,autoContrast:s})=>{const l=to({color:n||e.primaryColor,theme:e}),c=l.isThemeColor&&l.shade===void 0?`var(--mantine-color-${l.color}-outline)`:l.color;return{root:{"--checkbox-size":Ee(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:ft(t),"--checkbox-color":i==="outline"?c:yt(n,e),"--checkbox-icon-color":o?yt(o,e):oc(s,e)?is({color:n,theme:e}):void 0}}},ur=Q((e,t)=>{const n=U("Checkbox",H3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,label:d,id:f,size:h,radius:m,wrapperProps:g,children:v,checked:b,labelPosition:x,description:y,error:w,disabled:S,variant:j,indeterminate:E,icon:P,rootRef:T,iconColor:k,onChange:I,autoContrast:O,mod:R,...M}=n,N=U3(),B=h||(N==null?void 0:N.size),D=P,$=fe({name:"Checkbox",props:n,classes:tj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:q3}),{styleProps:_,rest:F}=ko(M),H=Cn(f),G=N?{checked:N.value.includes(F.value),onChange:oe=>{N.onChange(oe),I==null||I(oe)}}:{};return C.createElement(vf,{...$("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:H,size:B,labelPosition:x,label:d,description:y,error:w,disabled:S,classNames:r,styles:s,unstyled:l,"data-checked":G.checked||b||void 0,variant:j,ref:T,mod:R,..._,...g},C.createElement(q,{...$("inner"),mod:{"data-label-position":x}},C.createElement(q,{component:"input",id:H,ref:t,checked:b,disabled:S,mod:{error:!!w,indeterminate:E},...$("input",{focusable:!0,variant:j}),onChange:I,...F,...G,type:"checkbox"}),C.createElement(D,{indeterminate:E,...$("icon")})))});ur.classes={...tj,...ZE};ur.displayName="@mantine/core/Checkbox";ur.Group=$v;function ya(e){return"group"in e}function nj({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),o=[];for(let i=0;i<e.length;i+=1){const s=e[i];if(o.length===n)return o;ya(s)&&o.push({group:s.group,items:nj({options:s.items,search:t,limit:n-o.length})}),ya(s)||s.label.toLowerCase().includes(r)&&o.push(s)}return o}function G3(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 rj(e,t=new Set){if(Array.isArray(e))for(const n of e)if(ya(n))rj(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 fu(e,t){return Array.isArray(e)?e.includes(t):e===t}function oj({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:o}){if(!ya(e)){const s=t&&fu(n,e.value)&&C.createElement(yf,{className:Ln.optionsDropdownCheckIcon});return C.createElement(_e.Option,{value:e.value,disabled:e.disabled,className:Ze({[Ln.optionsDropdownOption]:!o}),"data-reverse":r==="right"||void 0,"data-checked":fu(n,e.value)||void 0,"aria-selected":fu(n,e.value),active:fu(n,e.value)},r==="left"&&s,C.createElement("span",null,e.label),r==="right"&&s)}const i=e.items.map(s=>C.createElement(oj,{data:s,value:n,key:s.value,unstyled:o,withCheckIcon:t,checkIconPosition:r}));return C.createElement(_e.Group,{label:e.group},i)}function Q3({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:o,limit:i,maxDropdownHeight:s,withScrollArea:l=!0,filterOptions:c=!0,withCheckIcon:u=!1,value:d,checkIconPosition:f,nothingFoundMessage:h,unstyled:m,labelId:g}){rj(e);const b=typeof o=="string"?(r||nj)({options:e,search:c?o:"",limit:i??1/0}):e,x=G3(b),y=b.map(w=>C.createElement(oj,{data:w,key:ya(w)?w.group:w.value,withCheckIcon:u,value:d,checkIconPosition:f,unstyled:m}));return C.createElement(_e.Dropdown,{hidden:t||n&&x},C.createElement(_e.Options,{labelledBy:g},l?C.createElement(hr.Autosize,{mah:s??220,type:"scroll",scrollbarSize:"var(--_combobox-padding)",offsetScrollbars:"y"},y):y,x&&h&&C.createElement(_e.Empty,null,h)))}const ij=p.createContext(null),K3=ij.Provider;function Y3(){return{withinGroup:!!p.useContext(ij)}}var xf={group:"m-11def92b",root:"m-f85678b6",image:"m-11f8ac07",placeholder:"m-104cd71f"};const X3={},J3=(e,{spacing:t})=>({group:{"--ag-spacing":en(t)}}),Lv=Q((e,t)=>{const n=U("AvatarGroup",X3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,spacing:u,...d}=n,f=fe({name:"AvatarGroup",classes:xf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:J3,rootSelector:"group"});return C.createElement(K3,{value:!0},C.createElement(q,{ref:t,...f("group"),...d}))});Lv.classes=xf;Lv.displayName="@mantine/core/AvatarGroup";function Z3(e){return C.createElement("svg",{...e,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},C.createElement("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"}))}const eN={},tN=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||"gray",theme:e,gradient:o,variant:r||"light",autoContrast:s});return{root:{"--avatar-size":Ee(t,"avatar-size"),"--avatar-radius":n===void 0?void 0:ft(n),"--avatar-bg":i||r?l.background:void 0,"--avatar-color":i||r?l.color:void 0,"--avatar-bd":i||r?l.border:void 0}}},Ji=fn((e,t)=>{const n=U("Avatar",eN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,src:u,alt:d,radius:f,color:h,gradient:m,imageProps:g,children:v,autoContrast:b,mod:x,...y}=n,w=Y3(),[S,j]=p.useState(!u),E=fe({name:"Avatar",props:n,classes:xf,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:tN});return p.useEffect(()=>j(!u),[u]),C.createElement(q,{...E("root"),mod:[{"within-group":w.withinGroup},x],ref:t,...y},S?C.createElement("span",{...E("placeholder"),title:d},v||C.createElement(Z3,null)):C.createElement("img",{...g,...E("image"),src:u,alt:d,onError:P=>{var T;j(!0),(T=g==null?void 0:g.onError)==null||T.call(g,P)}}))});Ji.classes=xf;Ji.displayName="@mantine/core/Avatar";Ji.Group=Lv;var sj={root:"m-347db0ec","root--dot":"m-fbd81e3d",label:"m-5add502a",section:"m-91fdda9b"};const nN={},rN=(e,{radius:t,color:n,gradient:r,variant:o,size:i,autoContrast:s})=>{const l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{root:{"--badge-height":Ee(i,"badge-height"),"--badge-padding-x":Ee(i,"badge-padding-x"),"--badge-fz":Ee(i,"badge-fz"),"--badge-radius":t===void 0?void 0:ft(t),"--badge-bg":n||o?l.background:void 0,"--badge-color":n||o?l.color:void 0,"--badge-bd":n||o?l.border:void 0,"--badge-dot-color":o==="dot"?yt(n,e):void 0}}},mc=fn((e,t)=>{const n=U("Badge",nN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,radius:u,color:d,gradient:f,leftSection:h,rightSection:m,children:g,variant:v,fullWidth:b,autoContrast:x,circle:y,mod:w,...S}=n,j=fe({name:"Badge",props:n,classes:sj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:rN});return C.createElement(q,{variant:v,mod:[{block:b,circle:y},w],...j("root",{variant:v}),ref:t,...S},h&&C.createElement("span",{...j("section"),"data-position":"left"},h),C.createElement("span",{...j("label")},g),m&&C.createElement("span",{...j("section"),"data-position":"right"},m))});mc.classes=sj;mc.displayName="@mantine/core/Badge";var aj={root:"m-ddec01c0",icon:"m-dde7bd57",cite:"m-dde51a35"};const oN={iconSize:48},iN=(e,{color:t,iconSize:n,radius:r})=>{const o=to({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),i=to({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":Zt(i.value,.07),"--bq-bg-dark":Zt(o.value,.06),"--bq-bd":yt(t,e),"--bq-icon-size":z(n),"--bq-radius":ft(r)}}},Fv=Q((e,t)=>{const n=U("Blockquote",oN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,icon:d,iconSize:f,cite:h,...m}=n,g=fe({name:"Blockquote",classes:aj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:iN});return C.createElement(q,{component:"blockquote",ref:t,...g("root"),...m},d&&C.createElement("span",{...g("icon")},d),u,h&&C.createElement("cite",{...g("cite")},h))});Fv.classes=aj;Fv.displayName="@mantine/core/Blockquote";var wf={root:"m-77c9d27d",inner:"m-80f1301b",loader:"m-a25b86ee",label:"m-811560b9",section:"m-a74036a",group:"m-80d6d844"};const u1={orientation:"horizontal"},sN=(e,{borderWidth:t})=>({group:{"--button-border-width":z(t)}}),zv=Q((e,t)=>{const n=U("ButtonGroup",u1,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,mod:h,...m}=U("ButtonGroup",u1,e),g=fe({name:"ButtonGroup",props:n,classes:wf,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:sN,rootSelector:"group"});return C.createElement(q,{...g("group"),ref:t,variant:f,mod:[{"data-orientation":c},h],role:"group",...m})});zv.classes=wf;zv.displayName="@mantine/core/ButtonGroup";const aN={},lN=(e,{radius:t,color:n,gradient:r,variant:o,size:i,justify:s,autoContrast:l})=>{const c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:l});return{root:{"--button-justify":s,"--button-height":Ee(i,"button-height"),"--button-padding-x":Ee(i,"button-padding-x"),"--button-fz":i!=null&&i.includes("compact")?qt(i.replace("compact-","")):qt(i),"--button-radius":t===void 0?void 0:ft(t),"--button-bg":n||o?c.background:void 0,"--button-hover":n||o?c.hover:void 0,"--button-color":c.color,"--button-bd":n||o?c.border:void 0,"--button-hover-color":n||o?c.hoverColor:void 0}}},ee=fn((e,t)=>{const n=U("Button",aN,e),{style:r,vars:o,className:i,color:s,disabled:l,children:c,leftSection:u,rightSection:d,fullWidth:f,variant:h,radius:m,loading:g,loaderProps:v,gradient:b,classNames:x,styles:y,unstyled:w,"data-disabled":S,autoContrast:j,mod:E,...P}=n,T=fe({name:"Button",props:n,classes:wf,className:i,style:r,classNames:x,styles:y,unstyled:w,vars:o,varsResolver:lN}),k=!!u,I=!!d;return C.createElement(lr,{ref:t,...T("root",{active:!l&&!g&&!S}),unstyled:w,variant:h,disabled:l||g,mod:[{disabled:l||S,loading:g,block:f,"with-left-section":k,"with-right-section":I},E],...P},C.createElement(q,{component:"span",...T("loader"),"aria-hidden":!0},C.createElement($n,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...v})),C.createElement("span",{...T("inner")},u&&C.createElement(q,{component:"span",...T("section"),mod:{position:"left"}},u),C.createElement(q,{component:"span",mod:{loading:g},...T("label")},c),d&&C.createElement(q,{component:"span",...T("section"),mod:{position:"right"}},d)))});ee.classes=wf;ee.displayName="@mantine/core/Button";ee.Group=zv;var lj={root:"m-4451eb3a"};const cN={},tn=fn((e,t)=>{const n=U("Center",cN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,inline:u,mod:d,...f}=n,h=fe({name:"Center",props:n,classes:lj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c});return C.createElement(q,{ref:t,mod:[{inline:u},d],...h("root"),...f})});tn.classes=lj;tn.displayName="@mantine/core/Center";const[uN,dN]=rc(),fN={};function cj(e){const{value:t,defaultValue:n,onChange:r,multiple:o,children:i}=U("ChipGroup",fN,e),[s,l]=un({value:t,defaultValue:n,finalValue:o?[]:null,onChange:r}),c=d=>Array.isArray(s)?s.includes(d):d===s,u=d=>{const f=d.currentTarget.value;Array.isArray(s)?l(s.includes(f)?s.filter(h=>h!==f):[...s,f]):l(f)};return C.createElement(uN,{value:{isChipSelected:c,onChange:u,multiple:o}},i)}cj.displayName="@mantine/core/ChipGroup";var uj={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 hN={type:"checkbox"},pN=(e,{size:t,radius:n,variant:r,color:o,autoContrast:i})=>{const s=e.variantColorResolver({color:o||e.primaryColor,theme:e,variant:r||"filled",autoContrast:i});return{root:{"--chip-fz":qt(t),"--chip-size":Ee(t,"chip-size"),"--chip-radius":n===void 0?void 0:ft(n),"--chip-checked-padding":Ee(t,"chip-checked-padding"),"--chip-padding":Ee(t,"chip-padding"),"--chip-icon-size":Ee(t,"chip-icon-size"),"--chip-bg":o||r?s.background:void 0,"--chip-hover":o||r?s.hover:void 0,"--chip-color":o||r?s.color:void 0,"--chip-bd":o||r?s.border:void 0,"--chip-spacing":Ee(t,"chip-spacing")}}},Hl=Q((e,t)=>{const n=U("Chip",hN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,id:u,checked:d,defaultChecked:f,onChange:h,value:m,wrapperProps:g,type:v,disabled:b,children:x,size:y,variant:w,icon:S,rootRef:j,autoContrast:E,mod:P,...T}=n,k=fe({name:"Chip",classes:uj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:pN}),I=dN(),O=Cn(u),{styleProps:R,rest:M}=ko(T),[N,B]=un({value:d,defaultValue:f,finalValue:!1,onChange:h}),D=I?{checked:I.isChipSelected(m),onChange:_=>{I.onChange(_),h==null||h(_.currentTarget.checked)},type:I.multiple?"checkbox":"radio"}:{},$=D.checked||N;return C.createElement(q,{size:y,variant:w,ref:j,mod:P,...k("root"),...R,...g},C.createElement("input",{type:v,...k("input"),checked:$,onChange:_=>B(_.currentTarget.checked),id:O,disabled:b,ref:t,value:m,...D,...M}),C.createElement("label",{htmlFor:O,"data-checked":$||void 0,"data-disabled":b||void 0,...k("label",{variant:w||"filled"})},$&&C.createElement("span",{...k("iconWrapper")},S||C.createElement(yf,{...k("checkIcon")})),C.createElement("span",null,x)))});Hl.classes=uj;Hl.displayName="@mantine/core/Chip";Hl.Group=cj;var dj={root:"m-7485cace"};const mN={},gN=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:Ee(t,"container-size")}}),Bv=Q((e,t)=>{const n=U("Container",mN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,fluid:u,mod:d,...f}=n,h=fe({name:"Container",classes:dj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:gN});return C.createElement(q,{ref:t,mod:[{fluid:u},d],...h("root"),...f})});Bv.classes=dj;Bv.displayName="@mantine/core/Container";const vN={timeout:1e3};function fj(e){const{children:t,timeout:n,value:r,...o}=U("CopyButton",vN,e),i=ES({timeout:n}),s=()=>i.copy(r);return C.createElement(C.Fragment,null,t({copy:s,copied:i.copied,...o}))}fj.displayName="@mantine/core/CopyButton";var hj={root:"m-3eebeb36",label:"m-9e365f20"};const yN={orientation:"horizontal"},xN=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?yt(t,e):void 0,"--divider-border-style":n,"--divider-size":Ee(r,"divider-size")}}),Rn=Q((e,t)=>{const n=U("Divider",yN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,orientation:d,label:f,labelPosition:h,mod:m,...g}=n,v=fe({name:"Divider",classes:hj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:xN});return C.createElement(q,{ref:t,mod:[{orientation:d,"with-label":!!f},m],...v("root"),...g,role:"separator"},f&&C.createElement(q,{component:"span",mod:{position:h},...v("label")},f))});Rn.classes=hj;Rn.displayName="@mantine/core/Divider";function wN({open:e,close:t,openDelay:n,closeDelay:r}){const o=p.useRef(-1),i=p.useRef(-1),s=()=>{window.clearTimeout(o.current),window.clearTimeout(i.current)},l=()=>{s(),n===0||n===void 0?e():o.current=window.setTimeout(e,n)},c=()=>{s(),r===0||r===void 0?t():i.current=window.setTimeout(t,r)};return p.useEffect(()=>s,[]),{openDropdown:l,closeDropdown:c}}const[SN,pj]=bn("Grid component was not found in tree"),gm=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,d1=(e,t,n)=>n||e==="auto"?"100%":e==="content"?"unset":gm(e,t),f1=(e,t)=>{if(e)return e==="auto"||t?"1":"auto"},h1=(e,t)=>e===0?"0":e?`${100/(t/e)}%`:void 0;function bN({span:e,order:t,offset:n,selector:r}){var h;const o=Pt(),i=pj(),l=Yo(e)===void 0?12:Yo(e),c=os({"--col-order":(h=Yo(t))==null?void 0:h.toString(),"--col-flex-grow":f1(l,i.grow),"--col-flex-basis":gm(l,i.columns),"--col-width":l==="content"?"auto":void 0,"--col-max-width":d1(l,i.columns,i.grow),"--col-offset":h1(Yo(n),i.columns)}),u=ct(o.breakpoints).reduce((m,g)=>{var v;return m[g]||(m[g]={}),typeof t=="object"&&t[g]!==void 0&&(m[g]["--col-order"]=(v=t[g])==null?void 0:v.toString()),typeof e=="object"&&e[g]!==void 0&&(m[g]["--col-flex-grow"]=f1(e[g],i.grow),m[g]["--col-flex-basis"]=gm(e[g],i.columns),m[g]["--col-width"]=e[g]==="content"?"auto":void 0,m[g]["--col-max-width"]=d1(e[g],i.columns,i.grow)),typeof n=="object"&&n[g]!==void 0&&(m[g]["--col-offset"]=h1(n[g],i.columns)),m},{}),f=Pl(ct(u),o).filter(m=>ct(u[m.value]).length>0).map(m=>({query:`(min-width: ${o.breakpoints[m.value]})`,styles:u[m.value]}));return C.createElement(Ta,{styles:c,media:f,selector:r})}var Uv={root:"m-410352e9",inner:"m-dee7bd2f",col:"m-96bdd299"};const CN={span:12},Vv=Q((e,t)=>{const n=U("GridCol",CN,e),{classNames:r,className:o,style:i,styles:s,vars:l,span:c,order:u,offset:d,...f}=n,h=pj(),m=ic();return C.createElement(C.Fragment,null,C.createElement(bN,{selector:`.${m}`,span:c,order:u,offset:d}),C.createElement(q,{ref:t,...h.getStyles("col",{className:Ze(o,m),style:i,classNames:r,styles:s}),...f}))});Vv.classes=Uv;Vv.displayName="@mantine/core/GridCol";function EN({gutter:e,selector:t}){const n=Pt(),r=os({"--grid-gutter":en(Yo(e))}),o=ct(n.breakpoints).reduce((l,c)=>(l[c]||(l[c]={}),typeof e=="object"&&e[c]!==void 0&&(l[c]["--grid-gutter"]=en(e[c])),l),{}),s=Pl(ct(o),n).filter(l=>ct(o[l.value]).length>0).map(l=>({query:`(min-width: ${n.breakpoints[l.value]})`,styles:o[l.value]}));return C.createElement(Ta,{styles:r,media:s,selector:t})}const jN={gutter:"md",grow:!1,columns:12},PN=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),Wn=Q((e,t)=>{const n=U("Grid",jN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,grow:u,gutter:d,columns:f,align:h,justify:m,children:g,...v}=n,b=fe({name:"Grid",classes:Uv,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:PN}),x=ic();return C.createElement(SN,{value:{getStyles:b,grow:u,columns:f}},C.createElement(EN,{selector:`.${x}`,...n}),C.createElement(q,{ref:t,...b("root",{className:x}),...v},C.createElement("div",{...b("inner")},g)))});Wn.classes=Uv;Wn.displayName="@mantine/core/Grid";Wn.Col=Vv;function xd(){return xd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xd.apply(this,arguments)}function Wv(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var TN=p.useLayoutEffect,kN=function(t){var n=p.useRef(t);return TN(function(){n.current=t}),n},p1=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},RN=function(t,n){var r=p.useRef();return p.useCallback(function(o){t.current=o,r.current&&p1(r.current,null),r.current=n,n&&p1(n,o)},[n])},m1={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},IN=function(t){Object.keys(m1).forEach(function(n){t.style.setProperty(n,m1[n],"important")})},g1=IN,mn=null,v1=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function DN(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),mn||(mn=document.createElement("textarea"),mn.setAttribute("tabindex","-1"),mn.setAttribute("aria-hidden","true"),g1(mn)),mn.parentNode===null&&document.body.appendChild(mn);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,l=s.boxSizing;Object.keys(s).forEach(function(h){var m=h;mn.style[m]=s[m]}),g1(mn),mn.value=t;var c=v1(mn,e);mn.value=t,c=v1(mn,e),mn.value="x";var u=mn.scrollHeight-o,d=u*n;l==="border-box"&&(d=d+o+i),c=Math.max(d,c);var f=u*r;return l==="border-box"&&(f=f+o+i),c=Math.min(f,c),[c,u]}var y1=function(){},_N=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},AN=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],NN=!!document.documentElement.currentStyle,ON=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=_N(AN,n),o=r.boxSizing;if(o==="")return null;NN&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),s=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:s}},MN=ON;function mj(e,t,n){var r=kN(n);p.useLayoutEffect(function(){var o=function(s){return r.current(s)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var $N=function(t){mj(window,"resize",t)},LN=function(t){mj(document.fonts,"loadingdone",t)},FN=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],zN=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,l=s===void 0?y1:s,c=t.onHeightChange,u=c===void 0?y1:c,d=Wv(t,FN),f=d.value!==void 0,h=p.useRef(null),m=RN(h,n),g=p.useRef(0),v=p.useRef(),b=function(){var w=h.current,S=r&&v.current?v.current:MN(w);if(S){v.current=S;var j=DN(S,w.value||w.placeholder||"x",i,o),E=j[0],P=j[1];g.current!==E&&(g.current=E,w.style.setProperty("height",E+"px","important"),u(E,{rowHeight:P}))}},x=function(w){f||b(),l(w)};return p.useLayoutEffect(b),$N(b),LN(b),p.createElement("textarea",xd({},d,{onChange:x,ref:m}))},BN=p.forwardRef(zN);const UN={},ps=Q((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:i,resize:s,...l}=U("Textarea",UN,e),c=n&&DS()!=="test",u=c?{maxRows:r,minRows:o}:{};return C.createElement(mr,{component:c?BN:"textarea",ref:t,...l,__staticSelector:i||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":s},...u})});ps.classes=mr.classes;ps.displayName="@mantine/core/Textarea";function x1(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}const VN={serialize:JSON.stringify,deserialize:JSON.parse},Aa=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,formatOnBlur:i,validationError:s,serialize:l,deserialize:c,onFocus:u,onBlur:d,readOnly:f,error:h,...m}=U("JsonInput",VN,e),[g,v]=un({value:n,defaultValue:r,finalValue:"",onChange:o}),[b,x]=p.useState(x1(g,c)),y=S=>{u==null||u(S),x(!0)},w=S=>{typeof d=="function"&&d(S);const j=x1(S.currentTarget.value,c);i&&!f&&j&&S.currentTarget.value.trim()!==""&&v(l(c(S.currentTarget.value),null,2)),x(j)};return C.createElement(ps,{value:g,onChange:S=>v(S.currentTarget.value),onFocus:y,onBlur:w,ref:t,readOnly:f,...m,autoComplete:"off",__staticSelector:"JsonInput",error:b?h:s||!0,"data-monospace":!0})});Aa.classes=mr.classes;Aa.displayName="@mantine/core/JsonInput";const[WN,HN]=bn("List component was not found in tree");var Hv={root:"m-abbac491",item:"m-abb6bec2",itemWrapper:"m-75cd9f71",itemIcon:"m-60f83e5b"};const qN={},qv=Q((e,t)=>{const n=U("ListItem",qN,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,children:u,mod:d,...f}=n,h=HN(),m=c||h.icon,g={classNames:r,styles:s};return C.createElement(q,{...h.getStyles("item",{...g,className:o,style:i}),component:"li",mod:[{"with-icon":!!m,centered:h.center},d],ref:t,...f},C.createElement("div",{...h.getStyles("itemWrapper",g)},m&&C.createElement("span",{...h.getStyles("itemIcon",g)},m),C.createElement("span",{...h.getStyles("itemLabel",g)},u)))});qv.classes=Hv;qv.displayName="@mantine/core/ListItem";const GN={type:"unordered"},QN=(e,{size:t,spacing:n})=>({root:{"--list-fz":qt(t),"--list-lh":CS(t),"--list-spacing":en(n)}}),xn=Q((e,t)=>{const n=U("List",GN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,type:d,withPadding:f,icon:h,spacing:m,center:g,listStyleType:v,mod:b,...x}=n,y=fe({name:"List",classes:Hv,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:QN});return C.createElement(WN,{value:{center:g,icon:h,getStyles:y}},C.createElement(q,{...y("root",{style:{listStyleType:v}}),component:d==="unordered"?"ul":"ol",mod:[{"with-padding":f},b],ref:t,...x},u))});xn.classes=Hv;xn.displayName="@mantine/core/List";xn.Item=qv;var gj={root:"m-6e45937b",loader:"m-e8eb006c",overlay:"m-df587f17"};const w1={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:Nr("overlay")},KN=(e,{zIndex:t})=>({root:{"--lo-z-index":t==null?void 0:t.toString()}}),Gv=Q((e,t)=>{const n=U("LoadingOverlay",w1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,transitionProps:u,loaderProps:d,overlayProps:f,visible:h,zIndex:m,...g}=n,v=Pt(),b=fe({name:"LoadingOverlay",classes:gj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:KN}),x={...w1.overlayProps,...f};return C.createElement(ds,{transition:"fade",...u,mounted:!!h},y=>C.createElement(q,{...b("root",{style:y}),ref:t,...g},C.createElement($n,{...b("loader"),unstyled:l,...d}),C.createElement(Wl,{...x,...b("overlay"),darkHidden:!0,unstyled:l,color:(f==null?void 0:f.color)||v.white}),C.createElement(Wl,{...x,...b("overlay"),lightHidden:!0,unstyled:l,color:(f==null?void 0:f.color)||v.colors.dark[5]})))});Gv.classes=gj;Gv.displayName="@mantine/core/LoadingOverlay";const[YN,gc]=bn("Menu component was not found in the tree");var Na={dropdown:"m-dc9b7c9f",label:"m-9bfac126",divider:"m-efdf90cb",item:"m-99ac2aa1",itemLabel:"m-5476e0d3",itemSection:"m-8b75e504"};const XN={},Qv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("MenuDivider",XN,e),c=gc();return C.createElement(q,{ref:t,...c.getStyles("divider",{className:r,style:o,styles:i,classNames:n}),...l})});Qv.classes=Na;Qv.displayName="@mantine/core/MenuDivider";const JN={},Kv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,onMouseEnter:l,onMouseLeave:c,children:u,...d}=U("MenuDropdown",JN,e),f=p.useRef(null),h=gc(),m=b=>{var x,y;(b.key==="ArrowUp"||b.key==="ArrowDown")&&(b.preventDefault(),(y=(x=f.current)==null?void 0:x.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||y.focus())},g=Un(l,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.openDropdown()),v=Un(c,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.closeDropdown());return C.createElement(Or.Dropdown,{...d,onMouseEnter:g,onMouseLeave:v,role:"menu","aria-orientation":"vertical",ref:Yt(t,f),...h.getStyles("dropdown",{className:r,style:o,styles:i,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:m},C.createElement("div",{tabIndex:-1,"data-autofocus":!0}),u)});Kv.classes=Na;Kv.displayName="@mantine/core/MenuDropdown";const ZN={},Yv=fn((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,color:l,closeMenuOnClick:c,leftSection:u,rightSection:d,children:f,disabled:h,...m}=U("MenuItem",ZN,e),g=gc(),v=Pt(),{dir:b}=ss(),x=p.useRef(),y=g.getItemIndex(x.current),w=m,S=Un(w.onMouseLeave,()=>g.setHovered(-1)),j=Un(w.onMouseEnter,()=>g.setHovered(g.getItemIndex(x.current))),E=Un(w.onClick,()=>{typeof c=="boolean"?c&&g.closeDropdownImmediately():g.closeOnItemClick&&g.closeDropdownImmediately()}),P=Un(w.onFocus,()=>g.setHovered(g.getItemIndex(x.current))),T=l?v.variantColorResolver({color:l,theme:v,variant:"light"}):void 0,k=l?to({color:l,theme:v}):null;return C.createElement(lr,{...m,unstyled:g.unstyled,tabIndex:g.menuItemTabIndex,onFocus:P,...g.getStyles("item",{className:r,style:o,styles:i,classNames:n}),ref:Yt(x,t),role:"menuitem",disabled:h,"data-menu-item":!0,"data-disabled":h||void 0,"data-hovered":g.hovered===y?!0:void 0,onMouseEnter:j,onMouseLeave:S,onClick:E,onKeyDown:bS({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:g.loop,dir:b,orientation:"vertical",onKeyDown:w.onKeydown}),__vars:{"--menu-item-color":k!=null&&k.isThemeColor&&(k==null?void 0:k.shade)===void 0?`var(--mantine-color-${k.color}-6)`:T==null?void 0:T.color,"--menu-item-hover":T==null?void 0:T.hover}},u&&C.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"left"},u),f&&C.createElement("div",{...g.getStyles("itemLabel",{styles:i,classNames:n})},f),d&&C.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"right"},d))});Yv.classes=Na;Yv.displayName="@mantine/core/MenuItem";const e9={},Xv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("MenuLabel",e9,e),c=gc();return C.createElement(q,{ref:t,...c.getStyles("label",{className:r,style:o,styles:i,classNames:n}),...l})});Xv.classes=Na;Xv.displayName="@mantine/core/MenuLabel";const t9={refProp:"ref"},vj=p.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=U("MenuTarget",t9,e);if(!To(n))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 i=gc(),s=Un(n.props.onClick,()=>{i.trigger==="click"?i.toggleDropdown():i.trigger==="click-hover"&&(i.setOpenedViaClick(!0),i.opened||i.openDropdown())}),l=Un(n.props.onMouseEnter,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.openDropdown()),c=Un(n.props.onMouseLeave,()=>{(i.trigger==="hover"||i.trigger==="click-hover"&&!i.openedViaClick)&&i.closeDropdown()});return C.createElement(Or.Target,{refProp:r,popupType:"menu",ref:t,...o},p.cloneElement(n,{onClick:s,onMouseEnter:l,onMouseLeave:c,"data-expanded":i.opened?!0:void 0}))});vj.displayName="@mantine/core/MenuTarget";const n9={trapFocus:!0,closeOnItemClick:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function J(e){const t=U("Menu",n9,e),{children:n,onOpen:r,onClose:o,opened:i,defaultOpened:s,trapFocus:l,onChange:c,closeOnItemClick:u,loop:d,closeOnEscape:f,trigger:h,openDelay:m,closeDelay:g,classNames:v,styles:b,unstyled:x,variant:y,vars:w,menuItemTabIndex:S,keepMounted:j,...E}=t,P=fe({name:"Menu",classes:Na,props:t,classNames:v,styles:b,unstyled:x}),[T,{setHovered:k,resetHovered:I}]=X2(),[O,R]=un({value:i,defaultValue:s,finalValue:!1,onChange:c}),[M,N]=p.useState(!1),B=()=>{R(!1),N(!1),O&&(o==null||o())},D=()=>{R(!0),!O&&(r==null||r())},$=()=>{O?B():D()},{openDropdown:_,closeDropdown:F}=wN({open:D,close:B,closeDelay:g,openDelay:m}),H=be=>Y2("[data-menu-item]","[data-menu-dropdown]",be),{resolvedClassNames:G,resolvedStyles:oe}=Wd({classNames:v,styles:b,props:t});return go(()=>{I()},[O]),C.createElement(YN,{value:{getStyles:P,opened:O,toggleDropdown:$,getItemIndex:H,hovered:T,setHovered:k,openedViaClick:M,setOpenedViaClick:N,closeOnItemClick:u,closeDropdown:h==="click"?B:F,openDropdown:h==="click"?D:_,closeDropdownImmediately:B,loop:d,trigger:h,unstyled:x,menuItemTabIndex:S}},C.createElement(Or,{...E,opened:O,onChange:$,defaultOpened:s,trapFocus:j?!1:l,closeOnEscape:f,__staticSelector:"Menu",classNames:G,styles:oe,unstyled:x,variant:y,keepMounted:j},n))}J.extend=e=>e;J.classes=Na;J.displayName="@mantine/core/Menu";J.Item=Yv;J.Label=Xv;J.Dropdown=Kv;J.Target=vj;J.Divider=Qv;const[r9,Oa]=bn("Modal component was not found in tree");var _o={root:"m-9df02822",content:"m-54c44539",inner:"m-1f958f16",header:"m-d0e2b9cd"};const o9={},Sf=Q((e,t)=>{const n=U("ModalBody",o9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Oa();return C.createElement(ME,{ref:t,...u.getStyles("body",{classNames:r,style:i,styles:s,className:o}),...c})});Sf.classes=_o;Sf.displayName="@mantine/core/ModalBody";const i9={},bf=Q((e,t)=>{const n=U("ModalCloseButton",i9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Oa();return C.createElement($E,{ref:t,...u.getStyles("close",{classNames:r,style:i,styles:s,className:o}),...c})});bf.classes=_o;bf.displayName="@mantine/core/ModalCloseButton";const s9={},Cf=Q((e,t)=>{const n=U("ModalContent",s9,e),{classNames:r,className:o,style:i,styles:s,vars:l,children:c,...u}=n,d=Oa(),f=d.scrollAreaComponent||$A;return C.createElement(AA,{...d.getStyles("content",{className:o,style:i,styles:s,classNames:r}),innerProps:d.getStyles("inner",{className:o,style:i,styles:s,classNames:r}),"data-full-screen":d.fullScreen||void 0,ref:t,...u},C.createElement(f,{style:{maxHeight:d.fullScreen?"100dvh":`calc(100dvh - (${z(d.yOffset)} * 2))`}},c))});Cf.classes=_o;Cf.displayName="@mantine/core/ModalContent";const a9={},Ef=Q((e,t)=>{const n=U("ModalHeader",a9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Oa();return C.createElement(LE,{ref:t,...u.getStyles("header",{classNames:r,style:i,styles:s,className:o}),...c})});Ef.classes=_o;Ef.displayName="@mantine/core/ModalHeader";const l9={},jf=Q((e,t)=>{const n=U("ModalOverlay",l9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Oa();return C.createElement(FE,{ref:t,...u.getStyles("overlay",{classNames:r,style:i,styles:s,className:o}),...c})});jf.classes=_o;jf.displayName="@mantine/core/ModalOverlay";const c9={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Nr("modal"),transitionProps:{duration:200,transition:"pop"},yOffset:"5dvh"},u9=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:ft(t),"--modal-size":Ee(n,"modal-size"),"--modal-y-offset":z(r),"--modal-x-offset":z(o)}}),Pf=Q((e,t)=>{const n=U("ModalRoot",c9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,yOffset:u,scrollAreaComponent:d,radius:f,fullScreen:h,centered:m,xOffset:g,__staticSelector:v,...b}=n,x=fe({name:v,classes:_o,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:u9});return C.createElement(r9,{value:{yOffset:u,scrollAreaComponent:d,getStyles:x,fullScreen:h}},C.createElement(DA,{ref:t,...x("root"),"data-full-screen":h||void 0,"data-centered":m||void 0,unstyled:l,...b}))});Pf.classes=_o;Pf.displayName="@mantine/core/ModalRoot";const d9={},Tf=Q((e,t)=>{const n=U("ModalTitle",d9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Oa();return C.createElement(zE,{ref:t,...u.getStyles("title",{classNames:r,style:i,styles:s,className:o}),...c})});Tf.classes=_o;Tf.displayName="@mantine/core/ModalTitle";const f9={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Nr("modal"),transitionProps:{duration:200,transition:"pop"},withOverlay:!0,withCloseButton:!0},jn=Q((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:i,closeButtonProps:s,children:l,radius:c,...u}=U("Modal",f9,e),d=!!n||i;return C.createElement(Pf,{ref:t,radius:c,...u},r&&C.createElement(jf,{...o}),C.createElement(Cf,{radius:c},d&&C.createElement(Ef,null,n&&C.createElement(Tf,null,n),i&&C.createElement(bf,{...s})),C.createElement(Sf,null,l)))});jn.classes=_o;jn.displayName="@mantine/core/Modal";jn.Root=Pf;jn.Overlay=jf;jn.Content=Cf;jn.Body=Sf;jn.Header=Ef;jn.Title=Tf;jn.CloseButton=bf;const[h9,Jv]=rc(),[p9,m9]=rc();var kf={root:"m-7cda1cd6","root--default":"m-44da308b","root--contrast":"m-e3a01f8",label:"m-1e0e6180",remove:"m-ae386778",group:"m-1dcfd90b"};const g9={},v9=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?Ee(t):Ee(n,"pg-gap")}}),Zv=Q((e,t)=>{const n=U("PillGroup",g9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,disabled:d,...f}=n,h=Jv(),m=(h==null?void 0:h.size)||u||void 0,g=fe({name:"PillGroup",classes:kf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:v9,stylesCtx:{size:m},rootSelector:"group"});return C.createElement(p9,{value:{size:m,disabled:d}},C.createElement(q,{ref:t,size:m,...g("group"),...f}))});Zv.classes=kf;Zv.displayName="@mantine/core/PillGroup";const y9={variant:"default"},x9=(e,{radius:t},{size:n})=>({root:{"--pill-fz":Ee(n,"pill-fz"),"--pill-height":Ee(n,"pill-height"),"--pill-radius":t===void 0?void 0:ft(t)}}),Zi=Q((e,t)=>{const n=U("Pill",y9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,variant:u,children:d,withRemoveButton:f,onRemove:h,removeButtonProps:m,radius:g,size:v,disabled:b,mod:x,...y}=n,w=m9(),S=Jv(),j=v||(w==null?void 0:w.size)||void 0,E=(S==null?void 0:S.variant)==="filled"?"contrast":u||"default",P=fe({name:"Pill",classes:kf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:x9,stylesCtx:{size:j}});return C.createElement(q,{component:"span",ref:t,variant:E,size:j,...P("root",{variant:E}),mod:[{"with-remove":f,disabled:b||(w==null?void 0:w.disabled)},x],...y},C.createElement("span",{...P("label")},d),f&&C.createElement(fs,{variant:"transparent",radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:l,...m,...P("remove",{className:m==null?void 0:m.className,style:m==null?void 0:m.style}),onMouseDown:T=>{var k;T.preventDefault(),T.stopPropagation(),(k=m==null?void 0:m.onMouseDown)==null||k.call(m,T)},onClick:T=>{var k;T.stopPropagation(),h==null||h(),(k=m==null?void 0:m.onClick)==null||k.call(m,T)}}))});Zi.classes=kf;Zi.displayName="@mantine/core/Pill";Zi.Group=Zv;var yj={field:"m-45c4369d"};const w9={type:"visible"},ey=Q((e,t)=>{const n=U("PillsInputField",w9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,type:u,disabled:d,id:f,pointer:h,mod:m,...g}=n,v=Jv(),b=Da(),x=fe({name:"PillsInputField",classes:yj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"field"}),y=d||(v==null?void 0:v.disabled);return C.createElement(q,{component:"input",ref:Yt(t,v==null?void 0:v.fieldRef),"data-type":u,disabled:y,mod:[{disabled:y,pointer:h},m],...x("field"),...g,id:(b==null?void 0:b.inputId)||f,"aria-invalid":v==null?void 0:v.hasError,"aria-describedby":b==null?void 0:b.describedBy,type:"text",onMouseDown:w=>!h&&w.stopPropagation()})});ey.classes=yj;ey.displayName="@mantine/core/PillsInputField";const S9={},xa=Q((e,t)=>{const n=U("PillsInput",S9,e),{children:r,onMouseDown:o,onClick:i,size:s,disabled:l,__staticSelector:c,error:u,variant:d,...f}=n,h=p.useRef();return C.createElement(h9,{value:{fieldRef:h,size:s,disabled:l,hasError:!!u,variant:d}},C.createElement(mr,{size:s,error:u,variant:d,component:"div",ref:t,onMouseDown:m=>{var g;m.preventDefault(),o==null||o(m),(g=h.current)==null||g.focus()},onClick:m=>{var g;m.preventDefault(),i==null||i(m),(g=h.current)==null||g.focus()},...f,multiline:!0,disabled:l,__staticSelector:c||"PillsInput",withAria:!1},r))});xa.displayName="@mantine/core/PillsInput";xa.Field=ey;function b9({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,i)=>(ya(i)?o.push({group:i.group,items:i.items.filter(s=>n.indexOf(s.value.toLowerCase().trim())===-1)}):n.indexOf(i.value.toLowerCase().trim())===-1&&o.push(i),o),[])}const C9={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:","},Rf=Q((e,t)=>{const n=U("MultiSelect",C9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,value:d,defaultValue:f,onChange:h,onKeyDown:m,variant:g,data:v,dropdownOpened:b,defaultDropdownOpened:x,onDropdownOpen:y,onDropdownClose:w,selectFirstOptionOnChange:S,onOptionSubmit:j,comboboxProps:E,filter:P,limit:T,withScrollArea:k,maxDropdownHeight:I,searchValue:O,defaultSearchValue:R,onSearchChange:M,readOnly:N,disabled:B,onFocus:D,onBlur:$,onPaste:_,radius:F,rightSection:H,rightSectionWidth:G,rightSectionPointerEvents:oe,rightSectionProps:be,leftSection:je,leftSectionWidth:Ae,leftSectionPointerEvents:ke,leftSectionProps:Ie,inputContainer:Qe,inputWrapperOrder:qe,withAsterisk:ht,labelProps:X,descriptionProps:Pe,errorProps:Ne,wrapperProps:nt,description:Ge,label:_t,error:Pn,maxValues:Lr,searchable:Xt,nothingFoundMessage:so,withCheckIcon:te,checkIconPosition:Ce,hidePickedOptions:rt,withErrorStyles:et,name:At,form:Fr,id:Xn,clearable:ji,clearButtonProps:Tn,hiddenInputProps:zr,placeholder:vr,hiddenInputValuesDivider:Lo,required:Ua,mod:zc,...Ss}=n,bs=Cn(Xn),Pi=qE(v),Ti=GE(Pi),hn=gf({opened:b,defaultOpened:x,onDropdownOpen:y,onDropdownClose:()=>{w==null||w(),hn.resetSelectedOption()}}),{styleProps:sh,rest:{type:ah,...lh}}=ko(Ss),[A,L]=un({value:d,defaultValue:f,finalValue:[],onChange:h}),[W,Z]=un({value:O,defaultValue:R,finalValue:"",onChange:M}),ue=fe({name:"MultiSelect",classes:{},props:n,classNames:r,styles:s,unstyled:l}),{resolvedClassNames:De,resolvedStyles:we}=Wd({props:n,styles:s,classNames:r}),ye=he=>{m==null||m(he),he.key===" "&&!Xt&&(he.preventDefault(),hn.toggleDropdown()),he.key==="Backspace"&&W.length===0&&A.length>0&&L(A.slice(0,A.length-1))},ge=A.map((he,Ke)=>{var $t,pn;return C.createElement(Zi,{key:`${he}-${Ke}`,withRemoveButton:!N&&!(($t=Ti[he])!=null&&$t.disabled),onRemove:()=>L(A.filter(Lt=>he!==Lt)),unstyled:l,...ue("pill")},((pn=Ti[he])==null?void 0:pn.label)||he)});p.useEffect(()=>{S&&hn.selectFirstOption()},[S,A]);const Oe=ji&&A.length>0&&!B&&!N&&C.createElement(_e.ClearButton,{size:u,...Tn,onClear:()=>{L([]),Z("")}}),Nt=b9({data:Pi,value:A});return C.createElement(C.Fragment,null,C.createElement(_e,{store:hn,classNames:De,styles:we,unstyled:l,size:u,readOnly:N,__staticSelector:"MultiSelect",onOptionSubmit:he=>{j==null||j(he),Z(""),hn.updateSelectedOptionIndex("selected"),A.includes(Ti[he].value)?L(A.filter(Ke=>Ke!==Ti[he].value)):A.length<Lr&&L([...A,Ti[he].value])},...E},C.createElement(_e.DropdownTarget,null,C.createElement(xa,{...sh,__staticSelector:"MultiSelect",classNames:De,styles:we,unstyled:l,size:u,className:o,style:i,variant:g,disabled:B,radius:F,rightSection:H||Oe||C.createElement(_e.Chevron,{size:u,error:Pn,unstyled:l}),rightSectionPointerEvents:oe||(Oe?"all":"none"),rightSectionWidth:G,rightSectionProps:be,leftSection:je,leftSectionWidth:Ae,leftSectionPointerEvents:ke,leftSectionProps:Ie,inputContainer:Qe,inputWrapperOrder:qe,withAsterisk:ht,labelProps:X,descriptionProps:Pe,errorProps:Ne,wrapperProps:nt,description:Ge,label:_t,error:Pn,multiline:!0,withErrorStyles:et,__stylesApiProps:{...n,rightSectionPointerEvents:oe||(Oe?"all":"none"),multiline:!0},pointer:!Xt,onClick:()=>Xt?hn.openDropdown():hn.toggleDropdown(),"data-expanded":hn.dropdownOpened||void 0,id:bs,required:Ua,mod:zc},C.createElement(Zi.Group,{disabled:B,unstyled:l,...ue("pillsList")},ge,C.createElement(_e.EventsTarget,null,C.createElement(xa.Field,{...lh,ref:t,id:bs,placeholder:vr,type:!Xt&&!vr?"hidden":"visible",...ue("inputField"),unstyled:l,onFocus:he=>{D==null||D(he),Xt&&hn.openDropdown()},onBlur:he=>{$==null||$(he),hn.closeDropdown(),Z("")},onKeyDown:ye,value:W,onChange:he=>{Z(he.currentTarget.value),Xt&&hn.openDropdown(),S&&hn.selectFirstOption()},disabled:B,readOnly:N||!Xt,pointer:!Xt}))))),C.createElement(Q3,{data:rt?Nt:Pi,hidden:N||B,filter:P,search:W,limit:T,hiddenWhenEmpty:!Xt||!so||rt&&Nt.length===0&&W.trim().length===0,withScrollArea:k,maxDropdownHeight:I,filterOptions:Xt,value:A,checkIconPosition:Ce,withCheckIcon:te,nothingFoundMessage:so,unstyled:l,labelId:`${bs}-label`})),C.createElement("input",{type:"hidden",name:At,value:A.join(Lo),form:Fr,disabled:B,...zr}))});Rf.classes={...mr.classes,..._e.classes};Rf.displayName="@mantine/core/MultiSelect";function E9(e){return"group"in e}function ty({data:e}){if(E9(e)){const o=e.items.map(i=>C.createElement(ty,{key:i.value,data:i}));return C.createElement("optgroup",{label:e.group},o)}const{value:t,label:n,...r}=e;return C.createElement("option",{key:e.value,value:e.value,...r},e.label)}ty.displayName="@mantine/core/NativeSelectOption";const j9={rightSectionPointerEvents:"none"},xt=Q((e,t)=>{const{data:n,children:r,size:o,error:i,rightSection:s,unstyled:l,...c}=U("NativeSelect",j9,e),u=qE(n).map((d,f)=>C.createElement(ty,{key:f,data:d}));return C.createElement(mr,{component:"select",ref:t,...c,__staticSelector:"NativeSelect",size:o,pointer:!0,error:i,unstyled:l,rightSection:s||C.createElement(mf,{size:o,error:i,unstyled:l})},r||u)});xt.classes=mr.classes;xt.displayName="@mantine/core/NativeSelect";var xj={root:"m-a513464",icon:"m-a4ceffb",loader:"m-b0920b15",body:"m-a49ed24",title:"m-3feedf16",description:"m-3d733a3a",closeButton:"m-919a4d88"};const P9={withCloseButton:!0},T9=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:ft(t),"--notification-color":n?yt(n,e):void 0}}),ny=Q((e,t)=>{const n=U("Notification",P9,e),{className:r,color:o,radius:i,loading:s,withCloseButton:l,withBorder:c,title:u,icon:d,children:f,onClose:h,closeButtonProps:m,classNames:g,style:v,styles:b,unstyled:x,variant:y,vars:w,mod:S,...j}=n,E=fe({name:"Notification",classes:xj,props:n,className:r,style:v,classNames:g,styles:b,unstyled:x,vars:w,varsResolver:T9});return C.createElement(q,{...E("root"),mod:[{"data-with-icon":!!d||s,"data-with-border":c},S],ref:t,variant:y,...j,role:"alert"},d&&!s&&C.createElement("div",{...E("icon")},d),s&&C.createElement($n,{size:28,color:o,...E("loader")}),C.createElement("div",{...E("body")},u&&C.createElement("div",{...E("title")},u),C.createElement(q,{...E("description"),mod:{"data-with-title":!!u}},f)),l&&C.createElement(fs,{iconSize:16,color:"gray",...m,unstyled:x,onClick:h,...E("closeButton")}))});ny.classes=xj;ny.displayName="@mantine/core/Notification";const[k9,If]=bn("Pagination.Root component was not found in tree");var vc={root:"m-4addd315",control:"m-326d024a",dots:"m-4ad7767d"};const R9={withPadding:!0},yc=Q((e,t)=>{const n=U("PaginationControl",R9,e),{classNames:r,className:o,style:i,styles:s,vars:l,active:c,disabled:u,withPadding:d,mod:f,...h}=n,m=If(),g=u||m.disabled;return C.createElement(lr,{ref:t,disabled:g,mod:[{active:c,disabled:g,"with-padding":d},f],...m.getStyles("control",{className:o,style:i,classNames:r,styles:s,active:!g}),...h})});yc.classes=vc;yc.displayName="@mantine/core/PaginationControl";function xc({style:e,children:t,path:n,...r}){return C.createElement("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},C.createElement("path",{d:n,fill:"currentColor"}))}const I9=e=>C.createElement(xc,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),D9=e=>C.createElement(xc,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),_9=e=>C.createElement(xc,{...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"}),A9=e=>C.createElement(xc,{...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"}),N9=e=>C.createElement(xc,{...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"}),O9={icon:N9},Df=Q((e,t)=>{const n=U("PaginationDots",O9,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,...u}=n,d=If(),f=c;return C.createElement(q,{ref:t,...d.getStyles("dots",{className:o,style:i,styles:s,classNames:r}),...u},C.createElement(f,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}}))});Df.classes=vc;Df.displayName="@mantine/core/PaginationDots";function _f({icon:e,name:t,action:n,type:r}){const o={icon:e},i=p.forwardRef((s,l)=>{const{icon:c,...u}=U(t,o,s),d=c,f=If(),h=r==="next"?f.active===f.total:f.active===1;return C.createElement(yc,{disabled:f.disabled||h,ref:l,onClick:f[n],withPadding:!1,...u},C.createElement(d,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}}))});return i.displayName=`@mantine/core/${t}`,i}const wj=_f({icon:I9,name:"PaginationNext",action:"onNext",type:"next"}),Sj=_f({icon:D9,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),bj=_f({icon:_9,name:"PaginationFirst",action:"onFirst",type:"previous"}),Cj=_f({icon:A9,name:"PaginationLast",action:"onLast",type:"next"});function ry({dotsIcon:e}){const t=If(),n=t.range.map((r,o)=>{var i;return r==="dots"?C.createElement(Df,{icon:e,key:o}):C.createElement(yc,{key:o,active:r===t.active,"aria-current":r===t.active?"page":void 0,onClick:()=>t.onChange(r),disabled:t.disabled,...(i=t.getItemProps)==null?void 0:i.call(t,r)},r)});return C.createElement(C.Fragment,null,n)}ry.displayName="@mantine/core/PaginationItems";const M9={siblings:1,boundaries:1},$9=(e,{size:t,radius:n,color:r,autoContrast:o})=>({root:{"--pagination-control-radius":n===void 0?void 0:ft(n),"--pagination-control-size":Ee(t,"pagination-control-size"),"--pagination-control-fz":qt(t),"--pagination-active-bg":r?yt(r,e):void 0,"--pagination-active-color":oc(o,e)?is({color:r,theme:e}):void 0}}),Af=Q((e,t)=>{const n=U("PaginationRoot",M9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,total:u,value:d,defaultValue:f,onChange:h,disabled:m,siblings:g,boundaries:v,color:b,radius:x,onNextPage:y,onPreviousPage:w,onFirstPage:S,onLastPage:j,getItemProps:E,autoContrast:P,...T}=n,k=fe({name:"Pagination",classes:vc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:$9}),{range:I,setPage:O,next:R,previous:M,active:N,first:B,last:D}=pR({page:d,initialPage:f,onChange:h,total:u,siblings:g,boundaries:v}),$=Un(y,R),_=Un(w,M),F=Un(S,B),H=Un(j,D);return C.createElement(k9,{value:{total:u,range:I,active:N,disabled:m,getItemProps:E,onChange:O,onNext:$,onPrevious:_,onFirst:F,onLast:H,getStyles:k}},C.createElement(q,{ref:t,...k("root"),...T}))});Af.classes=vc;Af.displayName="@mantine/core/PaginationRoot";const L9={withControls:!0,siblings:1,boundaries:1,gap:8},Mr=Q((e,t)=>{const n=U("Pagination",L9,e),{withEdges:r,withControls:o,getControlProps:i,nextIcon:s,previousIcon:l,lastIcon:c,firstIcon:u,dotsIcon:d,total:f,gap:h,...m}=n;return f<=0?null:C.createElement(Af,{ref:t,total:f,...m},C.createElement(Y,{gap:h},r&&C.createElement(bj,{icon:u,...i==null?void 0:i("first")}),o&&C.createElement(Sj,{icon:l,...i==null?void 0:i("previous")}),C.createElement(ry,{dotsIcon:d}),o&&C.createElement(wj,{icon:s,...i==null?void 0:i("next")}),r&&C.createElement(Cj,{icon:c,...i==null?void 0:i("last")})))});Mr.classes=vc;Mr.displayName="@mantine/core/Pagination";Mr.Root=Af;Mr.Control=yc;Mr.Dots=Df;Mr.First=bj;Mr.Last=Cj;Mr.Next=wj;Mr.Previous=Sj;Mr.Items=ry;const F9=({reveal:e})=>C.createElement("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)"}},C.createElement("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"}));var vm={root:"m-f61ca620",input:"m-ccf8da4c",innerInput:"m-f2d85dd2",visibilityToggle:"m-b1072d44"};const z9={visibilityToggleIcon:F9},B9=(e,{size:t})=>({root:{"--psi-icon-size":Ee(t,"psi-icon-size"),"--psi-button-size":Ee(t,"psi-button-size")}}),Rr=Q((e,t)=>{const n=U("PasswordInput",z9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,required:u,error:d,leftSection:f,disabled:h,id:m,variant:g,inputContainer:v,description:b,label:x,size:y,errorProps:w,descriptionProps:S,labelProps:j,withAsterisk:E,inputWrapperOrder:P,wrapperProps:T,radius:k,rightSection:I,rightSectionWidth:O,rightSectionPointerEvents:R,leftSectionWidth:M,visible:N,defaultVisible:B,onVisibilityChange:D,visibilityToggleIcon:$,visibilityToggleButtonProps:_,rightSectionProps:F,leftSectionProps:H,leftSectionPointerEvents:G,mod:oe,...be}=n,je=Cn(m),[Ae,ke]=un({value:N,defaultValue:B,finalValue:!1,onChange:D}),Ie=()=>ke(!Ae),Qe=fe({name:"PasswordInput",classes:vm,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:B9}),{resolvedClassNames:qe,resolvedStyles:ht}=Wd({classNames:r,styles:s,props:n}),{styleProps:X,rest:Pe}=ko(be),Ne=$,nt=C.createElement(Qt,{...Qe("visibilityToggle"),disabled:h,radius:k,"aria-hidden":!_,tabIndex:-1,..._,variant:"subtle",color:"gray",unstyled:l,onMouseDown:Ge=>{var _t;Ge.preventDefault(),(_t=_==null?void 0:_.onMouseDown)==null||_t.call(_,Ge),Ie()},onKeyDown:Ge=>{var _t;(_t=_==null?void 0:_.onKeyDown)==null||_t.call(_,Ge),Ge.key===" "&&(Ge.preventDefault(),Ie())}},C.createElement(Ne,{reveal:Ae}));return C.createElement(dt.Wrapper,{required:u,id:je,label:x,error:d,description:b,size:y,classNames:qe,styles:ht,__staticSelector:"PasswordInput",errorProps:w,descriptionProps:S,unstyled:l,withAsterisk:E,inputWrapperOrder:P,inputContainer:v,variant:g,labelProps:{...j,htmlFor:je},mod:oe,...Qe("root"),...X,...T},C.createElement(dt,{component:"div",error:d,leftSection:f,size:y,classNames:{...qe,input:Ze(vm.input,qe.input)},styles:ht,radius:k,disabled:h,__staticSelector:"PasswordInput",rightSectionWidth:O,rightSection:I??nt,variant:g,unstyled:l,leftSectionWidth:M,rightSectionPointerEvents:R||"all",rightSectionProps:F,leftSectionProps:H,leftSectionPointerEvents:G,withAria:!1},C.createElement("input",{required:u,"data-invalid":!!d||void 0,"data-with-left-section":!!f||void 0,...Qe("innerInput"),disabled:h,id:je,ref:t,...Pe,autoComplete:Pe.autoComplete||"off",type:Ae?"text":"password"})))});Rr.classes={...mr.classes,...vm};Rr.displayName="@mantine/core/PasswordInput";const[U9,V9]=rc(),W9={},oy=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,name:c,readOnly:u,...d}=U("RadioGroup",W9,e),f=Cn(c),[h,m]=un({value:n,defaultValue:r,finalValue:"",onChange:o}),g=v=>!u&&m(v.currentTarget.value);return C.createElement(U9,{value:{value:h,onChange:g,size:i,name:f}},C.createElement(dt.Wrapper,{size:i,ref:t,...s,...d,labelElement:"div",__staticSelector:"RadioGroup"},C.createElement(Mv,{role:"radiogroup"},l)))});oy.classes=dt.Wrapper.classes;oy.displayName="@mantine/core/RadioGroup";function H9({size:e,style:t,...n}){return C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:z(e),height:z(e),...t},"aria-hidden":!0,...n},C.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"}))}var Ej={root:"m-f3f1af94",inner:"m-89c4f5e4",icon:"m-f3ed6b2b",radio:"m-8a3dbb89","radio--outline":"m-1bfe9d39"};const q9={labelPosition:"right"},G9=(e,{size:t,radius:n,color:r,iconColor:o,variant:i,autoContrast:s})=>{const l=to({color:r||e.primaryColor,theme:e}),c=l.isThemeColor&&l.shade===void 0?`var(--mantine-color-${l.color}-outline)`:l.color;return{root:{"--radio-size":Ee(t,"radio-size"),"--radio-radius":n===void 0?void 0:ft(n),"--radio-color":i==="outline"?c:yt(r,e),"--radio-icon-color":o?yt(o,e):oc(s,e)?is({color:r,theme:e}):void 0,"--radio-icon-size":Ee(t,"radio-icon-size")}}},ql=Q((e,t)=>{const n=U("Radio",q9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,id:u,size:d,label:f,labelPosition:h,description:m,error:g,radius:v,color:b,variant:x,disabled:y,wrapperProps:w,icon:S=H9,rootRef:j,iconColor:E,onChange:P,mod:T,...k}=n,I=fe({name:"Radio",classes:Ej,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:G9}),O=V9(),R=(O==null?void 0:O.size)??d,M=n.size?d:R,{styleProps:N,rest:B}=ko(k),D=Cn(u),$=O?{checked:O.value===B.value,name:B.name??O.name,onChange:_=>{O.onChange(_),P==null||P(_)}}:{};return C.createElement(vf,{...I("root"),__staticSelector:"Radio",__stylesApiProps:n,id:D,size:M,labelPosition:h,label:f,description:m,error:g,disabled:y,classNames:r,styles:s,unstyled:l,"data-checked":$.checked||void 0,variant:x,ref:j,mod:T,...N,...w},C.createElement(q,{...I("inner"),mod:{"label-position":h}},C.createElement(q,{...I("radio",{focusable:!0,variant:x}),onChange:P,...B,...$,component:"input",mod:{error:!!g},ref:t,id:D,disabled:y,type:"radio"}),C.createElement(S,{...I("icon"),"aria-hidden":!0})))});ql.classes=Ej;ql.displayName="@mantine/core/Radio";ql.Group=oy;const Q9={duration:100,transition:"fade"};function K9(e,t){return{...Q9,...t,...e}}function Y9({offset:e,position:t}){const[n,r]=p.useState(!1),o=p.useRef(),{x:i,y:s,elements:l,refs:c,update:u,placement:d}=pv({placement:t,middleware:[fv({crossAxis:!0,padding:5,rootBoundary:"document"})]}),f=d.includes("right")?e:t.includes("left")?e*-1:0,h=d.includes("bottom")?e:t.includes("top")?e*-1:0,m=p.useCallback(({clientX:g,clientY:v})=>{c.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:g,y:v,left:g+f,top:v+h,right:g,bottom:v}}})},[l.reference]);return p.useEffect(()=>{if(c.floating.current){const g=o.current;g.addEventListener("mousemove",m);const v=po(c.floating.current);return v.forEach(b=>{b.addEventListener("scroll",u)}),()=>{g.removeEventListener("mousemove",m),v.forEach(b=>{b.removeEventListener("scroll",u)})}}},[l.reference,c.floating.current,u,m,n]),{handleMouseMove:m,x:i,y:s,opened:n,setOpened:r,boundaryRef:o,floating:c.setFloating}}var Nf={tooltip:"m-1b3c8819",arrow:"m-f898399f"};const X9={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:Nr("popover")},J9=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:ft(t),"--tooltip-bg":n?yt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),iy=Q((e,t)=>{const n=U("TooltipFloating",X9,e),{children:r,refProp:o,withinPortal:i,style:s,className:l,classNames:c,styles:u,unstyled:d,radius:f,color:h,label:m,offset:g,position:v,multiline:b,zIndex:x,disabled:y,variant:w,vars:S,portalProps:j,...E}=n,P=Pt(),T=fe({name:"TooltipFloating",props:n,classes:Nf,className:l,style:s,classNames:c,styles:u,unstyled:d,rootSelector:"tooltip",vars:S,varsResolver:J9}),{handleMouseMove:k,x:I,y:O,opened:R,boundaryRef:M,floating:N,setOpened:B}=Y9({offset:g,position:v});if(!To(r))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 D=Yt(M,r.ref,t),$=F=>{var H,G;(G=(H=r.props).onMouseEnter)==null||G.call(H,F),k(F),B(!0)},_=F=>{var H,G;(G=(H=r.props).onMouseLeave)==null||G.call(H,F),B(!1)};return C.createElement(C.Fragment,null,C.createElement(us,{...j,withinPortal:i},C.createElement(q,{...E,...T("tooltip",{style:{...FS(s,P),zIndex:x,display:!y&&R?"block":"none",top:(O&&Math.round(O))??"",left:(I&&Math.round(I))??""}}),variant:w,ref:N,mod:{multiline:b}},m)),p.cloneElement(r,{...r.props,[o]:D,onMouseEnter:$,onMouseLeave:_}))});iy.classes=Nf;iy.displayName="@mantine/core/TooltipFloating";const jj=p.createContext(!1),Z9=jj.Provider,e5=()=>p.useContext(jj),t5={openDelay:0,closeDelay:0};function Pj(e){const{openDelay:t,closeDelay:n,children:r}=U("TooltipGroup",t5,e);return C.createElement(Z9,{value:!0},C.createElement(B4,{delay:{open:t,close:n}},r))}Pj.displayName="@mantine/core/TooltipGroup";function n5(e){var E,P,T;const[t,n]=p.useState(!1),o=typeof e.opened=="boolean"?e.opened:t,i=e5(),s=Cn(),{delay:l,currentId:c,setCurrentId:u}=EE(),d=p.useCallback(k=>{n(k),k&&u(s)},[u,s]),{x:f,y:h,context:m,refs:g,update:v,placement:b,middlewareData:{arrow:{x,y}={}}}=pv({placement:e.position,open:o,onOpenChange:d,middleware:[iE(e.offset),fv({padding:8}),pE(),gE({element:e.arrowRef,padding:e.arrowOffset}),...e.inline?[mE()]:[]]}),{getReferenceProps:w,getFloatingProps:S}=J4([z4(m,{enabled:(E=e.events)==null?void 0:E.hover,delay:i?l:{open:e.openDelay,close:e.closeDelay},mouseOnly:!((P=e.events)!=null&&P.touch)}),X4(m,{enabled:(T=e.events)==null?void 0:T.focus,keyboardOnly:!0}),Z4(m,{role:"tooltip"}),Y4(m,{enabled:typeof e.opened>"u"}),U4(m,{id:s})]);IE({opened:o,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:g,update:v}}),go(()=>{var k;(k=e.onPositionChange)==null||k.call(e,b)},[b]);const j=o&&c&&c!==s;return{x:f,y:h,arrowX:x,arrowY:y,reference:g.setReference,floating:g.setFloating,getFloatingProps:S,getReferenceProps:w,isGroupPhase:j,opened:o,placement:b}}const S1={position:"top",refProp:"ref",withinPortal:!0,inline:!1,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:Nr("popover"),positionDependencies:[]},r5=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:ft(t),"--tooltip-bg":n?yt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),Ma=Q((e,t)=>{const n=U("Tooltip",S1,e),{children:r,position:o,refProp:i,label:s,openDelay:l,closeDelay:c,onPositionChange:u,opened:d,withinPortal:f,radius:h,color:m,classNames:g,styles:v,unstyled:b,style:x,className:y,withArrow:w,arrowSize:S,arrowOffset:j,arrowRadius:E,arrowPosition:P,offset:T,transitionProps:k,multiline:I,events:O,zIndex:R,disabled:M,positionDependencies:N,onClick:B,onMouseEnter:D,onMouseLeave:$,inline:_,variant:F,keepMounted:H,vars:G,portalProps:oe,mod:be,...je}=U("Tooltip",S1,n),{dir:Ae}=ss(),ke=p.useRef(null),Ie=n5({position:jE(Ae,o),closeDelay:c,openDelay:l,onPositionChange:u,opened:d,events:O,arrowRef:ke,arrowOffset:j,offset:typeof T=="number"?T+(w?S/2:0):T,positionDependencies:[...N,r],inline:_}),Qe=fe({name:"Tooltip",props:n,classes:Nf,className:y,style:x,classNames:g,styles:v,unstyled:b,rootSelector:"tooltip",vars:G,varsResolver:r5});if(!To(r))throw new Error("[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const qe=Yt(Ie.reference,r.ref,t),ht=K9(k,{duration:100,transition:"fade"});return C.createElement(C.Fragment,null,C.createElement(us,{...oe,withinPortal:f},C.createElement(ds,{...ht,keepMounted:H,mounted:!M&&!!Ie.opened,duration:Ie.isGroupPhase?10:ht.duration},X=>C.createElement(q,{...je,variant:F,mod:[{multiline:I},be],...Ie.getFloatingProps({ref:Ie.floating,className:Qe("tooltip").className,style:{...Qe("tooltip").style,...X,zIndex:R,top:Ie.y??0,left:Ie.x??0}})},s,C.createElement(mv,{ref:ke,arrowX:Ie.arrowX,arrowY:Ie.arrowY,visible:w,position:Ie.placement,arrowSize:S,arrowOffset:j,arrowRadius:E,arrowPosition:P,...Qe("arrow")})))),p.cloneElement(r,Ie.getReferenceProps({onClick:B,onMouseEnter:D,onMouseLeave:$,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,[i]:qe,className:Ze(y,r.props.className),...r.props})))});Ma.classes=Nf;Ma.displayName="@mantine/core/Tooltip";Ma.Floating=iy;Ma.Group=Pj;function o5({size:e,thickness:t,sum:n,value:r,root:o,offset:i}){const s=(e*.9-t*2)/2,l=Math.PI*s*2/100,c=o||r===void 0?`${(100-n)*l}, ${n*l}`:`${r*l}, ${(100-r)*l}`;return{strokeWidth:Number.isNaN(t)?12:t,cx:e/2||0,cy:e/2||0,r:s||0,transform:o?`scale(1, -1) translate(0, -${e})`:void 0,strokeDasharray:c,strokeDashoffset:o?0:i||0}}function Tj({size:e,value:t,offset:n,sum:r,thickness:o,root:i,color:s,lineRoundCaps:l,tooltip:c,getStyles:u,display:d,...f}){const h=Pt();return C.createElement(Ma.Floating,{disabled:!c,label:c},C.createElement(q,{component:"circle",...f,...u("curve"),__vars:{"--curve-color":s?yt(s,h):void 0},fill:"none",strokeLinecap:l?"round":"butt",...o5({sum:r,size:e,thickness:o,value:t,offset:n,root:i})}))}Tj.displayName="@mantine/core/Curve";function i5({size:e,thickness:t,sections:n,renderRoundedLineCaps:r,rootColor:o}){const i=n.reduce((d,f)=>d+f.value,0),s=Math.PI*((e*.9-t*2)/2)*2;let l=s;const c=[],u=[];for(let d=0;d<n.length;d+=1)c.push({sum:i,offset:l,data:n[d],root:!1}),l-=n[d].value/100*s;if(c.push({sum:i,offset:l,data:{color:o},root:!0}),u.push({...c[c.length-1],lineRoundCaps:!1}),c.length>2){u.push({...c[0],lineRoundCaps:r}),u.push({...c[c.length-2],lineRoundCaps:r});for(let d=1;d<=c.length-3;d+=1)u.push({...c[d],lineRoundCaps:!1})}else u.push({...c[0],lineRoundCaps:r});return u}var kj={root:"m-b32e4812",svg:"m-d43b5134",curve:"m-b1ca1fbf",label:"m-b23f9dc4"};function s5(e,t){return Math.min(e||12,(t||120)/4)}const a5={size:120,thickness:12},l5=(e,{size:t,thickness:n})=>({root:{"--rp-size":z(t),"--rp-label-offset":z(n*2)}}),Of=Q((e,t)=>{const n=U("RingProgress",a5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,label:u,sections:d,size:f,thickness:h,roundCaps:m,rootColor:g,...v}=n,b=fe({name:"RingProgress",classes:kj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:l5}),x=s5(h,f),y=i5({size:f,thickness:x,sections:d,renderRoundedLineCaps:m,rootColor:g}).map(({data:w,sum:S,root:j,lineRoundCaps:E,offset:P},T)=>C.createElement(Tj,{...w,key:T,size:f,thickness:x,sum:S,offset:P,color:w==null?void 0:w.color,root:j,lineRoundCaps:E,getStyles:b}));return C.createElement(q,{...b("root"),size:f,ref:t,...v},C.createElement("svg",{...b("svg")},y),u&&C.createElement("div",{...b("label")},u))});Of.classes=kj;Of.displayName="@mantine/core/RingProgress";function hu(e,t){const n=parseFloat(e.replace("px",""));return Number.isNaN(n)?t:n}function c5(e,t){const n=window.getComputedStyle(e);return{top:hu(n.getPropertyValue("padding-top"),t),right:hu(n.getPropertyValue("padding-right"),t),bottom:hu(n.getPropertyValue("padding-bottom"),t),left:hu(n.getPropertyValue("padding-left"),t)}}var Rj={root:"m-cf365364",indicator:"m-9e182ccd",label:"m-1738fcb2",input:"m-1714d588",control:"m-69686b9b"};const u5=4,d5={withItemsBorders:!0},f5=(e,{radius:t,color:n,transitionDuration:r,size:o,transitionTimingFunction:i})=>({root:{"--sc-radius":t===void 0?void 0:ft(t),"--sc-color":n?yt(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":i,"--sc-padding":Ee(o,"sc-padding"),"--sc-font-size":qt(o)}}),sy=Q((e,t)=>{var qe,ht;const n=U("SegmentedControl",d5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,data:u,value:d,defaultValue:f,onChange:h,size:m,name:g,disabled:v,readOnly:b,fullWidth:x,orientation:y,radius:w,color:S,transitionDuration:j,transitionTimingFunction:E,variant:P,autoContrast:T,withItemsBorders:k,mod:I,...O}=n,R=fe({name:"SegmentedControl",props:n,classes:Rj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:f5}),{dir:M}=ss(),N=Pt(),B=u.map(X=>typeof X=="string"?{label:X,value:X}:X),[D,$]=un({value:d,defaultValue:f,finalValue:Array.isArray(u)?((qe=B.find(X=>!X.disabled))==null?void 0:qe.value)??((ht=u[0])==null?void 0:ht.value)??null:null,onChange:h}),[_,F]=p.useState({width:0,height:0,translate:[0,0]}),H=Cn(g),G=p.useRef({}),oe=p.useRef(null),[be,je]=p.useState(!1),[Ae,ke]=gR();p.useEffect(()=>{if(D in G.current&&Ae.current){const X=G.current[D];if(X){const Pe=c5(oe.current,u5),Ne=X.getBoundingClientRect(),nt=X.offsetWidth/Ne.width,Ge=X.clientWidth*nt||0,_t=X.clientHeight*nt||0,Pn=ke.width-X.parentElement.offsetLeft+(M==="rtl"?Pe.left:Pe.right)-Ge,Lr=X.parentElement.offsetLeft-(M==="rtl"?Pe.right:Pe.left);F({width:Ge,height:_t,translate:[M==="rtl"?Pn*-1:Lr,X.parentElement.offsetTop-Pe.top]})}else F({width:0,height:0,translate:[0,0]})}},[D,ke,M]),yR(()=>{DS()!=="test"&&je(!0)},20,{autoInvoke:!0});const Ie=B.map(X=>C.createElement(q,{...R("control"),mod:{active:D===X.value,orientation:y},key:X.value},C.createElement("input",{...R("input"),disabled:v||X.disabled,type:"radio",name:H,value:X.value,id:`${H}-${X.value}`,checked:D===X.value,onChange:()=>!b&&$(X.value),"data-focus-ring":N.focusRing}),C.createElement(q,{component:"label",...R("label"),mod:{active:D===X.value&&!(v||X.disabled),disabled:v||X.disabled,"read-only":b},htmlFor:`${H}-${X.value}`,ref:Pe=>{G.current[X.value]=Pe},__vars:{"--sc-label-color":S!==void 0?is({color:S,theme:N}):void 0}},X.label))),Qe=Yt(Ae,oe,t);return u.length===0?null:C.createElement(q,{...R("root"),variant:P,size:m,ref:Qe,mod:[{"full-width":x,orientation:y,initialization:!be,"with-items-borders":k},I],...O,role:"radiogroup"},typeof D=="string"&&C.createElement(q,{component:"span",...R("indicator"),__vars:{"--sc-indicator-width":`${_.width}px`,"--sc-indicator-height":`${_.height}px`,"--sc-indicator-transform":`translate(${_.translate[0]}px, ${_.translate[1]}px)`}}),Ie)});sy.classes=Rj;sy.displayName="@mantine/core/SegmentedControl";function h5({spacing:e,verticalSpacing:t,cols:n,selector:r}){var d;const o=Pt(),i=t===void 0?e:t,s=os({"--sg-spacing-x":en(Yo(e)),"--sg-spacing-y":en(Yo(i)),"--sg-cols":(d=Yo(n))==null?void 0:d.toString()}),l=ct(o.breakpoints).reduce((f,h)=>(f[h]||(f[h]={}),typeof e=="object"&&e[h]!==void 0&&(f[h]["--sg-spacing-x"]=en(e[h])),typeof i=="object"&&i[h]!==void 0&&(f[h]["--sg-spacing-y"]=en(i[h])),typeof n=="object"&&n[h]!==void 0&&(f[h]["--sg-cols"]=n[h]),f),{}),u=Pl(ct(l),o).filter(f=>ct(l[f.value]).length>0).map(f=>({query:`(min-width: ${o.breakpoints[f.value]})`,styles:l[f.value]}));return C.createElement(Ta,{styles:s,media:u,selector:r})}var Ij={root:"m-2415a157"};const p5={cols:1,spacing:"md"},ay=Q((e,t)=>{const n=U("SimpleGrid",p5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,cols:u,verticalSpacing:d,spacing:f,...h}=n,m=fe({name:"SimpleGrid",classes:Ij,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),g=ic();return C.createElement(C.Fragment,null,C.createElement(h5,{...n,selector:`.${g}`}),C.createElement(q,{ref:t,...m("root",{className:g}),...h}))});ay.classes=Ij;ay.displayName="@mantine/core/SimpleGrid";const m5={},Mf=Q((e,t)=>{const{w:n,h:r,miw:o,mih:i,...s}=U("Space",m5,e);return C.createElement(q,{ref:t,...s,w:n,miw:o??n,h:r,mih:i??r})});Mf.displayName="@mantine/core/Space";var Dj={root:"m-6d731127"};const g5={gap:"md",align:"stretch",justify:"flex-start"},v5=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":en(t),"--stack-align":n,"--stack-justify":r}}),Se=Q((e,t)=>{const n=U("Stack",g5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,align:u,justify:d,gap:f,variant:h,...m}=n,g=fe({name:"Stack",props:n,classes:Dj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:v5});return C.createElement(q,{ref:t,...g("root"),variant:h,...m})});Se.classes=Dj;Se.displayName="@mantine/core/Stack";const[y5,x5]=bn("Stepper component was not found in tree"),wd=()=>null;wd.displayName="@mantine/core/StepperCompleted";var ly={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 pu=(e,t)=>typeof e=="function"?C.createElement(e,{step:t||0}):e,w5={withIcon:!0,allowStepClick:!0,iconPosition:"left"},cy=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,step:l,state:c,color:u,icon:d,completedIcon:f,progressIcon:h,label:m,description:g,withIcon:v,iconSize:b,loading:x,allowStepClick:y,allowStepSelect:w,iconPosition:S,orientation:j,mod:E,...P}=U("StepperStep",w5,e),T=x5(),k=Pt(),I={classNames:n,styles:i},O=c==="stepCompleted"?null:c==="stepProgress"?h:d,R={"data-progress":c==="stepProgress"||void 0,"data-completed":c==="stepCompleted"||void 0};return C.createElement(lr,{...T.getStyles("step",{className:r,style:o,variant:T.orientation,...I}),mod:[{"icon-position":S||T.iconPosition,"allow-click":y},E],ref:t,...R,...P,__vars:{"--step-color":u?yt(u,k):void 0},tabIndex:y?0:-1},v&&C.createElement("span",{...T.getStyles("stepWrapper",I)},C.createElement("span",{...T.getStyles("stepIcon",I),...R},C.createElement(ds,{mounted:c==="stepCompleted",transition:"pop",duration:200},M=>C.createElement("span",{...T.getStyles("stepCompletedIcon",{style:M,...I})},x?C.createElement($n,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...T.getStyles("stepLoader",I)}):pu(f,l)||C.createElement(yf,{size:"60%"}))),c!=="stepCompleted"?x?C.createElement($n,{...T.getStyles("stepLoader",I),size:"calc(var(--stepper-icon-size) / 2)",color:u}):pu(O||d,l):null),j==="vertical"&&C.createElement("span",{...T.getStyles("verticalSeparator",I),"data-active":c==="stepCompleted"||void 0})),(m||g)&&C.createElement("span",{...T.getStyles("stepBody",I),"data-orientation":T.orientation,"data-icon-position":S||T.iconPosition},m&&C.createElement("span",{...T.getStyles("stepLabel",I)},pu(m,l)),g&&C.createElement("span",{...T.getStyles("stepDescription",I)},pu(g,l))))});cy.classes=ly;cy.displayName="@mantine/core/StepperStep";const S5={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},b5=(e,{color:t,iconSize:n,size:r,contentPadding:o,radius:i,autoContrast:s})=>({root:{"--stepper-color":t?yt(t,e):void 0,"--stepper-icon-color":oc(s,e)?is({color:t,theme:e}):void 0,"--stepper-icon-size":n===void 0?Ee(r,"stepper-icon-size"):z(n),"--stepper-content-padding":en(o),"--stepper-radius":i===void 0?void 0:ft(i),"--stepper-fz":qt(r),"--stepper-spacing":en(r)}}),wa=Q((e,t)=>{var $,_,F;const n=U("Stepper",S5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,onStepClick:d,active:f,icon:h,completedIcon:m,progressIcon:g,color:v,iconSize:b,contentPadding:x,orientation:y,iconPosition:w,size:S,radius:j,allowNextStepsSelect:E,wrap:P,...T}=n,k=fe({name:"Stepper",classes:ly,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:b5}),I=p.Children.toArray(u),O=I.filter(H=>H.type!==wd),R=I.find(H=>H.type===wd),M=O.reduce((H,G,oe)=>{const be=f===oe?"stepProgress":f>oe?"stepCompleted":"stepInactive",Ae=typeof d!="function"?!1:typeof G.props.allowStepSelect=="boolean"?G.props.allowStepSelect:be==="stepCompleted"||E;return H.push(p.cloneElement(G,{icon:G.props.icon||h||oe+1,key:oe,step:oe,state:be,onClick:()=>Ae&&(d==null?void 0:d(oe)),allowStepClick:Ae,completedIcon:G.props.completedIcon||m,progressIcon:G.props.progressIcon||g,color:G.props.color||v,iconSize:b,radius:j,iconPosition:G.props.iconPosition||w,orientation:y,unstyled:l})),y==="horizontal"&&oe!==O.length-1&&H.push(C.createElement("div",{...k("separator"),"data-active":oe<f||void 0,"data-orientation":y,key:`separator-${oe}`})),H},[]),N=(_=($=O[f])==null?void 0:$.props)==null?void 0:_.children,B=(F=R==null?void 0:R.props)==null?void 0:F.children,D=f>O.length-1?B:N;return C.createElement(y5,{value:{getStyles:k,orientation:y,iconPosition:w}},C.createElement(q,{...k("root"),ref:t,size:S,...T},C.createElement(q,{...k("steps"),mod:{orientation:y,"icon-position":w,wrap:P&&y!=="vertical"}},M),D&&C.createElement("div",{...k("content")},D)))});wa.classes=ly;wa.displayName="@mantine/core/Stepper";wa.Completed=wd;wa.Step=cy;const _j=p.createContext(null),C5=_j.Provider,E5=()=>p.useContext(_j),j5={},uy=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,readOnly:c,...u}=U("SwitchGroup",j5,e),[d,f]=un({value:n,defaultValue:r,finalValue:[],onChange:o}),h=m=>{const g=m.currentTarget.value;!c&&f(d.includes(g)?d.filter(v=>v!==g):[...d,g])};return C.createElement(C5,{value:{value:d,onChange:h,size:i}},C.createElement(dt.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"SwitchGroup"},C.createElement(Mv,{role:"group"},l)))});uy.classes=dt.Wrapper.classes;uy.displayName="@mantine/core/SwitchGroup";var Aj={root:"m-5f93f3bb",input:"m-926b4011",track:"m-9307d992",thumb:"m-93039a1d",trackLabel:"m-8277e082"};const P5={labelPosition:"right"},T5=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ft(t),"--switch-height":Ee(r,"switch-height"),"--switch-width":Ee(r,"switch-width"),"--switch-thumb-size":Ee(r,"switch-thumb-size"),"--switch-label-font-size":Ee(r,"switch-label-font-size"),"--switch-track-label-padding":Ee(r,"switch-track-label-padding"),"--switch-color":n?yt(n,e):void 0}}),wc=Q((e,t)=>{const n=U("Switch",P5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,label:d,offLabel:f,onLabel:h,id:m,size:g,radius:v,wrapperProps:b,children:x,thumbIcon:y,checked:w,defaultChecked:S,onChange:j,labelPosition:E,description:P,error:T,disabled:k,variant:I,rootRef:O,mod:R,...M}=n,N=E5(),B=g||(N==null?void 0:N.size),D=fe({name:"Switch",props:n,classes:Aj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:T5}),{styleProps:$,rest:_}=ko(M),F=Cn(m),H=N?{checked:N.value.includes(_.value),onChange:N.onChange}:{},[G,oe]=un({value:H.checked??w,defaultValue:S,finalValue:!1});return C.createElement(vf,{...D("root"),__staticSelector:"Switch",__stylesApiProps:n,id:F,size:B,labelPosition:E,label:d,description:P,error:T,disabled:k,classNames:r,styles:s,unstyled:l,"data-checked":H.checked||void 0,variant:I,ref:O,mod:R,...$,...b},C.createElement("input",{..._,disabled:k,checked:G,onChange:be=>{var je;N?(je=H.onChange)==null||je.call(H,be):j==null||j(be),oe(be.currentTarget.checked)},id:F,ref:t,type:"checkbox",...D("input")}),C.createElement(q,{component:"label",htmlFor:F,mod:{error:T,"label-position":E},...D("track")},C.createElement(q,{component:"span",mod:"reduce-motion",...D("thumb")},y),C.createElement("span",{...D("trackLabel")},G?h:f)))});wc.classes={...Aj,...ZE};wc.displayName="@mantine/core/Switch";wc.Group=uy;const[k5,R5]=bn("Table component was not found in the tree");var Sc={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 I5(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 ms(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=Q((o,i)=>{const s=U(n,{},o),{classNames:l,className:c,style:u,styles:d,...f}=s,h=R5();return C.createElement(q,{component:e,ref:i,...I5(h,t),...h.getStyles(e,{className:c,classNames:l,style:u,styles:d,props:s}),...f})});return r.displayName=`@mantine/core/${n}`,r.classes=Sc,r}const ym=ms("th",{columnBorder:!0}),Nj=ms("td",{columnBorder:!0}),Lu=ms("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),Oj=ms("thead",{stickyHeader:!0}),Mj=ms("tbody"),$j=ms("tfoot"),Lj=ms("caption",{captionSide:!0});function dy({data:e}){return C.createElement(C.Fragment,null,e.caption&&C.createElement(Lj,null,e.caption),e.head&&C.createElement(Oj,null,C.createElement(Lu,null,e.head.map((t,n)=>C.createElement(ym,{key:n},t)))),e.body&&C.createElement(Mj,null,e.body.map((t,n)=>C.createElement(Lu,{key:n},t.map((r,o)=>C.createElement(Nj,{key:o},r))))),e.foot&&C.createElement($j,null,C.createElement(Lu,null,e.foot.map((t,n)=>C.createElement(ym,{key:n},t)))))}dy.displayName="@mantine/core/TableDataRenderer";const D5={type:"scrollarea"},_5=(e,{minWidth:t,type:n})=>({scrollContainer:{"--table-min-width":z(t),"--table-overflow":n==="native"?"auto":void 0}}),fy=Q((e,t)=>{const n=U("TableScrollContainer",D5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,minWidth:d,type:f,...h}=n,m=fe({name:"TableScrollContainer",classes:Sc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:_5,rootSelector:"scrollContainer"});return C.createElement(q,{component:f==="scrollarea"?hr:"div",...f==="scrollarea"?{offsetScrollbars:"x"}:{},ref:t,...m("scrollContainer"),...h},C.createElement("div",{...m("scrollContainerInner")},u))});fy.classes=Sc;fy.displayName="@mantine/core/TableScrollContainer";const A5={withRowBorders:!0,verticalSpacing:7},N5=(e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:o,borderColor:i,stripedColor:s,highlightOnHoverColor:l,striped:c,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":en(r),"--table-vertical-spacing":en(o),"--table-border-color":i?yt(i,e):void 0,"--table-striped-color":c&&s?yt(s,e):void 0,"--table-highlight-on-hover-color":u&&l?yt(l,e):void 0,"--table-sticky-header-offset":f?z(d):void 0}}),me=Q((e,t)=>{const n=U("Table",A5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,horizontalSpacing:u,verticalSpacing:d,captionSide:f,stripedColor:h,highlightOnHoverColor:m,striped:g,highlightOnHover:v,withColumnBorders:b,withRowBorders:x,withTableBorder:y,borderColor:w,layout:S,variant:j,data:E,children:P,stickyHeader:T,stickyHeaderOffset:k,mod:I,...O}=n,R=fe({name:"Table",props:n,className:o,style:i,classes:Sc,classNames:r,styles:s,unstyled:l,rootSelector:"table",vars:c,varsResolver:N5});return C.createElement(k5,{value:{getStyles:R,stickyHeader:T,striped:g===!0?"odd":g||void 0,highlightOnHover:v,withColumnBorders:b,withRowBorders:x,captionSide:f||"bottom"}},C.createElement(q,{component:"table",variant:j,ref:t,mod:[{"data-with-table-border":y},I],...R("table"),...O},P||!!E&&C.createElement(dy,{data:E})))});me.classes=Sc;me.displayName="@mantine/core/Table";me.Td=Nj;me.Th=ym;me.Tr=Lu;me.Thead=Oj;me.Tbody=Mj;me.Tfoot=$j;me.Caption=Lj;me.ScrollContainer=fy;me.DataRenderer=dy;const[O5,hy]=bn("Tabs component was not found in the tree");var bc={root:"m-89d60db1","list--default":"m-576c9d4",list:"m-89d33d6d",panel:"m-b0c91715",tab:"m-4ec4dce6",tabSection:"m-fc420b1f","tab--default":"m-539e827b","list--outline":"m-6772fbd5","tab--outline":"m-b59ab47c","tab--pills":"m-c3381914"};const M5={},py=Q((e,t)=>{const n=U("TabsList",M5,e),{children:r,className:o,grow:i,justify:s,classNames:l,styles:c,style:u,mod:d,...f}=n,h=hy();return C.createElement(q,{...f,...h.getStyles("list",{className:o,style:u,classNames:l,styles:c,props:n,variant:h.variant}),ref:t,role:"tablist",variant:h.variant,mod:[{grow:i,orientation:h.orientation,placement:h.orientation==="vertical"&&h.placement,inverted:h.inverted},d],"aria-orientation":h.orientation,__vars:{"--tabs-justify":s}},r)});py.classes=bc;py.displayName="@mantine/core/TabsList";const $5={},my=Q((e,t)=>{const n=U("TabsPanel",$5,e),{children:r,className:o,value:i,classNames:s,styles:l,style:c,mod:u,...d}=n,f=hy(),h=f.value===i,m=f.keepMounted||n.keepMounted||h?r:null;return C.createElement(q,{...d,...f.getStyles("panel",{className:o,classNames:s,styles:l,style:[c,h?void 0:{display:"none"}],props:n}),ref:t,mod:[{orientation:f.orientation},u],role:"tabpanel",id:f.getPanelId(i),"aria-labelledby":f.getTabId(i)},m)});my.classes=bc;my.displayName="@mantine/core/TabsPanel";const L5={},gy=Q((e,t)=>{const n=U("TabsTab",L5,e),{className:r,children:o,rightSection:i,leftSection:s,value:l,onClick:c,onKeyDown:u,disabled:d,color:f,style:h,classNames:m,styles:g,vars:v,mod:b,...x}=n,y=Pt(),{dir:w}=ss(),S=hy(),j=l===S.value,E=T=>{S.onChange(S.allowTabDeactivation&&l===S.value?null:l),c==null||c(T)},P={classNames:m,styles:g,props:n};return C.createElement(lr,{...x,...S.getStyles("tab",{className:r,style:h,variant:S.variant,...P}),disabled:d,unstyled:S.unstyled,variant:S.variant,mod:[{active:j,disabled:d,orientation:S.orientation,inverted:S.inverted,placement:S.orientation==="vertical"&&S.placement},b],ref:t,role:"tab",id:S.getTabId(l),"aria-selected":j,tabIndex:j||S.value===null?0:-1,"aria-controls":S.getPanelId(l),onClick:E,__vars:{"--tabs-color":f?yt(f,y):void 0},onKeyDown:bS({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:S.activateTabWithKeyboard,loop:S.loop,orientation:S.orientation||"horizontal",dir:w,onKeyDown:u})},s&&C.createElement("span",{...S.getStyles("tabSection",P),"data-position":"left"},s),o&&C.createElement("span",{...S.getStyles("tabLabel",P)},o),i&&C.createElement("span",{...S.getStyles("tabSection",P),"data-position":"right"},i))});gy.classes=bc;gy.displayName="@mantine/core/TabsTab";const b1="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",F5={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},z5=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":ft(t),"--tabs-color":yt(n,e),"--tabs-text-color":oc(r,e)?is({color:n,theme:e}):void 0}}),We=Q((e,t)=>{const n=U("Tabs",F5,e),{defaultValue:r,value:o,onChange:i,orientation:s,children:l,loop:c,id:u,activateTabWithKeyboard:d,allowTabDeactivation:f,variant:h,color:m,radius:g,inverted:v,placement:b,keepMounted:x,classNames:y,styles:w,unstyled:S,className:j,style:E,vars:P,autoContrast:T,mod:k,...I}=n,O=Cn(u),[R,M]=un({value:o,defaultValue:r,finalValue:null,onChange:i}),N=fe({name:"Tabs",props:n,classes:bc,className:j,style:E,classNames:y,styles:w,unstyled:S,vars:P,varsResolver:z5});return C.createElement(O5,{value:{placement:b,value:R,orientation:s,id:O,loop:c,activateTabWithKeyboard:d,getTabId:T0(`${O}-tab`,b1),getPanelId:T0(`${O}-panel`,b1),onChange:M,allowTabDeactivation:f,variant:h,color:m,radius:g,inverted:v,keepMounted:x,unstyled:S,getStyles:N}},C.createElement(q,{ref:t,id:O,variant:h,mod:[{orientation:s,inverted:s==="horizontal"&&v,placement:s==="vertical"&&b},k],...N("root"),...I},l))});We.classes=bc;We.displayName="@mantine/core/Tabs";We.Tab=gy;We.Panel=my;We.List=py;const B5={},ie=Q((e,t)=>{const n=U("TextInput",B5,e);return C.createElement(mr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});ie.classes=mr.classes;ie.displayName="@mantine/core/TextInput";var Fj={root:"m-7341320d"};const U5={},V5=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:s});return{root:{"--ti-size":Ee(t,"ti-size"),"--ti-radius":n===void 0?void 0:ft(n),"--ti-bg":i||r?l.background:void 0,"--ti-color":i||r?l.color:void 0,"--ti-bd":i||r?l.border:void 0}}},vy=Q((e,t)=>{const n=U("ThemeIcon",U5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,autoContrast:u,...d}=n,f=fe({name:"ThemeIcon",classes:Fj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:V5});return C.createElement(q,{ref:t,...f("root"),...d})});vy.classes=Fj;vy.displayName="@mantine/core/ThemeIcon";const W5=["h1","h2","h3","h4","h5","h6"];function H5(e,t){const n=t!==void 0?t:`h${e}`;return W5.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:{fontSize:z(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var zj={root:"m-8a5d1357"};const q5={order:1},G5=(e,{order:t,size:n,lineClamp:r,textWrap:o})=>{const i=H5(t,n);return{root:{"--title-fw":i.fontWeight,"--title-lh":i.lineHeight,"--title-fz":i.fontSize,"--title-line-clamp":typeof r=="number"?r.toString():void 0,"--title-text-wrap":o}}},ce=Q((e,t)=>{const n=U("Title",q5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,order:c,vars:u,size:d,variant:f,lineClamp:h,textWrap:m,mod:g,...v}=n,b=fe({name:"Title",props:n,classes:zj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:G5});return[1,2,3,4,5,6].includes(c)?C.createElement(q,{...b("root"),component:`h${c}`,variant:f,ref:t,mod:[{order:c,"data-line-clamp":typeof h=="number"},g],size:d,...v}):null});ce.classes=zj;ce.displayName="@mantine/core/Title";function Q5(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(i=>i(t))},initialize(o){n||(t=o,n=!0)},subscribe(o){return r.add(o),()=>r.delete(o)}}}function K5(e){return p.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}const Y5=()=>Q5({notifications:[],queue:[],limit:5}),gs=Y5(),X5=(e=gs)=>K5(e);function $a(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]);e.setState({notifications:r.slice(0,n.limit),queue:r.slice(n.limit),limit:n.limit})}function le(e,t=gs){const n=e.id||rg();return $a(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function Bj(e,t=gs){return $a(t,n=>n.filter(r=>{var o;return r.id===e?((o=r.onClose)==null||o.call(r,r),!1):!0})),e}function hl(e,t=gs){return $a(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function J5(e=gs){$a(e,()=>[])}function Z5(e=gs){$a(e,t=>t.slice(0,e.getState().limit))}const Jr={show:le,hide:Bj,update:hl,clean:J5,cleanQueue:Z5,updateState:$a};function xm(e,t){return xm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},xm(e,t)}function Uj(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xm(e,t)}var Vj={exports:{}},eO="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",tO=eO,nO=tO;function Wj(){}function Hj(){}Hj.resetWarningCache=Wj;var rO=function(){function e(r,o,i,s,l,c){if(c!==nO){var u=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 u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Hj,resetWarningCache:Wj};return n.PropTypes=n,n};Vj.exports=rO();var oO=Vj.exports;const Ue=Qm(oO),C1={disabled:!1},Sd=C.createContext(null);var iO=function(t){return t.scrollTop},pl="unmounted",_i="exited",Ai="entering",Os="entered",wm="exiting",Ao=function(e){Uj(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=o,l=s&&!s.isMounting?r.enter:r.appear,c;return i.appearStatus=null,r.in?l?(c=_i,i.appearStatus=Ai):c=Os:r.unmountOnExit||r.mountOnEnter?c=pl:c=_i,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===pl?{status:_i}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==Ai&&s!==Os&&(i=Ai):(s===Ai||s===Os)&&(i=wm)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,s,l;return i=s=l=o,o!=null&&typeof o!="number"&&(i=o.exit,s=o.enter,l=o.appear!==void 0?o.appear:s),{exit:i,enter:s,appear:l}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===Ai){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:fl.findDOMNode(this);s&&iO(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===_i&&this.setState({status:pl})},n.performEnter=function(o){var i=this,s=this.props.enter,l=this.context?this.context.isMounting:o,c=this.props.nodeRef?[l]:[fl.findDOMNode(this),l],u=c[0],d=c[1],f=this.getTimeouts(),h=l?f.appear:f.enter;if(!o&&!s||C1.disabled){this.safeSetState({status:Os},function(){i.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:Ai},function(){i.props.onEntering(u,d),i.onTransitionEnd(h,function(){i.safeSetState({status:Os},function(){i.props.onEntered(u,d)})})})},n.performExit=function(){var o=this,i=this.props.exit,s=this.getTimeouts(),l=this.props.nodeRef?void 0:fl.findDOMNode(this);if(!i||C1.disabled){this.safeSetState({status:_i},function(){o.props.onExited(l)});return}this.props.onExit(l),this.safeSetState({status:wm},function(){o.props.onExiting(l),o.onTransitionEnd(s.exit,function(){o.safeSetState({status:_i},function(){o.props.onExited(l)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,s=!0;return this.nextCallback=function(l){s&&(s=!1,i.nextCallback=null,o(l))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:fl.findDOMNode(this),l=o==null&&!this.props.addEndListener;if(!s||l){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=c[0],d=c[1];this.props.addEndListener(u,d)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===pl)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var l=Wv(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return C.createElement(Sd.Provider,{value:null},typeof s=="function"?s(o,l):C.cloneElement(C.Children.only(s),l))},t}(C.Component);Ao.contextType=Sd;Ao.propTypes={};function Ds(){}Ao.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ds,onEntering:Ds,onEntered:Ds,onExit:Ds,onExiting:Ds,onExited:Ds};Ao.UNMOUNTED=pl;Ao.EXITED=_i;Ao.ENTERING=Ai;Ao.ENTERED=Os;Ao.EXITING=wm;const sO=Ao;function aO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yy(e,t){var n=function(i){return t&&p.isValidElement(i)?t(i):i},r=Object.create(null);return e&&p.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function lO(e,t){e=e||{},t=t||{};function n(d){return d in t?t[d]:e[d]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var s,l={};for(var c in t){if(r[c])for(s=0;s<r[c].length;s++){var u=r[c][s];l[r[c][s]]=n(u)}l[c]=n(c)}for(s=0;s<o.length;s++)l[o[s]]=n(o[s]);return l}function Fi(e,t,n){return n[t]!=null?n[t]:e.props[t]}function cO(e,t){return yy(e.children,function(n){return p.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Fi(n,"appear",e),enter:Fi(n,"enter",e),exit:Fi(n,"exit",e)})})}function uO(e,t,n){var r=yy(e.children),o=lO(t,r);return Object.keys(o).forEach(function(i){var s=o[i];if(p.isValidElement(s)){var l=i in t,c=i in r,u=t[i],d=p.isValidElement(u)&&!u.props.in;c&&(!l||d)?o[i]=p.cloneElement(s,{onExited:n.bind(null,s),in:!0,exit:Fi(s,"exit",e),enter:Fi(s,"enter",e)}):!c&&l&&!d?o[i]=p.cloneElement(s,{in:!1}):c&&l&&p.isValidElement(u)&&(o[i]=p.cloneElement(s,{onExited:n.bind(null,s),in:u.props.in,exit:Fi(s,"exit",e),enter:Fi(s,"enter",e)}))}}),o}var dO=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},fO={component:"div",childFactory:function(t){return t}},xy=function(e){Uj(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(aO(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}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,i){var s=i.children,l=i.handleExited,c=i.firstRender;return{children:c?cO(o,l):uO(o,s,l),firstRender:!1}},n.handleExited=function(o,i){var s=yy(this.props.children);o.key in s||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(l){var c=xd({},l.children);return delete c[o.key],{children:c}}))},n.render=function(){var o=this.props,i=o.component,s=o.childFactory,l=Wv(o,["component","childFactory"]),c=this.state.contextValue,u=dO(this.state.children).map(s);return delete l.appear,delete l.enter,delete l.exit,i===null?C.createElement(Sd.Provider,{value:c},u):C.createElement(Sd.Provider,{value:c},C.createElement(i,l,u))},t}(C.Component);xy.propTypes={};xy.defaultProps=fO;const hO=xy,E1={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},pO={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function mO({state:e,maxHeight:t,position:n,transitionDuration:r}){const[o,i]=n.split("-"),s=i==="center"?`${o}-center`:i,l={opacity:0,maxHeight:t,transform:E1[s],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"},c={opacity:1,transform:pO[s]},u={opacity:0,maxHeight:0,transform:E1[s]};return{...l,...{entering:c,entered:c,exiting:u,exited:u}[e]}}function gO(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const qj=p.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:i,message:s,...l}=e,c=gO(n,e.autoClose),u=p.useRef(),d=()=>window.clearTimeout(u.current),f=()=>{t(e.id),d()},h=()=>{typeof c=="number"&&(u.current=window.setTimeout(f,c))};return p.useEffect(()=>{var m;(m=e.onOpen)==null||m.call(e,e)},[]),p.useEffect(()=>(h(),d),[c]),C.createElement(ny,{...r,...l,onClose:f,ref:o,onMouseEnter:d,onMouseLeave:h},s)});qj.displayName="@mantine/notifications/NotificationContainer";var Gj={root:"m-b37d9ac7",notification:"m-5ed0edd0"};const vO=sO,yO={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:Nr("overlay"),store:gs,withinPortal:!0},xO=(e,{zIndex:t,position:n,containerWidth:r})=>{const[o,i]=n.split("-");return{root:{"--notifications-z-index":t==null?void 0:t.toString(),"--notifications-top":o==="top"?"var(--mantine-spacing-md)":void 0,"--notifications-bottom":o==="bottom"?"var(--mantine-spacing-md)":void 0,"--notifications-left":i==="left"?"var(--mantine-spacing-md)":i==="center"?"50%":void 0,"--notifications-right":i==="right"?"var(--mantine-spacing-md)":void 0,"--notifications-transform":i==="center"?"translateX(-50%)":void 0,"--notifications-container-width":z(r)}}},No=Q((e,t)=>{const n=U("Notifications",yO,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,position:u,autoClose:d,transitionDuration:f,containerWidth:h,notificationMaxHeight:m,limit:g,zIndex:v,store:b,portalProps:x,withinPortal:y,...w}=n,S=Pt(),j=X5(b),E=uR(),P=ig(),T=p.useRef({}),k=p.useRef(0),O=(S.respectReducedMotion?P:!1)?1:f,R=fe({name:"Notifications",classes:Gj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:xO});p.useEffect(()=>{b==null||b.updateState(N=>({...N,limit:g||5}))},[g]),go(()=>{j.notifications.length>k.current&&setTimeout(()=>E(),0),k.current=j.notifications.length},[j.notifications]);const M=j.notifications.map(({style:N,...B})=>C.createElement(vO,{key:B.id,timeout:O,onEnter:()=>T.current[B.id].offsetHeight,nodeRef:{current:T.current[B.id]}},D=>C.createElement(qj,{ref:$=>{T.current[B.id]=$},data:B,onHide:$=>Bj($,b),autoClose:d,...R("notification",{style:{...mO({state:D,position:u,transitionDuration:O,maxHeight:m}),...N}})})));return C.createElement(us,{withinPortal:y,...x},C.createElement(q,{...R("root"),ref:t,...w},C.createElement(hO,null,M)))});No.classes=Gj;No.displayName="@mantine/notifications/Notifications";No.show=Jr.show;No.hide=Jr.hide;No.update=Jr.update;No.clean=Jr.clean;No.cleanQueue=Jr.cleanQueue;No.updateState=Jr.updateState;class wO{constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class Cc{constructor(t,n,r){this.operator=t,this.left=n,this.right=r}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class SO{constructor(){this.prefixParselets={},this.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,i){const s=o.consumeAndParse(n);return r(i,s)}})}infixLeft(t,n,r){return this.registerInfix(t,{parse(o,i,s){const l=o.consumeAndParse(n);return r(i,s,l)},precedence:n})}construct(t){return new bO(t,this.prefixParselets,this.infixParselets)}}class bO{constructor(t,n,r){this.tokens=t,this.prefixParselets=n,this.infixParselets=r}hasMore(){return this.tokens.length>0}match(t){const n=this.peek();return(n==null?void 0:n.id)!==t?!1:(this.consume(),!0)}consumeAndParse(t=1/0){const n=this.consume(),r=this.prefixParselets[n.id];if(!r)throw 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 i=this.consume();o=this.getInfixParselet(i).parse(this,o,i)}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){var r,o;if(!this.tokens.length)throw Error("Cant consume unknown more tokens.");if(t&&((r=this.peek())==null?void 0:r.id)!==t){const i=this.peek();throw Error(`Expected ${t} but got "${i.id}" (${i.value}) at line ${i.line} column ${i.column}.`)}if(n&&((o=this.peek())==null?void 0:o.value)!==n){const i=this.peek();throw Error(`Expected "${n}" but got "${i.value}" at line ${i.line} column ${i.column}.`)}return this.tokens.shift()}peek(){return this.tokens.length>0?this.tokens[0]:void 0}removeComments(){this.tokens=this.tokens.filter(t=>t.id!=="Comment")}getInfixParselet(t){return this.infixParselets[t.id==="Symbol"?t.value:t.id]}}const Qj="ok",CO="created",EO="gone",jO="not-modified",PO="not-found",TO="forbidden",kO="accepted",RO={resourceType:"OperationOutcome",id:Qj,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},IO={resourceType:"OperationOutcome",id:PO,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},Kj={resourceType:"OperationOutcome",id:TO,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function ci(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function gt(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function DO(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"exception",details:{text:"Internal server error"},diagnostics:e.toString()}]}}function $f(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function Yj(e){return e.id===Qj||e.id===CO||e.id===jO||e.id===kO}function _O(e){return e.id===EO}class $e extends Error{constructor(t,n){super(Xj(t)),this.outcome=t,this.cause=n}}function ut(e){return e instanceof $e?e.outcome:$f(e)?e:ci(Te(e))}function Te(e){return e?typeof e=="string"?e:e instanceof Error?e.message:$f(e)?Xj(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function Xj(e){var n;const t=((n=e.issue)==null?void 0:n.map(Jj))??[];return t.length>0?t.join("; "):"Unknown error"}function Jj(e){var n,r;let t;return(n=e.details)!=null&&n.text?e.diagnostics?t=`${e.details.text} (${e.diagnostics})`:t=e.details.text:e.diagnostics?t=e.diagnostics:t="Unknown error",(r=e.expression)!=null&&r.length&&(t+=` (${e.expression.join(", ")})`),t}function bt(e){const t=lt(e),n=Co(e);return n===t?{reference:t}:{reference:t,display:n}}function lt(e){return xs(e)?e.reference:`${e.resourceType}/${e.id}`}function Lf(e){if(e)return xs(e)?e.reference.split("/")[1]:e.id}function AO(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function Co(e){var t;if(AO(e)){const n=NO(e);if(n)return n}if(e.resourceType==="Device"){const n=OO(e);if(n)return n}return e.resourceType==="Observation"&&"code"in e&&(t=e.code)!=null&&t.text?e.code.text:e.resourceType==="User"&&e.email?e.email:"name"in e&&e.name&&typeof e.name=="string"?e.name:lt(e)}function NO(e){const t=e.name;if(t&&t.length>0)return Pc(t[0])}function OO(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function MO(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const n of t){const r=j1(n);if(r)return r}else return j1(t)}function j1(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function Zj(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(),i=n.getUTCMonth(),s=n.getUTCDate(),l=r.getUTCFullYear(),c=r.getUTCMonth(),u=r.getUTCDate();let d=l-o;(c<i||c===i&&u<s)&&d--;let f=l*12+c-(o*12+i);u<s&&f--;const h=Math.floor((r.getTime()-n.getTime())/(1e3*60*60*24));return{years:d,months:f,days:h}}function $O(e,t){const{years:n,months:r,days:o}=Zj(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 Ec(e,...t){var r;let n=e;for(let o=0;o<t.length&&n;o++)n=(r=n==null?void 0:n.extension)==null?void 0:r.find(i=>i.url===t[o]);return n}function Qn(e,t){return JSON.stringify(e,LO,t?2:void 0)}function LO(e,t){return!FO(e)&&Vt(t)?void 0:t}function FO(e){return!!/\d+$/.exec(e)}function Vt(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!cn(e):!1}function cn(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 jc(e,t,n){return e===t||Vt(e)&&Vt(t)?!0:Vt(e)||Vt(t)?!1:Array.isArray(e)&&Array.isArray(t)?zO(e,t):Array.isArray(e)||Array.isArray(t)?!1:Pr(e)&&Pr(t)?BO(e,t,n):(Pr(e)||Pr(t),!1)}function zO(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!jc(e[n],t[n]))return!1;return!0}function BO(e,t,n){const r=new Set;Object.keys(e).forEach(o=>r.add(o)),Object.keys(t).forEach(o=>r.add(o)),n==="meta"&&(r.delete("versionId"),r.delete("lastUpdated"),r.delete("author"));for(const o of r){const i=e[o],s=t[o];if(!jc(i,s,o))return!1}return!0}function wy(e,t){return Vt(e)?!0:Vt(t)?!1:Array.isArray(e)&&Array.isArray(t)?UO(e,t):Array.isArray(e)||Array.isArray(t)?!1:Pr(e)&&Pr(t)?VO(e,t):Pr(e)||Pr(t)?!1:e===t}function UO(e,t){return t.every(n=>e.some(r=>wy(r,n)))}function VO(e,t){return Object.entries(t).every(([n,r])=>n in e&&wy(e[n],r))}function ro(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function eP(e){return!!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.exec(e)}function Pr(e){return e!==null&&typeof e=="object"}const tP=[];for(let e=0;e<256;e++)tP.push(e.toString(16).padStart(2,"0"));function WO(e){const t=new Uint8Array(e),n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=tP[t[r]];return n.join("")}function HO(e){const t=new Uint8Array(e),n=[];for(let r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return window.btoa(n.join(""))}function zt(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function Sy(e){return e.length>0&&e.startsWith(e[0].toUpperCase())}function Gl(e,t){const n=e+".";if(t.startsWith(n))return t.slice(n.length)}function qO(e,t){var n,r;return(r=(n=e.coding)==null?void 0:n.find(o=>o.system===t))==null?void 0:r.code}function GO(e){if(e)return Array.isArray(e)?e:[e]}const P1=e=>new Promise(t=>{setTimeout(t,e)});function QO(e,t,n){const r=[];for(let o=0;o<n-1;o++){const i=e.indexOf(t);if(i<0)break;r.push(e.slice(0,i)),e=e.slice(i+t.length)}return r.push(e),r}function Za(e,t){return e?(e.push(t),e):[t]}function KO(e,t){return new URL(e,t).toString().replace("http://","ws://").replace("https://","wss://")}function YO(e,t){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!=null&&t.all||t!=null&&t.use)&&n.push("["+e.use+"]"),n.join((t==null?void 0:t.lineSeparator)??", ").trim()}function Pc(e,t){const n=[];if(e.prefix&&(t==null?void 0:t.prefix)!==!1&&n.push(...e.prefix),e.given&&n.push(...e.given),e.family&&n.push(e.family),e.suffix&&(t==null?void 0:t.suffix)!==!1&&n.push(...e.suffix),e.use&&(t!=null&&t.all||t!=null&&t.use)&&n.push("["+e.use+"]"),n.length===0){const r=Kl(e.text);if(r)return r}return n.join(" ").trim()}function Ff(e){return e instanceof Date&&!isNaN(e.getTime())}function XO(e,t,n){if(!e)return"";const r=new Date("2000-01-01T"+e+"Z");return Ff(r)?r.toLocaleTimeString(t,n):""}function Fn(e,t,n){if(!e)return"";const r=new Date(e);return Ff(r)?r.toLocaleString(t,n):""}function JO(e,t,n){return!e||!e.start&&!e.end?"":Fn(e.start,t,n)+" - "+Fn(e.end,t,n)}const ZO={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},eM={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},tM={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function nP(e){if(!e)return"";const t=[];return nM(t,e.repeat),e.event&&t.push(e.event.map(n=>Fn(n)).join(", ")),zt(t.join(" ").trim())}function nM(e,t){if(!(t!=null&&t.periodUnit))return;const n=t.frequency??1,r=t.period??1,o=t.periodUnit;n===1&&r===1?e.push(ZO[o]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+eM[o]):e.push("per "+r+" "+tM[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(zt).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(i=>XO(i)).join(", "))}function Ql(e,t,n=!1){if(n&&t===void 0)throw new Error("Precision must be specified for exclusive ranges");const r=(e==null?void 0:e.low)&&{...e.low,comparator:void 0},o=(e==null?void 0:e.high)&&{...e.high,comparator:void 0};return(r==null?void 0:r.value)===void 0&&(o==null?void 0:o.value)===void 0?"":(r==null?void 0:r.value)!==void 0&&(o==null?void 0:o.value)===void 0?n&&t!==void 0?(r.value=iM(r.value,t),`> ${Ho(r,t)}`):`>= ${Ho(r,t)}`:(r==null?void 0:r.value)===void 0&&(o==null?void 0:o.value)!==void 0?n&&t!==void 0?(o.value=oM(o.value,t),`< ${Ho(o,t)}`):`<= ${Ho(o,t)}`:((r==null?void 0:r.unit)===(o==null?void 0:o.unit)&&(r==null||delete r.unit),`${Ho(r,t)} - ${Ho(o,t)}`)}function Ho(e,t){if(!e)return"";const n=[];return e.comparator&&(n.push(e.comparator),n.push(" ")),e.value!==void 0&&(t!==void 0?n.push(e.value.toFixed(t)):n.push(e.value)),e.unit&&(e.unit!=="%"&&n[n.length-1]!==" "&&n.push(" "),n.push(e.unit)),n.join("").trim()}function rM(e){return(e==null?void 0:e.value)===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function Sa(e){if(!e)return"";const t=Kl(e.text);return t||(e.coding?e.coding.map(n=>vs(n)).join(", "):"")}function vs(e){return Kl(e==null?void 0:e.display)??Kl(e==null?void 0:e.code)??""}function rP(e){if(!e)return"";if("component"in e)return e.component.map(n=>rP(n)).join(" / ");if(e.valueQuantity)return Ho(e.valueQuantity);if(e.valueCodeableConcept)return Sa(e.valueCodeableConcept);const t=Kl(e.valueString);return t||""}function Kl(e){return typeof e=="string"?e:void 0}function oM(e,t,n=1){return(oP(e,t)+n)*Math.pow(10,-t)}function iM(e,t,n=1){return(oP(e,t)-n)*Math.pow(10,-t)}function oP(e,t){return t===void 0?e:Math.round(e*Math.pow(10,t))}function sM(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 aM(e){const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]={name:n,elements:Object.fromEntries(Object.entries(r.elements).map(([o,i])=>[o,sM(o,i)])),constraints:[],innerTypes:[]};return t}const lM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},cM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},uM={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"}]}}},dM={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"}]}}},fM={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"}]}}},hM={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"}]}}},pM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},mM={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"}]}}},gM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},vM={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"}]}}},yM={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"}]}}},xM={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"}]}}},wM={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"}]}}},SM={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"}]}}},bM={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"]}]}}},CM={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"}]}}},EM={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"}]}}},jM={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"}]}}},PM={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"}]}}},TM={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"}]}}},kM={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"]}]}}},RM={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"}]}}},IM={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"}]},account:{type:[{code:"Reference"}]},compartment:{max:9007199254740991,type:[{code:"Reference"}]}}},DM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},_M={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},AM={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"]}]}}},NM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},OM={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"}]}}},MM={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"}]}}},$M={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"}]}}},LM={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"}]}}},FM={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"]}]}}},zM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},BM={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"}]}}},UM={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"]}]}}},VM={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"}]}}},WM={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"}]}}},HM={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"}]}}},qM={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"}]}}},GM={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"}]}}},QM={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"]}]}}},KM={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"}]}}},YM={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"}]}}},XM={elements:{id:{type:[{code:"string"}]},meta:{type:[{code:"Meta"}]},implicitRules:{type:[{code:"uri"}]},language:{type:[{code:"code"}]},text:{type:[{code:"Narrative"}]},contained:{max:9007199254740991,type:[{code:"Resource"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},url:{type:[{code:"uri"}]},version:{type:[{code:"string"}]},name:{type:[{code:"string"}]},title:{type:[{code:"string"}]},status:{min:1,type:[{code:"code"}]},experimental:{type:[{code:"boolean"}]},date:{type:[{code:"dateTime"}]},publisher:{type:[{code:"string"}]},contact:{max:9007199254740991,type:[{code:"ContactDetail"}]},description:{type:[{code:"markdown"}]},useContext:{max:9007199254740991,type:[{code:"UsageContext"}]},jurisdiction:{max:9007199254740991,type:[{code:"CodeableConcept"}]}}},JM={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"}]}}},ZM={Element:lM,BackboneElement:cM,Address:uM,Age:dM,Annotation:fM,Attachment:hM,CodeableConcept:pM,Coding:mM,ContactDetail:gM,ContactPoint:vM,Contributor:yM,Count:xM,DataRequirement:wM,Distance:SM,Dosage:bM,Duration:CM,ElementDefinition:EM,Expression:jM,Extension:PM,HumanName:TM,Identifier:kM,MarketingStatus:RM,Meta:IM,Money:DM,Narrative:_M,ParameterDefinition:AM,Period:NM,Population:OM,ProdCharacteristic:MM,ProductShelfLife:$M,Quantity:LM,Range:FM,Ratio:zM,Reference:BM,RelatedArtifact:UM,SampledData:VM,Signature:WM,SubstanceAmount:HM,Timing:qM,TriggerDefinition:GM,UsageContext:QM,MoneyQuantity:KM,SimpleQuantity:YM,MetadataResource:XM,IdentityProvider:JM},e$="http://hl7.org";function t$(e,t,n){if(t==="$this")return[e];const[r,...o]=t.split(".");let i=[Kt(e,r,n)];for(const s of o){const l=[];for(const c of i)if(Array.isArray(c))for(const u of c)l.push(Kt(u,s,n));else c!==void 0&&l.push(Kt(c,s,n));i=l}return i}const iP={base64Binary:/^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/,canonical:/^\S*$/,code:/^[^\s]+( [^\s]+)*$/,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)?)?)?$/,id:/^[A-Za-z0-9\-.]{1,64}$/,instant:/^(\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))$/,markdown:/^[\s\S]+$/,oid:/^urn:oid:[0-2](\.(0|[1-9]\d*))+$/,string:/^[\s\S]+$/,time:/^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/,uri:/^\S*$/,url:/^\S*$/,uuid:/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,xhtml:/.*/};function n$(e,t){return!(t.pattern&&!wy(e,t.pattern)||t.fixed&&!jc(e,t.fixed))}function r$(e,t,n,r){if(Array.isArray(e))return!1;const o=(r??n.elements)[t.path],i=n.type;switch(t.type){case"value":case"pattern":if(!e||!o)return!1;if(n$(e,o))return!0;break;case"type":return!e||!(i!=null&&i.length)?!1:i.some(s=>s.code===e.type)}return!1}function ve(e){return[{type:V.boolean,value:e}]}function oo(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:V.integer,value:e}:typeof e=="number"?{type:V.decimal,value:e}:typeof e=="boolean"?{type:V.boolean,value:e}:typeof e=="string"?{type:V.string,value:e}:ir(e)?{type:V.Quantity,value:e}:Oo(e)?{type:e.resourceType,value:e}:{type:V.BackboneElement,value:e}}function ei(e){return e.length===0?!1:!!e[0].value}function Eo(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 Kt(e,t,n){if(!e.value)return;const r=ys(e.type,t,n==null?void 0:n.profileUrl);return r?sP(e,t,r):o$(e,t)}function sP(e,t,n){const r=e.value,o=n.type;if(!o||o.length===0)return;let i,s="undefined",l;if(n.path.endsWith("[x]")){const c=n.path.split(".").pop().replace("[x]","");for(const u of o){const d=c+zt(u.code);if(i=r[d],l=r["_"+d],i!==void 0||l!==void 0){s=u.code;break}}}else console.assert(o.length===1,"Expected single type",n.path),i=r[t],s=o[0].code,l=r["_"+t];if(l)if(Array.isArray(i))for(let c=0;c<Math.max(i.length,l.length);c++)i[c]=I1(i[c],l[c]);else i=I1(i,l);if(!Vt(i))return(s==="Element"||s==="BackboneElement")&&(s=n.type[0].code),Array.isArray(i)?i.map(c=>T1(c,s)):T1(i,s)}function T1(e,t){return t==="Resource"&&Oo(e)&&(t=e.resourceType),{type:t,value:e}}function o$(e,t){const n=e.value;if(!n||typeof n!="object")return;let r;if(t in n)r=n[t];else for(const o in V){const i=t+zt(o);if(i in n){r=n[i];break}}if(!Vt(r))return Array.isArray(r)?r.map(oo):oo(r)}function aP(e){const t=[];for(const n of e){let r=!1;for(const o of t)if(ei(uP(n,o))){r=!0;break}r||t.push(n)}return t}function lP(e){return ve(!ei(e))}function cP(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?ve(!1):ve(e.every((n,r)=>ei(uP(n,t[r]))))}function uP(e,t){var o,i;const n=(o=e.value)==null?void 0:o.valueOf(),r=(i=t.value)==null?void 0:i.valueOf();return typeof n=="number"&&typeof r=="number"?ve(Math.abs(n-r)<1e-8):ir(n)&&ir(r)?ve(hP(n,r)):ve(typeof n=="object"&&typeof r=="object"?by(e,t):n===r)}function dP(e,t){return e.length===0&&t.length===0?ve(!0):e.length!==t.length?ve(!1):(e.sort(k1),t.sort(k1),ve(e.every((n,r)=>ei(i$(n,t[r])))))}function i$(e,t){const{type:n,value:r}=e,{type:o,value:i}=t,s=r==null?void 0:r.valueOf(),l=i==null?void 0:i.valueOf();return typeof s=="number"&&typeof l=="number"?ve(Math.abs(s-l)<.01):ir(s)&&ir(l)?ve(hP(s,l)):ve(n==="Coding"&&o==="Coding"?typeof s!="object"||typeof l!="object"?!1:s.code===l.code&&s.system===l.system:typeof s=="object"&&typeof l=="object"?by({...s,id:void 0},{...l,id:void 0}):typeof s=="string"&&typeof l=="string"?s.toLowerCase()===l.toLowerCase():s===l)}function k1(e,t){var o,i;const n=(o=e.value)==null?void 0:o.valueOf(),r=(i=t.value)==null?void 0:i.valueOf();return typeof n=="number"&&typeof r=="number"?n-r:typeof n=="string"&&typeof r=="string"?n.localeCompare(r):0}function fP(e,t){const{value:n}=e;if(n==null)return!1;switch(t){case"Boolean":return typeof n=="boolean";case"Decimal":case"Integer":return typeof n=="number";case"Date":return s$(n);case"DateTime":return Sm(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return a$(n);case"Quantity":return ir(n);default:return typeof n=="object"&&(n==null?void 0:n.resourceType)===t}}function s$(e){return typeof e=="string"&&!!iP.date.exec(e)}function Sm(e){return typeof e=="string"&&!!iP.dateTime.exec(e)}function a$(e){return!!(e&&typeof e=="object"&&("start"in e&&Sm(e.start)||"end"in e&&Sm(e.end)))}function ir(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function hP(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 by(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const i=e[o],s=t[o];if(R1(i)&&R1(s)){if(!by(i,s))return!1}else if(i!==s)return!1}return!0}function R1(e){return e!==null&&typeof e=="object"}function I1(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return l$(e??{},t)}return e}function l$(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function c$(e){return new d$(e).parse()}const pP=aM(ZM),Cy=Object.create(null),D1=Object.create(null);function bm(e){let t;return e?(t=D1[e],t||(t=D1[e]=Object.create(null))):t=pP,t}function _1(e,t){var r;const n=Array.isArray(e)?e:((r=e.entry)==null?void 0:r.map(o=>o.resource))??[];for(const o of n)mP(o,t)}function mP(e,t){if(!(e!=null&&e.name))throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const n=c$(e),r=bm(t);r[e.name]=n,t&&e.url===t&&(Cy[t]=n);for(const o of n.innerTypes)o.parentType=n,r[o.name]=o}function gP(e){return!!pP[e]}function zf(e,t){let n=bm(t)[e];return!n&&t&&(n=bm()[e]),n}function u$(e,t){const n=zf(e,t);if(!n)throw new $e(ci("Unknown data type: "+e));return n}function vP(e){return!!Cy[e]}function Tc(e){return Cy[e]}class d${constructor(t){var n;if(!((n=t.snapshot)!=null&&n.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,title:t.title,type:t.type,url:t.url,kind:t.kind,description:p$(t),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){var n,r,o,i,s;let t=this.next();for(;t;){if(t.sliceName)this.parseSliceStart(t);else if((n=t.id)!=null&&n.includes(":")){if((r=this.slicingContext)!=null&&r.current){const l=ep(t,this.slicingContext.path);this.slicingContext.current.elements[l]=this.parseElementDefinition(t)}}else{const l=this.parseElementDefinition(t);this.checkFieldEnter(t,l);let c=this.backboneContext;for(;c;){if((o=t.path)!=null&&o.startsWith(c.path+".")){c.type.elements[ep(t,c.path)]=l;break}c=c.parent}if(!c){const u=ep(t,this.root.path);t.isSummary&&((i=this.resourceSchema.summaryProperties)==null||i.add(u.replace("[x]",""))),l.min>0&&((s=this.resourceSchema.mandatoryProperties)==null||s.add(u.replace("[x]",""))),this.resourceSchema.elements[u]=l}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),t.slicing&&!this.slicingContext&&this.enterSlice(t,n)}enterInnerType(t){var n,r,o;for(;this.backboneContext&&!_s((n=this.backboneContext)==null?void 0:n.path,t.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;this.backboneContext={type:{name:O1(t),title:t.label,description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path??"",parent:_s((r=this.backboneContext)==null?void 0:r.path,t.path)?this.backboneContext:(o=this.backboneContext)==null?void 0:o.parent}}enterSlice(t,n){var r,o,i,s;h$(t)&&!((r=this.peek())!=null&&r.sliceName)||(n.slicing={discriminator:(((o=t.slicing)==null?void 0:o.discriminator)??[]).map(l=>{if(l.type!=="value"&&l.type!=="pattern"&&l.type!=="type")throw new Error(`Unsupported slicing discriminator type: ${l.type}`);return{path:l.path,type:l.type}}),slices:[],ordered:((i=t.slicing)==null?void 0:i.ordered)??!1,rule:(s=t.slicing)==null?void 0:s.rules},this.slicingContext={field:n.slicing,path:t.path??""})}checkFieldExit(t=void 0){var n;if(this.backboneContext&&!_s(this.backboneContext.path,t==null?void 0:t.path))if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!_s(this.backboneContext.path,t==null?void 0:t.path));else this.innerTypes.push(this.backboneContext.type),delete this.backboneContext;this.slicingContext&&!_s(this.slicingContext.path,t==null?void 0:t.path)&&((n=this.slicingContext)!=null&&n.current&&this.slicingContext.field.slices.push(this.slicingContext.current),delete this.slicingContext)}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=this.elementIndex[t.contentReference.slice(t.contentReference.indexOf("#")+1)];return n?{...n,id:t.id,path:t.path,min:t.min??n.min,max:t.max??n.max,contentReference:t.contentReference,definition:t.definition}:void 0}return t}}isInnerType(t){var r;const n=this.peek();return!!(_s(t==null?void 0:t.path,n==null?void 0:n.path)&&((r=t.type)!=null&&r.some(o=>["BackboneElement","Element"].includes(o.code))))}parseSliceStart(t){if(!this.slicingContext)throw new Error(`Invalid slice start before discriminator: ${t.sliceName} (${t.id})`);this.slicingContext.current&&this.slicingContext.field.slices.push(this.slicingContext.current),this.slicingContext.current={name:t.sliceName??"",path:t.path??"",definition:t.definition,type:this.parseElementDefinitionType(t),elements:{},min:t.min??0,max:t.max==="*"?Number.POSITIVE_INFINITY:Number.parseInt(t.max,10),binding:t.binding}}parseElementDefinitionType(t){return(t.type??[]).map(n=>{var o;let r;return(n.code==="BackboneElement"||n.code==="Element")&&(r=O1(t)),r||(r=(o=Ec(n,"http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"))==null?void 0:o.valueUrl),r||(r=n.code??""),{code:r,targetProfile:n.targetProfile,profile:n.profile}})}parseElementDefinition(t){var i,s;const n=A1(t.max),r=(i=t.base)!=null&&i.max?A1(t.base.max):n,o={type:"ElementDefinition",value:t};return{description:t.definition||"",path:t.path||((s=t.base)==null?void 0:s.path)||"",min:t.min??0,max:n,isArray:r>1,constraints:(t.constraint??[]).map(l=>({key:l.key??"",severity:l.severity??"error",expression:l.expression??"",description:l.human??""})),type:this.parseElementDefinitionType(t),fixed:N1(Kt(o,"fixed[x]")),pattern:N1(Kt(o,"pattern[x]")),binding:t.binding}}}function A1(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function ep(e,t=""){return f$(e.path,t)}function f$(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function _s(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function N1(e){return Array.isArray(e)&&e.length>0?e[0]:Vt(e)?void 0:e}function h$(e){var n,r;const t=(n=e.slicing)==null?void 0:n.discriminator;return!!((r=e.type)!=null&&r.some(o=>o.code==="Extension")&&(t==null?void 0:t.length)===1&&t[0].type==="value"&&t[0].path==="url")}function p$(e){let t=e.description;return t!=null&&t.startsWith(`Base StructureDefinition for ${e.name} Type: `)&&(t=t.substring(`Base StructureDefinition for ${e.name} Type: `.length)),t}const V={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",Expression:"Expression",Extension:"Extension",HumanName:"HumanName",Identifier:"Identifier",MarketingStatus:"MarketingStatus",Meta:"Meta",Money:"Money",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",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"};function m$(e){for(const t of e.base??[]){let n=mi.types[t];n||(n={searchParamsDetails:{}},mi.types[t]=n),n.searchParams||(n.searchParams={_id:{base:[t],code:"_id",type:"token",expression:t+".id"},_lastUpdated:{base:[t],code:"_lastUpdated",type:"date",expression:t+".meta.lastUpdated"},_compartment:{base:[t],code:"_compartment",type:"reference",expression:t+".meta.compartment"},_profile:{base:[t],code:"_profile",type:"uri",expression:t+".meta.profile"},_security:{base:[t],code:"_security",type:"token",expression:t+".meta.security"},_source:{base:[t],code:"_source",type:"uri",expression:t+".meta.source"},_tag:{base:[t],code:"_tag",type:"token",expression:t+".meta.tag"}}),n.searchParams[e.code]=e}}function O1(e){var n,r,o,i;const t=(r=(n=e.type)==null?void 0:n[0])==null?void 0:r.code;return t==="BackboneElement"||t==="Element"?g$((i=((o=e.base)==null?void 0:o.path)??e.path)==null?void 0:i.split(".")):t}function g$(e){return e.length===1?e[0]:e.map(zt).join("")}function Ey(e){var t;return(t=mi.types[e])==null?void 0:t.searchParams}function v$(e,t){var n,r;return(r=(n=mi.types[e])==null?void 0:n.searchParams)==null?void 0:r[t]}function bd(e){const t=e.replaceAll("[x]","").split(".").pop();return yP(t)}function yP(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(x$).join(" ").replace("_"," ").replace(/\s+/g," ")}const y$=new Set(["ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function x$(e){const t=e.toUpperCase();return e===t?e:y$.has(t)?t:t.charAt(0)+e.slice(1)}function ys(e,t,n){const r=zf(e,n);if(r)return w$(r.elements,t)}function w$(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 i=t.slice(0,r)+"[x]",s=e[i];if(s)return s}}}function Oo(e){return!!(e&&typeof e=="object"&&"resourceType"in e)}function xs(e){return!!(e&&typeof e=="object"&&"reference"in e)}const mi={types:{}};function Fu(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 el=()=>[],kn={empty:(e,t)=>ve(t.length===0||t.every(n=>Vt(n.value))),hasValue:(e,t)=>ve(t.length!==0),exists:(e,t,n)=>ve(n?t.filter(r=>ei(n.eval(e,[r]))).length>0:t.length>0&&t.every(r=>!Vt(r.value))),all:(e,t,n)=>ve(t.every(r=>ei(n.eval(e,[r])))),allTrue:(e,t)=>{for(const n of t)if(!n.value)return ve(!1);return ve(!0)},anyTrue:(e,t)=>{for(const n of t)if(n.value)return ve(!0);return ve(!1)},allFalse:(e,t)=>{for(const n of t)if(n.value)return ve(!1);return ve(!0)},anyFalse:(e,t)=>{for(const n of t)if(!n.value)return ve(!0);return ve(!1)},subsetOf:el,supersetOf:el,count:(e,t)=>[{type:V.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)=>ve(t.length===kn.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>ei(n.eval(e,[r]))),select:(e,t,n)=>t.map(r=>n.eval(e,[r])).flat(),repeat:el,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(t.length-1,t.length),tail:(e,t)=>t.length===0?[]:t.slice(1,t.length),skip:(e,t,n)=>{var o;const r=(o=n.eval(e,t)[0])==null?void 0:o.value;if(typeof r!="number")throw new Error("Expected a number for skip(num)");return r>=t.length?[]:r<=0?t:t.slice(r,t.length)},take:(e,t,n)=>{var o;const r=(o=n.eval(e,t)[0])==null?void 0:o.value;if(typeof r!="number")throw new Error("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,t),o=[];for(const i of t)!o.some(s=>s.value===i.value)&&r.some(s=>s.value===i.value)&&o.push(i);return o},exclude:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t),o=[];for(const i of t)r.some(s=>s.value===i.value)||o.push(i);return o},union:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t);return aP([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t);return[...t,...r]},htmlChecks:(e,t,n)=>[oo(!0)],iif:(e,t,n,r,o)=>{const i=n.eval(e,t);if(i.length>1||i.length===1&&typeof i[0].value!="boolean")throw new Error("Expected criterion to evaluate to a Boolean");return ei(i)?r.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);if(typeof n=="boolean")return[{type:V.boolean,value:n}];if(typeof n=="number"&&(n===0||n===1))return ve(!!n);if(typeof n=="string"){const r=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(r))return ve(!0);if(["false","f","no","n","0","0.0"].includes(r))return ve(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:ve(kn.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);return typeof n=="number"?[{type:V.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:V.integer,value:parseInt(n,10)}]:typeof n=="boolean"?[{type:V.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:ve(kn.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:V.date,value:Fu(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:ve(kn.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:V.dateTime,value:Fu(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:ve(kn.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);return typeof n=="number"?[{type:V.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:V.decimal,value:parseFloat(n)}]:typeof n=="boolean"?[{type:V.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:ve(kn.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);return ir(n)?[{type:V.Quantity,value:n}]:typeof n=="number"?[{type:V.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:V.Quantity,value:{value:parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:V.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:ve(kn.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);return n==null?[]:ir(n)?[{type:V.string,value:`${n.value} '${n.unit}'`}]:[{type:V.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:ve(kn.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=qr(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:V.time,value:Fu("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:ve(kn.toTime(e,t).length===1),indexOf:(e,t,n)=>Jn((r,o)=>r.indexOf(o),e,t,n),substring:(e,t,n,r)=>Jn((o,i,s)=>{const l=i,c=s?l+s:o.length;return l<0||l>=o.length?void 0:o.substring(l,c)},e,t,n,r),startsWith:(e,t,n)=>Jn((r,o)=>r.startsWith(o),e,t,n),endsWith:(e,t,n)=>Jn((r,o)=>r.endsWith(o),e,t,n),contains:(e,t,n)=>Jn((r,o)=>r.includes(o),e,t,n),upper:(e,t)=>Jn(n=>n.toUpperCase(),e,t),lower:(e,t)=>Jn(n=>n.toLowerCase(),e,t),replace:(e,t,n,r)=>Jn((o,i,s)=>o.replaceAll(i,s),e,t,n,r),matches:(e,t,n)=>Jn((r,o)=>!!new RegExp(o).exec(r),e,t,n),replaceMatches:(e,t,n,r)=>Jn((o,i,s)=>o.replaceAll(i,s),e,t,n,r),length:(e,t)=>Jn(n=>n.length,e,t),toChars:(e,t)=>Jn(n=>n?n.split(""):void 0,e,t),abs:(e,t)=>Vr(Math.abs,e,t),ceiling:(e,t)=>Vr(Math.ceil,e,t),exp:(e,t)=>Vr(Math.exp,e,t),floor:(e,t)=>Vr(Math.floor,e,t),ln:(e,t)=>Vr(Math.log,e,t),log:(e,t,n)=>Vr((r,o)=>Math.log(r)/Math.log(o),e,t,n),power:(e,t,n)=>Vr(Math.pow,e,t,n),round:(e,t)=>Vr(Math.round,e,t),sqrt:(e,t)=>Vr(Math.sqrt,e,t),truncate:(e,t)=>Vr(n=>n|0,e,t),children:el,descendants:el,trace:(e,t,n)=>t,now:()=>[{type:V.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:V.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:V.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,o)=>{var u;const i=kn.toDateTime(e,n.eval(e,t));if(i.length===0)throw new Error("Invalid start date");const s=kn.toDateTime(e,r.eval(e,t));if(s.length===0)throw new Error("Invalid end date");const l=(u=o.eval(e,t)[0])==null?void 0:u.value;if(l!=="years"&&l!=="months"&&l!=="days")throw new Error("Invalid units");const c=Zj(i[0].value,s[0].value);return[{type:V.Quantity,value:{value:c[l],unit:l}}]},is:(e,t,n)=>{let r="";return n instanceof jy?r=n.name:n instanceof Ty&&(r=n.left.name+"."+n.right.name),r?t.map(o=>({type:V.boolean,value:fP(o,r)})):[]},not:(e,t)=>kn.toBoolean(e,t).map(n=>({type:V.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 i=r;if(i.resource)return oo(i.resource);i.reference?o=i.reference:i.type&&i.identifier&&(o=`${i.type}?identifier=${i.identifier.system}|${i.identifier.value}`)}if(o!=null&&o.includes("?")){const[i]=o.split("?");return{type:i,value:{resourceType:i}}}if(o!=null&&o.includes("/")){const[i,s]=o.split("/");return{type:i,value:{resourceType:i,id:s}}}return{type:V.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:V.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:V.BackboneElement,value:{namespace:"System",name:"Integer"}}:Oo(n)?{type:V.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:V.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(i=>{var s;return{type:V.boolean,value:((s=i.value)==null?void 0:s.resourceType)===o}})}};function Jn(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=qr(n,1);if(typeof o!="string")throw new Error("String function cannot be called with non-string");const i=e(o,...r.map(s=>{var l;return(l=s==null?void 0:s.eval(t,n)[0])==null?void 0:l.value}));return i===void 0?[]:Array.isArray(i)?i.map(oo):[oo(i)]}function Vr(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=qr(n,1),i=ir(o),s=i?o.value:o;if(typeof s!="number")throw new Error("Math function cannot be called with non-number");const l=e(s,...r.map(d=>{var f;return(f=d.eval(t,n)[0])==null?void 0:f.value})),c=i?V.Quantity:n[0].type,u=i?{...o,value:l}:l;return[{type:c,value:u}]}function qr(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}class S${constructor(t,n){this.original=t,this.child=n}eval(t,n){try{return n.length>0?n.map(r=>this.child.eval(t,[r])).flat():this.child.eval(t,[])}catch(r){throw new Error(`FhirPathError on "${this.original}": ${r}`)}}toString(){return this.child.toString()}}class As{constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class jy{constructor(t){this.name=t}eval(t,n){if(this.name==="$this")return n;const r=t.variables[this.name];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==null?void 0:o.value)!==void 0)}evalValue(t){const n=t.value;if(!(!n||typeof n!="object"))return Oo(n)&&n.resourceType===this.name?t:Kt(t,this.name)}toString(){return this.name}}class b${eval(){return[]}toString(){return"{}"}}class C$ extends wO{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 Py extends Cc{constructor(t,n){super("as",t,n)}eval(t,n){return kn.ofType(t,this.left.eval(t,n),this.right)}}class zn extends Cc{}class xr extends zn{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 i=r[0].value,s=o[0].value,l=ir(i)?i.value:i,c=ir(s)?s.value:s,u=this.impl(l,c);return typeof u=="boolean"?ve(u):ir(i)?[{type:V.Quantity,value:{...i,value:u}}]:[oo(u)]}}class E$ extends Cc{constructor(t,n){super("&",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n),i=[...r,...o];return i.length>0&&i.every(s=>typeof s.value=="string")?[{type:V.string,value:i.map(s=>s.value).join("")}]:i}}class j$ extends zn{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return ve(r.some(i=>i.value===o[0].value))}}class P$ extends zn{constructor(t,n){super("in",t,n)}eval(t,n){const r=Eo(this.left.eval(t,n)),o=this.right.eval(t,n);return r?ve(o.some(i=>i.value===r.value)):[]}}class Ty extends Cc{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 xP extends Cc{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return aP([...r,...o])}}class T$ extends zn{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return cP(r,o)}}class k$ extends zn{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return lP(cP(r,o))}}class R$ extends zn{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return dP(r,o)}}class I$ extends zn{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return lP(dP(r,o))}}class ky extends zn{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 ve(fP(r[0],o))}}class D$ extends zn{constructor(t,n){super("and",t,n)}eval(t,n){const r=Eo(this.left.eval(t,n),"boolean"),o=Eo(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!0&&(o==null?void 0:o.value)===!0?ve(!0):(r==null?void 0:r.value)===!1||(o==null?void 0:o.value)===!1?ve(!1):[]}}class _$ extends zn{constructor(t,n){super("or",t,n)}eval(t,n){const r=Eo(this.left.eval(t,n),"boolean"),o=Eo(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!1&&(o==null?void 0:o.value)===!1?ve(!1):r!=null&&r.value||o!=null&&o.value?ve(!0):[]}}class A$ extends zn{constructor(t,n){super("xor",t,n)}eval(t,n){const r=Eo(this.left.eval(t,n),"boolean"),o=Eo(this.right.eval(t,n),"boolean");return!r||!o?[]:ve(r.value!==o.value)}}class N$ extends zn{constructor(t,n){super("implies",t,n)}eval(t,n){const r=Eo(this.left.eval(t,n),"boolean"),o=Eo(this.right.eval(t,n),"boolean");return(o==null?void 0:o.value)===!0||(r==null?void 0:r.value)===!1?ve(!0):!r||!o?[]:ve(!1)}}class Ry{constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=kn[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 Iy{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 i=this.left.eval(t,n);return o in i?[i[o]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const O$=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class M${constructor(t,n,r,o){this.result=[],this.pos={index:0,line:1,column:0},this.markStack=[],this.str=t,this.keywords=n,this.operators=r,this.dateTimeLiterals=!!(o!=null&&o.dateTimeLiterals),this.symbolRegex=(o==null?void 0: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==='"'?this.consumeString(t):t==="`"?this.consumeBacktickSymbol():t==="@"?this.consumeDateTime():/\d/.exec(t)?this.consumeNumber():/\w/.exec(t)?this.consumeSymbol():(t==="$"||t==="%")&&/\w/.exec(n)?this.consumeSymbol():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()!==`
|
|
84
|
+
`))}consumeString(t){this.advance();const n=this.buildToken("String",this.consumeWhile(()=>this.prev()==="\\"||this.curr()!==t));return this.advance(),n}consumeBacktickSymbol(){this.advance();const t=this.buildToken("Symbol",this.consumeWhile(()=>this.curr()!=="`"));return this.advance(),t}consumeDateTime(){this.advance();const t=this.pos.index;this.consumeWhile(()=>/[\d-]/.exec(this.curr()));let n=!1,r=!1;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()))));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()===" "&&$$(this.peekToken())&&(n="Quantity",this.consumeToken()),this.buildToken(n,this.str.substring(t,this.pos.index)))}consumeSymbol(){var n;const t=this.consumeWhile(()=>this.symbolRegex.exec(this.curr()));return((n=this.prevToken())==null?void 0:n.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]}prev(){return this.str[this.pos.index-1]??""}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()===`
|
|
85
|
+
`?(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 $$(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&O$.includes(e.value)))}const L$=["true","false"],F$=["!=","!~","<=",">=","{}","->"];function z$(e){return new M$(e,L$,F$).tokenize()}const Xe={FunctionCall:0,Dot:1,Indexer:2,UnaryAdd:3,UnarySubtract:3,Multiply:4,Divide:4,IntegerDivide: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,Arrow:100,Semicolon:200},B$={parse(e){var n;const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+((n=e.peek())==null?void 0:n.value)+"`");return t}},U$={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new Iy(t,n)},precedence:Xe.Indexer},V$={parse(e,t){if(!(t instanceof jy))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new Ry(t.name,n)},precedence:Xe.FunctionCall};function W$(e){const t=e.split(" "),n=parseFloat(t[0]);let r=t[1];return r!=null&&r.startsWith("'")&&r.endsWith("'")?r=r.substring(1,r.length-1):r="{"+r+"}",{value:n,unit:r}}function H$(){return new SO().registerPrefix("String",{parse:(e,t)=>new As({type:V.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new As({type:V.dateTime,value:Fu(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new As({type:V.Quantity,value:W$(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new As({type:t.value.includes(".")?V.decimal:V.integer,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new As({type:V.boolean,value:!0})}).registerPrefix("false",{parse:()=>new As({type:V.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new jy(t.value)}).registerPrefix("{}",{parse:()=>new b$}).registerPrefix("(",B$).registerInfix("[",U$).registerInfix("(",V$).prefix("+",Xe.UnaryAdd,(e,t)=>new C$("+",t,n=>n)).prefix("-",Xe.UnarySubtract,(e,t)=>new xr("-",t,t,(n,r)=>-r)).infixLeft(".",Xe.Dot,(e,t,n)=>new Ty(e,n)).infixLeft("/",Xe.Divide,(e,t,n)=>new xr("/",e,n,(r,o)=>r/o)).infixLeft("*",Xe.Multiply,(e,t,n)=>new xr("*",e,n,(r,o)=>r*o)).infixLeft("+",Xe.Add,(e,t,n)=>new xr("+",e,n,(r,o)=>r+o)).infixLeft("-",Xe.Subtract,(e,t,n)=>new xr("-",e,n,(r,o)=>r-o)).infixLeft("|",Xe.Union,(e,t,n)=>new xP(e,n)).infixLeft("=",Xe.Equals,(e,t,n)=>new T$(e,n)).infixLeft("!=",Xe.NotEquals,(e,t,n)=>new k$(e,n)).infixLeft("~",Xe.Equivalent,(e,t,n)=>new R$(e,n)).infixLeft("!~",Xe.NotEquivalent,(e,t,n)=>new I$(e,n)).infixLeft("<",Xe.LessThan,(e,t,n)=>new xr("<",e,n,(r,o)=>r<o)).infixLeft("<=",Xe.LessThanOrEquals,(e,t,n)=>new xr("<=",e,n,(r,o)=>r<=o)).infixLeft(">",Xe.GreaterThan,(e,t,n)=>new xr(">",e,n,(r,o)=>r>o)).infixLeft(">=",Xe.GreaterThanOrEquals,(e,t,n)=>new xr(">=",e,n,(r,o)=>r>=o)).infixLeft("&",Xe.Ampersand,(e,t,n)=>new E$(e,n)).infixLeft("and",Xe.And,(e,t,n)=>new D$(e,n)).infixLeft("as",Xe.As,(e,t,n)=>new Py(e,n)).infixLeft("contains",Xe.Contains,(e,t,n)=>new j$(e,n)).infixLeft("div",Xe.Divide,(e,t,n)=>new xr("div",e,n,(r,o)=>r/o|0)).infixLeft("in",Xe.In,(e,t,n)=>new P$(e,n)).infixLeft("is",Xe.Is,(e,t,n)=>new ky(e,n)).infixLeft("mod",Xe.Modulo,(e,t,n)=>new xr("mod",e,n,(r,o)=>r%o)).infixLeft("or",Xe.Or,(e,t,n)=>new _$(e,n)).infixLeft("xor",Xe.Xor,(e,t,n)=>new A$(e,n)).infixLeft("implies",Xe.Implies,(e,t,n)=>new N$(e,n))}const q$=H$();function wP(e){return new S$(e,q$.construct(z$(e)).consumeAndParse())}function G$(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]=oo(n[r]))}return Yl(e,n).map(r=>r.value)}function Yl(e,t,n){const r=n??{};return wP(e).eval({variables:r},t).map(i=>{var s;return{type:i.type,value:(s=i.value)==null?void 0:s.valueOf()}})}var qo=(e=>(e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.QUANTITY="QUANTITY",e.TEXT="TEXT",e.REFERENCE="REFERENCE",e.CANONICAL="CANONICAL",e.DATE="DATE",e.DATETIME="DATETIME",e.PERIOD="PERIOD",e.UUID="UUID",e))(qo||{});function Bf(e,t){var r,o;let n=(o=(r=mi.types[e])==null?void 0:r.searchParamsDetails)==null?void 0:o[t.code];return n||(n=K$(e,t)),n}function Q$(e,t,n){const r=mi.types[e];r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function K$(e,t){const n=t.code,r=J$(n),o=eL(e,t.expression),i={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const l of o){const c=El(l);c.length===1&&c[0]instanceof zn?i.propertyTypes.add("boolean"):SP(i,El(l),e,1)}const s={columnName:r,type:Z$(t,i.propertyTypes),elementDefinitions:i.elementDefinitions,array:i.array};return Q$(e,n,s),s}function SP(e,t,n,r){const o=t[r];if(o instanceof Py){e.propertyTypes.add(o.right.toString());return}if(o instanceof Ry){Y$(e,o);return}const i=o.toString(),s=ys(n,i);if(!s)throw new Error(`Element definition not found for ${n} ${i}`);let l=!1,c=r+1;if(c<t.length&&t[c]instanceof Iy&&(l=!0,c++),s.isArray&&!l&&(e.array=!0),c>=t.length){e.elementDefinitions.push(s);for(const u of s.type)e.propertyTypes.add(u.code);return}for(const u of s.type){let d=u.code;X$(d)&&(d=s.type[0].code),SP(e,t,d,c)}}function Y$(e,t){if(t.name==="as"){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 ky){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function X$(e){return e==="Element"||e==="BackboneElement"}function J$(e){return e.split("-").reduce((t,n,r)=>t+(r?zt(n):n),"")}function Z$(e,t){switch(e.type){case"date":return t.size===1&&t.has(V.date)?"DATE":"DATETIME";case"number":return"NUMBER";case"quantity":return"QUANTITY";case"reference":return t.has(V.canonical)?"CANONICAL":"REFERENCE";case"token":return t.size===1&&t.has(V.boolean)?"BOOLEAN":"TEXT";default:return"TEXT"}}function eL(e,t){const n=[],r=wP(t);return Cm(e,r.child,n),n}function Cm(e,t,n){t instanceof xP?(Cm(e,t.left,n),Cm(e,t.right,n)):t.toString().startsWith(e+".")&&n.push(t)}function El(e){if(e instanceof Py||e instanceof Iy)return[El(e.left),e].flat();if(e instanceof zn)return[e];if(e instanceof Ty)return[El(e.left),El(e.right)].flat();if(e instanceof Ry){if(e.name==="where"&&!(e.args[0]instanceof ky))return[];if(e.name==="last")return[]}return[e]}const Uf=20;var re=(e=>(e.EQUALS="eq",e.NOT_EQUALS="ne",e.GREATER_THAN="gt",e.LESS_THAN="lt",e.GREATER_THAN_OR_EQUALS="ge",e.LESS_THAN_OR_EQUALS="le",e.STARTS_AFTER="sa",e.ENDS_BEFORE="eb",e.APPROXIMATELY="ap",e.CONTAINS="contains",e.EXACT="exact",e.TEXT="text",e.NOT="not",e.ABOVE="above",e.BELOW="below",e.IN="in",e.NOT_IN="not-in",e.OF_TYPE="of-type",e.MISSING="missing",e.IDENTIFIER="identifier",e.ITERATE="iterate",e))(re||{});const bP={contains:"contains",exact:"exact",above:"above",below:"below",text:"text",not:"not",in:"in","not-in":"not-in","of-type":"of-type",missing:"missing",identifier:"identifier",iterate:"iterate"},Dy={eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",sa:"sa",eb:"eb",ap:"ap"};function tL(e,t){if(!e)throw new Error("Invalid search URL");let n="",r;if(typeof e=="string")if(e.includes("?")){const[s,l]=e.split("?");n=s,r=new URLSearchParams(l)}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 i=[];if(r&&i.push(...r.entries()),t)for(const[s,l]of Object.entries(t))if(Array.isArray(l))for(const c of l)i.push([s,c]);else i.push([s,l??""]);return nL(o,i)}function nL(e,t){const n={resourceType:e};for(const[r,o]of t)rL(n,r,o);return n}function rL(e,t,n){var s,l;let r,o;const i=t.indexOf(":");if(i>=0?(r=t.substring(0,i),o=t.substring(i+1)):(r=t,o=""),r==="_has"||t.includes(".")){e.filters=Za(e.filters,{code:t,operator:"eq",value:n});return}switch(r){case"_sort":oL(e,n);break;case"_count":e.count=parseInt(n,10);break;case"_offset":e.offset=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=M1(n);o==="iterate"&&(c.modifier="iterate"),e.include=Za(e.include,c);break}case"_revinclude":{const c=M1(n);o==="iterate"&&(c.modifier="iterate"),e.revInclude=Za(e.revInclude,c);break}case"_fields":case"_elements":e.fields=n.split(",");break;case"_format":e.format=n;break;case"_pretty":e.pretty=n==="true";break;default:{const c=(l=(s=mi.types[e.resourceType])==null?void 0:s.searchParams)==null?void 0:l[r];c?e.filters=Za(e.filters,iL(c,o,n)):e.filters=Za(e.filters,lL(r,o,n))}}}function oL(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})}}function iL(e,t,n){if(t==="missing")return{code:e.code,operator:"missing",value:n};switch(e.type){case"number":case"date":case"quantity":return sL(e,n);case"reference":case"string":case"token":case"uri":return aL(e,t,n);default:throw new Error("Unrecognized search parameter type: "+e.type)}}function sL(e,t){const{operator:n,value:r}=cL(t);return{code:e.code,operator:n,value:r}}function aL(e,t,n){return{code:e.code,operator:uL(t),value:n}}function lL(e,t,n){var o;let r="eq";if(t)r=t;else if(n.length>=2){const i=n.substring(0,2);i in Dy&&(n.length===2||(o=n.at(2))!=null&&o.match(/\d/))&&(r=i,n=n.substring(i.length))}return{code:e,operator:r,value:n}}function cL(e){const t=e.substring(0,2),n=Dy[t];return n?{operator:n,value:e.substring(2)}:{operator:"eq",value:e}}function uL(e){return bP[e]??"eq"}function M1(e){const t=e.split(":");if(t.includes("*"))throw new $e(ci("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new $e(ci(`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 $e(ci(`Invalid include value '${e}'`))}function Qs(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(n=>t.push(dL(n))),e.sortRules&&e.sortRules.length>0&&t.push(fL(e.sortRules)),e.offset!==void 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.include&&e.include.forEach(n=>t.push($1("_include",n))),e.revInclude&&e.revInclude.forEach(n=>t.push($1("_revinclude",n))),t.length===0?"":(t.sort((n,r)=>n.localeCompare(r)),"?"+t.join("&"))}function dL(e){const t=e.operator in bP?":"+e.operator:"",n=e.operator!=="eq"&&e.operator in Dy?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function fL(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function $1(e,t){return e+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function hL(e){if(typeof window<"u")return window.atob(e);if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("binary");throw new Error("Unable to decode base64")}function pL(e){if(typeof window<"u")return window.btoa(e);if(typeof Buffer<"u")return Buffer.from(e,"binary").toString("base64");throw new Error("Unable to encode base64")}function L1(){const e=new Uint32Array(28);return crypto.getRandomValues(e),WO(e.buffer)}async function mL(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function CP(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function EP(e){var o,i,s;const t={};e=ro(e);for(const l of e.entry||[]){((o=l.resource)==null?void 0:o.meta)!==void 0&&(delete l.resource.meta.author,delete l.resource.meta.compartment,delete l.resource.meta.lastUpdated,delete l.resource.meta.project,delete l.resource.meta.versionId);const c=(i=l.resource)==null?void 0:i.id;c&&(t[c]=CP(),l.fullUrl="urn:uuid:"+t[c],(s=l.resource)==null||delete s.id)}const n=e.entry,r=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:n==null?void 0:n.map(l=>({fullUrl:l.fullUrl,request:{method:"POST",url:l.resource.resourceType},resource:l.resource}))},(l,c)=>gL(l,c,t),2);return vL(JSON.parse(r))}function gL(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 vL(e){const t=xL(e),{sorted:n,cycles:r}=yL(t),o={};for(const s of e.entry||[])s.fullUrl&&(o[s.fullUrl]=s);const i=n.map(s=>o[s]);for(const s of r)for(const l of s){const c=o[l],u={...c,request:{...c.request,method:"PUT"}};i.push(u)}return{...e,entry:i}}function yL(e){const t=[],n={},r=[];for(const i of Object.keys(e))n[i]=0;function o(i,s){if(n[i]===2)return!0;if(n[i]===1){const c=s.lastIndexOf(i);return c!==-1&&r.push(s.slice(c)),!0}n[i]=1,s.push(i);let l=!1;for(const c of e[i])o(c,s)||(l=!0);return n[i]=2,s.pop(),t.unshift(i),!l}for(const i in e)n[i]===0&&o(i,[]);return{sorted:t,cycles:r}}function jP(e,t){for(const n in e)if(e[n]&&typeof e[n]=="object"){const r=e[n];if(xs(r)){const o=r.reference;o.startsWith("urn:uuid:")&&t(o)}else jP(r,t)}}function xL(e){const t={};for(const n of e.entry||[])n.fullUrl&&(t[n.fullUrl]=[]);for(const n of e.entry||[]){const r=n.fullUrl;n.resource&&jP(n.resource,o=>{t[o]&&t[o].push(r)})}return t}class PP{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 Wt={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",PNG:"image/png",SVG:"image/svg+xml",TEXT:"text/plain",TYPESCRIPT:"text/typescript",PING:"x-application/ping"};class TP{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];if(n)for(const r of n)r.call(this,t);return!t.defaultPrevented}}class _y{constructor(){this.emitter=new TP}dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,n){this.emitter.addEventListener(t,n)}removeEventListener(t,n){this.emitter.removeEventListener(t,n)}}const Em={"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"},wL=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],Ay=["DiagnosticReport-update"];function SL(e){return Ay.includes(e)}function bL(e){if(Ay.includes(e))throw new $e(gt(`'context.version' is required for '${e}'.`))}const CL={"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"},select:{resourceType:"*",isArray:!0}},"DiagnosticReport-update":{report:{resourceType:"DiagnosticReport"},patient:{resourceType:"Patient",optional:!0},study:{resourceType:"ImagingStudy",optional:!0},updates:{resourceType:"Bundle"}},syncerror:{operationoutcome:{resourceType:"OperationOutcome"}}};function EL(e){return wL.includes(e)}function kP(e){return!!e.endpoint}function F1(e){if(!Ny(e))throw new $e(gt("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:n,topic:r,events:o}=e,i={"hub.channel.type":t,"hub.mode":n,"hub.topic":r,"hub.events":o.join(",")};return kP(e)&&(i.endpoint=e.endpoint),new URLSearchParams(i).toString()}function Ny(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 i of o)if(!Em[i])return!1;return!(kP(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function z1(e,t,n,r){if(typeof t!="object")throw new $e(gt(`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 $e(gt(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new $e(gt(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const o=r.resourceType;if(o!=="*"){if(!EL(t.resourceType))throw new $e(gt(`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 $e(gt(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${o}.`))}}function jL(e,t,n,r,o){if(o.set(t.key,(o.get(t.key)??0)+1),!r.isArray)z1(e,t.resource,n,r);else{const{resources:i}=t;if(!i)throw new $e(gt(`context[${n}] is invalid. context[${n}] for the '${e}' with key '${String(t.key)}' should contain an array of resources on the key 'resources'.`));for(const s of i)z1(e,s,n,r)}}function PL(e,t){const n=new Map,r=CL[e];for(let o=0;o<t.length;o++){const i=t[o].key;if(!r[i])throw new $e(gt(`Key '${i}' not found for event '${e}'. Make sure to add only valid keys.`));jL(e,t[o],o,r[i],n)}for(const[o,i]of Object.entries(r)){if(!(i.optional||n.has(o)))throw new $e(gt(`Missing required key '${o}' on context for '${e}' event.`));if(!i.manyAllowed&&(n.get(o)||0)>1)throw new $e(gt(`${n.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function B1(e,t,n,r){if(!(e&&typeof e=="string"))throw new $e(gt("Must provide a topic."));if(!Em[t])throw new $e(gt(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Em).join(", ")}`));if(typeof n!="object")throw new $e(gt("context must be a context object or array of context objects."));if(Ay.includes(t)&&!r)throw new $e(gt(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(n)?n:[n];return PL(t,o),{timestamp:new Date().toISOString(),id:CP(),event:{"hub.topic":e,"hub.event":t,context:o,...r?{"context.versionId":r}:{}}}}class TL extends _y{constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new $e(gt("Subscription request should contain an endpoint."));if(!Ny(t))throw new $e(gt("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 i=o;i.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:i}),n.send(JSON.stringify({id:o==null?void 0:o.id,timestamp:new Date().toISOString()})))}),n.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=n}disconnect(){this.websocket.close()}}function kL(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=hL(t),r=Array.from(n).reduce((i,s)=>{const l=("00"+s.charCodeAt(0).toString(16)).slice(-2);return`${i}%${l}`},""),o=decodeURIComponent(r);return JSON.parse(o)}function RL(e){return e.split(".").length===3}function Oy(e){const[t,n,r]=e.split(".");return kL(n)}function IL(e){try{return typeof Oy(e).login_id=="string"}catch{return!1}}function DL(e){try{const n=Oy(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}var U1;class wr{constructor(t){this[U1]="ReadablePromise",this.status="pending",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)}}U1=Symbol.toStringTag;class _L{constructor(t){this.storage=t??(typeof localStorage<"u"?localStorage:new AL)}clear(){this.storage.clear()}getString(t){return this.storage.getItem(t)??void 0}setString(t,n){n?this.storage.setItem(t,n):this.storage.removeItem(t)}getObject(t){const n=this.getString(t);return n?JSON.parse(n):void 0}setObject(t,n){this.setString(t,n?Qn(n):void 0)}}class AL{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]}}class NL extends _y{constructor(t){super(),this.bufferedAmount=-1/0,this.extensions="NOT_IMPLEMENTED",this.messageBuffer=[];const n=new WebSocket(t);n.addEventListener("open",()=>{if(this.messageBuffer.length){const r=this.messageBuffer;for(const o of r)n.send(o)}this.dispatchEvent(new Event("open"))}),n.addEventListener("error",r=>{this.dispatchEvent(r)}),n.addEventListener("message",r=>{this.dispatchEvent(r)}),n.addEventListener("close",r=>{this.dispatchEvent(r)}),this.ws=n}get readyState(){return this.ws.readyState}close(){this.ws.close()}send(t){if(this.ws.readyState!==WebSocket.OPEN){this.messageBuffer.push(t);return}try{this.ws.send(t)}catch(n){this.dispatchEvent(new ErrorEvent("error",{error:n,message:n.message})),this.messageBuffer.push(t)}}}class jm extends _y{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 OL{constructor(t){this.criteria=t,this.emitter=new jm(t),this.refCount=1}}class ML{constructor(t,n){if(!(t instanceof RP))throw new $e(gt("First arg of constructor should be a `MedplumClient`"));let r;try{r=new URL(n).toString()}catch{throw new $e(gt("Not a valid URL"))}const o=new NL(r);this.medplum=t,this.ws=o,this.masterSubEmitter=new jm,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.setupWebSocketListeners()}setupWebSocketListeners(){const t=this.ws;t.addEventListener("message",n=>{var r,o,i,s,l;try{const c=JSON.parse(n.data),u=(o=(r=c==null?void 0:c.entry)==null?void 0:r[0])==null?void 0:o.resource;if(u.type==="heartbeat"){(i=this.masterSubEmitter)==null||i.dispatchEvent({type:"heartbeat",payload:c});return}(s=this.masterSubEmitter)==null||s.dispatchEvent({type:"message",payload:c});const d=this.criteriaEntriesBySubscriptionId.get(Lf(u.subscription));if(!d){console.warn("Received notification for criteria the SubscriptionManager is not listening for");return}d.emitter.dispatchEvent({type:"message",payload:c})}catch(c){console.error(c);const u={type:"error",payload:c};(l=this.masterSubEmitter)==null||l.dispatchEvent(u);for(const{emitter:d}of this.criteriaEntries.values())d.dispatchEvent(u)}}),t.addEventListener("error",()=>{var r;const n={type:"error",payload:new $e(DO(new Error("WebSocket error")))};(r=this.masterSubEmitter)==null||r.dispatchEvent(n);for(const{emitter:o}of this.criteriaEntries.values())o.dispatchEvent(n)}),t.addEventListener("close",()=>{var r;const n={type:"close"};this.wsClosed&&((r=this.masterSubEmitter)==null||r.dispatchEvent(n));for(const{emitter:o}of this.criteriaEntries.values())o.dispatchEvent(n)})}emitConnect(t){var r;const n={type:"connect",payload:{subscriptionId:t}};(r=this.masterSubEmitter)==null||r.dispatchEvent(n);for(const{emitter:o}of this.criteriaEntries.values())o.dispatchEvent(n)}emitError(t,n){var o,i,s;const r={type:"error",payload:n};(o=this.masterSubEmitter)==null||o.dispatchEvent(r),(s=(i=this.criteriaEntries.get(t))==null?void 0:i.emitter)==null||s.dispatchEvent(r)}async getTokenForCriteria(t){var s,l;let n=t==null?void 0:t.subscriptionId;n||(n=(await this.medplum.createResource({resourceType:"Subscription",status:"active",reason:`WebSocket subscription for ${lt(this.medplum.getProfile())}`,criteria:t.criteria,channel:{type:"websocket"}})).id);const{parameter:r}=await this.medplum.get(`/fhir/R4/Subscription/${n}/$get-ws-binding-token`),o=(s=r==null?void 0:r.find(c=>c.name==="token"))==null?void 0:s.valueString,i=(l=r==null?void 0:r.find(c=>c.name==="websocket-url"))==null?void 0:l.valueUrl;if(!o)throw new $e(gt("Failed to get token"));if(!i)throw new $e(gt("Failed to get URL from $get-ws-binding-token"));return[n,o]}addCriteria(t){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(t);const n=this.criteriaEntries.get(t);if(n)return n.refCount+=1,n.emitter;const r=new OL(t);return this.criteriaEntries.set(t,r),this.getTokenForCriteria(r).then(([o,i])=>{r.subscriptionId=o,this.criteriaEntriesBySubscriptionId.set(o,r),this.emitConnect(o),this.ws.send(JSON.stringify({type:"bind-with-token",payload:{token:i}}))}).catch(o=>{console.error(o.message),this.emitError(t,o),this.criteriaEntries.delete(t)}),r.emitter}removeCriteria(t){var i,s,l;const n=this.criteriaEntries.get(t);if(!n){console.warn("Criteria not known to `SubscriptionManager`. Possibly called remove too many times.");return}if(n.refCount-=1,n.refCount>0)return;const r=(i=this.criteriaEntries.get(t))==null?void 0:i.subscriptionId,o={type:"disconnect",payload:{subscriptionId:r}};this.masterSubEmitter&&(this.masterSubEmitter._removeCriteria(t),this.masterSubEmitter.dispatchEvent(o)),(l=(s=this.criteriaEntries.get(t))==null?void 0:s.emitter)==null||l.dispatchEvent(o),this.criteriaEntries.delete(t),r&&this.criteriaEntriesBySubscriptionId.delete(r)}closeWebSocket(){this.wsClosed||(this.wsClosed=!0,this.ws.close())}getCriteriaCount(){return this.criteriaEntries.size}getMasterEmitter(){return this.masterSubEmitter||(this.masterSubEmitter=new jm(...Array.from(this.criteriaEntries.keys()))),this.masterSubEmitter}}const $L="3.0.5-443ecc48",LL=Wt.FHIR_JSON+", */*; q=0.1",FL="https://api.medplum.com/",zL=1e3,BL=6e4,UL=0,V1="Binary/",W1={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]};class RP extends TP{constructor(t){if(super(),this.initComplete=!0,t!=null&&t.baseUrl&&!t.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");if(this.options=t??{},this.fetch=(t==null?void 0:t.fetch)??VL(),this.storage=(t==null?void 0:t.storage)??new _L,this.createPdfImpl=t==null?void 0:t.createPdf,this.baseUrl=q1((t==null?void 0:t.baseUrl)??FL),this.fhirBaseUrl=q1(mu(this.baseUrl,(t==null?void 0:t.fhirUrlPath)??"fhir/R4/")),this.authorizeUrl=mu(this.baseUrl,(t==null?void 0:t.authorizeUrl)??"oauth2/authorize"),this.tokenUrl=mu(this.baseUrl,(t==null?void 0:t.tokenUrl)??"oauth2/token"),this.logoutUrl=mu(this.baseUrl,(t==null?void 0:t.logoutUrl)??"oauth2/logout"),this.clientId=(t==null?void 0:t.clientId)??"",this.clientSecret=(t==null?void 0:t.clientSecret)??"",this.onUnauthenticated=t==null?void 0:t.onUnauthenticated,this.cacheTime=(t==null?void 0:t.cacheTime)??(typeof window>"u"?UL:BL),this.cacheTime>0?this.requestCache=new PP((t==null?void 0:t.resourceCacheSize)??zL):this.requestCache=void 0,t!=null&&t.autoBatchTime?(this.autoBatchTime=t.autoBatchTime,this.autoBatchQueue=[]):(this.autoBatchTime=0,this.autoBatchQueue=void 0),t!=null&&t.accessToken)this.setAccessToken(t.accessToken),this.initPromise=Promise.resolve();else if(this.storage.getInitPromise!==void 0){const n=this.storage.getInitPromise(),r=new Promise(o=>{n.then(()=>{this.attemptResumeActiveLogin().then(o).catch(console.error),this.initComplete=!0}).catch(console.error)});this.initPromise=r,this.initComplete=!1}else this.initPromise=this.attemptResumeActiveLogin().catch(console.error);this.setupStorageListener()}get isInitialized(){return this.initComplete}getInitPromise(){return this.initPromise}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}clear(){this.storage.clear(),sessionStorage.clear(),this.clearActiveLogin()}clearActiveLogin(){var t;this.storage.setString("activeLogin",void 0),(t=this.requestCache)==null||t.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){var n;t=t.toString(),(n=this.requestCache)==null||n.delete(t)}invalidateAll(){var t;(t=this.requestCache)==null||t.clear()}invalidateSearches(t){const n=this.fhirBaseUrl+t;if(this.requestCache)for(const r of this.requestCache.keys())(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?o=new Promise((s,l)=>{this.autoBatchQueue.push({method:"GET",url:t.replace(this.fhirBaseUrl,""),options:n,resolve:s,reject:l}),this.autoBatchTimerId||(this.autoBatchTimerId=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime))}):o=this.request("GET",t,n);const i=new wr(o);return this.setCacheEntry(t,i),i}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,Wt.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(window.location.search).get("code");if(!r){await this.requestAuthorization(t);return}return this.processCode(r)}signOutWithRedirect(){window.location.assign(this.logoutUrl)}async signInWithExternalAuth(t,n,r,o,i=!0){let s=o;i&&(s=await this.ensureCodeChallenge(o)),window.location.assign(this.getExternalAuthRedirectUri(t,n,r,s,i))}async exchangeExternalAccessToken(t,n){if(n=n??this.clientId,!n)throw new Error("MedplumClient is missing clientId");const r=new URLSearchParams;return r.set("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),r.set("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),r.set("client_id",n),r.set("subject_token",t),this.fetchTokens(r)}getExternalAuthRedirectUri(t,n,r,o,i=!0){const s=new URL(t);if(s.searchParams.set("response_type","code"),s.searchParams.set("client_id",n),s.searchParams.set("redirect_uri",r),s.searchParams.set("scope",o.scope??"openid profile email"),s.searchParams.set("state",JSON.stringify(o)),i){const{codeChallenge:l,codeChallengeMethod:c}=o;if(!c)throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");if(!l)throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");s.searchParams.set("code_challenge_method",c),s.searchParams.set("code_challenge",l)}return s.toString()}fhirUrl(...t){return new URL(t.join("/"),this.fhirBaseUrl)}fhirSearchUrl(t,n){const r=this.fhirUrl(t);return n&&(r.search=new URLSearchParams(n).toString()),r}search(t,n,r){const o=this.fhirSearchUrl(t,n),i="search-"+o.toString(),s=this.getCacheEntry(i,r);if(s)return s.value;const l=new wr((async()=>{const c=await this.get(o,r);if(c.entry)for(const u of c.entry)this.cacheResource(u.resource);return c})());return this.setCacheEntry(i,l),l}searchOne(t,n,r){const o=this.fhirSearchUrl(t,n);o.searchParams.set("_count","1"),o.searchParams.sort();const i="searchOne-"+o.toString(),s=this.getCacheEntry(i,r);if(s)return s.value;const l=new wr(this.search(t,o.searchParams,r).then(c=>{var u,d;return(d=(u=c.entry)==null?void 0:u[0])==null?void 0:d.resource}));return this.setCacheEntry(i,l),l}searchResources(t,n,r){const i="searchResources-"+this.fhirSearchUrl(t,n).toString(),s=this.getCacheEntry(i,r);if(s)return s.value;const l=new wr(this.search(t,n,r).then(tp));return this.setCacheEntry(i,l),l}async*searchResourcePages(t,n,r){var i,s;let o=this.fhirSearchUrl(t,n);for(;o;){const l=new URL(o).searchParams,c=await this.search(t,l,r),u=(i=c.link)==null?void 0:i.find(d=>d.relation==="next");if(!((s=c.entry)!=null&&s.length)&&!u)break;yield tp(c),o=u!=null&&u.url?new URL(u.url):void 0}}searchValueSet(t,n,r){return this.valueSetExpand({url:t,filter:n},r)}valueSetExpand(t,n){const r=this.fhirUrl("ValueSet","$expand");return r.search=new URLSearchParams(t).toString(),this.get(r.toString(),n)}getCached(t,n){var o,i;const r=(i=(o=this.requestCache)==null?void 0:o.get(this.fhirUrl(t,n).toString()))==null?void 0:i.value;return r!=null&&r.isOk()?r.read():void 0}getCachedReference(t){const n=t.reference;if(!n)return;if(n==="system")return W1;const[r,o]=n.split("/");if(!(!r||!o))return this.getCached(r,o)}readResource(t,n,r){return this.get(this.fhirUrl(t,n),r)}readReference(t,n){const r=t.reference;if(!r)return new wr(Promise.reject(new Error("Missing reference")));if(r==="system")return new wr(Promise.resolve(W1));const[o,i]=r.split("/");return!o||!i?new wr(Promise.reject(new Error("Invalid reference"))):this.readResource(o,i,n)}requestSchema(t){if(gP(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new wr((async()=>{const i=`{
|
|
86
|
+
StructureDefinitionList(name: "${t}") {
|
|
87
|
+
resourceType,
|
|
88
|
+
name,
|
|
89
|
+
kind,
|
|
90
|
+
description,
|
|
91
|
+
type,
|
|
92
|
+
snapshot {
|
|
93
|
+
element {
|
|
94
|
+
id,
|
|
95
|
+
path,
|
|
96
|
+
definition,
|
|
97
|
+
min,
|
|
98
|
+
max,
|
|
99
|
+
base {
|
|
100
|
+
path,
|
|
101
|
+
min,
|
|
102
|
+
max
|
|
103
|
+
},
|
|
104
|
+
contentReference,
|
|
105
|
+
type {
|
|
106
|
+
code,
|
|
107
|
+
profile,
|
|
108
|
+
targetProfile
|
|
109
|
+
},
|
|
110
|
+
binding {
|
|
111
|
+
strength,
|
|
112
|
+
valueSet
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
SearchParameterList(base: "${t}", _count: 100) {
|
|
118
|
+
base,
|
|
119
|
+
code,
|
|
120
|
+
type,
|
|
121
|
+
expression,
|
|
122
|
+
target
|
|
123
|
+
}
|
|
124
|
+
}`.replace(/\s+/g," "),s=await this.graphql(i);_1(s.data.StructureDefinitionList);for(const l of s.data.SearchParameterList)m$(l)})());return this.setCacheEntry(n,o),o}requestProfileSchema(t,n){if(!(n!=null&&n.expandProfile)&&vP(t))return Promise.resolve([t]);const r=t+"-requestSchema"+(n!=null&&n.expandProfile?"-nested":""),o=this.getCacheEntry(r,void 0);if(o)return o.value;const i=new wr((async()=>{if(n!=null&&n.expandProfile){const s=this.fhirUrl("StructureDefinition","$expand-profile");s.search=new URLSearchParams({url:t}).toString();const l=await this.get(s.toString());return tp(l).map(c=>(mP(c,c.url),c.url))}else{const s=await this.searchOne("StructureDefinition",{url:t,_sort:"-_lastUpdated"});return s?(_1([s],t),[t]):(console.warn(`No StructureDefinition found for ${t}!`),[])}})());return this.setCacheEntry(r,i),i}readHistory(t,n,r){return this.get(this.fhirUrl(t,n,"_history"),r)}readVersion(t,n,r,o){return this.get(this.fhirUrl(t,n,"_history",r),o)}readPatientEverything(t,n){return this.get(this.fhirUrl("Patient",t,"$everything"),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){return await this.searchOne(t.resourceType,n,r)??this.createResource(t,r)}async createAttachment(t,n,r,o,i){const s=await this.createBinary(t,n,r,o,i);return{contentType:r,url:s.url,title:n}}createBinary(t,n,r,o,i){const s=this.fhirUrl("Binary");return n&&s.searchParams.set("_filename",n),o?this.uploadwithProgress(s,t,r,o,i):this.post(s,t,r,i)}uploadwithProgress(t,n,r,o,i){return new Promise((s,l)=>{var f;const c=new XMLHttpRequest,u=()=>c.abort();(f=i==null?void 0:i.signal)==null||f.addEventListener("abort",u);const d=h=>{var m;(m=i==null?void 0:i.signal)==null||m.removeEventListener("abort",u),h instanceof Error?l(h):s(h)};c.responseType="json",c.onabort=()=>d(new Error("Request aborted")),c.onerror=()=>d(new Error("Request error")),o&&(c.upload.onprogress=h=>o(h),c.upload.onload=h=>o(h)),c.onload=()=>{c.status>=200&&c.status<300?d(c.response):d(new $e(ut(c.response||c.statusText)))},c.open("POST",t),c.withCredentials=!0,c.setRequestHeader("Authorization","Bearer "+this.accessToken),c.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),c.setRequestHeader("Content-Type",r),c.setRequestHeader("X-Medplum","extended"),c.send(n)})}async createPdf(t,n,r,o){if(!this.createPdfImpl)throw new Error("PDF creation not enabled");const i=await this.createPdfImpl(t,r,o);return this.createBinary(i,n,"application/pdf")}createComment(t,n,r){const o=this.getProfile();let i,s;return t.resourceType==="Encounter"&&(i=bt(t),s=t.subject),t.resourceType==="ServiceRequest"&&(i=t.encounter,s=t.subject),t.resourceType==="Patient"&&(s=bt(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[bt(t)],encounter:i,subject:s,sender:o?bt(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),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),r}patchResource(t,n,r,o){return this.invalidateSearches(t),this.patch(this.fhirUrl(t,n),r,o)}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 i;if(typeof t=="string"){const s=t;i=this.fhirUrl("Bot",s,"$execute")}else{const s=t;i=this.fhirUrl("Bot","$execute"),i.searchParams.set("identifier",s.system+"|"+s.value)}return this.post(i,n,r,o)}executeBatch(t,n){return this.post(this.fhirBaseUrl.slice(0,-1),t,void 0,n)}sendEmail(t,n){return this.post("email/v1/send",t,Wt.JSON,n)}graphql(t,n,r,o){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},Wt.JSON,o)}readResourceGraph(t,n,r,o){return this.get(`${this.fhirUrl(t,n)}/$graph?graph=${r}`,o)}pushToAgent(t,n,r,o,i,s){return this.post(this.fhirUrl("Agent",Lf(t),"$push"),{destination:typeof n=="string"?n:lt(n),body:r,contentType:o,waitForResponse:i},Wt.FHIR_JSON,s)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){var n,r;(!((n=this.sessionDetails)!=null&&n.profile)||lt(this.sessionDetails.profile)!==((r=t.profile)==null?void 0:r.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}setAccessToken(t,n){this.accessToken=t,this.refreshToken=n,this.sessionDetails=void 0,this.accessTokenExpires=DL(t),this.medplumServer=IL(t)}getLogins(){return this.storage.getObject("logins")??[]}addLogin(t){const n=this.getLogins().filter(r=>{var o,i;return((o=r.profile)==null?void 0:o.reference)!==((i=t.profile)==null?void 0:i.reference)});n.push(t),this.storage.setObject("logins",n)}async refreshProfile(){return this.medplumServer?(this.profilePromise=new Promise((t,n)=>{this.get("auth/me").then(r=>{var i,s;this.profilePromise=void 0;const o=((s=(i=this.sessionDetails)==null?void 0:i.profile)==null?void 0:s.id)!==r.profile.id;this.sessionDetails=r,o&&this.dispatchEvent({type:"change"}),t(r.profile)}).catch(n)}),this.profilePromise):Promise.resolve(void 0)}isLoading(){return!!this.profilePromise}isSuperAdmin(){var t;return!!((t=this.sessionDetails)!=null&&t.project.superAdmin)}isProjectAdmin(){var t;return!!((t=this.sessionDetails)!=null&&t.membership.admin)}getProject(){var t;return(t=this.sessionDetails)==null?void 0:t.project}getProjectMembership(){var t;return(t=this.sessionDetails)==null?void 0:t.membership}getProfile(){var t;return(t=this.sessionDetails)==null?void 0:t.profile}async getProfileAsync(){return this.profilePromise?this.profilePromise:this.sessionDetails?this.sessionDetails.profile:this.refreshProfile()}getUserConfiguration(){var t;return(t=this.sessionDetails)==null?void 0:t.config}getAccessPolicy(){var t;return(t=this.sessionDetails)==null?void 0:t.accessPolicy}async download(t,n={}){this.refreshPromise&&await this.refreshPromise;const r=t.toString();return r.startsWith(V1)&&(t=this.fhirUrl(r)),this.addFetchOptionsDefaults(n),(await this.fetchWithRetry(t.toString(),n)).blob()}async uploadMedia(t,n,r,o,i){const s=await this.createBinary(t,r,n);return this.createResource({resourceType:"Media",status:"completed",content:{contentType:n,url:V1+s.id,title:r},...o},i)}async bulkExport(t="",n,r,o){const i=t&&`${t}/`,s=this.fhirUrl(`${i}$export`);return n&&s.searchParams.set("_type",n),r&&s.searchParams.set("_since",r),this.startAsyncRequest(s.toString(),o)}async startAsyncRequest(t,n={}){this.addFetchOptionsDefaults(n);const r=n.headers;return r.Prefer="respond-async",this.request("POST",t,n)}getCacheEntry(t,n){if(!this.requestCache||(n==null?void 0:n.cache)==="no-cache"||(n==null?void 0:n.cache)==="reload")return;const r=this.requestCache.get(t);if(!(!r||r.requestTime+this.cacheTime<Date.now()))return r}setCacheEntry(t,n){this.requestCache&&this.requestCache.set(t,{requestTime:Date.now(),value:n})}cacheResource(t){var n,r;t!=null&&t.id&&!((r=(n=t.meta)==null?void 0:n.tag)!=null&&r.some(o=>o.code==="SUBSETTED"))&&this.setCacheEntry(this.fhirUrl(t.resourceType,t.id).toString(),new wr(Promise.resolve(t)))}deleteCacheEntry(t){this.requestCache&&this.requestCache.delete(t)}async request(t,n,r={},o={}){var f;await this.refreshIfExpired(),r.method=t,this.addFetchOptionsDefaults(r);const i=await this.fetchWithRetry(n,r);if(i.status===401)return this.handleUnauthenticated(t,n,r);if(i.status===204||i.status===304)return;const s=i.headers.get("content-type"),l=s==null?void 0:s.includes("json");if(i.status===404&&!l)throw new $e(IO);const c=await this.parseBody(i,l),u=r.redirect??this.options.redirect;if((i.status===200||i.status===201)&&u==="follow"){const h=await G1(i,c);if(h)return this.request("GET",h,{...r,body:void 0})}const d=(f=r.headers)==null?void 0:f.Prefer;if(i.status===202&&d==="respond-async"){const m=await G1(i,c)??o.statusUrl;if(m)return this.pollStatus(m,r,o)}if(i.status>=400)throw new $e(ut(c));return c}async parseBody(t,n){let r;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=new URL(t,this.baseUrl).href);const r=3,o=200;let i;for(let s=0;s<r;s++){try{if(this.options.verbose&&this.logRequest(t,n),i=await this.fetch(t,n),this.options.verbose&&this.logResponse(i),i.status<500)return i}catch(l){this.retryCatch(s,r,l)}await P1(o)}return i}logRequest(t,n){if(console.log(`> ${n.method} ${t}`),n.headers){const r=n.headers,o=Object.entries(r).sort((i,s)=>i[0].localeCompare(s[0]));for(const[i,s]of o)console.log(`> ${i}: ${s}`)}}logResponse(t){console.log(`< ${t.status} ${t.statusText}`),t.headers&&t.headers.forEach((n,r)=>console.log(`< ${r}: ${n}`))}async pollStatus(t,n,r){return r.pollCount===void 0?(n.redirect="follow",r.statusUrl=t,r.pollCount=1):(await P1(1e3),r.pollCount++),this.request("GET",t,n,r)}async executeAutoBatch(){var o,i;const t=[...this.autoBatchQueue];if(this.autoBatchQueue.length=0,this.autoBatchTimerId=void 0,t.length===1){const s=t[0];try{s.resolve(await this.request(s.method,this.fhirBaseUrl+s.url,s.options))}catch(l){s.reject(new $e(ut(l)))}return}const n={resourceType:"Bundle",type:"batch",entry:t.map(s=>({request:{method:s.method,url:s.url},resource:s.options.body?JSON.parse(s.options.body):void 0}))},r=await this.post(this.fhirBaseUrl.slice(0,-1),n);for(let s=0;s<t.length;s++){const l=t[s],c=(o=r.entry)==null?void 0:o[s];(i=c==null?void 0:c.response)!=null&&i.outcome&&!Yj(c.response.outcome)?l.reject(new $e(c.response.outcome)):l.resolve(c==null?void 0:c.resource)}}addFetchOptionsDefaults(t){let n=t.headers;n||(n={},t.headers=n),n.Accept||(n.Accept=LL),n["X-Medplum"]="extended",t.body&&!n["Content-Type"]&&(n["Content-Type"]=Wt.FHIR_JSON),this.accessToken?n.Authorization="Bearer "+this.accessToken:this.basicAuth&&(n.Authorization="Basic "+this.basicAuth),t.cache||(t.cache="no-cache"),t.credentials||(t.credentials="include")}setRequestContentType(t,n){t.headers||(t.headers={});const r=t.headers;r["Content-Type"]=n}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))}handleUnauthenticated(t,n,r){return this.refresh()?this.request(t,n,r):(this.clearActiveLogin(),this.onUnauthenticated&&this.onUnauthenticated(),Promise.reject(new Error("Unauthenticated")))}async startPkce(){const t=L1();sessionStorage.setItem("pkceState",t);const n=L1();sessionStorage.setItem("codeVerifier",n);const r=await mL(n),o=HO(r).replaceAll("+","-").replaceAll("/","_").replaceAll("=","");return sessionStorage.setItem("codeChallenge",o),{codeChallengeMethod:"S256",codeChallenge:o}}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??H1()),r.searchParams.set("code_challenge_method",n.codeChallengeMethod),r.searchParams.set("code_challenge",n.codeChallenge),r.searchParams.set("scope",n.scope??"openid profile"),window.location.assign(r.toString())}processCode(t,n){const r=new URLSearchParams;if(r.set("grant_type","authorization_code"),r.set("code",t),r.set("client_id",(n==null?void 0:n.clientId)??this.clientId),r.set("redirect_uri",(n==null?void 0:n.redirectUri)??H1()),typeof sessionStorage<"u"){const o=sessionStorage.getItem("codeVerifier");o&&r.set("code_verifier",o)}return this.fetchTokens(r)}refreshIfExpired(){return!this.refreshPromise&&this.accessTokenExpires!==void 0&&this.accessTokenExpires<Date.now()&&this.refresh(),this.refreshPromise??Promise.resolve()}refresh(){if(this.refreshPromise)return this.refreshPromise;if(this.refreshToken){const t=new URLSearchParams;return t.set("grant_type","refresh_token"),t.set("client_id",this.clientId),t.set("refresh_token",this.refreshToken),this.refreshPromise=this.fetchTokens(t),this.refreshPromise}if(this.clientId&&this.clientSecret)return this.refreshPromise=this.startClientLogin(this.clientId,this.clientSecret),this.refreshPromise}async startClientLogin(t,n){this.clientId=t,this.clientSecret=n;const r=new URLSearchParams;return r.set("grant_type","client_credentials"),r.set("client_id",t),r.set("client_secret",n),this.fetchTokens(r)}async startJwtBearerLogin(t,n,r){this.clientId=t;const o=new URLSearchParams;return o.set("grant_type","urn:ietf:params:oauth:grant-type:jwt-bearer"),o.set("client_id",t),o.set("assertion",n),o.set("scope",r),this.fetchTokens(o)}async startJwtAssertionLogin(t){const n=new URLSearchParams;return n.append("grant_type","client_credentials"),n.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),n.append("client_assertion",t),this.fetchTokens(n)}setBasicAuth(t,n){this.clientId=t,this.clientSecret=n,this.basicAuth=pL(t+":"+n)}async fhircastSubscribe(t,n){if(!(typeof t=="string"&&t!==""))throw new $e(gt("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new $e(gt("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},i=(await this.post("/fhircast/STU3",F1(r),Wt.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!i)throw new Error("Invalid response!");return r.endpoint=i,r}async fhircastUnsubscribe(t){if(!Ny(t))throw new $e(gt("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new $e(gt("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post("/fhircast/STU3",F1(t),Wt.FORM_URL_ENCODED)}fhircastConnect(t){return new TL(t)}async fhircastPublish(t,n,r,o){return SL(n)?this.post(`/fhircast/STU3/${t}`,B1(t,n,r,o),Wt.JSON):(bL(n),this.post(`/fhircast/STU3/${t}`,B1(t,n,r),Wt.JSON))}async fhircastGetContext(t){return this.get(`/fhircast/STU3/${t}`)}async invite(t,n){return this.post("admin/projects/"+t+"/invite",n)}async fetchTokens(t){const n={method:"POST",headers:{"Content-Type":Wt.FORM_URL_ENCODED},body:t.toString(),credentials:"include"},r=n.headers;this.basicAuth&&(r.Authorization=`Basic ${this.basicAuth}`);let o;try{o=await this.fetchWithRetry(this.tokenUrl,n)}catch(s){throw this.refreshPromise=void 0,s}if(!o.ok){this.clearActiveLogin();try{const s=await o.json();throw new $e(ci(s.error_description))}catch(s){throw new $e(ci("Failed to fetch tokens"),s)}}const i=await o.json();return await this.verifyTokens(i),this.getProfile()}async verifyTokens(t){const n=t.access_token;if(RL(n)){const r=Oy(n);if(Date.now()>=r.exp*1e3)throw this.clearActiveLogin(),new Error("Token expired");if(r.cid){if(r.cid!==this.clientId)throw this.clearActiveLogin(),new Error("Token was not issued for this audience")}else if(this.clientId&&r.client_id!==this.clientId)throw this.clearActiveLogin(),new Error("Token was not issued for this audience")}return this.setActiveLogin({accessToken:n,refreshToken:t.refresh_token,project:t.project,profile:t.profile})}setupStorageListener(){try{window.addEventListener("storage",t=>{(t.key===null||t.key==="activeLogin")&&window.location.reload()})}catch{}}retryCatch(t,n,r){if(r.message==="Failed to fetch"&&t===1&&this.dispatchEvent({type:"offline"}),t>=n-1)throw r}getSubscriptionManager(){return this.subscriptionManager||(this.subscriptionManager=new ML(this,KO("/ws/subscriptions-r4",this.baseUrl))),this.subscriptionManager}subscribeToCriteria(t){return this.getSubscriptionManager().addCriteria(t)}unsubscribeFromCriteria(t){this.subscriptionManager&&(this.subscriptionManager.removeCriteria(t),this.subscriptionManager.getCriteriaCount()===0&&this.subscriptionManager.closeWebSocket())}getMasterSubscriptionEmitter(){return this.getSubscriptionManager().getMasterEmitter()}}function VL(){if(!globalThis.fetch)throw new Error("Fetch not available in this environment");return globalThis.fetch.bind(globalThis)}function H1(){return typeof window>"u"?"":window.location.protocol+"//"+window.location.host+"/"}function q1(e){return e.endsWith("/")?e:e+"/"}function mu(e,t){return new URL(t,e).toString()}async function G1(e,t){var o,i;const n=e.headers.get("content-location");if(n)return n;const r=e.headers.get("location");if(r)return r;if($f(t)&&((i=(o=t.issue)==null?void 0:o[0])!=null&&i.diagnostics))return t.issue[0].diagnostics}function tp(e){var n;const t=((n=e.entry)==null?void 0:n.map(r=>r.resource))??[];return Object.assign(t,{bundle:e})}function Cd({parentContext:e,path:t,elements:n,profileUrl:r,debugMode:o}){if(t===(e==null?void 0:e.path))return;const i=WL(t,n,e,!!o),s=Object.create(null);for(const[l,c]of Object.entries(i))s[t+"."+l]=c;return{path:t,elements:i,elementsByPath:s,profileUrl:r??(e==null?void 0:e.profileUrl),debugMode:o??(e==null?void 0:e.debugMode)??!1}}function WL(e,t,n,r){const o=Object.create(null);if(n)for(const[s,l]of Object.entries(n.elementsByPath)){const c=Gl(e,s);c!==void 0&&(o[c]=l)}let i=!1;if(t)for(const[s,l]of Object.entries(t))s in o||(o[s]=l,i=!0);return r&&console.assert(i,"Unnecessary ElementsContext; not using any newly provided elements"),o}function IP(e){return e.type!==void 0&&e.type.length>0}function HL(e,t,n,r){var i;const o=t$(e,t.path,{profileUrl:r});if(o){const s=((i=n.typeSchema)==null?void 0:i.elements)??n.elements;return o.some(l=>r$(l,t,n,s))??!1}return console.assert(!1,"getNestedProperty[%s] in isDiscriminatorComponentMatch missed",t.path),!1}function DP(e,t,n,r){var o,i;if(e)for(const s of t){const l={value:e,type:((o=s.typeSchema)==null?void 0:o.name)??((i=s.type)==null?void 0:i[0].code)};if(n.every(c=>{var u;return HL(l,c,s,((u=s.typeSchema)==null?void 0:u.url)??r)}))return s.name}}class qL{constructor(t,n,r){if(t.type===void 0)throw new Error("schema must include a type");this.rootSchema=t;const o=Cd({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[this.elementsContextStack.length-1]}crawlElement(t,n,r){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema);const o=Object.fromEntries(Object.entries(this.elementsContext.elements).filter(([i])=>i.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(!cn(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=GL(t);for(const o of r)this.crawlElementNode(o,n)}crawlElementNode(t,n){var o,i;const r=n+"."+t.key;this.visitor.onEnterElement&&this.visitor.onEnterElement(r,t.element,this.elementsContext);for(const s of t.children)this.crawlElementNode(s,n);cn((i=(o=t.element)==null?void 0:o.slicing)==null?void 0:i.slices)&&this.crawlSlicingImpl(t.element.slicing,r),this.visitor.onExitElement&&this.visitor.onExitElement(r,t.element,this.elementsContext)}prepareSlices(t,n){var i,s;const r=[];for(const l of t){if(!IP(l))continue;const c=(s=(i=l.type.find(u=>cn(u.profile)))==null?void 0:i.profile)==null?void 0:s[0];if(cn(c)){const u=Tc(c);u&&(l.typeSchema=u)}r.push(l)}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 i;const s=(o==null?void 0:o.elements)??t.elements;cn(s)&&(i=Cd({path:n,parentContext:this.elementsContext,elements:s})),i&&this.elementsContextStack.push(i),this.crawlElementsImpl(s,n),i&&this.elementsContextStack.pop(),this.visitor.onExitSlice&&this.visitor.onExitSlice(n,t,r),o&&this.visitor.onExitSchema&&this.visitor.onExitSchema(o)}}function GL(e){const t=[];function n(i,s){return s.startsWith(i+".")}function r(i,s){for(const l of i.children)if(n(l.key,s.key)){r(l,s);return}i.children.push(s)}const o=Object.entries(e);o.sort((i,s)=>i[0].localeCompare(s[0]));for(const[i,s]of o){const l={key:i,element:s,children:[]};let c=!1;for(const u of t)if(n(u.key,i)){r(u,l),c=!0;break}c||t.push(l)}return t}const np="__sliceName";function QL(e,t){const n=new KL(e,e.resourceType,"resource");return new qL(t,n).crawlResource(),n.getDefaultValue()}function Q1(e,t,n){for(const[r,o]of Object.entries(t)){if(n===void 0||n===r){Ed(e,r,o,t);continue}const i=Gl(n,r);i!==void 0&&Ed(e,i,o,t)}return e}class KL{constructor(t,n,r){this.schemaStack=[],this.valueStack=[],this.rootValue=ro(t),this.valueStack.splice(0,this.valueStack.length,{type:r,path:n,values:[this.rootValue]})}get schema(){return this.schemaStack[this.schemaStack.length-1]}get value(){return this.valueStack[this.valueStack.length-1]}onEnterSchema(t){this.schemaStack.push(t)}onExitSchema(){this.schemaStack.pop()}onEnterElement(t,n,r){const o=this.value.values,i=this.value.path,s=Gl(i,t);if(s===void 0)throw new Error(`Expected ${t} to be prefixed by ${i}`);const l=[];for(const c of o){if(c===void 0)continue;const u=Array.isArray(c)?c:[c];for(const d of u){YL(d,s,n,r.elements),Ed(d,s,n,r.elements);const f=Tm(d,s,n,r.elements);f!==void 0&&l.push(f)}}this.valueStack.push({type:"element",path:t,values:l})}onExitElement(t,n,r){if(!this.valueStack.pop())throw new Error("Expected value context to exist when exiting element");const i=Gl(this.value.path,t);if(i===void 0)throw new Error(`Expected ${t} to be prefixed by ${this.value.path}`);for(const s of this.value.values){const l=Tm(s,i,n,r.elements);if(Array.isArray(l))for(let c=l.length-1;c>=0;c--){const u=l[c];cn(u)||l.splice(c,1)}Vt(l)&&Pm(s,void 0,i,n)}}onEnterSlice(t,n,r){const o=this.value.values,i=[];for(const s of o){if(s===void 0)continue;if(!Array.isArray(s))throw new Error("Expected array value for sliced element");const l=this.getMatchingSliceValues(s,n,r);i.push(l)}this.valueStack.push({type:"slice",path:t,values:i})}getMatchingSliceValues(t,n,r){const o=[];for(const i of t)(i[np]??DP(i,[n],r.discriminator,this.schema.url))===n.name&&o.push(i);for(let i=o.length;i<n.min;i++)if(Sy(n.type[0].code)){const s=Object.create(null);o.push(s),t.push(s)}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];np in o&&delete o[np]}}getDefaultValue(){return this.rootValue}}function YL(e,t,n,r){const o=Tm(e,t,n,r);n.min>0&&o===void 0&&Sy(n.type[0].code)&&(n.isArray?Pm(e,[Object.create(null)],t,n):Pm(e,Object.create(null),t,n))}function Pm(e,t,n,r){if(n.includes("."))throw new Error("key cannot be nested");let o=n;if(n.includes("[x]")){const i=r.type[0].code;o=n.replace("[x]",zt(i))}t===void 0?delete e[o]:e[o]=t}function Tm(e,t,n,r){const o=t.split(".");let i=e,s;for(let l=0;l<o.length;l++){let c=o[l];if(c.includes("[x]")){const d=r[o.slice(0,l+1).join(".")].type[0].code;c=c.replace("[x]",zt(d))}if(l===o.length-1){Array.isArray(i)?s=i.map(u=>u[c]):s=i[c];continue}if(Array.isArray(i))i=i.map(u=>u[c]);else if(Pr(i)){if(i[c]===void 0)return;i=i[c]}else return}return s}function Ed(e,t,n,r){if(!(n.fixed||n.pattern))return e;if(Array.isArray(e))return e.map(l=>Ed(l,t,n,r));e==null&&(e=Object.create(null));const o=e,i=t.split(".");let s=o;for(let l=0;l<i.length;l++){let c=i[l];if(c.includes("[x]")){const d=r[i.slice(0,l+1).join(".")].type[0].code;c=c.replace("[x]",zt(d))}if(l===i.length-1){const u=Array.isArray(s)?s:[s];for(const d of u)n.fixed?d[c]??(d[c]=n.fixed.value):n.pattern&&(d[c]=_P(d[c],n.pattern.value))}else{if(!(c in s)){const u=i.slice(0,l+1).join(".");s[c]=r[u].isArray?[Object.create(null)]:Object.create(null)}s=s[c]}}return o}function _P(e,t){if(Array.isArray(t)&&(Array.isArray(e)||e===void 0))return((e==null?void 0:e.length)??0)>0?e:ro(t);if(Pr(t)&&(Pr(e)&&!Array.isArray(e)||e===void 0)){const n=ro(e)??Object.create(null);for(const r of Object.keys(t))n[r]=_P(n[r],t[r]);return n}return e}var AP=p.createContext(void 0);function Vf(){return p.useContext(AP)}function ne(){return Vf().medplum}function Wf(){return Vf().navigate}function Hf(){return Vf().profile}function XL(e){let t=e.medplum,n=e.navigate??JL,[r,o]=p.useState({profile:t.getProfile(),loading:!t.isInitialized});p.useEffect(()=>{t&&(t.isInitialized||(o(s=>({...s,loading:!0})),t.getInitPromise().then(()=>o(s=>({...s,loading:!1}))).catch(console.error)))},[t,t.isInitialized]),p.useEffect(()=>{function s(){o({...r,profile:t.getProfile()})}return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[t,r]);let i=p.useMemo(()=>({...r,medplum:t,navigate:n}),[r,t,n]);return a.jsx(AP.Provider,{value:i,children:e.children})}function JL(e){window.location.assign(e)}var K1=new Map,NP=e=>p.useMemo(()=>{if(!e)return;let 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;let r=n.get("Expires");if(!r||r.length>13)return e;let o=K1.get(t);if(o){let i=new URLSearchParams(new URL(o).search).get("Expires");if(i&&parseInt(i,10)*1e3-5e3>Date.now())return o}return K1.set(t,e),e},[e]);function st(e,t){let n=ne(),[r,o]=p.useState(Y1(n,e)),i=p.useCallback(s=>{jc(s,r)||o(s)},[r,o]);return p.useEffect(()=>{i(Y1(n,e))},[n,e,i]),p.useEffect(()=>{let s=!0;return xs(e)&&n.readReference(e).then(l=>{s&&i(l)}).catch(l=>{s&&(i(void 0),t&&t(ut(l)))}),()=>s=!1},[n,r,e,i,t]),r}function Y1(e,t){if(t){if(Oo(t))return t;if(xs(t))return e.getCachedReference(t)}}function ZL(e,t){return OP("searchOne",e,t)}function ba(e,t){return OP("searchResources",e,t)}function OP(e,t,n){let r=ne(),[o,i]=p.useState(),[s,l]=p.useState(!1),[c,u]=p.useState(),[d,f]=p.useState();return p.useEffect(()=>{let h=r.fhirSearchUrl(t,n).toString();h!==o&&(i(h),r[e](t,n).then(m=>{l(!1),u(m),f(RO)}).catch(m=>{l(!1),u(void 0),f(ut(m))}))},[r,e,t,n,o]),[c,s,d]}function e7(e){const t=e.value;return t?a.jsx(a.Fragment,{children:YO(t)}):null}function X1(e,t){return e.line&&e.line.length>t?e.line[t]:""}function J1(e,t,n){const r=e.line||[];for(;r.length<=t;)r.push("");return r[t]=n,{...e,line:r}}function t7(e){const[t,n]=p.useState(e.defaultValue||{}),r=p.useRef();r.current=t;function o(h){n(h),e.onChange&&e.onChange(h)}function i(h){o({...r.current,use:h})}function s(h){o({...r.current,type:h})}function l(h){o(J1(r.current||{},0,h))}function c(h){o(J1(r.current||{},1,h))}function u(h){o({...r.current,city:h})}function d(h){o({...r.current,state:h})}function f(h){o({...r.current,postalCode:h})}return a.jsxs(Y,{gap:"xs",wrap:"nowrap",grow:!0,children:[a.jsx(xt,{"data-testid":"address-use",defaultValue:t.use,onChange:h=>i(h.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(xt,{"data-testid":"address-type",defaultValue:t.type,onChange:h=>s(h.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(ie,{placeholder:"Line 1",defaultValue:X1(t,0),onChange:h=>l(h.currentTarget.value)}),a.jsx(ie,{placeholder:"Line 2",defaultValue:X1(t,1),onChange:h=>c(h.currentTarget.value)}),a.jsx(ie,{placeholder:"City",defaultValue:t.city,onChange:h=>u(h.currentTarget.value)}),a.jsx(ie,{placeholder:"State",defaultValue:t.state,onChange:h=>d(h.currentTarget.value)}),a.jsx(ie,{placeholder:"Postal Code",defaultValue:t.postalCode,onChange:h=>f(h.currentTarget.value)})]})}function n7(e){const t=Hf(),[n,r]=p.useState(e.defaultValue||{});function o(i){const s=i?{text:i,authorReference:t&&bt(t),time:new Date().toISOString()}:{};r(s),e.onChange&&e.onChange(s)}return a.jsx(ie,{name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:i=>o(i.currentTarget.value)})}var r7={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"},o7=Object.defineProperty,i7=Object.defineProperties,s7=Object.getOwnPropertyDescriptors,jd=Object.getOwnPropertySymbols,MP=Object.prototype.hasOwnProperty,$P=Object.prototype.propertyIsEnumerable,Z1=(e,t,n)=>t in e?o7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ew=(e,t)=>{for(var n in t||(t={}))MP.call(t,n)&&Z1(e,n,t[n]);if(jd)for(var n of jd(t))$P.call(t,n)&&Z1(e,n,t[n]);return e},a7=(e,t)=>i7(e,s7(t)),l7=(e,t)=>{var n={};for(var r in e)MP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jd)for(var r of jd(e))t.indexOf(r)<0&&$P.call(e,r)&&(n[r]=e[r]);return n},pe=(e,t,n)=>{const r=p.forwardRef((o,i)=>{var s=o,{color:l="currentColor",size:c=24,stroke:u=2,children:d}=s,f=l7(s,["color","size","stroke","children"]);return p.createElement("svg",ew(a7(ew({ref:i},r7),{width:c,height:c,stroke:l,strokeWidth:u,className:`tabler-icon tabler-icon-${e}`}),f),[...n.map(([h,m])=>p.createElement(h,m)),...d||[]])});return r.propTypes={color:Ue.string,size:Ue.oneOfType([Ue.string,Ue.number]),stroke:Ue.oneOfType([Ue.string,Ue.number])},r.displayName=`${t}`,r},c7=pe("adjustments-horizontal","IconAdjustmentsHorizontal",[["path",{d:"M14 6m-2 0a2 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:"M8 12m-2 0a2 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:"M17 18m-2 0a2 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"}]]),kc=pe("alert-circle","IconAlertCircle",[["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"}]]),u7=pe("arrow-down","IconArrowDown",[["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"}]]),d7=pe("arrow-up","IconArrowUp",[["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"}]]),f7=pe("bleach-off","IconBleachOff",[["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"}]]),h7=pe("bleach","IconBleach",[["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"}]]),p7=pe("box-multiple","IconBoxMultiple",[["path",{d:"M7 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",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"}]]),m7=pe("brackets-contain","IconBracketsContain",[["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"}]]),g7=pe("brand-asana","IconBrandAsana",[["path",{d:"M12 7m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-0"}],["path",{d:"M17 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M7 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-2"}]]),v7=pe("bucket-off","IconBucketOff",[["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"}]]),y7=pe("bucket","IconBucket",[["path",{d:"M12 7m-8 0a8 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"}]]),x7=pe("building","IconBuilding",[["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"}]]),Ri=pe("calendar","IconCalendar",[["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-12z",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"}]]),qf=pe("check","IconCheck",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]),w7=pe("checkbox","IconCheckbox",[["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"}]]),S7=pe("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),b7=pe("circle-filled","IconCircleFilled",[["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",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),Pd=pe("circle-minus","IconCircleMinus",[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l6 0",key:"svg-1"}]]),Td=pe("circle-plus","IconCirclePlus",[["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"}]]),My=pe("cloud-upload","IconCloudUpload",[["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"}]]),C7=pe("columns","IconColumns",[["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"}]]),LP=pe("copy","IconCopy",[["path",{d:"M7 7m0 2.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.667z",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"}]]),E7=pe("currency-dollar","IconCurrencyDollar",[["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"}]]),j7=pe("device-floppy","IconDeviceFloppy",[["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:"M12 14m-2 0a2 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"}]]),P7=pe("dots","IconDots",[["path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),T7=pe("edit","IconEdit",[["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.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),Rc=pe("equal-not","IconEqualNot",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]]),Ic=pe("equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]),tw=pe("file-alert","IconFileAlert",[["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 2z",key:"svg-1"}],["path",{d:"M12 17l.01 0",key:"svg-2"}],["path",{d:"M12 11l0 3",key:"svg-3"}]]),k7=pe("file-plus","IconFilePlus",[["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 2z",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]]),R7=pe("filter","IconFilter",[["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.227z",key:"svg-0"}]]),I7=pe("forms","IconForms",[["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"}]]),D7=pe("id","IconId",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M9 10m-2 0a2 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"}]]),_7=pe("list-details","IconListDetails",[["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 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-4"}],["path",{d:"M3 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-5"}]]),A7=pe("lock-access","IconLockAccess",[["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 11m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z",key:"svg-4"}],["path",{d:"M10 11v-2a2 2 0 1 1 4 0v2",key:"svg-5"}]]),N7=pe("lock","IconLock",[["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-6z",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"}]]),O7=pe("logout","IconLogout",[["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"}]]),FP=pe("math-greater","IconMathGreater",[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]]),zP=pe("math-lower","IconMathLower",[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]]),M7=pe("message","IconMessage",[["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 -3h12z",key:"svg-2"}]]),$7=pe("microscope","IconMicroscope",[["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 -3z",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"}]]),L7=pe("packages","IconPackages",[["path",{d:"M7 16.5l-5 -3l5 -3l5 3v5.5l-5 3z",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 3z",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"}]]),F7=pe("pin","IconPin",[["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"}]]),z7=pe("pinned-off","IconPinnedOff",[["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"}]]),B7=pe("player-play","IconPlayerPlay",[["path",{d:"M7 4v16l13 -8z",key:"svg-0"}]]),U7=pe("plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),V7=pe("receipt","IconReceipt",[["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"}]]),W7=pe("refresh","IconRefresh",[["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"}]]),H7=pe("report-medical","IconReportMedical",[["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 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z",key:"svg-1"}],["path",{d:"M10 14l4 0",key:"svg-2"}],["path",{d:"M12 12l0 4",key:"svg-3"}]]),q7=pe("router","IconRouter",[["path",{d:"M3 13m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",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"}]]),G7=pe("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]),km=pe("settings","IconSettings",[["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.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),$y=pe("sort-ascending","IconSortAscending",[["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"}]]),Ly=pe("sort-descending","IconSortDescending",[["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"}]]),Q7=pe("square","IconSquare",[["path",{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",key:"svg-0"}]]),K7=pe("star","IconStar",[["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.873z",key:"svg-0"}]]),Y7=pe("switch-horizontal","IconSwitchHorizontal",[["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"}]]),X7=pe("table-export","IconTableExport",[["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"}]]),BP=pe("trash","IconTrash",[["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"}]]),nw=pe("upload","IconUpload",[["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"}]]),J7=pe("webhook","IconWebhook",[["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"}]]),kd=pe("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);class UP extends p.Component{constructor(t){super(t),this.state={lastLocation:window.location.toString()}}static getDerivedStateFromError(t){return{error:t,lastLocation:window.location.toString()}}componentDidUpdate(t,n){window.location.toString()!==this.state.lastLocation&&this.setState({lastLocation:window.location.toString(),error:void 0})}shouldComponentUpdate(t,n){return!!(this.props.children!==t.children||n.error&&!this.state.error||this.state.lastLocation!==window.location.toString())}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.error?a.jsx(hs,{icon:a.jsx(kc,{size:16}),title:"Something went wrong",color:"red",children:Te(this.state.error)}):this.props.children}}function Ar(){return a.jsx(tn,{style:{width:"100%",height:"100vh"},children:a.jsx($n,{})})}const Z7="_main_1szoq_1",e6={main:Z7};function tt(e){e.preventDefault(),e.stopPropagation()}function VP(e){if(rw(e))return!0;if(e instanceof HTMLTableCellElement){const t=e.children;if(t.length===1&&rw(t[0]))return!0}return!1}function rw(e){return e instanceof HTMLInputElement&&e.type==="checkbox"}function Le(e){const t=Wf(),{to:n,suffix:r,label:o,onClick:i,children:s,...l}=e;let c=t6(n);return r&&(c+="/"+r),a.jsx(Ve,{href:c,"aria-label":o,onClick:u=>{tt(u),i?i(u):n&&t(c)},...l,children:s})}function t6(e){if(e){if(typeof e=="string")return n6(e);if(Oo(e))return r6(e);if(xs(e))return o6(e)}return"#"}function n6(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function r6(e){return`/${e.resourceType}/${e.id}`}function o6(e){return`/${e.reference}`}function i6(e){const t=e.split(" ").filter(Boolean);return t.length>1?t[0][0]+t[t.length-1][0]:t.length===1?t[0][0]:""}function Si(e){const t=st(e.value),n=t?Co(t):e.alt??"",r=i6(n),o=(t&&MO(t))??e.src,i=NP(o??void 0),s=e.radius??"xl",l={...e};return delete l.value,delete l.link,e.link?a.jsx(Le,{to:t,children:a.jsx(Ji,{src:i,alt:n,radius:s,...l,children:r})}):a.jsx(Ji,{src:i,alt:n,radius:s,...l,children:r})}const s6="_logoButton_189g3_1",a6="_user_189g3_11",l6="_userName_189g3_21",c6="_userActive_189g3_31",gu={logoButton:s6,user:a6,userName:l6,userActive:c6};function Fy(e){const t=e.value;return t?a.jsx(a.Fragment,{children:Pc(t,e.options)}):null}function u6(e){var c,u,d;const t=Vf(),{medplum:n,profile:r,navigate:o}=t,i=n.getLogins(),{colorScheme:s,setColorScheme:l}=oI();return a.jsxs(a.Fragment,{children:[a.jsxs(Se,{align:"center",p:"xl",children:[a.jsx(Si,{size:"xl",radius:100,value:t.profile}),a.jsx(Fy,{value:(u=(c=t.profile)==null?void 0:c.name)==null?void 0:u[0]}),a.jsx(ae,{c:"dimmed",size:"xs",children:(d=n.getActiveLogin())==null?void 0:d.project.display})]}),i.length>1&&a.jsx(J.Divider,{}),i.map(f=>f.profile.reference!==lt(t.profile)&&a.jsx(J.Item,{onClick:()=>{n.setActiveLogin(f).then(()=>window.location.reload()).catch(console.log)},children:a.jsxs(Y,{children:[a.jsx(Ji,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(ae,{size:"sm",fw:500,children:f.profile.display}),a.jsx(ae,{c:"dimmed",size:"xs",children:f.project.display})]})]})},f.profile.reference)),a.jsx(J.Divider,{}),a.jsx(Y,{justify:"center",children:a.jsx(sy,{size:"xs",value:s,onChange:f=>l(f),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]})}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Y7,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Add another account"}),a.jsx(J.Item,{leftSection:a.jsx(km,{size:14,stroke:1.5}),onClick:()=>o(`/${lt(r)}`),children:"Account settings"}),a.jsx(J.Item,{leftSection:a.jsx(O7,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),o("/signin")},children:"Sign out"}),a.jsx(ae,{size:"xs",c:"dimmed",ta:"center",children:e.version})]})}function zy(e){const t=gf({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{name:n,label:r,description:o,error:i,defaultValue:s,toOption:l,loadOptions:c,itemComponent:u,onChange:d,onCreate:f,creatable:h,clearable:m,required:g,placeholder:v,leftSection:b,maxValues:x,...y}=e,w=d6(s),[S,j]=p.useState(""),[E,P]=p.useState(),[T,k]=p.useState(),[I,O]=p.useState(),[R,M]=p.useState(w.map(l)),[N,B]=p.useState([]),D=u??f6,$=p.useRef();$.current=S;const _=p.useRef(),F=p.useRef(),H=p.useRef();H.current=E;const G=p.useRef();G.current=T;const oe=p.useRef();oe.current=I;const be=p.useRef();be.current=N;const je=p.useCallback(()=>{if(P(void 0),$.current===F.current&&c===_.current)return;F.current=$.current,_.current=c;const X=new AbortController;k(X),c($.current??"",X.signal).then(Pe=>{X.signal.aborted||(B(Pe.map(l)),k(void 0),oe.current?(Pe.length>0&&d(Pe.slice(0,1)),O(!1)):Pe.length>0&&t.openDropdown())}).catch(Pe=>{X.signal.aborted||Pe.message.includes("aborted")||le({color:"red",message:Te(Pe)})})},[t,c,d,l]),Ae=p.useCallback(X=>{N&&N.length>0&&t.openDropdown(),t.updateSelectedOptionIndex(),j(X.currentTarget.value),G.current&&(G.current.abort(),k(void 0)),H.current!==void 0&&window.clearTimeout(H.current);const Pe=window.setTimeout(()=>je(),100);P(Pe)},[t,N,je]),ke=p.useCallback(X=>{const Pe=[],Ne=[...R];let nt=N==null?void 0:N.find(_t=>_t.value===X),Ge=nt==null?void 0:nt.resource;if(!Ge&&h!==!1&&f&&(Ge=f(X),nt=l(Ge)),Ge&&Pe.push(Ge),nt&&Ne.push(nt),x!==void 0)for(;Ne.length>x;)Ne.shift();d(Pe),M(Ne)},[h,N,R,x,d,f,l]),Ie=X=>{j(""),B([]),t.closeDropdown(),F.current=void 0,ke(X==="$create"?S:X)},Qe=p.useCallback(X=>{const Pe=R.filter(Ne=>Ne.value!==X.value);d(Pe.map(Ne=>Ne.resource)),M(Pe)},[R,d]),qe=p.useCallback(X=>{X.key==="Enter"?!E&&!T?(tt(X),N&&N.length>0&&(B(N.slice(0,1)),ke(N[0].value))):O(!0):X.key==="Backspace"&&S.length===0&&(tt(X),Qe(R[R.length-1]))},[S,R,N,E,T,ke,Qe]);p.useEffect(()=>()=>{G.current&&G.current.abort()},[]);const ht=m&&R.length>0&&a.jsx(_e.ClearButton,{title:"Clear all",size:16,onClear:()=>{j(""),M([]),d([]),t.closeDropdown()}});return a.jsxs(_e,{store:t,onOptionSubmit:Ie,withinPortal:!0,shadow:"xl",...y,children:[a.jsx(_e.DropdownTarget,{children:a.jsx(xa,{label:r,description:o,error:i,className:e.className,leftSection:b,rightSection:T?a.jsx($n,{size:16}):ht,required:g,children:a.jsxs(Zi.Group,{children:[R.map(X=>a.jsx(Zi,{withRemoveButton:!0,onRemove:()=>Qe(X),children:X.label},X.value)),(x===void 0||x===0||R.length<x)&&a.jsx(_e.EventsTarget,{children:a.jsx(xa.Field,{role:"searchbox",name:n,value:S,placeholder:v,onFocus:Ae,onBlur:()=>t.closeDropdown(),onKeyDown:qe,onChange:Ae})})]})})}),a.jsx(_e.Dropdown,{children:a.jsxs(_e.Options,{children:[N.map(X=>a.jsx(_e.Option,{value:X.value,active:R.includes(X),children:a.jsx(D,{...X})},X.value)),h&&S.trim().length>0&&a.jsxs(_e.Option,{value:"$create",children:["+ Create ",S]}),!h&&S.trim().length>0&&N.length===0&&a.jsx(_e.Empty,{children:"Nothing found"})]})})]})}function d6(e){return e?Array.isArray(e)?e:[e]:[]}function f6(e){return a.jsx(Y,{gap:"sm",children:a.jsx("span",{children:e.label})})}const h6="_searchInput_dick8_1",p6={searchInput:h6};function m6(e){return{value:e.id,label:Co(e),resource:e}}function g6(e){const t=Wf(),n=ne(),r=p.useCallback(async(i,s)=>{const l=y6(i),c={signal:s},u=await n.graphql(l,void 0,void 0,c);return x6(u,i)},[n]),o=p.useCallback(i=>{i.length>0&&t(`/${lt(i[0])}`)},[t]);return a.jsx(zy,{size:"sm",radius:"md",className:p6.searchInput,leftSection:a.jsx(G7,{size:16}),placeholder:"Search",itemComponent:v6,toOption:m6,onChange:o,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const v6=p.forwardRef(({resource:e,...t},n)=>{var o;let r;return e.resourceType==="Patient"?r=e.birthDate:e.resourceType==="ServiceRequest"&&(r=(o=e.subject)==null?void 0:o.display),a.jsx("div",{ref:n,...t,children:a.jsxs(Y,{wrap:"nowrap",children:[a.jsx(Si,{value:e}),a.jsxs("div",{children:[a.jsx(ae,{children:Co(e)}),a.jsx(ae,{size:"xs",c:"dimmed",children:r})]})]})})});function y6(e){const t=JSON.stringify(e);return eP(e)?`{
|
|
125
|
+
Patients1: PatientList(_id: ${t}, _count: 1) {
|
|
126
|
+
resourceType
|
|
127
|
+
id
|
|
128
|
+
identifier {
|
|
129
|
+
system
|
|
130
|
+
value
|
|
131
|
+
}
|
|
132
|
+
name {
|
|
133
|
+
given
|
|
134
|
+
family
|
|
135
|
+
}
|
|
136
|
+
birthDate
|
|
137
|
+
}
|
|
138
|
+
ServiceRequestList(_id: ${t}, _count: 1) {
|
|
139
|
+
resourceType
|
|
140
|
+
id
|
|
141
|
+
identifier {
|
|
142
|
+
system
|
|
143
|
+
value
|
|
144
|
+
}
|
|
145
|
+
subject {
|
|
146
|
+
display
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}`.replace(/\s+/g," "):`{
|
|
150
|
+
Patients1: PatientList(name: ${t}, _count: 5) {
|
|
151
|
+
resourceType
|
|
152
|
+
id
|
|
153
|
+
identifier {
|
|
154
|
+
system
|
|
155
|
+
value
|
|
156
|
+
}
|
|
157
|
+
name {
|
|
158
|
+
given
|
|
159
|
+
family
|
|
160
|
+
}
|
|
161
|
+
birthDate
|
|
162
|
+
}
|
|
163
|
+
Patients2: PatientList(identifier: ${t}, _count: 5) {
|
|
164
|
+
resourceType
|
|
165
|
+
id
|
|
166
|
+
identifier {
|
|
167
|
+
system
|
|
168
|
+
value
|
|
169
|
+
}
|
|
170
|
+
name {
|
|
171
|
+
given
|
|
172
|
+
family
|
|
173
|
+
}
|
|
174
|
+
birthDate
|
|
175
|
+
}
|
|
176
|
+
ServiceRequestList(identifier: ${t}, _count: 5) {
|
|
177
|
+
resourceType
|
|
178
|
+
id
|
|
179
|
+
identifier {
|
|
180
|
+
system
|
|
181
|
+
value
|
|
182
|
+
}
|
|
183
|
+
subject {
|
|
184
|
+
display
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}`.replace(/\s+/g," ")}function x6(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),S6(w6(n),t).slice(0,5)}function w6(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 S6(e,t){return e.sort((n,r)=>ow(r,t)-ow(n,t))}function ow(e,t){let n=0;if(e.identifier)for(const r of e.identifier)n=Math.max(n,iw(r.value,t));if(e.resourceType==="Patient"&&e.name)for(const r of e.name)n=Math.max(n,iw(Pc(r),t));return n}function iw(e,t){if(!e)return 0;const n=e.toLowerCase().indexOf(t.toLowerCase());return n<0?0:100-n}function b6(e){var o;const t=Hf(),[n,r]=p.useState(!1);return a.jsx(Mn.Header,{p:8,style:{zIndex:101},children:a.jsxs(Y,{justify:"space-between",children:[a.jsxs(Y,{gap:"xs",children:[a.jsx(lr,{className:gu.logoButton,onClick:e.navbarToggle,children:e.logo}),!e.headerSearchDisabled&&a.jsx(g6,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(Y,{gap:"lg",pr:"sm",children:[e.notifications,a.jsxs(J,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"pop-top-right"},opened:n,onClose:()=>r(!1),children:[a.jsx(J.Target,{children:a.jsx(lr,{className:Ze(gu.user,{[gu.userActive]:n}),onClick:()=>r(i=>!i),children:a.jsxs(Y,{gap:7,children:[a.jsx(Si,{value:t,radius:"xl",size:24}),a.jsx(ae,{size:"sm",className:gu.userName,children:Pc((o=t==null?void 0:t.name)==null?void 0:o[0])}),a.jsx(S7,{size:12,stroke:1.5})]})})}),a.jsx(J.Dropdown,{children:a.jsx(u6,{version:e.version})})]})]})]})})}function C6(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?E6(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&j6(t,n);return t}function E6(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function j6(e,t){e[t.name]=t.value}function Be(e){return a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:t=>{t.preventDefault();const n=C6(t.target);e.onSubmit&&e.onSubmit(n)},children:e.children})}function P6(e){const t=ne(),n=t.getUserConfiguration();function r(o){var d,f;const{menuname:i,bookmarkname:s}=o,l=`${e.pathname}?${e.searchParams.toString()}`,c=ro(n),u=(d=c.menu)==null?void 0:d.find(({title:h})=>h===i);(f=u==null?void 0:u.link)==null||f.push({name:s,target:l}),t.updateResource(c).then(h=>{n.menu=h.menu,t.dispatchEvent({type:"change"}),le({color:"green",message:"Success"}),e.onOk()}).catch(h=>{le({color:"red",message:Te(h)})})}return a.jsx(jn,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:a.jsx(Be,{onSubmit:r,children:a.jsxs(Se,{children:[a.jsx(T6,{config:n}),a.jsx(ie,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{mt:"sm",type:"submit",children:"OK"})})]})})})}function T6(e){function t(r){var o;return(o=r==null?void 0:r.menu)==null?void 0:o.map(i=>i.title)}const n=t(e.config);return a.jsx(xt,{name:"menuname",defaultValue:n[0],label:"Select Menu Option",data:n,withAsterisk:!0})}function WP(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function k6(e){return typeof e.display=="string"?e.display:WP(e)}function R6(e){return{value:WP(e),label:k6(e),resource:e}}function I6(e){return{code:e,display:e}}function By(e){const t=ne(),{binding:n,creatable:r,clearable:o,expandParams:i,withHelpText:s,...l}=e,c=p.useCallback(async(u,d)=>{var g;if(!n)return[];const h=(g=(await t.valueSetExpand({...i,url:n,filter:u},{signal:d})).expansion)==null?void 0:g.contains,m=[];for(const v of h)v.code&&!m.some(b=>b.code===v.code)&&m.push(v);return m},[t,i,n]);return a.jsx(zy,{...l,creatable:r??!0,clearable:o??!0,toOption:R6,loadOptions:c,onCreate:I6,itemComponent:s?D6:void 0})}const D6=p.forwardRef(({label:e,resource:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsx(Y,{wrap:"nowrap",children:a.jsxs("div",{children:[a.jsx(ae,{children:e}),a.jsx(ae,{size:"xs",c:"dimmed",children:`${t.system}#${t.code}`})]})})}));function HP(e){const{defaultValue:t,onChange:n,withHelpText:r,...o}=e,[i,s]=p.useState(t);function l(c){const u=c[0],d=A6(u);s(d),n&&n(d)}return a.jsx(By,{defaultValue:_6(i),onChange:l,withHelpText:r??!0,...o})}function _6(e){return e?{code:e}:void 0}function A6(e){return e==null?void 0:e.code}function Uy(e){const[t,n]=p.useState(e.defaultValue),r=e.onChange,o=p.useCallback(i=>{n(i),r&&r(i)},[r]);return a.jsx(HP,{"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 N6="_menuTitle_9g6l5_1",O6="_link_9g6l5_9",M6="_linkActive_9g6l5_38",Rm={menuTitle:N6,link:O6,linkActive:M6};function $6(e){var l;const t=Wf(),n=z6(e.pathname,e.searchParams,e.menus),[r,o]=p.useState(!1);function i(c,u){c.stopPropagation(),c.preventDefault(),t(u),window.innerWidth<768&&e.closeNavbar()}function s(c){c&&t(`/${c}`)}return a.jsxs(a.Fragment,{children:[a.jsx(Mn.Navbar,{children:a.jsxs(hr,{p:"xs",children:[!e.resourceTypeSearchDisabled&&a.jsx(Mn.Section,{mb:"sm",children:a.jsx(Uy,{name:"resourceType",placeholder:"Resource Type",maxValues:0,onChange:c=>s(c)},window.location.pathname)}),a.jsxs(Mn.Section,{grow:!0,children:[(l=e.menus)==null?void 0:l.map(c=>{var u;return a.jsxs(p.Fragment,{children:[a.jsx(ae,{className:Rm.menuTitle,children:c.title}),(u=c.links)==null?void 0:u.map(d=>a.jsxs(L6,{to:d.href,active:d.href===(n==null?void 0:n.href),onClick:f=>i(f,d.href),children:[a.jsx(F6,{to:d.href,icon:d.icon}),a.jsx("span",{children:d.label})]},d.href))]},`menu-${c.title}`)}),e.displayAddBookmark&&a.jsx(ee,{variant:"subtle",size:"xs",mt:"xl",leftSection:a.jsx(U7,{size:"0.75rem"}),onClick:()=>o(!0),children:"Add Bookmark"})]})]})}),e.pathname&&e.searchParams&&a.jsx(P6,{pathname:e.pathname,searchParams:e.searchParams,visible:r,onOk:()=>o(!1),onCancel:()=>o(!1)})]})}function L6(e){return a.jsx(Le,{onClick:e.onClick,to:e.to,className:Ze(Rm.link,{[Rm.linkActive]:e.active}),children:e.children})}function F6(e){return e.icon?e.icon:a.jsx(Mf,{w:30})}function z6(e,t,n){if(!e||!t||!n)return;let r,o=0;for(const i of n)if(i.links)for(const s of i.links){const l=B6(e,t,s.href);l>o&&(o=l,r=s)}return r}function B6(e,t,n){const r=new URL(n,"https://example.com");if(e!==r.pathname)return 0;const o=["_count","_offset"];for(const[s,l]of r.searchParams.entries())if(!o.includes(s)&&t.get(s)!==l)return 0;let i=1;for(const[s,l]of t.entries())o.includes(s)||r.searchParams.get(s)===l&&i++;return i}function U6(e){const[t,n]=p.useState(localStorage.navbarOpen==="true"),r=ne(),o=Hf();p.useEffect(()=>{function c(){le({color:"red",message:"No connection to server",autoClose:!1})}return r.addEventListener("offline",c),()=>r.removeEventListener("offline",c)},[r]);function i(c){localStorage.navbarOpen=c.toString(),n(c)}function s(){i(!1)}function l(){i(!t)}return r.isLoading()?a.jsx(Ar,{}):a.jsxs(Mn,{header:{height:60},navbar:{width:250,breakpoint:"sm",collapsed:{desktop:!o||!t,mobile:!o||!t}},padding:0,children:[o&&a.jsx(b6,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarToggle:l,notifications:e.notifications}),o&&t?a.jsx($6,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,closeNavbar:s,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled}):void 0,a.jsx(Mn.Main,{className:e6.main,children:a.jsx(UP,{children:a.jsx(p.Suspense,{fallback:a.jsx(Ar,{}),children:e.children})})})]})}function Dc(e){const{contentType:t,url:n,title:r}=e.value??{},o=NP(n);return o?a.jsxs("div",{"data-testid":"attachment-display",children:[(t==null?void 0:t.startsWith("image/"))&&a.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:o,alt:r}),(t==null?void 0: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==="application/pdf"&&a.jsx("div",{"data-testid":"attachment-pdf",style:{maxWidth:e.maxWidth,minHeight:400},children:a.jsx("iframe",{width:"100%",height:"400",src:o+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx(Ve,{href:o,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:V6(r),children:r||"Download"})})]}):null}function V6(e){return e!=null&&e.includes(".")?e:void 0}function W6(e){var t;return a.jsx("div",{children:(t=e.values)==null?void 0:t.map((n,r)=>a.jsx("div",{children:a.jsx(Dc,{value:n,maxWidth:e.maxWidth})},"attatchment-"+r))})}function Vy(e){const t=ne(),n=p.useRef(null);function r(s){var l;tt(s),(l=n.current)==null||l.click()}function o(s){tt(s);const l=s.target.files;l&&Array.from(l).forEach(i)}function i(s){if(!s||!s.name)return;e.onUploadStart&&e.onUploadStart();const c=s.name,u=s.type||"application/octet-stream";t.createBinary(s,c,u,e.onUploadProgress).then(d=>{e.onUpload({contentType:d.contentType,url:d.url,title:c})}).catch(d=>{e.onUploadError&&e.onUploadError(ut(d))})}return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"file","data-testid":"upload-file-input",style:{display:"none"},ref:n,onChange:s=>o(s)}),e.children({onClick:r})]})}function H6(e){const[t,n]=p.useState(e.defaultValue??[]),r=p.useRef();r.current=t;function o(i){n(i),e.onChange&&e.onChange(i)}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((i,s)=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Dc,{value:i,maxWidth:200})}),a.jsx("td",{children:a.jsx(Qt,{title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:l=>{tt(l);const c=t.slice();c.splice(s,1),o(c)},children:a.jsx(Pd,{})})})]},`${s}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(Vy,{onUpload:i=>{o([...r.current,i])},children:i=>a.jsx(Qt,{...i,title:"Add",variant:"subtle",size:"sm",color:"green",children:a.jsx(My,{})})})})]})]})]})}function qP(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return t?a.jsxs(a.Fragment,{children:[a.jsx(Dc,{value:t,maxWidth:200}),a.jsx(ee,{onClick:o=>{tt(o),r(void 0)},children:"Remove"})]}):a.jsx(Vy,{onUpload:r,children:o=>a.jsx(ee,{...o,children:"Upload..."})})}const GP=["meta","implicitRules","contained","extension","modifierExtension"],QP=["language","text"],q6="_root_watd4_1",G6="_compact_watd4_14",sw={root:q6,compact:G6};function Wy(e){const{children:t,compact:n}=e;return a.jsx("dl",{className:Ze(sw.root,{[sw.compact]:n}),children:t})}function ia(e){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:e.term}),a.jsx("dd",{children:e.children})]})}function Zr(e){return a.jsx(a.Fragment,{children:Sa(e.value)})}function Q6(e){return a.jsx(a.Fragment,{children:vs(e.value)})}function KP(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 K6(e){var n;const t=e.value;return t?a.jsxs(a.Fragment,{children:[t.name,t.name&&": ",(n=t.telecom)==null?void 0:n.map(r=>a.jsx(KP,{value:r},`telecom-${t.name}-${r.value}`))]}):null}function Y6(e){var t,n;return a.jsxs("div",{children:[(t=e.value)==null?void 0:t.system,": ",(n=e.value)==null?void 0:n.value]})}function X6(e){return a.jsx(a.Fragment,{children:rM(e.value)})}function Xl(e){return a.jsx(a.Fragment,{children:Ho(e.value)})}function Hy(e){return a.jsx(a.Fragment,{children:Ql(e.value)})}function J6(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(Xl,{value:t.numerator})," / ",a.jsx(Xl,{value:t.denominator})]}):null}function Rd(e){if(!e.value)return null;const t=e.value.display||e.value.reference||Qn(e.value);return e.link!==!1&&e.value.reference?a.jsx(Le,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}function Z6(e){const{property:t,values:n}=e,r=t.type[0].code;return e.values?a.jsx(a.Fragment,{children:n.map((o,i)=>a.jsx("div",{children:a.jsx(jo,{arrayElement:!0,property:t,propertyType:r,value:o,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${i}-${n.length}`))}):a.jsx(a.Fragment,{})}function jo(e){var i;const{property:t,propertyType:n,value:r}=e;if((i=t==null?void 0:t.path)==null?void 0:i.endsWith(".id"))return a.jsxs(q,{component:"div",style:{display:"flex",gap:3,alignItems:"center"},children:[r,!Vt(r)&&a.jsx(fj,{value:r,timeout:2e3,children:({copied:s,copy:l})=>a.jsx(Ma,{label:s?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(Qt,{variant:"subtle",color:s?"teal":"gray",onClick:l,children:s?a.jsx(qf,{size:"1rem"}):a.jsx(LP,{size:"1rem"})})})})]});if(t!=null&&t.max&&t.max>1&&!e.arrayElement)return n===V.Attachment?a.jsx(W6,{values:r,maxWidth:e.maxWidth}):a.jsx(Z6,{property:t,values:r,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case V.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case V.SystemString:case V.string:return a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case V.code:case V.date:case V.decimal:case V.id:case V.integer:case V.positiveInt:case V.unsignedInt:case V.uri:case V.url:return a.jsx(a.Fragment,{children:r});case V.canonical:return a.jsx(Rd,{value:{reference:r},link:e.link});case V.dateTime:case V.instant:return a.jsx(a.Fragment,{children:Fn(r)});case V.markdown:return a.jsx("pre",{children:r});case V.Address:return a.jsx(e7,{value:r});case V.Annotation:return a.jsx(a.Fragment,{children:r==null?void 0:r.text});case V.Attachment:return a.jsx(Dc,{value:r,maxWidth:e.maxWidth});case V.CodeableConcept:return a.jsx(Zr,{value:r});case V.Coding:return a.jsx(Q6,{value:r});case V.ContactDetail:return a.jsx(K6,{value:r});case V.ContactPoint:return a.jsx(KP,{value:r});case V.HumanName:return a.jsx(Fy,{value:r});case V.Identifier:return a.jsx(Y6,{value:r});case V.Money:return a.jsx(X6,{value:r});case V.Period:return a.jsx(a.Fragment,{children:JO(r)});case V.Quantity:case V.Duration:return a.jsx(Xl,{value:r});case V.Range:return a.jsx(Hy,{value:r});case V.Ratio:return a.jsx(J6,{value:r});case V.Reference:return a.jsx(Rd,{value:r,link:e.link});case V.Timing:return a.jsx(a.Fragment,{children:nP(r)});case V.Dosage:case V.UsageContext:return a.jsx(Im,{value:{type:n,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues});default:if(!t)throw Error(`Displaying property of type ${e.propertyType} requires element schema`);return a.jsx(Im,{value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function Gf(e,t){const n=Kt(e,t);return n?Array.isArray(n)?[n.map(r=>r.value),n[0].type]:[n.value,n.type]:[void 0,"undefined"]}function e8(e,t,n){const r=sP(e,t,n);return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function Im(e){const t=e.value,n=t.value;if(!n)return null;const r=t.type,o=zf(r);return o?typeof n=="object"&&"name"in n&&Object.keys(n).length===1&&typeof n.name=="string"?a.jsx("div",{children:n.name}):a.jsx(Wy,{compact:e.compact,children:Object.entries(o.elements).map(i=>{const[s,l]=i;if(GP.includes(s)||QP.includes(s)&&l.path.split(".").length===2)return null;const[c,u]=Gf(t,s);return e.ignoreMissingValues&&(!c||Array.isArray(c)&&c.length===0)?null:a.jsx(ia,{term:bd(s),children:a.jsx(jo,{property:l,propertyType:u,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},s)})}):a.jsxs("div",{children:[r," not implemented"]})}const dr=C.createContext({path:"",profileUrl:void 0,elements:Object.create(null),elementsByPath:Object.create(null),debugMode:!1});dr.displayName="ElementsContext";function YP(e){const{debugMode:t}=p.useContext(dr);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,a.jsxs(Y,{wrap:"nowrap","data-testid":e.testId,children:[a.jsx("div",{children:e.children}),a.jsx("div",{children:a.jsx(dt.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,children:null})})]})}function Fe(e,t){var n,r,o;return(o=(r=(n=e==null?void 0:e.issue)==null?void 0:n.filter(i=>{var s;return XP((s=i.expression)==null?void 0:s[0],t)}))==null?void 0:r.map(i=>{var s;return(s=i.details)==null?void 0:s.text}))==null?void 0:o.join(`
|
|
188
|
+
`)}function Qf(e,t){var n;return(n=e==null?void 0:e.issue)==null?void 0:n.filter(r=>{var o;return XP((o=r.expression)==null?void 0:o[0],t)})}function XP(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=e.indexOf(".");if(n>=0&&e.substring(n+1)===t)return!0;const r=t.indexOf(".");return r>=0&&t.substring(r+1)===e}function it(e){const{debugMode:t}=p.useContext(dr);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,a.jsx(dt.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,error:Fe(e.outcome,e.htmlFor),"data-testid":e.testId,children:e.children})}function JP(e,t,n,r,o){const i=r.type;if(i.length>1)for(const s of i){const l=t.replace("[x]",zt(s.code));l in e&&delete e[l]}return e[n]=o,e}function t8(e){return!!e&&!Vt(e.url)&&!Vt(e.name)}function n8(e){const{defaultValue:t,onChange:n,withHelpText:r,...o}=e,[i,s]=p.useState(t);function l(c){const u=o8(c);s(u),n&&n(u)}return a.jsx(By,{defaultValue:i&&r8(i),onChange:l,withHelpText:r??!0,...o})}function r8(e){var t;return(t=e.coding)==null?void 0:t.map(n=>({system:n.system,code:n.code,display:n.display}))}function o8(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function ZP(e){const{defaultValue:t,onChange:n,withHelpText:r,...o}=e,[i,s]=p.useState(t);function l(c){const u=c[0],d=u&&s8(u);s(d),n&&n(d)}return a.jsx(By,{defaultValue:i&&i8(i),maxValues:1,onChange:l,withHelpText:r??!0,...o})}function i8(e){return{system:e.system,code:e.code,display:e.display}}function s8(e){return{system:e.system,code:e.code,display:e.display}}function eT(e){const{path:t,outcome:n}=e,{elementsByPath:r}=p.useContext(dr),[o,i]=p.useState(e.defaultValue),s=p.useRef();s.current=o;const[l,c,u]=p.useMemo(()=>["system","use","value"].map(g=>r[t+"."+g]),[r,t]);function d(g){g&&Object.keys(g).length===0&&(g=void 0),i(g),e.onChange&&e.onChange(g)}function f(g){const v={...s.current,system:g};g||delete v.system,d(v)}function h(g){const v={...s.current,use:g};g||delete v.use,d(v)}function m(g){const v={...s.current,value:g};g||delete v.value,d(v)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(xt,{"data-testid":"system",defaultValue:o==null?void 0:o.system,required:((l==null?void 0:l.min)??0)>0,onChange:g=>f(g.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:Fe(n,t+".system")}),a.jsx(xt,{"data-testid":"use",defaultValue:o==null?void 0:o.use,required:((c==null?void 0:c.min)??0)>0,onChange:g=>h(g.currentTarget.value),data:["","home","work","temp","old","mobile"],error:Fe(n,t+".use")}),a.jsx(ie,{placeholder:"Value",defaultValue:o==null?void 0:o.value,required:((u==null?void 0:u.min)??0)>0,onChange:g=>m(g.currentTarget.value),error:Fe(n,t+".value")})]})}function a8(e){var l;const[t,n]=p.useState(e.defaultValue),r=p.useRef();r.current=t;function o(c){n(c),e.onChange&&e.onChange(c)}function i(c){const u={...r.current,name:c};c||delete u.name,o(u)}function s(c){const u={...r.current,telecom:c&&[c]};c||delete u.telecom,o(u)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ie,{"data-testid":e.name+"-name",name:e.name+"-name",placeholder:"Name",style:{width:180},defaultValue:t==null?void 0:t.name,onChange:c=>i(c.currentTarget.value)}),a.jsx(eT,{name:e.name+"-telecom",path:e.path+".telecom",defaultValue:(l=t==null?void 0:t.telecom)==null?void 0:l[0],onChange:s,outcome:e.outcome})]})}function l8(e){if(!e)return"";const t=new Date(e);return Ff(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function tT(e){if(!e)return"";const t=new Date(e);return Ff(t)?t.toISOString():""}var c8={MEDPLUM_BASE_URL:"__MEDPLUM_BASE_URL__",MEDPLUM_CLIENT_ID:"__MEDPLUM_CLIENT_ID__",GOOGLE_CLIENT_ID:"__GOOGLE_CLIENT_ID__",RECAPTCHA_SITE_KEY:"__RECAPTCHA_SITE_KEY__",MEDPLUM_REGISTER_ENABLED:"__MEDPLUM_REGISTER_ENABLED__",MEDPLUM_VERSION:"3.0.5-443ecc48",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function es(e){return a.jsx(ie,{id:e.name,name:e.name,"data-autofocus":e.autoFocus,"data-testid":e.name,placeholder:e.placeholder,required:e.required,type:u8(),defaultValue:l8(e.defaultValue),autoFocus:e.autoFocus,error:Fe(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(tT(n))}}})}function u8(){return c8.NODE_ENV==="test"?"text":"datetime-local"}function d8(e){const{propertyType:t}=e,n=ne(),[r,o]=p.useState(),i=p.useMemo(()=>{if(cn(t.profile))return t.profile[0]},[t]),[s,l]=p.useState(i!==void 0);return p.useEffect(()=>{i&&(l(!0),n.requestProfileSchema(i).then(()=>{const c=Tc(i);l(!1),o(c)}).catch(c=>{l(!1),console.warn(c)}))},[n,i]),i&&(s||!vP(i))?a.jsx("div",{children:"Loading..."}):a.jsx(Ky,{profileUrl:i,path:e.path,typeName:(r==null?void 0:r.name)??"Extension",defaultValue:e.defaultValue,onChange:e.onChange})}function f8(e){var f,h,m;const{outcome:t,path:n}=e,[r,o]=p.useState(e.defaultValue);function i(g){o(g),e.onChange&&e.onChange(g)}function s(g){i({...r,use:g||void 0})}function l(g){i({...r,prefix:g?g.split(" "):void 0})}function c(g){i({...r,given:g?g.split(" "):void 0})}function u(g){i({...r,family:g||void 0})}function d(g){i({...r,suffix:g?g.split(" "):void 0})}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(xt,{defaultValue:r==null?void 0:r.use,name:e.name+"-use","data-testid":"use",onChange:g=>s(g.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:Fe(t,n+".use")}),a.jsx(ie,{placeholder:"Prefix",name:e.name+"-prefix",defaultValue:(f=r==null?void 0:r.prefix)==null?void 0:f.join(" "),onChange:g=>l(g.currentTarget.value),error:Fe(t,n+".prefix")}),a.jsx(ie,{placeholder:"Given",name:e.name+"-given",defaultValue:(h=r==null?void 0:r.given)==null?void 0:h.join(" "),onChange:g=>c(g.currentTarget.value),error:Fe(t,n+".given")}),a.jsx(ie,{name:e.name+"-family",placeholder:"Family",defaultValue:r==null?void 0:r.family,onChange:g=>u(g.currentTarget.value),error:Fe(t,n+".family")}),a.jsx(ie,{placeholder:"Suffix",name:e.name+"-suffix",defaultValue:(m=r==null?void 0:r.suffix)==null?void 0:m.join(" "),onChange:g=>d(g.currentTarget.value),error:Fe(t,n+".suffix")})]})}function h8(e){const{path:t,outcome:n}=e,[r,o]=p.useState(e.defaultValue),{elementsByPath:i}=p.useContext(dr),[s,l]=p.useMemo(()=>["system","value"].map(u=>i[t+"."+u]),[i,t]);function c(u){o(u),e.onChange&&e.onChange(u)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(ie,{placeholder:"System",required:((s==null?void 0:s.min)??0)>0,defaultValue:r==null?void 0:r.system,onChange:u=>c({...r,system:u.currentTarget.value}),error:Fe(n,t+".system")}),a.jsx(ie,{placeholder:"Value",required:((l==null?void 0:l.min)??0)>0,defaultValue:r==null?void 0:r.value,onChange:u=>c({...r,value:u.currentTarget.value}),error:Fe(n,t+".value")})]})}const p8=["USD","EUR","CAD","GBP","AUD"];function m8(e){var c;const{onChange:t}=e,[n,r]=p.useState(e.defaultValue),o=p.useCallback(u=>{r(u),t&&t(u)},[t]),i=p.useCallback(u=>{o({...n,currency:u.currentTarget.value})},[n,o]),s=p.useCallback(u=>{o({...n,value:u.currentTarget.valueAsNumber})},[n,o]),l=a.jsx(xt,{defaultValue:n==null?void 0:n.currency,data:p8,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:i});return a.jsx(ie,{type:"number",name:e.name,label:e.label,placeholder:e.placeholder??"Value",defaultValue:((c=n==null?void 0:n.value)==null?void 0:c.toString())??"USD",leftSection:a.jsx(E7,{size:14}),rightSection:l,rightSectionWidth:92,onChange:s})}function g8(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(es,{name:e.name+".start",placeholder:"Start",defaultValue:t==null?void 0:t.start,onChange:o=>r({...t,start:o})}),a.jsx(es,{name:e.name+".end",placeholder:"End",defaultValue:t==null?void 0:t.end,onChange:o=>r({...t,end:o})})]})}function ts(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(xt,{style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t==null?void 0:t.comparator,data:["","<","<=",">=",">"],onChange:o=>r({...t,comparator:o.currentTarget.value})}),a.jsx(ie,{id:e.name,name:e.name,required:e.required,"data-autofocus":e.autoFocus,"data-testid":e.name+"-value",type:"number",placeholder:"Value",defaultValue:t==null?void 0:t.value,autoFocus:e.autoFocus,step:"any",onWheel:o=>{e.disableWheel&&o.currentTarget.blur()},onChange:o=>{r({...t,value:v8(o.currentTarget.value)})}}),a.jsx(ie,{placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t==null?void 0:t.unit,onChange:o=>r({...t,unit:o.currentTarget.value})})]})}function v8(e){if(e)return parseFloat(e)}function qy(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ts,{name:e.name+"-low",defaultValue:t==null?void 0:t.low,onChange:o=>r({...t,low:o})}),a.jsx(ts,{name:e.name+"-high",defaultValue:t==null?void 0:t.high,onChange:o=>r({...t,high:o})})]})}function y8(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ts,{name:e.name+"-numerator",defaultValue:t==null?void 0:t.numerator,onChange:o=>r({...t,numerator:o})}),a.jsx(ts,{name:e.name+"-denominator",defaultValue:t==null?void 0:t.denominator,onChange:o=>r({...t,denominator:o})})]})}const x8={Observation:"code",User:"email:contains"},w8=["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","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function S8(e){return{value:lt(e),label:Co(e),resource:e}}function La(e){const t=ne(),{resourceType:n,searchCriteria:r}=e,[o,i]=p.useState(),s=st(e.defaultValue,i),l=e.onChange,c=p.useCallback(async(d,f)=>{const h=C8(n),m=new URLSearchParams({[h]:d??"",_count:"10",...r});return await t.searchResources(n,m,{signal:f})},[t,n,r]),u=p.useCallback(d=>{l&&l(d[0])},[l]);return cn(e.defaultValue)&&!o&&!s?null:a.jsx(zy,{name:e.name,required:e.required,itemComponent:b8,defaultValue:s,placeholder:e.placeholder,maxValues:1,toOption:S8,loadOptions:c,onChange:u,clearable:!0})}const b8=p.forwardRef(({label:e,resource:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs(Y,{wrap:"nowrap",children:[a.jsx(Si,{value:t}),a.jsxs("div",{children:[a.jsx(ae,{children:e}),a.jsx(ae,{size:"xs",c:"dimmed",children:t.birthDate})]})]})}));function C8(e){return x8[e]??(w8.includes(e)?"name":"_id")}function Kf(e){const{onChange:t}=e,n=ne(),[r,o]=p.useState(e.defaultValue),[i,s]=p.useState(()=>E8(e.targetTypes)),[l,c]=p.useState(()=>j8(e.defaultValue,i)),u=p.useRef(new PP),d=p.useMemo(()=>(l==null?void 0:l.type)==="profile"?{...e.searchCriteria,_profile:l.value}:e.searchCriteria,[e.searchCriteria,l]);p.useEffect(()=>{let m=!1;const g=i==null?void 0:i.map(v=>{if(!T8(v))return Promise.resolve(v);m=!0;const b=v.value,x=u.current.get(b);if(x)return x;const y=P8(n,v.value).then(S=>{const j={...v};return S?cn(S.type)?(j.resourceType=S.type,j.name=S.name,j.title=S.title):(console.error(`StructureDefinition.type missing for ${v.value}`),j.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${v.value}`),j.error="StructureDefinition not found"),j}).catch(S=>(console.error(S),{...v,error:S})),w=new wr(y);return u.current.set(b,w),w});!g||!m||Promise.all(g).then(v=>{if(s(v),!l)return;const b=v.findIndex(x=>x.value===l.value||x.resourceType===l.resourceType);if(b===-1){console.debug(`defaultValue had unexpected resourceType: ${l.resourceType}`);return}c(v[b])}).catch(console.error)},[n,l,i]);const f=p.useCallback(m=>{const g=m?bt(m):void 0;o(g),t&&t(g)},[t]),h=p.useMemo(()=>i?i.map(m=>({value:m.value,label:m.type==="profile"?m.title??m.name??m.resourceType??m.value:m.value})):[],[i]);return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[i&&i.length>1&&a.jsx(xt,{"data-autofocus":e.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:l==null?void 0:l.resourceType,autoFocus:e.autoFocus,onChange:m=>{const g=m.currentTarget.value,v=i.find(b=>b.value===g);c(v)},data:h}),!i&&a.jsx(Uy,{autoFocus:e.autoFocus,testId:"reference-input-resource-type-input",defaultValue:l==null?void 0:l.resourceType,onChange:m=>{c(m?{type:"resourceType",value:m,resourceType:m}:void 0)},name:e.name+"-resourceType",placeholder:"Resource Type"}),a.jsx(La,{resourceType:l==null?void 0:l.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:d,onChange:f})]})}function E8(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 j8(e,t){var r;const n=(r=e==null?void 0:e.reference)==null?void 0:r.split("/")[0];if(n){const o=t==null?void 0:t.find(i=>i.resourceType===n);return o||{type:"resourceType",value:n,resourceType:n}}if(t&&t.length>0)return t[0]}async function P8(e,t){const n=Tc(t);if(n)return{type:n.type,name:n.name,title:n.title};const r=`{
|
|
189
|
+
StructureDefinitionList(url: "${t}", _sort: "_lastUpdated", _count: 1) {
|
|
190
|
+
type,
|
|
191
|
+
name,
|
|
192
|
+
title,
|
|
193
|
+
}
|
|
194
|
+
}`.replace(/\s+/g," ");return(await e.graphql(r)).data.StructureDefinitionList[0]}function T8(e){return e.type==="profile"&&!(e!=null&&e.error)&&Vt(e.resourceType)}function nT({propertyDisplayName:e,onClick:t,testId:n}){const r=e?`Add ${e}`:"Add";return e?a.jsx(ee,{title:r,size:"sm",color:"green.6",variant:"subtle","data-testid":n,leftSection:a.jsx(Td,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(Qt,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(Td,{size:"1.25rem"})})}function rT({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(Qt,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,variant:"subtle",onClick:t,children:a.jsx(Pd,{size:"1.25rem"})})}const k8="_indented_ldk1d_1",oT={indented:k8};function iT(e,t,n){return t!==void 0?a.jsx(e,{value:t,children:n}):n}function R8(e){var h,m;const{slice:t,property:n}=e,[r,o]=p.useState(e.defaultValue),i=((h=t.typeSchema)==null?void 0:h.elements)??t.elements,s=p.useContext(dr),l=p.useMemo(()=>{var g;if(cn(i))return Cd({parentContext:s,elements:i,path:e.path,profileUrl:(g=t.typeSchema)==null?void 0:g.url});console.assert(!1,"Expected sliceElements to always be populated",e.path)},[s,e.path,(m=t.typeSchema)==null?void 0:m.url,i]);function c(g){o(g),e.onChange&&e.onChange(g)}const u=t.min>0,d=Vt(t.elements),f=yP(t.name);return iT(dr.Provider,l,a.jsx(it,{title:f,description:t.definition,withAsterisk:u,fhirPath:`${n.path}:${t.name}`,testId:e.testId,children:a.jsxs(Se,{className:d?oT.indented:void 0,children:[r.map((g,v)=>a.jsxs(Y,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},"data-testid":e.testId&&`${e.testId}-elements-${v}`,children:a.jsx(Gy,{elementDefinitionType:t.type[0],name:t.name,defaultValue:g,onChange:b=>{const x=[...r];x[v]=b,c(x)},outcome:e.outcome,min:t.min,max:t.max,binding:t.binding,path:e.path})}),r.length>t.min&&a.jsx(rT,{propertyDisplayName:f,testId:e.testId&&`${e.testId}-remove-${v}`,onClick:b=>{tt(b);const x=[...r];x.splice(v,1),c(x)}})]},`${v}-${r.length}`)),r.length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(nT,{propertyDisplayName:f,onClick:g=>{tt(g);const v=[...r,void 0];c(v)},testId:e.testId&&`${e.testId}-add`})})]})}))}function I8(e,t,n,r){if(!cn(n==null?void 0:n.slices))return[e];const o=new Array(t.length+1);for(let i=0;i<o.length;i++)o[i]=[];for(const i of e){const s=DP(i,t,n.discriminator,r);let l=s?t.findIndex(c=>c.name===s):-1;l===-1&&(l=t.length),o[l].push(i)}for(let i=0;i<t.length;i++){const s=t[i],l=o[i];for(;l.length<s.min;)l.push(void 0)}return o}async function D8({medplum:e,property:t}){return new Promise((n,r)=>{var l,c;if(!t.slicing){n([]);return}const o=[],i=[],s=[];for(const u of t.slicing.slices){if(!IP(u)){console.debug("Unsupported slice definition",u);continue}let d;cn(u.elements)||(d=(c=(l=u.type[0])==null?void 0:l.profile)==null?void 0:c[0]),o.push(u),i.push(d),d?s.push(e.requestProfileSchema(d)):s.push(Promise.resolve([]))}Promise.all(s).then(()=>{for(let u=0;u<o.length;u++){const d=o[u],f=i[u];if(f){const h=Tc(f);d.typeSchema=h}}n(o)}).catch(r)})}function _8(e){var x;const{property:t}=e,n=ne(),[r,o]=p.useState(!0),[i,s]=p.useState([]),[l]=p.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[c,u]=p.useState(()=>[l]),d=p.useContext(dr),f=(x=t.type[0])==null?void 0:x.code;p.useEffect(()=>{D8({medplum:n,property:t}).then(y=>{s(y);const w=I8(l,y,t.slicing,d.profileUrl);u(w),o(!1)}).catch(y=>{console.error(y),o(!1)})},[n,t,l,d.profileUrl,u,e.path]);function h(y,w){const S=[...c];if(S[w]=y,u(S),e.onChange){const j=S.flat().filter(E=>E!==void 0);e.onChange(j)}}if(r)return a.jsx("div",{children:"Loading..."});const m=i.length,g=c[m],v=!(e.hideNonSliceValues??(f==="Extension"&&i.length>0)),b=bd(t.path);return a.jsxs(Se,{className:e.indent?oT.indented:void 0,children:[i.map((y,w)=>a.jsx(R8,{slice:y,path:e.path,property:t,defaultValue:c[w],onChange:S=>{h(S,w)},testId:`slice-${y.name}`},y.name)),v&&g.map((y,w)=>a.jsxs(Y,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Fa,{arrayElement:!0,property:e.property,name:e.name+"."+w,path:e.path,defaultValue:y,onChange:S=>{const j=[...g];j[w]=S,h(j,m)},defaultPropertyType:void 0,outcome:e.outcome})}),a.jsx(rT,{propertyDisplayName:b,testId:`nonsliced-remove-${w}`,onClick:S=>{tt(S);const j=[...g];j.splice(w,1),h(j,m)}})]},`${w}-${g.length}`)),v&&c.flat().length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(nT,{propertyDisplayName:b,onClick:y=>{tt(y);const w=[...g];w.push(void 0),h(w,m)},testId:"nonsliced-add"})})]})}function A8(e){const[t,n]=p.useState(!1),r=ES(),o=p.useRef(null),i={...e.styles};return t||(i.input||(i.input={}),i.input.WebkitTextSecurity="disc"),a.jsxs(Xi,{gap:"xs",children:[a.jsx(ps,{...e,styles:{...i,root:{...i.root??{},flexGrow:1}},ref:o,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(Qt,{title:"Copy secret",onClick:()=>{var s;r.copy((s=o.current)==null?void 0:s.value),le({color:"green",message:"Copied"})},children:a.jsx(LP,{})})]})}const N8=["sun","mon","tue","wed","thu","fri","sat"];function O8(e){const[t,n]=p.useState(e.defaultValue),[r,o]=p.useState(!1),i=p.useRef();return i.current=t,a.jsxs(a.Fragment,{children:[a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx("span",{children:nP(i.current)||"No repeat"}),a.jsx(ee,{onClick:()=>o(!0),children:"Edit"})]}),a.jsx(M8,{visible:r,defaultValue:i.current,onOk:s=>{e.onChange&&e.onChange(s),n(s),o(!1)},onCancel:()=>o(!1)})]})}const aw={repeat:{period:1,periodUnit:"d"}};function M8(e){const[t,n]=p.useState(e.defaultValue||aw),r=p.useRef();r.current=t;function o(u){n({...r.current,event:[u]})}function i(u){n({...r.current,repeat:u})}function s(u){var d;i({...(d=r.current)==null?void 0:d.repeat,period:u})}function l(u){var d;i({...(d=r.current)==null?void 0:d.repeat,periodUnit:u})}function c(u){var d;i({...(d=r.current)==null?void 0:d.repeat,dayOfWeek:u})}return a.jsx(jn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(Se,{children:[a.jsx(it,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(es,{name:"timing-dialog-start",onChange:u=>o(u)})}),a.jsx(wc,{label:"Repeat",checked:!!t.repeat,onChange:u=>i(u.currentTarget.checked?aw.repeat:void 0)}),t.repeat&&a.jsxs(a.Fragment,{children:[a.jsx(it,{title:"Repeat every",htmlFor:"timing-dialog-period",children:a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ie,{type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:u=>s(parseInt(u.currentTarget.value,10)||1)}),a.jsx(xt,{id:"timing-dialog-periodUnit",name:"timing-dialog-periodUnit",defaultValue:t.repeat.periodUnit,onChange:u=>l(u.currentTarget.value),data:[{label:"second",value:"s"},{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(it,{title:"Repeat on",children:a.jsx(Hl.Group,{multiple:!0,onChange:c,children:a.jsx(Y,{justify:"space-between",mt:"md",gap:"xs",children:N8.map(u=>a.jsx(Hl,{value:u,size:"xs",radius:"xl",children:u.charAt(0).toUpperCase()},u))})})})]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function Fa(e){var l;const{property:t,name:n,onChange:r,defaultValue:o}=e,i=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,s=t.type;if((t.isArray||t.max>1)&&!e.arrayElement){if(i===V.Attachment)return a.jsx(H6,{name:n,defaultValue:o,onChange:r});const c=((l=s[0])==null?void 0:l.code)!==V.Extension;return a.jsx(_8,{property:t,name:n,path:e.path,defaultValue:o,indent:c,onChange:r,outcome:e.outcome})}else return s.length>1?a.jsx($8,{elementDefinitionTypes:s,...e}):a.jsx(Gy,{name:n,defaultValue:o,onChange:c=>{if(e.onChange){const u=e.name.replace("[x]",zt(s[0].code));e.onChange(c,u)}},outcome:e.outcome,elementDefinitionType:s[0],min:t.min,max:t.min,binding:t.binding,path:e.path})}function $8(e){const t=e.elementDefinitionTypes;let n;e.defaultPropertyType&&(n=t.find(i=>i.code===e.defaultPropertyType)),n||(n=t[0]);const[r,o]=p.useState(n);return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(xt,{style:{width:"200px"},defaultValue:r.code,"data-testid":e.name&&e.name+"-selector",onChange:i=>{o(t.find(s=>s.code===i.currentTarget.value))},data:t.map(i=>({value:i.code,label:i.code}))}),a.jsx(Gy,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:i=>{e.onChange&&e.onChange(i,e.name.replace("[x]",zt(r.code)))},min:e.property.min,max:e.property.max,binding:e.property.binding,path:e.property.path})]})}function Gy(e){const{name:t,onChange:n,outcome:r,binding:o,path:i}=e,s=e.min!==void 0&&e.min>0,l=e.elementDefinitionType.code,c=p.useContext(dr),u=p.useMemo(()=>{if(!Sy(l)||!Vt(e.defaultValue))return e.defaultValue;const f=Object.create(null);if(c.path===e.path)Q1(f,c.elements);else{const h=Gl(c.path,e.path);if(h===void 0)return e.defaultValue;Q1(f,c.elements,h)}return cn(f)?f:e.defaultValue},[l,c.path,c.elements,e.path,e.defaultValue]);if(!l)return a.jsx("div",{children:"Property type not specified "});const d={name:t,defaultValue:u,onChange:n,outcome:r,path:i};switch(l){case V.SystemString:case V.canonical:case V.string:case V.time:case V.uri:case V.url:return e.path==="Project.secret.value[x]"?a.jsx(A8,{id:t,name:t,"data-testid":t,defaultValue:u,required:s,onChange:f=>{e.onChange&&e.onChange(f.currentTarget.value)},error:Fe(e.outcome,t)}):a.jsx(ie,{id:t,name:t,"data-testid":t,defaultValue:u,required:s,onChange:f=>{n&&n(f.currentTarget.value)},error:Fe(r,t)});case V.date:return a.jsx(ie,{type:"date",id:t,name:t,"data-testid":t,defaultValue:u,required:s,onChange:f=>{n&&n(f.currentTarget.value)},error:Fe(r,t)});case V.dateTime:case V.instant:return a.jsx(es,{name:t,defaultValue:u,onChange:n,outcome:r});case V.decimal:case V.integer:case V.positiveInt:case V.unsignedInt:return a.jsx(ie,{type:"number",step:l===V.decimal?"any":"1",id:t,name:t,"data-testid":t,defaultValue:u,required:s,onChange:f=>{n&&n(f.currentTarget.valueAsNumber)}});case V.code:return a.jsx(HP,{...d,binding:o==null?void 0:o.valueSet});case V.boolean:return a.jsx(ur,{id:t,name:t,"data-testid":t,defaultChecked:!!u,onChange:f=>{n&&n(f.currentTarget.checked)}});case V.base64Binary:case V.markdown:return a.jsx(ps,{id:t,spellCheck:l!==V.base64Binary,name:t,"data-testid":t,defaultValue:u,required:s,onChange:f=>{n&&n(f.currentTarget.value)}});case V.Address:return a.jsx(t7,{...d});case V.Annotation:return a.jsx(n7,{...d});case V.Attachment:return a.jsx(qP,{...d});case V.CodeableConcept:return a.jsx(n8,{binding:o==null?void 0:o.valueSet,...d});case V.Coding:return a.jsx(ZP,{binding:o==null?void 0:o.valueSet,...d});case V.ContactDetail:return a.jsx(a8,{...d});case V.ContactPoint:return a.jsx(eT,{...d});case V.Extension:return a.jsx(d8,{...d,propertyType:e.elementDefinitionType});case V.HumanName:return a.jsx(f8,{...d});case V.Identifier:return a.jsx(h8,{...d});case V.Money:return a.jsx(m8,{...d});case V.Period:return a.jsx(g8,{...d});case V.Duration:case V.Quantity:return a.jsx(ts,{...d});case V.Range:return a.jsx(qy,{...d});case V.Ratio:return a.jsx(y8,{...d});case V.Reference:return a.jsx(Kf,{...d,targetTypes:F8(e.elementDefinitionType)});case V.Timing:return a.jsx(O8,{...d});case V.Dosage:case V.UsageContext:default:return a.jsx(Ky,{typeName:l,path:d.path,defaultValue:u,onChange:n,outcome:r})}}const L8=[`${e$}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function F8(e){var t;return(t=e==null?void 0:e.targetProfile)==null?void 0:t.map(n=>{const r=L8.find(o=>n.startsWith(o));return r?n.slice(r.length):n})}const Qy=new Set(["extension","modifierExtension"]),z8=new Set(["id",...GP].filter(e=>!Qy.has(e)));function B8(e){const[t,n]=p.useState(e.defaultValue??{}),r=p.useContext(dr),o=p.useMemo(()=>U8(r.elements),[r.elements]);function i(l){n(l),e.onChange&&e.onChange(l)}const s={type:e.type,value:t};return a.jsx(Se,{style:{flexGrow:1},"data-testid":e.testId,children:o.map(([l,c])=>{const[u,d]=e8(s,l,c),f=c.min!==void 0&&c.min>0,h=a.jsx(Fa,{property:c,name:l,path:e.path+"."+l,defaultValue:u,defaultPropertyType:d,onChange:(m,g)=>{i(JP({...t},l,g??l,c,m))},arrayElement:void 0,outcome:e.outcome},l);return e.type==="Extension"||Qy.has(l)?h:c.type.length===1&&c.type[0].code==="boolean"?a.jsx(YP,{title:bd(l),description:c.description,htmlFor:l,fhirPath:c.path,withAsterisk:f,children:h},l):a.jsx(it,{title:bd(l),description:c.description,withAsterisk:f,htmlFor:l,outcome:e.outcome,fhirPath:c.path,children:h},l)})})}function U8(e){return Object.entries(e).filter(([n,r])=>{var o;return!cn(r.type)||r.max===0||r.path.toLowerCase().endsWith("extension.url")&&r.fixed||Qy.has(n)&&!cn((o=r.slicing)==null?void 0:o.slices)||z8.has(n)?!1:!(QP.includes(n)&&r.path.split(".").length===2||n.includes("."))})}function Ky(e){const[t]=p.useState(()=>e.defaultValue??{}),n=p.useContext(dr),r=e.profileUrl??(n==null?void 0:n.profileUrl),o=p.useMemo(()=>zf(e.typeName,r),[e.typeName,r]),i=(o==null?void 0:o.type)??e.typeName,s=p.useMemo(()=>{if(o)return Cd({parentContext:n,elements:o.elements,path:e.path,profileUrl:o.url})},[o,e.path,n]);return o?iT(dr.Provider,s,a.jsx(B8,{path:e.path,type:i,defaultValue:t,onChange:e.onChange,outcome:e.outcome})):a.jsxs("div",{children:[i," not implemented"]})}const V8="_root_1vii2_1",W8={root:V8};function _c(e){const{children:t,...n}=e;return a.jsx(Bv,{className:W8.root,...n,children:t})}const H8="_noteBody_10swh_1",q8="_noteCite_10swh_5",G8="_noteRoot_10swh_10",lw={noteBody:H8,noteCite:q8,noteRoot:G8};function sT({value:e}){return e?a.jsx(Se,{justify:"flex-start",gap:"xs",children:e.map(t=>{var n;return t.text&&a.jsx(Fv,{classNames:{cite:lw.noteCite,root:lw.noteRoot},cite:((n=t.authorReference)==null?void 0:n.display)||t.authorString,icon:null,children:t.text},`note-${t.text}`)})}):null}function za(e){const{value:t,link:n,...r}=e,[o,i]=p.useState(),s=st(t,i);let l;if(o&&!Yj(o))l=`[${Te(o)}]`;else if(s)l=Co(s);else return null;return n?a.jsx(Le,{to:t,...r,children:l}):a.jsx(ae,{component:"span",...r,children:l})}function sa(e){return a.jsxs(Y,{gap:"xs",children:[a.jsx(Si,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(za,{value:e.value,link:e.link})]})}const Q8={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"};function aT(e){return a.jsx(mc,{color:Q8[e.status],children:e.status})}const K8="_table_pe9td_1",Y8="_criticalRow_pe9td_12",X8="_noteBody_pe9td_23",J8="_noteCite_pe9td_27",Z8="_noteRoot_pe9td_32",lT={table:K8,criticalRow:Y8,noteBody:X8,noteCite:J8,noteRoot:Z8};Yy.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1};function Yy(e){var s;const t=ne(),n=st(e.value),[r,o]=p.useState();if(p.useEffect(()=>{n!=null&&n.specimen&&Promise.allSettled(n.specimen.map(l=>t.readReference(l))).then(l=>l.filter(c=>c.status==="fulfilled").map(c=>c.value)).then(o).catch(console.error)},[t,n]),!n)return null;const i=(r==null?void 0:r.flatMap(l=>l.note||[]))||[];if(n.presentedForm&&n.presentedForm.length>0){const l=n.presentedForm[0];(s=l.contentType)!=null&&s.startsWith("text/plain")&&l.data&&i.push({text:window.atob(l.data)})}return a.jsxs(Se,{children:[a.jsx(ce,{children:"Diagnostic Report"}),a.jsx(eF,{value:n}),r&&!e.hideSpecimenInfo&&tF(r),n.result&&a.jsx(nF,{hideObservationNotes:e.hideObservationNotes,value:n.result}),i.length>0&&a.jsx(sT,{value:i})]})}function eF({value:e}){var t,n;return a.jsxs(Y,{mt:"md",gap:30,children:[e.subject&&a.jsxs("div",{children:[a.jsx(ae,{size:"xs",tt:"uppercase",c:"dimmed",children:"Subject"}),a.jsx(sa,{value:e.subject,link:!0})]}),(t=e.resultsInterpreter)==null?void 0:t.map(r=>a.jsxs("div",{children:[a.jsx(ae,{size:"xs",tt:"uppercase",c:"dimmed",children:"Interpreter"}),a.jsx(sa,{value:r,link:!0})]},r.reference)),(n=e.performer)==null?void 0:n.map(r=>a.jsxs("div",{children:[a.jsx(ae,{size:"xs",tt:"uppercase",c:"dimmed",children:"Performer"}),a.jsx(sa,{value:r,link:!0})]},r.reference)),e.issued&&a.jsxs("div",{children:[a.jsx(ae,{size:"xs",tt:"uppercase",c:"dimmed",children:"Issued"}),a.jsx(ae,{children:Fn(e.issued)})]}),e.status&&a.jsxs("div",{children:[a.jsx(ae,{size:"xs",tt:"uppercase",c:"dimmed",children:"Status"}),a.jsx(ae,{children:zt(e.status)})]})]})}function tF(e){return a.jsxs(Se,{gap:"xs",children:[a.jsx(ce,{order:2,size:"h6",children:"Specimens"}),a.jsx(xn,{type:"ordered",children:e==null?void 0:e.map(t=>{var n;return a.jsx(xn.Item,{ml:"sm",children:a.jsxs(Y,{gap:20,children:[a.jsxs(Y,{gap:5,children:[a.jsx(ae,{fw:500,children:"Collected:"})," ",Fn((n=t.collection)==null?void 0:n.collectedDateTime)]}),a.jsxs(Y,{gap:5,children:[a.jsx(ae,{fw:500,children:"Received:"})," ",Fn(t.receivedTime)]})]})},`specimen-${t.id}`)})})]})}function nF(e){return a.jsxs("table",{className:lT.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(cT,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function cT(e){var t;return a.jsx(a.Fragment,{children:(t=e.value)==null?void 0:t.map(n=>a.jsx(rF,{value:n,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${xs(n)?n.reference:n.id}`))})}function rF(e){var o,i;const t=st(e.value);if(!t||(o=e.ancestorIds)!=null&&o.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=sF(t);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:Ze({[lT.criticalRow]:r}),children:[a.jsx("td",{rowSpan:n?2:1,children:a.jsx(Le,{to:t,children:a.jsx(Zr,{value:t.code})})}),a.jsx("td",{children:a.jsx(oF,{value:t})}),a.jsx("td",{children:a.jsx(iF,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx(Zr,{value:t.interpretation[0]})}),a.jsx("td",{children:t.category&&t.category.length>0&&a.jsx(a.Fragment,{children:t.category.map(s=>a.jsx("div",{children:a.jsx(Zr,{value:s})},`category-${Sa(s)}`))})}),a.jsx("td",{children:(i=t.performer)==null?void 0:i.map(s=>a.jsx(Rd,{value:s},s.reference))}),a.jsx("td",{children:t.status&&a.jsx(aT,{status:t.status})})]}),t.hasMember&&a.jsx(cT,{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(sT,{value:t.note})})})]})}function oF(e){const t=e.value;return a.jsx(a.Fragment,{children:rP(t)})}function iF(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(Hy,{value:t}):null}function sF(e){var n,r,o,i;const t=(i=(o=(r=(n=e.interpretation)==null?void 0:n[0])==null?void 0:r.coding)==null?void 0:o[0])==null?void 0:i.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}const aF="_paper_1igaj_1",lF="_fill_1igaj_20",cw={paper:aF,fill:lF};function Xy(e){const{width:t,fill:n,className:r,children:o,...i}=e,s=t?{width:t}:void 0;return a.jsx(On,{className:Ze(cw.paper,n&&cw.fill,r),style:s,shadow:"sm",radius:"sm",withBorder:!0,...i,children:o})}var uT={},Ac={};Object.defineProperty(Ac,"__esModule",{value:!0});Ac.Pointer=void 0;function cF(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function uF(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var dF=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var n=t.split("/").map(cF);if(n[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(n)},e.prototype.toString=function(){return this.tokens.map(uF).join("/")},e.prototype.evaluate=function(t){for(var n=null,r="",o=t,i=1,s=this.tokens.length;i<s;i++)n=o,r=this.tokens[i],!(r=="__proto__"||r=="constructor"||r=="prototype")&&(o=(n||{})[r]);return{parent:n,key:r,value:o}},e.prototype.get=function(t){return this.evaluate(t).value},e.prototype.set=function(t,n){var r=this.evaluate(t);r.parent&&(r.parent[r.key]=n)},e.prototype.push=function(t){this.tokens.push(t)},e.prototype.add=function(t){var n=this.tokens.concat(String(t));return new e(n)},e}();Ac.Pointer=dF;var kt={},Jy={};(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 i=o.length,s=new Array(i),l=0;l<i;l++)s[l]=r(o[l]);return s}if(o.constructor==Date){var c=new Date(+o);return c}var u={};for(var d in o)e.hasOwnProperty.call(o,d)&&(u[d]=r(o[d]));return u}e.clone=r})(Jy);var yn={};Object.defineProperty(yn,"__esModule",{value:!0});yn.diffAny=yn.diffObjects=yn.diffArrays=yn.intersection=yn.subtract=yn.isDestructive=void 0;var Jl=Jy;function fF(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}yn.isDestructive=fF;function Dm(e,t){var n={};for(var r in e)Jl.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(n[r]=1);for(var o in t)Jl.hasOwnProperty.call(t,o)&&t[o]!==void 0&&delete n[o];return Object.keys(n)}yn.subtract=Dm;function dT(e){for(var t=e.length,n={},r=0;r<t;r++){var o=e[r];for(var i in o)Jl.hasOwnProperty.call(o,i)&&o[i]!==void 0&&(n[i]=(n[i]||0)+1)}for(var i in n)n[i]<t&&delete n[i];return Object.keys(n)}yn.intersection=dT;function hF(e){return e.op==="add"}function pF(e){return e.op==="remove"}function rp(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function fT(e,t,n,r){r===void 0&&(r=Yf);var o={"0,0":{operations:[],cost:0}};function i(d,f){var h="".concat(d,",").concat(f),m=o[h];if(m===void 0){if(d>0&&f>0&&!r(e[d-1],t[f-1],n.add(String(d-1))).length)m=i(d-1,f-1);else{var g=[];if(d>0){var v=i(d-1,f),b={op:"remove",index:d-1};g.push(rp(v,b))}if(f>0){var x=i(d,f-1),y={op:"add",index:d-1,value:t[f-1]};g.push(rp(x,y))}if(d>0&&f>0){var w=i(d-1,f-1),S={op:"replace",index:d-1,original:e[d-1],value:t[f-1]};g.push(rp(w,S))}var j=g.sort(function(E,P){return E.cost-P.cost})[0];m=j}o[h]=m}return m}var s=isNaN(e.length)||e.length<=0?0:e.length,l=isNaN(t.length)||t.length<=0?0:t.length,c=i(s,l).operations,u=c.reduce(function(d,f){var h=d[0],m=d[1];if(hF(f)){var g=f.index+1+m,v=g<s+m?String(g):"-",b={op:f.op,path:n.add(v).toString(),value:f.value};return[h.concat(b),m+1]}else if(pF(f)){var b={op:f.op,path:n.add(String(f.index+m)).toString()};return[h.concat(b),m-1]}else{var x=n.add(String(f.index+m)),y=r(f.original,f.value,x);return[h.concat.apply(h,y),m]}},[[],0])[0];return u}yn.diffArrays=fT;function hT(e,t,n,r){r===void 0&&(r=Yf);var o=[];return Dm(e,t).forEach(function(i){o.push({op:"remove",path:n.add(i).toString()})}),Dm(t,e).forEach(function(i){o.push({op:"add",path:n.add(i).toString(),value:t[i]})}),dT([e,t]).forEach(function(i){o.push.apply(o,r(e[i],t[i],n.add(i)))}),o}yn.diffObjects=hT;function Yf(e,t,n,r){if(r===void 0&&(r=Yf),e===t)return[];var o=(0,Jl.objectType)(e),i=(0,Jl.objectType)(t);return o=="array"&&i=="array"?fT(e,t,n,r):o=="object"&&i=="object"?hT(e,t,n,r):[{op:"replace",path:n.toString(),value:t}]}yn.diffAny=Yf;var Zy=x0&&x0.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(kt,"__esModule",{value:!0});kt.apply=kt.InvalidOperationError=kt.test=kt.copy=kt.move=kt.replace=kt.remove=kt.add=kt.TestError=kt.MissingError=void 0;var Po=Ac,e0=Jy,mF=yn,eo=function(e){Zy(t,e);function t(n){var r=e.call(this,"Value required at path: ".concat(n))||this;return r.path=n,r.name="MissingError",r}return t}(Error);kt.MissingError=eo;var pT=function(e){Zy(t,e);function t(n,r){var o=e.call(this,"Test failed: ".concat(n," != ").concat(r))||this;return o.actual=n,o.expected=r,o.name="TestError",o}return t}(Error);kt.TestError=pT;function t0(e,t,n){if(Array.isArray(e))if(t=="-")e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function mT(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function gT(e,t){var n=Po.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new eo(t.path):(t0(n.parent,n.key,(0,e0.clone)(t.value)),null)}kt.add=gT;function vT(e,t){var n=Po.Pointer.fromJSON(t.path).evaluate(e);return n.value===void 0?new eo(t.path):(mT(n.parent,n.key),null)}kt.remove=vT;function yT(e,t){var n=Po.Pointer.fromJSON(t.path).evaluate(e);if(n.parent===null)return new eo(t.path);if(Array.isArray(n.parent)){if(parseInt(n.key,10)>=n.parent.length)return new eo(t.path)}else if(n.value===void 0)return new eo(t.path);return n.parent[n.key]=(0,e0.clone)(t.value),null}kt.replace=yT;function xT(e,t){var n=Po.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new eo(t.from);var r=Po.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new eo(t.path):(mT(n.parent,n.key),t0(r.parent,r.key,n.value),null)}kt.move=xT;function wT(e,t){var n=Po.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new eo(t.from);var r=Po.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new eo(t.path):(t0(r.parent,r.key,(0,e0.clone)(n.value)),null)}kt.copy=wT;function ST(e,t){var n=Po.Pointer.fromJSON(t.path).evaluate(e);return(0,mF.diffAny)(n.value,t.value,new Po.Pointer).length?new pT(n.value,t.value):null}kt.test=ST;var bT=function(e){Zy(t,e);function t(n){var r=e.call(this,"Invalid operation: ".concat(n.op))||this;return r.operation=n,r.name="InvalidOperationError",r}return t}(Error);kt.InvalidOperationError=bT;function gF(e,t){switch(t.op){case"add":return gT(e,t);case"remove":return vT(e,t);case"replace":return yT(e,t);case"move":return xT(e,t);case"copy":return wT(e,t);case"test":return ST(e,t)}return new bT(t)}kt.apply=gF;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Ac;Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=kt,r=yn;function o(u,d){return d.map(function(f){return(0,n.apply)(u,f)})}e.applyPatch=o;function i(u){function d(f,h,m){var g=u(f,h,m);return Array.isArray(g)?g:(0,r.diffAny)(f,h,m,d)}return d}function s(u,d,f){var h=new t.Pointer;return(f?i(f):r.diffAny)(u,d,h)}e.createPatch=s;function l(u,d){var f=t.Pointer.fromJSON(d).evaluate(u);if(f!==void 0)return{op:"test",path:d,value:f.value}}function c(u,d){var f=new Array;return d.filter(r.isDestructive).forEach(function(h){var m=l(u,h.path);if(m&&f.push(m),"from"in h){var g=l(u,h.from);g&&f.push(g)}}),f}e.createTests=c})(uT);const vF="_root_w6lfx_1",yF="_removed_w6lfx_16",xF="_added_w6lfx_21",op={root:vF,removed:yF,added:xF};function wF(e){const t=ne(),{original:n,revised:r}=e,[o,i]=p.useState(!1);p.useEffect(()=>{t.requestSchema(e.original.resourceType).then(()=>i(!0)).catch(console.log)},[t,e.original.resourceType]);const s=p.useMemo(()=>{if(!o)return null;const l=[oo(n)],c=[oo(r)],u=[],d=SF(uT.createPatch(n,r));for(const f of d){const h=f.path,m=bF(h),g=CF(n.resourceType,m),v=f.op==="add"?void 0:Yl(m,l),b=f.op==="remove"?void 0:Yl(m,c);u.push({key:`op-${f.op}-${f.path}`,name:`${zt(f.op)} ${m}`,property:g,originalValue:uw(g,v),revisedValue:uw(g,b)})}return u},[o,n,r]);return s?a.jsxs(me,{className:op.root,children:[a.jsx(me.Thead,{children:a.jsxs(me.Tr,{children:[a.jsx(me.Th,{}),a.jsx(me.Th,{children:"Before"}),a.jsx(me.Th,{children:"After"})]})}),a.jsx(me.Tbody,{children:s.map(l=>a.jsxs(me.Tr,{children:[a.jsx(me.Td,{children:l.name}),a.jsx(me.Td,{className:op.removed,children:l.originalValue&&a.jsx(jo,{property:l.property,propertyType:l.originalValue.type,value:l.originalValue.value,ignoreMissingValues:!0})}),a.jsx(me.Td,{className:op.added,children:l.revisedValue&&a.jsx(jo,{property:l.property,propertyType:l.revisedValue.type,value:l.revisedValue.value,ignoreMissingValues:!0})})]},l.key))})]}):null}function SF(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 i=e.filter(l=>l.op===r&&l.path===o).length,s={op:r,path:o};i>1&&(r==="add"||r==="remove")&&/\/[0-9-]+$/.test(o)&&(s.op="replace",s.path=o.replace(/\/[^/]+$/,"")),t.some(l=>l.op===s.op&&l.path===s.path)||t.push(s)}return t}function bF(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 CF(e,t){var r;const n=Bf(e,{resourceType:"SearchParameter",base:[e],code:e+"."+t,expression:e+"."+t});return(r=n==null?void 0:n.elementDefinitions)==null?void 0:r[0]}function uw(e,t){return t&&{type:Array.isArray(t)?t[0].type:t.type,value:EF(t,!!(e!=null&&e.isArray))}}function EF(e,t){const n=GO(e).flatMap(r=>r.value);return t?n:n[0]}function n0(e){const t=ne(),n=st(e.value),[r,o]=p.useState(!1);return p.useEffect(()=>{n&&t.requestSchema(n.resourceType).then(()=>o(!0)).catch(console.log)},[t,n]),!r||!n?null:a.jsx(Im,{value:{type:n.resourceType,value:e.forceUseInput?e.value:n},ignoreMissingValues:e.ignoreMissingValues})}function jF(e){return a.jsx(_c,{children:e.children})}function ns(e){var c,u;const{resource:t,profile:n,padding:r,popupMenuItems:o,...i}=e,s=n??((c=t.meta)==null?void 0:c.author),l=e.dateTime??((u=t.meta)==null?void 0:u.lastUpdated);return a.jsxs(Xy,{"data-testid":"timeline-item",fill:!0,...i,children:[a.jsxs(Y,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(Si,{value:s,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(ae,{size:"sm",children:a.jsx(za,{c:"dark",fw:500,value:s,link:!0})}),a.jsxs(ae,{size:"xs",children:[a.jsx(Le,{c:"dimmed",to:e.resource,children:Fn(l)}),a.jsx(ae,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx(Le,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&a.jsxs(J,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(J.Target,{children:a.jsx(Qt,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${lt(e.resource)}`,children:a.jsx(P7,{})})}),o]})]}),a.jsxs(UP,{children:[r&&a.jsx("div",{style:{padding:"0 16px 16px 16px"},children:e.children}),!r&&a.jsx(a.Fragment,{children:e.children})]})]})}function CT(e,t){e.sort((n,r)=>{const o=dw(n,t),i=dw(r,t);return o>i?1:o<i?-1:fw(n,t)-fw(r,t)})}function dw(e,t){if(!ET(e,t)){const n=e.priority;if(typeof n=="string")return{stat:4,asap:3,urgent:2}[n]??0}return 0}function fw(e,t){var r;if(!ET(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=(r=e.meta)==null?void 0:r.lastUpdated;return n?new Date(n).getTime():0}function ET(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const PF="_pinnedComment_5uxzi_2",TF={pinnedComment:PF};function Xf(e){const t=ne(),n=Wf(),r=t.getProfile(),o=p.useRef(null),i=st(e.value),[s,l]=p.useState(),[c,u]=p.useState([]),d=e.loadTimelineResources,f=p.useRef(c);f.current=c;const h=p.useCallback(R=>{CT(R,i),R.reverse(),u(R)},[i]),m=p.useCallback(R=>{const M=[];for(const N of R){if(N.status!=="fulfilled")continue;const B=N.value;if(B.type==="history"&&l(B),B.entry)for(const D of B.entry)M.push(D.resource)}h(M)},[h]),g=p.useCallback(R=>h([...f.current,R]),[h]),v=p.useCallback(()=>{var N;let R,M;"resourceType"in e.value?(R=e.value.resourceType,M=e.value.id):[R,M]=(N=e.value.reference)==null?void 0:N.split("/"),d(t,R,M).then(m).catch(console.log)},[t,e.value,d,m]);p.useEffect(()=>v(),[v]);function b(R){!i||!e.createCommunication||t.createResource(e.createCommunication(i,r,R)).then(M=>g(M)).catch(console.log)}function x(R){!i||!e.createMedia||t.createResource(e.createMedia(i,r,R)).then(M=>g(M)).then(()=>hl({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(qf,{size:16}),autoClose:2e3})).catch(M=>hl({id:"upload-notification",color:"red",title:"Upload error",message:Te(M),icon:a.jsx(tw,{size:16}),autoClose:2e3}))}function y(R,M){return t.updateResource({...R,priority:M})}function w(R){y(R,"stat").then(v).catch(console.log)}function S(R){y(R,"routine").then(v).catch(console.log)}function j(R){n(`/${R.resourceType}/${R.id}`)}function E(R){n(`/${R.resourceType}/${R.id}/edit`)}function P(R){n(`/${R.resourceType}/${R.id}/delete`)}function T(R){var M;n(`/${R.resourceType}/${R.id}/_history/${(M=R.meta)==null?void 0:M.versionId}`)}function k(){le({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function I(R){hl({id:"upload-notification",loading:!0,title:"Uploading...",message:NF(R),autoClose:!1,withCloseButton:!1})}function O(R){hl({id:"upload-notification",color:"red",title:"Upload error",message:Te(R),icon:a.jsx(tw,{size:16}),autoClose:2e3})}return i?a.jsxs(jF,{children:[e.createCommunication&&a.jsx(Xy,{children:a.jsx(Be,{testid:"timeline-form",onSubmit:R=>{b(R.text);const M=o.current;M&&(M.value="",M.focus())},children:a.jsxs(Y,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(Si,{value:r}),a.jsx(ie,{name:"text",ref:o,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(Qt,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx(M7,{size:16})}),a.jsx(Vy,{onUpload:x,onUploadStart:k,onUploadProgress:I,onUploadError:O,children:R=>a.jsx(Qt,{...R,radius:"xl",color:"blue",variant:"filled",children:a.jsx(My,{size:16})})})]})})}),c.map(R=>{var N;if(!R)return null;const M=`${R.resourceType}/${R.id}/${(N=R.meta)==null?void 0:N.versionId}`;if(R.resourceType===i.resourceType&&R.id===i.id)return a.jsx(kF,{history:s,resource:R,onDetails:T},M);switch(R.resourceType){case"AuditEvent":return a.jsx(_F,{resource:R,onDetails:j},M);case"Communication":return a.jsx(IF,{resource:R,onPin:R.priority!=="stat"?w:void 0,onUnpin:R.priority==="stat"?S:void 0,onDetails:j,onEdit:E,onDelete:P},M);case"DiagnosticReport":return a.jsx(AF,{resource:R,onDetails:j,onEdit:E,onDelete:P},M);case"Media":return a.jsx(DF,{resource:R,onDetails:j,onEdit:E,onDelete:P},M);default:return a.jsx(ns,{resource:R,padding:!0,children:a.jsx(n0,{value:R,ignoreMissingValues:!0})},M)}})]}):a.jsx(tn,{style:{width:"100%",height:"100%"},children:a.jsx($n,{})})}function Ca(e){return a.jsxs(J.Dropdown,{children:[a.jsx(J.Label,{children:"Resource"}),e.onPin&&a.jsx(J.Item,{leftSection:a.jsx(F7,{size:14}),onClick:()=>e.onPin(e.resource),"aria-label":`Pin ${lt(e.resource)}`,children:"Pin"}),e.onUnpin&&a.jsx(J.Item,{leftSection:a.jsx(z7,{size:14}),onClick:()=>e.onUnpin(e.resource),"aria-label":`Unpin ${lt(e.resource)}`,children:"Unpin"}),e.onDetails&&a.jsx(J.Item,{leftSection:a.jsx(_7,{size:14}),onClick:()=>e.onDetails(e.resource),"aria-label":`Details ${lt(e.resource)}`,children:"Details"}),e.onEdit&&a.jsx(J.Item,{leftSection:a.jsx(T7,{size:14}),onClick:()=>e.onEdit(e.resource),"aria-label":`Edit ${lt(e.resource)}`,children:"Edit"}),e.onDelete&&a.jsxs(a.Fragment,{children:[a.jsx(J.Divider,{}),a.jsx(J.Label,{children:"Danger zone"}),a.jsx(J.Item,{color:"red",leftSection:a.jsx(BP,{size:14}),onClick:()=>e.onDelete(e.resource),"aria-label":`Delete ${lt(e.resource)}`,children:"Delete"})]})]})}function kF(e){const t=RF(e.history,e.resource);return t?a.jsx(ns,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Ca,{...e}),children:a.jsx(wF,{original:t,revised:e.resource})}):a.jsxs(ns,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Ca,{...e}),children:[a.jsx("h3",{children:"Created"}),a.jsx(n0,{value:e.resource,ignoreMissingValues:!0,forceUseInput:!0})]})}function RF(e,t){const n=e.entry,r=n.findIndex(o=>{var i,s,l;return((s=(i=o.resource)==null?void 0:i.meta)==null?void 0:s.versionId)===((l=t.meta)==null?void 0:l.versionId)});if(!(r>=n.length-1))return n[r+1].resource}function IF(e){var r,o;const n=!e.resource.priority||e.resource.priority==="routine"?void 0:TF.pinnedComment;return a.jsx(ns,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:a.jsx(Ca,{...e}),children:a.jsx("p",{children:(o=(r=e.resource.payload)==null?void 0:r[0])==null?void 0:o.contentString})})}function DF(e){var r;const t=(r=e.resource.content)==null?void 0:r.contentType,n=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return a.jsx(ns,{resource:e.resource,padding:!!n,popupMenuItems:a.jsx(Ca,{...e}),children:a.jsx(Dc,{value:e.resource.content})})}function _F(e){return a.jsx(ns,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Ca,{...e}),children:a.jsx(hr,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function AF(e){return a.jsx(ns,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Ca,{...e}),children:a.jsx(Yy,{value:e.resource})})}function NF(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${ip(e.loaded)} / ${ip(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${ip(e.loaded)}`}function ip(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 OF(e){return a.jsx(Xf,{value:e.resource,loadTimelineResources:async(t,n,r)=>{const o=`${n}/${r}`;return Promise.allSettled([t.readHistory(n,r),t.search("Task",{_filter:`based-on eq ${o} or focus eq ${o} or subject eq ${o}`,_count:100})])}})}function xe(e){const{children:t,...n}=e;return a.jsx(_c,{children:a.jsx(Xy,{...n,children:t})})}function MF(e){return a.jsx(Xf,{value:e.encounter,loadTimelineResources:async(t,n,r)=>Promise.allSettled([t.readHistory("Encounter",r),t.search("Communication","encounter=Encounter/"+r),t.search("Media","encounter=Encounter/"+r)]),createCommunication:(t,n,r)=>({resourceType:"Communication",status:"completed",encounter:bt(t),subject:t.subject,sender:bt(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",encounter:bt(t),subject:t.subject,operator:bt(n),issued:new Date().toISOString(),content:r})})}function $F(e){let t;try{t=G$(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(jo,{value:t[0]||"",propertyType:e.propertyType})}function LF(e){return a.jsxs(jn,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[a.jsxs(q,{display:"flex",style:{justifyContent:"space-between"},children:[e.exportCsv&&a.jsx(hw,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&a.jsx(hw,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),a.jsx(ae,{style:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function hw(e){return a.jsx(ee,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const FF={string:[re.EQUALS,re.NOT,re.CONTAINS,re.EXACT],fulltext:[re.EQUALS,re.NOT,re.CONTAINS,re.EXACT],token:[re.EQUALS,re.NOT],reference:[re.EQUALS,re.NOT],numeric:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS],quantity:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS],date:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS,re.STARTS_AFTER,re.ENDS_BEFORE,re.APPROXIMATELY],datetime:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS,re.STARTS_AFTER,re.ENDS_BEFORE,re.APPROXIMATELY]},zF={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",contains:"contains",exact:"exact",text:"text",not:"not",above:"above",below:"below",in:"in","not-in":"not in","of-type":"of type",missing:"missing",identifier:"identifier",iterate:"iterate"};function r0(e,t){return{...e,filters:t,offset:0,name:void 0}}function o0(e,t){return r0(e,(e.filters??[]).filter(n=>n.code!==t))}function Jf(e,t,n,r,o){o&&(e=o0(e,t));const i=[];return e.filters&&i.push(...e.filters),i.push({code:t,operator:n,value:r??""}),r0(e,i)}function BF(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function UF(e,t){return i0(e,t,-1)}function VF(e,t){return i0(e,t,0)}function WF(e,t){return i0(e,t,1)}function i0(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),a0(e,t,r,o)}function HF(e,t){return s0(e,t,-1)}function qF(e,t){return s0(e,t,0)}function GF(e,t){return s0(e,t,1)}function s0(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),a0(e,t,r,o)}function QF(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),a0(e,t,n,new Date)}function a0(e,t,n,r){return e=o0(e,t),e=pw(e,t,re.GREATER_THAN_OR_EQUALS,n),e=pw(e,t,re.LESS_THAN_OR_EQUALS,r),e}function pw(e,t,n,r){return Jf(e,t,n,r.toISOString())}function mw(e,t,n=!0){return Jf(e,t,re.MISSING,n.toString())}function KF(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function YF(e,t){const n=e.count??Uf,r=(t-1)*n;return KF(e,r)}function XF(e,t,n){return t===JF(e)&&n!==void 0&&n===ZF(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function JF(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function ZF(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function ez(e){return FF[e.type]}function l0(e){return zF[e]??""}function gi(e){let t=e;return t.includes(".")&&(t=t.split(".").pop()),t==="versionId"?"Version ID":(t=t.replace("[x]",""),t=t.replace(/([A-Z])/g," $1"),t=t.replace(/[-_]/g," "),t=t.replace(/\s+/g," "),t=t.trim(),t.toLowerCase()==="id"?"ID":t.split(/\s/).map(zt).join(" "))}function tz(e,t){var r,o;const n=t.name;return n==="id"?e.id:n==="meta.versionId"?(r=e.meta)==null?void 0:r.versionId:n==="_lastUpdated"?Fn((o=e.meta)==null?void 0:o.lastUpdated):t.elementDefinition&&`${e.resourceType}.${t.name}`===t.elementDefinition.path?nz(e,t.elementDefinition):t.searchParams&&t.searchParams.length===1&&t.name===t.searchParams[0].code?rz(e,t.searchParams[0]):null}function nz(e,t){var i,s,l;const n=((l=(s=(i=t.path)==null?void 0:i.split("."))==null?void 0:s.pop())==null?void 0:l.replaceAll("[x]",""))??"",[r,o]=Gf({type:e.resourceType,value:e},n);return r?a.jsx(jo,{property:t,propertyType:o,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function rz(e,t){const n=Yl(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,o)=>a.jsx(jo,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${n.length}`))})}function oz(e){const t=p.useRef(!1),[n,r]=p.useState({search:JSON.parse(Qn(e.search))}),[o,i]=p.useState(!1);p.useEffect(()=>{r({search:e.search})},[e.search]);const s=p.useMemo(()=>{if(!e.visible)return[];const c=e.search.resourceType,u=u$(c),d=Ey(c);return iz(u,d).sort((f,h)=>f.localeCompare(h)).map(f=>({value:f,label:gi(f)}))},[e.visible,e.search.resourceType]);if(!e.visible)return null;function l(c){r({search:{...n.search,fields:c}})}return a.jsx(jn,{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(Se,{children:[a.jsx(Rf,{style:{width:550},placeholder:"Select fields to display",data:s,value:n.search.fields??[],onChange:l,onDropdownOpen:()=>i(!0),onDropdownClose:()=>i(!1),maxDropdownHeight:"250px",clearButtonProps:{"aria-label":"Clear selection"},clearable:!0,searchable:!0}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{onClick:()=>e.onOk(n.search),children:"OK"})})]})})}function iz(e,t){const n=[],r=new Set,o=new Set;for(const i of Object.keys(e.elements))n.push(i),r.add(i.toLowerCase()),o.add(gi(i));if(t)for(const i of Object.keys(t)){const s=gi(i);!r.has(i)&&!o.has(s)&&(n.push(i),r.add(i),o.add(s))}return n}function jT(e){var o;const{resourceType:t,filter:n}=e,r=(o=mi.types[t].searchParams)==null?void 0:o[n.code];if(r){if(r.type==="reference"&&(n.operator===re.EQUALS||n.operator===re.NOT_EQUALS))return a.jsx(za,{value:{reference:n.value}});const i=Bf(t,r);if(n.code==="_lastUpdated"||i.type===qo.DATETIME)return a.jsx(a.Fragment,{children:Fn(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function PT(e){const t=Bf(e.resourceType,e.searchParam),n="filter-value";switch(t.type){case qo.REFERENCE:return a.jsx(Kf,{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 qo.BOOLEAN:return a.jsx(ur,{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 qo.DATE:return a.jsx(ie,{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 qo.DATETIME:return a.jsx(es,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case qo.NUMBER:return a.jsx(ie,{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 qo.QUANTITY:return a.jsx(ts,{name:n,defaultValue:sz(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(ie,{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 sz(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:parseFloat(t),system:n,unit:r}}}function az(e){const[t,n]=p.useState(JSON.parse(Qn(e.search))),[r,o]=p.useState(-1),i=p.useRef(t);i.current=t,p.useEffect(()=>{n(JSON.parse(Qn(e.search)))},[e.search]);function s(d){n(Jf(i.current,d.code,d.operator,d.value))}if(!e.visible)return null;const l=e.search.resourceType,c=Ey(l)??{},u=t.filters||[];return a.jsxs(jn,{title:"Filters",closeButtonProps:{"aria-label":"Close"},size:900,opened:e.visible,onClose:e.onCancel,children:[a.jsx("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:120}})]}),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",{children:"Actions"})]})}),a.jsxs("tbody",{children:[u.map((d,f)=>f===r?a.jsx(gw,{resourceType:l,searchParams:c,defaultValue:d,okText:"Save",onOk:h=>{const m=[...u];m[f]=h,n(r0(i.current,m)),o(-1)},onCancel:()=>o(-1)},`filter-${d.code}-${d.operator}-${d.value}-input`):a.jsx(lz,{resourceType:l,filter:d,onEdit:()=>o(f),onDelete:()=>n(BF(i.current,f))},`filter-${d.code}-${d.operator}-${d.value}-display`)),a.jsx(gw,{resourceType:l,searchParams:c,okText:"Add",onOk:s})]})]})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{onClick:()=>e.onOk(i.current),children:"OK"})})]})}function lz(e){const{filter:t}=e;return a.jsxs("tr",{children:[a.jsx("td",{children:gi(t.code)}),a.jsx("td",{children:l0(t.operator)}),a.jsx("td",{children:a.jsx(jT,{resourceType:e.resourceType,filter:t})}),a.jsxs("td",{children:[a.jsx(ee,{size:"compact-md",variant:"outline",onClick:e.onEdit,children:"Edit"}),a.jsx(ee,{size:"compact-md",variant:"outline",onClick:e.onDelete,children:"Delete"})]})]})}function gw(e){const[t,n]=p.useState(e.defaultValue??{}),r=p.useRef(t);r.current=t;function o(u){n({...r.current,code:u})}function i(u){n({...r.current,operator:u})}function s(u){n({...r.current,value:u})}const l=e.searchParams[t.code],c=l&&ez(l);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(xt,{"data-testid":"filter-field",defaultValue:r.current.code,onChange:u=>o(u.currentTarget.value),data:["",...Object.keys(e.searchParams).map(u=>({value:u,label:gi(u)}))]})}),a.jsx("td",{children:c&&a.jsx(xt,{"data-testid":"filter-operation",defaultValue:t.operator,onChange:u=>i(u.currentTarget.value),data:["",...c.map(u=>({value:u,label:l0(u)}))]})}),a.jsx("td",{children:l&&t.operator&&a.jsx(PT,{resourceType:e.resourceType,searchParam:l,defaultValue:t.value,onChange:s})}),a.jsxs("td",{children:[t.code&&t.operator&&a.jsx(ee,{size:"compact-md",variant:"outline",onClick:()=>{e.onOk(r.current),n({})},children:e.okText}),e.onCancel&&a.jsx(ee,{size:"compact-md",variant:"outline",onClick:e.onCancel,children:"Cancel"})]})]})}function cz(e){const[t,n]=p.useState(e.defaultValue??"");if(!e.visible||!e.searchParam||!e.filter)return null;function r(){e.onOk({...e.filter,value:t})}return a.jsx(jn,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:a.jsx(Be,{onSubmit:r,children:a.jsxs(Wn,{children:[a.jsx(Wn.Col,{span:10,children:a.jsx(PT,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})}),a.jsx(Wn.Col,{span:2,children:a.jsx(ee,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function uz(e){if(!e.searchParams)return null;function t(i,s){o(XF(e.search,i.code,s))}function n(i){o(o0(e.search,i.code))}function r(i,s){e.onPrompt(i,{code:i.code,operator:s,value:""})}function o(i){e.onChange(i)}return e.searchParams.length===1?a.jsx(dz,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:o,onClear:n}):a.jsx(J.Dropdown,{children:e.searchParams.map(i=>a.jsx(J.Item,{children:gi(i.code)},i.code))})}function dz(e){switch(e.searchParam.type){case"date":return a.jsx(fz,{...e});case"number":case"quantity":return a.jsx(hz,{...e});case"reference":return a.jsx(pz,{...e});case"string":return a.jsx(mz,{...e});case"token":case"uri":return a.jsx(gz,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function fz(e){const{searchParam:t}=e,n=t.code;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx($y,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(J.Item,{leftSection:a.jsx(Ly,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ic,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Rc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT_EQUALS),children:"Does not equal..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(zP,{size:14}),onClick:()=>e.onPrompt(t,re.ENDS_BEFORE),children:"Before..."}),a.jsx(J.Item,{leftSection:a.jsx(FP,{size:14}),onClick:()=>e.onPrompt(t,re.STARTS_AFTER),children:"After..."}),a.jsx(J.Item,{leftSection:a.jsx(m7,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Between..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(WF(e.search,n)),children:"Tomorrow"}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(VF(e.search,n)),children:"Today"}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(UF(e.search,n)),children:"Yesterday"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(GF(e.search,n)),children:"Next Month"}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(qF(e.search,n)),children:"This Month"}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(HF(e.search,n)),children:"Last Month"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(QF(e.search,n)),children:"Year to date"}),a.jsx(Nc,{...e})]})}function hz(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx($y,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(J.Item,{leftSection:a.jsx(Ly,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ic,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Rc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT_EQUALS),children:"Does not equal..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(FP,{size:14}),onClick:()=>e.onPrompt(t,re.GREATER_THAN),children:"Greater than..."}),a.jsx(J.Item,{leftSection:a.jsx(km,{size:14}),onClick:()=>e.onPrompt(t,re.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(J.Item,{leftSection:a.jsx(zP,{size:14}),onClick:()=>e.onPrompt(t,re.LESS_THAN),children:"Less than..."}),a.jsx(J.Item,{leftSection:a.jsx(km,{size:14}),onClick:()=>e.onPrompt(t,re.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx(Nc,{...e})]})}function pz(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(Ic,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Rc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT),children:"Does not equal..."}),a.jsx(Nc,{...e})]})}function mz(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx($y,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(J.Item,{leftSection:a.jsx(Ly,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ic,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Rc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT),children:"Does not equal..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(y7,{size:14}),onClick:()=>e.onPrompt(t,re.CONTAINS),children:"Contains..."}),a.jsx(J.Item,{leftSection:a.jsx(v7,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Does not contain..."}),a.jsx(Nc,{...e})]})}function gz(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(Ic,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Rc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT),children:"Does not equal..."}),a.jsx(Nc,{...e})]})}function Nc(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(h7,{size:14}),onClick:()=>e.onChange(mw(e.search,n)),children:"Missing"}),a.jsx(J.Item,{leftSection:a.jsx(f7,{size:14}),onClick:()=>e.onChange(mw(e.search,n,!1)),children:"Not missing"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(kd,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}const vz="_root_vlout_1",yz="_table_vlout_8",xz="_tr_vlout_12",wz="_th_vlout_18",Sz="_control_vlout_22",bz="_icon_vlout_31",tl={root:vz,table:yz,tr:xz,th:wz,control:Sz,icon:bz};function Cz(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(Ez(t,r));return n}function Ez(e,t){var o;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=ys(e,t),r=v$(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const i=Ey(e);let s;if(i){const l=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);s=Object.values(i).filter(c=>!!c.expression&&l.test(c==null?void 0:c.expression)),s.length===0&&(s=void 0)}return{name:t,elementDefinition:n,searchParams:s}}if(r){const i=Bf(e,r);return{name:t,elementDefinition:(o=i.elementDefinitions)==null?void 0:o[0],searchParams:[r]}}return{name:t}}class jz extends Event{constructor(t){super("change"),this.definition=t}}class Pz extends Event{constructor(t){super("load"),this.response=t}}class Id extends Event{constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function Tz(e){var M,N,B;const t=ne(),[n,r]=p.useState(),[o,i]=p.useState(),{search:s,onLoad:l}=e,[c,u]=p.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),d=p.useRef(c);d.current=c;const f=p.useCallback(D=>{i(void 0),t.search(s.resourceType,Qs({...s,fields:void 0}),D).then($=>{u({...d.current,searchResponse:$}),l&&l(new Pz($))}).catch($=>{u({...d.current,searchResponse:void 0}),i($)})},[t,s,l]),h=p.useCallback(()=>{u({...d.current,searchResponse:void 0}),f({cache:"reload"})},[f]);p.useEffect(()=>{f()},[f]);function m(D,$){D.stopPropagation();const F=D.target.checked,H={...d.current.selected};F?H[$]=!0:delete H[$],u({...d.current,selected:H})}function g(D){D.stopPropagation();const _=D.target.checked,F={},H=d.current.searchResponse;_&&(H!=null&&H.entry)&&H.entry.forEach(G=>{var oe;(oe=G.resource)!=null&&oe.id&&(F[G.resource.id]=!0)}),u({...d.current,selected:F})}function v(){var $,_;const D=d.current;if(!(($=D.searchResponse)!=null&&$.entry)||D.searchResponse.entry.length===0)return!1;for(const F of D.searchResponse.entry)if((_=F.resource)!=null&&_.id&&!D.selected[F.resource.id])return!1;return!0}function b(D){e.onChange&&e.onChange(new jz(D))}function x(D,$){if(VP(D.target)||D.button===2)return;tt(D);const _=D.button===1||D.ctrlKey||D.metaKey;!_&&e.onClick&&e.onClick(new Id($,D)),_&&e.onAuxClick&&e.onAuxClick(new Id($,D))}function y(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(p.useEffect(()=>{r(e.search.resourceType),t.requestSchema(e.search.resourceType).catch(console.error).finally(()=>r(void 0))},[t,e.search.resourceType]),!gP(e.search.resourceType)||n===e.search.resourceType)return a.jsx(tn,{style:{width:"100%",height:"100%"},children:a.jsx($n,{})});const w=e.checkboxesEnabled,S=Cz(s),j=s.resourceType,E=c.searchResponse,P=E==null?void 0:E.entry,T=P==null?void 0:P.map(D=>D.resource),k="subtle",I="gray",O=16,R=window.innerWidth<768;return a.jsxs("div",{className:tl.root,"data-testid":"search-control",children:[!e.hideToolbar&&a.jsxs(Y,{justify:"space-between",mb:"xl",children:[a.jsxs(Y,{gap:2,children:[a.jsx(ee,{size:"compact-md",variant:k,color:I,leftSection:a.jsx(C7,{size:O}),onClick:()=>u({...d.current,fieldEditorVisible:!0}),children:"Fields"}),a.jsx(ee,{size:"compact-md",variant:k,color:I,leftSection:a.jsx(R7,{size:O}),onClick:()=>u({...d.current,filterEditorVisible:!0}),children:"Filters"}),e.onNew&&a.jsx(ee,{size:"compact-md",variant:k,color:I,leftSection:a.jsx(k7,{size:O}),onClick:e.onNew,children:"New..."}),!R&&y()&&a.jsx(ee,{size:"compact-md",variant:k,color:I,leftSection:a.jsx(X7,{size:O}),onClick:e.onExport?e.onExport:()=>u({...d.current,exportDialogVisible:!0}),children:"Export..."}),!R&&e.onDelete&&a.jsx(ee,{size:"compact-md",variant:k,color:I,leftSection:a.jsx(BP,{size:O}),onClick:()=>e.onDelete(Object.keys(c.selected)),children:"Delete..."}),!R&&e.onBulk&&a.jsx(ee,{size:"compact-md",variant:k,color:I,leftSection:a.jsx(p7,{size:O}),onClick:()=>e.onBulk(Object.keys(c.selected)),children:"Bulk..."})]}),a.jsxs(Y,{gap:2,children:[E&&a.jsxs(ae,{size:"xs",c:"dimmed","data-testid":"count-display",children:[TT(s,E).toLocaleString(),"-",Dz(s,E).toLocaleString(),E.total!==void 0&&` of ${s.total==="estimate"?"~":""}${(M=E.total)==null?void 0:M.toLocaleString()}`]}),a.jsx(Qt,{variant:k,color:I,title:"Refresh",onClick:h,children:a.jsx(W7,{size:O})})]})]}),a.jsxs(me,{className:tl.table,children:[a.jsxs(me.Thead,{children:[a.jsxs(me.Tr,{children:[w&&a.jsx(me.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:v(),onChange:D=>g(D)})}),S.map(D=>a.jsx(me.Th,{children:a.jsxs(J,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(J.Target,{children:a.jsx(lr,{className:tl.control,p:2,children:a.jsxs(Y,{justify:"space-between",wrap:"nowrap",children:[a.jsx(ae,{fw:500,children:gi(D.name)}),a.jsx(tn,{className:tl.icon,children:a.jsx(c7,{size:14,stroke:1.5})})]})})}),a.jsx(uz,{search:e.search,searchParams:D.searchParams,onPrompt:($,_)=>{u({...d.current,filterDialogVisible:!0,filterDialogSearchParam:$,filterDialogFilter:_})},onChange:$=>{b($)}})]})},D.name))]}),!e.hideFilters&&a.jsxs(me.Tr,{children:[w&&a.jsx(me.Th,{}),S.map(D=>a.jsx(me.Th,{children:D.searchParams&&a.jsx(kz,{resourceType:j,searchParams:D.searchParams,filters:e.search.filters})},D.name))]})]}),a.jsx(me.Tbody,{children:T==null?void 0:T.map(D=>D&&a.jsxs(me.Tr,{className:tl.tr,"data-testid":"search-control-row",onClick:$=>x($,D),onAuxClick:$=>x($,D),children:[w&&a.jsx(me.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${D.id}`,checked:!!c.selected[D.id],onChange:$=>m($,D.id)})}),S.map($=>a.jsx(me.Td,{children:tz(D,$)},$.name))]},D.id))})]}),(T==null?void 0:T.length)===0&&a.jsx(_c,{children:a.jsx(tn,{style:{height:150},children:a.jsx(ae,{size:"xl",c:"dimmed",children:"No results"})})}),E&&a.jsx(tn,{m:"md",p:"md",children:a.jsx(Mr,{value:Rz(s),total:Iz(s,E),onChange:D=>b(YF(s,D)),getControlProps:D=>{switch(D){case"previous":return{"aria-label":"Previous page"};case"next":return{"aria-label":"Next page"};default:return{}}}})}),o&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),a.jsx(oz,{search:e.search,visible:d.current.fieldEditorVisible,onOk:D=>{b(D),u({...d.current,fieldEditorVisible:!1})},onCancel:()=>{u({...d.current,fieldEditorVisible:!1})}}),a.jsx(az,{search:e.search,visible:d.current.filterEditorVisible,onOk:D=>{b(D),u({...d.current,filterEditorVisible:!1})},onCancel:()=>{u({...d.current,filterEditorVisible:!1})}}),a.jsx(LF,{visible:d.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{u({...d.current,exportDialogVisible:!1})}}),a.jsx(cz,{visible:d.current.filterDialogVisible,title:(N=c.filterDialogSearchParam)!=null&&N.code?gi(c.filterDialogSearchParam.code):"",resourceType:j,searchParam:c.filterDialogSearchParam,filter:c.filterDialogFilter,defaultValue:"",onOk:D=>{b(Jf(e.search,D.code,D.operator,D.value)),u({...d.current,filterDialogVisible:!1})},onCancel:()=>{u({...d.current,filterDialogVisible:!1})}},(B=c.filterDialogSearchParam)==null?void 0:B.code)]})}const Oc=p.memo(Tz);function kz(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:[l0(n.operator)," ",a.jsx(jT,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function Rz(e){return Math.floor((e.offset??0)/(e.count??Uf))+1}function Iz(e,t){const n=e.count??Uf,r=kT(e,t);return Math.ceil(r/n)}function TT(e,t){return Math.min(kT(e,t),(e.offset??0)+1)}function Dz(e,t){var n;return TT(e,t)+(((n=t.entry)==null?void 0:n.length)??0)-1}function kT(e,t){var r,o;let n=t.total;return n===void 0&&(n=(e.offset??0)+(((r=t.entry)==null?void 0:r.length)??0)+((o=t.link)!=null&&o.some(i=>i.relation==="next")?1:0)),n}function _z(e){const t=ne(),[n,r]=p.useState(!1),[o,i]=p.useState(),{query:s,fields:l}=e,[c,u]=p.useState(),[d,f]=p.useState({}),h=p.useRef();h.current=c;const m=p.useRef({});m.current=d,p.useEffect(()=>{i(void 0),t.graphql(s).then(u).catch(w=>i(ut(w)))},[t,s]);function g(w,S){w.stopPropagation();const E=w.target.checked,P={...m.current};E?P[S]=!0:delete P[S],f(P)}function v(w){var T;w.stopPropagation();const j=w.target.checked,E={},P=(T=h.current)==null?void 0:T.data.ResourceList;j&&P&&P.forEach(k=>{k.id&&(E[k.id]=!0)}),f(E)}function b(){var S;const w=(S=h.current)==null?void 0:S.data.ResourceList;if(!w||w.length===0)return!1;for(const j of w)if(j.id&&!m.current[j.id])return!1;return!0}function x(w,S){VP(w.target)||(tt(w),w.button!==1&&e.onClick&&e.onClick(new Id(S,w)),w.button===1&&e.onAuxClick&&e.onAuxClick(new Id(S,w)))}if(p.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return a.jsx($n,{});const y=e.checkboxesEnabled;return a.jsxs("div",{onContextMenu:w=>tt(w),"data-testid":"search-control",children:[a.jsxs(me,{children:[a.jsx(me.Thead,{children:a.jsxs(me.Tr,{children:[y&&a.jsx(me.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:b(),onChange:w=>v(w)})}),l.map(w=>a.jsx(me.Th,{children:w.name},w.name))]})}),a.jsx(me.Tbody,{children:c==null?void 0:c.data.ResourceList.map(w=>w&&a.jsxs(me.Tr,{"data-testid":"search-control-row",onClick:S=>x(S,w),onAuxClick:S=>x(S,w),children:[y&&a.jsx(me.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${w.id}`,checked:!!d[w.id],onChange:S=>g(S,w.id)})}),l.map(S=>a.jsx(me.Td,{children:a.jsx($F,{propertyType:S.propertyType,path:S.fhirPath,resource:w})},S.name))]},w.id))})]}),(c==null?void 0:c.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(ee,{onClick:()=>e.onBulk(Object.keys(m.current)),children:"Bulk..."})]})}const Az=p.memo(_z);function $r(e){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 491 491",style:{width:e.size,height:e.size},children:[a.jsx("title",{children:"Medplum Logo"}),a.jsx("path",{fill:e.fill??"#ad7136",d:"M282 67c6-16 16-29 29-40L289 0c-22 17-37 41-43 68l17 23 19-24z"}),a.jsx("path",{fill:e.fill??"#946af9",d:"M311 63c-17 0-33 4-48 11-16-7-32-11-49-11-87 0-158 96-158 214s71 214 158 214c17 0 33-4 49-11 15 7 31 11 48 11 87 0 158-96 158-214S398 63 311 63z"}),a.jsx("path",{fill:e.fill??"#7857c5",d:"M231 489l-17 2c-87 0-158-96-158-214S127 63 214 63l17 1c-39 12-70 102-70 213s31 201 70 212z"}),a.jsx("path",{fill:e.fill??"#40bc26",d:"M207 220a176 176 0 01-177 43A176 176 0 01251 43l1 5c17 59 2 125-45 172z"}),a.jsx("path",{fill:e.fill??"#33961e",d:"M252 48A421 421 0 0057 270l-27-7A176 176 0 01251 43l1 5z"})]})}function Nz(e){const{group:t}=e;return a.jsx(On,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(Y,{children:[t.measureScore&&a.jsx($z,{group:t}),!t.measureScore&&a.jsx(Mz,{group:t})]})})}function Oz(e){const{measure:t}=e;return a.jsxs(a.Fragment,{children:[a.jsx(ae,{fz:"md",fw:500,mb:8,children:t.title}),a.jsx(ae,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function Mz(e){const{group:t}=e,n=t.population,r=n==null?void 0:n.find(c=>Sa(c.code)==="numerator"),o=n==null?void 0:n.find(c=>Sa(c.code)==="denominator"),i=r==null?void 0:r.count,s=o==null?void 0:o.count;if(s===0)return a.jsxs(q,{children:[a.jsx(ce,{order:3,children:"Not Applicable"}),a.jsx(ae,{children:`Denominator: ${s}`})]});if(i===void 0||s===void 0)return a.jsxs(q,{children:[a.jsx(ce,{order:3,children:"Insufficient Data"}),a.jsx(ae,{children:`Numerator: ${i}`}),a.jsx(ae,{children:`Denominator: ${s}`})]});const l=i/s*100;return a.jsx(Of,{size:120,thickness:12,roundCaps:!0,sections:[{value:l,color:RT(l)}],label:a.jsx(Xi,{justify:"center",children:a.jsxs(ae,{fw:700,fz:18,children:[i," / ",s]})})})}function $z(e){var r,o,i;const{group:t}=e,n=((r=t.measureScore)==null?void 0:r.unit)??((o=t.measureScore)==null?void 0:o.code);return a.jsx(a.Fragment,{children:n==="%"?a.jsx(Of,{size:120,thickness:12,roundCaps:!0,sections:[{value:Lz(t),color:RT(((i=t==null?void 0:t.measureScore)==null?void 0:i.value)??0)}],label:a.jsx(Xi,{justify:"center",children:a.jsx(ae,{fw:700,fz:18,children:a.jsx(Xl,{value:t.measureScore})})})}):a.jsx(Xi,{h:120,align:"center",children:a.jsx(ce,{order:3,children:a.jsx(Xl,{value:t.measureScore})})})})}function Lz(e){var r,o;const t=(r=e.measureScore)==null?void 0:r.value,n=(o=e.measureScore)==null?void 0:o.unit;return t?t<=1&&n==="%"?t*100:t:0}function RT(e){return e<=33?"red":e<=67?"yellow":"green"}function Fz(e){var r;const t=st(e.measureReport),[n]=ZL("Measure",{url:t==null?void 0:t.measure});return t?a.jsxs(q,{children:[n&&a.jsx(Oz,{measure:n}),a.jsx(ay,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:(r=t.group)==null?void 0:r.map((o,i)=>a.jsx(Nz,{group:o},o.id??i))})]}):null}function io(e){var n;const t=((n=e.outcome)==null?void 0:n.issue)||e.issues;return!t||t.length===0?null:a.jsx(hs,{icon:a.jsx(kc,{size:16}),color:"red",children:t.map(r=>{var o;return a.jsx("div",{"data-testid":"text-field-error",children:Jj(r)},(o=r.details)==null?void 0:o.text)})})}function zz(e){const t=p.useCallback((n,r,o)=>{const i=`${r}/${o}`,s=100;return Promise.allSettled([n.readHistory("Patient",o),n.search("Communication",{subject:i,_count:s}),n.search("Device",{patient:i,_count:s}),n.search("DeviceRequest",{patient:i,_count:s}),n.search("DiagnosticReport",{subject:i,_count:s}),n.search("Media",{subject:i,_count:s}),n.search("ServiceRequest",{subject:i,_count:s}),n.search("Task",{subject:i,_count:s})])},[]);return a.jsx(Xf,{value:e.patient,loadTimelineResources:t,createCommunication:(n,r,o)=>({resourceType:"Communication",status:"completed",subject:bt(n),sender:bt(r),sent:new Date().toISOString(),payload:[{contentString:o}]}),createMedia:(n,r,o)=>({resourceType:"Media",status:"completed",subject:bt(n),operator:bt(r),issued:new Date().toISOString(),content:o})})}const Bz="_section_14dzq_2",Uz="_hovering_14dzq_11",Vz="_editing_14dzq_15",Wz="_bottomActions_14dzq_20",Ks={section:Bz,hovering:Uz,editing:Vz,bottomActions:Wz};function Hz(e){const t=ne(),n=st(e.value),[r,o]=p.useState(!1),[i,s]=p.useState(),[l,c]=p.useState(),[u,d]=p.useState();function f(){c(void 0)}function h(){s(void 0)}const m=p.useRef();if(m.current=u,p.useEffect(()=>{t.requestSchema("PlanDefinition").then(()=>o(!0)).catch(console.log)},[t]),p.useEffect(()=>(d(Xz(n??{resourceType:"PlanDefinition",status:"active"})),document.addEventListener("mouseover",f),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",f),document.removeEventListener("click",h)}),[n]),!r||!u)return null;function g(v,b){d({...m.current,[v]:b})}return a.jsx("div",{children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(u),children:[a.jsx(ie,{label:"Plan Title",defaultValue:u.title,onChange:v=>g("title",v.currentTarget.value)}),a.jsx(IT,{actions:u.action||[],selectedKey:i,setSelectedKey:s,hoverKey:l,setHoverKey:c,onChange:v=>g("action",v)}),a.jsx(ee,{type:"submit",children:"Save"})]})})}function IT(e){const t=p.useRef();t.current=e.actions;function n(i){e.onChange(t.current.map(s=>s.id===i.id?i:s))}function r(i){e.onChange([...t.current,i]),e.setSelectedKey(i.id)}function o(i){e.onChange(t.current.filter(s=>s!==i))}return a.jsxs("div",{className:Ks.section,children:[e.actions.map(i=>a.jsx("div",{children:a.jsx(qz,{action:i,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>o(i)})},i.id)),a.jsx("div",{className:Ks.bottomActions,children:a.jsx(Ve,{href:"#",onClick:i=>{tt(i),r({id:_T()})},children:"Add action"})})]})}function qz(e){const{action:t}=e,n=Yz(t),r=e.selectedKey===e.action.id,o=e.hoverKey===e.action.id;function i(c){c.stopPropagation(),e.setSelectedKey(e.action.id)}function s(c){tt(c),e.setHoverKey(e.action.id)}const l=Ze(Ks.section,{[Ks.editing]:r,[Ks.hovering]:o&&!r});return a.jsxs("div",{"data-testid":t.id,className:l,onClick:i,onMouseOver:s,onFocus:s,children:[r?a.jsx(Qz,{action:t,actionType:n,onChange:e.onChange,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onRemove:e.onRemove}):a.jsx(Gz,{action:t,actionType:n}),a.jsx("div",{className:Ks.bottomActions,children:a.jsx(Ve,{href:"#",onClick:c=>{c.preventDefault(),e.onRemove()},children:"Remove"})})]})}const _m={path:"PlanDefinition.action.timing[x]",min:0,max:1,description:"",isArray:!1,constraints:[],type:["dateTime","Period","Range","Timing"].map(e=>({code:e}))};function Gz(e){const{action:t,actionType:n}=e,[r,o]=DT(t);return a.jsxs("div",{children:[a.jsxs("div",{children:[t.title||"Untitled"," ",n&&`(${n})`]}),t.definitionCanonical&&a.jsx("div",{children:a.jsx(Rd,{value:{reference:t.definitionCanonical}})}),r&&a.jsx("div",{children:a.jsx(jo,{property:_m,propertyType:o,value:r})})]})}function Qz(e){const{action:t}=e,[n,r]=p.useState(e.actionType);function o(i,s){e.onChange({...t,[i]:s})}return a.jsxs(Se,{gap:"xl",children:[a.jsx(ie,{name:`actionTitle-${t.id}`,label:"Title",defaultValue:t.title,onChange:i=>o("title",i.currentTarget.value)}),a.jsx(ie,{name:`actionDescription-${t.id}`,label:"Description",defaultValue:t.description,onChange:i=>o("description",i.currentTarget.value)}),a.jsx(xt,{label:"Type of Action",description:"The type of the action to be performed.",name:`actionType-${t.id}`,defaultValue:n,onChange:i=>r(i.currentTarget.value),data:["","appointment","lab","questionnaire","task"]}),t.action&&t.action.length>0&&a.jsx(IT,{actions:t.action,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:i=>o("action",i)}),(()=>{switch(n){case"appointment":return a.jsx(vu,{title:"Appointment",description:"The subject must schedule an appointment from the schedule.",resourceType:"Schedule",action:t,onChange:e.onChange});case"lab":return a.jsx(vu,{title:"Lab",description:"The subject must complete the following lab panel.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});case"questionnaire":return a.jsx(vu,{title:"Questionnaire",description:"The subject must complete the selected questionnaire.",resourceType:"Questionnaire",action:t,onChange:e.onChange});case"task":return a.jsx(vu,{title:"Task",description:"The subject must complete the following task.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});default:return null}})(),a.jsx(it,{title:"Timing",description:"When the action should take place.",children:a.jsx(Kz,{name:"timing-"+t.id,action:t,onChange:e.onChange})})]})}function vu(e){const{id:t,definitionCanonical:n}=e.action,r=n!=null&&n.startsWith(e.resourceType+"/")?{reference:n}:void 0;return a.jsx(La,{name:t,resourceType:e.resourceType,defaultValue:r,loadOnFocus:!0,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:lt(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function Kz(e){const t=e.action,n="timing",[r,o]=DT(t);return a.jsx(Fa,{property:_m,name:"timing[x]",path:"PlanDefinition.timing[x]",defaultValue:r,defaultPropertyType:o,onChange:(i,s)=>{e.onChange(JP(t,n,s??n,_m,i))},outcome:void 0})}function Yz(e){var t,n,r;if((t=e.definitionCanonical)!=null&&t.startsWith("Schedule"))return"appointment";if((n=e.definitionCanonical)!=null&&n.startsWith("Questionnaire/"))return"questionnaire";if((r=e.definitionCanonical)!=null&&r.startsWith("ActivityDefinition/"))return"task"}function DT(e){return Gf({type:"PlanDefinitionAction",value:e},"timing")}let sp=1;function _T(e){if(e){if(e.startsWith("id-")){const t=parseInt(e.substring(3),10);isNaN(t)||(sp=Math.max(sp,t+1))}return e}return"id-"+sp++}function Xz(e){return{...e,action:AT(e.action)}}function AT(e){if(e)return e.map(t=>({...t,id:_T(t.id),action:AT(t.action)}))}var mt=(e=>(e.group="group",e.display="display",e.question="question",e.boolean="boolean",e.decimal="decimal",e.integer="integer",e.date="date",e.dateTime="dateTime",e.time="time",e.string="string",e.text="text",e.url="url",e.choice="choice",e.openChoice="open-choice",e.attachment="attachment",e.reference="reference",e.quantity="quantity",e))(mt||{});function Jz(e){return e.type==="choice"||e.type==="open-choice"}function Zz(e,t){if(!e.enableWhen)return!0;const n=e.enableBehavior??"any";for(const r of e.enableWhen){const o=NT(t,r.question);if(r.operator==="exists"&&!r.answerBoolean&&!(o!=null&&o.length)){if(n==="any")return!0;continue}const{anyMatch:i,allMatch:s}=nB(r,o,n);if(n==="any"&&i)return!0;if(n==="all"&&!s)return!1}return n!=="any"}function eB(e,t,n){return e.map(r=>{var s;const o=(s=n.answerOption)==null?void 0:s.find(l=>vs(l.valueCoding)===r||l[t]===r),i=Kt({type:"QuestionnaireItemAnswerOption",value:o},"value");return{[t]:i==null?void 0:i.value}})}function NT(e,t){if(e)for(const n of e){if(n.linkId===t)return n.answer;if(n.item){const r=NT(n.item,t);if(r)return r}}}function tB(e,t,n){if(n==="exists")return!!e===t.value;if(e){const r=n==="="||n==="!="?n==null?void 0:n.replace("=","~"):n,[{value:o}]=Yl(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return o}else return!1}function nB(e,t,n){const r=t||[],o=Kt({type:"QuestionnaireItemEnableWhen",value:e},"answer[x]");let i=!1,s=!0;for(const l of r){const c=Kt({type:"QuestionnaireResponseItemAnswer",value:l},"value[x]"),{operator:u}=e;if(tB(c,o,u)?i=!0:s=!1,n==="any"&&i)break}return{anyMatch:i,allMatch:s}}function OT(e){var n,r;const t=Ec(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return(r=(n=t.valueCodeableConcept)==null?void 0:n.coding)==null?void 0:r.map(o=>o.code)}}function ap(e,t){var o;const n=ro(e);let r=Ec(n,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");return!t||t.length===0?(r&&(n.extension=(o=n.extension)==null?void 0:o.filter(i=>i!==r)),n):(r||(n.extension||(n.extension=[]),r={url:"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource"},n.extension.push(r)),t.length===1?(r.valueCode=t[0],delete r.valueCodeableConcept):(r.valueCodeableConcept={coding:t.map(i=>({code:i}))},delete r.valueCode),n)}function rB(e,t,n){const r=Ec(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter");if(!(r!=null&&r.valueString))return;let o=r.valueString;t!=null&&t.reference&&(o=o.replaceAll("$subj",t.reference)),n!=null&&n.reference&&(o=o.replaceAll("$encounter",n.reference));const i={},s=o.split("&");for(const l of s){const[c,u]=QO(l,"=",2);i[c]=u}return i}function oB(e){return{resourceType:"QuestionnaireResponse",questionnaire:lt(e),item:MT(e.item),status:"in-progress"}}function MT(e){return(e==null?void 0:e.map($T))??[]}function $T(e){var t;return{id:sB(),linkId:e.linkId,text:e.text,item:MT(e.item),answer:((t=e.initial)==null?void 0:t.map(aB))??[]}}let iB=1;function sB(){return"id-"+iB++}function aB(e){return{...e}}function lB(e){return e.value.display||e.value.reference||Qn(e.value)}function cB(e){var n,r,o,i;const t=(n=e==null?void 0:e.item)==null?void 0:n[0];if(t){const s=Ec(t,"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl");if(((i=(o=(r=s==null?void 0:s.valueCodeableConcept)==null?void 0:r.coding)==null?void 0:o[0])==null?void 0:i.code)==="page")return e.item.length}return 1}const LT=p.createContext({});function Am(e){const t=p.useContext(LT),n=e.item,r=e.response;function o(u){var f,h,m,g;let d;Array.isArray(u)?d=u:e.index>=(((h=(f=e.response)==null?void 0:f.answer)==null?void 0:h.length)??0)?d=(((m=e.response)==null?void 0:m.answer)??[]).concat([u]):d=(((g=e.response)==null?void 0:g.answer)??[]).map((b,x)=>x===e.index?u:b)??[],e.onChange({id:r==null?void 0:r.id,linkId:r==null?void 0:r.linkId,text:n.text,answer:d})}const i=n.type;if(!i)return null;const s=n.linkId;if(!s)return null;const l=n.initial&&n.initial.length>0?n.initial[0]:void 0,c=c0(r,e.index)??Kt({type:"QuestionnaireItemInitial",value:l},"value");switch(i){case mt.display:return a.jsx("p",{children:e.item.text},e.item.linkId);case mt.boolean:return a.jsx(YP,{title:e.item.text,htmlFor:e.item.linkId,children:a.jsx(ur,{id:e.item.linkId,name:e.item.linkId,defaultChecked:c==null?void 0:c.value,onChange:u=>o({valueBoolean:u.currentTarget.checked})})},e.item.linkId);case mt.decimal:return a.jsx(ie,{type:"number",step:"any",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDecimal:u.currentTarget.valueAsNumber})});case mt.integer:return a.jsx(ie,{type:"number",step:1,id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueInteger:u.currentTarget.valueAsNumber})});case mt.date:return a.jsx(ie,{type:"date",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDate:u.currentTarget.value})});case mt.dateTime:return a.jsx(es,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDateTime:u})});case mt.time:return a.jsx(ie,{type:"time",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueTime:u.currentTarget.value})});case mt.string:case mt.url:return a.jsx(ie,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case mt.text:return a.jsx(ps,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case mt.attachment:return a.jsx(Y,{py:4,children:a.jsx(qP,{name:s,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueAttachment:u})})});case mt.reference:return a.jsx(Kf,{name:s,required:n.required,targetTypes:OT(n),searchCriteria:rB(n,t.subject,t.encounter),defaultValue:c==null?void 0:c.value,onChange:u=>o({valueReference:u})});case mt.quantity:return a.jsx(ts,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueQuantity:u}),disableWheel:!0});case mt.choice:case mt.openChoice:return mB(n)&&!n.answerValueSet?a.jsx(uB,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)}):a.jsx(dB,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)});default:return null}}function uB(e){var c;const{name:t,item:n,initial:r,response:o}=e;if(!((c=n.answerOption)!=null&&c.length))return a.jsx(FT,{});const i=Kt({type:"QuestionnaireItemInitial",value:r},"value"),s=[""];for(const u of n.answerOption){const d=Kt({type:"QuestionnaireItemAnswerOption",value:u},"value");s.push(vw(d))}const l=c0(o)??i;if(n.repeats){const{propertyName:u,data:d}=gB(e.item),f=hB(o);return a.jsx(Rf,{data:d,placeholder:"Select items",searchable:!0,defaultValue:f||[vw(i)],onChange:h=>{const m=eB(h,u,n);e.onChangeAnswer(m)}})}return a.jsx(xt,{id:t,name:t,onChange:u=>{const d=u.currentTarget.selectedIndex;if(d===0){e.onChangeAnswer({});return}const f=n.answerOption[d-1],h=Kt({type:"QuestionnaireItemAnswerOption",value:f},"value"),m="value"+zt(h.type);e.onChangeAnswer({[m]:h.value})},defaultValue:vs(l==null?void 0:l.value)||(l==null?void 0:l.value),data:s})}function dB(e){var s;const{name:t,item:n,initial:r,onChangeAnswer:o,response:i}=e;return!((s=n.answerOption)!=null&&s.length)&&!n.answerValueSet?a.jsx(FT,{}):n.answerValueSet?a.jsx(ZP,{name:t,binding:n.answerValueSet,onChange:l=>o({valueCoding:l})}):a.jsx(fB,{name:(i==null?void 0:i.id)??t,item:n,initial:r,response:i,onChangeAnswer:o})}function fB(e){const{name:t,item:n,initial:r,onChangeAnswer:o,response:i}=e,s=ys("QuestionnaireItemAnswerOption","value[x]"),l=Kt({type:"QuestionnaireItemInitial",value:r},"value"),c=[];let u;if(n.answerOption)for(let h=0;h<n.answerOption.length;h++){const m=n.answerOption[h],g=`${t}-option-${h}`,v=Kt({type:"QuestionnaireItemAnswerOption",value:m},"value");v!=null&&v.value&&(l&&Qn(v)===Qn(l)&&(u=g),c.push([g,v]))}const d=c0(i),f=pB(c,d);return a.jsx(ql.Group,{name:t,value:f??u,onChange:h=>{const m=c.find(g=>g[0]===h);if(m){const g=m[1],v="value"+zt(g.type);o({[v]:g.value})}},children:c.map(([h,m])=>a.jsx(ql,{id:h,value:h,py:4,label:a.jsx(jo,{property:s,propertyType:m.type,value:m.value})},h))})}function FT(){return a.jsx(ie,{disabled:!0,placeholder:"No Answers Defined"})}function zT(e){return Kt({type:"QuestionnaireItemAnswer",value:e},"value")}function c0(e,t=0){const n=e.answer;return zT((n==null?void 0:n[t])??{})}function hB(e){const t=e.answer;return t?t.map(r=>zT(r)).map(r=>vs(r==null?void 0:r.value)||(r==null?void 0:r.value)):[]}function pB(e,t){var n;return(n=e.find(r=>jc(r[1].value,t==null?void 0:t.value)))==null?void 0:n[0]}function vw(e){if(e)return e.type==="CodeableConcept"?Sa(e.value):e.type==="Coding"?vs(e.value):e.type==="Reference"?lB(e):e.value.toString()}function mB(e){var t;return!!((t=e.extension)!=null&&t.some(n=>{var r,o,i;return n.url==="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"&&((i=(o=(r=n.valueCodeableConcept)==null?void 0:r.coding)==null?void 0:o[0])==null?void 0:i.code)==="drop-down"}))}function gB(e){var i;if(((i=e.answerOption)==null?void 0:i.length)===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=Kt({type:"QuestionnaireItemAnswerOption",value:t},"value"),r="value"+zt(n.type),o=(e.answerOption??[]).map(s=>({value:yw(s,r),label:yw(s,r)}));return{propertyName:r,data:o}}function yw(e,t){var n;return vs(e.valueCoding)||((n=e[t])==null?void 0:n.toString())}const vB="_section_cpwxo_1",yB="_hovering_cpwxo_10",xB="_editing_cpwxo_14",wB="_questionBody_cpwxo_19",SB="_topActions_cpwxo_23",bB="_bottomActions_cpwxo_32",CB="_movementActions_cpwxo_43",EB="_movementIcons_cpwxo_55",jB="_columnAlignment_cpwxo_59",PB="_linkIdInput_cpwxo_64",TB="_typeSelect_cpwxo_69",Zn={section:vB,hovering:yB,editing:xB,questionBody:wB,topActions:SB,bottomActions:bB,movementActions:CB,movementIcons:EB,columnAlignment:jB,linkIdInput:PB,typeSelect:TB};function kB(e){const t=ne(),n=st(e.questionnaire),[r,o]=p.useState(!1),[i,s]=p.useState(),[l,c]=p.useState(),[u,d]=p.useState();function f(){d(void 0)}function h(){c(void 0)}p.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>o(!0)).catch(console.log)},[t]),p.useEffect(()=>(s(_B(n??{resourceType:"Questionnaire",status:"active"})),document.addEventListener("mouseover",f),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",f),document.removeEventListener("click",h)}),[n]);const m=(g,v)=>{s(g),e.autoSave&&!v&&e.onSubmit&&e.onSubmit(g)};return!r||!i?null:a.jsx("div",{children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(i),children:[a.jsx(BT,{item:i,selectedKey:l,setSelectedKey:c,hoverKey:u,setHoverKey:d,onChange:m}),a.jsx(ee,{type:"submit",children:"Save"})]})})}function BT(e){var w;const t=e.item,n=e.item,r=Oo(e.item),o=r||n.type===mt.group,i=n.linkId??"[untitled]",s=e.selectedKey===e.item.id,l=e.hoverKey===e.item.id,c=p.useRef();c.current=e.item;function u(S){tt(S),e.setSelectedKey(e.item.id)}function d(S){tt(S),e.setHoverKey(e.item.id)}function f(S){var E;const j=c.current;e.onChange({...j,item:(E=j.item)==null?void 0:E.map(P=>P.id===S.id?S:P)})}function h(S,j){e.onChange({...e.item,item:[...e.item.item??[],S]},j)}function m(S){var j;e.onChange({...e.item,item:(j=e.item.item)==null?void 0:j.filter(E=>E!==S)})}function g(S,j){e.onChange({...c.current,[S]:j})}function v(S){e.onChange({...e.item,...S})}function b(S){var j;e.onChange({...e.item,item:(j=e.item.item)==null?void 0:j.map(E=>E===S?{...E,repeats:!E.repeats}:E)})}function x(S,j){const E=OB(e.item.item,S,j);e.onChange({...e.item,item:E})}const y=Ze(Zn.section,{[Zn.editing]:s,[Zn.hovering]:l&&!s});return a.jsxs("div",{"data-testid":n.linkId,className:y,onClick:u,onMouseOver:d,onFocus:d,children:[a.jsx("div",{className:Zn.questionBody,children:s?a.jsxs(a.Fragment,{children:[r&&a.jsx(ie,{size:"xl",defaultValue:t.title,onBlur:S=>g("title",S.currentTarget.value)}),!r&&a.jsx(ps,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:S=>g("text",S.currentTarget.value)}),n.type==="reference"&&a.jsx(DB,{item:n,onChange:v}),Jz(n)&&a.jsx(RB,{item:n,onChange:S=>v(S)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx(ce,{children:t.title}),n.text&&a.jsx("div",{children:n.text}),!o&&a.jsx(Am,{item:n,index:0,onChange:()=>{},response:{linkId:n.linkId}})]})}),(w=n.item)==null?void 0:w.map((S,j)=>a.jsx("div",{children:a.jsx(BT,{item:S,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:j===0,isLast:j===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:f,onRemove:()=>m(S),onRepeatable:b,onMoveUp:()=>x(j,-1),onMoveDown:()=>x(j,1)})},S.id)),!o&&a.jsx("div",{className:Zn.topActions,children:s?a.jsxs(a.Fragment,{children:[a.jsx(ie,{size:"xs",className:Zn.linkIdInput,defaultValue:n.linkId,onBlur:S=>g("linkId",S.currentTarget.value)}),!o&&a.jsx(xt,{size:"xs",className:Zn.typeSelect,defaultValue:n.type,onChange:S=>g("type",S.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:i})}),!r&&a.jsx(q,{className:Zn.movementActions,children:a.jsxs(q,{className:Zn.columnAlignment,children:[!e.isFirst&&a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(d7,{"data-testid":"up-button",size:15,className:Zn.movementIcons})}),!e.isLast&&a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(u7,{"data-testid":"down-button",size:15,className:Zn.movementIcons})})]})}),a.jsxs("div",{className:Zn.bottomActions,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),h({id:rs(),linkId:Mm("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),h({id:rs(),linkId:Mm("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),h(NB(),!0)},children:"Add Page"}),s&&!r&&a.jsxs(a.Fragment,{children:[a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx(Ve,{href:"#",onClick:S=>{S.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function RB(e){const t=ys("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(ie,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(IB,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(q,{display:"flex",children:[a.jsx(Ve,{href:"#",onClick:r=>{tt(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:rs()}]})},children:"Add choice"}),a.jsx(Mf,{w:"lg"}),a.jsx(Ve,{href:"#",onClick:r=>{tt(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function IB(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=Gf({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(Fa,{name:"value[x]",path:"Questionnaire.answerOption.value[x]",property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(o,i)=>{const s=[...e.options],l=s.findIndex(c=>c.id===t.id);s[l]={id:t.id,[i]:o},e.onChange({...e.item,answerOption:s})},outcome:void 0},t.id)}),a.jsx("div",{children:a.jsx(Ve,{href:"#",onClick:o=>{tt(o),e.onChange({...e.item,answerOption:e.options.filter(i=>i.id!==t.id)})},children:"Remove"})})]},t.id)})})}function DB(e){const t=OT(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(Y,{children:[a.jsx(Uy,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:o=>{e.onChange(ap(e.item,t.map(i=>i===n?o:i)))}}),a.jsx(Ve,{href:"#",onClick:o=>{tt(o),e.onChange(ap(e.item,t.filter(i=>i!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx(Ve,{href:"#",onClick:n=>{tt(n),e.onChange(ap(e.item,[...t,""]))},children:"Add Resource Type"})]})}let Nm=1,Om=1;function Mm(e){return e+Nm++}function rs(){return"id-"+Om++}function _B(e){return{...e,id:e.id||rs(),item:UT(e.item)}}function UT(e){if(e)return e.forEach(t=>{var n,r;(n=t.id)!=null&&n.match(/^id-\d+$/)&&(Om=Math.max(Om,parseInt(t.id.substring(3),10)+1)),(r=t.linkId)!=null&&r.match(/^q\d+$/)&&(Nm=Math.max(Nm,parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||rs(),item:UT(t.item),answerOption:AB(t.answerOption)}))}function AB(e){if(e)return e.map(t=>({...t,id:t.id||rs()}))}function NB(){return{id:rs(),linkId:Mm("s"),type:"group",text:"New Page",extension:[{url:"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",valueCodeableConcept:{coding:[{system:"http://hl7.org/fhir/questionnaire-item-control",code:"page"}]}}]}}function OB(e,t,n){const r=e??[],o=t+n;if(o<0||o>=r.length)return r;const i=[...r];return[i[t],i[o]]=[i[o],i[t]],i}function VT(e){const{item:t,response:n,onChange:r}=e,[o,i]=p.useState(MB(t,n??{linkId:t.linkId}));if(!e.checkForQuestionEnabled(t)||!n)return null;if(t.type===mt.display)return a.jsx("p",{children:t.text},t.linkId);const s=(t==null?void 0:t.repeats)&&t.type!==mt.choice&&t.type!==mt.openChoice;return t.type===mt.boolean?a.jsx(Am,{item:t,response:n,onChange:l=>r([l]),index:0},t.linkId):a.jsxs(it,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[[...Array(o)].map((l,c)=>a.jsx(Am,{item:t,response:n,onChange:u=>r([u]),index:c},`${t.linkId}-${c}`)),s&&a.jsx(Ve,{onClick:()=>i(l=>l+1),children:"Add Item"})]},e.item.linkId)}function MB(e,t){if(e.type===mt.choice||e.type===mt.openChoice)return 1;const n=t.answer;return n!=null&&n.length?n.length:1}function WT(e){const[t,n]=p.useState(e.response);if(t.length===0)return null;function r(i,s){const l=t.map((c,u)=>u===s?i[0]:c);n(l),e.onChange(l)}function o(){const i=$T(e.item);n([...t,i])}return a.jsxs(a.Fragment,{children:[t.map((i,s)=>a.jsx(HT,{item:e.item,response:i,checkForQuestionEnabled:e.checkForQuestionEnabled,onChange:l=>r(l,s)},i.id)),e.item.repeats&&a.jsx(Ve,{onClick:o,children:`Add Group: ${e.item.text}`})]})}function HT(e){var i;const{response:t,checkForQuestionEnabled:n,onChange:r}=e;function o(s){var d;const l=(d=t.item)==null?void 0:d.map(f=>s.find(m=>m.id===f.id)??f),c=l==null?void 0:l.concat(s.slice(1)),u={...t,item:c};r([u])}return e.checkForQuestionEnabled(e.item)?a.jsxs("div",{children:[e.item.text&&a.jsx(ce,{order:3,mb:"md",children:e.item.text}),a.jsx(Se,{children:(i=e.item.item)==null?void 0:i.map(s=>{var l,c,u;return s.type===mt.group?s.repeats?a.jsx(WT,{item:s,response:((l=t.item)==null?void 0:l.filter(d=>d.linkId===s.linkId))??[],checkForQuestionEnabled:n,onChange:o},s.linkId):a.jsx(HT,{item:s,checkForQuestionEnabled:n,response:((c=t.item)==null?void 0:c.find(d=>d.linkId===s.linkId))??{linkId:s.linkId},onChange:o},s.linkId):a.jsx(VT,{item:s,response:(u=t.item)==null?void 0:u.find(d=>d.linkId===s.linkId),onChange:o,checkForQuestionEnabled:n},s.linkId)})})]},e.item.linkId):null}function $B(e){const{items:t,response:n,activePage:r,onChange:o,nextStep:i,prevStep:s,numberOfPages:l,renderPages:c,submitButtonText:u,checkForQuestionEnabled:d}=e,f=t.map(h=>{var v;const m=((v=n==null?void 0:n.item)==null?void 0:v.filter(b=>b.linkId===h.linkId))??[],g=h.type===mt.group?a.jsx(WT,{item:h,response:m,onChange:o,checkForQuestionEnabled:d},h.linkId):a.jsx(VT,{item:h,response:m==null?void 0:m[0],onChange:o,checkForQuestionEnabled:d},h.linkId);return c?a.jsx(wa.Step,{label:h.text,children:g},h.linkId):g});return a.jsxs(a.Fragment,{children:[c&&a.jsx(wa,{active:r??0,allowNextStepsSelect:!1,p:6,children:f}),!c&&a.jsx(Se,{children:f}),a.jsx(LB,{activePage:r??0,numberOfPages:l,nextStep:i,prevStep:s,submitButtonText:u})]})}function LB(e){const t=e.activePage>0,n=e.activePage<e.numberOfPages-1,r=e.activePage===e.numberOfPages-1;return a.jsxs(Y,{justify:"flex-end",mt:"xl",gap:"xs",children:[t&&a.jsx(ee,{onClick:e.prevStep,children:"Back"}),n&&a.jsx(ee,{onClick:o=>{o.currentTarget.closest("form").reportValidity()&&e.nextStep()},children:"Next"}),r&&a.jsx(ee,{type:"submit",children:e.submitButtonText??"Submit"})]})}function qT(e){const t=ne(),n=t.getProfile(),[r,o]=p.useState(!1),i=st(e.questionnaire),[s,l]=p.useState(),[c,u]=p.useState(0);p.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>t.requestSchema("QuestionnaireResponse")).then(()=>o(!0)).catch(console.log)},[t]),p.useEffect(()=>{l(i?oB(i):void 0)},[i]);function d(v){const b=(s==null?void 0:s.item)??[],y={resourceType:"QuestionnaireResponse",status:"in-progress",item:GT(b,Array.isArray(v)?v:[v])};l(y)}function f(v){return Zz(v,(s==null?void 0:s.item)??[])}if(!r||!i||!s)return null;const h=cB(i),m=()=>u(v=>v+1),g=()=>u(v=>v-1);return a.jsx(LT.Provider,{value:{subject:e.subject,encounter:e.encounter},children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>{e.onSubmit&&s&&e.onSubmit({...s,questionnaire:lt(i),subject:e.subject,source:bt(n),authored:new Date().toISOString(),status:"completed"})},children:[i.title&&a.jsx(ce,{children:i.title}),a.jsx($B,{items:i.item??[],response:s,onChange:d,renderPages:h>1,activePage:c,numberOfPages:h,submitButtonText:e.submitButtonText,checkForQuestionEnabled:f,nextStep:m,prevStep:g})]})})}function FB(e,t){const n=GT(e.item??[],t.item??[]);return{...t,item:n.length>0?n:void 0,answer:t.answer&&t.answer.length>0?t.answer:e.answer}}function GT(e,t){const n=[],r=new Set;for(const o of e){const i=o.id,s=t.find(l=>l.id===i);s?(n.push(FB(o,s)),r.add(s.id)):n.push(o)}for(const o of t)r.has(o.id)||n.push(o);return n}const zB="_section_4m5it_1",BB={section:zB},UB=["gender","age","gestationalAge","context","appliesTo","category"],VB={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function WB(e){e=Object.assign(VB,e);const t=e.definition,[n,r]=p.useState([]),[o,i]=p.useState(1),[s,l]=p.useState(1);return p.useEffect(()=>{const g=GB(t,l);r(QB(g.qualifiedInterval||[],i))},[t]),a.jsxs(Be,{testid:"reference-range-editor",onSubmit:c,children:[a.jsx(Se,{children:n.map(g=>{var v;return a.jsx(HB,{unit:YB((v=t.quantitativeDetails)==null?void 0:v.unit),onChange:f,onAdd:h,onRemove:m,onRemoveGroup:d,intervalGroup:g},`group-${g.id}`)})}),a.jsx(Qt,{title:"Add Group",variant:"subtle",size:"sm",onClick:g=>{tt(g),u({id:`group-id-${o}`,filters:{},intervals:[]}),i(v=>v+1)},children:a.jsx(Td,{})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{type:"submit",children:"Save"})})]});function c(){const g=n.flatMap(v=>v.intervals).filter(v=>!XB(v));e.onSubmit({...t,qualifiedInterval:g})}function u(g){r(v=>[...v,g])}function d(g){r(v=>v.filter(b=>b.id!==g.id))}function f(g,v){r(b=>{b=[...b];const x=b.find(w=>w.id===g),y=x==null?void 0:x.intervals.findIndex(w=>w.id===v.id);return y!==void 0&&(x!=null&&x.intervals[y])&&(x.intervals[y]=v),b})}function h(g,v){v.id===void 0&&(v.id=`id-${s}`,l(b=>b+1)),r(b=>{b=[...b];const x=b.findIndex(y=>y.id===g);if(x!==-1){const y={...b[x]};v={...v,...y.filters},y.intervals=[...y.intervals,v],b[x]=y}return b})}function m(g,v){r(b=>{b=[...b];const x=b.find(y=>y.id===g);return x&&(x.intervals=x.intervals.filter(y=>y.id!==v.id)),b})}}function HB(e){const{intervalGroup:t,unit:n}=e;return a.jsx(_c,{"data-testid":t.id,className:BB.section,children:a.jsxs(Se,{gap:"lg",children:[a.jsx(Y,{justify:"flex-end",children:a.jsx(Qt,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{tt(r),e.onRemoveGroup(t)},children:a.jsx(Pd,{})},`remove-group-button-${t.id}`)}),a.jsx(qB,{intervalGroup:t,onChange:e.onChange}),a.jsx(Rn,{}),t.intervals.map(r=>a.jsxs(Se,{gap:"xs",children:[a.jsxs(Y,{children:[a.jsx(ie,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:o=>{tt(o),e.onChange(t.id,{...r,condition:o.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(Qt,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:o=>{tt(o),e.onRemove(t.id,r)},children:a.jsx(Pd,{})},`remove-interval-${r.id}`)]}),a.jsx(qy,{onChange:o=>{e.onChange(t.id,{...r,range:o})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(Qt,{title:"Add Interval",variant:"subtle",size:"sm",onClick:r=>{tt(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:a.jsx(Td,{})})]})})}function qB(e){var r,o;const{intervalGroup:t,onChange:n}=e;t.filters.age||(t.filters.age={});for(const i of["low","high"])(r=t.filters.age[i])!=null&&r.unit||(t.filters.age[i]={...t.filters.age[i],unit:"years",system:"http://unitsofmeasure.org"});return a.jsxs(Se,{style:{maxWidth:"50%"},children:[a.jsx(Y,{children:a.jsx(xt,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:i=>{for(const s of t.intervals){let l=i.currentTarget.value;l===""&&(l=void 0),n(t.id,{...s,gender:l})}}})}),a.jsxs(Y,{gap:"xs",children:[a.jsx(ae,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),a.jsx("div",{id:`div-age-${t.id}`,children:a.jsx(qy,{name:`age-${t.id}`,defaultValue:t.filters.age,onChange:i=>{for(const s of t.intervals)n(t.id,{...s,age:i})}},`age-${t.id}`)})]}),a.jsx(xt,{data:["","pre-puberty","follicular","midcycle","luteal","postmenopausal"],label:"Endocrine:",defaultValue:((o=t.filters.context)==null?void 0:o.text)||"",onChange:i=>{for(const s of t.intervals){let l=i.currentTarget.value;l===""?(l=void 0,n(t.id,{...s,context:void 0})):n(t.id,{...s,context:{text:l,coding:[{code:l,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),a.jsx(xt,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:i=>{for(const s of t.intervals){const l=i.currentTarget.value;l===""?n(t.id,{...s,category:void 0}):n(t.id,{...s,category:l})}}})]})}function GB(e,t){const n=e.qualifiedInterval||[];let r=Math.max(...n.map(o=>{var s;const i=parseInt(((s=o.id)==null?void 0:s.substring(3))||"",10);return isNaN(i)?Number.NEGATIVE_INFINITY:i}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(o=>({...o,id:o.id||`id-${r++}`}))},t(r),e}function QB(e,t){let n=1;const r={};for(const o of e){const i=KB(o);i in r||(r[i]={id:`group-id-${n++}`,filters:Object.fromEntries(UB.map(s=>[s,o[s]])),intervals:[]}),r[i].intervals.push(o)}return t(n),Object.values(r)}function KB(e){var n,r;return[`gender=${e.gender}`,`age=${Ql(e.age)}`,`gestationalAge=${Ql(e.gestationalAge)}`,`context=${(n=e.context)==null?void 0:n.text}`,`appliesTo=${(r=e.appliesTo)==null?void 0:r.map(o=>o.text).join("+")}`,`category=${e.category}`].join(":")}function YB(e){return e&&(qO(e,"http://unitsofmeasure.org")||e.text)}function XB(e){var t,n,r,o;return((n=(t=e.range)==null?void 0:t.low)==null?void 0:n.value)===void 0&&((o=(r=e.range)==null?void 0:r.high)==null?void 0:o.value)===void 0}function JB(e){var u;const t=ne(),n=st(e.value),[r,o]=p.useState(!1),[i,s]=p.useState();if(p.useEffect(()=>{n&&!r&&(t.executeBatch(l(n)).then(s).catch(console.log),o(!0))},[t,n,r]),!n||!i)return null;return a.jsx(Wn,{children:(u=n.action)==null?void 0:u.map((d,f)=>{var v,b,x,y,w,S;const h=d.resource&&c(d.resource),m=(b=(v=h==null?void 0:h.input)==null?void 0:v[0])==null?void 0:b.valueReference,g=(y=(x=h==null?void 0:h.output)==null?void 0:x[0])==null?void 0:y.valueReference;return a.jsxs(p.Fragment,{children:[a.jsx(Wn.Col,{span:1,p:"md",children:(h==null?void 0:h.status)==="completed"?a.jsx(w7,{}):a.jsx(Q7,{color:"gray"})}),a.jsxs(Wn.Col,{span:9,p:"xs",children:[a.jsx(ae,{fw:500,children:d.title}),d.description&&a.jsx("div",{children:d.description}),a.jsxs("div",{children:["Last edited by ",a.jsx(za,{value:(w=h==null?void 0:h.meta)==null?void 0:w.author})," on ",Fn((S=h==null?void 0:h.meta)==null?void 0:S.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx(aT,{status:(h==null?void 0:h.status)||"unknown"})]})]}),a.jsxs(Wn.Col,{span:2,p:"md",children:[m&&!g&&a.jsx(ee,{onClick:()=>e.onStart(h,m),children:"Start"}),m&&g&&a.jsx(ee,{onClick:()=>e.onEdit(h,m,g),children:"Edit"})]})]},`action-${f}`)})});function l(d){var h;const f=[];if(d.action)for(const m of d.action)(h=m.resource)!=null&&h.reference&&f.push({request:{method:"GET",url:m.resource.reference}});return{resourceType:"Bundle",type:"batch",entry:f}}function c(d){for(const f of i==null?void 0:i.entry)if(f.resource&&d.reference===lt(f.resource))return f.resource}}function QT(e,t){const n=ZB(e,t);return eU(n,e,t)}function ZB(e,t){const n=e.length,r=t.length,o=n+r+1,i=1+2*o,s=i/2|0,l=new Array(i);l[s+1]={i:0,j:-1,prev:void 0,snake:!0};for(let c=0;c<o;c++){for(let u=-c;u<=c;u+=2){const d=s+u,f=d+1,h=d-1,m=l[f],g=l[h];let v,b=0;u===-c||u!==c&&g.i<m.i?(b=m.i,v=m):(b=g.i+1,v=g),l[h]=void 0;let x=b-u,y={i:b,j:x,prev:tU(v),snake:!1};for(;b<n&&x<r&&e[b]===t[x];)b++,x++;if(b>y.i&&(y={i:b,j:x,prev:y,snake:!0}),l[d]=y,b>=n&&x>=r)return l[d]}l[s+c-1]=void 0}}function eU(e,t,n){const r=[];let o=e;for(o.snake&&(o=o.prev);o!=null&&o.prev&&o.prev.j>=0;){const i=o.i,s=o.j;o=o.prev;const l=o.i,c=o.j,u={position:l,lines:t.slice(l,i)},d={position:c,lines:n.slice(c,s)};let f;u.lines.length===0&&d.lines.length>0?f="insert":u.lines.length>0&&d.lines.length===0?f="delete":f="change",r.push({original:u,revised:d,type:f}),o.snake&&(o=o.prev)}return r}function tU(e){return e&&!e.snake&&e.prev?e.prev:e}function nU(e){const t=e.entry.filter(r=>!!r.resource).map(r=>{var o;return{meta:(o=r.resource)==null?void 0:o.meta,lines:Qn(r.resource,!0).match(/[^\r\n]+/g)}}).sort((r,o)=>r.meta.lastUpdated.localeCompare(o.meta.lastUpdated)),n=t[0].lines.map(r=>({id:t[0].meta.versionId,meta:t[0].meta,value:r,span:1}));return rU(n,t),oU(n),n}function rU(e,t){for(let n=1;n<t.length;n++){const r=QT(t[n-1].lines,t[n].lines);for(const o of r){const i=o.original.position,s=o.original.lines,l=o.revised.lines;if((o.type==="delete"||o.type==="change")&&e.splice(i,s.length),o.type==="insert"||o.type==="change")for(let c=0;c<o.revised.lines.length;c++)e.splice(i+c,0,{id:t[n].meta.versionId,meta:t[n].meta,value:l[c],span:1})}}}function oU(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 iU="_container_n4i51_1",sU="_root_n4i51_5",aU="_startRow_n4i51_20",lU="_normalRow_n4i51_24",cU="_author_n4i51_28",uU="_dateTime_n4i51_32",dU="_lineNumber_n4i51_37",fU="_line_n4i51_37",hU="_pre_n4i51_52",ao={container:iU,root:sU,startRow:aU,normalRow:lU,author:cU,dateTime:uU,lineNumber:dU,line:fU,pre:hU};function pU(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function mU(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return Ns(n,"year");const r=Math.floor(t/2592e3);if(r>0)return Ns(r,"month");const o=Math.floor(t/86400);if(o>0)return Ns(o,"day");const i=Math.floor(t/3600);if(i>0)return Ns(i,"hour");const s=Math.floor(t/60);return s>0?Ns(s,"minute"):Ns(t,"second")}function Ns(e,t){return`${e} ${e===1?t:t+"s"} ago`}function gU(e){var s,l;const t=ne(),[n,r]=p.useState(e.history);if(p.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=(l=(s=n.entry)==null?void 0:s[0])==null?void 0:l.resource;if(!o)return null;const i=nU(n);return a.jsx("div",{className:ao.container,children:a.jsx("table",{className:ao.root,children:a.jsx("tbody",{children:i.map((c,u)=>a.jsxs("tr",{className:c.span>0?ao.startRow:ao.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:ao.author,rowSpan:c.span,children:a.jsx(sa,{value:c.meta.author,link:!0})}),a.jsx("td",{className:ao.dateTime,rowSpan:c.span,children:a.jsx(Le,{to:pU(o,c.meta.versionId),children:mU(c.meta.lastUpdated)})})]}),a.jsx("td",{className:ao.lineNumber,children:u+1}),a.jsx("td",{className:ao.line,children:a.jsx("pre",{className:ao.pre,children:c.value})})]},"row-"+u))})})})}const vU="_removed_mgz0k_2",yU="_added_mgz0k_7",xw={removed:vU,added:yU};function xU(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=Qn(t,!0).match(/[^\r\n]+/g),o=Qn(n,!0).match(/[^\r\n]+/g),i=QT(r,o);return a.jsx("pre",{style:{color:"gray"},children:i.map((s,l)=>a.jsx(wU,{delta:s},"delta"+l))})}function wU(e){return a.jsxs(a.Fragment,{children:["...",a.jsx("br",{}),e.delta.original.lines.length>0&&a.jsx("div",{className:xw.removed,children:e.delta.original.lines.join(`
|
|
195
|
+
`)}),e.delta.revised.lines.length>0&&a.jsx("div",{className:xw.added,children:e.delta.revised.lines.join(`
|
|
196
|
+
`)}),"...",a.jsx("br",{})]})}function Dd(e){const{outcome:t}=e,n=ne(),r=st(e.defaultValue),[o,i]=p.useState(),[s,l]=p.useState();return p.useEffect(()=>{if(r)if(e.profileUrl){const c=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{const u=Tc(c);if(u){i(u.name);const d=QL(r,u);l(d)}else console.error(`Schema not found for ${c}`)}).catch(u=>{console.error("Error in requestProfileSchema",u)})}else{const c=e.schemaName??(r==null?void 0:r.resourceType);n.requestSchema(c).then(()=>{l(r),i(c)}).catch(console.log)}},[n,r,e.schemaName,e.profileUrl]),!o||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:c=>{c.preventDefault(),e.onSubmit&&e.onSubmit(s)},children:[a.jsxs(Se,{mb:"xl",children:[a.jsx(it,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(ie,{name:"resourceType",defaultValue:s.resourceType,disabled:!0})}),a.jsx(it,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(ie,{name:"id",defaultValue:s.id,disabled:!0})})]}),a.jsx(Ky,{path:s.resourceType,typeName:o,defaultValue:s,outcome:t,onChange:l,profileUrl:e.profileUrl}),a.jsxs(Y,{justify:"flex-end",mt:"xl",children:[a.jsx(ee,{type:"submit",children:"OK"}),e.onDelete&&a.jsx(ee,{variant:"outline",color:"red",type:"button",onClick:()=>{e.onDelete(s)},children:"Delete"})]})]})}function SU(e){var o;const t=ne(),[n,r]=p.useState(e.history);return p.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(me,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx(me.Thead,{children:a.jsxs(me.Tr,{children:[a.jsx(me.Th,{children:"Author"}),a.jsx(me.Th,{children:"Date"}),a.jsx(me.Th,{children:"Version"})]})}),a.jsx(me.Tbody,{children:(o=n.entry)==null?void 0:o.map((i,s)=>a.jsx(bU,{entry:i},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function bU(e){var r,o,i;const{response:t,resource:n}=e.entry;return n?a.jsxs(me.Tr,{children:[a.jsx(me.Td,{children:a.jsx(sa,{value:(r=n.meta)==null?void 0:r.author,link:!0})}),a.jsx(me.Td,{children:Fn((o=n.meta)==null?void 0:o.lastUpdated)}),a.jsx(me.Td,{children:a.jsx(Le,{to:CU(n),children:(i=n.meta)==null?void 0:i.versionId})})]}):a.jsx(me.Tr,{children:a.jsx(me.Td,{colSpan:3,children:Te(t==null?void 0:t.outcome)})})}function CU(e){var t;return`/${e.resourceType}/${e.id}/_history/${(t=e.meta)==null?void 0:t.versionId}`}function EU(e){return a.jsx(Xf,{value:e.serviceRequest,loadTimelineResources:async(t,n,r)=>{const o=`${n}/${r}`,i=100;return Promise.allSettled([t.readHistory("ServiceRequest",r),t.search("Communication",{"based-on":o,_count:i}),t.search("DiagnosticReport",{"based-on":o,_count:i}),t.search("Media",{"based-on":o,_count:i}),t.search("DocumentReference",{related:o,_count:i}),t.search("Task",{_filter:`based-on eq ${o} or focus eq ${o} or subject eq ${o}`,_count:i})])},createCommunication:(t,n,r)=>({resourceType:"Communication",status:"completed",basedOn:[bt(t)],subject:t.subject,sender:bt(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",basedOn:[bt(t)],subject:t.subject,operator:bt(n),issued:new Date().toISOString(),content:r})})}function jU(e){const t=ne(),{client:n,patient:r,encounter:o,children:i,...s}=e;function l(){t.createResource({resourceType:"SmartAppLaunch",patient:r,encounter:o}).then(c=>{const u=new URL(n.launchUri);u.searchParams.set("iss",t.getBaseUrl()+"fhir/R4"),u.searchParams.set("launch",c.id),window.location.assign(u.toString())}).catch(c=>le({color:"red",message:Te(c),autoClose:!1}))}return a.jsx(Ve,{onClick:()=>l(),...s,children:i})}function KT(e){const t=ne(),[n,r]=p.useState();return a.jsxs(Be,{style:{maxWidth:400},onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(i){r(ut(i))}},children:[a.jsxs(tn,{style:{flexDirection:"column"},children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Create project"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(ie,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:Fe(n,"firstName")}),a.jsxs(ae,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Ve,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ve,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(ee,{type:"submit",children:"Create project"})})]})}function YT(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 XT(e){const t=ne(),{googleClientId:n,handleGoogleCredential:r}=e,o=p.useRef(null),[i,s]=p.useState(typeof google<"u"),[l,c]=p.useState(!1),[u,d]=p.useState(!1);return p.useEffect(()=>{if(typeof google>"u"){YT("https://accounts.google.com/gsi/client",()=>s(!0));return}l||(google.accounts.id.initialize({client_id:n,callback:r}),c(!0)),o.current&&!u&&(google.accounts.id.renderButton(o.current,{}),d(!0))},[t,n,l,i,o,u,r]),n?a.jsx("div",{ref:o}):null}var PU={MEDPLUM_BASE_URL:"__MEDPLUM_BASE_URL__",MEDPLUM_CLIENT_ID:"__MEDPLUM_CLIENT_ID__",GOOGLE_CLIENT_ID:"__GOOGLE_CLIENT_ID__",RECAPTCHA_SITE_KEY:"__RECAPTCHA_SITE_KEY__",MEDPLUM_REGISTER_ENABLED:"__MEDPLUM_REGISTER_ENABLED__",MEDPLUM_VERSION:"3.0.5-443ecc48",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function JT(e){var t;if(e)return e;if(typeof window<"u"){const n=window.location.protocol+"//"+window.location.host;if((((t=PU.GOOGLE_AUTH_ORIGINS)==null?void 0:t.split(","))??[]).includes(n))return"__GOOGLE_CLIENT_ID__"}}function ZT(e){typeof grecaptcha>"u"&&YT("https://www.google.com/recaptcha/api.js?render="+e)}function ek(e){return new Promise((t,n)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(r){n(r)}})})}function TU(e){const t=JT(e.googleClientId),n=e.recaptchaSiteKey,r=ne(),[o,i]=p.useState(),s=Qf(o,void 0);return p.useEffect(()=>{n&&ZT(n)},[n]),a.jsxs(Be,{style:{maxWidth:400},onSubmit:async l=>{try{let c="";n&&(c=await ek(n)),e.handleAuthResponse(await r.startNewUser({projectId:e.projectId,clientId:e.clientId,firstName:l.firstName,lastName:l.lastName,email:l.email,password:l.password,remember:l.remember==="true",recaptchaSiteKey:n,recaptchaToken:c}))}catch(c){i(ut(c))}},children:[a.jsx(tn,{style:{flexDirection:"column"},children:e.children}),a.jsx(io,{issues:s}),t&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(XT,{googleClientId:t,handleGoogleCredential:async l=>{try{e.handleAuthResponse(await r.startGoogleLogin({googleClientId:l.clientId,googleCredential:l.credential,createUser:!0}))}catch(c){i(ut(c))}}})}),a.jsx(Rn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(ie,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:Fe(o,"firstName")}),a.jsx(ie,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:Fe(o,"lastName")}),a.jsx(ie,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:Fe(o,"email")}),a.jsx(Rr,{name:"password",label:"Password",autoComplete:"off",required:!0,error:Fe(o,"password")}),a.jsxs(ae,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Ve,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ve,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),a.jsxs(ae,{c:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",a.jsx(Ve,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ve,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(ur,{name:"remember",label:"Remember me",size:"xs"}),a.jsx(ee,{type:"submit",children:"Create account"})]})]})}function kU(e){const{type:t,projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,onSuccess:s}=e,l=ne(),[c,u]=p.useState(),[d,f]=p.useState();p.useEffect(()=>{t==="patient"&&c&&l.startNewPatient({login:c,projectId:n}).then(m=>l.processCode(m.code)).then(()=>s()).catch(m=>f(ut(m)))},[l,t,n,c,s]);function h(m){m.code?l.processCode(m.code).then(()=>s()).catch(console.log):m.login&&u(m.login)}return a.jsxs(xe,{width:450,children:[d&&a.jsx("pre",{children:JSON.stringify(d,null,2)}),!c&&a.jsx(TU,{projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,handleAuthResponse:h,children:e.children}),c&&t==="project"&&a.jsx(KT,{login:c,handleAuthResponse:h})]})}function RU(e){const[t,n]=p.useState();return t?a.jsx(DU,{email:t,...e}):a.jsx(IU,{setEmail:n,...e})}function IU(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:o,disableEmailAuth:i,...s}=e,l=ne(),c=!e.disableGoogleAuth&&JT(e.googleClientId),u=p.useCallback(async h=>{if(!h.authorizeUrl)return!1;const m=JSON.stringify({...await l.ensureCodeChallenge(s),domain:h.domain}),g=new URL(h.authorizeUrl);return g.searchParams.set("state",m),window.location.assign(g.toString()),!0},[l,s]),d=p.useCallback(async h=>{const m=await l.post("auth/method",{email:h.email});await u(m)||t(h.email)},[l,u,t]),f=p.useCallback(async h=>{const m=await l.startGoogleLogin({...s,googleCredential:h.credential});await u(m)||r(m)},[l,s,u,r]);return a.jsxs(Be,{style:{maxWidth:400},onSubmit:d,children:[a.jsx(tn,{style:{flexDirection:"column"},children:o}),c&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(XT,{googleClientId:c,handleGoogleCredential:f})}),!i&&a.jsx(Rn,{label:"or",labelPosition:"center",my:"lg"})]}),!i&&a.jsx(ie,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[a.jsx("div",{children:n&&a.jsx(Ve,{component:"button",type:"button",color:"dimmed",onClick:n,size:"xs",children:"Register"})}),!i&&a.jsx(ee,{type:"submit",children:"Next"})]})]})}function DU(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...o}=e,i=ne(),[s,l]=p.useState(),c=Qf(s,void 0),u=p.useCallback(d=>{i.startLogin({...o,password:d.password,remember:d.remember==="on"}).then(n).catch(f=>l(ut(f)))},[i,o,n]);return a.jsxs(Be,{style:{maxWidth:400},onSubmit:u,children:[a.jsx(tn,{style:{flexDirection:"column"},children:r}),a.jsx(io,{issues:c}),a.jsx(Se,{gap:"xl",children:a.jsx(Rr,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:Fe(s,"password")})}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[t&&a.jsx(Ve,{component:"button",type:"button",c:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),a.jsx(ur,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1}}),a.jsx(ee,{type:"submit",children:"Sign in"})]})]})}function _U(e){const t=ne(),n=gf(),[r,o]=p.useState(""),[i,s]=p.useState();function l(f){var h;return!!((h=f==null?void 0:f.toLowerCase())!=null&&h.includes(r.toLowerCase()))}function c(f){var h,m;return l((h=f.profile)==null?void 0:h.display)||l((m=f.project)==null?void 0:m.display)}function u(f){t.post("auth/profile",{login:e.login,profile:f}).then(e.handleAuthResponse).catch(h=>s(ut(h)))}const d=e.memberships.filter(c).slice(0,10).map(f=>a.jsx(_e.Option,{value:f.id,children:a.jsx(AU,{...f})},f.id));return a.jsxs(Se,{children:[a.jsxs(Xi,{gap:"md",mb:"md",justify:"center",align:"center",direction:"column",wrap:"nowrap",children:[a.jsx($r,{size:32}),a.jsx(ce,{order:3,children:"Choose profile"})]}),a.jsx(io,{outcome:i}),a.jsxs(_e,{store:n,onOptionSubmit:u,children:[a.jsx(_e.EventsTarget,{children:a.jsx(ie,{placeholder:"Search",value:r,onChange:f=>{o(f.currentTarget.value),n.updateSelectedOptionIndex()}})}),a.jsx("div",{children:a.jsx(_e.Options,{children:d.length>0?d:a.jsx(_e.Empty,{children:"Nothing found..."})})})]})]})}function AU(e){var t,n;return a.jsxs(Y,{children:[a.jsx(Ji,{radius:"xl"}),a.jsxs("div",{children:[a.jsx(ae,{fz:"sm",fw:500,children:(t=e.profile)==null?void 0:t.display}),a.jsx(ae,{fz:"xs",opacity:.6,children:(n=e.project)==null?void 0:n.display})]})]})}function NU(e){const t=ne();return a.jsx(Be,{style:{maxWidth:400},onSubmit:n=>{t.post("auth/scope",{login:e.login,scope:Object.keys(n).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:a.jsxs(Se,{children:[a.jsxs(tn,{style:{flexDirection:"column"},children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Choose scope"})]}),a.jsx(Se,{children:(e.scope??"openid").split(" ").map(n=>a.jsx(ur,{id:n,name:n,label:n,defaultChecked:!0},n))}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{type:"submit",children:"Set scope"})})]})})}function OU(e){const t=ne(),[n,r]=p.useState();return a.jsx(Be,{style:{maxWidth:400},onSubmit:o=>{r(void 0),t.post("auth/mfa/verify",{login:e.login,token:o.token}).then(e.handleAuthResponse).catch(i=>r(Te(i)))},children:a.jsxs(Se,{children:[a.jsxs(tn,{style:{flexDirection:"column"},children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Enter MFA code"})]}),n&&a.jsx(hs,{icon:a.jsx(kc,{size:16}),title:"Error",color:"red",children:n}),a.jsx(Se,{children:a.jsx(ie,{name:"token",label:"MFA code",required:!0})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{type:"submit",children:"Submit code"})})]})})}function tk(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:o,onRegister:i,onCode:s,...l}=e,c=ne(),[u,d]=p.useState(),[f,h]=p.useState(!1),[m,g]=p.useState(),v=p.useCallback(y=>{s?s(y):c.processCode(y).then(()=>{r&&r()}).catch(w=>le({color:"red",message:Te(w)}))},[c,s,r]),b=p.useCallback(y=>{h(!!y.mfaRequired),y.login&&d(y.login),y.memberships&&g(y.memberships),y.code&&(n?g(void 0):v(y.code))},[n,v]),x=p.useCallback(y=>{v(y.code)},[v]);return p.useEffect(()=>{t&&!u&&c.get("auth/login/"+t).then(b).catch(y=>le({color:"red",message:Te(y)}))},[c,t,u,b]),a.jsx(xe,{width:450,children:u?f?a.jsx(OU,{login:u,handleAuthResponse:b}):m?a.jsx(_U,{login:u,memberships:m,handleAuthResponse:b}):e.projectId==="new"?a.jsx(KT,{login:u,handleAuthResponse:b}):e.chooseScopes?a.jsx(NU,{login:u,scope:e.scope,handleAuthResponse:x}):a.jsx("div",{children:"Success"}):a.jsx(RU,{onForgotPassword:o,onRegister:i,handleAuthResponse:b,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...l,children:e.children})})}var nk,ww=uc;nk=ww.createRoot,ww.hydrateRoot;/**
|
|
197
|
+
* @remix-run/router v1.15.1
|
|
198
|
+
*
|
|
199
|
+
* Copyright (c) Remix Software Inc.
|
|
200
|
+
*
|
|
201
|
+
* This source code is licensed under the MIT license found in the
|
|
202
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
203
|
+
*
|
|
204
|
+
* @license MIT
|
|
205
|
+
*/function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}var Ot;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ot||(Ot={}));const Sw="popstate";function MU(e){e===void 0&&(e={});function t(r,o){let{pathname:i,search:s,hash:l}=r.location;return Zl("",{pathname:i,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Mc(o)}return LU(t,n,null,e)}function Me(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ea(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function $U(){return Math.random().toString(36).substr(2,8)}function bw(e,t){return{usr:e.state,key:e.key,idx:t}}function Zl(e,t,n,r){return n===void 0&&(n=null),It({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Mo(t):t,{state:n,key:t&&t.key||r||$U()})}function Mc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Mo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function LU(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,l=Ot.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(It({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=Ot.Pop;let b=d(),x=b==null?null:b-u;u=b,c&&c({action:l,location:v.location,delta:x})}function h(b,x){l=Ot.Push;let y=Zl(v.location,b,x);n&&n(y,b),u=d()+1;let w=bw(y,u),S=v.createHref(y);try{s.pushState(w,"",S)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;o.location.assign(S)}i&&c&&c({action:l,location:v.location,delta:1})}function m(b,x){l=Ot.Replace;let y=Zl(v.location,b,x);n&&n(y,b),u=d();let w=bw(y,u),S=v.createHref(y);s.replaceState(w,"",S),i&&c&&c({action:l,location:v.location,delta:0})}function g(b){let x=o.location.origin!=="null"?o.location.origin:o.location.href,y=typeof b=="string"?b:Mc(b);return y=y.replace(/ $/,"%20"),Me(x,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,x)}let v={get action(){return l},get location(){return e(o,s)},listen(b){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(Sw,f),c=b,()=>{o.removeEventListener(Sw,f),c=null}},createHref(b){return t(o,b)},createURL:g,encodeLocation(b){let x=g(b);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:m,go(b){return s.go(b)}};return v}var Tt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Tt||(Tt={}));const FU=new Set(["lazy","caseSensitive","path","id","index","children"]);function zU(e){return e.index===!0}function $m(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,i)=>{let s=[...n,i],l=typeof o.id=="string"?o.id:s.join("-");if(Me(o.index!==!0||!o.children,"Cannot specify children on an index route"),Me(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),zU(o)){let c=It({},o,t(o),{id:l});return r[l]=c,c}else{let c=It({},o,t(o),{id:l,children:void 0});return r[l]=c,o.children&&(c.children=$m(o.children,t,s,r)),c}})}function Ys(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?Mo(t):t,o=$c(r.pathname||"/",n);if(o==null)return null;let i=rk(e);UU(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let c=eV(o);s=XU(i[l],c)}return s}function BU(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],handle:n.handle}}function rk(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let o=(i,s,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};c.relativePath.startsWith("/")&&(Me(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=ui([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Me(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),rk(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:KU(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))o(i,s);else for(let c of ok(i.path))o(i,s,c)}),t}function ok(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=ok(r.join("/")),l=[];return l.push(...s.map(c=>c===""?i:[i,c].join("/"))),o&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function UU(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:YU(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const VU=/^:[\w-]+$/,WU=3,HU=2,qU=1,GU=10,QU=-2,Cw=e=>e==="*";function KU(e,t){let n=e.split("/"),r=n.length;return n.some(Cw)&&(r+=QU),t&&(r+=HU),n.filter(o=>!Cw(o)).reduce((o,i)=>o+(VU.test(i)?WU:i===""?qU:GU),r)}function YU(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 XU(e,t){let{routesMeta:n}=e,r={},o="/",i=[];for(let s=0;s<n.length;++s){let l=n[s],c=s===n.length-1,u=o==="/"?t:t.slice(o.length)||"/",d=JU({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u);if(!d)return null;Object.assign(r,d.params);let f=l.route;i.push({params:r,pathname:ui([o,d.pathname]),pathnameBase:rV(ui([o,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(o=ui([o,d.pathnameBase]))}return i}function JU(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ZU(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:h,isOptional:m}=d;if(h==="*"){let v=l[f]||"";s=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const g=l[f];return m&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function ZU(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ea(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,(s,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function eV(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ea(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function $c(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 tV(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Mo(e):e;return{pathname:n?n.startsWith("/")?n:nV(n,t):t,search:oV(r),hash:iV(o)}}function nV(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 lp(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 ik(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function sk(e,t){let n=ik(e);return t?n.map((r,o)=>o===e.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function ak(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=Mo(e):(o=It({},e),Me(!o.pathname||!o.pathname.includes("?"),lp("?","pathname","search",o)),Me(!o.pathname||!o.pathname.includes("#"),lp("#","pathname","hash",o)),Me(!o.search||!o.search.includes("#"),lp("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,l;if(s==null)l=n;else{let f=t.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;o.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=tV(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ui=e=>e.join("/").replace(/\/\/+/g,"/"),rV=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),oV=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,iV=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class u0{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function lk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const ck=["post","put","patch","delete"],sV=new Set(ck),aV=["get",...ck],lV=new Set(aV),cV=new Set([301,302,303,307,308]),uV=new Set([307,308]),cp={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dV={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},nl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},uk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fV=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),dk="remix-router-transitions";function hV(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",r=!n;Me(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let A=e.detectErrorBoundary;o=L=>({hasErrorBoundary:A(L)})}else o=fV;let i={},s=$m(e.routes,o,void 0,i),l,c=e.basename||"/",u=It({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),d=null,f=new Set,h=null,m=null,g=null,v=e.hydrationData!=null,b=Ys(s,e.history.location,c),x=null;if(b==null){let A=er(404,{pathname:e.history.location.pathname}),{matches:L,route:W}=Dw(s);b=L,x={[W.id]:A}}let y,w=b.some(A=>A.route.lazy),S=b.some(A=>A.route.loader);if(w)y=!1;else if(!S)y=!0;else if(u.v7_partialHydration){let A=e.hydrationData?e.hydrationData.loaderData:null,L=e.hydrationData?e.hydrationData.errors:null;y=b.every(W=>W.route.loader&&W.route.loader.hydrate!==!0&&(A&&A[W.route.id]!==void 0||L&&L[W.route.id]!==void 0))}else y=e.hydrationData!=null;let j,E={historyAction:e.history.action,location:e.history.location,matches:b,initialized:y,navigation:cp,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||x,fetchers:new Map,blockers:new Map},P=Ot.Pop,T=!1,k,I=!1,O=new Map,R=null,M=!1,N=!1,B=[],D=[],$=new Map,_=0,F=-1,H=new Map,G=new Set,oe=new Map,be=new Map,je=new Set,Ae=new Map,ke=new Map,Ie=!1;function Qe(){if(d=e.history.listen(A=>{let{action:L,location:W,delta:Z}=A;if(Ie){Ie=!1;return}Ea(ke.size===0||Z!=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 ue=bs({currentLocation:E.location,nextLocation:W,historyAction:L});if(ue&&Z!=null){Ie=!0,e.history.go(Z*-1),Ss(ue,{state:"blocked",location:W,proceed(){Ss(ue,{state:"proceeding",proceed:void 0,reset:void 0,location:W}),e.history.go(Z)},reset(){let De=new Map(E.blockers);De.set(ue,nl),X({blockers:De})}});return}return Ge(L,W)}),n){EV(t,O);let A=()=>jV(t,O);t.addEventListener("pagehide",A),R=()=>t.removeEventListener("pagehide",A)}return E.initialized||Ge(Ot.Pop,E.location,{initialHydration:!0}),j}function qe(){d&&d(),R&&R(),f.clear(),k&&k.abort(),E.fetchers.forEach((A,L)=>Xn(L)),E.blockers.forEach((A,L)=>zc(L))}function ht(A){return f.add(A),()=>f.delete(A)}function X(A,L){L===void 0&&(L={}),E=It({},E,A);let W=[],Z=[];u.v7_fetcherPersist&&E.fetchers.forEach((ue,De)=>{ue.state==="idle"&&(je.has(De)?Z.push(De):W.push(De))}),[...f].forEach(ue=>ue(E,{deletedFetchers:Z,unstable_viewTransitionOpts:L.viewTransitionOpts,unstable_flushSync:L.flushSync===!0})),u.v7_fetcherPersist&&(W.forEach(ue=>E.fetchers.delete(ue)),Z.forEach(ue=>Xn(ue)))}function Pe(A,L,W){var Z,ue;let{flushSync:De}=W===void 0?{}:W,we=E.actionData!=null&&E.navigation.formMethod!=null&&Cr(E.navigation.formMethod)&&E.navigation.state==="loading"&&((Z=A.state)==null?void 0:Z._isRedirect)!==!0,ye;L.actionData?Object.keys(L.actionData).length>0?ye=L.actionData:ye=null:we?ye=E.actionData:ye=null;let ge=L.loaderData?Iw(E.loaderData,L.loaderData,L.matches||[],L.errors):E.loaderData,Oe=E.blockers;Oe.size>0&&(Oe=new Map(Oe),Oe.forEach((Ke,$t)=>Oe.set($t,nl)));let Nt=T===!0||E.navigation.formMethod!=null&&Cr(E.navigation.formMethod)&&((ue=A.state)==null?void 0:ue._isRedirect)!==!0;l&&(s=l,l=void 0),M||P===Ot.Pop||(P===Ot.Push?e.history.push(A,A.state):P===Ot.Replace&&e.history.replace(A,A.state));let he;if(P===Ot.Pop){let Ke=O.get(E.location.pathname);Ke&&Ke.has(A.pathname)?he={currentLocation:E.location,nextLocation:A}:O.has(A.pathname)&&(he={currentLocation:A,nextLocation:E.location})}else if(I){let Ke=O.get(E.location.pathname);Ke?Ke.add(A.pathname):(Ke=new Set([A.pathname]),O.set(E.location.pathname,Ke)),he={currentLocation:E.location,nextLocation:A}}X(It({},L,{actionData:ye,loaderData:ge,historyAction:P,location:A,initialized:!0,navigation:cp,revalidation:"idle",restoreScrollPosition:ah(A,L.matches||E.matches),preventScrollReset:Nt,blockers:Oe}),{viewTransitionOpts:he,flushSync:De===!0}),P=Ot.Pop,T=!1,I=!1,M=!1,N=!1,B=[],D=[]}async function Ne(A,L){if(typeof A=="number"){e.history.go(A);return}let W=Lm(E.location,E.matches,c,u.v7_prependBasename,A,u.v7_relativeSplatPath,L==null?void 0:L.fromRouteId,L==null?void 0:L.relative),{path:Z,submission:ue,error:De}=Ew(u.v7_normalizeFormMethod,!1,W,L),we=E.location,ye=Zl(E.location,Z,L&&L.state);ye=It({},ye,e.history.encodeLocation(ye));let ge=L&&L.replace!=null?L.replace:void 0,Oe=Ot.Push;ge===!0?Oe=Ot.Replace:ge===!1||ue!=null&&Cr(ue.formMethod)&&ue.formAction===E.location.pathname+E.location.search&&(Oe=Ot.Replace);let Nt=L&&"preventScrollReset"in L?L.preventScrollReset===!0:void 0,he=(L&&L.unstable_flushSync)===!0,Ke=bs({currentLocation:we,nextLocation:ye,historyAction:Oe});if(Ke){Ss(Ke,{state:"blocked",location:ye,proceed(){Ss(Ke,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),Ne(A,L)},reset(){let $t=new Map(E.blockers);$t.set(Ke,nl),X({blockers:$t})}});return}return await Ge(Oe,ye,{submission:ue,pendingError:De,preventScrollReset:Nt,replace:L&&L.replace,enableViewTransition:L&&L.unstable_viewTransition,flushSync:he})}function nt(){if(rt(),X({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){Ge(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}Ge(P||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation})}}async function Ge(A,L,W){k&&k.abort(),k=null,P=A,M=(W&&W.startUninterruptedRevalidation)===!0,sh(E.location,E.matches),T=(W&&W.preventScrollReset)===!0,I=(W&&W.enableViewTransition)===!0;let Z=l||s,ue=W&&W.overrideNavigation,De=Ys(Z,L,c),we=(W&&W.flushSync)===!0;if(!De){let $t=er(404,{pathname:L.pathname}),{matches:pn,route:Lt}=Dw(Z);Pi(),Pe(L,{matches:pn,loaderData:{},errors:{[Lt.id]:$t}},{flushSync:we});return}if(E.initialized&&!N&&yV(E.location,L)&&!(W&&W.submission&&Cr(W.submission.formMethod))){Pe(L,{matches:De},{flushSync:we});return}k=new AbortController;let ye=ol(e.history,L,k.signal,W&&W.submission),ge,Oe;if(W&&W.pendingError)Oe={[jl(De).route.id]:W.pendingError};else if(W&&W.submission&&Cr(W.submission.formMethod)){let $t=await _t(ye,L,W.submission,De,{replace:W.replace,flushSync:we});if($t.shortCircuited)return;ge=$t.pendingActionData,Oe=$t.pendingActionError,ue=up(L,W.submission),we=!1,ye=new Request(ye.url,{signal:ye.signal})}let{shortCircuited:Nt,loaderData:he,errors:Ke}=await Pn(ye,L,De,ue,W&&W.submission,W&&W.fetcherSubmission,W&&W.replace,W&&W.initialHydration===!0,we,ge,Oe);Nt||(k=null,Pe(L,It({matches:De},ge?{actionData:ge}:{},{loaderData:he,errors:Ke})))}async function _t(A,L,W,Z,ue){ue===void 0&&(ue={}),rt();let De=bV(L,W);X({navigation:De},{flushSync:ue.flushSync===!0});let we,ye=zm(Z,L);if(!ye.route.action&&!ye.route.lazy)we={type:Tt.error,error:er(405,{method:A.method,pathname:L.pathname,routeId:ye.route.id})};else if(we=await rl("action",A,ye,Z,i,o,c,u.v7_relativeSplatPath),A.signal.aborted)return{shortCircuited:!0};if(Bi(we)){let ge;return ue&&ue.replace!=null?ge=ue.replace:ge=we.location===E.location.pathname+E.location.search,await te(E,we,{submission:W,replace:ge}),{shortCircuited:!0}}if(Xs(we)){let ge=jl(Z,ye.route.id);return(ue&&ue.replace)!==!0&&(P=Ot.Push),{pendingActionData:{},pendingActionError:{[ge.route.id]:we.error}}}if(zi(we))throw er(400,{type:"defer-action"});return{pendingActionData:{[ye.route.id]:we.data}}}async function Pn(A,L,W,Z,ue,De,we,ye,ge,Oe,Nt){let he=Z||up(L,ue),Ke=ue||De||Nw(he),$t=l||s,[pn,Lt]=jw(e.history,E,W,Ke,L,u.v7_partialHydration&&ye===!0,N,B,D,je,oe,G,$t,c,Oe,Nt);if(Pi(ot=>!(W&&W.some(wt=>wt.route.id===ot))||pn&&pn.some(wt=>wt.route.id===ot)),F=++_,pn.length===0&&Lt.length===0){let ot=vr();return Pe(L,It({matches:W,loaderData:{},errors:Nt||null},Oe?{actionData:Oe}:{},ot?{fetchers:new Map(E.fetchers)}:{}),{flushSync:ge}),{shortCircuited:!0}}if(!M&&(!u.v7_partialHydration||!ye)){Lt.forEach(wt=>{let Br=E.fetchers.get(wt.key),Uc=il(void 0,Br?Br.data:void 0);E.fetchers.set(wt.key,Uc)});let ot=Oe||E.actionData;X(It({navigation:he},ot?Object.keys(ot).length===0?{actionData:null}:{actionData:ot}:{},Lt.length>0?{fetchers:new Map(E.fetchers)}:{}),{flushSync:ge})}Lt.forEach(ot=>{$.has(ot.key)&&Tn(ot.key),ot.controller&&$.set(ot.key,ot.controller)});let Cs=()=>Lt.forEach(ot=>Tn(ot.key));k&&k.signal.addEventListener("abort",Cs);let{results:ch,loaderResults:Es,fetcherResults:Fo}=await Ce(E.matches,W,pn,Lt,A);if(A.signal.aborted)return{shortCircuited:!0};k&&k.signal.removeEventListener("abort",Cs),Lt.forEach(ot=>$.delete(ot.key));let ki=_w(ch);if(ki){if(ki.idx>=pn.length){let ot=Lt[ki.idx-pn.length].key;G.add(ot)}return await te(E,ki.result,{replace:we}),{shortCircuited:!0}}let{loaderData:uh,errors:dh}=Rw(E,W,pn,Es,Nt,Lt,Fo,Ae);Ae.forEach((ot,wt)=>{ot.subscribe(Br=>{(Br||ot.done)&&Ae.delete(wt)})});let fh=vr(),js=Lo(F),Bc=fh||js||Lt.length>0;return It({loaderData:uh,errors:dh},Bc?{fetchers:new Map(E.fetchers)}:{})}function Lr(A,L,W,Z){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");$.has(A)&&Tn(A);let ue=(Z&&Z.unstable_flushSync)===!0,De=l||s,we=Lm(E.location,E.matches,c,u.v7_prependBasename,W,u.v7_relativeSplatPath,L,Z==null?void 0:Z.relative),ye=Ys(De,we,c);if(!ye){At(A,L,er(404,{pathname:we}),{flushSync:ue});return}let{path:ge,submission:Oe,error:Nt}=Ew(u.v7_normalizeFormMethod,!0,we,Z);if(Nt){At(A,L,Nt,{flushSync:ue});return}let he=zm(ye,ge);if(T=(Z&&Z.preventScrollReset)===!0,Oe&&Cr(Oe.formMethod)){Xt(A,L,ge,he,ye,ue,Oe);return}oe.set(A,{routeId:L,path:ge}),so(A,L,ge,he,ye,ue,Oe)}async function Xt(A,L,W,Z,ue,De,we){if(rt(),oe.delete(A),!Z.route.action&&!Z.route.lazy){let wt=er(405,{method:we.formMethod,pathname:W,routeId:L});At(A,L,wt,{flushSync:De});return}let ye=E.fetchers.get(A);et(A,CV(we,ye),{flushSync:De});let ge=new AbortController,Oe=ol(e.history,W,ge.signal,we);$.set(A,ge);let Nt=_,he=await rl("action",Oe,Z,ue,i,o,c,u.v7_relativeSplatPath);if(Oe.signal.aborted){$.get(A)===ge&&$.delete(A);return}if(u.v7_fetcherPersist&&je.has(A)){if(Bi(he)||Xs(he)){et(A,Uo(void 0));return}}else{if(Bi(he))if($.delete(A),F>Nt){et(A,Uo(void 0));return}else return G.add(A),et(A,il(we)),te(E,he,{fetcherSubmission:we});if(Xs(he)){At(A,L,he.error);return}}if(zi(he))throw er(400,{type:"defer-action"});let Ke=E.navigation.location||E.location,$t=ol(e.history,Ke,ge.signal),pn=l||s,Lt=E.navigation.state!=="idle"?Ys(pn,E.navigation.location,c):E.matches;Me(Lt,"Didn't find any matches after fetcher action");let Cs=++_;H.set(A,Cs);let ch=il(we,he.data);E.fetchers.set(A,ch);let[Es,Fo]=jw(e.history,E,Lt,we,Ke,!1,N,B,D,je,oe,G,pn,c,{[Z.route.id]:he.data},void 0);Fo.filter(wt=>wt.key!==A).forEach(wt=>{let Br=wt.key,Uc=E.fetchers.get(Br),zk=il(void 0,Uc?Uc.data:void 0);E.fetchers.set(Br,zk),$.has(Br)&&Tn(Br),wt.controller&&$.set(Br,wt.controller)}),X({fetchers:new Map(E.fetchers)});let ki=()=>Fo.forEach(wt=>Tn(wt.key));ge.signal.addEventListener("abort",ki);let{results:uh,loaderResults:dh,fetcherResults:fh}=await Ce(E.matches,Lt,Es,Fo,$t);if(ge.signal.aborted)return;ge.signal.removeEventListener("abort",ki),H.delete(A),$.delete(A),Fo.forEach(wt=>$.delete(wt.key));let js=_w(uh);if(js){if(js.idx>=Es.length){let wt=Fo[js.idx-Es.length].key;G.add(wt)}return te(E,js.result)}let{loaderData:Bc,errors:ot}=Rw(E,E.matches,Es,dh,void 0,Fo,fh,Ae);if(E.fetchers.has(A)){let wt=Uo(he.data);E.fetchers.set(A,wt)}Lo(Cs),E.navigation.state==="loading"&&Cs>F?(Me(P,"Expected pending action"),k&&k.abort(),Pe(E.navigation.location,{matches:Lt,loaderData:Bc,errors:ot,fetchers:new Map(E.fetchers)})):(X({errors:ot,loaderData:Iw(E.loaderData,Bc,Lt,ot),fetchers:new Map(E.fetchers)}),N=!1)}async function so(A,L,W,Z,ue,De,we){let ye=E.fetchers.get(A);et(A,il(we,ye?ye.data:void 0),{flushSync:De});let ge=new AbortController,Oe=ol(e.history,W,ge.signal);$.set(A,ge);let Nt=_,he=await rl("loader",Oe,Z,ue,i,o,c,u.v7_relativeSplatPath);if(zi(he)&&(he=await pk(he,Oe.signal,!0)||he),$.get(A)===ge&&$.delete(A),!Oe.signal.aborted){if(je.has(A)){et(A,Uo(void 0));return}if(Bi(he))if(F>Nt){et(A,Uo(void 0));return}else{G.add(A),await te(E,he);return}if(Xs(he)){At(A,L,he.error);return}Me(!zi(he),"Unhandled fetcher deferred data"),et(A,Uo(he.data))}}async function te(A,L,W){let{submission:Z,fetcherSubmission:ue,replace:De}=W===void 0?{}:W;L.revalidate&&(N=!0);let we=Zl(A.location,L.location,{_isRedirect:!0});if(Me(we,"Expected a location on the redirect navigation"),n){let Ke=!1;if(L.reloadDocument)Ke=!0;else if(uk.test(L.location)){const $t=e.history.createURL(L.location);Ke=$t.origin!==t.location.origin||$c($t.pathname,c)==null}if(Ke){De?t.location.replace(L.location):t.location.assign(L.location);return}}k=null;let ye=De===!0?Ot.Replace:Ot.Push,{formMethod:ge,formAction:Oe,formEncType:Nt}=A.navigation;!Z&&!ue&&ge&&Oe&&Nt&&(Z=Nw(A.navigation));let he=Z||ue;if(uV.has(L.status)&&he&&Cr(he.formMethod))await Ge(ye,we,{submission:It({},he,{formAction:L.location}),preventScrollReset:T});else{let Ke=up(we,Z);await Ge(ye,we,{overrideNavigation:Ke,fetcherSubmission:ue,preventScrollReset:T})}}async function Ce(A,L,W,Z,ue){let De=await Promise.all([...W.map(ge=>rl("loader",ue,ge,L,i,o,c,u.v7_relativeSplatPath)),...Z.map(ge=>ge.matches&&ge.match&&ge.controller?rl("loader",ol(e.history,ge.path,ge.controller.signal),ge.match,ge.matches,i,o,c,u.v7_relativeSplatPath):{type:Tt.error,error:er(404,{pathname:ge.path})})]),we=De.slice(0,W.length),ye=De.slice(W.length);return await Promise.all([Aw(A,W,we,we.map(()=>ue.signal),!1,E.loaderData),Aw(A,Z.map(ge=>ge.match),ye,Z.map(ge=>ge.controller?ge.controller.signal:null),!0)]),{results:De,loaderResults:we,fetcherResults:ye}}function rt(){N=!0,B.push(...Pi()),oe.forEach((A,L)=>{$.has(L)&&(D.push(L),Tn(L))})}function et(A,L,W){W===void 0&&(W={}),E.fetchers.set(A,L),X({fetchers:new Map(E.fetchers)},{flushSync:(W&&W.flushSync)===!0})}function At(A,L,W,Z){Z===void 0&&(Z={});let ue=jl(E.matches,L);Xn(A),X({errors:{[ue.route.id]:W},fetchers:new Map(E.fetchers)},{flushSync:(Z&&Z.flushSync)===!0})}function Fr(A){return u.v7_fetcherPersist&&(be.set(A,(be.get(A)||0)+1),je.has(A)&&je.delete(A)),E.fetchers.get(A)||dV}function Xn(A){let L=E.fetchers.get(A);$.has(A)&&!(L&&L.state==="loading"&&H.has(A))&&Tn(A),oe.delete(A),H.delete(A),G.delete(A),je.delete(A),E.fetchers.delete(A)}function ji(A){if(u.v7_fetcherPersist){let L=(be.get(A)||0)-1;L<=0?(be.delete(A),je.add(A)):be.set(A,L)}else Xn(A);X({fetchers:new Map(E.fetchers)})}function Tn(A){let L=$.get(A);Me(L,"Expected fetch controller: "+A),L.abort(),$.delete(A)}function zr(A){for(let L of A){let W=Fr(L),Z=Uo(W.data);E.fetchers.set(L,Z)}}function vr(){let A=[],L=!1;for(let W of G){let Z=E.fetchers.get(W);Me(Z,"Expected fetcher: "+W),Z.state==="loading"&&(G.delete(W),A.push(W),L=!0)}return zr(A),L}function Lo(A){let L=[];for(let[W,Z]of H)if(Z<A){let ue=E.fetchers.get(W);Me(ue,"Expected fetcher: "+W),ue.state==="loading"&&(Tn(W),H.delete(W),L.push(W))}return zr(L),L.length>0}function Ua(A,L){let W=E.blockers.get(A)||nl;return ke.get(A)!==L&&ke.set(A,L),W}function zc(A){E.blockers.delete(A),ke.delete(A)}function Ss(A,L){let W=E.blockers.get(A)||nl;Me(W.state==="unblocked"&&L.state==="blocked"||W.state==="blocked"&&L.state==="blocked"||W.state==="blocked"&&L.state==="proceeding"||W.state==="blocked"&&L.state==="unblocked"||W.state==="proceeding"&&L.state==="unblocked","Invalid blocker state transition: "+W.state+" -> "+L.state);let Z=new Map(E.blockers);Z.set(A,L),X({blockers:Z})}function bs(A){let{currentLocation:L,nextLocation:W,historyAction:Z}=A;if(ke.size===0)return;ke.size>1&&Ea(!1,"A router only supports one blocker at a time");let ue=Array.from(ke.entries()),[De,we]=ue[ue.length-1],ye=E.blockers.get(De);if(!(ye&&ye.state==="proceeding")&&we({currentLocation:L,nextLocation:W,historyAction:Z}))return De}function Pi(A){let L=[];return Ae.forEach((W,Z)=>{(!A||A(Z))&&(W.cancel(),L.push(Z),Ae.delete(Z))}),L}function Ti(A,L,W){if(h=A,g=L,m=W||null,!v&&E.navigation===cp){v=!0;let Z=ah(E.location,E.matches);Z!=null&&X({restoreScrollPosition:Z})}return()=>{h=null,g=null,m=null}}function hn(A,L){return m&&m(A,L.map(Z=>BU(Z,E.loaderData)))||A.key}function sh(A,L){if(h&&g){let W=hn(A,L);h[W]=g()}}function ah(A,L){if(h){let W=hn(A,L),Z=h[W];if(typeof Z=="number")return Z}return null}function lh(A){i={},l=$m(A,o,void 0,i)}return j={get basename(){return c},get future(){return u},get state(){return E},get routes(){return s},get window(){return t},initialize:Qe,subscribe:ht,enableScrollRestoration:Ti,navigate:Ne,fetch:Lr,revalidate:nt,createHref:A=>e.history.createHref(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:Fr,deleteFetcher:ji,dispose:qe,getBlocker:Ua,deleteBlocker:zc,_internalFetchControllers:$,_internalActiveDeferreds:Ae,_internalSetRoutes:lh},j}function pV(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Lm(e,t,n,r,o,i,s,l){let c,u;if(s){c=[];for(let f of t)if(c.push(f),f.route.id===s){u=f;break}}else c=t,u=t[t.length-1];let d=ak(o||".",sk(c,i),$c(e.pathname,n)||e.pathname,l==="path");return o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&u&&u.route.index&&!d0(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:ui([n,d.pathname])),Mc(d)}function Ew(e,t,n,r){if(!r||!pV(r))return{path:n};if(r.formMethod&&!SV(r.formMethod))return{path:n,error:er(405,{method:r.formMethod})};let o=()=>({path:n,error:er(400,{type:"invalid-body"})}),i=r.formMethod||"get",s=e?i.toUpperCase():i.toLowerCase(),l=hk(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Cr(s))return o();let h=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,g)=>{let[v,b]=g;return""+m+v+"="+b+`
|
|
206
|
+
`},""):String(r.body);return{path:n,submission:{formMethod:s,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:h}}}else if(r.formEncType==="application/json"){if(!Cr(s))return o();try{let h=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:s,formAction:l,formEncType:r.formEncType,formData:void 0,json:h,text:void 0}}}catch{return o()}}}Me(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=Fm(r.formData),u=r.formData;else if(r.body instanceof FormData)c=Fm(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=kw(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=kw(c)}catch{return o()}let d={formMethod:s,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Cr(d.formMethod))return{path:n,submission:d};let f=Mo(n);return t&&f.search&&d0(f.search)&&c.append("index",""),f.search="?"+c,{path:Mc(f),submission:d}}function mV(e,t){let n=e;if(t){let r=e.findIndex(o=>o.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function jw(e,t,n,r,o,i,s,l,c,u,d,f,h,m,g,v){let b=v?Object.values(v)[0]:g?Object.values(g)[0]:void 0,x=e.createURL(t.location),y=e.createURL(o),w=v?Object.keys(v)[0]:void 0,j=mV(n,w).filter((P,T)=>{let{route:k}=P;if(k.lazy)return!0;if(k.loader==null)return!1;if(i)return k.loader.hydrate?!0:t.loaderData[k.id]===void 0&&(!t.errors||t.errors[k.id]===void 0);if(gV(t.loaderData,t.matches[T],P)||l.some(R=>R===P.route.id))return!0;let I=t.matches[T],O=P;return Pw(P,It({currentUrl:x,currentParams:I.params,nextUrl:y,nextParams:O.params},r,{actionResult:b,defaultShouldRevalidate:s||x.pathname+x.search===y.pathname+y.search||x.search!==y.search||fk(I,O)}))}),E=[];return d.forEach((P,T)=>{if(i||!n.some(M=>M.route.id===P.routeId)||u.has(T))return;let k=Ys(h,P.path,m);if(!k){E.push({key:T,routeId:P.routeId,path:P.path,matches:null,match:null,controller:null});return}let I=t.fetchers.get(T),O=zm(k,P.path),R=!1;f.has(T)?R=!1:c.includes(T)?R=!0:I&&I.state!=="idle"&&I.data===void 0?R=s:R=Pw(O,It({currentUrl:x,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:b,defaultShouldRevalidate:s})),R&&E.push({key:T,routeId:P.routeId,path:P.path,matches:k,match:O,controller:new AbortController})}),[j,E]}function gV(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function fk(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Pw(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function Tw(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];Me(o,"No route found in manifest");let i={};for(let s in r){let c=o[s]!==void 0&&s!=="hasErrorBoundary";Ea(!c,'Route "'+o.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.')),!c&&!FU.has(s)&&(i[s]=r[s])}Object.assign(o,i),Object.assign(o,It({},t(o),{lazy:void 0}))}async function rl(e,t,n,r,o,i,s,l,c){c===void 0&&(c={});let u,d,f,h=v=>{let b,x=new Promise((y,w)=>b=w);return f=()=>b(),t.signal.addEventListener("abort",f),Promise.race([v({request:t,params:n.params,context:c.requestContext}),x])};try{let v=n.route[e];if(n.route.lazy)if(v){let b,x=await Promise.all([h(v).catch(y=>{b=y}),Tw(n.route,i,o)]);if(b)throw b;d=x[0]}else if(await Tw(n.route,i,o),v=n.route[e],v)d=await h(v);else if(e==="action"){let b=new URL(t.url),x=b.pathname+b.search;throw er(405,{method:t.method,pathname:x,routeId:n.route.id})}else return{type:Tt.data,data:void 0};else if(v)d=await h(v);else{let b=new URL(t.url),x=b.pathname+b.search;throw er(404,{pathname:x})}Me(d!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(v){u=Tt.error,d=v}finally{f&&t.signal.removeEventListener("abort",f)}if(wV(d)){let v=d.status;if(cV.has(v)){let x=d.headers.get("Location");if(Me(x,"Redirects returned/thrown from loaders/actions must have a Location header"),!uk.test(x))x=Lm(new URL(t.url),r.slice(0,r.indexOf(n)+1),s,!0,x,l);else if(!c.isStaticRequest){let y=new URL(t.url),w=x.startsWith("//")?new URL(y.protocol+x):new URL(x),S=$c(w.pathname,s)!=null;w.origin===y.origin&&S&&(x=w.pathname+w.search+w.hash)}if(c.isStaticRequest)throw d.headers.set("Location",x),d;return{type:Tt.redirect,status:v,location:x,revalidate:d.headers.get("X-Remix-Revalidate")!==null,reloadDocument:d.headers.get("X-Remix-Reload-Document")!==null}}if(c.isRouteRequest)throw{type:u===Tt.error?Tt.error:Tt.data,response:d};let b;try{let x=d.headers.get("Content-Type");x&&/\bapplication\/json\b/.test(x)?d.body==null?b=null:b=await d.json():b=await d.text()}catch(x){return{type:Tt.error,error:x}}return u===Tt.error?{type:u,error:new u0(v,d.statusText,b),headers:d.headers}:{type:Tt.data,data:b,statusCode:d.status,headers:d.headers}}if(u===Tt.error)return{type:u,error:d};if(xV(d)){var m,g;return{type:Tt.deferred,deferredData:d,statusCode:(m=d.init)==null?void 0:m.status,headers:((g=d.init)==null?void 0:g.headers)&&new Headers(d.init.headers)}}return{type:Tt.data,data:d}}function ol(e,t,n,r){let o=e.createURL(hk(t)).toString(),i={signal:n};if(r&&Cr(r.formMethod)){let{formMethod:s,formEncType:l}=r;i.method=s.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(r.json)):l==="text/plain"?i.body=r.text:l==="application/x-www-form-urlencoded"&&r.formData?i.body=Fm(r.formData):i.body=r.formData}return new Request(o,i)}function Fm(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function kw(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function vV(e,t,n,r,o){let i={},s=null,l,c=!1,u={};return n.forEach((d,f)=>{let h=t[f].route.id;if(Me(!Bi(d),"Cannot handle redirect results in processLoaderData"),Xs(d)){let m=jl(e,h),g=d.error;r&&(g=Object.values(r)[0],r=void 0),s=s||{},s[m.route.id]==null&&(s[m.route.id]=g),i[h]=void 0,c||(c=!0,l=lk(d.error)?d.error.status:500),d.headers&&(u[h]=d.headers)}else zi(d)?(o.set(h,d.deferredData),i[h]=d.deferredData.data):i[h]=d.data,d.statusCode!=null&&d.statusCode!==200&&!c&&(l=d.statusCode),d.headers&&(u[h]=d.headers)}),r&&(s=r,i[Object.keys(r)[0]]=void 0),{loaderData:i,errors:s,statusCode:l||200,loaderHeaders:u}}function Rw(e,t,n,r,o,i,s,l){let{loaderData:c,errors:u}=vV(t,n,r,o,l);for(let d=0;d<i.length;d++){let{key:f,match:h,controller:m}=i[d];Me(s!==void 0&&s[d]!==void 0,"Did not find corresponding fetcher result");let g=s[d];if(!(m&&m.signal.aborted))if(Xs(g)){let v=jl(e.matches,h==null?void 0:h.route.id);u&&u[v.route.id]||(u=It({},u,{[v.route.id]:g.error})),e.fetchers.delete(f)}else if(Bi(g))Me(!1,"Unhandled fetcher revalidation redirect");else if(zi(g))Me(!1,"Unhandled fetcher deferred data");else{let v=Uo(g.data);e.fetchers.set(f,v)}}return{loaderData:c,errors:u}}function Iw(e,t,n,r){let o=It({},t);for(let i of n){let s=i.route.id;if(t.hasOwnProperty(s)?t[s]!==void 0&&(o[s]=t[s]):e[s]!==void 0&&i.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function jl(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 Dw(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 er(e,t){let{pathname:n,routeId:r,method:o,type:i}=t===void 0?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(s="Bad Request",o&&n&&r?l="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?l="defer() is not supported in actions":i==="invalid-body"&&(l="Unable to encode submission body")):e===403?(s="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):e===404?(s="Not Found",l='No route matches URL "'+n+'"'):e===405&&(s="Method Not Allowed",o&&n&&r?l="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new u0(e||500,s,new Error(l),!0)}function _w(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Bi(n))return{result:n,idx:t}}}function hk(e){let t=typeof e=="string"?Mo(e):e;return Mc(It({},t,{hash:""}))}function yV(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function zi(e){return e.type===Tt.deferred}function Xs(e){return e.type===Tt.error}function Bi(e){return(e&&e.type)===Tt.redirect}function xV(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function wV(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function SV(e){return lV.has(e.toLowerCase())}function Cr(e){return sV.has(e.toLowerCase())}async function Aw(e,t,n,r,o,i){for(let s=0;s<n.length;s++){let l=n[s],c=t[s];if(!c)continue;let u=e.find(f=>f.route.id===c.route.id),d=u!=null&&!fk(u,c)&&(i&&i[c.route.id])!==void 0;if(zi(l)&&(o||d)){let f=r[s];Me(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await pk(l,f,o).then(h=>{h&&(n[s]=h||n[s])})}}}async function pk(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Tt.data,data:e.deferredData.unwrappedData}}catch(o){return{type:Tt.error,error:o}}return{type:Tt.data,data:e.deferredData.data}}}function d0(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function zm(e,t){let n=typeof t=="string"?Mo(t).search:t.search;if(e[e.length-1].route.index&&d0(n||""))return e[e.length-1];let r=ik(e);return r[r.length-1]}function Nw(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:i,json:s}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function up(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 bV(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 il(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 CV(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 Uo(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 EV(e,t){try{let n=e.sessionStorage.getItem(dk);if(n){let r=JSON.parse(n);for(let[o,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function jV(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(dk,JSON.stringify(n))}catch(r){Ea(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
|
|
207
|
+
* React Router v6.22.1
|
|
208
|
+
*
|
|
209
|
+
* Copyright (c) Remix Software Inc.
|
|
210
|
+
*
|
|
211
|
+
* This source code is licensed under the MIT license found in the
|
|
212
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
213
|
+
*
|
|
214
|
+
* @license MIT
|
|
215
|
+
*/function ec(){return ec=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ec.apply(this,arguments)}const Zf=p.createContext(null),mk=p.createContext(null),eh=p.createContext(null),th=p.createContext(null),bi=p.createContext({outlet:null,matches:[],isDataRoute:!1}),gk=p.createContext(null);function nh(){return p.useContext(th)!=null}function $o(){return nh()||Me(!1),p.useContext(th).location}function vk(e){p.useContext(eh).static||p.useLayoutEffect(e)}function Dt(){let{isDataRoute:e}=p.useContext(bi);return e?FV():PV()}function PV(){nh()||Me(!1);let e=p.useContext(Zf),{basename:t,future:n,navigator:r}=p.useContext(eh),{matches:o}=p.useContext(bi),{pathname:i}=$o(),s=JSON.stringify(sk(o,n.v7_relativeSplatPath)),l=p.useRef(!1);return vk(()=>{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=ak(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ui([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,s,i,e])}const TV=p.createContext(null);function kV(e){let t=p.useContext(bi).outlet;return t&&p.createElement(TV.Provider,{value:e},t)}function Ye(){let{matches:e}=p.useContext(bi),t=e[e.length-1];return t?t.params:{}}function RV(e,t){return yk(e,t)}function yk(e,t,n,r){nh()||Me(!1);let{navigator:o}=p.useContext(eh),{matches:i}=p.useContext(bi),s=i[i.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=$o(),d;if(t){var f;let b=typeof t=="string"?Mo(t):t;c==="/"||(f=b.pathname)!=null&&f.startsWith(c)||Me(!1),d=b}else d=u;let h=d.pathname||"/",m=h;if(c!=="/"){let b=c.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let g=Ys(e,{pathname:m}),v=NV(g&&g.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:ui([c,o.encodeLocation?o.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:ui([c,o.encodeLocation?o.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,r);return t&&v?p.createElement(th.Provider,{value:{location:ec({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ot.Pop}},v):v}function IV(){let e=LV(),t=lk(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:o},n):null,null)}const DV=p.createElement(IV,null);class _V extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(bi.Provider,{value:this.props.routeContext},p.createElement(gk.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function AV(e){let{routeContext:t,match:n,children:r}=e,o=p.useContext(Zf);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(bi.Provider,{value:t},r)}function NV(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if((i=n)!=null&&i.errors)e=n.matches;else return null}let s=e,l=(o=n)==null?void 0:o.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id]));d>=0||Me(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:m}=n,g=f.route.loader&&h[f.route.id]===void 0&&(!m||m[f.route.id]===void 0);if(f.route.lazy||g){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let m,g=!1,v=null,b=null;n&&(m=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||DV,c&&(u<0&&h===0?(zV("route-fallback",!1),g=!0,b=null):u===h&&(g=!0,b=f.route.hydrateFallbackElement||null)));let x=t.concat(s.slice(0,h+1)),y=()=>{let w;return m?w=v:g?w=b:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(AV,{match:f,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?p.createElement(_V,{location:n.location,revalidation:n.revalidation,component:v,error:m,children:y(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):y()},null)}var xk=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(xk||{}),_d=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(_d||{});function OV(e){let t=p.useContext(Zf);return t||Me(!1),t}function MV(e){let t=p.useContext(mk);return t||Me(!1),t}function $V(e){let t=p.useContext(bi);return t||Me(!1),t}function wk(e){let t=$V(),n=t.matches[t.matches.length-1];return n.route.id||Me(!1),n.route.id}function LV(){var e;let t=p.useContext(gk),n=MV(_d.UseRouteError),r=wk(_d.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function FV(){let{router:e}=OV(xk.UseNavigateStable),t=wk(_d.UseNavigateStable),n=p.useRef(!1);return vk(()=>{n.current=!0}),p.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,ec({fromRouteId:t},i)))},[e,t])}const Ow={};function zV(e,t,n){!t&&!Ow[e]&&(Ow[e]=!0)}function f0(e){return kV(e.context)}function de(e){Me(!1)}function BV(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Ot.Pop,navigator:i,static:s=!1,future:l}=e;nh()&&Me(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:i,static:s,future:ec({v7_relativeSplatPath:!1},l)}),[c,l,i,s]);typeof r=="string"&&(r=Mo(r));let{pathname:d="/",search:f="",hash:h="",state:m=null,key:g="default"}=r,v=p.useMemo(()=>{let b=$c(d,c);return b==null?null:{location:{pathname:b,search:f,hash:h,state:m,key:g},navigationType:o}},[c,d,f,h,m,g,o]);return v==null?null:p.createElement(eh.Provider,{value:u},p.createElement(th.Provider,{children:n,value:v}))}function UV(e){let{children:t,location:n}=e;return RV(Bm(t),n)}new Promise(()=>{});function Bm(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,o)=>{if(!p.isValidElement(r))return;let i=[...t,o];if(r.type===p.Fragment){n.push.apply(n,Bm(r.props.children,i));return}r.type!==de&&Me(!1),!r.props.index||!r.props.children||Me(!1);let s={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=Bm(r.props.children,i)),n.push(s)}),n}function VV(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:p.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
216
|
+
* React Router DOM v6.22.1
|
|
217
|
+
*
|
|
218
|
+
* Copyright (c) Remix Software Inc.
|
|
219
|
+
*
|
|
220
|
+
* This source code is licensed under the MIT license found in the
|
|
221
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
222
|
+
*
|
|
223
|
+
* @license MIT
|
|
224
|
+
*/function Ad(){return Ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ad.apply(this,arguments)}function Um(e){return e===void 0&&(e=""),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 WV(e,t){let n=Um(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}const HV="6";try{window.__reactRouterVersion=HV}catch{}function qV(e,t){return hV({basename:t==null?void 0:t.basename,future:Ad({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:MU({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||GV(),routes:e,mapRouteProperties:VV,window:t==null?void 0:t.window}).initialize()}function GV(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Ad({},t,{errors:QV(t.errors)})),t}function QV(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 u0(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const KV=p.createContext({isTransitioning:!1}),YV=p.createContext(new Map),XV="startTransition",Mw=Zm[XV],JV="flushSync",$w=j_[JV];function ZV(e){Mw?Mw(e):e()}function sl(e){$w?$w(e):e()}class eW{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function tW(e){let{fallbackElement:t,router:n,future:r}=e,[o,i]=p.useState(n.state),[s,l]=p.useState(),[c,u]=p.useState({isTransitioning:!1}),[d,f]=p.useState(),[h,m]=p.useState(),[g,v]=p.useState(),b=p.useRef(new Map),{v7_startTransition:x}=r||{},y=p.useCallback(P=>{x?ZV(P):P()},[x]),w=p.useCallback((P,T)=>{let{deletedFetchers:k,unstable_flushSync:I,unstable_viewTransitionOpts:O}=T;k.forEach(M=>b.current.delete(M)),P.fetchers.forEach((M,N)=>{M.data!==void 0&&b.current.set(N,M.data)});let R=n.window==null||typeof n.window.document.startViewTransition!="function";if(!O||R){I?sl(()=>i(P)):y(()=>i(P));return}if(I){sl(()=>{h&&(d&&d.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let M=n.window.document.startViewTransition(()=>{sl(()=>i(P))});M.finished.finally(()=>{sl(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})})}),sl(()=>m(M));return}h?(d&&d.resolve(),h.skipTransition(),v({state:P,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(l(P),u({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[n.window,h,d,b,y]);p.useLayoutEffect(()=>n.subscribe(w),[n,w]),p.useEffect(()=>{c.isTransitioning&&!c.flushSync&&f(new eW)},[c]),p.useEffect(()=>{if(d&&s&&n.window){let P=s,T=d.promise,k=n.window.document.startViewTransition(async()=>{y(()=>i(P)),await T});k.finished.finally(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})}),m(k)}},[y,s,d,n.window]),p.useEffect(()=>{d&&s&&o.location.key===s.location.key&&d.resolve()},[d,h,o.location,s]),p.useEffect(()=>{!c.isTransitioning&&g&&(l(g.state),u({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),v(void 0))},[c.isTransitioning,g]),p.useEffect(()=>{},[]);let S=p.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:P=>n.navigate(P),push:(P,T,k)=>n.navigate(P,{state:T,preventScrollReset:k==null?void 0:k.preventScrollReset}),replace:(P,T,k)=>n.navigate(P,{replace:!0,state:T,preventScrollReset:k==null?void 0:k.preventScrollReset})}),[n]),j=n.basename||"/",E=p.useMemo(()=>({router:n,navigator:S,static:!1,basename:j}),[n,S,j]);return p.createElement(p.Fragment,null,p.createElement(Zf.Provider,{value:E},p.createElement(mk.Provider,{value:o},p.createElement(YV.Provider,{value:b.current},p.createElement(KV.Provider,{value:c},p.createElement(BV,{basename:j,location:o.location,navigationType:o.historyAction,navigator:S,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?p.createElement(nW,{routes:n.routes,future:n.future,state:o}):t))))),null)}function nW(e){let{routes:t,future:n,state:r}=e;return yk(t,void 0,r,n)}var Lw;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Lw||(Lw={}));var Fw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Fw||(Fw={}));function h0(e){let t=p.useRef(Um(e)),n=p.useRef(!1),r=$o(),o=p.useMemo(()=>WV(r.search,n.current?null:t.current),[r.search]),i=Dt(),s=p.useCallback((l,c)=>{const u=Um(typeof l=="function"?l(o):l);n.current=!0,i("?"+u,c)},[i,o]);return[o,s]}const rW=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Lc(e,t){const n=oW(e);if(typeof n.path!="string"){const{webkitRelativePath:r}=e;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function oW(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),o=rW.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var Ba=(e,t,n)=>new Promise((r,o)=>{var i=c=>{try{l(n.next(c))}catch(u){o(u)}},s=c=>{try{l(n.throw(c))}catch(u){o(u)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,s);l((n=n.apply(e,t)).next())});const iW=[".DS_Store","Thumbs.db"];function sW(e){return Ba(this,null,function*(){return Nd(e)&&aW(e.dataTransfer)?dW(e.dataTransfer,e.type):lW(e)?cW(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?uW(e):[]})}function aW(e){return Nd(e)}function lW(e){return Nd(e)&&Nd(e.target)}function Nd(e){return typeof e=="object"&&e!==null}function cW(e){return Vm(e.target.files).map(t=>Lc(t))}function uW(e){return Ba(this,null,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Lc(n))})}function dW(e,t){return Ba(this,null,function*(){if(e.items){const n=Vm(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(fW));return zw(Sk(r))}return zw(Vm(e.files).map(n=>Lc(n)))})}function zw(e){return e.filter(t=>iW.indexOf(t.name)===-1)}function Vm(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 fW(e){if(typeof e.webkitGetAsEntry!="function")return Bw(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?bk(t):Bw(e)}function Sk(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?Sk(n):[n]],[])}function Bw(e){const t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);const n=Lc(t);return Promise.resolve(n)}function hW(e){return Ba(this,null,function*(){return e.isDirectory?bk(e):pW(e)})}function bk(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function i(){t.readEntries(s=>Ba(this,null,function*(){if(s.length){const l=Promise.all(s.map(hW));o.push(l),i()}else try{const l=yield Promise.all(o);n(l)}catch(l){r(l)}}),s=>{r(s)})}i()})}function pW(e){return Ba(this,null,function*(){return new Promise((t,n)=>{e.file(r=>{const o=Lc(r,e.fullPath);t(o)},r=>{n(r)})})})}function mW(e,t){if(e&&t){const n=Array.isArray(t)?t:t.split(","),r=e.name||"",o=(e.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return n.some(s=>{const l=s.trim().toLowerCase();return l.charAt(0)==="."?r.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):o===l})}return!0}var gW=Object.defineProperty,vW=Object.defineProperties,yW=Object.getOwnPropertyDescriptors,Uw=Object.getOwnPropertySymbols,xW=Object.prototype.hasOwnProperty,wW=Object.prototype.propertyIsEnumerable,Vw=(e,t,n)=>t in e?gW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SW=(e,t)=>{for(var n in t||(t={}))xW.call(t,n)&&Vw(e,n,t[n]);if(Uw)for(var n of Uw(t))wW.call(t,n)&&Vw(e,n,t[n]);return e},bW=(e,t)=>vW(e,yW(t));const CW="file-invalid-type",EW="file-too-large",jW="file-too-small",PW="too-many-files",TW=e=>{e=Array.isArray(e)&&e.length===1?e[0]:e;const t=Array.isArray(e)?`one of ${e.join(", ")}`:e;return{code:CW,message:`File type must be ${t}`}},Ww=e=>({code:EW,message:`File is larger than ${e} ${e===1?"byte":"bytes"}`}),Hw=e=>({code:jW,message:`File is smaller than ${e} ${e===1?"byte":"bytes"}`}),kW={code:PW,message:"Too many files"};function Ck(e,t){const n=e.type==="application/x-moz-file"||mW(e,t);return[n,n?null:TW(t)]}function Ek(e,t,n){if(Oi(e.size))if(Oi(t)&&Oi(n)){if(e.size>n)return[!1,Ww(n)];if(e.size<t)return[!1,Hw(t)]}else{if(Oi(t)&&e.size<t)return[!1,Hw(t)];if(Oi(n)&&e.size>n)return[!1,Ww(n)]}return[!0,null]}function Oi(e){return e!=null}function RW({files:e,accept:t,minSize:n,maxSize:r,multiple:o,maxFiles:i,validator:s}){return!o&&e.length>1||o&&i>=1&&e.length>i?!1:e.every(l=>{const[c]=Ck(l,t),[u]=Ek(l,n,r),d=s?s(l):null;return c&&u&&!d})}function Od(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function yu(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,t=>t==="Files"||t==="application/x-moz-file"):!!e.target&&!!e.target.files}function qw(e){e.preventDefault()}function IW(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function DW(e){return e.indexOf("Edge/")!==-1}function _W(e=window.navigator.userAgent){return IW(e)||DW(e)}function Wr(...e){return(t,...n)=>e.some(r=>(!Od(t)&&r&&r(t,...n),Od(t)))}function AW(){return"showOpenFilePicker"in window}function NW(e){return Oi(e)?[{description:"Files",accept:Object.entries(e).filter(([n,r])=>{let o=!0;return jk(n)||(console.warn(`Skipped "${n}" 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.`),o=!1),(!Array.isArray(r)||!r.every(Pk))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),o=!1),o}).reduce((n,[r,o])=>bW(SW({},n),{[r]:o}),{})}]:e}function OW(e){if(Oi(e))return Object.entries(e).reduce((t,[n,r])=>[...t,n,...r],[]).filter(t=>jk(t)||Pk(t)).join(",")}function MW(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function $W(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function jk(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function Pk(e){return/^.*\.[\w]+$/.test(e)}var LW=Object.defineProperty,FW=Object.defineProperties,zW=Object.getOwnPropertyDescriptors,Md=Object.getOwnPropertySymbols,Tk=Object.prototype.hasOwnProperty,kk=Object.prototype.propertyIsEnumerable,Gw=(e,t,n)=>t in e?LW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t)=>{for(var n in t||(t={}))Tk.call(t,n)&&Gw(e,n,t[n]);if(Md)for(var n of Md(t))kk.call(t,n)&&Gw(e,n,t[n]);return e},Go=(e,t)=>FW(e,zW(t)),$d=(e,t)=>{var n={};for(var r in e)Tk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Md)for(var r of Md(e))t.indexOf(r)<0&&kk.call(e,r)&&(n[r]=e[r]);return n};const p0=p.forwardRef((e,t)=>{var n=e,{children:r}=n,o=$d(n,["children"]);const i=Ik(o),{open:s}=i,l=$d(i,["open"]);return p.useImperativeHandle(t,()=>({open:s}),[s]),C.createElement(p.Fragment,null,r(Go(vn({},l),{open:s})))});p0.displayName="Dropzone";const Rk={disabled:!1,getFilesFromEvent:sW,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};p0.defaultProps=Rk;p0.propTypes={children:Ue.func,accept:Ue.objectOf(Ue.arrayOf(Ue.string)),multiple:Ue.bool,preventDropOnDocument:Ue.bool,noClick:Ue.bool,noKeyboard:Ue.bool,noDrag:Ue.bool,noDragEventsBubbling:Ue.bool,minSize:Ue.number,maxSize:Ue.number,maxFiles:Ue.number,disabled:Ue.bool,getFilesFromEvent:Ue.func,onFileDialogCancel:Ue.func,onFileDialogOpen:Ue.func,useFsAccessApi:Ue.bool,autoFocus:Ue.bool,onDragEnter:Ue.func,onDragLeave:Ue.func,onDragOver:Ue.func,onDrop:Ue.func,onDropAccepted:Ue.func,onDropRejected:Ue.func,onError:Ue.func,validator:Ue.func};const Wm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Ik(e={}){const{accept:t,disabled:n,getFilesFromEvent:r,maxSize:o,minSize:i,multiple:s,maxFiles:l,onDragEnter:c,onDragLeave:u,onDragOver:d,onDrop:f,onDropAccepted:h,onDropRejected:m,onFileDialogCancel:g,onFileDialogOpen:v,useFsAccessApi:b,autoFocus:x,preventDropOnDocument:y,noClick:w,noKeyboard:S,noDrag:j,noDragEventsBubbling:E,onError:P,validator:T}=vn(vn({},Rk),e),k=p.useMemo(()=>OW(t),[t]),I=p.useMemo(()=>NW(t),[t]),O=p.useMemo(()=>typeof v=="function"?v:Qw,[v]),R=p.useMemo(()=>typeof g=="function"?g:Qw,[g]),M=p.useRef(null),N=p.useRef(null),[B,D]=p.useReducer(BW,Wm),{isFocused:$,isFileDialogActive:_}=B,F=p.useRef(typeof window<"u"&&window.isSecureContext&&b&&AW()),H=()=>{!F.current&&_&&setTimeout(()=>{if(N.current){const{files:te}=N.current;te.length||(D({type:"closeDialog"}),R())}},300)};p.useEffect(()=>(window.addEventListener("focus",H,!1),()=>{window.removeEventListener("focus",H,!1)}),[N,_,R,F]);const G=p.useRef([]),oe=te=>{M.current&&M.current.contains(te.target)||(te.preventDefault(),G.current=[])};p.useEffect(()=>(y&&(document.addEventListener("dragover",qw,!1),document.addEventListener("drop",oe,!1)),()=>{y&&(document.removeEventListener("dragover",qw),document.removeEventListener("drop",oe))}),[M,y]),p.useEffect(()=>(!n&&x&&M.current&&M.current.focus(),()=>{}),[M,x,n]);const be=p.useCallback(te=>{P?P(te):console.error(te)},[P]),je=p.useCallback(te=>{te.preventDefault(),te.persist(),Pn(te),G.current=[...G.current,te.target],yu(te)&&Promise.resolve(r(te)).then(Ce=>{if(Od(te)&&!E)return;const rt=Ce.length,et=rt>0&&RW({files:Ce,accept:k,minSize:i,maxSize:o,multiple:s,maxFiles:l,validator:T}),At=rt>0&&!et;D({isDragAccept:et,isDragReject:At,isDragActive:!0,type:"setDraggedFiles"}),c&&c(te)}).catch(Ce=>be(Ce))},[r,c,be,E,k,i,o,s,l,T]),Ae=p.useCallback(te=>{te.preventDefault(),te.persist(),Pn(te);const Ce=yu(te);if(Ce&&te.dataTransfer)try{te.dataTransfer.dropEffect="copy"}catch{}return Ce&&d&&d(te),!1},[d,E]),ke=p.useCallback(te=>{te.preventDefault(),te.persist(),Pn(te);const Ce=G.current.filter(et=>M.current&&M.current.contains(et)),rt=Ce.indexOf(te.target);rt!==-1&&Ce.splice(rt,1),G.current=Ce,!(Ce.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),yu(te)&&u&&u(te))},[M,u,E]),Ie=p.useCallback((te,Ce)=>{const rt=[],et=[];te.forEach(At=>{const[Fr,Xn]=Ck(At,k),[ji,Tn]=Ek(At,i,o),zr=T?T(At):null;if(Fr&&ji&&!zr)rt.push(At);else{let vr=[Xn,Tn];zr&&(vr=vr.concat(zr)),et.push({file:At,errors:vr.filter(Lo=>Lo)})}}),(!s&&rt.length>1||s&&l>=1&&rt.length>l)&&(rt.forEach(At=>{et.push({file:At,errors:[kW]})}),rt.splice(0)),D({acceptedFiles:rt,fileRejections:et,type:"setFiles"}),f&&f(rt,et,Ce),et.length>0&&m&&m(et,Ce),rt.length>0&&h&&h(rt,Ce)},[D,s,k,i,o,l,f,h,m,T]),Qe=p.useCallback(te=>{te.preventDefault(),te.persist(),Pn(te),G.current=[],yu(te)&&Promise.resolve(r(te)).then(Ce=>{Od(te)&&!E||Ie(Ce,te)}).catch(Ce=>be(Ce)),D({type:"reset"})},[r,Ie,be,E]),qe=p.useCallback(()=>{if(F.current){D({type:"openDialog"}),O();const te={multiple:s,types:I};window.showOpenFilePicker(te).then(Ce=>r(Ce)).then(Ce=>{Ie(Ce,null),D({type:"closeDialog"})}).catch(Ce=>{MW(Ce)?(R(Ce),D({type:"closeDialog"})):$W(Ce)?(F.current=!1,N.current?(N.current.value=null,N.current.click()):be(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."))):be(Ce)});return}N.current&&(D({type:"openDialog"}),O(),N.current.value=null,N.current.click())},[D,O,R,b,Ie,be,I,s]),ht=p.useCallback(te=>{!M.current||!M.current.isEqualNode(te.target)||(te.key===" "||te.key==="Enter"||te.keyCode===32||te.keyCode===13)&&(te.preventDefault(),qe())},[M,qe]),X=p.useCallback(()=>{D({type:"focus"})},[]),Pe=p.useCallback(()=>{D({type:"blur"})},[]),Ne=p.useCallback(()=>{w||(_W()?setTimeout(qe,0):qe())},[w,qe]),nt=te=>n?null:te,Ge=te=>S?null:nt(te),_t=te=>j?null:nt(te),Pn=te=>{E&&te.stopPropagation()},Lr=p.useMemo(()=>(te={})=>{var Ce=te,{refKey:rt="ref",role:et,onKeyDown:At,onFocus:Fr,onBlur:Xn,onClick:ji,onDragEnter:Tn,onDragOver:zr,onDragLeave:vr,onDrop:Lo}=Ce,Ua=$d(Ce,["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"]);return vn(vn({onKeyDown:Ge(Wr(At,ht)),onFocus:Ge(Wr(Fr,X)),onBlur:Ge(Wr(Xn,Pe)),onClick:nt(Wr(ji,Ne)),onDragEnter:_t(Wr(Tn,je)),onDragOver:_t(Wr(zr,Ae)),onDragLeave:_t(Wr(vr,ke)),onDrop:_t(Wr(Lo,Qe)),role:typeof et=="string"&&et!==""?et:"presentation",[rt]:M},!n&&!S?{tabIndex:0}:{}),Ua)},[M,ht,X,Pe,Ne,je,Ae,ke,Qe,S,j,n]),Xt=p.useCallback(te=>{te.stopPropagation()},[]),so=p.useMemo(()=>(te={})=>{var Ce=te,{refKey:rt="ref",onChange:et,onClick:At}=Ce,Fr=$d(Ce,["refKey","onChange","onClick"]);const Xn={accept:k,multiple:s,type:"file",style:{display:"none"},onChange:nt(Wr(et,Qe)),onClick:nt(Wr(At,Xt)),tabIndex:-1,[rt]:N};return vn(vn({},Xn),Fr)},[N,t,s,Qe,n]);return Go(vn({},B),{isFocused:$&&!n,getRootProps:Lr,getInputProps:so,rootRef:M,inputRef:N,open:nt(qe)})}function BW(e,t){switch(t.type){case"focus":return Go(vn({},e),{isFocused:!0});case"blur":return Go(vn({},e),{isFocused:!1});case"openDialog":return Go(vn({},Wm),{isFileDialogActive:!0});case"closeDialog":return Go(vn({},e),{isFileDialogActive:!1});case"setDraggedFiles":return Go(vn({},e),{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Go(vn({},e),{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return vn({},Wm);default:return e}}function Qw(){}const[UW,VW]=bn("Dropzone component was not found in tree");function m0(e){const t=n=>{const{children:r,...o}=U(`Dropzone${k0(e)}`,{},n),i=VW(),s=To(r)?r:C.createElement("span",null,r);return i[e]?p.cloneElement(s,o):null};return t.displayName=`@mantine/dropzone/${k0(e)}`,t}const WW=m0("accept"),HW=m0("reject"),qW=m0("idle");var tc={root:"m-d46a4834",inner:"m-b85f7144",fullScreen:"m-96f6e9ad",dropzone:"m-7946116d"};const GW={loading:!1,multiple:!0,maxSize:1/0,autoFocus:!1,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},QW=(e,{radius:t,variant:n,acceptColor:r,rejectColor:o})=>{const i=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),s=e.variantColorResolver({color:o||"red",theme:e,variant:n});return{root:{"--dropzone-radius":ft(t),"--dropzone-accept-color":i.color,"--dropzone-accept-bg":i.background,"--dropzone-reject-color":s.color,"--dropzone-reject-bg":s.background}}},Ci=Q((e,t)=>{const n=U("Dropzone",GW,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,radius:u,disabled:d,loading:f,multiple:h,maxSize:m,accept:g,children:v,onDropAny:b,onDrop:x,onReject:y,openRef:w,name:S,maxFiles:j,autoFocus:E,activateOnClick:P,activateOnDrag:T,dragEventsBubbling:k,activateOnKeyboard:I,onDragEnter:O,onDragLeave:R,onDragOver:M,onFileDialogCancel:N,onFileDialogOpen:B,preventDropOnDocument:D,useFsAccessApi:$,getFilesFromEvent:_,validator:F,rejectColor:H,acceptColor:G,enablePointerEvents:oe,loaderProps:be,mod:je,...Ae}=n,ke=fe({name:"Dropzone",classes:tc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:QW}),{getRootProps:Ie,getInputProps:Qe,isDragAccept:qe,isDragReject:ht,open:X}=Ik({onDrop:b,onDropAccepted:x,onDropRejected:y,disabled:d||f,accept:Array.isArray(g)?g.reduce((Ne,nt)=>({...Ne,[nt]:[]}),{}):g,multiple:h,maxSize:m,maxFiles:j,autoFocus:E,noClick:!P,noDrag:!T,noDragEventsBubbling:!k,noKeyboard:!I,onDragEnter:O,onDragLeave:R,onDragOver:M,onFileDialogCancel:N,onFileDialogOpen:B,preventDropOnDocument:D,useFsAccessApi:$,validator:F,..._?{getFilesFromEvent:_}:null});og(w,X);const Pe=!qe&&!ht;return C.createElement(UW,{value:{accept:qe,reject:ht,idle:Pe}},C.createElement(q,{...Ie({ref:t}),...ke("root",{focusable:!0}),...Ae,mod:[{accept:qe,reject:ht,idle:Pe,loading:f,"activate-on-click":P},je]},C.createElement(Gv,{visible:f,overlayProps:{radius:u},unstyled:l,loaderProps:be}),C.createElement("input",{...Qe(),name:S}),C.createElement("div",{...ke("inner"),"data-enable-pointer-events":oe||void 0},v)))});Ci.classes=tc;Ci.displayName="@mantine/dropzone/Dropzone";Ci.Accept=WW;Ci.Idle=qW;Ci.Reject=HW;const KW={loading:!1,maxSize:1/0,activateOnClick:!1,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:Nr("max"),withinPortal:!0},g0=Q((e,t)=>{const n=U("DropzoneFullScreen",KW,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,active:u,onDrop:d,onReject:f,zIndex:h,withinPortal:m,portalProps:g,...v}=n,b=fe({name:"DropzoneFullScreen",classes:tc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"fullScreen"}),{resolvedClassNames:x,resolvedStyles:y}=Wd({classNames:r,styles:s,props:n}),[w,S]=p.useState(0),[j,{open:E,close:P}]=vR(!1),T=I=>{var O;(O=I.dataTransfer)!=null&&O.types.includes("Files")&&(S(R=>R+1),E())},k=()=>{S(I=>I-1)};return p.useEffect(()=>{w===0&&P()},[w]),p.useEffect(()=>{if(u)return document.addEventListener("dragenter",T,!1),document.addEventListener("dragleave",k,!1),()=>{document.removeEventListener("dragenter",T,!1),document.removeEventListener("dragleave",k,!1)}},[u]),C.createElement(us,{...g,withinPortal:m},C.createElement(q,{...b("fullScreen",{style:{opacity:j?1:0,pointerEvents:j?"all":"none",zIndex:h}}),ref:t},C.createElement(Ci,{...v,classNames:x,styles:y,unstyled:l,className:tc.dropzone,onDrop:I=>{d==null||d(I),P(),S(0)},onReject:I=>{f==null||f(I),P(),S(0)}})))});g0.classes=tc;g0.displayName="@mantine/dropzone/DropzoneFullScreen";Ci.FullScreen=g0;const xu=Ci,YW='{"resourceType": "Bundle"}';function dp({id:e,title:t,message:n,color:r,icon:o,withCloseButton:i=!1,method:s="show",loading:l}){Jr[s]({id:e,loading:l,title:t,message:n,color:r,icon:o,withCloseButton:i,autoClose:!1})}function XW(){const e=Pt(),t=ne(),[n,r]=p.useState({}),o=p.useCallback(async(l,c)=>{const u="batch-upload";dp({id:u,title:"Batch Upload in Progress",message:"Your batch data is being uploaded. This may take a moment...",method:"show",loading:!0});try{r({});let d=JSON.parse(l);d.type!=="batch"&&d.type!=="transaction"&&(d=EP(d));const f=await t.executeBatch(d);r(h=>({...h,[c]:f})),dp({id:u,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(qf,{size:"1rem"}),withCloseButton:!0})}catch(d){dp({id:u,title:"Batch Upload Failed",color:"red",message:Te(d),method:"update",icon:a.jsx(kd,{size:"1rem"}),withCloseButton:!0})}},[t]),i=p.useCallback(async l=>{for(const c of l){const u=new FileReader;u.onload=d=>{var f;return o((f=d.target)==null?void 0:f.result,c.name)},u.readAsText(c)}},[o]),s=p.useCallback(async l=>{await o(l.input,"JSON Data")},[o]);return a.jsxs(xe,{children:[a.jsx(ce,{children:"Batch Create"}),a.jsxs("p",{children:["Use this page to create, read, or update multiple resources. For more details, see ",a.jsx("a",{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(We,{defaultValue:"upload",children:[a.jsxs(We.List,{children:[a.jsx(We.Tab,{value:"upload",children:"File Upload"}),a.jsx(We.Tab,{value:"json",children:"JSON"})]}),a.jsx(We.Panel,{value:"upload",pt:"xs",children:a.jsx(xu,{onDrop:i,accept:["application/json"],children:a.jsxs(Y,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(xu.Accept,{children:a.jsx(nw,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(xu.Reject,{children:a.jsx(kd,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(xu.Idle,{children:a.jsx(nw,{size:50,stroke:1.5})}),a.jsxs("div",{children:[a.jsx(ae,{size:"xl",inline:!0,children:"Drag files here or click to select files"}),a.jsx(ae,{size:"sm",color:"dimmed",inline:!0,mt:7,children:"Attach as many files as you like"})]})]})})}),a.jsx(We.Panel,{value:"json",pt:"xs",children:a.jsxs(Be,{onSubmit:s,children:[a.jsx(Aa,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:YW,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(ee,{type:"submit",children:"Submit"})})]})})]})]}),Object.keys(n).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Output"}),a.jsxs(We,{defaultValue:Object.keys(n)[0],children:[a.jsx(We.List,{children:Object.keys(n).map(l=>a.jsx(We.Tab,{value:l,children:l},l))}),Object.keys(n).map(l=>a.jsx(We.Panel,{value:l,children:a.jsx("pre",{style:{border:"1px solid #888"},children:JSON.stringify(n[l],void 0,2)})},l))]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(ee,{onClick:()=>r({}),children:"Start over"})})]})]})}function JW(){const{resourceType:e}=Ye(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(o=>!!o),[r]=ba("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(xe,{children:[a.jsxs(ce,{children:["No apps for ",e]}),a.jsx(Le,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(xe,{children:a.jsx("div",{children:r.map(o=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Le,{to:`/forms/${o.id}?subject=`+n.map(i=>`${e}/${i}`).join(","),children:o.name})}),a.jsx("p",{children:o.description})]},o.id))})}):a.jsx(Ar,{})}function ZW(){const e=ne(),[t,n]=p.useState(),[r,o]=p.useState(!1);return a.jsx(xe,{width:450,children:a.jsxs(Be,{style:{maxWidth:400},onSubmit:i=>{n(void 0),e.post("auth/changepassword",i).then(()=>o(!0)).catch(s=>n(ut(s)))},children:[a.jsxs(tn,{style:{flexDirection:"column"},children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Change password"})]}),!r&&a.jsxs(Se,{gap:"xl",mt:"xl",children:[a.jsx(Rr,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:Fe(t,"oldPassword")}),a.jsx(Rr,{name:"newPassword",label:"New password",required:!0,error:Fe(t,"newPassword")}),a.jsx(Rr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Fe(t,"confirmPassword")}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(ee,{type:"submit",children:"Change password"})})]}),r&&a.jsx("div",{"data-testid":"success",children:"Password changed successfully"})]})})}const Hm=["Form","JSON","Profiles"],eH=["Profiles"],fp=Hm[0].toLowerCase();function tH(){const e=Dt(),t=Pt(),{resourceType:n}=Ye(),[r,o]=p.useState(()=>{const s=window.location.pathname.split("/").pop();return s&&Hm.map(l=>l.toLowerCase()).includes(s)?s:fp});function i(s){s||(s=fp),o(s),e(`/${n}/new/${s}`)}return a.jsxs(a.Fragment,{children:[a.jsxs(On,{children:[a.jsxs(ae,{p:"md",fw:500,children:["New ",n]}),a.jsx(hr,{children:a.jsx(We,{defaultValue:fp,value:r,onChange:i,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Hm.map(s=>a.jsx(We.Tab,{value:s.toLowerCase(),px:"md",children:eH.includes(s)?a.jsxs(Y,{gap:"xs",wrap:"nowrap",children:[s,a.jsx(mc,{color:t.primaryColor,size:"sm",children:"Beta"})]}):s},s))})})})]}),a.jsx(f0,{})]})}function nH(){return a.jsx(xe,{children:a.jsxs(Se,{children:[a.jsx(ce,{order:1,children:"Unexpected Error"}),a.jsx(ae,{children:"We're sorry, something went wrong."}),a.jsxs(ae,{children:["Please contact ",a.jsx(Ve,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}const rH="_root_1fbwr_1",oH="_entry_1fbwr_8",iH="_key_1fbwr_13",sH="_value_1fbwr_20",rh={root:rH,entry:oH,key:iH,value:sH};function Re(e){return a.jsx(hr,{children:a.jsx("div",{className:rh.root,children:e.children})})}Re.Entry=function(t){return a.jsx("div",{className:rh.entry,children:t.children})};Re.Key=function(t){return a.jsx("div",{className:rh.key,children:t.children})};Re.Value=function(t){return a.jsx("div",{className:rh.value,children:t.children})};function aH(e){if(e.gender==="male")return"blue";if(e.gender==="female")return"pink"}function Dk(e){var n,r;const t=st(e.patient);return t?a.jsxs(Re,{children:[a.jsx(Si,{value:t,size:"lg",color:aH(t)}),a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Name"}),a.jsx(Re.Value,{children:a.jsx(Le,{to:t,fw:500,children:t.name?a.jsx(Fy,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"DoB"}),a.jsx(Re.Value,{children:t.birthDate})]}),a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Age"}),a.jsx(Re.Value,{children:$O(t.birthDate)})]})]}),t.gender&&a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Gender"}),a.jsx(Re.Value,{children:t.gender})]}),t.address&&a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"State"}),a.jsx(Re.Value,{children:(n=t.address[0])==null?void 0:n.state})]}),(r=t.identifier)==null?void 0:r.map(o=>a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:o==null?void 0:o.system}),a.jsx(Re.Value,{children:o==null?void 0:o.value})]},`${o==null?void 0:o.system}-${o==null?void 0:o.value}`))]}):null}function _k(e){const t=st(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx(Le,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(l,c){l&&c&&n.push({key:l,value:c})}function o(l){l&&r(l.system,l.value)}function i(l,c){Array.isArray(c)?c.forEach(u=>i(l,u)):typeof c=="string"?r(l,c):c&&(Array.isArray(c.coding)?r(l,c.coding.map(u=>u.display||u.code).join(", ")):r(l,c.text))}const s=Co(t);return s!==lt(t)&&r("Name",s),"category"in t&&i("Category",t.category),t.resourceType!=="Bot"&&"code"in t&&i("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(Re,{children:n.map(l=>a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:l.key}),a.jsx(Re.Value,{children:l.value})]},`${l.key}-${l.value}`))})}function v0(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function lH(e){var t;if(e.resourceType==="Specimen")return e;if(e.resourceType==="Observation")return e.specimen;if(e.resourceType==="DiagnosticReport"||e.resourceType==="ServiceRequest")return(t=e.specimen)==null?void 0:t[0]}function zu(e,t){return new Promise((n,r)=>{var i;const o=new MessageChannel;o.port1.onmessage=({data:s})=>{o.port1.close(),s.error?r(s.error):n(s.result)},(i=e.contentWindow)==null||i.postMessage(t,"https://codeeditor.medplum.com",[o.port2])})}function Ei(e){var t;return Lf((t=e.getActiveLogin())==null?void 0:t.project)}function cH(e,t){const n=new Blob([e],{type:Wt.JSON}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r;const i=t??new Date().toISOString().replace(/\D/g,"");o.download=`${i}.json`,document.body.appendChild(o),o.click(),URL.revokeObjectURL(r)}function uH(){const{id:e}=Ye(),t=$o(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,o=ne(),[i,s]=p.useState(!0),[l,c]=p.useState(),[u,d]=p.useState(),[f,h]=p.useState(),[m,g]=p.useState(),[v,b]=p.useState();if(p.useEffect(()=>{const w={resourceType:"Bundle",type:"batch",entry:[{request:{method:"GET",url:`Questionnaire/${e}`}}]};if(r){const S=r.split(",").filter(j=>!!j);S.length===1&&w.entry.push({request:{method:"GET",url:S[0]}}),d(S)}o.executeBatch(w).then(S=>{var j,E,P,T,k,I,O,R;((P=(E=(j=S.entry)==null?void 0:j[0])==null?void 0:E.response)==null?void 0:P.status)!=="200"?g((I=(k=(T=S.entry)==null?void 0:T[0])==null?void 0:k.response)==null?void 0:I.outcome):(c((O=S.entry[0])==null?void 0:O.resource),h((R=S.entry[1])==null?void 0:R.resource)),s(!1)}).catch(S=>{g(S),s(!1)})},[o,e,r]),m)return a.jsx(xe,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)})});if(v)return a.jsxs(xe,{children:[a.jsx(ce,{children:l==null?void 0:l.title}),a.jsx("p",{children:"Your response has been recorded."}),a.jsxs("ul",{children:[v.length===1&&a.jsx("li",{children:a.jsx(Le,{to:v[0],children:"Review your answers"})}),v.length>1&&a.jsxs("li",{children:["Review your answers:",a.jsx("ul",{children:v.map(w=>a.jsx("li",{children:a.jsx(Le,{to:w,children:lt(w)})},w.id))})]}),f&&a.jsx("li",{children:a.jsxs(Le,{to:f,children:["Back to ",Co(f)]})}),a.jsx("li",{children:a.jsx(Le,{to:"/",children:"Go back home"})})]})]});if(i||!l)return a.jsx(Ar,{});const x=f&&v0(f);return a.jsxs(a.Fragment,{children:[a.jsxs(On,{shadow:"xs",radius:0,children:[x&&a.jsx(Dk,{patient:x}),f&&f.resourceType!=="Patient"&&a.jsx(_k,{resource:f}),a.jsx(q,{px:"xl",py:"md",children:a.jsxs(ae,{children:[Co(l),u&&u.length>1&&a.jsxs(a.Fragment,{children:[" (for ",u.length," resources)"]})]})})]}),a.jsx(xe,{children:a.jsx(qT,{questionnaire:l,subject:f&&bt(f),onSubmit:y})})]});async function y(w){const S=[];if(!u||u.length===0)S.push(await o.createResource(w));else for(const j of u)S.push(await o.createResource({...w,subject:{reference:j}}));b(S)}}const dH="_paper_unw9o_1",fH={paper:dH},hH={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function Ak(e,t){const n=e.resourceType||pH(t),r=e.fields??mH(n),o=e.filters??(e.resourceType?void 0:gH(n)),i=e.sortRules??vH(n),s=e.offset??0,l=e.count??Uf;return{...e,resourceType:n,fields:r,filters:o,sortRules:i,offset:s,count:l}}function pH(e){var t,n;return localStorage.getItem("defaultResourceType")??((n=(t=e==null?void 0:e.option)==null?void 0:t.find(r=>r.id==="defaultResourceType"))==null?void 0:n.valueString)??"Patient"}function mH(e){const t=y0(e);if(t!=null&&t.fields)return t.fields;const n=["id","_lastUpdated"];switch(e){case"Patient":n.push("name","birthDate","gender");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 gH(e){var t;return(t=y0(e))==null?void 0:t.filters}function vH(e){const t=y0(e);return t!=null&&t.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function y0(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function yH(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function xH(e,t){const n={resourceType:e.resourceType,count:1e3,offset:0,filters:e.filters},r=Ak(n,t.getUserConfiguration()),o=await t.search(r.resourceType,Qs({...r,total:"accurate",fields:void 0}));return EP(o)}function Kw(){const e=ne(),t=Dt(),n=$o(),[r,o]=p.useState();return p.useEffect(()=>{const i=tL(n.pathname+n.search),s=Ak(i,e.getUserConfiguration());n.pathname===`/${s.resourceType}`&&n.search===Qs(s)?(yH(s),o(s)):t(`/${s.resourceType}${Qs(s)}`)},[e,t,n]),!(r!=null&&r.resourceType)||!r.fields||r.fields.length===0?a.jsx(Ar,{}):a.jsx(On,{shadow:"xs",m:"md",p:"xs",className:fH.paper,children:a.jsx(Oc,{checkboxesEnabled:!0,search:r,onClick:i=>t(`/${i.resource.resourceType}/${i.resource.id}`),onAuxClick:i=>window.open(`/${i.resource.resourceType}/${i.resource.id}`,"_blank"),onChange:i=>{t(`/${r.resourceType}${Qs(i.definition)}`)},onNew:()=>{t(hH[r.resourceType]??`/${r.resourceType}/new`)},onExportCsv:()=>{const i=e.fhirUrl(r.resourceType,"$csv")+Qs(r);e.download(i).then(s=>{window.open(window.URL.createObjectURL(s),"_blank")}).catch(s=>le({color:"red",message:Te(s),autoClose:!1}))},onExportTransactionBundle:async()=>{xH(r,e).then(i=>cH(JSON.stringify(i,void 0,2))).catch(i=>le({color:"red",message:Te(i),autoClose:!1}))},onDelete:i=>{window.confirm("Are you sure you want to delete these resources?")&&(e.invalidateSearches(r.resourceType),e.executeBatch({resourceType:"Bundle",type:"batch",entry:i.map(s=>({request:{method:"DELETE",url:`${r.resourceType}/${s}`}}))}).then(()=>o({...r})).catch(s=>le({color:"red",message:Te(s),autoClose:!1})))},onBulk:i=>{t(`/bulk/${r.resourceType}?ids=${i.join(",")}`)}})})}function wH(){const e=ne(),[t,n]=p.useState(),[r,o]=p.useState(void 0);p.useEffect(()=>{e.get("auth/mfa/status").then(l=>{const c=new URL("https://chart.googleapis.com/chart");c.searchParams.set("chs","300x300"),c.searchParams.set("cht","qr"),c.searchParams.set("chl",l.enrollUri),c.searchParams.set("choe","UTF-8"),n(c.toString()),o(l.enrolled)}).catch(l=>le({color:"red",message:Te(l),autoClose:!1}))},[e]);const i=p.useCallback(l=>{e.post("auth/mfa/enroll",l).then(()=>{o(!0),le({color:"green",message:"Success"})}).catch(c=>le({color:"red",message:Te(c),autoClose:!1}))},[e]),s=p.useCallback(()=>{e.post("auth/mfa/disable",{}).catch(console.log)},[e]);return r===void 0?null:r?a.jsx(xe,{children:a.jsxs(Y,{children:[a.jsx(ce,{children:"MFA is enabled"}),a.jsx(ee,{onClick:s,children:"Disable MFA"})]})}):a.jsx(xe,{width:400,children:a.jsxs(Be,{onSubmit:i,children:[a.jsx(ce,{children:"Multi Factor Auth Setup"}),a.jsx(tn,{children:a.jsx("img",{src:t})}),a.jsx(ie,{name:"token",label:"Code"}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{type:"submit",children:"Enroll"})})]})})}const qm={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__"};function Fc(){return qm}function Nk(){try{return qm.registerEnabled!==!1&&qm.registerEnabled!=="false"}catch{return!0}}function SH(){const e=Dt(),[t]=h0(),n=t.get("client_id");if(!n)return null;const r=t.get("scope")||"openid";function o(i){const s=new URL(t.get("redirect_uri"));for(const l of["scope","state","nonce"])t.has(l)&&s.searchParams.set(l,t.get(l));s.searchParams.set("code",i),window.location.assign(s.toString())}return a.jsxs(tk,{onCode:o,onForgotPassword:()=>e("/resetpassword"),onRegister:()=>e("/register"),googleClientId:Fc().googleClientId,clientId:n||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",children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Sign in to Medplum"})]})}function bH(){const e=ne(),t=Dt(),n=Fc();return p.useEffect(()=>{e.getProfile()&&t("/signin?project=new")},[e,t]),Nk()?a.jsxs(kU,{type:"project",onSuccess:()=>t("/"),googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Create a new account"})]}):a.jsx(xe,{width:450,children:a.jsx(hs,{icon:a.jsx(kc,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function CH(){const e=Dt(),t=ne(),[n,r]=p.useState(),[o,i]=p.useState(!1),s=Fc().recaptchaSiteKey;return p.useEffect(()=>{ZT(s)},[s]),a.jsx(xe,{width:450,children:a.jsxs(Be,{style:{maxWidth:400},onSubmit:async l=>{let c="";c=await ek(s),t.post("auth/resetpassword",{...l,recaptchaToken:c}).then(()=>i(!0)).catch(u=>r(ut(u)))},children:[a.jsxs(Se,{gap:"lg",mb:"xl",align:"center",children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Medplum Password Reset"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(io,{issues:Qf(n,void 0)}),!o&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{name:"email",type:"email",label:"Email",required:!0,autoFocus:!0,error:Fe(n,"email")}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(Ve,{component:"button",type:"button",color:"dimmed",onClick:()=>e("/register"),size:"xs",children:"Register"}),a.jsx(ee,{type:"submit",children:"Reset password"})]})]}),o&&a.jsx("div",{children:"If the account exists on our system, a password reset email will be sent."})]})]})})}function EH(){var i;const e=Dt(),t=ne(),[n,r]=p.useState();p.useEffect(()=>{t.get("auth/me").then(r).catch(s=>le({color:"red",message:Te(s),autoClose:!1}))},[t]);function o(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>le({color:"green",message:"Login revoked"})).catch(l=>le({color:"red",message:Te(l),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(xe,{children:[a.jsx(ce,{children:"Security"}),a.jsxs(Wy,{children:[a.jsx(ia,{term:"ID",children:a.jsx(Ve,{href:`/${lt(n.profile)}`,children:n.profile.id})}),a.jsx(ia,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(ia,{term:"Name",children:Pc((i=n.profile.name)==null?void 0:i[0])})]})]}),a.jsxs(xe,{children:[a.jsx(ce,{children:"Sessions"}),a.jsxs(me,{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:Fn(s.lastUpdated)}),a.jsx("td",{children:a.jsx(Ve,{href:"#",onClick:()=>o(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(xe,{children:[a.jsx(ce,{children:"Password"}),a.jsx(ee,{onClick:()=>e("/changepassword"),children:"Change password"})]}),a.jsxs(xe,{children:[a.jsx(ce,{children:"Multi Factor Auth"}),a.jsxs("p",{children:["Enrolled: ",n.security.mfaEnrolled.toString()]}),!n.security.mfaEnrolled&&a.jsx(ee,{onClick:()=>e("/mfa"),children:"Enroll"})]})]}):null}function jH(){const{id:e,secret:t}=Ye(),n=ne(),[r,o]=p.useState(),[i,s]=p.useState(!1),l=Qf(r,void 0);return a.jsxs(xe,{width:450,children:[a.jsx(io,{issues:l}),a.jsxs(Be,{style:{maxWidth:400},onSubmit:c=>{if(c.password!==c.confirmPassword){o(ci("Passwords do not match","confirmPassword"));return}o(void 0);const u={id:e,secret:t,password:c.password};n.post("auth/setpassword",u).then(()=>s(!0)).catch(d=>o(ut(d)))},children:[a.jsxs(tn,{style:{flexDirection:"column"},children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Set password"})]}),!i&&a.jsxs(Se,{children:[a.jsx(Rr,{name:"password",label:"New password",required:!0,error:Fe(r,"password")}),a.jsx(Rr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Fe(r,"confirmPassword")}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{type:"submit",children:"Set password"})})]}),i&&a.jsxs("div",{"data-testid":"success",children:["Password set. You can now ",a.jsx(Le,{to:"/signin",children:"sign in"}),"."]})]})]})}function PH(){const e=Hf(),t=Dt(),[n]=h0(),r=Fc(),o=p.useCallback(()=>{const i=n.get("next");t(i!=null&&i.startsWith("/")?i:"/")},[n,t]);return p.useEffect(()=>{e&&n.has("next")&&o()},[e,n,o]),a.jsxs(tk,{onSuccess:()=>o(),onForgotPassword:()=>t("/resetpassword"),onRegister:Nk()?()=>t("/register"):void 0,googleClientId:r.googleClientId,login:n.get("login")||void 0,projectId:n.get("project")||void 0,children:[a.jsx($r,{size:32}),a.jsx(ce,{children:"Sign in to Medplum"}),n.get("project")==="new"&&a.jsx("div",{children:"Sign in again to create a new project"})]})}function TH(){const e=Dt(),t=$o(),[n,r]=p.useState(),[o,i]=p.useState(),[s,l]=p.useState();return p.useEffect(()=>{const c=Object.fromEntries(new URLSearchParams(t.search).entries());r(c.resourceType),i(c.query),l(JSON.parse(c.fields))},[t]),!n||!o||!s?null:a.jsx(Az,{resourceType:n,checkboxesEnabled:!0,query:o,fields:s,onClick:c=>e(`/${n}/${c.resource.id}`),onAuxClick:c=>window.open(`/${n}/${c.resource.id}`,"_blank"),onBulk:c=>{e(`/bulk/${n}?ids=${c.join(",")}`)}})}function oh(e){const t=ne(),n=Ei(t),r=Dt(),[o,i]=p.useState({resourceType:"ProjectMembership",filters:[{code:"project",operator:re.EQUALS,value:"Project/"+n},{code:"profile-type",operator:re.EQUALS,value:e.resourceType}],fields:e.fields,count:100});return a.jsx(Oc,{search:o,onClick:s=>r(`/admin/members/${s.resource.id}`),onChange:s=>i(s.definition),hideFilters:!0,hideToolbar:!0})}function kH(){return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Bots"}),a.jsx(oh,{resourceType:"Bot",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Le,{to:"/admin/bots/new",children:"Create new bot"})})]})}function RH(){return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Clients"}),a.jsx(oh,{resourceType:"ClientApplication",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Le,{to:"/admin/clients/new",children:"Create new client"})})]})}function ih(e){return a.jsx(La,{resourceType:"AccessPolicy",name:"accessPolicy",defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{Oo(t)?e.onChange(bt(t)):e.onChange(void 0)}})}function IH(){const e=ne(),t=Ei(e),[n,r]=p.useState(""),[o,i]=p.useState(""),[s,l]=p.useState(),[c,u]=p.useState(),[d,f]=p.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Create new Bot"}),a.jsxs(Be,{onSubmit:()=>{const h={name:n,description:o,accessPolicy:s};e.post("admin/projects/"+t+"/bot",h).then(m=>{e.invalidateSearches("Bot"),e.invalidateSearches("ProjectMembership"),f(m),le({color:"green",message:"Bot created"})}).catch(m=>{le({color:"red",message:Te(m),autoClose:!1}),u(ut(m))})},children:[!d&&a.jsxs(Se,{children:[a.jsx(it,{title:"Name",htmlFor:"name",outcome:c,children:a.jsx(ie,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:h=>r(h.currentTarget.value),error:Fe(c,"name")})}),a.jsx(it,{title:"Description",htmlFor:"description",outcome:c,children:a.jsx(ie,{id:"description",name:"description",onChange:h=>i(h.currentTarget.value),error:Fe(c,"description")})}),a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:c,children:a.jsx(ih,{name:"accessPolicy",onChange:l})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{type:"submit",children:"Create Bot"})})]}),d&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(ae,{children:"Bot created"}),a.jsxs(xn,{children:[a.jsx(xn.Item,{children:a.jsx(Le,{to:d,children:"Go to new bot"})}),a.jsx(xn.Item,{children:a.jsx(Le,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function DH(){const e=ne(),t=Ei(e),[n,r]=p.useState(""),[o,i]=p.useState(""),[s,l]=p.useState(""),[c,u]=p.useState(),[d,f]=p.useState(),[h,m]=p.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Create new Client"}),a.jsxs(Be,{onSubmit:()=>{const g={name:n,description:o,redirectUri:s,accessPolicy:c};e.post("admin/projects/"+t+"/client",g).then(v=>{e.invalidateSearches("ClientApplication"),e.invalidateSearches("ProjectMembership"),m(v),le({color:"green",message:"Client created"})}).catch(v=>{le({color:"red",message:Te(v),autoClose:!1}),f(ut(v))})},children:[!h&&a.jsxs(Se,{children:[a.jsx(it,{title:"Name",htmlFor:"name",outcome:d,children:a.jsx(ie,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:g=>r(g.currentTarget.value),error:Fe(d,"name")})}),a.jsx(it,{title:"Description",htmlFor:"description",outcome:d,children:a.jsx(ie,{id:"description",name:"description",onChange:g=>i(g.currentTarget.value),error:Fe(d,"description")})}),a.jsx(it,{title:"Redirect URI",htmlFor:"redirectUri",outcome:d,children:a.jsx(ie,{id:"redirectUri",name:"redirectUri",onChange:g=>l(g.currentTarget.value),error:Fe(d,"redirectUri")})}),a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:d,children:a.jsx(ih,{name:"accessPolicy",onChange:u})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{type:"submit",children:"Create Client"})})]}),h&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(ae,{children:"Client created"}),a.jsxs(xn,{children:[a.jsx(xn.Item,{children:a.jsx(Le,{to:h,children:"Go to new client"})}),a.jsx(xn.Item,{children:a.jsx(Le,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}function _H(e){return a.jsx(La,{resourceType:"UserConfiguration",name:"userConfiguration",defaultValue:e.defaultValue,placeholder:"User Configuration",onChange:t=>{Oo(t)?e.onChange(bt(t)):e.onChange(void 0)}})}function AH(){const{membershipId:e}=Ye(),t=ne(),n=Ei(t),r=Dt(),o=t.get(`admin/projects/${n}/members/${e}`).read(),[i,s]=p.useState(o.accessPolicy),[l,c]=p.useState(o.userConfiguration),[u,d]=p.useState(o.admin),[f,h]=p.useState(),[m,g]=p.useState(!1);function v(){window.confirm("Are you sure?")&&t.delete(`admin/projects/${n}/members/${e}`).then(()=>t.get(`admin/projects/${n}`,{cache:"no-cache"})).then(()=>r("/admin/project")).catch(b=>h(ut(b)))}return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Edit membership"}),a.jsx("h3",{children:a.jsx(sa,{value:o.profile,link:!0})}),a.jsxs(Be,{onSubmit:()=>{const b={...o,accessPolicy:i,userConfiguration:l,admin:u};t.post(`admin/projects/${n}/members/${e}`,b).then(()=>g(!0)).catch(x=>h(ut(x)))},children:[!m&&a.jsxs(Se,{children:[a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(ih,{name:"accessPolicy",defaultValue:i,onChange:s})}),a.jsx(it,{title:"User Configuration",htmlFor:"userConfiguration",outcome:f,children:a.jsx(_H,{name:"userConfiguration",defaultValue:l,onChange:c})}),a.jsx(it,{title:"Admin",htmlFor:"admin",outcome:f,children:a.jsx(ur,{id:"admin",name:"admin",defaultChecked:u,onChange:b=>d(b.currentTarget.checked)})}),a.jsxs(Y,{justify:"flex-end",mt:"xl",children:[a.jsx(ee,{type:"submit",children:"Save"}),a.jsx(ee,{type:"button",color:"red",variant:"outline",onClick:v,children:"Remove user"})]})]}),m&&a.jsxs("div",{"data-testid":"success",children:[a.jsx("p",{children:"User updated"}),a.jsx("pre",{children:JSON.stringify(f,void 0,2)}),a.jsxs("p",{children:["Click ",a.jsx(Le,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]})]})]})}function NH(){const e=ne(),[t,n]=p.useState(e.getProject()),[r,o]=p.useState(),[i,s]=p.useState(),[l,c]=p.useState(!1),[u,d]=p.useState(void 0),f=p.useCallback(h=>{const m={resourceType:h.resourceType,firstName:h.firstName,lastName:h.lastName,email:h.email,sendEmail:h.sendEmail==="on",accessPolicy:r,admin:h.isAdmin==="on"};e.invite(t==null?void 0:t.id,m).then(g=>{e.invalidateSearches("Patient"),e.invalidateSearches("Practitioner"),e.invalidateSearches("ProjectMembership"),$f(g)?s(g):d(g),c(m.sendEmail??!1),le({color:"green",message:"Invite success"})}).catch(g=>{le({color:"red",message:Te(g),autoClose:!1}),s(ut(g))})},[e,t,r]);return a.jsxs(Be,{onSubmit:f,children:[!u&&!i&&a.jsxs(Se,{children:[a.jsx(ce,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(it,{title:"Project",htmlFor:"project",outcome:i,children:a.jsx(La,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(xt,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:Fe(i,"resourceType")}),a.jsx(ie,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:Fe(i,"firstName")}),a.jsx(ie,{name:"lastName",label:"Last Name",required:!0,error:Fe(i,"lastName")}),a.jsx(ie,{name:"email",type:"email",label:"Email",required:!0,error:Fe(i,"email")}),a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:i,children:a.jsx(ih,{name:"accessPolicy",onChange:o})}),a.jsx(ur,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(ur,{name:"isAdmin",label:"Admin"}),a.jsx(Y,{justify:"flex-end",children:a.jsx(ee,{type:"submit",children:"Invite"})})]}),i&&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(Le,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]}),u&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(ae,{children:"User created"}),l&&a.jsx(ae,{children:"Email sent"}),a.jsxs(xn,{children:[a.jsx(xn.Item,{children:a.jsx(Le,{to:u,children:"Go to new membership"})}),a.jsx(xn.Item,{children:a.jsx(Le,{to:u.profile,children:"Go to new profile"})}),a.jsx(xn.Item,{children:a.jsx(Le,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function OH(){return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Patients"}),a.jsx(oh,{resourceType:"Patient",fields:["user","profile","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Le,{to:"/admin/invite",children:"Invite new patient"})})]})}function MH(){const e=ne();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(io,{outcome:Kj});function t(n){e.post("admin/projects/setpassword",n).then(()=>le({color:"green",message:"Done"})).catch(r=>le({color:"red",message:Te(r),autoClose:!1}))}return a.jsxs(xe,{width:600,children:[a.jsx(ce,{order:1,children:"Project Admin"}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{order:2,children:"Force Set Password"}),a.jsx(ae,{children:"Sets the password for the specified user in this project."}),a.jsx(ae,{children:"This action can only be performed by project administrators. Passwords can only be set for users scoped in this project."}),a.jsx(Be,{onSubmit:t,children:a.jsxs(Se,{children:[a.jsx(ie,{name:"email",label:"Email",required:!0}),a.jsx(Rr,{name:"password",label:"Password",required:!0}),a.jsx(ee,{type:"submit",children:"Force Set Password"})]})})]})}function Yw(){const e=ne(),t=Ei(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Details"}),a.jsxs(Wy,{children:[a.jsx(ia,{term:"ID",children:n.project.id}),a.jsx(ia,{term:"Name",children:n.project.name})]})]})}const Xw=["Details","Users","Patients","Clients","Bots","Secrets","Sites"];function $H(){const e=Dt(),n=$o().pathname.replace("/admin/","")||Xw[0],r=ne(),o=Ei(r),i=p.useMemo(()=>r.get("admin/projects/"+o).read(),[r,o]);function s(l){e(`/admin/${l}`)}return a.jsxs(a.Fragment,{children:[a.jsxs(On,{children:[a.jsx(Re,{children:a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Project"}),a.jsx(Re.Value,{children:i.project.name})]})}),a.jsx(hr,{children:a.jsx(We,{value:n.toLowerCase(),onChange:s,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Xw.map(l=>a.jsx(We.Tab,{value:l.toLowerCase(),children:l},l))})})})]}),a.jsx(xe,{children:a.jsx(f0,{})})]})}function LH(){const e=ne(),t=Ei(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=p.useState(!1),[i,s]=p.useState();return p.useEffect(()=>{e.requestSchema("Project").then(()=>o(!0)).catch(console.log)},[e]),p.useEffect(()=>{n&&s(ro(n.project.secret||[]))},[e,n]),!r||!i?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:l=>{l.preventDefault(),e.post(`admin/projects/${t}/secrets`,i).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>le({color:"green",message:"Saved"})).catch(console.log)},children:[a.jsx(ce,{children:"Project Secrets"}),a.jsx("p",{children:"Use project secrets to store sensitive information such as API keys or other access credentials."}),a.jsx(Fa,{property:ys("Project","secret"),name:"secret",path:"Project.secret",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(ee,{type:"submit",children:"Save"})]})}function FH(){const e=ne(),t=Ei(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=p.useState(!1),[i,s]=p.useState();return p.useEffect(()=>{e.requestSchema("Project").then(()=>o(!0)).catch(console.log)},[e]),p.useEffect(()=>{n&&s(ro(n.project.site||[]))},[e,n]),!r||!i?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:l=>{l.preventDefault(),e.post(`admin/projects/${t}/sites`,i).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>le({color:"green",message:"Saved"})).catch(c=>{var d,f,h,m;const u=ut(c);le({color:"red",message:`Error ${(f=(d=u.issue)==null?void 0:d[0].details)==null?void 0:f.text} ${(m=(h=u.issue)==null?void 0:h[0].expression)==null?void 0:m[0]}`,autoClose:!1})})},children:[a.jsx(ce,{children:"Project Sites"}),a.jsx("p",{children:"Use project sites configure your project on a separate domain."}),a.jsx(Fa,{property:ys("Project","site"),name:"site",path:"Project.site",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(ee,{type:"submit",children:"Save"})]})}function zH(){const e=ne();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(io,{outcome:Kj});function t(){al(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function n(){al(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function r(){al(e,"Rebuilding Value Sets","admin/super/valuesets")}function o(u){al(e,"Reindexing Resources","admin/super/reindex",u)}function i(u){al(e,"Rebuilding Compartments","admin/super/compartments",u)}function s(u){e.post("admin/super/removebotidjobsfromqueue",u).then(()=>le({color:"green",message:"Done"})).catch(d=>le({color:"red",message:Te(d),autoClose:!1}))}function l(u){e.post("admin/super/purge",{...u,before:tT(u.before)}).then(()=>le({color:"green",message:"Done"})).catch(d=>le({color:"red",message:Te(d),autoClose:!1}))}function c(u){e.post("admin/super/setpassword",u).then(()=>le({color:"green",message:"Done"})).catch(d=>le({color:"red",message:Te(d),autoClose:!1}))}return a.jsxs(xe,{width:600,children:[a.jsx(ce,{order:1,children:"Super Admin"}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{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(Be,{children:a.jsx(ee,{onClick:t,children:"Rebuild StructureDefinitions"})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{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(Be,{children:a.jsx(ee,{onClick:n,children:"Rebuild SearchParameters"})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{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(Be,{children:a.jsx(ee,{onClick:r,children:"Rebuild ValueSets"})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{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(Be,{onSubmit:o,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Resource Type",children:a.jsx(ie,{name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(ee,{type:"submit",children:"Reindex"})]})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{order:2,children:"Rebuild Compartments"}),a.jsx("p",{children:"When Medplum changes how resource compartments are derived, the system may require a rebuild for old resources to take effect."}),a.jsx(Be,{onSubmit:i,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Resource Type",children:a.jsx(ie,{name:"resourceType",placeholder:"Compartments Resource Type"})}),a.jsx(ee,{type:"submit",children:"Rebuild Compartments"})]})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{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(Be,{onSubmit:l,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(xt,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(it,{title:"Purge Before",htmlFor:"before",children:a.jsx(es,{name:"before",placeholder:"Before Date"})}),a.jsx(ee,{type:"submit",children:"Purge"})]})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{order:2,children:"Remove Bot ID Jobs from Queue"}),a.jsx("p",{children:"Remove all queued jobs for a Bot ID"}),a.jsx(Be,{onSubmit:s,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Bot ID",children:a.jsx(ie,{name:"botId",placeholder:"Bot Id"})}),a.jsx(ee,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(Rn,{my:"lg"}),a.jsx(ce,{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(Be,{onSubmit:c,children:a.jsxs(Se,{children:[a.jsx(ie,{name:"email",label:"Email",required:!0}),a.jsx(Rr,{name:"password",label:"Password",required:!0}),a.jsx(ie,{name:"projectId",label:"Project ID"}),a.jsx(ee,{type:"submit",children:"Force Set Password"})]})})]})}function al(e,t,n,r){Jr.show({id:n,loading:!0,title:t,message:"Running...",autoClose:!1,withCloseButton:!1});const o={method:"POST"};r&&(o.body=JSON.stringify(r)),e.startAsyncRequest(n,o).then(()=>{Jr.update({id:n,color:"green",title:t,message:"Done",icon:a.jsx(qf,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})}).catch(i=>{Jr.update({id:n,color:"red",title:t,message:Te(i),icon:a.jsx(kd,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})})}function BH(){return a.jsxs(a.Fragment,{children:[a.jsx(ce,{children:"Users"}),a.jsx(oh,{resourceType:"Practitioner",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Le,{to:"/admin/invite",children:"Invite new user"})})]})}function UH(){const[e]=ba("ObservationDefinition","_count=100");return e?a.jsxs(me,{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=>{var n,r,o,i;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Zr,{value:(n=t.category)==null?void 0:n[0]})}),a.jsx("td",{children:a.jsx(Zr,{value:t.code})}),a.jsx("td",{children:a.jsx(Zr,{value:t.method})}),a.jsx("td",{children:(o=(r=t.quantitativeDetails)==null?void 0:r.unit)==null?void 0:o.text}),a.jsx("td",{children:(i=t.quantitativeDetails)==null?void 0:i.decimalPrecision}),a.jsx("td",{children:a.jsx(Gm,{ranges:t.qualifiedInterval})})]},t.id)})})]}):a.jsx(Ar,{})}function Gm(e){const{ranges:t}=e;if(!t)return null;const n=Jw(t.map(o=>o.gender));if(n.length>1)return n.sort((o,i)=>o.localeCompare(i)),a.jsx(a.Fragment,{children:n.map(o=>{var i;return a.jsxs(p.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:zt(o)})}),a.jsx(Gm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>s.gender===o)})]},o)})});const r=Jw(t.map(o=>o.age&&Ql(o.age)));return r.length>1?(r.sort((o,i)=>o.localeCompare(i)),a.jsx(a.Fragment,{children:r.map(o=>{var i;return a.jsxs(p.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:zt(o)})}),a.jsx(Gm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>Ql(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(Hy,{value:o.range})})]})})},`range-${o.condition}`))})}function Jw(e){return[...new Set(e.filter(t=>!!t))]}function VH(){const[e]=ba("ActivityDefinition","_count=100"),[t]=ba("ObservationDefinition","_count=100");return!e||!t?a.jsx(Ar,{}):a.jsxs(me,{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=>{var r;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Zr,{value:(r=n.category)==null?void 0:r[0]})}),a.jsx("td",{children:a.jsx(Zr,{value:n.code})}),e.map(o=>{var i;return a.jsx("td",{children:(i=o.observationResultRequirement)!=null&&i.find(s=>{var l;return(l=s.reference)==null?void 0:l.includes(n.id)})?"✅":""},o.id)})]},n.id)})})]})}function WH(e){var s;const t=ne(),[n,r]=p.useState(),[o,i]=p.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(Le,{to:o,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx(Le,{to:e.planDefinition,children:"Plan Definition"})]})]})]}):a.jsx(Be,{onSubmit:()=>{t.post(t.fhirUrl("PlanDefinition",e.planDefinition.id,"$apply"),{resourceType:"Parameters",parameter:[{name:"subject",valueReference:n}]}).then(i).catch(console.log)},children:a.jsxs(Se,{children:[a.jsxs(ce,{children:['Start "',e.planDefinition.title,'"']}),a.jsxs(ae,{children:["Use the ",a.jsx("strong",{children:"Apply"})," operation to create a group of tasks for a workflow."]}),a.jsx(ae,{children:"The following tasks will be created:"}),a.jsx("ul",{children:(s=e.planDefinition.action)==null?void 0:s.map((l,c)=>{var u;return a.jsxs("li",{children:[((u=l.definitionCanonical)==null?void 0:u.startsWith("Questionnaire/"))&&"Questionnaire request: ",l.title&&a.jsx(a.Fragment,{children:l.title}),l.code&&a.jsx(Zr,{value:l.code[0]})]},`action-${c}`)})}),a.jsx(it,{title:"Subject",children:a.jsx(Kf,{name:"subject",targetTypes:["Patient","Practitioner"],defaultValue:n,onChange:r})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{type:"submit",children:"Go"})})]})})}function HH(){const{resourceType:e,id:t}=Ye(),n=st({reference:e+"/"+t});return n?a.jsx(xe,{children:a.jsx(WH,{planDefinition:n})}):null}function qH(){const{resourceType:e,id:t}=Ye(),n=st({reference:e+"/"+t}),[r,o]=ba("Questionnaire","subject-type="+e),[i,s]=ba("ClientApplication",{_count:1e3});if(!n||o||s)return a.jsx(Ar,{});const l=i==null?void 0:i.filter(d=>GH(e)&&!!d.launchUri);if((!r||r.length===0)&&(!l||l.length===0))return a.jsxs(xe,{children:[a.jsx(ce,{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 c,u;return n.resourceType==="Patient"?c=bt(n):n.resourceType==="Encounter"&&(c=n.subject,u=bt(n)),a.jsxs(xe,{children:[r==null?void 0:r.map(d=>a.jsxs("div",{children:[a.jsx(ce,{order:3,children:a.jsx(Le,{to:`/forms/${d.id}?subject=${lt(n)}`,children:d.title||d.name})}),a.jsx(ae,{children:d.description})]},d.id)),l==null?void 0:l.map(d=>a.jsxs("div",{children:[a.jsx(ce,{order:3,children:a.jsx(jU,{client:d,patient:c,encounter:u,children:d.name})}),a.jsx(ae,{children:d.description})]},d.id))]})}function GH(e){return e==="Patient"||e==="Encounter"}function QH(){const{resourceType:e,id:t}=Ye(),n=Dt(),[r,o]=p.useState({resourceType:"AuditEvent",filters:[{code:"entity",operator:re.EQUALS,value:`${e}/${t}`}],fields:["id","outcome","outcomeDesc","_lastUpdated"],sortRules:[{code:"-_lastUpdated"}],count:20});return a.jsx(xe,{children:a.jsx(Oc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function KH(){const e=ne(),{resourceType:t,id:n}=Ye(),r=e.readHistory(t,n).read();return a.jsx(xe,{children:a.jsx(gU,{history:r})})}const YH="_hl7Input_k5xm3_1",XH={hl7Input:YH};function JH(e){return a.jsx("iframe",{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 ZH(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",{frameBorder:"0",src:n.toString(),style:{width:"100%",height:"100%",minHeight:e.minHeight},ref:e.iframeRef,"data-testid":e.testId,onLoad:r=>{zu(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const eq=`{
|
|
225
|
+
"resourceType": "Patient",
|
|
226
|
+
"name": [
|
|
227
|
+
{
|
|
228
|
+
"given": [
|
|
229
|
+
"Alice"
|
|
230
|
+
],
|
|
231
|
+
"family": "Smith"
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}`,tq="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 nq(){const e=ne(),{id:t}=Ye(),[n,r]=p.useState(),[o,i]=p.useState(),[s,l]=p.useState(eq),[c,u]=p.useState(tq),[d,f]=p.useState(Wt.FHIR_JSON),h=p.useRef(null),m=p.useRef(null),[g,v]=p.useState(!1);p.useEffect(()=>{e.readResource("Bot",t).then(async E=>{r(E),i(await rq(e,E))}).catch(E=>le({color:"red",message:Te(E),autoClose:!1}))},[e,t]);const b=p.useCallback(()=>zu(h.current,{command:"getValue"}),[]),x=p.useCallback(()=>zu(h.current,{command:"getOutput"}),[]),y=p.useCallback(async()=>d===Wt.FHIR_JSON?JSON.parse(s):c,[d,s,c]),w=p.useCallback(async E=>{E.preventDefault(),E.stopPropagation(),v(!0);try{const P=await b(),T=await e.createAttachment(P,"index.ts","text/typescript"),k=[];n!=null&&n.sourceCode?k.push({op:"replace",path:"/sourceCode",value:T}):k.push({op:"add",path:"/sourceCode",value:T}),await e.patchResource("Bot",t,k),le({color:"green",message:"Saved"})}catch(P){le({color:"red",message:Te(P),autoClose:!1})}finally{v(!1)}},[e,t,n,b]),S=p.useCallback(async E=>{E.preventDefault(),E.stopPropagation(),v(!0);try{const P=await x();await e.post(e.fhirUrl("Bot",t,"$deploy"),{code:P}),le({color:"green",message:"Deployed"})}catch(P){le({color:"red",message:Te(P),autoClose:!1})}finally{v(!1)}},[e,t,x]),j=p.useCallback(async E=>{E.preventDefault(),E.stopPropagation(),v(!0);try{const P=await y(),T=await e.post(e.fhirUrl("Bot",t,"$execute"),P,d);await zu(m.current,{command:"setValue",value:T}),le({color:"green",message:"Success"})}catch(P){le({color:"red",message:Te(P),autoClose:!1})}finally{v(!1)}},[e,t,y,d]);return!n||o===void 0?null:a.jsxs(Wn,{m:0,gutter:0,style:{overflow:"hidden"},children:[a.jsx(Wn.Col,{span:8,children:a.jsxs(On,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(ZH,{iframeRef:h,language:"typescript",module:"commonjs",testId:"code-frame",defaultValue:o,minHeight:"528px"}),a.jsxs(Y,{justify:"flex-end",gap:"xs",children:[a.jsx(ee,{type:"button",onClick:w,loading:g,leftSection:a.jsx(j7,{size:"1rem"}),children:"Save"}),a.jsx(ee,{type:"button",onClick:S,loading:g,leftSection:a.jsx(My,{size:"1rem"}),children:"Deploy"}),a.jsx(ee,{type:"button",onClick:j,loading:g,leftSection:a.jsx(B7,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(Wn.Col,{span:4,children:[a.jsxs(On,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(xt,{data:[{label:"FHIR",value:Wt.FHIR_JSON},{label:"HL7",value:Wt.HL7_V2}],onChange:E=>f(E.currentTarget.value)}),d===Wt.FHIR_JSON?a.jsx(Aa,{value:s,onChange:E=>l(E),autosize:!0,minRows:15}):a.jsx("textarea",{className:XH.hl7Input,value:c,onChange:E=>u(E.currentTarget.value),rows:15})]}),a.jsx(On,{m:2,p:"xs",shadow:"md",children:a.jsx(JH,{iframeRef:m,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function rq(e,t){var n,r,o;if((n=t.sourceCode)!=null&&n.url){const i=(o=(r=t.sourceCode.url)==null?void 0:r.split("/"))==null?void 0:o.find(eP);return(await e.download(e.fhirUrl("Binary",i))).text()}return t.code??""}function ws(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function Ok(e,t){var n,r;(r=(n=e==null?void 0:e.meta)==null?void 0:n.profile)!=null&&r.includes(t)||(e.meta=e.meta??{},e.meta.profile=e.meta.profile??[],e.meta.profile.push(t))}function oq(e,t){var n,r;if((r=(n=e==null?void 0:e.meta)==null?void 0:n.profile)!=null&&r.includes(t)){const o=e.meta.profile.indexOf(t);e.meta.profile.splice(o,1)}}function iq(){const e=ne(),{resourceType:t,id:n}=Ye(),r={reference:t+"/"+n},o=p.useCallback(i=>{e.updateResource(ws(i)).then(()=>{le({color:"green",message:"Success"})}).catch(s=>{le({color:"red",message:Te(s),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(xe,{children:a.jsx(Hz,{value:r,onSubmit:o})});case"Questionnaire":return a.jsx(xe,{children:a.jsx(kB,{questionnaire:r,onSubmit:o})});default:return null}}function sq(){const{resourceType:e,id:t}=Ye(),n=st({reference:e+"/"+t}),r=Dt();return n?a.jsx(xe,{children:a.jsx(JB,{value:n,onStart:(o,i)=>r(`/forms/${Lf(i)}`),onEdit:(o,i,s)=>r(`/${s.reference}}`)})}):null}function aq(){const e=ne(),{resourceType:t,id:n}=Ye(),r=Dt();return a.jsxs(xe,{children:[a.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),a.jsx(ee,{color:"red",onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)).catch(o=>le({color:"red",message:Te(o),autoClose:!1}))},children:"Delete"})]})}function lq(){const{resourceType:e,id:t}=Ye(),n=st({reference:e+"/"+t});return n?a.jsx(xe,{children:a.jsx(n0,{value:n})}):null}function cq(){const e=ne(),{resourceType:t,id:n}=Ye(),[r,o]=p.useState(),i=Dt(),[s,l]=p.useState();p.useEffect(()=>{e.readResource(t,n).then(d=>o(ro(d))).catch(d=>{l(ut(d)),le({color:"red",message:Te(d),autoClose:!1})})},[e,t,n]);const c=p.useCallback(d=>{l(void 0),e.updateResource(ws(d)).then(()=>{i(`/${t}/${n}/details`),le({color:"green",message:"Success"})}).catch(f=>{l(ut(f)),le({color:"red",message:Te(f),autoClose:!1})})},[e,t,n,i]),u=p.useCallback(()=>i(`/${t}/${n}/delete`),[i,t,n]);return r?a.jsx(xe,{children:a.jsx(Dd,{defaultValue:r,onSubmit:c,onDelete:u,outcome:s})}):null}function Mk(e,t){const n=ne(),r=Dt();return{defaultValue:{resourceType:e},handleSubmit:s=>{t&&t(void 0),n.createResource(s).then(l=>r("/"+l.resourceType+"/"+l.id)).catch(l=>{t&&t(ut(l)),le({color:"red",message:Te(l),autoClose:!1,styles:{description:{whiteSpace:"pre-line"}}})})}}}function $k({resource:e,currentProfile:t,onChange:n}){const r=e.resourceType,o=ne(),[i,s]=p.useState();return p.useEffect(()=>{o.searchResources("StructureDefinition",{type:r,derivation:"constraint",_count:50}).then(l=>{s(l.filter(t8))}).catch(console.error)},[o,n,r]),a.jsx(We,{value:t==null?void 0:t.url,onChange:l=>{const c=i==null?void 0:i.find(u=>u.url===l);c&&n(c)},children:a.jsx(We.List,{children:i==null?void 0:i.map(l=>{var d,f;const c=(f=(d=e.meta)==null?void 0:d.profile)==null?void 0:f.includes(l.url),u=c?"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(We.Tab,{value:l.url,title:u,rightSection:c&&a.jsx(vy,{variant:"outline",color:"green",size:"xs",style:{borderStyle:"none"},children:a.jsx(b7,{size:"90%"})}),children:l.title||l.name},l.url)})})})}function hp(){const{resourceType:e}=Ye(),t=$o(),[n,r]=p.useState(),{defaultValue:o,handleSubmit:i}=Mk(e,r),[s,l]=p.useState(),c=t.pathname.toLowerCase().endsWith("profiles"),u=p.useCallback(d=>{const f=ws(d);s&&Ok(f,s.url),i(f)},[s,i]);return c?a.jsx(xe,{children:a.jsxs(Se,{children:[a.jsx($k,{resource:o,currentProfile:s,onChange:l}),s?a.jsx(Dd,{defaultValue:o,onSubmit:u,outcome:n,profileUrl:s.url},s.url):a.jsx(ae,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})}):a.jsx(xe,{children:a.jsx(Dd,{defaultValue:o,onSubmit:i,outcome:n})})}function uq(){const e=ne(),{resourceType:t,id:n}=Ye(),r=e.readHistory(t,n).read();return a.jsx(xe,{children:a.jsx(SU,{history:r})})}function dq(){const{resourceType:e}=Ye(),[t,n]=p.useState(),{defaultValue:r,handleSubmit:o}=Mk(e,n),i=p.useCallback(s=>{o(JSON.parse(s["new-resource"]))},[o]);return a.jsxs(xe,{children:[t&&a.jsx(io,{outcome:t}),a.jsxs(Be,{onSubmit:i,children:[a.jsx(Aa,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:Qn(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(ee,{type:"submit",children:"OK"})})]})]})}function fq(){const e=ne(),{resourceType:t,id:n}=Ye(),r=st({reference:t+"/"+n}),o=Dt(),[i,s]=p.useState(),l=p.useCallback(c=>{e.updateResource(ws(JSON.parse(c.resource))).then(()=>{s(void 0),o(`/${t}/${n}/details`),le({color:"green",message:"Success"})}).catch(u=>{le({color:"red",message:Te(u),autoClose:!1})})},[e,t,n,o]);return r?a.jsxs(xe,{children:[i&&a.jsx(io,{outcome:i}),a.jsxs(Be,{onSubmit:l,children:[a.jsx(Aa,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:Qn(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(ee,{type:"submit",children:"OK"})})]})]}):null}function hq(){const{resourceType:e,id:t}=Ye();return st({reference:e+"/"+t})?a.jsxs(xe,{children:[a.jsxs(hs,{icon:a.jsx(kc,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx(Ve,{href:`/forms/${t}`,children:`/forms/${t}`})]}),a.jsx(qT,{questionnaire:{reference:e+"/"+t},onSubmit:()=>alert("You submitted the preview")})]}):null}function pq(){const e=ne(),{resourceType:t,id:n}=Ye(),[r,o]=p.useState(),[i,s]=p.useState();return p.useEffect(()=>{e.readResource(t,n).then(l=>o(ro(l))).catch(l=>{le({color:"red",message:Te(l)})})},[e,t,n]),r?a.jsxs(xe,{children:[a.jsxs(ce,{order:2,children:["Available ",t," profiles"]}),a.jsx(Se,{children:a.jsxs(a.Fragment,{children:[a.jsx($k,{resource:r,currentProfile:i,onChange:s}),i?a.jsx(mq,{profile:i,resource:r,onResourceUpdated:l=>o(l)},i.url):a.jsx(ae,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const mq=({profile:e,resource:t,onResourceUpdated:n})=>{const r=ne(),[o,i]=p.useState(),[s,l]=p.useState(()=>{var u,d;return(d=(u=t.meta)==null?void 0:u.profile)==null?void 0:d.includes(e.url)}),c=p.useCallback(u=>{i(void 0);const d=ws(u);s?Ok(d,e.url):oq(d,e.url),r.updateResource(d).then(f=>{n(f),le({color:"green",message:"Success"})}).catch(f=>{i(ut(f)),le({color:"red",message:Te(f),autoClose:!1})})},[r,e.url,n,s]);return a.jsxs(Se,{children:[a.jsx(wc,{size:"md",checked:s,label:`Conform resource to ${e.title}`,onChange:u=>l(u.currentTarget.checked),"data-testid":"profile-toggle"}),s?a.jsx(Dd,{profileUrl:e.url,defaultValue:t,onSubmit:c,outcome:o}):a.jsx("form",{noValidate:!0,onSubmit:u=>{u.preventDefault(),c(t)},children:a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(ee,{type:"submit",children:"OK"})})})]})};function gq(){const e=ne(),{id:t}=Ye(),[n,r]=p.useState(),[o,i]=p.useState(0),s=e.searchResources("Subscription","status=active&_count=100").read().filter(c=>vq(c,t));function l(){n&&e.createResource({resourceType:"Subscription",status:"active",reason:`Connect bot ${n.name} to questionnaire responses`,criteria:"QuestionnaireResponse?questionnaire=Questionnaire/"+t,channel:{type:"rest-hook",endpoint:lt(n)}}).then(()=>{r(void 0),i(Date.now()),e.invalidateSearches("Subscription"),le({color:"green",message:"Success"})}).catch(c=>le({color:"red",message:Te(c),autoClose:!1}))}return a.jsxs(xe,{children:[a.jsx(ce,{children:"Bots"}),s.length===0&&a.jsx("p",{children:"No bots found."}),s.map(c=>{var u;return a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(za,{value:{reference:(u=c.channel)==null?void 0:u.endpoint},link:!0})}),a.jsxs("p",{children:["Criteria: ",c.criteria]})]},c.id)}),a.jsx("hr",{}),a.jsx(ce,{children:"Connect to bot"}),a.jsxs(Y,{children:[a.jsx(La,{name:"bot",resourceType:"Bot",onChange:c=>r(c)}),a.jsx(ee,{onClick:l,children:"Connect"})]}),a.jsx("div",{style:{display:"none"},children:o})]})}function vq(e,t){var o;const n=e.criteria||"",r=((o=e.channel)==null?void 0:o.endpoint)||"";return n.startsWith("QuestionnaireResponse?")&&n.includes(t)&&r.startsWith("Bot/")}function yq(){const{id:e}=Ye(),t=Dt(),[n,r]=p.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:re.EQUALS,value:"Questionnaire/"+e}],fields:["id","_lastUpdated"]});return a.jsx(xe,{children:a.jsx(Oc,{search:n,onClick:o=>t(`/${o.resource.resourceType}/${o.resource.id}`),onChange:o=>r(o.definition),hideFilters:!0,hideToolbar:!0})})}function xq(){const e=ne(),{resourceType:t,id:n}=Ye(),r=st({reference:t+"/"+n}),o=p.useCallback(i=>{e.updateResource(ws(i)).then(()=>{le({color:"green",message:"Success"})}).catch(s=>{le({color:"red",message:Te(s),autoClose:!1})})},[e]);return r?a.jsx(xe,{children:a.jsx(WB,{onSubmit:o,definition:r})}):null}function wq(){const{resourceType:e,id:t}=Ye(),n=st({reference:e+"/"+t});return n?a.jsx(xe,{children:e==="MeasureReport"?a.jsx(Fz,{measureReport:n}):a.jsx(Yy,{value:n})}):null}const Sq="_container_1ue98_1",bq="_entry_1ue98_14",Cq="_active_1ue98_21",pp={container:Sq,entry:bq,active:Cq};function Eq(e){const t=ne(),n=st(e.value),[r,o]=p.useState();return p.useEffect(()=>{if(!n)return;const i=v0(n);if(!i)return;const s="reference"in i?i.reference:lt(i);t.search("ServiceRequest","subject="+s).then(l=>{const u=l.entry.map(d=>d.resource);CT(u),u.reverse(),o(u)}).catch(l=>le({color:"red",message:Te(l),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:pp.container,children:r.map(i=>{var s,l,c,u,d,f,h;return a.jsxs("div",{className:Ze(pp.entry,{[pp.active]:i.id===(n==null?void 0:n.id)}),children:[a.jsx("p",{children:a.jsx(Le,{to:i,children:jq(i)})}),((l=(s=i.category)==null?void 0:s[0])==null?void 0:l.text)&&a.jsx("p",{children:(c=i.category[0])==null?void 0:c.text}),((f=(d=(u=i.code)==null?void 0:u.coding)==null?void 0:d[0])==null?void 0:f.code)&&a.jsx("p",{children:(h=i.code.coding[0])==null?void 0:h.code}),a.jsx("p",{children:Pq(i)})]},i.id)})}):null}function jq(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function Pq(e){var t;return e.authoredOn?e.authoredOn.substring(0,10):(t=e.meta)!=null&&t.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const Tq="_container_1l2dh_1",kq={container:Tq};function Rq(e){var o,i,s,l;const t=st(e.valueSet);if(!t)return null;const n=[""],r=(l=(s=(i=(o=t.compose)==null?void 0:o.include)==null?void 0:i[0])==null?void 0:s.concept)==null?void 0:l.map(c=>c.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),a.jsx("div",{className:kq.container,children:a.jsx(xt,{defaultValue:e.defaultValue,onChange:c=>e.onChange(c.currentTarget.value),data:n})})}function Iq(e){var n,r;const t=st(e.specimen);return t?a.jsxs(Re,{children:[a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Type"}),a.jsx(Re.Value,{children:"Specimen"})]}),a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Collected"}),a.jsx(Re.Value,{children:Fn((n=t.collection)==null?void 0:n.collectedDateTime)})]}),a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Specimen Age"}),a.jsx(Re.Value,{children:Dq(t)})]}),(r=t.collection)!=null&&r.collectedDateTime&&t.receivedTime?a.jsxs(Re.Entry,{children:[a.jsx(Re.Key,{children:"Specimen Stability"}),a.jsx(Re.Value,{children:_q(t)})]}):a.jsx(a.Fragment,{})]}):null}function Dq(e){var o;const t=(o=e.collection)==null?void 0:o.collectedDateTime;if(!t)return;const n=new Date(t);return Lk(Fk(n,new Date))}function _q(e){var r;if(!((r=e.collection)!=null&&r.collectedDateTime)||!e.receivedTime)return;const t=new Date(e.collection.collectedDateTime),n=new Date(e.receivedTime);return Lk(Fk(t,n))}function Lk(e){return e.toString().padStart(3,"0")+"D"}function Fk(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function Aq(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==="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"),t}const Nq=["Profiles"];function Oq(){var w,S,j,E,P,T,k;const e=ne(),{resourceType:t,id:n}=Ye(),r={reference:t+"/"+n},o=Dt(),[i,s]=p.useState(),l=st(r,s),c=Aq(t),[u,d]=p.useState(()=>{const I=window.location.pathname.split("/").pop();return I&&c.map(O=>O.toLowerCase()).includes(I)?I:c[0].toLowerCase()}),f=Pt();async function h(){var R,M;const O=(M=(R=(await e.readHistory(t,n)).entry)==null?void 0:R.find(N=>!!N.resource))==null?void 0:M.resource;O?m(O):le({color:"red",message:"No history to restore",autoClose:!1})}function m(I){e.updateResource(ws(I)).then(()=>{s(void 0),le({color:"green",message:"Success"})}).catch(O=>{le({color:"red",message:Te(O),autoClose:!1})})}if(i)return _O(i)?a.jsxs(xe,{children:[a.jsx(ce,{children:"Deleted"}),a.jsx("p",{children:"The resource was deleted."}),a.jsx(ee,{color:"red",onClick:h,children:"Restore"})]}):a.jsx(io,{outcome:i});function g(I){I||(I=c[0].toLowerCase()),d(I),o(`/${t}/${n}/${I}`)}function v(I){const O=l,R=O.orderDetail||[];R.length===0&&R.push({}),R[0].text!==I&&(R[0].text=I,m({...O,orderDetail:R}))}const b=l&&v0(l),x=l&&lH(l),y=(j=(S=(w=e.getUserConfiguration())==null?void 0:w.option)==null?void 0:S.find(I=>I.id==="statusValueSet"))==null?void 0:j.valueString;return a.jsxs(a.Fragment,{children:[(l==null?void 0:l.resourceType)==="ServiceRequest"&&y&&a.jsx(Rq,{valueSet:{reference:y},defaultValue:(P=(E=l.orderDetail)==null?void 0:E[0])==null?void 0:P.text,onChange:v},lt(l)+"-"+((k=(T=l.orderDetail)==null?void 0:T[0])==null?void 0:k.text)),l&&a.jsx(Eq,{value:l}),l&&a.jsxs(On,{children:[b&&a.jsx(Dk,{patient:b}),x&&a.jsx(Iq,{specimen:x}),t!=="Patient"&&a.jsx(_k,{resource:r}),a.jsx(hr,{children:a.jsx(We,{value:u.toLowerCase(),onChange:g,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:c.map(I=>a.jsx(We.Tab,{value:I.toLowerCase(),children:Nq.includes(I)?a.jsxs(Y,{gap:"xs",wrap:"nowrap",children:[I,a.jsx(mc,{color:f.primaryColor,size:"sm",children:"Beta"})]}):I},I))})})})]}),a.jsx(f0,{})]})}function Zw(){var x,y,w,S;const e=Dt(),{resourceType:t,id:n,versionId:r,tab:o}=Ye(),i=ne(),[s,l]=p.useState(!0),[c,u]=p.useState(),[d,f]=p.useState();if(p.useEffect(()=>{f(void 0),l(!0),i.readHistory(t,n).then(j=>u(j)).then(()=>l(!1)).catch(j=>{f(j),l(!1)})},[i,t,n]),s)return a.jsx(Ar,{});if(!c)return a.jsxs(xe,{children:[a.jsx(ce,{children:"Resource not found"}),a.jsx(Le,{to:`/${t}`,children:"Return to search page"})]});const h=c.entry,m=h.findIndex(j=>{var E,P;return((P=(E=j.resource)==null?void 0:E.meta)==null?void 0:P.versionId)===r});if(m===-1)return a.jsxs(xe,{children:[a.jsx(ce,{children:"Version not found"}),a.jsx(Le,{to:`/${t}/${n}`,children:"Return to resource"})]});const g=h[m].resource,v=m<h.length-1?h[m+1].resource:void 0,b="diff";return a.jsx(a.Fragment,{children:a.jsxs(We,{value:o||b,onChange:j=>e(`/${t}/${n}/_history/${r}/${j||b}`),children:[a.jsxs(On,{children:[a.jsx(_c,{fluid:!0,p:"md",children:a.jsx(ae,{children:`${t} ${n}`})}),a.jsxs(We.List,{children:[a.jsx(We.Tab,{value:"diff",children:"Diff"}),a.jsx(We.Tab,{value:"raw",children:"Raw"})]})]}),a.jsxs(xe,{children:[d&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(d,void 0,2)}),a.jsx(We.Panel,{value:"diff",children:v?a.jsxs(a.Fragment,{children:[a.jsxs("ul",{children:[a.jsxs("li",{children:["Current: ",(x=g.meta)==null?void 0:x.versionId]}),a.jsxs("li",{children:["Previous:"," ",a.jsx(Le,{to:`/${t}/${n}/_history/${(y=v.meta)==null?void 0:y.versionId}`,children:(w=v.meta)==null?void 0:w.versionId})]})]}),a.jsx(xU,{original:v,revised:g})]}):a.jsxs(a.Fragment,{children:[a.jsxs("ul",{children:[a.jsxs("li",{children:["Current: ",(S=g.meta)==null?void 0:S.versionId]}),a.jsx("li",{children:"Previous: (none)"})]}),a.jsx("pre",{children:JSON.stringify(g,void 0,2)})]})}),a.jsx(We.Panel,{value:"raw",children:a.jsx("pre",{children:JSON.stringify(g,void 0,2)})})]})]})})}function Mq(){const{resourceType:e,id:t}=Ye(),n=Dt(),[r,o]=p.useState({resourceType:"Subscription",filters:[{code:"url",operator:re.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(xe,{children:a.jsx(Oc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function eS(){const{resourceType:e,id:t}=Ye(),n={reference:e+"/"+t};switch(e){case"Encounter":return a.jsx(MF,{encounter:n});case"Patient":return a.jsx(zz,{patient:n});case"ServiceRequest":return a.jsx(EU,{serviceRequest:n});default:return a.jsx(OF,{resource:n})}}function $q(){const e=ne(),{id:t}=Ye(),n=p.useMemo(()=>({reference:"Agent/"+t}),[t]),[r,o]=p.useState(""),[i,s]=p.useState(),[l,c]=p.useState(!1),u=p.useRef(r);u.current=r;const d=p.useCallback(()=>{u.current!==""&&(c(!0),e.pushToAgent(n,u.current,"PING",Wt.PING,!0).then(f=>{s(f),c(!1)}).catch(f=>{c(!1),f.message==="Destination device not found"?le({color:"red",title:"Error",message:"Invalid IP entered",autoClose:!1}):f.message==="Timeout"&&le({color:"red",title:"Error",message:'"$push" operation timed out. Agent may be unreachable',autoClose:!1})}))},[e,n]);return a.jsxs(xe,{children:[a.jsx(ce,{children:"Ping from Agent"}),a.jsxs("div",{style:{marginBottom:10},children:["Agent: ",a.jsx(za,{value:n,link:!0})]}),a.jsx(Be,{onSubmit:d,children:a.jsx(dt.Wrapper,{label:"IP",children:a.jsx(dt,{name:"ip",onChange:f=>o(f.target.value),value:r})})}),a.jsx(ee,{mt:10,mb:20,type:"button",onClick:d,loading:l,leftSection:a.jsx(q7,{size:"1rem"}),children:"Ping"}),!l&&i&&a.jsxs(a.Fragment,{children:[a.jsx(ce,{order:5,children:"Last Ping"}),a.jsx("pre",{children:i})]})]})}function Lq(){return a.jsx(UV,{children:a.jsxs(de,{errorElement:a.jsx(nH,{}),children:[a.jsx(de,{path:"/signin",element:a.jsx(PH,{})}),a.jsx(de,{path:"/oauth",element:a.jsx(SH,{})}),a.jsx(de,{path:"/resetpassword",element:a.jsx(CH,{})}),a.jsx(de,{path:"/setpassword/:id/:secret",element:a.jsx(jH,{})}),a.jsx(de,{path:"/register",element:a.jsx(bH,{})}),a.jsx(de,{path:"/changepassword",element:a.jsx(ZW,{})}),a.jsx(de,{path:"/security",element:a.jsx(EH,{})}),a.jsx(de,{path:"/mfa",element:a.jsx(wH,{})}),a.jsx(de,{path:"/batch",element:a.jsx(XW,{})}),a.jsx(de,{path:"/bulk/:resourceType",element:a.jsx(JW,{})}),a.jsx(de,{path:"/smart",element:a.jsx(TH,{})}),a.jsx(de,{path:"/forms/:id",element:a.jsx(uH,{})}),a.jsx(de,{path:"/admin/super",element:a.jsx(zH,{})}),a.jsx(de,{path:"/admin/config",element:a.jsx(MH,{})}),a.jsxs(de,{path:"/admin",element:a.jsx($H,{}),children:[a.jsx(de,{path:"patients",element:a.jsx(OH,{})}),a.jsx(de,{path:"bots/new",element:a.jsx(IH,{})}),a.jsx(de,{path:"bots",element:a.jsx(kH,{})}),a.jsx(de,{path:"clients/new",element:a.jsx(DH,{})}),a.jsx(de,{path:"clients",element:a.jsx(RH,{})}),a.jsx(de,{path:"details",element:a.jsx(Yw,{})}),a.jsx(de,{path:"invite",element:a.jsx(NH,{})}),a.jsx(de,{path:"users",element:a.jsx(BH,{})}),a.jsx(de,{path:"project",element:a.jsx(Yw,{})}),a.jsx(de,{path:"secrets",element:a.jsx(LH,{})}),a.jsx(de,{path:"sites",element:a.jsx(FH,{})}),a.jsx(de,{path:"members/:membershipId",element:a.jsx(AH,{})})]}),a.jsx(de,{path:"/lab/assays",element:a.jsx(UH,{})}),a.jsx(de,{path:"/lab/panels",element:a.jsx(VH,{})}),a.jsx(de,{path:"/:resourceType/:id/_history/:versionId/:tab",element:a.jsx(Zw,{})}),a.jsx(de,{path:"/:resourceType/:id/_history/:versionId",element:a.jsx(Zw,{})}),a.jsxs(de,{path:"/:resourceType/new",element:a.jsx(tH,{}),children:[a.jsx(de,{index:!0,element:a.jsx(hp,{})}),a.jsx(de,{path:"form",element:a.jsx(hp,{})}),a.jsx(de,{path:"json",element:a.jsx(dq,{})}),a.jsx(de,{path:"profiles",element:a.jsx(hp,{})})]}),a.jsx(de,{path:"/Agent/:id/tools",element:a.jsx($q,{})}),a.jsxs(de,{path:"/:resourceType/:id",element:a.jsx(Oq,{}),children:[a.jsx(de,{index:!0,element:a.jsx(eS,{})}),a.jsx(de,{path:"apply",element:a.jsx(HH,{})}),a.jsx(de,{path:"apps",element:a.jsx(qH,{})}),a.jsx(de,{path:"event",element:a.jsx(QH,{})}),a.jsx(de,{path:"blame",element:a.jsx(KH,{})}),a.jsx(de,{path:"bots",element:a.jsx(gq,{})}),a.jsx(de,{path:"builder",element:a.jsx(iq,{})}),a.jsx(de,{path:"checklist",element:a.jsx(sq,{})}),a.jsx(de,{path:"delete",element:a.jsx(aq,{})}),a.jsx(de,{path:"details",element:a.jsx(lq,{})}),a.jsx(de,{path:"edit",element:a.jsx(cq,{})}),a.jsx(de,{path:"editor",element:a.jsx(nq,{})}),a.jsx(de,{path:"history",element:a.jsx(uq,{})}),a.jsx(de,{path:"json",element:a.jsx(fq,{})}),a.jsx(de,{path:"preview",element:a.jsx(hq,{})}),a.jsx(de,{path:"responses",element:a.jsx(yq,{})}),a.jsx(de,{path:"report",element:a.jsx(wq,{})}),a.jsx(de,{path:"ranges",element:a.jsx(xq,{})}),a.jsx(de,{path:"subscriptions",element:a.jsx(Mq,{})}),a.jsx(de,{path:"timeline",element:a.jsx(eS,{})}),a.jsx(de,{path:"profiles",element:a.jsx(pq,{})})]}),a.jsx(de,{path:"/:resourceType",element:a.jsx(Kw,{})}),a.jsx(de,{path:"/",element:a.jsx(Kw,{})})]})})}function Fq(){const e=ne(),t=e.getUserConfiguration(),n=$o(),[r]=h0();return e.isLoading()?a.jsx(Ar,{}):a.jsx(U6,{logo:a.jsx($r,{size:24}),pathname:n.pathname,searchParams:r,version:$L,menus:zq(t),displayAddBookmark:!!(t!=null&&t.id),children:a.jsx(p.Suspense,{fallback:a.jsx(Ar,{}),children:a.jsx(Lq,{})})})}function zq(e){var n;const t=((n=e==null?void 0:e.menu)==null?void 0:n.map(r=>{var o;return{title:r.title,links:((o=r.link)==null?void 0:o.map(i=>({label:i.name,href:i.target,icon:Bq(i.target)})))||[]}}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(N7,{})}]}),t}const tS={Patient:K7,Practitioner:D7,Organization:x7,ServiceRequest:V7,DiagnosticReport:H7,Questionnaire:I7,admin:g7,AccessPolicy:A7,Subscription:J7,batch:L7,Observation:$7};function Bq(e){try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in tS){const n=tS[t];return a.jsx(n,{})}}catch{}return a.jsx(Mf,{w:30})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.getRegistrations().then(e=>Promise.all(e.map(t=>t.unregister()))).catch(e=>console.error("SW registration failed: ",e))});async function Uq(){const e=Fc(),t=new RP({baseUrl:e.baseUrl,clientId:e.clientId,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=qV([{path:"*",element:a.jsx(Fq,{})}]),o=s=>r.navigate(s);nk(document.getElementById("root")).render(a.jsx(p.StrictMode,{children:a.jsx(XL,{medplum:t,navigate:o,children:a.jsxs(MS,{theme:n,children:[a.jsx(No,{position:"bottom-right"}),a.jsx(tW,{router:r})]})})}))}Uq().catch(console.error);
|
|
235
|
+
//# sourceMappingURL=index-DP_HRmCX.js.map
|