@medplum/app 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,235 +0,0 @@
1
- function Ow(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 e0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function km(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mw={exports:{}},Cd={},Lw={exports:{}},Ae={};/**
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 Jl=Symbol.for("react.element"),ok=Symbol.for("react.portal"),ik=Symbol.for("react.fragment"),sk=Symbol.for("react.strict_mode"),ak=Symbol.for("react.profiler"),lk=Symbol.for("react.provider"),ck=Symbol.for("react.context"),uk=Symbol.for("react.forward_ref"),dk=Symbol.for("react.suspense"),fk=Symbol.for("react.memo"),hk=Symbol.for("react.lazy"),t0=Symbol.iterator;function pk(e){return e===null||typeof e!="object"?null:(e=t0&&e[t0]||e["@@iterator"],typeof e=="function"?e:null)}var $w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Fw=Object.assign,zw={};function ba(e,t,n){this.props=e,this.context=t,this.refs=zw,this.updater=n||$w}ba.prototype.isReactComponent={};ba.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")};ba.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Bw(){}Bw.prototype=ba.prototype;function Rm(e,t,n){this.props=e,this.context=t,this.refs=zw,this.updater=n||$w}var Dm=Rm.prototype=new Bw;Dm.constructor=Rm;Fw(Dm,ba.prototype);Dm.isPureReactComponent=!0;var n0=Array.isArray,Uw=Object.prototype.hasOwnProperty,Im={current:null},Vw={key:!0,ref:!0,__self:!0,__source:!0};function Hw(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)Uw.call(t,r)&&!Vw.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:Jl,type:e,key:i,ref:s,props:o,_owner:Im.current}}function mk(e,t){return{$$typeof:Jl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function _m(e){return typeof e=="object"&&e!==null&&e.$$typeof===Jl}function gk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var r0=/\/+/g;function Zf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?gk(""+e.key):t.toString(36)}function cu(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 Jl:case ok:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+Zf(s,0):r,n0(o)?(n="",e!=null&&(n=e.replace(r0,"$&/")+"/"),cu(o,t,n,"",function(u){return u})):o!=null&&(_m(o)&&(o=mk(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(r0,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",n0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+Zf(i,l);s+=cu(i,t,n,c,o)}else if(c=pk(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+Zf(i,l++),s+=cu(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 Nc(e,t,n){if(e==null)return e;var r=[],o=0;return cu(e,r,"","",function(i){return t.call(n,i,o++)}),r}function yk(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 wn={current:null},uu={transition:null},vk={ReactCurrentDispatcher:wn,ReactCurrentBatchConfig:uu,ReactCurrentOwner:Im};Ae.Children={map:Nc,forEach:function(e,t,n){Nc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Nc(e,function(){t++}),t},toArray:function(e){return Nc(e,function(t){return t})||[]},only:function(e){if(!_m(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ae.Component=ba;Ae.Fragment=ik;Ae.Profiler=ak;Ae.PureComponent=Rm;Ae.StrictMode=sk;Ae.Suspense=dk;Ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vk;Ae.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=Fw({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Im.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Uw.call(t,c)&&!Vw.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:Jl,type:e.type,key:o,ref:i,props:r,_owner:s}};Ae.createContext=function(e){return e={$$typeof:ck,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:lk,_context:e},e.Consumer=e};Ae.createElement=Hw;Ae.createFactory=function(e){var t=Hw.bind(null,e);return t.type=e,t};Ae.createRef=function(){return{current:null}};Ae.forwardRef=function(e){return{$$typeof:uk,render:e}};Ae.isValidElement=_m;Ae.lazy=function(e){return{$$typeof:hk,_payload:{_status:-1,_result:e},_init:yk}};Ae.memo=function(e,t){return{$$typeof:fk,type:e,compare:t===void 0?null:t}};Ae.startTransition=function(e){var t=uu.transition;uu.transition={};try{e()}finally{uu.transition=t}};Ae.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Ae.useCallback=function(e,t){return wn.current.useCallback(e,t)};Ae.useContext=function(e){return wn.current.useContext(e)};Ae.useDebugValue=function(){};Ae.useDeferredValue=function(e){return wn.current.useDeferredValue(e)};Ae.useEffect=function(e,t){return wn.current.useEffect(e,t)};Ae.useId=function(){return wn.current.useId()};Ae.useImperativeHandle=function(e,t,n){return wn.current.useImperativeHandle(e,t,n)};Ae.useInsertionEffect=function(e,t){return wn.current.useInsertionEffect(e,t)};Ae.useLayoutEffect=function(e,t){return wn.current.useLayoutEffect(e,t)};Ae.useMemo=function(e,t){return wn.current.useMemo(e,t)};Ae.useReducer=function(e,t,n){return wn.current.useReducer(e,t,n)};Ae.useRef=function(e){return wn.current.useRef(e)};Ae.useState=function(e){return wn.current.useState(e)};Ae.useSyncExternalStore=function(e,t,n){return wn.current.useSyncExternalStore(e,t,n)};Ae.useTransition=function(){return wn.current.useTransition()};Ae.version="18.2.0";Lw.exports=Ae;var p=Lw.exports;const b=km(p),Am=Ow({__proto__:null,default:b},[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 xk=p,wk=Symbol.for("react.element"),Sk=Symbol.for("react.fragment"),bk=Object.prototype.hasOwnProperty,Ck=xk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,jk={key:!0,ref:!0,__self:!0,__source:!0};function Ww(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)bk.call(t,r)&&!jk.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:wk,type:e,key:i,ref:s,props:o,_owner:Ck.current}}Cd.Fragment=Sk;Cd.jsx=Ww;Cd.jsxs=Ww;Mw.exports=Cd;var a=Mw.exports,Hr=function(){return Hr=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},Hr.apply(this,arguments)};function qw(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 Ek(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 du="right-scroll-bar-position",fu="width-before-scroll-bar",Tk="with-scroll-bars-hidden",Pk="--removed-body-scroll-bar-size";function eh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function kk(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 o0=new WeakMap;function Rk(e,t){var n=kk(t||null,function(r){return e.forEach(function(o){return eh(o,r)})});return p.useLayoutEffect(function(){var r=o0.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(l){i.has(l)||eh(l,null)}),i.forEach(function(l){o.has(l)||eh(l,s)})}o0.set(n,e)},[e]),n}function Dk(e){return e}function Ik(e,t){t===void 0&&(t=Dk);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 _k(e){e===void 0&&(e={});var t=Ik(null);return t.options=Hr({async:!0,ssr:!1},e),t}var Gw=function(e){var t=e.sideCar,n=qw(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,Hr({},n))};Gw.isSideCarExport=!0;function Ak(e,t){return e.useMedium(t),Gw}var Qw=_k(),th=function(){},jd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:th,onWheelCapture:th,onTouchMoveCapture:th}),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,y=e.allowPinchZoom,C=e.as,v=C===void 0?"div":C,w=e.gapMode,x=qw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,E=Rk([n,t]),j=Hr(Hr({},x),o);return p.createElement(p.Fragment,null,d&&p.createElement(S,{sideCar:Qw,removeScrollBar:u,shards:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:w}),s?p.cloneElement(p.Children.only(l),Hr(Hr({},j),{ref:E})):p.createElement(v,Hr({},j,{className:c,ref:E}),l))});jd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};jd.classNames={fullWidth:fu,zeroRight:du};var Nk=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ok(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Nk();return t&&e.setAttribute("nonce",t),e}function Mk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Lk(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var $k=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ok())&&(Mk(t,n),Lk(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fk=function(){var e=$k();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Kw=function(){var e=Fk(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zk={left:0,top:0,right:0,gap:0},nh=function(e){return parseInt(e||"",10)||0},Bk=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[nh(n),nh(r),nh(o)]},Uk=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zk;var t=Bk(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])}},Vk=Kw(),Hk=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(Tk,` {
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(du,` {
36
- right: `).concat(l,"px ").concat(r,`;
37
- }
38
-
39
- .`).concat(fu,` {
40
- margin-right: `).concat(l,"px ").concat(r,`;
41
- }
42
-
43
- .`).concat(du," .").concat(du,` {
44
- right: 0 `).concat(r,`;
45
- }
46
-
47
- .`).concat(fu," .").concat(fu,` {
48
- margin-right: 0 `).concat(r,`;
49
- }
50
-
51
- body {
52
- `).concat(Pk,": ").concat(l,`px;
53
- }
54
- `)},Wk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=p.useMemo(function(){return Uk(o)},[o]);return p.createElement(Vk,{styles:Hk(i,!t,o,n?"":"!important")})},Jh=!1;if(typeof window<"u")try{var Oc=Object.defineProperty({},"passive",{get:function(){return Jh=!0,!0}});window.addEventListener("test",Oc,Oc),window.removeEventListener("test",Oc,Oc)}catch{Jh=!1}var Cs=Jh?{passive:!1}:!1,qk=function(e){return e.tagName==="TEXTAREA"},Yw=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qk(e)&&n[t]==="visible")},Gk=function(e){return Yw(e,"overflowY")},Qk=function(e){return Yw(e,"overflowX")},i0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Xw(e,r);if(o){var i=Jw(e,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Kk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Yk=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xw=function(e,t){return e==="v"?Gk(t):Qk(t)},Jw=function(e,t){return e==="v"?Kk(t):Yk(t)},Xk=function(e,t){return e==="h"&&t==="rtl"?-1:1},Jk=function(e,t,n,r,o){var i=Xk(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=Jw(e,l),g=m[0],y=m[1],C=m[2],v=y-C-i*g;(g||v)&&Xw(e,l)&&(f+=v,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},Mc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},s0=function(e){return[e.deltaX,e.deltaY]},a0=function(e){return e&&"current"in e?e.current:e},Zk=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e2=function(e){return`
55
- .block-interactivity-`.concat(e,` {pointer-events: none;}
56
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
57
- `)},t2=0,js=[];function n2(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(t2++)[0],i=p.useState(Kw)[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 y=Ek([e.lockRef.current],(e.shards||[]).map(a0),!0).filter(Boolean);return y.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(y,C){if("touches"in y&&y.touches.length===2)return!s.current.allowPinchZoom;var v=Mc(y),w=n.current,x="deltaX"in y?y.deltaX:w[0]-v[0],S="deltaY"in y?y.deltaY:w[1]-v[1],E,j=y.target,T=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in y&&T==="h"&&j.type==="range")return!1;var P=i0(T,j);if(!P)return!0;if(P?E=T:(E=T==="v"?"h":"v",P=i0(T,j)),!P)return!1;if(!r.current&&"changedTouches"in y&&(x||S)&&(r.current=E),!E)return!0;var R=r.current||E;return Jk(R,C,y,R==="h"?x:S,!0)},[]),c=p.useCallback(function(y){var C=y;if(!(!js.length||js[js.length-1]!==i)){var v="deltaY"in C?s0(C):Mc(C),w=t.current.filter(function(E){return E.name===C.type&&(E.target===C.target||C.target===E.shadowParent)&&Zk(E.delta,v)})[0];if(w&&w.should){C.cancelable&&C.preventDefault();return}if(!w){var x=(s.current.shards||[]).map(a0).filter(Boolean).filter(function(E){return E.contains(C.target)}),S=x.length>0?l(C,x[0]):!s.current.noIsolation;S&&C.cancelable&&C.preventDefault()}}},[]),u=p.useCallback(function(y,C,v,w){var x={name:y,delta:C,target:v,should:w,shadowParent:r2(v)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(S){return S!==x})},1)},[]),d=p.useCallback(function(y){n.current=Mc(y),r.current=void 0},[]),f=p.useCallback(function(y){u(y.type,s0(y),y.target,l(y,e.lockRef.current))},[]),h=p.useCallback(function(y){u(y.type,Mc(y),y.target,l(y,e.lockRef.current))},[]);p.useEffect(function(){return js.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Cs),document.addEventListener("touchmove",c,Cs),document.addEventListener("touchstart",d,Cs),function(){js=js.filter(function(y){return y!==i}),document.removeEventListener("wheel",c,Cs),document.removeEventListener("touchmove",c,Cs),document.removeEventListener("touchstart",d,Cs)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(i,{styles:e2(o)}):null,m?p.createElement(Wk,{gapMode:e.gapMode}):null)}function r2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const o2=Ak(Qw,n2);var Ed=p.forwardRef(function(e,t){return p.createElement(jd,Hr({},e,{ref:t,sideCar:o2}))});Ed.classNames=jd.classNames;function rt(e){return Object.keys(e)}function rh(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Nm(e,t){const n={...e},r=t;return rh(e)&&rh(t)&&Object.keys(t).forEach(o=>{rh(r[o])&&o in e?n[o]=Nm(n[o],r[o]):n[o]=r[o]}),n}function i2(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function s2(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 Zh(e){const t=s2(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 oh(e){return`calc(${e} * var(--mantine-scale))`}function Zw(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return"0";if(typeof r=="number"){const o=`${r/16}${e}`;return t?oh(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?oh(r):r;const o=r.replace("px","");if(!Number.isNaN(Number(o))){const i=`${Number(o)/16}${e}`;return t?oh(i):i}}return r}return n}const z=Zw("rem",{shouldScale:!0}),Du=Zw("em");function os(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function eS(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 bo(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==b.Fragment:!1}function Sn(e){const t=p.createContext(null);return[({children:o,value:i})=>b.createElement(t.Provider,{value:i},o),()=>{const o=p.useContext(t);if(o===null)throw new Error(e);return o}]}function Zl(e=null){const t=p.createContext(e);return[({children:o,value:i})=>b.createElement(t.Provider,{value:i},o),()=>p.useContext(t)]}function l0(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function Iu(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function a2(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 l2(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 c2(e,t,n){return Iu(e,n)===Iu(t,n)}function tS({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=Iu(l.currentTarget,e))==null?void 0:g.querySelectorAll(t))||[]).filter(y=>c2(l.currentTarget,y,e)),u=c.findIndex(y=>l.currentTarget===y),d=l2(u,c,r),f=a2(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 y=c.length-1;!c[y].disabled&&c[y].focus();break}}}}const u2={app:100,modal:200,popover:300,overlay:400,max:9999};function _r(e){return u2[e]}const d2=()=>{};function f2(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||d2:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function Ce(e,t="size",n=!0){if(e!==void 0)return eS(e)?n?z(e):e:`var(--${t}-${e})`}function Yt(e){return Ce(e,"mantine-spacing")}function ut(e){return e===void 0?"var(--mantine-radius-default)":Ce(e,"mantine-radius")}function Jt(e){return Ce(e,"mantine-font-size")}function nS(e){return Ce(e,"mantine-line-height",!1)}function Om(e){if(e)return Ce(e,"mantine-shadow",!1)}function zn(e,t){return n=>{e==null||e(n),t==null||t(n)}}function Mm(e,t){return e in t.breakpoints?Zh(t.breakpoints[e]):Zh(e)}function Cl(e,t){const n=e.map(r=>({value:r,px:Mm(r,t)}));return n.sort((r,o)=>r.px-o.px),n}function qo(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function h2(e,t,n){var r;return n?Array.from(((r=Iu(n,t))==null?void 0:r.querySelectorAll(e))||[]).findIndex(o=>o===n):null}function p2(){const[e,t]=p.useState(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}var m2={};function g2(){return typeof process<"u"&&m2?"production":"development"}function rS(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=rS(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function We(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=rS(e))&&(r&&(r+=" "),r+=t);return r}const y2={};function v2(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=We(t[r],o):t[r]=o})}),t}function Td({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||y2);return v2(i)}function _u({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},{})}function Lm(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function Mo(e,t){const n=t-e+1;return Array.from({length:n},(r,o)=>o+e)}function c0(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 Pd(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 u0=["mousedown","touchstart"];function x2(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||u0).forEach(i=>document.addEventListener(i,o)),()=>{(t||u0).forEach(i=>document.removeEventListener(i,o))}},[r,e,n]),r}function oS({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 w2(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function S2(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function b2(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=p.useState(n?t:S2(e,t)),i=p.useRef();return p.useEffect(()=>{if("matchMedia"in window)return i.current=window.matchMedia(e),o(i.current.matches),w2(i.current,s=>o(s.matches))},[e]),r}const Ca=typeof document<"u"?p.useLayoutEffect:p.useEffect;function uo(e,t){const n=p.useRef(!1);p.useEffect(()=>()=>{n.current=!1},[]),p.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function iS({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 uo(()=>{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 C2(e,t="body > :not(script)"){const n=Lm(),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 j2=/input|select|textarea|button|object/,sS="a, input, select, textarea, button, object, [tabindex]";function E2(e){return e.style.display==="none"}function T2(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(E2(n))return!1;n=n.parentNode}return!0}function aS(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function ep(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(aS(e));return(j2.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&T2(e)}function lS(e){const t=aS(e);return(Number.isNaN(t)||t>=0)&&ep(e)}function P2(e){return Array.from(e.querySelectorAll(sS)).filter(lS)}function k2(e,t){const n=P2(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 R2(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(sS));s=l.find(lS)||l.find(ep)||null,!s&&ep(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=C2(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&&k2(t.current,s)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i),n.current&&n.current()}},[e]),o}const D2=e=>(e+1)%1e6;function I2(){const[,e]=p.useReducer(D2,0);return e}const _2=b.useId||(()=>{});function A2(){const e=_2();return e?`mantine-${e.replace(/:/g,"")}`:""}function Ln(e){const t=A2(),[n,r]=p.useState(t);return Ca(()=>{r(Lm())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function cS(e,t,n){p.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function $m(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function N2(...e){return t=>{e.forEach(n=>$m(n,t))}}function nn(...e){return p.useCallback(N2(...e),e)}function vn({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,i]=p.useState(t!==void 0?t:n),s=l=>{i(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,s,!1]}const Lc="dots";function O2({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]=vn({value:r,onChange:i,defaultValue:o,finalValue:o}),u=y=>{y<=0?c(1):y>s?c(s):c(y)},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 Mo(1,s);const C=Math.max(l-t,n),v=Math.min(l+t,s-n),w=C>n+2,x=v<s-(n+1);if(!w&&x){const S=t*2+n+2;return[...Mo(1,S),Lc,...Mo(s-(n-1),s)]}if(w&&!x){const S=n+1+2*t;return[...Mo(1,n),Lc,...Mo(s-S,s)]}return[...Mo(1,n),Lc,...Mo(C,v),Lc,...Mo(s-n+1,s)]},[s,t,l]),active:l,setPage:u,next:d,previous:f,first:h,last:m}}function Fm(e,t){return b2("(prefers-reduced-motion: reduce)",e,t)}function M2(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}]}const uS=p.createContext(null);function kd(){const e=p.useContext(uS);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function L2(){return kd().cssVariablesResolver}function $2(){return kd().classNamesPrefix}function zm(){return kd().getStyleNonce}function F2(e){return/^#?([0-9A-F]{3}){1,2}$/i.test(e)}function z2(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("")}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 B2(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 U2(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 dS(e){return F2(e)?z2(e):e.startsWith("rgb")?B2(e):e.startsWith("hsl")?U2(e):{r:0,g:0,b:0,a:1}}function $c(e,t){if(e.startsWith("var("))return e;const{r:n,g:r,b:o,a:i}=dS(e),s=1-t,l=c=>Math.round(c*s);return`rgba(${l(n)}, ${l(r)}, ${l(o)}, ${i})`}function tp(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function li({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Instead got ${typeof e}`);if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,variable:`--mantine-color-${e}`};const[r,o]=e.split("."),i=o?Number(o):void 0,s=r in t.colors;return s?{color:r,value:i!==void 0?t.colors[r][i]:t.colors[r][tp(t,n||"light")],shade:i,isThemeColor:s,variable:o?`--mantine-color-${r}-${i}`:`--mantine-color-${r}-filled`}:{color:e,value:e,isThemeColor:s,shade:i,variable:void 0}}function gt(e,t){const n=li({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function np(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=gt(n.from,t),o=gt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function Kt(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";const{r:n,g:r,b:o}=dS(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const V2=({color:e,theme:t,variant:n,gradient:r})=>{const o=li({color:e,theme:t});if(n==="filled")return o.isThemeColor?o.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:"var(--mantine-color-white)",border:`${z(1)} solid transparent`}:{background:`var(--mantine-color-${o.color}-${o.shade})`,hover:`var(--mantine-color-${o.color}-${o.shade===9?8:o.shade+1})`,color:"var(--mantine-color-white)",border:`${z(1)} solid transparent`}:{background:e,hover:$c(e,.1),color:"var(--mantine-color-white)",border:`${z(1)} solid transparent`};if(n==="light"){if(o.isThemeColor){if(o.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 i=t.colors[o.color][o.shade];return{background:Kt(i,.1),hover:Kt(i,.12),color:`var(--mantine-color-${o.color}-${Math.min(o.shade,6)})`,border:`${z(1)} solid transparent`}}return{background:Kt(e,.1),hover:Kt(e,.12),color:e,border:`${z(1)} solid transparent`}}if(n==="outline")return o.isThemeColor?o.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:Kt(t.colors[o.color][o.shade],.05),color:`var(--mantine-color-${o.color}-${o.shade})`,border:`${z(1)} solid var(--mantine-color-${o.color}-${o.shade})`}:{background:"transparent",hover:Kt(e,.05),color:e,border:`${z(1)} solid ${e}`};if(n==="subtle"){if(o.isThemeColor){if(o.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 i=t.colors[o.color][o.shade];return{background:"transparent",hover:Kt(i,.12),color:`var(--mantine-color-${o.color}-${Math.min(o.shade,6)})`,border:`${z(1)} solid transparent`}}return{background:"transparent",hover:Kt(e,.12),color:e,border:`${z(1)} solid transparent`}}return n==="transparent"?o.isThemeColor?o.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-${o.color}-${Math.min(o.shade,6)})`,border:`${z(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${z(1)} solid transparent`}:n==="white"?o.isThemeColor?o.shade===void 0?{background:"var(--mantine-color-white)",hover:$c(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${z(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:$c(t.white,.01),color:`var(--mantine-color-${o.color}-${o.shade})`,border:`${z(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:$c(t.white,.01),color:e,border:`${z(1)} solid transparent`}:n==="gradient"?{background:np(r,t),hover:np(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)`}:{}},H2={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"]},d0="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",Bm={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:H2,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:V2,fontFamily:d0,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:d0,fontWeight:"700",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 f0(e){return e==="auto"||e==="dark"||e==="light"}function W2({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 f0(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&&f0(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const q2="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",h0="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function ih(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function p0(e){if(!(e.primaryColor in e.colors))throw new Error(q2);if(typeof e.primaryShade=="object"&&(!ih(e.primaryShade.dark)||!ih(e.primaryShade.light)))throw new Error(h0);if(typeof e.primaryShade=="number"&&!ih(e.primaryShade))throw new Error(h0)}function G2(e,t){var r;if(!t)return p0(e),e;const n=Nm(e,t);return t.fontFamily&&!((r=t.headings)!=null&&r.fontFamily)&&(n.headings.fontFamily=t.fontFamily),p0(n),n}const Um=p.createContext(null),Q2=()=>p.useContext(Um)||Bm;function _t(){const e=p.useContext(Um);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 fS({theme:e,children:t,inherit:n=!0}){const r=Q2(),o=p.useMemo(()=>G2(n?r:Bm,e),[e,r,n]);return b.createElement(Um.Provider,{value:o},t)}fS.displayName="@mantine/core/MantineThemeProvider";function K2(){const e=_t(),t=zm(),n=rt(e.breakpoints).reduce((r,o)=>{const i=Zh(e.breakpoints[o]);return`${r}@media (max-width: ${Du(i-.1)}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${Du(i)}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return b.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 ah(e,t){return(Array.isArray(e)?e:[e]).reduce((r,o)=>`${o}{${r}}`,t)}function Y2(e,t){const n=sh(e.variables),r=n?ah(t,n):"",o=sh(e.dark),i=o?ah(`${t}[data-mantine-color-scheme="dark"]`,o):"",s=sh(e.light),l=s?ah(`${t}[data-mantine-color-scheme="light"]`,s):"";return`${r}${i}${l}`}function Es(e,t,n){rt(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const hS=e=>{const t=tp(e,"dark"),n=tp(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-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-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-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)"}};Es(o.variables,e.breakpoints,"breakpoint"),Es(o.variables,e.spacing,"spacing"),Es(o.variables,e.fontSizes,"font-size"),Es(o.variables,e.lineHeights,"line-height"),Es(o.variables,e.shadows,"shadow"),Es(o.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((s,l)=>{o.variables[`--mantine-primary-color-${l}`]=`var(--mantine-color-${e.primaryColor}-${l})`}),rt(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`]=Kt(e.colors[s][n],.1),o.light[`--mantine-color-${s}-light-hover`]=Kt(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`]=Kt(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`]=Kt(e.colors[s][Math.max(0,t-2)],.15),o.dark[`--mantine-color-${s}-light-hover`]=Kt(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`]=Kt(e.colors[s][Math.max(t-4,0)],.05)});const i=e.headings.sizes;return rt(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 X2({theme:e,generator:t}){const n=hS(e),r=t==null?void 0:t(e);return r?Nm(n,r):n}const lh=hS(Bm);function J2(e){const t={variables:{},light:{},dark:{}};return rt(e.variables).forEach(n=>{lh.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),rt(e.light).forEach(n=>{lh.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),rt(e.dark).forEach(n=>{lh.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function Z2(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 pS({cssVariablesSelector:e}){const t=_t(),n=zm(),r=L2(),o=X2({theme:t,generator:r}),i=e===":root",s=i?J2(o):o,l=Y2(s,e);return l?b.createElement("style",{"data-mantine-styles":!0,nonce:n==null?void 0:n(),dangerouslySetInnerHTML:{__html:`${l}${i?"":Z2(e)}`}}):null}pS.displayName="@mantine/CssVariables";function eR(){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 za(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 tR({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||(za(d,n),s(d),e.set(d))},[e.set,l,r]),u=p.useCallback(()=>{s(t),za(t,n),e.clear()},[e.clear,t]);return p.useEffect(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),Ca(()=>{za(e.get(t),n)},[]),p.useEffect(()=>{var f;if(r)return za(r,n),()=>{};o.current=window.matchMedia("(prefers-color-scheme: dark)");const d=h=>{i==="auto"&&za(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 nR({respectReducedMotion:e,getRootElement:t}){Ca(()=>{var n;e&&((n=t())==null||n.setAttribute("data-respect-reduced-motion","true"))},[e])}eR();function mS({theme:e,children:t,getStyleNonce:n,withCssVariables:r=!0,cssVariablesSelector:o=":root",classNamesPrefix:i="mantine",colorSchemeManager:s=W2(),defaultColorScheme:l="light",getRootElement:c=()=>document.documentElement,cssVariablesResolver:u,forceColorScheme:d}){const{colorScheme:f,setColorScheme:h,clearColorScheme:m}=tR({defaultColorScheme:l,forceColorScheme:d,manager:s,getRootElement:c});return nR({respectReducedMotion:(e==null?void 0:e.respectReducedMotion)||!1,getRootElement:c}),b.createElement(uS.Provider,{value:{colorSchemeManager:s,colorScheme:f,setColorScheme:h,clearColorScheme:m,getRootElement:c,classNamesPrefix:i,getStyleNonce:n,cssVariablesResolver:u,cssVariablesSelector:o}},b.createElement(fS,{theme:e},r&&b.createElement(pS,{cssVariablesSelector:o}),b.createElement(K2,null),t))}mS.displayName="@mantine/core/MantineProvider";function Rd({classNames:e,styles:t,props:n,stylesCtx:r}){const o=_t();return{resolvedClassNames:Td({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:_u({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const rR={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function oR({theme:e,options:t,unstyled:n}){return We((t==null?void 0:t.focusable)&&!n&&(e.focusClassName||rR[e.focusRing]),(t==null?void 0:t.active)&&!n&&e.activeClassName)}function iR({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return Td({theme:o,classNames:n==null?void 0:n.classNames,props:(n==null?void 0:n.props)||r,stylesCtx:t})[e]}function sR({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return Td({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function aR({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function lR({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function cR({themeName:e,classNamesPrefix:t,selector:n}){return e.map(r=>`${t}-${r}-${n}`)}function uR({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(i=>{var s,l;return(l=Td({theme:t,classNames:(s=t.components[i])==null?void 0:s.classNames,props:r,stylesCtx:o}))==null?void 0:l[n]})}function dR({options:e,classes:t,selector:n,unstyled:r}){return e!=null&&e.variant&&!r?t[`${n}--${e.variant}`]:void 0}function fR({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 We(oR({theme:e,options:t,unstyled:l}),uR({theme:e,themeName:n,selector:r,props:d,stylesCtx:f}),dR({options:t,classes:s,selector:r,unstyled:l}),sR({selector:r,stylesCtx:f,theme:e,classNames:i,props:d}),iR({selector:r,stylesCtx:f,options:t,props:d,theme:e}),aR({rootSelector:u,selector:r,className:c}),lR({selector:r,classes:s,unstyled:l}),cR({themeName:n,classNamesPrefix:o,selector:r}),t==null?void 0:t.className)}function hR({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(i=>{var s;return _u({theme:e,styles:(s=e.components[i])==null?void 0:s.styles,props:n,stylesCtx:r})[o]}).reduce((i,s)=>({...i,...s}),{})}function rp({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...rp({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function pR(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...os(n[r])}}),t),{})}function mR({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:i,themeName:s}){var l;return(l=pR([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 gR({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:i,rootSelector:s,styles:l,style:c,vars:u,varsResolver:d}){return{...hR({theme:e,themeName:t,props:o,stylesCtx:i,selector:n}),..._u({theme:e,styles:l,props:o,stylesCtx:i})[n],..._u({theme:e,styles:r==null?void 0:r.styles,props:(r==null?void 0:r.props)||o,stylesCtx:i})[n],...mR({theme:e,props:o,stylesCtx:i,vars:u,varsResolver:d,selector:n,themeName:t}),...s===n?rp({style:c,theme:e}):null,...rp({style:r==null?void 0:r.style,theme:e})}}function ue({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=_t(),m=$2(),g=(Array.isArray(e)?e:[e]).filter(y=>y);return(y,C)=>({className:fR({theme:h,options:C,themeName:g,selector:y,classNamesPrefix:m,classNames:c,classes:t,unstyled:l,className:o,rootSelector:s,props:n,stylesCtx:r}),style:gR({theme:h,themeName:g,selector:y,options:C,props:n,stylesCtx:r,rootSelector:s,styles:u,style:i,vars:d,varsResolver:f})})}function V(e,t,n){var s;const r=_t(),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 rt(e).reduce((t,n)=>e[n]!==void 0?`${t}${i2(n)}:${e[n]};`:t,"").trim()}function yR({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 ja({selector:e,styles:t,media:n}){const r=zm();return b.createElement("style",{"data-mantine-styles":"inline",nonce:r==null?void 0:r(),dangerouslySetInnerHTML:{__html:yR({selector:e,styles:t,media:n})}})}function Co(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:y,c:C,opacity:v,ff:w,fz:x,fw:S,lts:E,ta:j,lh:T,fs:P,tt:R,td:I,w:O,miw:D,maw:N,h:L,mih:B,mah:F,bgsz:_,bgp:k,bgr:M,bga:W,pos:K,top:ie,left:ve,bottom:Ee,right:Ne,inset:je,display:Ue,hiddenFrom:dt,visibleFrom:ft,lightHidden:rn,darkHidden:Ge,...Nt}=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:y,c:C,opacity:v,ff:w,fz:x,fw:S,lts:E,ta:j,lh:T,fs:P,tt:R,td:I,w:O,miw:D,maw:N,h:L,mih:B,mah:F,bgsz:_,bgp:k,bgr:M,bga:W,pos:K,top:ie,left:ve,bottom:Ee,right:Ne,inset:je,display:Ue,hiddenFrom:dt,visibleFrom:ft,lightHidden:rn,darkHidden:Ge}),rest:Nt}}const vR={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:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",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"}};function xR(e,t){const n=li({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:n.variable?`var(${n.variable})`:n.color}function wR(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 SR(e){return e}function bR(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:e}function CR(e){return typeof e=="number"?z(e):e}function jR(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 ch={color:xR,fontSize:wR,spacing:jR,identity:SR,size:CR,lineHeight:bR};function g0(e){return e.replace("(min-width: ","").replace("em)","")}function ER({media:e,...t}){const r=Object.keys(e).sort((o,i)=>Number(g0(o))-Number(g0(i))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function TR(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function PR(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function kR(e){return typeof e=="object"&&e!==null?rt(e).filter(t=>t!=="base"):[]}function RR(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function gS({styleProps:e,data:t,theme:n}){return ER(rt(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=PR(e[o]);if(!TR(e[o]))return s.forEach(u=>{r.inlineStyles[u]=ch[i.type](l,n)}),r;r.hasResponsiveStyles=!0;const c=kR(e[o]);return s.forEach(u=>{l&&(r.styles[u]=ch[i.type](l,n)),c.forEach(d=>{const f=`(min-width: ${n.breakpoints[d]})`;r.media[f]={...r.media[f],[u]:ch[i.type](RR(e[o],d),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function ec(){return`__m__-${p.useId().replace(/:/g,"")}`}function yS(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...yS(r,t)}),{}):typeof e=="function"?e(t):e??{}}function vS(e){return e.startsWith("data-")?e:`data-${e}`}function DR(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[vS(n)]=e[n]),t},{})}function xS(e){return e?typeof e=="string"?{[vS(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...xS(n)}),{}):DR(e):null}function op(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...op(r,t)}),{}):typeof e=="function"?e(t):e??{}}function IR({theme:e,style:t,vars:n,styleProps:r}){const o=op(t,e),i=op(n,e);return{...o,...i,...r}}const wS=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=_t(),y=e||"div",{styleProps:C,rest:v}=Co(h),w=ec(),x=gS({styleProps:C,theme:g,data:vR}),S={ref:m,style:IR({theme:g,style:t,vars:n,styleProps:x.inlineStyles}),className:We(r,{[w]:x.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":d,[`mantine-hidden-from-${l}`]:l,[`mantine-visible-from-${c}`]:c}),"data-variant":o,"data-size":eS(s)?void 0:s||void 0,...xS(i),...v};return b.createElement(b.Fragment,null,x.hasResponsiveStyles&&b.createElement(ja,{selector:`.${w}`,styles:x.styles,media:x.media}),typeof f=="function"?f(S):b.createElement(y,{...S}))});wS.displayName="@mantine/core/Box";const q=wS;function SS(e){return e}function G(e){const t=p.forwardRef(e);return t.extend=SS,t}function un(e){const t=p.forwardRef(e);return t.extend=SS,t}const _R=p.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function Ea(){return p.useContext(_R)}var bS={exports:{}},Gn={},CS={exports:{}},jS={};/**
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(k,M){var W=k.length;k.push(M);e:for(;0<W;){var K=W-1>>>1,ie=k[K];if(0<o(ie,M))k[K]=M,k[W]=ie,W=K;else break e}}function n(k){return k.length===0?null:k[0]}function r(k){if(k.length===0)return null;var M=k[0],W=k.pop();if(W!==M){k[0]=W;e:for(var K=0,ie=k.length,ve=ie>>>1;K<ve;){var Ee=2*(K+1)-1,Ne=k[Ee],je=Ee+1,Ue=k[je];if(0>o(Ne,W))je<ie&&0>o(Ue,Ne)?(k[K]=Ue,k[je]=W,K=je):(k[K]=Ne,k[Ee]=W,K=Ee);else if(je<ie&&0>o(Ue,W))k[K]=Ue,k[je]=W,K=je;else break e}}return M}function o(k,M){var W=k.sortIndex-M.sortIndex;return W!==0?W:k.id-M.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,y=!1,C=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(k){for(var M=n(u);M!==null;){if(M.callback===null)r(u);else if(M.startTime<=k)r(u),M.sortIndex=M.expirationTime,t(c,M);else break;M=n(u)}}function S(k){if(y=!1,x(k),!g)if(n(c)!==null)g=!0,F(E);else{var M=n(u);M!==null&&_(S,M.startTime-k)}}function E(k,M){g=!1,y&&(y=!1,v(P),P=-1),m=!0;var W=h;try{for(x(M),f=n(c);f!==null&&(!(f.expirationTime>M)||k&&!O());){var K=f.callback;if(typeof K=="function"){f.callback=null,h=f.priorityLevel;var ie=K(f.expirationTime<=M);M=e.unstable_now(),typeof ie=="function"?f.callback=ie:f===n(c)&&r(c),x(M)}else r(c);f=n(c)}if(f!==null)var ve=!0;else{var Ee=n(u);Ee!==null&&_(S,Ee.startTime-M),ve=!1}return ve}finally{f=null,h=W,m=!1}}var j=!1,T=null,P=-1,R=5,I=-1;function O(){return!(e.unstable_now()-I<R)}function D(){if(T!==null){var k=e.unstable_now();I=k;var M=!0;try{M=T(!0,k)}finally{M?N():(j=!1,T=null)}}else j=!1}var N;if(typeof w=="function")N=function(){w(D)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,B=L.port2;L.port1.onmessage=D,N=function(){B.postMessage(null)}}else N=function(){C(D,0)};function F(k){T=k,j||(j=!0,N())}function _(k,M){P=C(function(){k(e.unstable_now())},M)}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(k){k.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,F(E))},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(k){switch(h){case 1:case 2:case 3:var M=3;break;default:M=h}var W=h;h=M;try{return k()}finally{h=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(k,M){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var W=h;h=k;try{return M()}finally{h=W}},e.unstable_scheduleCallback=function(k,M,W){var K=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?K+W:K):W=K,k){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=W+ie,k={id:d++,callback:M,priorityLevel:k,startTime:W,expirationTime:ie,sortIndex:-1},W>K?(k.sortIndex=W,t(u,k),n(c)===null&&k===n(u)&&(y?(v(P),P=-1):y=!0,_(S,W-K))):(k.sortIndex=ie,t(c,k),g||m||(g=!0,F(E))),k},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(k){var M=h;return function(){var W=h;h=M;try{return k.apply(this,arguments)}finally{h=W}}}})(jS);CS.exports=jS;var AR=CS.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 ES=p,Wn=AR;function Q(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 TS=new Set,jl={};function is(e,t){ra(e,t),ra(e+"Capture",t)}function ra(e,t){for(jl[e]=t,e=0;e<t.length;e++)TS.add(t[e])}var fo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ip=Object.prototype.hasOwnProperty,NR=/^[: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]*$/,y0={},v0={};function OR(e){return ip.call(v0,e)?!0:ip.call(y0,e)?!1:NR.test(e)?v0[e]=!0:(y0[e]=!0,!1)}function MR(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 LR(e,t,n,r){if(t===null||typeof t>"u"||MR(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 bn(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 en={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){en[e]=new bn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];en[t]=new bn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){en[e]=new bn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){en[e]=new bn(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){en[e]=new bn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){en[e]=new bn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){en[e]=new bn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){en[e]=new bn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){en[e]=new bn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Vm=/[\-:]([a-z])/g;function Hm(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(Vm,Hm);en[t]=new bn(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(Vm,Hm);en[t]=new bn(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(Vm,Hm);en[t]=new bn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){en[e]=new bn(e,1,!1,e.toLowerCase(),null,!1,!1)});en.xlinkHref=new bn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){en[e]=new bn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Wm(e,t,n,r){var o=en.hasOwnProperty(t)?en[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(LR(t,n,o,r)&&(n=null),r||o===null?OR(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 jo=ES.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Fc=Symbol.for("react.element"),_s=Symbol.for("react.portal"),As=Symbol.for("react.fragment"),qm=Symbol.for("react.strict_mode"),sp=Symbol.for("react.profiler"),PS=Symbol.for("react.provider"),kS=Symbol.for("react.context"),Gm=Symbol.for("react.forward_ref"),ap=Symbol.for("react.suspense"),lp=Symbol.for("react.suspense_list"),Qm=Symbol.for("react.memo"),Fo=Symbol.for("react.lazy"),RS=Symbol.for("react.offscreen"),x0=Symbol.iterator;function Ba(e){return e===null||typeof e!="object"?null:(e=x0&&e[x0]||e["@@iterator"],typeof e=="function"?e:null)}var wt=Object.assign,uh;function il(e){if(uh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);uh=t&&t[1]||""}return`
77
- `+uh+e}var dh=!1;function fh(e,t){if(!e||dh)return"";dh=!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{dh=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?il(e):""}function $R(e){switch(e.tag){case 5:return il(e.type);case 16:return il("Lazy");case 13:return il("Suspense");case 19:return il("SuspenseList");case 0:case 2:case 15:return e=fh(e.type,!1),e;case 11:return e=fh(e.type.render,!1),e;case 1:return e=fh(e.type,!0),e;default:return""}}function cp(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 As:return"Fragment";case _s:return"Portal";case sp:return"Profiler";case qm:return"StrictMode";case ap:return"Suspense";case lp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case kS:return(e.displayName||"Context")+".Consumer";case PS:return(e._context.displayName||"Context")+".Provider";case Gm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Qm:return t=e.displayName||null,t!==null?t:cp(e.type)||"Memo";case Fo:t=e._payload,e=e._init;try{return cp(e(t))}catch{}}return null}function FR(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 cp(t);case 8:return t===qm?"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 ci(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function DS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zR(e){var t=DS(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 zc(e){e._valueTracker||(e._valueTracker=zR(e))}function IS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=DS(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Au(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 up(e,t){var n=t.checked;return wt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function w0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ci(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 _S(e,t){t=t.checked,t!=null&&Wm(e,"checked",t,!1)}function dp(e,t){_S(e,t);var n=ci(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")?fp(e,t.type,n):t.hasOwnProperty("defaultValue")&&fp(e,t.type,ci(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function S0(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 fp(e,t,n){(t!=="number"||Au(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sl=Array.isArray;function Qs(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=""+ci(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 hp(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return wt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function b0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(sl(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ci(n)}}function AS(e,t){var n=ci(t.value),r=ci(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 C0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function NS(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 pp(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?NS(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Bc,OS=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(Bc=Bc||document.createElement("div"),Bc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Bc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function El(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fl={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},BR=["Webkit","ms","Moz","O"];Object.keys(fl).forEach(function(e){BR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fl[t]=fl[e]})});function MS(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fl.hasOwnProperty(e)&&fl[e]?(""+t).trim():t+"px"}function LS(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=MS(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var UR=wt({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 mp(e,t){if(t){if(UR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function gp(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 yp=null;function Km(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vp=null,Ks=null,Ys=null;function j0(e){if(e=rc(e)){if(typeof vp!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Nd(t),vp(e.stateNode,e.type,t))}}function $S(e){Ks?Ys?Ys.push(e):Ys=[e]:Ks=e}function FS(){if(Ks){var e=Ks,t=Ys;if(Ys=Ks=null,j0(e),t)for(e=0;e<t.length;e++)j0(t[e])}}function zS(e,t){return e(t)}function BS(){}var hh=!1;function US(e,t,n){if(hh)return e(t,n);hh=!0;try{return zS(e,t,n)}finally{hh=!1,(Ks!==null||Ys!==null)&&(BS(),FS())}}function Tl(e,t){var n=e.stateNode;if(n===null)return null;var r=Nd(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(Q(231,t,typeof n));return n}var xp=!1;if(fo)try{var Ua={};Object.defineProperty(Ua,"passive",{get:function(){xp=!0}}),window.addEventListener("test",Ua,Ua),window.removeEventListener("test",Ua,Ua)}catch{xp=!1}function VR(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 hl=!1,Nu=null,Ou=!1,wp=null,HR={onError:function(e){hl=!0,Nu=e}};function WR(e,t,n,r,o,i,s,l,c){hl=!1,Nu=null,VR.apply(HR,arguments)}function qR(e,t,n,r,o,i,s,l,c){if(WR.apply(this,arguments),hl){if(hl){var u=Nu;hl=!1,Nu=null}else throw Error(Q(198));Ou||(Ou=!0,wp=u)}}function ss(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 VS(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 E0(e){if(ss(e)!==e)throw Error(Q(188))}function GR(e){var t=e.alternate;if(!t){if(t=ss(e),t===null)throw Error(Q(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 E0(o),e;if(i===r)return E0(o),t;i=i.sibling}throw Error(Q(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(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function HS(e){return e=GR(e),e!==null?WS(e):null}function WS(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=WS(e);if(t!==null)return t;e=e.sibling}return null}var qS=Wn.unstable_scheduleCallback,T0=Wn.unstable_cancelCallback,QR=Wn.unstable_shouldYield,KR=Wn.unstable_requestPaint,Dt=Wn.unstable_now,YR=Wn.unstable_getCurrentPriorityLevel,Ym=Wn.unstable_ImmediatePriority,GS=Wn.unstable_UserBlockingPriority,Mu=Wn.unstable_NormalPriority,XR=Wn.unstable_LowPriority,QS=Wn.unstable_IdlePriority,Dd=null,Gr=null;function JR(e){if(Gr&&typeof Gr.onCommitFiberRoot=="function")try{Gr.onCommitFiberRoot(Dd,e,void 0,(e.current.flags&128)===128)}catch{}}var Er=Math.clz32?Math.clz32:tD,ZR=Math.log,eD=Math.LN2;function tD(e){return e>>>=0,e===0?32:31-(ZR(e)/eD|0)|0}var Uc=64,Vc=4194304;function al(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 Lu(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=al(l):(i&=s,i!==0&&(r=al(i)))}else s=n&~o,s!==0?r=al(s):i!==0&&(r=al(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-Er(t),o=1<<n,r|=e[n],t&=~o;return r}function nD(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 rD(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Er(i),l=1<<s,c=o[s];c===-1?(!(l&n)||l&r)&&(o[s]=nD(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Sp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function KS(){var e=Uc;return Uc<<=1,!(Uc&4194240)&&(Uc=64),e}function ph(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function tc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Er(t),e[t]=n}function oD(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-Er(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Xm(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Er(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var He=0;function YS(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var XS,Jm,JS,ZS,eb,bp=!1,Hc=[],Jo=null,Zo=null,ei=null,Pl=new Map,kl=new Map,Ho=[],iD="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 P0(e,t){switch(e){case"focusin":case"focusout":Jo=null;break;case"dragenter":case"dragleave":Zo=null;break;case"mouseover":case"mouseout":ei=null;break;case"pointerover":case"pointerout":Pl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kl.delete(t.pointerId)}}function Va(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=rc(t),t!==null&&Jm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function sD(e,t,n,r,o){switch(t){case"focusin":return Jo=Va(Jo,e,t,n,r,o),!0;case"dragenter":return Zo=Va(Zo,e,t,n,r,o),!0;case"mouseover":return ei=Va(ei,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Pl.set(i,Va(Pl.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,kl.set(i,Va(kl.get(i)||null,e,t,n,r,o)),!0}return!1}function tb(e){var t=Mi(e.target);if(t!==null){var n=ss(t);if(n!==null){if(t=n.tag,t===13){if(t=VS(n),t!==null){e.blockedOn=t,eb(e.priority,function(){JS(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 hu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yp=r,n.target.dispatchEvent(r),yp=null}else return t=rc(n),t!==null&&Jm(t),e.blockedOn=n,!1;t.shift()}return!0}function k0(e,t,n){hu(e)&&n.delete(t)}function aD(){bp=!1,Jo!==null&&hu(Jo)&&(Jo=null),Zo!==null&&hu(Zo)&&(Zo=null),ei!==null&&hu(ei)&&(ei=null),Pl.forEach(k0),kl.forEach(k0)}function Ha(e,t){e.blockedOn===t&&(e.blockedOn=null,bp||(bp=!0,Wn.unstable_scheduleCallback(Wn.unstable_NormalPriority,aD)))}function Rl(e){function t(o){return Ha(o,e)}if(0<Hc.length){Ha(Hc[0],e);for(var n=1;n<Hc.length;n++){var r=Hc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Jo!==null&&Ha(Jo,e),Zo!==null&&Ha(Zo,e),ei!==null&&Ha(ei,e),Pl.forEach(t),kl.forEach(t),n=0;n<Ho.length;n++)r=Ho[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ho.length&&(n=Ho[0],n.blockedOn===null);)tb(n),n.blockedOn===null&&Ho.shift()}var Xs=jo.ReactCurrentBatchConfig,$u=!0;function lD(e,t,n,r){var o=He,i=Xs.transition;Xs.transition=null;try{He=1,Zm(e,t,n,r)}finally{He=o,Xs.transition=i}}function cD(e,t,n,r){var o=He,i=Xs.transition;Xs.transition=null;try{He=4,Zm(e,t,n,r)}finally{He=o,Xs.transition=i}}function Zm(e,t,n,r){if($u){var o=Cp(e,t,n,r);if(o===null)jh(e,t,r,Fu,n),P0(e,r);else if(sD(o,e,t,n,r))r.stopPropagation();else if(P0(e,r),t&4&&-1<iD.indexOf(e)){for(;o!==null;){var i=rc(o);if(i!==null&&XS(i),i=Cp(e,t,n,r),i===null&&jh(e,t,r,Fu,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else jh(e,t,r,null,n)}}var Fu=null;function Cp(e,t,n,r){if(Fu=null,e=Km(r),e=Mi(e),e!==null)if(t=ss(e),t===null)e=null;else if(n=t.tag,n===13){if(e=VS(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 Fu=e,null}function nb(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(YR()){case Ym:return 1;case GS:return 4;case Mu:case XR:return 16;case QS:return 536870912;default:return 16}default:return 16}}var Go=null,eg=null,pu=null;function rb(){if(pu)return pu;var e,t=eg,n=t.length,r,o="value"in Go?Go.value:Go.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 pu=o.slice(e,1<r?1-r:void 0)}function mu(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 Wc(){return!0}function R0(){return!1}function Qn(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)?Wc:R0,this.isPropagationStopped=R0,this}return wt(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=Wc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Wc)},persist:function(){},isPersistent:Wc}),t}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tg=Qn(Ta),nc=wt({},Ta,{view:0,detail:0}),uD=Qn(nc),mh,gh,Wa,Id=wt({},nc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ng,button:0,buttons:0,relatedTarget:function(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!==Wa&&(Wa&&e.type==="mousemove"?(mh=e.screenX-Wa.screenX,gh=e.screenY-Wa.screenY):gh=mh=0,Wa=e),mh)},movementY:function(e){return"movementY"in e?e.movementY:gh}}),D0=Qn(Id),dD=wt({},Id,{dataTransfer:0}),fD=Qn(dD),hD=wt({},nc,{relatedTarget:0}),yh=Qn(hD),pD=wt({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),mD=Qn(pD),gD=wt({},Ta,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yD=Qn(gD),vD=wt({},Ta,{data:0}),I0=Qn(vD),xD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wD={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"},SD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bD(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=SD[e])?!!t[e]:!1}function ng(){return bD}var CD=wt({},nc,{key:function(e){if(e.key){var t=xD[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=mu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wD[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ng,charCode:function(e){return e.type==="keypress"?mu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?mu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),jD=Qn(CD),ED=wt({},Id,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_0=Qn(ED),TD=wt({},nc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ng}),PD=Qn(TD),kD=wt({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),RD=Qn(kD),DD=wt({},Id,{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}),ID=Qn(DD),_D=[9,13,27,32],rg=fo&&"CompositionEvent"in window,pl=null;fo&&"documentMode"in document&&(pl=document.documentMode);var AD=fo&&"TextEvent"in window&&!pl,ob=fo&&(!rg||pl&&8<pl&&11>=pl),A0=" ",N0=!1;function ib(e,t){switch(e){case"keyup":return _D.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ns=!1;function ND(e,t){switch(e){case"compositionend":return sb(t);case"keypress":return t.which!==32?null:(N0=!0,A0);case"textInput":return e=t.data,e===A0&&N0?null:e;default:return null}}function OD(e,t){if(Ns)return e==="compositionend"||!rg&&ib(e,t)?(e=rb(),pu=eg=Go=null,Ns=!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 ob&&t.locale!=="ko"?null:t.data;default:return null}}var MD={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 O0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!MD[e.type]:t==="textarea"}function ab(e,t,n,r){$S(r),t=zu(t,"onChange"),0<t.length&&(n=new tg("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ml=null,Dl=null;function LD(e){vb(e,0)}function _d(e){var t=Ls(e);if(IS(t))return e}function $D(e,t){if(e==="change")return t}var lb=!1;if(fo){var vh;if(fo){var xh="oninput"in document;if(!xh){var M0=document.createElement("div");M0.setAttribute("oninput","return;"),xh=typeof M0.oninput=="function"}vh=xh}else vh=!1;lb=vh&&(!document.documentMode||9<document.documentMode)}function L0(){ml&&(ml.detachEvent("onpropertychange",cb),Dl=ml=null)}function cb(e){if(e.propertyName==="value"&&_d(Dl)){var t=[];ab(t,Dl,e,Km(e)),US(LD,t)}}function FD(e,t,n){e==="focusin"?(L0(),ml=t,Dl=n,ml.attachEvent("onpropertychange",cb)):e==="focusout"&&L0()}function zD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _d(Dl)}function BD(e,t){if(e==="click")return _d(t)}function UD(e,t){if(e==="input"||e==="change")return _d(t)}function VD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kr=typeof Object.is=="function"?Object.is:VD;function Il(e,t){if(kr(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(!ip.call(t,o)||!kr(e[o],t[o]))return!1}return!0}function $0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function F0(e,t){var n=$0(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=$0(n)}}function ub(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ub(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function db(){for(var e=window,t=Au();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Au(e.document)}return t}function og(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 HD(e){var t=db(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ub(n.ownerDocument.documentElement,n)){if(r!==null&&og(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=F0(n,i);var s=F0(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 WD=fo&&"documentMode"in document&&11>=document.documentMode,Os=null,jp=null,gl=null,Ep=!1;function z0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ep||Os==null||Os!==Au(r)||(r=Os,"selectionStart"in r&&og(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}),gl&&Il(gl,r)||(gl=r,r=zu(jp,"onSelect"),0<r.length&&(t=new tg("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Os)))}function qc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ms={animationend:qc("Animation","AnimationEnd"),animationiteration:qc("Animation","AnimationIteration"),animationstart:qc("Animation","AnimationStart"),transitionend:qc("Transition","TransitionEnd")},wh={},fb={};fo&&(fb=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);function Ad(e){if(wh[e])return wh[e];if(!Ms[e])return e;var t=Ms[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in fb)return wh[e]=t[n];return e}var hb=Ad("animationend"),pb=Ad("animationiteration"),mb=Ad("animationstart"),gb=Ad("transitionend"),yb=new Map,B0="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 gi(e,t){yb.set(e,t),is(t,[e])}for(var Sh=0;Sh<B0.length;Sh++){var bh=B0[Sh],qD=bh.toLowerCase(),GD=bh[0].toUpperCase()+bh.slice(1);gi(qD,"on"+GD)}gi(hb,"onAnimationEnd");gi(pb,"onAnimationIteration");gi(mb,"onAnimationStart");gi("dblclick","onDoubleClick");gi("focusin","onFocus");gi("focusout","onBlur");gi(gb,"onTransitionEnd");ra("onMouseEnter",["mouseout","mouseover"]);ra("onMouseLeave",["mouseout","mouseover"]);ra("onPointerEnter",["pointerout","pointerover"]);ra("onPointerLeave",["pointerout","pointerover"]);is("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));is("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));is("onBeforeInput",["compositionend","keypress","textInput","paste"]);is("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));is("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));is("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ll="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(" "),QD=new Set("cancel close invalid load scroll toggle".split(" ").concat(ll));function U0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,qR(r,t,void 0,e),e.currentTarget=null}function vb(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;U0(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;U0(o,l,u),i=c}}}if(Ou)throw e=wp,Ou=!1,wp=null,e}function it(e,t){var n=t[Dp];n===void 0&&(n=t[Dp]=new Set);var r=e+"__bubble";n.has(r)||(xb(t,e,2,!1),n.add(r))}function Ch(e,t,n){var r=0;t&&(r|=4),xb(n,e,r,t)}var Gc="_reactListening"+Math.random().toString(36).slice(2);function _l(e){if(!e[Gc]){e[Gc]=!0,TS.forEach(function(n){n!=="selectionchange"&&(QD.has(n)||Ch(n,!1,e),Ch(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Gc]||(t[Gc]=!0,Ch("selectionchange",!1,t))}}function xb(e,t,n,r){switch(nb(t)){case 1:var o=lD;break;case 4:o=cD;break;default:o=Zm}n=o.bind(null,t,n,e),o=void 0,!xp||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 jh(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}US(function(){var u=i,d=Km(n),f=[];e:{var h=yb.get(e);if(h!==void 0){var m=tg,g=e;switch(e){case"keypress":if(mu(n)===0)break e;case"keydown":case"keyup":m=jD;break;case"focusin":g="focus",m=yh;break;case"focusout":g="blur",m=yh;break;case"beforeblur":case"afterblur":m=yh;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=D0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=fD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=PD;break;case hb:case pb:case mb:m=mD;break;case gb:m=RD;break;case"scroll":m=uD;break;case"wheel":m=ID;break;case"copy":case"cut":case"paste":m=yD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=_0}var y=(t&4)!==0,C=!y&&e==="scroll",v=y?h!==null?h+"Capture":null:h;y=[];for(var w=u,x;w!==null;){x=w;var S=x.stateNode;if(x.tag===5&&S!==null&&(x=S,v!==null&&(S=Tl(w,v),S!=null&&y.push(Al(w,S,x)))),C)break;w=w.return}0<y.length&&(h=new m(h,g,null,n,d),f.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==yp&&(g=n.relatedTarget||n.fromElement)&&(Mi(g)||g[ho]))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&&(C=ss(g),g!==C||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(y=D0,S="onMouseLeave",v="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(y=_0,S="onPointerLeave",v="onPointerEnter",w="pointer"),C=m==null?h:Ls(m),x=g==null?h:Ls(g),h=new y(S,w+"leave",m,n,d),h.target=C,h.relatedTarget=x,S=null,Mi(d)===u&&(y=new y(v,w+"enter",g,n,d),y.target=x,y.relatedTarget=C,S=y),C=S,m&&g)t:{for(y=m,v=g,w=0,x=y;x;x=Ts(x))w++;for(x=0,S=v;S;S=Ts(S))x++;for(;0<w-x;)y=Ts(y),w--;for(;0<x-w;)v=Ts(v),x--;for(;w--;){if(y===v||v!==null&&y===v.alternate)break t;y=Ts(y),v=Ts(v)}y=null}else y=null;m!==null&&V0(f,h,m,y,!1),g!==null&&C!==null&&V0(f,C,g,y,!0)}}e:{if(h=u?Ls(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var E=$D;else if(O0(h))if(lb)E=UD;else{E=zD;var j=FD}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(E=BD);if(E&&(E=E(e,u))){ab(f,E,n,d);break e}j&&j(e,h,u),e==="focusout"&&(j=h._wrapperState)&&j.controlled&&h.type==="number"&&fp(h,"number",h.value)}switch(j=u?Ls(u):window,e){case"focusin":(O0(j)||j.contentEditable==="true")&&(Os=j,jp=u,gl=null);break;case"focusout":gl=jp=Os=null;break;case"mousedown":Ep=!0;break;case"contextmenu":case"mouseup":case"dragend":Ep=!1,z0(f,n,d);break;case"selectionchange":if(WD)break;case"keydown":case"keyup":z0(f,n,d)}var T;if(rg)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Ns?ib(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(ob&&n.locale!=="ko"&&(Ns||P!=="onCompositionStart"?P==="onCompositionEnd"&&Ns&&(T=rb()):(Go=d,eg="value"in Go?Go.value:Go.textContent,Ns=!0)),j=zu(u,P),0<j.length&&(P=new I0(P,e,null,n,d),f.push({event:P,listeners:j}),T?P.data=T:(T=sb(n),T!==null&&(P.data=T)))),(T=AD?ND(e,n):OD(e,n))&&(u=zu(u,"onBeforeInput"),0<u.length&&(d=new I0("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=T))}vb(f,t)})}function Al(e,t,n){return{instance:e,listener:t,currentTarget:n}}function zu(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Tl(e,n),i!=null&&r.unshift(Al(e,i,o)),i=Tl(e,t),i!=null&&r.push(Al(e,i,o))),e=e.return}return r}function Ts(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function V0(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=Tl(n,i),c!=null&&s.unshift(Al(n,c,l))):o||(c=Tl(n,i),c!=null&&s.push(Al(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var KD=/\r\n?/g,YD=/\u0000|\uFFFD/g;function H0(e){return(typeof e=="string"?e:""+e).replace(KD,`
81
- `).replace(YD,"")}function Qc(e,t,n){if(t=H0(t),H0(e)!==t&&n)throw Error(Q(425))}function Bu(){}var Tp=null,Pp=null;function kp(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 Rp=typeof setTimeout=="function"?setTimeout:void 0,XD=typeof clearTimeout=="function"?clearTimeout:void 0,W0=typeof Promise=="function"?Promise:void 0,JD=typeof queueMicrotask=="function"?queueMicrotask:typeof W0<"u"?function(e){return W0.resolve(null).then(e).catch(ZD)}:Rp;function ZD(e){setTimeout(function(){throw e})}function Eh(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),Rl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Rl(t)}function ti(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 q0(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 Pa=Math.random().toString(36).slice(2),Wr="__reactFiber$"+Pa,Nl="__reactProps$"+Pa,ho="__reactContainer$"+Pa,Dp="__reactEvents$"+Pa,eI="__reactListeners$"+Pa,tI="__reactHandles$"+Pa;function Mi(e){var t=e[Wr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ho]||n[Wr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=q0(e);e!==null;){if(n=e[Wr])return n;e=q0(e)}return t}e=n,n=e.parentNode}return null}function rc(e){return e=e[Wr]||e[ho],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ls(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function Nd(e){return e[Nl]||null}var Ip=[],$s=-1;function yi(e){return{current:e}}function lt(e){0>$s||(e.current=Ip[$s],Ip[$s]=null,$s--)}function nt(e,t){$s++,Ip[$s]=e.current,e.current=t}var ui={},cn=yi(ui),Rn=yi(!1),Wi=ui;function oa(e,t){var n=e.type.contextTypes;if(!n)return ui;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 Dn(e){return e=e.childContextTypes,e!=null}function Uu(){lt(Rn),lt(cn)}function G0(e,t,n){if(cn.current!==ui)throw Error(Q(168));nt(cn,t),nt(Rn,n)}function wb(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(Q(108,FR(e)||"Unknown",o));return wt({},n,r)}function Vu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ui,Wi=cn.current,nt(cn,e),nt(Rn,Rn.current),!0}function Q0(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=wb(e,t,Wi),r.__reactInternalMemoizedMergedChildContext=e,lt(Rn),lt(cn),nt(cn,e)):lt(Rn),nt(Rn,n)}var oo=null,Od=!1,Th=!1;function Sb(e){oo===null?oo=[e]:oo.push(e)}function nI(e){Od=!0,Sb(e)}function vi(){if(!Th&&oo!==null){Th=!0;var e=0,t=He;try{var n=oo;for(He=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}oo=null,Od=!1}catch(o){throw oo!==null&&(oo=oo.slice(e+1)),qS(Ym,vi),o}finally{He=t,Th=!1}}return null}var Fs=[],zs=0,Hu=null,Wu=0,tr=[],nr=0,qi=null,io=1,so="";function Di(e,t){Fs[zs++]=Wu,Fs[zs++]=Hu,Hu=e,Wu=t}function bb(e,t,n){tr[nr++]=io,tr[nr++]=so,tr[nr++]=qi,qi=e;var r=io;e=so;var o=32-Er(r)-1;r&=~(1<<o),n+=1;var i=32-Er(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,io=1<<32-Er(t)+o|n<<o|r,so=i+e}else io=1<<i|n<<o|r,so=e}function ig(e){e.return!==null&&(Di(e,1),bb(e,1,0))}function sg(e){for(;e===Hu;)Hu=Fs[--zs],Fs[zs]=null,Wu=Fs[--zs],Fs[zs]=null;for(;e===qi;)qi=tr[--nr],tr[nr]=null,so=tr[--nr],tr[nr]=null,io=tr[--nr],tr[nr]=null}var Vn=null,Bn=null,pt=!1,Cr=null;function Cb(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 K0(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,Vn=e,Bn=ti(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Vn=e,Bn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=qi!==null?{id:io,overflow:so}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Vn=e,Bn=null,!0):!1;default:return!1}}function _p(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ap(e){if(pt){var t=Bn;if(t){var n=t;if(!K0(e,t)){if(_p(e))throw Error(Q(418));t=ti(n.nextSibling);var r=Vn;t&&K0(e,t)?Cb(r,n):(e.flags=e.flags&-4097|2,pt=!1,Vn=e)}}else{if(_p(e))throw Error(Q(418));e.flags=e.flags&-4097|2,pt=!1,Vn=e}}}function Y0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Vn=e}function Kc(e){if(e!==Vn)return!1;if(!pt)return Y0(e),pt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!kp(e.type,e.memoizedProps)),t&&(t=Bn)){if(_p(e))throw jb(),Error(Q(418));for(;t;)Cb(e,t),t=ti(t.nextSibling)}if(Y0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Bn=ti(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Bn=null}}else Bn=Vn?ti(e.stateNode.nextSibling):null;return!0}function jb(){for(var e=Bn;e;)e=ti(e.nextSibling)}function ia(){Bn=Vn=null,pt=!1}function ag(e){Cr===null?Cr=[e]:Cr.push(e)}var rI=jo.ReactCurrentBatchConfig;function wr(e,t){if(e&&e.defaultProps){t=wt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}var qu=yi(null),Gu=null,Bs=null,lg=null;function cg(){lg=Bs=Gu=null}function ug(e){var t=qu.current;lt(qu),e._currentValue=t}function Np(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 Js(e,t){Gu=e,lg=Bs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(kn=!0),e.firstContext=null)}function sr(e){var t=e._currentValue;if(lg!==e)if(e={context:e,memoizedValue:t,next:null},Bs===null){if(Gu===null)throw Error(Q(308));Bs=e,Gu.dependencies={lanes:0,firstContext:e}}else Bs=Bs.next=e;return t}var Li=null;function dg(e){Li===null?Li=[e]:Li.push(e)}function Eb(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,dg(t)):(n.next=o.next,o.next=n),t.interleaved=n,po(e,r)}function po(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 zo=!1;function fg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tb(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 ao(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ni(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Be&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,po(e,n)}return o=r.interleaved,o===null?(t.next=t,dg(r)):(t.next=o.next,o.next=t),r.interleaved=t,po(e,n)}function gu(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,Xm(e,n)}}function X0(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 Qu(e,t,n,r){var o=e.updateQueue;zo=!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,y=l;switch(h=t,m=n,y.tag){case 1:if(g=y.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=y.payload,h=typeof g=="function"?g.call(m,f,h):g,h==null)break e;f=wt({},f,h);break e;case 2:zo=!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 J0(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(Q(191,o));o.call(r)}}}var Pb=new ES.Component().refs;function Op(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:wt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Md={isMounted:function(e){return(e=e._reactInternals)?ss(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gn(),o=oi(e),i=ao(r,o);i.payload=t,n!=null&&(i.callback=n),t=ni(e,i,o),t!==null&&(Tr(t,e,o,r),gu(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gn(),o=oi(e),i=ao(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ni(e,i,o),t!==null&&(Tr(t,e,o,r),gu(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gn(),r=oi(e),o=ao(n,r);o.tag=2,t!=null&&(o.callback=t),t=ni(e,o,r),t!==null&&(Tr(t,e,r,n),gu(t,e,r))}};function Z0(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?!Il(n,r)||!Il(o,i):!0}function kb(e,t,n){var r=!1,o=ui,i=t.contextType;return typeof i=="object"&&i!==null?i=sr(i):(o=Dn(t)?Wi:cn.current,r=t.contextTypes,i=(r=r!=null)?oa(e,o):ui),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Md,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function ex(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&&Md.enqueueReplaceState(t,t.state,null)}function Mp(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=Pb,fg(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=sr(i):(i=Dn(t)?Wi:cn.current,o.context=oa(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Op(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&&Md.enqueueReplaceState(o,o.state,null),Qu(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function qa(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(Q(309));var r=n.stateNode}if(!r)throw Error(Q(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===Pb&&(l=o.refs={}),s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function Yc(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function tx(e){var t=e._init;return t(e._payload)}function Rb(e){function t(v,w){if(e){var x=v.deletions;x===null?(v.deletions=[w],v.flags|=16):x.push(w)}}function n(v,w){if(!e)return null;for(;w!==null;)t(v,w),w=w.sibling;return null}function r(v,w){for(v=new Map;w!==null;)w.key!==null?v.set(w.key,w):v.set(w.index,w),w=w.sibling;return v}function o(v,w){return v=ii(v,w),v.index=0,v.sibling=null,v}function i(v,w,x){return v.index=x,e?(x=v.alternate,x!==null?(x=x.index,x<w?(v.flags|=2,w):x):(v.flags|=2,w)):(v.flags|=1048576,w)}function s(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,w,x,S){return w===null||w.tag!==6?(w=Ah(x,v.mode,S),w.return=v,w):(w=o(w,x),w.return=v,w)}function c(v,w,x,S){var E=x.type;return E===As?d(v,w,x.props.children,S,x.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Fo&&tx(E)===w.type)?(S=o(w,x.props),S.ref=qa(v,w,x),S.return=v,S):(S=bu(x.type,x.key,x.props,null,v.mode,S),S.ref=qa(v,w,x),S.return=v,S)}function u(v,w,x,S){return w===null||w.tag!==4||w.stateNode.containerInfo!==x.containerInfo||w.stateNode.implementation!==x.implementation?(w=Nh(x,v.mode,S),w.return=v,w):(w=o(w,x.children||[]),w.return=v,w)}function d(v,w,x,S,E){return w===null||w.tag!==7?(w=Vi(x,v.mode,S,E),w.return=v,w):(w=o(w,x),w.return=v,w)}function f(v,w,x){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Ah(""+w,v.mode,x),w.return=v,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Fc:return x=bu(w.type,w.key,w.props,null,v.mode,x),x.ref=qa(v,null,w),x.return=v,x;case _s:return w=Nh(w,v.mode,x),w.return=v,w;case Fo:var S=w._init;return f(v,S(w._payload),x)}if(sl(w)||Ba(w))return w=Vi(w,v.mode,x,null),w.return=v,w;Yc(v,w)}return null}function h(v,w,x,S){var E=w!==null?w.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return E!==null?null:l(v,w,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Fc:return x.key===E?c(v,w,x,S):null;case _s:return x.key===E?u(v,w,x,S):null;case Fo:return E=x._init,h(v,w,E(x._payload),S)}if(sl(x)||Ba(x))return E!==null?null:d(v,w,x,S,null);Yc(v,x)}return null}function m(v,w,x,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return v=v.get(x)||null,l(w,v,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Fc:return v=v.get(S.key===null?x:S.key)||null,c(w,v,S,E);case _s:return v=v.get(S.key===null?x:S.key)||null,u(w,v,S,E);case Fo:var j=S._init;return m(v,w,x,j(S._payload),E)}if(sl(S)||Ba(S))return v=v.get(x)||null,d(w,v,S,E,null);Yc(w,S)}return null}function g(v,w,x,S){for(var E=null,j=null,T=w,P=w=0,R=null;T!==null&&P<x.length;P++){T.index>P?(R=T,T=null):R=T.sibling;var I=h(v,T,x[P],S);if(I===null){T===null&&(T=R);break}e&&T&&I.alternate===null&&t(v,T),w=i(I,w,P),j===null?E=I:j.sibling=I,j=I,T=R}if(P===x.length)return n(v,T),pt&&Di(v,P),E;if(T===null){for(;P<x.length;P++)T=f(v,x[P],S),T!==null&&(w=i(T,w,P),j===null?E=T:j.sibling=T,j=T);return pt&&Di(v,P),E}for(T=r(v,T);P<x.length;P++)R=m(T,v,P,x[P],S),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?P:R.key),w=i(R,w,P),j===null?E=R:j.sibling=R,j=R);return e&&T.forEach(function(O){return t(v,O)}),pt&&Di(v,P),E}function y(v,w,x,S){var E=Ba(x);if(typeof E!="function")throw Error(Q(150));if(x=E.call(x),x==null)throw Error(Q(151));for(var j=E=null,T=w,P=w=0,R=null,I=x.next();T!==null&&!I.done;P++,I=x.next()){T.index>P?(R=T,T=null):R=T.sibling;var O=h(v,T,I.value,S);if(O===null){T===null&&(T=R);break}e&&T&&O.alternate===null&&t(v,T),w=i(O,w,P),j===null?E=O:j.sibling=O,j=O,T=R}if(I.done)return n(v,T),pt&&Di(v,P),E;if(T===null){for(;!I.done;P++,I=x.next())I=f(v,I.value,S),I!==null&&(w=i(I,w,P),j===null?E=I:j.sibling=I,j=I);return pt&&Di(v,P),E}for(T=r(v,T);!I.done;P++,I=x.next())I=m(T,v,P,I.value,S),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?P:I.key),w=i(I,w,P),j===null?E=I:j.sibling=I,j=I);return e&&T.forEach(function(D){return t(v,D)}),pt&&Di(v,P),E}function C(v,w,x,S){if(typeof x=="object"&&x!==null&&x.type===As&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Fc:e:{for(var E=x.key,j=w;j!==null;){if(j.key===E){if(E=x.type,E===As){if(j.tag===7){n(v,j.sibling),w=o(j,x.props.children),w.return=v,v=w;break e}}else if(j.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Fo&&tx(E)===j.type){n(v,j.sibling),w=o(j,x.props),w.ref=qa(v,j,x),w.return=v,v=w;break e}n(v,j);break}else t(v,j);j=j.sibling}x.type===As?(w=Vi(x.props.children,v.mode,S,x.key),w.return=v,v=w):(S=bu(x.type,x.key,x.props,null,v.mode,S),S.ref=qa(v,w,x),S.return=v,v=S)}return s(v);case _s:e:{for(j=x.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===x.containerInfo&&w.stateNode.implementation===x.implementation){n(v,w.sibling),w=o(w,x.children||[]),w.return=v,v=w;break e}else{n(v,w);break}else t(v,w);w=w.sibling}w=Nh(x,v.mode,S),w.return=v,v=w}return s(v);case Fo:return j=x._init,C(v,w,j(x._payload),S)}if(sl(x))return g(v,w,x,S);if(Ba(x))return y(v,w,x,S);Yc(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,w!==null&&w.tag===6?(n(v,w.sibling),w=o(w,x),w.return=v,v=w):(n(v,w),w=Ah(x,v.mode,S),w.return=v,v=w),s(v)):n(v,w)}return C}var sa=Rb(!0),Db=Rb(!1),oc={},Qr=yi(oc),Ol=yi(oc),Ml=yi(oc);function $i(e){if(e===oc)throw Error(Q(174));return e}function hg(e,t){switch(nt(Ml,t),nt(Ol,e),nt(Qr,oc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pp(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=pp(t,e)}lt(Qr),nt(Qr,t)}function aa(){lt(Qr),lt(Ol),lt(Ml)}function Ib(e){$i(Ml.current);var t=$i(Qr.current),n=pp(t,e.type);t!==n&&(nt(Ol,e),nt(Qr,n))}function pg(e){Ol.current===e&&(lt(Qr),lt(Ol))}var vt=yi(0);function Ku(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 Ph=[];function mg(){for(var e=0;e<Ph.length;e++)Ph[e]._workInProgressVersionPrimary=null;Ph.length=0}var yu=jo.ReactCurrentDispatcher,kh=jo.ReactCurrentBatchConfig,Gi=0,xt=null,Mt=null,zt=null,Yu=!1,yl=!1,Ll=0,oI=0;function on(){throw Error(Q(321))}function gg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kr(e[n],t[n]))return!1;return!0}function yg(e,t,n,r,o,i){if(Gi=i,xt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,yu.current=e===null||e.memoizedState===null?lI:cI,e=n(r,o),yl){i=0;do{if(yl=!1,Ll=0,25<=i)throw Error(Q(301));i+=1,zt=Mt=null,t.updateQueue=null,yu.current=uI,e=n(r,o)}while(yl)}if(yu.current=Xu,t=Mt!==null&&Mt.next!==null,Gi=0,zt=Mt=xt=null,Yu=!1,t)throw Error(Q(300));return e}function vg(){var e=Ll!==0;return Ll=0,e}function Ur(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?xt.memoizedState=zt=e:zt=zt.next=e,zt}function ar(){if(Mt===null){var e=xt.alternate;e=e!==null?e.memoizedState:null}else e=Mt.next;var t=zt===null?xt.memoizedState:zt.next;if(t!==null)zt=t,Mt=e;else{if(e===null)throw Error(Q(310));Mt=e,e={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},zt===null?xt.memoizedState=zt=e:zt=zt.next=e}return zt}function $l(e,t){return typeof t=="function"?t(e):t}function Rh(e){var t=ar(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=Mt,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,xt.lanes|=d,Qi|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,kr(r,t.memoizedState)||(kn=!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,xt.lanes|=i,Qi|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Dh(e){var t=ar(),n=t.queue;if(n===null)throw Error(Q(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);kr(i,t.memoizedState)||(kn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function _b(){}function Ab(e,t){var n=xt,r=ar(),o=t(),i=!kr(r.memoizedState,o);if(i&&(r.memoizedState=o,kn=!0),r=r.queue,xg(Mb.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||zt!==null&&zt.memoizedState.tag&1){if(n.flags|=2048,Fl(9,Ob.bind(null,n,r,o,t),void 0,null),Ut===null)throw Error(Q(349));Gi&30||Nb(n,t,o)}return o}function Nb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=xt.updateQueue,t===null?(t={lastEffect:null,stores:null},xt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ob(e,t,n,r){t.value=n,t.getSnapshot=r,Lb(t)&&$b(e)}function Mb(e,t,n){return n(function(){Lb(t)&&$b(e)})}function Lb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kr(e,n)}catch{return!0}}function $b(e){var t=po(e,1);t!==null&&Tr(t,e,1,-1)}function nx(e){var t=Ur();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$l,lastRenderedState:e},t.queue=e,e=e.dispatch=aI.bind(null,xt,e),[t.memoizedState,e]}function Fl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=xt.updateQueue,t===null?(t={lastEffect:null,stores:null},xt.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 Fb(){return ar().memoizedState}function vu(e,t,n,r){var o=Ur();xt.flags|=e,o.memoizedState=Fl(1|t,n,void 0,r===void 0?null:r)}function Ld(e,t,n,r){var o=ar();r=r===void 0?null:r;var i=void 0;if(Mt!==null){var s=Mt.memoizedState;if(i=s.destroy,r!==null&&gg(r,s.deps)){o.memoizedState=Fl(t,n,i,r);return}}xt.flags|=e,o.memoizedState=Fl(1|t,n,i,r)}function rx(e,t){return vu(8390656,8,e,t)}function xg(e,t){return Ld(2048,8,e,t)}function zb(e,t){return Ld(4,2,e,t)}function Bb(e,t){return Ld(4,4,e,t)}function Ub(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 Vb(e,t,n){return n=n!=null?n.concat([e]):null,Ld(4,4,Ub.bind(null,t,e),n)}function wg(){}function Hb(e,t){var n=ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&gg(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Wb(e,t){var n=ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&gg(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function qb(e,t,n){return Gi&21?(kr(n,t)||(n=KS(),xt.lanes|=n,Qi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,kn=!0),e.memoizedState=n)}function iI(e,t){var n=He;He=n!==0&&4>n?n:4,e(!0);var r=kh.transition;kh.transition={};try{e(!1),t()}finally{He=n,kh.transition=r}}function Gb(){return ar().memoizedState}function sI(e,t,n){var r=oi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qb(e))Kb(t,n);else if(n=Eb(e,t,n,r),n!==null){var o=gn();Tr(n,e,r,o),Yb(n,t,r)}}function aI(e,t,n){var r=oi(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qb(e))Kb(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,kr(l,s)){var c=t.interleaved;c===null?(o.next=o,dg(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=Eb(e,t,o,r),n!==null&&(o=gn(),Tr(n,e,r,o),Yb(n,t,r))}}function Qb(e){var t=e.alternate;return e===xt||t!==null&&t===xt}function Kb(e,t){yl=Yu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Yb(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xm(e,n)}}var Xu={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},lI={readContext:sr,useCallback:function(e,t){return Ur().memoizedState=[e,t===void 0?null:t],e},useContext:sr,useEffect:rx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,vu(4194308,4,Ub.bind(null,t,e),n)},useLayoutEffect:function(e,t){return vu(4194308,4,e,t)},useInsertionEffect:function(e,t){return vu(4,2,e,t)},useMemo:function(e,t){var n=Ur();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ur();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=sI.bind(null,xt,e),[r.memoizedState,e]},useRef:function(e){var t=Ur();return e={current:e},t.memoizedState=e},useState:nx,useDebugValue:wg,useDeferredValue:function(e){return Ur().memoizedState=e},useTransition:function(){var e=nx(!1),t=e[0];return e=iI.bind(null,e[1]),Ur().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=xt,o=Ur();if(pt){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),Ut===null)throw Error(Q(349));Gi&30||Nb(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,rx(Mb.bind(null,r,i,e),[e]),r.flags|=2048,Fl(9,Ob.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ur(),t=Ut.identifierPrefix;if(pt){var n=so,r=io;n=(r&~(1<<32-Er(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ll++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=oI++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},cI={readContext:sr,useCallback:Hb,useContext:sr,useEffect:xg,useImperativeHandle:Vb,useInsertionEffect:zb,useLayoutEffect:Bb,useMemo:Wb,useReducer:Rh,useRef:Fb,useState:function(){return Rh($l)},useDebugValue:wg,useDeferredValue:function(e){var t=ar();return qb(t,Mt.memoizedState,e)},useTransition:function(){var e=Rh($l)[0],t=ar().memoizedState;return[e,t]},useMutableSource:_b,useSyncExternalStore:Ab,useId:Gb,unstable_isNewReconciler:!1},uI={readContext:sr,useCallback:Hb,useContext:sr,useEffect:xg,useImperativeHandle:Vb,useInsertionEffect:zb,useLayoutEffect:Bb,useMemo:Wb,useReducer:Dh,useRef:Fb,useState:function(){return Dh($l)},useDebugValue:wg,useDeferredValue:function(e){var t=ar();return Mt===null?t.memoizedState=e:qb(t,Mt.memoizedState,e)},useTransition:function(){var e=Dh($l)[0],t=ar().memoizedState;return[e,t]},useMutableSource:_b,useSyncExternalStore:Ab,useId:Gb,unstable_isNewReconciler:!1};function la(e,t){try{var n="",r=t;do n+=$R(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 Ih(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Lp(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var dI=typeof WeakMap=="function"?WeakMap:Map;function Xb(e,t,n){n=ao(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Zu||(Zu=!0,Gp=r),Lp(e,t)},n}function Jb(e,t,n){n=ao(-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(){Lp(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Lp(e,t),typeof r!="function"&&(ri===null?ri=new Set([this]):ri.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function ox(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new dI;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=EI.bind(null,e,t,n),t.then(e,e))}function ix(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 sx(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=ao(-1,1),t.tag=2,ni(n,t,1))),n.lanes|=1),e)}var fI=jo.ReactCurrentOwner,kn=!1;function fn(e,t,n,r){t.child=e===null?Db(t,null,n,r):sa(t,e.child,n,r)}function ax(e,t,n,r,o){n=n.render;var i=t.ref;return Js(t,o),r=yg(e,t,n,r,i,o),n=vg(),e!==null&&!kn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mo(e,t,o)):(pt&&n&&ig(t),t.flags|=1,fn(e,t,r,o),t.child)}function lx(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!kg(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Zb(e,t,i,r,o)):(e=bu(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:Il,n(s,r)&&e.ref===t.ref)return mo(e,t,o)}return t.flags|=1,e=ii(i,r),e.ref=t.ref,e.return=t,t.child=e}function Zb(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Il(i,r)&&e.ref===t.ref)if(kn=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(kn=!0);else return t.lanes=e.lanes,mo(e,t,o)}return $p(e,t,n,r,o)}function eC(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},nt(Vs,Fn),Fn|=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,nt(Vs,Fn),Fn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,nt(Vs,Fn),Fn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,nt(Vs,Fn),Fn|=r;return fn(e,t,o,n),t.child}function tC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function $p(e,t,n,r,o){var i=Dn(n)?Wi:cn.current;return i=oa(t,i),Js(t,o),n=yg(e,t,n,r,i,o),r=vg(),e!==null&&!kn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mo(e,t,o)):(pt&&r&&ig(t),t.flags|=1,fn(e,t,n,o),t.child)}function cx(e,t,n,r,o){if(Dn(n)){var i=!0;Vu(t)}else i=!1;if(Js(t,o),t.stateNode===null)xu(e,t),kb(t,n,r),Mp(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=Dn(n)?Wi:cn.current,u=oa(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)&&ex(t,s,r,u),zo=!1;var h=t.memoizedState;s.state=h,Qu(t,r,s,o),c=t.memoizedState,l!==r||h!==c||Rn.current||zo?(typeof d=="function"&&(Op(t,n,d,r),c=t.memoizedState),(l=zo||Z0(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,Tb(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:wr(t.type,l),s.props=u,f=t.pendingProps,h=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=sr(c):(c=Dn(n)?Wi:cn.current,c=oa(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)&&ex(t,s,r,c),zo=!1,h=t.memoizedState,s.state=h,Qu(t,r,s,o);var g=t.memoizedState;l!==f||h!==g||Rn.current||zo?(typeof m=="function"&&(Op(t,n,m,r),g=t.memoizedState),(u=zo||Z0(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 Fp(e,t,n,r,i,o)}function Fp(e,t,n,r,o,i){tC(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Q0(t,n,!1),mo(e,t,i);r=t.stateNode,fI.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=sa(t,e.child,null,i),t.child=sa(t,null,l,i)):fn(e,t,l,i),t.memoizedState=r.state,o&&Q0(t,n,!0),t.child}function nC(e){var t=e.stateNode;t.pendingContext?G0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&G0(e,t.context,!1),hg(e,t.containerInfo)}function ux(e,t,n,r,o){return ia(),ag(o),t.flags|=256,fn(e,t,n,r),t.child}var zp={dehydrated:null,treeContext:null,retryLane:0};function Bp(e){return{baseLanes:e,cachePool:null,transitions:null}}function rC(e,t,n){var r=t.pendingProps,o=vt.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),nt(vt,o&1),e===null)return Ap(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=zd(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=Bp(n),t.memoizedState=zp,e):Sg(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return hI(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=ii(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=ii(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?Bp(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=zp,r}return i=e.child,e=i.sibling,r=ii(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 Sg(e,t){return t=zd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Xc(e,t,n,r){return r!==null&&ag(r),sa(t,e.child,null,n),e=Sg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hI(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Ih(Error(Q(422))),Xc(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=zd({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&&sa(t,e.child,null,s),t.child.memoizedState=Bp(s),t.memoizedState=zp,i);if(!(t.mode&1))return Xc(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Q(419)),r=Ih(i,r,void 0),Xc(e,t,s,r)}if(l=(s&e.childLanes)!==0,kn||l){if(r=Ut,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,po(e,o),Tr(r,e,o,-1))}return Pg(),r=Ih(Error(Q(421))),Xc(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=TI.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Bn=ti(o.nextSibling),Vn=t,pt=!0,Cr=null,e!==null&&(tr[nr++]=io,tr[nr++]=so,tr[nr++]=qi,io=e.id,so=e.overflow,qi=t),t=Sg(t,r.children),t.flags|=4096,t)}function dx(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Np(e.return,t,n)}function _h(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 oC(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(fn(e,t,r.children,n),r=vt.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&&dx(e,n,t);else if(e.tag===19)dx(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(nt(vt,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&&Ku(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),_h(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&&Ku(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}_h(t,!0,n,null,i);break;case"together":_h(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function xu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function mo(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(Q(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pI(e,t,n){switch(t.tag){case 3:nC(t),ia();break;case 5:Ib(t);break;case 1:Dn(t.type)&&Vu(t);break;case 4:hg(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;nt(qu,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(nt(vt,vt.current&1),t.flags|=128,null):n&t.child.childLanes?rC(e,t,n):(nt(vt,vt.current&1),e=mo(e,t,n),e!==null?e.sibling:null);nt(vt,vt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return oC(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),nt(vt,vt.current),r)break;return null;case 22:case 23:return t.lanes=0,eC(e,t,n)}return mo(e,t,n)}var iC,Up,sC,aC;iC=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}};Up=function(){};sC=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,$i(Qr.current);var i=null;switch(n){case"input":o=up(e,o),r=up(e,r),i=[];break;case"select":o=wt({},o,{value:void 0}),r=wt({},r,{value:void 0}),i=[];break;case"textarea":o=hp(e,o),r=hp(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Bu)}mp(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"&&(jl.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"&&(jl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&it("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)}};aC=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ga(e,t){if(!pt)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 mI(e,t,n){var r=t.pendingProps;switch(sg(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 Dn(t.type)&&Uu(),sn(t),null;case 3:return r=t.stateNode,aa(),lt(Rn),lt(cn),mg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Kc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Cr!==null&&(Yp(Cr),Cr=null))),Up(e,t),sn(t),null;case 5:pg(t);var o=$i(Ml.current);if(n=t.type,e!==null&&t.stateNode!=null)sC(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Q(166));return sn(t),null}if(e=$i(Qr.current),Kc(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Wr]=t,r[Nl]=i,e=(t.mode&1)!==0,n){case"dialog":it("cancel",r),it("close",r);break;case"iframe":case"object":case"embed":it("load",r);break;case"video":case"audio":for(o=0;o<ll.length;o++)it(ll[o],r);break;case"source":it("error",r);break;case"img":case"image":case"link":it("error",r),it("load",r);break;case"details":it("toggle",r);break;case"input":w0(r,i),it("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},it("invalid",r);break;case"textarea":b0(r,i),it("invalid",r)}mp(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&&Qc(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Qc(r.textContent,l,e),o=["children",""+l]):jl.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&it("scroll",r)}switch(n){case"input":zc(r),S0(r,i,!0);break;case"textarea":zc(r),C0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Bu)}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=NS(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[Wr]=t,e[Nl]=r,iC(e,t,!1,!1),t.stateNode=e;e:{switch(s=gp(n,r),n){case"dialog":it("cancel",e),it("close",e),o=r;break;case"iframe":case"object":case"embed":it("load",e),o=r;break;case"video":case"audio":for(o=0;o<ll.length;o++)it(ll[o],e);o=r;break;case"source":it("error",e),o=r;break;case"img":case"image":case"link":it("error",e),it("load",e),o=r;break;case"details":it("toggle",e),o=r;break;case"input":w0(e,r),o=up(e,r),it("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=wt({},r,{value:void 0}),it("invalid",e);break;case"textarea":b0(e,r),o=hp(e,r),it("invalid",e);break;default:o=r}mp(n,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?LS(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&OS(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&El(e,c):typeof c=="number"&&El(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(jl.hasOwnProperty(i)?c!=null&&i==="onScroll"&&it("scroll",e):c!=null&&Wm(e,i,c,s))}switch(n){case"input":zc(e),S0(e,r,!1);break;case"textarea":zc(e),C0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ci(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Qs(e,!!r.multiple,i,!1):r.defaultValue!=null&&Qs(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Bu)}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)aC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Q(166));if(n=$i(Ml.current),$i(Qr.current),Kc(t)){if(r=t.stateNode,n=t.memoizedProps,r[Wr]=t,(i=r.nodeValue!==n)&&(e=Vn,e!==null))switch(e.tag){case 3:Qc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Qc(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Wr]=t,t.stateNode=r}return sn(t),null;case 13:if(lt(vt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(pt&&Bn!==null&&t.mode&1&&!(t.flags&128))jb(),ia(),t.flags|=98560,i=!1;else if(i=Kc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Q(317));i[Wr]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;sn(t),i=!1}else Cr!==null&&(Yp(Cr),Cr=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||vt.current&1?Lt===0&&(Lt=3):Pg())),t.updateQueue!==null&&(t.flags|=4),sn(t),null);case 4:return aa(),Up(e,t),e===null&&_l(t.stateNode.containerInfo),sn(t),null;case 10:return ug(t.type._context),sn(t),null;case 17:return Dn(t.type)&&Uu(),sn(t),null;case 19:if(lt(vt),i=t.memoizedState,i===null)return sn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Ga(i,!1);else{if(Lt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Ku(e),s!==null){for(t.flags|=128,Ga(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 nt(vt,vt.current&1|2),t.child}e=e.sibling}i.tail!==null&&Dt()>ca&&(t.flags|=128,r=!0,Ga(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ku(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ga(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!pt)return sn(t),null}else 2*Dt()-i.renderingStartTime>ca&&n!==1073741824&&(t.flags|=128,r=!0,Ga(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=Dt(),t.sibling=null,n=vt.current,nt(vt,r?n&1|2:n&1),t):(sn(t),null);case 22:case 23:return Tg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Fn&1073741824&&(sn(t),t.subtreeFlags&6&&(t.flags|=8192)):sn(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function gI(e,t){switch(sg(t),t.tag){case 1:return Dn(t.type)&&Uu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return aa(),lt(Rn),lt(cn),mg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return pg(t),null;case 13:if(lt(vt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return lt(vt),null;case 4:return aa(),null;case 10:return ug(t.type._context),null;case 22:case 23:return Tg(),null;case 24:return null;default:return null}}var Jc=!1,an=!1,yI=typeof WeakSet=="function"?WeakSet:Set,re=null;function Us(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jt(e,t,r)}else n.current=null}function Vp(e,t,n){try{n()}catch(r){jt(e,t,r)}}var fx=!1;function vI(e,t){if(Tp=$u,e=db(),og(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(Pp={focusedElem:e,selectionRange:n},$u=!1,re=t;re!==null;)if(t=re,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,re=e;else for(;re!==null;){t=re;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 y=g.memoizedProps,C=g.memoizedState,v=t.stateNode,w=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:wr(t.type,y),C);v.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(S){jt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,re=e;break}re=t.return}return g=fx,fx=!1,g}function vl(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&&Vp(t,n,i)}o=o.next}while(o!==r)}}function $d(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 Hp(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 lC(e){var t=e.alternate;t!==null&&(e.alternate=null,lC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wr],delete t[Nl],delete t[Dp],delete t[eI],delete t[tI])),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 cC(e){return e.tag===5||e.tag===3||e.tag===4}function hx(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cC(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 Wp(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=Bu));else if(r!==4&&(e=e.child,e!==null))for(Wp(e,t,n),e=e.sibling;e!==null;)Wp(e,t,n),e=e.sibling}function qp(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(qp(e,t,n),e=e.sibling;e!==null;)qp(e,t,n),e=e.sibling}var Gt=null,Sr=!1;function Lo(e,t,n){for(n=n.child;n!==null;)uC(e,t,n),n=n.sibling}function uC(e,t,n){if(Gr&&typeof Gr.onCommitFiberUnmount=="function")try{Gr.onCommitFiberUnmount(Dd,n)}catch{}switch(n.tag){case 5:an||Us(n,t);case 6:var r=Gt,o=Sr;Gt=null,Lo(e,t,n),Gt=r,Sr=o,Gt!==null&&(Sr?(e=Gt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Gt.removeChild(n.stateNode));break;case 18:Gt!==null&&(Sr?(e=Gt,n=n.stateNode,e.nodeType===8?Eh(e.parentNode,n):e.nodeType===1&&Eh(e,n),Rl(e)):Eh(Gt,n.stateNode));break;case 4:r=Gt,o=Sr,Gt=n.stateNode.containerInfo,Sr=!0,Lo(e,t,n),Gt=r,Sr=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)&&Vp(n,t,s),o=o.next}while(o!==r)}Lo(e,t,n);break;case 1:if(!an&&(Us(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){jt(n,t,l)}Lo(e,t,n);break;case 21:Lo(e,t,n);break;case 22:n.mode&1?(an=(r=an)||n.memoizedState!==null,Lo(e,t,n),an=r):Lo(e,t,n);break;default:Lo(e,t,n)}}function px(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yI),t.forEach(function(r){var o=PI.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:Gt=l.stateNode,Sr=!1;break e;case 3:Gt=l.stateNode.containerInfo,Sr=!0;break e;case 4:Gt=l.stateNode.containerInfo,Sr=!0;break e}l=l.return}if(Gt===null)throw Error(Q(160));uC(i,s,o),Gt=null,Sr=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){jt(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)dC(t,e),t=t.sibling}function dC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yr(t,e),Fr(e),r&4){try{vl(3,e,e.return),$d(3,e)}catch(y){jt(e,e.return,y)}try{vl(5,e,e.return)}catch(y){jt(e,e.return,y)}}break;case 1:yr(t,e),Fr(e),r&512&&n!==null&&Us(n,n.return);break;case 5:if(yr(t,e),Fr(e),r&512&&n!==null&&Us(n,n.return),e.flags&32){var o=e.stateNode;try{El(o,"")}catch(y){jt(e,e.return,y)}}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&&_S(o,i),gp(l,s);var u=gp(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?LS(o,f):d==="dangerouslySetInnerHTML"?OS(o,f):d==="children"?El(o,f):Wm(o,d,f,u)}switch(l){case"input":dp(o,i);break;case"textarea":AS(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Qs(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?Qs(o,!!i.multiple,i.defaultValue,!0):Qs(o,!!i.multiple,i.multiple?[]:"",!1))}o[Nl]=i}catch(y){jt(e,e.return,y)}}break;case 6:if(yr(t,e),Fr(e),r&4){if(e.stateNode===null)throw Error(Q(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(y){jt(e,e.return,y)}}break;case 3:if(yr(t,e),Fr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rl(t.containerInfo)}catch(y){jt(e,e.return,y)}break;case 4:yr(t,e),Fr(e);break;case 13:yr(t,e),Fr(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(jg=Dt())),r&4&&px(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),Fr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(re=e,d=e.child;d!==null;){for(f=re=d;re!==null;){switch(h=re,m=h.child,h.tag){case 0:case 11:case 14:case 15:vl(4,h,h.return);break;case 1:Us(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(y){jt(r,n,y)}}break;case 5:Us(h,h.return);break;case 22:if(h.memoizedState!==null){gx(f);continue}}m!==null?(m.return=h,re=m):gx(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=MS("display",s))}catch(y){jt(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){jt(e,e.return,y)}}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),Fr(e),r&4&&px(e);break;case 21:break;default:yr(t,e),Fr(e)}}function Fr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(cC(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(El(o,""),r.flags&=-33);var i=hx(e);qp(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,l=hx(e);Wp(e,l,s);break;default:throw Error(Q(161))}}catch(c){jt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xI(e,t,n){re=e,fC(e)}function fC(e,t,n){for(var r=(e.mode&1)!==0;re!==null;){var o=re,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Jc;if(!s){var l=o.alternate,c=l!==null&&l.memoizedState!==null||an;l=Jc;var u=an;if(Jc=s,(an=c)&&!u)for(re=o;re!==null;)s=re,c=s.child,s.tag===22&&s.memoizedState!==null?yx(o):c!==null?(c.return=s,re=c):yx(o);for(;i!==null;)re=i,fC(i),i=i.sibling;re=o,Jc=l,an=u}mx(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,re=i):mx(e)}}function mx(e){for(;re!==null;){var t=re;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:an||$d(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:wr(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&J0(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}J0(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&&Rl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}an||t.flags&512&&Hp(t)}catch(h){jt(t,t.return,h)}}if(t===e){re=null;break}if(n=t.sibling,n!==null){n.return=t.return,re=n;break}re=t.return}}function gx(e){for(;re!==null;){var t=re;if(t===e){re=null;break}var n=t.sibling;if(n!==null){n.return=t.return,re=n;break}re=t.return}}function yx(e){for(;re!==null;){var t=re;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{$d(4,t)}catch(c){jt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(c){jt(t,o,c)}}var i=t.return;try{Hp(t)}catch(c){jt(t,i,c)}break;case 5:var s=t.return;try{Hp(t)}catch(c){jt(t,s,c)}}}catch(c){jt(t,t.return,c)}if(t===e){re=null;break}var l=t.sibling;if(l!==null){l.return=t.return,re=l;break}re=t.return}}var wI=Math.ceil,Ju=jo.ReactCurrentDispatcher,bg=jo.ReactCurrentOwner,or=jo.ReactCurrentBatchConfig,Be=0,Ut=null,At=null,Zt=0,Fn=0,Vs=yi(0),Lt=0,zl=null,Qi=0,Fd=0,Cg=0,xl=null,Pn=null,jg=0,ca=1/0,ro=null,Zu=!1,Gp=null,ri=null,Zc=!1,Qo=null,ed=0,wl=0,Qp=null,wu=-1,Su=0;function gn(){return Be&6?Dt():wu!==-1?wu:wu=Dt()}function oi(e){return e.mode&1?Be&2&&Zt!==0?Zt&-Zt:rI.transition!==null?(Su===0&&(Su=KS()),Su):(e=He,e!==0||(e=window.event,e=e===void 0?16:nb(e.type)),e):1}function Tr(e,t,n,r){if(50<wl)throw wl=0,Qp=null,Error(Q(185));tc(e,n,r),(!(Be&2)||e!==Ut)&&(e===Ut&&(!(Be&2)&&(Fd|=n),Lt===4&&Wo(e,Zt)),In(e,r),n===1&&Be===0&&!(t.mode&1)&&(ca=Dt()+500,Od&&vi()))}function In(e,t){var n=e.callbackNode;rD(e,t);var r=Lu(e,e===Ut?Zt:0);if(r===0)n!==null&&T0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&T0(n),t===1)e.tag===0?nI(vx.bind(null,e)):Sb(vx.bind(null,e)),JD(function(){!(Be&6)&&vi()}),n=null;else{switch(YS(r)){case 1:n=Ym;break;case 4:n=GS;break;case 16:n=Mu;break;case 536870912:n=QS;break;default:n=Mu}n=wC(n,hC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function hC(e,t){if(wu=-1,Su=0,Be&6)throw Error(Q(327));var n=e.callbackNode;if(Zs()&&e.callbackNode!==n)return null;var r=Lu(e,e===Ut?Zt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=td(e,r);else{t=r;var o=Be;Be|=2;var i=mC();(Ut!==e||Zt!==t)&&(ro=null,ca=Dt()+500,Ui(e,t));do try{CI();break}catch(l){pC(e,l)}while(!0);cg(),Ju.current=i,Be=o,At!==null?t=0:(Ut=null,Zt=0,t=Lt)}if(t!==0){if(t===2&&(o=Sp(e),o!==0&&(r=o,t=Kp(e,o))),t===1)throw n=zl,Ui(e,0),Wo(e,r),In(e,Dt()),n;if(t===6)Wo(e,r);else{if(o=e.current.alternate,!(r&30)&&!SI(o)&&(t=td(e,r),t===2&&(i=Sp(e),i!==0&&(r=i,t=Kp(e,i))),t===1))throw n=zl,Ui(e,0),Wo(e,r),In(e,Dt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:Ii(e,Pn,ro);break;case 3:if(Wo(e,r),(r&130023424)===r&&(t=jg+500-Dt(),10<t)){if(Lu(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){gn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Rp(Ii.bind(null,e,Pn,ro),t);break}Ii(e,Pn,ro);break;case 4:if(Wo(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Er(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=Dt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wI(r/1960))-r,10<r){e.timeoutHandle=Rp(Ii.bind(null,e,Pn,ro),r);break}Ii(e,Pn,ro);break;case 5:Ii(e,Pn,ro);break;default:throw Error(Q(329))}}}return In(e,Dt()),e.callbackNode===n?hC.bind(null,e):null}function Kp(e,t){var n=xl;return e.current.memoizedState.isDehydrated&&(Ui(e,t).flags|=256),e=td(e,t),e!==2&&(t=Pn,Pn=n,t!==null&&Yp(t)),e}function Yp(e){Pn===null?Pn=e:Pn.push.apply(Pn,e)}function SI(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(!kr(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 Wo(e,t){for(t&=~Cg,t&=~Fd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Er(t),r=1<<n;e[n]=-1,t&=~r}}function vx(e){if(Be&6)throw Error(Q(327));Zs();var t=Lu(e,0);if(!(t&1))return In(e,Dt()),null;var n=td(e,t);if(e.tag!==0&&n===2){var r=Sp(e);r!==0&&(t=r,n=Kp(e,r))}if(n===1)throw n=zl,Ui(e,0),Wo(e,t),In(e,Dt()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ii(e,Pn,ro),In(e,Dt()),null}function Eg(e,t){var n=Be;Be|=1;try{return e(t)}finally{Be=n,Be===0&&(ca=Dt()+500,Od&&vi())}}function Ki(e){Qo!==null&&Qo.tag===0&&!(Be&6)&&Zs();var t=Be;Be|=1;var n=or.transition,r=He;try{if(or.transition=null,He=1,e)return e()}finally{He=r,or.transition=n,Be=t,!(Be&6)&&vi()}}function Tg(){Fn=Vs.current,lt(Vs)}function Ui(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,XD(n)),At!==null)for(n=At.return;n!==null;){var r=n;switch(sg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Uu();break;case 3:aa(),lt(Rn),lt(cn),mg();break;case 5:pg(r);break;case 4:aa();break;case 13:lt(vt);break;case 19:lt(vt);break;case 10:ug(r.type._context);break;case 22:case 23:Tg()}n=n.return}if(Ut=e,At=e=ii(e.current,null),Zt=Fn=t,Lt=0,zl=null,Cg=Fd=Qi=0,Pn=xl=null,Li!==null){for(t=0;t<Li.length;t++)if(n=Li[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}Li=null}return e}function pC(e,t){do{var n=At;try{if(cg(),yu.current=Xu,Yu){for(var r=xt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Yu=!1}if(Gi=0,zt=Mt=xt=null,yl=!1,Ll=0,bg.current=null,n===null||n.return===null){Lt=1,zl=t,At=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=Zt,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=ix(s);if(m!==null){m.flags&=-257,sx(m,s,l,i,t),m.mode&1&&ox(i,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var y=new Set;y.add(c),t.updateQueue=y}else g.add(c);break e}else{if(!(t&1)){ox(i,u,t),Pg();break e}c=Error(Q(426))}}else if(pt&&l.mode&1){var C=ix(s);if(C!==null){!(C.flags&65536)&&(C.flags|=256),sx(C,s,l,i,t),ag(la(c,l));break e}}i=c=la(c,l),Lt!==4&&(Lt=2),xl===null?xl=[i]:xl.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=Xb(i,c,t);X0(i,v);break e;case 1:l=c;var w=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ri===null||!ri.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=Jb(i,l,t);X0(i,S);break e}}i=i.return}while(i!==null)}yC(n)}catch(E){t=E,At===n&&n!==null&&(At=n=n.return);continue}break}while(!0)}function mC(){var e=Ju.current;return Ju.current=Xu,e===null?Xu:e}function Pg(){(Lt===0||Lt===3||Lt===2)&&(Lt=4),Ut===null||!(Qi&268435455)&&!(Fd&268435455)||Wo(Ut,Zt)}function td(e,t){var n=Be;Be|=2;var r=mC();(Ut!==e||Zt!==t)&&(ro=null,Ui(e,t));do try{bI();break}catch(o){pC(e,o)}while(!0);if(cg(),Be=n,Ju.current=r,At!==null)throw Error(Q(261));return Ut=null,Zt=0,Lt}function bI(){for(;At!==null;)gC(At)}function CI(){for(;At!==null&&!QR();)gC(At)}function gC(e){var t=xC(e.alternate,e,Fn);e.memoizedProps=e.pendingProps,t===null?yC(e):At=t,bg.current=null}function yC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=gI(n,t),n!==null){n.flags&=32767,At=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Lt=6,At=null;return}}else if(n=mI(n,t,Fn),n!==null){At=n;return}if(t=t.sibling,t!==null){At=t;return}At=t=e}while(t!==null);Lt===0&&(Lt=5)}function Ii(e,t,n){var r=He,o=or.transition;try{or.transition=null,He=1,jI(e,t,n,r)}finally{or.transition=o,He=r}return null}function jI(e,t,n,r){do Zs();while(Qo!==null);if(Be&6)throw Error(Q(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(Q(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(oD(e,i),e===Ut&&(At=Ut=null,Zt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Zc||(Zc=!0,wC(Mu,function(){return Zs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=or.transition,or.transition=null;var s=He;He=1;var l=Be;Be|=4,bg.current=null,vI(e,n),dC(n,e),HD(Pp),$u=!!Tp,Pp=Tp=null,e.current=n,xI(n),KR(),Be=l,He=s,or.transition=i}else e.current=n;if(Zc&&(Zc=!1,Qo=e,ed=o),i=e.pendingLanes,i===0&&(ri=null),JR(n.stateNode),In(e,Dt()),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(Zu)throw Zu=!1,e=Gp,Gp=null,e;return ed&1&&e.tag!==0&&Zs(),i=e.pendingLanes,i&1?e===Qp?wl++:(wl=0,Qp=e):wl=0,vi(),null}function Zs(){if(Qo!==null){var e=YS(ed),t=or.transition,n=He;try{if(or.transition=null,He=16>e?16:e,Qo===null)var r=!1;else{if(e=Qo,Qo=null,ed=0,Be&6)throw Error(Q(331));var o=Be;for(Be|=4,re=e.current;re!==null;){var i=re,s=i.child;if(re.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(re=u;re!==null;){var d=re;switch(d.tag){case 0:case 11:case 15:vl(8,d,i)}var f=d.child;if(f!==null)f.return=d,re=f;else for(;re!==null;){d=re;var h=d.sibling,m=d.return;if(lC(d),d===u){re=null;break}if(h!==null){h.return=m,re=h;break}re=m}}}var g=i.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var C=y.sibling;y.sibling=null,y=C}while(y!==null)}}re=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,re=s;else e:for(;re!==null;){if(i=re,i.flags&2048)switch(i.tag){case 0:case 11:case 15:vl(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,re=v;break e}re=i.return}}var w=e.current;for(re=w;re!==null;){s=re;var x=s.child;if(s.subtreeFlags&2064&&x!==null)x.return=s,re=x;else e:for(s=w;re!==null;){if(l=re,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:$d(9,l)}}catch(E){jt(l,l.return,E)}if(l===s){re=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,re=S;break e}re=l.return}}if(Be=o,vi(),Gr&&typeof Gr.onPostCommitFiberRoot=="function")try{Gr.onPostCommitFiberRoot(Dd,e)}catch{}r=!0}return r}finally{He=n,or.transition=t}}return!1}function xx(e,t,n){t=la(n,t),t=Xb(e,t,1),e=ni(e,t,1),t=gn(),e!==null&&(tc(e,1,t),In(e,t))}function jt(e,t,n){if(e.tag===3)xx(e,e,n);else for(;t!==null;){if(t.tag===3){xx(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ri===null||!ri.has(r))){e=la(n,e),e=Jb(t,e,1),t=ni(t,e,1),e=gn(),t!==null&&(tc(t,1,e),In(t,e));break}}t=t.return}}function EI(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=gn(),e.pingedLanes|=e.suspendedLanes&n,Ut===e&&(Zt&n)===n&&(Lt===4||Lt===3&&(Zt&130023424)===Zt&&500>Dt()-jg?Ui(e,0):Cg|=n),In(e,t)}function vC(e,t){t===0&&(e.mode&1?(t=Vc,Vc<<=1,!(Vc&130023424)&&(Vc=4194304)):t=1);var n=gn();e=po(e,t),e!==null&&(tc(e,t,n),In(e,n))}function TI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vC(e,n)}function PI(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(Q(314))}r!==null&&r.delete(t),vC(e,n)}var xC;xC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Rn.current)kn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return kn=!1,pI(e,t,n);kn=!!(e.flags&131072)}else kn=!1,pt&&t.flags&1048576&&bb(t,Wu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;xu(e,t),e=t.pendingProps;var o=oa(t,cn.current);Js(t,n),o=yg(null,t,r,e,o,n);var i=vg();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,Dn(r)?(i=!0,Vu(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,fg(t),o.updater=Md,t.stateNode=o,o._reactInternals=t,Mp(t,r,e,n),t=Fp(null,t,r,!0,i,n)):(t.tag=0,pt&&i&&ig(t),fn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(xu(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=RI(r),e=wr(r,e),o){case 0:t=$p(null,t,r,e,n);break e;case 1:t=cx(null,t,r,e,n);break e;case 11:t=ax(null,t,r,e,n);break e;case 14:t=lx(null,t,r,wr(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),$p(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),cx(e,t,r,o,n);case 3:e:{if(nC(t),e===null)throw Error(Q(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Tb(e,t),Qu(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=la(Error(Q(423)),t),t=ux(e,t,r,n,o);break e}else if(r!==o){o=la(Error(Q(424)),t),t=ux(e,t,r,n,o);break e}else for(Bn=ti(t.stateNode.containerInfo.firstChild),Vn=t,pt=!0,Cr=null,n=Db(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ia(),r===o){t=mo(e,t,n);break e}fn(e,t,r,n)}t=t.child}return t;case 5:return Ib(t),e===null&&Ap(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,kp(r,o)?s=null:i!==null&&kp(r,i)&&(t.flags|=32),tC(e,t),fn(e,t,s,n),t.child;case 6:return e===null&&Ap(t),null;case 13:return rC(e,t,n);case 4:return hg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sa(t,null,r,n):fn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),ax(e,t,r,o,n);case 7:return fn(e,t,t.pendingProps,n),t.child;case 8:return fn(e,t,t.pendingProps.children,n),t.child;case 12:return fn(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,nt(qu,r._currentValue),r._currentValue=s,i!==null)if(kr(i.value,s)){if(i.children===o.children&&!Rn.current){t=mo(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=ao(-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),Np(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(Q(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Np(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}fn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Js(t,n),o=sr(o),r=r(o),t.flags|=1,fn(e,t,r,n),t.child;case 14:return r=t.type,o=wr(r,t.pendingProps),o=wr(r.type,o),lx(e,t,r,o,n);case 15:return Zb(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),xu(e,t),t.tag=1,Dn(r)?(e=!0,Vu(t)):e=!1,Js(t,n),kb(t,r,o),Mp(t,r,o,n),Fp(null,t,r,!0,e,n);case 19:return oC(e,t,n);case 22:return eC(e,t,n)}throw Error(Q(156,t.tag))};function wC(e,t){return qS(e,t)}function kI(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 kI(e,t,n,r)}function kg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function RI(e){if(typeof e=="function")return kg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Gm)return 11;if(e===Qm)return 14}return 2}function ii(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 bu(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")kg(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case As:return Vi(n.children,o,i,t);case qm:s=8,o|=8;break;case sp:return e=rr(12,n,t,o|2),e.elementType=sp,e.lanes=i,e;case ap:return e=rr(13,n,t,o),e.elementType=ap,e.lanes=i,e;case lp:return e=rr(19,n,t,o),e.elementType=lp,e.lanes=i,e;case RS:return zd(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case PS:s=10;break e;case kS:s=9;break e;case Gm:s=11;break e;case Qm:s=14;break e;case Fo:s=16,r=null;break e}throw Error(Q(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 zd(e,t,n,r){return e=rr(22,e,r,t),e.elementType=RS,e.lanes=n,e.stateNode={isHidden:!1},e}function Ah(e,t,n){return e=rr(6,e,null,t),e.lanes=n,e}function Nh(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 DI(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=ph(0),this.expirationTimes=ph(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ph(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Rg(e,t,n,r,o,i,s,l,c){return e=new DI(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},fg(i),e}function II(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_s,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function SC(e){if(!e)return ui;e=e._reactInternals;e:{if(ss(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Dn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(Dn(n))return wb(e,n,t)}return t}function bC(e,t,n,r,o,i,s,l,c){return e=Rg(n,r,!0,e,o,i,s,l,c),e.context=SC(null),n=e.current,r=gn(),o=oi(n),i=ao(r,o),i.callback=t??null,ni(n,i,o),e.current.lanes=o,tc(e,o,r),In(e,r),e}function Bd(e,t,n,r){var o=t.current,i=gn(),s=oi(o);return n=SC(n),t.context===null?t.context=n:t.pendingContext=n,t=ao(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ni(o,t,s),e!==null&&(Tr(e,o,s,i),gu(e,o,s)),s}function nd(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 wx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Dg(e,t){wx(e,t),(e=e.alternate)&&wx(e,t)}function _I(){return null}var CC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ig(e){this._internalRoot=e}Ud.prototype.render=Ig.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Bd(e,t,null,null)};Ud.prototype.unmount=Ig.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ki(function(){Bd(null,e,null,null)}),t[ho]=null}};function Ud(e){this._internalRoot=e}Ud.prototype.unstable_scheduleHydration=function(e){if(e){var t=ZS();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ho.length&&t!==0&&t<Ho[n].priority;n++);Ho.splice(n,0,e),n===0&&tb(e)}};function _g(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Sx(){}function AI(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=nd(s);i.call(u)}}var s=bC(t,r,e,0,null,!1,!1,"",Sx);return e._reactRootContainer=s,e[ho]=s.current,_l(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=nd(c);l.call(u)}}var c=Rg(e,0,!1,null,null,!1,!1,"",Sx);return e._reactRootContainer=c,e[ho]=c.current,_l(e.nodeType===8?e.parentNode:e),Ki(function(){Bd(t,c,n,r)}),c}function Hd(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=nd(s);l.call(c)}}Bd(t,s,e,o)}else s=AI(n,t,e,o,r);return nd(s)}XS=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=al(t.pendingLanes);n!==0&&(Xm(t,n|1),In(t,Dt()),!(Be&6)&&(ca=Dt()+500,vi()))}break;case 13:Ki(function(){var r=po(e,1);if(r!==null){var o=gn();Tr(r,e,1,o)}}),Dg(e,1)}};Jm=function(e){if(e.tag===13){var t=po(e,134217728);if(t!==null){var n=gn();Tr(t,e,134217728,n)}Dg(e,134217728)}};JS=function(e){if(e.tag===13){var t=oi(e),n=po(e,t);if(n!==null){var r=gn();Tr(n,e,t,r)}Dg(e,t)}};ZS=function(){return He};eb=function(e,t){var n=He;try{return He=e,t()}finally{He=n}};vp=function(e,t,n){switch(t){case"input":if(dp(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=Nd(r);if(!o)throw Error(Q(90));IS(r),dp(r,o)}}}break;case"textarea":AS(e,n);break;case"select":t=n.value,t!=null&&Qs(e,!!n.multiple,t,!1)}};zS=Eg;BS=Ki;var NI={usingClientEntryPoint:!1,Events:[rc,Ls,Nd,$S,FS,Eg]},Qa={findFiberByHostInstance:Mi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},OI={bundleType:Qa.bundleType,version:Qa.version,rendererPackageName:Qa.rendererPackageName,rendererConfig:Qa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=HS(e),e===null?null:e.stateNode},findFiberByHostInstance:Qa.findFiberByHostInstance||_I,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 eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eu.isDisabled&&eu.supportsFiber)try{Dd=eu.inject(OI),Gr=eu}catch{}}Gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NI;Gn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_g(t))throw Error(Q(200));return II(e,t,null,n)};Gn.createRoot=function(e,t){if(!_g(e))throw Error(Q(299));var n=!1,r="",o=CC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Rg(e,1,!1,null,null,n,!1,r,o),e[ho]=t.current,_l(e.nodeType===8?e.parentNode:e),new Ig(t)};Gn.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(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=HS(t),e=e===null?null:e.stateNode,e};Gn.flushSync=function(e){return Ki(e)};Gn.hydrate=function(e,t,n){if(!Vd(t))throw Error(Q(200));return Hd(null,e,t,!0,n)};Gn.hydrateRoot=function(e,t,n){if(!_g(e))throw Error(Q(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=CC;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=bC(t,null,e,1,n??null,o,!1,i,s),e[ho]=t.current,_l(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 Ud(t)};Gn.render=function(e,t,n){if(!Vd(t))throw Error(Q(200));return Hd(null,e,t,!1,n)};Gn.unmountComponentAtNode=function(e){if(!Vd(e))throw Error(Q(40));return e._reactRootContainer?(Ki(function(){Hd(null,null,e,!1,function(){e._reactRootContainer=null,e[ho]=null})}),!0):!1};Gn.unstable_batchedUpdates=Eg;Gn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Vd(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Hd(e,t,n,!1,r)};Gn.version="18.2.0-next-9e3b772b8-20220608";function jC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jC)}catch(e){console.error(e)}}jC(),bS.exports=Gn;var ic=bS.exports;const cl=km(ic),MI=Ow({__proto__:null,default:cl},[ic]),[LI,ur]=Sn("ScrollArea.Root component was not found in tree");function ua(e,t){const n=Ni(t);Ca(()=>{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 $I=b.forwardRef((e,t)=>{const{style:n,...r}=e,o=ur(),[i,s]=b.useState(0),[l,c]=b.useState(0),u=!!(i&&l);return ua(o.scrollbarX,()=>{var f;const d=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(d),c(d)}),ua(o.scrollbarY,()=>{var f;const d=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(d),s(d)}),u?b.createElement("div",{...r,ref:t,style:{...n,width:i,height:l}}):null}),FI=b.forwardRef((e,t)=>{const n=ur(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?b.createElement($I,{...e,ref:t}):null}),zI={scrollHideDelay:1e3,type:"hover"},EC=p.forwardRef((e,t)=>{const n=V("ScrollAreaRoot",zI,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),[y,C]=p.useState(null),[v,w]=p.useState(0),[x,S]=p.useState(0),[E,j]=p.useState(!1),[T,P]=p.useState(!1),R=nn(t,I=>c(I));return b.createElement(LI,{value:{type:r,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:E,onScrollbarXEnabledChange:j,scrollbarY:y,onScrollbarYChange:C,scrollbarYEnabled:T,onScrollbarYEnabledChange:P,onCornerWidthChange:w,onCornerHeightChange:S}},b.createElement(q,{...s,ref:R,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${v}px`,"--sa-corner-height":i!=="xy"?"0px":`${x}px`}}))});EC.displayName="@mantine/core/ScrollAreaRoot";function TC(e,t){const n=e/t;return Number.isNaN(n)?0:n}function Wd(e){const t=TC(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function PC(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 BI(e,[t,n]){return Math.min(n,Math.max(t,e))}function bx(e,t,n="ltr"){const r=Wd(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=BI(e,c);return PC([0,s],[0,l])(u)}function UI(e,t,n,r="ltr"){const o=Wd(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 PC([c,u],f)(e)}function kC(e,t){return e>0&&e<t}function rd(e){return e?parseInt(e,10):0}function Hi(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e==null||e(r),(n===!1||!r.defaultPrevented)&&(t==null||t(r))}}const[VI,RC]=Sn("ScrollAreaScrollbar was not found in tree"),DC=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=ur(),[m,g]=b.useState(null),y=nn(t,P=>g(P)),C=b.useRef(null),v=b.useRef(""),{viewport:w}=h,x=n.content-n.viewport,S=Ni(u),E=Ni(l),j=Pd(d,10),T=P=>{if(C.current){const R=P.clientX-C.current.left,I=P.clientY-C.current.top;c({x:R,y:I})}};return p.useEffect(()=>{const P=R=>{const I=R.target;(m==null?void 0:m.contains(I))&&S(R,x)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[w,m,x,S]),p.useEffect(E,[n,E]),ua(m,j),ua(h.content,j),b.createElement(VI,{value:{scrollbar:m,hasThumb:r,onThumbChange:Ni(o),onThumbPointerUp:Ni(i),onThumbPositionChange:E,onThumbPointerDown:Ni(s)}},b.createElement("div",{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:Hi(e.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),C.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",T(P))}),onPointerMove:Hi(e.onPointerMove,T),onPointerUp:Hi(e.onPointerUp,P=>{const R=P.target;R.hasPointerCapture(P.pointerId)&&R.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=v.current,C.current=null})}))}),HI=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=ur(),[l,c]=p.useState(),u=p.useRef(null),d=nn(t,u,s.onScrollbarXChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),b.createElement(DC,{"data-orientation":"horizontal",...i,ref:d,sizes:n,style:{...o,"--sa-thumb-width":`${Wd(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),kC(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:rd(l.paddingLeft),paddingEnd:rd(l.paddingRight)}})}})}),WI=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=ur(),[l,c]=b.useState(),u=p.useRef(null),d=nn(t,u,s.onScrollbarYChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),b.createElement(DC,{...i,"data-orientation":"vertical",ref:d,sizes:n,style:{"--sa-thumb-height":`${Wd(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),kC(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:rd(l.paddingTop),paddingEnd:rd(l.paddingBottom)}})}})}),Ag=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=Ea(),i=ur(),s=p.useRef(null),l=p.useRef(0),[c,u]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=TC(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)=>UI(m,l.current,c,g);return n==="horizontal"?b.createElement(HI,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,g=bx(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"?b.createElement(WI,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,g=bx(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}),IC=p.forwardRef((e,t)=>{const n=ur(),{forceMount:r,...o}=e,[i,s]=p.useState(!1),l=e.orientation==="horizontal",c=Pd(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?u:d)}},10);return ua(n.viewport,c),ua(n.content,c),r||i?b.createElement(Ag,{"data-state":i?"visible":"hidden",...o,ref:t}):null}),qI=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ur(),[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?b.createElement(IC,{"data-state":i?"visible":"hidden",...r,ref:t}):null}),GI=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ur(),i=e.orientation==="horizontal",[s,l]=p.useState("hidden"),c=Pd(()=>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"?b.createElement(Ag,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Hi(e.onPointerEnter,()=>l("interacting")),onPointerLeave:Hi(e.onPointerLeave,()=>l("idle"))}):null}),Cx=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ur(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,l=e.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),o.type==="hover"?b.createElement(qI,{...r,ref:t,forceMount:n}):o.type==="scroll"?b.createElement(GI,{...r,ref:t,forceMount:n}):o.type==="auto"?b.createElement(IC,{...r,ref:t,forceMount:n}):o.type==="always"?b.createElement(Ag,{...r,ref:t}):null});function QI(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 KI=p.forwardRef((e,t)=>{const{style:n,...r}=e,o=ur(),i=RC(),{onThumbPositionChange:s}=i,l=nn(t,d=>i.onThumbChange(d)),c=p.useRef(),u=Pd(()=>{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=QI(d,s);c.current=h,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,s]),b.createElement("div",{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:Hi(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:Hi(e.onPointerUp,i.onThumbPointerUp)})}),jx=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=RC();return n||o.hasThumb?b.createElement(KI,{ref:t,...r}):null}),_C=p.forwardRef(({children:e,style:t,...n},r)=>{const o=ur(),i=nn(r,o.onViewportChange);return b.createElement(q,{...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t}},b.createElement("div",{style:{minWidth:"100%",display:"table"},ref:o.onContentChange},e))});_C.displayName="@mantine/core/ScrollAreaViewport";var Ng={root:"m-d57069b5",viewport:"m-c0783ff9",viewportInner:"m-f8f631dd",scrollbar:"m-c44ba933",thumb:"m-d8b5e363",corner:"m-21657268"};const AC={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},YI=(e,{scrollbarSize:t})=>({root:{"--scrollarea-scrollbar-size":z(t)}}),dr=G((e,t)=>{const n=V("ScrollArea",AC,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:y,offsetScrollbars:C,scrollbars:v,...w}=n,[x,S]=p.useState(!1),E=ue({name:"ScrollArea",props:n,classes:Ng,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:YI});return b.createElement(EC,{type:d==="never"?"always":d,scrollHideDelay:f,ref:t,scrollbars:v,...E("root"),...w},b.createElement(_C,{...h,...E("viewport"),ref:m,"data-offset-scrollbars":C===!0?"xy":C||void 0,"data-scrollbars":v||void 0,onScroll:typeof g=="function"?({currentTarget:j})=>g({x:j.scrollLeft,y:j.scrollTop}):void 0},y),(v==="xy"||v==="x")&&b.createElement(Cx,{...E("scrollbar"),orientation:"horizontal","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)},b.createElement(jx,{...E("thumb")})),(v==="xy"||v==="y")&&b.createElement(Cx,{...E("scrollbar"),orientation:"vertical","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)},b.createElement(jx,{...E("thumb")})),b.createElement(FI,{...E("corner"),"data-hovered":x||void 0,"data-hidden":d==="never"||void 0}))});dr.displayName="@mantine/core/ScrollArea";const Og=G((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:y,style:C,vars:v,...w}=V("ScrollAreaAutosize",AC,e);return b.createElement(q,{...w,ref:t,style:[{display:"flex"},C]},b.createElement(q,{style:{display:"flex",flexDirection:"column",flex:1}},b.createElement(dr,{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:v,scrollbars:y},n)))});dr.classes=Ng;Og.displayName="@mantine/core/ScrollAreaAutosize";Og.classes=Ng;dr.Autosize=Og;var NC={root:"m-87cf2631"};const XI={__staticSelector:"UnstyledButton"},qn=un((e,t)=>{const n=V("UnstyledButton",XI,e),{className:r,component:o="button",__staticSelector:i,unstyled:s,classNames:l,styles:c,style:u,...d}=n,f=ue({name:i,props:n,classes:NC,className:r,style:u,classNames:l,styles:c,unstyled:s});return b.createElement(q,{...f("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...d})});qn.classes=NC;qn.displayName="@mantine/core/UnstyledButton";var OC={root:"m-1b7284a3"};const JI={},ZI=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:ut(t),"--paper-shadow":Om(n)}}),_n=un((e,t)=>{const n=V("Paper",JI,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,withBorder:c,vars:u,radius:d,shadow:f,variant:h,...m}=n,g=ue({name:"Paper",props:n,classes:OC,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:ZI});return b.createElement(q,{ref:t,mod:{"data-with-border":c},...g("root"),variant:h,...m})});_n.classes=OC;_n.displayName="@mantine/core/Paper";const Rr=Math.min,ln=Math.max,od=Math.round,tu=Math.floor,di=e=>({x:e,y:e}),e_={left:"right",right:"left",bottom:"top",top:"bottom"},t_={start:"end",end:"start"};function Xp(e,t,n){return ln(e,Rr(t,n))}function go(e,t){return typeof e=="function"?e(t):e}function Dr(e){return e.split("-")[0]}function ka(e){return e.split("-")[1]}function Mg(e){return e==="x"?"y":"x"}function Lg(e){return e==="y"?"height":"width"}function as(e){return["top","bottom"].includes(Dr(e))?"y":"x"}function $g(e){return Mg(as(e))}function n_(e,t,n){n===void 0&&(n=!1);const r=ka(e),o=$g(e),i=Lg(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=id(s)),[s,id(s)]}function r_(e){const t=id(e);return[Jp(e),t,Jp(t)]}function Jp(e){return e.replace(/start|end/g,t=>t_[t])}function o_(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 i_(e,t,n,r){const o=ka(e);let i=o_(Dr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Jp)))),i}function id(e){return e.replace(/left|right|bottom|top/g,t=>e_[t])}function s_(e){return{top:0,right:0,bottom:0,left:0,...e}}function Fg(e){return typeof e!="number"?s_(e):{top:e,right:e,bottom:e,left:e}}function da(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Ex(e,t,n){let{reference:r,floating:o}=e;const i=as(t),s=$g(t),l=Lg(s),c=Dr(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(ka(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const a_=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}=Ex(u,r,c),h=r,m={},g=0;for(let y=0;y<l.length;y++){const{name:C,fn:v}=l[y],{x:w,y:x,data:S,reset:E}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});if(d=w??d,f=x??f,m={...m,[C]:{...m[C],...S}},E&&g<=50){g++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:d,y:f}=Ex(u,h,c)),y=-1;continue}}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function zg(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}=go(t,e),g=Fg(m),C=l[h?f==="floating"?"reference":"floating":f],v=da(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(C)))==null||n?C:C.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=f==="floating"?{...s.floating,x:r,y:o}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},E=da(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:w,offsetParent:x,strategy:c}):w);return{top:(v.top-E.top+g.top)/S.y,bottom:(E.bottom-v.bottom+g.bottom)/S.y,left:(v.left-E.left+g.left)/S.x,right:(E.right-v.right+g.right)/S.x}}const l_=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}=go(e,t)||{};if(u==null)return{};const f=Fg(d),h={x:n,y:r},m=$g(o),g=Lg(m),y=await s.getDimensions(u),C=m==="y",v=C?"top":"left",w=C?"bottom":"right",x=C?"clientHeight":"clientWidth",S=i.reference[g]+i.reference[m]-h[m]-i.floating[g],E=h[m]-i.reference[m],j=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let T=j?j[x]:0;(!T||!await(s.isElement==null?void 0:s.isElement(j)))&&(T=l.floating[x]||i.floating[g]);const P=S/2-E/2,R=T/2-y[g]/2-1,I=Rr(f[v],R),O=Rr(f[w],R),D=I,N=T-y[g]-O,L=T/2-y[g]/2+P,B=Xp(D,L,N),F=!c.arrow&&ka(o)!=null&&L!=B&&i.reference[g]/2-(L<D?I:O)-y[g]/2<0,_=F?L<D?L-D:L-N:0;return{[m]:h[m]+_,data:{[m]:B,centerOffset:L-B-_,...F&&{alignmentOffset:_}},reset:F}}}),c_=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:y=!0,...C}=go(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Dr(o),w=Dr(l)===l,x=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(w||!y?[id(l)]:r_(l));!h&&g!=="none"&&S.push(...i_(l,y,g,x));const E=[l,...S],j=await zg(t,C),T=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&T.push(j[v]),f){const D=n_(o,s,x);T.push(j[D[0]],j[D[1]])}if(P=[...P,{placement:o,overflows:T}],!T.every(D=>D<=0)){var R,I;const D=(((R=i.flip)==null?void 0:R.index)||0)+1,N=E[D];if(N)return{data:{index:D,overflows:P},reset:{placement:N}};let L=(I=P.filter(B=>B.overflows[0]<=0).sort((B,F)=>B.overflows[1]-F.overflows[1])[0])==null?void 0:I.placement;if(!L)switch(m){case"bestFit":{var O;const B=(O=P.map(F=>[F.placement,F.overflows.filter(_=>_>0).reduce((_,k)=>_+k,0)]).sort((F,_)=>F[1]-_[1])[0])==null?void 0:O[0];B&&(L=B);break}case"initialPlacement":L=l;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function MC(e){const t=Rr(...e.map(i=>i.left)),n=Rr(...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 u_(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=>da(MC(o)))}const d_=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}=go(e,t),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),f=u_(d),h=da(MC(d)),m=Fg(l);function g(){if(f.length===2&&f[0].left>f[1].right&&c!=null&&u!=null)return f.find(C=>c>C.left-m.left&&c<C.right+m.right&&u>C.top-m.top&&u<C.bottom+m.bottom)||h;if(f.length>=2){if(as(n)==="y"){const I=f[0],O=f[f.length-1],D=Dr(n)==="top",N=I.top,L=O.bottom,B=D?I.left:O.left,F=D?I.right:O.right,_=F-B,k=L-N;return{top:N,bottom:L,left:B,right:F,width:_,height:k,x:B,y:N}}const C=Dr(n)==="left",v=ln(...f.map(I=>I.right)),w=Rr(...f.map(I=>I.left)),x=f.filter(I=>C?I.left===w:I.right===v),S=x[0].top,E=x[x.length-1].bottom,j=w,T=v,P=T-j,R=E-S;return{top:S,bottom:E,left:j,right:T,width:P,height:R,x:j,y:S}}return h}const y=await i.getElementRects({reference:{getBoundingClientRect:g},floating:r.floating,strategy:s});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}};async function f_(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Dr(n),l=ka(n),c=as(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=go(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 LC=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 f_(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}}}}},h_=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:C=>{let{x:v,y:w}=C;return{x:v,y:w}}},...c}=go(e,t),u={x:n,y:r},d=await zg(t,c),f=as(Dr(o)),h=Mg(f);let m=u[h],g=u[f];if(i){const C=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=m+d[C],x=m-d[v];m=Xp(w,m,x)}if(s){const C=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=g+d[C],x=g-d[v];g=Xp(w,g,x)}const y=l.fn({...t,[h]:m,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r}}}}},p_=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}=go(e,t),d={x:n,y:r},f=as(o),h=Mg(f);let m=d[h],g=d[f];const y=go(l,t),C=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const x=h==="y"?"height":"width",S=i.reference[h]-i.floating[x]+C.mainAxis,E=i.reference[h]+i.reference[x]-C.mainAxis;m<S?m=S:m>E&&(m=E)}if(u){var v,w;const x=h==="y"?"width":"height",S=["top","left"].includes(Dr(o)),E=i.reference[f]-i.floating[x]+(S&&((v=s.offset)==null?void 0:v[f])||0)+(S?0:C.crossAxis),j=i.reference[f]+i.reference[x]+(S?0:((w=s.offset)==null?void 0:w[f])||0)-(S?C.crossAxis:0);g<E?g=E:g>j&&(g=j)}return{[h]:m,[f]:g}}}},m_=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}=go(e,t),c=await zg(t,l),u=Dr(n),d=ka(n),f=as(n)==="y",{width:h,height:m}=r.floating;let g,y;u==="top"||u==="bottom"?(g=u,y=d===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(y=u,g=d==="end"?"top":"bottom");const C=m-c[g],v=h-c[y],w=!t.middlewareData.shift;let x=C,S=v;if(f){const j=h-c.left-c.right;S=d||w?Rr(v,j):j}else{const j=m-c.top-c.bottom;x=d||w?Rr(C,j):j}if(w&&!d){const j=ln(c.left,0),T=ln(c.right,0),P=ln(c.top,0),R=ln(c.bottom,0);f?S=h-2*(j!==0||T!==0?j+T:ln(c.left,c.right)):x=m-2*(P!==0||R!==0?P+R:ln(c.top,c.bottom))}await s({...t,availableWidth:S,availableHeight:x});const E=await o.getDimensions(i.floating);return h!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function fi(e){return $C(e)?(e.nodeName||"").toLowerCase():"#document"}function Hn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Eo(e){var t;return(t=($C(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $C(e){return e instanceof Node||e instanceof Hn(e).Node}function yo(e){return e instanceof Element||e instanceof Hn(e).Element}function Jr(e){return e instanceof HTMLElement||e instanceof Hn(e).HTMLElement}function Tx(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hn(e).ShadowRoot}function sc(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=lr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function g_(e){return["table","td","th"].includes(fi(e))}function Bg(e){const t=Ug(),n=lr(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 y_(e){let t=fa(e);for(;Jr(t)&&!qd(t);){if(Bg(t))return t;t=fa(t)}return null}function Ug(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function qd(e){return["html","body","#document"].includes(fi(e))}function lr(e){return Hn(e).getComputedStyle(e)}function Gd(e){return yo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function fa(e){if(fi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tx(e)&&e.host||Eo(e);return Tx(t)?t.host:t}function FC(e){const t=fa(e);return qd(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jr(t)&&sc(t)?t:FC(t)}function lo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=FC(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Hn(o);return i?t.concat(s,s.visualViewport||[],sc(o)?o:[],s.frameElement&&n?lo(s.frameElement):[]):t.concat(o,lo(o,[],n))}function zC(e){const t=lr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jr(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=od(n)!==i||od(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function Vg(e){return yo(e)?e:e.contextElement}function ea(e){const t=Vg(e);if(!Jr(t))return di(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=zC(t);let s=(i?od(n.width):n.width)/r,l=(i?od(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const v_=di(0);function BC(e){const t=Hn(e);return!Ug()||!t.visualViewport?v_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function x_(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Hn(e)?!1:t}function Yi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Vg(e);let s=di(1);t&&(r?yo(r)&&(s=ea(r)):s=ea(e));const l=x_(i,n,r)?BC(i):di(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=Hn(i),m=r&&yo(r)?Hn(r):r;let g=h.frameElement;for(;g&&r&&m!==h;){const y=ea(g),C=g.getBoundingClientRect(),v=lr(g),w=C.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,x=C.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=w,u+=x,g=Hn(g).frameElement}}return da({width:d,height:f,x:c,y:u})}function w_(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Jr(n),i=Eo(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},l=di(1);const c=di(0);if((o||!o&&r!=="fixed")&&((fi(n)!=="body"||sc(i))&&(s=Gd(n)),Jr(n))){const u=Yi(n);l=ea(n),c.x=u.x+n.clientLeft,c.y=u.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-s.scrollLeft*l.x+c.x,y:t.y*l.y-s.scrollTop*l.y+c.y}}function S_(e){return Array.from(e.getClientRects())}function UC(e){return Yi(Eo(e)).left+Gd(e).scrollLeft}function b_(e){const t=Eo(e),n=Gd(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+UC(e);const l=-n.scrollTop;return lr(r).direction==="rtl"&&(s+=ln(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function C_(e,t){const n=Hn(e),r=Eo(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=Ug();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:l,y:c}}function j_(e,t){const n=Yi(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Jr(e)?ea(e):di(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 Px(e,t,n){let r;if(t==="viewport")r=C_(e,n);else if(t==="document")r=b_(Eo(e));else if(yo(t))r=j_(t,n);else{const o=BC(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return da(r)}function VC(e,t){const n=fa(e);return n===t||!yo(n)||qd(n)?!1:lr(n).position==="fixed"||VC(n,t)}function E_(e,t){const n=t.get(e);if(n)return n;let r=lo(e,[],!1).filter(l=>yo(l)&&fi(l)!=="body"),o=null;const i=lr(e).position==="fixed";let s=i?fa(e):e;for(;yo(s)&&!qd(s);){const l=lr(s),c=Bg(s);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||sc(s)&&!c&&VC(e,s))?r=r.filter(d=>d!==s):o=l,s=fa(s)}return t.set(e,r),r}function T_(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?E_(t,this._c):[].concat(n),r],l=s[0],c=s.reduce((u,d)=>{const f=Px(t,d,o);return u.top=ln(f.top,u.top),u.right=Rr(f.right,u.right),u.bottom=Rr(f.bottom,u.bottom),u.left=ln(f.left,u.left),u},Px(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function P_(e){const{width:t,height:n}=zC(e);return{width:t,height:n}}function k_(e,t,n){const r=Jr(t),o=Eo(t),i=n==="fixed",s=Yi(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=di(0);if(r||!r&&!i)if((fi(t)!=="body"||sc(o))&&(l=Gd(t)),r){const u=Yi(t,!0,i,t);c.x=u.x+t.clientLeft,c.y=u.y+t.clientTop}else o&&(c.x=UC(o));return{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function kx(e,t){return!Jr(e)||lr(e).position==="fixed"?null:t?t(e):e.offsetParent}function HC(e,t){const n=Hn(e);if(!Jr(e))return n;let r=kx(e,t);for(;r&&g_(r)&&lr(r).position==="static";)r=kx(r,t);return r&&(fi(r)==="html"||fi(r)==="body"&&lr(r).position==="static"&&!Bg(r))?n:r||y_(e)||n}const R_=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||HC,i=this.getDimensions;return{reference:k_(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function D_(e){return lr(e).direction==="rtl"}const I_={convertOffsetParentRelativeRectToViewportRelativeRect:w_,getDocumentElement:Eo,getClippingRect:T_,getOffsetParent:HC,getElementRects:R_,getClientRects:S_,getDimensions:P_,getScale:ea,isElement:yo,isRTL:D_};function __(e,t){let n=null,r;const o=Eo(e);function i(){clearTimeout(r),n&&n.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=tu(d),g=tu(o.clientWidth-(u+f)),y=tu(o.clientHeight-(d+h)),C=tu(u),w={rootMargin:-m+"px "+-g+"px "+-y+"px "+-C+"px",threshold:ln(0,Rr(1,c))||1};let x=!0;function S(E){const j=E[0].intersectionRatio;if(j!==c){if(!x)return s();j?s(!1,j):r=setTimeout(()=>{s(!1,1e-7)},100)}x=!1}try{n=new IntersectionObserver(S,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(e)}return s(!0),i}function A_(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=Vg(e),d=o||i?[...u?lo(u):[],...lo(t)]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=u&&l?__(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(v=>{let[w]=v;w&&w.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{m&&m.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let g,y=c?Yi(e):null;c&&C();function C(){const v=Yi(e);y&&(v.x!==y.x||v.y!==y.y||v.width!==y.width||v.height!==y.height)&&n(),y=v,g=requestAnimationFrame(C)}return n(),()=>{d.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f&&f(),m&&m.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const Hg=h_,WC=c_,N_=m_,Rx=l_,qC=d_,O_=p_,M_=(e,t,n)=>{const r=new Map,o={platform:I_,...n},i={...o.platform,_c:r};return a_(e,t,{...o,platform:i})},GC=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?Rx({element:r.current,padding:o}).fn(n):{}:r?Rx({element:r,padding:o}).fn(n):{}}}};var Cu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function sd(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(!sd(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)&&!sd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function QC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dx(e,t){const n=QC(e);return Math.round(t*n)/n}function Ix(e){const t=p.useRef(e);return Cu(()=>{t.current=e}),t}function L_(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);sd(h,r)||m(r);const[g,y]=p.useState(null),[C,v]=p.useState(null),w=p.useCallback(F=>{F!=j.current&&(j.current=F,y(F))},[y]),x=p.useCallback(F=>{F!==T.current&&(T.current=F,v(F))},[v]),S=i||g,E=s||C,j=p.useRef(null),T=p.useRef(null),P=p.useRef(d),R=Ix(c),I=Ix(o),O=p.useCallback(()=>{if(!j.current||!T.current)return;const F={placement:t,strategy:n,middleware:h};I.current&&(F.platform=I.current),M_(j.current,T.current,F).then(_=>{const k={..._,isPositioned:!0};D.current&&!sd(P.current,k)&&(P.current=k,ic.flushSync(()=>{f(k)}))})},[h,t,n,I]);Cu(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[u]);const D=p.useRef(!1);Cu(()=>(D.current=!0,()=>{D.current=!1}),[]),Cu(()=>{if(S&&(j.current=S),E&&(T.current=E),S&&E){if(R.current)return R.current(S,E,O);O()}},[S,E,O,R]);const N=p.useMemo(()=>({reference:j,floating:T,setReference:w,setFloating:x}),[w,x]),L=p.useMemo(()=>({reference:S,floating:E}),[S,E]),B=p.useMemo(()=>{const F={position:n,left:0,top:0};if(!L.floating)return F;const _=Dx(L.floating,d.x),k=Dx(L.floating,d.y);return l?{...F,transform:"translate("+_+"px, "+k+"px)",...QC(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:k}},[n,l,L.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:O,refs:N,elements:L,floatingStyles:B}),[d,O,N,L,B])}var co=typeof document<"u"?p.useLayoutEffect:p.useEffect;let Oh=!1,$_=0;const _x=()=>"floating-ui-"+$_++;function F_(){const[e,t]=p.useState(()=>Oh?_x():void 0);return co(()=>{e==null&&t(_x())},[]),p.useEffect(()=>{Oh||(Oh=!0)},[]),e}const z_=Am.useId,KC=z_||F_;function B_(){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 U_=p.createContext(null),V_=p.createContext(null),YC=()=>{var e;return((e=p.useContext(U_))==null?void 0:e.id)||null},Wg=()=>p.useContext(V_);function Ko(e){return(e==null?void 0:e.ownerDocument)||document}function H_(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function W_(){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 Qd(e){return Ko(e).defaultView||window}function qr(e){return e?e instanceof Element||e instanceof Qd(e).Element:!1}function XC(e){return e?e instanceof HTMLElement||e instanceof Qd(e).HTMLElement:!1}function q_(e){if(typeof ShadowRoot>"u")return!1;const t=Qd(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function G_(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(H_())||t.test(W_()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Q_(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 JC(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function K_(e){return"nativeEvent"in e}function Zp(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&q_(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ZC(e){return"data-floating-ui-"+e}function Ax(e){const t=p.useRef(e);return co(()=>{t.current=e}),t}const Nx=ZC("safe-polygon");function ju(e,t,n){return n&&!JC(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}function Y_(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,y=Wg(),C=YC(),v=Ax(f),w=Ax(d),x=p.useRef(),S=p.useRef(),E=p.useRef(),j=p.useRef(),T=p.useRef(!0),P=p.useRef(!1),R=p.useRef(()=>{}),I=p.useCallback(()=>{var L;const B=(L=o.current.openEvent)==null?void 0:L.type;return(B==null?void 0:B.includes("mouse"))&&B!=="mousedown"},[o]);p.useEffect(()=>{if(!u)return;function L(){clearTimeout(S.current),clearTimeout(j.current),T.current=!0}return i.on("dismiss",L),()=>{i.off("dismiss",L)}},[u,i]),p.useEffect(()=>{if(!u||!v.current||!n)return;function L(F){I()&&r(!1,F)}const B=Ko(l).documentElement;return B.addEventListener("mouseleave",L),()=>{B.removeEventListener("mouseleave",L)}},[l,n,r,u,v,o,I]);const O=p.useCallback(function(L,B){B===void 0&&(B=!0);const F=ju(w.current,"close",x.current);F&&!E.current?(clearTimeout(S.current),S.current=setTimeout(()=>r(!1,L),F)):B&&(clearTimeout(S.current),r(!1,L))},[w,r]),D=p.useCallback(()=>{R.current(),E.current=void 0},[]),N=p.useCallback(()=>{if(P.current){const L=Ko(c.floating.current).body;L.style.pointerEvents="",L.removeAttribute(Nx),P.current=!1}},[c]);return p.useEffect(()=>{if(!u)return;function L(){return o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1}function B(k){if(clearTimeout(S.current),T.current=!1,h&&!JC(x.current)||m>0&&ju(w.current,"open")===0)return;const M=ju(w.current,"open",x.current);M?S.current=setTimeout(()=>{r(!0,k)},M):r(!0,k)}function F(k){if(L())return;R.current();const M=Ko(l);if(clearTimeout(j.current),v.current){n||clearTimeout(S.current),E.current=v.current({...e,tree:y,x:k.clientX,y:k.clientY,onClose(){N(),D(),O(k)}});const K=E.current;M.addEventListener("mousemove",K),R.current=()=>{M.removeEventListener("mousemove",K)};return}(x.current==="touch"?!Zp(l,k.relatedTarget):!0)&&O(k)}function _(k){L()||v.current==null||v.current({...e,tree:y,x:k.clientX,y:k.clientY,onClose(){N(),D(),O(k)}})(k)}if(qr(s)){const k=s;return n&&k.addEventListener("mouseleave",_),l==null||l.addEventListener("mouseleave",_),g&&k.addEventListener("mousemove",B,{once:!0}),k.addEventListener("mouseenter",B),k.addEventListener("mouseleave",F),()=>{n&&k.removeEventListener("mouseleave",_),l==null||l.removeEventListener("mouseleave",_),g&&k.removeEventListener("mousemove",B),k.removeEventListener("mouseenter",B),k.removeEventListener("mouseleave",F)}}},[s,l,u,e,h,m,g,O,D,N,r,n,y,w,v,o]),co(()=>{var L;if(u&&n&&(L=v.current)!=null&&L.__options.blockPointerEvents&&I()){const _=Ko(l).body;if(_.setAttribute(Nx,""),_.style.pointerEvents="none",P.current=!0,qr(s)&&l){var B,F;const k=s,M=y==null||(B=y.nodesRef.current.find(W=>W.id===C))==null||(F=B.context)==null?void 0:F.elements.floating;return M&&(M.style.pointerEvents=""),k.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{k.style.pointerEvents="",l.style.pointerEvents=""}}}},[u,n,C,l,s,y,v,o,I]),co(()=>{n||(x.current=void 0,D(),N())},[n,D,N]),p.useEffect(()=>()=>{D(),clearTimeout(S.current),clearTimeout(j.current),N()},[u,D,N]),p.useMemo(()=>{if(!u)return{};function L(B){x.current=B.pointerType}return{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(B){n||m===0||(clearTimeout(j.current),j.current=setTimeout(()=>{T.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 ej=p.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),tj=()=>p.useContext(ej),X_=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 co(()=>{o.currentId?s.current===null?s.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),s.current=null)},[o.currentId]),p.createElement(ej.Provider,{value:p.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,i,l])},t)},J_=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:i,setCurrentId:s,initialDelay:l,setState:c,timeoutMs:u}=tj();co(()=>{i&&(c({delay:{open:1,close:ju(l,"close")}}),i!==o&&r(!1))},[o,r,c,i,l]),co(()=>{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]),co(()=>{n&&s(o)},[n,s,o])};function Z_(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 Mh(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 e4(e){return"composedPath"in e?e.composedPath()[0]:e.target}const t4=Am.useInsertionEffect,n4=t4||(e=>e());function Eu(e){const t=p.useRef(()=>{});return n4(()=>{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 Tu(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 r4={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},o4={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},i4=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 s4(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:y="pointerdown",ancestorScroll:C=!1,bubbles:v}=t,w=Wg(),x=YC()!=null,S=Eu(typeof h=="function"?h:()=>!1),E=typeof h=="function"?S:h,j=p.useRef(!1),{escapeKeyBubbles:T,outsidePressBubbles:P}=i4(v),R=Eu(O=>{if(!n||!d||!f||O.key!=="Escape")return;const D=w?Mh(w.nodesRef.current,i):[];if(!T&&(O.stopPropagation(),D.length>0)){let N=!0;if(D.forEach(L=>{var B;if((B=L.context)!=null&&B.open&&!L.context.dataRef.current.__escapeKeyBubbles){N=!1;return}}),!N)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1,K_(O)?O.nativeEvent:O)}),I=Eu(O=>{const D=j.current;if(j.current=!1,D||typeof E=="function"&&!E(O))return;const N=e4(O);if(XC(N)&&c){const F=N.clientWidth>0&&N.scrollWidth>N.clientWidth,_=N.clientHeight>0&&N.scrollHeight>N.clientHeight;let k=_&&O.offsetX>N.clientWidth;if(_&&Qd(c).getComputedStyle(N).direction==="rtl"&&(k=O.offsetX<=N.offsetWidth-N.clientWidth),k||F&&O.offsetY>N.clientHeight)return}const L=w&&Mh(w.nodesRef.current,i).some(F=>{var _;return Tu(O,(_=F.context)==null?void 0:_.elements.floating)});if(Tu(O,c)||Tu(O,l)||L)return;const B=w?Mh(w.nodesRef.current,i):[];if(B.length>0){let F=!0;if(B.forEach(_=>{var k;if((k=_.context)!=null&&k.open&&!_.context.dataRef.current.__outsidePressBubbles){F=!1;return}}),!F)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:x?{preventScroll:!0}:G_(O)||Q_(O)}}),r(!1,O)});return p.useEffect(()=>{if(!n||!d)return;u.current.__escapeKeyBubbles=T,u.current.__outsidePressBubbles=P;function O(L){r(!1,L)}const D=Ko(c);f&&D.addEventListener("keydown",R),E&&D.addEventListener(m,I);let N=[];return C&&(qr(l)&&(N=lo(l)),qr(c)&&(N=N.concat(lo(c))),!qr(s)&&s&&s.contextElement&&(N=N.concat(lo(s.contextElement)))),N=N.filter(L=>{var B;return L!==((B=D.defaultView)==null?void 0:B.visualViewport)}),N.forEach(L=>{L.addEventListener("scroll",O,{passive:!0})}),()=>{f&&D.removeEventListener("keydown",R),E&&D.removeEventListener(m,I),N.forEach(L=>{L.removeEventListener("scroll",O)})}},[u,c,l,s,f,E,m,n,r,C,d,T,P,R,I]),p.useEffect(()=>{j.current=!1},[E,m]),p.useMemo(()=>d?{reference:{onKeyDown:R,[r4[y]]:O=>{g&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1,O.nativeEvent))}},floating:{onKeyDown:R,[o4[m]]:()=>{j.current=!0}}}:{},[d,o,g,m,y,r,R])}function qg(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=L_(e),u=Wg(),d=Eu((S,E)=>{S&&(h.current.openEvent=E),r==null||r(S,E)}),f=p.useRef(null),h=p.useRef({}),m=p.useState(()=>B_())[0],g=KC(),y=p.useCallback(S=>{const E=qr(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;c.refs.setReference(E)},[c.refs]),C=p.useCallback(S=>{(qr(S)||S===null)&&(f.current=S,s(S)),(qr(c.refs.reference.current)||c.refs.reference.current===null||S!==null&&!qr(S))&&c.refs.setReference(S)},[c.refs]),v=p.useMemo(()=>({...c.refs,setReference:C,setPositionReference:y,domReference:f}),[c.refs,C,y]),w=p.useMemo(()=>({...c.elements,domReference:l}),[c.elements,l]),x=p.useMemo(()=>({...c,refs:v,elements:w,dataRef:h,nodeId:o,floatingId:g,events:m,open:n,onOpenChange:d}),[c,o,g,m,n,d,v,w]);return co(()=>{const S=u==null?void 0:u.nodesRef.current.find(E=>E.id===o);S&&(S.context=x)}),p.useMemo(()=>({...c,context:x,refs:v,elements:w}),[c,v,w,x])}function a4(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 y=Ko(l).defaultView||window;function C(){!n&&XC(c)&&c===Z_(Ko(c))&&(h.current=!0)}return y.addEventListener("blur",C),()=>{y.removeEventListener("blur",C)}},[l,c,n,u]),p.useEffect(()=>{if(!u)return;function g(y){(y.type==="referencePress"||y.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:y}=g;f.current=y,h.current=!!(y&&d)},onMouseLeave(){h.current=!1},onFocus(g){var y;h.current||g.type==="focus"&&((y=o.current.openEvent)==null?void 0:y.type)==="mousedown"&&Tu(o.current.openEvent,c)||r(!0,g.nativeEvent)},onBlur(g){h.current=!1;const y=g.relatedTarget,C=qr(y)&&y.hasAttribute(ZC("focus-guard"))&&y.getAttribute("data-type")==="outside";m.current=setTimeout(()=>{Zp(s.floating.current,y)||Zp(c,y)||C||r(!1,g.nativeEvent)})}}}:{},[u,d,c,s,o,r])}function Lh(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 l4(e){e===void 0&&(e=[]);const t=e,n=p.useCallback(i=>Lh(i,e,"reference"),t),r=p.useCallback(i=>Lh(i,e,"floating"),t),o=p.useCallback(i=>Lh(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 c4(e,t){t===void 0&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,s=KC();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 nj(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 Ox(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function Mx(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 u4={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function d4({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",[u4[c]]:z(r)},f=z(-t/2);return c==="left"?{...d,...Ox(u,s,n,o),right:f,borderLeftColor:"transparent",borderBottomColor:"transparent"}:c==="right"?{...d,...Ox(u,s,n,o),left:f,borderRightColor:"transparent",borderTopColor:"transparent"}:c==="top"?{...d,...Mx(u,i,n,o,l),bottom:f,borderTopColor:"transparent",borderLeftColor:"transparent"}:c==="bottom"?{...d,...Mx(u,i,n,o,l),top:f,borderBottomColor:"transparent",borderRightColor:"transparent"}:{}}const Gg=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}=Ea();return i?b.createElement("div",{...u,ref:d,style:{...c,...d4({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:f,arrowX:s,arrowY:l})}}):null});Gg.displayName="@mantine/core/FloatingArrow";const[f4,rj]=Sn("Popover component was not found in the tree");function Qg({children:e,active:t=!0,refProp:n="ref"}){const r=R2(t),o=nn(r,e==null?void 0:e.ref);return bo(e)?p.cloneElement(e,{[n]:o}):e}Qg.displayName="@mantine/core/FocusTrap";function h4(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 p4={},oj=p.forwardRef((e,t)=>{const{children:n,target:r,...o}=V("Portal",p4,e),[i,s]=p.useState(!1),l=p.useRef(null);return Ca(()=>(s(!0),l.current=r?typeof r=="string"?document.querySelector(r):r:h4(o),$m(t,l.current),!r&&l.current&&document.body.appendChild(l.current),()=>{!r&&l.current&&document.body.removeChild(l.current)}),[r]),!i||!l.current?null:ic.createPortal(b.createElement(b.Fragment,null,n),l.current)});oj.displayName="@mantine/core/Portal";function ls({withinPortal:e=!0,children:t,...n}){return e?b.createElement(oj,{...n},t):b.createElement(b.Fragment,null,t)}ls.displayName="@mantine/core/OptionalPortal";const Ka=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${z(e==="bottom"?10:-10)})`},transitionProperty:"transform, opacity"}),nu={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:{...Ka("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...Ka("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...Ka("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...Ka("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...Ka("top"),common:{transformOrigin:"top right"}}},Lx={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function m4({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in nu?{transitionProperty:nu[e].transitionProperty,...o,...nu[e].common,...nu[e][Lx[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[Lx[t]]}}function g4({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:i,onEntered:s,onExited:l}){const c=_t(),u=Fm(),d=c.respectReducedMotion?u:!1,[f,h]=p.useState(d?0:e),[m,g]=p.useState(r?"entered":"exited"),y=p.useRef(-1),C=v=>{const w=v?o:i,x=v?s:l;g(v?"pre-entering":"pre-exiting"),window.clearTimeout(y.current);const S=d?0:v?e:t;if(h(S),S===0)typeof w=="function"&&w(),typeof x=="function"&&x(),g(v?"entered":"exited");else{const E=window.setTimeout(()=>{typeof w=="function"&&w(),g(v?"entering":"exiting")},10);y.current=window.setTimeout(()=>{window.clearTimeout(E),typeof x=="function"&&x(),g(v?"entered":"exited")},S)}};return uo(()=>{C(r)},[r]),p.useEffect(()=>()=>window.clearTimeout(y.current),[]),{transitionDuration:f,transitionStatus:m,transitionTimingFunction:n||"ease"}}function cs({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}=g4({mounted:o,exitDuration:r,duration:n,timingFunction:s,onExit:l,onEntered:c,onEnter:u,onExited:d});return f===0?o?b.createElement(b.Fragment,null,i({})):e?i({display:"none"}):null:h==="exited"?e?i({display:"none"}):null:b.createElement(b.Fragment,null,i(m4({transition:t,duration:f,state:h,timingFunction:m})))}cs.displayName="@mantine/core/Transition";var ij={dropdown:"m-38a85659",arrow:"m-a31dc6c1"};const y4={},Kg=G((e,t)=>{var C,v,w,x;const n=V("PopoverDropdown",y4,e),{className:r,style:o,vars:i,children:s,onKeyDownCapture:l,variant:c,classNames:u,styles:d,...f}=n,h=rj(),m=iS({opened:h.opened,shouldReturnFocus:h.returnFocus}),g=h.withRoles?{"aria-labelledby":h.getTargetId(),id:h.getDropdownId(),role:"dialog",tabIndex:-1}:{},y=nn(t,h.floating);return h.disabled?null:b.createElement(ls,{...h.portalProps,withinPortal:h.withinPortal},b.createElement(cs,{mounted:h.opened,...h.transitionProps,transition:((C=h.transitionProps)==null?void 0:C.transition)||"fade",duration:((v=h.transitionProps)==null?void 0:v.duration)??150,keepMounted:h.keepMounted,exitDuration:typeof((w=h.transitionProps)==null?void 0:w.exitDuration)=="number"?h.transitionProps.exitDuration:(x=h.transitionProps)==null?void 0:x.duration},S=>b.createElement(Qg,{active:h.trapFocus},b.createElement(q,{...g,...f,variant:c,ref:y,onKeyDownCapture:f2(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,b.createElement(Gg,{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})})))))});Kg.classes=ij;Kg.displayName="@mantine/core/PopoverDropdown";const v4={refProp:"ref",popupType:"dialog"},sj=G((e,t)=>{const{children:n,refProp:r,popupType:o,...i}=V("PopoverTarget",v4,e);if(!bo(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=rj(),c=nn(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:We(l.targetProps.className,s.className,n.props.className),[r]:c,...l.controlled?null:{onClick:l.onToggle}})});sj.displayName="@mantine/core/PopoverTarget";function aj({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 A_(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),uo(()=>{t.update()},r),uo(()=>{i(s=>s+1)},[e])}function x4(e,t){var r,o,i,s;const n=[LC(e.offset)];return(r=e.middlewares)!=null&&r.shift&&n.push(Hg({limiter:O_()})),(o=e.middlewares)!=null&&o.flip&&n.push(WC()),(i=e.middlewares)!=null&&i.inline&&n.push(qC()),n.push(GC({element:e.arrowRef,padding:e.arrowOffset})),((s=e.middlewares)!=null&&s.size||e.width==="target")&&n.push(N_({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 w4(e){const[t,n]=vn({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=qg({placement:e.position,middleware:x4(e,()=>i)});return aj({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies||[],floating:i}),uo(()=>{var s;(s=e.onPositionChange)==null||s.call(e,i.placement)},[i.placement]),uo(()=>{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 S4={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:_r("popover"),__staticSelector:"Popover",width:"max-content"},b4=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:ut(t),"--popover-shadow":Om(n)}});function Ar(e){var mr,Kn,_o,$t,to,ee;const t=V("Popover",S4,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:y,unstyled:C,classNames:v,styles:w,closeOnClickOutside:x,withinPortal:S,portalProps:E,closeOnEscape:j,clickOutsideEvents:T,trapFocus:P,onClose:R,onOpen:I,onChange:O,zIndex:D,radius:N,shadow:L,id:B,defaultOpened:F,__staticSelector:_,withRoles:k,disabled:M,returnFocus:W,variant:K,keepMounted:ie,vars:ve,...Ee}=t,Ne=ue({name:_,props:t,classes:ij,classNames:v,styles:w,unstyled:C,rootSelector:"dropdown",vars:ve,varsResolver:b4}),je=p.useRef(null),[Ue,dt]=p.useState(null),[ft,rn]=p.useState(null),{dir:Ge}=Ea(),Nt=Ln(B),Xe=w4({middlewares:d,width:u,position:nj(Ge,r),offset:typeof o=="number"?o+(f?h/2:0):o,arrowRef:je,arrowOffset:m,onPositionChange:i,positionDependencies:s,opened:l,defaultOpened:F,onChange:O,onOpen:I,onClose:R});x2(()=>x&&Xe.onClose(),T,[Ue,ft]);const Ot=p.useCallback(be=>{dt(be),Xe.floating.refs.setReference(be)},[Xe.floating.refs.setReference]),Pt=p.useCallback(be=>{rn(be),Xe.floating.refs.setFloating(be)},[Xe.floating.refs.setFloating]);return b.createElement(f4,{value:{returnFocus:W,disabled:M,controlled:Xe.controlled,reference:Ot,floating:Pt,x:Xe.floating.x,y:Xe.floating.y,arrowX:(_o=(Kn=(mr=Xe.floating)==null?void 0:mr.middlewareData)==null?void 0:Kn.arrow)==null?void 0:_o.x,arrowY:(ee=(to=($t=Xe.floating)==null?void 0:$t.middlewareData)==null?void 0:to.arrow)==null?void 0:ee.y,opened:Xe.opened,arrowRef:je,transitionProps:c,width:u,withArrow:f,arrowSize:h,arrowOffset:m,arrowRadius:g,arrowPosition:y,placement:Xe.floating.placement,trapFocus:P,withinPortal:S,portalProps:E,zIndex:D,radius:N,shadow:L,closeOnEscape:j,onClose:Xe.onClose,onToggle:Xe.onToggle,getTargetId:()=>`${Nt}-target`,getDropdownId:()=>`${Nt}-dropdown`,withRoles:k,targetProps:Ee,__staticSelector:_,classNames:v,styles:w,unstyled:C,variant:K,keepMounted:ie,getStyles:Ne}},n)}Ar.Target=sj;Ar.Dropdown=Kg;Ar.displayName="@mantine/core/Popover";Ar.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 C4=p.forwardRef(({className:e,...t},n)=>b.createElement(q,{component:"span",className:We(jr.barsLoader,e),...t,ref:n},b.createElement("span",{className:jr.bar}),b.createElement("span",{className:jr.bar}),b.createElement("span",{className:jr.bar}))),j4=p.forwardRef(({className:e,...t},n)=>b.createElement(q,{component:"span",className:We(jr.dotsLoader,e),...t,ref:n},b.createElement("span",{className:jr.dot}),b.createElement("span",{className:jr.dot}),b.createElement("span",{className:jr.dot}))),E4=p.forwardRef(({className:e,...t},n)=>b.createElement(q,{component:"span",className:We(jr.ovalLoader,e),...t,ref:n})),lj={bars:C4,oval:E4,dots:j4},T4={loaders:lj,type:"oval"},P4=(e,{size:t,color:n})=>({root:{"--loader-size":Ce(t,"loader-size"),"--loader-color":n?gt(n,e):void 0}}),Nn=G((e,t)=>{const n=V("Loader",T4,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,...y}=n,C=ue({name:"Loader",props:n,classes:jr,className:l,style:c,classNames:u,styles:d,unstyled:f,vars:s,varsResolver:P4});return g?b.createElement(q,{...C("root"),ref:t,...y},g):b.createElement(q,{...C("root"),ref:t,component:h[i],variant:m,size:r,...y})});Nn.defaultLoaders=lj;Nn.classes=jr;Nn.displayName="@mantine/core/Loader";var Kd={root:"m-8d3f4000",loader:"m-302b9fb1",group:"m-1a0f1b21"};const $x={orientation:"horizontal"},k4=(e,{borderWidth:t})=>({group:{"--ai-border-width":z(t)}}),Yg=G((e,t)=>{const n=V("ActionIconGroup",$x,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,...h}=V("ActionIconGroup",$x,e),m=ue({name:"ActionIconGroup",props:n,classes:Kd,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:k4,rootSelector:"group"});return b.createElement(q,{...m("group"),ref:t,variant:f,mod:{"data-orientation":c},role:"group",...h})});Yg.classes=Kd;Yg.displayName="@mantine/core/ActionIconGroup";const R4={},D4=(e,{size:t,radius:n,variant:r,gradient:o,color:i})=>{const s=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled"});return{root:{"--ai-size":Ce(t,"ai-size"),"--ai-radius":n===void 0?void 0:ut(n),"--ai-bg":i||r?s.background:void 0,"--ai-hover":i||r?s.hover:void 0,"--ai-hover-color":i||r?s.hoverColor:void 0,"--ai-color":i||r?s.color:void 0,"--ai-bd":i||r?s.border:void 0}}},Vt=un((e,t)=>{const n=V("ActionIcon",R4,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:y,vars:C,children:v,disabled:w,"data-disabled":x,...S}=n,E=ue({name:["ActionIcon",g],props:n,className:r,style:c,classes:Kd,classNames:s,styles:l,unstyled:o,vars:C,varsResolver:D4});return b.createElement(qn,{...E("root",{active:!w&&!u&&!x}),...S,unstyled:o,variant:i,size:f,disabled:w||u,ref:t,mod:{loading:u,disabled:w||x}},u?b.createElement(Nn,{...E("loader"),color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...d}):v)});Vt.classes=Kd;Vt.displayName="@mantine/core/ActionIcon";Vt.Group=Yg;const cj=p.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>b.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},b.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"})));cj.displayName="@mantine/core/CloseIcon";var uj={root:"m-86a44da5","root--subtle":"m-220c80f2"};const I4={variant:"subtle"},_4=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":Ce(t,"cb-size"),"--cb-radius":n===void 0?void 0:ut(n),"--cb-icon-size":z(r)}}),us=un((e,t)=>{const n=V("CloseButton",I4,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,...y}=n,C=ue({name:"CloseButton",props:n,className:l,style:u,classes:uj,classNames:c,styles:d,unstyled:f,vars:i,varsResolver:_4});return b.createElement(qn,{ref:t,...y,unstyled:f,variant:g,disabled:m,mod:{disabled:m||h},...C("root",{variant:g,active:!0})},b.createElement(cj,null),o)});us.classes=uj;us.displayName="@mantine/core/CloseButton";function A4(e){return p.Children.toArray(e).filter(Boolean)}var dj={root:"m-4081bf90"};const N4={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},O4=(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":Yt(r),"--group-align":o,"--group-justify":i,"--group-wrap":s}}),Y=G((e,t)=>{const n=V("Group",N4,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:y,variant:C,__size:v,...w}=n,x=A4(c),S=x.length,E=Yt(u??"md"),T={childWidth:`calc(${100/S}% - (${E} - ${E} / ${S}))`},P=ue({name:"Group",props:n,stylesCtx:T,className:o,style:i,classes:dj,classNames:r,styles:s,unstyled:l,vars:y,varsResolver:O4});return b.createElement(q,{...P("root"),ref:t,variant:C,mod:{grow:m},size:v,...w},x)});Y.classes=dj;Y.displayName="@mantine/core/Group";var fj={root:"m-9814e45f"};const M4={zIndex:_r("modal")},L4=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:i,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&Kt(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${z(o)})`:void 0,"--overlay-radius":i===void 0?void 0:ut(i),"--overlay-z-index":s==null?void 0:s.toString()}}),Bl=un((e,t)=>{const n=V("Overlay",M4,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:y,color:C,backgroundOpacity:v,...w}=n,x=ue({name:"Overlay",props:n,classes:fj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:L4});return b.createElement(q,{ref:t,...x("root"),mod:{center:d,fixed:u},...w},f)});Bl.classes=fj;Bl.displayName="@mantine/core/Overlay";const[$4,To]=Sn("ModalBase component was not found in tree");function F4({opened:e,transitionDuration:t}){const[n,r]=p.useState(e),o=p.useRef(),s=Fm()?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 z4({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:i,returnFocus:s}){const l=Ln(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=F4({opened:n,transitionDuration:h});return cS("keydown",g=>{!r&&g.key==="Escape"&&o&&i()}),iS({opened:n,shouldReturnFocus:r&&s}),{_id:l,titleMounted:c,bodyMounted:d,shouldLockScroll:m,setTitleMounted:u,setBodyMounted:f}}const B4=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:y,__vars:C,unstyled:v,removeScrollProps:w,...x},S)=>{const{_id:E,titleMounted:j,bodyMounted:T,shouldLockScroll:P,setTitleMounted:R,setBodyMounted:I}=z4({id:r,transitionProps:o,opened:t,trapFocus:i,closeOnEscape:s,onClose:n,returnFocus:l});return b.createElement(ls,{...d,withinPortal:u},b.createElement($4,{value:{opened:t,onClose:n,closeOnClickOutside:c,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${E}-title`,getBodyId:()=>`${E}-body`,titleMounted:j,bodyMounted:T,setTitleMounted:R,setBodyMounted:I,trapFocus:i,closeOnEscape:s,zIndex:m,unstyled:v}},b.createElement(Ed,{enabled:P&&f,...w},b.createElement(q,{ref:S,...x,__vars:{...C,"--mb-z-index":(m||_r("modal")).toString(),"--mb-shadow":Om(g),"--mb-padding":Yt(y)}},h))))});function U4(){const e=To();return p.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var ha={title:"m-615af6c9",header:"m-b5489c3c",inner:"m-60c222c7",content:"m-fd1ab0aa",close:"m-606cb269",body:"m-5df29311"};const hj=p.forwardRef(({className:e,...t},n)=>{const r=U4(),o=To();return b.createElement(q,{ref:n,...t,id:r,className:We({[ha.body]:!o.unstyled},e)})});hj.displayName="@mantine/core/ModalBaseBody";const pj=p.forwardRef(({className:e,onClick:t,...n},r)=>{const o=To();return b.createElement(us,{ref:r,...n,onClick:i=>{o.onClose(),t==null||t(i)},className:We({[ha.close]:!o.unstyled},e),unstyled:o.unstyled})});pj.displayName="@mantine/core/ModalBaseCloseButton";const V4=p.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...i},s)=>{const l=To(),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 b.createElement(cs,{mounted:l.opened,transition:"pop",...l.transitionProps,...e},u=>b.createElement("div",{...n,className:We({[ha.inner]:!l.unstyled},n.className)},b.createElement(Qg,{active:l.opened&&l.trapFocus},b.createElement(_n,{...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:We({[ha.content]:!l.unstyled},t),unstyled:l.unstyled},i.children))))}),mj=p.forwardRef(({className:e,...t},n)=>{const r=To();return b.createElement(q,{component:"header",ref:n,className:We({[ha.header]:!r.unstyled},e),...t})});mj.displayName="@mantine/core/ModalBaseHeader";const H4={duration:200,timingFunction:"ease",transition:"fade"};function W4(e){const t=To();return{...H4,...t.transitionProps,...e}}const gj=p.forwardRef(({onClick:e,transitionProps:t,style:n,...r},o)=>{const i=To(),s=W4(t);return b.createElement(cs,{mounted:i.opened,...s,transition:"fade"},l=>b.createElement(Bl,{ref:o,fixed:!0,style:[n,l],zIndex:i.zIndex,unstyled:i.unstyled,onClick:c=>{e==null||e(c),i.closeOnClickOutside&&i.onClose()},...r}))});gj.displayName="@mantine/core/ModalBaseOverlay";function q4(){const e=To();return p.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const yj=p.forwardRef(({className:e,...t},n)=>{const r=q4(),o=To();return b.createElement(q,{component:"h2",ref:n,className:We({[ha.title]:!o.unstyled},e),...t,id:r})});yj.displayName="@mantine/core/ModalBaseTitle";function G4({children:e}){return b.createElement(b.Fragment,null,e)}const[Q4,Ra]=Zl({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var fr={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 Fx={},K4=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Jt(t)} - ${z(2)})`}}),Yd=G((e,t)=>{const n=V("InputDescription",Fx,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,__staticSelector:d,__inheritStyles:f=!0,variant:h,...m}=V("InputDescription",Fx,n),g=Ra(),y=ue({name:["InputWrapper",d],props:n,classes:fr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"description",vars:c,varsResolver:K4}),C=f&&(g==null?void 0:g.getStyles)||y;return b.createElement(q,{component:"p",ref:t,variant:h,size:u,...C("description"),...m})});Yd.classes=fr;Yd.displayName="@mantine/core/InputDescription";const Y4={},X4=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Jt(t)} - ${z(2)})`}}),Xd=G((e,t)=>{const n=V("InputError",Y4,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=ue({name:["InputWrapper",d],props:n,classes:fr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"error",vars:c,varsResolver:X4}),y=Ra(),C=f&&(y==null?void 0:y.getStyles)||g;return b.createElement(q,{component:"p",ref:t,variant:h,size:u,...C("error"),...m})});Xd.classes=fr;Xd.displayName="@mantine/core/InputError";const zx={labelElement:"label"},J4=(e,{size:t})=>({label:{"--input-label-size":Jt(t),"--input-asterisk-color":void 0}}),Jd=G((e,t)=>{const n=V("InputLabel",zx,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:y,variant:C,...v}=V("InputLabel",zx,n),w=ue({name:["InputWrapper",y],props:n,classes:fr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"label",vars:c,varsResolver:J4}),x=Ra(),S=(x==null?void 0:x.getStyles)||w;return b.createElement(q,{...S("label"),component:u,variant:C,size:d,ref:t,htmlFor:u==="label"?h:void 0,mod:{required:f},onMouseDown:E=>{m==null||m(E),!E.defaultPrevented&&E.detail>1&&E.preventDefault()},...v},g,f&&b.createElement("span",{...S("required"),"aria-hidden":!0}," *"))});Jd.classes=fr;Jd.displayName="@mantine/core/InputLabel";const Bx={},Xg=G((e,t)=>{const n=V("InputPlaceholder",Bx,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,__staticSelector:u,variant:d,error:f,...h}=V("InputPlaceholder",Bx,n),m=ue({name:["InputPlaceholder",u],props:n,classes:fr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"placeholder"});return b.createElement(q,{...m("placeholder"),mod:{error:!!f},component:"span",variant:d,ref:t,...h})});Xg.classes=fr;Xg.displayName="@mantine/core/InputPlaceholder";function Z4(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 eA={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},tA=(e,{size:t})=>({label:{"--input-label-size":Jt(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Jt(t)} - ${z(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Jt(t)} - ${z(2)})`}}),Jg=G((e,t)=>{const n=V("InputWrapper",eA,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:y,description:C,labelProps:v,descriptionProps:w,errorProps:x,labelElement:S,children:E,withAsterisk:j,id:T,required:P,__stylesApiProps:R,...I}=n,O=ue({name:["InputWrapper",f],props:R||n,classes:fr,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:tA}),D={size:u,variant:d,__staticSelector:f},N=Ln(T),L=typeof j=="boolean"?j:P,B=(x==null?void 0:x.id)||`${N}-error`,F=(w==null?void 0:w.id)||`${N}-description`,_=N,k=!!y&&typeof y!="boolean",M=!!C,W=`${k?B:""} ${M?F:""}`,K=W.trim().length>0?W.trim():void 0,ie=(v==null?void 0:v.id)||`${N}-label`,ve=g&&b.createElement(Jd,{key:"label",labelElement:S,id:ie,htmlFor:_,required:L,...D,...v},g),Ee=M&&b.createElement(Yd,{key:"description",...w,...D,size:(w==null?void 0:w.size)||D.size,id:(w==null?void 0:w.id)||F},C),Ne=b.createElement(b.Fragment,{key:"input"},h(E)),je=k&&b.createElement(Xd,{...x,...D,size:(x==null?void 0:x.size)||D.size,key:"error",id:(x==null?void 0:x.id)||B},y),Ue=m.map(dt=>{switch(dt){case"label":return ve;case"input":return Ne;case"description":return Ee;case"error":return je;default:return null}});return b.createElement(Q4,{value:{getStyles:O,describedBy:K,inputId:_,labelId:ie,...Z4(m,{hasDescription:M,hasError:k})}},b.createElement(q,{ref:t,variant:d,size:u,mod:{error:!!y},...O("root"),...I},Ue))});Jg.classes=fr;Jg.displayName="@mantine/core/InputWrapper";const nA={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0},rA=(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":Ce(t.size,"input-height"),"--input-fz":Jt(t.size),"--input-radius":t.radius===void 0?void 0:ut(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?Ce(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),yt=un((e,t)=>{const n=V("Input",nA,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:y,leftSectionProps:C,leftSectionWidth:v,rightSection:w,rightSectionProps:x,rightSectionWidth:S,rightSectionPointerEvents:E,leftSectionPointerEvents:j,variant:T,vars:P,pointer:R,multiline:I,radius:O,id:D,withAria:N,withErrorStyles:L,...B}=n,{styleProps:F,rest:_}=Co(B),k=Ra(),M={offsetBottom:k==null?void 0:k.offsetBottom,offsetTop:k==null?void 0:k.offsetTop},W=ue({name:["Input",u],props:d||n,classes:fr,className:o,style:i,classNames:r,styles:s,unstyled:l,stylesCtx:M,rootSelector:"wrapper",vars:P,varsResolver:rA}),K=N?{required:c,disabled:g,"aria-invalid":!!m,"aria-describedby":k==null?void 0:k.describedBy,id:(k==null?void 0:k.inputId)||D}:{};return b.createElement(q,{...W("wrapper"),...F,...h,mod:{error:!!m&&L,pointer:R,disabled:g,multiline:I,"data-with-right-section":!!w,"data-with-left-section":!!y},variant:T,size:f},y&&b.createElement("div",{...C,"data-position":"left",...W("section",{className:C==null?void 0:C.className,style:C==null?void 0:C.style})},y),b.createElement(q,{component:"input",..._,...K,ref:t,required:c,mod:{disabled:g,error:!!m&&L},variant:T,...W("input")}),w&&b.createElement("div",{...x,"data-position":"right",...W("section",{className:x==null?void 0:x.className,style:x==null?void 0:x.style})},w))});yt.classes=fr;yt.Wrapper=Jg;yt.Label=Jd;yt.Error=Xd;yt.Description=Yd;yt.Placeholder=Xg;yt.displayName="@mantine/core/Input";function oA(e,t,n){const r=V(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:y,descriptionProps:C,wrapperProps:v,id:w,size:x,style:S,inputContainer:E,inputWrapperOrder:j,withAsterisk:T,variant:P,vars:R,...I}=r,{styleProps:O,rest:D}=Co(I),N={label:o,description:i,error:s,required:l,classNames:c,className:d,__staticSelector:h,__stylesApiProps:m||r,errorProps:g,labelProps:y,descriptionProps:C,unstyled:f,styles:u,size:x,style:S,inputContainer:E,inputWrapperOrder:j,withAsterisk:T,variant:P,id:w,...v};return{...D,classNames:c,styles:u,unstyled:f,wrapperProps:{...N,...O},inputProps:{required:l,classNames:c,styles:u,unstyled:f,size:x,__staticSelector:h,__stylesApiProps:m||r,error:s,variant:P,id:w}}}const iA={__staticSelector:"InputBase",withAria:!0},hr=un((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=oA("InputBase",iA,e);return b.createElement(yt.Wrapper,{...r},b.createElement(yt,{...n,...o,ref:t}))});hr.classes={...yt.classes,...yt.Wrapper.classes};hr.displayName="@mantine/core/InputBase";const sA={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 vj={root:"m-8bffd616"};const aA={},pa=un((e,t)=>{const n=V("Flex",aA,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:y,...C}=n,v=ue({name:"Flex",classes:vj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),w=_t(),x=ec(),S=gS({styleProps:{gap:u,rowGap:d,columnGap:f,align:h,justify:m,wrap:g,direction:y},theme:w,data:sA});return b.createElement(b.Fragment,null,S.hasResponsiveStyles&&b.createElement(ja,{selector:`.${x}`,styles:S.styles,media:S.media}),b.createElement(q,{ref:t,...v("root",{className:x,style:os(S.inlineStyles)}),...C}))});pa.classes=vj;pa.displayName="@mantine/core/Flex";var xj={root:"m-66836ed3","root--filled":"m-12b2e6d5","root--white":"m-cffd1856",wrapper:"m-a5d60502",body:"m-667c2793",title:"m-6a03f287",label:"m-698f4f23",icon:"m-667f2a6a",message:"m-7fa78076",closeButton:"m-87f54839"};const lA={},cA=(e,{radius:t,color:n,variant:r})=>{const o=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light"});return{root:{"--alert-radius":t===void 0?void 0:ut(t),"--alert-bg":n||r?o.background:void 0,"--alert-color":n||r?o.color:void 0,"--alert-bd":n||r?o.border:void 0}}},ds=G((e,t)=>{const n=V("Alert",lA,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:y,onClose:C,closeButtonLabel:v,variant:w,...x}=n,S=ue({name:"Alert",classes:xj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:cA}),E=Ln(m),j=f&&`${E}-title`||void 0,T=`${E}-body`;return b.createElement(q,{id:E,...S("root",{variant:w}),variant:w,ref:t,...x,role:"alert","aria-describedby":T,"aria-labelledby":j},b.createElement("div",{...S("wrapper")},g&&b.createElement("div",{...S("icon")},g),b.createElement("div",{...S("body")},f&&b.createElement("div",{...S("title"),"data-with-close-button":y||void 0},b.createElement("span",{id:j,...S("label")},f)),h&&b.createElement("div",{id:T,...S("message")},h)),y&&b.createElement(us,{...S("closeButton"),onClick:C,variant:"transparent",size:16,iconSize:16,"aria-label":v,unstyled:l})))});ds.classes=xj;ds.displayName="@mantine/core/Alert";var wj={root:"m-b6d8b162"};function uA(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const dA={inherit:!1},fA=(e,{variant:t,lineClamp:n,gradient:r,size:o,color:i})=>({root:{"--text-fz":Jt(o),"--text-lh":nS(o),"--text-gradient":t==="gradient"?np(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":i?gt(i,e):void 0}}),se=un((e,t)=>{const n=V("Text",dA,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:y,variant:C,mod:v,size:w,...x}=n,S=ue({name:["Text",u],props:n,classes:wj,className:f,style:h,classNames:m,styles:g,unstyled:y,vars:d,varsResolver:fA});return b.createElement(q,{...S("root",{focusable:!0}),ref:t,component:c?"span":"p",variant:C,mod:[{"data-truncate":uA(o),"data-line-clamp":typeof r=="number","data-inline":i,"data-inherit":s},v],size:w,...x})});se.classes=wj;se.displayName="@mantine/core/Text";var Sj={root:"m-849cf0da"};const hA={underline:"hover"},$e=un((e,t)=>{const{underline:n,className:r,unstyled:o,...i}=V("Anchor",hA,e);return b.createElement(se,{component:"a",ref:t,className:We({[Sj.root]:!o},r),...i,mod:{underline:n},__staticSelector:"Anchor",unstyled:o})});$e.classes=Sj;$e.displayName="@mantine/core/Anchor";const[pA,Da]=Sn("AppShell was not found in tree");var xi={root:"m-89ab340",navbar:"m-45252eee",aside:"m-9cdde9a",header:"m-3b16f56b",main:"m-8983817",footer:"m-3840c879",section:"m-6dcfc7c7"};const mA={},Zg=G((e,t)=>{const n=V("AppShellAside",mA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Da();return h.disabled?null:b.createElement(q,{component:"aside",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("aside",{className:o,classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-aside-z-index":`calc(${d??h.zIndex} + 1)`}})});Zg.classes=xi;Zg.displayName="@mantine/core/AppShellAside";const gA={},ey=G((e,t)=>{var m;const n=V("AppShellFooter",gA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Da();return h.disabled?null:b.createElement(q,{component:"footer",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("footer",{className:We({[Ed.classNames.zeroRight]:h.offsetScrollbars},o),classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-footer-z-index":(m=d??h.zIndex)==null?void 0:m.toString()}})});ey.classes=xi;ey.displayName="@mantine/core/AppShellFooter";const yA={},ty=G((e,t)=>{var m;const n=V("AppShellHeader",yA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Da();return h.disabled?null:b.createElement(q,{component:"header",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("header",{className:We({[Ed.classNames.zeroRight]:h.offsetScrollbars},o),classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-header-z-index":(m=d??h.zIndex)==null?void 0:m.toString()}})});ty.classes=xi;ty.displayName="@mantine/core/AppShellHeader";const vA={},ny=G((e,t)=>{const n=V("AppShellMain",vA,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Da();return b.createElement(q,{component:"main",ref:t,...u.getStyles("main",{className:o,style:i,classNames:r,styles:s}),...c})});ny.classes=xi;ny.displayName="@mantine/core/AppShellMain";function ac(e){return typeof e=="object"?e.base:e}function lc(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 cc(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function xA({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"),lc(i)){const f=z(ac(i));e["--app-shell-aside-width"]=f,e["--app-shell-aside-offset"]=f}if(cc(i)&&(typeof i.base<"u"&&(e["--app-shell-aside-width"]=z(i.base),e["--app-shell-aside-offset"]=z(i.base)),rt(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=Mm(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 wA({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(lc(r)){const s=z(ac(r));e["--app-shell-footer-height"]=s,i&&(e["--app-shell-footer-offset"]=s)}cc(r)&&(typeof r.base<"u"&&(e["--app-shell-footer-height"]=z(r.base),i&&(e["--app-shell-footer-offset"]=z(r.base))),rt(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 SA({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(lc(r)){const s=z(ac(r));e["--app-shell-header-height"]=s,i&&(e["--app-shell-header-offset"]=s)}cc(r)&&(typeof r.base<"u"&&(e["--app-shell-header-height"]=z(r.base),i&&(e["--app-shell-header-offset"]=z(r.base))),rt(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 bA({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"),lc(i)){const f=z(ac(i));e["--app-shell-navbar-width"]=f,e["--app-shell-navbar-offset"]=f}if(cc(i)&&(typeof i.base<"u"&&(e["--app-shell-navbar-width"]=z(i.base),e["--app-shell-navbar-offset"]=z(i.base)),rt(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=Mm(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 $h(e){return Number(e)===0?"0px":Yt(e)}function CA({padding:e,baseStyles:t,minMediaStyles:n}){lc(e)&&(t["--app-shell-padding"]=$h(ac(e))),cc(e)&&(e.base&&(t["--app-shell-padding"]=$h(e.base)),rt(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=$h(e[r]))}))}function jA({navbar:e,header:t,footer:n,aside:r,padding:o,theme:i}){const s={},l={},c={};bA({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,navbar:e,theme:i}),xA({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,aside:r,theme:i}),SA({baseStyles:c,minMediaStyles:s,header:t}),wA({baseStyles:c,minMediaStyles:s,footer:n}),CA({baseStyles:c,minMediaStyles:s,padding:o});const u=Cl(rt(s),i).map(h=>({query:`(min-width: ${Du(h.px)})`,styles:s[h.value]})),d=Cl(rt(l),i).map(h=>({query:`(max-width: ${Du(h.px)})`,styles:l[h.value]})),f=[...u,...d];return{baseStyles:c,media:f}}function EA({navbar:e,header:t,aside:n,footer:r,padding:o}){const i=_t(),s=kd(),{media:l,baseStyles:c}=jA({navbar:e,header:t,footer:r,aside:n,padding:o,theme:i});return b.createElement(ja,{media:l,styles:c,selector:s.cssVariablesSelector})}const TA={},ry=G((e,t)=>{const n=V("AppShellNavbar",TA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Da();return h.disabled?null:b.createElement(q,{component:"nav",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("navbar",{className:o,classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-navbar-z-index":`calc(${d??h.zIndex} + 1)`}})});ry.classes=xi;ry.displayName="@mantine/core/AppShellNavbar";const PA={},oy=un((e,t)=>{const n=V("AppShellSection",PA,e),{classNames:r,className:o,style:i,styles:s,vars:l,grow:c,...u}=n,d=Da();return b.createElement(q,{ref:t,mod:{grow:c},...d.getStyles("section",{className:o,style:i,classNames:r,styles:s}),...u})});oy.classes=xi;oy.displayName="@mantine/core/AppShellSection";function kA({transitionDuration:e,disabled:t}){const[n,r]=p.useState(!1),o=p.useRef(),i=p.useRef();return cS("resize",()=>{r(!0),clearTimeout(o.current),o.current=window.setTimeout(()=>r(!1),200)}),Ca(()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>r(!1),e||0)},[t,e]),n}const RA={withBorder:!0,offsetScrollbars:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:_r("app")},DA=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),An=G((e,t)=>{const n=V("AppShell",RA,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:y,layout:C,disabled:v,aside:w,footer:x,offsetScrollbars:S,...E}=n,j=ue({name:"AppShell",classes:xi,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:DA}),T=kA({disabled:v,transitionDuration:h});return b.createElement(pA,{value:{getStyles:j,withBorder:d,zIndex:y,disabled:v,offsetScrollbars:S}},b.createElement(EA,{navbar:u,header:g,aside:w,footer:x,padding:f}),b.createElement(q,{ref:t,...j("root"),mod:{resizing:T,layout:C,disabled:v},...E}))});An.classes=xi;An.displayName="@mantine/core/AppShell";An.Navbar=ry;An.Header=ty;An.Main=ny;An.Aside=Zg;An.Footer=ey;An.Section=oy;function bj(e){return typeof e=="string"?{value:e,label:e}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(t=>bj(t))}:e}function Cj(e){return e?e.map(bj):[]}function jj(e){return e.reduce((t,n)=>"group"in n?{...t,...jj(n.items)}:(t[n.value]=n,t),{})}var xn={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",optionsDropdownScrollArea:"m-71d052f9",optionsDropdownOption:"m-390b5f4",optionsDropdownCheckIcon:"m-8ee53fc2"};const IA={error:null},_A=(e,{size:t})=>({chevron:{"--combobox-chevron-size":Ce(t,"combobox-chevron-size")}}),Zd=G((e,t)=>{const n=V("ComboboxChevron",IA,e),{size:r,error:o,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,...f}=n,h=ue({name:"ComboboxChevron",classes:xn,props:n,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,varsResolver:_A,rootSelector:"chevron"});return b.createElement(q,{component:"svg",...f,...h("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:o}],ref:t},b.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"}))});Zd.classes=xn;Zd.displayName="@mantine/core/ComboboxChevron";const[AA,pr]=Sn("Combobox component was not found in tree"),Ej=p.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},i)=>b.createElement(us,{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)}}));Ej.displayName="@mantine/core/ComboboxClearButton";const NA={},iy=G((e,t)=>{const{classNames:n,styles:r,className:o,style:i,hidden:s,...l}=V("ComboboxDropdown",NA,e),c=pr();return b.createElement(Ar.Dropdown,{...l,ref:t,role:"presentation","data-hidden":s||void 0,...c.getStyles("dropdown",{className:o,style:i,classNames:n,styles:r})})});iy.classes=xn;iy.displayName="@mantine/core/ComboboxDropdown";const OA={refProp:"ref"},Tj=G((e,t)=>{const{children:n,refProp:r}=V("ComboboxDropdownTarget",OA,e);if(pr(),!bo(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 b.createElement(Ar.Target,{ref:t,refProp:r},n)});Tj.displayName="@mantine/core/ComboboxDropdownTarget";const MA={},sy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("ComboboxEmpty",MA,e),c=pr();return b.createElement(q,{ref:t,...c.getStyles("empty",{className:r,classNames:n,styles:i,style:o}),...l})});sy.classes=xn;sy.displayName="@mantine/core/ComboboxEmpty";function ay({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o}){const i=pr(),[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"){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 LA={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1},Pj=G((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,...c}=V("ComboboxEventsTarget",LA,e);if(!bo(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=pr(),d=ay({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown});return p.cloneElement(n,{...d,...c,[r]:nn(t,u.store.targetRef,n==null?void 0:n.ref)})});Pj.displayName="@mantine/core/ComboboxEventsTarget";const $A={},ly=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("ComboboxFooter",$A,e),c=pr();return b.createElement(q,{ref:t,...c.getStyles("footer",{className:r,classNames:n,style:o,styles:i}),...l})});ly.classes=xn;ly.displayName="@mantine/core/ComboboxFooter";const FA={},cy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,children:l,label:c,...u}=V("ComboboxGroup",FA,e),d=pr();return b.createElement(q,{ref:t,...d.getStyles("group",{className:r,classNames:n,style:o,styles:i}),...u},c&&b.createElement("div",{...d.getStyles("groupLabel",{classNames:n,styles:i})},c),l)});cy.classes=xn;cy.displayName="@mantine/core/ComboboxGroup";const zA={},uy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("ComboboxHeader",zA,e),c=pr();return b.createElement(q,{ref:t,...c.getStyles("header",{className:r,classNames:n,style:o,styles:i}),...l})});uy.classes=xn;uy.displayName="@mantine/core/ComboboxHeader";const BA={},dy=G((e,t)=>{const n=V("ComboboxOption",BA,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,...y}=n,C=pr(),v=p.useId(),w=u||v;return b.createElement(q,{...C.getStyles("option",{className:o,classNames:r,styles:s,style:i}),...y,ref:t,id:w,mod:["combobox-option",{"combobox-active":d,"combobox-disabled":m,"combobox-selected":g}],role:"option",onClick:x=>{var S;m?x.preventDefault():((S=C.onOptionSubmit)==null||S.call(C,n.value,n),c==null||c(x))},onMouseDown:x=>{x.preventDefault(),f==null||f(x)},onMouseOver:x=>{C.resetSelectionOnOptionHover&&C.store.resetSelectedOption(),h==null||h(x)}})});dy.classes=xn;dy.displayName="@mantine/core/ComboboxOption";const UA={},fy=G((e,t)=>{const n=V("ComboboxOptions",UA,e),{classNames:r,className:o,style:i,styles:s,id:l,onMouseDown:c,labelledBy:u,...d}=n,f=pr(),h=Ln(l);return p.useEffect(()=>{f.store.setListId(h)},[h]),b.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)}})});fy.classes=xn;fy.displayName="@mantine/core/ComboboxOptions";const VA={withAriaAttributes:!0,withKeyboardNavigation:!0},hy=G((e,t)=>{const n=V("ComboboxSearch",VA,e),{classNames:r,styles:o,unstyled:i,vars:s,withAriaAttributes:l,onKeyDown:c,withKeyboardNavigation:u,size:d,...f}=n,h=pr(),m=h.getStyles("search"),g=ay({targetType:"input",withAriaAttributes:l,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:c});return b.createElement(yt,{ref:nn(t,h.store.searchRef),classNames:[{input:m.className},r],styles:[{input:m.style},o],size:d||h.size,...g,...f,__staticSelector:"Combobox"})});hy.classes=xn;hy.displayName="@mantine/core/ComboboxSearch";const HA={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1},kj=G((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,...c}=V("ComboboxTarget",HA,e);if(!bo(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=pr(),d=ay({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown}),f=p.cloneElement(n,{...d,...c});return b.createElement(Ar.Target,{ref:nn(t,u.store.targetRef)},f)});kj.displayName="@mantine/core/ComboboxTarget";function WA(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 qA(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 GA(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function py({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:i=!0,scrollBehavior:s="instant"}={}){const[l,c]=vn({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),y=p.useRef(-1),C=p.useCallback((F="unknown")=>{l||(c(!0),o==null||o(F))},[c,o,l]),v=p.useCallback((F="unknown")=>{l&&(c(!1),r==null||r(F))},[c,r,l]),w=p.useCallback((F="unknown")=>{l?v(F):C(F)},[v,C,l]),x=p.useCallback(()=>{const F=document.querySelector(`#${u.current} [data-combobox-selected]`);F==null||F.removeAttribute("data-combobox-selected"),F==null||F.removeAttribute("aria-selected")},[]),S=p.useCallback(F=>{const _=document.getElementById(u.current),k=_==null?void 0:_.querySelectorAll("[data-combobox-option]");if(!k)return null;const M=F>=k.length?0:F<0?k.length-1:F;return d.current=M,k!=null&&k[M]&&!k[M].hasAttribute("data-combobox-disabled")?(x(),k[M].setAttribute("data-combobox-selected","true"),k[M].setAttribute("aria-selected","true"),k[M].scrollIntoView({block:"nearest",behavior:s}),k[M].id):null},[s,x]),E=p.useCallback(()=>{const F=document.querySelector(`#${u.current} [data-combobox-active]`);if(F){const _=document.querySelectorAll(`#${u.current} [data-combobox-option]`),k=Array.from(_).findIndex(M=>M===F);return S(k)}return S(0)},[S]),j=p.useCallback(()=>S(qA(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[S,i]),T=p.useCallback(()=>S(WA(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[S,i]),P=p.useCallback(()=>S(GA(document.querySelectorAll(`#${u.current} [data-combobox-option]`))),[S]),R=p.useCallback((F="selected")=>{y.current=window.setTimeout(()=>{const _=document.querySelectorAll(`#${u.current} [data-combobox-option]`),k=Array.from(_).findIndex(M=>M.hasAttribute(`data-combobox-${F}`));d.current=k},0)},[]),I=p.useCallback(()=>{d.current=-1,x()},[x]),O=p.useCallback(()=>{const F=document.querySelectorAll(`#${u.current} [data-combobox-option]`),_=F==null?void 0:F[d.current];_==null||_.click()},[]),D=p.useCallback(F=>{u.current=F},[]),N=p.useCallback(()=>{m.current=window.setTimeout(()=>f.current.focus(),0)},[]),L=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(y.current)},[]),{dropdownOpened:l,openDropdown:C,closeDropdown:v,toggleDropdown:w,selectedOptionIndex:d.current,getSelectedOptionIndex:B,selectOption:S,selectFirstOption:P,selectActiveOption:E,selectNextOption:j,selectPreviousOption:T,resetSelectedOption:I,updateSelectedOptionIndex:R,listId:u.current,setListId:D,clickSelectedOption:O,searchRef:f,focusSearchInput:N,targetRef:h,focusTarget:L}}const QA={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},KA=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Jt(t),"--combobox-option-padding":Ce(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:z(n),"--combobox-option-fz":Jt(t),"--combobox-option-padding":Ce(t,"combobox-option-padding")}});function Oe(e){const t=V("Combobox",QA,e),{classNames:n,styles:r,unstyled:o,children:i,store:s,vars:l,onOptionSubmit:c,size:u,dropdownPadding:d,resetSelectionOnOptionHover:f,__staticSelector:h,readOnly:m,...g}=t,y=py(),C=s||y,v=ue({name:h||"Combobox",classes:xn,props:t,classNames:n,styles:r,unstyled:o,vars:l,varsResolver:KA});return b.createElement(AA,{value:{getStyles:v,store:C,onOptionSubmit:c,size:u,resetSelectionOnOptionHover:f,readOnly:m}},b.createElement(Ar,{opened:C.dropdownOpened,...g,onClose:C.closeDropdown,withRoles:!1,unstyled:o},i))}const YA=e=>e;Oe.extend=YA;Oe.classes=xn;Oe.displayName="@mantine/core/Combobox";Oe.Target=kj;Oe.Dropdown=iy;Oe.Options=fy;Oe.Option=dy;Oe.Search=hy;Oe.Empty=sy;Oe.Chevron=Zd;Oe.Footer=ly;Oe.Header=uy;Oe.EventsTarget=Pj;Oe.DropdownTarget=Tj;Oe.Group=cy;Oe.ClearButton=Ej;var Rj={root:"m-5f75b09e",body:"m-5f6e695e",labelWrapper:"m-d3ea56bb",label:"m-8ee546b8",description:"m-328f68c0",error:"m-8e8a99cc"};const Dj=Rj,ef=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:y,vars:C,...v},w)=>{const x=ue({name:e,props:t,className:n,style:y,classes:Rj,classNames:r,styles:o,unstyled:i});return b.createElement(q,{...x("root"),ref:w,__vars:{"--label-fz":Jt(h),"--label-lh":Ce(h,"label-lh")},mod:{"label-position":m},variant:g,size:h,...v},b.createElement("div",{...x("body")},s,b.createElement("div",{...x("labelWrapper"),"data-disabled":d||void 0},l&&b.createElement("label",{...x("label"),"data-disabled":d||void 0,htmlFor:u},l),c&&b.createElement(yt.Description,{size:h,__inheritStyles:!1,...x("description")},c),f&&f!=="boolean"&&b.createElement(yt.Error,{size:h,__inheritStyles:!1,...x("error")},f))))});ef.displayName="@mantine/core/InlineInput";const Ij=p.createContext(null),XA=Ij.Provider,JA=()=>p.useContext(Ij);function my({children:e,role:t}){const n=Ra();return n?b.createElement("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy},e):b.createElement(b.Fragment,null,e)}const ZA={},gy=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,...c}=V("CheckboxGroup",ZA,e),[u,d]=vn({value:n,defaultValue:r,finalValue:[],onChange:o}),f=h=>{const m=h.currentTarget.value;d(u.includes(m)?u.filter(g=>g!==m):[...u,m])};return b.createElement(XA,{value:{value:u,onChange:f,size:i}},b.createElement(yt.Wrapper,{size:i,ref:t,...s,...c,labelElement:"div",__staticSelector:"CheckboxGroup"},b.createElement(my,{role:"group"},l)))});gy.classes=yt.Wrapper.classes;gy.displayName="@mantine/core/CheckboxGroup";function tf({size:e,style:t,...n}){const r=e!==void 0?{width:z(e),height:z(e),...t}:t;return b.createElement("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n},b.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 e3({indeterminate:e,...t}){return e?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...t},b.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):b.createElement(tf,{...t})}var _j={root:"m-bf2d988c",inner:"m-26062bec",input:"m-26063560",icon:"m-bf295423","input--outline":"m-215c4542"};const t3={labelPosition:"right",icon:e3},n3=(e,{radius:t,color:n,size:r,iconColor:o,variant:i})=>{const s=li({color:n||e.primaryColor,theme:e}),l=s.isThemeColor&&s.shade===void 0?`var(--mantine-color-${s.color}-outline)`:s.color;return{root:{"--checkbox-size":Ce(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:ut(t),"--checkbox-color":i==="outline"?l:gt(n,e),"--checkbox-icon-color":o?gt(o,e):void 0}}},cr=G((e,t)=>{const n=V("Checkbox",t3,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:y,checked:C,labelPosition:v,description:w,error:x,disabled:S,variant:E,indeterminate:j,icon:T,rootRef:P,iconColor:R,onChange:I,...O}=n,D=JA(),N=h||(D==null?void 0:D.size),L=T,B=ue({name:"Checkbox",props:n,classes:_j,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:n3}),{styleProps:F,rest:_}=Co(O),k=Ln(f),M=D?{checked:D.value.includes(_.value),onChange:W=>{D.onChange(W),I==null||I(W)}}:{};return b.createElement(ef,{...B("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:k,size:N,labelPosition:v,label:d,description:w,error:x,disabled:S,classNames:r,styles:s,unstyled:l,"data-checked":M.checked||C||void 0,variant:E,ref:P,...F,...g},b.createElement(q,{...B("inner"),mod:{"data-label-position":v}},b.createElement(q,{component:"input",id:k,ref:t,checked:C,disabled:S,mod:{error:!!x,indeterminate:j},...B("input",{focusable:!0,variant:E}),onChange:I,..._,...M,type:"checkbox"}),b.createElement(L,{indeterminate:j,...B("icon")})))});cr.classes={..._j,...Dj};cr.displayName="@mantine/core/Checkbox";cr.Group=gy;function ma(e){return"group"in e}function Aj({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;ma(s)&&o.push({group:s.group,items:Aj({options:s.items,search:t,limit:n-o.length})}),ma(s)||s.label.toLowerCase().includes(r)&&o.push(s)}return o}function r3(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 Nj(e,t=new Set){if(Array.isArray(e))for(const n of e)if(ma(n))Nj(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 Fh(e,t){return Array.isArray(e)?e.includes(t):e===t}function Oj({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:o}){if(!ma(e)){const s=t&&Fh(n,e.value)&&b.createElement(tf,{className:xn.optionsDropdownCheckIcon});return b.createElement(Oe.Option,{value:e.value,disabled:e.disabled,className:We({[xn.optionsDropdownOption]:!o}),"data-reverse":r==="right"||void 0,"data-checked":Fh(n,e.value)||void 0,"aria-selected":Fh(n,e.value)},r==="left"&&s,b.createElement("span",null,e.label),r==="right"&&s)}const i=e.items.map(s=>b.createElement(Oj,{data:s,value:n,key:s.value,unstyled:o,withCheckIcon:t,checkIconPosition:r}));return b.createElement(Oe.Group,{label:e.group},i)}function o3({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}){Nj(e);const C=typeof o=="string"?(r||Aj)({options:e,search:c?o:"",limit:i??1/0}):e,v=r3(C),w=C.map(x=>b.createElement(Oj,{data:x,key:ma(x)?x.group:x.value,withCheckIcon:u,value:d,checkIconPosition:f,unstyled:m}));return b.createElement(Oe.Dropdown,{hidden:t||n&&v},b.createElement(Oe.Options,{labelledBy:g},l?b.createElement(dr.Autosize,{mah:s??220,type:"scroll",scrollbarSize:"var(--_combobox-padding)",offsetScrollbars:"y",className:xn.optionsDropdownScrollArea},w):w,v&&h&&b.createElement(Oe.Empty,null,h)))}const Mj=p.createContext(null),i3=Mj.Provider;function s3(){return{withinGroup:!!p.useContext(Mj)}}var nf={root:"m-f85678b6",image:"m-11f8ac07",placeholder:"m-104cd71f",group:"m-11def92b"};const a3={},l3=(e,{spacing:t})=>({group:{"--ag-spacing":Yt(t)}}),yy=G((e,t)=>{const n=V("AvatarGroup",a3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,spacing:u,...d}=n,f=ue({name:"AvatarGroup",classes:nf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:l3,rootSelector:"group"});return b.createElement(i3,{value:!0},b.createElement(q,{ref:t,...f("group"),...d}))});yy.classes=nf;yy.displayName="@mantine/core/AvatarGroup";function c3(e){return b.createElement("svg",{...e,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.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 u3={},d3=(e,{size:t,radius:n,variant:r,gradient:o,color:i})=>{const s=e.variantColorResolver({color:i||"gray",theme:e,gradient:o,variant:r||"light"});return{root:{"--avatar-size":Ce(t,"avatar-size"),"--avatar-radius":n===void 0?void 0:ut(n),"--avatar-bg":i||r?s.background:void 0,"--avatar-color":i||r?s.color:void 0,"--avatar-bd":i||r?s.border:void 0}}},Xi=un((e,t)=>{const n=V("Avatar",u3,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:y,...C}=n,v=s3(),[w,x]=p.useState(!u),S=ue({name:"Avatar",props:n,classes:nf,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:d3});return p.useEffect(()=>x(!u),[u]),b.createElement(q,{...S("root"),mod:{"within-group":v.withinGroup},ref:t,...C},w?b.createElement("span",{...S("placeholder"),title:d},y||b.createElement(c3,null)):b.createElement("img",{...g,...S("image"),src:u,alt:d,onError:E=>{var j;x(!0),(j=g==null?void 0:g.onError)==null||j.call(g,E)}}))});Xi.classes=nf;Xi.displayName="@mantine/core/Avatar";Xi.Group=yy;var Lj={root:"m-347db0ec","root--dot":"m-fbd81e3d",label:"m-5add502a",section:"m-91fdda9b"};const f3={},h3=(e,{radius:t,color:n,gradient:r,variant:o,size:i})=>{const s=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled"});return{root:{"--badge-height":Ce(i,"badge-height"),"--badge-padding-x":Ce(i,"badge-padding-x"),"--badge-fz":Ce(i,"badge-fz"),"--badge-radius":t===void 0?void 0:ut(t),"--badge-bg":n||o?s.background:void 0,"--badge-color":n||o?s.color:void 0,"--badge-bd":n||o?s.border:void 0,"--badge-dot-color":o==="dot"?gt(n,e):void 0}}},rf=un((e,t)=>{const n=V("Badge",f3,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:y,fullWidth:C,...v}=n,w=ue({name:"Badge",props:n,classes:Lj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:h3});return b.createElement(q,{variant:y,mod:{block:C},...w("root",{variant:y}),ref:t,...v},h&&b.createElement("span",{...w("section"),"data-position":"left"},h),b.createElement("span",{...w("label")},g),m&&b.createElement("span",{...w("section"),"data-position":"right"},m))});rf.classes=Lj;rf.displayName="@mantine/core/Badge";var $j={root:"m-ddec01c0",icon:"m-dde7bd57",cite:"m-dde51a35"};const p3={iconSize:48},m3=(e,{color:t,iconSize:n,radius:r})=>{const o=li({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),i=li({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":Kt(i.value,.07),"--bq-bg-dark":Kt(o.value,.06),"--bq-bd":gt(t,e),"--bq-icon-size":z(n),"--bq-radius":ut(r)}}},vy=G((e,t)=>{const n=V("Blockquote",p3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,icon:d,iconSize:f,cite:h,...m}=n,g=ue({name:"Blockquote",classes:$j,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:m3});return b.createElement(q,{component:"blockquote",ref:t,...g("root"),...m},d&&b.createElement("span",{...g("icon")},d),u,h&&b.createElement("cite",{...g("cite")},h))});vy.classes=$j;vy.displayName="@mantine/core/Blockquote";var of={root:"m-77c9d27d",inner:"m-80f1301b",loader:"m-a25b86ee",label:"m-811560b9",section:"m-a74036a",group:"m-80d6d844"};const Ux={orientation:"horizontal"},g3=(e,{borderWidth:t})=>({group:{"--button-border-width":z(t)}}),xy=G((e,t)=>{const n=V("ButtonGroup",Ux,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,...h}=V("ButtonGroup",Ux,e),m=ue({name:"ButtonGroup",props:n,classes:of,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:g3,rootSelector:"group"});return b.createElement(q,{...m("group"),ref:t,variant:f,mod:{"data-orientation":c},role:"group",...h})});xy.classes=of;xy.displayName="@mantine/core/ButtonGroup";const y3={},v3=(e,{radius:t,color:n,gradient:r,variant:o,size:i,justify:s})=>{const l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled"});return{root:{"--button-justify":s,"--button-height":Ce(i,"button-height"),"--button-padding-x":Ce(i,"button-padding-x"),"--button-fz":i!=null&&i.includes("compact")?Jt(i.replace("compact-","")):Jt(i),"--button-radius":t===void 0?void 0:ut(t),"--button-bg":n||o?l.background:void 0,"--button-hover":n||o?l.hover:void 0,"--button-color":n||o?l.color:void 0,"--button-bd":n||o?l.border:void 0,"--button-hover-color":n||o?l.hoverColor:void 0}}},Z=un((e,t)=>{const n=V("Button",y3,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:y,gradient:C,classNames:v,styles:w,unstyled:x,"data-disabled":S,...E}=n,j=ue({name:"Button",props:n,classes:of,className:i,style:r,classNames:v,styles:w,unstyled:x,vars:o,varsResolver:v3}),T=!!u,P=!!d;return b.createElement(qn,{ref:t,...j("root",{active:!l&&!g&&!S}),unstyled:x,variant:h,disabled:l||g,mod:{disabled:l||S,loading:g,block:f,"with-left-section":T,"with-right-section":P},...E},b.createElement(q,{component:"span",...j("loader"),"aria-hidden":!0},b.createElement(Nn,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...y})),b.createElement("span",{...j("inner")},u&&b.createElement(q,{component:"span",...j("section"),mod:{position:"left"}},u),b.createElement(q,{component:"span",mod:{loading:g},...j("label")},c),d&&b.createElement(q,{component:"span",...j("section"),mod:{position:"right"}},d)))});Z.classes=of;Z.displayName="@mantine/core/Button";Z.Group=xy;var Fj={root:"m-4451eb3a"};const x3={},Bt=un((e,t)=>{const n=V("Center",x3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,inline:u,...d}=n,f=ue({name:"Center",props:n,classes:Fj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c});return b.createElement(q,{ref:t,mod:{inline:u},...f("root"),...d})});Bt.classes=Fj;Bt.displayName="@mantine/core/Center";const[w3,S3]=Zl(),b3={};function zj(e){const{value:t,defaultValue:n,onChange:r,multiple:o,children:i}=V("ChipGroup",b3,e),[s,l]=vn({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 b.createElement(w3,{value:{isChipSelected:c,onChange:u,multiple:o}},i)}zj.displayName="@mantine/core/ChipGroup";var Bj={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 C3={type:"checkbox"},j3=(e,{size:t,radius:n,variant:r,color:o})=>{const i=e.variantColorResolver({color:o||e.primaryColor,theme:e,variant:r||"filled"});return{root:{"--chip-fz":Jt(t),"--chip-size":Ce(t,"chip-size"),"--chip-radius":n===void 0?void 0:ut(n),"--chip-checked-padding":Ce(t,"chip-checked-padding"),"--chip-padding":Ce(t,"chip-padding"),"--chip-icon-size":Ce(t,"chip-icon-size"),"--chip-bg":o||r?i.background:void 0,"--chip-hover":o||r?i.hover:void 0,"--chip-color":o||r?i.color:void 0,"--chip-bd":o||r?i.border:void 0,"--chip-spacing":Ce(t,"chip-spacing")}}},Ul=G((e,t)=>{const n=V("Chip",C3,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:y,disabled:C,children:v,size:w,variant:x,icon:S,rootRef:E,...j}=n,T=ue({name:"Chip",classes:Bj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:j3}),P=S3(),R=Ln(u),{styleProps:I,rest:O}=Co(j),[D,N]=vn({value:d,defaultValue:f,finalValue:!1,onChange:h}),L=P?{checked:P.isChipSelected(m),onChange:F=>{P.onChange(F),h==null||h(F.currentTarget.checked)},type:P.multiple?"checkbox":"radio"}:{},B=L.checked||D;return b.createElement(q,{size:w,variant:x,ref:E,...T("root"),...I,...g},b.createElement("input",{type:y,...T("input"),checked:B,onChange:F=>N(F.currentTarget.checked),id:R,disabled:C,ref:t,value:m,...L,...O}),b.createElement("label",{htmlFor:R,"data-checked":B||void 0,"data-disabled":C||void 0,...T("label",{variant:x||"filled"})},B&&b.createElement("span",{...T("iconWrapper")},S||b.createElement(tf,{...T("checkIcon")})),v))});Ul.classes=Bj;Ul.displayName="@mantine/core/Chip";Ul.Group=zj;var Uj={root:"m-7485cace"};const E3={},T3=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:Ce(t,"container-size")}}),wy=G((e,t)=>{const n=V("Container",E3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,fluid:u,...d}=n,f=ue({name:"Container",classes:Uj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:T3});return b.createElement(q,{ref:t,mod:{fluid:u},...f("root"),...d})});wy.classes=Uj;wy.displayName="@mantine/core/Container";const P3={timeout:1e3};function Vj(e){const{children:t,timeout:n,value:r,...o}=V("CopyButton",P3,e),i=oS({timeout:n}),s=()=>i.copy(r);return b.createElement(b.Fragment,null,t({copy:s,copied:i.copied,...o}))}Vj.displayName="@mantine/core/CopyButton";var Hj={root:"m-3eebeb36",label:"m-9e365f20"};const k3={orientation:"horizontal"},R3=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?gt(t,e):void 0,"--divider-border-style":n,"--divider-size":Ce(r,"divider-size")}}),Tn=G((e,t)=>{const n=V("Divider",k3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,orientation:d,label:f,labelPosition:h,...m}=n,g=ue({name:"Divider",classes:Hj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:R3});return b.createElement(q,{ref:t,mod:{orientation:d,"with-label":!!f},...g("root"),...m,role:"separator"},f&&b.createElement(q,{component:"span",mod:{position:h},...g("label")},f))});Tn.classes=Hj;Tn.displayName="@mantine/core/Divider";function D3({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[I3,Wj]=Sn("Grid component was not found in tree"),em=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,Vx=(e,t,n)=>n||e==="auto"?"100%":e==="content"?"unset":em(e,t),Hx=(e,t)=>{if(e)return e==="auto"||t?"1":"auto"},Wx=(e,t)=>e===0?"0":e?`${100/(t/e)}%`:void 0;function _3({span:e,order:t,offset:n,selector:r}){var h;const o=_t(),i=Wj(),l=qo(e)===void 0?12:qo(e),c=os({"--col-order":(h=qo(t))==null?void 0:h.toString(),"--col-flex-grow":Hx(l,i.grow),"--col-flex-basis":em(l,i.columns),"--col-width":l==="content"?"auto":void 0,"--col-max-width":Vx(l,i.columns,i.grow),"--col-offset":Wx(qo(n),i.columns)}),u=rt(o.breakpoints).reduce((m,g)=>{var y;return m[g]||(m[g]={}),typeof t=="object"&&t[g]!==void 0&&(m[g]["--col-order"]=(y=t[g])==null?void 0:y.toString()),typeof e=="object"&&e[g]!==void 0&&(m[g]["--col-flex-grow"]=Hx(e[g],i.grow),m[g]["--col-flex-basis"]=em(e[g],i.columns),m[g]["--col-width"]=e[g]==="content"?"auto":void 0,m[g]["--col-max-width"]=Vx(e[g],i.columns,i.grow)),typeof n=="object"&&n[g]!==void 0&&(m[g]["--col-offset"]=Wx(n[g],i.columns)),m},{}),f=Cl(rt(u),o).filter(m=>rt(u[m.value]).length>0).map(m=>({query:`(min-width: ${o.breakpoints[m.value]})`,styles:u[m.value]}));return b.createElement(ja,{styles:c,media:f,selector:r})}var Sy={root:"m-410352e9",inner:"m-dee7bd2f",col:"m-96bdd299"};const A3={span:12},by=G((e,t)=>{const n=V("GridCol",A3,e),{classNames:r,className:o,style:i,styles:s,vars:l,span:c,order:u,offset:d,...f}=n,h=Wj(),m=ec();return b.createElement(b.Fragment,null,b.createElement(_3,{selector:`.${m}`,span:c,order:u,offset:d}),b.createElement(q,{ref:t,...h.getStyles("col",{className:We(o,m),style:i,classNames:r,styles:s}),...f}))});by.classes=Sy;by.displayName="@mantine/core/GridCol";function N3({gutter:e,selector:t}){const n=_t(),r=os({"--grid-gutter":Yt(qo(e))}),o=rt(n.breakpoints).reduce((l,c)=>(l[c]||(l[c]={}),typeof e=="object"&&e[c]!==void 0&&(l[c]["--grid-gutter"]=Yt(e[c])),l),{}),s=Cl(rt(o),n).filter(l=>rt(o[l.value]).length>0).map(l=>({query:`(min-width: ${n.breakpoints[l.value]})`,styles:o[l.value]}));return b.createElement(ja,{styles:r,media:s,selector:t})}const O3={gutter:"md",grow:!1,columns:12},M3=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),Un=G((e,t)=>{const n=V("Grid",O3,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,...y}=n,C=ue({name:"Grid",classes:Sy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:M3}),v=ec();return b.createElement(I3,{value:{getStyles:C,grow:u,columns:f}},b.createElement(N3,{selector:`.${v}`,...n}),b.createElement(q,{ref:t,...C("root",{className:v}),...y},b.createElement("div",{...C("inner")},g)))});Un.classes=Sy;Un.displayName="@mantine/core/Grid";Un.Col=by;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 Cy(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 L3=p.useLayoutEffect,$3=function(t){var n=p.useRef(t);return L3(function(){n.current=t}),n},qx=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},F3=function(t,n){var r=p.useRef();return p.useCallback(function(o){t.current=o,r.current&&qx(r.current,null),r.current=n,n&&qx(n,o)},[n])},Gx={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},z3=function(t){Object.keys(Gx).forEach(function(n){t.style.setProperty(n,Gx[n],"important")})},Qx=z3,dn=null,Kx=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function B3(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),dn||(dn=document.createElement("textarea"),dn.setAttribute("tabindex","-1"),dn.setAttribute("aria-hidden","true"),Qx(dn)),dn.parentNode===null&&document.body.appendChild(dn);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,l=s.boxSizing;Object.keys(s).forEach(function(h){var m=h;dn.style[m]=s[m]}),Qx(dn),dn.value=t;var c=Kx(dn,e);dn.value=t,c=Kx(dn,e),dn.value="x";var u=dn.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 Yx=function(){},U3=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},V3=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],H3=!!document.documentElement.currentStyle,W3=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=U3(V3,n),o=r.boxSizing;if(o==="")return null;H3&&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}},q3=W3;function qj(e,t,n){var r=$3(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 G3=function(t){qj(window,"resize",t)},Q3=function(t){qj(document.fonts,"loadingdone",t)},K3=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Y3=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,l=s===void 0?Yx:s,c=t.onHeightChange,u=c===void 0?Yx:c,d=Cy(t,K3),f=d.value!==void 0,h=p.useRef(null),m=F3(h,n),g=p.useRef(0),y=p.useRef(),C=function(){var x=h.current,S=r&&y.current?y.current:q3(x);if(S){y.current=S;var E=B3(S,x.value||x.placeholder||"x",i,o),j=E[0],T=E[1];g.current!==j&&(g.current=j,x.style.setProperty("height",j+"px","important"),u(j,{rowHeight:T}))}},v=function(x){f||C(),l(x)};return p.useLayoutEffect(C),G3(C),Q3(C),p.createElement("textarea",ad({},d,{onChange:v,ref:m}))},X3=p.forwardRef(Y3);const J3={},fs=G((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:i,...s}=V("Textarea",J3,e),l=n&&g2()!=="test",c=l?{maxRows:r,minRows:o}:{};return b.createElement(hr,{component:l?X3:"textarea",ref:t,...s,__staticSelector:i||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,...c})});fs.classes=hr.classes;fs.displayName="@mantine/core/Textarea";function Xx(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}const Z3={serialize:JSON.stringify,deserialize:JSON.parse},hs=G((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}=V("JsonInput",Z3,e),[g,y]=vn({value:n,defaultValue:r,finalValue:"",onChange:o}),[C,v]=p.useState(Xx(g,c)),w=S=>{u==null||u(S),v(!0)},x=S=>{typeof d=="function"&&d(S);const E=Xx(S.currentTarget.value,c);i&&!f&&E&&S.currentTarget.value.trim()!==""&&y(l(c(S.currentTarget.value),null,2)),v(E)};return b.createElement(fs,{value:g,onChange:S=>y(S.currentTarget.value),onFocus:w,onBlur:x,ref:t,readOnly:f,...m,autoComplete:"off",__staticSelector:"JsonInput",error:C?h:s||!0,"data-monospace":!0})});hs.classes=hr.classes;hs.displayName="@mantine/core/JsonInput";const[eN,tN]=Sn("List component was not found in tree");var jy={root:"m-abbac491",item:"m-abb6bec2",itemWrapper:"m-75cd9f71",itemIcon:"m-60f83e5b"};const nN={},Ey=G((e,t)=>{const n=V("ListItem",nN,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,children:u,...d}=n,f=tN(),h=c||f.icon,m={classNames:r,styles:s};return b.createElement(q,{...f.getStyles("item",{...m,className:o,style:i}),component:"li",mod:{"with-icon":!!h,centered:f.center},ref:t,...d},b.createElement("div",{...f.getStyles("itemWrapper",m)},h&&b.createElement("span",{...f.getStyles("itemIcon",m)},h),b.createElement("span",{...f.getStyles("itemLabel",m)},u)))});Ey.classes=jy;Ey.displayName="@mantine/core/ListItem";const rN={type:"unordered"},oN=(e,{size:t,spacing:n})=>({root:{"--list-fz":Jt(t),"--list-lh":nS(t),"--list-spacing":Yt(n)}}),mn=G((e,t)=>{const n=V("List",rN,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:y,...C}=n,v=ue({name:"List",classes:jy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:oN});return b.createElement(eN,{value:{center:g,icon:h,getStyles:v}},b.createElement(q,{...v("root",{style:{listStyleType:y}}),component:d==="unordered"?"ul":"ol",mod:{"with-padding":f},ref:t,...C},u))});mn.classes=jy;mn.displayName="@mantine/core/List";mn.Item=Ey;var Gj={root:"m-6e45937b",loader:"m-e8eb006c",overlay:"m-df587f17"};const Jx={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:_r("overlay")},iN=(e,{zIndex:t})=>({root:{"--lo-z-index":t==null?void 0:t.toString()}}),Ty=G((e,t)=>{const n=V("LoadingOverlay",Jx,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,y=_t(),C=ue({name:"LoadingOverlay",classes:Gj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:iN}),v={...Jx.overlayProps,...f};return b.createElement(cs,{transition:"fade",...u,mounted:!!h},w=>b.createElement(q,{...C("root",{style:w}),ref:t,...g},b.createElement(Nn,{...C("loader"),unstyled:l,...d}),b.createElement(Bl,{...v,...C("overlay"),"data-light":!0,unstyled:l,color:(f==null?void 0:f.color)||y.white}),b.createElement(Bl,{...v,...C("overlay"),"data-dark":!0,unstyled:l,color:(f==null?void 0:f.color)||y.colors.dark[5]})))});Ty.classes=Gj;Ty.displayName="@mantine/core/LoadingOverlay";const[sN,uc]=Sn("Menu component was not found in the tree");var Ia={dropdown:"m-dc9b7c9f",label:"m-9bfac126",divider:"m-efdf90cb",item:"m-99ac2aa1",itemLabel:"m-5476e0d3",itemSection:"m-8b75e504"};const aN={},Py=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("MenuDivider",aN,e),c=uc();return b.createElement(q,{ref:t,...c.getStyles("divider",{className:r,style:o,styles:i,classNames:n}),...l})});Py.classes=Ia;Py.displayName="@mantine/core/MenuDivider";const lN={},ky=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,onMouseEnter:l,onMouseLeave:c,children:u,...d}=V("MenuDropdown",lN,e),f=p.useRef(null),h=uc(),m=C=>{var v,w;(C.key==="ArrowUp"||C.key==="ArrowDown")&&(C.preventDefault(),(w=(v=f.current)==null?void 0:v.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||w.focus())},g=zn(l,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.openDropdown()),y=zn(c,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.closeDropdown());return b.createElement(Ar.Dropdown,{...d,onMouseEnter:g,onMouseLeave:y,role:"menu","aria-orientation":"vertical",ref:nn(t,f),...h.getStyles("dropdown",{className:r,style:o,styles:i,classNames:n}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:m},b.createElement("div",{tabIndex:-1,"data-autofocus":!0}),u)});ky.classes=Ia;ky.displayName="@mantine/core/MenuDropdown";const cN={},Ry=un((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}=V("MenuItem",cN,e),g=uc(),y=_t(),{dir:C}=Ea(),v=p.useRef(),w=g.getItemIndex(v.current),x=m,S=zn(x.onMouseLeave,()=>g.setHovered(-1)),E=zn(x.onMouseEnter,()=>g.setHovered(g.getItemIndex(v.current))),j=zn(x.onClick,()=>{typeof c=="boolean"?c&&g.closeDropdownImmediately():g.closeOnItemClick&&g.closeDropdownImmediately()}),T=zn(x.onFocus,()=>g.setHovered(g.getItemIndex(v.current))),P=l?y.variantColorResolver({color:l,theme:y,variant:"light"}):void 0,R=l?li({color:l,theme:y}):null;return b.createElement(qn,{...m,unstyled:g.unstyled,tabIndex:g.menuItemTabIndex,onFocus:T,...g.getStyles("item",{className:r,style:o,styles:i,classNames:n}),ref:nn(v,t),role:"menuitem",disabled:h,"data-menu-item":!0,"data-disabled":h||void 0,"data-hovered":g.hovered===w?!0:void 0,onMouseEnter:E,onMouseLeave:S,onClick:j,onKeyDown:tS({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:g.loop,dir:C,orientation:"vertical",onKeyDown:x.onKeydown}),__vars:{"--menu-item-color":R!=null&&R.isThemeColor&&(R==null?void 0:R.shade)===void 0?`var(--mantine-color-${R.color}-6)`:P==null?void 0:P.color,"--menu-item-hover":P==null?void 0:P.hover}},u&&b.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"left"},u),f&&b.createElement("div",{...g.getStyles("itemLabel",{styles:i,classNames:n})},f),d&&b.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"right"},d))});Ry.classes=Ia;Ry.displayName="@mantine/core/MenuItem";const uN={},Dy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("MenuLabel",uN,e),c=uc();return b.createElement(q,{ref:t,...c.getStyles("label",{className:r,style:o,styles:i,classNames:n}),...l})});Dy.classes=Ia;Dy.displayName="@mantine/core/MenuLabel";const dN={refProp:"ref"},Qj=p.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=V("MenuTarget",dN,e);if(!bo(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=uc(),s=zn(n.props.onClick,()=>(i.trigger==="click"||i.trigger==="click-hover")&&i.toggleDropdown()),l=zn(n.props.onMouseEnter,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.openDropdown()),c=zn(n.props.onMouseLeave,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.closeDropdown());return b.createElement(Ar.Target,{refProp:r,popupType:"menu",ref:t,...o},p.cloneElement(n,{onClick:s,onMouseEnter:l,onMouseLeave:c,"data-expanded":i.opened?!0:void 0}))});Qj.displayName="@mantine/core/MenuTarget";const fN={trapFocus:!0,closeOnItemClick:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function X(e){const t=V("Menu",fN,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:y,styles:C,unstyled:v,variant:w,vars:x,menuItemTabIndex:S,...E}=t,j=ue({name:"Menu",classes:Ia,props:t,classNames:y,styles:C,unstyled:v}),[T,{setHovered:P,resetHovered:R}]=p2(),[I,O]=vn({value:i,defaultValue:s,finalValue:!1,onChange:c}),D=()=>{O(!1),I&&(o==null||o())},N=()=>{O(!0),!I&&(r==null||r())},L=()=>{I?D():N()},{openDropdown:B,closeDropdown:F}=D3({open:N,close:D,closeDelay:g,openDelay:m}),_=W=>h2("[data-menu-item]","[data-menu-dropdown]",W),{resolvedClassNames:k,resolvedStyles:M}=Rd({classNames:y,styles:C,props:t});return uo(()=>{R()},[I]),b.createElement(sN,{value:{getStyles:j,opened:I,toggleDropdown:L,getItemIndex:_,hovered:T,setHovered:P,closeOnItemClick:u,closeDropdown:h==="click"?D:F,openDropdown:h==="click"?N:B,closeDropdownImmediately:D,loop:d,trigger:h,unstyled:v,menuItemTabIndex:S}},b.createElement(Ar,{...E,opened:I,onChange:L,defaultOpened:s,trapFocus:l,closeOnEscape:f,__staticSelector:"Menu",classNames:k,styles:M,unstyled:v,variant:w},n))}X.extend=e=>e;X.classes=Ia;X.displayName="@mantine/core/Menu";X.Item=Ry;X.Label=Dy;X.Dropdown=ky;X.Target=Qj;X.Divider=Py;const[hN,_a]=Sn("Modal component was not found in tree");var Po={root:"m-9df02822",content:"m-54c44539",inner:"m-1f958f16",header:"m-d0e2b9cd"};const pN={},sf=G((e,t)=>{const n=V("ModalBody",pN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=_a();return b.createElement(hj,{ref:t,...u.getStyles("body",{classNames:r,style:i,styles:s,className:o}),...c})});sf.classes=Po;sf.displayName="@mantine/core/ModalBody";const mN={},af=G((e,t)=>{const n=V("ModalCloseButton",mN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=_a();return b.createElement(pj,{ref:t,...u.getStyles("close",{classNames:r,style:i,styles:s,className:o}),...c})});af.classes=Po;af.displayName="@mantine/core/ModalCloseButton";const gN={},lf=G((e,t)=>{const n=V("ModalContent",gN,e),{classNames:r,className:o,style:i,styles:s,vars:l,children:c,...u}=n,d=_a(),f=d.scrollAreaComponent||G4;return b.createElement(V4,{...d.getStyles("content",{className:o,style:i,styles:s,classNames:r}),innerProps:d.getStyles("inner",{className:o,style:i,styles:s,classNames:r}),ref:t,...u},b.createElement(f,{style:{maxHeight:`calc(100vh - (${z(d.yOffset)} * 2))`}},c))});lf.classes=Po;lf.displayName="@mantine/core/ModalContent";const yN={},cf=G((e,t)=>{const n=V("ModalHeader",yN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=_a();return b.createElement(mj,{ref:t,...u.getStyles("header",{classNames:r,style:i,styles:s,className:o}),...c})});cf.classes=Po;cf.displayName="@mantine/core/ModalHeader";const vN={},uf=G((e,t)=>{const n=V("ModalOverlay",vN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=_a();return b.createElement(gj,{ref:t,...u.getStyles("overlay",{classNames:r,style:i,styles:s,className:o}),...c})});uf.classes=Po;uf.displayName="@mantine/core/ModalOverlay";const xN={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:_r("modal"),transitionProps:{duration:200,transition:"pop"},yOffset:"5dvh"},wN=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:ut(t),"--modal-size":Ce(n,"modal-size"),"--modal-y-offset":z(r),"--modal-x-offset":z(o)}}),df=G((e,t)=>{const n=V("ModalRoot",xN,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:y,...C}=n,v=ue({name:y,classes:Po,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:wN});return b.createElement(hN,{value:{yOffset:u,scrollAreaComponent:d,getStyles:v}},b.createElement(B4,{ref:t,...v("root"),"data-full-screen":h||void 0,"data-centered":m||void 0,unstyled:l,...C}))});df.classes=Po;df.displayName="@mantine/core/ModalRoot";const SN={},ff=G((e,t)=>{const n=V("ModalTitle",SN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=_a();return b.createElement(yj,{ref:t,...u.getStyles("title",{classNames:r,style:i,styles:s,className:o}),...c})});ff.classes=Po;ff.displayName="@mantine/core/ModalTitle";const bN={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:_r("modal"),transitionProps:{duration:200,transition:"pop"},withOverlay:!0,withCloseButton:!0},Cn=G((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:i,closeButtonProps:s,children:l,radius:c,...u}=V("Modal",bN,e),d=!!n||i;return b.createElement(df,{ref:t,radius:c,...u},r&&b.createElement(uf,{...o}),b.createElement(lf,{radius:c},d&&b.createElement(cf,null,n&&b.createElement(ff,null,n),i&&b.createElement(af,{...s})),b.createElement(sf,null,l)))});Cn.classes=Po;Cn.displayName="@mantine/core/Modal";Cn.Root=df;Cn.Overlay=uf;Cn.Content=lf;Cn.Body=sf;Cn.Header=cf;Cn.Title=ff;Cn.CloseButton=af;const[CN,Iy]=Zl(),[jN,EN]=Zl();var hf={root:"m-7cda1cd6","root--default":"m-44da308b","root--contrast":"m-e3a01f8",label:"m-1e0e6180",remove:"m-ae386778",group:"m-1dcfd90b"};const TN={},PN=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?Ce(t):Ce(n,"pg-gap")}}),_y=G((e,t)=>{const n=V("PillGroup",TN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,disabled:d,...f}=n,h=Iy(),m=(h==null?void 0:h.size)||u||void 0,g=ue({name:"PillGroup",classes:hf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:PN,stylesCtx:{size:m},rootSelector:"group"});return b.createElement(jN,{value:{size:m,disabled:d}},b.createElement(q,{ref:t,size:m,...g("group"),...f}))});_y.classes=hf;_y.displayName="@mantine/core/PillGroup";const kN={variant:"default"},RN=(e,{radius:t},{size:n})=>({root:{"--pill-fz":Ce(n,"pill-fz"),"--pill-height":Ce(n,"pill-height"),"--pill-radius":t===void 0?void 0:ut(t)}}),Ji=G((e,t)=>{const n=V("Pill",kN,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:y,disabled:C,...v}=n,w=EN(),x=Iy(),S=y||(w==null?void 0:w.size)||void 0,E=(x==null?void 0:x.variant)==="filled"?"contrast":u||"default",j=ue({name:"Pill",classes:hf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:RN,stylesCtx:{size:S}});return b.createElement(q,{component:"span",ref:t,variant:E,size:S,...j("root",{variant:E}),mod:{"with-remove":f,disabled:C||(w==null?void 0:w.disabled)},...v},b.createElement("span",{...j("label")},d),f&&b.createElement(us,{variant:"transparent",radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:l,...m,...j("remove",{className:m==null?void 0:m.className,style:m==null?void 0:m.style}),onMouseDown:T=>{var P;T.preventDefault(),T.stopPropagation(),(P=m==null?void 0:m.onMouseDown)==null||P.call(m,T)},onClick:T=>{var P;T.stopPropagation(),h==null||h(),(P=m==null?void 0:m.onClick)==null||P.call(m,T)}}))});Ji.classes=hf;Ji.displayName="@mantine/core/Pill";Ji.Group=_y;var Kj={field:"m-45c4369d"};const DN={type:"visible"},Ay=G((e,t)=>{const n=V("PillsInputField",DN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,type:u,disabled:d,id:f,pointer:h,...m}=n,g=Iy(),y=Ra(),C=ue({name:"PillsInputField",classes:Kj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"field"}),v=d||(g==null?void 0:g.disabled);return b.createElement(q,{component:"input",ref:nn(t,g==null?void 0:g.fieldRef),"data-type":u,disabled:v,mod:{disabled:v,pointer:h},...C("field"),...m,id:(y==null?void 0:y.inputId)||f,"aria-invalid":g==null?void 0:g.hasError,"aria-describedby":y==null?void 0:y.describedBy,type:"text",onMouseDown:w=>!h&&w.stopPropagation()})});Ay.classes=Kj;Ay.displayName="@mantine/core/PillsInputField";const IN={},ga=G((e,t)=>{const n=V("PillsInput",IN,e),{children:r,onMouseDown:o,onClick:i,size:s,disabled:l,__staticSelector:c,error:u,variant:d,...f}=n,h=p.useRef();return b.createElement(CN,{value:{fieldRef:h,size:s,disabled:l,hasError:!!u,variant:d}},b.createElement(hr,{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))});ga.displayName="@mantine/core/PillsInput";ga.Field=Ay;function _N({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,i)=>(ma(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 AN={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:","},pf=G((e,t)=>{const n=V("MultiSelect",AN,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:y,dropdownOpened:C,defaultDropdownOpened:v,onDropdownOpen:w,onDropdownClose:x,selectFirstOptionOnChange:S,onOptionSubmit:E,comboboxProps:j,filter:T,limit:P,withScrollArea:R,maxDropdownHeight:I,searchValue:O,defaultSearchValue:D,onSearchChange:N,readOnly:L,disabled:B,onFocus:F,onBlur:_,onPaste:k,radius:M,rightSection:W,rightSectionWidth:K,rightSectionPointerEvents:ie,rightSectionProps:ve,leftSection:Ee,leftSectionWidth:Ne,leftSectionPointerEvents:je,leftSectionProps:Ue,inputContainer:dt,inputWrapperOrder:ft,withAsterisk:rn,labelProps:Ge,descriptionProps:Nt,errorProps:Xe,wrapperProps:Ot,description:Pt,label:mr,error:Kn,maxValues:_o,searchable:$t,nothingFoundMessage:to,withCheckIcon:ee,checkIconPosition:be,hidePickedOptions:Je,withErrorStyles:Qe,name:kt,form:Mr,id:Yn,clearable:Ei,clearButtonProps:jn,hiddenInputProps:Lr,placeholder:gr,hiddenInputValuesDivider:Ao,...Fa}=n,xs=Ln(Yn),No=Cj(y),Ti=jj(No),Ht=py({opened:C,defaultOpened:v,onDropdownOpen:w,onDropdownClose:()=>{x==null||x(),Ht.resetSelectedOption()}}),{styleProps:qf,rest:{type:Gf,...Qf}}=Co(Fa),[Wt,Pi]=vn({value:d,defaultValue:f,finalValue:[],onChange:h}),[A,$]=vn({value:O,defaultValue:D,finalValue:"",onChange:N}),H=ue({name:"MultiSelect",classes:{},props:n,classNames:r,styles:s,unstyled:l}),{resolvedClassNames:J,resolvedStyles:ae}=Rd({props:n,styles:s,classNames:r}),Re=me=>{m==null||m(me),me.key===" "&&!$t&&(me.preventDefault(),Ht.toggleDropdown()),me.key==="Backspace"&&A.length===0&&Wt.length>0&&Pi(Wt.slice(0,Wt.length-1))},xe=Wt.map((me,St)=>{var Te;return b.createElement(Ji,{key:`${me}-${St}`,withRemoveButton:!L,onRemove:()=>Pi(Wt.filter(Ke=>me!==Ke)),unstyled:l,...H("pill")},((Te=Ti[me])==null?void 0:Te.label)||me)});p.useEffect(()=>{S&&Ht.selectFirstOption()},[S,Wt]);const ye=Ei&&Wt.length>0&&!B&&!L&&b.createElement(Oe.ClearButton,{size:u,...jn,onClear:()=>{Pi([]),$("")}}),pe=_N({data:No,value:Wt});return b.createElement(b.Fragment,null,b.createElement(Oe,{store:Ht,classNames:J,styles:ae,unstyled:l,size:u,readOnly:L,__staticSelector:"MultiSelect",onOptionSubmit:me=>{E==null||E(me),$(""),Ht.updateSelectedOptionIndex("selected"),Wt.includes(Ti[me].value)?Pi(Wt.filter(St=>St!==Ti[me].value)):Wt.length<_o&&Pi([...Wt,Ti[me].value])},...j},b.createElement(Oe.DropdownTarget,null,b.createElement(ga,{...qf,__staticSelector:"MultiSelect",classNames:J,styles:ae,unstyled:l,size:u,className:o,style:i,variant:g,disabled:B,radius:M,rightSection:W||ye||b.createElement(Oe.Chevron,{size:u,error:Kn,unstyled:l}),rightSectionPointerEvents:ie||(ye?"all":"none"),rightSectionWidth:K,rightSectionProps:ve,leftSection:Ee,leftSectionWidth:Ne,leftSectionPointerEvents:je,leftSectionProps:Ue,inputContainer:dt,inputWrapperOrder:ft,withAsterisk:rn,labelProps:Ge,descriptionProps:Nt,errorProps:Xe,wrapperProps:Ot,description:Pt,label:mr,error:Kn,multiline:!0,withErrorStyles:Qe,__stylesApiProps:{...n,multiline:!0},pointer:!$t,onClick:()=>$t?Ht.openDropdown():Ht.toggleDropdown(),"data-expanded":Ht.dropdownOpened||void 0,id:xs},b.createElement(Ji.Group,{disabled:B,unstyled:l,...H("pillsList")},xe,b.createElement(Oe.EventsTarget,null,b.createElement(ga.Field,{...Qf,ref:t,id:xs,placeholder:gr,type:!$t&&!gr?"hidden":"visible",...H("inputField"),unstyled:l,onFocus:me=>{F==null||F(me),$t&&Ht.openDropdown()},onBlur:me=>{_==null||_(me),Ht.closeDropdown(),$t&&Ht.closeDropdown(),$("")},onKeyDown:Re,value:A,onChange:me=>{$(me.currentTarget.value),$t&&Ht.openDropdown(),S&&Ht.selectFirstOption()},disabled:B,readOnly:L||!$t,pointer:!$t}))))),b.createElement(o3,{data:Je?pe:No,hidden:L||B,filter:T,search:A,limit:P,hiddenWhenEmpty:!$t||!to||Je&&pe.length===0&&A.trim().length===0,withScrollArea:R,maxDropdownHeight:I,filterOptions:$t,value:Wt,checkIconPosition:be,withCheckIcon:ee,nothingFoundMessage:to,unstyled:l,labelId:`${xs}-label`})),b.createElement("input",{type:"hidden",name:kt,value:Wt.join(Ao),form:Mr,disabled:B,...Lr}))});pf.classes={...hr.classes,...Oe.classes};pf.displayName="@mantine/core/MultiSelect";function NN(e){return"group"in e}function Ny({data:e}){if(NN(e)){const o=e.items.map(i=>b.createElement(Ny,{key:i.value,data:i}));return b.createElement("optgroup",{label:e.group},o)}const{value:t,label:n,...r}=e;return b.createElement("option",{key:e.value,value:e.value,...r},e.label)}Ny.displayName="@mantine/core/NativeSelectOption";const ON={rightSectionPointerEvents:"none"},ct=G((e,t)=>{const{data:n,children:r,size:o,error:i,rightSection:s,unstyled:l,...c}=V("NativeSelect",ON,e),u=Cj(n).map((d,f)=>b.createElement(Ny,{key:f,data:d}));return b.createElement(hr,{component:"select",ref:t,...c,__staticSelector:"NativeSelect",size:o,pointer:!0,error:i,unstyled:l,rightSection:s||b.createElement(Zd,{size:o,error:i,unstyled:l})},r||u)});ct.classes=hr.classes;ct.displayName="@mantine/core/NativeSelect";var Yj={root:"m-a513464",icon:"m-a4ceffb",loader:"m-b0920b15",body:"m-a49ed24",title:"m-3feedf16",description:"m-3d733a3a",closeButton:"m-919a4d88"};const MN={withCloseButton:!0},LN=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:ut(t),"--notification-color":n?gt(n,e):void 0}}),Oy=G((e,t)=>{const n=V("Notification",MN,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:y,styles:C,unstyled:v,variant:w,vars:x,...S}=n,E=ue({name:"Notification",classes:Yj,props:n,className:r,style:y,classNames:g,styles:C,unstyled:v,vars:x,varsResolver:LN});return b.createElement(q,{...E("root"),mod:{"data-with-icon":!!d||s,"data-with-border":c},ref:t,variant:w,...S,role:"alert"},d&&!s&&b.createElement("div",{...E("icon")},d),s&&b.createElement(Nn,{size:28,color:o,...E("loader")}),b.createElement("div",{...E("body")},u&&b.createElement("div",{...E("title")},u),b.createElement(q,{...E("description"),mod:{"data-with-title":!!u}},f)),l&&b.createElement(us,{iconSize:16,color:"gray",...m,unstyled:v,onClick:h,...E("closeButton")}))});Oy.classes=Yj;Oy.displayName="@mantine/core/Notification";const[$N,mf]=Sn("Pagination.Root component was not found in tree");var dc={root:"m-4addd315",control:"m-326d024a",dots:"m-4ad7767d"};const FN={withPadding:!0},fc=G((e,t)=>{const n=V("PaginationControl",FN,e),{classNames:r,className:o,style:i,styles:s,vars:l,active:c,disabled:u,withPadding:d,...f}=n,h=mf(),m=u||h.disabled;return b.createElement(qn,{ref:t,disabled:m,mod:{active:c,disabled:m,"with-padding":d},...h.getStyles("control",{className:o,style:i,classNames:r,styles:s,active:!m}),...f})});fc.classes=dc;fc.displayName="@mantine/core/PaginationControl";function hc({style:e,children:t,path:n,...r}){return b.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},b.createElement("path",{d:n,fill:"currentColor"}))}const zN=e=>b.createElement(hc,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),BN=e=>b.createElement(hc,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),UN=e=>b.createElement(hc,{...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"}),VN=e=>b.createElement(hc,{...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"}),HN=e=>b.createElement(hc,{...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"}),WN={icon:HN},gf=G((e,t)=>{const n=V("PaginationDots",WN,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,...u}=n,d=mf(),f=c;return b.createElement(q,{ref:t,...d.getStyles("dots",{className:o,style:i,styles:s,classNames:r}),...u},b.createElement(f,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}}))});gf.classes=dc;gf.displayName="@mantine/core/PaginationDots";function yf({icon:e,name:t,action:n,type:r}){const o={icon:e},i=p.forwardRef((s,l)=>{const{icon:c,...u}=V(t,o,s),d=c,f=mf(),h=r==="next"?f.active===f.total:f.active===1;return b.createElement(fc,{disabled:f.disabled||h,ref:l,onClick:f[n],withPadding:!1,...u},b.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 Xj=yf({icon:zN,name:"PaginationNext",action:"onNext",type:"next"}),Jj=yf({icon:BN,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),Zj=yf({icon:UN,name:"PaginationFirst",action:"onFirst",type:"previous"}),eE=yf({icon:VN,name:"PaginationLast",action:"onLast",type:"next"});function My({dotsIcon:e}){const t=mf(),n=t.range.map((r,o)=>{var i;return r==="dots"?b.createElement(gf,{icon:e,key:o}):b.createElement(fc,{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 b.createElement(b.Fragment,null,n)}My.displayName="@mantine/core/PaginationItems";const qN={siblings:1,boundaries:1},GN=(e,{size:t,radius:n,color:r})=>({root:{"--pagination-control-radius":n===void 0?void 0:ut(n),"--pagination-control-size":Ce(t,"pagination-control-size"),"--pagination-control-fz":Jt(t),"--pagination-active-bg":r?gt(r,e):void 0}}),vf=G((e,t)=>{const n=V("PaginationRoot",qN,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:y,color:C,radius:v,onNextPage:w,onPreviousPage:x,onFirstPage:S,onLastPage:E,getItemProps:j,...T}=n,P=ue({name:"Pagination",classes:dc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:GN}),{range:R,setPage:I,next:O,previous:D,active:N,first:L,last:B}=O2({page:d,initialPage:f,onChange:h,total:u,siblings:g,boundaries:y}),F=zn(w,O),_=zn(x,D),k=zn(S,L),M=zn(E,B);return b.createElement($N,{value:{total:u,range:R,active:N,disabled:m,getItemProps:j,onChange:I,onNext:F,onPrevious:_,onFirst:k,onLast:M,getStyles:P}},b.createElement(q,{ref:t,...P("root"),...T}))});vf.classes=dc;vf.displayName="@mantine/core/PaginationRoot";const QN={withControls:!0,siblings:1,boundaries:1,gap:8},Nr=G((e,t)=>{const n=V("Pagination",QN,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:b.createElement(vf,{ref:t,total:f,...m},b.createElement(Y,{gap:h},r&&b.createElement(Zj,{icon:u,...i==null?void 0:i("first")}),o&&b.createElement(Jj,{icon:l,...i==null?void 0:i("previous")}),b.createElement(My,{dotsIcon:d}),o&&b.createElement(Xj,{icon:s,...i==null?void 0:i("next")}),r&&b.createElement(eE,{icon:c,...i==null?void 0:i("last")})))});Nr.classes=dc;Nr.displayName="@mantine/core/Pagination";Nr.Root=vf;Nr.Control=fc;Nr.Dots=gf;Nr.First=Zj;Nr.Last=eE;Nr.Next=Xj;Nr.Previous=Jj;Nr.Items=My;const KN=({reveal:e})=>b.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)"}},b.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 tm={root:"m-f61ca620",input:"m-ccf8da4c",innerInput:"m-f2d85dd2",visibilityToggle:"m-b1072d44"};const YN={visibilityToggleIcon:KN},XN=(e,{size:t})=>({root:{"--psi-icon-size":Ce(t,"psi-icon-size"),"--psi-button-size":Ce(t,"psi-button-size")}}),Pr=G((e,t)=>{const n=V("PasswordInput",YN,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:y,description:C,label:v,size:w,errorProps:x,descriptionProps:S,labelProps:E,withAsterisk:j,inputWrapperOrder:T,wrapperProps:P,radius:R,rightSection:I,rightSectionWidth:O,rightSectionPointerEvents:D,leftSectionWidth:N,visible:L,defaultVisible:B,onVisibilityChange:F,visibilityToggleIcon:_,visibilityToggleButtonProps:k,rightSectionProps:M,leftSectionProps:W,leftSectionPointerEvents:K,...ie}=n,ve=Ln(m),[Ee,Ne]=vn({value:L,defaultValue:B,finalValue:!1,onChange:F}),je=()=>Ne(!Ee),Ue=ue({name:"PasswordInput",classes:tm,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:XN}),{resolvedClassNames:dt,resolvedStyles:ft}=Rd({classNames:r,styles:s,props:n}),{styleProps:rn,rest:Ge}=Co(ie),Nt=_,Xe=b.createElement(Vt,{...Ue("visibilityToggle"),disabled:h,radius:R,"aria-hidden":!k,tabIndex:-1,...k,variant:"subtle",color:"gray",unstyled:l,onMouseDown:Ot=>{var Pt;Ot.preventDefault(),(Pt=k==null?void 0:k.onMouseDown)==null||Pt.call(k,Ot),je()},onKeyDown:Ot=>{var Pt;(Pt=k==null?void 0:k.onKeyDown)==null||Pt.call(k,Ot),Ot.key===" "&&(Ot.preventDefault(),je())}},b.createElement(Nt,{reveal:Ee}));return b.createElement(yt.Wrapper,{required:u,id:ve,label:v,error:d,description:C,size:w,classNames:dt,styles:ft,__staticSelector:"PasswordInput",errorProps:x,descriptionProps:S,unstyled:l,withAsterisk:j,inputWrapperOrder:T,inputContainer:y,variant:g,labelProps:{...E,htmlFor:ve},...Ue("root"),...rn,...P},b.createElement(yt,{component:"div",error:d,leftSection:f,size:w,classNames:{...dt,input:We(tm.input,dt.input)},styles:ft,radius:R,disabled:h,__staticSelector:"PasswordInput",rightSectionWidth:O,rightSection:I??Xe,variant:g,unstyled:l,leftSectionWidth:N,rightSectionPointerEvents:D||"all",rightSectionProps:M,leftSectionProps:W,leftSectionPointerEvents:K,withAria:!1},b.createElement("input",{required:u,"data-invalid":!!d||void 0,"data-with-left-section":!!f||void 0,...Ue("innerInput"),disabled:h,id:ve,ref:t,...Ge,autoComplete:Ge.autoComplete||"off",type:Ee?"text":"password"})))});Pr.classes={...hr.classes,...tm};Pr.displayName="@mantine/core/PasswordInput";const[JN,ZN]=Zl(),e9={},Ly=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,name:c,...u}=V("RadioGroup",e9,e),d=Ln(c),[f,h]=vn({value:n,defaultValue:r,finalValue:"",onChange:o}),m=g=>h(g.currentTarget.value);return b.createElement(JN,{value:{value:f,onChange:m,size:i,name:d}},b.createElement(yt.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"RadioGroup"},b.createElement(my,{role:"radiogroup"},l)))});Ly.classes=yt.Wrapper.classes;Ly.displayName="@mantine/core/RadioGroup";function t9({size:e,style:t,...n}){return b.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},b.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"}))}var tE={root:"m-f3f1af94",inner:"m-89c4f5e4",icon:"m-f3ed6b2b",radio:"m-8a3dbb89","radio--outline":"m-1bfe9d39"};const n9={labelPosition:"right"},r9=(e,{size:t,radius:n,color:r,iconColor:o,variant:i})=>{const s=li({color:r||e.primaryColor,theme:e}),l=s.isThemeColor&&s.shade===void 0?`var(--mantine-color-${s.color}-outline)`:s.color;return{root:{"--radio-size":Ce(t,"radio-size"),"--radio-radius":n===void 0?void 0:ut(n),"--radio-color":i==="outline"?l:gt(r,e),"--radio-icon-color":o?gt(o,e):void 0,"--radio-icon-size":Ce(t,"radio-icon-size")}}},Vl=G((e,t)=>{const n=V("Radio",n9,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:y,color:C,variant:v,disabled:w,wrapperProps:x,icon:S=t9,rootRef:E,iconColor:j,onChange:T,...P}=n,R=ue({name:"Radio",classes:tE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:r9}),I=ZN(),O=(I==null?void 0:I.size)??d,D=n.size?d:O,{styleProps:N,rest:L}=Co(P),B=Ln(u),F=I?{checked:I.value===L.value,name:L.name??I.name,onChange:_=>{I.onChange(_),T==null||T(_)}}:{};return b.createElement(ef,{...R("root"),__staticSelector:"Radio",__stylesApiProps:n,id:B,size:D,labelPosition:h,label:f,description:m,error:g,disabled:w,classNames:r,styles:s,unstyled:l,"data-checked":F.checked||void 0,variant:v,ref:E,...N,...x},b.createElement(q,{...R("inner"),mod:{"label-position":h}},b.createElement(q,{...R("radio",{focusable:!0,variant:v}),onChange:T,...L,...F,component:"input",mod:{error:!!g},ref:t,id:B,disabled:w,type:"radio"}),b.createElement(S,{...R("icon"),"aria-hidden":!0})))});Vl.classes=tE;Vl.displayName="@mantine/core/Radio";Vl.Group=Ly;const o9={duration:100,transition:"fade"};function i9(e,t){return{...o9,...t,...e}}function s9({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}=qg({placement:t,middleware:[Hg({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:y})=>{c.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:g,y,left:g+f,top:y+h,right:g,bottom:y}}})},[l.reference]);return p.useEffect(()=>{if(c.floating.current){const g=o.current;g.addEventListener("mousemove",m);const y=lo(c.floating.current);return y.forEach(C=>{C.addEventListener("scroll",u)}),()=>{g.removeEventListener("mousemove",m),y.forEach(C=>{C.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 xf={tooltip:"m-1b3c8819",arrow:"m-f898399f"};const a9={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:_r("popover")},l9=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:ut(t),"--tooltip-bg":n?gt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),$y=G((e,t)=>{const n=V("TooltipFloating",a9,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:y,multiline:C,zIndex:v,disabled:w,variant:x,vars:S,portalProps:E,...j}=n,T=_t(),P=ue({name:"TooltipFloating",props:n,classes:xf,className:l,style:s,classNames:c,styles:u,unstyled:d,rootSelector:"tooltip",vars:S,varsResolver:l9}),{handleMouseMove:R,x:I,y:O,opened:D,boundaryRef:N,floating:L,setOpened:B}=s9({offset:g,position:y});if(!bo(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 F=nn(N,r.ref,t),_=M=>{var W,K;(K=(W=r.props).onMouseEnter)==null||K.call(W,M),R(M),B(!0)},k=M=>{var W,K;(K=(W=r.props).onMouseLeave)==null||K.call(W,M),B(!1)};return b.createElement(b.Fragment,null,b.createElement(ls,{...E,withinPortal:i},b.createElement(q,{...j,...P("tooltip",{style:{...yS(s,T),zIndex:v,display:!w&&D?"block":"none",top:(O&&Math.round(O))??"",left:(I&&Math.round(I))??""}}),variant:x,ref:L},m)),p.cloneElement(r,{...r.props,[o]:F,onMouseEnter:_,onMouseLeave:k}))});$y.classes=xf;$y.displayName="@mantine/core/TooltipFloating";const nE=p.createContext(!1),c9=nE.Provider,u9=()=>p.useContext(nE),d9={openDelay:0,closeDelay:0};function rE(e){const{openDelay:t,closeDelay:n,children:r}=V("TooltipGroup",d9,e);return b.createElement(c9,{value:!0},b.createElement(X_,{delay:{open:t,close:n}},r))}rE.displayName="@mantine/core/TooltipGroup";function f9(e){var j,T,P;const[t,n]=p.useState(!1),o=typeof e.opened=="boolean"?e.opened:t,i=u9(),s=Ln(),{delay:l,currentId:c,setCurrentId:u}=tj(),d=p.useCallback(R=>{n(R),R&&u(s)},[u,s]),{x:f,y:h,context:m,refs:g,update:y,placement:C,middlewareData:{arrow:{x:v,y:w}={}}}=qg({placement:e.position,open:o,onOpenChange:d,middleware:[LC(e.offset),Hg({padding:8}),WC(),GC({element:e.arrowRef,padding:e.arrowOffset}),...e.inline?[qC()]:[]]}),{getReferenceProps:x,getFloatingProps:S}=l4([Y_(m,{enabled:(j=e.events)==null?void 0:j.hover,delay:i?l:{open:e.openDelay,close:e.closeDelay},mouseOnly:!((T=e.events)!=null&&T.touch)}),a4(m,{enabled:(P=e.events)==null?void 0:P.focus,keyboardOnly:!0}),c4(m,{role:"tooltip"}),s4(m,{enabled:typeof e.opened>"u"}),J_(m,{id:s})]);aj({opened:o,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:g,update:y}}),uo(()=>{var R;(R=e.onPositionChange)==null||R.call(e,C)},[C]);const E=o&&c&&c!==s;return{x:f,y:h,arrowX:v,arrowY:w,reference:g.setReference,floating:g.setFloating,getFloatingProps:S,getReferenceProps:x,isGroupPhase:E,opened:o,placement:C}}const Zx={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:_r("popover"),positionDependencies:[]},h9=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:ut(t),"--tooltip-bg":n?gt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),Aa=G((e,t)=>{const n=V("Tooltip",Zx,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:y,unstyled:C,style:v,className:w,withArrow:x,arrowSize:S,arrowOffset:E,arrowRadius:j,arrowPosition:T,offset:P,transitionProps:R,multiline:I,events:O,zIndex:D,disabled:N,positionDependencies:L,onClick:B,onMouseEnter:F,onMouseLeave:_,inline:k,variant:M,keepMounted:W,vars:K,portalProps:ie,...ve}=V("Tooltip",Zx,n),{dir:Ee}=Ea(),Ne=p.useRef(null),je=f9({position:nj(Ee,o),closeDelay:c,openDelay:l,onPositionChange:u,opened:d,events:O,arrowRef:Ne,arrowOffset:E,offset:typeof P=="number"?P+(x?S/2:0):P,positionDependencies:[...L,r],inline:k}),Ue=ue({name:"Tooltip",props:n,classes:xf,className:w,style:v,classNames:g,styles:y,unstyled:C,rootSelector:"tooltip",vars:K,varsResolver:h9});if(!bo(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 dt=nn(je.reference,r.ref,t),ft=i9(R,{duration:100,transition:"fade"});return b.createElement(b.Fragment,null,b.createElement(ls,{...ie,withinPortal:f},b.createElement(cs,{...ft,keepMounted:W,mounted:!N&&!!je.opened,duration:je.isGroupPhase?10:ft.duration},rn=>b.createElement(q,{...ve,variant:M,mod:{multiline:I},...je.getFloatingProps({ref:je.floating,className:Ue("tooltip").className,style:{...Ue("tooltip").style,...rn,zIndex:D,top:je.y??0,left:je.x??0}})},s,b.createElement(Gg,{ref:Ne,arrowX:je.arrowX,arrowY:je.arrowY,visible:x,position:je.placement,arrowSize:S,arrowOffset:E,arrowRadius:j,arrowPosition:T,...Ue("arrow")})))),p.cloneElement(r,je.getReferenceProps({onClick:B,onMouseEnter:F,onMouseLeave:_,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,[i]:dt,className:We(w,r.props.className),...r.props})))});Aa.classes=xf;Aa.displayName="@mantine/core/Tooltip";Aa.Floating=$y;Aa.Group=rE;function p9({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 oE({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=_t();return b.createElement(Aa.Floating,{disabled:!c,label:c},b.createElement(q,{component:"circle",...f,...u("curve"),__vars:{"--curve-color":s?gt(s,h):void 0},fill:"none",strokeLinecap:l?"round":"butt",...p9({sum:r,size:e,thickness:o,value:t,offset:n,root:i})}))}oE.displayName="@mantine/core/Curve";function m9({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 iE={root:"m-b32e4812",svg:"m-d43b5134",curve:"m-b1ca1fbf",label:"m-b23f9dc4"};function g9(e,t){return Math.min(e||12,(t||120)/4)}const y9={size:120,thickness:12},v9=(e,{size:t,thickness:n})=>({root:{"--rp-size":z(t),"--rp-label-offset":z(n*2)}}),wf=G((e,t)=>{const n=V("RingProgress",y9,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,...y}=n,C=ue({name:"RingProgress",classes:iE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:v9}),v=g9(h,f),w=m9({size:f,thickness:v,sections:d,renderRoundedLineCaps:m,rootColor:g}).map(({data:x,sum:S,root:E,lineRoundCaps:j,offset:T},P)=>b.createElement(oE,{...x,key:P,size:f,thickness:v,sum:S,offset:T,color:x==null?void 0:x.color,root:E,lineRoundCaps:j,getStyles:C}));return b.createElement(q,{...C("root"),size:f,ref:t,...y},b.createElement("svg",{...C("svg")},w),u&&b.createElement("div",{...C("label")},u))});wf.classes=iE;wf.displayName="@mantine/core/RingProgress";function x9({spacing:e,verticalSpacing:t,cols:n,selector:r}){var d;const o=_t(),i=t===void 0?e:t,s=os({"--sg-spacing-x":Yt(qo(e)),"--sg-spacing-y":Yt(qo(i)),"--sg-cols":(d=qo(n))==null?void 0:d.toString()}),l=rt(o.breakpoints).reduce((f,h)=>(f[h]||(f[h]={}),typeof e=="object"&&e[h]!==void 0&&(f[h]["--sg-spacing-x"]=Yt(e[h])),typeof i=="object"&&i[h]!==void 0&&(f[h]["--sg-spacing-y"]=Yt(i[h])),typeof n=="object"&&n[h]!==void 0&&(f[h]["--sg-cols"]=n[h]),f),{}),u=Cl(rt(l),o).filter(f=>rt(l[f.value]).length>0).map(f=>({query:`(min-width: ${o.breakpoints[f.value]})`,styles:l[f.value]}));return b.createElement(ja,{styles:s,media:u,selector:r})}var sE={root:"m-2415a157"};const w9={cols:1,spacing:"md"},Fy=G((e,t)=>{const n=V("SimpleGrid",w9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,cols:u,verticalSpacing:d,spacing:f,...h}=n,m=ue({name:"SimpleGrid",classes:sE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),g=ec();return b.createElement(b.Fragment,null,b.createElement(x9,{...n,selector:`.${g}`}),b.createElement(q,{ref:t,...m("root",{className:g}),...h}))});Fy.classes=sE;Fy.displayName="@mantine/core/SimpleGrid";const S9={},Sf=G((e,t)=>{const{w:n,h:r,miw:o,mih:i,...s}=V("Space",S9,e);return b.createElement(q,{ref:t,...s,w:n,miw:o??n,h:r,mih:i??r})});Sf.displayName="@mantine/core/Space";var aE={root:"m-6d731127"};const b9={gap:"md",align:"stretch",justify:"flex-start"},C9=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":Yt(t),"--stack-align":n,"--stack-justify":r}}),Se=G((e,t)=>{const n=V("Stack",b9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,align:u,justify:d,gap:f,variant:h,...m}=n,g=ue({name:"Stack",props:n,classes:aE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:C9});return b.createElement(q,{ref:t,...g("root"),variant:h,...m})});Se.classes=aE;Se.displayName="@mantine/core/Stack";const[j9,E9]=Sn("Stepper component was not found in tree"),ld=()=>null;ld.displayName="@mantine/core/StepperCompleted";var zy={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 ru=(e,t)=>typeof e=="function"?b.createElement(e,{step:t||0}):e,T9={withIcon:!0,allowStepClick:!0,iconPosition:"left"},By=G((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:y,iconSize:C,loading:v,allowStepClick:w,allowStepSelect:x,iconPosition:S,orientation:E,...j}=V("StepperStep",T9,e),T=E9(),P=_t(),R={classNames:n,styles:i},I=c==="stepCompleted"?null:c==="stepProgress"?h:d,O={"data-progress":c==="stepProgress"||void 0,"data-completed":c==="stepCompleted"||void 0};return b.createElement(qn,{...T.getStyles("step",{className:r,style:o,variant:T.orientation,...R}),mod:{"icon-position":S||T.iconPosition,"allow-click":w},ref:t,...O,...j,__vars:{"--step-color":u?gt(u,P):void 0},tabIndex:w?0:-1},y&&b.createElement("span",{...T.getStyles("stepWrapper",R)},b.createElement("span",{...T.getStyles("stepIcon",R),...O},b.createElement(cs,{mounted:c==="stepCompleted",transition:"pop",duration:200},D=>b.createElement("span",{...T.getStyles("stepCompletedIcon",{style:D,...R})},v?b.createElement(Nn,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...T.getStyles("stepLoader",R)}):ru(f,l)||b.createElement(tf,{size:"60%"}))),c!=="stepCompleted"?v?b.createElement(Nn,{...T.getStyles("stepLoader",R),size:"calc(var(--stepper-icon-size) / 2)",color:u}):ru(I||d,l):null),E==="vertical"&&b.createElement("span",{...T.getStyles("verticalSeparator",R),"data-active":c==="stepCompleted"||void 0})),(m||g)&&b.createElement("span",{...T.getStyles("stepBody",R),"data-orientation":T.orientation,"data-icon-position":S||T.iconPosition},m&&b.createElement("span",{...T.getStyles("stepLabel",R)},ru(m,l)),g&&b.createElement("span",{...T.getStyles("stepDescription",R)},ru(g,l))))});By.classes=zy;By.displayName="@mantine/core/StepperStep";const P9={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},k9=(e,{color:t,iconSize:n,size:r,contentPadding:o,radius:i})=>({root:{"--stepper-color":t?gt(t,e):void 0,"--stepper-icon-size":n===void 0?Ce(r,"stepper-icon-size"):z(n),"--stepper-content-padding":Yt(o),"--stepper-radius":i===void 0?void 0:ut(i),"--stepper-fz":Jt(r),"--stepper-spacing":Yt(r)}}),ya=G((e,t)=>{var _,k,M;const n=V("Stepper",P9,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:y,iconSize:C,contentPadding:v,orientation:w,iconPosition:x,size:S,radius:E,allowNextStepsSelect:j,wrap:T,...P}=n,R=ue({name:"Stepper",classes:zy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:k9}),I=p.Children.toArray(u),O=I.filter(W=>W.type!==ld),D=I.find(W=>W.type===ld),N=O.reduce((W,K,ie)=>{const ve=f===ie?"stepProgress":f>ie?"stepCompleted":"stepInactive",Ne=typeof d!="function"?!1:typeof K.props.allowStepSelect=="boolean"?K.props.allowStepSelect:ve==="stepCompleted"||j;return W.push(p.cloneElement(K,{icon:K.props.icon||h||ie+1,key:ie,step:ie,state:ve,onClick:()=>Ne&&(d==null?void 0:d(ie)),allowStepClick:Ne,completedIcon:K.props.completedIcon||m,progressIcon:K.props.progressIcon||g,color:K.props.color||y,iconSize:C,radius:E,iconPosition:K.props.iconPosition||x,orientation:w,unstyled:l})),w==="horizontal"&&ie!==O.length-1&&W.push(b.createElement("div",{...R("separator"),"data-active":ie<f||void 0,"data-orientation":w,key:`separator-${ie}`})),W},[]),L=(k=(_=O[f])==null?void 0:_.props)==null?void 0:k.children,B=(M=D==null?void 0:D.props)==null?void 0:M.children,F=f>O.length-1?B:L;return b.createElement(j9,{value:{getStyles:R,orientation:w,iconPosition:x}},b.createElement(q,{...R("root"),ref:t,size:S,...P},b.createElement(q,{...R("steps"),mod:{orientation:w,"icon-position":x,wrap:T&&w!=="vertical"}},N),F&&b.createElement("div",{...R("content")},F)))});ya.classes=zy;ya.displayName="@mantine/core/Stepper";ya.Completed=ld;ya.Step=By;const lE=p.createContext(null),R9=lE.Provider,D9=()=>p.useContext(lE),I9={},Uy=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,...c}=V("SwitchGroup",I9,e),[u,d]=vn({value:n,defaultValue:r,finalValue:[],onChange:o}),f=h=>{const m=h.currentTarget.value;d(u.includes(m)?u.filter(g=>g!==m):[...u,m])};return b.createElement(R9,{value:{value:u,onChange:f,size:i}},b.createElement(yt.Wrapper,{size:i,ref:t,...s,...c,labelElement:"div",__staticSelector:"SwitchGroup"},b.createElement(my,{role:"group"},l)))});Uy.classes=yt.Wrapper.classes;Uy.displayName="@mantine/core/SwitchGroup";var cE={root:"m-5f93f3bb",input:"m-926b4011",track:"m-9307d992",thumb:"m-93039a1d",trackLabel:"m-8277e082"};const _9={labelPosition:"right"},A9=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ut(t),"--switch-height":Ce(r,"switch-height"),"--switch-width":Ce(r,"switch-width"),"--switch-thumb-size":Ce(r,"switch-thumb-size"),"--switch-label-font-size":Ce(r,"switch-label-font-size"),"--switch-track-label-padding":Ce(r,"switch-track-label-padding"),"--switch-color":n?gt(n,e):void 0}}),pc=G((e,t)=>{const n=V("Switch",_9,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:y,wrapperProps:C,children:v,thumbIcon:w,checked:x,defaultChecked:S,onChange:E,labelPosition:j,description:T,error:P,disabled:R,variant:I,rootRef:O,...D}=n,N=D9(),L=g||(N==null?void 0:N.size),B=ue({name:"Switch",props:n,classes:cE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:A9}),{styleProps:F,rest:_}=Co(D),k=Ln(m),M=N?{checked:N.value.includes(_.value),onChange:N.onChange}:{},[W,K]=vn({value:M.checked??x,defaultValue:S,finalValue:!1});return b.createElement(ef,{...B("root"),__staticSelector:"Switch",__stylesApiProps:n,id:k,size:L,labelPosition:j,label:d,description:T,error:P,disabled:R,classNames:r,styles:s,unstyled:l,"data-checked":M.checked||void 0,variant:I,ref:O,...F,...C},b.createElement("input",{..._,disabled:R,checked:W,onChange:ie=>{var ve;N?(ve=M.onChange)==null||ve.call(M,ie):E==null||E(ie),K(ie.currentTarget.checked)},id:k,ref:t,type:"checkbox",...B("input")}),b.createElement(q,{component:"label",htmlFor:k,mod:{error:P,"label-position":j},...B("track")},b.createElement(q,{component:"span",mod:"reduce-motion",...B("thumb")},w),b.createElement("span",{...B("trackLabel")},W?h:f)))});pc.classes={...cE,...Dj};pc.displayName="@mantine/core/Switch";pc.Group=Uy;const[N9,O9]=Sn("Table component was not found in the tree");var mc={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 M9(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 ps(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=G((o,i)=>{const s=V(n,{},o),{classNames:l,className:c,style:u,styles:d,...f}=s,h=O9();return b.createElement(q,{component:e,ref:i,...M9(h,t),...h.getStyles(e,{className:c,classNames:l,style:u,styles:d,props:s}),...f})});return r.displayName=`@mantine/core/${n}`,r.classes=mc,r}const nm=ps("th",{columnBorder:!0}),uE=ps("td",{columnBorder:!0}),Pu=ps("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),dE=ps("thead",{stickyHeader:!0}),fE=ps("tbody"),hE=ps("tfoot"),pE=ps("caption",{captionSide:!0});function Vy({data:e}){return b.createElement(b.Fragment,null,e.caption&&b.createElement(pE,null,e.caption),e.head&&b.createElement(dE,null,b.createElement(Pu,null,e.head.map((t,n)=>b.createElement(nm,{key:n},t)))),e.body&&b.createElement(fE,null,e.body.map((t,n)=>b.createElement(Pu,{key:n},t.map((r,o)=>b.createElement(uE,{key:o},r))))),e.foot&&b.createElement(hE,null,b.createElement(Pu,null,e.foot.map((t,n)=>b.createElement(nm,{key:n},t)))))}Vy.displayName="@mantine/core/TableDataRenderer";const L9={type:"scrollarea"},$9=(e,{minWidth:t,type:n})=>({scrollContainer:{"--table-min-width":z(t),"--table-overflow":n==="native"?"auto":void 0}}),Hy=G((e,t)=>{const n=V("TableScrollContainer",L9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,minWidth:d,type:f,...h}=n,m=ue({name:"TableScrollContainer",classes:mc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:$9,rootSelector:"scrollContainer"});return b.createElement(q,{component:f==="scrollarea"?dr:"div",...f==="scrollarea"?{offsetScrollbars:"x"}:{},ref:t,...m("scrollContainer"),...h},b.createElement("div",{...m("scrollContainerInner")},u))});Hy.classes=mc;Hy.displayName="@mantine/core/TableScrollContainer";const F9={withRowBorders:!0,verticalSpacing:7},z9=(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":Yt(r),"--table-vertical-spacing":Yt(o),"--table-border-color":i?gt(i,e):void 0,"--table-striped-color":c&&s?gt(s,e):void 0,"--table-highlight-on-hover-color":u&&l?gt(l,e):void 0,"--table-sticky-header-offset":f?z(d):void 0}}),he=G((e,t)=>{const n=V("Table",F9,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:y,withColumnBorders:C,withRowBorders:v,withTableBorder:w,borderColor:x,layout:S,variant:E,data:j,children:T,stickyHeader:P,stickyHeaderOffset:R,...I}=n,O=ue({name:"Table",props:n,className:o,style:i,classes:mc,classNames:r,styles:s,unstyled:l,rootSelector:"table",vars:c,varsResolver:z9});return b.createElement(N9,{value:{getStyles:O,stickyHeader:P,striped:g===!0?"odd":g||void 0,highlightOnHover:y,withColumnBorders:C,withRowBorders:v,captionSide:f||"bottom"}},b.createElement(q,{component:"table",variant:E,ref:t,mod:{"data-with-table-border":w},...O("table"),...I},T||!!j&&b.createElement(Vy,{data:j})))});he.classes=mc;he.displayName="@mantine/core/Table";he.Td=uE;he.Th=nm;he.Tr=Pu;he.Thead=dE;he.Tbody=fE;he.Tfoot=hE;he.Caption=pE;he.ScrollContainer=Hy;he.DataRenderer=Vy;const[B9,Wy]=Sn("Tabs component was not found in the tree");var gc={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 U9={},qy=G((e,t)=>{const n=V("TabsList",U9,e),{children:r,className:o,grow:i,justify:s,classNames:l,styles:c,style:u,...d}=n,f=Wy();return b.createElement(q,{...d,...f.getStyles("list",{className:o,style:u,classNames:l,styles:c,props:n,variant:f.variant}),ref:t,role:"tablist",variant:f.variant,mod:{grow:i,orientation:f.orientation,placement:f.orientation==="vertical"&&f.placement,inverted:f.inverted},"aria-orientation":f.orientation,__vars:{"--tabs-justify":s}},r)});qy.classes=gc;qy.displayName="@mantine/core/TabsList";const V9={},Gy=G((e,t)=>{const n=V("TabsPanel",V9,e),{children:r,className:o,value:i,classNames:s,styles:l,style:c,...u}=n,d=Wy(),f=d.value===i,h=d.keepMounted||n.keepMounted||f?r:null;return b.createElement(q,{...u,...d.getStyles("panel",{className:o,classNames:s,styles:l,style:[c,f?void 0:{display:"none"}],props:n}),ref:t,mod:{orientation:d.orientation},role:"tabpanel",id:d.getPanelId(i),"aria-labelledby":d.getTabId(i)},h)});Gy.classes=gc;Gy.displayName="@mantine/core/TabsPanel";const H9={},Qy=G((e,t)=>{const n=V("TabsTab",H9,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:y,...C}=n,v=_t(),{dir:w}=Ea(),x=Wy(),S=l===x.value,E=T=>{x.onChange(x.allowTabDeactivation&&l===x.value?null:l),c==null||c(T)},j={classNames:m,styles:g,props:n};return b.createElement(qn,{...C,...x.getStyles("tab",{className:r,style:h,variant:x.variant,...j}),disabled:d,unstyled:x.unstyled,variant:x.variant,mod:{active:S,disabled:d,orientation:x.orientation,inverted:x.inverted,placement:x.orientation==="vertical"&&x.placement},ref:t,role:"tab",id:x.getTabId(l),"aria-selected":S,tabIndex:S||x.value===null?0:-1,"aria-controls":x.getPanelId(l),onClick:E,__vars:{"--tabs-color":f?gt(f,v):void 0},onKeyDown:tS({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:x.activateTabWithKeyboard,loop:x.loop,orientation:x.orientation||"horizontal",dir:w,onKeyDown:u})},s&&b.createElement("span",{...x.getStyles("tabSection",j),"data-position":"left"},s),o&&b.createElement("span",{...x.getStyles("tabLabel",j)},o),i&&b.createElement("span",{...x.getStyles("tabSection",j),"data-position":"right"},i))});Qy.classes=gc;Qy.displayName="@mantine/core/TabsTab";const e1="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",W9={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},q9=(e,{radius:t,color:n})=>({root:{"--tabs-radius":ut(t),"--tabs-color":gt(n,e)}}),ze=G((e,t)=>{const n=V("Tabs",W9,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:y,placement:C,keepMounted:v,classNames:w,styles:x,unstyled:S,className:E,style:j,vars:T,...P}=n,R=Ln(u),[I,O]=vn({value:o,defaultValue:r,finalValue:null,onChange:i}),D=ue({name:"Tabs",props:n,classes:gc,className:E,style:j,classNames:w,styles:x,unstyled:S,vars:T,varsResolver:q9});return b.createElement(B9,{value:{placement:C,value:I,orientation:s,id:R,loop:c,activateTabWithKeyboard:d,getTabId:l0(`${R}-tab`,e1),getPanelId:l0(`${R}-panel`,e1),onChange:O,allowTabDeactivation:f,variant:h,color:m,radius:g,inverted:y,keepMounted:v,unstyled:S,getStyles:D}},b.createElement(q,{ref:t,id:R,variant:h,mod:{orientation:s,inverted:s==="horizontal"&&y,placement:s==="vertical"&&C},...D("root"),...P},l))});ze.classes=gc;ze.displayName="@mantine/core/Tabs";ze.Tab=Qy;ze.Panel=Gy;ze.List=qy;const G9={},oe=G((e,t)=>{const n=V("TextInput",G9,e);return b.createElement(hr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});oe.classes=hr.classes;oe.displayName="@mantine/core/TextInput";var mE={root:"m-7341320d"};const Q9={},K9=(e,{size:t,radius:n,variant:r,gradient:o,color:i})=>{const s=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled"});return{root:{"--ti-size":Ce(t,"ti-size"),"--ti-radius":n===void 0?void 0:ut(n),"--ti-bg":i||r?s.background:void 0,"--ti-color":i||r?s.color:void 0,"--ti-bd":i||r?s.border:void 0}}},Ky=G((e,t)=>{const n=V("ThemeIcon",Q9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,...u}=n,d=ue({name:"ThemeIcon",classes:mE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:K9});return b.createElement(q,{ref:t,...d("root"),...u})});Ky.classes=mE;Ky.displayName="@mantine/core/ThemeIcon";const Y9=["h1","h2","h3","h4","h5","h6"];function X9(e,t){const n=t!==void 0?t:`h${e}`;return Y9.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 gE={root:"m-8a5d1357"};const J9={order:1},Z9=(e,{order:t,size:n,lineClamp:r})=>{const o=X9(t,n);return{root:{"--title-fw":o.fontWeight,"--title-lh":o.lineHeight,"--title-fz":o.fontSize,"--title-line-clamp":typeof r=="number"?r.toString():void 0}}},le=G((e,t)=>{const n=V("Title",J9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,order:c,vars:u,size:d,variant:f,lineClamp:h,...m}=n,g=ue({name:"Title",props:n,classes:gE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:Z9});return[1,2,3,4,5,6].includes(c)?b.createElement(q,{...g("root"),component:`h${c}`,variant:f,ref:t,mod:{order:c,"data-line-clamp":typeof h=="number"},size:d,...m}):null});le.classes=gE;le.displayName="@mantine/core/Title";function e5(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 t5(e){return p.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}const n5=()=>e5({notifications:[],queue:[],limit:5}),ms=n5(),r5=(e=ms)=>t5(e);function Na(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 ce(e,t=ms){const n=e.id||Lm();return Na(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function yE(e,t=ms){return Na(t,n=>n.filter(r=>{var o;return r.id===e?((o=r.onClose)==null||o.call(r,r),!1):!0})),e}function ul(e,t=ms){return Na(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function o5(e=ms){Na(e,()=>[])}function i5(e=ms){Na(e,t=>t.slice(0,e.getState().limit))}const Kr={show:ce,hide:yE,update:ul,clean:o5,cleanQueue:i5,updateState:Na};function rm(e,t){return rm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},rm(e,t)}function vE(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,rm(e,t)}var xE={exports:{}},s5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",a5=s5,l5=a5;function wE(){}function SE(){}SE.resetWarningCache=wE;var c5=function(){function e(r,o,i,s,l,c){if(c!==l5){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:SE,resetWarningCache:wE};return n.PropTypes=n,n};xE.exports=c5();var u5=xE.exports;const Me=km(u5),t1={disabled:!1},cd=b.createContext(null);var d5=function(t){return t.scrollTop},dl="unmounted",_i="exited",Ai="entering",Is="entered",om="exiting",ko=function(e){vE(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=Is:r.unmountOnExit||r.mountOnEnter?c=dl:c=_i,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===dl?{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!==Is&&(i=Ai):(s===Ai||s===Is)&&(i=om)}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:cl.findDOMNode(this);s&&d5(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===_i&&this.setState({status:dl})},n.performEnter=function(o){var i=this,s=this.props.enter,l=this.context?this.context.isMounting:o,c=this.props.nodeRef?[l]:[cl.findDOMNode(this),l],u=c[0],d=c[1],f=this.getTimeouts(),h=l?f.appear:f.enter;if(!o&&!s||t1.disabled){this.safeSetState({status:Is},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:Is},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:cl.findDOMNode(this);if(!i||t1.disabled){this.safeSetState({status:_i},function(){o.props.onExited(l)});return}this.props.onExit(l),this.safeSetState({status:om},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:cl.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===dl)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=Cy(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return b.createElement(cd.Provider,{value:null},typeof s=="function"?s(o,l):b.cloneElement(b.Children.only(s),l))},t}(b.Component);ko.contextType=cd;ko.propTypes={};function Ps(){}ko.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ps,onEntering:Ps,onEntered:Ps,onExit:Ps,onExiting:Ps,onExited:Ps};ko.UNMOUNTED=dl;ko.EXITED=_i;ko.ENTERING=Ai;ko.ENTERED=Is;ko.EXITING=om;const f5=ko;function h5(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 p5(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 m5(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 g5(e,t,n){var r=Yy(e.children),o=p5(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 y5=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},v5={component:"div",childFactory:function(t){return t}},Xy=function(e){vE(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(h5(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?m5(o,l):g5(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=ad({},l.children);return delete c[o.key],{children:c}}))},n.render=function(){var o=this.props,i=o.component,s=o.childFactory,l=Cy(o,["component","childFactory"]),c=this.state.contextValue,u=y5(this.state.children).map(s);return delete l.appear,delete l.enter,delete l.exit,i===null?b.createElement(cd.Provider,{value:c},u):b.createElement(cd.Provider,{value:c},b.createElement(i,l,u))},t}(b.Component);Xy.propTypes={};Xy.defaultProps=v5;const x5=Xy,n1={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},w5={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function S5({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:n1[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:w5[s]},u={opacity:0,maxHeight:0,transform:n1[s]};return{...l,...{entering:c,entered:c,exiting:u,exited:u}[e]}}function b5(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const bE=p.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:i,message:s,...l}=e,c=b5(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]),b.createElement(Oy,{...r,...l,onClose:f,ref:o,onMouseEnter:d,onMouseLeave:h},s)});bE.displayName="@mantine/notifications/NotificationContainer";var CE={root:"m-b37d9ac7",notification:"m-5ed0edd0"};const C5=f5,j5={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:_r("overlay"),store:ms,withinPortal:!0},E5=(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)}}},Ro=G((e,t)=>{const n=V("Notifications",j5,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:y,store:C,portalProps:v,withinPortal:w,...x}=n,S=_t(),E=r5(C),j=I2(),T=Fm(),P=p.useRef({}),R=p.useRef(0),O=(S.respectReducedMotion?T:!1)?1:f,D=ue({name:"Notifications",classes:CE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:E5});p.useEffect(()=>{C==null||C.updateState(L=>({...L,limit:g||5}))},[g]),uo(()=>{E.notifications.length>R.current&&setTimeout(()=>j(),0),R.current=E.notifications.length},[E.notifications]);const N=E.notifications.map(({style:L,...B})=>b.createElement(C5,{key:B.id,timeout:O,onEnter:()=>P.current[B.id].offsetHeight,nodeRef:{current:P.current[B.id]}},F=>b.createElement(bE,{ref:_=>{P.current[B.id]=_},data:B,onHide:_=>yE(_,C),autoClose:d,...D("notification",{style:{...S5({state:F,position:u,transitionDuration:O,maxHeight:m}),...L}})})));return b.createElement(ls,{withinPortal:w,...v},b.createElement(q,{...D("root"),ref:t,...x},b.createElement(x5,null,N)))});Ro.classes=CE;Ro.displayName="@mantine/notifications/Notifications";Ro.show=Kr.show;Ro.hide=Kr.hide;Ro.update=Kr.update;Ro.clean=Kr.clean;Ro.cleanQueue=Kr.cleanQueue;Ro.updateState=Kr.updateState;class T5{constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class yc{constructor(t,n,r){this.operator=t,this.left=n,this.right=r}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class P5{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 k5(t,this.prefixParselets,this.infixParselets)}}class k5{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 jE="ok",R5="created",D5="gone",I5="not-modified",_5="not-found",A5="forbidden",N5="accepted",O5={resourceType:"OperationOutcome",id:jE,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},M5={resourceType:"OperationOutcome",id:_5,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},EE={resourceType:"OperationOutcome",id:A5,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function si(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function It(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function bf(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function TE(e){return e.id===jE||e.id===R5||e.id===I5||e.id===N5}function L5(e){return e.id===D5}class Fe extends Error{constructor(t,n){super(PE(t)),this.outcome=t,this.cause=n}}function ot(e){return e instanceof Fe?e.outcome:bf(e)?e:si(ke(e))}function ke(e){return e?typeof e=="string"?e:e instanceof Error?e.message:bf(e)?PE(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function PE(e){var n;const t=((n=e.issue)==null?void 0:n.map(kE))??[];return t.length>0?t.join("; "):"Unknown error"}function kE(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 mt(e){const t=at(e),n=vo(e);return n===t?{reference:t}:{reference:t,display:n}}function at(e){return vs(e)?e.reference:`${e.resourceType}/${e.id}`}function Jy(e){if(e)return vs(e)?e.reference.split("/")[1]:e.id}function $5(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function vo(e){var t;if($5(e)){const n=F5(e);if(n)return n}if(e.resourceType==="Device"){const n=z5(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:at(e)}function F5(e){const t=e.name;if(t&&t.length>0)return wc(t[0])}function z5(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function B5(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const n of t){const r=r1(n);if(r)return r}else return r1(t)}function r1(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function RE(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 U5(e,t){const{years:n,months:r,days:o}=RE(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 vc(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 On(e,t){return JSON.stringify(e,V5,t?2:void 0)}function V5(e,t){return!H5(e)&&Xt(t)?void 0:t}function H5(e){return!!/\d+$/.exec(e)}function Xt(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!Cf(e):!1}function Cf(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 xc(e,t,n){return e===t||Xt(e)&&Xt(t)?!0:Xt(e)||Xt(t)?!1:Array.isArray(e)&&Array.isArray(t)?W5(e,t):Array.isArray(e)||Array.isArray(t)?!1:Yo(e)&&Yo(t)?q5(e,t,n):(Yo(e)||Yo(t),!1)}function W5(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!xc(e[n],t[n]))return!1;return!0}function q5(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(!xc(i,s,o))return!1}return!0}function Zy(e,t){return Xt(e)?!0:Xt(t)?!1:Array.isArray(e)&&Array.isArray(t)?G5(e,t):Array.isArray(e)||Array.isArray(t)?!1:Yo(e)&&Yo(t)?Q5(e,t):Yo(e)||Yo(t)?!1:e===t}function G5(e,t){return t.every(n=>e.some(r=>Zy(r,n)))}function Q5(e,t){return Object.entries(t).every(([n,r])=>n in e&&Zy(e[n],r))}function wi(e){return JSON.parse(JSON.stringify(e))}function DE(e){return!!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.exec(e)}function Yo(e){return e!==null&&typeof e=="object"}const IE=[];for(let e=0;e<256;e++)IE.push(e.toString(16).padStart(2,"0"));function K5(e){const t=new Uint8Array(e),n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=IE[t[r]];return n.join("")}function Y5(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 tn(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function X5(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 J5(e){if(e)return Array.isArray(e)?e:[e]}const o1=e=>new Promise(t=>{setTimeout(t,e)});function Z5(e,t,n){const r=[];for(let o=0;o<n-1;o++){let i=e.indexOf(t);i<0&&(i=e.length),r.push(e.slice(0,i)),e=e.slice(i+t.length)}return e&&r.push(e),r}function Ya(e,t){return e?(e.push(t),e):[t]}function eO(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 wc(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=Wl(e.text);if(r)return r}return n.join(" ").trim()}function jf(e){return e instanceof Date&&!isNaN(e.getTime())}function tO(e,t,n){if(!e)return"";const r=new Date("2000-01-01T"+e+"Z");return jf(r)?r.toLocaleTimeString(t,n):""}function Mn(e,t,n){if(!e)return"";const r=new Date(e);return jf(r)?r.toLocaleString(t,n):""}function nO(e,t,n){return!e||!e.start&&!e.end?"":Mn(e.start,t,n)+" - "+Mn(e.end,t,n)}const rO={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},oO={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},iO={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function _E(e){if(!e)return"";const t=[];return sO(t,e.repeat),e.event&&t.push(e.event.map(n=>Mn(n)).join(", ")),tn(t.join(" ").trim())}function sO(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(rO[o]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+oO[o]):e.push("per "+r+" "+iO[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(tn).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(i=>tO(i)).join(", "))}function Hl(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=cO(r.value,t),`> ${Bo(r,t)}`):`>= ${Bo(r,t)}`:(r==null?void 0:r.value)===void 0&&(o==null?void 0:o.value)!==void 0?n&&t!==void 0?(o.value=lO(o.value,t),`< ${Bo(o,t)}`):`<= ${Bo(o,t)}`:((r==null?void 0:r.unit)===(o==null?void 0:o.unit)&&(r==null||delete r.unit),`${Bo(r,t)} - ${Bo(o,t)}`)}function Bo(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 aO(e){return(e==null?void 0:e.value)===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function va(e){if(!e)return"";const t=Wl(e.text);return t||(e.coding?e.coding.map(n=>gs(n)).join(", "):"")}function gs(e){return Wl(e==null?void 0:e.display)??Wl(e==null?void 0:e.code)??""}function AE(e){if(!e)return"";if("component"in e)return e.component.map(n=>AE(n)).join(" / ");if(e.valueQuantity)return Bo(e.valueQuantity);if(e.valueCodeableConcept)return va(e.valueCodeableConcept);const t=Wl(e.valueString);return t||""}function Wl(e){return typeof e=="string"?e:void 0}function lO(e,t,n=1){return(NE(e,t)+n)*Math.pow(10,-t)}function cO(e,t,n=1){return(NE(e,t)-n)*Math.pow(10,-t)}function NE(e,t){return t===void 0?e:Math.round(e*Math.pow(10,t))}function uO(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 dO(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,uO(o,i)])),constraints:[],innerTypes:[]};return t}const fO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},hO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},pO={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"}]}}},mO={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"}]}}},gO={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"}]}}},yO={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"}]}}},vO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},xO={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"}]}}},wO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},SO={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"}]}}},bO={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"}]}}},CO={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"}]}}},jO={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"}]}}},EO={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"}]}}},TO={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"]}]}}},PO={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"}]}}},kO={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"}]}}},RO={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"}]}}},DO={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"}]}}},IO={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"}]}}},_O={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"]}]}}},AO={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"}]}}},NO={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"}]}}},OO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},MO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},LO={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"]}]}}},$O={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},FO={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"}]}}},zO={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"}]}}},BO={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"}]}}},UO={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"}]}}},VO={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"]}]}}},HO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},WO={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"}]}}},qO={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"]}]}}},GO={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"}]}}},QO={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"}]}}},KO={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"}]}}},YO={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"}]}}},XO={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"}]}}},JO={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"]}]}}},ZO={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"}]},value:{type:[{code:"decimal"}]},comparator:{max:0,type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},tM={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"}]}}},nM={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"}]}}},rM={Element:fO,BackboneElement:hO,Address:pO,Age:mO,Annotation:gO,Attachment:yO,CodeableConcept:vO,Coding:xO,ContactDetail:wO,ContactPoint:SO,Contributor:bO,Count:CO,DataRequirement:jO,Distance:EO,Dosage:TO,Duration:PO,ElementDefinition:kO,Expression:RO,Extension:DO,HumanName:IO,Identifier:_O,MarketingStatus:AO,Meta:NO,Money:OO,Narrative:MO,ParameterDefinition:LO,Period:$O,Population:FO,ProdCharacteristic:zO,ProductShelfLife:BO,Quantity:UO,Range:VO,Ratio:HO,Reference:WO,RelatedArtifact:qO,SampledData:GO,Signature:QO,SubstanceAmount:KO,Timing:YO,TriggerDefinition:XO,UsageContext:JO,MoneyQuantity:ZO,SimpleQuantity:eM,MetadataResource:tM,IdentityProvider:nM};function ge(e){return[{type:U.boolean,value:e}]}function Zr(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:U.integer,value:e}:typeof e=="number"?{type:U.decimal,value:e}:typeof e=="boolean"?{type:U.boolean,value:e}:typeof e=="string"?{type:U.string,value:e}:ir(e)?{type:U.Quantity,value:e}:Do(e)?{type:e.resourceType,value:e}:{type:U.BackboneElement,value:e}}function Xo(e){return e.length===0?!1:!!e[0].value}function xo(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 yn(e,t){if(!e.value)return;const n=ys(e.type,t);return n?ev(e.value,t,n):oM(e,t)}function ev(e,t,n){const r=n.type;if(!r||r.length===0)return;let o,i="undefined",s;if(n.path.endsWith("[x]")){const l=n.path.split(".").pop().replace("[x]","");for(const c of r){const u=l+tn(c.code);if(o=e[u],s=e["_"+u],o!==void 0||s!==void 0){i=c.code;break}}}else console.assert(r.length===1,"Expected single type",n.path),o=e[t],i=r[0].code,s=e["_"+t];if(s)if(Array.isArray(o))for(let l=0;l<Math.max(o.length,s.length);l++)o[l]=l1(o[l],s[l]);else o=l1(o,s);if(!Xt(o))return(i==="Element"||i==="BackboneElement")&&(i=n.type[0].code),Array.isArray(o)?o.map(l=>i1(l,i)):i1(o,i)}function i1(e,t){return t==="Resource"&&Do(e)&&(t=e.resourceType),{type:t,value:e}}function oM(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 U){const i=t+tn(o);if(i in n){r=n[i];break}}if(!Xt(r))return Array.isArray(r)?r.map(Zr):Zr(r)}function OE(e){const t=[];for(const n of e){let r=!1;for(const o of t)if(Xo($E(n,o))){r=!0;break}r||t.push(n)}return t}function ME(e){return ge(!Xo(e))}function LE(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?ge(!1):ge(e.every((n,r)=>Xo($E(n,t[r]))))}function $E(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"?ge(Math.abs(n-r)<1e-8):ir(n)&&ir(r)?ge(BE(n,r)):ge(typeof n=="object"&&typeof r=="object"?tv(e,t):n===r)}function FE(e,t){return e.length===0&&t.length===0?ge(!0):e.length!==t.length?ge(!1):(e.sort(s1),t.sort(s1),ge(e.every((n,r)=>Xo(iM(n,t[r])))))}function iM(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"?ge(Math.abs(s-l)<.01):ir(s)&&ir(l)?ge(BE(s,l)):ge(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"?tv({...s,id:void 0},{...l,id:void 0}):typeof s=="string"&&typeof l=="string"?s.toLowerCase()===l.toLowerCase():s===l)}function s1(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 zE(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 typeof n=="string"&&!!/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n);case"DateTime":return typeof n=="string"&&!!/^\d{4}(-\d{2}(-\d{2})?)?T/.exec(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return sM(n);case"Quantity":return ir(n);default:return typeof n=="object"&&(n==null?void 0:n.resourceType)===t}}function sM(e){return!!(e&&typeof e=="object"&&"start"in e)}function ir(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function BE(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 tv(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(a1(i)&&a1(s)){if(!tv(i,s))return!1}else if(i!==s)return!1}return!0}function a1(e){return e!==null&&typeof e=="object"}function l1(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return aM(e??{},t)}return e}function aM(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function lM(e){return new hM(e).parse()}const UE=dO(rM),nv=Object.create(null),c1=Object.create(null);function rv(e){let t;return e?(t=c1[e],t||(t=c1[e]=Object.create(null))):t=UE,t}function u1(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)cM(o,t)}function cM(e,t){if(!(e!=null&&e.name))throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const n=lM(e),r=rv(t);r[e.name]=n,t&&e.url===t&&(nv[t]=n);for(const o of n.innerTypes)o.parentType=n,r[o.name]=o}function uM(e){return!!UE[e]}function ov(e,t){return rv(t)[e]}function dM(e,t){const n=rv(t)[e];if(!n)throw new Fe(si("Unknown data type: "+e));return n}function fM(e){return!!nv[e]}function Ef(e){return nv[e]}class hM{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:gM(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=zh(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[zh(t,c.path)]=l;break}c=c.parent}if(!c){const u=zh(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&&!ks((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:h1(t),title:t.label,description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path??"",parent:ks((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;mM(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&&!ks(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&&!ks(this.backboneContext.path,t==null?void 0:t.path));else this.innerTypes.push(this.backboneContext.type),delete this.backboneContext;this.slicingContext&&!ks(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!!(ks(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);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)}}parseElementDefinitionType(t){return(t.type??[]).map(n=>{var o;let r;return(n.code==="BackboneElement"||n.code==="Element")&&(r=h1(t)),r||(r=(o=vc(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=d1(t.max),r=(i=t.base)!=null&&i.max?d1(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:f1(yn(o,"fixed[x]")),pattern:f1(yn(o,"pattern[x]")),binding:t.binding}}}function d1(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function zh(e,t=""){return pM(e.path,t)}function pM(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function ks(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function f1(e){return Array.isArray(e)&&e.length>0?e[0]:Xt(e)?void 0:e}function mM(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 gM(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 U={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 yM(e){for(const t of e.base??[]){let n=hi.types[t];n||(n={searchParamsDetails:{}},hi.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 h1(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"?vM((i=((o=e.base)==null?void 0:o.path)??e.path)==null?void 0:i.split(".")):t}function vM(e){return e.length===1?e[0]:e.map(tn).join("")}function iv(e){var t;return(t=hi.types[e])==null?void 0:t.searchParams}function xM(e,t){var n,r;return(r=(n=hi.types[e])==null?void 0:n.searchParams)==null?void 0:r[t]}function ud(e){const t=e.replaceAll("[x]","").split(".").pop();return VE(t)}function VE(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(SM).join(" ").replace("_"," ").replace(/\s+/g," ")}const wM=new Set(["ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function SM(e){const t=e.toUpperCase();return e===t?e:wM.has(t)?t:t.charAt(0)+e.slice(1)}function ys(e,t){const n=ov(e);if(n)return HE(n.elements,t)}function HE(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 Do(e){return!!(e&&typeof e=="object"&&"resourceType"in e)}function vs(e){return!!(e&&typeof e=="object"&&"reference"in e)}const hi={types:{}};function ku(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 Xa=()=>[],En={empty:(e,t)=>ge(t.length===0),exists:(e,t,n)=>ge(n?t.filter(r=>Xo(n.eval(e,[r]))).length>0:t.length>0),all:(e,t,n)=>ge(t.every(r=>Xo(n.eval(e,[r])))),allTrue:(e,t)=>{for(const n of t)if(!n.value)return ge(!1);return ge(!0)},anyTrue:(e,t)=>{for(const n of t)if(n.value)return ge(!0);return ge(!1)},allFalse:(e,t)=>{for(const n of t)if(n.value)return ge(!1);return ge(!0)},anyFalse:(e,t)=>{for(const n of t)if(!n.value)return ge(!0);return ge(!1)},subsetOf:Xa,supersetOf:Xa,count:(e,t)=>[{type:U.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)=>ge(t.length===En.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>Xo(n.eval(e,[r]))),select:(e,t,n)=>t.map(r=>n.eval(e,[r])).flat(),repeat:Xa,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 OE([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t);return[...t,...r]},htmlChecks:(e,t,n)=>[Zr(!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 Xo(i)?r.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);if(typeof n=="boolean")return[{type:U.boolean,value:n}];if(typeof n=="number"&&(n===0||n===1))return ge(!!n);if(typeof n=="string"){const r=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(r))return ge(!0);if(["false","f","no","n","0","0.0"].includes(r))return ge(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:ge(En.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="number"?[{type:U.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:U.integer,value:parseInt(n,10)}]:typeof n=="boolean"?[{type:U.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:ge(En.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:U.date,value:ku(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:ge(En.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:U.dateTime,value:ku(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:ge(En.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="number"?[{type:U.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:U.decimal,value:parseFloat(n)}]:typeof n=="boolean"?[{type:U.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:ge(En.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return ir(n)?[{type:U.Quantity,value:n}]:typeof n=="number"?[{type:U.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:U.Quantity,value:{value:parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:U.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:ge(En.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return n==null?[]:ir(n)?[{type:U.string,value:`${n.value} '${n.unit}'`}]:[{type:U.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:ge(En.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:U.time,value:ku("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:ge(En.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)=>zr(Math.abs,e,t),ceiling:(e,t)=>zr(Math.ceil,e,t),exp:(e,t)=>zr(Math.exp,e,t),floor:(e,t)=>zr(Math.floor,e,t),ln:(e,t)=>zr(Math.log,e,t),log:(e,t,n)=>zr((r,o)=>Math.log(r)/Math.log(o),e,t,n),power:(e,t,n)=>zr(Math.pow,e,t,n),round:(e,t)=>zr(Math.round,e,t),sqrt:(e,t)=>zr(Math.sqrt,e,t),truncate:(e,t)=>zr(n=>n|0,e,t),children:Xa,descendants:Xa,trace:(e,t,n)=>(console.log("trace",t,n),t),now:()=>[{type:U.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:U.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:U.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,o)=>{var u;const i=En.toDateTime(e,n.eval(e,t));if(i.length===0)throw new Error("Invalid start date");const s=En.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=RE(i[0].value,s[0].value);return[{type:U.Quantity,value:{value:c[l],unit:l}}]},is:(e,t,n)=>{let r="";return n instanceof sv?r=n.name:n instanceof lv&&(r=n.left.name+"."+n.right.name),r?t.map(o=>({type:U.boolean,value:zE(o,r)})):[]},not:(e,t)=>En.toBoolean(e,t).map(n=>({type:U.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 Zr(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:U.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:U.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:U.BackboneElement,value:{namespace:"System",name:"Integer"}}:Do(n)?{type:U.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:U.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:U.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}]=Vr(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(Zr):[Zr(i)]}function zr(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Vr(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?U.Quantity:n[0].type,u=i?{...o,value:l}:l;return[{type:c,value:u}]}function Vr(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 bM{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 Rs{constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class sv{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 Do(n)&&n.resourceType===this.name?t:yn(t,this.name)}toString(){return this.name}}class CM{eval(){return[]}toString(){return"{}"}}class jM extends T5{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 av extends yc{constructor(t,n){super("as",t,n)}eval(t,n){return En.ofType(t,this.left.eval(t,n),this.right)}}class $n extends yc{}class vr extends $n{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"?ge(u):ir(i)?[{type:U.Quantity,value:{...i,value:u}}]:[Zr(u)]}}class EM extends yc{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:U.string,value:i.map(s=>s.value).join("")}]:i}}class TM extends $n{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return ge(r.some(i=>i.value===o[0].value))}}class PM extends $n{constructor(t,n){super("in",t,n)}eval(t,n){const r=xo(this.left.eval(t,n)),o=this.right.eval(t,n);return r?ge(o.some(i=>i.value===r.value)):[]}}class lv extends yc{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 WE extends yc{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return OE([...r,...o])}}class kM extends $n{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return LE(r,o)}}class RM extends $n{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return ME(LE(r,o))}}class DM extends $n{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return FE(r,o)}}class IM extends $n{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return ME(FE(r,o))}}class cv extends $n{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 ge(zE(r[0],o))}}class _M extends $n{constructor(t,n){super("and",t,n)}eval(t,n){const r=xo(this.left.eval(t,n),"boolean"),o=xo(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!0&&(o==null?void 0:o.value)===!0?ge(!0):(r==null?void 0:r.value)===!1||(o==null?void 0:o.value)===!1?ge(!1):[]}}class AM extends $n{constructor(t,n){super("or",t,n)}eval(t,n){const r=xo(this.left.eval(t,n),"boolean"),o=xo(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!1&&(o==null?void 0:o.value)===!1?ge(!1):r!=null&&r.value||o!=null&&o.value?ge(!0):[]}}class NM extends $n{constructor(t,n){super("xor",t,n)}eval(t,n){const r=xo(this.left.eval(t,n),"boolean"),o=xo(this.right.eval(t,n),"boolean");return!r||!o?[]:ge(r.value!==o.value)}}class OM extends $n{constructor(t,n){super("implies",t,n)}eval(t,n){const r=xo(this.left.eval(t,n),"boolean"),o=xo(this.right.eval(t,n),"boolean");return(o==null?void 0:o.value)===!0||(r==null?void 0:r.value)===!1?ge(!0):!r||!o?[]:ge(!1)}}class uv{constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=En[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 dv{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 MM=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class LM{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;return this.consumeWhile(()=>/[\d-]/.exec(this.curr())),this.curr()==="T"&&(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"?this.advance():(this.curr()==="+"||this.curr()==="-")&&(this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())))),this.buildToken("DateTime",this.str.substring(t,this.pos.index))}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()===" "&&$M(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 $M(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&MM.includes(e.value)))}const FM=["true","false"],zM=["!=","!~","<=",">=","{}","->"];function BM(e){return new LM(e,FM,zM).tokenize()}const Ve={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},UM={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}},VM={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new dv(t,n)},precedence:Ve.Indexer},HM={parse(e,t){if(!(t instanceof sv))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new uv(t.name,n)},precedence:Ve.FunctionCall};function WM(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 qM(){return new P5().registerPrefix("String",{parse:(e,t)=>new Rs({type:U.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new Rs({type:U.dateTime,value:ku(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new Rs({type:U.Quantity,value:WM(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new Rs({type:t.value.includes(".")?U.decimal:U.integer,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new Rs({type:U.boolean,value:!0})}).registerPrefix("false",{parse:()=>new Rs({type:U.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new sv(t.value)}).registerPrefix("{}",{parse:()=>new CM}).registerPrefix("(",UM).registerInfix("[",VM).registerInfix("(",HM).prefix("+",Ve.UnaryAdd,(e,t)=>new jM("+",t,n=>n)).prefix("-",Ve.UnarySubtract,(e,t)=>new vr("-",t,t,(n,r)=>-r)).infixLeft(".",Ve.Dot,(e,t,n)=>new lv(e,n)).infixLeft("/",Ve.Divide,(e,t,n)=>new vr("/",e,n,(r,o)=>r/o)).infixLeft("*",Ve.Multiply,(e,t,n)=>new vr("*",e,n,(r,o)=>r*o)).infixLeft("+",Ve.Add,(e,t,n)=>new vr("+",e,n,(r,o)=>r+o)).infixLeft("-",Ve.Subtract,(e,t,n)=>new vr("-",e,n,(r,o)=>r-o)).infixLeft("|",Ve.Union,(e,t,n)=>new WE(e,n)).infixLeft("=",Ve.Equals,(e,t,n)=>new kM(e,n)).infixLeft("!=",Ve.NotEquals,(e,t,n)=>new RM(e,n)).infixLeft("~",Ve.Equivalent,(e,t,n)=>new DM(e,n)).infixLeft("!~",Ve.NotEquivalent,(e,t,n)=>new IM(e,n)).infixLeft("<",Ve.LessThan,(e,t,n)=>new vr("<",e,n,(r,o)=>r<o)).infixLeft("<=",Ve.LessThanOrEquals,(e,t,n)=>new vr("<=",e,n,(r,o)=>r<=o)).infixLeft(">",Ve.GreaterThan,(e,t,n)=>new vr(">",e,n,(r,o)=>r>o)).infixLeft(">=",Ve.GreaterThanOrEquals,(e,t,n)=>new vr(">=",e,n,(r,o)=>r>=o)).infixLeft("&",Ve.Ampersand,(e,t,n)=>new EM(e,n)).infixLeft("and",Ve.And,(e,t,n)=>new _M(e,n)).infixLeft("as",Ve.As,(e,t,n)=>new av(e,n)).infixLeft("contains",Ve.Contains,(e,t,n)=>new TM(e,n)).infixLeft("div",Ve.Divide,(e,t,n)=>new vr("div",e,n,(r,o)=>r/o|0)).infixLeft("in",Ve.In,(e,t,n)=>new PM(e,n)).infixLeft("is",Ve.Is,(e,t,n)=>new cv(e,n)).infixLeft("mod",Ve.Modulo,(e,t,n)=>new vr("mod",e,n,(r,o)=>r%o)).infixLeft("or",Ve.Or,(e,t,n)=>new AM(e,n)).infixLeft("xor",Ve.Xor,(e,t,n)=>new NM(e,n)).infixLeft("implies",Ve.Implies,(e,t,n)=>new OM(e,n))}const GM=qM();function qE(e){return new bM(e,GM.construct(BM(e)).consumeAndParse())}function QM(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]=Zr(n[r]))}return ql(e,n).map(r=>r.value)}function ql(e,t,n){const r=n??{};return qE(e).eval({variables:r},t).map(i=>{var s;return{type:i.type,value:(s=i.value)==null?void 0:s.valueOf()}})}var Uo=(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))(Uo||{});function Tf(e,t){var r,o;let n=(o=(r=hi.types[e])==null?void 0:r.searchParamsDetails)==null?void 0:o[t.code];return n||(n=YM(e,t)),n}function KM(e,t,n){const r=hi.types[e];r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function YM(e,t){const n=t.code,r=ZM(n),o=tL(e,t.expression),i={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const l of o){const c=Sl(l);c.length===1&&c[0]instanceof $n?i.propertyTypes.add("boolean"):GE(i,Sl(l),e,1)}const s={columnName:r,type:eL(t,i.propertyTypes),elementDefinitions:i.elementDefinitions,array:i.array};return KM(e,n,s),s}function GE(e,t,n,r){const o=t[r];if(o instanceof av){e.propertyTypes.add(o.right.toString());return}if(o instanceof uv){XM(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 dv&&(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;JM(d)&&(d=s.type[0].code),GE(e,t,d,c)}}function XM(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 cv){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function JM(e){return e==="Element"||e==="BackboneElement"}function ZM(e){return e.split("-").reduce((t,n,r)=>t+(r?tn(n):n),"")}function eL(e,t){switch(e.type){case"date":return t.size===1&&t.has(U.date)?"DATE":"DATETIME";case"number":return"NUMBER";case"quantity":return"QUANTITY";case"reference":return t.has(U.canonical)?"CANONICAL":"REFERENCE";case"token":return t.size===1&&t.has(U.boolean)?"BOOLEAN":"TEXT";default:return"TEXT"}}function tL(e,t){const n=[],r=qE(t);return im(e,r.child,n),n}function im(e,t,n){t instanceof WE?(im(e,t.left,n),im(e,t.right,n)):t.toString().startsWith(e+".")&&n.push(t)}function Sl(e){if(e instanceof av||e instanceof dv)return[Sl(e.left),e].flat();if(e instanceof $n)return[e];if(e instanceof lv)return[Sl(e.left),Sl(e.right)].flat();if(e instanceof uv){if(e.name==="where"&&!(e.args[0]instanceof cv))return[];if(e.name==="last")return[]}return[e]}const Sc=20;var ne=(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))(ne||{});const QE={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"},fv={eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",sa:"sa",eb:"eb",ap:"ap"};function nL(e){let t;for(const n of e.pathname.split("/"))n&&(t=n);return oL(t,e.searchParams.entries())}function rL(e){return nL(new URL(e,"https://example.com/"))}function oL(e,t){const n={resourceType:e};for(const[r,o]of t)iL(n,r,o);return n}function iL(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=Ya(e.filters,{code:t,operator:"eq",value:n});return}switch(r){case"_sort":sL(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=p1(n);o==="iterate"&&(c.modifier="iterate"),e.include=Ya(e.include,c);break}case"_revinclude":{const c=p1(n);o==="iterate"&&(c.modifier="iterate"),e.revInclude=Ya(e.revInclude,c);break}case"_fields":case"_elements":e.fields=n.split(",");break;default:{const c=(l=(s=hi.types[e.resourceType])==null?void 0:s.searchParams)==null?void 0:l[r];c?e.filters=Ya(e.filters,aL(c,o,n)):e.filters=Ya(e.filters,uL(r,o,n))}}}function sL(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 aL(e,t,n){if(t==="missing")return{code:e.code,operator:"missing",value:n};switch(e.type){case"number":case"date":case"quantity":return lL(e,n);case"reference":case"string":case"token":case"uri":return cL(e,t,n);default:throw new Error("Unrecognized search parameter type: "+e.type)}}function lL(e,t){const{operator:n,value:r}=dL(t);return{code:e.code,operator:n,value:r}}function cL(e,t,n){return{code:e.code,operator:fL(t),value:n}}function uL(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 fv&&(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 dL(e){const t=e.substring(0,2),n=fv[t];return n?{operator:n,value:e.substring(2)}:{operator:"eq",value:e}}function fL(e){return QE[e]??"eq"}function p1(e){const t=e.split(":");if(t.includes("*"))throw new Fe(si("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new Fe(si(`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 Fe(si(`Invalid include value '${e}'`))}function Hs(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(n=>t.push(hL(n))),e.sortRules&&e.sortRules.length>0&&t.push(pL(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(m1("_include",n))),e.revInclude&&e.revInclude.forEach(n=>t.push(m1("_revinclude",n))),t.length===0?"":(t.sort((n,r)=>n.localeCompare(r)),"?"+t.join("&"))}function hL(e){const t=e.operator in QE?":"+e.operator:"",n=e.operator!=="eq"&&e.operator in fv?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function pL(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function m1(e,t){return e+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function mL(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 gL(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 g1(){const e=new Uint32Array(28);return crypto.getRandomValues(e),K5(e.buffer)}async function yL(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function KE(){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 YE(e){var o,i,s;const t={};e=wi(e);for(const l of e.entry||[]){(o=l.resource)==null||delete o.meta;const c=(i=l.resource)==null?void 0:i.id;c&&(t[c]=KE(),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)=>vL(l,c,t),2);return xL(JSON.parse(r))}function vL(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 xL(e){const t=SL(e),{sorted:n,cycles:r}=wL(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 wL(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 XE(e,t){for(const n in e)if(e[n]&&typeof e[n]=="object"){const r=e[n];if(vs(r)){const o=r.reference;o.startsWith("urn:uuid:")&&t(o)}else XE(r,t)}}function SL(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&&XE(n.resource,o=>{t[o]&&t[o].push(r)})}return t}class JE{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 Qt={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"};class ZE{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 bL{constructor(){this.emitter=new ZE}dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,n){this.emitter.addEventListener(t,n)}removeEventListener(t,n){this.emitter.removeEventListener(t,n)}}const sm={"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"},CL=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],hv=["DiagnosticReport-update"];function jL(e){return hv.includes(e)}function EL(e){if(hv.includes(e))throw new Fe(It(`'context.version' is required for '${e}'.`))}const TL={"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 PL(e){return CL.includes(e)}function eT(e){return!!e.endpoint}function y1(e){if(!pv(e))throw new Fe(It("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 eT(e)&&(i.endpoint=e.endpoint),new URLSearchParams(i).toString()}function pv(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(!sm[i])return!1;return!(eT(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function v1(e,t,n,r){if(typeof t!="object")throw new Fe(It(`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 Fe(It(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new Fe(It(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const o=r.resourceType;if(o!=="*"){if(!PL(t.resourceType))throw new Fe(It(`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 Fe(It(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${o}.`))}}function kL(e,t,n,r,o){if(o.set(t.key,(o.get(t.key)??0)+1),!r.isArray)v1(e,t.resource,n,r);else{const{resources:i}=t;if(!i)throw new Fe(It(`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)v1(e,s,n,r)}}function RL(e,t){const n=new Map,r=TL[e];for(let o=0;o<t.length;o++){const i=t[o].key;if(!r[i])throw new Fe(It(`Key '${i}' not found for event '${e}'. Make sure to add only valid keys.`));kL(e,t[o],o,r[i],n)}for(const[o,i]of Object.entries(r)){if(!(i.optional||n.has(o)))throw new Fe(It(`Missing required key '${o}' on context for '${e}' event.`));if(!i.manyAllowed&&(n.get(o)||0)>1)throw new Fe(It(`${n.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function x1(e,t,n,r){if(!(e&&typeof e=="string"))throw new Fe(It("Must provide a topic."));if(!sm[t])throw new Fe(It(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(sm).join(", ")}`));if(typeof n!="object")throw new Fe(It("context must be a context object or array of context objects."));if(hv.includes(t)&&!r)throw new Fe(It(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(n)?n:[n];return RL(t,o),{timestamp:new Date().toISOString(),id:KE(),event:{"hub.topic":e,"hub.event":t,context:o,...r?{"context.versionId":r}:{}}}}class DL extends bL{constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new Fe(It("Subscription request should contain an endpoint."));if(!pv(t))throw new Fe(It("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 IL(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=mL(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 _L(e){return e.split(".").length===3}function mv(e){const[t,n,r]=e.split(".");return IL(n)}function AL(e){try{return typeof mv(e).login_id=="string"}catch{return!1}}function NL(e){try{const n=mv(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}var w1;class xr{constructor(t){this[w1]="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)}}w1=Symbol.toStringTag;class OL{constructor(t){this.storage=t??(typeof localStorage<"u"?localStorage:new ML)}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?On(n):void 0)}}class ML{constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(t){return this.data.get(t)??null}setItem(t,n){n?this.data.set(t,n):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}const LL="3.0.0-0cc50f0d",$L=Qt.FHIR_JSON+", */*; q=0.1",FL="https://api.medplum.com/",zL=1e3,BL=6e4,UL=0,S1="Binary/",b1={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]};class VL extends ZE{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)??HL(),this.storage=(t==null?void 0:t.storage)??new OL,this.createPdfImpl=t==null?void 0:t.createPdf,this.baseUrl=j1((t==null?void 0:t.baseUrl)??FL),this.fhirBaseUrl=j1(ou(this.baseUrl,(t==null?void 0:t.fhirUrlPath)??"fhir/R4/")),this.authorizeUrl=ou(this.baseUrl,(t==null?void 0:t.authorizeUrl)??"oauth2/authorize"),this.tokenUrl=ou(this.baseUrl,(t==null?void 0:t.tokenUrl)??"oauth2/token"),this.logoutUrl=ou(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 JE((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 xr(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,Qt.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 xr((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 xr(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 xr(this.search(t,n,r).then(T1));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 T1(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 b1;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 xr(Promise.reject(new Error("Missing reference")));if(r==="system")return new xr(Promise.resolve(b1));const[o,i]=r.split("/");return!o||!i?new xr(Promise.reject(new Error("Invalid reference"))):this.readResource(o,i,n)}requestSchema(t){if(uM(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new xr((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);u1(s.data.StructureDefinitionList);for(const l of s.data.SearchParameterList)yM(l)})());return this.setCacheEntry(n,o),o}requestProfileSchema(t){if(fM(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new xr((async()=>{const i=await this.searchOne("StructureDefinition",{url:t,_sort:"-_lastUpdated"});i?u1([i],t):console.warn(`No StructureDefinition found for ${t}!`)})());return this.setCacheEntry(n,o),o}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 Fe(ot(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=mt(t),s=t.subject),t.resourceType==="ServiceRequest"&&(i=t.encounter,s=t.subject),t.resourceType==="Patient"&&(s=mt(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[mt(t)],encounter:i,subject:s,sender:o?mt(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")+`?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,Qt.JSON,n)}graphql(t,n,r,o){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},Qt.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",Jy(t),"$push"),{destination:at(n),body:r,contentType:o,waitForResponse:i},Qt.FHIR_JSON,s)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){var n,r;(!((n=this.sessionDetails)!=null&&n.profile)||at(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=NL(t),this.medplumServer=AL(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(S1)&&(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:S1+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;r.Prefer="respond-async";const o=await this.fetchWithRetry(t,n);if(o.status===202){const i=await E1(o);if(i)return this.pollStatus(i)}return this.parseResponse(o,"POST",t)}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 xr(Promise.resolve(t)))}deleteCacheEntry(t){this.requestCache&&this.requestCache.delete(t)}async request(t,n,r={}){await this.refreshIfExpired(),r.method=t,this.addFetchOptionsDefaults(r);const o=await this.fetchWithRetry(n,r);return this.parseResponse(o,t,n,r)}async parseResponse(t,n,r,o={}){if(t.status===401)return this.handleUnauthenticated(n,r,o);if(t.status===204||t.status===304)return;const i=t.headers.get("content-type"),s=i==null?void 0:i.includes("json");if(t.status===404&&!s)throw new Fe(M5);const l=t.headers.get("content-location"),c=o.redirect??this.options.redirect;if(t.status===201&&l&&c==="follow")return this.request("GET",l,{...o,body:void 0});let u;if(s)try{u=await t.json()}catch(d){throw console.error("Error parsing response",t.status,d),d}else u=await t.text();if(t.status>=400)throw new Fe(ot(u));return u}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 o1(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){let n=!0,r;const o=2e3;for(;n;){const i={};this.addFetchOptionsDefaults(i);const s=await this.fetchWithRetry(t,i);if(s.status!==202&&(n=!1,r=s,s.status===201)){const l=await E1(s);l&&(r=await this.fetchWithRetry(l,i))}await o1(o)}return this.parseResponse(r,"POST",t)}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 Fe(ot(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&&!TE(c.response.outcome)?l.reject(new Fe(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=$L),n["X-Medplum"]="extended",t.body&&!n["Content-Type"]&&(n["Content-Type"]=Qt.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||typeof File<"u"&&n instanceof File||typeof Uint8Array<"u"&&n instanceof 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=g1();sessionStorage.setItem("pkceState",t);const n=g1();sessionStorage.setItem("codeVerifier",n);const r=await yL(n),o=Y5(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??C1()),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)??C1()),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=gL(t+":"+n)}async fhircastSubscribe(t,n){if(!(typeof t=="string"&&t!==""))throw new Fe(It("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new Fe(It("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",y1(r),Qt.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!i)throw new Error("Invalid response!");return r.endpoint=i,r}async fhircastUnsubscribe(t){if(!pv(t))throw new Fe(It("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new Fe(It("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post("/fhircast/STU3",y1(t),Qt.FORM_URL_ENCODED)}fhircastConnect(t){return new DL(t)}async fhircastPublish(t,n,r,o){return jL(n)?this.post(`/fhircast/STU3/${t}`,x1(t,n,r,o),Qt.JSON):(EL(n),this.post(`/fhircast/STU3/${t}`,x1(t,n,r),Qt.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":Qt.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 Fe(si(s.error_description))}catch(s){throw new Fe(si("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(_L(n)){const r=mv(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}}function HL(){if(!globalThis.fetch)throw new Error("Fetch not available in this environment");return globalThis.fetch.bind(globalThis)}function C1(){return typeof window>"u"?"":window.location.protocol+"//"+window.location.host+"/"}function j1(e){return e.endsWith("/")?e:e+"/"}function ou(e,t){return new URL(t,e).toString()}async function E1(e){var o,i;const t=e.headers.get("content-location");if(t)return t;const n=e.headers.get("location");if(n)return n;const r=await e.json();if(bf(r)&&((i=(o=r.issue)==null?void 0:o[0])!=null&&i.diagnostics))return r.issue[0].diagnostics}function T1(e){var n;const t=((n=e.entry)==null?void 0:n.map(r=>r.resource))??[];return Object.assign(t,{bundle:e})}const WL="http://hl7.org";function qL(e,t){return!(t.pattern&&!Zy(e,t.pattern)||t.fixed&&!xc(e,t.fixed))}function GL(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(qL(e,o))return!0;break;case"type":return!e||!(i!=null&&i.length)?!1:i.some(s=>s.code===e.type)}return!1}var tT=p.createContext(void 0);function Pf(){return p.useContext(tT)}function te(){return Pf().medplum}function kf(){return Pf().navigate}function gv(){return Pf().profile}function QL(e){let t=e.medplum,n=e.navigate??KL,[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(tT.Provider,{value:i,children:e.children})}function KL(e){window.location.assign(e)}function tt(e,t){let n=te(),[r,o]=p.useState(P1(n,e)),i=p.useCallback(s=>{xc(s,r)||o(s)},[r,o]);return p.useEffect(()=>{i(P1(n,e))},[n,e,i]),p.useEffect(()=>{let s=!0;return vs(e)&&n.readReference(e).then(l=>{s&&i(l)}).catch(l=>{s&&(i(void 0),t&&t(ot(l)))}),()=>s=!1},[n,r,e,i,t]),r}function P1(e,t){if(t){if(Do(t))return t;if(vs(t))return e.getCachedReference(t)}}function YL(e,t){return nT("searchOne",e,t)}function xa(e,t){return nT("searchResources",e,t)}function nT(e,t,n){let r=te(),[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(O5)}).catch(m=>{l(!1),u(void 0),f(ot(m))}))},[r,e,t,n,o,u]),[c,s,d]}function XL(e){const t=e.value;return t?a.jsx(a.Fragment,{children:eO(t)}):null}function k1(e,t){return e.line&&e.line.length>t?e.line[t]:""}function R1(e,t,n){const r=e.line||[];for(;r.length<=t;)r.push("");return r[t]=n,{...e,line:r}}function JL(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(R1(r.current||{},0,h))}function c(h){o(R1(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(ct,{"data-testid":"address-use",defaultValue:t.use,onChange:h=>i(h.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(ct,{"data-testid":"address-type",defaultValue:t.type,onChange:h=>s(h.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(oe,{placeholder:"Line 1",defaultValue:k1(t,0),onChange:h=>l(h.currentTarget.value)}),a.jsx(oe,{placeholder:"Line 2",defaultValue:k1(t,1),onChange:h=>c(h.currentTarget.value)}),a.jsx(oe,{placeholder:"City",defaultValue:t.city,onChange:h=>u(h.currentTarget.value)}),a.jsx(oe,{placeholder:"State",defaultValue:t.state,onChange:h=>d(h.currentTarget.value)}),a.jsx(oe,{placeholder:"Postal Code",defaultValue:t.postalCode,onChange:h=>f(h.currentTarget.value)})]})}function ZL(e){const t=gv(),[n,r]=p.useState(e.defaultValue||{});function o(i){const s=i?{text:i,authorReference:t&&mt(t),time:new Date().toISOString()}:{};r(s),e.onChange&&e.onChange(s)}return a.jsx(oe,{name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:i=>o(i.currentTarget.value)})}var e$={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"},t$=Object.defineProperty,n$=Object.defineProperties,r$=Object.getOwnPropertyDescriptors,dd=Object.getOwnPropertySymbols,rT=Object.prototype.hasOwnProperty,oT=Object.prototype.propertyIsEnumerable,D1=(e,t,n)=>t in e?t$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I1=(e,t)=>{for(var n in t||(t={}))rT.call(t,n)&&D1(e,n,t[n]);if(dd)for(var n of dd(t))oT.call(t,n)&&D1(e,n,t[n]);return e},o$=(e,t)=>n$(e,r$(t)),i$=(e,t)=>{var n={};for(var r in e)rT.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dd)for(var r of dd(e))t.indexOf(r)<0&&oT.call(e,r)&&(n[r]=e[r]);return n},fe=(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=i$(s,["color","size","stroke","children"]);return p.createElement("svg",I1(o$(I1({ref:i},e$),{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:Me.string,size:Me.oneOfType([Me.string,Me.number]),stroke:Me.oneOfType([Me.string,Me.number])},r.displayName=`${t}`,r},s$=fe("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"}]]),bc=fe("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"}]]),a$=fe("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"}]]),l$=fe("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"}]]),c$=fe("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"}]]),u$=fe("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"}]]),d$=fe("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"}]]),f$=fe("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"}]]),h$=fe("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"}]]),p$=fe("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"}]]),m$=fe("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"}]]),g$=fe("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=fe("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"}]]),Rf=fe("check","IconCheck",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]),y$=fe("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"}]]),v$=fe("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),x$=fe("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"}]]),fd=fe("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"}]]),hd=fe("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"}]]),yv=fe("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"}]]),w$=fe("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"}]]),iT=fe("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"}]]),S$=fe("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"}]]),b$=fe("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"}]]),C$=fe("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"}]]),j$=fe("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"}]]),Df=fe("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"}]]),If=fe("equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]),_1=fe("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"}]]),E$=fe("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"}]]),T$=fe("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"}]]),P$=fe("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"}]]),k$=fe("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"}]]),R$=fe("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"}]]),D$=fe("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"}]]),I$=fe("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"}]]),_$=fe("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"}]]),sT=fe("math-greater","IconMathGreater",[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]]),aT=fe("math-lower","IconMathLower",[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]]),A$=fe("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"}]]),N$=fe("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"}]]),O$=fe("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"}]]),M$=fe("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"}]]),L$=fe("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"}]]),$$=fe("player-play","IconPlayerPlay",[["path",{d:"M7 4v16l13 -8z",key:"svg-0"}]]),F$=fe("plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),z$=fe("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"}]]),B$=fe("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"}]]),U$=fe("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"}]]),V$=fe("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"}]]),am=fe("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"}]]),vv=fe("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"}]]),xv=fe("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"}]]),H$=fe("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"}]]),W$=fe("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"}]]),q$=fe("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"}]]),G$=fe("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"}]]),lT=fe("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"}]]),A1=fe("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"}]]),Q$=fe("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"}]]),pd=fe("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);class cT 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(ds,{icon:a.jsx(bc,{size:16}),title:"Something went wrong",color:"red",children:ke(this.state.error)}):this.props.children}}function Ir(){return a.jsx(Bt,{style:{width:"100%",height:"100vh"},children:a.jsx(Nn,{})})}const K$="_main_1szoq_1",Y$={main:K$};function wv(e){const t=e.value;return t?a.jsx(a.Fragment,{children:wc(t,e.options)}):null}function Ye(e){e.preventDefault(),e.stopPropagation()}function uT(e){if(N1(e))return!0;if(e instanceof HTMLTableCellElement){const t=e.children;if(t.length===1&&N1(t[0]))return!0}return!1}function N1(e){return e instanceof HTMLInputElement&&e.type==="checkbox"}function Ie(e){const t=kf(),{to:n,suffix:r,label:o,onClick:i,children:s,...l}=e;let c=X$(n);return r&&(c+="/"+r),a.jsx($e,{href:c,"aria-label":o,onClick:u=>{Ye(u),i?i(u):n&&t(c)},...l,children:s})}function X$(e){if(e){if(typeof e=="string")return J$(e);if(Do(e))return Z$(e);if(vs(e))return e7(e)}return"#"}function J$(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function Z$(e){return`/${e.resourceType}/${e.id}`}function e7(e){return`/${e.reference}`}function pi(e){const t=tt(e.value),n=t?vo(t):e.alt??"",r=(t&&B5(t))??e.src,o=e.radius??"xl",i={...e};return delete i.value,delete i.link,e.link?a.jsx(Ie,{to:t,children:a.jsx(Xi,{src:r,alt:n,radius:o,...i})}):a.jsx(Xi,{src:r,alt:n,radius:o,...i})}const t7="_logoButton_189g3_1",n7="_user_189g3_11",r7="_userName_189g3_21",o7="_userActive_189g3_31",iu={logoButton:t7,user:n7,userName:r7,userActive:o7};function Sv(e){const t=py({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{defaultValue:n,toOption:r,loadOptions:o,onChange:i,onCreate:s,creatable:l}=e,c=i7(n),[u,d]=p.useState(""),[f,h]=p.useState(),[m,g]=p.useState(),[y,C]=p.useState(),[v,w]=p.useState(c.map(r)),[x,S]=p.useState([]),E=e.itemComponent??s7,j=p.useRef();j.current=u;const T=p.useRef(),P=p.useRef(),R=p.useRef();R.current=f;const I=p.useRef();I.current=m;const O=p.useRef();O.current=y;const D=p.useRef();D.current=x;const N=p.useCallback(()=>{if(h(void 0),j.current===P.current&&o===T.current)return;P.current=j.current,T.current=o;const M=new AbortController;g(M),o(j.current??"",M.signal).then(W=>{M.signal.aborted||(S(W.map(r)),g(void 0),O.current?(W.length>0&&i(W.slice(0,1)),C(!1)):W.length>0&&t.openDropdown())}).catch(W=>{M.signal.aborted||W.message.includes("aborted")||ce({color:"red",message:ke(W)})})},[t,o,i,r]),L=p.useCallback(M=>{x&&x.length>0&&t.openDropdown(),t.updateSelectedOptionIndex(),d(M.currentTarget.value),I.current&&(I.current.abort(),g(void 0)),R.current!==void 0&&window.clearTimeout(R.current);const W=window.setTimeout(()=>N(),100);h(W)},[t,x,N]),B=p.useCallback(M=>{const W=[],K=[];for(const ie of M){let ve=x==null?void 0:x.find(Ne=>Ne.value===ie),Ee=ve==null?void 0:ve.resource;!Ee&&l!==!1&&s&&(Ee=s(ie),ve=r(Ee)),Ee&&W.push(Ee),ve&&K.push(ve)}i(W),w(K)},[l,x,i,s,r]),F=M=>{d(""),S([]),P.current=void 0,B(M==="$create"?[u]:[M])},_=p.useCallback(M=>{w(W=>W.filter(K=>K.value!==M.value))},[]),k=p.useCallback(M=>{M.key==="Enter"?!f&&!m?(Ye(M),x&&x.length>0&&(S(x.slice(0,1)),B([x[0].value]))):C(!0):M.key==="Backspace"&&u.length===0&&(Ye(M),_(v[v.length-1]))},[u,v,x,f,m,B,_]);return p.useEffect(()=>()=>{I.current&&I.current.abort()},[]),a.jsxs(Oe,{store:t,onOptionSubmit:F,withinPortal:!0,shadow:"xl",children:[a.jsx(Oe.DropdownTarget,{children:a.jsx(ga,{className:e.className,leftSection:e.leftSection,rightSection:m?a.jsx(Nn,{size:16}):null,children:a.jsxs(Ji.Group,{children:[v.map(M=>a.jsx(Ji,{withRemoveButton:!0,onRemove:()=>_(M),children:M.label},M.value)),a.jsx(Oe.EventsTarget,{children:a.jsx(ga.Field,{role:"searchbox",value:u,placeholder:e.placeholder,onFocus:L,onBlur:()=>t.closeDropdown(),onKeyDown:k,onChange:L})})]})})}),a.jsx(Oe.Dropdown,{children:a.jsxs(Oe.Options,{children:[x.map(M=>a.jsx(Oe.Option,{value:M.value,active:v.includes(M),children:a.jsx(E,{...M})},M.value)),l&&u.trim().length>0&&a.jsxs(Oe.Option,{value:"$create",children:["+ Create ",u]}),!l&&u.trim().length>0&&x.length===0&&a.jsx(Oe.Empty,{children:"Nothing found"})]})})]})}function i7(e){return e?Array.isArray(e)?e:[e]:[]}function s7(e){return a.jsx(Y,{gap:"sm",children:a.jsx("span",{children:e.label})})}const a7="_searchInput_dick8_1",l7={searchInput:a7};function c7(e){return{value:e.id,label:vo(e),resource:e}}function u7(e){const t=kf(),n=te(),r=p.useCallback(async(i,s)=>{const l=f7(i),c={signal:s},u=await n.graphql(l,void 0,void 0,c);return h7(u,i)},[n]),o=p.useCallback(i=>{i.length>0&&t(`/${at(i[0])}`)},[t]);return a.jsx(Sv,{size:"sm",radius:"md",className:l7.searchInput,leftSection:a.jsx(V$,{size:16}),placeholder:"Search",itemComponent:d7,toOption:c7,onChange:o,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const d7=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(pi,{value:e}),a.jsxs("div",{children:[a.jsx(se,{children:vo(e)}),a.jsx(se,{size:"xs",c:"dimmed",children:r})]})]})})});function f7(e){const t=JSON.stringify(e);return DE(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 h7(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),m7(p7(n),t).slice(0,5)}function p7(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 m7(e,t){return e.sort((n,r)=>O1(r,t)-O1(n,t))}function O1(e,t){let n=0;if(e.identifier)for(const r of e.identifier)n=Math.max(n,M1(r.value,t));if(e.resourceType==="Patient"&&e.name)for(const r of e.name)n=Math.max(n,M1(wc(r),t));return n}function M1(e,t){if(!e)return 0;const n=e.toLowerCase().indexOf(t.toLowerCase());return n<0?0:100-n}function g7(e){var c,u,d,f;const t=Pf(),{medplum:n,profile:r,navigate:o}=t,i=n.getLogins(),[s,l]=p.useState(!1);return a.jsx(An.Header,{p:8,style:{zIndex:101},children:a.jsxs(Y,{justify:"space-between",children:[a.jsxs(Y,{gap:"xs",children:[a.jsx(qn,{className:iu.logoButton,onClick:e.navbarToggle,children:e.logo}),!e.headerSearchDisabled&&a.jsx(u7,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(X,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"pop-top-right"},opened:s,onClose:()=>l(!1),children:[a.jsx(X.Target,{children:a.jsx(qn,{className:We(iu.user,{[iu.userActive]:s}),onClick:()=>l(h=>!h),children:a.jsxs(Y,{gap:7,children:[a.jsx(pi,{value:r,radius:"xl",size:24}),a.jsx(se,{size:"sm",className:iu.userName,children:wc((c=r==null?void 0:r.name)==null?void 0:c[0])}),a.jsx(v$,{size:12,stroke:1.5})]})})}),a.jsxs(X.Dropdown,{children:[a.jsxs(Se,{align:"center",p:"xl",children:[a.jsx(pi,{size:"xl",radius:100,value:t.profile}),a.jsx(wv,{value:(d=(u=t.profile)==null?void 0:u.name)==null?void 0:d[0]}),a.jsx(se,{c:"dimmed",size:"xs",children:(f=n.getActiveLogin())==null?void 0:f.project.display})]}),i.length>1&&a.jsx(X.Divider,{}),i.map(h=>h.profile.reference!==at(t.profile)&&a.jsx(X.Item,{onClick:()=>{n.setActiveLogin(h).then(()=>window.location.reload()).catch(console.log)},children:a.jsxs(Y,{children:[a.jsx(Xi,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(se,{size:"sm",fw:500,children:h.profile.display}),a.jsx(se,{c:"dimmed",size:"xs",children:h.project.display})]})]})},h.profile.reference)),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(q$,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Add another account"}),a.jsx(X.Item,{leftSection:a.jsx(am,{size:14,stroke:1.5}),onClick:()=>o(`/${at(r)}`),children:"Account settings"}),a.jsx(X.Item,{leftSection:a.jsx(_$,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),o("/signin")},children:"Sign out"}),a.jsx(se,{size:"xs",c:"dimmed",ta:"center",children:e.version})]})]})]})})}function y7(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?v7(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&x7(t,n);return t}function v7(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function x7(e,t){e[t.name]=t.value}function Le(e){return a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:t=>{t.preventDefault();const n=y7(t.target);e.onSubmit&&e.onSubmit(n)},children:e.children})}function w7(e){const t=te(),n=t.getUserConfiguration();function r(o){var d,f;const{menuname:i,bookmarkname:s}=o,l=`${e.pathname}?${e.searchParams.toString()}`,c=wi(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"}),ce({color:"green",message:"Success"}),e.onOk()}).catch(h=>{ce({color:"red",message:ke(h)})})}return a.jsx(Cn,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:a.jsx(Le,{onSubmit:r,children:a.jsxs(Se,{children:[a.jsx(S7,{config:n}),a.jsx(oe,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{mt:"sm",type:"submit",children:"OK"})})]})})})}function S7(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(ct,{name:"menuname",defaultValue:n[0],label:"Select Menu Option",data:n,withAsterisk:!0})}function dT(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function b7(e){return typeof e.display=="string"?e.display:dT(e)}function C7(e){return{value:dT(e),label:b7(e),resource:e}}function j7(e){return{code:e,display:e}}function bv(e){const t=te(),{binding:n,creatable:r,clearable:o,expandParams:i,...s}=e,l=p.useCallback(async(c,u)=>{var m;if(!n)return[];const f=(m=(await t.valueSetExpand({...i,url:n,filter:c},{signal:u})).expansion)==null?void 0:m.contains,h=[];for(const g of f)g.code&&!h.some(y=>y.code===g.code)&&h.push(g);return h},[t,i,n]);return a.jsx(Sv,{...s,creatable:r??!0,clearable:o??!0,toOption:C7,loadOptions:l,onCreate:j7})}function fT(e){const{defaultValue:t,onChange:n,...r}=e,[o,i]=p.useState(t);function s(l){const c=l[0],u=T7(c);i(u),n&&n(u)}return a.jsx(bv,{defaultValue:E7(o),onChange:s,...r})}function E7(e){return e?{code:e}:void 0}function T7(e){return e==null?void 0:e.code}function Cv(e){const[t,n]=p.useState(e.defaultValue),r=e.onChange,o=p.useCallback(i=>{n(i),r&&r(i)},[r]);return a.jsx(fT,{"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:0,clearable:!1})}const P7="_menuTitle_9g6l5_1",k7="_link_9g6l5_9",R7="_linkActive_9g6l5_38",lm={menuTitle:P7,link:k7,linkActive:R7};function D7(e){var l;const t=kf(),n=A7(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(An.Navbar,{children:a.jsxs(dr,{p:"xs",children:[!e.resourceTypeSearchDisabled&&a.jsx(An.Section,{mb:"sm",children:a.jsx(Cv,{name:"resourceType",placeholder:"Resource Type",onChange:c=>s(c)},window.location.pathname)}),a.jsxs(An.Section,{grow:!0,children:[(l=e.menus)==null?void 0:l.map(c=>{var u;return a.jsxs(p.Fragment,{children:[a.jsx(se,{className:lm.menuTitle,children:c.title}),(u=c.links)==null?void 0:u.map(d=>a.jsxs(I7,{to:d.href,active:d.href===(n==null?void 0:n.href),onClick:f=>i(f,d.href),children:[a.jsx(_7,{to:d.href,icon:d.icon}),a.jsx("span",{children:d.label})]},d.href))]},`menu-${c.title}`)}),e.displayAddBookmark&&a.jsx(Z,{variant:"subtle",size:"xs",mt:"xl",leftSection:a.jsx(F$,{size:"0.75rem"}),onClick:()=>o(!0),children:"Add Bookmark"})]})]})}),e.pathname&&e.searchParams&&a.jsx(w7,{pathname:e.pathname,searchParams:e.searchParams,visible:r,onOk:()=>o(!1),onCancel:()=>o(!1)})]})}function I7(e){return a.jsx(Ie,{onClick:e.onClick,to:e.to,className:We(lm.link,{[lm.linkActive]:e.active}),children:e.children})}function _7(e){return e.icon?e.icon:a.jsx(Sf,{w:30})}function A7(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=N7(e,t,s.href);l>o&&(o=l,r=s)}return r}function N7(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 O7(e){const[t,n]=p.useState(localStorage.navbarOpen==="true"),r=te(),o=gv();p.useEffect(()=>{function c(){ce({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(Ir,{}):a.jsxs(An,{header:{height:60},navbar:{width:250,breakpoint:"sm",collapsed:{desktop:!o||!t,mobile:!o||!t}},padding:0,children:[o&&a.jsx(g7,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarToggle:l}),o&&t?a.jsx(D7,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,closeNavbar:s,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled}):void 0,a.jsx(An.Main,{className:Y$.main,children:a.jsx(cT,{children:a.jsx(p.Suspense,{fallback:a.jsx(Ir,{}),children:e.children})})})]})}function Cc(e){const{contentType:t,url:n,title:r}=e.value??{};return n?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:n,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:n})}),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:n+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx($e,{href:n,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:M7(r),children:r||"Download"})})]}):null}function M7(e){return e!=null&&e.includes(".")?e:void 0}function L7(e){var t;return a.jsx("div",{children:(t=e.values)==null?void 0:t.map((n,r)=>a.jsx("div",{children:a.jsx(Cc,{value:n,maxWidth:e.maxWidth})},"attatchment-"+r))})}function jv(e){const t=te(),n=p.useRef(null);function r(s){var l;Ye(s),(l=n.current)==null||l.click()}function o(s){Ye(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(ot(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 $7(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(Cc,{value:i,maxWidth:200})}),a.jsx("td",{children:a.jsx(Vt,{title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:l=>{Ye(l);const c=t.slice();c.splice(s,1),o(c)},children:a.jsx(fd,{})})})]},`${s}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(jv,{onUpload:i=>{o([...r.current,i])},children:i=>a.jsx(Vt,{...i,title:"Add",variant:"subtle",size:"sm",color:"green",children:a.jsx(yv,{})})})})]})]})]})}function hT(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(Cc,{value:t,maxWidth:200}),a.jsx(Z,{onClick:o=>{Ye(o),r(void 0)},children:"Remove"})]}):a.jsx(jv,{onUpload:r,children:o=>a.jsx(Z,{...o,children:"Upload..."})})}const pT=["meta","implicitRules","contained","extension","modifierExtension"],mT=["language","text"],F7="_root_1b4d2_1",z7="_compact_1b4d2_14",L1={root:F7,compact:z7};function Ev(e){const{children:t,compact:n}=e;return a.jsx("dl",{className:We(L1.root,{[L1.compact]:n}),children:t})}function ta(e){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:e.term}),a.jsx("dd",{children:e.children})]})}function Yr(e){return a.jsx(a.Fragment,{children:va(e.value)})}function B7(e){return a.jsx(a.Fragment,{children:gs(e.value)})}function gT(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 U7(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(gT,{value:r},`telecom-${t.name}-${r.value}`))]}):null}function V7(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 H7(e){return a.jsx(a.Fragment,{children:aO(e.value)})}function Gl(e){return a.jsx(a.Fragment,{children:Bo(e.value)})}function Tv(e){return a.jsx(a.Fragment,{children:Hl(e.value)})}function W7(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(Gl,{value:t.numerator})," / ",a.jsx(Gl,{value:t.denominator})]}):null}function md(e){if(!e.value)return null;const t=e.value.display||e.value.reference||On(e.value);return e.link!==!1&&e.value.reference?a.jsx(Ie,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}function q7(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(wo,{arrayElement:!0,property:t,propertyType:r,value:o,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${i}-${n.length}`))}):a.jsx(a.Fragment,{})}function wo(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,!Xt(r)&&a.jsx(Vj,{value:r,timeout:2e3,children:({copied:s,copy:l})=>a.jsx(Aa,{label:s?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(Vt,{variant:"subtle",color:s?"teal":"gray",onClick:l,children:s?a.jsx(Rf,{size:"1rem"}):a.jsx(iT,{size:"1rem"})})})})]});if(t!=null&&t.max&&t.max>1&&!e.arrayElement)return n===U.Attachment?a.jsx(L7,{values:r,maxWidth:e.maxWidth}):a.jsx(q7,{property:t,values:r,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case U.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case U.SystemString:case U.string:return a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case U.code:case U.date:case U.decimal:case U.id:case U.integer:case U.positiveInt:case U.unsignedInt:case U.uri:case U.url:return a.jsx(a.Fragment,{children:r});case U.canonical:return a.jsx(md,{value:{reference:r},link:e.link});case U.dateTime:case U.instant:return a.jsx(a.Fragment,{children:Mn(r)});case U.markdown:return a.jsx("pre",{children:r});case U.Address:return a.jsx(XL,{value:r});case U.Annotation:return a.jsx(a.Fragment,{children:r==null?void 0:r.text});case U.Attachment:return a.jsx(Cc,{value:r,maxWidth:e.maxWidth});case U.CodeableConcept:return a.jsx(Yr,{value:r});case U.Coding:return a.jsx(B7,{value:r});case U.ContactDetail:return a.jsx(U7,{value:r});case U.ContactPoint:return a.jsx(gT,{value:r});case U.HumanName:return a.jsx(wv,{value:r});case U.Identifier:return a.jsx(V7,{value:r});case U.Money:return a.jsx(H7,{value:r});case U.Period:return a.jsx(a.Fragment,{children:nO(r)});case U.Quantity:case U.Duration:return a.jsx(Gl,{value:r});case U.Range:return a.jsx(Tv,{value:r});case U.Ratio:return a.jsx(W7,{value:r});case U.Reference:return a.jsx(md,{value:r,link:e.link});case U.Timing:return a.jsx(a.Fragment,{children:_E(r)});case U.Dosage:case U.UsageContext:return a.jsx(cm,{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(cm,{value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function _f(e,t){const n=yn(e,t);return n?Array.isArray(n)?[n.map(r=>r.value),n[0].type]:[n.value,n.type]:[void 0,"undefined"]}function G7(e,t,n){const r=ev(e,t,n);return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function cm(e){const t=e.value,n=t.value;if(!n)return null;const r=t.type,o=ov(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(Ev,{compact:e.compact,children:Object.entries(o.elements).map(i=>{const[s,l]=i;if(pT.includes(s)||mT.includes(s)&&l.path.split(".").length===2)return null;const[c,u]=_f(t,s);return e.ignoreMissingValues&&(!c||Array.isArray(c)&&c.length===0)?null:a.jsx(ta,{term:ud(s),children:a.jsx(wo,{property:l,propertyType:u,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},s)})}):a.jsxs("div",{children:[r," not implemented"]})}function Q7(e,t){const n=e.lastIndexOf(t);if(n===-1)return["",e];const r=e.substring(0,n),o=e.substring(n+t.length);return[r,o]}const wa=b.createContext({profileUrl:void 0,debugMode:!1,getModifiedNestedElement:()=>{}});function K7(e,t,n){const r=Object.create(null);function o(s){return r[s]}const i=e==null?void 0:e.elements;if(i){const s=new Set;for(const[l,c]of Object.entries(i)){const[u,d]=Q7(l,".");s.has(u)&&(r[e.type+"."+l]=c),s.add(l)}}return{debugMode:n??!1,profileUrl:t,getModifiedNestedElement:o}}function yT(e){const{debugMode:t}=p.useContext(wa);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(yt.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,children:null})})]})}function _e(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 vT((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 Af(e,t){var n;return(n=e==null?void 0:e.issue)==null?void 0:n.filter(r=>{var o;return vT((o=r.expression)==null?void 0:o[0],t)})}function vT(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 et(e){const{debugMode:t}=p.useContext(wa);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,a.jsx(yt.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,error:_e(e.outcome,e.htmlFor),"data-testid":e.testId,children:e.children})}function um(e,t,n,r,o){const i=r.type;if(i.length>1)for(const s of i){const l=t.replace("[x]",tn(s.code));l in e&&delete e[l]}return e[n]=o,e}function Y7(e){return!!e&&!Xt(e.url)&&!Xt(e.name)}function X7(e){const{defaultValue:t,onChange:n,...r}=e,[o,i]=p.useState(t);function s(l){const c=Z7(l);i(c),n&&n(c)}return a.jsx(bv,{defaultValue:o&&J7(o),onChange:s,...r})}function J7(e){var t;return(t=e.coding)==null?void 0:t.map(n=>({system:n.system,code:n.code,display:n.display}))}function Z7(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function xT(e){const{defaultValue:t,onChange:n,...r}=e,[o,i]=p.useState(t);function s(l){const c=l[0],u=c&&t6(c);i(u),n&&n(u)}return a.jsx(bv,{defaultValue:o&&e6(o),maxValues:1,onChange:s,...r})}function e6(e){return{system:e.system,code:e.code,display:e.display}}function t6(e){return{system:e.system,code:e.code,display:e.display}}function wT(e){const{path:t,outcome:n}=e,{getModifiedNestedElement:r}=p.useContext(wa),[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 y={...s.current,system:g};g||delete y.system,d(y)}function h(g){const y={...s.current,use:g};g||delete y.use,d(y)}function m(g){const y={...s.current,value:g};g||delete y.value,d(y)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(ct,{"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:_e(n,t+".system")}),a.jsx(ct,{"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:_e(n,t+".use")}),a.jsx(oe,{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:_e(n,t+".value")})]})}function n6(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(oe,{"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(wT,{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 r6(e){if(!e)return"";const t=new Date(e);return jf(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function ST(e){if(!e)return"";const t=new Date(e);return jf(t)?t.toISOString():""}var o6={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.0-0cc50f0d",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function Zi(e){return a.jsx(oe,{id:e.name,name:e.name,"data-autofocus":e.autoFocus,"data-testid":e.name,placeholder:e.placeholder,required:e.required,type:i6(),defaultValue:r6(e.defaultValue),autoFocus:e.autoFocus,error:_e(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(ST(n))}}})}function i6(){return o6.NODE_ENV==="test"?"text":"datetime-local"}function s6(e){const{propertyType:t}=e,n=te(),[r,o]=p.useState(!1),[i,s]=p.useState(),l=p.useMemo(()=>{if(!(!t.profile||t.profile.length===0))return t.profile[0]},[t]);p.useEffect(()=>{l&&(o(!0),n.requestProfileSchema(l).then(()=>{const u=Ef(l);o(!1),s(u)}).catch(u=>{o(!1),console.warn(u)}))},[n,l]);function c(u){e.onChange&&(console.log("Extension",u),e.onChange(u))}return l?r?a.jsxs("div",{children:["Loading ",l,"..."]}):i?a.jsx(Rv,{profileUrl:l,typeName:i.name,defaultValue:e.defaultValue,onChange:c}):a.jsxs("div",{children:["StructureDefinition for ",l," not found"]}):a.jsx(a6,{...e})}function a6(e){return a.jsx(hs,{id:e.name,name:e.name,"data-testid":"extension-json-input",defaultValue:On(e.defaultValue),deserialize:JSON.parse,onChange:t=>{e.onChange&&e.onChange(JSON.parse(t))}})}function l6(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(ct,{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:_e(t,n+".use")}),a.jsx(oe,{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:_e(t,n+".prefix")}),a.jsx(oe,{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:_e(t,n+".given")}),a.jsx(oe,{name:e.name+"-family",placeholder:"Family",defaultValue:r==null?void 0:r.family,onChange:g=>u(g.currentTarget.value),error:_e(t,n+".family")}),a.jsx(oe,{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:_e(t,n+".suffix")})]})}function c6(e){const{path:t,outcome:n}=e,[r,o]=p.useState(e.defaultValue),{getModifiedNestedElement:i}=p.useContext(wa),[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(oe,{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:_e(n,t+".system")}),a.jsx(oe,{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:_e(n,t+".value")})]})}const u6=["USD","EUR","CAD","GBP","AUD"];function d6(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(ct,{defaultValue:n==null?void 0:n.currency,data:u6,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:i});return a.jsx(oe,{type:"number",label:e.label,placeholder:e.placeholder??"Value",defaultValue:((c=n==null?void 0:n.value)==null?void 0:c.toString())??"USD",leftSection:a.jsx(S$,{size:14}),rightSection:l,rightSectionWidth:92,onChange:s})}function f6(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(Zi,{name:e.name+".start",placeholder:"Start",defaultValue:t==null?void 0:t.start,onChange:o=>r({...t,start:o})}),a.jsx(Zi,{name:e.name+".end",placeholder:"End",defaultValue:t==null?void 0:t.end,onChange:o=>r({...t,end:o})})]})}function es(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(ct,{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(oe,{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:h6(o.currentTarget.value)})}}),a.jsx(oe,{placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t==null?void 0:t.unit,onChange:o=>r({...t,unit:o.currentTarget.value})})]})}function h6(e){if(e)return parseFloat(e)}function Pv(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+"-low",defaultValue:t==null?void 0:t.low,onChange:o=>r({...t,low:o})}),a.jsx(es,{name:e.name+"-high",defaultValue:t==null?void 0:t.high,onChange:o=>r({...t,high:o})})]})}function p6(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+"-numerator",defaultValue:t==null?void 0:t.numerator,onChange:o=>r({...t,numerator:o})}),a.jsx(es,{name:e.name+"-denominator",defaultValue:t==null?void 0:t.denominator,onChange:o=>r({...t,denominator:o})})]})}const m6={Observation:"code",User:"email:contains"},g6=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","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 y6(e){return{value:at(e),label:vo(e),resource:e}}function Oa(e){const t=te(),{resourceType:n,searchCriteria:r}=e,[o,i]=p.useState(),s=tt(e.defaultValue,i),l=e.onChange,c=p.useCallback(async(d,f)=>{const h=x6(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 e.defaultValue&&!o&&!s?null:a.jsx(Sv,{name:e.name,required:e.required,itemComponent:v6,defaultValue:s,placeholder:e.placeholder,maxValues:1,toOption:y6,loadOptions:c,onChange:u,clearable:!0})}const v6=p.forwardRef(({label:e,resource:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs(Y,{wrap:"nowrap",children:[a.jsx(pi,{value:t}),a.jsxs("div",{children:[a.jsx(se,{children:e}),a.jsx(se,{size:"xs",c:"dimmed",children:t.birthDate})]})]})}));function x6(e){return m6[e]??(g6.includes(e)?"name":"_id")}function Nf(e){const{onChange:t}=e,n=te(),[r,o]=p.useState(e.defaultValue),[i,s]=p.useState(()=>w6(e.targetTypes)),[l,c]=p.useState(()=>S6(e.defaultValue,i)),u=p.useRef(new JE),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(y=>{if(!C6(y))return Promise.resolve(y);m=!0;const C=y.value,v=u.current.get(C);if(v)return v;const w=b6(n,y.value).then(S=>{const E={...y};return S?Cf(S.type)?(E.resourceType=S.type,E.name=S.name,E.title=S.title):(console.error(`StructureDefinition.type missing for ${y.value}`),E.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${y.value}`),E.error="StructureDefinition not found"),E}).catch(S=>(console.error(S),{...y,error:S})),x=new xr(w);return u.current.set(C,x),x});!g||!m||Promise.all(g).then(y=>{if(s(y),!l)return;const C=y.findIndex(v=>v.value===l.value||v.resourceType===l.resourceType);if(C===-1){console.debug(`defaultValue had unexpected resourceType: ${l.resourceType}`);return}c(y[C])}).catch(console.error)},[n,l,i]);const f=p.useCallback(m=>{const g=m?mt(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(ct,{"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,y=i.find(C=>C.value===g);c(y)},data:h}),!i&&a.jsx(Cv,{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(Oa,{resourceType:l==null?void 0:l.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:d,onChange:f})]})}function w6(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 S6(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 b6(e,t){const n=Ef(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 C6(e){return e.type==="profile"&&!(e!=null&&e.error)&&Xt(e.resourceType)}const j6="_indented_ldk1d_1",bT={indented:j6};function E6(e,t,n){var r,o;for(const i of[n.elements,(r=n.typeSchema)==null?void 0:r.elements]){let s;if(Cf(i)){const l=HE(i,t.path);l&&(s=ev(e.value,t.path,l))}if(s)return((o=J5(s))==null?void 0:o.some(l=>GL(l,t,n,i)))??!1}return!1}function T6(e,t,n){var r;if(e)for(const o of t){const i={value:e,type:((r=o.typeSchema)==null?void 0:r.name)??o.type[0].code};if(n.every(s=>E6(i,s,o)))return o.name}}function $1(e,t,n){if(!n||n.slices.length===0)return[e];const r=new Array(t.length+1);for(let o=0;o<r.length;o++)r[o]=[];for(const o of e){const i=T6(o,t,n.discriminator);let s=i?t.findIndex(l=>l.name===i):-1;s===-1&&(s=t.length),r[s].push(o)}for(let o=0;o<t.length;o++)r[o].length===0&&r[o].push(void 0);return r}function P6(e){return e.type!==void 0&&e.type.length>0}function k6(e){var C;const{property:t}=e,n=te(),[r,o]=p.useState(!0),[i,s]=p.useState([]),[l]=p.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[c,u]=p.useState([[]]),d=(C=t.type[0])==null?void 0:C.code;p.useEffect(()=>{if(!t.slicing){const S=[];s(S);const E=$1(l,S,t.slicing);u(E),o(!1);return}const v=[],w=[],x=[];for(const S of t.slicing.slices){if(!P6(S))continue;const E=S.type[0];let j;Xt(S.elements)&&E.profile&&(j=E.profile[0]),v.push(S),w.push(j),j?x.push(n.requestProfileSchema(j)):x.push(Promise.resolve())}Promise.all(x).then(()=>{for(let E=0;E<v.length;E++){const j=v[E],T=w[E];if(T){const P=Ef(T);j.typeSchema=P}}s(v);const S=$1(l,v,t.slicing);u(S),o(!1)}).catch(S=>{console.error(S),o(!1)})},[n,t.slicing,d,l]);function f(v,w){const x=[...c];if(x[w]=v,u(x),e.onChange){const S=x.flat().filter(E=>E!==void 0);e.onChange(S)}}if(r)return a.jsx("div",{children:"Loading..."});const h=i.length,m=c[h],g=!(e.hideNonSliceValues??(d==="Extension"&&i.length>0)),y=ud(t.path);return a.jsxs(Se,{className:e.indent?bT.indented:void 0,children:[i.map((v,w)=>a.jsx(R6,{slice:v,property:t,defaultValue:c[w],onChange:x=>{f(x,w)},testId:`slice-${v.name}`},v.name)),g&&m.map((v,w)=>a.jsxs(Y,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Ma,{arrayElement:!0,property:e.property,name:e.name+"."+w,defaultValue:v,onChange:x=>{const S=[...m];S[w]=x,f(S,h)},defaultPropertyType:void 0,outcome:e.outcome})}),a.jsx(jT,{propertyDisplayName:y,testId:`nonsliced-remove-${w}`,onClick:x=>{Ye(x);const S=[...m];S.splice(w,1),f(S,h)}})]},`${w}-${m.length}`)),g&&c.flat().length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(CT,{propertyDisplayName:y,onClick:v=>{Ye(v);const w=[...m];w.push(void 0),f(w,h)},testId:"nonsliced-add"})})]})}function R6(e){const{slice:t,property:n}=e,[r,o]=p.useState(()=>e.defaultValue.map(u=>u??{}));function i(u){o(u),e.onChange&&e.onChange(u)}const s=t.min>0,l=Xt(t.elements),c=VE(t.name);return a.jsx(et,{title:c,description:t.definition,withAsterisk:s,fhirPath:`${n.path}:${t.name}`,testId:e.testId,children:a.jsxs(Se,{className:l?bT.indented:void 0,children:[r.map((u,d)=>a.jsxs(Y,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Se,{children:Xt(t.elements)?a.jsx(kv,{elementDefinitionType:t.type[0],name:t.name,defaultValue:u,onChange:f=>{const h=[...r];h[d]=f,i(h)},outcome:void 0,min:t.min,max:t.max,binding:void 0,path:t.path}):a.jsx(ET,{type:t.type[0].code,elements:t.elements,defaultValue:u,outcome:e.outcome,onChange:f=>{const h=[...r];h[d]=f,i(h)},testId:e.testId&&`${e.testId}-elements-${d}`})})}),r.length>t.min&&a.jsx(jT,{propertyDisplayName:c,testId:e.testId&&`${e.testId}-remove-${d}`,onClick:f=>{Ye(f);const h=[...r];h.splice(d,1),i(h)}})]},`${d}-${r.length}`)),r.length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(CT,{propertyDisplayName:c,onClick:u=>{Ye(u);const d=[...r,void 0];i(d)},testId:e.testId&&`${e.testId}-add`})})]})})}function CT({propertyDisplayName:e,onClick:t,testId:n}){const r=e?`Add ${e}`:"Add";return e?a.jsx(Z,{title:r,size:"sm",color:"green.6",variant:"subtle","data-testid":n,leftSection:a.jsx(hd,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(Vt,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(hd,{size:"1.25rem"})})}function jT({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(Vt,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,onClick:t,children:a.jsx(fd,{size:"1.25rem"})})}function D6(e){const[t,n]=p.useState(!1),r=oS(),o=p.useRef(null),i={...e.styles};return t||(i.input||(i.input={}),i.input.WebkitTextSecurity="disc"),a.jsxs(pa,{gap:"xs",children:[a.jsx(fs,{...e,styles:{...i,root:{...i.root??{},flexGrow:1}},ref:o,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(Vt,{title:"Copy secret",onClick:()=>{var s;r.copy((s=o.current)==null?void 0:s.value),ce({color:"green",message:"Copied"})},children:a.jsx(iT,{})})]})}const I6=["sun","mon","tue","wed","thu","fri","sat"];function _6(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:_E(i.current)||"No repeat"}),a.jsx(Z,{onClick:()=>o(!0),children:"Edit"})]}),a.jsx(A6,{visible:r,defaultValue:i.current,onOk:s=>{e.onChange&&e.onChange(s),n(s),o(!1)},onCancel:()=>o(!1)})]})}const F1={repeat:{period:1,periodUnit:"d"}};function A6(e){const[t,n]=p.useState(e.defaultValue||F1),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(Cn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(Se,{children:[a.jsx(et,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(Zi,{name:"timing-dialog-start",onChange:u=>o(u)})}),a.jsx(pc,{label:"Repeat",checked:!!t.repeat,onChange:u=>i(u.currentTarget.checked?F1.repeat:void 0)}),t.repeat&&a.jsxs(a.Fragment,{children:[a.jsx(et,{title:"Repeat every",htmlFor:"timing-dialog-period",children:a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(oe,{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(ct,{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(et,{title:"Repeat on",children:a.jsx(Ul.Group,{multiple:!0,onChange:c,children:a.jsx(Y,{justify:"space-between",mt:"md",gap:"xs",children:I6.map(u=>a.jsx(Ul,{value:u,size:"xs",radius:"xl",children:u.charAt(0).toUpperCase()},u))})})})]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function Ma(e){var l;const{property:t,name:n,defaultValue:r,onChange: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===U.Attachment)return a.jsx($7,{name:n,defaultValue:r,onChange:o});const c=((l=s[0])==null?void 0:l.code)!==U.Extension;return a.jsx(k6,{property:t,name:n,defaultValue:r,indent:c,onChange:o,outcome:e.outcome})}return s.length>1?a.jsx(N6,{elementDefinitionTypes:s,...e}):a.jsx(kv,{name:n,defaultValue:r,onChange:c=>{if(e.onChange){const u=e.name.replace("[x]",tn(s[0].code));e.onChange(c,u)}},outcome:e.outcome,elementDefinitionType:s[0],min:t.min,max:t.min,binding:t.binding,path:t.path})}function N6(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(ct,{style:{width:"200px"},defaultValue:r.code,onChange:i=>{o(t.find(s=>s.code===i.currentTarget.value))},data:t.map(i=>({value:i.code,label:i.code}))}),a.jsx(kv,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:i=>{e.onChange&&e.onChange(i,e.name.replace("[x]",tn(r.code)))},min:e.property.min,max:e.property.max,binding:e.property.binding,path:e.property.path})]})}function kv(e){const{name:t,defaultValue:n,onChange:r,outcome:o,binding:i,path:s}=e,l=e.min!==void 0&&e.min>0,c=e.elementDefinitionType.code;if(!c)return a.jsx("div",{children:"Property type not specified "});const u={name:t,defaultValue:n,onChange:r,outcome:o,path:s};switch(c){case U.SystemString:case U.canonical:case U.string:case U.time:case U.uri:case U.url:return e.path==="Project.secret.value[x]"?a.jsx(D6,{id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{e.onChange&&e.onChange(d.currentTarget.value)},error:_e(e.outcome,t)}):a.jsx(oe,{id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.value)},error:_e(o,t)});case U.date:return a.jsx(oe,{type:"date",id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.value)},error:_e(o,t)});case U.dateTime:case U.instant:return a.jsx(Zi,{name:t,defaultValue:n,onChange:r,outcome:o});case U.decimal:case U.integer:case U.positiveInt:case U.unsignedInt:return a.jsx(oe,{type:"number",step:c===U.decimal?"any":"1",id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.valueAsNumber)}});case U.code:return a.jsx(fT,{...u,binding:i==null?void 0:i.valueSet});case U.boolean:return a.jsx(cr,{id:t,name:t,"data-testid":t,defaultChecked:!!n,onChange:d=>{r&&r(d.currentTarget.checked)}});case U.base64Binary:case U.markdown:return a.jsx(fs,{id:t,spellCheck:c!==U.base64Binary,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.value)}});case U.Address:return a.jsx(JL,{...u});case U.Annotation:return a.jsx(ZL,{...u});case U.Attachment:return a.jsx(hT,{...u});case U.CodeableConcept:return a.jsx(X7,{binding:i==null?void 0:i.valueSet,...u});case U.Coding:return a.jsx(xT,{binding:i==null?void 0:i.valueSet,...u});case U.ContactDetail:return a.jsx(n6,{...u});case U.ContactPoint:return a.jsx(wT,{...u});case U.Extension:return a.jsx(s6,{...u,propertyType:e.elementDefinitionType});case U.HumanName:return a.jsx(l6,{...u});case U.Identifier:return a.jsx(c6,{...u});case U.Money:return a.jsx(d6,{...u});case U.Period:return a.jsx(f6,{...u});case U.Duration:case U.Quantity:return a.jsx(es,{...u});case U.Range:return a.jsx(Pv,{...u});case U.Ratio:return a.jsx(p6,{...u});case U.Reference:return a.jsx(Nf,{...u,targetTypes:M6(e.elementDefinitionType)});case U.Timing:return a.jsx(_6,{...u});case U.Dosage:case U.UsageContext:default:return a.jsx(Rv,{typeName:c,defaultValue:n,onChange:r,outcome:o})}}const O6=[`${WL}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function M6(e){var t;return(t=e==null?void 0:e.targetProfile)==null?void 0:t.map(n=>{const r=O6.find(o=>n.startsWith(o));return r?n.slice(r.length):n})}const dm=new Set(["extension","modifierExtension"]),L6=new Set(["id",...pT].filter(e=>!dm.has(e)));function ET(e){const{elements:t}=e,[n,r]=p.useState(e.defaultValue??{}),o=p.useMemo(()=>{const s=Object.create(null);for(const[l,c]of Object.entries(t))c.fixed&&(s[l]=c);return s},[t]);function i(s){for(const[l,c]of Object.entries(o))um(s,l,l,c,c.fixed.value);r(s),e.onChange&&e.onChange(s)}return a.jsx(Se,{style:{flexGrow:1},"data-testid":e.testId,children:Object.entries(t).map(([s,l])=>{var h;if(!l.type||l.max===0||s==="url"&&l.fixed||dm.has(s)&&!Cf((h=l.slicing)==null?void 0:h.slices))return null;if(L6.has(s))return null;if(mT.includes(s)&&l.path.split(".").length===2||s.includes("."))return null;const[c,u]=G7(n,s,l),d=l.min!==void 0&&l.min>0,f=a.jsx(Ma,{property:l,name:s,defaultValue:c,defaultPropertyType:u,onChange:(m,g)=>{i(um({...n},s,g??s,l,m))},arrayElement:void 0,outcome:e.outcome},s);return e.type==="Extension"||dm.has(s)?f:l.type.length===1&&l.type[0].code==="boolean"?a.jsx(yT,{title:ud(s),description:l.description,htmlFor:s,fhirPath:l.path,withAsterisk:d,children:f},s):a.jsx(et,{title:ud(s),description:l.description,withAsterisk:d,htmlFor:s,outcome:e.outcome,fhirPath:l.path,children:f},s)})})}function Rv(e){const{typeName:t}=e,[n,r]=p.useState(e.defaultValue??{}),o=p.useContext(wa),i=e.profileUrl??o.profileUrl,s=p.useMemo(()=>ov(t,i),[t,i]),l=p.useMemo(()=>K7(s,i),[s,i]);if(!s)return a.jsxs("div",{children:[t," not implemented"]});function c(u){r(u),e.onChange&&e.onChange(u)}return a.jsx(wa.Provider,{value:l,children:a.jsx(ET,{type:s.type,elements:s.elements,defaultValue:n,onChange:c,outcome:e.outcome})})}const $6="_root_1vii2_1",F6={root:$6};function jc(e){const{children:t,...n}=e;return a.jsx(wy,{className:F6.root,...n,children:t})}const z6="_noteBody_10swh_1",B6="_noteCite_10swh_5",U6="_noteRoot_10swh_10",z1={noteBody:z6,noteCite:B6,noteRoot:U6};function TT({value:e}){return e?a.jsx(Se,{justify:"flex-start",gap:"xs",children:e.map(t=>{var n;return t.text&&a.jsx(vy,{classNames:{cite:z1.noteCite,root:z1.noteRoot},cite:((n=t.authorReference)==null?void 0:n.display)||t.authorString,icon:null,children:t.text},`note-${t.text}`)})}):null}function Ec(e){const{value:t,link:n,...r}=e,[o,i]=p.useState(),s=tt(t,i);let l;if(o&&!TE(o))l=`[${ke(o)}]`;else if(s)l=vo(s);else return null;return n?a.jsx(Ie,{to:t,...r,children:l}):a.jsx(se,{component:"span",...r,children:l})}function na(e){return a.jsxs(Y,{gap:"xs",children:[a.jsx(pi,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(Ec,{value:e.value,link:e.link})]})}const V6={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 PT(e){return a.jsx(rf,{color:V6[e.status],children:e.status})}const H6="_table_pe9td_1",W6="_criticalRow_pe9td_12",q6="_noteBody_pe9td_23",G6="_noteCite_pe9td_27",Q6="_noteRoot_pe9td_32",kT={table:H6,criticalRow:W6,noteBody:q6,noteCite:G6,noteRoot:Q6};Dv.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1};function Dv(e){var s;const t=te(),n=tt(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(le,{children:"Diagnostic Report"}),a.jsx(K6,{value:n}),r&&!e.hideSpecimenInfo&&Y6(r),n.result&&a.jsx(X6,{hideObservationNotes:e.hideObservationNotes,value:n.result}),i.length>0&&a.jsx(TT,{value:i})]})}function K6({value:e}){var t,n;return a.jsxs(Y,{mt:"md",gap:30,children:[e.subject&&a.jsxs("div",{children:[a.jsx(se,{size:"xs",tt:"uppercase",c:"dimmed",children:"Subject"}),a.jsx(na,{value:e.subject,link:!0})]}),(t=e.resultsInterpreter)==null?void 0:t.map(r=>a.jsxs("div",{children:[a.jsx(se,{size:"xs",tt:"uppercase",c:"dimmed",children:"Interpreter"}),a.jsx(na,{value:r,link:!0})]},r.reference)),(n=e.performer)==null?void 0:n.map(r=>a.jsxs("div",{children:[a.jsx(se,{size:"xs",tt:"uppercase",c:"dimmed",children:"Performer"}),a.jsx(na,{value:r,link:!0})]},r.reference)),e.issued&&a.jsxs("div",{children:[a.jsx(se,{size:"xs",tt:"uppercase",c:"dimmed",children:"Issued"}),a.jsx(se,{children:Mn(e.issued)})]}),e.status&&a.jsxs("div",{children:[a.jsx(se,{size:"xs",tt:"uppercase",c:"dimmed",children:"Status"}),a.jsx(se,{children:tn(e.status)})]})]})}function Y6(e){return a.jsxs(Se,{gap:"xs",children:[a.jsx(le,{order:2,size:"h6",children:"Specimens"}),a.jsx(mn,{type:"ordered",children:e==null?void 0:e.map(t=>{var n;return a.jsx(mn.Item,{ml:"sm",children:a.jsxs(Y,{gap:20,children:[a.jsxs(Y,{gap:5,children:[a.jsx(se,{fw:500,children:"Collected:"})," ",Mn((n=t.collection)==null?void 0:n.collectedDateTime)]}),a.jsxs(Y,{gap:5,children:[a.jsx(se,{fw:500,children:"Received:"})," ",Mn(t.receivedTime)]})]})},`specimen-${t.id}`)})})]})}function X6(e){return a.jsxs("table",{className:kT.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(RT,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function RT(e){var t;return a.jsx(a.Fragment,{children:(t=e.value)==null?void 0:t.map(n=>a.jsx(J6,{value:n,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${vs(n)?n.reference:n.id}`))})}function J6(e){var o,i;const t=tt(e.value);if(!t||(o=e.ancestorIds)!=null&&o.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=t8(t);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:We({[kT.criticalRow]:r}),children:[a.jsx("td",{rowSpan:n?2:1,children:a.jsx(Ie,{to:t,children:a.jsx(Yr,{value:t.code})})}),a.jsx("td",{children:a.jsx(Z6,{value:t})}),a.jsx("td",{children:a.jsx(e8,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx(Yr,{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(Yr,{value:s})},`category-${va(s)}`))})}),a.jsx("td",{children:(i=t.performer)==null?void 0:i.map(s=>a.jsx(md,{value:s},s.reference))}),a.jsx("td",{children:t.status&&a.jsx(PT,{status:t.status})})]}),t.hasMember&&a.jsx(RT,{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(TT,{value:t.note})})})]})}function Z6(e){const t=e.value;return a.jsx(a.Fragment,{children:AE(t)})}function e8(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(Tv,{value:t}):null}function t8(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 n8="_paper_1igaj_1",r8="_fill_1igaj_20",B1={paper:n8,fill:r8};function Iv(e){const{width:t,fill:n,className:r,children:o,...i}=e,s=t?{width:t}:void 0;return a.jsx(_n,{className:We(B1.paper,n&&B1.fill,r),style:s,shadow:"sm",radius:"sm",withBorder:!0,...i,children:o})}var DT={},Tc={};Object.defineProperty(Tc,"__esModule",{value:!0});Tc.Pointer=void 0;function o8(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function i8(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var s8=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var n=t.split("/").map(o8);if(n[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(n)},e.prototype.toString=function(){return this.tokens.map(i8).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}();Tc.Pointer=s8;var Ct={},_v={};(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})(_v);var pn={};Object.defineProperty(pn,"__esModule",{value:!0});pn.diffAny=pn.diffObjects=pn.diffArrays=pn.intersection=pn.subtract=pn.isDestructive=void 0;var Ql=_v;function a8(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}pn.isDestructive=a8;function fm(e,t){var n={};for(var r in e)Ql.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(n[r]=1);for(var o in t)Ql.hasOwnProperty.call(t,o)&&t[o]!==void 0&&delete n[o];return Object.keys(n)}pn.subtract=fm;function IT(e){for(var t=e.length,n={},r=0;r<t;r++){var o=e[r];for(var i in o)Ql.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)}pn.intersection=IT;function l8(e){return e.op==="add"}function c8(e){return e.op==="remove"}function Bh(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function _T(e,t,n,r){r===void 0&&(r=Of);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 y=i(d-1,f),C={op:"remove",index:d-1};g.push(Bh(y,C))}if(f>0){var v=i(d,f-1),w={op:"add",index:d-1,value:t[f-1]};g.push(Bh(v,w))}if(d>0&&f>0){var x=i(d-1,f-1),S={op:"replace",index:d-1,original:e[d-1],value:t[f-1]};g.push(Bh(x,S))}var E=g.sort(function(j,T){return j.cost-T.cost})[0];m=E}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(l8(f)){var g=f.index+1+m,y=g<s+m?String(g):"-",C={op:f.op,path:n.add(y).toString(),value:f.value};return[h.concat(C),m+1]}else if(c8(f)){var C={op:f.op,path:n.add(String(f.index+m)).toString()};return[h.concat(C),m-1]}else{var v=n.add(String(f.index+m)),w=r(f.original,f.value,v);return[h.concat.apply(h,w),m]}},[[],0])[0];return u}pn.diffArrays=_T;function AT(e,t,n,r){r===void 0&&(r=Of);var o=[];return fm(e,t).forEach(function(i){o.push({op:"remove",path:n.add(i).toString()})}),fm(t,e).forEach(function(i){o.push({op:"add",path:n.add(i).toString(),value:t[i]})}),IT([e,t]).forEach(function(i){o.push.apply(o,r(e[i],t[i],n.add(i)))}),o}pn.diffObjects=AT;function Of(e,t,n,r){if(r===void 0&&(r=Of),e===t)return[];var o=(0,Ql.objectType)(e),i=(0,Ql.objectType)(t);return o=="array"&&i=="array"?_T(e,t,n,r):o=="object"&&i=="object"?AT(e,t,n,r):[{op:"replace",path:n.toString(),value:t}]}pn.diffAny=Of;var Av=e0&&e0.__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(Ct,"__esModule",{value:!0});Ct.apply=Ct.InvalidOperationError=Ct.test=Ct.copy=Ct.move=Ct.replace=Ct.remove=Ct.add=Ct.TestError=Ct.MissingError=void 0;var So=Tc,Nv=_v,u8=pn,Xr=function(e){Av(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);Ct.MissingError=Xr;var NT=function(e){Av(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);Ct.TestError=NT;function Ov(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 OT(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function MT(e,t){var n=So.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new Xr(t.path):(Ov(n.parent,n.key,(0,Nv.clone)(t.value)),null)}Ct.add=MT;function LT(e,t){var n=So.Pointer.fromJSON(t.path).evaluate(e);return n.value===void 0?new Xr(t.path):(OT(n.parent,n.key),null)}Ct.remove=LT;function $T(e,t){var n=So.Pointer.fromJSON(t.path).evaluate(e);if(n.parent===null)return new Xr(t.path);if(Array.isArray(n.parent)){if(parseInt(n.key,10)>=n.parent.length)return new Xr(t.path)}else if(n.value===void 0)return new Xr(t.path);return n.parent[n.key]=(0,Nv.clone)(t.value),null}Ct.replace=$T;function FT(e,t){var n=So.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new Xr(t.from);var r=So.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new Xr(t.path):(OT(n.parent,n.key),Ov(r.parent,r.key,n.value),null)}Ct.move=FT;function zT(e,t){var n=So.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new Xr(t.from);var r=So.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new Xr(t.path):(Ov(r.parent,r.key,(0,Nv.clone)(n.value)),null)}Ct.copy=zT;function BT(e,t){var n=So.Pointer.fromJSON(t.path).evaluate(e);return(0,u8.diffAny)(n.value,t.value,new So.Pointer).length?new NT(n.value,t.value):null}Ct.test=BT;var UT=function(e){Av(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);Ct.InvalidOperationError=UT;function d8(e,t){switch(t.op){case"add":return MT(e,t);case"remove":return LT(e,t);case"replace":return $T(e,t);case"move":return FT(e,t);case"copy":return zT(e,t);case"test":return BT(e,t)}return new UT(t)}Ct.apply=d8;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Tc;Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=Ct,r=pn;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})(DT);const f8="_root_w6lfx_1",h8="_removed_w6lfx_16",p8="_added_w6lfx_21",Uh={root:f8,removed:h8,added:p8};function m8(e){const t=te(),[n,r]=p.useState(!1);if(p.useEffect(()=>{t.requestSchema(e.original.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.original.resourceType]),!n)return null;const o=DT.createPatch(e.original,e.revised),i=[Zr(e.original)],s=[Zr(e.revised)];return a.jsxs(he,{className:Uh.root,children:[a.jsx(he.Thead,{children:a.jsxs(he.Tr,{children:[a.jsx(he.Th,{}),a.jsx(he.Th,{children:"Before"}),a.jsx(he.Th,{children:"After"})]})}),a.jsx(he.Tbody,{children:o.map(l=>{var y,C,v;if(l.path.startsWith("/meta"))return null;const c=l.path,u=g8(c),d=Tf(e.original.resourceType,{resourceType:"SearchParameter",base:[e.original.resourceType],code:e.original.resourceType+"."+u,expression:e.original.resourceType+"."+u}),f=(y=d==null?void 0:d.elementDefinitions)==null?void 0:y[0],h=!!(f!=null&&f.isArray),m=l.op==="add"||(C=ql(u,i))==null?void 0:C[0],g=l.op==="remove"||(v=ql(u,s))==null?void 0:v[0];return a.jsxs(he.Tr,{children:[a.jsxs(he.Td,{children:[tn(l.op)," ",u]}),a.jsx(he.Td,{className:Uh.removed,children:m&&a.jsx(wo,{property:f,propertyType:m.type,value:U1(m.value,h),ignoreMissingValues:!0})}),a.jsx(he.Td,{className:Uh.added,children:g&&a.jsx(wo,{property:f,propertyType:g.type,value:U1(g.value,h),ignoreMissingValues:!0})})]},`op-${l.op}-${l.path}`)})})]})}function g8(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}function U1(e,t){return Array.isArray(e)&&!t?e[0]:!Array.isArray(e)&&t?[e]:e}function Mv(e){const t=te(),n=tt(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(cm,{value:{type:n.resourceType,value:e.forceUseInput?e.value:n},ignoreMissingValues:e.ignoreMissingValues})}function y8(e){return a.jsx(jc,{children:e.children})}function ts(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(Iv,{"data-testid":"timeline-item",fill:!0,...i,children:[a.jsxs(Y,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(pi,{value:s,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(se,{size:"sm",children:a.jsx(Ec,{c:"dark",fw:500,value:s,link:!0})}),a.jsxs(se,{size:"xs",children:[a.jsx(Ie,{c:"dimmed",to:e.resource,children:Mn(l)}),a.jsx(se,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx(Ie,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&a.jsxs(X,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(X.Target,{children:a.jsx(Vt,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${at(e.resource)}`,children:a.jsx(C$,{})})}),o]})]}),a.jsxs(cT,{children:[r&&a.jsx("div",{style:{padding:"0 16px 16px 16px"},children:e.children}),!r&&a.jsx(a.Fragment,{children:e.children})]})]})}function VT(e,t){e.sort((n,r)=>{const o=V1(n,t),i=V1(r,t);return o>i?1:o<i?-1:H1(n,t)-H1(r,t)})}function V1(e,t){if(!HT(e,t)){const n=e.priority;if(typeof n=="string")return{stat:4,asap:3,urgent:2}[n]??0}return 0}function H1(e,t){var r;if(!HT(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 HT(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const v8="_pinnedComment_5uxzi_2",x8={pinnedComment:v8};function Mf(e){const t=te(),n=kf(),r=t.getProfile(),o=p.useRef(null),i=tt(e.value),[s,l]=p.useState(),[c,u]=p.useState([]),d=e.loadTimelineResources,f=p.useRef(c);f.current=c;const h=p.useCallback(D=>{VT(D,i),D.reverse(),u(D)},[i]),m=p.useCallback(D=>{const N=[];for(const L of D){if(L.status!=="fulfilled")continue;const B=L.value;if(B.type==="history"&&l(B),B.entry)for(const F of B.entry)N.push(F.resource)}h(N)},[h]),g=p.useCallback(D=>h([...f.current,D]),[h]),y=p.useCallback(()=>{var L;let D,N;"resourceType"in e.value?(D=e.value.resourceType,N=e.value.id):[D,N]=(L=e.value.reference)==null?void 0:L.split("/"),d(t,D,N).then(m).catch(console.log)},[t,e.value,d,m]);p.useEffect(()=>y(),[y]);function C(D){!i||!e.createCommunication||t.createResource(e.createCommunication(i,r,D)).then(N=>g(N)).catch(console.log)}function v(D){!i||!e.createMedia||t.createResource(e.createMedia(i,r,D)).then(N=>g(N)).then(()=>ul({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(Rf,{size:16}),autoClose:2e3})).catch(N=>ul({id:"upload-notification",color:"red",title:"Upload error",message:ke(N),icon:a.jsx(_1,{size:16}),autoClose:2e3}))}function w(D,N){return t.updateResource({...D,priority:N})}function x(D){w(D,"stat").then(y).catch(console.log)}function S(D){w(D,"routine").then(y).catch(console.log)}function E(D){n(`/${D.resourceType}/${D.id}`)}function j(D){n(`/${D.resourceType}/${D.id}/edit`)}function T(D){n(`/${D.resourceType}/${D.id}/delete`)}function P(D){var N;n(`/${D.resourceType}/${D.id}/_history/${(N=D.meta)==null?void 0:N.versionId}`)}function R(){ce({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function I(D){ul({id:"upload-notification",loading:!0,title:"Uploading...",message:T8(D),autoClose:!1,withCloseButton:!1})}function O(D){ul({id:"upload-notification",color:"red",title:"Upload error",message:ke(D),icon:a.jsx(_1,{size:16}),autoClose:2e3})}return i?a.jsxs(y8,{children:[e.createCommunication&&a.jsx(Iv,{children:a.jsx(Le,{testid:"timeline-form",onSubmit:D=>{C(D.text);const N=o.current;N&&(N.value="",N.focus())},children:a.jsxs(Y,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(pi,{value:r}),a.jsx(oe,{name:"text",ref:o,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(Vt,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx(A$,{size:16})}),a.jsx(jv,{onUpload:v,onUploadStart:R,onUploadProgress:I,onUploadError:O,children:D=>a.jsx(Vt,{...D,radius:"xl",color:"blue",variant:"filled",children:a.jsx(yv,{size:16})})})]})})}),c.map(D=>{var L;if(!D)return null;const N=`${D.resourceType}/${D.id}/${(L=D.meta)==null?void 0:L.versionId}`;if(D.resourceType===i.resourceType&&D.id===i.id)return a.jsx(w8,{history:s,resource:D,onDetails:P},N);switch(D.resourceType){case"AuditEvent":return a.jsx(j8,{resource:D,onDetails:E},N);case"Communication":return a.jsx(b8,{resource:D,onPin:D.priority!=="stat"?x:void 0,onUnpin:D.priority==="stat"?S:void 0,onDetails:E,onEdit:j,onDelete:T},N);case"DiagnosticReport":return a.jsx(E8,{resource:D,onDetails:E,onEdit:j,onDelete:T},N);case"Media":return a.jsx(C8,{resource:D,onDetails:E,onEdit:j,onDelete:T},N);default:return a.jsx(ts,{resource:D,padding:!0,children:a.jsx(Mv,{value:D,ignoreMissingValues:!0})},N)}})]}):a.jsx(Bt,{style:{width:"100%",height:"100%"},children:a.jsx(Nn,{})})}function Sa(e){return a.jsxs(X.Dropdown,{children:[a.jsx(X.Label,{children:"Resource"}),e.onPin&&a.jsx(X.Item,{leftSection:a.jsx(M$,{size:14}),onClick:()=>e.onPin(e.resource),"aria-label":`Pin ${at(e.resource)}`,children:"Pin"}),e.onUnpin&&a.jsx(X.Item,{leftSection:a.jsx(L$,{size:14}),onClick:()=>e.onUnpin(e.resource),"aria-label":`Unpin ${at(e.resource)}`,children:"Unpin"}),e.onDetails&&a.jsx(X.Item,{leftSection:a.jsx(R$,{size:14}),onClick:()=>e.onDetails(e.resource),"aria-label":`Details ${at(e.resource)}`,children:"Details"}),e.onEdit&&a.jsx(X.Item,{leftSection:a.jsx(j$,{size:14}),onClick:()=>e.onEdit(e.resource),"aria-label":`Edit ${at(e.resource)}`,children:"Edit"}),e.onDelete&&a.jsxs(a.Fragment,{children:[a.jsx(X.Divider,{}),a.jsx(X.Label,{children:"Danger zone"}),a.jsx(X.Item,{color:"red",leftSection:a.jsx(lT,{size:14}),onClick:()=>e.onDelete(e.resource),"aria-label":`Delete ${at(e.resource)}`,children:"Delete"})]})]})}function w8(e){const t=S8(e.history,e.resource);return t?a.jsx(ts,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(m8,{original:t,revised:e.resource})}):a.jsxs(ts,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:[a.jsx("h3",{children:"Created"}),a.jsx(Mv,{value:e.resource,ignoreMissingValues:!0,forceUseInput:!0})]})}function S8(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 b8(e){var r,o;const n=!e.resource.priority||e.resource.priority==="routine"?void 0:x8.pinnedComment;return a.jsx(ts,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx("p",{children:(o=(r=e.resource.payload)==null?void 0:r[0])==null?void 0:o.contentString})})}function C8(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(ts,{resource:e.resource,padding:!!n,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(Cc,{value:e.resource.content})})}function j8(e){return a.jsx(ts,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(dr,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function E8(e){return a.jsx(ts,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(Dv,{value:e.resource})})}function T8(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${Vh(e.loaded)} / ${Vh(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${Vh(e.loaded)}`}function Vh(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 P8(e){return a.jsx(Mf,{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 we(e){const{children:t,...n}=e;return a.jsx(jc,{children:a.jsx(Iv,{...n,children:t})})}function k8(e){return a.jsx(Mf,{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:mt(t),subject:t.subject,sender:mt(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",encounter:mt(t),subject:t.subject,operator:mt(n),issued:new Date().toISOString(),content:r})})}function R8(e){let t;try{t=QM(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(wo,{value:t[0]||"",propertyType:e.propertyType})}function D8(e){return a.jsxs(Cn,{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(W1,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&a.jsx(W1,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),a.jsx(se,{style:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function W1(e){return a.jsx(Z,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const I8={string:[ne.EQUALS,ne.NOT,ne.CONTAINS,ne.EXACT],fulltext:[ne.EQUALS,ne.NOT,ne.CONTAINS,ne.EXACT],token:[ne.EQUALS,ne.NOT],reference:[ne.EQUALS,ne.NOT],numeric:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS],quantity:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS],date:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS,ne.STARTS_AFTER,ne.ENDS_BEFORE,ne.APPROXIMATELY],datetime:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS,ne.STARTS_AFTER,ne.ENDS_BEFORE,ne.APPROXIMATELY]},_8={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 Lv(e,t){return{...e,filters:t,offset:0,name:void 0}}function $v(e,t){return Lv(e,(e.filters??[]).filter(n=>n.code!==t))}function Lf(e,t,n,r,o){o&&(e=$v(e,t));const i=[];return e.filters&&i.push(...e.filters),i.push({code:t,operator:n,value:r??""}),Lv(e,i)}function A8(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function N8(e,t){return Fv(e,t,-1)}function O8(e,t){return Fv(e,t,0)}function M8(e,t){return Fv(e,t,1)}function Fv(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),Bv(e,t,r,o)}function L8(e,t){return zv(e,t,-1)}function $8(e,t){return zv(e,t,0)}function F8(e,t){return zv(e,t,1)}function zv(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),Bv(e,t,r,o)}function z8(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),Bv(e,t,n,new Date)}function Bv(e,t,n,r){return e=$v(e,t),e=q1(e,t,ne.GREATER_THAN_OR_EQUALS,n),e=q1(e,t,ne.LESS_THAN_OR_EQUALS,r),e}function q1(e,t,n,r){return Lf(e,t,n,r.toISOString())}function G1(e,t,n=!0){return Lf(e,t,ne.MISSING,n.toString())}function B8(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function U8(e,t){const n=e.count??Sc,r=(t-1)*n;return B8(e,r)}function V8(e,t,n){return t===H8(e)&&n!==void 0&&n===W8(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function H8(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function W8(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function q8(e){return I8[e.type]}function Uv(e){return _8[e]??""}function mi(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(tn).join(" "))}function G8(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"?Mn((o=e.meta)==null?void 0:o.lastUpdated):t.elementDefinition&&`${e.resourceType}.${t.name}`===t.elementDefinition.path?Q8(e,t.elementDefinition):t.searchParams&&t.searchParams.length===1&&t.name===t.searchParams[0].code?K8(e,t.searchParams[0]):null}function Q8(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]=_f({type:e.resourceType,value:e},n);return r?a.jsx(wo,{property:t,propertyType:o,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function K8(e,t){const n=ql(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,o)=>a.jsx(wo,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${n.length}`))})}function Y8(e){const t=p.useRef(!1),[n,r]=p.useState({search:JSON.parse(On(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=dM(c),d=iv(c);return X8(u,d).sort((f,h)=>f.localeCompare(h)).map(f=>({value:f,label:mi(f)}))},[e.visible,e.search.resourceType]);if(!e.visible)return null;function l(c){r({search:{...n.search,fields:c}})}return a.jsx(Cn,{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(pf,{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(Z,{onClick:()=>e.onOk(n.search),children:"OK"})})]})})}function X8(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(mi(i));if(t)for(const i of Object.keys(t)){const s=mi(i);!r.has(i)&&!o.has(s)&&(n.push(i),r.add(i),o.add(s))}return n}function WT(e){var o;const{resourceType:t,filter:n}=e,r=(o=hi.types[t].searchParams)==null?void 0:o[n.code];if(r){if(r.type==="reference"&&(n.operator===ne.EQUALS||n.operator===ne.NOT_EQUALS))return a.jsx(Ec,{value:{reference:n.value}});const i=Tf(t,r);if(n.code==="_lastUpdated"||i.type===Uo.DATETIME)return a.jsx(a.Fragment,{children:Mn(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function qT(e){const t=Tf(e.resourceType,e.searchParam),n="filter-value";switch(t.type){case Uo.REFERENCE:return a.jsx(Nf,{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 Uo.BOOLEAN:return a.jsx(cr,{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 Uo.DATE:return a.jsx(oe,{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 Uo.DATETIME:return a.jsx(Zi,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case Uo.NUMBER:return a.jsx(oe,{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 Uo.QUANTITY:return a.jsx(es,{name:n,defaultValue:J8(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(oe,{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 J8(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:parseFloat(t),system:n,unit:r}}}function Z8(e){const[t,n]=p.useState(JSON.parse(On(e.search))),[r,o]=p.useState(-1),i=p.useRef(t);i.current=t,p.useEffect(()=>{n(JSON.parse(On(e.search)))},[e.search]);function s(d){n(Lf(i.current,d.code,d.operator,d.value))}if(!e.visible)return null;const l=e.search.resourceType,c=iv(l)??{},u=t.filters||[];return a.jsxs(Cn,{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(Q1,{resourceType:l,searchParams:c,defaultValue:d,okText:"Save",onOk:h=>{const m=[...u];m[f]=h,n(Lv(i.current,m)),o(-1)},onCancel:()=>o(-1)},`filter-${d.code}-${d.operator}-${d.value}-input`):a.jsx(eF,{resourceType:l,searchParams:c,filter:d,onEdit:()=>o(f),onDelete:()=>n(A8(i.current,f))},`filter-${d.code}-${d.operator}-${d.value}-display`)),a.jsx(Q1,{resourceType:l,searchParams:c,okText:"Add",onOk:s})]})]})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{onClick:()=>e.onOk(i.current),children:"OK"})})]})}function eF(e){const{filter:t}=e;return a.jsxs("tr",{children:[a.jsx("td",{children:mi(t.code)}),a.jsx("td",{children:Uv(t.operator)}),a.jsx("td",{children:a.jsx(WT,{resourceType:e.resourceType,filter:t})}),a.jsxs("td",{children:[a.jsx(Z,{size:"compact-md",variant:"outline",onClick:e.onEdit,children:"Edit"}),a.jsx(Z,{size:"size-md",variant:"outline",onClick:e.onDelete,children:"Delete"})]})]})}function Q1(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&&q8(l);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(ct,{"data-testid":"filter-field",defaultValue:r.current.code,onChange:u=>o(u.currentTarget.value),data:["",...Object.keys(e.searchParams).map(u=>({value:u,label:mi(u)}))]})}),a.jsx("td",{children:c&&a.jsx(ct,{"data-testid":"filter-operation",defaultValue:t.operator,onChange:u=>i(u.currentTarget.value),data:["",...c.map(u=>({value:u,label:Uv(u)}))]})}),a.jsx("td",{children:l&&t.operator&&a.jsx(qT,{resourceType:e.resourceType,searchParam:l,defaultValue:t.value,onChange:s})}),a.jsxs("td",{children:[t.code&&t.operator&&a.jsx(Z,{size:"compact-md",variant:"outline",onClick:()=>{e.onOk(r.current),n({})},children:e.okText}),e.onCancel&&a.jsx(Z,{size:"compact-md",variant:"outline",onClick:e.onCancel,children:"Cancel"})]})]})}function tF(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(Cn,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:a.jsx(Le,{onSubmit:r,children:a.jsxs(Un,{children:[a.jsx(Un.Col,{span:10,children:a.jsx(qT,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})}),a.jsx(Un.Col,{span:2,children:a.jsx(Z,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function nF(e){if(!e.searchParams)return null;function t(i,s){o(V8(e.search,i.code,s))}function n(i){o($v(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(rF,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:o,onClear:n}):a.jsx(X.Dropdown,{children:e.searchParams.map(i=>a.jsx(X.Item,{children:mi(i.code)},i.code))})}function rF(e){switch(e.searchParam.type){case"date":return a.jsx(oF,{...e});case"number":case"quantity":return a.jsx(iF,{...e});case"reference":return a.jsx(sF,{...e});case"string":case"token":case"uri":return a.jsx(aF,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function oF(e){const{searchParam:t}=e,n=t.code;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(vv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(X.Item,{leftSection:a.jsx(xv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(If,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Df,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(aT,{size:14}),onClick:()=>e.onPrompt(t,ne.ENDS_BEFORE),children:"Before..."}),a.jsx(X.Item,{leftSection:a.jsx(sT,{size:14}),onClick:()=>e.onPrompt(t,ne.STARTS_AFTER),children:"After..."}),a.jsx(X.Item,{leftSection:a.jsx(f$,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Between..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(M8(e.search,n)),children:"Tomorrow"}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(O8(e.search,n)),children:"Today"}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(N8(e.search,n)),children:"Yesterday"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(F8(e.search,n)),children:"Next Month"}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange($8(e.search,n)),children:"This Month"}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(L8(e.search,n)),children:"Last Month"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(Ri,{size:14}),onClick:()=>e.onChange(z8(e.search,n)),children:"Year to date"}),a.jsx($f,{...e})]})}function iF(e){const{searchParam:t}=e;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(vv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(X.Item,{leftSection:a.jsx(xv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(If,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Df,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(sT,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN),children:"Greater than..."}),a.jsx(X.Item,{leftSection:a.jsx(am,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(X.Item,{leftSection:a.jsx(aT,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN),children:"Less than..."}),a.jsx(X.Item,{leftSection:a.jsx(am,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx($f,{...e})]})}function sF(e){const{searchParam:t}=e;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(If,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Df,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),a.jsx($f,{...e})]})}function aF(e){const{searchParam:t}=e;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(vv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(X.Item,{leftSection:a.jsx(xv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(If,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Df,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(m$,{size:14}),onClick:()=>e.onPrompt(t,ne.CONTAINS),children:"Contains..."}),a.jsx(X.Item,{leftSection:a.jsx(p$,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Does not contain..."}),a.jsx($f,{...e})]})}function $f(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(u$,{size:14}),onClick:()=>e.onChange(G1(e.search,n)),children:"Missing"}),a.jsx(X.Item,{leftSection:a.jsx(c$,{size:14}),onClick:()=>e.onChange(G1(e.search,n,!1)),children:"Not missing"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(pd,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}const lF="_root_adxl2_1",cF="_table_adxl2_8",uF="_tr_adxl2_12",dF="_th_adxl2_18",fF="_control_adxl2_22",hF="_icon_adxl2_31",Ja={root:lF,table:cF,tr:uF,th:dF,control:fF,icon:hF};function pF(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(mF(t,r));return n}function mF(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=xM(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const i=iv(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=Tf(e,r);return{name:t,elementDefinition:(o=i.elementDefinitions)==null?void 0:o[0],searchParams:[r]}}return{name:t}}class gF extends Event{constructor(t){super("change"),this.definition=t}}class yF extends Event{constructor(t){super("load"),this.response=t}}class gd extends Event{constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function vF(e){var L,B,F;const t=te(),[n,r]=p.useState(!1),[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=s.total??"accurate",h=p.useCallback(_=>{i(void 0),t.search(s.resourceType,Hs({...s,total:f,fields:void 0}),_).then(k=>{u({...d.current,searchResponse:k}),l&&l(new yF(k))}).catch(k=>{u({...d.current,searchResponse:void 0}),i(k)})},[t,s,f,l]),m=p.useCallback(()=>{u({...d.current,searchResponse:void 0}),h({cache:"reload"})},[h]);p.useEffect(()=>{h()},[h]);function g(_,k){_.stopPropagation();const W=_.target.checked,K={...d.current.selected};W?K[k]=!0:delete K[k],u({...d.current,selected:K})}function y(_){_.stopPropagation();const M=_.target.checked,W={},K=d.current.searchResponse;M&&(K!=null&&K.entry)&&K.entry.forEach(ie=>{var ve;(ve=ie.resource)!=null&&ve.id&&(W[ie.resource.id]=!0)}),u({...d.current,selected:W})}function C(){var k,M;const _=d.current;if(!((k=_.searchResponse)!=null&&k.entry)||_.searchResponse.entry.length===0)return!1;for(const W of _.searchResponse.entry)if((M=W.resource)!=null&&M.id&&!_.selected[W.resource.id])return!1;return!0}function v(_){e.onChange&&e.onChange(new gF(_))}function w(_,k){if(uT(_.target)||_.button===2)return;Ye(_);const M=_.button===1||_.ctrlKey||_.metaKey;!M&&e.onClick&&e.onClick(new gd(k,_)),M&&e.onAuxClick&&e.onAuxClick(new gd(k,_))}function x(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(p.useEffect(()=>{r(!1),t.requestSchema(e.search.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.search.resourceType]),!n)return a.jsx(Bt,{style:{width:"100%",height:"100%"},children:a.jsx(Nn,{})});const S=e.checkboxesEnabled,E=pF(s),j=s.resourceType,T=c.searchResponse,P=T==null?void 0:T.entry,R=P==null?void 0:P.map(_=>_.resource),I="subtle",O="gray",D=16,N=window.innerWidth<768;return a.jsxs("div",{className:Ja.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(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(w$,{size:D}),onClick:()=>u({...d.current,fieldEditorVisible:!0}),children:"Fields"}),a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(T$,{size:D}),onClick:()=>u({...d.current,filterEditorVisible:!0}),children:"Filters"}),e.onNew&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(E$,{size:D}),onClick:e.onNew,children:"New..."}),!N&&x()&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(G$,{size:D}),onClick:e.onExport?e.onExport:()=>u({...d.current,exportDialogVisible:!0}),children:"Export..."}),!N&&e.onDelete&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(lT,{size:D}),onClick:()=>e.onDelete(Object.keys(c.selected)),children:"Delete..."}),!N&&e.onBulk&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(d$,{size:D}),onClick:()=>e.onBulk(Object.keys(c.selected)),children:"Bulk..."})]}),a.jsxs(Y,{gap:2,children:[T&&a.jsxs(se,{size:"xs",c:"dimmed",children:[bF(s,T.total),"-",CF(s,T.total)," of"," ",`${f==="estimate"?"~":""}${(L=T.total)==null?void 0:L.toLocaleString()}`]}),a.jsx(Vt,{variant:I,color:O,title:"Refresh",onClick:m,children:a.jsx(B$,{size:D})})]})]}),a.jsxs(he,{className:Ja.table,children:[a.jsxs(he.Thead,{children:[a.jsxs(he.Tr,{children:[S&&a.jsx(he.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:_=>y(_)})}),E.map(_=>a.jsx(he.Th,{children:a.jsxs(X,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(X.Target,{children:a.jsx(qn,{className:Ja.control,p:2,children:a.jsxs(Y,{justify:"space-between",wrap:"nowrap",children:[a.jsx(se,{fw:500,children:mi(_.name)}),a.jsx(Bt,{className:Ja.icon,children:a.jsx(s$,{size:14,stroke:1.5})})]})})}),a.jsx(nF,{search:e.search,searchParams:_.searchParams,onPrompt:(k,M)=>{u({...d.current,filterDialogVisible:!0,filterDialogSearchParam:k,filterDialogFilter:M})},onChange:k=>{v(k)}})]})},_.name))]}),!e.hideFilters&&a.jsxs(he.Tr,{children:[S&&a.jsx(he.Th,{}),E.map(_=>a.jsx(he.Th,{children:_.searchParams&&a.jsx(xF,{resourceType:j,searchParams:_.searchParams,filters:e.search.filters})},_.name))]})]}),a.jsx(he.Tbody,{children:R==null?void 0:R.map(_=>_&&a.jsxs(he.Tr,{className:Ja.tr,"data-testid":"search-control-row",onClick:k=>w(k,_),onAuxClick:k=>w(k,_),children:[S&&a.jsx(he.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${_.id}`,checked:!!c.selected[_.id],onChange:k=>g(k,_.id)})}),E.map(k=>a.jsx(he.Td,{children:G8(_,k)},k.name))]},_.id))})]}),(R==null?void 0:R.length)===0&&a.jsx(jc,{children:a.jsx(Bt,{style:{height:150},children:a.jsx(se,{size:"xl",c:"dimmed",children:"No results"})})}),(T==null?void 0:T.total)!==void 0&&T.total>0&&a.jsx(Bt,{m:"md",p:"md",children:a.jsx(Nr,{value:wF(s),total:SF(s,T.total),onChange:_=>v(U8(s,_)),getControlProps:_=>{switch(_){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(Y8,{search:e.search,visible:d.current.fieldEditorVisible,onOk:_=>{v(_),u({...d.current,fieldEditorVisible:!1})},onCancel:()=>{u({...d.current,fieldEditorVisible:!1})}}),a.jsx(Z8,{search:e.search,visible:d.current.filterEditorVisible,onOk:_=>{v(_),u({...d.current,filterEditorVisible:!1})},onCancel:()=>{u({...d.current,filterEditorVisible:!1})}}),a.jsx(D8,{visible:d.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{u({...d.current,exportDialogVisible:!1})}}),a.jsx(tF,{visible:d.current.filterDialogVisible,title:(B=c.filterDialogSearchParam)!=null&&B.code?mi(c.filterDialogSearchParam.code):"",resourceType:j,searchParam:c.filterDialogSearchParam,filter:c.filterDialogFilter,defaultValue:"",onOk:_=>{v(Lf(e.search,_.code,_.operator,_.value)),u({...d.current,filterDialogVisible:!1})},onCancel:()=>{u({...d.current,filterDialogVisible:!1})}},(F=c.filterDialogSearchParam)==null?void 0:F.code)]})}const Pc=p.memo(vF);function xF(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:[Uv(n.operator)," ",a.jsx(WT,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function wF(e){return Math.floor((e.offset??0)/(e.count??Sc))+1}function SF(e,t){const n=e.count??Sc;return Math.ceil(t/n)}function bF(e,t){return Math.min(t,(e.offset??0)+1)}function CF(e,t){return Math.min(t,((e.offset??0)+1)*(e.count??Sc))}function jF(e){const t=te(),[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(x=>i(ot(x)))},[t,s]);function g(x,S){x.stopPropagation();const j=x.target.checked,T={...m.current};j?T[S]=!0:delete T[S],f(T)}function y(x){var P;x.stopPropagation();const E=x.target.checked,j={},T=(P=h.current)==null?void 0:P.data.ResourceList;E&&T&&T.forEach(R=>{R.id&&(j[R.id]=!0)}),f(j)}function C(){var S;const x=(S=h.current)==null?void 0:S.data.ResourceList;if(!x||x.length===0)return!1;for(const E of x)if(E.id&&!m.current[E.id])return!1;return!0}function v(x,S){uT(x.target)||(Ye(x),x.button!==1&&e.onClick&&e.onClick(new gd(S,x)),x.button===1&&e.onAuxClick&&e.onAuxClick(new gd(S,x)))}if(p.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return a.jsx(Nn,{});const w=e.checkboxesEnabled;return a.jsxs("div",{onContextMenu:x=>Ye(x),"data-testid":"search-control",children:[a.jsxs(he,{children:[a.jsx(he.Thead,{children:a.jsxs(he.Tr,{children:[w&&a.jsx(he.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:x=>y(x)})}),l.map(x=>a.jsx(he.Th,{children:x.name},x.name))]})}),a.jsx(he.Tbody,{children:c==null?void 0:c.data.ResourceList.map(x=>x&&a.jsxs(he.Tr,{"data-testid":"search-control-row",onClick:S=>v(S,x),onAuxClick:S=>v(S,x),children:[w&&a.jsx(he.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${x.id}`,checked:!!d[x.id],onChange:S=>g(S,x.id)})}),l.map(S=>a.jsx(he.Td,{children:a.jsx(R8,{propertyType:S.propertyType,path:S.fhirPath,resource:x})},S.name))]},x.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(Z,{onClick:()=>e.onBulk(Object.keys(m.current)),children:"Bulk..."})]})}const EF=p.memo(jF);function Or(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 TF(e){const{group:t}=e;return a.jsx(_n,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(Y,{children:[t.measureScore&&a.jsx(RF,{group:t}),!t.measureScore&&a.jsx(kF,{group:t})]})})}function PF(e){const{measure:t}=e;return a.jsxs(a.Fragment,{children:[a.jsx(se,{fz:"md",fw:500,mb:8,children:t.title}),a.jsx(se,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function kF(e){const{group:t}=e,n=t.population,r=n==null?void 0:n.find(c=>va(c.code)==="numerator"),o=n==null?void 0:n.find(c=>va(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(le,{order:3,children:"Not Applicable"}),a.jsx(se,{children:`Denominator: ${s}`})]});if(i===void 0||s===void 0)return a.jsxs(q,{children:[a.jsx(le,{order:3,children:"Insufficient Data"}),a.jsx(se,{children:`Numerator: ${i}`}),a.jsx(se,{children:`Denominator: ${s}`})]});const l=i/s*100;return a.jsx(wf,{size:120,thickness:12,roundCaps:!0,sections:[{value:l,color:GT(l)}],label:a.jsx(pa,{justify:"center",children:a.jsxs(se,{fw:700,fz:18,children:[i," / ",s]})})})}function RF(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(wf,{size:120,thickness:12,roundCaps:!0,sections:[{value:DF(t),color:GT(((i=t==null?void 0:t.measureScore)==null?void 0:i.value)??0)}],label:a.jsx(pa,{justify:"center",children:a.jsx(se,{fw:700,fz:18,children:a.jsx(Gl,{value:t.measureScore})})})}):a.jsx(pa,{h:120,align:"center",children:a.jsx(le,{order:3,children:a.jsx(Gl,{value:t.measureScore})})})})}function DF(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 GT(e){return e<=33?"red":e<=67?"yellow":"green"}function IF(e){var r;const t=tt(e.measureReport),[n]=YL("Measure",{url:t==null?void 0:t.measure});return t?a.jsxs(q,{children:[n&&a.jsx(PF,{measure:n}),a.jsx(Fy,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:(r=t.group)==null?void 0:r.map((o,i)=>a.jsx(TF,{group:o},o.id??i))})]}):null}function eo(e){var n;const t=((n=e.outcome)==null?void 0:n.issue)||e.issues;return!t||t.length===0?null:a.jsx(ds,{icon:a.jsx(bc,{size:16}),color:"red",children:t.map(r=>{var o;return a.jsx("div",{"data-testid":"text-field-error",children:kE(r)},(o=r.details)==null?void 0:o.text)})})}function _F(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(Mf,{value:e.patient,loadTimelineResources:t,createCommunication:(n,r,o)=>({resourceType:"Communication",status:"completed",subject:mt(n),sender:mt(r),sent:new Date().toISOString(),payload:[{contentString:o}]}),createMedia:(n,r,o)=>({resourceType:"Media",status:"completed",subject:mt(n),operator:mt(r),issued:new Date().toISOString(),content:o})})}const AF="_section_14dzq_2",NF="_hovering_14dzq_11",OF="_editing_14dzq_15",MF="_bottomActions_14dzq_20",Ws={section:AF,hovering:NF,editing:OF,bottomActions:MF};function LF(e){const t=te(),n=tt(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(VF(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(y,C){d({...m.current,[y]:C})}return a.jsx("div",{children:a.jsxs(Le,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(u),children:[a.jsx(oe,{label:"Plan Title",defaultValue:u.title,onChange:y=>g("title",y.currentTarget.value)}),a.jsx(QT,{actions:u.action||[],selectedKey:i,setSelectedKey:s,hoverKey:l,setHoverKey:c,onChange:y=>g("action",y)}),a.jsx(Z,{type:"submit",children:"Save"})]})})}function QT(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:Ws.section,children:[e.actions.map(i=>a.jsx("div",{children:a.jsx($F,{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:Ws.bottomActions,children:a.jsx($e,{href:"#",onClick:i=>{Ye(i),r({id:YT()})},children:"Add action"})})]})}function $F(e){const{action:t}=e,n=UF(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){Ye(c),e.setHoverKey(e.action.id)}const l=We(Ws.section,{[Ws.editing]:r,[Ws.hovering]:o&&!r});return a.jsxs("div",{"data-testid":t.id,className:l,onClick:i,onMouseOver:s,onFocus:s,children:[r?a.jsx(zF,{action:t,actionType:n,onChange:e.onChange,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onRemove:e.onRemove}):a.jsx(FF,{action:t,actionType:n}),a.jsx("div",{className:Ws.bottomActions,children:a.jsx($e,{href:"#",onClick:c=>{c.preventDefault(),e.onRemove()},children:"Remove"})})]})}const hm={path:"PlanDefinition.action.timing[x]",min:0,max:1,description:"",isArray:!1,constraints:[],type:["dateTime","Period","Range","Timing"].map(e=>({code:e}))};function FF(e){const{action:t,actionType:n}=e,[r,o]=KT(t);return a.jsxs("div",{children:[a.jsxs("div",{children:[t.title||"Untitled"," ",n&&`(${n})`]}),t.definitionCanonical&&a.jsx("div",{children:a.jsx(md,{value:{reference:t.definitionCanonical}})}),r&&a.jsx("div",{children:a.jsx(wo,{property:hm,propertyType:o,value:r})})]})}function zF(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(oe,{name:`actionTitle-${t.id}`,label:"Title",defaultValue:t.title,onChange:i=>o("title",i.currentTarget.value)}),a.jsx(oe,{name:`actionDescription-${t.id}`,label:"Description",defaultValue:t.description,onChange:i=>o("description",i.currentTarget.value)}),a.jsx(ct,{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(QT,{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(su,{title:"Appointment",description:"The subject must schedule an appointment from the schedule.",resourceType:"Schedule",action:t,onChange:e.onChange});case"lab":return a.jsx(su,{title:"Lab",description:"The subject must complete the following lab panel.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});case"questionnaire":return a.jsx(su,{title:"Questionnaire",description:"The subject must complete the selected questionnaire.",resourceType:"Questionnaire",action:t,onChange:e.onChange});case"task":return a.jsx(su,{title:"Task",description:"The subject must complete the following task.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});default:return null}})(),a.jsx(et,{title:"Timing",description:"When the action should take place.",children:a.jsx(BF,{name:"timing-"+t.id,action:t,onChange:e.onChange})})]})}function su(e){const{id:t,definitionCanonical:n}=e.action,r=n!=null&&n.startsWith(e.resourceType+"/")?{reference:n}:void 0;return a.jsx(Oa,{name:t,resourceType:e.resourceType,defaultValue:r,loadOnFocus:!0,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:at(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function BF(e){const t=e.action,n="timing",[r,o]=KT(t);return a.jsx(Ma,{property:hm,name:"timing[x]",defaultValue:r,defaultPropertyType:o,onChange:(i,s)=>{e.onChange(um(t,n,s??n,hm,i))},outcome:void 0})}function UF(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 KT(e){return _f({type:"PlanDefinitionAction",value:e},"timing")}let Hh=1;function YT(e){if(e){if(e.startsWith("id-")){const t=parseInt(e.substring(3),10);isNaN(t)||(Hh=Math.max(Hh,t+1))}return e}return"id-"+Hh++}function VF(e){return{...e,action:XT(e.action)}}function XT(e){if(e)return e.map(t=>({...t,id:YT(t.id),action:XT(t.action)}))}var st=(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))(st||{});function HF(e){return e.type==="choice"||e.type==="open-choice"}function WF(e,t){if(!e.enableWhen)return!0;const n=e.enableBehavior??"any";for(const r of e.enableWhen){const o=JT(t,r.question);if(r.operator==="exists"&&!r.answerBoolean&&!(o!=null&&o.length)){if(n==="any")return!0;continue}const{anyMatch:i,allMatch:s}=QF(r,o,n);if(n==="any"&&i)return!0;if(n==="all"&&!s)return!1}return n!=="any"}function qF(e,t,n){return e.map(r=>{var s;const o=(s=n.answerOption)==null?void 0:s.find(l=>gs(l.valueCoding)===r||l[t]===r),i=yn({type:"QuestionnaireItemAnswerOption",value:o},"value");return{[t]:i==null?void 0:i.value}})}function JT(e,t){if(e)for(const n of e){if(n.linkId===t)return n.answer;if(n.item){const r=JT(n.item,t);if(r)return r}}}function GF(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}]=ql(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return o}else return!1}function QF(e,t,n){const r=t||[],o=yn({type:"QuestionnaireItemEnableWhen",value:e},"answer[x]");let i=!1,s=!0;for(const l of r){const c=yn({type:"QuestionnaireResponseItemAnswer",value:l},"value[x]"),{operator:u}=e;if(GF(c,o,u)?i=!0:s=!1,n==="any"&&i)break}return{anyMatch:i,allMatch:s}}function ZT(e){var n,r;const t=vc(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 Wh(e,t){var o;const n=wi(e);let r=vc(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 KF(e,t,n){const r=vc(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]=Z5(l,"=",2);i[c]=u}return i}function YF(e){return{resourceType:"QuestionnaireResponse",questionnaire:at(e),item:eP(e.item),status:"in-progress"}}function eP(e){return(e==null?void 0:e.map(tP))??[]}function tP(e){var t;return{id:JF(),linkId:e.linkId,text:e.text,item:eP(e.item),answer:((t=e.initial)==null?void 0:t.map(ZF))??[]}}let XF=1;function JF(){return"id-"+XF++}function ZF(e){return{...e}}function ez(e){return e.value.display||e.value.reference||On(e.value)}function tz(e){var n,r,o,i;const t=(n=e==null?void 0:e.item)==null?void 0:n[0];if(t){const s=vc(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 nP=p.createContext({});function pm(e){const t=p.useContext(nP),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((C,v)=>v===e.index?u:C)??[],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=Vv(r,e.index)??yn({type:"QuestionnaireItemInitial",value:l},"value");switch(i){case st.display:return a.jsx("p",{children:e.item.text},e.item.linkId);case st.boolean:return a.jsx(yT,{title:e.item.text,htmlFor:e.item.linkId,children:a.jsx(cr,{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 st.decimal:return a.jsx(oe,{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 st.integer:return a.jsx(oe,{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 st.date:return a.jsx(oe,{type:"date",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDate:u.currentTarget.value})});case st.dateTime:return a.jsx(Zi,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDateTime:u})});case st.time:return a.jsx(oe,{type:"time",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueTime:u.currentTarget.value})});case st.string:case st.url:return a.jsx(oe,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case st.text:return a.jsx(fs,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case st.attachment:return a.jsx(Y,{py:4,children:a.jsx(hT,{name:s,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueAttachment:u})})});case st.reference:return a.jsx(Nf,{name:s,required:n.required,targetTypes:ZT(n),searchCriteria:KF(n,t.subject,t.encounter),defaultValue:c==null?void 0:c.value,onChange:u=>o({valueReference:u})});case st.quantity:return a.jsx(es,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueQuantity:u}),disableWheel:!0});case st.choice:case st.openChoice:return az(n)&&!n.answerValueSet?a.jsx(nz,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)}):a.jsx(rz,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)});default:return null}}function nz(e){var c;const{name:t,item:n,initial:r,response:o}=e;if(!((c=n.answerOption)!=null&&c.length))return a.jsx(rP,{});const i=yn({type:"QuestionnaireItemInitial",value:r},"value"),s=[""];for(const u of n.answerOption){const d=yn({type:"QuestionnaireItemAnswerOption",value:u},"value");s.push(K1(d))}const l=Vv(o)??i;if(n.repeats){const{propertyName:u,data:d}=lz(e.item),f=iz(o);return a.jsx(pf,{data:d,placeholder:"Select items",searchable:!0,defaultValue:f||[K1(i)],onChange:h=>{const m=qF(h,u,n);e.onChangeAnswer(m)}})}return a.jsx(ct,{id:t,name:t,onChange:u=>{const d=u.currentTarget.selectedIndex;if(d===0){e.onChangeAnswer({});return}const f=n.answerOption[d-1],h=yn({type:"QuestionnaireItemAnswerOption",value:f},"value"),m="value"+tn(h.type);e.onChangeAnswer({[m]:h.value})},defaultValue:gs(l==null?void 0:l.value)||(l==null?void 0:l.value),data:s})}function rz(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(rP,{}):n.answerValueSet?a.jsx(xT,{name:t,binding:n.answerValueSet,onChange:l=>o({valueCoding:l})}):a.jsx(oz,{name:(i==null?void 0:i.id)??t,item:n,initial:r,response:i,onChangeAnswer:o})}function oz(e){const{name:t,item:n,initial:r,onChangeAnswer:o,response:i}=e,s=ys("QuestionnaireItemAnswerOption","value[x]"),l=yn({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}`,y=yn({type:"QuestionnaireItemAnswerOption",value:m},"value");y!=null&&y.value&&(l&&On(y)===On(l)&&(u=g),c.push([g,y]))}const d=Vv(i),f=sz(c,d);return a.jsx(Vl.Group,{name:t,value:f??u,onChange:h=>{const m=c.find(g=>g[0]===h);if(m){const g=m[1],y="value"+tn(g.type);o({[y]:g.value})}},children:c.map(([h,m])=>a.jsx(Vl,{id:h,value:h,py:4,label:a.jsx(wo,{property:s,propertyType:m.type,value:m.value})},h))})}function rP(){return a.jsx(oe,{disabled:!0,placeholder:"No Answers Defined"})}function oP(e){return yn({type:"QuestionnaireItemAnswer",value:e},"value")}function Vv(e,t=0){const n=e.answer;return oP((n==null?void 0:n[t])??{})}function iz(e){const t=e.answer;return t?t.map(r=>oP(r)).map(r=>gs(r==null?void 0:r.value)||(r==null?void 0:r.value)):[]}function sz(e,t){var n;return(n=e.find(r=>xc(r[1].value,t==null?void 0:t.value)))==null?void 0:n[0]}function K1(e){if(e)return e.type==="CodeableConcept"?va(e.value):e.type==="Coding"?gs(e.value):e.type==="Reference"?ez(e):e.value.toString()}function az(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 lz(e){var i;if(((i=e.answerOption)==null?void 0:i.length)===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=yn({type:"QuestionnaireItemAnswerOption",value:t},"value"),r="value"+tn(n.type),o=(e.answerOption??[]).map(s=>({value:Y1(s,r),label:Y1(s,r)}));return{propertyName:r,data:o}}function Y1(e,t){var n;return gs(e.valueCoding)||((n=e[t])==null?void 0:n.toString())}const cz="_section_cpwxo_1",uz="_hovering_cpwxo_10",dz="_editing_cpwxo_14",fz="_questionBody_cpwxo_19",hz="_topActions_cpwxo_23",pz="_bottomActions_cpwxo_32",mz="_movementActions_cpwxo_43",gz="_movementIcons_cpwxo_55",yz="_columnAlignment_cpwxo_59",vz="_linkIdInput_cpwxo_64",xz="_typeSelect_cpwxo_69",Zn={section:cz,hovering:uz,editing:dz,questionBody:fz,topActions:hz,bottomActions:pz,movementActions:mz,movementIcons:gz,columnAlignment:yz,linkIdInput:vz,typeSelect:xz};function wz(e){const t=te(),n=tt(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(jz(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,y)=>{s(g),e.autoSave&&!y&&e.onSubmit&&e.onSubmit(g)};return!r||!i?null:a.jsx("div",{children:a.jsxs(Le,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(i),children:[a.jsx(iP,{item:i,selectedKey:l,setSelectedKey:c,hoverKey:u,setHoverKey:d,onChange:m}),a.jsx(Z,{type:"submit",children:"Save"})]})})}function iP(e){var x;const t=e.item,n=e.item,r=Do(e.item),o=r||n.type===st.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){Ye(S),e.setSelectedKey(e.item.id)}function d(S){Ye(S),e.setHoverKey(e.item.id)}function f(S){var j;const E=c.current;e.onChange({...E,item:(j=E.item)==null?void 0:j.map(T=>T.id===S.id?S:T)})}function h(S,E){e.onChange({...e.item,item:[...e.item.item??[],S]},E)}function m(S){var E;e.onChange({...e.item,item:(E=e.item.item)==null?void 0:E.filter(j=>j!==S)})}function g(S,E){e.onChange({...c.current,[S]:E})}function y(S){e.onChange({...e.item,...S})}function C(S){var E;e.onChange({...e.item,item:(E=e.item.item)==null?void 0:E.map(j=>j===S?{...j,repeats:!j.repeats}:j)})}function v(S,E){const j=Pz(e.item.item,S,E);e.onChange({...e.item,item:j})}const w=We(Zn.section,{[Zn.editing]:s,[Zn.hovering]:l&&!s});return a.jsxs("div",{"data-testid":n.linkId,className:w,onClick:u,onMouseOver:d,onFocus:d,children:[a.jsx("div",{className:Zn.questionBody,children:s?a.jsxs(a.Fragment,{children:[r&&a.jsx(oe,{size:"xl",defaultValue:t.title,onBlur:S=>g("title",S.currentTarget.value)}),!r&&a.jsx(fs,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:S=>g("text",S.currentTarget.value)}),n.type==="reference"&&a.jsx(Cz,{item:n,onChange:y}),HF(n)&&a.jsx(Sz,{item:n,onChange:S=>y(S)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx(le,{children:t.title}),n.text&&a.jsx("div",{children:n.text}),!o&&a.jsx(pm,{item:n,index:0,onChange:()=>{},response:{linkId:n.linkId}})]})}),(x=n.item)==null?void 0:x.map((S,E)=>a.jsx("div",{children:a.jsx(iP,{item:S,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:E===0,isLast:E===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:f,onRemove:()=>m(S),onRepeatable:C,onMoveUp:()=>v(E,-1),onMoveDown:()=>v(E,1)})},S.id)),!o&&a.jsx("div",{className:Zn.topActions,children:s?a.jsxs(a.Fragment,{children:[a.jsx(oe,{size:"xs",className:Zn.linkIdInput,defaultValue:n.linkId,onBlur:S=>g("linkId",S.currentTarget.value)}),!o&&a.jsx(ct,{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($e,{href:"#",onClick:S=>{S.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(l$,{"data-testid":"up-button",size:15,className:Zn.movementIcons})}),!e.isLast&&a.jsx($e,{href:"#",onClick:S=>{S.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(a$,{"data-testid":"down-button",size:15,className:Zn.movementIcons})})]})}),a.jsxs("div",{className:Zn.bottomActions,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx($e,{href:"#",onClick:S=>{S.preventDefault(),h({id:ns(),linkId:ym("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx($e,{href:"#",onClick:S=>{S.preventDefault(),h({id:ns(),linkId:ym("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx($e,{href:"#",onClick:S=>{S.preventDefault(),h(Tz(),!0)},children:"Add Page"}),s&&!r&&a.jsxs(a.Fragment,{children:[a.jsx($e,{href:"#",onClick:S=>{S.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx($e,{href:"#",onClick:S=>{S.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function Sz(e){const t=ys("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(oe,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(bz,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(q,{display:"flex",children:[a.jsx($e,{href:"#",onClick:r=>{Ye(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:ns()}]})},children:"Add choice"}),a.jsx(Sf,{w:"lg"}),a.jsx($e,{href:"#",onClick:r=>{Ye(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function bz(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=_f({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(Ma,{name:"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($e,{href:"#",onClick:o=>{Ye(o),e.onChange({...e.item,answerOption:e.options.filter(i=>i.id!==t.id)})},children:"Remove"})})]},t.id)})})}function Cz(e){const t=ZT(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(Y,{children:[a.jsx(Cv,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:o=>{e.onChange(Wh(e.item,t.map(i=>i===n?o:i)))}}),a.jsx($e,{href:"#",onClick:o=>{Ye(o),e.onChange(Wh(e.item,t.filter(i=>i!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx($e,{href:"#",onClick:n=>{Ye(n),e.onChange(Wh(e.item,[...t,""]))},children:"Add Resource Type"})]})}let mm=1,gm=1;function ym(e){return e+mm++}function ns(){return"id-"+gm++}function jz(e){return{...e,id:e.id||ns(),item:sP(e.item)}}function sP(e){if(e)return e.forEach(t=>{var n,r;(n=t.id)!=null&&n.match(/^id-\d+$/)&&(gm=Math.max(gm,parseInt(t.id.substring(3),10)+1)),(r=t.linkId)!=null&&r.match(/^q\d+$/)&&(mm=Math.max(mm,parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||ns(),item:sP(t.item),answerOption:Ez(t.answerOption)}))}function Ez(e){if(e)return e.map(t=>({...t,id:t.id||ns()}))}function Tz(){return{id:ns(),linkId:ym("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 Pz(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 aP(e){const{item:t,response:n,onChange:r}=e,[o,i]=p.useState(kz(t,n??{linkId:t.linkId}));if(!e.checkForQuestionEnabled(t)||!n)return null;if(t.type===st.display)return a.jsx("p",{children:t.text},t.linkId);const s=(t==null?void 0:t.repeats)&&t.type!==st.choice&&t.type!==st.openChoice;return t.type===st.boolean?a.jsx(pm,{item:t,response:n,onChange:l=>r([l]),index:0},t.linkId):a.jsxs(et,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[[...Array(o)].map((l,c)=>a.jsx(pm,{item:t,response:n,onChange:u=>r([u]),index:c},`${t.linkId}-${c}`)),s&&a.jsx($e,{onClick:()=>i(l=>l+1),children:"Add Item"})]},e.item.linkId)}function kz(e,t){if(e.type===st.choice||e.type===st.openChoice)return 1;const n=t.answer;return n!=null&&n.length?n.length:1}function lP(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=tP(e.item);n([...t,i])}return a.jsxs(a.Fragment,{children:[t.map((i,s)=>a.jsx(cP,{item:e.item,response:i,checkForQuestionEnabled:e.checkForQuestionEnabled,onChange:l=>r(l,s)},i.id)),e.item.repeats&&a.jsx($e,{onClick:o,children:`Add Group: ${e.item.text}`})]})}function cP(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(le,{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===st.group?s.repeats?a.jsx(lP,{item:s,response:((l=t.item)==null?void 0:l.filter(d=>d.linkId===s.linkId))??[],checkForQuestionEnabled:n,onChange:o},s.linkId):a.jsx(cP,{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(aP,{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 Rz(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 y;const m=((y=n==null?void 0:n.item)==null?void 0:y.filter(C=>C.linkId===h.linkId))??[],g=h.type===st.group?a.jsx(lP,{item:h,response:m,onChange:o,checkForQuestionEnabled:d},h.linkId):a.jsx(aP,{item:h,response:m==null?void 0:m[0],onChange:o,checkForQuestionEnabled:d},h.linkId);return c?a.jsx(ya.Step,{label:h.text,children:g},h.linkId):g});return a.jsxs(a.Fragment,{children:[c&&a.jsx(ya,{active:r??0,allowNextStepsSelect:!1,p:6,children:f}),!c&&a.jsx(Se,{children:f}),a.jsx(Dz,{activePage:r??0,numberOfPages:l,nextStep:i,prevStep:s,submitButtonText:u})]})}function Dz(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(Z,{onClick:e.prevStep,children:"Back"}),n&&a.jsx(Z,{onClick:o=>{o.currentTarget.closest("form").reportValidity()&&e.nextStep()},children:"Next"}),r&&a.jsx(Z,{type:"submit",children:e.submitButtonText??"Submit"})]})}function uP(e){const t=te(),n=t.getProfile(),[r,o]=p.useState(!1),i=tt(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?YF(i):void 0)},[i]);function d(y){const C=(s==null?void 0:s.item)??[],w={resourceType:"QuestionnaireResponse",status:"in-progress",item:dP(C,Array.isArray(y)?y:[y])};l(w)}function f(y){return WF(y,(s==null?void 0:s.item)??[])}if(!r||!i)return null;const h=tz(i),m=()=>u(y=>y+1),g=()=>u(y=>y-1);return a.jsx(nP.Provider,{value:{subject:e.subject,encounter:e.encounter},children:a.jsxs(Le,{testid:"questionnaire-form",onSubmit:()=>{e.onSubmit&&s&&e.onSubmit({...s,questionnaire:at(i),subject:e.subject,source:mt(n),authored:new Date().toISOString(),status:"completed"})},children:[i.title&&a.jsx(le,{children:i.title}),a.jsx(Rz,{items:i.item??[],response:s,onChange:d,renderPages:h>1,activePage:c,numberOfPages:h,submitButtonText:e.submitButtonText,checkForQuestionEnabled:f,nextStep:m,prevStep:g})]})})}function Iz(e,t){const n=dP(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 dP(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(Iz(o,s)),r.add(s.id)):n.push(o)}for(const o of t)r.has(o.id)||n.push(o);return n}const _z="_section_4m5it_1",Az={section:_z},Nz=["gender","age","gestationalAge","context","appliesTo","category"],Oz={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function Mz(e){e=Object.assign(Oz,e);const t=e.definition,[n,r]=p.useState([]),[o,i]=p.useState(1),[s,l]=p.useState(1);return p.useEffect(()=>{const g=Fz(t,l);r(zz(g.qualifiedInterval||[],i))},[t]),a.jsxs(Le,{testid:"reference-range-editor",onSubmit:c,children:[a.jsx(Se,{children:n.map(g=>{var y;return a.jsx(Lz,{unit:Uz((y=t.quantitativeDetails)==null?void 0:y.unit),onChange:f,onAdd:h,onRemove:m,onRemoveGroup:d,intervalGroup:g},`group-${g.id}`)})}),a.jsx(Vt,{title:"Add Group",variant:"subtle",size:"sm",onClick:g=>{Ye(g),u({id:`group-id-${o}`,filters:{},intervals:[]}),i(y=>y+1)},children:a.jsx(hd,{})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Save"})})]});function c(){const g=n.flatMap(y=>y.intervals).filter(y=>!Vz(y));e.onSubmit({...t,qualifiedInterval:g})}function u(g){r(y=>[...y,g])}function d(g){r(y=>y.filter(C=>C.id!==g.id))}function f(g,y){r(C=>{C=[...C];const v=C.find(x=>x.id===g),w=v==null?void 0:v.intervals.findIndex(x=>x.id===y.id);return w!==void 0&&(v!=null&&v.intervals[w])&&(v.intervals[w]=y),C})}function h(g,y){y.id===void 0&&(y.id=`id-${s}`,l(C=>C+1)),r(C=>{C=[...C];const v=C.findIndex(w=>w.id===g);if(v!==-1){const w={...C[v]};y={...y,...w.filters},w.intervals=[...w.intervals,y],C[v]=w}return C})}function m(g,y){r(C=>{C=[...C];const v=C.find(w=>w.id===g);return v&&(v.intervals=v.intervals.filter(w=>w.id!==y.id)),C})}}function Lz(e){const{intervalGroup:t,unit:n}=e;return a.jsx(jc,{"data-testid":t.id,className:Az.section,children:a.jsxs(Se,{gap:"lg",children:[a.jsx(Y,{justify:"flex-end",children:a.jsx(Vt,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{Ye(r),e.onRemoveGroup(t)},children:a.jsx(fd,{})},`remove-group-button-${t.id}`)}),a.jsx($z,{intervalGroup:t,onChange:e.onChange}),a.jsx(Tn,{}),t.intervals.map(r=>a.jsxs(Se,{gap:"xs",children:[a.jsxs(Y,{children:[a.jsx(oe,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:o=>{Ye(o),e.onChange(t.id,{...r,condition:o.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(Vt,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:o=>{Ye(o),e.onRemove(t.id,r)},children:a.jsx(fd,{})},`remove-interval-${r.id}`)]}),a.jsx(Pv,{onChange:o=>{e.onChange(t.id,{...r,range:o})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(Vt,{title:"Add Interval",variant:"subtle",size:"sm",onClick:r=>{Ye(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:a.jsx(hd,{})})]})})}function $z(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(ct,{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(se,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),a.jsx("div",{id:`div-age-${t.id}`,children:a.jsx(Pv,{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(ct,{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(ct,{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 Fz(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 zz(e,t){let n=1;const r={};for(const o of e){const i=Bz(o);i in r||(r[i]={id:`group-id-${n++}`,filters:Object.fromEntries(Nz.map(s=>[s,o[s]])),intervals:[]}),r[i].intervals.push(o)}return t(n),Object.values(r)}function Bz(e){var n,r;return[`gender=${e.gender}`,`age=${Hl(e.age)}`,`gestationalAge=${Hl(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 Uz(e){return e&&(X5(e,"http://unitsofmeasure.org")||e.text)}function Vz(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 Hz(e){var u;const t=te(),n=tt(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(Un,{children:(u=n.action)==null?void 0:u.map((d,f)=>{var y,C,v,w,x,S;const h=d.resource&&c(d.resource),m=(C=(y=h==null?void 0:h.input)==null?void 0:y[0])==null?void 0:C.valueReference,g=(w=(v=h==null?void 0:h.output)==null?void 0:v[0])==null?void 0:w.valueReference;return a.jsxs(p.Fragment,{children:[a.jsx(Un.Col,{span:1,p:"md",children:(h==null?void 0:h.status)==="completed"?a.jsx(y$,{}):a.jsx(H$,{color:"gray"})}),a.jsxs(Un.Col,{span:9,p:"xs",children:[a.jsx(se,{fw:500,children:d.title}),d.description&&a.jsx("div",{children:d.description}),a.jsxs("div",{children:["Last edited by ",a.jsx(Ec,{value:(x=h==null?void 0:h.meta)==null?void 0:x.author})," on ",Mn((S=h==null?void 0:h.meta)==null?void 0:S.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx(PT,{status:(h==null?void 0:h.status)||"unknown"})]})]}),a.jsxs(Un.Col,{span:2,p:"md",children:[m&&!g&&a.jsx(Z,{onClick:()=>e.onStart(h,m),children:"Start"}),m&&g&&a.jsx(Z,{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===at(f.resource))return f.resource}}function fP(e,t){const n=Wz(e,t);return qz(n,e,t)}function Wz(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 y,C=0;u===-c||u!==c&&g.i<m.i?(C=m.i,y=m):(C=g.i+1,y=g),l[h]=void 0;let v=C-u,w={i:C,j:v,prev:Gz(y),snake:!1};for(;C<n&&v<r&&e[C]===t[v];)C++,v++;if(C>w.i&&(w={i:C,j:v,prev:w,snake:!0}),l[d]=w,C>=n&&v>=r)return l[d]}l[s+c-1]=void 0}}function qz(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 Gz(e){return e&&!e.snake&&e.prev?e.prev:e}function Qz(e){const t=e.entry.filter(r=>!!r.resource).map(r=>{var o;return{meta:(o=r.resource)==null?void 0:o.meta,lines:On(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 Kz(n,t),Yz(n),n}function Kz(e,t){for(let n=1;n<t.length;n++){const r=fP(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 Yz(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 Xz="_container_n4i51_1",Jz="_root_n4i51_5",Zz="_startRow_n4i51_20",eB="_normalRow_n4i51_24",tB="_author_n4i51_28",nB="_dateTime_n4i51_32",rB="_lineNumber_n4i51_37",oB="_line_n4i51_37",iB="_pre_n4i51_52",no={container:Xz,root:Jz,startRow:Zz,normalRow:eB,author:tB,dateTime:nB,lineNumber:rB,line:oB,pre:iB};function sB(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function aB(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return Ds(n,"year");const r=Math.floor(t/2592e3);if(r>0)return Ds(r,"month");const o=Math.floor(t/86400);if(o>0)return Ds(o,"day");const i=Math.floor(t/3600);if(i>0)return Ds(i,"hour");const s=Math.floor(t/60);return s>0?Ds(s,"minute"):Ds(t,"second")}function Ds(e,t){return`${e} ${e===1?t:t+"s"} ago`}function lB(e){var s,l;const t=te(),[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=Qz(n);return a.jsx("div",{className:no.container,children:a.jsx("table",{className:no.root,children:a.jsx("tbody",{children:i.map((c,u)=>a.jsxs("tr",{className:c.span>0?no.startRow:no.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:no.author,rowSpan:c.span,children:a.jsx(na,{value:c.meta.author,link:!0})}),a.jsx("td",{className:no.dateTime,rowSpan:c.span,children:a.jsx(Ie,{to:sB(o,c.meta.versionId),children:aB(c.meta.lastUpdated)})})]}),a.jsx("td",{className:no.lineNumber,children:u+1}),a.jsx("td",{className:no.line,children:a.jsx("pre",{className:no.pre,children:c.value})})]},"row-"+u))})})})}const cB="_removed_mgz0k_2",uB="_added_mgz0k_7",X1={removed:cB,added:uB};function dB(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=On(t,!0).match(/[^\r\n]+/g),o=On(n,!0).match(/[^\r\n]+/g),i=fP(r,o);return a.jsx("pre",{style:{color:"gray"},children:i.map((s,l)=>a.jsx(fB,{delta:s},"delta"+l))})}function fB(e){return a.jsxs(a.Fragment,{children:["...",a.jsx("br",{}),e.delta.original.lines.length>0&&a.jsx("div",{className:X1.removed,children:e.delta.original.lines.join(`
195
- `)}),e.delta.revised.lines.length>0&&a.jsx("div",{className:X1.added,children:e.delta.revised.lines.join(`
196
- `)}),"...",a.jsx("br",{})]})}function Hv(e){const{outcome:t}=e,n=te(),r=tt(e.defaultValue),[o,i]=p.useState(),[s,l]=p.useState();return p.useEffect(()=>{if(r)if(l(wi(r)),e.profileUrl){const c=e.profileUrl;n.requestProfileSchema(e.profileUrl).then(()=>{const u=Ef(c);u?i(u.name):console.log(`Schema not found for ${c}`)}).catch(console.log)}else{const c=e.schemaName??(r==null?void 0:r.resourceType);n.requestSchema(c).then(()=>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(et,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(oe,{name:"resourceType",defaultValue:s.resourceType,disabled:!0})}),a.jsx(et,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(oe,{name:"id",defaultValue:s.id,disabled:!0})})]}),a.jsx(Rv,{typeName:o,defaultValue:s,outcome:t,onChange:l,profileUrl:e.profileUrl}),a.jsxs(Y,{justify:"flex-end",mt:"xl",children:[a.jsx(Z,{type:"submit",children:"OK"}),e.onDelete&&a.jsx(Z,{variant:"outline",color:"red",type:"button",onClick:()=>{e.onDelete(s)},children:"Delete"})]})]})}function hB(e){var o;const t=te(),[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(he,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx(he.Thead,{children:a.jsxs(he.Tr,{children:[a.jsx(he.Th,{children:"Author"}),a.jsx(he.Th,{children:"Date"}),a.jsx(he.Th,{children:"Version"})]})}),a.jsx(he.Tbody,{children:(o=n.entry)==null?void 0:o.map((i,s)=>a.jsx(pB,{entry:i},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function pB(e){var r,o,i;const{response:t,resource:n}=e.entry;return n?a.jsxs(he.Tr,{children:[a.jsx(he.Td,{children:a.jsx(na,{value:(r=n.meta)==null?void 0:r.author,link:!0})}),a.jsx(he.Td,{children:Mn((o=n.meta)==null?void 0:o.lastUpdated)}),a.jsx(he.Td,{children:a.jsx(Ie,{to:mB(n),children:(i=n.meta)==null?void 0:i.versionId})})]}):a.jsx(he.Tr,{children:a.jsx(he.Td,{colSpan:3,children:ke(t==null?void 0:t.outcome)})})}function mB(e){var t;return`/${e.resourceType}/${e.id}/_history/${(t=e.meta)==null?void 0:t.versionId}`}function gB(e){return a.jsx(Mf,{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:[mt(t)],subject:t.subject,sender:mt(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",basedOn:[mt(t)],subject:t.subject,operator:mt(n),issued:new Date().toISOString(),content:r})})}function yB(e){const t=te(),{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=>ce({color:"red",message:ke(c),autoClose:!1}))}return a.jsx($e,{onClick:()=>l(),...s,children:i})}function hP(e){const t=te(),[n,r]=p.useState();return a.jsxs(Le,{style:{maxWidth:400},onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(i){r(ot(i))}},children:[a.jsxs(Bt,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Create project"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(oe,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:_e(n,"firstName")}),a.jsxs(se,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx($e,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx($e,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Create project"})})]})}function pP(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 mP(e){const t=te(),{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"){pP("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 vB={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.0-0cc50f0d",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function gP(e){var t;if(e)return e;if(typeof window<"u"){const n=window.location.protocol+"//"+window.location.host;if((((t=vB.GOOGLE_AUTH_ORIGINS)==null?void 0:t.split(","))??[]).includes(n))return"__GOOGLE_CLIENT_ID__"}}function yP(e){typeof grecaptcha>"u"&&pP("https://www.google.com/recaptcha/api.js?render="+e)}function vP(e){return new Promise((t,n)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(r){n(r)}})})}function xB(e){const t=gP(e.googleClientId),n=e.recaptchaSiteKey,r=te(),[o,i]=p.useState(),s=Af(o,void 0);return p.useEffect(()=>{n&&yP(n)},[n]),a.jsxs(Le,{style:{maxWidth:400},onSubmit:async l=>{try{let c="";n&&(c=await vP(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(ot(c))}},children:[a.jsx(Bt,{style:{flexDirection:"column"},children:e.children}),a.jsx(eo,{issues:s}),t&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(mP,{googleClientId:t,handleGoogleCredential:async l=>{try{e.handleAuthResponse(await r.startGoogleLogin({googleClientId:l.clientId,googleCredential:l.credential,createUser:!0}))}catch(c){i(ot(c))}}})}),a.jsx(Tn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(oe,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:_e(o,"firstName")}),a.jsx(oe,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:_e(o,"lastName")}),a.jsx(oe,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:_e(o,"email")}),a.jsx(Pr,{name:"password",label:"Password",autoComplete:"off",required:!0,error:_e(o,"password")}),a.jsxs(se,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx($e,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx($e,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),a.jsxs(se,{c:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",a.jsx($e,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx($e,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(cr,{name:"remember",label:"Remember me",size:"xs"}),a.jsx(Z,{type:"submit",children:"Create account"})]})]})}function wB(e){const{type:t,projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,onSuccess:s}=e,l=te(),[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(ot(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(we,{width:450,children:[d&&a.jsx("pre",{children:JSON.stringify(d,null,2)}),!c&&a.jsx(xB,{projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,handleAuthResponse:h,children:e.children}),c&&t==="project"&&a.jsx(hP,{login:c,handleAuthResponse:h})]})}function SB(e){const[t,n]=p.useState();return t?a.jsx(CB,{email:t,...e}):a.jsx(bB,{setEmail:n,...e})}function bB(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:o,disableEmailAuth:i,...s}=e,l=te(),c=!e.disableGoogleAuth&&gP(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(Le,{style:{maxWidth:400},onSubmit:d,children:[a.jsx(Bt,{style:{flexDirection:"column"},children:o}),c&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(mP,{googleClientId:c,handleGoogleCredential:f})}),!i&&a.jsx(Tn,{label:"or",labelPosition:"center",my:"lg"})]}),!i&&a.jsx(oe,{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($e,{component:"button",type:"button",color:"dimmed",onClick:n,size:"xs",children:"Register"})}),!i&&a.jsx(Z,{type:"submit",children:"Next"})]})]})}function CB(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...o}=e,i=te(),[s,l]=p.useState(),c=Af(s,void 0),u=p.useCallback(d=>{i.startLogin({...o,password:d.password,remember:d.remember==="on"}).then(n).catch(f=>l(ot(f)))},[i,o,n]);return a.jsxs(Le,{style:{maxWidth:400},onSubmit:u,children:[a.jsx(Bt,{style:{flexDirection:"column"},children:r}),a.jsx(eo,{issues:c}),a.jsx(Se,{gap:"xl",children:a.jsx(Pr,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:_e(s,"password")})}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[t&&a.jsx($e,{component:"button",type:"button",c:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),a.jsx(cr,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1}}),a.jsx(Z,{type:"submit",children:"Sign in"})]})]})}function jB(e){const t=te(),[n,r]=p.useState();return a.jsxs(Se,{children:[a.jsxs(Bt,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(le,{order:3,children:"Choose profile"})]}),a.jsx(eo,{outcome:n}),e.memberships.map(o=>{var i,s;return a.jsx(qn,{onClick:()=>{t.post("auth/profile",{login:e.login,profile:o.id}).then(e.handleAuthResponse).catch(l=>r(ot(l)))},children:a.jsxs(Y,{children:[a.jsx(Xi,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(se,{size:"sm",fw:500,children:(i=o.profile)==null?void 0:i.display}),a.jsx(se,{c:"dimmed",size:"xs",children:(s=o.project)==null?void 0:s.display})]})]})},o.id)})]})}function EB(e){const t=te();return a.jsx(Le,{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(Bt,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Choose scope"})]}),a.jsx(Se,{children:(e.scope??"openid").split(" ").map(n=>a.jsx(cr,{id:n,name:n,label:n,defaultChecked:!0},n))}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Set scope"})})]})})}function TB(e){const t=te(),[n,r]=p.useState();return a.jsx(Le,{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(ke(i)))},children:a.jsxs(Se,{children:[a.jsxs(Bt,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Enter MFA code"})]}),n&&a.jsx(ds,{icon:a.jsx(bc,{size:16}),title:"Error",color:"red",children:n}),a.jsx(Se,{children:a.jsx(oe,{name:"token",label:"MFA code",required:!0})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Submit code"})})]})})}function xP(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:o,onRegister:i,onCode:s,...l}=e,c=te(),[u,d]=p.useState(),[f,h]=p.useState(!1),[m,g]=p.useState(),y=p.useCallback(w=>{s?s(w):c.processCode(w).then(()=>{r&&r()}).catch(x=>ce({color:"red",message:ke(x)}))},[c,s,r]),C=p.useCallback(w=>{h(!!w.mfaRequired),w.login&&d(w.login),w.memberships&&g(w.memberships),w.code&&(n?g(void 0):y(w.code))},[n,y]),v=p.useCallback(w=>{y(w.code)},[y]);return p.useEffect(()=>{t&&!u&&c.get("auth/login/"+t).then(C).catch(w=>ce({color:"red",message:ke(w)}))},[c,t,u,C]),a.jsx(we,{width:450,children:u?f?a.jsx(TB,{login:u,handleAuthResponse:C}):m?a.jsx(jB,{login:u,memberships:m,handleAuthResponse:C}):e.projectId==="new"?a.jsx(hP,{login:u,handleAuthResponse:C}):e.chooseScopes?a.jsx(EB,{login:u,scope:e.scope,handleAuthResponse:v}):a.jsx("div",{children:"Success"}):a.jsx(SB,{onForgotPassword:o,onRegister:i,handleAuthResponse:C,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...l,children:e.children})})}var wP,J1=ic;wP=J1.createRoot,J1.hydrateRoot;/**
197
- * @remix-run/router v1.14.2
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 Et(){return Et=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},Et.apply(this,arguments)}var Rt;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Rt||(Rt={}));const Z1="popstate";function PB(e){e===void 0&&(e={});function t(r,o){let{pathname:i,search:s,hash:l}=r.location;return Kl("",{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:kc(o)}return RB(t,n,null,e)}function De(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function rs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kB(){return Math.random().toString(36).substr(2,8)}function ew(e,t){return{usr:e.state,key:e.key,idx:t}}function Kl(e,t,n,r){return n===void 0&&(n=null),Et({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Io(t):t,{state:n,key:t&&t.key||r||kB()})}function kc(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 Io(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 RB(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,l=Rt.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(Et({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=Rt.Pop;let C=d(),v=C==null?null:C-u;u=C,c&&c({action:l,location:y.location,delta:v})}function h(C,v){l=Rt.Push;let w=Kl(y.location,C,v);n&&n(w,C),u=d()+1;let x=ew(w,u),S=y.createHref(w);try{s.pushState(x,"",S)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;o.location.assign(S)}i&&c&&c({action:l,location:y.location,delta:1})}function m(C,v){l=Rt.Replace;let w=Kl(y.location,C,v);n&&n(w,C),u=d();let x=ew(w,u),S=y.createHref(w);s.replaceState(x,"",S),i&&c&&c({action:l,location:y.location,delta:0})}function g(C){let v=o.location.origin!=="null"?o.location.origin:o.location.href,w=typeof C=="string"?C:kc(C);return De(v,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,v)}let y={get action(){return l},get location(){return e(o,s)},listen(C){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(Z1,f),c=C,()=>{o.removeEventListener(Z1,f),c=null}},createHref(C){return t(o,C)},createURL:g,encodeLocation(C){let v=g(C);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:m,go(C){return s.go(C)}};return y}var bt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(bt||(bt={}));const DB=new Set(["lazy","caseSensitive","path","id","index","children"]);function IB(e){return e.index===!0}function vm(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(De(o.index!==!0||!o.children,"Cannot specify children on an index route"),De(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),IB(o)){let c=Et({},o,t(o),{id:l});return r[l]=c,c}else{let c=Et({},o,t(o),{id:l,children:void 0});return r[l]=c,o.children&&(c.children=vm(o.children,t,s,r)),c}})}function qs(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?Io(t):t,o=Rc(r.pathname||"/",n);if(o==null)return null;let i=SP(e);AB(i);let s=null;for(let l=0;s==null&&l<i.length;++l)s=UB(i[l],WB(o));return s}function _B(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 SP(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("/")&&(De(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=ai([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(De(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),SP(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:zB(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 bP(i.path))o(i,s,c)}),t}function bP(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=bP(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 AB(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:BB(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const NB=/^:[\w-]+$/,OB=3,MB=2,LB=1,$B=10,FB=-2,tw=e=>e==="*";function zB(e,t){let n=e.split("/"),r=n.length;return n.some(tw)&&(r+=FB),t&&(r+=MB),n.filter(o=>!tw(o)).reduce((o,i)=>o+(NB.test(i)?OB:i===""?LB:$B),r)}function BB(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 UB(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=VB({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:ai([o,d.pathname]),pathnameBase:KB(ai([o,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(o=ai([o,d.pathnameBase]))}return i}function VB(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=HB(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 y=l[f]||"";s=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const g=l[f];return m&&!g?u[h]=void 0:u[h]=qB(g||"",h),u},{}),pathname:i,pathnameBase:s,pattern:e}}function HB(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),rs(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 WB(e){try{return decodeURI(e)}catch(t){return rs(!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 qB(e,t){try{return decodeURIComponent(e)}catch(n){return rs(!1,'The value for the URL param "'+t+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+n+").")),e}}function Rc(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 GB(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Io(e):e;return{pathname:n?n.startsWith("/")?n:QB(n,t):t,search:YB(r),hash:XB(o)}}function QB(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 qh(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 CP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function jP(e,t){let n=CP(e);return t?n.map((r,o)=>o===e.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function EP(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=Io(e):(o=Et({},e),De(!o.pathname||!o.pathname.includes("?"),qh("?","pathname","search",o)),De(!o.pathname||!o.pathname.includes("#"),qh("#","pathname","hash",o)),De(!o.search||!o.search.includes("#"),qh("#","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=GB(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ai=e=>e.join("/").replace(/\/\/+/g,"/"),KB=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),YB=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,XB=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Wv{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 TP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const PP=["post","put","patch","delete"],JB=new Set(PP),ZB=["get",...PP],eU=new Set(ZB),tU=new Set([301,302,303,307,308]),nU=new Set([307,308]),Gh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},rU={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Za={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},kP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oU=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),RP="remix-router-transitions";function iU(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;De(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=$=>({hasErrorBoundary:A($)})}else o=oU;let i={},s=vm(e.routes,o,void 0,i),l,c=e.basename||"/",u=Et({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,y=e.hydrationData!=null,C=qs(s,e.history.location,c),v=null;if(C==null){let A=er(404,{pathname:e.history.location.pathname}),{matches:$,route:H}=cw(s);C=$,v={[H.id]:A}}let w,x=C.some(A=>A.route.lazy),S=C.some(A=>A.route.loader);if(x)w=!1;else if(!S)w=!0;else if(u.v7_partialHydration){let A=e.hydrationData?e.hydrationData.loaderData:null,$=e.hydrationData?e.hydrationData.errors:null;w=C.every(H=>H.route.loader&&H.route.loader.hydrate!==!0&&(A&&A[H.route.id]!==void 0||$&&$[H.route.id]!==void 0))}else w=e.hydrationData!=null;let E,j={historyAction:e.history.action,location:e.history.location,matches:C,initialized:w,navigation:Gh,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||v,fetchers:new Map,blockers:new Map},T=Rt.Pop,P=!1,R,I=!1,O=new Map,D=null,N=!1,L=!1,B=[],F=[],_=new Map,k=0,M=-1,W=new Map,K=new Set,ie=new Map,ve=new Map,Ee=new Set,Ne=new Map,je=new Map,Ue=!1;function dt(){if(d=e.history.listen(A=>{let{action:$,location:H,delta:J}=A;if(Ue){Ue=!1;return}rs(je.size===0||J!=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 ae=Ti({currentLocation:j.location,nextLocation:H,historyAction:$});if(ae&&J!=null){Ue=!0,e.history.go(J*-1),No(ae,{state:"blocked",location:H,proceed(){No(ae,{state:"proceeding",proceed:void 0,reset:void 0,location:H}),e.history.go(J)},reset(){let Re=new Map(j.blockers);Re.set(ae,Za),Ge({blockers:Re})}});return}return Pt($,H)}),n){gU(t,O);let A=()=>yU(t,O);t.addEventListener("pagehide",A),D=()=>t.removeEventListener("pagehide",A)}return j.initialized||Pt(Rt.Pop,j.location,{initialHydration:!0}),E}function ft(){d&&d(),D&&D(),f.clear(),R&&R.abort(),j.fetchers.forEach((A,$)=>Yn($)),j.blockers.forEach((A,$)=>xs($))}function rn(A){return f.add(A),()=>f.delete(A)}function Ge(A,$){$===void 0&&($={}),j=Et({},j,A);let H=[],J=[];u.v7_fetcherPersist&&j.fetchers.forEach((ae,Re)=>{ae.state==="idle"&&(Ee.has(Re)?J.push(Re):H.push(Re))}),[...f].forEach(ae=>ae(j,{deletedFetchers:J,unstable_viewTransitionOpts:$.viewTransitionOpts,unstable_flushSync:$.flushSync===!0})),u.v7_fetcherPersist&&(H.forEach(ae=>j.fetchers.delete(ae)),J.forEach(ae=>Yn(ae)))}function Nt(A,$,H){var J,ae;let{flushSync:Re}=H===void 0?{}:H,xe=j.actionData!=null&&j.navigation.formMethod!=null&&br(j.navigation.formMethod)&&j.navigation.state==="loading"&&((J=A.state)==null?void 0:J._isRedirect)!==!0,ye;$.actionData?Object.keys($.actionData).length>0?ye=$.actionData:ye=null:xe?ye=j.actionData:ye=null;let pe=$.loaderData?lw(j.loaderData,$.loaderData,$.matches||[],$.errors):j.loaderData,me=j.blockers;me.size>0&&(me=new Map(me),me.forEach((Ke,qt)=>me.set(qt,Za)));let St=P===!0||j.navigation.formMethod!=null&&br(j.navigation.formMethod)&&((ae=A.state)==null?void 0:ae._isRedirect)!==!0;l&&(s=l,l=void 0),N||T===Rt.Pop||(T===Rt.Push?e.history.push(A,A.state):T===Rt.Replace&&e.history.replace(A,A.state));let Te;if(T===Rt.Pop){let Ke=O.get(j.location.pathname);Ke&&Ke.has(A.pathname)?Te={currentLocation:j.location,nextLocation:A}:O.has(A.pathname)&&(Te={currentLocation:A,nextLocation:j.location})}else if(I){let Ke=O.get(j.location.pathname);Ke?Ke.add(A.pathname):(Ke=new Set([A.pathname]),O.set(j.location.pathname,Ke)),Te={currentLocation:j.location,nextLocation:A}}Ge(Et({},$,{actionData:ye,loaderData:pe,historyAction:T,location:A,initialized:!0,navigation:Gh,revalidation:"idle",restoreScrollPosition:Wt(A,$.matches||j.matches),preventScrollReset:St,blockers:me}),{viewTransitionOpts:Te,flushSync:Re===!0}),T=Rt.Pop,P=!1,I=!1,N=!1,L=!1,B=[],F=[]}async function Xe(A,$){if(typeof A=="number"){e.history.go(A);return}let H=xm(j.location,j.matches,c,u.v7_prependBasename,A,u.v7_relativeSplatPath,$==null?void 0:$.fromRouteId,$==null?void 0:$.relative),{path:J,submission:ae,error:Re}=nw(u.v7_normalizeFormMethod,!1,H,$),xe=j.location,ye=Kl(j.location,J,$&&$.state);ye=Et({},ye,e.history.encodeLocation(ye));let pe=$&&$.replace!=null?$.replace:void 0,me=Rt.Push;pe===!0?me=Rt.Replace:pe===!1||ae!=null&&br(ae.formMethod)&&ae.formAction===j.location.pathname+j.location.search&&(me=Rt.Replace);let St=$&&"preventScrollReset"in $?$.preventScrollReset===!0:void 0,Te=($&&$.unstable_flushSync)===!0,Ke=Ti({currentLocation:xe,nextLocation:ye,historyAction:me});if(Ke){No(Ke,{state:"blocked",location:ye,proceed(){No(Ke,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),Xe(A,$)},reset(){let qt=new Map(j.blockers);qt.set(Ke,Za),Ge({blockers:qt})}});return}return await Pt(me,ye,{submission:ae,pendingError:Re,preventScrollReset:St,replace:$&&$.replace,enableViewTransition:$&&$.unstable_viewTransition,flushSync:Te})}function Ot(){if(Je(),Ge({revalidation:"loading"}),j.navigation.state!=="submitting"){if(j.navigation.state==="idle"){Pt(j.historyAction,j.location,{startUninterruptedRevalidation:!0});return}Pt(T||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation})}}async function Pt(A,$,H){R&&R.abort(),R=null,T=A,N=(H&&H.startUninterruptedRevalidation)===!0,Qf(j.location,j.matches),P=(H&&H.preventScrollReset)===!0,I=(H&&H.enableViewTransition)===!0;let J=l||s,ae=H&&H.overrideNavigation,Re=qs(J,$,c),xe=(H&&H.flushSync)===!0;if(!Re){let qt=er(404,{pathname:$.pathname}),{matches:Xn,route:Ft}=cw(J);Ht(),Nt($,{matches:Xn,loaderData:{},errors:{[Ft.id]:qt}},{flushSync:xe});return}if(j.initialized&&!L&&uU(j.location,$)&&!(H&&H.submission&&br(H.submission.formMethod))){Nt($,{matches:Re},{flushSync:xe});return}R=new AbortController;let ye=tl(e.history,$,R.signal,H&&H.submission),pe,me;if(H&&H.pendingError)me={[bl(Re).route.id]:H.pendingError};else if(H&&H.submission&&br(H.submission.formMethod)){let qt=await mr(ye,$,H.submission,Re,{replace:H.replace,flushSync:xe});if(qt.shortCircuited)return;pe=qt.pendingActionData,me=qt.pendingActionError,ae=Qh($,H.submission),xe=!1,ye=new Request(ye.url,{signal:ye.signal})}let{shortCircuited:St,loaderData:Te,errors:Ke}=await Kn(ye,$,Re,ae,H&&H.submission,H&&H.fetcherSubmission,H&&H.replace,H&&H.initialHydration===!0,xe,pe,me);St||(R=null,Nt($,Et({matches:Re},pe?{actionData:pe}:{},{loaderData:Te,errors:Ke})))}async function mr(A,$,H,J,ae){ae===void 0&&(ae={}),Je();let Re=pU($,H);Ge({navigation:Re},{flushSync:ae.flushSync===!0});let xe,ye=Sm(J,$);if(!ye.route.action&&!ye.route.lazy)xe={type:bt.error,error:er(405,{method:A.method,pathname:$.pathname,routeId:ye.route.id})};else if(xe=await el("action",A,ye,J,i,o,c,u.v7_relativeSplatPath),A.signal.aborted)return{shortCircuited:!0};if(Bi(xe)){let pe;return ae&&ae.replace!=null?pe=ae.replace:pe=xe.location===j.location.pathname+j.location.search,await ee(j,xe,{submission:H,replace:pe}),{shortCircuited:!0}}if(Gs(xe)){let pe=bl(J,ye.route.id);return(ae&&ae.replace)!==!0&&(T=Rt.Push),{pendingActionData:{},pendingActionError:{[pe.route.id]:xe.error}}}if(zi(xe))throw er(400,{type:"defer-action"});return{pendingActionData:{[ye.route.id]:xe.data}}}async function Kn(A,$,H,J,ae,Re,xe,ye,pe,me,St){let Te=J||Qh($,ae),Ke=ae||Re||fw(Te),qt=l||s,[Xn,Ft]=rw(e.history,j,H,Ke,$,u.v7_partialHydration&&ye===!0,L,B,F,Ee,ie,K,qt,c,me,St);if(Ht(Ze=>!(H&&H.some(ht=>ht.route.id===Ze))||Xn&&Xn.some(ht=>ht.route.id===Ze)),M=++k,Xn.length===0&&Ft.length===0){let Ze=gr();return Nt($,Et({matches:H,loaderData:{},errors:St||null},me?{actionData:me}:{},Ze?{fetchers:new Map(j.fetchers)}:{}),{flushSync:pe}),{shortCircuited:!0}}if(!N&&(!u.v7_partialHydration||!ye)){Ft.forEach(ht=>{let $r=j.fetchers.get(ht.key),Ac=nl(void 0,$r?$r.data:void 0);j.fetchers.set(ht.key,Ac)});let Ze=me||j.actionData;Ge(Et({navigation:Te},Ze?Object.keys(Ze).length===0?{actionData:null}:{actionData:Ze}:{},Ft.length>0?{fetchers:new Map(j.fetchers)}:{}),{flushSync:pe})}Ft.forEach(Ze=>{_.has(Ze.key)&&jn(Ze.key),Ze.controller&&_.set(Ze.key,Ze.controller)});let ws=()=>Ft.forEach(Ze=>jn(Ze.key));R&&R.signal.addEventListener("abort",ws);let{results:Kf,loaderResults:Ss,fetcherResults:Oo}=await be(j.matches,H,Xn,Ft,A);if(A.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener("abort",ws),Ft.forEach(Ze=>_.delete(Ze.key));let ki=uw(Kf);if(ki){if(ki.idx>=Xn.length){let Ze=Ft[ki.idx-Xn.length].key;K.add(Ze)}return await ee(j,ki.result,{replace:xe}),{shortCircuited:!0}}let{loaderData:Yf,errors:Xf}=aw(j,H,Xn,Ss,St,Ft,Oo,Ne);Ne.forEach((Ze,ht)=>{Ze.subscribe($r=>{($r||Ze.done)&&Ne.delete(ht)})});let Jf=gr(),bs=Ao(M),_c=Jf||bs||Ft.length>0;return Et({loaderData:Yf,errors:Xf},_c?{fetchers:new Map(j.fetchers)}:{})}function _o(A,$,H,J){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)&&jn(A);let ae=(J&&J.unstable_flushSync)===!0,Re=l||s,xe=xm(j.location,j.matches,c,u.v7_prependBasename,H,u.v7_relativeSplatPath,$,J==null?void 0:J.relative),ye=qs(Re,xe,c);if(!ye){kt(A,$,er(404,{pathname:xe}),{flushSync:ae});return}let{path:pe,submission:me,error:St}=nw(u.v7_normalizeFormMethod,!0,xe,J);if(St){kt(A,$,St,{flushSync:ae});return}let Te=Sm(ye,pe);if(P=(J&&J.preventScrollReset)===!0,me&&br(me.formMethod)){$t(A,$,pe,Te,ye,ae,me);return}ie.set(A,{routeId:$,path:pe}),to(A,$,pe,Te,ye,ae,me)}async function $t(A,$,H,J,ae,Re,xe){if(Je(),ie.delete(A),!J.route.action&&!J.route.lazy){let ht=er(405,{method:xe.formMethod,pathname:H,routeId:$});kt(A,$,ht,{flushSync:Re});return}let ye=j.fetchers.get(A);Qe(A,mU(xe,ye),{flushSync:Re});let pe=new AbortController,me=tl(e.history,H,pe.signal,xe);_.set(A,pe);let St=k,Te=await el("action",me,J,ae,i,o,c,u.v7_relativeSplatPath);if(me.signal.aborted){_.get(A)===pe&&_.delete(A);return}if(u.v7_fetcherPersist&&Ee.has(A)){if(Bi(Te)||Gs(Te)){Qe(A,$o(void 0));return}}else{if(Bi(Te))if(_.delete(A),M>St){Qe(A,$o(void 0));return}else return K.add(A),Qe(A,nl(xe)),ee(j,Te,{fetcherSubmission:xe});if(Gs(Te)){kt(A,$,Te.error);return}}if(zi(Te))throw er(400,{type:"defer-action"});let Ke=j.navigation.location||j.location,qt=tl(e.history,Ke,pe.signal),Xn=l||s,Ft=j.navigation.state!=="idle"?qs(Xn,j.navigation.location,c):j.matches;De(Ft,"Didn't find any matches after fetcher action");let ws=++k;W.set(A,ws);let Kf=nl(xe,Te.data);j.fetchers.set(A,Kf);let[Ss,Oo]=rw(e.history,j,Ft,xe,Ke,!1,L,B,F,Ee,ie,K,Xn,c,{[J.route.id]:Te.data},void 0);Oo.filter(ht=>ht.key!==A).forEach(ht=>{let $r=ht.key,Ac=j.fetchers.get($r),rk=nl(void 0,Ac?Ac.data:void 0);j.fetchers.set($r,rk),_.has($r)&&jn($r),ht.controller&&_.set($r,ht.controller)}),Ge({fetchers:new Map(j.fetchers)});let ki=()=>Oo.forEach(ht=>jn(ht.key));pe.signal.addEventListener("abort",ki);let{results:Yf,loaderResults:Xf,fetcherResults:Jf}=await be(j.matches,Ft,Ss,Oo,qt);if(pe.signal.aborted)return;pe.signal.removeEventListener("abort",ki),W.delete(A),_.delete(A),Oo.forEach(ht=>_.delete(ht.key));let bs=uw(Yf);if(bs){if(bs.idx>=Ss.length){let ht=Oo[bs.idx-Ss.length].key;K.add(ht)}return ee(j,bs.result)}let{loaderData:_c,errors:Ze}=aw(j,j.matches,Ss,Xf,void 0,Oo,Jf,Ne);if(j.fetchers.has(A)){let ht=$o(Te.data);j.fetchers.set(A,ht)}Ao(ws),j.navigation.state==="loading"&&ws>M?(De(T,"Expected pending action"),R&&R.abort(),Nt(j.navigation.location,{matches:Ft,loaderData:_c,errors:Ze,fetchers:new Map(j.fetchers)})):(Ge({errors:Ze,loaderData:lw(j.loaderData,_c,Ft,Ze),fetchers:new Map(j.fetchers)}),L=!1)}async function to(A,$,H,J,ae,Re,xe){let ye=j.fetchers.get(A);Qe(A,nl(xe,ye?ye.data:void 0),{flushSync:Re});let pe=new AbortController,me=tl(e.history,H,pe.signal);_.set(A,pe);let St=k,Te=await el("loader",me,J,ae,i,o,c,u.v7_relativeSplatPath);if(zi(Te)&&(Te=await _P(Te,me.signal,!0)||Te),_.get(A)===pe&&_.delete(A),!me.signal.aborted){if(Ee.has(A)){Qe(A,$o(void 0));return}if(Bi(Te))if(M>St){Qe(A,$o(void 0));return}else{K.add(A),await ee(j,Te);return}if(Gs(Te)){kt(A,$,Te.error);return}De(!zi(Te),"Unhandled fetcher deferred data"),Qe(A,$o(Te.data))}}async function ee(A,$,H){let{submission:J,fetcherSubmission:ae,replace:Re}=H===void 0?{}:H;$.revalidate&&(L=!0);let xe=Kl(A.location,$.location,{_isRedirect:!0});if(De(xe,"Expected a location on the redirect navigation"),n){let Ke=!1;if($.reloadDocument)Ke=!0;else if(kP.test($.location)){const qt=e.history.createURL($.location);Ke=qt.origin!==t.location.origin||Rc(qt.pathname,c)==null}if(Ke){Re?t.location.replace($.location):t.location.assign($.location);return}}R=null;let ye=Re===!0?Rt.Replace:Rt.Push,{formMethod:pe,formAction:me,formEncType:St}=A.navigation;!J&&!ae&&pe&&me&&St&&(J=fw(A.navigation));let Te=J||ae;if(nU.has($.status)&&Te&&br(Te.formMethod))await Pt(ye,xe,{submission:Et({},Te,{formAction:$.location}),preventScrollReset:P});else{let Ke=Qh(xe,J);await Pt(ye,xe,{overrideNavigation:Ke,fetcherSubmission:ae,preventScrollReset:P})}}async function be(A,$,H,J,ae){let Re=await Promise.all([...H.map(pe=>el("loader",ae,pe,$,i,o,c,u.v7_relativeSplatPath)),...J.map(pe=>pe.matches&&pe.match&&pe.controller?el("loader",tl(e.history,pe.path,pe.controller.signal),pe.match,pe.matches,i,o,c,u.v7_relativeSplatPath):{type:bt.error,error:er(404,{pathname:pe.path})})]),xe=Re.slice(0,H.length),ye=Re.slice(H.length);return await Promise.all([dw(A,H,xe,xe.map(()=>ae.signal),!1,j.loaderData),dw(A,J.map(pe=>pe.match),ye,J.map(pe=>pe.controller?pe.controller.signal:null),!0)]),{results:Re,loaderResults:xe,fetcherResults:ye}}function Je(){L=!0,B.push(...Ht()),ie.forEach((A,$)=>{_.has($)&&(F.push($),jn($))})}function Qe(A,$,H){H===void 0&&(H={}),j.fetchers.set(A,$),Ge({fetchers:new Map(j.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function kt(A,$,H,J){J===void 0&&(J={});let ae=bl(j.matches,$);Yn(A),Ge({errors:{[ae.route.id]:H},fetchers:new Map(j.fetchers)},{flushSync:(J&&J.flushSync)===!0})}function Mr(A){return u.v7_fetcherPersist&&(ve.set(A,(ve.get(A)||0)+1),Ee.has(A)&&Ee.delete(A)),j.fetchers.get(A)||rU}function Yn(A){let $=j.fetchers.get(A);_.has(A)&&!($&&$.state==="loading"&&W.has(A))&&jn(A),ie.delete(A),W.delete(A),K.delete(A),Ee.delete(A),j.fetchers.delete(A)}function Ei(A){if(u.v7_fetcherPersist){let $=(ve.get(A)||0)-1;$<=0?(ve.delete(A),Ee.add(A)):ve.set(A,$)}else Yn(A);Ge({fetchers:new Map(j.fetchers)})}function jn(A){let $=_.get(A);De($,"Expected fetch controller: "+A),$.abort(),_.delete(A)}function Lr(A){for(let $ of A){let H=Mr($),J=$o(H.data);j.fetchers.set($,J)}}function gr(){let A=[],$=!1;for(let H of K){let J=j.fetchers.get(H);De(J,"Expected fetcher: "+H),J.state==="loading"&&(K.delete(H),A.push(H),$=!0)}return Lr(A),$}function Ao(A){let $=[];for(let[H,J]of W)if(J<A){let ae=j.fetchers.get(H);De(ae,"Expected fetcher: "+H),ae.state==="loading"&&(jn(H),W.delete(H),$.push(H))}return Lr($),$.length>0}function Fa(A,$){let H=j.blockers.get(A)||Za;return je.get(A)!==$&&je.set(A,$),H}function xs(A){j.blockers.delete(A),je.delete(A)}function No(A,$){let H=j.blockers.get(A)||Za;De(H.state==="unblocked"&&$.state==="blocked"||H.state==="blocked"&&$.state==="blocked"||H.state==="blocked"&&$.state==="proceeding"||H.state==="blocked"&&$.state==="unblocked"||H.state==="proceeding"&&$.state==="unblocked","Invalid blocker state transition: "+H.state+" -> "+$.state);let J=new Map(j.blockers);J.set(A,$),Ge({blockers:J})}function Ti(A){let{currentLocation:$,nextLocation:H,historyAction:J}=A;if(je.size===0)return;je.size>1&&rs(!1,"A router only supports one blocker at a time");let ae=Array.from(je.entries()),[Re,xe]=ae[ae.length-1],ye=j.blockers.get(Re);if(!(ye&&ye.state==="proceeding")&&xe({currentLocation:$,nextLocation:H,historyAction:J}))return Re}function Ht(A){let $=[];return Ne.forEach((H,J)=>{(!A||A(J))&&(H.cancel(),$.push(J),Ne.delete(J))}),$}function qf(A,$,H){if(h=A,g=$,m=H||null,!y&&j.navigation===Gh){y=!0;let J=Wt(j.location,j.matches);J!=null&&Ge({restoreScrollPosition:J})}return()=>{h=null,g=null,m=null}}function Gf(A,$){return m&&m(A,$.map(J=>_B(J,j.loaderData)))||A.key}function Qf(A,$){if(h&&g){let H=Gf(A,$);h[H]=g()}}function Wt(A,$){if(h){let H=Gf(A,$),J=h[H];if(typeof J=="number")return J}return null}function Pi(A){i={},l=vm(A,o,void 0,i)}return E={get basename(){return c},get future(){return u},get state(){return j},get routes(){return s},get window(){return t},initialize:dt,subscribe:rn,enableScrollRestoration:qf,navigate:Xe,fetch:_o,revalidate:Ot,createHref:A=>e.history.createHref(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:Mr,deleteFetcher:Ei,dispose:ft,getBlocker:Fa,deleteBlocker:xs,_internalFetchControllers:_,_internalActiveDeferreds:Ne,_internalSetRoutes:Pi},E}function sU(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function xm(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=EP(o||".",jP(c,i),Rc(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&&!qv(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:ai([n,d.pathname])),kc(d)}function nw(e,t,n,r){if(!r||!sU(r))return{path:n};if(r.formMethod&&!hU(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=IP(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!br(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[y,C]=g;return""+m+y+"="+C+`
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(!br(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()}}}De(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=wm(r.formData),u=r.formData;else if(r.body instanceof FormData)c=wm(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=sw(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=sw(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(br(d.formMethod))return{path:n,submission:d};let f=Io(n);return t&&f.search&&qv(f.search)&&c.append("index",""),f.search="?"+c,{path:kc(f),submission:d}}function aU(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 rw(e,t,n,r,o,i,s,l,c,u,d,f,h,m,g,y){let C=y?Object.values(y)[0]:g?Object.values(g)[0]:void 0,v=e.createURL(t.location),w=e.createURL(o),x=y?Object.keys(y)[0]:void 0,E=aU(n,x).filter((T,P)=>{let{route:R}=T;if(R.lazy)return!0;if(R.loader==null)return!1;if(i)return R.loader.hydrate?!0:t.loaderData[R.id]===void 0&&(!t.errors||t.errors[R.id]===void 0);if(lU(t.loaderData,t.matches[P],T)||l.some(D=>D===T.route.id))return!0;let I=t.matches[P],O=T;return ow(T,Et({currentUrl:v,currentParams:I.params,nextUrl:w,nextParams:O.params},r,{actionResult:C,defaultShouldRevalidate:s||v.pathname+v.search===w.pathname+w.search||v.search!==w.search||DP(I,O)}))}),j=[];return d.forEach((T,P)=>{if(i||!n.some(N=>N.route.id===T.routeId)||u.has(P))return;let R=qs(h,T.path,m);if(!R){j.push({key:P,routeId:T.routeId,path:T.path,matches:null,match:null,controller:null});return}let I=t.fetchers.get(P),O=Sm(R,T.path),D=!1;f.has(P)?D=!1:c.includes(P)?D=!0:I&&I.state!=="idle"&&I.data===void 0?D=s:D=ow(O,Et({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:w,nextParams:n[n.length-1].params},r,{actionResult:C,defaultShouldRevalidate:s})),D&&j.push({key:P,routeId:T.routeId,path:T.path,matches:R,match:O,controller:new AbortController})}),[E,j]}function lU(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function DP(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function ow(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function iw(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];De(o,"No route found in manifest");let i={};for(let s in r){let c=o[s]!==void 0&&s!=="hasErrorBoundary";rs(!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&&!DB.has(s)&&(i[s]=r[s])}Object.assign(o,i),Object.assign(o,Et({},t(o),{lazy:void 0}))}async function el(e,t,n,r,o,i,s,l,c){c===void 0&&(c={});let u,d,f,h=y=>{let C,v=new Promise((w,x)=>C=x);return f=()=>C(),t.signal.addEventListener("abort",f),Promise.race([y({request:t,params:n.params,context:c.requestContext}),v])};try{let y=n.route[e];if(n.route.lazy)if(y){let C,v=await Promise.all([h(y).catch(w=>{C=w}),iw(n.route,i,o)]);if(C)throw C;d=v[0]}else if(await iw(n.route,i,o),y=n.route[e],y)d=await h(y);else if(e==="action"){let C=new URL(t.url),v=C.pathname+C.search;throw er(405,{method:t.method,pathname:v,routeId:n.route.id})}else return{type:bt.data,data:void 0};else if(y)d=await h(y);else{let C=new URL(t.url),v=C.pathname+C.search;throw er(404,{pathname:v})}De(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(y){u=bt.error,d=y}finally{f&&t.signal.removeEventListener("abort",f)}if(fU(d)){let y=d.status;if(tU.has(y)){let v=d.headers.get("Location");if(De(v,"Redirects returned/thrown from loaders/actions must have a Location header"),!kP.test(v))v=xm(new URL(t.url),r.slice(0,r.indexOf(n)+1),s,!0,v,l);else if(!c.isStaticRequest){let w=new URL(t.url),x=v.startsWith("//")?new URL(w.protocol+v):new URL(v),S=Rc(x.pathname,s)!=null;x.origin===w.origin&&S&&(v=x.pathname+x.search+x.hash)}if(c.isStaticRequest)throw d.headers.set("Location",v),d;return{type:bt.redirect,status:y,location:v,revalidate:d.headers.get("X-Remix-Revalidate")!==null,reloadDocument:d.headers.get("X-Remix-Reload-Document")!==null}}if(c.isRouteRequest)throw{type:u===bt.error?bt.error:bt.data,response:d};let C;try{let v=d.headers.get("Content-Type");v&&/\bapplication\/json\b/.test(v)?d.body==null?C=null:C=await d.json():C=await d.text()}catch(v){return{type:bt.error,error:v}}return u===bt.error?{type:u,error:new Wv(y,d.statusText,C),headers:d.headers}:{type:bt.data,data:C,statusCode:d.status,headers:d.headers}}if(u===bt.error)return{type:u,error:d};if(dU(d)){var m,g;return{type:bt.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:bt.data,data:d}}function tl(e,t,n,r){let o=e.createURL(IP(t)).toString(),i={signal:n};if(r&&br(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=wm(r.formData):i.body=r.formData}return new Request(o,i)}function wm(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function sw(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function cU(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(De(!Bi(d),"Cannot handle redirect results in processLoaderData"),Gs(d)){let m=bl(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=TP(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 aw(e,t,n,r,o,i,s,l){let{loaderData:c,errors:u}=cU(t,n,r,o,l);for(let d=0;d<i.length;d++){let{key:f,match:h,controller:m}=i[d];De(s!==void 0&&s[d]!==void 0,"Did not find corresponding fetcher result");let g=s[d];if(!(m&&m.signal.aborted))if(Gs(g)){let y=bl(e.matches,h==null?void 0:h.route.id);u&&u[y.route.id]||(u=Et({},u,{[y.route.id]:g.error})),e.fetchers.delete(f)}else if(Bi(g))De(!1,"Unhandled fetcher revalidation redirect");else if(zi(g))De(!1,"Unhandled fetcher deferred data");else{let y=$o(g.data);e.fetchers.set(f,y)}}return{loaderData:c,errors:u}}function lw(e,t,n,r){let o=Et({},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 bl(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 cw(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 Wv(e||500,s,new Error(l),!0)}function uw(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Bi(n))return{result:n,idx:t}}}function IP(e){let t=typeof e=="string"?Io(e):e;return kc(Et({},t,{hash:""}))}function uU(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===bt.deferred}function Gs(e){return e.type===bt.error}function Bi(e){return(e&&e.type)===bt.redirect}function dU(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 fU(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function hU(e){return eU.has(e.toLowerCase())}function br(e){return JB.has(e.toLowerCase())}async function dw(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&&!DP(u,c)&&(i&&i[c.route.id])!==void 0;if(zi(l)&&(o||d)){let f=r[s];De(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await _P(l,f,o).then(h=>{h&&(n[s]=h||n[s])})}}}async function _P(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:bt.data,data:e.deferredData.unwrappedData}}catch(o){return{type:bt.error,error:o}}return{type:bt.data,data:e.deferredData.data}}}function qv(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Sm(e,t){let n=typeof t=="string"?Io(t).search:t.search;if(e[e.length-1].route.index&&qv(n||""))return e[e.length-1];let r=CP(e);return r[r.length-1]}function fw(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 Qh(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 pU(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 nl(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 mU(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 $o(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 gU(e,t){try{let n=e.sessionStorage.getItem(RP);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 yU(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(RP,JSON.stringify(n))}catch(r){rs(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
207
- * React Router v6.21.2
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 Yl(){return Yl=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},Yl.apply(this,arguments)}const Ff=p.createContext(null),AP=p.createContext(null),zf=p.createContext(null),Bf=p.createContext(null),Si=p.createContext({outlet:null,matches:[],isDataRoute:!1}),NP=p.createContext(null);function Uf(){return p.useContext(Bf)!=null}function bi(){return Uf()||De(!1),p.useContext(Bf).location}function OP(e){p.useContext(zf).static||p.useLayoutEffect(e)}function Tt(){let{isDataRoute:e}=p.useContext(Si);return e?IU():vU()}function vU(){Uf()||De(!1);let e=p.useContext(Ff),{basename:t,future:n,navigator:r}=p.useContext(zf),{matches:o}=p.useContext(Si),{pathname:i}=bi(),s=JSON.stringify(jP(o,n.v7_relativeSplatPath)),l=p.useRef(!1);return OP(()=>{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=EP(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ai([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,s,i,e])}const xU=p.createContext(null);function wU(e){let t=p.useContext(Si).outlet;return t&&p.createElement(xU.Provider,{value:e},t)}function qe(){let{matches:e}=p.useContext(Si),t=e[e.length-1];return t?t.params:{}}function SU(e,t){return MP(e,t)}function MP(e,t,n,r){Uf()||De(!1);let{navigator:o}=p.useContext(zf),{matches:i}=p.useContext(Si),s=i[i.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=bi(),d;if(t){var f;let C=typeof t=="string"?Io(t):t;c==="/"||(f=C.pathname)!=null&&f.startsWith(c)||De(!1),d=C}else d=u;let h=d.pathname||"/",m=c==="/"?h:h.slice(c.length)||"/",g=qs(e,{pathname:m}),y=TU(g&&g.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:ai([c,o.encodeLocation?o.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:ai([c,o.encodeLocation?o.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),i,n,r);return t&&y?p.createElement(Bf.Provider,{value:{location:Yl({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Rt.Pop}},y):y}function bU(){let e=DU(),t=TP(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 CU=p.createElement(bU,null);class jU 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(Si.Provider,{value:this.props.routeContext},p.createElement(NP.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function EU(e){let{routeContext:t,match:n,children:r}=e,o=p.useContext(Ff);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(Si.Provider,{value:t},r)}function TU(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||De(!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,y=null,C=null;n&&(m=l&&f.route.id?l[f.route.id]:void 0,y=f.route.errorElement||CU,c&&(u<0&&h===0?(_U("route-fallback",!1),g=!0,C=null):u===h&&(g=!0,C=f.route.hydrateFallbackElement||null)));let v=t.concat(s.slice(0,h+1)),w=()=>{let x;return m?x=y:g?x=C:f.route.Component?x=p.createElement(f.route.Component,null):f.route.element?x=f.route.element:x=d,p.createElement(EU,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:x})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?p.createElement(jU,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:w(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):w()},null)}var LP=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(LP||{}),yd=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}(yd||{});function PU(e){let t=p.useContext(Ff);return t||De(!1),t}function kU(e){let t=p.useContext(AP);return t||De(!1),t}function RU(e){let t=p.useContext(Si);return t||De(!1),t}function $P(e){let t=RU(),n=t.matches[t.matches.length-1];return n.route.id||De(!1),n.route.id}function DU(){var e;let t=p.useContext(NP),n=kU(yd.UseRouteError),r=$P(yd.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function IU(){let{router:e}=PU(LP.UseNavigateStable),t=$P(yd.UseNavigateStable),n=p.useRef(!1);return OP(()=>{n.current=!0}),p.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Yl({fromRouteId:t},i)))},[e,t])}const hw={};function _U(e,t,n){!t&&!hw[e]&&(hw[e]=!0)}function Gv(e){return wU(e.context)}function de(e){De(!1)}function AU(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Rt.Pop,navigator:i,static:s=!1,future:l}=e;Uf()&&De(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:i,static:s,future:Yl({v7_relativeSplatPath:!1},l)}),[c,l,i,s]);typeof r=="string"&&(r=Io(r));let{pathname:d="/",search:f="",hash:h="",state:m=null,key:g="default"}=r,y=p.useMemo(()=>{let C=Rc(d,c);return C==null?null:{location:{pathname:C,search:f,hash:h,state:m,key:g},navigationType:o}},[c,d,f,h,m,g,o]);return y==null?null:p.createElement(zf.Provider,{value:u},p.createElement(Bf.Provider,{children:n,value:y}))}function NU(e){let{children:t,location:n}=e;return SU(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&&De(!1),!r.props.index||!r.props.children||De(!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 OU(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.21.2
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 vd(){return vd=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},vd.apply(this,arguments)}function Cm(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 MU(e,t){let n=Cm(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}function LU(e,t){return iU({basename:t==null?void 0:t.basename,future:vd({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:PB({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||$U(),routes:e,mapRouteProperties:OU,window:t==null?void 0:t.window}).initialize()}function $U(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=vd({},t,{errors:FU(t.errors)})),t}function FU(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 Wv(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 zU=p.createContext({isTransitioning:!1}),BU=p.createContext(new Map),UU="startTransition",pw=Am[UU],VU="flushSync",mw=MI[VU];function HU(e){pw?pw(e):e()}function rl(e){mw?mw(e):e()}class WU{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 qU(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,y]=p.useState(),C=p.useRef(new Map),{v7_startTransition:v}=r||{},w=p.useCallback(T=>{v?HU(T):T()},[v]),x=p.useCallback((T,P)=>{let{deletedFetchers:R,unstable_flushSync:I,unstable_viewTransitionOpts:O}=P;R.forEach(N=>C.current.delete(N)),T.fetchers.forEach((N,L)=>{N.data!==void 0&&C.current.set(L,N.data)});let D=n.window==null||typeof n.window.document.startViewTransition!="function";if(!O||D){I?rl(()=>i(T)):w(()=>i(T));return}if(I){rl(()=>{h&&(d&&d.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let N=n.window.document.startViewTransition(()=>{rl(()=>i(T))});N.finished.finally(()=>{rl(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})})}),rl(()=>m(N));return}h?(d&&d.resolve(),h.skipTransition(),y({state:T,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(l(T),u({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[n.window,h,d,C,w]);p.useLayoutEffect(()=>n.subscribe(x),[n,x]),p.useEffect(()=>{c.isTransitioning&&!c.flushSync&&f(new WU)},[c]),p.useEffect(()=>{if(d&&s&&n.window){let T=s,P=d.promise,R=n.window.document.startViewTransition(async()=>{w(()=>i(T)),await P});R.finished.finally(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})}),m(R)}},[w,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}),y(void 0))},[c.isTransitioning,g]),p.useEffect(()=>{},[]);let S=p.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:T=>n.navigate(T),push:(T,P,R)=>n.navigate(T,{state:P,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(T,P,R)=>n.navigate(T,{replace:!0,state:P,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[n]),E=n.basename||"/",j=p.useMemo(()=>({router:n,navigator:S,static:!1,basename:E}),[n,S,E]);return p.createElement(p.Fragment,null,p.createElement(Ff.Provider,{value:j},p.createElement(AP.Provider,{value:o},p.createElement(BU.Provider,{value:C.current},p.createElement(zU.Provider,{value:c},p.createElement(AU,{basename:E,location:o.location,navigationType:o.historyAction,navigator:S,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?p.createElement(GU,{routes:n.routes,future:n.future,state:o}):t))))),null)}function GU(e){let{routes:t,future:n,state:r}=e;return MP(t,void 0,r,n)}var gw;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(gw||(gw={}));var yw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(yw||(yw={}));function Qv(e){let t=p.useRef(Cm(e)),n=p.useRef(!1),r=bi(),o=p.useMemo(()=>MU(r.search,n.current?null:t.current),[r.search]),i=Tt(),s=p.useCallback((l,c)=>{const u=Cm(typeof l=="function"?l(o):l);n.current=!0,i("?"+u,c)},[i,o]);return[o,s]}const QU=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 Dc(e,t){const n=KU(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 KU(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),o=QU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var La=(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 YU=[".DS_Store","Thumbs.db"];function XU(e){return La(this,null,function*(){return xd(e)&&JU(e.dataTransfer)?nV(e.dataTransfer,e.type):ZU(e)?eV(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?tV(e):[]})}function JU(e){return xd(e)}function ZU(e){return xd(e)&&xd(e.target)}function xd(e){return typeof e=="object"&&e!==null}function eV(e){return jm(e.target.files).map(t=>Dc(t))}function tV(e){return La(this,null,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Dc(n))})}function nV(e,t){return La(this,null,function*(){if(e.items){const n=jm(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(rV));return vw(FP(r))}return vw(jm(e.files).map(n=>Dc(n)))})}function vw(e){return e.filter(t=>YU.indexOf(t.name)===-1)}function jm(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 rV(e){if(typeof e.webkitGetAsEntry!="function")return xw(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?zP(t):xw(e)}function FP(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?FP(n):[n]],[])}function xw(e){const t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);const n=Dc(t);return Promise.resolve(n)}function oV(e){return La(this,null,function*(){return e.isDirectory?zP(e):iV(e)})}function zP(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function i(){t.readEntries(s=>La(this,null,function*(){if(s.length){const l=Promise.all(s.map(oV));o.push(l),i()}else try{const l=yield Promise.all(o);n(l)}catch(l){r(l)}}),s=>{r(s)})}i()})}function iV(e){return La(this,null,function*(){return new Promise((t,n)=>{e.file(r=>{const o=Dc(r,e.fullPath);t(o)},r=>{n(r)})})})}function sV(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 aV=Object.defineProperty,lV=Object.defineProperties,cV=Object.getOwnPropertyDescriptors,ww=Object.getOwnPropertySymbols,uV=Object.prototype.hasOwnProperty,dV=Object.prototype.propertyIsEnumerable,Sw=(e,t,n)=>t in e?aV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fV=(e,t)=>{for(var n in t||(t={}))uV.call(t,n)&&Sw(e,n,t[n]);if(ww)for(var n of ww(t))dV.call(t,n)&&Sw(e,n,t[n]);return e},hV=(e,t)=>lV(e,cV(t));const pV="file-invalid-type",mV="file-too-large",gV="file-too-small",yV="too-many-files",vV=e=>{e=Array.isArray(e)&&e.length===1?e[0]:e;const t=Array.isArray(e)?`one of ${e.join(", ")}`:e;return{code:pV,message:`File type must be ${t}`}},bw=e=>({code:mV,message:`File is larger than ${e} ${e===1?"byte":"bytes"}`}),Cw=e=>({code:gV,message:`File is smaller than ${e} ${e===1?"byte":"bytes"}`}),xV={code:yV,message:"Too many files"};function BP(e,t){const n=e.type==="application/x-moz-file"||sV(e,t);return[n,n?null:vV(t)]}function UP(e,t,n){if(Oi(e.size))if(Oi(t)&&Oi(n)){if(e.size>n)return[!1,bw(n)];if(e.size<t)return[!1,Cw(t)]}else{if(Oi(t)&&e.size<t)return[!1,Cw(t)];if(Oi(n)&&e.size>n)return[!1,bw(n)]}return[!0,null]}function Oi(e){return e!=null}function wV({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]=BP(l,t),[u]=UP(l,n,r),d=s?s(l):null;return c&&u&&!d})}function wd(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function au(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 jw(e){e.preventDefault()}function SV(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function bV(e){return e.indexOf("Edge/")!==-1}function CV(e=window.navigator.userAgent){return SV(e)||bV(e)}function Br(...e){return(t,...n)=>e.some(r=>(!wd(t)&&r&&r(t,...n),wd(t)))}function jV(){return"showOpenFilePicker"in window}function EV(e){return Oi(e)?[{description:"Files",accept:Object.entries(e).filter(([n,r])=>{let o=!0;return VP(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(HP))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),o=!1),o}).reduce((n,[r,o])=>hV(fV({},n),{[r]:o}),{})}]:e}function TV(e){if(Oi(e))return Object.entries(e).reduce((t,[n,r])=>[...t,n,...r],[]).filter(t=>VP(t)||HP(t)).join(",")}function PV(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function kV(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function VP(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function HP(e){return/^.*\.[\w]+$/.test(e)}var RV=Object.defineProperty,DV=Object.defineProperties,IV=Object.getOwnPropertyDescriptors,Sd=Object.getOwnPropertySymbols,WP=Object.prototype.hasOwnProperty,qP=Object.prototype.propertyIsEnumerable,Ew=(e,t,n)=>t in e?RV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hn=(e,t)=>{for(var n in t||(t={}))WP.call(t,n)&&Ew(e,n,t[n]);if(Sd)for(var n of Sd(t))qP.call(t,n)&&Ew(e,n,t[n]);return e},Vo=(e,t)=>DV(e,IV(t)),bd=(e,t)=>{var n={};for(var r in e)WP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sd)for(var r of Sd(e))t.indexOf(r)<0&&qP.call(e,r)&&(n[r]=e[r]);return n};const Kv=p.forwardRef((e,t)=>{var n=e,{children:r}=n,o=bd(n,["children"]);const i=QP(o),{open:s}=i,l=bd(i,["open"]);return p.useImperativeHandle(t,()=>({open:s}),[s]),b.createElement(p.Fragment,null,r(Vo(hn({},l),{open:s})))});Kv.displayName="Dropzone";const GP={disabled:!1,getFilesFromEvent:XU,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};Kv.defaultProps=GP;Kv.propTypes={children:Me.func,accept:Me.objectOf(Me.arrayOf(Me.string)),multiple:Me.bool,preventDropOnDocument:Me.bool,noClick:Me.bool,noKeyboard:Me.bool,noDrag:Me.bool,noDragEventsBubbling:Me.bool,minSize:Me.number,maxSize:Me.number,maxFiles:Me.number,disabled:Me.bool,getFilesFromEvent:Me.func,onFileDialogCancel:Me.func,onFileDialogOpen:Me.func,useFsAccessApi:Me.bool,autoFocus:Me.bool,onDragEnter:Me.func,onDragLeave:Me.func,onDragOver:Me.func,onDrop:Me.func,onDropAccepted:Me.func,onDropRejected:Me.func,onError:Me.func,validator:Me.func};const Em={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function QP(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:y,useFsAccessApi:C,autoFocus:v,preventDropOnDocument:w,noClick:x,noKeyboard:S,noDrag:E,noDragEventsBubbling:j,onError:T,validator:P}=hn(hn({},GP),e),R=p.useMemo(()=>TV(t),[t]),I=p.useMemo(()=>EV(t),[t]),O=p.useMemo(()=>typeof y=="function"?y:Tw,[y]),D=p.useMemo(()=>typeof g=="function"?g:Tw,[g]),N=p.useRef(null),L=p.useRef(null),[B,F]=p.useReducer(_V,Em),{isFocused:_,isFileDialogActive:k}=B,M=p.useRef(typeof window<"u"&&window.isSecureContext&&C&&jV()),W=()=>{!M.current&&k&&setTimeout(()=>{if(L.current){const{files:ee}=L.current;ee.length||(F({type:"closeDialog"}),D())}},300)};p.useEffect(()=>(window.addEventListener("focus",W,!1),()=>{window.removeEventListener("focus",W,!1)}),[L,k,D,M]);const K=p.useRef([]),ie=ee=>{N.current&&N.current.contains(ee.target)||(ee.preventDefault(),K.current=[])};p.useEffect(()=>(w&&(document.addEventListener("dragover",jw,!1),document.addEventListener("drop",ie,!1)),()=>{w&&(document.removeEventListener("dragover",jw),document.removeEventListener("drop",ie))}),[N,w]),p.useEffect(()=>(!n&&v&&N.current&&N.current.focus(),()=>{}),[N,v,n]);const ve=p.useCallback(ee=>{T?T(ee):console.error(ee)},[T]),Ee=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Kn(ee),K.current=[...K.current,ee.target],au(ee)&&Promise.resolve(r(ee)).then(be=>{if(wd(ee)&&!j)return;const Je=be.length,Qe=Je>0&&wV({files:be,accept:R,minSize:i,maxSize:o,multiple:s,maxFiles:l,validator:P}),kt=Je>0&&!Qe;F({isDragAccept:Qe,isDragReject:kt,isDragActive:!0,type:"setDraggedFiles"}),c&&c(ee)}).catch(be=>ve(be))},[r,c,ve,j,R,i,o,s,l,P]),Ne=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Kn(ee);const be=au(ee);if(be&&ee.dataTransfer)try{ee.dataTransfer.dropEffect="copy"}catch{}return be&&d&&d(ee),!1},[d,j]),je=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Kn(ee);const be=K.current.filter(Qe=>N.current&&N.current.contains(Qe)),Je=be.indexOf(ee.target);Je!==-1&&be.splice(Je,1),K.current=be,!(be.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),au(ee)&&u&&u(ee))},[N,u,j]),Ue=p.useCallback((ee,be)=>{const Je=[],Qe=[];ee.forEach(kt=>{const[Mr,Yn]=BP(kt,R),[Ei,jn]=UP(kt,i,o),Lr=P?P(kt):null;if(Mr&&Ei&&!Lr)Je.push(kt);else{let gr=[Yn,jn];Lr&&(gr=gr.concat(Lr)),Qe.push({file:kt,errors:gr.filter(Ao=>Ao)})}}),(!s&&Je.length>1||s&&l>=1&&Je.length>l)&&(Je.forEach(kt=>{Qe.push({file:kt,errors:[xV]})}),Je.splice(0)),F({acceptedFiles:Je,fileRejections:Qe,type:"setFiles"}),f&&f(Je,Qe,be),Qe.length>0&&m&&m(Qe,be),Je.length>0&&h&&h(Je,be)},[F,s,R,i,o,l,f,h,m,P]),dt=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Kn(ee),K.current=[],au(ee)&&Promise.resolve(r(ee)).then(be=>{wd(ee)&&!j||Ue(be,ee)}).catch(be=>ve(be)),F({type:"reset"})},[r,Ue,ve,j]),ft=p.useCallback(()=>{if(M.current){F({type:"openDialog"}),O();const ee={multiple:s,types:I};window.showOpenFilePicker(ee).then(be=>r(be)).then(be=>{Ue(be,null),F({type:"closeDialog"})}).catch(be=>{PV(be)?(D(be),F({type:"closeDialog"})):kV(be)?(M.current=!1,L.current?(L.current.value=null,L.current.click()):ve(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."))):ve(be)});return}L.current&&(F({type:"openDialog"}),O(),L.current.value=null,L.current.click())},[F,O,D,C,Ue,ve,I,s]),rn=p.useCallback(ee=>{!N.current||!N.current.isEqualNode(ee.target)||(ee.key===" "||ee.key==="Enter"||ee.keyCode===32||ee.keyCode===13)&&(ee.preventDefault(),ft())},[N,ft]),Ge=p.useCallback(()=>{F({type:"focus"})},[]),Nt=p.useCallback(()=>{F({type:"blur"})},[]),Xe=p.useCallback(()=>{x||(CV()?setTimeout(ft,0):ft())},[x,ft]),Ot=ee=>n?null:ee,Pt=ee=>S?null:Ot(ee),mr=ee=>E?null:Ot(ee),Kn=ee=>{j&&ee.stopPropagation()},_o=p.useMemo(()=>(ee={})=>{var be=ee,{refKey:Je="ref",role:Qe,onKeyDown:kt,onFocus:Mr,onBlur:Yn,onClick:Ei,onDragEnter:jn,onDragOver:Lr,onDragLeave:gr,onDrop:Ao}=be,Fa=bd(be,["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"]);return hn(hn({onKeyDown:Pt(Br(kt,rn)),onFocus:Pt(Br(Mr,Ge)),onBlur:Pt(Br(Yn,Nt)),onClick:Ot(Br(Ei,Xe)),onDragEnter:mr(Br(jn,Ee)),onDragOver:mr(Br(Lr,Ne)),onDragLeave:mr(Br(gr,je)),onDrop:mr(Br(Ao,dt)),role:typeof Qe=="string"&&Qe!==""?Qe:"presentation",[Je]:N},!n&&!S?{tabIndex:0}:{}),Fa)},[N,rn,Ge,Nt,Xe,Ee,Ne,je,dt,S,E,n]),$t=p.useCallback(ee=>{ee.stopPropagation()},[]),to=p.useMemo(()=>(ee={})=>{var be=ee,{refKey:Je="ref",onChange:Qe,onClick:kt}=be,Mr=bd(be,["refKey","onChange","onClick"]);const Yn={accept:R,multiple:s,type:"file",style:{display:"none"},onChange:Ot(Br(Qe,dt)),onClick:Ot(Br(kt,$t)),tabIndex:-1,[Je]:L};return hn(hn({},Yn),Mr)},[L,t,s,dt,n]);return Vo(hn({},B),{isFocused:_&&!n,getRootProps:_o,getInputProps:to,rootRef:N,inputRef:L,open:Ot(ft)})}function _V(e,t){switch(t.type){case"focus":return Vo(hn({},e),{isFocused:!0});case"blur":return Vo(hn({},e),{isFocused:!1});case"openDialog":return Vo(hn({},Em),{isFileDialogActive:!0});case"closeDialog":return Vo(hn({},e),{isFileDialogActive:!1});case"setDraggedFiles":return Vo(hn({},e),{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Vo(hn({},e),{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return hn({},Em);default:return e}}function Tw(){}const[AV,NV]=Sn("Dropzone component was not found in tree");function Yv(e){const t=n=>{const{children:r,...o}=V(`Dropzone${c0(e)}`,{},n),i=NV(),s=bo(r)?r:b.createElement("span",null,r);return i[e]?p.cloneElement(s,o):null};return t.displayName=`@mantine/dropzone/${c0(e)}`,t}const OV=Yv("accept"),MV=Yv("reject"),LV=Yv("idle");var Xl={root:"m-d46a4834",inner:"m-b85f7144",fullScreen:"m-96f6e9ad",dropzone:"m-7946116d"};const $V={loading:!1,multiple:!0,maxSize:1/0,autoFocus:!1,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},FV=(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":ut(t),"--dropzone-accept-color":i.color,"--dropzone-accept-bg":i.background,"--dropzone-reject-color":s.color,"--dropzone-reject-bg":s.background}}},Ci=G((e,t)=>{const n=V("Dropzone",$V,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:y,onDropAny:C,onDrop:v,onReject:w,openRef:x,name:S,maxFiles:E,autoFocus:j,activateOnClick:T,activateOnDrag:P,dragEventsBubbling:R,activateOnKeyboard:I,onDragEnter:O,onDragLeave:D,onDragOver:N,onFileDialogCancel:L,onFileDialogOpen:B,preventDropOnDocument:F,useFsAccessApi:_,getFilesFromEvent:k,validator:M,rejectColor:W,acceptColor:K,enablePointerEvents:ie,loaderProps:ve,...Ee}=n,Ne=ue({name:"Dropzone",classes:Xl,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:FV}),{getRootProps:je,getInputProps:Ue,isDragAccept:dt,isDragReject:ft,open:rn}=QP({onDrop:C,onDropAccepted:v,onDropRejected:w,disabled:d||f,accept:Array.isArray(g)?g.reduce((Nt,Xe)=>({...Nt,[Xe]:[]}),{}):g,multiple:h,maxSize:m,maxFiles:E,autoFocus:j,noClick:!T,noDrag:!P,noDragEventsBubbling:!R,noKeyboard:!I,onDragEnter:O,onDragLeave:D,onDragOver:N,onFileDialogCancel:L,onFileDialogOpen:B,preventDropOnDocument:F,useFsAccessApi:_,validator:M,...k?{getFilesFromEvent:k}:null});$m(x,rn);const Ge=!dt&&!ft;return b.createElement(AV,{value:{accept:dt,reject:ft,idle:Ge}},b.createElement(q,{...je({ref:t}),...Ne("root",{focusable:!0}),...Ee,mod:{accept:dt,reject:ft,idle:Ge,loading:f,"activate-on-click":T}},b.createElement(Ty,{visible:f,overlayProps:{radius:u},unstyled:l,loaderProps:ve}),b.createElement("input",{...Ue(),name:S}),b.createElement("div",{...Ne("inner"),"data-enable-pointer-events":ie||void 0},y)))});Ci.classes=Xl;Ci.displayName="@mantine/dropzone/Dropzone";Ci.Accept=OV;Ci.Idle=LV;Ci.Reject=MV;const zV={loading:!1,maxSize:1/0,activateOnClick:!1,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:_r("max"),withinPortal:!0},Xv=G((e,t)=>{const n=V("DropzoneFullScreen",zV,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,...y}=n,C=ue({name:"DropzoneFullScreen",classes:Xl,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"fullScreen"}),{resolvedClassNames:v,resolvedStyles:w}=Rd({classNames:r,styles:s,props:n}),[x,S]=p.useState(0),[E,{open:j,close:T}]=M2(!1),P=I=>{var O;(O=I.dataTransfer)!=null&&O.types.includes("Files")&&(S(D=>D+1),j())},R=()=>{S(I=>I-1)};return p.useEffect(()=>{x===0&&T()},[x]),p.useEffect(()=>{if(u)return document.addEventListener("dragenter",P,!1),document.addEventListener("dragleave",R,!1),()=>{document.removeEventListener("dragenter",P,!1),document.removeEventListener("dragleave",R,!1)}},[u]),b.createElement(ls,{...g,withinPortal:m},b.createElement(q,{...C("fullScreen",{style:{opacity:E?1:0,pointerEvents:E?"all":"none",zIndex:h}}),ref:t},b.createElement(Ci,{...y,classNames:v,styles:w,unstyled:l,className:Xl.dropzone,onDrop:I=>{d==null||d(I),T(),S(0)},onReject:I=>{f==null||f(I),T(),S(0)}})))});Xv.classes=Xl;Xv.displayName="@mantine/dropzone/DropzoneFullScreen";Ci.FullScreen=Xv;const lu=Ci,BV='{"resourceType": "Bundle"}';function Kh({id:e,title:t,message:n,color:r,icon:o,withCloseButton:i=!1,method:s="show",loading:l}){Kr[s]({id:e,loading:l,title:t,message:n,color:r,icon:o,withCloseButton:i,autoClose:!1})}function UV(){const e=_t(),t=te(),[n,r]=p.useState({}),o=p.useCallback(async(l,c)=>{const u="batch-upload";Kh({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=YE(d));const f=await t.executeBatch(d);r(h=>({...h,[c]:f})),Kh({id:u,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(Rf,{size:"1rem"}),withCloseButton:!0})}catch(d){Kh({id:u,title:"Batch Upload Failed",color:"red",message:ke(d),method:"update",icon:a.jsx(pd,{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(we,{children:[a.jsx(le,{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(ze,{defaultValue:"upload",children:[a.jsxs(ze.List,{children:[a.jsx(ze.Tab,{value:"upload",children:"File Upload"}),a.jsx(ze.Tab,{value:"json",children:"JSON"})]}),a.jsx(ze.Panel,{value:"upload",pt:"xs",children:a.jsx(lu,{onDrop:i,accept:["application/json"],children:a.jsxs(Y,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(lu.Accept,{children:a.jsx(A1,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(lu.Reject,{children:a.jsx(pd,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(lu.Idle,{children:a.jsx(A1,{size:50,stroke:1.5})}),a.jsxs("div",{children:[a.jsx(se,{size:"xl",inline:!0,children:"Drag files here or click to select files"}),a.jsx(se,{size:"sm",color:"dimmed",inline:!0,mt:7,children:"Attach as many files as you like"})]})]})})}),a.jsx(ze.Panel,{value:"json",pt:"xs",children:a.jsxs(Le,{onSubmit:s,children:[a.jsx(hs,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:BV,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Submit"})})]})})]})]}),Object.keys(n).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Output"}),a.jsxs(ze,{defaultValue:Object.keys(n)[0],children:[a.jsx(ze.List,{children:Object.keys(n).map(l=>a.jsx(ze.Tab,{value:l,children:l},l))}),Object.keys(n).map(l=>a.jsx(ze.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(Z,{onClick:()=>r({}),children:"Start over"})})]})]})}function VV(){const{resourceType:e}=qe(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(o=>!!o),[r]=xa("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(we,{children:[a.jsxs(le,{children:["No apps for ",e]}),a.jsx(Ie,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(we,{children:a.jsx("div",{children:r.map(o=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Ie,{to:`/forms/${o.id}?subject=`+n.map(i=>`${e}/${i}`).join(","),children:o.name})}),a.jsx("p",{children:o.description})]},o.id))})}):a.jsx(Ir,{})}function HV(){const e=te(),[t,n]=p.useState(),[r,o]=p.useState(!1);return a.jsx(we,{width:450,children:a.jsxs(Le,{style:{maxWidth:400},onSubmit:i=>{n(void 0),e.post("auth/changepassword",i).then(()=>o(!0)).catch(s=>n(ot(s)))},children:[a.jsxs(Bt,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Change password"})]}),!r&&a.jsxs(Se,{gap:"xl",mt:"xl",children:[a.jsx(Pr,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:_e(t,"oldPassword")}),a.jsx(Pr,{name:"newPassword",label:"New password",required:!0,error:_e(t,"newPassword")}),a.jsx(Pr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:_e(t,"confirmPassword")}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Change password"})})]}),r&&a.jsx("div",{"data-testid":"success",children:"Password changed successfully"})]})})}const KP=["Form","JSON"],Yh=KP[0].toLowerCase();function WV(){const e=Tt(),{resourceType:t}=qe(),n=window.location.pathname.split("/").pop(),[r,o]=p.useState(n??Yh);function i(s){s||(s=Yh),o(s),e(`/${t}/new/${s}`)}return a.jsxs(a.Fragment,{children:[a.jsxs(_n,{children:[a.jsxs(se,{p:"md",fw:500,children:["New ",t]}),a.jsx(dr,{children:a.jsx(ze,{defaultValue:Yh,value:r,onChange:i,children:a.jsx(ze.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:KP.map(s=>a.jsx(ze.Tab,{value:s.toLowerCase(),px:"md",children:s},s))})})})]}),a.jsx(Gv,{})]})}function qV(){return a.jsx(we,{children:a.jsxs(Se,{children:[a.jsx(le,{order:1,children:"Unexpected Error"}),a.jsx(se,{children:"We're sorry, something went wrong."}),a.jsxs(se,{children:["Please contact ",a.jsx($e,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}const GV="_root_1fbwr_1",QV="_entry_1fbwr_8",KV="_key_1fbwr_13",YV="_value_1fbwr_20",Vf={root:GV,entry:QV,key:KV,value:YV};function Pe(e){return a.jsx(dr,{children:a.jsx("div",{className:Vf.root,children:e.children})})}Pe.Entry=function(t){return a.jsx("div",{className:Vf.entry,children:t.children})};Pe.Key=function(t){return a.jsx("div",{className:Vf.key,children:t.children})};Pe.Value=function(t){return a.jsx("div",{className:Vf.value,children:t.children})};function XV(e){if(e.gender==="male")return"blue";if(e.gender==="female")return"pink"}function YP(e){var n,r;const t=tt(e.patient);return t?a.jsxs(Pe,{children:[a.jsx(pi,{value:t,size:"lg",color:XV(t)}),a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Name"}),a.jsx(Pe.Value,{children:a.jsx(Ie,{to:t,fw:500,children:t.name?a.jsx(wv,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"DoB"}),a.jsx(Pe.Value,{children:t.birthDate})]}),a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Age"}),a.jsx(Pe.Value,{children:U5(t.birthDate)})]})]}),t.gender&&a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Gender"}),a.jsx(Pe.Value,{children:t.gender})]}),t.address&&a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"State"}),a.jsx(Pe.Value,{children:(n=t.address[0])==null?void 0:n.state})]}),(r=t.identifier)==null?void 0:r.map(o=>a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:o==null?void 0:o.system}),a.jsx(Pe.Value,{children:o==null?void 0:o.value})]},`${o==null?void 0:o.system}-${o==null?void 0:o.value}`))]}):null}function XP(e){const t=tt(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx(Ie,{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=vo(t);return s!==at(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(Pe,{children:n.map(l=>a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:l.key}),a.jsx(Pe.Value,{children:l.value})]},`${l.key}-${l.value}`))})}function Jv(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function JV(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 Ru(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 ji(e){var t;return Jy((t=e.getActiveLogin())==null?void 0:t.project)}function ZV(e,t){const n=new Blob([e],{type:Qt.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 eH(){const{id:e}=qe(),t=bi(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,o=te(),[i,s]=p.useState(!0),[l,c]=p.useState(),[u,d]=p.useState(),[f,h]=p.useState(),[m,g]=p.useState(),[y,C]=p.useState();if(p.useEffect(()=>{const x={resourceType:"Bundle",type:"batch",entry:[{request:{method:"GET",url:`Questionnaire/${e}`}}]};if(r){const S=r.split(",").filter(E=>!!E);S.length===1&&x.entry.push({request:{method:"GET",url:S[0]}}),d(S)}o.executeBatch(x).then(S=>{var E,j,T,P,R,I,O,D;((T=(j=(E=S.entry)==null?void 0:E[0])==null?void 0:j.response)==null?void 0:T.status)!=="200"?g((I=(R=(P=S.entry)==null?void 0:P[0])==null?void 0:R.response)==null?void 0:I.outcome):(c((O=S.entry[0])==null?void 0:O.resource),h((D=S.entry[1])==null?void 0:D.resource)),s(!1)}).catch(S=>{g(S),s(!1)})},[o,e,r]),m)return a.jsx(we,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)})});if(y)return a.jsxs(we,{children:[a.jsx(le,{children:l==null?void 0:l.title}),a.jsx("p",{children:"Your response has been recorded."}),a.jsxs("ul",{children:[y.length===1&&a.jsx("li",{children:a.jsx(Ie,{to:y[0],children:"Review your answers"})}),y.length>1&&a.jsxs("li",{children:["Review your answers:",a.jsx("ul",{children:y.map(x=>a.jsx("li",{children:a.jsx(Ie,{to:x,children:at(x)})},x.id))})]}),f&&a.jsx("li",{children:a.jsxs(Ie,{to:f,children:["Back to ",vo(f)]})}),a.jsx("li",{children:a.jsx(Ie,{to:"/",children:"Go back home"})})]})]});if(i||!l)return a.jsx(Ir,{});const v=f&&Jv(f);return a.jsxs(a.Fragment,{children:[a.jsxs(_n,{shadow:"xs",radius:0,children:[v&&a.jsx(YP,{patient:v}),f&&f.resourceType!=="Patient"&&a.jsx(XP,{resource:f}),a.jsx(q,{px:"xl",py:"md",children:a.jsxs(se,{children:[vo(l),u&&u.length>1&&a.jsxs(a.Fragment,{children:[" (for ",u.length," resources)"]})]})})]}),a.jsx(we,{children:a.jsx(uP,{questionnaire:l,subject:f&&mt(f),onSubmit:w})})]});async function w(x){const S=[];if(!u||u.length===0)S.push(await o.createResource(x));else for(const E of u)S.push(await o.createResource({...x,subject:{reference:E}}));C(S)}}const tH="_paper_unw9o_1",nH={paper:tH},rH={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function JP(e,t){const n=e.resourceType||oH(t),r=e.fields??iH(n),o=e.filters??(e.resourceType?void 0:sH(n)),i=e.sortRules??aH(n),s=e.offset??0,l=e.count??Sc;return{...e,resourceType:n,fields:r,filters:o,sortRules:i,offset:s,count:l}}function oH(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 iH(e){const t=Zv(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 sH(e){var t;return(t=Zv(e))==null?void 0:t.filters}function aH(e){const t=Zv(e);return t!=null&&t.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function Zv(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function lH(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function cH(e,t){const n={resourceType:e.resourceType,count:1e3,offset:0,filters:e.filters},r=JP(n,t.getUserConfiguration()),o=await t.search(r.resourceType,Hs({...r,total:"accurate",fields:void 0}));return YE(o)}function Pw(){const e=te(),t=Tt(),n=bi(),[r,o]=p.useState();return p.useEffect(()=>{const i=rL(n.pathname+n.search),s=JP(i,e.getUserConfiguration());n.pathname===`/${s.resourceType}`&&n.search===Hs(s)?(lH(s),o(s)):t(`/${s.resourceType}${Hs(s)}`)},[e,t,n]),!(r!=null&&r.resourceType)||!r.fields||r.fields.length===0?a.jsx(Ir,{}):a.jsx(_n,{shadow:"xs",m:"md",p:"xs",className:nH.paper,children:a.jsx(Pc,{checkboxesEnabled:!0,search:r,userConfig:e.getUserConfiguration(),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}${Hs(i.definition)}`)},onNew:()=>{t(rH[r.resourceType]??`/${r.resourceType}/new`)},onExportCsv:()=>{const i=e.fhirUrl(r.resourceType,"$csv")+Hs(r);e.download(i).then(s=>{window.open(window.URL.createObjectURL(s),"_blank")}).catch(s=>ce({color:"red",message:ke(s),autoClose:!1}))},onExportTransactionBundle:async()=>{cH(r,e).then(i=>ZV(JSON.stringify(i,void 0,2))).catch(i=>ce({color:"red",message:ke(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=>ce({color:"red",message:ke(s),autoClose:!1})))},onBulk:i=>{t(`/bulk/${r.resourceType}?ids=${i.join(",")}`)}})})}function uH(){const e=te(),[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=>ce({color:"red",message:ke(l),autoClose:!1}))},[e]);const i=p.useCallback(l=>{e.post("auth/mfa/enroll",l).then(()=>{o(!0),ce({color:"green",message:"Success"})}).catch(c=>ce({color:"red",message:ke(c),autoClose:!1}))},[e]),s=p.useCallback(()=>{e.post("auth/mfa/disable",{}).catch(console.log)},[e]);return r===void 0?null:r?a.jsx(we,{children:a.jsxs(Y,{children:[a.jsx(le,{children:"MFA is enabled"}),a.jsx(Z,{onClick:s,children:"Disable MFA"})]})}):a.jsx(we,{width:400,children:a.jsxs(Le,{onSubmit:i,children:[a.jsx(le,{children:"Multi Factor Auth Setup"}),a.jsx(Bt,{children:a.jsx("img",{src:t})}),a.jsx(oe,{name:"token",label:"Code"}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Enroll"})})]})})}const Tm={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__"};function Ic(){return Tm}function ZP(){try{return Tm.registerEnabled!==!1&&Tm.registerEnabled!=="false"}catch{return!0}}function dH(){const e=Tt(),[t]=Qv(),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(xP,{onCode:o,onForgotPassword:()=>e("/resetpassword"),onRegister:()=>e("/register"),googleClientId:Ic().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(Or,{size:32}),a.jsx(le,{children:"Sign in to Medplum"})]})}function fH(){const e=te(),t=Tt(),n=Ic();return p.useEffect(()=>{e.getProfile()&&t("/signin?project=new")},[e,t]),ZP()?a.jsxs(wB,{type:"project",onSuccess:()=>t("/"),googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Create a new account"})]}):a.jsx(we,{width:450,children:a.jsx(ds,{icon:a.jsx(bc,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function hH(){const e=Tt(),t=te(),[n,r]=p.useState(),[o,i]=p.useState(!1),s=Ic().recaptchaSiteKey;return p.useEffect(()=>{yP(s)},[s]),a.jsx(we,{width:450,children:a.jsxs(Le,{style:{maxWidth:400},onSubmit:async l=>{let c="";c=await vP(s),t.post("auth/resetpassword",{...l,recaptchaToken:c}).then(()=>i(!0)).catch(u=>r(ot(u)))},children:[a.jsxs(Se,{gap:"lg",mb:"xl",align:"center",children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Medplum Password Reset"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(eo,{issues:Af(n,void 0)}),!o&&a.jsxs(a.Fragment,{children:[a.jsx(oe,{name:"email",type:"email",label:"Email",required:!0,autoFocus:!0,error:_e(n,"email")}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx($e,{component:"button",type:"button",color:"dimmed",onClick:()=>e("/register"),size:"xs",children:"Register"}),a.jsx(Z,{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 pH(){var i;const e=Tt(),t=te(),[n,r]=p.useState();p.useEffect(()=>{t.get("auth/me").then(r).catch(s=>ce({color:"red",message:ke(s),autoClose:!1}))},[t]);function o(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>ce({color:"green",message:"Login revoked"})).catch(l=>ce({color:"red",message:ke(l),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(we,{children:[a.jsx(le,{children:"Security"}),a.jsxs(Ev,{children:[a.jsx(ta,{term:"ID",children:a.jsx($e,{href:`/${at(n.profile)}`,children:n.profile.id})}),a.jsx(ta,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(ta,{term:"Name",children:wc((i=n.profile.name)==null?void 0:i[0])})]})]}),a.jsxs(we,{children:[a.jsx(le,{children:"Sessions"}),a.jsxs(he,{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:Mn(s.lastUpdated)}),a.jsx("td",{children:a.jsx($e,{href:"#",onClick:()=>o(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(we,{children:[a.jsx(le,{children:"Password"}),a.jsx(Z,{onClick:()=>e("/changepassword"),children:"Change password"})]}),a.jsxs(we,{children:[a.jsx(le,{children:"Multi Factor Auth"}),a.jsxs("p",{children:["Enrolled: ",n.security.mfaEnrolled.toString()]}),!n.security.mfaEnrolled&&a.jsx(Z,{onClick:()=>e("/mfa"),children:"Enroll"})]})]}):null}function mH(){const{id:e,secret:t}=qe(),n=te(),[r,o]=p.useState(),[i,s]=p.useState(!1),l=Af(r,void 0);return a.jsxs(we,{width:450,children:[a.jsx(eo,{issues:l}),a.jsxs(Le,{style:{maxWidth:400},onSubmit:c=>{if(c.password!==c.confirmPassword){o(si("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(ot(d)))},children:[a.jsxs(Bt,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Set password"})]}),!i&&a.jsxs(Se,{children:[a.jsx(Pr,{name:"password",label:"New password",required:!0,error:_e(r,"password")}),a.jsx(Pr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:_e(r,"confirmPassword")}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Set password"})})]}),i&&a.jsxs("div",{"data-testid":"success",children:["Password set. You can now ",a.jsx(Ie,{to:"/signin",children:"sign in"}),"."]})]})]})}function gH(){const e=gv(),t=Tt(),[n]=Qv(),r=Ic(),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(xP,{onSuccess:()=>o(),onForgotPassword:()=>t("/resetpassword"),onRegister:ZP()?()=>t("/register"):void 0,googleClientId:r.googleClientId,login:n.get("login")||void 0,projectId:n.get("project")||void 0,children:[a.jsx(Or,{size:32}),a.jsx(le,{children:"Sign in to Medplum"}),n.get("project")==="new"&&a.jsx("div",{children:"Sign in again to create a new project"})]})}function yH(){const e=Tt(),t=bi(),[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(EF,{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 Hf(e){const t=te(),n=ji(t),r=Tt(),[o,i]=p.useState({resourceType:"ProjectMembership",filters:[{code:"project",operator:ne.EQUALS,value:"Project/"+n},{code:"profile-type",operator:ne.EQUALS,value:e.resourceType}],fields:e.fields,count:100});return a.jsx(Pc,{search:o,onClick:s=>r(`/admin/members/${s.resource.id}`),onChange:s=>i(s.definition),hideFilters:!0,hideToolbar:!0})}function vH(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Bots"}),a.jsx(Hf,{resourceType:"Bot",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ie,{to:"/admin/bots/new",children:"Create new bot"})})]})}function xH(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Clients"}),a.jsx(Hf,{resourceType:"ClientApplication",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ie,{to:"/admin/clients/new",children:"Create new client"})})]})}function Wf(e){return a.jsx(Oa,{resourceType:"AccessPolicy",name:"accessPolicy",defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{Do(t)?e.onChange(mt(t)):e.onChange(void 0)}})}function wH(){const e=te(),t=ji(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(le,{children:"Create new Bot"}),a.jsxs(Le,{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),ce({color:"green",message:"Bot created"})}).catch(m=>{ce({color:"red",message:ke(m),autoClose:!1}),u(ot(m))})},children:[!d&&a.jsxs(Se,{children:[a.jsx(et,{title:"Name",htmlFor:"name",outcome:c,children:a.jsx(oe,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:h=>r(h.currentTarget.value),error:_e(c,"name")})}),a.jsx(et,{title:"Description",htmlFor:"description",outcome:c,children:a.jsx(oe,{id:"description",name:"description",onChange:h=>i(h.currentTarget.value),error:_e(c,"description")})}),a.jsx(et,{title:"Access Policy",htmlFor:"accessPolicy",outcome:c,children:a.jsx(Wf,{name:"accessPolicy",onChange:l})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Create Bot"})})]}),d&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(se,{children:"Bot created"}),a.jsxs(mn,{children:[a.jsx(mn.Item,{children:a.jsx(Ie,{to:d,children:"Go to new bot"})}),a.jsx(mn.Item,{children:a.jsx(Ie,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function SH(){const e=te(),t=ji(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(le,{children:"Create new Client"}),a.jsxs(Le,{onSubmit:()=>{const g={name:n,description:o,redirectUri:s,accessPolicy:c};e.post("admin/projects/"+t+"/client",g).then(y=>{e.invalidateSearches("ClientApplication"),e.invalidateSearches("ProjectMembership"),m(y),ce({color:"green",message:"Client created"})}).catch(y=>{ce({color:"red",message:ke(y),autoClose:!1}),f(ot(y))})},children:[!h&&a.jsxs(Se,{children:[a.jsx(et,{title:"Name",htmlFor:"name",outcome:d,children:a.jsx(oe,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:g=>r(g.currentTarget.value),error:_e(d,"name")})}),a.jsx(et,{title:"Description",htmlFor:"description",outcome:d,children:a.jsx(oe,{id:"description",name:"description",onChange:g=>i(g.currentTarget.value),error:_e(d,"description")})}),a.jsx(et,{title:"Redirect URI",htmlFor:"redirectUri",outcome:d,children:a.jsx(oe,{id:"redirectUri",name:"redirectUri",onChange:g=>l(g.currentTarget.value),error:_e(d,"redirectUri")})}),a.jsx(et,{title:"Access Policy",htmlFor:"accessPolicy",outcome:d,children:a.jsx(Wf,{name:"accessPolicy",onChange:u})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Create Client"})})]}),h&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(se,{children:"Client created"}),a.jsxs(mn,{children:[a.jsx(mn.Item,{children:a.jsx(Ie,{to:h,children:"Go to new client"})}),a.jsx(mn.Item,{children:a.jsx(Ie,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}function bH(e){return a.jsx(Oa,{resourceType:"UserConfiguration",name:"userConfiguration",defaultValue:e.defaultValue,placeholder:"User Configuration",onChange:t=>{Do(t)?e.onChange(mt(t)):e.onChange(void 0)}})}function CH(){const{membershipId:e}=qe(),t=te(),n=ji(t),r=Tt(),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 y(){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(C=>h(ot(C)))}return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Edit membership"}),a.jsx("h3",{children:a.jsx(na,{value:o.profile,link:!0})}),a.jsxs(Le,{onSubmit:()=>{const C={...o,accessPolicy:i,userConfiguration:l,admin:u};t.post(`admin/projects/${n}/members/${e}`,C).then(()=>g(!0)).catch(v=>h(ot(v)))},children:[!m&&a.jsxs(Se,{children:[a.jsx(et,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(Wf,{name:"accessPolicy",defaultValue:i,onChange:s})}),a.jsx(et,{title:"User Configuration",htmlFor:"userConfiguration",outcome:f,children:a.jsx(bH,{name:"userConfiguration",defaultValue:l,onChange:c})}),a.jsx(et,{title:"Admin",htmlFor:"admin",outcome:f,children:a.jsx(cr,{id:"admin",name:"admin",defaultChecked:u,onChange:C=>d(C.currentTarget.checked)})}),a.jsxs(Y,{justify:"flex-end",mt:"xl",children:[a.jsx(Z,{type:"submit",children:"Save"}),a.jsx(Z,{type:"button",color:"red",variant:"outline",onClick:y,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(Ie,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]})]})]})}function jH(){const e=te(),[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"),bf(g)?s(g):d(g),c(m.sendEmail??!1),ce({color:"green",message:"Invite success"})}).catch(g=>{ce({color:"red",message:ke(g),autoClose:!1}),s(ot(g))})},[e,t,r]);return a.jsxs(Le,{onSubmit:f,children:[!u&&!i&&a.jsxs(Se,{children:[a.jsx(le,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(et,{title:"Project",htmlFor:"project",outcome:i,children:a.jsx(Oa,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(ct,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:_e(i,"resourceType")}),a.jsx(oe,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:_e(i,"firstName")}),a.jsx(oe,{name:"lastName",label:"Last Name",required:!0,error:_e(i,"lastName")}),a.jsx(oe,{name:"email",type:"email",label:"Email",required:!0,error:_e(i,"email")}),a.jsx(et,{title:"Access Policy",htmlFor:"accessPolicy",outcome:i,children:a.jsx(Wf,{name:"accessPolicy",onChange:o})}),a.jsx(cr,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(cr,{name:"isAdmin",label:"Admin"}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{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(Ie,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]}),u&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(se,{children:"User created"}),l&&a.jsx(se,{children:"Email sent"}),a.jsxs(mn,{children:[a.jsx(mn.Item,{children:a.jsx(Ie,{to:u,children:"Go to new membership"})}),a.jsx(mn.Item,{children:a.jsx(Ie,{to:u.profile,children:"Go to new profile"})}),a.jsx(mn.Item,{children:a.jsx(Ie,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function EH(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Patients"}),a.jsx(Hf,{resourceType:"Patient",fields:["user","profile","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ie,{to:"/admin/invite",children:"Invite new patient"})})]})}function kw(){const e=te(),t=ji(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Details"}),a.jsxs(Ev,{children:[a.jsx(ta,{term:"ID",children:n.project.id}),a.jsx(ta,{term:"Name",children:n.project.name})]})]})}const Rw=["Details","Users","Patients","Clients","Bots","Secrets","Sites"];function TH(){const e=Tt(),n=bi().pathname.replace("/admin/","")||Rw[0],r=te(),o=ji(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(_n,{children:[a.jsx(Pe,{children:a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Project"}),a.jsx(Pe.Value,{children:i.project.name})]})}),a.jsx(dr,{children:a.jsx(ze,{value:n.toLowerCase(),onChange:s,children:a.jsx(ze.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Rw.map(l=>a.jsx(ze.Tab,{value:l.toLowerCase(),children:l},l))})})})]}),a.jsx(we,{children:a.jsx(Gv,{})})]})}function PH(){const e=te(),t=ji(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(wi(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(()=>ce({color:"green",message:"Saved"})).catch(console.log)},children:[a.jsx(le,{children:"Project Secrets"}),a.jsx("p",{children:"Use project secrets to store sensitive information such as API keys or other access credentials."}),a.jsx(Ma,{property:ys("Project","secret"),name:"secret",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(Z,{type:"submit",children:"Save"})]})}function kH(){const e=te(),t=ji(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(wi(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(()=>ce({color:"green",message:"Saved"})).catch(c=>{var d,f,h,m;const u=ot(c);ce({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(le,{children:"Project Sites"}),a.jsx("p",{children:"Use project sites configure your project on a separate domain."}),a.jsx(Ma,{property:ys("Project","site"),name:"site",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(Z,{type:"submit",children:"Save"})]})}function RH(){const e=te();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(eo,{outcome:EE});function t(){ol(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function n(){ol(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function r(){ol(e,"Rebuilding Value Sets","admin/super/valuesets")}function o(u){ol(e,"Reindexing Resources","admin/super/reindex",u)}function i(u){ol(e,"Rebuilding Compartments","admin/super/compartments",u)}function s(u){e.post("admin/super/removebotidjobsfromqueue",u).then(()=>ce({color:"green",message:"Done"})).catch(d=>ce({color:"red",message:ke(d),autoClose:!1}))}function l(u){e.post("admin/super/purge",{...u,before:ST(u.before)}).then(()=>ce({color:"green",message:"Done"})).catch(d=>ce({color:"red",message:ke(d),autoClose:!1}))}function c(u){e.post("admin/super/setpassword",u).then(()=>ce({color:"green",message:"Done"})).catch(d=>ce({color:"red",message:ke(d),autoClose:!1}))}return a.jsxs(we,{width:600,children:[a.jsx(le,{order:1,children:"Super Admin"}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{children:a.jsx(Z,{onClick:t,children:"Rebuild StructureDefinitions"})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{children:a.jsx(Z,{onClick:n,children:"Rebuild SearchParameters"})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{children:a.jsx(Z,{onClick:r,children:"Rebuild ValueSets"})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{onSubmit:o,children:a.jsxs(Se,{children:[a.jsx(et,{title:"Resource Type",children:a.jsx(oe,{name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(Z,{type:"submit",children:"Reindex"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{onSubmit:i,children:a.jsxs(Se,{children:[a.jsx(et,{title:"Resource Type",children:a.jsx(oe,{name:"resourceType",placeholder:"Compartments Resource Type"})}),a.jsx(Z,{type:"submit",children:"Rebuild Compartments"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{onSubmit:l,children:a.jsxs(Se,{children:[a.jsx(et,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(ct,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(et,{title:"Purge Before",htmlFor:"before",children:a.jsx(Zi,{name:"before",placeholder:"Before Date"})}),a.jsx(Z,{type:"submit",children:"Purge"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{order:2,children:"Remove Bot ID Jobs from Queue"}),a.jsx("p",{children:"Remove all queued jobs for a Bot ID"}),a.jsx(Le,{onSubmit:s,children:a.jsxs(Se,{children:[a.jsx(et,{title:"Bot ID",children:a.jsx(oe,{name:"botId",placeholder:"Bot Id"})}),a.jsx(Z,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{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(Le,{onSubmit:c,children:a.jsxs(Se,{children:[a.jsx(oe,{name:"email",label:"Email",required:!0}),a.jsx(Pr,{name:"password",label:"Password",required:!0}),a.jsx(oe,{name:"projectId",label:"Project ID"}),a.jsx(Z,{type:"submit",children:"Force Set Password"})]})})]})}function ol(e,t,n,r){Kr.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(()=>{Kr.update({id:n,color:"green",title:t,message:"Done",icon:a.jsx(Rf,{size:"1rem"}),autoClose:!1,withCloseButton:!0})}).catch(i=>{Kr.update({id:n,color:"red",title:t,message:ke(i),icon:a.jsx(pd,{size:"1rem"}),autoClose:!1,withCloseButton:!0})})}function DH(){const e=te();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(eo,{outcome:EE});function t(n){e.post("admin/projects/setpassword",n).then(()=>ce({color:"green",message:"Done"})).catch(r=>ce({color:"red",message:ke(r),autoClose:!1}))}return a.jsxs(we,{width:600,children:[a.jsx(le,{order:1,children:"Project Admin"}),a.jsx(Tn,{my:"lg"}),a.jsx(le,{order:2,children:"Force Set Password"}),a.jsxs(se,{children:["Sets the password for the specified user ",a.jsx(se,{w:500,children:"in this project"}),"."]}),a.jsx(se,{children:"This action can only be performed by project administrators. Passwords can only be set for users scoped in this project."}),a.jsx(Le,{onSubmit:t,children:a.jsxs(Se,{children:[a.jsx(oe,{name:"email",label:"Email",required:!0}),a.jsx(Pr,{name:"password",label:"Password",required:!0}),a.jsx(Z,{type:"submit",children:"Force Set Password"})]})})]})}function IH(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Users"}),a.jsx(Hf,{resourceType:"Practitioner",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ie,{to:"/admin/invite",children:"Invite new user"})})]})}function _H(){const[e]=xa("ObservationDefinition","_count=100");return e?a.jsxs(he,{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(Yr,{value:(n=t.category)==null?void 0:n[0]})}),a.jsx("td",{children:a.jsx(Yr,{value:t.code})}),a.jsx("td",{children:a.jsx(Yr,{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(Pm,{ranges:t.qualifiedInterval})})]},t.id)})})]}):a.jsx(Ir,{})}function Pm(e){const{ranges:t}=e;if(!t)return null;const n=Dw(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:tn(o)})}),a.jsx(Pm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>s.gender===o)})]},o)})});const r=Dw(t.map(o=>o.age&&Hl(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:tn(o)})}),a.jsx(Pm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>Hl(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(Tv,{value:o.range})})]})})},`range-${o.condition}`))})}function Dw(e){return[...new Set(e.filter(t=>!!t))]}function AH(){const[e]=xa("ActivityDefinition","_count=100"),[t]=xa("ObservationDefinition","_count=100");return!e||!t?a.jsx(Ir,{}):a.jsxs(he,{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(Yr,{value:(r=n.category)==null?void 0:r[0]})}),a.jsx("td",{children:a.jsx(Yr,{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 NH(e){var s;const t=te(),[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(Ie,{to:o,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx(Ie,{to:e.planDefinition,children:"Plan Definition"})]})]})]}):a.jsx(Le,{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(le,{children:['Start "',e.planDefinition.title,'"']}),a.jsxs(se,{children:["Use the ",a.jsx("strong",{children:"Apply"})," operation to create a group of tasks for a workflow."]}),a.jsx(se,{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(Yr,{value:l.code[0]})]},`action-${c}`)})}),a.jsx(et,{title:"Subject",children:a.jsx(Nf,{name:"subject",targetTypes:["Patient","Practitioner"],defaultValue:n,onChange:r})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Go"})})]})})}function OH(){const{resourceType:e,id:t}=qe(),n=tt({reference:e+"/"+t});return n?a.jsx(we,{children:a.jsx(NH,{planDefinition:n})}):null}function MH(){const{resourceType:e,id:t}=qe(),n=tt({reference:e+"/"+t}),[r,o]=xa("Questionnaire","subject-type="+e),[i,s]=xa("ClientApplication",{_count:1e3});if(!n||o||s)return a.jsx(Ir,{});const l=i==null?void 0:i.filter(d=>LH(e)&&!!d.launchUri);if((!r||r.length===0)&&(!l||l.length===0))return a.jsxs(we,{children:[a.jsx(le,{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=mt(n):n.resourceType==="Encounter"&&(c=n.subject,u=mt(n)),a.jsxs(we,{children:[r==null?void 0:r.map(d=>a.jsxs("div",{children:[a.jsx(le,{order:3,children:a.jsx(Ie,{to:`/forms/${d.id}?subject=${at(n)}`,children:d.title||d.name})}),a.jsx(se,{children:d.description})]},d.id)),l==null?void 0:l.map(d=>a.jsxs("div",{children:[a.jsx(le,{order:3,children:a.jsx(yB,{client:d,patient:c,encounter:u,children:d.name})}),a.jsx(se,{children:d.description})]},d.id))]})}function LH(e){return e==="Patient"||e==="Encounter"}function $H(){const{resourceType:e,id:t}=qe(),n=Tt(),[r,o]=p.useState({resourceType:"AuditEvent",filters:[{code:"entity",operator:ne.EQUALS,value:`${e}/${t}`}],fields:["id","outcome","outcomeDesc","_lastUpdated"],sortRules:[{code:"-_lastUpdated"}],count:20});return a.jsx(we,{children:a.jsx(Pc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function FH(){const e=te(),{resourceType:t,id:n}=qe(),r=e.readHistory(t,n).read();return a.jsx(we,{children:a.jsx(lB,{history:r})})}const zH="_hl7Input_k5xm3_1",BH={hl7Input:zH};function UH(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 VH(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=>{Ru(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const HH=`{
225
- "resourceType": "Patient",
226
- "name": [
227
- {
228
- "given": [
229
- "Alice"
230
- ],
231
- "family": "Smith"
232
- }
233
- ]
234
- }`,WH="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 qH(){const e=te(),{id:t}=qe(),[n,r]=p.useState(),[o,i]=p.useState(),[s,l]=p.useState(HH),[c,u]=p.useState(WH),[d,f]=p.useState(Qt.FHIR_JSON),h=p.useRef(null),m=p.useRef(null),[g,y]=p.useState(!1);p.useEffect(()=>{e.readResource("Bot",t).then(async j=>{r(j),i(await GH(e,j))}).catch(j=>ce({color:"red",message:ke(j),autoClose:!1}))},[e,t]);const C=p.useCallback(()=>Ru(h.current,{command:"getValue"}),[]),v=p.useCallback(()=>Ru(h.current,{command:"getOutput"}),[]),w=p.useCallback(async()=>d===Qt.FHIR_JSON?JSON.parse(s):c,[d,s,c]),x=p.useCallback(async j=>{j.preventDefault(),j.stopPropagation(),y(!0);try{const T=await C(),P=await e.createAttachment(T,"index.ts","text/typescript"),R=[];n!=null&&n.sourceCode?R.push({op:"replace",path:"/sourceCode",value:P}):R.push({op:"add",path:"/sourceCode",value:P}),await e.patchResource("Bot",t,R),ce({color:"green",message:"Saved"})}catch(T){ce({color:"red",message:ke(T),autoClose:!1})}finally{y(!1)}},[e,t,n,C]),S=p.useCallback(async j=>{j.preventDefault(),j.stopPropagation(),y(!0);try{const T=await v();await e.post(e.fhirUrl("Bot",t,"$deploy"),{code:T}),ce({color:"green",message:"Deployed"})}catch(T){ce({color:"red",message:ke(T),autoClose:!1})}finally{y(!1)}},[e,t,v]),E=p.useCallback(async j=>{j.preventDefault(),j.stopPropagation(),y(!0);try{const T=await w(),P=await e.post(e.fhirUrl("Bot",t,"$execute"),T,d);await Ru(m.current,{command:"setValue",value:P}),ce({color:"green",message:"Success"})}catch(T){ce({color:"red",message:ke(T),autoClose:!1})}finally{y(!1)}},[e,t,w,d]);return!n||o===void 0?null:a.jsxs(Un,{m:0,gutter:0,style:{overflow:"hidden"},children:[a.jsx(Un.Col,{span:8,children:a.jsxs(_n,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(VH,{iframeRef:h,language:"typescript",module:"commonjs",testId:"code-frame",defaultValue:o,minHeight:"528px"}),a.jsxs(Y,{justify:"flex-end",gap:"xs",children:[a.jsx(Z,{type:"button",onClick:x,loading:g,leftSection:a.jsx(b$,{size:"1rem"}),children:"Save"}),a.jsx(Z,{type:"button",onClick:S,loading:g,leftSection:a.jsx(yv,{size:"1rem"}),children:"Deploy"}),a.jsx(Z,{type:"button",onClick:E,loading:g,leftSection:a.jsx($$,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(Un.Col,{span:4,children:[a.jsxs(_n,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(ct,{data:[{label:"FHIR",value:Qt.FHIR_JSON},{label:"HL7",value:Qt.HL7_V2}],onChange:j=>f(j.currentTarget.value)}),d===Qt.FHIR_JSON?a.jsx(hs,{value:s,onChange:j=>l(j),autosize:!0,minRows:15}):a.jsx("textarea",{className:BH.hl7Input,value:c,onChange:j=>u(j.currentTarget.value),rows:15})]}),a.jsx(_n,{m:2,p:"xs",shadow:"md",children:a.jsx(UH,{iframeRef:m,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function GH(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(DE);return(await e.download(e.fhirUrl("Binary",i))).text()}return t.code??""}function $a(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function QH(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 KH(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 YH(){const e=te(),{resourceType:t,id:n}=qe(),r={reference:t+"/"+n},o=p.useCallback(i=>{e.updateResource($a(i)).then(()=>{ce({color:"green",message:"Success"})}).catch(s=>{ce({color:"red",message:ke(s),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(we,{children:a.jsx(LF,{value:r,onSubmit:o})});case"Questionnaire":return a.jsx(we,{children:a.jsx(wz,{questionnaire:r,onSubmit:o})});default:return null}}function XH(){const{resourceType:e,id:t}=qe(),n=tt({reference:e+"/"+t}),r=Tt();return n?a.jsx(we,{children:a.jsx(Hz,{value:n,onStart:(o,i)=>r(`/forms/${Jy(i)}`),onEdit:(o,i,s)=>r(`/${s.reference}}`)})}):null}function JH(){const e=te(),{resourceType:t,id:n}=qe(),r=Tt();return a.jsxs(we,{children:[a.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),a.jsx(Z,{color:"red",onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)).catch(o=>ce({color:"red",message:ke(o),autoClose:!1}))},children:"Delete"})]})}function ZH(){const{resourceType:e,id:t}=qe(),n=tt({reference:e+"/"+t});return n?a.jsx(we,{children:a.jsx(Mv,{value:n})}):null}function eW(){const e=te(),{resourceType:t,id:n}=qe(),[r,o]=p.useState(),i=Tt(),[s,l]=p.useState();p.useEffect(()=>{e.readResource(t,n).then(d=>o(wi(d))).catch(d=>{l(ot(d)),ce({color:"red",message:ke(d),autoClose:!1})})},[e,t,n]);const c=p.useCallback(d=>{l(void 0),e.updateResource($a(d)).then(()=>{i(`/${t}/${n}/details`),ce({color:"green",message:"Success"})}).catch(f=>{l(ot(f)),ce({color:"red",message:ke(f),autoClose:!1})})},[e,t,n,i]),u=p.useCallback(()=>i(`/${t}/${n}/delete`),[i,t,n]);return r?a.jsx(we,{children:a.jsx(Hv,{defaultValue:r,onSubmit:c,onDelete:u,outcome:s})}):null}function tW(){const e=te(),{resourceType:t,id:n}=qe(),r=e.readHistory(t,n).read();return a.jsx(we,{children:a.jsx(hB,{history:r})})}function nW(){const e=te(),{resourceType:t,id:n}=qe(),r=tt({reference:t+"/"+n}),o=Tt(),[i,s]=p.useState(),l=p.useCallback(c=>{e.updateResource($a(JSON.parse(c.resource))).then(()=>{s(void 0),o(`/${t}/${n}/details`),ce({color:"green",message:"Success"})}).catch(u=>{ce({color:"red",message:ke(u),autoClose:!1})})},[e,t,n,o]);return r?a.jsxs(we,{children:[i&&a.jsx(eo,{outcome:i}),a.jsxs(Le,{onSubmit:l,children:[a.jsx(hs,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:On(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"OK"})})]})]}):null}function rW(){const{resourceType:e,id:t}=qe();return tt({reference:e+"/"+t})?a.jsxs(we,{children:[a.jsxs(ds,{icon:a.jsx(bc,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx($e,{href:`/forms/${t}`,children:`/forms/${t}`})]}),a.jsx(uP,{questionnaire:{reference:e+"/"+t},onSubmit:()=>alert("You submitted the preview")})]}):null}function oW(){const e=te(),{id:t}=qe(),[n,r]=p.useState(),[o,i]=p.useState(0),s=e.searchResources("Subscription","status=active&_count=100").read().filter(c=>iW(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:at(n)}}).then(()=>{r(void 0),i(Date.now()),e.invalidateSearches("Subscription"),ce({color:"green",message:"Success"})}).catch(c=>ce({color:"red",message:ke(c),autoClose:!1}))}return a.jsxs(we,{children:[a.jsx(le,{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(Ec,{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(le,{children:"Connect to bot"}),a.jsxs(Y,{children:[a.jsx(Oa,{name:"bot",resourceType:"Bot",onChange:c=>r(c)}),a.jsx(Z,{onClick:l,children:"Connect"})]}),a.jsx("div",{style:{display:"none"},children:o})]})}function iW(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 sW(){const{id:e}=qe(),t=Tt(),[n,r]=p.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:ne.EQUALS,value:"Questionnaire/"+e}],fields:["id","_lastUpdated"]});return a.jsx(we,{children:a.jsx(Pc,{search:n,onClick:o=>t(`/${o.resource.resourceType}/${o.resource.id}`),onChange:o=>r(o.definition),hideFilters:!0,hideToolbar:!0})})}function aW(){const e=te(),{resourceType:t,id:n}=qe(),r=tt({reference:t+"/"+n}),o=p.useCallback(i=>{e.updateResource($a(i)).then(()=>{ce({color:"green",message:"Success"})}).catch(s=>{ce({color:"red",message:ke(s),autoClose:!1})})},[e]);return r?a.jsx(we,{children:a.jsx(Mz,{onSubmit:o,definition:r})}):null}function lW(){const{resourceType:e,id:t}=qe(),n=tt({reference:e+"/"+t});return n?a.jsx(we,{children:e==="MeasureReport"?a.jsx(IF,{measureReport:n}):a.jsx(Dv,{value:n})}):null}const cW="_container_1ue98_1",uW="_entry_1ue98_14",dW="_active_1ue98_21",Xh={container:cW,entry:uW,active:dW};function fW(e){const t=te(),n=tt(e.value),[r,o]=p.useState();return p.useEffect(()=>{if(!n)return;const i=Jv(n);if(!i)return;const s="reference"in i?i.reference:at(i);t.search("ServiceRequest","subject="+s).then(l=>{const u=l.entry.map(d=>d.resource);VT(u),u.reverse(),o(u)}).catch(l=>ce({color:"red",message:ke(l),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:Xh.container,children:r.map(i=>{var s,l,c,u,d,f,h;return a.jsxs("div",{className:We(Xh.entry,{[Xh.active]:i.id===(n==null?void 0:n.id)}),children:[a.jsx("p",{children:a.jsx(Ie,{to:i,children:hW(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:pW(i)})]},i.id)})}):null}function hW(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function pW(e){var t;return e.authoredOn?e.authoredOn.substring(0,10):(t=e.meta)!=null&&t.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const mW="_container_1l2dh_1",gW={container:mW};function yW(e){var o,i,s,l;const t=tt(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:gW.container,children:a.jsx(ct,{defaultValue:e.defaultValue,onChange:c=>e.onChange(c.currentTarget.value),data:n})})}function vW(e){var n,r;const t=tt(e.specimen);return t?a.jsxs(Pe,{children:[a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Type"}),a.jsx(Pe.Value,{children:"Specimen"})]}),a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Collected"}),a.jsx(Pe.Value,{children:Mn((n=t.collection)==null?void 0:n.collectedDateTime)})]}),a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Specimen Age"}),a.jsx(Pe.Value,{children:xW(t)})]}),(r=t.collection)!=null&&r.collectedDateTime&&t.receivedTime?a.jsxs(Pe.Entry,{children:[a.jsx(Pe.Key,{children:"Specimen Stability"}),a.jsx(Pe.Value,{children:wW(t)})]}):a.jsx(a.Fragment,{})]}):null}function xW(e){var o;const t=(o=e.collection)==null?void 0:o.collectedDateTime;if(!t)return;const n=new Date(t);return ek(tk(n,new Date))}function wW(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 ek(tk(t,n))}function ek(e){return e.toString().padStart(3,"0")+"D"}function tk(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function SW(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"),t.push("Details","Edit","Event","History","Blame","JSON","Apps","Profiles"),t}const bW=["Profiles"];function CW(){var x,S,E,j,T,P,R;const e=te(),{resourceType:t,id:n}=qe(),r={reference:t+"/"+n},o=Tt(),[i,s]=p.useState(),l=tt(r,s),c=SW(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=_t();async function h(){var D,N;const O=(N=(D=(await e.readHistory(t,n)).entry)==null?void 0:D.find(L=>!!L.resource))==null?void 0:N.resource;O?m(O):ce({color:"red",message:"No history to restore",autoClose:!1})}function m(I){e.updateResource($a(I)).then(()=>{s(void 0),ce({color:"green",message:"Success"})}).catch(O=>{ce({color:"red",message:ke(O),autoClose:!1})})}if(i)return L5(i)?a.jsxs(we,{children:[a.jsx(le,{children:"Deleted"}),a.jsx("p",{children:"The resource was deleted."}),a.jsx(Z,{color:"red",onClick:h,children:"Restore"})]}):a.jsx(eo,{outcome:i});function g(I){I||(I=c[0].toLowerCase()),d(I),o(`/${t}/${n}/${I}`)}function y(I){const O=l,D=O.orderDetail||[];D.length===0&&D.push({}),D[0].text!==I&&(D[0].text=I,m({...O,orderDetail:D}))}const C=l&&Jv(l),v=l&&JV(l),w=(E=(S=(x=e.getUserConfiguration())==null?void 0:x.option)==null?void 0:S.find(I=>I.id==="statusValueSet"))==null?void 0:E.valueString;return a.jsxs(a.Fragment,{children:[(l==null?void 0:l.resourceType)==="ServiceRequest"&&w&&a.jsx(yW,{valueSet:{reference:w},defaultValue:(T=(j=l.orderDetail)==null?void 0:j[0])==null?void 0:T.text,onChange:y},at(l)+"-"+((R=(P=l.orderDetail)==null?void 0:P[0])==null?void 0:R.text)),l&&a.jsx(fW,{value:l}),l&&a.jsxs(_n,{children:[C&&a.jsx(YP,{patient:C}),v&&a.jsx(vW,{specimen:v}),t!=="Patient"&&a.jsx(XP,{resource:r}),a.jsx(dr,{children:a.jsx(ze,{value:u.toLowerCase(),onChange:g,children:a.jsx(ze.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:c.map(I=>a.jsx(ze.Tab,{value:I.toLowerCase(),children:bW.includes(I)?a.jsxs(Y,{gap:"xs",wrap:"nowrap",children:[I,a.jsx(rf,{color:f.primaryColor,size:"sm",children:"Beta"})]}):I},I))})})})]}),a.jsx(Gv,{})]})}function Iw(){var v,w,x,S;const e=Tt(),{resourceType:t,id:n,versionId:r,tab:o}=qe(),i=te(),[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(E=>u(E)).then(()=>l(!1)).catch(E=>{f(E),l(!1)})},[i,t,n]),s)return a.jsx(Ir,{});if(!c)return a.jsxs(we,{children:[a.jsx(le,{children:"Resource not found"}),a.jsx(Ie,{to:`/${t}`,children:"Return to search page"})]});const h=c.entry,m=h.findIndex(E=>{var j,T;return((T=(j=E.resource)==null?void 0:j.meta)==null?void 0:T.versionId)===r});if(m===-1)return a.jsxs(we,{children:[a.jsx(le,{children:"Version not found"}),a.jsx(Ie,{to:`/${t}/${n}`,children:"Return to resource"})]});const g=h[m].resource,y=m<h.length-1?h[m+1].resource:void 0,C="diff";return a.jsx(a.Fragment,{children:a.jsxs(ze,{value:o||C,onChange:E=>e(`/${t}/${n}/_history/${r}/${E||C}`),children:[a.jsxs(_n,{children:[a.jsx(jc,{fluid:!0,p:"md",children:a.jsx(se,{children:`${t} ${n}`})}),a.jsxs(ze.List,{children:[a.jsx(ze.Tab,{value:"diff",children:"Diff"}),a.jsx(ze.Tab,{value:"raw",children:"Raw"})]})]}),a.jsxs(we,{children:[d&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(d,void 0,2)}),a.jsx(ze.Panel,{value:"diff",children:y?a.jsxs(a.Fragment,{children:[a.jsxs("ul",{children:[a.jsxs("li",{children:["Current: ",(v=g.meta)==null?void 0:v.versionId]}),a.jsxs("li",{children:["Previous:"," ",a.jsx(Ie,{to:`/${t}/${n}/_history/${(w=y.meta)==null?void 0:w.versionId}`,children:(x=y.meta)==null?void 0:x.versionId})]})]}),a.jsx(dB,{original:y,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(ze.Panel,{value:"raw",children:a.jsx("pre",{children:JSON.stringify(g,void 0,2)})})]})]})})}function jW(){const{resourceType:e,id:t}=qe(),n=Tt(),[r,o]=p.useState({resourceType:"Subscription",filters:[{code:"url",operator:ne.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(we,{children:a.jsx(Pc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function _w(){const{resourceType:e,id:t}=qe(),n={reference:e+"/"+t};switch(e){case"Encounter":return a.jsx(k8,{encounter:n});case"Patient":return a.jsx(_F,{patient:n});case"ServiceRequest":return a.jsx(gB,{serviceRequest:n});default:return a.jsx(P8,{resource:n})}}function nk(e,t){const n=te(),r=Tt();return{defaultValue:{resourceType:e},handleSubmit:s=>{t&&t(void 0),n.createResource(s).then(l=>r("/"+l.resourceType+"/"+l.id)).catch(l=>{t&&t(ot(l))})}}}function Aw(){const{resourceType:e}=qe(),[t,n]=p.useState(),{defaultValue:r,handleSubmit:o}=nk(e,n);return a.jsx(we,{children:a.jsx(Hv,{defaultValue:r,onSubmit:o,outcome:t})})}function EW(){const{resourceType:e}=qe(),[t,n]=p.useState(),{defaultValue:r,handleSubmit:o}=nk(e,n),i=p.useCallback(s=>{o(JSON.parse(s["new-resource"]))},[o]);return a.jsxs(we,{children:[t&&a.jsx(eo,{outcome:t}),a.jsxs(Le,{onSubmit:i,children:[a.jsx(hs,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:On(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"OK"})})]})]})}function TW(){const e=te(),{resourceType:t,id:n}=qe(),[r,o]=p.useState(),[i,s]=p.useState(),[l,c]=p.useState();return p.useEffect(()=>{e.readResource(t,n).then(u=>o(wi(u))).catch(u=>{ce({color:"red",message:ke(u)})})},[e,t,n]),p.useEffect(()=>{e.searchResources("StructureDefinition",{type:t,derivation:"constraint",_count:50}).then(u=>{c(u.filter(Y7))}).catch(console.error)},[e,t]),r?a.jsxs(we,{children:[a.jsxs(le,{order:2,children:["Available ",t," profiles"]}),a.jsx(Se,{children:a.jsxs(a.Fragment,{children:[a.jsx(ze,{value:i==null?void 0:i.url,onChange:u=>s(l==null?void 0:l.find(d=>d.url===u)),children:a.jsx(ze.List,{children:l==null?void 0:l.map(u=>{var h,m;const d=(m=(h=r.meta)==null?void 0:h.profile)==null?void 0:m.includes(u.url),f=d?"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(ze.Tab,{value:u.url,title:f,rightSection:d&&a.jsx(Ky,{variant:"outline",color:"green",size:"xs",style:{borderStyle:"none"},children:a.jsx(x$,{size:"90%"})}),children:u.title||u.name},u.url)})})}),i?a.jsx(PW,{profile:i,resource:r,onResourceUpdated:u=>o(u)},i.url):a.jsx(se,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const PW=({profile:e,resource:t,onResourceUpdated:n})=>{const r=te(),[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=$a(u);s?QH(d,e.url):KH(d,e.url),r.updateResource(d).then(f=>{n(f),ce({color:"green",message:"Success"})}).catch(f=>{i(ot(f)),ce({color:"red",message:ke(f)})})},[r,e.url,n,s]);return a.jsxs(Se,{children:[a.jsx(pc,{size:"md",checked:s,label:`Conform resource to ${e.title}`,onChange:u=>l(u.currentTarget.checked),"data-testid":"profile-toggle"}),s?a.jsx(Hv,{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(Z,{type:"submit",children:"OK"})})})]})};function kW(){return a.jsx(NU,{children:a.jsxs(de,{errorElement:a.jsx(qV,{}),children:[a.jsx(de,{path:"/signin",element:a.jsx(gH,{})}),a.jsx(de,{path:"/oauth",element:a.jsx(dH,{})}),a.jsx(de,{path:"/resetpassword",element:a.jsx(hH,{})}),a.jsx(de,{path:"/setpassword/:id/:secret",element:a.jsx(mH,{})}),a.jsx(de,{path:"/register",element:a.jsx(fH,{})}),a.jsx(de,{path:"/changepassword",element:a.jsx(HV,{})}),a.jsx(de,{path:"/security",element:a.jsx(pH,{})}),a.jsx(de,{path:"/mfa",element:a.jsx(uH,{})}),a.jsx(de,{path:"/batch",element:a.jsx(UV,{})}),a.jsx(de,{path:"/bulk/:resourceType",element:a.jsx(VV,{})}),a.jsx(de,{path:"/smart",element:a.jsx(yH,{})}),a.jsx(de,{path:"/forms/:id",element:a.jsx(eH,{})}),a.jsx(de,{path:"/admin/super",element:a.jsx(RH,{})}),a.jsx(de,{path:"/admin/config",element:a.jsx(DH,{})}),a.jsxs(de,{path:"/admin",element:a.jsx(TH,{}),children:[a.jsx(de,{path:"patients",element:a.jsx(EH,{})}),a.jsx(de,{path:"bots/new",element:a.jsx(wH,{})}),a.jsx(de,{path:"bots",element:a.jsx(vH,{})}),a.jsx(de,{path:"clients/new",element:a.jsx(SH,{})}),a.jsx(de,{path:"clients",element:a.jsx(xH,{})}),a.jsx(de,{path:"details",element:a.jsx(kw,{})}),a.jsx(de,{path:"invite",element:a.jsx(jH,{})}),a.jsx(de,{path:"users",element:a.jsx(IH,{})}),a.jsx(de,{path:"project",element:a.jsx(kw,{})}),a.jsx(de,{path:"secrets",element:a.jsx(PH,{})}),a.jsx(de,{path:"sites",element:a.jsx(kH,{})}),a.jsx(de,{path:"members/:membershipId",element:a.jsx(CH,{})})]}),a.jsx(de,{path:"/lab/assays",element:a.jsx(_H,{})}),a.jsx(de,{path:"/lab/panels",element:a.jsx(AH,{})}),a.jsx(de,{path:"/:resourceType/:id/_history/:versionId/:tab",element:a.jsx(Iw,{})}),a.jsx(de,{path:"/:resourceType/:id/_history/:versionId",element:a.jsx(Iw,{})}),a.jsxs(de,{path:"/:resourceType/new",element:a.jsx(WV,{}),children:[a.jsx(de,{index:!0,element:a.jsx(Aw,{})}),a.jsx(de,{path:"form",element:a.jsx(Aw,{})}),a.jsx(de,{path:"json",element:a.jsx(EW,{})})]}),a.jsxs(de,{path:"/:resourceType/:id",element:a.jsx(CW,{}),children:[a.jsx(de,{index:!0,element:a.jsx(_w,{})}),a.jsx(de,{path:"apply",element:a.jsx(OH,{})}),a.jsx(de,{path:"apps",element:a.jsx(MH,{})}),a.jsx(de,{path:"event",element:a.jsx($H,{})}),a.jsx(de,{path:"blame",element:a.jsx(FH,{})}),a.jsx(de,{path:"bots",element:a.jsx(oW,{})}),a.jsx(de,{path:"builder",element:a.jsx(YH,{})}),a.jsx(de,{path:"checklist",element:a.jsx(XH,{})}),a.jsx(de,{path:"delete",element:a.jsx(JH,{})}),a.jsx(de,{path:"details",element:a.jsx(ZH,{})}),a.jsx(de,{path:"edit",element:a.jsx(eW,{})}),a.jsx(de,{path:"editor",element:a.jsx(qH,{})}),a.jsx(de,{path:"history",element:a.jsx(tW,{})}),a.jsx(de,{path:"json",element:a.jsx(nW,{})}),a.jsx(de,{path:"preview",element:a.jsx(rW,{})}),a.jsx(de,{path:"responses",element:a.jsx(sW,{})}),a.jsx(de,{path:"report",element:a.jsx(lW,{})}),a.jsx(de,{path:"ranges",element:a.jsx(aW,{})}),a.jsx(de,{path:"subscriptions",element:a.jsx(jW,{})}),a.jsx(de,{path:"timeline",element:a.jsx(_w,{})}),a.jsx(de,{path:"profiles",element:a.jsx(TW,{})})]}),a.jsx(de,{path:"/:resourceType",element:a.jsx(Pw,{})}),a.jsx(de,{path:"/",element:a.jsx(Pw,{})})]})})}function RW(){const e=te(),t=e.getUserConfiguration(),n=bi(),[r]=Qv();return e.isLoading()?a.jsx(Ir,{}):a.jsx(O7,{logo:a.jsx(Or,{size:24}),pathname:n.pathname,searchParams:r,version:LL,menus:DW(t),displayAddBookmark:!!(t!=null&&t.id),children:a.jsx(p.Suspense,{fallback:a.jsx(Ir,{}),children:a.jsx(kW,{})})})}function DW(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:IW(i.target)})))||[]}}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(I$,{})}]}),t}const Nw={Patient:W$,Practitioner:k$,Organization:g$,ServiceRequest:z$,DiagnosticReport:U$,Questionnaire:P$,admin:h$,AccessPolicy:D$,Subscription:Q$,batch:O$,Observation:N$};function IW(e){try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in Nw){const n=Nw[t];return a.jsx(n,{})}}catch{}return a.jsx(Sf,{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 _W(){const e=Ic(),t=new VL({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=LU([{path:"*",element:a.jsx(RW,{})}]),o=s=>r.navigate(s);wP(document.getElementById("root")).render(a.jsx(p.StrictMode,{children:a.jsx(QL,{medplum:t,navigate:o,children:a.jsxs(mS,{theme:n,children:[a.jsx(Ro,{position:"bottom-right"}),a.jsx(qU,{router:r})]})})}))}_W().catch(console.error);
235
- //# sourceMappingURL=index-W-csCEpX.js.map